/** * createRadioGroup - the HEADLESS core behind : an accessible * single-select radio group (WAI-ARIA `radiogroup`) with roving tabindex + full * arrow-key navigation, exposed as **prop-getters** you spread onto YOUR OWN * markup. Keyboard/ARIA/roving-focus come from the core, the DOM is yours. * * ```svelte * *
* {#each options as opt (opt.value)} * * {/each} *
* ``` * * The styled is just one renderer over this core. */ export type RadioOption = { value: string | number; label: string; disabled?: boolean; }; /** Reactive inputs are passed as getters so the core tracks live prop changes. */ export type RadioGroupConfig = { options: () => ReadonlyArray; value: () => string | number | null; onChange?: (value: string | number) => void; disabled?: () => boolean; ariaLabel?: () => string | undefined; id?: () => string | undefined; invalid?: () => boolean; required?: () => boolean; error?: () => string | undefined; hint?: () => string | undefined; }; export type RadioProps = { type: 'button'; role: 'radio'; 'aria-checked': boolean; 'data-idx': number; 'data-checked': '' | undefined; disabled: boolean; tabindex: number; onclick: () => void; }; export type RadioGroupProps = { role: 'radiogroup'; id: string | undefined; 'aria-label': string | undefined; 'aria-invalid': 'true' | undefined; 'aria-required': 'true' | undefined; 'aria-describedby': string | undefined; 'aria-disabled': boolean; onkeydown: (e: KeyboardEvent) => void; }; export type RadioGroup = { /** Currently selected value. */ readonly value: string | number | null; readonly disabled: boolean; isChecked: (option: RadioOption) => boolean; /** Select by value (no-op when disabled / option disabled / unknown). */ select: (value: string | number) => void; onKeydown: (e: KeyboardEvent) => void; /** Spread onto the group container element. */ groupProps: () => RadioGroupProps; /** Spread onto each option element. */ radioProps: (option: RadioOption) => RadioProps; }; export declare function createRadioGroup(config: RadioGroupConfig): RadioGroup;