@zag-js/number-input 0.0.0-dev-20230222120620 → 0.0.0-dev-20230223072304
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.
|
@@ -21,32 +21,71 @@ function connect(state, send, normalize) {
|
|
|
21
21
|
const isDecrementDisabled = isDisabled || !state.context.canDecrement;
|
|
22
22
|
const translations = state.context.translations;
|
|
23
23
|
return {
|
|
24
|
+
/**
|
|
25
|
+
* Whether the input is focused.
|
|
26
|
+
*/
|
|
24
27
|
isFocused,
|
|
28
|
+
/**
|
|
29
|
+
* Whether the input is invalid.
|
|
30
|
+
*/
|
|
25
31
|
isInvalid,
|
|
32
|
+
/**
|
|
33
|
+
* Whether the input value is empty.
|
|
34
|
+
*/
|
|
26
35
|
isValueEmpty,
|
|
36
|
+
/**
|
|
37
|
+
* The formatted value of the input.
|
|
38
|
+
*/
|
|
27
39
|
value: state.context.formattedValue,
|
|
40
|
+
/**
|
|
41
|
+
* The value of the input as a number.
|
|
42
|
+
*/
|
|
28
43
|
valueAsNumber: state.context.valueAsNumber,
|
|
44
|
+
/**
|
|
45
|
+
* Function to set the value of the input.
|
|
46
|
+
*/
|
|
29
47
|
setValue(value) {
|
|
30
48
|
send({ type: "SET_VALUE", value: value.toString() });
|
|
31
49
|
},
|
|
50
|
+
/**
|
|
51
|
+
* Function to clear the value of the input.
|
|
52
|
+
*/
|
|
32
53
|
clearValue() {
|
|
33
54
|
send("CLEAR_VALUE");
|
|
34
55
|
},
|
|
56
|
+
/**
|
|
57
|
+
* Function to increment the value of the input by the step.
|
|
58
|
+
*/
|
|
35
59
|
increment() {
|
|
36
60
|
send("INCREMENT");
|
|
37
61
|
},
|
|
62
|
+
/**
|
|
63
|
+
* Function to decrement the value of the input by the step.
|
|
64
|
+
*/
|
|
38
65
|
decrement() {
|
|
39
66
|
send("DECREMENT");
|
|
40
67
|
},
|
|
68
|
+
/**
|
|
69
|
+
* Function to set the value of the input to the max.
|
|
70
|
+
*/
|
|
41
71
|
setToMax() {
|
|
42
72
|
send({ type: "SET_VALUE", value: state.context.max });
|
|
43
73
|
},
|
|
74
|
+
/**
|
|
75
|
+
* Function to set the value of the input to the min.
|
|
76
|
+
*/
|
|
44
77
|
setToMin() {
|
|
45
78
|
send({ type: "SET_VALUE", value: state.context.min });
|
|
46
79
|
},
|
|
80
|
+
/**
|
|
81
|
+
* Function to focus the input.
|
|
82
|
+
*/
|
|
47
83
|
focus() {
|
|
48
84
|
dom.getInputEl(state.context)?.focus();
|
|
49
85
|
},
|
|
86
|
+
/**
|
|
87
|
+
* Function to blur the input.
|
|
88
|
+
*/
|
|
50
89
|
blur() {
|
|
51
90
|
dom.getInputEl(state.context)?.blur();
|
|
52
91
|
},
|
package/dist/index.js
CHANGED
|
@@ -192,32 +192,71 @@ function connect(state, send, normalize) {
|
|
|
192
192
|
const isDecrementDisabled = isDisabled || !state.context.canDecrement;
|
|
193
193
|
const translations = state.context.translations;
|
|
194
194
|
return {
|
|
195
|
+
/**
|
|
196
|
+
* Whether the input is focused.
|
|
197
|
+
*/
|
|
195
198
|
isFocused,
|
|
199
|
+
/**
|
|
200
|
+
* Whether the input is invalid.
|
|
201
|
+
*/
|
|
196
202
|
isInvalid,
|
|
203
|
+
/**
|
|
204
|
+
* Whether the input value is empty.
|
|
205
|
+
*/
|
|
197
206
|
isValueEmpty,
|
|
207
|
+
/**
|
|
208
|
+
* The formatted value of the input.
|
|
209
|
+
*/
|
|
198
210
|
value: state.context.formattedValue,
|
|
211
|
+
/**
|
|
212
|
+
* The value of the input as a number.
|
|
213
|
+
*/
|
|
199
214
|
valueAsNumber: state.context.valueAsNumber,
|
|
215
|
+
/**
|
|
216
|
+
* Function to set the value of the input.
|
|
217
|
+
*/
|
|
200
218
|
setValue(value) {
|
|
201
219
|
send({ type: "SET_VALUE", value: value.toString() });
|
|
202
220
|
},
|
|
221
|
+
/**
|
|
222
|
+
* Function to clear the value of the input.
|
|
223
|
+
*/
|
|
203
224
|
clearValue() {
|
|
204
225
|
send("CLEAR_VALUE");
|
|
205
226
|
},
|
|
227
|
+
/**
|
|
228
|
+
* Function to increment the value of the input by the step.
|
|
229
|
+
*/
|
|
206
230
|
increment() {
|
|
207
231
|
send("INCREMENT");
|
|
208
232
|
},
|
|
233
|
+
/**
|
|
234
|
+
* Function to decrement the value of the input by the step.
|
|
235
|
+
*/
|
|
209
236
|
decrement() {
|
|
210
237
|
send("DECREMENT");
|
|
211
238
|
},
|
|
239
|
+
/**
|
|
240
|
+
* Function to set the value of the input to the max.
|
|
241
|
+
*/
|
|
212
242
|
setToMax() {
|
|
213
243
|
send({ type: "SET_VALUE", value: state.context.max });
|
|
214
244
|
},
|
|
245
|
+
/**
|
|
246
|
+
* Function to set the value of the input to the min.
|
|
247
|
+
*/
|
|
215
248
|
setToMin() {
|
|
216
249
|
send({ type: "SET_VALUE", value: state.context.min });
|
|
217
250
|
},
|
|
251
|
+
/**
|
|
252
|
+
* Function to focus the input.
|
|
253
|
+
*/
|
|
218
254
|
focus() {
|
|
219
255
|
dom.getInputEl(state.context)?.focus();
|
|
220
256
|
},
|
|
257
|
+
/**
|
|
258
|
+
* Function to blur the input.
|
|
259
|
+
*/
|
|
221
260
|
blur() {
|
|
222
261
|
dom.getInputEl(state.context)?.blur();
|
|
223
262
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -3,18 +3,57 @@ import { State, Send } from './number-input.types.js';
|
|
|
3
3
|
import '@zag-js/core';
|
|
4
4
|
|
|
5
5
|
declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the input is focused.
|
|
8
|
+
*/
|
|
6
9
|
isFocused: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the input is invalid.
|
|
12
|
+
*/
|
|
7
13
|
isInvalid: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the input value is empty.
|
|
16
|
+
*/
|
|
8
17
|
isValueEmpty: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The formatted value of the input.
|
|
20
|
+
*/
|
|
9
21
|
value: string;
|
|
22
|
+
/**
|
|
23
|
+
* The value of the input as a number.
|
|
24
|
+
*/
|
|
10
25
|
valueAsNumber: number;
|
|
26
|
+
/**
|
|
27
|
+
* Function to set the value of the input.
|
|
28
|
+
*/
|
|
11
29
|
setValue(value: string | number): void;
|
|
30
|
+
/**
|
|
31
|
+
* Function to clear the value of the input.
|
|
32
|
+
*/
|
|
12
33
|
clearValue(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Function to increment the value of the input by the step.
|
|
36
|
+
*/
|
|
13
37
|
increment(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Function to decrement the value of the input by the step.
|
|
40
|
+
*/
|
|
14
41
|
decrement(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Function to set the value of the input to the max.
|
|
44
|
+
*/
|
|
15
45
|
setToMax(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Function to set the value of the input to the min.
|
|
48
|
+
*/
|
|
16
49
|
setToMin(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Function to focus the input.
|
|
52
|
+
*/
|
|
17
53
|
focus(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Function to blur the input.
|
|
56
|
+
*/
|
|
18
57
|
blur(): void;
|
|
19
58
|
rootProps: T["element"];
|
|
20
59
|
labelProps: T["label"];
|
|
@@ -188,32 +188,71 @@ function connect(state, send, normalize) {
|
|
|
188
188
|
const isDecrementDisabled = isDisabled || !state.context.canDecrement;
|
|
189
189
|
const translations = state.context.translations;
|
|
190
190
|
return {
|
|
191
|
+
/**
|
|
192
|
+
* Whether the input is focused.
|
|
193
|
+
*/
|
|
191
194
|
isFocused,
|
|
195
|
+
/**
|
|
196
|
+
* Whether the input is invalid.
|
|
197
|
+
*/
|
|
192
198
|
isInvalid,
|
|
199
|
+
/**
|
|
200
|
+
* Whether the input value is empty.
|
|
201
|
+
*/
|
|
193
202
|
isValueEmpty,
|
|
203
|
+
/**
|
|
204
|
+
* The formatted value of the input.
|
|
205
|
+
*/
|
|
194
206
|
value: state.context.formattedValue,
|
|
207
|
+
/**
|
|
208
|
+
* The value of the input as a number.
|
|
209
|
+
*/
|
|
195
210
|
valueAsNumber: state.context.valueAsNumber,
|
|
211
|
+
/**
|
|
212
|
+
* Function to set the value of the input.
|
|
213
|
+
*/
|
|
196
214
|
setValue(value) {
|
|
197
215
|
send({ type: "SET_VALUE", value: value.toString() });
|
|
198
216
|
},
|
|
217
|
+
/**
|
|
218
|
+
* Function to clear the value of the input.
|
|
219
|
+
*/
|
|
199
220
|
clearValue() {
|
|
200
221
|
send("CLEAR_VALUE");
|
|
201
222
|
},
|
|
223
|
+
/**
|
|
224
|
+
* Function to increment the value of the input by the step.
|
|
225
|
+
*/
|
|
202
226
|
increment() {
|
|
203
227
|
send("INCREMENT");
|
|
204
228
|
},
|
|
229
|
+
/**
|
|
230
|
+
* Function to decrement the value of the input by the step.
|
|
231
|
+
*/
|
|
205
232
|
decrement() {
|
|
206
233
|
send("DECREMENT");
|
|
207
234
|
},
|
|
235
|
+
/**
|
|
236
|
+
* Function to set the value of the input to the max.
|
|
237
|
+
*/
|
|
208
238
|
setToMax() {
|
|
209
239
|
send({ type: "SET_VALUE", value: state.context.max });
|
|
210
240
|
},
|
|
241
|
+
/**
|
|
242
|
+
* Function to set the value of the input to the min.
|
|
243
|
+
*/
|
|
211
244
|
setToMin() {
|
|
212
245
|
send({ type: "SET_VALUE", value: state.context.min });
|
|
213
246
|
},
|
|
247
|
+
/**
|
|
248
|
+
* Function to focus the input.
|
|
249
|
+
*/
|
|
214
250
|
focus() {
|
|
215
251
|
dom.getInputEl(state.context)?.focus();
|
|
216
252
|
},
|
|
253
|
+
/**
|
|
254
|
+
* Function to blur the input.
|
|
255
|
+
*/
|
|
217
256
|
blur() {
|
|
218
257
|
dom.getInputEl(state.context)?.blur();
|
|
219
258
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/number-input",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230223072304",
|
|
4
4
|
"description": "Core logic for the number-input widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@zag-js/anatomy": "0.1.4",
|
|
30
|
-
"@zag-js/core": "0.0.0-dev-
|
|
31
|
-
"@zag-js/dom-
|
|
32
|
-
"@zag-js/
|
|
33
|
-
"@zag-js/
|
|
34
|
-
"@zag-js/mutation-observer": "0.0.0-dev-
|
|
30
|
+
"@zag-js/core": "0.0.0-dev-20230223072304",
|
|
31
|
+
"@zag-js/dom-query": "0.0.0-dev-20230223072304",
|
|
32
|
+
"@zag-js/dom-event": "0.0.0-dev-20230223072304",
|
|
33
|
+
"@zag-js/form-utils": "0.0.0-dev-20230223072304",
|
|
34
|
+
"@zag-js/mutation-observer": "0.0.0-dev-20230223072304",
|
|
35
35
|
"@zag-js/number-utils": "0.2.3",
|
|
36
36
|
"@zag-js/utils": "0.3.3",
|
|
37
37
|
"@zag-js/types": "0.3.4"
|