@momo-kits/foundation 0.75.1-beta.9 → 0.76.1-beta.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 (49) hide show
  1. package/{Navigation → Application}/BottomTab.tsx +19 -6
  2. package/{Navigation → Application}/Components.tsx +24 -15
  3. package/{Navigation → Application}/ModalScreen.tsx +17 -13
  4. package/{Navigation → Application}/Navigation.ts +5 -5
  5. package/{Navigation → Application}/NavigationContainer.tsx +3 -3
  6. package/{Navigation → Application}/StackScreen.tsx +7 -7
  7. package/{Navigation → Application}/index.ts +7 -3
  8. package/{Navigation → Application}/types.ts +23 -5
  9. package/{Navigation → Application}/utils.tsx +4 -6
  10. package/Assets/icon.json +6 -0
  11. package/Button/index.tsx +1 -1
  12. package/CheckBox/index.tsx +1 -1
  13. package/Consts/theme.ts +1 -1
  14. package/Divider/index.tsx +1 -1
  15. package/Icon/index.tsx +2 -2
  16. package/IconButton/index.tsx +1 -1
  17. package/Image/index.tsx +4 -2
  18. package/Input/Input.tsx +2 -1
  19. package/Input/InputMoney.tsx +2 -1
  20. package/Input/InputSearch.tsx +4 -2
  21. package/Input/InputTextArea.tsx +20 -19
  22. package/Input/common.tsx +1 -1
  23. package/Input/index.tsx +2 -0
  24. package/Layout/Card.tsx +13 -12
  25. package/Layout/GridSystem.tsx +4 -2
  26. package/Layout/Item.tsx +14 -14
  27. package/Layout/Screen.tsx +188 -0
  28. package/Layout/Section.tsx +9 -3
  29. package/Layout/types.ts +3 -1
  30. package/Layout/utils.ts +24 -4
  31. package/Pagination/Dot.tsx +1 -1
  32. package/Pagination/PaginationDot.tsx +1 -1
  33. package/Pagination/PaginationNumber.tsx +1 -2
  34. package/Pagination/PaginationScroll.tsx +2 -1
  35. package/Pagination/PaginationWhiteDot.tsx +1 -1
  36. package/Popup/PopupNotify.tsx +1 -1
  37. package/Popup/PopupPromotion.tsx +1 -1
  38. package/Radio/index.tsx +1 -1
  39. package/Switch/index.tsx +1 -1
  40. package/Tag/index.tsx +3 -1
  41. package/Text/index.tsx +5 -4
  42. package/Text/utils.ts +14 -0
  43. package/index.ts +9 -2
  44. package/package.json +40 -40
  45. package/publish.sh +2 -5
  46. package/Layout/ScreenContainer.tsx +0 -121
  47. package/Navigation/Observer.ts +0 -79
  48. /package/{Navigation → Application}/NavigationButton.tsx +0 -0
  49. /package/{Navigation → Application}/Navigator.ts +0 -0
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
1
  {
2
- "name": "@momo-kits/foundation",
3
- "version": "0.75.1-beta.9",
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
- }
2
+ "name": "@momo-kits/foundation",
3
+ "version": "0.76.1-beta.2",
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 CHANGED
@@ -12,15 +12,12 @@ echo VERSION: $VERSION
12
12
 
