dhre-ui-kit 0.0.30 → 0.0.32

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.30",
3
+ "version": "0.0.32",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
package/src/App.tsx CHANGED
@@ -1,38 +1,43 @@
1
1
  import React from 'react';
2
- import {View, StyleSheet, Text} from 'react-native';
3
- import BottomDrawer from './components/bottomDrawer';
2
+ import {ThemeProvider} from './theme/ThemeContext';
3
+ import {Badge, Line} from './index';
4
+ import {ArrowLeft, CalenderDots} from './assets';
5
+ import {View} from 'react-native';
6
+ import CustomButton from './components/button/Button';
4
7
 
5
8
  const App = () => {
6
9
  return (
7
- <View style={styles.container}>
8
- <Text>SSS</Text>
9
- <BottomDrawer isModalVisible={true} toggleModal={() => {}} title={''}>
10
- <Text style={styles.text}>Hello, World!</Text>
11
- </BottomDrawer>
12
- </View>
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>
39
+ </ThemeProvider>
13
40
  );
14
41
  };
15
42
 
16
- const styles = StyleSheet.create({
17
- container: {
18
- flex: 1,
19
- justifyContent: 'center',
20
- alignItems: 'center',
21
- backgroundColor:"#000"
22
- },
23
- image: {
24
- flex: 1,
25
- justifyContent: 'center',
26
- },
27
- absolute: {
28
- ...StyleSheet.absoluteFillObject,
29
- justifyContent: 'center',
30
- alignItems: 'center',
31
- },
32
- text: {
33
- color: 'red',
34
- fontSize: 24,
35
- },
36
- });
37
-
38
43
  export default App;
@@ -7,4 +7,5 @@ export interface AccordionProps {
7
7
  containerStyle?: ViewStyle;
8
8
  titleStyle?: TextStyle;
9
9
  children: React.ReactNode;
10
+ headerStyle?: ViewStyle;
10
11
  }
