@zag-js/slider 0.0.0-dev-20221118143153 → 0.0.0-dev-20221121143513
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.js +25 -12
- package/dist/index.mjs +25 -12
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -405,6 +405,21 @@ function trackFieldsetDisabled(el, callback) {
|
|
|
405
405
|
callback(fieldset.disabled);
|
|
406
406
|
return observeAttributes(fieldset, ["disabled"], () => callback(fieldset.disabled));
|
|
407
407
|
}
|
|
408
|
+
function trackFormControl(el, options) {
|
|
409
|
+
if (!el)
|
|
410
|
+
return;
|
|
411
|
+
const { onFieldsetDisabled, onFormReset } = options;
|
|
412
|
+
const cleanups = [
|
|
413
|
+
trackFormReset(el, onFormReset),
|
|
414
|
+
trackFieldsetDisabled(el, (disabled) => {
|
|
415
|
+
if (disabled)
|
|
416
|
+
onFieldsetDisabled();
|
|
417
|
+
})
|
|
418
|
+
];
|
|
419
|
+
return () => {
|
|
420
|
+
cleanups.forEach((cleanup) => cleanup == null ? void 0 : cleanup());
|
|
421
|
+
};
|
|
422
|
+
}
|
|
408
423
|
|
|
409
424
|
// ../../utilities/number/dist/index.mjs
|
|
410
425
|
function round(v, t) {
|
|
@@ -912,7 +927,7 @@ function machine(userContext) {
|
|
|
912
927
|
watch: {
|
|
913
928
|
value: ["invokeOnChange", "dispatchChangeEvent"]
|
|
914
929
|
},
|
|
915
|
-
activities: ["
|
|
930
|
+
activities: ["trackFormControlState", "trackThumbSize"],
|
|
916
931
|
on: {
|
|
917
932
|
SET_VALUE: {
|
|
918
933
|
actions: "setValue"
|
|
@@ -1001,17 +1016,15 @@ function machine(userContext) {
|
|
|
1001
1016
|
isVertical: (ctx2) => ctx2.isVertical
|
|
1002
1017
|
},
|
|
1003
1018
|
activities: {
|
|
1004
|
-
|
|
1005
|
-
return
|
|
1006
|
-
|
|
1007
|
-
ctx2.disabled =
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
if (ctx2.initialValue != null) {
|
|
1014
|
-
ctx2.value = ctx2.initialValue;
|
|
1019
|
+
trackFormControlState(ctx2) {
|
|
1020
|
+
return trackFormControl(dom.getInputEl(ctx2), {
|
|
1021
|
+
onFieldsetDisabled() {
|
|
1022
|
+
ctx2.disabled = true;
|
|
1023
|
+
},
|
|
1024
|
+
onFormReset() {
|
|
1025
|
+
if (ctx2.initialValue != null) {
|
|
1026
|
+
ctx2.value = ctx2.initialValue;
|
|
1027
|
+
}
|
|
1015
1028
|
}
|
|
1016
1029
|
});
|
|
1017
1030
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -377,6 +377,21 @@ function trackFieldsetDisabled(el, callback) {
|
|
|
377
377
|
callback(fieldset.disabled);
|
|
378
378
|
return observeAttributes(fieldset, ["disabled"], () => callback(fieldset.disabled));
|
|
379
379
|
}
|
|
380
|
+
function trackFormControl(el, options) {
|
|
381
|
+
if (!el)
|
|
382
|
+
return;
|
|
383
|
+
const { onFieldsetDisabled, onFormReset } = options;
|
|
384
|
+
const cleanups = [
|
|
385
|
+
trackFormReset(el, onFormReset),
|
|
386
|
+
trackFieldsetDisabled(el, (disabled) => {
|
|
387
|
+
if (disabled)
|
|
388
|
+
onFieldsetDisabled();
|
|
389
|
+
})
|
|
390
|
+
];
|
|
391
|
+
return () => {
|
|
392
|
+
cleanups.forEach((cleanup) => cleanup == null ? void 0 : cleanup());
|
|
393
|
+
};
|
|
394
|
+
}
|
|
380
395
|
|
|
381
396
|
// ../../utilities/number/dist/index.mjs
|
|
382
397
|
function round(v, t) {
|
|
@@ -884,7 +899,7 @@ function machine(userContext) {
|
|
|
884
899
|
watch: {
|
|
885
900
|
value: ["invokeOnChange", "dispatchChangeEvent"]
|
|
886
901
|
},
|
|
887
|
-
activities: ["
|
|
902
|
+
activities: ["trackFormControlState", "trackThumbSize"],
|
|
888
903
|
on: {
|
|
889
904
|
SET_VALUE: {
|
|
890
905
|
actions: "setValue"
|
|
@@ -973,17 +988,15 @@ function machine(userContext) {
|
|
|
973
988
|
isVertical: (ctx2) => ctx2.isVertical
|
|
974
989
|
},
|
|
975
990
|
activities: {
|
|
976
|
-
|
|
977
|
-
return
|
|
978
|
-
|
|
979
|
-
ctx2.disabled =
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
if (ctx2.initialValue != null) {
|
|
986
|
-
ctx2.value = ctx2.initialValue;
|
|
991
|
+
trackFormControlState(ctx2) {
|
|
992
|
+
return trackFormControl(dom.getInputEl(ctx2), {
|
|
993
|
+
onFieldsetDisabled() {
|
|
994
|
+
ctx2.disabled = true;
|
|
995
|
+
},
|
|
996
|
+
onFormReset() {
|
|
997
|
+
if (ctx2.initialValue != null) {
|
|
998
|
+
ctx2.value = ctx2.initialValue;
|
|
999
|
+
}
|
|
987
1000
|
}
|
|
988
1001
|
});
|
|
989
1002
|
},
|
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-20221121143513",
|
|
4
4
|
"description": "Core logic for the slider widget implemented as a state machine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/core": "0.
|
|
32
|
+
"@zag-js/core": "0.2.2",
|
|
33
33
|
"@zag-js/element-size": "0.3.0",
|
|
34
|
-
"@zag-js/types": "0.
|
|
34
|
+
"@zag-js/types": "0.3.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@zag-js/dom-utils": "0.
|
|
38
|
-
"@zag-js/form-utils": "0.0.0-dev-
|
|
39
|
-
"@zag-js/utils": "0.
|
|
37
|
+
"@zag-js/dom-utils": "0.2.1",
|
|
38
|
+
"@zag-js/form-utils": "0.0.0-dev-20221121143513",
|
|
39
|
+
"@zag-js/utils": "0.3.1",
|
|
40
40
|
"@zag-js/number-utils": "0.2.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|