@momo-kits/native-kits 0.300.7 → 0.300.8-beta.1-debug

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/CLAUDE.md +12 -8
  2. package/README.md +8 -7
  3. package/build.gradle.kts +13 -0
  4. package/compose/build.gradle.kts +195 -0
  5. package/compose/build.gradle.kts.backup +195 -0
  6. package/compose/compose.podspec +47 -0
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +19 -0
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +154 -0
  12. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -0
  13. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +61 -0
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/KitsBinding.kt +60 -0
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/KitsHost.kt +32 -0
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1067 -0
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +268 -0
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +55 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +81 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +354 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +130 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +482 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +49 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +224 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +137 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +473 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +113 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +262 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +237 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +228 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +280 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +183 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +342 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +40 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +82 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +39 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +362 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +304 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +88 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +308 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +218 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +456 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +205 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +89 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +542 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +175 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +201 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +208 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +12 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +194 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +291 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +71 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +184 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +315 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +54 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +397 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +153 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +118 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +212 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +422 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +750 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +152 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +35 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +244 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +398 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +103 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +93 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +208 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +133 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +167 -0
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +446 -0
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +105 -0
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +387 -0
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HelpCenterRequest.kt +33 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +197 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/ToolkitRequests.kt +38 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +135 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +114 -0
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +7 -0
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +76 -0
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +21 -0
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +117 -0
  131. package/compose/src/commonTest/kotlin/vn/momo/kits/application/KitsHostTest.kt +44 -0
  132. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +39 -0
  133. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +53 -0
  134. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
  135. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
  136. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +31 -0
  137. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
  138. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +65 -0
  139. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +217 -0
  140. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +48 -0
  141. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +143 -0
  142. package/gradle/libs.versions.toml +66 -0
  143. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  144. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  145. package/gradle.properties +24 -0
  146. package/gradlew +252 -0
  147. package/gradlew.bat +94 -0
  148. package/ios/Application/ApplicationEnvironment.swift +6 -4
  149. package/ios/Application/DesignSystemKits.swift +59 -13
  150. package/ios/Application/DesignSystemKitsPayload.swift +0 -8
  151. package/ios/Application/LanguageSource.swift +2 -11
  152. package/ios/Application/Localize.swift +8 -35
  153. package/ios/Application/LocalizeModifier.swift +2 -11
  154. package/ios/Application/MaxApi.swift +3 -11
  155. package/ios/Avatar/Avatar.swift +0 -1
  156. package/ios/Badge/Badge.swift +5 -8
  157. package/ios/Badge/BadgeRibbon.swift +2 -5
  158. package/ios/Button/Button.swift +4 -8
  159. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +5 -7
  160. package/ios/Carousel/Carousel.swift +4 -17
  161. package/ios/Checkbox/Checkbox.swift +0 -2
  162. package/ios/Collapse/Collapse.swift +17 -11
  163. package/ios/Colors+Radius+Spacing/Theme.swift +0 -7
  164. package/ios/DateTimePicker/DateTimePicker.swift +4 -10
  165. package/ios/DateTimePicker/DateTimePickerTypes.swift +1 -3
  166. package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -3
  167. package/ios/DateTimePicker/WheelPicker.swift +2 -4
  168. package/ios/Extensions/ActiveOpacityButtonStyle.swift +2 -3
  169. package/ios/Extensions/Color++.swift +2 -4
  170. package/ios/Extensions/SkeletonUICompat.swift +0 -8
  171. package/ios/Icon/Icon.swift +3 -6
  172. package/ios/IconButton/IconButton.swift +2 -5
  173. package/ios/Input/ErrorView.swift +0 -7
  174. package/ios/Input/Input.swift +9 -20
  175. package/ios/Input/InputPhoneNumber.swift +37 -20
  176. package/ios/Input/InputSearch.swift +23 -12
  177. package/ios/Input/InputTextArea.swift +4 -13
  178. package/ios/InputDropDown/InputDropDown.swift +1 -11
  179. package/ios/InputMoney/InputMoney.swift +9 -28
  180. package/ios/InputOTP/InputOTP.swift +2 -9
  181. package/ios/Layout/HeaderLayout.swift +72 -0
  182. package/ios/Layout/Item.swift +1 -2
  183. package/ios/Layout/ModalLayout.swift +144 -0
  184. package/ios/Layout/ScreenLayout.swift +48 -31
  185. package/ios/Layout/Section.swift +2 -3
  186. package/ios/Loader/Loader.swift +3 -12
  187. package/ios/Lottie/LottieView.swift +0 -11
  188. package/ios/Navigation/BottomSheet.swift +73 -94
  189. package/ios/Navigation/BottomTab/BottomTab.swift +58 -73
  190. package/ios/Navigation/BottomTab/BottomTabBar.swift +286 -121
  191. package/ios/Navigation/BottomTab/CurvedContainer.swift +52 -54
  192. package/ios/Navigation/BottomTab/DuoBarCompression.swift +5 -12
  193. package/ios/Navigation/BottomTab/DuoTabBar.swift +67 -202
  194. package/ios/Navigation/BottomTab/TabBarMetrics.swift +97 -0
  195. package/ios/Navigation/Component/FloatingButton.swift +4 -11
  196. package/ios/Navigation/Component/Header.swift +35 -54
  197. package/ios/Navigation/Component/HeaderBackground.swift +2 -8
  198. package/ios/Navigation/Component/HeaderJourney.swift +4 -8
  199. package/ios/Navigation/Component/HeaderLocation.swift +4 -8
  200. package/ios/Navigation/Component/HeaderRight.swift +20 -22
  201. package/ios/Navigation/Component/HeaderTitle.swift +1 -6
  202. package/ios/Navigation/Component/HeaderUser.swift +4 -10
  203. package/ios/Navigation/Component/SideBar.swift +6 -21
  204. package/ios/Navigation/Component/SnackBar.swift +9 -13
  205. package/ios/Navigation/HostBackGestureBridge.swift +2 -9
  206. package/ios/Navigation/ModalScreen.swift +24 -13
  207. package/ios/Navigation/Navigation.swift +35 -19
  208. package/ios/Navigation/NavigationContainer.swift +4 -15
  209. package/ios/Navigation/Navigator.swift +21 -39
  210. package/ios/Navigation/StackScreen.swift +64 -51
  211. package/ios/Navigation/StackTransition.swift +7 -14
  212. package/ios/Navigation/SwipeBackHaptic.swift +2 -7
  213. package/ios/Navigation/Tracking/ScreenTracker.swift +2 -7
  214. package/ios/Pagination/PaginationDot.swift +0 -9
  215. package/ios/Pagination/PaginationNumber.swift +1 -9
  216. package/ios/Pagination/PaginationScroll.swift +2 -14
  217. package/ios/Pagination/PaginationWhiteDot.swift +1 -10
  218. package/ios/Popup/PopupDisplay.swift +7 -5
  219. package/ios/Popup/PopupInput.swift +6 -4
  220. package/ios/Popup/PopupLayout.swift +17 -9
  221. package/ios/Popup/PopupNotify.swift +32 -25
  222. package/ios/PopupView/FullscreenPopup.swift +3 -4
  223. package/ios/PopupView/PopupView.swift +2 -2
  224. package/ios/PopupView/Utils++.swift +1 -2
  225. package/ios/ProgressInfo/ProgressInfo.swift +2 -13
  226. package/ios/Skeleton/Skeleton.swift +5 -16
  227. package/ios/Slider/Slider.swift +5 -12
  228. package/ios/StatusBarTap/StatusBarTap.h +2 -3
  229. package/ios/StatusBarTap/StatusBarTap.m +3 -16
  230. package/ios/Stepper/Stepper.swift +8 -27
  231. package/ios/Steps/Steps.swift +29 -26
  232. package/ios/Swipeable/SwipeCell.swift +2 -2
  233. package/ios/Swipeable/SwipeCellModel.swift +3 -6
  234. package/ios/TabView/TabView.swift +14 -28
  235. package/ios/Template/TrustBanner/TrustBanner.swift +2 -9
  236. package/ios/Title/Title.swift +1 -3
  237. package/ios/Tooltip/Tooltip.swift +4 -9
  238. package/ios/Typography/FontScale.swift +79 -24
  239. package/ios/Typography/Text.swift +6 -12
  240. package/ios/Typography/Typography.swift +8 -11
  241. package/ios/Uploader/Uploader.swift +2 -17
  242. package/ios-demo/README.md +120 -0
  243. package/ios-demo/Resources/tabbar_scan_qr_button.json +1 -0
  244. package/ios-demo/Resources/tabbar_scan_qr_label.json +1 -0
  245. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +11 -2
  246. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +296 -59
  247. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +15 -4
  248. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +0 -8
  249. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +114 -0
  250. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +29 -1
  251. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +16 -0
  252. package/package.json +1 -1
  253. package/publish.sh +8 -2
  254. package/scripts/ci/build-swiftui.sh +22 -0
  255. package/scripts/ci/resolve-version.mjs +144 -0
  256. package/settings.gradle.kts +63 -0
