@momo-kits/native-kits 0.89.30-rc.5 → 0.89.30-rc.7

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.
@@ -4,7 +4,6 @@ import androidx.compose.animation.animateColorAsState
4
4
  import androidx.compose.foundation.background
5
5
  import androidx.compose.foundation.border
6
6
  import androidx.compose.foundation.clickable
7
- import androidx.compose.foundation.interaction.MutableInteractionSource
8
7
  import androidx.compose.foundation.layout.Arrangement
9
8
  import androidx.compose.foundation.layout.Box
10
9
  import androidx.compose.foundation.layout.BoxWithConstraints
@@ -16,7 +15,6 @@ import androidx.compose.foundation.layout.padding
16
15
  import androidx.compose.foundation.layout.size
17
16
  import androidx.compose.foundation.layout.width
18
17
  import androidx.compose.foundation.shape.RoundedCornerShape
19
- import androidx.compose.material.ripple.rememberRipple
20
18
  import androidx.compose.runtime.Composable
21
19
  import androidx.compose.runtime.LaunchedEffect
22
20
  import androidx.compose.runtime.getValue
@@ -185,8 +183,7 @@ fun Header(
185
183
  )
186
184
  .padding(Spacing.XS)
187
185
  .semantics {
188
- contentDescription = "btn_navigation_back"; testTag =
189
- "btn_navigation_back"
186
+ testTag = "btn_navigation_back"
190
187
  },
191
188
  contentAlignment = Alignment.Center
