UNPKG

2.43 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 keyboard?: boolean;
24 autoFocus?: boolean;
25 onFocus?: (e: React.FocusEvent<HTMLDivElement>) => void;
26 onBlur?: (e: React.FocusEvent<HTMLDivElement>) => void;
27 range?: boolean;
28 count?: number;
29 min?: number;
30 max?: number;
31 step?: number | null;
32 value?: ValueType;
33 defaultValue?: ValueType;
34 onChange?: (value: ValueType) => void;
35 /** @deprecated It's always better to use `onChange` instead */
36 onBeforeChange?: (value: ValueType) => void;
37 /** @deprecated It's always better to use `onChange` instead */
38 onAfterChange?: (value: ValueType) => void;
39 allowCross?: boolean;
40 pushable?: boolean | number;
41 /** range only */
42 draggableTrack?: boolean;
43 reverse?: boolean;
44 vertical?: boolean;
45 included?: boolean;
46 startPoint?: number;
47 trackStyle?: React.CSSProperties | React.CSSProperties[];
48 handleStyle?: React.CSSProperties | React.CSSProperties[];
49 railStyle?: React.CSSProperties;
50 dotStyle?: React.CSSProperties | ((dotValue: number) => React.CSSProperties);
51 activeDotStyle?: React.CSSProperties | ((dotValue: number) => React.CSSProperties);
52 marks?: Record<string | number, React.ReactNode | MarkObj>;
53 dots?: boolean;
54 handleRender?: HandlesProps['handleRender'];
55 tabIndex?: number | number[];
56 ariaLabelForHandle?: string | string[];
57 ariaLabelledByForHandle?: string | string[];
58 ariaValueTextFormatterForHandle?: AriaValueFormat | AriaValueFormat[];
59}
60export interface SliderRef {
61 focus: () => void;
62 blur: () => void;
63}
64declare const Slider: React.ForwardRefExoticComponent<SliderProps<number | number[]> & React.RefAttributes<SliderRef>>;
65export default Slider;