@momo-kits/native-kits 0.163.1-beta.11-debug → 0.163.1-beta.12-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/compose.podspec +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +18 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +15 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +13 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +3 -2
- 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 +1 -0
- package/gradle.properties +1 -1
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/local.properties +8 -0
- package/package.json +1 -1
package/compose/build.gradle.kts
CHANGED
package/compose/compose.podspec
CHANGED
|
@@ -209,6 +209,7 @@ 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}")
|
|
212
213
|
overscrollOffset = Offset(overscrollX, overscrollY)
|
|
213
214
|
|
|
214
215
|
return Offset(x, y)
|
|
@@ -147,17 +147,6 @@ 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
|
-
|
|
161
150
|
val colorList: Map<String, Color> = mapOf(
|
|
162
151
|
"black_01" to black_01,
|
|
163
152
|
"black_02" to black_02,
|
|
@@ -313,13 +302,5 @@ object Colors {
|
|
|
313
302
|
"red_09" to red_09,
|
|
314
303
|
"red_10" to red_10,
|
|
315
304
|
"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,
|
|
324
305
|
)
|
|
325
306
|
}
|
|
@@ -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
|
|
7
8
|
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,13 +18,18 @@ 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
|
|
22
21
|
|
|
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)
|
|
23
29
|
@Composable
|
|
24
|
-
|
|
30
|
+
fun Card(
|
|
25
31
|
useShadow: Boolean = false,
|
|
26
32
|
backgroundImage: String? = null,
|
|
27
|
-
contentPadding: PaddingValues = PaddingValues(Spacing.M),
|
|
28
33
|
modifier: Modifier = Modifier,
|
|
29
34
|
content: @Composable () -> Unit,
|
|
30
35
|
) {
|
|
@@ -34,12 +39,20 @@ internal fun Card(
|
|
|
34
39
|
var surface = modifier.fillMaxWidth().padding(horizontal = 12.dp)
|
|
35
40
|
if (useShadow) surface = surface.shadow(4.dp, shape)
|
|
36
41
|
surface = surface.clip(shape)
|
|
42
|
+
// The React kit drops the surface colour when a backgroundImage is supplied
|
|
43
|
+
// (`!!backgroundImage && { backgroundColor: undefined }`).
|
|
37
44
|
if (backgroundImage == null) surface = surface.background(AppTheme.current.colors.background.surface)
|
|
38
45
|
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.
|
|
39
49
|
if (backgroundImage != null) {
|
|
40
50
|
Image(source = backgroundImage, modifier = Modifier.matchParentSize())
|
|
41
51
|
}
|
|
42
|
-
BoxWithConstraints(modifier = Modifier.fillMaxWidth().padding(
|
|
52
|
+
BoxWithConstraints(modifier = Modifier.fillMaxWidth().padding(12.dp)) {
|
|
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.
|
|
43
56
|
val sizePerSpan = (maxWidth - gutter * (columns - 1)) / columns - 1.dp / columns
|
|
44
57
|
CompositionLocalProvider(LocalGridContext provides GridContext(columns, gutter, sizePerSpan)) {
|
|
45
58
|
FlowRow(
|
|
@@ -9,18 +9,30 @@ import androidx.compose.ui.Modifier
|
|
|
9
9
|
import androidx.compose.ui.unit.Dp
|
|
10
10
|
import androidx.compose.ui.unit.dp
|
|
11
11
|
|
|
12
|
-
|
|
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(
|
|
13
18
|
val numberOfColumns: Int = 12,
|
|
14
19
|
val gutter: Dp = 12.dp,
|
|
15
20
|
val sizePerSpan: Dp = 0.dp,
|
|
16
21
|
) {
|
|
22
|
+
/** Width covering `span` columns + the (span-1) gutters between them. */
|
|
17
23
|
fun sizeForSpan(span: Int): Dp = sizePerSpan * span + gutter * (span - 1)
|
|
18
24
|
}
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
/** Provided by Section/Card; null when an Item is rendered outside a grid. */
|
|
27
|
+
val LocalGridContext = compositionLocalOf<GridContext?> { null }
|
|
21
28
|
|
|
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
|
+
*/
|
|
22
34
|
@Composable
|
|
23
|
-
|
|
35
|
+
fun Item(
|
|
24
36
|
widthSpan: Int = 12,
|
|
25
37
|
heightSpan: Int = 0,
|
|
26
38
|
modifier: Modifier = Modifier,
|
|
@@ -3,6 +3,7 @@ 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
|
|
6
7
|
import androidx.compose.foundation.layout.FlowRow
|
|
7
8
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
8
9
|
import androidx.compose.foundation.layout.padding
|
|
@@ -12,8 +13,14 @@ import androidx.compose.ui.Modifier
|
|
|
12
13
|
import androidx.compose.ui.unit.dp
|
|
13
14
|
import vn.momo.kits.components.Image
|
|
14
15
|
|
|
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)
|
|
15
22
|
@Composable
|
|
16
|
-
|
|
23
|
+
fun Section(
|
|
17
24
|
useMargin: Boolean = true,
|
|
18
25
|
backgroundImage: String? = null,
|
|
19
26
|
modifier: Modifier = Modifier,
|
|
@@ -23,10 +30,15 @@ internal fun Section(
|
|
|
23
30
|
val gutter = 12.dp
|
|
24
31
|
val margin = if (useMargin) 12.dp else 0.dp
|
|
25
32
|
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).
|
|
26
35
|
if (backgroundImage != null) {
|
|
27
36
|
Image(source = backgroundImage, modifier = Modifier.matchParentSize())
|
|
28
37
|
}
|
|
29
38
|
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.
|
|
30
42
|
val sizePerSpan = (maxWidth - gutter * (columns - 1)) / columns - 1.dp / columns
|
|
31
43
|
CompositionLocalProvider(LocalGridContext provides GridContext(columns, gutter, sizePerSpan)) {
|
|
32
44
|
FlowRow(
|
|
@@ -43,7 +43,6 @@ 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
|
|
47
46
|
import vn.momo.kits.const.Typography
|
|
48
47
|
import vn.momo.kits.navigation.tracking.ScreenTracker
|
|
49
48
|
import vn.momo.kits.modifier.conditional
|
|
@@ -59,6 +58,8 @@ internal fun BottomSheet(
|
|
|
59
58
|
barrierDismissible: Boolean = true,
|
|
60
59
|
onDismiss: (() -> Unit)?
|
|
61
60
|
) {
|
|
61
|
+
val navigator = LocalNavigator.current
|
|
62
|
+
|
|
62
63
|
val screenHeightDp = getScreenHeight()
|
|
63
64
|
val screenHeightPx = with(LocalDensity.current) { screenHeightDp.toPx() }
|
|
64
65
|
val sheetOffset = remember { Animatable(screenHeightPx) }
|
|
@@ -161,7 +162,7 @@ internal fun BottomSheet(
|
|
|
161
162
|
.noFeedbackClickable { },
|
|
162
163
|
contentAlignment = Alignment.BottomCenter
|
|
163
164
|
) {
|
|
164
|
-
Column
|
|
165
|
+
Column {
|
|
165
166
|
Box(
|
|
166
167
|
modifier = Modifier
|
|
167
168
|
.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
|
|
283
|
+
!options.scrollData.scrollable -> 0.dp
|
|
284
284
|
else -> navigationBar
|
|
285
285
|
}
|
|
286
286
|
)
|
|
@@ -31,6 +31,7 @@ object ScreenTracker {
|
|
|
31
31
|
val previousScreen = lastScreenName
|
|
32
32
|
lastScreenName = screenName
|
|
33
33
|
|
|
34
|
+
println("Tracking screen navigated native kit: $screenName")
|
|
34
35
|
maxApi?.track(
|
|
35
36
|
eventName = "auto_screen_navigated",
|
|
36
37
|
params = buildBaseParams(context, screenName).apply {
|
package/gradle.properties
CHANGED
package/ios/native-kits.podspec
CHANGED
package/local.properties
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
+
# as it contains information specific to your local configuration.
|
|
3
|
+
#
|
|
4
|
+
# Location of the SDK. This is only used by Gradle.
|
|
5
|
+
# For customization when using a Version Control System, please read the
|
|
6
|
+
# header note.
|
|
7
|
+
#Wed Aug 21 14:20:12 ICT 2024
|
|
8
|
+
sdk.dir=/Users/huynhdung/Library/Android/sdk
|