@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
@@ -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,23 +1,25 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.76.1-beta.2",
3
+ "version": "0.77.1-optimize.2",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
6
+ "scripts": {},
9
7
  "keywords": [
10
8
  "@momo-kits/foundation"
11
9
  ],
12
10
  "dependencies": {
11
+ "@gorhom/bottom-sheet": "2.4.1",
13
12
  "react-native-safe-area-context": "3.1.4",
14
- "react-native-linear-gradient": "2.5.6",
15
- "@react-navigation/bottom-tabs": "git+https://gitlab.com/dung.huynh1/react-navigation-bottom-tabs.git#main",
13
+ "react-native-linear-gradient": "2.8.3",
14
+ "react-native-gesture-handler": "1.10.3",
15
+ "react-native-modalize": "2.1.1",
16
+ "react-native-fast-image": "8.1.5",
17
+ "@react-navigation/bottom-tabs": "https://oauth2:5WXQLHPMxxCyvGt_Py4D@gitlab.mservice.com.vn/momo-platform/react-native-bottom-tabs.git",
16
18
  "@react-navigation/core": "5.16.1",
17
19
  "@react-navigation/native": "5.9.8",
18
20
  "@react-navigation/routers": "5.7.4",
19
- "@react-navigation/stack": "git+https://gitlab.com/dung.huynh1/react-navigation-stack.git#main",
20
- "@gorhom/bottom-sheet": "2.4.1"
21
+ "lottie-react-native": "3.3.2",
22
+ "@react-navigation/stack": "https://oauth2:eX-jVhzQdLc343AjD3Sc@gitlab.mservice.com.vn/momo-platform/react-navigation-stack.git"
21
23
  },
22
24
  "peerDependencies": {
23
25
  "react-native": "*"
@@ -29,12 +31,15 @@
29
31
  "@types/jest": "26.0.23",
30
32
  "@types/react-native": "0.64.4",
31
33
  "@types/react-test-renderer": "16.9.2",
34
+ "@types/d3-shape": "1.3.7",
32
35
  "babel-jest": "^26.6.3",
33
36
  "eslint": "^7.14.0",
34
37
  "jest": "^26.6.3",
35
38
  "metro-react-native-babel-preset": "^0.64.0",
36
39
  "react-test-renderer": "17.0.1",
37
- "typescript": "^4.0.3"
40
+ "typescript": "^4.0.3",
41
+ "@momo-platform/versions": "4.1.11",
42
+ "react-scanner": "^1.1.0"
38
43
  },
39
44
  "author": "@momo-kits/foundation",
