@momo-kits/native-kits 0.169.10-beta.1 → 0.169.10-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 (188) hide show
  1. package/build.gradle.kts +11 -0
  2. package/compose/build.gradle.kts +198 -0
  3. package/compose/compose.podspec +47 -0
  4. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +19 -0
  5. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +154 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -0
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +61 -0
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1067 -0
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +268 -0
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +81 -0
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +354 -0
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +130 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +482 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +49 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +224 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +137 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +473 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +113 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +262 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +237 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +228 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +265 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +183 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +342 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +40 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +82 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +39 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +362 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +304 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +88 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +308 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +218 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +456 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +205 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +89 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +542 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +175 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +201 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +208 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +12 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +194 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +291 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +184 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +315 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +54 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +397 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +153 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +113 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +206 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +421 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +730 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +152 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +35 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +242 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +398 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +103 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +93 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +208 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +133 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +167 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +456 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +105 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +401 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +204 -0
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +127 -0
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +114 -0
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +7 -0
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +76 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +21 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +117 -0
  123. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
  124. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
  125. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
  126. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
  127. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +65 -0
  128. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +217 -0
  129. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +48 -0
  130. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +143 -0
  131. package/gradle/libs.versions.toml +67 -0
  132. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  133. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  134. package/gradle.properties +24 -0
  135. package/gradlew +252 -0
  136. package/gradlew.bat +94 -0
  137. package/ios/Application/DesignSystemKits.swift +2 -3
  138. package/ios/Application/LanguageSource.swift +2 -3
  139. package/ios/Application/Localize.swift +4 -7
  140. package/ios/Application/LocalizeModifier.swift +2 -3
  141. package/ios/Badge/Badge.swift +5 -7
  142. package/ios/Button/Button.swift +2 -3
  143. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +3 -5
  144. package/ios/Carousel/Carousel.swift +2 -3
  145. package/ios/Collapse/Collapse.swift +17 -11
  146. package/ios/Extensions/ActiveOpacityButtonStyle.swift +2 -3
  147. package/ios/Icon/Icon.swift +2 -3
  148. package/ios/IconButton/IconButton.swift +2 -3
  149. package/ios/Input/InputSearch.swift +6 -23
  150. package/ios/Layout/ModalLayout.swift +2 -3
  151. package/ios/Layout/ScreenLayout.swift +10 -12
  152. package/ios/Layout/Section.swift +2 -3
  153. package/ios/Navigation/BottomSheet.swift +6 -9
  154. package/ios/Navigation/BottomTab/BottomTab.swift +6 -9
  155. package/ios/Navigation/BottomTab/BottomTabBar.swift +4 -6
  156. package/ios/Navigation/BottomTab/CurvedContainer.swift +2 -3
  157. package/ios/Navigation/BottomTab/DuoBarCompression.swift +2 -3
  158. package/ios/Navigation/BottomTab/DuoTabBar.swift +6 -6
  159. package/ios/Navigation/BottomTab/TabBarMetrics.swift +4 -6
  160. package/ios/Navigation/Component/Header.swift +46 -31
  161. package/ios/Navigation/Component/HeaderJourney.swift +1 -2
  162. package/ios/Navigation/Component/HeaderLocation.swift +1 -2
  163. package/ios/Navigation/Component/HeaderRight.swift +15 -18
  164. package/ios/Navigation/Component/HeaderUser.swift +1 -2
  165. package/ios/Navigation/Component/SideBar.swift +15 -7
  166. package/ios/Navigation/HostBackGestureBridge.swift +2 -3
  167. package/ios/Navigation/ModalScreen.swift +13 -11
  168. package/ios/Navigation/Navigation.swift +3 -9
  169. package/ios/Navigation/NavigationContainer.swift +4 -6
  170. package/ios/Navigation/Navigator.swift +12 -18
  171. package/ios/Navigation/StackScreen.swift +25 -40
  172. package/ios/Navigation/StackTransition.swift +7 -6
  173. package/ios/Skeleton/Skeleton.swift +3 -6
  174. package/ios/Steps/Steps.swift +20 -15
  175. package/ios/TabView/TabView.swift +2 -3
  176. package/ios/Title/Title.swift +1 -3
  177. package/ios/Typography/FontScale.swift +6 -9
  178. package/ios/Typography/Text.swift +2 -3
  179. package/ios/Typography/Typography.swift +3 -4
  180. package/ios/native-kits.podspec +1 -1
  181. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  182. package/ios-demo/README.md +120 -0
  183. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +2 -11
  184. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +0 -11
  185. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +1 -1
  186. package/package.json +1 -1
  187. package/settings.gradle.kts +64 -0
  188. package/ios/Layout/HeaderLayout.swift +0 -67
