@momo-kits/native-kits 0.162.4-debug → 0.162.5-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 (96) hide show
  1. package/compose/build.gradle.kts +11 -8
  2. package/compose/build.gradle.kts.backup +10 -7
  3. package/compose/compose.podspec +1 -1
  4. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +2 -7
  5. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +10 -3
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +6 -24
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +4 -19
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +1 -10
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +2 -2
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +1 -1
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +1 -1
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +5 -16
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +6 -101
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +2 -14
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +8 -33
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +1 -1
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +1 -6
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +27 -29
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +3 -26
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +27 -30
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +3 -13
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -5
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +3 -11
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +3 -18
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +11 -11
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +3 -11
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +1 -5
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +84 -59
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +13 -71
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +10 -51
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +6 -1
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +4 -21
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +15 -76
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +5 -26
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +1 -1
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +3 -11
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +15 -36
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +3 -9
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -28
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +2 -13
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +4 -10
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +3 -28
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +8 -47
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +4 -25
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +2 -11
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +1 -17
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +1 -6
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +50 -111
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +1 -5
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +7 -8
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +1 -12
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +4 -96
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +2 -12
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +9 -21
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +2 -2
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +9 -14
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +8 -11
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -1
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +24 -40
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +1 -1
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -5
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -2
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +94 -4
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -2
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +1 -5
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +5 -15
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +48 -7
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +48 -33
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +56 -55
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +3 -9
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +12 -32
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +1 -1
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +6 -24
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +11 -7
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +2 -1
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +6 -3
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +1 -1
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +3 -13
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +3 -2
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +1 -40
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -2
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -8
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +2 -17
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +1 -1
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +3 -3
  88. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +2 -3
  89. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -2
  90. package/gradle.properties +1 -1
  91. package/ios/Application/ApplicationEnvironment.swift +1 -0
  92. package/ios/Application/FontScaleStore.swift +59 -0
  93. package/ios/Typography/Text.swift +12 -7
  94. package/ios/Typography/Typography.swift +13 -8
  95. package/package.json +1 -1
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -17
@@ -70,15 +70,15 @@ fun BadgeRibbon(
70
70
  }
71
71
 
72
72
  if (isRound) {
73
- renderRoundContent(label, rotate, theme.colors.warning.primary)
73
+ RenderRoundContent(label, rotate, theme.colors.warning.primary)
74
74
  } else {
75
- renderSkewContent(label, rotate, theme.colors.warning.primary)
75
+ RenderSkewContent(label, rotate, theme.colors.warning.primary)
76
76
  }
77
77
  }
78
78
  }
79
79
 
80
80
  @Composable
