@westpac/ui 1.13.1 → 1.14.0

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.
@@ -47,6 +47,9 @@ export const PassCode = forwardRef(({ length, value, onChange, onComplete, onPas
47
47
  if (index + validData.length < length) {
48
48
  var _inputRefs_current_;
49
49
  (_inputRefs_current_ = inputRefs.current[index + validData.length]) === null || _inputRefs_current_ === void 0 ? void 0 : _inputRefs_current_.focus();
50
+ } else {
51
+ var _inputRefs_current_1;
52
+ (_inputRefs_current_1 = inputRefs.current[index + validData.length - 1]) === null || _inputRefs_current_1 === void 0 ? void 0 : _inputRefs_current_1.focus();
50
53
  }
51
54
  if (newPasscode.filter((passcode)=>!passcode).length === 0 && onComplete) {
52
55
  onComplete(newPasscode.join(''));
@@ -80,6 +83,13 @@ export const PassCode = forwardRef(({ length, value, onChange, onComplete, onPas
80
83
  } else {
81
84
  setInternalPasscode(newPasscode);
82
85
  }
86
+ if (index + validData.length < length) {
87
+ var _inputRefs_current_;
88
+ (_inputRefs_current_ = inputRefs.current[index + validData.length]) === null || _inputRefs_current_ === void 0 ? void 0 : _inputRefs_current_.focus();
89
+ } else {
90
+ var _inputRefs_current_1;
91
+ (_inputRefs_current_1 = inputRefs.current[index + validData.length - 1]) === null || _inputRefs_current_1 === void 0 ? void 0 : _inputRefs_current_1.focus();
92
+ }
83
93
  if (newPasscode.filter((passcode)=>!passcode).length === 0) {
84
94
  if (onPasteComplete) {
85
95
  onPasteComplete(newPasscode.join(''));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@westpac/ui",
3
- "version": "1.13.1",
3
+ "version": "1.14.0",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -81,6 +81,8 @@ export const PassCode = forwardRef<PassCodeRef, PassCodeProps>(
81
81
  // Move to the next input if available
82
82
  if (index + validData.length < length) {
83
83
  inputRefs.current[index + validData.length]?.focus();
84
+ } else {
85
+ inputRefs.current[index + validData.length - 1]?.focus();
84
86
  }
85
87
  if (newPasscode.filter(passcode => !passcode).length === 0 && onComplete) {
86
88
  onComplete(newPasscode.join(''));
@@ -112,6 +114,14 @@ export const PassCode = forwardRef<PassCodeRef, PassCodeProps>(
112
114
  } else {
113
115
  setInternalPasscode(newPasscode);
114
116
  }
117
+
118
+ // Move to the next input if available
119
+ if (index + validData.length < length) {
120
+ inputRefs.current[index + validData.length]?.focus();
121
+ } else {
122
+ inputRefs.current[index + validData.length - 1]?.focus();
123
+ }
124
+
115
125
  if (newPasscode.filter(passcode => !passcode).length === 0) {
116
126
  if (onPasteComplete) {
117
127
  onPasteComplete(newPasscode.join(''));