dhre-ui-kit 0.0.204 → 0.0.205
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/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +4 -2
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -3934,12 +3934,14 @@ const OTPInput = React.forwardRef(
|
|
|
3934
3934
|
if (value.length === 1 && regex.test(value) && index >= 0 && index < length) {
|
|
3935
3935
|
const newOTP = `${otp}${value}`;
|
|
3936
3936
|
setOTP(newOTP);
|
|
3937
|
-
|
|
3937
|
+
if (index < length - 1) {
|
|
3938
|
+
refs.current[index + 1]?.focus();
|
|
3939
|
+
}
|
|
3938
3940
|
} else if (value.length === 0 && index > 0) {
|
|
3939
3941
|
const newOTP = otp.slice(0, -1);
|
|
3940
3942
|
setOTP(newOTP);
|
|
3941
3943
|
refs.current[index - 1]?.focus();
|
|
3942
|
-
} else if (value
|
|
3944
|
+
} else if (value.length === length) {
|
|
3943
3945
|
setOTP(value);
|
|
3944
3946
|
refs.current[length - 1]?.focus();
|
|
3945
3947
|
} else {
|