@zag-js/number-input 0.0.0-dev-20220521182338 → 0.0.0-dev-20220522061015
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 +8 -5
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +8 -5
- package/dist/index.mjs.map +2 -2
- package/dist/number-input.machine.d.ts.map +1 -1
- package/package.json +2 -2
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,13 +790,14 @@ function machine(ctx = {}) {
|
|
|
788
790
|
},
|
|
789
791
|
{
|
|
790
792
|
target: "idle",
|
|
791
|
-
actions:
|
|
793
|
+
actions: "roundValue"
|
|
792
794
|
}
|
|
793
795
|
]
|
|
794
796
|
}
|
|
795
797
|
},
|
|
796
798
|
"before:spin": {
|
|
797
799
|
tags: ["focus"],
|
|
800
|
+
activities: "trackButtonDisabled",
|
|
798
801
|
entry: (0, import_core.choose)([
|
|
799
802
|
{ guard: "isIncrementHint", actions: "increment" },
|
|
800
803
|
{ guard: "isDecrementHint", actions: "decrement" }
|
|
@@ -842,7 +845,7 @@ function machine(ctx = {}) {
|
|
|
842
845
|
on: {
|
|
843
846
|
POINTER_UP_SCRUBBER: {
|
|
844
847
|
target: "focused",
|
|
845
|
-
actions:
|
|
848
|
+
actions: "clearCursorPoint"
|
|
846
849
|
},
|
|
847
850
|
POINTER_MOVE_SCRUBBER: [
|
|
848
851
|
{
|