@momo-kits/native-kits 0.151.2-test.1 → 0.151.2-test.10
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/compose/build.gradle.kts +2 -0
- package/compose/src/commonMain/composeResources/files/lottie_circle_loader.json +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +2 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +7 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +36 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +4 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +4 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +23 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +4 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +132 -119
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +21 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +21 -20
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +5 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +4 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +14 -0
- package/ios/Button/Button.swift +25 -4
- package/ios/Lottie/LottieView.swift +86 -0
- package/ios/native-kits.podspec +1 -0
- package/package.json +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -385
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Localize.kt +0 -35
package/compose/build.gradle.kts
CHANGED
|
@@ -47,6 +47,8 @@ kotlin {
|
|
|
47
47
|
implementation(libs.coil.multiplatform.network.ktor)
|
|
48
48
|
implementation(libs.jetbrains.serialization.json)
|
|
49
49
|
implementation(libs.kotlinx.datetime)
|
|
50
|
+
implementation(libs.compottie)
|
|
51
|
+
implementation(libs.compottie.res)
|
|
50
52
|
api(project(":NativeMaxApi"))
|
|
51
53
|
}
|
|
52
54
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"v":"5.10.2","fr":30,"ip":0,"op":50,"w":100,"h":100,"nm":"Spinner3_white","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"loading","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":13,"s":[0],"e":[200]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":25,"s":[200],"e":[360]},{"t":35}],"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.996078431373,0.956862745098,0.980392156863,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.392],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":18,"s":[0],"e":[100]},{"t":50}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0],"e":[100]},{"t":28}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":50,"st":0,"ct":1,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"loading 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":15,"s":[0],"e":[200]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":27,"s":[200],"e":[360]},{"t":37}],"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.98431372549,0.835294117647,0.917647058824,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.392],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":20,"s":[0],"e":[100]},{"t":49}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":2,"s":[0],"e":[100]},{"t":30}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":30,"op":50,"st":2,"ct":1,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"base","sr":1,"ks":{"o":{"a":0,"k":40,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[50,50,0],"ix":2,"l":2},"a":{"a":0,"k":[44.124,44.124,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[90,90],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.996078431373,0.956862745098,0.980392156863,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":9,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[44.124,44.124],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":50,"st":0,"ct":1,"bm":0}],"markers":[]}
|
|
@@ -67,6 +67,7 @@ data class FabProps(
|
|
|
67
67
|
val position: FABPosition? = FABPosition.END,
|
|
68
68
|
)
|
|
69
69
|
|
|
70
|
+
@Deprecated("Use vn.momo.kits.navigation.FloatingButton instead", ReplaceWith("vn.momo.kits.navigation.FloatingButton"))
|
|
70
71
|
@Composable
|
|
71
72
|
fun FloatingButton(
|
|
72
73
|
scrollPosition: Int,
|
|
@@ -9,13 +9,10 @@ import androidx.compose.foundation.layout.Box
|
|
|
9
9
|
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
10
10
|
import androidx.compose.foundation.layout.Row
|
|
11
11
|
import androidx.compose.foundation.layout.Spacer
|
|
12
|
-
import androidx.compose.foundation.layout.WindowInsets
|
|
13
|
-
import androidx.compose.foundation.layout.asPaddingValues
|
|
14
12
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
15
13
|
import androidx.compose.foundation.layout.height
|
|
16
14
|
import androidx.compose.foundation.layout.padding
|
|
17
15
|
import androidx.compose.foundation.layout.size
|
|
18
|
-
import androidx.compose.foundation.layout.systemBars
|
|
19
16
|
import androidx.compose.foundation.layout.width
|
|
20
17
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
21
18
|
import androidx.compose.runtime.Composable
|
|
@@ -38,13 +35,12 @@ import kotlinx.coroutines.flow.map
|
|
|
38
35
|
import vn.momo.kits.components.Icon
|
|
39
36
|
import vn.momo.kits.components.InputSearch
|
|
40
37
|
import vn.momo.kits.components.InputSearchProps
|
|
41
|
-
import vn.momo.kits.const.AppStatusBar
|
|
42
38
|
import vn.momo.kits.const.AppTheme
|
|
43
39
|
import vn.momo.kits.const.Colors
|
|
44
40
|
import vn.momo.kits.const.Spacing
|
|
45
41
|
import vn.momo.kits.modifier.conditional
|
|
46
42
|
import vn.momo.kits.modifier.setAutomationId
|
|
47
|
-
import vn.momo.kits.
|
|
43
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
48
44
|
|
|
49
45
|
data class HeaderColor(val tintIconColor: Color, val backgroundButton: Color, val borderColor: Color)
|
|
50
46
|
fun getHeaderColor(animatedHeader: AnimatedHeader?, opacity: Float, tintColor: Color?, defaultColor: Color): HeaderColor{
|
|
@@ -76,6 +72,7 @@ fun getHeaderColor(animatedHeader: AnimatedHeader?, opacity: Float, tintColor: C
|
|
|
76
72
|
)
|
|
77
73
|
}
|
|
78
74
|
|
|
75
|
+
@Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
|
|
79
76
|
@Composable
|
|
80
77
|
fun Header(
|
|
81
78
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
@@ -222,13 +219,4 @@ fun Header(
|
|
|
222
219
|
}
|
|
223
220
|
}
|
|
224
221
|
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
@Composable
|
|
228
|
-
fun getAppStatusBarHeight(): Dp {
|
|
229
|
-
return if (AppStatusBar.current == 0.dp) {
|
|
230
|
-
WindowInsets.systemBars.asPaddingValues().calculateTopPadding()
|
|
231
|
-
} else {
|
|
232
|
-
AppStatusBar.current
|
|
233
|
-
}
|
|
234
222
|
}
|
|
@@ -11,6 +11,7 @@ import androidx.compose.ui.graphics.graphicsLayer
|
|
|
11
11
|
import androidx.compose.ui.unit.dp
|
|
12
12
|
import vn.momo.kits.components.Image
|
|
13
13
|
|
|
14
|
+
@Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
|
|
14
15
|
@Composable
|
|
15
16
|
fun HeaderAnimated(image: String, scrollState: Int = 0) {
|
|
16
17
|
// Scale animation
|
|
@@ -8,9 +8,8 @@ import androidx.compose.runtime.Composable
|
|
|
8
8
|
import androidx.compose.runtime.getValue
|
|
9
9
|
import androidx.compose.ui.Modifier
|
|
10
10
|
import androidx.compose.ui.graphics.Color
|
|
11
|
-
import vn.momo.kits.const.AppStatusBar
|
|
12
11
|
import vn.momo.kits.const.AppTheme
|
|
13
|
-
import vn.momo.kits.
|
|
12
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
14
13
|
|
|
15
14
|
enum class TitlePosition {
|
|
16
15
|
LEFT, CENTER,
|
|
@@ -37,6 +36,7 @@ fun animateColor(start: Color, stop: Color, fraction: Float): Color {
|
|
|
37
36
|
)
|
|
38
37
|
}
|
|
39
38
|
|
|
39
|
+
@Deprecated("Use vn.momo.kits.navigation.component.HeaderBackground instead", ReplaceWith("vn.momo.kits.navigation.component.HeaderBackground"))
|
|
40
40
|
@Composable
|
|
41
41
|
fun HeaderBackground(
|
|
42
42
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
@@ -19,6 +19,7 @@ import vn.momo.kits.components.Options
|
|
|
19
19
|
import vn.momo.kits.const.AppTheme
|
|
20
20
|
import vn.momo.kits.utils.bottomBorder
|
|
21
21
|
|
|
22
|
+
@Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
|
|
22
23
|
@Composable
|
|
23
24
|
fun HeaderDefault(
|
|
24
25
|
opacityAni: Float,
|
|
@@ -19,6 +19,7 @@ import vn.momo.kits.components.Options
|
|
|
19
19
|
import vn.momo.kits.const.AppTheme
|
|
20
20
|
import vn.momo.kits.utils.bottomBorder
|
|
21
21
|
|
|
22
|
+
@Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
|
|
22
23
|
@Composable
|
|
23
24
|
fun HeaderExtended(
|
|
24
25
|
opacityAni: Float,
|
|
@@ -81,6 +81,7 @@ object Spacing {
|
|
|
81
81
|
val XXS = 2.dp
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
@Deprecated("Use vn.momo.kits.navigation.component.HeaderRight instead", ReplaceWith("vn.momo.kits.navigation.component.HeaderRight"))
|
|
84
85
|
@Composable
|
|
85
86
|
fun HeaderRight(
|
|
86
87
|
headerRight: HeaderRightData? = null,
|
|
@@ -258,6 +259,7 @@ private fun ToolkitHeaderRight(
|
|
|
258
259
|
}
|
|
259
260
|
}
|
|
260
261
|
|
|
262
|
+
@Deprecated("Use vn.momo.kits.navigation.component instead", ReplaceWith("vn.momo.kits.navigation.component"))
|
|
261
263
|
@Composable
|
|
262
264
|
fun NavigationButton(
|
|
263
265
|
disabled: Boolean,
|
|
@@ -10,6 +10,7 @@ import androidx.compose.ui.zIndex
|
|
|
10
10
|
import vn.momo.kits.components.Text
|
|
11
11
|
import vn.momo.kits.const.Typography
|
|
12
12
|
|
|
13
|
+
@Deprecated("Use vn.momo.kits.navigation.component instead", ReplaceWith("vn.momo.kits.navigation.component"))
|
|
13
14
|
@Composable
|
|
14
15
|
fun HeaderTitle(
|
|
15
16
|
title: String = "",
|
|
@@ -68,7 +68,6 @@ import androidx.compose.ui.unit.Dp
|
|
|
68
68
|
import androidx.compose.ui.unit.IntOffset
|
|
69
69
|
import androidx.compose.ui.unit.LayoutDirection
|
|
70
70
|
import androidx.compose.ui.unit.dp
|
|
71
|
-
import androidx.compose.ui.unit.max
|
|
72
71
|
import androidx.compose.ui.unit.sp
|
|
73
72
|
import kotlinx.coroutines.flow.collectLatest
|
|
74
73
|
import kotlinx.coroutines.flow.mapNotNull
|
|
@@ -83,8 +82,10 @@ import vn.momo.kits.modifier.kitsAutomationId
|
|
|
83
82
|
import vn.momo.kits.modifier.noFeedbackClickable
|
|
84
83
|
import vn.momo.kits.modifier.setAutomationId
|
|
85
84
|
import vn.momo.kits.modifier.shadow
|
|
85
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
86
86
|
import kotlin.math.max
|
|
87
87
|
|
|
88
|
+
@Deprecated("Use NavigationContainer(StackScreen) instead", ReplaceWith("NavigationContainer(StackScreen)"))
|
|
88
89
|
@Composable
|
|
89
90
|
fun LiteScreen(
|
|
90
91
|
scrollable: Boolean = true,
|
|
@@ -2,6 +2,7 @@ package vn.momo.kits.application
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.runtime.Composable
|
|
4
4
|
import androidx.compose.runtime.CompositionLocalProvider
|
|
5
|
+
import androidx.compose.runtime.Immutable
|
|
5
6
|
import androidx.compose.runtime.LaunchedEffect
|
|
6
7
|
import androidx.compose.runtime.getValue
|
|
7
8
|
import androidx.compose.runtime.mutableStateOf
|
|
@@ -17,6 +18,7 @@ import vn.momo.kits.const.ThemeAssets
|
|
|
17
18
|
import vn.momo.kits.const.defaultTheme
|
|
18
19
|
import vn.momo.kits.platform.getStatusBarHeight
|
|
19
20
|
|
|
21
|
+
@Deprecated("Use IMaxApi instead", ReplaceWith("IMaxApi"))
|
|
20
22
|
interface ComposeApi {
|
|
21
23
|
fun request(funcName: String, params: Any?): String
|
|
22
24
|
fun request(funcName: String, params: Any?, onResponse: ((String) -> Unit)?): String
|
|
@@ -62,6 +64,7 @@ class Navigator {
|
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
@Immutable
|
|
65
68
|
data class MiniAppContext(
|
|
66
69
|
val appIcon: String = "",
|
|
67
70
|
val appName: Any? = null,
|
|
@@ -135,9 +138,10 @@ private fun Map<String, Any?>?.mapStringAny(key: String): Map<String, Any?> =
|
|
|
135
138
|
private fun Map<String, Any?>?.listOfMapStringAny(key: String): List<Map<String, Any>> =
|
|
136
139
|
(this?.get(key) as? List<Map<String, Any>>) ?: emptyList()
|
|
137
140
|
|
|
138
|
-
|
|
141
|
+
@Deprecated("Use LocalApi instead", ReplaceWith("LocalApi"))
|
|
139
142
|
val PlatformApi = staticCompositionLocalOf<Any?> { null }
|
|
140
143
|
|
|
144
|
+
@Deprecated("Use LocalNavigator instead", ReplaceWith("LocalNavigator"))
|
|
141
145
|
val AppNavigator = staticCompositionLocalOf<Navigator?> {
|
|
142
146
|
null
|
|
143
147
|
}
|
|
@@ -154,6 +158,7 @@ val AppLanguage = staticCompositionLocalOf<String?> {
|
|
|
154
158
|
null
|
|
155
159
|
}
|
|
156
160
|
|
|
161
|
+
@Immutable
|
|
157
162
|
data class KitConfig(
|
|
158
163
|
val trustBanner: TrustBannerData? = null,
|
|
159
164
|
val headerBar: String? = null,
|
|
@@ -162,6 +167,7 @@ data class KitConfig(
|
|
|
162
167
|
|
|
163
168
|
internal var DesignSystemWhiteList: Boolean? = null
|
|
164
169
|
|
|
170
|
+
@Deprecated("Use NavigationContainer instead", ReplaceWith("NavigationContainer"))
|
|
165
171
|
@Composable
|
|
166
172
|
fun ApplicationContainer(
|
|
167
173
|
theme: Theme = defaultTheme,
|
|
@@ -40,6 +40,7 @@ import vn.momo.kits.const.Spacing
|
|
|
40
40
|
import vn.momo.kits.modifier.conditional
|
|
41
41
|
import vn.momo.kits.modifier.shadow
|
|
42
42
|
import vn.momo.kits.platform.getAndroidBuildVersion
|
|
43
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
43
44
|
|
|
44
45
|
enum class HeaderType {
|
|
45
46
|
DEFAULT,
|
|
@@ -49,6 +50,7 @@ enum class HeaderType {
|
|
|
49
50
|
|
|
50
51
|
const val HEADER_HEIGHT = 52
|
|
51
52
|
|
|
53
|
+
@Deprecated("Use NavigationContainer(StackScreen) instead", ReplaceWith("NavigationContainer(StackScreen)"))
|
|
52
54
|
@Composable
|
|
53
55
|
fun Screen(
|
|
54
56
|
backgroundColor: Color? = null,
|
|
@@ -22,6 +22,7 @@ data class HeaderAnimations(
|
|
|
22
22
|
private const val SCREEN_PADDING = 12
|
|
23
23
|
private const val BACK_WIDTH = 28
|
|
24
24
|
|
|
25
|
+
@Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
|
|
25
26
|
@Composable
|
|
26
27
|
fun useHeaderSearchAnimation(
|
|
27
28
|
opacityAni: Float,
|
|
@@ -11,23 +11,30 @@ import androidx.compose.foundation.layout.height
|
|
|
11
11
|
import androidx.compose.foundation.layout.padding
|
|
12
12
|
import androidx.compose.foundation.layout.size
|
|
13
13
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
14
|
-
import androidx.compose.material3.CircularProgressIndicator
|
|
15
14
|
import androidx.compose.runtime.Composable
|
|
15
|
+
import androidx.compose.runtime.getValue
|
|
16
16
|
import androidx.compose.runtime.remember
|
|
17
17
|
import androidx.compose.ui.Alignment
|
|
18
18
|
import androidx.compose.ui.Modifier
|
|
19
|
+
import androidx.compose.ui.draw.alpha
|
|
19
20
|
import androidx.compose.ui.draw.clip
|
|
20
21
|
import androidx.compose.ui.graphics.Color
|
|
21
22
|
import androidx.compose.ui.text.TextStyle
|
|
22
23
|
import androidx.compose.ui.text.style.TextOverflow
|
|
23
24
|
import androidx.compose.ui.unit.Dp
|
|
24
25
|
import androidx.compose.ui.unit.dp
|
|
26
|
+
import io.github.alexzhirkevich.compottie.Compottie
|
|
27
|
+
import io.github.alexzhirkevich.compottie.LottieCompositionSpec
|
|
28
|
+
import io.github.alexzhirkevich.compottie.animateLottieCompositionAsState
|
|
29
|
+
import io.github.alexzhirkevich.compottie.rememberLottieComposition
|
|
30
|
+
import io.github.alexzhirkevich.compottie.rememberLottiePainter
|
|
25
31
|
import vn.momo.kits.const.AppTheme
|
|
26
32
|
import vn.momo.kits.const.Colors
|
|
27
33
|
import vn.momo.kits.const.Radius
|
|
28
34
|
import vn.momo.kits.const.Spacing
|
|
29
35
|
import vn.momo.kits.const.Typography
|
|
30
36
|
import vn.momo.kits.modifier.activeOpacityClickable
|
|
37
|
+
import vn.momo.uikits.resources.Res
|
|
31
38
|
|
|
32
39
|
enum class ButtonType {
|
|
33
40
|
PRIMARY,
|
|
@@ -145,22 +152,35 @@ fun RenderLeading(
|
|
|
145
152
|
) {
|
|
146
153
|
if (loading) {
|
|
147
154
|
Box(Modifier.padding(end = marginRight)) {
|
|
148
|
-
|
|
149
|
-
|
|
155
|
+
val composition by rememberLottieComposition {
|
|
156
|
+
LottieCompositionSpec.JsonString(
|
|
157
|
+
Res.readBytes("files/lottie_circle_loader.json").decodeToString()
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
val progress by animateLottieCompositionAsState(
|
|
162
|
+
composition = composition,
|
|
163
|
+
iterations = Compottie.IterateForever
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
Image(
|
|
167
|
+
source = rememberLottiePainter(
|
|
168
|
+
composition = composition,
|
|
169
|
+
progress = { progress }
|
|
170
|
+
),
|
|
171
|
+
modifier = Modifier.size(iconSize),
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
if (iconLeft.isNotEmpty()) {
|
|
176
|
+
Icon(
|
|
177
|
+
source = iconLeft,
|
|
150
178
|
color = color,
|
|
151
|
-
|
|
152
|
-
|
|
179
|
+
size = iconSize,
|
|
180
|
+
modifier = Modifier.padding(end = marginRight)
|
|
153
181
|
)
|
|
154
182
|
}
|
|
155
183
|
}
|
|
156
|
-
if (iconLeft.isNotEmpty()) {
|
|
157
|
-
Icon(
|
|
158
|
-
source = iconLeft,
|
|
159
|
-
color = color,
|
|
160
|
-
size = iconSize,
|
|
161
|
-
modifier = Modifier.padding(end = marginRight)
|
|
162
|
-
)
|
|
163
|
-
}
|
|
164
184
|
}
|
|
165
185
|
}
|
|
166
186
|
|
|
@@ -261,7 +281,7 @@ fun Button(
|
|
|
261
281
|
}
|
|
262
282
|
}.activeOpacityClickable(
|
|
263
283
|
activeOpacity = 0.5f,
|
|
264
|
-
enabled = isEnabled,
|
|
284
|
+
enabled = isEnabled && !loading,
|
|
265
285
|
onClick = onClick
|
|
266
286
|
)
|
|
267
287
|
|
|
@@ -272,7 +292,8 @@ fun Button(
|
|
|
272
292
|
.then(getTypeStyle(type, size = size))
|
|
273
293
|
.padding(horizontal = sizeSpecs.padding)
|
|
274
294
|
.defaultMinSize(minWidth = sizeSpecs.width)
|
|
275
|
-
.height(sizeSpecs.height)
|
|
295
|
+
.height(sizeSpecs.height)
|
|
296
|
+
.alpha(if(loading) 0.75f else 1f),
|
|
276
297
|
horizontalArrangement = Arrangement.Center,
|
|
277
298
|
verticalAlignment = Alignment.CenterVertically,
|
|
278
299
|
) {
|
|
@@ -72,7 +72,7 @@ private fun getHostFromUrl(url: String): String? {
|
|
|
72
72
|
private fun appendSizeQueryParam(url: String, value: String): String {
|
|
73
73
|
val fragmentIndex = url.indexOf('#')
|
|
74
74
|
val (baseUrl, fragment) = if (fragmentIndex != -1) {
|
|
75
|
-
url.
|
|
75
|
+
url.take(fragmentIndex) to url.substring(fragmentIndex)
|
|
76
76
|
} else {
|
|
77
77
|
url to ""
|
|
78
78
|
}
|
package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt
CHANGED
|
@@ -2,7 +2,6 @@ package vn.momo.kits.components.datetimepicker
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.runtime.Composable
|
|
4
4
|
import androidx.compose.runtime.remember
|
|
5
|
-
import kotlinx.datetime.Clock
|
|
6
5
|
import kotlinx.datetime.DatePeriod
|
|
7
6
|
import kotlinx.datetime.LocalDateTime
|
|
8
7
|
import kotlinx.datetime.TimeZone
|
|
@@ -10,6 +9,8 @@ import kotlinx.datetime.minus
|
|
|
10
9
|
import kotlinx.datetime.number
|
|
11
10
|
import kotlinx.datetime.plus
|
|
12
11
|
import kotlinx.datetime.toLocalDateTime
|
|
12
|
+
import kotlin.time.Clock.System.now
|
|
13
|
+
import kotlin.time.ExperimentalTime
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Format a LocalDateTime object into a string
|
|
@@ -149,8 +150,9 @@ val timeMode = listOf("AM", "PM")
|
|
|
149
150
|
/**
|
|
150
151
|
* Get today's date
|
|
151
152
|
*/
|
|
153
|
+
@OptIn(ExperimentalTime::class)
|
|
152
154
|
fun getCurrentDateTime(): LocalDateTime {
|
|
153
|
-
return
|
|
155
|
+
return now().toLocalDateTime(TimeZone.currentSystemDefault())
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
/**
|
|
@@ -20,7 +20,6 @@ import androidx.compose.foundation.layout.padding
|
|
|
20
20
|
import androidx.compose.foundation.layout.size
|
|
21
21
|
import androidx.compose.foundation.layout.width
|
|
22
22
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
23
|
-
import androidx.compose.material.Text
|
|
24
23
|
import androidx.compose.runtime.Composable
|
|
25
24
|
import androidx.compose.runtime.DisposableEffect
|
|
26
25
|
import androidx.compose.runtime.LaunchedEffect
|
|
@@ -36,6 +35,7 @@ import androidx.compose.ui.unit.dp
|
|
|
36
35
|
import kotlinx.coroutines.launch
|
|
37
36
|
import vn.momo.kits.components.Divider
|
|
38
37
|
import vn.momo.kits.components.Icon
|
|
38
|
+
import vn.momo.kits.components.Text
|
|
39
39
|
import vn.momo.kits.const.AppTheme
|
|
40
40
|
import vn.momo.kits.const.Colors
|
|
41
41
|
import vn.momo.kits.const.Radius
|
|
@@ -2,6 +2,7 @@ package vn.momo.kits.navigation
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.gestures.ScrollableState
|
|
4
4
|
import androidx.compose.runtime.Composable
|
|
5
|
+
import androidx.compose.runtime.Stable
|
|
5
6
|
import androidx.compose.runtime.State
|
|
6
7
|
import androidx.compose.runtime.mutableStateOf
|
|
7
8
|
import androidx.compose.runtime.staticCompositionLocalOf
|
|
@@ -66,8 +67,9 @@ val LocalNavigation = staticCompositionLocalOf<Navigation> {
|
|
|
66
67
|
error("No NavigationStack provided")
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
@Stable
|
|
69
71
|
data class NavigationOptions(
|
|
70
|
-
|
|
72
|
+
val onBackHandler: (() -> Unit)? = null,
|
|
71
73
|
val hiddenBack: Boolean = false,
|
|
72
74
|
val headerTitle: HeaderTitle = HeaderTitle.Default("Stack"),
|
|
73
75
|
val headerRight: HeaderRight = HeaderRight.Toolkit(),
|
|
@@ -87,6 +89,6 @@ data class KeyboardOptions(
|
|
|
87
89
|
|
|
88
90
|
|
|
89
91
|
data class ScrollData(
|
|
90
|
-
val scrollable: Boolean =
|
|
92
|
+
val scrollable: Boolean = true,
|
|
91
93
|
val scrollState: ScrollableState? = null,
|
|
92
94
|
)
|
|
@@ -16,19 +16,25 @@ import androidx.compose.runtime.LaunchedEffect
|
|
|
16
16
|
import androidx.compose.runtime.mutableStateOf
|
|
17
17
|
import androidx.compose.runtime.remember
|
|
18
18
|
import androidx.compose.runtime.staticCompositionLocalOf
|
|
19
|
+
import androidx.compose.ui.unit.Dp
|
|
19
20
|
import androidx.compose.ui.unit.dp
|
|
20
21
|
import androidx.navigation.compose.NavHost
|
|
21
22
|
import androidx.navigation.compose.composable
|
|
22
23
|
import androidx.navigation.compose.rememberNavController
|
|
23
24
|
import androidx.navigation.toRoute
|
|
25
|
+
import vn.momo.kits.application.AppConfig
|
|
26
|
+
import vn.momo.kits.application.AppLanguage
|
|
24
27
|
import vn.momo.kits.application.ApplicationContext
|
|
28
|
+
import vn.momo.kits.application.KitConfig
|
|
25
29
|
import vn.momo.kits.application.MiniAppContext
|
|
26
30
|
import vn.momo.kits.const.AppNavigationBar
|
|
27
31
|
import vn.momo.kits.const.AppStatusBar
|
|
28
32
|
import vn.momo.kits.const.AppTheme
|
|
29
33
|
import vn.momo.kits.const.AppThemeController
|
|
30
34
|
import vn.momo.kits.const.Theme
|
|
35
|
+
import vn.momo.kits.const.ThemeAssets
|
|
31
36
|
import vn.momo.kits.const.defaultTheme
|
|
37
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
32
38
|
import vn.momo.maxapi.IMaxApi
|
|
33
39
|
|
|
34
40
|
@Composable
|
|
@@ -39,14 +45,13 @@ fun NavigationContainer(
|
|
|
39
45
|
applicationContext: MiniAppContext? = null,
|
|
40
46
|
maxApi: IMaxApi? = null,
|
|
41
47
|
setNavigator: ((Navigator) -> Unit)? = null,
|
|
48
|
+
statusBarHeight: Dp? = null,
|
|
49
|
+
config: KitConfig? = null,
|
|
50
|
+
language: String? = null,
|
|
42
51
|
){
|
|
43
52
|
val navController = rememberNavController()
|
|
44
53
|
val navigator = remember { Navigator(navController = navController, maxApi = maxApi) }
|
|
45
|
-
val statusBarHeight =
|
|
46
|
-
WindowInsets.systemBars.asPaddingValues().calculateTopPadding()
|
|
47
|
-
} else {
|
|
48
|
-
AppStatusBar.current
|
|
49
|
-
}
|
|
54
|
+
val statusBarHeight = statusBarHeight ?: getAppStatusBarHeight()
|
|
50
55
|
val navigationBarHeight = if (AppNavigationBar.current == 0.dp) {
|
|
51
56
|
WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
|
|
52
57
|
} else {
|
|
@@ -55,6 +60,17 @@ fun NavigationContainer(
|
|
|
55
60
|
|
|
56
61
|
val theme = remember { mutableStateOf(initialTheme) }
|
|
57
62
|
|
|
63
|
+
LaunchedEffect(Unit) {
|
|
64
|
+
val headerBar = config?.headerBar
|
|
65
|
+
if (headerBar != null && theme.value.assets.headerBackground == null) {
|
|
66
|
+
theme.value = theme.value.copy(
|
|
67
|
+
assets = ThemeAssets(
|
|
68
|
+
headerBackground = headerBar
|
|
69
|
+
)
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
val startDestination = DynamicScreenRegistry.register(initialScreen, options)
|
|
59
75
|
|
|
60
76
|
CompositionLocalProvider(
|
|
@@ -65,6 +81,8 @@ fun NavigationContainer(
|
|
|
65
81
|
AppStatusBar provides statusBarHeight,
|
|
66
82
|
AppNavigationBar provides navigationBarHeight,
|
|
67
83
|
ApplicationContext provides applicationContext,
|
|
84
|
+
AppConfig provides config,
|
|
85
|
+
AppLanguage provides language
|
|
68
86
|
) {
|
|
69
87
|
LaunchedEffect(Unit) {
|
|
70
88
|
setNavigator?.invoke(navigator)
|
|
@@ -208,9 +208,8 @@ object OverplayComponentRegistry {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
@Composable
|
|
211
|
-
fun
|
|
212
|
-
val overplay = currentOverlayComponent.value
|
|
213
|
-
if (overplay == null) return
|
|
211
|
+
fun OverlayComponent(){
|
|
212
|
+
val overplay = currentOverlayComponent.value ?: return
|
|
214
213
|
|
|
215
214
|
if (overplay.params is OverplayComponentParams.BottomSheet) {
|
|
216
215
|
val param = overplay.params
|
|
@@ -218,14 +217,14 @@ object OverplayComponentRegistry {
|
|
|
218
217
|
content = overplay.content,
|
|
219
218
|
header = param.bottomSheetHeader ?: BottomHeader.Title(),
|
|
220
219
|
isSurface = param.isSurface,
|
|
221
|
-
barrierDismissible = param.barrierDismissible
|
|
220
|
+
barrierDismissible = param.barrierDismissible,
|
|
222
221
|
onDismiss = param.onDismiss
|
|
223
222
|
)
|
|
224
223
|
} else if (overplay.params is OverplayComponentParams.Modal) {
|
|
225
224
|
val param = overplay.params
|
|
226
225
|
ModalScreen(
|
|
227
226
|
content = overplay.content,
|
|
228
|
-
barrierDismissible = param.barrierDismissible
|
|
227
|
+
barrierDismissible = param.barrierDismissible,
|
|
229
228
|
onDismiss = param.onDismiss
|
|
230
229
|
)
|
|
231
230
|
}
|