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.js CHANGED
@@ -3944,19 +3944,14 @@ const OTPInput = React__default["default"].forwardRef(
3944
3944
  }));
3945
3945
  const handleChange = (index, value) => {
3946
3946
  const regex = /^\d+$/;
3947
- if (value.length === 1 && // User is typing
3948
- regex.test(value) && index >= 0 && index < length) {
3947
+ if (value.length === 1 && regex.test(value) && index >= 0 && index < length) {
3949
3948
  const newOTP = `${otp}${value}`;
3950
3949
  setOTP(newOTP);
3951
- if (index + 1 < length) {
3952
- refs.current[index + 1]?.focus();
3953
- }
3950
+ refs.current[index + 1]?.focus();
3954
3951
  } else if (value.length === 0 && index > 0) {
3955
3952
  const newOTP = otp.slice(0, -1);
3956
3953
  setOTP(newOTP);
3957
- if (index - 1 >= 0) {
3958
- refs.current[index - 1]?.focus();
3959
- }
3954
+ refs.current[index - 1]?.focus();
3960
3955
  } else if (value?.length === length) {
3961
3956
  setOTP(value);
3962
3957
  refs.current[length - 1]?.focus();