@zag-js/number-input 0.78.1 → 0.78.3
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 +4 -4
- package/dist/index.mjs +5 -5
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -70,7 +70,7 @@ var dom = domQuery.createScope({
|
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
},
|
|
73
|
-
|
|
73
|
+
getMousemoveValue(ctx, event) {
|
|
74
74
|
const x = numberUtils.roundToDevicePixel(event.movementX);
|
|
75
75
|
const y = numberUtils.roundToDevicePixel(event.movementY);
|
|
76
76
|
let hint = x > 0 ? "increment" : x < 0 ? "decrement" : null;
|
|
@@ -224,7 +224,7 @@ function connect(state, send, normalize) {
|
|
|
224
224
|
onBlur() {
|
|
225
225
|
send("INPUT.BLUR");
|
|
226
226
|
},
|
|
227
|
-
|
|
227
|
+
onInput(event) {
|
|
228
228
|
send({ type: "INPUT.CHANGE", target: event.currentTarget, hint: "set" });
|
|
229
229
|
},
|
|
230
230
|
onBeforeInput(event) {
|
|
@@ -673,7 +673,7 @@ function machine(userContext) {
|
|
|
673
673
|
const doc = dom.getDoc(ctx2);
|
|
674
674
|
function onMousemove(event) {
|
|
675
675
|
if (!ctx2.scrubberCursorPoint) return;
|
|
676
|
-
const value = dom.
|
|
676
|
+
const value = dom.getMousemoveValue(ctx2, event);
|
|
677
677
|
if (!value.hint) return;
|
|
678
678
|
send({
|
|
679
679
|
type: "SCRUBBER.POINTER_MOVE",
|
|
@@ -801,7 +801,7 @@ var sync = {
|
|
|
801
801
|
if (!inputEl) return;
|
|
802
802
|
const sel = recordCursor(inputEl);
|
|
803
803
|
domQuery.raf(() => {
|
|
804
|
-
|
|
804
|
+
formUtils.setElementValue(inputEl, value);
|
|
805
805
|
restoreCursor(inputEl, sel);
|
|
806
806
|
});
|
|
807
807
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { getEventStep, isLeftClick, getEventPoint, addDomEvent, requestPointerLo
|
|
|
3
3
|
import { createScope, isSafari, MAX_Z_INDEX, dataAttr, ariaAttr, isComposingEvent, observeAttributes, raf } from '@zag-js/dom-query';
|
|
4
4
|
import { roundToDevicePixel, wrap, isAtMin, isAtMax, isWithinRange, increment, clamp, decrement } from '@zag-js/number-utils';
|
|
5
5
|
import { createMachine, choose, ref, guards } from '@zag-js/core';
|
|
6
|
-
import { trackFormControl } from '@zag-js/form-utils';
|
|
6
|
+
import { trackFormControl, setElementValue } from '@zag-js/form-utils';
|
|
7
7
|
import { compact, callAll, isEqual } from '@zag-js/utils';
|
|
8
8
|
import { NumberParser } from '@internationalized/number';
|
|
9
9
|
|
|
@@ -68,7 +68,7 @@ var dom = createScope({
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
},
|
|
71
|
-
|
|
71
|
+
getMousemoveValue(ctx, event) {
|
|
72
72
|
const x = roundToDevicePixel(event.movementX);
|
|
73
73
|
const y = roundToDevicePixel(event.movementY);
|
|
74
74
|
let hint = x > 0 ? "increment" : x < 0 ? "decrement" : null;
|
|
@@ -222,7 +222,7 @@ function connect(state, send, normalize) {
|
|
|
222
222
|
onBlur() {
|
|
223
223
|
send("INPUT.BLUR");
|
|
224
224
|
},
|
|
225
|
-
|
|
225
|
+
onInput(event) {
|
|
226
226
|
send({ type: "INPUT.CHANGE", target: event.currentTarget, hint: "set" });
|
|
227
227
|
},
|
|
228
228
|
onBeforeInput(event) {
|
|
@@ -671,7 +671,7 @@ function machine(userContext) {
|
|
|
671
671
|
const doc = dom.getDoc(ctx2);
|
|
672
672
|
function onMousemove(event) {
|
|
673
673
|
if (!ctx2.scrubberCursorPoint) return;
|
|
674
|
-
const value = dom.
|
|
674
|
+
const value = dom.getMousemoveValue(ctx2, event);
|
|
675
675
|
if (!value.hint) return;
|
|
676
676
|
send({
|
|
677
677
|
type: "SCRUBBER.POINTER_MOVE",
|
|
@@ -799,7 +799,7 @@ var sync = {
|
|
|
799
799
|
if (!inputEl) return;
|
|
800
800
|
const sel = recordCursor(inputEl);
|
|
801
801
|
raf(() => {
|
|
802
|
-
|
|
802
|
+
setElementValue(inputEl, value);
|
|
803
803
|
restoreCursor(inputEl, sel);
|
|
804
804
|
});
|
|
805
805
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/number-input",
|
|
3
|
-
"version": "0.78.
|
|
3
|
+
"version": "0.78.3",
|
|
4
4
|
"description": "Core logic for the number-input widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@internationalized/number": "3.6.0",
|
|
30
|
-
"@zag-js/anatomy": "0.78.
|
|
31
|
-
"@zag-js/core": "0.78.
|
|
32
|
-
"@zag-js/dom-event": "0.78.
|
|
33
|
-
"@zag-js/dom-query": "0.78.
|
|
34
|
-
"@zag-js/form-utils": "0.78.
|
|
35
|
-
"@zag-js/number-utils": "0.78.
|
|
36
|
-
"@zag-js/types": "0.78.
|
|
37
|
-
"@zag-js/utils": "0.78.
|
|
30
|
+
"@zag-js/anatomy": "0.78.3",
|
|
31
|
+
"@zag-js/core": "0.78.3",
|
|
32
|
+
"@zag-js/dom-event": "0.78.3",
|
|
33
|
+
"@zag-js/dom-query": "0.78.3",
|
|
34
|
+
"@zag-js/form-utils": "0.78.3",
|
|
35
|
+
"@zag-js/number-utils": "0.78.3",
|
|
36
|
+
"@zag-js/types": "0.78.3",
|
|
37
|
+
"@zag-js/utils": "0.78.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"clean-package": "2.2.0"
|