import * as React from 'react'; import type { CompositeMetadata } from '../../composite/list/CompositeList.js'; import { ThumbMetadata } from '../thumb/useSliderThumb.js'; export declare function focusThumb(thumbIndex: number, sliderRef: React.RefObject, setActive?: useSliderRoot.ReturnValue['setActive']): void; export declare function validateMinimumDistance(values: number | readonly number[], step: number, minStepsBetweenValues: number): boolean; /** */ export declare function useSliderRoot(parameters: useSliderRoot.Parameters): useSliderRoot.ReturnValue; export interface FingerPosition { x: number; y: number; } interface FingerState { value: number | number[]; valueRescaled: number; percentageValues: number[]; thumbIndex: number; } export declare namespace useSliderRoot { type Orientation = 'horizontal' | 'vertical'; interface Parameters { /** * The id of the slider element. */ id: string; /** * The id of the element containing a label for the slider. */ 'aria-labelledby': string; /** * The default value. Use when the component is not controlled. */ defaultValue?: number | readonly number[]; /** * Whether the component should ignore user interaction. * @default false */ disabled: boolean; /** * The maximum allowed value of the slider. * Should not be equal to min. * @default 100 */ max: number; /** * The minimum allowed value of the slider. * Should not be equal to max. * @default 0 */ min: number; /** * The minimum steps between values in a range slider. * @default 0 */ minStepsBetweenValues: number; /** * Identifies the field when a form is submitted. */ name: string; /** * Callback function that is fired when the slider's value changed. * * @param {number | readonly number[]} value The new value. * @param {Event} event The corresponding event that initiated the change. * You can pull out the new value by accessing `event.target.value` (any). * @param {number} activeThumbIndex Index of the currently moved thumb. */ onValueChange: (value: number | number[], event: Event, activeThumbIndex: number) => void; /** * Callback function that is fired when the `pointerup` is triggered. * * @param {number | number[]} value The new value. * @param {Event} event The corresponding event that initiated the change. * **Warning**: This is a generic event not a change event. */ onValueCommitted: (value: number | readonly number[], event: Event) => void; /** * The component orientation. * @default 'horizontal' */ orientation: Orientation; /** * The ref attached to the root of the Slider. */ rootRef: React.Ref; /** * The granularity with which the slider can step through values when using Page Up/Page Down or Shift + Arrow Up/Arrow Down. * @default 10 */ largeStep: number; /** * The granularity with which the slider can step through values. (A "discrete" slider.) * The `min` prop serves as the origin for the valid values. * We recommend (max - min) to be evenly divisible by the step. * @default 1 */ step: number; /** * The value of the slider. * For ranged sliders, provide an array with two values. */ value?: number | readonly number[]; } interface ReturnValue { getRootProps: (externalProps?: React.ComponentPropsWithRef<'div'>) => React.ComponentPropsWithRef<'div'>; /** * The index of the active thumb. */ active: number; 'aria-labelledby'?: string; handleInputChange: (valueInput: number, index: number, event: React.KeyboardEvent | React.ChangeEvent) => void; dragging: boolean; disabled: boolean; getFingerState: (fingerPosition: FingerPosition | null, shouldCaptureThumbIndex?: boolean, offset?: number) => FingerState | null; /** * Callback to invoke change handlers after internal value state is updated. */ setValue: (newValue: number | number[], newPercentageValues: readonly number[], activeThumb: number, event: Event) => void; /** * The large step value of the slider when incrementing or decrementing while the shift key is held, * or when using Page-Up or Page-Down keys. Snaps to multiples of this value. * @default 10 */ largeStep: number; lastChangedValueRef: React.RefObject; /** * The maximum allowed value of the slider. */ max: number; /** * The minimum allowed value of the slider. */ min: number; /** * The minimum steps between values in a range slider. */ minStepsBetweenValues: number; name: string; onValueCommitted: (value: number | readonly number[], event: Event) => void; /** * The component orientation. * @default 'horizontal' */ orientation: Orientation; registerSliderControl: (element: HTMLElement | null) => void; /** * The value(s) of the slider as percentages */ percentageValues: readonly number[]; setActive: React.Dispatch>; setDragging: React.Dispatch>; setPercentageValues: React.Dispatch>; setThumbMap: React.Dispatch | null>>>; /** * The step increment of the slider when incrementing or decrementing. It will snap * to multiples of this value. Decimal values are supported. * @default 1 */ step: number; thumbMap: Map | null>; thumbRefs: React.MutableRefObject<(HTMLElement | null)[]>; /** * The value(s) of the slider */ values: readonly number[]; } } export {};