dhre-ui-kit 0.0.71 → 0.0.73
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 +1 -1
- package/src/App.tsx +2 -29
- 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.tsx +2 -1
- package/src/components/scrollList/category.tsx +23 -3
- package/src/theme/ThemeContext.tsx +2 -2
- package/src/theme/themes.ts +28 -0
- package/src/utils/appEnum.ts +7 -0
package/package.json
CHANGED
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
|
};
|
|
@@ -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
|
};
|
|
@@ -7,6 +7,7 @@ import CustomTypography from '../customTypography';
|
|
|
7
7
|
import {useTheme} from '../../theme/ThemeContext';
|
|
8
8
|
import styles from './CustomDocumentPicker.styles';
|
|
9
9
|
import {CustomDocumentPickerProps} from './CustomDocumentPicker.interface';
|
|
10
|
+
import {withThemeProvider} from '../../theme/withThemeProvider';
|
|
10
11
|
|
|
11
12
|
const CustomDocumentPicker = ({
|
|
12
13
|
onDocumentUpload,
|
|
@@ -75,4 +76,4 @@ const CustomDocumentPicker = ({
|
|
|
75
76
|
);
|
|
76
77
|
};
|
|
77
78
|
|
|
78
|
-
export default CustomDocumentPicker;
|
|
79
|
+
export default withThemeProvider(CustomDocumentPicker);
|
|
@@ -1,9 +1,11 @@
|
|
|
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';
|
|
5
|
+
import {withThemeProvider} from '../../theme/withThemeProvider';
|
|
4
6
|
|
|
5
7
|
interface ScrollableListProps {
|
|
6
|
-
data: {name: string; value: string}[] | undefined;
|
|
8
|
+
data: {name: string; value: string; isError?: boolean}[] | undefined;
|
|
7
9
|
handleSelectCategory: (value: string) => void;
|
|
8
10
|
containerStyle?: object;
|
|
9
11
|
scrollViewContentStyle?: object;
|
|
@@ -26,7 +28,7 @@ const ScrollableList = ({
|
|
|
26
28
|
const [selectedItem, setSelectedItem] = useState<string | null>(
|
|
27
29
|
data && data.length > 0 ? data[0].name : null,
|
|
28
30
|
);
|
|
29
|
-
|
|
31
|
+
const {theme} = useTheme();
|
|
30
32
|
return (
|
|
31
33
|
<View style={[styles.container, containerStyle]}>
|
|
32
34
|
<ScrollView
|
|
@@ -60,6 +62,16 @@ const ScrollableList = ({
|
|
|
60
62
|
: defaultItemTextColor
|
|
61
63
|
}
|
|
62
64
|
/>
|
|
65
|
+
{item?.isError && (
|
|
66
|
+
<View
|
|
67
|
+
style={[
|
|
68
|
+
styles.errorViewStyle,
|
|
69
|
+
{
|
|
70
|
+
backgroundColor: theme.SURFACE_BRAND_STATIC,
|
|
71
|
+
},
|
|
72
|
+
]}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
63
75
|
</Pressable>
|
|
64
76
|
))}
|
|
65
77
|
</ScrollView>
|
|
@@ -76,6 +88,9 @@ const styles = StyleSheet.create({
|
|
|
76
88
|
alignItems: 'center',
|
|
77
89
|
},
|
|
78
90
|
item: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
gap: 8,
|
|
79
94
|
padding: 12,
|
|
80
95
|
borderBottomWidth: 2,
|
|
81
96
|
borderBottomColor: 'transparent',
|
|
@@ -83,6 +98,11 @@ const styles = StyleSheet.create({
|
|
|
83
98
|
selectedItem: {
|
|
84
99
|
borderBottomColor: 'white',
|
|
85
100
|
},
|
|
101
|
+
errorViewStyle: {
|
|
102
|
+
width: 6,
|
|
103
|
+
height: 6,
|
|
104
|
+
borderRadius: 100,
|
|
105
|
+
},
|
|
86
106
|
});
|
|
87
107
|
|
|
88
|
-
export default ScrollableList;
|
|
108
|
+
export default withThemeProvider(ScrollableList);
|
|
@@ -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];
|
package/src/theme/themes.ts
CHANGED
|
@@ -9,6 +9,10 @@ const theme = {
|
|
|
9
9
|
light: '#F5F5F5',
|
|
10
10
|
dark: '#212121',
|
|
11
11
|
},
|
|
12
|
+
[Theme.SURFACE_TERTIARY]: {
|
|
13
|
+
light: '#0000001A',
|
|
14
|
+
dark: '#373737',
|
|
15
|
+
},
|
|
12
16
|
[Theme.SURFACE_STATIC]: {
|
|
13
17
|
light: '#FFFFFF',
|
|
14
18
|
dark: '#FFFFFF',
|
|
@@ -25,10 +29,22 @@ const theme = {
|
|
|
25
29
|
light: '#E1E1E1',
|
|
26
30
|
dark: '#A7A7A7',
|
|
27
31
|
},
|
|
32
|
+
[Theme.SURFACE_INVERTED]: {
|
|
33
|
+
light: '#000000',
|
|
34
|
+
dark: '#FFFFFF',
|
|
35
|
+
},
|
|
28
36
|
[Theme.SURFACE_INVERTED_TRANSPARENT]: {
|
|
29
37
|
light: '#686868',
|
|
30
38
|
dark: '#FFFFFF',
|
|
31
39
|
},
|
|
40
|
+
[Theme.SURFACE_DROP_SHADOW]: {
|
|
41
|
+
light: '#CECECE',
|
|
42
|
+
dark: '#373737',
|
|
43
|
+
},
|
|
44
|
+
[Theme.SURFACE_BLUR]: {
|
|
45
|
+
light: '#000000B2',
|
|
46
|
+
dark: '#FFFFFFB2',
|
|
47
|
+
},
|
|
32
48
|
|
|
33
49
|
[Theme.CONTENT_PRIMARY]: {
|
|
34
50
|
light: '#000000',
|
|
@@ -50,6 +66,10 @@ const theme = {
|
|
|
50
66
|
light: '#FFFFFF',
|
|
51
67
|
dark: '#FFFFFF',
|
|
52
68
|
},
|
|
69
|
+
[Theme.CONTENT_PRIMARY_STATIC]: {
|
|
70
|
+
light: '#0000001A',
|
|
71
|
+
dark: '#686868',
|
|
72
|
+
},
|
|
53
73
|
[Theme.CONTENT_SECONDRY_STATIC]: {
|
|
54
74
|
light: '#CECECE',
|
|
55
75
|
dark: '#CECECE',
|
|
@@ -83,10 +103,18 @@ const theme = {
|
|
|
83
103
|
light: '#FFFFFF',
|
|
84
104
|
dark: '#FFFFFF',
|
|
85
105
|
},
|
|
106
|
+
[Theme.BORDER_TEXT_FIELD]: {
|
|
107
|
+
light: '#0000001A',
|
|
108
|
+
dark: '#404040',
|
|
109
|
+
},
|
|
86
110
|
[Theme.BORDER_SEPRATOR]: {
|
|
87
111
|
light: '#282828',
|
|
88
112
|
dark: '#FFFFFF',
|
|
89
113
|
},
|
|
114
|
+
[Theme.BORDER_SEPERATOR_HEADER]: {
|
|
115
|
+
light: '#E1E1E1',
|
|
116
|
+
dark: '#404040',
|
|
117
|
+
},
|
|
90
118
|
|
|
91
119
|
[Theme.WARNING]: {
|
|
92
120
|
light: '#B65E01',
|
package/src/utils/appEnum.ts
CHANGED
|
@@ -74,17 +74,22 @@ export enum FontStyle {
|
|
|
74
74
|
export enum Theme {
|
|
75
75
|
SURFACE_PRIMARY = 'SURFACE_PRIMARY',
|
|
76
76
|
SURFACE_SECONDARY = 'SURFACE_SECONDARY',
|
|
77
|
+
SURFACE_TERTIARY = 'SURFACE_TERTIARY',
|
|
77
78
|
SURFACE_STATIC = 'SURFACE_STATIC',
|
|
78
79
|
SURFACE_BRAND_STATIC = 'SURFACE_BRAND_STATIC',
|
|
79
80
|
SURFACE_BRAND_TRANSPARENT_STATIC = 'SURFACE_BRAND_TRANSPARENT_STATIC',
|
|
80
81
|
SURFACE_DISABLE = 'SURFACE_DISABLE',
|
|
82
|
+
SURFACE_INVERTED = 'SURFACE_INVERTED',
|
|
81
83
|
SURFACE_INVERTED_TRANSPARENT = 'SURFACE_INVERTED_TRANSPARENT',
|
|
84
|
+
SURFACE_DROP_SHADOW = 'SURFACE_DROP_SHADOW',
|
|
85
|
+
SURFACE_BLUR = 'SURFACE_BLUR',
|
|
82
86
|
|
|
83
87
|
CONTENT_PRIMARY = 'CONTENT_PRIMARY',
|
|
84
88
|
CONTENT_SECONDRY = 'CONTENT_SECONDRY',
|
|
85
89
|
CONTENT_DISABLE = 'CONTENT_DISABLE',
|
|
86
90
|
CONTENT_INVERTED = 'CONTENT_INVERTED',
|
|
87
91
|
CONTENT_STATIC = 'CONTENT_STATIC',
|
|
92
|
+
CONTENT_PRIMARY_STATIC = 'CONTENT_PRIMARY_STATIC',
|
|
88
93
|
CONTENT_SECONDRY_STATIC = 'CONTENT_SECONDRY_STATIC',
|
|
89
94
|
|
|
90
95
|
BORDER_PRIMARY = 'BORDER_PRIMARY',
|
|
@@ -93,6 +98,8 @@ export enum Theme {
|
|
|
93
98
|
BORDER_INVERTED = 'BORDER_INVERTED',
|
|
94
99
|
BORDER_BRAND_STATIC = 'BORDER_BRAND_STATIC',
|
|
95
100
|
BORDER_BRAND_TRANSPARENT_STATIC = 'BORDER_BRAND_TRANSPARENT_STATIC',
|
|
101
|
+
BORDER_TEXT_FIELD = 'BORDER_TEXT_FIELD',
|
|
102
|
+
BORDER_SEPERATOR_HEADER = 'BORDER_SEPERATOR_HEADER',
|
|
96
103
|
BORDER_STATIC = 'BORDER_STATIC',
|
|
97
104
|
BORDER_SEPRATOR = 'BORDER_SEPRATOR',
|
|
98
105
|
WARNING = 'WARNING',
|