@momo-kits/foundation 0.76.1-beta.2 → 0.77.1-optimize.2
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/Application/BottomTab/BottomTabBar.tsx +478 -0
- package/Application/BottomTab/index.tsx +134 -0
- package/Application/Components.tsx +339 -161
- package/Application/ModalScreen.tsx +113 -99
- package/Application/Navigation.ts +22 -16
- package/Application/NavigationContainer.tsx +99 -48
- package/Application/Navigator.ts +110 -41
- package/Application/StackScreen.tsx +126 -8
- package/Application/index.ts +23 -4
- package/Application/types.ts +84 -33
- package/Application/utils.tsx +90 -50
- package/Assets/DotAnimation.json +256 -0
- package/Assets/SpinnerAnimation.json +1027 -0
- package/Assets/icon.json +83 -5
- package/Assets/icon_bank.json +506 -0
- package/Assets/language.json +202 -0
- package/Badge/Badge.tsx +56 -0
- package/Badge/BadgeDot.tsx +11 -0
- package/Badge/BadgeRibbon.tsx +125 -0
- package/Badge/Shape.tsx +29 -0
- package/Badge/index.tsx +7 -0
- package/Badge/styles.ts +58 -0
- package/Badge/types.ts +63 -0
- package/Button/index.tsx +90 -39
- package/Button/styles.ts +19 -0
- package/CheckBox/index.tsx +58 -43
- package/CheckBox/styles.ts +1 -1
- package/CheckBox/types.ts +6 -4
- package/Consts/colors+spacing+radius.ts +18 -0
- package/Consts/styles.ts +0 -26
- package/Consts/theme.ts +4 -0
- package/Divider/index.tsx +2 -0
- package/Icon/index.tsx +13 -9
- package/Icon/types.ts +4 -3
- package/IconButton/index.tsx +24 -15
- package/Image/index.tsx +60 -48
- package/Image/styles.ts +1 -9
- package/Image/types.ts +5 -1
- package/Input/Input.tsx +227 -116
- package/Input/InputDropDown.tsx +132 -0
- package/Input/InputMoney.tsx +174 -111
- package/Input/InputOTP.tsx +257 -0
- package/Input/InputSearch.tsx +160 -132
- package/Input/InputTextArea.tsx +150 -123
- package/Input/common.tsx +42 -17
- package/Input/index.tsx +204 -18
- package/Input/styles.ts +44 -7
- package/Input/utils.ts +2 -2
- package/Layout/Card.tsx +67 -29
- package/Layout/FloatingButton.tsx +128 -0
- package/Layout/GridSystem.tsx +31 -21
- package/Layout/Item.tsx +21 -25
- package/Layout/ItemList.tsx +55 -0
- package/Layout/ItemSectionList.tsx +39 -0
- package/Layout/Screen.tsx +348 -153
- package/Layout/Section.tsx +66 -34
- package/Layout/index.ts +13 -3
- package/Layout/styles.ts +101 -0
- package/Layout/types.ts +1 -39
- package/Layout/utils.ts +27 -52
- package/Loader/DotLoader.tsx +37 -0
- package/Loader/Loader.tsx +13 -0
- package/Loader/ProgressBar.tsx +44 -0
- package/Loader/Spinner.tsx +29 -0
- package/Loader/index.tsx +4 -0
- package/Loader/styles.ts +10 -0
- package/Loader/types.ts +35 -0
- package/Loader/utils.ts +25 -0
- package/Pagination/PaginationDot.tsx +7 -2
- package/Pagination/PaginationNumber.tsx +8 -6
- package/Pagination/PaginationScroll.tsx +0 -1
- package/Pagination/PaginationWhiteDot.tsx +8 -5
- package/Pagination/styles.ts +3 -0
- package/Pagination/types.ts +2 -0
- package/Popup/PopupNotify.tsx +102 -44
- package/Popup/PopupPromotion.tsx +63 -22
- package/Popup/types.ts +15 -4
- package/Radio/index.tsx +35 -21
- package/Radio/types.ts +7 -5
- package/Skeleton/index.tsx +1 -1
- package/Skeleton/types.ts +3 -0
- package/Switch/index.tsx +35 -24
- package/Switch/types.ts +5 -3
- package/Tag/index.tsx +2 -4
- package/Text/index.tsx +27 -22
- package/Text/styles.ts +38 -0
- package/Text/types.ts +25 -13
- package/Text/utils.ts +1 -1
- package/Title/index.tsx +186 -0
- package/Title/styles.ts +79 -0
- package/Title/types.ts +20 -0
- package/code-scanner.js +143 -0
- package/index.ts +8 -1
- package/migrate_typo.js +56 -0
- package/package.json +14 -9
- package/tsconfig.json +24 -0
- package/verify.js +47 -0
- package/Application/BottomTab.tsx +0 -52
- package/Application/NavigationButton.tsx +0 -54
- package/Assets/header-background.png +0 -0
package/Button/index.tsx
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import React, {FC, useContext} from 'react';
|
|
2
2
|
import {
|
|
3
|
+
Animated,
|
|
3
4
|
StyleSheet,
|
|
4
5
|
TouchableOpacity,
|
|
5
6
|
TouchableOpacityProps,
|
|
6
7
|
View,
|
|
7
8
|
} from 'react-native';
|
|
8
|
-
import
|
|
9
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
10
|
+
import {ApplicationContext, ComponentContext} from '../Application';
|
|
9
11
|
import {Text} from '../Text';
|
|
10
12
|
import {Typography} from '../Text/types';
|
|
11
|
-
import {Colors} from '../Consts';
|
|
13
|
+
import {Colors, Spacing} from '../Consts';
|
|
12
14
|
import styles from './styles';
|
|
13
15
|
import {Icon} from '../Icon';
|
|
16
|
+
import {Loader} from '../Loader';
|
|
17
|
+
|
|
18
|
+
const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
|
|
14
19
|
|
|
15
20
|
export interface ButtonProps extends TouchableOpacityProps {
|
|
16
21
|
/**
|
|
@@ -55,24 +60,48 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
55
60
|
*/
|
|
56
61
|
useTintColor?: boolean;
|
|
57
62
|
|
|
63
|
+
/**
|
|
64
|
+
* If true, the icon of button will use be show indicator loading.
|
|
65
|
+
*/
|
|
66
|
+
loading?: boolean;
|
|
67
|
+
|
|
58
68
|
/**
|
|
59
69
|
* A callback function that is called when the button is pressed.
|
|
60
70
|
*/
|
|
61
71
|
onPress: () => void;
|
|
72
|
+
|
|
73
|
+
params?: any;
|
|
62
74
|
}
|
|
63
75
|
|
|
64
76
|
const Button: FC<ButtonProps> = ({
|
|
65
|
-
type,
|
|
66
|
-
size,
|
|
67
|
-
useTintColor,
|
|
68
|
-
full,
|
|
77
|
+
type = 'primary',
|
|
78
|
+
size = 'large',
|
|
79
|
+
useTintColor = true,
|
|
80
|
+
full = true,
|
|
69
81
|
iconRight,
|
|
70
82
|
iconLeft,
|
|
71
|
-
|
|
83
|
+
loading = false,
|
|
84
|
+
title = 'Button',
|
|
72
85
|
onPress,
|
|
86
|
+
params,
|
|
87
|
+
accessibilityLabel,
|
|
73
88
|
...rest
|
|
74
89
|
}) => {
|
|
75
|
-
const {theme} = useContext(ApplicationContext);
|
|
90
|
+
const {theme, config} = useContext(ApplicationContext);
|
|
91
|
+
const {gradient, color} = config?.navigationBar?.buttonColors ?? {};
|
|
92
|
+
let gradientPros;
|
|
93
|
+
let state = 'enabled';
|
|
94
|
+
if (loading) {
|
|
95
|
+
state = 'loading';
|
|
96
|
+
}
|
|
97
|
+
if (gradient?.length > 0 && type == 'primary') {
|
|
98
|
+
gradientPros = {
|
|
99
|
+
colors: gradient,
|
|
100
|
+
start: {x: 1, y: 0.5},
|
|
101
|
+
end: {x: 0, y: 0.5},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
76
105
|
const getSizeStyle = () => {
|
|
77
106
|
const styleSheet: {[key: string]: any} = styles;
|
|
78
107
|
return styleSheet[size ?? 'small'];
|
|
@@ -96,7 +125,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
96
125
|
return {
|
|
97
126
|
backgroundColor: theme.colors.background.surface,
|
|
98
127
|
borderWidth: 1,
|
|
99
|
-
borderColor: theme.colors.primary,
|
|
128
|
+
borderColor: color ?? theme.colors.primary,
|
|
100
129
|
};
|
|
101
130
|
case 'tonal':
|
|
102
131
|
return {
|
|
@@ -151,14 +180,14 @@ const Button: FC<ButtonProps> = ({
|
|
|
151
180
|
const getTypography = (): Typography => {
|
|
152
181
|
switch (size) {
|
|
153
182
|
case 'large':
|
|
154
|
-
return '
|
|
183
|
+
return 'action_default_bold';
|
|
155
184
|
case 'medium':
|
|
156
|
-
return '
|
|
185
|
+
return 'action_s_bold';
|
|
157
186
|
case 'small':
|
|
158
|
-
return '
|
|
187
|
+
return 'action_xs_bold';
|
|
159
188
|
|
|
160
189
|
default:
|
|
161
|
-
return '
|
|
190
|
+
return 'action_default_bold';
|
|
162
191
|
}
|
|
163
192
|
};
|
|
164
193
|
|
|
@@ -171,13 +200,13 @@ const Button: FC<ButtonProps> = ({
|
|
|
171
200
|
case 'secondary':
|
|
172
201
|
return theme.colors.text.default;
|
|
173
202
|
case 'outline':
|
|
174
|
-
return theme.colors.primary;
|
|
203
|
+
return color ?? theme.colors.primary;
|
|
175
204
|
case 'tonal':
|
|
176
205
|
return theme.colors.primary;
|
|
177
206
|
case 'danger':
|
|
178
207
|
return Colors.black_01;
|
|
179
208
|
case 'text':
|
|
180
|
-
return theme.colors.primary;
|
|
209
|
+
return color ?? theme.colors.primary;
|
|
181
210
|
default:
|
|
182
211
|
return Colors.black_01;
|
|
183
212
|
}
|
|
@@ -200,11 +229,27 @@ const Button: FC<ButtonProps> = ({
|
|
|
200
229
|
* render leading
|
|
201
230
|
*/
|
|
202
231
|
const renderLeading = () => {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const color = useTintColor ? getTextColor() : undefined;
|
|
232
|
+
const iconSize = getIconSize();
|
|
233
|
+
const marginRight = getIconSpace();
|
|
234
|
+
const color = useTintColor ? getTextColor() : undefined;
|
|
207
235
|
|
|
236
|
+
if (loading) {
|
|
237
|
+
return (
|
|
238
|
+
<View
|
|
239
|
+
style={[
|
|
240
|
+
styles.trailing,
|
|
241
|
+
{
|
|
242
|
+
width: iconSize,
|
|
243
|
+
height: iconSize,
|
|
244
|
+
marginRight,
|
|
245
|
+
borderRadius: Spacing.M,
|
|
246
|
+
},
|
|
247
|
+
]}>
|
|
248
|
+
<Loader type="spinner" color={color} />
|
|
249
|
+
</View>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
if (iconLeft) {
|
|
208
253
|
return (
|
|
209
254
|
<View
|
|
210
255
|
style={[
|
|
@@ -221,8 +266,9 @@ const Button: FC<ButtonProps> = ({
|
|
|
221
266
|
* render trailing
|
|
222
267
|
*/
|
|
223
268
|
const renderTrailing = () => {
|
|
224
|
-
const marginLeft = getIconSpace();
|
|
225
269
|
const color = useTintColor ? getTextColor() : undefined;
|
|
270
|
+
const marginLeft = getIconSpace();
|
|
271
|
+
|
|
226
272
|
if (iconRight) {
|
|
227
273
|
const iconSize = getIconSize();
|
|
228
274
|
return (
|
|
@@ -253,26 +299,31 @@ const Button: FC<ButtonProps> = ({
|
|
|
253
299
|
const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
|
|
254
300
|
|
|
255
301
|
return (
|
|
256
|
-
<
|
|
257
|
-
{
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
302
|
+
<ComponentContext.Provider
|
|
303
|
+
value={{
|
|
304
|
+
componentName: 'Button',
|
|
305
|
+
params,
|
|
306
|
+
state: state,
|
|
307
|
+
componentId: accessibilityLabel,
|
|
308
|
+
componentValue: title,
|
|
309
|
+
action: 'click',
|
|
310
|
+
}}>
|
|
311
|
+
<TouchableOpacity
|
|
312
|
+
{...rest}
|
|
313
|
+
accessibilityLabel={accessibilityLabel}
|
|
314
|
+
activeOpacity={activeOpacity}
|
|
315
|
+
onPress={onPressButton}
|
|
316
|
+
style={buttonStyle}>
|
|
317
|
+
{renderLeading()}
|
|
318
|
+
{renderTitle()}
|
|
319
|
+
{renderTrailing()}
|
|
320
|
+
{gradientPros && (
|
|
321
|
+
<AnimationLinear {...gradientPros} style={styles.gradientView} />
|
|
322
|
+
)}
|
|
323
|
+
{gradientPros && <View style={styles.strokeView} />}
|
|
324
|
+
</TouchableOpacity>
|
|
325
|
+
</ComponentContext.Provider>
|
|
266
326
|
);
|
|
267
327
|
};
|
|
268
328
|
|
|
269
|
-
Button.defaultProps = {
|
|
270
|
-
type: 'primary',
|
|
271
|
-
size: 'large',
|
|
272
|
-
full: true,
|
|
273
|
-
disabled: false,
|
|
274
|
-
title: 'Button',
|
|
275
|
-
useTintColor: true,
|
|
276
|
-
};
|
|
277
|
-
|
|
278
329
|
export {Button};
|
package/Button/styles.ts
CHANGED
|
@@ -38,4 +38,23 @@ export default StyleSheet.create({
|
|
|
38
38
|
alignItems: 'center',
|
|
39
39
|
justifyContent: 'center',
|
|
40
40
|
},
|
|
41
|
+
gradientView: {
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
zIndex: -1,
|
|
44
|
+
borderRadius: 8,
|
|
45
|
+
top: 0,
|
|
46
|
+
bottom: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
right: 0,
|
|
49
|
+
},
|
|
50
|
+
strokeView: {
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
top: 2,
|
|
53
|
+
bottom: 2,
|
|
54
|
+
left: 2,
|
|
55
|
+
right: 2,
|
|
56
|
+
borderRadius: 6,
|
|
57
|
+
borderWidth: 0.5,
|
|
58
|
+
borderColor: '#FFF9E1',
|
|
59
|
+
},
|
|
41
60
|
});
|
package/CheckBox/index.tsx
CHANGED
|
@@ -2,60 +2,75 @@ import React, {FC, useContext} from 'react';
|
|
|
2
2
|
import {TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {CheckBoxProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {ApplicationContext} from '../Application';
|
|
5
|
+
import {ApplicationContext, ComponentContext} from '../Application';
|
|
6
6
|
import {Text} from '../Text';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
|
+
import {formatNameLength} from '../Application/utils';
|
|
8
9
|
|
|
9
|
-
const CheckBox: FC<CheckBoxProps> =
|
|
10
|
+
const CheckBox: FC<CheckBoxProps> = ({
|
|
11
|
+
value,
|
|
12
|
+
disabled = false,
|
|
13
|
+
onChange,
|
|
14
|
+
style,
|
|
15
|
+
label,
|
|
16
|
+
indeterminate,
|
|
17
|
+
params,
|
|
18
|
+
accessibilityLabel,
|
|
19
|
+
}) => {
|
|
10
20
|
const {theme} = useContext(ApplicationContext);
|
|
11
|
-
const
|
|
21
|
+
const haveValue = value || indeterminate;
|
|
22
|
+
const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
|
|
23
|
+
let borderColor = theme.colors.text.default;
|
|
24
|
+
let backgroundColor = theme.colors.background.surface;
|
|
12
25
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let backgroundColor = haveValue
|
|
18
|
-
? theme.colors.primary
|
|
19
|
-
: theme.colors.background.surface;
|
|
20
|
-
|
|
21
|
-
let iconSource = indeterminated ? 'ic_minus' : 'ic_checked';
|
|
26
|
+
if (haveValue) {
|
|
27
|
+
borderColor = theme.colors.primary;
|
|
28
|
+
backgroundColor = theme.colors.primary;
|
|
29
|
+
}
|
|
22
30
|
|
|
23
31
|
if (disabled) {
|
|
24
|
-
borderColor =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
borderColor = theme.colors.border.disable;
|
|
33
|
+
backgroundColor = theme.colors.background.surface;
|
|
34
|
+
if (haveValue) {
|
|
35
|
+
borderColor = theme.colors.background.tonal;
|
|
36
|
+
backgroundColor = theme.colors.background.tonal;
|
|
37
|
+
}
|
|
30
38
|
}
|
|
31
|
-
const checkboxStyle = {borderColor, backgroundColor, borderWidth: 1};
|
|
32
39
|
|
|
33
|
-
const onChangeValue = () => {
|
|
34
|
-
onChange?.(!value);
|
|
35
|
-
};
|
|
36
40
|
return (
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
<ComponentContext.Provider
|
|
42
|
+
value={{
|
|
43
|
+
componentName: 'CheckBox',
|
|
44
|
+
params,
|
|
45
|
+
state: disabled ? 'disabled' : 'filled',
|
|
46
|
+
componentId: accessibilityLabel,
|
|
47
|
+
action: 'click',
|
|
48
|
+
componentLabel: formatNameLength(label || ''),
|
|
49
|
+
componentValue: indeterminate ? 'undetermined' : value,
|
|
50
|
+
}}>
|
|
51
|
+
<TouchableOpacity
|
|
52
|
+
accessibilityLabel={accessibilityLabel}
|
|
53
|
+
activeOpacity={0.8}
|
|
54
|
+
onPress={() => onChange?.(!value)}
|
|
55
|
+
disabled={disabled}
|
|
56
|
+
style={[style, styles.container]}>
|
|
57
|
+
<View
|
|
58
|
+
style={[
|
|
59
|
+
{borderColor, backgroundColor, borderWidth: 1},
|
|
60
|
+
styles.checkbox,
|
|
61
|
+
]}>
|
|
62
|
+
{haveValue && (
|
|
63
|
+
<Icon
|
|
64
|
+
color={theme.colors.background.surface}
|
|
65
|
+
size={20}
|
|
66
|
+
source={iconSource}
|
|
67
|
+
/>
|
|
68
|
+
)}
|
|
69
|
+
</View>
|
|
70
|
+
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
71
|
+
</TouchableOpacity>
|
|
72
|
+
</ComponentContext.Provider>
|
|
54
73
|
);
|
|
55
74
|
};
|
|
56
75
|
|
|
57
|
-
CheckBox.defaultProps = {
|
|
58
|
-
disabled: false,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
76
|
export {CheckBox};
|
package/CheckBox/styles.ts
CHANGED
package/CheckBox/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {ViewStyle} from 'react-native';
|
|
1
|
+
import {TouchableOpacityProps, ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface CheckBoxProps extends TouchableOpacityProps {
|
|
4
4
|
/**
|
|
5
5
|
* Represents whether the CheckBox is currently checked (`true`) or unchecked (`false`).
|
|
6
6
|
*/
|
|
@@ -28,11 +28,13 @@ export type CheckBoxProps = {
|
|
|
28
28
|
* which is typically used to represent a "mixed" or "partial" selection state.
|
|
29
29
|
* Defaults to `false` if not provided.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
indeterminate?: boolean;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Optional. Used to apply custom styling to the CheckBox component.
|
|
35
35
|
* Accepts an object of style properties.
|
|
36
36
|
*/
|
|
37
37
|
style?: ViewStyle;
|
|
38
|
-
|
|
38
|
+
|
|
39
|
+
params?: any;
|
|
40
|
+
}
|
|
@@ -152,6 +152,10 @@ const Spacing = {
|
|
|
152
152
|
M: 12,
|
|
153
153
|
L: 16,
|
|
154
154
|
XL: 24,
|
|
155
|
+
XXL: 32,
|
|
156
|
+
Size3XL: 48,
|
|
157
|
+
Size4XL: 56,
|
|
158
|
+
Size5XL: 64,
|
|
155
159
|
};
|
|
156
160
|
|
|
157
161
|
const Radius = {
|
|
@@ -209,6 +213,20 @@ const Shadow = {
|
|
|
209
213
|
elevation: 6,
|
|
210
214
|
},
|
|
211
215
|
}),
|
|
216
|
+
|
|
217
|
+
Pink: Platform.select({
|
|
218
|
+
ios: {
|
|
219
|
+
shadowColor: '#e27eb5',
|
|
220
|
+
shadowOffset: {width: 0, height: 6},
|
|
221
|
+
shadowOpacity: 0.25,
|
|
222
|
+
shadowRadius: 8,
|
|
223
|
+
},
|
|
224
|
+
android: {
|
|
225
|
+
elevation: 16,
|
|
226
|
+
shadowColor: '#e27eb5',
|
|
227
|
+
shadowOpacity: 0.25,
|
|
228
|
+
},
|
|
229
|
+
}),
|
|
212
230
|
};
|
|
213
231
|
|
|
214
232
|
export {Colors, Spacing, Radius, Shadow};
|
package/Consts/styles.ts
CHANGED
|
@@ -47,32 +47,6 @@ const Styles = StyleSheet.create({
|
|
|
47
47
|
alignItems: 'flex-end',
|
|
48
48
|
justifyContent: 'center',
|
|
49
49
|
},
|
|
50
|
-
//paddingHorizontal
|
|
51
|
-
paddingHorizontal4: {
|
|
52
|
-
paddingHorizontal: 4,
|
|
53
|
-
},
|
|
54
|
-
paddingHorizontal8: {
|
|
55
|
-
paddingHorizontal: 8,
|
|
56
|
-
},
|
|
57
|
-
paddingHorizontal16: {
|
|
58
|
-
paddingHorizontal: 16,
|
|
59
|
-
},
|
|
60
|
-
paddingHorizontal24: {
|
|
61
|
-
paddingHorizontal: 24,
|
|
62
|
-
},
|
|
63
|
-
//paddingVertical
|
|
64
|
-
paddingVertical4: {
|
|
65
|
-
paddingVertical: 4,
|
|
66
|
-
},
|
|
67
|
-
paddingVertical8: {
|
|
68
|
-
paddingVertical: 8,
|
|
69
|
-
},
|
|
70
|
-
paddingVertical16: {
|
|
71
|
-
paddingVertical: 16,
|
|
72
|
-
},
|
|
73
|
-
paddingVertical24: {
|
|
74
|
-
paddingVertical: 24,
|
|
75
|
-
},
|
|
76
50
|
});
|
|
77
51
|
|
|
78
52
|
export {Styles};
|
package/Consts/theme.ts
CHANGED
|
@@ -116,6 +116,10 @@ const defaultDarkTheme: Theme = {
|
|
|
116
116
|
const defaultContext: Context = {
|
|
117
117
|
theme: defaultTheme,
|
|
118
118
|
navigator: undefined,
|
|
119
|
+
showGrid: false,
|
|
120
|
+
translate: (key: string) => {
|
|
121
|
+
return key;
|
|
122
|
+
},
|
|
119
123
|
};
|
|
120
124
|
|
|
121
125
|
export {defaultContext, defaultTheme, defaultDarkTheme};
|
package/Divider/index.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
2
|
import {View} from 'react-native';
|
|
3
3
|
import {ApplicationContext} from '../Application';
|
|
4
|
+
import {Spacing} from '../Consts';
|
|
4
5
|
|
|
5
6
|
const Divider = () => {
|
|
6
7
|
const {theme} = useContext(ApplicationContext);
|
|
@@ -11,6 +12,7 @@ const Divider = () => {
|
|
|
11
12
|
height: 1,
|
|
12
13
|
width: '100%',
|
|
13
14
|
backgroundColor: theme.colors.border.default,
|
|
15
|
+
marginVertical: Spacing.XS,
|
|
14
16
|
}}
|
|
15
17
|
/>
|
|
16
18
|
);
|
package/Icon/index.tsx
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import React, {useContext} from 'react';
|
|
2
2
|
import IconSources from '../Assets/icon.json';
|
|
3
|
+
import IconBankSources from '../Assets/icon_bank.json';
|
|
3
4
|
import {IconProps} from './types';
|
|
4
5
|
import {ApplicationContext} from '../Application';
|
|
5
6
|
import {Image} from '../Image';
|
|
6
7
|
|
|
7
|
-
const Icon: React.FC<IconProps> = ({
|
|
8
|
+
const Icon: React.FC<IconProps> = ({
|
|
9
|
+
source = 'ic_back',
|
|
10
|
+
size = 24,
|
|
11
|
+
color,
|
|
12
|
+
style = {},
|
|
13
|
+
}) => {
|
|
8
14
|
const {theme} = useContext(ApplicationContext);
|
|
9
15
|
|
|
10
16
|
/**
|
|
@@ -18,20 +24,18 @@ const Icon: React.FC<IconProps> = ({source, size, color, style = {}}) => {
|
|
|
18
24
|
return {uri: source};
|
|
19
25
|
};
|
|
20
26
|
|
|
27
|
+
const tintColorProps = color !== null && {
|
|
28
|
+
tintColor: color ?? theme.colors.text.default,
|
|
29
|
+
};
|
|
30
|
+
|
|
21
31
|
return (
|
|
22
32
|
<Image
|
|
23
|
-
accessibilityLabel={`Icon/${getIconSource()?.uri}`}
|
|
24
33
|
loading={false}
|
|
25
34
|
source={getIconSource()}
|
|
26
35
|
style={[style, {width: size, height: size}]}
|
|
27
|
-
|
|
36
|
+
{...tintColorProps}
|
|
28
37
|
/>
|
|
29
38
|
);
|
|
30
39
|
};
|
|
31
40
|
|
|
32
|
-
Icon
|
|
33
|
-
source: 'ic_back',
|
|
34
|
-
size: 24,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export {Icon, IconSources};
|
|
41
|
+
export {Icon, IconSources, IconBankSources};
|
package/Icon/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ImageStyle} from 'react-native-fast-image';
|
|
2
|
+
import {StyleProp} from "react-native";
|
|
2
3
|
|
|
3
4
|
export type IconProps = {
|
|
4
5
|
/**
|
|
@@ -17,11 +18,11 @@ export type IconProps = {
|
|
|
17
18
|
* Optional. Represents the color of the icon.
|
|
18
19
|
* It can be any valid color in @momo-kits/foundation.
|
|
19
20
|
*/
|
|
20
|
-
color?: string;
|
|
21
|
+
color?: string | null;
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Optional. Used to apply custom styling to the Icon component.
|
|
24
25
|
* Accepts an object of style properties.
|
|
25
26
|
*/
|
|
26
|
-
style?:
|
|
27
|
+
style?: StyleProp<ImageStyle>;
|
|
27
28
|
};
|
package/IconButton/index.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
TouchableOpacity,
|
|
6
6
|
TouchableOpacityProps,
|
|
7
7
|
} from 'react-native';
|
|
8
|
-
import {ApplicationContext} from '../Application';
|
|
8
|
+
import {ApplicationContext, ComponentContext} from '../Application';
|
|
9
9
|
import {Colors} from '../Consts';
|
|
10
10
|
import {Icon} from '../Icon';
|
|
11
11
|
import styles from './styles';
|
|
@@ -26,13 +26,17 @@ export interface IconButtonProps extends TouchableOpacityProps {
|
|
|
26
26
|
* Optional. Defines the size of the IconButton.
|
|
27
27
|
*/
|
|
28
28
|
size?: 'large' | 'small';
|
|
29
|
+
|
|
30
|
+
params?: any;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
const IconButton: React.FC<IconButtonProps> = ({
|
|
32
|
-
type,
|
|
34
|
+
type = 'primary',
|
|
33
35
|
icon,
|
|
34
36
|
size,
|
|
35
37
|
onPress,
|
|
38
|
+
params,
|
|
39
|
+
accessibilityLabel,
|
|
36
40
|
...rest
|
|
37
41
|
}) => {
|
|
38
42
|
const {theme} = useContext(ApplicationContext);
|
|
@@ -121,20 +125,25 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
121
125
|
const iconSize = size === 'small' ? 16 : 24;
|
|
122
126
|
|
|
123
127
|
return (
|
|
124
|
-
<
|
|
125
|
-
{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
<ComponentContext.Provider
|
|
129
|
+
value={{
|
|
130
|
+
componentName: 'IconButton',
|
|
131
|
+
params,
|
|
132
|
+
state: type === 'disabled' ? 'disabled' : 'enabled',
|
|
133
|
+
componentId: accessibilityLabel,
|
|
134
|
+
componentValue: icon,
|
|
135
|
+
action: 'click',
|
|
136
|
+
}}>
|
|
137
|
+
<TouchableOpacity
|
|
138
|
+
{...rest}
|
|
139
|
+
accessibilityLabel={accessibilityLabel}
|
|
140
|
+
activeOpacity={activeOpacity}
|
|
141
|
+
onPress={onPressButton}
|
|
142
|
+
style={buttonStyle}>
|
|
143
|
+
<Icon size={iconSize} source={icon} color={getIconColor()} />
|
|
144
|
+
</TouchableOpacity>
|
|
145
|
+
</ComponentContext.Provider>
|
|
132
146
|
);
|
|
133
147
|
};
|
|
134
148
|
|
|
135
|
-
IconButton.defaultProps = {
|
|
136
|
-
type: 'primary',
|
|
137
|
-
disabled: false,
|
|
138
|
-
};
|
|
139
|
-
|
|
140
149
|
export {IconButton};
|