@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.
@@ -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" | "step" | "translations";
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": "1.41.1",
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": "1.41.1",
31
- "@zag-js/core": "1.41.1",
32
- "@zag-js/dom-query": "1.41.1",
33
- "@zag-js/types": "1.41.1",
34
- "@zag-js/utils": "1.41.1"
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"