@momo-kits/native-kits 0.163.1-sp.2-debug → 0.163.1-sp.2

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 (143) hide show
  1. package/package.json +1 -1
  2. package/build.gradle.kts +0 -11
  3. package/compose/build.gradle.kts +0 -190
  4. package/compose/build.gradle.kts.backup +0 -190
  5. package/compose/compose.podspec +0 -47
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -150
  9. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  10. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  11. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  12. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -52
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -106
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -183
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -207
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -39
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -293
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -826
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -110
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -378
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -113
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -112
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -477
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -214
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -240
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -216
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -259
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -182
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -328
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -97
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -310
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -323
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -217
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -199
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -470
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -88
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -131
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -203
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -175
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -234
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -188
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -276
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -52
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -36
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -39
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -252
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -129
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -100
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -172
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -360
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -581
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -156
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -225
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -320
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -81
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -309
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -34
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -360
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -69
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -105
  132. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  133. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  134. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -207
  135. package/gradle/libs.versions.toml +0 -69
  136. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  137. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  138. package/gradle.properties +0 -26
  139. package/gradlew +0 -252
  140. package/gradlew.bat +0 -94
  141. package/ios-demo/README.md +0 -120
  142. package/local.properties +0 -8
  143. package/settings.gradle.kts +0 -64
