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.
Files changed (218) hide show
  1. package/{src/assets/index.ts → lib/assets/index.d.ts} +1 -18
  2. package/lib/index.d.ts +862 -0
  3. package/lib/index.esm.js +2 -0
  4. package/lib/index.esm.js.map +1 -0
  5. package/lib/index.js +4333 -0
  6. package/lib/index.js.map +1 -0
  7. package/lib/index.mjs +4248 -0
  8. package/lib/index.mjs.map +1 -0
  9. package/lib/theme/ThemeContext.d.ts +10 -0
  10. package/lib/theme/colors.d.ts +166 -0
  11. package/lib/theme/fonts.d.ts +8 -0
  12. package/lib/theme/themes.d.ts +131 -0
  13. package/lib/theme/withThemeProvider.d.ts +2 -0
  14. package/lib/utils/appEnum.d.ts +90 -0
  15. package/lib/utils/commonStyles.d.ts +15 -0
  16. package/lib/utils/constants.d.ts +19 -0
  17. package/lib/utils/deviceUtils.d.ts +7 -0
  18. package/lib/utils/regex.d.ts +1 -0
  19. package/lib/utils/stylehelper.d.ts +5 -0
  20. package/package.json +61 -81
  21. package/README.md +0 -1
  22. package/__mocks__/custom-text.mock.tsx +0 -19
  23. package/__mocks__/setup-tests.ts +0 -24
  24. package/__mocks__/svgMock.ts +0 -2
  25. package/src/App.tsx +0 -43
  26. package/src/assets/fonts/MeraasAktiv_Bd.ttf +0 -0
  27. package/src/assets/fonts/MeraasAktiv_Lt.ttf +0 -0
  28. package/src/assets/fonts/MeraasAktiv_Rg.ttf +0 -0
  29. package/src/assets/images/arrowLeft.svg +0 -3
  30. package/src/assets/images/bellSimple.svg +0 -3
  31. package/src/assets/images/calenderDots.svg +0 -1
  32. package/src/assets/images/caretDown.svg +0 -3
  33. package/src/assets/images/caretLeft.svg +0 -3
  34. package/src/assets/images/caretRight.svg +0 -3
  35. package/src/assets/images/caretUp.svg +0 -3
  36. package/src/assets/images/checkWhite.svg +0 -3
  37. package/src/assets/images/circleTick.svg +0 -3
  38. package/src/assets/images/crossIcon.svg +0 -3
  39. package/src/assets/images/dotsThreeVertical.svg +0 -5
  40. package/src/assets/images/fileIcon.svg +0 -8
  41. package/src/assets/images/searchIcon.svg +0 -4
  42. package/src/assets/images/trash.svg +0 -7
  43. package/src/assets/images/uploadFileIcon.svg +0 -12
  44. package/src/components/ContactModel/ContactModel.tsx +0 -206
  45. package/src/components/ContactModel/index.ts +0 -1
  46. package/src/components/OutOfOffice/OurOffices.tsx +0 -91
  47. package/src/components/OutOfOffice/index.ts +0 -1
  48. package/src/components/accordion/Accordion.interface.ts +0 -16
  49. package/src/components/accordion/Accordion.styles.ts +0 -28
  50. package/src/components/accordion/Accordion.test.tsx +0 -21
  51. package/src/components/accordion/Accordion.tsx +0 -85
  52. package/src/components/accordion/index.ts +0 -1
  53. package/src/components/autoOtpReader/AutoOtpReader.test.tsx +0 -56
  54. package/src/components/autoOtpReader/AutoOtpReader.tsx +0 -79
  55. package/src/components/autoOtpReader/index.ts +0 -1
  56. package/src/components/badge/Badge.styles.ts +0 -20
  57. package/src/components/badge/Badge.test.tsx +0 -57
  58. package/src/components/badge/Badge.tsx +0 -48
  59. package/src/components/badge/index.ts +0 -1
  60. package/src/components/bottomDrawer/BottomDrawer.interface.ts +0 -23
  61. package/src/components/bottomDrawer/BottomDrawer.styles.ts +0 -47
  62. package/src/components/bottomDrawer/BottomDrawer.test.tsx +0 -19
  63. package/src/components/bottomDrawer/BottomDrawer.tsx +0 -92
  64. package/src/components/bottomDrawer/index.ts +0 -1
  65. package/src/components/button/Button.interface.ts +0 -19
  66. package/src/components/button/Button.styles.ts +0 -78
  67. package/src/components/button/Button.test.tsx +0 -43
  68. package/src/components/button/Button.tsx +0 -82
  69. package/src/components/button/index.ts +0 -1
  70. package/src/components/cards/Cards.interface.ts +0 -13
  71. package/src/components/cards/Cards.styles.ts +0 -59
  72. package/src/components/cards/Cards.test.tsx +0 -41
  73. package/src/components/cards/Cards.tsx +0 -69
  74. package/src/components/cards/index.ts +0 -1
  75. package/src/components/checkBox/CheckBox.interface.ts +0 -15
  76. package/src/components/checkBox/CheckBox.styles.ts +0 -35
  77. package/src/components/checkBox/CheckBox.test.tsx +0 -46
  78. package/src/components/checkBox/CheckBox.tsx +0 -50
  79. package/src/components/checkBox/index.ts +0 -1
  80. package/src/components/countryPicker/CountryPicker.tsx +0 -169
  81. package/src/components/countryPicker/index.ts +0 -1
  82. package/src/components/customDocumentPicker/CustomDocumentPicker.interface.ts +0 -13
  83. package/src/components/customDocumentPicker/CustomDocumentPicker.styles.ts +0 -33
  84. package/src/components/customDocumentPicker/CustomDocumentPicker.tsx +0 -100
  85. package/src/components/customDocumentPicker/index.ts +0 -1
  86. package/src/components/customDropdown/CustomDropdown.interface.ts +0 -15
  87. package/src/components/customDropdown/CustomDropdown.styles.tsx +0 -46
  88. package/src/components/customDropdown/CustomDropdown.test.tsx +0 -30
  89. package/src/components/customDropdown/CustomDropdown.tsx +0 -106
  90. package/src/components/customDropdown/index.ts +0 -1
  91. package/src/components/customHeader/CustomHeader.interface.tsx +0 -10
  92. package/src/components/customHeader/CustomHeader.styles.ts +0 -26
  93. package/src/components/customHeader/CustomHeader.test.tsx +0 -14
  94. package/src/components/customHeader/CustomHeader.tsx +0 -46
  95. package/src/components/customHeader/index.ts +0 -1
  96. package/src/components/customIcon/CustomIcon.interface.ts +0 -12
  97. package/src/components/customIcon/CustomIcon.styles.ts +0 -13
  98. package/src/components/customIcon/CustomIcon.test.tsx +0 -14
  99. package/src/components/customIcon/CustomIcon.tsx +0 -33
  100. package/src/components/customIcon/index.ts +0 -1
  101. package/src/components/customInputText/CustomInputText.interface.ts +0 -20
  102. package/src/components/customInputText/CustomInputText.styles.ts +0 -56
  103. package/src/components/customInputText/CustomInputText.test.tsx +0 -37
  104. package/src/components/customInputText/CustomInputText.tsx +0 -120
  105. package/src/components/customInputText/index.ts +0 -1
  106. package/src/components/customLoader/CustomLoader.inteface.ts +0 -3
  107. package/src/components/customLoader/CustomLoader.styles.ts +0 -16
  108. package/src/components/customLoader/CustomLoader.tsx +0 -16
  109. package/src/components/customLoader/index.ts +0 -1
  110. package/src/components/customSearchBar/CustomSearchBar.interface.ts +0 -21
  111. package/src/components/customSearchBar/CustomSearchBar.styles.ts +0 -23
  112. package/src/components/customSearchBar/CustomSearchBar.test.tsx +0 -27
  113. package/src/components/customSearchBar/CustomSearchBar.tsx +0 -87
  114. package/src/components/customSearchBar/index.ts +0 -1
  115. package/src/components/customSlideButton/custom-slide-button.interface.ts +0 -4
  116. package/src/components/customSlideButton/index.tsx +0 -78
  117. package/src/components/customSlideButton/styles.ts +0 -39
  118. package/src/components/customSwitchBtn/customSwitchBtn.interface.ts +0 -15
  119. package/src/components/customSwitchBtn/customSwitchBtn.styles.ts +0 -34
  120. package/src/components/customSwitchBtn/customSwitchBtn.tsx +0 -63
  121. package/src/components/customSwitchBtn/index.ts +0 -1
  122. package/src/components/customText/CustomText.tsx +0 -33
  123. package/src/components/customText/index.ts +0 -1
  124. package/src/components/customTooltip/CustomTooltip.interface.ts +0 -14
  125. package/src/components/customTooltip/CustomTooltip.styles.ts +0 -23
  126. package/src/components/customTooltip/CustomTooltip.test.tsx +0 -18
  127. package/src/components/customTooltip/CustomTooltip.tsx +0 -46
  128. package/src/components/customTooltip/index.ts +0 -1
  129. package/src/components/customTypography/CustomTypography.test.tsx +0 -12
  130. package/src/components/customTypography/CustomTypography.tsx +0 -27
  131. package/src/components/customTypography/index.ts +0 -1
  132. package/src/components/dateRangePicker/DateRangePicker.interface.ts +0 -19
  133. package/src/components/dateRangePicker/DateRangePicker.styles.ts +0 -19
  134. package/src/components/dateRangePicker/DateRangePicker.tsx +0 -108
  135. package/src/components/dateRangePicker/index.ts +0 -1
  136. package/src/components/dropDown/DropDown.tsx +0 -145
  137. package/src/components/dropDown/index.ts +0 -1
  138. package/src/components/feedback/feedback.style.ts +0 -48
  139. package/src/components/feedback/feedback.tsx +0 -61
  140. package/src/components/feedback/index.ts +0 -1
  141. package/src/components/fileUpload/FileUpload.styles.ts +0 -41
  142. package/src/components/fileUpload/FileUpload.test.tsx +0 -39
  143. package/src/components/fileUpload/FileUpload.tsx +0 -65
  144. package/src/components/fileUpload/index.ts +0 -1
  145. package/src/components/horizontalLine/Line.tsx +0 -26
  146. package/src/components/horizontalLine/index.ts +0 -1
  147. package/src/components/notificationBandge/NotificationBandge.interface.tsx +0 -3
  148. package/src/components/notificationBandge/NotificationBandge.styles.tsx +0 -26
  149. package/src/components/notificationBandge/NotificationBandge.tsx +0 -26
  150. package/src/components/notificationBandge/index.tsx +0 -1
  151. package/src/components/otp/index.tsx +0 -166
  152. package/src/components/otp/otp.interface.ts +0 -14
  153. package/src/components/otp/styles.ts +0 -29
  154. package/src/components/pdfView/PdfView.test.tsx +0 -12
  155. package/src/components/pdfView/PdfView.tsx +0 -8
  156. package/src/components/pdfView/index.ts +0 -1
  157. package/src/components/popup/PopUp.interface.ts +0 -9
  158. package/src/components/popup/PopUp.styles.ts +0 -52
  159. package/src/components/popup/PopUp.test.tsx +0 -35
  160. package/src/components/popup/PopUp.tsx +0 -60
  161. package/src/components/popup/index.ts +0 -1
  162. package/src/components/progressBar/ProgressBar.test.tsx +0 -78
  163. package/src/components/progressBar/ProgressBar.tsx +0 -120
  164. package/src/components/progressBar/index.ts +0 -1
  165. package/src/components/property360View/Property360View.test.tsx +0 -24
  166. package/src/components/property360View/Property360View.tsx +0 -19
  167. package/src/components/property360View/index.ts +0 -1
  168. package/src/components/rating/index.ts +0 -1
  169. package/src/components/rating/rating.styles.ts +0 -13
  170. package/src/components/rating/rating.test.tsx +0 -61
  171. package/src/components/rating/rating.tsx +0 -96
  172. package/src/components/scrollList/category.tsx +0 -110
  173. package/src/components/scrollList/index.ts +0 -1
  174. package/src/components/singleSelectionTag/TagSingleSelection.tsx +0 -105
  175. package/src/components/singleSelectionTag/index.ts +0 -1
  176. package/src/components/stepper/index.tsx +0 -105
  177. package/src/components/stepper/stepper.interface.ts +0 -24
  178. package/src/components/stepper/styles.ts +0 -74
  179. package/src/components/swipableList/SwipableList.interface.ts +0 -52
  180. package/src/components/swipableList/SwipableList.styles.ts +0 -30
  181. package/src/components/swipableList/SwipableList.test.tsx +0 -209
  182. package/src/components/swipableList/SwipableList.tsx +0 -137
  183. package/src/components/swipableList/index.ts +0 -1
  184. package/src/components/tabs/Tabs.interface.ts +0 -10
  185. package/src/components/tabs/Tabs.styles.ts +0 -24
  186. package/src/components/tabs/Tabs.tsx +0 -74
  187. package/src/components/tabs/index.ts +0 -1
  188. package/src/components/tags/Tags.interface.ts +0 -12
  189. package/src/components/tags/Tags.styles.ts +0 -36
  190. package/src/components/tags/Tags.test.tsx +0 -22
  191. package/src/components/tags/Tags.tsx +0 -76
  192. package/src/components/tags/index.ts +0 -1
  193. package/src/components/textInput/Textinput.tsx +0 -124
  194. package/src/components/textInput/index.ts +0 -1
  195. package/src/components/toast/Toast.interface.ts +0 -39
  196. package/src/components/toast/Toast.styles.ts +0 -41
  197. package/src/components/toast/Toast.test.tsx +0 -13
  198. package/src/components/toast/Toast.tsx +0 -115
  199. package/src/components/toast/ToastService.ts +0 -30
  200. package/src/components/toast/index.ts +0 -1
  201. package/src/components/toggleButton/ToggleButton.styles.ts +0 -40
  202. package/src/components/toggleButton/ToggleButton.test.tsx +0 -33
  203. package/src/components/toggleButton/ToggleButton.tsx +0 -78
  204. package/src/components/toggleButton/index.ts +0 -1
  205. package/src/components/topic/Topic.tsx +0 -85
  206. package/src/components/topic/index.ts +0 -1
  207. package/src/index.ts +0 -59
  208. package/src/theme/ThemeContext.tsx +0 -38
  209. package/src/theme/colors.ts +0 -186
  210. package/src/theme/fonts.ts +0 -72
  211. package/src/theme/themes.ts +0 -137
  212. package/src/theme/withThemeProvider.tsx +0 -14
  213. package/src/utils/appEnum.ts +0 -109
  214. package/src/utils/commonStyles.ts +0 -17
  215. package/src/utils/constants.ts +0 -20
  216. package/src/utils/deviceUtils.ts +0 -14
  217. package/src/utils/regex.ts +0 -1
  218. package/src/utils/stylehelper.ts +0 -13
