@momo-kits/native-kits 0.152.4-beta.3 → 0.152.5

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 (155) hide show
  1. package/package.json +7 -6
  2. package/shared/build.gradle.kts +74 -0
  3. package/CODE_OF_CONDUCT.md +0 -133
  4. package/CONTRIBUTING.md +0 -114
  5. package/LICENSE +0 -20
  6. package/README.md +0 -7
  7. package/build.gradle.kts +0 -32
  8. package/compose/MoMoComposeKits.podspec +0 -54
  9. package/compose/build.gradle.kts +0 -149
  10. package/compose/src/androidMain/AndroidManifest.xml +0 -2
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -105
  12. package/compose/src/commonMain/composeResources/files/lottie_circle_loader.json +0 -1
  13. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  14. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  23. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  24. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  25. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  26. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -306
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -715
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -214
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -236
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -77
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -27
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -334
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -345
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -90
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -131
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -69
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -143
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -179
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -111
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -384
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -160
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -234
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -223
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -232
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -236
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -228
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -50
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -34
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -85
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -33
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -338
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -95
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -64
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -89
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -84
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -208
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -172
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -199
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -237
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -13
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -191
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -258
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -59
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -49
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -232
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -111
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -94
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -159
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -232
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScaleSizeScope.kt +0 -17
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -459
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -169
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -216
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -180
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -251
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -31
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -385
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -38
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -62
  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 -144
  111. package/gradle.properties +0 -19
  112. package/gradlew +0 -240
  113. package/gradlew.bat +0 -91
  114. package/ios/Application/ApplicationEnvironment.swift +0 -50
  115. package/ios/Application/Components.swift +0 -263
  116. package/ios/Application/ComposeApi.swift +0 -22
  117. package/ios/Application/FloatingButton.swift +0 -172
  118. package/ios/Application/HeaderRight.swift +0 -271
  119. package/ios/Application/Screen.swift +0 -249
  120. package/ios/Badge/BadgeDot.swift +0 -31
  121. package/ios/Button/Button.swift +0 -211
  122. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +0 -126
  123. package/ios/Checkbox/Checkbox.swift +0 -81
  124. package/ios/Chip/Chip.swift +0 -96
  125. package/ios/Colors+Radius+Spacing/Colors.swift +0 -172
  126. package/ios/Colors+Radius+Spacing/Radius.swift +0 -22
  127. package/ios/Colors+Radius+Spacing/Spacing.swift +0 -12
  128. package/ios/Extensions/Color++.swift +0 -25
  129. package/ios/Icon/Icon.swift +0 -51
  130. package/ios/Image/Image.swift +0 -70
  131. package/ios/Input/Input.swift +0 -207
  132. package/ios/Input/InputPhoneNumber.swift +0 -176
  133. package/ios/Input/InputSearch.swift +0 -238
  134. package/ios/Input/InputTextArea.swift +0 -242
  135. package/ios/Lottie/LottieView.swift +0 -86
  136. package/ios/OTPKeyboard/KeyboardButton.swift +0 -41
  137. package/ios/OTPKeyboard/OTPKeyboard.swift +0 -145
  138. package/ios/Popup/PopupDisplay.swift +0 -284
  139. package/ios/Popup/PopupInput.swift +0 -96
  140. package/ios/Popup/PopupPromotion.swift +0 -73
  141. package/ios/PopupView/FullscreenPopup.swift +0 -251
  142. package/ios/PopupView/Modifiers.swift +0 -158
  143. package/ios/PopupView/PopupView.swift +0 -289
  144. package/ios/PopupView/Utils++.swift +0 -281
  145. package/ios/ScrollIndicator/ScrollIndicator.swift +0 -110
  146. package/ios/Swipeable/SwipeCell.swift +0 -278
  147. package/ios/Swipeable/SwipeCellModel.swift +0 -86
  148. package/ios/Switch/Switch.swift +0 -44
  149. package/ios/Template/Logo/Logo.swift +0 -75
  150. package/ios/Template/TrustBanner/TrustBanner.swift +0 -120
  151. package/ios/Theme.md +0 -18
  152. package/ios/Typography/Text.swift +0 -140
  153. package/ios/Typography/Typography.swift +0 -95
  154. package/ios/native-kits.podspec +0 -18
  155. package/settings.gradle.kts +0 -25
