@teamnhz/rn-ui-toolkit 1.0.2 → 1.0.3

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.
Files changed (39) hide show
  1. package/dist/assets/images/ic_calendar.png +0 -0
  2. package/dist/assets/images/ic_time.png +0 -0
  3. package/dist/components/BottomSheet/index.js +58 -2
  4. package/dist/components/Buttons/index.d.ts +2 -2
  5. package/dist/components/Buttons/index.js +102 -11
  6. package/dist/components/CheckBox/index.d.ts +2 -2
  7. package/dist/components/CheckBox/index.js +112 -15
  8. package/dist/components/DateTimePicker/index.d.ts +20 -4
  9. package/dist/components/DateTimePicker/index.js +246 -20
  10. package/dist/components/Dividers/index.d.ts +3 -3
  11. package/dist/components/Dividers/index.js +41 -5
  12. package/dist/components/HorizontalFlatList/index.d.ts +2 -2
  13. package/dist/components/HorizontalFlatList/index.js +47 -8
  14. package/dist/components/Image/index.d.ts +2 -4
  15. package/dist/components/Image/index.js +22 -4
  16. package/dist/components/ImagePicker/index.d.ts +8 -1
  17. package/dist/components/ImagePicker/index.js +154 -18
  18. package/dist/components/Input/index.d.ts +12 -4
  19. package/dist/components/Input/index.js +288 -22
  20. package/dist/components/KeyboardScroll/index.d.ts +3 -0
  21. package/dist/components/KeyboardScroll/index.js +76 -0
  22. package/dist/components/Modal/index.d.ts +2 -2
  23. package/dist/components/Modal/index.js +31 -3
  24. package/dist/components/Switch/index.d.ts +13 -3
  25. package/dist/components/Switch/index.js +93 -12
  26. package/dist/components/T/index.d.ts +5 -4
  27. package/dist/components/T/index.js +69 -10
  28. package/dist/components/Toast/index.js +123 -3
  29. package/dist/components/VerticalFlatList/index.d.ts +2 -2
  30. package/dist/components/VerticalFlatList/index.js +22 -5
  31. package/dist/components/index.d.ts +29 -29
  32. package/dist/components/index.js +29 -29
  33. package/dist/styles/colors.d.ts +1 -0
  34. package/dist/styles/colors.js +30 -29
  35. package/dist/styles/images.d.ts +2 -0
  36. package/dist/styles/images.js +5 -1
  37. package/package.json +20 -16
  38. package/dist/components/ScrolledContainer/index.d.ts +0 -13
  39. package/dist/components/ScrolledContainer/index.js +0 -30
