@momo-kits/foundation 0.81.51-beta.0 → 0.81.52

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.
Files changed (71) hide show
  1. package/Application/{BottomTab/index.tsx → BottomTab.tsx} +18 -42
  2. package/Application/Components.tsx +91 -356
  3. package/Application/ModalScreen.tsx +185 -14
  4. package/Application/Navigation.ts +19 -5
  5. package/Application/NavigationContainer.tsx +72 -62
  6. package/Application/Navigator.ts +48 -154
  7. package/Application/StackScreen.tsx +32 -289
  8. package/Application/index.ts +15 -13
  9. package/Application/types.ts +35 -81
  10. package/Application/utils.tsx +30 -76
  11. package/Assets/icon_bank.json +1 -1
  12. package/Badge/Badge.tsx +1 -1
  13. package/Badge/index.tsx +1 -2
  14. package/Badge/styles.ts +6 -50
  15. package/Button/index.tsx +26 -44
  16. package/CheckBox/index.tsx +26 -37
  17. package/CheckBox/types.ts +3 -5
  18. package/Consts/colors+spacing+radius.ts +0 -14
  19. package/Icon/index.tsx +8 -9
  20. package/Icon/types.ts +2 -2
  21. package/IconButton/index.tsx +14 -24
  22. package/Image/index.tsx +8 -23
  23. package/Image/types.ts +0 -2
  24. package/Input/Input.tsx +26 -116
  25. package/Input/InputDropDown.tsx +51 -66
  26. package/Input/InputMoney.tsx +15 -106
  27. package/Input/InputOTP.tsx +26 -49
  28. package/Input/InputSearch.tsx +99 -252
  29. package/Input/InputTextArea.tsx +6 -26
  30. package/Input/common.tsx +22 -48
  31. package/Input/index.tsx +77 -112
  32. package/Input/styles.ts +11 -48
  33. package/Input/utils.ts +1 -1
  34. package/Layout/Card.tsx +3 -4
  35. package/Layout/GridSystem.tsx +1 -1
  36. package/Layout/ItemList.tsx +2 -3
  37. package/Layout/Screen.tsx +121 -242
  38. package/Layout/Section.tsx +3 -4
  39. package/Layout/styles.ts +13 -11
  40. package/Layout/types.ts +1 -1
  41. package/Layout/utils.ts +4 -4
  42. package/Loader/index.tsx +0 -2
  43. package/Pagination/PaginationScroll.tsx +2 -2
  44. package/Pagination/styles.ts +1 -1
  45. package/Popup/PopupNotify.tsx +46 -57
  46. package/Popup/PopupPromotion.tsx +8 -6
  47. package/Popup/types.ts +7 -1
  48. package/Radio/index.tsx +20 -35
  49. package/Radio/types.ts +3 -5
  50. package/Switch/index.tsx +18 -32
  51. package/Switch/types.ts +3 -5
  52. package/Tag/index.tsx +2 -9
  53. package/Tag/styles.ts +2 -3
  54. package/Tag/types.ts +0 -12
  55. package/Text/index.tsx +5 -24
  56. package/Text/styles.ts +8 -8
  57. package/Title/index.tsx +103 -170
  58. package/Title/styles.ts +9 -36
  59. package/Title/types.ts +48 -16
  60. package/code-scanner.js +16 -125
  61. package/index.ts +0 -7
  62. package/package.json +7 -8
  63. package/publish.sh +21 -16
  64. package/tsconfig.json +1 -1
  65. package/Application/BottomSheet.tsx +0 -216
  66. package/Application/BottomTab/BottomTabBar.tsx +0 -278
  67. package/Application/Localize.ts +0 -44
  68. package/Application/constants.ts +0 -9
  69. package/Badge/BadgeDotAnimation.tsx +0 -95
  70. package/Input/TextTyping.tsx +0 -113
  71. package/Layout/FloatingButton.tsx +0 -168
package/Input/index.tsx CHANGED
@@ -1,12 +1,10 @@
1
- import {GestureResponderEvent, TextInputProps, ViewStyle} from 'react-native';
2
1
  import Input from './Input';
3
- import InputDropDown from './InputDropDown';
2
+ import InputTextArea from './InputTextArea';
3
+ import InputSearch from './InputSearch';
4
4
  import InputMoney from './InputMoney';
5
5
  import InputOTP from './InputOTP';
