@zag-js/number-input 1.34.1 → 1.35.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.
Files changed (37) hide show
  1. package/dist/cursor.d.mts +12 -0
  2. package/dist/cursor.d.ts +12 -0
  3. package/dist/cursor.js +111 -0
  4. package/dist/cursor.mjs +84 -0
  5. package/dist/index.d.mts +9 -314
  6. package/dist/index.d.ts +9 -314
  7. package/dist/index.js +37 -931
  8. package/dist/index.mjs +9 -926
  9. package/dist/number-input.anatomy.d.mts +6 -0
  10. package/dist/number-input.anatomy.d.ts +6 -0
  11. package/dist/number-input.anatomy.js +43 -0
  12. package/dist/number-input.anatomy.mjs +17 -0
  13. package/dist/number-input.connect.d.mts +8 -0
  14. package/dist/number-input.connect.d.ts +8 -0
  15. package/dist/number-input.connect.js +308 -0
  16. package/dist/number-input.connect.mjs +284 -0
  17. package/dist/number-input.dom.d.mts +34 -0
  18. package/dist/number-input.dom.d.ts +34 -0
  19. package/dist/number-input.dom.js +150 -0
  20. package/dist/number-input.dom.mjs +109 -0
  21. package/dist/number-input.machine.d.mts +8 -0
  22. package/dist/number-input.machine.d.ts +8 -0
  23. package/dist/number-input.machine.js +460 -0
  24. package/dist/number-input.machine.mjs +441 -0
  25. package/dist/number-input.props.d.mts +9 -0
  26. package/dist/number-input.props.d.ts +9 -0
  27. package/dist/number-input.props.js +65 -0
  28. package/dist/number-input.props.mjs +39 -0
  29. package/dist/number-input.types.d.mts +303 -0
  30. package/dist/number-input.types.d.ts +303 -0
  31. package/dist/number-input.types.js +18 -0
  32. package/dist/number-input.types.mjs +0 -0
  33. package/dist/number-input.utils.d.mts +13 -0
  34. package/dist/number-input.utils.d.ts +13 -0
  35. package/dist/number-input.utils.js +63 -0
  36. package/dist/number-input.utils.mjs +34 -0
  37. package/package.json +17 -7
