UNPKG

@react-md/form

Version:

This package is for creating all the different form input types.

46 lines (45 loc) 1.83 kB
import type { DefinedSliderValueOptions, RangeSliderControls, RangeSliderDefaultValue, RangeSliderValue, SliderStepOptions } from "./types"; /** * @remarks \@since 2.5.0 */ export interface UseRangeSliderOptions extends SliderStepOptions { /** * An optional callback that will be triggered when the value has changed when * the `updateOn` behavior is set to `"blur"`. When the `updateOn` behavior is * set to `"change"` (default), this will do nothing since the return value * from the hook will always be the latest value. */ onChange?(value: RangeSliderValue): void; } /** * @remarks \@since 2.5.0 */ export interface RangeSliderRequiredProps extends RangeSliderControls, DefinedSliderValueOptions { /** * The current value of the slider. */ value: RangeSliderValue; } /** * @remarks \@since 2.5.0 */ export declare type RangeSliderValueReturnType = readonly [ RangeSliderValue, RangeSliderRequiredProps ]; /** * This hook is used to control the value and behavior of the `RangeSlider` * component. The first argument will contain the current slider value while the * second argument will be all the props required to control the `RangeSlider` * component. * * @param defaultValue - An optional default value to use. When omitted, this * will be the `[min, max]` values * @param options - An object containing the `min` and `max` values allowed for * the slider as well as a `step` to indicate valid values between the `min` and * `max`. * @returns an ordered list containing the current value followed by the * `RangeSlider` props * @remarks \@since 2.5.0 */ export declare function useRangeSlider(defaultValue?: RangeSliderDefaultValue, { min, max, step, jump: propJump, updateOn, onChange, }?: UseRangeSliderOptions): RangeSliderValueReturnType;