@momo-kits/native-kits 0.169.12-beta.1-debug → 0.169.12-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/HeaderLayout.swift +1 -6
  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 -198
  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/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -61
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1067
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -268
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -81
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -354
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -130
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -482
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -224
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -137
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -473
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -113
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -262
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -237
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -228
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -280
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -183
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -342
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -40
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -82
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -39
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -362
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -304
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -88
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -308
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -218
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -456
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -205
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -89
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -542
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -175
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -201
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -208
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -12
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -291
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +0 -71
  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 -184
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -315
  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 -54
  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 -397
  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 -118
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -206
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -421
  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 -750
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -152
  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 -242
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -398
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -103
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -93
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -208
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +0 -133
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -167
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -446
  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 -400
  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 -197
  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 -7
  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 -21
  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 -117
  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 -65
  135. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -217
  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 -143
  138. package/gradle/libs.versions.toml +0 -67
  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,363 +0,0 @@
1
- package vn.momo.kits.navigation.component
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.*
6
- import androidx.compose.foundation.shape.CircleShape
7
- import androidx.compose.foundation.shape.RoundedCornerShape
8
- import androidx.compose.foundation.text.BasicText
9
- import androidx.compose.foundation.text.TextAutoSize
10
- import androidx.compose.runtime.Composable
11
- import androidx.compose.runtime.Immutable
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.draw.clipToBounds
17
- import androidx.compose.ui.layout.ContentScale
18
- import androidx.compose.ui.text.TextStyle
19
- import androidx.compose.ui.text.font.FontWeight
20
- import androidx.compose.ui.text.style.TextOverflow
21
- import androidx.compose.ui.unit.Dp
22
- import androidx.compose.ui.unit.dp
23
- import androidx.compose.ui.unit.sp
24
- import vn.momo.kits.components.Image
25
- import vn.momo.kits.components.Options
26
- import vn.momo.kits.components.Skeleton
27
- import vn.momo.kits.components.Text
28
- import vn.momo.kits.const.AppTheme
29
- import vn.momo.kits.const.Colors
30
- import vn.momo.kits.const.Spacing
31
- import vn.momo.kits.const.Typography
32
- import vn.momo.kits.const.getFontFamily
33
- import vn.momo.kits.modifier.activeOpacityClickable
34
- import vn.momo.kits.navigation.component.HeaderTitle.User
35
-
36
- @Composable
37
- internal fun HeaderUser(
38
- data: HeaderTitle
39
- ) {
40
- if (data !is User) return
41
-
42
- if (data.isLoading) {
43
- return TitleUserShimmer()
44
- }
45
-
46
- val maxWidth = headerTitleMaxWidth()
47
-
48
- Row(
49
- modifier = Modifier
50
- .fillMaxWidth()
51
- .padding(vertical = Spacing.XS)
52
- .activeOpacityClickable(enabled = data.onPress != null, onClick = { data.onPress?.invoke() }),
53
- horizontalArrangement = Arrangement.SpaceBetween,
54
- verticalAlignment = Alignment.CenterVertically
55
- ) {
56
- Row(
57
- modifier = Modifier.widthIn(max = maxWidth),
58
- verticalAlignment = Alignment.CenterVertically
59
- ) {
60
- Box(modifier = Modifier.size(Spacing.XXL)) {
61
- AvatarGroup(urls = AvatarUrls(data.image ?: listOf()), title = data.title)
62
- if (data.dotColor != null) {
63
- Box(
64
- modifier = Modifier
65
- .align(Alignment.BottomEnd)
66
- .size(10.dp)
67
- .clip(CircleShape)
68
- .background(data.dotColor)
69
- )
70
- }
71
- }
72
-
73
- Spacer(Modifier.width(6.dp))
74
-
75
- Column(modifier = Modifier.weight(1f, fill = false)) {
76
- Row(verticalAlignment = Alignment.CenterVertically) {
77
- Text(
78
- text = data.title,
79
- color = data.tintColor,
80
- style = Typography.actionXsBold,
81
- fontFamily = headerFontFamily,
82
- maxLines = 1,
83
- overflow = TextOverflow.Ellipsis
84
- )
85
- if (data.icons.isNotEmpty()) {
86
- Spacer(Modifier.width(6.dp))
87
- Row(verticalAlignment = Alignment.CenterVertically) {
88
- data.icons.forEach { icon ->
89
- RemoteIcon16(url = icon)
90
- }
91
- }
92
- }
93
- }
94
-
95
- if (!data.subTitle.isNullOrEmpty()) {
96
- Spacer(Modifier.height(2.dp))
97
- Text(
98
- text = data.subTitle,
99
- color = data.tintColor,
100
- style = Typography.descriptionXsRegular,
101
- maxLines = 1,
102
- overflow = TextOverflow.Ellipsis
103
- )
104
- }
105
- }
106
- }
107
- }
108
- }
109
-
110
- @Composable
111
- private fun TitleUserShimmer() {
112
- val theme = AppTheme.current
113
- Row(
114
- modifier = Modifier
115
- .fillMaxWidth()
116
- .padding(vertical = Spacing.XS),
117
- verticalAlignment = Alignment.CenterVertically
118
- ) {
119
- Box(
120
- modifier = Modifier
121
- .size(Spacing.XXL)
122
- .clip(CircleShape)
123
- .background(theme.colors.border.default)
124
- ) {
125
- Skeleton()
126
- }
127
- Spacer(Modifier.width(Spacing.M / 2))
128
- Column(modifier = Modifier.fillMaxWidth()) {
129
- Box(
130
- modifier = Modifier
131
- .height(18.dp)
132
- .width(120.dp)
133
- .clip(RoundedCornerShape(8.dp))
134
- ) { Skeleton() }
135
- Spacer(Modifier.height(Spacing.XXS))
136
- Box(
137
- modifier = Modifier
138
- .height(12.dp)
139
- .width(120.dp)
140
- .clip(RoundedCornerShape(8.dp))
141
- ) { Skeleton() }
142
- }
143
- }
144
- }
145
-
146
- @Composable
147
- private fun AvatarGroup(
148
- urls: AvatarUrls?,
149
- title: String? = null,
150
- size: Dp = Spacing.XXL
151
- ) {
152
- val theme = AppTheme.current
153
- val modifierBorder = remember {
154
- Modifier.clip(CircleShape).border(width = (0.5).dp, color = theme.colors.border.default, shape = CircleShape)
155
- }
156
- val options = Options(
157
- contentScale = ContentScale.Crop,
158
- alignment = Alignment.Center
159
- )
160
-
161
- when (urls?.items?.size) {
162
- 0 -> InitialsAvatar(
163
- modifier = modifierBorder,
164
- name = title ?: "",
165
- fallbackInitials = null,
166
- size = size
167
- )
168
- 1 -> SingleAvatar(options = options, modifier = modifierBorder, urls.items[0], size)
169
- 2 -> TwoAvatar(options = options, modifier = modifierBorder, urls, size)
170
- 3 -> ThreeAvatar(options = options, modifier = modifierBorder, urls, size)
171
- 4 -> FourAvatar(options = options, modifier = modifierBorder, urls, size)
172
- else -> ManyAvatar(options = options, modifier = modifierBorder, urls!!, size)
173
- }
174
- }
175
-
176
- @Composable
177
- private fun SingleAvatar(options: Options, modifier: Modifier = Modifier, url: String, size: Dp) {
178
- Image(
179
- source = url,
180
- options = options,
181
- modifier = modifier
182
- .size(size)
183
- )
184
- }
185
-
186
- @Composable
187
- private fun TwoAvatar(options: Options, modifier: Modifier = Modifier, urls: AvatarUrls, size: Dp) {
188
- val child = 24.dp
189
- Box(modifier = Modifier.size(size)) {
190
- Image(
191
- source = urls.items[0],
192
- options = options,
193
- modifier = modifier
194
- .size(child)
195
- .align(Alignment.TopEnd)
196
- )
197
- Image(
198
- source = urls.items[1],
199
- options = options,
200
- modifier = modifier
201
- .size(child)
202
- .align(Alignment.BottomStart)
203
- )
204
- }
205
- }
206
-
207
- @Composable
208
- private fun ThreeAvatar(options: Options, modifier: Modifier = Modifier, urls: AvatarUrls, size: Dp) {
209
- val child = 16.dp
210
- Box(modifier = Modifier.size(size).padding(2.dp)) {
211
- Image(
212
- source = urls.items[0],
213
- options = options,
214
- modifier = modifier
215
- .size(child)
216
- .align(Alignment.BottomEnd)
217
- )
218
- Image(
219
- source = urls.items[1],
220
- options = options,
221
- modifier = modifier
222
- .size(child)
223
- .align(Alignment.TopCenter)
224
- )
225
- Image(
226
- source = urls.items[2],
227
- options = options,
228
- modifier = modifier
229
- .size(child)
230
- .align(Alignment.BottomStart)
231
- )
232
- }
233
- }
234
-
235
- @Composable
236
- private fun FourAvatar(options: Options, modifier: Modifier = Modifier, urls: AvatarUrls, size: Dp) {
237
- val child = 16.dp
238
- Box(modifier = Modifier.size(size).padding(1.dp)) {
239
- Image(
240
- source = urls.items[0],
241
- options = options,
242
- modifier = modifier
243
- .size(child)
244
- .align(Alignment.BottomStart)
245
- )
246
- Image(
247
- source = urls.items[1],
248
- options = options,
249
- modifier = modifier
250
- .size(child)
251
- .align(Alignment.BottomEnd)
252
- )
253
- Image(
254
- source = urls.items[2],
255
- options = options,
256
- modifier = modifier
257
- .size(child)
258
- .align(Alignment.TopEnd)
259
- )
260
- Image(
261
- source = urls.items[3],
262
- options = options,
263
- modifier = modifier
264
- .size(child)
265
- .align(Alignment.TopStart)
266
- )
267
- }
268
- }
269
-
270
- @Composable
271
- private fun ManyAvatar(options: Options, modifier: Modifier = Modifier, urls: AvatarUrls, size: Dp) {
272
- val child = 16.dp
273
- val more = urls.items.size - 3
274
- Box(modifier = Modifier.size(size).padding(1.dp)) {
275
- Image(
276
- source = urls.items[0],
277
- options = options,
278
- modifier = modifier
279
- .size(child)
280
- .align(Alignment.BottomStart)
281
- )
282
- Image(
283
- source = urls.items[1],
284
- options = options,
285
- modifier = modifier
286
- .size(child)
287
- .align(Alignment.TopEnd)
288
- )
289
- Image(
290
- source = urls.items[2],
291
- options = options,
292
- modifier = modifier
293
- .size(child)
294
- .align(Alignment.TopStart)
295
- )
296
- Box(
297
- modifier = modifier
298
- .size(child)
299
- .align(Alignment.BottomEnd)
300
- .background(Colors.pink_09)
301
- .padding(1.dp)
302
- .clipToBounds(),
303
- contentAlignment = Alignment.Center
304
- ) {
305
- BasicText(
306
- text = "+$more",
307
- style = TextStyle(
308
- color = Colors.pink_03,
309
- fontFamily = getFontFamily(AppTheme.current.font, FontWeight.Normal)
310
- ),
311
- maxLines = 1,
312
- autoSize = TextAutoSize.StepBased(
313
- minFontSize = 1.sp,
314
- maxFontSize = 10.sp,
315
- stepSize = 1.sp
316
- )
317
- )
318
- }
319
- }
320
- }
321
-
322
- @Composable
323
- private fun InitialsAvatar(
324
- modifier: Modifier = Modifier,
325
- name: String,
326
- fallbackInitials: String? = null,
327
- size: Dp = Spacing.XXL
328
- ) {
329
- val initials = remember(name, fallbackInitials) {
330
- fallbackInitials ?: run {
331
- val words = name.trim().split(Regex("\\s+")).takeLast(2)
332
- words.joinToString("") { it.firstOrNull()?.uppercase() ?: "" }
333
- }
334
- }
335
- Box(
336
- modifier = modifier
337
- .size(size)
338
- .background(Colors.pink_09),
339
- contentAlignment = Alignment.Center
340
- ) {
341
- Text(
342
- text = initials,
343
- color = Colors.pink_03,
344
- style = Typography.descriptionXsRegular
345
- )
346
- }
347
- }
348
-
349
- @Composable
350
- private fun RemoteIcon16(url: String) {
351
- Image(
352
- source = url,
353
- options = Options(
354
- contentScale = ContentScale.Crop
355
- ),
356
- modifier = Modifier
357
- .size(16.dp)
358
- .clip(RoundedCornerShape(4.dp)),
359
- )
360
- }
361
-
362
- @Immutable
363
- private data class AvatarUrls(val items: List<String>)
@@ -1,197 +0,0 @@
1
- package vn.momo.kits.navigation.component
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.Arrangement
6
- import androidx.compose.foundation.layout.Box
7
- import androidx.compose.foundation.layout.BoxScope
8
- import androidx.compose.foundation.layout.Column
9
- import androidx.compose.foundation.layout.Row
10
- import androidx.compose.foundation.layout.Spacer
11
- import androidx.compose.foundation.layout.absolutePadding
12
- import androidx.compose.foundation.layout.offset
13
- import androidx.compose.foundation.layout.size
14
- import androidx.compose.foundation.layout.width
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.CompositionLocalProvider
19
- import androidx.compose.runtime.LaunchedEffect
20
- import androidx.compose.ui.AbsoluteAlignment
21
- import androidx.compose.ui.Alignment
22
- import androidx.compose.ui.Modifier
23
- import androidx.compose.ui.draw.clip
24
- import androidx.compose.ui.draw.shadow
25
- import androidx.compose.ui.graphics.Shape
26
- import androidx.compose.ui.layout.layout
27
- import androidx.compose.ui.unit.Dp
28
- import androidx.compose.ui.unit.constrainHeight
29
- import androidx.compose.ui.unit.dp
30
- import vn.momo.kits.components.BadgeDot
31
- import vn.momo.kits.components.DotSize
32
- import vn.momo.kits.components.Icon
33
- import vn.momo.kits.const.Colors
34
- import vn.momo.kits.const.Radius
35
- import vn.momo.kits.const.Spacing
36
- import vn.momo.kits.layout.DuoMetrics
37
- import vn.momo.kits.layout.SideBarEdge
38
- import vn.momo.kits.layout.getScreenLayout
39
- import vn.momo.kits.modifier.activeOpacityClickable
40
- import vn.momo.kits.modifier.conditional
41
- import vn.momo.kits.modifier.setAutomationId
42
- import vn.momo.kits.navigation.LocalNavigator
43
- import vn.momo.kits.navigation.LocalOptions
44
- import vn.momo.kits.navigation.bottomtab.LocalDuoBarCompression
45
-
46
- private val SIDE_BAR_ICON_SIZE = 24.dp
47
-
48
- // iPhone Duo: back and toolkit leave the bar for a column in the side safe area, as the system bars do.
49
- // bottomInset is what footer / tab bar / home indicator take from the bottom, gap included; the column stays above it.
50
- @Composable
51
- internal fun BoxScope.HeaderSideBar(bottomInset: Dp, modifier: Modifier = Modifier) {
52
- val options = LocalOptions.current
53
- val navigator = LocalNavigator.current
54
- val screenLayout = getScreenLayout()
55
- val sideBar = screenLayout.sideBar ?: return
56
- val headerRight = options.headerRight
57
- val toolkit = headerRight as? HeaderRight.Toolkit
58
- // a custom header right also lives in the side column on Duo, where the toolkit does
59
- val hasRight = toolkit != null || headerRight is HeaderRight.Custom
60
- val empty = options.headerType == HeaderType.None || (options.hiddenBack && !hasRight)
61
- val compression = LocalDuoBarCompression.current
62
- val rightHeight = toolkit?.let { toolkitColumnHeight(it) }
63
- ?: if (headerRight is HeaderRight.Custom) DuoMetrics.controlSize else 0.dp
64
- // with the back button hidden the header right rises to the top of the column, so drop the back slot and its gap
65
- val backHeight = if (options.hiddenBack) 0.dp else DuoMetrics.controlSize
66
- val gap = if (!options.hiddenBack && hasRight) Spacing.M else 0.dp
67
- val fullHeight = if (empty) 0.dp else backHeight + gap + (if (hasRight) rightHeight else 0.dp)
68
- LaunchedEffect(fullHeight, compression.setToolbarHeight) { compression.setToolbarHeight(fullHeight) }
69
- if (empty) return
70
-
71
- val headerColor = getHeaderColor(options.headerType, headerOpacity(), options.tintColor, Colors.black_17)
72
- val isRight = sideBar.edge == SideBarEdge.RIGHT
73
-
74
- Column(
75
- modifier = modifier
76
- .align(if (isRight) AbsoluteAlignment.TopRight else AbsoluteAlignment.TopLeft)
77
- .width(sideBar.width)
78
- .layout { measurable, constraints ->
79
- val placeable = measurable.measure(constraints.copy(minHeight = 0))
80
- val maxY = screenLayout.height.roundToPx() - bottomInset.roundToPx() - placeable.height
81
- val y = minOf(sideBar.top.roundToPx(), maxY).coerceAtLeast(0)
82
- layout(placeable.width, constraints.constrainHeight(y + placeable.height)) {
83
- placeable.place(0, y)
84
- }
85
- }
86
- .absolutePadding(left = if (isRight) Spacing.M else 0.dp, right = if (isRight) 0.dp else Spacing.M),
87
- horizontalAlignment = if (isRight) AbsoluteAlignment.Left else AbsoluteAlignment.Right,
88
- verticalArrangement = Arrangement.spacedBy(Spacing.M),
89
- ) {
90
- if (!options.hiddenBack) {
91
- SideBarButton(
92
- icon = "arrow-back",
93
- headerColor = headerColor,
94
- automationId = "btn_navigation_back",
95
- onClick = { navigator.onBackSafe { } },
96
- )
97
- }
98
- when {
99
- !hasRight || compression.toolbarHidden -> Unit
100
- // a custom header right follows the header colors, centered on the control lane so it lines up with the back button
101
- toolkit == null -> CompositionLocalProvider(LocalHeaderColor provides headerColor) {
102
- Box(Modifier.width(DuoMetrics.controlSize), contentAlignment = Alignment.Center) {
103
- HeaderRight(headerRight, options.tintColor, headerColor)
104
- }
105
- }
106
- // HIG "Toolbar compressed": tools fold into one button, distinct from the useMore icon
107
- compression.toolbarCompressed -> SideBarButton(
108
- icon = "navigation_menu",
109
- headerColor = headerColor,
110
- showBadge = toolkit.tools.any { group -> group.items.any { it.showBadge } },
111
- automationId = "btn_navigation_toolbar",
112
- onClick = compression.expandToolbar,
113
- )
114
- else -> Toolkit(
115
- headerRight = toolkit,
116
- tintColor = options.tintColor,
117
- headerColor = headerColor,
118
- layout = ToolkitLayout.SideBarColumn,
119
- )
120
- }
121
- }
122
- }
123
-
124
- @Composable
125
- internal fun SideBarButton(
126
- icon: String,
127
- headerColor: HeaderColor,
128
- onClick: () -> Unit,
129
- enabled: Boolean = true,
130
- showBadge: Boolean = false,
131
- automationId: String? = null,
132
- ) {
133
- Box {
134
- Box(
135
- modifier = Modifier
136
- .size(DuoMetrics.controlSize)
137
- .sideBarGlass(headerColor, CircleShape)
138
- .activeOpacityClickable(enabled = enabled, onClick = onClick)
139
- .conditional(automationId != null) { setAutomationId(automationId.orEmpty()) },
140
- contentAlignment = Alignment.Center,
141
- ) {
142
- Icon(source = icon, size = SIDE_BAR_ICON_SIZE, color = headerColor.tintIconColor)
143
- }
144
- if (showBadge) {
145
- BadgeDot(
146
- size = DotSize.Small,
147
- modifier = Modifier.align(Alignment.TopEnd).offset(x = -Spacing.XXS, y = Spacing.XXS),
148
- )
149
- }
150
- }
151
- }
152
-
153
- // Vertical capsule grouping related side bar controls, one item per 50pt.
154
- @Composable
155
- internal fun SideBarGroup(
156
- headerColor: HeaderColor,
157
- itemCount: Int,
158
- content: @Composable (itemModifier: Modifier) -> Unit,
159
- ) {
160
- val length = if (itemCount > 1) DuoMetrics.itemPitch * itemCount else DuoMetrics.controlSize
161
- val item = length / itemCount.coerceAtLeast(1)
162
- val glass = Modifier.sideBarGlass(headerColor, RoundedCornerShape(Radius.XL))
163
- Column(Modifier.size(width = DuoMetrics.controlSize, height = length).then(glass)) {
164
- content(Modifier.size(width = DuoMetrics.controlSize, height = item))
165
- }
166
- }
167
-
168
- @Composable
169
- internal fun SideBarGroupItem(
170
- icon: String,
171
- headerColor: HeaderColor,
172
- automationId: String,
173
- onClick: () -> Unit,
174
- modifier: Modifier = Modifier,
175
- ) {
176
- Box(
177
- modifier = modifier
178
- .activeOpacityClickable(onClick = onClick)
179
- .setAutomationId(automationId),
180
- contentAlignment = Alignment.Center,
181
- ) {
182
- Icon(source = icon, size = SIDE_BAR_ICON_SIZE, color = headerColor.tintIconColor)
183
- }
184
- }
185
-
186
- // Dark glass under light icons (banner headers), light glass otherwise. The light one is opaque:
187
- // Compose has no backdrop blur and a translucent fill shows its own shadow through (RN uses 85% white).
188
- private fun Modifier.sideBarGlass(headerColor: HeaderColor, shape: Shape): Modifier {
189
- if (headerColor.tintIconColor == Colors.black_01) {
190
- return clip(shape)
191
- .background(Colors.black_20.copy(alpha = 0.5f))
192
- .border(0.5.dp, Colors.black_01.copy(alpha = 0.2f), shape)
193
- }
194
- return shadow(3.dp, shape)
195
- .background(Colors.black_01)
196
- .border(0.5.dp, Colors.black_20.copy(alpha = 0.08f), shape)
197
- }
@@ -1,133 +0,0 @@
1
- package vn.momo.kits.navigation.component
2
-
3
- import androidx.compose.animation.core.Animatable
4
- import androidx.compose.animation.core.tween
5
- import androidx.compose.foundation.border
6
- import androidx.compose.foundation.layout.Box
7
- import androidx.compose.foundation.layout.fillMaxWidth
8
- import androidx.compose.foundation.layout.offset
9
- import androidx.compose.runtime.Composable
10
- import androidx.compose.runtime.DisposableEffect
11
- import androidx.compose.runtime.LaunchedEffect
12
- import androidx.compose.runtime.getValue
13
- import androidx.compose.runtime.mutableStateOf
14
- import androidx.compose.runtime.remember
15
- import androidx.compose.runtime.rememberCoroutineScope
16
- import androidx.compose.runtime.setValue
17
- import androidx.compose.ui.Modifier
18
- import androidx.compose.ui.layout.onGloballyPositioned
19
- import androidx.compose.ui.platform.LocalDensity
20
- import androidx.compose.ui.unit.IntOffset
21
- import androidx.compose.ui.unit.dp
22
- import kotlinx.coroutines.delay
23
- import vn.momo.kits.application.IsShowBaseLineDebug
24
- import vn.momo.kits.const.Colors
25
- import vn.momo.kits.modifier.conditional
26
- import kotlinx.coroutines.launch
27
- import vn.momo.kits.const.AppNavigationBar
28
- import vn.momo.kits.navigation.LocalFooterHeightPx
29
- import vn.momo.kits.navigation.LocalNavigator
30
- import vn.momo.kits.navigation.LocalOptions
31
- import vn.momo.kits.navigation.OverplayComponentRegistry
32
- import kotlin.time.Duration.Companion.milliseconds
33
-
34
- sealed class SnackBar(open val duration: Long? = null) {
35
- data class Custom(
36
- val content: @Composable () -> Unit,
37
- override val duration: Long? = 3000L
38
- ) : SnackBar(duration)
39
-
40
- data class Toast(
41
- override val duration: Long? = 3000L
42
- ) : SnackBar(duration)
43
- }
44
-
45
- @Composable
46
- internal fun SnackBar(
47
- data: SnackBar,
48
- onDismiss: (() -> Unit)?
49
- ) {
50
- val navigator = LocalNavigator.current
51
- val options = LocalOptions.current
52
- val density = LocalDensity.current
53
- val footerHeightPxState = LocalFooterHeightPx.current
54
- val navigationBar = AppNavigationBar.current
55
-
56
- val footerHeight = if (options.footerComponent != null) {
57
- footerHeightPxState.value
58
- } else {
59
- with(density){ navigationBar.toPx() }
60
- }.toInt()
61
-
62
- var startPosition by remember { mutableStateOf(Float.MAX_VALUE) }
63
- val targetPosition = 0f
64
-
65
- var offsetY by remember { mutableStateOf(Animatable(startPosition)) }
66
- val coroutineScope = rememberCoroutineScope()
67
-
68
- suspend fun openEvent() {
69
- offsetY.snapTo(startPosition)
70
- offsetY.animateTo(
71
- targetValue = targetPosition,
72
- animationSpec = tween(
73
- durationMillis = 350,
74
- )
75
- )
76
- }
77
-
78
- fun closeEvent() {
79
- coroutineScope.launch {
80
- offsetY.animateTo(
81
- targetValue = startPosition,
82
- animationSpec = tween(
83
- durationMillis = 200,
84
- )
85
- )
86
- // hideSnackBar() would call clear() -> this close again while still bound
87
- OverplayComponentRegistry.hardClearAfterDismiss()
88
- }
89
- }
90
-
91
- LaunchedEffect(startPosition) {
92
- if (startPosition != Float.MAX_VALUE){
93
- openEvent()
94
- }
95
- }
96
-
97
- LaunchedEffect(data.duration) {
98
- val duration = data.duration
99
- if (duration != null) {
100
- delay(duration.milliseconds)
101
- navigator.hideSnackBar()
102
- }
103
- }
104
-
105
- DisposableEffect(Unit) {
106
- OverplayComponentRegistry.bindClose {
107
- closeEvent()
108
- }
109
- onDispose {
110
- onDismiss?.invoke()
111
- }
112
- }
113
-
114
- Box(
115
- modifier = Modifier
116
- .offset { IntOffset(0, offsetY.value.toInt() - footerHeight) }
117
- .onGloballyPositioned {
118
- if (startPosition != it.size.height.toFloat()) {
119
- startPosition = it.size.height.toFloat()
120
- offsetY = Animatable(startPosition)
121
- }
122
- }
123
- .fillMaxWidth()
124
- .conditional(IsShowBaseLineDebug) {
125
- border(1.dp, Colors.blue_03)
126
- }
127
- ) {
128
- when (data) {
129
- is SnackBar.Custom -> data.content()
130
- is SnackBar.Toast -> {}
131
- }
132
- }
133
- }