dhre-ui-kit 0.0.1

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.
Files changed (102) hide show
  1. package/README.md +1 -0
  2. package/package.json +104 -0
  3. package/src/App.tsx +146 -0
  4. package/src/assets/images/calenderDots.svg +1 -0
  5. package/src/assets/index.ts +2 -0
  6. package/src/components/autoOtpReader/AutoOtpReader.test.tsx +56 -0
  7. package/src/components/autoOtpReader/AutoOtpReader.tsx +79 -0
  8. package/src/components/autoOtpReader/index.ts +1 -0
  9. package/src/components/badge/Badge.styles.ts +20 -0
  10. package/src/components/badge/Badge.test.tsx +45 -0
  11. package/src/components/badge/Badge.tsx +47 -0
  12. package/src/components/badge/index.ts +1 -0
  13. package/src/components/bottomDrawer/BottomDrawer.interface.ts +12 -0
  14. package/src/components/bottomDrawer/BottomDrawer.styles.ts +31 -0
  15. package/src/components/bottomDrawer/BottomDrawer.test.tsx +19 -0
  16. package/src/components/bottomDrawer/BottomDrawer.tsx +43 -0
  17. package/src/components/bottomDrawer/index.ts +1 -0
  18. package/src/components/button/Button.interface.ts +18 -0
  19. package/src/components/button/Button.styles.ts +78 -0
  20. package/src/components/button/Button.test.tsx +43 -0
  21. package/src/components/button/Button.tsx +53 -0
  22. package/src/components/button/index.ts +1 -0
  23. package/src/components/cards/Cards.interface.ts +13 -0
  24. package/src/components/cards/Cards.styles.ts +59 -0
  25. package/src/components/cards/Cards.test.tsx +41 -0
  26. package/src/components/cards/Cards.tsx +69 -0
  27. package/src/components/cards/index.ts +1 -0
  28. package/src/components/checkBox/CheckBox.interface.ts +10 -0
  29. package/src/components/checkBox/CheckBox.styles.ts +36 -0
  30. package/src/components/checkBox/CheckBox.test.tsx +46 -0
  31. package/src/components/checkBox/CheckBox.tsx +42 -0
  32. package/src/components/checkBox/index.ts +1 -0
  33. package/src/components/customDropdown/CustomDropdown.interface.ts +15 -0
  34. package/src/components/customDropdown/CustomDropdown.styles.tsx +46 -0
  35. package/src/components/customDropdown/CustomDropdown.test.tsx +30 -0
  36. package/src/components/customDropdown/CustomDropdown.tsx +106 -0
  37. package/src/components/customDropdown/index.ts +1 -0
  38. package/src/components/customInputText/CustomInputText.interface.ts +20 -0
  39. package/src/components/customInputText/CustomInputText.styles.ts +56 -0
  40. package/src/components/customInputText/CustomInputText.test.tsx +37 -0
  41. package/src/components/customInputText/CustomInputText.tsx +120 -0
  42. package/src/components/customInputText/index.ts +1 -0
  43. package/src/components/customText/CustomText.tsx +31 -0
  44. package/src/components/customText/index.ts +1 -0
  45. package/src/components/customTooltip/CustomTooltip.interface.ts +14 -0
  46. package/src/components/customTooltip/CustomTooltip.styles.ts +23 -0
  47. package/src/components/customTooltip/CustomTooltip.test.tsx +18 -0
  48. package/src/components/customTooltip/CustomTooltip.tsx +46 -0
  49. package/src/components/customTooltip/index.ts +1 -0
  50. package/src/components/customTypography/CustomTypography.tsx +25 -0
  51. package/src/components/fileUpload/FileUpload.styles.ts +41 -0
  52. package/src/components/fileUpload/FileUpload.test.tsx +39 -0
  53. package/src/components/fileUpload/FileUpload.tsx +65 -0
  54. package/src/components/fileUpload/index.ts +1 -0
  55. package/src/components/notification/Notification.interface.ts +61 -0
  56. package/src/components/notification/Notification.styles.ts +33 -0
  57. package/src/components/notification/Notification.test.tsx +116 -0
  58. package/src/components/notification/Notification.tsx +156 -0
  59. package/src/components/pdfView/PdfView.test.tsx +10 -0
  60. package/src/components/pdfView/PdfView.tsx +18 -0
  61. package/src/components/pdfView/index.ts +1 -0
  62. package/src/components/popup/PopUp.interface.ts +9 -0
  63. package/src/components/popup/PopUp.styles.ts +52 -0
  64. package/src/components/popup/PopUp.test.tsx +35 -0
  65. package/src/components/popup/PopUp.tsx +60 -0
  66. package/src/components/popup/index.ts +1 -0
  67. package/src/components/progressBar/ProgressBar.test.tsx +78 -0
  68. package/src/components/progressBar/ProgressBar.tsx +93 -0
  69. package/src/components/progressBar/index.ts +1 -0
  70. package/src/components/property360View/Property360View.test.tsx +24 -0
  71. package/src/components/property360View/Property360View.tsx +19 -0
  72. package/src/components/property360View/index.ts +1 -0
  73. package/src/components/rating/Rating.styles.ts +13 -0
  74. package/src/components/rating/Rating.test.tsx +61 -0
  75. package/src/components/rating/Rating.tsx +96 -0
  76. package/src/components/rating/index.ts +1 -0
  77. package/src/components/tabs/Tabs.interface.ts +13 -0
  78. package/src/components/tabs/Tabs.styles.ts +36 -0
  79. package/src/components/tabs/Tabs.test.tsx +20 -0
  80. package/src/components/tabs/Tabs.tsx +65 -0
  81. package/src/components/tabs/index.ts +1 -0
  82. package/src/components/tags/Tags.interface.ts +12 -0
  83. package/src/components/tags/Tags.styles.ts +36 -0
  84. package/src/components/tags/Tags.test.tsx +22 -0
  85. package/src/components/tags/Tags.tsx +76 -0
  86. package/src/components/tags/index.ts +1 -0
  87. package/src/components/toggleButton/ToggleButton.styles.ts +40 -0
  88. package/src/components/toggleButton/ToggleButton.test.tsx +33 -0
  89. package/src/components/toggleButton/ToggleButton.tsx +78 -0
  90. package/src/components/toggleButton/index.ts +1 -0
  91. package/src/index.ts +19 -0
  92. package/src/theme/ThemeContext.tsx +32 -0
  93. package/src/theme/colors.ts +156 -0
  94. package/src/theme/fonts.ts +303 -0
  95. package/src/theme/themes.ts +20 -0
  96. package/src/theme/withThemeProvider.tsx +14 -0
  97. package/src/utils/appEnum.ts +17 -0
  98. package/src/utils/commonStyles.ts +17 -0
  99. package/src/utils/constants.ts +17 -0
  100. package/src/utils/deviceUtils.ts +9 -0
  101. package/src/utils/regex.ts +1 -0
  102. package/src/utils/stylehelper.ts +13 -0
