@momo-kits/foundation 0.92.1-tracking.7 → 0.92.1-tracking.8

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.
@@ -58,7 +58,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
58
58
  });
59
59
  }, []);
60
60
 
61
- const accessibilityID = getAccessibilityID("tbr_main_bottom")
61
+ const accessibilityID = getAccessibilityID?.("tbr_main_bottom")
62
62
 
63
63
  return (
64
64
  <Tab.Navigator
@@ -75,7 +75,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
75
75
  },
76
76
  }}>
77
77
  {tabs.map(item => {
78
- const itemAccessibilityID = getAccessibilityID(`btn_tabbar_${item.name}`)
78
+ const itemAccessibilityID = getAccessibilityID?.(`btn_tabbar_${item.name}`)
79
79
  return (
80
80
  <Tab.Screen
81
81
  {...itemAccessibilityID}
@@ -30,6 +30,7 @@ import {Icon} from '../Icon';
30
30
  import {PopupNotify} from '../Popup';
31
31
  import {Badge, BadgeDot} from '../Badge';
32
32
  import {getAccessibilityID} from './utils';
33
+ const accessibilityID = getAccessibilityID("title_navigation_header")
33
34
 
34
35
  const NavigationButton: React.FC<NavigationButtonProps> = ({
35
36
  icon,
@@ -65,7 +66,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
65
66
  }
66
67
  }, [badgeType, badgeValue]);
67
68
 
68
- const ID = getAccessibilityID(accessibilityID);
69
+ const ID = getAccessibilityID?.(accessibilityID);
69
70
  return (
70
71
  <View {...ID} style={{width: scaleSize(28)}}>
71
72
  <TouchableOpacity
@@ -90,9 +91,11 @@ const HeaderTitle: React.FC<any> = props => {
90
91
  extrapolate: 'clamp',
91
92
  });
92
93
 
94
+
93
95
  return (
94
96
  <Animated.Text
95
97
  {...props}
98
+ {...accessibilityID}
96
99
  style={[
97
100
  styles.title,
98
101
  {fontFamily: `${theme.font}-Bold`, opacity, color: props.tintColor},
@@ -246,7 +249,9 @@ const HeaderCustom: React.FC<TitleCustomProps> = ({
246
249
  )}
247
250
  </View>
248
251
  <View style={[Styles.flex, {paddingHorizontal: 8}]}>
249
- <Text typography="header_default_bold" color={tintColor}>
252
+ <Text
253
+ {...accessibilityID}
254
+ typography="header_default_bold" color={tintColor}>
250
255
  {title}
251
256
  </Text>
252
257
  <Text typography="description_default_regular" color={tintColor}>
@@ -403,13 +408,13 @@ const HeaderToolkitAction: React.FC<any> = ({
403
408
  },
404
409
  ]}>
405
410
  <TouchableOpacity
406
- {...getAccessibilityID('btn_navigation_more')}
411
+ {...getAccessibilityID?.('btn_navigation_more')}
407
412
  onPress={onMore}>
408
413
  <Icon color={tintColor} source="navigation_more_horiz" size={20} />
409
414
  </TouchableOpacity>
410
415
  <View style={[styles.divider, {backgroundColor: tintColor}]} />
411
416
  <TouchableOpacity
412
- {...getAccessibilityID('btn_navigation_close')}
417
+ {...getAccessibilityID?.('btn_navigation_close')}
413
418
  onPress={onClose}>
414
419
  <Icon
415
420
  color={tintColor}
@@ -155,7 +155,7 @@ const getAccessibilityID = (key = '') => {
155
155
  }
156
156
  };
157
157
 
158
- const formatComponentName = (word: string) => {
158
+ const formatComponentName = (word = '') => {
159
159
  const accentsMap = {
160
160
  a: 'á|à|ả|ã|ạ|â|ấ|ầ|ẩ|ẫ|ậ|ă|ắ|ằ|ẳ|ẵ|ặ',
161
161
  A: 'Á|À|Ả|Ã|Ạ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ|Ă|Ắ|Ằ|Ẳ|Ẵ|Ặ',
@@ -183,7 +183,7 @@ const formatComponentName = (word: string) => {
183
183
  return word;
184
184
  };
185
185
 
186
- const formatNameLength = (name: string) => {
186
+ const formatNameLength = (name = '') => {
187
187
  let formattedName = name;
188
188
  if (formattedName.length > 100) {
189
189
  formattedName = formattedName.substring(0, 100);
package/Button/index.tsx CHANGED
@@ -78,6 +78,8 @@ export interface ButtonProps extends TouchableOpacityProps {
78
78
  params?: any;
79
79
 
80
80
  componentId?: string;
81
+
82
+ accessibilityID?: object
81
83
  }
82
84
 
83
85
  const Button: FC<ButtonProps> = ({
@@ -93,6 +95,7 @@ const Button: FC<ButtonProps> = ({
93
95
  params,
94
96
  componentId,
95
97
  accessibilityLabel,
98
+ accessibilityID,
96
99
  ...rest
97
100
  }) => {
98
101
  const {theme, config} = useContext(ApplicationContext);
@@ -303,7 +306,7 @@ const Button: FC<ButtonProps> = ({
303
306
  };
304
307
 
305
308
  const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
306
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|btn_${title}`)
309
+ const selfAccessibilityID = accessibilityID ? accessibilityID : getAccessibilityID?.(`${appId}/${code}/${screenInfo.screenName}/btn_${title}`)
307
310
  return (
308
311
  <ScreenContext.Provider
309
312
  value={{
@@ -321,7 +324,7 @@ const Button: FC<ButtonProps> = ({
321
324
  }}>
322
325
  <TouchableOpacity
323
326
  {...rest}
324
- {...accessibilityID}
327
+ {...selfAccessibilityID}
325
328
  activeOpacity={activeOpacity}
326
329
  onPress={onPressButton}
327
330
  style={buttonStyle}>
@@ -42,7 +42,7 @@ const CheckBox: FC<CheckBoxProps> = ({
42
42
  backgroundColor = theme.colors.background.tonal;
43
43
  }
44
44
  }
45
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|cbx_${label}_${value}`)
45
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/cbx_${label}_${value}`)
46
46
 
47
47
  return (
48
48
  <ScreenContext.Provider
package/Image/index.tsx CHANGED
@@ -42,7 +42,7 @@ const Image: React.FC<ImageProps> = ({
42
42
  return children;
43
43
  };
44
44
 
45
- const accessibilityID = getAccessibilityID(`img|${source}`)
45
+ const accessibilityID = getAccessibilityID?.(`img|${source}`)
46
46
  return (
47
47
  <FastImage
48
48
  {...rest}
package/Input/Input.tsx CHANGED
@@ -121,6 +121,7 @@ const Input = forwardRef(
121
121
  placeholderColor = disabledColor;
122
122
  iconTintColor = disabledColor;
123
123
  }
124
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}${disabled && "_disabled" }`)
124
125
 
125
126
  return (
126
127
  <View
@@ -149,6 +150,7 @@ const Input = forwardRef(
149
150
  )}
150
151
  <TextInput
151
152
  {...props}
153
+ {...accessibilityID}
152
154
  editable={!disabled}
153
155
  secureTextEntry={secure}
154
156
  textAlignVertical="center"
@@ -202,7 +204,6 @@ const Input = forwardRef(
202
204
  inputState = 'disabled';
203
205
  }
204
206
 
205
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
206
207
 
207
208
  return (
208
209
  <ScreenContext.Provider
@@ -214,7 +215,7 @@ const Input = forwardRef(
214
215
  state: inputState,
215
216
  componentId,
216
217
  }}>
217
- <View {...accessibilityID} style={[style, styles.wrapper]}>
218
+ <View style={[style, styles.wrapper]}>
218
219
  {renderInputView()}
219
220
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
220
221
  </View>
@@ -60,6 +60,7 @@ const InputDropDown = ({
60
60
  placeholderColor = disabledColor;
61
61
  iconTintColor = disabledColor;
62
62
  }
63
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}${disabled && "_disabled" }`)
63
64
 
64
65
  return (
65
66
  <View
@@ -89,6 +90,7 @@ const InputDropDown = ({
89
90
  {full && (
90
91
  <TextInput
91
92
  {...props}
93
+ {...accessibilityID}
92
94
  onPressIn={onPress}
93
95
  editable={false}
94
96
  textAlignVertical="top"
@@ -112,7 +114,6 @@ const InputDropDown = ({
112
114
  );
113
115
  };
114
116
 
115
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
116
117
 
117
118
 
118
119
  return (
@@ -126,7 +127,6 @@ const InputDropDown = ({
126
127
  componentId,
127
128
  }}>
128
129
  <TouchableOpacity
129
- {...accessibilityID}
130
130
  onPress={onPress}
131
131
  style={[style, full && styles.wrapper]}>
132
132
  {renderInputView()}
@@ -104,6 +104,7 @@ const InputMoney = forwardRef(
104
104
  placeholderColor = disabledColor;
105
105
  iconTintColor = disabledColor;
106
106
  }
107
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}${disabled && "_disabled" }`)
107
108
 
108
109
  return (
109
110
  <View
@@ -123,6 +124,7 @@ const InputMoney = forwardRef(
123
124
  <View style={styles.inputView}>
124
125
  <TextInput
125
126
  {...props}
127
+ {...accessibilityID}
126
128
  editable={!disabled}
127
129
  textAlignVertical="top"
128
130
  ref={inputRef}
@@ -173,7 +175,6 @@ const InputMoney = forwardRef(
173
175
  inputState = 'disabled';
174
176
  }
175
177
 
176
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
177
178
 
178
179
  return (
179
180
  <ScreenContext.Provider
@@ -186,7 +187,6 @@ const InputMoney = forwardRef(
186
187
  componentId,
187
188
  }}>
188
189
  <View
189
- {...accessibilityID}
190
190
  style={[style, styles.wrapper]}>
191
191
  {renderInputView()}
192
192
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
@@ -191,6 +191,7 @@ const InputOTP = forwardRef(
191
191
  );
192
192
  };
193
193
 
194
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}`)
194
195
  const renderInputView = () => {
195
196
  return (
196
197
  <View
@@ -216,6 +217,7 @@ const InputOTP = forwardRef(
216
217
  <View style={styles.inputView}>
217
218
  <TextInput
218
219
  {...props}
220
+ {...accessibilityID}
219
221
  ref={inputRef}
220
222
  value={value}
221
223
  onChangeText={_onChangeText}
@@ -230,7 +232,6 @@ const InputOTP = forwardRef(
230
232
  </View>
231
233
  );
232
234
  };
233
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
234
235
 
235
236
  return (
236
237
  <ScreenContext.Provider
@@ -243,7 +244,6 @@ const InputOTP = forwardRef(
243
244
  componentId,
244
245
  }}>
245
246
  <TouchableOpacity
246
- {...accessibilityID}
247
247
  activeOpacity={1}
248
248
  onPress={onFocusInput}
249
249
  style={[style, styles.otpWrapper]}>
@@ -66,11 +66,13 @@ const InputSearch = forwardRef(
66
66
  checkTyping(text, haveValue, setHaveValue);
67
67
  onChangeText?.(text);
68
68
  };
69
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_search`)
69
70
 
70
71
  const renderInputView = () => {
71
72
  return (
72
73
  <TextInput
73
74
  {...props}
75
+ {...accessibilityID}
74
76
  textAlignVertical="center"
75
77
  ref={inputRef}
76
78
  style={[
@@ -139,11 +141,9 @@ const InputSearch = forwardRef(
139
141
  const backgroundColor = hasColorBG
140
142
  ? theme.colors.background.default
141
143
  : theme.colors.background.surface;
142
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_search`)
143
144
 
144
145
  return (
145
146
  <ScreenContext.Provider
146
- {...accessibilityID}
147
147
  value={{
148
148
  ...screenInfo,
149
149
  componentName: 'InputSearch',
@@ -94,6 +94,7 @@ const InputTextArea = forwardRef(
94
94
  textColor = disabledColor;
95
95
  placeholderColor = disabledColor;
96
96
  }
97
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}${disabled && "_disabled" }`)
97
98
 
98
99
  return (
99
100
  <View
@@ -116,6 +117,7 @@ const InputTextArea = forwardRef(
116
117
  <View style={styles.textAreaView}>
117
118
  <TextInput
118
119
  {...props}
120
+ {...accessibilityID}
119
121
  ref={inputRef}
120
122
  editable={!disabled}
121
123
  textAlignVertical="top"
@@ -153,11 +155,9 @@ const InputTextArea = forwardRef(
153
155
  </View>
154
156
  );
155
157
  };
156
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
157
158
 
158
159
  return (
159
160
  <View
160
- {...accessibilityID}
161
161
  style={[style, styles.wrapper]}>
162
162
  {renderInputView()}
163
163
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
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(15),
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(15),
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(15),
111
+ fontSize: scaleSize(14),
112
112
  paddingVertical: Spacing.XS,
113
113
  },
114
114
  searchInputView: {
@@ -109,13 +109,13 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
109
109
  );
110
110
  };
111
111
  const renderColumn = () => {
112
- const accessibilityPrimaryID = getAccessibilityID('btn_popup_allow')
113
- const accessibilitySecondID = getAccessibilityID('btn_popup_cancel')
112
+ const accessibilityPrimaryID = getAccessibilityID?.('btn_popup_allow')
113
+ const accessibilitySecondID = getAccessibilityID?.('btn_popup_cancel')
114
114
 
115
115
  return (
116
116
  <View style={Styles.columnCenter}>
117
117
  <Button
118
- {...accessibilityPrimaryID}
118
+ accessibilityID={accessibilityPrimaryID}
119
119
  title={primary.title}
120
120
  size="medium"
121
121
  onPress={() => {
@@ -127,7 +127,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
127
127
  <>
128
128
  <View style={styles.buttonSpace} />
129
129
  <Button
130
- {...accessibilitySecondID}
130
+ accessibilityID={accessibilitySecondID}
131
131
  title={secondary?.title}
132
132
  type="text"
133
133
  size="medium"
@@ -161,7 +161,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
161
161
  * build close action
162
162
  */
163
163
  const buildCloseIcon = () => {
164
- const accessibilityCloseID = getAccessibilityID('ic_popup_close')
164
+ const accessibilityCloseID = getAccessibilityID?.('ic_popup_close')
165
165
 
166
166
  return (
167
167
  <TouchableOpacity
@@ -189,7 +189,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
189
189
  );
190
190
  };
191
191
 
192
- const accessibilityID = getAccessibilityID(`pu_${context.code}_notify`)
192
+ const accessibilityID = getAccessibilityID?.(`pu_${context.code}_notify`)
193
193
 
194
194
  return (
195
195
  <View
@@ -49,7 +49,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
49
49
  * build close action
50
50
  */
51
51
  const buildCloseIcon = () => {
52
- const accessibilityCloseID = getAccessibilityID('ic_popup_close')
52
+ const accessibilityCloseID = getAccessibilityID?.('ic_popup_close')
53
53
 
54
54
  return (
55
55
  <View {...accessibilityCloseID} style={styles.iconCloseContainer}>
@@ -78,7 +78,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
78
78
  </View>
79
79
  );
80
80
  };
81
- const accessibilityID = getAccessibilityID(`pu_${context.code}_promotion`)
81
+ const accessibilityID = getAccessibilityID?.(`pu_${context.code}_promotion`)
82
82
 
83
83
  return (
84
84
  <View
package/Radio/index.tsx CHANGED
@@ -45,7 +45,7 @@ const Radio: FC<RadioProps> = ({
45
45
  : theme.colors.text.disable,
46
46
  };
47
47
  }
48
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|rdo_${label}_${value}`)
48
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/rdo_${label}_${value}`)
49
49
 
50
50
  return (
51
51
  <ScreenContext.Provider
package/Switch/index.tsx CHANGED
@@ -22,7 +22,7 @@ const Switch: FC<SwitchProps> = props => {
22
22
  if (disabled) {
23
23
  backgroundColor = value ? Colors.green_09 : Colors.black_05;
24
24
  }
25
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|swt_${value}`)
25
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/swt_${value}`)
26
26
 
27
27
  return (
28
28
  <ScreenContext.Provider
package/Text/index.tsx CHANGED
@@ -50,9 +50,11 @@ export interface TextProps extends RNTextProps {
50
50
  * It can be any valid color string (e.g., hex, rgb, rgba, etc.).
51
51
  */
52
52
  color?: string;
53
+
54
+ children?: any
53
55
  }
54
56
  const Text: React.FC<TextProps> = ({
55
- typography,
57
+ typography='body_default_regular',
56
58
  color,
57
59
  children,
58
60
  style,
@@ -103,8 +105,4 @@ const Text: React.FC<TextProps> = ({
103
105
  );
104
106
  };
105
107
 
106
- Text.defaultProps = {
107
- typography: 'body_default_regular',
108
- };
109
-
110
108
  export {Text, scaleSize};
package/Text/styles.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export default {
2
- headline_default_bold: {fontSize: 24, lineHeight: 32, fontWeight: '700'},
3
- header_m_bold: {fontSize: 18, lineHeight: 28, fontWeight: '700'},
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: 16, fontWeight: '600'},
6
+ header_xs_semibold: {fontSize: 12, lineHeight: 18, fontWeight: '600'},
7
7
  body_default_regular: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
8
8
  body_regularstrikethrought: {
9
9
  fontSize: 14,
@@ -13,28 +13,28 @@ export default {
13
13
  },
14
14
  description_default_regular: {
15
15
  fontSize: 12,
16
- lineHeight: 16,
16
+ lineHeight: 18,
17
17
  fontWeight: '400',
18
18
  },
19
19
  description_default_regularstrikethrought: {
20
20
  fontSize: 12,
21
- lineHeight: 16,
21
+ lineHeight: 18,
22
22
  fontWeight: '400',
23
23
  textDecorationLine: 'line-through',
24
24
  },
25
- description_xs_regular: {fontSize: 10, lineHeight: 14, fontWeight: '400'},
26
- description_xs_regularstrikethrought: {
25
+ description_s_regular: {fontSize: 10, lineHeight: 14, fontWeight: '400'},
26
+ description_s_regularstrikethrought: {
27
27
  fontSize: 10,
28
28
  lineHeight: 14,
29
29
  fontWeight: '400',
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: 16, fontWeight: '500'},
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: 16, fontWeight: '700'},
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.1-tracking.7",
3
+ "version": "0.92.1-tracking.8",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {