@momo-kits/native-kits 0.169.8-beta.3-debug → 0.169.8-beta.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 (154) hide show
  1. package/ios/Input/InputSearch.swift +23 -6
  2. package/ios/Layout/HeaderLayout.swift +60 -0
  3. package/ios/Navigation/BottomTab/BottomTabBar.swift +0 -9
  4. package/ios/Navigation/Component/Header.swift +25 -15
  5. package/ios/Navigation/Component/HeaderJourney.swift +2 -1
  6. package/ios/Navigation/Component/HeaderLocation.swift +2 -1
  7. package/ios/Navigation/Component/HeaderRight.swift +13 -8
  8. package/ios/Navigation/Component/HeaderUser.swift +2 -1
  9. package/ios/Navigation/Navigation.swift +6 -26
  10. package/ios/Navigation/StackScreen.swift +30 -26
  11. package/ios/native-kits.podspec +1 -1
  12. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  13. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +11 -2
  14. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +1 -13
  15. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +11 -0
  16. package/package.json +1 -1
  17. package/build.gradle.kts +0 -11
  18. package/compose/build.gradle.kts +0 -198
  19. package/compose/compose.podspec +0 -47
  20. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  21. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  22. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  23. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  24. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -154
  25. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +0 -17
  26. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1067
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -267
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -482
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -224
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -195
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -473
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -113
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -263
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -228
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -265
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -183
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -40
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -82
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -39
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -363
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -307
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -88
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -306
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -457
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -205
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -89
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -542
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -120
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -201
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -210
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -12
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -292
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +0 -184
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -316
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -397
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -153
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -113
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -422
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -727
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -242
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -400
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -100
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -97
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -207
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +0 -132
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -167
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -456
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -105
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -399
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -204
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -114
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -76
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +0 -7
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -22
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
  139. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
  140. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  141. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  142. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  143. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  144. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -218
  145. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +0 -48
  146. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -144
  147. package/gradle/libs.versions.toml +0 -67
  148. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  149. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  150. package/gradle.properties +0 -24
  151. package/gradlew +0 -252
  152. package/gradlew.bat +0 -94
  153. package/ios-demo/README.md +0 -120
  154. package/settings.gradle.kts +0 -64
