dhre-ui-kit 0.0.309 → 0.0.311
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 +9 -10
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +9 -10
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -4089,6 +4089,7 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4089
4089
|
resendOTP,
|
|
4090
4090
|
errorMessage,
|
|
4091
4091
|
testId = "",
|
|
4092
|
+
errorMessageMaxReachCountProps,
|
|
4092
4093
|
otpContainerStyle,
|
|
4093
4094
|
otpHeaderTextStyle,
|
|
4094
4095
|
textInputStyle,
|
|
@@ -4100,20 +4101,18 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4100
4101
|
disabled,
|
|
4101
4102
|
maxResendCount = 2,
|
|
4102
4103
|
timerToResend = 6e4,
|
|
4103
|
-
timerIcon
|
|
4104
|
+
timerIcon,
|
|
4105
|
+
isInValidOtp
|
|
4104
4106
|
}, ref) => {
|
|
4105
4107
|
const [otp, setOTP] = React.useState("");
|
|
4106
4108
|
const [isResendOtpEnable, setIsResendOtpEnable] = React.useState(false);
|
|
4107
4109
|
const [activeInput, setActiveInput] = React.useState(null);
|
|
4108
4110
|
const [resendOTPCount, setResendOTPCount] = React.useState(0);
|
|
4109
4111
|
const [errorMessageMaxReachCount, setErrorMessageMaxReachCount] = React.useState("");
|
|
4110
|
-
const filteredTheme = Object?.keys(theme)?.reduce(
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
},
|
|
4115
|
-
{}
|
|
4116
|
-
);
|
|
4112
|
+
const filteredTheme = Object?.keys(theme)?.reduce((acc, key) => {
|
|
4113
|
+
acc[key] = theme[key][mode];
|
|
4114
|
+
return acc;
|
|
4115
|
+
}, {});
|
|
4117
4116
|
const { theme: theme$1 } = mode ? { theme: filteredTheme } : useTheme();
|
|
4118
4117
|
const [timeLeft, setTimeLeft] = React.useState(60);
|
|
4119
4118
|
React.useEffect(() => {
|
|
@@ -4135,7 +4134,7 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4135
4134
|
const onClickResendOTP = () => {
|
|
4136
4135
|
if (resendOTPCount > maxResendCount - 1) {
|
|
4137
4136
|
setErrorMessageMaxReachCount(
|
|
4138
|
-
"You have exceeded the maximum number of attempts."
|
|
4137
|
+
errorMessageMaxReachCountProps ? errorMessageMaxReachCountProps : "You have exceeded the maximum number of attempts."
|
|
4139
4138
|
);
|
|
4140
4139
|
}
|
|
4141
4140
|
if (resendOTPCount < maxResendCount) {
|
|
@@ -4238,7 +4237,7 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4238
4237
|
style: {
|
|
4239
4238
|
...styles$5.textInputStyle,
|
|
4240
4239
|
color: theme$1.CONTENT_PRIMARY,
|
|
4241
|
-
borderColor: errorMessage ? theme$1.ERROR : otp.length === length ? theme$1.SUCCESS : activeInput === index ? theme$1.BORDER_INVERTED : theme$1.BORDER_PRIMARY,
|
|
4240
|
+
borderColor: errorMessage || isInValidOtp ? theme$1.ERROR : otp.length === length ? theme$1.SUCCESS : activeInput === index ? theme$1.BORDER_INVERTED : theme$1.BORDER_PRIMARY,
|
|
4242
4241
|
...textInputStyle
|
|
4243
4242
|
},
|
|
4244
4243
|
onFocus: () => setActiveInput(index),
|