dhre-ui-kit 0.0.202 → 0.0.203

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