@momo-kits/native-kits 0.152.4-beta.5 → 0.152.4-beta.7

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 (156) 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 +392 -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 +302 -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 +484 -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/navigation/component/SnackBar.kt +123 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +38 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +62 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +88 -0
  109. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +144 -0
  110. package/gradle.properties +19 -0
  111. package/gradlew +240 -0
  112. package/gradlew.bat +91 -0
  113. package/ios/Application/ApplicationEnvironment.swift +50 -0
  114. package/ios/Application/Components.swift +263 -0
  115. package/ios/Application/ComposeApi.swift +22 -0
  116. package/ios/Application/FloatingButton.swift +172 -0
  117. package/ios/Application/HeaderRight.swift +271 -0
  118. package/ios/Application/Screen.swift +249 -0
  119. package/ios/Badge/BadgeDot.swift +31 -0
  120. package/ios/Button/Button.swift +211 -0
  121. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
  122. package/ios/Checkbox/Checkbox.swift +81 -0
  123. package/ios/Chip/Chip.swift +96 -0
  124. package/ios/Colors+Radius+Spacing/Colors.swift +172 -0
  125. package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
  126. package/ios/Colors+Radius+Spacing/Spacing.swift +12 -0
  127. package/ios/Extensions/Color++.swift +25 -0
  128. package/ios/Icon/Icon.swift +51 -0
  129. package/ios/Image/Image.swift +70 -0
  130. package/ios/Input/Input.swift +207 -0
  131. package/ios/Input/InputPhoneNumber.swift +176 -0
  132. package/ios/Input/InputSearch.swift +238 -0
  133. package/ios/Input/InputTextArea.swift +242 -0
  134. package/ios/Lottie/LottieView.swift +86 -0
  135. package/ios/OTPKeyboard/KeyboardButton.swift +41 -0
  136. package/ios/OTPKeyboard/OTPKeyboard.swift +145 -0
  137. package/ios/Popup/PopupDisplay.swift +284 -0
  138. package/ios/Popup/PopupInput.swift +96 -0
  139. package/ios/Popup/PopupPromotion.swift +73 -0
  140. package/ios/PopupView/FullscreenPopup.swift +251 -0
  141. package/ios/PopupView/Modifiers.swift +158 -0
  142. package/ios/PopupView/PopupView.swift +289 -0
  143. package/ios/PopupView/Utils++.swift +281 -0
  144. package/ios/ScrollIndicator/ScrollIndicator.swift +110 -0
  145. package/ios/Swipeable/SwipeCell.swift +278 -0
  146. package/ios/Swipeable/SwipeCellModel.swift +86 -0
  147. package/ios/Switch/Switch.swift +44 -0
  148. package/ios/Template/Logo/Logo.swift +75 -0
  149. package/ios/Template/TrustBanner/TrustBanner.swift +120 -0
  150. package/ios/Theme.md +18 -0
  151. package/ios/Typography/Text.swift +140 -0
  152. package/ios/Typography/Typography.swift +95 -0
  153. package/ios/native-kits.podspec +18 -0
  154. package/package.json +6 -7
  155. package/settings.gradle.kts +25 -0
  156. package/shared/build.gradle.kts +0 -74
