@momo-kits/foundation 0.114.0-beta.2 → 0.114.0-beta.4

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.
@@ -12,10 +12,8 @@ import {BadgeDot} from '../../Badge';
12
12
  const NavigationButton: React.FC<NavigationButtonProps> = ({
13
13
  icon,
14
14
  tintColor,
15
- onPress,
16
15
  showBadge = false,
17
- accessibilityLabel = '',
18
- disabled = false,
16
+ ...props
19
17
  }) => {
20
18
  const {theme} = useContext(ApplicationContext);
21
19
  let buttonStyle: ViewStyle = {};
@@ -29,10 +27,8 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
29
27
  return (
30
28
  <View style={{width: 28}}>
31
29
  <TouchableOpacity
32
- disabled={disabled}
33
- accessibilityLabel={accessibilityLabel}
30
+ {...props}
34
31
  style={[styles.navigationButton, buttonStyle]}
35
- onPress={onPress}
36
32
  hitSlop={{top: 7, bottom: 7, left: 7, right: 7}}>
37
33
  <Icon
38
34
  source={icon}
@@ -138,11 +138,11 @@ const StackScreen: React.FC<ScreenParams> = props => {
138
138
  });
139
139
  if (
140
140
  context.debugLastElement &&
141
- lastElement.current?.children?.current?.length > 0
141
+ lastElement.current?.children?.length > 0
142
142
  ) {
143
143
  Alert.alert(
144
144
  `${screenName}- load ${timeLoad}ms`,
145
- JSON.stringify(lastElement.current?.children?.current)
145
+ JSON.stringify(lastElement.current?.children)
146
146
  );
147
147
  }
148
148
  }
@@ -1,7 +1,12 @@
1
1
  import {EventArg} from '@react-navigation/core';
2
2
  import {StackNavigationOptions} from '@react-navigation/stack';
3
3
  import React, {ReactNode} from 'react';
4
- import {Animated, ViewProps, ViewStyle} from 'react-native';
4
+ import {
5
+ Animated,
6
+ TouchableOpacityProps,
7
+ ViewProps,
8
+ ViewStyle,
9
+ } from 'react-native';
5
10
  import {PopupNotifyProps} from '../Popup/types';
6
11
  import Localize from './Localize';
7
12
  import Navigation from './Navigation';
@@ -147,14 +152,11 @@ export type BottomSheetParams = {
147
152
  keyboardVerticalOffset?: number;
148
153
  };
149
154
 
150
- export type NavigationButtonProps = {
155
+ export interface NavigationButtonProps extends TouchableOpacityProps {
151
156
  icon: string;
152
157
  tintColor?: string;
153
- onPress: () => void;
154
158
  showBadge?: boolean;
155
- accessibilityLabel?: string;
156
- disabled?: boolean;
157
- };
159
+ }
158
160
 
159
161
  export type HeaderTitleProps = {
160
162
  type: 'default' | 'user' | 'location' | 'journey';
@@ -169,6 +169,14 @@ const setAutomationID = (accessibilityLabel = '') => {
169
169
  }
170
170
  };
171
171
 
