@momo-kits/native-kits 0.157.5-debug → 0.158.1-beta.1-debug

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/.claude/settings.local.json +11 -0
  2. package/.claude/skills/design-system/SKILL.md +88 -0
  3. package/.claude/skills/design-system/references/components/avatar.md +134 -0
  4. package/.claude/skills/design-system/references/components/badge.md +127 -0
  5. package/.claude/skills/design-system/references/components/bottom-tab.md +177 -0
  6. package/.claude/skills/design-system/references/components/bottomsheet.md +170 -0
  7. package/.claude/skills/design-system/references/components/button.md +206 -0
  8. package/.claude/skills/design-system/references/components/carousel.md +117 -0
  9. package/.claude/skills/design-system/references/components/checkbox.md +98 -0
  10. package/.claude/skills/design-system/references/components/chip.md +146 -0
  11. package/.claude/skills/design-system/references/components/collapse.md +120 -0
  12. package/.claude/skills/design-system/references/components/date-picker.md +119 -0
  13. package/.claude/skills/design-system/references/components/divider.md +84 -0
  14. package/.claude/skills/design-system/references/components/icon.md +130 -0
  15. package/.claude/skills/design-system/references/components/image.md +81 -0
  16. package/.claude/skills/design-system/references/components/information.md +107 -0
  17. package/.claude/skills/design-system/references/components/input-dropdown.md +138 -0
  18. package/.claude/skills/design-system/references/components/input-money.md +157 -0
  19. package/.claude/skills/design-system/references/components/input-otp.md +132 -0
  20. package/.claude/skills/design-system/references/components/input-phone-number.md +140 -0
  21. package/.claude/skills/design-system/references/components/input-search.md +124 -0
  22. package/.claude/skills/design-system/references/components/input-text-area.md +133 -0
  23. package/.claude/skills/design-system/references/components/input.md +152 -0
  24. package/.claude/skills/design-system/references/components/loader.md +87 -0
  25. package/.claude/skills/design-system/references/components/pagination.md +105 -0
  26. package/.claude/skills/design-system/references/components/popup-notify.md +128 -0
  27. package/.claude/skills/design-system/references/components/progress-info.md +114 -0
  28. package/.claude/skills/design-system/references/components/radio.md +86 -0
  29. package/.claude/skills/design-system/references/components/rating.md +126 -0
  30. package/.claude/skills/design-system/references/components/skeleton.md +120 -0
  31. package/.claude/skills/design-system/references/components/slider.md +141 -0
  32. package/.claude/skills/design-system/references/components/snackbar.md +97 -0
  33. package/.claude/skills/design-system/references/components/stepper.md +100 -0
  34. package/.claude/skills/design-system/references/components/steps.md +91 -0
  35. package/.claude/skills/design-system/references/components/suggest-action.md +95 -0
  36. package/.claude/skills/design-system/references/components/swipe.md +121 -0
  37. package/.claude/skills/design-system/references/components/switch.md +98 -0
  38. package/.claude/skills/design-system/references/components/tab-view.md +120 -0
  39. package/.claude/skills/design-system/references/components/tag.md +118 -0
  40. package/.claude/skills/design-system/references/components/text.md +151 -0
  41. package/.claude/skills/design-system/references/components/toast.md +99 -0
  42. package/.claude/skills/design-system/references/components/tooltip.md +138 -0
  43. package/.claude/skills/design-system/references/components/top-nav-miniapp.md +94 -0
  44. package/.claude/skills/design-system/references/components/top-nav.md +226 -0
  45. package/.claude/skills/design-system/references/components/uploader.md +115 -0
  46. package/.claude/skills/design-system/references/navigation/bottom-tab.md +131 -0
  47. package/.claude/skills/design-system/references/navigation/bottomsheet.md +161 -0
  48. package/.claude/skills/design-system/references/navigation/modal.md +133 -0
  49. package/.claude/skills/design-system/references/navigation/navigation-options.md +225 -0
  50. package/.claude/skills/design-system/references/navigation/navigator.md +111 -0
  51. package/.claude/skills/design-system/references/navigation/setup.md +134 -0
  52. package/.claude/skills/design-system/references/navigation/stack.md +128 -0
  53. package/.claude/skills/design-system/references/spec-convention.md +80 -0
  54. package/.claude/skills/design-system/references/tokens/colors.md +131 -0
  55. package/.claude/skills/design-system/references/tokens/spacing-radius.md +144 -0
  56. package/.claude/skills/design-system/references/tokens/theme.md +125 -0
  57. package/.claude/skills/design-system/references/tokens/typography.md +135 -0
  58. package/.claude/skills/design-system-kits/SKILL.md +102 -0
  59. package/.claude/skills/design-system-kits/references/code-convention.md +118 -0
  60. package/.claude/skills/design-system-kits/references/components/avatar.md +45 -0
  61. package/.claude/skills/design-system-kits/references/components/badge.md +27 -0
  62. package/.claude/skills/design-system-kits/references/components/button.md +65 -0
  63. package/.claude/skills/design-system-kits/references/components/carousel.md +51 -0
  64. package/.claude/skills/design-system-kits/references/components/checkbox.md +39 -0
  65. package/.claude/skills/design-system-kits/references/components/chip.md +54 -0
  66. package/.claude/skills/design-system-kits/references/components/collapse.md +63 -0
  67. package/.claude/skills/design-system-kits/references/components/date-picker.md +36 -0
  68. package/.claude/skills/design-system-kits/references/components/divider.md +21 -0
  69. package/.claude/skills/design-system-kits/references/components/icon.md +382 -0
  70. package/.claude/skills/design-system-kits/references/components/image.md +62 -0
  71. package/.claude/skills/design-system-kits/references/components/information.md +61 -0
  72. package/.claude/skills/design-system-kits/references/components/input-dropdown.md +92 -0
  73. package/.claude/skills/design-system-kits/references/components/input-money.md +128 -0
  74. package/.claude/skills/design-system-kits/references/components/input-otp.md +85 -0
  75. package/.claude/skills/design-system-kits/references/components/input-phone-number.md +96 -0
  76. package/.claude/skills/design-system-kits/references/components/input-search.md +127 -0
  77. package/.claude/skills/design-system-kits/references/components/input-text-area.md +100 -0
  78. package/.claude/skills/design-system-kits/references/components/input.md +126 -0
  79. package/.claude/skills/design-system-kits/references/components/loader.md +41 -0
  80. package/.claude/skills/design-system-kits/references/components/pagination.md +47 -0
  81. package/.claude/skills/design-system-kits/references/components/popup-notify.md +69 -0
  82. package/.claude/skills/design-system-kits/references/components/popup-promotion.md +35 -0
  83. package/.claude/skills/design-system-kits/references/components/progress-info.md +55 -0
  84. package/.claude/skills/design-system-kits/references/components/radio.md +42 -0
  85. package/.claude/skills/design-system-kits/references/components/rating.md +36 -0
  86. package/.claude/skills/design-system-kits/references/components/skeleton.md +25 -0
  87. package/.claude/skills/design-system-kits/references/components/slider.md +53 -0
  88. package/.claude/skills/design-system-kits/references/components/snackbar.md +52 -0
  89. package/.claude/skills/design-system-kits/references/components/stepper.md +46 -0
  90. package/.claude/skills/design-system-kits/references/components/steps.md +57 -0
  91. package/.claude/skills/design-system-kits/references/components/suggest-action.md +44 -0
  92. package/.claude/skills/design-system-kits/references/components/swipe.md +44 -0
  93. package/.claude/skills/design-system-kits/references/components/switch.md +43 -0
  94. package/.claude/skills/design-system-kits/references/components/tab-view.md +56 -0
  95. package/.claude/skills/design-system-kits/references/components/tag.md +50 -0
  96. package/.claude/skills/design-system-kits/references/components/text.md +56 -0
  97. package/.claude/skills/design-system-kits/references/components/toast.md +51 -0
  98. package/.claude/skills/design-system-kits/references/components/tooltip.md +95 -0
  99. package/.claude/skills/design-system-kits/references/components/uploader.md +48 -0
  100. package/.claude/skills/design-system-kits/references/design-spec-structure.md +356 -0
  101. package/.claude/skills/design-system-kits/references/design-spec-to-code.md +596 -0
  102. package/.claude/skills/design-system-kits/references/navigation/bottom-tab.md +155 -0
  103. package/.claude/skills/design-system-kits/references/navigation/bottomsheet.md +94 -0
  104. package/.claude/skills/design-system-kits/references/navigation/modal.md +125 -0
  105. package/.claude/skills/design-system-kits/references/navigation/navigation-options.md +430 -0
  106. package/.claude/skills/design-system-kits/references/navigation/navigator.md +177 -0
  107. package/.claude/skills/design-system-kits/references/navigation/setup.md +94 -0
  108. package/.claude/skills/design-system-kits/references/navigation/stack.md +152 -0
  109. package/.claude/skills/design-system-kits/references/screen-layout-rule.md +125 -0
  110. package/.claude/skills/design-system-kits/references/tokens/colors.md +183 -0
  111. package/.claude/skills/design-system-kits/references/tokens/spacing-radius.md +45 -0
  112. package/.claude/skills/design-system-kits/references/tokens/theme.md +97 -0
  113. package/.claude/skills/design-system-kits/references/tokens/typography.md +105 -0
  114. package/.claude/skills/vibe-design/SKILL.md +306 -0
  115. package/compose/build.gradle.kts +1 -1
  116. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +7 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +123 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +224 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +2 -2
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +338 -0
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +348 -0
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +256 -0
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +494 -0
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +131 -0
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +215 -0
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +531 -0
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +192 -0
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +3 -0
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +5 -2
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +2 -11
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +5 -1
  135. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +12 -0
  136. package/gradle.properties +1 -1
  137. package/ios/Popup/PopupPromotion.swift +2 -2
  138. package/local.properties +8 -0
  139. package/package.json +1 -1
