@zag-js/pin-input 1.24.0 → 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 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]) nextValue = next[1];
489
- else if (current[0] === next[1]) nextValue = next[0];
490
- return nextValue.split("")[nextValue.length - 1];
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]) nextValue = next[1];
487
- else if (current[0] === next[1]) nextValue = next[0];
488
- return nextValue.split("")[nextValue.length - 1];
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.0",
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.0",
30
- "@zag-js/dom-query": "1.24.0",
31
- "@zag-js/utils": "1.24.0",
32
- "@zag-js/core": "1.24.0",
33
- "@zag-js/types": "1.24.0"
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"