@yamada-ui/radio
Version:
Yamada UI radio component
1 lines • 1.99 kB
Source Map (JSON)
{"version":3,"sources":["../src/radio-context.ts"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n PropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport type { ChangeEvent } from \"react\"\nimport type { RadioCardProps } from \"./radio-card\"\nimport { createContext } from \"@yamada-ui/utils\"\n\ninterface RadioGroupSharedContext extends FormControlOptions {\n name: string\n value: number | string\n onChange: (evOrValue: ChangeEvent<HTMLInputElement> | number | string) => void\n}\n\nexport interface RadioGroupContext\n extends RadioGroupSharedContext,\n ThemeProps<\"Radio\"> {}\n\nexport const [RadioGroupProvider, useRadioGroupContext] =\n createContext<RadioGroupContext>({\n name: \"RadioGroupContext\",\n strict: false,\n })\n\nexport interface RadioCardGroupContext\n extends RadioGroupSharedContext,\n Pick<\n RadioCardProps,\n \"addonProps\" | \"descriptionProps\" | \"labelProps\" | \"withIcon\"\n >,\n ThemeProps<\"RadioCard\"> {}\n\nexport const [RadioCardGroupProvider, useRadioCardGroupContext] =\n createContext<RadioCardGroupContext>({\n name: \"RadioCardGroupContext\",\n strict: false,\n })\n\nexport interface RadioCardContext {\n styles: { [key: string]: CSSUIObject | undefined }\n withIcon: boolean\n getIconProps: PropGetter\n iconProps?: HTMLUIProps\n}\n\nexport const [RadioCardProvider, useRadioCardContext] =\n createContext<RadioCardContext>({\n name: \"RadioCardContext\",\n errorMessage: `useRadioCardContext returned is 'undefined'. Seems you forgot to wrap the components in \"<RadioCard />\"`,\n })\n"],"mappings":";;;AASA,SAAS,qBAAqB;AAYvB,IAAM,CAAC,oBAAoB,oBAAoB,IACpD,cAAiC;AAAA,EAC/B,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;AAUI,IAAM,CAAC,wBAAwB,wBAAwB,IAC5D,cAAqC;AAAA,EACnC,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;AASI,IAAM,CAAC,mBAAmB,mBAAmB,IAClD,cAAgC;AAAA,EAC9B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;","names":[]}