@momo-kits/foundation 0.76.1-beta.1 → 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/Popup/PopupNotify.tsx
CHANGED
|
@@ -1,24 +1,65 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {StyleSheet, TouchableOpacity, View} from 'react-native';
|
|
3
|
-
import {
|
|
1
|
+
import React, {useContext, useEffect, useRef, useState} from 'react';
|
|
2
|
+
import {ScrollView, StyleSheet, TouchableOpacity, View} from 'react-native';
|
|
3
|
+
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
4
|
+
import {Button} from '../Button';
|
|
4
5
|
import {Radius, Spacing, Styles} from '../Consts';
|
|
6
|
+
import {Icon} from '../Icon';
|
|
5
7
|
import {Image} from '../Image';
|
|
6
8
|
import {Text} from '../Text';
|
|
7
|
-
import {
|
|
8
|
-
import {Button} from '../Button';
|
|
9
|
-
import {Icon} from '../Icon';
|
|
9
|
+
import {PopupNotifyProps} from './types';
|
|
10
10
|
|
|
11
11
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
12
|
+
id,
|
|
12
13
|
image,
|
|
13
|
-
title,
|
|
14
|
-
description,
|
|
15
|
-
|
|
14
|
+
title = 'Title',
|
|
15
|
+
description = 'Description',
|
|
16
|
+
error,
|
|
16
17
|
secondary,
|
|
17
18
|
primary,
|
|
18
19
|
buttonDirection = 'row',
|
|
19
20
|
onIconClose,
|
|
20
21
|
}) => {
|
|
21
|
-
const
|
|
22
|
+
const context = useContext<any>(MiniAppContext);
|
|
23
|
+
const {theme, navigator, translate} = useContext(ApplicationContext);
|
|
24
|
+
const [scrollContent, setScrollContent] = useState(false);
|
|
25
|
+
const closeAction = useRef('touch_outside');
|
|
26
|
+
let descriptionStyle = {};
|
|
27
|
+
let Description: any = View;
|
|
28
|
+
if (scrollContent) {
|
|
29
|
+
Description = ScrollView;
|
|
30
|
+
descriptionStyle = {height: 80};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* tracking
|
|
34
|
+
*/
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const routes = navigator?.ref.current?.getRootState()?.routes || [];
|
|
37
|
+
const routesLength = routes.length;
|
|
38
|
+
let screen_name = routes?.[0]?.params?.screen?.name;
|
|
39
|
+
if (routesLength > 1) {
|
|
40
|
+
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
41
|
+
}
|
|
42
|
+
const tracking = {
|
|
43
|
+
appId: context.appId,
|
|
44
|
+
code: context.code,
|
|
45
|
+
screen_name,
|
|
46
|
+
component_type: 'popup',
|
|
47
|
+
component_name: id,
|
|
48
|
+
error_code: error ? error : undefined,
|
|
49
|
+
};
|
|
50
|
+
navigator?.maxApi?.trackEvent?.('service_component_displayed', {
|
|
51
|
+
...tracking,
|
|
52
|
+
trigger_id: '111012100000000000',
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return () => {
|
|
56
|
+
navigator?.maxApi?.trackEvent?.('service_popup_dismissed', {
|
|
57
|
+
...tracking,
|
|
58
|
+
trigger_id: '111154100000000001',
|
|
59
|
+
action_type: closeAction.current,
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
}, []);
|
|
22
63
|
|
|
23
64
|
/**
|
|
24
65
|
* on action popup
|
|
@@ -44,8 +85,10 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
44
85
|
type="text"
|
|
45
86
|
size="medium"
|
|
46
87
|
onPress={() => {
|
|
88
|
+
closeAction.current = 'button_action';
|
|
47
89
|
onAction(secondary?.onPress);
|
|
48
90
|
}}
|
|
91
|
+
accessibilityLabel={'btn_popup_cancel'}
|
|
49
92
|
/>
|
|
50
93
|
</View>
|
|
51
94
|
<View style={styles.buttonSpace} />
|
|
@@ -56,8 +99,10 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
56
99
|
title={primary.title}
|
|
57
100
|
size="medium"
|
|
58
101
|
onPress={() => {
|
|
102
|
+
closeAction.current = 'button_action';
|
|
59
103
|
onAction(primary.onPress);
|
|
60
104
|
}}
|
|
105
|
+
accessibilityLabel={'btn_popup_allow'}
|
|
61
106
|
/>
|
|
62
107
|
</View>
|
|
63
108
|
</View>
|
|
@@ -67,9 +112,11 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
67
112
|
return (
|
|
68
113
|
<View style={Styles.columnCenter}>
|
|
69
114
|
<Button
|
|
115
|
+
accessibilityLabel={'btn_popup_allow'}
|
|
70
116
|
title={primary.title}
|
|
71
117
|
size="medium"
|
|
72
118
|
onPress={() => {
|
|
119
|
+
closeAction.current = 'button_action';
|
|
73
120
|
onAction(primary.onPress);
|
|
74
121
|
}}
|
|
75
122
|
/>
|
|
@@ -77,10 +124,12 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
77
124
|
<>
|
|
78
125
|
<View style={styles.buttonSpace} />
|
|
79
126
|
<Button
|
|
127
|
+
accessibilityLabel={'btn_popup_cancel'}
|
|
80
128
|
title={secondary?.title}
|
|
81
129
|
type="text"
|
|
82
130
|
size="medium"
|
|
83
131
|
onPress={() => {
|
|
132
|
+
closeAction.current = 'button_action';
|
|
84
133
|
onAction(secondary?.onPress);
|
|
85
134
|
}}
|
|
86
135
|
/>
|
|
@@ -109,25 +158,32 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
109
158
|
* build close action
|
|
110
159
|
*/
|
|
111
160
|
const buildCloseIcon = () => {
|
|
112
|
-
|
|
113
|
-
|
|
161
|
+
if (typeof onIconClose === 'function') {
|
|
162
|
+
return (
|
|
114
163
|
<TouchableOpacity
|
|
115
|
-
|
|
116
|
-
style={
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
164
|
+
accessibilityLabel={'ic_popup_close'}
|
|
165
|
+
style={styles.iconCloseContainer}
|
|
166
|
+
onPress={() => {
|
|
167
|
+
closeAction.current = 'icon_close';
|
|
168
|
+
onAction(onIconClose);
|
|
169
|
+
}}>
|
|
170
|
+
<View
|
|
171
|
+
style={[
|
|
172
|
+
styles.iconClose,
|
|
173
|
+
{
|
|
174
|
+
backgroundColor: theme.colors.text.default,
|
|
175
|
+
borderColor: theme.colors.background.surface,
|
|
176
|
+
},
|
|
177
|
+
]}>
|
|
178
|
+
<Icon
|
|
179
|
+
source="navigation_close"
|
|
180
|
+
color={theme.colors.background.surface}
|
|
181
|
+
size={14}
|
|
182
|
+
/>
|
|
183
|
+
</View>
|
|
128
184
|
</TouchableOpacity>
|
|
129
|
-
|
|
130
|
-
|
|
185
|
+
);
|
|
186
|
+
}
|
|
131
187
|
};
|
|
132
188
|
|
|
133
189
|
return (
|
|
@@ -139,21 +195,29 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
139
195
|
]}>
|
|
140
196
|
{!!image && <Image source={{uri: image}} style={styles.image} />}
|
|
141
197
|
<View style={styles.content}>
|
|
142
|
-
<Text typography={'
|
|
198
|
+
<Text typography={'header_default_bold'} numberOfLines={1}>
|
|
143
199
|
{title}
|
|
144
200
|
</Text>
|
|
145
|
-
<
|
|
146
|
-
<Text
|
|
201
|
+
<Description style={[styles.description, descriptionStyle]}>
|
|
202
|
+
<Text
|
|
203
|
+
typography={'body_default_regular'}
|
|
204
|
+
onTextLayout={({nativeEvent: {lines}}) => {
|
|
205
|
+
const enableScroll = lines.length > 3;
|
|
206
|
+
if (enableScroll != scrollContent) {
|
|
207
|
+
setScrollContent(enableScroll);
|
|
208
|
+
}
|
|
209
|
+
}}>
|
|
147
210
|
{description}
|
|
148
211
|
</Text>
|
|
149
|
-
</
|
|
150
|
-
{!!
|
|
212
|
+
</Description>
|
|
213
|
+
{!!error && (
|
|
151
214
|
<View style={styles.information}>
|
|
152
215
|
<Text
|
|
153
|
-
typography={'
|
|
216
|
+
typography={'description_xs_regular'}
|
|
154
217
|
color={theme.colors.text.hint}
|
|
155
218
|
numberOfLines={1}>
|
|
156
|
-
{
|
|
219
|
+
{translate?.('errorCode')}
|
|
220
|
+
{error}
|
|
157
221
|
</Text>
|
|
158
222
|
</View>
|
|
159
223
|
)}
|
|
@@ -173,6 +237,7 @@ const styles = StyleSheet.create({
|
|
|
173
237
|
borderTopLeftRadius: Radius.L,
|
|
174
238
|
borderTopRightRadius: Radius.L,
|
|
175
239
|
aspectRatio: 1.7777,
|
|
240
|
+
overflow: 'hidden',
|
|
176
241
|
},
|
|
177
242
|
content: {padding: Spacing.XL},
|
|
178
243
|
description: {
|
|
@@ -191,8 +256,9 @@ const styles = StyleSheet.create({
|
|
|
191
256
|
},
|
|
192
257
|
iconCloseContainer: {
|
|
193
258
|
position: 'absolute',
|
|
194
|
-
top: -Spacing.
|
|
195
|
-
right: -Spacing.
|
|
259
|
+
top: -Spacing.M,
|
|
260
|
+
right: -Spacing.M,
|
|
261
|
+
padding: Spacing.XS,
|
|
196
262
|
},
|
|
197
263
|
iconClose: {
|
|
198
264
|
width: 20,
|
|
@@ -204,12 +270,4 @@ const styles = StyleSheet.create({
|
|
|
204
270
|
},
|
|
205
271
|
});
|
|
206
272
|
|
|
207
|
-
PopupNotify.defaultProps = {
|
|
208
|
-
title: 'Title',
|
|
209
|
-
primary: {
|
|
210
|
-
title: 'Primary',
|
|
211
|
-
onPress: () => {},
|
|
212
|
-
},
|
|
213
|
-
};
|
|
214
|
-
|
|
215
273
|
export default PopupNotify;
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -1,13 +1,49 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
1
|
+
import React, {useContext, useEffect, useRef} from 'react';
|
|
2
2
|
import {StyleSheet, TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {PopupPromotionProps} from './types';
|
|
4
|
-
import {ApplicationContext} from '../Application';
|
|
4
|
+
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
5
5
|
import {Image} from '../Image';
|
|
6
6
|
import {Radius, Spacing} from '../Consts';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
8
|
|
|
9
|
-
const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
9
|
+
const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
10
|
+
id,
|
|
11
|
+
image,
|
|
12
|
+
onIconClose,
|
|
13
|
+
}) => {
|
|
14
|
+
const context = useContext<any>(MiniAppContext);
|
|
10
15
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
16
|
+
const closeAction = useRef('touch_outside');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* tracking
|
|
20
|
+
*/
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const routes = navigator?.ref.current?.getRootState()?.routes || [];
|
|
23
|
+
const routesLength = routes.length;
|
|
24
|
+
let screen_name = routes?.[0]?.params?.screen?.name;
|
|
25
|
+
if (routesLength > 1) {
|
|
26
|
+
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
27
|
+
}
|
|
28
|
+
const tracking = {
|
|
29
|
+
appId: context.appId,
|
|
30
|
+
code: context.code,
|
|
31
|
+
screen_name,
|
|
32
|
+
component_type: 'popup',
|
|
33
|
+
component_name: id,
|
|
34
|
+
};
|
|
35
|
+
navigator?.maxApi?.trackEvent?.('service_component_displayed', {
|
|
36
|
+
...tracking,
|
|
37
|
+
trigger_id: '111012100000000000',
|
|
38
|
+
});
|
|
39
|
+
return () => {
|
|
40
|
+
navigator?.maxApi?.trackEvent?.('service_popup_dismissed', {
|
|
41
|
+
...tracking,
|
|
42
|
+
trigger_id: '111154100000000001',
|
|
43
|
+
action_type: closeAction.current,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
11
47
|
|
|
12
48
|
/**
|
|
13
49
|
* build close action
|
|
@@ -16,22 +52,27 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onClose}) => {
|
|
|
16
52
|
return (
|
|
17
53
|
<View style={styles.iconCloseContainer}>
|
|
18
54
|
<TouchableOpacity
|
|
55
|
+
accessibilityLabel={'ic_popup_close'}
|
|
19
56
|
onPress={() => {
|
|
57
|
+
closeAction.current = 'icon_close';
|
|
20
58
|
navigator?.pop();
|
|
21
|
-
|
|
59
|
+
onIconClose?.();
|
|
22
60
|
}}
|
|
23
|
-
style={
|
|
24
|
-
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
61
|
+
style={styles.iconButton}>
|
|
62
|
+
<View
|
|
63
|
+
style={[
|
|
64
|
+
styles.iconClose,
|
|
65
|
+
{
|
|
66
|
+
backgroundColor: theme.colors.text.default,
|
|
67
|
+
borderColor: theme.colors.background.surface,
|
|
68
|
+
},
|
|
69
|
+
]}>
|
|
70
|
+
<Icon
|
|
71
|
+
source="navigation_close"
|
|
72
|
+
color={theme.colors.background.surface}
|
|
73
|
+
size={14}
|
|
74
|
+
/>
|
|
75
|
+
</View>
|
|
35
76
|
</TouchableOpacity>
|
|
36
77
|
</View>
|
|
37
78
|
);
|
|
@@ -40,10 +81,10 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onClose}) => {
|
|
|
40
81
|
return (
|
|
41
82
|
<View accessibilityLabel={'PopupPromotion'}>
|
|
42
83
|
<Image
|
|
43
|
-
style={styles.container}
|
|
44
84
|
source={{
|
|
45
85
|
uri: image,
|
|
46
86
|
}}
|
|
87
|
+
style={styles.container}
|
|
47
88
|
/>
|
|
48
89
|
{buildCloseIcon()}
|
|
49
90
|
</View>
|
|
@@ -53,12 +94,16 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onClose}) => {
|
|
|
53
94
|
const styles = StyleSheet.create({
|
|
54
95
|
container: {
|
|
55
96
|
aspectRatio: 0.72,
|
|
97
|
+
width: '100%',
|
|
56
98
|
},
|
|
57
99
|
iconCloseContainer: {
|
|
58
100
|
width: '100%',
|
|
59
101
|
flexDirection: 'row',
|
|
60
102
|
justifyContent: 'center',
|
|
61
|
-
marginTop: Spacing.
|
|
103
|
+
marginTop: Spacing.S,
|
|
104
|
+
},
|
|
105
|
+
iconButton: {
|
|
106
|
+
padding: 8,
|
|
62
107
|
},
|
|
63
108
|
iconClose: {
|
|
64
109
|
width: 20,
|
|
@@ -70,8 +115,4 @@ const styles = StyleSheet.create({
|
|
|
70
115
|
},
|
|
71
116
|
});
|
|
72
117
|
|
|
73
|
-
PopupPromotion.defaultProps = {
|
|
74
|
-
image: 'https://google.com',
|
|
75
|
-
};
|
|
76
|
-
|
|
77
118
|
export default PopupPromotion;
|
package/Popup/types.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
1
3
|
export type PopupNotifyProps = {
|
|
4
|
+
/**
|
|
5
|
+
* `id`: Optional. id component_name for tracking component.
|
|
6
|
+
*/
|
|
7
|
+
id?: string;
|
|
2
8
|
/**
|
|
3
9
|
* `image`: Optional. Represents the URL or path of the image to be displayed in the PopupNotify component.
|
|
4
10
|
*/
|
|
@@ -12,12 +18,12 @@ export type PopupNotifyProps = {
|
|
|
12
18
|
/**
|
|
13
19
|
* `description`: Represents the description text to be displayed in the PopupNotify component.
|
|
14
20
|
*/
|
|
15
|
-
description: string;
|
|
21
|
+
description: string | React.ReactNode;
|
|
16
22
|
|
|
17
23
|
/**
|
|
18
|
-
* `
|
|
24
|
+
* `error`: Optional. Represents additional error text to be displayed in the PopupNotify component.
|
|
19
25
|
*/
|
|
20
|
-
|
|
26
|
+
error?: string;
|
|
21
27
|
|
|
22
28
|
/**
|
|
23
29
|
* `secondary`: Optional. Represents the secondary action that can be performed from the PopupNotify component.
|
|
@@ -44,6 +50,11 @@ export type PopupNotifyProps = {
|
|
|
44
50
|
};
|
|
45
51
|
|
|
46
52
|
export type PopupPromotionProps = {
|
|
53
|
+
/**
|
|
54
|
+
* `id`: Optional. id component_name for tracking component.
|
|
55
|
+
*/
|
|
56
|
+
id?: string;
|
|
57
|
+
|
|
47
58
|
/**
|
|
48
59
|
* `image`: Represents the URL or path of the image to be displayed in the PopupPromotion component.
|
|
49
60
|
*/
|
|
@@ -52,7 +63,7 @@ export type PopupPromotionProps = {
|
|
|
52
63
|
/**
|
|
53
64
|
* `onClose`: Optional. A callback function that is called when the PopupPromotion component is closed.
|
|
54
65
|
*/
|
|
55
|
-
|
|
66
|
+
onIconClose?: () => void;
|
|
56
67
|
};
|
|
57
68
|
|
|
58
69
|
type PopupAction = {
|
package/Radio/index.tsx
CHANGED
|
@@ -4,8 +4,9 @@ import {TouchableOpacity, View} from 'react-native';
|
|
|
4
4
|
import {RadioProps} from './types';
|
|
5
5
|
import {Text} from '../Text';
|
|
6
6
|
import styles from './styles';
|
|
7
|
-
import {ApplicationContext} from '../Application';
|
|
7
|
+
import {ApplicationContext, ComponentContext} from '../Application';
|
|
8
8
|
import {Spacing} from '../Consts';
|
|
9
|
+
import {formatNameLength} from '../Application/utils';
|
|
9
10
|
|
|
10
11
|
const Radio: FC<RadioProps> = ({
|
|
11
12
|
value,
|
|
@@ -14,6 +15,8 @@ const Radio: FC<RadioProps> = ({
|
|
|
14
15
|
onChange,
|
|
15
16
|
label,
|
|
16
17
|
style,
|
|
18
|
+
params,
|
|
19
|
+
accessibilityLabel,
|
|
17
20
|
}) => {
|
|
18
21
|
const {theme} = useContext(ApplicationContext);
|
|
19
22
|
const selected = value === groupValue;
|
|
@@ -38,27 +41,38 @@ const Radio: FC<RadioProps> = ({
|
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
<ComponentContext.Provider
|
|
45
|
+
value={{
|
|
46
|
+
componentName: 'Radio',
|
|
47
|
+
params,
|
|
48
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
49
|
+
componentId: accessibilityLabel,
|
|
50
|
+
componentLabel: formatNameLength(label || ''),
|
|
51
|
+
componentValue: selected,
|
|
52
|
+
action: 'click',
|
|
53
|
+
}}>
|
|
54
|
+
<TouchableOpacity
|
|
55
|
+
accessibilityLabel={accessibilityLabel}
|
|
56
|
+
onPress={onChange}
|
|
57
|
+
disabled={disabled}
|
|
53
58
|
style={[
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
style,
|
|
60
|
+
{
|
|
61
|
+
flexDirection: 'row',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
},
|
|
64
|
+
]}>
|
|
65
|
+
<View
|
|
66
|
+
style={[
|
|
67
|
+
styles.radio,
|
|
68
|
+
checkBoxStyle,
|
|
69
|
+
disabledStyle,
|
|
70
|
+
{marginRight: label ? Spacing.XS : 0},
|
|
71
|
+
]}
|
|
72
|
+
/>
|
|
73
|
+
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
74
|
+
</TouchableOpacity>
|
|
75
|
+
</ComponentContext.Provider>
|
|
62
76
|
);
|
|
63
77
|
};
|
|
64
78
|
|
package/Radio/types.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {ViewStyle} from 'react-native';
|
|
1
|
+
import {TouchableOpacityProps, ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface RadioProps extends TouchableOpacityProps {
|
|
4
4
|
/**
|
|
5
5
|
* `value`: Represents the value associated with the Radio component.
|
|
6
6
|
* It is used to determine whether the Radio component is selected or not in comparison with the `groupValue`.
|
|
7
7
|
*/
|
|
8
|
-
value:
|
|
8
|
+
value: any;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* `disabled`: Optional. If `true`, the user won't be able to interact with the Radio component.
|
|
@@ -28,11 +28,13 @@ export type RadioProps = {
|
|
|
28
28
|
* `groupValue`: Represents the value of the selected Radio component within a group of Radio components.
|
|
29
29
|
* The Radio component for which `value` equals `groupValue` will be selected.
|
|
30
30
|
*/
|
|
31
|
-
groupValue:
|
|
31
|
+
groupValue: any;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* `style`: Optional. Used to apply custom styling to the Radio component.
|
|
35
35
|
* Accepts an object of style properties.
|
|
36
36
|
*/
|
|
37
37
|
style?: ViewStyle;
|
|
38
|
-
|
|
38
|
+
|
|
39
|
+
params?: any;
|
|
40
|
+
}
|
package/Skeleton/index.tsx
CHANGED
|
@@ -41,7 +41,7 @@ const Skeleton: React.FC<SkeletonTypes> = ({style}) => {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
return (
|
|
44
|
-
<View style={[styles.container, style]}
|
|
44
|
+
<View style={[styles.container, style]}>
|
|
45
45
|
<View
|
|
46
46
|
onLayout={e => onLayout(e.nativeEvent.layout.width)}
|
|
47
47
|
style={[Styles.flex, {backgroundColor: PRIMARY_COLOR}]}>
|
package/Skeleton/types.ts
CHANGED
package/Switch/index.tsx
CHANGED
|
@@ -1,40 +1,51 @@
|
|
|
1
|
-
import React, {FC
|
|
1
|
+
import React, {FC} from 'react';
|
|
2
2
|
import {TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {SwitchProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {ApplicationContext} from '../Application';
|
|
6
5
|
import {Colors} from '../Consts';
|
|
6
|
+
import {ComponentContext} from '../Application';
|
|
7
7
|
|
|
8
|
-
const Switch: FC<SwitchProps> =
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const Switch: FC<SwitchProps> = ({
|
|
9
|
+
value = false,
|
|
10
|
+
onChange,
|
|
11
|
+
disabled = false,
|
|
12
|
+
style,
|
|
13
|
+
params,
|
|
14
|
+
accessibilityLabel,
|
|
15
|
+
}) => {
|
|
11
16
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
12
17
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
13
18
|
|
|
14
|
-
let backgroundColor = value ?
|
|
19
|
+
let backgroundColor = value ? Colors.green_03 : Colors.black_07;
|
|
15
20
|
if (disabled) {
|
|
16
|
-
backgroundColor = value ?
|
|
21
|
+
backgroundColor = value ? Colors.green_09 : Colors.black_05;
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
return (
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
<ComponentContext.Provider
|
|
26
|
+
value={{
|
|
27
|
+
componentName: 'Switch',
|
|
28
|
+
params,
|
|
29
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
30
|
+
componentId: accessibilityLabel,
|
|
31
|
+
componentValue: value,
|
|
32
|
+
action: 'click',
|
|
33
|
+
}}>
|
|
34
|
+
<TouchableOpacity
|
|
35
|
+
disabled={disabled}
|
|
36
|
+
accessibilityLabel={accessibilityLabel}
|
|
37
|
+
onPress={() => onChange?.(!value)}
|
|
38
|
+
style={[
|
|
39
|
+
style,
|
|
40
|
+
styles.container,
|
|
41
|
+
{backgroundColor, alignItems: circleAlign},
|
|
42
|
+
]}>
|
|
43
|
+
<View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
|
|
44
|
+
<View style={[styles.circleSmall, {backgroundColor}]} />
|
|
45
|
+
</View>
|
|
46
|
+
</TouchableOpacity>
|
|
47
|
+
</ComponentContext.Provider>
|
|
33
48
|
);
|
|
34
49
|
};
|
|
35
50
|
|
|
36
|
-
Switch.defaultProps = {
|
|
37
|
-
value: false,
|
|
38
|
-
disabled: false,
|
|
39
|
-
};
|
|
40
51
|
export {Switch};
|
package/Switch/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 SwitchProps extends TouchableOpacityProps {
|
|
4
4
|
/**
|
|
5
5
|
* `value`: Represents whether the Switch component is currently in the 'on' (`true`) or 'off' (`false`) state.
|
|
6
6
|
*/
|
|
@@ -23,4 +23,6 @@ export type SwitchProps = {
|
|
|
23
23
|
* Accepts an object of style properties.
|
|
24
24
|
*/
|
|
25
25
|
style?: ViewStyle;
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
params?: any;
|
|
28
|
+
}
|
package/Tag/index.tsx
CHANGED
|
@@ -60,9 +60,7 @@ const Tag: FC<TagProps> = ({
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
return (
|
|
63
|
-
<View
|
|
64
|
-
style={[style, sizeStyle, {backgroundColor: tagColor}]}
|
|
65
|
-
accessibilityLabel={`Tag/${label}`}>
|
|
63
|
+
<View style={[style, sizeStyle, {backgroundColor: tagColor}]}>
|
|
66
64
|
{!!icon && (
|
|
67
65
|
<Icon
|
|
68
66
|
style={styles.icon}
|
|
@@ -71,7 +69,7 @@ const Tag: FC<TagProps> = ({
|
|
|
71
69
|
color={labelColor}
|
|
72
70
|
/>
|
|
73
71
|
)}
|
|
74
|
-
<Text color={labelColor} typography={'
|
|
72
|
+
<Text color={labelColor} typography={'label_s_medium'}>
|
|
75
73
|
{label}
|
|
76
74
|
</Text>
|
|
77
75
|
</View>
|