{"version":3,"file":"radio-card.cjs","names":["createSlotComponent","radioCardStyle","useRadio","useInputBorder","styled"],"sources":["../../../../src/components/radio-card/radio-card.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type { GenericsComponent, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UseRadioProps } from \"../radio\"\nimport type { RadioCardStyle } from \"./radio-card.style\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useInputBorder } from \"../input\"\nimport { useRadio } from \"../radio\"\nimport { radioCardStyle } from \"./radio-card.style\"\n\nexport interface RadioCardRootProps<Y extends string = string>\n  extends Merge<HTMLStyledProps<\"label\">, UseRadioProps<Y>>,\n    ThemeProps<RadioCardStyle>,\n    UseInputBorderProps {\n  /**\n   * The addon of the radio card.\n   */\n  addon?: ReactNode\n  /**\n   * The description of the radio card.\n   */\n  description?: ReactNode\n  /**\n   * The label of the radio card.\n   */\n  label?: ReactNode\n  /**\n   * If `true`, the indicator will be displayed.\n   *\n   * @default true\n   */\n  withIndicator?: boolean\n  /**\n   * Props for the addon component.\n   */\n  addonProps?: RadioCardAddonProps\n  /**\n   * Props for the description component.\n   */\n  descriptionProps?: RadioCardDescriptionProps\n  /**\n   * Props for the indicator component.\n   */\n  indicatorProps?: RadioCardIndicatorProps\n  /**\n   * Props for the input element.\n   */\n  inputProps?: HTMLStyledProps<\"input\">\n  /**\n   * Props for the label component.\n   */\n  labelProps?: RadioCardLabelProps\n  /**\n   * Props for the label element.\n   */\n  rootProps?: HTMLStyledProps<\"label\">\n}\n\nconst {\n  component,\n  PropsContext: RadioCardPropsContext,\n  usePropsContext: useRadioCardPropsContext,\n  withContext,\n  withProvider,\n  useRootComponentProps,\n} = createSlotComponent<RadioCardRootProps, RadioCardStyle>(\n  \"radio-card\",\n  radioCardStyle,\n)\n\nexport {\n  component,\n  RadioCardPropsContext,\n  useRadioCardPropsContext,\n  useRootComponentProps,\n}\n\n/**\n * `RadioCard` is a component used for allowing users to select one option from multiple choices.\n *\n * @see https://yamada-ui.com/docs/components/radio-card\n */\nexport const RadioCardRoot = withProvider<\"label\", RadioCardRootProps>(\n  ({\n    addon,\n    children,\n    description,\n    errorBorderColor,\n    focusBorderColor,\n    label,\n    withIndicator = true,\n    addonProps,\n    descriptionProps,\n    indicatorProps,\n    inputProps,\n    labelProps,\n    rootProps,\n    ...rest\n  }) => {\n    const { getIndicatorProps, getInputProps, getRootProps } = useRadio(rest)\n    const varProps = useInputBorder({ errorBorderColor, focusBorderColor })\n    const computedChildren = useMemo(() => {\n      if (children) return children\n\n      return (\n        <>\n          {label ? (\n            <RadioCardLabel {...labelProps}>{label}</RadioCardLabel>\n          ) : null}\n          {description ? (\n            <RadioCardDescription {...descriptionProps}>\n              {description}\n            </RadioCardDescription>\n          ) : null}\n          {addon ? (\n            <RadioCardAddon {...addonProps}>{addon}</RadioCardAddon>\n          ) : null}\n        </>\n      )\n    }, [\n      addon,\n      addonProps,\n      children,\n      description,\n      descriptionProps,\n      label,\n      labelProps,\n    ])\n\n    return (\n      <styled.label {...getRootProps({ ...varProps, ...rootProps })}>\n        <styled.input {...getInputProps(inputProps)} />\n        {withIndicator ? (\n          <RadioCardIndicator {...getIndicatorProps(indicatorProps)} />\n        ) : null}\n\n        {computedChildren}\n      </styled.label>\n    )\n  },\n  \"root\",\n)() as GenericsComponent<{\n  <Y extends string = string>(props: RadioCardRootProps<Y>): ReactElement\n}>\n\ninterface RadioCardIndicatorProps extends HTMLStyledProps {}\n\nconst RadioCardIndicator = withContext<\"div\", RadioCardIndicatorProps>(\n  \"div\",\n  \"indicator\",\n)({ \"data-indicator\": \"\" })\n\nexport interface RadioCardLabelProps extends HTMLStyledProps {}\n\nexport const RadioCardLabel = withContext<\"span\", RadioCardLabelProps>(\n  \"span\",\n  \"label\",\n)()\n\nexport interface RadioCardDescriptionProps extends HTMLStyledProps {}\n\nexport const RadioCardDescription = withContext<\n  \"span\",\n  RadioCardDescriptionProps\n>(\"span\", \"description\")()\n\nexport interface RadioCardAddonProps extends HTMLStyledProps {}\n\nexport const RadioCardAddon = withContext<\"span\", RadioCardAddonProps>(\n  \"span\",\n  \"addon\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;AA8DA,MAAM,EACJ,WACA,cAAc,uBACd,iBAAiB,0BACjB,aACA,cACA,0BACEA,6CACF,cACAC,wCACD;;;;;;AAcD,MAAa,gBAAgB,cAC1B,EACC,OACA,UACA,aACA,kBACA,kBACA,OACA,gBAAgB,MAChB,YACA,kBACA,gBACA,YACA,YACA,UACA,GAAG,WACC;CACJ,MAAM,EAAE,mBAAmB,eAAe,iBAAiBC,2BAAS,KAAK;CACzE,MAAM,WAAWC,wCAAe;EAAE;EAAkB;EAAkB,CAAC;CACvE,MAAM,4CAAiC;AACrC,MAAI,SAAU,QAAO;AAErB,SACE;GACG,QACC,2CAAC;IAAe,GAAI;cAAa;KAAuB,GACtD;GACH,cACC,2CAAC;IAAqB,GAAI;cACvB;KACoB,GACrB;GACH,QACC,2CAAC;IAAe,GAAI;cAAa;KAAuB,GACtD;MACH;IAEJ;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QACE,4CAACC,uBAAO;EAAM,GAAI,aAAa;GAAE,GAAG;GAAU,GAAG;GAAW,CAAC;;GAC3D,2CAACA,uBAAO,SAAM,GAAI,cAAc,WAAW,GAAI;GAC9C,gBACC,2CAAC,sBAAmB,GAAI,kBAAkB,eAAe,GAAI,GAC3D;GAEH;;GACY;GAGnB,OACD,EAAE;AAMH,MAAM,qBAAqB,YACzB,OACA,YACD,CAAC,EAAE,kBAAkB,IAAI,CAAC;AAI3B,MAAa,iBAAiB,YAC5B,QACA,QACD,EAAE;AAIH,MAAa,uBAAuB,YAGlC,QAAQ,cAAc,EAAE;AAI1B,MAAa,iBAAiB,YAC5B,QACA,QACD,EAAE"}