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.
- package/{src/assets/index.ts → lib/assets/index.d.ts} +1 -18
- package/lib/index.d.ts +862 -0
- package/lib/index.esm.js +2 -0
- package/lib/index.esm.js.map +1 -0
- package/lib/index.js +4333 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +4248 -0
- package/lib/index.mjs.map +1 -0
- package/lib/theme/ThemeContext.d.ts +10 -0
- package/lib/theme/colors.d.ts +166 -0
- package/lib/theme/fonts.d.ts +8 -0
- package/lib/theme/themes.d.ts +131 -0
- package/lib/theme/withThemeProvider.d.ts +2 -0
- package/lib/utils/appEnum.d.ts +90 -0
- package/lib/utils/commonStyles.d.ts +15 -0
- package/lib/utils/constants.d.ts +19 -0
- package/lib/utils/deviceUtils.d.ts +7 -0
- package/lib/utils/regex.d.ts +1 -0
- package/lib/utils/stylehelper.d.ts +5 -0
- package/package.json +61 -81
- package/README.md +0 -1
- package/__mocks__/custom-text.mock.tsx +0 -19
- package/__mocks__/setup-tests.ts +0 -24
- package/__mocks__/svgMock.ts +0 -2
- package/src/App.tsx +0 -43
- package/src/assets/fonts/MeraasAktiv_Bd.ttf +0 -0
- package/src/assets/fonts/MeraasAktiv_Lt.ttf +0 -0
- package/src/assets/fonts/MeraasAktiv_Rg.ttf +0 -0
- package/src/assets/images/arrowLeft.svg +0 -3
- package/src/assets/images/bellSimple.svg +0 -3
- package/src/assets/images/calenderDots.svg +0 -1
- package/src/assets/images/caretDown.svg +0 -3
- package/src/assets/images/caretLeft.svg +0 -3
- package/src/assets/images/caretRight.svg +0 -3
- package/src/assets/images/caretUp.svg +0 -3
- package/src/assets/images/checkWhite.svg +0 -3
- package/src/assets/images/circleTick.svg +0 -3
- package/src/assets/images/crossIcon.svg +0 -3
- package/src/assets/images/dotsThreeVertical.svg +0 -5
- package/src/assets/images/fileIcon.svg +0 -8
- package/src/assets/images/searchIcon.svg +0 -4
- package/src/assets/images/trash.svg +0 -7
- package/src/assets/images/uploadFileIcon.svg +0 -12
- package/src/components/ContactModel/ContactModel.tsx +0 -206
- package/src/components/ContactModel/index.ts +0 -1
- package/src/components/OutOfOffice/OurOffices.tsx +0 -91
- package/src/components/OutOfOffice/index.ts +0 -1
- package/src/components/accordion/Accordion.interface.ts +0 -16
- package/src/components/accordion/Accordion.styles.ts +0 -28
- package/src/components/accordion/Accordion.test.tsx +0 -21
- package/src/components/accordion/Accordion.tsx +0 -85
- package/src/components/accordion/index.ts +0 -1
- package/src/components/autoOtpReader/AutoOtpReader.test.tsx +0 -56
- package/src/components/autoOtpReader/AutoOtpReader.tsx +0 -79
- package/src/components/autoOtpReader/index.ts +0 -1
- package/src/components/badge/Badge.styles.ts +0 -20
- package/src/components/badge/Badge.test.tsx +0 -57
- package/src/components/badge/Badge.tsx +0 -48
- package/src/components/badge/index.ts +0 -1
- package/src/components/bottomDrawer/BottomDrawer.interface.ts +0 -23
- package/src/components/bottomDrawer/BottomDrawer.styles.ts +0 -47
- package/src/components/bottomDrawer/BottomDrawer.test.tsx +0 -19
- package/src/components/bottomDrawer/BottomDrawer.tsx +0 -92
- package/src/components/bottomDrawer/index.ts +0 -1
- package/src/components/button/Button.interface.ts +0 -19
- package/src/components/button/Button.styles.ts +0 -78
- package/src/components/button/Button.test.tsx +0 -43
- package/src/components/button/Button.tsx +0 -82
- package/src/components/button/index.ts +0 -1
- package/src/components/cards/Cards.interface.ts +0 -13
- package/src/components/cards/Cards.styles.ts +0 -59
- package/src/components/cards/Cards.test.tsx +0 -41
- package/src/components/cards/Cards.tsx +0 -69
- package/src/components/cards/index.ts +0 -1
- package/src/components/checkBox/CheckBox.interface.ts +0 -15
- package/src/components/checkBox/CheckBox.styles.ts +0 -35
- package/src/components/checkBox/CheckBox.test.tsx +0 -46
- package/src/components/checkBox/CheckBox.tsx +0 -50
- package/src/components/checkBox/index.ts +0 -1
- package/src/components/countryPicker/CountryPicker.tsx +0 -169
- package/src/components/countryPicker/index.ts +0 -1
- package/src/components/customDocumentPicker/CustomDocumentPicker.interface.ts +0 -13
- package/src/components/customDocumentPicker/CustomDocumentPicker.styles.ts +0 -33
- package/src/components/customDocumentPicker/CustomDocumentPicker.tsx +0 -100
- package/src/components/customDocumentPicker/index.ts +0 -1
- package/src/components/customDropdown/CustomDropdown.interface.ts +0 -15
- package/src/components/customDropdown/CustomDropdown.styles.tsx +0 -46
- package/src/components/customDropdown/CustomDropdown.test.tsx +0 -30
- package/src/components/customDropdown/CustomDropdown.tsx +0 -106
- package/src/components/customDropdown/index.ts +0 -1
- package/src/components/customHeader/CustomHeader.interface.tsx +0 -10
- package/src/components/customHeader/CustomHeader.styles.ts +0 -26
- package/src/components/customHeader/CustomHeader.test.tsx +0 -14
- package/src/components/customHeader/CustomHeader.tsx +0 -46
- package/src/components/customHeader/index.ts +0 -1
- package/src/components/customIcon/CustomIcon.interface.ts +0 -12
- package/src/components/customIcon/CustomIcon.styles.ts +0 -13
- package/src/components/customIcon/CustomIcon.test.tsx +0 -14
- package/src/components/customIcon/CustomIcon.tsx +0 -33
- package/src/components/customIcon/index.ts +0 -1
- package/src/components/customInputText/CustomInputText.interface.ts +0 -20
- package/src/components/customInputText/CustomInputText.styles.ts +0 -56
- package/src/components/customInputText/CustomInputText.test.tsx +0 -37
- package/src/components/customInputText/CustomInputText.tsx +0 -120
- package/src/components/customInputText/index.ts +0 -1
- package/src/components/customLoader/CustomLoader.inteface.ts +0 -3
- package/src/components/customLoader/CustomLoader.styles.ts +0 -16
- package/src/components/customLoader/CustomLoader.tsx +0 -16
- package/src/components/customLoader/index.ts +0 -1
- package/src/components/customSearchBar/CustomSearchBar.interface.ts +0 -21
- package/src/components/customSearchBar/CustomSearchBar.styles.ts +0 -23
- package/src/components/customSearchBar/CustomSearchBar.test.tsx +0 -27
- package/src/components/customSearchBar/CustomSearchBar.tsx +0 -87
- package/src/components/customSearchBar/index.ts +0 -1
- package/src/components/customSlideButton/custom-slide-button.interface.ts +0 -4
- package/src/components/customSlideButton/index.tsx +0 -78
- package/src/components/customSlideButton/styles.ts +0 -39
- package/src/components/customSwitchBtn/customSwitchBtn.interface.ts +0 -15
- package/src/components/customSwitchBtn/customSwitchBtn.styles.ts +0 -34
- package/src/components/customSwitchBtn/customSwitchBtn.tsx +0 -63
- package/src/components/customSwitchBtn/index.ts +0 -1
- package/src/components/customText/CustomText.tsx +0 -33
- package/src/components/customText/index.ts +0 -1
- package/src/components/customTooltip/CustomTooltip.interface.ts +0 -14
- package/src/components/customTooltip/CustomTooltip.styles.ts +0 -23
- package/src/components/customTooltip/CustomTooltip.test.tsx +0 -18
- package/src/components/customTooltip/CustomTooltip.tsx +0 -46
- package/src/components/customTooltip/index.ts +0 -1
- package/src/components/customTypography/CustomTypography.test.tsx +0 -12
- package/src/components/customTypography/CustomTypography.tsx +0 -27
- package/src/components/customTypography/index.ts +0 -1
- package/src/components/dateRangePicker/DateRangePicker.interface.ts +0 -19
- package/src/components/dateRangePicker/DateRangePicker.styles.ts +0 -19
- package/src/components/dateRangePicker/DateRangePicker.tsx +0 -108
- package/src/components/dateRangePicker/index.ts +0 -1
- package/src/components/dropDown/DropDown.tsx +0 -145
- package/src/components/dropDown/index.ts +0 -1
- package/src/components/feedback/feedback.style.ts +0 -48
- package/src/components/feedback/feedback.tsx +0 -61
- package/src/components/feedback/index.ts +0 -1
- package/src/components/fileUpload/FileUpload.styles.ts +0 -41
- package/src/components/fileUpload/FileUpload.test.tsx +0 -39
- package/src/components/fileUpload/FileUpload.tsx +0 -65
- package/src/components/fileUpload/index.ts +0 -1
- package/src/components/horizontalLine/Line.tsx +0 -26
- package/src/components/horizontalLine/index.ts +0 -1
- package/src/components/notificationBandge/NotificationBandge.interface.tsx +0 -3
- package/src/components/notificationBandge/NotificationBandge.styles.tsx +0 -26
- package/src/components/notificationBandge/NotificationBandge.tsx +0 -26
- package/src/components/notificationBandge/index.tsx +0 -1
- package/src/components/otp/index.tsx +0 -166
- package/src/components/otp/otp.interface.ts +0 -14
- package/src/components/otp/styles.ts +0 -29
- package/src/components/pdfView/PdfView.test.tsx +0 -12
- package/src/components/pdfView/PdfView.tsx +0 -8
- package/src/components/pdfView/index.ts +0 -1
- package/src/components/popup/PopUp.interface.ts +0 -9
- package/src/components/popup/PopUp.styles.ts +0 -52
- package/src/components/popup/PopUp.test.tsx +0 -35
- package/src/components/popup/PopUp.tsx +0 -60
- package/src/components/popup/index.ts +0 -1
- package/src/components/progressBar/ProgressBar.test.tsx +0 -78
- package/src/components/progressBar/ProgressBar.tsx +0 -120
- package/src/components/progressBar/index.ts +0 -1
- package/src/components/property360View/Property360View.test.tsx +0 -24
- package/src/components/property360View/Property360View.tsx +0 -19
- package/src/components/property360View/index.ts +0 -1
- package/src/components/rating/index.ts +0 -1
- package/src/components/rating/rating.styles.ts +0 -13
- package/src/components/rating/rating.test.tsx +0 -61
- package/src/components/rating/rating.tsx +0 -96
- package/src/components/scrollList/category.tsx +0 -110
- package/src/components/scrollList/index.ts +0 -1
- package/src/components/singleSelectionTag/TagSingleSelection.tsx +0 -105
- package/src/components/singleSelectionTag/index.ts +0 -1
- package/src/components/stepper/index.tsx +0 -105
- package/src/components/stepper/stepper.interface.ts +0 -24
- package/src/components/stepper/styles.ts +0 -74
- package/src/components/swipableList/SwipableList.interface.ts +0 -52
- package/src/components/swipableList/SwipableList.styles.ts +0 -30
- package/src/components/swipableList/SwipableList.test.tsx +0 -209
- package/src/components/swipableList/SwipableList.tsx +0 -137
- package/src/components/swipableList/index.ts +0 -1
- package/src/components/tabs/Tabs.interface.ts +0 -10
- package/src/components/tabs/Tabs.styles.ts +0 -24
- package/src/components/tabs/Tabs.tsx +0 -74
- package/src/components/tabs/index.ts +0 -1
- package/src/components/tags/Tags.interface.ts +0 -12
- package/src/components/tags/Tags.styles.ts +0 -36
- package/src/components/tags/Tags.test.tsx +0 -22
- package/src/components/tags/Tags.tsx +0 -76
- package/src/components/tags/index.ts +0 -1
- package/src/components/textInput/Textinput.tsx +0 -124
- package/src/components/textInput/index.ts +0 -1
- package/src/components/toast/Toast.interface.ts +0 -39
- package/src/components/toast/Toast.styles.ts +0 -41
- package/src/components/toast/Toast.test.tsx +0 -13
- package/src/components/toast/Toast.tsx +0 -115
- package/src/components/toast/ToastService.ts +0 -30
- package/src/components/toast/index.ts +0 -1
- package/src/components/toggleButton/ToggleButton.styles.ts +0 -40
- package/src/components/toggleButton/ToggleButton.test.tsx +0 -33
- package/src/components/toggleButton/ToggleButton.tsx +0 -78
- package/src/components/toggleButton/index.ts +0 -1
- package/src/components/topic/Topic.tsx +0 -85
- package/src/components/topic/index.ts +0 -1
- package/src/index.ts +0 -59
- package/src/theme/ThemeContext.tsx +0 -38
- package/src/theme/colors.ts +0 -186
- package/src/theme/fonts.ts +0 -72
- package/src/theme/themes.ts +0 -137
- package/src/theme/withThemeProvider.tsx +0 -14
- package/src/utils/appEnum.ts +0 -109
- package/src/utils/commonStyles.ts +0 -17
- package/src/utils/constants.ts +0 -20
- package/src/utils/deviceUtils.ts +0 -14
- package/src/utils/regex.ts +0 -1
- package/src/utils/stylehelper.ts +0 -13
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {render, screen} from '@testing-library/react-native';
|
|
3
|
-
import StarRating from './rating';
|
|
4
|
-
import {CalenderDots} from '../../assets';
|
|
5
|
-
|
|
6
|
-
describe('Star component', () => {
|
|
7
|
-
it('renders a full star for a rating of 1', () => {
|
|
8
|
-
const rating = 1;
|
|
9
|
-
const count = 5;
|
|
10
|
-
const size = 20;
|
|
11
|
-
|
|
12
|
-
render(
|
|
13
|
-
<StarRating
|
|
14
|
-
rating={rating}
|
|
15
|
-
count={count}
|
|
16
|
-
size={size}
|
|
17
|
-
fullStarIcon={<CalenderDots />}
|
|
18
|
-
halfStarIcon={<CalenderDots />}
|
|
19
|
-
/>,
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const stars = screen.getAllByTestId('star');
|
|
23
|
-
expect(stars.length).toBe(1);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('renders a half star for a rating of 1.5', () => {
|
|
27
|
-
const rating = 1.5;
|
|
28
|
-
const count = 5;
|
|
29
|
-
const size = 20;
|
|
30
|
-
|
|
31
|
-
render(
|
|
32
|
-
<StarRating
|
|
33
|
-
rating={rating}
|
|
34
|
-
count={count}
|
|
35
|
-
size={size}
|
|
36
|
-
fullStarIcon={<CalenderDots />}
|
|
37
|
-
halfStarIcon={<CalenderDots />}
|
|
38
|
-
/>,
|
|
39
|
-
);
|
|
40
|
-
const stars = screen.getAllByTestId('star');
|
|
41
|
-
expect(stars.length).toBe(1);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('renders empty stars for a rating below 1', () => {
|
|
45
|
-
const rating = 0.5;
|
|
46
|
-
const count = 5;
|
|
47
|
-
const size = 20;
|
|
48
|
-
|
|
49
|
-
render(
|
|
50
|
-
<StarRating
|
|
51
|
-
rating={rating}
|
|
52
|
-
count={count}
|
|
53
|
-
size={size}
|
|
54
|
-
fullStarIcon={<CalenderDots />}
|
|
55
|
-
halfStarIcon={<CalenderDots />}
|
|
56
|
-
/>,
|
|
57
|
-
);
|
|
58
|
-
const stars = screen.getAllByTestId('star');
|
|
59
|
-
expect(stars.length).toBe(1);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {View, ViewStyle} from 'react-native';
|
|
3
|
-
import styles from './rating.styles';
|
|
4
|
-
|
|
5
|
-
interface StarProps {
|
|
6
|
-
rating: number;
|
|
7
|
-
count: number;
|
|
8
|
-
size: number;
|
|
9
|
-
fullStarIcon: React.ReactElement;
|
|
10
|
-
halfStarIcon: React.ReactElement;
|
|
11
|
-
fullStarColor?: string;
|
|
12
|
-
emptyStarColor?: string;
|
|
13
|
-
starStyle?: ViewStyle;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const splitRating = (rating: number): [number, number] => {
|
|
17
|
-
const isDecimal = rating !== Math.floor(rating);
|
|
18
|
-
if (isDecimal) {
|
|
19
|
-
const integerPart = Math.floor(rating);
|
|
20
|
-
const decimalPart = rating - integerPart;
|
|
21
|
-
return [integerPart, decimalPart];
|
|
22
|
-
} else {
|
|
23
|
-
return [rating, 0];
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const drawStar = (
|
|
28
|
-
starIndex: number,
|
|
29
|
-
ratingArray: [number, number],
|
|
30
|
-
size: number,
|
|
31
|
-
fullStarIcon: React.ReactElement,
|
|
32
|
-
halfStarIcon: React.ReactElement,
|
|
33
|
-
fullStarColor: string,
|
|
34
|
-
emptyStarColor: string,
|
|
35
|
-
): JSX.Element => {
|
|
36
|
-
const [fullStars, decimalPart] = ratingArray;
|
|
37
|
-
|
|
38
|
-
if (starIndex <= fullStars) {
|
|
39
|
-
return React.cloneElement(fullStarIcon, {
|
|
40
|
-
style: {height: size, width: size},
|
|
41
|
-
fill: fullStarColor,
|
|
42
|
-
testID: `star-${starIndex}`,
|
|
43
|
-
});
|
|
44
|
-
} else if (starIndex === fullStars + 1 && decimalPart >= 0.5) {
|
|
45
|
-
return React.cloneElement(halfStarIcon, {
|
|
46
|
-
style: {height: size, width: size},
|
|
47
|
-
fill: fullStarColor,
|
|
48
|
-
testID: `star-${starIndex}`,
|
|
49
|
-
});
|
|
50
|
-
} else {
|
|
51
|
-
return React.cloneElement(fullStarIcon, {
|
|
52
|
-
style: {height: size, width: size},
|
|
53
|
-
fill: emptyStarColor,
|
|
54
|
-
testID: `star-${starIndex}`,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const Star: React.FC<StarProps> = ({
|
|
60
|
-
rating,
|
|
61
|
-
count,
|
|
62
|
-
size,
|
|
63
|
-
fullStarIcon,
|
|
64
|
-
halfStarIcon,
|
|
65
|
-
fullStarColor = 'gold',
|
|
66
|
-
emptyStarColor = 'gray',
|
|
67
|
-
starStyle,
|
|
68
|
-
}) => {
|
|
69
|
-
const stars: React.ReactElement[] = [];
|
|
70
|
-
for (let i = 0; i < count; i++) {
|
|
71
|
-
const starIndex = i + 1;
|
|
72
|
-
const ratingArray = splitRating(rating);
|
|
73
|
-
const starType = drawStar(
|
|
74
|
-
starIndex,
|
|
75
|
-
ratingArray,
|
|
76
|
-
size,
|
|
77
|
-
fullStarIcon,
|
|
78
|
-
halfStarIcon,
|
|
79
|
-
fullStarColor,
|
|
80
|
-
emptyStarColor,
|
|
81
|
-
);
|
|
82
|
-
stars.push(
|
|
83
|
-
<View key={i} style={[styles.star, starStyle]}>
|
|
84
|
-
{starType}
|
|
85
|
-
</View>,
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<View style={styles.container} testID="star">
|
|
91
|
-
{stars}
|
|
92
|
-
</View>
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export default Star;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import React, {useState} from 'react';
|
|
2
|
-
import {ScrollView, Pressable, View, StyleSheet} from 'react-native';
|
|
3
|
-
import CustomText from '../customText/CustomText';
|
|
4
|
-
import {useTheme} from '../../theme/ThemeContext';
|
|
5
|
-
import {withThemeProvider} from '../../theme/withThemeProvider';
|
|
6
|
-
|
|
7
|
-
interface ScrollableListProps {
|
|
8
|
-
data: {name: string; value: string; isError?: boolean}[] | undefined;
|
|
9
|
-
handleSelectCategory: (name: string, value: string) => void;
|
|
10
|
-
containerStyle?: object;
|
|
11
|
-
scrollViewContentStyle?: object;
|
|
12
|
-
itemStyle?: object;
|
|
13
|
-
selectedItemStyle?: object;
|
|
14
|
-
selectedItemTextColor?: string;
|
|
15
|
-
defaultItemTextColor?: string;
|
|
16
|
-
activeTab?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const ScrollableList = ({
|
|
20
|
-
data,
|
|
21
|
-
handleSelectCategory,
|
|
22
|
-
containerStyle,
|
|
23
|
-
scrollViewContentStyle,
|
|
24
|
-
itemStyle,
|
|
25
|
-
selectedItemStyle,
|
|
26
|
-
selectedItemTextColor = 'CONTENT_PRIMARY',
|
|
27
|
-
defaultItemTextColor = 'CONTENT_SECONDRY',
|
|
28
|
-
activeTab,
|
|
29
|
-
}: ScrollableListProps) => {
|
|
30
|
-
const [selectedItem, setSelectedItem] = useState<string | null>(
|
|
31
|
-
data && data.length > 0 ? data[0].name : null,
|
|
32
|
-
);
|
|
33
|
-
const {theme} = useTheme();
|
|
34
|
-
return (
|
|
35
|
-
<View style={[styles.container, containerStyle]}>
|
|
36
|
-
<ScrollView
|
|
37
|
-
horizontal
|
|
38
|
-
showsHorizontalScrollIndicator={false}
|
|
39
|
-
contentContainerStyle={[
|
|
40
|
-
styles.scrollViewContent,
|
|
41
|
-
scrollViewContentStyle,
|
|
42
|
-
]}>
|
|
43
|
-
{data?.map(item => (
|
|
44
|
-
<Pressable
|
|
45
|
-
key={item.value} // Use item.value as the key
|
|
46
|
-
style={[
|
|
47
|
-
styles.item,
|
|
48
|
-
itemStyle,
|
|
49
|
-
(activeTab ?? selectedItem) === item.name && [
|
|
50
|
-
styles.selectedItem,
|
|
51
|
-
selectedItemStyle,
|
|
52
|
-
],
|
|
53
|
-
]}
|
|
54
|
-
onPress={() => {
|
|
55
|
-
setSelectedItem(item.name);
|
|
56
|
-
handleSelectCategory(item.name, item.value);
|
|
57
|
-
}}>
|
|
58
|
-
<CustomText
|
|
59
|
-
text={item.name}
|
|
60
|
-
variant="L1_REGULAR"
|
|
61
|
-
textColor={
|
|
62
|
-
(activeTab ?? selectedItem) === item.name
|
|
63
|
-
? selectedItemTextColor
|
|
64
|
-
: defaultItemTextColor
|
|
65
|
-
}
|
|
66
|
-
/>
|
|
67
|
-
{item?.isError && (
|
|
68
|
-
<View
|
|
69
|
-
style={[
|
|
70
|
-
styles.errorViewStyle,
|
|
71
|
-
{
|
|
72
|
-
backgroundColor: theme.SURFACE_BRAND_STATIC,
|
|
73
|
-
},
|
|
74
|
-
]}
|
|
75
|
-
/>
|
|
76
|
-
)}
|
|
77
|
-
</Pressable>
|
|
78
|
-
))}
|
|
79
|
-
</ScrollView>
|
|
80
|
-
</View>
|
|
81
|
-
);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const styles = StyleSheet.create({
|
|
85
|
-
container: {
|
|
86
|
-
paddingVertical: 10,
|
|
87
|
-
},
|
|
88
|
-
scrollViewContent: {
|
|
89
|
-
flexDirection: 'row',
|
|
90
|
-
alignItems: 'center',
|
|
91
|
-
},
|
|
92
|
-
item: {
|
|
93
|
-
flexDirection: 'row',
|
|
94
|
-
alignItems: 'center',
|
|
95
|
-
gap: 8,
|
|
96
|
-
padding: 12,
|
|
97
|
-
borderBottomWidth: 2,
|
|
98
|
-
borderBottomColor: 'transparent',
|
|
99
|
-
},
|
|
100
|
-
selectedItem: {
|
|
101
|
-
borderBottomColor: 'white',
|
|
102
|
-
},
|
|
103
|
-
errorViewStyle: {
|
|
104
|
-
width: 6,
|
|
105
|
-
height: 6,
|
|
106
|
-
borderRadius: 100,
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
export default withThemeProvider(ScrollableList);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './category';
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {View, Text, Pressable, FlatList, StyleSheet} from 'react-native';
|
|
3
|
-
|
|
4
|
-
interface Tag {
|
|
5
|
-
value: string;
|
|
6
|
-
name: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface TagsComponentProps {
|
|
10
|
-
tagList: Tag[];
|
|
11
|
-
selectedTag: string; // Allow null for unselected state
|
|
12
|
-
setSelectedTag: (val: string) => void; // Allow null for unselected state
|
|
13
|
-
handleTagPress?: (val: string) => void | undefined;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const TagsComponent: React.FC<TagsComponentProps> = ({
|
|
17
|
-
tagList,
|
|
18
|
-
selectedTag,
|
|
19
|
-
handleTagPress,
|
|
20
|
-
}) => {
|
|
21
|
-
const reorderedTags = (): Tag[] => {
|
|
22
|
-
if (selectedTag) {
|
|
23
|
-
return [
|
|
24
|
-
tagList.find(tag => tag.name === selectedTag)!,
|
|
25
|
-
...tagList.filter(tag => tag.name !== selectedTag),
|
|
26
|
-
];
|
|
27
|
-
}
|
|
28
|
-
return tagList;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const renderTagItem = ({item}: {item: Tag}) => (
|
|
32
|
-
<Pressable
|
|
33
|
-
onPress={() => handleTagPress?.(item.name)}
|
|
34
|
-
style={[
|
|
35
|
-
styles.tagButton,
|
|
36
|
-
selectedTag === item?.name
|
|
37
|
-
? styles.selectedTagButton
|
|
38
|
-
: styles.unselectedTagButton,
|
|
39
|
-
]}>
|
|
40
|
-
<Text
|
|
41
|
-
style={[
|
|
42
|
-
styles.tagText,
|
|
43
|
-
selectedTag === item?.name
|
|
44
|
-
? styles.selectedTagText
|
|
45
|
-
: styles.unselectedTagText,
|
|
46
|
-
]}>
|
|
47
|
-
{item?.name}
|
|
48
|
-
</Text>
|
|
49
|
-
{selectedTag === item?.name && <Text style={styles.closeButton}>✕</Text>}
|
|
50
|
-
</Pressable>
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<View>
|
|
55
|
-
<FlatList
|
|
56
|
-
data={reorderedTags()}
|
|
57
|
-
renderItem={renderTagItem}
|
|
58
|
-
keyExtractor={item => item?.name}
|
|
59
|
-
horizontal
|
|
60
|
-
showsHorizontalScrollIndicator={false}
|
|
61
|
-
contentContainerStyle={styles.listContainer}
|
|
62
|
-
/>
|
|
63
|
-
</View>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const styles = StyleSheet.create({
|
|
68
|
-
listContainer: {
|
|
69
|
-
paddingHorizontal: 10,
|
|
70
|
-
alignItems: 'center',
|
|
71
|
-
},
|
|
72
|
-
tagButton: {
|
|
73
|
-
flexDirection: 'row',
|
|
74
|
-
alignItems: 'center',
|
|
75
|
-
paddingVertical: 8,
|
|
76
|
-
paddingHorizontal: 12,
|
|
77
|
-
borderRadius: 20,
|
|
78
|
-
marginHorizontal: 8,
|
|
79
|
-
borderWidth: 1,
|
|
80
|
-
},
|
|
81
|
-
selectedTagButton: {
|
|
82
|
-
backgroundColor: '#FFF',
|
|
83
|
-
borderColor: '#000',
|
|
84
|
-
},
|
|
85
|
-
unselectedTagButton: {
|
|
86
|
-
backgroundColor: 'transparent',
|
|
87
|
-
borderColor: '#888',
|
|
88
|
-
},
|
|
89
|
-
tagText: {
|
|
90
|
-
fontSize: 16,
|
|
91
|
-
},
|
|
92
|
-
selectedTagText: {
|
|
93
|
-
color: '#000',
|
|
94
|
-
},
|
|
95
|
-
unselectedTagText: {
|
|
96
|
-
color: '#888',
|
|
97
|
-
},
|
|
98
|
-
closeButton: {
|
|
99
|
-
marginLeft: 10,
|
|
100
|
-
fontSize: 18,
|
|
101
|
-
color: '#000',
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
export default TagsComponent;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './TagSingleSelection';
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {View} from 'react-native';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {CheckWhite} from '../../assets';
|
|
4
|
-
import {styles} from './styles';
|
|
5
|
-
import {IData, IProps, Status} from './stepper.interface';
|
|
6
|
-
import {FontStyle} from '../../utils/appEnum';
|
|
7
|
-
import CustomTypography from '../customTypography';
|
|
8
|
-
import {useTheme} from '../../theme/ThemeContext';
|
|
9
|
-
import {withThemeProvider} from '../../theme/withThemeProvider';
|
|
10
|
-
|
|
11
|
-
const Stepper = ({
|
|
12
|
-
containerStyle,
|
|
13
|
-
showStepCount = false,
|
|
14
|
-
showStatus = false,
|
|
15
|
-
data,
|
|
16
|
-
}: IProps) => {
|
|
17
|
-
const {theme} = useTheme();
|
|
18
|
-
|
|
19
|
-
const renderCircleStyle = (status?: string) => {
|
|
20
|
-
if (status === Status.Active) {
|
|
21
|
-
return {...styles.activeStepCircle, borderColor: theme.CONTENT_PRIMARY};
|
|
22
|
-
} else if (status === Status.Inactive) {
|
|
23
|
-
return {
|
|
24
|
-
...styles.inactiveStepCircle,
|
|
25
|
-
borderColor: theme.CONTENT_SECONDRY,
|
|
26
|
-
};
|
|
27
|
-
} else if (status === Status.Completed) {
|
|
28
|
-
return {...styles.completeStepCircle, backgroundColor: theme.SUCCESS};
|
|
29
|
-
} else {
|
|
30
|
-
return {...styles.stepCountCircle, borderColor: theme.BORDER_PRIMARY};
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const renderLableStyle = (status?: string) => {
|
|
34
|
-
if (status === Status.Active) {
|
|
35
|
-
return {...styles.activeStepLabel, color: theme.CONTENT_PRIMARY};
|
|
36
|
-
} else if (status === Status.Inactive) {
|
|
37
|
-
return {...styles.inactiveStepLabel, color: theme.CONTENT_SECONDRY};
|
|
38
|
-
} else if (status === Status.Completed) {
|
|
39
|
-
return {...styles.completeStepLabel, color: theme.CONTENT_PRIMARY};
|
|
40
|
-
} else {
|
|
41
|
-
return {...styles.countStepLabel, color: theme.CONTENT_PRIMARY};
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const renderDividerStyle = (status?: string) => {
|
|
46
|
-
if (status === Status.Active) {
|
|
47
|
-
return {borderColor: theme.BORDER_PRIMARY};
|
|
48
|
-
} else if (status === Status.Inactive) {
|
|
49
|
-
return {borderColor: theme.BORDER_PRIMARY};
|
|
50
|
-
} else if (status === Status.Completed) {
|
|
51
|
-
return {
|
|
52
|
-
...styles.completeStepDivider,
|
|
53
|
-
borderColor: theme.CONTENT_PRIMARY,
|
|
54
|
-
};
|
|
55
|
-
} else {
|
|
56
|
-
return {borderColor: theme.CONTENT_SECONDRY};
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<View style={{...styles.stepperContainer, ...containerStyle}}>
|
|
62
|
-
{data?.map((item: IData, index) => {
|
|
63
|
-
const stepCircleStyle = renderCircleStyle(item?.status);
|
|
64
|
-
const dividerStyle = renderDividerStyle(item?.status);
|
|
65
|
-
const labelStyle = renderLableStyle(item?.status);
|
|
66
|
-
const lastViewStyle =
|
|
67
|
-
index === data?.length - 1 ? styles.lastStepWrapper : null;
|
|
68
|
-
return (
|
|
69
|
-
<View
|
|
70
|
-
key={index?.toString()}
|
|
71
|
-
style={{...styles.stepperWrapper, ...lastViewStyle}}>
|
|
72
|
-
<View style={styles.stepperSeparatorContainer}>
|
|
73
|
-
<View style={{...stepCircleStyle}}>
|
|
74
|
-
{showStepCount && (
|
|
75
|
-
<CustomTypography
|
|
76
|
-
text={item?.step}
|
|
77
|
-
variant={FontStyle.L2_REGULAR}
|
|
78
|
-
style={{
|
|
79
|
-
color: theme.CONTENT_PRIMARY,
|
|
80
|
-
}}
|
|
81
|
-
/>
|
|
82
|
-
)}
|
|
83
|
-
{showStatus && item?.status === Status.Completed && (
|
|
84
|
-
<CheckWhite />
|
|
85
|
-
)}
|
|
86
|
-
</View>
|
|
87
|
-
{index != data?.length - 1 && (
|
|
88
|
-
<View style={{...styles.separator, ...dividerStyle}} />
|
|
89
|
-
)}
|
|
90
|
-
</View>
|
|
91
|
-
<View style={styles.lableContainer}>
|
|
92
|
-
<CustomTypography
|
|
93
|
-
text={item?.label}
|
|
94
|
-
variant={FontStyle.L3_REGULAR}
|
|
95
|
-
style={labelStyle}
|
|
96
|
-
/>
|
|
97
|
-
</View>
|
|
98
|
-
</View>
|
|
99
|
-
);
|
|
100
|
-
})}
|
|
101
|
-
</View>
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export default withThemeProvider(Stepper);
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {ViewStyle} from 'react-native';
|
|
2
|
-
|
|
3
|
-
type StatusType = 'Active' | 'Inactive' | 'Completed' | 'Rejected' | 'Count';
|
|
4
|
-
|
|
5
|
-
export enum Status {
|
|
6
|
-
Active = 'Active',
|
|
7
|
-
Inactive = 'Inactive',
|
|
8
|
-
Completed = 'Completed',
|
|
9
|
-
Rejected = 'Rejected',
|
|
10
|
-
Count = 'Count',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface IData {
|
|
14
|
-
step: string;
|
|
15
|
-
label?: string;
|
|
16
|
-
status?: StatusType;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface IProps {
|
|
20
|
-
containerStyle?: ViewStyle;
|
|
21
|
-
showStepCount?: boolean;
|
|
22
|
-
showStatus?: boolean;
|
|
23
|
-
data: IData[];
|
|
24
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
-
|
|
3
|
-
const styles = StyleSheet.create({
|
|
4
|
-
stepperContainer: {
|
|
5
|
-
flexDirection: 'row',
|
|
6
|
-
marginBottom: 24,
|
|
7
|
-
justifyContent: 'space-between',
|
|
8
|
-
},
|
|
9
|
-
stepperWrapper: {
|
|
10
|
-
flex: 1,
|
|
11
|
-
marginRight: 10,
|
|
12
|
-
overflow: 'hidden',
|
|
13
|
-
},
|
|
14
|
-
lastStepWrapper: {flex: 0.5},
|
|
15
|
-
stepperSeparatorContainer: {
|
|
16
|
-
flexDirection: 'row',
|
|
17
|
-
alignItems: 'center',
|
|
18
|
-
},
|
|
19
|
-
activeStepCircle: {
|
|
20
|
-
height: 24,
|
|
21
|
-
width: 24,
|
|
22
|
-
borderRadius: 12,
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
borderWidth: 2,
|
|
25
|
-
justifyContent: 'center',
|
|
26
|
-
},
|
|
27
|
-
activeStepLabel: {
|
|
28
|
-
marginTop: 11,
|
|
29
|
-
},
|
|
30
|
-
inactiveStepCircle: {
|
|
31
|
-
height: 24,
|
|
32
|
-
width: 24,
|
|
33
|
-
borderRadius: 12,
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
borderWidth: 2,
|
|
36
|
-
justifyContent: 'center',
|
|
37
|
-
},
|
|
38
|
-
inactiveStepLabel: {
|
|
39
|
-
marginTop: 11,
|
|
40
|
-
},
|
|
41
|
-
completeStepCircle: {
|
|
42
|
-
height: 24,
|
|
43
|
-
width: 24,
|
|
44
|
-
borderRadius: 12,
|
|
45
|
-
alignItems: 'center',
|
|
46
|
-
justifyContent: 'center',
|
|
47
|
-
},
|
|
48
|
-
completeStepLabel: {
|
|
49
|
-
marginTop: 11,
|
|
50
|
-
},
|
|
51
|
-
completeStepDivider: {
|
|
52
|
-
borderStyle: 'solid',
|
|
53
|
-
},
|
|
54
|
-
stepCountCircle: {
|
|
55
|
-
height: 24,
|
|
56
|
-
width: 24,
|
|
57
|
-
borderRadius: 12,
|
|
58
|
-
alignItems: 'center',
|
|
59
|
-
borderWidth: 1,
|
|
60
|
-
justifyContent: 'center',
|
|
61
|
-
},
|
|
62
|
-
countStepLabel: {
|
|
63
|
-
marginTop: 11,
|
|
64
|
-
},
|
|
65
|
-
separator: {
|
|
66
|
-
borderWidth: 1,
|
|
67
|
-
borderStyle: 'dashed',
|
|
68
|
-
width: '100%',
|
|
69
|
-
marginLeft: 10,
|
|
70
|
-
},
|
|
71
|
-
lableContainer: {width: 60},
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
export {styles};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import {ReactNode} from 'react';
|
|
2
|
-
import {TextStyle, ViewStyle} from 'react-native';
|
|
3
|
-
|
|
4
|
-
export interface ListItem {
|
|
5
|
-
id: string;
|
|
6
|
-
templateId: number;
|
|
7
|
-
title: string;
|
|
8
|
-
subTitle: string;
|
|
9
|
-
icon: string;
|
|
10
|
-
isRead: boolean;
|
|
11
|
-
isPinned: boolean;
|
|
12
|
-
isDeleted: boolean;
|
|
13
|
-
isActionable: boolean;
|
|
14
|
-
category: string;
|
|
15
|
-
url: string;
|
|
16
|
-
channel: string;
|
|
17
|
-
status: string;
|
|
18
|
-
createdBy: string;
|
|
19
|
-
createdDateTime: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface ActionButtonProps {
|
|
23
|
-
icon: ReactNode;
|
|
24
|
-
title?: string;
|
|
25
|
-
onPress: () => void;
|
|
26
|
-
style?: object;
|
|
27
|
-
testID: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface SwipableListProps {
|
|
31
|
-
data: ListItem[];
|
|
32
|
-
testId?: string;
|
|
33
|
-
renderItem: (item: ListItem) => ReactNode;
|
|
34
|
-
leftPrimaryActionActiveIcon?: ReactNode;
|
|
35
|
-
leftPrimaryActionActiveTitle?: string;
|
|
36
|
-
leftPrimaryActionInActiveIcon?: ReactNode;
|
|
37
|
-
leftPrimaryActionInActiveTitle?: string;
|
|
38
|
-
leftPrimaryActionHandler?: (item: ListItem) => void;
|
|
39
|
-
leftPrimaryActionStyle?: ViewStyle;
|
|
40
|
-
leftSecondaryActionActiveIcon?: ReactNode;
|
|
41
|
-
leftSecondaryActionActiveTitle?: string;
|
|
42
|
-
leftSecondaryActionInActiveIcon?: ReactNode;
|
|
43
|
-
leftSecondaryActionInActiveTitle?: string;
|
|
44
|
-
leftSecondaryActionHandler?: (item: ListItem) => void;
|
|
45
|
-
leftSecondaryActionStyle?: ViewStyle;
|
|
46
|
-
rightPrimaryActionIcon?: ReactNode;
|
|
47
|
-
rightPrimaryActionTitle?: string;
|
|
48
|
-
rightPrimaryActionHandler?: (item: ListItem) => void;
|
|
49
|
-
rightPrimaryActionStyle?: ViewStyle;
|
|
50
|
-
itemStyle?: ViewStyle;
|
|
51
|
-
titleStyle?: TextStyle;
|
|
52
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {horizontalScale, verticalScale} from '../../utils/stylehelper';
|
|
2
|
-
import {StyleSheet} from 'react-native';
|
|
3
|
-
|
|
4
|
-
export const styles = StyleSheet.create({
|
|
5
|
-
container: {
|
|
6
|
-
flex: 1,
|
|
7
|
-
},
|
|
8
|
-
swippableContainer: {paddingVertical: verticalScale(16)},
|
|
9
|
-
actionButton: {
|
|
10
|
-
justifyContent: 'center',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
},
|
|
13
|
-
titleStyle: {
|
|
14
|
-
color: '#fff',
|
|
15
|
-
},
|
|
16
|
-
leftActions: {
|
|
17
|
-
flexDirection: 'row',
|
|
18
|
-
justifyContent: 'center',
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
width: horizontalScale(150),
|
|
21
|
-
gap: horizontalScale(24),
|
|
22
|
-
},
|
|
23
|
-
rightActions: {
|
|
24
|
-
flexDirection: 'row',
|
|
25
|
-
paddingHorizontal: horizontalScale(24),
|
|
26
|
-
},
|
|
27
|
-
seprator: {
|
|
28
|
-
height: verticalScale(16),
|
|
29
|
-
},
|
|
30
|
-
});
|