@zag-js/pin-input 0.2.1 → 0.2.3
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 +4 -0
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ declare type PublicContext = DirectionProperty & CommonProperties & {
|
|
|
16
16
|
* The name of the input element. Useful for form submission.
|
|
17
17
|
*/
|
|
18
18
|
name?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The associate form of the underlying input element.
|
|
21
|
+
*/
|
|
22
|
+
form?: string;
|
|
19
23
|
/**
|
|
20
24
|
* The regular expression that the user-entered input value is checked against.
|
|
21
25
|
*/
|
package/dist/index.js
CHANGED
|
@@ -235,6 +235,7 @@ function connect(state, send, normalize) {
|
|
|
235
235
|
tabIndex: -1,
|
|
236
236
|
id: dom.getHiddenInputId(state.context),
|
|
237
237
|
name: state.context.name,
|
|
238
|
+
form: state.context.form,
|
|
238
239
|
style: visuallyHiddenStyle,
|
|
239
240
|
maxLength: state.context.valueLength,
|
|
240
241
|
defaultValue: state.context.valueAsString
|
|
@@ -324,7 +325,7 @@ function getWindow(el) {
|
|
|
324
325
|
}
|
|
325
326
|
function getDescriptor(el, options) {
|
|
326
327
|
var _a;
|
|
327
|
-
const { type, property } = options;
|
|
328
|
+
const { type, property = "value" } = options;
|
|
328
329
|
const proto = getWindow(el)[type].prototype;
|
|
329
330
|
return (_a = Object.getOwnPropertyDescriptor(proto, property)) != null ? _a : {};
|
|
330
331
|
}
|
|
@@ -626,9 +627,8 @@ function isValidType(value, type) {
|
|
|
626
627
|
return !!((_a = REGEX[type]) == null ? void 0 : _a.test(value));
|
|
627
628
|
}
|
|
628
629
|
function assign(ctx, value) {
|
|
629
|
-
const valueArr = value.split("").filter(Boolean);
|
|
630
|
+
const valueArr = Array.isArray(value) ? value : value.split("").filter(Boolean);
|
|
630
631
|
const valueObj = Object.assign({}, ctx.value, valueArr);
|
|
631
|
-
console.log("valueObj :>> ", valueObj);
|
|
632
632
|
ctx.value = Object.values(valueObj);
|
|
633
633
|
}
|
|
634
634
|
function lastChar(value) {
|
package/dist/index.mjs
CHANGED
|
@@ -208,6 +208,7 @@ function connect(state, send, normalize) {
|
|
|
208
208
|
tabIndex: -1,
|
|
209
209
|
id: dom.getHiddenInputId(state.context),
|
|
210
210
|
name: state.context.name,
|
|
211
|
+
form: state.context.form,
|
|
211
212
|
style: visuallyHiddenStyle,
|
|
212
213
|
maxLength: state.context.valueLength,
|
|
213
214
|
defaultValue: state.context.valueAsString
|
|
@@ -297,7 +298,7 @@ function getWindow(el) {
|
|
|
297
298
|
}
|
|
298
299
|
function getDescriptor(el, options) {
|
|
299
300
|
var _a;
|
|
300
|
-
const { type, property } = options;
|
|
301
|
+
const { type, property = "value" } = options;
|
|
301
302
|
const proto = getWindow(el)[type].prototype;
|
|
302
303
|
return (_a = Object.getOwnPropertyDescriptor(proto, property)) != null ? _a : {};
|
|
303
304
|
}
|
|
@@ -599,9 +600,8 @@ function isValidType(value, type) {
|
|
|
599
600
|
return !!((_a = REGEX[type]) == null ? void 0 : _a.test(value));
|
|
600
601
|
}
|
|
601
602
|
function assign(ctx, value) {
|
|
602
|
-
const valueArr = value.split("").filter(Boolean);
|
|
603
|
+
const valueArr = Array.isArray(value) ? value : value.split("").filter(Boolean);
|
|
603
604
|
const valueObj = Object.assign({}, ctx.value, valueArr);
|
|
604
|
-
console.log("valueObj :>> ", valueObj);
|
|
605
605
|
ctx.value = Object.values(valueObj);
|
|
606
606
|
}
|
|
607
607
|
function lastChar(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/pin-input",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Core logic for the pin-input widget implemented as a state machine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/core": "0.2.
|
|
33
|
-
"@zag-js/types": "0.3.
|
|
32
|
+
"@zag-js/core": "0.2.2",
|
|
33
|
+
"@zag-js/types": "0.3.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@zag-js/dom-utils": "0.2.
|
|
37
|
-
"@zag-js/form-utils": "0.2.
|
|
38
|
-
"@zag-js/utils": "0.3.
|
|
36
|
+
"@zag-js/dom-utils": "0.2.1",
|
|
37
|
+
"@zag-js/form-utils": "0.2.2",
|
|
38
|
+
"@zag-js/utils": "0.3.1"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build-fast": "tsup src/index.ts --format=esm,cjs",
|