@momo-kits/foundation 0.74.2-react-native.1

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 (105) hide show
  1. package/Application/BottomTab.tsx +120 -0
  2. package/Application/Components.tsx +534 -0
  3. package/Application/ModalScreen.tsx +268 -0
  4. package/Application/Navigation.ts +50 -0
  5. package/Application/NavigationContainer.tsx +120 -0
  6. package/Application/Navigator.ts +131 -0
  7. package/Application/StackScreen.tsx +71 -0
  8. package/Application/index.ts +41 -0
  9. package/Application/types.ts +216 -0
  10. package/Application/utils.tsx +151 -0
  11. package/Assets/DotAnimation.json +256 -0
  12. package/Assets/SpinnerAnimation.json +1027 -0
  13. package/Assets/icon.json +4031 -0
  14. package/Assets/icon_bank.json +506 -0
  15. package/Assets/language.json +202 -0
  16. package/Badge/Badge.tsx +56 -0
  17. package/Badge/BadgeDot.tsx +11 -0
  18. package/Badge/BadgeRibbon.tsx +125 -0
  19. package/Badge/Shape.tsx +29 -0
  20. package/Badge/index.tsx +7 -0
  21. package/Badge/styles.ts +58 -0
  22. package/Badge/types.ts +63 -0
  23. package/Button/index.tsx +310 -0
  24. package/Button/styles.ts +60 -0
  25. package/CheckBox/index.tsx +65 -0
  26. package/CheckBox/styles.ts +15 -0
  27. package/CheckBox/types.ts +38 -0
  28. package/Consts/colors+spacing+radius.ts +218 -0
  29. package/Consts/index.ts +4 -0
  30. package/Consts/styles.ts +52 -0
  31. package/Consts/theme.ts +125 -0
  32. package/Divider/index.tsx +21 -0
  33. package/Icon/index.tsx +41 -0
  34. package/Icon/types.ts +27 -0
  35. package/IconButton/index.tsx +139 -0
  36. package/IconButton/styles.ts +19 -0
  37. package/Image/index.tsx +83 -0
  38. package/Image/styles.ts +5 -0
  39. package/Image/types.ts +5 -0
  40. package/Input/Input.tsx +192 -0
  41. package/Input/InputDropDown.tsx +114 -0
  42. package/Input/InputMoney.tsx +163 -0
  43. package/Input/InputOTP.tsx +235 -0
  44. package/Input/InputSearch.tsx +151 -0
  45. package/Input/InputTextArea.tsx +159 -0
  46. package/Input/common.tsx +129 -0
  47. package/Input/index.tsx +251 -0
  48. package/Input/styles.ts +160 -0
  49. package/Input/utils.ts +69 -0
  50. package/Layout/Card.tsx +180 -0
  51. package/Layout/GridSystem.tsx +136 -0
  52. package/Layout/Item.tsx +56 -0
  53. package/Layout/ItemList.tsx +55 -0
  54. package/Layout/ItemSectionList.tsx +39 -0
  55. package/Layout/Screen.tsx +355 -0
  56. package/Layout/Section.tsx +179 -0
  57. package/Layout/index.ts +29 -0
  58. package/Layout/styles.ts +97 -0
  59. package/Layout/types.ts +23 -0
  60. package/Layout/utils.ts +55 -0
  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 +28 -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/Dot.tsx +16 -0
  70. package/Pagination/PaginationDot.tsx +38 -0
  71. package/Pagination/PaginationNumber.tsx +24 -0
  72. package/Pagination/PaginationScroll.tsx +88 -0
  73. package/Pagination/PaginationWhiteDot.tsx +35 -0
  74. package/Pagination/index.tsx +25 -0
  75. package/Pagination/styles.ts +50 -0
  76. package/Pagination/types.ts +40 -0
  77. package/Popup/PopupNotify.tsx +266 -0
  78. package/Popup/PopupPromotion.tsx +120 -0
  79. package/Popup/index.tsx +4 -0
  80. package/Popup/types.ts +87 -0
  81. package/Radio/index.tsx +64 -0
  82. package/Radio/styles.ts +11 -0
  83. package/Radio/types.ts +38 -0
  84. package/Skeleton/index.tsx +72 -0
  85. package/Skeleton/styles.ts +5 -0
  86. package/Skeleton/types.ts +6 -0
  87. package/Switch/index.tsx +37 -0
  88. package/Switch/styles.ts +23 -0
  89. package/Switch/types.ts +26 -0
  90. package/Tag/index.tsx +79 -0
  91. package/Tag/styles.ts +24 -0
  92. package/Tag/types.ts +36 -0
  93. package/Text/index.tsx +110 -0
  94. package/Text/styles.ts +73 -0
  95. package/Text/types.ts +34 -0
  96. package/Text/utils.ts +14 -0
  97. package/Title/index.tsx +132 -0
  98. package/Title/styles.ts +52 -0
  99. package/Title/types.ts +52 -0
  100. package/code-scanner.js +51 -0
  101. package/index.ts +51 -0
  102. package/package.json +36 -0
  103. package/publish.sh +23 -0
  104. package/tsconfig.json +24 -0
  105. package/verify.js +44 -0
