@momo-kits/native-kits 0.156.6-sp.2-debug → 0.156.6-sp.3-debug

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.
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.156.6-sp.2-debug"
43
+ version = "0.156.6-sp.3-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -23,7 +23,7 @@ import vn.momo.kits.modifier.conditional
23
23
 
24
24
 
25
25
  @Composable
26
- fun Badge(label: String = "Label", backgroundColor: Color? = null, modifier: Modifier? = null) {
26
+ fun Badge(label: String = "Label", backgroundColor: Color? = null) {
27
27
  val primaryColors = listOf(
28
28
  Color(0xFFF0F0F0),
29
29
  Color(0xFFEB2F96),
@@ -63,23 +63,21 @@ fun Badge(label: String = "Label", backgroundColor: Color? = null, modifier: Mod
63
63
  }
64
64
  val scaleSize = scaleSize(16f)
65
65
 
66
- if (modifier != null) {
67
- Box(
68
- modifier = modifier
69
- .height(scaleSize.dp)
70
- .widthIn(min = scaleSize.dp)
71
- .background(color = badgeColor, shape = RoundedCornerShape(Radius.M))
72
- .border(width = 1.dp, shape = RoundedCornerShape(Radius.M), color = Colors.black_01)
73
- .conditional(IsShowBaseLineDebug) {
74
- border(1.dp, Colors.blue_03)
75
- }
76
- .padding(horizontal = Spacing.XS), contentAlignment = Alignment.Center
77
- ) {
78
- Text(
79
- text = formatTitle(label),
80
- color = Colors.black_01,
81
- style = Typography.actionXxsBold
82
- )
83
- }
66
+ Box(
67
+ modifier = Modifier
68
+ .height(scaleSize.dp)
69
+ .widthIn(min = scaleSize.dp)
70
+ .background(color = badgeColor, shape = RoundedCornerShape(Radius.M))
71
+ .border(width = 1.dp, shape = RoundedCornerShape(Radius.M), color = Colors.black_01)
72
+ .conditional(IsShowBaseLineDebug) {
73
+ border(1.dp, Colors.blue_03)
74
+ }
75
+ .padding(horizontal = Spacing.XS), contentAlignment = Alignment.Center
76
+ ) {
77
+ Text(
78
+ text = formatTitle(label),
79
+ color = Colors.black_01,
80
+ style = Typography.actionXxsBold
81
+ )
84
82
  }
85
83
  }
@@ -49,20 +49,9 @@ import vn.momo.kits.utils.formatNumberToMoney
49
49
 
50
50
  class CustomConverter : VisualTransformation {
51
51
  override fun filter(text: AnnotatedString): TransformedText {
52
- if (text.text.isEmpty()) {
53
- return TransformedText(
54
- AnnotatedString("0"),
55
- object : OffsetMapping {
56
- override fun originalToTransformed(offset: Int): Int = 0
57
- override fun transformedToOriginal(offset: Int): Int = 0
58
- }
59
- )
60
- }
61
-
62
- if (text.text == "0") {
52
+ if (text.text.isEmpty() || text.text == "0") {
63
53
  return TransformedText(AnnotatedString("0"), OffsetMapping.Identity)
64
54
  }
65
-
66
55
  val formattedText = formatNumberToMoney(text.text.toLong())
67
56
 
68
57
  return TransformedText(
@@ -40,15 +40,13 @@ import vn.momo.kits.const.Colors
40
40
  import vn.momo.kits.const.Radius
41
41
  import vn.momo.kits.const.Spacing
42
42
  import vn.momo.kits.application.IsShowBaseLineDebug
43
- import vn.momo.kits.components.BadgeDot
44
- import vn.momo.kits.components.DotSize
45
43
  import vn.momo.kits.const.Typography
46
44
  import vn.momo.kits.modifier.conditional
47
45
  import vn.momo.kits.modifier.noFeedbackClickable
48
46
  import vn.momo.kits.platform.getScreenDimensions
49
47
 
50
48
  val floatingButtonWidth = 75.dp
51
- const val BOTTOM_TAB_BAR_HEIGHT = 64
49
+ const val BOTTOM_TAB_BAR_HEIGHT = 56
52
50
 
53
51
  @Composable
54
52
  fun BottomTabBar(
@@ -144,18 +142,6 @@ fun RowScope.renderTabBarItem(
144
142
 
145
143
  @Composable
146
144
  fun TabBarItem(item: BottomTabItem, selected: Boolean, onClick: () -> Unit) {
147
- fun isNumber(label: String): Boolean {
148
- val numberRegex = "^\\d+$".toRegex()
149
- return numberRegex.matches(label)
150
- }
151
- fun formatLabel(label: String): String? {
152
- if (isNumber(label) && label.toInt() == 0) {
153
- return null
154
- }
155
- return label
156
- }
157
- val badgeLabel = item.badgeLabel?.let { formatLabel(it) }
158
-
159
145
  Box(modifier = Modifier
160
146
  .fillMaxSize()
161
147
  .padding(horizontal = Spacing.XXS)
@@ -170,34 +156,31 @@ fun TabBarItem(item: BottomTabItem, selected: Boolean, onClick: () -> Unit) {
170
156
  Column(
171
157
  modifier = Modifier
172
158
  .fillMaxSize()
173
- .padding(horizontal = Spacing.S, vertical = Spacing.S)
159
+ .padding(horizontal = Spacing.XXS)
174
160
  .noFeedbackClickable {
175
161
  onClick()
176
162
  },
177
163
  horizontalAlignment = Alignment.CenterHorizontally,
178
- verticalArrangement = Arrangement.Center
164
+ verticalArrangement = Arrangement.Bottom
179
165
  ) {
180
166
  Icon(
181
167
  source = item.icon,
182
- size = 28.dp,
183
- modifier = Modifier.padding(Spacing.XS),
168
+ modifier = Modifier.weight(1f),
184
169
  color = if (selected) AppTheme.current.colors.primary else AppTheme.current.colors.text.hint)
185
170
  Text(
186
171
  text = item.label,
187
172
  color = if (selected) AppTheme.current.colors.primary else AppTheme.current.colors.text.hint,
188
- style = if (selected) Typography.labelXsMedium else Typography.descriptionXsRegular,
173
+ style = Typography.labelXsMedium,
189
174
  maxLines = 1,
190
175
  overflow = TextOverflow.Ellipsis
191
176
  )
192
177
  }
193
- if (badgeLabel != null) {
194
- if (badgeLabel.isEmpty())
195
- BadgeDot(
196
- size = DotSize.Small,
197
- modifier = Modifier.offset(x = 50.dp, y = (-48).dp)
198
- )
199
- else
200
- Badge(badgeLabel, modifier = Modifier.offset(x = 44.dp, y = (-42).dp))
178
+ if(item.badgeLabel != null){
179
+ Box(modifier = Modifier
180
+ .offset(x = 44.dp, y = (-32).dp)
181
+ ){
182
+ Badge(item.badgeLabel)
183
+ }
201
184
  }
202
185
  }
203
186
  }
@@ -207,7 +190,7 @@ fun FloatingButton(data: BottomTabFloatingButton) {
207
190
  Column(
208
191
  modifier = Modifier
209
192
  .width(floatingButtonWidth)
210
- .padding(horizontal = Spacing.XXS, vertical = Spacing.S)
193
+ .padding(horizontal = Spacing.XXS)
211
194
  .conditional(IsShowBaseLineDebug) {
212
195
  border(1.dp, Colors.blue_03)
213
196
  }
@@ -154,7 +154,7 @@ public struct FloatingButton: View {
154
154
  Spacer().frame(width: 8)
155
155
  Text(label)
156
156
  .foregroundColor(.white)
157
- .font(.system(size: 16, weight: .bold))
157
+ .font(.system(size: scaleSize(16), weight: .bold))
158
158
  .lineLimit(1)
159
159
  .background(
160
160
  GeometryReader { geo in
@@ -137,7 +137,7 @@ public struct BadgeRibbon: View {
137
137
  private var roundContent: some View {
138
138
  HStack(spacing: 0) {
139
139
  Text(label)
140
- .font(.system(size: 12, weight: .medium))
140
+ .font(.system(size: scaleSize(12), weight: .medium))
141
141
  .foregroundColor(Colors.black01)
142
142
  .lineLimit(1)
143
143
  .rotationEffect(rotation)
@@ -158,7 +158,7 @@ public struct BadgeRibbon: View {
158
158
  private var skewContent: some View {
159
159
  HStack(spacing: 0) {
160
160
  Text(label)
161
- .font(.system(size: 12, weight: .medium))
161
+ .font(.system(size: scaleSize(12), weight: .medium))
162
162
  .foregroundColor(Colors.black01)
163
163
  .lineLimit(1)
164
164
  .rotationEffect(rotation)
@@ -128,9 +128,7 @@ public struct PopupDisplay: View {
128
128
  .clipped()
129
129
  }
130
130
  VStack(alignment: .leading, spacing: 0) {
131
- Text(title)
132
- .foregroundColor(.black)
133
- .font(.header_default_semibold)
131
+ MomoText(title, typography: .headerDefaultBold)
134
132
  .padding(.top, 24)
135
133
  .padding(.bottom, 8)
136
134
  .lineLimit(2)
@@ -139,9 +137,7 @@ public struct PopupDisplay: View {
139
137
  Group {
140
138
  if isScrollable {
141
139
  ScrollView(showsIndicators: false) {
142
- Text(description)
143
- .font(.body_default_regular)
144
- .foregroundColor(Colors.black17)
140
+ MomoText(description, typography: .bodyDefaultRegular)
145
141
  .multilineTextAlignment(.leading)
146
142
  .background(GeometryReader { geo in
147
143
  Color.clear.onAppear { textHeight = geo.size.height }
@@ -149,13 +145,12 @@ public struct PopupDisplay: View {
149
145
  .measureLineHeights(font: .body_default_regular,
150
146
  oneLine: $oneLineH,
151
147
  twoLines: $twoLineH)
148
+ .accessibility(identifier: "description_popup_permission")
152
149
  }
153
150
  // Cap the visible height to ~8.5 lines
154
151
  .frame(height: min(maxHeight8_5, textHeight))
155
152
  } else {
156
- Text(description)
157
- .font(.body_default_regular)
158
- .foregroundColor(Colors.black17)
153
+ MomoText(description, typography: .bodyDefaultRegular)
159
154
  .multilineTextAlignment(.leading)
160
155
  .background(GeometryReader { geo in
161
156
  Color.clear.onAppear {
@@ -167,14 +162,13 @@ public struct PopupDisplay: View {
167
162
  .measureLineHeights(font: .body_default_regular,
168
163
  oneLine: $oneLineH,
169
164
  twoLines: $twoLineH)
165
+ .accessibility(identifier: "description_popup_permission")
170
166
  }
171
167
  }
172
168
  .padding(.bottom, 8)
173
169
 
174
170
  if(!errorCode.isEmpty) {
175
- Text((errorCodeLabels[language] ?? "Mã lỗi: ") + errorCode)
176
- .foregroundColor(Colors.black12)
177
- .font(.description_xs_regular)
171
+ MomoText((errorCodeLabels[language] ?? "Mã lỗi: ") + errorCode, typography: .descriptionXsRegular, color: Colors.black12)
178
172
  .lineLimit(1)
179
173
  .padding(.bottom, 8)
180
174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.156.6-sp.2-debug",
3
+ "version": "0.156.6-sp.3-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},
@@ -1,198 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.Canvas
4
- import androidx.compose.foundation.background
5
- import androidx.compose.foundation.border
6
- import androidx.compose.foundation.layout.Box
7
- import androidx.compose.foundation.layout.WindowInsets
8
- import androidx.compose.foundation.layout.asPaddingValues
9
- import androidx.compose.foundation.layout.fillMaxHeight
10
- import androidx.compose.foundation.layout.fillMaxSize
11
- import androidx.compose.foundation.layout.fillMaxWidth
12
- import androidx.compose.foundation.layout.height
13
- import androidx.compose.foundation.layout.navigationBars
14
- import androidx.compose.foundation.layout.padding
15
- import androidx.compose.foundation.layout.width
16
- import androidx.compose.runtime.Composable
17
- import androidx.compose.ui.Alignment
18
- import androidx.compose.ui.Modifier
19
- import androidx.compose.ui.geometry.Offset
20
- import androidx.compose.ui.graphics.Color
21
- import androidx.compose.ui.graphics.PathEffect
22
- import androidx.compose.ui.graphics.StrokeCap
23
- import androidx.compose.ui.unit.dp
24
- import io.ktor.util.Platform
25
- import vn.momo.kits.application.IsShowBaseLineDebug
26
- import vn.momo.kits.const.Colors
27
- import vn.momo.kits.modifier.conditional
28
- import vn.momo.kits.platform.getPlatformName
29
- import vn.momo.kits.platform.getStatusBarHeight
30
-
31
- /**
32
- * A debug overlay that draws danger/warning baseline guides on top of the screen.
33
- *
34
- * Highlights safe-area boundaries, header regions, and bottom navigation zones
35
- * using colored solid or dotted lines and semi-transparent red zones.
36
- *
37
- * @param enabled When `false` the composable renders nothing. Pass `false` when
38
- * your QC automation flag is active to suppress the overlay.
39
- */
40
- @Composable
41
- fun BaselineView(enabled: Boolean = true) {
42
- if (!enabled) return
43
-
44
- val bottomInsetHeight = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding()
45
- val topInset = if (getPlatformName() == "Android") getStatusBarHeight() - 14.dp else getStatusBarHeight()
46
- val bottomInset = if (getPlatformName() == "iOS") minOf(bottomInsetHeight, 21.dp) else bottomInsetHeight
47
-
48
- Box(modifier = Modifier.fillMaxSize()) {
49
- // Danger zones
50
- Box(
51
- modifier = Modifier
52
- .fillMaxWidth()
53
- .height(topInset)
54
- .background(Color.Red.copy(alpha = 0.15f))
55
- )
56
- Box(
57
- modifier = Modifier
58
- .width(12.dp)
59
- .fillMaxHeight()
60
- .padding(top = topInset, bottom = bottomInset)
61
- .background(Color.Red.copy(alpha = 0.15f))
62
- )
63
- Box(
64
- modifier = Modifier
65
- .width(12.dp)
66
- .fillMaxHeight()
67
- .padding(top = topInset, bottom = bottomInset)
68
- .background(Color.Red.copy(alpha = 0.15f))
69
- .align(Alignment.TopEnd)
70
- )
71
- Box(
72
- modifier = Modifier
73
- .fillMaxWidth()
74
- .height(bottomInset)
75
- .background(Color.Red.copy(alpha = 0.15f))
76
- .align(Alignment.BottomCenter)
77
- )
78
-
79
- // Danger lines
80
- BaselineDottedLine(
81
- Modifier
82
- .padding(top = topInset)
83
- .fillMaxWidth(),
84
- isDotted = false,
85
- color = Color(0xFFE400FF)
86
- )
87
- BaselineDottedLine(
88
- Modifier
89
- .padding(top = topInset + 52.dp)
90
- .fillMaxWidth(),
91
- color = Color(0xFFE400FF)
92
- )
93
- BaselineDottedLine(
94
- Modifier
95
- .padding(top = topInset + 104.dp)
96
- .fillMaxWidth(),
97
- color = Color(0xFFE400FF)
98
- )
99
- BaselineDottedLine(
100
- Modifier
101
- .padding(bottom = bottomInset + 64.dp)
102
- .fillMaxWidth()
103
- .align(Alignment.BottomCenter),
104
- color = Color(0xFFE400FF)
105
- )
106
- BaselineDottedLine(
107
- Modifier
108
- .padding(bottom = bottomInset)
109
- .fillMaxWidth()
110
- .align(Alignment.BottomCenter),
111
- isDotted = false,
112
- color = Color(0xFFE400FF)
113
- )
114
- BaselineDottedLine(
115
- Modifier
116
- .padding(start = 12.dp)
117
- .fillMaxHeight(),
118
- orientation = BaselineOrientation.Vertical,
119
- isDotted = false,
120
- color = Color(0xFFE400FF)
121
- )
122
- BaselineDottedLine(
123
- Modifier
124
- .padding(end = 12.dp)
125
- .fillMaxHeight()
126
- .align(Alignment.BottomEnd),
127
- orientation = BaselineOrientation.Vertical,
128
- isDotted = false,
129
- color = Color(0xFFE400FF)
130
- )
131
-
132
- // Warning lines
133
- BaselineDottedLine(
134
- Modifier
135
- .padding(top = topInset + 26.dp)
136
- .fillMaxWidth(),
137
- color = Color(0xFFFF7A00)
138
- )
139
- BaselineDottedLine(
140
- Modifier
141
- .padding(bottom = bottomInset + 56.dp)
142
- .fillMaxWidth()
143
- .align(Alignment.BottomCenter),
144
- color = Color(0xFFFFCC00)
145
- )
146
- BaselineDottedLine(
147
- Modifier
148
- .padding(bottom = bottomInset + 8.dp)
149
- .fillMaxWidth()
150
- .align(Alignment.BottomCenter),
151
- color = Color(0xFFFFCC00)
152
- )
153
-
154
- // Header background warning lines
155
- BaselineDottedLine(
156
- Modifier
157
- .padding(start = 40.dp, top = topInset)
158
- .height(52.dp),
159
- color = Color(0xFF00C520),
160
- orientation = BaselineOrientation.Vertical
161
- )
162
- BaselineDottedLine(
163
- Modifier
164
- .padding(start = 48.dp, top = topInset)
165
- .height(52.dp),
166
- color = Color(0xFF00C520),
167
- orientation = BaselineOrientation.Vertical
168
- )
169
- }
170
- }
171
-
172
- enum class BaselineOrientation { Horizontal, Vertical }
173
-
174
- @Composable
175
- fun BaselineDottedLine(
176
- modifier: Modifier = Modifier,
177
- color: Color = Color.Red,
178
- orientation: BaselineOrientation = BaselineOrientation.Horizontal,
179
- isDotted: Boolean = true
180
- ) {
181
- Canvas(modifier = modifier) {
182
- val pathEffect = if (isDotted) PathEffect.dashPathEffect(floatArrayOf(8f, 8f)) else null
183
- drawLine(
184
- color = color,
185
- start = if (orientation == BaselineOrientation.Horizontal) Offset(
186
- 0f,
187
- size.height / 2
188
- ) else Offset(size.width / 2, 0f),
189
- end = if (orientation == BaselineOrientation.Horizontal) Offset(
190
- size.width,
191
- size.height / 2
192
- ) else Offset(size.width / 2, size.height),
193
- strokeWidth = 1.dp.toPx(),
194
- pathEffect = pathEffect,
195
- cap = StrokeCap.Round,
196
- )
197
- }
198
- }