@momo-kits/native-kits 0.169.13-beta.4-debug → 0.169.13

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 (173) hide show
  1. package/CLAUDE.md +1 -4
  2. package/ios/Navigation/BottomTab/BottomTabBar.swift +14 -4
  3. package/ios/native-kits.podspec +1 -1
  4. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  5. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +16 -3
  6. package/package.json +1 -1
  7. package/build.gradle.kts +0 -11
  8. package/compose/build.gradle.kts +0 -202
  9. package/compose/compose.podspec +0 -47
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  12. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  13. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  14. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -154
  15. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +0 -17
  16. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
  17. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiActionsTest.kt +0 -647
  18. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiExprTest.kt +0 -1411
  19. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiHostTest.kt +0 -130
  20. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiKitArgsTest.kt +0 -524
  21. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiKitNodesTest.kt +0 -559
  22. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiRenderPlanTest.kt +0 -741
  23. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiRenderReuseTest.kt +0 -221
  24. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiRendererPropsTest.kt +0 -270
  25. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiStylePlanTest.kt +0 -849
  26. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiStyleTest.kt +0 -212
  27. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiTrackingTest.kt +0 -239
  28. package/compose/src/androidUnitTest/kotlin/vn/momo/kits/sdui/SduiViewTest.kt +0 -252
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -61
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1067
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -268
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -81
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -354
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -130
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -482
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -224
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -137
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -473
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -113
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -262
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -237
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -228
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -280
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -183
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -342
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -40
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -82
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -39
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -362
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -304
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -88
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -308
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -218
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -456
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -205
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -89
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -542
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -175
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -201
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -208
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -12
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -291
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +0 -71
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +0 -184
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -315
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -54
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -397
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -153
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -118
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -206
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -421
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -750
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -152
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -242
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -398
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -103
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -93
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -208
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +0 -133
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -167
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -446
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -105
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -400
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -197
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -114
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -7
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -76
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +0 -7
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -21
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiActions.kt +0 -154
  139. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiExpr.kt +0 -1038
  140. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiKitNodes.kt +0 -848
  141. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiLog.kt +0 -47
  142. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiModel.kt +0 -39
  143. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiPropsRenderer.kt +0 -463
  144. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiRenderer.kt +0 -1146
  145. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiStyle.kt +0 -667
  146. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiTracking.kt +0 -240
  147. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiValidate.kt +0 -185
  148. package/compose/src/commonMain/kotlin/vn/momo/kits/sdui/SduiView.kt +0 -200
  149. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  150. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  151. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  152. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -117
  153. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
  154. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  155. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  156. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  157. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -65
  158. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -217
  159. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +0 -48
  160. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -143
  161. package/gradle/libs.versions.toml +0 -69
  162. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  163. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  164. package/gradle.properties +0 -24
  165. package/gradlew +0 -252
  166. package/gradlew.bat +0 -94
  167. package/ios-demo/README.md +0 -120
  168. package/scripts/sdui-visual/README.md +0 -64
  169. package/scripts/sdui-visual/diff.py +0 -65
  170. package/scripts/sdui-visual/drive.py +0 -234
  171. package/scripts/sdui-visual/plan.json +0 -713
  172. package/scripts/sdui-visual/run.sh +0 -92
  173. package/settings.gradle.kts +0 -64
