@momo-kits/native-kits 0.153.1-scaleSize.3 → 0.154.1-beta.1
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/Badge.kt +3 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +21 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +16 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +7 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +4 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +4 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +23 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +17 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/{navigation → components}/ScaleSizeScope.kt +6 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +2 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +34 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +9 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +1 -1
- package/local.properties +2 -2
- package/package.json +2 -2
|
@@ -59,11 +59,12 @@ fun Badge(label: String = "Label", backgroundColor: Color? = null) {
|
|
|
59
59
|
if (backgroundColor != null && primaryColors.contains(backgroundColor)) {
|
|
60
60
|
badgeColor = backgroundColor
|
|
61
61
|
}
|
|
62
|
+
val scaleSize = scaleSize(16f)
|
|
62
63
|
|
|
63
64
|
Box(
|
|
64
65
|
modifier = Modifier
|
|
65
|
-
.height(scaleSize
|
|
66
|
-
.widthIn(min = scaleSize
|
|
66
|
+
.height(scaleSize.dp)
|
|
67
|
+
.widthIn(min = scaleSize.dp)
|
|
67
68
|
.background(color = badgeColor, shape = RoundedCornerShape(Radius.M))
|
|
68
69
|
.border(width = 1.dp, shape = RoundedCornerShape(Radius.M), color = Colors.black_01)
|
|
69
70
|
.padding(horizontal = Spacing.XS), contentAlignment = Alignment.Center
|
|
@@ -60,27 +60,29 @@ fun Chip(
|
|
|
60
60
|
val (height, horizontal, iconSize, iconSpacing) =
|
|
61
61
|
listOf(scaleSize(dims.height), scaleSize(dims.horizontal), scaleSize(dims.iconSize), scaleSize(dims.iconSpacing))
|
|
62
62
|
|
|
63
|
+
val radius = scaleSize(Radius.L)
|
|
64
|
+
|
|
63
65
|
Row(
|
|
64
66
|
modifier
|
|
65
67
|
.wrapContentWidth()
|
|
66
|
-
.height(height)
|
|
67
|
-
.clip(RoundedCornerShape(
|
|
68
|
+
.height(height.dp)
|
|
69
|
+
.clip(RoundedCornerShape(radius))
|
|
68
70
|
.background(bg)
|
|
69
71
|
.conditional(selected) {
|
|
70
|
-
Modifier.border(width = 2.dp, color = theme.colors.secondary, shape = RoundedCornerShape(
|
|
72
|
+
Modifier.border(width = 2.dp, color = theme.colors.secondary, shape = RoundedCornerShape(radius))
|
|
71
73
|
}
|
|
72
74
|
.activeOpacityClickable {
|
|
73
75
|
onClick()
|
|
74
76
|
}
|
|
75
|
-
.padding(horizontal = horizontal)
|
|
77
|
+
.padding(horizontal = horizontal.dp)
|
|
76
78
|
.conditional(accessibilityLabel != null) {
|
|
77
79
|
setAutomationId(accessibilityLabel.toString())
|
|
78
80
|
},
|
|
79
81
|
verticalAlignment = Alignment.CenterVertically,
|
|
80
|
-
horizontalArrangement = Arrangement.spacedBy(iconSpacing)
|
|
82
|
+
horizontalArrangement = Arrangement.spacedBy(iconSpacing.dp)
|
|
81
83
|
) {
|
|
82
84
|
if (iconLeft != null) {
|
|
83
|
-
Icon(source = iconLeft, size = dims.iconSize, color = leftTint)
|
|
85
|
+
Icon(source = iconLeft, size = dims.iconSize.dp, color = leftTint)
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
if (!label.isNullOrEmpty()) {
|
|
@@ -99,7 +101,7 @@ fun Chip(
|
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
if (iconRight != null) {
|
|
102
|
-
Icon(source = iconRight, size = iconSize, color = rightTint)
|
|
104
|
+
Icon(source = iconRight, size = iconSize.dp, color = rightTint)
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
}
|
|
@@ -109,23 +111,23 @@ enum class ChipSize { SMALL, LARGE }
|
|
|
109
111
|
object ChipDefaults {
|
|
110
112
|
@Immutable
|
|
111
113
|
data class Dimensions(
|
|
112
|
-
val height:
|
|
113
|
-
val horizontal:
|
|
114
|
-
val iconSize:
|
|
115
|
-
val iconSpacing:
|
|
114
|
+
val height: Float,
|
|
115
|
+
val horizontal: Float,
|
|
116
|
+
val iconSize: Float,
|
|
117
|
+
val iconSpacing: Float,
|
|
116
118
|
)
|
|
117
119
|
|
|
118
120
|
val Large = Dimensions(
|
|
119
|
-
height =
|
|
120
|
-
horizontal =
|
|
121
|
-
iconSize =
|
|
122
|
-
iconSpacing =
|
|
121
|
+
height = 32f,
|
|
122
|
+
horizontal = 12f,
|
|
123
|
+
iconSize = 20f,
|
|
124
|
+
iconSpacing = 4f,
|
|
123
125
|
)
|
|
124
126
|
|
|
125
127
|
val Small = Dimensions(
|
|
126
|
-
height =
|
|
127
|
-
horizontal =
|
|
128
|
-
iconSize =
|
|
129
|
-
iconSpacing =
|
|
128
|
+
height = 24f,
|
|
129
|
+
horizontal = 10f,
|
|
130
|
+
iconSize = 16f,
|
|
131
|
+
iconSpacing = 4f,
|
|
130
132
|
)
|
|
131
133
|
}
|
|
@@ -34,6 +34,7 @@ import androidx.compose.ui.text.font.FontWeight
|
|
|
34
34
|
import androidx.compose.ui.text.input.KeyboardType
|
|
35
35
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
36
36
|
import androidx.compose.ui.text.input.VisualTransformation
|
|
37
|
+
import androidx.compose.ui.text.style.TextAlign
|
|
37
38
|
import androidx.compose.ui.unit.Dp
|
|
38
39
|
import androidx.compose.ui.unit.dp
|
|
39
40
|
import androidx.compose.ui.unit.sp
|
|
@@ -42,6 +43,7 @@ import vn.momo.kits.const.AppTheme
|
|
|
42
43
|
import vn.momo.kits.const.Radius
|
|
43
44
|
import vn.momo.kits.const.Spacing
|
|
44
45
|
import vn.momo.kits.const.Typography
|
|
46
|
+
import vn.momo.kits.const.scaleSize
|
|
45
47
|
import vn.momo.kits.modifier.setAutomationId
|
|
46
48
|
|
|
47
49
|
data class InputSizeDetail(
|
|
@@ -213,20 +215,26 @@ fun Input(
|
|
|
213
215
|
if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
|
|
214
216
|
}
|
|
215
217
|
|
|
218
|
+
val fontSize = 16.sp
|
|
219
|
+
val lineHeight = 24.sp
|
|
220
|
+
val scaleFontSize = scaleSize(fontSize)
|
|
221
|
+
val scaleLineHeight = scaleSize(lineHeight)
|
|
222
|
+
|
|
216
223
|
val textStyle = remember(textColor, fontWeight) {
|
|
217
224
|
TextStyle(
|
|
218
225
|
color = textColor,
|
|
219
|
-
fontSize =
|
|
220
|
-
lineHeight =
|
|
226
|
+
fontSize = scaleFontSize,
|
|
227
|
+
lineHeight = scaleLineHeight,
|
|
221
228
|
fontWeight = fontWeight.value
|
|
222
229
|
)
|
|
223
230
|
}
|
|
224
231
|
|
|
225
232
|
val placeholderStyle = remember(placeholderColor, fontWeight) {
|
|
226
233
|
TextStyle(
|
|
227
|
-
fontSize =
|
|
228
|
-
lineHeight =
|
|
229
|
-
fontWeight = fontWeight.value
|
|
234
|
+
fontSize = fontSize,
|
|
235
|
+
lineHeight = lineHeight,
|
|
236
|
+
fontWeight = fontWeight.value,
|
|
237
|
+
textAlign = TextAlign.Center
|
|
230
238
|
)
|
|
231
239
|
}
|
|
232
240
|
|
|
@@ -280,7 +288,7 @@ fun Input(
|
|
|
280
288
|
) {
|
|
281
289
|
Row(
|
|
282
290
|
modifier = Modifier.padding(horizontal = Spacing.S),
|
|
283
|
-
verticalAlignment = Alignment.
|
|
291
|
+
verticalAlignment = Alignment.CenterVertically
|
|
284
292
|
) {
|
|
285
293
|
Text(
|
|
286
294
|
floatingValue,
|
|
@@ -331,13 +339,14 @@ fun Input(
|
|
|
331
339
|
)
|
|
332
340
|
}
|
|
333
341
|
|
|
334
|
-
Box(Modifier.weight(1f)) {
|
|
342
|
+
Box(Modifier.weight(1f), contentAlignment = Alignment.CenterStart) {
|
|
335
343
|
if (text.value.isEmpty()) {
|
|
336
344
|
Text(
|
|
337
345
|
text = placeholder,
|
|
338
346
|
style = placeholderStyle,
|
|
339
347
|
color = placeholderColor
|
|
340
348
|
)
|
|
349
|
+
|
|
341
350
|
}
|
|
342
351
|
innerTextField()
|
|
343
352
|
}
|
|
@@ -30,6 +30,7 @@ import androidx.compose.ui.zIndex
|
|
|
30
30
|
import vn.momo.kits.const.AppTheme
|
|
31
31
|
import vn.momo.kits.const.Spacing
|
|
32
32
|
import vn.momo.kits.const.Typography
|
|
33
|
+
import vn.momo.kits.const.scaleSize
|
|
33
34
|
|
|
34
35
|
@Composable
|
|
35
36
|
fun InputDropDown(
|
|
@@ -76,6 +77,9 @@ fun InputDropDown(
|
|
|
76
77
|
|
|
77
78
|
val testId = if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
|
|
78
79
|
|
|
80
|
+
val fontSize = scaleSize(16.sp)
|
|
81
|
+
val lineHeight = scaleSize(24.sp)
|
|
82
|
+
|
|
79
83
|
Column(modifier = Modifier.clickable(enabled = !disabled, onClick = onPress).semantics {
|
|
80
84
|
contentDescription = floatingValue; testTag = testId
|
|
81
85
|
}) {
|
|
@@ -90,7 +94,7 @@ fun InputDropDown(
|
|
|
90
94
|
Row(
|
|
91
95
|
modifier = Modifier
|
|
92
96
|
.padding(horizontal = Spacing.S),
|
|
93
|
-
verticalAlignment = Alignment.
|
|
97
|
+
verticalAlignment = Alignment.CenterVertically
|
|
94
98
|
) {
|
|
95
99
|
Text(
|
|
96
100
|
floatingValue,
|
|
@@ -142,8 +146,8 @@ fun InputDropDown(
|
|
|
142
146
|
Text(
|
|
143
147
|
text = value.value.ifEmpty { placeholder },
|
|
144
148
|
style = TextStyle(
|
|
145
|
-
fontSize =
|
|
146
|
-
lineHeight =
|
|
149
|
+
fontSize = fontSize,
|
|
150
|
+
lineHeight = lineHeight
|
|
147
151
|
),
|
|
148
152
|
color = if (value.value.isEmpty()) placeholderColor else textColor
|
|
149
153
|
)
|
|
@@ -32,11 +32,12 @@ import androidx.compose.runtime.setValue
|
|
|
32
32
|
import androidx.compose.ui.Alignment
|
|
33
33
|
import androidx.compose.ui.Modifier
|
|
34
34
|
import androidx.compose.ui.focus.onFocusChanged
|
|
35
|
+
import androidx.compose.ui.text.TextStyle
|
|
35
36
|
import androidx.compose.ui.text.input.KeyboardType
|
|
36
37
|
import androidx.compose.ui.unit.dp
|
|
38
|
+
import androidx.compose.ui.unit.sp
|
|
37
39
|
import androidx.compose.ui.zIndex
|
|
38
40
|
import vn.momo.kits.const.AppTheme
|
|
39
|
-
import vn.momo.kits.const.Colors
|
|
40
41
|
import vn.momo.kits.const.Radius
|
|
41
42
|
import vn.momo.kits.const.Spacing
|
|
42
43
|
import vn.momo.kits.const.Typography
|
|
@@ -106,10 +107,12 @@ fun InputOTP(
|
|
|
106
107
|
handleChangeText("")
|
|
107
108
|
}
|
|
108
109
|
|
|
110
|
+
val fontSize = scaleSize(20.sp)
|
|
109
111
|
|
|
110
112
|
Column {
|
|
111
113
|
BasicTextField(
|
|
112
114
|
value = value,
|
|
115
|
+
textStyle = TextStyle(fontSize = fontSize),
|
|
113
116
|
onValueChange = handleChangeText,
|
|
114
117
|
singleLine = true,
|
|
115
118
|
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = if (dataType == "number") KeyboardType.Number else KeyboardType.Ascii),
|
|
@@ -36,6 +36,7 @@ import vn.momo.kits.const.Colors
|
|
|
36
36
|
import vn.momo.kits.const.Radius
|
|
37
37
|
import vn.momo.kits.const.Spacing
|
|
38
38
|
import vn.momo.kits.const.Typography
|
|
39
|
+
import vn.momo.kits.const.scaleSize
|
|
39
40
|
import vn.momo.kits.modifier.setAutomationId
|
|
40
41
|
|
|
41
42
|
data class InputPhoneNumberSizeDetail(
|
|
@@ -113,18 +114,7 @@ fun InputPhoneNumber(
|
|
|
113
114
|
|
|
114
115
|
val testId = "input_phone_number"
|
|
115
116
|
|
|
116
|
-
val textStyle =
|
|
117
|
-
size.values.textStyle.merge(TextStyle(
|
|
118
|
-
color = textColor,
|
|
119
|
-
))
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
val placeholderStyle = remember(placeholderColor) {
|
|
123
|
-
|
|
124
|
-
size.values.textStyle.merge(TextStyle(
|
|
125
|
-
color = placeholderColor
|
|
126
|
-
))
|
|
127
|
-
}
|
|
117
|
+
val textStyle = scaleSize(size.values.textStyle.copy(color = textColor))
|
|
128
118
|
|
|
129
119
|
Column(modifier = modifier.setAutomationId(testId)) {
|
|
130
120
|
BasicTextField(
|
|
@@ -174,11 +164,10 @@ fun InputPhoneNumber(
|
|
|
174
164
|
alignment = Alignment.Center
|
|
175
165
|
)
|
|
176
166
|
)
|
|
177
|
-
|
|
178
167
|
Text(
|
|
179
168
|
"+84",
|
|
180
169
|
color = textColor,
|
|
181
|
-
style = textStyle,
|
|
170
|
+
style = size.values.textStyle.copy(color = textColor),
|
|
182
171
|
)
|
|
183
172
|
|
|
184
173
|
// Divider
|
|
@@ -195,7 +184,7 @@ fun InputPhoneNumber(
|
|
|
195
184
|
if (text.value.isEmpty()) {
|
|
196
185
|
Text(
|
|
197
186
|
text = placeholder,
|
|
198
|
-
style =
|
|
187
|
+
style = size.values.textStyle.copy(color = placeholderColor),
|
|
199
188
|
color = placeholderColor,
|
|
200
189
|
modifier = Modifier.align(Alignment.CenterStart)
|
|
201
190
|
)
|
|
@@ -9,10 +9,10 @@ import androidx.compose.foundation.layout.Row
|
|
|
9
9
|
import androidx.compose.foundation.layout.Spacer
|
|
10
10
|
import androidx.compose.foundation.layout.fillMaxHeight
|
|
11
11
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
12
|
-
import androidx.compose.foundation.layout.height
|
|
13
12
|
import androidx.compose.foundation.layout.padding
|
|
14
13
|
import androidx.compose.foundation.layout.size
|
|
15
14
|
import androidx.compose.foundation.layout.width
|
|
15
|
+
import androidx.compose.foundation.layout.wrapContentHeight
|
|
16
16
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
17
17
|
import androidx.compose.foundation.text.BasicTextField
|
|
18
18
|
import androidx.compose.foundation.text.KeyboardActions
|
|
@@ -39,6 +39,7 @@ import vn.momo.kits.const.Colors
|
|
|
39
39
|
import vn.momo.kits.const.Radius
|
|
40
40
|
import vn.momo.kits.const.Spacing
|
|
41
41
|
import vn.momo.kits.const.Typography
|
|
42
|
+
import vn.momo.kits.const.scaleSize
|
|
42
43
|
import vn.momo.kits.utils.ifTrue
|
|
43
44
|
|
|
44
45
|
@Composable
|
|
@@ -122,21 +123,34 @@ fun InputSearch(
|
|
|
122
123
|
placeholderColor = disabledColor
|
|
123
124
|
iconTintColor = disabledColor
|
|
124
125
|
}
|
|
126
|
+
val fontSize = 14.sp
|
|
127
|
+
val scaleFontSize = scaleSize(fontSize)
|
|
128
|
+
|
|
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) {
|
|
138
|
+
TextStyle(
|
|
139
|
+
color = textColor,
|
|
140
|
+
fontSize = fontSize,
|
|
141
|
+
fontWeight = inputSearchProps.fontWeight.value
|
|
142
|
+
)
|
|
143
|
+
}
|
|
125
144
|
|
|
126
145
|
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
|
|
127
146
|
BasicTextField(
|
|
128
147
|
enabled = !inputSearchProps.disabled,
|
|
129
148
|
singleLine = true,
|
|
130
149
|
value = inputSearchProps.text.value,
|
|
131
|
-
textStyle =
|
|
132
|
-
color = textColor,
|
|
133
|
-
fontSize = 14.sp,
|
|
134
|
-
lineHeight = 20.sp,
|
|
135
|
-
fontWeight = inputSearchProps.fontWeight.value
|
|
136
|
-
),
|
|
150
|
+
textStyle = textStyle,
|
|
137
151
|
keyboardOptions = inputSearchProps.keyboardOptions.copy(keyboardType = inputSearchProps.keyboardType),
|
|
138
152
|
keyboardActions = inputSearchProps.keyboardActions,
|
|
139
|
-
modifier = inputSearchProps.modifier.weight(1f).
|
|
153
|
+
modifier = inputSearchProps.modifier.weight(1f).wrapContentHeight().onFocusChanged {
|
|
140
154
|
isFocused = it.isFocused
|
|
141
155
|
if (it.isFocused) {
|
|
142
156
|
inputSearchProps.onFocus()
|
|
@@ -178,11 +192,7 @@ fun InputSearch(
|
|
|
178
192
|
if (inputSearchProps.text.value.isEmpty()) {
|
|
179
193
|
Text(
|
|
180
194
|
text = inputSearchProps.placeholder,
|
|
181
|
-
style =
|
|
182
|
-
fontSize = 14.sp,
|
|
183
|
-
lineHeight = 20.sp,
|
|
184
|
-
fontWeight = inputSearchProps.fontWeight.value
|
|
185
|
-
),
|
|
195
|
+
style = placeHolderStyle,
|
|
186
196
|
maxLines = 1,
|
|
187
197
|
color = placeholderColor,
|
|
188
198
|
overflow = TextOverflow.Ellipsis
|
|
@@ -36,6 +36,7 @@ import androidx.compose.ui.zIndex
|
|
|
36
36
|
import vn.momo.kits.const.AppTheme
|
|
37
37
|
import vn.momo.kits.const.Spacing
|
|
38
38
|
import vn.momo.kits.const.Typography
|
|
39
|
+
import vn.momo.kits.const.scaleSize
|
|
39
40
|
|
|
40
41
|
const val MAX_LENGTH = 300
|
|
41
42
|
val DEFAULT_HEIGHT = 104.dp
|
|
@@ -86,7 +87,11 @@ fun InputTextArea(
|
|
|
86
87
|
iconTintColor = disabledColor
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
val fontSize = 16.sp
|
|
91
|
+
val lineHeight = 24.sp
|
|
92
|
+
val scaleFontSize = scaleSize(16.sp)
|
|
93
|
+
val scaleLineHeight = scaleSize(24.sp)
|
|
94
|
+
val scaleHeight = scaleSize(height)
|
|
90
95
|
|
|
91
96
|
Column {
|
|
92
97
|
BasicTextField(
|
|
@@ -95,12 +100,12 @@ fun InputTextArea(
|
|
|
95
100
|
value = text.value,
|
|
96
101
|
textStyle = TextStyle(
|
|
97
102
|
color = textColor,
|
|
98
|
-
fontSize =
|
|
99
|
-
lineHeight =
|
|
103
|
+
fontSize = scaleFontSize,
|
|
104
|
+
lineHeight = scaleLineHeight,
|
|
100
105
|
fontWeight = fontWeight.value
|
|
101
106
|
),
|
|
102
107
|
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = keyboardType),
|
|
103
|
-
modifier = Modifier.height(
|
|
108
|
+
modifier = Modifier.height(scaleHeight).onFocusChanged {
|
|
104
109
|
isFocused = it.isFocused
|
|
105
110
|
if (it.isFocused) {
|
|
106
111
|
onFocus()
|
|
@@ -118,14 +123,14 @@ fun InputTextArea(
|
|
|
118
123
|
if (floatingValue.isNotEmpty() || floatingIcon.isNotEmpty()) {
|
|
119
124
|
Box(
|
|
120
125
|
modifier = Modifier.wrapContentSize()
|
|
121
|
-
.offset(y = (-
|
|
126
|
+
.offset(y = (-scaleHeight / 2), x = (Spacing.S))
|
|
122
127
|
.background(AppTheme.current.colors.background.surface)
|
|
123
128
|
.zIndex(10f),
|
|
124
129
|
) {
|
|
125
130
|
Row(
|
|
126
131
|
modifier = Modifier
|
|
127
132
|
.padding(horizontal = Spacing.S),
|
|
128
|
-
verticalAlignment = Alignment.
|
|
133
|
+
verticalAlignment = Alignment.CenterVertically
|
|
129
134
|
) {
|
|
130
135
|
Text(
|
|
131
136
|
floatingValue,
|
|
@@ -166,9 +171,10 @@ fun InputTextArea(
|
|
|
166
171
|
) {
|
|
167
172
|
Column {
|
|
168
173
|
Row(
|
|
169
|
-
modifier = Modifier.weight(
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
modifier = Modifier.weight(1f).padding(
|
|
175
|
+
start = Spacing.M,
|
|
176
|
+
end = Spacing.M,
|
|
177
|
+
top = Spacing.M
|
|
172
178
|
),
|
|
173
179
|
verticalAlignment = Alignment.Top
|
|
174
180
|
) {
|
|
@@ -177,8 +183,8 @@ fun InputTextArea(
|
|
|
177
183
|
Text(
|
|
178
184
|
text = placeholder,
|
|
179
185
|
style = TextStyle(
|
|
180
|
-
fontSize =
|
|
181
|
-
lineHeight =
|
|
186
|
+
fontSize = fontSize,
|
|
187
|
+
lineHeight = lineHeight,
|
|
182
188
|
fontWeight = fontWeight.value
|
|
183
189
|
),
|
|
184
190
|
color = placeholderColor
|
|
@@ -206,7 +212,6 @@ fun InputTextArea(
|
|
|
206
212
|
|
|
207
213
|
Box(
|
|
208
214
|
modifier = Modifier
|
|
209
|
-
.weight(1.5f)
|
|
210
215
|
.fillMaxWidth()
|
|
211
216
|
.padding(end = Spacing.M),
|
|
212
217
|
contentAlignment = Alignment.CenterEnd
|
package/compose/src/commonMain/kotlin/vn/momo/kits/{navigation → components}/ScaleSizeScope.kt
RENAMED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
package vn.momo.kits.
|
|
1
|
+
package vn.momo.kits.components
|
|
2
2
|
|
|
3
3
|
import androidx.compose.runtime.Composable
|
|
4
4
|
import androidx.compose.runtime.CompositionLocalProvider
|
|
5
|
-
import
|
|
5
|
+
import androidx.compose.runtime.staticCompositionLocalOf
|
|
6
|
+
|
|
7
|
+
internal val ScaleSizeMaxRate = staticCompositionLocalOf<Float?> { null }
|
|
6
8
|
|
|
7
9
|
@Composable
|
|
8
10
|
fun ScaleSizeScope(
|
|
@@ -10,8 +12,8 @@ fun ScaleSizeScope(
|
|
|
10
12
|
content: @Composable () -> Unit
|
|
11
13
|
) {
|
|
12
14
|
CompositionLocalProvider(
|
|
13
|
-
ScaleSizeMaxRate provides scaleSizeMaxRate
|
|
15
|
+
ScaleSizeMaxRate provides scaleSizeMaxRate,
|
|
14
16
|
) {
|
|
15
17
|
content()
|
|
16
18
|
}
|
|
17
|
-
}
|
|
19
|
+
}
|
|
@@ -10,7 +10,6 @@ import androidx.compose.ui.text.style.TextAlign
|
|
|
10
10
|
import androidx.compose.ui.text.style.TextDecoration
|
|
11
11
|
import androidx.compose.ui.text.style.TextOverflow
|
|
12
12
|
import androidx.compose.ui.unit.TextUnit
|
|
13
|
-
import androidx.compose.ui.unit.sp
|
|
14
13
|
import vn.momo.kits.const.AppTheme
|
|
15
14
|
import vn.momo.kits.const.Typography
|
|
16
15
|
import vn.momo.kits.const.getFontFamily
|
|
@@ -38,8 +37,8 @@ fun Text(
|
|
|
38
37
|
val theme = AppTheme.current
|
|
39
38
|
|
|
40
39
|
// Call @Composable functions directly in composable context
|
|
41
|
-
val scaledFontSize = scaleSize(style.fontSize
|
|
42
|
-
val scaledLineHeight = scaleSize(style.lineHeight
|
|
40
|
+
val scaledFontSize = scaleSize(style.fontSize)
|
|
41
|
+
val scaledLineHeight = scaleSize(style.lineHeight)
|
|
43
42
|
val fontFamilyResult = getFontFamily(fontFamily ?: theme.font, style.fontWeight)
|
|
44
43
|
|
|
45
44
|
// Now memoize the results
|
|
@@ -184,8 +184,6 @@ val AppThemeController = staticCompositionLocalOf<(Theme) -> Unit> {
|
|
|
184
184
|
error("No AppTheme controller provided")
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
val ScaleSizeMaxRate = staticCompositionLocalOf<Float?> { null }
|
|
188
|
-
|
|
189
187
|
val AppStatusBar = staticCompositionLocalOf { 0.dp }
|
|
190
188
|
|
|
191
189
|
val AppNavigationBar = staticCompositionLocalOf { 0.dp }
|
|
@@ -8,10 +8,14 @@ import androidx.compose.ui.text.font.FontFamily
|
|
|
8
8
|
import androidx.compose.ui.text.font.FontWeight
|
|
9
9
|
import androidx.compose.ui.text.style.TextDecoration
|
|
10
10
|
import androidx.compose.ui.unit.Dp
|
|
11
|
+
import androidx.compose.ui.unit.TextUnit
|
|
12
|
+
import androidx.compose.ui.unit.TextUnitType
|
|
13
|
+
import androidx.compose.ui.unit.dp
|
|
11
14
|
import androidx.compose.ui.unit.sp
|
|
12
15
|
import org.jetbrains.compose.resources.Font
|
|
13
16
|
import org.jetbrains.compose.resources.FontResource
|
|
14
17
|
import org.jetbrains.compose.resources.InternalResourceApi
|
|
18
|
+
import vn.momo.kits.components.ScaleSizeMaxRate
|
|
15
19
|
import vn.momo.kits.platform.getScreenDimensions
|
|
16
20
|
import kotlin.math.max
|
|
17
21
|
import kotlin.math.min
|
|
@@ -41,9 +45,8 @@ fun scaleSize(size: Float): Float {
|
|
|
41
45
|
val density = LocalDensity.current
|
|
42
46
|
val fontScale = density.fontScale
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
var fontSizeScaleOS = defaultFontSize
|
|
48
|
+
var fontSizeScaleDevice = size
|
|
49
|
+
var fontSizeScaleOS = size
|
|
47
50
|
|
|
48
51
|
if (deviceScale > 1) {
|
|
49
52
|
fontSizeScaleDevice =
|
|
@@ -61,11 +64,35 @@ fun scaleSize(size: Float): Float {
|
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
@Composable
|
|
64
|
-
fun scaleSize(size:
|
|
67
|
+
fun scaleSize(size: TextUnit): TextUnit {
|
|
68
|
+
if (!size.isSp) return size
|
|
69
|
+
|
|
65
70
|
val density = LocalDensity.current
|
|
66
|
-
|
|
67
|
-
val
|
|
68
|
-
|
|
71
|
+
|
|
72
|
+
val scaled = scaleSize(size.value)
|
|
73
|
+
val spValue = scaled / density.fontScale
|
|
74
|
+
|
|
75
|
+
return TextUnit(value = spValue, type = TextUnitType.Sp)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@Composable
|
|
79
|
+
fun scaleSize(size: Dp): Dp {
|
|
80
|
+
return scaleSize(size.value).toInt().dp
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@Composable
|
|
84
|
+
fun scaleSize(textStyle: TextStyle): TextStyle {
|
|
85
|
+
return textStyle.copy(
|
|
86
|
+
fontSize = if (textStyle.fontSize != TextUnit.Unspecified)
|
|
87
|
+
scaleSize(textStyle.fontSize)
|
|
88
|
+
else
|
|
89
|
+
TextUnit.Unspecified,
|
|
90
|
+
|
|
91
|
+
lineHeight = if (textStyle.lineHeight != TextUnit.Unspecified)
|
|
92
|
+
scaleSize(textStyle.lineHeight)
|
|
93
|
+
else
|
|
94
|
+
TextUnit.Unspecified,
|
|
95
|
+
)
|
|
69
96
|
}
|
|
70
97
|
|
|
71
98
|
|
|
@@ -39,6 +39,7 @@ import vn.momo.kits.const.Colors
|
|
|
39
39
|
import vn.momo.kits.const.Radius
|
|
40
40
|
import vn.momo.kits.const.Spacing
|
|
41
41
|
import vn.momo.kits.const.Typography
|
|
42
|
+
import vn.momo.kits.const.scaleSize
|
|
42
43
|
import vn.momo.kits.modifier.noFeedbackClickable
|
|
43
44
|
import vn.momo.kits.platform.getScreenDimensions
|
|
44
45
|
|
|
@@ -156,17 +157,15 @@ fun TabBarItem(item: BottomTabItem, selected: Boolean, onClick: () -> Unit) {
|
|
|
156
157
|
) {
|
|
157
158
|
Icon(
|
|
158
159
|
source = item.icon,
|
|
160
|
+
modifier = Modifier.weight(1f),
|
|
159
161
|
color = if (selected) AppTheme.current.colors.primary else AppTheme.current.colors.text.hint)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
overflow = TextOverflow.Ellipsis
|
|
168
|
-
)
|
|
169
|
-
}
|
|
162
|
+
Text(
|
|
163
|
+
text = item.label,
|
|
164
|
+
color = if (selected) AppTheme.current.colors.primary else AppTheme.current.colors.text.hint,
|
|
165
|
+
style = Typography.labelXsMedium,
|
|
166
|
+
maxLines = 1,
|
|
167
|
+
overflow = TextOverflow.Ellipsis
|
|
168
|
+
)
|
|
170
169
|
}
|
|
171
170
|
if(item.badgeLabel != null){
|
|
172
171
|
Box(modifier = Modifier
|
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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/native-kits",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.154.1-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@momo-platform/native-max-api": "1.0.18
|
|
6
|
+
"@momo-platform/native-max-api": "1.0.18"
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {},
|
|
9
9
|
"license": "MoMo"
|