@momo-kits/native-kits 0.169.8-beta.7-debug → 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.
Files changed (32) hide show
  1. package/compose/build.gradle.kts +1 -1
  2. package/compose/compose.podspec +1 -1
  3. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +1 -59
  4. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +5 -20
  5. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +1 -1
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +55 -0
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +2 -7
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +14 -33
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +1 -10
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +39 -29
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +29 -28
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +10 -3
  13. package/gradle.properties +1 -1
  14. package/ios/Input/InputSearch.swift +6 -23
  15. package/ios/Navigation/BottomTab/BottomTabBar.swift +0 -9
  16. package/ios/Navigation/Component/Header.swift +46 -31
  17. package/ios/Navigation/Component/HeaderJourney.swift +1 -2
  18. package/ios/Navigation/Component/HeaderLocation.swift +1 -2
  19. package/ios/Navigation/Component/HeaderRight.swift +15 -18
  20. package/ios/Navigation/Component/HeaderUser.swift +1 -2
  21. package/ios/Navigation/Component/SideBar.swift +13 -4
  22. package/ios/Navigation/Navigation.swift +1 -31
  23. package/ios/Navigation/StackScreen.swift +14 -43
  24. package/ios/native-kits.podspec +1 -1
  25. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  26. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +2 -11
  27. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +1 -13
  28. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +0 -11
  29. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +1 -1
  30. package/package.json +1 -1
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +0 -63
  32. package/ios/Layout/HeaderLayout.swift +0 -60
@@ -8,8 +8,6 @@ import androidx.compose.foundation.layout.Arrangement
8
8
  import androidx.compose.foundation.layout.Box
9
9
  import androidx.compose.foundation.layout.Column
10
10
  import androidx.compose.foundation.layout.Row
11
- import androidx.compose.foundation.layout.RowScope
12
- import androidx.compose.foundation.layout.fillMaxHeight
13
11
  import androidx.compose.foundation.layout.height
14
12
  import androidx.compose.foundation.layout.offset
15
13
  import androidx.compose.foundation.layout.padding
@@ -31,9 +29,6 @@ import androidx.compose.ui.graphics.Color
31
29
  import androidx.compose.ui.unit.Dp
32
30
  import androidx.compose.ui.unit.dp
33
31
  import vn.momo.kits.layout.DuoMetrics
34
- import vn.momo.kits.layout.HEADER_BUTTON_SIZE
35
- import vn.momo.kits.layout.HEADER_ICON_SIZE
36
- import vn.momo.kits.layout.HEADER_PILL_WIDTH
37
32
  import vn.momo.kits.application.LocalContext
38
33
  import vn.momo.kits.application.MiniAppContext
39
34
  import vn.momo.kits.components.BadgeDot
@@ -84,8 +79,8 @@ internal fun toolkitColumnHeight(headerRight: HeaderRight.Toolkit): Dp {
84
79
  return shortcut + if (groupCount > 1) DuoMetrics.itemPitch * groupCount else DuoMetrics.controlSize
85
80
  }
86
81
 
87
- // SideBarColumn: the iPhone Duo side bar, 48pt controls; Bar: every header row, iPhone Duo status bar row included.
88
- internal enum class ToolkitLayout { Bar, SideBarColumn }
82
+ // SideBarColumn: the iPhone Duo side bar; SideBarRow: the Duo header row on the status bar, same 48pt controls.
83
+ internal enum class ToolkitLayout { Bar, SideBarColumn, SideBarRow }
89
84
 
90
85
  @Composable
