@momo-kits/foundation 0.92.28 → 0.92.29-optimize.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Input/Input.tsx CHANGED
@@ -1,5 +1,6 @@
1
1
  import React, {
2
2
  forwardRef,
3
+ ReactNode,
3
4
  useContext,
4
5
  useImperativeHandle,
5
6
  useRef,
@@ -16,11 +17,15 @@ import {
16
17
  import {ApplicationContext, ComponentContext} from '../Application';
17
18
  import {Icon} from '../Icon';
18
19
  import {Loader} from '../Loader';
20
+ import {Text} from '../Text';
19
21
  import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
20
22
  import {InputProps} from './index';
21
23
  import styles from './styles';
22
24
  import {checkTyping} from './utils';
23
25
 
26
+ /**
27
+ * Input default component
28
+ */
24
29
  const Input = forwardRef(
25
30
  (
26
31
  {
@@ -34,16 +39,19 @@ const Input = forwardRef(
34
39
  onFocus,
35
40
  errorMessage,
36
41
  icon,
42
+ iconColor,
43
+ onPressIcon,
44
+ trailing,
45
+ trailingColor,
46
+ onPressTrailing,
37
47
  disabled = false,
38
48
  floatingIconColor,
39
- iconColor,
40
49
  required = false,
41
50
  errorSpacing,
42
51
  loading = false,
43
52
  leadingIcon,
44
53
  leadingIconColor,
45
54
  fontWeight = 'Regular',
46
- onPressIcon,
47
55
  secureTextEntry,
48
56
  keyboardType,
49
57
  style,
@@ -53,7 +61,7 @@ const Input = forwardRef(
53
61
  editable = true,
54
62
  ...props
55
63
  }: InputProps,
56
- ref,
64
+ ref
57
65
  ) => {
58
66
  const {theme} = useContext(ApplicationContext);
59
67
  const [focused, setFocused] = useState(false);
@@ -90,7 +98,11 @@ const Input = forwardRef(
90
98
  };
91
99
  });
92
100
 
93
- const renderIcon = (color: string | undefined) => {
101
+ /**
102
+ * Render trailing icon or text
103
+ * @param color
104
+ */
105
+ const renderTrailing = (color?: string) => {
94
106
  if (loading) {
95
107
  return <Loader type={'spinner'} color={color} style={styles.icon} />;
96
108
  }
@@ -109,24 +121,46 @@ const Input = forwardRef(
109
121
  </TouchableOpacity>
110
122
  );
111
123
  }
112
- if (icon) {
113
- return (
114
- <TouchableOpacity
115
- onPress={onPressIcon}
116
- disabled={!onPressIcon}
117
- style={styles.icon}>
118
- <Icon color={color} source={icon} size={24} />
119
- </TouchableOpacity>
124
+ if (icon || trailing) {
125
+ const renderIconTouchable = (icon: ReactNode) => {
126
+ return (
127
+ <TouchableOpacity
128
+ onPress={onPressTrailing ?? onPressIcon}
129
+ style={styles.icon}>
130
+ {icon}
131
+ </TouchableOpacity>
132
+ );
133
+ };
134
+ const trailingValue = icon || trailing;
135
+ if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
136
+ return renderIconTouchable(
137
+ <Icon
138
+ color={color}
139
+ source={(icon || trailing) as string}
140
+ size={24}
141
+ />
142
+ );
143
+ }
144
+ return renderIconTouchable(
145
+ <Text
146
+ typography="action_xs_bold"
147
+ color={color ?? theme.colors.primary}
148
+ numberOfLines={1}>
149
+ {trailingValue!.substring(0, 15)}
150
+ </Text>
120
151
  );
121
152
  }
122
153
  };
123
154
 
155
+ /**
156
+ * Render input view
157
+ */
124
158
  const renderInputView = () => {
125
159
  const disabledColor = theme.colors.text.disable;
126
160
  const secure = secureTextInput && secureTextEntry;
127
161
  let textColor = theme.colors.text.default;
128
162
  let placeholderColor = theme.colors.text.hint;
129
- let iconTintColor = iconColor;
163
+ let iconTintColor = trailingColor ?? iconColor;
130
164
 
131
165
  if (disabled) {
132
166
  textColor = disabledColor;
@@ -204,21 +238,19 @@ const Input = forwardRef(
204
238
  />
205
239
  </TouchableOpacity>
206
240
  )}
207
- {renderIcon(iconTintColor)}
241
+ {renderTrailing(iconTintColor)}
208
242
  </View>
209
243
  </View>
210
244
  );
211
245
  };
212
246
 
213
247
  let inputState = 'active';
214
-
215
248
  if (value && value?.length > 0) {
216
249
  inputState = 'filled';
217
250
  }
218
251
  if (errorMessage && errorMessage?.length > 0) {
219
252
  inputState = 'error';
220
253
  }
221
-
222
254
  if (disabled) {
223
255
  inputState = 'disabled';
224
256
  }
@@ -242,7 +274,7 @@ const Input = forwardRef(
242
274
  </View>
243
275
  </ComponentContext.Provider>
244
276
  );
245
- },
277
+ }
246
278
  );
247
279
 
248
280
  export default Input;
@@ -1,4 +1,4 @@
1
- import React, {useContext} from 'react';
1
+ import React, {ReactNode, useContext} from 'react';
2
2
  import {TextInput, TouchableOpacity, View} from 'react-native';
3
3
  import {ApplicationContext, ComponentContext} from '../Application';
4
4
  import {Styles} from '../Consts';
@@ -6,6 +6,7 @@ import {Icon} from '../Icon';
6
6
  import {Loader} from '../Loader';
7
7
  import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
8
8
  import {InputDropDownProps} from './index';
9
+ import {Text} from '../Text';
9
10
  import styles from './styles';
10
11
 
11
12
  const InputDropDown = ({
@@ -17,9 +18,13 @@ const InputDropDown = ({
17
18
  placeholder,
18
19
  errorMessage,
19
20
  icon = 'arrow_chevron_down_small',
21
+ iconColor,
22
+ onPressIcon,
23
+ trailing,
24
+ trailingColor,
25
+ onPressTrailing,
20
26
  disabled = false,
21
27
  floatingIconColor,
22
- iconColor,
23
28
  required = false,
24
29
  errorSpacing,
25
30
  loading = false,
@@ -32,22 +37,50 @@ const InputDropDown = ({
32
37
  ...props
33
38
  }: InputDropDownProps) => {
34
39
  const {theme} = useContext(ApplicationContext);
35
- const full = !!value || !!placeholder;
36
40
 
37
- const renderIcon = (color: string | undefined) => {
41
+ /**
42
+ * Render trailing icon or text
43
+ * @param color
44
+ */
45
+ const renderTrailing = (color?: string) => {
38
46
  if (loading) {
39
- return <Loader type={'spinner'} color={color} />;
47
+ return <Loader type={'spinner'} color={color} style={styles.icon} />;
40
48
  }
41
- if (icon) {
42
- return <Icon color={color} source={icon} size={24} />;
49
+ if (icon || trailing) {
50
+ const renderIconTouchable = (icon: ReactNode) => {
51
+ return (
52
+ <TouchableOpacity
53
+ onPress={onPressTrailing ?? onPressIcon}
54
+ style={styles.icon}>
55
+ {icon}
56
+ </TouchableOpacity>
57
+ );
58
+ };
59
+ const trailingValue = icon || trailing;
60
+ if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
61
+ return renderIconTouchable(
62
+ <Icon color={color} source={(icon || trailing) as string} size={24} />
63
+ );
64
+ }
65
+ return renderIconTouchable(
66
+ <Text
67
+ typography="action_xs_bold"
68
+ color={color ?? theme.colors.primary}
69
+ numberOfLines={1}>
70
+ {trailingValue!.substring(0, 15)}
71
+ </Text>
72
+ );
43
73
  }
44
74
  };
45
75
 
76
+ /**
77
+ * Render the input view
78
+ */
46
79
  const renderInputView = () => {
47
80
  const disabledColor = theme.colors.text.disable;
48
81
  let textColor = theme.colors.text.default;
49
82
  let placeholderColor = theme.colors.text.hint;
50
- let iconTintColor = iconColor;
83
+ let iconTintColor = trailingColor ?? iconColor;
51
84
 
52
85
  if (disabled) {
53
86
  textColor = disabledColor;
@@ -70,7 +103,7 @@ const InputDropDown = ({
70
103
  required={required}
71
104
  floatingIcon={floatingIcon}
72
105
  />
73
- <View style={full ? styles.inputView : Styles.row}>
106
+ <View style={Styles.row}>
74
107
  {!!leadingIcon && (
75
108
  <View style={styles.leadingIconContainer}>
76
109
  <Icon
@@ -80,28 +113,26 @@ const InputDropDown = ({
80
113
  />
81
114
  </View>
82
115
  )}
83
- {full && (
84
- <TextInput
85
- {...props}
86
- accessibilityLabel={accessibilityLabel}
87
- onPressIn={onPress}
88
- editable={false}
89
- style={[
90
- styles.input,
91
- {
92
- color: textColor,
93
- fontFamily: `${theme.font}-Regular`,
94
- },
95
- ]}
96
- textBreakStrategy="highQuality"
97
- value={value}
98
- placeholder={placeholder}
99
- selectionColor={theme.colors.primary}
100
- placeholderTextColor={placeholderColor}
101
- />
102
- )}
116
+ <TextInput
117
+ {...props}
118
+ accessibilityLabel={accessibilityLabel}
119
+ onPressOut={onPress}
120
+ editable={false}
121
+ style={[
122
+ styles.input,
123
+ {
124
+ color: textColor,
125
+ fontFamily: `${theme.font}-Regular`,
126
+ },
127
+ ]}
128
+ textBreakStrategy="highQuality"
129
+ value={value}
130
+ placeholder={placeholder}
131
+ selectionColor={theme.colors.primary}
132
+ placeholderTextColor={placeholderColor}
133
+ />
103
134
  </View>
104
- <View style={styles.iconView}>{renderIcon(iconTintColor)}</View>
135
+ <View style={styles.iconView}>{renderTrailing(iconTintColor)}</View>
105
136
  </View>
106
137
  );
107
138
  };
@@ -115,9 +146,7 @@ const InputDropDown = ({
115
146
  componentLabel: floatingValue,
116
147
  componentId: accessibilityLabel,
117
148
  }}>
118
- <TouchableOpacity
119
- onPress={onPress}
120
- style={[style, full && styles.wrapper]}>
149
+ <TouchableOpacity onPress={onPress} style={[style, styles.wrapper]}>
121
150
  {renderInputView()}
122
151
  <ErrorView
123
152
  errorMessage={errorMessage}
@@ -1,5 +1,6 @@
1
1
  import React, {
2
2
  forwardRef,
3
+ ReactNode,
3
4
  useContext,
4
5
  useEffect,
5
6
  useImperativeHandle,
@@ -19,6 +20,8 @@ import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
19
20
  import {InputMoneyProps} from './index';
20
21
  import styles from './styles';
21
22
  import {formatMoneyToNumber, formatNumberToMoney} from './utils';
23
+ import {Text} from '../Text';
24
+ import {Loader} from '../Loader';
22
25
 
23
26
  const InputMoney = forwardRef(
24
27
  (
@@ -27,13 +30,18 @@ const InputMoney = forwardRef(
27
30
  floatingValue,
28
31
  floatingIcon,
29
32
  size = 'small',
33
+ loading,
30
34
  onBlur,
31
35
  onFocus,
32
36
  errorMessage,
33
37
  icon,
38
+ iconColor,
39
+ onPressIcon,
40
+ trailing,
41
+ trailingColor,
42
+ onPressTrailing,
34
43
  disabled = false,
35
44
  floatingIconColor,
36
- iconColor,
37
45
  required = false,
38
46
  errorSpacing,
39
47
  style,
@@ -44,7 +52,7 @@ const InputMoney = forwardRef(
44
52
  value: _value,
45
53
  ...props
46
54
  }: InputMoneyProps,
47
- ref,
55
+ ref
48
56
  ) => {
49
57
  const {theme} = useContext(ApplicationContext);
50
58
  const [focused, setFocused] = useState(false);
@@ -63,7 +71,7 @@ const InputMoney = forwardRef(
63
71
  };
64
72
 
65
73
  const [value, setValue] = useState(
66
- defaultValue ? validateText(defaultValue) : '',
74
+ defaultValue ? validateText(defaultValue) : ''
67
75
  );
68
76
 
69
77
  const onClearText = () => {
@@ -99,11 +107,51 @@ const InputMoney = forwardRef(
99
107
  onBlur?.(e);
100
108
  };
101
109
 
110
+ /**
111
+ * Render trailing icon or text
112
+ * @param color
113
+ */
114
+ const renderTrailing = (color?: string) => {
115
+ if (loading) {
116
+ return <Loader type={'spinner'} color={color} style={styles.icon} />;
117
+ }
118
+
119
+ if (icon || trailing) {
120
+ const renderIconTouchable = (icon: ReactNode) => {
121
+ return (
122
+ <TouchableOpacity
123
+ onPress={onPressTrailing ?? onPressIcon}
124
+ style={styles.icon}>
125
+ {icon}
126
+ </TouchableOpacity>
127
+ );
128
+ };
129
+ const trailingValue = icon || trailing;
130
+ if (trailingValue?.includes('_') || trailingValue?.includes('http')) {
131
+ return renderIconTouchable(
132
+ <Icon
133
+ color={color}
134
+ source={(icon || trailing) as string}
135
+ size={24}
136
+ />
137
+ );
138
+ }
139
+ return renderIconTouchable(
140
+ <Text
141
+ typography="action_xs_bold"
142
+ color={color ?? theme.colors.primary}
143
+ numberOfLines={1}>
144
+ {trailingValue!.substring(0, 15)}
145
+ </Text>
146
+ );
147
+ }
148
+ };
149
+
102
150
  const renderInputView = () => {
103
151
  const disabledColor = theme.colors.text.disable;
104
152
  let textColor = theme.colors.text.default;
105
153
  let placeholderColor = theme.colors.text.hint;
106
- let iconTintColor = iconColor;
154
+ let iconTintColor = trailingColor ?? iconColor;
107
155
 
108
156
  if (disabled) {
109
157
  textColor = disabledColor;
@@ -160,7 +208,7 @@ const InputMoney = forwardRef(
160
208
  />
161
209
  </TouchableOpacity>
162
210
  )}
163
- {!!icon && <Icon color={iconTintColor} source={icon} />}
211
+ {renderTrailing(iconTintColor)}
164
212
  </View>
165
213
  </View>
166
214
  );
@@ -198,7 +246,7 @@ const InputMoney = forwardRef(
198
246
  </View>
199
247
  </ComponentContext.Provider>
200
248
  );
201
- },
249
+ }
202
250
  );
203
251
 
204
252
  export default InputMoney;
@@ -74,6 +74,7 @@ const InputOTP = forwardRef(
74
74
  placeholder,
75
75
  onChangeText,
76
76
  onBlur,
77
+ onFocus,
77
78
  dataType = 'number',
78
79
  params,
79
80
  style,
@@ -215,7 +216,7 @@ const InputOTP = forwardRef(
215
216
  value={value}
216
217
  onChangeText={_onChangeText}
217
218
  keyboardType={dataType === 'number' ? 'number-pad' : 'default'}
218
- onFocus={onFocusInput}
219
+ onFocus={onFocus}
219
220
  onBlur={onBlurInput}
220
221
  style={{opacity: 0}}
221
222
  selectionColor={theme.colors.primary}
@@ -18,6 +18,7 @@ import {Text} from '../Text';
18
18
  import {InputSearchProps} from './index';
19
19
  import styles from './styles';
20
20
  import {checkTyping} from './utils';
21
+ import {Styles} from '../Consts';
21
22
 
22
23
  const InputSearch = forwardRef(
23
24
  (
@@ -25,10 +26,14 @@ const InputSearch = forwardRef(
25
26
  placeholder,
26
27
  onFocus,
27
28
  onBlur,
28
- iconColor,
29
29
  value,
30
- onChangeText,
31
30
  icon,
31
+ iconColor,
32
+ onPressIcon,
33
+ trailing,
34
+ trailingColor,
35
+ onPressTrailing,
36
+ onChangeText,
32
37
  buttonText = 'Hủy',
33
38
  showButtonText = true,
34
39
  style,
@@ -39,7 +44,7 @@ const InputSearch = forwardRef(
39
44
  accessibilityLabel,
40
45
  ...props
41
46
  }: InputSearchProps,
42
- ref,
47
+ ref
43
48
  ) => {
44
49
  const {theme} = useContext(ApplicationContext);
45
50
  const [focused, setFocused] = useState(false);
@@ -75,6 +80,9 @@ const InputSearch = forwardRef(
75
80
  };
76
81
  });
77
82
 
83
+ /**
84
+ * Render the input view
85
+ */
78
86
  const renderInputView = () => {
79
87
  return (
80
88
  <TextInput
@@ -99,12 +107,12 @@ const InputSearch = forwardRef(
99
107
  );
100
108
  };
101
109
 
102
- const renderIconView = () => {
110
+ /**
111
+ * Render trailing icon or text
112
+ */
113
+ const renderTrailing = () => {
103
114
  return (
104
- <View
105
- style={{
106
- flexDirection: 'row',
107
- }}>
115
+ <View style={Styles.row}>
108
116
  {focused && haveValue && (
109
117
  <TouchableOpacity style={styles.iconWrapper} onPress={onClearText}>
110
118
  <Icon
@@ -114,8 +122,10 @@ const InputSearch = forwardRef(
114
122
  />
115
123
  </TouchableOpacity>
116
124
  )}
117
- {!!icon && (
118
- <View style={{flexDirection: 'row'}}>
125
+ {!!(icon || trailing) && (
126
+ <TouchableOpacity
127
+ style={Styles.row}
128
+ onPress={onPressTrailing ?? onPressIcon}>
119
129
  <View
120
130
  style={[
121
131
  styles.divider,
@@ -125,22 +135,20 @@ const InputSearch = forwardRef(
125
135
  ]}
126
136
  />
127
137
  <Icon
128
- color={iconColor}
129
- source={icon}
138
+ color={iconColor || trailingColor}
139
+ source={(icon || trailing) as string}
130
140
  style={styles.iconSearchInput}
131
141
  />
132
- </View>
142
+ </TouchableOpacity>
133
143
  )}
134
144
  </View>
135
145
  );
136
146
  };
137
147
 
138
148
  let inputState = 'empty';
139
-
140
149
  if (focused) {
141
150
  inputState = 'focus';
142
151
  }
143
-
144
152
  if (value && value?.length > 0) {
145
153
  inputState = 'filled';
146
154
  }
@@ -171,7 +179,7 @@ const InputSearch = forwardRef(
171
179
  color={theme.colors.text.hint}
172
180
  />
173
181
  {renderInputView()}
174
- {renderIconView()}
182
+ {renderTrailing()}
175
183
  </View>
176
184
  {showButtonText && (
177
185
  <TouchableOpacity onPress={onPressButtonText}>
@@ -185,7 +193,7 @@ const InputSearch = forwardRef(
185
193
  </View>
186
194
  </ComponentContext.Provider>
187
195
  );
188
- },
196
+ }
189
197
  );
190
198
 
191
199
  export default InputSearch;
package/Input/index.tsx CHANGED
@@ -6,6 +6,8 @@ import InputOTP from './InputOTP';
6
6
  import InputSearch from './InputSearch';
7
7
  import InputTextArea from './InputTextArea';
8
8
 
9
+ export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
10
+
9
11
  export interface InputProps extends TextInputProps {
10
12
  /**
11
13
  * Optional. Defines the size of the Input component.
@@ -28,15 +30,38 @@ export interface InputProps extends TextInputProps {
28
30
  errorMessage?: string;
29
31
 
30
32
  /**
33
+ * @deprecated Use `trailing` instead.
31
34
  * Optional. Represents the name or key of the icon to be displayed in the Input component.
32
35
  */
33
36
  icon?: string;
34
37
 
35
38
  /**
39
+ * @deprecated Use `trailingColor` instead.
36
40
  * Optional. Represents the color of the icon in the Input component.
37
41
  */
38
42
  iconColor?: string;
39
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
+ /**
51
+ * Optional. Represents the name or key of the icon to be displayed in the Input component.
52
+ */
53
+ trailing?: string;
54
+
55
+ /**
56
+ * Optional. Represents the color of the icon in the Input component.
57
+ */
58
+ trailingColor?: string;
59
+
60
+ /**
61
+ * Optional. callback function to be called when the icon is pressed.
62
+ */
63
+ onPressTrailing?: () => void;
64
+
40
65
  /**
41
66
  * Optional. If `true`, the user won't be able to interact with the Input component.
42
67
  * Defaults to `false` if not provided.
@@ -82,11 +107,6 @@ export interface InputProps extends TextInputProps {
82
107
  */
83
108
  fontWeight?: 'Regular' | 'Bold';
84
109
 
85
- /**
86
- * Optional. callback function to be called when the icon is pressed.
87
- */
88
- onPressIcon?: () => void;
89
-
90
110
  /**
91
111
  * Optional. params for element tracking.
92
112
  */
@@ -98,8 +118,7 @@ export interface InputProps extends TextInputProps {
98
118
  hintText?: string;
99
119
  }
100
120
 
101
- export interface InputTextAreaProps
102
- extends Omit<InputProps, 'size' | 'icon' | 'iconColor'> {
121
+ export interface InputTextAreaProps extends Omit<InputProps, 'size'> {
103
122
  /**
104
123
  * Optional. Defines the height of the InputTextArea component.
105
124
  * It can be used to set a specific height for the text area.
@@ -125,14 +144,37 @@ export interface InputSearchProps extends TextInputProps {
125
144
  onPressButtonText?: () => void;
126
145
 
127
146
  /**
147
+ * @deprecated Use `trailing` instead.
148
+ * Optional. Represents the name or key of the icon to be displayed in the Input component.
149
+ */
150
+ icon?: string;
151
+
152
+ /**
153
+ * @deprecated Use `trailingColor` instead.
128
154
  * Optional. Represents the color of the icon in the Input component.
129
155
  */
130
156
  iconColor?: string;
131
157
 
158
+ /**
159
+ * @deprecated Use `onPressTrailing` instead.
160
+ * Optional. callback function to be called when the icon is pressed.
161
+ */
162
+ onPressIcon?: () => void;
163
+
132
164
  /**
133
165
  * Optional. Represents the name or key of the icon to be displayed in the Input component.
134
166
  */
135
- icon?: string;
167
+ trailing?: string;
168
+
169
+ /**
170
+ * Optional. Represents the color of the icon in the Input component.
171
+ */
172
+ trailingColor?: string;
173
+
174
+ /**
175
+ * Optional. callback function to be called when the icon is pressed.
176
+ */
177
+ onPressTrailing?: () => void;
136
178
 
137
179
  /**
138
180
  * Optional. If `true`, the user won't be able to interact with the Input component.
@@ -147,8 +189,6 @@ export interface InputSearchProps extends TextInputProps {
147
189
 
148
190
  export interface InputMoneyProps extends Omit<InputProps, 'placeholder'> {}
149
191
 
150
- export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
151
-
152
192
  export interface InputOTPProps
153
193
  extends Omit<InputProps, 'size' | 'icon' | 'iconColor'> {
154
194
  /**
@@ -189,57 +229,17 @@ export interface InputDropDownProps extends InputProps {
189
229
  */
190
230
  size?: 'small' | 'large';
191
231
 
192
- /**
193
- * Optional. The current value of the InputDropDown.
194
- */
195
- value?: string;
196
-
197
- /**
198
- * Optional. Text that is displayed when there is no value set in the InputDropDown.
199
- */
200
- placeholder?: string;
201
-
202
232
  /**
203
233
  * Optional. Function to be called when the InputDropDown is pressed.
204
234
  */
205
235
  onPress?: () => void;
206
236
 
207
- /**
208
- * Optional. Represents the value for the floating title in the InputDropDown component.
209
- */
210
- floatingValue?: string;
211
-
212
- /**
213
- * Optional. Represents the name or key of the floating icon to be displayed in the InputDropDown component.
214
- */
215
- floatingIcon?: string;
216
-
217
- /**
218
- * Optional. Represents the error message to be displayed below the InputDropDown component when there is an error.
219
- */
220
- errorMessage?: string;
221
-
222
- /**
223
- * Optional. Represents the name or key of the icon to be displayed in the InputDropDown component.
224
- */
225
- icon?: string;
226
-
227
- /**
228
- * Optional. Represents the color of the icon in the InputDropDown component.
229
- */
230
- iconColor?: string;
231
-
232
237
  /**
233
238
  * Optional. If `true`, the user won't be able to interact with the InputDropDown component.
234
239
  * Defaults to `false` if not provided.
235
240
  */
236
241
  disabled?: boolean;
237
242
 
238
- /**
239
- * Optional. Represents the color of the floating icon in the InputDropDown component.
240
- */
241
- floatingIconColor?: string;
242
-
243
243
  /**
244
244
  * Optional. If `true`, the InputDropDown component is marked as required,
245
245
  * indicating that the user must provide a value before submitting a form.
@@ -247,28 +247,6 @@ export interface InputDropDownProps extends InputProps {
247
247
  */
248
248
  required?: boolean;
249
249
 
250
- /**
251
- * Optional. If `true`,
252
- * includes spacing when InputDropDown does not have an error message.
253
- * Defaults to `false` if not provided.
254
- */
255
- errorSpacing?: boolean;
256
-
257
- /**
258
- * If `true`, the icon of the input will show an indicator for loading.
259
- */
260
- loading?: boolean;
261
-
262
- /**
263
- * Optional. Represents the leading icon in the InputDropDown component.
264
- */
265
- leadingIcon?: string;
266
-
267
- /**
268
- * Optional. Represents the color of the leading icon in the InputDropDown component.
269
- */
270
- leadingIconColor?: string;
271
-
272
250
  /**
273
251
  * Optional. params for element tracking.
274
252
  */
package/code-scanner.js CHANGED
@@ -15,7 +15,7 @@ const calculateAdoptionRate = async (
15
15
  kitJsonPath,
16
16
  miniappJsonPath,
17
17
  reactNativeJsonPath,
18
- fsJsonPath,
18
+ fsJsonPath
19
19
  ) => {
20
20
  const kitJson = require(kitJsonPath);
21
21
  const miniAppJson = require(miniappJsonPath);
@@ -98,8 +98,8 @@ const main = async () => {
98
98
 
99
99
  const allKitsReg = /@momo-kits/;
100
100
  const fsReg =
101
- /^(?:@fs-mobile-platform\/(components|investment|screens)|@miniapp-platform\/(components|foundation))$/;
102
- const RNReg = 'react-native';
101
+ /^(?:@fs-mobile-platform\/(components(\/.*)?|investment(\/.*)?|screens(\/.*)?|foundation(\/.*)?)|@miniapp-platform\/(components(\/.*)?|foundation(\/.*)?))$/;
102
+ const RNReg = /react-native|react-native-svg/;
103
103
 
104
104
  const config1 = {
105
105
  crawlFrom: scanPath,
@@ -148,7 +148,7 @@ const main = async () => {
148
148
  kitJsonPath,
149
149
  miniappJsonPath,
150
150
  reactNativeJsonPath,
151
- fsJsonPath,
151
+ fsJsonPath
152
152
  );
153
153
  sendMessage(result);
154
154
  console.log(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.28",
3
+ "version": "0.92.29-optimize.2",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -43,4 +43,4 @@
43
43
  },
44
44
  "author": "@momo-kits/foundation",
45
45
  "license": "ISC"
46
- }
46
+ }
package/publish.sh CHANGED
@@ -7,16 +7,16 @@ rsync -r --exclude=/dist ./* dist
7
7
  cd dist
8
8
 
9
9
  if [ "$1" == "stable" ]; then
10
- npm version $(npm view @momo-kits/foundation@stable version)
11
- npm version patch
10
+ #npm version $(npm view @momo-kits/foundation@stable version)
11
+ #npm version patch
12
12
  npm publish --tag stable --access=public
13
13
  elif [ "$1" == "latest" ]; then
14
- npm version $(npm view @momo-kits/foundation@latest version)
15
- npm version prerelease --preid=rc
14
+ #npm version $(npm view @momo-kits/foundation@latest version)
15
+ #npm version prerelease --preid=rc
16
16
  npm publish --tag latest --access=public
17
17
  else
18
- npm version $(npm view @momo-kits/foundation@beta version)
19
- npm version prerelease --preid=beta
18
+ #npm version $(npm view @momo-kits/foundation@beta version)
19
+ #npm version prerelease --preid=beta
20
20
  npm publish --tag beta --access=public
21
21
  fi
22
22
 
package/verify.js CHANGED
@@ -1,47 +1,41 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
 
4
- try {
5
- const packageInfo = JSON.parse(
6
- fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8'),
4
+ const packageInfo = JSON.parse(
5
+ fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8')
6
+ );
7
+ const packageVersion = parseInt(packageInfo?.version.split('.')?.[1]);
8
+
9
+ const app = path.join(`${__dirname}/../../../`, 'app.json');
10
+ const miniJson = path.join(`${__dirname}/../../../`, 'package.json');
11
+
12
+ if (!fs.existsSync(app) || !fs.existsSync(miniJson)) {
13
+ return;
14
+ }
15
+
16
+ const appInfo = JSON.parse(fs.readFileSync(app, 'utf8'));
17
+ const miniInfo = JSON.parse(fs.readFileSync(miniJson, 'utf8'));
18
+
19
+ const iOSAppTarget = appInfo?.client?.ios.deploymentTarget;
20
+ const androidAppTarget = appInfo?.client?.android.deploymentTarget;
21
+
22
+ if (
23
+ miniInfo?.dependencies?.['@momo-platform/momo-core']?.includes('optimize')
24
+ ) {
25
+ return;
26
+ }
27
+
28
+ if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
29
+ throw new Error(
30
+ `\x1b[41m Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`
31
+ );
32
+ }
33
+
34
+ if (
35
+ miniInfo?.dependencies?.['@momo-platform/momo-core'] &&
36
+ miniInfo?.dependencies?.['@momo-platform/momo-core'] !== packageInfo?.version
37
+ ) {
38
+ throw new Error(
39
+ `\x1b[41m Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`
7
40
  );
8
- const packageVersion = parseInt(packageInfo?.version.split('.')?.[1]);
9
-
10
- const app = path.join(`${__dirname}/../../../`, 'app.json');
11
- const miniJson = path.join(`${__dirname}/../../../`, 'package.json');
12
-
13
- if (!fs.existsSync(app) || fs.existsSync(miniJson)) {
14
- return;
15
- }
16
-
17
- const appInfo = JSON.parse(fs.readFileSync(app, 'utf8'));
18
- const miniInfo = JSON.parse(fs.readFileSync(miniJson, 'utf8'));
19
-
20
- const iOSAppTarget = appInfo?.client?.ios.deploymentTarget;
21
- const androidAppTarget = appInfo?.client?.android.deploymentTarget;
22
-
23
- if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
24
- console.error(
25
- `Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`,
26
- );
27
- throw new Error(
28
- `Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`,
29
- );
30
- }
31
-
32
- if (
33
- miniInfo?.dependencies?.['@momo-platform/momo-core'] &&
34
- miniInfo?.dependencies?.['@momo-platform/momo-core'] !==
35
- packageInfo?.version
36
- ) {
37
- console.error(
38
- `Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`,
39
- );
40
- throw new Error(
41
- `Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`,
42
- );
43
- }
44
- } catch (error) {
45
- console.error(`Installation failed: ${error.message}`);
46
- process.exit(1);
47
41
  }