@@ -0,0 +1,302 @@
1
+ package vn.momo.kits.navigation
2
+
3
+ import androidx.compose.foundation.layout.Box
4
+ import androidx.compose.foundation.layout.fillMaxSize
5
+ import androidx.compose.runtime.Composable
6
+ import androidx.compose.runtime.MutableState
7
+ import androidx.compose.runtime.mutableStateOf
8
+ import androidx.compose.runtime.staticCompositionLocalOf
9
+ import androidx.compose.ui.Alignment
10
+ import androidx.compose.ui.Modifier
11
+ import androidx.navigation.NavController
12
+ import kotlinx.coroutines.CoroutineScope
13
+ import kotlinx.coroutines.Dispatchers
14
+ import kotlinx.coroutines.SupervisorJob
15
+ import kotlinx.coroutines.cancel
16
+ import kotlinx.coroutines.delay
17
+ import kotlinx.coroutines.launch
18
+ import kotlinx.serialization.Serializable
19
+ import vn.momo.kits.navigation.BottomHeader.*
20
+ import vn.momo.kits.navigation.component.SnackBar
21
+ import vn.momo.maxapi.IMaxApi
22
+
23
+ class Navigator(
24
+ private val navController: NavController,
25
+ private val maxApi: IMaxApi?
26
+ ) {
27
+ private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
28
+
29
+ fun push(content: @Composable () -> Unit, options: NavigationOptions? = null) {
30
+ val route = DynamicScreenRegistry.register(content, options)
31
+ navController.navigate(DynamicScreenRoute(route.id))
32
+ }
33
+
34
+ fun replace(content: @Composable () -> Unit, options: NavigationOptions? = null) {
35
+ if (navController.previousBackStackEntry != null){
36
+ val latestScreen = DynamicScreenRegistry.getLatestScreen()
37
+ latestScreen?.let { DynamicScreenRegistry.unregisterScreen(it.id) }
38
+ navController.popBackStack()
39
+ push(content, options)
40
+ }
41
+ }
42
+
43
+ fun pop(count: Int = 1, callBack: (() -> Unit)? = null) {
44
+ scope.launch {
45
+ repeat(count) {
46
+ if (OverplayComponentRegistry.getOverplayType() == OverplayComponentType.SNACK_BAR){
47
+ dismissScreen()
48
+ OverplayComponentRegistry.hardClearAfterDismiss()
49
+ }
50
+ else if (OverplayComponentRegistry.isOverplayShowing()){
51
+ dismissOverplay()
52
+ } else {
53
+ dismissScreen()
54
+ }
55
+ }
56
+ callBack?.invoke()
57
+ }
58
+ }
59
+ private suspend fun CoroutineScope.dismissOverplay(isDelay: Boolean = true) {
60
+ OverplayComponentRegistry.clear()
61
+ if (isDelay) delay(300L)
62
+ OverplayComponentRegistry.hardClearAfterDismiss()
63
+ }
64
+
65
+ private suspend fun CoroutineScope.dismissScreen() {
66
+ if (navController.previousBackStackEntry != null){
67
+ navController.popBackStack()
68
+ delay(300L)
69
+ DynamicScreenRegistry.getLatestScreen()?.let { it1 ->
70
+ DynamicScreenRegistry.unregisterScreen(it1.id)
71
+ }
72
+ } else {
73
+ maxApi?.dismiss { }
74
+ }
75
+ }
76
+
77
+ fun present(content: @Composable () -> Unit, options: NavigationOptions? = null) {
78
+ val route = DynamicScreenRegistry.register(content, options)
79
+ navController.navigate(DynamicDialogRoute(route.id))
80
+ }
81
+
82
+ fun reset(content: @Composable () -> Unit, options: NavigationOptions? = null) {
83
+ DynamicScreenRegistry.unregisterAll()
84
+
85
+ val route = DynamicScreenRegistry.register(content, options)
86
+ navController.navigate(DynamicScreenRoute(route.id)) {
87
+ popUpTo(0) { inclusive = true }
88
+ }
89
+ }
90
+
91
+ fun showModal(
92
+ content: @Composable () -> Unit,
93
+ barrierDismissible: Boolean = true,
94
+ onDismiss: (() -> Unit)? = null
95
+ ){
96
+ val id = DynamicScreenRegistry.getLatestScreen()?.id ?: -1
97
+ OverplayComponentRegistry.registerOverplay(id, content, OverplayComponentType.MODAL, false, barrierDismissible, onDismiss)
98
+ }
99
+
100
+ fun showBottomSheet(
101
+ content: @Composable () -> Unit,
102
+ isSurface: Boolean = false,
103
+ barrierDismissible: Boolean = true,
104
+ onDismiss: (() -> Unit)? = null,
105
+ bottomSheetHeader: BottomHeader? = null
106
+ ){
107
+ val id = DynamicScreenRegistry.getLatestScreen()?.id ?: -1
108
+ OverplayComponentRegistry.registerOverplay(id, content, OverplayComponentType.BOTTOM_SHEET, isSurface, barrierDismissible, onDismiss, bottomSheetHeader)
109
+ }
110
+
111
+ fun showSnackBar(snackBar: SnackBar, onDismiss: (() -> Unit)? = null) {
112
+ val id = DynamicScreenRegistry.getLatestScreen()?.id ?: -1
113
+ scope.launch {
114
+ OverplayComponentRegistry.registerOverplay(
115
+ id = id,
116
+ content = {
117
+ SnackBar(snackBar, onDismiss)
118
+ },
119
+ type = OverplayComponentType.SNACK_BAR,
120
+ onDismiss = onDismiss
121
+ )
122
+ }
123
+ }
124
+
125
+ fun hideSnackBar() {
126
+ scope.launch {
127
+ OverplayComponentRegistry.clear()
128
+ delay(250L)
129
+ OverplayComponentRegistry.hardClearAfterDismiss()
130
+ }
131
+ }
132
+
133
+ fun dispose(){
134
+ scope.cancel()
135
+ }
136
+ }
137
+
138
+ val LocalNavigator = staticCompositionLocalOf<Navigator> {
139
+ error("No NavigationStack provided")
140
+ }
141
+
142
+ @Serializable
143
+ data class DynamicScreenRoute(val id: Int)
144
+
145
+ @Serializable
146
+ data class DynamicDialogRoute(val id: Int)
147
+
148
+ data class DynamicScreen(
149
+ val id: Int,
150
+ val content: @Composable () -> Unit,
151
+ var options: NavigationOptions? = null
152
+ )
153
+
154
+ object DynamicScreenRegistry {
155
+ private val screens = mutableMapOf<Int, DynamicScreen>()
156
+ private var idCounter = 1
157
+
158
+ fun register(content: @Composable () -> Unit, options: NavigationOptions?): DynamicScreenRoute {
159
+ val id = idCounter++
160
+ screens[id] = DynamicScreen(
161
+ id = id,
162
+ content = content,
163
+ options = options
164
+ )
165
+ return DynamicScreenRoute(id)
166
+ }
167
+
168
+ fun unregisterScreen(id: Int) {
169
+ screens.remove(id)
170
+ }
171
+
172
+ fun getLatestScreen(): DynamicScreen?{
173
+ return screens.entries.lastOrNull()?.value
174
+ }
175
+
176
+ fun unregisterAll(){
177
+ val ids = screens.keys.toList()
178
+ for (id in ids) {
179
+ unregisterScreen(id)
180
+ }
181
+ }
182
+
183
+ fun getScreen(id: Int): DynamicScreen? = screens[id]
184
+
185
+ fun setOptions(id: Int, options: NavigationOptions){
186
+ screens[id]?.options = options
187
+ }
188
+ }
189
+
190
+
191
+ sealed class OverplayComponentParams {
192
+ class Modal(
193
+ val onDismiss: (() -> Unit)? = null,
194
+ val barrierDismissible: Boolean = true
195
+ ) : OverplayComponentParams()
196
+
197
+ class BottomSheet(
198
+ val isSurface: Boolean = false,
199
+ val onDismiss: (() -> Unit)? = null,
200
+ val barrierDismissible: Boolean = true,
201
+ val bottomSheetHeader: BottomHeader? = null,
202
+ ) : OverplayComponentParams()
203
+
204
+ class SnackBar() : OverplayComponentParams()
205
+ }
206
+
207
+ data class OverplayComponent(
208
+ val id: Int,
209
+ val type: OverplayComponentType? = null,
210
+ val content: @Composable () -> Unit,
211
+ val params: OverplayComponentParams? = null
212
+ )
213
+
214
+ enum class OverplayComponentType {
215
+ MODAL, BOTTOM_SHEET, SNACK_BAR
216
+ }
217
+
218
+ object OverplayComponentRegistry {
219
+ private var currentOverlayComponent : MutableState<OverplayComponent?> = mutableStateOf(null)
220
+ private var requestClose: (() -> Unit)? = null
221
+ internal fun bindClose(handler: (() -> Unit)?) {
222
+ requestClose = handler
223
+ }
224
+
225
+ fun registerOverplay(
226
+ id: Int,
227
+ content: @Composable () -> Unit,
228
+ type: OverplayComponentType,
229
+ isSurface: Boolean = false,
230
+ barrierDismissible: Boolean = true,
231
+ onDismiss: (() -> Unit)?,
232
+ bottomSheetHeader: BottomHeader? = null,
233
+ ){
234
+ val params = when(type){
235
+ OverplayComponentType.MODAL -> OverplayComponentParams.Modal(onDismiss, barrierDismissible)
236
+ OverplayComponentType.BOTTOM_SHEET -> OverplayComponentParams.BottomSheet(isSurface, onDismiss, barrierDismissible, bottomSheetHeader)
237
+ OverplayComponentType.SNACK_BAR -> OverplayComponentParams.SnackBar()
238
+ }
239
+
240
+ currentOverlayComponent.value = OverplayComponent(
241
+ id = id,
242
+ type = type,
243
+ content = content,
244
+ params = params
245
+ )
246
+ }
247
+
248
+ fun isOverplayShowing(): Boolean = currentOverlayComponent.value != null
249
+
250
+ fun getOverplayType(): OverplayComponentType? = currentOverlayComponent.value?.type
251
+
252
+ fun currentRootId(): Int? = currentOverlayComponent.value?.id
253
+
254
+ fun clear(){
255
+ if (requestClose != null) {
256
+ requestClose?.invoke()
257
+ } else {
258
+ currentOverlayComponent.value = null
259
+ }
260
+ }
261
+
262
+ internal fun hardClearAfterDismiss() {
263
+ currentOverlayComponent.value = null
264
+ requestClose = null
265
+ }
266
+
267
+ @Composable
268
+ fun OverlayComponent(){
269
+ val overplay = currentOverlayComponent.value ?: return
270
+
271
+ when (val params = overplay.params) {
272
+ is OverplayComponentParams.BottomSheet -> {
273
+ BottomSheet(
274
+ content = overplay.content,
275
+ header = params.bottomSheetHeader ?: Title(),
276
+ isSurface = params.isSurface,
277
+ barrierDismissible = params.barrierDismissible,
278
+ onDismiss = params.onDismiss
279
+ )
280
+ }
281
+
282
+ is OverplayComponentParams.Modal -> {
283
+ ModalScreen(
284
+ content = overplay.content,
285
+ barrierDismissible = params.barrierDismissible,
286
+ onDismiss = params.onDismiss
287
+ )
288
+ }
289
+
290
+ is OverplayComponentParams.SnackBar -> {
291
+ Box(
292
+ modifier = Modifier.fillMaxSize(),
293
+ contentAlignment = Alignment.BottomCenter
294
+ ) {
295
+ overplay.content()
296
+ }
297
+ }
298
+
299
+ null -> {}
300
+ }
301
+ }
302
+ }
@@ -0,0 +1,17 @@
1
+ package vn.momo.kits.navigation
2
+
3
+ import androidx.compose.runtime.Composable
4
+ import androidx.compose.runtime.CompositionLocalProvider
5
+ import vn.momo.kits.const.ScaleSizeMaxRate
6
+
7
+ @Composable
8
+ fun ScaleSizeScope(
9
+ scaleSizeMaxRate: Float? = null,
10
+ content: @Composable () -> Unit
11
+ ) {
12
+ CompositionLocalProvider(
13
+ ScaleSizeMaxRate provides scaleSizeMaxRate
14
+ ) {
15
+ content()
16
+ }
17
+ }