import { Fieldset } from '../Fieldset/Fieldset'; import { ComponentErrors } from '../ComponentErrors/ComponentErrors'; import { slottableComponent } from '../HOC/slottableComponent'; import { getShortcutKey } from '../Checkbox/getShortcutKey'; import { RadioOption } from './RadioOption'; import { useListKeyboardHandler } from '../../../hooks/useListKeyboardHandler'; import type { LunaticError } from '../../../use-lunatic/type'; import { Declarations } from '../Declarations/Declarations'; import type { LunaticComponentProps } from '../../type'; export type RadioGroupProps = Pick< LunaticComponentProps<'Radio'>, | 'id' | 'options' | 'value' | 'checkboxStyle' | 'label' | 'shortcut' | 'className' | 'disabled' | 'readOnly' | 'description' | 'declarations' | 'orientation' | 'detailAlwaysDisplayed' | 'shouldBeFiltered' > & { errors?: LunaticError[]; clearable?: boolean; }; /** * Stack of radios fields surrounded by a fieldset */ function LunaticRadioGroup({ options, value, id, label, description, checkboxStyle = false, errors, className, shortcut, disabled, readOnly, declarations, orientation, detailAlwaysDisplayed, }: RadioGroupProps) { const onKeyDown = useListKeyboardHandler(options); const maxIndex = options.length; return (
); } export const RadioGroup = slottableComponent('RadioGroup', LunaticRadioGroup);