@momo-kits/foundation 0.81.43 → 0.81.49

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 (48) hide show
  1. package/Application/BottomTab.tsx +29 -12
  2. package/Application/Components.tsx +178 -174
  3. package/Application/ModalScreen.tsx +4 -17
  4. package/Application/NavigationContainer.tsx +9 -30
  5. package/Application/Navigator.ts +14 -9
  6. package/Application/StackScreen.tsx +25 -28
  7. package/Application/index.ts +10 -1
  8. package/Application/types.ts +30 -17
  9. package/Application/utils.tsx +14 -0
  10. package/Assets/icon.json +83 -5
  11. package/Assets/icon_bank.json +506 -0
  12. package/Badge/Badge.tsx +1 -1
  13. package/Badge/BadgeRibbon.tsx +2 -2
  14. package/Badge/styles.ts +5 -2
  15. package/Button/index.tsx +4 -5
  16. package/CheckBox/index.tsx +1 -2
  17. package/Icon/index.tsx +7 -2
  18. package/Icon/types.ts +1 -1
  19. package/IconButton/index.tsx +0 -1
  20. package/Input/Input.tsx +26 -7
  21. package/Input/InputDropDown.tsx +1 -6
  22. package/Input/InputMoney.tsx +14 -6
  23. package/Input/InputOTP.tsx +12 -9
  24. package/Input/InputSearch.tsx +8 -12
  25. package/Input/InputTextArea.tsx +4 -6
  26. package/Input/common.tsx +5 -3
  27. package/Input/index.tsx +2 -6
  28. package/Input/styles.ts +1 -3
  29. package/Layout/Card.tsx +8 -9
  30. package/Layout/Item.tsx +0 -1
  31. package/Layout/ItemList.tsx +39 -33
  32. package/Layout/Screen.tsx +1 -3
  33. package/Layout/Section.tsx +4 -4
  34. package/Pagination/PaginationNumber.tsx +1 -1
  35. package/Pagination/PaginationScroll.tsx +0 -1
  36. package/Popup/PopupNotify.tsx +28 -32
  37. package/Popup/PopupPromotion.tsx +24 -28
  38. package/Radio/index.tsx +1 -2
  39. package/Skeleton/index.tsx +1 -1
  40. package/Switch/index.tsx +0 -1
  41. package/Tag/index.tsx +2 -4
  42. package/Text/index.tsx +2 -2
  43. package/Text/styles.ts +38 -0
  44. package/Text/types.ts +18 -24
  45. package/Title/index.tsx +2 -2
  46. package/package.json +2 -2
  47. package/publish.sh +1 -1
  48. package/verify.js +37 -39
@@ -4,7 +4,7 @@ import {PopupNotifyProps} from './types';
4
4
  import {Radius, Spacing, Styles} from '../Consts';
5
5
  import {Image} from '../Image';
6
6
  import {Text} from '../Text';
7
- import {ApplicationContext} from '../Application';
7
+ import {ApplicationContext, MiniAppContext} from '../Application';
8
8
  import {Button} from '../Button';
9
9
  import {Icon} from '../Icon';
10
10
 
@@ -19,6 +19,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
19
19
  buttonDirection = 'row',
20
20
  onIconClose,