@@ -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
  }
@@ -1,6 +1,5 @@
1
- // SwiftUI mirror of Compose's `navigation/component/SideBar.kt`. iPhone Duo: back and toolkit
2
- // leave the header bar for a column in the side safe area, as the system bars do.
3
- // Port of RN `SideBarButton.tsx` + `useSideBarItemStyle`.
1
+ // SwiftUI mirror of Compose's `navigation/component/SideBar.kt` (RN `SideBarButton.tsx` + `useSideBarItemStyle`):
2
+ // on iPhone Duo, back and toolkit leave the header for a column in the side safe area, as the system bars do.
4
3
 
5
4
  import SwiftUI
6
5
 
@@ -137,17 +136,26 @@ struct SideBarButton: View {
137
136
  }
138
137
  }
139
138
 
140
- /// 48pt vertical glass capsule grouping related side bar controls, one item per 50pt.
139
+ /// 48pt glass capsule grouping related controls, one item per 50pt: vertical in the side bar,
140
+ /// horizontal on a header row.
141
141
  struct SideBarGroup<Content: View>: View {
142
142
  let headerColor: HeaderColor
143
143
  let itemCount: Int
144
+ var horizontal: Bool = false
144
145
  @ViewBuilder let content: () -> Content
145
146
 
146
147
  var body: some View {
147
148
  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)))
149
+ Group {
150
+ if horizontal {
151
+ HStack(spacing: 0) { content() }
152
+ .frame(width: length, height: DuoMetrics.controlSize)
153
+ } else {
154
+ VStack(spacing: 0) { content() }
155
+ .frame(width: DuoMetrics.controlSize, height: length)
156
+ }
157
+ }
158
+ .modifier(SideBarGlass(headerColor: headerColor, shape: RoundedRectangle(cornerRadius: Radius.XL)))
151
159
  }
152
160
  }
153
161
 
@@ -1,6 +1,5 @@
1
- // SwiftUI mirror of Compose's `navigation/HostBackGestureBridge.kt`: the host owns the edge-pan
2
- // recogniser and routes a back into the topmost kit stack (NavigationContainer attaches itself).
3
- // `started` ... `cancelled` scrub the pop with the finger; a plain `pop` plays the regular back.
1
+ // SwiftUI mirror of Compose's `navigation/HostBackGestureBridge.kt`: routes the host's edge pan into the topmost
2
+ // kit stack (NavigationContainer attaches itself); `started` ... `cancelled` scrub the pop, `pop` plays a plain back.
4
3
 
5
4
  import UIKit
6
5
 
@@ -37,17 +37,7 @@ struct ModalScreen<Content: View>: View {
37
37
  )
38
38
  .scaleEffect(contentScale)
39
39
  .opacity(contentOpacity)
40
- // center in the placement: the safe area, or the right half of a half-folded iPhone Duo
41
- .padding(
42
- modal.isFoldable
43
- ? EdgeInsets(
44
- top: placement.minY,
45
- leading: placement.minX,
46
- bottom: layout.height - placement.maxY,
47
- trailing: layout.width - placement.maxX
48
- )
49
- : EdgeInsets()
50
- )
40
+ .padding(contentPadding(modal))
51
41
  }
52
42
  // Full screen like RN's Modal, so asymmetric landscape insets don't shift the content sideways.
53
43
  .frame(maxWidth: .infinity, maxHeight: .infinity)
@@ -65,6 +55,18 @@ struct ModalScreen<Content: View>: View {
65
55
  }
66
56
  }
67
57
 
58
+ // Centers the content in the placement: the safe area, or the right half of a half-folded iPhone Duo.
59
+ private func contentPadding(_ modal: ModalLayout) -> EdgeInsets {
60
+ guard modal.isFoldable else { return EdgeInsets() }
61
+ let placement = modal.placement
62
+ return EdgeInsets(
63
+ top: placement.minY,
64
+ leading: placement.minX,
65
+ bottom: layout.height - placement.maxY,
66
+ trailing: layout.width - placement.maxX
67
+ )
68
+ }
69
+
68
70
  // Mirrors Compose's `openEvent`: 250ms fade + scale to 1.