@@ -1,51 +0,0 @@
1
- package vn.momo.kits.modifier
2
-
3
- import androidx.compose.runtime.Composable
4
- import androidx.compose.runtime.State
5
- import androidx.compose.ui.Modifier
6
- import androidx.compose.ui.layout.Measurable
7
- import androidx.compose.ui.layout.MeasureResult
8
- import androidx.compose.ui.layout.MeasureScope
9
- import androidx.compose.ui.node.LayoutModifierNode
10
- import androidx.compose.ui.node.ModifierNodeElement
11
- import androidx.compose.ui.unit.Constraints
12
- import androidx.compose.ui.unit.IntOffset
13
-
14
- @Composable
15
- fun Modifier.dynamicSize(
16
- widthState: State<Int>? = null,
17
- heightState: State<Int>? = null,
18
- ) = this then DynamicSizeElement(widthState, heightState)
19
-
20
- private data class DynamicSizeElement(
21
- val widthState: State<Int>?,
22
- val heightState: State<Int>?,
23
- ) : ModifierNodeElement<DynamicSizeNode>() {
24
- override fun create(): DynamicSizeNode {
25
- return DynamicSizeNode(widthState, heightState)
26
- }
27
-
28
- override fun update(node: DynamicSizeNode) {
29
- node.widthState = widthState
30
- node.heightState = heightState
31
- }
32
-
33
- }
34
-
35
- private class DynamicSizeNode(
36
- var widthState: State<Int>?,
37
- var heightState: State<Int>?,
38
- ) : Modifier.Node(), LayoutModifierNode {
39
- override fun MeasureScope.measure(
40
- measurable: Measurable,
41
- constraints: Constraints
42
- ): MeasureResult {
43
- val p = measurable.measure(constraints)
44
- return layout(
45
- width = widthState?.value ?: p.width,
46
- height = heightState?.value ?: p.height,
47
- ) {
48
- p.place(IntOffset.Zero)
49
- }
50
- }
51
- }
@@ -1,252 +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.Color
32
- import androidx.compose.ui.input.pointer.pointerInput
33
- import androidx.compose.ui.platform.LocalDensity
34
- import androidx.compose.ui.unit.IntOffset
35
- import androidx.compose.ui.unit.dp
36
- import kotlinx.coroutines.launch
37
- import vn.momo.kits.components.Divider
38
- import vn.momo.kits.components.Icon
39
- import vn.momo.kits.components.Text
40
- import vn.momo.kits.const.AppTheme
41
- import vn.momo.kits.const.Colors
42
- import vn.momo.kits.const.Radius
43
- import vn.momo.kits.const.Spacing
44
- import vn.momo.kits.application.LocalContext
45
- import vn.momo.kits.application.IsShowBaseLineDebug
46
- import vn.momo.kits.const.AppNavigationBar
47
- import vn.momo.kits.const.Typography
48
- import vn.momo.kits.navigation.tracking.ScreenTracker
49
- import vn.momo.kits.modifier.conditional
50
- import vn.momo.kits.modifier.noFeedbackClickable
51
- import vn.momo.kits.platform.BackHandler
52
- import vn.momo.kits.platform.getScreenHeight
53
-
54
- @Composable
55
- internal fun BottomSheet(
56
- content: @Composable () -> Unit,
57
- header: BottomHeader,
58
- isSurface: Boolean = false,
59
- barrierDismissible: Boolean = true,
60
- onDismiss: (() -> Unit)?
61
- ) {
62
- val screenHeightDp = getScreenHeight()
63
- val screenHeightPx = with(LocalDensity.current) { screenHeightDp.toPx() }
64
- val sheetOffset = remember { Animatable(screenHeightPx) }
65
-
66
- val backgroundAlpha = remember { Animatable(0f) }
67
- val dynamicAlpha = ((1f - (sheetOffset.value / screenHeightPx)).coerceIn(0f, 1f)) * 0.3f
68
- val alpha = backgroundAlpha.value + dynamicAlpha
69
-
70
- val sheetCloseOffset = with(LocalDensity.current) { 100.dp.toPx() }
71
-
72
- val coroutineScope = rememberCoroutineScope()
73
-
74
- val maxApi = LocalMaxApi.current
75
- val context = LocalContext.current
76
-
77
- DisposableEffect(Unit) {
78
- ScreenTracker.trackPopupDisplayed(
79
- maxApi = maxApi,
80
- context = context,
81
- parentScreenName = ScreenTracker.getLastScreenName()
82
- )
83
- onDispose { }
84
- }
85
-
86
- suspend fun openEvent(){
87
- backgroundAlpha.animateTo(
88
- targetValue = 0.3f,
89
- animationSpec = tween(
90
- durationMillis = 100,
91
- easing = CubicBezierEasing(0.05f, 0.7f, 0.1f, 1f)
92
- )
93
- )
94
- sheetOffset.animateTo(
95
- targetValue = 0f,
96
- animationSpec = tween(
97
- durationMillis = 350,
98
- easing = CubicBezierEasing(0.05f, 0.7f, 0.1f, 1f)
99
- )
100
- )
101
- }
102
-
103
- fun closeEvent(){
104
- coroutineScope.launch {
105
- sheetOffset.animateTo(
106
- targetValue = screenHeightPx,
107
- animationSpec = tween(
108
- durationMillis = 200,
109
- easing = CubicBezierEasing(0.3f, 0.0f, 0.8f, 0.15f)
110
- )
111
- )
112
- backgroundAlpha.animateTo(
113
- targetValue = 0f,
114
- animationSpec = tween(
115
- durationMillis = 100,
116
- easing = CubicBezierEasing(0.3f, 0.0f, 0.8f, 0.15f)
117
- )
118
- )
119
- OverplayComponentRegistry.hardClearAfterDismiss()
120
- }
121
- }
122
-
123
- LaunchedEffect(Unit) {
124
- openEvent()
125
- }
126
-
127
- DisposableEffect(Unit) {
128
- OverplayComponentRegistry.bindClose { closeEvent() }
129
- onDispose {
130
- onDismiss?.invoke()
131
- }
132
- }
133
-
134
- BackHandler(true){
135
- closeEvent()
136
- }
137
-
138
- BoxWithConstraints(
139
- modifier = Modifier
140
- .fillMaxSize()
141
- .background(Color.Black.copy(alpha = alpha))
142
- .noFeedbackClickable {
143
- if(barrierDismissible) closeEvent()
144
- }
145
- ) {
146
- val parentHeight = with(LocalDensity.current) { constraints.maxHeight.toDp() }
147
-
148
- Box(
149
- modifier = Modifier
150
- .align(Alignment.BottomCenter)
151
- .offset { IntOffset(x = 0, y = sheetOffset.value.toInt()) }
152
- .fillMaxWidth()
153
- .heightIn(max = parentHeight - 90.dp)
154
- .background(
155
- color = if (isSurface) AppTheme.current.colors.background.surface else AppTheme.current.colors.background.default,
156
- shape = RoundedCornerShape(topStart = Radius.M, topEnd = Radius.M)
157
- )
158
- .conditional(IsShowBaseLineDebug) {
159
- border(1.dp, Colors.blue_03)
160
- }
161
- .noFeedbackClickable { },
162
- contentAlignment = Alignment.BottomCenter
163
- ) {
164
- Column(Modifier.padding(bottom = AppNavigationBar.current)) {
165
- Box(
166
- modifier = Modifier
167
- .height(72.dp)
168
- .fillMaxWidth()
169
- .pointerInput(Unit) {
170
- detectDragGestures(
171
- onDrag = { change, dragAmount ->
172
- change.consume()
173
- coroutineScope.launch {
174
- val newOffset = (sheetOffset.value + dragAmount.y).coerceAtLeast(0f)
175
- sheetOffset.snapTo(newOffset)
176
- }
177
- },
178
- onDragEnd = {
179
- coroutineScope.launch {
180
- if (sheetOffset.value > sheetCloseOffset) {
181
- closeEvent()
182
- } else {
183
- sheetOffset.animateTo(0f)
184
- }
185
- }
186
- }
187
- )
188
- }
189
- ) {
190
- Column(
191
- modifier = Modifier
192
- .fillMaxSize()
193
- .padding(horizontal = Spacing.M),
194
- horizontalAlignment = Alignment.CenterHorizontally
195
- ) {
196
- Spacer(Modifier.height(8.dp))
197
- Box(
198
- modifier = Modifier
199
- .height(4.dp)
200
- .width(40.dp)
201
- .background(
202
- color = Colors.black_06,
203
- shape = RoundedCornerShape(Radius.S)
204
- )
205
- )
206
- Spacer(Modifier.height(4.dp))
207
- Box(Modifier.fillMaxWidth().height(56.dp), contentAlignment = Alignment.Center){
208
- when (header) {
209
- is BottomHeader.Title -> {
210
- Row(modifier = Modifier.fillMaxSize(), verticalAlignment = Alignment.CenterVertically) {
211
- Box(Modifier.size(24.dp))
212
- Box(Modifier.fillMaxHeight().weight(1f), contentAlignment = Alignment.Center){
213
- Text(
214
- text = header.data,
215
- color = Colors.black_17,
216
- style = Typography.headerDefaultBold
217
- )
218
- }
219
- Box(Modifier
220
- .size(24.dp)
221
- .noFeedbackClickable {
222
- closeEvent()
223
- },
224
- contentAlignment = Alignment.Center
225
- ){
226
- Icon(source = "navigation_close")
227
- }
228
- }
229
- }
230
- is BottomHeader.Custom -> {
231
- header.content()
232
- }
233
- }
234
- }
235
- }
236
- }
237
- Divider()
238
- content()
239
- }
240
- }
241
- }
242
- }
243
-
244
- sealed class BottomHeader {
245
- data class Title(
246
- val data: String = "Bottom Sheet Title",
247
- ) : BottomHeader()
248
-
249
- data class Custom(
250
- val content: @Composable () -> Unit
251
- ) : BottomHeader()
252
- }
@@ -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,100 +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
- floatingButtonProps: FloatingButtonProps? = null,
36
- keyboardOptions: KeyboardOptions? = null
37
- ) {
38
- updateOptions(
39
- options.copy(
40
- onBackHandler = onBackHandler ?: options.onBackHandler,
41
- hiddenBack = hiddenBack ?: options.hiddenBack,
42
- headerBackProps = headerBackProps ?: options.headerBackProps,
43
- headerTitle = headerTitle ?: options.headerTitle,
44
- titlePosition = titlePosition ?: options.titlePosition,
45
- headerRight = headerRight ?: options.headerRight,
46
- headerType = headerType ?: options.headerType,
47
- scrollData = scrollData ?: options.scrollData,
48
- backgroundColor = backgroundColor ?: options.backgroundColor,
49
- tintColor = tintColor ?: options.tintColor,
50
- footerComponent = footerComponent ?: options.footerComponent,
51
- floatingButtonProps = floatingButtonProps ?: options.floatingButtonProps,
52
- keyboardOptions = keyboardOptions ?: options.keyboardOptions,
53
- )
54
- )
55
- }
56
-
57
- fun setOptions(newOptions: NavigationOptions) {
58
- updateOptions(newOptions)
59
- }
60
-
61
- private fun updateOptions(updated: NavigationOptions) {
62
- _options.value = updated
63
- if (bottomTabIndex != -1) setBottomTabOption(bottomTabIndex, updated)
64
- if (id != -1) registry?.setOptions(id, updated)
65
- }
66
- }
67
-
68
- val LocalNavigation = staticCompositionLocalOf<Navigation> {
69
- error("No NavigationStack provided")
70
- }
71
-
72
- @Stable
73
- data class NavigationOptions(
74
- val screenName: String? = null,
75
- val onBackHandler: (() -> Unit)? = null,
76
- val hiddenBack: Boolean = false,
77
- val headerBackProps: HeaderBackProps = HeaderBackProps(),
78
- val headerTitle: HeaderTitle = HeaderTitle.Default("Stack"),
79
- val titlePosition: TitlePosition = TitlePosition.LEFT,
80
- val headerRight: HeaderRight = HeaderRight.Toolkit(),
81
- val headerType: HeaderType = HeaderType.Default(),
82
- val scrollData: ScrollData = ScrollData(),
83
- val backgroundColor: Color? = null,
84
- val tintColor: Color? = null,
85
- val footerComponent: @Composable (() -> Unit)? = null,
86
- val floatingButtonProps: FloatingButtonProps? = null,
87
- val keyboardOptions: KeyboardOptions = KeyboardOptions()
88
- ) {
89
- internal fun hasFooter() : Boolean = footerComponent != null
90
- }
91
-
92
- data class KeyboardOptions(
93
- val keyboardShouldPersistTaps: Boolean = false,
94
- val useAvoidKeyboard: Boolean = true
95
- )
96
- data class ScrollData(
97
- val scrollable: Boolean = true,
98
- val scrollState: ScrollableState? = null,
99
- val scrollToTopCallback: (() -> Unit)? = null,
100
- )