@metamask/snaps-sdk
Version:
A library containing the core functionality for building MetaMask Snaps
1 lines • 1.67 kB
Source Map (JSON)
{"version":3,"file":"Link.cjs","sourceRoot":"","sources":["../../../src/jsx/components/Link.ts"],"names":[],"mappings":";;;AAIA,gDAAmD;AA0BnD,MAAM,IAAI,GAAG,MAAM,CAAC;AAEpB;;;;;;;;;;GAUG;AACU,QAAA,IAAI,GAAG,IAAA,+BAAmB,EAAyB,IAAI,CAAC,CAAC","sourcesContent":["import type { AddressElement } from './Address';\nimport type { StandardFormattingElement } from './formatting';\nimport { type IconElement } from './Icon';\nimport { type ImageElement } from './Image';\nimport { createSnapComponent } from '../component';\nimport type { SnapsChildren } from '../component';\n\n/**\n * The children of the {@link Link} component.\n */\nexport type LinkChildren = SnapsChildren<\n | string\n | StandardFormattingElement\n | IconElement\n | ImageElement\n | AddressElement\n>;\n\n/**\n * The props of the {@link Link} component.\n *\n * @property children - The text to display in the link.\n * @property href - The URL to link to. This must be an `https` or `mailto` URL.\n * `http` is not allowed.\n */\nexport type LinkProps = {\n children: LinkChildren;\n href: string;\n};\n\nconst TYPE = 'Link';\n\n/**\n * A link component, which is used to display a hyperlink.\n *\n * @param props - The props of the component.\n * @param props.children - The text to display in the link.\n * @param props.href - The URL to link to. This must be an `https` or `mailto`\n * URL. `http` is not allowed.\n * @returns A link element.\n * @example\n * <Link href=\"https://example.com\">Click here</Link>\n */\nexport const Link = createSnapComponent<LinkProps, typeof TYPE>(TYPE);\n\n/**\n * A link element.\n *\n * @see Link\n */\nexport type LinkElement = ReturnType<typeof Link>;\n"]}