@momo-kits/native-kits 0.169.6-debug → 0.169.7-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 (134) hide show
  1. package/compose/build.gradle.kts +1 -1
  2. package/compose/compose.podspec +1 -1
  3. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +1 -2
  4. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1 -5
  5. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +2 -4
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +13 -12
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +2 -2
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -1
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +13 -73
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +1 -1
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +1 -8
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +3 -8
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -1
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +1 -3
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +7 -15
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +1 -3
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +1 -2
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -2
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +1 -2
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +1 -1
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +1 -2
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -2
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +6 -30
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +2 -18
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -2
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -3
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +6 -24
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -5
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +1 -7
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -3
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +1 -1
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +4 -30
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +2 -7
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +1 -2
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +4 -7
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +5 -1
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -12
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -2
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +1 -1
  40. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +1 -1
  41. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +1 -2
  42. package/gradle/libs.versions.toml +0 -2
  43. package/gradle.properties +1 -1
  44. package/ios/Application/ApplicationEnvironment.swift +2 -3
  45. package/ios/Application/DesignSystemKits.swift +4 -20
  46. package/ios/Application/DesignSystemKitsPayload.swift +0 -8
  47. package/ios/Application/LanguageSource.swift +0 -8
  48. package/ios/Application/Localize.swift +7 -31
  49. package/ios/Application/LocalizeModifier.swift +0 -8
  50. package/ios/Application/MaxApi.swift +3 -11
  51. package/ios/Avatar/Avatar.swift +0 -1
  52. package/ios/Badge/Badge.swift +0 -1
  53. package/ios/Badge/BadgeRibbon.swift +2 -5
  54. package/ios/Button/Button.swift +2 -5
  55. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +2 -2
  56. package/ios/Carousel/Carousel.swift +5 -17
  57. package/ios/Checkbox/Checkbox.swift +0 -2
  58. package/ios/Colors+Radius+Spacing/Theme.swift +0 -7
  59. package/ios/DateTimePicker/DateTimePicker.swift +4 -10
  60. package/ios/DateTimePicker/DateTimePickerTypes.swift +1 -3
  61. package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -3
  62. package/ios/DateTimePicker/WheelPicker.swift +2 -4
  63. package/ios/Extensions/SkeletonUICompat.swift +0 -8
  64. package/ios/Icon/Icon.swift +1 -3
  65. package/ios/IconButton/IconButton.swift +0 -2
  66. package/ios/Input/ErrorView.swift +0 -7
  67. package/ios/Input/Input.swift +6 -19
  68. package/ios/Input/InputPhoneNumber.swift +0 -11
  69. package/ios/Input/InputSearch.swift +0 -6
  70. package/ios/Input/InputTextArea.swift +1 -12
  71. package/ios/InputDropDown/InputDropDown.swift +1 -11
  72. package/ios/InputMoney/InputMoney.swift +9 -28
  73. package/ios/InputOTP/InputOTP.swift +2 -9
  74. package/ios/Layout/Item.swift +1 -2
  75. package/ios/Layout/ModalLayout.swift +7 -14
  76. package/ios/Layout/ScreenLayout.swift +2 -7
  77. package/ios/Loader/Loader.swift +3 -12
  78. package/ios/Lottie/LottieView.swift +0 -11
  79. package/ios/Navigation/BottomSheet.swift +14 -35
  80. package/ios/Navigation/BottomTab/BottomTab.swift +10 -19
  81. package/ios/Navigation/BottomTab/BottomTabBar.swift +4 -10
  82. package/ios/Navigation/BottomTab/CurvedContainer.swift +5 -11
  83. package/ios/Navigation/BottomTab/DuoBarCompression.swift +6 -12
  84. package/ios/Navigation/BottomTab/DuoTabBar.swift +2 -7
  85. package/ios/Navigation/BottomTab/TabBarMetrics.swift +3 -9
  86. package/ios/Navigation/Component/FloatingButton.swift +4 -11
  87. package/ios/Navigation/Component/Header.swift +4 -8
  88. package/ios/Navigation/Component/HeaderBackground.swift +2 -8
  89. package/ios/Navigation/Component/HeaderJourney.swift +2 -7
  90. package/ios/Navigation/Component/HeaderLocation.swift +2 -7
  91. package/ios/Navigation/Component/HeaderRight.swift +2 -7
  92. package/ios/Navigation/Component/HeaderTitle.swift +1 -6
  93. package/ios/Navigation/Component/HeaderUser.swift +2 -9
  94. package/ios/Navigation/Component/SideBar.swift +3 -8
  95. package/ios/Navigation/Component/SnackBar.swift +5 -13
  96. package/ios/Navigation/HostBackGestureBridge.swift +3 -9
  97. package/ios/Navigation/ModalScreen.swift +2 -8
  98. package/ios/Navigation/Navigation.swift +2 -15
  99. package/ios/Navigation/NavigationContainer.swift +3 -12
  100. package/ios/Navigation/Navigator.swift +15 -27
  101. package/ios/Navigation/StackScreen.swift +8 -28
  102. package/ios/Navigation/StackTransition.swift +3 -11
  103. package/ios/Navigation/SwipeBackHaptic.swift +2 -7
  104. package/ios/Navigation/Tracking/ScreenTracker.swift +2 -7
  105. package/ios/Pagination/PaginationDot.swift +0 -9
  106. package/ios/Pagination/PaginationNumber.swift +1 -9
  107. package/ios/Pagination/PaginationScroll.swift +2 -14
  108. package/ios/Pagination/PaginationWhiteDot.swift +1 -10
  109. package/ios/Popup/PopupDisplay.swift +3 -3
  110. package/ios/Popup/PopupInput.swift +1 -1
  111. package/ios/Popup/PopupLayout.swift +3 -3
  112. package/ios/PopupView/FullscreenPopup.swift +3 -4
  113. package/ios/PopupView/PopupView.swift +2 -2
  114. package/ios/PopupView/Utils++.swift +1 -2
  115. package/ios/ProgressInfo/ProgressInfo.swift +2 -13
  116. package/ios/Skeleton/Skeleton.swift +2 -10
  117. package/ios/Slider/Slider.swift +5 -12
  118. package/ios/StatusBarTap/StatusBarTap.h +2 -3
  119. package/ios/StatusBarTap/StatusBarTap.m +3 -16
  120. package/ios/Stepper/Stepper.swift +8 -27
  121. package/ios/Steps/Steps.swift +9 -11
  122. package/ios/Swipeable/SwipeCell.swift +2 -2
  123. package/ios/Swipeable/SwipeCellModel.swift +3 -6
  124. package/ios/TabView/TabView.swift +12 -25
  125. package/ios/Template/TrustBanner/TrustBanner.swift +2 -9
  126. package/ios/Tooltip/Tooltip.swift +2 -7
  127. package/ios/Typography/FontScale.swift +3 -15
  128. package/ios/Typography/Text.swift +2 -7
  129. package/ios/Typography/Typography.swift +8 -10
  130. package/ios/Uploader/Uploader.swift +2 -17
  131. package/ios/native-kits.podspec +1 -1
  132. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  133. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +0 -8
  134. package/package.json +1 -1
