@momo-kits/foundation 0.89.5 → 0.92.1-beta.16
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 +479 -0
- package/Application/{BottomTab.tsx → BottomTab/index.tsx} +19 -9
- package/Application/Components.tsx +48 -26
- package/Application/ModalScreen.tsx +107 -131
- package/Application/NavigationContainer.tsx +64 -51
- package/Application/Navigator.ts +51 -31
- package/Application/StackScreen.tsx +83 -12
- package/Application/index.ts +0 -4
- package/Application/types.ts +17 -7
- package/Application/utils.tsx +73 -10
- package/Badge/Badge.tsx +1 -1
- package/Button/index.tsx +54 -14
- package/CheckBox/index.tsx +53 -20
- package/CheckBox/types.ts +4 -0
- package/Consts/colors+spacing+radius.ts +14 -0
- package/IconButton/index.tsx +30 -7
- package/Image/index.tsx +3 -1
- package/Input/Input.tsx +68 -5
- package/Input/InputDropDown.tsx +44 -5
- package/Input/InputMoney.tsx +53 -5
- package/Input/InputOTP.tsx +39 -7
- package/Input/InputSearch.tsx +61 -25
- package/Input/InputTextArea.tsx +23 -0
- package/Input/index.tsx +29 -2
- package/Input/styles.ts +3 -3
- package/Popup/PopupNotify.tsx +13 -2
- package/Popup/PopupPromotion.tsx +11 -4
- package/Radio/index.tsx +52 -19
- package/Radio/types.ts +5 -0
- package/Switch/index.tsx +39 -14
- package/Switch/types.ts +4 -0
- package/Text/index.tsx +24 -5
- package/Text/styles.ts +8 -8
- package/Text/types.ts +19 -1
- package/Title/index.tsx +148 -102
- package/Title/styles.ts +33 -9
- package/Title/types.ts +12 -48
- package/index.ts +2 -1
- package/package.json +3 -1
- package/verify.js +9 -6
package/Input/InputSearch.tsx
CHANGED
|
@@ -12,6 +12,12 @@ import styles from './styles';
|
|
|
12
12
|
import {Icon} from '../Icon';
|
|
13
13
|
import {Text} from '../Text';
|
|
14
14
|
import {checkTyping} from './utils';
|
|
15
|
+
import {getAccessibilityID} from '../Application/utils';
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
ScreenContext,
|
|
19
|
+
MiniAppContext,
|
|
20
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
15
21
|
|
|
16
22
|
const InputSearch = forwardRef(
|
|
17
23
|
(
|
|
@@ -28,15 +34,19 @@ const InputSearch = forwardRef(
|
|
|
28
34
|
style,
|
|
29
35
|
defaultValue,
|
|
30
36
|
onPressButtonText,
|
|
31
|
-
|
|
37
|
+
params,
|
|
38
|
+
componentId,
|
|
39
|
+
hasColorBG = false,
|
|
32
40
|
...props
|
|
33
41
|
}: InputSearchProps,
|
|
34
42
|
ref,
|
|
35
43
|
) => {
|
|
36
44
|
const {theme} = useContext(ApplicationContext);
|
|
45
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
37
46
|
const [focused, setFocused] = useState(false);
|
|
38
47
|
const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
|
|
39
48
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
49
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
40
50
|
|
|
41
51
|
const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
42
52
|
setFocused(true);
|
|
@@ -62,6 +72,9 @@ const InputSearch = forwardRef(
|
|
|
62
72
|
return (
|
|
63
73
|
<TextInput
|
|
64
74
|
{...props}
|
|
75
|
+
{...getAccessibilityID(
|
|
76
|
+
`${appId}/${code}/${screenInfo.screenName}/input_search`,
|
|
77
|
+
)}
|
|
65
78
|
textAlignVertical="center"
|
|
66
79
|
ref={inputRef}
|
|
67
80
|
style={[
|
|
@@ -117,33 +130,56 @@ const InputSearch = forwardRef(
|
|
|
117
130
|
);
|
|
118
131
|
};
|
|
119
132
|
|
|
120
|
-
|
|
133
|
+
let inputState = 'empty';
|
|
134
|
+
|
|
135
|
+
if (focused) {
|
|
136
|
+
inputState = 'focus';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (value && value?.length > 0) {
|
|
140
|
+
inputState = 'filled';
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const backgroundColor = hasColorBG
|
|
144
|
+
? theme.colors.background.default
|
|
145
|
+
: theme.colors.background.surface;
|
|
121
146
|
|
|
122
147
|
return (
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
148
|
+
<ScreenContext.Provider
|
|
149
|
+
value={{
|
|
150
|
+
...screenInfo,
|
|
151
|
+
componentName: 'InputSearch',
|
|
152
|
+
params,
|
|
153
|
+
state: inputState,
|
|
154
|
+
componentId,
|
|
155
|
+
}}>
|
|
156
|
+
<View style={[style, styles.searchInputContainer]}>
|
|
157
|
+
<View
|
|
158
|
+
style={[
|
|
159
|
+
styles.searchInputWrapper,
|
|
160
|
+
{
|
|
161
|
+
backgroundColor,
|
|
162
|
+
},
|
|
163
|
+
]}>
|
|
164
|
+
<Icon
|
|
165
|
+
source={'navigation_search'}
|
|
166
|
+
size={24}
|
|
167
|
+
color={theme.colors.text.hint}
|
|
168
|
+
/>
|
|
169
|
+
{renderInputView()}
|
|
170
|
+
{renderIconView()}
|
|
171
|
+
</View>
|
|
172
|
+
{showButtonText && (
|
|
173
|
+
<TouchableOpacity onPress={onPressButtonText}>
|
|
174
|
+
<Text
|
|
175
|
+
typography={'action_default_bold'}
|
|
176
|
+
style={styles.textButton}>
|
|
177
|
+
{buttonText}
|
|
178
|
+
</Text>
|
|
179
|
+
</TouchableOpacity>
|
|
180
|
+
)}
|
|
138
181
|
</View>
|
|
139
|
-
|
|
140
|
-
<TouchableOpacity onPress={onPressButtonText}>
|
|
141
|
-
<Text typography={'action_default_bold'} style={styles.textButton}>
|
|
142
|
-
{buttonText}
|
|
143
|
-
</Text>
|
|
144
|
-
</TouchableOpacity>
|
|
145
|
-
)}
|
|
146
|
-
</View>
|
|
182
|
+
</ScreenContext.Provider>
|
|
147
183
|
);
|
|
148
184
|
},
|
|
149
185
|
);
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -18,6 +18,12 @@ import {
|
|
|
18
18
|
import {InputTextAreaProps} from './index';
|
|
19
19
|
import {Icon} from '../Icon';
|
|
20
20
|
import {ApplicationContext} from '../Application';
|
|
21
|
+
import {cleanNameForTracking, getAccessibilityID} from '../Application/utils';
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
ScreenContext,
|
|
25
|
+
MiniAppContext,
|
|
26
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
21
27
|
|
|
22
28
|
const InputTextArea = forwardRef(
|
|
23
29
|
(
|
|
@@ -43,6 +49,8 @@ const InputTextArea = forwardRef(
|
|
|
43
49
|
ref,
|
|
44
50
|
) => {
|
|
45
51
|
const {theme} = useContext(ApplicationContext);
|
|
52
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
53
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
46
54
|
const [focused, setFocused] = useState(false);
|
|
47
55
|
const [inputValue, setInputValue] = useState(defaultValue ?? '');
|
|
48
56
|
const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
|
|
@@ -88,6 +96,20 @@ const InputTextArea = forwardRef(
|
|
|
88
96
|
placeholderColor = disabledColor;
|
|
89
97
|
}
|
|
90
98
|
|
|
99
|
+
const accessibilityID = disabled
|
|
100
|
+
? getAccessibilityID(
|
|
101
|
+
`${appId}/${code}/${
|
|
102
|
+
screenInfo.screenName
|
|
103
|
+
}/input_${cleanNameForTracking(
|
|
104
|
+
floatingValue ?? placeholder,
|
|
105
|
+
)}_disabled`,
|
|
106
|
+
)
|
|
107
|
+
: getAccessibilityID(
|
|
108
|
+
`${appId}/${code}/${
|
|
109
|
+
screenInfo.screenName
|
|
110
|
+
}/input_${cleanNameForTracking(floatingValue ?? placeholder)}`,
|
|
111
|
+
);
|
|
112
|
+
|
|
91
113
|
return (
|
|
92
114
|
<View
|
|
93
115
|
style={[
|
|
@@ -109,6 +131,7 @@ const InputTextArea = forwardRef(
|
|
|
109
131
|
<View style={styles.textAreaView}>
|
|
110
132
|
<TextInput
|
|
111
133
|
{...props}
|
|
134
|
+
{...accessibilityID}
|
|
112
135
|
ref={inputRef}
|
|
113
136
|
editable={!disabled}
|
|
114
137
|
textAlignVertical="top"
|
package/Input/index.tsx
CHANGED
|
@@ -80,6 +80,9 @@ export interface InputProps extends TextInputProps {
|
|
|
80
80
|
fontWeight?: 'Regular' | 'Bold';
|
|
81
81
|
|
|
82
82
|
onPressIcon?: () => void;
|
|
83
|
+
|
|
84
|
+
params?: any;
|
|
85
|
+
componentId?: string;
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
type InputPropsWithoutSizeAndIcon = Omit<
|
|
@@ -121,7 +124,14 @@ export interface InputSearchProps extends TextInputProps {
|
|
|
121
124
|
*/
|
|
122
125
|
icon?: string;
|
|
123
126
|
|
|
124
|
-
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
*/
|
|
130
|
+
hasColorBG?: boolean;
|
|
131
|
+
|
|
132
|
+
params?: any;
|
|
133
|
+
|
|
134
|
+
componentId?: string;
|
|
125
135
|
}
|
|
126
136
|
|
|
127
137
|
export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
|
|
@@ -141,6 +151,8 @@ export interface InputOTPProps extends InputPropsWithoutSizeAndIcon {
|
|
|
141
151
|
* 'number' - The OTP input will be treated as a number.
|
|
142
152
|
*/
|
|
143
153
|
dataType?: 'string' | 'number';
|
|
154
|
+
|
|
155
|
+
floatingValue: string;
|
|
144
156
|
}
|
|
145
157
|
|
|
146
158
|
export type CaretProps = {
|
|
@@ -245,7 +257,22 @@ export interface InputDropDownProps {
|
|
|
245
257
|
*/
|
|
246
258
|
leadingIconColor?: string;
|
|
247
259
|
|
|
248
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Optional. params for element tracking.
|
|
262
|
+
*/
|
|
263
|
+
params?: {
|
|
264
|
+
[key: string]: any;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* component id for element tracking.
|
|
269
|
+
*/
|
|
270
|
+
componentId?: string;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Optional. Represents the style of the InputDropDown component.
|
|
274
|
+
*/
|
|
275
|
+
style?: ViewStyle | ViewStyle[];
|
|
249
276
|
}
|
|
250
277
|
|
|
251
278
|
export {Input, InputTextArea, InputSearch, InputMoney, InputOTP, InputDropDown};
|
package/Input/styles.ts
CHANGED
|
@@ -7,7 +7,7 @@ export default StyleSheet.create({
|
|
|
7
7
|
input: {
|
|
8
8
|
flex: 1,
|
|
9
9
|
paddingLeft: Spacing.M,
|
|
10
|
-
fontSize: scaleSize(
|
|
10
|
+
fontSize: scaleSize(14),
|
|
11
11
|
},
|
|
12
12
|
wrapper: {
|
|
13
13
|
width: '100%',
|
|
@@ -75,7 +75,7 @@ export default StyleSheet.create({
|
|
|
75
75
|
flex: 1,
|
|
76
76
|
paddingRight: Spacing.XS,
|
|
77
77
|
paddingVertical: Spacing.XS,
|
|
78
|
-
fontSize: scaleSize(
|
|
78
|
+
fontSize: scaleSize(14),
|
|
79
79
|
},
|
|
80
80
|
textAreaWrapper: {
|
|
81
81
|
borderWidth: 1,
|
|
@@ -108,7 +108,7 @@ export default StyleSheet.create({
|
|
|
108
108
|
height: 36,
|
|
109
109
|
marginLeft: Spacing.S,
|
|
110
110
|
flex: 1,
|
|
111
|
-
fontSize: scaleSize(
|
|
111
|
+
fontSize: scaleSize(14),
|
|
112
112
|
paddingVertical: Spacing.XS,
|
|
113
113
|
},
|
|
114
114
|
searchInputView: {
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -4,9 +4,14 @@ import {PopupNotifyProps} from './types';
|
|
|
4
4
|
import {Radius, Spacing, Styles} from '../Consts';
|
|
5
5
|
import {Image} from '../Image';
|
|
6
6
|
import {Text} from '../Text';
|
|
7
|
-
import {ApplicationContext
|
|
7
|
+
import {ApplicationContext} from '../Application';
|
|
8
8
|
import {Button} from '../Button';
|
|
9
9
|
import {Icon} from '../Icon';
|
|
10
|
+
import {getAccessibilityID} from '../Application/utils';
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
MiniAppContext,
|
|
14
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
10
15
|
|
|
11
16
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
12
17
|
id,
|
|
@@ -19,7 +24,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
19
24
|
buttonDirection = 'row',
|
|
20
25
|
onIconClose,
|
|
21
26
|
}) => {
|
|
22
|
-
const context = useContext(MiniAppContext);
|
|
27
|
+
const context = useContext<any>(MiniAppContext);
|
|
23
28
|
const {theme, navigator, translate} = useContext(ApplicationContext);
|
|
24
29
|
const [scrollContent, setScrollContent] = useState(false);
|
|
25
30
|
const closeAction = useRef('touch_outside');
|
|
@@ -89,6 +94,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
89
94
|
closeAction.current = 'button_action';
|
|
90
95
|
onAction(secondary?.onPress);
|
|
91
96
|
}}
|
|
97
|
+
accessibilityLabel={'btn_popup_cancel'}
|
|
92
98
|
/>
|
|
93
99
|
</View>
|
|
94
100
|
<View style={styles.buttonSpace} />
|
|
@@ -102,6 +108,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
102
108
|
closeAction.current = 'button_action';
|
|
103
109
|
onAction(primary.onPress);
|
|
104
110
|
}}
|
|
111
|
+
accessibilityLabel={'btn_popup_allow'}
|
|
105
112
|
/>
|
|
106
113
|
</View>
|
|
107
114
|
</View>
|
|
@@ -111,6 +118,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
111
118
|
return (
|
|
112
119
|
<View style={Styles.columnCenter}>
|
|
113
120
|
<Button
|
|
121
|
+
accessibilityLabel={'btn_popup_allow'}
|
|
114
122
|
title={primary.title}
|
|
115
123
|
size="medium"
|
|
116
124
|
onPress={() => {
|
|
@@ -122,6 +130,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
122
130
|
<>
|
|
123
131
|
<View style={styles.buttonSpace} />
|
|
124
132
|
<Button
|
|
133
|
+
accessibilityLabel={'btn_popup_cancel'}
|
|
125
134
|
title={secondary?.title}
|
|
126
135
|
type="text"
|
|
127
136
|
size="medium"
|
|
@@ -157,6 +166,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
157
166
|
const buildCloseIcon = () => {
|
|
158
167
|
return (
|
|
159
168
|
<TouchableOpacity
|
|
169
|
+
{...getAccessibilityID?.('ic_popup_close')}
|
|
160
170
|
style={styles.iconCloseContainer}
|
|
161
171
|
onPress={() => {
|
|
162
172
|
closeAction.current = 'icon_close';
|
|
@@ -182,6 +192,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
182
192
|
|
|
183
193
|
return (
|
|
184
194
|
<View
|
|
195
|
+
{...getAccessibilityID?.(`pu_${context.code}_notify`)}
|
|
185
196
|
style={[
|
|
186
197
|
styles.container,
|
|
187
198
|
{backgroundColor: theme.colors.background.surface},
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
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
|
|
4
|
+
import {ApplicationContext} from '../Application';
|
|
5
5
|
import {Image} from '../Image';
|
|
6
6
|
import {Radius, Spacing} from '../Consts';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
|
+
import {getAccessibilityID} from '../Application/utils';
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
MiniAppContext,
|
|
12
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
8
13
|
|
|
9
14
|
const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
10
15
|
id,
|
|
11
16
|
image,
|
|
12
17
|
onIconClose,
|
|
13
18
|
}) => {
|
|
14
|
-
const context = useContext(MiniAppContext);
|
|
19
|
+
const context = useContext<any>(MiniAppContext);
|
|
15
20
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
16
21
|
const closeAction = useRef('touch_outside');
|
|
17
22
|
|
|
@@ -49,7 +54,9 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
49
54
|
*/
|
|
50
55
|
const buildCloseIcon = () => {
|
|
51
56
|
return (
|
|
52
|
-
<View
|
|
57
|
+
<View
|
|
58
|
+
{...getAccessibilityID?.('ic_popup_close')}
|
|
59
|
+
style={styles.iconCloseContainer}>
|
|
53
60
|
<TouchableOpacity
|
|
54
61
|
onPress={() => {
|
|
55
62
|
closeAction.current = 'icon_close';
|
|
@@ -77,7 +84,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
77
84
|
};
|
|
78
85
|
|
|
79
86
|
return (
|
|
80
|
-
<View>
|
|
87
|
+
<View {...getAccessibilityID?.(`pu_${context.code}_promotion`)}>
|
|
81
88
|
<Image
|
|
82
89
|
source={{
|
|
83
90
|
uri: image,
|
package/Radio/index.tsx
CHANGED
|
@@ -6,6 +6,16 @@ import {Text} from '../Text';
|
|
|
6
6
|
import styles from './styles';
|
|
7
7
|
import {ApplicationContext} from '../Application';
|
|
8
8
|
import {Spacing} from '../Consts';
|
|
9
|
+
import {
|
|
10
|
+
cleanNameForTracking,
|
|
11
|
+
formatNameLength,
|
|
12
|
+
getAccessibilityID,
|
|
13
|
+
} from '../Application/utils';
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
ScreenContext,
|
|
17
|
+
MiniAppContext,
|
|
18
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
9
19
|
|
|
10
20
|
const Radio: FC<RadioProps> = ({
|
|
11
21
|
value,
|
|
@@ -14,8 +24,12 @@ const Radio: FC<RadioProps> = ({
|
|
|
14
24
|
onChange,
|
|
15
25
|
label,
|
|
16
26
|
style,
|
|
27
|
+
params,
|
|
28
|
+
componentId,
|
|
17
29
|
}) => {
|
|
30
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
18
31
|
const {theme} = useContext(ApplicationContext);
|
|
32
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
19
33
|
const selected = value === groupValue;
|
|
20
34
|
let disabledStyle = {};
|
|
21
35
|
let checkBoxStyle = {
|
|
@@ -37,27 +51,46 @@ const Radio: FC<RadioProps> = ({
|
|
|
37
51
|
};
|
|
38
52
|
}
|
|
39
53
|
|
|
54
|
+
const accessibilityID = getAccessibilityID?.(
|
|
55
|
+
`${appId}/${code}/${screenInfo.screenName}/rdo_${cleanNameForTracking(
|
|
56
|
+
label,
|
|
57
|
+
)}_${selected}`,
|
|
58
|
+
);
|
|
59
|
+
|
|
40
60
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
<ScreenContext.Provider
|
|
62
|
+
value={{
|
|
63
|
+
...screenInfo,
|
|
64
|
+
componentName: 'Button',
|
|
65
|
+
params,
|
|
66
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
67
|
+
componentId,
|
|
68
|
+
componentLabel: formatNameLength(label || ''),
|
|
69
|
+
componentValue: value,
|
|
70
|
+
action: 'click',
|
|
71
|
+
}}>
|
|
72
|
+
<TouchableOpacity
|
|
73
|
+
{...accessibilityID}
|
|
74
|
+
onPress={onChange}
|
|
75
|
+
disabled={disabled}
|
|
52
76
|
style={[
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
77
|
+
style,
|
|
78
|
+
{
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
},
|
|
82
|
+
]}>
|
|
83
|
+
<View
|
|
84
|
+
style={[
|
|
85
|
+
styles.radio,
|
|
86
|
+
checkBoxStyle,
|
|
87
|
+
disabledStyle,
|
|
88
|
+
{marginRight: label ? Spacing.XS : 0},
|
|
89
|
+
]}
|
|
90
|
+
/>
|
|
91
|
+
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
92
|
+
</TouchableOpacity>
|
|
93
|
+
</ScreenContext.Provider>
|
|
61
94
|
);
|
|
62
95
|
};
|
|
63
96
|
|
package/Radio/types.ts
CHANGED
package/Switch/index.tsx
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import React, {FC} from 'react';
|
|
1
|
+
import React, {FC, useContext} from 'react';
|
|
2
2
|
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 {getAccessibilityID} from '../Application/utils';
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
ScreenContext,
|
|
10
|
+
MiniAppContext,
|
|
11
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
6
12
|
|
|
7
13
|
const Switch: FC<SwitchProps> = props => {
|
|
8
|
-
const {
|
|
14
|
+
const {appId, code} = useContext<any>(MiniAppContext);
|
|
15
|
+
const {value, onChange, disabled, style, params, componentId} = props;
|
|
16
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
17
|
+
|
|
9
18
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
10
19
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
|
11
20
|
|
|
@@ -14,19 +23,35 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
14
23
|
backgroundColor = value ? Colors.green_09 : Colors.black_05;
|
|
15
24
|
}
|
|
16
25
|
|
|
26
|
+
const accessibilityID = getAccessibilityID?.(
|
|
27
|
+
`${appId}/${code}/${screenInfo.screenName}/swt_${value}`,
|
|
28
|
+
);
|
|
29
|
+
|
|
17
30
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
<ScreenContext.Provider
|
|
32
|
+
value={{
|
|
33
|
+
...screenInfo,
|
|
34
|
+
componentName: 'Button',
|
|
35
|
+
params,
|
|
36
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
37
|
+
componentId,
|
|
38
|
+
componentValue: value,
|
|
39
|
+
action: 'click',
|
|
40
|
+
}}>
|
|
41
|
+
<TouchableOpacity
|
|
42
|
+
{...accessibilityID}
|
|
43
|
+
disabled={disabled}
|
|
44
|
+
onPress={() => onChange?.(!value)}
|
|
45
|
+
style={[
|
|
46
|
+
style,
|
|
47
|
+
styles.container,
|
|
48
|
+
{backgroundColor, alignItems: circleAlign},
|
|
49
|
+
]}>
|
|
50
|
+
<View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
|
|
51
|
+
<View style={[styles.circleSmall, {backgroundColor}]} />
|
|
52
|
+
</View>
|
|
53
|
+
</TouchableOpacity>
|
|
54
|
+
</ScreenContext.Provider>
|
|
30
55
|
);
|
|
31
56
|
};
|
|
32
57
|
|
package/Switch/types.ts
CHANGED
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,
|
|
@@ -94,6 +110,13 @@ const Text: React.FC<TextProps> = ({
|
|
|
94
110
|
};
|
|
95
111
|
|
|
96
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
|
+
|
|
97
120
|
return (
|
|
98
121
|
<RNText
|
|
99
122
|
{...rest}
|
|
@@ -103,8 +126,4 @@ const Text: React.FC<TextProps> = ({
|
|
|
103
126
|
);
|
|
104
127
|
};
|
|
105
128
|
|
|
106
|
-
Text.defaultProps = {
|
|
107
|
-
typography: 'body_default_regular',
|
|
108
|
-
};
|
|
109
|
-
|
|
110
129
|
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: 34, fontWeight: '700'},
|
|
3
|
+
header_m_bold: {fontSize: 18, lineHeight: 26, 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: 18, fontWeight: '600'},
|
|
7
7
|
body_default_regular: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
|
|
8
|
-
|
|
8
|
+
body_default_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: 18,
|
|
17
17
|
fontWeight: '400',
|
|
18
18
|
},
|
|
19
19
|
description_default_regularstrikethrought: {
|
|
20
20
|
fontSize: 12,
|
|
21
|
-
lineHeight:
|
|
21
|
+
lineHeight: 18,
|
|
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: 18, 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: 18, fontWeight: '700'},
|
|
38
38
|
action_xxs_bold: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
|
|
39
39
|
/**non-support**/
|
|
40
40
|
headline_default: {
|
package/Text/types.ts
CHANGED
|
@@ -14,13 +14,31 @@ export type TypographyWeight = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export type Typography =
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
**/
|
|
20
|
+
| 'headline_default'
|
|
21
|
+
| 'headline_l'
|
|
22
|
+
| 'headline_xl'
|
|
23
|
+
| 'title_default'
|
|
24
|
+
| 'title_xs'
|
|
25
|
+
| 'title_s'
|
|
26
|
+
| 'header_default'
|
|
27
|
+
| 'paragraph_default'
|
|
28
|
+
| 'paragraph_bold'
|
|
29
|
+
| 'paragraph_italic'
|
|
30
|
+
| 'label_xxs'
|
|
31
|
+
| 'action_s'
|
|
32
|
+
/**
|
|
33
|
+
* end
|
|
34
|
+
**/
|
|
17
35
|
| 'headline_default_bold'
|
|
18
36
|
| 'header_m_bold'
|
|
19
37
|
| 'header_default_bold'
|
|
20
38
|
| 'header_s_semibold'
|
|
21
39
|
| 'header_xs_semibold'
|
|
22
40
|
| 'body_default_regular'
|
|
23
|
-
| '
|
|
41
|
+
| 'body_default_regularstrikethrought'
|
|
24
42
|
| 'description_default_regular'
|
|
25
43
|
| 'description_default_regularstrikethrought'
|
|
26
44
|
| 'description_xs_regular'
|