@zag-js/number-input 0.0.0-dev-20220509202935 → 0.0.0-dev-20220510202352
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 +12 -22
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +12 -22
- package/dist/index.mjs.map +2 -2
- package/dist/number-input.connect.d.ts.map +1 -1
- package/dist/number-input.machine.d.ts.map +1 -1
- package/dist/number-input.types.d.ts +5 -4
- package/dist/number-input.types.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -58,6 +58,12 @@ function nextTick(fn) {
|
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
function raf(fn) {
|
|
62
|
+
const id = globalThis.requestAnimationFrame(fn);
|
|
63
|
+
return function cleanup() {
|
|
64
|
+
globalThis.cancelAnimationFrame(id);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
61
67
|
var noop = () => {
|
|
62
68
|
};
|
|
63
69
|
var pipe = (...fns) => (v) => fns.reduce((a, b) => b(a), v);
|
|
@@ -524,10 +530,8 @@ function connect(state, send, normalize = normalizeProp) {
|
|
|
524
530
|
send({ type: "SET_VALUE", value: state.context.min });
|
|
525
531
|
},
|
|
526
532
|
focus() {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
(_a = dom.getInputEl(state.context)) == null ? void 0 : _a.focus();
|
|
530
|
-
});
|
|
533
|
+
var _a;
|
|
534
|
+
(_a = dom.getInputEl(state.context)) == null ? void 0 : _a.focus();
|
|
531
535
|
},
|
|
532
536
|
rootProps: normalize.element({
|
|
533
537
|
id: dom.getRootId(state.context),
|
|
@@ -778,7 +782,7 @@ function machine(ctx = {}) {
|
|
|
778
782
|
actions: "setToMax"
|
|
779
783
|
},
|
|
780
784
|
CHANGE: {
|
|
781
|
-
actions: ["setValue", "
|
|
785
|
+
actions: ["setValue", "setHint"]
|
|
782
786
|
},
|
|
783
787
|
BLUR: [
|
|
784
788
|
{
|
|
@@ -813,7 +817,7 @@ function machine(ctx = {}) {
|
|
|
813
817
|
on: {
|
|
814
818
|
PRESS_UP: {
|
|
815
819
|
target: "focused",
|
|
816
|
-
actions:
|
|
820
|
+
actions: "clearHint"
|
|
817
821
|
}
|
|
818
822
|
}
|
|
819
823
|
},
|
|
@@ -835,7 +839,7 @@ function machine(ctx = {}) {
|
|
|
835
839
|
on: {
|
|
836
840
|
PRESS_UP: {
|
|
837
841
|
target: "focused",
|
|
838
|
-
actions:
|
|
842
|
+
actions: "clearHint"
|
|
839
843
|
}
|
|
840
844
|
}
|
|
841
845
|
},
|
|
@@ -947,7 +951,7 @@ function machine(ctx = {}) {
|
|
|
947
951
|
if (!ctx2.focusInputOnChange)
|
|
948
952
|
return;
|
|
949
953
|
const input = dom.getInputEl(ctx2);
|
|
950
|
-
|
|
954
|
+
raf(() => input == null ? void 0 : input.focus());
|
|
951
955
|
},
|
|
952
956
|
increment(ctx2, evt) {
|
|
953
957
|
ctx2.value = utils.increment(ctx2, evt.step);
|
|
@@ -984,20 +988,6 @@ function machine(ctx = {}) {
|
|
|
984
988
|
setHintToSet(ctx2) {
|
|
985
989
|
ctx2.hint = "set";
|
|
986
990
|
},
|
|
987
|
-
setSelectionRange(ctx2, evt) {
|
|
988
|
-
ctx2.inputSelection = {
|
|
989
|
-
start: evt.target.selectionStart,
|
|
990
|
-
end: evt.target.selectionEnd
|
|
991
|
-
};
|
|
992
|
-
},
|
|
993
|
-
restoreSelection(ctx2) {
|
|
994
|
-
var _a, _b, _c;
|
|
995
|
-
const input = dom.getInputEl(ctx2);
|
|
996
|
-
if (!input || !ctx2.inputSelection)
|
|
997
|
-
return;
|
|
998
|
-
input.selectionStart = (_b = ctx2.inputSelection.start) != null ? _b : (_a = input.value) == null ? void 0 : _a.length;
|
|
999
|
-
input.selectionEnd = (_c = ctx2.inputSelection.end) != null ? _c : input.selectionStart;
|
|
1000
|
-
},
|
|
1001
991
|
invokeOnChange(ctx2) {
|
|
1002
992
|
var _a;
|
|
1003
993
|
(_a = ctx2.onChange) == null ? void 0 : _a.call(ctx2, { value: ctx2.value, valueAsNumber: ctx2.valueAsNumber });
|