@momo-kits/native-kits 0.168.1-beta.4 → 0.168.1-beta.40-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 +15 -10
- package/README.md +2 -10
- 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 +154 -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 +195 -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 +363 -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/ModalLayout.kt +187 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +316 -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 +393 -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 +153 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +113 -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 +739 -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 +239 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +389 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +94 -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/DuoTabBar.kt +203 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +104 -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 +92 -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 +76 -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 +22 -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 +219 -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 +144 -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/Application/ApplicationEnvironment.swift +7 -6
- package/ios/Application/DesignSystemKits.swift +163 -0
- package/ios/Application/DesignSystemKitsPayload.swift +68 -0
- package/ios/Badge/BadgeRibbon.swift +8 -1
- package/ios/Extensions/Color++.swift +2 -4
- package/ios/Input/Input.swift +16 -4
- package/ios/Input/InputPhoneNumber.swift +1 -3
- package/ios/Input/InputSearch.swift +1 -2
- package/ios/Input/InputTextArea.swift +8 -4
- package/ios/InputMoney/InputMoney.swift +6 -7
- package/ios/Layout/ModalLayout.swift +152 -0
- package/ios/Layout/ScreenLayout.swift +77 -18
- package/ios/Navigation/BottomSheet.swift +56 -53
- package/ios/Navigation/BottomTab/BottomTab.swift +46 -52
- package/ios/Navigation/BottomTab/BottomTabBar.swift +281 -115
- package/ios/Navigation/BottomTab/CurvedContainer.swift +51 -47
- package/ios/Navigation/BottomTab/DuoBarCompression.swift +2 -3
- package/ios/Navigation/BottomTab/DuoTabBar.swift +64 -172
- package/ios/Navigation/BottomTab/TabBarMetrics.swift +84 -0
- package/ios/Navigation/Component/HeaderBackground.swift +22 -1
- package/ios/Navigation/Component/HeaderRight.swift +1 -1
- package/ios/Navigation/Component/SnackBar.swift +4 -0
- package/ios/Navigation/ModalScreen.swift +20 -5
- package/ios/Navigation/StackScreen.swift +6 -8
- package/ios/Popup/PopupDisplay.swift +6 -4
- package/ios/Popup/PopupInput.swift +6 -4
- package/ios/Popup/PopupLayout.swift +17 -11
- package/ios/Popup/PopupNotify.swift +32 -25
- package/ios/Stepper/Stepper.swift +1 -2
- package/ios/Template/TrustBanner/TrustBanner.swift +4 -2
- package/ios/Typography/FontScale.swift +29 -15
- package/ios/Typography/Text.swift +88 -14
- package/ios/Typography/Typography.swift +2 -2
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/README.md +120 -0
- package/ios-demo/Resources/tabbar_scan_qr_button.json +1 -0
- package/ios-demo/Resources/tabbar_scan_qr_label.json +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +272 -59
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +103 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +29 -1
- package/package.json +1 -1
- package/publish.sh +2 -33
- package/settings.gradle.kts +64 -0
- package/ios/Typography/FontScaleStore.swift +0 -58
- package/ios/Typography/KitDesignSystem.swift +0 -17
|
@@ -2,27 +2,13 @@
|
|
|
2
2
|
// DuoTabBar.swift
|
|
3
3
|
// MoMoUIKits
|
|
4
4
|
//
|
|
5
|
-
// iPhone Duo tab bar, port of RN `BottomTab/DuoTabBar.tsx` (Figma
|
|
6
|
-
// a
|
|
5
|
+
// iPhone Duo tab bar, port of RN `BottomTab/DuoTabBar.tsx` (Figma "Specs Navigation", DS-984):
|
|
6
|
+
// a rail in the side bar, or the horizontal bar at 65% of the short side when unfolded portrait.
|
|
7
7
|
//
|
|
8
8
|
|
|
9
9
|
import SwiftUI
|
|
10
10
|
|
|
11
|
-
private let
|
|
12
|
-
private let iconSize: CGFloat = 28
|
|
13
|
-
private let qrIconSize: CGFloat = 24
|
|
14
|
-
private let railPadding: CGFloat = 6
|
|
15
|
-
private let railGap = Spacing.XXS
|
|
16
|
-
// selection bubble overflows the 48 rail cell by 5 above and below (Figma MT2)
|
|
17
|
-
private let railBubbleWidth: CGFloat = 44
|
|
18
|
-
private let railBubbleHeight: CGFloat = 58
|
|
19
|
-
let duoFloatingTabBarHeight: CGFloat = 62
|
|
20
|
-
private let floatingPadding = Spacing.XS
|
|
21
|
-
private let floatingQrSize: CGFloat = 44
|
|
22
|
-
// floating bar spans 6 of the 8 portrait grid columns, like the content
|
|
23
|
-
private let gridColumns: CGFloat = 8
|
|
24
|
-
private let gridSpan: CGFloat = 6
|
|
25
|
-
private let tabSpring = Animation.interpolatingSpring(mass: 0.8, stiffness: 220, damping: 18)
|
|
11
|
+
private let compactSize = DuoMetrics.controlSize
|
|
26
12
|
|
|
27
13
|
/// Room tab screens leave for the Duo tab bar, provided by BottomTab to its tab StackScreens.
|
|
28
14
|
struct DuoTabBarInsets: Equatable {
|
|
@@ -43,58 +29,33 @@ extension EnvironmentValues {
|
|
|
43
29
|
}
|
|
44
30
|
}
|
|
45
31
|
|
|
46
|
-
/// Rail plus the
|
|
32
|
+
/// Rail container plus the center action under it; compressed, the rail is a single button.
|
|
47
33
|
func duoRailHeight(itemCount: Int, hasQr: Bool, compressed: Bool = false) -> CGFloat {
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
let rail = compressed
|
|
35
|
+
? compactSize
|
|
36
|
+
: CGFloat(itemCount) * TabBarMetrics.railItemHeight + TabBarMetrics.railPaddingBottom
|
|
37
|
+
return rail + (hasQr ? TabBarMetrics.railCtaGap + TabBarMetrics.railCtaHeight : 0)
|
|
51
38
|
}
|
|
52
39
|
|
|
53
40
|
extension ScreenLayout {
|
|
41
|
+
/// The horizontal bar sits above the home indicator area.
|
|
42
|
+
var duoFloatingTabBarBottom: CGFloat {
|
|
43
|
+
TabBarMetrics.bottomGap(insets.bottom)
|
|
44
|
+
}
|
|
45
|
+
|
|
54
46
|
func duoTabBarInsets(itemCount: Int, hasFloatingButton: Bool, tabBarCompressed: Bool = false) -> DuoTabBarInsets {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
// the horizontal bar floats over the content (phone and unfolded Duo); the overlay is measured
|
|
48
|
+
// from the bottom safe area, the bar reaches into it
|
|
49
|
+
guard isIPhoneDuo, let sideBar else {
|
|
50
|
+
// the center action's button rises above the bar, tab content leaves room for it too
|
|
51
|
+
let ctaLift = hasFloatingButton && itemCount % 2 == 0 ? TabBarMetrics.ctaLift : 0
|
|
52
|
+
return DuoTabBarInsets(overlay: TabBarMetrics.height + ctaLift + duoFloatingTabBarBottom - insets.bottom)
|
|
58
53
|
}
|
|
59
54
|
let rail = duoRailHeight(itemCount: itemCount, hasQr: hasFloatingButton, compressed: tabBarCompressed)
|
|
60
55
|
return DuoTabBarInsets(sideBarReserve: sideBar.bottom + rail + DuoBarCompression.groupGap)
|
|
61
56
|
}
|
|
62
57
|
}
|
|
63
58
|
|
|
64
|
-
/// Glass on iOS 26, a system blur before it (RN GlassView's fallback).
|
|
65
|
-
struct DuoBarMaterial<S: Shape>: ViewModifier {
|
|
66
|
-
let shape: S
|
|
67
|
-
var visible: Bool = true
|
|
68
|
-
|
|
69
|
-
func body(content: Content) -> some View {
|
|
70
|
-
content.background(material.allowsHitTesting(false))
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@ViewBuilder
|
|
74
|
-
private var material: some View {
|
|
75
|
-
#if compiler(>=6.2)
|
|
76
|
-
if #available(iOS 26.0, *) {
|
|
77
|
-
// glass materializes by toggling its effect, it does not fade with opacity
|
|
78
|
-
Color.clear
|
|
79
|
-
.glassEffect(visible ? .regular : .identity, in: shape)
|
|
80
|
-
.shadow(color: Color.black.opacity(visible ? 0.16 : 0), radius: 16, x: 0, y: 6)
|
|
81
|
-
.animation(.easeInOut(duration: 0.25), value: visible)
|
|
82
|
-
} else {
|
|
83
|
-
blur
|
|
84
|
-
}
|
|
85
|
-
#else
|
|
86
|
-
blur
|
|
87
|
-
#endif
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
private var blur: some View {
|
|
91
|
-
shape.fill(.regularMaterial)
|
|
92
|
-
.shadow(color: Color.black.opacity(0.16), radius: 16, x: 0, y: 6)
|
|
93
|
-
.opacity(visible ? 1 : 0)
|
|
94
|
-
.animation(.easeInOut(duration: 0.25), value: visible)
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
59
|
struct DuoTabBar: View {
|
|
99
60
|
let items: [BottomTabItem]
|
|
100
61
|
let floatingButton: BottomTabFloatingButton?
|
|
@@ -115,7 +76,7 @@ struct DuoTabBar: View {
|
|
|
115
76
|
}
|
|
116
77
|
}
|
|
117
78
|
|
|
118
|
-
/// Vertical bar anchored to the bottom of the side bar,
|
|
79
|
+
/// Vertical bar anchored to the bottom of the side bar, center action below it.
|
|
119
80
|
/// When the side bar is short it can shrink to one button showing the current tab
|
|
120
81
|
/// (HIG "Tab bar compressed"); tapping it expands the rail and compresses the toolbar.
|
|
121
82
|
private struct DuoRailTabBar: View {
|
|
@@ -131,15 +92,15 @@ private struct DuoRailTabBar: View {
|
|
|
131
92
|
private var isRight: Bool { sideBar.edge == .right }
|
|
132
93
|
|
|
133
94
|
var body: some View {
|
|
134
|
-
VStack(spacing:
|
|
95
|
+
VStack(spacing: TabBarMetrics.railCtaGap) {
|
|
135
96
|
if compression.tabBarCompressed, items.indices.contains(selectedIndex) {
|
|
136
97
|
SwiftUI.Button(action: compression.expandTabBar) {
|
|
137
|
-
|
|
138
|
-
.frame(width:
|
|
98
|
+
TabIcon(item: items[selectedIndex], selected: true, vertical: true)
|
|
99
|
+
.frame(width: compactSize, height: compactSize)
|
|
139
100
|
.contentShape(Circle())
|
|
140
101
|
}
|
|
141
102
|
.buttonStyle(.plain)
|
|
142
|
-
.modifier(
|
|
103
|
+
.modifier(TabBarContainer(shape: Circle()))
|
|
143
104
|
.accessibilityLabel(items[selectedIndex].label)
|
|
144
105
|
.accessibilityIdentifier("bottom_tab_bar")
|
|
145
106
|
} else {
|
|
@@ -147,9 +108,12 @@ private struct DuoRailTabBar: View {
|
|
|
147
108
|
}
|
|
148
109
|
|
|
149
110
|
if let floatingButton {
|
|
150
|
-
|
|
111
|
+
RailCenterAction(data: floatingButton)
|
|
151
112
|
}
|
|
152
113
|
}
|
|
114
|
+
// the rail lines up with the header buttons in the side bar: centered on a 48 lane kept
|
|
115
|
+
// Spacing.M from the strip's inner edge; the wider rail and center action overflow it evenly
|
|
116
|
+
.frame(width: compactSize)
|
|
153
117
|
.padding(isRight ? .leading : .trailing, Spacing.M)
|
|
154
118
|
.frame(width: sideBar.width, alignment: isRight ? .leading : .trailing)
|
|
155
119
|
.padding(.bottom, sideBar.bottom)
|
|
@@ -157,39 +121,42 @@ private struct DuoRailTabBar: View {
|
|
|
157
121
|
.ignoresSafeArea()
|
|
158
122
|
}
|
|
159
123
|
|
|
160
|
-
///
|
|
124
|
+
/// Column of rail items (.Nav/Duo/Item) with the sliding active indicator.
|
|
161
125
|
private var rail: some View {
|
|
162
126
|
ZStack(alignment: .top) {
|
|
163
|
-
|
|
164
|
-
.
|
|
165
|
-
.
|
|
166
|
-
.
|
|
167
|
-
+ CGFloat(selectedIndex) * (itemSize + railGap))
|
|
168
|
-
.animation(tabSpring, value: selectedIndex)
|
|
127
|
+
ActiveIndicator(radius: TabBarMetrics.railIndicatorRadius)
|
|
128
|
+
.frame(width: TabBarMetrics.railItemWidth, height: TabBarMetrics.railIndicatorHeight)
|
|
129
|
+
.offset(y: Spacing.XS + CGFloat(selectedIndex) * TabBarMetrics.railItemHeight)
|
|
130
|
+
.animation(TabBarMetrics.indicatorMotion, value: selectedIndex)
|
|
169
131
|
|
|
170
|
-
VStack(spacing:
|
|
132
|
+
VStack(spacing: 0) {
|
|
171
133
|
ForEach(items.indices, id: \.self) { index in
|
|
172
134
|
SwiftUI.Button {
|
|
173
135
|
onTabSelected(index)
|
|
174
136
|
compression.onTabSelected()
|
|
175
137
|
} label: {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
138
|
+
VStack(spacing: 0) {
|
|
139
|
+
TabItemContent(item: items[index], selected: index == selectedIndex, vertical: true, fixedFontScale: true)
|
|
140
|
+
}
|
|
141
|
+
.frame(width: TabBarMetrics.railItemWidth, height: TabBarMetrics.railItemHeight)
|
|
142
|
+
.contentShape(Rectangle())
|
|
179
143
|
}
|
|
180
144
|
.buttonStyle(.plain)
|
|
181
145
|
.accessibilityLabel(items[index].label)
|
|
146
|
+
.accessibilityAddTraits(index == selectedIndex ? .isSelected : [])
|
|
182
147
|
}
|
|
183
148
|
}
|
|
184
|
-
.padding(.vertical, railPadding)
|
|
185
149
|
}
|
|
186
|
-
.
|
|
187
|
-
.
|
|
150
|
+
.padding(.horizontal, TabBarMetrics.railPaddingHorizontal)
|
|
151
|
+
.padding(.bottom, TabBarMetrics.railPaddingBottom)
|
|
152
|
+
.frame(width: TabBarMetrics.railContainerWidth)
|
|
153
|
+
.modifier(TabBarContainer(shape: RoundedRectangle(cornerRadius: Radius.XL)))
|
|
154
|
+
.accessibilityElement(children: .contain)
|
|
188
155
|
.accessibilityIdentifier("bottom_tab_bar")
|
|
189
156
|
}
|
|
190
157
|
}
|
|
191
158
|
|
|
192
|
-
///
|
|
159
|
+
/// Horizontal navigation bar of the unfolded display: 65% of the short side, centered.
|
|
193
160
|
private struct DuoFloatingTabBar: View {
|
|
194
161
|
let items: [BottomTabItem]
|
|
195
162
|
let floatingButton: BottomTabFloatingButton?
|
|
@@ -197,108 +164,33 @@ private struct DuoFloatingTabBar: View {
|
|
|
197
164
|
let onTabSelected: (Int) -> Void
|
|
198
165
|
|
|
199
166
|
@Environment(\.screenLayout) private var layout
|
|
200
|
-
@Environment(\.appTheme) private var theme
|
|
201
|
-
|
|
202
|
-
private var barWidth: CGFloat {
|
|
203
|
-
let columnWidth = (layout.width - 2 * Spacing.M - (gridColumns - 1) * Spacing.M) / gridColumns
|
|
204
|
-
return columnWidth * gridSpan + (gridSpan - 1) * Spacing.M
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
private var useQr: Bool { floatingButton != nil && items.count % 2 == 0 }
|
|
208
|
-
private var middle: Int { items.count / 2 }
|
|
209
|
-
private var cellCount: Int { items.count + (useQr ? 1 : 0) }
|
|
210
|
-
private var cellWidth: CGFloat { (barWidth - floatingPadding * 2) / CGFloat(max(cellCount, 1)) }
|
|
211
|
-
private var visualIndex: Int { useQr && selectedIndex >= middle ? selectedIndex + 1 : selectedIndex }
|
|
212
167
|
|
|
213
168
|
var body: some View {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
if useQr && cell == middle, let floatingButton {
|
|
224
|
-
DuoQrButton(data: floatingButton, size: floatingQrSize)
|
|
225
|
-
.frame(width: cellWidth)
|
|
226
|
-
} else {
|
|
227
|
-
let index = useQr && cell > middle ? cell - 1 : cell
|
|
228
|
-
tabCell(index)
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
.padding(floatingPadding)
|
|
234
|
-
.frame(width: barWidth, height: duoFloatingTabBarHeight)
|
|
235
|
-
.modifier(DuoBarMaterial(shape: Capsule()))
|
|
236
|
-
.accessibilityIdentifier("bottom_tab_bar")
|
|
237
|
-
.padding(.bottom, layout.insets.bottom + Spacing.M)
|
|
169
|
+
HorizontalTabBar(
|
|
170
|
+
items: items,
|
|
171
|
+
floatingButton: floatingButton,
|
|
172
|
+
selectedIndex: selectedIndex,
|
|
173
|
+
onTabSelected: onTabSelected,
|
|
174
|
+
width: TabBarMetrics.horizontalBarWidth(layout),
|
|
175
|
+
fixedFontScale: true
|
|
176
|
+
)
|
|
177
|
+
.padding(.bottom, layout.duoFloatingTabBarBottom)
|
|
238
178
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
|
|
239
179
|
.ignoresSafeArea()
|
|
240
180
|
}
|
|
241
|
-
|
|
242
|
-
private func tabCell(_ index: Int) -> some View {
|
|
243
|
-
let selected = index == selectedIndex
|
|
244
|
-
return SwiftUI.Button { onTabSelected(index) } label: {
|
|
245
|
-
VStack(spacing: Spacing.XXS) {
|
|
246
|
-
DuoTabIcon(item: items[index], selected: selected)
|
|
247
|
-
MomoText(
|
|
248
|
-
items[index].label,
|
|
249
|
-
typography: .labelXsMedium,
|
|
250
|
-
color: selected ? theme.colors.primary : theme.colors.text.default,
|
|
251
|
-
textAlign: .center,
|
|
252
|
-
maxLines: 1
|
|
253
|
-
)
|
|
254
|
-
}
|
|
255
|
-
.frame(width: cellWidth)
|
|
256
|
-
.frame(maxHeight: .infinity)
|
|
257
|
-
.contentShape(Rectangle())
|
|
258
|
-
}
|
|
259
|
-
.buttonStyle(.plain)
|
|
260
|
-
.accessibilityLabel(items[index].label)
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
private struct DuoTabIcon: View {
|
|
265
|
-
let item: BottomTabItem
|
|
266
|
-
let selected: Bool
|
|
267
|
-
|
|
268
|
-
@Environment(\.appTheme) private var theme
|
|
269
|
-
|
|
270
|
-
private var badgeLabel: String? {
|
|
271
|
-
guard let label = item.badgeLabel else { return nil }
|
|
272
|
-
if let n = Int(label), n == 0 { return nil }
|
|
273
|
-
return label
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
var body: some View {
|
|
277
|
-
Icon(source: item.icon, size: iconSize, color: selected ? theme.colors.primary : theme.colors.text.default)
|
|
278
|
-
.overlay(alignment: .topTrailing) {
|
|
279
|
-
if let badgeLabel, !badgeLabel.isEmpty {
|
|
280
|
-
Badge(label: badgeLabel).offset(x: Spacing.S, y: -Spacing.XS)
|
|
281
|
-
} else if badgeLabel != nil || item.showDot {
|
|
282
|
-
BadgeDot(size: .small)
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
181
|
}
|
|
287
182
|
|
|
288
|
-
|
|
183
|
+
/// Center action of the rail: round button with its label, under the container.
|
|
184
|
+
private struct RailCenterAction: View {
|
|
289
185
|
let data: BottomTabFloatingButton
|
|
290
|
-
let size: CGFloat
|
|
291
|
-
|
|
292
|
-
@Environment(\.appTheme) private var theme
|
|
293
186
|
|
|
294
187
|
var body: some View {
|
|
295
|
-
SwiftUI.Button(action: data.onPress) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
.accessibilityLabel(data.label)
|
|
188
|
+
SwiftUI.Button(action: data.onPress) { EmptyView() }
|
|
189
|
+
.buttonStyle(CenterActionStyle(size: TabBarMetrics.railCtaSize, vertical: true, icon: data.icon,
|
|
190
|
+
iconContent: data.iconContent, labelContent: data.labelContent,
|
|
191
|
+
label: data.label, fixedFontScale: true))
|
|
192
|
+
.frame(width: TabBarMetrics.railCtaWidth, height: TabBarMetrics.railCtaHeight)
|
|
193
|
+
.accessibilityLabel(data.label)
|
|
194
|
+
.accessibilityIdentifier(data.label)
|
|
303
195
|
}
|
|
304
196
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
static let indicatorRadius = Radius.XL
|
|
22
|
+
// home indicator / gesture bar area under the container
|
|
23
|
+
static let systemIndicatorHeight: CGFloat = 24
|
|
24
|
+
// unfolded foldables (short side from 600, the smallest in the spec) use 65% of the short side,
|
|
25
|
+
// centered; phones and folded outer displays fill the window
|
|
26
|
+
static let foldableMinShortSide: CGFloat = 600
|
|
27
|
+
static let foldableWidthRatio: CGFloat = 0.65
|
|
28
|
+
static let ctaSlotWidth: CGFloat = 92
|
|
29
|
+
static let ctaSize: CGFloat = 48
|
|
30
|
+
// the icon sits 10 inside the 48 button (prototype .cta: 28 icon), 12 inside the 52 rail one
|
|
31
|
+
static let ctaIconSize: CGFloat = 28
|
|
32
|
+
// the button rises 22 above the container top edge
|
|
33
|
+
static let ctaLift: CGFloat = 22
|
|
34
|
+
static let ctaLabelGap = Spacing.M
|
|
35
|
+
static let ctaLabelHeight: CGFloat = 18
|
|
36
|
+
// notch dipped into the container top edge under the center action (Figma "Backgroud" path):
|
|
37
|
+
// starts notchHalfWidth left of the center, then cubic segments of control1, control2, end,
|
|
38
|
+
// each point as (dx from the center, dy below the top edge)
|
|
39
|
+
static let notchHalfWidth: CGFloat = 50.758
|
|
40
|
+
static let notchCurves: [[CGPoint]] = [
|
|
41
|
+
[CGPoint(x: -39.749, y: 0), CGPoint(x: -31.231, y: 9.765), CGPoint(x: -24.563, y: 18.526)],
|
|
42
|
+
[CGPoint(x: -18.928, y: 25.93), CGPoint(x: -10.022, y: 30.709), CGPoint(x: 0, y: 30.709)],
|
|
43
|
+
[CGPoint(x: 10.022, y: 30.709), CGPoint(x: 18.928, y: 25.93), CGPoint(x: 24.563, y: 18.526)],
|
|
44
|
+
[CGPoint(x: 31.231, y: 9.765), CGPoint(x: 39.749, y: 0), CGPoint(x: notchHalfWidth, y: 0)],
|
|
45
|
+
]
|
|
46
|
+
static let railContainerWidth: CGFloat = 56
|
|
47
|
+
static let railPaddingHorizontal = Spacing.XS
|
|
48
|
+
static let railPaddingBottom = Spacing.S
|
|
49
|
+
static let railItemWidth: CGFloat = 48
|
|
50
|
+
static let railItemHeight: CGFloat = 62
|
|
51
|
+
static let railIndicatorHeight: CGFloat = 40
|
|
52
|
+
static let railIndicatorRadius: CGFloat = 20
|
|
53
|
+
static let railCtaGap = Spacing.L
|
|
54
|
+
static let railCtaSize: CGFloat = 52
|
|
55
|
+
static let railCtaLabelGap = Spacing.XS
|
|
56
|
+
static let railCtaWidth: CGFloat = 68
|
|
57
|
+
static let railCtaHeight: CGFloat = 70
|
|
58
|
+
static let badgeMaxWidth: CGFloat = 58
|
|
59
|
+
|
|
60
|
+
// motion (MoMo Navigation Prototype): one active indicator slides to the selected item overshooting
|
|
61
|
+
// a little, icon and label tint cross-fade, the center action shrinks while held
|
|
62
|
+
static let indicatorMotion = Animation.timingCurve(0.34, 1.4, 0.5, 1, duration: 0.55)
|
|
63
|
+
static let tintMotion = Animation.easeInOut(duration: 0.25)
|
|
64
|
+
static let ctaPressMotion = Animation.easeOut(duration: 0.15)
|
|
65
|
+
static let ctaPressedScale: CGFloat = 0.92
|
|
66
|
+
|
|
67
|
+
/// Width of the horizontal bar: 65% of the short side on an unfolded foldable, otherwise the window
|
|
68
|
+
/// minus the side safe areas and margins.
|
|
69
|
+
static func horizontalBarWidth(_ layout: ScreenLayout) -> CGFloat {
|
|
70
|
+
let shortSide = min(layout.width, layout.height)
|
|
71
|
+
if shortSide >= foldableMinShortSide { return shortSide * foldableWidthRatio }
|
|
72
|
+
return layout.width - layout.insets.leading - layout.insets.trailing - 2 * margin
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/// Gap under the container: the home indicator area.
|
|
76
|
+
static func bottomGap(_ bottomInset: CGFloat) -> CGFloat {
|
|
77
|
+
max(min(bottomInset, systemIndicatorHeight), Spacing.S)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// The center action needs a tab on each side: Special type takes 2 or 4 tabs.
|
|
81
|
+
static func hasCenterAction(_ floatingButton: BottomTabFloatingButton?, tabCount: Int) -> Bool {
|
|
82
|
+
floatingButton != nil && tabCount % 2 == 0
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -90,6 +90,27 @@ private let duoGradientExtra: CGFloat = 52
|
|
|
90
90
|
// scroll distance over which the extended gradient collapses to the header
|
|
91
91
|
private let duoExtendedCollapseDistance: CGFloat = 100
|
|
92
92
|
|
|
93
|
+
// scroll distance over which the bar fades in
|
|
94
|
+
private let duoBarFadeDistance: CGFloat = 16
|
|
95
|
+
|
|
96
|
+
/// Port of RN `DuoGlassBackground`: translucent surface with a hairline, shown once the content
|
|
97
|
+
/// scrolls `fadeStart` under the header.
|
|
98
|
+
struct DuoHeaderBar: View {
|
|
99
|
+
let scrollOffset: CGFloat
|
|
100
|
+
var fadeStart: CGFloat = 0
|
|
101
|
+
|
|
102
|
+
@Environment(\.appTheme) private var theme
|
|
103
|
+
|
|
104
|
+
var body: some View {
|
|
105
|
+
theme.colors.background.surface.opacity(0.8)
|
|
106
|
+
.overlay(alignment: .bottom) {
|
|
107
|
+
theme.colors.border.default.frame(height: 0.5)
|
|
108
|
+
}
|
|
109
|
+
.opacity(min(max((scrollOffset - fadeStart) / duoBarFadeDistance, 0), 1))
|
|
110
|
+
.allowsHitTesting(false)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
93
114
|
/// Port of RN `DuoScrollGradient`: with the glass header the content scrolls under the bar, so the
|
|
94
115
|
/// header gradient is drawn under it. Compose draws this inside `HeaderBackground`.
|
|
95
116
|
struct DuoScrollGradient: View {
|
|
@@ -114,7 +135,7 @@ struct DuoScrollGradient: View {
|
|
|
114
135
|
let progress = min(scroll / duoExtendedCollapseDistance, 1)
|
|
115
136
|
gradient
|
|
116
137
|
.frame(height: headerHeight + (extended ? duoGradientExtra * (1 - progress) : 0))
|
|
117
|
-
.opacity(1 - min(scroll / duoGradientExtra, 1))
|
|
138
|
+
.opacity(Double(1 - min(scroll / duoGradientExtra, 1)))
|
|
118
139
|
}
|
|
119
140
|
}
|
|
120
141
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
|
|
@@ -359,7 +359,7 @@ struct Toolkit: View {
|
|
|
359
359
|
}
|
|
360
360
|
toolButton(icon: headerRight.closeIcon, accessibilityId: "btn_navigation_close", action: onPressClose)
|
|
361
361
|
}
|
|
362
|
-
.frame(width: 65, height: 28)
|
|
362
|
+
.frame(width: usesHelpCenter(context) ? 65 : 28, height: 28)
|
|
363
363
|
.background(headerColor.backgroundButton)
|
|
364
364
|
.cornerRadius(14)
|
|
365
365
|
.overlay(RoundedRectangle(cornerRadius: 14).stroke(headerColor.borderColor, lineWidth: 0.2))
|
|
@@ -57,6 +57,7 @@ struct SnackBarView: View {
|
|
|
57
57
|
let bottomInset: CGFloat
|
|
58
58
|
|
|
59
59
|
@EnvironmentObject private var navigator: Navigator
|
|
60
|
+
@Environment(\.screenLayout) private var layout
|
|
60
61
|
|
|
61
62
|
@State private var contentHeight: CGFloat = 0
|
|
62
63
|
@State private var offsetY: CGFloat = 0
|
|
@@ -75,6 +76,9 @@ struct SnackBarView: View {
|
|
|
75
76
|
)
|
|
76
77
|
.offset(y: offsetY)
|
|
77
78
|
.padding(.bottom, bottomInset)
|
|
79
|
+
// iPhone Duo: clear of the side toolbar strip, like the screen content (0 elsewhere)
|
|
80
|
+
.padding(.leading, layout.insetLeft)
|
|
81
|
+
.padding(.trailing, layout.insetRight)
|
|
78
82
|
}
|
|
79
83
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
80
84
|
.ignoresSafeArea()
|
|
@@ -24,9 +24,11 @@ struct ModalScreen<Content: View>: View {
|
|
|
24
24
|
@State private var didAppear = false
|
|
25
25
|
|
|
26
26
|
var body: some View {
|
|
27
|
+
let modal = layout.modalLayout
|
|
28
|
+
let placement = modal.placement
|
|
27
29
|
ZStack {
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
+
// full screen on foldables too, over the iPhone Duo control column
|
|
31
|
+
Colors.black20.opacity(modal.scrimOpacity * scrimOpacity)
|
|
30
32
|
.ignoresSafeArea()
|
|
31
33
|
.contentShape(Rectangle())
|
|
32
34
|
.onTapGesture {
|
|
@@ -34,11 +36,24 @@ struct ModalScreen<Content: View>: View {
|
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
content()
|
|
39
|
+
// foldables: capped by the spec; nil leaves the size alone
|
|
40
|
+
.frame(
|
|
41
|
+
maxWidth: modal.isFoldable ? modal.popup.maxWidth : nil,
|
|
42
|
+
maxHeight: modal.isFoldable ? (modal.popup.maxHeight ?? placement.height) : nil
|
|
43
|
+
)
|
|
37
44
|
.scaleEffect(contentScale)
|
|
38
45
|
.opacity(contentOpacity)
|
|
39
|
-
//
|
|
40
|
-
.padding(
|
|
41
|
-
|
|
46
|
+
// center in the placement: the safe area, or the right half of a half-folded iPhone Duo
|
|
47
|
+
.padding(
|
|
48
|
+
modal.isFoldable
|
|
49
|
+
? EdgeInsets(
|
|
50
|
+
top: placement.minY,
|
|
51
|
+
leading: placement.minX,
|
|
52
|
+
bottom: layout.height - placement.maxY,
|
|
53
|
+
trailing: layout.width - placement.maxX
|
|
54
|
+
)
|
|
55
|
+
: EdgeInsets()
|
|
56
|
+
)
|
|
42
57
|
}
|
|
43
58
|
// Full screen like RN's Modal, so asymmetric landscape insets don't shift the content sideways.
|
|
44
59
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
@@ -403,11 +403,8 @@ public struct StackScreen<Content: View>: View {
|
|
|
403
403
|
.background(alignment: .top) {
|
|
404
404
|
Group {
|
|
405
405
|
if layout.sideBar != nil {
|
|
406
|
-
//
|
|
407
|
-
|
|
408
|
-
shape: Rectangle(),
|
|
409
|
-
visible: scrollOffset > heroGlassStart(animatedHeader)
|
|
410
|
-
))
|
|
406
|
+
// the bar shows once the banner has scrolled under the header
|
|
407
|
+
DuoHeaderBar(scrollOffset: scrollOffset, fadeStart: heroGlassStart(animatedHeader))
|
|
411
408
|
} else {
|
|
412
409
|
HeaderBarBackground(opacity: opacity)
|
|
413
410
|
}
|
|
@@ -457,8 +454,7 @@ public struct StackScreen<Content: View>: View {
|
|
|
457
454
|
|
|
458
455
|
header
|
|
459
456
|
.background(
|
|
460
|
-
|
|
461
|
-
.modifier(DuoBarMaterial(shape: Rectangle(), visible: scrollOffset > 0))
|
|
457
|
+
DuoHeaderBar(scrollOffset: scrollOffset)
|
|
462
458
|
.edgesIgnoringSafeArea([.top, .horizontal])
|
|
463
459
|
)
|
|
464
460
|
.offset(y: -headerHide)
|
|
@@ -577,7 +573,8 @@ private struct StackScreenContent<Content: View>: View {
|
|
|
577
573
|
var animatedSearchInset: CGFloat = 0
|
|
578
574
|
/// Room for a header the content scrolls under (iPhone Duo glass header).
|
|
579
575
|
var topInset: CGFloat = 0
|
|
580
|
-
/// Room for
|
|
576
|
+
/// Room for the floating tab bar that overlays the content: scrolling content runs under it and
|
|
577
|
+
/// ends clear of it, static content stays above it.
|
|
581
578
|
var bottomInset: CGFloat = 0
|
|
582
579
|
/// Compose's animated-search snap: a scroll that comes to rest part way through this distance
|
|
583
580
|
/// finishes the move, up or back down.
|
|
@@ -648,6 +645,7 @@ private struct StackScreenContent<Content: View>: View {
|
|
|
648
645
|
}
|
|
649
646
|
}
|
|
650
647
|
} else {
|
|
648
|
+
// static tab content stays above the floating tab bar
|
|
651
649
|
content()
|
|
652
650
|
.padding(.top, topInset)
|
|
653
651
|
.padding(.bottom, bottomInset)
|
|
@@ -70,6 +70,7 @@ public struct PopupDisplay: View {
|
|
|
70
70
|
}
|
|
71
71
|
VStack(alignment: .leading, spacing: 0) {
|
|
72
72
|
MomoText(title, typography: .headerDefaultBold, maxLines: 2, accessibilityId: "title_popup_permission")
|
|
73
|
+
.padding(.trailing, isShowCloseIcon && url.isEmpty ? ModalMetrics.iconButtonSize + Spacing.M - Spacing.XL : 0)
|
|
73
74
|
.padding(.top, 24)
|
|
74
75
|
.padding(.bottom, 8)
|
|
75
76
|
|
|
@@ -107,15 +108,16 @@ public struct PopupDisplay: View {
|
|
|
107
108
|
}
|
|
108
109
|
.fixedSize(horizontal: false, vertical: true)
|
|
109
110
|
.background(theme.colors.background.surface)
|
|
110
|
-
.clipShape(RoundedRectangle(cornerRadius:
|
|
111
|
+
.clipShape(RoundedRectangle(cornerRadius: layout.popupRadius()))
|
|
111
112
|
|
|
112
113
|
if isShowCloseIcon {
|
|
113
|
-
|
|
114
|
-
.
|
|
114
|
+
ModalIconButton(icon: "navigation_close", accessibilityId: "ic_popup_close", action: onClose)
|
|
115
|
+
.padding(.top, Spacing.M)
|
|
116
|
+
.padding(.trailing, Spacing.M)
|
|
115
117
|
}
|
|
116
118
|
}
|
|
117
119
|
.frame(maxWidth: layout.popupMaxWidth)
|
|
118
|
-
.padding(.horizontal, 12)
|
|
120
|
+
.padding(.horizontal, layout.popupHorizontalPadding(12))
|
|
119
121
|
.accessibilityElement(children: .contain)
|
|
120
122
|
.accessibilityIdentifier("popup_notify")
|
|
121
123
|
}
|
|
@@ -29,6 +29,7 @@ public struct PopupInput: View {
|
|
|
29
29
|
VStack {
|
|
30
30
|
VStack(alignment: .leading) {
|
|
31
31
|
MomoText(title, typography: .headerDefaultBold)
|
|
32
|
+
.padding(.trailing, ModalMetrics.iconButtonSize + Spacing.M - Spacing.XL)
|
|
32
33
|
.padding(.top, 12)
|
|
33
34
|
.padding(.bottom, 24)
|
|
34
35
|
|
|
@@ -55,15 +56,16 @@ public struct PopupInput: View {
|
|
|
55
56
|
|
|
56
57
|
}.clipped()
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
.
|
|
59
|
+
ModalIconButton(icon: "navigation_close", accessibilityId: "ic_popup_close", action: onPressClose)
|
|
60
|
+
.padding(.top, Spacing.M)
|
|
61
|
+
.padding(.trailing, Spacing.M)
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
|
-
.background(theme.colors.background.surface.cornerRadius(8))
|
|
64
|
+
.background(theme.colors.background.surface.cornerRadius(layout.popupRadius(8)))
|
|
63
65
|
.shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
|
|
64
66
|
.shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
|
|
65
67
|
.frame(maxWidth: layout.popupMaxWidth)
|
|
66
|
-
.padding(.horizontal, 40)
|
|
68
|
+
.padding(.horizontal, layout.popupHorizontalPadding(40))
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
// MARK: Internal
|