@momo-kits/native-kits 0.151.2-test.2 → 0.151.2-test.3
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/NavigationContainer.kt +3 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +35 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +4 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +3 -1
- package/package.json +1 -1
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":[]}
|
|
@@ -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
|
|
@@ -63,6 +64,7 @@ class Navigator {
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
@Immutable
|
|
66
68
|
data class MiniAppContext(
|
|
67
69
|
val appIcon: String = "",
|
|
68
70
|
val appName: Any? = null,
|
|
@@ -156,6 +158,7 @@ val AppLanguage = staticCompositionLocalOf<String?> {
|
|
|
156
158
|
null
|
|
157
159
|
}
|
|
158
160
|
|
|
161
|
+
@Immutable
|
|
159
162
|
data class KitConfig(
|
|
160
163
|
val trustBanner: TrustBannerData? = null,
|
|
161
164
|
val headerBar: String? = null,
|
|
@@ -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
|
-
|
|
155
|
+
val composition by rememberLottieComposition {
|
|
156
|
+
LottieCompositionSpec.JsonString(
|
|
157
|
+
Res.readBytes("files/spinner_white.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
|
+
),
|
|
149
171
|
modifier = Modifier.size(iconSize - 4.dp),
|
|
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
|
) {
|
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
|
/**
|
|
@@ -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,6 +67,7 @@ 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,
|
|
@@ -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
|
)
|