dhre-ui-kit 0.0.234 → 0.0.236
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 +2 -0
- package/lib/index.js +13 -14
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +13 -14
- 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,9 @@ 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,
|
|
4030
|
+
timerToResend = 6e4
|
|
4029
4031
|
}, ref) => {
|
|
4030
4032
|
const [otp, setOTP] = React.useState("");
|
|
4031
4033
|
const [isResendOtpEnable, setIsResendOtpEnable] = React.useState(false);
|
|
@@ -4046,11 +4048,10 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4046
4048
|
enableResendOtp();
|
|
4047
4049
|
}, []);
|
|
4048
4050
|
const onClickResendOTP = () => {
|
|
4049
|
-
if (resendOTPCount >=
|
|
4051
|
+
if (resendOTPCount >= maxResendCount - 1) {
|
|
4050
4052
|
setErrorMessageMaxReachCount("You have exceeded the maximum number of attempts.");
|
|
4051
|
-
return;
|
|
4052
4053
|
}
|
|
4053
|
-
if (resendOTPCount
|
|
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 >=
|
|
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
|
+
}, timerToResend);
|
|
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
|
|
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,
|