@@ -51,7 +51,6 @@ fun Modifier.shimmerLoadingAnimation(
51
51
  angleOfAxisY: Float = 0f,
52
52
  durationMillis: Int = DEFAULT_DURATION_MILLIS,
53
53
  ): Modifier {
54
- // Memoize calculations to avoid repeated computations
55
54
  val widthOfShadowBrush = remember(maxWidth) {
56
55
  (maxWidth * SHADOW_BRUSH_PERCENTAGE).toInt()
57
56
  }
@@ -75,7 +74,6 @@ fun Modifier.shimmerLoadingAnimation(
75
74
  )
76
75
 
77
76
  return drawBehind {
78
- // Memoize brush creation by using remember in the calling composable
79
77
  val startX = translateAnimation.value - widthOfShadowBrush
80
78
  val endX = translateAnimation.value
81
79
 
@@ -69,24 +69,9 @@ private fun formatLabel(value: Float): String =
69
69
  if (value == value.toLong().toFloat()) value.toLong().toString()
70
70
  else ((value * 10).toLong() / 10.0).toString()
71
71
 
72
- // ── Component ─────────────────────────────────────────────────────────────────
73
-
74
72
  /**
75
- * Range slider (or single-thumb when [disableRange] = true), migrated from React Native.
76
- *
77
- * @param min Minimum selectable value.
78
- * @param max Maximum selectable value.
79
- * @param step Snap increment between values.
80
- * @param modifier Modifier applied to the root container.
81
- * @param low Initial lower-thumb value (defaults to [min]).
82
- * @param high Initial upper-thumb value (defaults to [max]).
83
- * @param minRange Minimum required gap between low and high (default 0).
84
- * @param disableRange When true only the low thumb is shown (single-value mode).
85
- * @param floatingLabel When true a value label floats above the active thumb during drag.
86
- * @param disabled Non-interactive; rendered in the disabled colour.
87
- * @param onValueChanged Invoked with (low, high, byUser) on every value change.
88
- * @param onSliderTouchStart Invoked when a drag gesture begins.
89
- * @param onSliderTouchEnd Invoked when a drag gesture ends.
73
+ * Range slider ported from RN; [disableRange] keeps only the low thumb.
74
+ * [low]/[high] only seed the thumbs (not controlled); [minRange] is the minimum gap between them.
90
75
  */
91
76
  @Composable
92
77
  fun Slider(
@@ -107,7 +92,6 @@ fun Slider(
107
92
  val theme = AppTheme.current
108
93
  val density = LocalDensity.current
109
94
 
110
- // Validated, step-snapped initial values
111
95
  val initLow = remember(low, min, max, step) {
112
96
  clamp(low ?: min, min, max)
113
97
  }
@@ -118,7 +102,6 @@ fun Slider(
118
102
  var lowValue by remember { mutableFloatStateOf(initLow) }
119
103
  var highValue by remember { mutableFloatStateOf(initHigh) }
120
104
 
121
- // Smoothly animated display fractions
122
105
  val lowFraction by animateFloatAsState(
123
106
  targetValue = valueToFraction(lowValue, min, max),
124
107
  animationSpec = spring(stiffness = 1200f),
@@ -155,13 +138,11 @@ fun Slider(
155
138
  modifier = Modifier
156
139
  .fillMaxWidth()
157
140
  .onGloballyPositioned { coords -> trackWidthPx = coords.size.width.toFloat() }
158
- // ── Gesture handling ──────────────────────────────────────────
159
141
  .pointerInput(disabled, min, max, step, minRange, disableRange) {
160
142
  if (disabled) return@pointerInput
161
143
 
162
144
  awaitPointerEventScope {
163
145
  while (true) {
164
- // Finger down
165
146
  val downEvent = awaitPointerEvent()
166
147
  val downChange = downEvent.changes.firstOrNull() ?: continue
167
148
  val touchX = downChange.position.x
@@ -176,7 +157,6 @@ fun Slider(
176
157
  isDragging = true
177
158
  currentOnTouchStart(lowValue, highValue)
178
159
 
179
- // Apply initial press
180
160
  applyDrag(touchX, trackWidthPx, thumbSizePx,
181
161
  min, max, step, minRange, draggingLow,
182
162
  lowValue, highValue) { nl, nh ->
@@ -185,7 +165,6 @@ fun Slider(
185
165
  currentOnValueChanged(nl, nh, true)
186
166
  }
187
167
 
188
- // Track move / release
189
168
  while (true) {
190
169
  val moveEvent = awaitPointerEvent()
191
170
  val moveChange = moveEvent.changes.firstOrNull() ?: break
@@ -212,7 +191,6 @@ fun Slider(
212
191
  val trackWidth = maxWidth
213
192
  val availableWidth = trackWidth - THUMB_SIZE
214
193
 
215
- // ── Floating label ────────────────────────────────────────────────
216
194
  if (floatingLabel && isDragging) {
217
195
  val activeFraction = if (draggingLow) lowFraction else highFraction
218
196
  val activeValue = if (draggingLow) lowValue else highValue
@@ -244,7 +222,7 @@ fun Slider(
244
222
  // Top padding pushes track + thumbs below the label when floatingLabel is on
245
223
  val topPad = if (floatingLabel) THUMB_SIZE + LABEL_GAP else 0.dp
246
224
 
247
- // ── Inactive track (full width) ───────────────────────────────────
225
+ // Inactive track, full width
248
226
  Box(
249
227
  modifier = Modifier
250
228
  .align(Alignment.TopStart)
@@ -256,7 +234,7 @@ fun Slider(
256
234
  .background(trackInactiveColor)
257
235
  )
258
236
 
259
- // ── Active track (selected range / single value) ──────────────────
237
+ // Active track: the selected range, or up to the single thumb
260
238
  val activeStartFraction = if (disableRange) 0f else lowFraction
261
239
  val activeEndFraction = if (disableRange) lowFraction else highFraction
262
240
  val activeStartDp = THUMB_SIZE / 2 + availableWidth * activeStartFraction
@@ -275,7 +253,7 @@ fun Slider(
275
253
  )
276
254
  }
277
255
 
278
- // ── Low thumb ─────────────────────────────────────────────────────
256
+ // Low thumb
279
257
  Box(
280
258
  modifier = Modifier
281
259
  .align(Alignment.TopStart)
@@ -287,7 +265,7 @@ fun Slider(
287
265
  .border(THUMB_BORDER, theme.colors.background.surface, RoundedCornerShape(percent = 100))
288
266
  )
289
267
 
290
- // ── High thumb (range mode only) ──────────────────────────────────
268
+ // High thumb
291
269
  if (!disableRange) {
292
270
  Box(
293
271
  modifier = Modifier
@@ -304,8 +282,6 @@ fun Slider(
304
282
  }
305
283
  }
306
284
 
307
- // ── Private drag helper ───────────────────────────────────────────────────────
308
-
309
285
  private fun applyDrag(
310
286
  positionX: Float,
311
287
  trackWidthPx: Float,
@@ -213,7 +213,6 @@ private fun StepsHorizontal(
213
213
  ),
214
214
  horizontalAlignment = colAlign,
215
215
  ) {
216
- // time label shown above the icon row
217
216
  if (!item.time.isNullOrEmpty()) {
218
217
  Text(
219
218
  text = item.time,
@@ -313,7 +312,6 @@ private fun StepsVertical(
313
312
  val completedLine = remember(theme.colors.primary) { theme.colors.primary.copy(alpha = 0.2f) }
314
313
  val defaultLine = theme.colors.background.default
315
314
  val useSmall = size == StepsSize.SMALL
316
- // Fixed connector height; grows proportionally with content in practice
317
315
  val connectorHeight: Dp = if (useSmall) 24.dp else 32.dp
318
316
 
319
317
  Column(modifier = Modifier.fillMaxWidth()) {
@@ -412,23 +410,9 @@ private fun StepsVertical(
412
410
  }
413
411
  }
414
412
 
415
- // ─── Public API ────────────────────────────────────────────────────────────────
416
-
417
413
  /**
418
- * Steps — guided progress indicator through a sequence of procedural steps.
419
- *
420
- * Mirrors the React Native `Steps` component from `@momo-kits/step`.
421
- *
422
- * @param steps Ordered list of [StepItem] values to display.
423
- * @param activeIndex Zero-based index of the currently active step.
424
- * @param modifier Modifier applied to the outermost container.
425
- * @param horizontal `true` renders a horizontal layout; defaults to vertical.
426
- * @param size [StepsSize.SMALL] or [StepsSize.LARGE] — affects bubble and typography scale.
427
- * @param useNumber Shows the 1-based step number inside the bubble instead of a check/dot icon.
428
- * @param align Text and icon alignment in horizontal mode: LEFT, RIGHT, CENTER, or STRETCH.
429
- * @param customIcon Icon source name rendered inside the active-step bubble (replaces the dot).
430
- * @param disabled Dims all steps and suppresses all press callbacks.
431
- * @param onPress Invoked with the tapped [StepItem] and its index; only fires for completed steps.
414
+ * Port of RN `Steps` (`@momo-kits/step`). [onPress] fires for completed steps only;
415
+ * [align] applies to the horizontal layout only.
432
416
  */
433
417
  @Composable
434
418
  fun Steps(
@@ -103,7 +103,6 @@ fun Swipe(
103
103
  .height(height)
104
104
  .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) }
105
105
  ) {
106
- // Left actions
107
106
  if (left.isNotEmpty()) {
108
107
  Row(
109
108
  modifier = Modifier
@@ -122,7 +121,6 @@ fun Swipe(
122
121
  }
123
122
  }
124
123
 
125
- // Right actions
126
124
  if (right.isNotEmpty()) {
127
125
  Row(
128
126
  modifier = Modifier
@@ -29,7 +29,6 @@ fun Switch(
29
29
  title: String? = "",
30
30
  accessibilityId: String? = ""
31
31
  ) {
32
- // Memoize color calculations to avoid repeated conditional logic
33
32
  val colors = remember(value, disabled) {
34
33
  val circleColor = if (value) Colors.black_01 else Colors.black_03
35
34
  val bgColor = when {
@@ -49,12 +48,10 @@ fun Switch(
49
48
  ?: "toggle_${title?.takeIf { it.isNotEmpty() } ?: "unknown"}_$value"
50
49
  }
51
50
 
52
- // Memoize alignment calculation
53
51
  val contentAlignment = remember(value) {
54
52
  if (value) Alignment.CenterEnd else Alignment.CenterStart
55
53
  }
56
54
 
57
- // Memoize click handler to avoid lambda recreation
58
55
  val onClickHandler = remember(onChange, value) {
59
56
  { onChange(!value) }
60
57
  }
@@ -105,7 +105,6 @@ fun TabView(
105
105
  .fillMaxWidth()
106
106
  .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
107
107
  ) {
108
- // Tab bar
109
108
  when {
110
109
  type == TabViewType.CARD -> CardTabBar(
111
110
  tabs = tabs,
@@ -135,7 +134,6 @@ fun TabView(
135
134
  )
136
135
  }
137
136
 
138
- // Content area
139
137
  if (fitContent) {
140
138
  Box(modifier = Modifier.fillMaxWidth()) {
141
139
  tabs.getOrNull(selectedIndex)?.content?.invoke()
@@ -207,7 +205,6 @@ private fun DefaultTabBar(
207
205
  }
208
206
  }
209
207
 
210
- // Animated underline indicator
211
208
  TabUnderlineIndicator(offsetX = indicatorOffsetX, width = indicatorWidth, color = selectedColor)
212
209
  }
213
210
  }
@@ -291,7 +288,6 @@ private fun ScrollableTabBar(
291
288
  }
292
289
  }
293
290
 
294
- // Animated underline indicator aligned to bottom of the bar
295
291
  TabUnderlineIndicator(
296
292
  offsetX = animatedX - scrollOffsetDp + Spacing.XS,
297
293
  width = (animatedWidth - Spacing.XS * 2).coerceAtLeast(0.dp),
@@ -312,21 +308,14 @@ private fun CardTabBar(
312
308
  val theme = AppTheme.current
313
309
  val surface = theme.colors.background.surface
314
310
 
315
- // react-kits `CardTabBar` draws the bar in TWO layers: a flat strip where every
316
- // tab looks unselected, and one raised card laid OVER it for the active tab.
317
- // The card is 4dp taller, sits `Spacing.XS` higher, and is joined to the strip
318
- // on each side by a curved "ear" — the browser-tab silhouette that gives this
319
- // variant its name. Rendering the active tab in place (just taller) loses both
320
- // the overlap and the ears, and the strip used the theme's `tonal` pink where
321
- // react-kits uses `Colors.black_02`, so the bar came out pink and flat.
311
+ // As react-kits: a flat `black_02` strip of unselected tabs, with one raised card over it for the
312
+ // active tab, 4dp taller and joined to the strip by a curved "ear" on each side.
322
313
  val pathWidth = if (tabs.size > 2) 22.dp else 28.dp
323
314
  val isFirst = selectedIndex == 0
324
315
  val isLast = selectedIndex == tabs.lastIndex
325
316
 
326
- // The bar is exactly as tall as the FLAT strip — react-kits' raised card is
327
- // `position: absolute`, so it never adds height; it just overflows upward into
328
- // the 4dp margin. Letting the 44dp card size this box instead left a 4dp band of
329
- // background showing between the tabs and the panel they sit on.
317
+ // Only as tall as the flat strip: like react-kits' absolute card, the raised one overflows up into
318
+ // the 4dp top padding instead of adding height.
330
319
  BoxWithConstraints(
331
320
  modifier = Modifier
332
321
  .fillMaxWidth()
@@ -368,17 +357,10 @@ private fun CardTabBar(
368
357
  val active = tabs.getOrNull(selectedIndex) ?: return@BoxWithConstraints
369
358
  Row(
370
359
  modifier = Modifier
371
- // Pinned to the strip's BOTTOM edge so the two always end on the same
372
- // pixel; `requiredHeight` then grows it upward into the 4dp margin.
373
- // Offsetting it up by hand instead left a sub-dp sliver of strip
374
- // showing under the card once rounding got involved.
360
+ // Pinned to the strip's bottom so both end on the same pixel (a manual offset leaves a sub-dp sliver).
375
361
  .align(Alignment.BottomStart)
376
362
  .offset(x = itemWidth * selectedIndex - (if (isFirst) 0.dp else pathWidth))
377
- // `requiredHeight`, not `height`: the bar box is only as tall as the
378
- // flat strip, so a plain height would be coerced down to 40 and the
379
- // raised card would stop 4dp short of the panel below, leaving a grey
380
- // sliver. react-kits gets this free — its card is absolutely
381
- // positioned and ignores the parent box entirely.
363
+ // requiredHeight: a plain height is coerced to the 40dp box and stops 4dp short of the panel.
382
364
  .requiredHeight(CARD_TAB_ACTIVE_HEIGHT),
383
365
  verticalAlignment = Alignment.Bottom,
384
366
  ) {
@@ -75,14 +75,12 @@ fun Text(
75
75
  accessibilityId: String? = null,
76
76
  inlineContent: Map<String, InlineTextContent> = mapOf(),
77
77
  ) {
78
- // Cache theme access to avoid repeated lookups
79
78
  val theme = AppTheme.current
80
79
 
81
80
  val fontSize = scaleSize(style.fontSize)
82
81
  val lineHeight = scaleSize(style.lineHeight)
83
82
  val font = getFontFamily(fontFamily ?: theme.font, style.fontWeight)
84
83
 
85
- // Memoize color calculation
86
84
  val textColor = remember(color, theme) {
87
85
  color ?: theme.colors.text.default
88
86
  }
@@ -95,13 +93,10 @@ fun Text(
95
93
  )
96
94
  }
97
95
 
98
- // Memoize automation ID
99
96
  val automationId = remember(accessibilityId, text) {
100
97
  accessibilityId ?: text
101
98
  }
102
99
 
103
- // on/off baseline config value, default will be false
104
-
105
100
  androidx.compose.material3.Text(
106
101
  modifier = modifier.conditional(IsShowBaseLineDebug){
107
102
  border(1.dp, Colors.blue_03)
@@ -89,10 +89,7 @@ fun Title(
89
89
  .conditional(IsShowBaseLineDebug) {
90
90
  border(1.dp, Colors.blue_03)
91
91
  }
92
- // react-kits' Title root is `styles.wrapper` = `{flexDirection:'row'}`
93
- // plus, for a SECTION only, `marginTop: Spacing.S` (foundations/Title
94
- // index.tsx). It has no padding at all, so the 8dp box here inset every
95
- // title by 8dp against the web render.
92
+ // RN parity: only a Section gets a top margin; the root has no padding.
96
93
  .padding(top = if (type == TitleType.Section) Spacing.S else 0.dp),
97
94
  verticalAlignment = Alignment.CenterVertically
98
95
  ) {
@@ -105,7 +102,6 @@ fun Title(
105
102
  IconAlign.Bottom -> Arrangement.Bottom
106
103
  },
107
104
  ) {
108
- // Icon
109
105
  Icon(
110
106
  source = it,
111
107
  color = iconColor ?: theme.colors.text.default,
@@ -130,7 +126,6 @@ fun Title(
130
126
  maxLines = if (showTrailingAction || badgeLabel != null) 1 else 2,
131
127
  )
132
128
 
133
- // Badge
134
129
  badgeLabel?.let {
135
130
  Spacer(modifier = Modifier.width(4.dp))
136
131
  Badge(
@@ -163,7 +158,6 @@ fun Title(
163
158
  }
164
159
  }
165
160
 
166
- // Description
167
161
  description?.let {
168
162
  Spacer(modifier = Modifier.height(4.dp))
169
163
  Text(
@@ -49,17 +49,14 @@ class TooltipState {
49
49
  var isVisible by mutableStateOf(false)
50
50
  private set
51
51
 
52
- /** Shows the tooltip. */
53
52
  fun show() {
54
53
  isVisible = true
55
54
  }
56
55
 
57
- /** Hides the tooltip. */
58
56
  fun hide() {
59
57
  isVisible = false
60
58
  }
61
59
 
62
- /** Toggles the tooltip visibility. */
63
60
  fun toggle() {
64
61
  isVisible = !isVisible
65
62
  }
@@ -152,7 +152,7 @@ private fun UploaderImageItem(
152
152
  modifier = Modifier
153
153
  .fillMaxSize()
154
154
  .clip(RoundedCornerShape(Radius.XS))
155
- .background(Color(0x66FFFFFF)),
155
+ .background(Colors.opacity_white_40),
156
156
  contentAlignment = Alignment.Center,
157
157
  ) {
158
158
  Skeleton()
@@ -7,9 +7,6 @@ import kotlinx.datetime.number
7
7
  import kotlin.time.Clock
8
8
  import kotlin.time.ExperimentalTime
9
9
 
10
- /**
11
- * Format a LocalDateTime object into a string
12
- */
13
10
  fun formatLocalDateTime(dateTime: LocalDateTime, format: String = "yyyy-MM-dd HH:mm"): String {
14
11
  return when (format) {
15
12
  "yyyy-MM-dd HH:mm" -> "${dateTime.year}-${paddingNum(dateTime.month.number)}-${
@@ -28,16 +25,11 @@ fun formatLocalDateTime(dateTime: LocalDateTime, format: String = "yyyy-MM-dd HH
28
25
  }
29
26
  }
30
27
 
31
- /**
32
- * Pad a number with a leading zero if it's less than 10
33
- */
34
28
  fun paddingNum(num: Int): String {
35
29
  return if (num > 9) num.toString() else "0$num"
36
30
  }
37
31
 
38
- /**
39
- * Get a list of days in a month
40
- */
32
+ /** Zero-padded days of [month], clipped to [minDate] / [maxDate] when they fall in it. */
41
33
  fun getDaysInMonth(
42
34
  year: Int,
43
35
  month: Int,
@@ -70,9 +62,7 @@ fun getDaysInMonth(
70
62
  return days
71
63
  }
72
64
 
73
- /**
74
- * Get a list of months
75
- */
65
+ /** Zero-padded months of [currentYear], clipped to [minDate] / [maxDate] when they fall in it. */
76
66
  fun getMonths(
77
67
  minDate: LocalDateTime,
78
68
  maxDate: LocalDateTime,
@@ -97,9 +87,6 @@ fun getMonths(
97
87
  return months
98
88
  }
99
89
 
100
- /**
101
- * Get a list of years
102
- */
103
90
  fun getYears(minDate: LocalDateTime, maxDate: LocalDateTime): List<String> {
104
91
  val startYear = minDate.year
105
92
  val endYear = maxDate.year
@@ -112,9 +99,7 @@ fun getYears(minDate: LocalDateTime, maxDate: LocalDateTime): List<String> {
112
99
  return years
113
100
  }
114
101
 
115
- /**
116
- * Get a list of hours
117
- */
102
+ /** 1...12 when [hourMode] is 12, otherwise 0 until [hourMode]; zero-padded. */
118
103
  fun getHours(hourMode: Int): List<String> {
119
104
  val hours = mutableListOf<String>()
120
105
  for (i in 0 until hourMode) {
@@ -124,9 +109,6 @@ fun getHours(hourMode: Int): List<String> {
124
109
  return hours
125
110
  }
126
111
 
127
- /**
128
- * Get a list of minutes
129
- */
130
112
  fun getMinutes(interval: Int): List<String> {
131
113
  // A non-positive interval would never reach 60.
132
114
  val step = interval.coerceAtLeast(1)
@@ -139,22 +121,14 @@ fun getMinutes(interval: Int): List<String> {
139
121
  return minutes
140
122
  }
141
123
 
142
- /**
143
- * Time mode for 12-hour clock
144
- */
145
124
  val timeMode = listOf("AM", "PM")
146
125
 
147
- /**
148
- * Get today's date
149
- */
150
126
  @OptIn(ExperimentalTime::class)
151
127
  fun getCurrentDateTime(): LocalDateTime {
152
128
  return Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault())
153
129
  }
154
130
 
155
- /**
156
- * Create a date that's a certain number of years before or after the current date
157
- */
131
+ /** Now shifted by [years] (negative = past), keeping the hour and minute. */
158
132
  fun createRelativeDate(years: Int): LocalDateTime {
159
133
  val currentDateTime = getCurrentDateTime()
160
134
  val period = DatePeriod(years = if (years < 0) -years else years)
@@ -5,13 +5,8 @@ import androidx.compose.ui.text.font.FontFamily
5
5
  import androidx.compose.ui.text.font.FontWeight
6
6
 
7
7
  /**
8
- * Nạp font từ tài nguyên native của app host thay vì đóng gói bản copy riêng trong SDK.
9
- *
10
- * App host (MoMo Platform) đã bundle sẵn toàn bộ font từ `font-source`:
11
- * - Android: `assets/fonts/<fileName>` (gradle task `syncMomoFonts`)
12
- * - iOS: file rời ở bundle root (pbxproj fileRef được `post_install.rb` trỏ về font-source)
13
- *
14
- * Trả về `null` nếu host không có font đó — caller tự fallback [FontFamily.Default].
8
+ * Loads [fileName] from the host app's bundled fonts instead of a copy in the kit: Android `assets/fonts/`
9
+ * (host task `syncMomoFonts`), iOS bundle root (`post_install.rb`). Null when missing; callers fall back.
15
10
  */
16
11
  @Composable
17
12
  internal expect fun hostFontFamily(fileName: String, weight: FontWeight): FontFamily?
@@ -21,8 +21,7 @@ const val MAX_DEVICE_SCALE = 5
21
21
  @Composable
22
22
  fun scaleSize(size: Float): Float {
23
23
  val context = LocalContext.current
24
- // opt-in ceiling: when context.scaleSizeMaxRate is set, the result never exceeds size × capRate,
25
- // in both the userScaleRate path and the OS path. Null keeps the old behavior.
24
+ // Opt-in ceiling: a set scaleSizeMaxRate caps both the userScaleRate and the OS path at size × capRate.
26
25
  val capRate = context?.scaleSizeMaxRate
27
26
  fun cap(scaled: Float): Float = if (capRate != null) min(scaled, size * capRate) else scaled
28
27
  val useOsScale = context?.useOSScaleRate ?: DesignSystemKits.getConfigs().useOSScaleRate
@@ -89,11 +89,8 @@ internal fun modalLayoutOf(layout: ScreenLayout): ModalLayout = modalLayoutOf(
89
89
  )
90
90
 
91
91
  /**
92
- * Resolves popup / bottom sheet geometry from plain window metrics, for hosts without a kits screen.
93
- *
94
- * All values are in dp and window coordinates. The insets are the raw safe area (system bars and
95
- * display cutout); on iPhone Duo they also carry the control column. [hinge] is the vertical hinge of
96
- * a half-folded iPhone Duo, null while flat. Pure: no composition needed.
92
+ * Popup / bottom sheet geometry from plain window metrics (dp, window coordinates), for hosts without a kits
93
+ * screen. Insets are the raw safe area, plus the control column on iPhone Duo; [hinge] is null while flat.
97
94
  */
98
95
  fun modalLayoutOf(
99
96
  width: Dp,
@@ -111,8 +108,8 @@ fun modalLayoutOf(
111
108
  return ModalLayout(
112
109
  isFoldable = false,
113
110
  placement = placement,
114
- popup = popupGeometry(placement.width, null, Spacing.XL, Radius.L),
115
- sheet = SheetGeometry(width = null, maxHeight = null, minHeight = 0.dp, margin = 0.dp, radius = Radius.M),
111
+ popup = popupGeometry(placement.width, null, Spacing.XL, Radius.XL),
112
+ sheet = SheetGeometry(width = null, maxHeight = null, minHeight = 0.dp, margin = 0.dp, radius = Radius.XL),
116
113
  scrimOpacity = PHONE_SCRIM_OPACITY,
117
114
  )
118
115
  }
@@ -33,6 +33,7 @@ import androidx.compose.runtime.setValue
33
33
  import androidx.compose.runtime.rememberCoroutineScope
34
34
  import androidx.compose.ui.Alignment
35
35
  import androidx.compose.ui.Modifier
36
+ import androidx.compose.ui.draw.clip
36
37
  import androidx.compose.ui.graphics.Brush
37
38
  import androidx.compose.ui.graphics.Color
38
39
  import androidx.compose.ui.input.pointer.pointerInput
@@ -91,6 +92,7 @@ internal fun BottomSheet(
91
92
  val modal = rememberModalLayout()
92
93
  val isFoldable = modal.isFoldable
93
94
  val sheet = modal.sheet
95
+ val sheetShape = RoundedCornerShape(topStart = sheet.radius, topEnd = sheet.radius)
94
96
  val title = header as? BottomHeader.Title
95
97
  // the screen is the outer display on iPhone Duo, even when unfolded
96
98
  val screenHeightDp = if (isFoldable) layout.height else getScreenHeight()
@@ -206,9 +208,11 @@ internal fun BottomSheet(
206
208
  .offset { IntOffset(x = 0, y = sheetOffset.value.toInt()) }
207
209
  .then(if (sheet.width != null) Modifier.width(sheet.width) else Modifier.fillMaxWidth())
208
210
  .heightIn(max = maxHeight)
211
+ // clip too, so content (images, scrims) follows the corners like iOS clipShape
212
+ .clip(sheetShape)
209
213
  .background(
210
214
  color = if (isSurface) AppTheme.current.colors.background.surface else AppTheme.current.colors.background.default,
211
- shape = RoundedCornerShape(topStart = sheet.radius, topEnd = sheet.radius)
215
+ shape = sheetShape
212
216
  )
213
217
  .conditional(IsShowBaseLineDebug) {
214
218
  border(1.dp, Colors.blue_03)
@@ -140,22 +140,18 @@ internal fun StackScreen(
140
140
  // A mounted-but-hidden bottom tab tracks again each time it is focused (RN useFocusEffect).
141
141
  val tabFocused = LocalBottomTabFocused.current
142
142
 
143
- // Auto tracking state
144
143
  val trackingState = remember(tabFocused) {
145
144
  ScreenTrackingState().apply {
146
145
  time = Clock.System.now().toEpochMilliseconds()
147
146
  }
148
147
  }
149
148
 
150
- // Determine action: push or back
151
149
  val action = remember(tabFocused) {
152
150
  if (ScreenTracker.getLastScreenName() != null) "push" else "back"
153
151
  }
154
152
 
155
- // Auto tracking effects
156
153
  LaunchedEffect(name, tabFocused) {
157
154
  if (!tabFocused) return@LaunchedEffect
158
- // Track screen navigated immediately
159
155
  ScreenTracker.trackScreenNavigated(
160
156
  maxApi = maxApi,
161
157
  context = context,
@@ -164,7 +160,6 @@ internal fun StackScreen(
164
160
  state = trackingState
165
161
  )
166
162
 
167
- // Track screen displayed after 2 seconds (debounce)
168
163
  delay(2000.milliseconds)
169
164
  val loadTime = Clock.System.now().toEpochMilliseconds() - trackingState.time
170
165
  ScreenTracker.trackScreenDisplayed(
@@ -175,7 +170,6 @@ internal fun StackScreen(
175
170
  state = trackingState
176
171
  )
177
172
 
178
- // Track screen interacted after displayed
179
173
  val interactionTime = Clock.System.now().toEpochMilliseconds() - trackingState.time
180
174
  ScreenTracker.trackScreenInteracted(
181
175
  maxApi = maxApi,
@@ -226,21 +220,17 @@ internal fun StackScreen(
226
220
  LocalFooterHeightPx provides footerHeightPx,
227
221
  LocalHeaderRightWidthPx provides headerRightWidthPx
228
222
  ) {
229
- // AI-GENERATED START: custom screen background, full window and outside the keyboard padding
230
223
  Box(Modifier.fillMaxSize()) {
231
224
  options.backgroundComponent?.let { background ->
232
225
  Box(Modifier.fillMaxSize()) { background() }
233
226
  }
234
- // AI-GENERATED END: custom screen background, full window and outside the keyboard padding
235
227
  Box(
236
228
  Modifier
237
229
  .fillMaxSize()
238
- // AI-GENERATED START: custom background replaces the colour
239
230
  .background(
240
231
  if (options.backgroundComponent != null) Color.Transparent
241
232
  else options.backgroundColor ?: AppTheme.current.colors.background.default
242
233
  )
243
- // AI-GENERATED END: custom background replaces the colour
244
234
  .conditional(options.keyboardOptions.keyboardShouldPersistTaps) {
245
235
  hideKeyboardOnTap()
246
236
  }
@@ -279,9 +269,7 @@ internal fun StackScreen(
279
269
 
280
270
  OverplayView(isBottomTabChild = isBottomTabChild, id = id)
281
271
  }
282
- // AI-GENERATED START: custom screen background, full window and outside the keyboard padding
283
272
  }
284
- // AI-GENERATED END: custom screen background, full window and outside the keyboard padding
285
273
  }
286
274
  }
287
275
 
@@ -75,14 +75,12 @@ internal fun FloatingButton(
75
75
 
76
76
  val coroutineScope = rememberCoroutineScope()
77
77
 
78
- // Animations
79
78
  val baseSize = if (size == FABSize.SMALL) FabSmallSize else FabDefaultSize
80
79
  val width by animateDpAsState(
81
80
  targetValue = if (isExpanded && text != null) FabExpandedWidth else baseSize,
82
81
  animationSpec = tween(100, easing = CubicBezierEasing(0.2f, 0.2f, 0.2f, 0.2f))
83
82
  )
84
83
 
85
- // Scroll listener
86
84
  LaunchedEffect(text) {
87
85
  if (text != null) {
88
86
  coroutineScope.launch {