@@ -1,307 +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 and shrink with its text.
190
- Row(
191
- modifier = Modifier
192
- .fillMaxWidth()
193
- .height(IntrinsicSize.Min),
194
- ) {
195
- Column(
196
- modifier = Modifier
197
- .fillMaxHeight()
198
- .heightIn(min = if (isLast) 40.dp else 48.dp),
199
- horizontalAlignment = Alignment.CenterHorizontally,
200
- ) {
201
- ProgressInfoStepIcon(
202
- index = index,
203
- size = size,
204
- useNumber = useNumber,
205
- customIcon = customIcon,
206
- )
207
- if (!isLast) {
208
- Spacer(
209
- modifier = Modifier
210
- .width(2.dp)
211
- .weight(1f)
212
- .background(lineColor),
213
- )
214
- }
215
- }
216
-
217
- // Right column: title + description
218
- Column(
219
- modifier = Modifier
220
- .weight(1f)
221
- .padding(
222
- end = Spacing.S,
223
- bottom = if (isLast) 0.dp else Spacing.S,
224
- ),
225
- ) {
226
- if (showTitle && item.title.isNotEmpty()) {
227
- Text(
228
- text = item.title,
229
- style = Typography.headerXsSemibold,
230
- maxLines = 2,
231
- modifier = Modifier
232
- .fillMaxWidth()
233
- .padding(end = Spacing.S),
234
- )
235
- }
236
-
237
- val desc = item.description
238
- if (showDescription && !desc.isNullOrEmpty()) {
239
- Text(
240
- text = desc,
241
- style = Typography.descriptionDefaultRegular,
242
- color = Colors.black_12,
243
- )
244
- }
245
- }
246
- }
247
- }
248
- }
249
- }
250
-
251
- @Composable
252
- private fun ProgressInfoStepIcon(
253
- index: Int,
254
- size: ProgressInfoSize,
255
- useNumber: Boolean,
256
- customIcon: String?,
257
- modifier: Modifier = Modifier,
258
- ) {
259
- val containerSize = scaleSize(if (size == ProgressInfoSize.Small) 16f else 24f).dp
260
- val dotSize = scaleSize(if (size == ProgressInfoSize.Small) 6f else 8f).dp
261
- val iconSize = scaleSize(if (size == ProgressInfoSize.Small) 12f else 16f).dp
262
-
263
- Box(
264
- contentAlignment = Alignment.Center,
265
- modifier = modifier
266
- .size(containerSize)
267
- .clip(CircleShape)
268
- .background(Colors.pink_08)
269
- .border(width = 2.dp, color = Colors.pink_08, shape = CircleShape)
270
- .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
271
- ) {
272
- when {
273
- useNumber -> {
274
- Text(
275
- text = (index + 1).toString(),
276
- style = Typography.headerXsSemibold,
277
- color = Colors.pink_MoMo_Branding,
278
- textAlign = TextAlign.Center,
279
- )
280
- }
281
- !customIcon.isNullOrEmpty() -> {
282
- Icon(
283
- source = customIcon,
284
- size = iconSize,
285
- color = Colors.pink_MoMo_Branding,
286
- )
287
- }
288
- else -> {
289
- Box(
290
- modifier = Modifier
291
- .size(dotSize)
292
- .clip(CircleShape)
293
- .background(Colors.pink_MoMo_Branding),
294
- )
295
- }
296
- }
297
- }
298
- }
299
-
300
- @Composable
301
- private fun ProgressInfoHorizontalLine(modifier: Modifier = Modifier) {
302
- Box(
303
- modifier = modifier
304
- .height(2.dp)
305
- .background(Colors.pink_08),
306
- )
307
- }
@@ -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 androidx.compose.runtime.remember
6
- import vn.momo.kits.application.LocalContext
7
- import vn.momo.kits.application.MiniAppContext
8
-
9
- // Caps scaleSize() for the subtree at size × scaleSizeMaxRate through MiniAppContext.scaleSizeMaxRate
10
- // (RN ScaleSizeProvider); the nearest scope wins and null lifts the cap.
11
- @Composable
12
- fun ScaleSizeScope(
13
- scaleSizeMaxRate: Float? = null,
14
- content: @Composable () -> Unit
15
- ) {
16
- val context = LocalContext.current
17
- val scoped = remember(context, scaleSizeMaxRate) {
18
- (context ?: MiniAppContext()).copy(scaleSizeMaxRate = scaleSizeMaxRate)
19
- }
20
- CompositionLocalProvider(LocalContext provides scoped, content = content)
21
- }
@@ -1,88 +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
- val widthOfShadowBrush = remember(maxWidth) {
55
- (maxWidth * SHADOW_BRUSH_PERCENTAGE).toInt()
56
- }
57
-
58
- val animationTarget = remember(durationMillis, widthOfShadowBrush) {
59
- (durationMillis + widthOfShadowBrush).toFloat()
60
- }
61
-
62
- val transition = rememberInfiniteTransition(label = "shimmer")
63
- val translateAnimation = transition.animateFloat(
64
- initialValue = 0f,
65
- targetValue = animationTarget,
66
- animationSpec = infiniteRepeatable(
67
- animation = tween(
68
- durationMillis = durationMillis,
69
- easing = LinearEasing,
70
- ),
71
- repeatMode = RepeatMode.Restart,
72
- ),
73
- label = "shimmerTranslate"
74
- )
75
-
76
- return drawBehind {
77
- val startX = translateAnimation.value - widthOfShadowBrush
78
- val endX = translateAnimation.value
79
-
80
- drawRect(
81
- brush = Brush.linearGradient(
82
- colors = shimmerColors,
83
- start = Offset(x = startX, y = 0f),
84
- end = Offset(x = endX, y = angleOfAxisY)
85
- )
86
- )
87
- }
88
- }