@@ -0,0 +1,303 @@
1
+ import { NumberFormatter, NumberParser } from '@internationalized/number';
2
+ import { Machine, EventObject, Service } from '@zag-js/core';
3
+ import { PropTypes, RequiredBy, LocaleProperties, CommonProperties } from '@zag-js/types';
4
+
5
+ interface ValueChangeDetails {
6
+ value: string;
7
+ valueAsNumber: number;
8
+ }
9
+ interface FocusChangeDetails extends ValueChangeDetails {
10
+ focused: boolean;
11
+ }
12
+ type ValidityState = "rangeUnderflow" | "rangeOverflow";
13
+ interface ValueInvalidDetails extends ValueChangeDetails {
14
+ reason: ValidityState;
15
+ }
16
+ type InputMode = "text" | "tel" | "numeric" | "decimal";
17
+ type ElementIds = Partial<{
18
+ root: string;
19
+ label: string;
20
+ input: string;
21
+ incrementTrigger: string;
22
+ decrementTrigger: string;
23
+ scrubber: string;
24
+ }>;
25
+ interface IntlTranslations {
26
+ /**
27
+ * Function that returns the human-readable value.
28
+ * It is used to set the `aria-valuetext` property of the input
29
+ */
30
+ valueText?: ((value: string) => string) | undefined;
31
+ /**
32
+ * The label foe the increment button
33
+ */
34
+ incrementLabel?: string | undefined;
35
+ /**
36
+ * The label for the decrement button
37
+ */
38
+ decrementLabel?: string | undefined;
39
+ }
40
+ interface NumberInputProps extends LocaleProperties, CommonProperties {
41
+ /**
42
+ * The ids of the elements in the number input. Useful for composition.
43
+ */
44
+ ids?: ElementIds | undefined;
45
+ /**
46
+ * The name attribute of the number input. Useful for form submission.
47
+ */
48
+ name?: string | undefined;
49
+ /**
50
+ * The associate form of the input element.
51
+ */
52
+ form?: string | undefined;
53
+ /**
54
+ * Whether the number input is disabled.
55
+ */
56
+ disabled?: boolean | undefined;
57
+ /**
58
+ * Whether the number input is readonly
59
+ */
60
+ readOnly?: boolean | undefined;
61
+ /**
62
+ * Whether the number input value is invalid.
63
+ */
64
+ invalid?: boolean | undefined;
65
+ /**
66
+ * Whether the number input is required
67
+ */
68
+ required?: boolean | undefined;
69
+ /**
70
+ * The pattern used to check the <input> element's value against
71
+ *
72
+ * @default "-?[0-9]*(.[0-9]+)?"
73
+ */
74
+ pattern?: string | undefined;
75
+ /**
76
+ * The controlled value of the input
77
+ */
78
+ value?: string | undefined;
79
+ /**
80
+ * The initial value of the input when rendered.
81
+ * Use when you don't need to control the value of the input.
82
+ */
83
+ defaultValue?: string | undefined;
84
+ /**
85
+ * The minimum value of the number input
86
+ * @default Number.MIN_SAFE_INTEGER
87
+ */
88
+ min?: number | undefined;
89
+ /**
90
+ * The maximum value of the number input
91
+ * @default Number.MAX_SAFE_INTEGER
92
+ */
93
+ max?: number | undefined;
94
+ /**
95
+ * The amount to increment or decrement the value by
96
+ * @default 1
97
+ */
98
+ step?: number | undefined;
99
+ /**
100
+ * Whether to allow mouse wheel to change the value
101
+ */
102
+ allowMouseWheel?: boolean | undefined;
103
+ /**
104
+ * Whether to allow the value overflow the min/max range
105
+ * @default true
106
+ */
107
+ allowOverflow?: boolean | undefined;
108
+ /**
109
+ * Whether to clamp the value when the input loses focus (blur)
110
+ * @default true
111
+ */
112
+ clampValueOnBlur?: boolean | undefined;
113
+ /**
114
+ * Whether to focus input when the value changes
115
+ * @default true
116
+ */
117
+ focusInputOnChange?: boolean | undefined;
118
+ /**
119
+ * Specifies the localized strings that identifies the accessibility elements and their states
120
+ */
121
+ translations?: IntlTranslations | undefined;
122
+ /**
123
+ * The options to pass to the `Intl.NumberFormat` constructor
124
+ */
125
+ formatOptions?: Intl.NumberFormatOptions | undefined;
126
+ /**
127
+ * Hints at the type of data that might be entered by the user. It also determines
128
+ * the type of keyboard shown to the user on mobile devices
129
+ * @default "decimal"
130
+ */
131
+ inputMode?: InputMode | undefined;
132
+ /**
133
+ * Function invoked when the value changes
134
+ */
135
+ onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
136
+ /**
137
+ * Function invoked when the value overflows or underflows the min/max range
138
+ */
139
+ onValueInvalid?: ((details: ValueInvalidDetails) => void) | undefined;
140
+ /**
141
+ * Function invoked when the number input is focused
142
+ */
143
+ onFocusChange?: ((details: FocusChangeDetails) => void) | undefined;
144
+ /**
145
+ * Function invoked when the value is committed (when the input is blurred or the Enter key is pressed)
146
+ */
147
+ onValueCommit?: ((details: ValueChangeDetails) => void) | undefined;
148
+ /**
149
+ * Whether to spin the value when the increment/decrement button is pressed
150
+ * @default true
151
+ */
152
+ spinOnPress?: boolean | undefined;
153
+ }
154
+ type PropsWithDefault = "dir" | "locale" | "focusInputOnChange" | "clampValueOnBlur" | "allowOverflow" | "inputMode" | "pattern" | "translations" | "step" | "spinOnPress" | "min" | "max" | "step" | "translations";
155
+ type ComputedContext = Readonly<{
156
+ /**
157
+ * The value of the input as a number
158
+ */
159
+ valueAsNumber: number;
160
+ /**
161
+ * Whether the value is at the min
162
+ */
163
+ isAtMin: boolean;
164
+ /**
165
+ * Whether the value is at the max
166
+ */
167
+ isAtMax: boolean;
168
+ /**
169
+ * Whether the value is out of the min/max range
170
+ */
171
+ isOutOfRange: boolean;
172
+ /**
173
+ * Whether the value is empty
174
+ */
175
+ isValueEmpty: boolean;
176
+ /**
177
+ * Whether the color picker is disabled
178
+ */
179
+ isDisabled: boolean;
180
+ /**
181
+ * Whether the increment button is enabled
182
+ */
183
+ canIncrement: boolean;
184
+ /**
185
+ * Whether the decrement button is enabled
186
+ */
187
+ canDecrement: boolean;
188
+ /**
189
+ * The `aria-valuetext` attribute of the input
190
+ */
191
+ valueText: string | undefined;
192
+ /**
193
+ * The formatted value of the input
194
+ */
195
+ formattedValue: string;
196
+ /**
197
+ * Whether the writing direction is RTL
198
+ */
199
+ isRtl: boolean;
200
+ /**
201
+ * The number i18n formatter
202
+ */
203
+ formatter: NumberFormatter;
204
+ /**
205
+ * The number i18n parser
206
+ */
207
+ parser: NumberParser;
208
+ }>;
209
+ type HintValue = "increment" | "decrement";
210
+ interface PrivateContext {
211
+ /**
212
+ * The hint that determines if we're incrementing or decrementing
213
+ */
214
+ hint: HintValue | null;
215
+ /**
216
+ * The scrubber cursor position
217
+ */
218
+ scrubberCursorPoint: {
219
+ x: number;
220
+ y: number;
221
+ } | null;
222
+ /**
223
+ * Whether the checkbox's fieldset is disabled
224
+ */
225
+ fieldsetDisabled: boolean;
226
+ /**
227
+ * The value of the input
228
+ */
229
+ value: string;
230
+ }
231
+ interface NumberInputSchema {
232
+ state: "idle" | "focused" | "spinning" | "before:spin" | "scrubbing";
233
+ tag: "focus";
234
+ props: RequiredBy<NumberInputProps, PropsWithDefault>;
235
+ context: PrivateContext;
236
+ computed: ComputedContext;
237
+ action: string;
238
+ event: EventObject;
239
+ guard: string;
240
+ effect: string;
241
+ }
242
+ type NumberInputService = Service<NumberInputSchema>;
243
+ type NumberInputMachine = Machine<NumberInputSchema>;
244
+ interface NumberInputApi<T extends PropTypes = PropTypes> {
245
+ /**
246
+ * Whether the input is focused.
247
+ */
248
+ focused: boolean;
249
+ /**
250
+ * Whether the input is invalid.
251
+ */
252
+ invalid: boolean;
253
+ /**
254
+ * Whether the input value is empty.
255
+ */
256
+ empty: boolean;
257
+ /**
258
+ * The formatted value of the input.
259
+ */
260
+ value: string;
261
+ /**
262
+ * The value of the input as a number.
263
+ */
264
+ valueAsNumber: number;
265
+ /**
266
+ * Function to set the value of the input.
267
+ */
268
+ setValue: (value: number) => void;
269
+ /**
270
+ * Function to clear the value of the input.
271
+ */
272
+ clearValue: VoidFunction;
273
+ /**
274
+ * Function to increment the value of the input by the step.
275
+ */
276
+ increment: VoidFunction;
277
+ /**
278
+ * Function to decrement the value of the input by the step.
279
+ */
280
+ decrement: VoidFunction;
281
+ /**
282
+ * Function to set the value of the input to the max.
283
+ */
284
+ setToMax: VoidFunction;
285
+ /**
286
+ * Function to set the value of the input to the min.
287
+ */
288
+ setToMin: VoidFunction;
289
+ /**
290
+ * Function to focus the input.
291
+ */
292
+ focus: VoidFunction;
293
+ getRootProps: () => T["element"];
294
+ getLabelProps: () => T["label"];
295
+ getControlProps: () => T["element"];
296
+ getValueTextProps: () => T["element"];
297
+ getInputProps: () => T["input"];
298
+ getDecrementTriggerProps: () => T["button"];
299
+ getIncrementTriggerProps: () => T["button"];
300
+ getScrubberProps: () => T["element"];
301
+ }
302
+
303
+ export type { ElementIds, FocusChangeDetails, HintValue, InputMode, IntlTranslations, NumberInputApi, NumberInputMachine, NumberInputProps, NumberInputSchema, NumberInputService, ValidityState, ValueChangeDetails, ValueInvalidDetails };
@@ -0,0 +1,303 @@
1
+ import { NumberFormatter, NumberParser } from '@internationalized/number';
2
+ import { Machine, EventObject, Service } from '@zag-js/core';
3
+ import { PropTypes, RequiredBy, LocaleProperties, CommonProperties } from '@zag-js/types';
4
+
5
+ interface ValueChangeDetails {
6
+ value: string;
7
+ valueAsNumber: number;
8
+ }
9
+ interface FocusChangeDetails extends ValueChangeDetails {
10
+ focused: boolean;
11
+ }
12
+ type ValidityState = "rangeUnderflow" | "rangeOverflow";
13
+ interface ValueInvalidDetails extends ValueChangeDetails {
14
+ reason: ValidityState;
15
+ }
16
+ type InputMode = "text" | "tel" | "numeric" | "decimal";
17
+ type ElementIds = Partial<{
18
+ root: string;
19
+ label: string;
20
+ input: string;
21
+ incrementTrigger: string;
22
+ decrementTrigger: string;
23
+ scrubber: string;
24
+ }>;
25
+ interface IntlTranslations {
26
+ /**
27
+ * Function that returns the human-readable value.
28
+ * It is used to set the `aria-valuetext` property of the input
29
+ */
30
+ valueText?: ((value: string) => string) | undefined;
31
+ /**
32
+ * The label foe the increment button
33
+ */
34
+ incrementLabel?: string | undefined;
35
+ /**
36
+ * The label for the decrement button
37
+ */
38
+ decrementLabel?: string | undefined;
39
+ }
40
+ interface NumberInputProps extends LocaleProperties, CommonProperties {
41
+ /**
42
+ * The ids of the elements in the number input. Useful for composition.
43
+ */
44
+ ids?: ElementIds | undefined;
45
+ /**
46
+ * The name attribute of the number input. Useful for form submission.
47
+ */
48
+ name?: string | undefined;
49
+ /**
50
+ * The associate form of the input element.
51
+ */
52
+ form?: string | undefined;
53
+ /**
54
+ * Whether the number input is disabled.
55
+ */
56
+ disabled?: boolean | undefined;
57
+ /**
58
+ * Whether the number input is readonly
59
+ */
60
+ readOnly?: boolean | undefined;
61
+ /**
62
+ * Whether the number input value is invalid.
63
+ */
64
+ invalid?: boolean | undefined;
65
+ /**
66
+ * Whether the number input is required
67
+ */
68
+ required?: boolean | undefined;
69
+ /**
70
+ * The pattern used to check the <input> element's value against
71
+ *
72
+ * @default "-?[0-9]*(.[0-9]+)?"
73
+ */
74
+ pattern?: string | undefined;
75
+ /**
76
+ * The controlled value of the input
77
+ */
78
+ value?: string | undefined;
79
+ /**
80
+ * The initial value of the input when rendered.
81
+ * Use when you don't need to control the value of the input.
82
+ */
83
+ defaultValue?: string | undefined;
84
+ /**
85
+ * The minimum value of the number input
86
+ * @default Number.MIN_SAFE_INTEGER
87
+ */
88
+ min?: number | undefined;
89
+ /**
90
+ * The maximum value of the number input
91
+ * @default Number.MAX_SAFE_INTEGER
92
+ */
93
+ max?: number | undefined;
94
+ /**
95
+ * The amount to increment or decrement the value by
96
+ * @default 1
97
+ */
98
+ step?: number | undefined;
99
+ /**
100
+ * Whether to allow mouse wheel to change the value
101
+ */
102
+ allowMouseWheel?: boolean | undefined;
103
+ /**
104
+ * Whether to allow the value overflow the min/max range
105
+ * @default true
106
+ */
107
+ allowOverflow?: boolean | undefined;
108
+ /**
109
+ * Whether to clamp the value when the input loses focus (blur)
110
+ * @default true
111
+ */
112
+ clampValueOnBlur?: boolean | undefined;
113
+ /**
114
+ * Whether to focus input when the value changes
115
+ * @default true
116
+ */
117
+ focusInputOnChange?: boolean | undefined;
118
+ /**
119
+ * Specifies the localized strings that identifies the accessibility elements and their states
120
+ */
121
+ translations?: IntlTranslations | undefined;
122
+ /**
123
+ * The options to pass to the `Intl.NumberFormat` constructor
124
+ */
125
+ formatOptions?: Intl.NumberFormatOptions | undefined;
126
+ /**
127
+ * Hints at the type of data that might be entered by the user. It also determines
128
+ * the type of keyboard shown to the user on mobile devices
129
+ * @default "decimal"
130
+ */
131
+ inputMode?: InputMode | undefined;
132
+ /**
133
+ * Function invoked when the value changes
134
+ */
135
+ onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
136
+ /**
137
+ * Function invoked when the value overflows or underflows the min/max range
138
+ */
139
+ onValueInvalid?: ((details: ValueInvalidDetails) => void) | undefined;
140
+ /**
141
+ * Function invoked when the number input is focused
142
+ */
143
+ onFocusChange?: ((details: FocusChangeDetails) => void) | undefined;
144
+ /**
145
+ * Function invoked when the value is committed (when the input is blurred or the Enter key is pressed)
146
+ */
147
+ onValueCommit?: ((details: ValueChangeDetails) => void) | undefined;
148
+ /**
149
+ * Whether to spin the value when the increment/decrement button is pressed
150
+ * @default true
151
+ */
152
+ spinOnPress?: boolean | undefined;
153
+ }
154
+ type PropsWithDefault = "dir" | "locale" | "focusInputOnChange" | "clampValueOnBlur" | "allowOverflow" | "inputMode" | "pattern" | "translations" | "step" | "spinOnPress" | "min" | "max" | "step" | "translations";
155
+ type ComputedContext = Readonly<{
156
+ /**
157
+ * The value of the input as a number
158
+ */
159
+ valueAsNumber: number;
160
+ /**
161
+ * Whether the value is at the min
162
+ */
163
+ isAtMin: boolean;
164
+ /**
165
+ * Whether the value is at the max
166
+ */
167
+ isAtMax: boolean;
168
+ /**
169
+ * Whether the value is out of the min/max range
170
+ */
171
+ isOutOfRange: boolean;
172
+ /**
173
+ * Whether the value is empty
174
+ */
175
+ isValueEmpty: boolean;
176
+ /**
177
+ * Whether the color picker is disabled
178
+ */
179
+ isDisabled: boolean;
180
+ /**
181
+ * Whether the increment button is enabled
182
+ */
183
+ canIncrement: boolean;
184
+ /**
185
+ * Whether the decrement button is enabled
186
+ */
187
+ canDecrement: boolean;
188
+ /**
189
+ * The `aria-valuetext` attribute of the input
190
+ */
191
+ valueText: string | undefined;
192
+ /**
193
+ * The formatted value of the input
194
+ */
195
+ formattedValue: string;
196
+ /**
197
+ * Whether the writing direction is RTL
198
+ */
199
+ isRtl: boolean;
200
+ /**
201
+ * The number i18n formatter
202
+ */
203
+ formatter: NumberFormatter;
204
+ /**
205
+ * The number i18n parser
206
+ */
207
+ parser: NumberParser;
208
+ }>;
209
+ type HintValue = "increment" | "decrement";
210
+ interface PrivateContext {
211
+ /**
212
+ * The hint that determines if we're incrementing or decrementing
213
+ */
214
+ hint: HintValue | null;
215
+ /**
216
+ * The scrubber cursor position
217
+ */
218
+ scrubberCursorPoint: {
219
+ x: number;
220
+ y: number;
221
+ } | null;
222
+ /**
223
+ * Whether the checkbox's fieldset is disabled
224
+ */
225
+ fieldsetDisabled: boolean;
226
+ /**
227
+ * The value of the input
228
+ */
229
+ value: string;
230
+ }
231
+ interface NumberInputSchema {
232
+ state: "idle" | "focused" | "spinning" | "before:spin" | "scrubbing";
233
+ tag: "focus";
234
+ props: RequiredBy<NumberInputProps, PropsWithDefault>;
235
+ context: PrivateContext;
236
+ computed: ComputedContext;
237
+ action: string;
238
+ event: EventObject;
239
+ guard: string;
240
+ effect: string;
241
+ }
242
+ type NumberInputService = Service<NumberInputSchema>;
243
+ type NumberInputMachine = Machine<NumberInputSchema>;
244
+ interface NumberInputApi<T extends PropTypes = PropTypes> {
245
+ /**
246
+ * Whether the input is focused.
247
+ */
248
+ focused: boolean;
249
+ /**
250
+ * Whether the input is invalid.
251
+ */
252
+ invalid: boolean;
253
+ /**
254
+ * Whether the input value is empty.
255
+ */
256
+ empty: boolean;
257
+ /**
258
+ * The formatted value of the input.
259
+ */
260
+ value: string;
261
+ /**
262
+ * The value of the input as a number.
263
+ */
264
+ valueAsNumber: number;
265
+ /**
266
+ * Function to set the value of the input.
267
+ */
268
+ setValue: (value: number) => void;
269
+ /**
270
+ * Function to clear the value of the input.
271
+ */
272
+ clearValue: VoidFunction;
273
+ /**
274
+ * Function to increment the value of the input by the step.
275
+ */
276
+ increment: VoidFunction;
277
+ /**
278
+ * Function to decrement the value of the input by the step.
279
+ */
280
+ decrement: VoidFunction;
281
+ /**
282
+ * Function to set the value of the input to the max.
283
+ */
284
+ setToMax: VoidFunction;
285
+ /**
286
+ * Function to set the value of the input to the min.
287
+ */
288
+ setToMin: VoidFunction;
289
+ /**
290
+ * Function to focus the input.
291
+ */
292
+ focus: VoidFunction;
293
+ getRootProps: () => T["element"];
294
+ getLabelProps: () => T["label"];
295
+ getControlProps: () => T["element"];
296
+ getValueTextProps: () => T["element"];
297
+ getInputProps: () => T["input"];
298
+ getDecrementTriggerProps: () => T["button"];
299
+ getIncrementTriggerProps: () => T["button"];
300
+ getScrubberProps: () => T["element"];
301
+ }
302
+
303
+ export type { ElementIds, FocusChangeDetails, HintValue, InputMode, IntlTranslations, NumberInputApi, NumberInputMachine, NumberInputProps, NumberInputSchema, NumberInputService, ValidityState, ValueChangeDetails, ValueInvalidDetails };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/number-input.types.ts
17
+ var number_input_types_exports = {};
18
+ module.exports = __toCommonJS(number_input_types_exports);
File without changes
@@ -0,0 +1,13 @@
1
+ import { NumberParser } from '@internationalized/number';
2
+ import { Params } from '@zag-js/core';
3
+ import { NumberInputSchema } from './number-input.types.mjs';
4
+ import '@zag-js/types';
5
+
6
+ declare const createFormatter: (locale: string, options?: Intl.NumberFormatOptions) => Intl.NumberFormat;
7
+ declare const createParser: (locale: string, options?: Intl.NumberFormatOptions) => NumberParser;
8
+ type Ctx = Pick<Params<NumberInputSchema>, "prop" | "computed">;
9
+ declare const parseValue: (value: string, params: Ctx) => number;
10
+ declare const formatValue: (value: number, params: Ctx) => string;
11
+ declare const getDefaultStep: (step: number | undefined, formatOptions: Intl.NumberFormatOptions | undefined) => number;
12
+
13
+ export { createFormatter, createParser, formatValue, getDefaultStep, parseValue };
@@ -0,0 +1,13 @@
1
+ import { NumberParser } from '@internationalized/number';
2
+ import { Params } from '@zag-js/core';
3
+ import { NumberInputSchema } from './number-input.types.js';
4
+ import '@zag-js/types';
5
+
6
+ declare const createFormatter: (locale: string, options?: Intl.NumberFormatOptions) => Intl.NumberFormat;
7
+ declare const createParser: (locale: string, options?: Intl.NumberFormatOptions) => NumberParser;
8
+ type Ctx = Pick<Params<NumberInputSchema>, "prop" | "computed">;
9
+ declare const parseValue: (value: string, params: Ctx) => number;
10
+ declare const formatValue: (value: number, params: Ctx) => string;
11
+ declare const getDefaultStep: (step: number | undefined, formatOptions: Intl.NumberFormatOptions | undefined) => number;
12
+
13
+ export { createFormatter, createParser, formatValue, getDefaultStep, parseValue };