@momo-kits/native-kits 0.157.2-debug → 0.157.2

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.
Files changed (117) hide show
  1. package/package.json +1 -1
  2. package/build.gradle.kts +0 -11
  3. package/compose/build.gradle.kts +0 -180
  4. package/compose/build.gradle.kts.backup +0 -180
  5. package/compose/compose.podspec +0 -54
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -110
  7. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  8. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  9. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  10. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  11. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  12. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -107
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -305
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -720
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -121
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -405
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -85
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -340
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -198
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -94
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -136
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -148
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -188
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -116
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -448
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -172
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -255
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -231
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -233
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -254
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -241
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -92
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -352
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -103
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -70
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -17
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -96
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -96
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -92
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -130
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -214
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -576
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -177
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -205
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -239
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -13
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -185
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -285
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -59
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -14
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -50
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -239
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -119
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -98
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -161
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -331
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -497
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -162
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -243
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -187
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -279
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -32
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -370
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -42
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -62
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -88
  110. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -149
  111. package/gradle/libs.versions.toml +0 -57
  112. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  113. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  114. package/gradle.properties +0 -26
  115. package/gradlew +0 -252
  116. package/gradlew.bat +0 -94
  117. package/settings.gradle.kts +0 -52
@@ -1,32 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.Box
6
- import androidx.compose.foundation.layout.size
7
- import androidx.compose.foundation.shape.RoundedCornerShape
8
- import androidx.compose.runtime.Composable
9
- import androidx.compose.ui.Modifier
10
- import androidx.compose.ui.unit.dp
11
- import vn.momo.kits.application.IsShowBaseLineDebug
12
- import vn.momo.kits.const.Colors
13
- import vn.momo.kits.const.Radius
14
- import vn.momo.kits.modifier.conditional
15
-
16
- enum class DotSize(val size: Int) {
17
- Small(10),
18
- Large(16)
19
- }
20
-
21
- @Composable
22
- fun BadgeDot(size: DotSize = DotSize.Large, modifier: Modifier = Modifier) {
23
- Box(
24
- modifier = modifier
25
- .size(size.size.dp)
26
- .border(width = 1.dp, color = Colors.black_01, shape = RoundedCornerShape(Radius.S))
27
- .background(color = Colors.red_03, shape = RoundedCornerShape(Radius.S))
28
- .conditional(IsShowBaseLineDebug) {
29
- border(1.dp, Colors.blue_03)
30
- }
31
- )
32
- }
@@ -1,340 +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.Row
8
- import androidx.compose.foundation.layout.height
9
- import androidx.compose.foundation.layout.padding
10
- import androidx.compose.foundation.layout.size
11
- import androidx.compose.foundation.layout.width
12
- import androidx.compose.foundation.shape.RoundedCornerShape
13
- import androidx.compose.runtime.Composable
14
- import androidx.compose.runtime.remember
15
- import androidx.compose.ui.Alignment
16
- import androidx.compose.ui.Modifier
17
- import androidx.compose.ui.geometry.CornerRadius
18
- import androidx.compose.ui.geometry.Offset
19
- import androidx.compose.ui.geometry.Rect
20
- import androidx.compose.ui.geometry.RoundRect
21
- import androidx.compose.ui.geometry.Size
22
- import androidx.compose.ui.graphics.Color
23
- import androidx.compose.ui.graphics.Path
24
- import androidx.compose.ui.graphics.graphicsLayer
25
- import androidx.compose.ui.layout.ContentScale
26
- import androidx.compose.ui.platform.LocalDensity
27
- import androidx.compose.ui.text.rememberTextMeasurer
28
- import androidx.compose.ui.text.style.TextAlign
29
- import androidx.compose.ui.text.style.TextOverflow
30
- import androidx.compose.ui.unit.Dp
31
- import androidx.compose.ui.unit.dp
32
- import androidx.compose.ui.unit.sp
33
- import vn.momo.kits.application.IsShowBaseLineDebug
34
- import vn.momo.kits.const.AppTheme
35
- import vn.momo.kits.const.Colors
36
- import vn.momo.kits.const.Typography
37
- import vn.momo.kits.const.getFontFamily
38
- import vn.momo.kits.const.scaleSize
39
- import vn.momo.kits.modifier.conditional
40
-
41
- @Composable
42
- fun BadgeRibbon(
43
- position: RibbonPosition = RibbonPosition.TopRight,
44
- label: String = "Label",
45
- isRound: Boolean = false,
46
- modifier: Modifier = Modifier,
47
- ) {
48
- val theme = AppTheme.current
49
-
50
- val rotate = if (position == RibbonPosition.TopRight || position == RibbonPosition.BottomRight) 180f else 0f
51
- val useUpTail = position == RibbonPosition.BottomLeft || position == RibbonPosition.TopRight
52
- val verticalAlignment = when(position){
53
- RibbonPosition.TopLeft, RibbonPosition.BottomRight -> Alignment.Top
54
- RibbonPosition.BottomLeft, RibbonPosition.TopRight -> Alignment.Bottom
55
- }
56
-
57
- Row(
58
- modifier = modifier
59
- .height(ribbonHeight)
60
- .conditional(IsShowBaseLineDebug) {
61
- border(1.dp, Colors.blue_03)
62
- }
63
- .graphicsLayer { rotationZ = rotate },
64
- verticalAlignment = verticalAlignment
65
- ) {
66
- if (useUpTail) {
67
- UpTail()
68
- } else {
69
- DownTail()
70
- }
71
-
72
- if (isRound) {
73
- renderRoundContent(label, rotate, theme.colors.warning.primary)
74
- } else {
75
- renderSkewContent(label, rotate, theme.colors.warning.primary)
76
- }
77
- }
78
- }
79
-
80
- @Composable
81
- fun renderRoundContent(label: String, rotate: Float, backgroundColor: Color){
82
- Box(
83
- modifier = Modifier
84
- .height(roundHeight)
85
- .background(
86
- color = backgroundColor,
87
- shape = RoundedCornerShape(
88
- topEnd = roundRightRadius,
89
- bottomEnd = roundRightRadius,
90
- )
91
- )
92
- .padding(end = roundPaddingEnd),
93
- contentAlignment = Alignment.Center,
94
- ) {
95
- Label(label, rotate)
96
- }
97
- }
98
-
99
- @Composable
100
- fun renderSkewContent(label: String, rotate: Float, backgroundColor: Color){
101
- Box(
102
- modifier = Modifier
103
- .height(skewBodyHeight)
104
- .background(backgroundColor),
105
- contentAlignment = Alignment.Center
106
- ) {
107
- Label(label, rotate)
108
- }
109
- RightTail()
110
- }
111
-
112
- @Composable
113
- fun Label(label: String, rotate: Float){
114
- Text(
115
- text = label,
116
- color = Colors.black_01,
117
- maxLines = 1,
118
- overflow = TextOverflow.Ellipsis,
119
- style = Typography.labelXsMedium,
120
- modifier = Modifier.graphicsLayer { rotationZ = rotate }
121
- )
122
- }
123
-
124
- @Composable
125
- fun UpTail() {
126
- Image(
127
- source = "https://static.momocdn.net/app/img/kits/utils/Head_down_4x.png",
128
- modifier = Modifier
129
- .graphicsLayer { rotationZ = 180f }
130
- .width(headTailWidth)
131
- .height(headTailHeight),
132
- options = Options(
133
- contentScale = ContentScale.FillBounds,
134
- )
135
- )
136
- }
137
-
138
- @Composable
139
- fun DownTail() {
140
- Image(
141
- source = "https://static.momocdn.net/app/img/kits/utils/Head_4x.png",
142
- modifier = Modifier
143
- .width(headTailWidth)
144
- .height(headTailHeight),
145
- options = Options(
146
- contentScale = ContentScale.FillBounds,
147
- )
148
- )
149
- }
150
-
151
- @Composable
152
- fun RightTail() {
153
- Image(
154
- source = "https://static.momocdn.net/app/img/kits/utils/Tail_4x.png",
155
- modifier = Modifier
156
- .width(skewTailWidth)
157
- .height(skewTailHeight),
158
- options = Options(
159
- contentScale = ContentScale.FillBounds,
160
- )
161
- )
162
- }
163
-
164
- @Composable
165
- fun RoundedBadgeRibbon(
166
- text: String = "Label",
167
- position: RibbonPosition = RibbonPosition.TopLeft,
168
- modifier: Modifier = Modifier
169
- ) {
170
- val theme = AppTheme.current
171
- val density = LocalDensity.current
172
- val style = Typography.labelXsMedium
173
- val fontFamily = style.fontFamily
174
-
175
- val scaledFontSize = scaleSize(style.fontSize.value).sp
176
- val fontFamilyResult = getFontFamily(fontFamily?.toString() ?: theme.font, style.fontWeight)
177
-
178
- val fontSize = remember(scaledFontSize) { scaledFontSize }
179
- val font = remember(fontFamilyResult) { fontFamilyResult }
180
- val textMeasurer = rememberTextMeasurer()
181
-
182
- val textLayoutResult = remember(text, fontSize, font) {
183
- textMeasurer.measure(
184
- text = text,
185
- style = style.copy(fontSize = fontSize, fontFamily = font)
186
- )
187
- }
188
-
189
- val textWidth = with(density) { textLayoutResult.size.width.toDp() }
190
- val textHeight = with(density) { textLayoutResult.size.height.toDp() }
191
-
192
- val minRibbonHeight = (textHeight * 1.2f).coerceAtLeast(16.dp)
193
- val paddingBottom = minRibbonHeight / 4f
194
- val badgeHeight = minRibbonHeight + paddingBottom
195
- val horizontalPadding = paddingBottom
196
- val badgeWidth = (textWidth + horizontalPadding * 2).coerceAtLeast(28.dp)
197
-
198
- val (rotateZ, scaleY, scaleX) = when (position) {
199
- RibbonPosition.TopLeft -> Triple(0f, 1f, -1f)
200
- RibbonPosition.TopRight -> Triple(0f, 1f, 1f)
201
- RibbonPosition.BottomRight -> Triple(0f, -1f, 1f)
202
- RibbonPosition.BottomLeft -> Triple(0f, -1f, -1f)
203
- }
204
-
205
- Box(
206
- modifier = modifier
207
- .size(width = badgeWidth, height = badgeHeight)
208
- .graphicsLayer {
209
- rotationZ = rotateZ
210
- this.scaleY = scaleY
211
- this.scaleX = scaleX
212
- }
213
- ) {
214
- val roundedRect = (badgeHeight - paddingBottom) / 2f
215
-
216
- Canvas(modifier = Modifier.matchParentSize()) {
217
- val width = size.width
218
- val height = size.height
219
- val ribbonHeight = height - paddingBottom.toPx()
220
- val cornerRadius = roundedRect.toPx()
221
-
222
- val mainColor = Color(0xFFFA541C)
223
- val tailColor = Color(0xFFC41B24)
224
-
225
- val headWidth = 4.dp.toPx()
226
- val leftSectionWidth = width * (9f / 28f)
227
- val middleSectionWidth = width - leftSectionWidth - headWidth
228
- val rightX = leftSectionWidth + middleSectionWidth
229
-
230
- // 1. Tail + 2. BG
231
- val leftMiddlePath = Path().apply {
232
- addRoundRect(
233
- RoundRect(
234
- rect = Rect(
235
- left = 0f,
236
- top = 0f,
237
- right = rightX + 1f,
238
- bottom = ribbonHeight
239
- ),
240
- topLeft = CornerRadius(cornerRadius, cornerRadius),
241
- topRight = CornerRadius.Zero,
242
- bottomRight = CornerRadius.Zero,
243
- bottomLeft = CornerRadius(cornerRadius, cornerRadius)
244
- )
245
- )
246
- }
247
- drawPath(
248
- path = leftMiddlePath,
249
- color = mainColor
250
- )
251
-
252
- // 3. Head
253
- val headPath = Path().apply {
254
- addRoundRect(
255
- RoundRect(
256
- rect = Rect(
257
- left = rightX,
258
- top = 0f,
259
- right = rightX + headWidth,
260
- bottom = ribbonHeight
261
- ),
262
- topLeft = CornerRadius.Zero,
263
- topRight = CornerRadius(cornerRadius, cornerRadius),
264
- bottomRight = CornerRadius.Zero,
265
- bottomLeft = CornerRadius.Zero
266
- )
267
- )
268
- }
269
- drawPath(
270
- path = headPath,
271
- color = mainColor
272
- )
273
-
274
- // Draw bottom tail section
275
- val tailY = ribbonHeight
276
- val tailHeight = paddingBottom.toPx()
277
- val halfHeadWidth = headWidth / 2f
278
- val tailStartX = rightX + headWidth - halfHeadWidth
279
-
280
- // Background square (main color)
281
- drawRect(
282
- color = mainColor,
283
- topLeft = Offset(tailStartX, tailY),
284
- size = Size(halfHeadWidth, halfHeadWidth)
285
- )
286
-
287
- val tailRoundRadius = tailHeight
288
- val tailRightPath = Path().apply {
289
- addRoundRect(
290
- RoundRect(
291
- rect = Rect(
292
- left = tailStartX,
293
- top = tailY,
294
- right = tailStartX + halfHeadWidth,
295
- bottom = tailY + tailHeight
296
- ),
297
- topLeft = CornerRadius.Zero,
298
- topRight = CornerRadius(tailRoundRadius, tailRoundRadius),
299
- bottomRight = CornerRadius(tailRoundRadius, tailRoundRadius),
300
- bottomLeft = CornerRadius.Zero
301
- )
302
- )
303
- }
304
- drawPath(
305
- path = tailRightPath,
306
- color = tailColor
307
- )
308
- }
309
-
310
- Text(
311
- text = text,
312
- modifier = Modifier
313
- .padding(bottom = paddingBottom)
314
- .padding(horizontal = paddingBottom / 2)
315
- .align(Alignment.Center)
316
- .graphicsLayer {
317
- rotationZ = rotateZ
318
- this.scaleY = scaleY
319
- this.scaleX = scaleX
320
- },
321
- textAlign = TextAlign.Center,
322
- style = Typography.labelXsMedium,
323
- maxLines = 1,
324
- overflow = TextOverflow.Ellipsis,
325
- color = Colors.black_01
326
- )
327
- }
328
- }
329
-
330
- val ribbonHeight: Dp = 20.dp
331
- val roundHeight: Dp = 16.dp
332
- val skewBodyHeight: Dp = 16.dp
333
- val roundRightRadius: Dp = 12.dp
334
- val roundPaddingEnd: Dp = 6.dp
335
- val skewTailWidth: Dp = 8.dp
336
- val skewTailHeight: Dp = 16.dp
337
- val headTailWidth: Dp = 5.dp
338
- val headTailHeight: Dp = 20.dp
339
-
340
- enum class RibbonPosition {TopLeft, TopRight, BottomLeft, BottomRight}
@@ -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
- }