@momo-kits/native-kits 0.89.27 → 0.89.29-beta.0
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/src/commonMain/kotlin/vn/momo/kits/application/Components.kt +36 -31
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +34 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +3 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +2 -2
- package/local.properties +2 -2
- package/package.json +1 -1
- package/android/android.iml +0 -11
|
@@ -88,7 +88,7 @@ fun HeaderImage(
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
HeaderType.SURFACE -> {
|
|
91
|
-
val height =statusBarHeight + 52.dp
|
|
91
|
+
val height = statusBarHeight + 52.dp
|
|
92
92
|
Box(
|
|
93
93
|
modifier = Modifier.fillMaxWidth().height(height)
|
|
94
94
|
.background(AppTheme.current.colors.background.surface)
|
|
@@ -158,37 +158,42 @@ fun Header(
|
|
|
158
158
|
verticalAlignment = Alignment.CenterVertically,
|
|
159
159
|
horizontalArrangement = Arrangement.SpaceBetween
|
|
160
160
|
) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
161
|
+
Box {
|
|
162
|
+
if (isBack) {
|
|
163
|
+
Box(
|
|
164
|
+
modifier = Modifier
|
|
165
|
+
.size(28.dp)
|
|
166
|
+
.then(
|
|
167
|
+
if (headerType == HeaderType.SURFACE) {
|
|
168
|
+
Modifier.border(
|
|
169
|
+
0.5.dp,
|
|
170
|
+
Colors.black_20.copy(alpha = 0.4f),
|
|
171
|
+
RoundedCornerShape(100)
|
|
172
|
+
)
|
|
173
|
+
} else {
|
|
174
|
+
Modifier
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
.background(
|
|
178
|
+
backgroundButton,
|
|
179
|
+
RoundedCornerShape(100)
|
|
180
|
+
)
|
|
181
|
+
.clickable(
|
|
182
|
+
onClick = goBack
|
|
183
|
+
)
|
|
184
|
+
.padding(Spacing.XS)
|
|
185
|
+
.semantics {
|
|
186
|
+
contentDescription = "btn_navigation_back"; testTag =
|
|
187
|
+
"btn_navigation_back"
|
|
188
|
+
},
|
|
189
|
+
contentAlignment = Alignment.Center
|
|
190
|
+
) {
|
|
191
|
+
Icon(
|
|
192
|
+
source = "ic_back_ios",
|
|
193
|
+
color = if (headerType == HeaderType.SURFACE && animatedHeader !== null) tintIconColorAnim else tintIconColor,
|
|
194
|
+
size = 20.dp,
|
|
179
195
|
)
|
|
180
|
-
|
|
181
|
-
onClick = goBack
|
|
182
|
-
)
|
|
183
|
-
.padding(Spacing.XS)
|
|
184
|
-
.semantics { contentDescription = "btn_navigation_back"; testTag = "btn_navigation_back" },
|
|
185
|
-
contentAlignment = Alignment.Center
|
|
186
|
-
) {
|
|
187
|
-
Icon(
|
|
188
|
-
source = "ic_back_ios",
|
|
189
|
-
color = if (headerType == HeaderType.SURFACE && animatedHeader !== null) tintIconColorAnim else tintIconColor,
|
|
190
|
-
size = 20.dp,
|
|
191
|
-
)
|
|
196
|
+
}
|
|
192
197
|
}
|
|
193
198
|
}
|
|
194
199
|
Box(Modifier.graphicsLayer {
|
|
@@ -75,7 +75,7 @@ fun OTPCaret() {
|
|
|
75
75
|
|
|
76
76
|
@Composable
|
|
77
77
|
fun InputOTP(
|
|
78
|
-
length: Int =
|
|
78
|
+
length: Int? = null,
|
|
79
79
|
errorMessage: String = "",
|
|
80
80
|
errorSpacing: Boolean = false,
|
|
81
81
|
floatingValue: String = "Label",
|
|
@@ -92,7 +92,10 @@ fun InputOTP(
|
|
|
92
92
|
var isBlurred = false
|
|
93
93
|
|
|
94
94
|
val handleChangeText: (String) -> Unit = { text ->
|
|
95
|
-
if (text.length <= MAX_LENGTH &&
|
|
95
|
+
if (text.length <= MAX_LENGTH &&
|
|
96
|
+
(dataType != "number" || !text.any { !it.isDigit() }) &&
|
|
97
|
+
(text.length < value.length || value.length < text.length)
|
|
98
|
+
) {
|
|
96
99
|
value = text
|
|
97
100
|
onChangeText(text)
|
|
98
101
|
}
|
|
@@ -153,27 +156,41 @@ fun InputOTP(
|
|
|
153
156
|
horizontalArrangement = Arrangement.SpaceBetween,
|
|
154
157
|
verticalAlignment = Alignment.CenterVertically
|
|
155
158
|
) {
|
|
156
|
-
|
|
159
|
+
if (length != null) {
|
|
160
|
+
for (i in 0 until length) {
|
|
161
|
+
if (isFocused && value.length == i) {
|
|
162
|
+
OTPCaret()
|
|
163
|
+
} else {
|
|
164
|
+
val textColor =
|
|
165
|
+
if (value.getOrNull(i) != null) AppTheme.current.colors.text.default else AppTheme.current.colors.text.hint
|
|
166
|
+
val typo =
|
|
167
|
+
if (value.getOrNull(i) != null) Typography.titleS else Typography.descriptionDefault
|
|
168
|
+
Text(
|
|
169
|
+
text = value.getOrNull(i)?.toString() ?: "-",
|
|
170
|
+
color = textColor,
|
|
171
|
+
style = typo
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
if (i != length - 1) Spacer(Modifier.width(Spacing.L))
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
157
177
|
if (value.isEmpty() && !isFocused && placeholder.isNotEmpty()) {
|
|
158
178
|
return@BasicTextField Text(
|
|
159
179
|
text = placeholder,
|
|
160
180
|
color = AppTheme.current.colors.text.hint
|
|
161
181
|
)
|
|
162
|
-
}
|
|
163
|
-
if (isFocused && value.length == i) {
|
|
164
|
-
OTPCaret();
|
|
165
182
|
} else {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
183
|
+
for (i in value.indices) {
|
|
184
|
+
Text(
|
|
185
|
+
style = Typography.titleS,
|
|
186
|
+
text = value[i].toString()
|
|
187
|
+
)
|
|
188
|
+
if (i != value.length - 1 || (isFocused && value.length != MAX_LENGTH)) {
|
|
189
|
+
Spacer(Modifier.width(Spacing.L))
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (isFocused && value.length != MAX_LENGTH) OTPCaret()
|
|
175
193
|
}
|
|
176
|
-
if (i != length - 1) Spacer(Modifier.width(Spacing.L))
|
|
177
194
|
}
|
|
178
195
|
}
|
|
179
196
|
}
|
|
@@ -182,4 +199,4 @@ fun InputOTP(
|
|
|
182
199
|
)
|
|
183
200
|
ErrorView(errorMessage, errorSpacing, "")
|
|
184
201
|
}
|
|
185
|
-
}
|
|
202
|
+
}
|
|
@@ -25,9 +25,10 @@ fun Text(
|
|
|
25
25
|
overflow: TextOverflow = TextOverflow.Clip,
|
|
26
26
|
textDecoration: TextDecoration? = null,
|
|
27
27
|
onTextLayout: ((TextLayoutResult) -> Unit)? = null,
|
|
28
|
+
fontFamily: String = "SFProText"
|
|
28
29
|
) {
|
|
29
30
|
val fontSize = scaleSize(style.fontSize.value).sp
|
|
30
|
-
val
|
|
31
|
+
val font = getFontFamily(fontFamily, style.fontWeight)
|
|
31
32
|
|
|
32
33
|
androidx.compose.material3.Text(
|
|
33
34
|
modifier = modifier,
|
|
@@ -36,7 +37,7 @@ fun Text(
|
|
|
36
37
|
style = style,
|
|
37
38
|
textAlign = textAlign,
|
|
38
39
|
fontSize = fontSize,
|
|
39
|
-
fontFamily =
|
|
40
|
+
fontFamily = font,
|
|
40
41
|
maxLines = maxLines,
|
|
41
42
|
textDecoration = textDecoration,
|
|
42
43
|
onTextLayout = onTextLayout,
|
|
@@ -27,10 +27,10 @@ fun scaleSize(size: Float): Float {
|
|
|
27
27
|
|
|
28
28
|
@OptIn(InternalResourceApi::class)
|
|
29
29
|
@Composable
|
|
30
|
-
fun getFont(font: String): FontFamily {
|
|
30
|
+
fun getFont(font: String, ext: String = "ttf"): FontFamily {
|
|
31
31
|
val fontResource = FontResource(
|
|
32
32
|
"font:${font}",
|
|
33
|
-
setOf(ResourceItem(setOf(), "
|
|
33
|
+
setOf(ResourceItem(setOf(), "fonts/${font}.${ext}", -1, -1))
|
|
34
34
|
)
|
|
35
35
|
return FontFamily(Font(fontResource))
|
|
36
36
|
}
|
package/local.properties
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
# Location of the SDK. This is only used by Gradle.
|
|
5
5
|
# For customization when using a Version Control System, please read the
|
|
6
6
|
# header note.
|
|
7
|
-
#
|
|
8
|
-
sdk.dir=/Users/
|
|
7
|
+
#Wed Aug 21 14:20:12 ICT 2024
|
|
8
|
+
sdk.dir=/Users/huynhdung/Library/Android/sdk
|
package/package.json
CHANGED
package/android/android.iml
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="JAVA_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
-
<exclude-output />
|
|
5
|
-
<content url="file://$MODULE_DIR$">
|
|
6
|
-
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" />
|
|
7
|
-
</content>
|
|
8
|
-
<orderEntry type="inheritedJdk" />
|
|
9
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
-
</component>
|
|
11
|
-
</module>
|