@@ -6,7 +6,7 @@ import CustomTypography from '../customTypography/CustomTypography';
6
6
  describe('Accordion Component', () => {
7
7
  test('Component renders correctly', async () => {
8
8
  const {getByTestId, getByText} = render(
9
- <Accordion title="Test Title">
9
+ <Accordion title="Test Title" isOpen={false} onToggle={() => {}}>
10
10
  <CustomTypography variant="B4_REGULAR" text="Test Content" />
11
11
  </Accordion>,
12
12
  );
@@ -11,12 +11,14 @@ const Accordion = ({
11
11
  testId = 'ACCORDION',
12
12
  containerStyle,
13
13
  titleStyle,
14
+ headerStyle,
14
15
  children,
15
- }: AccordionProps) => {
16
+ isOpen,
17
+ onToggle,
18
+ }: AccordionProps & {isOpen: boolean; onToggle: () => void}) => {
16
19
  const contentRef = useRef<View>(null);
17
20
  const [animation] = useState(new Animated.Value(0));
18
21
  const [contentHeight, setContentHeight] = useState(0);
19
- const [expanded, setExpanded] = useState(false);
20
22
 
21
23
  useEffect(() => {
22
24
  if (contentRef.current) {
@@ -24,16 +26,15 @@ const Accordion = ({
24
26
  setContentHeight(height);
25
27
  });
26
28
  }
27
- }, [expanded]);
29
+ }, [isOpen]);
28
30
 
29
- const toggleAccordion = () => {
31
+ useEffect(() => {
30
32
  Animated.timing(animation, {
31
- toValue: expanded ? 0 : 1,
33
+ toValue: isOpen ? 1 : 0,
32
34
  duration: 300,
33
35
  useNativeDriver: false,
34
36
  }).start();
35
- setExpanded(!expanded);
36
- };
37
+ }, [isOpen]);
37
38
 
38
39
  const cardHeight = animation.interpolate({
39
40
  inputRange: [0, 1],
@@ -42,13 +43,13 @@ const Accordion = ({
42
43
 
43
44
  return (
44
45
  <View style={[styles.container, containerStyle]} testID={testId}>
45
- <Pressable style={styles.header} onPress={toggleAccordion}>
46
+ <Pressable style={[styles.header, headerStyle]} onPress={onToggle}>
46
47
  <CustomTypography
47
48
  variant={'B4_REGULAR'}
48
49
  text={title}
49
50
  style={[styles.title, titleStyle]}
50
51
  />
51
- {React.cloneElement(expanded ? <CaretUp /> : <CaretDown />, {
52
+ {React.cloneElement(isOpen ? <CaretUp /> : <CaretDown />, {
52
53
  width: moderateScale(20),
53
54
  height: moderateScale(20),
54
55
  style: styles.iconStyle,
@@ -11,4 +11,5 @@ export interface CustomSearchBarProps extends TextInputProps {
11
11
  onSearchIconPress?: () => void;
12
12
  onCrossIconPress?: () => void;
13
13
  handleOnChangeText?: (text: string) => void;
14
+ rightIcon?: React.ReactElement;
14
15
  }
@@ -16,6 +16,7 @@ const CustomSearchBar = ({
16
16
  onSearchIconPress,
17
17
  onCrossIconPress,
18
18
  handleOnChangeText,
19
+ rightIcon = <CrossIcon />,
19
20
  ...props
20
21
  }: CustomSearchBarProps) => {
21
22
  const [value, setValue] = useState('');
@@ -62,7 +63,7 @@ const CustomSearchBar = ({
62
63
  onCrossIconPress?.(); // Call custom handler if provided
63
64
  }}
64
65
  style={crossIconStyle}>
65
- {React.cloneElement(<CrossIcon />, {
66
+ {React.cloneElement(rightIcon, {
66
67
  width: moderateScale(24),
67
68
  height: moderateScale(24),
68
69
  style: [styles.crossIconStyle, crossIconStyle],
@@ -0,0 +1,48 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ const styles = StyleSheet.create({
4
+ container: {
5
+ flex: 1,
6
+ backgroundColor: 'black',
7
+ padding: 20,
8
+ justifyContent: 'center',
9
+ },
10
+ headerText: {
11
+ color: 'white',
12
+ fontSize: 18,
13
+ fontWeight: 'bold',
14
+ marginBottom: 20,
15
+ },
16
+ textInput: {
17
+ backgroundColor: 'white',
18
+ borderRadius: 10,
19
+ padding: 15,
20
+ color: 'black',
21
+ fontSize: 16,
22
+ textAlignVertical: 'top',
23
+ minHeight: 100,
24
+ },
25
+ charCounter: {
26
+ textAlign: 'left',
27
+ marginTop: 10,
28
+ },
29
+ buttonContainer: {
30
+ flexDirection: 'row',
31
+ //justifyContent: "space-between",
32
+ marginTop: 20,
33
+ },
34
+ feedbackButton: {
35
+ backgroundColor: 'transparent',
36
+ borderColor: 'white',
37
+ borderWidth: 1,
38
+ paddingVertical: 10,
39
+ paddingHorizontal: 20,
40
+ borderRadius: 30,
41
+ },
42
+ cancelButton: {
43
+ paddingVertical: 10,
44
+ paddingHorizontal: 40,
45
+ },
46
+ });
47
+
48
+ export default styles;
@@ -0,0 +1,59 @@
1
+ import React, {useState} from 'react';
2
+ import {View, Text, TextInput, Pressable} from 'react-native';
3
+ import CustomText from '../customText/CustomText';
4
+
5
+ import styles from './feedback.style';
6
+ const FeedbackForm = ({
7
+ title,
8
+ clearAllData,
9
+ handleSendFeedback,
10
+ }: {
11
+ title: string;
12
+ clearAllData?: () => void;
13
+ handleSendFeedback?: () => void;
14
+ }) => {
15
+ const [feedback, setFeedback] = useState('');
16
+
17
+ const maxChars = 200;
18
+
19
+ return (
20
+ <View style={styles.container}>
21
+ <Text style={styles.headerText}>{title}</Text>
22
+
23
+ <TextInput
24
+ style={[styles.textInput, {height: Math.max(100)}]}
25
+ placeholder="Would you like to tell us more..."
26
+ placeholderTextColor="gray"
27
+ multiline
28
+ maxLength={maxChars}
29
+ value={feedback}
30
+ onChangeText={text => setFeedback(text)}
31
+ />
32
+ <CustomText
33
+ text={`${feedback.length}/${maxChars} characters`}
34
+ variant="L2_REGULAR"
35
+ textColor="CONTENT_SECONDRY"
36
+ style={styles.charCounter}
37
+ />
38
+ <View style={styles.buttonContainer}>
39
+ <Pressable style={styles.feedbackButton} onPress={handleSendFeedback}>
40
+ <CustomText
41
+ text="Send feedback"
42
+ variant="L1_REGULAR"
43
+ textColor="CONTENT_PRIMARY"
44
+ />
45
+ </Pressable>
46
+
47
+ <Pressable style={styles.cancelButton} onPress={clearAllData}>
48
+ <CustomText
49
+ text="Cancel"
50
+ variant="L1_REGULAR"
51
+ textColor="CONTENT_PRIMARY"
52
+ />
53
+ </Pressable>
54
+ </View>
55
+ </View>
56
+ );
57
+ };
58
+
59
+ export default FeedbackForm;
@@ -0,0 +1 @@
1
+ export {default} from './feedback';
@@ -0,0 +1,83 @@
1
+ import React, {useState} from 'react';
2
+ import {ScrollView, Pressable, View, StyleSheet} from 'react-native';
3
+ import CustomText from '../customText/CustomText';
4
+
5
+ interface ScrollableListProps {
6
+ data: string[];
7
+ handleSelectCategory: (item: string) => void;
8
+ containerStyle?: object;
9
+ scrollViewContentStyle?: object;
10
+ itemStyle?: object;
11
+ selectedItemStyle?: object;
12
+ selectedItemTextColor?: string;
13
+ defaultItemTextColor?: string;
14
+ }
15
+
16
+ const ScrollableList = ({
17
+ data,
18
+ handleSelectCategory,
19
+ containerStyle,
20
+ scrollViewContentStyle,
21
+ itemStyle,
22
+ selectedItemStyle,
23
+ selectedItemTextColor = 'CONTENT_PRIMARY',
24
+ defaultItemTextColor = 'CONTENT_SECONDRY',
25
+ }: ScrollableListProps) => {
26
+ const [selectedItem, setSelectedItem] = useState<string | null>(data[0]);
27
+
28
+ return (
29
+ <View style={[styles.container, containerStyle]}>
30
+ <ScrollView
31
+ horizontal
32
+ showsHorizontalScrollIndicator={false}
33
+ contentContainerStyle={[
34
+ styles.scrollViewContent,
35
+ scrollViewContentStyle,
36
+ ]}>
37
+ {data?.map(item => (
38
+ <Pressable
39
+ key={item}
40
+ style={[
41
+ styles.item,
42
+ itemStyle,
43
+ selectedItem === item && [styles.selectedItem, selectedItemStyle],
44
+ ]}
45
+ onPress={() => {
46
+ setSelectedItem(item);
47
+ handleSelectCategory(item);
48
+ }}>
49
+ <CustomText
50
+ text={item}
51
+ variant="L1_REGULAR"
52
+ textColor={
53
+ selectedItem === item
54
+ ? selectedItemTextColor
55
+ : defaultItemTextColor
56
+ }
57
+ />
58
+ </Pressable>
59
+ ))}
60
+ </ScrollView>
61
+ </View>
62
+ );
63
+ };
64
+
65
+ const styles = StyleSheet.create({
66
+ container: {
67
+ paddingVertical: 10,
68
+ },
69
+ scrollViewContent: {
70
+ flexDirection: 'row',
71
+ alignItems: 'center',
72
+ },
73
+ item: {
74
+ padding: 12,
75
+ borderBottomWidth: 2,
76
+ borderBottomColor: 'transparent',
77
+ },
78
+ selectedItem: {
79
+ borderBottomColor: 'white',
80
+ },
81
+ });
82
+
83
+ export default ScrollableList;
@@ -0,0 +1 @@
1
+ export {default} from './category';
package/src/index.ts CHANGED
@@ -31,6 +31,8 @@ export {default as ContactModel} from './components/ContactModel';
31
31
  export {default as DateRangePicker} from './components/dateRangePicker';
32
32
  export {default as OurOfficesButton} from './components/OutOfOffice';
33
33
  export {default as NotificationBandge} from './components/notificationBandge';
34
+ export {default as category} from './components/scrollList';
35
+ export {default as FeedbackForm} from './components/feedback';
34
36
 
35
37
  export {FONT_STYLES} from './theme/fonts';
36
38
  export {DHRE_DEFAULT, DHRE_COLORS_TEXT} from './theme/colors';
@@ -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];