dhre-ui-kit 0.0.244 → 0.0.245
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 +0 -1
- package/lib/index.js +37 -9
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +37 -9
- 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,6 +3976,11 @@ const styles$5 = StyleSheet.create({
|
|
|
3977
3976
|
resendOTPStyle: {
|
|
3978
3977
|
alignSelf: "flex-end",
|
|
3979
3978
|
marginTop: verticalScale(8)
|
|
3979
|
+
},
|
|
3980
|
+
timerContainer: {
|
|
3981
|
+
flexDirection: "row",
|
|
3982
|
+
justifyContent: "space-between",
|
|
3983
|
+
marginTop: verticalScale(8)
|
|
3980
3984
|
}
|
|
3981
3985
|
});
|
|
3982
3986
|
|
|
@@ -4012,6 +4016,18 @@ const OTPInput = React.forwardRef(
|
|
|
4012
4016
|
{}
|
|
4013
4017
|
);
|
|
4014
4018
|
const { theme: theme$1 } = mode ? { theme: filteredTheme } : useTheme();
|
|
4019
|
+
const [timeLeft, setTimeLeft] = useState(60);
|
|
4020
|
+
useEffect(() => {
|
|
4021
|
+
let timer;
|
|
4022
|
+
if (!isResendOtpEnable && timeLeft > 0) {
|
|
4023
|
+
timer = setInterval(() => {
|
|
4024
|
+
setTimeLeft((prevTime) => prevTime - 1);
|
|
4025
|
+
}, 1e3);
|
|
4026
|
+
} else if (timeLeft === 0) {
|
|
4027
|
+
clearInterval(timer);
|
|
4028
|
+
}
|
|
4029
|
+
return () => clearInterval(timer);
|
|
4030
|
+
}, [timeLeft, isResendOtpEnable]);
|
|
4015
4031
|
const refs = useRef([]);
|
|
4016
4032
|
refs.current = Array(length).fill(0).map((_, index) => refs.current[index] || null);
|
|
4017
4033
|
useEffect(() => {
|
|
@@ -4019,7 +4035,9 @@ const OTPInput = React.forwardRef(
|
|
|
4019
4035
|
}, []);
|
|
4020
4036
|
const onClickResendOTP = () => {
|
|
4021
4037
|
if (resendOTPCount > maxResendCount - 1) {
|
|
4022
|
-
setErrorMessageMaxReachCount(
|
|
4038
|
+
setErrorMessageMaxReachCount(
|
|
4039
|
+
"You have exceeded the maximum number of attempts."
|
|
4040
|
+
);
|
|
4023
4041
|
}
|
|
4024
4042
|
if (resendOTPCount < maxResendCount) {
|
|
4025
4043
|
setIsResendOtpEnable(false);
|
|
@@ -4039,6 +4057,7 @@ const OTPInput = React.forwardRef(
|
|
|
4039
4057
|
const enableResendOtp = () => {
|
|
4040
4058
|
setTimeout(() => {
|
|
4041
4059
|
setIsResendOtpEnable(true);
|
|
4060
|
+
setTimeLeft(timerToResend / 1e3);
|
|
4042
4061
|
}, timerToResend);
|
|
4043
4062
|
};
|
|
4044
4063
|
useEffect(() => {
|
|
@@ -4137,7 +4156,16 @@ const OTPInput = React.forwardRef(
|
|
|
4137
4156
|
autoComplete: "sms-otp",
|
|
4138
4157
|
selectionColor: theme$1.CONTENT_PRIMARY
|
|
4139
4158
|
}
|
|
4140
|
-
))), !errorMessageMaxReachCount && /* @__PURE__ */ React.createElement(
|
|
4159
|
+
))), !errorMessageMaxReachCount && /* @__PURE__ */ React.createElement(View, { style: styles$5.timerContainer }, /* @__PURE__ */ React.createElement(
|
|
4160
|
+
CustomTypography,
|
|
4161
|
+
{
|
|
4162
|
+
text: `${timeLeft} sec`,
|
|
4163
|
+
variant: FontStyle.L2_REGULAR,
|
|
4164
|
+
style: {
|
|
4165
|
+
...resendTextStyle
|
|
4166
|
+
}
|
|
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,
|