@momo-kits/native-kits 0.152.4-beta.6 → 0.152.4-maxapi

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/CODE_OF_CONDUCT.md +133 -0
  2. package/CONTRIBUTING.md +114 -0
  3. package/LICENSE +20 -0
  4. package/README.md +7 -0
  5. package/build.gradle.kts +32 -0
  6. package/compose/MoMoComposeKits.podspec +54 -0
  7. package/compose/build.gradle.kts +149 -0
  8. package/compose/src/androidMain/AndroidManifest.xml +2 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +105 -0
  10. package/compose/src/commonMain/composeResources/files/lottie_circle_loader.json +1 -0
  11. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  12. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  23. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  24. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +57 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +201 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +222 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +48 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +306 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +715 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +214 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +236 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +77 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +27 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +334 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +345 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +90 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +131 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +58 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +143 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +179 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +111 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +384 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +160 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +234 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +223 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +232 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +236 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +228 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +364 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +50 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +34 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +85 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +33 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +338 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +95 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +64 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +89 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +84 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +208 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +172 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +199 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +237 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +191 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +13 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +191 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +258 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +59 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +68 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +49 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +232 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +111 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +94 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +159 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +232 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScaleSizeScope.kt +17 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +459 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +169 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +216 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +180 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +251 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +80 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +306 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +31 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +385 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +38 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +62 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +88 -0
  108. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +144 -0
  109. package/gradle.properties +19 -0
  110. package/gradlew +240 -0
  111. package/gradlew.bat +91 -0
  112. package/ios/Application/ApplicationEnvironment.swift +50 -0
  113. package/ios/Application/Components.swift +263 -0
  114. package/ios/Application/ComposeApi.swift +22 -0
  115. package/ios/Application/FloatingButton.swift +172 -0
  116. package/ios/Application/HeaderRight.swift +271 -0
  117. package/ios/Application/Screen.swift +249 -0
  118. package/ios/Badge/BadgeDot.swift +31 -0
  119. package/ios/Button/Button.swift +211 -0
  120. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
  121. package/ios/Checkbox/Checkbox.swift +81 -0
  122. package/ios/Chip/Chip.swift +96 -0
  123. package/ios/Colors+Radius+Spacing/Colors.swift +172 -0
  124. package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
  125. package/ios/Colors+Radius+Spacing/Spacing.swift +12 -0
  126. package/ios/Extensions/Color++.swift +25 -0
  127. package/ios/Icon/Icon.swift +51 -0
  128. package/ios/Image/Image.swift +70 -0
  129. package/ios/Input/Input.swift +207 -0
  130. package/ios/Input/InputPhoneNumber.swift +176 -0
  131. package/ios/Input/InputSearch.swift +238 -0
  132. package/ios/Input/InputTextArea.swift +242 -0
  133. package/ios/Lottie/LottieView.swift +86 -0
  134. package/ios/OTPKeyboard/KeyboardButton.swift +41 -0
  135. package/ios/OTPKeyboard/OTPKeyboard.swift +145 -0
  136. package/ios/Popup/PopupDisplay.swift +284 -0
  137. package/ios/Popup/PopupInput.swift +96 -0
  138. package/ios/Popup/PopupPromotion.swift +73 -0
  139. package/ios/PopupView/FullscreenPopup.swift +251 -0
  140. package/ios/PopupView/Modifiers.swift +158 -0
  141. package/ios/PopupView/PopupView.swift +289 -0
  142. package/ios/PopupView/Utils++.swift +281 -0
  143. package/ios/ScrollIndicator/ScrollIndicator.swift +110 -0
  144. package/ios/Swipeable/SwipeCell.swift +278 -0
  145. package/ios/Swipeable/SwipeCellModel.swift +86 -0
  146. package/ios/Switch/Switch.swift +44 -0
  147. package/ios/Template/Logo/Logo.swift +75 -0
  148. package/ios/Template/TrustBanner/TrustBanner.swift +120 -0
  149. package/ios/Theme.md +18 -0
  150. package/ios/Typography/Text.swift +140 -0
  151. package/ios/Typography/Typography.swift +95 -0
  152. package/ios/native-kits.podspec +18 -0
  153. package/package.json +6 -7
  154. package/settings.gradle.kts +25 -0
  155. package/shared/build.gradle.kts +0 -74
