@momo-kits/native-kits 0.154.1-beta.9 → 0.154.2-test.1

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 (118) hide show
  1. package/README.md +175 -5
  2. package/ios/native-kits.podspec +18 -16
  3. package/package.json +2 -4
  4. package/CODE_OF_CONDUCT.md +0 -133
  5. package/CONTRIBUTING.md +0 -114
  6. package/LICENSE +0 -20
  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/Context.kt +0 -102
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -305
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -715
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -114
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -404
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -78
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -27
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -334
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -345
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -90
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -133
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -69
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -143
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -179
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -111
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -393
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -164
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -234
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -226
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -221
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -246
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -233
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -50
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -34
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -85
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -33
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -338
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -95
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -64
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -17
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -89
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -94
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -208
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -170
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -199
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -237
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -13
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -189
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -285
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -59
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -49
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -232
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -111
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -94
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -163
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -302
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -483
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -169
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -215
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -180
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -251
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -31
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -385
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -125
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -38
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -62
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -88
  112. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -144
  113. package/gradle.properties +0 -19
  114. package/gradlew +0 -240
  115. package/gradlew.bat +0 -91
  116. package/ios/Theme.md +0 -18
  117. package/local.properties +0 -8
  118. 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,94 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.border
4
- import androidx.compose.runtime.Composable
5
- import androidx.compose.runtime.remember
6
- import androidx.compose.ui.Modifier
7
- import androidx.compose.ui.graphics.Color
8
- import androidx.compose.ui.text.TextLayoutResult
9
- import androidx.compose.ui.text.TextStyle
10
- import androidx.compose.ui.text.style.TextAlign
11
- import androidx.compose.ui.text.style.TextDecoration
12
- import androidx.compose.ui.text.style.TextOverflow
13
- import androidx.compose.ui.unit.TextUnit
14
- import androidx.compose.ui.unit.dp
15
- import vn.momo.kits.application.ApplicationContext
16
- import vn.momo.kits.const.AppTheme
17
- import vn.momo.kits.const.Colors
18
- import vn.momo.kits.const.Typography
19
- import vn.momo.kits.const.getFontFamily
20
- import vn.momo.kits.const.scaleSize
21
- import vn.momo.kits.modifier.conditional
22
- import vn.momo.kits.modifier.setAutomationId
23
-
24
- @Composable
25
- fun Text(
26
- text: String,
27
- color: Color? = null,
28
- style: TextStyle = Typography.bodyDefaultRegular,
29
- textAlign: TextAlign? = TextAlign.Start,
30
- modifier: Modifier = Modifier,
31
- maxLines: Int = Int.MAX_VALUE,
32
- overflow: TextOverflow = TextOverflow.Clip,
33
- textDecoration: TextDecoration? = null,
34
- onTextLayout: ((TextLayoutResult) -> Unit)? = null,
35
- fontFamily: String? = null,
36
- minLines: Int = 1,
37
- letterSpacing: TextUnit = TextUnit.Unspecified,
38
- softWrap: Boolean = true,
39
- accessibilityId: String? = null
40
- ) {
41
- val application = ApplicationContext.current
42
- // Cache theme access to avoid repeated lookups
43
- val theme = AppTheme.current
44
-
45
- // Call @Composable functions directly in composable context
46
- val scaledFontSize = scaleSize(style.fontSize)
47
- val scaledLineHeight = scaleSize(style.lineHeight)
48
- val fontFamilyResult = getFontFamily(fontFamily ?: theme.font, style.fontWeight)
49
-
50
- // Now memoize the results
51
- val fontSize = remember(scaledFontSize) { scaledFontSize }
52
- val lineHeight = remember(scaledLineHeight) { scaledLineHeight }
53
- val font = remember(fontFamilyResult) { fontFamilyResult }
54
-
55
- // Memoize color calculation
56
- val textColor = remember(color, theme) {
57
- color ?: theme.colors.text.default
58
- }
59
-
60
- // Memoize style copy operation
61
- val optimizedStyle = remember(style) {
62
- style.copy(
63
- fontWeight = null,
64
- lineHeight = if (lineHeight.value.isFinite() && lineHeight.value > 0) lineHeight else style.lineHeight
65
- )
66
- }
67
-
68
- // Memoize automation ID
69
- val automationId = remember(accessibilityId, text) {
70
- accessibilityId ?: text
71
- }
72
-
73
- // on/off baseline config value, default will be false
74
- val showBaseLineDebug = application?.features?.showBaseLineDebug == true
75
-
76
- androidx.compose.material3.Text(
77
- modifier = modifier.conditional(showBaseLineDebug){
78
- border(1.dp, Colors.blue_03)
79
- }.setAutomationId(automationId, text),
80
- text = text,
81
- color = textColor,
82
- style = optimizedStyle,
83
- textAlign = textAlign,
84
- fontSize = fontSize,
85
- fontFamily = font,
86
- maxLines = maxLines,
87
- softWrap = softWrap,
88
- letterSpacing = letterSpacing,
89
- minLines = minLines,
90
- textDecoration = textDecoration,
91
- onTextLayout = onTextLayout,
92
- overflow = overflow
93
- )
94
- }
@@ -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,170 +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 vn.momo.kits.application.AppConfig
21
- import vn.momo.kits.application.AppLanguage
22
- import vn.momo.kits.const.Typography
23
- import vn.momo.kits.modifier.noFeedbackClickable
24
-
25
- val defaultBanner = TrustBannerData(
26
- content = mapOf(
27
- "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.",
28
- "en" to "Ensuring financial security and data privacy is MoMo's highest priority."
29
- ),
30
- subContent = mapOf(
31
- "vi" to "Tìm hiểu thêm",
32
- "en" to "Learn more"
33
- ),
34
- pciImage = "https://static.momocdn.net/app/img/kits/trustBanner/pci_dss.png",
35
- sslImage = "https://static.momocdn.net/app/img/kits/trustBanner/ssl.png",
36
- urlConfig = "login_and_security",
37
- icons = listOf(
38
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png",
39
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_agribank.png",
40
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png",
41
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png"
42
- ),
43
- momoImage = "https://static.momocdn.net/app/img/kits/trustBanner/ic_secu.png"
44
- )
45
-
46
- const val backgroundBlue = 0xFFF2F8FF
47
- const val contentColor = 0xFF484848
48
- const val subContentColor = 0xFFEB2F96
49
-
50
- data class TrustBannerData(
51
- val content: Map<String, String> = mapOf("vi" to "", "en" to ""),
52
- val subContent: Map<String, String> = mapOf("vi" to "", "en" to ""),
53
- val pciImage: String? = null,
54
- val momoImage: String? = null,
55
- val sslImage: String? = null,
56
- val icons: List<String>? = null,
57
- val urlConfig: String = ""
58
- )
59
-
60
- @Composable
61
- fun TrustBanner(
62
- serviceName: String = "",
63
- screenName: String = "",
64
- onPress: ((Map<String, String>) -> Unit)? = null,
65
- trackEvent: ((String, Map<String, String>) -> Unit)? = null
66
- ) {
67
- val appConfig = AppConfig.current
68
- val language = AppLanguage.current ?: "vi"
69
- val trustBanner = appConfig?.trustBanner ?: defaultBanner
70
- val trackParams = mapOf(
71
- "service_name" to serviceName,
72
- "screen_name" to screenName,
73
- "component_name" to "logo_trust",
74
- "url_config" to trustBanner.urlConfig
75
- )
76
-
77
- Row(
78
- modifier = Modifier
79
- .clip(RoundedCornerShape(12.dp))
80
- .background(color = Color(backgroundBlue))
81
- .padding(12.dp)
82
- .then(
83
- if (onPress != null) {
84
- Modifier.clickable {
85
- trackEvent?.invoke(
86
- "service_component_clicked", trackParams
87
- )
88
-
89
- onPress(
90
- mapOf(
91
- "service_name" to serviceName,
92
- "screen_name" to screenName,
93
- "url_config" to trustBanner.urlConfig,
94
- )
95
- )
96
-
97
- }
98
- } else {
99
- Modifier.noFeedbackClickable {
100
- trackEvent?.invoke(
101
- "service_component_clicked", trackParams
102
- )
103
- }
104
- }
105
- )
106
- ) {
107
- if (trustBanner.momoImage != null) {
108
- Image(
109
- source = trustBanner.momoImage,
110
- modifier = Modifier
111
- .width(64.dp)
112
- .height(64.dp)
113
- )
114
- }
115
- Column(
116
- modifier = Modifier
117
- .padding(start = 10.dp)
118
- ) {
119
- Text(
120
- text = trustBanner.content[language] ?: "",
121
- modifier = Modifier.padding(bottom = 8.dp),
122
- color = Color(contentColor),
123
- style = Typography.descriptionDefaultRegular,
124
- maxLines = 2
125
- )
126
- Row(
127
- modifier = Modifier.fillMaxWidth(),
128
- horizontalArrangement = Arrangement.SpaceBetween
129
- ) {
130
- Row(
131
- verticalAlignment = Alignment.CenterVertically,
132
- ) {
133
- Text(
134
- text = trustBanner.subContent[language] ?: "",
135
- color = Color(subContentColor),
136
- style = Typography.actionXsBold,
137
- maxLines = 2
138
- )
139
- Icon(
140
- source = "https://img.mservice.io/momo_app_v2/new_version/img/appx_icon/16_arrow_chevron_right_small.png",
141
- color = Color(subContentColor),
142
- )
143
- }
144
- Row {
145
- if (trustBanner.pciImage != null) {
146
- Image(
147
- source = trustBanner.pciImage, modifier = Modifier
148
- .padding(end = 4.dp)
149
- .width(27.dp)
150
- .height(20.dp), options = Options(
151
- contentScale = ContentScale.Fit,
152
- )
153
- )
154
- }
155
- if (trustBanner.sslImage != null) {
156
- Image(
157
- source = trustBanner.sslImage, modifier = Modifier
158
- .width(52.dp)
159
- .height(20.dp),
160
- options = Options(
161
- contentScale = ContentScale.Fit,
162
- )
163
- )
164
- }
165
-
166
- }
167
- }
168
- }
169
- }
170
- }