dhre-ui-kit 0.0.94 → 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 -124
- 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,46 +0,0 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
-
import {DHRE_COLORS_TEXT, DHRE_COLORS_BG} from '../../theme/colors';
|
|
3
|
-
import {
|
|
4
|
-
horizontalScale,
|
|
5
|
-
moderateScale,
|
|
6
|
-
verticalScale,
|
|
7
|
-
} from '../../utils/stylehelper';
|
|
8
|
-
|
|
9
|
-
const styles = StyleSheet.create({
|
|
10
|
-
labelStyle: {
|
|
11
|
-
color: DHRE_COLORS_TEXT.DH_TEXTLIGHT,
|
|
12
|
-
},
|
|
13
|
-
dropDownStyle: {
|
|
14
|
-
flexDirection: 'row',
|
|
15
|
-
justifyContent: 'space-between',
|
|
16
|
-
alignItems: 'center',
|
|
17
|
-
height: verticalScale(48),
|
|
18
|
-
marginTop: verticalScale(8),
|
|
19
|
-
paddingHorizontal: horizontalScale(20),
|
|
20
|
-
paddingVertical: verticalScale(12),
|
|
21
|
-
backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
|
|
22
|
-
borderWidth: 1,
|
|
23
|
-
borderColor: DHRE_COLORS_BG.DH_LINE_GREY_700,
|
|
24
|
-
borderRadius: moderateScale(24),
|
|
25
|
-
},
|
|
26
|
-
selectedValueStyle: {
|
|
27
|
-
color: DHRE_COLORS_TEXT.DH_TEXTDARK,
|
|
28
|
-
},
|
|
29
|
-
optionContainer: {
|
|
30
|
-
marginTop: verticalScale(4),
|
|
31
|
-
borderRadius: moderateScale(24),
|
|
32
|
-
borderWidth: 1,
|
|
33
|
-
borderColor: DHRE_COLORS_BG.DH_GREY1,
|
|
34
|
-
},
|
|
35
|
-
item: {
|
|
36
|
-
flexDirection: 'row',
|
|
37
|
-
alignItems: 'center',
|
|
38
|
-
paddingVertical: verticalScale(12),
|
|
39
|
-
paddingHorizontal: horizontalScale(20),
|
|
40
|
-
},
|
|
41
|
-
iconStyle: {
|
|
42
|
-
marginRight: horizontalScale(12),
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export default styles;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {it} from '@jest/globals';
|
|
3
|
-
import {fireEvent, render} from '@testing-library/react-native';
|
|
4
|
-
import CustomDropdown from './CustomDropdown';
|
|
5
|
-
import {CalenderDots} from '../../assets';
|
|
6
|
-
|
|
7
|
-
const mockProps = {
|
|
8
|
-
label: 'Dropdown',
|
|
9
|
-
options: [
|
|
10
|
-
{id: '1', value: 'option1', label: 'Option 1'},
|
|
11
|
-
{id: '2', value: 'option2', label: 'Option 2'},
|
|
12
|
-
],
|
|
13
|
-
selectedValue: undefined,
|
|
14
|
-
oneSelect: jest.fn(),
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
describe('Custom Dropdown Component', () => {
|
|
18
|
-
it('Component renders correctly', () => {
|
|
19
|
-
const {getByTestId} = render(
|
|
20
|
-
<CustomDropdown
|
|
21
|
-
upArrowIcon={<CalenderDots />}
|
|
22
|
-
downArrowIcon={<CalenderDots />}
|
|
23
|
-
{...mockProps}
|
|
24
|
-
/>,
|
|
25
|
-
);
|
|
26
|
-
expect(getByTestId('CUSTOM-DROPDOWN')).toBeTruthy();
|
|
27
|
-
fireEvent.press(getByTestId('CUSTOM-DROPDOWN-BTN'));
|
|
28
|
-
fireEvent.press(getByTestId('CUSTOM-DROPDOWN-Option 1-BTN'));
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import {Pressable, View} from 'react-native';
|
|
2
|
-
import React, {useState} from 'react';
|
|
3
|
-
import {DHRE_COLORS_BG, DHRE_COLORS_TEXT} from '../../theme/colors';
|
|
4
|
-
import {CustomDropdownProps} from './CustomDropdown.interface';
|
|
5
|
-
import styles from './CustomDropdown.styles';
|
|
6
|
-
import {moderateScale} from '../../utils/stylehelper';
|
|
7
|
-
import CustomTypography from '../customTypography/CustomTypography';
|
|
8
|
-
|
|
9
|
-
const CustomDropdown: React.FC<CustomDropdownProps> = ({
|
|
10
|
-
label,
|
|
11
|
-
placeholder = 'Choose Option',
|
|
12
|
-
options,
|
|
13
|
-
selectedValue,
|
|
14
|
-
oneSelect,
|
|
15
|
-
testId = 'CUSTOM-DROPDOWN',
|
|
16
|
-
iconName,
|
|
17
|
-
iconStyle,
|
|
18
|
-
upArrowIcon,
|
|
19
|
-
downArrowIcon,
|
|
20
|
-
}) => {
|
|
21
|
-
const [showOptions, setShowOptions] = useState(false);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<View testID={testId}>
|
|
25
|
-
<CustomTypography
|
|
26
|
-
variant="P3regular"
|
|
27
|
-
style={styles.labelStyle}
|
|
28
|
-
text={label}
|
|
29
|
-
/>
|
|
30
|
-
<Pressable
|
|
31
|
-
testID={`${testId}-BTN`}
|
|
32
|
-
style={styles.dropDownStyle}
|
|
33
|
-
onPress={() => setShowOptions(!showOptions)}>
|
|
34
|
-
{iconName && (
|
|
35
|
-
<View style={iconStyle}>
|
|
36
|
-
{React.cloneElement(iconName, {
|
|
37
|
-
width: moderateScale(24),
|
|
38
|
-
height: moderateScale(24),
|
|
39
|
-
style: styles.iconStyle,
|
|
40
|
-
})}
|
|
41
|
-
</View>
|
|
42
|
-
)}
|
|
43
|
-
<CustomTypography
|
|
44
|
-
variant="P3regular"
|
|
45
|
-
style={styles.selectedValueStyle}
|
|
46
|
-
text={selectedValue ? selectedValue.label : placeholder}
|
|
47
|
-
/>
|
|
48
|
-
<View>
|
|
49
|
-
{showOptions
|
|
50
|
-
? React.cloneElement(upArrowIcon, {
|
|
51
|
-
width: moderateScale(24),
|
|
52
|
-
height: moderateScale(24),
|
|
53
|
-
})
|
|
54
|
-
: React.cloneElement(downArrowIcon, {
|
|
55
|
-
width: moderateScale(24),
|
|
56
|
-
height: moderateScale(24),
|
|
57
|
-
})}
|
|
58
|
-
</View>
|
|
59
|
-
</Pressable>
|
|
60
|
-
{showOptions && (
|
|
61
|
-
<View style={styles.optionContainer}>
|
|
62
|
-
{options?.map(({id, value, label}) => (
|
|
63
|
-
<Pressable
|
|
64
|
-
key={id}
|
|
65
|
-
testID={`${testId}-${label}-BTN`}
|
|
66
|
-
onPress={() => {
|
|
67
|
-
setShowOptions(!showOptions);
|
|
68
|
-
oneSelect({id, value, label});
|
|
69
|
-
}}
|
|
70
|
-
style={[
|
|
71
|
-
styles.item,
|
|
72
|
-
{
|
|
73
|
-
backgroundColor:
|
|
74
|
-
id === selectedValue?.id
|
|
75
|
-
? DHRE_COLORS_BG.DH_GREY1
|
|
76
|
-
: DHRE_COLORS_TEXT.DH_WHITE,
|
|
77
|
-
},
|
|
78
|
-
]}>
|
|
79
|
-
{iconName && (
|
|
80
|
-
<View style={iconStyle}>
|
|
81
|
-
{React.cloneElement(iconName, {
|
|
82
|
-
width: moderateScale(24),
|
|
83
|
-
height: moderateScale(24),
|
|
84
|
-
style: styles.iconStyle,
|
|
85
|
-
})}
|
|
86
|
-
</View>
|
|
87
|
-
)}
|
|
88
|
-
<CustomTypography
|
|
89
|
-
variant="P3regular"
|
|
90
|
-
style={{
|
|
91
|
-
color:
|
|
92
|
-
id === selectedValue?.id
|
|
93
|
-
? DHRE_COLORS_TEXT.DH_BLACK
|
|
94
|
-
: DHRE_COLORS_TEXT.DH_TEXTDARK,
|
|
95
|
-
}}
|
|
96
|
-
text={label}
|
|
97
|
-
/>
|
|
98
|
-
</Pressable>
|
|
99
|
-
))}
|
|
100
|
-
</View>
|
|
101
|
-
)}
|
|
102
|
-
</View>
|
|
103
|
-
);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export default CustomDropdown;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './CustomDropdown';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
-
import {horizontalScale, verticalScale} from '../../utils/stylehelper';
|
|
3
|
-
|
|
4
|
-
const styles = StyleSheet.create({
|
|
5
|
-
container: {
|
|
6
|
-
flexDirection: 'row',
|
|
7
|
-
justifyContent: 'space-between',
|
|
8
|
-
paddingHorizontal: horizontalScale(16),
|
|
9
|
-
paddingTop: verticalScale(74),
|
|
10
|
-
paddingBottom: verticalScale(16),
|
|
11
|
-
backgroundColor: '#212121',
|
|
12
|
-
borderBottomWidth: 1,
|
|
13
|
-
borderBottomColor: '#282828',
|
|
14
|
-
},
|
|
15
|
-
headderContainer: {
|
|
16
|
-
flexDirection: 'row',
|
|
17
|
-
alignItems: 'center',
|
|
18
|
-
},
|
|
19
|
-
headerTitle: {
|
|
20
|
-
color: '#FFFFFF',
|
|
21
|
-
},
|
|
22
|
-
leftIconStyle: {marginRight: horizontalScale(9)},
|
|
23
|
-
rightIconStyle: {marginLeft: horizontalScale(8)},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export default styles;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {render} from '@testing-library/react-native';
|
|
3
|
-
import CustomHeader from './CustomHeader';
|
|
4
|
-
|
|
5
|
-
describe('Custom Header Component', () => {
|
|
6
|
-
it('Component renders correctly', () => {
|
|
7
|
-
const {getByTestId, getByText} = render(
|
|
8
|
-
<CustomHeader title="Header Title" />,
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
expect(getByTestId('CUSTOM-HEADER')).toBeTruthy();
|
|
12
|
-
expect(getByText('Header Title')).toBeTruthy();
|
|
13
|
-
});
|
|
14
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {View} from 'react-native';
|
|
3
|
-
import {CaretLeft, HeaderIcon} from '../../assets';
|
|
4
|
-
import CustomTypography from '../customTypography/CustomTypography';
|
|
5
|
-
import {moderateScale} from '../../utils/stylehelper';
|
|
6
|
-
import styles from './CustomHeader.styles';
|
|
7
|
-
import {CustomHeaderProps} from './CustomHeader.interface';
|
|
8
|
-
|
|
9
|
-
const CustomHeader = ({
|
|
10
|
-
title,
|
|
11
|
-
testId = 'CUSTOM-HEADER',
|
|
12
|
-
leftIcon = <CaretLeft />,
|
|
13
|
-
rightIcon = <HeaderIcon />,
|
|
14
|
-
showLeftIcon = true,
|
|
15
|
-
showRightIcon = true,
|
|
16
|
-
onLeftPress,
|
|
17
|
-
onRightPress,
|
|
18
|
-
}: CustomHeaderProps) => {
|
|
19
|
-
return (
|
|
20
|
-
<View style={styles.container} testID={testId}>
|
|
21
|
-
<View style={styles.headderContainer}>
|
|
22
|
-
{showLeftIcon &&
|
|
23
|
-
React.cloneElement(leftIcon, {
|
|
24
|
-
width: moderateScale(24),
|
|
25
|
-
height: moderateScale(24),
|
|
26
|
-
onPress: onLeftPress,
|
|
27
|
-
style: styles.leftIconStyle,
|
|
28
|
-
})}
|
|
29
|
-
<CustomTypography
|
|
30
|
-
variant={'B2_REGULAR'}
|
|
31
|
-
text={title}
|
|
32
|
-
style={styles.headerTitle}
|
|
33
|
-
/>
|
|
34
|
-
</View>
|
|
35
|
-
{showRightIcon &&
|
|
36
|
-
React.cloneElement(rightIcon, {
|
|
37
|
-
width: moderateScale(24),
|
|
38
|
-
height: moderateScale(24),
|
|
39
|
-
onPress: onRightPress,
|
|
40
|
-
style: styles.rightIconStyle,
|
|
41
|
-
})}
|
|
42
|
-
</View>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default CustomHeader;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './CustomHeader';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextStyle, ViewStyle} from 'react-native';
|
|
3
|
-
|
|
4
|
-
export interface CustomIconProps {
|
|
5
|
-
icon: React.ReactElement;
|
|
6
|
-
title?: string;
|
|
7
|
-
titleVariant?: string;
|
|
8
|
-
testId?: string;
|
|
9
|
-
onPress?: () => void;
|
|
10
|
-
containerStyle?: ViewStyle;
|
|
11
|
-
titleStyle?: TextStyle;
|
|
12
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {render, fireEvent} from '@testing-library/react-native';
|
|
3
|
-
import {CalenderDots} from '../../assets';
|
|
4
|
-
import CustomIcon from './CustomIcon';
|
|
5
|
-
|
|
6
|
-
describe('Custom Icon Component', () => {
|
|
7
|
-
it('Component renders correctly', () => {
|
|
8
|
-
const {getByTestId} = render(
|
|
9
|
-
<CustomIcon icon={<CalenderDots />} title="Test Title" />,
|
|
10
|
-
);
|
|
11
|
-
expect(getByTestId('CUSTOM-ICON')).toBeTruthy();
|
|
12
|
-
fireEvent.press(getByTestId('CUSTOM-ICON'));
|
|
13
|
-
});
|
|
14
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {Pressable} from 'react-native';
|
|
3
|
-
import CustomTypography from '../customTypography';
|
|
4
|
-
import {CustomIconProps} from './CustomIcon.interface';
|
|
5
|
-
import styles from './CustomIcon.styles';
|
|
6
|
-
|
|
7
|
-
const CustomIcon = ({
|
|
8
|
-
icon,
|
|
9
|
-
title,
|
|
10
|
-
titleVariant = 'L1_REGULAR',
|
|
11
|
-
testId = 'CUSTOM-ICON',
|
|
12
|
-
onPress,
|
|
13
|
-
containerStyle,
|
|
14
|
-
titleStyle,
|
|
15
|
-
}: CustomIconProps) => {
|
|
16
|
-
return (
|
|
17
|
-
<Pressable
|
|
18
|
-
style={[styles.container, containerStyle]}
|
|
19
|
-
onPress={onPress}
|
|
20
|
-
testID={testId}>
|
|
21
|
-
{icon}
|
|
22
|
-
{title && (
|
|
23
|
-
<CustomTypography
|
|
24
|
-
variant={titleVariant}
|
|
25
|
-
text={title}
|
|
26
|
-
style={[styles.title, titleStyle]}
|
|
27
|
-
/>
|
|
28
|
-
)}
|
|
29
|
-
</Pressable>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default CustomIcon;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './CustomIcon';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {ReactElement} from 'react';
|
|
2
|
-
import {TextInputProps} from 'react-native';
|
|
3
|
-
|
|
4
|
-
export interface CustomTextInputProps extends TextInputProps {
|
|
5
|
-
label: string;
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
errorMessage?: string;
|
|
9
|
-
successMessage?: string;
|
|
10
|
-
testID?: string;
|
|
11
|
-
handleFocus?: () => void;
|
|
12
|
-
handleBlur?: () => void;
|
|
13
|
-
handleOnChangeText?: (text: string) => void;
|
|
14
|
-
secureTextEntry?: boolean;
|
|
15
|
-
isSearchBar?: boolean;
|
|
16
|
-
multiline?: boolean;
|
|
17
|
-
rightIcon1?: ReactElement;
|
|
18
|
-
rightIcon2?: ReactElement;
|
|
19
|
-
searchIcon?: ReactElement;
|
|
20
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
-
import {
|
|
3
|
-
DHRE_COLORS_TEXT,
|
|
4
|
-
DHRE_COLORS_BG,
|
|
5
|
-
DHRE_COLORS_ALERT,
|
|
6
|
-
} from '../../theme/colors';
|
|
7
|
-
import {FONT_STYLES} from '../../theme/fonts';
|
|
8
|
-
import {
|
|
9
|
-
horizontalScale,
|
|
10
|
-
moderateScale,
|
|
11
|
-
verticalScale,
|
|
12
|
-
} from '../../utils/stylehelper';
|
|
13
|
-
|
|
14
|
-
const styles = StyleSheet.create({
|
|
15
|
-
labelStyle: {
|
|
16
|
-
color: DHRE_COLORS_TEXT.DH_TEXTDARK,
|
|
17
|
-
},
|
|
18
|
-
inputContainer: {
|
|
19
|
-
flexDirection: 'row',
|
|
20
|
-
justifyContent: 'space-between',
|
|
21
|
-
marginVertical: verticalScale(8),
|
|
22
|
-
paddingHorizontal: horizontalScale(20),
|
|
23
|
-
paddingVertical: verticalScale(12),
|
|
24
|
-
backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
|
|
25
|
-
borderWidth: 1,
|
|
26
|
-
borderColor: DHRE_COLORS_BG.DH_LINE_GREY_700,
|
|
27
|
-
borderRadius: moderateScale(24),
|
|
28
|
-
},
|
|
29
|
-
input: {
|
|
30
|
-
flex: 1,
|
|
31
|
-
...FONT_STYLES.P2medium,
|
|
32
|
-
color: DHRE_COLORS_TEXT.DH_BLACK,
|
|
33
|
-
},
|
|
34
|
-
inputFocused: {
|
|
35
|
-
borderColor: DHRE_COLORS_TEXT.DH_BLACK,
|
|
36
|
-
},
|
|
37
|
-
inputError: {
|
|
38
|
-
borderColor: DHRE_COLORS_ALERT.DH_ALERT_ORANGE,
|
|
39
|
-
},
|
|
40
|
-
inputSucess: {
|
|
41
|
-
borderColor: DHRE_COLORS_ALERT.DH_SUCCESS_GREEN,
|
|
42
|
-
},
|
|
43
|
-
disableInputStyle: {
|
|
44
|
-
borderColor: DHRE_COLORS_BG.DH_GREY1,
|
|
45
|
-
backgroundColor: DHRE_COLORS_BG.DH_GREY1,
|
|
46
|
-
//need to check background and border color
|
|
47
|
-
},
|
|
48
|
-
disableTextStyle: {
|
|
49
|
-
color: DHRE_COLORS_TEXT.DH_TEXTLIGHTEST,
|
|
50
|
-
},
|
|
51
|
-
crossIconStyle: {marginLeft: horizontalScale(12)},
|
|
52
|
-
eyeIconStyle: {marginLeft: horizontalScale(16)},
|
|
53
|
-
searchIconStyle: {marginRight: horizontalScale(12)},
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
export default styles;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {it} from '@jest/globals';
|
|
3
|
-
import {fireEvent, render} from '@testing-library/react-native';
|
|
4
|
-
import CustomTextInput from './CustomInputText';
|
|
5
|
-
|
|
6
|
-
const mockProps = {
|
|
7
|
-
testID: 'CUSTOM-TEST-INPUT',
|
|
8
|
-
label: 'Email',
|
|
9
|
-
placeholder: 'Email',
|
|
10
|
-
disabled: false,
|
|
11
|
-
errorMessage: '',
|
|
12
|
-
successMessage: '',
|
|
13
|
-
handelFocus: jest.fn(),
|
|
14
|
-
handelBlur: jest.fn(),
|
|
15
|
-
handelOnChangeText: jest.fn(),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
describe('Custom Text Input Component', () => {
|
|
19
|
-
it('Component renders correctly', () => {
|
|
20
|
-
const {getByTestId} = render(<CustomTextInput {...mockProps} />);
|
|
21
|
-
expect(getByTestId('CUSTOM-TEST-INPUT')).toBeTruthy();
|
|
22
|
-
const textInput = getByTestId('CUSTOM-TEST-INPUT');
|
|
23
|
-
fireEvent.changeText(textInput, 'test@example.com');
|
|
24
|
-
expect(mockProps.handelOnChangeText).not.toHaveBeenCalledWith(
|
|
25
|
-
'test@example.com',
|
|
26
|
-
);
|
|
27
|
-
fireEvent(textInput, 'focus');
|
|
28
|
-
fireEvent(textInput, 'blur');
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('Check blur method when value is empty', () => {
|
|
32
|
-
const {getByTestId} = render(<CustomTextInput {...mockProps} />);
|
|
33
|
-
expect(getByTestId('CUSTOM-TEST-INPUT')).toBeTruthy();
|
|
34
|
-
const textInput = getByTestId('CUSTOM-TEST-INPUT');
|
|
35
|
-
fireEvent(textInput, 'blur');
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import React, {useState} from 'react';
|
|
2
|
-
import {TextInput, View} from 'react-native';
|
|
3
|
-
import {DHRE_COLORS_ALERT, DHRE_COLORS_TEXT} from '../../theme/colors';
|
|
4
|
-
import {moderateScale} from '../../utils/stylehelper';
|
|
5
|
-
import {CustomTextInputProps} from './CustomInputText.interface';
|
|
6
|
-
import styles from './CustomInputText.styles';
|
|
7
|
-
import CustomTypography from '../customTypography/CustomTypography';
|
|
8
|
-
|
|
9
|
-
const CustomTextInput: React.FC<CustomTextInputProps> = ({
|
|
10
|
-
label,
|
|
11
|
-
placeholder,
|
|
12
|
-
disabled = false,
|
|
13
|
-
errorMessage,
|
|
14
|
-
successMessage,
|
|
15
|
-
testID = 'CUSTOM-TEST-INPUT',
|
|
16
|
-
handleFocus,
|
|
17
|
-
handleBlur,
|
|
18
|
-
handleOnChangeText,
|
|
19
|
-
secureTextEntry = false,
|
|
20
|
-
isSearchBar = false,
|
|
21
|
-
multiline,
|
|
22
|
-
rightIcon1,
|
|
23
|
-
rightIcon2,
|
|
24
|
-
searchIcon,
|
|
25
|
-
...props
|
|
26
|
-
}) => {
|
|
27
|
-
const [value, setValue] = useState('');
|
|
28
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
29
|
-
const [error, setError] = useState(!!errorMessage);
|
|
30
|
-
const [isSecureTextEntry, setIsSecureTextEntry] = useState(secureTextEntry);
|
|
31
|
-
|
|
32
|
-
const onFocus = () => {
|
|
33
|
-
handleFocus?.();
|
|
34
|
-
setIsFocused(true);
|
|
35
|
-
setError(false);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const onBlur = () => {
|
|
39
|
-
handleBlur?.();
|
|
40
|
-
if (!value) {
|
|
41
|
-
setError(true);
|
|
42
|
-
}
|
|
43
|
-
setIsFocused(false);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const handleIconPress1 = () => setValue('');
|
|
47
|
-
const handleIconPress2 = () => setIsSecureTextEntry(!isSecureTextEntry);
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<View testID={testID}>
|
|
51
|
-
<CustomTypography
|
|
52
|
-
variant="P3medium"
|
|
53
|
-
style={[styles.labelStyle, disabled && styles.disableTextStyle]}
|
|
54
|
-
text={label}
|
|
55
|
-
/>
|
|
56
|
-
<View
|
|
57
|
-
style={[
|
|
58
|
-
styles.inputContainer,
|
|
59
|
-
isFocused && styles.inputFocused,
|
|
60
|
-
error && styles.inputError,
|
|
61
|
-
disabled && styles.disableInputStyle,
|
|
62
|
-
successMessage ? styles.inputSucess : {},
|
|
63
|
-
{
|
|
64
|
-
height: multiline ? 120 : 48,
|
|
65
|
-
alignItems: multiline ? 'flex-start' : 'center',
|
|
66
|
-
},
|
|
67
|
-
]}>
|
|
68
|
-
{isSearchBar &&
|
|
69
|
-
searchIcon &&
|
|
70
|
-
React.cloneElement(searchIcon, {
|
|
71
|
-
width: moderateScale(24),
|
|
72
|
-
height: moderateScale(24),
|
|
73
|
-
style: styles.searchIconStyle,
|
|
74
|
-
})}
|
|
75
|
-
<TextInput
|
|
76
|
-
{...props}
|
|
77
|
-
onFocus={onFocus}
|
|
78
|
-
onBlur={onBlur}
|
|
79
|
-
style={styles.input}
|
|
80
|
-
placeholderTextColor={DHRE_COLORS_TEXT.DH_TEXTLIGHTEST}
|
|
81
|
-
editable={!disabled}
|
|
82
|
-
value={value}
|
|
83
|
-
onChangeText={val => {
|
|
84
|
-
setValue(val);
|
|
85
|
-
handleOnChangeText?.(val);
|
|
86
|
-
}}
|
|
87
|
-
secureTextEntry={isSecureTextEntry}
|
|
88
|
-
/>
|
|
89
|
-
{value &&
|
|
90
|
-
!multiline &&
|
|
91
|
-
rightIcon1 &&
|
|
92
|
-
React.cloneElement(rightIcon1, {
|
|
93
|
-
onPress: handleIconPress1,
|
|
94
|
-
testID: 'icon1',
|
|
95
|
-
})}
|
|
96
|
-
{secureTextEntry &&
|
|
97
|
-
rightIcon2 &&
|
|
98
|
-
React.cloneElement(rightIcon2, {
|
|
99
|
-
onPress: handleIconPress2,
|
|
100
|
-
testID: 'icon2',
|
|
101
|
-
})}
|
|
102
|
-
</View>
|
|
103
|
-
{(error || successMessage) && (
|
|
104
|
-
<CustomTypography
|
|
105
|
-
numberOfLines={2}
|
|
106
|
-
variant="P4regular"
|
|
107
|
-
style={{
|
|
108
|
-
color: successMessage
|
|
109
|
-
? DHRE_COLORS_ALERT.DH_SUCCESS_GREEN
|
|
110
|
-
: DHRE_COLORS_ALERT.DH_ALERT_ORANGE,
|
|
111
|
-
}}
|
|
112
|
-
testID={`${testID}-message`}
|
|
113
|
-
text={successMessage || errorMessage || `Please Enter ${placeholder}`}
|
|
114
|
-
/>
|
|
115
|
-
)}
|
|
116
|
-
</View>
|
|
117
|
-
);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export default CustomTextInput;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './CustomInputText';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
-
|
|
3
|
-
const styles = StyleSheet.create({
|
|
4
|
-
container: {
|
|
5
|
-
flex: 1,
|
|
6
|
-
justifyContent: 'center',
|
|
7
|
-
alignItems: 'center',
|
|
8
|
-
backgroundColor: 'transparent',
|
|
9
|
-
position: 'absolute',
|
|
10
|
-
width: '100%',
|
|
11
|
-
height: '100%',
|
|
12
|
-
zIndex: 1000,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export default styles;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {View, ActivityIndicator} from 'react-native';
|
|
3
|
-
import {CustomLoaderProps} from './CustomLoader.inteface';
|
|
4
|
-
import styles from './CustomLoader.styles';
|
|
5
|
-
|
|
6
|
-
const CustomLoader = ({loading}: CustomLoaderProps) => {
|
|
7
|
-
if (!loading) return null;
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<View style={styles.container}>
|
|
11
|
-
<ActivityIndicator size="large" color="#686868" />
|
|
12
|
-
</View>
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default CustomLoader;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './CustomLoader';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {TextInputProps, TextStyle, ViewStyle} from 'react-native';
|
|
2
|
-
|
|
3
|
-
export interface CustomSearchBarProps extends TextInputProps {
|
|
4
|
-
height?: number;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
testID?: string;
|
|
7
|
-
inputContainerStyle?: ViewStyle;
|
|
8
|
-
searchIconStyle?: TextStyle;
|
|
9
|
-
crossIconStyle?: TextStyle;
|
|
10
|
-
inputStyle?: TextStyle;
|
|
11
|
-
onSearchIconPress?: () => void;
|
|
12
|
-
onCrossIconPress?: () => void;
|
|
13
|
-
handleOnChangeText?: (text: string) => void;
|
|
14
|
-
rightIcon?: React.ReactElement;
|
|
15
|
-
disableBorderColor?: string;
|
|
16
|
-
disablePlaceHolderStyle?: string;
|
|
17
|
-
enablePlaceHolderStyle?: string;
|
|
18
|
-
borderColor?: string;
|
|
19
|
-
setValue: (val: string) => void;
|
|
20
|
-
value: string | undefined;
|
|
21
|
-
}
|