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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dhre-ui-kit",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
@@ -1,3 +1,3 @@
1
- <svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M16.25 8L10 14.25L3.75 8" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
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="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M3.75 13L10 6.75L16.25 13" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
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
  }
@@ -21,7 +21,6 @@ const styles = StyleSheet.create({
21
21
  content: {
22
22
  overflow: 'scroll',
23
23
  marginTop: verticalScale(16),
24
- marginHorizontal: horizontalScale(16),
25
24
  },
26
25
  });
27
26
 
@@ -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 = ({title, testId = 'ACCORDION', children}: AccordionProps) => {
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: '#000',
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 {StyleSheet} from 'react-native';
2
+
3
+ const styles = StyleSheet.create({
4
+ container: {
5
+ justifyContent: 'center',
6
+ alignItems: 'center',
7
+ backgroundColor: '#fff',
8
+ },
9
+ title: {
10
+ color: '#000',
11
+ },
12
+ });
13
+
14
+ export default styles;
@@ -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?: ViewStyle;
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
- padding: moderateScale(24),
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 variant="L1_REGULAR" style={titleStyle} text={title} />
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';
@@ -53,33 +53,37 @@ const theme = {
53
53
  dark: '##CECECE',
54
54
  },
55
55
 
56
- BODER_PRIMARY: {
56
+ BORDER_PRIMARY: {
57
57
  light: '#686868',
58
58
  dark: '#404040',
59
59
  },
60
- BODER_SECONDRY: {
60
+ BORDER_SECONDRY: {
61
61
  light: '#A7A7A7',
62
62
  dark: '#686868',
63
63
  },
64
- BODER_DISABLE: {
64
+ BORDER_DISABLE: {
65
65
  light: '#CECECE',
66
66
  dark: '#4F4F4F',
67
67
  },
68
- BODER_INVERTED: {
68
+ BORDER_INVERTED: {
69
69
  light: '#000000',
70
70
  dark: '#FFFFFF',
71
71
  },
72
- BODER_BRAND_STATIC: {
72
+ BORDER_BRAND_STATIC: {
73
73
  light: '#D92D27',
74
74
  dark: '#D92D27',
75
75
  },
76
- BODER_BRAND_TRANSPARENT_STATIC: {
76
+ BORDER_BRAND_TRANSPARENT_STATIC: {
77
77
  light: '#D92D3E',
78
78
  dark: '#D92D3E',
79
79
  },
80
- BODER_STATIC: {
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;