@zag-js/number-input 1.47.0 → 1.48.0

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.
Files changed (41) hide show
  1. package/dist/cursor.d.mts +8 -10
  2. package/dist/cursor.d.ts +8 -10
  3. package/dist/cursor.js +65 -104
  4. package/dist/cursor.mjs +59 -77
  5. package/dist/index.d.mts +6 -9
  6. package/dist/index.d.ts +6 -9
  7. package/dist/index.js +12 -38
  8. package/dist/index.mjs +2 -7
  9. package/dist/number-input.anatomy.d.mts +2 -6
  10. package/dist/number-input.anatomy.d.ts +2 -6
  11. package/dist/number-input.anatomy.js +8 -42
  12. package/dist/number-input.anatomy.mjs +4 -16
  13. package/dist/number-input.connect.d.mts +3 -8
  14. package/dist/number-input.connect.d.ts +3 -8
  15. package/dist/number-input.connect.js +310 -310
  16. package/dist/number-input.connect.mjs +304 -284
  17. package/dist/number-input.dom.d.mts +28 -32
  18. package/dist/number-input.dom.d.ts +28 -32
  19. package/dist/number-input.dom.js +96 -137
  20. package/dist/number-input.dom.mjs +76 -96
  21. package/dist/number-input.machine.d.mts +2 -8
  22. package/dist/number-input.machine.d.ts +2 -8
  23. package/dist/number-input.machine.js +484 -460
  24. package/dist/number-input.machine.mjs +478 -440
  25. package/dist/number-input.props.d.mts +3 -9
  26. package/dist/number-input.props.d.ts +3 -9
  27. package/dist/number-input.props.js +40 -65
  28. package/dist/number-input.props.mjs +36 -39
  29. package/dist/number-input.translations.d.mts +3 -8
  30. package/dist/number-input.translations.d.ts +3 -8
  31. package/dist/number-input.translations.js +8 -31
  32. package/dist/number-input.translations.mjs +4 -6
  33. package/dist/number-input.types.d.mts +298 -300
  34. package/dist/number-input.types.d.ts +298 -300
  35. package/dist/number-input.types.js +4 -18
  36. package/dist/number-input.types.mjs +1 -0
  37. package/dist/number-input.utils.d.mts +9 -12
  38. package/dist/number-input.utils.d.ts +9 -12
  39. package/dist/number-input.utils.js +28 -57
  40. package/dist/number-input.utils.mjs +20 -28
  41. package/package.json +8 -8
@@ -1,313 +1,313 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/number-input.connect.ts
31
- var number_input_connect_exports = {};
32
- __export(number_input_connect_exports, {
33
- connect: () => connect
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
34
4
  });
