@momo-kits/foundation 0.76.1-beta.2 → 0.77.1-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.
Files changed (100) hide show
  1. package/Application/BottomTab/BottomTabBar.tsx +478 -0
  2. package/Application/BottomTab/index.tsx +134 -0
  3. package/Application/Components.tsx +339 -161
  4. package/Application/ModalScreen.tsx +113 -99
  5. package/Application/Navigation.ts +22 -16
  6. package/Application/NavigationContainer.tsx +99 -48
  7. package/Application/Navigator.ts +110 -41
  8. package/Application/StackScreen.tsx +126 -8
  9. package/Application/index.ts +23 -4
  10. package/Application/types.ts +84 -33
  11. package/Application/utils.tsx +90 -50
  12. package/Assets/DotAnimation.json +256 -0
  13. package/Assets/SpinnerAnimation.json +1027 -0
  14. package/Assets/icon.json +83 -5
  15. package/Assets/icon_bank.json +506 -0
  16. package/Assets/language.json +202 -0
  17. package/Badge/Badge.tsx +56 -0
  18. package/Badge/BadgeDot.tsx +11 -0
  19. package/Badge/BadgeRibbon.tsx +125 -0
  20. package/Badge/Shape.tsx +29 -0
  21. package/Badge/index.tsx +7 -0
  22. package/Badge/styles.ts +58 -0
  23. package/Badge/types.ts +63 -0
  24. package/Button/index.tsx +90 -39
  25. package/Button/styles.ts +19 -0
  26. package/CheckBox/index.tsx +58 -43
  27. package/CheckBox/styles.ts +1 -1
  28. package/CheckBox/types.ts +6 -4
  29. package/Consts/colors+spacing+radius.ts +18 -0
  30. package/Consts/styles.ts +0 -26
  31. package/Consts/theme.ts +4 -0
  32. package/Divider/index.tsx +2 -0
  33. package/Icon/index.tsx +13 -9
  34. package/Icon/types.ts +4 -3
  35. package/IconButton/index.tsx +24 -15
  36. package/Image/index.tsx +60 -48
  37. package/Image/styles.ts +1 -9
  38. package/Image/types.ts +5 -1
  39. package/Input/Input.tsx +227 -116
  40. package/Input/InputDropDown.tsx +132 -0
  41. package/Input/InputMoney.tsx +174 -111
  42. package/Input/InputOTP.tsx +257 -0
  43. package/Input/InputSearch.tsx +160 -132
  44. package/Input/InputTextArea.tsx +150 -123
  45. package/Input/common.tsx +42 -17
  46. package/Input/index.tsx +204 -18
  47. package/Input/styles.ts +44 -7
  48. package/Input/utils.ts +2 -2
  49. package/Layout/Card.tsx +67 -29
  50. package/Layout/FloatingButton.tsx +128 -0
  51. package/Layout/GridSystem.tsx +31 -21
  52. package/Layout/Item.tsx +21 -25
  53. package/Layout/ItemList.tsx +55 -0
  54. package/Layout/ItemSectionList.tsx +39 -0
  55. package/Layout/Screen.tsx +348 -153
  56. package/Layout/Section.tsx +66 -34
  57. package/Layout/index.ts +13 -3
  58. package/Layout/styles.ts +101 -0
  59. package/Layout/types.ts +1 -39
  60. package/Layout/utils.ts +27 -52
  61. package/Loader/DotLoader.tsx +37 -0
  62. package/Loader/Loader.tsx +13 -0
  63. package/Loader/ProgressBar.tsx +44 -0
  64. package/Loader/Spinner.tsx +29 -0
  65. package/Loader/index.tsx +4 -0
  66. package/Loader/styles.ts +10 -0
  67. package/Loader/types.ts +35 -0
  68. package/Loader/utils.ts +25 -0
  69. package/Pagination/PaginationDot.tsx +7 -2
  70. package/Pagination/PaginationNumber.tsx +8 -6
  71. package/Pagination/PaginationScroll.tsx +0 -1
  72. package/Pagination/PaginationWhiteDot.tsx +8 -5
  73. package/Pagination/styles.ts +3 -0
  74. package/Pagination/types.ts +2 -0
  75. package/Popup/PopupNotify.tsx +102 -44
  76. package/Popup/PopupPromotion.tsx +63 -22
  77. package/Popup/types.ts +15 -4
  78. package/Radio/index.tsx +35 -21
  79. package/Radio/types.ts +7 -5
  80. package/Skeleton/index.tsx +1 -1
  81. package/Skeleton/types.ts +3 -0
  82. package/Switch/index.tsx +35 -24
  83. package/Switch/types.ts +5 -3
  84. package/Tag/index.tsx +2 -4
  85. package/Text/index.tsx +27 -22
  86. package/Text/styles.ts +38 -0
  87. package/Text/types.ts +25 -13
  88. package/Text/utils.ts +1 -1
  89. package/Title/index.tsx +186 -0
  90. package/Title/styles.ts +79 -0
  91. package/Title/types.ts +20 -0
  92. package/code-scanner.js +143 -0
  93. package/index.ts +8 -1
  94. package/migrate_typo.js +56 -0
  95. package/package.json +14 -9
  96. package/tsconfig.json +24 -0
  97. package/verify.js +47 -0
  98. package/Application/BottomTab.tsx +0 -52
  99. package/Application/NavigationButton.tsx +0 -54
  100. package/Assets/header-background.png +0 -0