40
45
  "license": "ISC"
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": ".",
4
+ "allowUnreachableCode": false,
5
+ "allowUnusedLabels": false,
6
+ "esModuleInterop": true,
7
+ "forceConsistentCasingInFileNames": true,
8
+ "jsx": "react",
9
+ "lib": ["esnext"],
10
+ "module": "esnext",
11
+ "moduleResolution": "node",
12
+ "noFallthroughCasesInSwitch": true,
13
+ "noImplicitReturns": false,
14
+ "noImplicitUseStrict": false,
15
+ "noStrictGenericChecks": false,
16
+ "noUncheckedIndexedAccess": true,
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": true,
19
+ "resolveJsonModule": true,
20
+ "skipLibCheck": true,
21
+ "strict": true,
22
+ "target": "esnext",
23
+ }
24
+ }
package/verify.js ADDED
@@ -0,0 +1,47 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ try {
5
+ const packageInfo = JSON.parse(
6
+ fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8'),
7
+ );
8
+ const packageVersion = parseInt(packageInfo?.version.split('.')?.[1]);
9
+
10
+ const app = path.join(`${__dirname}/../../../`, 'app.json');
11
+ const miniJson = path.join(`${__dirname}/../../../`, 'package.json');
12
+
13
+ if (!fs.existsSync(app) || fs.existsSync(miniJson)) {
14
+ return;
15
+ }
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
+
23
+ if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
24
+ console.error(
25
+ `Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`,
26
+ );
27
+ throw new Error(
28
+ `Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`,
29
+ );
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
+ }
44
+ } catch (error) {
45
+ console.error(`Installation failed: ${error.message}`);
46
+ process.exit(1);
47
+ }
@@ -1,52 +0,0 @@
1
- import React, {FC, useContext} from 'react';
2
- import {BottomTabProps} from './types';
3
- import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
4
- import {Icon} from '../Icon';
5
- import {Text} from '../Text';
6
- import {ApplicationContext} from './index';
7
-
8
- const Tab = createBottomTabNavigator();
9
-
10
- const BottomTab: FC<BottomTabProps> = ({tabs, listeners}) => {
11
- const {theme} = useContext(ApplicationContext);
12
- return (
13
- <Tab.Navigator>
14
- {tabs.map(item => {
15
- return (
16
- <Tab.Screen
17
- key={item.name}
18
- name={item.name}
19
- component={item.screen}
20
- listeners={listeners}
21
- options={{
22
- tabBarLabel: ({color, focused}) => {
23
- return (
24
- <Text
25
- typography={focused ? 'label_xs' : 'description_xs'}
26
- color={color}>
27
- {item.label}
28
- </Text>
29
- );
30
- },
31
- tabBarBadge: item?.badgeLabel,
32
- tabBarBadgeStyle: {
33
- borderColor: 'white',
34
- borderWidth: 2,
35
- fontSize: 10,
36
- lineHeight: 14,
37
- fontWeight: 'bold',
38
- alignSelf: 'center',
39
- fontFamily: `${theme.font}-Bold`,
40
- },
41
- tabBarIcon: ({color, size}) => (
42
- <Icon source={item.icon} color={color} size={size} />
43
- ),
44
- }}
45
- />
46
- );
47
- })}
48
- </Tab.Navigator>
49
- );
50
- };
51
-
52
- export default BottomTab;
@@ -1,54 +0,0 @@
1
- import {Platform, StyleSheet, TouchableOpacity as TouchRN} from 'react-native';
2
- import {TouchableOpacity as TouchGesture} from 'react-native-gesture-handler';
3
- import React, {useContext} from 'react';
4
- import {NavigationButtonProps} from './types';
5
- import {ApplicationContext} from './index';
6
- import {Icon} from '../Icon';
7
- import {Colors} from '../Consts';
8
-
9
- const TouchableOpacity = Platform.OS === 'ios' ? TouchRN : TouchGesture;
10
- const NavigationButton: React.FC<NavigationButtonProps> = ({
11
- icon,
12
- tintColor,
13
- onPress,
14
- backgroundColor,
15
- useBorder = true,
16
- accessibilityLabel,
17
- }) => {
18
- const {theme} = useContext(ApplicationContext);
19
- if (!backgroundColor && tintColor != Colors.black_01) {
20
- backgroundColor = theme.colors.background.surface;
21
- }
22
-
23
- return (
24
- <TouchableOpacity
25
- accessibilityLabel={`NavigationButton/${accessibilityLabel}`}
26
- style={[
27
- styles.container,
28
- {
29
- backgroundColor: backgroundColor ?? '#00000066',
30
- borderWidth: useBorder && backgroundColor ? 0.5 : 0,
31
- },
32
- ]}
33
- onPress={onPress}>
34
- <Icon
35
- source={icon}
36
- color={tintColor ?? theme.colors.text.default}
37
- size={20}
38
- />
39
- </TouchableOpacity>
40
- );
41
- };
42
-
43
- const styles = StyleSheet.create({
44
- container: {
45
- height: 28,
46
- width: 28,
47
- borderRadius: 14,
48
- borderColor: '#00000066',
49
- justifyContent: 'center',
50
- alignItems: 'center',
51
- },
52
- });
53
-
54
- export default NavigationButton;
Binary file