@momo-kits/foundation 0.168.1-beta.39 → 0.168.1-beta.40

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 (153) hide show
  1. package/Application/BottomSheet.tsx +398 -86
  2. package/Application/BottomTab/BottomTabBar.tsx +275 -215
  3. package/Application/BottomTab/CustomBottomTabItem.tsx +107 -131
  4. package/Application/BottomTab/DuoBarCompression.tsx +28 -14
  5. package/Application/BottomTab/DuoTabBar.tsx +540 -32
  6. package/Application/BottomTab/TabBarIcon.tsx +72 -146
  7. package/Application/BottomTab/index.tsx +353 -89
  8. package/Application/BottomTab/useLiquidSelection.ts +374 -0
  9. package/Application/Components/BackgroundImageView.tsx +0 -4
  10. package/Application/Components/DuoGlassBackground.tsx +5 -7
  11. package/Application/Components/HeaderAnimated.tsx +13 -41
  12. package/Application/Components/HeaderBackground.tsx +3 -20
  13. package/Application/Components/HeaderExtendHeader.tsx +46 -66
  14. package/Application/Components/HeaderLeft.tsx +18 -5
  15. package/Application/Components/HeaderRight.tsx +529 -8
  16. package/Application/Components/HeaderTitle.tsx +579 -16
  17. package/Application/Components/NavigationButton.tsx +11 -18
  18. package/Application/Components/SearchHeader.tsx +18 -38
  19. package/Application/Localize.ts +0 -7
  20. package/Application/ModalScreen.tsx +18 -41
  21. package/Application/Navigation.ts +17 -15
  22. package/Application/NavigationContainer.tsx +21 -23
  23. package/Application/Navigator.ts +48 -20
  24. package/Application/ScaleSizeProvider.tsx +6 -13
  25. package/Application/StackScreen.tsx +172 -27
  26. package/Application/TooltipPortal.tsx +5 -12
  27. package/Application/WidgetContainer.tsx +7 -20
  28. package/Application/device.ts +52 -0
  29. package/Application/index.ts +1 -23
  30. package/Application/types.ts +242 -17
  31. package/Application/utils.tsx +493 -0
  32. package/Badge/Badge.tsx +0 -5
  33. package/Badge/BadgeDot.tsx +0 -1
  34. package/Badge/BadgeDotAnimation.tsx +7 -15
  35. package/Badge/BadgeRibbon.tsx +39 -47
  36. package/Badge/Shape.tsx +0 -2
  37. package/Badge/styles.ts +0 -2
  38. package/Badge/types.ts +2 -2
  39. package/Button/index.tsx +152 -21
  40. package/Button/styles.ts +1 -1
  41. package/CheckBox/index.tsx +6 -5
  42. package/Consts/theme.ts +10 -10
  43. package/Context/index.ts +1 -5
  44. package/Divider/DashDivider.tsx +11 -11
  45. package/Divider/index.tsx +7 -21
  46. package/FoundationList/index.tsx +0 -4
  47. package/Icon/index.tsx +6 -6
  48. package/Icon/types.ts +1 -1
  49. package/IconButton/index.tsx +12 -4
  50. package/Image/index.tsx +7 -9
  51. package/Input/Input.tsx +12 -10
  52. package/Input/InputDropDown.tsx +13 -10
  53. package/Input/InputMoney.tsx +152 -45
  54. package/Input/InputOTP.tsx +34 -36
  55. package/Input/InputPhoneNumber.tsx +5 -8
  56. package/Input/InputSearch.tsx +111 -19
  57. package/Input/InputTextArea.tsx +5 -5
  58. package/Input/SystemTextInput.tsx +2 -7
  59. package/Input/TextTyping.tsx +0 -4
  60. package/Input/common.tsx +17 -31
  61. package/Input/index.tsx +21 -24
  62. package/Input/styles.ts +5 -25
  63. package/Input/utils.ts +12 -14
  64. package/Layout/Card.tsx +4 -7
  65. package/Layout/FloatingButton.tsx +21 -26
  66. package/Layout/Item.tsx +2 -6
  67. package/Layout/ItemList.tsx +7 -9
  68. package/Layout/ItemSectionList.tsx +1 -2
  69. package/Layout/ReservedRegions.tsx +17 -34
  70. package/Layout/Screen.tsx +696 -122
  71. package/Layout/Section.tsx +7 -9
  72. package/Layout/TrackingScope.tsx +0 -1
  73. package/Layout/index.ts +4 -10
  74. package/Layout/styles.ts +0 -2
  75. package/Layout/types.ts +4 -2
  76. package/Layout/utils.ts +181 -40
  77. package/Loader/DotLoader.tsx +3 -11
  78. package/Loader/Loader.tsx +0 -4
  79. package/Loader/ProgressBar.tsx +6 -3
  80. package/Loader/Spinner.tsx +3 -11
  81. package/Loader/styles.ts +0 -4
  82. package/Loader/utils.ts +7 -11
  83. package/Pagination/Dot.tsx +0 -4
  84. package/Pagination/PaginationDot.tsx +0 -1
  85. package/Pagination/PaginationNumber.tsx +3 -5
  86. package/Pagination/PaginationScroll.tsx +0 -5
  87. package/Pagination/PaginationWhiteDot.tsx +0 -1
  88. package/Pagination/index.tsx +0 -4
  89. package/Pagination/types.ts +2 -2
  90. package/Popup/PopupNotify.tsx +102 -94
  91. package/Popup/PopupPromotion.tsx +11 -9
  92. package/Popup/types.ts +4 -11
  93. package/Popup/utils.ts +18 -50
  94. package/Radio/index.tsx +10 -6
  95. package/Radio/styles.ts +0 -6
  96. package/Skeleton/index.tsx +9 -9
  97. package/Skeleton/styles.ts +0 -1
  98. package/Switch/index.tsx +0 -1
  99. package/Tag/index.tsx +4 -8
  100. package/Tag/types.ts +3 -3
  101. package/Text/index.tsx +5 -25
  102. package/Text/styles.ts +1 -1
  103. package/Text/types.ts +6 -1
  104. package/Text/utils.ts +4 -20
  105. package/Title/index.tsx +40 -42
  106. package/Title/styles.ts +0 -6
  107. package/ViewBoundary/index.tsx +2 -4
  108. package/index.ts +6 -0
  109. package/package.json +1 -2
  110. package/Application/BottomSheet.hooks.ts +0 -195
  111. package/Application/BottomSheet.parts.tsx +0 -157
  112. package/Application/BottomSheet.styles.ts +0 -43
  113. package/Application/BottomTab/ActiveIndicator.tsx +0 -91
  114. package/Application/BottomTab/BottomTabBar.styles.ts +0 -65
  115. package/Application/BottomTab/BottomTabInset.tsx +0 -18
  116. package/Application/BottomTab/CurvedContainer.tsx +0 -155
  117. package/Application/BottomTab/DuoRailTabBar.tsx +0 -223
  118. package/Application/BottomTab/DuoTabBar.styles.ts +0 -81
  119. package/Application/BottomTab/TabScreen.tsx +0 -160
  120. package/Application/BottomTab/metrics.ts +0 -164
  121. package/Application/BottomTab/tabItems.ts +0 -46
  122. package/Application/BottomTab/usePressLift.ts +0 -32
  123. package/Application/Components/HeaderRight.styles.ts +0 -146
  124. package/Application/Components/HeaderTitle.shared.ts +0 -44
  125. package/Application/Components/HeaderTitle.styles.ts +0 -125
  126. package/Application/Components/HeaderToolkitAction.tsx +0 -180
  127. package/Application/Components/SwipeBackHaptic.tsx +0 -95
  128. package/Application/Components/TitleJourney.tsx +0 -110
  129. package/Application/Components/TitleLocation.tsx +0 -73
  130. package/Application/Components/TitleUser.tsx +0 -304
  131. package/Application/Components/useToolkitActions.tsx +0 -218
  132. package/Application/ModalIconButton.tsx +0 -66
  133. package/Application/StackScreen.tracking.ts +0 -143
  134. package/Application/headerLayout.ts +0 -158
  135. package/Application/hooks.ts +0 -137
  136. package/Application/modalLayout.ts +0 -176
  137. package/Application/navigationOptions.tsx +0 -212
  138. package/Application/types.header.ts +0 -121
  139. package/Application/types.tabs.ts +0 -48
  140. package/Application/types.theme.ts +0 -87
  141. package/Application/utils.ts +0 -107
  142. package/Button/utils.ts +0 -133
  143. package/Input/InputMoneyView.tsx +0 -194
  144. package/Input/SearchTextTyping.tsx +0 -108
  145. package/Input/moneyUtils.ts +0 -23
  146. package/Layout/layoutMetrics.ts +0 -58
  147. package/Layout/layoutTypes.ts +0 -86
  148. package/Layout/screenContent.tsx +0 -92
  149. package/Layout/screenFooter.tsx +0 -63
  150. package/Layout/screenHeader.tsx +0 -321
  151. package/Layout/screenQuickReturn.tsx +0 -64
  152. package/Layout/screenScroll.ts +0 -107
  153. package/Layout/screenTypes.ts +0 -143
