dhre-ui-kit 0.0.6 → 0.0.8
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/assets/images/caretDown.svg +2 -2
- package/src/assets/images/caretUp.svg +2 -2
- package/src/components/accordion/Accordion.interface.ts +4 -1
- package/src/components/accordion/Accordion.styles.ts +0 -1
- package/src/components/accordion/Accordion.tsx +9 -3
- package/src/components/customHeader/CustomHeader.styles.ts +3 -1
- package/src/components/customIcon/CustomIcon.interface.ts +11 -0
- package/src/components/customIcon/CustomIcon.styles.ts +14 -0
- package/src/components/customIcon/CustomIcon.test.tsx +14 -0
- package/src/components/customIcon/CustomIcon.tsx +32 -0
- package/src/components/customIcon/index.ts +1 -0
- package/src/components/customTypography/index.ts +1 -0
- package/src/components/swipableList/SwipableList.interface.ts +2 -2
- package/src/components/swipableList/SwipableList.styles.ts +6 -1
- package/src/components/swipableList/SwipableList.tsx +9 -4
- package/src/index.ts +3 -0
- package/src/theme/themes.ts +11 -7
package/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="
|
|
2
|
-
<path d="M16.25
|
|
1
|
+
<svg width="28" height="20" viewBox="0 0 28 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M16.25 7.5L10 13.75L3.75 7.5" stroke="#A7A7A7" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
3
|
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="
|
|
2
|
-
<path d="M3.75
|
|
1
|
+
<svg width="28" height="20" viewBox="0 0 28 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M3.75 12.5L10 6.25L16.25 12.5" stroke="#A7A7A7" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
3
|
</svg>
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import {TextStyle, ViewStyle} from 'react-native';
|
|
2
3
|
|
|
3
4
|
export interface AccordionProps {
|
|
4
5
|
title: string;
|
|
5
|
-
children: React.ReactNode;
|
|
6
6
|
testId?: string;
|
|
7
|
+
containerStyle?: ViewStyle;
|
|
8
|
+
titleStyle?: TextStyle;
|
|
9
|
+
children: React.ReactNode;
|
|
7
10
|
}
|
|
@@ -6,7 +6,13 @@ import {moderateScale} from '../../utils/stylehelper';
|
|
|
6
6
|
import {AccordionProps} from './Accordion.interface';
|
|
7
7
|
import styles from './Accordion.styles';
|
|
8
8
|
|
|
9
|
-
const Accordion = ({
|
|
9
|
+
const Accordion = ({
|
|
10
|
+
title,
|
|
11
|
+
testId = 'ACCORDION',
|
|
12
|
+
containerStyle,
|
|
13
|
+
titleStyle,
|
|
14
|
+
children,
|
|
15
|
+
}: AccordionProps) => {
|
|
10
16
|
const contentRef = useRef<View>(null);
|
|
11
17
|
const [animation] = useState(new Animated.Value(0));
|
|
12
18
|
const [contentHeight, setContentHeight] = useState(0);
|
|
@@ -35,12 +41,12 @@ const Accordion = ({title, testId = 'ACCORDION', children}: AccordionProps) => {
|
|
|
35
41
|
});
|
|
36
42
|
|
|
37
43
|
return (
|
|
38
|
-
<View style={styles.container} testID={testId}>
|
|
44
|
+
<View style={[styles.container, containerStyle]} testID={testId}>
|
|
39
45
|
<Pressable style={styles.header} onPress={toggleAccordion}>
|
|
40
46
|
<CustomTypography
|
|
41
47
|
variant={'B4_REGULAR'}
|
|
42
48
|
text={title}
|
|
43
|
-
style={styles.title}
|
|
49
|
+
style={[styles.title, titleStyle]}
|
|
44
50
|
/>
|
|
45
51
|
{React.cloneElement(expanded ? <CaretUp /> : <CaretDown />, {
|
|
46
52
|
width: moderateScale(20),
|
|
@@ -8,7 +8,9 @@ const styles = StyleSheet.create({
|
|
|
8
8
|
paddingHorizontal: horizontalScale(16),
|
|
9
9
|
paddingTop: verticalScale(74),
|
|
10
10
|
paddingBottom: verticalScale(16),
|
|
11
|
-
backgroundColor: '#
|
|
11
|
+
backgroundColor: '#212121',
|
|
12
|
+
borderBottomWidth: 1,
|
|
13
|
+
borderBottomColor: '#282828',
|
|
12
14
|
},
|
|
13
15
|
headderContainer: {
|
|
14
16
|
flexDirection: 'row',
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {TextStyle, ViewStyle} from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface CustomIconProps {
|
|
5
|
+
icon: React.ReactElement;
|
|
6
|
+
title?: string;
|
|
7
|
+
testId?: string;
|
|
8
|
+
onPress?: () => void;
|
|
9
|
+
containerStyle?: ViewStyle;
|
|
10
|
+
titleStyle?: TextStyle;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {render, fireEvent} from '@testing-library/react-native';
|
|
3
|
+
import {CalenderDots} from '../../assets';
|
|
4
|
+
import CustomIcon from './CustomIcon';
|
|
5
|
+
|
|
6
|
+
describe('Custom Icon Component', () => {
|
|
7
|
+
it('Component renders correctly', () => {
|
|
8
|
+
const {getByTestId} = render(
|
|
9
|
+
<CustomIcon icon={<CalenderDots />} title="Test Title" />,
|
|
10
|
+
);
|
|
11
|
+
expect(getByTestId('CUSTOM-ICON')).toBeTruthy();
|
|
12
|
+
fireEvent.press(getByTestId('CUSTOM-ICON'));
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Pressable} from 'react-native';
|
|
3
|
+
import CustomTypography from '../customTypography';
|
|
4
|
+
import {CustomIconProps} from './CustomIcon.interface';
|
|
5
|
+
import styles from './CustomIcon.styles';
|
|
6
|
+
|
|
7
|
+
const CustomIcon = ({
|
|
8
|
+
icon,
|
|
9
|
+
title,
|
|
10
|
+
testId = 'CUSTOM-ICON',
|
|
11
|
+
onPress,
|
|
12
|
+
containerStyle,
|
|
13
|
+
titleStyle,
|
|
14
|
+
}: CustomIconProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<Pressable
|
|
17
|
+
style={[styles.container, containerStyle]}
|
|
18
|
+
onPress={onPress}
|
|
19
|
+
testID={testId}>
|
|
20
|
+
{icon}
|
|
21
|
+
{title && (
|
|
22
|
+
<CustomTypography
|
|
23
|
+
variant="L1_REGULAR"
|
|
24
|
+
text={title}
|
|
25
|
+
style={[styles.title, titleStyle]}
|
|
26
|
+
/>
|
|
27
|
+
)}
|
|
28
|
+
</Pressable>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default CustomIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './CustomIcon';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './CustomTypography';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ReactNode} from 'react';
|
|
2
|
-
import {ViewStyle} from 'react-native';
|
|
2
|
+
import {TextStyle, ViewStyle} from 'react-native';
|
|
3
3
|
|
|
4
4
|
export interface ListItem {
|
|
5
5
|
id: string;
|
|
@@ -33,5 +33,5 @@ export interface SwipableListProps {
|
|
|
33
33
|
rightPrimaryActionHandler?: (id: string) => void;
|
|
34
34
|
rightPrimaryActionStyle?: ViewStyle;
|
|
35
35
|
itemStyle?: ViewStyle;
|
|
36
|
-
titleStyle?:
|
|
36
|
+
titleStyle?: TextStyle;
|
|
37
37
|
}
|
|
@@ -5,10 +5,15 @@ export const styles = StyleSheet.create({
|
|
|
5
5
|
container: {
|
|
6
6
|
flex: 1,
|
|
7
7
|
},
|
|
8
|
+
swippableContainer: {paddingVertical: verticalScale(16)},
|
|
8
9
|
actionButton: {
|
|
9
10
|
justifyContent: 'center',
|
|
10
11
|
alignItems: 'center',
|
|
11
|
-
|
|
12
|
+
paddingHorizontal: moderateScale(24),
|
|
13
|
+
paddingVertical: moderateScale(8),
|
|
14
|
+
},
|
|
15
|
+
titleStyle: {
|
|
16
|
+
color: '#fff',
|
|
12
17
|
},
|
|
13
18
|
leftActions: {
|
|
14
19
|
flexDirection: 'row',
|
|
@@ -40,11 +40,15 @@ const SwipableList = (props: SwipableListProps) => {
|
|
|
40
40
|
onPress={onPress}
|
|
41
41
|
style={[styles.actionButton, style]}>
|
|
42
42
|
{icon}
|
|
43
|
-
<CustomTypography
|
|
43
|
+
<CustomTypography
|
|
44
|
+
variant="L1_REGULAR"
|
|
45
|
+
style={[styles.titleStyle, titleStyle]}
|
|
46
|
+
text={title}
|
|
47
|
+
/>
|
|
44
48
|
</Pressable>
|
|
45
49
|
);
|
|
46
50
|
|
|
47
|
-
const leftActionHandle = item => (
|
|
51
|
+
const leftActionHandle = (item: ListItem) => (
|
|
48
52
|
<View style={[styles.leftActions, leftPrimaryActionStyle]}>
|
|
49
53
|
{leftPrimaryActionIcon && (
|
|
50
54
|
<ActionButton
|
|
@@ -67,7 +71,7 @@ const SwipableList = (props: SwipableListProps) => {
|
|
|
67
71
|
</View>
|
|
68
72
|
);
|
|
69
73
|
|
|
70
|
-
const rightActionHandle = item => (
|
|
74
|
+
const rightActionHandle = (item: ListItem) => (
|
|
71
75
|
<View style={[styles.rightActions, rightPrimaryActionStyle]}>
|
|
72
76
|
{rightPrimaryActionIcon && (
|
|
73
77
|
<ActionButton
|
|
@@ -85,7 +89,8 @@ const SwipableList = (props: SwipableListProps) => {
|
|
|
85
89
|
<GestureHandlerRootView testID={`${testId}-LIST`} style={styles.container}>
|
|
86
90
|
<Swipeable
|
|
87
91
|
renderLeftActions={() => leftActionHandle(item)}
|
|
88
|
-
renderRightActions={() => rightActionHandle(item)}
|
|
92
|
+
renderRightActions={() => rightActionHandle(item)}
|
|
93
|
+
containerStyle={styles.swippableContainer}>
|
|
89
94
|
{props?.renderItem(item)}
|
|
90
95
|
</Swipeable>
|
|
91
96
|
</GestureHandlerRootView>
|
package/src/index.ts
CHANGED
|
@@ -22,3 +22,6 @@ export {default as Toast} from './components/toast';
|
|
|
22
22
|
export {default as CustomSearchBar} from './components/customSearchBar';
|
|
23
23
|
export {default as CustomHeader} from './components/customHeader';
|
|
24
24
|
export {default as SwipableList} from './components/swipableList';
|
|
25
|
+
export {default as CustomTypography} from './components/customTypography';
|
|
26
|
+
export {default as CustomIcon} from './components/customIcon';
|
|
27
|
+
export * from './utils/stylehelper';
|
package/src/theme/themes.ts
CHANGED
|
@@ -53,33 +53,37 @@ const theme = {
|
|
|
53
53
|
dark: '##CECECE',
|
|
54
54
|
},
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
BORDER_PRIMARY: {
|
|
57
57
|
light: '#686868',
|
|
58
58
|
dark: '#404040',
|
|
59
59
|
},
|
|
60
|
-
|
|
60
|
+
BORDER_SECONDRY: {
|
|
61
61
|
light: '#A7A7A7',
|
|
62
62
|
dark: '#686868',
|
|
63
63
|
},
|
|
64
|
-
|
|
64
|
+
BORDER_DISABLE: {
|
|
65
65
|
light: '#CECECE',
|
|
66
66
|
dark: '#4F4F4F',
|
|
67
67
|
},
|
|
68
|
-
|
|
68
|
+
BORDER_INVERTED: {
|
|
69
69
|
light: '#000000',
|
|
70
70
|
dark: '#FFFFFF',
|
|
71
71
|
},
|
|
72
|
-
|
|
72
|
+
BORDER_BRAND_STATIC: {
|
|
73
73
|
light: '#D92D27',
|
|
74
74
|
dark: '#D92D27',
|
|
75
75
|
},
|
|
76
|
-
|
|
76
|
+
BORDER_BRAND_TRANSPARENT_STATIC: {
|
|
77
77
|
light: '#D92D3E',
|
|
78
78
|
dark: '#D92D3E',
|
|
79
79
|
},
|
|
80
|
-
|
|
80
|
+
BORDER_STATIC: {
|
|
81
81
|
light: '#FFFFFF',
|
|
82
82
|
dark: '#FFFFFF',
|
|
83
83
|
},
|
|
84
|
+
BORDER_SEPRATOR: {
|
|
85
|
+
light: '#282828',
|
|
86
|
+
dark: '#FFFFFF',
|
|
87
|
+
},
|
|
84
88
|
};
|
|
85
89
|
export default theme;
|