@momo-kits/native-kits 0.162.23-debug → 0.162.24-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/compose/build.gradle.kts +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +1 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +19 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +5 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +3 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +1 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +2 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -1
- package/gradle.properties +1 -1
- package/package.json +1 -1
package/compose/build.gradle.kts
CHANGED
|
@@ -209,7 +209,6 @@ internal class CupertinoOverscrollEffect(
|
|
|
209
209
|
private fun availableDelta(delta: Offset, source: CupertinoScrollSource): Offset {
|
|
210
210
|
val (x, overscrollX) = availableDelta(delta.x, overscrollOffset.x, source)
|
|
211
211
|
val (y, overscrollY) = availableDelta(delta.y, overscrollOffset.y, source)
|
|
212
|
-
println("availableDelta delta=${delta.y} consumed y=$y overscrollY=$overscrollY source=${source}")
|
|
213
212
|
overscrollOffset = Offset(overscrollX, overscrollY)
|
|
214
213
|
|
|
215
214
|
return Offset(x, y)
|
|
@@ -147,6 +147,17 @@ object Colors {
|
|
|
147
147
|
val red_10 = Color(0xFFFEF4F4)
|
|
148
148
|
val red_11 = Color(0xFFFEF8F8)
|
|
149
149
|
|
|
150
|
+
// Translucent overlays, ported from the React kit's Consts (the reference
|
|
151
|
+
// palette). React spells them `#RRGGBBAA`; Compose's Color takes `0xAARRGGBB`.
|
|
152
|
+
val opacity_black_20 = Color(0x33000000)
|
|
153
|
+
val opacity_black_40 = Color(0x66000000)
|
|
154
|
+
val opacity_black_60 = Color(0x99000000)
|
|
155
|
+
val opacity_black_80 = Color(0xCC000000)
|
|
156
|
+
val opacity_white_20 = Color(0x33FFFFFF)
|
|
157
|
+
val opacity_white_40 = Color(0x66FFFFFF)
|
|
158
|
+
val opacity_white_60 = Color(0x99FFFFFF)
|
|
159
|
+
val opacity_white_80 = Color(0xCCFFFFFF)
|
|
160
|
+
|
|
150
161
|
val colorList: Map<String, Color> = mapOf(
|
|
151
162
|
"black_01" to black_01,
|
|
152
163
|
"black_02" to black_02,
|
|
@@ -302,5 +313,13 @@ object Colors {
|
|
|
302
313
|
"red_09" to red_09,
|
|
303
314
|
"red_10" to red_10,
|
|
304
315
|
"red_11" to red_11,
|
|
316
|
+
"opacity_black_20" to opacity_black_20,
|
|
317
|
+
"opacity_black_40" to opacity_black_40,
|
|
318
|
+
"opacity_black_60" to opacity_black_60,
|
|
319
|
+
"opacity_black_80" to opacity_black_80,
|
|
320
|
+
"opacity_white_20" to opacity_white_20,
|
|
321
|
+
"opacity_white_40" to opacity_white_40,
|
|
322
|
+
"opacity_white_60" to opacity_white_60,
|
|
323
|
+
"opacity_white_80" to opacity_white_80,
|
|
305
324
|
)
|
|
306
325
|
}
|
|
@@ -4,8 +4,8 @@ import androidx.compose.foundation.background
|
|
|
4
4
|
import androidx.compose.foundation.layout.Arrangement
|
|
5
5
|
import androidx.compose.foundation.layout.Box
|
|
6
6
|
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
7
|
-
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
|
8
7
|
import androidx.compose.foundation.layout.FlowRow
|
|
8
|
+
import androidx.compose.foundation.layout.PaddingValues
|
|
9
9
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
10
10
|
import androidx.compose.foundation.layout.padding
|
|
11
11
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
@@ -18,18 +18,13 @@ import androidx.compose.ui.unit.dp
|
|
|
18
18
|
import vn.momo.kits.components.Image
|
|
19
19
|
import vn.momo.kits.const.AppTheme
|
|
20
20
|
import vn.momo.kits.const.Radius
|
|
21
|
+
import vn.momo.kits.const.Spacing
|
|
21
22
|
|
|
22
|
-
/**
|
|
23
|
-
* A white rounded surface card that lays its [Item]s on a 12-column grid
|
|
24
|
-
* (React kit foundations/Layout/Card). 8dp gutter, 12dp padding, 12dp
|
|
25
|
-
* horizontal margin, Radius.M corners, background = theme surface, optional
|
|
26
|
-
* shadow or [backgroundImage]. Items flow left-to-right and wrap.
|
|
27
|
-
*/
|
|
28
|
-
@OptIn(ExperimentalLayoutApi::class)
|
|
29
23
|
@Composable
|
|
30
|
-
fun Card(
|
|
24
|
+
internal fun Card(
|
|
31
25
|
useShadow: Boolean = false,
|
|
32
26
|
backgroundImage: String? = null,
|
|
27
|
+
contentPadding: PaddingValues = PaddingValues(Spacing.M),
|
|
33
28
|
modifier: Modifier = Modifier,
|
|
34
29
|
content: @Composable () -> Unit,
|
|
35
30
|
) {
|
|
@@ -39,20 +34,12 @@ fun Card(
|
|
|
39
34
|
var surface = modifier.fillMaxWidth().padding(horizontal = 12.dp)
|
|
40
35
|
if (useShadow) surface = surface.shadow(4.dp, shape)
|
|
41
36
|
surface = surface.clip(shape)
|
|
42
|
-
// The React kit drops the surface colour when a backgroundImage is supplied
|
|
43
|
-
// (`!!backgroundImage && { backgroundColor: undefined }`).
|
|
44
37
|
if (backgroundImage == null) surface = surface.background(AppTheme.current.colors.background.surface)
|
|
45
38
|
Box(modifier = surface) {
|
|
46
|
-
// React renders this as an absolutely-filled child BEHIND the content
|
|
47
|
-
// (styles.imageBackground: position absolute, inset 0) — matchParentSize
|
|
48
|
-
// fills the card without contributing to its measured size.
|
|
49
39
|
if (backgroundImage != null) {
|
|
50
40
|
Image(source = backgroundImage, modifier = Modifier.matchParentSize())
|
|
51
41
|
}
|
|
52
|
-
BoxWithConstraints(modifier = Modifier.fillMaxWidth().padding(
|
|
53
|
-
// `- 1.dp / columns` mirrors the React kit's `- 1 / numberOfColumns`
|
|
54
|
-
// nudge: it keeps a full 12-span Item ~1dp narrower than the content
|
|
55
|
-
// box so sub-pixel rounding can never overflow and wrap the FlowRow.
|
|
42
|
+
BoxWithConstraints(modifier = Modifier.fillMaxWidth().padding(contentPadding)) {
|
|
56
43
|
val sizePerSpan = (maxWidth - gutter * (columns - 1)) / columns - 1.dp / columns
|
|
57
44
|
CompositionLocalProvider(LocalGridContext provides GridContext(columns, gutter, sizePerSpan)) {
|
|
58
45
|
FlowRow(
|
|
@@ -9,30 +9,18 @@ import androidx.compose.ui.Modifier
|
|
|
9
9
|
import androidx.compose.ui.unit.Dp
|
|
10
10
|
import androidx.compose.ui.unit.dp
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
* Grid context supplied by [Section] / [Card]: the per-span cell size + gutter,
|
|
14
|
-
* so an [Item] can resolve its pixel width from a 1-12 `widthSpan`. Mirrors the
|
|
15
|
-
* React kit's GridContext (foundations/Layout/GridSystem).
|
|
16
|
-
*/
|
|
17
|
-
data class GridContext(
|
|
12
|
+
internal data class GridContext(
|
|
18
13
|
val numberOfColumns: Int = 12,
|
|
19
14
|
val gutter: Dp = 12.dp,
|
|
20
15
|
val sizePerSpan: Dp = 0.dp,
|
|
21
16
|
) {
|
|
22
|
-
/** Width covering `span` columns + the (span-1) gutters between them. */
|
|
23
17
|
fun sizeForSpan(span: Int): Dp = sizePerSpan * span + gutter * (span - 1)
|
|
24
18
|
}
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
val LocalGridContext = compositionLocalOf<GridContext?> { null }
|
|
20
|
+
internal val LocalGridContext = compositionLocalOf<GridContext?> { null }
|
|
28
21
|
|
|
29
|
-
/**
|
|
30
|
-
* A grid cell. `widthSpan` (1-12) sets the width as a fraction of the parent
|
|
31
|
-
* Section/Card; the parent's flex-wrap flows the cells into rows. Rendered
|
|
32
|
-
* outside a grid it just wraps its content at its natural size.
|
|
33
|
-
*/
|
|
34
22
|
@Composable
|
|
35
|
-
fun Item(
|
|
23
|
+
internal fun Item(
|
|
36
24
|
widthSpan: Int = 12,
|
|
37
25
|
heightSpan: Int = 0,
|
|
38
26
|
modifier: Modifier = Modifier,
|
|
@@ -3,7 +3,6 @@ package vn.momo.kits.layout
|
|
|
3
3
|
import androidx.compose.foundation.layout.Arrangement
|
|
4
4
|
import androidx.compose.foundation.layout.Box
|
|
5
5
|
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
6
|
-
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
|
7
6
|
import androidx.compose.foundation.layout.FlowRow
|
|
8
7
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
9
8
|
import androidx.compose.foundation.layout.padding
|
|
@@ -13,14 +12,8 @@ import androidx.compose.ui.Modifier
|
|
|
13
12
|
import androidx.compose.ui.unit.dp
|
|
14
13
|
import vn.momo.kits.components.Image
|
|
15
14
|
|
|
16
|
-
/**
|
|
17
|
-
* A transparent 12-column grid row that wraps its [Item]s (React kit
|
|
18
|
-
* foundations/Layout/Section). 12dp gutter; 12dp horizontal margin when
|
|
19
|
-
* `useMargin`; optional [backgroundImage]. Items flow left-to-right and wrap.
|
|
20
|
-
*/
|
|
21
|
-
@OptIn(ExperimentalLayoutApi::class)
|
|
22
15
|
@Composable
|
|
23
|
-
fun Section(
|
|
16
|
+
internal fun Section(
|
|
24
17
|
useMargin: Boolean = true,
|
|
25
18
|
backgroundImage: String? = null,
|
|
26
19
|
modifier: Modifier = Modifier,
|
|
@@ -30,15 +23,10 @@ fun Section(
|
|
|
30
23
|
val gutter = 12.dp
|
|
31
24
|
val margin = if (useMargin) 12.dp else 0.dp
|
|
32
25
|
Box(modifier = modifier.fillMaxWidth().padding(horizontal = margin)) {
|
|
33
|
-
// React renders this as an absolutely-filled child behind the content
|
|
34
|
-
// (styles.imageBackground: position absolute, inset 0).
|
|
35
26
|
if (backgroundImage != null) {
|
|
36
27
|
Image(source = backgroundImage, modifier = Modifier.matchParentSize())
|
|
37
28
|
}
|
|
38
29
|
BoxWithConstraints(modifier = Modifier.fillMaxWidth()) {
|
|
39
|
-
// `- 1.dp / columns` mirrors the React kit's `- 1 / numberOfColumns`
|
|
40
|
-
// nudge — keeps a full 12-span Item ~1dp inside the content box so
|
|
41
|
-
// sub-pixel rounding can never overflow and wrap the FlowRow.
|
|
42
30
|
val sizePerSpan = (maxWidth - gutter * (columns - 1)) / columns - 1.dp / columns
|
|
43
31
|
CompositionLocalProvider(LocalGridContext provides GridContext(columns, gutter, sizePerSpan)) {
|
|
44
32
|
FlowRow(
|
|
@@ -43,6 +43,7 @@ import vn.momo.kits.const.Radius
|
|
|
43
43
|
import vn.momo.kits.const.Spacing
|
|
44
44
|
import vn.momo.kits.application.LocalContext
|
|
45
45
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
46
|
+
import vn.momo.kits.const.AppNavigationBar
|
|
46
47
|
import vn.momo.kits.const.Typography
|
|
47
48
|
import vn.momo.kits.navigation.tracking.ScreenTracker
|
|
48
49
|
import vn.momo.kits.modifier.conditional
|
|
@@ -58,8 +59,6 @@ internal fun BottomSheet(
|
|
|
58
59
|
barrierDismissible: Boolean = true,
|
|
59
60
|
onDismiss: (() -> Unit)?
|
|
60
61
|
) {
|
|
61
|
-
val navigator = LocalNavigator.current
|
|
62
|
-
|
|
63
62
|
val screenHeightDp = getScreenHeight()
|
|
64
63
|
val screenHeightPx = with(LocalDensity.current) { screenHeightDp.toPx() }
|
|
65
64
|
val sheetOffset = remember { Animatable(screenHeightPx) }
|
|
@@ -162,7 +161,7 @@ internal fun BottomSheet(
|
|
|
162
161
|
.noFeedbackClickable { },
|
|
163
162
|
contentAlignment = Alignment.BottomCenter
|
|
164
163
|
) {
|
|
165
|
-
Column {
|
|
164
|
+
Column(Modifier.padding(bottom = AppNavigationBar.current)) {
|
|
166
165
|
Box(
|
|
167
166
|
modifier = Modifier
|
|
168
167
|
.height(72.dp)
|
|
@@ -280,7 +280,7 @@ internal fun ColumnScope.MainContent(content: @Composable () -> Unit, isBottomTa
|
|
|
280
280
|
bottom = when {
|
|
281
281
|
options.hasFooter() || isBottomTabRoot -> 0.dp
|
|
282
282
|
isBottomTabChild -> bottomTabBarInset() + (navigationBar - keyboardSizeState().value).coerceAtLeast(0.dp)
|
|
283
|
-
!options.scrollData.scrollable -> 0.dp
|
|
283
|
+
!options.scrollData.scrollable && options.scrollData.scrollState == null -> 0.dp
|
|
284
284
|
else -> navigationBar
|
|
285
285
|
}
|
|
286
286
|
)
|
|
@@ -31,7 +31,6 @@ object ScreenTracker {
|
|
|
31
31
|
val previousScreen = lastScreenName
|
|
32
32
|
lastScreenName = screenName
|
|
33
33
|
|
|
34
|
-
println("Tracking screen navigated native kit: $screenName")
|
|
35
34
|
maxApi?.track(
|
|
36
35
|
eventName = "auto_screen_navigated",
|
|
37
36
|
params = buildBaseParams(context, screenName).apply {
|
package/gradle.properties
CHANGED