@momo-kits/native-kits 0.157.1-debug → 0.157.1-skill.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/.claude/momo-native-kits/SKILL.md +87 -0
  2. package/.claude/momo-native-kits/references/Badge.md +39 -0
  3. package/.claude/momo-native-kits/references/BadgeDot.md +37 -0
  4. package/.claude/momo-native-kits/references/BottomSheet.md +51 -0
  5. package/.claude/momo-native-kits/references/BottomTab.md +65 -0
  6. package/.claude/momo-native-kits/references/Button.md +197 -0
  7. package/.claude/momo-native-kits/references/CheckBox.md +51 -0
  8. package/.claude/momo-native-kits/references/Chip.md +47 -0
  9. package/.claude/momo-native-kits/references/Divider.md +29 -0
  10. package/.claude/momo-native-kits/references/HeaderTitle.md +45 -0
  11. package/.claude/momo-native-kits/references/HeaderType.md +47 -0
  12. package/.claude/momo-native-kits/references/Icon.md +32 -0
  13. package/.claude/momo-native-kits/references/Image.md +38 -0
  14. package/.claude/momo-native-kits/references/Information.md +36 -0
  15. package/.claude/momo-native-kits/references/Input.md +334 -0
  16. package/.claude/momo-native-kits/references/InputDropDown.md +47 -0
  17. package/.claude/momo-native-kits/references/InputMoney.md +241 -0
  18. package/.claude/momo-native-kits/references/InputOTP.md +52 -0
  19. package/.claude/momo-native-kits/references/InputPhoneNumber.md +175 -0
  20. package/.claude/momo-native-kits/references/InputSearch.md +57 -0
  21. package/.claude/momo-native-kits/references/InputTextArea.md +46 -0
  22. package/.claude/momo-native-kits/references/NavigationContainer.md +51 -0
  23. package/.claude/momo-native-kits/references/Navigator.md +287 -0
  24. package/.claude/momo-native-kits/references/PaginationDot.md +28 -0
  25. package/.claude/momo-native-kits/references/PaginationNumber.md +28 -0
  26. package/.claude/momo-native-kits/references/PopupNotify.md +47 -0
  27. package/.claude/momo-native-kits/references/Radio.md +44 -0
  28. package/.claude/momo-native-kits/references/Skeleton.md +32 -0
  29. package/.claude/momo-native-kits/references/Switch.md +36 -0
  30. package/.claude/momo-native-kits/references/Tag.md +40 -0
  31. package/.claude/momo-native-kits/references/Text.md +37 -0
  32. package/.claude/momo-native-kits/references/Title.md +43 -0
  33. package/.claude/momo-native-kits/references/Tooltip.md +30 -0
  34. package/.claude/settings.local.json +13 -0
  35. package/building-skill-for-claude.md +1190 -0
  36. package/ios/Input/InputPhoneNumber.swift +2 -1
  37. package/package.json +1 -1
  38. package/build.gradle.kts +0 -11
  39. package/compose/build.gradle.kts +0 -180
  40. package/compose/build.gradle.kts.backup +0 -180
  41. package/compose/compose.podspec +0 -54
  42. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -110
  43. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  44. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  45. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  46. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  47. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  48. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  49. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  50. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  51. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  52. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  53. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  54. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  55. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  56. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -107
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -305
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -720
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -121
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -405
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -85
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -340
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -198
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -339
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -94
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -136
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -148
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -188
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -116
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -448
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -172
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -255
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -231
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -233
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -254
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -241
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -92
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -352
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -103
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -70
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -17
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -96
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -96
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -92
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -130
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -214
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -576
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -177
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -205
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -239
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
  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 -13
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -185
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -285
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -59
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -14
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -50
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -239
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -119
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -98
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -161
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -331
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -497
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -162
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -243
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -187
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -279
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -32
  139. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -370
  140. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
  141. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -42
  142. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  143. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -62
  144. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  145. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -88
  146. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -149
  147. package/gradle/libs.versions.toml +0 -57
  148. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  149. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  150. package/gradle.properties +0 -26
  151. package/gradlew +0 -252
  152. package/gradlew.bat +0 -94
  153. package/settings.gradle.kts +0 -52