Binary file
@@ -15,7 +15,7 @@ const styles = StyleSheet.create({
15
15
  backgroundColor: "rgba(0,0,0,0.4)",
16
16
  },
17
17
  sheet: {
18
- backgroundColor: Colors.white,
18
+ backgroundColor: Colors.appThemeColor,
19
19
  borderTopLeftRadius: 16,
20
20
  borderTopRightRadius: 16,
21
21
  padding: 16,
@@ -27,9 +27,65 @@ const styles = StyleSheet.create({
27
27
  dragIndicator: {
28
28
  width: 40,
29
29
  height: 5,
30
- backgroundColor: "#ccc",
30
+ backgroundColor: Colors.dividerColor,
31
31
  borderRadius: 3,
32
32
  alignSelf: "center",
33
33
  marginBottom: 10,
34
34
  },
35
35
  });
36
+ // import React from "react";
37
+ // import { Modal, View, StyleSheet, TouchableOpacity } from "react-native";
38
+ // import { Colors } from "../../styles";
39
+ // interface AppBottomSheetProps {
40
+ // ref?:any;
41
+ // visible: boolean;
42
+ // onClose: () => void;
43
+ // children: React.ReactNode;
44
+ // height?: number;
45
+ // }
46
+ // const BottomSheet: React.FC<AppBottomSheetProps> = ({
47
+ // ref,
48
+ // visible,
49
+ // onClose,
50
+ // children,
51
+ // height = 300,
52
+ // }) => {
53
+ // return (
54
+ // <Modal ref={ref} transparent visible={visible} animationType="slide">
55
+ // <TouchableOpacity
56
+ // style={styles.overlay}
57
+ // activeOpacity={1}
58
+ // onPress={onClose}
59
+ // />
60
+ // <View style={[styles.sheet, { height }]}>
61
+ // <View style={styles.dragIndicator} />
62
+ // {children}
63
+ // </View>
64
+ // </Modal>
65
+ // );
66
+ // };
67
+ // export default BottomSheet;
68
+ // const styles = StyleSheet.create({
69
+ // overlay: {
70
+ // flex: 1,
71
+ // backgroundColor: "rgba(0,0,0,0.4)",
72
+ // },
73
+ // sheet: {
74
+ // backgroundColor: Colors.white,
75
+ // borderTopLeftRadius: 16,
76
+ // borderTopRightRadius: 16,
77
+ // padding: 16,
78
+ // position: "absolute",
79
+ // bottom: 0,
80
+ // left: 0,
81
+ // right: 0,
82
+ // },
83
+ // dragIndicator: {
84
+ // width: 40,
85
+ // height: 5,
86
+ // backgroundColor: "#ccc",
87
+ // borderRadius: 3,
88
+ // alignSelf: "center",
89
+ // marginBottom: 10,
90
+ // },
91
+ // });
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { ViewStyle, TextStyle } from 'react-native';
1
+ import React from "react";
2
+ import { ViewStyle, TextStyle } from "react-native";
3
3
  type ButtonDataProps = {
4
4
  title: string;
5
5
  buttonStyle?: ViewStyle;
@@ -1,8 +1,8 @@
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');
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
6
  const Button = ({ outline, buttonStyle, title, intlType, titleStyle, loading, onPress, disabled, }) => {
7
7
  const { t } = useTranslation();
8
8
  const dynamicTranslation = (text) => intlType ? t(text, { ns: intlType }) : t(text);
@@ -11,7 +11,7 @@ const Button = ({ outline, buttonStyle, title, intlType, titleStyle, loading, on
11
11
  outline && styles.outlineButton,
12
12
  buttonStyle,
13
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: [
14
+ ], onPress: onPress, disabled: disabled || loading, activeOpacity: 0.7 }, loading ? (React.createElement(ActivityIndicator, { color: outline ? Colors.primaryColor : "#fff" })) : (React.createElement(Text, { style: [
15
15
  styles.defaultTitleStyle,
16
16
  outline && styles.outlineTitleStyle,
17
17
  titleStyle,
@@ -21,22 +21,22 @@ export default Button;
21
21
  const styles = StyleSheet.create({
22
22
  button: {
23
23
  width: width,
24
- alignSelf: 'center',
24
+ alignSelf: "center",
25
25
  borderRadius: 5,
26
26
  backgroundColor: Colors.primaryColor,
27
27
  height: Scale.moderateScale(50),
28
- alignItems: 'center',
29
- justifyContent: 'center',
28
+ alignItems: "center",
29
+ justifyContent: "center",
30
30
  },
31
31
  outlineButton: {
32
- backgroundColor: 'transparent',
32
+ backgroundColor: "transparent",
33
33
  borderWidth: 1,
34
34
  borderColor: Colors.primaryColor,
35
35
  },
36
36
  outlineTitleStyle: { color: Colors.primaryColor },
37
37
  defaultTitleStyle: {
38
38
  ...Typography.style.standardU(),
39
- textTransform: 'capitalize',
39
+ textTransform: "capitalize",
40
40
  color: Colors.white,
41
41
  },
42
42
  disabledButton: {
@@ -44,3 +44,94 @@ const styles = StyleSheet.create({
44
44
  backgroundColor: Colors.disabledGrey,
45
45
  },
46
46
  });
47
+ // import React from "react";
48
+ // import {
49
+ // StyleSheet,
50
+ // Text,
51
+ // TouchableOpacity,
52
+ // ActivityIndicator,
53
+ // ViewStyle,
54
+ // TextStyle,
55
+ // Dimensions,
56
+ // } from "react-native";
57
+ // import { useTranslation } from "react-i18next";
58
+ // import { Colors, Typography, Scale } from "../../styles";
59
+ // const { width } = Dimensions.get("window");
60
+ // type ButtonDataProps = {
61
+ // title: string;
62
+ // buttonStyle?: ViewStyle;
63
+ // intlType?: string; // namespace
64
+ // outline?: boolean;
65
+ // titleStyle?: TextStyle;
66
+ // loading?: boolean;
67
+ // onPress?: () => void;
68
+ // disabled?: boolean;
69
+ // };
70
+ // const Button = ({
71
+ // outline,
72
+ // buttonStyle,
73
+ // title,
74
+ // intlType,
75
+ // titleStyle,
76
+ // loading,
77
+ // onPress,
78
+ // disabled,
79
+ // }: ButtonDataProps) => {
80
+ // const { t } = useTranslation();
81
+ // const dynamicTranslation = (text: string) =>
82
+ // intlType ? t(text, { ns: intlType }) : t(text);
83
+ // return (
84
+ // <TouchableOpacity
85
+ // style={[
86
+ // styles.button,
87
+ // outline && styles.outlineButton,
88
+ // buttonStyle,
89
+ // (disabled || loading) && styles.disabledButton,
90
+ // ]}
91
+ // onPress={onPress}
92
+ // disabled={disabled || loading}
93
+ // activeOpacity={0.7}
94
+ // >
95
+ // {loading ? (
96
+ // <ActivityIndicator color={outline ? Colors.primaryColor : "#fff"} />
97
+ // ) : (
98
+ // <Text
99
+ // style={[
100
+ // styles.defaultTitleStyle,
101
+ // outline && styles.outlineTitleStyle,
102
+ // titleStyle,
103
+ // ]}
104
+ // >
105
+ // {dynamicTranslation(title)}
106
+ // </Text>
107
+ // )}
108
+ // </TouchableOpacity>
109
+ // );
110
+ // };
111
+ // export default Button;
112
+ // const styles = StyleSheet.create({
113
+ // button: {
114
+ // width: width,
115
+ // alignSelf: "center",
116
+ // borderRadius: 5,
117
+ // backgroundColor: Colors.primaryColor,
118
+ // height: Scale.moderateScale(50),
119
+ // alignItems: "center",
120
+ // justifyContent: "center",
121
+ // },
122
+ // outlineButton: {
123
+ // backgroundColor: "transparent",
124
+ // borderWidth: 1,
125
+ // borderColor: Colors.primaryColor,
126
+ // },
127
+ // outlineTitleStyle: { color: Colors.primaryColor },
128
+ // defaultTitleStyle: {
129
+ // ...Typography.style.standardU(),
130
+ // textTransform: "capitalize",
131
+ // color: Colors.white,
132
+ // },
133
+ // disabledButton: {
134
+ // opacity: 0.6,
135
+ // backgroundColor: Colors.disabledGrey,
136
+ // },
137
+ // });
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { StyleProp, ViewStyle, TextStyle } from 'react-native';
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle, TextStyle } from "react-native";
3
3
  interface CheckBoxProps {
4
4
  label?: string;
5
5
  intlType?: string;
@@ -1,13 +1,13 @@
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';
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
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
7
  const { t } = useTranslation();
8
8
  const getLabel = () => {
9
9
  if (!label)
10
- return '';
10
+ return "";
11
11
  if (intlType) {
12
12
  const translated = t(label, { ns: intlType });
13
13
  if (translated !== label)
@@ -23,20 +23,117 @@ const CheckBox = ({ label, intlType, checked, onChange, disabled = false, size =
23
23
  borderWidth: 1,
24
24
  borderColor: disabled ? disabledColor : color,
25
25
  borderRadius: 4,
26
- justifyContent: 'center',
27
- alignItems: 'center',
26
+ justifyContent: "center",
27
+ alignItems: "center",
28
28
  marginRight: 10,
29
- backgroundColor: checked ? checkedColor : 'transparent',
29
+ backgroundColor: checked ? checkedColor : "transparent",
30
30
  },
31
31
  boxStyle,
32
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));
33
+ renderLabel ? (renderLabel()) : label ? (React.createElement(Text, { style: [{ fontSize: 14, color: labelColor }, labelStyle] }, getLabel())) : null));
38
34
  };
39
35
  const styles = StyleSheet.create({
40
- container: { flexDirection: 'row', alignItems: 'center' },
36
+ container: { flexDirection: "row", alignItems: "center" },
41
37
  });
42
38
  export default CheckBox;
39
+ // import React from 'react';
40
+ // import {
41
+ // View,
42
+ // Text,
43
+ // TouchableOpacity,
44
+ // StyleSheet,
45
+ // StyleProp,
46
+ // ViewStyle,
47
+ // TextStyle,
48
+ // } from 'react-native';
49
+ // import { useTranslation } from 'react-i18next';
50
+ // import Icon from 'react-native-vector-icons/Feather';
51
+ // import { Colors } from '../../styles';
52
+ // interface CheckBoxProps {
53
+ // label?: string; // translation key OR plain text
54
+ // intlType?: string; // optional namespace
55
+ // checked: boolean;
56
+ // onChange: (checked: boolean) => void;
57
+ // disabled?: boolean;
58
+ // // Customization options
59
+ // size?: number; // box size
60
+ // color?: string; // border color
61
+ // checkedColor?: string; // fill color when checked
62
+ // disabledColor?: string; // border when disabled
63
+ // labelColor?: string;
64
+ // containerStyle?: StyleProp<ViewStyle>;
65
+ // boxStyle?: StyleProp<ViewStyle>;
66
+ // labelStyle?: StyleProp<TextStyle>;
67
+ // iconStyle?: StyleProp<TextStyle>;
68
+ // renderLabel?: () => React.ReactNode; // full custom label
69
+ // }
70
+ // const CheckBox: React.FC<CheckBoxProps> = ({
71
+ // label,
72
+ // intlType,
73
+ // checked,
74
+ // onChange,
75
+ // disabled = false,
76
+ // size = 20,
77
+ // color = Colors.checkedColor,
78
+ // checkedColor = Colors.checkedColor,
79
+ // disabledColor = Colors.disabledGrey,
80
+ // labelColor = Colors.textColor,
81
+ // containerStyle,
82
+ // boxStyle,
83
+ // labelStyle,
84
+ // iconStyle,
85
+ // renderLabel,
86
+ // }) => {
87
+ // const { t } = useTranslation();
88
+ // const getLabel = () => {
89
+ // if (!label) return '';
90
+ // if (intlType) {
91
+ // const translated = t(label, { ns: intlType });
92
+ // if (translated !== label) return translated;
93
+ // }
94
+ // return label;
95
+ // };
96
+ // return (
97
+ // <TouchableOpacity
98
+ // style={[styles.container, containerStyle]}
99
+ // onPress={() => onChange(!checked)}
100
+ // disabled={disabled}
101
+ // activeOpacity={0.7}
102
+ // >
103
+ // <View
104
+ // style={[
105
+ // {
106
+ // width: size,
107
+ // height: size,
108
+ // borderWidth: 1,
109
+ // borderColor: disabled ? disabledColor : color,
110
+ // borderRadius: 4,
111
+ // justifyContent: 'center',
112
+ // alignItems: 'center',
113
+ // marginRight: 10,
114
+ // backgroundColor: checked ? checkedColor : 'transparent',
115
+ // },
116
+ // boxStyle,
117
+ // ]}
118
+ // >
119
+ // {checked && (
120
+ // <Icon
121
+ // name="check"
122
+ // size={size * 0.7}
123
+ // color="#fff"
124
+ // style={iconStyle as any}
125
+ // />
126
+ // )}
127
+ // </View>
128
+ // {renderLabel
129
+ // ? renderLabel()
130
+ // : label
131
+ // ? <Text style={[{ fontSize: 14, color: labelColor }, labelStyle]}>{getLabel()}</Text>
132
+ // : null}
133
+ // </TouchableOpacity>
134
+ // );
135
+ // };
136
+ // const styles = StyleSheet.create({
137
+ // container: { flexDirection: 'row', alignItems: 'center' },
138
+ // });
139
+ // export default CheckBox;
@@ -1,17 +1,33 @@
1
- import React from 'react';
1
+ import React from "react";
2
+ import { ImageSourcePropType, StyleProp, TextStyle, ViewStyle, ImageStyle } from "react-native";
2
3
  interface DateTimePickerProps {
3
4
  value: Date | null;
4
5
  onChange: (date: Date) => void;
5
- label: string;
6
+ label?: string;
7
+ placeholder?: string;
6
8
  intlType?: string;
7
- mode?: 'date' | 'time' | 'datetime';
9
+ mode?: "date" | "time" | "datetime";
8
10
  disabled?: boolean;
9
- /** 🔥 new props (to match raw DatePicker usage) */
11
+ /** raw DatePicker props */
10
12
  minimumDate?: Date;
11
13
  maximumDate?: Date;
12
14
  modal?: boolean;
13
15
  confirmText?: string;
14
16
  cancelText?: string;
17
+ /** style overrides */
18
+ containerStyle?: StyleProp<ViewStyle>;
19
+ pickerContainerStyle?: StyleProp<ViewStyle>;
20
+ labelStyle?: StyleProp<TextStyle>;
21
+ textStyle?: StyleProp<TextStyle>;
22
+ leftImageStyle?: StyleProp<ImageStyle>;
23
+ rightImageStyle?: StyleProp<ImageStyle>;
24
+ /** icons */
25
+ leftIcon?: ImageSourcePropType;
26
+ rightIcon?: ImageSourcePropType;
27
+ leftIconShow?: boolean;
28
+ onCancel?: () => void;
29
+ error?: string | boolean;
30
+ errorTextStyle?: StyleProp<TextStyle>;
15
31
  }
16
32
  declare const DateTimePicker: React.FC<DateTimePickerProps>;
17
33
  export default DateTimePicker;