@@ -1,20 +1,14 @@
1
- //
2
- // Header.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/Header.kt`: the header bar (back button,
6
- // title, header right), its colors, opacity and the header models.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/Header.kt`: the header bar (back button,
2
+ // title, header right), its colors, opacity and the header models.
8
3
 
9
4
  import SwiftUI
10
5
 
11
6
  /// Header bar height, mirrors Compose's `HEADER_HEIGHT`.
12
7
  public let HEADER_HEIGHT: CGFloat = 52
13
8
 
14
- /// Room the back button and toolkit take from the bar (Compose `HEADER_ACTIONS_WIDTH`).
15
- let headerActionsWidth: CGFloat = 172
16
- // Extra width the 48pt back and toolkit take on the iPhone Duo status bar row.
17
- private let statusBarRowActionsExtra: CGFloat = 55
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
18
12
 
19
13
  public enum TitlePosition {
20
14
  case left, center
@@ -29,15 +23,19 @@ public struct AnimatedHeader {
29
23
  public var aspectRatio: AnimatedHeaderRatio = .ratio16_9
30
24
  public var isSurface: Bool = true
31
25
  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?
32
28
 
33
29
  public init(
34
30
  aspectRatio: AnimatedHeaderRatio = .ratio16_9,
35
31
  isSurface: Bool = true,
36
- composable: @escaping (_ scrollState: CGFloat) -> AnyView = { _ in AnyView(EmptyView()) }
32
+ composable: @escaping (_ scrollState: CGFloat) -> AnyView = { _ in AnyView(EmptyView()) },
33
+ bannerBackgroundColor: Color? = nil
37
34
  ) {
38
35
  self.aspectRatio = aspectRatio
39
36
  self.isSurface = isSurface
40
37
  self.composable = composable
38
+ self.bannerBackgroundColor = bannerBackgroundColor
41
39
  }
42
40
  }
43
41
 
@@ -291,10 +289,10 @@ func headerSearchProps(
291
289
  }
292
290
 
293
291
  /// Max title width: back button and toolkit share the bar unless the iPhone Duo side bar holds them.
294
- func headerTitleMaxWidth(_ layout: ScreenLayout) -> CGFloat {
292
+ func headerTitleMaxWidth(_ layout: ScreenLayout, _ contentLayout: ContentLayout) -> CGFloat {
295
293
  let clearance = layout.statusBarClearance.map { $0.left + $0.right } ?? 0
296
294
  if layout.sideBar != nil { return layout.contentWidth - Spacing.M * 2 - clearance }
297
- return layout.width - headerActionsWidth - (layout.statusBarClearance != nil ? statusBarRowActionsExtra : 0) - clearance
295
+ return layout.headerLayout(contentLayout).frameWidth - headerActionsWidth - clearance
298
296
  }
299
297
 
300
298
  // MARK: - Header
@@ -344,20 +342,21 @@ public struct NavigationHeader: View {
344
342
  }
345
343
 
346
344
  @Environment(\.screenLayout) private var layout
345
+ @Environment(\.contentLayout) private var contentLayout
347
346
  @Environment(\.appTheme) private var theme
348
347
  @OptionalEnvironmentObject private var navigator: Navigator?
349
348
  @State private var headerRightWidth: CGFloat = 0
350
349
 
350
+ private var headerLayout: HeaderLayout { layout.headerLayout(contentLayout) }
351
+
351
352
  /// iPhone Duo side bar holds back and the toolkit; a custom header right stays in the bar.
352
353
  private var useSideBar: Bool { layout.sideBar != nil }
353
354
 
354
- /// iPhone Duo inner portrait: the row sits on the status bar, between its clusters, with 48pt controls.
355
- private var statusBarRow: Bool { layout.statusBarClearance != nil && !useSideBar }
356
-
357
- /// Max centered title width; on the status bar row the clusters are lopsided, so both sides keep the wider one's room.
355
+ /// Max centered title width; on the status bar row the clusters are lopsided, so both sides
356
+ /// keep the wider one's room.
358
357
  private var centerTitleMaxWidth: CGFloat {
359
- guard let clearance = layout.statusBarClearance else { return (layout.contentWidth - Spacing.M * 2) / 2 }
360
- let back = goBack == nil || useSideBar ? 0 : DuoMetrics.controlSize + Spacing.S
358
+ guard let clearance = layout.statusBarClearance else { return headerLayout.frameWidth / 2 }
359
+ let back = goBack == nil || useSideBar ? 0 : HeaderLayoutMetrics.buttonSize + HeaderLayoutMetrics.titleGap
361
360
  let inset = max(clearance.left + back, clearance.right + headerRightWidth) + Spacing.S
362
361
  return max(layout.contentWidth - (Spacing.M + inset) * 2, 0)
363
362
  }
@@ -382,17 +381,8 @@ public struct NavigationHeader: View {
382
381
  ZStack {
383
382
  HStack(spacing: 0) {
384
383
  if let goBack, !useSideBar {
385
- if statusBarRow {
386
- SideBarButton(
387
- icon: "arrow-back",
388
- headerColor: headerColor,
389
- accessibilityId: "btn_navigation_back",
390
- action: goBack
391
- )
392
- } else {
393
- BackButton(color: headerColor, onBack: goBack)
394
- }
395
- Spacer().frame(width: Spacing.S)
384
+ BackButton(color: headerColor, onBack: goBack)
385
+ Spacer().frame(width: HeaderLayoutMetrics.titleGap)
396
386
  }
397
387
 
398
388
  if centerTitle {
@@ -403,33 +393,23 @@ public struct NavigationHeader: View {
403
393
  }
404
394
 
405
395
  if let headerRight, !(useSideBar && toolkitHeaderRight(headerRight) != nil) {
406
- Group {
407
- if statusBarRow, let toolkit = toolkitHeaderRight(headerRight) {
408
- Toolkit(
409
- headerRight: toolkit.data ?? HeaderRightData(),
410
- tintColor: toolkit.tintColor,
411
- layout: .sideBarRow
412
- )
413
- } else {
414
- AnyView(headerRight())
415
- }
416
- }
417
- .environment(\.headerColor, headerColor)
418
- .background(
419
- GeometryReader { geo in
420
- Color.clear.preference(key: HeaderRightWidthKey.self, value: geo.size.width)
421
- }
422
- )
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
+ )
423
403
  }
424
404
  }
425
- .padding(.leading, Spacing.M + (layout.statusBarClearance?.left ?? 0))
426
- .padding(.trailing, Spacing.M + (layout.statusBarClearance?.right ?? 0))
405
+ .padding(.leading, headerLayout.frameInset + (layout.statusBarClearance?.left ?? 0))
406
+ .padding(.trailing, headerLayout.frameInset + (layout.statusBarClearance?.right ?? 0))
427
407
 
428
408
  if centerTitle {
429
409
  titleArea(centered: true)
430
410
  // Compose caps a centered title at half the bar
431
411
  .frame(maxWidth: centerTitleMaxWidth)
432
- .padding(.horizontal, Spacing.M)
412
+ .padding(.horizontal, headerLayout.frameInset)
433
413
  }
434
414
  }
435
415
  .onPreferenceChange(HeaderRightWidthKey.self) { headerRightWidth = $0 }
@@ -452,6 +432,7 @@ public struct NavigationHeader: View {
452
432
  theme: theme,
453
433
  pop: navigator.map { navigator in { navigator.pop() } }
454
434
  ))
435
+ .headerSize()
455
436
  } else {
456
437
  switch headerTitle {
457
438
  case let .user(data)?:
@@ -505,7 +486,7 @@ struct HeaderBarBackground: View {
505
486
 
506
487
  // MARK: - Back button
507
488
 
508
- /// Mirrors Compose's `BackButton`: a 28pt circle with the back arrow.
489
+ /// Mirrors Compose's `BackButton`: a 32pt circle with the back arrow.
509
490
  private struct BackButton: View {
510
491
  let color: HeaderColor
511
492
  let onBack: () -> Void
@@ -515,8 +496,8 @@ private struct BackButton: View {
515
496
  Circle()
516
497
  .fill(color.backgroundButton)
517
498
  .overlay(Circle().stroke(color.borderColor, lineWidth: 0.2))
518
- .frame(width: 28, height: 28)
519
- .overlay(Icon(source: "arrow-back", size: 20, color: color.tintIconColor))
499
+ .frame(width: HeaderLayoutMetrics.buttonSize, height: HeaderLayoutMetrics.buttonSize)
500
+ .overlay(Icon(source: "arrow-back", size: HeaderLayoutMetrics.iconSize, color: color.tintIconColor))
520
501
  }
521
502
  .buttonStyle(ActiveOpacityButtonStyle())
522
503
  .accessibilityIdentifier("btn_navigation_back")
@@ -1,10 +1,5 @@
1
- //
2
- // HeaderBackground.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderBackground.kt`: the band behind the
6
- // header — the pink gradient (or the theme's header image) fading into the screen background.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderBackground.kt`: the band behind the
2
+ // header — the pink gradient (or the theme's header image) fading into the screen background.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -143,7 +138,6 @@ struct DuoScrollGradient: View {
143
138
  .allowsHitTesting(false)
144
139
  }
145
140
 
146
- /// The fade spans the gradient box.
147
141
  private var gradient: LinearGradient {
148
142
  LinearGradient(
149
143
  colors: [theme.colors.gradient, theme.colors.gradient.opacity(0)],
@@ -1,10 +1,5 @@
1
- //
2
- // HeaderJourney.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderJourney.kt`: a "start → end" title
6
- // with an optional description below.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderJourney.kt`: a "start → end" title
2
+ // with an optional description below.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -18,6 +13,7 @@ public struct HeaderJourneyView: View {
18
13
  }
19
14
 
20
15
  @Environment(\.screenLayout) private var layout
16
+ @Environment(\.contentLayout) private var contentLayout
21
17
 
22
18
  public var body: some View {
23
19
  if data.isLoading {
@@ -50,7 +46,7 @@ public struct HeaderJourneyView: View {
50
46
  MomoText(description, typography: .descriptionXsRegular, color: tint, maxLines: 1)
51
47
  }
52
48
  }
53
- .frame(maxWidth: headerTitleMaxWidth(layout), alignment: .leading)
49
+ .frame(maxWidth: headerTitleMaxWidth(layout, contentLayout), alignment: .leading)
54
50
  }
55
51
  .buttonStyle(ActiveOpacityButtonStyle())
56
52
  .disabled(data.onPress == nil)
@@ -1,10 +1,5 @@
1
- //
2
- // HeaderLocation.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderLocation.kt`: a description above a
6
- // tappable location with a chevron.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderLocation.kt`: a description above a
2
+ // tappable location with a chevron.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -18,6 +13,7 @@ public struct HeaderLocationView: View {
18
13
  }
19
14
 
20
15
  @Environment(\.screenLayout) private var layout
16
+ @Environment(\.contentLayout) private var contentLayout
21
17
 
22
18
  public var body: some View {
23
19
  if data.isLoading {
@@ -39,7 +35,7 @@ public struct HeaderLocationView: View {
39
35
  Icon(source: "16_arrow_chevron_down_small", size: 16, color: tint)
40
36
  }
41
37
  }
42
- .frame(maxWidth: headerTitleMaxWidth(layout), alignment: .leading)
38
+ .frame(maxWidth: headerTitleMaxWidth(layout, contentLayout), alignment: .leading)
43
39
  }
44
40
  .buttonStyle(ActiveOpacityButtonStyle())
45
41
  .disabled(data.onPress == nil)
@@ -1,10 +1,5 @@
1
- //
2
- // HeaderRight.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderRight.kt`: the mini-app toolkit
6
- // (shortcut / more / single tool, help center and close) in the bar or the iPhone Duo side bar.
7
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderRight.kt`: the mini-app toolkit
2
+ // (shortcut / more / single tool, help center and close) in the bar or the iPhone Duo side bar.
8
3
 
9
4
  import SwiftUI
10
5
 
@@ -143,9 +138,9 @@ private struct NavigationButtonConfig {
143
138
  let onPress: () -> Void
144
139
  }
145
140
 
146
- /// `sideBarColumn`: the iPhone Duo side bar; `sideBarRow`: the Duo header row on the status bar, same 48pt controls.
141
+ /// `sideBarColumn`: the iPhone Duo side bar, 48pt controls; `bar`: every header row, iPhone Duo status bar row included.
147
142
  enum ToolkitLayout {
148
- case bar, sideBarColumn, sideBarRow
143
+ case bar, sideBarColumn
149
144
  }
150
145
 
151
146
  struct Toolkit: View {
@@ -298,16 +293,14 @@ struct Toolkit: View {
298
293
  case .bar:
299
294
  horizontalBody
300
295
  case .sideBarColumn:
301
- VStack(spacing: Spacing.M) { sideBarControls(horizontal: false) }
302
- case .sideBarRow:
303
- HStack(spacing: Spacing.M) { sideBarControls(horizontal: true) }
296
+ VStack(spacing: Spacing.M) { sideBarControls }
304
297
  }
305
298
  }
306
299
  .onAppear(perform: loadFavoriteState)
307
300
  }
308
301
 
309
302
  @ViewBuilder
310
- private func sideBarControls(horizontal: Bool) -> some View {
303
+ private var sideBarControls: some View {
311
304
  let config = navigationButtonConfig
312
305
  let useHelpCenter = usesHelpCenter(context)
313
306
  if showsShortcut(headerRight, context) {
@@ -319,7 +312,7 @@ struct Toolkit: View {
319
312
  action: config.onPress
320
313
  )
321
314
  }
322
- SideBarGroup(headerColor: headerColor, itemCount: useHelpCenter ? 2 : 1, horizontal: horizontal) {
315
+ SideBarGroup(headerColor: headerColor, itemCount: useHelpCenter ? 2 : 1) {
323
316
  if useHelpCenter {
324
317
  SideBarGroupItem(
325
318
  icon: "help_center",
@@ -359,25 +352,30 @@ struct Toolkit: View {
359
352
  }
360
353
  toolButton(icon: headerRight.closeIcon, accessibilityId: "btn_navigation_close", action: onPressClose)
361
354
  }
362
- .frame(width: 65, height: 28)
355
+ .frame(
356
+ width: usesHelpCenter(context) ? HeaderLayoutMetrics.pillWidth : HeaderLayoutMetrics.buttonSize,
357
+ height: HeaderLayoutMetrics.buttonSize
358
+ )
363
359
  .background(headerColor.backgroundButton)
364
- .cornerRadius(14)
365
- .overlay(RoundedRectangle(cornerRadius: 14).stroke(headerColor.borderColor, lineWidth: 0.2))
360
+ .clipShape(Capsule())
361
+ .overlay(Capsule().stroke(headerColor.borderColor, lineWidth: 0.2))
366
362
  .padding(.leading, Spacing.S)
367
363
  }
368
364
  }
369
365
 
366
+ /// One half of the help / home pill; each half takes an equal share of the pill width.
370
367
  private func toolButton(icon: String, accessibilityId: String, action: @escaping () -> Void) -> some View {
371
368
  SwiftUI.Button(action: action) {
372
- Icon(source: icon, size: 20, color: headerColor.tintIconColor)
373
- .padding(4)
369
+ Icon(source: icon, size: HeaderLayoutMetrics.iconSize, color: headerColor.tintIconColor)
370
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
371
+ .contentShape(Rectangle())
374
372
  }
375
373
  .buttonStyle(ActiveOpacityButtonStyle())
376
374
  .accessibilityIdentifier(accessibilityId)
377
375
  }
378
376
  }
379
377
 
380
- /// Mirrors Compose's `NavigationButton`: the 28pt circular shortcut / more button.
378
+ /// Mirrors Compose's `NavigationButton`: the 32pt circular shortcut / more button.
381
379
  public struct NavigationButton: View {
382
380
  var disabled: Bool
383
381
  var icon: String
@@ -410,9 +408,9 @@ public struct NavigationButton: View {
410
408
  Circle()
411
409
  .fill(colors.backgroundButton)
412
410
  .overlay(Circle().stroke(colors.borderColor, lineWidth: 0.2))
413
- Icon(source: icon, size: 20, color: colors.tintIconColor)
411
+ Icon(source: icon, size: HeaderLayoutMetrics.iconSize, color: colors.tintIconColor)
414
412
  }
415
- .frame(width: 28, height: 28)
413
+ .frame(width: HeaderLayoutMetrics.buttonSize, height: HeaderLayoutMetrics.buttonSize)
416
414
  .overlay(alignment: .topTrailing) {
417
415
  if showBadge {
418
416
  BadgeDot(size: .small).offset(x: -Spacing.XXS, y: -Spacing.XXS)
@@ -1,9 +1,4 @@
1
- //
2
- // HeaderTitle.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderTitle.kt`: the plain header title.
6
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderTitle.kt`: the plain header title.
7
2
 
8
3
  import SwiftUI
9
4
 
@@ -1,12 +1,5 @@
1
- //
2
- // HeaderUser.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/HeaderUser.kt`.
6
- // Renders a `HeaderTitle.User`: an avatar group (1..n avatars with overflow),
7
- // a title with optional inline icons, and an optional subtitle. Shows a
8
- // skeleton shimmer placeholder while `isLoading`.
9
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/HeaderUser.kt`: avatar group, title with
2
+ // inline icons and an optional subtitle, or a skeleton while `isLoading`.
10
3
 
11
4
  import SwiftUI
12
5
 
@@ -20,6 +13,7 @@ public struct HeaderUserView: View {
20
13
  private let avatarSize: CGFloat = Spacing.XXL // 32
21
14
 
22
15
  @Environment(\.screenLayout) private var layout
16
+ @Environment(\.contentLayout) private var contentLayout
23
17
 
24
18
  public var body: some View {
25
19
  if data.isLoading {
@@ -74,7 +68,7 @@ public struct HeaderUserView: View {
74
68
  }
75
69
  }
76
70
  }
77
- .frame(maxWidth: headerTitleMaxWidth(layout), alignment: .leading)
71
+ .frame(maxWidth: headerTitleMaxWidth(layout, contentLayout), alignment: .leading)
78
72
 
79
73
  Spacer(minLength: 0)
80
74
  }
@@ -1,11 +1,5 @@
1
- //
2
- // SideBar.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/SideBar.kt`. iPhone Duo: back and toolkit
6
- // leave the header bar for a column in the side safe area, as the system bars do.
7
- // Port of RN `SideBarButton.tsx` + `useSideBarItemStyle`.
8
- //
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.
9
3
 
10
4
  import SwiftUI
11
5
 
@@ -142,26 +136,17 @@ struct SideBarButton: View {
142
136
  }
143
137
  }
144
138
 
145
- /// 48pt glass capsule grouping related controls, one item per 50pt: vertical in the side bar,
146
- /// horizontal on a header row.
139
+ /// 48pt vertical glass capsule grouping related side bar controls, one item per 50pt.
147
140
  struct SideBarGroup<Content: View>: View {
148
141
  let headerColor: HeaderColor
149
142
  let itemCount: Int
150
- var horizontal: Bool = false
151
143
  @ViewBuilder let content: () -> Content
152
144
 
153
145
  var body: some View {
154
146
  let length = itemCount > 1 ? DuoMetrics.itemPitch * CGFloat(itemCount) : DuoMetrics.controlSize
155
- Group {
156
- if horizontal {
157
- HStack(spacing: 0) { content() }
158
- .frame(width: length, height: DuoMetrics.controlSize)
159
- } else {
160
- VStack(spacing: 0) { content() }
161
- .frame(width: DuoMetrics.controlSize, height: length)
162
- }
163
- }
164
- .modifier(SideBarGlass(headerColor: headerColor, shape: RoundedRectangle(cornerRadius: Radius.XL)))
147
+ VStack(spacing: 0) { content() }
148
+ .frame(width: DuoMetrics.controlSize, height: length)
149
+ .modifier(SideBarGlass(headerColor: headerColor, shape: RoundedRectangle(cornerRadius: Radius.XL)))
165
150
  }
166
151
  }
167
152
 
@@ -1,11 +1,5 @@
1
- //
2
- // SnackBar.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/component/SnackBar.kt`: slides up above the screen's
6
- // footer (or the home indicator), stays for `duration`, then slides back down.
7
- // `Navigator.showSnackBar(_:)` drives it through the overplay host.
8
- //
1
+ // SwiftUI mirror of Compose's `navigation/component/SnackBar.kt`, driven by
2
+ // `Navigator.showSnackBar(_:)` through the overplay host.
9
3
 
10
4
  import Foundation
11
5
  import SwiftUI
@@ -38,8 +32,7 @@ public struct SnackBar {
38
32
  SnackBar(style: .custom, duration: duration, content: { AnyView(content()) })
39
33
  }
40
34
 
41
- /// Mirrors `SnackBar.Toast`: a placeholder with no custom content (parity with
42
- /// Compose where `Toast` currently renders nothing).
35
+ /// Mirrors `SnackBar.Toast`, which renders nothing in Compose either.
43
36
  public static func toast(duration: TimeInterval? = 3.0) -> SnackBar {
44
37
  SnackBar(style: .toast, duration: duration, content: nil)
45
38
  }
@@ -57,6 +50,7 @@ struct SnackBarView: View {
57
50
  let bottomInset: CGFloat
58
51
 
59
52
  @EnvironmentObject private var navigator: Navigator
53
+ @Environment(\.screenLayout) private var layout
60
54
 
61
55
  @State private var contentHeight: CGFloat = 0
62
56
  @State private var offsetY: CGFloat = 0
@@ -75,6 +69,9 @@ struct SnackBarView: View {
75
69
  )
76
70
  .offset(y: offsetY)
77
71
  .padding(.bottom, bottomInset)
72
+ // iPhone Duo: clear of the side toolbar strip, like the screen content (0 elsewhere)
73
+ .padding(.leading, layout.insetLeft)
74
+ .padding(.trailing, layout.insetRight)
78
75
  }
79
76
  .frame(maxWidth: .infinity, maxHeight: .infinity)
80
77
  .ignoresSafeArea()
@@ -102,7 +99,7 @@ struct SnackBarView: View {
102
99
  }
103
100
  }
104
101
 
105
- // Mirrors Compose's `openEvent`: 350ms slide up.
102
+ // Compose's `openEvent`.
106
103
  private func open() {
107
104
  DispatchQueue.main.async {
108
105
  withAnimation(.easeOut(duration: 0.35)) {
@@ -111,7 +108,7 @@ struct SnackBarView: View {
111
108
  }
112
109
  }
113
110
 
114
- // Animated slide down, then remove (mirrors Compose's `closeEvent`/`hideSnackBar`).
111
+ // Slides down, then removes the overplay (Compose's `closeEvent` / `hideSnackBar`).
115
112
  private func close() {
116
113
  guard !isClosing else { return }
117
114
  isClosing = true
@@ -133,7 +130,6 @@ struct SnackBarView: View {
133
130
  private func scheduleAutoDismiss() {
134
131
  guard let duration = snackBar.duration else { return }
135
132
  let workItem = DispatchWorkItem {
136
- // Only auto-dismiss if this snack bar is still the active overplay.
137
133
  if navigator.overplay?.id == overplayId {
138
134
  navigator.hideSnackBar()
139
135
  }
@@ -1,12 +1,5 @@
1
- //
2
- // HostBackGestureBridge.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `navigation/HostBackGestureBridge.kt`: the host owns the edge-pan
6
- // recogniser and routes a back into the topmost kit stack. NavigationContainer attaches itself.
7
- // `started` / `progressed` / `completed` / `cancelled` scrub the pop transition with the finger;
8
- // a host that only calls `pop` gets the regular animated back.
9
- //
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.
10
3
 
11
4
  import UIKit
12
5
 
@@ -1,11 +1,5 @@
1
- //
2
- // ModalScreen.swift
3
- // MoMoUIKits
4
- //
5
- // SwiftUI mirror of Compose's `ModalScreen` (navigation/ModalScreen.kt).
6
- // A centered overlay that fades + scales in over a dimmed scrim, and animates
7
- // back out before the overplay is removed. Driven by `Navigator.showModal`.
8
- //
1
+ // SwiftUI mirror of Compose's `navigation/ModalScreen.kt`, driven by `Navigator.showModal`: a
2
+ // centered overlay that fades + scales in over a dimmed scrim and animates out before removal.
9
3
 
10
4
  import SwiftUI
11
5
 
@@ -24,9 +18,11 @@ struct ModalScreen<Content: View>: View {
24
18
  @State private var didAppear = false
25
19
 
26
20
  var body: some View {
21
+ let modal = layout.modalLayout
22
+ let placement = modal.placement
27
23
  ZStack {
28
- // Dimmed scrim (mirrors `Color.Black.copy(alpha = 0.6f * alpha)`).
29
- Color.black.opacity(0.6 * scrimOpacity)
24
+ // full screen on foldables too, over the iPhone Duo control column
25
+ Colors.black20.opacity(modal.scrimOpacity * scrimOpacity)
30
26
  .ignoresSafeArea()
31
27
  .contentShape(Rectangle())
32
28
  .onTapGesture {
@@ -34,11 +30,14 @@ struct ModalScreen<Content: View>: View {
34
30
  }
35
31
 
36
32
  content()
33
+ // foldables: capped by the spec; nil leaves the size alone
34
+ .frame(
35
+ maxWidth: modal.isFoldable ? modal.popup.maxWidth : nil,
36
+ maxHeight: modal.isFoldable ? (modal.popup.maxHeight ?? placement.height) : nil
37
+ )
37
38
  .scaleEffect(contentScale)
38
39
  .opacity(contentOpacity)
39
- // iPhone Duo: center below the side status bar and above the home indicator
40
- .padding(.top, layout.isDuoDevice ? layout.duoTopInset : 0)
41
- .padding(.bottom, layout.isDuoDevice ? layout.insets.bottom : 0)
40
+ .padding(contentPadding(modal))
42
41
  }
43
42
  // Full screen like RN's Modal, so asymmetric landscape insets don't shift the content sideways.
44
43
  .frame(maxWidth: .infinity, maxHeight: .infinity)
@@ -56,6 +55,18 @@ struct ModalScreen<Content: View>: View {
56
55
  }
57
56
  }
58
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
+
59
70
  // Mirrors Compose's `openEvent`: 250ms fade + scale to 1.
60
71
  private func open() {
61
72
  DispatchQueue.main.async {