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 CHANGED
@@ -3968,12 +3968,14 @@ const OTPInput = React__default["default"].forwardRef(
3968
3968
  if (value.length === 1 && regex.test(value) && index >= 0 && index < length) {
3969
3969
  const newOTP = `${otp}${value}`;
3970
3970
  setOTP(newOTP);
3971
- refs.current[index + 1]?.focus();
3971
+ if (index < length - 1) {
3972
+ refs.current[index + 1]?.focus();
3973
+ }
3972
3974
  } else if (value.length === 0 && index > 0) {
3973
3975
  const newOTP = otp.slice(0, -1);
3974
3976
  setOTP(newOTP);
3975
3977
  refs.current[index - 1]?.focus();
3976
- } else if (value?.length === length) {
3978
+ } else if (value.length === length) {
3977
3979
  setOTP(value);
3978
3980
  refs.current[length - 1]?.focus();
3979
3981
  } else {