@momo-kits/native-kits 0.152.4-beta.3 → 0.152.4-beta.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,48 +0,0 @@
1
- package vn.momo.kits.application
2
-
3
- import androidx.compose.animation.core.animateFloatAsState
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.runtime.getValue
9
- import androidx.compose.ui.Modifier
10
- import androidx.compose.ui.graphics.graphicsLayer
11
- import androidx.compose.ui.unit.dp
12
- import vn.momo.kits.components.Image
13
-
14
- @Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
15
- @Composable
16
- fun HeaderAnimated(image: String, scrollState: Int = 0) {
17
- // Scale animation
18
- val scale by animateFloatAsState(
19
- targetValue = when {
20
- scrollState < 0 -> (-(scrollState / 300f)).coerceIn(1f, 4f)
21
- scrollState.toFloat() in 0f..300f -> 1f
22
- else -> 1f
23
- }
24
- )
25
-
26
- // Opacity animation
27
- val opacity by animateFloatAsState(
28
- targetValue = when {
29
- scrollState.toFloat() in 0f..150f -> 1f - (scrollState / 300f)
30
- scrollState.toFloat() in 150f..300f -> 0.5f - ((scrollState - 150f) / 300f)
31
- else -> 1f
32
- }
33
- )
34
-
35
- // Translation Y animation
36
-
37
- Box(modifier = Modifier.fillMaxWidth().height(200.dp)
38
- .graphicsLayer {
39
- scaleX = scale
40
- scaleY = scale
41
- }) {
42
- if (image.isEmpty()) return
43
- Image(
44
- source = image,
45
- modifier = Modifier.fillMaxWidth().height(200.dp)
46
- )
47
- }
48
- }
@@ -1,86 +0,0 @@
1
- package vn.momo.kits.application
2
-
3
- import androidx.compose.animation.animateColorAsState
4
- import androidx.compose.animation.core.animateFloatAsState
5
- import androidx.compose.foundation.layout.Box
6
- import androidx.compose.foundation.layout.fillMaxWidth
7
- import androidx.compose.runtime.Composable
8
- import androidx.compose.runtime.getValue
9
- import androidx.compose.ui.Modifier
10
- import androidx.compose.ui.graphics.Color
11
- import vn.momo.kits.const.AppTheme
12
- import vn.momo.kits.utils.getAppStatusBarHeight
13
-
14
- enum class TitlePosition {
15
- LEFT, CENTER,
16
- }
17
-
18
- enum class AnimatedHeaderRatio(val value: Float){
19
- RATIO_16_9(16f / 9f),
20
- RATIO_1_1(1f),
21
- RATIO_3_2(3f / 2f)
22
- }
23
-
24
- data class AnimatedHeader(
25
- val aspectRatio: AnimatedHeaderRatio = AnimatedHeaderRatio.RATIO_16_9,
26
- val isSurface: Boolean = true,
27
- val composable: @Composable (scrollState: Int) -> Unit = {}
28
- )
29
-
30
- fun animateColor(start: Color, stop: Color, fraction: Float): Color {
31
- return Color(
32
- red = start.red + fraction * (stop.red - start.red),
33
- green = start.green + fraction * (stop.green - start.green),
34
- blue = start.blue + fraction * (stop.blue - start.blue),
35
- alpha = start.alpha + fraction * (stop.alpha - start.alpha)
36
- )
37
- }
38
-
39
- @Deprecated("Use vn.momo.kits.navigation.component.HeaderBackground instead", ReplaceWith("vn.momo.kits.navigation.component.HeaderBackground"))
40
- @Composable
41
- fun HeaderBackground(
42
- headerType: HeaderType = HeaderType.DEFAULT,
43
- scrollState: Int,
44
- headerTransparent: Boolean = false,
45
- ) {
46
- val statusBarHeight = getAppStatusBarHeight()
47
-
48
- val opacityAni by animateFloatAsState(
49
- targetValue = (1 - (scrollState / HEADER_HEIGHT * 1f)).coerceIn(0f, 1f),
50
- )
51
-
52
- val backgroundColor by animateColorAsState(
53
- targetValue = if (headerTransparent) {
54
- Color.Transparent
55
- } else {
56
- animateColor(
57
- Color.Transparent,
58
- AppTheme.current.colors.background.surface,
59
- opacityAni
60
- )
61
- }
62
- )
63
-
64
- when (headerType) {
65
- HeaderType.DEFAULT -> {
66
- HeaderDefault(
67
- opacityAni = opacityAni,
68
- statusBarHeight = statusBarHeight,
69
- backgroundColor = backgroundColor,
70
- headerTransparent = headerTransparent
71
- )
72
- }
73
-
74
- HeaderType.EXTENDED -> {
75
- HeaderExtended(
76
- opacityAni = opacityAni,
77
- statusBarHeight = statusBarHeight,
78
- backgroundColor = backgroundColor,
79
- )
80
- }
81
-
82
- else -> {
83
- Box(modifier = Modifier.fillMaxWidth())
84
- }
85
- }
86
- }
@@ -1,76 +0,0 @@
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 HeaderDefault(
25
- opacityAni: Float,
26
- statusBarHeight: Dp,
27
- backgroundColor: Color?,
28
- headerTransparent: Boolean = false
29
- ) {
30
- val height = statusBarHeight + HEADER_HEIGHT.dp
31
- Box(
32
- modifier = Modifier.fillMaxWidth().height(height)
33
- .background(if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.background.surface)
34
- .bottomBorder(
35
- strokeWidth = 1.dp,
36
- color = if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.border.default
37
- )
38
- ) {
39
- Box(
40
- modifier = Modifier
41
- .height(height)
42
- .fillMaxWidth()
43
- .alpha(opacityAni)
44
- .background(
45
- if (headerTransparent)
46
- Brush.linearGradient(
47
- colors = listOf(
48
- Color.Transparent,
49
- Color.Transparent,
50
- ),
51
- start = Offset(0f, 0f),
52
- end = Offset(0f, with(LocalDensity.current) { 154.dp.toPx() })
53
- )
54
- else
55
- Brush.linearGradient(
56
- colors = listOf(
57
- Color(0xFFFDCADE),
58
- Color(0x00FDCADE)
59
- ),
60
- start = Offset(0f, 0f),
61
- end = Offset(0f, with(LocalDensity.current) { 154.dp.toPx() })
62
- )
63
- )
64
- )
65
- if (AppTheme.current.assets.headerBackground != null) {
66
- Image(
67
- loading = false,
68
- source = AppTheme.current.assets.headerBackground!!,
69
- modifier = Modifier.fillMaxWidth().height(height),
70
- options = Options(
71
- contentScale = ContentScale.FillWidth
72
- )
73
- )
74
- }
75
- }
76
- }
@@ -1,76 +0,0 @@
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
- }
@@ -1,306 +0,0 @@
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
- }
@@ -1,33 +0,0 @@
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
- }