@momo-kits/foundation 0.80.8 → 0.81.1-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 +212 -0
- package/Application/BottomTab/BottomTabBar.tsx +278 -0
- package/Application/BottomTab/index.tsx +143 -0
- package/Application/Components.tsx +384 -213
- package/Application/ModalScreen.tsx +14 -178
- package/Application/Navigation.ts +15 -19
- package/Application/NavigationContainer.tsx +66 -63
- package/Application/Navigator.ts +106 -53
- package/Application/StackScreen.tsx +123 -9
- package/Application/index.ts +19 -6
- package/Application/types.ts +83 -26
- package/Application/utils.tsx +62 -74
- package/Assets/icon.json +83 -5
- package/Assets/icon_bank.json +506 -0
- package/Assets/language.json +3 -1
- package/Badge/Badge.tsx +56 -0
- package/Badge/BadgeDot.tsx +11 -0
- package/Badge/BadgeRibbon.tsx +125 -0
- package/Badge/Shape.tsx +29 -0
- package/Badge/index.tsx +7 -0
- package/Badge/styles.ts +58 -0
- package/Badge/types.ts +63 -0
- package/Button/index.tsx +64 -28
- package/Button/styles.ts +19 -0
- package/CheckBox/index.tsx +37 -27
- package/CheckBox/types.ts +5 -3
- package/Consts/colors+spacing+radius.ts +18 -0
- package/Icon/index.tsx +14 -9
- package/Icon/types.ts +4 -3
- package/IconButton/index.tsx +24 -15
- package/Image/index.tsx +62 -47
- package/Image/styles.ts +1 -9
- package/Image/types.ts +5 -1
- package/Input/Input.tsx +104 -25
- package/Input/InputDropDown.tsx +115 -110
- package/Input/InputMoney.tsx +79 -18
- package/Input/InputOTP.tsx +190 -149
- package/Input/InputSearch.tsx +96 -44
- package/Input/InputTextArea.tsx +33 -17
- package/Input/common.tsx +26 -17
- package/Input/index.tsx +108 -41
- package/Input/styles.ts +5 -7
- package/Input/utils.ts +1 -1
- package/Layout/AnimatedInputSearch.tsx +44 -0
- package/Layout/Card.tsx +37 -13
- package/Layout/FloatingButton.tsx +168 -0
- package/Layout/GridSystem.tsx +2 -3
- package/Layout/Item.tsx +1 -2
- package/Layout/ItemList.tsx +55 -0
- package/Layout/ItemSectionList.tsx +39 -0
- package/Layout/Screen.tsx +404 -181
- package/Layout/Section.tsx +22 -22
- package/Layout/TextTyping.tsx +114 -0
- package/Layout/index.ts +12 -2
- package/Layout/styles.ts +46 -13
- package/Layout/types.ts +13 -5
- package/Layout/utils.ts +7 -12
- package/Loader/index.tsx +2 -0
- package/Pagination/PaginationDot.tsx +6 -1
- package/Pagination/PaginationNumber.tsx +7 -4
- package/Pagination/PaginationScroll.tsx +0 -1
- package/Pagination/PaginationWhiteDot.tsx +6 -1
- package/Pagination/styles.ts +3 -0
- package/Pagination/types.ts +2 -0
- package/Popup/PopupNotify.tsx +108 -40
- package/Popup/PopupPromotion.tsx +45 -10
- package/Popup/types.ts +13 -10
- package/Radio/index.tsx +35 -21
- package/Radio/types.ts +7 -5
- package/Skeleton/index.tsx +1 -1
- package/Switch/index.tsx +32 -19
- package/Switch/types.ts +5 -3
- package/Tag/index.tsx +2 -4
- package/Text/index.tsx +26 -6
- package/Text/styles.ts +38 -0
- package/Text/types.ts +25 -13
- package/Title/index.tsx +177 -64
- package/Title/styles.ts +48 -15
- package/Title/types.ts +16 -7
- package/code-scanner.js +125 -16
- package/index.ts +9 -0
- package/migrate_typo.js +56 -0
- package/package.json +8 -7
- package/publish.sh +21 -16
- package/tsconfig.json +1 -2
- package/verify.js +24 -6
- package/Application/BottomTab.tsx +0 -65
package/migrate_typo.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const {readFileSync, writeFileSync, readdirSync, statSync} = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
let rootPath = process.argv[2];
|
|
4
|
+
|
|
5
|
+
const migrateText = [
|
|
6
|
+
{typo1: 'headline_s', typo2: 'headline_default_bold'},
|
|
7
|
+
{typo1: 'header_s', typo2: 'header_s_semibold'},
|
|
8
|
+
{typo1: 'header_xs', typo2: 'header_xs_semibold'},
|
|
9
|
+
{typo1: 'description_default', typo2: 'body_default_regular'},
|
|
10
|
+
{typo1: 'description_s', typo2: 'description_default_regular'},
|
|
11
|
+
{typo1: 'description_xs', typo2: 'description_xs_regular'},
|
|
12
|
+
{typo1: 'label_default', typo2: 'label_default_medium'},
|
|
13
|
+
{typo1: 'label_s', typo2: 'label_s_medium'},
|
|
14
|
+
{typo1: 'label_xs', typo2: 'label_xs_medium'},
|
|
15
|
+
{typo1: 'action_default', typo2: 'action_default_bold'},
|
|
16
|
+
{typo1: 'action_xs', typo2: 'action_xs_bold'},
|
|
17
|
+
{typo1: 'action_xxs', typo2: 'action_xxs_bold'},
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
function replaceTextInFile(oldText, newText, filePath) {
|
|
21
|
+
try {
|
|
22
|
+
let content = readFileSync(filePath, {encoding: 'utf-8'});
|
|
23
|
+
const regex = new RegExp(`\\b${oldText}\\b`, 'g');
|
|
24
|
+
content = content.replace(regex, newText);
|
|
25
|
+
writeFileSync(filePath, content, 'utf8');
|
|
26
|
+
console.log(`Replaced text in: ${filePath}`);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error(`Error processing file ${filePath}:`, error);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function scanDirectory(directory, oldText, newText) {
|
|
33
|
+
const files = readdirSync(directory);
|
|
34
|
+
|
|
35
|
+
files.forEach(file => {
|
|
36
|
+
const filePath = path.join(directory, file);
|
|
37
|
+
const stat = statSync(filePath);
|
|
38
|
+
|
|
39
|
+
if (stat.isDirectory()) {
|
|
40
|
+
scanDirectory(filePath, oldText, newText);
|
|
41
|
+
} else if (
|
|
42
|
+
stat.isFile() &&
|
|
43
|
+
(filePath.endsWith('.tsx') || filePath.endsWith('.ts'))
|
|
44
|
+
) {
|
|
45
|
+
replaceTextInFile(oldText, newText, filePath);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function main() {
|
|
51
|
+
migrateText.forEach(({typo1, typo2}) => {
|
|
52
|
+
scanDirectory(rootPath, typo1, typo2);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.81.1-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
11
|
"@gorhom/bottom-sheet": "2.4.1",
|
|
14
12
|
"react-native-safe-area-context": "3.1.4",
|
|
15
|
-
"react-native-linear-gradient": "2.
|
|
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
|
-
"@react-navigation/bottom-tabs": "
|
|
17
|
+
"@react-navigation/bottom-tabs": "https://oauth2:5WXQLHPMxxCyvGt_Py4D@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
21
|
"lottie-react-native": "3.3.2",
|
|
23
|
-
"@react-navigation/stack": "
|
|
22
|
+
"@react-navigation/stack": "https://oauth2:eX-jVhzQdLc343AjD3Sc@gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git"
|
|
24
23
|
},
|
|
25
24
|
"peerDependencies": {
|
|
26
25
|
"react-native": "*"
|
|
@@ -32,12 +31,14 @@
|
|
|
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",
|
|
38
38
|
"metro-react-native-babel-preset": "^0.64.0",
|
|
39
39
|
"react-test-renderer": "17.0.1",
|
|
40
40
|
"typescript": "^4.0.3",
|
|
41
|
+
"@momo-platform/versions": "4.1.11",
|
|
41
42
|
"react-scanner": "^1.1.0"
|
|
42
43
|
},
|
|
43
44
|
"author": "@momo-kits/foundation",
|
package/publish.sh
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Prepare dist files
|
|
2
4
|
rm -rf dist
|
|
3
5
|
mkdir dist
|
|
4
|
-
|
|
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
|
-
|
|
6
|
+
rsync -r --exclude=/dist ./* dist
|
|
15
7
|
cd dist
|
|
16
|
-
npm publish --tag latest --access=public
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+
if [ "$1" == "stable" ]; then
|
|
10
|
+
npm version $(npm view @momo-kits/foundation@stable version)
|
|
11
|
+
npm version patch
|
|
12
|
+
npm publish --tag stable --access=public
|
|
13
|
+
elif [ "$1" == "latest" ]; then
|
|
14
|
+
npm version $(npm view @momo-kits/foundation@latest version)
|
|
15
|
+
npm version prerelease --preid=rc
|
|
16
|
+
npm publish --tag latest --access=public
|
|
17
|
+
else
|
|
18
|
+
npm version $(npm view @momo-kits/foundation@beta version)
|
|
19
|
+
npm version prerelease --preid=beta
|
|
20
|
+
npm publish --tag beta --access=public
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
PACKAGE_NAME=$(npm pkg get name)
|
|
24
|
+
NEW_PACKAGE_VERSION=$(npm pkg get version)
|
|
25
|
+
|
|
26
|
+
# Clean up
|
|
19
27
|
cd ..
|
|
20
28
|
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"}'
|
package/tsconfig.json
CHANGED
package/verify.js
CHANGED
|
@@ -2,19 +2,24 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
4
|
try {
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const packageInfo = JSON.parse(
|
|
6
|
+
fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8'),
|
|
7
|
+
);
|
|
7
8
|
const packageVersion = parseInt(packageInfo?.version.split('.')?.[1]);
|
|
8
9
|
|
|
9
10
|
const app = path.join(`${__dirname}/../../../`, 'app.json');
|
|
10
|
-
const
|
|
11
|
-
const iOSAppTarget = appInfo?.client?.ios.deploymentTarget;
|
|
12
|
-
const androidAppTarget = appInfo?.client?.android.deploymentTarget;
|
|
11
|
+
const miniJson = path.join(`${__dirname}/../../../`, 'package.json');
|
|
13
12
|
|
|
14
|
-
if (
|
|
13
|
+
if (!fs.existsSync(app) || fs.existsSync(miniJson)) {
|
|
15
14
|
return;
|
|
16
15
|
}
|
|
17
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
|
+
|
|
18
23
|
if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
|
|
19
24
|
console.error(
|
|
20
25
|
`Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`,
|
|
@@ -23,6 +28,19 @@ try {
|
|
|
23
28
|
`Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`,
|
|
24
29
|
);
|
|
25
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
|
+
}
|
|
26
44
|
} catch (error) {
|
|
27
45
|
console.error(`Installation failed: ${error.message}`);
|
|
28
46
|
process.exit(1);
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React, {useContext} from 'react';
|
|
2
|
-
import {View} from 'react-native';
|
|
3
|
-
import {BottomTabProps} from './types';
|
|
4
|
-
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
|
|
5
|
-
import {Icon} from '../Icon';
|
|
6
|
-
import {Text} from '../Text';
|
|
7
|
-
import {ApplicationContext} from './index';
|
|
8
|
-
|
|
9
|
-
const Tab = createBottomTabNavigator();
|
|
10
|
-
|
|
11
|
-
const BottomTab: React.FC<BottomTabProps> = ({tabs, listeners, navigation}) => {
|
|
12
|
-
const {theme} = useContext(ApplicationContext);
|
|
13
|
-
|
|
14
|
-
const defaultListener = {
|
|
15
|
-
focus: (item: any) => {
|
|
16
|
-
const focusItem = tabs.find(i => item.target.includes(i.name));
|
|
17
|
-
if (focusItem?.options) {
|
|
18
|
-
navigation?.setOptions?.(focusItem.options);
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Tab.Navigator backBehavior={'firstRoute'}>
|
|
25
|
-
{tabs.map(item => {
|
|
26
|
-
return (
|
|
27
|
-
<Tab.Screen
|
|
28
|
-
key={item.name}
|
|
29
|
-
name={item.name}
|
|
30
|
-
component={item.screen}
|
|
31
|
-
listeners={listeners ?? defaultListener}
|
|
32
|
-
options={{
|
|
33
|
-
tabBarLabel: ({color, focused}) => {
|
|
34
|
-
return (
|
|
35
|
-
<View style={{paddingHorizontal: 16}}>
|
|
36
|
-
<Text
|
|
37
|
-
typography={focused ? 'label_xs' : 'description_xs'}
|
|
38
|
-
color={color}>
|
|
39
|
-
{item.label}
|
|
40
|
-
</Text>
|
|
41
|
-
</View>
|
|
42
|
-
);
|
|
43
|
-
},
|
|
44
|
-
tabBarBadge: item?.badgeLabel,
|
|
45
|
-
tabBarBadgeStyle: {
|
|
46
|
-
borderColor: 'white',
|
|
47
|
-
borderWidth: 2,
|
|
48
|
-
fontSize: 10,
|
|
49
|
-
lineHeight: 14,
|
|
50
|
-
fontWeight: 'bold',
|
|
51
|
-
alignSelf: 'center',
|
|
52
|
-
fontFamily: `${theme.font}-Bold`,
|
|
53
|
-
},
|
|
54
|
-
tabBarIcon: ({color}) => (
|
|
55
|
-
<Icon source={item.icon} color={color} size={28} />
|
|
56
|
-
),
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
);
|
|
60
|
-
})}
|
|
61
|
-
</Tab.Navigator>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export default BottomTab;
|