81
- fun renderRoundContent(label: String, rotate: Float, backgroundColor: Color){
81
+ internal fun RenderRoundContent(label: String, rotate: Float, backgroundColor: Color){
82
82
  Box(
83
83
  modifier = Modifier
84
84
  .height(roundHeight)
@@ -97,7 +97,7 @@ fun renderRoundContent(label: String, rotate: Float, backgroundColor: Color){
97
97
  }
98
98
 
99
99
  @Composable
100
- fun renderSkewContent(label: String, rotate: Float, backgroundColor: Color){
100
+ internal fun RenderSkewContent(label: String, rotate: Float, backgroundColor: Color){
101
101
  Box(
102
102
  modifier = Modifier
103
103
  .height(skewBodyHeight)
@@ -110,7 +110,7 @@ fun renderSkewContent(label: String, rotate: Float, backgroundColor: Color){
110
110
  }
111
111
 
112
112
  @Composable
113
- fun Label(label: String, rotate: Float){
113
+ internal fun Label(label: String, rotate: Float){
114
114
  Text(
115
115
  text = label,
116
116
  color = Colors.black_01,
@@ -122,7 +122,7 @@ fun Label(label: String, rotate: Float){
122
122
  }
123
123
 
124
124
  @Composable
125
- fun UpTail() {
125
+ internal fun UpTail() {
126
126
  Image(
127
127
  source = "https://static.momocdn.net/app/img/kits/utils/Head_down_4x.png",
128
128
  modifier = Modifier
@@ -136,7 +136,7 @@ fun UpTail() {
136
136
  }
137
137
 
138
138
  @Composable
139
- fun DownTail() {
139
+ internal fun DownTail() {
140
140
  Image(
141
141
  source = "https://static.momocdn.net/app/img/kits/utils/Head_4x.png",
142
142
  modifier = Modifier
@@ -149,7 +149,7 @@ fun DownTail() {
149
149
  }
150
150
 
151
151
  @Composable
152
- fun RightTail() {
152
+ internal fun RightTail() {
153
153
  Image(
154
154
  source = "https://static.momocdn.net/app/img/kits/utils/Tail_4x.png",
155
155
  modifier = Modifier
@@ -190,10 +190,9 @@ fun RoundedBadgeRibbon(
190
190
  val textHeight = with(density) { textLayoutResult.size.height.toDp() }
191
191
 
192
192
  val minRibbonHeight = (textHeight * 1.2f).coerceAtLeast(16.dp)
193
- val paddingBottom = minRibbonHeight / 4f
194
- val badgeHeight = minRibbonHeight + paddingBottom
195
- val horizontalPadding = paddingBottom
196
- val badgeWidth = (textWidth + horizontalPadding * 2).coerceAtLeast(28.dp)
193
+ val padding = minRibbonHeight / 4f
194
+ val badgeHeight = minRibbonHeight + padding
195
+ val badgeWidth = (textWidth + padding * 2).coerceAtLeast(28.dp)
197
196
 
198
197
  val (rotateZ, scaleY, scaleX) = when (position) {
199
198
  RibbonPosition.TopLeft -> Triple(0f, 1f, -1f)
@@ -211,12 +210,12 @@ fun RoundedBadgeRibbon(
211
210
  this.scaleX = scaleX
212
211
  }
213
212
  ) {
214
- val roundedRect = (badgeHeight - paddingBottom) / 2f
213
+ val roundedRect = (badgeHeight - padding) / 2f
215
214
 
216
215
  Canvas(modifier = Modifier.matchParentSize()) {
217
216
  val width = size.width
218
217
  val height = size.height
219
- val ribbonHeight = height - paddingBottom.toPx()
218
+ val ribbonHeight = height - padding.toPx()
220
219
  val cornerRadius = roundedRect.toPx()
221
220
 
222
221
  val mainColor = Color(0xFFFA541C)
@@ -273,7 +272,7 @@ fun RoundedBadgeRibbon(
273
272
 
274
273
  // Draw bottom tail section
275
274
  val tailY = ribbonHeight
276
- val tailHeight = paddingBottom.toPx()
275
+ val tailHeight = padding.toPx()
277
276
  val halfHeadWidth = headWidth / 2f
278
277
  val tailStartX = rightX + headWidth - halfHeadWidth
279
278
 
@@ -284,7 +283,6 @@ fun RoundedBadgeRibbon(
284
283
  size = Size(halfHeadWidth, halfHeadWidth)
285
284
  )
286
285
 
287
- val tailRoundRadius = tailHeight
288
286
  val tailRightPath = Path().apply {
289
287
  addRoundRect(
290
288
  RoundRect(
@@ -295,8 +293,8 @@ fun RoundedBadgeRibbon(
295
293
  bottom = tailY + tailHeight
296
294
  ),
297
295
  topLeft = CornerRadius.Zero,
298
- topRight = CornerRadius(tailRoundRadius, tailRoundRadius),
299
- bottomRight = CornerRadius(tailRoundRadius, tailRoundRadius),
296
+ topRight = CornerRadius(tailHeight, tailHeight),
297
+ bottomRight = CornerRadius(tailHeight, tailHeight),
300
298
  bottomLeft = CornerRadius.Zero
301
299
  )
302
300
  )
@@ -310,8 +308,8 @@ fun RoundedBadgeRibbon(
310
308
  Text(
311
309
  text = text,
312
310
  modifier = Modifier
313
- .padding(bottom = paddingBottom)
314
- .padding(horizontal = paddingBottom / 2)
311
+ .padding(bottom = padding)
312
+ .padding(horizontal = padding / 2)
315
313
  .align(Alignment.Center)
316
314
  .graphicsLayer {
317
315
  rotationZ = rotateZ
@@ -327,14 +325,14 @@ fun RoundedBadgeRibbon(
327
325
  }
328
326
  }
329
327
 
330
- val ribbonHeight: Dp = 20.dp
331
- val roundHeight: Dp = 16.dp
332
- val skewBodyHeight: Dp = 16.dp
333
- val roundRightRadius: Dp = 12.dp
334
- val roundPaddingEnd: Dp = 6.dp
335
- val skewTailWidth: Dp = 8.dp
336
- val skewTailHeight: Dp = 16.dp
337
- val headTailWidth: Dp = 5.dp
338
- val headTailHeight: Dp = 20.dp
328
+ private val ribbonHeight: Dp = 20.dp
329
+ private val roundHeight: Dp = 16.dp
330
+ private val skewBodyHeight: Dp = 16.dp
331
+ private val roundRightRadius: Dp = 12.dp
332
+ private val roundPaddingEnd: Dp = 6.dp
333
+ private val skewTailWidth: Dp = 8.dp
334
+ private val skewTailHeight: Dp = 16.dp
335
+ private val headTailWidth: Dp = 5.dp
336
+ private val headTailHeight: Dp = 20.dp
339
337
 
340
338
  enum class RibbonPosition {TopLeft, TopRight, BottomLeft, BottomRight}
@@ -2,17 +2,7 @@ package vn.momo.kits.components
2
2
 
3
3
  import androidx.compose.foundation.Canvas
4
4
  import androidx.compose.foundation.background
5
- import androidx.compose.foundation.border
6
- import androidx.compose.foundation.layout.Box
7
- import androidx.compose.foundation.layout.WindowInsets
8
- import androidx.compose.foundation.layout.asPaddingValues
9
- import androidx.compose.foundation.layout.fillMaxHeight
10
- import androidx.compose.foundation.layout.fillMaxSize
11
- import androidx.compose.foundation.layout.fillMaxWidth
12
- import androidx.compose.foundation.layout.height
13
- import androidx.compose.foundation.layout.navigationBars
14
- import androidx.compose.foundation.layout.padding
15
- import androidx.compose.foundation.layout.width
5
+ import androidx.compose.foundation.layout.*
16
6
  import androidx.compose.runtime.Composable
17
7
  import androidx.compose.ui.Alignment
18
8
  import androidx.compose.ui.Modifier
@@ -21,22 +11,9 @@ import androidx.compose.ui.graphics.Color
21
11
  import androidx.compose.ui.graphics.PathEffect
22
12
  import androidx.compose.ui.graphics.StrokeCap
23
13
  import androidx.compose.ui.unit.dp
24
- import io.ktor.util.Platform
25
- import vn.momo.kits.application.IsShowBaseLineDebug
26
- import vn.momo.kits.const.Colors
27
- import vn.momo.kits.modifier.conditional
28
14
  import vn.momo.kits.platform.getPlatformName
29
15
  import vn.momo.kits.platform.getStatusBarHeight
30
16
 
31
- /**
32
- * A debug overlay that draws danger/warning baseline guides on top of the screen.
33
- *
34
- * Highlights safe-area boundaries, header regions, and bottom navigation zones
35
- * using colored solid or dotted lines and semi-transparent red zones.
36
- *
37
- * @param enabled When `false` the composable renders nothing. Pass `false` when
38
- * your QC automation flag is active to suppress the overlay.
39
- */
40
17
  @Composable
41
18
  fun BaselineView(enabled: Boolean = true) {
42
19
  if (!enabled) return
@@ -169,10 +146,10 @@ fun BaselineView(enabled: Boolean = true) {
169
146
  }
170
147
  }
171
148
 
172
- enum class BaselineOrientation { Horizontal, Vertical }
149
+ private enum class BaselineOrientation { Horizontal, Vertical }
173
150
 
174
151
  @Composable
175
- fun BaselineDottedLine(
152
+ private fun BaselineDottedLine(
176
153
  modifier: Modifier = Modifier,
177
154
  color: Color = Color.Red,
178
155
  orientation: BaselineOrientation = BaselineOrientation.Horizontal,
@@ -1,5 +1,7 @@
1
1
  package vn.momo.kits.components
2
2
 
3
+ import vn.momo.kits.modifier.InternalApi
4
+
3
5
  import androidx.compose.animation.core.animateDpAsState
4
6
  import androidx.compose.animation.core.animateFloatAsState
5
7
  import androidx.compose.animation.core.tween
@@ -8,14 +10,7 @@ import androidx.compose.foundation.border
8
10
  import androidx.compose.foundation.clickable
9
11
  import androidx.compose.foundation.interaction.MutableInteractionSource
10
12
  import androidx.compose.foundation.interaction.collectIsPressedAsState
11
- import androidx.compose.foundation.layout.Arrangement
12
- import androidx.compose.foundation.layout.Box
13
- import androidx.compose.foundation.layout.Row
14
- import androidx.compose.foundation.layout.fillMaxWidth
15
- import androidx.compose.foundation.layout.height
16
- import androidx.compose.foundation.layout.padding
17
- import androidx.compose.foundation.layout.size
18
- import androidx.compose.foundation.layout.wrapContentHeight
13
+ import androidx.compose.foundation.layout.*
19
14
  import androidx.compose.foundation.shape.RoundedCornerShape
20
15
  import androidx.compose.runtime.Composable
21
16
  import androidx.compose.runtime.getValue
@@ -30,11 +25,7 @@ import androidx.compose.ui.text.style.TextOverflow
30
25
  import androidx.compose.ui.unit.Dp
31
26
  import androidx.compose.ui.unit.dp
32
27
  import vn.momo.kits.application.IsShowBaseLineDebug
33
- import vn.momo.kits.const.AppTheme
34
- import vn.momo.kits.const.Colors
35
- import vn.momo.kits.const.Radius
36
- import vn.momo.kits.const.Spacing
37
- import vn.momo.kits.const.Typography
28
+ import vn.momo.kits.const.*
38
29
  import vn.momo.kits.modifier.conditional
39
30
  import vn.momo.kits.platform.LottieAnimation
40
31
 
@@ -100,32 +91,37 @@ private val iconSpaceCache = mapOf(
100
91
  Size.LARGE to Spacing.S
101
92
  )
102
93
 
103
- fun getStyle(size: Size): TextStyle {
94
+ private fun getStyle(size: Size): TextStyle {
104
95
  return styleCache[size] ?: Typography.actionDefaultBold
105
96
  }
106
97
 
107
- fun getIconSize(size: Size): Dp = iconSizeCache[size] ?: 24.dp
108
- fun getIconSpace(size: Size): Dp = iconSpaceCache[size] ?: Spacing.S
98
+ private fun getIconSize(size: Size): Dp = iconSizeCache[size] ?: 24.dp
99
+ private fun getIconSpace(size: Size): Dp = iconSpaceCache[size] ?: Spacing.S
109
100
 
110
101
  @Composable
111
- fun getTextColor(loading: Boolean, type: ButtonType): Color {
102
+ internal fun getTextColor(loading: Boolean, type: ButtonType): Color {
112
103
  val theme = AppTheme.current
113
104
 
114
105
  return remember(type, theme, loading) {
115
- when (type) {
116
- ButtonType.DISABLED -> theme.colors.text.disable
117
- ButtonType.PRIMARY -> Colors.black_01
118
- ButtonType.SECONDARY -> theme.colors.text.default
119
- ButtonType.OUTLINE -> theme.colors.primary
120
- ButtonType.TONAL -> theme.colors.primary
121
- ButtonType.DANGER -> Colors.black_01
122
- ButtonType.TEXT -> theme.colors.primary
123
- }.withLoading(loading)
106
+ getButtonColor(type, theme).withLoading(loading)
107
+ }
108
+ }
109
+
110
+ internal fun getButtonColor(type: ButtonType, theme: Theme): Color {
111
+ return when (type) {
112
+ ButtonType.DISABLED -> theme.colors.text.disable
113
+ ButtonType.PRIMARY -> Colors.black_01
114
+ ButtonType.SECONDARY -> theme.colors.text.default
115
+ ButtonType.OUTLINE -> theme.colors.primary
116
+ ButtonType.TONAL -> theme.colors.primary
117
+ ButtonType.DANGER -> Colors.black_01
118
+ ButtonType.TEXT -> theme.colors.primary
124
119
  }
125
120
  }
126
121
 
122
+
127
123
  @Composable
128
- fun RenderTitle(size: Size, title: String = "", textColor: Color) {
124
+ internal fun RenderTitle(size: Size, title: String = "", textColor: Color) {
129
125
  val style = remember(size) { getStyle(size) }
130
126
  Text(
131
127
  style = style,
@@ -137,6 +133,7 @@ fun RenderTitle(size: Size, title: String = "", textColor: Color) {
137
133
  }
138
134
 
139
135
  @Composable
136
+ @InternalApi
140
137
  fun RenderIcon(
141
138
  size: Size,
142
139
  isIconLeft: Boolean,
@@ -187,7 +184,7 @@ private fun shouldLoadingOnLeft(iconLeft: String, iconRight: String): Boolean {
187
184
  }
188
185
 
189
186
  @Composable
190
- fun getTypeStyle(
187
+ internal fun getTypeStyle(
191
188
  type: ButtonType,
192
189
  color: Color? = AppTheme.current.colors.primary,
193
190
  size: Size,
@@ -223,7 +220,7 @@ fun getTypeStyle(
223
220
  }
224
221
 
225
222
  @Composable
226
- fun getButtonBackgroundColor(
223
+ internal fun getButtonBackgroundColor(
227
224
  loading: Boolean,
228
225
  type: ButtonType
229
226
  ): Color {
@@ -242,7 +239,7 @@ fun getButtonBackgroundColor(
242
239
  }
243
240
  }
244
241
 
245
- fun Color.withLoading(loading: Boolean): Color =
242
+ private fun Color.withLoading(loading: Boolean): Color =
246
243
  this.copy(alpha = if (loading) 0.75f else 1f)
247
244
 
248
245
  @Composable
@@ -8,13 +8,7 @@ import androidx.compose.foundation.layout.PaddingValues
8
8
  import androidx.compose.foundation.layout.fillMaxWidth
9
9
  import androidx.compose.foundation.pager.HorizontalPager
10
10
  import androidx.compose.foundation.pager.rememberPagerState
11
- import androidx.compose.runtime.Composable
12
- import androidx.compose.runtime.LaunchedEffect
13
- import androidx.compose.runtime.getValue
14
- import androidx.compose.runtime.mutableStateOf
15
- import androidx.compose.runtime.remember
16
- import androidx.compose.runtime.setValue
17
- import androidx.compose.runtime.snapshotFlow
11
+ import androidx.compose.runtime.*
18
12
  import androidx.compose.ui.Modifier
19
13
  import androidx.compose.ui.graphics.graphicsLayer
20
14
  import androidx.compose.ui.unit.dp
@@ -24,6 +18,7 @@ import vn.momo.kits.application.IsShowBaseLineDebug
24
18
  import vn.momo.kits.const.Colors
25
19
  import vn.momo.kits.modifier.conditional
26
20
  import kotlin.math.absoluteValue
21
+ import kotlin.time.Duration.Companion.milliseconds
27
22
 
28
23
  @Composable
29
24
  fun Carousel(
@@ -32,7 +27,6 @@ fun Carousel(
32
27
  loop: Boolean = false,
33
28
  autoplay: Boolean = false,
34
29
  autoplayInterval: Long = 3000L,
35
- enableSnap: Boolean = true,
36
30
  scrollEnabled: Boolean = true,
37
31
  inactiveSlideOpacity: Float = 1f,
38
32
  inactiveSlideScale: Float = 1f,
@@ -48,18 +42,15 @@ fun Carousel(
48
42
 
49
43
  val pagerState = rememberPagerState(initialPage = startPage) { virtualPageCount }
50
44
 
51
- // Map virtual page to real index
52
45
  val realIndex: (Int) -> Int = { page -> page % itemCount }
53
46
 
54
- // Track user interaction for autoplay pause
55
47
  var isUserScrolling by remember { mutableStateOf(false) }
56
48
 
57
- // Autoplay
58
49
  if (autoplay && itemCount > 1) {
59
50
  LaunchedEffect(autoplayInterval, isUserScrolling) {
60
51
  if (isUserScrolling) return@LaunchedEffect
61
52
  while (isActive) {
62
- delay(autoplayInterval)
53
+ delay(autoplayInterval.milliseconds)
63
54
  if (!isUserScrolling) {
64
55
  val nextPage = pagerState.currentPage + 1
65
56
  if (nextPage < virtualPageCount) {
@@ -70,7 +61,6 @@ fun Carousel(
70
61
  }
71
62
  }
72
63
 
73
- // Track scroll state for callbacks
74
64
  LaunchedEffect(pagerState) {
75
65
  snapshotFlow { pagerState.isScrollInProgress }.collect { scrolling ->
76
66
  isUserScrolling = scrolling
@@ -22,7 +22,6 @@ import vn.momo.kits.const.Typography
22
22
  import vn.momo.kits.modifier.activeOpacityClickable
23
23
  import vn.momo.kits.modifier.conditional
24
24
 
25
- // Pre-computed shape for performance
26
25
  private val checkboxShape = RoundedCornerShape(Radius.XS)
27
26
 
28
27
  @Composable
@@ -33,10 +32,8 @@ fun CheckBox(
33
32
  indeterminate: Boolean = false,
34
33
  title: String = "",
35
34
  ) {
36
- // Cache theme access
37
35
  val theme = AppTheme.current
38
36
 
39
- // Memoize color calculations to avoid repeated conditional logic
40
37
  val colors = remember(checked, disabled, theme) {
41
38
  when {
42
39
  disabled && checked -> Pair(theme.colors.background.tonal, theme.colors.background.tonal)
@@ -48,12 +45,10 @@ fun CheckBox(
48
45
 
49
46
  val (borderColor, backgroundColor) = colors
50
47
 
51
- // Memoize icon source to avoid repeated conditional check
52
48
  val iconSource = remember(indeterminate) {
53
49
  if (indeterminate) "navigation_minus" else "ic_checked"
54
50
  }
55
51
 
56
- // Memoize click handler to avoid lambda recreation
57
52
  val onClickHandler = remember(onCheckedChange, checked) {
58
53
  { onCheckedChange(!checked) }
59
54
  }
@@ -2,11 +2,7 @@ package vn.momo.kits.components
2
2
 
3
3
  import androidx.compose.foundation.background
4
4
  import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.Arrangement
6
- import androidx.compose.foundation.layout.Row
7
- import androidx.compose.foundation.layout.height
8
- import androidx.compose.foundation.layout.padding
9
- import androidx.compose.foundation.layout.wrapContentWidth
5
+ import androidx.compose.foundation.layout.*
10
6
  import androidx.compose.foundation.shape.RoundedCornerShape
11
7
  import androidx.compose.runtime.Composable
12
8
  import androidx.compose.runtime.Immutable
@@ -17,12 +13,8 @@ import androidx.compose.ui.graphics.Color
17
13
  import androidx.compose.ui.text.style.TextAlign
18
14
  import androidx.compose.ui.text.style.TextOverflow
19
15
  import androidx.compose.ui.unit.dp
20
- import vn.momo.kits.const.AppTheme
21
- import vn.momo.kits.const.Colors
22
- import vn.momo.kits.const.Radius
23
- import vn.momo.kits.const.Typography
24
16
  import vn.momo.kits.application.IsShowBaseLineDebug
25
- import vn.momo.kits.const.scaleSize
17
+ import vn.momo.kits.const.*
26
18
  import vn.momo.kits.modifier.activeOpacityClickable
27
19
  import vn.momo.kits.modifier.conditional
28
20
  import vn.momo.kits.modifier.setAutomationId
@@ -111,7 +103,7 @@ fun Chip(
111
103
 
112
104
  enum class ChipSize { SMALL, LARGE }
113
105
 
114
- object ChipDefaults {
106
+ private object ChipDefaults {
115
107
  @Immutable
116
108
  data class Dimensions(
117
109
  val height: Float,
@@ -7,20 +7,9 @@ import androidx.compose.animation.expandVertically
7
7
  import androidx.compose.animation.shrinkVertically
8
8
  import androidx.compose.foundation.background
9
9
  import androidx.compose.foundation.border
10
- import androidx.compose.foundation.layout.Box
11
- import androidx.compose.foundation.layout.Column
12
- import androidx.compose.foundation.layout.Row
13
- import androidx.compose.foundation.layout.Spacer
14
- import androidx.compose.foundation.layout.fillMaxWidth
15
- import androidx.compose.foundation.layout.padding
16
- import androidx.compose.foundation.layout.size
17
- import androidx.compose.foundation.layout.width
10
+ import androidx.compose.foundation.layout.*
18
11
  import androidx.compose.foundation.shape.RoundedCornerShape
19
- import androidx.compose.runtime.Composable
20
- import androidx.compose.runtime.getValue
21
- import androidx.compose.runtime.mutableStateOf
22
- import androidx.compose.runtime.remember
23
- import androidx.compose.runtime.setValue
12
+ import androidx.compose.runtime.*
24
13
  import androidx.compose.ui.Alignment
25
14
  import androidx.compose.ui.Modifier
26
15
  import androidx.compose.ui.draw.clip
@@ -29,11 +18,7 @@ import androidx.compose.ui.graphics.Color
29
18
  import androidx.compose.ui.text.TextStyle
30
19
  import androidx.compose.ui.unit.dp
31
20
  import vn.momo.kits.application.IsShowBaseLineDebug
32
- import vn.momo.kits.const.AppTheme
33
- import vn.momo.kits.const.Colors
34
- import vn.momo.kits.const.Radius
35
- import vn.momo.kits.const.Spacing
36
- import vn.momo.kits.const.Typography
21
+ import vn.momo.kits.const.*
37
22
  import vn.momo.kits.modifier.activeOpacityClickable
38
23
  import vn.momo.kits.modifier.conditional
39
24
  import vn.momo.kits.modifier.setAutomationId
@@ -42,8 +42,8 @@ import androidx.compose.ui.unit.toOffset
42
42
  import androidx.compose.ui.unit.toSize
43
43
  import kotlinx.coroutines.CoroutineScope
44
44
  import kotlinx.coroutines.cancel
45
+ import kotlinx.coroutines.currentCoroutineContext
45
46
  import kotlinx.coroutines.isActive
46
- import kotlin.coroutines.coroutineContext
47
47
  import kotlin.math.abs
48
48
  import kotlin.math.sign
49
49
 
@@ -103,7 +103,7 @@ internal class CupertinoOverscrollEffect(
103
103
  * end at the same time, which is not the case:
104
104
  * Spring->Fling->Spring, Fling->Spring, Spring->Fling effects can have different timing per dimension
105
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
106
+ * which is not possible to express without changing API. Hence, this effect will be fixed to latest
107
107
  * received delta.
108
108
  */
109
109
  private var direction: CupertinoOverscrollDirection = CupertinoOverscrollDirection.UNKNOWN
@@ -151,7 +151,7 @@ internal class CupertinoOverscrollEffect(
151
151
  override val node: DelegatableNode get() = overscrollNode
152
152
 
153
153
  private fun onDraw() {
154
- // Fix an issue where scrolling was cancelled but the overscroll effect was not completed.
154
+ // Fix an issue where scrolling was canceled but the overscroll effect was not completed.
155
155
  // Reset the overscroll effect when no ongoing animation or interaction is applied.
156
156
  if (!drawCallScheduledByOffsetChange && isInProgress && overscrollNode.pointersDown == 0) {
157
157
  overscrollOffsetState.value = Offset.Zero
@@ -289,7 +289,7 @@ internal class CupertinoOverscrollEffect(
289
289
  }
290
290
 
291
291
  private fun applyPullToRefresh() {
292
- val (isRefresh, refresh, threshHold, _, sendHaptic) = pullRefreshState ?: return
292
+ val (isRefresh, refresh, threshHold, _, _) = pullRefreshState ?: return
293
293
  val overscrollY = overscrollOffset.y
294
294
  if (isRefresh.value || overscrollY < threshHold.value * density) return
295
295
  refresh.invoke()
@@ -398,7 +398,7 @@ internal class CupertinoOverscrollEffect(
398
398
  }
399
399
 
400
400
  springAnimationScope?.cancel()
401
- springAnimationScope = CoroutineScope(coroutineContext)
401
+ springAnimationScope = CoroutineScope(currentCoroutineContext())
402
402
  springAnimationScope?.run {
403
403
  AnimationState(
404
404
  Float.VectorConverter,
@@ -414,7 +414,7 @@ internal class CupertinoOverscrollEffect(
414
414
  } ?: (value * density).toOffset()
415
415
  currentVelocity = velocity * density
416
416
 
417
- // If it was fling from overscroll, cancel animation and return velocity
417
+ // If it was flung from overscroll, cancel animation and return velocity
418
418
  if (reason == CupertinoSpringAnimationReason.FLING_FROM_OVERSCROLL &&
419
419
  initialSign != 0f &&
420
420
  sign(value) != initialSign
@@ -425,7 +425,7 @@ internal class CupertinoOverscrollEffect(
425
425
  springAnimationScope = null
426
426
  }
427
427
 
428
- if (coroutineContext.isActive) {
428
+ if (currentCoroutineContext().isActive) {
429
429
  // The spring is critically damped, so in case spring-fling-spring sequence is slightly
430
430
  // offset and velocity is of the opposite sign, it will end up with no animation
431
431
  overscrollOffset = Offset.Zero
@@ -447,8 +447,8 @@ internal class CupertinoOverscrollEffect(
447
447
  val dpSize = scrollSize / density
448
448
 
449
449
  return Offset(
450
- rubberBandedValue(dpOffset.x, dpSize.width, RUBBER_BAND_COEFFICIENT),
451
- rubberBandedValue(dpOffset.y, dpSize.height, RUBBER_BAND_COEFFICIENT)
450
+ rubberBandedValue(dpOffset.x, dpSize.width),
451
+ rubberBandedValue(dpOffset.y, dpSize.height)
452
452
  ) * density
453
453
  }
454
454
 
@@ -456,8 +456,8 @@ internal class CupertinoOverscrollEffect(
456
456
  * Maps raw delta offset [value] on an axis within scroll container with [dimension]
457
457
  * to actual visible offset
458
458
  */
459
- private fun rubberBandedValue(value: Float, dimension: Float, coefficient: Float) =
460
- sign(value) * (1f - (1f / (abs(value) * coefficient / dimension + 1f))) * dimension
459
+ private fun rubberBandedValue(value: Float, dimension: Float) =
460
+ sign(value) * (1f - (1f / (abs(value) * RUBBER_BAND_COEFFICIENT / dimension + 1f))) * dimension
461
461
 
462
462
  companion object Companion {
463
463
  private const val RUBBER_BAND_COEFFICIENT = 0.55f
@@ -56,7 +56,7 @@ private val iconSizeMap = mapOf(
56
56
  )
57
57
 
58
58
  @Composable
59
- fun getIconStyle(type: ButtonType, color: Color? = null): Modifier {
59
+ internal fun getIconStyle(type: ButtonType, color: Color? = null): Modifier {
60
60
  val theme = AppTheme.current
61
61
 
62
62
  return remember(type, color, theme) {
@@ -91,18 +91,10 @@ fun getIconStyle(type: ButtonType, color: Color? = null): Modifier {
91
91
  }
92
92
 
93
93
  @Composable
94
- fun getIconColor(type: ButtonType): Color {
94
+ internal fun getIconColor(type: ButtonType): Color {
95
95
  val theme = AppTheme.current
96
96
  return remember(type, theme) {
97
- when (type) {
98
- ButtonType.DISABLED -> theme.colors.text.disable
99
- ButtonType.PRIMARY -> Colors.black_01
100
- ButtonType.SECONDARY -> theme.colors.text.default
101
- ButtonType.OUTLINE -> theme.colors.primary
102
- ButtonType.TONAL -> theme.colors.primary
103
- ButtonType.DANGER -> Colors.black_01
104
- ButtonType.TEXT -> theme.colors.primary
105
- }
97
+ getButtonColor(type, theme)
106
98
  }
107
99
  }
108
100
 
@@ -3,11 +3,7 @@ package vn.momo.kits.components
3
3
  import androidx.compose.foundation.background
4
4
  import androidx.compose.foundation.border
5
5
  import androidx.compose.foundation.clickable
6
- import androidx.compose.foundation.layout.Column
7
- import androidx.compose.foundation.layout.Row
8
- import androidx.compose.foundation.layout.height
9
- import androidx.compose.foundation.layout.padding
10
- import androidx.compose.foundation.layout.width
6
+ import androidx.compose.foundation.layout.*
11
7
  import androidx.compose.foundation.shape.RoundedCornerShape
12
8
  import androidx.compose.runtime.Composable
13
9
  import androidx.compose.ui.Modifier