172
+ export const getImageName = (source: any): string => {
173
+ const parts = source?.uri?.split?.('/');
174
+ if (parts?.length > 0) {
175
+ return parts?.[parts.length - 1];
176
+ }
177
+ return '';
178
+ };
179
+
172
180
  export {
173
181
  getStackOptions,
174
182
  getDialogOptions,
package/Badge/Badge.tsx CHANGED
@@ -7,12 +7,7 @@ import styles from './styles';
7
7
  import {Colors} from '../Consts';
8
8
  import {Text} from '../Text';
9
9
 
10
- const Badge: FC<BadgeProps> = ({
11
- label = 'Label',
12
- style,
13
- backgroundColor,
14
- accessibilityLabel,
15
- }) => {
10
+ const Badge: FC<BadgeProps> = ({label = 'Label', style, backgroundColor}) => {
16
11
  const {theme} = useContext(ApplicationContext);
17
12
 
18
13
  const isValidatedColor = () => {
@@ -51,10 +46,7 @@ const Badge: FC<BadgeProps> = ({
51
46
 
52
47
  return (
53
48
  <View style={[style, styles.badge, {backgroundColor: badgeColor}]}>
54
- <Text
55
- color={Colors.black_01}
56
- typography={'action_xxs_bold'}
57
- accessibilityLabel={accessibilityLabel}>
49
+ <Text color={Colors.black_01} typography={'action_xxs_bold'}>
58
50
  {formatTitle()}
59
51
  </Text>
60
52
  </View>
package/Badge/types.ts CHANGED
@@ -18,8 +18,6 @@ export type BadgeProps = {
18
18
  * Optional. Custom background badge.
19
19
  */
20
20
  backgroundColor?: string;
21
-
22
- accessibilityLabel?: string;
23
21
  };
24
22
 
25
23
  /**
package/Button/index.tsx CHANGED
@@ -76,8 +76,6 @@ export interface ButtonProps extends TouchableOpacityProps {
76
76
  onPress: () => void;
77
77
 
78
78
  params?: any;
79
-
80
- accessibilityLabelTitle?: string;
81
79
  }
82
80
 
83
81
  const Button: FC<ButtonProps> = ({
@@ -89,19 +87,14 @@ const Button: FC<ButtonProps> = ({
89
87
  iconLeft,
90
88
  loading = false,
91
89
  title = 'Button',
92
- onPress,
93
90
  params,
94
- accessibilityLabelTitle,
95
91
  ...rest
96
92
  }) => {
97
93
  const {theme, config} = useContext(ApplicationContext);
98
94
  const skeleton = useContext(SkeletonContext);
99
95
  const {gradient, color} = config?.navigationBar?.buttonColors ?? {};
100
96
  let gradientPros;
101
- let state = 'enabled';
102
- if (loading) {
103
- state = 'loading';
104
- }
97
+
105
98
  if (gradient?.length > 0 && type === 'primary') {
106
99
  gradientPros = {
107
100
  colors: gradient,
@@ -227,11 +220,7 @@ const Button: FC<ButtonProps> = ({
227
220
  const typography = getTypography();
228
221
  const textColor = getTextColor();
229
222
  return (
230
- <Text
231
- typography={typography}
232
- color={textColor}
233
- numberOfLines={1}
234
- accessibilityLabel={accessibilityLabelTitle}>
223
+ <Text typography={typography} color={textColor} numberOfLines={1}>
235
224
  {title}
236
225
  </Text>
237
226
  );
@@ -310,19 +299,14 @@ const Button: FC<ButtonProps> = ({
310
299
  value={{
311
300
  componentName: 'Button',
312
301
  params,
313
- state: state,
314
- componentValue: title,
315
302
  action: 'click',
316
303
  }}>
317
304
  <TouchableOpacity
318
305
  {...rest}
306
+ accessibilityRole="button"
307
+ accessibilityState={{disabled: type === 'disabled', busy: loading}}
319
308
  disabled={type === 'disabled'}
320
- accessibilityState={{
321
- ...rest.accessibilityState,
322
- disabled: type === 'disabled',
323
- }}
324
309
  activeOpacity={0.5}
325
- onPress={onPress}
326
310
  style={buttonStyle}>
327
311
  {renderLeading()}
328
312
  {renderTitle()}
@@ -14,9 +14,7 @@ const CheckBox: FC<CheckBoxProps> = ({
14
14
  label,
15
15
  indeterminate,
16
16
  params,
17
- accessibilityLabel,
18
- accessibilityState,
19
- accessibilityLabelLabel,
17
+ ...props
20
18
  }) => {
21
19
  const {theme} = useContext(ApplicationContext);
22
20
  const haveValue = value || indeterminate;
@@ -45,11 +43,9 @@ const CheckBox: FC<CheckBoxProps> = ({
45
43
  params,
46
44
  state: disabled ? 'disabled' : 'filled',
47
45
  action: 'click',
48
- componentValue: indeterminate ? 'undetermined' : value,
49
46
  }}>
50
47
  <TouchableOpacity
51
- accessibilityLabel={accessibilityLabel}
52
- accessibilityState={accessibilityState}
48
+ {...props}
53
49
  activeOpacity={0.8}
54
50
  onPress={() => onChange?.(!value)}
55
51
  disabled={disabled}
@@ -67,13 +63,7 @@ const CheckBox: FC<CheckBoxProps> = ({
67
63
  />
68
64
  )}
69
65
  </View>
70
- {!!label && (
71
- <Text
72
- typography={'body_default_regular'}
73
- accessibilityLabel={accessibilityLabelLabel}>
74
- {label}
75
- </Text>
76
- )}
66
+ {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
77
67
  </TouchableOpacity>
78
68
  </ComponentContext.Provider>
79
69
  );
package/CheckBox/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import {TouchableOpacityProps, ViewStyle} from 'react-native';
1
+ import {TouchableOpacityProps} from 'react-native';
2
2
 
3
3
  export interface CheckBoxProps extends TouchableOpacityProps {
4
4
  /**
@@ -31,15 +31,7 @@ export interface CheckBoxProps extends TouchableOpacityProps {
31
31
  indeterminate?: boolean;
32
32
 
33
33
  /**
34
- * Optional. Used to apply custom styling to the CheckBox component.
35
- * Accepts an object of style properties.
34
+ * Optional. Represents the accessibility label for the CheckBox.
36
35
  */
37
- style?: ViewStyle;
38
-
39
36
  params?: any;
40
-
41
- /**
42
- * Optional. Represents the label for the CheckBox component.
43
- */
44
- accessibilityLabelLabel?: string;
45
37
  }
package/Icon/index.tsx CHANGED
@@ -10,7 +10,7 @@ const Icon: React.FC<IconProps> = ({
10
10
  size = 24,
11
11
  color,
12
12
  style = {},
13
- accessibilityLabel,
13
+ ...props
14
14
  }) => {
15
15
  const {theme} = useContext(ApplicationContext);
16
16
 
@@ -31,11 +31,11 @@ const Icon: React.FC<IconProps> = ({
31
31
 
32
32
  return (
33
33
  <Image
34
+ {...props}
34
35
  loading={false}
35
36
  source={getIconSource()}
36
37
  style={[style, {width: size, height: size}]}
37
38
  resizeMode="contain"
38
- accessibilityLabel={accessibilityLabel}
39
39
  {...tintColorProps}
40
40
  />
41
41
  );
package/Icon/types.ts CHANGED
@@ -24,9 +24,4 @@ export type IconProps = {
24
24
  * Accepts an object of style properties.
25
25
  */
26
26
  style?: StyleProp<ImageStyle>;
27
-
28
- /**
29
- * Optional. Represents the accessibility label for the icon.
30
- */
31
- accessibilityLabel?: string;
32
27
  };
@@ -26,6 +26,9 @@ export interface IconButtonProps extends TouchableOpacityProps {
26
26
  */
27
27
  size?: 'large' | 'small';
28
28
 
29
+ /**
30
+ * Optional. Params for tracking
31
+ */
29
32
  params?: any;
30
33
  }
31
34
 
@@ -33,9 +36,7 @@ const IconButton: React.FC<IconButtonProps> = ({
33
36
  type = 'primary',
34
37
  icon,
35
38
  size,
36
- onPress,
37
39
  params,
38
- accessibilityLabel,
39
40
  ...rest
40
41
  }) => {
41
42
  const {theme} = useContext(ApplicationContext);
@@ -118,15 +119,12 @@ const IconButton: React.FC<IconButtonProps> = ({
118
119
  componentName: 'IconButton',
119
120
  params,
120
121
  state: type === 'disabled' ? 'disabled' : 'enabled',
121
- componentValue: icon,
122
122
  action: 'click',
123
123
  }}>
124
124
  <TouchableOpacity
125
125
  {...rest}
126
126
  disabled={type === 'disabled'}
127
- accessibilityLabel={accessibilityLabel}
128
127
  activeOpacity={activeOpacity}
129
- onPress={onPress}
130
128
  style={buttonStyle}>
131
129
  <Icon size={iconSize} source={icon} color={getIconColor()} />
132
130
  </TouchableOpacity>
package/Image/index.tsx CHANGED
@@ -1,12 +1,13 @@
1
1
  import React, {useContext, useRef, useState} from 'react';
2
2
  import {StyleSheet, View} from 'react-native';
3
- import FastImage, {Source} from 'react-native-fast-image';
3
+ import FastImage from 'react-native-fast-image';
4
4
  import styles from './styles';
5
5
  import {ApplicationContext, SkeletonContext} from '../Application';
6
6
  import {Skeleton} from '../Skeleton';
7
7
  import {Icon} from '../Icon';
8
8
  import {Styles} from '../Consts';
9
9
  import {ImageProps} from './types';
10
+ import {getImageName} from '../Application/utils';
10
11
 
11
12
  type Status = 'success' | 'loading' | 'error';
12
13
 
@@ -24,7 +25,7 @@ const Image: React.FC<ImageProps> = ({
24
25
  const [status, setStatus] = useState<Status>('success');
25
26
 
26
27
  const test: any = {
27
- accessibilityLabel: accessibilityLabel || `img|${(source as Source).uri}`,
28
+ accessibilityLabel: accessibilityLabel || `img|${getImageName(source)}`,
28
29
  };
29
30
 
30
31
  /**
package/Input/Input.tsx CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  ApplicationContext,
18
18
  ComponentContext,
19
- setAutomationID,
19
+ MiniAppContext,
20
20
  } from '../Application';
21
21
  import {Icon} from '../Icon';
22
22
  import {Loader} from '../Loader';
@@ -41,9 +41,6 @@ const Input = forwardRef(
41
41
  onBlur,
42
42
  onFocus,
43
43
  errorMessage,
44
- icon,
45
- iconColor,
46
- onPressIcon,
47
44
  trailing,
48
45
  trailingColor,
49
46
  onPressTrailing,
@@ -60,25 +57,23 @@ const Input = forwardRef(
60
57
  style,
61
58
  params,
62
59
  hintText,
63
- accessibilityLabel,
64
60
  editable = true,
65
61
  onPressFloatingIcon,
66
62
  onPressLeadingIcon,
67
63
  showClearIcon = true,
68
- accessibilityLabelErrorMessage,
69
- accessibilityLabelFloatingValue,
70
- accessibilityLabelLeadingIcon,
71
- accessibilityLabelTrailingIcon,
72
- accessibilityLabelClearIcon,
73
64
  ...props
74
65
  }: InputProps,
75
66
  ref
76
67
  ) => {
77
68
  const {theme} = useContext(ApplicationContext);
69
+ const app = useContext<any>(MiniAppContext);
70
+ const screen = useContext<any>(MiniAppContext);
78
71
  const [focused, setFocused] = useState(false);
79
72
  const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
80
73
  const [secureTextInput, setSecureTextInput] = useState(secureTextEntry);
81
74
  const inputRef = useRef<TextInput | null>(null);
75
+ const componentName = 'Input';
76
+ const componentId = `${app.appId}/${app.code}/${screen.screenName}/${componentName}|${placeholder}`;
82
77
 
83
78
  const onClearText = () => {
84
79
  inputRef?.current?.clear();
@@ -126,8 +121,7 @@ const Input = forwardRef(
126
121
  return (
127
122
  <TouchableOpacity
128
123
  onPress={() => setSecureTextInput(!secureTextInput)}
129
- style={styles.icon}
130
- accessibilityLabel={accessibilityLabelTrailingIcon}>
124
+ style={styles.icon}>
131
125
  <Icon
132
126
  color={color}
133
127
  size={24}
@@ -138,24 +132,20 @@ const Input = forwardRef(
138
132
  </TouchableOpacity>
139
133
  );
140
134
  }
141
- if (icon || trailing) {
135
+ if (trailing) {
142
136
  const renderIconTouchable = (icon: ReactNode) => {
143
137
  return (
144
138
  <TouchableOpacity
145
- onPress={onPressTrailing ?? onPressIcon}
146
- style={styles.icon}>
139
+ onPress={onPressTrailing}
140
+ style={styles.icon}
141
+ accessibilityLabel={`${accessibilityLabel}/trailing`}>
147
142
  {icon}
148
143
  </TouchableOpacity>
149
144
  );
150
145
  };
151
- const trailingValue = icon || trailing;
152
- if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
146
+ if (trailing?.includes('_') || trailing?.includes('http')) {
153
147
  return renderIconTouchable(
154
- <Icon
155
- color={color}
156
- source={(icon || trailing) as string}
157
- size={24}
158
- />
148
+ <Icon color={color} source={trailing} size={24} />
159
149
  );
160
150
  }
161
151
  return renderIconTouchable(
@@ -163,7 +153,7 @@ const Input = forwardRef(
163
153
  typography="action_xs_bold"
164
154
  color={color ?? theme.colors.primary}
165
155
  numberOfLines={1}>
166
- {trailingValue!.substring(0, 15)}
156
+ {trailing!.substring(0, 15)}
167
157
  </Text>
168
158
  );
169
159
  }
@@ -177,7 +167,7 @@ const Input = forwardRef(
177
167
  const secure = secureTextInput && secureTextEntry;
178
168
  let textColor = theme.colors.text.default;
179
169
  let placeholderColor = theme.colors.text.hint;
180
- let iconTintColor = trailingColor ?? iconColor;
170
+ let iconTintColor = trailingColor;
181
171
 
182
172
  if (disabled) {
183
173
  textColor = disabledColor;
@@ -200,14 +190,14 @@ const Input = forwardRef(
200
190
  required={required}
201
191
  floatingIcon={floatingIcon}
202
192
  onPress={onPressFloatingIcon}
203
- accessibilityLabel={accessibilityLabelFloatingValue}
193
+ accessibilityLabel={accessibilityLabel}
204
194
  />
205
195
  <View style={styles.inputView}>
206
196
  {!!leadingIcon && (
207
197
  <View style={styles.leadingIconContainer}>
208
198
  <TouchableOpacity
209
199
  onPress={onPressLeadingIcon}
210
- accessibilityLabel={accessibilityLabelLeadingIcon}>
200
+ accessibilityLabel={`${accessibilityLabel}/floating_icon-${leadingIcon}`}>
211
201
  <Icon
212
202
  color={leadingIconColor}
213
203
  source={leadingIcon}
@@ -218,11 +208,7 @@ const Input = forwardRef(
218
208
  )}
219
209
  <TextInput
220
210
  {...props}
221
- {...setAutomationID(accessibilityLabel)}
222
- accessibilityState={{
223
- ...props.accessibilityState,
224
- disabled: disabled,
225
- }}
211
+ accessibilityLabel={`${componentId}/input`}
226
212
  editable={editable && !disabled}
227
213
  secureTextEntry={secure}
228
214
  textAlignVertical="center"
@@ -250,9 +236,9 @@ const Input = forwardRef(
250
236
  <View style={styles.iconView}>
251
237
  {showClearIcon && focused && haveValue && (
252
238
  <TouchableOpacity
239
+ accessibilityLabel={`${accessibilityLabel}/clear_icon`}
253
240
  style={styles.iconWrapper}
254
- onPress={onClearText}
255
- accessibilityLabel={accessibilityLabelClearIcon}>
241
+ onPress={onClearText}>
256
242
  <Icon
257
243
  source="24_navigation_close_circle_full"
258
244
  size={16}
@@ -277,20 +263,23 @@ const Input = forwardRef(
277
263
  inputState = 'disabled';
278
264
  }
279
265
 
266
+ const accessibilityLabel = props.accessibilityLabel ?? componentId;
280
267
  return (
281
268
  <ComponentContext.Provider
282
269
  value={{
283
- componentName: 'Input',
270
+ componentName,
284
271
  params,
285
272
  state: inputState,
286
273
  }}>
287
- <View style={[style, styles.wrapper]}>
274
+ <View
275
+ style={[style, styles.wrapper]}
276
+ accessibilityLabel={accessibilityLabel}>
288
277
  {renderInputView()}
289
278
  <ErrorView
290
279
  errorMessage={errorMessage}
291
280
  errorSpacing={errorSpacing}
292
281
  hintText={hintText}
293
- accessibilityLabel={accessibilityLabelErrorMessage}
282
+ accessibilityLabel={accessibilityLabel}
294
283
  />
295
284
  </View>
296
285
  </ComponentContext.Provider>
@@ -14,7 +14,6 @@ const InputDropDown = ({
14
14
  floatingIcon,
15
15
  onPressFloatingIcon,
16
16
  size = 'small',
17
- onPress,
18
17
  placeholder,
19
18
  errorMessage,
20
19
  disabled = false,
@@ -25,13 +24,9 @@ const InputDropDown = ({
25
24
  leadingIconColor,
26
25
  style,
27
26
  params,
28
- accessibilityLabel,
29
27
  hintText,
30
28
  multiline,
31
- accessibilityLabelText,
32
- accessibilityLabelTouchable,
33
- accessibilityLabelErrorMessage,
34
- accessibilityLabelFloatingValue,
29
+ ...props
35
30
  }: InputDropDownProps) => {
36
31
  const {theme} = useContext(ApplicationContext);
37
32
 
@@ -54,16 +49,15 @@ const InputDropDown = ({
54
49
  styles.inputDropDownWrapper,
55
50
  {backgroundColor: theme.colors.background.surface},
56
51
  getSizeStyle(size, multiline),
57
- getBorderColor(theme, false, errorMessage, disabled),
52
+ getBorderColor(theme, false, errorMessage, disabled as boolean),
58
53
  ]}>
59
54
  <FloatingView
60
55
  floatingValue={floatingValue}
61
56
  floatingIconColor={floatingIconColor}
62
- disabled={disabled}
57
+ disabled={disabled as boolean}
63
58
  required={required}
64
59
  floatingIcon={floatingIcon}
65
60
  onPress={onPressFloatingIcon}
66
- accessibilityLabel={accessibilityLabelFloatingValue}
67
61
  />
68
62
  <View style={styles.inputDropDownView}>
69
63
  {!!leadingIcon && (
@@ -82,14 +76,11 @@ const InputDropDown = ({
82
76
  />
83
77
  </View>
84
78
  )}
85
- <View
86
- accessibilityLabel={accessibilityLabel}
87
- style={styles.textViewDropDown}>
79
+ <View style={styles.textViewDropDown}>
88
80
  <Text
89
81
  numberOfLines={multiline ? undefined : 1}
90
82
  typography={'body_default_regular'}
91
- color={value ? textColor : placeholderColor}
92
- accessibilityLabel={accessibilityLabelText}>
83
+ color={value ? textColor : placeholderColor}>
93
84
  {value || placeholder}
94
85
  </Text>
95
86
  </View>
@@ -116,18 +107,14 @@ const InputDropDown = ({
116
107
  state: 'enabled',
117
108
  }}>
118
109
  <TouchableOpacity
110
+ {...props}
119
111
  activeOpacity={0.6}
120
- onPress={onPress}
121
- style={[style, styles.wrapper]}
122
- accessibilityLabel={accessibilityLabelTouchable}
123
- accessibilityState={{disabled}}
124
- disabled={disabled}>
112
+ style={[style, styles.wrapper]}>
125
113
  {renderInputView()}
126
114
  <ErrorView
127
115
  errorMessage={errorMessage}
128
116
  errorSpacing={errorSpacing}
129
117
  hintText={hintText}
130
- accessibilityLabel={accessibilityLabelErrorMessage}
131
118
  />
132
119
  </TouchableOpacity>
133
120
  </ComponentContext.Provider>
@@ -37,9 +37,6 @@ const InputMoney = forwardRef(
37
37
  onBlur,
38
38
  onFocus,
39
39
  errorMessage,
40
- icon,
41
- iconColor,
42
- onPressIcon,
43
40
  trailing,
44
41
  trailingColor,
45
42
  onPressTrailing,
@@ -50,15 +47,12 @@ const InputMoney = forwardRef(
50
47
  style,
51
48
  params,
52
49
  defaultValue = '',
53
- accessibilityLabel,
54
50
  hintText,
55
51
  value: _value,
56
52
  onPressFloatingIcon,
57
53
  placeholder = '0đ',
58
54
  currency = 'đ',
59
55
  showClearIcon = true,
60
- accessibilityLabelErrorMessage,
61
- accessibilityLabelFloatingValue,
62
56
  ...props
63
57
  }: InputMoneyProps,
64
58
  ref
@@ -121,7 +115,7 @@ const InputMoney = forwardRef(
121
115
  const disabledColor = theme.colors.text.disable;
122
116
  let textColor = theme.colors.text.default;
123
117
  let placeholderColor = theme.colors.text.hint;
124
- let iconTintColor = trailingColor ?? iconColor;
118
+ let iconTintColor = trailingColor;
125
119
 
126
120
  if (disabled) {
127
121
  textColor = disabledColor;
@@ -144,16 +138,10 @@ const InputMoney = forwardRef(
144
138
  required={required}
145
139
  floatingIcon={floatingIcon}
146
140
  onPress={onPressFloatingIcon}
147
- accessibilityLabel={accessibilityLabelFloatingValue}
148
141
  />
149
142
  <View style={styles.inputView}>
150
143
  <TextInput
151
144
  {...props}
152
- accessibilityLabel={accessibilityLabel}
153
- accessibilityState={{
154
- ...props.accessibilityState,
155
- disabled: disabled,
156
- }}
157
145
  editable={!disabled}
158
146
  ref={inputRef}
159
147
  keyboardType={'number-pad'}
@@ -187,10 +175,10 @@ const InputMoney = forwardRef(
187
175
  )}
188
176
  <RenderTrailing
189
177
  color={iconTintColor}
190
- icon={icon}
178
+ icon={trailing}
191
179
  trailing={trailing}
192
180
  onPressTrailing={onPressTrailing}
193
- onPressIcon={onPressIcon}
181
+ onPressIcon={onPressTrailing}
194
182
  loading={loading}
195
183
  />
196
184
  </View>
@@ -224,7 +212,6 @@ const InputMoney = forwardRef(
224
212
  errorMessage={errorMessage}
225
213
  errorSpacing={errorSpacing}
226
214
  hintText={hintText}
227
- accessibilityLabel={accessibilityLabelErrorMessage}
228
215
  />
229
216
  </View>
230
217
  </ComponentContext.Provider>
@@ -77,7 +77,6 @@ const InputOTP = forwardRef(
77
77
  dataType = 'number',
78
78
  params,
79
79
  style,
80
- accessibilityLabel,
81
80
  hintText,
82
81
  ...props
83
82
  }: InputOTPProps,
@@ -210,7 +209,6 @@ const InputOTP = forwardRef(
210
209
  <View style={styles.otpRealInputWrapper}>
211
210
  <TextInput
212
211
  {...props}
213
- accessibilityLabel={accessibilityLabel}
214
212
  ref={inputRef}
215
213
  value={value}
216
214
  onChangeText={_onChangeText}
@@ -118,9 +118,6 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
118
118
  onFocus,
119
119
  onBlur,
120
120
  value,
121
- icon,
122
- iconColor,
123
- onPressIcon,
124
121
  trailing,
125
122
  trailingColor,
126
123
  onPressTrailing,
@@ -132,7 +129,6 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
132
129
  onPressButtonText,
133
130
  params,
134
131
  backgroundColor,
135
- accessibilityLabel,
136
132
  onPress,
137
133
  typingData,
138
134
  ...props
@@ -202,7 +198,6 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
202
198
  return (
203
199
  <TextInput
204
200
  {...props}
205
- accessibilityLabel={accessibilityLabel}
206
201
  textAlignVertical="center"
207
202
  allowFontScaling={false}
208
203
  ref={inputRef}
@@ -239,10 +234,8 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
239
234
  />
240
235
  </TouchableOpacity>
241
236
  )}
242
- {!!(icon || trailing) && (
243
- <TouchableOpacity
244
- style={Styles.row}
245
- onPress={onPressTrailing ?? onPressIcon}>
237
+ {!!trailing && (
238
+ <TouchableOpacity style={Styles.row} onPress={onPressTrailing}>
246
239
  <View
247
240
  style={[
248
241
  styles.divider,
@@ -252,8 +245,8 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
252
245
  ]}
253
246
  />
254
247
  <Icon
255
- color={iconColor || trailingColor}
256
- source={(icon || trailing) as string}
248
+ color={trailingColor}
249
+ source={trailing as string}
257
250
  style={styles.iconSearchInput}
258
251
  />
259
252
  </TouchableOpacity>
package/Input/common.tsx CHANGED
@@ -17,12 +17,12 @@ import IconSources from '../Assets/icon.json';
17
17
  type FloatingViewProps = {
18
18
  floatingValue?: string;
19
19
  floatingIconColor?: string;
20
+ accessibilityLabel?: string;
20
21
  disabled?: boolean;
21
22
  floatingIcon?: string;
22
23
  required?: boolean;
23
24
  style?: ViewStyle;
24
25
  onPress?: (e: GestureResponderEvent) => void;
25
- accessibilityLabel?: string;
26
26
  };
27
27
 
28
28
  type TrailingProps = {
@@ -98,9 +98,11 @@ export const ErrorView: FC<{
98
98
  />
99
99
  </View>
100
100
  <Text
101
+ accessibilityLabel={`${accessibilityLabel}/${
102
+ errorMessage ? 'error' : 'hint'
103
+ }-${errorMessage ?? hintTextDefault}`}
101
104
  style={Styles.flex}
102
105
  color={errorMessage ? errorColor : hintColor}
103
- accessibilityLabel={accessibilityLabel}
104
106
  typography={'description_default_regular'}>
105
107
  {errorMessage ?? hintTextDefault}
106
108
  </Text>
@@ -146,7 +148,7 @@ export const FloatingView: FC<FloatingViewProps> = ({
146
148
  <Text
147
149
  color={floatingTextColor}
148
150
  typography={'label_s_medium'}
149
- accessibilityLabel={accessibilityLabel}>
151
+ accessibilityLabel={`${accessibilityLabel}/floating-${floatingValue}`}>
150
152
  {floatingValue}
151
153
  {required && (
152
154
  <Text
package/Input/index.tsx CHANGED
@@ -1,4 +1,8 @@
1
- import {GestureResponderEvent, TextInputProps, ViewStyle} from 'react-native';
1
+ import {
2
+ GestureResponderEvent,
3
+ TextInputProps,
4
+ TouchableOpacityProps,
5
+ } from 'react-native';
2
6
  import Input from './Input';
3
7
  import InputDropDown from './InputDropDown';
4
8
  import InputMoney from './InputMoney';
@@ -29,24 +33,6 @@ export interface InputProps extends TextInputProps {
29
33
  */
30
34
  errorMessage?: string;
31
35
 
32
- /**
33
- * @deprecated Use `trailing` instead.
34
- * Optional. Represents the name or key of the icon to be displayed in the Input component.
35
- */
36
- icon?: string;
37
-
38
- /**
39
- * @deprecated Use `trailingColor` instead.
40
- * Optional. Represents the color of the icon in the Input component.
41
- */
42
- iconColor?: string;
43
-
44
- /**
45
- * @deprecated Use `onPressTrailing` instead.
46
- * Optional. callback function to be called when the icon is pressed.
47
- */
48
- onPressIcon?: () => void;
49
-
50
36
  /**
51
37
  * Optional. Represents the name or key of the icon to be displayed in the Input component.
52
38
  */
@@ -131,36 +117,6 @@ export interface InputProps extends TextInputProps {
131
117
  * Optional. Represents the style of the Input component.
132
118
  */
133
119
  showClearIcon?: boolean;
134
-
135
- /**
136
- * Optional. Represents the accessibility label for the error message.
137
- * This is read out by screen readers.
138
- */
139
- accessibilityLabelErrorMessage?: string;
140
-
141
- /**
142
- * Optional. Represents the accessibility label for the Floating Value.
143
- * This is read out by screen readers.
144
- */
145
- accessibilityLabelFloatingValue?: string;
146
-
147
- /**
148
- * Optional. Represents the accessibility label for the leading Icon.
149
- * This is read out by screen readers.
150
- */
151
- accessibilityLabelLeadingIcon?: string;
152
-
153
- /**
154
- * Optional. Represents the accessibility label for the trailing Icon.
155
- * This is read out by screen readers.
156
- */
157
- accessibilityLabelTrailingIcon?: string;
158
-
159
- /**
160
- * Optional. Represents the accessibility label for the clear Icon.
161
- * This is read out by screen readers.
162
- */
163
- accessibilityLabelClearIcon?: string;
164
120
  }
165
121
 
166
122
  export interface InputTextAreaProps extends Omit<InputProps, 'size'> {
@@ -282,8 +238,7 @@ export type CaretProps = {
282
238
  length?: number;
283
239
  };
284
240
 
285
- export interface InputDropDownProps
286
- extends Omit<InputProps, 'trailing' | 'trailingColor' | 'onPressTrailing'> {
241
+ export interface InputDropDownProps extends TouchableOpacityProps {
287
242
  /**
288
243
  * Optional. Defines the size of the InputDropDown component.
289
244
  * 'small' - A smaller, less prominent input.
@@ -292,51 +247,100 @@ export interface InputDropDownProps
292
247
  size?: 'small' | 'large';
293
248
 
294
249
  /**
295
- * Optional. Function to be called when the InputDropDown is pressed.
250
+ * Optional. Represents the text to be displayed in the InputDropDown component.
296
251
  */
297
- onPress?: () => void;
252
+ value?: string;
298
253
 
299
254
  /**
300
- * Optional. If `true`, the user won't be able to interact with the InputDropDown component.
301
- * Defaults to `false` if not provided.
255
+ * Optional. Represents the placeholder text to be displayed in the InputDropDown component.
302
256
  */
303
- disabled?: boolean;
257
+ placeholder?: string;
258
+
259
+ /**
260
+ * Optional. Represents the data for the dropdown.
261
+ */
262
+ multiline?: boolean;
304
263
 
305
264
  /**
306
- * Optional. If `true`, the InputDropDown component is marked as required,
265
+ * Optional. Represents the value for the floating title in the Input component.
266
+ */
267
+ floatingValue?: string;
268
+
269
+ /**
270
+ * Optional. Represents the name or key of the floating icon to be displayed in the Input component.
271
+ */
272
+ floatingIcon?: string;
273
+
274
+ /**
275
+ * Optional. Represents the error message to be displayed below the Input component when there is an error.
276
+ */
277
+ errorMessage?: string;
278
+
279
+ /**
280
+ * @deprecated Use `trailing` instead.
281
+ * Optional. Represents the name or key of the icon to be displayed in the Input component.
282
+ */
283
+ icon?: string;
284
+
285
+ /**
286
+ * @deprecated Use `onPressTrailing` instead.
287
+ * Optional. callback function to be called when the icon is pressed.
288
+ */
289
+ onPressIcon?: () => void;
290
+
291
+ /**
292
+ * Optional. Represents the color of the floating icon in the Input component.
293
+ */
294
+ floatingIconColor?: string;
295
+
296
+ /**
297
+ * Optional. If `true`, the Input component is marked as required,
307
298
  * indicating that the user must provide a value before submitting a form.
308
299
  * Defaults to `false` if not provided.
309
300
  */
310
301
  required?: boolean;
311
302
 
312
303
  /**
313
- * Optional. params for element tracking.
304
+ * Optional. If `true`,
305
+ * include spacing when Input not have error message.
306
+ * Defaults to `false` if not provided.
314
307
  */
315
- params?: {
316
- [key: string]: any;
317
- };
308
+ errorSpacing?: boolean;
318
309
 
319
310
  /**
320
- * Optional. Represents the style of the InputDropDown component.
311
+ * If true, the icon of input will use be show indicator loading.
321
312
  */
322
- style?: ViewStyle | ViewStyle[];
313
+ loading?: boolean;
323
314
 
324
315
  /**
325
- * Optional. Represents the data for the dropdown.
316
+ * Optional. Represents the leading icon in the Input component.
326
317
  */
327
- multiline?: boolean;
318
+ leadingIcon?: string;
328
319
 
329
320
  /**
330
- * Optional. Represents the accessibility label for the InputDropDown component.
331
- * This is read out by screen readers.
321
+ * Optional. callback function to be called when the leading icon is pressed.
332
322
  */
333
- accessibilityLabelText?: string;
323
+ onPressLeadingIcon?: () => void;
334
324
 
335
325
  /**
336
- * Optional. Represents the accessibility Touchable for the InputDropDown component.
337
- * This is read out by screen readers.
326
+ * Optional. Represents the color of the leading icon in the Input component.
338
327
  */
339
- accessibilityLabelTouchable?: string;
328
+ leadingIconColor?: string;
329
+
330
+ /**
331
+ * Optional. params for element tracking.
332
+ */
333
+ params?: any;
334
+
335
+ /**
336
+ * Optional. Represents text below the Input component.
337
+ */
338
+ hintText?: string;
339
+
340
+ /**
341
+ * Optional. Represents the style of the Input component.
342
+ */
343
+ onPressFloatingIcon?: () => void;
340
344
  }
341
345
 
342
346
  export type InputRef = {
package/Layout/Card.tsx CHANGED
@@ -27,7 +27,6 @@ const Card: React.FC<CardProps> = ({
27
27
  style,
28
28
  backgroundImage,
29
29
  useShadow = false,
30
- accessibilityLabel,
31
30
  ...props
32
31
  }) => {
33
32
  const {showGrid, theme} = useContext(ApplicationContext);
@@ -157,9 +156,7 @@ const Card: React.FC<CardProps> = ({
157
156
  },
158
157
  !!backgroundImage && {backgroundColor: undefined},
159
158
  useShadow && Shadow.Light,
160
- ]}
161
- accessibilityLabel={accessibilityLabel}
162
- >
159
+ ]}>
163
160
  {!!backgroundImage && (
164
161
  <Image
165
162
  source={{uri: backgroundImage}}
@@ -33,7 +33,6 @@ const Section: React.FC<SectionProps> = ({
33
33
  useMargin = true,
34
34
  backgroundImage,
35
35
  style,
36
- accessibilityLabel,
37
36
  ...props
38
37
  }) => {
39
38
  const {showGrid} = useContext(ApplicationContext);
@@ -162,9 +161,7 @@ const Section: React.FC<SectionProps> = ({
162
161
  flexDirection: 'row',
163
162
  flexWrap: 'wrap',
164
163
  },
165
- ]}
166
- accessibilityLabel={accessibilityLabel}
167
- >
164
+ ]}>
168
165
  {!!backgroundImage && (
169
166
  <Image
170
167
  source={{uri: backgroundImage}}
package/Radio/index.tsx CHANGED
@@ -15,9 +15,7 @@ const Radio: FC<RadioProps> = ({
15
15
  label,
16
16
  style,
17
17
  params,
18
- accessibilityLabel,
19
- accessibilityLabelText,
20
- accessibilityState,
18
+ ...props
21
19
  }) => {
22
20
  const {theme} = useContext(ApplicationContext);
23
21
  const selected = value === groupValue;
@@ -47,14 +45,12 @@ const Radio: FC<RadioProps> = ({
47
45
  componentName: 'Radio',
48
46
  params,
49
47
  state: disabled ? 'disabled' : 'enabled',
50
- componentValue: selected,
51
48
  action: 'click',
52
49
  }}>
53
50
  <TouchableOpacity
54
- accessibilityLabel={accessibilityLabel}
55
- accessibilityState={accessibilityState}
56
- onPress={onChange}
51
+ {...props}
57
52
  disabled={disabled}
53
+ onPress={onChange}
58
54
  style={[
59
55
  style,
60
56
  {
@@ -71,10 +67,7 @@ const Radio: FC<RadioProps> = ({
71
67
  ]}
72
68
  />
73
69
  {!!label && (
74
- <Text
75
- typography={'body_default_regular'}
76
- style={styles.radioText}
77
- accessibilityLabel={accessibilityLabelText}>
70
+ <Text typography={'body_default_regular'} style={styles.radioText}>
78
71
  {label}
79
72
  </Text>
80
73
  )}
@@ -84,4 +77,3 @@ const Radio: FC<RadioProps> = ({
84
77
  };
85
78
 
86
79
  export {Radio};
87
- export type {RadioProps};
package/Radio/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import {TouchableOpacityProps, ViewStyle} from 'react-native';
1
+ import {TouchableOpacityProps} from 'react-native';
2
2
 
3
3
  export interface RadioProps extends TouchableOpacityProps {
4
4
  /**
@@ -7,12 +7,6 @@ export interface RadioProps extends TouchableOpacityProps {
7
7
  */
8
8
  value: any;
9
9
 
10
- /**
11
- * `disabled`: Optional. If `true`, the user won't be able to interact with the Radio component.
12
- * Defaults to `false` if not provided.
13
- */
14
- disabled?: boolean;
15
-
16
10
  /**
17
11
  * `label`: Optional. Represents the text label displayed next to the Radio component.
18
12
  */
@@ -31,15 +25,7 @@ export interface RadioProps extends TouchableOpacityProps {
31
25
  groupValue: any;
32
26
 
33
27
  /**
34
- * `style`: Optional. Used to apply custom styling to the Radio component.
35
- * Accepts an object of style properties.
28
+ * Optional. params for tracking
36
29
  */
37
- style?: ViewStyle;
38
-
39
30
  params?: any;
40
-
41
- /**
42
- * `accessibilityLabelText`: Optional. Represents the label for the Radio Label component.
43
- */
44
- accessibilityLabelText?: string;
45
31
  }
package/Switch/index.tsx CHANGED
@@ -11,7 +11,7 @@ const Switch: FC<SwitchProps> = ({
11
11
  disabled = false,
12
12
  style,
13
13
  params,
14
- accessibilityLabel,
14
+ ...props
15
15
  }) => {
16
16
  const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
17
17
  const circleAlign = value ? 'flex-end' : 'flex-start';
@@ -27,12 +27,11 @@ const Switch: FC<SwitchProps> = ({
27
27
  componentName: 'Switch',
28
28
  params,
29
29
  state: disabled ? 'disabled' : 'enabled',
30
- componentValue: value,
31
30
  action: 'click',
32
31
  }}>
33
32
  <TouchableOpacity
33
+ {...props}
34
34
  disabled={disabled}
35
- accessibilityLabel={accessibilityLabel}
36
35
  onPress={() => onChange?.(!value)}
37
36
  style={[
38
37
  style,
package/Switch/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import {TouchableOpacityProps, ViewStyle} from 'react-native';
1
+ import {TouchableOpacityProps} from 'react-native';
2
2
 
3
3
  export interface SwitchProps extends TouchableOpacityProps {
4
4
  /**
@@ -13,16 +13,7 @@ export interface SwitchProps extends TouchableOpacityProps {
13
13
  onChange: (value: boolean) => void;
14
14
 
15
15
  /**
16
- * `disabled`: Optional. If `true`, the user won't be able to interact with the Switch component.
17
- * Defaults to `false` if not provided.
16
+ * Optional. params for tracking
18
17
  */
19
- disabled?: boolean;
20
-
21
- /**
22
- * `style`: Optional. Used to apply custom styling to the Switch component.
23
- * Accepts an object of style properties.
24
- */
25
- style?: ViewStyle;
26
-
27
18
  params?: any;
28
19
  }
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/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
@@ -2,11 +2,7 @@ import React, {useContext} from 'react';
2
2
  import {Text as RNText, TextProps as RNTextProps, View} from 'react-native';
3
3
  import styles from './styles';
4
4
  import {Typography, TypographyWeight} from './types';
5
- import {
6
- ApplicationContext,
7
- setAutomationID,
8
- SkeletonContext,
9
- } from '../Application';
5
+ import {ApplicationContext, SkeletonContext} from '../Application';
10
6
  import {scaleSize} from './utils';
11
7
  import {Skeleton} from '../Skeleton';
12
8
 
@@ -161,7 +157,6 @@ const Text: React.FC<TextProps> = ({
161
157
  return (
162
158
  <RNText
163
159
  {...rest}
164
- {...setAutomationID(rest.accessibilityLabel)}
165
160
  allowFontScaling={false}
166
161
  style={[
167
162
  style,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.114.0-beta.2",
3
+ "version": "0.114.0-beta.4",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},