@momo-kits/native-kits 0.157.2-debug → 0.157.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.
package/compose/build.gradle.kts
CHANGED
package/compose/compose.podspec
CHANGED
|
@@ -8,8 +8,11 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
|
8
8
|
import androidx.compose.foundation.layout.Arrangement
|
|
9
9
|
import androidx.compose.foundation.layout.Box
|
|
10
10
|
import androidx.compose.foundation.layout.Column
|
|
11
|
+
import androidx.compose.foundation.layout.IntrinsicSize
|
|
11
12
|
import androidx.compose.foundation.layout.Row
|
|
12
13
|
import androidx.compose.foundation.layout.Spacer
|
|
14
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
15
|
+
import androidx.compose.foundation.layout.height
|
|
13
16
|
import androidx.compose.foundation.layout.offset
|
|
14
17
|
import androidx.compose.foundation.layout.padding
|
|
15
18
|
import androidx.compose.foundation.layout.size
|
|
@@ -221,7 +224,7 @@ private class TooltipPositionProvider(
|
|
|
221
224
|
fun Tooltip(
|
|
222
225
|
state: TooltipState,
|
|
223
226
|
title: String? = null,
|
|
224
|
-
description: String
|
|
227
|
+
description: String,
|
|
225
228
|
buttons: List<TooltipButton> = emptyList(),
|
|
226
229
|
placement: TooltipPlacement = TooltipPlacement.TOP,
|
|
227
230
|
align: TooltipAlign = TooltipAlign.CENTER,
|
|
@@ -282,6 +285,7 @@ private fun TooltipPopupContent(
|
|
|
282
285
|
Column(
|
|
283
286
|
modifier = Modifier
|
|
284
287
|
.widthIn(max = tooltipMaxWidth)
|
|
288
|
+
.width(IntrinsicSize.Max)
|
|
285
289
|
.background(Colors.black_17, tooltipShape)
|
|
286
290
|
.clip(tooltipShape)
|
|
287
291
|
.conditional(IsShowBaseLineDebug) {
|
|
@@ -289,8 +293,8 @@ private fun TooltipPopupContent(
|
|
|
289
293
|
}
|
|
290
294
|
.padding(Spacing.M)
|
|
291
295
|
) {
|
|
292
|
-
Row {
|
|
293
|
-
Column(modifier = Modifier.weight(1f
|
|
296
|
+
Row(Modifier.fillMaxWidth()) {
|
|
297
|
+
Column(modifier = Modifier.weight(1f)) {
|
|
294
298
|
if (!title.isNullOrEmpty()) {
|
|
295
299
|
Text(
|
|
296
300
|
text = title,
|
|
@@ -307,7 +311,6 @@ private fun TooltipPopupContent(
|
|
|
307
311
|
style = Typography.descriptionDefaultRegular,
|
|
308
312
|
color = Colors.black_01,
|
|
309
313
|
maxLines = 2,
|
|
310
|
-
modifier = Modifier.padding(bottom = Spacing.M),
|
|
311
314
|
overflow = TextOverflow.Ellipsis,
|
|
312
315
|
)
|
|
313
316
|
}
|
|
@@ -330,6 +333,7 @@ private fun TooltipPopupContent(
|
|
|
330
333
|
}
|
|
331
334
|
}
|
|
332
335
|
if (buttons.isNotEmpty()) {
|
|
336
|
+
Spacer(Modifier.height(Spacing.M))
|
|
333
337
|
TooltipButtons(
|
|
334
338
|
buttons = buttons,
|
|
335
339
|
modifier = Modifier.align(Alignment.End),
|
|
@@ -488,6 +492,7 @@ private fun TooltipButtons(buttons: List<TooltipButton>, modifier: Modifier = Mo
|
|
|
488
492
|
TooltipSecondaryButton(
|
|
489
493
|
title = secondary.title ?: "",
|
|
490
494
|
onPress = secondary.onPress ?: {},
|
|
495
|
+
modifier = Modifier.weight(1f, fill = false),
|
|
491
496
|
)
|
|
492
497
|
Spacer(modifier = Modifier.width(Spacing.S))
|
|
493
498
|
TooltipPrimaryButton(
|
|
@@ -520,6 +525,12 @@ private fun TooltipSingleButton(btn: TooltipButton) {
|
|
|
520
525
|
)
|
|
521
526
|
}
|
|
522
527
|
}
|
|
528
|
+
|
|
529
|
+
private const val MAX_BUTTON_LENGTH = 16
|
|
530
|
+
|
|
531
|
+
private fun String.limitWithEllipsis(max: Int = 16): String {
|
|
532
|
+
return if (length > max) take(max) + "…" else this
|
|
533
|
+
}
|
|
523
534
|
@Composable
|
|
524
535
|
private fun TooltipPrimaryButton(
|
|
525
536
|
title: String,
|
|
@@ -527,7 +538,7 @@ private fun TooltipPrimaryButton(
|
|
|
527
538
|
) {
|
|
528
539
|
Button(
|
|
529
540
|
onClick = onPress,
|
|
530
|
-
title = title,
|
|
541
|
+
title = title.limitWithEllipsis(),
|
|
531
542
|
type = ButtonType.SECONDARY,
|
|
532
543
|
size = Size.MEDIUM,
|
|
533
544
|
isFull = false,
|
|
@@ -537,18 +548,21 @@ private fun TooltipPrimaryButton(
|
|
|
537
548
|
private fun TooltipSecondaryButton(
|
|
538
549
|
title: String,
|
|
539
550
|
onPress: () -> Unit,
|
|
551
|
+
modifier: Modifier = Modifier,
|
|
540
552
|
) {
|
|
541
553
|
Box(
|
|
542
|
-
modifier =
|
|
554
|
+
modifier = modifier
|
|
543
555
|
.activeOpacityClickable {
|
|
544
556
|
onPress()
|
|
545
557
|
}
|
|
546
558
|
.padding(horizontal = Spacing.M, vertical = Spacing.S),
|
|
547
559
|
) {
|
|
548
560
|
Text(
|
|
549
|
-
text = title,
|
|
561
|
+
text = title.limitWithEllipsis(),
|
|
550
562
|
color = Colors.black_01,
|
|
551
563
|
style = Typography.actionSBold,
|
|
564
|
+
maxLines = 1,
|
|
565
|
+
overflow = TextOverflow.Ellipsis,
|
|
552
566
|
)
|
|
553
567
|
}
|
|
554
568
|
}
|
package/gradle.properties
CHANGED