@zag-js/slider 2.0.0-next.2 → 2.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.js +16 -38
- package/dist/index.mjs +2 -7
- package/dist/slider.anatomy.d.mts +2 -6
- package/dist/slider.anatomy.d.ts +2 -6
- package/dist/slider.anatomy.js +8 -44
- package/dist/slider.anatomy.mjs +4 -18
- package/dist/slider.connect.d.mts +3 -7
- package/dist/slider.connect.d.ts +3 -7
- package/dist/slider.connect.js +403 -372
- package/dist/slider.connect.mjs +399 -352
- package/dist/slider.dom.d.mts +15 -30
- package/dist/slider.dom.d.ts +15 -30
- package/dist/slider.dom.js +56 -141
- package/dist/slider.dom.mjs +40 -97
- package/dist/slider.machine.d.mts +2 -7
- package/dist/slider.machine.d.ts +2 -7
- package/dist/slider.machine.js +372 -368
- package/dist/slider.machine.mjs +368 -352
- package/dist/slider.props.d.mts +7 -12
- package/dist/slider.props.d.ts +7 -12
- package/dist/slider.props.js +49 -73
- package/dist/slider.props.mjs +40 -43
- package/dist/slider.style.d.mts +15 -17
- package/dist/slider.style.d.ts +15 -17
- package/dist/slider.style.js +103 -157
- package/dist/slider.style.mjs +91 -124
- package/dist/slider.types.d.mts +402 -377
- package/dist/slider.types.d.ts +402 -377
- package/dist/slider.types.js +4 -18
- package/dist/slider.types.mjs +1 -0
- package/dist/slider.utils.d.mts +23 -27
- package/dist/slider.utils.d.ts +23 -27
- package/dist/slider.utils.js +196 -205
- package/dist/slider.utils.mjs +180 -176
- package/package.json +7 -7
package/dist/slider.types.d.ts
CHANGED
|
@@ -1,397 +1,422 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type ThumbCollisionBehavior = "none" | "push" | "swap";
|
|
5
|
-
type ThumbAlignment = "contain" | "center";
|
|
6
|
-
type SliderOrigin = "start" | "center" | "end" | number;
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { CommonProperties, DirectionProperty, PropTypes } from "@zag-js/types";
|
|
2
|
+
import { EventObject, Machine, Service } from "@zag-js/core";
|
|
3
|
+
import { AnimationFrame } from "@zag-js/dom-query";
|
|
4
|
+
export type ThumbCollisionBehavior = "none" | "push" | "swap";
|
|
5
|
+
export type ThumbAlignment = "contain" | "center";
|
|
6
|
+
export type SliderOrigin = "start" | "center" | "end" | number;
|
|
7
|
+
/**
|
|
8
|
+
* What changed the slider value:
|
|
9
|
+
* - `track-click`: the pointer was pressed on the track and the thumb jumped there
|
|
10
|
+
* - `drag`: a thumb was dragged
|
|
11
|
+
* - `keyboard`: an arrow, Page Up/Down, Home or End key was pressed
|
|
12
|
+
* - `script`: `setValue`, `setThumbValue`, `setThumbPercent`, `increment` or `decrement` was called
|
|
13
|
+
*/
|
|
14
|
+
export type ValueChangeReason = "track-click" | "drag" | "keyboard" | "script";
|
|
15
|
+
export interface ValueChangeDetails {
|
|
16
|
+
value: number[];
|
|
17
|
+
/**
|
|
18
|
+
* What changed the value
|
|
19
|
+
*/
|
|
20
|
+
reason?: ValueChangeReason | undefined;
|
|
9
21
|
}
|
|
10
|
-
interface FocusChangeDetails {
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
export interface FocusChangeDetails {
|
|
23
|
+
focusedIndex: number;
|
|
24
|
+
value: number[];
|
|
13
25
|
}
|
|
14
|
-
interface ValueTextDetails {
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
export interface ValueTextDetails {
|
|
27
|
+
value: number;
|
|
28
|
+
index: number;
|
|
17
29
|
}
|
|
18
|
-
interface
|
|
19
|
-
|
|
20
|
-
thumb?: ((index: number) => string) | undefined;
|
|
21
|
-
hiddenInput?: ((index: number) => string) | undefined;
|
|
22
|
-
control?: string | undefined;
|
|
23
|
-
track?: string | undefined;
|
|
24
|
-
range?: string | undefined;
|
|
25
|
-
label?: string | undefined;
|
|
26
|
-
valueText?: string | undefined;
|
|
27
|
-
marker?: ((index: number) => string) | undefined;
|
|
30
|
+
export interface ThumbLabelDetails {
|
|
31
|
+
index: number;
|
|
28
32
|
}
|
|
29
|
-
interface
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
33
|
+
export interface ElementIds {
|
|
34
|
+
root?: string | undefined;
|
|
35
|
+
thumb?: ((index: number) => string) | undefined;
|
|
36
|
+
hiddenInput?: ((index: number) => string) | undefined;
|
|
37
|
+
control?: string | undefined;
|
|
38
|
+
track?: string | undefined;
|
|
39
|
+
range?: string | undefined;
|
|
40
|
+
label?: string | undefined;
|
|
41
|
+
valueText?: string | undefined;
|
|
42
|
+
marker?: ((index: number) => string) | undefined;
|
|
43
|
+
}
|
|
44
|
+
export interface SliderProps extends DirectionProperty, CommonProperties {
|
|
45
|
+
/**
|
|
46
|
+
* The ids of the elements in the slider. Useful for composition.
|
|
47
|
+
*/
|
|
48
|
+
ids?: ElementIds | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The name associated with each slider thumb (when used in a form)
|
|
51
|
+
*/
|
|
52
|
+
name?: string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* The associate form of the underlying input element.
|
|
55
|
+
*/
|
|
56
|
+
form?: string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* The controlled value of the slider
|
|
59
|
+
*/
|
|
60
|
+
value?: number[] | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* The initial value of the slider when rendered.
|
|
63
|
+
* Use when you don't need to control the value of the slider.
|
|
64
|
+
*/
|
|
65
|
+
defaultValue?: number[] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the slider is disabled
|
|
68
|
+
*/
|
|
69
|
+
disabled?: boolean | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Whether the slider is read-only
|
|
72
|
+
*/
|
|
73
|
+
readOnly?: boolean | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Whether the slider is invalid
|
|
76
|
+
*/
|
|
77
|
+
invalid?: boolean | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Function invoked when the value of the slider changes
|
|
80
|
+
*/
|
|
81
|
+
onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Function invoked when the slider value change is done
|
|
84
|
+
*/
|
|
85
|
+
onValueChangeEnd?: ((details: ValueChangeDetails) => void) | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Function invoked when the slider's focused index changes
|
|
88
|
+
*/
|
|
89
|
+
onFocusChange?: ((details: FocusChangeDetails) => void) | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Function that returns a human readable value for the slider thumb
|
|
92
|
+
*/
|
|
93
|
+
getAriaValueText?: ((details: ValueTextDetails) => string) | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Function that returns the accessible name of each thumb, e.g. "Minimum price"
|
|
96
|
+
*/
|
|
97
|
+
getAriaLabel?: ((details: ThumbLabelDetails) => string) | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Function that returns the `id` of the element that labels each thumb.
|
|
100
|
+
* Defaults to the label part when no `getAriaLabel` is provided.
|
|
101
|
+
*/
|
|
102
|
+
getAriaLabelledBy?: ((details: ThumbLabelDetails) => string) | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* The minimum value of the slider
|
|
105
|
+
* @default 0
|
|
106
|
+
*/
|
|
107
|
+
min?: number | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* The maximum value of the slider
|
|
110
|
+
* @default 100
|
|
111
|
+
*/
|
|
112
|
+
max?: number | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* The step value of the slider
|
|
115
|
+
* @default 1
|
|
116
|
+
*/
|
|
117
|
+
step?: number | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* The step value of the slider when the `Shift` key is held, or the
|
|
120
|
+
* `PageUp`/`PageDown` keys are used.
|
|
121
|
+
* @default 10 * step
|
|
122
|
+
*/
|
|
123
|
+
largeStep?: number | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* The minimum permitted steps between multiple thumbs.
|
|
126
|
+
*
|
|
127
|
+
* `minStepsBetweenThumbs` * `step` should reflect the gap between the thumbs.
|
|
128
|
+
*
|
|
129
|
+
* - `step: 1` and `minStepsBetweenThumbs: 10` => gap is `10`
|
|
130
|
+
* - `step: 10` and `minStepsBetweenThumbs: 2` => gap is `20`
|
|
131
|
+
*
|
|
132
|
+
* @default 0
|
|
133
|
+
*/
|
|
134
|
+
minStepsBetweenThumbs?: number | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* The orientation of the slider
|
|
137
|
+
* @default "horizontal"
|
|
138
|
+
*/
|
|
139
|
+
orientation?: "vertical" | "horizontal" | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* The origin of the slider range. The track is filled from the origin to the thumb.
|
|
142
|
+
* - `"start"` / `"end"`: fill from `min` / `max`
|
|
143
|
+
* - `"center"`: fill from the midpoint of `min`/`max`
|
|
144
|
+
* - a `number`: fill from that value instead, for when the neutral point isn't the midpoint
|
|
145
|
+
*
|
|
146
|
+
* @default "start"
|
|
147
|
+
*/
|
|
148
|
+
origin?: SliderOrigin | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* The alignment of the slider thumb relative to the track
|
|
151
|
+
* - `center`: the thumb will extend beyond the bounds of the slider track.
|
|
152
|
+
* - `contain`: the thumb will be contained within the bounds of the track.
|
|
153
|
+
*
|
|
154
|
+
* @default "contain"
|
|
155
|
+
*/
|
|
156
|
+
thumbAlignment?: "contain" | "center" | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* The slider thumbs dimensions. A number sets both the width and height.
|
|
159
|
+
*/
|
|
160
|
+
thumbSize?: number | {
|
|
161
|
+
width: number;
|
|
162
|
+
height: number;
|
|
163
|
+
} | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Controls how thumbs behave when they collide during pointer interactions.
|
|
166
|
+
* - `none` (default): Thumbs cannot move past each other; excess movement is ignored.
|
|
167
|
+
* - `push`: Thumbs push each other without restoring their previous positions when dragged back.
|
|
168
|
+
* - `swap`: Thumbs swap places when dragged past each other.
|
|
169
|
+
*
|
|
170
|
+
* @default "none"
|
|
171
|
+
*/
|
|
172
|
+
thumbCollisionBehavior?: "none" | "push" | "swap" | undefined;
|
|
157
173
|
}
|
|
158
174
|
type PropsWithDefault = "dir" | "min" | "max" | "step" | "largeStep" | "orientation" | "defaultValue" | "origin" | "thumbAlignment" | "minStepsBetweenThumbs" | "thumbCollisionBehavior";
|
|
159
175
|
type Computed = Readonly<{
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
176
|
+
/**
|
|
177
|
+
* @computed
|
|
178
|
+
* Whether the slider thumb has been measured
|
|
179
|
+
*/
|
|
180
|
+
hasMeasuredThumbSize: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* @computed
|
|
183
|
+
* Whether the slider is interactive
|
|
184
|
+
*/
|
|
185
|
+
isInteractive: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* @computed
|
|
188
|
+
* Whether the slider is vertical
|
|
189
|
+
*/
|
|
190
|
+
isVertical: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* @computed
|
|
193
|
+
* Whether the slider is horizontal
|
|
194
|
+
*/
|
|
195
|
+
isHorizontal: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* @computed
|
|
198
|
+
* Whether the slider is in RTL mode
|
|
199
|
+
*/
|
|
200
|
+
isRtl: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* @computed
|
|
203
|
+
* The percentage of the slider value relative to the slider min/max
|
|
204
|
+
*/
|
|
205
|
+
valuePercent: number[];
|
|
206
|
+
/**
|
|
207
|
+
* @computed
|
|
208
|
+
* Whether the slider is disabled
|
|
209
|
+
*/
|
|
210
|
+
isDisabled: boolean;
|
|
195
211
|
}>;
|
|
196
212
|
interface Context {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
213
|
+
/**
|
|
214
|
+
* The active index of the range slider. This represents
|
|
215
|
+
* the currently dragged/focused thumb.
|
|
216
|
+
*/
|
|
217
|
+
focusedIndex: number;
|
|
218
|
+
/**
|
|
219
|
+
* The value of the range slider
|
|
220
|
+
*/
|
|
221
|
+
value: number[];
|
|
222
|
+
/**
|
|
223
|
+
* The size of the slider thumbs
|
|
224
|
+
*/
|
|
225
|
+
thumbSize: Size | null;
|
|
210
226
|
}
|
|
211
|
-
interface SliderSchema {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
227
|
+
export interface SliderSchema {
|
|
228
|
+
state: "idle" | "dragging" | "focus";
|
|
229
|
+
props: SliderProps;
|
|
230
|
+
defaultPropKey: PropsWithDefault;
|
|
231
|
+
context: Context;
|
|
232
|
+
refs: {
|
|
233
|
+
/**
|
|
234
|
+
* The offset from the thumb center when pointer down occurs.
|
|
235
|
+
* Used to maintain constant offset during drag.
|
|
236
|
+
*/
|
|
237
|
+
thumbDragOffset: {
|
|
238
|
+
x: number;
|
|
239
|
+
y: number;
|
|
240
|
+
} | null;
|
|
241
|
+
/**
|
|
242
|
+
* The values when a thumb drag starts.
|
|
243
|
+
* Used for swap collision behavior to determine swap direction.
|
|
244
|
+
*/
|
|
245
|
+
startValue: number[] | null;
|
|
246
|
+
/**
|
|
247
|
+
* The reason of the last pointer-driven change, reported by `onValueChangeEnd`.
|
|
248
|
+
*/
|
|
249
|
+
pointerReason: ValueChangeReason | undefined;
|
|
250
|
+
focusFrame: AnimationFrame;
|
|
251
|
+
};
|
|
252
|
+
computed: Computed;
|
|
253
|
+
event: EventObject;
|
|
254
|
+
action: string;
|
|
255
|
+
effect: string;
|
|
256
|
+
guard: string;
|
|
236
257
|
}
|
|
237
|
-
type SliderService = Service<SliderSchema>;
|
|
238
|
-
type SliderMachine = Machine<SliderSchema>;
|
|
258
|
+
export type SliderService = Service<SliderSchema>;
|
|
259
|
+
export type SliderMachine = Machine<SliderSchema>;
|
|
239
260
|
interface Size {
|
|
240
|
-
|
|
241
|
-
|
|
261
|
+
width: number;
|
|
262
|
+
height: number;
|
|
242
263
|
}
|
|
243
|
-
interface MarkerProps {
|
|
244
|
-
|
|
264
|
+
export interface MarkerProps {
|
|
265
|
+
value: number;
|
|
245
266
|
}
|
|
246
|
-
interface MarkerState {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
267
|
+
export interface MarkerState {
|
|
268
|
+
/**
|
|
269
|
+
* The value of the marker
|
|
270
|
+
*/
|
|
271
|
+
value: number;
|
|
272
|
+
/**
|
|
273
|
+
* Whether the marker is disabled
|
|
274
|
+
*/
|
|
275
|
+
disabled: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* The state of the marker relative to the slider value
|
|
278
|
+
*/
|
|
279
|
+
state: "under-value" | "over-value" | "at-value";
|
|
280
|
+
/**
|
|
281
|
+
* Whether the marker is within the filled range, accounting for `origin`
|
|
282
|
+
*/
|
|
283
|
+
inRange: boolean;
|
|
259
284
|
}
|
|
260
|
-
interface ThumbProps {
|
|
261
|
-
|
|
262
|
-
|
|
285
|
+
export interface ThumbProps {
|
|
286
|
+
index: number;
|
|
287
|
+
name?: string | undefined;
|
|
288
|
+
disabled?: boolean | undefined;
|
|
263
289
|
}
|
|
264
|
-
interface ThumbState {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
290
|
+
export interface ThumbState {
|
|
291
|
+
/**
|
|
292
|
+
* The index of the thumb
|
|
293
|
+
*/
|
|
294
|
+
index: number;
|
|
295
|
+
/**
|
|
296
|
+
* The value of the thumb
|
|
297
|
+
*/
|
|
298
|
+
value: number;
|
|
299
|
+
/**
|
|
300
|
+
* Whether the thumb is disabled
|
|
301
|
+
*/
|
|
302
|
+
disabled: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Whether the thumb is focused
|
|
305
|
+
*/
|
|
306
|
+
focused: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Whether the thumb is being dragged
|
|
309
|
+
*/
|
|
310
|
+
dragging: boolean;
|
|
285
311
|
}
|
|
286
|
-
interface DraggingIndicatorProps {
|
|
287
|
-
|
|
312
|
+
export interface DraggingIndicatorProps {
|
|
313
|
+
index: number;
|
|
288
314
|
}
|
|
289
|
-
interface RootState {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
315
|
+
export interface RootState {
|
|
316
|
+
/**
|
|
317
|
+
* Whether the slider is disabled
|
|
318
|
+
*/
|
|
319
|
+
disabled: boolean;
|
|
320
|
+
/**
|
|
321
|
+
* Whether the slider is invalid
|
|
322
|
+
*/
|
|
323
|
+
invalid: boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Whether the slider is being dragged
|
|
326
|
+
*/
|
|
327
|
+
dragging: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Whether the slider is focused
|
|
330
|
+
*/
|
|
331
|
+
focused: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* The orientation of the slider
|
|
334
|
+
*/
|
|
335
|
+
orientation: "vertical" | "horizontal";
|
|
310
336
|
}
|
|
311
|
-
interface SliderApi<T extends PropTypes = PropTypes> {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
337
|
+
export interface SliderApi<T extends PropTypes = PropTypes> {
|
|
338
|
+
/**
|
|
339
|
+
* The value of the slider.
|
|
340
|
+
*/
|
|
341
|
+
value: number[];
|
|
342
|
+
/**
|
|
343
|
+
* Whether the slider is being dragged.
|
|
344
|
+
*/
|
|
345
|
+
dragging: boolean;
|
|
346
|
+
/**
|
|
347
|
+
* Whether the slider is focused.
|
|
348
|
+
*/
|
|
349
|
+
focused: boolean;
|
|
350
|
+
/**
|
|
351
|
+
* Function to set the value of the slider.
|
|
352
|
+
*/
|
|
353
|
+
setValue: (value: number[]) => void;
|
|
354
|
+
/**
|
|
355
|
+
* Returns the value of the thumb at the given index.
|
|
356
|
+
*/
|
|
357
|
+
getThumbValue: (index: number) => number;
|
|
358
|
+
/**
|
|
359
|
+
* Sets the value of the thumb at the given index.
|
|
360
|
+
*/
|
|
361
|
+
setThumbValue: (index: number, value: number) => void;
|
|
362
|
+
/**
|
|
363
|
+
* Returns the percent of the thumb at the given index.
|
|
364
|
+
*/
|
|
365
|
+
getValuePercent: (value: number) => number;
|
|
366
|
+
/**
|
|
367
|
+
* Returns the value of the thumb at the given percent.
|
|
368
|
+
*/
|
|
369
|
+
getPercentValue: (percent: number) => number;
|
|
370
|
+
/**
|
|
371
|
+
* Returns the percent of the thumb at the given index.
|
|
372
|
+
*/
|
|
373
|
+
getThumbPercent: (index: number) => number;
|
|
374
|
+
/**
|
|
375
|
+
* Sets the percent of the thumb at the given index.
|
|
376
|
+
*/
|
|
377
|
+
setThumbPercent: (index: number, percent: number) => void;
|
|
378
|
+
/**
|
|
379
|
+
* Returns the min value of the thumb at the given index.
|
|
380
|
+
*/
|
|
381
|
+
getThumbMin: (index: number) => number;
|
|
382
|
+
/**
|
|
383
|
+
* Returns the max value of the thumb at the given index.
|
|
384
|
+
*/
|
|
385
|
+
getThumbMax: (index: number) => number;
|
|
386
|
+
/**
|
|
387
|
+
* Function to increment the value of the slider at the given index.
|
|
388
|
+
*/
|
|
389
|
+
increment: (index: number) => void;
|
|
390
|
+
/**
|
|
391
|
+
* Function to decrement the value of the slider at the given index.
|
|
392
|
+
*/
|
|
393
|
+
decrement: (index: number) => void;
|
|
394
|
+
/**
|
|
395
|
+
* Function to focus the slider. This focuses the first thumb.
|
|
396
|
+
*/
|
|
397
|
+
focus: VoidFunction;
|
|
398
|
+
/**
|
|
399
|
+
* Returns the state of the slider
|
|
400
|
+
*/
|
|
401
|
+
getRootState: () => RootState;
|
|
402
|
+
getLabelProps: () => T["label"];
|
|
403
|
+
getRootProps: () => T["element"];
|
|
404
|
+
getValueTextProps: () => T["element"];
|
|
405
|
+
getTrackProps: () => T["element"];
|
|
406
|
+
/**
|
|
407
|
+
* Returns the state of a specific thumb
|
|
408
|
+
*/
|
|
409
|
+
getThumbState: (props: ThumbProps) => ThumbState;
|
|
410
|
+
getThumbProps: (props: ThumbProps) => T["element"];
|
|
411
|
+
getHiddenInputProps: (props: ThumbProps) => T["input"];
|
|
412
|
+
getRangeProps: () => T["element"];
|
|
413
|
+
getControlProps: () => T["element"];
|
|
414
|
+
getMarkerGroupProps: () => T["element"];
|
|
415
|
+
/**
|
|
416
|
+
* Returns the state of a specific marker
|
|
417
|
+
*/
|
|
418
|
+
getMarkerState: (props: MarkerProps) => MarkerState;
|
|
419
|
+
getMarkerProps: (props: MarkerProps) => T["element"];
|
|
420
|
+
getDraggingIndicatorProps: (props: DraggingIndicatorProps) => T["element"];
|
|
395
421
|
}
|
|
396
|
-
|
|
397
|
-
export type { DraggingIndicatorProps, ElementIds, FocusChangeDetails, MarkerProps, MarkerState, RootState, SliderApi, SliderMachine, SliderOrigin, SliderProps, SliderSchema, SliderService, ThumbAlignment, ThumbCollisionBehavior, ThumbProps, ThumbState, ValueChangeDetails, ValueTextDetails };
|
|
422
|
+
export {};
|