dhre-ui-kit 0.0.234 → 0.0.235

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.d.ts CHANGED
@@ -712,6 +712,7 @@ interface IProps$1 {
712
712
  resendText?: string;
713
713
  mode?: 'light' | 'dark';
714
714
  disabled?: boolean;
715
+ maxResendCount?: number;
715
716
  }
716
717
  type OTPInputHandle = {
717
718
  reset?: () => void;
package/lib/index.js CHANGED
@@ -4025,7 +4025,8 @@ const OTPInput = React__default["default"].forwardRef(
4025
4025
  label = "OTP",
4026
4026
  resendText = "Resend OTP",
4027
4027
  mode,
4028
- disabled
4028
+ disabled,
4029
+ maxResendCount = 4
4029
4030
  }, ref) => {
4030
4031
  const [otp, setOTP] = React.useState("");
4031
4032
  const [isResendOtpEnable, setIsResendOtpEnable] = React.useState(false);
@@ -4046,11 +4047,11 @@ const OTPInput = React__default["default"].forwardRef(
4046
4047
  enableResendOtp();
4047
4048
  }, []);
4048
4049
  const onClickResendOTP = () => {
4049
- if (resendOTPCount >= 3) {
4050
+ if (resendOTPCount >= maxResendCount - 1) {
4050
4051
  setErrorMessageMaxReachCount("You have exceeded the maximum number of attempts.");
4051
4052
  return;
4052
4053
  }
4053
- if (resendOTPCount < 3) {
4054
+ if (resendOTPCount < maxResendCount) {
4054
4055
  setIsResendOtpEnable(false);
4055
4056
  setResendOTPCount(resendOTPCount + 1);
4056
4057
  enableResendOtp();
@@ -4058,20 +4059,18 @@ const OTPInput = React__default["default"].forwardRef(
4058
4059
  setOTP("");
4059
4060
  }
4060
4061
  };
4061
- const enableResendOtp = () => {
4062
- setTimeout(() => {
4063
- setIsResendOtpEnable(true);
4064
- }, 5e3);
4065
- };
4066
4062
  const disableResendButton = () => {
4067
- if (disabled === true && resendOTPCount >= 3) {
4068
- setIsResendOtpEnable(true);
4063
+ if (disabled === true && resendOTPCount >= maxResendCount) {
4069
4064
  return true;
4070
4065
  } else {
4071
- setIsResendOtpEnable(false);
4072
4066
  return false;
4073
4067
  }
4074
4068
  };
4069
+ const enableResendOtp = () => {
4070
+ setTimeout(() => {
4071
+ setIsResendOtpEnable(true);
4072
+ }, 6e4);
4073
+ };
4075
4074
  React.useEffect(() => {
4076
4075
  if (reactNative.Platform.OS === "android") {
4077
4076
  onStartListeningOtp();
@@ -4151,7 +4150,7 @@ const OTPInput = React__default["default"].forwardRef(
4151
4150
  style: {
4152
4151
  ...styles$5.textInputStyle,
4153
4152
  color: theme$1.CONTENT_PRIMARY,
4154
- borderColor: errorMessage || errorMessageMaxReachCount ? theme$1.ERROR : otp.length === length ? theme$1.SUCCESS : activeInput === index ? theme$1.BORDER_INVERTED : theme$1.BORDER_PRIMARY,
4153
+ borderColor: errorMessage ? theme$1.ERROR : otp.length === length ? theme$1.SUCCESS : activeInput === index ? theme$1.BORDER_INVERTED : theme$1.BORDER_PRIMARY,
4155
4154
  ...textInputStyle
4156
4155
  },
4157
4156
  onFocus: () => setActiveInput(index),
@@ -4168,7 +4167,7 @@ const OTPInput = React__default["default"].forwardRef(
4168
4167
  autoComplete: "sms-otp",
4169
4168
  selectionColor: theme$1.CONTENT_PRIMARY
4170
4169
  }
4171
- ))), /* @__PURE__ */ React__default["default"].createElement(
4170
+ ))), !errorMessageMaxReachCount && /* @__PURE__ */ React__default["default"].createElement(
4172
4171
  reactNative.Pressable,
4173
4172
  {
4174
4173
  onPress: onClickResendOTP,