@westpac/ui 1.15.1 → 1.15.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.
|
@@ -51,14 +51,19 @@ export const PassCode = forwardRef(({ length, value, onChange, onComplete, onPas
|
|
|
51
51
|
var _inputRefs_current_1;
|
|
52
52
|
(_inputRefs_current_1 = inputRefs.current[index + validData.length - 1]) === null || _inputRefs_current_1 === void 0 ? void 0 : _inputRefs_current_1.focus();
|
|
53
53
|
}
|
|
54
|
-
if (newPasscode.filter((passcode)=>!passcode).length === 0
|
|
55
|
-
|
|
54
|
+
if (newPasscode.filter((passcode)=>!passcode).length === 0) {
|
|
55
|
+
if (onPasteComplete && validData.length > 1) {
|
|
56
|
+
onPasteComplete(newPasscode.join(''));
|
|
57
|
+
} else if (onComplete) {
|
|
58
|
+
onComplete(newPasscode.join(''));
|
|
59
|
+
}
|
|
56
60
|
}
|
|
57
61
|
}, [
|
|
58
62
|
passcode,
|
|
59
63
|
length,
|
|
60
64
|
onChange,
|
|
61
65
|
onComplete,
|
|
66
|
+
onPasteComplete,
|
|
62
67
|
type
|
|
63
68
|
]);
|
|
64
69
|
const handlePaste = useCallback((index, event)=>{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@westpac/ui",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -259,13 +259,13 @@
|
|
|
259
259
|
"typescript": "^5.5.4",
|
|
260
260
|
"vite": "^7.3.5",
|
|
261
261
|
"vitest": "^3.2.6",
|
|
262
|
-
"@westpac/eslint-config": "~1.1.0",
|
|
263
|
-
"@westpac/style-config": "~1.0.2",
|
|
264
262
|
"@westpac/test-config": "~0.0.0",
|
|
265
|
-
"@westpac/ts-config": "~0.0.0"
|
|
263
|
+
"@westpac/ts-config": "~0.0.0",
|
|
264
|
+
"@westpac/style-config": "~1.0.2",
|
|
265
|
+
"@westpac/eslint-config": "~1.1.0"
|
|
266
266
|
},
|
|
267
267
|
"dependencies": {
|
|
268
|
-
"@internationalized/date": "
|
|
268
|
+
"@internationalized/date": "^3.12.0",
|
|
269
269
|
"@react-aria/accordion": "3.0.0-alpha.37",
|
|
270
270
|
"@react-aria/utils": "~3.29.1",
|
|
271
271
|
"@react-spectrum/utils": "~3.11.5",
|
|
@@ -279,7 +279,6 @@
|
|
|
279
279
|
"zustand": "~4.5.4"
|
|
280
280
|
},
|
|
281
281
|
"peerDependencies": {
|
|
282
|
-
"@internationalized/date": "~3.10.0",
|
|
283
282
|
"react": ">=18.2.0",
|
|
284
283
|
"tailwindcss": "~4.1.12"
|
|
285
284
|
},
|
|
@@ -84,11 +84,15 @@ export const PassCode = forwardRef<PassCodeRef, PassCodeProps>(
|
|
|
84
84
|
} else {
|
|
85
85
|
inputRefs.current[index + validData.length - 1]?.focus();
|
|
86
86
|
}
|
|
87
|
-
if (newPasscode.filter(passcode => !passcode).length === 0
|
|
88
|
-
|
|
87
|
+
if (newPasscode.filter(passcode => !passcode).length === 0) {
|
|
88
|
+
if (onPasteComplete && validData.length > 1) {
|
|
89
|
+
onPasteComplete(newPasscode.join(''));
|
|
90
|
+
} else if (onComplete) {
|
|
91
|
+
onComplete(newPasscode.join(''));
|
|
92
|
+
}
|
|
89
93
|
}
|
|
90
94
|
},
|
|
91
|
-
[passcode, length, onChange, onComplete, type],
|
|
95
|
+
[passcode, length, onChange, onComplete, onPasteComplete, type],
|
|
92
96
|
);
|
|
93
97
|
|
|
94
98
|
const handlePaste = useCallback(
|