@zag-js/pin-input 1.34.1 → 1.35.1
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 +8 -199
- package/dist/index.d.ts +8 -199
- package/dist/index.js +35 -545
- package/dist/index.mjs +9 -542
- package/dist/pin-input.anatomy.d.mts +6 -0
- package/dist/pin-input.anatomy.d.ts +6 -0
- package/dist/pin-input.anatomy.js +34 -0
- package/dist/pin-input.anatomy.mjs +8 -0
- package/dist/pin-input.connect.d.mts +7 -0
- package/dist/pin-input.connect.d.ts +7 -0
- package/dist/pin-input.connect.js +235 -0
- package/dist/pin-input.connect.mjs +210 -0
- package/dist/pin-input.dom.d.mts +16 -0
- package/dist/pin-input.dom.d.ts +16 -0
- package/dist/pin-input.dom.js +71 -0
- package/dist/pin-input.dom.mjs +35 -0
- package/dist/pin-input.machine.d.mts +7 -0
- package/dist/pin-input.machine.d.ts +7 -0
- package/dist/pin-input.machine.js +320 -0
- package/dist/pin-input.machine.mjs +285 -0
- package/dist/pin-input.props.d.mts +8 -0
- package/dist/pin-input.props.d.ts +8 -0
- package/dist/pin-input.props.js +61 -0
- package/dist/pin-input.props.mjs +35 -0
- package/dist/pin-input.types.d.mts +188 -0
- package/dist/pin-input.types.d.ts +188 -0
- package/dist/pin-input.types.js +18 -0
- package/dist/pin-input.types.mjs +0 -0
- package/dist/pin-input.utils.d.mts +10 -0
- package/dist/pin-input.utils.d.ts +10 -0
- package/dist/pin-input.utils.js +45 -0
- package/dist/pin-input.utils.mjs +19 -0
- package/package.json +17 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,199 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
value: string[];
|
|
10
|
-
valueAsString: string;
|
|
11
|
-
}
|
|
12
|
-
interface ValueInvalidDetails {
|
|
13
|
-
value: string;
|
|
14
|
-
index: number;
|
|
15
|
-
}
|
|
16
|
-
type IntlTranslations = {
|
|
17
|
-
inputLabel: (index: number, length: number) => string;
|
|
18
|
-
};
|
|
19
|
-
type ElementIds = Partial<{
|
|
20
|
-
root: string;
|
|
21
|
-
hiddenInput: string;
|
|
22
|
-
label: string;
|
|
23
|
-
control: string;
|
|
24
|
-
input: (id: string) => string;
|
|
25
|
-
}>;
|
|
26
|
-
interface PinInputProps extends DirectionProperty, CommonProperties {
|
|
27
|
-
/**
|
|
28
|
-
* The name of the input element. Useful for form submission.
|
|
29
|
-
*/
|
|
30
|
-
name?: string | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* The associate form of the underlying input element.
|
|
33
|
-
*/
|
|
34
|
-
form?: string | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* The regular expression that the user-entered input value is checked against.
|
|
37
|
-
*/
|
|
38
|
-
pattern?: string | undefined;
|
|
39
|
-
/**
|
|
40
|
-
* The ids of the elements in the pin input. Useful for composition.
|
|
41
|
-
*/
|
|
42
|
-
ids?: ElementIds | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Whether the inputs are disabled
|
|
45
|
-
*/
|
|
46
|
-
disabled?: boolean | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* The placeholder text for the input
|
|
49
|
-
* @default "○"
|
|
50
|
-
*/
|
|
51
|
-
placeholder?: string | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Whether to auto-focus the first input.
|
|
54
|
-
*/
|
|
55
|
-
autoFocus?: boolean | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Whether the pin input is in the invalid state
|
|
58
|
-
*/
|
|
59
|
-
invalid?: boolean | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* Whether the pin input is required
|
|
62
|
-
*/
|
|
63
|
-
required?: boolean | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* Whether the pin input is in the valid state
|
|
66
|
-
*/
|
|
67
|
-
readOnly?: boolean | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* If `true`, the pin input component signals to its fields that they should
|
|
70
|
-
* use `autocomplete="one-time-code"`.
|
|
71
|
-
*/
|
|
72
|
-
otp?: boolean | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* The controlled value of the the pin input.
|
|
75
|
-
*/
|
|
76
|
-
value?: string[] | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* The initial value of the the pin input when rendered.
|
|
79
|
-
* Use when you don't need to control the value of the pin input.
|
|
80
|
-
*/
|
|
81
|
-
defaultValue?: string[] | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* The type of value the pin-input should allow
|
|
84
|
-
* @default "numeric"
|
|
85
|
-
*/
|
|
86
|
-
type?: "alphanumeric" | "numeric" | "alphabetic" | undefined;
|
|
87
|
-
/**
|
|
88
|
-
* Function called when all inputs have valid values
|
|
89
|
-
*/
|
|
90
|
-
onValueComplete?: ((details: ValueChangeDetails) => void) | undefined;
|
|
91
|
-
/**
|
|
92
|
-
* Function called on input change
|
|
93
|
-
*/
|
|
94
|
-
onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
|
|
95
|
-
/**
|
|
96
|
-
* Function called when an invalid value is entered
|
|
97
|
-
*/
|
|
98
|
-
onValueInvalid?: ((details: ValueInvalidDetails) => void) | undefined;
|
|
99
|
-
/**
|
|
100
|
-
* If `true`, the input's value will be masked just like `type=password`
|
|
101
|
-
*/
|
|
102
|
-
mask?: boolean | undefined;
|
|
103
|
-
/**
|
|
104
|
-
* Whether to blur the input when the value is complete
|
|
105
|
-
*/
|
|
106
|
-
blurOnComplete?: boolean | undefined;
|
|
107
|
-
/**
|
|
108
|
-
* Whether to select input value when input is focused
|
|
109
|
-
*/
|
|
110
|
-
selectOnFocus?: boolean | undefined;
|
|
111
|
-
/**
|
|
112
|
-
* Specifies the localized strings that identifies the accessibility elements and their states
|
|
113
|
-
*/
|
|
114
|
-
translations?: IntlTranslations | undefined;
|
|
115
|
-
/**
|
|
116
|
-
* The number of inputs to render to improve SSR aria attributes.
|
|
117
|
-
* This will be required in next major version.
|
|
118
|
-
*/
|
|
119
|
-
count?: number | undefined;
|
|
120
|
-
}
|
|
121
|
-
type PropsWithDefault = "placeholder" | "otp" | "type" | "defaultValue";
|
|
122
|
-
interface PinInputSchema {
|
|
123
|
-
state: "idle" | "focused";
|
|
124
|
-
props: RequiredBy<PinInputProps, PropsWithDefault>;
|
|
125
|
-
context: {
|
|
126
|
-
value: string[];
|
|
127
|
-
focusedIndex: number;
|
|
128
|
-
count: number;
|
|
129
|
-
};
|
|
130
|
-
computed: {
|
|
131
|
-
_value: string[];
|
|
132
|
-
valueLength: number;
|
|
133
|
-
filledValueLength: number;
|
|
134
|
-
isValueComplete: boolean;
|
|
135
|
-
valueAsString: string;
|
|
136
|
-
focusedValue: string;
|
|
137
|
-
};
|
|
138
|
-
event: EventObject;
|
|
139
|
-
action: string;
|
|
140
|
-
effect: string;
|
|
141
|
-
guard: string;
|
|
142
|
-
}
|
|
143
|
-
type PinInputService = Service<PinInputSchema>;
|
|
144
|
-
type PinInputMachine = Machine<PinInputSchema>;
|
|
145
|
-
interface InputProps {
|
|
146
|
-
index: number;
|
|
147
|
-
}
|
|
148
|
-
interface PinInputApi<T extends PropTypes = PropTypes> {
|
|
149
|
-
/**
|
|
150
|
-
* The value of the input as an array of strings.
|
|
151
|
-
*/
|
|
152
|
-
value: string[];
|
|
153
|
-
/**
|
|
154
|
-
* The value of the input as a string.
|
|
155
|
-
*/
|
|
156
|
-
valueAsString: string;
|
|
157
|
-
/**
|
|
158
|
-
* Whether all inputs are filled.
|
|
159
|
-
*/
|
|
160
|
-
complete: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* The number of inputs to render
|
|
163
|
-
*/
|
|
164
|
-
count: number;
|
|
165
|
-
/**
|
|
166
|
-
* The array of input values.
|
|
167
|
-
*/
|
|
168
|
-
items: number[];
|
|
169
|
-
/**
|
|
170
|
-
* Function to set the value of the inputs.
|
|
171
|
-
*/
|
|
172
|
-
setValue: (value: string[]) => void;
|
|
173
|
-
/**
|
|
174
|
-
* Function to clear the value of the inputs.
|
|
175
|
-
*/
|
|
176
|
-
clearValue: VoidFunction;
|
|
177
|
-
/**
|
|
178
|
-
* Function to set the value of the input at a specific index.
|
|
179
|
-
*/
|
|
180
|
-
setValueAtIndex: (index: number, value: string) => void;
|
|
181
|
-
/**
|
|
182
|
-
* Function to focus the pin-input. This will focus the first input.
|
|
183
|
-
*/
|
|
184
|
-
focus: VoidFunction;
|
|
185
|
-
getRootProps: () => T["element"];
|
|
186
|
-
getLabelProps: () => T["label"];
|
|
187
|
-
getHiddenInputProps: () => T["input"];
|
|
188
|
-
getControlProps: () => T["element"];
|
|
189
|
-
getInputProps: (props: InputProps) => T["input"];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
declare function connect<T extends PropTypes>(service: Service<PinInputSchema>, normalize: NormalizeProps<T>): PinInputApi<T>;
|
|
193
|
-
|
|
194
|
-
declare const machine: _zag_js_core.Machine<PinInputSchema>;
|
|
195
|
-
|
|
196
|
-
declare const props: (keyof PinInputProps)[];
|
|
197
|
-
declare const splitProps: <Props extends Partial<PinInputProps>>(props: Props) => [Partial<PinInputProps>, Omit<Props, keyof PinInputProps>];
|
|
198
|
-
|
|
199
|
-
export { type PinInputApi as Api, type ElementIds, type InputProps, type IntlTranslations, type PinInputMachine as Machine, type PinInputProps as Props, type PinInputService as Service, type ValueChangeDetails, type ValueInvalidDetails, anatomy, connect, machine, props, splitProps };
|
|
1
|
+
export { anatomy } from './pin-input.anatomy.mjs';
|
|
2
|
+
export { connect } from './pin-input.connect.mjs';
|
|
3
|
+
export { machine } from './pin-input.machine.mjs';
|
|
4
|
+
export { props, splitProps } from './pin-input.props.mjs';
|
|
5
|
+
export { PinInputApi as Api, ElementIds, InputProps, IntlTranslations, PinInputMachine as Machine, PinInputProps as Props, PinInputService as Service, ValueChangeDetails, ValueInvalidDetails } from './pin-input.types.mjs';
|
|
6
|
+
import '@zag-js/anatomy';
|
|
7
|
+
import '@zag-js/core';
|
|
8
|
+
import '@zag-js/types';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,199 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
value: string[];
|
|
10
|
-
valueAsString: string;
|
|
11
|
-
}
|
|
12
|
-
interface ValueInvalidDetails {
|
|
13
|
-
value: string;
|
|
14
|
-
index: number;
|
|
15
|
-
}
|
|
16
|
-
type IntlTranslations = {
|
|
17
|
-
inputLabel: (index: number, length: number) => string;
|
|
18
|
-
};
|
|
19
|
-
type ElementIds = Partial<{
|
|
20
|
-
root: string;
|
|
21
|
-
hiddenInput: string;
|
|
22
|
-
label: string;
|
|
23
|
-
control: string;
|
|
24
|
-
input: (id: string) => string;
|
|
25
|
-
}>;
|
|
26
|
-
interface PinInputProps extends DirectionProperty, CommonProperties {
|
|
27
|
-
/**
|
|
28
|
-
* The name of the input element. Useful for form submission.
|
|
29
|
-
*/
|
|
30
|
-
name?: string | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* The associate form of the underlying input element.
|
|
33
|
-
*/
|
|
34
|
-
form?: string | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* The regular expression that the user-entered input value is checked against.
|
|
37
|
-
*/
|
|
38
|
-
pattern?: string | undefined;
|
|
39
|
-
/**
|
|
40
|
-
* The ids of the elements in the pin input. Useful for composition.
|
|
41
|
-
*/
|
|
42
|
-
ids?: ElementIds | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Whether the inputs are disabled
|
|
45
|
-
*/
|
|
46
|
-
disabled?: boolean | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* The placeholder text for the input
|
|
49
|
-
* @default "○"
|
|
50
|
-
*/
|
|
51
|
-
placeholder?: string | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Whether to auto-focus the first input.
|
|
54
|
-
*/
|
|
55
|
-
autoFocus?: boolean | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Whether the pin input is in the invalid state
|
|
58
|
-
*/
|
|
59
|
-
invalid?: boolean | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* Whether the pin input is required
|
|
62
|
-
*/
|
|
63
|
-
required?: boolean | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* Whether the pin input is in the valid state
|
|
66
|
-
*/
|
|
67
|
-
readOnly?: boolean | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* If `true`, the pin input component signals to its fields that they should
|
|
70
|
-
* use `autocomplete="one-time-code"`.
|
|
71
|
-
*/
|
|
72
|
-
otp?: boolean | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* The controlled value of the the pin input.
|
|
75
|
-
*/
|
|
76
|
-
value?: string[] | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* The initial value of the the pin input when rendered.
|
|
79
|
-
* Use when you don't need to control the value of the pin input.
|
|
80
|
-
*/
|
|
81
|
-
defaultValue?: string[] | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* The type of value the pin-input should allow
|
|
84
|
-
* @default "numeric"
|
|
85
|
-
*/
|
|
86
|
-
type?: "alphanumeric" | "numeric" | "alphabetic" | undefined;
|
|
87
|
-
/**
|
|
88
|
-
* Function called when all inputs have valid values
|
|
89
|
-
*/
|
|
90
|
-
onValueComplete?: ((details: ValueChangeDetails) => void) | undefined;
|
|
91
|
-
/**
|
|
92
|
-
* Function called on input change
|
|
93
|
-
*/
|
|
94
|
-
onValueChange?: ((details: ValueChangeDetails) => void) | undefined;
|
|
95
|
-
/**
|
|
96
|
-
* Function called when an invalid value is entered
|
|
97
|
-
*/
|
|
98
|
-
onValueInvalid?: ((details: ValueInvalidDetails) => void) | undefined;
|
|
99
|
-
/**
|
|
100
|
-
* If `true`, the input's value will be masked just like `type=password`
|
|
101
|
-
*/
|
|
102
|
-
mask?: boolean | undefined;
|
|
103
|
-
/**
|
|
104
|
-
* Whether to blur the input when the value is complete
|
|
105
|
-
*/
|
|
106
|
-
blurOnComplete?: boolean | undefined;
|
|
107
|
-
/**
|
|
108
|
-
* Whether to select input value when input is focused
|
|
109
|
-
*/
|
|
110
|
-
selectOnFocus?: boolean | undefined;
|
|
111
|
-
/**
|
|
112
|
-
* Specifies the localized strings that identifies the accessibility elements and their states
|
|
113
|
-
*/
|
|
114
|
-
translations?: IntlTranslations | undefined;
|
|
115
|
-
/**
|
|
116
|
-
* The number of inputs to render to improve SSR aria attributes.
|
|
117
|
-
* This will be required in next major version.
|
|
118
|
-
*/
|
|
119
|
-
count?: number | undefined;
|
|
120
|
-
}
|
|
121
|
-
type PropsWithDefault = "placeholder" | "otp" | "type" | "defaultValue";
|
|
122
|
-
interface PinInputSchema {
|
|
123
|
-
state: "idle" | "focused";
|
|
124
|
-
props: RequiredBy<PinInputProps, PropsWithDefault>;
|
|
125
|
-
context: {
|
|
126
|
-
value: string[];
|
|
127
|
-
focusedIndex: number;
|
|
128
|
-
count: number;
|
|
129
|
-
};
|
|
130
|
-
computed: {
|
|
131
|
-
_value: string[];
|
|
132
|
-
valueLength: number;
|
|
133
|
-
filledValueLength: number;
|
|
134
|
-
isValueComplete: boolean;
|
|
135
|
-
valueAsString: string;
|
|
136
|
-
focusedValue: string;
|
|
137
|
-
};
|
|
138
|
-
event: EventObject;
|
|
139
|
-
action: string;
|
|
140
|
-
effect: string;
|
|
141
|
-
guard: string;
|
|
142
|
-
}
|
|
143
|
-
type PinInputService = Service<PinInputSchema>;
|
|
144
|
-
type PinInputMachine = Machine<PinInputSchema>;
|
|
145
|
-
interface InputProps {
|
|
146
|
-
index: number;
|
|
147
|
-
}
|
|
148
|
-
interface PinInputApi<T extends PropTypes = PropTypes> {
|
|
149
|
-
/**
|
|
150
|
-
* The value of the input as an array of strings.
|
|
151
|
-
*/
|
|
152
|
-
value: string[];
|
|
153
|
-
/**
|
|
154
|
-
* The value of the input as a string.
|
|
155
|
-
*/
|
|
156
|
-
valueAsString: string;
|
|
157
|
-
/**
|
|
158
|
-
* Whether all inputs are filled.
|
|
159
|
-
*/
|
|
160
|
-
complete: boolean;
|
|
161
|
-
/**
|
|
162
|
-
* The number of inputs to render
|
|
163
|
-
*/
|
|
164
|
-
count: number;
|
|
165
|
-
/**
|
|
166
|
-
* The array of input values.
|
|
167
|
-
*/
|
|
168
|
-
items: number[];
|
|
169
|
-
/**
|
|
170
|
-
* Function to set the value of the inputs.
|
|
171
|
-
*/
|
|
172
|
-
setValue: (value: string[]) => void;
|
|
173
|
-
/**
|
|
174
|
-
* Function to clear the value of the inputs.
|
|
175
|
-
*/
|
|
176
|
-
clearValue: VoidFunction;
|
|
177
|
-
/**
|
|
178
|
-
* Function to set the value of the input at a specific index.
|
|
179
|
-
*/
|
|
180
|
-
setValueAtIndex: (index: number, value: string) => void;
|
|
181
|
-
/**
|
|
182
|
-
* Function to focus the pin-input. This will focus the first input.
|
|
183
|
-
*/
|
|
184
|
-
focus: VoidFunction;
|
|
185
|
-
getRootProps: () => T["element"];
|
|
186
|
-
getLabelProps: () => T["label"];
|
|
187
|
-
getHiddenInputProps: () => T["input"];
|
|
188
|
-
getControlProps: () => T["element"];
|
|
189
|
-
getInputProps: (props: InputProps) => T["input"];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
declare function connect<T extends PropTypes>(service: Service<PinInputSchema>, normalize: NormalizeProps<T>): PinInputApi<T>;
|
|
193
|
-
|
|
194
|
-
declare const machine: _zag_js_core.Machine<PinInputSchema>;
|
|
195
|
-
|
|
196
|
-
declare const props: (keyof PinInputProps)[];
|
|
197
|
-
declare const splitProps: <Props extends Partial<PinInputProps>>(props: Props) => [Partial<PinInputProps>, Omit<Props, keyof PinInputProps>];
|
|
198
|
-
|
|
199
|
-
export { type PinInputApi as Api, type ElementIds, type InputProps, type IntlTranslations, type PinInputMachine as Machine, type PinInputProps as Props, type PinInputService as Service, type ValueChangeDetails, type ValueInvalidDetails, anatomy, connect, machine, props, splitProps };
|
|
1
|
+
export { anatomy } from './pin-input.anatomy.js';
|
|
2
|
+
export { connect } from './pin-input.connect.js';
|
|
3
|
+
export { machine } from './pin-input.machine.js';
|
|
4
|
+
export { props, splitProps } from './pin-input.props.js';
|
|
5
|
+
export { PinInputApi as Api, ElementIds, InputProps, IntlTranslations, PinInputMachine as Machine, PinInputProps as Props, PinInputService as Service, ValueChangeDetails, ValueInvalidDetails } from './pin-input.types.js';
|
|
6
|
+
import '@zag-js/anatomy';
|
|
7
|
+
import '@zag-js/core';
|
|
8
|
+
import '@zag-js/types';
|