@@ -1,13 +0,0 @@
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
- }
@@ -1,59 +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
- 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;
@@ -1,41 +0,0 @@
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
- });
@@ -1,69 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export {default} from './Cards';
@@ -1,15 +0,0 @@
1
- import {TextStyle, ViewStyle} from 'react-native';
2
-
3
- export interface CheckBoxProps {
4
- isChecked: boolean;
5
- onCheck?: (checked: boolean) => void;
6
- labelName: string;
7
- disable?: boolean;
8
- isCircle?: boolean;
9
- testID?: string;
10
- checkedIcon: React.ReactElement;
11
- uncheckedIcon: React.ReactElement;
12
- titleVariant?: string;
13
- titleStyle?: TextStyle;
14
- containerStyle?: ViewStyle;
15
- }
@@ -1,35 +0,0 @@
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
- },
30
- labelStyle: {
31
- color: DHRE_COLORS_TEXT.DH_TEXTDARK,
32
- },
33
- });
34
-
35
- export default styles;
@@ -1,46 +0,0 @@
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
- });
@@ -1,50 +0,0 @@
1
- import React, {useEffect, 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
- titleVariant = 'L1_REGULAR',
16
- titleStyle,
17
- containerStyle,
18
- }) => {
19
- const [checked, setChecked] = useState(isChecked || false);
20
-
21
- useEffect(() => {
22
- setChecked(isChecked);
23
- }, [isChecked]);
24
-
25
- const handlePress = () => {
26
- setChecked(!checked);
27
- onCheck && onCheck(!checked);
28
- };
29
-
30
- return (
31
- <View testID={testID} style={containerStyle}>
32
- <Pressable
33
- testID={'Checkbox-Press'}
34
- onPress={handlePress}
35
- disabled={disable}
36
- style={styles.directionStyle}>
37
- <View style={styles.checkboxContainer}>
38
- {React.cloneElement(checked ? checkedIcon : uncheckedIcon)}
39
- </View>
40
- <CustomTypography
41
- variant={titleVariant}
42
- text={labelName}
43
- style={titleStyle}
44
- />
45
- </Pressable>
46
- </View>
47
- );
48
- };
49
-
50
- export default Checkbox;
@@ -1 +0,0 @@
1
- export {default} from './CheckBox';
@@ -1,169 +0,0 @@
1
- import React, {useState} from 'react';
2
- import {
3
- View,
4
- TextInput,
5
- StyleSheet,
6
- Text,
7
- ViewStyle,
8
- TextStyle,
9
- } from 'react-native';
10
- import CountryPicker, {
11
- Country,
12
- CountryCode,
13
- } from 'react-native-country-picker-modal';
14
- import {DHRE_COLORS_TEXT, DHRE_DEFAULT} from '../../theme/colors';
15
- import {
16
- moderateScale,
17
- horizontalScale,
18
- verticalScale,
19
- } from '../../utils/stylehelper';
20
- import CustomTypography from '../customTypography';
21
- import theme from '../../theme/themes';
22
- import {
23
- DEFAULT_CALLING_CODE,
24
- DEFAULT_COUNTRY_CODE,
25
- } from '../../utils/constants';
26
-
27
- interface MobileNumberInputProps {
28
- defaultCountryCode?: CountryCode;
29
- defaultCallingCode?: string;
30
- placeholder: string;
31
- onChangeText: (text: string) => void;
32
- value?: string;
33
- containerStyle?: ViewStyle;
34
- inputStyle?: TextStyle;
35
- countryPickerStyle?: ViewStyle;
36
- callingCodeStyle?: TextStyle;
37
- getCountryCode: (countryCode: string) => void;
38
- maxLength: number;
39
- errorMessage?: string;
40
- label: string;
41
- }
42
-
43
- const CountryDropDown = ({
44
- defaultCountryCode = DEFAULT_COUNTRY_CODE,
45
- defaultCallingCode = DEFAULT_CALLING_CODE,
46
- placeholder,
47
- onChangeText,
48
- value,
49
- containerStyle,
50
- inputStyle,
51
- countryPickerStyle,
52
- callingCodeStyle,
53
- getCountryCode,
54
- maxLength,
55
- errorMessage,
56
- label,
57
- }: MobileNumberInputProps) => {
58
- const [countryCode, setCountryCode] =
59
- useState<CountryCode>(defaultCountryCode);
60
- const [callingCode, setCallingCode] = useState<string>(defaultCallingCode);
61
- const [pickerVisible, setPickerVisible] = useState<boolean>(false);
62
- const [isFocused, setIsFocused] = useState<boolean>(false);
63
-
64
- const handleSelect = (country: Country) => {
65
- setCountryCode(country.cca2);
66
- setCallingCode(`+${country.callingCode[0]}`);
67
- getCountryCode(`+${country.callingCode[0]}`);
68
- };
69
-
70
- return (
71
- <>
72
- <View style={[styles.container, containerStyle]}>
73
- <View style={[styles.countryPickerContainer, countryPickerStyle]}>
74
- <CountryPicker
75
- withFilter
76
- withFlag
77
- countryCode={countryCode}
78
- withCallingCode
79
- onSelect={handleSelect}
80
- visible={pickerVisible}
81
- />
82
- <Text
83
- onPress={() => setPickerVisible(true)}
84
- style={[styles.callingCode, callingCodeStyle]}>
85
- {callingCode}
86
- </Text>
87
- </View>
88
- <View style={styles.flex}>
89
- {(isFocused || value) && (
90
- <CustomTypography
91
- variant={'L2_REGULAR'}
92
- text={label ?? ''}
93
- style={styles.floatingLabel}
94
- />
95
- )}
96
- <TextInput
97
- style={[styles.input, inputStyle]}
98
- placeholder={!isFocused ? placeholder : ''}
99
- keyboardType="phone-pad"
100
- value={value}
101
- onChangeText={onChangeText}
102
- onFocus={() => setIsFocused(true)}
103
- onBlur={() => setIsFocused(false)}
104
- maxLength={maxLength}
105
- placeholderTextColor={theme.CONTENT_SECONDRY['light']}
106
- />
107
- </View>
108
- </View>
109
- {errorMessage ? (
110
- <CustomTypography
111
- variant={'L2_REGULAR'}
112
- text={errorMessage ?? ''}
113
- style={{
114
- ...styles.errorStyle,
115
- color: DHRE_DEFAULT.DH_SEMENTIC_ERROR,
116
- }}
117
- />
118
- ) : null}
119
- </>
120
- );
121
- };
122
-
123
- const styles = StyleSheet.create({
124
- flex: {
125
- flex: 1,
126
- },
127
- container: {
128
- flexDirection: 'row',
129
- alignItems: 'center',
130
- borderColor: DHRE_COLORS_TEXT.DH_BLACK,
131
- borderWidth: 1,
132
- height: verticalScale(48),
133
- borderRadius: moderateScale(8),
134
- paddingHorizontal: horizontalScale(10),
135
- paddingVertical: verticalScale(0),
136
- marginTop: verticalScale(20),
137
- },
138
- countryPickerContainer: {
139
- flexDirection: 'row',
140
- alignItems: 'center',
141
- marginRight: horizontalScale(10),
142
- },
143
- callingCode: {
144
- fontSize: moderateScale(16),
145
- color: DHRE_COLORS_TEXT.DH_BLACK,
146
- },
147
- input: {
148
- flex: 1,
149
- fontSize: moderateScale(16),
150
- borderLeftWidth: 1,
151
- borderLeftColor: DHRE_COLORS_TEXT.DH_TEXTLIGHTEST,
152
- paddingLeft: horizontalScale(8),
153
- },
154
- floatingLabel: {
155
- position: 'absolute',
156
- left: horizontalScale(-88),
157
- top: verticalScale(-8),
158
- fontSize: moderateScale(12),
159
- color: DHRE_COLORS_TEXT.DH_BLACK,
160
- backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
161
- paddingHorizontal: horizontalScale(4),
162
- zIndex: 1,
163
- },
164
- errorStyle: {
165
- marginTop: verticalScale(4),
166
- },
167
- });
168
-
169
- export default CountryDropDown;
@@ -1 +0,0 @@
1
- export {default} from './CountryPicker';
@@ -1,13 +0,0 @@
1
- import {TextStyle, ViewStyle} from 'react-native';
2
- import {DocumentPickerResponse} from 'react-native-document-picker';
3
-
4
- export interface CustomDocumentPickerProps {
5
- onDocumentUpload: (base64: string, document?: DocumentPickerResponse) => void;
6
- title?: string;
7
- hint?: string;
8
- maxFileSize?: number;
9
- fileTypes?: string[];
10
- containerStyle?: ViewStyle;
11
- titleStyle?: TextStyle;
12
- hintStyle?: TextStyle;
13
- }
@@ -1,33 +0,0 @@
1
- import {StyleSheet} from 'react-native';
2
- import {
3
- verticalScale,
4
- horizontalScale,
5
- moderateScale,
6
- } from '../../utils/stylehelper';
7
-
8
- const styles = StyleSheet.create({
9
- container: {
10
- flexDirection: 'row',
11
- alignItems: 'center',
12
- justifyContent: 'space-between',
13
- paddingVertical: verticalScale(16),
14
- paddingHorizontal: horizontalScale(24),
15
- borderWidth: 1,
16
- borderStyle: 'dashed',
17
- borderRadius: moderateScale(8),
18
- marginBottom: verticalScale(8),
19
- },
20
- fileUploadContainerStyle: {
21
- flexDirection: 'row',
22
- alignItems: 'center',
23
- justifyContent: 'space-between',
24
- paddingVertical: verticalScale(16),
25
- paddingHorizontal: horizontalScale(24),
26
- borderRadius: moderateScale(8),
27
- marginBottom: verticalScale(8),
28
- },
29
- innerContainer: {flexDirection: 'row', columnGap: horizontalScale(24)},
30
- titleContainer: {gap: verticalScale(4)},
31
- });
32
-
33
- export default styles;
@@ -1,100 +0,0 @@
1
- import React, {useState, useCallback, memo} from 'react';
2
- import {View, Pressable, Alert} from 'react-native';
3
- import DocumentPicker, {
4
- DocumentPickerResponse,
5
- } from 'react-native-document-picker';
6
- import RNFS from 'react-native-fs';
7
- import {FileIcon, Trash, UploadFile} from '../../assets';
8
- import {FontStyle} from '../../utils/appEnum';
9
- import CustomTypography from '../customTypography';
10
- import {useTheme} from '../../theme/ThemeContext';
11
- import styles from './CustomDocumentPicker.styles';
12
- import {CustomDocumentPickerProps} from './CustomDocumentPicker.interface';
13
- import {withThemeProvider} from '../../theme/withThemeProvider';
14
-
15
- const CustomDocumentPicker = ({
16
- onDocumentUpload,
17
- title = 'Upload Images/Videos',
18
- hint = 'PNG, JPEG (max size. 4MB)',
19
- maxFileSize = 4,
20
- fileTypes = [DocumentPicker.types.images, DocumentPicker.types.pdf],
21
- containerStyle,
22
- titleStyle,
23
- hintStyle,
24
- }: CustomDocumentPickerProps) => {
25
- const [error, setError] = useState('');
26
- const [docDetails, setDocDetails] = useState<DocumentPickerResponse>();
27
- const {theme} = useTheme();
28
-
29
- const pickDocument = useCallback(async () => {
30
- try {
31
- const res = await DocumentPicker.pickSingle({
32
- type: fileTypes,
33
- });
34
-
35
- if (res?.size && res.size > maxFileSize * 1024 * 1024) {
36
- setError(
37
- `File size higher than ${maxFileSize}MB. Please upload a smaller file.`,
38
- );
39
- return;
40
- }
41
-
42
- setError(''); // Clear error on successful upload
43
- setDocDetails(res);
44
- const base64Data = await RNFS.readFile(res.uri, 'base64');
45
- onDocumentUpload(base64Data, res); // Pass base64 data to onDocumentUpload
46
- } catch (err) {
47
- if (DocumentPicker.isCancel(err)) {
48
- Alert.alert('User canceled the picker');
49
- } else if (err instanceof Error) {
50
- Alert.alert('Unknown Error: ' + err.message);
51
- } else {
52
- Alert.alert('Unknown Error: ' + JSON.stringify(err));
53
- }
54
- }
55
- }, [fileTypes, maxFileSize, onDocumentUpload]);
56
-
57
- const removeDocument = useCallback(() => {
58
- setDocDetails(undefined);
59
- }, []);
60
-
61
- return (
62
- <>
63
- <View
64
- style={[
65
- docDetails ? styles.fileUploadContainerStyle : styles.container,
66
- {borderColor: error ? theme.ERROR : theme.BORDER_SECONDRY},
67
- docDetails ? {backgroundColor: theme.SURFACE_SECONDARY} : {},
68
- containerStyle,
69
- ]}>
70
- <Pressable style={styles.innerContainer} onPress={pickDocument}>
71
- {docDetails ? <FileIcon /> : <UploadFile />}
72
- <View style={styles.titleContainer}>
73
- <CustomTypography
74
- variant={FontStyle.L2_REGULAR}
75
- text={docDetails?.name ?? title}
76
- style={[{color: theme.CONTENT_PRIMARY}, titleStyle]}
77
- />
78
- {!docDetails && (
79
- <CustomTypography
80
- variant={FontStyle.L3_REGULAR}
81
- text={hint}
82
- style={[{color: theme.CONTENT_SECONDRY}, hintStyle]}
83
- />
84
- )}
85
- </View>
86
- </Pressable>
87
- {docDetails && <Trash onPress={removeDocument} />}
88
- </View>
89
- {error && (
90
- <CustomTypography
91
- variant={FontStyle.L2_REGULAR}
92
- text={error}
93
- style={{color: theme.ERROR}}
94
- />
95
- )}
96
- </>
97
- );
98
- };
99
-
100
- export default withThemeProvider(memo(CustomDocumentPicker));
@@ -1 +0,0 @@
1
- export {default} from './CustomDocumentPicker';
@@ -1,15 +0,0 @@
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
- }