@momo-kits/foundation 0.92.7-rc.21 → 0.92.7-rc.22

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 (57) hide show
  1. package/Application/BottomSheet.tsx +216 -0
  2. package/Application/BottomTab/BottomTabBar.tsx +62 -223
  3. package/Application/BottomTab/index.tsx +15 -11
  4. package/Application/Components.tsx +291 -45
  5. package/Application/Localize.ts +44 -0
  6. package/Application/ModalScreen.tsx +11 -181
  7. package/Application/Navigation.ts +4 -18
  8. package/Application/NavigationContainer.tsx +10 -28
  9. package/Application/Navigator.ts +14 -16
  10. package/Application/StackScreen.tsx +222 -42
  11. package/Application/index.ts +5 -3
  12. package/Application/types.ts +47 -29
  13. package/Application/utils.tsx +61 -19
  14. package/Assets/icon_bank.json +1 -1
  15. package/Badge/BadgeDotAnimation.tsx +95 -0
  16. package/Badge/index.tsx +2 -1
  17. package/Badge/styles.ts +50 -6
  18. package/Button/index.tsx +7 -8
  19. package/Icon/index.tsx +1 -1
  20. package/Icon/types.ts +1 -2
  21. package/Image/index.tsx +0 -1
  22. package/Input/Input.tsx +51 -17
  23. package/Input/InputDropDown.tsx +42 -45
  24. package/Input/InputMoney.tsx +65 -6
  25. package/Input/InputOTP.tsx +14 -13
  26. package/Input/InputSearch.tsx +259 -146
  27. package/Input/InputTextArea.tsx +0 -1
  28. package/Input/TextTyping.tsx +113 -0
  29. package/Input/common.tsx +29 -10
  30. package/Input/index.tsx +84 -89
  31. package/Input/styles.ts +44 -7
  32. package/Input/utils.ts +1 -1
  33. package/Layout/Card.tsx +4 -3
  34. package/Layout/FloatingButton.tsx +3 -3
  35. package/Layout/GridSystem.tsx +1 -1
  36. package/Layout/ItemList.tsx +3 -2
  37. package/Layout/Screen.tsx +188 -102
  38. package/Layout/Section.tsx +4 -3
  39. package/Layout/styles.ts +0 -6
  40. package/Layout/types.ts +1 -1
  41. package/Layout/utils.ts +2 -2
  42. package/Loader/index.tsx +2 -0
  43. package/Pagination/PaginationScroll.tsx +2 -2
  44. package/Pagination/styles.ts +1 -1
  45. package/Popup/PopupNotify.tsx +7 -7
  46. package/Popup/PopupPromotion.tsx +1 -1
  47. package/Popup/types.ts +1 -1
  48. package/Tag/index.tsx +9 -2
  49. package/Tag/styles.ts +3 -2
  50. package/Tag/types.ts +12 -0
  51. package/Title/index.tsx +20 -7
  52. package/Title/styles.ts +4 -4
  53. package/code-scanner.js +141 -124
  54. package/index.ts +7 -0
  55. package/package.json +5 -4
  56. package/publish.sh +16 -21
  57. package/tsconfig.json +1 -1
package/Tag/styles.ts CHANGED
@@ -1,19 +1,20 @@
1
1
  import {StyleSheet} from 'react-native';
2
2
  import {Radius, Spacing} from '../Consts';
3
+ import {scaleSize} from '../Text';
3
4
 