@@ -1,342 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.animation.core.*
4
- import androidx.compose.foundation.Canvas
5
- import androidx.compose.foundation.OverscrollEffect
6
- import androidx.compose.foundation.background
7
- import androidx.compose.foundation.gestures.FlingBehavior
8
- import androidx.compose.foundation.gestures.ScrollableDefaults
9
- import androidx.compose.foundation.layout.*
10
- import androidx.compose.foundation.lazy.*
11
- import androidx.compose.material.ExperimentalMaterialApi
12
- import androidx.compose.material.pullrefresh.PullRefreshIndicator
13
- import androidx.compose.material.pullrefresh.pullRefresh
14
- import androidx.compose.material.pullrefresh.rememberPullRefreshState
15
- import androidx.compose.runtime.*
16
- import androidx.compose.ui.Alignment
17
- import androidx.compose.ui.Modifier
18
- import androidx.compose.ui.composed
19
- import androidx.compose.ui.geometry.CornerRadius
20
- import androidx.compose.ui.geometry.Offset
21
- import androidx.compose.ui.geometry.Size
22
- import androidx.compose.ui.graphics.Color
23
- import androidx.compose.ui.graphics.drawscope.rotate
24
- import androidx.compose.ui.hapticfeedback.HapticFeedbackType
25
- import androidx.compose.ui.layout.Measurable
26
- import androidx.compose.ui.layout.MeasureResult
27
- import androidx.compose.ui.layout.MeasureScope
28
- import androidx.compose.ui.layout.layout
29
- import androidx.compose.ui.platform.LocalDensity
30
- import androidx.compose.ui.platform.LocalHapticFeedback
31
- import androidx.compose.ui.unit.Constraints
32
- import androidx.compose.ui.unit.IntOffset
33
- import androidx.compose.ui.unit.dp
34
- import kotlinx.coroutines.flow.collect
35
- import kotlinx.coroutines.flow.combine
36
- import kotlinx.coroutines.flow.distinctUntilChanged
37
- import vn.momo.kits.const.Spacing
38
- import vn.momo.kits.modifier.conditional
39
- import vn.momo.kits.platform.getPlatformName
40
-
41
- private const val BOX_KEY = "LazyColumnWithBouncing_BOX_KEY"
42
-
43
-
44
- @OptIn(ExperimentalMaterialApi::class)
45
- @Composable
46
- internal fun overScrollWithPullToRefresh(
47
- pullRefreshState: PullToRefreshCustomState?,
48
- ): OverscrollEffect {
49
- val density = LocalDensity.current
50
- val hapticFeedback = LocalHapticFeedback.current
51
-
52
- return remember(density) {
53
- CupertinoOverscrollEffect(
54
- pullRefreshState = if (pullRefreshState != null && pullRefreshState.sendHaptic != null) pullRefreshState
55
- else pullRefreshState?.copy(
56
- sendHaptic = {
57
- hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
58
- }),
59
- density = density.density,
60
- applyClip = false,
61
- )
62
- }
63
- }
64
-
65
- @OptIn(ExperimentalMaterialApi::class)
66
- @Composable
67
- fun LazyColumnWithBouncing(
68
- modifier: Modifier = Modifier,
69
- modifierIndicator: Modifier = Modifier,
70
- state: LazyListState = rememberLazyListState(),
71
- contentPadding: PaddingValues = PaddingValues(0.dp),
72
- reverseLayout: Boolean = false,
73
- verticalArrangement: Arrangement.Vertical = if (!reverseLayout) Arrangement.Top else Arrangement.Bottom,
74
- horizontalAlignment: Alignment.Horizontal = Alignment.Start,
75
- flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
76
- userScrollEnabled: Boolean = true,
77
- pullRefreshState: PullToRefreshCustomState? = null,
78
- content: LazyListScope.() -> Unit,
79
- ) {
80
- val height = remember { mutableIntStateOf(0) }
81
- val maxConstraint = remember { mutableIntStateOf(0) }
82
-
83
- LaunchedEffect(Unit) {
84
- val addOn = 1
85
- combine(
86
- snapshotFlow { maxConstraint.value }.distinctUntilChanged(),
87
- snapshotFlow { state.layoutInfo }
88
- ) { cHeight, layoutInfo ->
89
- height.value = when {
90
- height.value == 0 && (state.canScrollForward || state.canScrollBackward) -> 0
91
- layoutInfo.viewportSize.height >= cHeight && height.value == 0 -> 0
92
- layoutInfo.visibleItemsInfo.lastOrNull()?.key != BOX_KEY -> 0
93
- else -> {
94
- val vH = layoutInfo.totalHeight
95
- (cHeight - (vH - height.value) + addOn).coerceIn(0, cHeight)
96
- }
97
- }
98
- }.collect()
99
- }
100
-
101
- val measureLayout = remember<MeasureScope.(Measurable, Constraints) -> MeasureResult>(maxConstraint) {
102
- { m, c ->
103
- val p = m.measure(c.copy(minHeight = 0))
104
- maxConstraint.value = c.maxHeight
105
- layout(p.width, p.height) {
106
- p.place(IntOffset.Zero)
107
- }
108
- }
109
- }
110
-
111
- if (getPlatformName() == "iOS") {
112
-
113
- val overscroll = overScrollWithPullToRefresh(
114
- pullRefreshState = remember {
115
- pullRefreshState
116
- })
117
-
118
- Box {
119
- IosIndicator(
120
- effect = overscroll,
121
- modifier = modifierIndicator.align(Alignment.TopCenter).padding(top = Spacing.L).size(24.dp),
122
- )
123
- LazyColumn(
124
- modifier = modifier
125
- .layout(measure = measureLayout),
126
- state = state,
127
- contentPadding = contentPadding,
128
- flingBehavior = flingBehavior,
129
- horizontalAlignment = horizontalAlignment,
130
- verticalArrangement = verticalArrangement,
131
- reverseLayout = reverseLayout,
132
- userScrollEnabled = userScrollEnabled,
133
- overscrollEffect = overscroll,
134
- ) {
135
- content()
136
- item(key = BOX_KEY) {
137
- FakeBox(height)
138
- }
139
- }
140
- }
141
- } else {
142
- val pullState = rememberPullRefreshState(
143
- refreshing = pullRefreshState?.refreshingState?.value ?: false,
144
- onRefresh = {
145
- pullRefreshState?.onRefresh()
146
- },
147
- )
148
-
149
- Box(
150
- contentAlignment = Alignment.TopCenter,
151
- modifier = Modifier.conditional(pullRefreshState != null) {
152
- pullRefresh(pullState)
153
- }) {
154
- LazyColumn(
155
- modifier = modifier.calculateHeight(height),
156
- state = state,
157
- contentPadding = contentPadding,
158
- flingBehavior = flingBehavior,
159
- horizontalAlignment = horizontalAlignment,
160
- verticalArrangement = verticalArrangement,
161
- reverseLayout = reverseLayout,
162
- userScrollEnabled = userScrollEnabled,
163
- ) {
164
- content()
165
- }
166
- if (pullRefreshState != null) {
167
- PullRefreshIndicator(
168
- pullRefreshState.refreshingState.value,
169
- pullState,
170
- modifierIndicator.align(Alignment.TopCenter)
171
- )
172
- }
173
-
174
- }
175
- }
176
- }
177
-
178
- @Composable
179
- private fun IosIndicator(
180
- effect: OverscrollEffect?,
181
- modifier: Modifier = Modifier,
182
- ) {
183
- if (effect !is CupertinoOverscrollEffect) return
184
- if (effect.pullRefreshState == null) return
185
- val state = effect.pullRefreshState
186
-
187
-
188
- SpinningProgressBarLoading(
189
- progress = state.position, modifier = modifier
190
- )
191
- }
192
-
193
- @Composable
194
- private fun SpinningProgressBarLoading(
195
- progress: State<Float>, modifier: Modifier = Modifier
196
- ) {
197
- if (progress.value <= 0) {
198
- return
199
- }
200
-
201
- val hapticFeedback = LocalHapticFeedback.current
202
- val isSendHaptic = remember { mutableStateOf(false) }
203
-
204
- val totalStep = 8
205
- val stepAngle = 360f / totalStep
206
- val baseOpacity = 1.0f / (totalStep + 2)
207
- val minAlpha = 0.2f
208
-
209
- val infiniteTransition = rememberInfiniteTransition()
210
- val angle = infiniteTransition.animateFloat(
211
- initialValue = 0f, targetValue = totalStep.toFloat(), animationSpec = infiniteRepeatable(
212
- animation = tween(totalStep * 100, easing = LinearEasing),
213
- repeatMode = RepeatMode.Restart
214
- )
215
- )
216
-
217
- LaunchedEffect(Unit) {
218
- snapshotFlow { progress.value }.collect {
219
- if (it >= 1.0f && !isSendHaptic.value) {
220
- hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
221
- isSendHaptic.value = true
222
- } else if (progress.value < 1.0f && isSendHaptic.value) {
223
- isSendHaptic.value = false
224
- }
225
- }
226
-
227
- }
228
-
229
- Canvas(modifier = modifier) {
230
- val percentage = progress.value
231
- val clampedProgress = percentage.coerceIn(0f, 1f)
232
- val value = (totalStep * clampedProgress).coerceIn(0f, totalStep.toFloat())
233
- val integerPart = value.toInt()
234
- val decimalPart = value - integerPart
235
-
236
- if (integerPart <= 0) return@Canvas
237
-
238
- val canvasWidth = size.width
239
- val canvasHeight = size.height
240
- val width = size.width * 0.3f
241
- val height = size.height / 8
242
- val cornerRadius = (width.coerceAtMost(height) / 2)
243
-
244
- if (percentage >= 1f) {
245
- for (i in 0..360 step 360 / totalStep) {
246
- rotate(i.toFloat()) {
247
- drawRoundRect(
248
- color = Color.LightGray.copy(alpha = .7f),
249
- topLeft = Offset(canvasWidth - width, (canvasHeight - height) / 2),
250
- size = Size(width, height),
251
- cornerRadius = CornerRadius(cornerRadius, cornerRadius)
252
- )
253
- }
254
- }
255
-
256
- val coefficient = 360f / totalStep
257
-
258
- for (i in 1..4) {
259
- rotate((angle.value.toInt() + i) * coefficient) {
260
- drawRoundRect(
261
- color = Color.Gray.copy(alpha = (0.2f + 0.2f * i).coerceIn(0f, 1f)),
262
- topLeft = Offset(canvasWidth - width, (canvasHeight - height) / 2),
263
- size = Size(width, height),
264
- cornerRadius = CornerRadius(cornerRadius, cornerRadius)
265
- )
266
- }
267
- }
268
- return@Canvas
269
- }
270
-
271
- val topLeft = Offset(canvasWidth - width, (canvasHeight - height) / 2)
272
- val rectSize = Size(width, height)
273
- val cornerRadiusValue = CornerRadius(cornerRadius, cornerRadius)
274
- repeat(integerPart) { i ->
275
- val angle = i * stepAngle - 90f
276
- val stepOpacity = 1f - (baseOpacity * i)
277
-
278
- val alpha = if (i == integerPart - 1) {
279
- (decimalPart * stepOpacity).coerceIn(minAlpha, 1f)
280
- } else {
281
- stepOpacity.coerceIn(minAlpha, 1f)
282
- }
283
-
284
- rotate(angle) {
285
- drawRoundRect(
286
- color = Color.Gray.copy(alpha = alpha),
287
- topLeft = topLeft,
288
- size = rectSize,
289
- cornerRadius = cornerRadiusValue
290
- )
291
- }
292
- }
293
- }
294
- }
295
-
296
- @Composable
297
- private fun FakeBox(height: MutableState<Int>) {
298
- Box(
299
- modifier = Modifier
300
- .dynamicHeight(height).fillMaxWidth().background(Color.Red),
301
- )
302
- }
303
-
304
- private fun Modifier.calculateHeight(
305
- height: MutableState<Int>,
306
- ) = this.layout { m, c ->
307
- val p = m.measure(
308
- constraints = c.copy(
309
- minHeight = 0
310
- )
311
- )
312
- val vH = p.height
313
- val cMaxHeight = c.maxHeight
314
- val addOn = 0.5.dp.roundToPx()
315
- var extraSpace = addOn + height.value
316
- if (height.value == 0) {
317
- extraSpace = 0
318
- }
319
- if (vH - extraSpace >= cMaxHeight && height.value != 0) {
320
- height.value = 0
321
- } else if (vH - extraSpace < cMaxHeight) {
322
- height.value = cMaxHeight - (vH - extraSpace) + addOn
323
- }
324
-
325
- layout(c.maxWidth, cMaxHeight) {
326
- p.place(IntOffset.Zero)
327
- }
328
- }
329
-
330
-
331
- private fun Modifier.dynamicHeight(height: MutableState<Int>) = composed {
332
- val measure = remember<MeasureScope.(Measurable, Constraints) -> MeasureResult>(this, height) {
333
- { m, c ->
334
- val p = m.measure(c)
335
- layout(c.maxWidth, height.value) { p.place(IntOffset.Zero) }
336
- }
337
- }
338
- this.layout(measure = measure)
339
- }
340
-
341
- private val LazyListLayoutInfo.totalHeight: Int
342
- get() = visibleItemsInfo.sumOf { it.size }
@@ -1,108 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.animation.core.FastOutSlowInEasing
4
- import androidx.compose.animation.core.animateFloatAsState
5
- import androidx.compose.animation.core.tween
6
- import androidx.compose.foundation.background
7
- import androidx.compose.foundation.border
8
- import androidx.compose.foundation.layout.Box
9
- import androidx.compose.foundation.layout.fillMaxWidth
10
- import androidx.compose.foundation.layout.height
11
- import androidx.compose.foundation.layout.size
12
- import androidx.compose.foundation.shape.RoundedCornerShape
13
- import androidx.compose.runtime.Composable
14
- import androidx.compose.runtime.getValue
15
- import androidx.compose.ui.Modifier
16
- import androidx.compose.ui.draw.clip
17
- import androidx.compose.ui.graphics.Color
18
- import androidx.compose.ui.unit.dp
19
- import vn.momo.kits.application.IsShowBaseLineDebug
20
- import vn.momo.kits.const.AppTheme
21
- import vn.momo.kits.const.Colors
22
- import vn.momo.kits.const.Radius
23
- import vn.momo.kits.modifier.conditional
24
- import vn.momo.kits.platform.LottieAnimation
25
-
26
- enum class LoaderType {
27
- DOT, SPINNER
28
- }
29
-
30
- @Composable
31
- fun Loader(
32
- type: LoaderType = LoaderType.DOT,
33
- tintColor: Color? = null,
34
- modifier: Modifier = Modifier
35
- ) {
36
- when (type) {
37
- LoaderType.DOT -> DotLoader(tintColor = tintColor, modifier = modifier)
38
- LoaderType.SPINNER -> SpinnerLoader(tintColor = tintColor, modifier = modifier)
39
- }
40
- }
41
-
42
- @Composable
43
- fun DotLoader(
44
- tintColor: Color? = null,
45
- modifier: Modifier = Modifier
46
- ) {
47
- LottieAnimation(
48
- path = "files/dot_loading",
49
- tintColor = tintColor,
50
- modifier = modifier
51
- .size(width = 52.dp, height = 18.dp)
52
- .conditional(IsShowBaseLineDebug) {
53
- border(1.dp, Colors.blue_03)
54
- }
55
- )
56
- }
57
-
58
- @Composable
59
- fun SpinnerLoader(
60
- tintColor: Color? = null,
61
- modifier: Modifier = Modifier
62
- ) {
63
- LottieAnimation(
64
- path = "files/lottie_circle_loader",
65
- tintColor = tintColor,
66
- modifier = modifier
67
- .size(24.dp)
68
- .conditional(IsShowBaseLineDebug) {
69
- border(1.dp, Colors.blue_03)
70
- }
71
- )
72
- }
73
-
74
- @Composable
75
- fun ProgressBar(
76
- percent: Float = 0f,
77
- color: Color? = null,
78
- modifier: Modifier = Modifier
79
- ) {
80
- val clampedPercent = percent.coerceIn(0f, 100f)
81
- val animatedProgress by animateFloatAsState(
82
- targetValue = clampedPercent / 100f,
83
- animationSpec = tween(durationMillis = 200, easing = FastOutSlowInEasing),
84
- label = "progressAnimation"
85
- )
86
-
87
- val trackColor = AppTheme.current.colors.background.default
88
- val fillColor = color ?: AppTheme.current.colors.primary
89
-
90
- Box(
91
- modifier = modifier
92
- .fillMaxWidth()
93
- .height(4.dp)
94
- .clip(RoundedCornerShape(Radius.XXS))
95
- .background(trackColor)
96
- .conditional(IsShowBaseLineDebug) {
97
- border(1.dp, Colors.blue_03)
98
- }
99
- ) {
100
- Box(
101
- modifier = Modifier
102
- .fillMaxWidth(animatedProgress)
103
- .height(4.dp)
104
- .clip(RoundedCornerShape(Radius.XXS))
105
- .background(fillColor)
106
- )
107
- }
108
- }
@@ -1,56 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.Box
6
- import androidx.compose.foundation.layout.Row
7
- import androidx.compose.foundation.layout.padding
8
- import androidx.compose.foundation.layout.size
9
- import androidx.compose.foundation.shape.RoundedCornerShape
10
- import androidx.compose.runtime.Composable
11
- import androidx.compose.ui.Modifier
12
- import androidx.compose.ui.graphics.Color
13
- import androidx.compose.ui.unit.dp
14
- import vn.momo.kits.application.IsShowBaseLineDebug
15
- import vn.momo.kits.const.AppTheme
16
- import vn.momo.kits.const.Colors
17
- import vn.momo.kits.const.Spacing
18
- import vn.momo.kits.modifier.conditional
19
-
20
- @Composable
21
- internal fun Dot(active: Boolean = false, activeColor: Color, modifier: Modifier = Modifier) {
22
- return if (active) {
23
- Box(
24
- modifier = modifier.size(width = 12.dp, height = 4.dp).background(
25
- color = activeColor,
26
- shape = RoundedCornerShape(4.dp)
27
- )
28
- )
29
- } else {
30
- Box(
31
- modifier = modifier.size(4.dp)
32
- .background(
33
- color = AppTheme.current.colors.background.pressed,
34
- shape = RoundedCornerShape(4.dp)
35
- )
36
- )
37
- }
38
- }
39
-
40
- @Composable
41
- fun PaginationDot(
42
- activeIndex: Int = 0,
43
- dataLength: Int = 3
44
- ) {
45
- Row(modifier = Modifier.conditional(IsShowBaseLineDebug) {
46
- border(1.dp, Colors.blue_03)
47
- }) {
48
- for (i in 0 until dataLength) {
49
- Dot(
50
- i == activeIndex,
51
- AppTheme.current.colors.primary,
52
- modifier = Modifier.padding(end = if (i != dataLength - 1) Spacing.XS else 0.dp)
53
- )
54
- }
55
- }
56
- }
@@ -1,40 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.BoxWithConstraints
6
- import androidx.compose.foundation.layout.padding
7
- import androidx.compose.foundation.shape.RoundedCornerShape
8
- import androidx.compose.runtime.Composable
9
- import androidx.compose.ui.Alignment
10
- import androidx.compose.ui.Modifier
11
- import androidx.compose.ui.unit.dp
12
- import vn.momo.kits.application.IsShowBaseLineDebug
13
- import vn.momo.kits.const.Colors
14
- import vn.momo.kits.const.Spacing
15
- import vn.momo.kits.const.Typography
16
- import vn.momo.kits.modifier.conditional
17
-
18
- @Composable
19
- fun PaginationNumber(
20
- activeIndex: Int = 0,
21
- dataLength: Int = 2
22
- ) {
23
- BoxWithConstraints(
24
- modifier = Modifier.background(
25
- color = Colors.opacity_black_20,
26
- shape = RoundedCornerShape(Spacing.L)
27
- )
28
- .conditional(IsShowBaseLineDebug) {
29
- border(1.dp, Colors.blue_03)
30
- },
31
- contentAlignment = Alignment.Center
32
- ) {
33
- Text(
34
- modifier = Modifier.padding(horizontal = Spacing.S),
35
- text = "${1 + activeIndex}/$dataLength",
36
- color = Colors.black_01,
37
- style = Typography.labelDefaultMedium
38
- )
39
- }
40
- }
@@ -1,82 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.horizontalScroll
6
- import androidx.compose.foundation.layout.*
7
- import androidx.compose.foundation.rememberScrollState
8
- import androidx.compose.foundation.shape.RoundedCornerShape
9
- import androidx.compose.runtime.Composable
10
- import androidx.compose.runtime.derivedStateOf
11
- import androidx.compose.runtime.getValue
12
- import androidx.compose.runtime.remember
13
- import androidx.compose.ui.Alignment
14
- import androidx.compose.ui.Modifier
15
- import androidx.compose.ui.draw.clip
16
- import androidx.compose.ui.unit.Dp
17
- import androidx.compose.ui.unit.dp
18
- import vn.momo.kits.application.IsShowBaseLineDebug
19
- import vn.momo.kits.const.AppTheme
20
- import vn.momo.kits.const.Colors
21
- import vn.momo.kits.const.Spacing
22
- import vn.momo.kits.modifier.conditional
23
-
24
- private val INDICATOR_WIDTH = 24.dp
25
- private val PROGRESS_WIDTH = 72.dp
26
-
27
- private fun calculateOffset(currentPosition: Int, maxBound: Int): Dp {
28
- return if (maxBound == 0) 0.dp else {
29
- (PROGRESS_WIDTH - INDICATOR_WIDTH) * (currentPosition / maxBound.toFloat())
30
- }
31
- }
32
-
33
- @Composable
34
- fun PaginationScroll(
35
- modifier: Modifier = Modifier,
36
- content: @Composable () -> Unit
37
- ) {
38
- val scrollState = rememberScrollState()
39
- val theme = AppTheme.current
40
-
41
- val indicatorOffset by remember {
42
- derivedStateOf {
43
- calculateOffset(scrollState.value, scrollState.maxValue)
44
- }
45
- }
46
-
47
- val (progressBackground, indicatorColor) = remember(theme) {
48
- theme.colors.background.pressed to theme.colors.primary
49
- }
50
-
51
- Column(horizontalAlignment = Alignment.CenterHorizontally) {
52
- Row(
53
- modifier = modifier
54
- .fillMaxWidth()
55
- .conditional(IsShowBaseLineDebug) {
56
- border(1.dp, Colors.blue_03)
57
- }
58
- .padding(bottom = Spacing.L)
59
- .horizontalScroll(scrollState)
60
- ) {
61
- content()
62
- }
63
-
64
- // Progress indicator
65
- Box(
66
- modifier = Modifier
67
- .clip(RoundedCornerShape(Spacing.XS))
68
- .width(PROGRESS_WIDTH)
69
- .height(4.dp)
70
- .background(color = progressBackground)
71
- ) {
72
- Box(
73
- modifier = Modifier
74
- .offset(x = indicatorOffset)
75
- .clip(RoundedCornerShape(Spacing.XS))
76
- .width(INDICATOR_WIDTH)
77
- .height(4.dp)
78
- .background(color = indicatorColor)
79
- )
80
- }
81
- }
82
- }
@@ -1,39 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.Row
6
- import androidx.compose.foundation.layout.padding
7
- import androidx.compose.foundation.shape.RoundedCornerShape
8
- import androidx.compose.runtime.Composable
9
- import androidx.compose.ui.Modifier
10
- import androidx.compose.ui.unit.dp
11
- import vn.momo.kits.application.IsShowBaseLineDebug
12
- import vn.momo.kits.const.Colors
13
- import vn.momo.kits.const.Spacing
14
- import vn.momo.kits.modifier.conditional
15
-
16
- @Composable
17
- fun PaginationWhiteDot(
18
- activeIndex: Int = 0,
19
- dataLength: Int = 3
20
- ) {
21
- Row(
22
- modifier = Modifier.background(
23
- color = Colors.opacity_black_20,
24
- shape = RoundedCornerShape(Spacing.S)
25
- )
26
- .conditional(IsShowBaseLineDebug) {
27
- border(1.dp, Colors.blue_03)
28
- }
29
- .padding(Spacing.XS)
30
- ) {
31
- for (i in 0 until dataLength) {
32
- Dot(
33
- i == activeIndex,
34
- Colors.black_01,
35
- modifier = Modifier.padding(end = if (i != dataLength - 1) Spacing.XS else 0.dp)
36
- )
37
- }
38
- }
39
- }