@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
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.169.6-debug"
43
+ version = "0.169.7-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |spec|
2
2
  spec.name = 'compose'
3
- spec.version = '0.169.6-debug'
3
+ spec.version = '0.169.7-debug'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
@@ -12,8 +12,7 @@ internal actual fun hostFontFamily(fileName: String, weight: FontWeight): FontFa
12
12
  val assets = LocalContext.current.applicationContext.assets
13
13
  return remember(fileName, weight) {
14
14
  val path = "fonts/$fileName"
15
- // AssetManager.open ném IOException nếu thiếu file; Font(path, assetManager) thì lỗi
16
- // muộn lúc render nên phải kiểm tra tồn tại trước.
15
+ // Font(path, assetManager) only fails later at render time, so check the asset exists first.
17
16
  val exists = runCatching { assets.open(path).close() }.isSuccess
18
17
  if (exists) FontFamily(Font(path = path, assetManager = assets, weight = weight)) else null
19
18
  }
@@ -150,7 +150,6 @@ fun LiteScreen(
150
150
  verticalArrangement: Arrangement.Vertical = Arrangement.Top,
151
151
  horizontalAlignment: Alignment.Horizontal = Alignment.Start,
152
152
  backgroundColor: Color = AppTheme.current.colors.background.default,
153
- /* Begin of header props */
154
153
  title: String? = null,
155
154
  inputSearchProps: LiteInputSearchProps? = null,
156
155
  goBack: (() -> Unit)? = null,
@@ -161,7 +160,6 @@ fun LiteScreen(
161
160
  headerTintColor: Color? = null,
162
161
  headerBackgroundColor: Color? = null,
163
162
  headerSpaceBetween: Dp? = null,
164
- /* End of header props */
165
163
 
166
164
  screenContent: @Composable () -> Unit,
167
165
  ) {
@@ -678,9 +676,7 @@ private class LiteScreenLayoutPolicy(
678
676
  )
679
677
  )
680
678
 
681
- /**
682
- * replicate logic from [vn.momo.kits.navigation.component.HeaderBackground]
683
- * */
679
+ // Same height rule as navigation.component.HeaderBackground.
684
680
  var defaultHeight = with(geometry) { headerHeight(screenLayout, statusBarPx, headerRowDefault) }
685
681
  if (isHeaderExtend) {
686
682
  defaultHeight = if (screenLayout.isIPhoneDuo) {
@@ -15,10 +15,8 @@ data class LocalizationObject(
15
15
  )
16
16
 
17
17
  /**
18
- * Translation gateway, ported from momo-kits React Native (`Application/Localize.ts`).
19
- * Holds the merged dictionary (kit defaults + host overrides) and the active language,
20
- * switched at runtime via [changeLanguage]. Language is snapshot-backed, so a switch
21
- * recomposes consumers of [translate]/[translateData].
18
+ * Port of RN `Application/Localize.ts`: kit defaults merged with host overrides. The language is
19
+ * snapshot state, so [changeLanguage] recomposes readers of [translate]/[translateData].
22
20
  */
23
21
  @Stable
24
22
  class Localize(translations: LocalizationObject = LocalizationObject()) {
@@ -17,19 +17,20 @@ import vn.momo.kits.application.IsShowBaseLineDebug
17
17
  import vn.momo.kits.const.*
18
18
  import vn.momo.kits.modifier.conditional
19
19
 
20
+ // RN accepts only the `_03` palette as a custom badge color.
20
21
  private val badgePrimaryColors = listOf(
21
- Color(0xFFF0F0F0),
22
- Color(0xFFEB2F96),
23
- Color(0xFF962AF0),
24
- Color(0xFF4E4BFF),
25
- Color(0xFF007AFF),
26
- Color(0xFF13C2C2),
27
- Color(0xFF34C759),
28
- Color(0xFFA0D911),
29
- Color(0xFFFFCC00),
30
- Color(0xFFFA8C16),
31
- Color(0xFFFA541C),
32
- Color(0xFFF5222D)
22
+ Colors.black_03,
23
+ Colors.pink_03,
24
+ Colors.violet_03,
25
+ Colors.indigo_03,
26
+ Colors.blue_03,
27
+ Colors.mint_03,
28
+ Colors.green_03,
29
+ Colors.lime_03,
30
+ Colors.yellow_03,
31
+ Colors.gold_03,
32
+ Colors.orange_03,
33
+ Colors.red_03
33
34
  )
34
35
 
35
36
  private val badgeNumberRegex = "^\\d+$".toRegex()
@@ -218,8 +218,8 @@ fun RoundedBadgeRibbon(
218
218
  val ribbonHeight = height - padding.toPx()
219
219
  val cornerRadius = roundedRect.toPx()
220
220
 
221
- val mainColor = Color(0xFFFA541C)
222
- val tailColor = Color(0xFFC41B24)
221
+ val mainColor = Colors.orange_03
222
+ val tailColor = Colors.red_01
223
223
 
224
224
  val headWidth = 4.dp.toPx()
225
225
  val leftSectionWidth = width * (9f / 28f)
@@ -327,7 +327,6 @@ fun Button(
327
327
  }
328
328
  )
329
329
 
330
- // Content
331
330
  Row(
332
331
  modifier = Modifier
333
332
  .padding(horizontal = sizeSpecs.padding)
@@ -61,10 +61,7 @@ private enum class CupertinoSpringAnimationReason {
61
61
 
62
62
 
63
63
  private data class CupertinoOverscrollAvailableDelta(
64
-
65
64
  val availableDelta: Float,
66
-
67
-
68
65
  val newOverscrollValue: Float
69
66
  )
70
67
 
@@ -83,44 +80,21 @@ data class PullToRefreshCustomState(
83
80
  }
84
81
 
85
82
  /**
86
- * CupertinoOverscrollEffect
87
- *
88
- * @param density to be taken into consideration during computations;
89
- * Cupertino formulas use DPs, and scroll machinery uses raw values.
90
- *
91
- * @param applyClip Some consumers of overscroll effect apply clip by themselves and some don't,
92
- * thus this flag is needed to update our modifier chain and make the clipping correct in every case while avoiding redundancy
83
+ * iOS rubber-band overscroll (from JetBrains compose-multiplatform-core) with optional pull-to-refresh.
84
+ * The formulas run in dp, hence [density]; [applyClip] is for consumers that don't clip themselves.
93
85
  */
94
86
  internal class CupertinoOverscrollEffect(
95
87
  val pullRefreshState: PullToRefreshCustomState? = null,
96
88
  private val density: Float,
97
89
  val applyClip: Boolean
98
90
  ) : OverscrollEffect {
99
- /*
100
- * Direction of scrolling for this overscroll effect, derived from arguments during
101
- * [applyToScroll] calls. Technically this effect supports both dimensions, but current API requires
102
- * that different stages of animations spawned by this effect for both dimensions
103
- * end at the same time, which is not the case:
104
- * Spring->Fling->Spring, Fling->Spring, Spring->Fling effects can have different timing per dimension
105
- * (see Notes of https://github.com/JetBrains/compose-multiplatform-core/pull/609),
106
- * which is not possible to express without changing API. Hence, this effect will be fixed to latest
107
- * received delta.
108
- */
91
+ // Follows the axis of the latest delta: the API can't end per-axis spring/fling stages at different
92
+ // times (Notes of https://github.com/JetBrains/compose-multiplatform-core/pull/609).
109
93
  private var direction: CupertinoOverscrollDirection = CupertinoOverscrollDirection.UNKNOWN
110
94
 
111
- /*
112
- * Size of container is taking into consideration when computing rubber banding
113
- */
114
95
  private var scrollSize: Size = Size.Zero
115
96
 
116
- /*
117
- * Current offset in overscroll area
118
- * Negative for bottom-right
119
- * Positive for top-left
120
- * Zero if within the scrollable range
121
- * It will be mapped to the actual visible offset using the rubber banding rule inside
122
- * [Modifier.offset] within [effectModifier]
123
- */
97
+ // Raw overscroll: positive top-left, negative bottom-right, zero in range; drawn rubber-banded.
124
98
  private var overscrollOffsetState = mutableStateOf(Offset.Zero)
125
99
  private var overscrollOffset: Offset
126
100
  get() = overscrollOffsetState.value
@@ -135,10 +109,7 @@ internal class CupertinoOverscrollEffect(
135
109
  get() = overscrollOffsetState.value.rubberBanded().round()
136
110
 
137
111
  override val isInProgress: Boolean
138
- get() =
139
- // If visible overscroll offset has at least one pixel
140
- // this effect is considered to be in progress
141
- visibleOverscrollOffset.toOffset().getDistance() > 0.5f
112
+ get() = visibleOverscrollOffset.toOffset().getDistance() > 0.5f
142
113
 
143
114
  @OptIn(ExperimentalMaterialApi::class)
144
115
  private val overscrollNode = CupertinoOverscrollNode(
@@ -151,8 +122,7 @@ internal class CupertinoOverscrollEffect(
151
122
  override val node: DelegatableNode get() = overscrollNode
152
123
 
153
124
  private fun onDraw() {
154
- // Fix an issue where scrolling was canceled but the overscroll effect was not completed.
155
- // Reset the overscroll effect when no ongoing animation or interaction is applied.
125
+ // A cancelled scroll can leave the effect half-way: reset it once nothing animates or touches it.
156
126
  if (!drawCallScheduledByOffsetChange && isInProgress && overscrollNode.pointersDown == 0) {
157
127
  overscrollOffsetState.value = Offset.Zero
158
128
  }
@@ -167,18 +137,12 @@ internal class CupertinoOverscrollEffect(
167
137
  else -> null
168
138
  }
169
139
 
170
- /*
171
- * Takes input scroll delta, current overscroll value, and scroll source, return [CupertinoOverscrollAvailableDelta]
172
- */
173
140
  @Stable
174
141
  private fun availableDelta(
175
142
  delta: Float,
176
143
  overscroll: Float,
177
144
  source: CupertinoScrollSource
178
145
  ): CupertinoOverscrollAvailableDelta {
179
- // if source is fling:
180
- // 1. no delta will be consumed
181
- // 2. overscroll will stay the same
182
146
  if (source == CupertinoScrollSource.FLING) {
183
147
  return CupertinoOverscrollAvailableDelta(delta, overscroll)
184
148
  }
@@ -202,10 +166,7 @@ internal class CupertinoOverscrollEffect(
202
166
  }
203
167
  }
204
168
 
205
- /*
206
- * Returns the amount of scroll delta available after user performed scroll inside overscroll area
207
- * It will update [overscroll] resulting in visual change because of [Modifier.offset] depending on it
208
- */
169
+ // Delta left after the overscroll area takes its share; moves [overscrollOffset] as a side effect.
209
170
  private fun availableDelta(delta: Offset, source: CupertinoScrollSource): Offset {
210
171
  val (x, overscrollX) = availableDelta(delta.x, overscrollOffset.x, source)
211
172
  val (y, overscrollY) = availableDelta(delta.y, overscrollOffset.y, source)
@@ -214,37 +175,25 @@ internal class CupertinoOverscrollEffect(
214
175
  return Offset(x, y)
215
176
  }
216
177
 
217
- /*
218
- * Semantics of this method match the [OverscrollEffect.applyToScroll] one,
219
- * The only difference is NestedScrollSource being remapped to CupertinoScrollSource to narrow
220
- * processed states invariant
221
- */
222
178
  private fun applyToScroll(
223
179
  delta: Offset,
224
180
  source: CupertinoScrollSource,
225
181
  performScroll: (Offset) -> Offset
226
182
  ): Offset {
227
- // Calculate how much delta is available after being consumed by scrolling inside overscroll area
228
183
  val deltaLeftForPerformScroll = availableDelta(delta, source)
229
-
230
- // Then pass remaining delta to scroll closure
231
184
  val deltaConsumedByPerformScroll = performScroll(deltaLeftForPerformScroll)
232
-
233
- // Delta which is left after `performScroll` was invoked with availableDelta
234
185
  val unconsumedDelta = deltaLeftForPerformScroll - deltaConsumedByPerformScroll
235
186
 
236
187
  return when (source) {
237
188
  CupertinoScrollSource.DRAG -> {
238
- // [unconsumedDelta] is going into overscroll again in case a user drags and hits the
239
- // overscroll->content->overscroll or content->overscroll scenario within single frame
189
+ // The rest goes back into overscroll: a drag can cross the content edge within one frame.
240
190
  overscrollOffset += unconsumedDelta
241
191
  lastFlingUnconsumedDelta = Offset.Zero
242
192
  delta - unconsumedDelta
243
193
  }
244
194
 
245
195
  CupertinoScrollSource.FLING -> {
246
- // If unconsumedDelta is not Zero, [CupertinoOverscrollEffect] will cancel fling and
247
- // start spring animation instead
196
+ // Non-zero cancels the fling and starts the spring animation instead.
248
197
  lastFlingUnconsumedDelta = unconsumedDelta
249
198
  delta - unconsumedDelta
250
199
  }
@@ -302,11 +251,9 @@ internal class CupertinoOverscrollEffect(
302
251
  if (hasXPart) {
303
252
  CupertinoOverscrollDirection.HORIZONTAL
304
253
  } else {
305
- // hasYPart != hasXPart and hasXPart is false
306
254
  CupertinoOverscrollDirection.VERTICAL
307
255
  }
308
256
  } else {
309
- // hasXPart and hasYPart are equal
310
257
  CupertinoOverscrollDirection.UNKNOWN
311
258
  }
312
259
  }
@@ -376,8 +323,7 @@ internal class CupertinoOverscrollEffect(
376
323
  val initialSign = sign(initialValue)
377
324
  var currentVelocity = initialVelocity
378
325
 
379
- // All input values are divided by density so all internal calculations are performed as if
380
- // they operated on DPs. Callback value is then scaled back to raw pixels.
326
+ // The spring runs in dp (inputs divided by density); the callback scales back to px.
381
327
  val visibilityThreshold = 0.5f / density
382
328
 
383
329
  val spec = when (reason) {
@@ -413,7 +359,7 @@ internal class CupertinoOverscrollEffect(
413
359
  } ?: (value * density).toOffset()
414
360
  currentVelocity = velocity * density
415
361
 
416
- // If it was flung from overscroll, cancel animation and return velocity
362
+ // Flung from overscroll: stop at the edge and hand the velocity back to the fling.
417
363
  if (reason == CupertinoSpringAnimationReason.FLING_FROM_OVERSCROLL &&
418
364
  initialSign != 0f &&
419
365
  sign(value) != initialSign
@@ -425,8 +371,7 @@ internal class CupertinoOverscrollEffect(
425
371
  }
426
372
 
427
373
  if (currentCoroutineContext().isActive) {
428
- // The spring is critically damped, so in case spring-fling-spring sequence is slightly
429
- // offset and velocity is of the opposite sign, it will end up with no animation
374
+ // Critically damped: a slightly offset spring-fling-spring with opposite velocity ends unanimated.
430
375
  overscrollOffset = Offset.Zero
431
376
  }
432
377
 
@@ -451,10 +396,6 @@ internal class CupertinoOverscrollEffect(
451
396
  ) * density
452
397
  }
453
398
 
454
- /*
455
- * Maps raw delta offset [value] on an axis within scroll container with [dimension]
456
- * to actual visible offset
457
- */
458
399
  private fun rubberBandedValue(value: Float, dimension: Float) =
459
400
  sign(value) * (1f - (1f / (abs(value) * RUBBER_BAND_COEFFICIENT / dimension + 1f))) * dimension
460
401
 
@@ -488,7 +429,6 @@ private class CupertinoOverscrollNode @OptIn(ExperimentalMaterialApi::class) con
488
429
  pointersDown++
489
430
  } else if (pointerEvent.type == PointerEventType.Release) {
490
431
  pointersDown--
491
- // assert(pointersDown >= 0) { "pointersDown cannot be negative" }
492
432
  }
493
433
  }
494
434
  }
@@ -31,7 +31,6 @@ fun Icon(
31
31
  color: Color? = AppTheme.current.colors.text.default,
32
32
  modifier: Modifier = Modifier,
33
33
  ) {
34
- // decode image without downscaling it
35
34
  val context = LocalPlatformContext.current
36
35
 
37
36
  val iconUrl = remember(source) {
@@ -72,6 +71,7 @@ fun Icon(
72
71
  modifier = Modifier.matchParentSize(),
73
72
  model = ImageRequest.Builder(context)
74
73
  .data(iconUrl)
74
+ // Undefined size: decode at full resolution, not downscaled to the view.
75
75
  .size(
76
76
  coil3.size.Dimension.Undefined,
77
77
  coil3.size.Dimension.Undefined
@@ -38,7 +38,7 @@ enum class ImageState {
38
38
  Loading, Success, Error
39
39
  }
40
40
 
41
- // Cached domain set for better performance
41
+ // CDN hosts that serve a resized image for the `size` query param.
42
42
  private val supportedDomains = setOf(
43
43
  "static.momocdn.net",
44
44
  "img.mservice.com.vn",
@@ -47,7 +47,6 @@ private val supportedDomains = setOf(
47
47
  "image.momocdn.net"
48
48
  )
49
49
 
50
- // Pre-computed size chart for optimal image sizing
51
50
  private val sizeChart = mapOf(
52
51
  64 to "XXS",
53
52
  128 to "XS",
@@ -58,7 +57,6 @@ private val sizeChart = mapOf(
58
57
  2048 to "XXL"
59
58
  )
60
59
 
61
- // Optimized size selection using binary search approach
62
60
  private fun closestSizeForWidth(width: Float): String {
63
61
  val targetWidth = width.toInt()
64
62
  return sizeChart.entries
@@ -66,7 +64,6 @@ private fun closestSizeForWidth(width: Float): String {
66
64
  ?.value ?: "M"
67
65
  }
68
66
 
69
- // Cached regex for better URL parsing performance
70
67
  private val urlHostRegex = Regex("^(?:https?://)?([^:/\\s]+)")
71
68
 
72
69
  private fun getHostFromUrl(url: String): String? {
@@ -90,7 +87,6 @@ private fun GifImageState.toImageState(): ImageState {
90
87
  }
91
88
  }
92
89
 
93
- // Optimized query parameter appending
94
90
  private fun appendSizeQueryParam(url: String, value: String): String {
95
91
  val fragmentIndex = url.indexOf('#')
96
92
  val (baseUrl, fragment) = if (fragmentIndex != -1) {
@@ -103,7 +99,6 @@ private fun appendSizeQueryParam(url: String, value: String): String {
103
99
  return "${baseUrl}${separator}size=$value$fragment"
104
100
  }
105
101
 
106
- // Cache for processed URLs to avoid repeated calculations
107
102
  private val urlCache = mutableMapOf<String, String>()
108
103
 
109
104
  @Composable
@@ -130,7 +125,6 @@ fun Image(
130
125
  val urlToLoad = remember(source, maxWidth, maxHeight, density) {
131
126
  when (source) {
132
127
  is String -> {
133
- // Check cache first
134
128
  val cacheKey = "$source|${maxWidth}|${density.density}"
135
129
  urlCache[cacheKey] ?: run {
136
130
  val processedUrl = processImageUrl(source, maxWidth, density)
@@ -182,7 +176,6 @@ fun Image(
182
176
  }
183
177
  }
184
178
 
185
- // Extracted URL processing logic for better performance
186
179
  private fun processImageUrl(url: String, maxWidth: androidx.compose.ui.unit.Dp, density: androidx.compose.ui.unit.Density): String {
187
180
  val host = getHostFromUrl(url)
188
181
  return if (!isGifUrl(url) && host != null && supportedDomains.contains(host)) {
@@ -210,10 +210,8 @@ fun Input(
210
210
  modifier: Modifier = Modifier,
211
211
  inputModifier: Modifier = Modifier,
212
212
  ) {
213
- // Consolidated state management
214
213
  var inputState by remember { mutableStateOf(InputState()) }
215
214
 
216
- // Memoized color calculations
217
215
  val theme = AppTheme.current
218
216
  val colors = remember(disabled, theme, iconColor) {
219
217
  if (disabled) {
@@ -221,9 +219,9 @@ fun Input(
221
219
  Triple(disabledColor, disabledColor, disabledColor)
222
220
  } else {
223
221
  Triple(
224
- theme.colors.text.default, // textColor
225
- theme.colors.text.hint, // placeholderColor
226
- iconColor // iconTintColor
222
+ theme.colors.text.default,
223
+ theme.colors.text.hint,
224
+ iconColor
227
225
  )
228
226
  }
229
227
  }
@@ -310,7 +308,6 @@ fun Input(
310
308
  onChangeText(limitedText)
311
309
  },
312
310
  decorationBox = { innerTextField ->
313
- // Floating label
314
311
  FloatingLabel(
315
312
  floatingValue = floatingValue,
316
313
  floatingIcon = floatingIcon,
@@ -339,7 +336,6 @@ fun Input(
339
336
  modifier = Modifier.padding(horizontal = Spacing.M),
340
337
  verticalAlignment = Alignment.CenterVertically
341
338
  ) {
342
- // Leading icon
343
339
  if (leadingIcon.isNotEmpty()) {
344
340
  Icon(
345
341
  source = leadingIcon,
@@ -404,7 +400,6 @@ fun Input(
404
400
  },
405
401
  )
406
402
 
407
- // Error/hint display
408
403
  ErrorView(error, errorSpacing, hintText)
409
404
  }
410
405
  }
@@ -83,7 +83,6 @@ fun InputDropDown(
83
83
  modifier = Modifier.padding(horizontal = Spacing.M),
84
84
  verticalAlignment = Alignment.CenterVertically
85
85
  ) {
86
- //leading icon
87
86
  if (leadingIcon.isNotEmpty()) {
88
87
  Icon(
89
88
  source = leadingIcon,
@@ -190,7 +190,6 @@ fun InputMoney(
190
190
  }
191
191
  },
192
192
  decorationBox = { innerTextField ->
193
- // Floating Icon
194
193
  FloatingLabel(
195
194
  floatingValue = floatingValue,
196
195
  floatingIcon = floatingIcon,
@@ -199,7 +198,7 @@ fun InputMoney(
199
198
  offsetY = -size.values.height / 2,
200
199
  required = required,
201
200
  )
202
- //input box wrapper
201
+ // Input container
203
202
  Box(
204
203
  modifier = Modifier.fillMaxWidth()
205
204
  .border(
@@ -213,7 +212,6 @@ fun InputMoney(
213
212
  modifier = Modifier.padding(horizontal = Spacing.M),
214
213
  verticalAlignment = Alignment.CenterVertically
215
214
  ) {
216
- //leading icon
217
215
  if (leadingIcon.isNotEmpty()) {
218
216
  Icon(
219
217
  source = leadingIcon,
@@ -67,12 +67,8 @@ private fun getBorderColor(isFocused: Boolean, error: String): Color {
67
67
  }
68
68
 
69
69
  /**
70
- * @param icon Deprecated: use [trailing].
71
- * @param iconColor Deprecated: use [trailingColor].
72
- * @param onRightIconPressed Deprecated: use [onPressTrailing].
73
- * @param trailing Icon key or URL; wins over [icon] when not empty.
74
- * @param trailingColor Wins over [iconColor] when set.
75
- * @param onPressTrailing Wins over [onRightIconPressed] when set.
70
+ * [icon], [iconColor] and [onRightIconPressed] are deprecated aliases of [trailing] (icon key or URL),
71
+ * [trailingColor] and [onPressTrailing]; the new param wins when set ([trailing] when not empty).
76
72
  */
77
73
  @Composable
78
74
  fun InputPhoneNumber(
@@ -95,17 +91,15 @@ fun InputPhoneNumber(
95
91
  modifier: Modifier = Modifier,
96
92
  inputModifier: Modifier = Modifier,
97
93
  ) {
98
- // Consolidated state management
99
94
  var inputState by remember { mutableStateOf(InputState()) }
100
95
 
101
- // Memoized color calculations
102
96
  val theme = AppTheme.current
103
97
  val colors = remember(theme, iconColor, trailingColor) {
104
- Triple(
105
- theme.colors.text.default, // textColor
106
- theme.colors.text.hint, // placeholderColor
107
- trailingColor ?: iconColor // iconTintColor
108
- )
98
+ Triple(
99
+ theme.colors.text.default,
100
+ theme.colors.text.hint,
101
+ trailingColor ?: iconColor
102
+ )
109
103
  }
110
104
 
111
105
  val (textColor, placeholderColor, iconTintColor) = colors
@@ -164,7 +158,6 @@ fun InputPhoneNumber(
164
158
  modifier = Modifier.padding(horizontal = Spacing.M),
165
159
  verticalAlignment = Alignment.CenterVertically
166
160
  ) {
167
- // Leading icon
168
161
  Image(
169
162
  source = "https://static.momocdn.net/app/img/icon/ic-qrcode-package/ic_vn_flag.png",
170
163
  modifier = Modifier.size(24.dp).padding(end = Spacing.XS),
@@ -230,7 +223,6 @@ fun InputPhoneNumber(
230
223
  }
231
224
  },
232
225
  )
233
- // Error/hint display
234
226
  ErrorView(error, errorSpacing, hintText)
235
227
  }
236
228
  }
@@ -95,7 +95,6 @@ fun InputTextArea(
95
95
  }
96
96
  },
97
97
  decorationBox = { innerTextField ->
98
- // Floating Icon
99
98
  FloatingLabel(
100
99
  floatingValue = floatingValue,
101
100
  floatingIcon = floatingIcon,
@@ -104,7 +103,7 @@ fun InputTextArea(
104
103
  offsetY = -scaleHeight / 2,
105
104
  required = required,
106
105
  )
107
- //input box wrapper
106
+ // Input container
108
107
  Box(
109
108
  modifier = Modifier.fillMaxWidth()
110
109
  .background(
@@ -179,7 +178,6 @@ fun InputTextArea(
179
178
  }
180
179
  },
181
180
  )
182
- // show error
183
181
  ErrorView(error, errorSpacing, "")
184
182
  }
185
183
  }
@@ -8,7 +8,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
8
8
  import androidx.compose.runtime.Composable
9
9
  import androidx.compose.ui.Alignment
10
10
  import androidx.compose.ui.Modifier
11
- import androidx.compose.ui.graphics.Color
12
11
  import androidx.compose.ui.unit.dp
13
12
  import vn.momo.kits.application.IsShowBaseLineDebug
14
13
  import vn.momo.kits.const.Colors
@@ -23,7 +22,7 @@ fun PaginationNumber(
23
22
  ) {
24
23
  BoxWithConstraints(
25
24
  modifier = Modifier.background(
26
- color = Color(0x33000000),
25
+ color = Colors.opacity_black_20,
27
26
  shape = RoundedCornerShape(Spacing.L)
28
27
  )
29
28
  .conditional(IsShowBaseLineDebug) {
@@ -38,14 +38,12 @@ fun PaginationScroll(
38
38
  val scrollState = rememberScrollState()
39
39
  val theme = AppTheme.current
40
40
 
41
- // Use derivedStateOf to optimize scroll position calculations
42
41
  val indicatorOffset by remember {
43
42
  derivedStateOf {
44
43
  calculateOffset(scrollState.value, scrollState.maxValue)
45
44
  }
46
45
  }
47
46
 
48
- // Cache theme colors to avoid repeated access
49
47
  val (progressBackground, indicatorColor) = remember(theme) {
50
48
  theme.colors.background.pressed to theme.colors.primary
51
49
  }
@@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.padding
7
7
  import androidx.compose.foundation.shape.RoundedCornerShape
8
8
  import androidx.compose.runtime.Composable
9
9
  import androidx.compose.ui.Modifier
10
- import androidx.compose.ui.graphics.Color
11
10
  import androidx.compose.ui.unit.dp
12
11
  import vn.momo.kits.application.IsShowBaseLineDebug
13
12
  import vn.momo.kits.const.Colors
@@ -21,7 +20,7 @@ fun PaginationWhiteDot(
21
20
  ) {
22
21
  Row(
23
22
  modifier = Modifier.background(
24
- color = Color(0x33000000),
23
+ color = Colors.opacity_black_20,
25
24
  shape = RoundedCornerShape(Spacing.S)
26
25
  )
27
26
  .conditional(IsShowBaseLineDebug) {
@@ -206,7 +206,7 @@ fun PopupNotify(
206
206
  .verticalScroll(descriptionScrollState)
207
207
  ) {
208
208
  Text(
209
- text = props.description,
209
+ text = description,
210
210
  onTextLayout = { layoutResult.value = it },
211
211
  style = Typography.bodyDefaultRegular
212
212
  )
@@ -186,8 +186,7 @@ private fun ProgressInfoVertical(
186
186
  steps.forEachIndexed { index, item ->
187
187
  val isLast = index == steps.lastIndex
188
188
 
189
- // Intrinsic height lets the connector fill the row in one pass; measuring the row and
190
- // feeding it back lagged a frame and never let the line shrink with its text.
189
+ // Intrinsic height lets the connector fill the row in one pass and shrink with its text.
191
190
  Row(
192
191
  modifier = Modifier
193
192
  .fillMaxWidth()