@momo-kits/native-kits 0.152.4-scale.4 → 0.152.4-scale.5
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/components/Input.kt +13 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +11 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +17 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +16 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +16 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScaleSizeScope.kt +0 -3
- package/local.properties +2 -2
- package/package.json +1 -1
|
@@ -45,7 +45,6 @@ import vn.momo.kits.const.Spacing
|
|
|
45
45
|
import vn.momo.kits.const.Typography
|
|
46
46
|
import vn.momo.kits.const.scaleSize
|
|
47
47
|
import vn.momo.kits.modifier.setAutomationId
|
|
48
|
-
import vn.momo.kits.navigation.ScaleSizeScope
|
|
49
48
|
|
|
50
49
|
data class InputSizeDetail(
|
|
51
50
|
val borderWidth: Dp,
|
|
@@ -216,14 +215,16 @@ fun Input(
|
|
|
216
215
|
if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
|
|
217
216
|
}
|
|
218
217
|
|
|
219
|
-
val fontSize =
|
|
220
|
-
val lineHeight =
|
|
218
|
+
val fontSize = 16.sp
|
|
219
|
+
val lineHeight = 24.sp
|
|
220
|
+
val scaleFontSize = scaleSize(fontSize)
|
|
221
|
+
val scaleLineHeight = scaleSize(lineHeight)
|
|
221
222
|
|
|
222
223
|
val textStyle = remember(textColor, fontWeight) {
|
|
223
224
|
TextStyle(
|
|
224
225
|
color = textColor,
|
|
225
|
-
fontSize =
|
|
226
|
-
lineHeight =
|
|
226
|
+
fontSize = scaleFontSize,
|
|
227
|
+
lineHeight = scaleLineHeight,
|
|
227
228
|
fontWeight = fontWeight.value
|
|
228
229
|
)
|
|
229
230
|
}
|
|
@@ -287,7 +288,7 @@ fun Input(
|
|
|
287
288
|
) {
|
|
288
289
|
Row(
|
|
289
290
|
modifier = Modifier.padding(horizontal = Spacing.S),
|
|
290
|
-
verticalAlignment = Alignment.
|
|
291
|
+
verticalAlignment = Alignment.CenterVertically
|
|
291
292
|
) {
|
|
292
293
|
Text(
|
|
293
294
|
floatingValue,
|
|
@@ -340,15 +341,12 @@ fun Input(
|
|
|
340
341
|
|
|
341
342
|
Box(Modifier.weight(1f), contentAlignment = Alignment.CenterStart) {
|
|
342
343
|
if (text.value.isEmpty()) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
color = placeholderColor
|
|
350
|
-
)
|
|
351
|
-
}
|
|
344
|
+
Text(
|
|
345
|
+
text = placeholder,
|
|
346
|
+
style = placeholderStyle,
|
|
347
|
+
color = placeholderColor
|
|
348
|
+
)
|
|
349
|
+
|
|
352
350
|
}
|
|
353
351
|
innerTextField()
|
|
354
352
|
}
|
|
@@ -116,7 +116,6 @@ fun InputPhoneNumber(
|
|
|
116
116
|
val testId = "input_phone_number"
|
|
117
117
|
|
|
118
118
|
val textStyle = scaleSize(size.values.textStyle.copy(color = textColor))
|
|
119
|
-
val placeholderStyle = scaleSize(size.values.textStyle.copy(color = placeholderColor))
|
|
120
119
|
|
|
121
120
|
Column(modifier = modifier.setAutomationId(testId)) {
|
|
122
121
|
BasicTextField(
|
|
@@ -166,13 +165,11 @@ fun InputPhoneNumber(
|
|
|
166
165
|
alignment = Alignment.Center
|
|
167
166
|
)
|
|
168
167
|
)
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
)
|
|
175
|
-
}
|
|
168
|
+
Text(
|
|
169
|
+
"+84",
|
|
170
|
+
color = textColor,
|
|
171
|
+
style = size.values.textStyle.copy(color = textColor),
|
|
172
|
+
)
|
|
176
173
|
|
|
177
174
|
// Divider
|
|
178
175
|
Box(modifier = Modifier.padding(horizontal = Spacing.M)) {
|
|
@@ -186,14 +183,12 @@ fun InputPhoneNumber(
|
|
|
186
183
|
|
|
187
184
|
Box(Modifier.weight(1f)) {
|
|
188
185
|
if (text.value.isEmpty()) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
)
|
|
196
|
-
}
|
|
186
|
+
Text(
|
|
187
|
+
text = placeholder,
|
|
188
|
+
style = size.values.textStyle.copy(color = placeholderColor),
|
|
189
|
+
color = placeholderColor,
|
|
190
|
+
modifier = Modifier.align(Alignment.CenterStart)
|
|
191
|
+
)
|
|
197
192
|
}
|
|
198
193
|
innerTextField()
|
|
199
194
|
}
|
|
@@ -40,7 +40,6 @@ import vn.momo.kits.const.Radius
|
|
|
40
40
|
import vn.momo.kits.const.Spacing
|
|
41
41
|
import vn.momo.kits.const.Typography
|
|
42
42
|
import vn.momo.kits.const.scaleSize
|
|
43
|
-
import vn.momo.kits.navigation.ScaleSizeScope
|
|
44
43
|
import vn.momo.kits.utils.ifTrue
|
|
45
44
|
|
|
46
45
|
@Composable
|
|
@@ -124,10 +123,18 @@ fun InputSearch(
|
|
|
124
123
|
placeholderColor = disabledColor
|
|
125
124
|
iconTintColor = disabledColor
|
|
126
125
|
}
|
|
127
|
-
|
|
128
|
-
val
|
|
126
|
+
val fontSize = 14.sp
|
|
127
|
+
val scaleFontSize = scaleSize(fontSize)
|
|
129
128
|
|
|
130
129
|
val textStyle = remember(textColor, inputSearchProps.fontWeight.value) {
|
|
130
|
+
TextStyle(
|
|
131
|
+
color = textColor,
|
|
132
|
+
fontSize = scaleFontSize,
|
|
133
|
+
fontWeight = inputSearchProps.fontWeight.value
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
val placeHolderStyle = remember(textColor, inputSearchProps.fontWeight.value) {
|
|
131
138
|
TextStyle(
|
|
132
139
|
color = textColor,
|
|
133
140
|
fontSize = fontSize,
|
|
@@ -183,15 +190,13 @@ fun InputSearch(
|
|
|
183
190
|
)
|
|
184
191
|
Box(Modifier.weight(1f)) {
|
|
185
192
|
if (inputSearchProps.text.value.isEmpty()) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)
|
|
194
|
-
}
|
|
193
|
+
Text(
|
|
194
|
+
text = inputSearchProps.placeholder,
|
|
195
|
+
style = placeHolderStyle,
|
|
196
|
+
maxLines = 1,
|
|
197
|
+
color = placeholderColor,
|
|
198
|
+
overflow = TextOverflow.Ellipsis
|
|
199
|
+
)
|
|
195
200
|
}
|
|
196
201
|
innerTextField()
|
|
197
202
|
}
|
|
@@ -37,7 +37,6 @@ import vn.momo.kits.const.AppTheme
|
|
|
37
37
|
import vn.momo.kits.const.Spacing
|
|
38
38
|
import vn.momo.kits.const.Typography
|
|
39
39
|
import vn.momo.kits.const.scaleSize
|
|
40
|
-
import vn.momo.kits.navigation.ScaleSizeScope
|
|
41
40
|
|
|
42
41
|
const val MAX_LENGTH = 300
|
|
43
42
|
val DEFAULT_HEIGHT = 104.dp
|
|
@@ -88,8 +87,10 @@ fun InputTextArea(
|
|
|
88
87
|
iconTintColor = disabledColor
|
|
89
88
|
}
|
|
90
89
|
|
|
91
|
-
val fontSize =
|
|
92
|
-
val lineHeight =
|
|
90
|
+
val fontSize = 16.sp
|
|
91
|
+
val lineHeight = 24.sp
|
|
92
|
+
val scaleFontSize = scaleSize(16.sp)
|
|
93
|
+
val scaleLineHeight = scaleSize(24.sp)
|
|
93
94
|
val scaleHeight = scaleSize(height)
|
|
94
95
|
|
|
95
96
|
Column {
|
|
@@ -99,8 +100,8 @@ fun InputTextArea(
|
|
|
99
100
|
value = text.value,
|
|
100
101
|
textStyle = TextStyle(
|
|
101
102
|
color = textColor,
|
|
102
|
-
fontSize =
|
|
103
|
-
lineHeight =
|
|
103
|
+
fontSize = scaleFontSize,
|
|
104
|
+
lineHeight = scaleLineHeight,
|
|
104
105
|
fontWeight = fontWeight.value
|
|
105
106
|
),
|
|
106
107
|
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = keyboardType),
|
|
@@ -129,7 +130,7 @@ fun InputTextArea(
|
|
|
129
130
|
Row(
|
|
130
131
|
modifier = Modifier
|
|
131
132
|
.padding(horizontal = Spacing.S),
|
|
132
|
-
verticalAlignment = Alignment.
|
|
133
|
+
verticalAlignment = Alignment.CenterVertically
|
|
133
134
|
) {
|
|
134
135
|
Text(
|
|
135
136
|
floatingValue,
|
|
@@ -179,18 +180,15 @@ fun InputTextArea(
|
|
|
179
180
|
) {
|
|
180
181
|
Box(Modifier.weight(1f)) {
|
|
181
182
|
if (text.value.isEmpty()) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
)
|
|
192
|
-
}
|
|
193
|
-
|
|
183
|
+
Text(
|
|
184
|
+
text = placeholder,
|
|
185
|
+
style = TextStyle(
|
|
186
|
+
fontSize = fontSize,
|
|
187
|
+
lineHeight = lineHeight,
|
|
188
|
+
fontWeight = fontWeight.value
|
|
189
|
+
),
|
|
190
|
+
color = placeholderColor
|
|
191
|
+
)
|
|
194
192
|
}
|
|
195
193
|
innerTextField()
|
|
196
194
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
package vn.momo.kits.components
|
|
2
2
|
|
|
3
|
-
import androidx.compose.foundation.border
|
|
4
|
-
import androidx.compose.foundation.layout.Box
|
|
5
3
|
import androidx.compose.runtime.Composable
|
|
6
4
|
import androidx.compose.runtime.remember
|
|
7
5
|
import androidx.compose.ui.Modifier
|
|
@@ -12,14 +10,11 @@ import androidx.compose.ui.text.style.TextAlign
|
|
|
12
10
|
import androidx.compose.ui.text.style.TextDecoration
|
|
13
11
|
import androidx.compose.ui.text.style.TextOverflow
|
|
14
12
|
import androidx.compose.ui.unit.TextUnit
|
|
15
|
-
import androidx.compose.ui.unit.dp
|
|
16
13
|
import vn.momo.kits.const.AppTheme
|
|
17
|
-
import vn.momo.kits.const.Colors
|
|
18
14
|
import vn.momo.kits.const.Typography
|
|
19
15
|
import vn.momo.kits.const.getFontFamily
|
|
20
16
|
import vn.momo.kits.const.scaleSize
|
|
21
17
|
import vn.momo.kits.modifier.setAutomationId
|
|
22
|
-
import vn.momo.kits.navigation.DisableScaleSize
|
|
23
18
|
|
|
24
19
|
@Composable
|
|
25
20
|
fun Text(
|
|
@@ -69,23 +64,20 @@ fun Text(
|
|
|
69
64
|
accessibilityId ?: text
|
|
70
65
|
}
|
|
71
66
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
67
|
+
androidx.compose.material3.Text(
|
|
68
|
+
modifier = modifier.setAutomationId(automationId, text),
|
|
69
|
+
text = text,
|
|
70
|
+
color = textColor,
|
|
71
|
+
style = optimizedStyle,
|
|
72
|
+
textAlign = textAlign,
|
|
73
|
+
fontSize = fontSize,
|
|
74
|
+
fontFamily = font,
|
|
75
|
+
maxLines = maxLines,
|
|
76
|
+
softWrap = softWrap,
|
|
77
|
+
letterSpacing = letterSpacing,
|
|
78
|
+
minLines = minLines,
|
|
79
|
+
textDecoration = textDecoration,
|
|
80
|
+
onTextLayout = onTextLayout,
|
|
81
|
+
overflow = overflow
|
|
82
|
+
)
|
|
91
83
|
}
|
|
@@ -15,7 +15,6 @@ import androidx.compose.ui.unit.sp
|
|
|
15
15
|
import org.jetbrains.compose.resources.Font
|
|
16
16
|
import org.jetbrains.compose.resources.FontResource
|
|
17
17
|
import org.jetbrains.compose.resources.InternalResourceApi
|
|
18
|
-
import vn.momo.kits.navigation.DisableScaleSize
|
|
19
18
|
import vn.momo.kits.navigation.ScaleSizeMaxRate
|
|
20
19
|
import vn.momo.kits.platform.getScreenDimensions
|
|
21
20
|
import kotlin.math.max
|
|
@@ -39,7 +38,6 @@ const val MAX_DEVICE_SCALE = 5
|
|
|
39
38
|
|
|
40
39
|
@Composable
|
|
41
40
|
fun scaleSize(size: Float): Float {
|
|
42
|
-
if (DisableScaleSize.current == true) return size
|
|
43
41
|
val scaleSizeMaxRate: Float = ScaleSizeMaxRate.current ?: MAX_FONT_SCALE
|
|
44
42
|
val deviceWidth = getScreenDimensions().width
|
|
45
43
|
val deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
|
|
@@ -67,7 +65,6 @@ fun scaleSize(size: Float): Float {
|
|
|
67
65
|
|
|
68
66
|
@Composable
|
|
69
67
|
fun scaleSize(size: TextUnit): TextUnit {
|
|
70
|
-
if (DisableScaleSize.current == true) return size
|
|
71
68
|
if (!size.isSp) return size
|
|
72
69
|
|
|
73
70
|
val density = LocalDensity.current
|
|
@@ -5,17 +5,14 @@ import androidx.compose.runtime.CompositionLocalProvider
|
|
|
5
5
|
import androidx.compose.runtime.staticCompositionLocalOf
|
|
6
6
|
|
|
7
7
|
val ScaleSizeMaxRate = staticCompositionLocalOf<Float?> { null }
|
|
8
|
-
val DisableScaleSize = staticCompositionLocalOf<Boolean> { false }
|
|
9
8
|
|
|
10
9
|
@Composable
|
|
11
10
|
fun ScaleSizeScope(
|
|
12
|
-
disableScale: Boolean = false,
|
|
13
11
|
scaleSizeMaxRate: Float? = null,
|
|
14
12
|
content: @Composable () -> Unit
|
|
15
13
|
) {
|
|
16
14
|
CompositionLocalProvider(
|
|
17
15
|
ScaleSizeMaxRate provides scaleSizeMaxRate,
|
|
18
|
-
DisableScaleSize provides disableScale
|
|
19
16
|
) {
|
|
20
17
|
content()
|
|
21
18
|
}
|
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
|
+
#Mon Dec 22 10:07:29 ICT 2025
|
|
8
|
+
sdk.dir=/Users/phuc/Library/Android/sdk
|