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.mjs
CHANGED
|
@@ -3989,7 +3989,9 @@ const OTPInput = React.forwardRef(
|
|
|
3989
3989
|
label = "OTP",
|
|
3990
3990
|
resendText = "Resend OTP",
|
|
3991
3991
|
mode,
|
|
3992
|
-
disabled
|
|
3992
|
+
disabled,
|
|
3993
|
+
maxResendCount = 4,
|
|
3994
|
+
timerToResend = 6e4
|
|
3993
3995
|
}, ref) => {
|
|
3994
3996
|
const [otp, setOTP] = useState("");
|
|
3995
3997
|
const [isResendOtpEnable, setIsResendOtpEnable] = useState(false);
|
|
@@ -4010,11 +4012,10 @@ const OTPInput = React.forwardRef(
|
|
|
4010
4012
|
enableResendOtp();
|
|
4011
4013
|
}, []);
|
|
4012
4014
|
const onClickResendOTP = () => {
|
|
4013
|
-
if (resendOTPCount >=
|
|
4015
|
+
if (resendOTPCount >= maxResendCount - 1) {
|
|
4014
4016
|
setErrorMessageMaxReachCount("You have exceeded the maximum number of attempts.");
|
|
4015
|
-
return;
|
|
4016
4017
|
}
|
|
4017
|
-
if (resendOTPCount
|
|
4018
|
+
if (resendOTPCount <= maxResendCount) {
|
|
4018
4019
|
setIsResendOtpEnable(false);
|
|
4019
4020
|
setResendOTPCount(resendOTPCount + 1);
|
|
4020
4021
|
enableResendOtp();
|
|
@@ -4022,20 +4023,18 @@ const OTPInput = React.forwardRef(
|
|
|
4022
4023
|
setOTP("");
|
|
4023
4024
|
}
|
|
4024
4025
|
};
|
|
4025
|
-
const enableResendOtp = () => {
|
|
4026
|
-
setTimeout(() => {
|
|
4027
|
-
setIsResendOtpEnable(true);
|
|
4028
|
-
}, 5e3);
|
|
4029
|
-
};
|
|
4030
4026
|
const disableResendButton = () => {
|
|
4031
|
-
if (disabled === true && resendOTPCount >=
|
|
4032
|
-
setIsResendOtpEnable(true);
|
|
4027
|
+
if (disabled === true && resendOTPCount >= maxResendCount) {
|
|
4033
4028
|
return true;
|
|
4034
4029
|
} else {
|
|
4035
|
-
setIsResendOtpEnable(false);
|
|
4036
4030
|
return false;
|
|
4037
4031
|
}
|
|
4038
4032
|
};
|
|
4033
|
+
const enableResendOtp = () => {
|
|
4034
|
+
setTimeout(() => {
|
|
4035
|
+
setIsResendOtpEnable(true);
|
|
4036
|
+
}, timerToResend);
|
|
4037
|
+
};
|
|
4039
4038
|
useEffect(() => {
|
|
4040
4039
|
if (Platform.OS === "android") {
|
|
4041
4040
|
onStartListeningOtp();
|
|
@@ -4115,7 +4114,7 @@ const OTPInput = React.forwardRef(
|
|
|
4115
4114
|
style: {
|
|
4116
4115
|
...styles$5.textInputStyle,
|
|
4117
4116
|
color: theme$1.CONTENT_PRIMARY,
|
|
4118
|
-
borderColor: errorMessage
|
|
4117
|
+
borderColor: errorMessage ? theme$1.ERROR : otp.length === length ? theme$1.SUCCESS : activeInput === index ? theme$1.BORDER_INVERTED : theme$1.BORDER_PRIMARY,
|
|
4119
4118
|
...textInputStyle
|
|
4120
4119
|
},
|
|
4121
4120
|
onFocus: () => setActiveInput(index),
|
|
@@ -4132,7 +4131,7 @@ const OTPInput = React.forwardRef(
|
|
|
4132
4131
|
autoComplete: "sms-otp",
|
|
4133
4132
|
selectionColor: theme$1.CONTENT_PRIMARY
|
|
4134
4133
|
}
|
|
4135
|
-
))), /* @__PURE__ */ React.createElement(
|
|
4134
|
+
))), !errorMessageMaxReachCount && /* @__PURE__ */ React.createElement(
|
|
4136
4135
|
Pressable,
|
|
4137
4136
|
{
|
|
4138
4137
|
onPress: onClickResendOTP,
|