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.mjs
CHANGED
|
@@ -187,7 +187,7 @@ const theme = {
|
|
|
187
187
|
},
|
|
188
188
|
[Theme.BORDER_PRIMARY]: {
|
|
189
189
|
light: "#686868",
|
|
190
|
-
dark: "#
|
|
190
|
+
dark: "#A7A7A7"
|
|
191
191
|
},
|
|
192
192
|
[Theme.BORDER_SECONDRY]: {
|
|
193
193
|
light: "#A7A7A7",
|
|
@@ -3911,14 +3911,19 @@ const OTPInput = React.forwardRef(
|
|
|
3911
3911
|
}));
|
|
3912
3912
|
const handleChange = (index, value) => {
|
|
3913
3913
|
const regex = /^\d+$/;
|
|
3914
|
-
if (value.length === 1 &&
|
|
3914
|
+
if (value.length === 1 && // User is typing
|
|
3915
|
+
regex.test(value) && index >= 0 && index < length) {
|
|
3915
3916
|
const newOTP = `${otp}${value}`;
|
|
3916
3917
|
setOTP(newOTP);
|
|
3917
|
-
|
|
3918
|
+
if (index + 1 < length) {
|
|
3919
|
+
refs.current[index + 1]?.focus();
|
|
3920
|
+
}
|
|
3918
3921
|
} else if (value.length === 0 && index > 0) {
|
|
3919
3922
|
const newOTP = otp.slice(0, -1);
|
|
3920
3923
|
setOTP(newOTP);
|
|
3921
|
-
|
|
3924
|
+
if (index - 1 >= 0) {
|
|
3925
|
+
refs.current[index - 1]?.focus();
|
|
3926
|
+
}
|
|
3922
3927
|
} else if (value?.length === length) {
|
|
3923
3928
|
setOTP(value);
|
|
3924
3929
|
refs.current[length - 1]?.focus();
|