@momo-kits/foundation 0.81.52 → 0.81.53-beta.0
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/Application/BottomSheet.tsx +216 -0
- package/Application/BottomTab/BottomTabBar.tsx +278 -0
- package/Application/{BottomTab.tsx → BottomTab/index.tsx} +43 -18
- package/Application/Components.tsx +71 -53
- package/Application/ModalScreen.tsx +12 -183
- package/Application/Navigation.ts +2 -2
- package/Application/NavigationContainer.tsx +54 -53
- package/Application/Navigator.ts +53 -35
- package/Application/StackScreen.tsx +225 -30
- package/Application/index.ts +8 -12
- package/Application/types.ts +45 -27
- package/Application/utils.tsx +19 -15
- package/Assets/icon_bank.json +1 -1
- package/Badge/Badge.tsx +1 -1
- package/Button/index.tsx +44 -25
- package/CheckBox/index.tsx +37 -26
- package/CheckBox/types.ts +5 -3
- package/Consts/colors+spacing+radius.ts +14 -0
- package/Icon/index.tsx +9 -8
- package/Icon/types.ts +2 -2
- package/IconButton/index.tsx +24 -14
- package/Image/index.tsx +23 -8
- package/Image/types.ts +2 -0
- package/Input/Input.tsx +116 -26
- package/Input/InputDropDown.tsx +66 -51
- package/Input/InputMoney.tsx +106 -15
- package/Input/InputOTP.tsx +45 -22
- package/Input/InputSearch.tsx +92 -44
- package/Input/InputTextArea.tsx +26 -6
- package/Input/common.tsx +48 -22
- package/Input/index.tsx +94 -77
- package/Input/styles.ts +35 -5
- package/Input/utils.ts +1 -1
- package/Layout/Card.tsx +4 -3
- package/Layout/FloatingButton.tsx +168 -0
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/ItemList.tsx +3 -2
- package/Layout/Screen.tsx +87 -49
- package/Layout/Section.tsx +4 -3
- package/Layout/styles.ts +11 -7
- package/Layout/utils.ts +4 -4
- package/Loader/index.tsx +2 -0
- package/Popup/PopupNotify.tsx +55 -44
- package/Popup/PopupPromotion.tsx +5 -7
- package/Popup/types.ts +1 -7
- package/Radio/index.tsx +35 -20
- package/Radio/types.ts +5 -3
- package/Switch/index.tsx +32 -18
- package/Switch/types.ts +5 -3
- package/Tag/styles.ts +3 -2
- package/Text/index.tsx +24 -5
- package/Text/styles.ts +8 -8
- package/Title/index.tsx +170 -103
- package/Title/styles.ts +36 -9
- package/Title/types.ts +16 -48
- package/code-scanner.js +125 -16
- package/index.ts +7 -0
- package/package.json +6 -6
- package/publish.sh +16 -21
- package/tsconfig.json +1 -1
package/Title/types.ts
CHANGED
|
@@ -1,52 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Optional. Defines the type of Title component.
|
|
4
|
-
* 'screen' - Used for screen titles.
|
|
5
|
-
* 'section' - Used for section titles within a screen.
|
|
6
|
-
* 'card' - Used for titles within a card component.
|
|
7
|
-
*/
|
|
8
|
-
type?: 'screen' | 'section' | 'card';
|
|
1
|
+
import {ViewStyle} from 'react-native';
|
|
9
2
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
export type TitleProps = {
|
|
4
|
+
type?: 'card' | 'section';
|
|
5
|
+
size?: 'small' | 'medium' | 'large';
|
|
13
6
|
title: string;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Optional. A description or subtitle that appears below the title.
|
|
17
|
-
*/
|
|
18
|
-
description?: string;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Optional. Defines the size of the Title component.
|
|
22
|
-
* 'large' - A larger, more prominent title.
|
|
23
|
-
* 'small' - A smaller, less prominent title.
|
|
24
|
-
*/
|
|
25
|
-
size?: 'large' | 'medium' | 'small';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Optional. Represents the name or key of the icon to be displayed alongside the title.
|
|
29
|
-
*/
|
|
30
7
|
icon?: string;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* Optional. Function to be called when the action associated with the title is pressed.
|
|
44
|
-
*/
|
|
45
|
-
onPressAction?: () => void;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Optional. If `true`, an action button or icon is displayed alongside the title.
|
|
49
|
-
*/
|
|
50
|
-
showAction?: boolean;
|
|
51
|
-
usePadding?: boolean;
|
|
8
|
+
description?: string;
|
|
9
|
+
iconColor?: string;
|
|
10
|
+
iconAlign?: 'top' | 'middle' | 'bottom';
|
|
11
|
+
showRightAction?: boolean;
|
|
12
|
+
showTrailingAction?: boolean;
|
|
13
|
+
badgeLabel?: string;
|
|
14
|
+
buttonTitle?: string;
|
|
15
|
+
buttonSize?: 'small' | 'large';
|
|
16
|
+
onPressRightAction?: () => void;
|
|
17
|
+
onPressTrailingAction?: () => void;
|
|
18
|
+
textOnly?: boolean;
|
|
19
|
+
style?: ViewStyle;
|
|
52
20
|
};
|
package/code-scanner.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const scanner = require('react-scanner');
|
|
2
|
+
const fs = require('fs');
|
|
2
3
|
const path = require('path');
|
|
3
4
|
|
|
4
5
|
const scan = async config => {
|
|
@@ -9,43 +10,151 @@ const calcSum = array => {
|
|
|
9
10
|
return array.reduce((a, b) => a + b, 0);
|
|
10
11
|
};
|
|
11
12
|
|
|
12
|
-
const calculateAdoptionRate = (
|
|
13
|
+
const calculateAdoptionRate = async (
|
|
14
|
+
branchName,
|
|
15
|
+
kitJsonPath,
|
|
16
|
+
miniappJsonPath,
|
|
17
|
+
reactNativeJsonPath,
|
|
18
|
+
fsJsonPath
|
|
19
|
+
) => {
|
|
13
20
|
const kitJson = require(kitJsonPath);
|
|
14
21
|
const miniAppJson = require(miniappJsonPath);
|
|
22
|
+
const reactNativeJson = require(reactNativeJsonPath);
|
|
23
|
+
const fsJson = require(fsJsonPath);
|
|
24
|
+
|
|
15
25
|
const numOfKitComponents = calcSum(Object.values(kitJson));
|
|
16
26
|
const numOfMiniAppComponents = calcSum(Object.values(miniAppJson));
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
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
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const sendMessage = ({
|
|
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);
|
|
77
|
+
})
|
|
78
|
+
.catch(error => {
|
|
79
|
+
console.error('Error:', error);
|
|
80
|
+
});
|
|
21
81
|
};
|
|
22
82
|
|
|
23
83
|
const main = async () => {
|
|
24
|
-
const
|
|
25
|
-
|
|
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
|
+
}
|
|
26
92
|
|
|
27
|
-
const
|
|
28
|
-
const
|
|
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/;
|
|
29
103
|
|
|
30
104
|
const config1 = {
|
|
31
105
|
crawlFrom: scanPath,
|
|
32
106
|
includeSubComponents: true,
|
|
33
|
-
importedFrom:
|
|
107
|
+
importedFrom: allKitsReg,
|
|
34
108
|
processors: [['count-components', {outputTo: kitJsonPath}]],
|
|
35
|
-
rootDir:
|
|
109
|
+
rootDir: process.cwd(),
|
|
36
110
|
};
|
|
37
111
|
|
|
38
112
|
const config2 = {
|
|
39
113
|
crawlFrom: scanPath,
|
|
40
114
|
includeSubComponents: true,
|
|
41
115
|
processors: [['count-components', {outputTo: miniappJsonPath}]],
|
|
42
|
-
rootDir:
|
|
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(),
|
|
43
125
|
};
|
|
44
126
|
|
|
45
|
-
|
|
46
|
-
|
|
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);
|
|
47
145
|
|
|
48
|
-
|
|
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
|
+
}
|
|
49
158
|
};
|
|
50
159
|
|
|
51
|
-
main()
|
|
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,25 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.53-beta.0",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"postinstall": "node verify.js"
|
|
8
|
-
},
|
|
6
|
+
"scripts": {},
|
|
9
7
|
"keywords": [
|
|
10
8
|
"@momo-kits/foundation"
|
|
11
9
|
],
|
|
12
10
|
"dependencies": {
|
|
13
|
-
"@gorhom/bottom-sheet": "
|
|
11
|
+
"@gorhom/bottom-sheet": "2.4.1",
|
|
14
12
|
"react-native-safe-area-context": "3.1.4",
|
|
15
13
|
"react-native-linear-gradient": "2.8.3",
|
|
16
14
|
"react-native-gesture-handler": "1.10.3",
|
|
15
|
+
"react-native-modalize": "2.1.1",
|
|
17
16
|
"react-native-fast-image": "8.1.5",
|
|
18
17
|
"@react-navigation/bottom-tabs": "https://gitlab.mservice.com.vn/momo-platform/react-native-bottom-tabs.git",
|
|
19
18
|
"@react-navigation/core": "5.16.1",
|
|
20
19
|
"@react-navigation/native": "5.9.8",
|
|
21
20
|
"@react-navigation/routers": "5.7.4",
|
|
22
|
-
"lottie-react-native": "
|
|
21
|
+
"lottie-react-native": "git+https://gitlab.mservice.com.vn/momo-platform/momo-lottie-react-native.git",
|
|
23
22
|
"@react-navigation/stack": "https://gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git"
|
|
24
23
|
},
|
|
25
24
|
"peerDependencies": {
|
|
@@ -32,6 +31,7 @@
|
|
|
32
31
|
"@types/jest": "26.0.23",
|
|
33
32
|
"@types/react-native": "0.64.4",
|
|
34
33
|
"@types/react-test-renderer": "16.9.2",
|
|
34
|
+
"@types/d3-shape": "1.3.7",
|
|
35
35
|
"babel-jest": "^26.6.3",
|
|
36
36
|
"eslint": "^7.14.0",
|
|
37
37
|
"jest": "^26.6.3",
|
package/publish.sh
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
rm -rf dist
|
|
3
|
-
mkdir dist
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
npm publish --tag beta --access=public
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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)
|