@momo-kits/foundation 0.75.1-beta.10

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 (76) hide show
  1. package/Assets/header-background.png +0 -0
  2. package/Assets/icon.json +3947 -0
  3. package/Button/index.tsx +278 -0
  4. package/Button/styles.ts +41 -0
  5. package/CheckBox/index.tsx +61 -0
  6. package/CheckBox/styles.ts +15 -0
  7. package/CheckBox/types.ts +38 -0
  8. package/Consts/colors+spacing+radius.ts +214 -0
  9. package/Consts/index.ts +4 -0
  10. package/Consts/styles.ts +78 -0
  11. package/Consts/theme.ts +121 -0
  12. package/Divider/index.tsx +19 -0
  13. package/Icon/index.tsx +37 -0
  14. package/Icon/types.ts +27 -0
  15. package/IconButton/index.tsx +140 -0
  16. package/IconButton/styles.ts +19 -0
  17. package/Image/index.tsx +80 -0
  18. package/Image/styles.ts +13 -0
  19. package/Image/types.ts +3 -0
  20. package/Input/Input.tsx +136 -0
  21. package/Input/InputMoney.tsx +132 -0
  22. package/Input/InputSearch.tsx +161 -0
  23. package/Input/InputTextArea.tsx +152 -0
  24. package/Input/common.tsx +118 -0
  25. package/Input/index.tsx +96 -0
  26. package/Input/styles.ts +122 -0
  27. package/Input/utils.ts +69 -0
  28. package/Layout/Card.tsx +141 -0
  29. package/Layout/GridSystem.tsx +124 -0
  30. package/Layout/Item.tsx +60 -0
  31. package/Layout/ScreenContainer.tsx +121 -0
  32. package/Layout/Section.tsx +141 -0
  33. package/Layout/index.ts +17 -0
  34. package/Layout/types.ts +59 -0
  35. package/Layout/utils.ts +60 -0
  36. package/Navigation/BottomTab.tsx +39 -0
  37. package/Navigation/Components.tsx +365 -0
  38. package/Navigation/ModalScreen.tsx +226 -0
  39. package/Navigation/Navigation.ts +44 -0
  40. package/Navigation/NavigationButton.tsx +54 -0
  41. package/Navigation/NavigationContainer.tsx +77 -0
  42. package/Navigation/Navigator.ts +82 -0
  43. package/Navigation/StackScreen.tsx +27 -0
  44. package/Navigation/index.ts +14 -0
  45. package/Navigation/types.ts +158 -0
  46. package/Navigation/utils.tsx +138 -0
  47. package/Pagination/Dot.tsx +16 -0
  48. package/Pagination/PaginationDot.tsx +33 -0
  49. package/Pagination/PaginationNumber.tsx +23 -0
  50. package/Pagination/PaginationScroll.tsx +88 -0
  51. package/Pagination/PaginationWhiteDot.tsx +32 -0
  52. package/Pagination/index.tsx +25 -0
  53. package/Pagination/styles.ts +47 -0
  54. package/Pagination/types.ts +38 -0
  55. package/Popup/PopupNotify.tsx +215 -0
  56. package/Popup/PopupPromotion.tsx +77 -0
  57. package/Popup/index.tsx +4 -0
  58. package/Popup/types.ts +70 -0
  59. package/Radio/index.tsx +65 -0
  60. package/Radio/styles.ts +11 -0
  61. package/Radio/types.ts +38 -0
  62. package/Skeleton/index.tsx +72 -0
  63. package/Skeleton/styles.ts +5 -0
  64. package/Skeleton/types.ts +3 -0
  65. package/Switch/index.tsx +40 -0
  66. package/Switch/styles.ts +23 -0
  67. package/Switch/types.ts +26 -0
  68. package/Tag/index.tsx +79 -0
  69. package/Tag/styles.ts +24 -0
  70. package/Tag/types.ts +36 -0
  71. package/Text/index.tsx +123 -0
  72. package/Text/styles.ts +35 -0
  73. package/Text/types.ts +40 -0
  74. package/index.ts +38 -0
  75. package/package.json +41 -0
  76. package/publish.sh +26 -0
