@momo-kits/native-kits 0.300.7-debug → 0.300.8-beta.1-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 +12 -8
- package/README.md +8 -7
- package/compose/build.gradle.kts +2 -4
- package/compose/build.gradle.kts.backup +1 -3
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +1 -2
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +3 -2
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +2 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/KitsBinding.kt +60 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/KitsHost.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +20 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +5 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +7 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +18 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +15 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +4 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +13 -73
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +1 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +1 -53
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +3 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +2 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +12 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +11 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +17 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +20 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +3 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +7 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +1 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +1 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +83 -82
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +6 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +9 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +13 -35
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +2 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +5 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +6 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +55 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +1 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +3 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +22 -50
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +2 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +11 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +71 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +184 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +18 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +5 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +123 -64
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +24 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +11 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +16 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +59 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +69 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +14 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +5 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +43 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +330 -149
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +87 -70
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +92 -261
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +31 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +46 -72
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HelpCenterRequest.kt +8 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +29 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/ToolkitRequests.kt +8 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +9 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +26 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +1 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +4 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +2 -3
- package/compose/src/commonTest/kotlin/vn/momo/kits/application/KitsHostTest.kt +44 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +2 -7
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +9 -18
- package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +1 -1
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +3 -6
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +5 -6
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +12 -12
- 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 +11 -6
- package/gradle/libs.versions.toml +1 -3
- package/gradle.properties +1 -3
- package/ios/Application/ApplicationEnvironment.swift +6 -4
- package/ios/Application/DesignSystemKits.swift +59 -13
- package/ios/Application/DesignSystemKitsPayload.swift +0 -8
- package/ios/Application/LanguageSource.swift +2 -11
- package/ios/Application/Localize.swift +8 -35
- package/ios/Application/LocalizeModifier.swift +2 -11
- package/ios/Application/MaxApi.swift +3 -11
- package/ios/Avatar/Avatar.swift +0 -1
- package/ios/Badge/Badge.swift +5 -8
- package/ios/Badge/BadgeRibbon.swift +2 -5
- package/ios/Button/Button.swift +4 -8
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +5 -7
- package/ios/Carousel/Carousel.swift +4 -17
- package/ios/Checkbox/Checkbox.swift +0 -2
- package/ios/Collapse/Collapse.swift +17 -11
- package/ios/Colors+Radius+Spacing/Theme.swift +0 -7
- package/ios/DateTimePicker/DateTimePicker.swift +4 -10
- package/ios/DateTimePicker/DateTimePickerTypes.swift +1 -3
- package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -3
- package/ios/DateTimePicker/WheelPicker.swift +2 -4
- package/ios/Extensions/ActiveOpacityButtonStyle.swift +2 -3
- package/ios/Extensions/Color++.swift +2 -4
- package/ios/Extensions/SkeletonUICompat.swift +0 -8
- package/ios/Icon/Icon.swift +3 -6
- package/ios/IconButton/IconButton.swift +2 -5
- package/ios/Input/ErrorView.swift +0 -7
- package/ios/Input/Input.swift +9 -20
- package/ios/Input/InputPhoneNumber.swift +37 -20
- package/ios/Input/InputSearch.swift +23 -12
- package/ios/Input/InputTextArea.swift +4 -13
- package/ios/InputDropDown/InputDropDown.swift +1 -11
- package/ios/InputMoney/InputMoney.swift +9 -28
- package/ios/InputOTP/InputOTP.swift +2 -9
- package/ios/Layout/HeaderLayout.swift +72 -0
- package/ios/Layout/Item.swift +1 -2
- package/ios/Layout/ModalLayout.swift +144 -0
- package/ios/Layout/ScreenLayout.swift +48 -31
- package/ios/Layout/Section.swift +2 -3
- package/ios/Loader/Loader.swift +3 -12
- package/ios/Lottie/LottieView.swift +0 -11
- package/ios/Navigation/BottomSheet.swift +73 -94
- package/ios/Navigation/BottomTab/BottomTab.swift +58 -73
- package/ios/Navigation/BottomTab/BottomTabBar.swift +286 -121
- package/ios/Navigation/BottomTab/CurvedContainer.swift +52 -54
- package/ios/Navigation/BottomTab/DuoBarCompression.swift +5 -12
- package/ios/Navigation/BottomTab/DuoTabBar.swift +67 -202
- package/ios/Navigation/BottomTab/TabBarMetrics.swift +97 -0
- package/ios/Navigation/Component/FloatingButton.swift +4 -11
- package/ios/Navigation/Component/Header.swift +35 -54
- package/ios/Navigation/Component/HeaderBackground.swift +2 -8
- package/ios/Navigation/Component/HeaderJourney.swift +4 -8
- package/ios/Navigation/Component/HeaderLocation.swift +4 -8
- package/ios/Navigation/Component/HeaderRight.swift +20 -22
- package/ios/Navigation/Component/HeaderTitle.swift +1 -6
- package/ios/Navigation/Component/HeaderUser.swift +4 -10
- package/ios/Navigation/Component/SideBar.swift +6 -21
- package/ios/Navigation/Component/SnackBar.swift +9 -13
- package/ios/Navigation/HostBackGestureBridge.swift +2 -9
- package/ios/Navigation/ModalScreen.swift +24 -13
- package/ios/Navigation/Navigation.swift +35 -19
- package/ios/Navigation/NavigationContainer.swift +4 -15
- package/ios/Navigation/Navigator.swift +21 -39
- package/ios/Navigation/StackScreen.swift +64 -51
- package/ios/Navigation/StackTransition.swift +7 -14
- package/ios/Navigation/SwipeBackHaptic.swift +2 -7
- package/ios/Navigation/Tracking/ScreenTracker.swift +2 -7
- package/ios/Pagination/PaginationDot.swift +0 -9
- package/ios/Pagination/PaginationNumber.swift +1 -9
- package/ios/Pagination/PaginationScroll.swift +2 -14
- package/ios/Pagination/PaginationWhiteDot.swift +1 -10
- package/ios/Popup/PopupDisplay.swift +7 -5
- package/ios/Popup/PopupInput.swift +6 -4
- package/ios/Popup/PopupLayout.swift +17 -9
- package/ios/Popup/PopupNotify.swift +32 -25
- package/ios/PopupView/FullscreenPopup.swift +3 -4
- package/ios/PopupView/PopupView.swift +2 -2
- package/ios/PopupView/Utils++.swift +1 -2
- package/ios/ProgressInfo/ProgressInfo.swift +2 -13
- package/ios/Skeleton/Skeleton.swift +5 -16
- package/ios/Slider/Slider.swift +5 -12
- package/ios/StatusBarTap/StatusBarTap.h +2 -3
- package/ios/StatusBarTap/StatusBarTap.m +3 -16
- package/ios/Stepper/Stepper.swift +8 -27
- package/ios/Steps/Steps.swift +29 -26
- package/ios/Swipeable/SwipeCell.swift +2 -2
- package/ios/Swipeable/SwipeCellModel.swift +3 -6
- package/ios/TabView/TabView.swift +14 -28
- package/ios/Template/TrustBanner/TrustBanner.swift +2 -9
- package/ios/Title/Title.swift +1 -3
- package/ios/Tooltip/Tooltip.swift +4 -9
- package/ios/Typography/FontScale.swift +79 -24
- package/ios/Typography/Text.swift +6 -12
- package/ios/Typography/Typography.swift +8 -11
- package/ios/Uploader/Uploader.swift +2 -17
- 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/AnimatedHeaderDemo.swift +11 -2
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +296 -59
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +15 -4
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +0 -8
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +114 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +29 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +16 -0
- package/package.json +1 -1
- package/publish.sh +8 -2
- package/scripts/ci/build-swiftui.sh +22 -0
- package/scripts/ci/resolve-version.mjs +144 -0
- package/settings.gradle.kts +0 -1
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// MoMoUIKits
|
|
4
|
-
//
|
|
5
|
-
// SwiftUI mirror of Compose's `navigation/bottomtab/BottomTabBar.kt`.
|
|
6
|
-
// Renders the row of tab items, an animated selection indicator, a top shadow,
|
|
7
|
-
// badges/dots, and an optional center floating button (with the curved notch).
|
|
8
|
-
//
|
|
1
|
+
// SwiftUI mirror of Compose's `navigation/bottomtab/BottomTabBar.kt` (Figma "Specs Navigation", DS-984): floating
|
|
2
|
+
// container, evenly split items with a tonal active indicator, badges/dots, the Special center action in a notch.
|
|
9
3
|
|
|
10
4
|
import SwiftUI
|
|
11
5
|
|
|
@@ -49,178 +43,349 @@ public struct BottomTabFloatingButton {
|
|
|
49
43
|
public let icon: String
|
|
50
44
|
public let label: String
|
|
51
45
|
public let onPress: () -> Void
|
|
46
|
+
/// Replaces the icon inside the 48 button, e.g. the button part of a Lottie; centered, unclipped.
|
|
47
|
+
public let iconContent: AnyView?
|
|
48
|
+
/// Drawn over the label text, which stays, e.g. the label part of a Lottie; centered, unclipped.
|
|
49
|
+
public let labelContent: AnyView?
|
|
52
50
|
|
|
53
51
|
public init(icon: String, label: String, onPress: @escaping () -> Void) {
|
|
54
52
|
self.icon = icon
|
|
55
53
|
self.label = label
|
|
56
54
|
self.onPress = onPress
|
|
55
|
+
self.iconContent = nil
|
|
56
|
+
self.labelContent = nil
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/// The button and label parts given separately, e.g. a Lottie split into both.
|
|
60
|
+
public init<IconContent: View, LabelContent: View>(
|
|
61
|
+
label: String,
|
|
62
|
+
onPress: @escaping () -> Void,
|
|
63
|
+
@ViewBuilder iconContent: () -> IconContent,
|
|
64
|
+
@ViewBuilder labelContent: () -> LabelContent
|
|
65
|
+
) {
|
|
66
|
+
self.icon = ""
|
|
67
|
+
self.label = label
|
|
68
|
+
self.onPress = onPress
|
|
69
|
+
self.iconContent = AnyView(iconContent())
|
|
70
|
+
self.labelContent = AnyView(labelContent())
|
|
57
71
|
}
|
|
58
|
-
}
|
|
59
72
|
|
|
60
|
-
|
|
61
|
-
let BOTTOM_TAB_BAR_HEIGHT: CGFloat = 64
|
|
73
|
+
}
|
|
62
74
|
|
|
63
75
|
// MARK: - Tab bar
|
|
64
76
|
|
|
77
|
+
/// Phone tab bar: the horizontal navigation bar filling the window, above the home indicator.
|
|
65
78
|
struct BottomTabBar: View {
|
|
66
79
|
let items: [BottomTabItem]
|
|
67
80
|
let floatingButton: BottomTabFloatingButton?
|
|
68
81
|
let selectedIndex: Int
|
|
69
82
|
let onTabSelected: (Int) -> Void
|
|
83
|
+
let bottomInset: CGFloat
|
|
70
84
|
|
|
71
85
|
@Environment(\.screenLayout) private var layout
|
|
72
|
-
@Environment(\.appTheme) private var theme
|
|
73
86
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
var body: some View {
|
|
88
|
+
HorizontalTabBar(
|
|
89
|
+
items: items,
|
|
90
|
+
floatingButton: floatingButton,
|
|
91
|
+
selectedIndex: selectedIndex,
|
|
92
|
+
onTabSelected: onTabSelected,
|
|
93
|
+
width: TabBarMetrics.horizontalBarWidth(
|
|
94
|
+
layout,
|
|
95
|
+
itemCount: items.count,
|
|
96
|
+
hasCta: TabBarMetrics.hasCenterAction(floatingButton, tabCount: items.count)
|
|
97
|
+
)
|
|
98
|
+
)
|
|
99
|
+
.padding(.bottom, TabBarMetrics.bottomGap(bottomInset))
|
|
100
|
+
.frame(maxWidth: .infinity)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
77
103
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
104
|
+
/// One active indicator slides behind the selected item; the Special type's center action rises ctaLift above
|
|
105
|
+
/// the container's notch.
|
|
106
|
+
struct HorizontalTabBar: View {
|
|
107
|
+
let items: [BottomTabItem]
|
|
108
|
+
let floatingButton: BottomTabFloatingButton?
|
|
109
|
+
let selectedIndex: Int
|
|
110
|
+
let onTabSelected: (Int) -> Void
|
|
111
|
+
let width: CGFloat
|
|
112
|
+
|
|
113
|
+
private var cta: BottomTabFloatingButton? {
|
|
114
|
+
TabBarMetrics.hasCenterAction(floatingButton, tabCount: items.count) ? floatingButton : nil
|
|
83
115
|
}
|
|
84
116
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
117
|
+
/// Items share what the padding, gaps and center action slot leave.
|
|
118
|
+
private var itemWidth: CGFloat {
|
|
119
|
+
let slots = CGFloat(items.count + (cta == nil ? 0 : 1))
|
|
120
|
+
let content = width - 2 * TabBarMetrics.paddingHorizontal - (slots - 1) * TabBarMetrics.itemGap
|
|
121
|
+
return max((content - (cta == nil ? 0 : TabBarMetrics.ctaSlotWidth)) / CGFloat(max(items.count, 1)), 0)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private func itemX(_ index: Int) -> CGFloat {
|
|
125
|
+
let afterCta = cta != nil && index >= items.count / 2
|
|
126
|
+
return TabBarMetrics.paddingHorizontal + CGFloat(index) * (itemWidth + TabBarMetrics.itemGap)
|
|
127
|
+
+ (afterCta ? TabBarMetrics.ctaSlotWidth + TabBarMetrics.itemGap : 0)
|
|
88
128
|
}
|
|
89
129
|
|
|
90
130
|
var body: some View {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
131
|
+
let shape = NotchedBarShape(radius: TabBarMetrics.height / 2, notchCenterX: cta == nil ? nil : width / 2)
|
|
132
|
+
ZStack(alignment: .top) {
|
|
133
|
+
ZStack(alignment: .topLeading) {
|
|
134
|
+
ActiveIndicator(radius: TabBarMetrics.indicatorRadius)
|
|
135
|
+
.frame(width: itemWidth, height: TabBarMetrics.indicatorHeight)
|
|
136
|
+
.offset(x: itemX(selectedIndex), y: TabBarMetrics.paddingVertical)
|
|
137
|
+
.animation(TabBarMetrics.indicatorMotion, value: selectedIndex)
|
|
138
|
+
|
|
139
|
+
HStack(spacing: TabBarMetrics.itemGap) {
|
|
140
|
+
ForEach(items.indices, id: \.self) { index in
|
|
141
|
+
if cta != nil && index == items.count / 2 {
|
|
142
|
+
Color.clear.frame(width: TabBarMetrics.ctaSlotWidth)
|
|
143
|
+
}
|
|
144
|
+
SwiftUI.Button { onTabSelected(index) } label: {
|
|
145
|
+
VStack(spacing: TabBarMetrics.itemIconLabelGap) {
|
|
146
|
+
TabItemContent(item: items[index], selected: index == selectedIndex)
|
|
147
|
+
}
|
|
148
|
+
.frame(width: itemWidth)
|
|
149
|
+
.contentShape(Rectangle())
|
|
150
|
+
}
|
|
151
|
+
.buttonStyle(.plain)
|
|
152
|
+
.accessibilityLabel(items[index].label)
|
|
153
|
+
.accessibilityAddTraits(index == selectedIndex ? .isSelected : [])
|
|
154
|
+
}
|
|
101
155
|
}
|
|
156
|
+
.padding(.horizontal, TabBarMetrics.paddingHorizontal)
|
|
157
|
+
.padding(.vertical, TabBarMetrics.paddingVertical)
|
|
102
158
|
}
|
|
103
|
-
.frame(
|
|
104
|
-
.
|
|
105
|
-
.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
RoundedRectangle(cornerRadius: 2)
|
|
109
|
-
.fill(theme.colors.primary)
|
|
110
|
-
.frame(width: 44, height: 2)
|
|
111
|
-
.offset(x: indicatorOffset, y: -BOTTOM_TAB_BAR_HEIGHT + 2)
|
|
112
|
-
.animation(.easeInOut(duration: 0.25), value: selectedIndex)
|
|
113
|
-
|
|
114
|
-
// Top shadow.
|
|
115
|
-
LinearGradient(
|
|
116
|
-
colors: [Color.black.opacity(0.05), .clear],
|
|
117
|
-
startPoint: .bottom,
|
|
118
|
-
endPoint: .top
|
|
119
|
-
)
|
|
120
|
-
.frame(height: 6)
|
|
121
|
-
.frame(maxWidth: .infinity)
|
|
122
|
-
.offset(y: -BOTTOM_TAB_BAR_HEIGHT)
|
|
159
|
+
.frame(width: width, height: TabBarMetrics.height, alignment: .topLeading)
|
|
160
|
+
.modifier(TabBarContainer(shape: shape))
|
|
161
|
+
.accessibilityElement(children: .contain)
|
|
162
|
+
.accessibilityIdentifier("bottom_tab_bar")
|
|
163
|
+
.padding(.top, cta == nil ? 0 : TabBarMetrics.ctaLift)
|
|
123
164
|
|
|
124
|
-
if let
|
|
125
|
-
|
|
165
|
+
if let cta {
|
|
166
|
+
CenterAction(data: cta)
|
|
167
|
+
.offset(y: centerActionTop)
|
|
126
168
|
}
|
|
127
169
|
}
|
|
170
|
+
.frame(width: width)
|
|
128
171
|
}
|
|
129
172
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
173
|
+
/// Offset of the center action column from the bar top: the items sit at the top of the container
|
|
174
|
+
/// (which starts ctaLift down), so the column is placed for its label to start on the tab labels' line.
|
|
175
|
+
private var centerActionTop: CGFloat {
|
|
176
|
+
let itemLabelTop = TabBarMetrics.ctaLift + TabBarMetrics.paddingVertical
|
|
177
|
+
+ TabBarMetrics.indicatorHeight + TabBarMetrics.itemIconLabelGap
|
|
178
|
+
return itemLabelTop - TabBarMetrics.ctaLabelGap - TabBarMetrics.ctaSize
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/// One active indicator per bar: Background/tonal with its inner light (white 12% from below) and
|
|
183
|
+
/// tint (primary 12% from above).
|
|
184
|
+
struct ActiveIndicator: View {
|
|
185
|
+
let radius: CGFloat
|
|
186
|
+
|
|
187
|
+
@Environment(\.appTheme) private var theme
|
|
188
|
+
|
|
189
|
+
var body: some View {
|
|
190
|
+
let shape = RoundedRectangle(cornerRadius: radius)
|
|
191
|
+
shape
|
|
192
|
+
.fill(theme.colors.background.tonal)
|
|
193
|
+
// inner shadows: primary 12% falling 1 from the top edge, white 12% rising 2 from the bottom one
|
|
194
|
+
.overlay(
|
|
195
|
+
LinearGradient(
|
|
196
|
+
stops: [
|
|
197
|
+
.init(color: theme.colors.primary.opacity(0.12), location: 0),
|
|
198
|
+
.init(color: theme.colors.primary.opacity(0), location: 0.1),
|
|
199
|
+
.init(color: Color.white.opacity(0), location: 0.85),
|
|
200
|
+
.init(color: Color.white.opacity(0.12), location: 1),
|
|
201
|
+
],
|
|
202
|
+
startPoint: .top,
|
|
203
|
+
endPoint: .bottom
|
|
204
|
+
)
|
|
205
|
+
.clipShape(shape)
|
|
137
206
|
)
|
|
138
|
-
.
|
|
139
|
-
}
|
|
207
|
+
.allowsHitTesting(false)
|
|
140
208
|
}
|
|
141
209
|
}
|
|
142
210
|
|
|
143
211
|
// MARK: - Tab item
|
|
144
212
|
|
|
145
|
-
|
|
213
|
+
/// Icon in its indicator slot, label under it. The bar slides one shared active indicator behind the
|
|
214
|
+
/// slots; the icon and label tint cross-fade on focus.
|
|
215
|
+
struct TabItemContent: View {
|
|
146
216
|
let item: BottomTabItem
|
|
147
217
|
let selected: Bool
|
|
148
|
-
|
|
218
|
+
var vertical = false
|
|
219
|
+
var showLabel = true
|
|
149
220
|
|
|
150
221
|
@Environment(\.appTheme) private var theme
|
|
151
222
|
|
|
152
|
-
|
|
223
|
+
var body: some View {
|
|
224
|
+
TabIcon(item: item, selected: selected, vertical: vertical)
|
|
225
|
+
.frame(height: vertical ? TabBarMetrics.railIndicatorHeight : TabBarMetrics.indicatorHeight)
|
|
226
|
+
if showLabel {
|
|
227
|
+
ZStack {
|
|
228
|
+
labelText(theme.colors.text.secondary).opacity(selected ? 0 : 1)
|
|
229
|
+
labelText(theme.colors.primary).opacity(selected ? 1 : 0)
|
|
230
|
+
}
|
|
231
|
+
.animation(TabBarMetrics.tintMotion, value: selected)
|
|
232
|
+
.frame(maxWidth: vertical ? nil : .infinity)
|
|
233
|
+
// fixed slot so a capped-scale label overflows downward and the icon above it stays put
|
|
234
|
+
.frame(
|
|
235
|
+
height: vertical ? TabBarMetrics.railLabelHeight : TabBarMetrics.labelHeight,
|
|
236
|
+
alignment: .top
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
}
|
|
153
240
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
241
|
+
private func labelText(_ color: Color) -> some View {
|
|
242
|
+
MomoText(
|
|
243
|
+
item.label,
|
|
244
|
+
typography: vertical ? .labelXsMedium : .labelSMedium,
|
|
245
|
+
color: color,
|
|
246
|
+
textAlign: .center,
|
|
247
|
+
maxLines: 1
|
|
248
|
+
)
|
|
249
|
+
.truncationMode(.tail)
|
|
159
250
|
}
|
|
251
|
+
}
|
|
160
252
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
253
|
+
/// Badge value shown on a tab: nil hides it, "" is a dot, numbers cap at 99+ ("0" hides it, RN parity).
|
|
254
|
+
func tabBadgeLabel(_ item: BottomTabItem) -> String? {
|
|
255
|
+
guard let label = item.badgeLabel else { return item.showDot ? "" : nil }
|
|
256
|
+
if label.isEmpty { return "" }
|
|
257
|
+
if label.allSatisfy({ ("0"..."9").contains($0) }) {
|
|
258
|
+
let value = Int(label) ?? Int.max
|
|
259
|
+
if value == 0 { return item.showDot ? "" : nil }
|
|
260
|
+
return value > 99 ? "99+" : label
|
|
261
|
+
}
|
|
262
|
+
return label
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/// 24 icon, active and inactive tints cross-faded; badges hang off it: dot at 16/-2, label badge at
|
|
266
|
+
/// 12/-7 growing right, or centered over the icon at -10 on the rail.
|
|
267
|
+
struct TabIcon: View {
|
|
268
|
+
let item: BottomTabItem
|
|
269
|
+
let selected: Bool
|
|
270
|
+
var vertical = false
|
|
271
|
+
|
|
272
|
+
@Environment(\.appTheme) private var theme
|
|
178
273
|
|
|
179
|
-
|
|
180
|
-
|
|
274
|
+
var body: some View {
|
|
275
|
+
ZStack {
|
|
276
|
+
Icon(source: item.icon, size: TabBarMetrics.iconSize, color: theme.colors.text.secondary)
|
|
277
|
+
.opacity(selected ? 0 : 1)
|
|
278
|
+
Icon(source: item.icon, size: TabBarMetrics.iconSize, color: theme.colors.primary)
|
|
279
|
+
.opacity(selected ? 1 : 0)
|
|
280
|
+
}
|
|
281
|
+
.animation(TabBarMetrics.tintMotion, value: selected)
|
|
282
|
+
.frame(width: TabBarMetrics.iconSize, height: TabBarMetrics.iconSize)
|
|
283
|
+
.overlay(alignment: vertical ? .top : .topLeading) {
|
|
284
|
+
if let badge = tabBadgeLabel(item) {
|
|
285
|
+
if badge.isEmpty {
|
|
181
286
|
BadgeDot(size: .small)
|
|
182
|
-
.offset(x: -
|
|
287
|
+
.offset(x: vertical ? 16 - (TabBarMetrics.iconSize - 10) / 2 : 16, y: -Spacing.XXS)
|
|
183
288
|
} else {
|
|
184
|
-
|
|
185
|
-
.
|
|
289
|
+
TabBadge(label: badge)
|
|
290
|
+
.fixedSize()
|
|
291
|
+
.frame(width: TabBarMetrics.badgeMaxWidth, alignment: vertical ? .center : .leading)
|
|
292
|
+
.offset(x: vertical ? 0 : Spacing.M, y: vertical ? -10 : -7)
|
|
186
293
|
}
|
|
187
|
-
} else if item.showDot {
|
|
188
|
-
BadgeDot(size: .small)
|
|
189
|
-
.offset(x: -Spacing.S, y: Spacing.XS)
|
|
190
294
|
}
|
|
191
295
|
}
|
|
192
|
-
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
193
|
-
.padding(.horizontal, Spacing.XXS)
|
|
194
|
-
.contentShape(Rectangle())
|
|
195
|
-
.onTapGesture { onClick() }
|
|
196
296
|
}
|
|
197
297
|
}
|
|
198
298
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
private struct
|
|
202
|
-
let
|
|
299
|
+
/// Numbers use the error color, text the warning color (Figma Badge round numeric / text); the text
|
|
300
|
+
/// keeps its design size so it fits the 16 height on the Duo displays too.
|
|
301
|
+
private struct TabBadge: View {
|
|
302
|
+
let label: String
|
|
203
303
|
|
|
204
304
|
@Environment(\.appTheme) private var theme
|
|
205
305
|
|
|
306
|
+
private var isNumber: Bool {
|
|
307
|
+
let digits = label.hasSuffix("+") ? String(label.dropLast()) : label
|
|
308
|
+
return !digits.isEmpty && digits.allSatisfy { ("0"..."9").contains($0) }
|
|
309
|
+
}
|
|
310
|
+
|
|
206
311
|
var body: some View {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
312
|
+
MomoText(label, typography: .actionXxsBold, color: Colors.black01, maxLines: 1)
|
|
313
|
+
.truncationMode(.tail)
|
|
314
|
+
.scaleSizeMaxRate(1)
|
|
315
|
+
.padding(.horizontal, Spacing.XS)
|
|
316
|
+
.frame(minWidth: 16, maxWidth: TabBarMetrics.badgeMaxWidth, minHeight: 16, maxHeight: 16)
|
|
317
|
+
.background(Capsule().fill(isNumber ? theme.colors.error.primary : theme.colors.warning.primary))
|
|
318
|
+
.overlay(Capsule().strokeBorder(theme.colors.background.surface, lineWidth: 1))
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// MARK: - Center action
|
|
323
|
+
|
|
324
|
+
/// Center action press: the button shrinks while held; the label stays plain text.
|
|
325
|
+
struct CenterActionStyle: ButtonStyle {
|
|
326
|
+
let size: CGFloat
|
|
327
|
+
let vertical: Bool
|
|
328
|
+
let icon: String
|
|
329
|
+
var iconContent: AnyView? = nil
|
|
330
|
+
var labelContent: AnyView? = nil
|
|
331
|
+
let label: String
|
|
332
|
+
|
|
333
|
+
@Environment(\.appTheme) private var theme
|
|
334
|
+
|
|
335
|
+
func makeBody(configuration: Configuration) -> some View {
|
|
336
|
+
let pressed = configuration.isPressed
|
|
337
|
+
VStack(spacing: vertical ? TabBarMetrics.railCtaLabelGap : TabBarMetrics.ctaLabelGap) {
|
|
338
|
+
ZStack {
|
|
339
|
+
// Figma Effect/Popover, one layer per shadow, spread as a shrunk circle:
|
|
340
|
+
// 8% y8 blur 24 spread -12, 4% y12 blur 32 spread -16
|
|
341
|
+
Circle().inset(by: 12).fill(theme.colors.primary)
|
|
342
|
+
.shadow(color: Color.black.opacity(0.08), radius: 12, x: 0, y: 8)
|
|
343
|
+
Circle().inset(by: 16).fill(theme.colors.primary)
|
|
344
|
+
.shadow(color: Color.black.opacity(0.04), radius: 16, x: 0, y: 12)
|
|
345
|
+
Circle().fill(theme.colors.primary)
|
|
346
|
+
// Figma Icon Button border: white 60% hairline
|
|
347
|
+
.overlay(Circle().stroke(Color.white.opacity(TabBarMetrics.ctaBorderOpacity), lineWidth: 1))
|
|
348
|
+
if let iconContent {
|
|
349
|
+
// custom content (e.g. an oversized Lottie) is clipped to the round button
|
|
350
|
+
iconContent
|
|
351
|
+
.frame(width: size, height: size)
|
|
352
|
+
.clipShape(Circle())
|
|
353
|
+
} else {
|
|
354
|
+
Icon(source: icon, size: TabBarMetrics.ctaIconSize, color: Colors.black01)
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
.frame(width: size, height: size)
|
|
358
|
+
.scaleEffect(pressed ? TabBarMetrics.ctaPressedScale : 1)
|
|
359
|
+
.animation(TabBarMetrics.ctaPressMotion, value: pressed)
|
|
360
|
+
MomoText(
|
|
361
|
+
label,
|
|
362
|
+
typography: vertical ? .labelXsMedium : .labelSMedium,
|
|
363
|
+
color: theme.colors.text.secondary,
|
|
364
|
+
textAlign: .center,
|
|
365
|
+
maxLines: 1
|
|
366
|
+
)
|
|
367
|
+
.truncationMode(.tail)
|
|
368
|
+
.padding(.horizontal, vertical ? Spacing.XS : Spacing.XXS)
|
|
369
|
+
.frame(minHeight: vertical ? nil : TabBarMetrics.ctaLabelHeight)
|
|
370
|
+
.overlay(labelContent?.allowsHitTesting(false))
|
|
219
371
|
}
|
|
220
|
-
|
|
221
|
-
.
|
|
222
|
-
.padding(.vertical, Spacing.S)
|
|
372
|
+
// the whole slot is the hit area, not just the button and label
|
|
373
|
+
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
|
|
223
374
|
.contentShape(Rectangle())
|
|
224
|
-
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/// Center action (.Nav/CTA): button rising out of the notch, label under it.
|
|
379
|
+
private struct CenterAction: View {
|
|
380
|
+
let data: BottomTabFloatingButton
|
|
381
|
+
|
|
382
|
+
var body: some View {
|
|
383
|
+
SwiftUI.Button(action: data.onPress) { EmptyView() }
|
|
384
|
+
.buttonStyle(CenterActionStyle(size: TabBarMetrics.ctaSize, vertical: false, icon: data.icon,
|
|
385
|
+
iconContent: data.iconContent, labelContent: data.labelContent,
|
|
386
|
+
label: data.label))
|
|
387
|
+
.frame(width: TabBarMetrics.ctaSlotWidth, height: TabBarMetrics.ctaSize + TabBarMetrics.ctaLabelGap + TabBarMetrics.ctaLabelHeight)
|
|
388
|
+
.accessibilityLabel(data.label)
|
|
389
|
+
.accessibilityIdentifier(data.label)
|
|
225
390
|
}
|
|
226
391
|
}
|
|
@@ -1,65 +1,63 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// MoMoUIKits
|
|
4
|
-
//
|
|
5
|
-
// SwiftUI mirror of Compose's `CurvedContainer` (navigation/bottomtab/CurvedContainer.kt).
|
|
6
|
-
// Draws the surface-colored notch that sits behind the center floating button,
|
|
7
|
-
// carving a circular cut-out into the tab bar's top edge.
|
|
8
|
-
//
|
|
1
|
+
// SwiftUI mirror of Compose's `CurvedContainer.kt`: the navigation bar container shape, a rounded
|
|
2
|
+
// rectangle with a notch cut into the top edge around the center action, and its floating shadow.
|
|
9
3
|
|
|
10
4
|
import SwiftUI
|
|
11
5
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var height: CGFloat = 16
|
|
18
|
-
var color: Color = Colors.black01
|
|
6
|
+
/// Rounded container, with the notch dipped into the top edge around `notchCenterX` (from the
|
|
7
|
+
/// leading edge).
|
|
8
|
+
struct NotchedBarShape: Shape {
|
|
9
|
+
var radius: CGFloat
|
|
10
|
+
var notchCenterX: CGFloat?
|
|
19
11
|
|
|
20
|
-
|
|
21
|
-
let
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
let
|
|
12
|
+
func path(in rect: CGRect) -> Path {
|
|
13
|
+
let r = min(radius, rect.height / 2, rect.width / 2)
|
|
14
|
+
guard let cx = notchCenterX else {
|
|
15
|
+
return Path(roundedRect: rect, cornerRadius: r)
|
|
16
|
+
}
|
|
17
|
+
let w = rect.width
|
|
18
|
+
let h = rect.height
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
.
|
|
20
|
+
var path = Path()
|
|
21
|
+
path.move(to: CGPoint(x: r, y: 0))
|
|
22
|
+
path.addLine(to: CGPoint(x: cx - TabBarMetrics.notchHalfWidth, y: 0))
|
|
23
|
+
for curve in TabBarMetrics.notchCurves {
|
|
24
|
+
path.addCurve(
|
|
25
|
+
to: CGPoint(x: cx + curve[2].x, y: curve[2].y),
|
|
26
|
+
control1: CGPoint(x: cx + curve[0].x, y: curve[0].y),
|
|
27
|
+
control2: CGPoint(x: cx + curve[1].x, y: curve[1].y)
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
path.addLine(to: CGPoint(x: w - r, y: 0))
|
|
31
|
+
path.addRelativeArc(center: CGPoint(x: w - r, y: r), radius: r, startAngle: .degrees(-90), delta: .degrees(90))
|
|
32
|
+
path.addLine(to: CGPoint(x: w, y: h - r))
|
|
33
|
+
path.addRelativeArc(center: CGPoint(x: w - r, y: h - r), radius: r, startAngle: .degrees(0), delta: .degrees(90))
|
|
34
|
+
path.addLine(to: CGPoint(x: r, y: h))
|
|
35
|
+
path.addRelativeArc(center: CGPoint(x: r, y: h - r), radius: r, startAngle: .degrees(90), delta: .degrees(90))
|
|
36
|
+
path.addLine(to: CGPoint(x: 0, y: r))
|
|
37
|
+
path.addRelativeArc(center: CGPoint(x: r, y: r), radius: r, startAngle: .degrees(180), delta: .degrees(90))
|
|
38
|
+
path.closeSubpath()
|
|
39
|
+
return path.offsetBy(dx: rect.minX, dy: rect.minY)
|
|
32
40
|
}
|
|
33
41
|
}
|
|
34
42
|
|
|
35
|
-
///
|
|
36
|
-
///
|
|
37
|
-
|
|
38
|
-
let
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
path.addCurve(
|
|
54
|
-
to: CGPoint(x: centerX + circleOverR + 40, y: circleOverTop),
|
|
55
|
-
control1: CGPoint(x: centerX + circleOverR, y: 0),
|
|
56
|
-
control2: CGPoint(x: centerX + circleOverR, y: circleOverTop)
|
|
43
|
+
/// Translucent fill (Figma .Nav/Background) with the shadow following the shape. Shadows go over the fill, as opaque
|
|
44
|
+
/// layers under it would make the glass solid (compositingGroup keeps the first from being re-cast).
|
|
45
|
+
struct TabBarContainer<S: Shape>: ViewModifier {
|
|
46
|
+
let shape: S
|
|
47
|
+
|
|
48
|
+
@Environment(\.appTheme) private var theme
|
|
49
|
+
|
|
50
|
+
func body(content: Content) -> some View {
|
|
51
|
+
content.background(
|
|
52
|
+
shape
|
|
53
|
+
.fill(theme.colors.background.surface.opacity(TabBarMetrics.backgroundOpacity))
|
|
54
|
+
// Figma .Nav/Background: 1px light-gray hairline defining the pill edge
|
|
55
|
+
.overlay(shape.stroke(theme.colors.border.default, lineWidth: 1))
|
|
56
|
+
.compositingGroup()
|
|
57
|
+
// Figma Shadow/floating: 12% blur 24, then 4% blur 32 spread -16 offset y12
|
|
58
|
+
.shadow(color: Color.black.opacity(0.12), radius: 12)
|
|
59
|
+
.shadow(color: Color.black.opacity(0.04), radius: 16, x: 0, y: 12)
|
|
60
|
+
.allowsHitTesting(false)
|
|
57
61
|
)
|
|
58
|
-
|
|
59
|
-
path.addLine(to: CGPoint(x: width, y: circleOverTop))
|
|
60
|
-
path.addLine(to: CGPoint(x: width, y: 60))
|
|
61
|
-
path.addLine(to: CGPoint(x: 0, y: 60))
|
|
62
|
-
path.closeSubpath()
|
|
63
|
-
return path
|
|
64
62
|
}
|
|
65
63
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// MoMoUIKits
|
|
4
|
-
//
|
|
5
|
-
// Port of RN `BottomTab/DuoBarCompression.tsx` (HIG, Designing for iPhone Duo: Vertical controls):
|
|
6
|
-
// keeps the side bar's toolbar and tab bar clear of each other.
|
|
7
|
-
//
|
|
1
|
+
// Port of RN `BottomTab/DuoBarCompression.tsx` (HIG, Designing for iPhone Duo: Vertical controls):
|
|
2
|
+
// keeps the side bar's toolbar and tab bar clear of each other.
|
|
8
3
|
|
|
9
4
|
import SwiftUI
|
|
10
5
|
|
|
11
|
-
/// iPhone Duo: which side bar
|
|
6
|
+
/// iPhone Duo: which of the side bar's bars starts compressed when the strip cannot hold both whole.
|
|
12
7
|
public enum DuoBarCompressionBehavior {
|
|
13
8
|
case toolbar, tabBar
|
|
14
9
|
}
|
|
@@ -36,10 +31,8 @@ struct DuoBarCompression {
|
|
|
36
31
|
/// Back, then the single button the toolbar folds into.
|
|
37
32
|
private static let compressedToolbarHeight = 2 * DuoMetrics.controlSize + Spacing.M
|
|
38
33
|
|
|
39
|
-
///
|
|
40
|
-
///
|
|
41
|
-
/// - otherwise both rest compressed; tapping one opens it for a moment (the rail closes
|
|
42
|
-
/// again once a tab is picked)
|
|
34
|
+
/// Both fit: both whole. One fits beside the other compressed: it is compressed and a tap swaps them. Otherwise
|
|
35
|
+
/// both rest compressed and a tap opens one for a moment (the rail closes again once a tab is picked).
|
|
43
36
|
static func resolve(
|
|
44
37
|
layout: ScreenLayout,
|
|
45
38
|
tabCount: Int,
|