@@ -1,331 +0,0 @@
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.components.PopupAction
20
- import vn.momo.kits.components.PopupNotify
21
- import vn.momo.kits.navigation.BottomHeader.*
22
- import vn.momo.kits.navigation.component.SnackBar
23
- import vn.momo.maxapi.IMaxApi
24
-
25
- class Navigator(
26
- private val navController: NavController,
27
- private val maxApi: IMaxApi?
28
- ) {
29
- private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
30
-
31
- fun push(content: @Composable () -> Unit, options: NavigationOptions? = null) {
32
- val route = DynamicScreenRegistry.register(content, options)
33
- navController.navigate(DynamicScreenRoute(route.id))
34
- }
35
-
36
- fun replace(content: @Composable () -> Unit, options: NavigationOptions? = null) {
37
- if (navController.previousBackStackEntry != null){
38
- val latestScreen = DynamicScreenRegistry.getLatestScreen()
39
- latestScreen?.let { DynamicScreenRegistry.unregisterScreen(it.id) }
40
- navController.popBackStack()
41
- push(content, options)
42
- }
43
- }
44
-
45
- fun onBackSafe(callBack: (() -> Unit)? = null) {
46
- val latestScreen = DynamicScreenRegistry.getLatestScreen()
47
- val options = latestScreen?.options
48
- if (options?.onBackHandler != null) {
49
- options.onBackHandler.invoke()
50
- return
51
- }
52
- val preventBack = options?.headerBackProps?.preventBack
53
- if (preventBack != null) {
54
- showModal(
55
- content = {
56
- PopupNotify(preventBack.copy(
57
- primary = PopupAction(
58
- title = preventBack.primary?.title ?: "",
59
- onPress = {
60
- preventBack.primary?.onPress?.invoke()
61
- pop(2, callBack) // close popup notify, then close the screen
62
- }
63
- )
64
- ))
65
- }
66
- )
67
- } else {
68
- pop(1, callBack)
69
- }
70
- }
71
-
72
- fun pop(count: Int = 1, callBack: (() -> Unit)? = null) {
73
- scope.launch {
74
- repeat(count) {
75
- if (OverplayComponentRegistry.getOverplayType() == OverplayComponentType.SNACK_BAR){
76
- dismissScreen()
77
- OverplayComponentRegistry.hardClearAfterDismiss()
78
- }
79
- else if (OverplayComponentRegistry.isOverplayShowing()){
80
- dismissOverplay()
81
- } else {
82
- dismissScreen()
83
- }
84
- }
85
- callBack?.invoke()
86
- }
87
- }
88
- private suspend fun dismissOverplay(isDelay: Boolean = true) {
89
- OverplayComponentRegistry.clear()
90
- if (isDelay) delay(300L)
91
- OverplayComponentRegistry.hardClearAfterDismiss()
92
- }
93
-
94
- private suspend fun dismissScreen() {
95
- if (navController.previousBackStackEntry != null){
96
- navController.popBackStack()
97
- delay(300L)
98
- DynamicScreenRegistry.getLatestScreen()?.let { it1 ->
99
- DynamicScreenRegistry.unregisterScreen(it1.id)
100
- }
101
- } else {
102
- maxApi?.dismiss { }
103
- }
104
- }
105
-
106
- fun present(content: @Composable () -> Unit, options: NavigationOptions? = null) {
107
- val route = DynamicScreenRegistry.register(content, options)
108
- navController.navigate(DynamicDialogRoute(route.id))
109
- }
110
-
111
- fun reset(content: @Composable () -> Unit, options: NavigationOptions? = null) {
112
- DynamicScreenRegistry.unregisterAll()
113
-
114
- val route = DynamicScreenRegistry.register(content, options)
115
- navController.navigate(DynamicScreenRoute(route.id)) {
116
- popUpTo(0) { inclusive = true }
117
- }
118
- }
119
-
120
- fun showModal(
121
- content: @Composable () -> Unit,
122
- barrierDismissible: Boolean = true,
123
- onDismiss: (() -> Unit)? = null
124
- ){
125
- val id = DynamicScreenRegistry.getLatestScreen()?.id ?: -1
126
- OverplayComponentRegistry.registerOverplay(id, content, OverplayComponentType.MODAL, false, barrierDismissible, onDismiss)
127
- }
128
-
129
- fun showBottomSheet(
130
- content: @Composable () -> Unit,
131
- isSurface: Boolean = false,
132
- barrierDismissible: Boolean = true,
133
- onDismiss: (() -> Unit)? = null,
134
- bottomSheetHeader: BottomHeader? = null
135
- ){
136
- val id = DynamicScreenRegistry.getLatestScreen()?.id ?: -1
137
- OverplayComponentRegistry.registerOverplay(id, content, OverplayComponentType.BOTTOM_SHEET, isSurface, barrierDismissible, onDismiss, bottomSheetHeader)
138
- }
139
-
140
- fun showSnackBar(snackBar: SnackBar, onDismiss: (() -> Unit)? = null) {
141
- val id = DynamicScreenRegistry.getLatestScreen()?.id ?: -1
142
- scope.launch {
143
- OverplayComponentRegistry.registerOverplay(
144
- id = id,
145
- content = {
146
- SnackBar(snackBar, onDismiss)
147
- },
148
- type = OverplayComponentType.SNACK_BAR,
149
- onDismiss = onDismiss
150
- )
151
- }
152
- }
153
-
154
- fun hideSnackBar() {
155
- scope.launch {
156
- OverplayComponentRegistry.clear()
157
- delay(250L)
158
- OverplayComponentRegistry.hardClearAfterDismiss()
159
- }
160
- }
161
-
162
- fun dispose(){
163
- scope.cancel()
164
- }
165
- }
166
-
167
- val LocalNavigator = staticCompositionLocalOf<Navigator> {
168
- error("No NavigationStack provided")
169
- }
170
-
171
- @Serializable
172
- data class DynamicScreenRoute(val id: Int)
173
-
174
- @Serializable
175
- data class DynamicDialogRoute(val id: Int)
176
-
177
- data class DynamicScreen(
178
- val id: Int,
179
- val content: @Composable () -> Unit,
180
- var options: NavigationOptions? = null
181
- )
182
-
183
- object DynamicScreenRegistry {
184
- private val screens = mutableMapOf<Int, DynamicScreen>()
185
- private var idCounter = 1
186
-
187
- fun register(content: @Composable () -> Unit, options: NavigationOptions?): DynamicScreenRoute {
188
- val id = idCounter++
189
- screens[id] = DynamicScreen(
190
- id = id,
191
- content = content,
192
- options = options
193
- )
194
- return DynamicScreenRoute(id)
195
- }
196
-
197
- fun unregisterScreen(id: Int) {
198
- screens.remove(id)
199
- }
200
-
201
- fun getLatestScreen(): DynamicScreen?{
202
- return screens.entries.lastOrNull()?.value
203
- }
204
-
205
- fun unregisterAll(){
206
- val ids = screens.keys.toList()
207
- for (id in ids) {
208
- unregisterScreen(id)
209
- }
210
- }
211
-
212
- fun getScreen(id: Int): DynamicScreen? = screens[id]
213
-
214
- fun setOptions(id: Int, options: NavigationOptions){
215
- screens[id]?.options = options
216
- }
217
- }
218
-
219
-
220
- sealed class OverplayComponentParams {
221
- class Modal(
222
- val onDismiss: (() -> Unit)? = null,
223
- val barrierDismissible: Boolean = true
224
- ) : OverplayComponentParams()
225
-
226
- class BottomSheet(
227
- val isSurface: Boolean = false,
228
- val onDismiss: (() -> Unit)? = null,
229
- val barrierDismissible: Boolean = true,
230
- val bottomSheetHeader: BottomHeader? = null,
231
- ) : OverplayComponentParams()
232
-
233
- class SnackBar() : OverplayComponentParams()
234
- }
235
-
236
- data class OverplayComponent(
237
- val id: Int,
238
- val type: OverplayComponentType? = null,
239
- val content: @Composable () -> Unit,
240
- val params: OverplayComponentParams? = null
241
- )
242
-
243
- enum class OverplayComponentType {
244
- MODAL, BOTTOM_SHEET, SNACK_BAR
245
- }
246
-
247
- object OverplayComponentRegistry {
248
- private var currentOverlayComponent : MutableState<OverplayComponent?> = mutableStateOf(null)
249
- private var requestClose: (() -> Unit)? = null
250
- internal fun bindClose(handler: (() -> Unit)?) {
251
- requestClose = handler
252
- }
253
-
254
- fun registerOverplay(
255
- id: Int,
256
- content: @Composable () -> Unit,
257
- type: OverplayComponentType,
258
- isSurface: Boolean = false,
259
- barrierDismissible: Boolean = true,
260
- onDismiss: (() -> Unit)?,
261
- bottomSheetHeader: BottomHeader? = null,
262
- ){
263
- val params = when(type){
264
- OverplayComponentType.MODAL -> OverplayComponentParams.Modal(onDismiss, barrierDismissible)
265
- OverplayComponentType.BOTTOM_SHEET -> OverplayComponentParams.BottomSheet(isSurface, onDismiss, barrierDismissible, bottomSheetHeader)
266
- OverplayComponentType.SNACK_BAR -> OverplayComponentParams.SnackBar()
267
- }
268
-
269
- currentOverlayComponent.value = OverplayComponent(
270
- id = id,
271
- type = type,
272
- content = content,
273
- params = params
274
- )
275
- }
276
-
277
- fun isOverplayShowing(): Boolean = currentOverlayComponent.value != null
278
-
279
- fun getOverplayType(): OverplayComponentType? = currentOverlayComponent.value?.type
280
-
281
- fun currentRootId(): Int? = currentOverlayComponent.value?.id
282
-
283
- fun clear(){
284
- if (requestClose != null) {
285
- requestClose?.invoke()
286
- } else {
287
- currentOverlayComponent.value = null
288
- }
289
- }
290
-
291
- internal fun hardClearAfterDismiss() {
292
- currentOverlayComponent.value = null
293
- requestClose = null
294
- }
295
-
296
- @Composable
297
- fun OverlayComponent(){
298
- val overplay = currentOverlayComponent.value ?: return
299
-
300
- when (val params = overplay.params) {
301
- is OverplayComponentParams.BottomSheet -> {
302
- BottomSheet(
303
- content = overplay.content,
304
- header = params.bottomSheetHeader ?: Title(),
305
- isSurface = params.isSurface,
306
- barrierDismissible = params.barrierDismissible,
307
- onDismiss = params.onDismiss
308
- )
309
- }
310
-
311
- is OverplayComponentParams.Modal -> {
312
- ModalScreen(
313
- content = overplay.content,
314
- barrierDismissible = params.barrierDismissible,
315
- onDismiss = params.onDismiss
316
- )
317
- }
318
-
319
- is OverplayComponentParams.SnackBar -> {
320
- Box(
321
- modifier = Modifier.fillMaxSize(),
322
- contentAlignment = Alignment.BottomCenter
323
- ) {
324
- overplay.content()
325
- }
326
- }
327
-
328
- null -> {}
329
- }
330
- }
331
- }