@momo-kits/foundation 0.150.2-phuc.13 → 0.150.2-scaleSize.35
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/BottomSheet.tsx +39 -114
- package/Application/BottomTab/Badge.tsx +15 -2
- package/Application/BottomTab/BottomTabBar.tsx +1 -1
- package/Application/BottomTab/CustomBottomTabItem.tsx +5 -3
- package/Application/BottomTab/TabBarIcon.tsx +8 -6
- package/Application/BottomTab/index.tsx +82 -87
- package/Application/Components/BackgroundImageView.tsx +1 -1
- package/Application/Components/HeaderAnimated.tsx +12 -11
- package/Application/Components/HeaderBackground.tsx +1 -1
- package/Application/Components/HeaderExtendHeader.tsx +31 -26
- package/Application/Components/HeaderLeft.tsx +2 -2
- package/Application/Components/HeaderRight.tsx +24 -20
- package/Application/Components/HeaderTitle.tsx +19 -7
- package/Application/Components/NavigationButton.tsx +12 -11
- package/Application/Components/SearchHeader.tsx +20 -3
- package/Application/ModalScreen.tsx +14 -1
- package/Application/NavigationContainer.tsx +13 -7
- package/Application/StackScreen.tsx +100 -155
- package/Application/WidgetContainer.tsx +1 -1
- package/Application/index.ts +12 -31
- package/Application/types.ts +66 -18
- package/Application/utils.tsx +41 -17
- package/Assets/language.json +6 -2
- package/Assets/lottie_circle_loader.json +1 -0
- package/Badge/Badge.tsx +14 -11
- package/Badge/BadgeRibbon.tsx +1 -1
- package/Button/index.tsx +47 -32
- package/CheckBox/index.tsx +23 -19
- package/CheckBox/styles.ts +1 -0
- package/Context/index.ts +23 -0
- package/Divider/DashDivider.tsx +10 -9
- package/Divider/index.tsx +7 -7
- package/FoundationList/index.tsx +7 -4
- package/Icon/index.tsx +9 -9
- package/IconButton/index.tsx +12 -10
- package/Image/index.tsx +9 -2
- package/Input/Input.tsx +3 -5
- package/Input/InputDropDown.tsx +31 -23
- package/Input/InputMoney.tsx +3 -5
- package/Input/InputOTP.tsx +7 -7
- package/Input/InputPhoneNumber.tsx +271 -0
- package/Input/InputSearch.tsx +3 -5
- package/Input/InputTextArea.tsx +2 -1
- package/Input/TextTyping.tsx +8 -2
- package/Input/common.tsx +31 -24
- package/Input/index.tsx +21 -1
- package/Input/styles.ts +17 -12
- package/Input/utils.ts +42 -1
- package/Layout/Card.tsx +4 -3
- package/Layout/FloatingButton.tsx +1 -1
- package/Layout/GridSystem.tsx +15 -14
- package/Layout/Item.tsx +1 -1
- package/Layout/Screen.tsx +8 -5
- package/Layout/Section.tsx +1 -1
- package/Layout/TrackingScope.tsx +3 -3
- package/Loader/DotLoader.tsx +7 -7
- package/Loader/ProgressBar.tsx +10 -9
- package/Loader/Spinner.tsx +7 -7
- package/Pagination/Dot.tsx +10 -7
- package/Pagination/PaginationDot.tsx +8 -8
- package/Pagination/PaginationScroll.tsx +12 -10
- package/Popup/PopupNotify.tsx +2 -2
- package/Popup/PopupPromotion.tsx +1 -1
- package/Radio/index.tsx +18 -18
- package/Skeleton/index.tsx +1 -1
- package/Switch/index.tsx +17 -12
- package/Text/index.tsx +4 -4
- package/Text/styles.ts +37 -36
- package/Text/types.ts +1 -0
- package/Text/utils.ts +33 -4
- package/Title/index.tsx +48 -29
- package/index.ts +1 -0
- package/package.json +35 -34
- package/Application/Components/index.ts +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"v":"5.10.2","fr":30,"ip":0,"op":20,"w":100,"h":100,"nm":"Spinner3.1_Refine","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":12,"ty":4,"nm":"loading 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0],"e":[360]},{"t":20}],"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.996078431373,0.956862745098,0.980392156863,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0],"e":[20]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[20],"e":[0]},{"t":20}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[35],"e":[50]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":10,"s":[50],"e":[35]},{"t":20}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":20,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":13,"ty":4,"nm":"loading 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":2,"s":[0],"e":[360]},{"t":20}],"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.98431372549,0.835294117647,0.917647058824,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":2,"s":[0],"e":[20]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":12,"s":[20],"e":[0]},{"t":20}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":2,"s":[35],"e":[50]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"t":12,"s":[50],"e":[35]},{"t":20}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":20,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":14,"ty":4,"nm":"base pink 2","sr":1,"ks":{"o":{"a":0,"k":40,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.996078431373,0.972549019608,0.988235294118,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":20,"st":0,"ct":1,"bm":0}],"markers":[]}
|
package/Badge/Badge.tsx
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {View} from 'react-native';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useComponentId } from '../Application';
|
|
5
|
+
import { ApplicationContext } from '../Context';
|
|
6
|
+
import { BadgeProps } from './types';
|
|
6
7
|
import styles from './styles';
|
|
7
|
-
import {Colors} from '../Consts';
|
|
8
|
-
import {Text} from '../Text';
|
|
8
|
+
import { Colors } from '../Consts';
|
|
9
|
+
import { Text } from '../Text';
|
|
9
10
|
|
|
10
11
|
const Badge: FC<BadgeProps> = ({
|
|
11
12
|
label = 'Label',
|
|
@@ -13,8 +14,8 @@ const Badge: FC<BadgeProps> = ({
|
|
|
13
14
|
backgroundColor,
|
|
14
15
|
accessibilityLabel,
|
|
15
16
|
}) => {
|
|
16
|
-
const {theme} = useContext(ApplicationContext);
|
|
17
|
-
const {componentId} = useComponentId('Badge', accessibilityLabel);
|
|
17
|
+
const { theme } = useContext(ApplicationContext);
|
|
18
|
+
const { componentId } = useComponentId('Badge', accessibilityLabel);
|
|
18
19
|
|
|
19
20
|
const isValidatedColor = () => {
|
|
20
21
|
const colorKeys = Object.keys(Colors);
|
|
@@ -53,12 +54,14 @@ const Badge: FC<BadgeProps> = ({
|
|
|
53
54
|
return (
|
|
54
55
|
<View style={[style, styles.badgeContainer]}>
|
|
55
56
|
<View
|
|
56
|
-
style={[styles.badge, {backgroundColor: badgeColor}]}
|
|
57
|
-
accessibilityLabel={componentId}
|
|
57
|
+
style={[styles.badge, { backgroundColor: badgeColor }]}
|
|
58
|
+
accessibilityLabel={componentId}
|
|
59
|
+
>
|
|
58
60
|
<Text
|
|
59
61
|
color={Colors.black_01}
|
|
60
62
|
typography={'action_xxs_bold'}
|
|
61
|
-
accessibilityLabel={`${componentId}|text`}
|
|
63
|
+
accessibilityLabel={`${componentId}|text`}
|
|
64
|
+
>
|
|
62
65
|
{formatTitle()}
|
|
63
66
|
</Text>
|
|
64
67
|
</View>
|
package/Badge/BadgeRibbon.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { View } from 'react-native';
|
|
|
3
3
|
import { DownTail, UpTail } from './Shape';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import { BadgeRibbonProps } from './types';
|
|
6
|
-
import { ApplicationContext } from '../
|
|
6
|
+
import { ApplicationContext } from '../Context';
|
|
7
7
|
import { Text } from '../Text';
|
|
8
8
|
import { Colors } from '../Consts';
|
|
9
9
|
import { Image } from '../Image';
|
package/Button/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
1
|
+
import React, { FC, useContext, useRef } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Animated,
|
|
4
4
|
StyleSheet,
|
|
@@ -7,19 +7,19 @@ import {
|
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import LinearGradient from 'react-native-linear-gradient';
|
|
10
|
+
import { useComponentId } from '../Application';
|
|
10
11
|
import {
|
|
11
12
|
ApplicationContext,
|
|
12
13
|
ComponentContext,
|
|
13
14
|
SkeletonContext,
|
|
14
|
-
|
|
15
|
-
} from '../
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {Colors, Spacing} from '../Consts';
|
|
15
|
+
} from '../Context';
|
|
16
|
+
import { Text } from '../Text';
|
|
17
|
+
import { Typography } from '../Text/types';
|
|
18
|
+
import { Colors, Spacing } from '../Consts';
|
|
19
19
|
import styles from './styles';
|
|
20
|
-
import {Icon} from '../Icon';
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
20
|
+
import { Icon } from '../Icon';
|
|
21
|
+
import { Skeleton } from '../Skeleton';
|
|
22
|
+
import LottieView from 'lottie-react-native';
|
|
23
23
|
|
|
24
24
|
const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
|
|
25
25
|
|
|
@@ -95,27 +95,29 @@ const Button: FC<ButtonProps> = ({
|
|
|
95
95
|
accessibilityState,
|
|
96
96
|
...rest
|
|
97
97
|
}) => {
|
|
98
|
-
const {theme, config} = useContext(ApplicationContext);
|
|
98
|
+
const { theme, config } = useContext(ApplicationContext);
|
|
99
99
|
const skeleton = useContext(SkeletonContext);
|
|
100
100
|
const componentName = 'Button';
|
|
101
|
+
const animationRef = useRef<LottieView>(null);
|
|
101
102
|
|
|
102
|
-
const {componentId} = useComponentId(
|
|
103
|
+
const { componentId } = useComponentId(
|
|
103
104
|
`${componentName}/${title}`,
|
|
104
105
|
rest.accessibilityLabel,
|
|
105
106
|
);
|
|
106
|
-
const {gradient, color} = config?.navigationBar?.buttonColors ?? {};
|
|
107
|
+
const { gradient, color } = config?.navigationBar?.buttonColors ?? {};
|
|
107
108
|
let gradientPros;
|
|
109
|
+
const isDisabled = type === 'disabled' || loading;
|
|
108
110
|
|
|
109
111
|
if (gradient?.length > 0 && type === 'primary') {
|
|
110
112
|
gradientPros = {
|
|
111
113
|
colors: gradient,
|
|
112
|
-
start: {x: 1, y: 0.5},
|
|
113
|
-
end: {x: 0, y: 0.5},
|
|
114
|
+
start: { x: 1, y: 0.5 },
|
|
115
|
+
end: { x: 0, y: 0.5 },
|
|
114
116
|
};
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
const getSizeStyle = () => {
|
|
118
|
-
const styleSheet: {[key: string]: any} = styles;
|
|
120
|
+
const styleSheet: { [key: string]: any } = styles;
|
|
119
121
|
return styleSheet[size ?? 'small'];
|
|
120
122
|
};
|
|
121
123
|
|
|
@@ -126,7 +128,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
126
128
|
backgroundColor: theme.colors.background.disable,
|
|
127
129
|
};
|
|
128
130
|
case 'primary':
|
|
129
|
-
return {backgroundColor: theme.colors.primary};
|
|
131
|
+
return { backgroundColor: theme.colors.primary };
|
|
130
132
|
case 'secondary':
|
|
131
133
|
return {
|
|
132
134
|
backgroundColor: theme.colors.background.surface,
|
|
@@ -150,7 +152,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
150
152
|
case 'text':
|
|
151
153
|
return {};
|
|
152
154
|
default:
|
|
153
|
-
return {backgroundColor: theme.colors.primary};
|
|
155
|
+
return { backgroundColor: theme.colors.primary };
|
|
154
156
|
}
|
|
155
157
|
};
|
|
156
158
|
|
|
@@ -247,7 +249,16 @@ const Button: FC<ButtonProps> = ({
|
|
|
247
249
|
|
|
248
250
|
if (loading) {
|
|
249
251
|
return (
|
|
250
|
-
<
|
|
252
|
+
<LottieView
|
|
253
|
+
ref={animationRef}
|
|
254
|
+
source={require('../Assets/lottie_circle_loader.json')}
|
|
255
|
+
autoPlay
|
|
256
|
+
loop
|
|
257
|
+
colorFilters={[
|
|
258
|
+
{ keypath: 'loading 2.Ellipse 1.Stroke 1', color: textColor },
|
|
259
|
+
{ keypath: 'loading 3.Ellipse 1.Stroke 1', color: textColor },
|
|
260
|
+
{ keypath: 'base pink 2.Ellipse 1.Stroke 1', color: textColor },
|
|
261
|
+
]}
|
|
251
262
|
style={[
|
|
252
263
|
styles.trailing,
|
|
253
264
|
{
|
|
@@ -256,9 +267,8 @@ const Button: FC<ButtonProps> = ({
|
|
|
256
267
|
marginRight,
|
|
257
268
|
borderRadius: Spacing.M,
|
|
258
269
|
},
|
|
259
|
-
]}
|
|
260
|
-
|
|
261
|
-
</View>
|
|
270
|
+
]}
|
|
271
|
+
/>
|
|
262
272
|
);
|
|
263
273
|
}
|
|
264
274
|
if (iconLeft) {
|
|
@@ -266,8 +276,9 @@ const Button: FC<ButtonProps> = ({
|
|
|
266
276
|
<View
|
|
267
277
|
style={[
|
|
268
278
|
styles.leading,
|
|
269
|
-
{width: iconSize, height: iconSize, marginRight},
|
|
270
|
-
]}
|
|
279
|
+
{ width: iconSize, height: iconSize, marginRight },
|
|
280
|
+
]}
|
|
281
|
+
>
|
|
271
282
|
<Icon color={textColor} source={iconLeft} size={iconSize} />
|
|
272
283
|
</View>
|
|
273
284
|
);
|
|
@@ -287,8 +298,9 @@ const Button: FC<ButtonProps> = ({
|
|
|
287
298
|
<View
|
|
288
299
|
style={[
|
|
289
300
|
styles.trailing,
|
|
290
|
-
{width: iconSize, height: iconSize, marginLeft},
|
|
291
|
-
]}
|
|
301
|
+
{ width: iconSize, height: iconSize, marginLeft },
|
|
302
|
+
]}
|
|
303
|
+
>
|
|
292
304
|
<Icon color={textColor} source={iconRight} size={iconSize} />
|
|
293
305
|
</View>
|
|
294
306
|
);
|
|
@@ -298,11 +310,12 @@ const Button: FC<ButtonProps> = ({
|
|
|
298
310
|
const buttonStyle = StyleSheet.flatten([
|
|
299
311
|
getSizeStyle(),
|
|
300
312
|
getTypeStyle(),
|
|
301
|
-
full && {width: '100%'},
|
|
313
|
+
full && { width: '100%' },
|
|
314
|
+
loading && { opacity: 0.75 },
|
|
302
315
|
]);
|
|
303
316
|
|
|
304
317
|
if (skeleton?.loading) {
|
|
305
|
-
return <Skeleton style={[buttonStyle, {paddingHorizontal: 0}]} />;
|
|
318
|
+
return <Skeleton style={[buttonStyle, { paddingHorizontal: 0 }]} />;
|
|
306
319
|
}
|
|
307
320
|
|
|
308
321
|
return (
|
|
@@ -312,19 +325,21 @@ const Button: FC<ButtonProps> = ({
|
|
|
312
325
|
componentId,
|
|
313
326
|
params,
|
|
314
327
|
action: 'click',
|
|
315
|
-
}}
|
|
328
|
+
}}
|
|
329
|
+
>
|
|
316
330
|
<TouchableOpacity
|
|
317
331
|
{...rest}
|
|
318
332
|
accessibilityLabel={componentId}
|
|
319
333
|
accessibilityRole="button"
|
|
320
334
|
accessibilityState={{
|
|
321
|
-
disabled:
|
|
335
|
+
disabled: isDisabled,
|
|
322
336
|
busy: loading,
|
|
323
337
|
...accessibilityState,
|
|
324
338
|
}}
|
|
325
|
-
disabled={
|
|
339
|
+
disabled={isDisabled}
|
|
326
340
|
activeOpacity={0.5}
|
|
327
|
-
style={buttonStyle}
|
|
341
|
+
style={buttonStyle}
|
|
342
|
+
>
|
|
328
343
|
{renderLeading()}
|
|
329
344
|
{renderTitle()}
|
|
330
345
|
{renderTrailing()}
|
|
@@ -337,4 +352,4 @@ const Button: FC<ButtonProps> = ({
|
|
|
337
352
|
);
|
|
338
353
|
};
|
|
339
354
|
|
|
340
|
-
export {Button};
|
|
355
|
+
export { Button };
|
package/CheckBox/index.tsx
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import React, {FC, useContext} from 'react';
|
|
2
|
-
import {TouchableOpacity, View} from 'react-native';
|
|
3
|
-
import {CheckBoxProps} from './types';
|
|
1
|
+
import React, { FC, useContext } from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { CheckBoxProps } from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from '../Application';
|
|
10
|
-
import {Text} from '../Text';
|
|
11
|
-
import {Icon} from '../Icon';
|
|
5
|
+
import { useComponentId } from '../Application';
|
|
6
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
7
|
+
import { Text } from '../Text';
|
|
8
|
+
import { Icon } from '../Icon';
|
|
12
9
|
|
|
13
10
|
const CheckBox: FC<CheckBoxProps> = ({
|
|
14
11
|
value,
|
|
@@ -21,15 +18,15 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
21
18
|
accessibilityState,
|
|
22
19
|
...props
|
|
23
20
|
}) => {
|
|
24
|
-
const {theme} = useContext(ApplicationContext);
|
|
21
|
+
const { theme } = useContext(ApplicationContext);
|
|
25
22
|
const haveValue = value || indeterminate;
|
|
26
23
|
const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
|
|
27
24
|
let borderColor = theme.colors.text.default;
|
|
28
25
|
let backgroundColor = 'transparent';
|
|
29
26
|
const componentName = 'CheckBox';
|
|
30
|
-
const {componentId} = useComponentId(
|
|
27
|
+
const { componentId } = useComponentId(
|
|
31
28
|
`${componentName}${label ? `/${label}` : ''}`,
|
|
32
|
-
props.accessibilityLabel
|
|
29
|
+
props.accessibilityLabel,
|
|
33
30
|
);
|
|
34
31
|
|
|
35
32
|
if (haveValue) {
|
|
@@ -54,7 +51,8 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
54
51
|
params,
|
|
55
52
|
state: disabled ? 'disabled' : 'filled',
|
|
56
53
|
action: 'click',
|
|
57
|
-
}}
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
58
56
|
<TouchableOpacity
|
|
59
57
|
{...props}
|
|
60
58
|
accessibilityLabel={componentId}
|
|
@@ -66,12 +64,14 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
66
64
|
disabled,
|
|
67
65
|
...accessibilityState,
|
|
68
66
|
}}
|
|
69
|
-
style={[style, styles.container]}
|
|
67
|
+
style={[style, styles.container]}
|
|
68
|
+
>
|
|
70
69
|
<View
|
|
71
70
|
style={[
|
|
72
|
-
{borderColor, backgroundColor, borderWidth: 1},
|
|
71
|
+
{ borderColor, backgroundColor, borderWidth: 1 },
|
|
73
72
|
styles.checkbox,
|
|
74
|
-
]}
|
|
73
|
+
]}
|
|
74
|
+
>
|
|
75
75
|
{haveValue && (
|
|
76
76
|
<Icon
|
|
77
77
|
color={theme.colors.background.surface}
|
|
@@ -80,10 +80,14 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
80
80
|
/>
|
|
81
81
|
)}
|
|
82
82
|
</View>
|
|
83
|
-
{!!label &&
|
|
83
|
+
{!!label && (
|
|
84
|
+
<Text typography={'body_default_regular'} style={styles.label}>
|
|
85
|
+
{label}
|
|
86
|
+
</Text>
|
|
87
|
+
)}
|
|
84
88
|
</TouchableOpacity>
|
|
85
89
|
</ComponentContext.Provider>
|
|
86
90
|
);
|
|
87
91
|
};
|
|
88
92
|
|
|
89
|
-
export {CheckBox};
|
|
93
|
+
export { CheckBox };
|
package/CheckBox/styles.ts
CHANGED
package/Context/index.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { createContext } from 'react';
|
|
3
|
+
import { defaultContext } from '../Consts';
|
|
4
|
+
|
|
5
|
+
const Context = createContext({});
|
|
6
|
+
const ApplicationContext = createContext(defaultContext);
|
|
7
|
+
|
|
8
|
+
const MiniAppContext = (Platform as any).MiniAppContext ?? Context;
|
|
9
|
+
const ScreenContext = (Platform as any).ScreenContext ?? Context;
|
|
10
|
+
const ComponentContext = (Platform as any).ComponentContext ?? Context;
|
|
11
|
+
const SkeletonContext = createContext({ loading: false });
|
|
12
|
+
const TrackingScopeContext = createContext<{ scopeName?: string }>({
|
|
13
|
+
scopeName: undefined,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ApplicationContext,
|
|
18
|
+
MiniAppContext,
|
|
19
|
+
ScreenContext,
|
|
20
|
+
ComponentContext,
|
|
21
|
+
SkeletonContext,
|
|
22
|
+
TrackingScopeContext,
|
|
23
|
+
};
|
package/Divider/DashDivider.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {View, ViewStyle} from 'react-native';
|
|
3
|
-
import {ApplicationContext} from '../
|
|
4
|
-
import {Spacing} from '../Consts';
|
|
5
|
-
import Svg, {Line} from 'react-native-svg';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { View, ViewStyle } from 'react-native';
|
|
3
|
+
import { ApplicationContext } from '../Context';
|
|
4
|
+
import { Spacing } from '../Consts';
|
|
5
|
+
import Svg, { Line } from 'react-native-svg';
|
|
6
6
|
|
|
7
7
|
export interface DashDividerProps {
|
|
8
8
|
/**
|
|
@@ -11,8 +11,8 @@ export interface DashDividerProps {
|
|
|
11
11
|
style?: ViewStyle;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const DashDivider: React.FC<DashDividerProps> = ({style}) => {
|
|
15
|
-
const {theme} = useContext(ApplicationContext);
|
|
14
|
+
const DashDivider: React.FC<DashDividerProps> = ({ style }) => {
|
|
15
|
+
const { theme } = useContext(ApplicationContext);
|
|
16
16
|
const borderColor = theme.colors.border.default;
|
|
17
17
|
|
|
18
18
|
return (
|
|
@@ -24,7 +24,8 @@ const DashDivider: React.FC<DashDividerProps> = ({style}) => {
|
|
|
24
24
|
marginVertical: Spacing.XS,
|
|
25
25
|
},
|
|
26
26
|
style,
|
|
27
|
-
]}
|
|
27
|
+
]}
|
|
28
|
+
>
|
|
28
29
|
<Svg height="1" width="100%">
|
|
29
30
|
<Line
|
|
30
31
|
x1="0"
|
|
@@ -42,4 +43,4 @@ const DashDivider: React.FC<DashDividerProps> = ({style}) => {
|
|
|
42
43
|
);
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
export {DashDivider};
|
|
46
|
+
export { DashDivider };
|
package/Divider/index.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {View, ViewStyle} from 'react-native';
|
|
3
|
-
import {ApplicationContext} from '../
|
|
4
|
-
import {Spacing} from '../Consts';
|
|
5
|
-
import {DashDivider} from './DashDivider';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { View, ViewStyle } from 'react-native';
|
|
3
|
+
import { ApplicationContext } from '../Context';
|
|
4
|
+
import { Spacing } from '../Consts';
|
|
5
|
+
import { DashDivider } from './DashDivider';
|
|
6
6
|
|
|
7
7
|
export interface DividerProps {
|
|
8
8
|
/**
|
|
@@ -23,7 +23,7 @@ const Divider: React.FC<DividerProps> = ({
|
|
|
23
23
|
useMargin = true,
|
|
24
24
|
type = 'default',
|
|
25
25
|
}) => {
|
|
26
|
-
const {theme} = useContext(ApplicationContext);
|
|
26
|
+
const { theme } = useContext(ApplicationContext);
|
|
27
27
|
|
|
28
28
|
if (type === 'dash') return <DashDivider style={style} />;
|
|
29
29
|
|
|
@@ -42,4 +42,4 @@ const Divider: React.FC<DividerProps> = ({
|
|
|
42
42
|
);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
export {Divider};
|
|
45
|
+
export { Divider };
|
package/FoundationList/index.tsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { FlashList } from '@shopify/flash-list';
|
|
3
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FlashList, FlashListProps } from '@shopify/flash-list';
|
|
3
|
+
import { FlatListProps } from 'react-native';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type CombinedListProps<ItemT> = FlatListProps<ItemT> &
|
|
6
|
+
Partial<FlashListProps<ItemT>>;
|
|
7
|
+
|
|
8
|
+
const FoundationList = <ItemT,>(props: CombinedListProps<ItemT>) => {
|
|
6
9
|
return <FlashList {...props} />;
|
|
7
10
|
};
|
|
8
11
|
|
package/Icon/index.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import IconSources from '../Assets/icon.json';
|
|
3
3
|
import IconBankSources from '../Assets/icon_bank.json';
|
|
4
|
-
import {IconProps} from './types';
|
|
5
|
-
import {ApplicationContext} from '../
|
|
6
|
-
import {Image} from '../Image';
|
|
4
|
+
import { IconProps } from './types';
|
|
5
|
+
import { ApplicationContext } from '../Context';
|
|
6
|
+
import { Image } from '../Image';
|
|
7
7
|
|
|
8
8
|
const Icon: React.FC<IconProps> = ({
|
|
9
9
|
source = 'ic_back',
|
|
@@ -12,17 +12,17 @@ const Icon: React.FC<IconProps> = ({
|
|
|
12
12
|
style = {},
|
|
13
13
|
...props
|
|
14
14
|
}) => {
|
|
15
|
-
const {theme} = useContext(ApplicationContext);
|
|
15
|
+
const { theme } = useContext(ApplicationContext);
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* get icon source maps or remote http
|
|
19
19
|
*/
|
|
20
20
|
const getIconSource = (): any => {
|
|
21
21
|
if (source && !source.includes('http')) {
|
|
22
|
-
let icon: {[key: string]: {uri: string}} = IconSources;
|
|
22
|
+
let icon: { [key: string]: { uri: string } } = IconSources;
|
|
23
23
|
return icon[source] ?? icon.ic_warning;
|
|
24
24
|
}
|
|
25
|
-
return {uri: source};
|
|
25
|
+
return { uri: source };
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const tintColorProps = color !== null && {
|
|
@@ -34,11 +34,11 @@ const Icon: React.FC<IconProps> = ({
|
|
|
34
34
|
{...props}
|
|
35
35
|
loading={false}
|
|
36
36
|
source={getIconSource()}
|
|
37
|
-
style={[style, {width: size, height: size}]}
|
|
37
|
+
style={[style, { width: size, height: size }]}
|
|
38
38
|
resizeMode="contain"
|
|
39
39
|
{...tintColorProps}
|
|
40
40
|
/>
|
|
41
41
|
);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export {Icon, IconSources, IconBankSources};
|
|
44
|
+
export { Icon, IconSources, IconBankSources };
|
package/IconButton/index.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
StyleSheet,
|
|
4
4
|
TouchableOpacity,
|
|
5
5
|
TouchableOpacityProps,
|
|
6
6
|
} from 'react-native';
|
|
7
|
-
import {ApplicationContext, ComponentContext} from '../
|
|
8
|
-
import {Colors} from '../Consts';
|
|
9
|
-
import {Icon} from '../Icon';
|
|
7
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
8
|
+
import { Colors } from '../Consts';
|
|
9
|
+
import { Icon } from '../Icon';
|
|
10
10
|
import styles from './styles';
|
|
11
11
|
|
|
12
12
|
export interface IconButtonProps extends TouchableOpacityProps {
|
|
@@ -39,7 +39,7 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
39
39
|
params,
|
|
40
40
|
...rest
|
|
41
41
|
}) => {
|
|
42
|
-
const {theme} = useContext(ApplicationContext);
|
|
42
|
+
const { theme } = useContext(ApplicationContext);
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* get size icon button
|
|
@@ -61,7 +61,7 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
61
61
|
backgroundColor: theme.colors.background.disable,
|
|
62
62
|
};
|
|
63
63
|
case 'primary':
|
|
64
|
-
return {backgroundColor: theme.colors.primary};
|
|
64
|
+
return { backgroundColor: theme.colors.primary };
|
|
65
65
|
case 'secondary':
|
|
66
66
|
return {
|
|
67
67
|
backgroundColor: theme.colors.background.surface,
|
|
@@ -83,7 +83,7 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
83
83
|
backgroundColor: theme.colors.error.primary,
|
|
84
84
|
};
|
|
85
85
|
default:
|
|
86
|
-
return {backgroundColor: theme.colors.primary};
|
|
86
|
+
return { backgroundColor: theme.colors.primary };
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
|
|
@@ -120,16 +120,18 @@ const IconButton: React.FC<IconButtonProps> = ({
|
|
|
120
120
|
params,
|
|
121
121
|
state: type === 'disabled' ? 'disabled' : 'enabled',
|
|
122
122
|
action: 'click',
|
|
123
|
-
}}
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
124
125
|
<TouchableOpacity
|
|
125
126
|
{...rest}
|
|
126
127
|
disabled={type === 'disabled'}
|
|
127
128
|
activeOpacity={activeOpacity}
|
|
128
|
-
style={buttonStyle}
|
|
129
|
+
style={buttonStyle}
|
|
130
|
+
>
|
|
129
131
|
<Icon size={iconSize} source={icon} color={getIconColor()} />
|
|
130
132
|
</TouchableOpacity>
|
|
131
133
|
</ComponentContext.Provider>
|
|
132
134
|
);
|
|
133
135
|
};
|
|
134
136
|
|
|
135
|
-
export {IconButton};
|
|
137
|
+
export { IconButton };
|
package/Image/index.tsx
CHANGED
|
@@ -6,15 +6,22 @@ import {
|
|
|
6
6
|
ApplicationContext,
|
|
7
7
|
ComponentContext,
|
|
8
8
|
SkeletonContext,
|
|
9
|
-
} from '../
|
|
9
|
+
} from '../Context';
|
|
10
10
|
import { Skeleton } from '../Skeleton';
|
|
11
11
|
import { Icon } from '../Icon';
|
|
12
12
|
import { Styles } from '../Consts';
|
|
13
13
|
import { ImageProps } from './types';
|
|
14
|
-
import { getImageName } from '../Application/utils';
|
|
15
14
|
|
|
16
15
|
type Status = 'success' | 'loading' | 'error';
|
|
17
16
|
|
|
17
|
+
export const getImageName = (source: any): string => {
|
|
18
|
+
const parts = source?.uri?.split?.('/');
|
|
19
|
+
if (parts?.length > 0) {
|
|
20
|
+
return parts?.[parts.length - 1];
|
|
21
|
+
}
|
|
22
|
+
return '';
|
|
23
|
+
};
|
|
24
|
+
|
|
18
25
|
const Image: React.FC<ImageProps> = ({
|
|
19
26
|
style,
|
|
20
27
|
source,
|
package/Input/Input.tsx
CHANGED
|
@@ -12,11 +12,7 @@ import {
|
|
|
12
12
|
TouchableOpacity,
|
|
13
13
|
View,
|
|
14
14
|
} from 'react-native';
|
|
15
|
-
import {
|
|
16
|
-
ApplicationContext,
|
|
17
|
-
ComponentContext,
|
|
18
|
-
useComponentId,
|
|
19
|
-
} from '../Application';
|
|
15
|
+
import { useComponentId } from '../Application';
|
|
20
16
|
import { Icon } from '../Icon';
|
|
21
17
|
import { exportFontFamily } from '../Text';
|
|
22
18
|
import {
|
|
@@ -30,6 +26,7 @@ import { InputProps } from './index';
|
|
|
30
26
|
import styles from './styles';
|
|
31
27
|
import { checkTyping } from './utils';
|
|
32
28
|
import SystemTextInput from './SystemTextInput';
|
|
29
|
+
import { ApplicationContext, ComponentContext } from '../Context';
|
|
33
30
|
|
|
34
31
|
/**
|
|
35
32
|
* Input default component
|
|
@@ -85,6 +82,7 @@ const Input = forwardRef(
|
|
|
85
82
|
|
|
86
83
|
const onClearText = () => {
|
|
87
84
|
inputRef?.current?.clear();
|
|
85
|
+
inputRef.current?.setNativeProps({ text: '' });
|
|
88
86
|
_onChangeText('');
|
|
89
87
|
};
|
|
90
88
|
|