@momo-kits/native-kits 0.169.8-beta.7 → 0.169.8-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/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +198 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +19 -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 +1067 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +267 -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 +82 -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 +356 -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 +482 -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 +224 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +137 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +473 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +113 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +263 -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 +228 -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 +183 -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 +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +82 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +39 -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 +307 -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 +88 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +306 -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 +457 -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 +205 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +89 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +542 -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 +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +201 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -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 +210 -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 +12 -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 +292 -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 +184 -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 +397 -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 +727 -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 +242 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +391 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +100 -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 +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +132 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +167 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +456 -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 +204 -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 +114 -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 +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 +144 -0
- package/gradle/libs.versions.toml +67 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +24 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/Input/InputSearch.swift +6 -23
- package/ios/Navigation/BottomTab/BottomTabBar.swift +0 -9
- package/ios/Navigation/Component/Header.swift +46 -31
- package/ios/Navigation/Component/HeaderJourney.swift +1 -2
- package/ios/Navigation/Component/HeaderLocation.swift +1 -2
- package/ios/Navigation/Component/HeaderRight.swift +15 -18
- package/ios/Navigation/Component/HeaderUser.swift +1 -2
- package/ios/Navigation/Component/SideBar.swift +13 -4
- package/ios/Navigation/Navigation.swift +1 -31
- package/ios/Navigation/StackScreen.swift +14 -43
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/README.md +120 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +2 -11
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +1 -13
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +0 -11
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +1 -1
- package/package.json +1 -1
- package/settings.gradle.kts +64 -0
- package/ios/Layout/HeaderLayout.swift +0 -60
|
@@ -166,19 +166,10 @@ struct HorizontalTabBar: View {
|
|
|
166
166
|
|
|
167
167
|
if let cta {
|
|
168
168
|
CenterAction(data: cta)
|
|
169
|
-
.offset(y: centerActionTop)
|
|
170
169
|
}
|
|
171
170
|
}
|
|
172
171
|
.frame(width: width)
|
|
173
172
|
}
|
|
174
|
-
|
|
175
|
-
/// Offset of the center action column from the bar top: the items sit at the top of the container
|
|
176
|
-
/// (which starts ctaLift down), so the column is placed for its label to start on the tab labels' line.
|
|
177
|
-
private var centerActionTop: CGFloat {
|
|
178
|
-
let itemLabelTop = TabBarMetrics.ctaLift + TabBarMetrics.paddingVertical
|
|
179
|
-
+ TabBarMetrics.indicatorHeight + TabBarMetrics.itemIconLabelGap
|
|
180
|
-
return itemLabelTop - TabBarMetrics.ctaLabelGap - TabBarMetrics.ctaSize
|
|
181
|
-
}
|
|
182
173
|
}
|
|
183
174
|
|
|
184
175
|
/// One active indicator per bar: Background/tonal with its inner light (white 12% from below) and
|
|
@@ -6,9 +6,10 @@ import SwiftUI
|
|
|
6
6
|
/// Header bar height, mirrors Compose's `HEADER_HEIGHT`.
|
|
7
7
|
public let HEADER_HEIGHT: CGFloat = 52
|
|
8
8
|
|
|
9
|
-
/// Room the back button
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/// Room the back button and toolkit take from the bar (Compose `HEADER_ACTIONS_WIDTH`).
|
|
10
|
+
let headerActionsWidth: CGFloat = 172
|
|
11
|
+
// Extra width the 48pt back and toolkit take on the iPhone Duo status bar row.
|
|
12
|
+
private let statusBarRowActionsExtra: CGFloat = 55
|
|
12
13
|
|
|
13
14
|
public enum TitlePosition {
|
|
14
15
|
case left, center
|
|
@@ -23,19 +24,15 @@ public struct AnimatedHeader {
|
|
|
23
24
|
public var aspectRatio: AnimatedHeaderRatio = .ratio16_9
|
|
24
25
|
public var isSurface: Bool = true
|
|
25
26
|
public var composable: (_ scrollState: CGFloat) -> AnyView = { _ in AnyView(EmptyView()) }
|
|
26
|
-
/// Wide windows: fills the sides of the phone-sized banner, fading out downward.
|
|
27
|
-
public var bannerBackgroundColor: Color?
|
|
28
27
|
|
|
29
28
|
public init(
|
|
30
29
|
aspectRatio: AnimatedHeaderRatio = .ratio16_9,
|
|
31
30
|
isSurface: Bool = true,
|
|
32
|
-
composable: @escaping (_ scrollState: CGFloat) -> AnyView = { _ in AnyView(EmptyView()) }
|
|
33
|
-
bannerBackgroundColor: Color? = nil
|
|
31
|
+
composable: @escaping (_ scrollState: CGFloat) -> AnyView = { _ in AnyView(EmptyView()) }
|
|
34
32
|
) {
|
|
35
33
|
self.aspectRatio = aspectRatio
|
|
36
34
|
self.isSurface = isSurface
|
|
37
35
|
self.composable = composable
|
|
38
|
-
self.bannerBackgroundColor = bannerBackgroundColor
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
38
|
|
|
@@ -289,10 +286,10 @@ func headerSearchProps(
|
|
|
289
286
|
}
|
|
290
287
|
|
|
291
288
|
/// Max title width: back button and toolkit share the bar unless the iPhone Duo side bar holds them.
|
|
292
|
-
func headerTitleMaxWidth(_ layout: ScreenLayout
|
|
289
|
+
func headerTitleMaxWidth(_ layout: ScreenLayout) -> CGFloat {
|
|
293
290
|
let clearance = layout.statusBarClearance.map { $0.left + $0.right } ?? 0
|
|
294
291
|
if layout.sideBar != nil { return layout.contentWidth - Spacing.M * 2 - clearance }
|
|
295
|
-
return layout.
|
|
292
|
+
return layout.width - headerActionsWidth - (layout.statusBarClearance != nil ? statusBarRowActionsExtra : 0) - clearance
|
|
296
293
|
}
|
|
297
294
|
|
|
298
295
|
// MARK: - Header
|
|
@@ -342,21 +339,21 @@ public struct NavigationHeader: View {
|
|
|
342
339
|
}
|
|
343
340
|
|
|
344
341
|
@Environment(\.screenLayout) private var layout
|
|
345
|
-
@Environment(\.contentLayout) private var contentLayout
|
|
346
342
|
@Environment(\.appTheme) private var theme
|
|
347
343
|
@OptionalEnvironmentObject private var navigator: Navigator?
|
|
348
344
|
@State private var headerRightWidth: CGFloat = 0
|
|
349
345
|
|
|
350
|
-
private var headerLayout: HeaderLayout { layout.headerLayout(contentLayout) }
|
|
351
|
-
|
|
352
346
|
/// iPhone Duo side bar holds back and the toolkit; a custom header right stays in the bar.
|
|
353
347
|
private var useSideBar: Bool { layout.sideBar != nil }
|
|
354
348
|
|
|
349
|
+
/// iPhone Duo inner portrait: the row sits on the status bar, between its clusters, with 48pt controls.
|
|
350
|
+
private var statusBarRow: Bool { layout.statusBarClearance != nil && !useSideBar }
|
|
351
|
+
|
|
355
352
|
/// Max centered title width; on the status bar row the clusters are lopsided, so both sides
|
|
356
353
|
/// keep the wider one's room.
|
|
357
354
|
private var centerTitleMaxWidth: CGFloat {
|
|
358
|
-
guard let clearance = layout.statusBarClearance else { return
|
|
359
|
-
let back = goBack == nil || useSideBar ? 0 :
|
|
355
|
+
guard let clearance = layout.statusBarClearance else { return (layout.contentWidth - Spacing.M * 2) / 2 }
|
|
356
|
+
let back = goBack == nil || useSideBar ? 0 : DuoMetrics.controlSize + Spacing.S
|
|
360
357
|
let inset = max(clearance.left + back, clearance.right + headerRightWidth) + Spacing.S
|
|
361
358
|
return max(layout.contentWidth - (Spacing.M + inset) * 2, 0)
|
|
362
359
|
}
|
|
@@ -381,8 +378,17 @@ public struct NavigationHeader: View {
|
|
|
381
378
|
ZStack {
|
|
382
379
|
HStack(spacing: 0) {
|
|
383
380
|
if let goBack, !useSideBar {
|
|
384
|
-
|
|
385
|
-
|
|
381
|
+
if statusBarRow {
|
|
382
|
+
SideBarButton(
|
|
383
|
+
icon: "arrow-back",
|
|
384
|
+
headerColor: headerColor,
|
|
385
|
+
accessibilityId: "btn_navigation_back",
|
|
386
|
+
action: goBack
|
|
387
|
+
)
|
|
388
|
+
} else {
|
|
389
|
+
BackButton(color: headerColor, onBack: goBack)
|
|
390
|
+
}
|
|
391
|
+
Spacer().frame(width: Spacing.S)
|
|
386
392
|
}
|
|
387
393
|
|
|
388
394
|
if centerTitle {
|
|
@@ -393,23 +399,33 @@ public struct NavigationHeader: View {
|
|
|
393
399
|
}
|
|
394
400
|
|
|
395
401
|
if let headerRight, !(useSideBar && toolkitHeaderRight(headerRight) != nil) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
402
|
+
Group {
|
|
403
|
+
if statusBarRow, let toolkit = toolkitHeaderRight(headerRight) {
|
|
404
|
+
Toolkit(
|
|
405
|
+
headerRight: toolkit.data ?? HeaderRightData(),
|
|
406
|
+
tintColor: toolkit.tintColor,
|
|
407
|
+
layout: .sideBarRow
|
|
408
|
+
)
|
|
409
|
+
} else {
|
|
410
|
+
AnyView(headerRight())
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
.environment(\.headerColor, headerColor)
|
|
414
|
+
.background(
|
|
415
|
+
GeometryReader { geo in
|
|
416
|
+
Color.clear.preference(key: HeaderRightWidthKey.self, value: geo.size.width)
|
|
417
|
+
}
|
|
418
|
+
)
|
|
403
419
|
}
|
|
404
420
|
}
|
|
405
|
-
.padding(.leading,
|
|
406
|
-
.padding(.trailing,
|
|
421
|
+
.padding(.leading, Spacing.M + (layout.statusBarClearance?.left ?? 0))
|
|
422
|
+
.padding(.trailing, Spacing.M + (layout.statusBarClearance?.right ?? 0))
|
|
407
423
|
|
|
408
424
|
if centerTitle {
|
|
409
425
|
titleArea(centered: true)
|
|
410
426
|
// Compose caps a centered title at half the bar
|
|
411
427
|
.frame(maxWidth: centerTitleMaxWidth)
|
|
412
|
-
.padding(.horizontal,
|
|
428
|
+
.padding(.horizontal, Spacing.M)
|
|
413
429
|
}
|
|
414
430
|
}
|
|
415
431
|
.onPreferenceChange(HeaderRightWidthKey.self) { headerRightWidth = $0 }
|
|
@@ -432,7 +448,6 @@ public struct NavigationHeader: View {
|
|
|
432
448
|
theme: theme,
|
|
433
449
|
pop: navigator.map { navigator in { navigator.pop() } }
|
|
434
450
|
))
|
|
435
|
-
.headerSize()
|
|
436
451
|
} else {
|
|
437
452
|
switch headerTitle {
|
|
438
453
|
case let .user(data)?:
|
|
@@ -486,7 +501,7 @@ struct HeaderBarBackground: View {
|
|
|
486
501
|
|
|
487
502
|
// MARK: - Back button
|
|
488
503
|
|
|
489
|
-
/// Mirrors Compose's `BackButton`: a
|
|
504
|
+
/// Mirrors Compose's `BackButton`: a 28pt circle with the back arrow.
|
|
490
505
|
private struct BackButton: View {
|
|
491
506
|
let color: HeaderColor
|
|
492
507
|
let onBack: () -> Void
|
|
@@ -496,8 +511,8 @@ private struct BackButton: View {
|
|
|
496
511
|
Circle()
|
|
497
512
|
.fill(color.backgroundButton)
|
|
498
513
|
.overlay(Circle().stroke(color.borderColor, lineWidth: 0.2))
|
|
499
|
-
.frame(width:
|
|
500
|
-
.overlay(Icon(source: "arrow-back", size:
|
|
514
|
+
.frame(width: 28, height: 28)
|
|
515
|
+
.overlay(Icon(source: "arrow-back", size: 20, color: color.tintIconColor))
|
|
501
516
|
}
|
|
502
517
|
.buttonStyle(ActiveOpacityButtonStyle())
|
|
503
518
|
.accessibilityIdentifier("btn_navigation_back")
|
|
@@ -13,7 +13,6 @@ public struct HeaderJourneyView: View {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
@Environment(\.screenLayout) private var layout
|
|
16
|
-
@Environment(\.contentLayout) private var contentLayout
|
|
17
16
|
|
|
18
17
|
public var body: some View {
|
|
19
18
|
if data.isLoading {
|
|
@@ -46,7 +45,7 @@ public struct HeaderJourneyView: View {
|
|
|
46
45
|
MomoText(description, typography: .descriptionXsRegular, color: tint, maxLines: 1)
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
.frame(maxWidth: headerTitleMaxWidth(layout
|
|
48
|
+
.frame(maxWidth: headerTitleMaxWidth(layout), alignment: .leading)
|
|
50
49
|
}
|
|
51
50
|
.buttonStyle(ActiveOpacityButtonStyle())
|
|
52
51
|
.disabled(data.onPress == nil)
|
|
@@ -13,7 +13,6 @@ public struct HeaderLocationView: View {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
@Environment(\.screenLayout) private var layout
|
|
16
|
-
@Environment(\.contentLayout) private var contentLayout
|
|
17
16
|
|
|
18
17
|
public var body: some View {
|
|
19
18
|
if data.isLoading {
|
|
@@ -35,7 +34,7 @@ public struct HeaderLocationView: View {
|
|
|
35
34
|
Icon(source: "16_arrow_chevron_down_small", size: 16, color: tint)
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
|
-
.frame(maxWidth: headerTitleMaxWidth(layout
|
|
37
|
+
.frame(maxWidth: headerTitleMaxWidth(layout), alignment: .leading)
|
|
39
38
|
}
|
|
40
39
|
.buttonStyle(ActiveOpacityButtonStyle())
|
|
41
40
|
.disabled(data.onPress == nil)
|
|
@@ -138,9 +138,9 @@ private struct NavigationButtonConfig {
|
|
|
138
138
|
let onPress: () -> Void
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
/// `sideBarColumn`: the iPhone Duo side bar
|
|
141
|
+
/// `sideBarColumn`: the iPhone Duo side bar; `sideBarRow`: the Duo header row on the status bar, same 48pt controls.
|
|
142
142
|
enum ToolkitLayout {
|
|
143
|
-
case bar, sideBarColumn
|
|
143
|
+
case bar, sideBarColumn, sideBarRow
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
struct Toolkit: View {
|
|
@@ -293,14 +293,16 @@ struct Toolkit: View {
|
|
|
293
293
|
case .bar:
|
|
294
294
|
horizontalBody
|
|
295
295
|
case .sideBarColumn:
|
|
296
|
-
VStack(spacing: Spacing.M) { sideBarControls }
|
|
296
|
+
VStack(spacing: Spacing.M) { sideBarControls(horizontal: false) }
|
|
297
|
+
case .sideBarRow:
|
|
298
|
+
HStack(spacing: Spacing.M) { sideBarControls(horizontal: true) }
|
|
297
299
|
}
|
|
298
300
|
}
|
|
299
301
|
.onAppear(perform: loadFavoriteState)
|
|
300
302
|
}
|
|
301
303
|
|
|
302
304
|
@ViewBuilder
|
|
303
|
-
private
|
|
305
|
+
private func sideBarControls(horizontal: Bool) -> some View {
|
|
304
306
|
let config = navigationButtonConfig
|
|
305
307
|
let useHelpCenter = usesHelpCenter(context)
|
|
306
308
|
if showsShortcut(headerRight, context) {
|
|
@@ -312,7 +314,7 @@ struct Toolkit: View {
|
|
|
312
314
|
action: config.onPress
|
|
313
315
|
)
|
|
314
316
|
}
|
|
315
|
-
SideBarGroup(headerColor: headerColor, itemCount: useHelpCenter ? 2 : 1) {
|
|
317
|
+
SideBarGroup(headerColor: headerColor, itemCount: useHelpCenter ? 2 : 1, horizontal: horizontal) {
|
|
316
318
|
if useHelpCenter {
|
|
317
319
|
SideBarGroupItem(
|
|
318
320
|
icon: "help_center",
|
|
@@ -352,30 +354,25 @@ struct Toolkit: View {
|
|
|
352
354
|
}
|
|
353
355
|
toolButton(icon: headerRight.closeIcon, accessibilityId: "btn_navigation_close", action: onPressClose)
|
|
354
356
|
}
|
|
355
|
-
.frame(
|
|
356
|
-
width: usesHelpCenter(context) ? HeaderLayoutMetrics.pillWidth : HeaderLayoutMetrics.buttonSize,
|
|
357
|
-
height: HeaderLayoutMetrics.buttonSize
|
|
358
|
-
)
|
|
357
|
+
.frame(width: usesHelpCenter(context) ? 65 : 28, height: 28)
|
|
359
358
|
.background(headerColor.backgroundButton)
|
|
360
|
-
.
|
|
361
|
-
.overlay(
|
|
359
|
+
.cornerRadius(14)
|
|
360
|
+
.overlay(RoundedRectangle(cornerRadius: 14).stroke(headerColor.borderColor, lineWidth: 0.2))
|
|
362
361
|
.padding(.leading, Spacing.S)
|
|
363
362
|
}
|
|
364
363
|
}
|
|
365
364
|
|
|
366
|
-
/// One half of the help / home pill; each half takes an equal share of the pill width.
|
|
367
365
|
private func toolButton(icon: String, accessibilityId: String, action: @escaping () -> Void) -> some View {
|
|
368
366
|
SwiftUI.Button(action: action) {
|
|
369
|
-
Icon(source: icon, size:
|
|
370
|
-
.
|
|
371
|
-
.contentShape(Rectangle())
|
|
367
|
+
Icon(source: icon, size: 20, color: headerColor.tintIconColor)
|
|
368
|
+
.padding(4)
|
|
372
369
|
}
|
|
373
370
|
.buttonStyle(ActiveOpacityButtonStyle())
|
|
374
371
|
.accessibilityIdentifier(accessibilityId)
|
|
375
372
|
}
|
|
376
373
|
}
|
|
377
374
|
|
|
378
|
-
/// Mirrors Compose's `NavigationButton`: the
|
|
375
|
+
/// Mirrors Compose's `NavigationButton`: the 28pt circular shortcut / more button.
|
|
379
376
|
public struct NavigationButton: View {
|
|
380
377
|
var disabled: Bool
|
|
381
378
|
var icon: String
|
|
@@ -408,9 +405,9 @@ public struct NavigationButton: View {
|
|
|
408
405
|
Circle()
|
|
409
406
|
.fill(colors.backgroundButton)
|
|
410
407
|
.overlay(Circle().stroke(colors.borderColor, lineWidth: 0.2))
|
|
411
|
-
Icon(source: icon, size:
|
|
408
|
+
Icon(source: icon, size: 20, color: colors.tintIconColor)
|
|
412
409
|
}
|
|
413
|
-
.frame(width:
|
|
410
|
+
.frame(width: 28, height: 28)
|
|
414
411
|
.overlay(alignment: .topTrailing) {
|
|
415
412
|
if showBadge {
|
|
416
413
|
BadgeDot(size: .small).offset(x: -Spacing.XXS, y: -Spacing.XXS)
|
|
@@ -13,7 +13,6 @@ public struct HeaderUserView: View {
|
|
|
13
13
|
private let avatarSize: CGFloat = Spacing.XXL // 32
|
|
14
14
|
|
|
15
15
|
@Environment(\.screenLayout) private var layout
|
|
16
|
-
@Environment(\.contentLayout) private var contentLayout
|
|
17
16
|
|
|
18
17
|
public var body: some View {
|
|
19
18
|
if data.isLoading {
|
|
@@ -68,7 +67,7 @@ public struct HeaderUserView: View {
|
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
|
-
.frame(maxWidth: headerTitleMaxWidth(layout
|
|
70
|
+
.frame(maxWidth: headerTitleMaxWidth(layout), alignment: .leading)
|
|
72
71
|
|
|
73
72
|
Spacer(minLength: 0)
|
|
74
73
|
}
|
|
@@ -137,17 +137,26 @@ struct SideBarButton: View {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
/// 48pt
|
|
140
|
+
/// 48pt glass capsule grouping related controls, one item per 50pt: vertical in the side bar,
|
|
141
|
+
/// horizontal on a header row.
|
|
141
142
|
struct SideBarGroup<Content: View>: View {
|
|
142
143
|
let headerColor: HeaderColor
|
|
143
144
|
let itemCount: Int
|
|
145
|
+
var horizontal: Bool = false
|
|
144
146
|
@ViewBuilder let content: () -> Content
|
|
145
147
|
|
|
146
148
|
var body: some View {
|
|
147
149
|
let length = itemCount > 1 ? DuoMetrics.itemPitch * CGFloat(itemCount) : DuoMetrics.controlSize
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
Group {
|
|
151
|
+
if horizontal {
|
|
152
|
+
HStack(spacing: 0) { content() }
|
|
153
|
+
.frame(width: length, height: DuoMetrics.controlSize)
|
|
154
|
+
} else {
|
|
155
|
+
VStack(spacing: 0) { content() }
|
|
156
|
+
.frame(width: DuoMetrics.controlSize, height: length)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
.modifier(SideBarGlass(headerColor: headerColor, shape: RoundedRectangle(cornerRadius: Radius.XL)))
|
|
151
160
|
}
|
|
152
161
|
}
|
|
153
162
|
|
|
@@ -14,9 +14,6 @@ public final class Navigation: ObservableObject {
|
|
|
14
14
|
private weak var registry: DynamicScreenRegistry?
|
|
15
15
|
/// What the footer (or navigation bar) takes from the window bottom; lifts snack bars.
|
|
16
16
|
var bottomObstruction: CGFloat = 0
|
|
17
|
-
/// A tab that pads itself asks (via `floatingTabBarEdgeToEdge()`) to run edge to edge behind the floating
|
|
18
|
-
/// bar and the home indicator; the kit then stops reserving that space. Compose's `bottomTabEdgeToEdge`.
|
|
19
|
-
@Published var bottomTabEdgeToEdge = false
|
|
20
17
|
|
|
21
18
|
init(
|
|
22
19
|
id: Int = -1,
|
|
@@ -87,8 +84,6 @@ public struct NavigationOptions {
|
|
|
87
84
|
public var inputSearchProps: InputSearchProps?
|
|
88
85
|
public var fabProps: FabProps?
|
|
89
86
|
public var onBackHandler: (() -> Void)?
|
|
90
|
-
/// Wide windows: `.stretch` puts the header row in the centered 600pt content frame.
|
|
91
|
-
public var contentLayout: ContentLayout
|
|
92
87
|
|
|
93
88
|
public init(
|
|
94
89
|
screenName: String? = nil,
|
|
@@ -117,8 +112,7 @@ public struct NavigationOptions {
|
|
|
117
112
|
layoutOffset: CGFloat = 56,
|
|
118
113
|
inputSearchProps: InputSearchProps? = nil,
|
|
119
114
|
fabProps: FabProps? = nil,
|
|
120
|
-
onBackHandler: (() -> Void)? = nil
|
|
121
|
-
contentLayout: ContentLayout = .grid
|
|
115
|
+
onBackHandler: (() -> Void)? = nil
|
|
122
116
|
) {
|
|
123
117
|
self.screenName = screenName
|
|
124
118
|
self.title = title
|
|
@@ -147,7 +141,6 @@ public struct NavigationOptions {
|
|
|
147
141
|
self.inputSearchProps = inputSearchProps
|
|
148
142
|
self.fabProps = fabProps
|
|
149
143
|
self.onBackHandler = onBackHandler
|
|
150
|
-
self.contentLayout = contentLayout
|
|
151
144
|
}
|
|
152
145
|
}
|
|
153
146
|
|
|
@@ -191,31 +184,8 @@ struct OptionsStackScreen: View {
|
|
|
191
184
|
layoutOffset: options.layoutOffset,
|
|
192
185
|
inputSearchProps: options.inputSearchProps,
|
|
193
186
|
fabProps: options.fabProps,
|
|
194
|
-
contentLayout: options.contentLayout,
|
|
195
187
|
screenName: screenName,
|
|
196
188
|
content: content
|
|
197
189
|
)
|
|
198
190
|
}
|
|
199
191
|
}
|
|
200
|
-
|
|
201
|
-
// MARK: - Edge-to-edge tab content
|
|
202
|
-
|
|
203
|
-
public extension View {
|
|
204
|
-
/// Compose's `floatingTabBarContentPadding()`: the content of a `BottomTab` tab runs edge to edge behind
|
|
205
|
-
/// the floating tab bar and the home indicator, and pads its own bottom (e.g. a full-screen native view
|
|
206
|
-
/// with its own safe area). No effect outside a tab.
|
|
207
|
-
func floatingTabBarEdgeToEdge() -> some View {
|
|
208
|
-
modifier(FloatingTabBarEdgeToEdge())
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
private struct FloatingTabBarEdgeToEdge: ViewModifier {
|
|
213
|
-
@OptionalEnvironmentObject private var navigation: Navigation?
|
|
214
|
-
|
|
215
|
-
func body(content: Content) -> some View {
|
|
216
|
-
content.onAppear {
|
|
217
|
-
guard let navigation, navigation.bottomTabIndex != -1, !navigation.bottomTabEdgeToEdge else { return }
|
|
218
|
-
navigation.bottomTabEdgeToEdge = true
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
@@ -34,7 +34,6 @@ public struct StackScreen<Content: View>: View {
|
|
|
34
34
|
var layoutOffset: CGFloat
|
|
35
35
|
var inputSearchProps: InputSearchProps?
|
|
36
36
|
var fabProps: FabProps?
|
|
37
|
-
var contentLayout: ContentLayout = .grid
|
|
38
37
|
var screenName: String = ""
|
|
39
38
|
var content: () -> Content
|
|
40
39
|
|
|
@@ -66,7 +65,6 @@ public struct StackScreen<Content: View>: View {
|
|
|
66
65
|
layoutOffset: CGFloat = 56,
|
|
67
66
|
inputSearchProps: InputSearchProps? = nil,
|
|
68
67
|
fabProps: FabProps? = nil,
|
|
69
|
-
contentLayout: ContentLayout = .grid,
|
|
70
68
|
screenName: String = "",
|
|
71
69
|
@ViewBuilder content: @escaping () -> Content
|
|
72
70
|
) {
|
|
@@ -97,7 +95,6 @@ public struct StackScreen<Content: View>: View {
|
|
|
97
95
|
self.layoutOffset = layoutOffset
|
|
98
96
|
self.inputSearchProps = inputSearchProps
|
|
99
97
|
self.fabProps = fabProps
|
|
100
|
-
self.contentLayout = contentLayout
|
|
101
98
|
self.screenName = screenName
|
|
102
99
|
self.content = content
|
|
103
100
|
}
|
|
@@ -164,16 +161,6 @@ public struct StackScreen<Content: View>: View {
|
|
|
164
161
|
&& inputSearchProps == nil && !headerTransparent && !fullScreenContent
|
|
165
162
|
}
|
|
166
163
|
|
|
167
|
-
/// Bottom room for the tab's content: clear of the floating bar, unless the tab runs edge to edge
|
|
168
|
-
/// (`floatingTabBarEdgeToEdge()`), when it also covers the home indicator that BottomTab keeps clear of
|
|
169
|
-
/// (a negative inset extends the content past the tab's frame).
|
|
170
|
-
private var contentBottomInset: CGFloat {
|
|
171
|
-
guard let navigation, navigation.bottomTabIndex != -1, navigation.bottomTabEdgeToEdge else {
|
|
172
|
-
return duoTabBarInsets.overlay
|
|
173
|
-
}
|
|
174
|
-
return -layout.insets.bottom
|
|
175
|
-
}
|
|
176
|
-
|
|
177
164
|
/// iPhone Duo: the header leaves with the content and slides back in on a reverse scroll
|
|
178
165
|
/// (RN DuoQuickReturnHeader). The side bar is drawn apart from the header, so it stays put.
|
|
179
166
|
private var useQuickReturn: Bool {
|
|
@@ -310,7 +297,6 @@ public struct StackScreen<Content: View>: View {
|
|
|
310
297
|
}
|
|
311
298
|
}
|
|
312
299
|
.ignoresSafeArea(.keyboard, edges: .bottom)
|
|
313
|
-
.environment(\.contentLayout, contentLayout)
|
|
314
300
|
.onChange(of: scrollOffset) { updateHeaderHide($0) }
|
|
315
301
|
.onAppear { reportEmptySideBar() }
|
|
316
302
|
.onChange(of: showsSideBar) { _ in reportEmptySideBar() }
|
|
@@ -393,7 +379,7 @@ public struct StackScreen<Content: View>: View {
|
|
|
393
379
|
scrollOffset: $scrollOffset,
|
|
394
380
|
scrollToTopCallback: scrollToTopCallback,
|
|
395
381
|
animatedSearchInset: animatedSearchInset,
|
|
396
|
-
bottomInset:
|
|
382
|
+
bottomInset: duoTabBarInsets.overlay,
|
|
397
383
|
snapDistance: searchSnapDistance,
|
|
398
384
|
onScrollIdle: settleHeader,
|
|
399
385
|
content: { animatedHeroBody(animatedHeader) }
|
|
@@ -426,7 +412,7 @@ public struct StackScreen<Content: View>: View {
|
|
|
426
412
|
scrollOffset: $scrollOffset,
|
|
427
413
|
scrollToTopCallback: scrollToTopCallback,
|
|
428
414
|
animatedSearchInset: animatedSearchInset,
|
|
429
|
-
bottomInset:
|
|
415
|
+
bottomInset: duoTabBarInsets.overlay,
|
|
430
416
|
snapDistance: searchSnapDistance,
|
|
431
417
|
onScrollIdle: settleHeader,
|
|
432
418
|
content: { duoInsetContent }
|
|
@@ -447,7 +433,7 @@ public struct StackScreen<Content: View>: View {
|
|
|
447
433
|
scrollOffset: $scrollOffset,
|
|
448
434
|
scrollToTopCallback: scrollToTopCallback,
|
|
449
435
|
topInset: layout.headerHeight - layout.insets.top,
|
|
450
|
-
bottomInset:
|
|
436
|
+
bottomInset: duoTabBarInsets.overlay,
|
|
451
437
|
snapDistance: searchSnapDistance,
|
|
452
438
|
onScrollIdle: settleHeader,
|
|
453
439
|
content: content
|
|
@@ -493,7 +479,7 @@ public struct StackScreen<Content: View>: View {
|
|
|
493
479
|
scrollOffset: $scrollOffset,
|
|
494
480
|
scrollToTopCallback: scrollToTopCallback,
|
|
495
481
|
animatedSearchInset: animatedSearchInset,
|
|
496
|
-
bottomInset:
|
|
482
|
+
bottomInset: duoTabBarInsets.overlay,
|
|
497
483
|
snapDistance: searchSnapDistance,
|
|
498
484
|
onScrollIdle: settleHeader,
|
|
499
485
|
content: content
|
|
@@ -510,28 +496,18 @@ public struct StackScreen<Content: View>: View {
|
|
|
510
496
|
}
|
|
511
497
|
|
|
512
498
|
private func heroGlassStart(_ animatedHeader: AnimatedHeader) -> CGFloat {
|
|
513
|
-
max(
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
/// Wide windows keep the phone banner size, centered; phones fill the width.
|
|
517
|
-
private var bannerWidth: CGFloat {
|
|
518
|
-
layout.headerLayout(contentLayout).isWide ? HeaderLayoutMetrics.bannerWidth : layout.width
|
|
499
|
+
max(layout.width / animatedHeader.aspectRatio.value - layout.headerHeight, 0)
|
|
519
500
|
}
|
|
520
501
|
|
|
521
502
|
/// The banner fills the width at its aspect ratio; the body starts `layoutOffset` below the
|
|
522
|
-
/// header band so it overlaps the banner's lower part.
|
|
523
|
-
/// fills the sides, fading out downward.
|
|
503
|
+
/// header band so it overlaps the banner's lower part.
|
|
524
504
|
@ViewBuilder
|
|
525
505
|
private func animatedHeroBody(_ animatedHeader: AnimatedHeader) -> some View {
|
|
526
|
-
let width =
|
|
506
|
+
let width = layout.width
|
|
527
507
|
let imageHeight = width / animatedHeader.aspectRatio.value
|
|
528
508
|
let contentTopInset = layout.headerHeight + layoutOffset
|
|
529
509
|
|
|
530
510
|
ZStack(alignment: .top) {
|
|
531
|
-
if width < layout.width, let fill = animatedHeader.bannerBackgroundColor {
|
|
532
|
-
LinearGradient(colors: [fill, fill.opacity(0)], startPoint: .top, endPoint: .bottom)
|
|
533
|
-
.frame(width: layout.width, height: imageHeight)
|
|
534
|
-
}
|
|
535
511
|
animatedHeader.composable(scrollOffset)
|
|
536
512
|
.frame(width: width, height: imageHeight)
|
|
537
513
|
.clipped()
|
|
@@ -585,8 +561,7 @@ private struct StackScreenContent<Content: View>: View {
|
|
|
585
561
|
/// Room for a header the content scrolls under (iPhone Duo glass header).
|
|
586
562
|
var topInset: CGFloat = 0
|
|
587
563
|
/// Room for the floating tab bar that overlays the content: scrolling content runs under it and
|
|
588
|
-
/// ends clear of it, static content stays above it.
|
|
589
|
-
/// reaches that far past its frame.
|
|
564
|
+
/// ends clear of it, static content stays above it.
|
|
590
565
|
var bottomInset: CGFloat = 0
|
|
591
566
|
/// Compose's animated-search snap: a scroll that comes to rest part way through this distance
|
|
592
567
|
/// finishes the move, up or back down.
|
|
@@ -647,8 +622,6 @@ private struct StackScreenContent<Content: View>: View {
|
|
|
647
622
|
}
|
|
648
623
|
}
|
|
649
624
|
.coordinateSpace(name: scrollSpace)
|
|
650
|
-
// an edge-to-edge tab's scroll reaches past its frame, under the home indicator
|
|
651
|
-
.padding(.bottom, min(bottomInset, 0))
|
|
652
625
|
.modifier(ScrollRest(offset: scrollOffset, onRest: scrollDidRest))
|
|
653
626
|
// Status-bar tap (MoMoStatusBarTap swizzle) scrolls to top and notifies the consumer.
|
|
654
627
|
.onReceive(NotificationCenter.default.publisher(for: MoMoStatusBarTap.notificationName)) { _ in
|
|
@@ -749,7 +722,6 @@ private struct SearchAnimatedHeader: View {
|
|
|
749
722
|
var hasToolkit: Bool = false
|
|
750
723
|
|
|
751
724
|
@Environment(\.screenLayout) private var layout
|
|
752
|
-
@Environment(\.contentLayout) private var contentLayout
|
|
753
725
|
@Environment(\.appTheme) private var theme
|
|
754
726
|
@OptionalEnvironmentObject private var navigator: Navigator?
|
|
755
727
|
|
|
@@ -760,14 +732,14 @@ private struct SearchAnimatedHeader: View {
|
|
|
760
732
|
let rowTop = layout.headerStatusBarHeight - layout.insets.top
|
|
761
733
|
let minTop = rowTop + (layout.headerBarHeight - HEADER_HEIGHT) / 2
|
|
762
734
|
let maxTop = layout.headerHeight - layout.insets.top
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
// collapsed on the iPhone Duo status bar row, the search stays between its clusters
|
|
735
|
+
let minSide = Spacing.M
|
|
736
|
+
// collapsed on the iPhone Duo status bar row, the search stays between its clusters (48pt back there)
|
|
766
737
|
let clearance = layout.statusBarClearance
|
|
767
|
-
let
|
|
738
|
+
let backWidth: CGFloat = clearance != nil && !useSideBar ? DuoMetrics.controlSize : 28
|
|
739
|
+
let maxStart = (clearance?.left ?? 0) + (hiddenBack || useSideBar ? Spacing.M : backWidth + Spacing.M + Spacing.S)
|
|
768
740
|
let maxEnd = (clearance?.right ?? 0) + (useSideBar && hasToolkit
|
|
769
|
-
?
|
|
770
|
-
: headerRightWidth + (hasHeaderRight ?
|
|
741
|
+
? Spacing.M
|
|
742
|
+
: headerRightWidth + (hasHeaderRight ? Spacing.M * 2 : Spacing.M))
|
|
771
743
|
|
|
772
744
|
// one progress for all three, so the field docks with its final insets and never covers the toolkit
|
|
773
745
|
let progress = min(scroll / HEADER_HEIGHT, 1)
|
|
@@ -783,7 +755,6 @@ private struct SearchAnimatedHeader: View {
|
|
|
783
755
|
theme: theme,
|
|
784
756
|
pop: navigator.map { navigator in { navigator.pop() } }
|
|
785
757
|
))
|
|
786
|
-
.headerSize()
|
|
787
758
|
.frame(height: HEADER_HEIGHT)
|
|
788
759
|
.padding(.leading, start)
|
|
789
760
|
.padding(.trailing, end)
|
package/ios/native-kits.podspec
CHANGED