import { default as React } from 'react'; import { SafeExtract, SafeOmit } from '../../../.deps/utils/src'; import { Spacing } from '../../../tokens/types'; import { RadioGroupImageOption } from './RadioGroupImageOption'; import { RadioGroupOption } from './RadioGroupOption'; import { RenderRadioGroupOptionProps } from './types'; export type SelectKey = string | number; export interface RadioGroupOwnProps { /** * The id of the radio group. */ id?: string; /** * Required for grouping radio buttons (sets the name attribute on each input). */ name: string; /** * Default selected key value of the input (uncontrolled). */ defaultValue?: V; /** * Selected key value (controlled). */ value?: V | null; /** * Function to handle option selection. * @param value - The selected value. * @param event - The change event. */ onChange?: (value: V | null, event: React.ChangeEvent) => void; /** * Disables the input. */ disabled?: boolean; /** * List of keys of the disabled options (controlled). */ disabledValues?: Array; /** * Function to get the value for an option. * @param option - The option to get the value for. */ getOptionValue(option: T): V; /** * Function to get the text label for an option. * @param option - The option to get the text label for. */ getOptionLabel(option: T): string; /** * Function to get the description for an option. * @param option - The option to get the description for. */ getOptionTooltip?(option: T): string | undefined; /** * Function to render a custom option. When provided, replaces the default RadioOption rendering. */ renderOption?(option: T, props: RenderRadioGroupOptionProps): React.ReactNode; /** * List of options to display (controlled). */ options: Array; /** * Whether the field is required (adds asterisk to the label and sets required attribute on each input). */ required?: boolean; /** * Layout engine used to arrange options. * @default 'flex' */ layout?: 'flex' | 'grid'; /** * Direction of options. Applies only when layout is 'flex'. * @default 'vertical' */ orientation?: 'horizontal' | 'vertical'; /** * Minimum column width in pixels. Applies only when layout is 'grid'. * The grid auto-fills as many columns of at least this width as fit the container, * so the number of columns adapts to available space without media queries. */ minColumnWidth?: number; /** * Gap between options. Sets both row and column gap to the same value. * Defaults: column gap 'xl', row gap 'sm'. */ gap?: SafeExtract; } interface InheritedHTMLDivProps extends SafeOmit, 'defaultValue' | 'onChange' | 'className' | 'style'> { /** * Validation state of the radio group. */ validity?: 'error' | 'warning'; } export interface RadioGroupProps extends RadioGroupOwnProps, InheritedHTMLDivProps { } export declare const RadioGroup: (({ name, value, defaultValue, onChange, disabled, disabledValues, getOptionValue, getOptionLabel, getOptionTooltip, options, renderOption, required, validity, layout, orientation, minColumnWidth, gap, "aria-label": ariaLabel, "aria-labelledby": ariaLabeledBy, "aria-describedby": ariaDescribedBy, "aria-errormessage": ariaErrorMessage, ...rest }: RadioGroupProps) => React.JSX.Element) & { displayName: string; Option: typeof RadioGroupOption; ImageOption: typeof RadioGroupImageOption; }; export {};