@momo-kits/foundation 0.81.51-beta.0 → 0.81.52
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/index.tsx → BottomTab.tsx} +18 -42
- package/Application/Components.tsx +91 -356
- package/Application/ModalScreen.tsx +185 -14
- package/Application/Navigation.ts +19 -5
- package/Application/NavigationContainer.tsx +72 -62
- package/Application/Navigator.ts +48 -154
- package/Application/StackScreen.tsx +32 -289
- package/Application/index.ts +15 -13
- package/Application/types.ts +35 -81
- package/Application/utils.tsx +30 -76
- package/Assets/icon_bank.json +1 -1
- package/Badge/Badge.tsx +1 -1
- package/Badge/index.tsx +1 -2
- package/Badge/styles.ts +6 -50
- package/Button/index.tsx +26 -44
- package/CheckBox/index.tsx +26 -37
- package/CheckBox/types.ts +3 -5
- package/Consts/colors+spacing+radius.ts +0 -14
- package/Icon/index.tsx +8 -9
- package/Icon/types.ts +2 -2
- package/IconButton/index.tsx +14 -24
- package/Image/index.tsx +8 -23
- package/Image/types.ts +0 -2
- package/Input/Input.tsx +26 -116
- package/Input/InputDropDown.tsx +51 -66
- package/Input/InputMoney.tsx +15 -106
- package/Input/InputOTP.tsx +26 -49
- package/Input/InputSearch.tsx +99 -252
- package/Input/InputTextArea.tsx +6 -26
- package/Input/common.tsx +22 -48
- package/Input/index.tsx +77 -112
- package/Input/styles.ts +11 -48
- package/Input/utils.ts +1 -1
- package/Layout/Card.tsx +3 -4
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/ItemList.tsx +2 -3
- package/Layout/Screen.tsx +121 -242
- package/Layout/Section.tsx +3 -4
- package/Layout/styles.ts +13 -11
- package/Layout/types.ts +1 -1
- package/Layout/utils.ts +4 -4
- package/Loader/index.tsx +0 -2
- package/Pagination/PaginationScroll.tsx +2 -2
- package/Pagination/styles.ts +1 -1
- package/Popup/PopupNotify.tsx +46 -57
- package/Popup/PopupPromotion.tsx +8 -6
- package/Popup/types.ts +7 -1
- package/Radio/index.tsx +20 -35
- package/Radio/types.ts +3 -5
- package/Switch/index.tsx +18 -32
- package/Switch/types.ts +3 -5
- package/Tag/index.tsx +2 -9
- package/Tag/styles.ts +2 -3
- package/Tag/types.ts +0 -12
- package/Text/index.tsx +5 -24
- package/Text/styles.ts +8 -8
- package/Title/index.tsx +103 -170
- package/Title/styles.ts +9 -36
- package/Title/types.ts +48 -16
- package/code-scanner.js +16 -125
- package/index.ts +0 -7
- package/package.json +7 -8
- package/publish.sh +21 -16
- package/tsconfig.json +1 -1
- package/Application/BottomSheet.tsx +0 -216
- package/Application/BottomTab/BottomTabBar.tsx +0 -278
- package/Application/Localize.ts +0 -44
- package/Application/constants.ts +0 -9
- package/Badge/BadgeDotAnimation.tsx +0 -95
- package/Input/TextTyping.tsx +0 -113
- package/Layout/FloatingButton.tsx +0 -168
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, {useContext, useEffect, useRef, useState} from 'react';
|
|
2
2
|
import {ScrollView, StyleSheet, TouchableOpacity, View} from 'react-native';
|
|
3
|
+
import {PopupNotifyProps} from './types';
|
|
4
|
+
import {Radius, Spacing, Styles} from '../Consts';
|
|
5
|
+
import {Image} from '../Image';
|
|
6
|
+
import {Text} from '../Text';
|
|
3
7
|
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
4
8
|
import {Button} from '../Button';
|
|
5
|
-
import {Radius, Spacing, Styles} from '../Consts';
|
|
6
9
|
import {Icon} from '../Icon';
|
|
7
|
-
import {Image} from '../Image';
|
|
8
|
-
import {scaleSize, Text} from '../Text';
|
|
9
|
-
import {PopupNotifyProps} from './types';
|
|
10
10
|
|
|
11
11
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
12
12
|
id,
|
|
@@ -19,29 +19,30 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
19
19
|
buttonDirection = 'row',
|
|
20
20
|
onIconClose,
|
|
21
21
|
}) => {
|
|
22
|
-
const context = useContext
|
|
22
|
+
const context = useContext(MiniAppContext);
|
|
23
23
|
const {theme, navigator, translate} = useContext(ApplicationContext);
|
|
24
24
|
const [scrollContent, setScrollContent] = useState(false);
|
|
25
25
|
const closeAction = useRef('touch_outside');
|
|
26
|
+
|
|
26
27
|
let descriptionStyle = {};
|
|
27
28
|
let Description: any = View;
|
|
28
29
|
if (scrollContent) {
|
|
29
30
|
Description = ScrollView;
|
|
30
|
-
descriptionStyle = {
|
|
31
|
+
descriptionStyle = {height: 80};
|
|
31
32
|
}
|
|
33
|
+
|
|
32
34
|
/**
|
|
33
35
|
* tracking
|
|
34
36
|
*/
|
|
35
37
|
useEffect(() => {
|
|
36
|
-
const routes
|
|
38
|
+
const routes = navigator?.ref.current?.getRootState()?.routes || [];
|
|
37
39
|
const routesLength = routes.length;
|
|
38
40
|
let screen_name = routes?.[0]?.params?.screen?.name;
|
|
39
41
|
if (routesLength > 1) {
|
|
40
42
|
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
41
43
|
}
|
|
42
44
|
const tracking = {
|
|
43
|
-
|
|
44
|
-
code: context.code,
|
|
45
|
+
...context,
|
|
45
46
|
screen_name,
|
|
46
47
|
component_type: 'popup',
|
|
47
48
|
component_name: id,
|
|
@@ -88,7 +89,6 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
88
89
|
closeAction.current = 'button_action';
|
|
89
90
|
onAction(secondary?.onPress);
|
|
90
91
|
}}
|
|
91
|
-
accessibilityLabel={'btn_popup_cancel'}
|
|
92
92
|
/>
|
|
93
93
|
</View>
|
|
94
94
|
<View style={styles.buttonSpace} />
|
|
@@ -102,7 +102,6 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
102
102
|
closeAction.current = 'button_action';
|
|
103
103
|
onAction(primary.onPress);
|
|
104
104
|
}}
|
|
105
|
-
accessibilityLabel={'btn_popup_allow'}
|
|
106
105
|
/>
|
|
107
106
|
</View>
|
|
108
107
|
</View>
|
|
@@ -112,7 +111,6 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
112
111
|
return (
|
|
113
112
|
<View style={Styles.columnCenter}>
|
|
114
113
|
<Button
|
|
115
|
-
accessibilityLabel={'btn_popup_allow'}
|
|
116
114
|
title={primary.title}
|
|
117
115
|
size="medium"
|
|
118
116
|
onPress={() => {
|
|
@@ -124,7 +122,6 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
124
122
|
<>
|
|
125
123
|
<View style={styles.buttonSpace} />
|
|
126
124
|
<Button
|
|
127
|
-
accessibilityLabel={'btn_popup_cancel'}
|
|
128
125
|
title={secondary?.title}
|
|
129
126
|
type="text"
|
|
130
127
|
size="medium"
|
|
@@ -139,7 +136,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
139
136
|
);
|
|
140
137
|
};
|
|
141
138
|
|
|
142
|
-
if (buttonDirection
|
|
139
|
+
if (buttonDirection == 'auto') {
|
|
143
140
|
if (
|
|
144
141
|
secondary?.title &&
|
|
145
142
|
(secondary.title.length > 12 || primary.title.length > 12)
|
|
@@ -148,7 +145,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
148
145
|
}
|
|
149
146
|
return renderRow();
|
|
150
147
|
}
|
|
151
|
-
if (buttonDirection
|
|
148
|
+
if (buttonDirection == 'row') {
|
|
152
149
|
return renderRow();
|
|
153
150
|
}
|
|
154
151
|
return renderColumn();
|
|
@@ -158,61 +155,53 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
158
155
|
* build close action
|
|
159
156
|
*/
|
|
160
157
|
const buildCloseIcon = () => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
</TouchableOpacity>
|
|
185
|
-
);
|
|
186
|
-
}
|
|
158
|
+
return (
|
|
159
|
+
<TouchableOpacity
|
|
160
|
+
style={styles.iconCloseContainer}
|
|
161
|
+
onPress={() => {
|
|
162
|
+
closeAction.current = 'icon_close';
|
|
163
|
+
onAction(onIconClose);
|
|
164
|
+
}}>
|
|
165
|
+
<View
|
|
166
|
+
style={[
|
|
167
|
+
styles.iconClose,
|
|
168
|
+
{
|
|
169
|
+
backgroundColor: theme.colors.text.default,
|
|
170
|
+
borderColor: theme.colors.background.surface,
|
|
171
|
+
},
|
|
172
|
+
]}>
|
|
173
|
+
<Icon
|
|
174
|
+
source="navigation_close"
|
|
175
|
+
color={theme.colors.background.surface}
|
|
176
|
+
size={14}
|
|
177
|
+
/>
|
|
178
|
+
</View>
|
|
179
|
+
</TouchableOpacity>
|
|
180
|
+
);
|
|
187
181
|
};
|
|
188
182
|
|
|
189
183
|
return (
|
|
190
184
|
<View
|
|
191
|
-
accessibilityLabel={'popup_notify'}
|
|
192
185
|
style={[
|
|
193
186
|
styles.container,
|
|
194
187
|
{backgroundColor: theme.colors.background.surface},
|
|
195
188
|
]}>
|
|
196
189
|
{!!image && <Image source={{uri: image}} style={styles.image} />}
|
|
197
190
|
<View style={styles.content}>
|
|
198
|
-
<Text typography={'header_default_bold'} numberOfLines={
|
|
191
|
+
<Text typography={'header_default_bold'} numberOfLines={1}>
|
|
199
192
|
{title}
|
|
200
193
|
</Text>
|
|
201
194
|
<Description style={[styles.description, descriptionStyle]}>
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
</Text>
|
|
213
|
-
) : (
|
|
214
|
-
description
|
|
215
|
-
)}
|
|
195
|
+
<Text
|
|
196
|
+
typography={'body_default_regular'}
|
|
197
|
+
onTextLayout={({nativeEvent: {lines}}) => {
|
|
198
|
+
const enableScroll = lines.length > 3;
|
|
199
|
+
if (enableScroll != scrollContent) {
|
|
200
|
+
setScrollContent(enableScroll);
|
|
201
|
+
}
|
|
202
|
+
}}>
|
|
203
|
+
{description}
|
|
204
|
+
</Text>
|
|
216
205
|
</Description>
|
|
217
206
|
{!!error && (
|
|
218
207
|
<View style={styles.information}>
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -11,7 +11,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
11
11
|
image,
|
|
12
12
|
onIconClose,
|
|
13
13
|
}) => {
|
|
14
|
-
const context = useContext
|
|
14
|
+
const context = useContext(MiniAppContext);
|
|
15
15
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
16
16
|
const closeAction = useRef('touch_outside');
|
|
17
17
|
|
|
@@ -19,15 +19,14 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
19
19
|
* tracking
|
|
20
20
|
*/
|
|
21
21
|
useEffect(() => {
|
|
22
|
-
const routes
|
|
22
|
+
const routes = navigator?.ref.current?.getRootState()?.routes || [];
|
|
23
23
|
const routesLength = routes.length;
|
|
24
24
|
let screen_name = routes?.[0]?.params?.screen?.name;
|
|
25
25
|
if (routesLength > 1) {
|
|
26
26
|
screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
27
27
|
}
|
|
28
28
|
const tracking = {
|
|
29
|
-
|
|
30
|
-
code: context.code,
|
|
29
|
+
...context,
|
|
31
30
|
screen_name,
|
|
32
31
|
component_type: 'popup',
|
|
33
32
|
component_name: id,
|
|
@@ -52,7 +51,6 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
52
51
|
return (
|
|
53
52
|
<View style={styles.iconCloseContainer}>
|
|
54
53
|
<TouchableOpacity
|
|
55
|
-
accessibilityLabel={'ic_popup_close'}
|
|
56
54
|
onPress={() => {
|
|
57
55
|
closeAction.current = 'icon_close';
|
|
58
56
|
navigator?.pop();
|
|
@@ -79,7 +77,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
79
77
|
};
|
|
80
78
|
|
|
81
79
|
return (
|
|
82
|
-
<View
|
|
80
|
+
<View>
|
|
83
81
|
<Image
|
|
84
82
|
source={{
|
|
85
83
|
uri: image,
|
|
@@ -115,4 +113,8 @@ const styles = StyleSheet.create({
|
|
|
115
113
|
},
|
|
116
114
|
});
|
|
117
115
|
|
|
116
|
+
PopupPromotion.defaultProps = {
|
|
117
|
+
image: 'https://google.com',
|
|
118
|
+
};
|
|
119
|
+
|
|
118
120
|
export default PopupPromotion;
|
package/Popup/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {TextStyle} from 'react-native';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
export type PopupNotifyProps = {
|
|
@@ -18,7 +19,7 @@ export type PopupNotifyProps = {
|
|
|
18
19
|
/**
|
|
19
20
|
* `description`: Represents the description text to be displayed in the PopupNotify component.
|
|
20
21
|
*/
|
|
21
|
-
description
|
|
22
|
+
description: string | React.ReactNode;
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* `error`: Optional. Represents additional error text to be displayed in the PopupNotify component.
|
|
@@ -78,4 +79,9 @@ type PopupAction = {
|
|
|
78
79
|
onPress: () => void;
|
|
79
80
|
};
|
|
80
81
|
|
|
82
|
+
export type HighlightText = {
|
|
83
|
+
text: string;
|
|
84
|
+
style: TextStyle;
|
|
85
|
+
};
|
|
86
|
+
|
|
81
87
|
type PopupActionDirection = 'row' | 'column' | 'auto';
|
package/Radio/index.tsx
CHANGED
|
@@ -4,9 +4,8 @@ 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
|
|
7
|
+
import {ApplicationContext} from '../Application';
|
|
8
8
|
import {Spacing} from '../Consts';
|
|
9
|
-
import {formatNameLength} from '../Application/utils';
|
|
10
9
|
|
|
11
10
|
const Radio: FC<RadioProps> = ({
|
|
12
11
|
value,
|
|
@@ -15,8 +14,6 @@ const Radio: FC<RadioProps> = ({
|
|
|
15
14
|
onChange,
|
|
16
15
|
label,
|
|
17
16
|
style,
|
|
18
|
-
params,
|
|
19
|
-
accessibilityLabel,
|
|
20
17
|
}) => {
|
|
21
18
|
const {theme} = useContext(ApplicationContext);
|
|
22
19
|
const selected = value === groupValue;
|
|
@@ -41,38 +38,26 @@ const Radio: FC<RadioProps> = ({
|
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
return (
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
<
|
|
55
|
-
accessibilityLabel={accessibilityLabel}
|
|
56
|
-
onPress={onChange}
|
|
57
|
-
disabled={disabled}
|
|
41
|
+
<TouchableOpacity
|
|
42
|
+
onPress={onChange}
|
|
43
|
+
disabled={disabled}
|
|
44
|
+
style={[
|
|
45
|
+
style,
|
|
46
|
+
{
|
|
47
|
+
flexDirection: 'row',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
},
|
|
50
|
+
]}>
|
|
51
|
+
<View
|
|
58
52
|
style={[
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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>
|
|
53
|
+
styles.radio,
|
|
54
|
+
checkBoxStyle,
|
|
55
|
+
disabledStyle,
|
|
56
|
+
{marginRight: label ? Spacing.XS : 0},
|
|
57
|
+
]}
|
|
58
|
+
/>
|
|
59
|
+
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
60
|
+
</TouchableOpacity>
|
|
76
61
|
);
|
|
77
62
|
};
|
|
78
63
|
|
package/Radio/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export type RadioProps = {
|
|
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`.
|
|
@@ -35,6 +35,4 @@ export interface RadioProps extends TouchableOpacityProps {
|
|
|
35
35
|
* Accepts an object of style properties.
|
|
36
36
|
*/
|
|
37
37
|
style?: ViewStyle;
|
|
38
|
-
|
|
39
|
-
params?: any;
|
|
40
|
-
}
|
|
38
|
+
};
|
package/Switch/index.tsx
CHANGED
|
@@ -3,16 +3,9 @@ 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';
|
|
7
6
|
|
|
8
|
-
const Switch: FC<SwitchProps> =
|
|
9
|
-
value =
|
|
10
|
-
onChange,
|
|
11
|
-
disabled = false,
|
|
12
|
-
style,
|
|
13
|
-
params,
|
|
14
|
-
accessibilityLabel,
|
|
15
|
-
}) => {
|
|
7
|
+
const Switch: FC<SwitchProps> = props => {
|
|
8
|
+
const {value, onChange, disabled, style} = props;
|
|
16
9
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
17
10
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
18
11
|
|
|
@@ -22,30 +15,23 @@ const Switch: FC<SwitchProps> = ({
|
|
|
22
15
|
}
|
|
23
16
|
|
|
24
17
|
return (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}}>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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>
|
|
18
|
+
<TouchableOpacity
|
|
19
|
+
disabled={disabled}
|
|
20
|
+
onPress={() => onChange?.(!value)}
|
|
21
|
+
style={[
|
|
22
|
+
style,
|
|
23
|
+
styles.container,
|
|
24
|
+
{backgroundColor, alignItems: circleAlign},
|
|
25
|
+
]}>
|
|
26
|
+
<View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
|
|
27
|
+
<View style={[styles.circleSmall, {backgroundColor}]} />
|
|
28
|
+
</View>
|
|
29
|
+
</TouchableOpacity>
|
|
48
30
|
);
|
|
49
31
|
};
|
|
50
32
|
|
|
33
|
+
Switch.defaultProps = {
|
|
34
|
+
value: false,
|
|
35
|
+
disabled: false,
|
|
36
|
+
};
|
|
51
37
|
export {Switch};
|
package/Switch/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ViewStyle} from 'react-native';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export type SwitchProps = {
|
|
4
4
|
/**
|
|
5
5
|
* `value`: Represents whether the Switch component is currently in the 'on' (`true`) or 'off' (`false`) state.
|
|
6
6
|
*/
|
|
@@ -23,6 +23,4 @@ export interface SwitchProps extends TouchableOpacityProps {
|
|
|
23
23
|
* Accepts an object of style properties.
|
|
24
24
|
*/
|
|
25
25
|
style?: ViewStyle;
|
|
26
|
-
|
|
27
|
-
params?: any;
|
|
28
|
-
}
|
|
26
|
+
};
|
package/Tag/index.tsx
CHANGED
|
@@ -31,8 +31,6 @@ const Tag: FC<TagProps> = ({
|
|
|
31
31
|
size = 'large',
|
|
32
32
|
style,
|
|
33
33
|
customColor,
|
|
34
|
-
accessibilityLabelContainer,
|
|
35
|
-
accessibilityLabelText,
|
|
36
34
|
}) => {
|
|
37
35
|
let labelColor = textColor[color];
|
|
38
36
|
let tagColor = backgroundColor[color];
|
|
@@ -62,9 +60,7 @@ const Tag: FC<TagProps> = ({
|
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
return (
|
|
65
|
-
<View
|
|
66
|
-
style={[style, sizeStyle, {backgroundColor: tagColor}]}
|
|
67
|
-
accessibilityLabel={accessibilityLabelContainer}>
|
|
63
|
+
<View style={[style, sizeStyle, {backgroundColor: tagColor}]}>
|
|
68
64
|
{!!icon && (
|
|
69
65
|
<Icon
|
|
70
66
|
style={styles.icon}
|
|
@@ -73,10 +69,7 @@ const Tag: FC<TagProps> = ({
|
|
|
73
69
|
color={labelColor}
|
|
74
70
|
/>
|
|
75
71
|
)}
|
|
76
|
-
<Text
|
|
77
|
-
color={labelColor}
|
|
78
|
-
typography={'label_s_medium'}
|
|
79
|
-
accessibilityLabel={accessibilityLabelText}>
|
|
72
|
+
<Text color={labelColor} typography={'label_s_medium'}>
|
|
80
73
|
{label}
|
|
81
74
|
</Text>
|
|
82
75
|
</View>
|
package/Tag/styles.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import {StyleSheet} from 'react-native';
|
|
2
2
|
import {Radius, Spacing} from '../Consts';
|
|
3
|
-
import {scaleSize} from '../Text';
|
|
4
3
|
|
|
5
4
|
export default StyleSheet.create({
|
|
6
5
|
container: {
|
|
7
6
|
paddingHorizontal: Spacing.S,
|
|
8
7
|
borderRadius: Radius.S,
|
|
9
8
|
flexDirection: 'row',
|
|
10
|
-
height:
|
|
9
|
+
height: 24,
|
|
11
10
|
alignItems: 'center',
|
|
12
11
|
justifyContent: 'center',
|
|
13
12
|
},
|
|
14
13
|
mediumContainer: {
|
|
15
14
|
paddingHorizontal: Spacing.S,
|
|
16
15
|
borderRadius: Radius.S,
|
|
17
|
-
height:
|
|
16
|
+
height: 18,
|
|
18
17
|
alignItems: 'center',
|
|
19
18
|
flexDirection: 'row',
|
|
20
19
|
justifyContent: 'center',
|
package/Tag/types.ts
CHANGED
|
@@ -33,16 +33,4 @@ export type TagProps = {
|
|
|
33
33
|
* that can be applied to the Tag component.
|
|
34
34
|
*/
|
|
35
35
|
customColor?: string;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Overrides the text that's read by the screen reader when the user interacts with the element. By default, the
|
|
39
|
-
* label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
|
|
40
|
-
*/
|
|
41
|
-
accessibilityLabelContainer?: string;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Overrides the text that's read by the screen reader when the user interacts with the element. By default, the
|
|
45
|
-
* label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
|
|
46
|
-
*/
|
|
47
|
-
accessibilityLabelText?: string;
|
|
48
36
|
};
|
package/Text/index.tsx
CHANGED
|
@@ -51,24 +51,8 @@ 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
|
-
|
|
70
54
|
const Text: React.FC<TextProps> = ({
|
|
71
|
-
typography
|
|
55
|
+
typography,
|
|
72
56
|
color,
|
|
73
57
|
children,
|
|
74
58
|
style,
|
|
@@ -110,13 +94,6 @@ const Text: React.FC<TextProps> = ({
|
|
|
110
94
|
};
|
|
111
95
|
|
|
112
96
|
const textStyle = getTypoStyle(typography);
|
|
113
|
-
|
|
114
|
-
if (deprecatedValues.includes(typography)) {
|
|
115
|
-
console.warn(
|
|
116
|
-
`Warning: The typography value "${typography}" is deprecated.`,
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
97
|
return (
|
|
121
98
|
<RNText
|
|
122
99
|
{...rest}
|
|
@@ -126,4 +103,8 @@ const Text: React.FC<TextProps> = ({
|
|
|
126
103
|
);
|
|
127
104
|
};
|
|
128
105
|
|
|
106
|
+
Text.defaultProps = {
|
|
107
|
+
typography: 'body_default_regular',
|
|
108
|
+
};
|
|
109
|
+
|
|
129
110
|
export {Text, scaleSize};
|
package/Text/styles.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
headline_default_bold: {fontSize: 24, lineHeight:
|
|
3
|
-
header_m_bold: {fontSize: 18, lineHeight:
|
|
2
|
+
headline_default_bold: {fontSize: 24, lineHeight: 32, fontWeight: '700'},
|
|
3
|
+
header_m_bold: {fontSize: 18, lineHeight: 28, fontWeight: '700'},
|
|
4
4
|
header_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
5
5
|
header_s_semibold: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
|
|
6
|
-
header_xs_semibold: {fontSize: 12, lineHeight:
|
|
6
|
+
header_xs_semibold: {fontSize: 12, lineHeight: 16, fontWeight: '600'},
|
|
7
7
|
body_default_regular: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
|
|
8
|
-
|
|
8
|
+
body_regularstrikethrought: {
|
|
9
9
|
fontSize: 14,
|
|
10
10
|
lineHeight: 20,
|
|
11
11
|
fontWeight: '400',
|
|
@@ -13,12 +13,12 @@ export default {
|
|
|
13
13
|
},
|
|
14
14
|
description_default_regular: {
|
|
15
15
|
fontSize: 12,
|
|
16
|
-
lineHeight:
|
|
16
|
+
lineHeight: 16,
|
|
17
17
|
fontWeight: '400',
|
|
18
18
|
},
|
|
19
19
|
description_default_regularstrikethrought: {
|
|
20
20
|
fontSize: 12,
|
|
21
|
-
lineHeight:
|
|
21
|
+
lineHeight: 16,
|
|
22
22
|
fontWeight: '400',
|
|
23
23
|
textDecorationLine: 'line-through',
|
|
24
24
|
},
|
|
@@ -30,11 +30,11 @@ export default {
|
|
|
30
30
|
textDecorationLine: 'line-through',
|
|
31
31
|
},
|
|
32
32
|
label_default_medium: {fontSize: 14, lineHeight: 20, fontWeight: '500'},
|
|
33
|
-
label_s_medium: {fontSize: 12, lineHeight:
|
|
33
|
+
label_s_medium: {fontSize: 12, lineHeight: 16, fontWeight: '500'},
|
|
34
34
|
label_xs_medium: {fontSize: 10, lineHeight: 14, fontWeight: '500'},
|
|
35
35
|
action_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
|
|
36
36
|
action_s_bold: {fontSize: 14, lineHeight: 20, fontWeight: '700'},
|
|
37
|
-
action_xs_bold: {fontSize: 12, lineHeight:
|
|
37
|
+
action_xs_bold: {fontSize: 12, lineHeight: 16, fontWeight: '700'},
|
|
38
38
|
action_xxs_bold: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
|
|
39
39
|
/**non-support**/
|
|
40
40
|
headline_default: {
|