dhre-ui-kit 0.0.95 → 0.0.96
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/{src/assets/index.ts → lib/assets/index.d.ts} +1 -18
- package/lib/index.d.ts +862 -0
- package/lib/index.esm.js +2 -0
- package/lib/index.esm.js.map +1 -0
- package/lib/index.js +4333 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +4248 -0
- package/lib/index.mjs.map +1 -0
- package/lib/theme/ThemeContext.d.ts +10 -0
- package/lib/theme/colors.d.ts +166 -0
- package/lib/theme/fonts.d.ts +8 -0
- package/lib/theme/themes.d.ts +131 -0
- package/lib/theme/withThemeProvider.d.ts +2 -0
- package/lib/utils/appEnum.d.ts +90 -0
- package/lib/utils/commonStyles.d.ts +15 -0
- package/lib/utils/constants.d.ts +19 -0
- package/lib/utils/deviceUtils.d.ts +7 -0
- package/lib/utils/regex.d.ts +1 -0
- package/lib/utils/stylehelper.d.ts +5 -0
- package/package.json +61 -81
- package/README.md +0 -1
- package/__mocks__/custom-text.mock.tsx +0 -19
- package/__mocks__/setup-tests.ts +0 -24
- package/__mocks__/svgMock.ts +0 -2
- package/src/App.tsx +0 -43
- package/src/assets/fonts/MeraasAktiv_Bd.ttf +0 -0
- package/src/assets/fonts/MeraasAktiv_Lt.ttf +0 -0
- package/src/assets/fonts/MeraasAktiv_Rg.ttf +0 -0
- package/src/assets/images/arrowLeft.svg +0 -3
- package/src/assets/images/bellSimple.svg +0 -3
- package/src/assets/images/calenderDots.svg +0 -1
- package/src/assets/images/caretDown.svg +0 -3
- package/src/assets/images/caretLeft.svg +0 -3
- package/src/assets/images/caretRight.svg +0 -3
- package/src/assets/images/caretUp.svg +0 -3
- package/src/assets/images/checkWhite.svg +0 -3
- package/src/assets/images/circleTick.svg +0 -3
- package/src/assets/images/crossIcon.svg +0 -3
- package/src/assets/images/dotsThreeVertical.svg +0 -5
- package/src/assets/images/fileIcon.svg +0 -8
- package/src/assets/images/searchIcon.svg +0 -4
- package/src/assets/images/trash.svg +0 -7
- package/src/assets/images/uploadFileIcon.svg +0 -12
- package/src/components/ContactModel/ContactModel.tsx +0 -206
- package/src/components/ContactModel/index.ts +0 -1
- package/src/components/OutOfOffice/OurOffices.tsx +0 -91
- package/src/components/OutOfOffice/index.ts +0 -1
- package/src/components/accordion/Accordion.interface.ts +0 -16
- package/src/components/accordion/Accordion.styles.ts +0 -28
- package/src/components/accordion/Accordion.test.tsx +0 -21
- package/src/components/accordion/Accordion.tsx +0 -85
- package/src/components/accordion/index.ts +0 -1
- package/src/components/autoOtpReader/AutoOtpReader.test.tsx +0 -56
- package/src/components/autoOtpReader/AutoOtpReader.tsx +0 -79
- package/src/components/autoOtpReader/index.ts +0 -1
- package/src/components/badge/Badge.styles.ts +0 -20
- package/src/components/badge/Badge.test.tsx +0 -57
- package/src/components/badge/Badge.tsx +0 -48
- package/src/components/badge/index.ts +0 -1
- package/src/components/bottomDrawer/BottomDrawer.interface.ts +0 -23
- package/src/components/bottomDrawer/BottomDrawer.styles.ts +0 -47
- package/src/components/bottomDrawer/BottomDrawer.test.tsx +0 -19
- package/src/components/bottomDrawer/BottomDrawer.tsx +0 -92
- package/src/components/bottomDrawer/index.ts +0 -1
- package/src/components/button/Button.interface.ts +0 -19
- package/src/components/button/Button.styles.ts +0 -78
- package/src/components/button/Button.test.tsx +0 -43
- package/src/components/button/Button.tsx +0 -82
- package/src/components/button/index.ts +0 -1
- package/src/components/cards/Cards.interface.ts +0 -13
- package/src/components/cards/Cards.styles.ts +0 -59
- package/src/components/cards/Cards.test.tsx +0 -41
- package/src/components/cards/Cards.tsx +0 -69
- package/src/components/cards/index.ts +0 -1
- package/src/components/checkBox/CheckBox.interface.ts +0 -15
- package/src/components/checkBox/CheckBox.styles.ts +0 -35
- package/src/components/checkBox/CheckBox.test.tsx +0 -46
- package/src/components/checkBox/CheckBox.tsx +0 -50
- package/src/components/checkBox/index.ts +0 -1
- package/src/components/countryPicker/CountryPicker.tsx +0 -169
- package/src/components/countryPicker/index.ts +0 -1
- package/src/components/customDocumentPicker/CustomDocumentPicker.interface.ts +0 -13
- package/src/components/customDocumentPicker/CustomDocumentPicker.styles.ts +0 -33
- package/src/components/customDocumentPicker/CustomDocumentPicker.tsx +0 -100
- package/src/components/customDocumentPicker/index.ts +0 -1
- package/src/components/customDropdown/CustomDropdown.interface.ts +0 -15
- package/src/components/customDropdown/CustomDropdown.styles.tsx +0 -46
- package/src/components/customDropdown/CustomDropdown.test.tsx +0 -30
- package/src/components/customDropdown/CustomDropdown.tsx +0 -106
- package/src/components/customDropdown/index.ts +0 -1
- package/src/components/customHeader/CustomHeader.interface.tsx +0 -10
- package/src/components/customHeader/CustomHeader.styles.ts +0 -26
- package/src/components/customHeader/CustomHeader.test.tsx +0 -14
- package/src/components/customHeader/CustomHeader.tsx +0 -46
- package/src/components/customHeader/index.ts +0 -1
- package/src/components/customIcon/CustomIcon.interface.ts +0 -12
- package/src/components/customIcon/CustomIcon.styles.ts +0 -13
- package/src/components/customIcon/CustomIcon.test.tsx +0 -14
- package/src/components/customIcon/CustomIcon.tsx +0 -33
- package/src/components/customIcon/index.ts +0 -1
- package/src/components/customInputText/CustomInputText.interface.ts +0 -20
- package/src/components/customInputText/CustomInputText.styles.ts +0 -56
- package/src/components/customInputText/CustomInputText.test.tsx +0 -37
- package/src/components/customInputText/CustomInputText.tsx +0 -120
- package/src/components/customInputText/index.ts +0 -1
- package/src/components/customLoader/CustomLoader.inteface.ts +0 -3
- package/src/components/customLoader/CustomLoader.styles.ts +0 -16
- package/src/components/customLoader/CustomLoader.tsx +0 -16
- package/src/components/customLoader/index.ts +0 -1
- package/src/components/customSearchBar/CustomSearchBar.interface.ts +0 -21
- package/src/components/customSearchBar/CustomSearchBar.styles.ts +0 -23
- package/src/components/customSearchBar/CustomSearchBar.test.tsx +0 -27
- package/src/components/customSearchBar/CustomSearchBar.tsx +0 -87
- package/src/components/customSearchBar/index.ts +0 -1
- package/src/components/customSlideButton/custom-slide-button.interface.ts +0 -4
- package/src/components/customSlideButton/index.tsx +0 -78
- package/src/components/customSlideButton/styles.ts +0 -39
- package/src/components/customSwitchBtn/customSwitchBtn.interface.ts +0 -15
- package/src/components/customSwitchBtn/customSwitchBtn.styles.ts +0 -34
- package/src/components/customSwitchBtn/customSwitchBtn.tsx +0 -63
- package/src/components/customSwitchBtn/index.ts +0 -1
- package/src/components/customText/CustomText.tsx +0 -33
- package/src/components/customText/index.ts +0 -1
- package/src/components/customTooltip/CustomTooltip.interface.ts +0 -14
- package/src/components/customTooltip/CustomTooltip.styles.ts +0 -23
- package/src/components/customTooltip/CustomTooltip.test.tsx +0 -18
- package/src/components/customTooltip/CustomTooltip.tsx +0 -46
- package/src/components/customTooltip/index.ts +0 -1
- package/src/components/customTypography/CustomTypography.test.tsx +0 -12
- package/src/components/customTypography/CustomTypography.tsx +0 -27
- package/src/components/customTypography/index.ts +0 -1
- package/src/components/dateRangePicker/DateRangePicker.interface.ts +0 -19
- package/src/components/dateRangePicker/DateRangePicker.styles.ts +0 -19
- package/src/components/dateRangePicker/DateRangePicker.tsx +0 -108
- package/src/components/dateRangePicker/index.ts +0 -1
- package/src/components/dropDown/DropDown.tsx +0 -145
- package/src/components/dropDown/index.ts +0 -1
- package/src/components/feedback/feedback.style.ts +0 -48
- package/src/components/feedback/feedback.tsx +0 -61
- package/src/components/feedback/index.ts +0 -1
- package/src/components/fileUpload/FileUpload.styles.ts +0 -41
- package/src/components/fileUpload/FileUpload.test.tsx +0 -39
- package/src/components/fileUpload/FileUpload.tsx +0 -65
- package/src/components/fileUpload/index.ts +0 -1
- package/src/components/horizontalLine/Line.tsx +0 -26
- package/src/components/horizontalLine/index.ts +0 -1
- package/src/components/notificationBandge/NotificationBandge.interface.tsx +0 -3
- package/src/components/notificationBandge/NotificationBandge.styles.tsx +0 -26
- package/src/components/notificationBandge/NotificationBandge.tsx +0 -26
- package/src/components/notificationBandge/index.tsx +0 -1
- package/src/components/otp/index.tsx +0 -166
- package/src/components/otp/otp.interface.ts +0 -14
- package/src/components/otp/styles.ts +0 -29
- package/src/components/pdfView/PdfView.test.tsx +0 -12
- package/src/components/pdfView/PdfView.tsx +0 -8
- package/src/components/pdfView/index.ts +0 -1
- package/src/components/popup/PopUp.interface.ts +0 -9
- package/src/components/popup/PopUp.styles.ts +0 -52
- package/src/components/popup/PopUp.test.tsx +0 -35
- package/src/components/popup/PopUp.tsx +0 -60
- package/src/components/popup/index.ts +0 -1
- package/src/components/progressBar/ProgressBar.test.tsx +0 -78
- package/src/components/progressBar/ProgressBar.tsx +0 -120
- package/src/components/progressBar/index.ts +0 -1
- package/src/components/property360View/Property360View.test.tsx +0 -24
- package/src/components/property360View/Property360View.tsx +0 -19
- package/src/components/property360View/index.ts +0 -1
- package/src/components/rating/index.ts +0 -1
- package/src/components/rating/rating.styles.ts +0 -13
- package/src/components/rating/rating.test.tsx +0 -61
- package/src/components/rating/rating.tsx +0 -96
- package/src/components/scrollList/category.tsx +0 -110
- package/src/components/scrollList/index.ts +0 -1
- package/src/components/singleSelectionTag/TagSingleSelection.tsx +0 -105
- package/src/components/singleSelectionTag/index.ts +0 -1
- package/src/components/stepper/index.tsx +0 -105
- package/src/components/stepper/stepper.interface.ts +0 -24
- package/src/components/stepper/styles.ts +0 -74
- package/src/components/swipableList/SwipableList.interface.ts +0 -52
- package/src/components/swipableList/SwipableList.styles.ts +0 -30
- package/src/components/swipableList/SwipableList.test.tsx +0 -209
- package/src/components/swipableList/SwipableList.tsx +0 -137
- package/src/components/swipableList/index.ts +0 -1
- package/src/components/tabs/Tabs.interface.ts +0 -10
- package/src/components/tabs/Tabs.styles.ts +0 -24
- package/src/components/tabs/Tabs.tsx +0 -74
- package/src/components/tabs/index.ts +0 -1
- package/src/components/tags/Tags.interface.ts +0 -12
- package/src/components/tags/Tags.styles.ts +0 -36
- package/src/components/tags/Tags.test.tsx +0 -22
- package/src/components/tags/Tags.tsx +0 -76
- package/src/components/tags/index.ts +0 -1
- package/src/components/textInput/Textinput.tsx +0 -120
- package/src/components/textInput/index.ts +0 -1
- package/src/components/toast/Toast.interface.ts +0 -39
- package/src/components/toast/Toast.styles.ts +0 -41
- package/src/components/toast/Toast.test.tsx +0 -13
- package/src/components/toast/Toast.tsx +0 -115
- package/src/components/toast/ToastService.ts +0 -30
- package/src/components/toast/index.ts +0 -1
- package/src/components/toggleButton/ToggleButton.styles.ts +0 -40
- package/src/components/toggleButton/ToggleButton.test.tsx +0 -33
- package/src/components/toggleButton/ToggleButton.tsx +0 -78
- package/src/components/toggleButton/index.ts +0 -1
- package/src/components/topic/Topic.tsx +0 -85
- package/src/components/topic/index.ts +0 -1
- package/src/index.ts +0 -59
- package/src/theme/ThemeContext.tsx +0 -38
- package/src/theme/colors.ts +0 -186
- package/src/theme/fonts.ts +0 -72
- package/src/theme/themes.ts +0 -137
- package/src/theme/withThemeProvider.tsx +0 -14
- package/src/utils/appEnum.ts +0 -109
- package/src/utils/commonStyles.ts +0 -17
- package/src/utils/constants.ts +0 -20
- package/src/utils/deviceUtils.ts +0 -14
- package/src/utils/regex.ts +0 -1
- package/src/utils/stylehelper.ts +0 -13
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {Pressable, StyleSheet, ViewStyle} from 'react-native';
|
|
3
|
-
import {TextInput} from 'react-native-paper';
|
|
4
|
-
import {DHRE_COLORS_TEXT, DHRE_DEFAULT} from '../../theme/colors';
|
|
5
|
-
import {verticalScale, moderateScale} from '../../utils/stylehelper';
|
|
6
|
-
import CustomTypography from '../customTypography';
|
|
7
|
-
import theme from '../../theme/themes';
|
|
8
|
-
|
|
9
|
-
interface CommonTextInputProps {
|
|
10
|
-
label: string;
|
|
11
|
-
value?: string;
|
|
12
|
-
onChangeText: (text: string) => void;
|
|
13
|
-
placeholderText?: string;
|
|
14
|
-
isSecureTextEntry?: boolean;
|
|
15
|
-
activeBorderColor?: string;
|
|
16
|
-
inactiveBorderColor?: string;
|
|
17
|
-
borderRadius?: number;
|
|
18
|
-
inputStyle?: ViewStyle;
|
|
19
|
-
keyboardType?: 'default' | 'numeric' | 'email-address' | 'phone-pad';
|
|
20
|
-
maxLength?: number;
|
|
21
|
-
errorMessage?: string;
|
|
22
|
-
editable?: boolean;
|
|
23
|
-
textColor?: string;
|
|
24
|
-
labelColor?: string;
|
|
25
|
-
pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto' | undefined;
|
|
26
|
-
handlePress?: () => void;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const CommonTextInput: React.FC<CommonTextInputProps> = ({
|
|
30
|
-
label,
|
|
31
|
-
value,
|
|
32
|
-
onChangeText,
|
|
33
|
-
isSecureTextEntry = false,
|
|
34
|
-
keyboardType = 'default',
|
|
35
|
-
placeholderText,
|
|
36
|
-
activeBorderColor = theme.CONTENT_PRIMARY['light'],
|
|
37
|
-
inactiveBorderColor = theme.BORDER_PRIMARY['light'],
|
|
38
|
-
inputStyle,
|
|
39
|
-
maxLength,
|
|
40
|
-
errorMessage,
|
|
41
|
-
editable = true,
|
|
42
|
-
textColor = theme.CONTENT_PRIMARY['light'],
|
|
43
|
-
labelColor,
|
|
44
|
-
handlePress,
|
|
45
|
-
pointerEvents,
|
|
46
|
-
}) => {
|
|
47
|
-
return (
|
|
48
|
-
<Pressable onPress={handlePress} style={styles.container}>
|
|
49
|
-
<TextInput
|
|
50
|
-
mode="outlined"
|
|
51
|
-
outlineStyle={{
|
|
52
|
-
...styles.outlineStyle,
|
|
53
|
-
borderColor: value?.length
|
|
54
|
-
? activeBorderColor
|
|
55
|
-
: inactiveBorderColor,
|
|
56
|
-
}}
|
|
57
|
-
label={label}
|
|
58
|
-
value={value}
|
|
59
|
-
onChangeText={onChangeText}
|
|
60
|
-
secureTextEntry={isSecureTextEntry}
|
|
61
|
-
keyboardType={keyboardType}
|
|
62
|
-
theme={{
|
|
63
|
-
colors: {
|
|
64
|
-
primary: labelColor ? labelColor : DHRE_COLORS_TEXT.DH_BLACK,
|
|
65
|
-
},
|
|
66
|
-
}}
|
|
67
|
-
style={[errorMessage ? styles.errorInput : styles.input, inputStyle]}
|
|
68
|
-
maxLength={maxLength}
|
|
69
|
-
textColor={textColor}
|
|
70
|
-
placeholder={placeholderText}
|
|
71
|
-
editable={editable}
|
|
72
|
-
pointerEvents={pointerEvents}
|
|
73
|
-
/>
|
|
74
|
-
{errorMessage ? (
|
|
75
|
-
<CustomTypography
|
|
76
|
-
variant={'L2_REGULAR'}
|
|
77
|
-
text={errorMessage ?? ''}
|
|
78
|
-
style={{
|
|
79
|
-
...styles.errorStyle,
|
|
80
|
-
color: DHRE_DEFAULT.DH_SEMENTIC_ERROR,
|
|
81
|
-
}}
|
|
82
|
-
/>
|
|
83
|
-
) : null}
|
|
84
|
-
</Pressable>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const styles = StyleSheet.create({
|
|
89
|
-
container: {
|
|
90
|
-
justifyContent: 'center',
|
|
91
|
-
},
|
|
92
|
-
touchable: {
|
|
93
|
-
width: '100%',
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
input: {
|
|
97
|
-
marginVertical: verticalScale(8),
|
|
98
|
-
backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
|
|
99
|
-
paddingVertical: 0,
|
|
100
|
-
height: verticalScale(48),
|
|
101
|
-
justifyContent: 'center',
|
|
102
|
-
},
|
|
103
|
-
errorInput: {
|
|
104
|
-
marginTop: verticalScale(12),
|
|
105
|
-
backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
|
|
106
|
-
paddingVertical: 0,
|
|
107
|
-
height: verticalScale(48),
|
|
108
|
-
justifyContent: 'center',
|
|
109
|
-
},
|
|
110
|
-
outlineStyle: {
|
|
111
|
-
borderWidth: 1,
|
|
112
|
-
height: verticalScale(48),
|
|
113
|
-
borderRadius: moderateScale(8),
|
|
114
|
-
},
|
|
115
|
-
errorStyle: {
|
|
116
|
-
marginTop: verticalScale(4),
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
export default CommonTextInput;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './Textinput';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export interface ToastRef {
|
|
2
|
-
showToast: (
|
|
3
|
-
message: string,
|
|
4
|
-
duration?: number,
|
|
5
|
-
isSuccess?: boolean,
|
|
6
|
-
buttonText?: string | null,
|
|
7
|
-
buttonAction?: (() => void) | null,
|
|
8
|
-
) => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type ShowToast = (
|
|
12
|
-
message: string,
|
|
13
|
-
duration?: number,
|
|
14
|
-
isSuccess?: boolean,
|
|
15
|
-
buttonText?: string | null,
|
|
16
|
-
buttonAction?: (() => void) | null,
|
|
17
|
-
) => void;
|
|
18
|
-
export interface ToastProps {}
|
|
19
|
-
// ToastService.interface.ts
|
|
20
|
-
export interface ToastRef {
|
|
21
|
-
showToast: (
|
|
22
|
-
message: string,
|
|
23
|
-
duration?: number,
|
|
24
|
-
isSuccess?: boolean,
|
|
25
|
-
buttonText?: string | null,
|
|
26
|
-
buttonAction?: (() => void) | null,
|
|
27
|
-
) => void;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ToastServiceInterface {
|
|
31
|
-
setRef: (ref: ToastRef | null) => void;
|
|
32
|
-
showToast: (
|
|
33
|
-
message: string,
|
|
34
|
-
duration?: number,
|
|
35
|
-
isSuccess?: boolean,
|
|
36
|
-
buttonText?: string | null,
|
|
37
|
-
buttonAction?: (() => void) | null,
|
|
38
|
-
) => void;
|
|
39
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
-
import {
|
|
3
|
-
horizontalScale,
|
|
4
|
-
moderateScale,
|
|
5
|
-
verticalScale,
|
|
6
|
-
width,
|
|
7
|
-
} from '../../utils/stylehelper';
|
|
8
|
-
|
|
9
|
-
const styles = StyleSheet.create({
|
|
10
|
-
container: {
|
|
11
|
-
position: 'absolute',
|
|
12
|
-
alignSelf: 'center',
|
|
13
|
-
height: verticalScale(72),
|
|
14
|
-
width: width - horizontalScale(32),
|
|
15
|
-
top: 56,
|
|
16
|
-
borderRadius: moderateScale(8),
|
|
17
|
-
overflow: 'hidden',
|
|
18
|
-
},
|
|
19
|
-
toastContainer: {flex: 1, justifyContent: 'center'},
|
|
20
|
-
innerContainer: {
|
|
21
|
-
flexDirection: 'row',
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
paddingHorizontal: horizontalScale(12),
|
|
24
|
-
},
|
|
25
|
-
icon: {
|
|
26
|
-
marginRight: 9,
|
|
27
|
-
},
|
|
28
|
-
messageText: {
|
|
29
|
-
flex: 1,
|
|
30
|
-
color: '#fff',
|
|
31
|
-
},
|
|
32
|
-
button: {
|
|
33
|
-
marginLeft: 9,
|
|
34
|
-
},
|
|
35
|
-
buttonText: {
|
|
36
|
-
textDecorationLine: 'underline',
|
|
37
|
-
color: '#fff',
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export default styles;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {render} from '@testing-library/react-native';
|
|
3
|
-
import Toast from './Toast';
|
|
4
|
-
|
|
5
|
-
jest.mock('react-native-progress', () => ({
|
|
6
|
-
Bar: props => <div {...props} />,
|
|
7
|
-
}));
|
|
8
|
-
|
|
9
|
-
describe('Toast Component', () => {
|
|
10
|
-
it('Component renders correctly', () => {
|
|
11
|
-
render(<Toast />);
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import React, {useEffect, useState, useRef} from 'react';
|
|
2
|
-
import {View, Animated, Pressable} from 'react-native';
|
|
3
|
-
import * as Progress from 'react-native-progress';
|
|
4
|
-
import {CrossIcon, CircleTick} from '../../assets';
|
|
5
|
-
import CustomTypography from '../customTypography/CustomTypography';
|
|
6
|
-
import {horizontalScale, width} from '../../utils/stylehelper';
|
|
7
|
-
import {ToastRef, ShowToast, ToastProps} from './Toast.interface'; // Import the interfaces
|
|
8
|
-
import styles from './Toast.styles';
|
|
9
|
-
|
|
10
|
-
const Toast = React.forwardRef<ToastRef, ToastProps>((_props, ref) => {
|
|
11
|
-
const [visible, setVisible] = useState(false);
|
|
12
|
-
const [message, setMessage] = useState('');
|
|
13
|
-
const [isSuccess, setIsSuccess] = useState(true);
|
|
14
|
-
const [btnText, setBtnText] = useState<string | null>(null);
|
|
15
|
-
const [onBtnPress, setOnBtnPress] = useState<(() => void) | null>(null);
|
|
16
|
-
const [progress, setProgress] = useState(0);
|
|
17
|
-
|
|
18
|
-
const bottom = useRef(new Animated.Value(-80)).current;
|
|
19
|
-
|
|
20
|
-
const showToast: ShowToast = (
|
|
21
|
-
toastMessage,
|
|
22
|
-
duration = 3000,
|
|
23
|
-
success = true,
|
|
24
|
-
buttonText = null,
|
|
25
|
-
buttonAction = null,
|
|
26
|
-
) => {
|
|
27
|
-
setMessage(toastMessage);
|
|
28
|
-
setIsSuccess(success);
|
|
29
|
-
setBtnText(buttonText);
|
|
30
|
-
setOnBtnPress(() => buttonAction);
|
|
31
|
-
setVisible(true);
|
|
32
|
-
|
|
33
|
-
Animated.timing(bottom, {
|
|
34
|
-
toValue: 20,
|
|
35
|
-
duration: 500,
|
|
36
|
-
useNativeDriver: false,
|
|
37
|
-
}).start();
|
|
38
|
-
|
|
39
|
-
setTimeout(() => {
|
|
40
|
-
hideToast();
|
|
41
|
-
}, duration);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const hideToast = () => {
|
|
45
|
-
Animated.timing(bottom, {
|
|
46
|
-
toValue: -80,
|
|
47
|
-
duration: 500,
|
|
48
|
-
useNativeDriver: false,
|
|
49
|
-
}).start(() => {
|
|
50
|
-
setVisible(false);
|
|
51
|
-
setMessage('');
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const simulateProgress = () => {
|
|
56
|
-
setProgress(prev => (prev + 0.1 > 1 ? 1 : prev + 0.1));
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
if (visible) {
|
|
61
|
-
setProgress(0);
|
|
62
|
-
const interval = setInterval(simulateProgress, 180);
|
|
63
|
-
return () => clearInterval(interval);
|
|
64
|
-
}
|
|
65
|
-
}, [visible]);
|
|
66
|
-
|
|
67
|
-
React.useImperativeHandle(ref, () => ({
|
|
68
|
-
showToast,
|
|
69
|
-
}));
|
|
70
|
-
|
|
71
|
-
return visible ? (
|
|
72
|
-
<Animated.View
|
|
73
|
-
style={[
|
|
74
|
-
styles.container,
|
|
75
|
-
{bottom},
|
|
76
|
-
{backgroundColor: isSuccess ? '#04743F' : '#DB3056'},
|
|
77
|
-
]}
|
|
78
|
-
testID="TOAST">
|
|
79
|
-
<View style={styles.toastContainer}>
|
|
80
|
-
<View style={styles.innerContainer}>
|
|
81
|
-
{isSuccess ? <CircleTick /> : <CrossIcon />}
|
|
82
|
-
<CustomTypography
|
|
83
|
-
variant="L2_REGULAR"
|
|
84
|
-
text={message}
|
|
85
|
-
style={styles.messageText}
|
|
86
|
-
/>
|
|
87
|
-
{btnText && (
|
|
88
|
-
<Pressable
|
|
89
|
-
style={styles.button}
|
|
90
|
-
onPress={onBtnPress || undefined}
|
|
91
|
-
testID="TOAST-BTN">
|
|
92
|
-
<CustomTypography
|
|
93
|
-
variant="L2_BOLD"
|
|
94
|
-
text={btnText}
|
|
95
|
-
style={styles.buttonText}
|
|
96
|
-
/>
|
|
97
|
-
</Pressable>
|
|
98
|
-
)}
|
|
99
|
-
</View>
|
|
100
|
-
</View>
|
|
101
|
-
<Progress.Bar
|
|
102
|
-
progress={progress}
|
|
103
|
-
width={width - horizontalScale(48)}
|
|
104
|
-
height={3}
|
|
105
|
-
color={isSuccess ? '#024324' : '#851D41'}
|
|
106
|
-
borderColor="transparent"
|
|
107
|
-
/>
|
|
108
|
-
</Animated.View>
|
|
109
|
-
) : null;
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// Set the display name for debugging purposes
|
|
113
|
-
Toast.displayName = 'Toast';
|
|
114
|
-
|
|
115
|
-
export default Toast;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {ToastRef, ToastServiceInterface} from './Toast.interface';
|
|
2
|
-
|
|
3
|
-
class ToastService implements ToastServiceInterface {
|
|
4
|
-
private toastRef: ToastRef | null = null;
|
|
5
|
-
|
|
6
|
-
setRef(ref: ToastRef | null) {
|
|
7
|
-
this.toastRef = ref;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
showToast(
|
|
11
|
-
message: string,
|
|
12
|
-
duration: number = 3000,
|
|
13
|
-
isSuccess: boolean = true,
|
|
14
|
-
buttonText: string | null = null,
|
|
15
|
-
buttonAction: (() => void) | null = null,
|
|
16
|
-
) {
|
|
17
|
-
if (this.toastRef) {
|
|
18
|
-
this.toastRef.showToast(
|
|
19
|
-
message,
|
|
20
|
-
duration,
|
|
21
|
-
isSuccess,
|
|
22
|
-
buttonText,
|
|
23
|
-
buttonAction,
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const toastService = new ToastService();
|
|
30
|
-
export default toastService;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './Toast';
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {DHRE_COLORS_TEXT} from '../../theme/colors';
|
|
2
|
-
import {horizontalScale, verticalScale} from '../../utils/stylehelper';
|
|
3
|
-
import {StyleSheet} from 'react-native';
|
|
4
|
-
|
|
5
|
-
const styles = StyleSheet.create({
|
|
6
|
-
container: {
|
|
7
|
-
width: horizontalScale(70),
|
|
8
|
-
height: verticalScale(25),
|
|
9
|
-
borderRadius: 15,
|
|
10
|
-
justifyContent: 'center',
|
|
11
|
-
},
|
|
12
|
-
track: {
|
|
13
|
-
position: 'absolute',
|
|
14
|
-
top: 0,
|
|
15
|
-
left: 0,
|
|
16
|
-
right: 0,
|
|
17
|
-
bottom: 0,
|
|
18
|
-
justifyContent: 'center',
|
|
19
|
-
borderRadius: 15,
|
|
20
|
-
},
|
|
21
|
-
thumb: {
|
|
22
|
-
position: 'absolute',
|
|
23
|
-
width: horizontalScale(20),
|
|
24
|
-
height: verticalScale(20),
|
|
25
|
-
borderRadius: 16,
|
|
26
|
-
justifyContent: 'center',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
|
|
29
|
-
left: horizontalScale(2),
|
|
30
|
-
},
|
|
31
|
-
text: {
|
|
32
|
-
color: DHRE_COLORS_TEXT.DH_WHITE,
|
|
33
|
-
textAlign: 'left',
|
|
34
|
-
marginHorizontal: horizontalScale(10),
|
|
35
|
-
},
|
|
36
|
-
textRight: {
|
|
37
|
-
textAlign: 'right',
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
export default styles;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {render, screen, fireEvent} from '@testing-library/react-native';
|
|
3
|
-
import CustomSwitch from './ToggleButton';
|
|
4
|
-
|
|
5
|
-
describe('CustomSwitch', () => {
|
|
6
|
-
it('renders correctly with default type', () => {
|
|
7
|
-
const onValueChangeMock = jest.fn();
|
|
8
|
-
render(<CustomSwitch onValueChange={onValueChangeMock} value={false} />);
|
|
9
|
-
|
|
10
|
-
const switchElement = screen.getByTestId('custom-switch');
|
|
11
|
-
expect(switchElement).toBeTruthy();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('renders correctly with custom type', () => {
|
|
15
|
-
const onValueChangeMock = jest.fn();
|
|
16
|
-
render(<CustomSwitch onValueChange={onValueChangeMock} value={true} />);
|
|
17
|
-
|
|
18
|
-
const switchElement = screen.getByTestId('custom-switch');
|
|
19
|
-
expect(switchElement).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('toggles switch on press', () => {
|
|
23
|
-
const onValueChangeMock = jest.fn();
|
|
24
|
-
const {getByTestId} = render(
|
|
25
|
-
<CustomSwitch onValueChange={onValueChangeMock} value={false} />,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
const switchElement = getByTestId('custom-switch');
|
|
29
|
-
fireEvent.press(switchElement);
|
|
30
|
-
|
|
31
|
-
expect(onValueChangeMock).toHaveBeenCalledWith(true);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React, {useState, useRef, useEffect} from 'react';
|
|
2
|
-
import {View, Animated, Pressable} from 'react-native';
|
|
3
|
-
import {DHRE_COLORS_ALERT, DHRE_COLORS_TEXT} from '../../theme/colors';
|
|
4
|
-
import styles from './ToggleButton.styles';
|
|
5
|
-
import CustomTypography from '../../components/customTypography/CustomTypography';
|
|
6
|
-
import {
|
|
7
|
-
ToggleButtonType,
|
|
8
|
-
TextDirectType,
|
|
9
|
-
ToggleTextType,
|
|
10
|
-
} from '../../utils/appEnum';
|
|
11
|
-
interface CustomSwitchProps {
|
|
12
|
-
onValueChange: (value: boolean) => void;
|
|
13
|
-
value: boolean;
|
|
14
|
-
type?: ToggleButtonType;
|
|
15
|
-
trackWidth?: number;
|
|
16
|
-
width?: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const CustomSwitch: React.FC<CustomSwitchProps> = ({
|
|
20
|
-
onValueChange,
|
|
21
|
-
value,
|
|
22
|
-
type = ToggleButtonType.LARGE,
|
|
23
|
-
trackWidth = type !== ToggleButtonType.SMALL ? 35 : 15,
|
|
24
|
-
width = type !== ToggleButtonType.SMALL ? 60 : 40,
|
|
25
|
-
}) => {
|
|
26
|
-
const [isOn, setIsOn] = useState(value);
|
|
27
|
-
const animatedValue = useRef(
|
|
28
|
-
new Animated.Value(value ? trackWidth : 0),
|
|
29
|
-
).current;
|
|
30
|
-
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
Animated.timing(animatedValue, {
|
|
33
|
-
toValue: isOn ? trackWidth : 0,
|
|
34
|
-
duration: 200,
|
|
35
|
-
useNativeDriver: true,
|
|
36
|
-
}).start();
|
|
37
|
-
}, [isOn, animatedValue, trackWidth]);
|
|
38
|
-
|
|
39
|
-
const toggleSwitch = () => {
|
|
40
|
-
setIsOn(!isOn);
|
|
41
|
-
onValueChange(!isOn);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const animatedStyle = {
|
|
45
|
-
transform: [{translateX: animatedValue}],
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<Pressable
|
|
50
|
-
onPress={toggleSwitch}
|
|
51
|
-
style={[styles.container, {width}]}
|
|
52
|
-
testID="custom-switch">
|
|
53
|
-
<View
|
|
54
|
-
style={[
|
|
55
|
-
styles.track,
|
|
56
|
-
{
|
|
57
|
-
backgroundColor: isOn
|
|
58
|
-
? DHRE_COLORS_ALERT.DH_SUCCESS_GREEN_ACCENT
|
|
59
|
-
: DHRE_COLORS_TEXT.DH_TEXTDISABLED,
|
|
60
|
-
},
|
|
61
|
-
]}>
|
|
62
|
-
<Animated.View style={[styles.thumb, animatedStyle]} />
|
|
63
|
-
{type !== ToggleButtonType.SMALL && (
|
|
64
|
-
<CustomTypography
|
|
65
|
-
variant="B3semiBold"
|
|
66
|
-
style={[
|
|
67
|
-
styles.text,
|
|
68
|
-
{textAlign: isOn ? TextDirectType.left : TextDirectType.right},
|
|
69
|
-
]}
|
|
70
|
-
text={isOn ? ToggleTextType.ON : ToggleTextType.OFF}
|
|
71
|
-
/>
|
|
72
|
-
)}
|
|
73
|
-
</View>
|
|
74
|
-
</Pressable>
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export default CustomSwitch;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './ToggleButton';
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React, {ReactElement} from 'react';
|
|
2
|
-
import {TouchableOpacity, View, StyleSheet, ViewStyle} from 'react-native';
|
|
3
|
-
import {SvgProps} from 'react-native-svg';
|
|
4
|
-
import {useTheme} from '../../theme/ThemeContext';
|
|
5
|
-
import CustomText from '../customText';
|
|
6
|
-
import {withThemeProvider} from '../../theme/withThemeProvider';
|
|
7
|
-
|
|
8
|
-
interface OurOfficesButtonProps {
|
|
9
|
-
rightIcon?: ReactElement<SvgProps>;
|
|
10
|
-
onPress: () => void;
|
|
11
|
-
title: string;
|
|
12
|
-
subTitle?: string;
|
|
13
|
-
containterStyle?: ViewStyle;
|
|
14
|
-
}
|
|
15
|
-
const Topic = ({
|
|
16
|
-
rightIcon,
|
|
17
|
-
onPress,
|
|
18
|
-
title,
|
|
19
|
-
subTitle,
|
|
20
|
-
containterStyle,
|
|
21
|
-
}: OurOfficesButtonProps) => {
|
|
22
|
-
const {theme} = useTheme();
|
|
23
|
-
return (
|
|
24
|
-
<TouchableOpacity
|
|
25
|
-
style={[
|
|
26
|
-
styles.button,
|
|
27
|
-
{backgroundColor: theme['SURFACE_SECONDARY']},
|
|
28
|
-
containterStyle,
|
|
29
|
-
]}
|
|
30
|
-
onPress={onPress}>
|
|
31
|
-
{rightIcon && (
|
|
32
|
-
<View style={styles.rightIconContainer}>
|
|
33
|
-
{React.cloneElement(rightIcon)}
|
|
34
|
-
</View>
|
|
35
|
-
)}
|
|
36
|
-
<View style={styles.textContainer}>
|
|
37
|
-
{subTitle && (
|
|
38
|
-
<CustomText
|
|
39
|
-
text={subTitle}
|
|
40
|
-
variant="L3_REGULAR"
|
|
41
|
-
textColor="CONTENT_PRIMARY"
|
|
42
|
-
/>
|
|
43
|
-
)}
|
|
44
|
-
<CustomText
|
|
45
|
-
text={title}
|
|
46
|
-
variant="L1_REGULAR"
|
|
47
|
-
textColor="CONTENT_PRIMARY"
|
|
48
|
-
/>
|
|
49
|
-
</View>
|
|
50
|
-
</TouchableOpacity>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const styles = StyleSheet.create({
|
|
55
|
-
button: {
|
|
56
|
-
flexDirection: 'row',
|
|
57
|
-
alignItems: 'center',
|
|
58
|
-
height: 75,
|
|
59
|
-
width: 158,
|
|
60
|
-
borderRadius: 10,
|
|
61
|
-
marginLeft: 12,
|
|
62
|
-
marginVertical: 14,
|
|
63
|
-
},
|
|
64
|
-
iconContainer: {
|
|
65
|
-
marginHorizontal: 16,
|
|
66
|
-
},
|
|
67
|
-
textContainer: {
|
|
68
|
-
flex: 1,
|
|
69
|
-
position: 'absolute',
|
|
70
|
-
padding: 10,
|
|
71
|
-
bottom: 0,
|
|
72
|
-
marginHorizontal: 8,
|
|
73
|
-
marginTop: 20,
|
|
74
|
-
},
|
|
75
|
-
titleText: {
|
|
76
|
-
marginBottom: 4,
|
|
77
|
-
},
|
|
78
|
-
rightIconContainer: {
|
|
79
|
-
position: 'absolute',
|
|
80
|
-
left: 16,
|
|
81
|
-
top: 10,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
export default withThemeProvider(Topic);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './Topic';
|
package/src/index.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export {default as CustomText} from './components/customText';
|
|
2
|
-
// export {default as AutoOtpReader} from './components/autoOtpReader'; //TODO: warn
|
|
3
|
-
export {default as Badge} from './components/badge';
|
|
4
|
-
export {default as BottomDrawer} from './components/bottomDrawer';
|
|
5
|
-
export {default as Button} from './components/button';
|
|
6
|
-
export {default as Cards} from './components/cards';
|
|
7
|
-
export {default as CheckBox} from './components/checkBox';
|
|
8
|
-
export {default as CustomDropdown} from './components/customDropdown';
|
|
9
|
-
export {default as CustomTextInput} from './components/customInputText';
|
|
10
|
-
export {default as CustomTooltip} from './components/customTooltip';
|
|
11
|
-
export {default as FileUpload} from './components/fileUpload';
|
|
12
|
-
export {default as PdfView} from './components/pdfView';
|
|
13
|
-
export {default as PopUp} from './components/popup';
|
|
14
|
-
export {default as CustomProgressBar} from './components/progressBar';
|
|
15
|
-
// export {default as Property360View} from './components/property360View';
|
|
16
|
-
export {default as StarRating} from './components/rating';
|
|
17
|
-
export {default as Tabs} from './components/tabs';
|
|
18
|
-
export {default as Tags} from './components/tags';
|
|
19
|
-
export {default as ToggleButton} from './components/toggleButton';
|
|
20
|
-
export {default as Accordion} from './components/accordion';
|
|
21
|
-
export {default as Toast} from './components/toast';
|
|
22
|
-
export {default as CustomSearchBar} from './components/customSearchBar';
|
|
23
|
-
export {default as CustomHeader} from './components/customHeader';
|
|
24
|
-
export {default as SwipableList} from './components/swipableList';
|
|
25
|
-
export {default as CustomTypography} from './components/customTypography';
|
|
26
|
-
export {default as CustomIcon} from './components/customIcon';
|
|
27
|
-
export {default as CustomLoader} from './components/customLoader';
|
|
28
|
-
export {default as Line} from './components/horizontalLine';
|
|
29
|
-
export {default as Topic} from './components/topic';
|
|
30
|
-
export {default as ContactModel} from './components/ContactModel';
|
|
31
|
-
export {default as DateRangePicker} from './components/dateRangePicker';
|
|
32
|
-
export {default as OurOfficesButton} from './components/OutOfOffice';
|
|
33
|
-
export {default as NotificationBandge} from './components/notificationBandge';
|
|
34
|
-
export {default as Category} from './components/scrollList';
|
|
35
|
-
export {default as FeedbackForm} from './components/feedback';
|
|
36
|
-
export {default as CountryPicker} from './components/countryPicker';
|
|
37
|
-
export {default as TextInput} from './components/textInput';
|
|
38
|
-
export {default as DropDown} from './components/dropDown';
|
|
39
|
-
export {default as CustomSwitchBtn} from './components/customSwitchBtn';
|
|
40
|
-
export {default as toastService} from './components/toast/ToastService';
|
|
41
|
-
export {default as SingleSelectionTags} from './components/singleSelectionTag';
|
|
42
|
-
export {default as CustomDocumentPicker} from './components/customDocumentPicker';
|
|
43
|
-
export {default as OTPInput} from './components/otp';
|
|
44
|
-
export {default as Stepper} from './components/stepper';
|
|
45
|
-
export {FONT_STYLES} from './theme/fonts';
|
|
46
|
-
export {FontStyle, Theme} from './utils/appEnum';
|
|
47
|
-
export {default as CustomSlideButton} from './components/customSlideButton';
|
|
48
|
-
|
|
49
|
-
export {DHRE_DEFAULT, DHRE_COLORS_TEXT} from './theme/colors';
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
verticalScale,
|
|
53
|
-
horizontalScale,
|
|
54
|
-
moderateScale,
|
|
55
|
-
} from './utils/stylehelper';
|
|
56
|
-
export {copyToClipboard} from './utils/deviceUtils';
|
|
57
|
-
|
|
58
|
-
export {default} from './theme/themes';
|
|
59
|
-
export {default as CustomTextTest} from '../__mocks__/custom-text.mock';
|