@momo-kits/foundation 0.167.1-beta.7 → 0.167.1-duo.12

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 (46) hide show
  1. package/Application/BottomSheet.tsx +115 -14
  2. package/Application/BottomTab/BottomTabBar.tsx +6 -3
  3. package/Application/BottomTab/DuoBarCompression.tsx +135 -0
  4. package/Application/BottomTab/DuoTabBar.tsx +462 -0
  5. package/Application/BottomTab/index.tsx +155 -134
  6. package/Application/Components/DuoGlassBackground.tsx +179 -0
  7. package/Application/Components/DuoQuickReturnHeader.tsx +42 -0
  8. package/Application/Components/HeaderExtendHeader.tsx +65 -28
  9. package/Application/Components/HeaderLeft.tsx +23 -0
  10. package/Application/Components/HeaderRight.tsx +104 -9
  11. package/Application/Components/HeaderTitle.tsx +47 -21
  12. package/Application/Components/OptionalGlassView.ts +11 -0
  13. package/Application/Components/SearchHeader.tsx +15 -14
  14. package/Application/Components/SideBarButton.tsx +128 -0
  15. package/Application/ModalScreen.tsx +16 -2
  16. package/Application/NavigationContainer.tsx +36 -48
  17. package/Application/Navigator.ts +1 -3
  18. package/Application/StackScreen.tsx +2 -5
  19. package/Application/WidgetContainer.tsx +9 -15
  20. package/Application/device.ts +29 -0
  21. package/Application/types.ts +10 -1
  22. package/Application/utils.tsx +10 -3
  23. package/Consts/index.ts +0 -1
  24. package/Consts/theme.ts +3 -4
  25. package/Input/Input.tsx +3 -4
  26. package/Input/InputMoney.tsx +31 -51
  27. package/Input/InputPhoneNumber.tsx +3 -4
  28. package/Input/InputSearch.tsx +3 -4
  29. package/Input/InputTextArea.tsx +3 -4
  30. package/Layout/Card.tsx +8 -26
  31. package/Layout/FloatingButton.tsx +3 -3
  32. package/Layout/Item.tsx +1 -10
  33. package/Layout/ReservedRegions.tsx +47 -0
  34. package/Layout/Screen.tsx +240 -48
  35. package/Layout/Section.tsx +5 -18
  36. package/Layout/index.ts +4 -4
  37. package/Layout/styles.ts +5 -0
  38. package/Layout/utils.ts +375 -5
  39. package/Popup/PopupNotify.tsx +33 -22
  40. package/Popup/PopupPromotion.tsx +20 -8
  41. package/Popup/utils.ts +32 -0
  42. package/Text/index.tsx +5 -15
  43. package/Text/utils.ts +1 -2
  44. package/package.json +3 -2
  45. package/Consts/designSystemFont.ts +0 -25
  46. package/Layout/GridSystem.tsx +0 -137
