@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
@@ -1,19 +1,16 @@
1
+ import { EventArg } from '@react-navigation/core';
1
2
  import { StackNavigationOptions } from '@react-navigation/stack';
2
- import React from 'react';
3
- import { ViewStyle } from 'react-native';
3
+ import React, { ReactNode } from 'react';
4
+ import {
5
+ Animated,
6
+ TouchableOpacityProps,
7
+ ViewProps,
8
+ ViewStyle,
9
+ } from 'react-native';
10
+ import type { SharedValue } from 'react-native-reanimated';
4
11
  import { PopupNotifyProps } from '../Popup/types';
12
+ import { InputRef, InputSearchProps } from '../Input';
5
13
  import Navigation from './Navigation';
6
- import type {
7
- HeaderRightToolkit,
8
- HeaderTitleProps,
9
- OnBoarding,
10
- } from './types.header';
11
- import type { LocalizeProps, Theme } from './types.theme';
12
- import type { HeaderContentLayout } from './headerLayout';
13
-
14
- export * from './types.theme';
15
- export * from './types.header';
16
- export * from './types.tabs';
17
14
 
18
15
  export type NavigationProps = {
19
16
  context: any;
@@ -47,6 +44,105 @@ export type NavigatorProps = {
47
44
  }) => void;
48
45
  };
49
46
 
47
+ export type LocalizeProps = {
48
+ getCurrentLanguage: 'en' | 'vi';
49
+ getAssets: LocalizationObject;
50
+ translate: (key: string) => string;
51
+ translateData: (data: { vi: string; en: string }) => string;
52
+ addTranslations: (translations: LocalizationObject) => void;
53
+ };
54
+
55
+ export type Theme = {
56
+ dark: boolean;
57
+ colors: {
58
+ primary: string;
59
+ secondary: string;
60
+ gradient: string;
61
+ background: {
62
+ default: string;
63
+ surface: string;
64
+ tonal: string;
65
+ pressed: string;
66
+ selected: string;
67
+ disable: string;
68
+ };
69
+ text: {
70
+ default: string;
71
+ secondary: string;
72
+ hint: string;
73
+ disable: string;
74
+ };
75
+ border: {
76
+ default: string;
77
+ disable: string;
78
+ };
79
+ success: {
80
+ primary: string;
81
+ secondary: string;
82
+ container: string;
83
+ };
84
+ warning: {
85
+ primary: string;
86
+ secondary: string;
87
+ container: string;
88
+ };
89
+ error: {
90
+ primary: string;
91
+ secondary: string;
92
+ container: string;
93
+ };
94
+ highlight: {
95
+ primary: string;
96
+ secondary: string;
97
+ container: string;
98
+ };
99
+ interactive: {
100
+ primary: string;
101
+ secondary: string;
102
+ container: string;
103
+ };
104
+ };
105
+ font: string;
106
+ assets?: {
107
+ headerBackground?: string;
108
+ };
109
+ };
110
+
111
+ export type ScaleSizeProviderProps = {
112
+ scaleSizeMaxRate?: number;
113
+ children: ViewProps['children'];
114
+ };
115
+
116
+ export type Context = {
117
+ [key: string]: any;
118
+ theme: Theme;
119
+ navigator?: NavigatorProps;
120
+ translate?: (data: string | { vi: string; en: string }) => string;
121
+ };
122
+
123
+ export type LocalizationObject = {
124
+ vi: {
125
+ [key: string]: string;
126
+ };
127
+ en: {
128
+ [key: string]: string;
129
+ };
130
+ };
131
+
132
+ export type ToolGroup = {
133
+ title: { vi: string; en: string };
134
+ items: Tool[];
135
+ };
136
+
137
+ export type Tool = {
138
+ icon: string;
139
+ name: { vi: string; en: string };
140
+ key: string;
141
+ showBadge?: boolean;
142
+ showRightIcon?: boolean;
143
+ onPress: () => void;
144
+ };
145
+
50
146
  export type FeatureFlags = {
51
147
  enableFoundationList?: boolean;
52
148
  enableBottomTabAnimation?: boolean;
@@ -121,6 +217,19 @@ export type BottomSheetParams = {
121
217
  };
122
218
  };
123
219
 
220
+ export interface NavigationButtonProps extends TouchableOpacityProps {
221
+ icon: string;
222
+ tintColor?: string;
223
+ showBadge?: boolean;
224
+ }
225
+
226
+ export type HeaderTitleProps = {
227
+ type: 'default' | 'user' | 'location' | 'journey';
228
+ data: TitleUserProps | TitleLocationProps | TitleJourneyProps;
229
+ };
230
+
231
+ export type HeaderType = 'default' | 'extended' | 'none';
232
+
124
233
  export interface NavigationOptions
