@momo-kits/native-kits 0.169.7 → 0.169.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 (150) hide show
  1. package/CLAUDE.md +2 -1
  2. package/build.gradle.kts +11 -0
  3. package/compose/build.gradle.kts +198 -0
  4. package/compose/compose.podspec +47 -0
  5. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +19 -0
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +154 -0
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -0
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +62 -0
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1067 -0
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +267 -0
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +82 -0
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +356 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +482 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +49 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +224 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +195 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +473 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +113 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +263 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +235 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +228 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +265 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +183 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +40 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +82 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +39 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +363 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +307 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +88 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +306 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +220 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +457 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +205 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +89 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +542 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +120 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +201 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +210 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +12 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +194 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +292 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +184 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +316 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +397 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +153 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +113 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +205 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +422 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +727 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +148 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +35 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +242 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +400 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +100 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +97 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +207 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +132 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +167 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +456 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +105 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +399 -0
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +204 -0
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +127 -0
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +114 -0
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +76 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +22 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +118 -0
  124. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
  125. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
  126. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
  127. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
  128. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
  129. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +218 -0
  130. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +48 -0
  131. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +144 -0
  132. package/gradle/libs.versions.toml +67 -0
  133. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  134. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  135. package/gradle.properties +24 -0
  136. package/gradlew +252 -0
  137. package/gradlew.bat +94 -0
  138. package/ios/Application/ApplicationEnvironment.swift +4 -1
  139. package/ios/Navigation/BottomTab/BottomTab.swift +19 -16
  140. package/ios/Navigation/BottomTab/BottomTabBar.swift +19 -33
  141. package/ios/Navigation/BottomTab/DuoTabBar.swift +3 -4
  142. package/ios/Navigation/BottomTab/TabBarMetrics.swift +3 -0
  143. package/ios/Typography/FontScale.swift +44 -8
  144. package/ios/native-kits.podspec +1 -1
  145. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  146. package/ios-demo/README.md +120 -0
  147. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +13 -1
  148. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +16 -0
  149. package/package.json +1 -1
  150. package/settings.gradle.kts +64 -0
@@ -95,8 +95,7 @@ struct BottomTabBar: View {
95
95
  layout,
96
96
  itemCount: items.count,
97
97
  hasCta: TabBarMetrics.hasCenterAction(floatingButton, tabCount: items.count)
98
- ),
99
- fixedFontScale: true
98
+ )
100
99
  )
101
100
  .padding(.bottom, TabBarMetrics.bottomGap(bottomInset))
102
101
  .frame(maxWidth: .infinity)
@@ -112,7 +111,6 @@ struct HorizontalTabBar: View {
112
111
  let selectedIndex: Int
113
112
  let onTabSelected: (Int) -> Void
114
113
  let width: CGFloat
115
- var fixedFontScale = false
116
114
 
117
115
  private var cta: BottomTabFloatingButton? {
118
116
  TabBarMetrics.hasCenterAction(floatingButton, tabCount: items.count) ? floatingButton : nil
@@ -147,7 +145,7 @@ struct HorizontalTabBar: View {
147
145
  }
148
146
  SwiftUI.Button { onTabSelected(index) } label: {
149
147
  VStack(spacing: TabBarMetrics.itemIconLabelGap) {
150
- TabItemContent(item: items[index], selected: index == selectedIndex, fixedFontScale: fixedFontScale)
148
+ TabItemContent(item: items[index], selected: index == selectedIndex)
151
149
  }
152
150
  .frame(width: itemWidth)
153
151
  .contentShape(Rectangle())
@@ -167,11 +165,20 @@ struct HorizontalTabBar: View {
167
165
  .padding(.top, cta == nil ? 0 : TabBarMetrics.ctaLift)
168
166
 
169
167
  if let cta {
170
- CenterAction(data: cta, fixedFontScale: fixedFontScale)
168
+ CenterAction(data: cta)
169
+ .offset(y: centerActionTop)
171
170
  }
172
171
  }
173
172
  .frame(width: width)
174
173
  }
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
+ }
175
182
  }
176
183
 
177
184
  /// One active indicator per bar: Background/tonal with its inner light (white 12% from below) and
@@ -203,21 +210,6 @@ struct ActiveIndicator: View {
203
210
  }
204
211
  }
205
212
 