@@ -1,25 +0,0 @@
1
- import { useContext } from 'react';
2
- import { MiniAppContext } from '../Context';
3
-
4
- export const NEW_DEFAULT_FONT_FAMILY = 'MomoTrustSans';
5
- export const LEGACY_DEFAULT_FONT_FAMILY = 'SFProText';
6
- const HEADER_FONT_FAMILY = 'MoMoTrustDisplay';
7
-
8
- export const useIsDesignSystemWhiteList = (): boolean => {
9
- const context = useContext<any>(MiniAppContext);
10
- return context?.designSystemConfig?.isWhiteListDesignSystem === true;
11
- };
12
-
13
- export const resolveFontFamily = (font: string, isWhiteList: boolean): string =>
14
- isWhiteList ? NEW_DEFAULT_FONT_FAMILY : font;
15
-
16
- export const useResolvedFontFamily = (font: string): string =>
17
- resolveFontFamily(font, useIsDesignSystemWhiteList());
18
-
19
- export const useDefaultRegularFontFamily = (): string =>
20
- `${useResolvedFontFamily(LEGACY_DEFAULT_FONT_FAMILY)}-Regular`;
21
-
22
- export const useHeaderFontFamily = (): string =>
23
- useIsDesignSystemWhiteList()
24
- ? HEADER_FONT_FAMILY
25
- : LEGACY_DEFAULT_FONT_FAMILY;
@@ -1,137 +0,0 @@
1
- import React, { useContext } from 'react';
2
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
3
- import { Dimensions, StyleSheet, View } from 'react-native';
4
- import { ApplicationContext } from '../Context';
5
- import { Colors, Spacing } from '../Consts';
6
- import { GridContextProps } from './types';
7
- import { useGridSystem } from './utils';
8
-
9
- const GridSystem: React.FC<any> = ({
10
- width = Dimensions.get('window').width,
11
- useMargin = true,
12
- gutterSize = Spacing.M,
13
- screenGrid = true,
14
- gridColor = Colors.blue_07,
15
- }) => {
16
- const { theme } = useContext(ApplicationContext);
17
- const { numberOfColumns } = useGridSystem();
18
-
19
- const margin = useMargin ? Spacing.M : 0;
20
- const widthSection = width - margin * 2;
21
- const totalGutterSize = gutterSize * (numberOfColumns - 1);
22
- const sizePerSpan = (widthSection - totalGutterSize) / numberOfColumns;
23
-
24
- const grid: GridContextProps = {
25
- numberOfColumns,
26
- gutterSize,
27
- sizePerSpan,
28
- getSizeSpan: span => {
29
- return span * sizePerSpan + (span - 1) * gutterSize;
30
- },
31
- };
32
- const insets = useSafeAreaInsets();
33
-
34
- const list: number[] = [];
35
- for (let i = 1; i <= grid.numberOfColumns; i++) {
36
- list.push(i);
37
- }
38
-
39
- return (
40
- <>
41
- <View
42
- pointerEvents="none"
43
- style={[
44
- styles.gridContainer,
45
- screenGrid && insets,
46
- {
47
- borderColor: theme.colors.error.primary,
48
- marginHorizontal: margin,
49
- top: Spacing.M,
50
- bottom: Spacing.M,
51
- },
52
- ]}
53
- >
54
- {list.map((_, index) => {
55
- return (
56
- <View style={{ flexDirection: 'row' }} key={index.toString()}>
57
- {index !== 0 && <View style={{ width: grid.gutterSize }} />}
58
- <View
59
- key={`Grid${index.toString()}`}
60
- pointerEvents="none"
61
- style={[
62
- styles.gridColumn,
63
- {
64
- width: grid.sizePerSpan,
65
- backgroundColor: gridColor,
66
- },
67
- ]}
68
- />
69
- </View>
70
- );
71
- })}
72
- </View>
73
- {screenGrid && (
74
- <>
75
- <View pointerEvents="none" style={styles.dangerLeftContainer} />
76
- <View pointerEvents="none" style={styles.dangerRightContainer} />
77
- <View
78
- pointerEvents="none"
79
- style={[styles.dangerTopContainer, { height: Spacing.M }]}
80
- />
81
- <View
82
- pointerEvents="none"
83
- style={[styles.dangerBottomContainer, { height: insets.bottom }]}
84
- />
85
- </>
86
- )}
87
- </>
88
- );
89
- };
90
-
91
- const styles = StyleSheet.create({
92
- gridContainer: {
93
- position: 'absolute',
94
- top: 0,
95
- bottom: 0,
96
- left: 0,
97
- right: 0,
98
- flexDirection: 'row',
99
- borderWidth: 1,
100
- },
101
- gridColumn: {
102
- height: '100%',
103
- opacity: 0.2,
104
- },
105
- dangerTopContainer: {
106
- opacity: 0.2,
107
- backgroundColor: Colors.red_03,
108
- width: '100%',
109
- top: 0,
110
- position: 'absolute',
111
- },
112
- dangerBottomContainer: {
113
- opacity: 0.2,
114
- backgroundColor: Colors.red_03,
115
- width: '100%',
116
- bottom: 0,
117
- position: 'absolute',
118
- },
119
- dangerLeftContainer: {
120
- opacity: 0.2,
121
- backgroundColor: Colors.red_03,
122
- width: Spacing.M,
123
- height: '100%',
124
- left: 0,
125
- position: 'absolute',
126
- },
127
- dangerRightContainer: {
128
- opacity: 0.2,
129
- backgroundColor: Colors.red_03,
130
- width: Spacing.M,
131
- height: '100%',
132
- right: 0,
133
- position: 'absolute',
134
- },
135
- });
136
-
137
- export default GridSystem;