dhre-ui-kit 0.0.255 → 0.0.257
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 +20 -20
- package/lib/index.js +195 -195
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +195 -195
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ interface CustomTextProps extends TextProps {
|
|
|
18
18
|
style?: StyleProp<TextStyle>;
|
|
19
19
|
textColor?: string;
|
|
20
20
|
}
|
|
21
|
-
declare const _default$
|
|
21
|
+
declare const _default$l: (props: CustomTextProps) => React$1.JSX.Element;
|
|
22
22
|
|
|
23
23
|
interface BadgeProps {
|
|
24
24
|
text?: string;
|
|
@@ -28,7 +28,7 @@ interface BadgeProps {
|
|
|
28
28
|
iconStyle?: ViewStyle;
|
|
29
29
|
handleIconPress: () => void;
|
|
30
30
|
}
|
|
31
|
-
declare const _default$
|
|
31
|
+
declare const _default$k: (props: BadgeProps) => React$1.JSX.Element;
|
|
32
32
|
|
|
33
33
|
interface BottomDrawerProps {
|
|
34
34
|
isModalVisible: boolean;
|
|
@@ -74,7 +74,7 @@ interface CustomButtonProps {
|
|
|
74
74
|
isLoading?: boolean;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
declare const _default$
|
|
77
|
+
declare const _default$j: (props: CustomButtonProps) => React$1.JSX.Element;
|
|
78
78
|
|
|
79
79
|
interface CardsProps {
|
|
80
80
|
topLeftTitle?: string;
|
|
@@ -327,7 +327,7 @@ interface Props {
|
|
|
327
327
|
onSelectionChange?: (selected: string[]) => void;
|
|
328
328
|
style?: ViewStyle;
|
|
329
329
|
}
|
|
330
|
-
declare const _default$
|
|
330
|
+
declare const _default$i: (props: Props) => React$1.JSX.Element;
|
|
331
331
|
|
|
332
332
|
interface TagsProps {
|
|
333
333
|
tags: string[];
|
|
@@ -366,7 +366,7 @@ interface AccordionProps {
|
|
|
366
366
|
titleVariant?: string;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
declare const _default$
|
|
369
|
+
declare const _default$h: (props: AccordionProps) => React$1.JSX.Element;
|
|
370
370
|
|
|
371
371
|
interface ToastProps {
|
|
372
372
|
sucessIcon: React$1.ReactElement;
|
|
@@ -421,7 +421,7 @@ interface CustomHeaderProps {
|
|
|
421
421
|
onRightPress?: () => void;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
declare const _default$
|
|
424
|
+
declare const _default$g: (props: CustomHeaderProps) => React$1.JSX.Element;
|
|
425
425
|
|
|
426
426
|
interface ListItem {
|
|
427
427
|
id: string;
|
|
@@ -464,7 +464,7 @@ interface SwipableListProps {
|
|
|
464
464
|
titleStyle?: TextStyle;
|
|
465
465
|
}
|
|
466
466
|
|
|
467
|
-
declare const _default$
|
|
467
|
+
declare const _default$f: (props: SwipableListProps) => React$1.JSX.Element;
|
|
468
468
|
|
|
469
469
|
interface TypoTextProps extends TextProps {
|
|
470
470
|
variant: keyof typeof FONT_STYLES;
|
|
@@ -490,9 +490,9 @@ interface CustomLoaderProps {
|
|
|
490
490
|
loadingText?: string;
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
-
declare const _default$
|
|
493
|
+
declare const _default$e: (props: CustomLoaderProps) => React$1.JSX.Element;
|
|
494
494
|
|
|
495
|
-
declare const _default$
|
|
495
|
+
declare const _default$d: (props: {
|
|
496
496
|
backgroundColor?: string;
|
|
497
497
|
style?: ViewStyle;
|
|
498
498
|
}) => React$1.JSX.Element;
|
|
@@ -507,7 +507,7 @@ interface OurOfficesButtonProps$1 {
|
|
|
507
507
|
time?: string;
|
|
508
508
|
subTitleStyle?: TextStyle;
|
|
509
509
|
}
|
|
510
|
-
declare const _default$
|
|
510
|
+
declare const _default$c: (props: OurOfficesButtonProps$1) => React$1.JSX.Element;
|
|
511
511
|
|
|
512
512
|
interface ContactModalProps {
|
|
513
513
|
phoneNumber: string;
|
|
@@ -517,14 +517,14 @@ interface ContactModalProps {
|
|
|
517
517
|
data: string;
|
|
518
518
|
emailSubject: string;
|
|
519
519
|
}
|
|
520
|
-
declare const _default$
|
|
520
|
+
declare const _default$b: (props: ContactModalProps) => React$1.JSX.Element;
|
|
521
521
|
|
|
522
522
|
interface DateRangePickerProps extends CalendarProps {
|
|
523
523
|
onButtonPress: (startDate: string, endDate: string) => void;
|
|
524
524
|
btnTitle?: string;
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
-
declare const _default$
|
|
527
|
+
declare const _default$a: (props: DateRangePickerProps) => React$1.JSX.Element;
|
|
528
528
|
|
|
529
529
|
interface OurOfficesButtonProps {
|
|
530
530
|
leftIcon?: ReactElement<SvgProps>;
|
|
@@ -538,7 +538,7 @@ interface OurOfficesButtonProps {
|
|
|
538
538
|
titleColor?: string;
|
|
539
539
|
descriptionColor?: string;
|
|
540
540
|
}
|
|
541
|
-
declare const _default$
|
|
541
|
+
declare const _default$9: (props: OurOfficesButtonProps) => React$1.JSX.Element;
|
|
542
542
|
|
|
543
543
|
interface NotificationBandgeProps {
|
|
544
544
|
notificationCount?: number;
|
|
@@ -564,9 +564,9 @@ interface ScrollableListProps {
|
|
|
564
564
|
activeTab?: string;
|
|
565
565
|
errorStyle?: object;
|
|
566
566
|
}
|
|
567
|
-
declare const _default$
|
|
567
|
+
declare const _default$8: (props: ScrollableListProps) => React$1.JSX.Element;
|
|
568
568
|
|
|
569
|
-
declare const _default$
|
|
569
|
+
declare const _default$7: (props: {
|
|
570
570
|
title: string;
|
|
571
571
|
feedback: string;
|
|
572
572
|
inputText: string;
|
|
@@ -641,7 +641,7 @@ interface CustomDropdownProps {
|
|
|
641
641
|
selectedItemTextStyle?: TextStyle;
|
|
642
642
|
menuContainerStyle?: ViewStyle;
|
|
643
643
|
activeColor?: string;
|
|
644
|
-
renderRightIcon?: (visible?: boolean) => JSX.Element | null
|
|
644
|
+
renderRightIcon?: (visible?: boolean) => JSX.Element | null;
|
|
645
645
|
disable?: boolean;
|
|
646
646
|
}
|
|
647
647
|
declare const CustomDropdown: (props: CustomDropdownProps) => React$1.JSX.Element;
|
|
@@ -681,7 +681,7 @@ interface TagsComponentProps {
|
|
|
681
681
|
selectedTagButton?: ViewStyle;
|
|
682
682
|
unselectedTagButton?: ViewStyle;
|
|
683
683
|
}
|
|
684
|
-
declare const _default$
|
|
684
|
+
declare const _default$6: (props: TagsComponentProps) => React$1.JSX.Element;
|
|
685
685
|
|
|
686
686
|
interface CustomDocumentPickerProps {
|
|
687
687
|
onDocumentUpload: (base64: string, document?: DocumentPickerResponse) => void;
|
|
@@ -697,7 +697,7 @@ interface CustomDocumentPickerProps {
|
|
|
697
697
|
deleteIcon: React$1.ReactElement;
|
|
698
698
|
}
|
|
699
699
|
|
|
700
|
-
declare const _default$
|
|
700
|
+
declare const _default$5: (props: CustomDocumentPickerProps) => React$1.JSX.Element;
|
|
701
701
|
|
|
702
702
|
interface IProps$1 {
|
|
703
703
|
length?: number;
|
|
@@ -723,7 +723,7 @@ type OTPInputHandle = {
|
|
|
723
723
|
set?: (newOtp: string) => void;
|
|
724
724
|
};
|
|
725
725
|
|
|
726
|
-
declare const
|
|
726
|
+
declare const _default$4: (props: IProps$1 & React$1.RefAttributes<OTPInputHandle>) => React$1.JSX.Element;
|
|
727
727
|
|
|
728
728
|
type StatusType = 'Active' | 'Inactive' | 'Completed' | 'Rejected' | 'Count';
|
|
729
729
|
interface IData {
|
|
@@ -1128,4 +1128,4 @@ interface RadioButtonGroupProps {
|
|
|
1128
1128
|
|
|
1129
1129
|
declare const RadioButtonGroup: React$1.FC<RadioButtonGroupProps>;
|
|
1130
1130
|
|
|
1131
|
-
export { _default$
|
|
1131
|
+
export { _default$h as Accordion, _default$1 as AppointmentCard, _default$k as Badge, BottomDrawer, _default$j as Button, Cards, _default$8 as Category, Checkbox as CheckBox, _default$b as ContactModel, CountryDropDown as CountryPicker, _default$5 as CustomDocumentPicker, CustomDropdown$1 as CustomDropdown, _default$g as CustomHeader, type CustomHeaderProps, CustomIcon, _default$e as CustomLoader, CustomProgressBar, CustomSearchBar, _default$2 as CustomSlideButton, CustomSwitchBtn, _default$l as CustomText, CustomTextInput, CustomTooltip, CustomTypography, DHRE_COLORS_ALERT, DHRE_COLORS_BG, DHRE_COLORS_PRIMARY, DHRE_COLORS_SECONDARY, DHRE_COLORS_TEXT, DHRE_DEFAULT, _default$a as DateRangePicker, CustomDropdown as DropDown, FONT_STYLES, _default$7 as FeedbackForm, FileUpload, FontStyle, _default$d as Line, NotificationBandge, _default$4 as OTPInput, _default$9 as OurOfficesButton, PdfView, PopUp, _default as PropertyDetails, RadioButtonGroup, ShapeType, _default$6 as SingleSelectionTags, type SlideButtonHandle, Star as StarRating, _default$3 as Stepper, _default$f as SwipableList, _default$i as Tabs, Tags, TextDirectType, CommonTextInput as TextInput, Theme, Toast, type ToastRef, CustomSwitch as ToggleButton, ToggleButtonType, ToggleTextType, _default$c as Topic, copyToClipboard, theme as default, height, horizontalScale, moderateScale, toastService, verticalScale, width };
|
package/lib/index.js
CHANGED
|
@@ -3986,215 +3986,215 @@ const styles$5 = reactNative.StyleSheet.create({
|
|
|
3986
3986
|
}
|
|
3987
3987
|
});
|
|
3988
3988
|
|
|
3989
|
-
const
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
3989
|
+
const OTPInputComponent = ({
|
|
3990
|
+
length = 4,
|
|
3991
|
+
onComplete,
|
|
3992
|
+
resendOTP,
|
|
3993
|
+
errorMessage,
|
|
3994
|
+
testId = "",
|
|
3995
|
+
otpContainerStyle,
|
|
3996
|
+
otpHeaderTextStyle,
|
|
3997
|
+
textInputStyle,
|
|
3998
|
+
resendTextStyle,
|
|
3999
|
+
resendOtpColor,
|
|
4000
|
+
label = "OTP",
|
|
4001
|
+
resendText = "Resend OTP",
|
|
4002
|
+
mode,
|
|
4003
|
+
disabled,
|
|
4004
|
+
maxResendCount = 2,
|
|
4005
|
+
timerToResend = 6e4,
|
|
4006
|
+
timerIcon
|
|
4007
|
+
}, ref) => {
|
|
4008
|
+
const [otp, setOTP] = React.useState("");
|
|
4009
|
+
const [isResendOtpEnable, setIsResendOtpEnable] = React.useState(false);
|
|
4010
|
+
const [activeInput, setActiveInput] = React.useState(null);
|
|
4011
|
+
const [resendOTPCount, setResendOTPCount] = React.useState(0);
|
|
4012
|
+
const [errorMessageMaxReachCount, setErrorMessageMaxReachCount] = React.useState("");
|
|
4013
|
+
const filteredTheme = mode ? theme[mode] : theme;
|
|
4014
|
+
const { theme: theme$1 } = useTheme() || { theme: filteredTheme };
|
|
4015
|
+
const [timeLeft, setTimeLeft] = React.useState(60);
|
|
4016
|
+
React.useEffect(() => {
|
|
4017
|
+
let timer;
|
|
4018
|
+
if (!isResendOtpEnable && timeLeft > 0) {
|
|
4019
|
+
timer = setInterval(() => {
|
|
4020
|
+
setTimeLeft((prevTime) => prevTime - 1);
|
|
4021
|
+
}, 1e3);
|
|
4022
|
+
} else if (timeLeft === 0) {
|
|
4023
|
+
clearInterval(timer);
|
|
4024
|
+
}
|
|
4025
|
+
return () => clearInterval(timer);
|
|
4026
|
+
}, [timeLeft, isResendOtpEnable]);
|
|
4027
|
+
const otpRefs = React.useRef(Array(length).fill(null));
|
|
4028
|
+
React.useEffect(() => {
|
|
4029
|
+
enableResendOtp();
|
|
4030
|
+
}, []);
|
|
4031
|
+
const onClickResendOTP = () => {
|
|
4032
|
+
if (resendOTPCount > maxResendCount - 1) {
|
|
4033
|
+
setErrorMessageMaxReachCount(
|
|
4034
|
+
"You have exceeded the maximum number of attempts."
|
|
4035
|
+
);
|
|
4036
|
+
}
|
|
4037
|
+
if (resendOTPCount < maxResendCount) {
|
|
4038
|
+
setIsResendOtpEnable(false);
|
|
4039
|
+
setResendOTPCount(resendOTPCount + 1);
|
|
4030
4040
|
enableResendOtp();
|
|
4031
|
-
|
|
4032
|
-
const onClickResendOTP = () => {
|
|
4033
|
-
if (resendOTPCount > maxResendCount - 1) {
|
|
4034
|
-
setErrorMessageMaxReachCount(
|
|
4035
|
-
"You have exceeded the maximum number of attempts."
|
|
4036
|
-
);
|
|
4037
|
-
}
|
|
4038
|
-
if (resendOTPCount < maxResendCount) {
|
|
4039
|
-
setIsResendOtpEnable(false);
|
|
4040
|
-
setResendOTPCount(resendOTPCount + 1);
|
|
4041
|
-
enableResendOtp();
|
|
4042
|
-
resendOTP?.();
|
|
4043
|
-
setOTP("");
|
|
4044
|
-
}
|
|
4045
|
-
};
|
|
4046
|
-
const disableResendButton = () => {
|
|
4047
|
-
return disabled || resendOTPCount >= maxResendCount;
|
|
4048
|
-
};
|
|
4049
|
-
const enableResendOtp = () => {
|
|
4050
|
-
setTimeout(() => {
|
|
4051
|
-
setIsResendOtpEnable(true);
|
|
4052
|
-
setTimeLeft(timerToResend / 1e3);
|
|
4053
|
-
}, timerToResend);
|
|
4054
|
-
};
|
|
4055
|
-
React.useEffect(() => {
|
|
4056
|
-
if (reactNative.Platform.OS === "android") {
|
|
4057
|
-
onStartListeningOtp();
|
|
4058
|
-
}
|
|
4059
|
-
return () => {
|
|
4060
|
-
if (reactNative.Platform.OS === "android") {
|
|
4061
|
-
OTPVerify__default["default"].removeListener();
|
|
4062
|
-
OTPVerify.removeListener();
|
|
4063
|
-
}
|
|
4064
|
-
};
|
|
4065
|
-
}, []);
|
|
4066
|
-
const onStartListeningOtp = async () => {
|
|
4067
|
-
await OTPVerify__default["default"].getOtp();
|
|
4068
|
-
OTPVerify.startOtpListener((message) => {
|
|
4069
|
-
const otpRegex = new RegExp(`(\\d{${length}})`, "g");
|
|
4070
|
-
const otp2 = otpRegex.exec(message)?.[1];
|
|
4071
|
-
setOTP(otp2 ?? "");
|
|
4072
|
-
if (otp2) {
|
|
4073
|
-
otpRefs.current[otp2?.length - 1]?.focus();
|
|
4074
|
-
}
|
|
4075
|
-
});
|
|
4076
|
-
};
|
|
4077
|
-
const reset = () => {
|
|
4041
|
+
resendOTP?.();
|
|
4078
4042
|
setOTP("");
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
const newOTP = otp.slice(0, -1);
|
|
4099
|
-
setOTP(newOTP);
|
|
4100
|
-
otpRefs.current[index]?.focus();
|
|
4101
|
-
}
|
|
4102
|
-
};
|
|
4103
|
-
const handleKeyPress = (e, index) => {
|
|
4104
|
-
if (e.nativeEvent.key === "Backspace" && index > 0) {
|
|
4105
|
-
otpRefs.current[index - 1]?.focus();
|
|
4043
|
+
}
|
|
4044
|
+
};
|
|
4045
|
+
const disableResendButton = () => {
|
|
4046
|
+
return disabled || resendOTPCount >= maxResendCount;
|
|
4047
|
+
};
|
|
4048
|
+
const enableResendOtp = () => {
|
|
4049
|
+
setTimeout(() => {
|
|
4050
|
+
setIsResendOtpEnable(true);
|
|
4051
|
+
setTimeLeft(timerToResend / 1e3);
|
|
4052
|
+
}, timerToResend);
|
|
4053
|
+
};
|
|
4054
|
+
React.useEffect(() => {
|
|
4055
|
+
if (reactNative.Platform.OS === "android") {
|
|
4056
|
+
onStartListeningOtp();
|
|
4057
|
+
}
|
|
4058
|
+
return () => {
|
|
4059
|
+
if (reactNative.Platform.OS === "android") {
|
|
4060
|
+
OTPVerify__default["default"].removeListener();
|
|
4061
|
+
OTPVerify.removeListener();
|
|
4106
4062
|
}
|
|
4107
4063
|
};
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
{
|
|
4116
|
-
|
|
4117
|
-
variant: FontStyle.B4_REGULAR,
|
|
4118
|
-
style: {
|
|
4119
|
-
color: otp?.length ? theme$1.CONTENT_PRIMARY : theme$1.CONTENT_SECONDRY,
|
|
4120
|
-
textAlign: "left",
|
|
4121
|
-
...otpHeaderTextStyle
|
|
4122
|
-
}
|
|
4123
|
-
}
|
|
4124
|
-
), /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: { ...styles$5.textInputContainer } }, Array.from({ length }).map((_, index) => /* @__PURE__ */ React__default["default"].createElement(
|
|
4125
|
-
reactNative.TextInput,
|
|
4126
|
-
{
|
|
4127
|
-
key: index?.toString(),
|
|
4128
|
-
style: {
|
|
4129
|
-
...styles$5.textInputStyle,
|
|
4130
|
-
color: theme$1.CONTENT_PRIMARY,
|
|
4131
|
-
borderColor: errorMessage ? theme$1.ERROR : otp.length === length ? theme$1.SUCCESS : activeInput === index ? theme$1.BORDER_INVERTED : theme$1.BORDER_PRIMARY,
|
|
4132
|
-
...textInputStyle
|
|
4133
|
-
},
|
|
4134
|
-
onFocus: () => setActiveInput(index),
|
|
4135
|
-
onBlur: () => setActiveInput(null),
|
|
4136
|
-
onKeyPress: (e) => handleKeyPress(e, index),
|
|
4137
|
-
onChangeText: (text) => handleChange(index, text),
|
|
4138
|
-
value: otp[index] ? "\u25CF" : "",
|
|
4139
|
-
placeholder: "",
|
|
4140
|
-
keyboardType: "numeric",
|
|
4141
|
-
ref: (el) => otpRefs.current[index] = el,
|
|
4142
|
-
returnKeyType: otp.length === length ? "done" : "next",
|
|
4143
|
-
importantForAutofill: "yes",
|
|
4144
|
-
textContentType: "oneTimeCode",
|
|
4145
|
-
autoComplete: "sms-otp",
|
|
4146
|
-
selectionColor: theme$1.CONTENT_PRIMARY
|
|
4064
|
+
}, []);
|
|
4065
|
+
const onStartListeningOtp = async () => {
|
|
4066
|
+
await OTPVerify__default["default"].getOtp();
|
|
4067
|
+
OTPVerify.startOtpListener((message) => {
|
|
4068
|
+
const otpRegex = new RegExp(`(\\d{${length}})`, "g");
|
|
4069
|
+
const otp2 = otpRegex.exec(message)?.[1];
|
|
4070
|
+
setOTP(otp2 ?? "");
|
|
4071
|
+
if (otp2) {
|
|
4072
|
+
otpRefs.current[otp2?.length - 1]?.focus();
|
|
4147
4073
|
}
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4074
|
+
});
|
|
4075
|
+
};
|
|
4076
|
+
const reset = () => {
|
|
4077
|
+
setOTP("");
|
|
4078
|
+
otpRefs.current[0]?.focus();
|
|
4079
|
+
};
|
|
4080
|
+
React__default["default"].useImperativeHandle(ref, () => ({
|
|
4081
|
+
reset
|
|
4082
|
+
}));
|
|
4083
|
+
const handleChange = (index, value) => {
|
|
4084
|
+
const regex = /^\d+$/;
|
|
4085
|
+
if (value.length === 1 && regex.test(value) && index >= 0 && index < length) {
|
|
4086
|
+
const newOTP = `${otp}${value}`;
|
|
4087
|
+
setOTP(newOTP);
|
|
4088
|
+
otpRefs.current[index + 1]?.focus();
|
|
4089
|
+
} else if (value.length === 0 && index > 0) {
|
|
4090
|
+
const newOTP = otp.slice(0, -1);
|
|
4091
|
+
setOTP(newOTP);
|
|
4092
|
+
otpRefs.current[index - 1]?.focus();
|
|
4093
|
+
} else if (value?.length === length) {
|
|
4094
|
+
setOTP(value);
|
|
4095
|
+
otpRefs.current[length - 1]?.focus();
|
|
4096
|
+
} else {
|
|
4097
|
+
const newOTP = otp.slice(0, -1);
|
|
4098
|
+
setOTP(newOTP);
|
|
4099
|
+
otpRefs.current[index]?.focus();
|
|
4100
|
+
}
|
|
4101
|
+
};
|
|
4102
|
+
const handleKeyPress = (e, index) => {
|
|
4103
|
+
if (e.nativeEvent.key === "Backspace" && index > 0) {
|
|
4104
|
+
otpRefs.current[index - 1]?.focus();
|
|
4105
|
+
}
|
|
4106
|
+
};
|
|
4107
|
+
React.useEffect(() => {
|
|
4108
|
+
if (otp.length === length) {
|
|
4109
|
+
onComplete?.(otp);
|
|
4110
|
+
}
|
|
4111
|
+
}, [otp]);
|
|
4112
|
+
return /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: { ...otpContainerStyle }, "data-testid": testId }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4113
|
+
CustomTypography,
|
|
4114
|
+
{
|
|
4115
|
+
text: label,
|
|
4116
|
+
variant: FontStyle.B4_REGULAR,
|
|
4117
|
+
style: {
|
|
4118
|
+
color: otp?.length ? theme$1.CONTENT_PRIMARY : theme$1.CONTENT_SECONDRY,
|
|
4119
|
+
textAlign: "left",
|
|
4120
|
+
...otpHeaderTextStyle
|
|
4154
4121
|
}
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4122
|
+
}
|
|
4123
|
+
), /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: { ...styles$5.textInputContainer } }, Array.from({ length }).map((_, index) => /* @__PURE__ */ React__default["default"].createElement(
|
|
4124
|
+
reactNative.TextInput,
|
|
4125
|
+
{
|
|
4126
|
+
key: index?.toString(),
|
|
4127
|
+
style: {
|
|
4128
|
+
...styles$5.textInputStyle,
|
|
4129
|
+
color: theme$1.CONTENT_PRIMARY,
|
|
4130
|
+
borderColor: errorMessage ? theme$1.ERROR : otp.length === length ? theme$1.SUCCESS : activeInput === index ? theme$1.BORDER_INVERTED : theme$1.BORDER_PRIMARY,
|
|
4131
|
+
...textInputStyle
|
|
4161
4132
|
},
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4133
|
+
onFocus: () => setActiveInput(index),
|
|
4134
|
+
onBlur: () => setActiveInput(null),
|
|
4135
|
+
onKeyPress: (e) => handleKeyPress(e, index),
|
|
4136
|
+
onChangeText: (text) => handleChange(index, text),
|
|
4137
|
+
value: otp[index] ? "\u25CF" : "",
|
|
4138
|
+
placeholder: "",
|
|
4139
|
+
keyboardType: "numeric",
|
|
4140
|
+
ref: (el) => otpRefs.current[index] = el,
|
|
4141
|
+
returnKeyType: otp.length === length ? "done" : "next",
|
|
4142
|
+
importantForAutofill: "yes",
|
|
4143
|
+
textContentType: "oneTimeCode",
|
|
4144
|
+
autoComplete: "sms-otp",
|
|
4145
|
+
selectionColor: theme$1.CONTENT_PRIMARY
|
|
4146
|
+
}
|
|
4147
|
+
))), !errorMessageMaxReachCount && /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$5.timerContainer }, (disableResendButton() || !isResendOtpEnable) && /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$5.timerIconContainer }, timerIcon, /* @__PURE__ */ React__default["default"].createElement(
|
|
4148
|
+
CustomTypography,
|
|
4149
|
+
{
|
|
4150
|
+
text: `00:${timeLeft} secs`,
|
|
4151
|
+
variant: FontStyle.L1_REGULAR,
|
|
4152
|
+
style: { color: theme$1.INFO }
|
|
4153
|
+
}
|
|
4154
|
+
)), /* @__PURE__ */ React__default["default"].createElement(
|
|
4155
|
+
reactNative.Pressable,
|
|
4156
|
+
{
|
|
4157
|
+
onPress: onClickResendOTP,
|
|
4158
|
+
style: styles$5.resendOTPStyle,
|
|
4159
|
+
disabled: disableResendButton() || !isResendOtpEnable
|
|
4160
|
+
},
|
|
4161
|
+
/* @__PURE__ */ React__default["default"].createElement(
|
|
4175
4162
|
CustomTypography,
|
|
4176
4163
|
{
|
|
4177
|
-
text:
|
|
4164
|
+
text: resendText,
|
|
4178
4165
|
variant: FontStyle.L2_REGULAR,
|
|
4179
4166
|
style: {
|
|
4180
|
-
|
|
4181
|
-
color: theme$1.
|
|
4167
|
+
textDecorationLine: "underline",
|
|
4168
|
+
color: isResendOtpEnable ? resendOtpColor ?? theme$1.CONTENT_PRIMARY : theme$1.CONTENT_DISABLE,
|
|
4169
|
+
...resendTextStyle
|
|
4182
4170
|
}
|
|
4183
4171
|
}
|
|
4184
|
-
)
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4172
|
+
)
|
|
4173
|
+
)), errorMessage ? /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$5.resendOtpContainer }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4174
|
+
CustomTypography,
|
|
4175
|
+
{
|
|
4176
|
+
text: errorMessage,
|
|
4177
|
+
variant: FontStyle.L2_REGULAR,
|
|
4178
|
+
style: {
|
|
4179
|
+
alignSelf: "flex-start",
|
|
4180
|
+
color: theme$1.ERROR
|
|
4193
4181
|
}
|
|
4194
|
-
|
|
4195
|
-
}
|
|
4196
|
-
|
|
4182
|
+
}
|
|
4183
|
+
)) : null, errorMessageMaxReachCount ? /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$5.resendOtpContainer }, /* @__PURE__ */ React__default["default"].createElement(
|
|
4184
|
+
CustomTypography,
|
|
4185
|
+
{
|
|
4186
|
+
text: errorMessageMaxReachCount,
|
|
4187
|
+
variant: FontStyle.L2_REGULAR,
|
|
4188
|
+
style: {
|
|
4189
|
+
alignSelf: "flex-start",
|
|
4190
|
+
color: theme$1.ERROR
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4193
|
+
)) : null);
|
|
4194
|
+
};
|
|
4195
|
+
const OTPInput = React__default["default"].forwardRef(OTPInputComponent);
|
|
4197
4196
|
OTPInput.displayName = "OTPInput";
|
|
4197
|
+
var index$4 = withThemeProvider(OTPInput);
|
|
4198
4198
|
|
|
4199
4199
|
const styles$4 = reactNative.StyleSheet.create({
|
|
4200
4200
|
stepperContainer: {
|
|
@@ -4971,7 +4971,7 @@ exports.FileUpload = FileUpload;
|
|
|
4971
4971
|
exports.FontStyle = FontStyle;
|
|
4972
4972
|
exports.Line = Line;
|
|
4973
4973
|
exports.NotificationBandge = NotificationBandge;
|
|
4974
|
-
exports.OTPInput =
|
|
4974
|
+
exports.OTPInput = index$4;
|
|
4975
4975
|
exports.OurOfficesButton = OurOffices;
|
|
4976
4976
|
exports.PdfView = PdfView;
|
|
4977
4977
|
exports.PopUp = PopUp;
|