@momo-kits/native-kits 0.117.1-beta.12 → 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
  }
@@ -38,6 +38,9 @@ public struct PopupDisplay: View {
38
38
 
39
39
  // MARK: Public
40
40
 
41
+ @State private var textHeight: CGFloat = .zero
42
+ @State private var isScrollable = false
43
+
41
44
  public var body: some View {
42
45
  var shouldUseColumn: Bool {
43
46
  buttonDirection == .column || (buttonDirection == .auto && (closeButtonTitle.count > 12 || actionButtonTitle.count > 12))
@@ -80,12 +83,37 @@ public struct PopupDisplay: View {
80
83
  .lineLimit(2)
81
84
  .accessibility(identifier: "title_popup_permission")
82
85
 
83
- Text(description)
84
- .foregroundColor(.black)
85
- .font(.paragraph)
86
- .opacity(0.6)
87
- .multilineTextAlignment(.leading)
88
- .padding(.bottom, 8)
86
+ Group {
87
+ if isScrollable {
88
+ ScrollView(showsIndicators: false) {
89
+ Text(description)
90
+ .font(.paragraph)
91
+ .foregroundColor(.black)
92
+ .opacity(0.6)
93
+ .multilineTextAlignment(.leading)
94
+ .background(GeometryReader { geo in
95
+ Color.clear
96
+ .onAppear {
97
+ textHeight = geo.size.height
98
+ }
99
+ })
100
+ }
101
+ .frame(height: 60)
102
+ } else {
103
+ Text(description)
104
+ .font(.paragraph)
105
+ .foregroundColor(.black)
106
+ .opacity(0.6)
107
+ .multilineTextAlignment(.leading)
108
+ .background(GeometryReader { geo in
109
+ Color.clear
110
+ .onAppear {
111
+ textHeight = geo.size.height
112
+ isScrollable = textHeight > 60 // adjust threshold to ~3 lines
113
+ }
114
+ })
115
+ }
116
+ }.padding(.bottom, 8)
89
117
 
90
118
  if(!errorCode.isEmpty) {
91
119
  Text(errorCode)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.117.1-beta.12",
3
+ "version": "0.117.1-beta.14",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},