@@ -12,40 +12,39 @@ import {
12
12
  } from './Components';
13
13
  import {NavigationOptions, Theme} from './types';
14
14
  import {Colors} from '../Consts';
15
-
16
- const getTintColor = (theme: Theme): any => {
17
- if (theme.assets?.headerBackground) {
18
- return {
19
- headerTintColor: Colors.black_01,
20
- };
21
- }
22
- return {
23
- headerTintColor: theme.colors.text.default,
24
- };
25
- };
26
-
27
- const getStackOptions = (theme: Theme): StackNavigationOptions => {
15
+ import {Platform} from 'react-native';
16
+ const isIOS = Platform.OS === 'ios';
17
+ /**
18
+ * default options for stack screen
19
+ */
20
+ const getStackOptions = (): StackNavigationOptions => {
28
21
  return {
29
22
  headerTitleAlign: 'left',
30
23
  headerTitle: HeaderTitle,
31
- headerBackground: HeaderBackground,
24
+ headerBackground: (props: any) => <HeaderBackground {...props} />,
32
25
  headerLeft: (props: any) => <HeaderLeft {...props} />,
33
26
  headerRight: (props: any) => <HeaderToolkitAction {...props} />,
34
- ...getTintColor(theme),
27
+ headerTintColor: Colors.black_01,
35
28
  };
36
29
  };
37
30
 
38
- const getDialogOptions = (theme: Theme): StackNavigationOptions => {
31
+ /**
32
+ * default options for dialog screen
33
+ */
34
+ const getDialogOptions = (): StackNavigationOptions => {
39
35
  return {
40
36
  headerTitleAlign: 'left',
41
37
  headerTitle: HeaderTitle,
42
38
  headerLeft: (props: any) => <HeaderLeft {...props} />,
43
- headerBackground: HeaderBackground,
44
- ...getTintColor(theme),
39
+ headerBackground: (props: any) => <HeaderBackground {...props} />,
40
+ headerTintColor: Colors.black_01,
45
41
  ...TransitionPresets.ModalTransition,
46
42
  };
47
43
  };
48
44
 
45
+ /**
46
+ * default options for modal screen
47
+ */
49
48
  const getModalOptions = (): StackNavigationOptions => {
50
49
  return {
51
50
  headerShown: false,
@@ -71,41 +70,51 @@ const getModalOptions = (): StackNavigationOptions => {
71
70
  };
72
71
  };
73
72
 
73
+ /**
74
+ * build react-navigation options
75
+ */
74
76
  const getOptions = (params: NavigationOptions, theme: Theme) => {
75
- let backgroundProps = {};
76
- let titleProps = {};
77
77
  let options = {};
78
78
 
79
- if (params.preventBack) {
79
+ if (
80
+ typeof params.onPressLeftHeader === 'function' ||
81
+ params.preventBack !== undefined ||
82
+ typeof params.hiddenBack === 'boolean'
83
+ ) {
80
84
  options = {
81
85
  ...options,
82
- headerLeft: (props: any) => (
83
- <HeaderLeft {...props} preventBack={params.preventBack} />
84
- ),
86
+ headerLeft: params.hiddenBack
87
+ ? null
88
+ : (props: any) => (
89
+ <HeaderLeft
90
+ {...props}
91
+ preventBack={params.preventBack}
92
+ onPressLeftHeader={params.onPressLeftHeader}
93
+ />
94
+ ),
85
95
  };
86
96
  }
87
- if (params.surface == true) {
88
- options = {
89
- ...options,
90
- ...getTintColor({
91
- ...theme,
92
- assets: {...theme.assets, headerBackground: undefined},
93
- }),
94
- };
95
- backgroundProps = {
96
- ...backgroundProps,
97
- image: null,
98
- backgroundColor: theme.colors.background.surface,
99
- useBorder: true,
100
- };
101
- } else {
102
- backgroundProps = {};
103
- options = {...options, ...getTintColor(theme)};
104
- }
105
97
 
106
- if (params.animatedValue) {
107
- backgroundProps = {...backgroundProps, animatedValue: params.animatedValue};
108
- titleProps = {...titleProps, animatedValue: params.animatedValue};
98
+ if (typeof params.surface == 'boolean') {
99
+ if (params.surface) {
100
+ options = {
101
+ ...options,
102
+ headerTintColor: theme.colors.text.default,
103
+ headerBackground: () => (
104
+ <HeaderBackground
105
+ image={null}
106
+ backgroundColor={theme.colors.background.surface}
107
+ useBorder={true}
108
+ />
109
+ ),
110
+ };
111
+ } else {
112
+ options = {
113
+ ...options,
114
+ headerTintColor: Colors.black_01,
115
+ headerBackground: HeaderBackground,
116
+ };
117
+ }
109
118
  }
110
119
 
111
120
  if (params.customTitle) {
@@ -116,11 +125,13 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
116
125
  return <HeaderCustom {...params.customTitle} {...props} />;
117
126
  },
118
127
  };
119
- } else if (!params.headerTitle) {
128
+ }
129
+
130
+ if (params.toolkitParams) {
120
131
  options = {
121
132
  ...options,
122
- headerTitle: (props: any) => {
123
- return <HeaderTitle {...titleProps} {...props} />;
133
+ headerRight: (props: any) => {
134
+ return <HeaderToolkitAction {...params.toolkitParams} {...props} />;
124
135
  },
125
136
  };
126
137
  }
@@ -128,8 +139,37 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
128
139
  return {
129
140
  ...params,
130
141
  ...options,
131
- headerBackground: () => <HeaderBackground {...backgroundProps} />,
132
142
  };
133
143
  };
134
144
 
135
- export {getStackOptions, getDialogOptions, getModalOptions, getOptions};
145
+ const getAccessibilityID = (
146
+ key = '',
147
+ override: string | undefined = undefined,
148
+ ) => {
149
+ if (isIOS) {
150
+ return {
151
+ accessible: true,
152
+ testID: override || key,
153
+ };
154
+ } else {
155
+ return {
156
+ accessibilityLabel: override || key,
157
+ };
158
+ }
159
+ };
160
+
161
+ const formatNameLength = (name = '') => {
162
+ let formattedName = name;
163
+ if (formattedName.length > 100) {
164
+ formattedName = formattedName.substring(0, 100);
165
+ }
166
+ return formattedName;
167
+ };
168
+ export {
169
+ getStackOptions,
170
+ getDialogOptions,
171
+ getModalOptions,
172
+ getOptions,
173
+ formatNameLength,
174
+ getAccessibilityID,
175
+ };
@@ -0,0 +1,256 @@
1
+ {
2
+ "v": "4.8.0",
3
+ "meta": {"g": "LottieFiles AE 3.2.2", "a": "", "k": "", "d": "", "tc": ""},
4
+ "fr": 60,
5
+ "ip": 10,
6
+ "op": 54,
7
+ "w": 52,
8
+ "h": 20,
9
+ "nm": "Dot 10",
10
+ "ddd": 0,
11
+ "assets": [
12
+ {
13
+ "id": "comp_0",
14
+ "layers": [
15
+ {
16
+ "ddd": 0,
17
+ "ind": 1,
18
+ "ty": 4,
19
+ "nm": "1",
20
+ "sr": 1,
21
+ "ks": {
22
+ "o": {"a": 0, "k": 100, "ix": 11},
23
+ "r": {"a": 0, "k": 0, "ix": 10},
24
+ "p": {
25
+ "a": 1,
26
+ "k": [
27
+ {
28
+ "i": {"x": 0.711, "y": 1},
29
+ "o": {"x": 0.26, "y": 0.24},
30
+ "t": 0,
31
+ "s": [-14, 11, 0],
32
+ "to": [0, -1.172, 0],
33
+ "ti": [0, -0.21, 0]
34
+ },
35
+ {
36
+ "i": {"x": 0.667, "y": 1},
37
+ "o": {"x": 0.333, "y": 0},
38
+ "t": 17,
39
+ "s": [-14, 5, 0],
40
+ "to": [0, 0.333, 0],
41
+ "ti": [0, -1, 0]
42
+ },
43
+ {
44
+ "i": {"x": 0.833, "y": 0.542},
45
+ "o": {"x": 0.333, "y": 0},
46
+ "t": 30,
47
+ "s": [-14, 13, 0],
48
+ "to": [0, 1, 0],
49
+ "ti": [0, 0.333, 0]
50
+ },
51
+ {"t": 45, "s": [-14, 11, 0]}
52
+ ],
53
+ "ix": 2
54
+ },
55
+ "a": {"a": 0, "k": [-40, 0, 0], "ix": 1},
56
+ "s": {"a": 0, "k": [100, 100, 100], "ix": 6}
57
+ },
58
+ "ao": 0,
59
+ "shapes": [
60
+ {
61
+ "ty": "gr",
62
+ "it": [
63
+ {
64
+ "d": 1,
65
+ "ty": "el",
66
+ "s": {"a": 0, "k": [12, 12], "ix": 2},
67
+ "p": {"a": 0, "k": [0, 0], "ix": 3},
68
+ "nm": "Ellipse Path 1",
69
+ "mn": "ADBE Vector Shape - Ellipse",
70
+ "hd": false
71
+ },
72
+ {
73
+ "ty": "st",
74
+ "c": {"a": 0, "k": [1, 1, 1, 1], "ix": 3},
75
+ "o": {"a": 0, "k": 100, "ix": 4},
76
+ "w": {"a": 0, "k": 0, "ix": 5},
77
+ "lc": 1,
78
+ "lj": 1,
79
+ "ml": 4,
80
+ "bm": 0,
81
+ "nm": "Stroke 1",
82
+ "mn": "ADBE Vector Graphic - Stroke",
83
+ "hd": false
84
+ },
85
+ {
86
+ "ty": "fl",
87
+ "c": {
88
+ "a": 1,
89
+ "k": [
90
+ {
91
+ "i": {"x": [0.833], "y": [0.833]},
92
+ "o": {"x": [0.167], "y": [0.167]},
93
+ "t": 0,
94
+ "s": [0.968627510819, 0.674509803922, 0.835294177485, 1]
95
+ },
96
+ {
97
+ "i": {"x": [0.833], "y": [0.833]},
98
+ "o": {"x": [0.167], "y": [0.167]},
99
+ "t": 17,
100
+ "s": [0.921568632126, 0.184313729405, 0.588235318661, 1]
101
+ },
102
+ {
103
+ "t": 35,
104
+ "s": [0.968627510819, 0.674509803922, 0.835294177485, 1]
105
+ }
106
+ ],
107
+ "ix": 4
108
+ },
109
+ "o": {"a": 0, "k": 100, "ix": 5},
110
+ "r": 1,
111
+ "bm": 0,
112
+ "nm": "Fill 1",
113
+ "mn": "ADBE Vector Graphic - Fill",
114
+ "hd": false
115
+ },
116
+ {
117
+ "ty": "tr",
118
+ "p": {"a": 0, "k": [-20, 1], "ix": 2},
119
+ "a": {"a": 0, "k": [0, 0], "ix": 1},
120
+ "s": {"a": 0, "k": [100, 100], "ix": 3},
121
+ "r": {"a": 0, "k": 0, "ix": 6},
122
+ "o": {"a": 0, "k": 100, "ix": 7},
123
+ "sk": {"a": 0, "k": 0, "ix": 4},
124
+ "sa": {"a": 0, "k": 0, "ix": 5},
125
+ "nm": "Transform"
126
+ }
127
+ ],
128
+ "nm": "Ellipse 1",
129
+ "np": 3,
130
+ "cix": 2,
131
+ "bm": 0,
132
+ "ix": 1,
133
+ "mn": "ADBE Vector Group",
134
+ "hd": false
135
+ }
136
+ ],
137
+ "ip": 0,
138
+ "op": 45,
139
+ "st": 0,
140
+ "bm": 0
141
+ }
142
+ ]
143
+ }
144
+ ],
145
+ "layers": [
146
+ {
147
+ "ddd": 0,
148
+ "ind": 1,
149
+ "ty": 0,
150
+ "nm": "Dot 0",
151
+ "refId": "comp_0",
152
+ "sr": 1,
153
+ "ks": {
154
+ "o": {"a": 0, "k": 100, "ix": 11},
155
+ "r": {"a": 0, "k": 0, "ix": 10},
156
+ "p": {"a": 0, "k": [6, 10, 0], "ix": 2},
157
+ "a": {"a": 0, "k": [-34, 10, 0], "ix": 1},
158
+ "s": {"a": 0, "k": [100, 100, 100], "ix": 6}
159
+ },
160
+ "ao": 0,
161
+ "tm": {
162
+ "a": 1,
163
+ "k": [
164
+ {
165
+ "i": {"x": [0.833], "y": [0.833]},
166
+ "o": {"x": [0.167], "y": [0.167]},
167
+ "t": 10,
168
+ "s": [0]
169
+ },
170
+ {"t": 54, "s": [0.733]}
171
+ ],
172
+ "ix": 2,
173
+ "x": "var $bm_rt;\n$bm_rt = loopOut('cycle', 0);"
174
+ },
175
+ "w": 12,
176
+ "h": 20,
177
+ "ip": 10,
178
+ "op": 90,
179
+ "st": 10,
180
+ "bm": 0
181
+ },
182
+ {
183
+ "ddd": 0,
184
+ "ind": 2,
185
+ "ty": 0,
186
+ "nm": "Dot 0",
187
+ "refId": "comp_0",
188
+ "sr": 1,
189
+ "ks": {
190
+ "o": {"a": 0, "k": 100, "ix": 11},
191
+ "r": {"a": 0, "k": 0, "ix": 10},
192
+ "p": {"a": 0, "k": [6, 10, 0], "ix": 2},
193
+ "a": {"a": 0, "k": [-14, 10, 0], "ix": 1},
194
+ "s": {"a": 0, "k": [100, 100, 100], "ix": 6}
195
+ },
196
+ "ao": 0,
197
+ "tm": {
198
+ "a": 1,
199
+ "k": [
200
+ {
201
+ "i": {"x": [0.833], "y": [0.833]},
202
+ "o": {"x": [0.167], "y": [0.167]},
203
+ "t": 5,
204
+ "s": [0]
205
+ },
206
+ {"t": 49, "s": [0.733]}
207
+ ],
208
+ "ix": 2,
209
+ "x": "var $bm_rt;\n$bm_rt = loopOut('cycle', 0);"
210
+ },
211
+ "w": 12,
212
+ "h": 20,
213
+ "ip": 5,
214
+ "op": 85,
215
+ "st": 5,
216
+ "bm": 0
217
+ },
218
+ {
219
+ "ddd": 0,
220
+ "ind": 3,
221
+ "ty": 0,
222
+ "nm": "Dot 0",
223
+ "refId": "comp_0",
224
+ "sr": 1,
225
+ "ks": {
226
+ "o": {"a": 0, "k": 100, "ix": 11},
227
+ "r": {"a": 0, "k": 0, "ix": 10},
228
+ "p": {"a": 0, "k": [6, 10, 0], "ix": 2},
229
+ "a": {"a": 0, "k": [6, 10, 0], "ix": 1},
230
+ "s": {"a": 0, "k": [100, 100, 100], "ix": 6}
231
+ },
232
+ "ao": 0,
233
+ "tm": {
234
+ "a": 1,
235
+ "k": [
236
+ {
237
+ "i": {"x": [0.833], "y": [0.833]},
238
+ "o": {"x": [0.167], "y": [0.167]},
239
+ "t": 0,
240
+ "s": [0]
241
+ },
242
+ {"t": 44, "s": [0.733]}
243
+ ],
244
+ "ix": 2,
245
+ "x": "var $bm_rt;\n$bm_rt = loopOut('cycle', 0);"
246
+ },
247
+ "w": 12,
248
+ "h": 20,
249
+ "ip": 0,
250
+ "op": 80,
251
+ "st": 0,
252
+ "bm": 0
253
+ }
254
+ ],
255
+ "markers": []
256
+ }