@momo-kits/native-kits 0.169.8-beta.7-debug → 0.169.8
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/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/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/build.gradle.kts +0 -11
- package/compose/build.gradle.kts +0 -198
- package/compose/compose.podspec +0 -47
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -154
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +0 -17
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1067
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -267
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -482
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -224
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -195
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -473
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -113
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -263
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -228
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -280
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -183
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -82
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -39
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -363
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -307
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -88
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -306
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -457
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -205
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -89
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -542
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -120
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -201
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -210
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -292
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +0 -63
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +0 -184
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -316
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -397
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -153
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -118
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -422
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -746
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -242
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -400
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -100
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -97
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -207
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +0 -132
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -167
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -446
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -105
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -398
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -197
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -114
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +0 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
- package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -218
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +0 -48
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -144
- package/gradle/libs.versions.toml +0 -67
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +0 -8
- package/gradle.properties +0 -24
- package/gradlew +0 -252
- package/gradlew.bat +0 -94
- package/ios/Layout/HeaderLayout.swift +0 -60
- package/ios-demo/README.md +0 -120
- package/settings.gradle.kts +0 -64
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import SwiftUI
|
|
2
2
|
|
|
3
|
-
/// Body searches keep 36 / 24; the header search matches the 32pt header buttons.
|
|
4
|
-
enum InputSearchSize {
|
|
5
|
-
case `default`, header
|
|
6
|
-
|
|
7
|
-
var height: CGFloat { self == .header ? HeaderLayoutMetrics.searchHeight : 36 }
|
|
8
|
-
var iconSize: CGFloat { self == .header ? HeaderLayoutMetrics.iconSize : 24 }
|
|
9
|
-
}
|
|
10
|
-
|
|
11
3
|
// MARK: - RenderRightIconSearch
|
|
12
4
|
|
|
13
5
|
struct RenderRightIconSearch: View {
|
|
@@ -15,7 +7,6 @@ struct RenderRightIconSearch: View {
|
|
|
15
7
|
let loading: Bool
|
|
16
8
|
let icon: String
|
|
17
9
|
let color: Color
|
|
18
|
-
var size: InputSearchSize = .default
|
|
19
10
|
let onClick: () -> Void
|
|
20
11
|
|
|
21
12
|
var body: some View {
|
|
@@ -26,13 +17,13 @@ struct RenderRightIconSearch: View {
|
|
|
26
17
|
.padding(.horizontal, Spacing.S)
|
|
27
18
|
}
|
|
28
19
|
if !icon.isEmpty {
|
|
29
|
-
// Compose: a 1pt rule inset S from the top and bottom of the bar.
|
|
20
|
+
// Compose: a 1pt rule inset S from the top and bottom of the 36pt bar.
|
|
30
21
|
Rectangle()
|
|
31
22
|
.fill(theme.colors.primary)
|
|
32
|
-
.frame(width: 1, height:
|
|
23
|
+
.frame(width: 1, height: 36 - Spacing.S * 2)
|
|
33
24
|
.padding(.leading, Spacing.S)
|
|
34
25
|
|
|
35
|
-
Icon(source: icon, size:
|
|
26
|
+
Icon(source: icon, size: 24, color: color)
|
|
36
27
|
.padding(.leading, Spacing.S)
|
|
37
28
|
.onTapGesture(perform: onClick)
|
|
38
29
|
}
|
|
@@ -146,7 +137,6 @@ public struct InputSearch: View {
|
|
|
146
137
|
var clearCondition: (() -> Bool)? = nil
|
|
147
138
|
var onClearPress: () -> Void = {}
|
|
148
139
|
var onSubmit: () -> Void = {}
|
|
149
|
-
var size: InputSearchSize = .default
|
|
150
140
|
|
|
151
141
|
@State private var isFocused = false
|
|
152
142
|
@State private var isBlurred = false
|
|
@@ -236,7 +226,7 @@ public struct InputSearch: View {
|
|
|
236
226
|
if let searchIcon = searchIcon {
|
|
237
227
|
searchIcon()
|
|
238
228
|
} else {
|
|
239
|
-
Icon(source: "navigation_search", size:
|
|
229
|
+
Icon(source: "navigation_search", size: 24, color: theme.colors.text.hint)
|
|
240
230
|
.padding(.trailing, Spacing.XS)
|
|
241
231
|
}
|
|
242
232
|
|
|
@@ -285,11 +275,11 @@ public struct InputSearch: View {
|
|
|
285
275
|
.padding(.leading, Spacing.XS)
|
|
286
276
|
}
|
|
287
277
|
|
|
288
|
-
RenderRightIconSearch(loading: loading, icon: icon, color: iconColor,
|
|
278
|
+
RenderRightIconSearch(loading: loading, icon: icon, color: iconColor, onClick: onRightIconPressed)
|
|
289
279
|
}
|
|
290
280
|
.padding(.horizontal, Spacing.M)
|
|
291
281
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
292
|
-
.frame(height:
|
|
282
|
+
.frame(height: 36)
|
|
293
283
|
.background(
|
|
294
284
|
RoundedRectangle(cornerRadius: Radius.XL)
|
|
295
285
|
.fill(backgroundColor ?? theme.colors.background.surface)
|
|
@@ -308,13 +298,6 @@ public struct InputSearch: View {
|
|
|
308
298
|
}
|
|
309
299
|
}
|
|
310
300
|
|
|
311
|
-
/// The header search: 32pt tall with a 20pt icon, level with the header buttons.
|
|
312
|
-
func headerSize() -> InputSearch {
|
|
313
|
-
var copy = self
|
|
314
|
-
copy.size = .header
|
|
315
|
-
return copy
|
|
316
|
-
}
|
|
317
|
-
|
|
318
301
|
// MARK: - Helper Functions
|
|
319
302
|
|
|
320
303
|
func getBorderColor(isFocused: Bool, error: String, disabled: Bool) -> Color {
|
|
@@ -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
|
-
}
|