@momo-kits/foundation 0.113.0-optimize.3 → 0.113.0-optimize.3-beta.5

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.
@@ -224,10 +224,8 @@ const HeaderToolkitAction: React.FC<any> = ({
224
224
 
225
225
  navigator?.maxApi?.dispatchFunction?.(
226
226
  'showTools',
227
- {
228
- tools,
229
- context,
230
- },
227
+ tools,
228
+ context,
231
229
  (key: string) => {
232
230
  for (const group of tools) {
233
231
  const pressedTool = group?.items?.find?.(
package/Button/index.tsx CHANGED
@@ -76,6 +76,8 @@ export interface ButtonProps extends TouchableOpacityProps {
76
76
  onPress: () => void;
77
77
 
78
78
  params?: any;
79
+
80
+ accessibilityLabelTitle?: string;
79
81
  }
80
82
 
81
83
  const Button: FC<ButtonProps> = ({
@@ -89,7 +91,7 @@ const Button: FC<ButtonProps> = ({
89
91
  title = 'Button',
90
92
  onPress,
91
93
  params,
92
- accessibilityLabel,
94
+ accessibilityLabelTitle,
93
95
  ...rest
94
96
  }) => {
95
97
  const {theme, config} = useContext(ApplicationContext);
@@ -225,7 +227,11 @@ const Button: FC<ButtonProps> = ({
225
227
  const typography = getTypography();
226
228
  const textColor = getTextColor();
227
229
  return (
228
- <Text typography={typography} color={textColor} numberOfLines={1}>
230
+ <Text
231
+ typography={typography}
232
+ color={textColor}
233
+ numberOfLines={1}
234
+ accessibilityLabel={accessibilityLabelTitle}>
229
235
  {title}
230
236
  </Text>
231
237
  );
@@ -311,7 +317,10 @@ const Button: FC<ButtonProps> = ({
311
317
  <TouchableOpacity
312
318
  {...rest}
313
319
  disabled={type === 'disabled'}
314
- accessibilityLabel={accessibilityLabel}
320
+ accessibilityState={{
321
+ ...rest.accessibilityState,
322
+ disabled: type === 'disabled',
323
+ }}
315
324
  activeOpacity={0.5}
316
325
  onPress={onPress}
317
326
  style={buttonStyle}>
@@ -15,6 +15,8 @@ const CheckBox: FC<CheckBoxProps> = ({
15
15
  indeterminate,
16
16
  params,
17
17
  accessibilityLabel,
18
+ accessibilityState,
19
+ accessibilityLabelLabel,
18
20
  }) => {
19
21
  const {theme} = useContext(ApplicationContext);
20
22
  const haveValue = value || indeterminate;
@@ -47,6 +49,7 @@ const CheckBox: FC<CheckBoxProps> = ({
47
49
  }}>
48
50
  <TouchableOpacity
49
51
  accessibilityLabel={accessibilityLabel}
52
+ accessibilityState={accessibilityState}
50
53
  activeOpacity={0.8}
51
54
  onPress={() => onChange?.(!value)}
52
55
  disabled={disabled}
@@ -64,7 +67,13 @@ const CheckBox: FC<CheckBoxProps> = ({
64
67
  />
65
68
  )}
66
69
  </View>
67
- {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
70
+ {!!label && (
71
+ <Text
72
+ typography={'body_default_regular'}
73
+ accessibilityLabel={accessibilityLabelLabel}>
74
+ {label}
75
+ </Text>
76
+ )}
68
77
  </TouchableOpacity>
69
78
  </ComponentContext.Provider>
70
79
  );
package/CheckBox/types.ts CHANGED
@@ -37,4 +37,9 @@ export interface CheckBoxProps extends TouchableOpacityProps {
37
37
  style?: ViewStyle;
38
38
 
39
39
  params?: any;
40
+
41
+ /**
42
+ * Optional. Represents the label for the CheckBox component.
43
+ */
44
+ accessibilityLabelLabel?: string;
40
45
  }
package/Input/Input.tsx CHANGED
@@ -13,7 +13,11 @@ import {
13
13
  TouchableOpacity,
14
14
  View,
15
15
  } from 'react-native';
16
- import {ApplicationContext, ComponentContext} from '../Application';
16
+ import {
17
+ ApplicationContext,
18
+ ComponentContext,
19
+ setAutomationID,
20
+ } from '../Application';
17
21
  import {Icon} from '../Icon';
18
22
  import {Loader} from '../Loader';
19
23
  import {exportFontFamily, Text} from '../Text';
@@ -61,6 +65,11 @@ const Input = forwardRef(
61
65
  onPressFloatingIcon,
62
66
  onPressLeadingIcon,
63
67
  showClearIcon = true,
68
+ accessibilityLabelErrorMessage,
69
+ accessibilityLabelFloatingValue,
70
+ accessibilityLabelLeadingIcon,
71
+ accessibilityLabelTrailingIcon,
72
+ accessibilityLabelClearIcon,
64
73
  ...props
65
74
  }: InputProps,
66
75
  ref
@@ -117,7 +126,8 @@ const Input = forwardRef(
117
126
  return (
118
127
  <TouchableOpacity
119
128
  onPress={() => setSecureTextInput(!secureTextInput)}
120
- style={styles.icon}>
129
+ style={styles.icon}
130
+ accessibilityLabel={accessibilityLabelTrailingIcon}>
121
131
  <Icon
122
132
  color={color}
123
133
  size={24}
@@ -190,11 +200,14 @@ const Input = forwardRef(
190
200
  required={required}
191
201
  floatingIcon={floatingIcon}
192
202
  onPress={onPressFloatingIcon}
203
+ accessibilityLabel={accessibilityLabelFloatingValue}
193
204
  />
194
205
  <View style={styles.inputView}>
195
206
  {!!leadingIcon && (
196
207
  <View style={styles.leadingIconContainer}>
197
- <TouchableOpacity onPress={onPressLeadingIcon}>
208
+ <TouchableOpacity
209
+ onPress={onPressLeadingIcon}
210
+ accessibilityLabel={accessibilityLabelLeadingIcon}>
198
211
  <Icon
199
212
  color={leadingIconColor}
200
213
  source={leadingIcon}
@@ -205,7 +218,11 @@ const Input = forwardRef(
205
218
  )}
206
219
  <TextInput
207
220
  {...props}
208
- accessibilityLabel={accessibilityLabel}
221
+ {...setAutomationID(accessibilityLabel)}
222
+ accessibilityState={{
223
+ ...props.accessibilityState,
224
+ disabled: disabled,
225
+ }}
209
226
  editable={editable && !disabled}
210
227
  secureTextEntry={secure}
211
228
  textAlignVertical="center"
@@ -234,7 +251,8 @@ const Input = forwardRef(
234
251
  {showClearIcon && focused && haveValue && (
235
252
  <TouchableOpacity
236
253
  style={styles.iconWrapper}
237
- onPress={onClearText}>
254
+ onPress={onClearText}
255
+ accessibilityLabel={accessibilityLabelClearIcon}>
238
256
  <Icon
239
257
  source="24_navigation_close_circle_full"
240
258
  size={16}
@@ -272,6 +290,7 @@ const Input = forwardRef(
272
290
  errorMessage={errorMessage}
273
291
  errorSpacing={errorSpacing}
274
292
  hintText={hintText}
293
+ accessibilityLabel={accessibilityLabelErrorMessage}
275
294
  />
276
295
  </View>
277
296
  </ComponentContext.Provider>
@@ -28,6 +28,10 @@ const InputDropDown = ({
28
28
  accessibilityLabel,
29
29
  hintText,
30
30
  multiline,
31
+ accessibilityLabelText,
32
+ accessibilityLabelTouchable,
33
+ accessibilityLabelErrorMessage,
34
+ accessibilityLabelFloatingValue,
31
35
  }: InputDropDownProps) => {
32
36
  const {theme} = useContext(ApplicationContext);
33
37
 
@@ -59,6 +63,7 @@ const InputDropDown = ({
59
63
  required={required}
60
64
  floatingIcon={floatingIcon}
61
65
  onPress={onPressFloatingIcon}
66
+ accessibilityLabel={accessibilityLabelFloatingValue}
62
67
  />
63
68
  <View style={styles.inputDropDownView}>
64
69
  {!!leadingIcon && (
@@ -83,7 +88,8 @@ const InputDropDown = ({
83
88
  <Text
84
89
  numberOfLines={multiline ? undefined : 1}
85
90
  typography={'body_default_regular'}
86
- color={value ? textColor : placeholderColor}>
91
+ color={value ? textColor : placeholderColor}
92
+ accessibilityLabel={accessibilityLabelText}>
87
93
  {value || placeholder}
88
94
  </Text>
89
95
  </View>
@@ -112,12 +118,16 @@ const InputDropDown = ({
112
118
  <TouchableOpacity
113
119
  activeOpacity={0.6}
114
120
  onPress={onPress}
115
- style={[style, styles.wrapper]}>
121
+ style={[style, styles.wrapper]}
122
+ accessibilityLabel={accessibilityLabelTouchable}
123
+ accessibilityState={{disabled}}
124
+ disabled={disabled}>
116
125
  {renderInputView()}
117
126
  <ErrorView
118
127
  errorMessage={errorMessage}
119
128
  errorSpacing={errorSpacing}
120
129
  hintText={hintText}
130
+ accessibilityLabel={accessibilityLabelErrorMessage}
121
131
  />
122
132
  </TouchableOpacity>
123
133
  </ComponentContext.Provider>
package/Input/common.tsx CHANGED
@@ -22,6 +22,7 @@ type FloatingViewProps = {
22
22
  required?: boolean;
23
23
  style?: ViewStyle;
24
24
  onPress?: (e: GestureResponderEvent) => void;
25
+ accessibilityLabel?: string;
25
26
  };
26
27
 
27
28
  type TrailingProps = {
@@ -80,7 +81,8 @@ export const ErrorView: FC<{
80
81
  errorMessage?: string;
81
82
  errorSpacing?: boolean;
82
83
  hintText?: string;
83
- }> = ({errorMessage, errorSpacing, hintText}) => {
84
+ accessibilityLabel?: string;
85
+ }> = ({errorMessage, errorSpacing, hintText, accessibilityLabel}) => {
84
86
  const {theme} = useContext(ApplicationContext);
85
87
  const errorColor = theme.colors.error.primary;
86
88
  const hintColor = theme.colors.text.hint;
@@ -98,6 +100,7 @@ export const ErrorView: FC<{
98
100
  <Text
99
101
  style={Styles.flex}
100
102
  color={errorMessage ? errorColor : hintColor}
103
+ accessibilityLabel={accessibilityLabel}
101
104
  typography={'description_default_regular'}>
102
105
  {errorMessage ?? hintTextDefault}
103
106
  </Text>
@@ -118,6 +121,7 @@ export const FloatingView: FC<FloatingViewProps> = ({
118
121
  required,
119
122
  style,
120
123
  onPress,
124
+ accessibilityLabel,
121
125
  }) => {
122
126
  const {theme} = useContext(ApplicationContext);
123
127
 
@@ -139,7 +143,10 @@ export const FloatingView: FC<FloatingViewProps> = ({
139
143
  },
140
144
  style,
141
145
  ]}>
142
- <Text color={floatingTextColor} typography={'label_s_medium'}>
146
+ <Text
147
+ color={floatingTextColor}
148
+ typography={'label_s_medium'}
149
+ accessibilityLabel={accessibilityLabel}>
143
150
  {floatingValue}
144
151
  {required && (
145
152
  <Text
package/Input/index.tsx CHANGED
@@ -131,6 +131,36 @@ export interface InputProps extends TextInputProps {
131
131
  * Optional. Represents the style of the Input component.
132
132
  */
133
133
  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;
134
164
  }
135
165
 
136
166
  export interface InputTextAreaProps extends Omit<InputProps, 'size'> {
@@ -295,6 +325,18 @@ export interface InputDropDownProps
295
325
  * Optional. Represents the data for the dropdown.
296
326
  */
297
327
  multiline?: boolean;
328
+
329
+ /**
330
+ * Optional. Represents the accessibility label for the InputDropDown component.
331
+ * This is read out by screen readers.
332
+ */
333
+ accessibilityLabelText?: string;
334
+
335
+ /**
336
+ * Optional. Represents the accessibility Touchable for the InputDropDown component.
337
+ * This is read out by screen readers.
338
+ */
339
+ accessibilityLabelTouchable?: string;
298
340
  }
299
341
 
300
342
  export type InputRef = {
package/Radio/index.tsx CHANGED
@@ -16,6 +16,8 @@ const Radio: FC<RadioProps> = ({
16
16
  style,
17
17
  params,
18
18
  accessibilityLabel,
19
+ accessibilityLabelText,
20
+ accessibilityState,
19
21
  }) => {
20
22
  const {theme} = useContext(ApplicationContext);
21
23
  const selected = value === groupValue;
@@ -50,6 +52,7 @@ const Radio: FC<RadioProps> = ({
50
52
  }}>
51
53
  <TouchableOpacity
52
54
  accessibilityLabel={accessibilityLabel}
55
+ accessibilityState={accessibilityState}
53
56
  onPress={onChange}
54
57
  disabled={disabled}
55
58
  style={[
@@ -67,10 +70,18 @@ const Radio: FC<RadioProps> = ({
67
70
  {marginRight: label ? Spacing.S : 0},
68
71
  ]}
69
72
  />
70
- {!!label && <Text typography={'body_default_regular'} style={styles.radioText}>{label}</Text>}
73
+ {!!label && (
74
+ <Text
75
+ typography={'body_default_regular'}
76
+ style={styles.radioText}
77
+ accessibilityLabel={accessibilityLabelText}>
78
+ {label}
79
+ </Text>
80
+ )}
71
81
  </TouchableOpacity>
72
82
  </ComponentContext.Provider>
73
83
  );
74
84
  };
75
85
 
76
86
  export {Radio};
87
+ export type {RadioProps};
package/Radio/types.ts CHANGED
@@ -37,4 +37,9 @@ export interface RadioProps extends TouchableOpacityProps {
37
37
  style?: ViewStyle;
38
38
 
39
39
  params?: any;
40
+
41
+ /**
42
+ * `accessibilityLabelText`: Optional. Represents the label for the Radio Label component.
43
+ */
44
+ accessibilityLabelText?: string;
40
45
  }
@@ -33,7 +33,7 @@ const Skeleton: React.FC<SkeletonTypes> = ({style}) => {
33
33
  duration: 1000,
34
34
  easing: Easing.linear,
35
35
  useNativeDriver: Platform.OS !== 'web',
36
- }),
36
+ })
37
37
  );
38
38
  }, [beginShimmerPosition]);
39
39
 
@@ -78,6 +78,21 @@ const Skeleton: React.FC<SkeletonTypes> = ({style}) => {
78
78
  );
79
79
  };
80
80
 
81
+ /**
82
+ * SkeletonProvider component provides a context for managing the loading state
83
+ * and applies a layout animation when the loading state changes.
84
+ *
85
+ * @param {boolean} loading - Indicates whether the skeleton loading state is active.
86
+ * @param {React.ReactNode} children - The child components to be rendered within the provider.
87
+ *
88
+ * @example
89
+ * <SkeletonProvider loading={true}>
90
+ * <YourComponent />
91
+ * </SkeletonProvider>
92
+ *
93
+ * The layout animation is configured using LayoutAnimation.configureNext, which animates the opacity of the components over 500 milliseconds with an ease-in-ease-out effect.
94
+ */
95
+
81
96
  const SkeletonProvider: React.FC<{loading: boolean}> = ({
82
97
  loading = true,
83
98
  children,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.113.0-optimize.3",
3
+ "version": "0.113.0-optimize.3-beta.5",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},