@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.
- 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 -43
- package/dist/number-input.anatomy.mjs +4 -17
- package/dist/number-input.connect.d.mts +3 -8
- package/dist/number-input.connect.d.ts +3 -8
- package/dist/number-input.connect.js +483 -377
- package/dist/number-input.connect.mjs +478 -353
- package/dist/number-input.dom.d.mts +33 -33
- package/dist/number-input.dom.d.ts +33 -33
- package/dist/number-input.dom.js +99 -142
- package/dist/number-input.dom.mjs +78 -103
- package/dist/number-input.machine.d.mts +2 -8
- package/dist/number-input.machine.d.ts +2 -8
- package/dist/number-input.machine.js +600 -528
- package/dist/number-input.machine.mjs +596 -512
- package/dist/number-input.props.d.mts +3 -9
- package/dist/number-input.props.d.ts +3 -9
- package/dist/number-input.props.js +43 -69
- package/dist/number-input.props.mjs +39 -43
- package/dist/number-input.translations.d.mts +3 -8
- package/dist/number-input.translations.d.ts +3 -8
- package/dist/number-input.translations.js +9 -31
- package/dist/number-input.translations.mjs +5 -6
- package/dist/number-input.types.d.mts +418 -408
- package/dist/number-input.types.d.ts +418 -408
- package/dist/number-input.types.js +4 -18
- package/dist/number-input.types.mjs +1 -0
- package/dist/number-input.utils.d.mts +16 -12
- package/dist/number-input.utils.d.ts +16 -12
- package/dist/number-input.utils.js +51 -57
- package/dist/number-input.utils.mjs +39 -27
- package/package.json +8 -8
- package/dist/cursor.d.mts +0 -12
- package/dist/cursor.d.ts +0 -12
- package/dist/cursor.js +0 -111
- package/dist/cursor.mjs +0 -84
|
@@ -1,428 +1,438 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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-
|
|
9
|
-
interface ValueChangeDetails {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
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
|
-
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" | "
|
|
193
|
+
type PropsWithDefault = "dir" | "locale" | "focusInputOnChange" | "allowOutOfRange" | "pattern" | "step" | "largeStep" | "smallStep" | "spinOnPress" | "scrubberPixelSensitivity" | "scrubberDirection" | "snapOnStep";
|
|
198
194
|
type ComputedContext = Readonly<{
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
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
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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
|
-
|
|
339
|
-
|
|
340
|
-
|
|
346
|
+
export interface IncrementTriggerState {
|
|
347
|
+
/**
|
|
348
|
+
* Whether the increment trigger is disabled.
|
|
349
|
+
*/
|
|
350
|
+
disabled: boolean;
|
|
341
351
|
}
|
|
342
|
-
interface DecrementTriggerState {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
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
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
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 {};
|