@momo-kits/native-kits 0.167.1-duo.2-debug → 0.167.1-duo.3

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 (171) hide show
  1. package/.claude/scheduled_tasks.lock +1 -0
  2. package/.claude/settings.local.json +185 -0
  3. package/CLAUDE.md +8 -3
  4. package/ios/Application/HeaderRight.swift +25 -12
  5. package/ios/Application/Layout/ScreenLayout.swift +196 -0
  6. package/ios/Application/Navigation/BottomTab/BottomTab.swift +30 -9
  7. package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +5 -2
  8. package/ios/Application/Navigation/BottomTab/DuoTabBar.swift +275 -0
  9. package/ios/Application/Navigation/HeaderUser.swift +4 -1
  10. package/ios/Application/Navigation/NavigationContainer.swift +3 -0
  11. package/ios/Application/Navigation/Overplay/BottomSheet.swift +41 -4
  12. package/ios/Application/Navigation/Overplay/ModalScreen.swift +5 -1
  13. package/ios/Application/Navigation/component/DuoScrollGradient.swift +55 -0
  14. package/ios/Application/Navigation/component/Header.swift +9 -3
  15. package/ios/Application/Navigation/component/HeaderBackground.swift +3 -2
  16. package/ios/Application/Navigation/component/NavigationFooter.swift +1 -1
  17. package/ios/Application/Navigation/component/NavigationHeaderRight.swift +61 -9
  18. package/ios/Application/Navigation/component/SideBar.swift +155 -0
  19. package/ios/Application/StackScreen.swift +135 -18
  20. package/ios/Popup/PopupDisplay.swift +84 -68
  21. package/ios/Popup/PopupLayout.swift +45 -0
  22. package/ios/Popup/PopupNotify.swift +43 -32
  23. package/ios/Popup/PopupPromotion.swift +17 -5
  24. package/ios/native-kits.podspec +1 -1
  25. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  26. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DuoTabDemo.swift +76 -0
  27. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +1 -0
  28. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IPhoneDuoDemo.swift +170 -0
  29. package/package.json +1 -1
  30. package/build.gradle.kts +0 -11
  31. package/compose/build.gradle.kts +0 -190
  32. package/compose/build.gradle.kts.backup +0 -190
  33. package/compose/compose.podspec +0 -47
  34. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  35. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  36. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  37. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  38. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -151
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -52
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -124
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -183
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -207
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -39
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -293
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -831
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -110
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -378
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -113
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -475
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -266
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -240
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -264
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -334
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -98
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -310
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -323
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -199
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -552
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -88
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -234
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -188
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -16
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +0 -18
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -297
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -157
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -299
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -129
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -106
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -393
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -622
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -175
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -232
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  139. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  140. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -381
  141. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -83
  142. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -105
  143. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  144. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -347
  145. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -37
  146. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  147. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -169
  148. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
  149. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  150. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  151. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
  152. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  153. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -71
  154. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  155. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  156. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  157. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
  158. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -40
  159. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  160. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  161. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  162. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  163. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -213
  164. package/gradle/libs.versions.toml +0 -69
  165. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  166. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  167. package/gradle.properties +0 -26
  168. package/gradlew +0 -252
  169. package/gradlew.bat +0 -94
  170. package/ios-demo/README.md +0 -120
  171. package/settings.gradle.kts +0 -64
