@metamask/snaps-sdk
Version:
A library containing the core functionality for building MetaMask Snaps
1 lines • 1.53 kB
Source Map (JSON)
{"version":3,"file":"AddressInput.cjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/AddressInput.ts"],"names":[],"mappings":";;;AAEA,mDAAsD;AAWtD,MAAM,IAAI,GAAG,cAAc,CAAC;AAE5B;;;;;;;;;;;;;GAaG;AACU,QAAA,YAAY,GAAG,IAAA,+BAAmB,EAC7C,IAAI,CACL,CAAC","sourcesContent":["import type { CaipChainId } from '@metamask/utils';\n\nimport { createSnapComponent } from '../../component';\n\nexport type AddressInputProps = {\n name: string;\n value?: string | undefined;\n chainId: CaipChainId;\n placeholder?: string | undefined;\n disabled?: boolean | undefined;\n displayAvatar?: boolean | undefined;\n};\n\nconst TYPE = 'AddressInput';\n\n/**\n * An input component for entering an address. Resolves the address to a display name and avatar.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the input field.\n * @param props.value - The value of the input field.\n * @param props.chainId - The CAIP-2 chain ID of the address.\n * @param props.placeholder - The placeholder text of the input field.\n * @param props.disabled - Whether the input field is disabled.\n * @param props.displayAvatar - Whether to display the avatar of the address.\n * @returns An input element.\n * @example\n * <AddressInput name=\"address\" value=\"0x1234567890123456789012345678901234567890\" chainId=\"eip155:1\" />\n */\nexport const AddressInput = createSnapComponent<AddressInputProps, typeof TYPE>(\n TYPE,\n);\n\nexport type AddressInputElement = ReturnType<typeof AddressInput>;\n"]}