69
71
  private func open() {
70
72
  DispatchQueue.main.async {
@@ -3,9 +3,8 @@
3
3
 
4
4
  import SwiftUI
5
5
 
6
- /// Per-screen handle (Compose `LocalNavigation`). Read it inside a screen with
7
- /// `@EnvironmentObject var navigation: Navigation` and call `setOptions` to change the header,
8
- /// footer or back handling after the screen is shown.
6
+ /// Per-screen handle (Compose `LocalNavigation`): a screen reads `@EnvironmentObject var navigation: Navigation`
7
+ /// and calls `setOptions` to change the header, footer or back handling after it is shown.
9
8
  public final class Navigation: ObservableObject {
10
9
  public let id: Int
11
10
  public let bottomTabIndex: Int
@@ -87,8 +86,6 @@ public struct NavigationOptions {
87
86
  public var inputSearchProps: InputSearchProps?
88
87
  public var fabProps: FabProps?
89
88
  public var onBackHandler: (() -> Void)?
90
- /// Wide windows: `.stretch` puts the header row in the centered 600pt content frame.
91
- public var contentLayout: ContentLayout
92
89
 
93
90
  public init(
94
91
  screenName: String? = nil,
@@ -117,8 +114,7 @@ public struct NavigationOptions {
117
114
  layoutOffset: CGFloat = 56,
118
115
  inputSearchProps: InputSearchProps? = nil,
119
116
  fabProps: FabProps? = nil,
120
- onBackHandler: (() -> Void)? = nil,
121
- contentLayout: ContentLayout = .grid
117
+ onBackHandler: (() -> Void)? = nil
122
118
  ) {
123
119
  self.screenName = screenName
124
120
  self.title = title
@@ -147,7 +143,6 @@ public struct NavigationOptions {
147
143
  self.inputSearchProps = inputSearchProps
148
144
  self.fabProps = fabProps
149
145
  self.onBackHandler = onBackHandler
150
- self.contentLayout = contentLayout
151
146
  }
152
147
  }
153
148
 
@@ -191,7 +186,6 @@ struct OptionsStackScreen: View {
191
186
  layoutOffset: options.layoutOffset,
192
187
  inputSearchProps: options.inputSearchProps,
193
188
  fabProps: options.fabProps,
194
- contentLayout: options.contentLayout,
195
189
  screenName: screenName,
196
190
  content: content
197
191
  )
@@ -1,6 +1,5 @@
1
- // SwiftUI mirror of Compose's `navigation/NavigationContainer.kt`: hosts the kit stack
2
- // (`StackHost`, the NavHost counterpart), injects Navigator, theme, localize and font scale, and
3
- // renders every registered screen inside `StackScreen` chrome built from its options.
1
+ // SwiftUI mirror of Compose's `navigation/NavigationContainer.kt`: hosts the kit stack (`StackHost`, the NavHost
2
+ // counterpart), injects Navigator, theme, localize and font scale, and wraps each screen in `StackScreen` chrome.
4
3
 
5
4
  import SwiftUI
6
5
 
@@ -84,9 +83,8 @@ public struct NavigationContainer<Initial: View>: View {
84
83
  setNavigator?(navigator)
85
84
  // Idempotent, so a re-appear won't double-count.
86
85
  HostBackGestureBridge.shared.attach(navigator)
87
- // Only a seed: a Localize with a language source already tracks the host in both
88
- // directions, so asking maxApi would just race it. `changeLanguage` normalizes the
89
- // raw response and hops to main itself.
86
+ // Only a seed: a Localize with a language source already tracks the host, so asking maxApi would race
87
+ // it. `changeLanguage` normalizes the raw response and hops to main itself.
90
88
  guard !localize.observesAppLanguage else { return }
91
89
  maxApi?.getLanguage { data in
92
90
  localize.changeLanguage(data?["response"] as? String)
@@ -1,6 +1,5 @@
1
- // SwiftUI mirror of Compose's `navigation/Navigator.kt`: Navigator, DynamicScreenRegistry and
2
- // the overplay model. Screens are registered by Int id; the stack paths store routes by id and
3
- // content is looked up from the registry on render.
1
+ // SwiftUI mirror of Compose's `navigation/Navigator.kt`: Navigator, DynamicScreenRegistry and the overplay model.
2
+ // The stack holds screen ids; content is looked up from the registry on render.
4
3
 
5
4
  import SwiftUI
6
5
  import Combine
@@ -101,9 +100,8 @@ public struct OverplayItem: Identifiable {
101
100
 
102
101
  // MARK: - Stack
103
102
 
104
- /// One back-stack entry, root first. A presented screen is an entry like any other (Compose's
105
- /// `DynamicDialogRoute` in the same NavHost): it rises instead of sliding in, and later pushes
106
- /// stack on top of it.
103
+ /// One back-stack entry, root first. A presented screen is one too (Compose's `DynamicDialogRoute` in the same
104
+ /// NavHost): it rises instead of sliding in, and later pushes stack on top of it.
107
105
  struct StackEntry: Hashable, Identifiable {
108
106
  let id: Int
109
107
  let isDialog: Bool
@@ -132,9 +130,8 @@ public final class Navigator: ObservableObject {
132
130
  /// Host dismiss fallback when there is no `composeApi` (Compose's `maxApi.dismiss`).
133
131
  public var maxApi: MaxApi?
134
132
 
135
- /// Set by a bottom tab off its first tab: back on the screen hosting the tabs returns to the
136
- /// first tab (Compose `tabBackHandler`). Keyed by that screen, so a screen pushed or presented
137
- /// over the tabs still pops normally.
133
+ /// Set by a bottom tab off its first tab so back returns there (Compose `tabBackHandler`). Keyed by the
134
+ /// hosting screen, so a screen pushed or presented over the tabs still pops normally.
138
135
  var tabBackHandler: (screenId: Int, handler: () -> Void)?
139
136
 
140
137
  /// The container's stack view, which plays (and lets the host gesture scrub) the transitions.
@@ -216,9 +213,8 @@ public final class Navigator: ObservableObject {
216
213
  popStep(remaining: count, callback: callback)
217
214
  }
218
215
 
219
- /// One `pop` iteration. Like Compose's coroutine loop it waits out the overplay's exit
220
- /// animation, or a `pop(2)` (prevent-back: close the popup, then leave) would spend both
221
- /// steps on the closing overplay and never pop the screen.
216
+ /// Waits out the overplay's exit animation like Compose's coroutine loop, or a `pop(2)` (prevent-back: close
217
+ /// the popup, then leave) would spend both steps on the closing overplay and never pop the screen.
222
218
  private func popStep(remaining: Int, callback: (() -> Void)?) {
223
219
  guard remaining > 0 else {
224
220
  callback?()
@@ -367,9 +363,8 @@ public final class Navigator: ObservableObject {
367
363
 
368
364
  // MARK: Host back gesture (Compose's HostBackTarget)
369
365
 
370
- /// Only a plain pop is scrubbed. A back the screen handles itself — tab back, custom
371
- /// handler, prevent-back popup, an open overplay — or one closing a presented screen
372
- /// waits for the release and goes through `onBackSafe`, as RN turns the gesture off there.
366
+ /// Only a plain pop is scrubbed. Tab back, a custom handler, prevent-back, an open overplay or a presented
367
+ /// top wait for the release and go through `onBackSafe`, as RN turns the gesture off there.
373
368
  private var canSeekBack: Bool {
374
369
  guard canPop(), overplay == nil, let top = entries.last, !top.isDialog else { return false }
375
370
  if let tabBackHandler, tabBackHandler.screenId == -1 || tabBackHandler.screenId == top.id {
@@ -525,9 +520,8 @@ public final class Navigator: ObservableObject {
525
520
  disposeScreens(previous.map(\.id).filter { !kept.contains($0) })
526
521
  }
527
522
 
528
- /// Screens are released only once the pop transition has played out: the outgoing
529
- /// view is still on screen while it animates. Liveness is re-checked when the timer
530
- /// fires, so an entry back on the stack by then keeps its screen.
523
+ /// Released only after the pop transition, as the outgoing view animates until then. Liveness is re-checked
524
+ /// when the timer fires, so an entry back on the stack by then keeps its screen.
531
525
  private func disposeScreens(_ ids: [Int]) {
532
526
  guard !ids.isEmpty else { return }
533
527
  DispatchQueue.main.asyncAfter(deadline: .now() + Self.screenDisposeDelay) { [weak self] in