@momo-kits/native-kits 0.300.4-debug → 0.300.4

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/package.json +1 -1
  2. package/build.gradle.kts +0 -13
  3. package/compose/build.gradle.kts +0 -197
  4. package/compose/build.gradle.kts.backup +0 -197
  5. package/compose/compose.podspec +0 -47
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -20
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -153
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1071
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -65
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -81
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -478
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -265
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -265
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -361
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -308
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -330
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -207
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -92
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -560
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -501
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -236
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -17
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -287
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -306
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -338
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -137
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -116
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -215
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -404
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -732
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -40
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -233
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -217
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -97
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -377
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -455
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -103
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -413
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HelpCenterRequest.kt +0 -37
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -192
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/ToolkitRequests.kt +0 -41
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -135
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -74
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -20
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
  123. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +0 -44
  124. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +0 -62
  125. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
  126. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  127. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -36
  128. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  129. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  130. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -217
  131. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -138
  132. package/gradle/libs.versions.toml +0 -68
  133. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  134. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  135. package/gradle.properties +0 -26
  136. package/gradlew +0 -252
  137. package/gradlew.bat +0 -94
  138. package/ios-demo/README.md +0 -120
  139. package/settings.gradle.kts +0 -64
@@ -1,308 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.*
6
- import androidx.compose.foundation.shape.CircleShape
7
- import androidx.compose.runtime.Composable
8
- import androidx.compose.runtime.remember
9
- import androidx.compose.ui.Alignment
10
- import androidx.compose.ui.Modifier
11
- import androidx.compose.ui.draw.clip
12
- import androidx.compose.ui.text.style.TextAlign
13
- import androidx.compose.ui.unit.dp
14
- import vn.momo.kits.application.IsShowBaseLineDebug
15
- import vn.momo.kits.const.*
16
- import vn.momo.kits.modifier.conditional
17
-
18
- data class ProgressInfoItem(
19
- val title: String,
20
- val description: String? = null,
21
- )
22
-
23
- enum class ProgressInfoSize { Small, Large }
24
-
25
- enum class ProgressInfoAlign { Left, Right, Center, Stretch }
26
-
27
- @Composable
28
- fun ProgressInfo(
29
- steps: List<ProgressInfoItem>,
30
- horizontal: Boolean = false,
31
- size: ProgressInfoSize = ProgressInfoSize.Large,
32
- useNumber: Boolean = false,
33
- align: ProgressInfoAlign = ProgressInfoAlign.Center,
34
- showTitle: Boolean = true,
35
- showDescription: Boolean = true,
36
- customIcon: String? = null,
37
- modifier: Modifier = Modifier,
38
- ) {
39
- if (horizontal) {
40
- ProgressInfoHorizontal(
41
- steps = steps,
42
- size = size,
43
- useNumber = useNumber,
44
- align = align,
45
- showTitle = showTitle,
46
- showDescription = showDescription,
47
- customIcon = customIcon,
48
- modifier = modifier,
49
- )
50
- } else {
51
- ProgressInfoVertical(
52
- steps = steps,
53
- size = size,
54
- useNumber = useNumber,
55
- showTitle = showTitle,
56
- showDescription = showDescription,
57
- customIcon = customIcon,
58
- modifier = modifier,
59
- )
60
- }
61
- }
62
-
63
- @Composable
64
- private fun ProgressInfoHorizontal(
65
- steps: List<ProgressInfoItem>,
66
- size: ProgressInfoSize,
67
- useNumber: Boolean,
68
- align: ProgressInfoAlign,
69
- showTitle: Boolean,
70
- showDescription: Boolean,
71
- customIcon: String?,
72
- modifier: Modifier = Modifier,
73
- ) {
74
- Row(
75
- modifier = modifier
76
- .fillMaxWidth()
77
- .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
78
- verticalAlignment = Alignment.Top,
79
- ) {
80
- steps.forEachIndexed { index, item ->
81
- val isFirst = index == 0
82
- val isLast = index == steps.lastIndex
83
-
84
- val columnAlign: Alignment.Horizontal = when (align) {
85
- ProgressInfoAlign.Left -> Alignment.Start
86
- ProgressInfoAlign.Right -> Alignment.End
87
- ProgressInfoAlign.Stretch -> when {
88
- isFirst -> Alignment.Start
89
- isLast -> Alignment.End
90
- else -> Alignment.CenterHorizontally
91
- }
92
- ProgressInfoAlign.Center -> Alignment.CenterHorizontally
93
- }
94
-
95
- val textAlign: TextAlign = when (align) {
96
- ProgressInfoAlign.Left -> TextAlign.Left
97
- ProgressInfoAlign.Right -> TextAlign.Right
98
- ProgressInfoAlign.Stretch -> when {
99
- isFirst -> TextAlign.Left
100
- isLast -> TextAlign.Right
101
- else -> TextAlign.Center
102
- }
103
- ProgressInfoAlign.Center -> TextAlign.Center
104
- }
105
-
106
- val endPadding = if (!isLast &&
107
- align != ProgressInfoAlign.Center &&
108
- align != ProgressInfoAlign.Stretch
109
- ) Spacing.XS else 0.dp
110
-
111
- val hideLineLeft = align == ProgressInfoAlign.Left ||
112
- (align == ProgressInfoAlign.Stretch && isFirst)
113
- val hideLineRight = align == ProgressInfoAlign.Right ||
114
- (align == ProgressInfoAlign.Stretch && isLast)
115
-
116
- Column(
117
- modifier = Modifier
118
- .weight(1f)
119
- .padding(end = endPadding),
120
- horizontalAlignment = columnAlign,
121
- ) {
122
- Row(
123
- modifier = Modifier.fillMaxWidth(),
124
- verticalAlignment = Alignment.CenterVertically,
125
- ) {
126
- if (!hideLineLeft) {
127
- ProgressInfoHorizontalLine(modifier = Modifier.weight(1f))
128
- }
129
- ProgressInfoStepIcon(
130
- index = index,
131
- size = size,
132
- useNumber = useNumber,
133
- customIcon = customIcon,
134
- modifier = Modifier.padding(vertical = Spacing.XS),
135
- )
136
- if (!hideLineRight) {
137
- ProgressInfoHorizontalLine(modifier = Modifier.weight(1f))
138
- }
139
- }
140
-
141
- if (showTitle && item.title.isNotEmpty()) {
142
- Text(
143
- text = item.title,
144
- style = Typography.headerXsSemibold,
145
- textAlign = textAlign,
146
- modifier = Modifier
147
- .fillMaxWidth()
148
- .padding(bottom = Spacing.XS),
149
- )
150
- }
151
-
152
- val desc = item.description
153
- if (showDescription && !desc.isNullOrEmpty()) {
154
- Text(
155
- text = desc,
156
- style = Typography.descriptionDefaultRegular,
157
- color = Colors.black_12,
158
- textAlign = textAlign,
159
- modifier = Modifier.fillMaxWidth(),
160
- )
161
- }
162
- }
163
- }
164
- }
165
- }
166
-
167
-
168
- @Composable
169
- private fun ProgressInfoVertical(
170
- steps: List<ProgressInfoItem>,
171
- size: ProgressInfoSize,
172
- useNumber: Boolean,
173
- showTitle: Boolean,
174
- showDescription: Boolean,
175
- customIcon: String?,
176
- modifier: Modifier = Modifier,
177
- ) {
178
- val theme = AppTheme.current
179
- val lineColor = remember(theme) { theme.colors.primary.copy(alpha = 0.2f) }
180
-
181
- Column(
182
- modifier = modifier
183
- .fillMaxWidth()
184
- .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
185
- ) {
186
- steps.forEachIndexed { index, item ->
187
- val isLast = index == steps.lastIndex
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.
191
- Row(
192
- modifier = Modifier
193
- .fillMaxWidth()
194
- .height(IntrinsicSize.Min),
195
- ) {
196
- Column(
197
- modifier = Modifier
198
- .fillMaxHeight()
199
- .heightIn(min = if (isLast) 40.dp else 48.dp),
200
- horizontalAlignment = Alignment.CenterHorizontally,
201
- ) {
202
- ProgressInfoStepIcon(
203
- index = index,
204
- size = size,
205
- useNumber = useNumber,
206
- customIcon = customIcon,
207
- )
208
- if (!isLast) {
209
- Spacer(
210
- modifier = Modifier
211
- .width(2.dp)
212
- .weight(1f)
213
- .background(lineColor),
214
- )
215
- }
216
- }
217
-
218
- // Right column: title + description
219
- Column(
220
- modifier = Modifier
221
- .weight(1f)
222
- .padding(
223
- end = Spacing.S,
224
- bottom = if (isLast) 0.dp else Spacing.S,
225
- ),
226
- ) {
227
- if (showTitle && item.title.isNotEmpty()) {
228
- Text(
229
- text = item.title,
230
- style = Typography.headerXsSemibold,
231
- maxLines = 2,
232
- modifier = Modifier
233
- .fillMaxWidth()
234
- .padding(end = Spacing.S),
235
- )
236
- }
237
-
238
- val desc = item.description
239
- if (showDescription && !desc.isNullOrEmpty()) {
240
- Text(
241
- text = desc,
242
- style = Typography.descriptionDefaultRegular,
243
- color = Colors.black_12,
244
- )
245
- }
246
- }
247
- }
248
- }
249
- }
250
- }
251
-
252
- @Composable
253
- private fun ProgressInfoStepIcon(
254
- index: Int,
255
- size: ProgressInfoSize,
256
- useNumber: Boolean,
257
- customIcon: String?,
258
- modifier: Modifier = Modifier,
259
- ) {
260
- val containerSize = scaleSize(if (size == ProgressInfoSize.Small) 16f else 24f).dp
261
- val dotSize = scaleSize(if (size == ProgressInfoSize.Small) 6f else 8f).dp
262
- val iconSize = scaleSize(if (size == ProgressInfoSize.Small) 12f else 16f).dp
263
-
264
- Box(
265
- contentAlignment = Alignment.Center,
266
- modifier = modifier
267
- .size(containerSize)
268
- .clip(CircleShape)
269
- .background(Colors.pink_08)
270
- .border(width = 2.dp, color = Colors.pink_08, shape = CircleShape)
271
- .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
272
- ) {
273
- when {
274
- useNumber -> {
275
- Text(
276
- text = (index + 1).toString(),
277
- style = Typography.headerXsSemibold,
278
- color = Colors.pink_MoMo_Branding,
279
- textAlign = TextAlign.Center,
280
- )
281
- }
282
- !customIcon.isNullOrEmpty() -> {
283
- Icon(
284
- source = customIcon,
285
- size = iconSize,
286
- color = Colors.pink_MoMo_Branding,
287
- )
288
- }
289
- else -> {
290
- Box(
291
- modifier = Modifier
292
- .size(dotSize)
293
- .clip(CircleShape)
294
- .background(Colors.pink_MoMo_Branding),
295
- )
296
- }
297
- }
298
- }
299
- }
300
-
301
- @Composable
302
- private fun ProgressInfoHorizontalLine(modifier: Modifier = Modifier) {
303
- Box(
304
- modifier = modifier
305
- .height(2.dp)
306
- .background(Colors.pink_08),
307
- )
308
- }
@@ -1,59 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.border
4
- import androidx.compose.foundation.layout.*
5
- import androidx.compose.foundation.shape.RoundedCornerShape
6
- import androidx.compose.runtime.Composable
7
- import androidx.compose.ui.Alignment
8
- import androidx.compose.ui.Modifier
9
- import androidx.compose.ui.draw.clip
10
- import androidx.compose.ui.unit.dp
11
- import vn.momo.kits.application.IsShowBaseLineDebug
12
- import vn.momo.kits.const.*
13
- import vn.momo.kits.modifier.activeOpacityClickable
14
- import vn.momo.kits.modifier.conditional
15
-
16
- @Composable
17
- fun Radio(
18
- value: Any,
19
- groupValue: Any,
20
- disabled: Boolean = false,
21
- onChange: () -> Unit = {},
22
- label: String = "",
23
- modifier: Modifier = Modifier,
24
- ) {
25
- val selected = value == groupValue
26
- val borderColor = when {
27
- disabled && selected -> AppTheme.current.colors.background.tonal
28
- disabled -> AppTheme.current.colors.text.disable
29
- selected -> AppTheme.current.colors.primary
30
- else -> AppTheme.current.colors.text.default
31
- }
32
- val borderWidth = if (selected) 6.dp else 2.dp
33
-
34
- Row(
35
- modifier = modifier.activeOpacityClickable(
36
- onClick = onChange,
37
- enabled = !disabled,
38
- ),
39
- horizontalArrangement = Arrangement.Center,
40
- verticalAlignment = Alignment.CenterVertically,
41
- ) {
42
- Box(
43
- modifier = Modifier
44
- .padding(end = if (label.isEmpty()) 0.dp else Spacing.XS)
45
- .border(borderWidth, borderColor, RoundedCornerShape(Radius.M))
46
- .conditional(IsShowBaseLineDebug) {
47
- border(1.dp, Colors.blue_03)
48
- }
49
- .clip(RoundedCornerShape(Radius.M))
50
- .size(20.dp)
51
- )
52
- if (label.isNotEmpty()) {
53
- Text(
54
- style = Typography.descriptionDefaultRegular,
55
- text = label,
56
- )
57
- }
58
- }
59
- }
@@ -1,87 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.border
4
- import androidx.compose.foundation.layout.Arrangement
5
- import androidx.compose.foundation.layout.Row
6
- import androidx.compose.runtime.Composable
7
- import androidx.compose.runtime.Immutable
8
- import androidx.compose.runtime.remember
9
- import androidx.compose.ui.Alignment
10
- import androidx.compose.ui.Modifier
11
- import androidx.compose.ui.unit.dp
12
- import vn.momo.kits.application.IsShowBaseLineDebug
13
- import vn.momo.kits.const.Colors
14
- import vn.momo.kits.const.scaleSize
15
- import vn.momo.kits.modifier.activeOpacityClickable
16
- import vn.momo.kits.modifier.conditional
17
-
18
- @Composable
19
- fun Rating(
20
- modifier: Modifier = Modifier,
21
- numOfStars: Int,
22
- rating: Float,
23
- onRatingChange: ((Int) -> Unit)? = null,
24
- size: RatingSize = RatingSize.LARGE,
25
- ) {
26
- val iconSize = remember(size) {
27
- when (size) {
28
- RatingSize.SMALL -> RatingDefaults.Small.iconSize
29
- RatingSize.MEDIUM -> RatingDefaults.Medium.iconSize
30
- RatingSize.LARGE -> RatingDefaults.Large.iconSize
31
- }
32
- }
33
-
34
- Row(
35
- modifier = modifier
36
- .conditional(IsShowBaseLineDebug) {
37
- border(1.dp, Colors.blue_03)
38
- },
39
- verticalAlignment = Alignment.CenterVertically,
40
- horizontalArrangement = Arrangement.spacedBy(2.dp)
41
- ) {
42
- for (index in 0 until numOfStars) {
43
- val starIcon = remember(rating, index) {
44
- when {
45
- index < rating.toInt() -> "reaction_star_full"
46
- index == rating.toInt() && rating % 1 != 0f -> "reaction_star_half"
47
- else -> "reaction_star_non"
48
- }
49
- }
50
- val starColor = remember(rating, index) {
51
- when {
52
- index < rating.toInt() -> Colors.yellow_03
53
- index == rating.toInt() && rating % 1 != 0f -> Colors.yellow_03
54
- else -> Colors.black_07
55
- }
56
- }
57
-
58
- val starModifier = if (onRatingChange != null) {
59
- Modifier.activeOpacityClickable {
60
- onRatingChange(index + 1)
61
- }
62
- } else {
63
- Modifier
64
- }
65
-
66
- Icon(
67
- source = starIcon,
68
- size = scaleSize(iconSize).dp,
69
- color = starColor,
70
- modifier = starModifier,
71
- )
72
- }
73
- }
74
- }
75
-
76
- enum class RatingSize { SMALL, MEDIUM, LARGE }
77
-
78
- object RatingDefaults {
79
- @Immutable
80
- data class Dimensions(
81
- val iconSize: Float,
82
- )
83
-
84
- val Small = Dimensions(iconSize = 16f)
85
- val Medium = Dimensions(iconSize = 20f)
86
- val Large = Dimensions(iconSize = 24f)
87
- }
@@ -1,21 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.runtime.Composable
4
- import androidx.compose.runtime.CompositionLocalProvider
5
- import vn.momo.kits.application.ScaleSizeMaxRate
6
-
7
- @Deprecated(
8
- "Max font scale is fixed at MAX_FONT_SCALE (1.5); this override is no longer applied. Remove the wrapper.",
9
- ReplaceWith("content()"),
10
- )
11
- @Composable
12
- fun ScaleSizeScope(
13
- scaleSizeMaxRate: Float? = null,
14
- content: @Composable () -> Unit
15
- ) {
16
- CompositionLocalProvider(
17
- ScaleSizeMaxRate provides scaleSizeMaxRate,
18
- ) {
19
- content()
20
- }
21
- }
@@ -1,90 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import vn.momo.kits.modifier.InternalApi
4
-
5
- import androidx.compose.animation.core.*
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.BoxWithConstraints
10
- import androidx.compose.foundation.layout.fillMaxSize
11
- import androidx.compose.runtime.Composable
12
- import androidx.compose.runtime.remember
13
- import androidx.compose.ui.Modifier
14
- import androidx.compose.ui.draw.drawBehind
15
- import androidx.compose.ui.geometry.Offset
16
- import androidx.compose.ui.graphics.Brush
17
- import androidx.compose.ui.unit.dp
18
- import vn.momo.kits.application.IsShowBaseLineDebug
19
- import vn.momo.kits.const.Colors
20
- import vn.momo.kits.modifier.conditional
21
-
22
- private val shimmerColors = listOf(
23
- Colors.black_05,
24
- Colors.black_03,
25
- Colors.black_05,
26
- )
27
- private const val SHADOW_BRUSH_PERCENTAGE = 0.6f
28
- private const val DEFAULT_DURATION_MILLIS = 1000
29
-
30
- @Composable
31
- fun Skeleton() {
32
- BoxWithConstraints(modifier = Modifier.fillMaxSize()) {
33
- val maxWidthValue = remember(maxWidth) { maxWidth.value.toInt() }
34
-
35
- Box(
36
- modifier = Modifier
37
- .fillMaxSize()
38
- .background(Colors.black_05)
39
- .conditional(IsShowBaseLineDebug) {
40
- border(1.dp, Colors.blue_03)
41
- }
42
- .shimmerLoadingAnimation(maxWidth = maxWidthValue)
43
- )
44
- }
45
- }
46
-
47
- @Composable
48
- @InternalApi
49
- fun Modifier.shimmerLoadingAnimation(
50
- maxWidth: Int,
51
- angleOfAxisY: Float = 0f,
52
- durationMillis: Int = DEFAULT_DURATION_MILLIS,
53
- ): Modifier {
54
- // Memoize calculations to avoid repeated computations
55
- val widthOfShadowBrush = remember(maxWidth) {
56
- (maxWidth * SHADOW_BRUSH_PERCENTAGE).toInt()
57
- }
58
-
59
- val animationTarget = remember(durationMillis, widthOfShadowBrush) {
60
- (durationMillis + widthOfShadowBrush).toFloat()
61
- }
62
-
63
- val transition = rememberInfiniteTransition(label = "shimmer")
64
- val translateAnimation = transition.animateFloat(
65
- initialValue = 0f,
66
- targetValue = animationTarget,
67
- animationSpec = infiniteRepeatable(
68
- animation = tween(
69
- durationMillis = durationMillis,
70
- easing = LinearEasing,
71
- ),
72
- repeatMode = RepeatMode.Restart,
73
- ),
74
- label = "shimmerTranslate"
75
- )
76
-
77
- return drawBehind {
78
- // Memoize brush creation by using remember in the calling composable
79
- val startX = translateAnimation.value - widthOfShadowBrush
80
- val endX = translateAnimation.value
81
-
82
- drawRect(
83
- brush = Brush.linearGradient(
84
- colors = shimmerColors,
85
- start = Offset(x = startX, y = 0f),
86
- end = Offset(x = endX, y = angleOfAxisY)
87
- )
88
- )
89
- }
90
- }