@zag-js/number-input 0.1.6 → 0.1.7
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 +7 -5
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +7 -5
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -342,6 +342,7 @@ var isIPad = () => platform(/^iPad/) || isMac() && navigator.maxTouchPoints > 1;
|
|
|
342
342
|
var isIos = () => isIPhone() || isIPad();
|
|
343
343
|
var isSafari = () => ua(/^((?!chrome|android).)*safari/i);
|
|
344
344
|
var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
|
|
345
|
+
var isLeftClick = (v) => v.button === 0;
|
|
345
346
|
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
346
347
|
|
|
347
348
|
// src/number-input.dom.ts
|
|
@@ -606,7 +607,7 @@ function connect(state, send, normalize = normalizeProp) {
|
|
|
606
607
|
onPointerDown(event) {
|
|
607
608
|
if (isDecrementDisabled)
|
|
608
609
|
return;
|
|
609
|
-
send({ type: "PRESS_DOWN", hint: "decrement" });
|
|
610
|
+
send(isLeftClick(event) ? { type: "PRESS_DOWN", hint: "decrement" } : { type: "FOCUS" });
|
|
610
611
|
event.preventDefault();
|
|
611
612
|
},
|
|
612
613
|
onPointerUp() {
|
|
@@ -629,10 +630,10 @@ function connect(state, send, normalize = normalizeProp) {
|
|
|
629
630
|
tabIndex: -1,
|
|
630
631
|
"aria-controls": dom.getInputId(state.context),
|
|
631
632
|
onPointerDown(event) {
|
|
632
|
-
event.preventDefault();
|
|
633
633
|
if (isIncrementDisabled)
|
|
634
634
|
return;
|
|
635
|
-
send({ type: "PRESS_DOWN", hint: "increment" });
|
|
635
|
+
send(isLeftClick(event) ? { type: "PRESS_DOWN", hint: "increment" } : { type: "FOCUS" });
|
|
636
|
+
event.preventDefault();
|
|
636
637
|
},
|
|
637
638
|
onPointerUp() {
|
|
638
639
|
send({ type: "PRESS_UP", hint: "increment" });
|
|
@@ -750,6 +751,7 @@ function machine(ctx = {}) {
|
|
|
750
751
|
},
|
|
751
752
|
focused: {
|
|
752
753
|
tags: ["focus"],
|
|
754
|
+
entry: "focusInput",
|
|
753
755
|
activities: "attachWheelListener",
|
|
754
756
|
on: {
|
|
755
757
|
PRESS_DOWN: {
|
|
@@ -788,7 +790,7 @@ function machine(ctx = {}) {
|
|
|
788
790
|
},
|
|
789
791
|
{
|
|
790
792
|
target: "idle",
|
|
791
|
-
actions:
|
|
793
|
+
actions: "roundValue"
|
|
792
794
|
}
|
|
793
795
|
]
|
|
794
796
|
}
|
|
@@ -843,7 +845,7 @@ function machine(ctx = {}) {
|
|
|
843
845
|
on: {
|
|
844
846
|
POINTER_UP_SCRUBBER: {
|
|
845
847
|
target: "focused",
|
|
846
|
-
actions:
|
|
848
|
+
actions: "clearCursorPoint"
|
|
847
849
|
},
|
|
848
850
|
POINTER_MOVE_SCRUBBER: [
|
|
849
851
|
{
|