@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.
- package/Application/BottomSheet.tsx +398 -86
- package/Application/BottomTab/BottomTabBar.tsx +275 -215
- package/Application/BottomTab/CustomBottomTabItem.tsx +107 -131
- package/Application/BottomTab/DuoBarCompression.tsx +28 -14
- package/Application/BottomTab/DuoTabBar.tsx +540 -32
- package/Application/BottomTab/TabBarIcon.tsx +72 -146
- package/Application/BottomTab/index.tsx +353 -89
- package/Application/BottomTab/useLiquidSelection.ts +374 -0
- package/Application/Components/BackgroundImageView.tsx +0 -4
- package/Application/Components/DuoGlassBackground.tsx +5 -7
- package/Application/Components/HeaderAnimated.tsx +13 -41
- package/Application/Components/HeaderBackground.tsx +3 -20
- package/Application/Components/HeaderExtendHeader.tsx +46 -66
- package/Application/Components/HeaderLeft.tsx +18 -5
- package/Application/Components/HeaderRight.tsx +529 -8
- package/Application/Components/HeaderTitle.tsx +579 -16
- package/Application/Components/NavigationButton.tsx +11 -18
- package/Application/Components/SearchHeader.tsx +18 -38
- package/Application/Localize.ts +0 -7
- package/Application/ModalScreen.tsx +18 -41
- package/Application/Navigation.ts +17 -15
- package/Application/NavigationContainer.tsx +21 -23
- package/Application/Navigator.ts +48 -20
- package/Application/ScaleSizeProvider.tsx +6 -13
- package/Application/StackScreen.tsx +172 -27
- package/Application/TooltipPortal.tsx +5 -12
- package/Application/WidgetContainer.tsx +7 -20
- package/Application/device.ts +52 -0
- package/Application/index.ts +1 -23
- package/Application/types.ts +242 -17
- package/Application/utils.tsx +493 -0
- package/Badge/Badge.tsx +0 -5
- package/Badge/BadgeDot.tsx +0 -1
- package/Badge/BadgeDotAnimation.tsx +7 -15
- package/Badge/BadgeRibbon.tsx +39 -47
- package/Badge/Shape.tsx +0 -2
- package/Badge/styles.ts +0 -2
- package/Badge/types.ts +2 -2
- package/Button/index.tsx +152 -21
- package/Button/styles.ts +1 -1
- package/CheckBox/index.tsx +6 -5
- package/Consts/theme.ts +10 -10
- package/Context/index.ts +1 -5
- package/Divider/DashDivider.tsx +11 -11
- package/Divider/index.tsx +7 -21
- package/FoundationList/index.tsx +0 -4
- package/Icon/index.tsx +6 -6
- package/Icon/types.ts +1 -1
- package/IconButton/index.tsx +12 -4
- package/Image/index.tsx +7 -9
- package/Input/Input.tsx +12 -10
- package/Input/InputDropDown.tsx +13 -10
- package/Input/InputMoney.tsx +152 -45
- package/Input/InputOTP.tsx +34 -36
- package/Input/InputPhoneNumber.tsx +5 -8
- package/Input/InputSearch.tsx +111 -19
- package/Input/InputTextArea.tsx +5 -5
- package/Input/SystemTextInput.tsx +2 -7
- package/Input/TextTyping.tsx +0 -4
- package/Input/common.tsx +17 -31
- package/Input/index.tsx +21 -24
- package/Input/styles.ts +5 -25
- package/Input/utils.ts +12 -14
- package/Layout/Card.tsx +4 -7
- package/Layout/FloatingButton.tsx +21 -26
- package/Layout/Item.tsx +2 -6
- package/Layout/ItemList.tsx +7 -9
- package/Layout/ItemSectionList.tsx +1 -2
- package/Layout/ReservedRegions.tsx +17 -34
- package/Layout/Screen.tsx +696 -122
- package/Layout/Section.tsx +7 -9
- package/Layout/TrackingScope.tsx +0 -1
- package/Layout/index.ts +4 -10
- package/Layout/styles.ts +0 -2
- package/Layout/types.ts +4 -2
- package/Layout/utils.ts +181 -40
- package/Loader/DotLoader.tsx +3 -11
- package/Loader/Loader.tsx +0 -4
- package/Loader/ProgressBar.tsx +6 -3
- package/Loader/Spinner.tsx +3 -11
- package/Loader/styles.ts +0 -4
- package/Loader/utils.ts +7 -11
- package/Pagination/Dot.tsx +0 -4
- package/Pagination/PaginationDot.tsx +0 -1
- package/Pagination/PaginationNumber.tsx +3 -5
- package/Pagination/PaginationScroll.tsx +0 -5
- package/Pagination/PaginationWhiteDot.tsx +0 -1
- package/Pagination/index.tsx +0 -4
- package/Pagination/types.ts +2 -2
- package/Popup/PopupNotify.tsx +102 -94
- package/Popup/PopupPromotion.tsx +11 -9
- package/Popup/types.ts +4 -11
- package/Popup/utils.ts +18 -50
- package/Radio/index.tsx +10 -6
- package/Radio/styles.ts +0 -6
- package/Skeleton/index.tsx +9 -9
- package/Skeleton/styles.ts +0 -1
- package/Switch/index.tsx +0 -1
- package/Tag/index.tsx +4 -8
- package/Tag/types.ts +3 -3
- package/Text/index.tsx +5 -25
- package/Text/styles.ts +1 -1
- package/Text/types.ts +6 -1
- package/Text/utils.ts +4 -20
- package/Title/index.tsx +40 -42
- package/Title/styles.ts +0 -6
- package/ViewBoundary/index.tsx +2 -4
- package/index.ts +6 -0
- package/package.json +1 -2
- package/Application/BottomSheet.hooks.ts +0 -195
- package/Application/BottomSheet.parts.tsx +0 -157
- package/Application/BottomSheet.styles.ts +0 -43
- package/Application/BottomTab/ActiveIndicator.tsx +0 -91
- package/Application/BottomTab/BottomTabBar.styles.ts +0 -65
- package/Application/BottomTab/BottomTabInset.tsx +0 -18
- package/Application/BottomTab/CurvedContainer.tsx +0 -155
- package/Application/BottomTab/DuoRailTabBar.tsx +0 -223
- package/Application/BottomTab/DuoTabBar.styles.ts +0 -81
- package/Application/BottomTab/TabScreen.tsx +0 -160
- package/Application/BottomTab/metrics.ts +0 -164
- package/Application/BottomTab/tabItems.ts +0 -46
- package/Application/BottomTab/usePressLift.ts +0 -32
- package/Application/Components/HeaderRight.styles.ts +0 -146
- package/Application/Components/HeaderTitle.shared.ts +0 -44
- package/Application/Components/HeaderTitle.styles.ts +0 -125
- package/Application/Components/HeaderToolkitAction.tsx +0 -180
- package/Application/Components/SwipeBackHaptic.tsx +0 -95
- package/Application/Components/TitleJourney.tsx +0 -110
- package/Application/Components/TitleLocation.tsx +0 -73
- package/Application/Components/TitleUser.tsx +0 -304
- package/Application/Components/useToolkitActions.tsx +0 -218
- package/Application/ModalIconButton.tsx +0 -66
- package/Application/StackScreen.tracking.ts +0 -143
- package/Application/headerLayout.ts +0 -158
- package/Application/hooks.ts +0 -137
- package/Application/modalLayout.ts +0 -176
- package/Application/navigationOptions.tsx +0 -212
- package/Application/types.header.ts +0 -121
- package/Application/types.tabs.ts +0 -48
- package/Application/types.theme.ts +0 -87
- package/Application/utils.ts +0 -107
- package/Button/utils.ts +0 -133
- package/Input/InputMoneyView.tsx +0 -194
- package/Input/SearchTextTyping.tsx +0 -108
- package/Input/moneyUtils.ts +0 -23
- package/Layout/layoutMetrics.ts +0 -58
- package/Layout/layoutTypes.ts +0 -86
- package/Layout/screenContent.tsx +0 -92
- package/Layout/screenFooter.tsx +0 -63
- package/Layout/screenHeader.tsx +0 -321
- package/Layout/screenQuickReturn.tsx +0 -64
- package/Layout/screenScroll.ts +0 -107
- package/Layout/screenTypes.ts +0 -143
package/Application/types.ts
CHANGED
|
@@ -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 {
|
|
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
|
-
*
|
|
134
|
-
*
|
|
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
|
-
|
|
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
|
}
|