@zag-js/pin-input 0.1.10 → 0.1.13
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/LICENSE +21 -0
- package/dist/index.d.ts +136 -3
- package/dist/index.js +260 -286
- package/dist/index.mjs +255 -289
- package/package.json +13 -11
- package/dist/pin-input.connect.d.ts +0 -16
- package/dist/pin-input.dom.d.ts +0 -27
- package/dist/pin-input.machine.d.ts +0 -2
- package/dist/pin-input.types.d.ts +0 -122
package/dist/pin-input.dom.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { MachineContext as Ctx } from "./pin-input.types";
|
|
2
|
-
export declare const dom: {
|
|
3
|
-
getRootNode: (ctx: {
|
|
4
|
-
getRootNode?: () => Node | Document | ShadowRoot;
|
|
5
|
-
}) => Document | ShadowRoot;
|
|
6
|
-
getDoc: (ctx: {
|
|
7
|
-
getRootNode?: () => Node | Document | ShadowRoot;
|
|
8
|
-
}) => Document;
|
|
9
|
-
getWin: (ctx: {
|
|
10
|
-
getRootNode?: () => Node | Document | ShadowRoot;
|
|
11
|
-
}) => Window & typeof globalThis;
|
|
12
|
-
getActiveElement: (ctx: {
|
|
13
|
-
getRootNode?: () => Node | Document | ShadowRoot;
|
|
14
|
-
}) => HTMLElement;
|
|
15
|
-
getById: <T_1 = HTMLElement>(ctx: {
|
|
16
|
-
getRootNode?: () => Node | Document | ShadowRoot;
|
|
17
|
-
}, id: string) => T_1;
|
|
18
|
-
} & {
|
|
19
|
-
getRootId: (ctx: Ctx) => string;
|
|
20
|
-
getInputId: (ctx: Ctx, id: string) => string;
|
|
21
|
-
getHiddenInputId: (ctx: Ctx) => string;
|
|
22
|
-
getRootEl: (ctx: Ctx) => HTMLElement;
|
|
23
|
-
getElements: (ctx: Ctx) => HTMLInputElement[];
|
|
24
|
-
getFocusedEl: (ctx: Ctx) => HTMLInputElement;
|
|
25
|
-
getFirstInputEl: (ctx: Ctx) => HTMLInputElement;
|
|
26
|
-
getHiddenInputEl: (ctx: Ctx) => HTMLInputElement;
|
|
27
|
-
};
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import type { StateMachine as S } from "@zag-js/core";
|
|
2
|
-
import type { CommonProperties, Context, DirectionProperty, RequiredBy } from "@zag-js/types";
|
|
3
|
-
declare type IntlMessages = {
|
|
4
|
-
inputLabel: (index: number, length: number) => string;
|
|
5
|
-
};
|
|
6
|
-
declare type ElementIds = Partial<{
|
|
7
|
-
root: string;
|
|
8
|
-
hiddenInput: string;
|
|
9
|
-
input(id: string): string;
|
|
10
|
-
}>;
|
|
11
|
-
declare type PublicContext = DirectionProperty & CommonProperties & {
|
|
12
|
-
/**
|
|
13
|
-
* The name of the input element. Useful for form submission.
|
|
14
|
-
*/
|
|
15
|
-
name?: string;
|
|
16
|
-
/**
|
|
17
|
-
* The regular expression that the user-entered input value is checked against.
|
|
18
|
-
*/
|
|
19
|
-
pattern?: string;
|
|
20
|
-
/**
|
|
21
|
-
* The ids of the elements in the pin input. Useful for composition.
|
|
22
|
-
*/
|
|
23
|
-
ids?: ElementIds;
|
|
24
|
-
/**
|
|
25
|
-
* Whether the inputs are disabled
|
|
26
|
-
*/
|
|
27
|
-
disabled?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* The placeholder text for the input
|
|
30
|
-
*/
|
|
31
|
-
placeholder?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Whether to auto-focus the first input.
|
|
34
|
-
*/
|
|
35
|
-
autoFocus?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Whether the pin input is in the invalid state
|
|
38
|
-
*/
|
|
39
|
-
invalid?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* If `true`, the pin input component signals to its fields that they should
|
|
42
|
-
* use `autocomplete="one-time-code"`.
|
|
43
|
-
*/
|
|
44
|
-
otp?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* The value of the the pin input.
|
|
47
|
-
*/
|
|
48
|
-
value: string[];
|
|
49
|
-
/**
|
|
50
|
-
* The type of value the pin-input should allow
|
|
51
|
-
*/
|
|
52
|
-
type?: "alphanumeric" | "numeric" | "alphabetic";
|
|
53
|
-
/**
|
|
54
|
-
* Function called when all inputs have valid values
|
|
55
|
-
*/
|
|
56
|
-
onComplete?: (details: {
|
|
57
|
-
value: string[];
|
|
58
|
-
valueAsString: string;
|
|
59
|
-
}) => void;
|
|
60
|
-
/**
|
|
61
|
-
* Function called on input change
|
|
62
|
-
*/
|
|
63
|
-
onChange?: (details: {
|
|
64
|
-
value: string[];
|
|
65
|
-
}) => void;
|
|
66
|
-
/**
|
|
67
|
-
* Function called when an invalid value is entered
|
|
68
|
-
*/
|
|
69
|
-
onInvalid?: (details: {
|
|
70
|
-
value: string;
|
|
71
|
-
index: number;
|
|
72
|
-
}) => void;
|
|
73
|
-
/**
|
|
74
|
-
* If `true`, the input's value will be masked just like `type=password`
|
|
75
|
-
*/
|
|
76
|
-
mask?: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Whether to blur the input when the value is complete
|
|
79
|
-
*/
|
|
80
|
-
blurOnComplete?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Specifies the localized strings that identifies the accessibility elements and their states
|
|
83
|
-
*/
|
|
84
|
-
messages: IntlMessages;
|
|
85
|
-
};
|
|
86
|
-
export declare type UserDefinedContext = RequiredBy<PublicContext, "id">;
|
|
87
|
-
declare type ComputedContext = Readonly<{
|
|
88
|
-
/**
|
|
89
|
-
* @computed
|
|
90
|
-
* The number of inputs
|
|
91
|
-
*/
|
|
92
|
-
valueLength: number;
|
|
93
|
-
/**
|
|
94
|
-
* @computed
|
|
95
|
-
* The number of inputs that are not empty
|
|
96
|
-
*/
|
|
97
|
-
filledValueLength: number;
|
|
98
|
-
/**
|
|
99
|
-
* @computed
|
|
100
|
-
* Whether all input values are valid
|
|
101
|
-
*/
|
|
102
|
-
isValueComplete: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* @computed
|
|
105
|
-
* The string representation of the input values
|
|
106
|
-
*/
|
|
107
|
-
valueAsString: string;
|
|
108
|
-
}>;
|
|
109
|
-
declare type PrivateContext = Context<{
|
|
110
|
-
/**
|
|
111
|
-
* @internal
|
|
112
|
-
* The index of the input field that has focus
|
|
113
|
-
*/
|
|
114
|
-
focusedIndex: number;
|
|
115
|
-
}>;
|
|
116
|
-
export declare type MachineContext = PublicContext & PrivateContext & ComputedContext;
|
|
117
|
-
export declare type MachineState = {
|
|
118
|
-
value: "unknown" | "idle" | "focused";
|
|
119
|
-
};
|
|
120
|
-
export declare type State = S.State<MachineContext, MachineState>;
|
|
121
|
-
export declare type Send = S.Send<S.AnyEventObject>;
|
|
122
|
-
export {};
|