@momo-kits/native-kits 0.157.7 → 0.157.8-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.
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +180 -0
- package/compose/build.gradle.kts.backup +180 -0
- package/compose/compose.podspec +54 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +117 -0
- package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
- package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +57 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +107 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +201 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +222 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +305 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +720 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +121 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +405 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +85 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +340 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +198 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +357 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +123 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +94 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +136 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +224 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +148 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +116 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +448 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +172 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +255 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +231 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +233 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +254 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +241 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +364 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +352 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +103 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +70 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +348 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +256 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +494 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +131 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +215 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +531 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +130 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +214 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +590 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +177 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +192 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +205 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +239 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +191 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +285 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +68 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +14 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +253 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +99 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +164 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +333 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +552 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +162 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +243 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +187 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +279 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +80 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +370 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +167 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +46 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +62 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +88 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +161 -0
- package/gradle/libs.versions.toml +57 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +26 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/package.json +1 -1
- package/settings.gradle.kts +52 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
package vn.momo.kits.components
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.background
|
|
4
|
+
import androidx.compose.foundation.border
|
|
5
|
+
import androidx.compose.foundation.clickable
|
|
6
|
+
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
7
|
+
import androidx.compose.foundation.layout.Box
|
|
8
|
+
import androidx.compose.foundation.layout.Column
|
|
9
|
+
import androidx.compose.foundation.layout.aspectRatio
|
|
10
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
11
|
+
import androidx.compose.foundation.layout.height
|
|
12
|
+
import androidx.compose.foundation.layout.padding
|
|
13
|
+
import androidx.compose.foundation.layout.width
|
|
14
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
15
|
+
import androidx.compose.runtime.Composable
|
|
16
|
+
import androidx.compose.runtime.remember
|
|
17
|
+
import androidx.compose.ui.Alignment
|
|
18
|
+
import androidx.compose.ui.Modifier
|
|
19
|
+
import androidx.compose.ui.draw.clip
|
|
20
|
+
import androidx.compose.ui.layout.ContentScale
|
|
21
|
+
import androidx.compose.ui.unit.dp
|
|
22
|
+
import vn.momo.kits.const.AppTheme
|
|
23
|
+
import vn.momo.kits.const.Radius
|
|
24
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
25
|
+
import vn.momo.kits.const.Colors
|
|
26
|
+
import vn.momo.kits.const.Spacing
|
|
27
|
+
import vn.momo.kits.modifier.conditional
|
|
28
|
+
import vn.momo.kits.modifier.setAutomationId
|
|
29
|
+
import vn.momo.kits.utils.ifNotNull
|
|
30
|
+
|
|
31
|
+
@Composable
|
|
32
|
+
fun PopupPromotion(
|
|
33
|
+
source: String = "",
|
|
34
|
+
onPress: (() -> Unit) = {},
|
|
35
|
+
onClose: (() -> Unit) = {},
|
|
36
|
+
) {
|
|
37
|
+
Column(Modifier
|
|
38
|
+
.padding(horizontal = Spacing.M)
|
|
39
|
+
.conditional(IsShowBaseLineDebug) {
|
|
40
|
+
border(1.dp, Colors.blue_03)
|
|
41
|
+
}
|
|
42
|
+
.setAutomationId("popup_notify")) {
|
|
43
|
+
source.ifNotNull(
|
|
44
|
+
Image(
|
|
45
|
+
source = source,
|
|
46
|
+
modifier = Modifier.fillMaxWidth()
|
|
47
|
+
.aspectRatio(0.72f)
|
|
48
|
+
.clickable(
|
|
49
|
+
interactionSource = remember { MutableInteractionSource() },
|
|
50
|
+
indication = null,
|
|
51
|
+
onClick = onPress
|
|
52
|
+
),
|
|
53
|
+
options = Options(alignment = Alignment.Center, contentScale = ContentScale.FillBounds)
|
|
54
|
+
), null
|
|
55
|
+
)
|
|
56
|
+
Box(
|
|
57
|
+
modifier = Modifier
|
|
58
|
+
.padding(top = Spacing.S)
|
|
59
|
+
.fillMaxWidth()
|
|
60
|
+
.width(40.dp)
|
|
61
|
+
.height(40.dp),
|
|
62
|
+
contentAlignment = Alignment.Center
|
|
63
|
+
) {
|
|
64
|
+
Box(
|
|
65
|
+
modifier = Modifier
|
|
66
|
+
.width(40.dp)
|
|
67
|
+
.height(40.dp)
|
|
68
|
+
.clickable(
|
|
69
|
+
interactionSource = remember { MutableInteractionSource() },
|
|
70
|
+
indication = null,
|
|
71
|
+
onClick = onClose
|
|
72
|
+
),
|
|
73
|
+
contentAlignment = Alignment.Center
|
|
74
|
+
) {
|
|
75
|
+
Box(
|
|
76
|
+
Modifier
|
|
77
|
+
.width(22.dp)
|
|
78
|
+
.height(22.dp)
|
|
79
|
+
.background(
|
|
80
|
+
color = AppTheme.current.colors.text.default,
|
|
81
|
+
shape = RoundedCornerShape(Radius.M)
|
|
82
|
+
)
|
|
83
|
+
.border(
|
|
84
|
+
width = 2.dp,
|
|
85
|
+
color = AppTheme.current.colors.background.surface,
|
|
86
|
+
shape = RoundedCornerShape(Radius.M)
|
|
87
|
+
)
|
|
88
|
+
.clip(RoundedCornerShape(100))
|
|
89
|
+
,
|
|
90
|
+
contentAlignment = Alignment.Center
|
|
91
|
+
) {
|
|
92
|
+
Icon(
|
|
93
|
+
source = "navigation_close",
|
|
94
|
+
color = AppTheme.current.colors.background.surface,
|
|
95
|
+
size = 16.dp,
|
|
96
|
+
modifier = Modifier.setAutomationId("ic_popup_close")
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,338 @@
|
|
|
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.mutableFloatStateOf
|
|
9
|
+
import androidx.compose.runtime.remember
|
|
10
|
+
import androidx.compose.ui.Alignment
|
|
11
|
+
import androidx.compose.ui.Modifier
|
|
12
|
+
import androidx.compose.ui.draw.clip
|
|
13
|
+
import androidx.compose.ui.layout.onGloballyPositioned
|
|
14
|
+
import androidx.compose.ui.platform.LocalDensity
|
|
15
|
+
import androidx.compose.ui.text.style.TextAlign
|
|
16
|
+
import androidx.compose.ui.unit.dp
|
|
17
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
18
|
+
import vn.momo.kits.const.*
|
|
19
|
+
import vn.momo.kits.modifier.conditional
|
|
20
|
+
|
|
21
|
+
// ─── Data model ───────────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
data class ProgressInfoItem(
|
|
24
|
+
val title: String,
|
|
25
|
+
val description: String? = null,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
enum class ProgressInfoSize { Small, Large }
|
|
29
|
+
|
|
30
|
+
enum class ProgressInfoAlign { Left, Right, Center, Stretch }
|
|
31
|
+
|
|
32
|
+
// ─── Public entry-point ───────────────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Display-only step progress indicator migrated from the React Native ProgressInfo component.
|
|
36
|
+
*
|
|
37
|
+
* @param steps Ordered list of steps; each has a [ProgressInfoItem.title] and an
|
|
38
|
+
* optional [ProgressInfoItem.description].
|
|
39
|
+
* @param horizontal When `true` renders steps in a horizontal row with connector lines;
|
|
40
|
+
* when `false` (default) renders a vertical column.
|
|
41
|
+
* @param size Icon diameter: [ProgressInfoSize.Small] = 16 dp,
|
|
42
|
+
* [ProgressInfoSize.Large] = 24 dp (default).
|
|
43
|
+
* @param useNumber Show the 1-based step index inside the icon instead of the default dot.
|
|
44
|
+
* @param align Alignment of icon + text for the horizontal variant.
|
|
45
|
+
* @param showTitle Whether step titles are rendered (default `true`).
|
|
46
|
+
* @param showDescription Whether step descriptions are rendered (default `true`).
|
|
47
|
+
* @param customIcon Icon source key rendered inside each step circle (overrides the dot;
|
|
48
|
+
* itself overridden by [useNumber]).
|
|
49
|
+
* @param modifier Modifier applied to the root layout.
|
|
50
|
+
*/
|
|
51
|
+
@Composable
|
|
52
|
+
fun ProgressInfo(
|
|
53
|
+
steps: List<ProgressInfoItem>,
|
|
54
|
+
horizontal: Boolean = false,
|
|
55
|
+
size: ProgressInfoSize = ProgressInfoSize.Large,
|
|
56
|
+
useNumber: Boolean = false,
|
|
57
|
+
align: ProgressInfoAlign = ProgressInfoAlign.Center,
|
|
58
|
+
showTitle: Boolean = true,
|
|
59
|
+
showDescription: Boolean = true,
|
|
60
|
+
customIcon: String? = null,
|
|
61
|
+
modifier: Modifier = Modifier,
|
|
62
|
+
) {
|
|
63
|
+
if (horizontal) {
|
|
64
|
+
ProgressInfoHorizontal(
|
|
65
|
+
steps = steps,
|
|
66
|
+
size = size,
|
|
67
|
+
useNumber = useNumber,
|
|
68
|
+
align = align,
|
|
69
|
+
showTitle = showTitle,
|
|
70
|
+
showDescription = showDescription,
|
|
71
|
+
customIcon = customIcon,
|
|
72
|
+
modifier = modifier,
|
|
73
|
+
)
|
|
74
|
+
} else {
|
|
75
|
+
ProgressInfoVertical(
|
|
76
|
+
steps = steps,
|
|
77
|
+
size = size,
|
|
78
|
+
useNumber = useNumber,
|
|
79
|
+
showTitle = showTitle,
|
|
80
|
+
showDescription = showDescription,
|
|
81
|
+
customIcon = customIcon,
|
|
82
|
+
modifier = modifier,
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ─── Horizontal variant ───────────────────────────────────────────────────────
|
|
88
|
+
|
|
89
|
+
@Composable
|
|
90
|
+
private fun ProgressInfoHorizontal(
|
|
91
|
+
steps: List<ProgressInfoItem>,
|
|
92
|
+
size: ProgressInfoSize,
|
|
93
|
+
useNumber: Boolean,
|
|
94
|
+
align: ProgressInfoAlign,
|
|
95
|
+
showTitle: Boolean,
|
|
96
|
+
showDescription: Boolean,
|
|
97
|
+
customIcon: String?,
|
|
98
|
+
modifier: Modifier = Modifier,
|
|
99
|
+
) {
|
|
100
|
+
Row(
|
|
101
|
+
modifier = modifier
|
|
102
|
+
.fillMaxWidth()
|
|
103
|
+
.conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
|
|
104
|
+
verticalAlignment = Alignment.Top,
|
|
105
|
+
) {
|
|
106
|
+
steps.forEachIndexed { index, item ->
|
|
107
|
+
val isFirst = index == 0
|
|
108
|
+
val isLast = index == steps.lastIndex
|
|
109
|
+
|
|
110
|
+
val columnAlign: Alignment.Horizontal = when (align) {
|
|
111
|
+
ProgressInfoAlign.Left -> Alignment.Start
|
|
112
|
+
ProgressInfoAlign.Right -> Alignment.End
|
|
113
|
+
ProgressInfoAlign.Stretch -> when {
|
|
114
|
+
isFirst -> Alignment.Start
|
|
115
|
+
isLast -> Alignment.End
|
|
116
|
+
else -> Alignment.CenterHorizontally
|
|
117
|
+
}
|
|
118
|
+
ProgressInfoAlign.Center -> Alignment.CenterHorizontally
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
val textAlign: TextAlign = when (align) {
|
|
122
|
+
ProgressInfoAlign.Left -> TextAlign.Left
|
|
123
|
+
ProgressInfoAlign.Right -> TextAlign.Right
|
|
124
|
+
ProgressInfoAlign.Stretch -> when {
|
|
125
|
+
isFirst -> TextAlign.Left
|
|
126
|
+
isLast -> TextAlign.Right
|
|
127
|
+
else -> TextAlign.Center
|
|
128
|
+
}
|
|
129
|
+
ProgressInfoAlign.Center -> TextAlign.Center
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
val endPadding = if (!isLast &&
|
|
133
|
+
align != ProgressInfoAlign.Center &&
|
|
134
|
+
align != ProgressInfoAlign.Stretch
|
|
135
|
+
) Spacing.XS else 0.dp
|
|
136
|
+
|
|
137
|
+
val hideLineLeft = align == ProgressInfoAlign.Left ||
|
|
138
|
+
(align == ProgressInfoAlign.Stretch && isFirst)
|
|
139
|
+
val hideLineRight = align == ProgressInfoAlign.Right ||
|
|
140
|
+
(align == ProgressInfoAlign.Stretch && isLast)
|
|
141
|
+
|
|
142
|
+
Column(
|
|
143
|
+
modifier = Modifier
|
|
144
|
+
.weight(1f)
|
|
145
|
+
.padding(end = endPadding),
|
|
146
|
+
horizontalAlignment = columnAlign,
|
|
147
|
+
) {
|
|
148
|
+
Row(
|
|
149
|
+
modifier = Modifier.fillMaxWidth(),
|
|
150
|
+
verticalAlignment = Alignment.CenterVertically,
|
|
151
|
+
) {
|
|
152
|
+
if (!hideLineLeft) {
|
|
153
|
+
ProgressInfoHorizontalLine(modifier = Modifier.weight(1f))
|
|
154
|
+
}
|
|
155
|
+
ProgressInfoStepIcon(
|
|
156
|
+
index = index,
|
|
157
|
+
size = size,
|
|
158
|
+
useNumber = useNumber,
|
|
159
|
+
customIcon = customIcon,
|
|
160
|
+
modifier = Modifier.padding(vertical = Spacing.XS),
|
|
161
|
+
)
|
|
162
|
+
if (!hideLineRight) {
|
|
163
|
+
ProgressInfoHorizontalLine(modifier = Modifier.weight(1f))
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (showTitle && item.title.isNotEmpty()) {
|
|
168
|
+
Text(
|
|
169
|
+
text = item.title,
|
|
170
|
+
style = Typography.headerXsSemibold,
|
|
171
|
+
textAlign = textAlign,
|
|
172
|
+
modifier = Modifier
|
|
173
|
+
.fillMaxWidth()
|
|
174
|
+
.padding(bottom = Spacing.XS),
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
val desc = item.description
|
|
179
|
+
if (showDescription && !desc.isNullOrEmpty()) {
|
|
180
|
+
Text(
|
|
181
|
+
text = desc,
|
|
182
|
+
style = Typography.descriptionDefaultRegular,
|
|
183
|
+
color = Colors.black_12,
|
|
184
|
+
textAlign = textAlign,
|
|
185
|
+
modifier = Modifier.fillMaxWidth(),
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// ─── Vertical variant ─────────────────────────────────────────────────────────
|
|
194
|
+
|
|
195
|
+
@Composable
|
|
196
|
+
private fun ProgressInfoVertical(
|
|
197
|
+
steps: List<ProgressInfoItem>,
|
|
198
|
+
size: ProgressInfoSize,
|
|
199
|
+
useNumber: Boolean,
|
|
200
|
+
showTitle: Boolean,
|
|
201
|
+
showDescription: Boolean,
|
|
202
|
+
customIcon: String?,
|
|
203
|
+
modifier: Modifier = Modifier,
|
|
204
|
+
) {
|
|
205
|
+
val theme = AppTheme.current
|
|
206
|
+
val lineColor = remember(theme) { theme.colors.primary.copy(alpha = 0.2f) }
|
|
207
|
+
val density = LocalDensity.current
|
|
208
|
+
|
|
209
|
+
Column(
|
|
210
|
+
modifier = modifier
|
|
211
|
+
.fillMaxWidth()
|
|
212
|
+
.conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
|
|
213
|
+
) {
|
|
214
|
+
steps.forEachIndexed { index, item ->
|
|
215
|
+
val isLast = index == steps.lastIndex
|
|
216
|
+
val rowHeightPx = remember { mutableFloatStateOf(0f) }
|
|
217
|
+
val rowHeightDp = with(density) { rowHeightPx.value.toDp() }
|
|
218
|
+
|
|
219
|
+
Row(
|
|
220
|
+
modifier = Modifier
|
|
221
|
+
.fillMaxWidth()
|
|
222
|
+
.onGloballyPositioned { coords -> rowHeightPx.value = coords.size.height.toFloat() },
|
|
223
|
+
) {
|
|
224
|
+
Column(
|
|
225
|
+
modifier = Modifier.heightIn(min = if (isLast) 40.dp else 48.dp),
|
|
226
|
+
horizontalAlignment = Alignment.CenterHorizontally,
|
|
227
|
+
) {
|
|
228
|
+
ProgressInfoStepIcon(
|
|
229
|
+
index = index,
|
|
230
|
+
size = size,
|
|
231
|
+
useNumber = useNumber,
|
|
232
|
+
customIcon = customIcon,
|
|
233
|
+
)
|
|
234
|
+
if (!isLast) {
|
|
235
|
+
Spacer(
|
|
236
|
+
modifier = Modifier
|
|
237
|
+
.width(2.dp)
|
|
238
|
+
.height(rowHeightDp-if(size == ProgressInfoSize.Large) scaleSize(24f).dp else scaleSize(16f).dp)
|
|
239
|
+
.background(lineColor),
|
|
240
|
+
)
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Right column: title + description
|
|
245
|
+
Column(
|
|
246
|
+
modifier = Modifier
|
|
247
|
+
.weight(1f)
|
|
248
|
+
.padding(
|
|
249
|
+
end = Spacing.S,
|
|
250
|
+
bottom = if (isLast) 0.dp else Spacing.S,
|
|
251
|
+
),
|
|
252
|
+
) {
|
|
253
|
+
if (showTitle && item.title.isNotEmpty()) {
|
|
254
|
+
Text(
|
|
255
|
+
text = item.title,
|
|
256
|
+
style = Typography.headerXsSemibold,
|
|
257
|
+
maxLines = 2,
|
|
258
|
+
modifier = Modifier
|
|
259
|
+
.fillMaxWidth()
|
|
260
|
+
.padding(end = Spacing.S),
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
val desc = item.description
|
|
265
|
+
if (showDescription && !desc.isNullOrEmpty()) {
|
|
266
|
+
Text(
|
|
267
|
+
text = desc,
|
|
268
|
+
style = Typography.descriptionDefaultRegular,
|
|
269
|
+
color = Colors.black_12,
|
|
270
|
+
)
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// ─── Step icon ────────────────────────────────────────────────────────────────
|
|
279
|
+
|
|
280
|
+
@Composable
|
|
281
|
+
private fun ProgressInfoStepIcon(
|
|
282
|
+
index: Int,
|
|
283
|
+
size: ProgressInfoSize,
|
|
284
|
+
useNumber: Boolean,
|
|
285
|
+
customIcon: String?,
|
|
286
|
+
modifier: Modifier = Modifier,
|
|
287
|
+
) {
|
|
288
|
+
val containerSize = scaleSize(if (size == ProgressInfoSize.Small) 16f else 24f).dp
|
|
289
|
+
val dotSize = scaleSize(if (size == ProgressInfoSize.Small) 6f else 8f).dp
|
|
290
|
+
val iconSize = scaleSize(if (size == ProgressInfoSize.Small) 12f else 16f).dp
|
|
291
|
+
|
|
292
|
+
Box(
|
|
293
|
+
contentAlignment = Alignment.Center,
|
|
294
|
+
modifier = modifier
|
|
295
|
+
.size(containerSize)
|
|
296
|
+
.clip(CircleShape)
|
|
297
|
+
.background(Colors.pink_08)
|
|
298
|
+
.border(width = 2.dp, color = Colors.pink_08, shape = CircleShape)
|
|
299
|
+
.conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
|
|
300
|
+
) {
|
|
301
|
+
when {
|
|
302
|
+
useNumber -> {
|
|
303
|
+
Text(
|
|
304
|
+
text = (index + 1).toString(),
|
|
305
|
+
style = Typography.headerXsSemibold,
|
|
306
|
+
color = Colors.pink_MoMo_Branding,
|
|
307
|
+
textAlign = TextAlign.Center,
|
|
308
|
+
)
|
|
309
|
+
}
|
|
310
|
+
!customIcon.isNullOrEmpty() -> {
|
|
311
|
+
Icon(
|
|
312
|
+
source = customIcon,
|
|
313
|
+
size = iconSize,
|
|
314
|
+
color = Colors.pink_MoMo_Branding,
|
|
315
|
+
)
|
|
316
|
+
}
|
|
317
|
+
else -> {
|
|
318
|
+
Box(
|
|
319
|
+
modifier = Modifier
|
|
320
|
+
.size(dotSize)
|
|
321
|
+
.clip(CircleShape)
|
|
322
|
+
.background(Colors.pink_MoMo_Branding),
|
|
323
|
+
)
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// ─── Horizontal connector line ────────────────────────────────────────────────
|
|
330
|
+
|
|
331
|
+
@Composable
|
|
332
|
+
private fun ProgressInfoHorizontalLine(modifier: Modifier = Modifier) {
|
|
333
|
+
Box(
|
|
334
|
+
modifier = modifier
|
|
335
|
+
.height(2.dp)
|
|
336
|
+
.background(Colors.pink_08),
|
|
337
|
+
)
|
|
338
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
package vn.momo.kits.components
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.border
|
|
4
|
+
import androidx.compose.foundation.clickable
|
|
5
|
+
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
6
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
7
|
+
import androidx.compose.foundation.layout.Box
|
|
8
|
+
import androidx.compose.foundation.layout.Row
|
|
9
|
+
import androidx.compose.foundation.layout.padding
|
|
10
|
+
import androidx.compose.foundation.layout.size
|
|
11
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
12
|
+
import androidx.compose.runtime.Composable
|
|
13
|
+
import androidx.compose.runtime.remember
|
|
14
|
+
import androidx.compose.ui.Alignment
|
|
15
|
+
import androidx.compose.ui.Modifier
|
|
16
|
+
import androidx.compose.ui.draw.clip
|
|
17
|
+
import androidx.compose.ui.unit.dp
|
|
18
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
19
|
+
import vn.momo.kits.const.AppTheme
|
|
20
|
+
import vn.momo.kits.const.Colors
|
|
21
|
+
import vn.momo.kits.const.Radius
|
|
22
|
+
import vn.momo.kits.const.Spacing
|
|
23
|
+
import vn.momo.kits.const.Typography
|
|
24
|
+
import vn.momo.kits.modifier.activeOpacityClickable
|
|
25
|
+
import vn.momo.kits.modifier.conditional
|
|
26
|
+
|
|
27
|
+
@Composable
|
|
28
|
+
fun Radio(
|
|
29
|
+
value: Any,
|
|
30
|
+
groupValue: Any,
|
|
31
|
+
disabled: Boolean = false,
|
|
32
|
+
onChange: () -> Unit = {},
|
|
33
|
+
label: String = "",
|
|
34
|
+
modifier: Modifier = Modifier,
|
|
35
|
+
) {
|
|
36
|
+
val selected = value == groupValue
|
|
37
|
+
val borderColor = when {
|
|
38
|
+
disabled && selected -> AppTheme.current.colors.background.tonal
|
|
39
|
+
disabled -> AppTheme.current.colors.text.disable
|
|
40
|
+
selected -> AppTheme.current.colors.primary
|
|
41
|
+
else -> AppTheme.current.colors.text.default
|
|
42
|
+
}
|
|
43
|
+
val borderWidth = if (selected) 6.dp else 2.dp
|
|
44
|
+
|
|
45
|
+
Row(
|
|
46
|
+
modifier = modifier.activeOpacityClickable(
|
|
47
|
+
onClick = onChange,
|
|
48
|
+
enabled = !disabled,
|
|
49
|
+
),
|
|
50
|
+
horizontalArrangement = Arrangement.Center,
|
|
51
|
+
verticalAlignment = Alignment.CenterVertically,
|
|
52
|
+
) {
|
|
53
|
+
Box(
|
|
54
|
+
modifier = modifier
|
|
55
|
+
.padding(end = if (label.isEmpty()) 0.dp else Spacing.XS)
|
|
56
|
+
.border(borderWidth, borderColor, RoundedCornerShape(Radius.M))
|
|
57
|
+
.conditional(IsShowBaseLineDebug) {
|
|
58
|
+
border(1.dp, Colors.blue_03)
|
|
59
|
+
}
|
|
60
|
+
.clip(RoundedCornerShape(Radius.M))
|
|
61
|
+
.size(20.dp)
|
|
62
|
+
)
|
|
63
|
+
if (label.isNotEmpty()) {
|
|
64
|
+
Text(
|
|
65
|
+
style = Typography.descriptionDefaultRegular,
|
|
66
|
+
text = label,
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
@Composable
|
|
8
|
+
fun ScaleSizeScope(
|
|
9
|
+
scaleSizeMaxRate: Float? = null,
|
|
10
|
+
content: @Composable () -> Unit
|
|
11
|
+
) {
|
|
12
|
+
CompositionLocalProvider(
|
|
13
|
+
ScaleSizeMaxRate provides scaleSizeMaxRate,
|
|
14
|
+
) {
|
|
15
|
+
content()
|
|
16
|
+
}
|
|
17
|
+
}
|