125
234
  extends Omit<StackNavigationOptions, 'headerRight' | 'headerTitle'> {
126
235
  preventBack?: PopupNotifyProps;
@@ -129,10 +238,126 @@ export interface NavigationOptions
129
238
  hiddenBack?: boolean;
130
239
  headerTitle?: HeaderTitleProps | string;
131
240
  headerRight?: OnBoarding | HeaderRightToolkit | any;
241
+ }
242
+
243
+ export type OnBoarding = {
244
+ useOnBoarding?: boolean;
245
+ onPress?: () => void;
246
+ };
247
+
248
+ export type HeaderRightToolkit = {
249
+ useShortcut?: boolean;
250
+ tools?: ToolGroup[];
251
+ preventClose?: PopupNotifyProps;
252
+ useMore?: boolean;
253
+ useCloseIcon?: boolean;
254
+ };
255
+
256
+ export interface HeaderBackProps extends NavigationButtonProps {
257
+ preventBack?: PopupNotifyProps;
258
+ onPressLeftHeader?: () => void;
259
+ onBackHandler?: (goBack: () => void) => void;
260
+ /**
261
+ * Optional. If `true`, the button floats into the iPhone Duo side bar while the
262
+ * device shows one. Set when the button is rendered by the navigation header.
263
+ */
264
+ floating?: boolean;
265
+ }
266
+
267
+ export type HeaderBackgroundProps = {
268
+ animatedValue?: Animated.Value | SharedValue<number>;
269
+ useGradient?: boolean;
270
+ useShadowHeader?: boolean;
271
+ backgroundColor?: string;
272
+ gradientColor?: string;
273
+ headerBackground?: string;
274
+ };
275
+
276
+ export type TitleUserProps = {
277
+ title: string;
278
+ subTitle?: string;
279
+ image?: string[] | string;
280
+ dotColor?: string;
281
+ verify?: boolean;
282
+ tintColor?: string;
283
+ onPress?: () => void;
284
+ icons?: string[];
285
+ isLoading?: boolean;
286
+ };
287
+
288
+ export type TitleLocationProps = {
289
+ description?: string;
290
+ location: string;
291
+ tintColor?: string;
292
+ onPress?: () => void;
293
+ isLoading?: boolean;
294
+ };
295
+
296
+ export type TitleJourneyProps = {
297
+ start: string;
298
+ end?: string;
299
+ description?: string;
300
+ icon: string;
301
+ iconColor?: string;
302
+ tintColor?: string;
303
+ onPress?: () => void;
304
+ isLoading?: boolean;
305
+ };
306
+
307
+ export interface HeaderAnimatedProps extends ViewProps {
308
+ animatedValue: Animated.Value | SharedValue<number>;
309
+ image: string;
310
+ useScale?: boolean;
311
+ aspectRatio?: '16/9' | '3/2' | '1/1';
312
+ }
313
+
314
+ export type BottomTabItemProps = {
315
+ name: string;
316
+ label: string;
317
+ icon: string;
318
+ showDot?: boolean;
319
+ badgeLabel?: string | number;
320
+ screen: React.ComponentType<NavigationScreenProps>;
321
+ options: NavigationOptions;
322
+ initialParams?: any;
323
+ };
324
+
325
+ export type BottomTabProps = {
326
+ nested?: boolean;
327
+ tabs: BottomTabItemProps[];
328
+ initialRouteName?: string;
329
+ navigation: NavigationProps;
330
+ listeners?: {
331
+ tabPress?: (e: EventArg<'tabPress', true, undefined>) => void;
332
+ focus?: (e: EventArg<'focus', false, unknown>) => void;
333
+ blur?: (e: EventArg<'blur', false, unknown>) => void;
334
+ };
335
+ floatingButton?: FloatingButtonProps;
132
336
  /**
133
- * Optional. `stretch` centers back, title and the right cluster in a 600pt
134
- * frame on wide windows (foldable inner display, tablet); the background stays
135
- * full width. Defaults to `grid`, the header row at the window edges.
337
+ * iPhone Duo: when the side bar can't hold both bars, which one starts compressed;
338
+ * tapping the compressed one swaps them. Defaults to 'toolbar'
136
339
  */
137
- contentLayout?: HeaderContentLayout;
340
+ compressionBehavior?: 'toolbar' | 'tabBar';
341
+ };
342
+
343
+ export type FloatingButtonProps = {
344
+ container?: React.ReactNode;
345
+ icon: string | React.ReactNode;
346
+ label: string;
347
+ onPress: () => void;
348
+ };
349
+
350
+ export type AnimatedHeader = {
351
+ headerTintColor?: string;
352
+ component?: (props?: any) => React.ReactElement;
353
+ headerTitle?: HeaderTitleProps | string;
354
+ };
355
+
356
+ export interface SearchHeaderProps extends InputSearchProps {
357
+ ref?: React.RefObject<InputRef>;
358
+ animatedValue?: Animated.Value | SharedValue<number>;
359
+ headerRightWidth?: 0 | 74 | 110 | number;
360
+ leftPosition?: 12 | 48 | number;
361
+ renderButtons?: () => ReactNode;
362
+ hiddenBack?: boolean;
138
363
  }