@momo-kits/native-kits 0.89.19 → 0.89.20
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 +18 -14
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +22 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Components.kt +71 -25
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +200 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +47 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +7 -139
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +89 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +17 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +6 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +36 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +54 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +155 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +2 -20
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +185 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +2 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +58 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +37 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +65 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +43 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +14 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +28 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +1 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +18 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -23
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +33 -0
- package/package.json +1 -1
- package/settings.gradle.kts +1 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/utils/Platform.kt +0 -3
- package/compose/src/androidMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +0 -8
- package/compose/src/androidMain/kotlin/vn/momo/kits/utils/Utils.android.kt +0 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Platform.kt +0 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +0 -5
- package/compose/src/iosMain/kotlin/vn/momo/kits/utils/Platform.kt +0 -3
- package/compose/src/iosMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +0 -9
- package/compose/src/iosMain/kotlin/vn/momo/kits/utils/Utils.ios.kt +0 -18
|
@@ -11,13 +11,13 @@ import org.jetbrains.compose.resources.Font
|
|
|
11
11
|
import org.jetbrains.compose.resources.FontResource
|
|
12
12
|
import org.jetbrains.compose.resources.InternalResourceApi
|
|
13
13
|
import org.jetbrains.compose.resources.ResourceItem
|
|
14
|
-
import vn.momo.kits.
|
|
14
|
+
import vn.momo.kits.platform.getScreenDimensions
|
|
15
15
|
|
|
16
16
|
const val DEFAULT_SCREEN_SIZE = 375f
|
|
17
17
|
|
|
18
18
|
@Composable
|
|
19
19
|
fun scaleSize(size: Float): Float {
|
|
20
|
-
val deviceWidth = getScreenDimensions().
|
|
20
|
+
val deviceWidth = getScreenDimensions().width
|
|
21
21
|
val scaleRate = deviceWidth / DEFAULT_SCREEN_SIZE
|
|
22
22
|
if (scaleRate > 1) {
|
|
23
23
|
return if ((scaleRate * size) > (size + 5)) size + 5 else scaleRate * size
|
|
@@ -1,2 +1,30 @@
|
|
|
1
1
|
package vn.momo.kits.layout
|
|
2
2
|
|
|
3
|
+
import androidx.compose.foundation.layout.Box
|
|
4
|
+
import androidx.compose.foundation.layout.height
|
|
5
|
+
import androidx.compose.foundation.layout.width
|
|
6
|
+
import androidx.compose.runtime.Composable
|
|
7
|
+
import androidx.compose.ui.Modifier
|
|
8
|
+
import androidx.compose.ui.unit.Dp
|
|
9
|
+
|
|
10
|
+
data class GridContext (
|
|
11
|
+
val numberOfColumns: Number,
|
|
12
|
+
val gutterSize: Number,
|
|
13
|
+
val sizePerSpan: Number,
|
|
14
|
+
val getSizeSpan: (Number) -> Number
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
@Composable
|
|
18
|
+
fun Item(heightSpan: Number = 1,
|
|
19
|
+
widthSpan: Number = 1,
|
|
20
|
+
content: @Composable() () -> Unit,
|
|
21
|
+
modifier: Modifier = Modifier,
|
|
22
|
+
grid: GridContext) {
|
|
23
|
+
|
|
24
|
+
val widthItem = grid.getSizeSpan(widthSpan)
|
|
25
|
+
val heightItem = grid.getSizeSpan(heightSpan)
|
|
26
|
+
|
|
27
|
+
Box(modifier = modifier.width(width = Dp(widthItem.toFloat())).height(height = Dp(heightItem.toFloat()))) {
|
|
28
|
+
content()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -8,7 +8,7 @@ import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
|
|
|
8
8
|
import androidx.compose.ui.graphics.toArgb
|
|
9
9
|
import androidx.compose.ui.unit.Dp
|
|
10
10
|
import androidx.compose.ui.unit.dp
|
|
11
|
-
import vn.momo.kits.
|
|
11
|
+
import vn.momo.kits.platform.setMaskFilter
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
fun Modifier.shadow(
|
|
@@ -29,7 +29,6 @@ fun Modifier.shadow(
|
|
|
29
29
|
val topPixel = (0f - spreadPixel) + offsetY.toPx()
|
|
30
30
|
val rightPixel = (this.size.width + spreadPixel)
|
|
31
31
|
val bottomPixel = (0f + spreadPixel) - offsetY.toPx()
|
|
32
|
-
// val bottomPixel = if (offsetY < 0.dp) 0f else this.size.height + spreadPixel
|
|
33
32
|
|
|
34
33
|
if (blurRadius != 0f) {
|
|
35
34
|
frameworkPaint.setMaskFilter(blurRadius)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package vn.momo.kits.platform
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.Composable
|
|
4
|
+
import androidx.compose.ui.graphics.NativePaint
|
|
5
|
+
|
|
6
|
+
data class ScreenDimension(
|
|
7
|
+
val width: Int,
|
|
8
|
+
val height: Int,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
expect fun getPlatformName(): String
|
|
12
|
+
|
|
13
|
+
expect fun disableOverscroll(): Unit
|
|
14
|
+
|
|
15
|
+
@Composable
|
|
16
|
+
expect fun getScreenDimensions(): ScreenDimension
|
|
17
|
+
|
|
18
|
+
expect fun NativePaint.setMaskFilter(blurRadius: Float)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
package vn.momo.kits.utils
|
|
2
2
|
|
|
3
|
-
import androidx.compose.runtime.Composable
|
|
4
3
|
import androidx.compose.ui.Modifier
|
|
5
4
|
import androidx.compose.ui.composed
|
|
6
5
|
import androidx.compose.ui.draw.drawBehind
|
|
@@ -11,10 +10,6 @@ import androidx.compose.ui.unit.Dp
|
|
|
11
10
|
import androidx.compose.ui.unit.dp
|
|
12
11
|
import kotlin.math.abs
|
|
13
12
|
|
|
14
|
-
data class ScreenDimension(
|
|
15
|
-
val screenWidth: Int,
|
|
16
|
-
val screenHeight: Int,
|
|
17
|
-
)
|
|
18
13
|
|
|
19
14
|
internal fun Modifier.bottomBorder(strokeWidth: Dp, color: Color) = composed(
|
|
20
15
|
factory = {
|
|
@@ -77,21 +72,3 @@ fun formatNumberToMoney(number: Long, currency: String = "đ"): String {
|
|
|
77
72
|
|
|
78
73
|
return result + currency
|
|
79
74
|
}
|
|
80
|
-
|
|
81
|
-
@Composable
|
|
82
|
-
expect fun getScreenDimensions(): ScreenDimension
|
|
83
|
-
|
|
84
|
-
val primaryColors = listOf(
|
|
85
|
-
Color(0xFFF0F0F0),
|
|
86
|
-
Color(0xFFEB2F96),
|
|
87
|
-
Color(0xFF962AF0),
|
|
88
|
-
Color(0xFF4E4BFF),
|
|
89
|
-
Color(0xFF007AFF),
|
|
90
|
-
Color(0xFF13C2C2),
|
|
91
|
-
Color(0xFF34C759),
|
|
92
|
-
Color(0xFFA0D911),
|
|
93
|
-
Color(0xFFFFCC00),
|
|
94
|
-
Color(0xFFFA8C16),
|
|
95
|
-
Color(0xFFFA541C),
|
|
96
|
-
Color(0xFFF5222D)
|
|
97
|
-
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
package vn.momo.kits.platform
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
4
|
+
import androidx.compose.foundation.gestures.optOutOfCupertinoOverscroll
|
|
5
|
+
import androidx.compose.runtime.Composable
|
|
6
|
+
import androidx.compose.ui.graphics.NativePaint
|
|
7
|
+
import kotlinx.cinterop.ExperimentalForeignApi
|
|
8
|
+
import kotlinx.cinterop.get
|
|
9
|
+
import kotlinx.cinterop.memScoped
|
|
10
|
+
import org.jetbrains.skia.FilterBlurMode
|
|
11
|
+
import org.jetbrains.skia.MaskFilter
|
|
12
|
+
import platform.UIKit.UIScreen
|
|
13
|
+
|
|
14
|
+
actual fun getPlatformName(): String = "iOS"
|
|
15
|
+
|
|
16
|
+
@OptIn(ExperimentalFoundationApi::class)
|
|
17
|
+
actual fun disableOverscroll() {
|
|
18
|
+
optOutOfCupertinoOverscroll()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@OptIn(ExperimentalForeignApi::class)
|
|
22
|
+
@Composable
|
|
23
|
+
actual fun getScreenDimensions(): ScreenDimension = memScoped {
|
|
24
|
+
val config = UIScreen.mainScreen.bounds.ptr[0]
|
|
25
|
+
return ScreenDimension(
|
|
26
|
+
config.size.width.toInt(),
|
|
27
|
+
config.size.height.toInt()
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
actual fun NativePaint.setMaskFilter(blurRadius: Float) {
|
|
32
|
+
this.maskFilter = MaskFilter.makeBlur(FilterBlurMode.NORMAL, blurRadius / 2, true)
|
|
33
|
+
}
|
package/package.json
CHANGED
package/settings.gradle.kts
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.utils
|
|
2
|
-
|
|
3
|
-
import androidx.compose.runtime.Composable
|
|
4
|
-
import androidx.compose.ui.platform.LocalConfiguration
|
|
5
|
-
import androidx.compose.ui.text.font.Font
|
|
6
|
-
import androidx.compose.ui.text.font.FontFamily
|
|
7
|
-
|
|
8
|
-
@Composable
|
|
9
|
-
actual fun getScreenDimensions(): ScreenDimension {
|
|
10
|
-
val config = LocalConfiguration.current
|
|
11
|
-
return ScreenDimension(
|
|
12
|
-
config.screenWidthDp, config.screenHeightDp
|
|
13
|
-
)
|
|
14
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.utils
|
|
2
|
-
|
|
3
|
-
import androidx.compose.ui.graphics.NativePaint
|
|
4
|
-
import org.jetbrains.skia.FilterBlurMode
|
|
5
|
-
import org.jetbrains.skia.MaskFilter
|
|
6
|
-
|
|
7
|
-
actual fun NativePaint.setMaskFilter(blurRadius: Float) {
|
|
8
|
-
this.maskFilter = MaskFilter.makeBlur(FilterBlurMode.NORMAL, blurRadius / 2, true)
|
|
9
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.utils
|
|
2
|
-
|
|
3
|
-
import androidx.compose.runtime.Composable
|
|
4
|
-
import androidx.compose.ui.text.font.FontFamily
|
|
5
|
-
import kotlinx.cinterop.ExperimentalForeignApi
|
|
6
|
-
import kotlinx.cinterop.get
|
|
7
|
-
import kotlinx.cinterop.memScoped
|
|
8
|
-
import platform.UIKit.UIScreen
|
|
9
|
-
|
|
10
|
-
@OptIn(ExperimentalForeignApi::class)
|
|
11
|
-
@Composable
|
|
12
|
-
actual fun getScreenDimensions(): ScreenDimension = memScoped {
|
|
13
|
-
val config = UIScreen.mainScreen.bounds.ptr[0]
|
|
14
|
-
return ScreenDimension(
|
|
15
|
-
config.size.width.toInt(),
|
|
16
|
-
config.size.height.toInt()
|
|
17
|
-
)
|
|
18
|
-
}
|