@momo-kits/native-kits 0.169.5-beta.1-debug → 0.169.5-beta.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 (145) hide show
  1. package/ios/Layout/ModalLayout.swift +2 -2
  2. package/ios/Popup/PopupDisplay.swift +3 -3
  3. package/ios/Popup/PopupInput.swift +1 -1
  4. package/ios/Popup/PopupLayout.swift +3 -3
  5. package/ios/native-kits.podspec +1 -1
  6. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  7. package/package.json +1 -1
  8. package/build.gradle.kts +0 -11
  9. package/compose/build.gradle.kts +0 -198
  10. package/compose/compose.podspec +0 -47
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -20
  12. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  13. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  14. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  15. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -154
  16. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +0 -17
  17. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1071
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -81
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -195
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -478
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -265
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -265
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -363
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -308
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -330
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -207
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -92
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -560
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -501
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -236
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -17
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -293
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +0 -187
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -316
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -393
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -153
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -113
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -422
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -739
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -239
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -423
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -94
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -97
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -203
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +0 -108
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -456
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -105
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -399
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -204
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -114
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -76
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +0 -7
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -22
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
  130. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
  131. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  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/BackGesture.ios.kt +0 -38
  134. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  135. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -219
  136. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +0 -48
  137. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -144
  138. package/gradle/libs.versions.toml +0 -69
  139. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  140. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  141. package/gradle.properties +0 -24
  142. package/gradlew +0 -252
  143. package/gradlew.bat +0 -94
  144. package/ios-demo/README.md +0 -120
  145. package/settings.gradle.kts +0 -64