21
21
  }) => {
22
+ const context = useContext(MiniAppContext);
22
23
  const {theme, navigator, translate} = useContext(ApplicationContext);
23
24
  const [scrollContent, setScrollContent] = useState(false);
24
25
  const closeAction = useRef('touch_outside');
@@ -34,35 +35,31 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
34
35
  * tracking
35
36
  */
36
37
  useEffect(() => {
37
- if (navigator?.trackingInfo) {
38
- const routes = navigator.ref.current?.getRootState()?.routes || [];
39
- const routesLength = routes.length;
40
- let screen_name = routes?.[0]?.params?.screen?.name;
41
- if (routesLength > 1) {
42
- screen_name = routes[routesLength - 2]?.params?.screen?.name;
43
- }
44
- const tracking = {
45
- feature_code: navigator?.trackingInfo?.code,
46
- app_id: navigator?.trackingInfo?.appId,
47
- miniapp_version: navigator?.trackingInfo?.buildNumber,
48
- flow_partner_id: navigator?.trackingInfo?.flowPartnerId,
49
- screen_name,
50
- component_type: 'popup',
51
- component_name: id,
52
- error_code: error ? error : undefined,
53
- };
54
- navigator?.maxApi?.trackEvent?.('service_component_displayed', {
38
+ const routes = navigator?.ref.current?.getRootState()?.routes || [];
39
+ const routesLength = routes.length;
40
+ let screen_name = routes?.[0]?.params?.screen?.name;
41
+ if (routesLength > 1) {
42
+ screen_name = routes[routesLength - 2]?.params?.screen?.name;
43
+ }
44
+ const tracking = {
45
+ ...context,
46
+ screen_name,
47
+ component_type: 'popup',
48
+ component_name: id,
49
+ error_code: error ? error : undefined,
50
+ };
51
+ navigator?.maxApi?.trackEvent?.('service_component_displayed', {
52
+ ...tracking,
53
+ trigger_id: '111012100000000000',
54
+ });
55
+
56
+ return () => {
57
+ navigator?.maxApi?.trackEvent?.('service_popup_dismissed', {
55
58
  ...tracking,
56
- trigger_id: '111012100000000000',
59
+ trigger_id: '111154100000000001',
60
+ action_type: closeAction.current,
57
61
  });
58
- return () => {
59
- navigator?.maxApi?.trackEvent?.('service_popup_dismissed', {
60
- ...tracking,
61
- trigger_id: '111154100000000001',
62
- action_type: closeAction.current,
63
- });
64
- };
65
- }
62
+ };
66
63
  }, []);
67
64
 
68
65
  /**
@@ -185,19 +182,18 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
185
182
 
186
183
  return (
187
184
  <View
188
- accessibilityLabel={'PopupNotify'}
189
185
  style={[
190
186
  styles.container,
191
187
  {backgroundColor: theme.colors.background.surface},
192
188
  ]}>
193
189
  {!!image && <Image source={{uri: image}} style={styles.image} />}
194
190
  <View style={styles.content}>
195
- <Text typography={'title_xs'} numberOfLines={1}>
191
+ <Text typography={'header_default_bold'} numberOfLines={1}>
196
192
  {title}
197
193
  </Text>
198
194
  <Description style={[styles.description, descriptionStyle]}>
199
195
  <Text
200
- typography={'paragraph_default'}
196
+ typography={'body_default_regular'}
201
197
  onTextLayout={({nativeEvent: {lines}}) => {
202
198
  const enableScroll = lines.length > 3;
203
199
  if (enableScroll != scrollContent) {
@@ -210,7 +206,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
210
206
  {!!error && (
211
207
  <View style={styles.information}>
212
208
  <Text
213
- typography={'description_xs'}
209
+ typography={'description_xs_regular'}
214
210
  color={theme.colors.text.hint}
215
211
  numberOfLines={1}>
216
212
  {translate?.('errorCode')}
@@ -1,7 +1,7 @@
1
1
  import React, {useContext, useEffect, useRef} from 'react';
2
2
  import {StyleSheet, TouchableOpacity, View} from 'react-native';
3
3
  import {PopupPromotionProps} from './types';
4
- import {ApplicationContext} from '../Application';
4
+ import {ApplicationContext, MiniAppContext} from '../Application';
5
5
  import {Image} from '../Image';
6
6
  import {Radius, Spacing} from '../Consts';
7
7
  import {Icon} from '../Icon';
@@ -11,6 +11,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
11
11
  image,
12
12
  onIconClose,
13
13
  }) => {
14
+ const context = useContext(MiniAppContext);
14
15
  const {theme, navigator} = useContext(ApplicationContext);
15
16
  const closeAction = useRef('touch_outside');
16
17
 
@@ -18,34 +19,29 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
18
19
  * tracking
19
20
  */
20
21
  useEffect(() => {
21
- if (navigator?.trackingInfo) {
22
- const routes = navigator.ref.current?.getRootState()?.routes || [];
23
- const routesLength = routes.length;
24
- let screen_name = routes?.[0]?.params?.screen?.name;
25
- if (routesLength > 1) {
26
- screen_name = routes[routesLength - 2]?.params?.screen?.name;
27
- }
28
- const tracking = {
29
- feature_code: navigator?.trackingInfo?.code,
30
- app_id: navigator?.trackingInfo?.appId,
31
- miniapp_version: navigator?.trackingInfo?.buildNumber,
32
- flow_partner_id: navigator?.trackingInfo?.flowPartnerId,
33
- screen_name,
34
- component_type: 'popup',
35
- component_name: id,
36
- };
37
- navigator?.maxApi?.trackEvent?.('service_component_displayed', {
22
+ const routes = navigator?.ref.current?.getRootState()?.routes || [];
23
+ const routesLength = routes.length;
24
+ let screen_name = routes?.[0]?.params?.screen?.name;
25
+ if (routesLength > 1) {
26
+ screen_name = routes[routesLength - 2]?.params?.screen?.name;
27
+ }
28
+ const tracking = {
29
+ ...context,
30
+ screen_name,
31
+ component_type: 'popup',
32
+ component_name: id,
33
+ };
34
+ navigator?.maxApi?.trackEvent?.('service_component_displayed', {
35
+ ...tracking,
36
+ trigger_id: '111012100000000000',
37
+ });
38
+ return () => {
39
+ navigator?.maxApi?.trackEvent?.('service_popup_dismissed', {
38
40
  ...tracking,
39
- trigger_id: '111012100000000000',
41
+ trigger_id: '111154100000000001',
42
+ action_type: closeAction.current,
40
43
  });
41
- return () => {
42
- navigator?.maxApi?.trackEvent?.('service_popup_dismissed', {
43
- ...tracking,
44
- trigger_id: '111154100000000001',
45
- action_type: closeAction.current,
46
- });
47
- };
48
- }
44
+ };
49
45
  }, []);
50
46
 
51
47
  /**
@@ -81,7 +77,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
81
77
  };
82
78
 
83
79
  return (
84
- <View accessibilityLabel={'PopupPromotion'}>
80
+ <View>
85
81
  <Image
86
82
  source={{
87
83
  uri: image,
package/Radio/index.tsx CHANGED
@@ -39,7 +39,6 @@ const Radio: FC<RadioProps> = ({
39
39
 
40
40
  return (
41
41
  <TouchableOpacity
42
- accessibilityLabel={`Radio/${label}/${value}`}
43
42
  onPress={onChange}
44
43
  disabled={disabled}
45
44
  style={[
@@ -57,7 +56,7 @@ const Radio: FC<RadioProps> = ({
57
56
  {marginRight: label ? Spacing.XS : 0},
58
57
  ]}
59
58
  />
60
- {!!label && <Text typography={'description_default'}>{label}</Text>}
59
+ {!!label && <Text typography={'body_default_regular'}>{label}</Text>}
61
60
  </TouchableOpacity>
62
61
  );
63
62
  };
@@ -41,7 +41,7 @@ const Skeleton: React.FC<SkeletonTypes> = ({style}) => {
41
41
  }
42
42
  };
43
43
  return (
44
- <View style={[styles.container, style]} accessibilityLabel={'Skeleton'}>
44
+ <View style={[styles.container, style]}>
45
45
  <View
46
46
  onLayout={e => onLayout(e.nativeEvent.layout.width)}
47
47
  style={[Styles.flex, {backgroundColor: PRIMARY_COLOR}]}>
package/Switch/index.tsx CHANGED
@@ -16,7 +16,6 @@ const Switch: FC<SwitchProps> = props => {
16
16
 
17
17
  return (
18
18
  <TouchableOpacity
19
- accessibilityLabel={'Switch'}
20
19
  disabled={disabled}
21
20
  onPress={() => onChange?.(!value)}
22
21
  style={[
package/Tag/index.tsx CHANGED
@@ -60,9 +60,7 @@ const Tag: FC<TagProps> = ({
60
60
  }
61
61
 
62
62
  return (
63
- <View
64
- style={[style, sizeStyle, {backgroundColor: tagColor}]}
65
- accessibilityLabel={`Tag/${label}`}>
63
+ <View style={[style, sizeStyle, {backgroundColor: tagColor}]}>
66
64
  {!!icon && (
67
65
  <Icon
68
66
  style={styles.icon}
@@ -71,7 +69,7 @@ const Tag: FC<TagProps> = ({
71
69
  color={labelColor}
72
70
  />
73
71
  )}
74
- <Text color={labelColor} typography={'label_s'}>
72
+ <Text color={labelColor} typography={'label_s_medium'}>
75
73
  {label}
76
74
  </Text>
77
75
  </View>
package/Text/index.tsx CHANGED
@@ -84,6 +84,7 @@ const Text: React.FC<TextProps> = ({
84
84
  }
85
85
 
86
86
  return {
87
+ ...typoStyle,
87
88
  fontFamily,
88
89
  fontSize: scaleSize(fontSize),
89
90
  lineHeight: scaleSize(lineHeight),
@@ -96,7 +97,6 @@ const Text: React.FC<TextProps> = ({
96
97
  return (
97
98
  <RNText
98
99
  {...rest}
99
- accessibilityLabel={`Text/${children}`}
100
100
  style={[style, textStyle, {color: color ?? theme.colors.text.default}]}>
101
101
  {children ?? ''}
102
102
  </RNText>
@@ -104,7 +104,7 @@ const Text: React.FC<TextProps> = ({
104
104
  };
105
105
 
106
106
  Text.defaultProps = {
107
- typography: 'paragraph_default',
107
+ typography: 'body_default_regular',
108
108
  };
109
109
 
110
110
  export {Text, scaleSize};
package/Text/styles.ts CHANGED
@@ -1,4 +1,42 @@
1
1
  export default {
2
+ headline_default_bold: {fontSize: 24, lineHeight: 32, fontWeight: '700'},
3
+ header_m_bold: {fontSize: 18, lineHeight: 28, fontWeight: '700'},
4
+ header_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
5
+ header_s_semibold: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
6
+ header_xs_semibold: {fontSize: 12, lineHeight: 16, fontWeight: '600'},
7
+ body_default_regular: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
8
+ body_regularstrikethrought: {
9
+ fontSize: 14,
10
+ lineHeight: 20,
11
+ fontWeight: '400',
12
+ textDecorationLine: 'line-through',
13
+ },
14
+ description_default_regular: {
15
+ fontSize: 12,
16
+ lineHeight: 16,
17
+ fontWeight: '400',
18
+ },
19
+ description_default_regularstrikethrought: {
20
+ fontSize: 12,
21
+ lineHeight: 16,
22
+ fontWeight: '400',
23
+ textDecorationLine: 'line-through',
24
+ },
25
+ description_xs_regular: {fontSize: 10, lineHeight: 14, fontWeight: '400'},
26
+ description_xs_regularstrikethrought: {
27
+ fontSize: 10,
28
+ lineHeight: 14,
29
+ fontWeight: '400',
30
+ textDecorationLine: 'line-through',
31
+ },
32
+ label_default_medium: {fontSize: 14, lineHeight: 20, fontWeight: '500'},
33
+ label_s_medium: {fontSize: 12, lineHeight: 16, fontWeight: '500'},
34
+ label_xs_medium: {fontSize: 10, lineHeight: 14, fontWeight: '500'},
35
+ action_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
36
+ action_s_bold: {fontSize: 14, lineHeight: 20, fontWeight: '700'},
37
+ action_xs_bold: {fontSize: 12, lineHeight: 16, fontWeight: '700'},
38
+ action_xxs_bold: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
39
+ /**non-support**/
2
40
  headline_default: {
3
41
  fontSize: 28,
4
42
  lineHeight: 34,
package/Text/types.ts CHANGED
@@ -14,27 +14,21 @@ export type TypographyWeight = {
14
14
  };
15
15
 
16
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';
17
+ | 'headline_default_bold'
18
+ | 'header_m_bold'
19
+ | 'header_default_bold'
20
+ | 'header_s_semibold'
21
+ | 'header_xs_semibold'
22
+ | 'body_default_regular'
23
+ | 'body_regularstrikethrought'
24
+ | 'description_default_regular'
25
+ | 'description_default_regularstrikethrought'
26
+ | 'description_xs_regular'
27
+ | 'description_xs_regularstrikethrought'
28
+ | 'label_default_medium'
29
+ | 'label_s_medium'
30
+ | 'label_xs_medium'
31
+ | 'action_default_bold'
32
+ | 'action_s_bold'
33
+ | 'action_xs_bold'
34
+ | 'action_xxs_bold';
package/Title/index.tsx CHANGED
@@ -39,7 +39,7 @@ const Title: FC<TitleProps> = ({
39
39
  const renderAction = () => {
40
40
  return !!actionTitle && titleFlex ? (
41
41
  <TouchableOpacity onPress={onPressAction}>
42
- <Text typography={'action_s'} color={theme.colors.primary}>
42
+ <Text typography={'action_s_bold'} color={theme.colors.primary}>
43
43
  {actionTitle}
44
44
  </Text>
45
45
  </TouchableOpacity>
@@ -116,7 +116,7 @@ const Title: FC<TitleProps> = ({
116
116
  {!!description && type !== 'screen' && (
117
117
  <Text
118
118
  numberOfLines={1}
119
- typography={'description_s'}
119
+ typography={'description_default_regular'}
120
120
  color={theme.colors.text.secondary}>
121
121
  {description}
122
122
  </Text>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.43",
3
+ "version": "0.81.49",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -43,4 +43,4 @@
43
43
  },
44
44
  "author": "@momo-kits/foundation",
45
45
  "license": "ISC"
46
- }
46
+ }
package/publish.sh CHANGED
@@ -13,7 +13,7 @@ echo VERSION: $VERSION
13
13
  rsync -r --verbose --exclude '*.mdx' --exclude '*Demo.js' --exclude 'props-type.js' --exclude 'prop-types.js' ./* dist
14
14
 
15
15
  cd dist
16
- npm publish --tag latest --access=public
16
+ npm publish --tag beta --access=public
17
17
 
18
18
  #clear dist and package json
19
19
  cd ..
package/verify.js CHANGED
@@ -1,43 +1,41 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
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?.name !== '@momo-platform/momo-core' &&
31
- miniInfo?.resolutions?.['@momo-platform/momo-core'] !== packageInfo?.version
32
- ) {
33
- console.error(
34
- `Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`,
35
- );
36
- throw new Error(
37
- `Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`,
38
- );
39
- }
40
- } catch (error) {
41
- console.error(`Installation failed: ${error.message}`);
42
- process.exit(1);
4
+ const packageInfo = JSON.parse(
5
+ fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8')
6
+ );
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
+
12
+ if (!fs.existsSync(app) || !fs.existsSync(miniJson)) {
13
+ return;
14
+ }
15
+
16
+ const appInfo = JSON.parse(fs.readFileSync(app, 'utf8'));
17
+ const miniInfo = JSON.parse(fs.readFileSync(miniJson, 'utf8'));
18
+
19
+ const iOSAppTarget = appInfo?.client?.ios.deploymentTarget;
20
+ const androidAppTarget = appInfo?.client?.android.deploymentTarget;
21
+
22
+ if (
23
+ miniInfo?.dependencies?.['@momo-platform/momo-core']?.includes('optimize')
24
+ ) {
25
+ return;
26
+ }
27
+
28
+ if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
29
+ throw new Error(
30
+ `\x1b[41m Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`
31
+ );
32
+ }
33
+
34
+ if (
35
+ miniInfo?.dependencies?.['@momo-platform/momo-core'] &&
36
+ miniInfo?.dependencies?.['@momo-platform/momo-core'] !== packageInfo?.version
37
+ ) {
38
+ throw new Error(
39
+ `\x1b[41m Package ${packageInfo.name} version: ${packageInfo.version} require install resolutions @momo-platform/momo-core ${packageInfo.version}`
40
+ );
43
41
  }