@@ -1,299 +0,0 @@
1
- package vn.momo.kits.navigation
2
-
3
- import androidx.compose.animation.core.Animatable
4
- import androidx.compose.animation.core.CubicBezierEasing
5
- import androidx.compose.animation.core.tween
6
- import androidx.compose.foundation.background
7
- import androidx.compose.foundation.border
8
- import androidx.compose.foundation.gestures.detectDragGestures
9
- import androidx.compose.foundation.layout.Box
10
- import androidx.compose.foundation.layout.BoxWithConstraints
11
- import androidx.compose.foundation.layout.Column
12
- import androidx.compose.foundation.layout.Row
13
- import androidx.compose.foundation.layout.Spacer
14
- import androidx.compose.foundation.layout.fillMaxHeight
15
- import androidx.compose.foundation.layout.fillMaxSize
16
- import androidx.compose.foundation.layout.fillMaxWidth
17
- import androidx.compose.foundation.layout.height
18
- import androidx.compose.foundation.layout.heightIn
19
- import androidx.compose.foundation.layout.offset
20
- import androidx.compose.foundation.layout.padding
21
- import androidx.compose.foundation.layout.size
22
- import androidx.compose.foundation.layout.width
23
- import androidx.compose.foundation.shape.RoundedCornerShape
24
- import androidx.compose.runtime.Composable
25
- import androidx.compose.runtime.DisposableEffect
26
- import androidx.compose.runtime.LaunchedEffect
27
- import androidx.compose.runtime.remember
28
- import androidx.compose.runtime.rememberCoroutineScope
29
- import androidx.compose.ui.Alignment
30
- import androidx.compose.ui.Modifier
31
- import androidx.compose.ui.graphics.Brush
32
- import androidx.compose.ui.graphics.Color
33
- import androidx.compose.ui.input.pointer.pointerInput
34
- import androidx.compose.ui.platform.LocalDensity
35
- import androidx.compose.ui.unit.IntOffset
36
- import androidx.compose.ui.unit.dp
37
- import kotlinx.coroutines.launch
38
- import vn.momo.kits.components.Divider
39
- import vn.momo.kits.components.Icon
40
- import vn.momo.kits.components.Text
41
- import vn.momo.kits.const.AppTheme
42
- import vn.momo.kits.const.Colors
43
- import vn.momo.kits.const.Radius
44
- import vn.momo.kits.const.Spacing
45
- import vn.momo.kits.application.LocalContext
46
- import vn.momo.kits.application.IsShowBaseLineDebug
47
- import vn.momo.kits.const.AppNavigationBar
48
- import vn.momo.kits.const.Typography
49
- import vn.momo.kits.navigation.tracking.ScreenTracker
50
- import vn.momo.kits.modifier.conditional
51
- import vn.momo.kits.modifier.noFeedbackClickable
52
- import vn.momo.kits.platform.BackHandler
53
- import vn.momo.kits.platform.getScreenHeight
54
-
55
- @Composable
56
- internal fun BottomSheet(
57
- content: @Composable () -> Unit,
58
- header: BottomHeader,
59
- isSurface: Boolean = false,
60
- barrierDismissible: Boolean = true,
61
- draggable: Boolean = true,
62
- useBottomInset: Boolean = true,
63
- footerComponent: (@Composable () -> Unit)? = null,
64
- onDismiss: (() -> Unit)?
65
- ) {
66
- val screenHeightDp = getScreenHeight()
67
- val screenHeightPx = with(LocalDensity.current) { screenHeightDp.toPx() }
68
- val sheetOffset = remember { Animatable(screenHeightPx) }
69
-
70
- val backgroundAlpha = remember { Animatable(0f) }
71
- val dynamicAlpha = ((1f - (sheetOffset.value / screenHeightPx)).coerceIn(0f, 1f)) * 0.3f
72
- val alpha = backgroundAlpha.value + dynamicAlpha
73
-
74
- val sheetCloseOffset = with(LocalDensity.current) { 100.dp.toPx() }
75
-
76
- val coroutineScope = rememberCoroutineScope()
77
-
78
- val maxApi = LocalMaxApi.current
79
- val context = LocalContext.current
80
-
81
- DisposableEffect(Unit) {
82
- ScreenTracker.trackPopupDisplayed(
83
- maxApi = maxApi,
84
- context = context,
85
- parentScreenName = ScreenTracker.getLastScreenName()
86
- )
87
- onDispose { }
88
- }
89
-
90
- suspend fun openEvent(){
91
- backgroundAlpha.animateTo(
92
- targetValue = 0.3f,
93
- animationSpec = tween(
94
- durationMillis = 100,
95
- easing = CubicBezierEasing(0.05f, 0.7f, 0.1f, 1f)
96
- )
97
- )
98
- sheetOffset.animateTo(
99
- targetValue = 0f,
100
- animationSpec = tween(
101
- durationMillis = 350,
102
- easing = CubicBezierEasing(0.05f, 0.7f, 0.1f, 1f)
103
- )
104
- )
105
- }
106
-
107
- fun closeEvent(){
108
- coroutineScope.launch {
109
- sheetOffset.animateTo(
110
- targetValue = screenHeightPx,
111
- animationSpec = tween(
112
- durationMillis = 200,
113
- easing = CubicBezierEasing(0.3f, 0.0f, 0.8f, 0.15f)
114
- )
115
- )
116
- backgroundAlpha.animateTo(
117
- targetValue = 0f,
118
- animationSpec = tween(
119
- durationMillis = 100,
120
- easing = CubicBezierEasing(0.3f, 0.0f, 0.8f, 0.15f)
121
- )
122
- )
123
- OverplayComponentRegistry.hardClearAfterDismiss()
124
- }
125
- }
126
-
127
- LaunchedEffect(Unit) {
128
- openEvent()
129
- }
130
-
131
- DisposableEffect(Unit) {
132
- OverplayComponentRegistry.bindClose { closeEvent() }
133
- onDispose {
134
- onDismiss?.invoke()
135
- }
136
- }
137
-
138
- BackHandler(true){
139
- closeEvent()
140
- }
141
-
142
- BoxWithConstraints(
143
- modifier = Modifier
144
- .fillMaxSize()
145
- .background(Color.Black.copy(alpha = alpha))
146
- .noFeedbackClickable {
147
- if(barrierDismissible) closeEvent()
148
- }
149
- ) {
150
- val parentHeight = with(LocalDensity.current) { constraints.maxHeight.toDp() }
151
-
152
- Box(
153
- modifier = Modifier
154
- .align(Alignment.BottomCenter)
155
- .offset { IntOffset(x = 0, y = sheetOffset.value.toInt()) }
156
- .fillMaxWidth()
157
- .heightIn(max = parentHeight - 90.dp)
158
- .background(
159
- color = if (isSurface) AppTheme.current.colors.background.surface else AppTheme.current.colors.background.default,
160
- shape = RoundedCornerShape(topStart = Radius.M, topEnd = Radius.M)
161
- )
162
- .conditional(IsShowBaseLineDebug) {
163
- border(1.dp, Colors.blue_03)
164
- }
165
- .noFeedbackClickable { },
166
- contentAlignment = Alignment.BottomCenter
167
- ) {
168
- val bottomInset = if (useBottomInset) {
169
- (AppNavigationBar.current - keyboardSizeState().value).coerceAtLeast(0.dp)
170
- } else 0.dp
171
- Column(Modifier.padding(bottom = bottomInset)) {
172
- Box(
173
- modifier = Modifier
174
- .height(72.dp)
175
- .fillMaxWidth()
176
- .conditional(draggable) {
177
- pointerInput(Unit) {
178
- detectDragGestures(
179
- onDrag = { change, dragAmount ->
180
- change.consume()
181
- coroutineScope.launch {
182
- val newOffset = (sheetOffset.value + dragAmount.y).coerceAtLeast(0f)
183
- sheetOffset.snapTo(newOffset)
184
- }
185
- },
186
- onDragEnd = {
187
- coroutineScope.launch {
188
- if (sheetOffset.value > sheetCloseOffset) {
189
- closeEvent()
190
- } else {
191
- sheetOffset.animateTo(0f)
192
- }
193
- }
194
- }
195
- )
196
- }
197
- }
198
- ) {
199
- Column(
200
- modifier = Modifier
201
- .fillMaxSize()
202
- .padding(horizontal = Spacing.M),
203
- horizontalAlignment = Alignment.CenterHorizontally
204
- ) {
205
- Spacer(Modifier.height(8.dp))
206
- Box(
207
- modifier = Modifier
208
- .height(4.dp)
209
- .width(40.dp)
210
- .background(
211
- color = Colors.black_06,
212
- shape = RoundedCornerShape(Radius.S)
213
- )
214
- )
215
- Spacer(Modifier.height(4.dp))
216
- Box(Modifier.fillMaxWidth().height(56.dp), contentAlignment = Alignment.Center){
217
- when (header) {
218
- is BottomHeader.Title -> {
219
- Row(modifier = Modifier.fillMaxSize(), verticalAlignment = Alignment.CenterVertically) {
220
- Box(Modifier.size(24.dp))
221
- Box(Modifier.fillMaxHeight().weight(1f), contentAlignment = Alignment.Center){
222
- Text(
223
- text = header.data,
224
- color = Colors.black_17,
225
- style = Typography.headerDefaultBold
226
- )
227
- }
228
- Box(Modifier
229
- .size(24.dp)
230
- .noFeedbackClickable {
231
- closeEvent()
232
- },
233
- contentAlignment = Alignment.Center
234
- ){
235
- Icon(source = "navigation_close")
236
- }
237
- }
238
- }
239
- is BottomHeader.Custom -> {
240
- header.content()
241
- }
242
- }
243
- }
244
- }
245
- }
246
- Divider()
247
- if (footerComponent != null) {
248
- Box(Modifier.weight(1f, fill = false)) {
249
- content()
250
- }
251
- BottomSheetFooter(footerComponent)
252
- } else {
253
- content()
254
- }
255
- }
256
- }
257
- }
258
- }
259
-
260
- @Composable
261
- private fun BottomSheetFooter(footerComponent: @Composable () -> Unit) {
262
- val shadowBrush = remember {
263
- Brush.verticalGradient(
264
- colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.05f))
265
- )
266
- }
267
-
268
- Box {
269
- Box(
270
- Modifier
271
- .fillMaxWidth()
272
- .background(AppTheme.current.colors.background.surface)
273
- .conditional(IsShowBaseLineDebug) {
274
- border(1.dp, Colors.blue_03)
275
- }
276
- .padding(vertical = Spacing.S)
277
- ) {
278
- footerComponent()
279
- }
280
-
281
- Box(
282
- modifier = Modifier
283
- .fillMaxWidth()
284
- .height(6.dp)
285
- .offset(x = 0.dp, y = (-6).dp)
286
- .background(shadowBrush)
287
- )
288
- }
289
- }
290
-
291
- sealed class BottomHeader {
292
- data class Title(
293
- val data: String = "Bottom Sheet Title",
294
- ) : BottomHeader()
295
-
296
- data class Custom(
297
- val content: @Composable () -> Unit
298
- ) : BottomHeader()
299
- }
@@ -1,58 +0,0 @@
1
- package vn.momo.kits.navigation
2
-
3
- interface HostBackTarget {
4
- fun canPop(): Boolean
5
-
6
- fun onBack()
7
-
8
- fun backStarted()
9
- fun backProgressed(progress: Float)
10
- fun backCompleted()
11
- fun backCancelled()
12
- }
13
-
14
- object HostBackGestureBridge {
15
- private val targets = mutableListOf<HostBackTarget>()
16
- private var gestureTarget: HostBackTarget? = null
17
-
18
- var shouldUseFloatingArrowBack: Boolean = false
19
-
20
- fun checkCanPop(): Boolean = targets.isNotEmpty()
21
-
22
- fun canPopInner(): Boolean = top()?.canPop() == true
23
-
24
- fun pop() {
25
- top()?.onBack()
26
- }
27
-
28
- fun started() {
29
- val target = top() ?: return
30
- gestureTarget = target
31
- target.backStarted()
32
- }
33
-
34
- fun progressed(progress: Float) {
35
- gestureTarget?.backProgressed(progress.coerceIn(0f, 1f))
36
- }
37
-
38
- fun completed() {
39
- (gestureTarget ?: top())?.backCompleted()
40
- gestureTarget = null
41
- }
42
-
43
- fun cancelled() {
44
- gestureTarget?.backCancelled()
45
- gestureTarget = null
46
- }
47
-
48
- fun attach(target: HostBackTarget) {
49
- targets += target
50
- }
51
-
52
- fun detach(target: HostBackTarget) {
53
- targets -= target
54
- if (gestureTarget === target) gestureTarget = null
55
- }
56
-
57
- private fun top(): HostBackTarget? = targets.lastOrNull()
58
- }
@@ -1,129 +0,0 @@
1
- package vn.momo.kits.navigation
2
-
3
- import androidx.compose.animation.core.Animatable
4
- import androidx.compose.animation.core.CubicBezierEasing
5
- import androidx.compose.animation.core.tween
6
- import androidx.compose.foundation.background
7
- import androidx.compose.foundation.border
8
- import androidx.compose.foundation.clickable
9
- import androidx.compose.foundation.interaction.MutableInteractionSource
10
- import androidx.compose.foundation.layout.Box
11
- import androidx.compose.foundation.layout.fillMaxSize
12
- import androidx.compose.foundation.layout.wrapContentSize
13
- import androidx.compose.runtime.*
14
- import androidx.compose.ui.Alignment
15
- import androidx.compose.ui.Modifier
16
- import androidx.compose.ui.draw.alpha
17
- import androidx.compose.ui.draw.scale
18
- import androidx.compose.ui.graphics.Color
19
- import androidx.compose.ui.unit.dp
20
- import kotlinx.coroutines.launch
21
- import vn.momo.kits.application.LocalContext
22
- import vn.momo.kits.application.IsShowBaseLineDebug
23
- import vn.momo.kits.const.Colors
24
- import vn.momo.kits.modifier.conditional
25
- import vn.momo.kits.modifier.noFeedbackClickable
26
- import vn.momo.kits.navigation.tracking.ScreenTracker
27
- import vn.momo.kits.platform.BackHandler
28
-
29
- @Composable
30
- internal fun ModalScreen(
31
- content: @Composable () -> Unit,
32
- barrierDismissible: Boolean = true,
33
- onDismiss: (() -> Unit)? = null
34
- ) {
35
- val navigator = LocalNavigator.current
36
-
37
- val alpha = remember { Animatable(0f) }
38
- val scale = remember { Animatable(0.8f) }
39
-
40
- val coroutineScope = rememberCoroutineScope()
41
-
42
- val maxApi = LocalMaxApi.current
43
- val context = LocalContext.current
44
-
45
- DisposableEffect(Unit) {
46
- ScreenTracker.trackPopupDisplayed(
47
- maxApi = maxApi,
48
- context = context,
49
- parentScreenName = ScreenTracker.getLastScreenName()
50
- )
51
- onDispose { }
52
- }
53
-
54
- fun openEvent() {
55
- coroutineScope.launch {
56
- launch {
57
- alpha.animateTo(
58
- targetValue = 1f,
59
- animationSpec = tween(durationMillis = 250)
60
- )
61
- }
62
- launch {
63
- scale.animateTo(
64
- targetValue = 1f,
65
- animationSpec = tween(
66
- durationMillis = 250,
67
- easing = CubicBezierEasing(0.2f, 0.0f, 0f, 1f)
68
- )
69
- )
70
- }
71
- }
72
- }
73
-
74
- fun closeEvent() {
75
- coroutineScope.launch {
76
- alpha.animateTo(
77
- targetValue = 0f,
78
- animationSpec = tween(durationMillis = 200)
79
- )
80
- scale.animateTo(
81
- targetValue = 0.8f,
82
- animationSpec = tween(durationMillis = 200)
83
- )
84
- OverplayComponentRegistry.hardClearAfterDismiss()
85
- }
86
- }
87
-
88
- LaunchedEffect(Unit) {
89
- openEvent()
90
- }
91
-
92
- DisposableEffect(Unit) {
93
- OverplayComponentRegistry.bindClose { closeEvent() }
94
- onDispose {
95
- onDismiss?.invoke()
96
- }
97
- }
98
-
99
- BackHandler(enabled = true) {
100
- closeEvent()
101
- }
102
-
103
- Box(
104
- modifier = Modifier
105
- .fillMaxSize()
106
- .background(Color.Black.copy(alpha = 0.6f * alpha.value))
107
- .noFeedbackClickable {
108
- if(barrierDismissible) closeEvent()
109
- },
110
- contentAlignment = Alignment.Center
111
- ) {
112
- Box(
113
- modifier = Modifier
114
- .scale(scale.value)
115
- .alpha(alpha.value)
116
- .wrapContentSize()
117
- .conditional(IsShowBaseLineDebug) {
118
- border(1.dp, Colors.blue_03)
119
- }
120
- .clickable(
121
- indication = null,
122
- interactionSource = remember { MutableInteractionSource() }
123
- ) {},
124
- contentAlignment = Alignment.Center
125
- ) {
126
- content()
127
- }
128
- }
129
- }
@@ -1,106 +0,0 @@
1
- package vn.momo.kits.navigation
2
-
3
- import androidx.compose.foundation.gestures.ScrollableState
4
- import androidx.compose.runtime.*
5
- import androidx.compose.ui.graphics.Color
6
- import vn.momo.kits.navigation.bottomtab.setBottomTabOption
7
- import vn.momo.kits.navigation.component.*
8
-
9
- class Navigation(
10
- val id: Int = -1,
11
- val bottomTabIndex: Int = -1,
12
- val initOptions: NavigationOptions? = null,
13
- private val registry: DynamicScreenRegistry? = null
14
- ) {
15
- private val _options = mutableStateOf(initOptions ?: NavigationOptions())
16
- val currentOptions: State<NavigationOptions> get() = _options
17
- val options: NavigationOptions get() = _options.value
18
-
19
- private val _isBottomTabRoot = mutableStateOf(false)
20
- internal val isBottomTabRoot: Boolean get() = _isBottomTabRoot.value
21
- internal fun markAsBottomTabRoot() { _isBottomTabRoot.value = true }
22
-
23
- fun setOptions(
24
- onBackHandler: (() -> Unit)? = null,
25
- hiddenBack: Boolean? = null,
26
- headerBackProps: HeaderBackProps? = null,
27
- headerTitle: HeaderTitle? = null,
28
- titlePosition: TitlePosition? = null,
29
- headerRight: HeaderRight? = null,
30
- headerType: HeaderType? = null,
31
- scrollData: ScrollData? = null,
32
- backgroundColor: Color? = null,
33
- tintColor: Color? = null,
34
- footerComponent: (@Composable () -> Unit)? = null,
35
- footerTransparent: Boolean? = null,
36
- footerUseMargin: Boolean? = null,
37
- floatingButtonProps: FloatingButtonProps? = null,
38
- keyboardOptions: KeyboardOptions? = null
39
- ) {
40
- updateOptions(
41
- options.copy(
42
- onBackHandler = onBackHandler ?: options.onBackHandler,
43
- hiddenBack = hiddenBack ?: options.hiddenBack,
44
- headerBackProps = headerBackProps ?: options.headerBackProps,
45
- headerTitle = headerTitle ?: options.headerTitle,
46
- titlePosition = titlePosition ?: options.titlePosition,
47
- headerRight = headerRight ?: options.headerRight,
48
- headerType = headerType ?: options.headerType,
49
- scrollData = scrollData ?: options.scrollData,
50
- backgroundColor = backgroundColor ?: options.backgroundColor,
51
- tintColor = tintColor ?: options.tintColor,
52
- footerComponent = footerComponent ?: options.footerComponent,
53
- footerTransparent = footerTransparent ?: options.footerTransparent,
54
- footerUseMargin = footerUseMargin ?: options.footerUseMargin,
55
- floatingButtonProps = floatingButtonProps ?: options.floatingButtonProps,
56
- keyboardOptions = keyboardOptions ?: options.keyboardOptions,
57
- )
58
- )
59
- }
60
-
61
- fun setOptions(newOptions: NavigationOptions) {
62
- updateOptions(newOptions)
63
- }
64
-
65
- private fun updateOptions(updated: NavigationOptions) {
66
- _options.value = updated
67
- if (bottomTabIndex != -1) setBottomTabOption(bottomTabIndex, updated)
68
- if (id != -1) registry?.setOptions(id, updated)
69
- }
70
- }
71
-
72
- val LocalNavigation = staticCompositionLocalOf<Navigation> {
73
- error("No NavigationStack provided")
74
- }
75
-
76
- @Stable
77
- data class NavigationOptions(
78
- val screenName: String? = null,
79
- val onBackHandler: (() -> Unit)? = null,
80
- val hiddenBack: Boolean = false,
81
- val headerBackProps: HeaderBackProps = HeaderBackProps(),
82
- val headerTitle: HeaderTitle = HeaderTitle.Default("Stack"),
83
- val titlePosition: TitlePosition = TitlePosition.LEFT,
84
- val headerRight: HeaderRight = HeaderRight.Toolkit(),
85
- val headerType: HeaderType = HeaderType.Default(),
86
- val scrollData: ScrollData = ScrollData(),
87
- val backgroundColor: Color? = null,
88
- val tintColor: Color? = null,
89
- val footerComponent: @Composable (() -> Unit)? = null,
90
- val footerTransparent: Boolean = false,
91
- val footerUseMargin: Boolean = true,
92
- val floatingButtonProps: FloatingButtonProps? = null,
93
- val keyboardOptions: KeyboardOptions = KeyboardOptions()
94
- ) {
95
- internal fun hasFooter() : Boolean = footerComponent != null
96
- }
97
-
98
- data class KeyboardOptions(
99
- val keyboardShouldPersistTaps: Boolean = false,
100
- val useAvoidKeyboard: Boolean = true
101
- )
102
- data class ScrollData(
103
- val scrollable: Boolean = true,
104
- val scrollState: ScrollableState? = null,
105
- val scrollToTopCallback: (() -> Unit)? = null,
106
- )