6
- import InputSearch from './InputSearch';
7
- import InputTextArea from './InputTextArea';
8
-
9
- export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
6
+ import InputDropDown from './InputDropDown';
7
+ import {TextInputProps, ViewStyle} from 'react-native';
10
8
 
11
9
  export interface InputProps extends TextInputProps {
12
10
  /**
@@ -30,38 +28,15 @@ export interface InputProps extends TextInputProps {
30
28
  errorMessage?: string;
31
29
 
32
30
  /**
33
- * @deprecated Use `trailing` instead.
34
31
  * Optional. Represents the name or key of the icon to be displayed in the Input component.
35
32
  */
36
33
  icon?: string;
37
34
 
38
35
  /**
39
- * @deprecated Use `trailingColor` instead.
40
36
  * Optional. Represents the color of the icon in the Input component.
41
37
  */
42
38
  iconColor?: string;
43
39
 
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
-
65
40
  /**
66
41
  * Optional. If `true`, the user won't be able to interact with the Input component.
67
42
  * Defaults to `false` if not provided.
@@ -102,25 +77,19 @@ export interface InputProps extends TextInputProps {
102
77
  */
103
78
  leadingIconColor?: string;
104
79
 
105
- /**
106
- * Optional. Represents the font weight of the text in the Input component.
107
- */
108
80
  fontWeight?: 'Regular' | 'Bold';
109
81
 
110
- /**
111
- * Optional. params for element tracking.
112
- */
113
- params?: any;
82
+ onPressIcon?: () => void;
83
+ }
114
84
 
115
- /**
116
- * Optional. Represents text below the Input component.
117
- */
118
- hintText?: string;
85
+ type InputPropsWithoutSizeAndIcon = Omit<
86
+ InputProps,
87
+ 'size' | 'icon' | 'iconColor'
88
+ >;
119
89
 
120
- onPressFloatingIcon?: (e: GestureResponderEvent) => void;
121
- }
90
+ type InputPropsWithoutPlaceholder = Omit<InputProps, 'placeholder'>;
122
91
 
