@zag-js/number-input 2.0.0-next.2 → 2.0.0-next.4

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/index.d.mts +6 -9
  2. package/dist/index.d.ts +6 -9
  3. package/dist/index.js +12 -38
  4. package/dist/index.mjs +2 -7
  5. package/dist/number-input.anatomy.d.mts +2 -6
  6. package/dist/number-input.anatomy.d.ts +2 -6
  7. package/dist/number-input.anatomy.js +8 -43
  8. package/dist/number-input.anatomy.mjs +4 -17
  9. package/dist/number-input.connect.d.mts +3 -8
  10. package/dist/number-input.connect.d.ts +3 -8
  11. package/dist/number-input.connect.js +483 -377
  12. package/dist/number-input.connect.mjs +478 -353
  13. package/dist/number-input.dom.d.mts +33 -33
  14. package/dist/number-input.dom.d.ts +33 -33
  15. package/dist/number-input.dom.js +99 -142
  16. package/dist/number-input.dom.mjs +78 -103
  17. package/dist/number-input.machine.d.mts +2 -8
  18. package/dist/number-input.machine.d.ts +2 -8
  19. package/dist/number-input.machine.js +600 -528
  20. package/dist/number-input.machine.mjs +596 -512
  21. package/dist/number-input.props.d.mts +3 -9
  22. package/dist/number-input.props.d.ts +3 -9
  23. package/dist/number-input.props.js +43 -69
  24. package/dist/number-input.props.mjs +39 -43
  25. package/dist/number-input.translations.d.mts +3 -8
  26. package/dist/number-input.translations.d.ts +3 -8
  27. package/dist/number-input.translations.js +9 -31
  28. package/dist/number-input.translations.mjs +5 -6
  29. package/dist/number-input.types.d.mts +418 -408
  30. package/dist/number-input.types.d.ts +418 -408
  31. package/dist/number-input.types.js +4 -18
  32. package/dist/number-input.types.mjs +1 -0
  33. package/dist/number-input.utils.d.mts +16 -12
  34. package/dist/number-input.utils.d.ts +16 -12
  35. package/dist/number-input.utils.js +51 -57
  36. package/dist/number-input.utils.mjs +39 -27
  37. package/package.json +8 -8
  38. package/dist/cursor.d.mts +0 -12
  39. package/dist/cursor.d.ts +0 -12
  40. package/dist/cursor.js +0 -111
  41. package/dist/cursor.mjs +0 -84
@@ -1,428 +1,438 @@
1
- import { NumberParser } from '@internationalized/number';
2
- import { Machine, EventObject, Service } from '@zag-js/core';
3
- import { PropTypes, LocaleProperties, CommonProperties } from '@zag-js/types';
4
-
1
+ import { AnimationFrame } from "@zag-js/dom-query";
2
+ import { NumberParser } from "@internationalized/number";
3
+ import { EventObject, Machine, Service } from "@zag-js/core";
4
+ import { CommonProperties, LocaleProperties, PropTypes } from "@zag-js/types";
5
5
  /**
6
6
  * The reason for the number input value change
7
7
  */
