UNPKG

2.41 kBTypeScriptView Raw
1import * as React from 'react';
2import type { HandlesProps } from './Handles';
3import type { AriaValueFormat } from './interface';
4import type { MarkObj } from './Marks';
5/**
6 * New:
7 * - click mark to update range value
8 * - handleRender
9 * - Fix handle with count not correct
10 * - Fix pushable not work in some case
11 * - No more FindDOMNode
12 * - Move all position related style into inline style
13 * - Key: up is plus, down is minus
14 * - fix Key with step = null not align with marks
15 * - Change range should not trigger onChange
16 * - keyboard support pushable
17 */
18export interface SliderProps<ValueType = number | number[]> {
19 prefixCls?: string;
20 className?: string;
21 style?: React.CSSProperties;
22 disabled?: boolean;
23 autoFocus?: boolean;
24 onFocus?: (e: React.FocusEvent<HTMLDivElement>) => void;
25 onBlur?: (e: React.FocusEvent<HTMLDivElement>) => void;
26 range?: boolean;
27 count?: number;
28 min?: number;
29 max?: number;
30 step?: number | null;
31 value?: ValueType;
32 defaultValue?: ValueType;
33 onChange?: (value: ValueType) => void;
34 /** @deprecated It's always better to use `onChange` instead */
35 onBeforeChange?: (value: ValueType) => void;
36 /** @deprecated It's always better to use `onChange` instead */
37 onAfterChange?: (value: ValueType) => void;
38 allowCross?: boolean;
39 pushable?: boolean | number;
40 /** range only */
41 draggableTrack?: boolean;
42 reverse?: boolean;
43 vertical?: boolean;
44 included?: boolean;
45 startPoint?: number;
46 trackStyle?: React.CSSProperties | React.CSSProperties[];
47 handleStyle?: React.CSSProperties | React.CSSProperties[];
48 railStyle?: React.CSSProperties;
49 dotStyle?: React.CSSProperties | ((dotValue: number) => React.CSSProperties);
50 activeDotStyle?: React.CSSProperties | ((dotValue: number) => React.CSSProperties);
51 marks?: Record<string | number, React.ReactNode | MarkObj>;
52 dots?: boolean;
53 handleRender?: HandlesProps['handleRender'];
54 tabIndex?: number | number[];
55 ariaLabelForHandle?: string | string[];
56 ariaLabelledByForHandle?: string | string[];
57 ariaValueTextFormatterForHandle?: AriaValueFormat | AriaValueFormat[];
58}
59export interface SliderRef {
60 focus: () => void;
61 blur: () => void;
62}
63declare const Slider: React.ForwardRefExoticComponent<SliderProps<number | number[]> & React.RefAttributes<SliderRef>>;
64export default Slider;