@@ -0,0 +1,76 @@
1
+ package vn.momo.kits.application
2
+
3
+ import androidx.compose.foundation.background
4
+ import androidx.compose.foundation.layout.Box
5
+ import androidx.compose.foundation.layout.fillMaxWidth
6
+ import androidx.compose.foundation.layout.height
7
+ import androidx.compose.runtime.Composable
8
+ import androidx.compose.ui.Modifier
9
+ import androidx.compose.ui.draw.alpha
10
+ import androidx.compose.ui.geometry.Offset
11
+ import androidx.compose.ui.graphics.Brush
12
+ import androidx.compose.ui.graphics.Color
13
+ import androidx.compose.ui.layout.ContentScale
14
+ import androidx.compose.ui.platform.LocalDensity
15
+ import androidx.compose.ui.unit.Dp
16
+ import androidx.compose.ui.unit.dp
17
+ import vn.momo.kits.components.Image
18
+ import vn.momo.kits.components.Options
19
+ import vn.momo.kits.const.AppTheme
20
+ import vn.momo.kits.utils.bottomBorder
21
+
22
+ @Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
23
+ @Composable
24
+ fun HeaderExtended(
25
+ opacityAni: Float,
26
+ statusBarHeight: Dp,
27
+ backgroundColor: Color
28
+ ) {
29
+ Box(
30
+ modifier = Modifier
31
+ .fillMaxWidth()
32
+ .height(154.dp)
33
+ .alpha(opacityAni)
34
+ .background(
35
+ Brush.linearGradient(
36
+ colors = listOf(
37
+ Color(0xFFFDCADE),
38
+ Color(0x00FDCADE)
39
+ ),
40
+ start = Offset(0f, 0f),
41
+ end = Offset(0f, with(LocalDensity.current) { 154.dp.toPx() })
42
+ )
43
+ )
44
+ ) {
45
+ if (AppTheme.current.assets.headerBackground != null) {
46
+ Box(
47
+ modifier = Modifier
48
+ .fillMaxWidth()
49
+ .background(backgroundColor)
50
+ ) {
51
+ Image(
52
+ loading = false,
53
+ source = AppTheme.current.assets.headerBackground!!,
54
+ modifier = Modifier.fillMaxWidth().height(154.dp),
55
+ options = Options(
56
+ contentScale = ContentScale.FillWidth
57
+ )
58
+ )
59
+ }
60
+ }
61
+ }
62
+
63
+ Box(
64
+ modifier = Modifier
65
+ .fillMaxWidth()
66
+ .alpha(1f - opacityAni)
67
+ .height(statusBarHeight + HEADER_HEIGHT.dp)
68
+ .background(
69
+ AppTheme.current.colors.background.surface
70
+ )
71
+ .bottomBorder(
72
+ strokeWidth = 1.dp,
73
+ color = AppTheme.current.colors.border.default
74
+ )
75
+ )
76
+ }
@@ -0,0 +1,306 @@
1
+ package vn.momo.kits.application
2
+
3
+ import androidx.compose.foundation.background
4
+ import androidx.compose.foundation.border
5
+ import androidx.compose.foundation.clickable
6
+ import androidx.compose.foundation.layout.Arrangement
7
+ import androidx.compose.foundation.layout.Box
8
+ import androidx.compose.foundation.layout.Row
9
+ import androidx.compose.foundation.layout.height
10
+ import androidx.compose.foundation.layout.offset
11
+ import androidx.compose.foundation.layout.padding
12
+ import androidx.compose.foundation.layout.size
13
+ import androidx.compose.foundation.layout.width
14
+ import androidx.compose.foundation.shape.CircleShape
15
+ import androidx.compose.foundation.shape.RoundedCornerShape
16
+ import androidx.compose.runtime.Composable
17
+ import androidx.compose.runtime.getValue
18
+ import androidx.compose.runtime.mutableStateOf
19
+ import androidx.compose.runtime.remember
20
+ import androidx.compose.runtime.setValue
21
+ import androidx.compose.ui.Alignment
22
+ import androidx.compose.ui.Modifier
23
+ import androidx.compose.ui.draw.clip
24
+ import androidx.compose.ui.graphics.Color
25
+ import androidx.compose.ui.unit.dp
26
+ import kotlinx.serialization.json.Json
27
+ import kotlinx.serialization.json.jsonObject
28
+ import kotlinx.serialization.json.jsonPrimitive
29
+ import vn.momo.kits.components.BadgeDot
30
+ import vn.momo.kits.components.DotSize
31
+ import vn.momo.kits.components.Icon
32
+ import vn.momo.kits.const.AppTheme
33
+ import vn.momo.kits.const.Colors
34
+
35
+ data class HeaderRightData(
36
+ val useShortcut: Boolean = false,
37
+ val useMore: Boolean = false,
38
+ val useSystemTools: Boolean = true,
39
+ val tools: List<ToolGroup> = emptyList(),
40
+ val toolCallback: ((String) -> Unit)? = { _ -> }
41
+ )
42
+
43
+ data class Tool(
44
+ val key: String,
45
+ val icon: String,
46
+ val showBadge: Boolean = false,
47
+ val name: Map<String, String> = emptyMap(),
48
+ val showRightIcon: Boolean = true,
49
+ ) {
50
+ fun toMap(): Map<String, Any> {
51
+ return mapOf(
52
+ "key" to key,
53
+ "icon" to icon,
54
+ "showBadge" to showBadge,
55
+ "name" to name,
56
+ "showRightIcon" to showRightIcon
57
+ )
58
+ }
59
+ }
60
+
61
+ data class ToolGroup(
62
+ val title: Map<String, String> = emptyMap(),
63
+ val items: List<Tool>
64
+ ) {
65
+ fun toMap(): Map<String, Any> {
66
+ return mapOf(
67
+ "title" to title,
68
+ "items" to items.map { it.toMap() }
69
+ )
70
+ }
71
+ }
72
+
73
+ data class NavigationButtonConfig(
74
+ val icon: String,
75
+ val onPress: () -> Unit
76
+ )
77
+
78
+ object Spacing {
79
+ val M = 16.dp
80
+ val S = 8.dp
81
+ val XXS = 2.dp
82
+ }
83
+
84
+ @Deprecated("Use vn.momo.kits.navigation.component.HeaderRight instead", ReplaceWith("vn.momo.kits.navigation.component.HeaderRight"))
85
+ @Composable
86
+ fun HeaderRight(
87
+ headerRight: HeaderRightData? = null,
88
+ opacity: Float = 1f,
89
+ animatedHeader: AnimatedHeader? = null,
90
+ tintColor: Color? = null,
91
+ ) {
92
+ Row(
93
+ verticalAlignment = Alignment.CenterVertically,
94
+ ) {
95
+ ToolkitHeaderRight(headerRight = headerRight, opacity = opacity, animatedHeader = animatedHeader, tintColor = tintColor)
96
+ }
97
+ }
98
+
99
+ private fun getNavigationButtonConfig(
100
+ headerRight: HeaderRightData? = null,
101
+ isFavorite: Boolean = false,
102
+ onPressShortcut: () -> Unit,
103
+ onPressMore: () -> Unit
104
+ ): NavigationButtonConfig {
105
+ val totalTools = headerRight?.tools?.sumOf { it.items.size } ?: 0
106
+ var icon = if (isFavorite) "pin_star_checked" else "pin_star"
107
+ var onClickHandler = onPressShortcut
108
+ if (totalTools > 1 || headerRight?.useMore == true) {
109
+ icon = "navigation_more_icon"
110
+ onClickHandler = onPressMore
111
+ } else if (totalTools == 1 && !headerRight?.tools.isNullOrEmpty()) {
112
+ val singleTool = headerRight?.tools?.first()?.items?.firstOrNull()
113
+ if (singleTool != null) {
114
+ icon = singleTool.icon
115
+ onClickHandler = {
116
+ headerRight.toolCallback?.invoke(singleTool.key)
117
+ }
118
+ }
119
+ }
120
+ return NavigationButtonConfig(icon, onClickHandler)
121
+ }
122
+
123
+ @Composable
124
+ private fun ToolkitHeaderRight(
125
+ headerRight: HeaderRightData? = null,
126
+ opacity: Float = 1f,
127
+ animatedHeader: AnimatedHeader? = null,
128
+ tintColor: Color? = null
129
+ ) {
130
+ var isFavorite by remember { mutableStateOf(false) }
131
+ val isLoading by remember { mutableStateOf(false) }
132
+ val api = PlatformApi.current as? ComposeApi
133
+ val context = ApplicationContext.current
134
+
135
+ fun onPressShortcut() {
136
+ api?.request("onToolAction", mapOf("item" to mapOf("key" to "onFavorite"))) {
137
+ isFavorite = !isFavorite
138
+ }
139
+ }
140
+
141
+ fun onPressHelpCenter() {
142
+ val paramMap = mapOf(
143
+ "appId" to context?.appId,
144
+ "code" to context?.appCode,
145
+ "name" to context?.appName,
146
+ "icon" to context?.appIcon,
147
+ "description" to context?.description
148
+ )
149
+ api?.request("showHelpCenter", paramMap) {
150
+
151
+ }
152
+ }
153
+
154
+ fun onPressClose() {
155
+ api?.request("dismissAll", "", { _ -> })
156
+ }
157
+
158
+ fun onPressMore() {
159
+ api?.request(
160
+ "showTools",
161
+ mapOf(
162
+ "useSystemTools" to headerRight?.useSystemTools,
163
+ "tools" to headerRight?.tools?.map { it.toMap() },
164
+ "context" to mapOf(
165
+ "appId" to context?.appId,
166
+ "code" to context?.appCode,
167
+ "name" to context?.appName,
168
+ "icon" to context?.appIcon,
169
+ "description" to context?.description,
170
+ "support" to context?.support,
171
+ "toolkitConfig" to context?.toolkitConfig,
172
+ "providerId" to context?.providerId,
173
+ "permissions" to context?.permissions
174
+ )
175
+ )
176
+ ) { response ->
177
+ try {
178
+ val json = Json.parseToJsonElement(response).jsonObject
179
+ val toolResponse = json["response"]?.jsonPrimitive?.content
180
+ if (toolResponse != null) {
181
+ headerRight?.toolCallback?.invoke(toolResponse)
182
+ }
183
+ } catch (e: Exception) {
184
+ println("Error parsing response: $e")
185
+ }
186
+ }
187
+ }
188
+
189
+ val navButtonConfig = getNavigationButtonConfig(
190
+ headerRight,
191
+ isFavorite,
192
+ ::onPressShortcut,
193
+ ::onPressMore
194
+ )
195
+
196
+ val showBadge = headerRight?.tools?.any { group ->
197
+ group.items.any { it.showBadge }
198
+ }
199
+
200
+ val toolkitWidth = if (context !== null) 65.dp else 28.dp
201
+
202
+ var isShowShortcut = headerRight?.useShortcut == true
203
+
204
+ if (headerRight?.useMore == true && context == null) {
205
+ isShowShortcut = false
206
+ }
207
+
208
+ val color = getHeaderColor(animatedHeader, opacity, tintColor, AppTheme.current.colors.text.default)
209
+ val tintIconColor = color.tintIconColor
210
+ val backgroundButton = color.backgroundButton
211
+ val borderColor = color.borderColor
212
+
213
+ Row(
214
+ verticalAlignment = Alignment.CenterVertically
215
+ ) {
216
+ if (isShowShortcut) {
217
+ NavigationButton(
218
+ disabled = isLoading,
219
+ icon = navButtonConfig.icon,
220
+ showBadge = showBadge,
221
+ onClick = navButtonConfig.onPress,
222
+ tintColor = tintIconColor
223
+ )
224
+ }
225
+ Row(
226
+ verticalAlignment = Alignment.CenterVertically,
227
+ horizontalArrangement = Arrangement.Center,
228
+ modifier = Modifier
229
+ .padding(start = Spacing.S)
230
+ .border(0.2.dp, borderColor, shape = RoundedCornerShape(14.dp))
231
+ .width(toolkitWidth)
232
+ .height(28.dp)
233
+ .clip(shape = RoundedCornerShape(14.dp))
234
+ .background(backgroundButton)
235
+ ) {
236
+ if (context != null) {
237
+ Icon(
238
+ source = "help_center",
239
+ size = 20.dp,
240
+ color = tintIconColor,
241
+ modifier = Modifier.padding(4.dp).clickable {
242
+ onPressHelpCenter()
243
+ })
244
+ Box(
245
+ modifier = Modifier
246
+ .width(0.5.dp)
247
+ .height(12.dp)
248
+ .background(tintColor ?: Colors.black_20)
249
+ )
250
+ }
251
+
252
+ Icon(
253
+ source = "16_basic_home",
254
+ size = 20.dp,
255
+ color = tintIconColor,
256
+ modifier = Modifier.padding(4.dp).clickable { onPressClose() }
257
+ )
258
+ }
259
+ }
260
+ }
261
+
262
+ @Deprecated("Use vn.momo.kits.navigation.component instead", ReplaceWith("vn.momo.kits.navigation.component"))
263
+ @Composable
264
+ fun NavigationButton(
265
+ disabled: Boolean,
266
+ icon: String,
267
+ showBadge: Boolean? = false,
268
+ onClick: () -> Unit,
269
+ tintColor: Color?
270
+ ) {
271
+ val backgroundButton = if (tintColor == Colors.black_01) Colors.black_20.copy(alpha = 0.6f) else Colors.black_01.copy(alpha = 0.6f)
272
+ val borderColor = if (tintColor == Colors.black_01) Colors.black_01.copy(alpha = 0.2f) else Colors.black_20.copy(alpha = 0.2f)
273
+
274
+ Box(
275
+ modifier = Modifier
276
+ .size(28.dp)
277
+ .clickable(enabled = !disabled, onClick = onClick)
278
+ ) {
279
+ Box(
280
+ modifier = Modifier
281
+ .matchParentSize()
282
+ .clip(CircleShape)
283
+ .background(backgroundButton)
284
+ .border(0.2.dp, borderColor, CircleShape)
285
+ )
286
+ Box(
287
+ modifier = Modifier.matchParentSize(),
288
+ contentAlignment = Alignment.Center
289
+ ) {
290
+ Icon(
291
+ source = icon,
292
+ size = 20.dp,
293
+ color = tintColor
294
+ )
295
+ }
296
+
297
+ if (showBadge == true) {
298
+ BadgeDot(
299
+ size = DotSize.Small,
300
+ modifier = Modifier
301
+ .align(Alignment.TopEnd)
302
+ .offset(x = -Spacing.XXS, y = -Spacing.XXS)
303
+ )
304
+ }
305
+ }
306
+ }
@@ -0,0 +1,33 @@
1
+ package vn.momo.kits.application
2
+
3
+ import androidx.compose.runtime.Composable
4
+ import androidx.compose.ui.Modifier
5
+ import androidx.compose.ui.graphics.Color
6
+ import androidx.compose.ui.text.style.TextAlign
7
+ import androidx.compose.ui.text.style.TextOverflow
8
+ import androidx.compose.ui.unit.sp
9
+ import androidx.compose.ui.zIndex
10
+ import vn.momo.kits.components.Text
11
+ import vn.momo.kits.const.Typography
12
+
13
+ @Deprecated("Use vn.momo.kits.navigation.component instead", ReplaceWith("vn.momo.kits.navigation.component"))
14
+ @Composable
15
+ fun HeaderTitle(
16
+ title: String = "",
17
+ modifier: Modifier = Modifier,
18
+ textAlign: TextAlign = TextAlign.Start,
19
+ color: Color? = null,
20
+ ) {
21
+ Text(
22
+ modifier = Modifier.then(modifier).zIndex(1f),
23
+ text = title,
24
+ textAlign = textAlign,
25
+ style = Typography.actionSBold.copy(
26
+ fontSize = 15.sp,
27
+ lineHeight = 22.sp,
28
+ ),
29
+ color = color,
30
+ maxLines = 1,
31
+ overflow = TextOverflow.Ellipsis
32
+ )
33
+ }