@zag-js/number-input 1.46.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.
- package/dist/cursor.d.mts +8 -10
- package/dist/cursor.d.ts +8 -10
- package/dist/cursor.js +65 -104
- package/dist/cursor.mjs +59 -77
- package/dist/index.d.mts +6 -9
- package/dist/index.d.ts +6 -9
- package/dist/index.js +12 -38
- package/dist/index.mjs +2 -7
- package/dist/number-input.anatomy.d.mts +2 -6
- package/dist/number-input.anatomy.d.ts +2 -6
- package/dist/number-input.anatomy.js +8 -42
- package/dist/number-input.anatomy.mjs +4 -16
- package/dist/number-input.connect.d.mts +3 -8
- package/dist/number-input.connect.d.ts +3 -8
- package/dist/number-input.connect.js +310 -310
- package/dist/number-input.connect.mjs +304 -284
- package/dist/number-input.dom.d.mts +28 -32
- package/dist/number-input.dom.d.ts +28 -32
- package/dist/number-input.dom.js +96 -138
- package/dist/number-input.dom.mjs +76 -97
- package/dist/number-input.machine.d.mts +2 -8
- package/dist/number-input.machine.d.ts +2 -8
- package/dist/number-input.machine.js +484 -460
- package/dist/number-input.machine.mjs +478 -440
- package/dist/number-input.props.d.mts +3 -9
- package/dist/number-input.props.d.ts +3 -9
- package/dist/number-input.props.js +40 -65
- package/dist/number-input.props.mjs +36 -39
- package/dist/number-input.translations.d.mts +3 -8
- package/dist/number-input.translations.d.ts +3 -8
- package/dist/number-input.translations.js +8 -31
- package/dist/number-input.translations.mjs +4 -6
- package/dist/number-input.types.d.mts +298 -300
- package/dist/number-input.types.d.ts +298 -300
- package/dist/number-input.types.js +4 -18
- package/dist/number-input.types.mjs +1 -0
- package/dist/number-input.utils.d.mts +9 -12
- package/dist/number-input.utils.d.ts +9 -12
- package/dist/number-input.utils.js +28 -57
- package/dist/number-input.utils.mjs +20 -28
- package/package.json +8 -8
|
@@ -1,313 +1,313 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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
|
-
|
|
311
|
-
0 && (module.exports = {
|
|
312
|
-
connect
|
|
313
|
-
});
|
|
313
|
+
exports.connect = connect;
|