{"version":3,"file":"RadioButton.cjs","sources":["../../../../src/components/radio-button/RadioButton.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport { useId } from \"../../hooks/useId/useId.js\";\nimport { SupportLabel } from \"../input-group/SupportLabel.js\";\nimport { BaseRadioButton } from \"./BaseRadioButton.js\";\nimport { useRadioGroupContext } from \"./radioGroupContext.js\";\nimport type { RadioButtonProps } from \"./types.js\";\n\nexport const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(\n    (props, ref) => {\n        const { checked, value, supportLabelProps, helpLabel, ...rest } = props;\n        const { value: selectedValue, ...context } = useRadioGroupContext();\n        const supportId = useId(\"jkl-support-label\");\n\n        return (\n            <>\n                <BaseRadioButton\n                    {...context}\n                    {...rest}\n                    ref={ref}\n                    checked={\n                        typeof checked !== \"undefined\"\n                            ? checked\n                            : typeof selectedValue !== \"undefined\"\n                              ? value === selectedValue\n                              : undefined\n                    }\n                    value={value}\n                    aria-describedby={helpLabel ? supportId : undefined}\n                />\n                <SupportLabel\n                    {...supportLabelProps}\n                    label={helpLabel}\n                    labelType={\"help\"}\n                    id={supportId}\n                />\n            </>\n        );\n    },\n);\n\nRadioButton.displayName = \"RadioButton\";\n"],"names":["RadioButton","forwardRef","props","ref","checked","value","supportLabelProps","helpLabel","rest","selectedValue","context","useRadioGroupContext","supportId","useId","jsxs","Fragment","children","jsx","BaseRadioButton","SupportLabel","label","labelType","id","displayName"],"mappings":"sSAOaA,EAAcC,EAAAA,WACvB,CAACC,EAAOC,KACJ,MAAQC,QAAAA,EAASC,MAAAA,EAAOC,kBAAAA,EAAmBC,UAAAA,KAAcC,GAASN,GAC1DG,MAAOI,KAAkBC,GAAYC,EAAAA,uBACvCC,EAAYC,EAAAA,MAAM,qBAExB,OACIC,EAAAA,KAAAC,WAAA,CACIC,SAAA,CAAAC,EAAAA,IAACC,EAAAA,gBAAA,IACOR,KACAF,EACJL,IAAAA,EACAC,eACWA,EAAY,IACbA,SACOK,EAAkB,IACvBJ,IAAUI,OACV,EAEZJ,MAAAA,EACA,mBAAkBE,EAAYK,OAAY,IAE9CK,EAAAA,IAACE,EAAAA,aAAA,IACOb,EACJc,MAAOb,EACPc,UAAW,OACXC,GAAIV,SAOxBZ,EAAYuB,YAAc"}