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,56 +0,0 @@
1
- import React from 'react';
2
- import {render} from '@testing-library/react-native';
3
- import AutoOtpReader from './AutoOtpReader';
4
- import RNOtpVerify from 'react-native-otp-verify';
5
- import {isAndroid} from '../../utils/deviceUtils';
6
-
7
- jest.mock('../../utils/deviceUtils', () => ({
8
- isAndroid: jest.fn(),
9
- }));
10
-
11
- const mockOnOtpDetected = jest.fn();
12
- const mockOnHashGenerated = jest.fn();
13
-
14
- describe('AutoOtpReader', () => {
15
- beforeEach(() => {
16
- jest.clearAllMocks();
17
- (isAndroid as jest.Mock).mockReturnValue(true);
18
- });
19
-
20
- it('should start listening for OTP on mount and generate hash', async () => {
21
- const otpMessage = 'Your OTP is 123456. Hash: xyz123';
22
- const generatedHash = 'hash123';
23
-
24
- (RNOtpVerify.getOtp as jest.Mock).mockResolvedValueOnce(undefined);
25
- (RNOtpVerify.getHash as jest.Mock).mockResolvedValueOnce(generatedHash);
26
- (RNOtpVerify.addListener as jest.Mock).mockImplementation(callback => {
27
- callback(otpMessage);
28
- });
29
- render(
30
- <AutoOtpReader
31
- onOtpDetected={mockOnOtpDetected}
32
- onHashGenerated={mockOnHashGenerated}
33
- />,
34
- );
35
- await new Promise(r => setTimeout(r, 0));
36
- expect(RNOtpVerify.getOtp).toHaveBeenCalled();
37
- expect(RNOtpVerify.addListener).toHaveBeenCalled();
38
- expect(mockOnOtpDetected).toHaveBeenCalledWith('123456');
39
- });
40
-
41
- it('should not call onHashGenerated if hash generation fails', async () => {
42
- (RNOtpVerify.getOtp as jest.Mock).mockResolvedValueOnce(undefined);
43
- (RNOtpVerify.getHash as jest.Mock).mockRejectedValueOnce(
44
- new Error('Hash generation error'),
45
- );
46
-
47
- render(
48
- <AutoOtpReader
49
- onOtpDetected={mockOnOtpDetected}
50
- onHashGenerated={mockOnHashGenerated}
51
- />,
52
- );
53
- await new Promise(r => setTimeout(r, 0));
54
- expect(mockOnHashGenerated).not.toHaveBeenCalled();
55
- });
56
- });
@@ -1,79 +0,0 @@
1
- import React, {useCallback, useEffect} from 'react';
2
- import {Keyboard} from 'react-native';
3
- import RNOtpVerify from 'react-native-otp-verify';
4
- import {isAndroid} from '../../utils/deviceUtils';
5
- import {stringLengthRegex} from '../../utils/regex';
6
-
7
- /**
8
- * Interface for the props of the AutoOtpReader component.
9
- */
10
- interface AutoOtpReaderProps {
11
- onOtpDetected: (otp: string) => void;
12
- onHashGenerated?: (hash: string) => void;
13
- }
14
-
15
- /**
16
- * AutoOtpReader component to automatically fetch OTP from the message for Android devices.
17
- *
18
- * - Generates a Hash using RNOtpVerify.getHash().
19
- * - Shares this Hash using an API request with OTP API.
20
- * - Appends this hash to the OTP message.
21
- * - Once the OTP message is received on the device, based on the matching hash, contents of the message will be copied to the OTP boxes.
22
- *
23
- * In iOS, use textContentType="oneTimeCode" for OTP autofill.
24
- *
25
- * @param props The props for the component.
26
- * @returns A null component as it only handles side effects.
27
- */
28
- const AutoOtpReader: React.FC<AutoOtpReaderProps> = ({
29
- onOtpDetected,
30
- onHashGenerated,
31
- }) => {
32
- const otpHandler = useCallback(
33
- (message: string) => {
34
- if (message) {
35
- try {
36
- const code = message.match(stringLengthRegex);
37
- if (code) {
38
- onOtpDetected(code[0]);
39
- }
40
- } catch (error) {
41
- console.log('ERROR::', error);
42
- } finally {
43
- RNOtpVerify.removeListener();
44
- Keyboard.dismiss();
45
- }
46
- }
47
- },
48
- [onOtpDetected],
49
- );
50
-
51
- const startListeningForOtp = useCallback(() => {
52
- RNOtpVerify.getOtp()
53
- .then(() => RNOtpVerify.addListener(otpHandler))
54
- .catch(error => console.log(error));
55
- }, [otpHandler]);
56
-
57
- useEffect(() => {
58
- if (isAndroid()) {
59
- startListeningForOtp();
60
- }
61
- return () => RNOtpVerify.removeListener();
62
- }, [startListeningForOtp]);
63
-
64
- useEffect(() => {
65
- if (isAndroid()) {
66
- RNOtpVerify.getHash()
67
- .then(hash => {
68
- if (hash && hash.length > 0 && onHashGenerated) {
69
- onHashGenerated(hash[0]);
70
- }
71
- })
72
- .catch(error => console.log(error));
73
- }
74
- }, [onHashGenerated]);
75
-
76
- return null;
77
- };
78
-
79
- export default AutoOtpReader;
@@ -1 +0,0 @@
1
- export {default} from './AutoOtpReader';
@@ -1,20 +0,0 @@
1
- import {StyleSheet} from 'react-native';
2
- import {horizontalScale, verticalScale} from '../../utils/stylehelper';
3
- import {DHRE_COLORS_ALERT, DHRE_COLORS_TEXT} from '../../theme/colors';
4
- const styles = StyleSheet.create({
5
- badge: {
6
- backgroundColor: DHRE_COLORS_ALERT.DH_SUCCESS_GREEN,
7
- borderRadius: 15,
8
- padding: verticalScale(4),
9
- },
10
- icon: {
11
- marginHorizontal: horizontalScale(4),
12
- height: verticalScale(16),
13
- width: horizontalScale(16),
14
- },
15
- text: {
16
- color: DHRE_COLORS_TEXT.DH_WHITE,
17
- },
18
- });
19
-
20
- export default styles;
@@ -1,57 +0,0 @@
1
- import React from 'react';
2
- import {render, screen} from '@testing-library/react-native';
3
- import Badge from './Badge';
4
- import {useSelector} from 'react-redux';
5
-
6
- // Mock the useSelector hook
7
-
8
- describe('Badge component', () => {
9
- beforeEach(() => {
10
- (useSelector as unknown as jest.Mock).mockImplementation(() => {
11
- return 'light';
12
- });
13
- });
14
-
15
- it('renders text correctly', () => {
16
- const text = 'Test Badge';
17
- render(
18
- <Badge
19
- text={text}
20
- handleIconPress={function (): void {
21
- throw new Error('Function not implemented.');
22
- }}
23
- />,
24
- );
25
-
26
- const badgeText = screen.getByText(text);
27
- expect(badgeText).toBeDefined();
28
- });
29
-
30
- it('renders icon correctly', () => {
31
- render(
32
- <Badge
33
- handleIconPress={function (): void {
34
- throw new Error('Function not implemented.');
35
- }}
36
- />,
37
- );
38
- // Your assertions here
39
- });
40
-
41
- it('renders with custom style', () => {
42
- const customStyle = {backgroundColor: 'red'};
43
- render(
44
- <Badge
45
- style={customStyle}
46
- handleIconPress={function (): void {
47
- throw new Error('Function not implemented.');
48
- }}
49
- />,
50
- );
51
-
52
- const badge = screen.getByTestId('BADGE');
53
- expect(badge).toBeDefined();
54
- // You can also check if the custom style is applied correctly
55
- expect(badge.props.style).toContainEqual(customStyle);
56
- });
57
- });
@@ -1,48 +0,0 @@
1
- import React, {ReactElement} from 'react';
2
- import {View, ViewStyle, TextStyle, Pressable} from 'react-native';
3
- import commonStyles from '../../utils/commonStyles';
4
- import styles from './Badge.styles';
5
- import {SvgProps} from 'react-native-svg';
6
- import CustomTypography from '../customTypography/CustomTypography';
7
- import {withThemeProvider} from '../../theme/withThemeProvider';
8
-
9
- interface BadgeProps {
10
- text?: string;
11
- style?: ViewStyle;
12
- iconName?: ReactElement<SvgProps>;
13
- textStyle?: TextStyle;
14
- iconStyle?: ViewStyle;
15
- handleIconPress: () => void;
16
- }
17
-
18
- const Badge: React.FC<BadgeProps> = ({
19
- text,
20
- style,
21
- iconName,
22
- textStyle,
23
- iconStyle,
24
- handleIconPress,
25
- }) => {
26
- return (
27
- <Pressable
28
- style={[styles.badge, commonStyles.centerRow, style]}
29
- testID="BADGE"
30
- onPress={handleIconPress}>
31
- {iconName && (
32
- <View style={[styles.icon, iconStyle]}>
33
- {React.cloneElement(iconName)}
34
- </View>
35
- )}
36
-
37
- {text && (
38
- <CustomTypography
39
- variant="B3semiBold"
40
- style={[styles.text, textStyle]}
41
- text={text}
42
- />
43
- )}
44
- </Pressable>
45
- );
46
- };
47
-
48
- export default withThemeProvider(Badge);
@@ -1 +0,0 @@
1
- export {default} from './Badge';
@@ -1,23 +0,0 @@
1
- import {TextStyle, ViewStyle} from 'react-native';
2
-
3
- export interface BottomDrawerProps {
4
- isModalVisible: boolean;
5
- toggleModal: () => void;
6
- isFullScreen?: boolean;
7
- children: React.ReactNode;
8
- title: string;
9
- testID?: string;
10
- style?: ViewStyle;
11
- modalContainerStyle?: ViewStyle;
12
- blurAmount?: number;
13
- blurViewStyle?: ViewStyle;
14
- showBlurView?: boolean;
15
- leftIcon?: React.ReactElement;
16
- rightIcon?: React.ReactElement;
17
- showLeftIcon?: boolean;
18
- showRightIcon?: boolean;
19
- onLeftIconPress?: () => void;
20
- titleStyle?: TextStyle;
21
- titleVariant?: string;
22
- showHeader?: boolean;
23
- }
@@ -1,47 +0,0 @@
1
- import {
2
- horizontalScale,
3
- moderateScale,
4
- verticalScale,
5
- } from '../../utils/stylehelper';
6
- import {StyleSheet} from 'react-native';
7
-
8
- const styles = StyleSheet.create({
9
- mainContainer: {
10
- flex: 1,
11
- justifyContent: 'flex-end',
12
- },
13
- blurView: {
14
- ...StyleSheet.absoluteFillObject,
15
- position: 'absolute',
16
- top: 0,
17
- left: 0,
18
- bottom: 0,
19
- right: 0,
20
- },
21
- modalContainer: {
22
- flex: 0.5,
23
- backgroundColor: '#000',
24
- paddingTop: moderateScale(8),
25
- paddingHorizontal: moderateScale(16),
26
- borderTopLeftRadius: moderateScale(22),
27
- borderTopRightRadius: moderateScale(22),
28
- },
29
- separator: {
30
- height: verticalScale(3),
31
- width: horizontalScale(32),
32
- alignSelf: 'center',
33
- backgroundColor: '#A7A7A7',
34
- borderRadius: moderateScale(25),
35
- },
36
- headerContainer: {
37
- flexDirection: 'row',
38
- justifyContent: 'space-between',
39
- alignItems: 'center',
40
- marginTop: verticalScale(24),
41
- },
42
- title: {flex: 1, color: '#fff'},
43
- leftIconStyle: {marginRight: 8},
44
- rightIconStyle: {marginLeft: 8},
45
- });
46
-
47
- export default styles;
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import {Text} from 'react-native';
3
- import {it} from '@jest/globals';
4
- import {render} from '@testing-library/react-native';
5
- import BottomDrawer from './BottomDrawer';
6
-
7
- const mockProps = {
8
- isModalVisible: true,
9
- toggleModal: jest.fn(),
10
- children: <Text>Mock Child</Text>,
11
- title: 'Test Title',
12
- };
13
-
14
- describe('Bottom Drawer Component', () => {
15
- it('Component renders correctly', () => {
16
- const {getByTestId} = render(<BottomDrawer {...mockProps} />);
17
- expect(getByTestId('BOTTOM-DRAWER')).toBeTruthy();
18
- });
19
- });
@@ -1,92 +0,0 @@
1
- import React from 'react';
2
- import {View, Modal, KeyboardAvoidingView, Platform} from 'react-native';
3
- import {PanGestureHandler} from 'react-native-gesture-handler';
4
- import {BlurView} from '@react-native-community/blur';
5
- import {BottomDrawerProps} from './BottomDrawer.interface';
6
- import styles from './BottomDrawer.styles';
7
- import CustomTypography from '../customTypography/CustomTypography';
8
- import {ArrowLeft, CrossIcon} from '../../assets';
9
- import {moderateScale} from '../../utils/stylehelper';
10
-
11
- const BottomDrawer: React.FC<BottomDrawerProps> = ({
12
- isModalVisible,
13
- toggleModal,
14
- children,
15
- title,
16
- testID = 'BOTTOM-DRAWER',
17
- style,
18
- modalContainerStyle,
19
- blurAmount = 10,
20
- blurViewStyle,
21
- showBlurView = true,
22
- showLeftIcon = false,
23
- showRightIcon = true,
24
- leftIcon = <ArrowLeft />,
25
- rightIcon = <CrossIcon />,
26
- onLeftIconPress,
27
- titleStyle,
28
- titleVariant = 'B2_REGULAR',
29
- showHeader = true,
30
- }) => {
31
- const onSwipDown = (event: {nativeEvent: {translationY: number}}) => {
32
- const {translationY} = event.nativeEvent;
33
- if (translationY > 50) {
34
- toggleModal();
35
- }
36
- };
37
-
38
- return (
39
- <Modal
40
- animationType="slide"
41
- transparent={true}
42
- visible={isModalVisible}
43
- onRequestClose={toggleModal}>
44
- <PanGestureHandler onGestureEvent={onSwipDown}>
45
- <KeyboardAvoidingView
46
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
47
- style={{flex: 1}}>
48
- <View style={[styles.mainContainer, style]} testID={testID}>
49
- {showBlurView ? (
50
- <BlurView
51
- style={[styles.blurView, blurViewStyle]}
52
- blurType="light"
53
- blurAmount={blurAmount}
54
- />
55
- ) : null}
56
- <View style={[styles.modalContainer, modalContainerStyle]}>
57
- {showHeader && (
58
- <>
59
- <View style={styles.separator} />
60
- <View style={styles.headerContainer}>
61
- {showLeftIcon &&
62
- React.cloneElement(leftIcon, {
63
- width: moderateScale(24),
64
- height: moderateScale(24),
65
- style: styles.leftIconStyle,
66
- onPress: onLeftIconPress,
67
- })}
68
- <CustomTypography
69
- variant={titleVariant}
70
- text={title}
71
- style={{...styles.title, ...titleStyle}}
72
- />
73
- {showRightIcon &&
74
- React.cloneElement(rightIcon, {
75
- width: moderateScale(24),
76
- height: moderateScale(24),
77
- style: styles.rightIconStyle,
78
- onPress: toggleModal,
79
- })}
80
- </View>
81
- </>
82
- )}
83
- {children}
84
- </View>
85
- </View>
86
- </KeyboardAvoidingView>
87
- </PanGestureHandler>
88
- </Modal>
89
- );
90
- };
91
-
92
- export default BottomDrawer;
@@ -1 +0,0 @@
1
- export {default} from './BottomDrawer';
@@ -1,19 +0,0 @@
1
- import {ReactElement} from 'react';
2
- import {StyleProp, TextStyle, ViewStyle} from 'react-native';
3
- import {SvgProps} from 'react-native-svg';
4
- export interface CustomButtonProps {
5
- title: string;
6
- onPress: () => void;
7
- containerStyle?: StyleProp<ViewStyle>;
8
- textStyle?: TextStyle;
9
- leftIcon?: ReactElement<SvgProps>;
10
- rightIcon?: ReactElement<SvgProps>;
11
- iconStyle?: ViewStyle;
12
- titleColor?: string;
13
- titleVariant?: string;
14
- imagePosition?: 'left' | 'right';
15
- testID?: string;
16
- disabled?: boolean;
17
- disabledColor?: string;
18
- disableButtonTitleColor?: string;
19
- }
@@ -1,78 +0,0 @@
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;
@@ -1,43 +0,0 @@
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
- });
@@ -1,82 +0,0 @@
1
- import React from 'react';
2
- import {StyleSheet, View, Pressable} from 'react-native';
3
- import CustomText from '../customText';
4
- import {useTheme} from '../../theme/ThemeContext';
5
- import {withThemeProvider} from '../../theme/withThemeProvider';
6
- import {CustomButtonProps} from './Button.interface';
7
-
8
- const CustomButton = ({
9
- title,
10
- testID,
11
- onPress,
12
- containerStyle,
13
- textStyle,
14
- leftIcon,
15
- rightIcon,
16
- iconStyle,
17
- titleColor,
18
- titleVariant = 'L2_REGULAR',
19
- imagePosition = 'right',
20
- disabled = false,
21
- disabledColor,
22
- disableButtonTitleColor,
23
- }: CustomButtonProps) => {
24
- const {theme} = useTheme();
25
- return (
26
- <Pressable
27
- testID={testID}
28
- style={[
29
- styles.buttonContainer,
30
- containerStyle,
31
- disabled
32
- ? {
33
- backgroundColor: disabledColor
34
- ? disabledColor
35
- : theme.SURFACE_DISABLE,
36
- }
37
- : {},
38
- ]}
39
- onPress={onPress}
40
- disabled={disabled}>
41
- {imagePosition === 'left' && leftIcon && (
42
- <View style={iconStyle}>
43
- {React.cloneElement(leftIcon, {width: 20, height: 20})}
44
- </View>
45
- )}
46
- <CustomText
47
- text={title}
48
- variant={titleVariant}
49
- style={[
50
- textStyle,
51
- disabled
52
- ? {
53
- color: disableButtonTitleColor
54
- ? disableButtonTitleColor
55
- : theme.CONTENT_DISABLE,
56
- }
57
- : {},
58
- ]}
59
- textColor={titleColor}
60
- />
61
-
62
- {imagePosition === 'right' && rightIcon && (
63
- <View style={iconStyle}>
64
- {React.cloneElement(rightIcon, {width: 20, height: 20})}
65
- </View>
66
- )}
67
- </Pressable>
68
- );
69
- };
70
-
71
- const styles = StyleSheet.create({
72
- buttonContainer: {
73
- flexDirection: 'row',
74
- alignItems: 'center',
75
- padding: 10,
76
- backgroundColor: '#000000',
77
- borderRadius: 8,
78
- justifyContent: 'center',
79
- },
80
- });
81
-
82
- export default withThemeProvider(CustomButton);
@@ -1 +0,0 @@
1
- export {default} from './Button';