@@ -0,0 +1,51 @@
1
+ const scanner = require('react-scanner');
2
+ const path = require('path');
3
+
4
+ const scan = async config => {
5
+ return await scanner.run(config);
6
+ };
7
+
8
+ const calcSum = array => {
9
+ return array.reduce((a, b) => a + b, 0);
10
+ };
11
+
12
+ const calculateAdoptionRate = (kitJsonPath, miniappJsonPath) => {
13
+ const kitJson = require(kitJsonPath);
14
+ const miniAppJson = require(miniappJsonPath);
15
+ const numOfKitComponents = calcSum(Object.values(kitJson));
16
+ const numOfMiniAppComponents = calcSum(Object.values(miniAppJson));
17
+ const adoptionRate = (numOfKitComponents / numOfMiniAppComponents) * 100;
18
+ console.log("Number of kit's components: ", numOfKitComponents);
19
+ console.log("Number of miniapp's components: ", numOfMiniAppComponents);
20
+ console.log('Adoption rate: ', adoptionRate);
21
+ };
22
+
23
+ const main = async () => {
24
+ const [scanPath, kitJsonRelativePath, miniappJsonRelativePath] =
25
+ process.argv.slice(2);
26
+
27
+ const kitJsonPath = path.resolve(process.cwd(), kitJsonRelativePath);
28
+ const miniappJsonPath = path.resolve(process.cwd(), miniappJsonRelativePath);
29
+
30
+ const config1 = {
31
+ crawlFrom: scanPath,
32
+ includeSubComponents: true,
33
+ importedFrom: /@momo-kits\/.+/,
34
+ processors: [['count-components', {outputTo: kitJsonPath}]],
35
+ rootDir: './',
36
+ };
37
+
38
+ const config2 = {
39
+ crawlFrom: scanPath,
40
+ includeSubComponents: true,
41
+ processors: [['count-components', {outputTo: miniappJsonPath}]],
42
+ rootDir: './',
43
+ };
44
+
45
+ await scan(config1);
46
+ await scan(config2);
47
+
48
+ calculateAdoptionRate(kitJsonPath, miniappJsonPath);
49
+ };
50
+
51
+ main().catch(console.error);
package/index.ts ADDED
@@ -0,0 +1,51 @@
1
+ import {
2
+ SafeAreaProvider,
3
+ SafeAreaView,
4
+ useSafeAreaInsets,
5
+ } from 'react-native-safe-area-context';
6
+ import LinearGradient from 'react-native-linear-gradient';
7
+
8
+ /**
9
+ * native export
10
+ */
11
+ export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient};
12
+
13
+ /**
14
+ * foundation component
15
+ */
16
+
17
+ export * from './Consts';
18
+ export * from './Layout';
19
+ export * from './Layout/types';
20
+ export * from './Popup';
21
+ export * from './Popup/types';
22
+ export * from './Text';
23
+ export * from './Text/types';
24
+ export * from './Button';
25
+ export * from './Application';
26
+ export * from './Application/types';
27
+ export * from './Icon';
28
+ export * from './Icon/types';
29
+ export * from './IconButton';
30
+ export * from './Image';
31
+ export * from './Image/types';
32
+ export * from './Skeleton';
33
+ export * from './Skeleton/types';
34
+ export * from './CheckBox';
35
+ export * from './CheckBox/types';
36
+ export * from './Radio';
37
+ export * from './Radio/types';
38
+ export * from './Switch';
39
+ export * from './Switch/types';
40
+ export * from './Input';
41
+ export * from './Divider';
42
+ export * from './Tag';
43
+ export * from './Tag/types';
44
+ export * from './Pagination';
45
+ export * from './Pagination/types';
46
+ export * from './Loader';
47
+ export * from './Loader/types';
48
+ export * from './Title';
49
+ export * from './Title/types';
50
+ export * from './Badge';
51
+ export * from './Badge/types';
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@momo-kits/foundation",
3
+ "version": "0.74.2-react-native.1",
4
+ "description": "React Native Component Kits",
5
+ "main": "index.ts",
6
+ "scripts": {
7
+ "postinstall": "node verify.js"
8
+ },
9
+ "keywords": [
10
+ "@momo-kits/foundation"
11
+ ],
12
+ "dependencies": {
13
+ "@gorhom/bottom-sheet": "4.6.1",
14
+ "react-native-safe-area-context": "4.9.0",
15
+ "react-native-linear-gradient": "2.8.3",
16
+ "react-native-gesture-handler": "2.16.0",
17
+ "react-native-fast-image": "8.6.3",
18
+ "@react-navigation/bottom-tabs": "6.5.20",
19
+ "@react-navigation/core": "6.4.16",
20
+ "@react-navigation/native": "6.1.17",
21
+ "@react-navigation/routers": "6.1.9",
22
+ "@react-navigation/stack": "6.3.29",
23
+ "lottie-react-native": "6.7.2"
24
+ },
25
+ "peerDependencies": {
26
+ "react-native": "*"
27
+ },
28
+ "devDependencies": {
29
+ "@types/react": "^18.2.6",
30
+ "typescript": "5.0.4",
31
+ "@momo-platform/versions": "4.1.11",
32
+ "react-scanner": "^1.1.0"
33
+ },
34
+ "author": "@momo-kits/foundation",
35
+ "license": "ISC"
36
+ }
package/publish.sh ADDED
@@ -0,0 +1,23 @@
1
+ #!/bin/bash
2
+ rm -rf dist
3
+ 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
+
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"}'
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,44 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ try {
5
+ const package = path.join(`${__dirname}`, 'package.json');
6
+ const packageInfo = JSON.parse(fs.readFileSync(package, 'utf8'));
7
+ const packageVersion = parseInt(packageInfo?.version.split('.')?.[1]);
8
+
9
+ const app = path.join(`${__dirname}/../../../`, 'app.json');
10
+ const miniJson = path.join(`${__dirname}/../../../`, 'package.json');
11
+ const appInfo = JSON.parse(fs.readFileSync(app, 'utf8'));
12
+ const miniInfo = JSON.parse(fs.readFileSync(miniJson, 'utf8'));
13
+ const iOSAppTarget = appInfo?.client?.ios.deploymentTarget;
14
+ const androidAppTarget = appInfo?.client?.android.deploymentTarget;
15
+
16
+ if (appInfo.name === 'MoMoPlatform') {
17
+ return;
18
+ }
19
+
20
+ if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
21
+ console.error(
22
+ `Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`,
23
+ );
24
+ throw new Error(
25
+ `Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`,
26
+ );
27
+ }
28
+
29
+ if (
30
+ miniInfo?.dependencies?.['@momo-platform/momo-core'] &&
31
+ miniInfo?.dependencies?.['@momo-platform/momo-core'] !==
32
+ packageInfo?.version
33
+ ) {
34
+ console.error(
35
+ `Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`,
36
+ );
37
+ throw new Error(
38
+ `Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`,
39
+ );
40
+ }
41
+ } catch (error) {
42
+ console.error(`Installation failed: ${error.message}`);
43
+ process.exit(1);
44
+ }