206
- /// Tab labels follow the host/OS font scale but never grow past this, so the fixed-height container
207
- /// and the notch stay aligned.
208
- private let tabLabelMaxScale: CGFloat = 1.2
209
-
210
- /// Compose's `CappedFontScale`: caps the label scale at `tabLabelMaxScale` when enabled.
211
- struct CappedFontScale: ViewModifier {
212
- let enabled: Bool
213
-
214
- @Environment(\.momoFontScale) private var fontScale
215
-
216
- func body(content: Content) -> some View {
217
- content.environment(\.momoFontScale, enabled ? fontScale.cappedAt(tabLabelMaxScale) : fontScale)
218
- }
219
- }
220
-
221
213
  // MARK: - Tab item
222
214
 
223
215
  /// Icon in its indicator slot, label under it. The bar slides one shared active indicator behind the
@@ -227,7 +219,6 @@ struct TabItemContent: View {
227
219
  let selected: Bool
228
220
  var vertical = false
229
221
  var showLabel = true
230
- var fixedFontScale = false
231
222
 
232
223
  @Environment(\.appTheme) private var theme
233
224
 
@@ -235,19 +226,17 @@ struct TabItemContent: View {
235
226
  TabIcon(item: item, selected: selected, vertical: vertical)
236
227
  .frame(height: vertical ? TabBarMetrics.railIndicatorHeight : TabBarMetrics.indicatorHeight)
237
228
  if showLabel {
238
- let label = ZStack {
229
+ ZStack {
239
230
  labelText(theme.colors.text.secondary).opacity(selected ? 0 : 1)
240
231
  labelText(theme.colors.primary).opacity(selected ? 1 : 0)
241
232
  }
242
233
  .animation(TabBarMetrics.tintMotion, value: selected)
243
234
  .frame(maxWidth: vertical ? nil : .infinity)
244
235
  // fixed slot so a capped-scale label overflows downward and the icon above it stays put
245
- label
246
- .modifier(CappedFontScale(enabled: fixedFontScale))
247
- .frame(
248
- height: vertical ? TabBarMetrics.railLabelHeight : TabBarMetrics.labelHeight,
249
- alignment: .top
250
- )
236
+ .frame(
237
+ height: vertical ? TabBarMetrics.railLabelHeight : TabBarMetrics.labelHeight,
238
+ alignment: .top
239
+ )
251
240
  }
252
241
  }
253
242
 
@@ -324,7 +313,7 @@ private struct TabBadge: View {
324
313
  var body: some View {
325
314
  MomoText(label, typography: .actionXxsBold, color: Colors.black01, maxLines: 1)
326
315
  .truncationMode(.tail)
327
- .environment(\.momoFontScale, FontScale(userScaleRate: 1, useOSScaleRate: false))
316
+ .scaleSizeMaxRate(1)
328
317
  .padding(.horizontal, Spacing.XS)
329
318
  .frame(minWidth: 16, maxWidth: TabBarMetrics.badgeMaxWidth, minHeight: 16, maxHeight: 16)
330
319
  .background(Capsule().fill(isNumber ? theme.colors.error.primary : theme.colors.warning.primary))
@@ -342,7 +331,6 @@ struct CenterActionStyle: ButtonStyle {
342
331
  var iconContent: AnyView? = nil
343
332
  var labelContent: AnyView? = nil
344
333
  let label: String
345
- var fixedFontScale = false
346
334
 
347
335
  @Environment(\.appTheme) private var theme
348
336
 
@@ -379,7 +367,6 @@ struct CenterActionStyle: ButtonStyle {
379
367
  maxLines: 1
380
368
  )
381
369
  .truncationMode(.tail)
382
- .modifier(CappedFontScale(enabled: fixedFontScale))
383
370
  .padding(.horizontal, vertical ? Spacing.XS : Spacing.XXS)
384
371
  .frame(minHeight: vertical ? nil : TabBarMetrics.ctaLabelHeight)
385
372
  .overlay(labelContent?.allowsHitTesting(false))
@@ -393,13 +380,12 @@ struct CenterActionStyle: ButtonStyle {
393
380
  /// Center action (.Nav/CTA): button rising out of the notch, label under it.
394
381
  private struct CenterAction: View {
395
382
  let data: BottomTabFloatingButton
396
- var fixedFontScale = false
397
383
 
398
384
  var body: some View {
399
385
  SwiftUI.Button(action: data.onPress) { EmptyView() }
400
386
  .buttonStyle(CenterActionStyle(size: TabBarMetrics.ctaSize, vertical: false, icon: data.icon,
401
387
  iconContent: data.iconContent, labelContent: data.labelContent,
402
- label: data.label, fixedFontScale: fixedFontScale))
388
+ label: data.label))
403
389
  .frame(width: TabBarMetrics.ctaSlotWidth, height: TabBarMetrics.ctaSize + TabBarMetrics.ctaLabelGap + TabBarMetrics.ctaLabelHeight)
404
390
  .accessibilityLabel(data.label)
405
391
  .accessibilityIdentifier(data.label)
@@ -131,7 +131,7 @@ private struct DuoRailTabBar: View {
131
131
  compression.onTabSelected()
132
132
  } label: {
133
133
  VStack(spacing: 0) {
134
- TabItemContent(item: items[index], selected: index == selectedIndex, vertical: true, fixedFontScale: true)
134
+ TabItemContent(item: items[index], selected: index == selectedIndex, vertical: true)
135
135
  }
136
136
  .frame(width: TabBarMetrics.railItemWidth, height: TabBarMetrics.railItemHeight)
137
137
  .contentShape(Rectangle())
@@ -170,8 +170,7 @@ private struct DuoFloatingTabBar: View {
170
170
  layout,
171
171
  itemCount: items.count,
172
172
  hasCta: TabBarMetrics.hasCenterAction(floatingButton, tabCount: items.count)
173
- ),
174
- fixedFontScale: true
173
+ )
175
174
  )
176
175
  .padding(.bottom, layout.duoFloatingTabBarBottom)
177
176
  .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
@@ -187,7 +186,7 @@ private struct RailCenterAction: View {
187
186
  SwiftUI.Button(action: data.onPress) { EmptyView() }
188
187
  .buttonStyle(CenterActionStyle(size: TabBarMetrics.railCtaSize, vertical: true, icon: data.icon,
189
188
  iconContent: data.iconContent, labelContent: data.labelContent,
190
- label: data.label, fixedFontScale: true))
189
+ label: data.label))
191
190
  .frame(width: TabBarMetrics.railCtaWidth, height: TabBarMetrics.railCtaHeight)
192
191
  .accessibilityLabel(data.label)
193
192
  .accessibilityIdentifier(data.label)
@@ -23,6 +23,9 @@ enum TabBarMetrics {
23
23
  // label overflows downward instead of pushing the icon up
24
24
  static let labelHeight: CGFloat = 18
25
25
  static let railLabelHeight: CGFloat = 14
26
+ // font scale cap for the whole bar (RN ScaleSizeProvider around renderTabBar): its text follows the
27
+ // OS/host scale up to 1.2× so the fixed-height container and the notch stay aligned
28
+ static let labelMaxScale: CGFloat = 1.2
26
29
  static let indicatorRadius = Radius.XL
27
30
  // home indicator / gesture bar area under the container
28
31
  static let systemIndicatorHeight: CGFloat = 24
@@ -15,7 +15,8 @@ public struct FontScale: Equatable {
15
15
  /// From the app window, not UIScreen.main (which stays on one display on iPhone Duo).
16
16
  public let windowShortSide: CGFloat
17
17
  /// Opt-in ceiling (Compose's `MiniAppContext.scaleSizeMaxRate`): caps the result at size × maxScaleRate
18
- /// on both the userScaleRate and OS paths; nil means no cap. Used by `CappedFontScale` for tab labels.
18
+ /// on both the userScaleRate and OS paths; nil means no cap. Set it with `ScaleSizeScope` or
19
+ /// `MiniAppContext.scaleSizeMaxRate`.
19
20
  public let maxScaleRate: CGFloat?
20
21
 
21
22
  public init(
@@ -54,9 +55,8 @@ public struct FontScale: Equatable {
54
55
  return cap(max(deviceScaled, osScaled))
55
56
  }
56
57
 
57
- /// A copy that caps the scale at `rate` while keeping the host/OS inputs — the SwiftUI mirror of
58
- /// Compose's `CappedFontScale` wrapper.
59
- public func cappedAt(_ rate: CGFloat) -> FontScale {
58
+ /// A copy that caps the scale at `rate` (nil lifts the cap) while keeping the host/OS inputs.
59
+ public func cappedAt(_ rate: CGFloat?) -> FontScale {
60
60
  FontScale(
61
61
  userScaleRate: userScaleRate,
62
62
  useOSScaleRate: useOSScaleRate,
@@ -74,14 +74,15 @@ public struct FontScale: Equatable {
74
74
 
75
75
  /// A host-pushed mini-app context wins per field, matching Compose's
76
76
  /// `context?.useOSScaleRate ?: DesignSystemKits.getConfigs().useOSScaleRate`.
77
- public func overriding(userScaleRate: CGFloat?, useOSScaleRate: Bool?) -> FontScale {
78
- guard userScaleRate != nil || useOSScaleRate != nil else { return self }
77
+ public func overriding(userScaleRate: CGFloat?, useOSScaleRate: Bool?, maxScaleRate: CGFloat? = nil) -> FontScale {
78
+ let overridesAny = userScaleRate != nil || useOSScaleRate != nil || maxScaleRate != nil
79
+ guard overridesAny else { return self }
79
80
  return FontScale(
80
81
  userScaleRate: userScaleRate ?? self.userScaleRate,
81
82
  useOSScaleRate: useOSScaleRate ?? self.useOSScaleRate,
82
83
  osFontScale: osFontScale,
83
84
  windowShortSide: windowShortSide,
84
- maxScaleRate: maxScaleRate
85
+ maxScaleRate: maxScaleRate ?? self.maxScaleRate
85
86
  )
86
87
  }
87
88
  }
@@ -120,9 +121,44 @@ private struct MomoFontScaleModifier: ViewModifier {
120
121
  \.momoFontScale,
121
122
  store.fontScale.overriding(
122
123
  userScaleRate: context?.userScaleRate,
123
- useOSScaleRate: context?.useOSScaleRate
124
+ useOSScaleRate: context?.useOSScaleRate,
125
+ maxScaleRate: context?.scaleSizeMaxRate
124
126
  )
125
127
  )
126
128
  .environment(\.designSystemKitsConfigs, store.getConfigs())
127
129
  }
128
130
  }
131
+
132
+ /// Compose's `ScaleSizeScope` (RN `ScaleSizeProvider`): caps the font scale of `content` at
133
+ /// size × `scaleSizeMaxRate`; the nearest scope wins and nil lifts the cap.
134
+ public struct ScaleSizeScope<Content: View>: View {
135
+ private let scaleSizeMaxRate: CGFloat?
136
+ private let content: Content
137
+
138
+ public init(scaleSizeMaxRate: CGFloat? = nil, @ViewBuilder content: () -> Content) {
139
+ self.scaleSizeMaxRate = scaleSizeMaxRate
140
+ self.content = content()
141
+ }
142
+
143
+ public var body: some View {
144
+ content.scaleSizeMaxRate(scaleSizeMaxRate)
145
+ }
146
+ }
147
+
148
+ public extension View {
149
+ /// Modifier form of `ScaleSizeScope`.
150
+ func scaleSizeMaxRate(_ rate: CGFloat?) -> some View {
151
+ modifier(ScaleSizeMaxRateModifier(rate: rate))
152
+ }
153
+ }
154
+
155
+ /// Derives from the injected snapshot, so it stays live under `.momoFontScale()`.
156
+ private struct ScaleSizeMaxRateModifier: ViewModifier {
157
+ let rate: CGFloat?
158
+
159
+ @Environment(\.momoFontScale) private var fontScale
160
+
161
+ func body(content: Content) -> some View {
162
+ content.environment(\.momoFontScale, fontScale.cappedAt(rate))
163
+ }
164
+ }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.169.7'
3
+ s.version = '0.169.8-beta.1'
4
4
  s.summary = 'MoMoUIKits for iOS'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKitsDemo'
3
- s.version = '0.169.7'
3
+ s.version = '0.169.8-beta.1'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -0,0 +1,120 @@
1
+ # MoMoUIKitsDemo
2
+
3
+ SwiftUI demo browser for `MoMoUIKits`.
4
+
5
+ The package can optionally host a Compose UIKits screen by receiving a
6
+ `UIViewController` factory from the host app. It does not import the KMP
7
+ `shared` module directly.
8
+
9
+ SwiftUI mode reuses the full demo screen set from
10
+ `sample/iosApp/iosApp/Demo`, including the sample `HomeView` registry and demo
11
+ screens for all currently available components.
12
+
13
+ ## CocoaPods
14
+
15
+ In the host app `Podfile`, include both local pods:
16
+
17
+ ```ruby
18
+ pod 'MoMoUIKits', :path => '../momo-native-kits/ios/native-kits.podspec'
19
+ pod 'MoMoUIKitsDemo', :path => '../momo-native-kits/ios-demo'
20
+ ```
21
+
22
+ Adjust the relative paths to match the host app checkout.
23
+
24
+ ## Host App Usage
25
+
26
+ ```swift
27
+ import MoMoUIKitsDemo
28
+ import shared
29
+
30
+ class UIKitsViewController: BaseComposeAppViewController {
31
+ override func getViewController() -> UIViewController? {
32
+ let params = self.application.data as? [String: Any]
33
+
34
+ return MoMoUIKitsDemoViewControllerFactory.make(
35
+ context: MoMoUIKitsDemoContext(
36
+ appId: params?["appId"] as? String ?? "",
37
+ appCode: params?["code"] as? String ?? "",
38
+ appName: params?["name"] as? String,
39
+ appIcon: params?["icon"] as? String ?? ""
40
+ ),
41
+ composeViewController: {
42
+ UIKitsScreenComposeViewControllerKt.UIKitsScreenComposeViewController(
43
+ params: params
44
+ )
45
+ }
46
+ )
47
+ }
48
+
49
+ override func viewDidDisappear(_ animated: Bool) {
50
+ super.viewDidDisappear(animated)
51
+ composeViewController = nil
52
+ }
53
+ }
54
+ ```
55
+
56
+ If the host does not pass `composeViewController`, the demo opens directly in
57
+ SwiftUI mode.
58
+
59
+ ## Included SwiftUI Demos
60
+
61
+ The pod includes the sample demo screens for:
62
+
63
+ - Animated Header
64
+ - Avatar
65
+ - Badge
66
+ - Baseline View
67
+ - Bottom Tab
68
+ - Button
69
+ - Carousel
70
+ - Checkbox
71
+ - Chip
72
+ - Collapse
73
+ - DateTimePicker
74
+ - Divider
75
+ - Header User
76
+ - Icon Button
77
+ - Image
78
+ - Information
79
+ - Input
80
+ - Input DropDown
81
+ - Input Money
82
+ - Input OTP
83
+ - Input Phone Number
84
+ - Input Search
85
+ - Input TextArea
86
+ - Loader
87
+ - Navigation
88
+ - Pagination
89
+ - Popup Display
90
+ - Popup Notify
91
+ - Popup Promotion
92
+ - Progress Info
93
+ - Radio
94
+ - Rating
95
+ - Skeleton
96
+ - Slider
97
+ - SnackBar
98
+ - Stepper
99
+ - Steps
100
+ - Suggest Action
101
+ - Swipe
102
+ - Switch
103
+ - TabView
104
+ - Tag
105
+ - Theme
106
+ - Title
107
+ - Tooltip
108
+ - Typography
109
+ - Uploader
110
+
111
+ ## Validation Notes
112
+
113
+ Validated locally with:
114
+
115
+ ```sh
116
+ pod ipc spec ios/MoMoUIKits.podspec
117
+ pod ipc spec ios-demo/MoMoUIKitsDemo.podspec
118
+ pod lib lint ios/MoMoUIKits.podspec --allow-warnings --skip-import-validation
119
+ pod lib lint ios-demo/MoMoUIKitsDemo.podspec --allow-warnings --skip-import-validation --include-podspecs=ios/MoMoUIKits.podspec
120
+ ```
@@ -39,6 +39,8 @@ private struct DemoConfig: Hashable {
39
39
  var initialRouteName = "Momo"
40
40
  var compressionBehavior: DuoBarCompressionBehavior = .toolbar
41
41
  var backToInitialTab = true
42
+ // a sticky footer in the tab's content body, to check it clears the floating bar
43
+ var footer = false
42
44
 
43
45
  var visibleTabs: [TabConfig] { Array(tabs.prefix(tabCount)) }
44
46
  }
@@ -107,7 +109,10 @@ struct BottomTabDemoContent: View {
107
109
  icon: tab.icon,
108
110
  showDot: tab.showDot,
109
111
  badgeLabel: tab.badgeLabel,
110
- options: NavigationOptions(headerTitle: .default(tab.label)),
112
+ options: NavigationOptions(
113
+ headerTitle: .default(tab.label),
114
+ footer: config.footer ? { AnyView(demoFooter) } : nil
115
+ ),
111
116
  screen: { TabContent(name: tab.name, config: $config, focused: $focused) }
112
117
  )
113
118
  },
@@ -124,6 +129,10 @@ struct BottomTabDemoContent: View {
124
129
  .onAppear { ctaLottieLoader.load() }
125
130
  }
126
131
 
132
+ private var demoFooter: some View {
133
+ MoMoUIKits.Button(title: "Footer trong content", action: {}, isFull: true)
134
+ }
135
+
127
136
  private var floatingButton: BottomTabFloatingButton? {
128
137
  guard config.special else { return nil }
129
138
  guard config.ctaLottie else {
@@ -202,6 +211,9 @@ private struct TabContent: View {
202
211
  ])
203
212
  Options(title: "backToInitialTab", hint: "Back ở tab khác quay về tab đầu trước khi rời màn",
204
213
  options: yesNo(config.backToInitialTab) { config.backToInitialTab = $0 })
214
+ Options(title: "footer",
215
+ hint: "Footer dính trong content body, kiểm tra nó nằm trên thanh tab nổi",
216
+ options: yesNo(config.footer) { config.footer = $0 })
205
217
  }
206
218
 
207
219
  Section(title: "Nút giữa (floatingButton)") {
@@ -39,6 +39,8 @@ struct TypographyDemo: View {
39
39
  // MARK: - Preview
40
40
 
41
41
  private struct TypographyPreview: View {
42
+ @Environment(\.appTheme) private var theme
43
+
42
44
  var body: some View {
43
45
  BasicColumnBox("Headers", alignment: .leading) {
44
46
  MomoText("Headline Default Bold", typography: .headlineDefaultBold)
@@ -63,6 +65,20 @@ private struct TypographyPreview: View {
63
65
  MomoText("Action XS Bold", typography: .actionXsBold)
64
66
  MomoText("Action XXS Bold", typography: .actionXxsBold)
65
67
  }
68
+ BasicColumnBox("ScaleSizeScope", alignment: .leading) {
69
+ MomoText(
70
+ "Increase the system font size to compare",
71
+ typography: .descriptionXsRegular,
72
+ color: theme.colors.text.secondary
73
+ )
74
+ MomoText("No scope", typography: .bodyDefaultRegular)
75
+ ScaleSizeScope(scaleSizeMaxRate: 1) {
76
+ MomoText("ScaleSizeScope(1)", typography: .bodyDefaultRegular)
77
+ }
78
+ ScaleSizeScope(scaleSizeMaxRate: 1.2) {
79
+ MomoText("ScaleSizeScope(1.2)", typography: .bodyDefaultRegular)
80
+ }
81
+ }
66
82
  }
67
83
  }
68
84
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.169.7",
3
+ "version": "0.169.8-beta.1-debug",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "publish:local": "bash publish.sh local"
@@ -0,0 +1,64 @@
1
+ import org.gradle.kotlin.dsl.maven
2
+
3
+ rootProject.name = "momo-native-kits"
4
+ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
5
+
6
+ pluginManagement {
7
+ repositories {
8
+ google {
9
+ mavenContent {
10
+ includeGroupAndSubgroups("androidx")
11
+ includeGroupAndSubgroups("com.android")
12
+ includeGroupAndSubgroups("com.google")
13
+ }
14
+ }
15
+ mavenCentral()
16
+ gradlePluginPortal()
17
+ maven {
18
+ url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
19
+ credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
20
+ }
21
+ maven {
22
+ url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
23
+ credentials {
24
+ username = "viewer"
25
+ password = "viewer"
26
+ }
27
+ isAllowInsecureProtocol = true
28
+ }
29
+ }
30
+ }
31
+
32
+ dependencyResolutionManagement {
33
+ repositories {
34
+ google {
35
+ mavenContent {
36
+ includeGroupAndSubgroups("androidx")
37
+ includeGroupAndSubgroups("com.android")
38
+ includeGroupAndSubgroups("com.google")
39
+ }
40
+ }
41
+ mavenCentral()
42
+ maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
43
+ maven {
44
+ url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
45
+ credentials {
46
+ username = "download_packages";
47
+ password = "gldt-bjDqLpU_sPcHDuXau2ws"
48
+ }
49
+ }
50
+ maven {
51
+ url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
52
+ credentials {
53
+ username = "viewer"
54
+ password = "viewer"
55
+ }
56
+ isAllowInsecureProtocol = true
57
+ }
58
+ }
59
+ }
60
+
61
+ include(":compose")
62
+
63
+ include(":sample:androidApp")
64
+ include(":sample:shared")