@zag-js/number-input 0.1.13 → 0.1.16

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.ts CHANGED
@@ -26,6 +26,10 @@ declare type IntlMessages = {
26
26
  */
27
27
  decrementLabel: string;
28
28
  };
29
+ declare type Value = {
30
+ value: string;
31
+ valueAsNumber: number;
32
+ };
29
33
  declare type PublicContext = DirectionProperty & CommonProperties & {
30
34
  /**
31
35
  * The ids of the elements in the number input. Useful for composition.
@@ -115,18 +119,23 @@ declare type PublicContext = DirectionProperty & CommonProperties & {
115
119
  /**
116
120
  * Function invoked when the value changes
117
121
  */
118
- onChange?: (details: {
119
- value: string;
120
- valueAsNumber: number;
121
- }) => void;
122
+ onChange?: (details: Value) => void;
122
123
  /**
123
124
  * Function invoked when the value overflows or underflows the min/max range
124
125
  */
125
- onInvalid?: (details: {
126
+ onInvalid?: (details: Value & {
126
127
  reason: ValidityState;
127
- value: string;
128
- valueAsNumber: number;
129
128
  }) => void;
129
+ /**
130
+ * Function invoked when the number input is focused
131
+ */
132
+ onFocus?: (details: Value & {
133
+ srcElement: HTMLElement | null;
134
+ }) => void;
135
+ /**
136
+ * The value of the input when it is blurred
137
+ */
138
+ onBlur?: (details: Value) => void;
130
139
  /**
131
140
  * The minimum number of fraction digits to use. Possible values are from 0 to 20
132
141
  */
@@ -135,6 +144,10 @@ declare type PublicContext = DirectionProperty & CommonProperties & {
135
144
  * The maximum number of fraction digits to use. Possible values are from 0 to 20;
136
145
  */
137
146
  maxFractionDigits?: number;
147
+ /**
148
+ * Whether to spin the value when the increment/decrement button is pressed
149
+ */
150
+ spinOnPress?: boolean;
138
151
  };
139
152
  declare type UserDefinedContext = RequiredBy<PublicContext, "id">;
140
153
  declare type ComputedContext = Readonly<{
@@ -211,6 +224,7 @@ declare function connect<T extends PropTypes>(state: State, send: Send, normaliz
211
224
  setToMax(): void;
212
225
  setToMin(): void;
213
226
  focus(): void;
227
+ blur(): void;
214
228
  rootProps: T["element"];
215
229
  labelProps: T["label"];
216
230
  groupProps: T["element"];