@zag-js/pin-input 1.24.1 → 1.24.2
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.js +8 -3
- package/dist/index.mjs +8 -3
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -485,9 +485,14 @@ var machine = createMachine({
|
|
|
485
485
|
});
|
|
486
486
|
function getNextValue(current, next) {
|
|
487
487
|
let nextValue = next;
|
|
488
|
-
if (current[0] === next[0])
|
|
489
|
-
|
|
490
|
-
|
|
488
|
+
if (current[0] === next[0]) {
|
|
489
|
+
nextValue = next[1];
|
|
490
|
+
} else if (current[0] === next[1]) {
|
|
491
|
+
nextValue = next[0];
|
|
492
|
+
}
|
|
493
|
+
const chars = nextValue.split("");
|
|
494
|
+
nextValue = chars[chars.length - 1];
|
|
495
|
+
return nextValue ?? "";
|
|
491
496
|
}
|
|
492
497
|
function fill(value, count) {
|
|
493
498
|
return Array.from({ length: count }).fill("").map((v, i) => value[i] || v);
|
package/dist/index.mjs
CHANGED
|
@@ -483,9 +483,14 @@ var machine = createMachine({
|
|
|
483
483
|
});
|
|
484
484
|
function getNextValue(current, next) {
|
|
485
485
|
let nextValue = next;
|
|
486
|
-
if (current[0] === next[0])
|
|
487
|
-
|
|
488
|
-
|
|
486
|
+
if (current[0] === next[0]) {
|
|
487
|
+
nextValue = next[1];
|
|
488
|
+
} else if (current[0] === next[1]) {
|
|
489
|
+
nextValue = next[0];
|
|
490
|
+
}
|
|
491
|
+
const chars = nextValue.split("");
|
|
492
|
+
nextValue = chars[chars.length - 1];
|
|
493
|
+
return nextValue ?? "";
|
|
489
494
|
}
|
|
490
495
|
function fill(value, count) {
|
|
491
496
|
return Array.from({ length: count }).fill("").map((v, i) => value[i] || v);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/pin-input",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.2",
|
|
4
4
|
"description": "Core logic for the pin-input widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@zag-js/anatomy": "1.24.
|
|
30
|
-
"@zag-js/
|
|
31
|
-
"@zag-js/
|
|
32
|
-
"@zag-js/
|
|
33
|
-
"@zag-js/
|
|
29
|
+
"@zag-js/anatomy": "1.24.2",
|
|
30
|
+
"@zag-js/utils": "1.24.2",
|
|
31
|
+
"@zag-js/core": "1.24.2",
|
|
32
|
+
"@zag-js/types": "1.24.2",
|
|
33
|
+
"@zag-js/dom-query": "1.24.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"clean-package": "2.2.0"
|