8
- type ValueChangeReason = "input-change" | "input-blur" | "keyboard" | "increment-press" | "decrement-press" | "wheel" | "scrub" | "script";
9
- interface ValueChangeDetails {
10
- value: string;
11
- valueAsNumber: number;
12
- reason?: ValueChangeReason | undefined;
8
+ export type ValueChangeReason = "input-change" | "input-blur" | "keyboard" | "increment-trigger" | "decrement-trigger" | "wheel" | "scrub" | "script" | "autofill";
9
+ export interface ValueChangeDetails {
10
+ /** The number, or `null` when the input is empty */
11
+ value: number | null;
12
+ /** The value as shown in the input */
13
+ formattedValue: string;
14
+ reason?: ValueChangeReason | undefined;
13
15
  }
14
- interface FocusChangeDetails {
15
- value: string;
16
- valueAsNumber: number;
17
- focused: boolean;
16
+ export interface FocusChangeDetails {
17
+ value: number | null;
18
+ formattedValue: string;
19
+ focused: boolean;
18
20
  }
19
- type ValidityState = "rangeUnderflow" | "rangeOverflow";
21
+ export type ValidityState = "rangeUnderflow" | "rangeOverflow";
20
22
  /** Detached from `ValueChangeDetails`: here `reason` is why the value is invalid. */
21
- interface ValueInvalidDetails {
22
- value: string;
23
- valueAsNumber: number;
24
- reason: ValidityState;
23
+ export interface ValueInvalidDetails {
24
+ value: number;
25
+ formattedValue: string;
26
+ reason: ValidityState;
25
27
  }
26
- type InputMode = "text" | "tel" | "numeric" | "decimal";
27
- type ElementIds = Partial<{
28
- root: string;
29
- label: string;
30
- input: string;
31
- incrementTrigger: string;
32
- decrementTrigger: string;
33
- scrubber: string;
34
- scrubberCursor: string;
28
+ export type InputMode = "text" | "tel" | "numeric" | "decimal";
29
+ export type ElementIds = Partial<{
30
+ root: string;
31
+ label: string;
32
+ input: string;
33
+ incrementTrigger: string;
34
+ decrementTrigger: string;
35
+ scrubber: string;
36
+ scrubberCursor: string;
37
+ hiddenInput: string;
35
38
  }>;
36
- interface IntlTranslations {
37
- /**
38
- * Function that returns the human-readable value.
39
- * It is used to set the `aria-valuetext` property of the input
40
- */
41
- valueText?: ((value: string) => string) | undefined;
42
- /**
43
- * The label foe the increment button
44
- */
45
- incrementLabel?: string | undefined;
46
- /**
47
- * The label for the decrement button
48
- */
49
- decrementLabel?: string | undefined;
39
+ export interface IntlTranslations {
40
+ /**
41
+ * The label for the increment button
42
+ */
43
+ incrementLabel?: string | undefined;
44
+ /**
45
+ * The label for the decrement button
46
+ */
47
+ decrementLabel?: string | undefined;
48
+ /**
49
+ * How screen readers describe the input. Left out on iOS, where VoiceOver would skip the required state.
50
+ */
51
+ roleDescription?: string | undefined;
50
52
  }
51
- interface NumberInputProps extends LocaleProperties, CommonProperties {
52
- /**
53
- * The ids of the elements in the number input. Useful for composition.
54
- */
55
- ids?: ElementIds | undefined;
56
- /**
57
- * The name attribute of the number input. Useful for form submission.
58
- */
59
- name?: string | undefined;
60
- /**
61
- * The associate form of the input element.
62
- */
63
- form?: string | undefined;
64
- /**
65
- * Whether the number input is disabled.
66
- */
67
- disabled?: boolean | undefined;
68
- /**
69
- * Whether the number input is readonly
70
- */
71
- readOnly?: boolean | undefined;
72
- /**
73
- * Whether the number input value is invalid.
74
- */
75
- invalid?: boolean | undefined;
76
- /**
77
- * Whether the number input is required
78
- */
79
- required?: boolean | undefined;
80
- /**
81
- * The pattern used to check the <input> element's value against
82
- *
83
- * @default "-?[0-9]*(.[0-9]+)?"
84
- */
85
- pattern?: string | undefined;
86
- /**
87
- * The controlled value of the input
88
- */
89
- value?: string | undefined;
90
- /**
91
- * The initial value of the input when rendered.
92
- * Use when you don't need to control the value of the input.
93
- */
94
- defaultValue?: string | undefined;
95
- /**
96
- * The minimum value of the number input
97
- * @default Number.MIN_SAFE_INTEGER
98
- */
99
- min?: number | undefined;
100
- /**
101
- * The maximum value of the number input
102
- * @default Number.MAX_SAFE_INTEGER
103
- */
104
- max?: number | undefined;
105
- /**
106
- * The amount to increment or decrement the value by
107
- * @default 1
108
- */
109
- step?: number | undefined;
110
- /**
111
- * Whether to allow mouse wheel to change the value
112
- */
113
- allowMouseWheel?: boolean | undefined;
114
- /**
115
- * Whether to allow the value overflow the min/max range
116
- * @default true
117
- */
118
- allowOverflow?: boolean | undefined;
119
- /**
120
- * Whether to clamp the value when the input loses focus (blur)
121
- * @default true
122
- */
123
- clampValueOnBlur?: boolean | undefined;
124
- /**
125
- * Whether to focus input when the value changes
126
- * @default true
127
- */
128
- focusInputOnChange?: boolean | undefined;
129
- /**
130
- * Specifies the localized strings that identifies the accessibility elements and their states
131
- */
132
- translations?: IntlTranslations | undefined;
133
- /**
134
- * The options to pass to the `Intl.NumberFormat` constructor
135
- */
136
- formatOptions?: Intl.NumberFormatOptions | undefined;
137
- /**
138
- * Hints at the type of data that might be entered by the user. It also determines
139
- * the type of keyboard shown to the user on mobile devices
140
- * @default "decimal"
141
- */
142
- inputMode?: InputMode | undefined;
143
- /**
144
- * Function invoked when the value changes
145
- */
146
- onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
147
- /**
148
- * Function invoked when the value overflows or underflows the min/max range
149
- */
150
- onValueInvalid?: ((details: ValueInvalidDetails) => void) | undefined;
151
- /**
152
- * Function invoked when the number input is focused
153
- */
154
- onFocusChange?: ((details: FocusChangeDetails) => void) | undefined;
155
- /**
156
- * Function invoked when the value settles: the input is blurred or `Enter` is pressed, a stepper
157
- * or scrub gesture ends, or a key or wheel step completes.
158
- */
159
- onValueCommit?: ((details: ValueChangeDetails) => void) | undefined;
160
- /**
161
- * Whether to spin the value when the increment/decrement button is pressed
162
- * @default true
163
- */
164
- spinOnPress?: boolean | undefined;
165
- /**
166
- * Step value when Shift key is held (large increments).
167
- * @default step * 10
168
- */
169
- largeStep?: number | undefined;
170
- /**
171
- * Step value when Alt/Option key is held (fine control).
172
- * @default step * 0.1
173
- */
174
- smallStep?: number | undefined;
175
- /**
176
- * How many pixels the pointer must move to change the value by one step.
177
- * Higher values mean more precise control. Lower values mean more sensitivity.
178
- * @default 2
179
- */
180
- scrubberPixelSensitivity?: number | undefined;
181
- /**
182
- * Distance in pixels before the virtual cursor wraps around.
183
- * When not set, the viewport bounds are used (default behavior).
184
- */
185
- scrubberTeleportDistance?: number | undefined;
186
- /**
187
- * The direction of scrubbing.
188
- * @default "horizontal"
189
- */
190
- scrubberDirection?: "horizontal" | "vertical" | undefined;
191
- /**
192
- * Whether values snap to step multiples when scrubbing.
193
- * @default false
194
- */
195
- snapOnStep?: boolean | undefined;
53
+ export interface NumberInputProps extends LocaleProperties, CommonProperties {
54
+ /**
55
+ * The ids of the elements in the number input. Useful for composition.
56
+ */
57
+ ids?: ElementIds | undefined;
58
+ /**
59
+ * The name attribute of the number input. Useful for form submission.
60
+ */
61
+ name?: string | undefined;
62
+ /**
63
+ * The associate form of the input element.
64
+ */
65
+ form?: string | undefined;
66
+ /**
67
+ * Whether the number input is disabled.
68
+ */
69
+ disabled?: boolean | undefined;
70
+ /**
71
+ * Whether the number input is readonly
72
+ */
73
+ readOnly?: boolean | undefined;
74
+ /**
75
+ * Whether the number input value is invalid.
76
+ */
77
+ invalid?: boolean | undefined;
78
+ /**
79
+ * Whether the number input is required
80
+ */
81
+ required?: boolean | undefined;
82
+ /**
83
+ * The pattern used to check the <input> element's value against
84
+ *
85
+ * @default "-?[0-9]*(.[0-9]+)?"
86
+ */
87
+ pattern?: string | undefined;
88
+ /**
89
+ * The controlled value. Use `null` for an empty input.
90
+ */
91
+ value?: number | null | undefined;
92
+ /**
93
+ * The initial value when rendered.
94
+ * Use when you don't need to control the value.
95
+ */
96
+ defaultValue?: number | null | undefined;
97
+ /**
98
+ * The minimum value of the number input
99
+ */
100
+ min?: number | undefined;
101
+ /**
102
+ * The maximum value of the number input
103
+ */
104
+ max?: number | undefined;
105
+ /**
106
+ * The amount to increment or decrement the value by
107
+ * @default 1
108
+ */
109
+ step?: number | undefined;
110
+ /**
111
+ * Whether to allow mouse wheel to change the value
112
+ */
113
+ allowMouseWheel?: boolean | undefined;
114
+ /**
115
+ * Whether a typed value can stay outside the min/max range instead of being clamped on blur or Enter.
116
+ * The value is then reported as invalid. Stepping always stays within the range.
117
+ * @default false
118
+ */
119
+ allowOutOfRange?: boolean | undefined;
120
+ /**
121
+ * Whether to focus input when the value changes
122
+ * @default true
123
+ */
124
+ focusInputOnChange?: boolean | undefined;
125
+ /**
126
+ * Specifies the localized strings that identifies the accessibility elements and their states
127
+ */
128
+ translations?: IntlTranslations | undefined;
129
+ /**
130
+ * The options to pass to the `Intl.NumberFormat` constructor
131
+ */
132
+ formatOptions?: Intl.NumberFormatOptions | undefined;
133
+ /**
134
+ * Hints at the type of data that might be entered by the user. It also determines
135
+ * the type of keyboard shown to the user on mobile devices.
136
+ * Defaults to `"text"` on iPhone when negatives are allowed, otherwise `"decimal"`.
137
+ */
138
+ inputMode?: InputMode | undefined;
139
+ /**
140
+ * Function invoked when the value changes
141
+ */
142
+ onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
143
+ /**
144
+ * Function invoked when the value overflows or underflows the min/max range
145
+ */
146
+ onValueInvalid?: ((details: ValueInvalidDetails) => void) | undefined;
147
+ /**
148
+ * Function invoked when the number input is focused
149
+ */
150
+ onFocusChange?: ((details: FocusChangeDetails) => void) | undefined;
151
+ /**
152
+ * Function invoked when the value settles: the input is blurred or `Enter` is pressed, a stepper
153
+ * or scrub gesture ends, or a key or wheel step completes.
154
+ */
155
+ onValueCommit?: ((details: ValueChangeDetails) => void) | undefined;
156
+ /**
157
+ * Whether to spin the value when the increment/decrement button is pressed
158
+ * @default true
159
+ */
160
+ spinOnPress?: boolean | undefined;
161
+ /**
162
+ * Step value when Shift key is held (large increments).
163
+ * @default step * 10
164
+ */
165
+ largeStep?: number | undefined;
166
+ /**
167
+ * Step value when Alt/Option key is held (fine control).
168
+ * @default step * 0.1
169
+ */
170
+ smallStep?: number | undefined;
171
+ /**
172
+ * How many pixels the pointer must move to change the value by one step.
173
+ * Higher values mean more precise control. Lower values mean more sensitivity.
174
+ * @default 2
175
+ */
176
+ scrubberPixelSensitivity?: number | undefined;
177
+ /**
178
+ * Distance in pixels before the virtual cursor wraps around.
179
+ * When not set, the viewport bounds are used (default behavior).
180
+ */
181
+ scrubberTeleportDistance?: number | undefined;
182
+ /**
183
+ * The direction of scrubbing.
184
+ * @default "horizontal"
185
+ */
186
+ scrubberDirection?: "horizontal" | "vertical" | undefined;
187
+ /**
188
+ * Whether values snap to step multiples when scrubbing.
189
+ * @default false
190
+ */
191
+ snapOnStep?: boolean | undefined;
196
192
  }
197
- type PropsWithDefault = "dir" | "locale" | "focusInputOnChange" | "clampValueOnBlur" | "allowOverflow" | "inputMode" | "pattern" | "step" | "largeStep" | "smallStep" | "spinOnPress" | "min" | "max" | "scrubberPixelSensitivity" | "scrubberDirection" | "snapOnStep";
193
+ type PropsWithDefault = "dir" | "locale" | "focusInputOnChange" | "allowOutOfRange" | "pattern" | "step" | "largeStep" | "smallStep" | "spinOnPress" | "scrubberPixelSensitivity" | "scrubberDirection" | "snapOnStep";
198
194
  type ComputedContext = Readonly<{
199
- /**
200
- * The value of the input as a number
201
- */
202
- valueAsNumber: number;
203
- /**
204
- * Whether the value is at the min
205
- */
206
- isAtMin: boolean;
207
- /**
208
- * Whether the value is at the max
209
- */
210
- isAtMax: boolean;
211
- /**
212
- * Whether the value is out of the min/max range
213
- */
214
- isOutOfRange: boolean;
215
- /**
216
- * Whether the value is empty
217
- */
218
- isValueEmpty: boolean;
219
- /**
220
- * Whether the color picker is disabled
221
- */
222
- isDisabled: boolean;
223
- /**
224
- * Whether the increment button is enabled
225
- */
226
- canIncrement: boolean;
227
- /**
228
- * Whether the decrement button is enabled
229
- */
230
- canDecrement: boolean;
231
- /**
232
- * The `aria-valuetext` attribute of the input
233
- */
234
- valueText: string | undefined;
235
- /**
236
- * The formatted value of the input
237
- */
238
- formattedValue: string;
239
- /**
240
- * Whether the writing direction is RTL
241
- */
242
- isRtl: boolean;
243
- /**
244
- * The number i18n formatter
245
- */
246
- formatter: Intl.NumberFormat;
247
- /**
248
- * The number i18n parser
249
- */
250
- parser: NumberParser;
195
+ /**
196
+ * The min, or `-Infinity` when there's none
197
+ */
198
+ min: number;
199
+ /**
200
+ * The max, or `Infinity` when there's none
201
+ */
202
+ max: number;
203
+ /**
204
+ * Whether the value is at the min
205
+ */
206
+ isAtMin: boolean;
207
+ /**
208
+ * Whether the value is at the max
209
+ */
210
+ isAtMax: boolean;
211
+ /**
212
+ * Whether the value is out of the min/max range
213
+ */
214
+ isOutOfRange: boolean;
215
+ /**
216
+ * Whether the value is empty
217
+ */
218
+ isValueEmpty: boolean;
219
+ /**
220
+ * Whether the color picker is disabled
221
+ */
222
+ isDisabled: boolean;
223
+ /**
224
+ * Whether the increment button is enabled
225
+ */
226
+ canIncrement: boolean;
227
+ /**
228
+ * Whether the decrement button is enabled
229
+ */
230
+ canDecrement: boolean;
231
+ /**
232
+ * The formatted value of the input
233
+ */
234
+ formattedValue: string;
235
+ /**
236
+ * Whether the writing direction is RTL
237
+ */
238
+ isRtl: boolean;
239
+ /**
240
+ * The number i18n formatter
241
+ */
242
+ formatter: Intl.NumberFormat;
243
+ /**
244
+ * The number i18n parser
245
+ */
246
+ parser: NumberParser;
251
247
  }>;
252
- type HintValue = "increment" | "decrement";
248
+ export type StepDirection = 1 | -1;
249
+ export interface Platform {
250
+ /** Whether the device is an iPhone */
251
+ iPhone: boolean;
252
+ /** Whether the device runs iOS or iPadOS */
253
+ ios: boolean;
254
+ /** Whether the browser supports pointer lock (not Safari) */
255
+ supportsPointerLock: boolean;
256
+ }
253
257
  interface PrivateContext {
254
- /**
255
- * The hint that determines if we're incrementing or decrementing
256
- */
257
- hint: HintValue | null;
258
- /**
259
- * The scrubber cursor position
260
- */
261
- scrubberCursorPoint: {
262
- x: number;
263
- y: number;
264
- } | null;
265
- /**
266
- * Whether the checkbox's fieldset is disabled
267
- */
268
- fieldsetDisabled: boolean;
269
- /**
270
- * The value of the input
271
- */
272
- value: string;
273
- /**
274
- * The accumulated delta for pixel sensitivity tracking
275
- */
276
- cumulativeDelta: number;
277
- /**
278
- * Whether the browser supports pointer lock (false on Safari, false during SSR)
279
- */
280
- isPointerLockSupported: boolean;
281
- /**
282
- * The visual viewport scale (for pinch-zoom compensation on the cursor)
283
- */
284
- visualScale: number;
258
+ /**
259
+ * The scrubber cursor position
260
+ */
261
+ scrubberCursorPoint: {
262
+ x: number;
263
+ y: number;
264
+ } | null;
265
+ /**
266
+ * Whether the checkbox's fieldset is disabled
267
+ */
268
+ fieldsetDisabled: boolean;
269
+ /**
270
+ * The number, or `null` when empty
271
+ */
272
+ value: number | null;
273
+ /**
274
+ * The text in the input. Kept while typing, reformatted from `value` otherwise.
275
+ */
276
+ inputValue: string;
277
+ /**
278
+ * The accumulated delta for pixel sensitivity tracking
279
+ */
280
+ cumulativeDelta: number;
281
+ /**
282
+ * The detected platform, read after mount (all false during SSR)
283
+ */
284
+ platform: Platform;
285
+ /**
286
+ * The visual viewport scale (for pinch-zoom compensation on the cursor)
287
+ */
288
+ visualScale: number;
285
289
  }
286
- interface NumberInputSchema {
287
- state: "idle" | "focused" | "pressed" | "pressed.waiting" | "pressed.repeating" | "scrubbing";
288
- tag: "focus";
289
- props: NumberInputProps;
290
- defaultPropKey: PropsWithDefault;
291
- context: PrivateContext;
292
- computed: ComputedContext;
293
- action: string;
294
- event: EventObject;
295
- guard: string;
296
- effect: string;
290
+ export interface NumberInputSchema {
291
+ state: "idle" | "focused" | "pressed" | "pressed.waiting" | "pressed.repeating" | "scrubbing";
292
+ tag: "focus";
293
+ props: NumberInputProps;
294
+ defaultPropKey: PropsWithDefault;
295
+ context: PrivateContext;
296
+ refs: {
297
+ syncFrame: AnimationFrame;
298
+ focusFrame: AnimationFrame;
299
+ pressDirection: StepDirection;
300
+ committedValue: number | null;
301
+ };
302
+ computed: ComputedContext;
303
+ action: string;
304
+ event: EventObject;
305
+ guard: string;
306
+ effect: string;
297
307
  }
298
- type NumberInputService = Service<NumberInputSchema>;
299
- type NumberInputMachine = Machine<NumberInputSchema>;
300
- interface RootState {
301
- /**
302
- * Whether the number input is disabled.
303
- */
304
- disabled: boolean;
305
- /**
306
- * Whether the number input is focused.
307
- */
308
- focused: boolean;
309
- /**
310
- * Whether the number input is invalid.
311
- */
312
- invalid: boolean;
313
- /**
314
- * Whether the number input is being scrubbed.
315
- */
316
- scrubbing: boolean;
308
+ export type NumberInputService = Service<NumberInputSchema>;
309
+ export type NumberInputMachine = Machine<NumberInputSchema>;
310
+ export interface RootState {
311
+ /**
312
+ * Whether the number input is disabled.
313
+ */
314
+ disabled: boolean;
315
+ /**
316
+ * Whether the number input is focused.
317
+ */
318
+ focused: boolean;
319
+ /**
320
+ * Whether the number input is invalid.
321
+ */
322
+ invalid: boolean;
323
+ /**
324
+ * Whether the number input is being scrubbed.
325
+ */
326
+ scrubbing: boolean;
317
327
  }
318
- interface InputState {
319
- /**
320
- * Whether the input is disabled.
321
- */
322
- disabled: boolean;
323
- /**
324
- * Whether the input is invalid.
325
- */
326
- invalid: boolean;
327
- /**
328
- * Whether the input is read-only.
329
- */
330
- readOnly: boolean;
331
- /**
332
- * Whether the input is being scrubbed.
333
- */
334
- scrubbing: boolean;
328
+ export interface InputState {
329
+ /**
330
+ * Whether the input is disabled.
331
+ */
332
+ disabled: boolean;
333
+ /**
334
+ * Whether the input is invalid.
335
+ */
336
+ invalid: boolean;
337
+ /**
338
+ * Whether the input is read-only.
339
+ */
340
+ readOnly: boolean;
341
+ /**
342
+ * Whether the input is being scrubbed.
343
+ */
344
+ scrubbing: boolean;
335
345
  }
336
- interface IncrementTriggerState {
337
- /**
338
- * Whether the increment trigger is disabled.
339
- */
340
- disabled: boolean;
346
+ export interface IncrementTriggerState {
347
+ /**
348
+ * Whether the increment trigger is disabled.
349
+ */
350
+ disabled: boolean;
341
351
  }
342
- interface DecrementTriggerState {
343
- /**
344
- * Whether the decrement trigger is disabled.
345
- */
346
- disabled: boolean;
352
+ export interface DecrementTriggerState {
353
+ /**
354
+ * Whether the decrement trigger is disabled.
355
+ */
356
+ disabled: boolean;
347
357
  }
348
- interface NumberInputApi<T extends PropTypes = PropTypes> {
349
- /**
350
- * Whether the input is focused.
351
- */
352
- focused: boolean;
353
- /**
354
- * Whether the input is being scrubbed.
355
- */
356
- scrubbing: boolean;
357
- /**
358
- * Whether the input is invalid.
359
- */
360
- invalid: boolean;
361
- /**
362
- * Whether the input value is empty.
363
- */
364
- empty: boolean;
365
- /**
366
- * The formatted value of the input.
367
- */
368
- value: string;
369
- /**
370
- * The value of the input as a number.
371
- */
372
- valueAsNumber: number;
373
- /**
374
- * Function to set the value of the input.
375
- */
376
- setValue: (value: number) => void;
377
- /**
378
- * Function to clear the value of the input.
379
- */
380
- clearValue: VoidFunction;
381
- /**
382
- * Function to increment the value of the input by the step.
383
- */
384
- increment: VoidFunction;
385
- /**
386
- * Function to decrement the value of the input by the step.
387
- */
388
- decrement: VoidFunction;
389
- /**
390
- * Function to set the value of the input to the max.
391
- */
392
- setToMax: VoidFunction;
393
- /**
394
- * Function to set the value of the input to the min.
395
- */
396
- setToMin: VoidFunction;
397
- /**
398
- * Function to focus the input.
399
- */
400
- focus: VoidFunction;
401
- /**
402
- * Returns the state of the root.
403
- */
404
- getRootState: () => RootState;
405
- getRootProps: () => T["element"];
406
- getLabelProps: () => T["label"];
407
- getControlProps: () => T["element"];
408
- getValueTextProps: () => T["element"];
409
- /**
410
- * Returns the state of the input.
411
- */
412
- getInputState: () => InputState;
413
- getInputProps: () => T["input"];
414
- /**
415
- * Returns the state of the decrement trigger.
416
- */
417
- getDecrementTriggerState: () => DecrementTriggerState;
418
- getDecrementTriggerProps: () => T["button"];
419
- /**
420
- * Returns the state of the increment trigger.
421
- */
422
- getIncrementTriggerState: () => IncrementTriggerState;
423
- getIncrementTriggerProps: () => T["button"];
424
- getScrubberProps: () => T["element"];
425
- getScrubberCursorProps: () => T["element"];
358
+ export interface NumberInputApi<T extends PropTypes = PropTypes> {
359
+ /**
360
+ * Whether the input is focused.
361
+ */
362
+ focused: boolean;
363
+ /**
364
+ * Whether the input is being scrubbed.
365
+ */
366
+ scrubbing: boolean;
367
+ /**
368
+ * Whether the input is invalid.
369
+ */
370
+ invalid: boolean;
371
+ /**
372
+ * Whether the input value is empty.
373
+ */
374
+ empty: boolean;
375
+ /**
376
+ * The number, or `null` when the input is empty.
377
+ */
378
+ value: number | null;
379
+ /**
380
+ * The value as shown in the input.
381
+ */
382
+ formattedValue: string;
383
+ /**
384
+ * Function to set the value of the input.
385
+ */
386
+ setValue: (value: number) => void;
387
+ /**
388
+ * Function to clear the value of the input.
389
+ */
390
+ clearValue: VoidFunction;
391
+ /**
392
+ * Function to increment the value of the input by the step.
393
+ */
394
+ increment: VoidFunction;
395
+ /**
396
+ * Function to decrement the value of the input by the step.
397
+ */
398
+ decrement: VoidFunction;
399
+ /**
400
+ * Function to set the value of the input to the max.
401
+ */
402
+ setToMax: VoidFunction;
403
+ /**
404
+ * Function to set the value of the input to the min.
405
+ */
406
+ setToMin: VoidFunction;
407
+ /**
408
+ * Function to focus the input.
409
+ */
410
+ focus: VoidFunction;
411
+ /**
412
+ * Returns the state of the root.
413
+ */
414
+ getRootState: () => RootState;
415
+ getRootProps: () => T["element"];
416
+ getLabelProps: () => T["label"];
417
+ getControlProps: () => T["element"];
418
+ getValueTextProps: () => T["element"];
419
+ /**
420
+ * Returns the state of the input.
421
+ */
422
+ getInputState: () => InputState;
423
+ getInputProps: () => T["input"];
424
+ getHiddenInputProps: () => T["input"];
425
+ /**
426
+ * Returns the state of the decrement trigger.
427
+ */
428
+ getDecrementTriggerState: () => DecrementTriggerState;
429
+ getDecrementTriggerProps: () => T["button"];
430
+ /**
431
+ * Returns the state of the increment trigger.
432
+ */
433
+ getIncrementTriggerState: () => IncrementTriggerState;
434
+ getIncrementTriggerProps: () => T["button"];
435
+ getScrubberProps: () => T["element"];
436
+ getScrubberCursorProps: () => T["element"];
426
437
  }
427
-
428
- export type { DecrementTriggerState, ElementIds, FocusChangeDetails, HintValue, IncrementTriggerState, InputMode, InputState, IntlTranslations, NumberInputApi, NumberInputMachine, NumberInputProps, NumberInputSchema, NumberInputService, RootState, ValidityState, ValueChangeDetails, ValueChangeReason, ValueInvalidDetails };
438
+ export {};