Files
v10/dist/dev/ui/hooks/use-slider.d.ts

36 lines
1.8 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { SliderOptions, SliderRootProps, SliderRootStyle, SliderThumbProps } from "@videojs/core/dom";
import { SliderInput, SliderState } from "@videojs/core";
//#region src/ui/hooks/use-slider.d.ts
interface UseSliderOptions<State extends SliderState = SliderState> extends Pick<SliderOptions, 'getPercent' | 'getStepPercent' | 'getLargeStepPercent' | 'changeThrottle' | 'onValueChange' | 'onValueCommit' | 'onDragStart' | 'onDragEnd'> {
computeState: (input: SliderInput) => State;
orientation?: 'horizontal' | 'vertical' | undefined;
disabled?: boolean | undefined;
/** Adjust a raw 0100 percent for thumb alignment. Called for fill and pointer percents. */
adjustPercent?: ((rawPercent: number, thumbSize: number, trackSize: number) => number) | undefined;
/** Compute CSS variable map from the (possibly alignment-adjusted) state. */
getCSSVars: (state: State) => Record<string, string>;
}
interface UseSliderReturnValue<State extends SliderState = SliderState> {
state: State;
cssVars: Record<string, string>;
rootRef: React.RefCallback<HTMLElement>;
thumbRef: React.RefCallback<HTMLElement>;
rootProps: SliderRootProps;
rootStyle: SliderRootStyle;
thumbProps: SliderThumbProps;
}
/**
* Manages slider input lifecycle for React.
*
* Wraps `createSlider()` from `@videojs/core/dom` and subscribes to its
* input state via `useSnapshot`. Returns split props for the root
* (pointer events) and thumb (keyboard/focus) elements.
*/
declare function useSlider<State extends SliderState = SliderState>(options: UseSliderOptions<State>): UseSliderReturnValue<State>;
declare namespace useSlider {
type Options = UseSliderOptions;
type ReturnValue = UseSliderReturnValue;
}
//#endregion
export { UseSliderOptions, UseSliderReturnValue, useSlider };
//# sourceMappingURL=use-slider.d.ts.map