import { ElementProps, ValueProps } from '../../core/types'; import { ReactNode } from 'react'; import './RadioSlider.scss'; type RadioSliderOption = T | { label: ReactNode; value: T; disabled?: boolean; }; export type RadioSliderProps = ValueProps & ElementProps & { options: RadioSliderOption[]; optionClassName?: string; value?: T; threshold?: number; }; /** * ListBox from react-aria-components supports multiple selection modes, * but we only need single selection mode for our RadioSlider. * @param props * @param props.value - The selected option value. * @param {(value: T, e?: any) => void} [props.onChange] - Optional function called when the selected option changes. * @param props.options - Array of options to be displayed. The type of the option can be any string or an object with label, value, and disabled properties. * @param {number} props.threshold - The threshold value to determine if the options should be displayed as a dropdown. * @param {ElementProps} props.rest - Additional props forwarded to the rendered root control: to the Select component in dropdown mode, and to the ListBox component otherwise. * @returns {JSX.Element} - The RadioSlider component. * @example * ```tsx * const [value, setValue] = useState('option 1') * * return ( * setValue(v)} options={['option 1', 'option 2', 'option 3']} /> * ) * ``` * @example with enum * ```tsx * enum Fruit { * Apple = 'Apple', * Banana = 'Banana', * Orange = 'Orange', * }; * * const [value, setValue] = useState(Fruit.Apple) * * return ( * value={value} onChange={(v) => setValue(v)} options={Object.values(Fruit)} /> * ) * ``` */ export declare const RadioSlider: (props: RadioSliderProps) => import("react/jsx-runtime").JSX.Element; export default RadioSlider;