@@ -14,24 +14,14 @@ import { Colors, Radius, Spacing } from '../../Consts';
14
14
  import { Image } from '../../Image';
15
15
  import { SearchHeaderProps } from '../types';
16
16
  import BackgroundImageView from './BackgroundImageView';
17
- import { type AnimatedCompatValue } from '../utils';
18
- import { useNormalizedSharedValue } from '../hooks';
17
+ import { AnimatedCompatValue, useNormalizedSharedValue } from '../utils';
19
18
  import { useScreenLayout } from '../../Layout';
20
- import { HeaderMetrics } from '../../Layout/utils';
21
- import {
22
- HeaderBarMetrics,
23
- type HeaderContentLayout,
24
- useHeaderLayout,
25
- } from '../headerLayout';
19
+ import { DuoMetrics, HeaderMetrics } from '../../Layout/utils';
26
20
 
27
- const { buttonSize, pillWidth, sidePadding, titleGap } = HeaderBarMetrics;
28
- const SCREEN_PADDING = sidePadding;
29
- const TOOLKIT_WIDTH = pillWidth + sidePadding;
21
+ const SCREEN_PADDING = 12;
22
+ const BACK_WIDTH = 28;
23
+ const TOOLKIT_WIDTH = 73;
30
24
 
31
- /**
32
- * Extended header background: a gradient that collapses on scroll and, with
33
- * `inputSearchProps`, a full-width search that slides into the bar beside back/toolkit.
34
- */
35
25
  const HeaderExtendHeader: React.FC<{
36
26
  headerType?: HeaderType;
37
27
  animatedValue: AnimatedCompatValue;
@@ -43,7 +33,6 @@ const HeaderExtendHeader: React.FC<{
43
33
  useShadowHeader?: boolean;
44
34
  gradientColor?: string;
45
35
  headerBackground?: string;
46
- contentLayout?: HeaderContentLayout;
47
36
  }> = ({
48
37
  headerType = 'default',
49
38
  animatedValue,
@@ -54,7 +43,6 @@ const HeaderExtendHeader: React.FC<{
54
43
  useShadowHeader: useShadowHeaderProp = true,
55
44
  gradientColor: customGradientColor,
56
45
  headerBackground: customBackground,
57
- contentLayout,
58
46
  }) => {
59
47
  const { theme } = useContext(ApplicationContext);
60
48
  const context = useContext<any>(MiniAppContext);
@@ -62,31 +50,31 @@ const HeaderExtendHeader: React.FC<{
62
50
  const gradientColor = customGradientColor ?? theme.colors.gradient;
63
51
  const headerBackground = customBackground ?? theme.assets?.headerBackground;
64
52
  const layout = useScreenLayout();
65
- const headerLayout = useHeaderLayout(contentLayout);
66
- // the stretch frame pulls the search in from both bar edges
67
- const frameShift = headerLayout.frameInset - sidePadding;
68
53
 
69
- const backLeft = buttonSize + sidePadding + titleGap;
70
- const defaultLeft = layout.sideBar ? SCREEN_PADDING : backLeft;
54
+ // the iPhone Duo status bar row keeps side bar sized back and toolkit
55
+ const isStatusBarRow = !!layout.statusBarClearance;
56
+ const duoToolkitWidth = DuoMetrics.itemPitch * 2 + SCREEN_PADDING;
57
+ const backWidth = isStatusBarRow ? DuoMetrics.controlSize : BACK_WIDTH;
58
+ const toolkitWidth = isStatusBarRow ? duoToolkitWidth : TOOLKIT_WIDTH;
59
+ const defaultLeft = layout.sideBar ? SCREEN_PADDING : backWidth + 20;
71
60
  const leftPosition = inputSearchProps?.leftPosition || defaultLeft;
72
- const defaultRightWidth = layout.sideBar ? 0 : TOOLKIT_WIDTH;
61
+ const defaultRightWidth = layout.sideBar ? 0 : toolkitWidth;
73
62
  const headerRightWidth = customHeaderRightWidth ?? defaultRightWidth;
74
- const contentLeft = layout.insetLeft + SCREEN_PADDING + frameShift;
75
- const contentRight = layout.insetLeft + layout.contentWidth - frameShift;
63
+ const contentLeft = layout.insetLeft + SCREEN_PADDING;
64
+ const contentRight = layout.insetLeft + layout.contentWidth;
76
65
  // collapsed on the status bar row, the search stays between its clusters
77
- const clearanceLeft = layout.statusBarClearance?.left ?? 0;
78
- const clearanceRight = layout.statusBarClearance?.right ?? 0;
79
- const searchLeft = leftPosition + clearanceLeft + frameShift;
80
- const collapsedLeft = layout.insetLeft + searchLeft;
81
- const collapsedRight = contentRight - clearanceRight - headerRightWidth;
82
- const searchWidth = contentRight - contentLeft - SCREEN_PADDING;
83
- const collapsedSearchWidth = collapsedRight - collapsedLeft - SCREEN_PADDING;
66
+ const collapsedLeft =
67
+ layout.insetLeft + leftPosition + (layout.statusBarClearance?.left ?? 0);
68
+ const collapsedRight = contentRight - (layout.statusBarClearance?.right ?? 0);
69
+ const searchWidth = layout.contentWidth - SCREEN_PADDING * 2;
70
+ const collapsedSearchWidth =
71
+ collapsedRight - collapsedLeft - SCREEN_PADDING - headerRightWidth;
84
72
  // a row taller than barHeight (iPhone Duo) centers the collapsed search on the title
85
- const titleRowHeight = layout.headerHeight - layout.headerStatusBarHeight;
86
- const collapsedRaise = (titleRowHeight - HeaderMetrics.barHeight) / 2;
87
-
88
- // the iPhone Duo side bar keeps the content search size
89
- const searchSize = layout.sideBar ? 'default' : 'header';
73
+ const collapsedRaise =
74
+ (layout.headerHeight -
75
+ layout.headerStatusBarHeight -
76
+ HeaderMetrics.barHeight) /
77
+ 2;
90
78
 
91
79
  let useShadowHeader = useShadowHeaderProp;
92
80
  if (inputSearchProps && Platform.OS === 'android') {
@@ -159,9 +147,7 @@ const HeaderExtendHeader: React.FC<{
159
147
 
160
148
  if (inputSearchProps) {
161
149
  return (
162
- <View
163
- style={[styles.container, showBaseLineDebug && styles.debugBaseLine]}
164
- >
150
+ <View style={[{ zIndex: 0 }, showBaseLineDebug && styles.debugBaseLine]}>
165
151
  <Animated.View style={heightStyle} />
166
152
  <BackgroundImageView
167
153
  useShadowHeader={useShadowHeader}
@@ -179,7 +165,6 @@ const HeaderExtendHeader: React.FC<{
179
165
  <Animated.View
180
166
  style={[
181
167
  styles.extendedHeader,
182
- headerLayout.isWide && styles.phoneHeight,
183
168
  // fade out within the header box, as DuoScrollGradient does
184
169
  !!layout.sideBar && styles.fillHeaderBox,
185
170
  gradientOpacityStyle,
@@ -191,10 +176,7 @@ const HeaderExtendHeader: React.FC<{
191
176
  >
192
177
  {!!theme.assets?.headerBackground && (
193
178
  <Image
194
- style={[
195
- styles.headerBackground,
196
- headerLayout.isWide && styles.phoneHeight,
197
- ]}
179
+ style={styles.headerBackground}
198
180
  source={{ uri: theme.assets?.headerBackground }}
199
181
  loading={false}
200
182
  />
@@ -203,7 +185,16 @@ const HeaderExtendHeader: React.FC<{
203
185
  </Animated.View>
204
186
  )}
205
187
  </Animated.View>
206
- <Animated.View style={[styles.searchContainer, heightStyle]}>
188
+ <Animated.View
189
+ style={[
190
+ {
191
+ justifyContent: 'flex-end',
192
+ position: 'absolute',
193
+ zIndex: 2,
194
+ },
195
+ heightStyle,
196
+ ]}
197
+ >
207
198
  <Animated.View
208
199
  style={[{ marginVertical: Spacing.S }, searchTranslateStyle]}
209
200
  >
@@ -213,7 +204,6 @@ const HeaderExtendHeader: React.FC<{
213
204
  <InputSearch
214
205
  {...inputSearchProps}
215
206
  ref={inputSearchRef}
216
- size={searchSize}
217
207
  backgroundColor={'transparent'}
218
208
  showButtonText={false}
219
209
  />
@@ -226,9 +216,7 @@ const HeaderExtendHeader: React.FC<{
226
216
 
227
217
  if (headerType === 'extended') {
228
218
  return (
229
- <View
230
- style={[styles.container, showBaseLineDebug && styles.debugBaseLine]}
231
- >
219
+ <View style={[{ zIndex: 0 }, showBaseLineDebug && styles.debugBaseLine]}>
232
220
  <BackgroundImageView
233
221
  useShadowHeader={useShadowHeader}
234
222
  heightHeader={heightHeader}
@@ -249,10 +237,7 @@ const HeaderExtendHeader: React.FC<{
249
237
  >
250
238
  {!!headerBackground && (
251
239
  <Image
252
- style={[
253
- styles.headerBackground,
254
- headerLayout.isWide && styles.phoneHeight,
255
- ]}
240
+ style={styles.headerBackground}
256
241
  source={{ uri: headerBackground }}
257
242
  loading={false}
258
243
  />
@@ -280,11 +265,6 @@ const styles = StyleSheet.create({
280
265
  position: 'absolute',
281
266
  width: '100%',
282
267
  },
283
- // wide windows keep the phone gradient height instead of scaling with the width
284
- phoneHeight: {
285
- aspectRatio: undefined,
286
- height: HeaderBarMetrics.gradientHeight,
287
- },
288
268
  fillHeaderBox: {
289
269
  aspectRatio: undefined,
290
270
  height: '100%',
@@ -294,15 +274,15 @@ const styles = StyleSheet.create({
294
274
  position: 'absolute',
295
275
  overflow: 'hidden',
296
276
  },
297
- debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
298
- container: {
299
- zIndex: 0,
300
- },
301
- searchContainer: {
302
- justifyContent: 'flex-end',
277
+ verifiedDot: {
278
+ width: 4,
279
+ height: 4,
280
+ borderRadius: 2,
281
+ backgroundColor: Colors.green_03,
303
282
  position: 'absolute',
304
- zIndex: 2,
283
+ alignSelf: 'center',
305
284
  },
285
+ debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
306
286
  });
307
287
 
308
288
  export { HeaderExtendHeader };
@@ -6,13 +6,11 @@ import { PopupNotify } from '../../Popup';
6
6
  import { NavigationButton } from './NavigationButton';
7
7
  import { SideBarButton } from './SideBarButton';
8
8
  import Animated from 'react-native-reanimated';
9
- import { useSideBarItemStyle } from '../../Layout/utils';
9
+ import { useScreenLayout, useSideBarItemStyle } from '../../Layout/utils';
10
10
  import { useSideBarCounterStyle } from './DuoQuickReturnHeader';
11
- import { HeaderBarMetrics } from '../headerLayout';
12
11
 
13
12
  /**
14
- * Header back button, also bound to the Android hardware back. `preventBack`
15
- * confirms in a popup first; the iPhone Duo side bar uses the 48pt side bar button.
13
+ * default header left used for nav
16
14
  */
17
15
  const HeaderLeft: React.FC<HeaderBackProps> = ({
18
16
  tintColor,
@@ -25,6 +23,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
25
23
  const { navigator } = useContext(ApplicationContext);
26
24
  const sideBarStyle = useSideBarItemStyle('left', 0);
27
25
  const counterStyle = useSideBarCounterStyle();
26
+ const { statusBarClearance } = useScreenLayout();
28
27
 
29
28
  const goBack = useCallback(() => {
30
29
  const canGoBack = navigator?.ref?.current?.canGoBack?.();
@@ -97,6 +96,20 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
97
96
  );
98
97
  }
99
98
 
99
+ // on the status bar row the controls keep the side bar size
100
+ if (statusBarClearance) {
101
+ return (
102
+ <View style={styles.headerLeft}>
103
+ <SideBarButton
104
+ accessibilityLabel="btn_navigation_back"
105
+ icon="arrow-back"
106
+ tintColor={tintColor}
107
+ onPress={goBackSafe}
108
+ />
109
+ </View>
110
+ );
111
+ }
112
+
100
113
  return (
101
114
  <View style={styles.headerLeft}>
102
115
  <NavigationButton
@@ -111,7 +124,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
111
124
 
112
125
  const styles = StyleSheet.create({
113
126
  headerLeft: {
114
- marginLeft: HeaderBarMetrics.sidePadding,
127
+ marginLeft: 12,
115
128
  },
116
129
  });
117
130