4
5
  export default StyleSheet.create({
5
6
  container: {
6
7
  paddingHorizontal: Spacing.S,
7
8
  borderRadius: Radius.S,
8
9
  flexDirection: 'row',
9
- height: 24,
10
+ height: scaleSize(24),
10
11
  alignItems: 'center',
11
12
  justifyContent: 'center',
12
13
  },
13
14
  mediumContainer: {
14
15
  paddingHorizontal: Spacing.S,
15
16
  borderRadius: Radius.S,
16
- height: 18,
17
+ height: scaleSize(18),
17
18
  alignItems: 'center',
18
19
  flexDirection: 'row',
19
20
  justifyContent: 'center',
package/Tag/types.ts CHANGED
@@ -33,4 +33,16 @@ export type TagProps = {
33
33
  * that can be applied to the Tag component.
34
34
  */
35
35
  customColor?: string;
36
+
37
+ /**
38
+ * Overrides the text that's read by the screen reader when the user interacts with the element. By default, the
39
+ * label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
40
+ */
41
+ accessibilityLabelContainer?: string;
42
+
43
+ /**
44
+ * Overrides the text that's read by the screen reader when the user interacts with the element. By default, the
45
+ * label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
46
+ */
47
+ accessibilityLabelText?: string;
36
48
  };
package/Title/index.tsx CHANGED
@@ -1,13 +1,13 @@
1
1
  import React, {FC, useContext, useState} from 'react';
2
2
  import {Text as RNText, TouchableOpacity, View, ViewStyle} from 'react-native';
3
- import styles from './styles';
4
3
  import {Icon} from '../Icon';
5
4
  import {scaleSize, Text} from '../Text';
6
5
  import {ApplicationContext} from '../Application';
7
6
  import {Badge} from '../Badge';
8
- import {Typography} from '../Text/types';
9
- import {TitleProps} from './types';
10
7
  import {Colors} from '../Consts';
8
+ import styles from './styles';
9
+ import {TitleProps} from './types';
10
+ import {Typography} from '../Text/types';
11
11
 
12
12
  const Title: FC<TitleProps> = ({
13
13
  title = 'Title',
@@ -67,7 +67,9 @@ const Title: FC<TitleProps> = ({
67
67
  <View style={styles.contentView}>
68
68
  <View
69
69
  onLayout={e => {
70
- setContentWidth(e.nativeEvent.layout.width);
70
+ if (e.nativeEvent.layout.width !== contentWidth) {
71
+ setContentWidth(e.nativeEvent.layout.width);
72
+ }
71
73
  }}
72
74
  style={[styles.iconLeftView, flexStyle]}>
73
75
  <RNText
@@ -75,14 +77,19 @@ const Title: FC<TitleProps> = ({
75
77
  style={[
76
78
  styleSheet[typography],
77
79
  styles.title,
78
- {maxWidth: contentWidth - badgeWidth},
80
+ {
81
+ maxWidth:
82
+ contentWidth > 0 ? contentWidth - badgeWidth : undefined,
83
+ },
79
84
  ]}>
80
85
  {title}
81
86
  </RNText>
82
87
  {badgeLabel && (
83
88
  <View
84
89
  onLayout={e => {
85
- setBadgeWidth(e.nativeEvent.layout.width);
90
+ if (e.nativeEvent.layout.width !== badgeWidth) {
91
+ setBadgeWidth(e.nativeEvent.layout.width);
92
+ }
86
93
  }}
87
94
  style={{
88
95
  alignItems: 'center',
@@ -133,8 +140,14 @@ const Title: FC<TitleProps> = ({
133
140
  const renderActionRight = () => {
134
141
  if (!showRightAction || showTrailingAction) return false;
135
142
 
143
+ const lineHeight = styleSheet[typography].lineHeight;
144
+
136
145
  return (
137
- <View>
146
+ <View
147
+ style={{
148
+ height: lineHeight,
149
+ justifyContent: 'center',
150
+ }}>
138
151
  {!buttonTitle ? (
139
152
  <TouchableOpacity
140
153
  onPress={onPressRightAction}
package/Title/styles.ts CHANGED
@@ -46,16 +46,16 @@ export default StyleSheet.create({
46
46
  marginRight: Spacing.S,
47
47
  },
48
48
  iconRight: {
49
- width: scaleSize(22),
50
- height: scaleSize(22),
49
+ width: 22,
50
+ height: 22,
51
51
  borderRadius: Radius.M,
52
52
  alignItems: 'center',
53
53
  justifyContent: 'center',
54
54
  marginLeft: Spacing.S,
55
55
  },
56
56
  iconLeft: {
57
- width: scaleSize(18),
58
- height: scaleSize(18),
57
+ width: 18,
58
+ height: 18,
59
59
  borderRadius: Radius.M,
60
60
  alignItems: 'center',
61
61
  justifyContent: 'center',
package/code-scanner.js CHANGED
@@ -2,142 +2,159 @@ const scanner = require('react-scanner');
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
 
5
- const scan = async (config) => {
6
- return await scanner.run(config);
5
+ const scan = async config => {
6
+ return await scanner.run(config);
7
7
  };
8
8
 
9
- const calcSum = (array) => {
10
- return array.reduce((a, b) => a + b, 0);
9
+ const calcSum = array => {
10
+ return array.reduce((a, b) => a + b, 0);
11
11
  };
12
12
 
13
- const calculateAdoptionRate = async (branchName , kitJsonPath , miniappJsonPath , reactNativeJsonPath , fsJsonPath ) => {
14
- const kitJson = require(kitJsonPath);
15
- const miniAppJson = require(miniappJsonPath);
16
- const reactNativeJson = require(reactNativeJsonPath);
17
- const fsJson = require(fsJsonPath);
18
-
19
- const numOfKitComponents = calcSum(Object.values(kitJson));
20
- const numOfMiniAppComponents = calcSum(Object.values(miniAppJson));
21
- const numOfReactNativeComponents = calcSum(Object.values(reactNativeJson));
22
- const numOfFSComponents = calcSum(Object.values(fsJson));
23
-
24
- const adoptionRate = ((numOfKitComponents + numOfReactNativeComponents + numOfFSComponents) / numOfMiniAppComponents) * 100;
25
-
26
- return {
27
- miniAppName: branchName,
28
- numOfKitComponents: numOfKitComponents,
29
- numOfMiniAppComponents: numOfMiniAppComponents,
30
- numOfReactNativeComponents: numOfReactNativeComponents,
31
- numOfFSComponents: numOfFSComponents,
32
- adoptionRate: adoptionRate.toFixed(2) + '%'
33
- }
13
+ const calculateAdoptionRate = async (
14
+ branchName,
15
+ kitJsonPath,
16
+ miniappJsonPath,
17
+ reactNativeJsonPath,
18
+ fsJsonPath
19
+ ) => {
20
+ const kitJson = require(kitJsonPath);
21
+ const miniAppJson = require(miniappJsonPath);
22
+ const reactNativeJson = require(reactNativeJsonPath);
23
+ const fsJson = require(fsJsonPath);
24
+
25
+ const numOfKitComponents = calcSum(Object.values(kitJson));
26
+ const numOfMiniAppComponents = calcSum(Object.values(miniAppJson));
27
+ const numOfReactNativeComponents = calcSum(Object.values(reactNativeJson));
28
+ const numOfFSComponents = calcSum(Object.values(fsJson));
29
+
30
+ const adoptionRate =
31
+ ((numOfKitComponents + numOfReactNativeComponents + numOfFSComponents) /
32
+ numOfMiniAppComponents) *
33
+ 100;
34
+
35
+ return {
36
+ miniAppName: branchName,
37
+ numOfKitComponents: numOfKitComponents,
38
+ numOfMiniAppComponents: numOfMiniAppComponents,
39
+ numOfReactNativeComponents: numOfReactNativeComponents,
40
+ numOfFSComponents: numOfFSComponents,
41
+ adoptionRate: adoptionRate.toFixed(2) + '%',
42
+ };
34
43
  };
35
44
 
36
- function ensureFileExists(filePath , defaultContent = {}) {
37
- if (!fs.existsSync(filePath)) {
38
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
39
- fs.writeFileSync(filePath, JSON.stringify(defaultContent, null, 2));
40
- }
45
+ function ensureFileExists(filePath, defaultContent = {}) {
46
+ if (!fs.existsSync(filePath)) {
47
+ fs.mkdirSync(path.dirname(filePath), {recursive: true});
48
+ fs.writeFileSync(filePath, JSON.stringify(defaultContent, null, 2));
49
+ }
41
50
  }
42
51
 
43
52
  const sendMessage = ({
44
- numOfKitComponents,
45
- numOfMiniAppComponents,
46
- numOfFSComponents,
47
- numOfReactNativeComponents,
48
- adoptionRate,
49
- miniAppName = ''
50
- }) => {
51
- const url = 'https://chat.googleapis.com/v1/spaces/AAAAL9P6G8M/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=fnwfYuH_u0KicBnKTSSm9S0qV6azJH5v6URm8HR7V2g';
52
-
53
- const data = {
54
- text: `MiniApp: ${miniAppName}\nNumber of kit's components: ${numOfKitComponents}\nNumber of miniapp's components: ${numOfMiniAppComponents}\nNumber of FS's components: ${numOfFSComponents}\nNumber of React Native's components: ${numOfReactNativeComponents}\nAdoption rate: ${adoptionRate}`
55
- };
56
-
57
- fetch(url, {
58
- method: 'POST',
59
- headers: {
60
- 'Content-Type': 'application/json'
61
- },
62
- body: JSON.stringify(data)
53
+ numOfKitComponents,
54
+ numOfMiniAppComponents,
55
+ numOfFSComponents,
56
+ numOfReactNativeComponents,
57
+ adoptionRate,
58
+ miniAppName = '',
59
+ }) => {
60
+ const url =
61
+ 'https://chat.googleapis.com/v1/spaces/AAAAL9P6G8M/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=fnwfYuH_u0KicBnKTSSm9S0qV6azJH5v6URm8HR7V2g';
62
+
63
+ const data = {
64
+ text: `MiniApp: ${miniAppName}\nNumber of kit's components: ${numOfKitComponents}\nNumber of miniapp's components: ${numOfMiniAppComponents}\nNumber of FS's components: ${numOfFSComponents}\nNumber of React Native's components: ${numOfReactNativeComponents}\nAdoption rate: ${adoptionRate}`,
65
+ };
66
+
67
+ fetch(url, {
68
+ method: 'POST',
69
+ headers: {
70
+ 'Content-Type': 'application/json',
71
+ },
72
+ body: JSON.stringify(data),
73
+ })
74
+ .then(response => response.json())
75
+ .then(data => {
76
+ console.log('Success:', data);
63
77
  })
64
- .then(response => response.json())
65
- .then(data => {
66
- console.log('Success:', data);
67
- })
68
- .catch((error) => {
69
- console.error('Error:', error);
70
- });
71
- }
78
+ .catch(error => {
79
+ console.error('Error:', error);
80
+ });
81
+ };
72
82
 
73
83
  const main = async () => {
74
- const rootPath = `${__dirname}/../../../`
75
- const app = path.join(`${__dirname}/../../../`, 'app.json');
76
- const appJson = require(app)
77
- const branchName = appJson.appId
78
-
79
- if (!branchName || !branchName.includes("vn.momo")){
80
- return
81
- }
82
-
83
- const scanPath = path.join(rootPath, 'src')
84
- const kitJsonPath = path.join(rootPath, './scan/kit.json')
85
- const miniappJsonPath = path.join(rootPath, './scan/miniapp.json')
86
- const reactNativeJsonPath = path.join(rootPath, './scan/RN.json')
87
- const fsJsonPath = path.join(rootPath, './scan/verLib.json')
88
-
89
- const allKitsReg = /@momo-kits/;
90
- const fsReg = /^(?:@fs-mobile-platform\/(components|investment|screens)|@miniapp-platform\/(components|foundation))$/;
91
- const RNReg = 'react-native'
92
-
93
- const config1 = {
94
- crawlFrom: scanPath,
95
- includeSubComponents: true,
96
- importedFrom: allKitsReg,
97
- processors: [['count-components', { outputTo: kitJsonPath }]],
98
- rootDir: process.cwd(),
99
- };
100
-
101
- const config2 = {
102
- crawlFrom: scanPath,
103
- includeSubComponents: true,
104
- processors: [['count-components', { outputTo: miniappJsonPath }]],
105
- rootDir: process.cwd(),
106
- };
107
-
108
- const config3 = {
109
- crawlFrom: scanPath,
110
- includeSubComponents: true,
111
- importedFrom: RNReg,
112
- processors: [['count-components', { outputTo: reactNativeJsonPath }]],
113
- rootDir: process.cwd(),
114
- };
115
-
116
- const config4 = {
117
- crawlFrom: scanPath,
118
- includeSubComponents: true,
119
- importedFrom: fsReg,
120
- processors: [['count-components', { outputTo: fsJsonPath }]],
121
- rootDir: process.cwd(),
122
- };
123
-
124
- try {
125
- ensureFileExists(kitJsonPath, {});
126
- ensureFileExists(miniappJsonPath, {});
127
- ensureFileExists(reactNativeJsonPath, {});
128
- ensureFileExists(fsJsonPath, {});
129
-
130
- await scan(config1);
131
- await scan(config2);
132
- await scan(config3);
133
- await scan(config4);
134
-
135
- const result = await calculateAdoptionRate(branchName,kitJsonPath, miniappJsonPath, reactNativeJsonPath, fsJsonPath);
136
- sendMessage(result)
137
- console.log(result)
138
- } catch (error) {
139
- console.error("Error during scan or calculation:", error);
140
- }
84
+ const rootPath = `${__dirname}/../../../`;
85
+ const app = path.join(`${__dirname}/../../../`, 'app.json');
86
+ const appJson = require(app);
87
+ const branchName = appJson.appId;
88
+
89
+ if (!branchName || !branchName.includes('vn.momo')) {
90
+ return;
91
+ }
92
+
93
+ const scanPath = path.join(rootPath, 'src');
94
+ const kitJsonPath = path.join(rootPath, './scan/kit.json');
95
+ const miniappJsonPath = path.join(rootPath, './scan/miniapp.json');
96
+ const reactNativeJsonPath = path.join(rootPath, './scan/RN.json');
97
+ const fsJsonPath = path.join(rootPath, './scan/verLib.json');
98
+
99
+ const allKitsReg = /@momo-kits/;
100
+ const fsReg =
101
+ /^(?:@fs-mobile-platform\/(components(\/.*)?|investment(\/.*)?|screens(\/.*)?|foundation(\/.*)?)|@miniapp-platform\/(components(\/.*)?|foundation(\/.*)?))$/;
102
+ const RNReg = /react-native|react-native-svg/;
103
+
104
+ const config1 = {
105
+ crawlFrom: scanPath,
106
+ includeSubComponents: true,
107
+ importedFrom: allKitsReg,
108
+ processors: [['count-components', {outputTo: kitJsonPath}]],
109
+ rootDir: process.cwd(),
110
+ };
111
+
112
+ const config2 = {
113
+ crawlFrom: scanPath,
114
+ includeSubComponents: true,
115
+ processors: [['count-components', {outputTo: miniappJsonPath}]],
116
+ rootDir: process.cwd(),
117
+ };
118
+
119
+ const config3 = {
120
+ crawlFrom: scanPath,
121
+ includeSubComponents: true,
122
+ importedFrom: RNReg,
123
+ processors: [['count-components', {outputTo: reactNativeJsonPath}]],
124
+ rootDir: process.cwd(),
125
+ };
126
+
127
+ const config4 = {
128
+ crawlFrom: scanPath,
129
+ includeSubComponents: true,
130
+ importedFrom: fsReg,
131
+ processors: [['count-components', {outputTo: fsJsonPath}]],
132
+ rootDir: process.cwd(),
133
+ };
134
+
135
+ try {
136
+ ensureFileExists(kitJsonPath, {});
137
+ ensureFileExists(miniappJsonPath, {});
138
+ ensureFileExists(reactNativeJsonPath, {});
139
+ ensureFileExists(fsJsonPath, {});
140
+
141
+ await scan(config1);
142
+ await scan(config2);
143
+ await scan(config3);
144
+ await scan(config4);
145
+
146
+ const result = await calculateAdoptionRate(
147
+ branchName,
148
+ kitJsonPath,
149
+ miniappJsonPath,
150
+ reactNativeJsonPath,
151
+ fsJsonPath
152
+ );
153
+ sendMessage(result);
154
+ console.log(result);
155
+ } catch (error) {
156
+ console.error('Error during scan or calculation:', error);
157
+ }
141
158
  };
142
159
 
143
160
  main();
package/index.ts CHANGED
@@ -49,3 +49,10 @@ export * from './Title';
49
49
  export * from './Title/types';
50
50
  export * from './Badge';
51
51
  export * from './Badge/types';
52
+
53
+ /**
54
+ * export trick for keep old mini app working
55
+ * @deprecated
56
+ */
57
+ export * from 'react-native-modalize';
58
+ export * from '@gorhom/bottom-sheet';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.7-rc.21",
3
+ "version": "0.92.7-rc.22",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -18,7 +18,7 @@
18
18
  "@react-navigation/core": "5.16.1",
19
19
  "@react-navigation/native": "5.9.8",
20
20
  "@react-navigation/routers": "5.7.4",
21
- "lottie-react-native": "3.3.2",
21
+ "lottie-react-native": "git+https://gitlab.mservice.com.vn/momo-platform/momo-lottie-react-native.git",
22
22
  "@react-navigation/stack": "https://gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git"
23
23
  },
24
24
  "peerDependencies": {
@@ -39,8 +39,9 @@
39
39
  "react-test-renderer": "17.0.1",
40
40
  "typescript": "^4.0.3",
41
41
  "@momo-platform/versions": "4.1.11",
42
- "react-scanner": "^1.1.0"
42
+ "react-scanner": "^1.1.0",
43
+ "@types/color": "3.0.6"
43
44
  },
44
45
  "author": "@momo-kits/foundation",
45
46
  "license": "ISC"
46
- }
47
+ }
package/publish.sh CHANGED
@@ -1,23 +1,18 @@
1
1
  #!/bin/bash
2
- rm -rf dist
3
- mkdir dist
4
2
 
5
- cp . ./dist
6
-
7
-
8
- # GET VERSION from mck_package.json
9
- VERSIONSTRING=( v$(jq .version package.json) )
10
- VERSION=(${VERSIONSTRING//[\"]/})
11
- echo VERSION: $VERSION
12
-
13
- rsync -r --verbose --exclude '*.mdx' --exclude '*Demo.js' --exclude 'props-type.js' --exclude 'prop-types.js' ./* dist
14
-
15
- cd dist
16
- npm publish --tag latest --access=public
17
-
18
- #clear dist and package json
19
- cd ..
20
- rm -rf dist
21
-
22
-
23
- #curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/core new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/foundation"}'
3
+ if [ "$1" == "stable" ]; then
4
+ npm version $(npm view @momo-kits/foundation@stable version)
5
+ npm version patch
6
+ npm publish --tag stable --access=public
7
+ elif [ "$1" == "latest" ]; then
8
+ npm version $(npm view @momo-kits/foundation@latest version)
9
+ npm version prerelease --preid=rc
10
+ npm publish --tag latest --access=public
11
+ else
12
+ npm version $(npm view @momo-kits/foundation@beta version)
13
+ npm version prerelease --preid=beta
14
+ npm publish --tag beta --access=public
15
+ fi
16
+
17
+ PACKAGE_NAME=$(npm pkg get name)
18
+ NEW_PACKAGE_VERSION=$(npm pkg get version)
package/tsconfig.json CHANGED
@@ -19,6 +19,6 @@
19
19
  "resolveJsonModule": true,
20
20
  "skipLibCheck": true,
21
21
  "strict": true,
22
- "target": "esnext",
22
+ "target": "esnext"
23
23
  }
24
24
  }