@zag-js/number-input 0.0.0-dev-20220415160434 → 0.0.0-dev-20220417135151
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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +393 -373
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +399 -376
- package/dist/index.mjs.map +2 -2
- package/dist/number-input.dom.d.ts +1 -1
- package/dist/number-input.dom.d.ts.map +1 -1
- package/dist/number-input.machine.d.ts +2 -2
- package/dist/number-input.machine.d.ts.map +1 -1
- package/dist/number-input.types.d.ts +50 -33
- package/dist/number-input.types.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -2,13 +2,13 @@ import { MachineContext as Ctx } from "./number-input.types";
|
|
|
2
2
|
export declare const dom: {
|
|
3
3
|
getDoc: (ctx: Ctx) => Document;
|
|
4
4
|
getWin: (ctx: Ctx) => Window & typeof globalThis;
|
|
5
|
+
getRootId: (ctx: Ctx) => string;
|
|
5
6
|
getInputId: (ctx: Ctx) => string;
|
|
6
7
|
getIncButtonId: (ctx: Ctx) => string;
|
|
7
8
|
getDecButtonId: (ctx: Ctx) => string;
|
|
8
9
|
getScrubberId: (ctx: Ctx) => string;
|
|
9
10
|
getCursorId: (ctx: Ctx) => string;
|
|
10
11
|
getLabelId: (ctx: Ctx) => string;
|
|
11
|
-
getRootId: (ctx: Ctx) => string;
|
|
12
12
|
getInputEl: (ctx: Ctx) => HTMLInputElement;
|
|
13
13
|
getIncButtonEl: (ctx: Ctx) => HTMLButtonElement;
|
|
14
14
|
getDecButtonEl: (ctx: Ctx) => HTMLButtonElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-input.dom.d.ts","sourceRoot":"","sources":["../src/number-input.dom.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,IAAI,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAK5D,eAAO,MAAM,GAAG;kBACA,GAAG;kBACH,GAAG;
|
|
1
|
+
{"version":3,"file":"number-input.dom.d.ts","sourceRoot":"","sources":["../src/number-input.dom.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,IAAI,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAK5D,eAAO,MAAM,GAAG;kBACA,GAAG;kBACH,GAAG;qBAEA,GAAG;sBACF,GAAG;0BACC,GAAG;0BACH,GAAG;yBACJ,GAAG;uBACL,GAAG;sBACJ,GAAG;sBAEH,GAAG;0BACC,GAAG;0BACH,GAAG;yBACJ,GAAG;uBACL,GAAG;2BAEC,GAAG,SAAS,UAAU;;;;;;;6BAsBpB,GAAG;CA8B7B,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { MachineContext, MachineState } from "./number-input.types";
|
|
2
|
-
export declare
|
|
1
|
+
import type { MachineContext, MachineState, UserDefinedContext } from "./number-input.types";
|
|
2
|
+
export declare function machine(ctx?: UserDefinedContext): import("@zag-js/core").Machine<MachineContext, MachineState, import("@zag-js/core").StateMachine.AnyEventObject>;
|
|
3
3
|
//# sourceMappingURL=number-input.machine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-input.machine.d.ts","sourceRoot":"","sources":["../src/number-input.machine.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"number-input.machine.d.ts","sourceRoot":"","sources":["../src/number-input.machine.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAK5F,wBAAgB,OAAO,CAAC,GAAG,GAAE,kBAAuB,oHAyXnD"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { StateMachine as S } from "@zag-js/core";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { StateMachine as S } from "@zag-js/core";
|
|
2
|
+
import type { Point } from "@zag-js/rect-utils";
|
|
3
|
+
import type { Context, DirectionProperty } from "@zag-js/types";
|
|
4
4
|
declare type ValidityState = "rangeUnderflow" | "rangeOverflow";
|
|
5
5
|
declare type InputSelection = Record<"start" | "end", number | null>;
|
|
6
|
-
declare type
|
|
6
|
+
declare type ElementIds = Partial<{
|
|
7
7
|
root: string;
|
|
8
8
|
label: string;
|
|
9
9
|
input: string;
|
|
@@ -26,11 +26,11 @@ declare type IntlMessages = {
|
|
|
26
26
|
*/
|
|
27
27
|
decrementLabel: string;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
declare type PublicContext = DirectionProperty & {
|
|
30
30
|
/**
|
|
31
31
|
* The ids of the elements in the number input. Useful for composition.
|
|
32
32
|
*/
|
|
33
|
-
ids?:
|
|
33
|
+
ids?: ElementIds;
|
|
34
34
|
/**
|
|
35
35
|
* The name attribute of the number input. Useful for form submission.
|
|
36
36
|
*/
|
|
@@ -62,10 +62,6 @@ export declare type MachineContext = Context<{
|
|
|
62
62
|
* The value of the input
|
|
63
63
|
*/
|
|
64
64
|
value: string;
|
|
65
|
-
/**
|
|
66
|
-
* @computed the value of the input as a number
|
|
67
|
-
*/
|
|
68
|
-
readonly valueAsNumber: number;
|
|
69
65
|
/**
|
|
70
66
|
* The minimum value of the number input
|
|
71
67
|
*/
|
|
@@ -114,10 +110,6 @@ export declare type MachineContext = Context<{
|
|
|
114
110
|
* If using a custom display format, this converts the default format to the custom format.
|
|
115
111
|
*/
|
|
116
112
|
format?: (value: string) => string | number;
|
|
117
|
-
/**
|
|
118
|
-
* @internal The hint that determines if we're incrementing or decrementing
|
|
119
|
-
*/
|
|
120
|
-
hint: "increment" | "decrement" | "set" | null;
|
|
121
113
|
/**
|
|
122
114
|
* Hints at the type of data that might be entered by the user. It also determines
|
|
123
115
|
* the type of keyboard shown to the user on mobile devices
|
|
@@ -143,48 +135,73 @@ export declare type MachineContext = Context<{
|
|
|
143
135
|
value: string;
|
|
144
136
|
valueAsNumber: number;
|
|
145
137
|
}) => void;
|
|
138
|
+
};
|
|
139
|
+
export declare type UserDefinedContext = Partial<PublicContext>;
|
|
140
|
+
declare type ComputedContext = Readonly<{
|
|
146
141
|
/**
|
|
147
|
-
* @
|
|
142
|
+
* @computed
|
|
143
|
+
* The value of the input as a number
|
|
148
144
|
*/
|
|
149
|
-
|
|
145
|
+
valueAsNumber: number;
|
|
150
146
|
/**
|
|
151
|
-
* @computed
|
|
147
|
+
* @computed
|
|
148
|
+
* Whether the value is at the min
|
|
152
149
|
*/
|
|
153
|
-
|
|
150
|
+
isAtMin: boolean;
|
|
154
151
|
/**
|
|
155
|
-
* @computed
|
|
152
|
+
* @computed
|
|
153
|
+
* Whether the value is at the max
|
|
156
154
|
*/
|
|
157
|
-
|
|
155
|
+
isAtMax: boolean;
|
|
158
156
|
/**
|
|
159
|
-
* @computed
|
|
157
|
+
* @computed
|
|
158
|
+
* Whether the value is out of the min/max range
|
|
160
159
|
*/
|
|
161
|
-
|
|
160
|
+
isOutOfRange: boolean;
|
|
162
161
|
/**
|
|
163
|
-
* @computed
|
|
162
|
+
* @computed
|
|
163
|
+
* Whether the increment button is enabled
|
|
164
164
|
*/
|
|
165
|
-
|
|
165
|
+
canIncrement: boolean;
|
|
166
166
|
/**
|
|
167
|
-
* @computed
|
|
167
|
+
* @computed
|
|
168
|
+
* Whether the decrement button is enabled
|
|
168
169
|
*/
|
|
169
|
-
|
|
170
|
+
canDecrement: boolean;
|
|
170
171
|
/**
|
|
171
|
-
* @computed
|
|
172
|
+
* @computed
|
|
173
|
+
* The `aria-valuetext` attribute of the input
|
|
172
174
|
*/
|
|
173
|
-
|
|
175
|
+
valueText: string | undefined;
|
|
174
176
|
/**
|
|
175
|
-
* @computed
|
|
177
|
+
* @computed
|
|
178
|
+
* The formatted value of the input
|
|
176
179
|
*/
|
|
177
|
-
|
|
180
|
+
formattedValue: string;
|
|
178
181
|
/**
|
|
179
|
-
* @computed
|
|
182
|
+
* @computed
|
|
183
|
+
* Whether the writing direction is RTL
|
|
180
184
|
*/
|
|
181
|
-
|
|
185
|
+
isRtl: boolean;
|
|
186
|
+
}>;
|
|
187
|
+
declare type PrivateContext = Context<{
|
|
188
|
+
/**
|
|
189
|
+
* @internal
|
|
190
|
+
* The hint that determines if we're incrementing or decrementing
|
|
191
|
+
*/
|
|
192
|
+
hint: "increment" | "decrement" | "set" | null;
|
|
193
|
+
/**
|
|
194
|
+
* @internal
|
|
195
|
+
* The selection range of the input
|
|
196
|
+
*/
|
|
197
|
+
inputSelection: InputSelection | null;
|
|
182
198
|
}>;
|
|
199
|
+
export declare type MachineContext = PublicContext & PrivateContext & ComputedContext;
|
|
183
200
|
export declare type MachineState = {
|
|
184
201
|
value: "unknown" | "idle" | "focused" | "spinning" | "before:spin" | "scrubbing";
|
|
185
202
|
tags: "focus";
|
|
186
203
|
};
|
|
187
204
|
export declare type State = S.State<MachineContext, MachineState>;
|
|
188
|
-
export declare type Send =
|
|
205
|
+
export declare type Send = S.Send<S.AnyEventObject>;
|
|
189
206
|
export {};
|
|
190
207
|
//# sourceMappingURL=number-input.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-input.types.d.ts","sourceRoot":"","sources":["../src/number-input.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,CAAC,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"number-input.types.d.ts","sourceRoot":"","sources":["../src/number-input.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,CAAC,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAI/D,aAAK,aAAa,GAAG,gBAAgB,GAAG,eAAe,CAAA;AAEvD,aAAK,cAAc,GAAG,M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,CAAA;CACf,CAAC,CAAA;AAIF,aAAK,cAAc,GAAG,OAAO,CAAC;IAC5B;;;OAGG;IACH,IAAI,EAAE,WAAW,GAAG,WAAW,GAAG,KAAK,GAAG,IAAI,CAAA;IAC9C;;;OAGG;IACH,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;CACtC,CAAC,CAAA;AAIF,oBAAY,cAAc,GAAG,aAAa,GAAG,cAAc,GAAG,eAAe,CAAA;AAI7E,oBAAY,YAAY,GAAG;IACzB,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,GAAG,WAAW,CAAA;IAChF,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAED,oBAAY,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;AAIzD,oBAAY,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAA"}
|
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-20220417135151",
|
|
4
4
|
"description": "Core logic for the number-input widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/core": "^0.0.0-dev-
|
|
33
|
-
"@zag-js/dom-utils": "^0.0.0-dev-
|
|
34
|
-
"@zag-js/number-utils": "^0.0.0-dev-
|
|
35
|
-
"@zag-js/rect-utils": "^0.0.0-dev-
|
|
36
|
-
"@zag-js/types": "^0.0.0-dev-
|
|
37
|
-
"@zag-js/utils": "^0.0.0-dev-
|
|
32
|
+
"@zag-js/core": "^0.0.0-dev-20220417135151",
|
|
33
|
+
"@zag-js/dom-utils": "^0.0.0-dev-20220417135151",
|
|
34
|
+
"@zag-js/number-utils": "^0.0.0-dev-20220417135151",
|
|
35
|
+
"@zag-js/rect-utils": "^0.0.0-dev-20220417135151",
|
|
36
|
+
"@zag-js/types": "^0.0.0-dev-20220417135151",
|
|
37
|
+
"@zag-js/utils": "^0.0.0-dev-20220417135151"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build:fast": "zag build",
|