dhre-ui-kit 0.0.70 → 0.0.72
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/package.json +2 -1
- package/src/App.tsx +2 -29
- package/src/assets/images/uploadFileIcon.svg +12 -0
- package/src/assets/index.ts +2 -0
- package/src/components/accordion/Accordion.interface.ts +1 -0
- package/src/components/accordion/Accordion.styles.ts +2 -2
- package/src/components/accordion/Accordion.tsx +22 -15
- package/src/components/customDocumentPicker/CustomDocumentPicker.interface.ts +9 -0
- package/src/components/customDocumentPicker/CustomDocumentPicker.styles.ts +23 -0
- package/src/components/customDocumentPicker/CustomDocumentPicker.tsx +78 -0
- package/src/components/customDocumentPicker/index.ts +1 -0
- package/src/components/dateRangePicker/DateRangePicker.tsx +6 -3
- package/src/components/scrollList/category.tsx +21 -2
- package/src/index.ts +1 -0
- package/src/theme/ThemeContext.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dhre-ui-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.72",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"react-native-blob-util": "^0.19.11",
|
|
33
33
|
"react-native-calendars": "^1.1306.0",
|
|
34
34
|
"react-native-country-picker-modal": "^2.0.0",
|
|
35
|
+
"react-native-document-picker": "^9.3.1",
|
|
35
36
|
"react-native-element-dropdown": "^2.12.1",
|
|
36
37
|
"react-native-gesture-handler": "2.17.0",
|
|
37
38
|
"react-native-otp-verify": "^1.1.8",
|
package/src/App.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {ThemeProvider} from './theme/ThemeContext';
|
|
3
|
-
import {Badge, Line} from './index';
|
|
3
|
+
import {Badge, DateRangePicker, Line} from './index';
|
|
4
4
|
import {ArrowLeft, CalenderDots} from './assets';
|
|
5
5
|
import {View} from 'react-native';
|
|
6
6
|
import CustomButton from './components/button/Button';
|
|
@@ -8,34 +8,7 @@ import CustomButton from './components/button/Button';
|
|
|
8
8
|
const App = () => {
|
|
9
9
|
return (
|
|
10
10
|
<ThemeProvider>
|
|
11
|
-
<
|
|
12
|
-
<Badge
|
|
13
|
-
handleIconPress={function (): void {}}
|
|
14
|
-
text="gggsdfghjhgf"
|
|
15
|
-
style={{margin: 20}}
|
|
16
|
-
iconName={<CalenderDots width={20} height={20} />}
|
|
17
|
-
textStyle={{color: 'black'}}
|
|
18
|
-
iconStyle={{}}
|
|
19
|
-
/>
|
|
20
|
-
<Line />
|
|
21
|
-
<CustomButton
|
|
22
|
-
title="Yes"
|
|
23
|
-
onPress={() => console.log('Yes Button Pressed')}
|
|
24
|
-
leftIcon={<ArrowLeft />}
|
|
25
|
-
// titleColor={color.CONTENT_SECONDRY[currentTheme]}
|
|
26
|
-
titleVariant="L2_REGULAR"
|
|
27
|
-
containerStyle={[
|
|
28
|
-
{
|
|
29
|
-
borderWidth: 1,
|
|
30
|
-
borderRadius: 20,
|
|
31
|
-
|
|
32
|
-
height: 40,
|
|
33
|
-
},
|
|
34
|
-
]}
|
|
35
|
-
// iconStyle={styles.iconStyle}
|
|
36
|
-
imagePosition="left"
|
|
37
|
-
/>
|
|
38
|
-
</View>
|
|
11
|
+
<DateRangePicker onButtonPress={() => {}} />
|
|
39
12
|
</ThemeProvider>
|
|
40
13
|
);
|
|
41
14
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_489_41808)">
|
|
3
|
+
<path d="M12 14V3.5" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M20.25 14V20H3.75V14" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path d="M8.25 7.25L12 3.5L15.75 7.25" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
</g>
|
|
7
|
+
<defs>
|
|
8
|
+
<clipPath id="clip0_489_41808">
|
|
9
|
+
<rect width="24" height="24" fill="white" transform="translate(0 0.5)"/>
|
|
10
|
+
</clipPath>
|
|
11
|
+
</defs>
|
|
12
|
+
</svg>
|
package/src/assets/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ import HeaderIcon from './images/dotsThreeVertical.svg';
|
|
|
8
8
|
import CircleTick from './images/circleTick.svg';
|
|
9
9
|
import ArrowLeft from './images/arrowLeft.svg';
|
|
10
10
|
import BellSimple from './images/bellSimple.svg';
|
|
11
|
+
import UploadFile from './images/uploadFileIcon.svg';
|
|
11
12
|
|
|
12
13
|
export {
|
|
13
14
|
CalenderDots,
|
|
@@ -20,4 +21,5 @@ export {
|
|
|
20
21
|
CircleTick,
|
|
21
22
|
ArrowLeft,
|
|
22
23
|
BellSimple,
|
|
24
|
+
UploadFile,
|
|
23
25
|
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
|
|
8
8
|
const styles = StyleSheet.create({
|
|
9
9
|
container: {
|
|
10
|
-
paddingVertical: verticalScale(
|
|
10
|
+
paddingVertical: verticalScale(24),
|
|
11
11
|
borderBottomWidth: moderateScale(1),
|
|
12
12
|
borderBottomColor: '#282828',
|
|
13
13
|
},
|
|
@@ -15,7 +15,7 @@ const styles = StyleSheet.create({
|
|
|
15
15
|
flexDirection: 'row',
|
|
16
16
|
justifyContent: 'space-between',
|
|
17
17
|
alignItems: 'center',
|
|
18
|
-
paddingHorizontal: horizontalScale(
|
|
18
|
+
paddingHorizontal: horizontalScale(24),
|
|
19
19
|
},
|
|
20
20
|
title: {flex: 1, color: '#FFFFFF'},
|
|
21
21
|
iconStyle: {marginLeft: horizontalScale(20)},
|
|
@@ -15,7 +15,8 @@ const Accordion = ({
|
|
|
15
15
|
children,
|
|
16
16
|
isOpen,
|
|
17
17
|
onToggle,
|
|
18
|
-
optionalElement, // Destructure the new prop
|
|
18
|
+
optionalElement, // Destructure the new prop,
|
|
19
|
+
headerComponent,
|
|
19
20
|
}: AccordionProps) => {
|
|
20
21
|
const contentRef = useRef<View>(null);
|
|
21
22
|
const [animation] = useState(new Animated.Value(0));
|
|
@@ -45,11 +46,15 @@ const Accordion = ({
|
|
|
45
46
|
return (
|
|
46
47
|
<View style={[styles.container, containerStyle]} testID={testId}>
|
|
47
48
|
<Pressable style={[styles.header, headerStyle]} onPress={onToggle}>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
{headerComponent ? (
|
|
50
|
+
headerComponent()
|
|
51
|
+
) : (
|
|
52
|
+
<CustomTypography
|
|
53
|
+
variant={'B4_REGULAR'}
|
|
54
|
+
text={title}
|
|
55
|
+
style={[styles.title, titleStyle]}
|
|
56
|
+
/>
|
|
57
|
+
)}
|
|
53
58
|
{React.cloneElement(isOpen ? <CaretUp /> : <CaretDown />, {
|
|
54
59
|
width: moderateScale(20),
|
|
55
60
|
height: moderateScale(20),
|
|
@@ -59,15 +64,17 @@ const Accordion = ({
|
|
|
59
64
|
|
|
60
65
|
{optionalElement ? optionalElement() : null}
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
<View
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
{isOpen && (
|
|
68
|
+
<Animated.View style={[styles.content, {height: cardHeight}]}>
|
|
69
|
+
<View
|
|
70
|
+
ref={contentRef}
|
|
71
|
+
onLayout={(event: LayoutChangeEvent) => {
|
|
72
|
+
setContentHeight(event.nativeEvent.layout.height);
|
|
73
|
+
}}>
|
|
74
|
+
{children}
|
|
75
|
+
</View>
|
|
76
|
+
</Animated.View>
|
|
77
|
+
)}
|
|
71
78
|
</View>
|
|
72
79
|
);
|
|
73
80
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {DocumentPickerResponse} from 'react-native-document-picker';
|
|
2
|
+
|
|
3
|
+
export interface CustomDocumentPickerProps {
|
|
4
|
+
onDocumentUpload: (document: DocumentPickerResponse) => void;
|
|
5
|
+
title?: string;
|
|
6
|
+
hint?: string;
|
|
7
|
+
maxFileSize?: number;
|
|
8
|
+
fileTypes?: string[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
import {
|
|
3
|
+
verticalScale,
|
|
4
|
+
horizontalScale,
|
|
5
|
+
moderateScale,
|
|
6
|
+
} from '../../utils/stylehelper';
|
|
7
|
+
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
paddingVertical: verticalScale(16),
|
|
13
|
+
paddingHorizontal: horizontalScale(24),
|
|
14
|
+
borderWidth: 1,
|
|
15
|
+
borderStyle: 'dashed',
|
|
16
|
+
borderRadius: moderateScale(8),
|
|
17
|
+
gap: moderateScale(24),
|
|
18
|
+
marginBottom: verticalScale(8),
|
|
19
|
+
},
|
|
20
|
+
titleContainer: {gap: verticalScale(4)},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export default styles;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
|
+
import {View, Pressable, Alert} from 'react-native';
|
|
3
|
+
import DocumentPicker from 'react-native-document-picker';
|
|
4
|
+
import {UploadFile} from '../../assets';
|
|
5
|
+
import {FontStyle} from '../../utils/appEnum';
|
|
6
|
+
import CustomTypography from '../customTypography';
|
|
7
|
+
import {useTheme} from '../../theme/ThemeContext';
|
|
8
|
+
import styles from './CustomDocumentPicker.styles';
|
|
9
|
+
import {CustomDocumentPickerProps} from './CustomDocumentPicker.interface';
|
|
10
|
+
|
|
11
|
+
const CustomDocumentPicker = ({
|
|
12
|
+
onDocumentUpload,
|
|
13
|
+
title = 'Upload Images/Videos',
|
|
14
|
+
hint = 'PNG, JPEG (max size. 4MB)',
|
|
15
|
+
maxFileSize = 4,
|
|
16
|
+
fileTypes = [DocumentPicker.types.images, DocumentPicker.types.pdf],
|
|
17
|
+
}: CustomDocumentPickerProps) => {
|
|
18
|
+
const [error, setError] = useState('');
|
|
19
|
+
|
|
20
|
+
const pickDocument = async () => {
|
|
21
|
+
try {
|
|
22
|
+
const res = await DocumentPicker.pickSingle({
|
|
23
|
+
type: fileTypes,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (res?.size && res?.size > maxFileSize * 1024 * 1024) {
|
|
27
|
+
setError(
|
|
28
|
+
`File size higher than ${maxFileSize}MB. Please upload a smaller file.`,
|
|
29
|
+
);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
onDocumentUpload(res);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
if (DocumentPicker.isCancel(err)) {
|
|
35
|
+
Alert.alert('User canceled the picker');
|
|
36
|
+
} else if (err instanceof Error) {
|
|
37
|
+
Alert.alert('Unknown Error: ' + err.message);
|
|
38
|
+
} else {
|
|
39
|
+
Alert.alert('Unknown Error: ' + JSON.stringify(err));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const {theme} = useTheme();
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<Pressable
|
|
48
|
+
style={[
|
|
49
|
+
styles.container,
|
|
50
|
+
{borderColor: error ? theme.ERROR : theme.BORDER_SECONDRY},
|
|
51
|
+
]}
|
|
52
|
+
onPress={pickDocument}>
|
|
53
|
+
<UploadFile />
|
|
54
|
+
<View style={styles.titleContainer}>
|
|
55
|
+
<CustomTypography
|
|
56
|
+
variant={FontStyle.L2_REGULAR}
|
|
57
|
+
text={title}
|
|
58
|
+
style={{color: theme.CONTENT_PRIMARY}}
|
|
59
|
+
/>
|
|
60
|
+
<CustomTypography
|
|
61
|
+
variant={FontStyle.L3_REGULAR}
|
|
62
|
+
text={hint}
|
|
63
|
+
style={{color: theme.CONTENT_SECONDRY}}
|
|
64
|
+
/>
|
|
65
|
+
</View>
|
|
66
|
+
</Pressable>
|
|
67
|
+
{error && (
|
|
68
|
+
<CustomTypography
|
|
69
|
+
variant={FontStyle.L2_REGULAR}
|
|
70
|
+
text={error}
|
|
71
|
+
style={{color: theme.ERROR}}
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
74
|
+
</>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default CustomDocumentPicker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './CustomDocumentPicker';
|
|
@@ -68,9 +68,12 @@ const DateRangePicker = (props: DateRangePickerProps) => {
|
|
|
68
68
|
return (
|
|
69
69
|
<View>
|
|
70
70
|
<Calendar
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
// markedDates={{
|
|
72
|
+
// [selectedDate]: { selected: true, marked: true, selectedColor: 'blue' },
|
|
73
|
+
// }}
|
|
74
|
+
// markedDates={getMarkedDates()}
|
|
75
|
+
// mode="date"
|
|
76
|
+
// markingType={'period'}
|
|
74
77
|
theme={{
|
|
75
78
|
calendarBackground: 'transparent',
|
|
76
79
|
arrowColor: '#fff',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, {useState} from 'react';
|
|
2
2
|
import {ScrollView, Pressable, View, StyleSheet} from 'react-native';
|
|
3
3
|
import CustomText from '../customText/CustomText';
|
|
4
|
+
import {useTheme} from '../../theme/ThemeContext';
|
|
4
5
|
|
|
5
6
|
interface ScrollableListProps {
|
|
6
|
-
data: {name: string; value: string}[] | undefined;
|
|
7
|
+
data: {name: string; value: string; isError?: boolean}[] | undefined;
|
|
7
8
|
handleSelectCategory: (value: string) => void;
|
|
8
9
|
containerStyle?: object;
|
|
9
10
|
scrollViewContentStyle?: object;
|
|
@@ -26,7 +27,7 @@ const ScrollableList = ({
|
|
|
26
27
|
const [selectedItem, setSelectedItem] = useState<string | null>(
|
|
27
28
|
data && data.length > 0 ? data[0].name : null,
|
|
28
29
|
);
|
|
29
|
-
|
|
30
|
+
const {theme} = useTheme();
|
|
30
31
|
return (
|
|
31
32
|
<View style={[styles.container, containerStyle]}>
|
|
32
33
|
<ScrollView
|
|
@@ -60,6 +61,16 @@ const ScrollableList = ({
|
|
|
60
61
|
: defaultItemTextColor
|
|
61
62
|
}
|
|
62
63
|
/>
|
|
64
|
+
{item?.isError && (
|
|
65
|
+
<View
|
|
66
|
+
style={[
|
|
67
|
+
styles.errorViewStyle,
|
|
68
|
+
{
|
|
69
|
+
backgroundColor: theme.SURFACE_BRAND_STATIC,
|
|
70
|
+
},
|
|
71
|
+
]}
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
63
74
|
</Pressable>
|
|
64
75
|
))}
|
|
65
76
|
</ScrollView>
|
|
@@ -76,6 +87,9 @@ const styles = StyleSheet.create({
|
|
|
76
87
|
alignItems: 'center',
|
|
77
88
|
},
|
|
78
89
|
item: {
|
|
90
|
+
flexDirection: 'row',
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
gap: 8,
|
|
79
93
|
padding: 12,
|
|
80
94
|
borderBottomWidth: 2,
|
|
81
95
|
borderBottomColor: 'transparent',
|
|
@@ -83,6 +97,11 @@ const styles = StyleSheet.create({
|
|
|
83
97
|
selectedItem: {
|
|
84
98
|
borderBottomColor: 'white',
|
|
85
99
|
},
|
|
100
|
+
errorViewStyle: {
|
|
101
|
+
width: 6,
|
|
102
|
+
height: 6,
|
|
103
|
+
borderRadius: 100,
|
|
104
|
+
},
|
|
86
105
|
});
|
|
87
106
|
|
|
88
107
|
export default ScrollableList;
|
package/src/index.ts
CHANGED
|
@@ -39,6 +39,7 @@ export {default as DropDown} from './components/dropDown';
|
|
|
39
39
|
export {default as CustomSwitchBtn} from './components/customSwitchBtn';
|
|
40
40
|
export {default as toastService} from './components/toast/ToastService';
|
|
41
41
|
export {default as SingleSelectionTags} from './components/singleSelectionTag';
|
|
42
|
+
export {default as CustomDocumentPicker} from './components/customDocumentPicker';
|
|
42
43
|
export {FONT_STYLES} from './theme/fonts';
|
|
43
44
|
export {FontStyle, Theme} from './utils/appEnum';
|
|
44
45
|
|
|
@@ -14,8 +14,8 @@ interface ThemeProviderProps {
|
|
|
14
14
|
|
|
15
15
|
export const ThemeProvider: React.FC<ThemeProviderProps> = ({children}) => {
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
const mode = useSelector((state: any) => state.theme.currentTheme);
|
|
18
|
-
|
|
17
|
+
// const mode = useSelector((state: any) => state.theme.currentTheme);
|
|
18
|
+
const mode = 'light'
|
|
19
19
|
// Filter the theme based on the mode (light or dark)
|
|
20
20
|
const filteredTheme = Object.keys(theme).reduce((acc, key) => {
|
|
21
21
|
acc[key] = theme[key][mode];
|