dhre-ui-kit 0.0.95 → 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 -120
  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,166 +0,0 @@
1
- import React, {useEffect, useState, useRef} from 'react';
2
- import {
3
- View,
4
- TextInput,
5
- Pressable,
6
- NativeSyntheticEvent,
7
- TextInputKeyPressEventData,
8
- } from 'react-native';
9
- import {FontStyle} from '../../utils/appEnum';
10
- import {styles} from './styles';
11
- import {IProps, OTPInputHandle} from './otp.interface';
12
- import CustomTypography from '../customTypography';
13
- import {useTheme} from '../../theme/ThemeContext';
14
- import {withThemeProvider} from '../../theme/withThemeProvider';
15
-
16
- const OTPInput = React.forwardRef<OTPInputHandle, IProps>(
17
- (
18
- {
19
- length = 4,
20
- onComplete,
21
- resendOTP,
22
- errorMessage,
23
- testId = '',
24
- otpContainerStyle,
25
- },
26
- ref,
27
- ) => {
28
- const [otp, setOTP] = useState('');
29
- const [isResendOtpEnable, setIsResendOtpEnable] = useState(false);
30
- const [activeInput, setActiveInput] = useState<number | null>(null);
31
- const {theme} = useTheme();
32
- const refs = useRef<(TextInput | null)[]>([]);
33
- refs.current = Array(length)
34
- .fill(0)
35
- .map((_, index) => refs.current[index] || null);
36
-
37
- useEffect(() => {
38
- enableResendOtp();
39
- }, []);
40
-
41
- const onClickResendOTP = () => {
42
- setIsResendOtpEnable(false);
43
- enableResendOtp();
44
- resendOTP?.();
45
- };
46
-
47
- const enableResendOtp = () => {
48
- setTimeout(() => {
49
- setIsResendOtpEnable(true);
50
- }, 5000);
51
- };
52
-
53
- React.useImperativeHandle(ref, () => ({
54
- reset() {
55
- setOTP('');
56
- },
57
- }));
58
-
59
- const handleChange = (index: number, value: string) => {
60
- const regex = /^\d+$/;
61
- if (
62
- value.length === 1 &&
63
- regex.test(value) &&
64
- index >= 0 &&
65
- index < length
66
- ) {
67
- const newOTP = `${otp}${value}`;
68
- setOTP(newOTP);
69
- refs.current[index + 1]?.focus();
70
- } else if (value.length === 0 && index > 0) {
71
- const newOTP = otp.slice(0, -1);
72
- setOTP(newOTP);
73
- refs.current[index - 1]?.focus();
74
- } else {
75
- const newOTP = otp.slice(0, -1);
76
- setOTP(newOTP);
77
- refs.current[index]?.focus();
78
- }
79
- };
80
-
81
- const handleKeyPress = (
82
- e: NativeSyntheticEvent<TextInputKeyPressEventData>,
83
- index: number,
84
- ) => {
85
- if (e.nativeEvent.key === 'Backspace' && index > 0) {
86
- refs.current[index - 1]?.focus();
87
- }
88
- };
89
-
90
- useEffect(() => {
91
- if (otp.length === length) {
92
- onComplete?.(otp);
93
- }
94
- }, [otp]);
95
-
96
- return (
97
- <View style={{...otpContainerStyle}} data-testid={testId}>
98
- <CustomTypography
99
- text={'OTP'}
100
- variant={FontStyle.B4_REGULAR}
101
- style={{
102
- color: otp?.length ? theme.CONTENT_PRIMARY : theme.CONTENT_SECONDRY,
103
- textAlign: 'left',
104
- }}
105
- />
106
- <View style={{...styles.textInputContainer}}>
107
- {Array.from({length}).map((_, index) => (
108
- <TextInput
109
- key={index?.toString()}
110
- style={{
111
- ...styles.textInputStyle,
112
- color: theme.CONTENT_PRIMARY,
113
- borderColor: errorMessage
114
- ? theme.ERROR
115
- : otp.length === length
116
- ? theme.SUCCESS
117
- : activeInput === index
118
- ? theme.BORDER_INVERTED
119
- : theme.BORDER_PRIMARY,
120
- }}
121
- onFocus={() => setActiveInput(index)}
122
- onBlur={() => setActiveInput(null)}
123
- onKeyPress={e => handleKeyPress(e, index)}
124
- onChangeText={text => handleChange(index, text)}
125
- value={otp[index] ? '●' : ''}
126
- placeholder=""
127
- keyboardType="numeric"
128
- ref={el => (refs.current[index] = el)}
129
- returnKeyType={otp.length === length ? 'done' : 'next'}
130
- selectionColor={theme.CONTENT_PRIMARY}
131
- />
132
- ))}
133
- </View>
134
-
135
- <View style={styles.resendOtpContainer}>
136
- {errorMessage ? (
137
- <CustomTypography
138
- text={errorMessage}
139
- variant={FontStyle.L2_REGULAR}
140
- style={{
141
- color: theme.ERROR,
142
- }}
143
- />
144
- ) : (
145
- <View />
146
- )}
147
- <Pressable onPress={onClickResendOTP} disabled={!isResendOtpEnable}>
148
- <CustomTypography
149
- text={'Resend OTP'}
150
- variant={FontStyle.L2_REGULAR}
151
- style={{
152
- textDecorationLine: 'underline',
153
- color: isResendOtpEnable
154
- ? theme.CONTENT_PRIMARY
155
- : theme.CONTENT_DISABLE,
156
- }}
157
- />
158
- </Pressable>
159
- </View>
160
- </View>
161
- );
162
- },
163
- );
164
-
165
- export default withThemeProvider(OTPInput);
166
- OTPInput.displayName = 'OTPInput';
@@ -1,14 +0,0 @@
1
- import {ViewStyle} from 'react-native';
2
-
3
- export interface IProps {
4
- length?: number;
5
- onComplete?: (otp?: string) => void;
6
- errorMessage?: string;
7
- testId?: string;
8
- otpContainerStyle?: ViewStyle;
9
- resendOTP?: () => void;
10
- }
11
-
12
- export type OTPInputHandle = {
13
- reset: () => void;
14
- };
@@ -1,29 +0,0 @@
1
- import {StyleSheet} from 'react-native';
2
- import {verticalScale, moderateScale} from '../../utils/stylehelper';
3
-
4
- const styles = StyleSheet.create({
5
- textInputContainer: {
6
- flexDirection: 'row',
7
- justifyContent: 'space-between',
8
- marginTop: verticalScale(8),
9
- },
10
- textInputStyle: {
11
- height: verticalScale(48),
12
- width: moderateScale(72),
13
- borderRadius: moderateScale(8),
14
- borderWidth: 1,
15
- textAlign: 'center',
16
- fontSize: moderateScale(12),
17
- },
18
- resendOtpContainer: {
19
- flexDirection: 'row',
20
- alignItems: 'center',
21
- justifyContent: 'space-between',
22
- marginTop: verticalScale(12),
23
- },
24
- resendOtpTextEnable: {
25
- textDecorationLine: 'underline',
26
- },
27
- });
28
-
29
- export {styles};
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import {render} from '@testing-library/react-native';
3
- import PdfView from './PdfView';
4
-
5
- describe('PdfView', () => {
6
- it('renders the Pdf component with the correct source URI', () => {
7
- const pdfResponse = 'base64encodedstring';
8
- render(
9
- <PdfView source={{uri: `data:application/pdf;base64,${pdfResponse}`}} />,
10
- );
11
- });
12
- });
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import Pdf, {PdfProps} from 'react-native-pdf';
3
-
4
- const PdfView: React.FC<PdfProps> = props => {
5
- return <Pdf {...props} />;
6
- };
7
-
8
- export default PdfView;
@@ -1 +0,0 @@
1
- export {default} from './PdfView';
@@ -1,9 +0,0 @@
1
- export interface PopUpProps {
2
- subtitle?: string;
3
- buttonText?: string;
4
- title?: string;
5
- leftButtonShown: boolean;
6
- rightButtonShown: boolean;
7
- testID?: string;
8
- onButtonPress?: () => void;
9
- }
@@ -1,52 +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
- padding: horizontalScale(20),
8
- marginHorizontal: horizontalScale(16),
9
- justifyContent: 'space-between',
10
- backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
11
- },
12
- subTitleBelow: {
13
- color: DHRE_COLORS_TEXT.DH_TEXTDARK,
14
- },
15
- subtitle: {
16
- letterSpacing: 0.5,
17
- marginTop: verticalScale(8),
18
- color: DHRE_COLORS_TEXT.DH_TEXTLIGHT,
19
- marginBottom: verticalScale(24),
20
- },
21
- button: {
22
- backgroundColor: DHRE_COLORS_TEXT.DH_BLACK,
23
- paddingVertical: verticalScale(14),
24
- paddingHorizontal: horizontalScale(34),
25
- borderRadius: 50,
26
- flex: 1,
27
- },
28
- buttonText: {
29
- color: DHRE_COLORS_TEXT.DH_WHITE,
30
- textAlign: 'center',
31
- },
32
- buttonLeft: {
33
- backgroundColor: DHRE_COLORS_TEXT.DH_WHITE,
34
- paddingVertical: verticalScale(14),
35
- paddingHorizontal: horizontalScale(34),
36
- borderRadius: 50,
37
- borderWidth: 1,
38
- flex: 1,
39
- borderColor: DHRE_COLORS_BG.DH_GREY1,
40
- },
41
- buttonLeftText: {
42
- color: DHRE_COLORS_TEXT.DH_BLACK,
43
- textAlign: 'center',
44
- },
45
- buttonContainer: {
46
- flexDirection: 'row',
47
- gap: horizontalScale(16),
48
- justifyContent: 'space-between',
49
- },
50
- });
51
-
52
- export default styles;
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import {it} from '@jest/globals';
3
- import {fireEvent, render} from '@testing-library/react-native';
4
- import PopUp from './PopUp';
5
-
6
- const mockProps = {
7
- subtitle: 'SubTitle',
8
- buttonText: 'Button',
9
- title: 'Title',
10
- leftButtonShown: true,
11
- rightButtonShown: true,
12
- testID: 'POPUP-COMPONENT',
13
- onButtonPress: jest.fn(),
14
- };
15
- const mockWithoutDataProps = {
16
- subtitle: undefined,
17
- buttonText: undefined,
18
- title: undefined,
19
- leftButtonShown: false,
20
- rightButtonShown: false,
21
- testID: 'POPUP-COMPONENT',
22
- onButtonPress: jest.fn(),
23
- };
24
-
25
- describe('PopUp Component', () => {
26
- it('Component renders correctly', () => {
27
- const {getByTestId} = render(<PopUp {...mockProps} />);
28
- expect(getByTestId('POPUP-COMPONENT')).toBeTruthy();
29
- fireEvent.press(getByTestId('Left-Button-Press'));
30
- });
31
- it('Component renders correctly when props data is not passed', () => {
32
- const {getByTestId} = render(<PopUp {...mockWithoutDataProps} />);
33
- expect(getByTestId('POPUP-COMPONENT')).toBeTruthy();
34
- });
35
- });
@@ -1,60 +0,0 @@
1
- import React from 'react';
2
- import {View, Pressable} from 'react-native';
3
- import styles from './PopUp.styles';
4
- import {PopUpProps} from './PopUp.interface';
5
- import CustomTypography from '../customTypography/CustomTypography';
6
-
7
- const PopUp: React.FC<PopUpProps> = ({
8
- subtitle,
9
- title,
10
- buttonText,
11
- onButtonPress,
12
- testID,
13
- leftButtonShown = false,
14
- rightButtonShown = false,
15
- }: PopUpProps) => {
16
- return (
17
- <View testID={testID} style={styles.container}>
18
- {title ? (
19
- <CustomTypography
20
- style={styles.subTitleBelow}
21
- variant="H6semiBold"
22
- text={title}
23
- />
24
- ) : null}
25
- {subtitle ? (
26
- <CustomTypography
27
- style={styles.subtitle}
28
- variant="P3regular"
29
- text={subtitle}
30
- />
31
- ) : null}
32
-
33
- <View style={styles.buttonContainer}>
34
- {leftButtonShown ? (
35
- <Pressable
36
- testID="Left-Button-Press"
37
- style={styles.buttonLeft}
38
- onPress={onButtonPress}>
39
- <CustomTypography
40
- style={styles.buttonLeftText}
41
- variant="B2semiBold"
42
- text={buttonText}
43
- />
44
- </Pressable>
45
- ) : null}
46
- {rightButtonShown ? (
47
- <Pressable style={styles.button} onPress={onButtonPress}>
48
- <CustomTypography
49
- style={styles.buttonText}
50
- variant="B2semiBold"
51
- text={buttonText}
52
- />
53
- </Pressable>
54
- ) : null}
55
- </View>
56
- </View>
57
- );
58
- };
59
-
60
- export default PopUp;
@@ -1 +0,0 @@
1
- export {default} from './PopUp';
@@ -1,78 +0,0 @@
1
- import React from 'react';
2
- import {render, act} from '@testing-library/react-native';
3
- import CustomProgressBar from './ProgressBar';
4
- import {ShapeType} from '../../utils/appEnum';
5
-
6
- jest.mock('react-native-progress', () => ({
7
- Bar: jest.fn(),
8
- Circle: jest.fn(),
9
- }));
10
-
11
- jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
12
-
13
- describe('CustomProgressBar', () => {
14
- it('updates progress correctly', () => {
15
- jest.useFakeTimers();
16
-
17
- const {getByTestId} = render(
18
- <CustomProgressBar
19
- value={50}
20
- type={ShapeType.LINE}
21
- width={0}
22
- fillColor={''}
23
- unfilledColor={''}
24
- progress={0}
25
- setProgress={function (): void {}}
26
- />,
27
- );
28
- const lineProgressBar = getByTestId('custom-progress-bar');
29
- for (let i = 0; i < 5; i++) {
30
- act(() => {
31
- jest.advanceTimersByTime(100);
32
- });
33
- }
34
-
35
- expect(lineProgressBar.props.progress).toBeUndefined();
36
- while (lineProgressBar.props.progress < 1) {
37
- act(() => {
38
- jest.advanceTimersByTime(100);
39
- });
40
- }
41
- if (typeof lineProgressBar.props.progress === 'number') {
42
- expect(lineProgressBar.props.progress).toBeCloseTo(1);
43
- }
44
- jest.useRealTimers();
45
- });
46
- });
47
- describe('CustomProgressBar', () => {
48
- it('renders a line progress bar with initial progress and color', () => {
49
- const {getByTestId} = render(
50
- <CustomProgressBar
51
- value={50}
52
- type={ShapeType.LINE}
53
- width={0}
54
- fillColor={''}
55
- unfilledColor={''}
56
- progress={0}
57
- setProgress={function (): void {}}
58
- />,
59
- );
60
- const lineProgressBar = getByTestId('custom-progress-bar');
61
- expect(lineProgressBar).toBeTruthy();
62
- });
63
- it('renders a line progress bar with initial progress and color', () => {
64
- const {getByTestId} = render(
65
- <CustomProgressBar
66
- value={50}
67
- type={ShapeType.CIRCLE}
68
- width={0}
69
- fillColor={''}
70
- unfilledColor={''}
71
- progress={0}
72
- setProgress={function (): void {}}
73
- />,
74
- );
75
- const lineProgressBar = getByTestId('custom-progress-bar');
76
- expect(lineProgressBar).toBeTruthy();
77
- });
78
- });
@@ -1,120 +0,0 @@
1
- import React, {useEffect} from 'react';
2
- import {StyleSheet, TextStyle, View} from 'react-native';
3
- import * as Progress from 'react-native-progress';
4
- import {ShapeType} from '../../utils/appEnum';
5
- import CustomText from '../customText';
6
-
7
- interface CustomProgressBarProps {
8
- value: number; // Current progress value (0 to 100)
9
- type: ShapeType.LINE | ShapeType.CIRCLE; // Type of progress bar
10
- width: number; // Width of the progress bar
11
- height?: number; // Optional height (default behavior depends on library)
12
- fillColor: string; // Color of the progress fill
13
- unfilledColor: string; // Color of the unfilled area
14
- borderWidth?: number; // Optional border width
15
- borderRadius?: number; // Optional border radius
16
- circleSize?: number; // Size of the circle progress bar (if type is CIRCLE)
17
- thickness?: number; // Thickness of the circle progress bar (if type is CIRCLE)
18
- progress: number; // filled area
19
- setProgress: React.Dispatch<React.SetStateAction<number>>;
20
- increment?: number; // Optional increment value for progress update
21
- interval?: number; // Optional interval time (ms) for progress update
22
- percentageText?: string;
23
- valueTextStyle?: TextStyle;
24
- }
25
-
26
- const CustomProgressBar: React.FC<CustomProgressBarProps> = ({
27
- value,
28
- type,
29
- width,
30
- height,
31
- fillColor,
32
- unfilledColor,
33
- borderWidth,
34
- borderRadius,
35
- circleSize,
36
- thickness,
37
- progress,
38
- setProgress,
39
- increment = 1, // Default increment to 1
40
- interval = 100, // Default interval to 100ms
41
- percentageText,
42
- valueTextStyle,
43
- }) => {
44
- useEffect(() => {
45
- const progressInterval = setInterval(() => {
46
- if (progress < value) {
47
- setProgress((prevProgress: number) => prevProgress + increment);
48
- } else {
49
- clearInterval(progressInterval);
50
- }
51
- }, interval);
52
-
53
- return () => clearInterval(progressInterval);
54
- }, [progress, value, increment, interval]);
55
-
56
- const showPercentage = () => {
57
- return (
58
- <View style={styles.flexDirection}>
59
- <CustomText
60
- text={`${value}%`}
61
- variant="B1_REGULAR"
62
- textColor="CONTENT_PRIMARY"
63
- style={valueTextStyle}
64
- />
65
- {percentageText ? (
66
- <CustomText
67
- text={percentageText}
68
- variant="L3_REGULAR"
69
- textColor="CONTENT_PRIMARY"
70
- />
71
- ) : null}
72
- </View>
73
- );
74
- };
75
- const renderProgressBar = () => {
76
- switch (type) {
77
- case ShapeType.LINE:
78
- return (
79
- <Progress.Bar
80
- progress={progress / 100}
81
- width={width}
82
- height={height}
83
- color={fillColor}
84
- unfilledColor={unfilledColor}
85
- borderWidth={borderWidth}
86
- borderRadius={borderRadius}
87
- testID="custom-progress-bar-line"
88
- />
89
- );
90
- case ShapeType.CIRCLE:
91
- return (
92
- <Progress.Circle
93
- progress={progress / 100}
94
- size={circleSize}
95
- thickness={thickness}
96
- color={fillColor}
97
- unfilledColor={unfilledColor}
98
- borderWidth={borderWidth}
99
- showsText={true}
100
- formatText={showPercentage}
101
- testID="custom-progress-bar-circle"
102
- />
103
- );
104
- default:
105
- return null;
106
- }
107
- };
108
-
109
- return <View testID="custom-progress-bar">{renderProgressBar()}</View>;
110
- };
111
-
112
- const styles = StyleSheet.create({
113
- flexDirection: {
114
- flexDirection: 'column',
115
- justifyContent: 'center',
116
- alignItems: 'center',
117
- },
118
- });
119
-
120
- export default CustomProgressBar;
@@ -1 +0,0 @@
1
- export {default} from './ProgressBar';
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import {render} from '@testing-library/react-native';
3
- import Property360View from './Property360View';
4
- import WebView from 'react-native-webview';
5
-
6
- describe('Property360View Component', () => {
7
- it('should render the WebView with the correct URI', () => {
8
- const imageURI = 'https://example.com/360image.jpg';
9
- const {getByTestId} = render(<Property360View imageURI={imageURI} />);
10
- const propertyView = getByTestId('PROPERTY_360_VIEW');
11
- expect(propertyView).toBeTruthy();
12
- expect(WebView).toHaveBeenCalledWith(
13
- expect.objectContaining({
14
- source: {uri: imageURI},
15
- }),
16
- {},
17
- );
18
- });
19
- it('should apply the commonStyles.flexOne style to the View and WebView components', () => {
20
- const imageURI = 'https://example.com/360image.jpg';
21
- const {getByTestId} = render(<Property360View imageURI={imageURI} />);
22
- expect(getByTestId('PROPERTY_360_VIEW')).toBeTruthy();
23
- });
24
- });
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import {View} from 'react-native';
3
- import WebView from 'react-native-webview';
4
- import commonStyles from '../../utils/commonStyles';
5
-
6
- const Property360View = ({imageURI}: {imageURI: string}) => {
7
- return (
8
- <View style={commonStyles.flexOne} testID="PROPERTY_360_VIEW">
9
- <WebView
10
- source={{
11
- uri: imageURI,
12
- }}
13
- style={commonStyles.flexOne}
14
- />
15
- </View>
16
- );
17
- };
18
-
19
- export default Property360View;
@@ -1 +0,0 @@
1
- export {default} from './Property360View';
@@ -1 +0,0 @@
1
- export {default} from './rating';
@@ -1,13 +0,0 @@
1
- import {horizontalScale} from '../../utils/stylehelper';
2
- import {StyleSheet} from 'react-native';
3
-
4
- const styles = StyleSheet.create({
5
- container: {
6
- flexDirection: 'row',
7
- alignItems: 'center',
8
- },
9
- star: {
10
- marginHorizontal: horizontalScale(2),
11
- },
12
- });
13
- export default styles;