@metamask/snaps-sdk
Version:
A library containing the core functionality for building MetaMask Snaps
1 lines • 1.69 kB
Source Map (JSON)
{"version":3,"file":"RadioGroup.cjs","sourceRoot":"","sources":["../../../../src/jsx/components/form/RadioGroup.ts"],"names":[],"mappings":";;;AAEA,mDAAsD;AAEtD,MAAM,IAAI,GAAG,YAAY,CAAC;AAkB1B;;;;;;;;;;;GAWG;AACU,QAAA,UAAU,GAAG,IAAA,+BAAmB,EAC3C,IAAI,CACL,CAAC","sourcesContent":["import type { RadioElement } from './Radio';\nimport type { SnapsChildren } from '../../component';\nimport { createSnapComponent } from '../../component';\n\nconst TYPE = 'RadioGroup';\n\n/**\n * The props of the {@link RadioGroup} component.\n *\n * @property name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @property value - The value of the radio group element.\n * @property children - Radio options in form of <Radio> elements.\n * @property disabled - Whether the radio group is disabled.\n */\ntype RadioGroupProps = {\n name: string;\n value?: string | undefined;\n children: SnapsChildren<RadioElement>;\n disabled?: boolean | undefined;\n};\n\n/**\n * A RadioGroup component, used to display multiple choices, where only one can be chosen.\n *\n * @param props.name - The name of the dropdown. This is used to identify the\n * state in the form data.\n * @param props.value - The value of the radio group element.\n * @param props.children - Radio options in form of <Radio> elements.\n * @param props.disabled - Whether the radio group is disabled.\n * @returns A RadioGroup element.\n * @example\n * <RadioGroup />\n */\nexport const RadioGroup = createSnapComponent<RadioGroupProps, typeof TYPE>(\n TYPE,\n);\n\n/**\n * A RadioGroup element.\n *\n * @see RadioGroup\n */\nexport type RadioGroupElement = ReturnType<typeof RadioGroup>;\n"]}