1 | import React from 'react';
|
2 | import type { SliderProps as RcSliderProps } from 'rc-slider';
|
3 | import type { SliderRef } from 'rc-slider/lib/Slider';
|
4 | import type { GetProp } from '../_util/type';
|
5 | import type { AbstractTooltipProps, TooltipPlacement } from '../tooltip';
|
6 | export type SliderMarks = RcSliderProps['marks'];
|
7 | interface HandleGeneratorInfo {
|
8 | value?: number;
|
9 | dragging?: boolean;
|
10 | index: number;
|
11 | }
|
12 | export type HandleGeneratorFn = (config: {
|
13 | tooltipPrefixCls?: string;
|
14 | prefixCls?: string;
|
15 | info: HandleGeneratorInfo;
|
16 | }) => React.ReactElement;
|
17 | export type Formatter = ((value?: number) => React.ReactNode) | null;
|
18 | export interface SliderTooltipProps extends AbstractTooltipProps {
|
19 | prefixCls?: string;
|
20 | open?: boolean;
|
21 | placement?: TooltipPlacement;
|
22 | getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
23 | formatter?: Formatter;
|
24 | autoAdjustOverflow?: boolean;
|
25 | }
|
26 | export interface SliderBaseProps {
|
27 | prefixCls?: string;
|
28 | reverse?: boolean;
|
29 | min?: number;
|
30 | max?: number;
|
31 | step?: null | number;
|
32 | marks?: SliderMarks;
|
33 | dots?: boolean;
|
34 | included?: boolean;
|
35 | disabled?: boolean;
|
36 | keyboard?: boolean;
|
37 | vertical?: boolean;
|
38 | className?: string;
|
39 | rootClassName?: string;
|
40 | id?: string;
|
41 | style?: React.CSSProperties;
|
42 | tooltip?: SliderTooltipProps;
|
43 | autoFocus?: boolean;
|
44 | styles?: RcSliderProps['styles'];
|
45 | classNames?: RcSliderProps['classNames'];
|
46 | onFocus?: React.FocusEventHandler<HTMLDivElement>;
|
47 | onBlur?: React.FocusEventHandler<HTMLDivElement>;
|
48 |
|
49 | tooltipPrefixCls?: string;
|
50 |
|
51 | tipFormatter?: Formatter;
|
52 |
|
53 | tooltipVisible?: boolean;
|
54 | |
55 |
|
56 |
|
57 |
|
58 | getTooltipPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
59 |
|
60 | tooltipPlacement?: TooltipPlacement;
|
61 | }
|
62 | export interface SliderSingleProps extends SliderBaseProps {
|
63 | range?: false;
|
64 | value?: number;
|
65 | defaultValue?: number;
|
66 | onChange?: (value: number) => void;
|
67 |
|
68 | onAfterChange?: (value: number) => void;
|
69 | onChangeComplete?: (value: number) => void;
|
70 |
|
71 | handleStyle?: React.CSSProperties;
|
72 |
|
73 | trackStyle?: React.CSSProperties;
|
74 |
|
75 | railStyle?: React.CSSProperties;
|
76 | }
|
77 | export interface SliderRangeProps extends SliderBaseProps {
|
78 | range: true | SliderRange;
|
79 | value?: number[];
|
80 | defaultValue?: number[];
|
81 | onChange?: (value: number[]) => void;
|
82 |
|
83 | onAfterChange?: (value: number[]) => void;
|
84 | onChangeComplete?: (value: number[]) => void;
|
85 |
|
86 | handleStyle?: React.CSSProperties[];
|
87 |
|
88 | trackStyle?: React.CSSProperties[];
|
89 |
|
90 | railStyle?: React.CSSProperties;
|
91 | }
|
92 | type SliderRange = Exclude<GetProp<RcSliderProps, 'range'>, boolean>;
|
93 | export type Opens = {
|
94 | [index: number]: boolean;
|
95 | };
|
96 | declare const Slider: React.ForwardRefExoticComponent<(SliderSingleProps | SliderRangeProps) & React.RefAttributes<SliderRef>>;
|
97 | export default Slider;
|