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.d.ts
CHANGED
|
@@ -612,7 +612,6 @@ interface CommonTextInputProps extends TextInputProps$1 {
|
|
|
612
612
|
handlePress?: () => void;
|
|
613
613
|
rightIcon?: () => React$1.ReactElement;
|
|
614
614
|
onRightIconPress?: () => void;
|
|
615
|
-
onlyErrorBorderLabel?: boolean;
|
|
616
615
|
}
|
|
617
616
|
declare const CommonTextInput: (props: CommonTextInputProps) => React$1.JSX.Element;
|
|
618
617
|
|
package/lib/index.js
CHANGED
|
@@ -3439,8 +3439,7 @@ const CommonTextInput = (props) => {
|
|
|
3439
3439
|
multiline = false,
|
|
3440
3440
|
// Default multiline to false
|
|
3441
3441
|
rightIcon,
|
|
3442
|
-
onRightIconPress
|
|
3443
|
-
onlyErrorBorderLabel
|
|
3442
|
+
onRightIconPress
|
|
3444
3443
|
} = props;
|
|
3445
3444
|
return /* @__PURE__ */ React__default["default"].createElement(reactNative.Pressable, { onPress: handlePress, style: styles$9.container }, /* @__PURE__ */ React__default["default"].createElement(
|
|
3446
3445
|
reactNativePaper.TextInput,
|
|
@@ -3452,7 +3451,7 @@ const CommonTextInput = (props) => {
|
|
|
3452
3451
|
autoCorrect: false,
|
|
3453
3452
|
outlineStyle: {
|
|
3454
3453
|
...styles$9.outlineStyle,
|
|
3455
|
-
borderColor: errorMessage?.length
|
|
3454
|
+
borderColor: errorMessage?.length ? DHRE_DEFAULT.DH_SEMENTIC_ERROR : value?.length ? activeBorderColor : inactiveBorderColor
|
|
3456
3455
|
},
|
|
3457
3456
|
label,
|
|
3458
3457
|
value,
|
|
@@ -3462,12 +3461,12 @@ const CommonTextInput = (props) => {
|
|
|
3462
3461
|
theme: {
|
|
3463
3462
|
colors: {
|
|
3464
3463
|
onSurfaceVariant: value?.length ? activeBorderColor : inactiveBorderColor,
|
|
3465
|
-
error: errorMessage?.length
|
|
3464
|
+
error: errorMessage?.length ? DHRE_DEFAULT.DH_SEMENTIC_ERROR : DHRE_COLORS_TEXT.DH_BLACK,
|
|
3466
3465
|
primary: labelColor ? errorMessage?.length ? DHRE_DEFAULT.DH_SEMENTIC_ERROR : labelColor : DHRE_COLORS_TEXT.DH_BLACK
|
|
3467
3466
|
}
|
|
3468
3467
|
},
|
|
3469
3468
|
style: [
|
|
3470
|
-
errorMessage
|
|
3469
|
+
errorMessage ? styles$9.errorInput : styles$9.input,
|
|
3471
3470
|
inputStyle,
|
|
3472
3471
|
multiline && styles$9.multilineInput
|
|
3473
3472
|
// Apply multiline style if true
|
|
@@ -3477,7 +3476,7 @@ const CommonTextInput = (props) => {
|
|
|
3477
3476
|
placeholder: placeholderText,
|
|
3478
3477
|
editable,
|
|
3479
3478
|
pointerEvents,
|
|
3480
|
-
error: errorMessage?.length
|
|
3479
|
+
error: errorMessage?.length ? true : false,
|
|
3481
3480
|
multiline,
|
|
3482
3481
|
numberOfLines: multiline ? 4 : 1,
|
|
3483
3482
|
right: rightIcon ? /* @__PURE__ */ React__default["default"].createElement(
|
|
@@ -4013,6 +4012,11 @@ const styles$5 = reactNative.StyleSheet.create({
|
|
|
4013
4012
|
resendOTPStyle: {
|
|
4014
4013
|
alignSelf: "flex-end",
|
|
4015
4014
|
marginTop: verticalScale(8)
|
|
4015
|
+
},
|
|
4016
|
+
timerContainer: {
|
|
4017
|
+
flexDirection: "row",
|
|
4018
|
+
justifyContent: "space-between",
|
|
4019
|
+
marginTop: verticalScale(8)
|
|
4016
4020
|
}
|
|
4017
4021
|
});
|
|
4018
4022
|
|
|
@@ -4048,6 +4052,18 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4048
4052
|
{}
|
|
4049
4053
|
);
|
|
4050
4054
|
const { theme: theme$1 } = mode ? { theme: filteredTheme } : useTheme();
|
|
4055
|
+
const [timeLeft, setTimeLeft] = React.useState(60);
|
|
4056
|
+
React.useEffect(() => {
|
|
4057
|
+
let timer;
|
|
4058
|
+
if (!isResendOtpEnable && timeLeft > 0) {
|
|
4059
|
+
timer = setInterval(() => {
|
|
4060
|
+
setTimeLeft((prevTime) => prevTime - 1);
|
|
4061
|
+
}, 1e3);
|
|
4062
|
+
} else if (timeLeft === 0) {
|
|
4063
|
+
clearInterval(timer);
|
|
4064
|
+
}
|
|
4065
|
+
return () => clearInterval(timer);
|
|
4066
|
+
}, [timeLeft, isResendOtpEnable]);
|
|
4051
4067
|
const refs = React.useRef([]);
|
|
4052
4068
|
refs.current = Array(length).fill(0).map((_, index) => refs.current[index] || null);
|
|
4053
4069
|
React.useEffect(() => {
|
|
@@ -4055,7 +4071,9 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4055
4071
|
}, []);
|
|
4056
4072
|
const onClickResendOTP = () => {
|
|
4057
4073
|
if (resendOTPCount > maxResendCount - 1) {
|
|
4058
|
-
setErrorMessageMaxReachCount(
|
|
4074
|
+
setErrorMessageMaxReachCount(
|
|
4075
|
+
"You have exceeded the maximum number of attempts."
|
|
4076
|
+
);
|
|
4059
4077
|
}
|
|
4060
4078
|
if (resendOTPCount < maxResendCount) {
|
|
4061
4079
|
setIsResendOtpEnable(false);
|
|
@@ -4075,6 +4093,7 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4075
4093
|
const enableResendOtp = () => {
|
|
4076
4094
|
setTimeout(() => {
|
|
4077
4095
|
setIsResendOtpEnable(true);
|
|
4096
|
+
setTimeLeft(timerToResend / 1e3);
|
|
4078
4097
|
}, timerToResend);
|
|
4079
4098
|
};
|
|
4080
4099
|
React.useEffect(() => {
|
|
@@ -4173,7 +4192,16 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4173
4192
|
autoComplete: "sms-otp",
|
|
4174
4193
|
selectionColor: theme$1.CONTENT_PRIMARY
|
|
4175
4194
|
}
|
|
4176
|
-
))), !errorMessageMaxReachCount && /* @__PURE__ */ React__default["default"].createElement(
|
|
4195
|
+
))), !errorMessageMaxReachCount && /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$5.timerContainer }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4196
|
+
CustomTypography,
|
|
4197
|
+
{
|
|
4198
|
+
text: `${timeLeft} sec`,
|
|
4199
|
+
variant: FontStyle.L2_REGULAR,
|
|
4200
|
+
style: {
|
|
4201
|
+
...resendTextStyle
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
), /* @__PURE__ */ React__default["default"].createElement(
|
|
4177
4205
|
reactNative.Pressable,
|
|
4178
4206
|
{
|
|
4179
4207
|
onPress: onClickResendOTP,
|
|
@@ -4192,7 +4220,7 @@ const OTPInput = React__default["default"].forwardRef(
|
|
|
4192
4220
|
}
|
|
4193
4221
|
}
|
|
4194
4222
|
)
|
|
4195
|
-
), errorMessage ? /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$5.resendOtpContainer }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4223
|
+
)), errorMessage ? /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$5.resendOtpContainer }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4196
4224
|
CustomTypography,
|
|
4197
4225
|
{
|
|
4198
4226
|
text: errorMessage,
|