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,209 +0,0 @@
1
- import React from 'react';
2
- import {fireEvent, render} from '@testing-library/react-native';
3
- import SwipableList from './SwipableList';
4
- import {CalenderDots} from '../../assets';
5
- import {Text} from 'react-native';
6
-
7
- jest.mock('react-native-gesture-handler', () => {
8
- const mockGestureHandler = {
9
- swipeable: jest.fn(),
10
- gestureHandlerRootHOC: jest.fn(),
11
- };
12
- return {
13
- PanGestureHandler: mockGestureHandler,
14
- TapGestureHandler: mockGestureHandler,
15
- LongPressGestureHandler: mockGestureHandler,
16
- State: {},
17
- Directions: {},
18
- Swipeable: jest
19
- .fn()
20
- .mockImplementation(
21
- ({children, renderLeftActions, renderRightActions}) => (
22
- <div>
23
- {renderLeftActions && renderLeftActions()}
24
- {children}
25
- {renderRightActions && renderRightActions()}
26
- </div>
27
- ),
28
- ),
29
- GestureHandlerRootView: jest
30
- .fn()
31
- .mockImplementation(({children}) => <div>{children}</div>),
32
- };
33
- });
34
- const customStyle = {backgroundColor: 'red', padding: 20};
35
-
36
- describe('Notification Component', () => {
37
- const notifications = [
38
- {
39
- id: '1',
40
- title: 'Notification 1',
41
- isPinned: false,
42
- isRead: true,
43
- templateId: 1,
44
- subTitle: 'Welcome Albus',
45
- icon: 'https://svgshare.com/i/U7z.svg',
46
- isDeleted: false,
47
- isActionable: false,
48
- category: 'general',
49
- url: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8Y2lyY2xlIGN4PSI1MCIgY3k9IjUwIiByPSI0MCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIzIiBmaWxsPSJyZWQiIC8+Cjwvc3ZnPg==',
50
- channel: 'push',
51
- status: 'sent',
52
- createdBy: 'system',
53
- createdDateTime: '2024-09-02T12:00:00+05:30',
54
- },
55
- {
56
- id: '2',
57
- title: 'Notification 2',
58
- isPinned: true,
59
- isRead: false,
60
- templateId: 1,
61
- subTitle: 'Welcome Albus',
62
- icon: 'https://svgshare.com/i/U7z.svg',
63
- isDeleted: false,
64
- isActionable: false,
65
- category: 'general',
66
- url: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8Y2lyY2xlIGN4PSI1MCIgY3k9IjUwIiByPSI0MCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIzIiBmaWxsPSJyZWQiIC8+Cjwvc3ZnPg==',
67
- channel: 'push',
68
- status: 'sent',
69
- createdBy: 'system',
70
- createdDateTime: '2024-09-02T12:00:00+05:30',
71
- },
72
- ];
73
-
74
- const notificationsPinned = [
75
- {
76
- id: '1',
77
- title: 'Notification 1',
78
- isPinned: true,
79
- isRead: true,
80
- templateId: 1,
81
- subTitle: 'Welcome Albus',
82
- icon: 'https://svgshare.com/i/U7z.svg',
83
- isDeleted: false,
84
- isActionable: false,
85
- category: 'general',
86
- url: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8Y2lyY2xlIGN4PSI1MCIgY3k9IjUwIiByPSI0MCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIzIiBmaWxsPSJyZWQiIC8+Cjwvc3ZnPg==',
87
- channel: 'push',
88
- status: 'sent',
89
- createdBy: 'system',
90
- createdDateTime: '2024-09-02T12:00:00+05:30',
91
- },
92
- {
93
- id: '2',
94
- title: 'Notification 2',
95
- isPinned: false,
96
- isRead: false,
97
- templateId: 1,
98
- subTitle: 'Welcome Albus',
99
- icon: 'https://svgshare.com/i/U7z.svg',
100
- isDeleted: false,
101
- isActionable: false,
102
- category: 'general',
103
- url: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8Y2lyY2xlIGN4PSI1MCIgY3k9IjUwIiByPSI0MCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIzIiBmaWxsPSJyZWQiIC8+Cjwvc3ZnPg==',
104
- channel: 'push',
105
- status: 'sent',
106
- createdBy: 'system',
107
- createdDateTime: '2024-09-02T12:00:00+05:30',
108
- },
109
- ];
110
-
111
- const notificationsUnPinned = [
112
- {
113
- id: '1',
114
- title: 'Notification 1',
115
- isPinned: false,
116
- isRead: false,
117
- templateId: 1,
118
- subTitle: 'Welcome Albus',
119
- icon: 'https://svgshare.com/i/U7z.svg',
120
- isDeleted: false,
121
- isActionable: false,
122
- category: 'general',
123
- url: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8Y2lyY2xlIGN4PSI1MCIgY3k9IjUwIiByPSI0MCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIzIiBmaWxsPSJyZWQiIC8+Cjwvc3ZnPg==',
124
- channel: 'push',
125
- status: 'sent',
126
- createdBy: 'system',
127
- createdDateTime: '2024-09-02T12:00:00+05:30',
128
- },
129
- {
130
- id: '2',
131
- title: 'Notification 2',
132
- isPinned: false,
133
- isRead: false,
134
- templateId: 1,
135
- subTitle: 'Welcome Albus',
136
- icon: 'https://svgshare.com/i/U7z.svg',
137
- isDeleted: false,
138
- isActionable: false,
139
- category: 'general',
140
- url: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8Y2lyY2xlIGN4PSI1MCIgY3k9IjUwIiByPSI0MCIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIzIiBmaWxsPSJyZWQiIC8+Cjwvc3ZnPg==',
141
- channel: 'push',
142
- status: 'sent',
143
- createdBy: 'system',
144
- createdDateTime: '2024-09-02T12:00:00+05:30',
145
- },
146
- ];
147
-
148
- const mockLeftPrimaryActionHandler = jest.fn();
149
- const mockRightPrimaryActionHandler = jest.fn();
150
- const mockLeftSecondaryActionHandler = jest.fn();
151
-
152
- const commonProps = {
153
- leftPrimaryActionIcon: <CalenderDots />,
154
- leftPrimaryActionHandler: mockLeftPrimaryActionHandler,
155
- leftPrimaryActionStyle: {backgroundColor: 'red'},
156
- leftSecondaryActionIcon: <CalenderDots />,
157
- leftSecondaryActionHandler: mockLeftSecondaryActionHandler,
158
- leftSecondaryActionStyle: {backgroundColor: 'blue'},
159
- rightPrimaryActionIcon: <CalenderDots />,
160
- rightPrimaryActionHandler: mockRightPrimaryActionHandler,
161
- rightPrimaryActionStyle: {backgroundColor: 'green'},
162
- itemStyle: customStyle,
163
- titleStyle: customStyle,
164
- };
165
-
166
- const props = {
167
- ...commonProps,
168
- data: notifications,
169
- leftPrimaryActionTitle: 'Pin',
170
- leftSecondaryActionTitle: 'Read',
171
- rightPrimaryActionTitle: 'Delete',
172
- };
173
- const propsUnPinned = {
174
- ...commonProps,
175
- data: notificationsUnPinned,
176
- leftPrimaryActionTitle: 'Pin',
177
- leftSecondaryActionTitle: 'Read',
178
- rightPrimaryActionTitle: 'Delete',
179
- };
180
-
181
- const propsPinned = {
182
- ...commonProps,
183
- data: notificationsPinned,
184
- leftPrimaryActionTitle: '',
185
- leftSecondaryActionTitle: '',
186
- rightPrimaryActionTitle: '',
187
- };
188
-
189
- it('renders Notification component correctly', () => {
190
- const {getByTestId} = render(
191
- <SwipableList {...props} renderItem={() => <Text>Title</Text>} />,
192
- );
193
- expect(getByTestId('SWIPABLE-LIST')).toBeTruthy();
194
- fireEvent.press(getByTestId('SWIPABLE-LIST-RIGHT-PRIMARY-1'));
195
- });
196
-
197
- it('renders Notification component when pinned', () => {
198
- const {getByTestId} = render(
199
- <SwipableList {...propsPinned} renderItem={() => <Text>Title</Text>} />,
200
- );
201
- expect(getByTestId('SWIPABLE-LIST')).toBeTruthy();
202
- });
203
- it('renders Notification component when pinned', () => {
204
- const {getByTestId} = render(
205
- <SwipableList {...propsUnPinned} renderItem={() => <Text>Title</Text>} />,
206
- );
207
- expect(getByTestId('SWIPABLE-LIST')).toBeTruthy();
208
- });
209
- });
@@ -1,137 +0,0 @@
1
- import React, {ReactNode} from 'react';
2
- import {FlatList, View, Pressable} from 'react-native';
3
- import {GestureHandlerRootView, Swipeable} from 'react-native-gesture-handler';
4
- import {
5
- ActionButtonProps,
6
- ListItem,
7
- SwipableListProps,
8
- } from './SwipableList.interface';
9
- import {styles} from './SwipableList.styles';
10
- import CustomTypography from '../customTypography/CustomTypography';
11
-
12
- const SwipableList = (props: SwipableListProps) => {
13
- const {
14
- data,
15
- testId = 'SWIPABLE-LIST',
16
- leftPrimaryActionActiveIcon,
17
- leftPrimaryActionInActiveIcon,
18
- leftPrimaryActionActiveTitle,
19
- leftPrimaryActionInActiveTitle,
20
- leftSecondaryActionActiveIcon,
21
- leftSecondaryActionInActiveIcon,
22
- leftSecondaryActionActiveTitle,
23
- leftSecondaryActionInActiveTitle,
24
- leftPrimaryActionHandler,
25
- leftPrimaryActionStyle,
26
- leftSecondaryActionHandler,
27
- leftSecondaryActionStyle,
28
- rightPrimaryActionIcon,
29
- rightPrimaryActionTitle,
30
- rightPrimaryActionHandler,
31
- rightPrimaryActionStyle,
32
- titleStyle,
33
- } = props;
34
-
35
- const ActionButton = ({
36
- icon,
37
- title,
38
- onPress,
39
- style,
40
- testID,
41
- }: ActionButtonProps) => (
42
- <Pressable
43
- testID={testID}
44
- onPress={onPress}
45
- style={[styles.actionButton, style]}>
46
- {icon}
47
- <CustomTypography
48
- variant="L1_REGULAR"
49
- style={[styles.titleStyle, titleStyle]}
50
- text={title}
51
- />
52
- </Pressable>
53
- );
54
-
55
- const leftActionHandle = (
56
- item: ListItem,
57
- leftPrimaryActionIcon: ReactNode,
58
- leftPrimaryActionTitle: string | undefined,
59
- leftSecondaryActionIcon: ReactNode,
60
- leftSecondaryActionTitle: string | undefined,
61
- ) => (
62
- <View style={[styles.leftActions, leftPrimaryActionStyle]}>
63
- {leftPrimaryActionIcon && (
64
- <ActionButton
65
- icon={leftPrimaryActionIcon}
66
- title={leftPrimaryActionTitle}
67
- onPress={() => leftPrimaryActionHandler?.(item)}
68
- style={leftPrimaryActionStyle}
69
- testID={`${testId}-LEFT-PRIMARY-${item.id}`}
70
- />
71
- )}
72
- {leftSecondaryActionIcon && (
73
- <ActionButton
74
- icon={leftSecondaryActionIcon}
75
- title={leftSecondaryActionTitle}
76
- onPress={() => leftSecondaryActionHandler?.(item)}
77
- style={leftSecondaryActionStyle}
78
- testID={`${testId}-LEFT-SECONDARY-${item.id}`}
79
- />
80
- )}
81
- </View>
82
- );
83
-
84
- const rightActionHandle = (item: ListItem) => (
85
- <View style={[styles.rightActions, rightPrimaryActionStyle]}>
86
- {rightPrimaryActionIcon && (
87
- <ActionButton
88
- icon={rightPrimaryActionIcon}
89
- title={rightPrimaryActionTitle || ''}
90
- onPress={() => rightPrimaryActionHandler?.(item)}
91
- style={rightPrimaryActionStyle}
92
- testID={`${testId}-RIGHT-PRIMARY-${item.id}`}
93
- />
94
- )}
95
- </View>
96
- );
97
-
98
- const renderItem = ({item}: {item: ListItem}) => (
99
- <GestureHandlerRootView testID={`${testId}-LIST`} style={styles.container}>
100
- <Swipeable
101
- renderLeftActions={() =>
102
- leftActionHandle(
103
- item,
104
- item.isPinned
105
- ? leftPrimaryActionInActiveIcon
106
- : leftPrimaryActionActiveIcon,
107
- item.isPinned
108
- ? leftPrimaryActionInActiveTitle
109
- : leftPrimaryActionActiveTitle,
110
- item.isRead
111
- ? leftSecondaryActionInActiveIcon
112
- : leftSecondaryActionActiveIcon,
113
- item.isRead
114
- ? leftSecondaryActionInActiveTitle
115
- : leftSecondaryActionActiveTitle,
116
- )
117
- }
118
- renderRightActions={() => rightActionHandle(item)}
119
- containerStyle={styles.swippableContainer}>
120
- {props?.renderItem(item)}
121
- </Swipeable>
122
- </GestureHandlerRootView>
123
- );
124
-
125
- return (
126
- <View testID={testId}>
127
- <FlatList
128
- data={data}
129
- renderItem={renderItem}
130
- keyExtractor={item => item.id}
131
- ItemSeparatorComponent={() => <View style={styles.seprator} />}
132
- />
133
- </View>
134
- );
135
- };
136
-
137
- export default SwipableList;
@@ -1 +0,0 @@
1
- export {default} from './SwipableList';
@@ -1,10 +0,0 @@
1
- export interface Tab {
2
- id: string;
3
- title: string;
4
- isSelected?: boolean;
5
- }
6
- export interface MultipleTabsProps {
7
- tabs: Tab[];
8
- initialSelected?: string[];
9
- onSelectionChange?: (selectedTabs: Tab[]) => void;
10
- }
@@ -1,24 +0,0 @@
1
- import {StyleSheet} from 'react-native';
2
- import {
3
- horizontalScale,
4
- moderateScale,
5
- verticalScale,
6
- } from '../../utils/stylehelper';
7
-
8
- export default StyleSheet.create({
9
- container: {
10
- flexDirection: 'row',
11
- gap: horizontalScale(5),
12
- flexWrap: 'wrap',
13
- },
14
- button: {
15
- minWidth: horizontalScale(94),
16
- minHeight: verticalScale(32),
17
- paddingVertical: verticalScale(8),
18
- paddingHorizontal: horizontalScale(12),
19
- borderRadius: moderateScale(32),
20
- alignItems: 'center',
21
- justifyContent: 'center',
22
- borderWidth: 1,
23
- },
24
- });
@@ -1,74 +0,0 @@
1
- import React, {useState} from 'react';
2
- import {Pressable, View, ViewStyle} from 'react-native';
3
- import styles from './Tabs.styles';
4
- import {FontStyle} from '../../utils/appEnum';
5
- import CustomText from '../customText';
6
- import {useTheme} from '../../theme/ThemeContext';
7
- import {withThemeProvider} from '../../theme/withThemeProvider';
8
- interface Props {
9
- options: string[];
10
- initialSelected?: string[];
11
- onSelectionChange?: (selected: string[]) => void;
12
- style?: ViewStyle;
13
- }
14
-
15
- const Tabs: React.FC<Props> = ({
16
- options,
17
- initialSelected = [],
18
- onSelectionChange,
19
- style,
20
- }) => {
21
- const {theme} = useTheme();
22
-
23
- const [data, setData] = useState(
24
- options.map(option => ({
25
- title: option,
26
- id: option,
27
- isSelected: initialSelected?.includes(option),
28
- })),
29
- );
30
-
31
- const handlePress = (id: string) => {
32
- const updatedData = data?.map(item =>
33
- item?.id === id ? {...item, isSelected: !item?.isSelected} : item,
34
- );
35
- setData(updatedData);
36
- const selectedTabs = updatedData
37
- .filter(item => item?.isSelected)
38
- .map(item => item?.id);
39
- if (onSelectionChange) {
40
- onSelectionChange(selectedTabs);
41
- }
42
- };
43
-
44
- return (
45
- <View style={[styles.container, style]}>
46
- {data?.map(({id, title, isSelected}) => (
47
- <Pressable
48
- key={id}
49
- style={{
50
- ...styles.button,
51
- backgroundColor: isSelected
52
- ? theme.CONTENT_PRIMARY
53
- : theme.CONTENT_INVERTED,
54
- borderColor: isSelected
55
- ? theme.CONTENT_INVERTED
56
- : theme.CONTENT_SECONDRY,
57
- }}
58
- onPress={() => handlePress(id)}>
59
- <CustomText
60
- variant={FontStyle.L2_REGULAR}
61
- style={{
62
- color: isSelected
63
- ? theme.CONTENT_INVERTED
64
- : theme.CONTENT_SECONDRY,
65
- }}
66
- text={title}
67
- />
68
- </Pressable>
69
- ))}
70
- </View>
71
- );
72
- };
73
-
74
- export default withThemeProvider(Tabs);
@@ -1 +0,0 @@
1
- export {default} from './Tabs';
@@ -1,12 +0,0 @@
1
- import {ReactElement} from 'react';
2
- import {ViewStyle} from 'react-native';
3
-
4
- export interface TagsProps {
5
- tags: string[];
6
- tagStyles?: ViewStyle;
7
- handleSetSelectedTagsOptions: (tags: string[]) => void;
8
- handleTagsChange: (tag: string) => void;
9
- testID?: string;
10
- icon?: ReactElement;
11
- iconStyle?: ViewStyle;
12
- }
@@ -1,36 +0,0 @@
1
- import {DHRE_COLORS_BG, DHRE_COLORS_TEXT} from '../../theme/colors';
2
- import {horizontalScale, verticalScale} from '../../utils/stylehelper';
3
- import {StyleSheet} from 'react-native';
4
-
5
- const styles = StyleSheet.create({
6
- container: {
7
- width: '100%',
8
- },
9
- contentContainer: {
10
- flexWrap: 'wrap',
11
- flexDirection: 'row',
12
- },
13
- tag: {
14
- paddingVertical: verticalScale(8),
15
- paddingHorizontal: horizontalScale(12),
16
- borderRadius: 20,
17
- margin: horizontalScale(8),
18
- flexDirection: 'row',
19
- alignItems: 'center',
20
- },
21
- selectedTag: {
22
- backgroundColor: DHRE_COLORS_TEXT.DH_BLACK,
23
- },
24
- tagText: {
25
- color: DHRE_COLORS_TEXT.DH_WHITE,
26
- marginRight: horizontalScale(8),
27
- },
28
- tagUnSelected: {
29
- backgroundColor: DHRE_COLORS_BG.DH_GREY1,
30
- },
31
- tagUnselectedText: {
32
- color: DHRE_COLORS_TEXT.DH_TEXTLIGHT,
33
- },
34
- });
35
-
36
- export default styles;
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import {it} from '@jest/globals';
3
- import {fireEvent, render} from '@testing-library/react-native';
4
- import Tags from './Tags';
5
-
6
- const customStyle = {backgroundColor: 'red', padding: 20};
7
-
8
- const mockProps = {
9
- tags: ['One', 'Two', 'Three'],
10
- tagStyles: customStyle,
11
- handleSetSelectedTagsOptions: jest.fn(),
12
- handleTagsChange: jest.fn(),
13
- testID: 'TAGS-COMPONENT',
14
- };
15
-
16
- describe('Tags Component', () => {
17
- it('Component renders correctly', () => {
18
- const {getByTestId} = render(<Tags {...mockProps} />);
19
- expect(getByTestId('TAGS-COMPONENT')).toBeTruthy();
20
- fireEvent.press(getByTestId('TAGS-COMPONENT-One-BTN'));
21
- });
22
- });
@@ -1,76 +0,0 @@
1
- import React, {useState} from 'react';
2
- import {ScrollView, Pressable} from 'react-native';
3
- import CustomTypography from '../customTypography/CustomTypography';
4
- import {TagsProps} from './Tags.interface';
5
- import styles from './Tags.styles';
6
-
7
- const Tags: React.FC<TagsProps> = ({
8
- tags,
9
- tagStyles,
10
- handleSetSelectedTagsOptions,
11
- handleTagsChange,
12
- testID,
13
- icon,
14
- iconStyle,
15
- }) => {
16
- const [selectedTags, setSelectedTags] = useState<string[]>([]);
17
-
18
- const toggleTag = (tag: string) => {
19
- setSelectedTags(prevSelectedTags => {
20
- const selectedTagsSet = new Set(prevSelectedTags);
21
- selectedTagsSet.has(tag)
22
- ? selectedTagsSet.delete(tag)
23
- : selectedTagsSet.add(tag);
24
- handleSetSelectedTagsOptions([...selectedTagsSet]);
25
- return [...selectedTagsSet];
26
- });
27
- };
28
-
29
- const removeTag = (tag: string) => {
30
- setSelectedTags(prevSelectedTags =>
31
- prevSelectedTags.filter(t => t !== tag),
32
- );
33
- handleTagsChange(tag);
34
- };
35
-
36
- return (
37
- <ScrollView
38
- testID={testID}
39
- style={styles.container}
40
- contentContainerStyle={styles.contentContainer}
41
- horizontal={false}>
42
- {tags?.map(tag => (
43
- <Pressable
44
- testID={`${testID}-${tag}-BTN`}
45
- key={tag}
46
- onPress={() => toggleTag(tag)}
47
- style={[
48
- styles.tag,
49
- tagStyles,
50
- selectedTags.includes(tag)
51
- ? styles.selectedTag
52
- : styles.tagUnSelected,
53
- ]}>
54
- <CustomTypography
55
- variant={selectedTags.includes(tag) ? 'H9semiBold' : 'P4regular'}
56
- style={
57
- selectedTags.includes(tag)
58
- ? styles.tagText
59
- : styles.tagUnselectedText
60
- }
61
- text={tag}
62
- />
63
- {selectedTags.includes(tag) && icon && (
64
- <Pressable
65
- testID={`${testID}-${tag}-PRESS`}
66
- onPress={() => removeTag(tag)}>
67
- {React.cloneElement(icon, {style: [icon.props.style, iconStyle]})}
68
- </Pressable>
69
- )}
70
- </Pressable>
71
- ))}
72
- </ScrollView>
73
- );
74
- };
75
-
76
- export default Tags;
@@ -1 +0,0 @@
1
- export {default} from './Tags';