@momo-kits/native-kits 0.168.1-beta.32 → 0.168.1-beta.33-debug
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/CLAUDE.md +1 -0
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +198 -0
- package/compose/build.gradle.kts.backup +198 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +20 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +153 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +62 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1071 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +81 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +357 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +542 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +49 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +231 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +189 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +478 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +265 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +235 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +223 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +265 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +185 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +370 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +308 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +330 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +220 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +560 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +125 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +501 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +236 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +194 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +287 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +321 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +502 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +148 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +116 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +205 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +422 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +732 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +148 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +232 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +237 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +97 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoLiquidSelection.kt +380 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +436 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +455 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +105 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +399 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +192 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +127 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +91 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +74 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +20 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +118 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +218 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +48 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +138 -0
- package/gradle/libs.versions.toml +69 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +26 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/Input/Input.swift +3 -1
- package/ios/Input/InputTextArea.swift +3 -1
- package/ios/Navigation/BottomTab/BottomTab.swift +67 -48
- package/ios/Navigation/BottomTab/BottomTabBar.swift +131 -281
- package/ios/Navigation/BottomTab/CurvedContainer.swift +47 -51
- package/ios/Navigation/BottomTab/DuoLiquidSelection.swift +364 -0
- package/ios/Navigation/BottomTab/DuoTabBar.swift +292 -72
- package/ios/Navigation/Component/HeaderRight.swift +1 -1
- package/ios/Navigation/StackScreen.swift +1 -3
- package/ios-demo/README.md +120 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +59 -272
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +90 -0
- package/package.json +1 -1
- package/settings.gradle.kts +64 -0
- package/ios/Navigation/BottomTab/TabBarMetrics.swift +0 -88
- package/ios-demo/Resources/tabbar_scan_qr_button.json +0 -1
- package/ios-demo/Resources/tabbar_scan_qr_label.json +0 -1
|
@@ -2,294 +2,77 @@
|
|
|
2
2
|
// BottomTabDemo.swift
|
|
3
3
|
// Example
|
|
4
4
|
//
|
|
5
|
-
// Usage demo for the bottom-tab navigation
|
|
6
|
-
//
|
|
7
|
-
//
|
|
5
|
+
// Usage demo for the bottom-tab navigation. Mirrors Compose's `BottomTabUsage`:
|
|
6
|
+
// four tabs (each with its own header title + badge) and a center floating
|
|
7
|
+
// button. Must be hosted inside a `NavigationContainer` (uses the Navigator).
|
|
8
8
|
//
|
|
9
9
|
|
|
10
|
-
import Lottie
|
|
11
10
|
import MoMoUIKits
|
|
12
11
|
import SwiftUI
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
let name: String
|
|
16
|
-
var label: String
|
|
17
|
-
var icon: String
|
|
18
|
-
// nil = no badge, "" = dot, "0" = hidden, numbers > 99 = 99+, text = text badge
|
|
19
|
-
var badgeLabel: String?
|
|
20
|
-
var showDot = false
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
private struct DemoConfig: Hashable {
|
|
24
|
-
var tabs: [TabConfig] = [
|
|
25
|
-
TabConfig(name: "Momo", label: "Momo", icon: "home_momo_active"),
|
|
26
|
-
TabConfig(name: "UuDai", label: "Ưu đãi", icon: "home_promotions_active", badgeLabel: "Mới"),
|
|
27
|
-
TabConfig(name: "GiaoDich", label: "Giao dịch", icon: "home_history_active", badgeLabel: "5"),
|
|
28
|
-
TabConfig(name: "Toi", label: "Tôi", icon: "home_friends_active", badgeLabel: ""),
|
|
29
|
-
TabConfig(name: "Vi", label: "Ví", icon: "home_wallet_inactive", badgeLabel: "1999"),
|
|
30
|
-
]
|
|
31
|
-
var tabCount = 4
|
|
32
|
-
var longLabels = false
|
|
33
|
-
var special = true
|
|
34
|
-
var ctaLabel = "Quét mọi QR"
|
|
35
|
-
var ctaIcon = "momomain_scan_code"
|
|
36
|
-
// the Home Lottie, split into its button and label parts, instead of icon and label
|
|
37
|
-
var ctaLottie = false
|
|
38
|
-
var initialRouteName = "Momo"
|
|
39
|
-
var compressionBehavior: DuoBarCompressionBehavior = .toolbar
|
|
40
|
-
var backToInitialTab = true
|
|
41
|
-
|
|
42
|
-
var visibleTabs: [TabConfig] { Array(tabs.prefix(tabCount)) }
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
private let icons = [
|
|
46
|
-
"home_momo_active", "home_promotions_active", "home_history_active", "home_friends_active",
|
|
47
|
-
"home_wallet_inactive", "notifications_bell", "basic_setting",
|
|
48
|
-
]
|
|
49
|
-
private let ctaIcons = ["momomain_scan_code", "navigation_scan", "navigation_qrcode"]
|
|
50
|
-
// The Home "Quét mọi QR" animation in two files on a 160 canvas: pink circle 100 centered at y 70, label
|
|
51
|
-
// centered at y 138. At 77 the circle is the 48 button; the button part moves down 5 onto the button center,
|
|
52
|
-
// the label part up 28 onto the label line.
|
|
53
|
-
private let ctaLottieSize: CGFloat = 77
|
|
54
|
-
private let ctaLottieButtonOffset: CGFloat = 5
|
|
55
|
-
private let ctaLottieLabelOffset: CGFloat = 28
|
|
56
|
-
|
|
57
|
-
/// A Lottie bundled with the demo: in the app bundle (sample iosApp) or the demo pod's resource bundle.
|
|
58
|
-
private func demoLottie(_ name: String) -> LottieAnimation? {
|
|
59
|
-
let podBundle = Bundle.main.url(forResource: "MoMoUIKitsDemoResources", withExtension: "bundle").flatMap(Bundle.init(url:))
|
|
60
|
-
return LottieAnimation.named(name, bundle: .main) ?? podBundle.flatMap { LottieAnimation.named(name, bundle: $0) }
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private let ctaLottieButton = demoLottie("tabbar_scan_qr_button")
|
|
64
|
-
private let ctaLottieLabel = demoLottie("tabbar_scan_qr_label")
|
|
65
|
-
|
|
66
|
-
// both parts read their progress from the same clock, two playing views start at different times
|
|
67
|
-
private func ctaLottie(_ animation: LottieAnimation?, offset: CGFloat) -> some View {
|
|
68
|
-
TimelineView(.animation) { timeline in
|
|
69
|
-
let duration = animation?.duration ?? 1
|
|
70
|
-
let elapsed = timeline.date.timeIntervalSinceReferenceDate
|
|
71
|
-
LottieView(animation: animation)
|
|
72
|
-
.currentProgress(elapsed.truncatingRemainder(dividingBy: duration) / duration)
|
|
73
|
-
.resizable()
|
|
74
|
-
.frame(width: ctaLottieSize, height: ctaLottieSize)
|
|
75
|
-
.offset(y: offset)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
private let badges: [(String, String?)] = [
|
|
79
|
-
("Không", nil), ("Dot \"\"", ""), ("\"0\"", "0"), ("\"5\"", "5"),
|
|
80
|
-
("\"1999\"", "1999"), ("\"Mới\"", "Mới"), ("Chữ dài", "Khuyến mãi lớn"),
|
|
81
|
-
]
|
|
82
|
-
|
|
13
|
+
@available(iOS 16.0, *)
|
|
83
14
|
struct BottomTabDemoContent: View {
|
|
84
|
-
@
|
|
85
|
-
// the bar is rebuilt on every change: reopen it on the tab the user is on
|
|
86
|
-
@State private var focused = DemoConfig().initialRouteName
|
|
15
|
+
@EnvironmentObject private var navigator: Navigator
|
|
87
16
|
|
|
88
17
|
var body: some View {
|
|
89
|
-
let tabs = config.visibleTabs
|
|
90
|
-
let initial = tabs.contains { $0.name == focused } ? focused : tabs[0].name
|
|
91
18
|
BottomTab(
|
|
92
|
-
items:
|
|
19
|
+
items: [
|
|
20
|
+
BottomTabItem(
|
|
21
|
+
name: "Tab1",
|
|
22
|
+
label: "Option 1",
|
|
23
|
+
icon: "16_basic_home",
|
|
24
|
+
badgeLabel: "",
|
|
25
|
+
options: NavigationOptions(headerTitle: .default("Option 1"), hiddenBack: false),
|
|
26
|
+
screen: { tabBody("Option 1", Colors.blue09) }
|
|
27
|
+
),
|
|
93
28
|
BottomTabItem(
|
|
94
|
-
name:
|
|
95
|
-
label:
|
|
96
|
-
icon:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
29
|
+
name: "Tab2",
|
|
30
|
+
label: "Option 2",
|
|
31
|
+
icon: "help_center",
|
|
32
|
+
badgeLabel: "0", // hidden (mirrors Compose's "0" → no badge)
|
|
33
|
+
options: NavigationOptions(headerTitle: .default("Option 2")),
|
|
34
|
+
screen: { tabBody("Option 2", Colors.pink09) }
|
|
35
|
+
),
|
|
36
|
+
BottomTabItem(
|
|
37
|
+
name: "Tab3",
|
|
38
|
+
label: "Option 3 with a very long label",
|
|
39
|
+
icon: "pin_star",
|
|
40
|
+
badgeLabel: "New",
|
|
41
|
+
options: NavigationOptions(headerTitle: .default("Option 3")),
|
|
42
|
+
screen: { tabBody("Option 3", Colors.yellow09) }
|
|
43
|
+
),
|
|
44
|
+
BottomTabItem(
|
|
45
|
+
name: "Tab4",
|
|
46
|
+
label: "Option 4 also quite long here",
|
|
47
|
+
icon: "navigation_more_icon",
|
|
48
|
+
badgeLabel: "9999",
|
|
49
|
+
options: NavigationOptions(headerTitle: .default("Option 4")),
|
|
50
|
+
screen: { tabBody("Option 4", Colors.blue10) }
|
|
101
51
|
)
|
|
102
|
-
|
|
103
|
-
floatingButton:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
switchTab()
|
|
109
|
-
},
|
|
110
|
-
backToInitialTab: config.backToInitialTab
|
|
52
|
+
],
|
|
53
|
+
floatingButton: BottomTabFloatingButton(
|
|
54
|
+
icon: "16_basic_home",
|
|
55
|
+
label: "Quét QR",
|
|
56
|
+
onPress: { navigator.push({ qrScreen }, options: NavigationOptions(title: "QR")) }
|
|
57
|
+
)
|
|
111
58
|
)
|
|
112
|
-
.id(config)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
private var floatingButton: BottomTabFloatingButton? {
|
|
116
|
-
guard config.special else { return nil }
|
|
117
|
-
guard config.ctaLottie else {
|
|
118
|
-
return BottomTabFloatingButton(icon: config.ctaIcon, label: config.ctaLabel, onPress: {})
|
|
119
|
-
}
|
|
120
|
-
return BottomTabFloatingButton(
|
|
121
|
-
label: config.ctaLabel,
|
|
122
|
-
onPress: {},
|
|
123
|
-
iconContent: { ctaLottie(ctaLottieButton, offset: ctaLottieButtonOffset) },
|
|
124
|
-
labelContent: { ctaLottie(ctaLottieLabel, offset: -ctaLottieLabelOffset) }
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/// Content of every tab: this tab's own props, the bar props, then the center action. The tab's
|
|
130
|
-
/// StackScreen scrolls it under the floating bar and keeps its end clear of it.
|
|
131
|
-
private struct TabContent: View {
|
|
132
|
-
let name: String
|
|
133
|
-
@Binding var config: DemoConfig
|
|
134
|
-
@Binding var focused: String
|
|
135
|
-
|
|
136
|
-
private var tab: TabConfig { config.tabs.first { $0.name == name }! }
|
|
137
|
-
|
|
138
|
-
private func updateTab(_ change: (inout TabConfig) -> Void) {
|
|
139
|
-
guard let index = config.tabs.firstIndex(where: { $0.name == name }) else { return }
|
|
140
|
-
change(&config.tabs[index])
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
private func yesNo(_ value: Bool, _ onChange: @escaping (Bool) -> Void) -> [Option] {
|
|
144
|
-
[Option(title: "Có", selected: value) { onChange(true) },
|
|
145
|
-
Option(title: "Không", selected: !value) { onChange(false) }]
|
|
146
59
|
}
|
|
147
60
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
VStack
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
Section(title: "Tab đang mở · \(name)") {
|
|
155
|
-
IconOptions(title: "icon", icons: icons, value: tab.icon) { icon in updateTab { $0.icon = icon } }
|
|
156
|
-
Options(title: "badgeLabel",
|
|
157
|
-
hint: "\"\" là dot, \"0\" ẩn badge, số > 99 hiện 99+, chữ dài bị cắt ở 58",
|
|
158
|
-
options: badges.map { title, value in
|
|
159
|
-
Option(title: title, selected: tab.badgeLabel == value) { updateTab { $0.badgeLabel = value } }
|
|
160
|
-
})
|
|
161
|
-
Options(title: "showDot",
|
|
162
|
-
hint: "Hiện dot khi không có badgeLabel hoặc badgeLabel là \"0\"",
|
|
163
|
-
options: yesNo(tab.showDot) { value in updateTab { $0.showDot = value } })
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
Section(title: "Thanh tab") {
|
|
167
|
-
Options(title: "Số tab (items)", options: (2...5).map { count in
|
|
168
|
-
Option(title: "\(count)", selected: config.tabCount == count) { config.tabCount = count }
|
|
169
|
-
})
|
|
170
|
-
Options(title: "label", options: [
|
|
171
|
-
Option(title: "Ngắn", selected: !config.longLabels) { config.longLabels = false },
|
|
172
|
-
Option(title: "Dài", selected: config.longLabels) { config.longLabels = true },
|
|
173
|
-
])
|
|
174
|
-
Options(title: "initialRouteName", hint: "Tab được chọn khi BottomTab mở",
|
|
175
|
-
options: config.visibleTabs.map { item in
|
|
176
|
-
Option(title: item.name, selected: config.initialRouteName == item.name) {
|
|
177
|
-
focused = item.name
|
|
178
|
-
config.initialRouteName = item.name
|
|
179
|
-
}
|
|
180
|
-
})
|
|
181
|
-
Options(title: "compressionBehavior",
|
|
182
|
-
hint: "iPhone Duo: bar nào thu gọn trước khi side bar không đủ chỗ",
|
|
183
|
-
options: [
|
|
184
|
-
Option(title: "toolbar", selected: config.compressionBehavior == .toolbar) {
|
|
185
|
-
config.compressionBehavior = .toolbar
|
|
186
|
-
},
|
|
187
|
-
Option(title: "tabBar", selected: config.compressionBehavior == .tabBar) {
|
|
188
|
-
config.compressionBehavior = .tabBar
|
|
189
|
-
},
|
|
190
|
-
])
|
|
191
|
-
Options(title: "backToInitialTab", hint: "Back ở tab khác quay về tab đầu trước khi rời màn",
|
|
192
|
-
options: yesNo(config.backToInitialTab) { config.backToInitialTab = $0 })
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
Section(title: "Nút giữa (floatingButton)") {
|
|
196
|
-
Options(title: "floatingButton",
|
|
197
|
-
hint: ctaHidden
|
|
198
|
-
? "Đang ẩn: nút giữa chỉ hiện khi có 2 hoặc 4 tab"
|
|
199
|
-
: "Có = Special (nút giữa trong notch), Không = Default",
|
|
200
|
-
options: yesNo(config.special) { config.special = $0 })
|
|
201
|
-
if config.special {
|
|
202
|
-
Options(title: "label", options: ["Quét mọi QR", "Quét mã thanh toán"].map { label in
|
|
203
|
-
Option(title: label, selected: config.ctaLabel == label) { config.ctaLabel = label }
|
|
204
|
-
})
|
|
205
|
-
Options(title: "icon dạng", hint: "Lottie: animation Quét mọi QR của Home, 2 phần nút và chữ", options: [
|
|
206
|
-
Option(title: "Icon", selected: !config.ctaLottie) { config.ctaLottie = false },
|
|
207
|
-
Option(title: "Lottie", selected: config.ctaLottie) { config.ctaLottie = true },
|
|
208
|
-
])
|
|
209
|
-
if !config.ctaLottie {
|
|
210
|
-
IconOptions(title: "icon", icons: ctaIcons, value: config.ctaIcon) { config.ctaIcon = $0 }
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
MoMoUIKits.Button(title: "Khôi phục mặc định", action: { config = DemoConfig() }, type: .outline)
|
|
216
|
-
}
|
|
217
|
-
.padding(Spacing.M)
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
private struct Option: Identifiable {
|
|
222
|
-
var id: String { title }
|
|
223
|
-
let title: String
|
|
224
|
-
let selected: Bool
|
|
225
|
-
let onPress: () -> Void
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
private struct Section<Content: View>: View {
|
|
229
|
-
let title: String
|
|
230
|
-
@ViewBuilder let content: () -> Content
|
|
231
|
-
|
|
232
|
-
@Environment(\.appTheme) private var theme
|
|
233
|
-
|
|
234
|
-
var body: some View {
|
|
235
|
-
VStack(alignment: .leading, spacing: Spacing.M) {
|
|
236
|
-
MomoText(title, typography: .headerSSemibold)
|
|
237
|
-
content()
|
|
61
|
+
@ViewBuilder
|
|
62
|
+
private func tabBody(_ title: String, _ color: Color) -> some View {
|
|
63
|
+
VStack {
|
|
64
|
+
MomoText(title, typography: .headerDefaultBold)
|
|
65
|
+
.padding(.top, 24)
|
|
66
|
+
Spacer()
|
|
238
67
|
}
|
|
239
|
-
.
|
|
240
|
-
.
|
|
241
|
-
.background(RoundedRectangle(cornerRadius: Radius.M).fill(theme.colors.background.surface))
|
|
68
|
+
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
69
|
+
.background(color)
|
|
242
70
|
}
|
|
243
|
-
}
|
|
244
71
|
|
|
245
|
-
private
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
var body: some View {
|
|
251
|
-
VStack(alignment: .leading, spacing: Spacing.XS) {
|
|
252
|
-
MomoText(title, typography: .labelDefaultMedium)
|
|
253
|
-
if let hint {
|
|
254
|
-
MomoText(hint, typography: .descriptionXsRegular)
|
|
255
|
-
}
|
|
256
|
-
LazyVGrid(columns: [GridItem(.adaptive(minimum: 88), spacing: Spacing.S, alignment: .leading)],
|
|
257
|
-
alignment: .leading, spacing: Spacing.S) {
|
|
258
|
-
ForEach(options) { option in
|
|
259
|
-
MoMoUIKits.Button(title: option.title, action: option.onPress,
|
|
260
|
-
type: option.selected ? .primary : .outline, size: .small, isFull: false)
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
private struct IconOptions: View {
|
|
268
|
-
let title: String
|
|
269
|
-
let icons: [String]
|
|
270
|
-
let value: String
|
|
271
|
-
let onChange: (String) -> Void
|
|
272
|
-
|
|
273
|
-
@Environment(\.appTheme) private var theme
|
|
274
|
-
|
|
275
|
-
var body: some View {
|
|
276
|
-
VStack(alignment: .leading, spacing: Spacing.XS) {
|
|
277
|
-
MomoText(title, typography: .labelDefaultMedium)
|
|
278
|
-
HStack(spacing: Spacing.S) {
|
|
279
|
-
ForEach(icons, id: \.self) { icon in
|
|
280
|
-
let selected = icon == value
|
|
281
|
-
SwiftUI.Button { onChange(icon) } label: {
|
|
282
|
-
Icon(source: icon, size: 24, color: selected ? theme.colors.primary : theme.colors.text.default)
|
|
283
|
-
.frame(width: 40, height: 40)
|
|
284
|
-
.overlay(
|
|
285
|
-
RoundedRectangle(cornerRadius: Radius.S)
|
|
286
|
-
.stroke(selected ? theme.colors.primary : theme.colors.border.default, lineWidth: 1)
|
|
287
|
-
)
|
|
288
|
-
}
|
|
289
|
-
.buttonStyle(.plain)
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
72
|
+
private var qrScreen: some View {
|
|
73
|
+
VStack { MomoText("QR scanner placeholder") }
|
|
74
|
+
.frame(maxWidth: .infinity)
|
|
75
|
+
.padding(24)
|
|
293
76
|
}
|
|
294
77
|
}
|
|
295
78
|
|
|
@@ -297,6 +80,10 @@ private struct IconOptions: View {
|
|
|
297
80
|
|
|
298
81
|
struct BottomTabDemo: View {
|
|
299
82
|
var body: some View {
|
|
300
|
-
|
|
83
|
+
if #available(iOS 16.0, *) {
|
|
84
|
+
BottomTabDemoContent()
|
|
85
|
+
} else {
|
|
86
|
+
Text("Bottom tab demo requires iOS 16+").padding()
|
|
87
|
+
}
|
|
301
88
|
}
|
|
302
89
|
}
|
|
@@ -202,6 +202,13 @@ private struct NavigationDemoContent: View {
|
|
|
202
202
|
)
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
row("Header Types") {
|
|
206
|
+
navigator.push(
|
|
207
|
+
{ HeaderTypesScreen() },
|
|
208
|
+
options: NavigationOptions(title: "Header Types")
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
|
|
205
212
|
row("Bottom Tabs") {
|
|
206
213
|
navigator.push(
|
|
207
214
|
{ BottomTabDemoContent() },
|
|
@@ -253,6 +260,89 @@ private struct UpdateOptionsScreen: View {
|
|
|
253
260
|
}
|
|
254
261
|
}
|
|
255
262
|
|
|
263
|
+
/// Header options switched at runtime (Compose `HeaderTypeUsage`).
|
|
264
|
+
@available(iOS 16.0, *)
|
|
265
|
+
private struct HeaderTypesScreen: View {
|
|
266
|
+
private enum Kind: String, CaseIterable {
|
|
267
|
+
case none = "None", `default` = "Default", extended = "Extended", transparent = "Transparent"
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
@EnvironmentObject private var navigation: Navigation
|
|
271
|
+
@State private var kind: AnyHashable = Kind.default
|
|
272
|
+
@State private var titlePosition: AnyHashable = TitlePosition.left
|
|
273
|
+
@State private var showBack = true
|
|
274
|
+
@State private var showHeaderRight = true
|
|
275
|
+
@State private var isAnimated = false
|
|
276
|
+
@State private var isHeader = false
|
|
277
|
+
@State private var isFullScreenContent = false
|
|
278
|
+
@State private var searchText = ""
|
|
279
|
+
|
|
280
|
+
var body: some View {
|
|
281
|
+
VStack(alignment: .leading, spacing: Spacing.M) {
|
|
282
|
+
ForEach(Kind.allCases, id: \.self) { item in
|
|
283
|
+
Radio(value: item, groupValue: $kind, onChange: applyHeader, label: item.rawValue)
|
|
284
|
+
}
|
|
285
|
+
Divider()
|
|
286
|
+
MomoText("Title Position")
|
|
287
|
+
ForEach([TitlePosition.left, TitlePosition.center], id: \.self) { position in
|
|
288
|
+
Radio(value: position, groupValue: $titlePosition, onChange: {
|
|
289
|
+
navigation.setOptions { $0.titlePosition = position }
|
|
290
|
+
}, label: position == .left ? "LEFT" : "CENTER")
|
|
291
|
+
}
|
|
292
|
+
Divider()
|
|
293
|
+
Checkbox($showBack, onChange: { checked in
|
|
294
|
+
navigation.setOptions { $0.hiddenBack = !checked }
|
|
295
|
+
}, title: "Show Back")
|
|
296
|
+
Checkbox($showHeaderRight, onChange: { checked in
|
|
297
|
+
navigation.setOptions {
|
|
298
|
+
$0.headerRightData = checked ? HeaderRightData() : nil
|
|
299
|
+
$0.headerRight = nil
|
|
300
|
+
}
|
|
301
|
+
}, title: "Show Header Right")
|
|
302
|
+
Divider()
|
|
303
|
+
Checkbox($isAnimated, onChange: { checked in
|
|
304
|
+
if checked { isHeader = false }
|
|
305
|
+
applyHeader()
|
|
306
|
+
}, title: "Search Animated")
|
|
307
|
+
Checkbox($isHeader, onChange: { checked in
|
|
308
|
+
if checked { isAnimated = false }
|
|
309
|
+
applyHeader()
|
|
310
|
+
}, title: "Search Header")
|
|
311
|
+
if kind == AnyHashable(Kind.transparent) {
|
|
312
|
+
Checkbox($isFullScreenContent, onChange: { _ in applyHeader() }, title: "Is Full Screen Content")
|
|
313
|
+
}
|
|
314
|
+
Color.clear.frame(height: 1600)
|
|
315
|
+
}
|
|
316
|
+
.padding(Spacing.M)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
private func applyHeader() {
|
|
320
|
+
let selected = kind.base as? Kind ?? .default
|
|
321
|
+
var search: InputSearchProps?
|
|
322
|
+
if isAnimated {
|
|
323
|
+
search = InputSearchProps(text: $searchText, placeholder: "Search input")
|
|
324
|
+
} else if isHeader {
|
|
325
|
+
search = InputSearchProps(text: $searchText, buttonText: "Huỷ", showButtonText: true, placeholder: "Search input")
|
|
326
|
+
}
|
|
327
|
+
navigation.setOptions {
|
|
328
|
+
switch selected {
|
|
329
|
+
case .none:
|
|
330
|
+
$0.headerType = .none
|
|
331
|
+
case .default, .extended:
|
|
332
|
+
$0.headerType = selected == .default ? .default : .extended
|
|
333
|
+
$0.useAnimated = isAnimated
|
|
334
|
+
$0.inputSearchProps = search
|
|
335
|
+
case .transparent:
|
|
336
|
+
$0.headerType = .default
|
|
337
|
+
$0.useAnimated = false
|
|
338
|
+
$0.inputSearchProps = nil
|
|
339
|
+
}
|
|
340
|
+
$0.headerTransparent = selected == .transparent
|
|
341
|
+
$0.fullScreenContent = selected == .transparent && isFullScreenContent
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
256
346
|
@available(iOS 16.0, *)
|
|
257
347
|
private struct DemoLeafScreen: View {
|
|
258
348
|
@EnvironmentObject private var navigator: Navigator
|
package/package.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import org.gradle.kotlin.dsl.maven
|
|
2
|
+
|
|
3
|
+
rootProject.name = "momo-native-kits"
|
|
4
|
+
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
|
5
|
+
|
|
6
|
+
pluginManagement {
|
|
7
|
+
repositories {
|
|
8
|
+
google {
|
|
9
|
+
mavenContent {
|
|
10
|
+
includeGroupAndSubgroups("androidx")
|
|
11
|
+
includeGroupAndSubgroups("com.android")
|
|
12
|
+
includeGroupAndSubgroups("com.google")
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
mavenCentral()
|
|
16
|
+
gradlePluginPortal()
|
|
17
|
+
maven {
|
|
18
|
+
url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
|
|
19
|
+
credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
|
|
20
|
+
}
|
|
21
|
+
maven {
|
|
22
|
+
url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
|
|
23
|
+
credentials {
|
|
24
|
+
username = "viewer"
|
|
25
|
+
password = "viewer"
|
|
26
|
+
}
|
|
27
|
+
isAllowInsecureProtocol = true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
dependencyResolutionManagement {
|
|
33
|
+
repositories {
|
|
34
|
+
google {
|
|
35
|
+
mavenContent {
|
|
36
|
+
includeGroupAndSubgroups("androidx")
|
|
37
|
+
includeGroupAndSubgroups("com.android")
|
|
38
|
+
includeGroupAndSubgroups("com.google")
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
mavenCentral()
|
|
42
|
+
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
|
|
43
|
+
maven {
|
|
44
|
+
url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
|
|
45
|
+
credentials {
|
|
46
|
+
username = "download_packages";
|
|
47
|
+
password = "gldt-bjDqLpU_sPcHDuXau2ws"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
maven {
|
|
51
|
+
url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
|
|
52
|
+
credentials {
|
|
53
|
+
username = "viewer"
|
|
54
|
+
password = "viewer"
|
|
55
|
+
}
|
|
56
|
+
isAllowInsecureProtocol = true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
include(":compose")
|
|
62
|
+
|
|
63
|
+
include(":sample:androidApp")
|
|
64
|
+
include(":sample:shared")
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// TabBarMetrics.swift
|
|
3
|
-
// MoMoUIKits
|
|
4
|
-
//
|
|
5
|
-
// Navigation bar measurements (Figma "Specs Navigation", DS-984), mirrored from Compose's
|
|
6
|
-
// `navigation/bottomtab/TabBarMetrics.kt` and RN `BottomTab/metrics.ts`.
|
|
7
|
-
// Horizontal: floating container with items split evenly, center action in a notch.
|
|
8
|
-
// Vertical: iPhone Duo rail, center action under the container.
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
import SwiftUI
|
|
12
|
-
|
|
13
|
-
enum TabBarMetrics {
|
|
14
|
-
static let height: CGFloat = 68
|
|
15
|
-
static let margin = Spacing.S
|
|
16
|
-
static let paddingVertical = Spacing.S
|
|
17
|
-
static let paddingHorizontal = Spacing.M
|
|
18
|
-
static let itemGap = Spacing.XS
|
|
19
|
-
static let iconSize: CGFloat = 24
|
|
20
|
-
static let indicatorHeight: CGFloat = 32
|
|
21
|
-
// active indicator behind the icon: 24 icon + XS·M padding
|
|
22
|
-
static let indicatorPaddingVertical = Spacing.XS
|
|
23
|
-
static let indicatorPaddingHorizontal = Spacing.M
|
|
24
|
-
static let indicatorRadius = Radius.XL
|
|
25
|
-
// home indicator / gesture bar area under the container
|
|
26
|
-
static let systemIndicatorHeight: CGFloat = 24
|
|
27
|
-
// unfolded foldables (short side from 600, the smallest in the spec) use 65% of the short side,
|
|
28
|
-
// centered; phones and folded outer displays fill the window
|
|
29
|
-
static let foldableMinShortSide: CGFloat = 600
|
|
30
|
-
static let foldableWidthRatio: CGFloat = 0.65
|
|
31
|
-
static let ctaSlotWidth: CGFloat = 92
|
|
32
|
-
static let ctaSize: CGFloat = 48
|
|
33
|
-
// the icon sits 10 inside the 48 button (prototype .cta: 28 icon), 12 inside the 52 rail one
|
|
34
|
-
static let ctaIconSize: CGFloat = 28
|
|
35
|
-
// the button rises 22 above the container top edge
|
|
36
|
-
static let ctaLift: CGFloat = 22
|
|
37
|
-
static let ctaLabelGap = Spacing.M
|
|
38
|
-
static let ctaLabelHeight: CGFloat = 18
|
|
39
|
-
// notch dipped into the container top edge under the center action (Figma "Backgroud" path):
|
|
40
|
-
// starts notchHalfWidth left of the center, then cubic segments of control1, control2, end,
|
|
41
|
-
// each point as (dx from the center, dy below the top edge)
|
|
42
|
-
static let notchHalfWidth: CGFloat = 50.758
|
|
43
|
-
static let notchCurves: [[CGPoint]] = [
|
|
44
|
-
[CGPoint(x: -39.749, y: 0), CGPoint(x: -31.231, y: 9.765), CGPoint(x: -24.563, y: 18.526)],
|
|
45
|
-
[CGPoint(x: -18.928, y: 25.93), CGPoint(x: -10.022, y: 30.709), CGPoint(x: 0, y: 30.709)],
|
|
46
|
-
[CGPoint(x: 10.022, y: 30.709), CGPoint(x: 18.928, y: 25.93), CGPoint(x: 24.563, y: 18.526)],
|
|
47
|
-
[CGPoint(x: 31.231, y: 9.765), CGPoint(x: 39.749, y: 0), CGPoint(x: notchHalfWidth, y: 0)],
|
|
48
|
-
]
|
|
49
|
-
static let railContainerWidth: CGFloat = 56
|
|
50
|
-
static let railPaddingHorizontal = Spacing.XS
|
|
51
|
-
static let railPaddingBottom = Spacing.S
|
|
52
|
-
static let railItemWidth: CGFloat = 48
|
|
53
|
-
static let railItemHeight: CGFloat = 62
|
|
54
|
-
static let railIndicatorHeight: CGFloat = 40
|
|
55
|
-
static let railIndicatorPaddingVertical = Spacing.S
|
|
56
|
-
static let railIndicatorRadius: CGFloat = 20
|
|
57
|
-
static let railCtaGap = Spacing.L
|
|
58
|
-
static let railCtaSize: CGFloat = 52
|
|
59
|
-
static let railCtaLabelGap = Spacing.XS
|
|
60
|
-
static let railCtaWidth: CGFloat = 68
|
|
61
|
-
static let railCtaHeight: CGFloat = 70
|
|
62
|
-
static let badgeMaxWidth: CGFloat = 58
|
|
63
|
-
|
|
64
|
-
// motion (MoMo Navigation Prototype): one active indicator slides to the selected item overshooting
|
|
65
|
-
// a little, icon and label tint cross-fade, the center action shrinks while held
|
|
66
|
-
static let indicatorMotion = Animation.timingCurve(0.34, 1.4, 0.5, 1, duration: 0.55)
|
|
67
|
-
static let tintMotion = Animation.easeInOut(duration: 0.25)
|
|
68
|
-
static let ctaPressMotion = Animation.easeOut(duration: 0.15)
|
|
69
|
-
static let ctaPressedScale: CGFloat = 0.92
|
|
70
|
-
|
|
71
|
-
/// Width of the horizontal bar: 65% of the short side on an unfolded foldable, otherwise the window
|
|
72
|
-
/// minus the side safe areas and margins.
|
|
73
|
-
static func horizontalBarWidth(_ layout: ScreenLayout) -> CGFloat {
|
|
74
|
-
let shortSide = min(layout.width, layout.height)
|
|
75
|
-
if shortSide >= foldableMinShortSide { return shortSide * foldableWidthRatio }
|
|
76
|
-
return layout.width - layout.insets.leading - layout.insets.trailing - 2 * margin
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/// Gap under the container: the home indicator area.
|
|
80
|
-
static func bottomGap(_ bottomInset: CGFloat) -> CGFloat {
|
|
81
|
-
max(min(bottomInset, systemIndicatorHeight), Spacing.S)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/// The center action needs a tab on each side: Special type takes 2 or 4 tabs.
|
|
85
|
-
static func hasCenterAction(_ floatingButton: BottomTabFloatingButton?, tabCount: Int) -> Bool {
|
|
86
|
-
floatingButton != nil && tabCount % 2 == 0
|
|
87
|
-
}
|
|
88
|
-
}
|