@@ -1,203 +0,0 @@
1
- package vn.momo.kits.navigation.bottomtab
2
-
3
- import androidx.compose.foundation.clickable
4
- import androidx.compose.foundation.layout.Arrangement
5
- import androidx.compose.foundation.layout.Box
6
- import androidx.compose.foundation.layout.BoxScope
7
- import androidx.compose.foundation.layout.Column
8
- import androidx.compose.foundation.layout.height
9
- import androidx.compose.foundation.layout.offset
10
- import androidx.compose.foundation.layout.padding
11
- import androidx.compose.foundation.layout.size
12
- import androidx.compose.foundation.layout.width
13
- import androidx.compose.foundation.layout.absolutePadding
14
- import androidx.compose.foundation.layout.wrapContentWidth
15
- import androidx.compose.foundation.shape.CircleShape
16
- import androidx.compose.foundation.shape.RoundedCornerShape
17
- import androidx.compose.runtime.Composable
18
- import androidx.compose.runtime.compositionLocalOf
19
- import androidx.compose.ui.AbsoluteAlignment
20
- import androidx.compose.ui.Alignment
21
- import androidx.compose.ui.Modifier
22
- import androidx.compose.ui.graphics.Color
23
- import androidx.compose.ui.platform.LocalDensity
24
- import androidx.compose.ui.semantics.Role
25
- import androidx.compose.ui.semantics.contentDescription
26
- import androidx.compose.ui.semantics.role
27
- import androidx.compose.ui.semantics.selected
28
- import androidx.compose.ui.semantics.semantics
29
- import vn.momo.kits.modifier.activeOpacityClickable
30
- import androidx.compose.ui.unit.Dp
31
- import androidx.compose.ui.unit.dp
32
- import vn.momo.kits.components.Icon
33
- import vn.momo.kits.const.AppTheme
34
- import vn.momo.kits.const.Colors
35
- import vn.momo.kits.const.Radius
36
- import vn.momo.kits.const.Spacing
37
- import vn.momo.kits.layout.DuoMetrics
38
- import vn.momo.kits.layout.ScreenLayout
39
- import vn.momo.kits.layout.SideBarEdge
40
- import vn.momo.kits.modifier.noFeedbackClickable
41
- import vn.momo.kits.modifier.setAutomationId
42
-
43
- // Figma "Specs Navigation" (DS-984) Vertical type, mirrored from RN DuoTabBar.tsx.
44
- private val COMPACT_SIZE = DuoMetrics.controlSize
45
-
46
- // Space from the window bottom the rail stack and its gap take, so the header side bar stays above it.
47
- internal val LocalDuoRailReserve = compositionLocalOf { 0.dp }
48
-
49
- // Rail container plus the center action under it; compressed, the rail is a single button.
50
- internal fun duoRailHeight(itemCount: Int, hasQr: Boolean, compressed: Boolean = false): Dp {
51
- val rail = if (compressed) COMPACT_SIZE
52
- else TabBarMetrics.railItemHeight * itemCount + TabBarMetrics.railPaddingBottom
53
- return rail + if (hasQr) TabBarMetrics.railCtaGap + TabBarMetrics.railCtaHeight else 0.dp
54
- }
55
-
56
- // Space tab content leaves under the floating horizontal bar (phone and unfolded Duo), the rising center
57
- // action included; 0 when the Duo rail sits in the side strip.
58
- internal fun duoFloatingTabBarInset(layout: ScreenLayout, hasCenterAction: Boolean = false): Dp =
59
- if (layout.isIPhoneDuo && layout.sideBar != null) 0.dp
60
- else TabBarMetrics.height + tabBarBottomGap(layout.insetBottom) + if (hasCenterAction) TabBarMetrics.ctaLift else 0.dp
61
-
62
- // Whether the tabs' bar shows the center action, whose button rises ctaLift above the container.
63
- internal val LocalTabBarHasCenterAction = compositionLocalOf { false }
64
-
65
- // iPhone Duo tab bar: rail in the side bar, or the horizontal bar when unfolded portrait.
66
- @Composable
67
- internal fun BoxScope.DuoTabBar(
68
- layout: ScreenLayout,
69
- items: List<BottomTabItem>,
70
- floatingButton: BottomTabFloatingButton?,
71
- selectedIndex: Int,
72
- onTabSelected: (Int) -> Unit,
73
- compression: DuoBarCompression = DuoBarCompression(),
74
- ) {
75
- if (layout.sideBar != null) {
76
- DuoRailTabBar(layout, items, floatingButton, selectedIndex, onTabSelected, compression)
77
- } else {
78
- HorizontalTabBar(
79
- items = items,
80
- floatingButton = floatingButton,
81
- selectedIndex = selectedIndex,
82
- onTabSelected = onTabSelected,
83
- fixedFontScale = true,
84
- modifier = Modifier
85
- .align(Alignment.BottomCenter)
86
- .padding(bottom = tabBarBottomGap(layout.insetBottom))
87
- .width(horizontalBarWidth(layout.width, layout.height, layout.insetLeft, layout.insetRight)),
88
- )
89
- }
90
- }
91
-
92
- // Vertical bar anchored to the bottom of the side bar, center action below it. When the side bar is
93
- // short it can shrink to one button showing the current tab (HIG "Tab bar compressed"); tapping it
94
- // expands the rail and compresses the toolbar.
95
- @Composable
96
- private fun BoxScope.DuoRailTabBar(
97
- layout: ScreenLayout,
98
- items: List<BottomTabItem>,
99
- floatingButton: BottomTabFloatingButton?,
100
- selectedIndex: Int,
101
- onTabSelected: (Int) -> Unit,
102
- compression: DuoBarCompression,
103
- ) {
104
- val sideBar = layout.sideBar ?: return
105
- val isRight = sideBar.edge == SideBarEdge.RIGHT
106
-
107
- // the rail lines up with the header buttons in the side bar: centered on a 48 lane kept Spacing.M
108
- // from the strip's inner edge; the wider rail and center action overflow the lane evenly
109
- Column(
110
- modifier = Modifier
111
- .align(if (isRight) AbsoluteAlignment.BottomRight else AbsoluteAlignment.BottomLeft)
112
- .width(sideBar.width)
113
- .padding(bottom = sideBar.bottom)
114
- .absolutePadding(left = if (isRight) Spacing.M else 0.dp, right = if (isRight) 0.dp else Spacing.M)
115
- .wrapContentWidth(if (isRight) AbsoluteAlignment.Left else AbsoluteAlignment.Right)
116
- .width(COMPACT_SIZE),
117
- horizontalAlignment = Alignment.CenterHorizontally,
118
- verticalArrangement = Arrangement.spacedBy(TabBarMetrics.railCtaGap),
119
- ) {
120
- val current = items.getOrNull(selectedIndex)
121
- if (compression.tabBarCompressed && current != null) {
122
- Column(
123
- modifier = Modifier
124
- .size(COMPACT_SIZE)
125
- .tabBarContainer(CircleShape)
126
- .noFeedbackClickable(onClick = compression.expandTabBar)
127
- .setAutomationId("bottom_tab_bar"),
128
- horizontalAlignment = Alignment.CenterHorizontally,
129
- verticalArrangement = Arrangement.Center,
130
- ) {
131
- TabIcon(current, AppTheme.current.colors.primary, vertical = true)
132
- }
133
- } else {
134
- Rail(items, selectedIndex) {
135
- onTabSelected(it)
136
- compression.onTabSelected()
137
- }
138
- }
139
- if (floatingButton != null) {
140
- RailCenterAction(floatingButton)
141
- }
142
- }
143
- }
144
-
145
- // Column of rail items (.Nav/Duo/Item) with the sliding active indicator.
146
- @Composable
147
- private fun Rail(items: List<BottomTabItem>, selectedIndex: Int, onItemClick: (Int) -> Unit) {
148
- val density = LocalDensity.current
149
- Box(
150
- Modifier
151
- .wrapContentWidth(unbounded = true)
152
- .width(TabBarMetrics.railContainerWidth)
153
- .tabBarContainer(RoundedCornerShape(Radius.XL))
154
- .padding(horizontal = TabBarMetrics.railPaddingHorizontal)
155
- .padding(bottom = TabBarMetrics.railPaddingBottom)
156
- .setAutomationId("bottom_tab_bar")
157
- ) {
158
- ActiveIndicator(
159
- offset = with(density) { (Spacing.XS + TabBarMetrics.railItemHeight * selectedIndex.coerceAtLeast(0)).toPx() },
160
- modifier = Modifier.size(TabBarMetrics.railItemWidth, TabBarMetrics.railIndicatorHeight),
161
- shape = RoundedCornerShape(TabBarMetrics.railIndicatorRadius),
162
- axisX = false,
163
- )
164
- Column {
165
- items.forEachIndexed { index, item ->
166
- Column(
167
- modifier = Modifier
168
- .size(TabBarMetrics.railItemWidth, TabBarMetrics.railItemHeight)
169
- .activeOpacityClickable { onItemClick(index) }
170
- .semantics {
171
- role = Role.Tab
172
- selected = index == selectedIndex
173
- contentDescription = item.label
174
- },
175
- horizontalAlignment = Alignment.CenterHorizontally,
176
- verticalArrangement = Arrangement.Center,
177
- ) {
178
- TabItemContent(item, selected = index == selectedIndex, vertical = true, fixedFontScale = true)
179
- }
180
- }
181
- }
182
- }
183
- }
184
-
185
- // Center action of the rail: round button with its label, under the container.
186
- @Composable
187
- private fun RailCenterAction(data: BottomTabFloatingButton) {
188
- val (interactionSource, pressed) = rememberCenterActionPress()
189
- Column(
190
- modifier = Modifier
191
- .wrapContentWidth(unbounded = true)
192
- .size(TabBarMetrics.railCtaWidth, TabBarMetrics.railCtaHeight)
193
- .clickable(interactionSource = interactionSource, indication = null, onClick = data.onPress)
194
- .setAutomationId(data.label),
195
- horizontalAlignment = Alignment.CenterHorizontally,
196
- verticalArrangement = Arrangement.spacedBy(TabBarMetrics.railCtaLabelGap, Alignment.CenterVertically),
197
- ) {
198
- Box(Modifier.centerActionButton(TabBarMetrics.railCtaSize, pressed), contentAlignment = Alignment.Center) {
199
- data.iconContent?.invoke() ?: Icon(source = data.icon, color = Colors.black_01, size = TabBarMetrics.ctaIconSize)
200
- }
201
- CenterActionLabel(data.label, data.labelContent, vertical = true, fixedFontScale = true)
202
- }
203
- }
@@ -1,108 +0,0 @@
1
- package vn.momo.kits.navigation.bottomtab
2
-
3
- import androidx.compose.animation.core.CubicBezierEasing
4
- import androidx.compose.animation.core.tween
5
- import androidx.compose.ui.graphics.Color
6
- import androidx.compose.ui.graphics.shadow.Shadow
7
- import androidx.compose.ui.unit.Dp
8
- import androidx.compose.ui.unit.DpOffset
9
- import androidx.compose.ui.unit.dp
10
- import vn.momo.kits.const.Radius
11
- import vn.momo.kits.const.Spacing
12
- import vn.momo.kits.platform.getPlatformName
13
-
14
- // Navigation bar measurements (Figma "Specs Navigation", DS-984), mirrored from RN BottomTab/metrics.ts.
15
- // Horizontal: floating container with items split evenly, center action in a notch.
16
- // Vertical: iPhone Duo rail, center action under the container.
17
- internal object TabBarMetrics {
18
- val height = 68.dp
19
- val margin = Spacing.S
20
- val paddingVertical = Spacing.S
21
- val paddingHorizontal = Spacing.M
22
- val itemGap = Spacing.XS
23
- val iconSize = 24.dp
24
- val indicatorHeight = 32.dp
25
- // label_s_medium / label_xs_medium line heights: the label slot keeps this height so a scaled
26
- // label overflows downward instead of pushing the icon up
27
- val labelHeight = 18.dp
28
- val railLabelHeight = 14.dp
29
- // active indicator behind the icon: 24 icon + XS·M padding
30
- val indicatorPaddingHorizontal = Spacing.M
31
- val indicatorRadius = Radius.XL
32
- // home indicator / gesture bar area under the container
33
- val systemIndicatorHeight = 24.dp
34
- // unfolded foldables (short side from 600, the smallest in the spec) use 65% of the short side,
35
- // centered; phones and folded outer displays fill the window
36
- val foldableMinShortSide = 600.dp
37
- const val FOLDABLE_WIDTH_RATIO = 0.65f
38
- val ctaSlotWidth = 92.dp
39
- val ctaSize = 48.dp
40
- // the icon sits 10 inside the 48 button (prototype .cta: 28 icon), 12 inside the 52 rail one
41
- val ctaIconSize = 28.dp
42
- // the button rises 22 above the container top edge
43
- val ctaLift = 22.dp
44
- val ctaLabelGap = Spacing.M
45
- val ctaLabelHeight = 18.dp
46
- val railContainerWidth = 56.dp
47
- val railPaddingHorizontal = Spacing.XS
48
- val railPaddingBottom = Spacing.S
49
- val railItemWidth = 48.dp
50
- val railItemHeight = 62.dp
51
- val railIndicatorHeight = 40.dp
52
- val railIndicatorRadius = 20.dp
53
- val railCtaGap = Spacing.L
54
- val railCtaSize = 52.dp
55
- val railCtaLabelGap = Spacing.XS
56
- val railCtaWidth = 68.dp
57
- val railCtaHeight = 70.dp
58
- val badgeMaxWidth = 58.dp
59
- }
60
-
61
- // Motion of the navigation bar (MoMo Navigation Prototype): one active indicator slides to the
62
- // selected item overshooting a little, icon and label tint cross-fade, the center action shrinks while held.
63
- internal object TabBarMotion {
64
- val indicator = tween<Float>(durationMillis = 550, easing = CubicBezierEasing(0.34f, 1.4f, 0.5f, 1f))
65
- const val TINT_MILLIS = 250
66
- const val CTA_PRESS_MILLIS = 150
67
- const val CTA_PRESSED_SCALE = 0.92f
68
- }
69
-
70
- // Figma Effect/Popover on the center action button.
71
- internal val CtaShadows = listOf(
72
- Shadow(radius = 24.dp, spread = (-12).dp, color = Color.Black, alpha = 0.08f, offset = DpOffset(0.dp, 8.dp)),
73
- Shadow(radius = 32.dp, spread = (-16).dp, color = Color.Black, alpha = 0.04f, offset = DpOffset(0.dp, 12.dp)),
74
- )
75
-
76
- // Inner light and tint of the active indicator: white 12% from below, primary 12% from above.
77
- internal fun indicatorInnerShadows(primary: Color) = listOf(
78
- Shadow(radius = 2.dp, color = Color.White, alpha = 0.12f, offset = DpOffset(0.dp, (-2).dp)),
79
- Shadow(radius = 2.dp, color = primary, alpha = 0.12f, offset = DpOffset(0.dp, 1.dp)),
80
- )
81
-
82
- // Notch dipped into the container top edge under the center action (Figma "Backgroud" path): starts
83
- // NOTCH_HALF_WIDTH left of the center, then cubic segments of control1, control2, end, each point as
84
- // (dx from the center, dy below the top edge) in dp.
85
- internal const val NOTCH_HALF_WIDTH = 50.758f
86
- internal val NOTCH_CURVES = listOf(
87
- listOf(-39.749f to 0f, -31.231f to 9.765f, -24.563f to 18.526f),
88
- listOf(-18.928f to 25.93f, -10.022f to 30.709f, 0f to 30.709f),
89
- listOf(10.022f to 30.709f, 18.928f to 25.93f, 24.563f to 18.526f),
90
- listOf(31.231f to 9.765f, 39.749f to 0f, NOTCH_HALF_WIDTH to 0f),
91
- )
92
-
93
- // Width of the horizontal bar: 65% of the short side on an unfolded foldable, otherwise the window minus
94
- // the side safe areas and margins.
95
- internal fun horizontalBarWidth(width: Dp, height: Dp, insetLeft: Dp, insetRight: Dp): Dp {
96
- val shortSide = minOf(width, height)
97
- if (shortSide >= TabBarMetrics.foldableMinShortSide) return shortSide * TabBarMetrics.FOLDABLE_WIDTH_RATIO
98
- return width - insetLeft - insetRight - TabBarMetrics.margin * 2
99
- }
100
-
101
- // Gap under the container: the home indicator / gesture bar area.
102
- internal fun tabBarBottomGap(navigationBar: Dp): Dp =
103
- (if (getPlatformName() == "iOS") minOf(navigationBar, TabBarMetrics.systemIndicatorHeight) else navigationBar)
104
- .coerceAtLeast(Spacing.S)
105
-
106
- // The center action needs a tab on each side: Special type takes 2 or 4 tabs.
107
- internal fun hasCenterAction(floatingButton: BottomTabFloatingButton?, tabCount: Int): Boolean =
108
- floatingButton != null && tabCount % 2 == 0
@@ -1,169 +0,0 @@
1
- package vn.momo.kits.navigation.component
2
-
3
- import androidx.compose.animation.*
4
- import androidx.compose.animation.core.CubicBezierEasing
5
- import androidx.compose.animation.core.LinearEasing
6
- import androidx.compose.animation.core.animateDpAsState
7
- import androidx.compose.animation.core.tween
8
- import androidx.compose.foundation.ScrollState
9
- import androidx.compose.foundation.background
10
- import androidx.compose.foundation.border
11
- import androidx.compose.foundation.interaction.MutableInteractionSource
12
- import androidx.compose.foundation.layout.*
13
- import androidx.compose.material3.AlertDialogDefaults
14
- import androidx.compose.material3.FloatingActionButton
15
- import androidx.compose.material3.FloatingActionButtonDefaults
16
- import androidx.compose.material3.FloatingActionButtonElevation
17
- import androidx.compose.runtime.*
18
- import androidx.compose.runtime.saveable.rememberSaveable
19
- import androidx.compose.ui.Alignment
20
- import androidx.compose.ui.Modifier
21
- import androidx.compose.ui.graphics.Color
22
- import androidx.compose.ui.unit.Dp
23
- import androidx.compose.ui.unit.dp
24
- import kotlinx.coroutines.delay
25
- import kotlinx.coroutines.flow.MutableStateFlow
26
- import kotlinx.coroutines.flow.collectLatest
27
- import kotlinx.coroutines.launch
28
- import vn.momo.kits.application.IsShowBaseLineDebug
29
- import vn.momo.kits.components.Icon
30
- import vn.momo.kits.components.Text
31
- import vn.momo.kits.const.Colors
32
- import vn.momo.kits.const.Typography
33
- import vn.momo.kits.modifier.conditional
34
- import kotlin.time.Duration.Companion.milliseconds
35
-
36
- enum class FABSize { SMALL, DEFAULT }
37
- enum class FABPosition { END, CENTER }
38
-
39
- data class FloatingButtonProps(
40
- val icon: String,
41
- val iconColor: Color? = null,
42
- val label: String? = null,
43
- val onClick: () -> Unit,
44
- val size: FABSize = FABSize.DEFAULT,
45
- val bottom: Dp? = null,
46
- val scrollState: ScrollState? = null,
47
- val position: FABPosition? = FABPosition.END,
48
- )
49
-
50
- private val FabSmallSize = 36.dp
51
- private val FabDefaultSize = 48.dp
52
- private val FabExpandedWidth = 80.dp
53
- private val FabIconSizeSmall = 12.dp
54
- private val FabIconSizeDefault = 24.dp
55
- private val FabPaddingHorizontal = 12.dp
56
-
57
- @Composable
58
- internal fun FloatingButton(
59
- scrollPosition: Int,
60
- bottom: Dp,
61
- onClick: () -> Unit,
62
- containerColor: Color,
63
- contentColor: Color = containerColor,
64
- icon: String,
65
- iconColor: Color? = null,
66
- text: String? = null,
67
- elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(4.dp),
68
- size: FABSize = FABSize.DEFAULT,
69
- position: FABPosition = FABPosition.END,
70
- keyboardSize: Dp = 0.dp,
71
- ) {
72
- val scrollStateFlow = remember { MutableStateFlow(scrollPosition) }
73
- var lastScrollPosition by rememberSaveable { mutableStateOf(0) }
74
- var isExpanded by rememberSaveable { mutableStateOf(false) }
75
-
76
- val coroutineScope = rememberCoroutineScope()
77
-
78
- // Animations
79
- val baseSize = if (size == FABSize.SMALL) FabSmallSize else FabDefaultSize
80
- val width by animateDpAsState(
81
- targetValue = if (isExpanded && text != null) FabExpandedWidth else baseSize,
82
- animationSpec = tween(100, easing = CubicBezierEasing(0.2f, 0.2f, 0.2f, 0.2f))
83
- )
84
-
85
- // Scroll listener
86
- LaunchedEffect(text) {
87
- if (text != null) {
88
- coroutineScope.launch {
89
- scrollStateFlow.collectLatest { newScroll ->
90
- isExpanded = newScroll <= lastScrollPosition
91
- delay(100.milliseconds)
92
- lastScrollPosition = newScroll
93
- }
94
- }
95
- }
96
- }
97
-
98
- LaunchedEffect(scrollPosition) {
99
- scrollStateFlow.value = scrollPosition
100
- }
101
-
102
- Box(
103
- modifier = Modifier
104
- .fillMaxSize()
105
- .padding(end = 12.dp, bottom = bottom)
106
- .offset(y = -keyboardSize)
107
- .background(Color.Transparent),
108
- contentAlignment = if (position == FABPosition.END) Alignment.BottomEnd else Alignment.BottomCenter,
109
- ) {
110
- FloatingActionButton(
111
- onClick = onClick,
112
- shape = AlertDialogDefaults.shape,
113
- containerColor = containerColor,
114
- contentColor = contentColor,
115
- elevation = elevation,
116
- interactionSource = remember { MutableInteractionSource() },
117
- modifier = Modifier
118
- .sizeIn(minWidth = width)
119
- .height(baseSize)
120
- .conditional(IsShowBaseLineDebug) {
121
- border(1.dp, Colors.blue_03)
122
- }
123
- ) {
124
- Row(
125
- modifier = Modifier.padding(
126
- start = if (isExpanded) FabPaddingHorizontal else 0.dp,
127
- end = if (isExpanded) FabPaddingHorizontal else 0.dp,
128
- ),
129
- verticalAlignment = Alignment.CenterVertically,
130
- horizontalArrangement = if (isExpanded) Arrangement.Start else Arrangement.Center
131
- ) {
132
- Icon(
133
- source = icon,
134
- size = if (size == FABSize.SMALL) FabIconSizeSmall else FabIconSizeDefault,
135
- color = iconColor ?: Color.White
136
- )
137
-
138
- AnimatedVisibility(
139
- visible = isExpanded,
140
- enter = fadeInExpandAnimation,
141
- exit = fadeOutShrinkAnimation,
142
- ) {
143
- Row {
144
- Spacer(Modifier.width(12.dp))
145
- Text(
146
- text = text ?: "",
147
- color = Color.White,
148
- style = Typography.actionDefaultBold
149
- )
150
- }
151
- }
152
- }
153
- }
154
- }
155
- }
156
-
157
- private val fadeOutShrinkAnimation = fadeOut(
158
- animationSpec = tween(100, easing = LinearEasing)
159
- ) + shrinkHorizontally(
160
- animationSpec = tween(100, easing = LinearEasing),
161
- shrinkTowards = Alignment.Start
162
- )
163
-
164
- private val fadeInExpandAnimation = fadeIn(
165
- animationSpec = tween(100, easing = LinearEasing)
166
- ) + expandHorizontally(
167
- animationSpec = tween(100, easing = LinearEasing),
168
- expandFrom = Alignment.Start
169
- )