13
13
  rsync -r --verbose --exclude '*.mdx' --exclude '*Demo.js' --exclude 'props-type.js' --exclude 'prop-types.js' ./* dist
14
14
 
15
- #babel component to dist
16
- #babel ./dist -d dist --copy-files
17
-
18
15
  cd dist
19
- npm publish --tag beta --access=public
16
+ npm publish --tag latest --access=public
20
17
 
21
18
  #clear dist and package json
22
19
  cd ..
23
20
  rm -rf dist
24
21
 
25
22
 
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"}'
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"}'
@@ -1,121 +0,0 @@
1
- import {Animated, KeyboardAvoidingView, Platform, View} from 'react-native';
2
- import {useHeaderHeight} from '@react-navigation/stack';
3
- import {useSafeAreaInsets} from 'react-native-safe-area-context';
4
- import React, {useContext} from 'react';
5
- import {ScreenContainerProps} from '../Navigation/types';
6
- import {Spacing, Styles} from '../Consts';
7
- import {Section, Card, validateChildren} from './index';
8
- import {ApplicationContext} from '../Navigation';
9
-
10
- const ScreenContainer: React.FC<ScreenContainerProps> = ({
11
- children,
12
- enableKeyboardAvoidingView,
13
- scrollable,
14
- scrollY,
15
- headerBackground,
16
- scrollViewProps,
17
- footerComponent: Footer,
18
- }) => {
19
- const {theme} = useContext(ApplicationContext);
20
- const insets = useSafeAreaInsets();
21
- let marginHeader = 0;
22
- let handleScroll;
23
- let imageAnimatedStyle = {};
24
- let Component: any = View;
25
- if (scrollable) {
26
- Component = Animated.ScrollView;
27
- }
28
- if (scrollY) {
29
- marginHeader = useHeaderHeight();
30
- imageAnimatedStyle = {
31
- transform: [
32
- {
33
- scale: scrollY.interpolate?.({
34
- inputRange: [-300, 0, 1],
35
- outputRange: [1.75, 1, 1],
36
- extrapolate: 'clamp',
37
- }),
38
- },
39
- ],
40
- };
41
- handleScroll = Animated.event(
42
- [{nativeEvent: {contentOffset: {y: scrollY}}}],
43
- {useNativeDriver: true},
44
- );
45
- }
46
-
47
- /**
48
- * build content for screen
49
- */
50
- const renderContent = () => {
51
- const results = validateChildren(children, [Section, Card]);
52
- if (Array.isArray(results)) {
53
- return results.map((item, index) => {
54
- return (
55
- <View
56
- key={`ScreenItem${index}`}
57
- style={{
58
- marginTop: Spacing.M,
59
- flex: item.props?.expanded ? 1 : undefined,
60
- }}>
61
- {item}
62
- </View>
63
- );
64
- });
65
- }
66
- return results;
67
- };
68
-
69
- return (
70
- <View style={Styles.flex} accessibilityLabel={`ScreenContainer`}>
71
- <View
72
- style={{
73
- position: 'absolute',
74
- height: 300,
75
- width: '100%',
76
- }}>
77
- {!!headerBackground && (
78
- <Animated.Image
79
- source={{
80
- uri: headerBackground,
81
- }}
82
- style={{
83
- aspectRatio: 1.3,
84
- ...imageAnimatedStyle,
85
- }}
86
- />
87
- )}
88
- </View>
89
- <KeyboardAvoidingView
90
- style={Styles.flex}
91
- enabled={enableKeyboardAvoidingView}
92
- behavior={Platform.select({
93
- ios: 'padding',
94
- android: undefined,
95
- })}>
96
- <Component
97
- {...scrollViewProps}
98
- onScroll={handleScroll}
99
- style={[Styles.flex, {marginTop: marginHeader}]}>
100
- {renderContent()}
101
- </Component>
102
- {Footer && (
103
- <View
104
- style={{
105
- paddingTop: Spacing.S,
106
- paddingBottom: insets.bottom,
107
- backgroundColor: theme.colors.background.surface,
108
- }}>
109
- <Section>{Footer}</Section>
110
- </View>
111
- )}
112
- </KeyboardAvoidingView>
113
- </View>
114
- );
115
- };
116
-
117
- ScreenContainer.defaultProps = {
118
- enableKeyboardAvoidingView: false,
119
- scrollable: false,
120
- };
121
- export default ScreenContainer;
@@ -1,79 +0,0 @@
1
- class Subject {
2
- private observers: any[];
3
- constructor() {
4
- this.observers = [];
5
- }
6
-
7
- attach(observer: any) {
8
- observer && this.observers.push(observer);
9
- }
10
-
11
- detach(observer: any) {
12
- this.observers = this.observers.filter(item => item !== observer);
13
- }
14
-
15
- notify(newState: any) {
16
- this.observers.forEach(observer => {
17
- if (typeof observer === 'function') {
18
- observer(newState);
19
- } else {
20
- observer.updateData && observer.updateData(newState);
21
- }
22
- });
23
- }
24
- }
25
-
26
- class ObserverInstance {
27
- private readonly props: any;
28
- constructor(props: any) {
29
- this.props = props;
30
- }
31
-
32
- remove() {
33
- const {detach, observer} = this.props;
34
- detach && detach(observer);
35
- }
36
- }
37
-
38
- export default class Observer {
39
- static SCHEMA = 'Observer';
40
-
41
- static instances: any = {};
42
- private schema: any;
43
- private subject: Subject;
44
- private data: null;
45
- private loaded: boolean;
46
-
47
- constructor(props: any) {
48
- this.schema = props.schema;
49
- this.subject = new Subject();
50
- this.data = null;
51
- this.loaded = false;
52
- this.initilize();
53
- }
54
-
55
- static getInstance(schema: string, Class = Observer) {
56
- schema = schema || Class.SCHEMA;
57
- let instance = Observer.instances[schema];
58
- if (!instance) {
59
- instance = new Class({schema});
60
- Observer.instances[schema] = instance;
61
- }
62
- return instance;
63
- }
64
-
65
- initilize = () => {};
66
-
67
- notify = (state: any) => {
68
- this.subject.notify(state);
69
- };
70
-
71
- attach = (observer: any) => {
72
- this.subject.attach(observer);
73
- return new ObserverInstance({observer, detach: this.detach});
74
- };
75
-
76
- detach = (observer: any) => {
77
- this.subject.detach(observer);
78
- };
79
- }
File without changes