@@ -0,0 +1,123 @@
1
+ package vn.momo.kits.components
2
+
3
+ import androidx.compose.animation.core.animateFloatAsState
4
+ import androidx.compose.animation.core.tween
5
+ import androidx.compose.foundation.border
6
+ import androidx.compose.foundation.layout.Box
7
+ import androidx.compose.foundation.layout.PaddingValues
8
+ import androidx.compose.foundation.layout.fillMaxWidth
9
+ import androidx.compose.foundation.pager.HorizontalPager
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
18
+ import androidx.compose.ui.Modifier
19
+ import androidx.compose.ui.graphics.graphicsLayer
20
+ import androidx.compose.ui.unit.dp
21
+ import kotlinx.coroutines.delay
22
+ import kotlinx.coroutines.isActive
23
+ import vn.momo.kits.application.IsShowBaseLineDebug
24
+ import vn.momo.kits.const.Colors
25
+ import vn.momo.kits.modifier.conditional
26
+ import kotlin.math.absoluteValue
27
+
28
+ @Composable
29
+ fun Carousel(
30
+ itemCount: Int,
31
+ modifier: Modifier = Modifier,
32
+ loop: Boolean = false,
33
+ autoplay: Boolean = false,
34
+ autoplayInterval: Long = 3000L,
35
+ enableSnap: Boolean = true,
36
+ scrollEnabled: Boolean = true,
37
+ inactiveSlideOpacity: Float = 1f,
38
+ inactiveSlideScale: Float = 1f,
39
+ contentPadding: PaddingValues = PaddingValues(0.dp),
40
+ onSnapToItem: (Int) -> Unit = {},
41
+ onScrollIndexChanged: (Int) -> Unit = {},
42
+ content: @Composable (index: Int) -> Unit,
43
+ ) {
44
+ if (itemCount <= 0) return
45
+
46
+ val virtualPageCount = if (loop) itemCount * 1000 else itemCount
47
+ val startPage = if (loop) (virtualPageCount / 2) - ((virtualPageCount / 2) % itemCount) else 0
48
+
49
+ val pagerState = rememberPagerState(initialPage = startPage) { virtualPageCount }
50
+
51
+ // Map virtual page to real index
52
+ val realIndex: (Int) -> Int = { page -> page % itemCount }
53
+
54
+ // Track user interaction for autoplay pause
55
+ var isUserScrolling by remember { mutableStateOf(false) }
56
+
57
+ // Autoplay
58
+ if (autoplay && itemCount > 1) {
59
+ LaunchedEffect(autoplayInterval, isUserScrolling) {
60
+ if (isUserScrolling) return@LaunchedEffect
61
+ while (isActive) {
62
+ delay(autoplayInterval)
63
+ if (!isUserScrolling) {
64
+ val nextPage = pagerState.currentPage + 1
65
+ if (nextPage < virtualPageCount) {
66
+ pagerState.animateScrollToPage(nextPage)
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+
73
+ // Track scroll state for callbacks
74
+ LaunchedEffect(pagerState) {
75
+ snapshotFlow { pagerState.isScrollInProgress }.collect { scrolling ->
76
+ isUserScrolling = scrolling
77
+ }
78
+ }
79
+
80
+ LaunchedEffect(pagerState) {
81
+ snapshotFlow { pagerState.currentPage }.collect { page ->
82
+ val real = realIndex(page)
83
+ onSnapToItem(real)
84
+ onScrollIndexChanged(real)
85
+ }
86
+ }
87
+
88
+ HorizontalPager(
89
+ state = pagerState,
90
+ modifier = modifier
91
+ .fillMaxWidth()
92
+ .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
93
+ contentPadding = contentPadding,
94
+ userScrollEnabled = scrollEnabled,
95
+ beyondViewportPageCount = if (loop) 1 else 0,
96
+ ) { page ->
97
+ val real = realIndex(page)
98
+
99
+ val pageOffset = ((pagerState.currentPage - page) + pagerState.currentPageOffsetFraction).absoluteValue
100
+
101
+ val scale by animateFloatAsState(
102
+ targetValue = if (pageOffset < 0.5f) 1f else inactiveSlideScale,
103
+ animationSpec = tween(150),
104
+ label = "carouselScale"
105
+ )
106
+ val alpha by animateFloatAsState(
107
+ targetValue = if (pageOffset < 0.5f) 1f else inactiveSlideOpacity,
108
+ animationSpec = tween(150),
109
+ label = "carouselAlpha"
110
+ )
111
+
112
+ Box(
113
+ modifier = Modifier
114
+ .graphicsLayer {
115
+ scaleX = scale
116
+ scaleY = scale
117
+ this.alpha = alpha
118
+ }
119
+ ) {
120
+ content(real)
121
+ }
122
+ }
123
+ }
@@ -0,0 +1,224 @@
1
+ package vn.momo.kits.components
2
+
3
+ import androidx.compose.animation.AnimatedVisibility
4
+ import androidx.compose.animation.core.animateFloatAsState
5
+ import androidx.compose.animation.core.tween
6
+ import androidx.compose.animation.expandVertically
7
+ import androidx.compose.animation.shrinkVertically
8
+ import androidx.compose.foundation.background
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
18
+ 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
24
+ import androidx.compose.ui.Alignment
25
+ import androidx.compose.ui.Modifier
26
+ import androidx.compose.ui.draw.clip
27
+ import androidx.compose.ui.draw.rotate
28
+ import androidx.compose.ui.graphics.Color
29
+ import androidx.compose.ui.text.TextStyle
30
+ import androidx.compose.ui.unit.dp
31
+ 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
37
+ import vn.momo.kits.modifier.activeOpacityClickable
38
+ import vn.momo.kits.modifier.conditional
39
+ import vn.momo.kits.modifier.setAutomationId
40
+
41
+ enum class CollapseTitleSize {
42
+ Small, Medium, Large
43
+ }
44
+
45
+ @Composable
46
+ fun Collapse(
47
+ title: String,
48
+ modifier: Modifier = Modifier,
49
+ description: String? = null,
50
+ image: String? = null,
51
+ imageSize: Int = 24,
52
+ subTitle: String? = null,
53
+ tagLabel: String? = null,
54
+ tagColor: TagColor = TagColor.Default,
55
+ showBorder: Boolean = false,
56
+ expandDefault: Boolean = false,
57
+ titleSize: CollapseTitleSize = CollapseTitleSize.Medium,
58
+ useBackgroundCollapseButton: Boolean = false,
59
+ backgroundColor: Color? = null,
60
+ titleColor: Color? = null,
61
+ onPress: ((isExpanded: Boolean) -> Unit)? = null,
62
+ accessibilityId: String? = null,
63
+ content: (@Composable () -> Unit)? = null,
64
+ ) {
65
+ val theme = AppTheme.current
66
+
67
+ var expanded by remember { mutableStateOf(expandDefault) }
68
+
69
+ val chevronRotation by animateFloatAsState(
70
+ targetValue = if (expanded) 180f else 0f,
71
+ animationSpec = tween(durationMillis = 300),
72
+ label = "chevronRotation"
73
+ )
74
+
75
+ val resolvedBackgroundColor = remember(backgroundColor, theme) {
76
+ backgroundColor ?: theme.colors.background.surface
77
+ }
78
+
79
+ val resolvedTitleStyle: TextStyle = remember(titleSize) {
80
+ when (titleSize) {
81
+ CollapseTitleSize.Small -> Typography.headerSSemibold
82
+ CollapseTitleSize.Medium -> Typography.headerDefaultBold
83
+ CollapseTitleSize.Large -> Typography.headerMBold
84
+ }
85
+ }
86
+
87
+ val borderShape = remember { RoundedCornerShape(Radius.S) }
88
+
89
+ val automationId = remember(accessibilityId, title) {
90
+ accessibilityId ?: "Collapse/$title"
91
+ }
92
+
93
+ Column(
94
+ modifier = modifier
95
+ .fillMaxWidth()
96
+ .clip(borderShape)
97
+ .background(resolvedBackgroundColor, shape = borderShape)
98
+ .conditional(showBorder) {
99
+ border(
100
+ width = 1.dp,
101
+ color = theme.colors.border.default,
102
+ shape = borderShape
103
+ )
104
+ }
105
+ .conditional(IsShowBaseLineDebug) {
106
+ border(1.dp, Colors.blue_03)
107
+ }
108
+ .setAutomationId(automationId)
109
+ ) {
110
+ Row(
111
+ modifier = Modifier
112
+ .fillMaxWidth()
113
+ .activeOpacityClickable {
114
+ onPress?.invoke(expanded)
115
+ expanded = !expanded
116
+ }
117
+ .padding(horizontal = Spacing.M, vertical = Spacing.S)
118
+ .setAutomationId("$automationId|touch"),
119
+ verticalAlignment = Alignment.Top
120
+ ) {
121
+ if (image != null) {
122
+ Image(
123
+ source = image,
124
+ modifier = Modifier
125
+ .size(imageSize.dp)
126
+ .clip(RoundedCornerShape(Radius.XS))
127
+ .setAutomationId("$automationId|img")
128
+ )
129
+ Spacer(modifier = Modifier.width(Spacing.S))
130
+ }
131
+
132
+ Column(modifier = Modifier.weight(1f)) {
133
+ Text(
134
+ text = title,
135
+ style = resolvedTitleStyle,
136
+ color = titleColor ?: theme.colors.text.default,
137
+ accessibilityId = "$automationId|text"
138
+ )
139
+ if (description != null) {
140
+ Text(
141
+ text = description,
142
+ style = Typography.bodyDefaultRegular,
143
+ color = theme.colors.text.secondary,
144
+ maxLines = 2,
145
+ accessibilityId = "$automationId|description-text"
146
+ )
147
+ }
148
+ }
149
+
150
+ val hasInfo = subTitle != null || tagLabel != null
151
+ if (hasInfo) {
152
+ Spacer(modifier = Modifier.width(Spacing.S))
153
+ Box(contentAlignment = Alignment.CenterEnd) {
154
+ if (subTitle != null) {
155
+ Text(
156
+ text = subTitle,
157
+ style = Typography.bodyDefaultRegular,
158
+ color = theme.colors.text.secondary,
159
+ maxLines = 1,
160
+ accessibilityId = "$automationId|sub-title-text"
161
+ )
162
+ } else if (tagLabel != null) {
163
+ Tag(
164
+ label = tagLabel,
165
+ color = tagColor
166
+ )
167
+ }
168
+ }
169
+ }
170
+
171
+ Spacer(modifier = Modifier.width(Spacing.S))
172
+ if (useBackgroundCollapseButton) {
173
+ Box(
174
+ modifier = Modifier
175
+ .size(24.dp)
176
+ .background(
177
+ color = theme.colors.background.tonal,
178
+ shape = RoundedCornerShape(Radius.M)
179
+ ),
180
+ contentAlignment = Alignment.Center
181
+ ) {
182
+ Icon(
183
+ source = "arrow_chevron_down_small",
184
+ size = 16.dp,
185
+ color = theme.colors.primary,
186
+ modifier = Modifier
187
+ .rotate(chevronRotation)
188
+ .setAutomationId("$automationId|icon")
189
+ )
190
+ }
191
+ } else {
192
+ Icon(
193
+ source = "arrow_chevron_down_small",
194
+ size = 24.dp,
195
+ color = theme.colors.text.default,
196
+ modifier = Modifier
197
+ .rotate(chevronRotation)
198
+ .setAutomationId("$automationId|icon")
199
+ )
200
+ }
201
+ }
202
+
203
+ if (content != null) {
204
+ AnimatedVisibility(
205
+ visible = expanded,
206
+ enter = expandVertically(animationSpec = tween(durationMillis = 300)),
207
+ exit = shrinkVertically(animationSpec = tween(durationMillis = 300))
208
+ ) {
209
+ Column(
210
+ modifier = Modifier
211
+ .fillMaxWidth()
212
+ .conditional(showBorder) {
213
+ border(
214
+ width = 1.dp,
215
+ color = theme.colors.border.default
216
+ )
217
+ }
218
+ ) {
219
+ content()
220
+ }
221
+ }
222
+ }
223
+ }
224
+ }
@@ -0,0 +1,108 @@
1
+ package vn.momo.kits.components
2
+
3
+ import androidx.compose.animation.core.FastOutSlowInEasing
4
+ import androidx.compose.animation.core.animateFloatAsState
5
+ import androidx.compose.animation.core.tween
6
+ import androidx.compose.foundation.background
7
+ import androidx.compose.foundation.border
8
+ import androidx.compose.foundation.layout.Box
9
+ import androidx.compose.foundation.layout.fillMaxWidth
10
+ import androidx.compose.foundation.layout.height
11
+ import androidx.compose.foundation.layout.size
12
+ import androidx.compose.foundation.shape.RoundedCornerShape
13
+ import androidx.compose.runtime.Composable
14
+ import androidx.compose.runtime.getValue
15
+ import androidx.compose.ui.Modifier
16
+ import androidx.compose.ui.draw.clip
17
+ import androidx.compose.ui.graphics.Color
18
+ import androidx.compose.ui.unit.dp
19
+ import vn.momo.kits.application.IsShowBaseLineDebug
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.modifier.conditional
24
+ import vn.momo.kits.platform.LottieAnimation
25
+
26
+ enum class LoaderType {
27
+ DOT, SPINNER
28
+ }
29
+
30
+ @Composable
31
+ fun Loader(
32
+ type: LoaderType = LoaderType.DOT,
33
+ tintColor: Color? = null,
34
+ modifier: Modifier = Modifier
35
+ ) {
36
+ when (type) {
37
+ LoaderType.DOT -> DotLoader(tintColor = tintColor, modifier = modifier)
38
+ LoaderType.SPINNER -> SpinnerLoader(tintColor = tintColor, modifier = modifier)
39
+ }
40
+ }
41
+
42
+ @Composable
43
+ fun DotLoader(
44
+ tintColor: Color? = null,
45
+ modifier: Modifier = Modifier
46
+ ) {
47
+ LottieAnimation(
48
+ path = "files/dot_loading",
49
+ tintColor = tintColor,
50
+ modifier = modifier
51
+ .size(width = 52.dp, height = 18.dp)
52
+ .conditional(IsShowBaseLineDebug) {
53
+ border(1.dp, Colors.blue_03)
54
+ }
55
+ )
56
+ }
57
+
58
+ @Composable
59
+ fun SpinnerLoader(
60
+ tintColor: Color? = null,
61
+ modifier: Modifier = Modifier
62
+ ) {
63
+ LottieAnimation(
64
+ path = "files/lottie_circle_loader",
65
+ tintColor = tintColor,
66
+ modifier = modifier
67
+ .size(24.dp)
68
+ .conditional(IsShowBaseLineDebug) {
69
+ border(1.dp, Colors.blue_03)
70
+ }
71
+ )
72
+ }
73
+
74
+ @Composable
75
+ fun ProgressBar(
76
+ percent: Float = 0f,
77
+ color: Color? = null,
78
+ modifier: Modifier = Modifier
79
+ ) {
80
+ val clampedPercent = percent.coerceIn(0f, 100f)
81
+ val animatedProgress by animateFloatAsState(
82
+ targetValue = clampedPercent / 100f,
83
+ animationSpec = tween(durationMillis = 200, easing = FastOutSlowInEasing),
84
+ label = "progressAnimation"
85
+ )
86
+
87
+ val trackColor = AppTheme.current.colors.background.default
88
+ val fillColor = color ?: AppTheme.current.colors.primary
89
+
90
+ Box(
91
+ modifier = modifier
92
+ .fillMaxWidth()
93
+ .height(4.dp)
94
+ .clip(RoundedCornerShape(Radius.XXS))
95
+ .background(trackColor)
96
+ .conditional(IsShowBaseLineDebug) {
97
+ border(1.dp, Colors.blue_03)
98
+ }
99
+ ) {
100
+ Box(
101
+ modifier = Modifier
102
+ .fillMaxWidth(animatedProgress)
103
+ .height(4.dp)
104
+ .clip(RoundedCornerShape(Radius.XXS))
105
+ .background(fillColor)
106
+ )
107
+ }
108
+ }
@@ -44,13 +44,13 @@ fun PopupPromotion(
44
44
  Image(
45
45
  source = source,
46
46
  modifier = Modifier.fillMaxWidth()
47
- .aspectRatio(0.5625f)
47
+ .aspectRatio(0.72f)
48
48
  .clickable(
49
49
  interactionSource = remember { MutableInteractionSource() },
50
50
  indication = null,
51
51
  onClick = onPress
52
52
  ),
53
- options = Options(alignment = Alignment.Center, contentScale = ContentScale.Fit)
53
+ options = Options(alignment = Alignment.Center, contentScale = ContentScale.FillBounds)
54
54
  ), null
55
55
  )
56
56
  Box(