dhre-ui-kit 0.0.84 → 0.0.87

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.84",
3
+ "version": "0.0.87",
4
4
  "main": "src/index.ts",
5
5
  "files": [
6
6
  "src",
package/src/App.tsx CHANGED
@@ -1,40 +1,13 @@
1
1
  import React from 'react';
2
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';
3
+ import {CustomDocumentPicker} from './index';
4
+ import { View } from 'react-native';
7
5
 
8
6
  const App = () => {
9
7
  return (
10
8
  <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
- />
9
+ <View style={{flex:1,justifyContent:'center'}}>
10
+ <CustomDocumentPicker onDocumentUpload={() => {}} />
38
11
  </View>
39
12
  </ThemeProvider>
40
13
  );
@@ -0,0 +1,8 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M4.5 12V3.75C4.5 3.55109 4.57902 3.36032 4.71967 3.21967C4.86032 3.07902 5.05109 3 5.25 3H14.25L19.5 8.25V12" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M14.25 3V8.25H19.5" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M4.5 18.75H6C6.39782 18.75 6.77936 18.592 7.06066 18.3107C7.34196 18.0294 7.5 17.6478 7.5 17.25C7.5 16.8522 7.34196 16.4706 7.06066 16.1893C6.77936 15.908 6.39782 15.75 6 15.75H4.5V20.25" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M20.25 15.75H17.625V20.25" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
6
+ <path d="M19.875 18.375H17.625" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
7
+ <path d="M12 20.25C12.5967 20.25 13.169 20.0129 13.591 19.591C14.0129 19.169 14.25 18.5967 14.25 18C14.25 17.4033 14.0129 16.831 13.591 16.409C13.169 15.9871 12.5967 15.75 12 15.75H10.6875V20.25H12Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
8
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M20.25 5.25H3.75" stroke="#EB0542" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M9.75 9.75V15.75" stroke="#EB0542" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M14.25 9.75V15.75" stroke="#EB0542" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M18.75 5.25V19.5C18.75 19.6989 18.671 19.8897 18.5303 20.0303C18.3897 20.171 18.1989 20.25 18 20.25H6C5.80109 20.25 5.61032 20.171 5.46967 20.0303C5.32902 19.8897 5.25 19.6989 5.25 19.5V5.25" stroke="#EB0542" stroke-linecap="round" stroke-linejoin="round"/>
6
+ <path d="M15.75 5.25V3.75C15.75 3.35218 15.592 2.97064 15.3107 2.68934C15.0294 2.40804 14.6478 2.25 14.25 2.25H9.75C9.35218 2.25 8.97064 2.40804 8.68934 2.68934C8.40804 2.97064 8.25 3.35218 8.25 3.75V5.25" stroke="#EB0542" stroke-linecap="round" stroke-linejoin="round"/>
7
+ </svg>
@@ -11,6 +11,8 @@ import BellSimple from './images/bellSimple.svg';
11
11
  import UploadFile from './images/uploadFileIcon.svg';
12
12
  import CaretRight from './images/caretRight.svg';
13
13
  import CheckWhite from './images/checkWhite.svg';
14
+ import FileIcon from './images/fileIcon.svg';
15
+ import Trash from './images/trash.svg';
14
16
 
15
17
  export {
16
18
  CalenderDots,
@@ -26,4 +28,6 @@ export {
26
28
  UploadFile,
27
29
  CaretRight,
28
30
  CheckWhite,
31
+ FileIcon,
32
+ Trash,
29
33
  };
@@ -9,14 +9,24 @@ const styles = StyleSheet.create({
9
9
  container: {
10
10
  flexDirection: 'row',
11
11
  alignItems: 'center',
12
+ justifyContent: 'space-between',
12
13
  paddingVertical: verticalScale(16),
13
14
  paddingHorizontal: horizontalScale(24),
14
15
  borderWidth: 1,
15
16
  borderStyle: 'dashed',
16
17
  borderRadius: moderateScale(8),
17
- gap: moderateScale(24),
18
18
  marginBottom: verticalScale(8),
19
19
  },
20
+ fileUploadContainerStyle: {
21
+ flexDirection: 'row',
22
+ alignItems: 'center',
23
+ justifyContent: 'space-between',
24
+ paddingVertical: verticalScale(16),
25
+ paddingHorizontal: horizontalScale(24),
26
+ borderRadius: moderateScale(8),
27
+ marginBottom: verticalScale(8),
28
+ },
29
+ innerContainer: {flexDirection: 'row', columnGap: horizontalScale(24)},
20
30
  titleContainer: {gap: verticalScale(4)},
21
31
  });
22
32
 
@@ -1,7 +1,9 @@
1
- import React, {useState} from 'react';
1
+ import React, {useState, useCallback, memo} from 'react';
2
2
  import {View, Pressable, Alert} from 'react-native';
3
- import DocumentPicker from 'react-native-document-picker';
4
- import {UploadFile} from '../../assets';
3
+ import DocumentPicker, {
4
+ DocumentPickerResponse,
5
+ } from 'react-native-document-picker';
6
+ import {FileIcon, Trash, UploadFile} from '../../assets';
5
7
  import {FontStyle} from '../../utils/appEnum';
6
8
  import CustomTypography from '../customTypography';
7
9
  import {useTheme} from '../../theme/ThemeContext';
@@ -20,19 +22,24 @@ const CustomDocumentPicker = ({
20
22
  hintStyle,
21
23
  }: CustomDocumentPickerProps) => {
22
24
  const [error, setError] = useState('');
25
+ const [docDetails, setDocDetails] = useState<DocumentPickerResponse>();
26
+ const {theme} = useTheme();
23
27
 
24
- const pickDocument = async () => {
28
+ const pickDocument = useCallback(async () => {
25
29
  try {
26
30
  const res = await DocumentPicker.pickSingle({
27
31
  type: fileTypes,
28
32
  });
29
33
 
30
- if (res?.size && res?.size > maxFileSize * 1024 * 1024) {
34
+ if (res?.size && res.size > maxFileSize * 1024 * 1024) {
31
35
  setError(
32
36
  `File size higher than ${maxFileSize}MB. Please upload a smaller file.`,
33
37
  );
34
38
  return;
35
39
  }
40
+
41
+ setError(''); // Clear error on successful upload
42
+ setDocDetails(res);
36
43
  onDocumentUpload(res);
37
44
  } catch (err) {
38
45
  if (DocumentPicker.isCancel(err)) {
@@ -43,32 +50,40 @@ const CustomDocumentPicker = ({
43
50
  Alert.alert('Unknown Error: ' + JSON.stringify(err));
44
51
  }
45
52
  }
46
- };
53
+ }, [fileTypes, maxFileSize, onDocumentUpload]);
54
+
55
+ const removeDocument = useCallback(() => {
56
+ setDocDetails(undefined);
57
+ }, []);
47
58
 
48
- const {theme} = useTheme();
49
59
  return (
50
60
  <>
51
- <Pressable
61
+ <View
52
62
  style={[
53
- styles.container,
63
+ docDetails ? styles.fileUploadContainerStyle : styles.container,
54
64
  {borderColor: error ? theme.ERROR : theme.BORDER_SECONDRY},
65
+ docDetails ? {backgroundColor: theme.SURFACE_SECONDARY} : {},
55
66
  containerStyle,
56
- ]}
57
- onPress={pickDocument}>
58
- <UploadFile />
59
- <View style={styles.titleContainer}>
60
- <CustomTypography
61
- variant={FontStyle.L2_REGULAR}
62
- text={title}
63
- style={[{color: theme.CONTENT_PRIMARY}, titleStyle]}
64
- />
65
- <CustomTypography
66
- variant={FontStyle.L3_REGULAR}
67
- text={hint}
68
- style={[{color: theme.CONTENT_SECONDRY}, hintStyle]}
69
- />
70
- </View>
71
- </Pressable>
67
+ ]}>
68
+ <Pressable style={styles.innerContainer} onPress={pickDocument}>
69
+ {docDetails ? <FileIcon /> : <UploadFile />}
70
+ <View style={styles.titleContainer}>
71
+ <CustomTypography
72
+ variant={FontStyle.L2_REGULAR}
73
+ text={docDetails?.name ?? title}
74
+ style={[{color: theme.CONTENT_PRIMARY}, titleStyle]}
75
+ />
76
+ {!docDetails && (
77
+ <CustomTypography
78
+ variant={FontStyle.L3_REGULAR}
79
+ text={hint}
80
+ style={[{color: theme.CONTENT_SECONDRY}, hintStyle]}
81
+ />
82
+ )}
83
+ </View>
84
+ </Pressable>
85
+ {docDetails && <Trash onPress={removeDocument} />}
86
+ </View>
72
87
  {error && (
73
88
  <CustomTypography
74
89
  variant={FontStyle.L2_REGULAR}
@@ -80,4 +95,4 @@ const CustomDocumentPicker = ({
80
95
  );
81
96
  };
82
97
 
83
- export default withThemeProvider(CustomDocumentPicker);
98
+ export default withThemeProvider(memo(CustomDocumentPicker));
@@ -4,6 +4,8 @@ import {CaretRight} from '../../assets/index';
4
4
  import {CustomTypography, FontStyle} from '../../index';
5
5
  import styles from './styles';
6
6
  import {CustomSlideButtonProps} from './custom-slide-button.interface';
7
+ import {useTheme} from '../../theme/ThemeContext';
8
+ import {withThemeProvider} from '../../theme/withThemeProvider';
7
9
 
8
10
  const {width} = Dimensions.get('window');
9
11
  const BUTTON_WIDTH = 40; // Width of the button
@@ -41,15 +43,31 @@ const CustomSlideButton = ({label, onComplete}: CustomSlideButtonProps) => {
41
43
  }),
42
44
  ).current;
43
45
 
46
+ const {theme} = useTheme();
44
47
  return (
45
- <View style={styles.sliderContainer}>
48
+ <View
49
+ style={{
50
+ ...styles.sliderContainer,
51
+ backgroundColor: theme.SURFACE_PRIMARY,
52
+ }}>
46
53
  <View style={styles.buttonTextCOntainer}>
47
- <CustomTypography text={label} variant={FontStyle.L1_REGULAR} />
54
+ <CustomTypography
55
+ text={label}
56
+ variant={FontStyle.L1_REGULAR}
57
+ style={{
58
+ color: theme.CONTENT_PRIMARY,
59
+ }}
60
+ />
48
61
  </View>
49
62
  <Animated.View
50
63
  style={[styles.slider, {transform: [{translateX: pan}]}]}
51
64
  {...panResponder.panHandlers}>
52
- <View style={{...styles.button, width: BUTTON_WIDTH}}>
65
+ <View
66
+ style={{
67
+ ...styles.button,
68
+ backgroundColor: theme.SURFACE_INVERTED,
69
+ width: BUTTON_WIDTH,
70
+ }}>
53
71
  <CaretRight />
54
72
  </View>
55
73
  </Animated.View>
@@ -57,4 +75,4 @@ const CustomSlideButton = ({label, onComplete}: CustomSlideButtonProps) => {
57
75
  );
58
76
  };
59
77
 
60
- export default CustomSlideButton;
78
+ export default withThemeProvider(CustomSlideButton);
@@ -1,17 +1,15 @@
1
1
  import {StyleSheet} from 'react-native';
2
+ import {moderateScale, verticalScale} from '../../utils/stylehelper';
2
3
 
3
4
  const styles = StyleSheet.create({
4
5
  container: {
5
6
  flex: 1,
6
7
  justifyContent: 'center',
7
8
  alignItems: 'center',
8
- backgroundColor: '#f8f8f8',
9
9
  },
10
10
  sliderContainer: {
11
- width: '100%',
12
- height: 48,
13
- backgroundColor: '#e0e0e0',
14
- borderRadius: 25,
11
+ height: verticalScale(48),
12
+ borderRadius: moderateScale(25),
15
13
  overflow: 'hidden',
16
14
  justifyContent: 'center',
17
15
  },
@@ -21,12 +19,11 @@ const styles = StyleSheet.create({
21
19
  position: 'absolute',
22
20
  },
23
21
  button: {
24
- height: 40,
25
- backgroundColor: '#000',
22
+ height: verticalScale(40),
26
23
  justifyContent: 'center',
27
24
  alignItems: 'center',
28
- borderRadius: 20,
29
- margin: 4,
25
+ borderRadius: moderateScale(20),
26
+ margin: moderateScale(4),
30
27
  },
31
28
  buttonTextCOntainer: {
32
29
  position: 'absolute',
@@ -3,9 +3,10 @@ import React from 'react';
3
3
  import {CheckWhite} from '../../assets';
4
4
  import {styles} from './styles';
5
5
  import {IData, IProps, Status} from './stepper.interface';
6
- import {DHRE_COLORS_TEXT} from '../../theme/colors';
7
6
  import {FontStyle} from '../../utils/appEnum';
8
7
  import CustomTypography from '../customTypography';
8
+ import {useTheme} from '../../theme/ThemeContext';
9
+ import {withThemeProvider} from '../../theme/withThemeProvider';
9
10
 
10
11
  const Stepper = ({
11
12
  containerStyle,
@@ -13,38 +14,46 @@ const Stepper = ({
13
14
  showStatus = false,
14
15
  data,
15
16
  }: IProps) => {
17
+ const {theme} = useTheme();
18
+
16
19
  const renderCircleStyle = (status?: string) => {
17
20
  if (status === Status.Active) {
18
- return styles.activeStepCircle;
21
+ return {...styles.activeStepCircle, borderColor: theme.CONTENT_PRIMARY};
19
22
  } else if (status === Status.Inactive) {
20
- return styles.inactiveStepCircle;
23
+ return {
24
+ ...styles.inactiveStepCircle,
25
+ borderColor: theme.CONTENT_SECONDRY,
26
+ };
21
27
  } else if (status === Status.Completed) {
22
- return styles.completeStepCircle;
28
+ return {...styles.completeStepCircle, backgroundColor: theme.SUCCESS};
23
29
  } else {
24
- return styles.stepCountCircle;
30
+ return {...styles.stepCountCircle, borderColor: theme.BORDER_PRIMARY};
25
31
  }
26
32
  };
27
33
  const renderLableStyle = (status?: string) => {
28
34
  if (status === Status.Active) {
29
- return styles.activeStepLabel;
35
+ return {...styles.activeStepLabel, color: theme.CONTENT_PRIMARY};
30
36
  } else if (status === Status.Inactive) {
31
- return styles.inactiveStepLabel;
37
+ return {...styles.inactiveStepLabel, color: theme.CONTENT_SECONDRY};
32
38
  } else if (status === Status.Completed) {
33
- return styles.completeStepLabel;
39
+ return {...styles.completeStepLabel, color: theme.CONTENT_PRIMARY};
34
40
  } else {
35
- return styles.countStepLabel;
41
+ return {...styles.countStepLabel, color: theme.CONTENT_PRIMARY};
36
42
  }
37
43
  };
38
44
 
39
45
  const renderDividerStyle = (status?: string) => {
40
46
  if (status === Status.Active) {
41
- return styles.activeStepDivider;
47
+ return {borderColor: theme.BORDER_PRIMARY};
42
48
  } else if (status === Status.Inactive) {
43
- return styles.inactiveStepDivider;
49
+ return {borderColor: theme.BORDER_PRIMARY};
44
50
  } else if (status === Status.Completed) {
45
- return styles.completeStepDivider;
51
+ return {
52
+ ...styles.completeStepDivider,
53
+ borderColor: theme.CONTENT_PRIMARY,
54
+ };
46
55
  } else {
47
- return styles.countStepDivider;
56
+ return {borderColor: theme.CONTENT_SECONDRY};
48
57
  }
49
58
  };
50
59
 
@@ -67,7 +76,7 @@ const Stepper = ({
67
76
  text={item?.step}
68
77
  variant={FontStyle.L2_REGULAR}
69
78
  style={{
70
- color: DHRE_COLORS_TEXT.DH_WHITE,
79
+ color: theme.CONTENT_PRIMARY,
71
80
  }}
72
81
  />
73
82
  )}
@@ -93,4 +102,4 @@ const Stepper = ({
93
102
  );
94
103
  };
95
104
 
96
- export default Stepper;
105
+ export default withThemeProvider(Stepper);
@@ -1,5 +1,4 @@
1
1
  import {StyleSheet} from 'react-native';
2
- import {DHRE_COLORS_TEXT} from '../../theme/colors';
3
2
 
4
3
  const styles = StyleSheet.create({
5
4
  stepperContainer: {
@@ -23,46 +22,33 @@ const styles = StyleSheet.create({
23
22
  borderRadius: 12,
24
23
  alignItems: 'center',
25
24
  borderWidth: 2,
26
- borderColor: '#000000',
27
25
  justifyContent: 'center',
28
26
  },
29
27
  activeStepLabel: {
30
- color: DHRE_COLORS_TEXT.DH_BLACK,
31
28
  marginTop: 11,
32
29
  },
33
- activeStepDivider: {
34
- borderColor: '#686868',
35
- },
36
30
  inactiveStepCircle: {
37
31
  height: 24,
38
32
  width: 24,
39
33
  borderRadius: 12,
40
34
  alignItems: 'center',
41
35
  borderWidth: 2,
42
- borderColor: '#A7A7A7',
43
36
  justifyContent: 'center',
44
37
  },
45
38
  inactiveStepLabel: {
46
- color: '#686868',
47
39
  marginTop: 11,
48
40
  },
49
- inactiveStepDivider: {
50
- borderColor: '#686868',
51
- },
52
41
  completeStepCircle: {
53
42
  height: 24,
54
43
  width: 24,
55
- backgroundColor: '#00B578',
56
44
  borderRadius: 12,
57
45
  alignItems: 'center',
58
46
  justifyContent: 'center',
59
47
  },
60
48
  completeStepLabel: {
61
- color: DHRE_COLORS_TEXT.DH_BLACK,
62
49
  marginTop: 11,
63
50
  },
64
51
  completeStepDivider: {
65
- borderColor: DHRE_COLORS_TEXT.DH_BLACK,
66
52
  borderStyle: 'solid',
67
53
  },
68
54
  stepCountCircle: {
@@ -71,16 +57,12 @@ const styles = StyleSheet.create({
71
57
  borderRadius: 12,
72
58
  alignItems: 'center',
73
59
  borderWidth: 1,
74
- borderColor: '#A7A7A7',
75
60
  justifyContent: 'center',
76
61
  },
77
62
  countStepLabel: {
78
- color: DHRE_COLORS_TEXT.DH_WHITE,
63
+
79
64
  marginTop: 11,
80
65
  },
81
- countStepDivider: {
82
- borderColor: '#686868',
83
- },
84
66
  separator: {
85
67
  borderWidth: 1,
86
68
  borderStyle: 'dashed',
@@ -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];