@@ -0,0 +1,78 @@
1
+ import {
2
+ DHRE_COLORS_TEXT,
3
+ DHRE_COLORS_BG,
4
+ DHRE_COLORS_ALERT,
5
+ DHRE_COLORS_PRIMARY,
6
+ } from '../../theme/colors';
7
+ import {horizontalScale, verticalScale} from '../../utils/stylehelper';
8
+ import {StyleSheet} from 'react-native';
9
+
10
+ const styles = StyleSheet.create({
11
+ mainContainer: {
12
+ marginHorizontal: horizontalScale(16),
13
+ },
14
+ button: {
15
+ backgroundColor: DHRE_COLORS_TEXT.DH_BLACK,
16
+ borderRadius: 50,
17
+ paddingVertical: verticalScale(4),
18
+ width: '100%',
19
+ paddingHorizontal: horizontalScale(8),
20
+ alignItems: 'center',
21
+ },
22
+ directionStyle: {
23
+ flexDirection: 'row',
24
+ alignItems: 'center',
25
+ },
26
+ iconStyle: {
27
+ height: verticalScale(24),
28
+ width: horizontalScale(24),
29
+ },
30
+ primary: {
31
+ backgroundColor: DHRE_COLORS_TEXT.DH_BLACK,
32
+ color: DHRE_COLORS_TEXT.DH_WHITE,
33
+ },
34
+ secondary: {
35
+ backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
36
+ borderColor: DHRE_COLORS_BG.DH_GREY1,
37
+ borderWidth: 1,
38
+ },
39
+ disable: {
40
+ backgroundColor: DHRE_COLORS_BG.DH_LINE_GREY_0,
41
+ },
42
+ tertiary: {
43
+ backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
44
+ },
45
+ functionPrimary: {
46
+ backgroundColor: DHRE_COLORS_ALERT.DH_ALERT_ORANGE,
47
+ },
48
+ functionSecondary: {
49
+ backgroundColor: DHRE_COLORS_ALERT.DH_ALERT_ORANGE_0,
50
+ borderColor: DHRE_COLORS_ALERT.DH_ALERT_ORANGE,
51
+ borderWidth: 1,
52
+ },
53
+ functionNotice: {
54
+ backgroundColor: DHRE_COLORS_ALERT.DH_SUCCESS_GREEN_900,
55
+ },
56
+ primaryText: {
57
+ color: DHRE_COLORS_TEXT.DH_WHITE,
58
+ },
59
+ secondaryText: {
60
+ color: DHRE_COLORS_TEXT.DH_BLACK,
61
+ },
62
+ disableText: {
63
+ color: DHRE_COLORS_TEXT.DH_TEXTDISABLED,
64
+ },
65
+ tertiaryText: {
66
+ color: DHRE_COLORS_PRIMARY.DH_RED_100,
67
+ },
68
+ functionPrimaryText: {
69
+ color: DHRE_COLORS_TEXT.DH_WHITE,
70
+ },
71
+ functionSecondaryText: {
72
+ color: DHRE_COLORS_ALERT.DH_ALERT_ORANGE,
73
+ },
74
+ functionNoticeText: {
75
+ color: DHRE_COLORS_TEXT.DH_WHITE,
76
+ },
77
+ });
78
+ export default styles;
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import {it} from '@jest/globals';
3
+ import {render} from '@testing-library/react-native';
4
+ import Button from './Button';
5
+
6
+ const customStyle = {backgroundColor: 'red', padding: 20};
7
+
8
+ const mockProps = {
9
+ onPress: jest.fn(),
10
+ title: 'Title',
11
+ buttonType: 'Primary',
12
+ buttonStyle: customStyle,
13
+ titleStyle: customStyle,
14
+ iconShown: true,
15
+ iconStyles: customStyle,
16
+ testID: 'CUSTOM-BUTTONS',
17
+ titleShown: true,
18
+ variant: 'H1bold',
19
+ };
20
+
21
+ const mockPropsDisable = {
22
+ onPress: jest.fn(),
23
+ title: 'Title',
24
+ buttonType: 'Primary',
25
+ buttonStyle: customStyle,
26
+ titleStyle: customStyle,
27
+ iconShown: false,
28
+ iconStyles: customStyle,
29
+ testID: 'CUSTOM-BUTTONS',
30
+ titleShown: false,
31
+ variant: 'H1bold',
32
+ };
33
+
34
+ describe('Button Component', () => {
35
+ it('Component renders correctly', () => {
36
+ const {getByTestId} = render(<Button {...mockProps} />);
37
+ expect(getByTestId('CUSTOM-BUTTONS')).toBeTruthy();
38
+ });
39
+ it('Component renders correctly When title shown false', () => {
40
+ const {getByTestId} = render(<Button {...mockPropsDisable} />);
41
+ expect(getByTestId('CUSTOM-BUTTONS')).toBeTruthy();
42
+ });
43
+ });
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import {Pressable, View} from 'react-native';
3
+ import styles from './Button.styles';
4
+ import {BUTTON_TYPES} from '../../utils/constants';
5
+ import {ButtonProps} from './Button.interface';
6
+ import {DHRE_COLORS_TEXT} from '../../theme/colors';
7
+ import CustomTypography from '../customTypography/CustomTypography';
8
+
9
+ const Button: React.FC<ButtonProps> = ({
10
+ onPress,
11
+ title = '',
12
+ buttonType = BUTTON_TYPES.PRIMARY,
13
+ buttonStyle,
14
+ titleStyle,
15
+ variant,
16
+ iconStyles,
17
+ testID,
18
+ titleShown = true,
19
+ iconShown = false,
20
+ iconName,
21
+ }) => {
22
+ const buttonStyles = [styles.button, styles[buttonType], buttonStyle];
23
+ const textStyle = [styles[buttonType + BUTTON_TYPES.TEXT], titleStyle];
24
+ const iconStyle = [styles.iconStyle, iconStyles];
25
+
26
+ return (
27
+ <View testID={testID} style={styles.mainContainer}>
28
+ <Pressable
29
+ disabled={buttonType === BUTTON_TYPES.DISABLE}
30
+ onPress={onPress}
31
+ style={buttonStyles}>
32
+ <View style={styles.directionStyle}>
33
+ {titleShown ? (
34
+ <CustomTypography
35
+ variant={variant}
36
+ style={textStyle}
37
+ text={title}
38
+ />
39
+ ) : null}
40
+ {iconShown && iconName && (
41
+ <View style={iconStyle}>
42
+ {React.cloneElement(iconName, {
43
+ fill: DHRE_COLORS_TEXT.DH_WHITE,
44
+ })}
45
+ </View>
46
+ )}
47
+ </View>
48
+ </Pressable>
49
+ </View>
50
+ );
51
+ };
52
+
53
+ export default Button;
@@ -0,0 +1 @@
1
+ export {default} from './Button';
@@ -0,0 +1,13 @@
1
+ import {ReactNode} from 'react';
2
+
3
+ export interface CardsProps {
4
+ topLeftTitle?: string;
5
+ subtitle?: string;
6
+ iconTitle?: string;
7
+ iconSource?: ReactNode;
8
+ buttonText?: string;
9
+ title?: string;
10
+ buttonShown?: boolean;
11
+ testID?: string;
12
+ onButtonPress?: () => void;
13
+ }
@@ -0,0 +1,59 @@
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
+ padding: horizontalScale(20),
8
+ marginHorizontal: horizontalScale(16),
9
+ justifyContent: 'space-between',
10
+ backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
11
+ },
12
+ topLeft: {
13
+ alignSelf: 'flex-start',
14
+ paddingVertical: verticalScale(4),
15
+ paddingHorizontal: horizontalScale(12),
16
+ backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
17
+ borderWidth: 1,
18
+ borderColor: DHRE_COLORS_TEXT.DH_LIGHTGREEN,
19
+ borderRadius: 50,
20
+ },
21
+ title: {
22
+ color: DHRE_COLORS_TEXT.DH_LIGHTGREEN,
23
+ },
24
+ subTitleBelow: {
25
+ marginTop: verticalScale(12),
26
+ color: DHRE_COLORS_TEXT.DH_TEXTDARK,
27
+ },
28
+ subtitle: {
29
+ letterSpacing: 0.5,
30
+ marginTop: verticalScale(8),
31
+ color: DHRE_COLORS_TEXT.DH_TEXTLIGHT,
32
+ },
33
+ leftBottomView: {
34
+ flexDirection: 'row',
35
+ alignItems: 'center',
36
+ marginTop: verticalScale(8),
37
+ },
38
+ subTitleLeftBelow: {
39
+ letterSpacing: 0.5,
40
+ marginTop: verticalScale(4),
41
+ marginBottom: verticalScale(4),
42
+ marginLeft: horizontalScale(4),
43
+ color: DHRE_COLORS_TEXT.DH_TEXTLIGHT,
44
+ },
45
+ button: {
46
+ backgroundColor: DHRE_COLORS_TEXT.DH_BLACK,
47
+ paddingVertical: verticalScale(6),
48
+ paddingHorizontal: horizontalScale(34),
49
+ borderRadius: 50,
50
+ position: 'absolute',
51
+ bottom: verticalScale(20),
52
+ right: horizontalScale(20),
53
+ },
54
+ buttonText: {
55
+ color: DHRE_COLORS_TEXT.DH_WHITE,
56
+ },
57
+ });
58
+
59
+ export default styles;
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import {it} from '@jest/globals';
3
+ import {fireEvent, render} from '@testing-library/react-native';
4
+ import {CalenderDots} from '../../assets';
5
+ import Cards from './Cards';
6
+
7
+ const mockProps = {
8
+ topLeftTitle: 'LeftTitle',
9
+ subtitle: 'SubTitle',
10
+ iconTitle: 'IconTitle',
11
+ iconSource: <CalenderDots />,
12
+ buttonText: 'Button',
13
+ title: 'Title',
14
+ buttonShown: true,
15
+ testID: 'CARDS-COMPONENT',
16
+ onButtonPress: jest.fn(),
17
+ };
18
+
19
+ const mockDisableProps = {
20
+ topLeftTitle: undefined,
21
+ subtitle: undefined,
22
+ iconTitle: undefined,
23
+ iconSource: <CalenderDots />,
24
+ buttonText: 'Button',
25
+ title: undefined,
26
+ buttonShown: false,
27
+ testID: 'CARDS-COMPONENT',
28
+ onButtonPress: jest.fn(),
29
+ };
30
+
31
+ describe('Cards Component', () => {
32
+ it('Component renders correctly', () => {
33
+ const {getByTestId} = render(<Cards {...mockProps} />);
34
+ expect(getByTestId('CARDS-COMPONENT')).toBeTruthy();
35
+ fireEvent.press(getByTestId('Button-Press'));
36
+ });
37
+ it('Component renders correctly when title, subTitle and other props are not passed', () => {
38
+ const {getByTestId} = render(<Cards {...mockDisableProps} />);
39
+ expect(getByTestId('CARDS-COMPONENT')).toBeTruthy();
40
+ });
41
+ });
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+ import {View, Pressable} from 'react-native';
3
+ import {CardsProps} from './Cards.interface';
4
+ import CustomTypography from '../customTypography/CustomTypography';
5
+ import styles from './Cards.styles';
6
+
7
+ const Cards: React.FC<CardsProps> = ({
8
+ topLeftTitle,
9
+ subtitle,
10
+ title,
11
+ iconSource,
12
+ buttonText,
13
+ iconTitle,
14
+ buttonShown,
15
+ testID,
16
+ onButtonPress,
17
+ }) => {
18
+ return (
19
+ <View testID={testID} style={styles.container}>
20
+ {topLeftTitle ? (
21
+ <View style={styles.topLeft}>
22
+ <CustomTypography
23
+ variant="P2regular"
24
+ style={styles.title}
25
+ text={topLeftTitle}
26
+ />
27
+ </View>
28
+ ) : null}
29
+ {title ? (
30
+ <CustomTypography
31
+ variant="H6bold"
32
+ style={styles.subTitleBelow}
33
+ text={title}
34
+ />
35
+ ) : null}
36
+ {subtitle ? (
37
+ <CustomTypography
38
+ variant="P3regular"
39
+ style={styles.subtitle}
40
+ text={subtitle}
41
+ />
42
+ ) : null}
43
+ <View style={styles.leftBottomView}>
44
+ {iconSource ? iconSource : null}
45
+ {iconTitle ? (
46
+ <CustomTypography
47
+ variant="P3regular"
48
+ style={styles.subTitleLeftBelow}
49
+ text={iconTitle}
50
+ />
51
+ ) : null}
52
+ </View>
53
+ {buttonShown ? (
54
+ <Pressable
55
+ testID="Button-Press"
56
+ style={styles.button}
57
+ onPress={onButtonPress}>
58
+ <CustomTypography
59
+ variant="B2semiBold"
60
+ style={styles.buttonText}
61
+ text={buttonText}
62
+ />
63
+ </Pressable>
64
+ ) : null}
65
+ </View>
66
+ );
67
+ };
68
+
69
+ export default Cards;
@@ -0,0 +1 @@
1
+ export {default} from './Cards';
@@ -0,0 +1,10 @@
1
+ export interface CheckBoxProps {
2
+ isChecked: boolean;
3
+ onCheck?: (checked: boolean) => void;
4
+ labelName: string;
5
+ disable?: boolean;
6
+ isCircle?: boolean;
7
+ testID?: string;
8
+ checkedIcon: React.ReactElement;
9
+ uncheckedIcon: React.ReactElement;
10
+ }
@@ -0,0 +1,36 @@
1
+ import {StyleSheet} from 'react-native';
2
+ import {horizontalScale, verticalScale} from '../../utils/stylehelper';
3
+ import {DHRE_COLORS_TEXT} from '../../theme/colors';
4
+
5
+ const styles = StyleSheet.create({
6
+ checkboxContainer: {
7
+ alignItems: 'center',
8
+ justifyContent: 'center',
9
+ },
10
+ checkboxImage: {
11
+ width: horizontalScale(18),
12
+ height: verticalScale(18),
13
+ backgroundColor: DHRE_COLORS_TEXT.DH_BLACK,
14
+ resizeMode: 'contain',
15
+ },
16
+ uncheckedCheckbox: {
17
+ width: horizontalScale(18),
18
+ height: verticalScale(18),
19
+ overflow: 'hidden',
20
+ borderRadius: 1,
21
+ borderWidth: 1,
22
+ borderColor: DHRE_COLORS_TEXT.DH_BLACK,
23
+ },
24
+ directionStyle: {
25
+ flexDirection: 'row',
26
+ justifyContent: 'center',
27
+ alignItems: 'center',
28
+ gap: horizontalScale(8),
29
+ marginTop: verticalScale(18),
30
+ },
31
+ labelStyle: {
32
+ color: DHRE_COLORS_TEXT.DH_TEXTDARK,
33
+ },
34
+ });
35
+
36
+ export default styles;
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import {it} from '@jest/globals';
3
+ import {fireEvent, render} from '@testing-library/react-native';
4
+ import CheckBox from './CheckBox';
5
+ import {CalenderDots} from '../../assets';
6
+
7
+ const mockProps = {
8
+ isChecked: true,
9
+ onCheck: jest.fn(),
10
+ labelName: 'Label',
11
+ disable: false,
12
+ isCircle: false,
13
+ testID: 'CHECKBOX-COMPONENT',
14
+ };
15
+ const mockCircleProps = {
16
+ isChecked: false,
17
+ onCheck: jest.fn(),
18
+ labelName: 'Label',
19
+ disable: true,
20
+ isCircle: true,
21
+ testID: 'CHECKBOX-COMPONENT',
22
+ };
23
+
24
+ describe('CheckBox Component', () => {
25
+ it('Component renders correctly', () => {
26
+ const {getByTestId} = render(
27
+ <CheckBox
28
+ checkedIcon={<CalenderDots />}
29
+ uncheckedIcon={<CalenderDots />}
30
+ {...mockProps}
31
+ />,
32
+ );
33
+ expect(getByTestId('CHECKBOX-COMPONENT')).toBeTruthy();
34
+ fireEvent.press(getByTestId('Checkbox-Press'));
35
+ });
36
+ it('Component renders correctly when checkbox type is circle', () => {
37
+ const {getByTestId} = render(
38
+ <CheckBox
39
+ checkedIcon={<CalenderDots />}
40
+ uncheckedIcon={<CalenderDots />}
41
+ {...mockCircleProps}
42
+ />,
43
+ );
44
+ expect(getByTestId('CHECKBOX-COMPONENT')).toBeTruthy();
45
+ });
46
+ });
@@ -0,0 +1,42 @@
1
+ import React, {useState} from 'react';
2
+ import {View, Pressable} from 'react-native';
3
+ import {CheckBoxProps} from './CheckBox.interface';
4
+ import styles from './CheckBox.styles';
5
+ import CustomTypography from '../customTypography/CustomTypography';
6
+
7
+ const Checkbox: React.FC<CheckBoxProps> = ({
8
+ isChecked,
9
+ onCheck,
10
+ labelName,
11
+ disable,
12
+ testID,
13
+ checkedIcon,
14
+ uncheckedIcon,
15
+ }) => {
16
+ const [checked, setChecked] = useState(isChecked || false);
17
+
18
+ const handlePress = () => {
19
+ setChecked(!checked);
20
+ onCheck && onCheck(!checked);
21
+ };
22
+
23
+ return (
24
+ <View testID={testID}>
25
+ <Pressable
26
+ testID={'Checkbox-Press'}
27
+ onPress={handlePress}
28
+ disabled={disable}
29
+ style={({pressed}) => [
30
+ styles.directionStyle,
31
+ {opacity: pressed ? 0.5 : 1},
32
+ ]}>
33
+ <View style={styles.checkboxContainer}>
34
+ {React.cloneElement(checked ? checkedIcon : uncheckedIcon)}
35
+ </View>
36
+ <CustomTypography variant="H8medium" text={labelName} />
37
+ </Pressable>
38
+ </View>
39
+ );
40
+ };
41
+
42
+ export default Checkbox;
@@ -0,0 +1 @@
1
+ export {default} from './CheckBox';
@@ -0,0 +1,15 @@
1
+ import {ReactElement} from 'react';
2
+ import {ViewStyle} from 'react-native';
3
+
4
+ export interface CustomDropdownProps {
5
+ label: string;
6
+ placeholder?: string;
7
+ options: Array<{id: string; value: string; label: string}>;
8
+ selectedValue?: {id: string; value: string; label: string};
9
+ oneSelect: (option: {id: string; value: string; label: string}) => void;
10
+ testId?: string;
11
+ iconName?: ReactElement;
12
+ iconStyle?: ViewStyle;
13
+ upArrowIcon: ReactElement;
14
+ downArrowIcon: ReactElement;
15
+ }
@@ -0,0 +1,46 @@
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;
@@ -0,0 +1,30 @@
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
+ });