@zag-js/slider 0.0.0-dev-20230222120620 → 0.0.0-dev-20230222181847
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.
|
@@ -25,21 +25,51 @@ function connect(state, send, normalize) {
|
|
|
25
25
|
return getValuePercent(value, state.context.min, state.context.max);
|
|
26
26
|
}
|
|
27
27
|
return {
|
|
28
|
+
/**
|
|
29
|
+
* Whether the slider is focused.
|
|
30
|
+
*/
|
|
28
31
|
isFocused,
|
|
32
|
+
/**
|
|
33
|
+
* Whether the slider is being dragged.
|
|
34
|
+
*/
|
|
29
35
|
isDragging,
|
|
36
|
+
/**
|
|
37
|
+
* The value of the slider.
|
|
38
|
+
*/
|
|
30
39
|
value: state.context.value,
|
|
40
|
+
/**
|
|
41
|
+
* The value of the slider as a percent.
|
|
42
|
+
*/
|
|
31
43
|
percent: getValuePercent(state.context.value, state.context.min, state.context.max),
|
|
44
|
+
/**
|
|
45
|
+
* Function to set the value of the slider.
|
|
46
|
+
*/
|
|
32
47
|
setValue(value) {
|
|
33
48
|
send({ type: "SET_VALUE", value });
|
|
34
49
|
},
|
|
50
|
+
/**
|
|
51
|
+
* Returns the value of the slider at the given percent.
|
|
52
|
+
*/
|
|
35
53
|
getPercentValue: getPercentValueFn,
|
|
54
|
+
/**
|
|
55
|
+
* Returns the percent of the slider at the given value.
|
|
56
|
+
*/
|
|
36
57
|
getValuePercent: getValuePercentFn,
|
|
58
|
+
/**
|
|
59
|
+
* Function to focus the slider.
|
|
60
|
+
*/
|
|
37
61
|
focus() {
|
|
38
62
|
dom.getThumbEl(state.context)?.focus();
|
|
39
63
|
},
|
|
64
|
+
/**
|
|
65
|
+
* Function to increment the value of the slider by the step.
|
|
66
|
+
*/
|
|
40
67
|
increment() {
|
|
41
68
|
send("INCREMENT");
|
|
42
69
|
},
|
|
70
|
+
/**
|
|
71
|
+
* Function to decrement the value of the slider by the step.
|
|
72
|
+
*/
|
|
43
73
|
decrement() {
|
|
44
74
|
send("DECREMENT");
|
|
45
75
|
},
|
package/dist/index.js
CHANGED
|
@@ -222,21 +222,51 @@ function connect(state, send, normalize) {
|
|
|
222
222
|
return (0, import_numeric_range3.getValuePercent)(value, state.context.min, state.context.max);
|
|
223
223
|
}
|
|
224
224
|
return {
|
|
225
|
+
/**
|
|
226
|
+
* Whether the slider is focused.
|
|
227
|
+
*/
|
|
225
228
|
isFocused,
|
|
229
|
+
/**
|
|
230
|
+
* Whether the slider is being dragged.
|
|
231
|
+
*/
|
|
226
232
|
isDragging,
|
|
233
|
+
/**
|
|
234
|
+
* The value of the slider.
|
|
235
|
+
*/
|
|
227
236
|
value: state.context.value,
|
|
237
|
+
/**
|
|
238
|
+
* The value of the slider as a percent.
|
|
239
|
+
*/
|
|
228
240
|
percent: (0, import_numeric_range3.getValuePercent)(state.context.value, state.context.min, state.context.max),
|
|
241
|
+
/**
|
|
242
|
+
* Function to set the value of the slider.
|
|
243
|
+
*/
|
|
229
244
|
setValue(value) {
|
|
230
245
|
send({ type: "SET_VALUE", value });
|
|
231
246
|
},
|
|
247
|
+
/**
|
|
248
|
+
* Returns the value of the slider at the given percent.
|
|
249
|
+
*/
|
|
232
250
|
getPercentValue: getPercentValueFn,
|
|
251
|
+
/**
|
|
252
|
+
* Returns the percent of the slider at the given value.
|
|
253
|
+
*/
|
|
233
254
|
getValuePercent: getValuePercentFn,
|
|
255
|
+
/**
|
|
256
|
+
* Function to focus the slider.
|
|
257
|
+
*/
|
|
234
258
|
focus() {
|
|
235
259
|
dom.getThumbEl(state.context)?.focus();
|
|
236
260
|
},
|
|
261
|
+
/**
|
|
262
|
+
* Function to increment the value of the slider by the step.
|
|
263
|
+
*/
|
|
237
264
|
increment() {
|
|
238
265
|
send("INCREMENT");
|
|
239
266
|
},
|
|
267
|
+
/**
|
|
268
|
+
* Function to decrement the value of the slider by the step.
|
|
269
|
+
*/
|
|
240
270
|
decrement() {
|
|
241
271
|
send("DECREMENT");
|
|
242
272
|
},
|
package/dist/index.mjs
CHANGED
package/dist/slider.connect.d.ts
CHANGED
|
@@ -3,15 +3,45 @@ import { State, Send } from './slider.types.js';
|
|
|
3
3
|
import '@zag-js/core';
|
|
4
4
|
|
|
5
5
|
declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the slider is focused.
|
|
8
|
+
*/
|
|
6
9
|
isFocused: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the slider is being dragged.
|
|
12
|
+
*/
|
|
7
13
|
isDragging: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The value of the slider.
|
|
16
|
+
*/
|
|
8
17
|
value: number;
|
|
18
|
+
/**
|
|
19
|
+
* The value of the slider as a percent.
|
|
20
|
+
*/
|
|
9
21
|
percent: number;
|
|
22
|
+
/**
|
|
23
|
+
* Function to set the value of the slider.
|
|
24
|
+
*/
|
|
10
25
|
setValue(value: number): void;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the value of the slider at the given percent.
|
|
28
|
+
*/
|
|
11
29
|
getPercentValue: (percent: number) => number;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the percent of the slider at the given value.
|
|
32
|
+
*/
|
|
12
33
|
getValuePercent: (value: number) => number;
|
|
34
|
+
/**
|
|
35
|
+
* Function to focus the slider.
|
|
36
|
+
*/
|
|
13
37
|
focus(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Function to increment the value of the slider by the step.
|
|
40
|
+
*/
|
|
14
41
|
increment(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Function to decrement the value of the slider by the step.
|
|
44
|
+
*/
|
|
15
45
|
decrement(): void;
|
|
16
46
|
rootProps: T["element"];
|
|
17
47
|
labelProps: T["label"];
|
package/dist/slider.connect.js
CHANGED
|
@@ -217,21 +217,51 @@ function connect(state, send, normalize) {
|
|
|
217
217
|
return (0, import_numeric_range3.getValuePercent)(value, state.context.min, state.context.max);
|
|
218
218
|
}
|
|
219
219
|
return {
|
|
220
|
+
/**
|
|
221
|
+
* Whether the slider is focused.
|
|
222
|
+
*/
|
|
220
223
|
isFocused,
|
|
224
|
+
/**
|
|
225
|
+
* Whether the slider is being dragged.
|
|
226
|
+
*/
|
|
221
227
|
isDragging,
|
|
228
|
+
/**
|
|
229
|
+
* The value of the slider.
|
|
230
|
+
*/
|
|
222
231
|
value: state.context.value,
|
|
232
|
+
/**
|
|
233
|
+
* The value of the slider as a percent.
|
|
234
|
+
*/
|
|
223
235
|
percent: (0, import_numeric_range3.getValuePercent)(state.context.value, state.context.min, state.context.max),
|
|
236
|
+
/**
|
|
237
|
+
* Function to set the value of the slider.
|
|
238
|
+
*/
|
|
224
239
|
setValue(value) {
|
|
225
240
|
send({ type: "SET_VALUE", value });
|
|
226
241
|
},
|
|
242
|
+
/**
|
|
243
|
+
* Returns the value of the slider at the given percent.
|
|
244
|
+
*/
|
|
227
245
|
getPercentValue: getPercentValueFn,
|
|
246
|
+
/**
|
|
247
|
+
* Returns the percent of the slider at the given value.
|
|
248
|
+
*/
|
|
228
249
|
getValuePercent: getValuePercentFn,
|
|
250
|
+
/**
|
|
251
|
+
* Function to focus the slider.
|
|
252
|
+
*/
|
|
229
253
|
focus() {
|
|
230
254
|
dom.getThumbEl(state.context)?.focus();
|
|
231
255
|
},
|
|
256
|
+
/**
|
|
257
|
+
* Function to increment the value of the slider by the step.
|
|
258
|
+
*/
|
|
232
259
|
increment() {
|
|
233
260
|
send("INCREMENT");
|
|
234
261
|
},
|
|
262
|
+
/**
|
|
263
|
+
* Function to decrement the value of the slider by the step.
|
|
264
|
+
*/
|
|
235
265
|
decrement() {
|
|
236
266
|
send("DECREMENT");
|
|
237
267
|
},
|
package/dist/slider.connect.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/slider",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230222181847",
|
|
4
4
|
"description": "Core logic for the slider widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@zag-js/anatomy": "0.1.4",
|
|
30
|
-
"@zag-js/core": "0.0.0-dev-
|
|
31
|
-
"@zag-js/dom-query": "0.0.0-dev-
|
|
32
|
-
"@zag-js/dom-event": "0.0.0-dev-
|
|
33
|
-
"@zag-js/form-utils": "0.0.0-dev-
|
|
30
|
+
"@zag-js/core": "0.0.0-dev-20230222181847",
|
|
31
|
+
"@zag-js/dom-query": "0.0.0-dev-20230222181847",
|
|
32
|
+
"@zag-js/dom-event": "0.0.0-dev-20230222181847",
|
|
33
|
+
"@zag-js/form-utils": "0.0.0-dev-20230222181847",
|
|
34
34
|
"@zag-js/utils": "0.3.3",
|
|
35
35
|
"@zag-js/element-size": "0.3.2",
|
|
36
36
|
"@zag-js/numeric-range": "0.1.1",
|