@zag-js/number-input 0.1.7 → 0.1.8
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 +16 -12
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +16 -12
- package/dist/index.mjs.map +3 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -131,17 +131,6 @@ function getNativeEvent(event) {
|
|
|
131
131
|
var _a;
|
|
132
132
|
return (_a = event.nativeEvent) != null ? _a : event;
|
|
133
133
|
}
|
|
134
|
-
var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
|
|
135
|
-
var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
|
|
136
|
-
function getEventStep(event) {
|
|
137
|
-
if (event.ctrlKey || event.metaKey) {
|
|
138
|
-
return 0.1;
|
|
139
|
-
} else {
|
|
140
|
-
const isPageKey = PAGE_KEYS.has(event.key);
|
|
141
|
-
const isSkipKey = isPageKey || event.shiftKey && ARROW_KEYS.has(event.key);
|
|
142
|
-
return isSkipKey ? 10 : 1;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
134
|
function observeAttributes(node, attributes, fn) {
|
|
146
135
|
if (!node)
|
|
147
136
|
return noop;
|
|
@@ -157,6 +146,17 @@ function observeAttributes(node, attributes, fn) {
|
|
|
157
146
|
obs.observe(node, { attributes: true, attributeFilter: attrs });
|
|
158
147
|
return () => obs.disconnect();
|
|
159
148
|
}
|
|
149
|
+
var PAGE_KEYS = /* @__PURE__ */ new Set(["PageUp", "PageDown"]);
|
|
150
|
+
var ARROW_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"]);
|
|
151
|
+
function getEventStep(event) {
|
|
152
|
+
if (event.ctrlKey || event.metaKey) {
|
|
153
|
+
return 0.1;
|
|
154
|
+
} else {
|
|
155
|
+
const isPageKey = PAGE_KEYS.has(event.key);
|
|
156
|
+
const isSkipKey = isPageKey || event.shiftKey && ARROW_KEYS.has(event.key);
|
|
157
|
+
return isSkipKey ? 10 : 1;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
160
|
function itemById(v, id) {
|
|
161
161
|
return v.find((node) => node.id === id);
|
|
162
162
|
}
|
|
@@ -327,7 +327,11 @@ function getEventPoint(e, t2 = "page") {
|
|
|
327
327
|
|
|
328
328
|
// ../../types/dist/index.mjs
|
|
329
329
|
function createNormalizer(fn) {
|
|
330
|
-
return {
|
|
330
|
+
return new Proxy({}, {
|
|
331
|
+
get() {
|
|
332
|
+
return fn;
|
|
333
|
+
}
|
|
334
|
+
});
|
|
331
335
|
}
|
|
332
336
|
var normalizeProp = createNormalizer((v) => v);
|
|
333
337
|
|