@teamnhz/rn-ui-toolkit 1.0.0
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/dist/assets/images/cancel.png +0 -0
- package/dist/assets/images/eye_off.png +0 -0
- package/dist/assets/images/eye_on.png +0 -0
- package/dist/assets/images/favourite.png +0 -0
- package/dist/assets/images/image_icon.png +0 -0
- package/dist/assets/images/upload.png +0 -0
- package/dist/assets/images/video_icon.png +0 -0
- package/dist/components/Accordion/index.d.ts +15 -0
- package/dist/components/Accordion/index.js +51 -0
- package/dist/components/BottomSheet/index.d.ts +10 -0
- package/dist/components/BottomSheet/index.js +35 -0
- package/dist/components/Buttons/index.d.ts +14 -0
- package/dist/components/Buttons/index.js +46 -0
- package/dist/components/CheckBox/index.d.ts +21 -0
- package/dist/components/CheckBox/index.js +42 -0
- package/dist/components/Container/index.d.ts +11 -0
- package/dist/components/Container/index.js +30 -0
- package/dist/components/DateTimePicker/index.d.ts +11 -0
- package/dist/components/DateTimePicker/index.js +50 -0
- package/dist/components/Dividers/index.d.ts +9 -0
- package/dist/components/Dividers/index.js +23 -0
- package/dist/components/DocumentPicker/index.d.ts +16 -0
- package/dist/components/DocumentPicker/index.js +52 -0
- package/dist/components/DropDown/index.d.ts +24 -0
- package/dist/components/DropDown/index.js +34 -0
- package/dist/components/FullSpinner/index.d.ts +6 -0
- package/dist/components/FullSpinner/index.js +22 -0
- package/dist/components/HProgressSteps/index.d.ts +15 -0
- package/dist/components/HProgressSteps/index.js +102 -0
- package/dist/components/HStack/index.d.ts +10 -0
- package/dist/components/HStack/index.js +13 -0
- package/dist/components/HorizontalFlatList/index.d.ts +10 -0
- package/dist/components/HorizontalFlatList/index.js +14 -0
- package/dist/components/Image/index.d.ts +5 -0
- package/dist/components/Image/index.js +6 -0
- package/dist/components/ImagePicker/index.d.ts +10 -0
- package/dist/components/ImagePicker/index.js +109 -0
- package/dist/components/Input/index.d.ts +26 -0
- package/dist/components/Input/index.js +118 -0
- package/dist/components/Modal/index.d.ts +9 -0
- package/dist/components/Modal/index.js +5 -0
- package/dist/components/MyStatusBar/index.d.ts +8 -0
- package/dist/components/MyStatusBar/index.js +13 -0
- package/dist/components/ProgressBar/index.d.ts +9 -0
- package/dist/components/ProgressBar/index.js +26 -0
- package/dist/components/RadioButton/index.d.ts +18 -0
- package/dist/components/RadioButton/index.js +49 -0
- package/dist/components/ScrolledContainer/index.d.ts +13 -0
- package/dist/components/ScrolledContainer/index.js +30 -0
- package/dist/components/ShouldRender/index.d.ts +6 -0
- package/dist/components/ShouldRender/index.js +5 -0
- package/dist/components/Spinner/index.d.ts +8 -0
- package/dist/components/Spinner/index.js +17 -0
- package/dist/components/Switch/index.d.ts +6 -0
- package/dist/components/Switch/index.js +23 -0
- package/dist/components/T/index.d.ts +17 -0
- package/dist/components/T/index.js +20 -0
- package/dist/components/Toast/index.d.ts +13 -0
- package/dist/components/Toast/index.js +84 -0
- package/dist/components/VProgressSteps/index.d.ts +3 -0
- package/dist/components/VProgressSteps/index.js +77 -0
- package/dist/components/VStack/index.d.ts +9 -0
- package/dist/components/VStack/index.js +15 -0
- package/dist/components/VerticalFlatList/index.d.ts +7 -0
- package/dist/components/VerticalFlatList/index.js +6 -0
- package/dist/components/index.d.ts +28 -0
- package/dist/components/index.js +28 -0
- package/dist/constants/messages.d.ts +11 -0
- package/dist/constants/messages.js +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/styles/colors.d.ts +32 -0
- package/dist/styles/colors.js +31 -0
- package/dist/styles/config.json +108 -0
- package/dist/styles/images.d.ts +9 -0
- package/dist/styles/images.js +15 -0
- package/dist/styles/index.d.ts +7 -0
- package/dist/styles/index.js +9 -0
- package/dist/styles/mixins.d.ts +64 -0
- package/dist/styles/mixins.js +68 -0
- package/dist/styles/scale.d.ts +4 -0
- package/dist/styles/scale.js +9 -0
- package/dist/styles/typography.d.ts +89 -0
- package/dist/styles/typography.js +123 -0
- package/dist/utils/permissionMessage.d.ts +12 -0
- package/dist/utils/permissionMessage.js +12 -0
- package/dist/utils/permissions.d.ts +18 -0
- package/dist/utils/permissions.js +106 -0
- package/dist/utils/regex.d.ts +2 -0
- package/dist/utils/regex.js +7 -0
- package/package.json +37 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
interface AccordionProps {
|
|
4
|
+
title: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
initiallyExpanded?: boolean;
|
|
7
|
+
showIcon?: boolean;
|
|
8
|
+
textStyle?: TextStyle;
|
|
9
|
+
headerStyle?: ViewStyle;
|
|
10
|
+
bodyStyle?: ViewStyle;
|
|
11
|
+
iconColor?: string;
|
|
12
|
+
containerStyle?: any;
|
|
13
|
+
}
|
|
14
|
+
declare const Accordion: React.FC<AccordionProps>;
|
|
15
|
+
export default Accordion;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet, LayoutAnimation, Platform, UIManager, } from 'react-native';
|
|
3
|
+
import { Colors, Typography, Scale } from '../../styles';
|
|
4
|
+
import T from '../T';
|
|
5
|
+
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
6
|
+
if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
|
|
7
|
+
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
8
|
+
}
|
|
9
|
+
const Accordion = ({ title, children, initiallyExpanded = false, showIcon = true, textStyle, headerStyle, bodyStyle, iconColor = Colors.white, containerStyle }) => {
|
|
10
|
+
const [expanded, setExpanded] = useState(initiallyExpanded);
|
|
11
|
+
const toggleExpand = () => {
|
|
12
|
+
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
13
|
+
setExpanded(!expanded);
|
|
14
|
+
};
|
|
15
|
+
return (React.createElement(View, { style: [styles.container, containerStyle] },
|
|
16
|
+
React.createElement(View, { style: [
|
|
17
|
+
styles.header,
|
|
18
|
+
expanded && { borderBottomLeftRadius: 0, borderBottomRightRadius: 0 },
|
|
19
|
+
headerStyle,
|
|
20
|
+
] },
|
|
21
|
+
React.createElement(T, { title: title, intlType: "", style: [styles.title, textStyle] }),
|
|
22
|
+
React.createElement(TouchableOpacity, { style: {}, onPress: toggleExpand, activeOpacity: 0.8 }, showIcon && (React.createElement(Ionicons, { name: expanded ? 'chevron-up' : 'chevron-down', size: 20, color: iconColor })))),
|
|
23
|
+
expanded && React.createElement(View, { style: [styles.body, bodyStyle] }, children)));
|
|
24
|
+
};
|
|
25
|
+
const styles = StyleSheet.create({
|
|
26
|
+
container: {
|
|
27
|
+
marginVertical: Scale.moderateScale(5),
|
|
28
|
+
borderWidth: 1,
|
|
29
|
+
borderColor: Colors.disabledGrey,
|
|
30
|
+
borderRadius: Scale.moderateScale(8),
|
|
31
|
+
overflow: 'hidden',
|
|
32
|
+
},
|
|
33
|
+
header: {
|
|
34
|
+
padding: Scale.moderateScale(12),
|
|
35
|
+
backgroundColor: Colors.primaryColor,
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
width: '100%'
|
|
40
|
+
},
|
|
41
|
+
title: {
|
|
42
|
+
...Typography.style.standardU(),
|
|
43
|
+
color: Colors.white,
|
|
44
|
+
flex: 1,
|
|
45
|
+
},
|
|
46
|
+
body: {
|
|
47
|
+
padding: Scale.moderateScale(10),
|
|
48
|
+
backgroundColor: Colors.white,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
export default Accordion;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Modal, View, StyleSheet, TouchableOpacity } from "react-native";
|
|
3
|
+
import { Colors } from "../../styles";
|
|
4
|
+
const BottomSheet = ({ ref, visible, onClose, children, height = 300, }) => {
|
|
5
|
+
return (React.createElement(Modal, { ref: ref, transparent: true, visible: visible, animationType: "slide" },
|
|
6
|
+
React.createElement(TouchableOpacity, { style: styles.overlay, activeOpacity: 1, onPress: onClose }),
|
|
7
|
+
React.createElement(View, { style: [styles.sheet, { height }] },
|
|
8
|
+
React.createElement(View, { style: styles.dragIndicator }),
|
|
9
|
+
children)));
|
|
10
|
+
};
|
|
11
|
+
export default BottomSheet;
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
overlay: {
|
|
14
|
+
flex: 1,
|
|
15
|
+
backgroundColor: "rgba(0,0,0,0.4)",
|
|
16
|
+
},
|
|
17
|
+
sheet: {
|
|
18
|
+
backgroundColor: Colors.white,
|
|
19
|
+
borderTopLeftRadius: 16,
|
|
20
|
+
borderTopRightRadius: 16,
|
|
21
|
+
padding: 16,
|
|
22
|
+
position: "absolute",
|
|
23
|
+
bottom: 0,
|
|
24
|
+
left: 0,
|
|
25
|
+
right: 0,
|
|
26
|
+
},
|
|
27
|
+
dragIndicator: {
|
|
28
|
+
width: 40,
|
|
29
|
+
height: 5,
|
|
30
|
+
backgroundColor: "#ccc",
|
|
31
|
+
borderRadius: 3,
|
|
32
|
+
alignSelf: "center",
|
|
33
|
+
marginBottom: 10,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
type ButtonDataProps = {
|
|
4
|
+
title: string;
|
|
5
|
+
buttonStyle?: ViewStyle;
|
|
6
|
+
intlType?: string;
|
|
7
|
+
outline?: boolean;
|
|
8
|
+
titleStyle?: TextStyle;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
onPress?: () => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare const Button: ({ outline, buttonStyle, title, intlType, titleStyle, loading, onPress, disabled, }: ButtonDataProps) => React.JSX.Element;
|
|
14
|
+
export default Button;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, Text, TouchableOpacity, ActivityIndicator, Dimensions, } from 'react-native';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Colors, Typography, Scale } from '../../styles';
|
|
5
|
+
const { width } = Dimensions.get('window');
|
|
6
|
+
const Button = ({ outline, buttonStyle, title, intlType, titleStyle, loading, onPress, disabled, }) => {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
const dynamicTranslation = (text) => intlType ? t(text, { ns: intlType }) : t(text);
|
|
9
|
+
return (React.createElement(TouchableOpacity, { style: [
|
|
10
|
+
styles.button,
|
|
11
|
+
outline && styles.outlineButton,
|
|
12
|
+
buttonStyle,
|
|
13
|
+
(disabled || loading) && styles.disabledButton,
|
|
14
|
+
], onPress: onPress, disabled: disabled || loading, activeOpacity: 0.7 }, loading ? (React.createElement(ActivityIndicator, { color: outline ? Colors.primaryColor : '#fff' })) : (React.createElement(Text, { style: [
|
|
15
|
+
styles.defaultTitleStyle,
|
|
16
|
+
outline && styles.outlineTitleStyle,
|
|
17
|
+
titleStyle,
|
|
18
|
+
] }, dynamicTranslation(title)))));
|
|
19
|
+
};
|
|
20
|
+
export default Button;
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
button: {
|
|
23
|
+
width: width,
|
|
24
|
+
alignSelf: 'center',
|
|
25
|
+
borderRadius: 5,
|
|
26
|
+
backgroundColor: Colors.primaryColor,
|
|
27
|
+
height: Scale.moderateScale(50),
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
},
|
|
31
|
+
outlineButton: {
|
|
32
|
+
backgroundColor: 'transparent',
|
|
33
|
+
borderWidth: 1,
|
|
34
|
+
borderColor: Colors.primaryColor,
|
|
35
|
+
},
|
|
36
|
+
outlineTitleStyle: { color: Colors.primaryColor },
|
|
37
|
+
defaultTitleStyle: {
|
|
38
|
+
...Typography.style.standardU(),
|
|
39
|
+
textTransform: 'capitalize',
|
|
40
|
+
color: Colors.white,
|
|
41
|
+
},
|
|
42
|
+
disabledButton: {
|
|
43
|
+
opacity: 0.6,
|
|
44
|
+
backgroundColor: Colors.disabledGrey,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
interface CheckBoxProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
intlType?: string;
|
|
6
|
+
checked: boolean;
|
|
7
|
+
onChange: (checked: boolean) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
size?: number;
|
|
10
|
+
color?: string;
|
|
11
|
+
checkedColor?: string;
|
|
12
|
+
disabledColor?: string;
|
|
13
|
+
labelColor?: string;
|
|
14
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
15
|
+
boxStyle?: StyleProp<ViewStyle>;
|
|
16
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
17
|
+
iconStyle?: StyleProp<TextStyle>;
|
|
18
|
+
renderLabel?: () => React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
declare const CheckBox: React.FC<CheckBoxProps>;
|
|
21
|
+
export default CheckBox;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity, StyleSheet, } from 'react-native';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import Icon from 'react-native-vector-icons/Feather';
|
|
5
|
+
import { Colors } from '../../styles';
|
|
6
|
+
const CheckBox = ({ label, intlType, checked, onChange, disabled = false, size = 20, color = Colors.checkedColor, checkedColor = Colors.checkedColor, disabledColor = Colors.disabledGrey, labelColor = Colors.textColor, containerStyle, boxStyle, labelStyle, iconStyle, renderLabel, }) => {
|
|
7
|
+
const { t } = useTranslation();
|
|
8
|
+
const getLabel = () => {
|
|
9
|
+
if (!label)
|
|
10
|
+
return '';
|
|
11
|
+
if (intlType) {
|
|
12
|
+
const translated = t(label, { ns: intlType });
|
|
13
|
+
if (translated !== label)
|
|
14
|
+
return translated;
|
|
15
|
+
}
|
|
16
|
+
return label;
|
|
17
|
+
};
|
|
18
|
+
return (React.createElement(TouchableOpacity, { style: [styles.container, containerStyle], onPress: () => onChange(!checked), disabled: disabled, activeOpacity: 0.7 },
|
|
19
|
+
React.createElement(View, { style: [
|
|
20
|
+
{
|
|
21
|
+
width: size,
|
|
22
|
+
height: size,
|
|
23
|
+
borderWidth: 1,
|
|
24
|
+
borderColor: disabled ? disabledColor : color,
|
|
25
|
+
borderRadius: 4,
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
marginRight: 10,
|
|
29
|
+
backgroundColor: checked ? checkedColor : 'transparent',
|
|
30
|
+
},
|
|
31
|
+
boxStyle,
|
|
32
|
+
] }, checked && (React.createElement(Icon, { name: "check", size: size * 0.7, color: "#fff", style: iconStyle }))),
|
|
33
|
+
renderLabel
|
|
34
|
+
? renderLabel()
|
|
35
|
+
: label
|
|
36
|
+
? React.createElement(Text, { style: [{ fontSize: 14, color: labelColor }, labelStyle] }, getLabel())
|
|
37
|
+
: null));
|
|
38
|
+
};
|
|
39
|
+
const styles = StyleSheet.create({
|
|
40
|
+
container: { flexDirection: 'row', alignItems: 'center' },
|
|
41
|
+
});
|
|
42
|
+
export default CheckBox;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
type ContainerProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
containerStyle?: ViewStyle;
|
|
6
|
+
safeEdgesTop?: boolean;
|
|
7
|
+
safeEdgesBottom?: boolean;
|
|
8
|
+
onPress?: () => void;
|
|
9
|
+
};
|
|
10
|
+
declare const Container: ({ children, containerStyle, safeEdgesTop, safeEdgesBottom, onPress, }: ContainerProps) => React.JSX.Element;
|
|
11
|
+
export default Container;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View, Platform, TouchableWithoutFeedback, KeyboardAvoidingView, } from 'react-native';
|
|
3
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
4
|
+
import { Colors, Scale } from '../../styles';
|
|
5
|
+
const Container = ({ children, containerStyle, safeEdgesTop, safeEdgesBottom, onPress, }) => {
|
|
6
|
+
const edges = ['left', 'right'];
|
|
7
|
+
if (safeEdgesTop) {
|
|
8
|
+
edges.push('top');
|
|
9
|
+
}
|
|
10
|
+
if (safeEdgesBottom) {
|
|
11
|
+
edges.push('bottom');
|
|
12
|
+
}
|
|
13
|
+
return (React.createElement(KeyboardAvoidingView, { behavior: Platform.OS === 'ios' ? 'padding' : undefined, style: styles.keyboardViewStyle },
|
|
14
|
+
React.createElement(TouchableWithoutFeedback, { onPress: onPress },
|
|
15
|
+
React.createElement(SafeAreaView, { edges: edges, style: [styles.globalSafeAreaStyle, containerStyle] },
|
|
16
|
+
React.createElement(View, { style: [styles.screen, containerStyle] }, children)))));
|
|
17
|
+
};
|
|
18
|
+
export default Container;
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
keyboardViewStyle: { flex: 1 },
|
|
21
|
+
globalSafeAreaStyle: {
|
|
22
|
+
flex: 1,
|
|
23
|
+
backgroundColor: Colors.background,
|
|
24
|
+
paddingBottom: Platform.OS === 'android' ? Scale?.moderateScale(10) : 0,
|
|
25
|
+
},
|
|
26
|
+
screen: {
|
|
27
|
+
flex: 1,
|
|
28
|
+
paddingTop: Scale?.moderateScale(20),
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DateTimePickerProps {
|
|
3
|
+
value: Date | null;
|
|
4
|
+
onChange: (date: Date) => void;
|
|
5
|
+
label: string;
|
|
6
|
+
intlType?: string;
|
|
7
|
+
mode?: 'date' | 'time' | 'datetime';
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const DateTimePicker: React.FC<DateTimePickerProps>;
|
|
11
|
+
export default DateTimePicker;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, TouchableOpacity, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import DatePicker from 'react-native-date-picker';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Colors, Scale, Typography } from '../../styles';
|
|
6
|
+
const DateTimePicker = ({ value, onChange, label, intlType, mode = 'date', disabled = false, }) => {
|
|
7
|
+
const { t } = useTranslation(['common', 'validation', 'address', 'sell']);
|
|
8
|
+
const getLabel = () => {
|
|
9
|
+
if (intlType) {
|
|
10
|
+
const translated = t(label, { ns: intlType });
|
|
11
|
+
if (translated !== label)
|
|
12
|
+
return translated;
|
|
13
|
+
}
|
|
14
|
+
return label;
|
|
15
|
+
};
|
|
16
|
+
const [open, setOpen] = useState(false);
|
|
17
|
+
return (React.createElement(View, { style: styles.container },
|
|
18
|
+
React.createElement(TouchableOpacity, { style: styles.button, disabled: disabled, onPress: () => setOpen(true) },
|
|
19
|
+
React.createElement(Text, { style: styles.text }, value ? formatValue(value, mode) : getLabel())),
|
|
20
|
+
React.createElement(DatePicker, { modal: true, open: open, date: value || new Date(), mode: mode, onConfirm: (val) => {
|
|
21
|
+
setOpen(false);
|
|
22
|
+
onChange(val);
|
|
23
|
+
}, onCancel: () => setOpen(false) })));
|
|
24
|
+
};
|
|
25
|
+
const formatValue = (date, mode) => {
|
|
26
|
+
try {
|
|
27
|
+
switch (mode) {
|
|
28
|
+
case 'time':
|
|
29
|
+
return date.toLocaleTimeString();
|
|
30
|
+
case 'datetime':
|
|
31
|
+
return date.toLocaleString();
|
|
32
|
+
default:
|
|
33
|
+
return date.toLocaleDateString();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return ''; // fallback if date is invalid
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const styles = StyleSheet.create({
|
|
41
|
+
container: { marginVertical: Scale.moderateScale(5) },
|
|
42
|
+
button: {
|
|
43
|
+
borderWidth: 1,
|
|
44
|
+
borderColor: Colors.primaryColor,
|
|
45
|
+
borderRadius: 5,
|
|
46
|
+
padding: 10,
|
|
47
|
+
},
|
|
48
|
+
text: { ...Typography.style.standardU(), color: Colors.primaryColor },
|
|
49
|
+
});
|
|
50
|
+
export default DateTimePicker;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
type DividerProps = {
|
|
4
|
+
small?: boolean;
|
|
5
|
+
disableMargin?: boolean;
|
|
6
|
+
marginStyle?: ViewStyle;
|
|
7
|
+
};
|
|
8
|
+
declare const Dividers: ({ small, disableMargin, marginStyle, }: DividerProps) => React.JSX.Element;
|
|
9
|
+
export default Dividers;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import { Divider } from 'react-native-elements';
|
|
4
|
+
import { Colors, Scale } from '../../styles';
|
|
5
|
+
const Dividers = ({ small, disableMargin, marginStyle, }) => (React.createElement(Divider, { style: [
|
|
6
|
+
small ? styles.dividerStyleSmall : styles.dividerStyleBig,
|
|
7
|
+
!disableMargin ? styles.verticalMargin : null,
|
|
8
|
+
marginStyle,
|
|
9
|
+
] }));
|
|
10
|
+
export default Dividers;
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
dividerStyleBig: {
|
|
13
|
+
backgroundColor: Colors.lightGrey,
|
|
14
|
+
height: Scale?.moderateScale(10),
|
|
15
|
+
},
|
|
16
|
+
dividerStyleSmall: {
|
|
17
|
+
backgroundColor: Colors.lightGrey,
|
|
18
|
+
height: 1,
|
|
19
|
+
},
|
|
20
|
+
verticalMargin: {
|
|
21
|
+
marginVertical: Scale?.moderateScale(20),
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
import type { DocumentPickerResponse } from '@react-native-documents/picker';
|
|
4
|
+
interface AppDocumentPickerProps {
|
|
5
|
+
label?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
onPick: (file: DocumentPickerResponse | null) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
iconColor?: string;
|
|
10
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
11
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
12
|
+
iconStyle?: StyleProp<ViewStyle>;
|
|
13
|
+
renderContent?: () => React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare const AppDocumentPicker: React.FC<AppDocumentPickerProps>;
|
|
16
|
+
export default AppDocumentPicker;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Text, TouchableOpacity, StyleSheet, } from 'react-native';
|
|
3
|
+
import * as DocumentPickerLib from '@react-native-documents/picker';
|
|
4
|
+
import { requestDocumentPermission } from '../../utils/permissions';
|
|
5
|
+
import { Colors } from '../../styles';
|
|
6
|
+
import Image from '../Image';
|
|
7
|
+
const AppDocumentPicker = ({ label = 'Upload File', icon = require('../../assets/images/upload.png'), onPick, disabled = false, containerStyle, labelStyle, iconStyle, iconColor = Colors.primaryColor, renderContent, }) => {
|
|
8
|
+
const [selectedFile, setSelectedFile] = useState(null);
|
|
9
|
+
const handlePick = async () => {
|
|
10
|
+
const granted = await requestDocumentPermission();
|
|
11
|
+
if (!granted) {
|
|
12
|
+
onPick(null);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const [res] = await DocumentPickerLib.pick({
|
|
17
|
+
type: [DocumentPickerLib.types.allFiles],
|
|
18
|
+
copyTo: 'documentDirectory',
|
|
19
|
+
});
|
|
20
|
+
setSelectedFile(res);
|
|
21
|
+
onPick(res);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
console.error('Document Picker Error:', err);
|
|
25
|
+
onPick(null);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return (React.createElement(TouchableOpacity, { style: [styles.container, containerStyle], onPress: handlePick, disabled: disabled, activeOpacity: 0.7 }, renderContent ? (renderContent()) : (React.createElement(React.Fragment, null,
|
|
29
|
+
selectedFile ? (React.createElement(Image, { source: { uri: selectedFile.uri }, style: [styles.fileIcon, iconStyle], resizeMode: "contain" })) : (React.createElement(Image, { source: icon, style: [{ width: 20, height: 20 }, iconStyle], tintColor: iconColor, resizeMode: "contain" })),
|
|
30
|
+
React.createElement(Text, { style: [styles.label, labelStyle] }, selectedFile ? selectedFile.name || 'Uploaded File' : label)))));
|
|
31
|
+
};
|
|
32
|
+
export default AppDocumentPicker;
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
container: {
|
|
35
|
+
flexDirection: 'row',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
borderWidth: 1,
|
|
38
|
+
borderColor: Colors.borderGrey,
|
|
39
|
+
padding: 10,
|
|
40
|
+
borderRadius: 8,
|
|
41
|
+
},
|
|
42
|
+
label: {
|
|
43
|
+
fontSize: 14,
|
|
44
|
+
marginLeft: 8,
|
|
45
|
+
color: Colors.textColor,
|
|
46
|
+
},
|
|
47
|
+
fileIcon: {
|
|
48
|
+
width: 24,
|
|
49
|
+
height: 24,
|
|
50
|
+
marginRight: 8,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AppDropDownProps {
|
|
3
|
+
intlType?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
data: Array<{
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}>;
|
|
9
|
+
value: string | null;
|
|
10
|
+
onChange: (item: {
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}) => void;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
containerStyle?: any;
|
|
16
|
+
dropDownStyle?: any;
|
|
17
|
+
itemTextStyle?: any;
|
|
18
|
+
placeholderStyle?: any;
|
|
19
|
+
iconStyle?: any;
|
|
20
|
+
selectedTextStyle?: any;
|
|
21
|
+
dropdownContainerStyle?: any;
|
|
22
|
+
}
|
|
23
|
+
declare const DropDown: React.FC<AppDropDownProps>;
|
|
24
|
+
export default DropDown;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, StyleSheet, Dimensions } from 'react-native';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Dropdown } from 'react-native-element-dropdown';
|
|
5
|
+
import { Colors, Typography } from '../../styles';
|
|
6
|
+
const { width } = Dimensions.get('window');
|
|
7
|
+
const DropDown = ({ intlType, label, data, value, onChange, disabled = false, containerStyle, dropDownStyle, itemTextStyle, placeholderStyle, iconStyle, selectedTextStyle, dropdownContainerStyle }) => {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
const placeholder = intlType && label
|
|
10
|
+
? String(t(`${intlType}.${label}`))
|
|
11
|
+
: label || '';
|
|
12
|
+
return (React.createElement(View, { style: [styles.container, containerStyle] },
|
|
13
|
+
React.createElement(Dropdown, { iconStyle: [styles.iconstyle, iconStyle], style: [styles.dropdown, dropDownStyle, disabled && { borderColor: Colors.borderGrey }], placeholder: placeholder, data: data, value: value, labelField: "label", valueField: "value", onChange: onChange, disable: disabled, placeholderStyle: [styles.placeholderStyle, placeholderStyle], itemTextStyle: [styles.placeholderStyle, itemTextStyle], selectedTextStyle: [styles.placeholderStyle, selectedTextStyle], containerStyle: [styles.container, dropdownContainerStyle] })));
|
|
14
|
+
};
|
|
15
|
+
const styles = StyleSheet.create({
|
|
16
|
+
container: { width: width },
|
|
17
|
+
dropdown: {
|
|
18
|
+
borderWidth: 1,
|
|
19
|
+
borderColor: Colors.primaryColor,
|
|
20
|
+
borderRadius: 5,
|
|
21
|
+
paddingHorizontal: 10,
|
|
22
|
+
paddingVertical: 15,
|
|
23
|
+
...Typography.style.standardU(),
|
|
24
|
+
color: Colors.textColor
|
|
25
|
+
},
|
|
26
|
+
placeholderStyle: {
|
|
27
|
+
color: Colors.textColor,
|
|
28
|
+
...Typography.style.standardU(),
|
|
29
|
+
},
|
|
30
|
+
iconstyle: {
|
|
31
|
+
color: Colors.textColor,
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
export default DropDown;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, ActivityIndicator, View } from 'react-native';
|
|
3
|
+
import { Colors } from '../../styles';
|
|
4
|
+
const FullSpinner = ({ isVisible, backgroundVisible, }) => isVisible ? (React.createElement(View, { style: [styles.mainContainer, backgroundVisible && styles.background] },
|
|
5
|
+
React.createElement(ActivityIndicator, { size: "large", color: Colors.primaryColor }))) : null;
|
|
6
|
+
export default FullSpinner;
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
mainContainer: {
|
|
9
|
+
position: 'absolute',
|
|
10
|
+
top: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
backgroundColor: 'transparent',
|
|
13
|
+
right: 0,
|
|
14
|
+
bottom: 0,
|
|
15
|
+
justifyContent: 'center',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
flex: 1,
|
|
18
|
+
},
|
|
19
|
+
background: {
|
|
20
|
+
backgroundColor: Colors.background,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A reusable horizontal progress steps component for React Native.
|
|
4
|
+
* It displays a series of circles connected by lines to represent steps.
|
|
5
|
+
* The active and completed steps have different styling.
|
|
6
|
+
*
|
|
7
|
+
* @param {Array<string>} steps - An array of strings representing the step titles.
|
|
8
|
+
* @param {number} currentStep - The index of the currently active step (0-indexed).
|
|
9
|
+
* @param {string} [activeStepColor] - Color for the active step circle. Defaults to Colors.primaryColor.
|
|
10
|
+
* @param {string} [completedStepColor] - Color for completed steps. Defaults to Colors.primaryColor.
|
|
11
|
+
* @param {string} [defaultStepColor] - Color for incomplete steps. Defaults to Colors.borderGrey.
|
|
12
|
+
* @param {number} [stepSize=30] - Diameter of the step circles.
|
|
13
|
+
*/
|
|
14
|
+
declare const HProgressSteps: ({ steps, currentStep, activeStepColor, completedStepColor, defaultStepColor, stepSize, }: any) => React.JSX.Element;
|
|
15
|
+
export default HProgressSteps;
|