dhre-ui-kit 0.0.233 → 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 +1 -0
- package/lib/index.js +18 -11
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +18 -11
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
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,24 +4047,30 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4046
4047
|
enableResendOtp();
|
|
4047
4048
|
}, []);
|
|
4048
4049
|
const onClickResendOTP = () => {
|
|
4049
|
-
if (resendOTPCount >=
|
|
4050
|
+
if (resendOTPCount >= maxResendCount - 1) {
|
|
4050
4051
|
setErrorMessageMaxReachCount("You have exceeded the maximum number of attempts.");
|
|
4051
4052
|
return;
|
|
4052
4053
|
}
|
|
4053
|
-
if (resendOTPCount <
|
|
4054
|
+
if (resendOTPCount < maxResendCount) {
|
|
4055
|
+
setIsResendOtpEnable(false);
|
|
4054
4056
|
setResendOTPCount(resendOTPCount + 1);
|
|
4055
4057
|
enableResendOtp();
|
|
4056
4058
|
resendOTP?.();
|
|
4057
4059
|
setOTP("");
|
|
4058
4060
|
}
|
|
4059
4061
|
};
|
|
4060
|
-
const
|
|
4061
|
-
if (
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4062
|
+
const disableResendButton = () => {
|
|
4063
|
+
if (disabled === true && resendOTPCount >= maxResendCount) {
|
|
4064
|
+
return true;
|
|
4065
|
+
} else {
|
|
4066
|
+
return false;
|
|
4065
4067
|
}
|
|
4066
4068
|
};
|
|
4069
|
+
const enableResendOtp = () => {
|
|
4070
|
+
setTimeout(() => {
|
|
4071
|
+
setIsResendOtpEnable(true);
|
|
4072
|
+
}, 6e4);
|
|
4073
|
+
};
|
|
4067
4074
|
React.useEffect(() => {
|
|
4068
4075
|
if (reactNative.Platform.OS === "android") {
|
|
4069
4076
|
onStartListeningOtp();
|
|
@@ -4143,7 +4150,7 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4143
4150
|
style: {
|
|
4144
4151
|
...styles$5.textInputStyle,
|
|
4145
4152
|
color: theme$1.CONTENT_PRIMARY,
|
|
4146
|
-
borderColor: errorMessage
|
|
4153
|
+
borderColor: errorMessage ? theme$1.ERROR : otp.length === length ? theme$1.SUCCESS : activeInput === index ? theme$1.BORDER_INVERTED : theme$1.BORDER_PRIMARY,
|
|
4147
4154
|
...textInputStyle
|
|
4148
4155
|
},
|
|
4149
4156
|
onFocus: () => setActiveInput(index),
|
|
@@ -4160,12 +4167,12 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4160
4167
|
autoComplete: "sms-otp",
|
|
4161
4168
|
selectionColor: theme$1.CONTENT_PRIMARY
|
|
4162
4169
|
}
|
|
4163
|
-
))), /* @__PURE__ */ React__default["default"].createElement(
|
|
4170
|
+
))), !errorMessageMaxReachCount && /* @__PURE__ */ React__default["default"].createElement(
|
|
4164
4171
|
reactNative.Pressable,
|
|
4165
4172
|
{
|
|
4166
4173
|
onPress: onClickResendOTP,
|
|
4167
4174
|
style: styles$5.resendOTPStyle,
|
|
4168
|
-
disabled:
|
|
4175
|
+
disabled: disableResendButton() || !isResendOtpEnable
|
|
4169
4176
|
},
|
|
4170
4177
|
/* @__PURE__ */ React__default["default"].createElement(
|
|
4171
4178
|
CustomTypography,
|