1import React from 'react';
2import { Input, AccessoryIcon, Flex } from 'indigo-react';
3import cn from 'classnames';
4import { useField } from 'react-final-form';
13} from 'form/formatters';
14import { DEFAULT_HD_PATH } from 'lib/wallet';
15import InputSigil from 'components/InputSigil';
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';
21const PLACEHOLDER_TICKET = '~sampel-ticlyt-migfun-falmel';
22const PLACEHOLDER_ADDRESS = '0x';
23const PLACEHOLDER_HEX = '0x';
24const PLACEHOLDER_PRIVATE_KEY =
25 'a44de2416ee6beb2f323fab48b432925c9785808d33a6ca6d7ba00b45e9370c3';
26const PLACEHOLDER_EMAIL = 'email@example.com';
28const formatPat = buildFormatter([downcase, ensurePatFormat]);
30export function TicketInput({ name, ...rest }) {
32 meta: { valid, error, validating, touched, active },
47 obscure={value => value.replace(/[^~-]+/g, '••••••')}
48 placeholder={PLACEHOLDER_TICKET}
52 touched && !active && error ? (
53 <AccessoryIcon.Failure />
55 <AccessoryIcon.Pending />
57 <AccessoryIcon.Success />
60 config={{ parse: formatPat }}
67export function MnemonicInput({ ...rest }) {
71 placeholder={PLACEHOLDER_MNEMONIC}
80export function HdPathInput({ ...rest }) {
84 placeholder={PLACEHOLDER_HD_PATH}
93export function PassphraseInput({ ...rest }) {
97 placeholder="Passphrase"
105export function PointInput({ name, size = 4, ...rest }) {
108 meta: { active, valid, error },
110 subscription: { value: true, active: true, valid: true, error: true },
118 placeholder={PLACEHOLDER_POINT}
119 autoCapitalize="none"
133 config={{ parse: formatPat }}
140export function HexInput({ ...rest }) {
144 placeholder={PLACEHOLDER_HEX}
145 autoCapitalize="none"
149 config={{ parse: ensureHexPrefix }}
155export function PrivateKeyInput({ ...rest }) {
159 placeholder={PLACEHOLDER_PRIVATE_KEY}
160 config={{ parse: stripHexPrefix }}
166export function AddressInput({ ...rest }) {
170 placeholder={PLACEHOLDER_ADDRESS}
171 autoCapitalize="none"
179export function NumberInput({ ...rest }) {
184 config={{ format: convertToNumber }}
190export function EmailInput({ ...rest }) {
194 placeholder={PLACEHOLDER_EMAIL}
195 autoCapitalize="none"
201export const ColorInput = ({
208 const { input } = useField(name, { subscription: { value: true } });
210 const isWhite = c => c === '#FFFFFF';
212 // disabled = disabled || submitting || submitSucceeded;
214 <Flex col className={cn(className, 'flex-wrap mb1')}>
217 className={cn('f6 lh-tall', {
224 <div className="flex">
227 className={cn('m0 p0 h7 w7 p2 flex flex-center', {
228 'b b-black': isWhite(c),
230 style={{ backgroundColor: c }}
231 onClick={() => input.onChange(c)}>
232 {c === input.value ? (
235 { 'bg-black': isWhite(c), 'bg-white': !isWhite(c) },
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