package/Text/index.tsx ADDED
@@ -0,0 +1,123 @@
1
+ import React, {useContext} from 'react';
2
+ import {Text as RNText, TextProps as RNTextProps} from 'react-native';
3
+ import styles from './styles';
4
+ import {Typography, TypographyWeight} from './types';
5
+ import {ApplicationContext} from '../Navigation';
6
+ import {GridContext} from '../Layout';
7
+
8
+ const SFProText: TypographyWeight = {
9
+ 100: 'Thin',
10
+ 200: 'Ultralight',
11
+ 300: 'Light',
12
+ 400: 'Regular',
13
+ 500: 'Medium',
14
+ 600: 'Semibold',
15
+ 700: 'Bold',
16
+ 800: 'Heavy',
17
+ 900: 'Black',
18
+ normal: 'Regular',
19
+ bold: 'Bold',
20
+ };
21
+
22
+ const AlegreyaSans: TypographyWeight = {
23
+ 100: 'Thin',
24
+ 200: 'Thin',
25
+ 300: 'Thin',
26
+ 400: 'Regular',
27
+ 500: 'Medium',
28
+ 600: 'Medium',
29
+ 700: 'Bold',
30
+ 800: 'Black',
31
+ 900: 'Black',
32
+ normal: 'Regular',
33
+ bold: 'Bold',
34
+ };
35
+
36
+ const FontStyle: {[key: string]: string} = {
37
+ italic: 'Italic',
38
+ normal: '',
39
+ };
40
+
41
+ export interface TextProps extends RNTextProps {
42
+ /**
43
+ * Represents the typography style applied to the Text component.
44
+ * It defines the appearance of the text in terms of font size, weight, line height etc.
45
+ */
46
+ typography: Typography;
47
+
48
+ /**
49
+ * Optional. Represents the color of the text in the Text component.
50
+ * It can be any valid color string (e.g., hex, rgb, rgba, etc.).
51
+ */
52
+ color?: string;
53
+
54
+ /**
55
+ * Optional. Represents the width of the Text component in terms of span numbers.
56
+ * It can be used to set a specific width for the text based on a predefined grid system.
57
+ */
58
+ widthSpan?: number;
59
+ }
60
+ const Text: React.FC<TextProps> = ({
61
+ typography,
62
+ color,
63
+ children,
64
+ style,
65
+ widthSpan,
66
+ ...rest
67
+ }) => {
68
+ const grid = useContext(GridContext);
69
+ const {theme} = useContext(ApplicationContext);
70
+
71
+ const getTypoStyle = (typo: Typography) => {
72
+ const styleSheet: {
73
+ [key: string]: any;
74
+ } = styles;
75
+ const typoStyle = styleSheet[typo] ?? styleSheet.paragraph_default;
76
+ const {fontWeight, fontSize, fontStyle, lineHeight} = typoStyle;
77
+ const style = FontStyle[fontStyle ?? 'normal'];
78
+ let fontFamily: string;
79
+
80
+ switch (theme.font) {
81
+ case 'SFProText': {
82
+ fontFamily = `${theme.font}-${SFProText[fontWeight]}${style}`;
83
+ break;
84
+ }
85
+ case 'AlegreyaSans': {
86
+ fontFamily = `${theme.font}-${AlegreyaSans[fontWeight]}${style}`;
87
+ break;
88
+ }
89
+ default: {
90
+ fontFamily = `SFProText-${SFProText[fontWeight]}${style}`;
91
+ }
92
+ }
93
+
94
+ return {
95
+ fontFamily,
96
+ fontSize,
97
+ lineHeight,
98
+ fontStyle,
99
+ };
100
+ };
101
+
102
+ const textStyle = getTypoStyle(typography);
103
+ const spanStyle = widthSpan ? {width: grid.getSizeSpan(widthSpan)} : {};
104
+ return (
105
+ <RNText
106
+ {...rest}
107
+ accessibilityLabel={`Text/${children}`}
108
+ style={[
109
+ style,
110
+ textStyle,
111
+ spanStyle,
112
+ {color: color ?? theme.colors.text.default},
113
+ ]}>
114
+ {children ?? ''}
115
+ </RNText>
116
+ );
117
+ };
118
+
119
+ Text.defaultProps = {
120
+ typography: 'paragraph_default',
121
+ };
122
+
123
+ export {Text};
package/Text/styles.ts ADDED
@@ -0,0 +1,35 @@
1
+ export default {
2
+ headline_default: {
3
+ fontSize: 28,
4
+ lineHeight: 34,
5
+ fontWeight: '600',
6
+ },
7
+ headline_s: {fontSize: 24, lineHeight: 32, fontWeight: '600'},
8
+ headline_l: {fontSize: 32, lineHeight: 36, fontWeight: '600'},
9
+ headline_xl: {fontSize: 36, lineHeight: 44, fontWeight: '600'},
10
+ title_default: {fontSize: 20, lineHeight: 28, fontWeight: '700'},
11
+ title_xs: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
12
+ title_s: {fontSize: 18, lineHeight: 28, fontWeight: '700'},
13
+ header_default: {fontSize: 15, lineHeight: 22, fontWeight: '600'},
14
+ header_xs: {fontSize: 12, lineHeight: 16, fontWeight: '600'},
15
+ header_s: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
16
+ paragraph_default: {fontSize: 15, lineHeight: 22, fontWeight: '400'},
17
+ paragraph_bold: {fontSize: 15, lineHeight: 22, fontWeight: '700'},
18
+ paragraph_italic: {
19
+ fontSize: 15,
20
+ lineHeight: 22,
21
+ fontWeight: '400',
22
+ fontStyle: 'italic',
23
+ },
24
+ description_default: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
25
+ description_xs: {fontSize: 10, lineHeight: 14, fontWeight: '400'},
26
+ description_s: {fontSize: 12, lineHeight: 16, fontWeight: '400'},
27
+ label_default: {fontSize: 14, lineHeight: 20, fontWeight: '500'},
28
+ label_xxs: {fontSize: 8, lineHeight: 12, fontWeight: '500'},
29
+ label_xs: {fontSize: 10, lineHeight: 14, fontWeight: '500'},
30
+ label_s: {fontSize: 12, lineHeight: 16, fontWeight: '500'},
31
+ action_default: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
32
+ action_xxs: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
33
+ action_xs: {fontSize: 12, lineHeight: 16, fontWeight: '700'},
34
+ action_s: {fontSize: 15, lineHeight: 22, fontWeight: '700'},
35
+ };
package/Text/types.ts ADDED
@@ -0,0 +1,40 @@
1
+ export type TypographyWeight = {
2
+ [key: string]: string;
3
+ 100: string;
4
+ 200: string;
5
+ 300: string;
6
+ 400: string;
7
+ 500: string;
8
+ 600: string;
9
+ 700: string;
10
+ 800: string;
11
+ 900: string;
12
+ normal: string;
13
+ bold: string;
14
+ };
15
+
16
+ export type Typography =
17
+ | 'headline_default'
18
+ | 'headline_s'
19
+ | 'headline_l'
20
+ | 'headline_xl'
21
+ | 'title_default'
22
+ | 'title_xs'
23
+ | 'title_s'
24
+ | 'header_default'
25
+ | 'header_xs'
26
+ | 'header_s'
27
+ | 'paragraph_default'
28
+ | 'paragraph_bold'
29
+ | 'paragraph_italic'
30
+ | 'description_default'
31
+ | 'description_xs'
32
+ | 'description_s'
33
+ | 'label_default'
34
+ | 'label_xxs'
35
+ | 'label_xs'
36
+ | 'label_s'
37
+ | 'action_default'
38
+ | 'action_xxs'
39
+ | 'action_xs'
40
+ | 'action_s';
package/index.ts ADDED
@@ -0,0 +1,38 @@
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
+ export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient};
9
+
10
+ export * from './Consts';
11
+ export * from './Layout';
12
+ export * from './Layout/types';
13
+ export * from './Popup';
14
+ export * from './Popup/types';
15
+ export * from './Text';
16
+ export * from './Text/types';
17
+ export * from './Button';
18
+ export * from './Navigation';
19
+ export * from './Navigation/types';
20
+ export * from './Icon';
21
+ export * from './Icon/types';
22
+ export * from './IconButton';
23
+ export * from './Image';
24
+ export * from './Image/types';
25
+ export * from './Skeleton';
26
+ export * from './Skeleton/types';
27
+ export * from './CheckBox';
28
+ export * from './CheckBox/types';
29
+ export * from './Radio';
30
+ export * from './Radio/types';
31
+ export * from './Switch';
32
+ export * from './Switch/types';
33
+ export * from './Input';
34
+ export * from './Divider';
35
+ export * from './Tag';
36
+ export * from './Tag/types';
37
+ export * from './Pagination';
38
+ export * from './Pagination/types';
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@momo-kits/foundation",
3
+ "version": "0.75.1-beta.10",
4
+ "description": "React Native Component Kits",
5
+ "main": "index.ts",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [
10
+ "@momo-kits/foundation"
11
+ ],
12
+ "dependencies": {
13
+ "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",
16
+ "@react-navigation/core": "5.16.1",
17
+ "@react-navigation/native": "5.9.8",
18
+ "@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
+ },
22
+ "peerDependencies": {
23
+ "react-native": "*"
24
+ },
25
+ "devDependencies": {
26
+ "@babel/core": "^7.12.9",
27
+ "@babel/runtime": "^7.12.5",
28
+ "@react-native-community/eslint-config": "^2.0.0",
29
+ "@types/jest": "26.0.23",
30
+ "@types/react-native": "0.64.4",
31
+ "@types/react-test-renderer": "16.9.2",
32
+ "babel-jest": "^26.6.3",
33
+ "eslint": "^7.14.0",
34
+ "jest": "^26.6.3",
35
+ "metro-react-native-babel-preset": "^0.64.0",
36
+ "react-test-renderer": "17.0.1",
37
+ "typescript": "^4.0.3"
38
+ },
39
+ "author": "@momo-kits/foundation",
40
+ "license": "ISC"
41
+ }
package/publish.sh ADDED
@@ -0,0 +1,26 @@
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
+ #babel component to dist
16
+ #babel ./dist -d dist --copy-files
17
+
18
+ cd dist
19
+ npm publish --tag beta --access=public
20
+
21
+ #clear dist and package json
22
+ cd ..
23
+ rm -rf dist
24
+
25
+
26
+ #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/core"}'