91
86
  internal fun Toolkit(
@@ -172,7 +167,8 @@ internal fun Toolkit(
172
167
  }
173
168
 
174
169
  if (layout != ToolkitLayout.Bar) {
175
- Column(verticalArrangement = Arrangement.spacedBy(Spacing.M)) {
170
+ val horizontal = layout == ToolkitLayout.SideBarRow
171
+ val controls = @Composable {
176
172
  if (isShowShortcut) {
177
173
  SideBarButton(
178
174
  icon = icon,
@@ -182,7 +178,7 @@ internal fun Toolkit(
182
178
  onClick = navButtonConfig.onPress,
183
179
  )
184
180
  }
185
- SideBarGroup(headerColor = headerColor, itemCount = if (useHelpCenter) 2 else 1) { item ->
181
+ SideBarGroup(headerColor = headerColor, itemCount = if (useHelpCenter) 2 else 1, horizontal = horizontal) { item ->
186
182
  if (useHelpCenter) {
187
183
  SideBarGroupItem(
188
184
  icon = "help_center",
@@ -201,6 +197,13 @@ internal fun Toolkit(
201
197
  )
202
198
  }
203
199
  }
200
+ if (horizontal) {
201
+ Row(horizontalArrangement = Arrangement.spacedBy(Spacing.M), verticalAlignment = Alignment.CenterVertically) {
202
+ controls()
203
+ }
204
+ } else {
205
+ Column(verticalArrangement = Arrangement.spacedBy(Spacing.M)) { controls() }
206
+ }
204
207
  return
205
208
  }
206
209
 
@@ -222,14 +225,18 @@ internal fun Toolkit(
222
225
  horizontalArrangement = Arrangement.Center,
223
226
  modifier = Modifier
224
227
  .padding(start = Spacing.S)
225
- .border(0.2.dp, headerColor.borderColor, shape = PILL_SHAPE)
226
- .height(HEADER_BUTTON_SIZE)
227
- .width(if (useHelpCenter) HEADER_PILL_WIDTH else HEADER_BUTTON_SIZE)
228
- .clip(shape = PILL_SHAPE)
228
+ .border(0.2.dp, headerColor.borderColor, shape = RoundedCornerShape(14.dp))
229
+ .height(28.dp)
230
+ .clip(shape = RoundedCornerShape(14.dp))
229
231
  .background(headerColor.backgroundButton)
230
232
  ) {
231
233
  if (useHelpCenter) {
232
- PillItem(icon = "help_center", headerColor = headerColor, onClick = ::onPressHelpCenter)
234
+ Icon(
235
+ source = "help_center",
236
+ size = 20.dp,
237
+ color = headerColor.tintIconColor,
238
+ modifier = Modifier.padding(4.dp).activeOpacityClickable(onClick = ::onPressHelpCenter)
239
+ )
233
240
  Box(
234
241
  modifier = Modifier
235
242
  .width(0.5.dp)
@@ -237,23 +244,17 @@ internal fun Toolkit(
237
244
  .background(tintColor ?: Colors.black_20)
238
245
  )
239
246
  }
240
- PillItem(icon = closeIcon, headerColor = headerColor, onClick = ::onPressClose)
247
+ Icon(
248
+ source = closeIcon,
249
+ size = 20.dp,
250
+ color = headerColor.tintIconColor,
251
+ modifier = Modifier.padding(4.dp).activeOpacityClickable(onClick = ::onPressClose)
252
+ )
241
253
  }
242
254
  }
243
255
  }
244
256
 
245
- private val PILL_SHAPE = RoundedCornerShape(percent = 50)
246
257
 
247
- // One half of the help / home pill; each half takes an equal share of the pill width.
248
- @Composable
249
- private fun RowScope.PillItem(icon: String, headerColor: HeaderColor, onClick: () -> Unit) {
250
- Box(
251
- modifier = Modifier.weight(1f).fillMaxHeight().activeOpacityClickable(onClick = onClick),
252
- contentAlignment = Alignment.Center,
253
- ) {
254
- Icon(source = icon, size = HEADER_ICON_SIZE, color = headerColor.tintIconColor)
255
- }
256
- }
257
258
 
258
259
  // Colors follow the enclosing header, so it fits a `HeaderRight.Custom` next to the toolkit.
259
260
  @Composable
@@ -285,7 +286,7 @@ internal fun NavigationButton(
285
286
  ) {
286
287
  Box(
287
288
  modifier = modifier
288
- .size(HEADER_BUTTON_SIZE)
289
+ .size(28.dp)
289
290
  .activeOpacityClickable(enabled = !disabled, onClick = onClick)
290
291
  ) {
291
292
  Box(
@@ -301,7 +302,7 @@ internal fun NavigationButton(
301
302
  ) {
302
303
  Icon(
303
304
  source = icon,
304
- size = HEADER_ICON_SIZE,
305
+ size = 20.dp,
305
306
  color = headerColor.tintIconColor
306
307
  )
307
308
  }
@@ -150,18 +150,25 @@ internal fun SideBarButton(
150
150
  }
151
151
  }
152
152
 
153
- // Vertical capsule grouping related side bar controls, one item per 50pt.
153
+ // Capsule grouping related controls, one item per 50pt: vertical in the side bar, horizontal on a header row.
154
154
  @Composable
155
155
  internal fun SideBarGroup(
156
156
  headerColor: HeaderColor,
157
157
  itemCount: Int,
158
+ horizontal: Boolean = false,
158
159
  content: @Composable (itemModifier: Modifier) -> Unit,
159
160
  ) {
160
161
  val length = if (itemCount > 1) DuoMetrics.itemPitch * itemCount else DuoMetrics.controlSize
161
162
  val item = length / itemCount.coerceAtLeast(1)
162
163
  val glass = Modifier.sideBarGlass(headerColor, RoundedCornerShape(Radius.XL))
163
- Column(Modifier.size(width = DuoMetrics.controlSize, height = length).then(glass)) {
164
- content(Modifier.size(width = DuoMetrics.controlSize, height = item))
164
+ if (horizontal) {
165
+ Row(Modifier.size(width = length, height = DuoMetrics.controlSize).then(glass)) {
166
+ content(Modifier.size(width = item, height = DuoMetrics.controlSize))
167
+ }
168
+ } else {
169
+ Column(Modifier.size(width = DuoMetrics.controlSize, height = length).then(glass)) {
170
+ content(Modifier.size(width = DuoMetrics.controlSize, height = item))
171
+ }
165
172
  }
166
173
  }
167
174
 
package/gradle.properties CHANGED
@@ -18,7 +18,7 @@ kotlin.apple.xcodeCompatibility.nowarn=true
18
18
  name="ComposeKits"
19
19
  group=vn.momo.kits
20
20
  artifact.id=kits
21
- version=0.169.8-beta.7
21
+ version=0.169.8
22
22
 
23
23
  repo=GitLab
24
24
  url=https://artifacts.mservice.com.vn/repository/maven-momo-app/
@@ -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: size.height - Spacing.S * 2)
23
+ .frame(width: 1, height: 36 - Spacing.S * 2)
33
24
  .padding(.leading, Spacing.S)
34
25
 
35
- Icon(source: icon, size: size.iconSize, color: color)
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: size.iconSize, color: theme.colors.text.hint)
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, size: size, onClick: onRightIconPressed)
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: size.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, the gaps around the title and the right cluster take from the header row
10
- /// (Compose `HEADER_ACTIONS_WIDTH`).
11
- let headerActionsWidth: CGFloat = HeaderLayoutMetrics.buttonSize + HeaderLayoutMetrics.titleGap * 2 + HeaderLayoutMetrics.clusterWidth
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, _ contentLayout: ContentLayout) -> CGFloat {
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.headerLayout(contentLayout).frameWidth - headerActionsWidth - clearance
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 headerLayout.frameWidth / 2 }
359
- let back = goBack == nil || useSideBar ? 0 : HeaderLayoutMetrics.buttonSize + HeaderLayoutMetrics.titleGap
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
- BackButton(color: headerColor, onBack: goBack)
385
- Spacer().frame(width: HeaderLayoutMetrics.titleGap)
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
- AnyView(headerRight())
397
- .environment(\.headerColor, headerColor)
398
- .background(
399
- GeometryReader { geo in
400
- Color.clear.preference(key: HeaderRightWidthKey.self, value: geo.size.width)
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, headerLayout.frameInset + (layout.statusBarClearance?.left ?? 0))
406
- .padding(.trailing, headerLayout.frameInset + (layout.statusBarClearance?.right ?? 0))
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, headerLayout.frameInset)
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 32pt circle with the back arrow.
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: HeaderLayoutMetrics.buttonSize, height: HeaderLayoutMetrics.buttonSize)
500
- .overlay(Icon(source: "arrow-back", size: HeaderLayoutMetrics.iconSize, color: color.tintIconColor))
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, contentLayout), alignment: .leading)
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, contentLayout), alignment: .leading)
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, 48pt controls; `bar`: every header row, iPhone Duo status bar row included.
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 var sideBarControls: some View {
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
- .clipShape(Capsule())
361
- .overlay(Capsule().stroke(headerColor.borderColor, lineWidth: 0.2))
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: HeaderLayoutMetrics.iconSize, color: headerColor.tintIconColor)
370
- .frame(maxWidth: .infinity, maxHeight: .infinity)
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 32pt circular shortcut / more button.
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: HeaderLayoutMetrics.iconSize, color: colors.tintIconColor)
408
+ Icon(source: icon, size: 20, color: colors.tintIconColor)
412
409
  }
413
- .frame(width: HeaderLayoutMetrics.buttonSize, height: HeaderLayoutMetrics.buttonSize)
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, contentLayout), alignment: .leading)
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 vertical glass capsule grouping related side bar controls, one item per 50pt.
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
- VStack(spacing: 0) { content() }
149
- .frame(width: DuoMetrics.controlSize, height: length)
150
- .modifier(SideBarGlass(headerColor: headerColor, shape: RoundedRectangle(cornerRadius: Radius.XL)))
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