dhre-ui-kit 0.0.244 → 0.0.246
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 -1
- package/lib/index.js +39 -11
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +39 -11
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -3403,8 +3403,7 @@ const CommonTextInput = (props) => {
|
|
|
3403
3403
|
multiline = false,
|
|
3404
3404
|
// Default multiline to false
|
|
3405
3405
|
rightIcon,
|
|
3406
|
-
onRightIconPress
|
|
3407
|
-
onlyErrorBorderLabel
|
|
3406
|
+
onRightIconPress
|
|
3408
3407
|
} = props;
|
|
3409
3408
|
return /* @__PURE__ */ React.createElement(Pressable, { onPress: handlePress, style: styles$9.container }, /* @__PURE__ */ React.createElement(
|
|
3410
3409
|
TextInput$1,
|
|
@@ -3416,7 +3415,7 @@ const CommonTextInput = (props) => {
|
|
|
3416
3415
|
autoCorrect: false,
|
|
3417
3416
|
outlineStyle: {
|
|
3418
3417
|
...styles$9.outlineStyle,
|
|
3419
|
-
borderColor: errorMessage?.length
|
|
3418
|
+
borderColor: errorMessage?.length ? DHRE_DEFAULT.DH_SEMENTIC_ERROR : value?.length ? activeBorderColor : inactiveBorderColor
|
|
3420
3419
|
},
|
|
3421
3420
|
label,
|
|
3422
3421
|
value,
|
|
@@ -3426,12 +3425,12 @@ const CommonTextInput = (props) => {
|
|
|
3426
3425
|
theme: {
|
|
3427
3426
|
colors: {
|
|
3428
3427
|
onSurfaceVariant: value?.length ? activeBorderColor : inactiveBorderColor,
|
|
3429
|
-
error: errorMessage?.length
|
|
3428
|
+
error: errorMessage?.length ? DHRE_DEFAULT.DH_SEMENTIC_ERROR : DHRE_COLORS_TEXT.DH_BLACK,
|
|
3430
3429
|
primary: labelColor ? errorMessage?.length ? DHRE_DEFAULT.DH_SEMENTIC_ERROR : labelColor : DHRE_COLORS_TEXT.DH_BLACK
|
|
3431
3430
|
}
|
|
3432
3431
|
},
|
|
3433
3432
|
style: [
|
|
3434
|
-
errorMessage
|
|
3433
|
+
errorMessage ? styles$9.errorInput : styles$9.input,
|
|
3435
3434
|
inputStyle,
|
|
3436
3435
|
multiline && styles$9.multilineInput
|
|
3437
3436
|
// Apply multiline style if true
|
|
@@ -3441,7 +3440,7 @@ const CommonTextInput = (props) => {
|
|
|
3441
3440
|
placeholder: placeholderText,
|
|
3442
3441
|
editable,
|
|
3443
3442
|
pointerEvents,
|
|
3444
|
-
error: errorMessage?.length
|
|
3443
|
+
error: errorMessage?.length ? true : false,
|
|
3445
3444
|
multiline,
|
|
3446
3445
|
numberOfLines: multiline ? 4 : 1,
|
|
3447
3446
|
right: rightIcon ? /* @__PURE__ */ React.createElement(
|
|
@@ -3977,7 +3976,13 @@ const styles$5 = StyleSheet.create({
|
|
|
3977
3976
|
resendOTPStyle: {
|
|
3978
3977
|
alignSelf: "flex-end",
|
|
3979
3978
|
marginTop: verticalScale(8)
|
|
3980
|
-
}
|
|
3979
|
+
},
|
|
3980
|
+
timerContainer: {
|
|
3981
|
+
flexDirection: "row",
|
|
3982
|
+
justifyContent: "space-between",
|
|
3983
|
+
marginTop: verticalScale(8)
|
|
3984
|
+
},
|
|
3985
|
+
timerIconContainer: { flexDirection: "row", gap: horizontalScale(8) }
|
|
3981
3986
|
});
|
|
3982
3987
|
|
|
3983
3988
|
const OTPInput = React.forwardRef(
|
|
@@ -3997,7 +4002,8 @@ const OTPInput = React.forwardRef(
|
|
|
3997
4002
|
mode,
|
|
3998
4003
|
disabled,
|
|
3999
4004
|
maxResendCount = 2,
|
|
4000
|
-
timerToResend = 6e4
|
|
4005
|
+
timerToResend = 6e4,
|
|
4006
|
+
timerIcon
|
|
4001
4007
|
}, ref) => {
|
|
4002
4008
|
const [otp, setOTP] = useState("");
|
|
4003
4009
|
const [isResendOtpEnable, setIsResendOtpEnable] = useState(false);
|
|
@@ -4012,6 +4018,18 @@ const OTPInput = React.forwardRef(
|
|
|
4012
4018
|
{}
|
|
4013
4019
|
);
|
|
4014
4020
|
const { theme: theme$1 } = mode ? { theme: filteredTheme } : useTheme();
|
|
4021
|
+
const [timeLeft, setTimeLeft] = useState(60);
|
|
4022
|
+
useEffect(() => {
|
|
4023
|
+
let timer;
|
|
4024
|
+
if (!isResendOtpEnable && timeLeft > 0) {
|
|
4025
|
+
timer = setInterval(() => {
|
|
4026
|
+
setTimeLeft((prevTime) => prevTime - 1);
|
|
4027
|
+
}, 1e3);
|
|
4028
|
+
} else if (timeLeft === 0) {
|
|
4029
|
+
clearInterval(timer);
|
|
4030
|
+
}
|
|
4031
|
+
return () => clearInterval(timer);
|
|
4032
|
+
}, [timeLeft, isResendOtpEnable]);
|
|
4015
4033
|
const refs = useRef([]);
|
|
4016
4034
|
refs.current = Array(length).fill(0).map((_, index) => refs.current[index] || null);
|
|
4017
4035
|
useEffect(() => {
|
|
@@ -4019,7 +4037,9 @@ const OTPInput = React.forwardRef(
|
|
|
4019
4037
|
}, []);
|
|
4020
4038
|
const onClickResendOTP = () => {
|
|
4021
4039
|
if (resendOTPCount > maxResendCount - 1) {
|
|
4022
|
-
setErrorMessageMaxReachCount(
|
|
4040
|
+
setErrorMessageMaxReachCount(
|
|
4041
|
+
"You have exceeded the maximum number of attempts."
|
|
4042
|
+
);
|
|
4023
4043
|
}
|
|
4024
4044
|
if (resendOTPCount < maxResendCount) {
|
|
4025
4045
|
setIsResendOtpEnable(false);
|
|
@@ -4039,6 +4059,7 @@ const OTPInput = React.forwardRef(
|
|
|
4039
4059
|
const enableResendOtp = () => {
|
|
4040
4060
|
setTimeout(() => {
|
|
4041
4061
|
setIsResendOtpEnable(true);
|
|
4062
|
+
setTimeLeft(timerToResend / 1e3);
|
|
4042
4063
|
}, timerToResend);
|
|
4043
4064
|
};
|
|
4044
4065
|
useEffect(() => {
|
|
@@ -4137,7 +4158,14 @@ const OTPInput = React.forwardRef(
|
|
|
4137
4158
|
autoComplete: "sms-otp",
|
|
4138
4159
|
selectionColor: theme$1.CONTENT_PRIMARY
|
|
4139
4160
|
}
|
|
4140
|
-
))), !errorMessageMaxReachCount && /* @__PURE__ */ React.createElement(
|
|
4161
|
+
))), !errorMessageMaxReachCount && /* @__PURE__ */ React.createElement(View, { style: styles$5.timerContainer }, timeLeft !== 0 && /* @__PURE__ */ React.createElement(View, { style: styles$5.timerIconContainer }, timerIcon, /* @__PURE__ */ React.createElement(
|
|
4162
|
+
CustomTypography,
|
|
4163
|
+
{
|
|
4164
|
+
text: `${timeLeft} sec`,
|
|
4165
|
+
variant: FontStyle.L2_REGULAR,
|
|
4166
|
+
style: { color: theme$1.CONTENT_PRIMARY }
|
|
4167
|
+
}
|
|
4168
|
+
)), /* @__PURE__ */ React.createElement(
|
|
4141
4169
|
Pressable,
|
|
4142
4170
|
{
|
|
4143
4171
|
onPress: onClickResendOTP,
|
|
@@ -4156,7 +4184,7 @@ const OTPInput = React.forwardRef(
|
|
|
4156
4184
|
}
|
|
4157
4185
|
}
|
|
4158
4186
|
)
|
|
4159
|
-
), errorMessage ? /* @__PURE__ */ React.createElement(View, { style: styles$5.resendOtpContainer }, /* @__PURE__ */ React.createElement(
|
|
4187
|
+
)), errorMessage ? /* @__PURE__ */ React.createElement(View, { style: styles$5.resendOtpContainer }, /* @__PURE__ */ React.createElement(
|
|
4160
4188
|
CustomTypography,
|
|
4161
4189
|
{
|
|
4162
4190
|
text: errorMessage,
|