@momo-kits/native-kits 0.161.2-beta.26 → 0.161.2-beta.27-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 +186 -0
- package/compose/build.gradle.kts.backup +186 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +136 -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 +109 -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 +921 -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 +403 -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 +452 -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 +235 -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 +259 -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 +135 -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 +57 -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 +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +155 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +345 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +556 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +161 -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 +315 -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 +34 -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 +131 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +167 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +72 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +101 -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 +70 -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 +105 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +33 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +205 -0
- package/gradle/libs.versions.toml +67 -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/local.properties +8 -0
- package/package.json +1 -1
- package/settings.gradle.kts +64 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
package vn.momo.kits.platform
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.Image
|
|
4
|
+
import androidx.compose.foundation.background
|
|
5
|
+
import androidx.compose.foundation.layout.Box
|
|
6
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
7
|
+
import androidx.compose.runtime.Composable
|
|
8
|
+
import androidx.compose.runtime.getValue
|
|
9
|
+
import androidx.compose.ui.Modifier
|
|
10
|
+
import androidx.compose.ui.graphics.Color
|
|
11
|
+
import io.github.alexzhirkevich.compottie.Compottie
|
|
12
|
+
import io.github.alexzhirkevich.compottie.ExperimentalCompottieApi
|
|
13
|
+
import io.github.alexzhirkevich.compottie.LottieCompositionSpec
|
|
14
|
+
import io.github.alexzhirkevich.compottie.animateLottieCompositionAsState
|
|
15
|
+
import io.github.alexzhirkevich.compottie.dynamic.rememberLottieDynamicProperties
|
|
16
|
+
import io.github.alexzhirkevich.compottie.rememberLottieComposition
|
|
17
|
+
import io.github.alexzhirkevich.compottie.rememberLottiePainter
|
|
18
|
+
import vn.momo.kits.utils.readJson
|
|
19
|
+
|
|
20
|
+
@OptIn(ExperimentalCompottieApi::class)
|
|
21
|
+
@Composable
|
|
22
|
+
internal fun ComposeLottieAnimation(
|
|
23
|
+
path: String,
|
|
24
|
+
tintColor: Color?,
|
|
25
|
+
bgColor: Color?,
|
|
26
|
+
modifier: Modifier,
|
|
27
|
+
) {
|
|
28
|
+
val json = readJson(path)
|
|
29
|
+
|
|
30
|
+
if (json.isEmpty()) {
|
|
31
|
+
Box(modifier.background(bgColor ?: Color.Transparent))
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
val composition by rememberLottieComposition(json) {
|
|
36
|
+
LottieCompositionSpec.JsonString(json)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Recolor only the fill/stroke color slots (matching the native lottie-ios per-keypath tint)
|
|
40
|
+
// instead of a global ColorFilter.tint, which would flatten a multicolor animation to a silhouette.
|
|
41
|
+
val dynamicProperties = if (tintColor != null) {
|
|
42
|
+
rememberLottieDynamicProperties(tintColor) {
|
|
43
|
+
shapeLayer("**") {
|
|
44
|
+
fill("**") { color { tintColor } }
|
|
45
|
+
stroke("**") { color { tintColor } }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
null
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
val lottieState = animateLottieCompositionAsState(
|
|
53
|
+
composition = composition,
|
|
54
|
+
iterations = Compottie.IterateForever,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
Box(modifier.background(bgColor ?: Color.Transparent)) {
|
|
58
|
+
Image(
|
|
59
|
+
painter = rememberLottiePainter(
|
|
60
|
+
composition = composition,
|
|
61
|
+
progress = lottieState::value,
|
|
62
|
+
dynamicProperties = dynamicProperties,
|
|
63
|
+
enableExpressions = false,
|
|
64
|
+
expressionEngineFactory = { _, _ ->
|
|
65
|
+
error("Lottie JS expressions are disabled in MoMo kits")
|
|
66
|
+
},
|
|
67
|
+
),
|
|
68
|
+
contentDescription = null,
|
|
69
|
+
modifier = Modifier.fillMaxSize(),
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
package vn.momo.kits.platform
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.Composable
|
|
4
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
5
|
+
import androidx.compose.runtime.ProvidedValue
|
|
6
|
+
import androidx.compose.runtime.key
|
|
7
|
+
import androidx.compose.ui.Modifier
|
|
8
|
+
import androidx.compose.ui.graphics.Color
|
|
9
|
+
import androidx.compose.ui.graphics.NativePaint
|
|
10
|
+
import androidx.compose.ui.unit.Dp
|
|
11
|
+
|
|
12
|
+
data class ScreenDimension(
|
|
13
|
+
val width: Int,
|
|
14
|
+
val height: Int,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
expect fun getPlatformName(): String
|
|
18
|
+
|
|
19
|
+
@Composable
|
|
20
|
+
expect fun getScreenDimensions(): ScreenDimension
|
|
21
|
+
|
|
22
|
+
expect fun NativePaint.setMaskFilter(blurRadius: Float)
|
|
23
|
+
|
|
24
|
+
@Composable
|
|
25
|
+
expect fun getStatusBarHeight(): Dp
|
|
26
|
+
|
|
27
|
+
@Composable
|
|
28
|
+
expect fun BackHandler(enabled: Boolean, onBack: () -> Unit)
|
|
29
|
+
|
|
30
|
+
@Composable
|
|
31
|
+
expect fun ProvideNavigationEventDispatcherOwner(content: @Composable () -> Unit)
|
|
32
|
+
|
|
33
|
+
@Composable
|
|
34
|
+
expect fun getScreenHeight(): Dp
|
|
35
|
+
|
|
36
|
+
sealed interface OSVersion {
|
|
37
|
+
val value: Int
|
|
38
|
+
data class Android(val sdk: Int) : OSVersion { override val value: Int get() = sdk }
|
|
39
|
+
data class IOS(val major: Int) : OSVersion { override val value: Int get() = major }
|
|
40
|
+
|
|
41
|
+
operator fun compareTo(other: Int): Int = value.compareTo(other)
|
|
42
|
+
}
|
|
43
|
+
expect fun getOSVersion(): OSVersion
|
|
44
|
+
|
|
45
|
+
fun supportsImePadding(): Boolean = when (val v = getOSVersion()) {
|
|
46
|
+
is OSVersion.Android -> v.sdk > 29
|
|
47
|
+
is OSVersion.IOS -> true
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param useCompose when `true`, renders via the pure-Compose Compottie engine instead of the
|
|
52
|
+
* platform-native engine (airbnb-lottie on Android, lottie-ios on iOS). Defaults to `false` for
|
|
53
|
+
* backward compatibility. Note: when `useCompose = true`, `tintColor` recolors only the fill/stroke
|
|
54
|
+
* color slots (matching the native lottie-ios per-keypath tint), so gradient and text-layer colors
|
|
55
|
+
* are left untinted; `placedAsOverlay` is a no-op.
|
|
56
|
+
*/
|
|
57
|
+
@Composable
|
|
58
|
+
expect fun LottieAnimation(
|
|
59
|
+
path: String,
|
|
60
|
+
tintColor: Color? = null,
|
|
61
|
+
bgColor: Color? = null,
|
|
62
|
+
placedAsOverlay: Boolean = false,
|
|
63
|
+
modifier: Modifier = Modifier,
|
|
64
|
+
useCompose: Boolean = false
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
expect fun NativePaint.setColor(
|
|
68
|
+
color: Color = Color.Black
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
/** Ngôn ngữ fallback mặc định của kit khi không xác định được ngôn ngữ: tiếng Việt. */
|
|
72
|
+
const val DEFAULT_LANGUAGE = "vi"
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Platform override cho ngôn ngữ mà Compose Resources (stringResource) sử dụng.
|
|
76
|
+
* Pattern theo tài liệu:
|
|
77
|
+
* https://kotlinlang.org/docs/multiplatform/compose-resource-environment.html
|
|
78
|
+
*/
|
|
79
|
+
expect object LocalAppLocale {
|
|
80
|
+
val current: String
|
|
81
|
+
@Composable get
|
|
82
|
+
|
|
83
|
+
@Composable
|
|
84
|
+
infix fun provides(value: String?): ProvidedValue<*>
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Bọc [content] để ép Compose Resources resolve theo [language].
|
|
89
|
+
*
|
|
90
|
+
* `key(language)` buộc recompose toàn bộ subtree khi ngôn ngữ thay đổi, nhờ đó
|
|
91
|
+
* các lời gọi stringResource() đã render trước đó được resolve lại đúng ngôn ngữ.
|
|
92
|
+
* `language == null` nghĩa là dùng locale mặc định của thiết bị.
|
|
93
|
+
*/
|
|
94
|
+
@Composable
|
|
95
|
+
fun ProvideAppLocale(language: String?, content: @Composable () -> Unit) {
|
|
96
|
+
CompositionLocalProvider(LocalAppLocale provides language) {
|
|
97
|
+
key(language) {
|
|
98
|
+
content()
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|