35
- module.exports = __toCommonJS(number_input_connect_exports);
36
- var import_dom_query = require("@zag-js/dom-query");
37
- var import_utils = require("@zag-js/utils");
38
- var import_cursor = require("./cursor.js");
39
- var import_number_input = require("./number-input.anatomy.js");
40
- var dom = __toESM(require("./number-input.dom.js"));
41
- var import_number_input2 = require("./number-input.translations.js");
5
+ const require_cursor = require("./cursor.js");
6
+ const require_number_input_anatomy = require("./number-input.anatomy.js");
7
+ const require_number_input_dom = require("./number-input.dom.js");
8
+ const require_number_input_translations = require("./number-input.translations.js");
9
+ let _zag_js_dom_query = require("@zag-js/dom-query");
10
+ let _zag_js_utils = require("@zag-js/utils");
11
+ // src/number-input.connect.ts
42
12
  function connect(service, normalize) {
43
- const { state, send, prop, scope, computed } = service;
44
- const focused = state.hasTag("focus");
45
- const disabled = computed("isDisabled");
46
- const readOnly = !!prop("readOnly");
47
- const required = !!prop("required");
48
- const scrubbing = state.matches("scrubbing");
49
- const empty = computed("isValueEmpty");
50
- const invalid = prop("invalid") !== void 0 ? !!prop("invalid") : computed("isOutOfRange");
51
- const isIncrementDisabled = disabled || !computed("canIncrement") || readOnly;
52
- const isDecrementDisabled = disabled || !computed("canDecrement") || readOnly;
53
- const translations = (0, import_utils.mergeWithDefault)(import_number_input2.defaultTranslations, prop("translations"));
54
- return {
55
- focused,
56
- invalid,
57
- empty,
58
- value: computed("formattedValue"),
59
- valueAsNumber: computed("valueAsNumber"),
60
- setValue(value) {
61
- send({ type: "VALUE.SET", value });
62
- },
63
- clearValue() {
64
- send({ type: "VALUE.CLEAR" });
65
- },
66
- increment() {
67
- send({ type: "VALUE.INCREMENT" });
68
- },
69
- decrement() {
70
- send({ type: "VALUE.DECREMENT" });
71
- },
72
- setToMax() {
73
- send({ type: "VALUE.SET", value: prop("max") });
74
- },
75
- setToMin() {
76
- send({ type: "VALUE.SET", value: prop("min") });
77
- },
78
- focus() {
79
- dom.getInputEl(scope)?.focus();
80
- },
81
- getRootProps() {
82
- return normalize.element({
83
- id: dom.getRootId(scope),
84
- ...import_number_input.parts.root.attrs,
85
- dir: prop("dir"),
86
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
87
- "data-focus": (0, import_dom_query.dataAttr)(focused),
88
- "data-invalid": (0, import_dom_query.dataAttr)(invalid),
89
- "data-scrubbing": (0, import_dom_query.dataAttr)(scrubbing)
90
- });
91
- },
92
- getLabelProps() {
93
- return normalize.label({
94
- ...import_number_input.parts.label.attrs,
95
- dir: prop("dir"),
96
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
97
- "data-focus": (0, import_dom_query.dataAttr)(focused),
98
- "data-invalid": (0, import_dom_query.dataAttr)(invalid),
99
- "data-required": (0, import_dom_query.dataAttr)(required),
100
- "data-scrubbing": (0, import_dom_query.dataAttr)(scrubbing),
101
- id: dom.getLabelId(scope),
102
- htmlFor: dom.getInputId(scope),
103
- onClick() {
104
- (0, import_dom_query.raf)(() => {
105
- (0, import_dom_query.setCaretToEnd)(dom.getInputEl(scope));
106
- });
107
- }
108
- });
109
- },
110
- getControlProps() {
111
- return normalize.element({
112
- ...import_number_input.parts.control.attrs,
113
- dir: prop("dir"),
114
- role: "group",
115
- "aria-disabled": disabled,
116
- "data-focus": (0, import_dom_query.dataAttr)(focused),
117
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
118
- "data-invalid": (0, import_dom_query.dataAttr)(invalid),
119
- "data-scrubbing": (0, import_dom_query.dataAttr)(scrubbing),
120
- "aria-invalid": (0, import_dom_query.ariaAttr)(invalid)
121
- });
122
- },
123
- getValueTextProps() {
124
- return normalize.element({
125
- ...import_number_input.parts.valueText.attrs,
126
- dir: prop("dir"),
127
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
128
- "data-invalid": (0, import_dom_query.dataAttr)(invalid),
129
- "data-focus": (0, import_dom_query.dataAttr)(focused),
130
- "data-scrubbing": (0, import_dom_query.dataAttr)(scrubbing)
131
- });
132
- },
133
- getInputProps() {
134
- return normalize.input({
135
- ...import_number_input.parts.input.attrs,
136
- dir: prop("dir"),
137
- name: prop("name"),
138
- form: prop("form"),
139
- id: dom.getInputId(scope),
140
- role: "spinbutton",
141
- defaultValue: computed("formattedValue"),
142
- pattern: prop("formatOptions") ? void 0 : prop("pattern"),
143
- inputMode: prop("inputMode"),
144
- "aria-invalid": (0, import_dom_query.ariaAttr)(invalid),
145
- "data-invalid": (0, import_dom_query.dataAttr)(invalid),
146
- disabled,
147
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
148
- readOnly,
149
- required: prop("required"),
150
- autoComplete: "off",
151
- autoCorrect: "off",
152
- spellCheck: "false",
153
- type: "text",
154
- "aria-roledescription": "numberfield",
155
- "aria-valuemin": prop("min"),
156
- "aria-valuemax": prop("max"),
157
- "aria-valuenow": Number.isNaN(computed("valueAsNumber")) ? void 0 : computed("valueAsNumber"),
158
- "aria-valuetext": computed("valueText"),
159
- "data-scrubbing": (0, import_dom_query.dataAttr)(scrubbing),
160
- onFocus() {
161
- send({ type: "INPUT.FOCUS" });
162
- },
163
- onBlur() {
164
- send({ type: "INPUT.BLUR" });
165
- },
166
- onInput(event) {
167
- const selection = (0, import_cursor.recordCursor)(event.currentTarget, scope);
168
- send({ type: "INPUT.CHANGE", target: event.currentTarget, hint: "set", selection });
169
- },
170
- onBeforeInput(event) {
171
- try {
172
- const { selectionStart, selectionEnd, value } = event.currentTarget;
173
- const nextValue = value.slice(0, selectionStart) + (event.data ?? "") + value.slice(selectionEnd);
174
- const isValid = computed("parser").isValidPartialNumber(nextValue);
175
- if (!isValid) {
176
- event.preventDefault();
177
- }
178
- } catch {
179
- }
180
- },
181
- onKeyDown(event) {
182
- if (event.defaultPrevented) return;
183
- if (readOnly) return;
184
- if ((0, import_dom_query.isComposingEvent)(event)) return;
185
- const step = (0, import_dom_query.getEventStepValue)(event, {
186
- step: prop("step"),
187
- largeStep: prop("largeStep"),
188
- smallStep: prop("smallStep")
189
- });
190
- const keyMap = {
191
- ArrowUp() {
192
- send({ type: "INPUT.ARROW_UP", step });
193
- event.preventDefault();
194
- },
195
- ArrowDown() {
196
- send({ type: "INPUT.ARROW_DOWN", step });
197
- event.preventDefault();
198
- },
199
- Home() {
200
- if ((0, import_dom_query.isModifierKey)(event)) return;
201
- send({ type: "INPUT.HOME" });
202
- event.preventDefault();
203
- },
204
- End() {
205
- if ((0, import_dom_query.isModifierKey)(event)) return;
206
- send({ type: "INPUT.END" });
207
- event.preventDefault();
208
- },
209
- Enter(event2) {
210
- const selection = (0, import_cursor.recordCursor)(event2.currentTarget, scope);
211
- send({ type: "INPUT.ENTER", selection });
212
- }
213
- };
214
- const exec = keyMap[event.key];
215
- exec?.(event);
216
- }
217
- });
218
- },
219
- getDecrementTriggerProps() {
220
- return normalize.button({
221
- ...import_number_input.parts.decrementTrigger.attrs,
222
- dir: prop("dir"),
223
- id: dom.getDecrementTriggerId(scope),
224
- disabled: isDecrementDisabled,
225
- "data-disabled": (0, import_dom_query.dataAttr)(isDecrementDisabled),
226
- "aria-label": translations.decrementLabel,
227
- type: "button",
228
- tabIndex: -1,
229
- "aria-controls": dom.getInputId(scope),
230
- "data-scrubbing": (0, import_dom_query.dataAttr)(scrubbing),
231
- onPointerDown(event) {
232
- if (isDecrementDisabled) return;
233
- if (!(0, import_dom_query.isLeftClick)(event)) return;
234
- send({ type: "TRIGGER.PRESS_DOWN", hint: "decrement", pointerType: event.pointerType });
235
- if (event.pointerType === "mouse") {
236
- event.preventDefault();
237
- }
238
- if (event.pointerType === "touch") {
239
- event.currentTarget?.focus({ preventScroll: true });
240
- }
241
- },
242
- onPointerUp(event) {
243
- send({ type: "TRIGGER.PRESS_UP", hint: "decrement", pointerType: event.pointerType });
244
- },
245
- onPointerLeave() {
246
- if (isDecrementDisabled) return;
247
- send({ type: "TRIGGER.PRESS_UP", hint: "decrement" });
248
- }
249
- });
250
- },
251
- getIncrementTriggerProps() {
252
- return normalize.button({
253
- ...import_number_input.parts.incrementTrigger.attrs,
254
- dir: prop("dir"),
255
- id: dom.getIncrementTriggerId(scope),
256
- disabled: isIncrementDisabled,
257
- "data-disabled": (0, import_dom_query.dataAttr)(isIncrementDisabled),
258
- "aria-label": translations.incrementLabel,
259
- type: "button",
260
- tabIndex: -1,
261
- "aria-controls": dom.getInputId(scope),
262
- "data-scrubbing": (0, import_dom_query.dataAttr)(scrubbing),
263
- onPointerDown(event) {
264
- if (isIncrementDisabled || !(0, import_dom_query.isLeftClick)(event)) return;
265
- send({ type: "TRIGGER.PRESS_DOWN", hint: "increment", pointerType: event.pointerType });
266
- if (event.pointerType === "mouse") {
267
- event.preventDefault();
268
- }
269
- if (event.pointerType === "touch") {
270
- event.currentTarget?.focus({ preventScroll: true });
271
- }
272
- },
273
- onPointerUp(event) {
274
- send({ type: "TRIGGER.PRESS_UP", hint: "increment", pointerType: event.pointerType });
275
- },
276
- onPointerLeave(event) {
277
- send({ type: "TRIGGER.PRESS_UP", hint: "increment", pointerType: event.pointerType });
278
- }
279
- });
280
- },
281
- getScrubberProps() {
282
- return normalize.element({
283
- ...import_number_input.parts.scrubber.attrs,
284
- dir: prop("dir"),
285
- "data-disabled": (0, import_dom_query.dataAttr)(disabled),
286
- id: dom.getScrubberId(scope),
287
- role: "presentation",
288
- "data-scrubbing": (0, import_dom_query.dataAttr)(scrubbing),
289
- onMouseDown(event) {
290
- if (disabled) return;
291
- if (!(0, import_dom_query.isLeftClick)(event)) return;
292
- const point = (0, import_dom_query.getEventPoint)(event);
293
- const win = (0, import_dom_query.getWindow)(event.currentTarget);
294
- const dpr = win.devicePixelRatio;
295
- point.x = point.x - (0, import_utils.roundToDpr)(7.5, dpr);
296
- point.y = point.y - (0, import_utils.roundToDpr)(7.5, dpr);
297
- send({ type: "SCRUBBER.PRESS_DOWN", point });
298
- event.preventDefault();
299
- (0, import_dom_query.raf)(() => {
300
- (0, import_dom_query.setCaretToEnd)(dom.getInputEl(scope));
301
- });
302
- },
303
- style: {
304
- cursor: disabled ? void 0 : "ew-resize"
305
- }
306
- });
307
- }
308
- };
13
+ const { state, send, prop, scope, computed } = service;
14
+ const focused = state.hasTag("focus");
15
+ const disabled = computed("isDisabled");
16
+ const readOnly = !!prop("readOnly");
17
+ const required = !!prop("required");
18
+ const scrubbing = state.matches("scrubbing");
19
+ const empty = computed("isValueEmpty");
20
+ const invalid = prop("invalid") !== void 0 ? !!prop("invalid") : computed("isOutOfRange");
21
+ const isIncrementDisabled = disabled || !computed("canIncrement") || readOnly;
22
+ const isDecrementDisabled = disabled || !computed("canDecrement") || readOnly;
23
+ const translations = (0, _zag_js_utils.mergeWithDefault)(require_number_input_translations.defaultTranslations, prop("translations"));
24
+ return {
25
+ focused,
26
+ invalid,
27
+ empty,
28
+ value: computed("formattedValue"),
29
+ valueAsNumber: computed("valueAsNumber"),
30
+ setValue(value) {
31
+ send({
32
+ type: "VALUE.SET",
33
+ value
34
+ });
35
+ },
36
+ clearValue() {
37
+ send({ type: "VALUE.CLEAR" });
38
+ },
39
+ increment() {
40
+ send({ type: "VALUE.INCREMENT" });
41
+ },
42
+ decrement() {
43
+ send({ type: "VALUE.DECREMENT" });
44
+ },
45
+ setToMax() {
46
+ send({
47
+ type: "VALUE.SET",
48
+ value: prop("max")
49
+ });
50
+ },
51
+ setToMin() {
52
+ send({
53
+ type: "VALUE.SET",
54
+ value: prop("min")
55
+ });
56
+ },
57
+ focus() {
58
+ require_number_input_dom.getInputEl(scope)?.focus();
59
+ },
60
+ getRootProps() {
61
+ return normalize.element({
62
+ id: require_number_input_dom.getRootId(scope),
63
+ ...require_number_input_anatomy.parts.root.attrs,
64
+ dir: prop("dir"),
65
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
66
+ "data-focus": (0, _zag_js_dom_query.dataAttr)(focused),
67
+ "data-invalid": (0, _zag_js_dom_query.dataAttr)(invalid),
68
+ "data-scrubbing": (0, _zag_js_dom_query.dataAttr)(scrubbing)
69
+ });
70
+ },
71
+ getLabelProps() {
72
+ return normalize.label({
73
+ ...require_number_input_anatomy.parts.label.attrs,
74
+ dir: prop("dir"),
75
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
76
+ "data-focus": (0, _zag_js_dom_query.dataAttr)(focused),
77
+ "data-invalid": (0, _zag_js_dom_query.dataAttr)(invalid),
78
+ "data-required": (0, _zag_js_dom_query.dataAttr)(required),
79
+ "data-scrubbing": (0, _zag_js_dom_query.dataAttr)(scrubbing),
80
+ id: require_number_input_dom.getLabelId(scope),
81
+ htmlFor: require_number_input_dom.getInputId(scope),
82
+ onClick() {
83
+ (0, _zag_js_dom_query.raf)(() => {
84
+ (0, _zag_js_dom_query.setCaretToEnd)(require_number_input_dom.getInputEl(scope));
85
+ });
86
+ }
87
+ });
88
+ },
89
+ getControlProps() {
90
+ return normalize.element({
91
+ ...require_number_input_anatomy.parts.control.attrs,
92
+ dir: prop("dir"),
93
+ role: "group",
94
+ "aria-disabled": disabled,
95
+ "data-focus": (0, _zag_js_dom_query.dataAttr)(focused),
96
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
97
+ "data-invalid": (0, _zag_js_dom_query.dataAttr)(invalid),
98
+ "data-scrubbing": (0, _zag_js_dom_query.dataAttr)(scrubbing),
99
+ "aria-invalid": (0, _zag_js_dom_query.ariaAttr)(invalid)
100
+ });
101
+ },
102
+ getValueTextProps() {
103
+ return normalize.element({
104
+ ...require_number_input_anatomy.parts.valueText.attrs,
105
+ dir: prop("dir"),
106
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
107
+ "data-invalid": (0, _zag_js_dom_query.dataAttr)(invalid),
108
+ "data-focus": (0, _zag_js_dom_query.dataAttr)(focused),
109
+ "data-scrubbing": (0, _zag_js_dom_query.dataAttr)(scrubbing)
110
+ });
111
+ },
112
+ getInputProps() {
113
+ return normalize.input({
114
+ ...require_number_input_anatomy.parts.input.attrs,
115
+ dir: prop("dir"),
116
+ name: prop("name"),
117
+ form: prop("form"),
118
+ id: require_number_input_dom.getInputId(scope),
119
+ role: "spinbutton",
120
+ defaultValue: computed("formattedValue"),
121
+ pattern: prop("formatOptions") ? void 0 : prop("pattern"),
122
+ inputMode: prop("inputMode"),
123
+ "aria-invalid": (0, _zag_js_dom_query.ariaAttr)(invalid),
124
+ "data-invalid": (0, _zag_js_dom_query.dataAttr)(invalid),
125
+ disabled,
126
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
127
+ readOnly,
128
+ required: prop("required"),
129
+ autoComplete: "off",
130
+ autoCorrect: "off",
131
+ spellCheck: "false",
132
+ type: "text",
133
+ "aria-roledescription": "numberfield",
134
+ "aria-valuemin": prop("min"),
135
+ "aria-valuemax": prop("max"),
136
+ "aria-valuenow": Number.isNaN(computed("valueAsNumber")) ? void 0 : computed("valueAsNumber"),
137
+ "aria-valuetext": computed("valueText"),
138
+ "data-scrubbing": (0, _zag_js_dom_query.dataAttr)(scrubbing),
139
+ onFocus() {
140
+ send({ type: "INPUT.FOCUS" });
141
+ },
142
+ onBlur() {
143
+ send({ type: "INPUT.BLUR" });
144
+ },
145
+ onInput(event) {
146
+ const selection = require_cursor.recordCursor(event.currentTarget, scope);
147
+ send({
148
+ type: "INPUT.CHANGE",
149
+ target: event.currentTarget,
150
+ hint: "set",
151
+ selection
152
+ });
153
+ },
154
+ onBeforeInput(event) {
155
+ try {
156
+ const { selectionStart, selectionEnd, value } = event.currentTarget;
157
+ const nextValue = value.slice(0, selectionStart) + (event.data ?? "") + value.slice(selectionEnd);
158
+ if (!computed("parser").isValidPartialNumber(nextValue)) event.preventDefault();
159
+ } catch {}
160
+ },
161
+ onKeyDown(event) {
162
+ if (event.defaultPrevented) return;
163
+ if (readOnly) return;
164
+ if ((0, _zag_js_dom_query.isComposingEvent)(event)) return;
165
+ const step = (0, _zag_js_dom_query.getEventStepValue)(event, {
166
+ step: prop("step"),
167
+ largeStep: prop("largeStep"),
168
+ smallStep: prop("smallStep")
169
+ });
170
+ const exec = {
171
+ ArrowUp() {
172
+ send({
173
+ type: "INPUT.ARROW_UP",
174
+ step
175
+ });
176
+ event.preventDefault();
177
+ },
178
+ ArrowDown() {
179
+ send({
180
+ type: "INPUT.ARROW_DOWN",
181
+ step
182
+ });
183
+ event.preventDefault();
184
+ },
185
+ Home() {
186
+ if ((0, _zag_js_dom_query.isModifierKey)(event)) return;
187
+ send({ type: "INPUT.HOME" });
188
+ event.preventDefault();
189
+ },
190
+ End() {
191
+ if ((0, _zag_js_dom_query.isModifierKey)(event)) return;
192
+ send({ type: "INPUT.END" });
193
+ event.preventDefault();
194
+ },
195
+ Enter(event) {
196
+ const selection = require_cursor.recordCursor(event.currentTarget, scope);
197
+ send({
198
+ type: "INPUT.ENTER",
199
+ selection
200
+ });
201
+ }
202
+ }[event.key];
203
+ exec?.(event);
204
+ }
205
+ });
206
+ },
207
+ getDecrementTriggerProps() {
208
+ return normalize.button({
209
+ ...require_number_input_anatomy.parts.decrementTrigger.attrs,
210
+ dir: prop("dir"),
211
+ id: require_number_input_dom.getDecrementTriggerId(scope),
212
+ disabled: isDecrementDisabled,
213
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(isDecrementDisabled),
214
+ "aria-label": translations.decrementLabel,
215
+ type: "button",
216
+ tabIndex: -1,
217
+ "aria-controls": require_number_input_dom.getInputId(scope),
218
+ "data-scrubbing": (0, _zag_js_dom_query.dataAttr)(scrubbing),
219
+ onPointerDown(event) {
220
+ if (isDecrementDisabled) return;
221
+ if (!(0, _zag_js_dom_query.isLeftClick)(event)) return;
222
+ send({
223
+ type: "TRIGGER.PRESS_DOWN",
224
+ hint: "decrement",
225
+ pointerType: event.pointerType
226
+ });
227
+ if (event.pointerType === "mouse") event.preventDefault();
228
+ if (event.pointerType === "touch") event.currentTarget?.focus({ preventScroll: true });
229
+ },
230
+ onPointerUp(event) {
231
+ send({
232
+ type: "TRIGGER.PRESS_UP",
233
+ hint: "decrement",
234
+ pointerType: event.pointerType
235
+ });
236
+ },
237
+ onPointerLeave() {
238
+ if (isDecrementDisabled) return;
239
+ send({
240
+ type: "TRIGGER.PRESS_UP",
241
+ hint: "decrement"
242
+ });
243
+ }
244
+ });
245
+ },
246
+ getIncrementTriggerProps() {
247
+ return normalize.button({
248
+ ...require_number_input_anatomy.parts.incrementTrigger.attrs,
249
+ dir: prop("dir"),
250
+ id: require_number_input_dom.getIncrementTriggerId(scope),
251
+ disabled: isIncrementDisabled,
252
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(isIncrementDisabled),
253
+ "aria-label": translations.incrementLabel,
254
+ type: "button",
255
+ tabIndex: -1,
256
+ "aria-controls": require_number_input_dom.getInputId(scope),
257
+ "data-scrubbing": (0, _zag_js_dom_query.dataAttr)(scrubbing),
258
+ onPointerDown(event) {
259
+ if (isIncrementDisabled || !(0, _zag_js_dom_query.isLeftClick)(event)) return;
260
+ send({
261
+ type: "TRIGGER.PRESS_DOWN",
262
+ hint: "increment",
263
+ pointerType: event.pointerType
264
+ });
265
+ if (event.pointerType === "mouse") event.preventDefault();
266
+ if (event.pointerType === "touch") event.currentTarget?.focus({ preventScroll: true });
267
+ },
268
+ onPointerUp(event) {
269
+ send({
270
+ type: "TRIGGER.PRESS_UP",
271
+ hint: "increment",
272
+ pointerType: event.pointerType
273
+ });
274
+ },
275
+ onPointerLeave(event) {
276
+ send({
277
+ type: "TRIGGER.PRESS_UP",
278
+ hint: "increment",
279
+ pointerType: event.pointerType
280
+ });
281
+ }
282
+ });
283
+ },
284
+ getScrubberProps() {
285
+ return normalize.element({
286
+ ...require_number_input_anatomy.parts.scrubber.attrs,
287
+ dir: prop("dir"),
288
+ "data-disabled": (0, _zag_js_dom_query.dataAttr)(disabled),
289
+ id: require_number_input_dom.getScrubberId(scope),
290
+ role: "presentation",
291
+ "data-scrubbing": (0, _zag_js_dom_query.dataAttr)(scrubbing),
292
+ onMouseDown(event) {
293
+ if (disabled) return;
294
+ if (!(0, _zag_js_dom_query.isLeftClick)(event)) return;
295
+ const point = (0, _zag_js_dom_query.getEventPoint)(event);
296
+ const dpr = (0, _zag_js_dom_query.getWindow)(event.currentTarget).devicePixelRatio;
297
+ point.x = point.x - (0, _zag_js_utils.roundToDpr)(7.5, dpr);
298
+ point.y = point.y - (0, _zag_js_utils.roundToDpr)(7.5, dpr);
299
+ send({
300
+ type: "SCRUBBER.PRESS_DOWN",
301
+ point
302
+ });
303
+ event.preventDefault();
304
+ (0, _zag_js_dom_query.raf)(() => {
305
+ (0, _zag_js_dom_query.setCaretToEnd)(require_number_input_dom.getInputEl(scope));
306
+ });
307
+ },
308
+ style: { cursor: disabled ? void 0 : "ew-resize" }
309
+ });
310
+ }
311
+ };
309
312
  }
310
- // Annotate the CommonJS export names for ESM import in node:
311
- 0 && (module.exports = {
312
- connect
313
- });
313
+ exports.connect = connect;