192
189
  ) {
@@ -225,7 +222,7 @@ fun Header(
225
222
  title = title,
226
223
  color = if (headerType == HeaderType.SURFACE && animatedHeader !== null) tintIconColorAnim else tintIconColor,
227
224
  modifier = Modifier.semantics {
228
- contentDescription = "title_navigation_header"
225
+ contentDescription = title
229
226
  testTag = "title_navigation_header"
230
227
  }
231
228
  )
@@ -18,6 +18,9 @@ import androidx.compose.ui.Alignment
18
18
  import androidx.compose.ui.Modifier
19
19
  import androidx.compose.ui.draw.clip
20
20
  import androidx.compose.ui.graphics.Color
21
+ import androidx.compose.ui.semantics.contentDescription
22
+ import androidx.compose.ui.semantics.semantics
23
+ import androidx.compose.ui.semantics.testTag
21
24
  import androidx.compose.ui.text.TextStyle
22
25
  import androidx.compose.ui.text.style.TextOverflow
23
26
  import androidx.compose.ui.unit.Dp
@@ -233,6 +236,7 @@ fun Button(
233
236
  isFull: Boolean = true,
234
237
  modifier: Modifier = Modifier,
235
238
  ) {
239
+ val testId = "btn_${type.toString().lowercase()}_$title"
236
240
  val customModifier = if (isFull) {
237
241
  modifier
238
242
  .fillMaxWidth()
@@ -254,7 +258,10 @@ fun Button(
254
258
  .padding(horizontal = size.value.padding)
255
259
  .defaultMinSize(
256
260
  minWidth = size.value.width
257
- ).height(size.value.height),
261
+ ).height(size.value.height)
262
+ .semantics {
263
+ contentDescription = title; testTag = testId
264
+ },
258
265
  horizontalArrangement = Arrangement.Center,
259
266
  verticalAlignment = Alignment.CenterVertically,
260
267
  ) {
@@ -36,7 +36,6 @@ fun Image(
36
36
  options: Options? = null,
37
37
  loading: Boolean = true,
38
38
  ) {
39
- modifier.semantics {contentDescription = "img|$source"; testTag = "img|$source"}
40
39
  var imageOptions = Options()
41
40
  var imageState by remember { mutableStateOf(ImageState.Loading) }
42
41
 
@@ -51,7 +50,7 @@ fun Image(
51
50
 
52
51
  Box(modifier = modifier) {
53
52
  AsyncImage(
54
- modifier = modifier,
53
+ modifier = Modifier.matchParentSize().semantics {contentDescription = "img|$source"; testTag = "img|$source"},
55
54
  model = source,
56
55
  contentDescription = null,
57
56
  contentScale = imageOptions.contentScale,
@@ -29,6 +29,9 @@ import androidx.compose.ui.Alignment
29
29
  import androidx.compose.ui.Modifier
30
30
  import androidx.compose.ui.focus.onFocusChanged
31
31
  import androidx.compose.ui.graphics.Color
32
+ import androidx.compose.ui.semantics.contentDescription
33
+ import androidx.compose.ui.semantics.semantics
34
+ import androidx.compose.ui.semantics.testTag
32
35
  import androidx.compose.ui.text.TextStyle
33
36
  import androidx.compose.ui.text.font.FontWeight
34
37
  import androidx.compose.ui.text.input.KeyboardType
@@ -198,7 +201,11 @@ fun Input(
198
201
  iconTintColor = disabledColor
199
202
  }
200
203
 
201
- Column {
204
+ val testId = if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
205
+
206
+ Column(modifier = Modifier.semantics {
207
+ contentDescription = floatingValue; testTag = testId
208
+ }) {
202
209
  BasicTextField(
203
210
  enabled = !disabled,
204
211
  readOnly = readOnly,
@@ -17,10 +17,12 @@ import androidx.compose.runtime.MutableState
17
17
  import androidx.compose.runtime.getValue
18
18
  import androidx.compose.runtime.mutableStateOf
19
19
  import androidx.compose.runtime.remember
20
- import androidx.compose.runtime.setValue
21
20
  import androidx.compose.ui.Alignment
22
21
  import androidx.compose.ui.Modifier
23
22
  import androidx.compose.ui.graphics.Color
23
+ import androidx.compose.ui.semantics.contentDescription
24
+ import androidx.compose.ui.semantics.semantics
25
+ import androidx.compose.ui.semantics.testTag
24
26
  import androidx.compose.ui.text.TextStyle
25
27
  import androidx.compose.ui.unit.dp
26
28
  import androidx.compose.ui.unit.sp
@@ -72,8 +74,11 @@ fun InputDropDown(
72
74
  iconTintColor = disabledColor
73
75
  }
74
76
 
77
+ val testId = if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
75
78
 
76
- Column(modifier = Modifier.clickable(enabled = !disabled, onClick = onPress)) {
79
+ Column(modifier = Modifier.clickable(enabled = !disabled, onClick = onPress).semantics {
80
+ contentDescription = floatingValue; testTag = testId
81
+ }) {
77
82
  Box {
78
83
  if (floatingValue.isNotEmpty() || floatingIcon.isNotEmpty()) {
79
84
  Box(
@@ -27,6 +27,9 @@ import androidx.compose.ui.Alignment
27
27
  import androidx.compose.ui.Modifier
28
28
  import androidx.compose.ui.focus.onFocusChanged
29
29
  import androidx.compose.ui.graphics.Color
30
+ import androidx.compose.ui.semantics.contentDescription
31
+ import androidx.compose.ui.semantics.semantics
32
+ import androidx.compose.ui.semantics.testTag
30
33
  import androidx.compose.ui.text.AnnotatedString
31
34
  import androidx.compose.ui.text.TextStyle
32
35
  import androidx.compose.ui.text.input.KeyboardType
@@ -104,8 +107,11 @@ fun InputMoney(
104
107
  iconTintColor = disabledColor
105
108
  }
106
109
 
110
+ val testId = if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
107
111
 
108
- Column {
112
+ Column(modifier = Modifier.semantics {
113
+ contentDescription = floatingValue; testTag = testId
114
+ }) {
109
115
  BasicTextField(
110
116
  enabled = !disabled,
111
117
  singleLine = true,
@@ -97,7 +97,7 @@ fun PopupNotify(
97
97
  }
98
98
 
99
99
  Box(Modifier.semantics {
100
- contentDescription = "popup_notify"; testTag = "popup_notify"
100
+ contentDescription = title; testTag = "popup_notify"
101
101
  }, contentAlignment = Alignment.TopEnd) {
102
102
  Column(
103
103
  modifier = Modifier
@@ -166,7 +166,7 @@ fun PopupNotify(
166
166
  color = AppTheme.current.colors.background.surface,
167
167
  size = 14.dp,
168
168
  modifier = Modifier.semantics {
169
- contentDescription = "ic_popup_close"; testTag = "ic_popup_close"
169
+ testTag = "ic_popup_close"
170
170
  }
171
171
  )
172
172
  }
@@ -235,7 +235,7 @@ fun renderRow(
235
235
  title = it.title,
236
236
  type = ButtonType.TEXT,
237
237
  modifier = Modifier.semantics {
238
- contentDescription = "btn_popup_cancel"; testTag = "btn_popup_cancel"
238
+ contentDescription = it.title; testTag = "btn_popup_cancel"
239
239
  }
240
240
  )
241
241
  }
@@ -250,7 +250,7 @@ fun renderRow(
250
250
  },
251
251
  title = primary?.title ?: "",
252
252
  modifier = Modifier.semantics {
253
- contentDescription = "btn_popup_allow"; testTag = "btn_popup_allow"
253
+ contentDescription = primary?.title ?: ""; testTag = "btn_popup_allow"
254
254
  }
255
255
  )
256
256
  }
@@ -273,7 +273,7 @@ fun renderColumn(
273
273
  },
274
274
  title = primary?.title ?: "",
275
275
  modifier = Modifier.semantics {
276
- contentDescription = "btn_popup_allow"; testTag = "btn_popup_allow"
276
+ contentDescription = primary?.title ?: ""; testTag = "btn_popup_allow"
277
277
  }
278
278
  )
279
279
  secondary?.let {
@@ -288,7 +288,7 @@ fun renderColumn(
288
288
  title = it.title,
289
289
  type = ButtonType.TEXT,
290
290
  modifier = Modifier.semantics {
291
- contentDescription = "btn_popup_cancel"; testTag = "btn_popup_cancel"
291
+ contentDescription = it.title; testTag = "btn_popup_cancel"
292
292
  }
293
293
  )
294
294
  }
@@ -17,7 +17,6 @@ import androidx.compose.runtime.remember
17
17
  import androidx.compose.ui.Alignment
18
18
  import androidx.compose.ui.Modifier
19
19
  import androidx.compose.ui.draw.clip
20
- import androidx.compose.ui.semantics.contentDescription
21
20
  import androidx.compose.ui.semantics.semantics
22
21
  import androidx.compose.ui.semantics.testTag
23
22
  import androidx.compose.ui.unit.dp
@@ -30,7 +29,7 @@ fun PromotionPopup(
30
29
  source: String = "",
31
30
  onClose: (() -> Unit) = {},
32
31
  ) {
33
- Column(Modifier.semantics { contentDescription = "popup_notify"; testTag = "popup_notify" }) {
32
+ Column(Modifier.semantics { testTag = "popup_notify" }) {
34
33
  if (source.isNotEmpty()) {
35
34
  Image(
36
35
  source = source,
@@ -69,7 +68,7 @@ fun PromotionPopup(
69
68
  color = AppTheme.current.colors.background.surface,
70
69
  size = 14.dp,
71
70
  modifier = Modifier.semantics {
72
- contentDescription = "ic_popup_close"; testTag = "ic_popup_close"
71
+ testTag = "ic_popup_close"
73
72
  }
74
73
  )
75
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.89.30-rc.5",
3
+ "version": "0.89.30-rc.7",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},