1import React from 'react';
2import { Input, AccessoryIcon } from 'indigo-react';
3import { useField } from 'react-final-form';
12} from 'form/formatters';
13import { DEFAULT_HD_PATH } from 'lib/constants';
14import InputSigil from 'components/InputSigil';
15import { StatelessTextInput } from '@tlon/indigo-react';
17const PLACEHOLDER_POINT = '~sampel-ponnym';
18const PLACEHOLDER_HD_PATH = DEFAULT_HD_PATH;
19const PLACEHOLDER_MNEMONIC =
20 'example crew supreme gesture quantum web media hazard theory mercy wing kitten';
21export const PLACEHOLDER_TICKET = '~sampel-ticlyt-migfun-falmel';
22const PLACEHOLDER_PASSWORD = '••••••-••••••-••••••-••••••';
23const PLACEHOLDER_ADDRESS = '0x';
24const PLACEHOLDER_HEX = '0x';
25const PLACEHOLDER_PRIVATE_KEY =
26 'a44de2416ee6beb2f323fab48b432925c9785808d33a6ca6d7ba00b45e9370c3';
27const PLACEHOLDER_EMAIL = 'email@example.com';
29const formatPat = buildFormatter([downcase, ensurePatFormat]);
31export function TicketInput({ name, hidden, ...rest }) {
33 meta: { valid, error, validating, touched, active },
46 type={hidden ? 'password' : 'text'}
48 obscure={value => value.replace(/[^~-]+/g, '••••••')}
49 placeholder={hidden ? PLACEHOLDER_PASSWORD : PLACEHOLDER_TICKET}
53 touched && !active && error ? (
54 <AccessoryIcon.Failure />
56 <AccessoryIcon.Pending />
58 <AccessoryIcon.Success />
61 config={{ parse: formatPat }}
68export function MnemonicInput({ ...rest }) {
72 placeholder={PLACEHOLDER_MNEMONIC}
81export function HdPathInput({ ...rest }) {
85 placeholder={PLACEHOLDER_HD_PATH}
94export function PassphraseInput({ ...rest }) {
98 placeholder="Passphrase"
106export function PointInput({ name, size = 4, ...rest }) {
109 meta: { active, valid, error },
111 subscription: { value: true, active: true, valid: true, error: true },
119 placeholder={PLACEHOLDER_POINT}
120 autoCapitalize="none"
134 config={{ parse: formatPat }}
141export function HexInput({ ...rest }) {
145 placeholder={PLACEHOLDER_HEX}
146 autoCapitalize="none"
150 config={{ parse: ensureHexPrefix }}
156export function PrivateKeyInput({ ...rest }) {
160 placeholder={PLACEHOLDER_PRIVATE_KEY}
161 config={{ parse: stripHexPrefix }}
167export function PsbtInput({ ...rest }) {
172 config={{ parse: stripHexPrefix }}
178export function AddressInput({ ...rest }) {
182 placeholder={PLACEHOLDER_ADDRESS}
183 autoCapitalize="none"
191export function NumberInput({ ...rest }) {
196 config={{ format: convertToNumber }}
202export function EmailInput({ ...rest }) {
206 placeholder={PLACEHOLDER_EMAIL}
207 autoCapitalize="none"
213export function TicketSegmentInput({ name, ...rest }) {
214 const { input } = useField(name);
218 autoCapitalize="none"
228export const HiddenInput = ({ ...rest }) => {
229 return <StatelessTextInput type="hidden" {...rest} />;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list