@@ -1,86 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.layout.Box
5
- import androidx.compose.foundation.layout.Row
6
- import androidx.compose.foundation.layout.height
7
- import androidx.compose.foundation.layout.padding
8
- import androidx.compose.foundation.shape.RoundedCornerShape
9
- import androidx.compose.runtime.Composable
10
- import androidx.compose.ui.Alignment
11
- import androidx.compose.ui.Modifier
12
- import androidx.compose.ui.graphics.Color
13
- import androidx.compose.ui.unit.dp
14
- import vn.momo.kits.const.Colors
15
- import vn.momo.kits.const.Radius
16
- import vn.momo.kits.const.Spacing
17
- import vn.momo.kits.const.Typography
18
- import vn.momo.kits.const.scaleSize
19
-
20
- enum class TagSize(val height: Float) {
21
- Large(24.toFloat()),
22
- Medium(18.toFloat())
23
- }
24
-
25
- enum class TagColor(val backgroundColor: Color, val textColor: Color) {
26
- Default(Colors.black_04, Colors.black_17),
27
- Orange(Colors.orange_08, Colors.orange_03),
28
- Green(Colors.green_08, Colors.green_03),
29
- Red(Colors.red_08, Colors.red_03),
30
- Blue(Colors.blue_08, Colors.blue_03),
31
- Grey(Colors.black_04, Colors.black_12),
32
- }
33
-
34
- @Composable
35
- fun Tag(
36
- label: String = "Label",
37
- icon: String? = null,
38
- color: TagColor = TagColor.Default,
39
- size: TagSize = TagSize.Large,
40
- customColor: Color? = null,
41
- ) {
42
- val primaryColors = listOf(
43
- Color(0xFFF0F0F0),
44
- Color(0xFFEB2F96),
45
- Color(0xFF962AF0),
46
- Color(0xFF4E4BFF),
47
- Color(0xFF007AFF),
48
- Color(0xFF13C2C2),
49
- Color(0xFF34C759),
50
- Color(0xFFA0D911),
51
- Color(0xFFFFCC00),
52
- Color(0xFFFA8C16),
53
- Color(0xFFFA541C),
54
- Color(0xFFF5222D)
55
- )
56
- var tagColor = color.backgroundColor
57
- var labelColor = color.textColor
58
-
59
- if (primaryColors.contains(customColor)) {
60
- tagColor = color.backgroundColor
61
- labelColor = color.textColor
62
- }
63
-
64
- Box(
65
- modifier = Modifier
66
- .height(scaleSize(size.height).dp)
67
- .background(tagColor, shape = RoundedCornerShape(Radius.S))
68
- .padding(horizontal = Spacing.S),
69
- contentAlignment = Alignment.Center
70
- ) {
71
- Row(verticalAlignment = Alignment.CenterVertically) {
72
- if (icon != null) {
73
- Icon(
74
- source = icon,
75
- size = 16.dp,
76
- color = labelColor
77
- )
78
- }
79
- Text(
80
- text = label,
81
- color = labelColor,
82
- style = Typography.labelSMedium
83
- )
84
- }
85
- }
86
- }
@@ -1,84 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.runtime.Composable
4
- import androidx.compose.runtime.remember
5
- import androidx.compose.ui.Modifier
6
- import androidx.compose.ui.graphics.Color
7
- import androidx.compose.ui.text.TextLayoutResult
8
- import androidx.compose.ui.text.TextStyle
9
- import androidx.compose.ui.text.style.TextAlign
10
- import androidx.compose.ui.text.style.TextDecoration
11
- import androidx.compose.ui.text.style.TextOverflow
12
- import androidx.compose.ui.unit.TextUnit
13
- import androidx.compose.ui.unit.sp
14
- import vn.momo.kits.const.AppTheme
15
- import vn.momo.kits.const.Typography
16
- import vn.momo.kits.const.getFontFamily
17
- import vn.momo.kits.const.scaleSize
18
- import vn.momo.kits.modifier.setAutomationId
19
-
20
- @Composable
21
- fun Text(
22
- text: String,
23
- color: Color? = null,
24
- style: TextStyle = Typography.bodyDefaultRegular,
25
- textAlign: TextAlign? = TextAlign.Start,
26
- modifier: Modifier = Modifier,
27
- maxLines: Int = Int.MAX_VALUE,
28
- overflow: TextOverflow = TextOverflow.Clip,
29
- textDecoration: TextDecoration? = null,
30
- onTextLayout: ((TextLayoutResult) -> Unit)? = null,
31
- fontFamily: String? = null,
32
- minLines: Int = 1,
33
- letterSpacing: TextUnit = TextUnit.Unspecified,
34
- softWrap: Boolean = true,
35
- accessibilityId: String? = null
36
- ) {
37
- // Cache theme access to avoid repeated lookups
38
- val theme = AppTheme.current
39
-
40
- // Call @Composable functions directly in composable context
41
- val scaledFontSize = scaleSize(style.fontSize.value).sp
42
- val scaledLineHeight = scaleSize(style.lineHeight.value).sp
43
- val fontFamilyResult = getFontFamily(fontFamily ?: theme.font, style.fontWeight)
44
-
45
- // Now memoize the results
46
- val fontSize = remember(scaledFontSize) { scaledFontSize }
47
- val lineHeight = remember(scaledLineHeight) { scaledLineHeight }
48
- val font = remember(fontFamilyResult) { fontFamilyResult }
49
-
50
- // Memoize color calculation
51
- val textColor = remember(color, theme) {
52
- color ?: theme.colors.text.default
53
- }
54
-
55
- // Memoize style copy operation
56
- val optimizedStyle = remember(style) {
57
- style.copy(
58
- fontWeight = null,
59
- lineHeight = if (lineHeight.value.isFinite() && lineHeight.value > 0) lineHeight else style.lineHeight
60
- )
61
- }
62
-
63
- // Memoize automation ID
64
- val automationId = remember(accessibilityId, text) {
65
- accessibilityId ?: text
66
- }
67
-
68
- androidx.compose.material3.Text(
69
- modifier = modifier.setAutomationId(automationId, text),
70
- text = text,
71
- color = textColor,
72
- style = optimizedStyle,
73
- textAlign = textAlign,
74
- fontSize = fontSize,
75
- fontFamily = font,
76
- maxLines = maxLines,
77
- softWrap = softWrap,
78
- letterSpacing = letterSpacing,
79
- minLines = minLines,
80
- textDecoration = textDecoration,
81
- onTextLayout = onTextLayout,
82
- overflow = overflow
83
- )
84
- }
@@ -1,208 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.clickable
5
- import androidx.compose.foundation.layout.Arrangement
6
- import androidx.compose.foundation.layout.Box
7
- import androidx.compose.foundation.layout.Column
8
- import androidx.compose.foundation.layout.IntrinsicSize
9
- import androidx.compose.foundation.layout.Row
10
- import androidx.compose.foundation.layout.Spacer
11
- import androidx.compose.foundation.layout.fillMaxHeight
12
- import androidx.compose.foundation.layout.fillMaxWidth
13
- import androidx.compose.foundation.layout.height
14
- import androidx.compose.foundation.layout.padding
15
- import androidx.compose.foundation.layout.size
16
- import androidx.compose.foundation.layout.width
17
- import androidx.compose.foundation.shape.RoundedCornerShape
18
- import androidx.compose.runtime.Composable
19
- import androidx.compose.ui.Alignment
20
- import androidx.compose.ui.Modifier
21
- import androidx.compose.ui.graphics.Color
22
- import androidx.compose.ui.text.TextStyle
23
- import androidx.compose.ui.text.font.FontWeight
24
- import androidx.compose.ui.unit.dp
25
- import androidx.compose.ui.unit.sp
26
- import vn.momo.kits.const.AppTheme
27
- import vn.momo.kits.const.Colors
28
- import vn.momo.kits.const.Spacing
29
- import vn.momo.kits.const.Typography
30
-
31
- enum class TitleType { Card, Section }
32
- enum class TitleSize { Small, Medium, Large }
33
- enum class IconAlign { Top, Center, Bottom }
34
- enum class ButtonSize { Small, Large }
35
-
36
- @Composable
37
- fun Title(
38
- title: String,
39
- type: TitleType = TitleType.Section,
40
- size: TitleSize = TitleSize.Medium,
41
- icon: String? = null,
42
- iconColor: Color? = null,
43
- iconAlign: IconAlign = IconAlign.Top,
44
- showRightAction: Boolean = false,
45
- showTrailingAction: Boolean = false,
46
- badgeLabel: String? = null,
47
- buttonTitle: String? = null,
48
- buttonSize: ButtonSize = ButtonSize.Small,
49
- onPressRightAction: () -> Unit = {},
50
- onPressTrailingAction: () -> Unit = {},
51
- textOnly: Boolean = false,
52
- description: String? = null,
53
- modifier: Modifier = Modifier
54
- ) {
55
- val theme = AppTheme.current
56
- val textStyle: TextStyle = when (type) {
57
- TitleType.Card -> when (size) {
58
- TitleSize.Small -> TextStyle(fontSize = 14.sp, lineHeight = 20.sp)
59
- TitleSize.Medium -> TextStyle(fontSize = 16.sp, lineHeight = 22.sp)
60
- TitleSize.Large -> TextStyle(fontSize = 18.sp, lineHeight = 26.sp)
61
- }
62
-
63
- TitleType.Section -> when (size) {
64
- TitleSize.Small -> TextStyle(
65
- fontSize = 16.sp,
66
- lineHeight = 24.sp,
67
- fontWeight = FontWeight.Bold
68
- )
69
-
70
- TitleSize.Medium -> TextStyle(
71
- fontSize = 18.sp,
72
- lineHeight = 26.sp,
73
- fontWeight = FontWeight.Bold
74
- )
75
-
76
- TitleSize.Large -> TextStyle(
77
- fontSize = 20.sp,
78
- lineHeight = 28.sp,
79
- fontWeight = FontWeight.Bold
80
- )
81
- }
82
- }
83
-
84
- if (textOnly) {
85
- Text(
86
- text = title,
87
- style = textStyle,
88
- modifier = modifier
89
- )
90
- return
91
- }
92
-
93
- Row(
94
- modifier = modifier
95
- .fillMaxWidth()
96
- .height(IntrinsicSize.Min)
97
- .padding(8.dp),
98
- verticalAlignment = Alignment.CenterVertically
99
- ) {
100
- icon?.let {
101
- Column(
102
- modifier = Modifier.fillMaxHeight().padding(end = Spacing.S),
103
- verticalArrangement = when (iconAlign) {
104
- IconAlign.Top -> Arrangement.Top
105
- IconAlign.Center -> Arrangement.Center
106
- IconAlign.Bottom -> Arrangement.Bottom
107
- },
108
- ) {
109
- // Icon
110
- Icon(
111
- source = it,
112
- color = iconColor ?: theme.colors.text.default,
113
- modifier = Modifier.size(24.dp)
114
- )
115
- }
116
- }
117
-
118
- Column(
119
- modifier = Modifier.weight(1f)
120
- ) {
121
- Row(
122
- verticalAlignment = Alignment.CenterVertically
123
- ) {
124
- Row(
125
- verticalAlignment = Alignment.CenterVertically,
126
- modifier = if (showTrailingAction) Modifier else Modifier.weight(1f),
127
- ) {
128
- Text(
129
- text = title,
130
- style = textStyle,
131
- maxLines = if (showTrailingAction || badgeLabel != null) 1 else 2,
132
- )
133
-
134
- // Badge
135
- badgeLabel?.let {
136
- Spacer(modifier = Modifier.width(4.dp))
137
- Badge(
138
- label = it
139
- )
140
- }
141
-
142
- }
143
-
144
- // Trailing action (icon)
145
- if (showTrailingAction && !showRightAction) {
146
- Spacer(modifier = Modifier.width(8.dp))
147
- Box(
148
- modifier = Modifier
149
- .size(24.dp)
150
- .background(
151
- color = if (type == TitleType.Section) Colors.black_06.copy(0.6f) else Colors.black_06.copy(
152
- 0.3f
153
- ),
154
- shape = RoundedCornerShape(12.dp)
155
- )
156
- .clickable { onPressTrailingAction() },
157
- contentAlignment = Alignment.Center
158
- ) {
159
- Icon(
160
- source = "arrow_chevron_right_small",
161
- size = 18.dp
162
- )
163
- }
164
- }
165
- }
166
-
167
- // Description
168
- description?.let {
169
- Spacer(modifier = Modifier.height(4.dp))
170
- Text(
171
- text = it,
172
- style = Typography.descriptionDefaultRegular,
173
- color = theme.colors.text.secondary
174
- )
175
- }
176
- }
177
-
178
- // Right action (button or icon)
179
- if (showRightAction && !showTrailingAction) {
180
- Spacer(modifier = Modifier.width(8.dp))
181
- if (buttonTitle != null) {
182
- Text(
183
- text = buttonTitle,
184
- style = if (buttonSize === ButtonSize.Small) Typography.actionXsBold else Typography.actionSBold,
185
- color = theme.colors.primary,
186
- modifier = Modifier.clickable { onPressRightAction() }
187
- )
188
- } else {
189
- Box(
190
- modifier = Modifier
191
- .size(24.dp)
192
- .background(
193
- color = Colors.pink_03.copy(alpha = 0.1f),
194
- shape = RoundedCornerShape(12.dp)
195
- )
196
- .clickable { onPressRightAction() },
197
- contentAlignment = Alignment.Center
198
- ) {
199
- Icon(
200
- source = "arrow_chevron_right_small",
201
- modifier = Modifier.size(22.dp),
202
- color = theme.colors.primary
203
- )
204
- }
205
- }
206
- }
207
- }
208
- }
@@ -1,172 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.clickable
5
- import androidx.compose.foundation.layout.Arrangement
6
- import androidx.compose.foundation.layout.Column
7
- import androidx.compose.foundation.layout.Row
8
- import androidx.compose.foundation.layout.fillMaxWidth
9
- import androidx.compose.foundation.layout.height
10
- import androidx.compose.foundation.layout.padding
11
- import androidx.compose.foundation.layout.width
12
- import androidx.compose.foundation.shape.RoundedCornerShape
13
- import androidx.compose.runtime.Composable
14
- import androidx.compose.ui.Alignment
15
- import androidx.compose.ui.Modifier
16
- import androidx.compose.ui.draw.clip
17
- import androidx.compose.ui.graphics.Color
18
- import androidx.compose.ui.layout.ContentScale
19
- import androidx.compose.ui.unit.dp
20
- import androidx.compose.ui.unit.sp
21
- import vn.momo.kits.application.AppConfig
22
- import vn.momo.kits.application.AppLanguage
23
- import vn.momo.kits.modifier.noFeedbackClickable
24
- import vn.momo.kits.components.Text
25
- import vn.momo.kits.const.Typography
26
-
27
- val defaultBanner = TrustBannerData(
28
- content = mapOf(
29
- "vi" to "An toàn tài sản & Bảo mật thông tin của bạn là ưu tiên hàng đầu của MoMo.",
30
- "en" to "Ensuring financial security and data privacy is MoMo's highest priority."
31
- ),
32
- subContent = mapOf(
33
- "vi" to "Tìm hiểu thêm",
34
- "en" to "Learn more"
35
- ),
36
- pciImage = "https://static.momocdn.net/app/img/kits/trustBanner/pci_dss.png",
37
- sslImage = "https://static.momocdn.net/app/img/kits/trustBanner/ssl.png",
38
- urlConfig = "login_and_security",
39
- icons = listOf(
40
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png",
41
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_agribank.png",
42
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png",
43
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png"
44
- ),
45
- momoImage = "https://static.momocdn.net/app/img/kits/trustBanner/ic_secu.png"
46
- )
47
-
48
- const val backgroundBlue = 0xFFF2F8FF
49
- const val contentColor = 0xFF484848
50
- const val subContentColor = 0xFFEB2F96
51
-
52
- data class TrustBannerData(
53
- val content: Map<String, String> = mapOf("vi" to "", "en" to ""),
54
- val subContent: Map<String, String> = mapOf("vi" to "", "en" to ""),
55
- val pciImage: String? = null,
56
- val momoImage: String? = null,
57
- val sslImage: String? = null,
58
- val icons: List<String>? = null,
59
- val urlConfig: String = ""
60
- )
61
-
62
- @Composable
63
- fun TrustBanner(
64
- serviceName: String = "",
65
- screenName: String = "",
66
- onPress: ((Map<String, String>) -> Unit)? = null,
67
- trackEvent: ((String, Map<String, String>) -> Unit)? = null
68
- ) {
69
- val appConfig = AppConfig.current
70
- val language = AppLanguage.current ?: "vi"
71
- val trustBanner = appConfig?.trustBanner ?: defaultBanner
72
- val trackParams = mapOf(
73
- "service_name" to serviceName,
74
- "screen_name" to screenName,
75
- "component_name" to "logo_trust",
76
- "url_config" to trustBanner.urlConfig
77
- )
78
-
79
- Row(
80
- modifier = Modifier
81
- .clip(RoundedCornerShape(12.dp))
82
- .background(color = Color(backgroundBlue))
83
- .padding(12.dp)
84
- .then(
85
- if (onPress != null) {
86
- Modifier.clickable {
87
- trackEvent?.invoke(
88
- "service_component_clicked", trackParams
89
- )
90
-
91
- onPress(
92
- mapOf(
93
- "service_name" to serviceName,
94
- "screen_name" to screenName,
95
- "url_config" to trustBanner.urlConfig,
96
- )
97
- )
98
-
99
- }
100
- } else {
101
- Modifier.noFeedbackClickable {
102
- trackEvent?.invoke(
103
- "service_component_clicked", trackParams
104
- )
105
- }
106
- }
107
- )
108
- ) {
109
- if (trustBanner.momoImage != null) {
110
- Image(
111
- source = trustBanner.momoImage,
112
- modifier = Modifier
113
- .width(64.dp)
114
- .height(64.dp)
115
- )
116
- }
117
- Column(
118
- modifier = Modifier
119
- .padding(start = 10.dp)
120
- ) {
121
- Text(
122
- text = trustBanner.content[language] ?: "",
123
- modifier = Modifier.padding(bottom = 8.dp),
124
- color = Color(contentColor),
125
- style = Typography.descriptionDefaultRegular,
126
- maxLines = 2
127
- )
128
- Row(
129
- modifier = Modifier.fillMaxWidth(),
130
- horizontalArrangement = Arrangement.SpaceBetween
131
- ) {
132
- Row(
133
- verticalAlignment = Alignment.CenterVertically,
134
- ) {
135
- Text(
136
- text = trustBanner.subContent[language] ?: "",
137
- color = Color(subContentColor),
138
- style = Typography.actionXsBold,
139
- maxLines = 2
140
- )
141
- Icon(
142
- source = "https://img.mservice.io/momo_app_v2/new_version/img/appx_icon/16_arrow_chevron_right_small.png",
143
- color = Color(subContentColor),
144
- )
145
- }
146
- Row {
147
- if (trustBanner.pciImage != null) {
148
- Image(
149
- source = trustBanner.pciImage, modifier = Modifier
150
- .padding(end = 4.dp)
151
- .width(27.dp)
152
- .height(20.dp), options = Options(
153
- contentScale = ContentScale.Fit,
154
- )
155
- )
156
- }
157
- if (trustBanner.sslImage != null) {
158
- Image(
159
- source = trustBanner.sslImage, modifier = Modifier
160
- .width(52.dp)
161
- .height(20.dp),
162
- options = Options(
163
- contentScale = ContentScale.Fit,
164
- )
165
- )
166
- }
167
-
168
- }
169
- }
170
- }
171
- }
172
- }