@momo-kits/foundation 0.80.9 → 0.81.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Application/BottomSheet.tsx +212 -0
- package/Application/BottomTab/BottomTabBar.tsx +278 -0
- package/Application/BottomTab/index.tsx +143 -0
- package/Application/Components.tsx +379 -209
- package/Application/ModalScreen.tsx +14 -178
- package/Application/Navigation.ts +15 -19
- package/Application/NavigationContainer.tsx +66 -63
- package/Application/Navigator.ts +106 -53
- package/Application/StackScreen.tsx +123 -9
- package/Application/index.ts +19 -6
- package/Application/types.ts +83 -26
- package/Application/utils.tsx +38 -49
- package/Assets/icon.json +83 -5
- package/Assets/icon_bank.json +506 -0
- package/Assets/language.json +3 -1
- 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 +64 -28
- package/Button/styles.ts +19 -0
- package/CheckBox/index.tsx +37 -27
- package/CheckBox/types.ts +5 -3
- package/Consts/colors+spacing+radius.ts +18 -0
- package/Icon/index.tsx +14 -9
- package/Icon/types.ts +4 -3
- package/IconButton/index.tsx +24 -15
- package/Image/index.tsx +62 -47
- package/Image/styles.ts +1 -9
- package/Image/types.ts +5 -1
- package/Input/Input.tsx +104 -25
- package/Input/InputDropDown.tsx +35 -23
- package/Input/InputMoney.tsx +79 -18
- package/Input/InputOTP.tsx +190 -149
- package/Input/InputSearch.tsx +96 -44
- package/Input/InputTextArea.tsx +33 -17
- package/Input/common.tsx +26 -17
- package/Input/index.tsx +69 -24
- package/Input/styles.ts +5 -7
- package/Input/utils.ts +1 -1
- package/Layout/AnimatedInputSearch.tsx +44 -0
- package/Layout/Card.tsx +37 -13
- package/Layout/FloatingButton.tsx +168 -0
- package/Layout/GridSystem.tsx +2 -3
- package/Layout/Item.tsx +1 -2
- package/Layout/ItemList.tsx +55 -0
- package/Layout/ItemSectionList.tsx +39 -0
- package/Layout/Screen.tsx +404 -181
- package/Layout/Section.tsx +22 -22
- package/Layout/TextTyping.tsx +114 -0
- package/Layout/index.ts +12 -2
- package/Layout/styles.ts +46 -13
- package/Layout/types.ts +13 -5
- package/Layout/utils.ts +7 -12
- package/Loader/index.tsx +2 -0
- package/Pagination/PaginationDot.tsx +6 -1
- package/Pagination/PaginationNumber.tsx +7 -4
- package/Pagination/PaginationScroll.tsx +0 -1
- package/Pagination/PaginationWhiteDot.tsx +6 -1
- package/Pagination/styles.ts +3 -0
- package/Pagination/types.ts +2 -0
- package/Popup/PopupNotify.tsx +108 -40
- package/Popup/PopupPromotion.tsx +45 -10
- package/Popup/types.ts +13 -10
- package/Radio/index.tsx +35 -21
- package/Radio/types.ts +7 -5
- package/Skeleton/index.tsx +1 -1
- package/Switch/index.tsx +32 -19
- package/Switch/types.ts +5 -3
- package/Tag/index.tsx +2 -4
- package/Text/index.tsx +26 -6
- package/Text/styles.ts +38 -0
- package/Text/types.ts +25 -13
- package/Title/index.tsx +177 -63
- package/Title/styles.ts +48 -15
- package/Title/types.ts +16 -47
- package/code-scanner.js +125 -16
- package/index.ts +9 -0
- package/migrate_typo.js +56 -0
- package/package.json +9 -8
- package/publish.sh +21 -16
- package/tsconfig.json +1 -2
- package/verify.js +24 -6
- package/Application/BottomTab.tsx +0 -65
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
14
|
title = 'Title',
|
|
14
15
|
description = 'Description',
|
|
15
|
-
|
|
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
|
/>
|
|
@@ -90,7 +139,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
90
139
|
);
|
|
91
140
|
};
|
|
92
141
|
|
|
93
|
-
if (buttonDirection
|
|
142
|
+
if (buttonDirection === 'auto') {
|
|
94
143
|
if (
|
|
95
144
|
secondary?.title &&
|
|
96
145
|
(secondary.title.length > 12 || primary.title.length > 12)
|
|
@@ -99,7 +148,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
99
148
|
}
|
|
100
149
|
return renderRow();
|
|
101
150
|
}
|
|
102
|
-
if (buttonDirection
|
|
151
|
+
if (buttonDirection === 'row') {
|
|
103
152
|
return renderRow();
|
|
104
153
|
}
|
|
105
154
|
return renderColumn();
|
|
@@ -109,52 +158,70 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
109
158
|
* build close action
|
|
110
159
|
*/
|
|
111
160
|
const buildCloseIcon = () => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
161
|
+
if (typeof onIconClose === 'function') {
|
|
162
|
+
return (
|
|
163
|
+
<TouchableOpacity
|
|
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>
|
|
184
|
+
</TouchableOpacity>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
132
187
|
};
|
|
133
188
|
|
|
134
189
|
return (
|
|
135
190
|
<View
|
|
136
|
-
accessibilityLabel={'
|
|
191
|
+
accessibilityLabel={'popup_notify'}
|
|
137
192
|
style={[
|
|
138
193
|
styles.container,
|
|
139
194
|
{backgroundColor: theme.colors.background.surface},
|
|
140
195
|
]}>
|
|
141
196
|
{!!image && <Image source={{uri: image}} style={styles.image} />}
|
|
142
197
|
<View style={styles.content}>
|
|
143
|
-
<Text typography={'
|
|
198
|
+
<Text typography={'header_default_bold'} numberOfLines={1}>
|
|
144
199
|
{title}
|
|
145
200
|
</Text>
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
201
|
+
<Description style={[styles.description, descriptionStyle]}>
|
|
202
|
+
{typeof description === 'string' ? (
|
|
203
|
+
<Text
|
|
204
|
+
typography={'body_default_regular'}
|
|
205
|
+
onTextLayout={({nativeEvent: {lines}}) => {
|
|
206
|
+
const enableScroll = lines.length > 3;
|
|
207
|
+
if (enableScroll !== scrollContent) {
|
|
208
|
+
setScrollContent(enableScroll);
|
|
209
|
+
}
|
|
210
|
+
}}>
|
|
211
|
+
{description}
|
|
212
|
+
</Text>
|
|
213
|
+
) : (
|
|
214
|
+
description
|
|
215
|
+
)}
|
|
216
|
+
</Description>
|
|
217
|
+
{!!error && (
|
|
152
218
|
<View style={styles.information}>
|
|
153
219
|
<Text
|
|
154
|
-
typography={'
|
|
220
|
+
typography={'description_xs_regular'}
|
|
155
221
|
color={theme.colors.text.hint}
|
|
156
222
|
numberOfLines={1}>
|
|
157
|
-
{
|
|
223
|
+
{translate?.('errorCode')}
|
|
224
|
+
{error}
|
|
158
225
|
</Text>
|
|
159
226
|
</View>
|
|
160
227
|
)}
|
|
@@ -174,6 +241,7 @@ const styles = StyleSheet.create({
|
|
|
174
241
|
borderTopLeftRadius: Radius.L,
|
|
175
242
|
borderTopRightRadius: Radius.L,
|
|
176
243
|
aspectRatio: 1.7777,
|
|
244
|
+
overflow: 'hidden',
|
|
177
245
|
},
|
|
178
246
|
content: {padding: Spacing.XL},
|
|
179
247
|
description: {
|
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,9 +52,11 @@ 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
61
|
style={styles.iconButton}>
|
|
24
62
|
<View
|
|
@@ -41,12 +79,12 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onClose}) => {
|
|
|
41
79
|
};
|
|
42
80
|
|
|
43
81
|
return (
|
|
44
|
-
<View accessibilityLabel={'
|
|
82
|
+
<View accessibilityLabel={'popup_promotion'}>
|
|
45
83
|
<Image
|
|
46
|
-
style={styles.container}
|
|
47
84
|
source={{
|
|
48
85
|
uri: image,
|
|
49
86
|
}}
|
|
87
|
+
style={styles.container}
|
|
50
88
|
/>
|
|
51
89
|
{buildCloseIcon()}
|
|
52
90
|
</View>
|
|
@@ -56,6 +94,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onClose}) => {
|
|
|
56
94
|
const styles = StyleSheet.create({
|
|
57
95
|
container: {
|
|
58
96
|
aspectRatio: 0.72,
|
|
97
|
+
width: '100%',
|
|
59
98
|
},
|
|
60
99
|
iconCloseContainer: {
|
|
61
100
|
width: '100%',
|
|
@@ -76,8 +115,4 @@ const styles = StyleSheet.create({
|
|
|
76
115
|
},
|
|
77
116
|
});
|
|
78
117
|
|
|
79
|
-
PopupPromotion.defaultProps = {
|
|
80
|
-
image: 'https://google.com',
|
|
81
|
-
};
|
|
82
|
-
|
|
83
118
|
export default PopupPromotion;
|
package/Popup/types.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {TextStyle} from 'react-native';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
|
|
4
3
|
export type PopupNotifyProps = {
|
|
4
|
+
/**
|
|
5
|
+
* `id`: Optional. id component_name for tracking component.
|
|
6
|
+
*/
|
|
7
|
+
id?: string;
|
|
5
8
|
/**
|
|
6
9
|
* `image`: Optional. Represents the URL or path of the image to be displayed in the PopupNotify component.
|
|
7
10
|
*/
|
|
@@ -15,12 +18,12 @@ export type PopupNotifyProps = {
|
|
|
15
18
|
/**
|
|
16
19
|
* `description`: Represents the description text to be displayed in the PopupNotify component.
|
|
17
20
|
*/
|
|
18
|
-
description
|
|
21
|
+
description?: string | React.ReactNode;
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
|
-
* `
|
|
24
|
+
* `error`: Optional. Represents additional error text to be displayed in the PopupNotify component.
|
|
22
25
|
*/
|
|
23
|
-
|
|
26
|
+
error?: string;
|
|
24
27
|
|
|
25
28
|
/**
|
|
26
29
|
* `secondary`: Optional. Represents the secondary action that can be performed from the PopupNotify component.
|
|
@@ -47,6 +50,11 @@ export type PopupNotifyProps = {
|
|
|
47
50
|
};
|
|
48
51
|
|
|
49
52
|
export type PopupPromotionProps = {
|
|
53
|
+
/**
|
|
54
|
+
* `id`: Optional. id component_name for tracking component.
|
|
55
|
+
*/
|
|
56
|
+
id?: string;
|
|
57
|
+
|
|
50
58
|
/**
|
|
51
59
|
* `image`: Represents the URL or path of the image to be displayed in the PopupPromotion component.
|
|
52
60
|
*/
|
|
@@ -55,7 +63,7 @@ export type PopupPromotionProps = {
|
|
|
55
63
|
/**
|
|
56
64
|
* `onClose`: Optional. A callback function that is called when the PopupPromotion component is closed.
|
|
57
65
|
*/
|
|
58
|
-
|
|
66
|
+
onIconClose?: () => void;
|
|
59
67
|
};
|
|
60
68
|
|
|
61
69
|
type PopupAction = {
|
|
@@ -70,9 +78,4 @@ type PopupAction = {
|
|
|
70
78
|
onPress: () => void;
|
|
71
79
|
};
|
|
72
80
|
|
|
73
|
-
export type HighlightText = {
|
|
74
|
-
text: string;
|
|
75
|
-
style: TextStyle;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
81
|
type PopupActionDirection = 'row' | 'column' | 'auto';
|
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/Switch/index.tsx
CHANGED
|
@@ -3,9 +3,16 @@ import {TouchableOpacity, View} from 'react-native';
|
|
|
3
3
|
import {SwitchProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import {Colors} from '../Consts';
|
|
6
|
+
import {ComponentContext} from '../Application';
|
|
6
7
|
|
|
7
|
-
const Switch: FC<SwitchProps> =
|
|
8
|
-
|
|
8
|
+
const Switch: FC<SwitchProps> = ({
|
|
9
|
+
value = false,
|
|
10
|
+
onChange,
|
|
11
|
+
disabled = false,
|
|
12
|
+
style,
|
|
13
|
+
params,
|
|
14
|
+
accessibilityLabel,
|
|
15
|
+
}) => {
|
|
9
16
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
10
17
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
11
18
|
|
|
@@ -15,24 +22,30 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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>
|
|
31
48
|
);
|
|
32
49
|
};
|
|
33
50
|
|
|
34
|
-
Switch.defaultProps = {
|
|
35
|
-
value: false,
|
|
36
|
-
disabled: false,
|
|
37
|
-
};
|
|
38
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>
|
package/Text/index.tsx
CHANGED
|
@@ -51,8 +51,24 @@ export interface TextProps extends RNTextProps {
|
|
|
51
51
|
*/
|
|
52
52
|
color?: string;
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
const deprecatedValues: Typography[] = [
|
|
56
|
+
'headline_default',
|
|
57
|
+
'headline_l',
|
|
58
|
+
'headline_xl',
|
|
59
|
+
'title_default',
|
|
60
|
+
'title_xs',
|
|
61
|
+
'title_s',
|
|
62
|
+
'header_default',
|
|
63
|
+
'paragraph_default',
|
|
64
|
+
'paragraph_bold',
|
|
65
|
+
'paragraph_italic',
|
|
66
|
+
'label_xxs',
|
|
67
|
+
'action_s',
|
|
68
|
+
];
|
|
69
|
+
|
|
54
70
|
const Text: React.FC<TextProps> = ({
|
|
55
|
-
typography,
|
|
71
|
+
typography = 'body_default_regular',
|
|
56
72
|
color,
|
|
57
73
|
children,
|
|
58
74
|
style,
|
|
@@ -84,26 +100,30 @@ const Text: React.FC<TextProps> = ({
|
|
|
84
100
|
}
|
|
85
101
|
|
|
86
102
|
return {
|
|
103
|
+
...typoStyle,
|
|
87
104
|
fontFamily,
|
|
88
105
|
fontSize: scaleSize(fontSize),
|
|
89
106
|
lineHeight: scaleSize(lineHeight),
|
|
90
107
|
fontStyle,
|
|
108
|
+
fontWeight,
|
|
91
109
|
};
|
|
92
110
|
};
|
|
93
111
|
|
|
94
112
|
const textStyle = getTypoStyle(typography);
|
|
113
|
+
|
|
114
|
+
if (deprecatedValues.includes(typography)) {
|
|
115
|
+
console.warn(
|
|
116
|
+
`Warning: The typography value "${typography}" is deprecated.`,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
95
120
|
return (
|
|
96
121
|
<RNText
|
|
97
122
|
{...rest}
|
|
98
|
-
accessibilityLabel={`Text/${children}`}
|
|
99
123
|
style={[style, textStyle, {color: color ?? theme.colors.text.default}]}>
|
|
100
124
|
{children ?? ''}
|
|
101
125
|
</RNText>
|
|
102
126
|
);
|
|
103
127
|
};
|
|
104
128
|
|
|
105
|
-
Text.defaultProps = {
|
|
106
|
-
typography: 'paragraph_default',
|
|
107
|
-
};
|
|
108
|
-
|
|
109
129
|
export {Text, scaleSize};
|