{"version":3,"file":"RadioGroup.cjs","sources":["../../../../../src/components/forms/radio-btn/RadioGroup.tsx"],"sourcesContent":["import React from \"react\";\nimport RadioButton from \"./RadioButton\";\n\n/**\n * Interface for radio option items\n */\ninterface RadioOption {\n  /** Unique identifier for the option */\n  id: string;\n  /** Value of the option */\n  value: string;\n  /** Display label for the option */\n  label: string;\n  /** Whether the option is disabled */\n  disabled?: boolean;\n  /** Help text for this specific option */\n  helpText?: string;\n}\n\n/**\n * Props for the RadioGroup component\n */\ninterface RadioGroupProps {\n  /** Group label that describes the collection of options */\n  label: string;\n  /** Name attribute for all radio inputs in the group */\n  name: string;\n  /** Array of radio options to display */\n  options: RadioOption[];\n  /** Currently selected value */\n  selectedValue?: string;\n  /** Callback function when selection changes */\n  onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;\n  /** Whether the field group is required */\n  required?: boolean;\n  /** Error message for the entire group */\n  error?: string;\n  /** Additional CSS classes */\n  className?: string;\n  /** Whether to display radio buttons inline horizontally */\n  inline?: boolean;\n  /** ID for the fieldset element */\n  id?: string;\n  /** Additional description for the group */\n  description?: string;\n}\n\n/**\n * A component for grouping related radio buttons with a common label\n */\nconst RadioGroup: React.FC<RadioGroupProps> = ({\n  label,\n  name,\n  options,\n  selectedValue,\n  onChange,\n  required = false,\n  error,\n  className = \"\",\n  inline = false,\n  id,\n  description,\n}) => {\n  const groupId = id || `radio-group-${name}`;\n  const descriptionId = description ? `${groupId}-description` : undefined;\n\n  return (\n    <fieldset\n      className={`ihub-radio-group ${className} ${\n        inline ? \"ihub-radio-group-inline\" : \"\"\n      } ${error ? \"ihub-radio-group-error\" : \"\"}`}\n      id={groupId}\n      aria-required={required}\n      aria-describedby={descriptionId}\n      aria-invalid={!!error}\n    >\n      <legend className=\"ihub-radio-group-legend\">\n        {label}\n        {required && (\n          <span className=\"ihub-required-mark\" aria-hidden=\"true\">\n            *\n          </span>\n        )}\n      </legend>\n\n      {description && (\n        <div id={descriptionId} className=\"ihub-radio-group-description\">\n          {description}\n        </div>\n      )}\n\n      <div className=\"ihub-radio-options\">\n        {options.map((option) => (\n          <RadioButton\n            key={option.id}\n            id={option.id}\n            name={name}\n            value={option.value}\n            label={option.label}\n            checked={selectedValue === option.value}\n            disabled={option.disabled}\n            onChange={onChange}\n            required={required}\n            helpText={option.helpText}\n          />\n        ))}\n      </div>\n\n      {error && (\n        <div className=\"ihub-radio-group-error-message\" role=\"alert\">\n          {error}\n        </div>\n      )}\n    </fieldset>\n  );\n};\n\nexport default RadioGroup;\n"],"names":["_ref","label","name","options","selectedValue","onChange","_ref$required","required","error","_ref$className","className","_ref$inline","inline","id","description","groupId","concat","descriptionId","undefined","_jsxs","children","jsxs","_jsx","jsx","map","option","RadioButton","value","checked","disabled","helpText","role"],"mappings":"sJAkD8C,SAA9BA,GAYX,IAXHC,EAAKD,EAALC,MACAC,EAAIF,EAAJE,KACAC,EAAOH,EAAPG,QACAC,EAAaJ,EAAbI,cACAC,EAAQL,EAARK,SAAQC,EAAAN,EACRO,SAAAA,OAAW,IAAHD,GAAQA,EAChBE,EAAKR,EAALQ,MAAKC,EAAAT,EACLU,UAAAA,OAAY,IAAHD,EAAG,GAAEA,EAAAE,EAAAX,EACdY,OAAAA,OAAS,IAAHD,GAAQA,EACdE,EAAEb,EAAFa,GACAC,EAAWd,EAAXc,YAEMC,EAAUF,kBAAEG,OAAmBd,GAC/Be,EAAgBH,EAAW,GAAAE,OAAMD,uBAAwBG,EAE/D,OACEC,EAAAA,KACE,WAAA,CAAAT,UAAS,oBAAAM,OAAsBN,OAASM,OACtCJ,EAAS,0BAA4B,GACvC,KAAAI,OAAIR,EAAQ,yBAA2B,IACvCK,GAAIE,EAAO,gBACIR,EACG,mBAAAU,mBACFT,EAEhBY,SAAA,CAAAD,EAAAE,KAAA,SAAA,CAAQX,UAAU,0BACfU,SAAA,CAAAnB,EACAM,GACCe,EAAAA,IAAA,OAAA,CAAMZ,UAAU,qBAAiC,cAAA,yBAMpDI,GACCQ,EAAAC,IAA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