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