@zag-js/number-input 1.41.1 → 2.0.0-next.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/number-input.anatomy.d.mts +2 -2
- package/dist/number-input.anatomy.d.ts +2 -2
- package/dist/number-input.anatomy.js +2 -1
- package/dist/number-input.anatomy.mjs +2 -1
- package/dist/number-input.connect.js +40 -19
- package/dist/number-input.connect.mjs +42 -20
- package/dist/number-input.dom.d.mts +10 -8
- package/dist/number-input.dom.d.ts +10 -8
- package/dist/number-input.dom.js +60 -64
- package/dist/number-input.dom.mjs +57 -59
- package/dist/number-input.machine.js +72 -28
- package/dist/number-input.machine.mjs +75 -29
- package/dist/number-input.props.js +6 -0
- package/dist/number-input.props.mjs +6 -0
- package/dist/number-input.types.d.mts +50 -1
- package/dist/number-input.types.d.ts +50 -1
- package/package.json +6 -6
|
@@ -21,6 +21,7 @@ type ElementIds = Partial<{
|
|
|
21
21
|
incrementTrigger: string;
|
|
22
22
|
decrementTrigger: string;
|
|
23
23
|
scrubber: string;
|
|
24
|
+
scrubberCursor: string;
|
|
24
25
|
}>;
|
|
25
26
|
interface IntlTranslations {
|
|
26
27
|
/**
|
|
@@ -150,8 +151,39 @@ interface NumberInputProps extends LocaleProperties, CommonProperties {
|
|
|
150
151
|
* @default true
|
|
151
152
|
*/
|
|
152
153
|
spinOnPress?: boolean | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Step value when Shift key is held (large increments).
|
|
156
|
+
* @default step * 10
|
|
157
|
+
*/
|
|
158
|
+
largeStep?: number | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* Step value when Alt/Option key is held (fine control).
|
|
161
|
+
* @default step * 0.1
|
|
162
|
+
*/
|
|
163
|
+
smallStep?: number | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* How many pixels the pointer must move to change the value by one step.
|
|
166
|
+
* Higher values mean more precise control. Lower values mean more sensitivity.
|
|
167
|
+
* @default 2
|
|
168
|
+
*/
|
|
169
|
+
scrubberPixelSensitivity?: number | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* Distance in pixels before the virtual cursor wraps around.
|
|
172
|
+
* When not set, the viewport bounds are used (default behavior).
|
|
173
|
+
*/
|
|
174
|
+
scrubberTeleportDistance?: number | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* The direction of scrubbing.
|
|
177
|
+
* @default "horizontal"
|
|
178
|
+
*/
|
|
179
|
+
scrubberDirection?: "horizontal" | "vertical" | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Whether values snap to step multiples when scrubbing.
|
|
182
|
+
* @default false
|
|
183
|
+
*/
|
|
184
|
+
snapOnStep?: boolean | undefined;
|
|
153
185
|
}
|
|
154
|
-
type PropsWithDefault = "dir" | "locale" | "focusInputOnChange" | "clampValueOnBlur" | "allowOverflow" | "inputMode" | "pattern" | "translations" | "step" | "spinOnPress" | "min" | "max" | "
|
|
186
|
+
type PropsWithDefault = "dir" | "locale" | "focusInputOnChange" | "clampValueOnBlur" | "allowOverflow" | "inputMode" | "pattern" | "translations" | "step" | "spinOnPress" | "min" | "max" | "largeStep" | "smallStep" | "scrubberPixelSensitivity" | "scrubberDirection" | "snapOnStep";
|
|
155
187
|
type ComputedContext = Readonly<{
|
|
156
188
|
/**
|
|
157
189
|
* The value of the input as a number
|
|
@@ -227,6 +259,18 @@ interface PrivateContext {
|
|
|
227
259
|
* The value of the input
|
|
228
260
|
*/
|
|
229
261
|
value: string;
|
|
262
|
+
/**
|
|
263
|
+
* The accumulated delta for pixel sensitivity tracking
|
|
264
|
+
*/
|
|
265
|
+
cumulativeDelta: number;
|
|
266
|
+
/**
|
|
267
|
+
* Whether the browser supports pointer lock (false on Safari, false during SSR)
|
|
268
|
+
*/
|
|
269
|
+
isPointerLockSupported: boolean;
|
|
270
|
+
/**
|
|
271
|
+
* The visual viewport scale (for pinch-zoom compensation on the cursor)
|
|
272
|
+
*/
|
|
273
|
+
visualScale: number;
|
|
230
274
|
}
|
|
231
275
|
interface NumberInputSchema {
|
|
232
276
|
state: "idle" | "focused" | "spinning" | "before:spin" | "scrubbing";
|
|
@@ -246,6 +290,10 @@ interface NumberInputApi<T extends PropTypes = PropTypes> {
|
|
|
246
290
|
* Whether the input is focused.
|
|
247
291
|
*/
|
|
248
292
|
focused: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Whether the input is being scrubbed.
|
|
295
|
+
*/
|
|
296
|
+
scrubbing: boolean;
|
|
249
297
|
/**
|
|
250
298
|
* Whether the input is invalid.
|
|
251
299
|
*/
|
|
@@ -298,6 +346,7 @@ interface NumberInputApi<T extends PropTypes = PropTypes> {
|
|
|
298
346
|
getDecrementTriggerProps: () => T["button"];
|
|
299
347
|
getIncrementTriggerProps: () => T["button"];
|
|
300
348
|
getScrubberProps: () => T["element"];
|
|
349
|
+
getScrubberCursorProps: () => T["element"];
|
|
301
350
|
}
|
|
302
351
|
|
|
303
352
|
export type { ElementIds, FocusChangeDetails, HintValue, InputMode, IntlTranslations, NumberInputApi, NumberInputMachine, NumberInputProps, NumberInputSchema, NumberInputService, ValidityState, ValueChangeDetails, ValueInvalidDetails };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/number-input",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-next.0",
|
|
4
4
|
"description": "Core logic for the number-input widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@internationalized/number": "3.6.6",
|
|
30
|
-
"@zag-js/anatomy": "
|
|
31
|
-
"@zag-js/core": "
|
|
32
|
-
"@zag-js/dom-query": "
|
|
33
|
-
"@zag-js/types": "
|
|
34
|
-
"@zag-js/utils": "
|
|
30
|
+
"@zag-js/anatomy": "2.0.0-next.0",
|
|
31
|
+
"@zag-js/core": "2.0.0-next.0",
|
|
32
|
+
"@zag-js/dom-query": "2.0.0-next.0",
|
|
33
|
+
"@zag-js/types": "2.0.0-next.0",
|
|
34
|
+
"@zag-js/utils": "2.0.0-next.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"clean-package": "2.2.0"
|