@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.
@@ -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 = scaleSize(16.sp)
220
- val lineHeight = scaleSize(24.sp)
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 = fontSize,
226
- lineHeight = 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.Bottom
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
- ScaleSizeScope(
344
- disableScale = true
345
- ) {
346
- Text(
347
- text = placeholder,
348
- style = placeholderStyle,
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
  }
@@ -94,7 +94,7 @@ fun InputDropDown(
94
94
  Row(
95
95
  modifier = Modifier
96
96
  .padding(horizontal = Spacing.S),
97
- verticalAlignment = Alignment.Bottom
97
+ verticalAlignment = Alignment.CenterVertically
98
98
  ) {
99
99
  Text(
100
100
  floatingValue,
@@ -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
- ScaleSizeScope(disableScale = true) {
170
- Text(
171
- "+84",
172
- color = textColor,
173
- style = textStyle,
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
- ScaleSizeScope(disableScale = true) {
190
- Text(
191
- text = placeholder,
192
- style = placeholderStyle,
193
- color = placeholderColor,
194
- modifier = Modifier.align(Alignment.CenterStart)
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 fontSize = scaleSize(14.sp)
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
- ScaleSizeScope(disableScale = true) {
187
- Text(
188
- text = inputSearchProps.placeholder,
189
- style = textStyle,
190
- maxLines = 1,
191
- color = placeholderColor,
192
- overflow = TextOverflow.Ellipsis
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 = scaleSize(16.sp)
92
- val lineHeight = scaleSize(24.sp)
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 = fontSize,
103
- lineHeight = 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.Bottom
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
- ScaleSizeScope(disableScale = true) {
183
- Text(
184
- text = placeholder,
185
- style = TextStyle(
186
- fontSize = fontSize,
187
- lineHeight = lineHeight,
188
- fontWeight = fontWeight.value
189
- ),
190
- color = placeholderColor
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
- Box(modifier = Modifier.border(1.dp, Colors.blue_03)) {
73
- androidx.compose.material3.Text(
74
- modifier = modifier.setAutomationId(automationId, text),
75
- text = text,
76
- color = textColor,
77
- style = optimizedStyle,
78
- textAlign = textAlign,
79
- fontSize = fontSize,
80
- fontFamily = font,
81
- maxLines = maxLines,
82
- softWrap = softWrap,
83
- letterSpacing = letterSpacing,
84
- minLines = minLines,
85
- textDecoration = textDecoration,
86
- onTextLayout = onTextLayout,
87
- overflow = overflow
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
- #Thu Jan 09 10:43:10 ICT 2025
8
- sdk.dir=/Users/sophia/Library/Android/sdk
7
+ #Mon Dec 22 10:07:29 ICT 2025
8
+ sdk.dir=/Users/phuc/Library/Android/sdk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.152.4-scale.4",
3
+ "version": "0.152.4-scale.5",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@momo-platform/native-max-api": "1.0.18"