@momo-kits/foundation 0.89.5 → 0.92.1-tracking.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.tsx +6 -1
- package/Application/Components.tsx +21 -8
- package/Application/NavigationContainer.tsx +8 -3
- package/Application/Navigator.ts +51 -31
- package/Application/StackScreen.tsx +69 -9
- package/Application/types.ts +2 -0
- package/Application/utils.tsx +61 -2
- package/Button/index.tsx +46 -16
- package/CheckBox/index.tsx +44 -21
- package/CheckBox/types.ts +4 -0
- package/IconButton/index.tsx +30 -7
- package/Image/index.tsx +3 -0
- package/Input/Input.tsx +39 -5
- package/Input/InputDropDown.tsx +30 -5
- package/Input/InputMoney.tsx +41 -5
- package/Input/InputOTP.tsx +31 -8
- package/Input/InputSearch.tsx +60 -26
- package/Input/InputTextArea.tsx +12 -2
- package/Input/index.tsx +27 -2
- package/Popup/PopupNotify.tsx +12 -0
- package/Popup/PopupPromotion.tsx +8 -2
- package/Radio/index.tsx +43 -20
- package/Radio/types.ts +5 -0
- package/Switch/index.tsx +36 -14
- package/Switch/types.ts +4 -0
- package/index.ts +2 -1
- package/package.json +1 -1
- package/verify.js +1 -1
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 {}
|
|
@@ -245,7 +255,22 @@ export interface InputDropDownProps {
|
|
|
245
255
|
*/
|
|
246
256
|
leadingIconColor?: string;
|
|
247
257
|
|
|
248
|
-
|
|
258
|
+
/**
|
|
259
|
+
* Optional. params for element tracking.
|
|
260
|
+
*/
|
|
261
|
+
params?: {
|
|
262
|
+
[key: string]: any;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* component id for element tracking.
|
|
267
|
+
*/
|
|
268
|
+
componentId?: string;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Optional. Represents the style of the InputDropDown component.
|
|
272
|
+
*/
|
|
273
|
+
style?: ViewStyle | ViewStyle[];
|
|
249
274
|
}
|
|
250
275
|
|
|
251
276
|
export {Input, InputTextArea, InputSearch, InputMoney, InputOTP, InputDropDown};
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import {Text} from '../Text';
|
|
|
7
7
|
import {ApplicationContext, MiniAppContext} from '../Application';
|
|
8
8
|
import {Button} from '../Button';
|
|
9
9
|
import {Icon} from '../Icon';
|
|
10
|
+
import {getAccessibilityID} from "../Application/utils";
|
|
10
11
|
|
|
11
12
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
12
13
|
id,
|
|
@@ -108,9 +109,13 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
108
109
|
);
|
|
109
110
|
};
|
|
110
111
|
const renderColumn = () => {
|
|
112
|
+
const accessibilityPrimaryID = getAccessibilityID('btn_popup_allow')
|
|
113
|
+
const accessibilitySecondID = getAccessibilityID('btn_popup_cancel')
|
|
114
|
+
|
|
111
115
|
return (
|
|
112
116
|
<View style={Styles.columnCenter}>
|
|
113
117
|
<Button
|
|
118
|
+
{...accessibilityPrimaryID}
|
|
114
119
|
title={primary.title}
|
|
115
120
|
size="medium"
|
|
116
121
|
onPress={() => {
|
|
@@ -122,6 +127,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
122
127
|
<>
|
|
123
128
|
<View style={styles.buttonSpace} />
|
|
124
129
|
<Button
|
|
130
|
+
{...accessibilitySecondID}
|
|
125
131
|
title={secondary?.title}
|
|
126
132
|
type="text"
|
|
127
133
|
size="medium"
|
|
@@ -155,8 +161,11 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
155
161
|
* build close action
|
|
156
162
|
*/
|
|
157
163
|
const buildCloseIcon = () => {
|
|
164
|
+
const accessibilityCloseID = getAccessibilityID('ic_popup_close')
|
|
165
|
+
|
|
158
166
|
return (
|
|
159
167
|
<TouchableOpacity
|
|
168
|
+
{...accessibilityCloseID}
|
|
160
169
|
style={styles.iconCloseContainer}
|
|
161
170
|
onPress={() => {
|
|
162
171
|
closeAction.current = 'icon_close';
|
|
@@ -180,8 +189,11 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
180
189
|
);
|
|
181
190
|
};
|
|
182
191
|
|
|
192
|
+
const accessibilityID = getAccessibilityID(`pu_${context.code}_notify`)
|
|
193
|
+
|
|
183
194
|
return (
|
|
184
195
|
<View
|
|
196
|
+
{...accessibilityID}
|
|
185
197
|
style={[
|
|
186
198
|
styles.container,
|
|
187
199
|
{backgroundColor: theme.colors.background.surface},
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -5,6 +5,7 @@ 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
|
+
import {getAccessibilityID} from "../Application/utils";
|
|
8
9
|
|
|
9
10
|
const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
10
11
|
id,
|
|
@@ -48,8 +49,10 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
48
49
|
* build close action
|
|
49
50
|
*/
|
|
50
51
|
const buildCloseIcon = () => {
|
|
52
|
+
const accessibilityCloseID = getAccessibilityID('ic_popup_close')
|
|
53
|
+
|
|
51
54
|
return (
|
|
52
|
-
<View style={styles.iconCloseContainer}>
|
|
55
|
+
<View {...accessibilityCloseID} style={styles.iconCloseContainer}>
|
|
53
56
|
<TouchableOpacity
|
|
54
57
|
onPress={() => {
|
|
55
58
|
closeAction.current = 'icon_close';
|
|
@@ -75,9 +78,12 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
75
78
|
</View>
|
|
76
79
|
);
|
|
77
80
|
};
|
|
81
|
+
const accessibilityID = getAccessibilityID(`pu_${context.code}_promotion`)
|
|
78
82
|
|
|
79
83
|
return (
|
|
80
|
-
<View
|
|
84
|
+
<View
|
|
85
|
+
{...accessibilityID}
|
|
86
|
+
>
|
|
81
87
|
<Image
|
|
82
88
|
source={{
|
|
83
89
|
uri: image,
|
package/Radio/index.tsx
CHANGED
|
@@ -4,8 +4,13 @@ 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, MiniAppContext} from '../Application';
|
|
8
8
|
import {Spacing} from '../Consts';
|
|
9
|
+
import {formatNameLength, getAccessibilityID} from '../Application/utils';
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
ScreenContext,
|
|
13
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
9
14
|
|
|
10
15
|
const Radio: FC<RadioProps> = ({
|
|
11
16
|
value,
|
|
@@ -14,8 +19,12 @@ const Radio: FC<RadioProps> = ({
|
|
|
14
19
|
onChange,
|
|
15
20
|
label,
|
|
16
21
|
style,
|
|
22
|
+
params,
|
|
23
|
+
componentId,
|
|
17
24
|
}) => {
|
|
25
|
+
const {appId} = useContext(MiniAppContext)
|
|
18
26
|
const {theme} = useContext(ApplicationContext);
|
|
27
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
19
28
|
const selected = value === groupValue;
|
|
20
29
|
let disabledStyle = {};
|
|
21
30
|
let checkBoxStyle = {
|
|
@@ -36,28 +45,42 @@ const Radio: FC<RadioProps> = ({
|
|
|
36
45
|
: theme.colors.text.disable,
|
|
37
46
|
};
|
|
38
47
|
}
|
|
48
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|rdo_${label}_${value}`)
|
|
39
49
|
|
|
40
50
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
<ScreenContext.Provider
|
|
52
|
+
value={{
|
|
53
|
+
...screenInfo,
|
|
54
|
+
componentName: 'Button',
|
|
55
|
+
params,
|
|
56
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
57
|
+
componentId,
|
|
58
|
+
componentLabel: formatNameLength(label || ''),
|
|
59
|
+
componentValue: value,
|
|
60
|
+
action: 'click',
|
|
61
|
+
}}>
|
|
62
|
+
<TouchableOpacity
|
|
63
|
+
{...accessibilityID}
|
|
64
|
+
onPress={onChange}
|
|
65
|
+
disabled={disabled}
|
|
52
66
|
style={[
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
style,
|
|
68
|
+
{
|
|
69
|
+
flexDirection: 'row',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
},
|
|
72
|
+
]}>
|
|
73
|
+
<View
|
|
74
|
+
style={[
|
|
75
|
+
styles.radio,
|
|
76
|
+
checkBoxStyle,
|
|
77
|
+
disabledStyle,
|
|
78
|
+
{marginRight: label ? Spacing.XS : 0},
|
|
79
|
+
]}
|
|
80
|
+
/>
|
|
81
|
+
{!!label && <Text typography={'body_default_regular'}>{label}</Text>}
|
|
82
|
+
</TouchableOpacity>
|
|
83
|
+
</ScreenContext.Provider>
|
|
61
84
|
);
|
|
62
85
|
};
|
|
63
86
|
|
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
|
+
import {MiniAppContext} from "../Application";
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
ScreenContext,
|
|
11
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
6
12
|
|
|
7
13
|
const Switch: FC<SwitchProps> = props => {
|
|
8
|
-
|
|
14
|
+
const {appId} = useContext(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
|
|
|
@@ -13,20 +22,33 @@ const Switch: FC<SwitchProps> = props => {
|
|
|
13
22
|
if (disabled) {
|
|
14
23
|
backgroundColor = value ? Colors.green_09 : Colors.black_05;
|
|
15
24
|
}
|
|
25
|
+
const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|swt_${value}`)
|
|
16
26
|
|
|
17
27
|
return (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
<ScreenContext.Provider
|
|
29
|
+
value={{
|
|
30
|
+
...screenInfo,
|
|
31
|
+
componentName: 'Button',
|
|
32
|
+
params,
|
|
33
|
+
state: disabled ? 'disabled' : 'enabled',
|
|
34
|
+
componentId,
|
|
35
|
+
componentValue: value,
|
|
36
|
+
action: 'click',
|
|
37
|
+
}}>
|
|
38
|
+
<TouchableOpacity
|
|
39
|
+
{...accessibilityID}
|
|
40
|
+
disabled={disabled}
|
|
41
|
+
onPress={() => onChange?.(!value)}
|
|
42
|
+
style={[
|
|
43
|
+
style,
|
|
44
|
+
styles.container,
|
|
45
|
+
{backgroundColor, alignItems: circleAlign},
|
|
46
|
+
]}>
|
|
47
|
+
<View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
|
|
48
|
+
<View style={[styles.circleSmall, {backgroundColor}]} />
|
|
49
|
+
</View>
|
|
50
|
+
</TouchableOpacity>
|
|
51
|
+
</ScreenContext.Provider>
|
|
30
52
|
);
|
|
31
53
|
};
|
|
32
54
|
|
package/Switch/types.ts
CHANGED
package/index.ts
CHANGED
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
useSafeAreaInsets,
|
|
5
5
|
} from 'react-native-safe-area-context';
|
|
6
6
|
import LinearGradient from 'react-native-linear-gradient';
|
|
7
|
+
import {getAccessibilityID} from "./Application/utils";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* native export
|
|
10
11
|
*/
|
|
11
|
-
export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient};
|
|
12
|
+
export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient, getAccessibilityID};
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* foundation component
|
package/package.json
CHANGED
package/verify.js
CHANGED