dhre-ui-kit 0.0.71 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dhre-ui-kit",
3
- "version": "0.0.71",
3
+ "version": "0.0.72",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
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
- <View style={{marginTop: 50}}>
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
  };
@@ -11,4 +11,5 @@ export interface AccordionProps {
11
11
  isOpen: boolean;
12
12
  onToggle: () => void;
13
13
  optionalElement?: () => React.ReactNode; // Update this line
14
+ headerComponent?: () => React.ReactNode;
14
15
  }
@@ -7,7 +7,7 @@ import {
7
7
 
8
8
  const styles = StyleSheet.create({
9
9
  container: {
10
- paddingVertical: verticalScale(16),
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(16),
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
- <CustomTypography
49
- variant={'B4_REGULAR'}
50
- text={title}
51
- style={[styles.title, titleStyle]}
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
- <Animated.View style={[styles.content, {height: cardHeight}]}>
63
- <View
64
- ref={contentRef}
65
- onLayout={(event: LayoutChangeEvent) => {
66
- setContentHeight(event.nativeEvent.layout.height);
67
- }}>
68
- {children}
69
- </View>
70
- </Animated.View>
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
  };
@@ -68,9 +68,12 @@ const DateRangePicker = (props: DateRangePickerProps) => {
68
68
  return (
69
69
  <View>
70
70
  <Calendar
71
- markedDates={getMarkedDates()}
72
- mode="date"
73
- markingType={'period'}
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;
@@ -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
- // const mode = 'light'
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];