dhre-ui-kit 0.0.199 → 0.0.202
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 +9 -4
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +9 -4
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -220,7 +220,7 @@ const theme = {
|
|
|
220
220
|
},
|
|
221
221
|
[Theme.BORDER_PRIMARY]: {
|
|
222
222
|
light: "#686868",
|
|
223
|
-
dark: "#
|
|
223
|
+
dark: "#A7A7A7"
|
|
224
224
|
},
|
|
225
225
|
[Theme.BORDER_SECONDRY]: {
|
|
226
226
|
light: "#A7A7A7",
|
|
@@ -3944,14 +3944,19 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
3944
3944
|
}));
|
|
3945
3945
|
const handleChange = (index, value) => {
|
|
3946
3946
|
const regex = /^\d+$/;
|
|
3947
|
-
if (value.length === 1 &&
|
|
3947
|
+
if (value.length === 1 && // User is typing
|
|
3948
|
+
regex.test(value) && index >= 0 && index < length) {
|
|
3948
3949
|
const newOTP = `${otp}${value}`;
|
|
3949
3950
|
setOTP(newOTP);
|
|
3950
|
-
|
|
3951
|
+
if (index + 1 < length) {
|
|
3952
|
+
refs.current[index + 1]?.focus();
|
|
3953
|
+
}
|
|
3951
3954
|
} else if (value.length === 0 && index > 0) {
|
|
3952
3955
|
const newOTP = otp.slice(0, -1);
|
|
3953
3956
|
setOTP(newOTP);
|
|
3954
|
-
|
|
3957
|
+
if (index - 1 >= 0) {
|
|
3958
|
+
refs.current[index - 1]?.focus();
|
|
3959
|
+
}
|
|
3955
3960
|
} else if (value?.length === length) {
|
|
3956
3961
|
setOTP(value);
|
|
3957
3962
|
refs.current[length - 1]?.focus();
|