@momo-kits/native-kits 0.117.1-beta.13 → 0.117.1-beta.14

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.
@@ -29,10 +29,10 @@ fun HeaderDefault(
29
29
  val height = statusBarHeight + HEADER_HEIGHT.dp
30
30
  Box(
31
31
  modifier = Modifier.fillMaxWidth().height(height)
32
- .background(backgroundColor ?: AppTheme.current.colors.background.surface)
32
+ .background(if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.background.surface)
33
33
  .bottomBorder(
34
34
  strokeWidth = 1.dp,
35
- color = backgroundColor?: AppTheme.current.colors.border.default
35
+ color = if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.border.default
36
36
  )
37
37
  ) {
38
38
  Box(
@@ -4,6 +4,7 @@ import androidx.compose.foundation.background
4
4
  import androidx.compose.foundation.border
5
5
  import androidx.compose.foundation.clickable
6
6
  import androidx.compose.foundation.layout.Box
7
+ import androidx.compose.foundation.layout.Row
7
8
  import androidx.compose.foundation.layout.height
8
9
  import androidx.compose.foundation.layout.padding
9
10
  import androidx.compose.foundation.layout.size
@@ -17,6 +18,8 @@ import androidx.compose.ui.graphics.Color
17
18
  import androidx.compose.ui.unit.dp
18
19
  import vn.momo.kits.const.Colors
19
20
  import vn.momo.kits.const.Spacing
21
+ import vn.momo.kits.const.Typography
22
+ import vn.momo.kits.modifier.setAutomationId
20
23
  import vn.momo.kits.utils.ifTrue
21
24
 
22
25
  @Composable
@@ -24,6 +27,8 @@ fun Switch(
24
27
  value: Boolean = false,
25
28
  onChange: (Boolean) -> Unit = {},
26
29
  disabled: Boolean = false,
30
+ title: String? = "",
31
+ accessibilityId: String? = ""
27
32
  ) {
28
33
  val circleBackgroundColor = value.ifTrue(Colors.black_01, Colors.black_03)
29
34
  var backgroundColor = value.ifTrue(Colors.green_03, Colors.black_07)
@@ -32,27 +37,35 @@ fun Switch(
32
37
  }
33
38
 
34
39
  Box(
35
- modifier = Modifier.then(
36
- Modifier.width(38.dp).height(20.dp).border(
37
- 0.dp, Color.Unspecified,
38
- RoundedCornerShape(20.dp)
39
- ).background(backgroundColor, RoundedCornerShape(20.dp)).clip(RoundedCornerShape(20.dp))
40
- .clickable(
41
- enabled = !disabled,
42
- onClick = { onChange(!value) }
43
- )
44
- .padding(horizontal = Spacing.XS)
45
- ),
46
- contentAlignment = value.ifTrue(Alignment.CenterEnd, Alignment.CenterStart)
40
+ modifier = Modifier.setAutomationId( accessibilityId ?: "toggle_${title ?: "unknown"}_${value}")
47
41
  ) {
48
42
  Box(
49
- modifier = Modifier.size(14.dp)
50
- .border(0.dp, Color.Unspecified, RoundedCornerShape(percent = 100))
51
- .background(circleBackgroundColor, RoundedCornerShape(percent = 100)),
52
- contentAlignment = Alignment.Center
53
- )
54
- {
55
- Box(Modifier.size(6.dp).background(backgroundColor, RoundedCornerShape(percent = 100)))
43
+ modifier = Modifier.then(
44
+ Modifier.width(38.dp).height(20.dp).border(
45
+ 0.dp, Color.Unspecified,
46
+ RoundedCornerShape(20.dp)
47
+ ).background(backgroundColor, RoundedCornerShape(20.dp))
48
+ .clip(RoundedCornerShape(20.dp))
49
+ .clickable(
50
+ enabled = !disabled,
51
+ onClick = { onChange(!value) }
52
+ )
53
+ .padding(horizontal = Spacing.XS)
54
+ ),
55
+ contentAlignment = value.ifTrue(Alignment.CenterEnd, Alignment.CenterStart)
56
+ ) {
57
+ Box(
58
+ modifier = Modifier.size(14.dp)
59
+ .border(0.dp, Color.Unspecified, RoundedCornerShape(percent = 100))
60
+ .background(circleBackgroundColor, RoundedCornerShape(percent = 100)),
61
+ contentAlignment = Alignment.Center
62
+ )
63
+ {
64
+ Box(
65
+ Modifier.size(6.dp)
66
+ .background(backgroundColor, RoundedCornerShape(percent = 100))
67
+ )
68
+ }
56
69
  }
57
70
  }
58
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.117.1-beta.13",
3
+ "version": "0.117.1-beta.14",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},