@momo-kits/foundation 0.89.3 → 0.89.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.
@@ -35,7 +35,6 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
35
35
  tintColor,
36
36
  onPress,
37
37
  useBorder = true,
38
- accessibilityLabel,
39
38
  badgeType,
40
39
  badgeValue,
41
40
  }) => {
@@ -67,7 +66,6 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
67
66
  return (
68
67
  <View style={{width: scaleSize(28)}}>
69
68
  <TouchableOpacity
70
- accessibilityLabel={`NavigationButton/${accessibilityLabel}`}
71
69
  style={[styles.navigationButton, buttonStyle]}
72
70
  onPress={onPress}>
73
71
  <Icon
@@ -81,7 +79,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
81
79
  );
82
80
  };
83
81
 
84
- const HeaderTitle: React.FC<any> = ({accessibilityLabel = '', ...props}) => {
82
+ const HeaderTitle: React.FC<any> = props => {
85
83
  const {theme} = useContext(ApplicationContext);
86
84
  const opacity = props.animatedValue?.interpolate({
87
85
  inputRange: [0, 200],
@@ -92,7 +90,6 @@ const HeaderTitle: React.FC<any> = ({accessibilityLabel = '', ...props}) => {
92
90
  return (
93
91
  <Animated.Text
94
92
  {...props}
95
- accessibilityLabel={`HeaderTitle/${accessibilityLabel}${props.children}`}
96
93
  style={[
97
94
  styles.title,
98
95
  {fontFamily: `${theme.font}-Bold`, opacity, color: props.tintColor},
@@ -106,7 +103,6 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
106
103
  preventBack,
107
104
  onPressLeftHeader,
108
105
  useBorder,
109
- accessibilityLabel = '',
110
106
  }) => {
111
107
  const context = useContext(MiniAppContext);
112
108
  const {navigator} = useContext(ApplicationContext);
@@ -171,7 +167,6 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
171
167
  icon="ic_back"
172
168
  tintColor={tintColor}
173
169
  onPress={goBackSafe}
174
- accessibilityLabel={`${accessibilityLabel}Back`}
175
170
  useBorder={useBorder}
176
171
  />
177
172
  </View>
@@ -368,7 +363,6 @@ const HeaderToolkitAction: React.FC<any> = ({
368
363
  if (pinTool)
369
364
  return (
370
365
  <NavigationButton
371
- accessibilityLabel={'UtilityTool'}
372
366
  icon={pinTool.icon as string}
373
367
  tintColor={tintColor}
374
368
  badgeValue={badgeValue}
@@ -399,15 +393,11 @@ const HeaderToolkitAction: React.FC<any> = ({
399
393
  borderWidth: backgroundColor ? 0.5 : 0,
400
394
  },
401
395
  ]}>
402
- <TouchableOpacity
403
- accessibilityLabel={'Toolkit/More'}
404
- onPress={onMore}>
396
+ <TouchableOpacity onPress={onMore}>
405
397
  <Icon color={tintColor} source="navigation_more_horiz" size={20} />
406
398
  </TouchableOpacity>
407
399
  <View style={[styles.divider, {backgroundColor: tintColor}]} />
408
- <TouchableOpacity
409
- accessibilityLabel={`Toolkit/Close`}
410
- onPress={onClose}>
400
+ <TouchableOpacity onPress={onClose}>
411
401
  <Icon
412
402
  color={tintColor}
413
403
  source="16_navigation_close_circle"
@@ -74,7 +74,7 @@ const Modal: React.FC<ModalParams> = props => {
74
74
  style={styles.modalSpaceVertical}
75
75
  onPress={() => onDismiss()}
76
76
  />
77
- <View style={styles.modalContent} accessibilityLabel={'Modal'}>
77
+ <View style={styles.modalContent}>
78
78
  <Component {...params} />
79
79
  </View>
80
80
  <Pressable
@@ -167,7 +167,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
167
167
  bottomInset={Platform.OS === 'ios' ? bottomInset : 0}
168
168
  handleComponent={null}
169
169
  backdropComponent={backdropComponent}>
170
- <BottomSheetView accessibilityLabel={'BottomSheet'}>
170
+ <BottomSheetView>
171
171
  <View style={[styles.sheetContainer, {backgroundColor}]}>
172
172
  <View style={styles.indicatorContainer}>
173
173
  <View
@@ -189,22 +189,11 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
189
189
  ...{
190
190
  headerLeft: (props: any) => {
191
191
  if (props.canGoBack) {
192
- return (
193
- <HeaderLeft
194
- {...props}
195
- useBorder={false}
196
- accessibilityLabel={'BottomSheet/'}
197
- />
198
- );
192
+ return <HeaderLeft {...props} useBorder={false} />;
199
193
  }
200
194
  },
201
195
  headerTitle: (props: any) => {
202
- return (
203
- <HeaderTitle
204
- {...props}
205
- accessibilityLabel={'BottomSheet/'}
206
- />
207
- );
196
+ return <HeaderTitle {...props} />;
208
197
  },
209
198
  headerTintColor: theme.colors.text.default,
210
199
  headerBackground: () => (
@@ -220,7 +209,6 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
220
209
  icon="24_navigation_close"
221
210
  useBorder={false}
222
211
  onPress={() => bottomSheetRef.current?.dismiss()}
223
- accessibilityLabel={'BottomSheet/Close'}
224
212
  />
225
213
  </HeaderRightAction>
226
214
  ),
@@ -109,6 +109,18 @@ class Navigator {
109
109
  );
110
110
  };
111
111
 
112
+ /**
113
+ * dismiss a feature data
114
+ * @param data
115
+ */
116
+ setDismissData = (data: any) => {
117
+ this.dismissData = data;
118
+ };
119
+
120
+ /**
121
+ * set callback function for toolkit
122
+ * @param callback
123
+ */
112
124
  setToolkitCallback = (
113
125
  callback: (item: {key: string; action: string}) => void,
114
126
  ) => {
@@ -127,7 +127,6 @@ export type NavigationButtonProps = {
127
127
  tintColor?: string;
128
128
  useBorder?: boolean;
129
129
  onPress: () => void;
130
- accessibilityLabel?: string;
131
130
  badgeType?: 'dot' | 'number';
132
131
  badgeValue?: number;
133
132
  };
@@ -159,7 +158,6 @@ export interface NavigationOptions extends StackNavigationOptions {
159
158
  export interface HeaderBackProps extends NavigationButtonProps {
160
159
  preventBack?: PopupNotifyProps;
161
160
  onPressLeftHeader?: () => void;
162
- accessibilityLabel?: string;
163
161
  }
164
162
 
165
163
  export type HeaderBackgroundProps = {
package/Button/index.tsx CHANGED
@@ -293,7 +293,6 @@ const Button: FC<ButtonProps> = ({
293
293
  return (
294
294
  <TouchableOpacity
295
295
  {...rest}
296
- accessibilityLabel={`Button/${title}`}
297
296
  activeOpacity={activeOpacity}
298
297
  onPress={onPressButton}
299
298
  style={buttonStyle}>
@@ -36,7 +36,6 @@ const CheckBox: FC<CheckBoxProps> = ({
36
36
 
37
37
  return (
38
38
  <TouchableOpacity
39
- accessibilityLabel={`CheckBox/${label}/${value}`}
40
39
  activeOpacity={0.8}
41
40
  onPress={() => onChange?.(!value)}
42
41
  disabled={disabled}
@@ -123,7 +123,6 @@ const IconButton: React.FC<IconButtonProps> = ({
123
123
  return (
124
124
  <TouchableOpacity
125
125
  {...rest}
126
- accessibilityLabel={`IconButton/${icon}`}
127
126
  activeOpacity={activeOpacity}
128
127
  onPress={onPressButton}
129
128
  style={buttonStyle}>
package/Input/Input.tsx CHANGED
@@ -37,6 +37,7 @@ const Input = forwardRef(
37
37
  leadingIconColor,
38
38
  fontWeight = 'Regular',
39
39
  onPressIcon,
40
+ secureTextEntry,
40
41
  style,
41
42
  ...props
42
43
  }: InputProps,
@@ -45,8 +46,8 @@ const Input = forwardRef(
45
46
  const {theme} = useContext(ApplicationContext);
46
47
  const [focused, setFocused] = useState(false);
47
48
  const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
49
+ const [secureTextInput, setSecureTextInput] = useState(secureTextEntry);
48
50
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
49
- const accessibilityLabel = `Input/${floatingValue ?? placeholder}`;
50
51
 
51
52
  const onClearText = () => {
52
53
  inputRef?.current?.clear();
@@ -70,11 +71,29 @@ const Input = forwardRef(
70
71
 
71
72
  const renderIcon = (color: string | undefined) => {
72
73
  if (loading) {
73
- return <Loader type={'spinner'} color={color} />;
74
+ return <Loader type={'spinner'} color={color} style={styles.icon} />;
75
+ }
76
+ if (secureTextEntry) {
77
+ return (
78
+ <TouchableOpacity
79
+ onPress={() => setSecureTextInput(!secureTextInput)}
80
+ style={styles.icon}>
81
+ <Icon
82
+ color={color}
83
+ size={24}
84
+ source={
85
+ secureTextInput ? '24_security_eye_off' : '24_security_eye_open'
86
+ }
87
+ />
88
+ </TouchableOpacity>
89
+ );
74
90
  }
75
91
  if (icon) {
76
92
  return (
77
- <TouchableOpacity onPress={onPressIcon} disabled={!onPressIcon}>
93
+ <TouchableOpacity
94
+ onPress={onPressIcon}
95
+ disabled={!onPressIcon}
96
+ style={styles.icon}>
78
97
  <Icon color={color} source={icon} size={24} />
79
98
  </TouchableOpacity>
80
99
  );
@@ -83,6 +102,7 @@ const Input = forwardRef(
83
102
 
84
103
  const renderInputView = () => {
85
104
  const disabledColor = theme.colors.text.disable;
105
+ const secure = secureTextInput && secureTextEntry;
86
106
  let textColor = theme.colors.text.default;
87
107
  let placeholderColor = theme.colors.text.hint;
88
108
  let iconTintColor = iconColor;
@@ -120,8 +140,8 @@ const Input = forwardRef(
120
140
  )}
121
141
  <TextInput
122
142
  {...props}
123
- accessibilityLabel={accessibilityLabel}
124
143
  editable={!disabled}
144
+ secureTextEntry={secure}
125
145
  textAlignVertical="center"
126
146
  ref={inputRef}
127
147
  style={[
@@ -130,6 +150,7 @@ const Input = forwardRef(
130
150
  color: textColor,
131
151
  fontFamily: `${theme.font}-${fontWeight}`,
132
152
  },
153
+ secure && {fontSize: size === 'small' ? 20 : 28},
133
154
  ]}
134
155
  textBreakStrategy="highQuality"
135
156
  value={value}
@@ -160,9 +181,7 @@ const Input = forwardRef(
160
181
  };
161
182
 
162
183
  return (
163
- <View
164
- style={[style, styles.wrapper]}
165
- accessibilityLabel={accessibilityLabel}>
184
+ <View style={[style, styles.wrapper]}>
166
185
  {renderInputView()}
167
186
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
168
187
  </View>
@@ -30,7 +30,6 @@ const InputDropDown = ({
30
30
  }: InputDropDownProps) => {
31
31
  const {theme} = useContext(ApplicationContext);
32
32
  const full = !!value || !!placeholder;
33
- const accessibilityLabel = `InputDropDown/${floatingValue ?? placeholder}`;
34
33
 
35
34
  const renderIcon = (color: string | undefined) => {
36
35
  if (loading) {
@@ -82,7 +81,6 @@ const InputDropDown = ({
82
81
  <TextInput
83
82
  {...props}
84
83
  onPressIn={onPress}
85
- accessibilityLabel={accessibilityLabel}
86
84
  editable={false}
87
85
  textAlignVertical="top"
88
86
  style={[
@@ -106,10 +104,7 @@ const InputDropDown = ({
106
104
  };
107
105
 
108
106
  return (
109
- <TouchableOpacity
110
- onPress={onPress}
111
- style={[style, full && styles.wrapper]}
112
- accessibilityLabel={accessibilityLabel}>
107
+ <TouchableOpacity onPress={onPress} style={[style, full && styles.wrapper]}>
113
108
  {renderInputView()}
114
109
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
115
110
  </TouchableOpacity>
@@ -44,7 +44,6 @@ const InputMoney = forwardRef(
44
44
  const {theme} = useContext(ApplicationContext);
45
45
  const [focused, setFocused] = useState(false);
46
46
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
47
- const accessibilityLabel = `InputMoney/${floatingValue}`;
48
47
 
49
48
  const validateText = (text: string) => {
50
49
  const valueFormat = formatMoneyToNumber(text, 'đ');
@@ -115,7 +114,6 @@ const InputMoney = forwardRef(
115
114
  <View style={styles.inputView}>
116
115
  <TextInput
117
116
  {...props}
118
- accessibilityLabel={accessibilityLabel}
119
117
  editable={!disabled}
120
118
  textAlignVertical="top"
121
119
  ref={inputRef}
@@ -154,9 +152,7 @@ const InputMoney = forwardRef(
154
152
  };
155
153
 
156
154
  return (
157
- <View
158
- style={[style, styles.wrapper]}
159
- accessibilityLabel={accessibilityLabel}>
155
+ <View style={[style, styles.wrapper]}>
160
156
  {renderInputView()}
161
157
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
162
158
  </View>
@@ -88,7 +88,6 @@ const InputOTP = forwardRef(
88
88
  const [focused, setFocused] = useState(false);
89
89
  const inputRef = useRef<TextInput>(null);
90
90
  const {theme} = useContext(ApplicationContext);
91
- const accessibilityLabel = `InputOTP/${floatingValue ?? placeholder}`;
92
91
 
93
92
  useImperativeHandle(ref, () => ({
94
93
  onChangeText: (text: string) => {
@@ -206,7 +205,6 @@ const InputOTP = forwardRef(
206
205
  <View style={styles.inputView}>
207
206
  <TextInput
208
207
  {...props}
209
- accessibilityLabel={accessibilityLabel}
210
208
  ref={inputRef}
211
209
  value={value}
212
210
  onChangeText={_onChangeText}
@@ -226,8 +224,7 @@ const InputOTP = forwardRef(
226
224
  <TouchableOpacity
227
225
  activeOpacity={1}
228
226
  onPress={onFocusInput}
229
- style={[style, styles.otpWrapper]}
230
- accessibilityLabel={accessibilityLabel}>
227
+ style={[style, styles.otpWrapper]}>
231
228
  {renderInputView()}
232
229
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
233
230
  </TouchableOpacity>
@@ -37,7 +37,6 @@ const InputSearch = forwardRef(
37
37
  const [focused, setFocused] = useState(false);
38
38
  const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
39
39
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
40
- const accessibilityLabel = `InputMoney/${placeholder}`;
41
40
 
42
41
  const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
43
42
  setFocused(true);
@@ -63,7 +62,6 @@ const InputSearch = forwardRef(
63
62
  return (
64
63
  <TextInput
65
64
  {...props}
66
- accessibilityLabel={accessibilityLabel}
67
65
  textAlignVertical="center"
68
66
  ref={inputRef}
69
67
  style={[
@@ -119,9 +117,7 @@ const InputSearch = forwardRef(
119
117
  );
120
118
  };
121
119
  return (
122
- <View
123
- style={[style, styles.searchInputContainer]}
124
- accessibilityLabel={accessibilityLabel}>
120
+ <View style={[style, styles.searchInputContainer]}>
125
121
  <View
126
122
  style={[
127
123
  styles.searchInputWrapper,
@@ -46,7 +46,6 @@ const InputTextArea = forwardRef(
46
46
  const [focused, setFocused] = useState(false);
47
47
  const [inputValue, setInputValue] = useState(defaultValue ?? '');
48
48
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
49
- const accessibilityLabel = `InputTextArea/${floatingValue ?? placeholder}`;
50
49
 
51
50
  const onClearText = () => {
52
51
  inputRef?.current?.clear();
@@ -110,7 +109,6 @@ const InputTextArea = forwardRef(
110
109
  <View style={styles.textAreaView}>
111
110
  <TextInput
112
111
  {...props}
113
- accessibilityLabel={accessibilityLabel}
114
112
  ref={inputRef}
115
113
  editable={!disabled}
116
114
  textAlignVertical="top"
@@ -150,9 +148,7 @@ const InputTextArea = forwardRef(
150
148
  };
151
149
 
152
150
  return (
153
- <View
154
- style={[style, styles.wrapper]}
155
- accessibilityLabel={accessibilityLabel}>
151
+ <View style={[style, styles.wrapper]}>
156
152
  {renderInputView()}
157
153
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
158
154
  </View>
package/Input/styles.ts CHANGED
@@ -53,8 +53,7 @@ export default StyleSheet.create({
53
53
  marginRight: Spacing.M,
54
54
  },
55
55
  icon: {
56
- width: 24,
57
- height: 24,
56
+ marginLeft: Spacing.S
58
57
  },
59
58
  iconWrapper: {
60
59
  width: 24,
package/Layout/Card.tsx CHANGED
@@ -144,7 +144,6 @@ const Card: React.FC<CardProps> = ({
144
144
  <GridContext.Provider value={gridContext}>
145
145
  <View
146
146
  {...props}
147
- accessibilityLabel={`Card`}
148
147
  style={[
149
148
  {backgroundColor: theme.colors.background.surface},
150
149
  style,
package/Layout/Item.tsx CHANGED
@@ -37,7 +37,6 @@ const Item: React.FC<ItemProps> = ({
37
37
 
38
38
  return (
39
39
  <View
40
- accessibilityLabel={`Item`}
41
40
  style={[
42
41
  style,
43
42
  styles.item,
package/Layout/Screen.tsx CHANGED
@@ -301,9 +301,7 @@ const Screen = forwardRef(
301
301
  };
302
302
 
303
303
  return (
304
- <View
305
- style={[Styles.flex, {backgroundColor}]}
306
- accessibilityLabel={`ScreenContainer`}>
304
+ <View style={[Styles.flex, {backgroundColor}]}>
307
305
  {!!headerBackground && (
308
306
  <>
309
307
  <Image
@@ -151,7 +151,6 @@ const Section: React.FC<SectionProps> = ({
151
151
  }}>
152
152
  <View
153
153
  {...props}
154
- accessibilityLabel={`Section`}
155
154
  style={[
156
155
  style,
157
156
  styles.protectedStyle,
@@ -31,7 +31,6 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
31
31
  const renderScrollView = () => {
32
32
  return (
33
33
  <Animated.ScrollView
34
- accessibilityLabel={'PaginationScroll'}
35
34
  ref={scrollViewRef}
36
35
  onScroll={Animated.event(
37
36
  [
@@ -182,7 +182,6 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
182
182
 
183
183
  return (
184
184
  <View
185
- accessibilityLabel={'PopupNotify'}
186
185
  style={[
187
186
  styles.container,
188
187
  {backgroundColor: theme.colors.background.surface},
@@ -77,7 +77,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
77
77
  };
78
78
 
79
79
  return (
80
- <View accessibilityLabel={'PopupPromotion'}>
80
+ <View>
81
81
  <Image
82
82
  source={{
83
83
  uri: image,
package/Radio/index.tsx CHANGED
@@ -39,7 +39,6 @@ const Radio: FC<RadioProps> = ({
39
39
 
40
40
  return (
41
41
  <TouchableOpacity
42
- accessibilityLabel={`Radio/${label}/${value}`}
43
42
  onPress={onChange}
44
43
  disabled={disabled}
45
44
  style={[
@@ -41,7 +41,7 @@ const Skeleton: React.FC<SkeletonTypes> = ({style}) => {
41
41
  }
42
42
  };
43
43
  return (
44
- <View style={[styles.container, style]} accessibilityLabel={'Skeleton'}>
44
+ <View style={[styles.container, style]}>
45
45
  <View
46
46
  onLayout={e => onLayout(e.nativeEvent.layout.width)}
47
47
  style={[Styles.flex, {backgroundColor: PRIMARY_COLOR}]}>
package/Switch/index.tsx CHANGED
@@ -16,7 +16,6 @@ const Switch: FC<SwitchProps> = props => {
16
16
 
17
17
  return (
18
18
  <TouchableOpacity
19
- accessibilityLabel={'Switch'}
20
19
  disabled={disabled}
21
20
  onPress={() => onChange?.(!value)}
22
21
  style={[
package/Tag/index.tsx CHANGED
@@ -60,9 +60,7 @@ const Tag: FC<TagProps> = ({
60
60
  }
61
61
 
62
62
  return (
63
- <View
64
- style={[style, sizeStyle, {backgroundColor: tagColor}]}
65
- accessibilityLabel={`Tag/${label}`}>
63
+ <View style={[style, sizeStyle, {backgroundColor: tagColor}]}>
66
64
  {!!icon && (
67
65
  <Icon
68
66
  style={styles.icon}
package/Text/index.tsx CHANGED
@@ -97,7 +97,6 @@ const Text: React.FC<TextProps> = ({
97
97
  return (
98
98
  <RNText
99
99
  {...rest}
100
- accessibilityLabel={`Text/${children}`}
101
100
  style={[style, textStyle, {color: color ?? theme.colors.text.default}]}>
102
101
  {children ?? ''}
103
102
  </RNText>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.89.3",
3
+ "version": "0.89.4",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {