@zag-js/number-input 0.21.0 → 0.22.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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _zag_js_anatomy from '@zag-js/anatomy';
2
- import { RequiredBy, PropTypes, DirectionProperty, CommonProperties, Context, NormalizeProps } from '@zag-js/types';
2
+ import { RequiredBy, PropTypes, LocaleProperties, CommonProperties, Context, NormalizeProps } from '@zag-js/types';
3
3
  import * as _zag_js_core from '@zag-js/core';
4
4
  import { StateMachine } from '@zag-js/core';
5
5
 
@@ -11,7 +11,6 @@ interface ValueChangeDetails {
11
11
  }
12
12
  interface FocusChangeDetails extends ValueChangeDetails {
13
13
  focused: boolean;
14
- srcElement?: HTMLElement | null;
15
14
  }
16
15
  type ValidityState = "rangeUnderflow" | "rangeOverflow";
17
16
  interface ValueInvalidDetails extends ValueChangeDetails {
@@ -41,7 +40,7 @@ type IntlTranslations = {
41
40
  */
42
41
  decrementLabel: string;
43
42
  };
44
- interface PublicContext extends DirectionProperty, CommonProperties {
43
+ interface PublicContext extends LocaleProperties, CommonProperties {
45
44
  /**
46
45
  * The ids of the elements in the number input. Useful for composition.
47
46
  */
@@ -98,11 +97,6 @@ interface PublicContext extends DirectionProperty, CommonProperties {
98
97
  * @default true
99
98
  */
100
99
  allowOverflow: boolean;
101
- /**
102
- * Whether the pressed key should be allowed in the input.
103
- * The default behavior is to allow DOM floating point characters defined by /^[Ee0-9+\-.]$/
104
- */
105
- validateCharacter?: (char: string) => boolean;
106
100
  /**
107
101
  * Whether to clamp the value when the input loses focus (blur)
108
102
  * @default true
@@ -118,13 +112,9 @@ interface PublicContext extends DirectionProperty, CommonProperties {
118
112
  */
119
113
  translations: IntlTranslations;
120
114
  /**
121
- * If using a custom display format, this converts the custom format to a format `parseFloat` understands.
122
- */
123
- parse?: (value: string) => string;
124
- /**
125
- * If using a custom display format, this converts the default format to the custom format.
115
+ * The options to pass to the `Intl.NumberFormat` constructor
126
116
  */
127
- format?: (value: string) => string | number;
117
+ formatOptions?: Intl.NumberFormatOptions;
128
118
  /**
129
119
  * Hints at the type of data that might be entered by the user. It also determines
130
120
  * the type of keyboard shown to the user on mobile devices
@@ -143,14 +133,6 @@ interface PublicContext extends DirectionProperty, CommonProperties {
143
133
  * Function invoked when the number input is focused
144
134
  */
145
135
  onFocusChange?: (details: FocusChangeDetails) => void;
146
- /**
147
- * The minimum number of fraction digits to use. Possible values are from 0 to 20
148
- */
149
- minFractionDigits?: number;
150
- /**
151
- * The maximum number of fraction digits to use. Possible values are from 0 to 20;
152
- */
153
- maxFractionDigits?: number;
154
136
  /**
155
137
  * Whether to spin the value when the increment/decrement button is pressed
156
138
  */
@@ -183,6 +165,11 @@ type ComputedContext = Readonly<{
183
165
  * Whether the value is empty
184
166
  */
185
167
  isValueEmpty: boolean;
168
+ /**
169
+ * @computed
170
+ * Whether the color picker is disabled
171
+ */
172
+ isDisabled: boolean;
186
173
  /**
187
174
  * @computed
188
175
  * Whether the increment button is enabled
@@ -267,10 +254,6 @@ interface MachineApi<T extends PropTypes = PropTypes> {
267
254
  * Function to focus the input.
268
255
  */
269
256
  focus(): void;
270
- /**
271
- * Function to blur the input.
272
- */
273
- blur(): void;
274
257
  rootProps: T["element"];
275
258
  labelProps: T["label"];
276
259
  controlProps: T["element"];
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _zag_js_anatomy from '@zag-js/anatomy';
2
- import { RequiredBy, PropTypes, DirectionProperty, CommonProperties, Context, NormalizeProps } from '@zag-js/types';
2
+ import { RequiredBy, PropTypes, LocaleProperties, CommonProperties, Context, NormalizeProps } from '@zag-js/types';
3
3
  import * as _zag_js_core from '@zag-js/core';
4
4
  import { StateMachine } from '@zag-js/core';
5
5
 
@@ -11,7 +11,6 @@ interface ValueChangeDetails {
11
11
  }
12
12
  interface FocusChangeDetails extends ValueChangeDetails {
13
13
  focused: boolean;
14
- srcElement?: HTMLElement | null;
15
14
  }
16
15
  type ValidityState = "rangeUnderflow" | "rangeOverflow";
17
16
  interface ValueInvalidDetails extends ValueChangeDetails {
@@ -41,7 +40,7 @@ type IntlTranslations = {
41
40
  */
42
41
  decrementLabel: string;
43
42
  };
44
- interface PublicContext extends DirectionProperty, CommonProperties {
43
+ interface PublicContext extends LocaleProperties, CommonProperties {
45
44
  /**
46
45
  * The ids of the elements in the number input. Useful for composition.
47
46
  */
@@ -98,11 +97,6 @@ interface PublicContext extends DirectionProperty, CommonProperties {
98
97
  * @default true
99
98
  */
100
99
  allowOverflow: boolean;
101
- /**
102
- * Whether the pressed key should be allowed in the input.
103
- * The default behavior is to allow DOM floating point characters defined by /^[Ee0-9+\-.]$/
104
- */
105
- validateCharacter?: (char: string) => boolean;
106
100
  /**
107
101
  * Whether to clamp the value when the input loses focus (blur)
108
102
  * @default true
@@ -118,13 +112,9 @@ interface PublicContext extends DirectionProperty, CommonProperties {
118
112
  */
119
113
  translations: IntlTranslations;
120
114
  /**
121
- * If using a custom display format, this converts the custom format to a format `parseFloat` understands.
122
- */
123
- parse?: (value: string) => string;
124
- /**
125
- * If using a custom display format, this converts the default format to the custom format.
115
+ * The options to pass to the `Intl.NumberFormat` constructor
126
116
  */
127
- format?: (value: string) => string | number;
117
+ formatOptions?: Intl.NumberFormatOptions;
128
118
  /**
129
119
  * Hints at the type of data that might be entered by the user. It also determines
130
120
  * the type of keyboard shown to the user on mobile devices
@@ -143,14 +133,6 @@ interface PublicContext extends DirectionProperty, CommonProperties {
143
133
  * Function invoked when the number input is focused
144
134
  */
145
135
  onFocusChange?: (details: FocusChangeDetails) => void;
146
- /**
147
- * The minimum number of fraction digits to use. Possible values are from 0 to 20
148
- */
149
- minFractionDigits?: number;
150
- /**
151
- * The maximum number of fraction digits to use. Possible values are from 0 to 20;
152
- */
153
- maxFractionDigits?: number;
154
136
  /**
155
137
  * Whether to spin the value when the increment/decrement button is pressed
156
138
  */
@@ -183,6 +165,11 @@ type ComputedContext = Readonly<{
183
165
  * Whether the value is empty
184
166
  */
185
167
  isValueEmpty: boolean;
168
+ /**
169
+ * @computed
170
+ * Whether the color picker is disabled
171
+ */
172
+ isDisabled: boolean;
186
173
  /**
187
174
  * @computed
188
175
  * Whether the increment button is enabled
@@ -267,10 +254,6 @@ interface MachineApi<T extends PropTypes = PropTypes> {
267
254
  * Function to focus the input.
268
255
  */
269
256
  focus(): void;
270
- /**
271
- * Function to blur the input.
272
- */
273
- blur(): void;
274
257
  rootProps: T["element"];
275
258
  labelProps: T["label"];
276
259
  controlProps: T["element"];