123
- export interface InputTextAreaProps extends Omit<InputProps, 'size'> {
92
+ export interface InputTextAreaProps extends InputPropsWithoutSizeAndIcon {
124
93
  /**
125
94
  * Optional. Defines the height of the InputTextArea component.
126
95
  * It can be used to set a specific height for the text area.
@@ -140,70 +109,26 @@ export interface InputSearchProps extends TextInputProps {
140
109
  */
141
110
  showButtonText?: boolean;
142
111
 
143
- /**
144
- * Optional. Represents the value for the floating title in the InputSearch component.
145
- */
146
112
  onPressButtonText?: () => void;
147
113
 
148
114
  /**
149
- * @deprecated Use `trailing` instead.
150
- * Optional. Represents the name or key of the icon to be displayed in the Input component.
151
- */
152
- icon?: string;
153
-
154
- /**
155
- * @deprecated Use `trailingColor` instead.
156
115
  * Optional. Represents the color of the icon in the Input component.
157
116
  */
158
117
  iconColor?: string;
159
118
 
160
- /**
161
- * @deprecated Use `onPressTrailing` instead.
162
- * Optional. callback function to be called when the icon is pressed.
163
- */
164
- onPressIcon?: () => void;
165
-
166
119
  /**
167
120
  * Optional. Represents the name or key of the icon to be displayed in the Input component.
168
121
  */
169
- trailing?: string;
170
-
171
- /**
172
- * Optional. Represents the color of the icon in the Input component.
173
- */
174
- trailingColor?: string;
175
-
176
- /**
177
- * Optional. callback function to be called when the icon is pressed.
178
- */
179
- onPressTrailing?: () => void;
180
-
181
- /**
182
- * Optional. If `true`, the user won't be able to interact with the Input component.
183
- */
184
- hasColorBG?: boolean;
185
-
186
- /**
187
- * Optional. Represents the style of the InputSearch component.
188
- */
189
- params?: any;
190
-
191
- /**
192
- * Optional. Represents the data for typing animation.
193
- */
194
- typingData?: string[];
122
+ icon?: string;
195
123
 
196
- /**
197
- * Optional. Represents the callback function to be called when the search button is pressed.
198
- * @param e
199
- */
200
- onPress?: (e: GestureResponderEvent) => void;
124
+ hasColorBG?: boolean
201
125
  }
202
126
 
203
- export interface InputMoneyProps extends Omit<InputProps, 'placeholder'> {}
127
+ export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
128
+
129
+ export type OTPInputLength = 2 | 4 | 6 | 8 | 10;
204
130
 
205
- export interface InputOTPProps
206
- extends Omit<InputProps, 'size' | 'icon' | 'iconColor'> {
131
+ export interface InputOTPProps extends InputPropsWithoutSizeAndIcon {
207
132
  /**
208
133
  * Optional. Defines the length of the OTP (One Time Password) input.
209
134
  * Can be 2, 4, 6, 8, or 10.
@@ -216,8 +141,6 @@ export interface InputOTPProps
216
141
  * 'number' - The OTP input will be treated as a number.
217
142
  */
218
143
  dataType?: 'string' | 'number';
219
-
220
- floatingValue: string;
221
144
  }
222
145
 
223
146
  export type CaretProps = {
@@ -234,8 +157,7 @@ export type CaretProps = {
234
157
  length?: number;
235
158
  };
236
159
 
237
- export interface InputDropDownProps
238
- extends Omit<InputProps, 'trailing' | 'trailingColor' | 'onPressTrailing'> {
160
+ export interface InputDropDownProps {
239
161
  /**
240
162
  * Optional. Defines the size of the InputDropDown component.
241
163
  * 'small' - A smaller, less prominent input.
@@ -243,17 +165,57 @@ export interface InputDropDownProps
243
165
  */
244
166
  size?: 'small' | 'large';
245
167
 
168
+ /**
169
+ * Optional. The current value of the InputDropDown.
170
+ */
171
+ value?: string;
172
+
173
+ /**
174
+ * Optional. Text that is displayed when there is no value set in the InputDropDown.
175
+ */
176
+ placeholder?: string;
177
+
246
178
  /**
247
179
  * Optional. Function to be called when the InputDropDown is pressed.
248
180
  */
249
181
  onPress?: () => void;
250
182
 
183
+ /**
184
+ * Optional. Represents the value for the floating title in the InputDropDown component.
185
+ */
186
+ floatingValue?: string;
187
+
188
+ /**
189
+ * Optional. Represents the name or key of the floating icon to be displayed in the InputDropDown component.
190
+ */
191
+ floatingIcon?: string;
192
+
193
+ /**
194
+ * Optional. Represents the error message to be displayed below the InputDropDown component when there is an error.
195
+ */
196
+ errorMessage?: string;
197
+
198
+ /**
199
+ * Optional. Represents the name or key of the icon to be displayed in the InputDropDown component.
200
+ */
201
+ icon?: string;
202
+
203
+ /**
204
+ * Optional. Represents the color of the icon in the InputDropDown component.
205
+ */
206
+ iconColor?: string;
207
+
251
208
  /**
252
209
  * Optional. If `true`, the user won't be able to interact with the InputDropDown component.
253
210
  * Defaults to `false` if not provided.
254
211
  */
255
212
  disabled?: boolean;
256
213
 
214
+ /**
215
+ * Optional. Represents the color of the floating icon in the InputDropDown component.
216
+ */
217
+ floatingIconColor?: string;
218
+
257
219
  /**
258
220
  * Optional. If `true`, the InputDropDown component is marked as required,
259
221
  * indicating that the user must provide a value before submitting a form.
@@ -262,25 +224,28 @@ export interface InputDropDownProps
262
224
  required?: boolean;
263
225
 
264
226
  /**
265
- * Optional. params for element tracking.
227
+ * Optional. If `true`,
228
+ * includes spacing when InputDropDown does not have an error message.
229
+ * Defaults to `false` if not provided.
266
230
  */
267
- params?: {
268
- [key: string]: any;
269
- };
231
+ errorSpacing?: boolean;
270
232
 
271
233
  /**
272
- * Optional. Represents the style of the InputDropDown component.
234
+ * If `true`, the icon of the input will show an indicator for loading.
273
235
  */
274
- style?: ViewStyle | ViewStyle[];
236
+ loading?: boolean;
275
237
 
276
- multiline?: boolean;
277
- }
238
+ /**
239
+ * Optional. Represents the leading icon in the InputDropDown component.
240
+ */
241
+ leadingIcon?: string;
278
242
 
279
- export type InputRef = {
280
- clear: () => void;
281
- focus: () => void | undefined;
282
- blur: () => void | undefined;
283
- setText: (text: string) => void;
284
- };
243
+ /**
244
+ * Optional. Represents the color of the leading icon in the InputDropDown component.
245
+ */
246
+ leadingIconColor?: string;
247
+
248
+ style: ViewStyle | ViewStyle[];
249
+ }
285
250
 
286
- export {Input, InputDropDown, InputMoney, InputOTP, InputSearch, InputTextArea};
251
+ export {Input, InputTextArea, InputSearch, InputMoney, InputOTP, InputDropDown};
package/Input/styles.ts CHANGED
@@ -1,5 +1,5 @@
1
- import {Platform, StyleSheet} from 'react-native';
2
- import {Colors, Radius, Spacing} from '../Consts';
1
+ import {StyleSheet} from 'react-native';
2
+ import {Radius, Spacing} from '../Consts';
3
3
  import {scaleSize} from '../Text';
4
4
 
5
5
  export default StyleSheet.create({
@@ -7,8 +7,7 @@ export default StyleSheet.create({
7
7
  input: {
8
8
  flex: 1,
9
9
  paddingLeft: Spacing.M,
10
- fontSize: scaleSize(14),
11
- height: '100%',
10
+ fontSize: scaleSize(15),
12
11
  },
13
12
  wrapper: {
14
13
  width: '100%',
@@ -29,12 +28,12 @@ export default StyleSheet.create({
29
28
  left: Spacing.S,
30
29
  paddingHorizontal: Spacing.S,
31
30
  flexDirection: 'row',
32
- alignItems: 'center',
33
31
  },
34
32
  floatingIcon: {marginLeft: Spacing.XS},
35
- errorIcon: {marginRight: Spacing.XS, marginTop: Spacing.XXS},
33
+ errorIcon: {marginRight: Spacing.XS},
36
34
  errorView: {
37
35
  flexDirection: 'row',
36
+ alignItems: 'center',
38
37
  marginTop: Spacing.XS,
39
38
  },
40
39
  inputView: {
@@ -54,7 +53,7 @@ export default StyleSheet.create({
54
53
  marginRight: Spacing.M,
55
54
  },
56
55
  icon: {
57
- marginLeft: Spacing.S,
56
+ marginLeft: Spacing.S
58
57
  },
59
58
  iconWrapper: {
60
59
  width: 24,
@@ -76,7 +75,7 @@ export default StyleSheet.create({
76
75
  flex: 1,
77
76
  paddingRight: Spacing.XS,
78
77
  paddingVertical: Spacing.XS,
79
- fontSize: scaleSize(14),
78
+ fontSize: scaleSize(15),
80
79
  },
81
80
  textAreaWrapper: {
82
81
  borderWidth: 1,
@@ -109,7 +108,7 @@ export default StyleSheet.create({
109
108
  height: 36,
110
109
  marginLeft: Spacing.S,
111
110
  flex: 1,
112
- fontSize: scaleSize(14),
111
+ fontSize: scaleSize(15),
113
112
  paddingVertical: Spacing.XS,
114
113
  },
115
114
  searchInputView: {
@@ -133,27 +132,20 @@ export default StyleSheet.create({
133
132
  paddingVertical: Spacing.S,
134
133
  fontWeight: 'bold',
135
134
  },
136
- inputStyle: {
137
- color: Colors.black_12,
138
- fontSize: scaleSize(12),
139
- height: Platform.select({
140
- android: 60,
141
- ios: 36,
142
- }),
143
- },
135
+
144
136
  //OTP
145
137
  otpWrapper: {
146
138
  width: '100%',
147
139
  marginTop: Spacing.M,
148
140
  },
149
141
  otpInput: {
150
- height: 56,
142
+ height: scaleSize(56),
151
143
  borderRadius: Radius.S,
152
144
  borderWidth: 1,
153
145
  },
154
146
  otpFloatingView: {
155
147
  position: 'absolute',
156
- top: -Spacing.M + 2,
148
+ top: -Spacing.S,
157
149
  alignSelf: 'center',
158
150
  paddingHorizontal: Spacing.S,
159
151
  },
@@ -164,33 +156,4 @@ export default StyleSheet.create({
164
156
  alignItems: 'center',
165
157
  justifyContent: 'center',
166
158
  },
167
-
168
- //DropDown
169
- inputDropDownWrapper: {
170
- flexDirection: 'row',
171
- marginTop: Spacing.S,
172
- },
173
- inputDropDownView: {
174
- flex: 1,
175
- flexDirection: 'row',
176
- paddingLeft: Spacing.M,
177
- },
178
- iconViewDropDown: {
179
- flexDirection: 'row',
180
- marginRight: Spacing.M,
181
- },
182
- textViewDropDown: {
183
- flex: 1,
184
- marginVertical: Spacing.M,
185
- marginRight: Spacing.S,
186
- justifyContent: 'center',
187
- },
188
- multilineContainer: {
189
- borderWidth: 1,
190
- borderRadius: Radius.S,
191
- },
192
- leadingIconContainerDropDown: {
193
- borderRadius: Radius.XS,
194
- overflow: 'hidden',
195
- },
196
159
  });
package/Input/utils.ts CHANGED
@@ -61,7 +61,7 @@ const formatMoneyToNumber = (money: string, currencyUnit: string) => {
61
61
  };
62
62
  const checkTyping = (text: string, value: boolean, setValue: any) => {
63
63
  let typing = text?.length > 0;
64
- if (typing !== value) {
64
+ if (typing != value) {
65
65
  setValue(typing);
66
66
  }
67
67
  };
package/Layout/Card.tsx CHANGED
@@ -86,7 +86,7 @@ const Card: React.FC<CardProps> = ({
86
86
  {rows.map((i: React.ReactElement, index: number) => {
87
87
  return (
88
88
  <View key={`Item${cursor}${index}`} style={{flexDirection: 'row'}}>
89
- {index !== 0 && (
89
+ {index != 0 && (
90
90
  <View style={{width: gridContext.gutterSize}}></View>
91
91
  )}
92
92
  {i}
@@ -126,14 +126,14 @@ const Card: React.FC<CardProps> = ({
126
126
  rows = [item];
127
127
  }
128
128
 
129
- if (i === arrayChild.length - 1) {
129
+ if (i == arrayChild.length - 1) {
130
130
  cursor += 1;
131
131
  element.push(addRowView(rows, cursor, true));
132
132
  }
133
133
  }
134
134
  } else {
135
135
  element.push(children);
136
- if (children?.type === Fragment) {
136
+ if (children?.type == Fragment) {
137
137
  return renderView(children?.props.children);
138
138
  }
139
139
  }
@@ -144,7 +144,6 @@ const Card: React.FC<CardProps> = ({
144
144
  <GridContext.Provider value={gridContext}>
145
145
  <View
146
146
  {...props}
147
- onLayout={undefined}
148
147
  style={[
149
148
  {backgroundColor: theme.colors.background.surface},
150
149
  style,
@@ -53,7 +53,7 @@ const GridSystem: React.FC<any> = ({
53
53
  {list.map((_, index) => {
54
54
  return (
55
55
  <View style={{flexDirection: 'row'}} key={index.toString()}>
56
- {index !== 0 && <View style={{width: grid.gutterSize}} />}
56
+ {index != -0 && <View style={{width: grid.gutterSize}} />}
57
57
  <View
58
58
  key={`Grid${index.toString()}`}
59
59
  pointerEvents="none"
@@ -20,7 +20,7 @@ const ItemList = forwardRef(
20
20
  contentContainerStyle,
21
21
  ...props
22
22
  }: ItemListProps,
23
- ref
23
+ ref,
24
24
  ) => {
25
25
  const {gutterSize, numberOfColumns} = useContext(GridContext);
26
26
  const widthItem = (widthSpan ?? numberOfColumns) as SpanNumber;
@@ -41,7 +41,6 @@ const ItemList = forwardRef(
41
41
  <FlatList
42
42
  ref={ref as React.RefObject<FlatList>}
43
43
  {...props}
44
- key={`ItemList-${numColumns}`}
45
44
  numColumns={numColumns}
46
45
  renderItem={_renderItem}
47
46
  horizontal={false}
@@ -50,7 +49,7 @@ const ItemList = forwardRef(
50
49
  contentContainerStyle={[contentContainerStyle, styles.protectedStyle]}
51
50
  />
52
51
  );
53
- }
52
+ },
54
53
  );
55
54
 
56
55
  export default ItemList;