@momo-kits/native-kits 0.169.3-beta.1-debug → 0.169.3

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 (141) hide show
  1. package/ios/native-kits.podspec +1 -1
  2. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  3. package/package.json +1 -1
  4. package/build.gradle.kts +0 -11
  5. package/compose/build.gradle.kts +0 -198
  6. package/compose/compose.podspec +0 -47
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -20
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -154
  12. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +0 -17
  13. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1071
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -81
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -195
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -478
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -265
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -265
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -363
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -308
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -330
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -207
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -92
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -560
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -501
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -236
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -17
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -287
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +0 -187
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -316
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -393
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -153
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -113
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -422
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -739
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -239
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -389
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -94
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -97
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -203
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +0 -104
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -455
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -105
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -399
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -192
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -92
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -76
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +0 -7
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -22
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
  126. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
  127. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  128. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  129. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  130. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  131. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -219
  132. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +0 -48
  133. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -144
  134. package/gradle/libs.versions.toml +0 -69
  135. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  136. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  137. package/gradle.properties +0 -24
  138. package/gradlew +0 -252
  139. package/gradlew.bat +0 -94
  140. package/ios-demo/README.md +0 -120
  141. 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,192 +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.LaunchedEffect
19
- import androidx.compose.ui.AbsoluteAlignment
20
- import androidx.compose.ui.Alignment
21
- import androidx.compose.ui.Modifier
22
- import androidx.compose.ui.draw.clip
23
- import androidx.compose.ui.draw.shadow
24
- import androidx.compose.ui.graphics.Shape
25
- import androidx.compose.ui.layout.layout
26
- import androidx.compose.ui.unit.Dp
27
- import androidx.compose.ui.unit.constrainHeight
28
- import androidx.compose.ui.unit.dp
29
- import vn.momo.kits.components.BadgeDot
30
- import vn.momo.kits.components.DotSize
31
- import vn.momo.kits.components.Icon
32
- import vn.momo.kits.const.Colors
33
- import vn.momo.kits.const.Radius
34
- import vn.momo.kits.const.Spacing
35
- import vn.momo.kits.layout.DuoMetrics
36
- import vn.momo.kits.layout.SideBarEdge
37
- import vn.momo.kits.layout.getScreenLayout
38
- import vn.momo.kits.modifier.activeOpacityClickable
39
- import vn.momo.kits.modifier.conditional
40
- import vn.momo.kits.modifier.setAutomationId
41
- import vn.momo.kits.navigation.LocalNavigator
42
- import vn.momo.kits.navigation.LocalOptions
43
- import vn.momo.kits.navigation.bottomtab.LocalDuoBarCompression
44
-
45
- private val SIDE_BAR_ICON_SIZE = 24.dp
46
-
47
- // iPhone Duo: back and toolkit leave the bar for a column in the side safe area, as the system bars do.
48
- // bottomInset is what footer / tab bar / home indicator take from the bottom, gap included; the column stays above it.
49
- @Composable
50
- internal fun BoxScope.HeaderSideBar(bottomInset: Dp, modifier: Modifier = Modifier) {
51
- val options = LocalOptions.current
52
- val navigator = LocalNavigator.current
53
- val screenLayout = getScreenLayout()
54
- val sideBar = screenLayout.sideBar ?: return
55
- val toolkit = options.headerRight as? HeaderRight.Toolkit
56
- val empty = options.headerType == HeaderType.None || (options.hiddenBack && toolkit == null)
57
- val compression = LocalDuoBarCompression.current
58
- val fullHeight = if (empty) 0.dp else DuoMetrics.controlSize + (toolkit?.let { Spacing.M + toolkitColumnHeight(it) } ?: 0.dp)
59
- LaunchedEffect(fullHeight, compression.setToolbarHeight) { compression.setToolbarHeight(fullHeight) }
60
- if (empty) return
61
-
62
- val headerColor = getHeaderColor(options.headerType, headerOpacity(), options.tintColor, Colors.black_17)
63
- val isRight = sideBar.edge == SideBarEdge.RIGHT
64
-
65
- Column(
66
- modifier = modifier
67
- .align(if (isRight) AbsoluteAlignment.TopRight else AbsoluteAlignment.TopLeft)
68
- .width(sideBar.width)
69
- .layout { measurable, constraints ->
70
- val placeable = measurable.measure(constraints.copy(minHeight = 0))
71
- val maxY = screenLayout.height.roundToPx() - bottomInset.roundToPx() - placeable.height
72
- val y = minOf(sideBar.top.roundToPx(), maxY).coerceAtLeast(0)
73
- layout(placeable.width, constraints.constrainHeight(y + placeable.height)) {
74
- placeable.place(0, y)
75
- }
76
- }
77
- .absolutePadding(left = if (isRight) Spacing.M else 0.dp, right = if (isRight) 0.dp else Spacing.M),
78
- horizontalAlignment = if (isRight) AbsoluteAlignment.Left else AbsoluteAlignment.Right,
79
- verticalArrangement = Arrangement.spacedBy(Spacing.M),
80
- ) {
81
- if (options.hiddenBack) {
82
- // keep the slot so the toolkit does not jump between root and pushed screens
83
- Spacer(Modifier.size(DuoMetrics.controlSize))
84
- } else {
85
- SideBarButton(
86
- icon = "arrow-back",
87
- headerColor = headerColor,
88
- automationId = "btn_navigation_back",
89
- onClick = { navigator.onBackSafe { } },
90
- )
91
- }
92
- when {
93
- toolkit == null || compression.toolbarHidden -> Unit
94
- // HIG "Toolbar compressed": tools fold into one button, distinct from the useMore icon
95
- compression.toolbarCompressed -> SideBarButton(
96
- icon = "navigation_menu",
97
- headerColor = headerColor,
98
- showBadge = toolkit.tools.any { group -> group.items.any { it.showBadge } },
99
- automationId = "btn_navigation_toolbar",
100
- onClick = compression.expandToolbar,
101
- )
102
- else -> Toolkit(
103
- headerRight = toolkit,
104
- tintColor = options.tintColor,
105
- headerColor = headerColor,
106
- layout = ToolkitLayout.SideBarColumn,
107
- )
108
- }
109
- }
110
- }
111
-
112
- @Composable
113
- internal fun SideBarButton(
114
- icon: String,
115
- headerColor: HeaderColor,
116
- onClick: () -> Unit,
117
- enabled: Boolean = true,
118
- showBadge: Boolean = false,
119
- automationId: String? = null,
120
- ) {
121
- Box {
122
- Box(
123
- modifier = Modifier
124
- .size(DuoMetrics.controlSize)
125
- .sideBarGlass(headerColor, CircleShape)
126
- .activeOpacityClickable(enabled = enabled, onClick = onClick)
127
- .conditional(automationId != null) { setAutomationId(automationId.orEmpty()) },
128
- contentAlignment = Alignment.Center,
129
- ) {
130
- Icon(source = icon, size = SIDE_BAR_ICON_SIZE, color = headerColor.tintIconColor)
131
- }
132
- if (showBadge) {
133
- BadgeDot(
134
- size = DotSize.Small,
135
- modifier = Modifier.align(Alignment.TopEnd).offset(x = -Spacing.XXS, y = Spacing.XXS),
136
- )
137
- }
138
- }
139
- }
140
-
141
- // Capsule grouping related controls, one item per 50pt: vertical in the side bar, horizontal on a header row.
142
- @Composable
143
- internal fun SideBarGroup(
144
- headerColor: HeaderColor,
145
- itemCount: Int,
146
- horizontal: Boolean = false,
147
- content: @Composable (itemModifier: Modifier) -> Unit,
148
- ) {
149
- val length = if (itemCount > 1) DuoMetrics.itemPitch * itemCount else DuoMetrics.controlSize
150
- val item = length / itemCount.coerceAtLeast(1)
151
- val glass = Modifier.sideBarGlass(headerColor, RoundedCornerShape(Radius.XL))
152
- if (horizontal) {
153
- Row(Modifier.size(width = length, height = DuoMetrics.controlSize).then(glass)) {
154
- content(Modifier.size(width = item, height = DuoMetrics.controlSize))
155
- }
156
- } else {
157
- Column(Modifier.size(width = DuoMetrics.controlSize, height = length).then(glass)) {
158
- content(Modifier.size(width = DuoMetrics.controlSize, height = item))
159
- }
160
- }
161
- }
162
-
163
- @Composable
164
- internal fun SideBarGroupItem(
165
- icon: String,
166
- headerColor: HeaderColor,
167
- automationId: String,
168
- onClick: () -> Unit,
169
- modifier: Modifier = Modifier,
170
- ) {
171
- Box(
172
- modifier = modifier
173
- .activeOpacityClickable(onClick = onClick)
174
- .setAutomationId(automationId),
175
- contentAlignment = Alignment.Center,
176
- ) {
177
- Icon(source = icon, size = SIDE_BAR_ICON_SIZE, color = headerColor.tintIconColor)
178
- }
179
- }
180
-
181
- // Dark glass under light icons (banner headers), light glass otherwise. The light one is opaque:
182
- // Compose has no backdrop blur and a translucent fill shows its own shadow through (RN uses 85% white).
183
- private fun Modifier.sideBarGlass(headerColor: HeaderColor, shape: Shape): Modifier =
184
- if (headerColor.tintIconColor == Colors.black_01) {
185
- clip(shape)
186
- .background(Colors.black_20.copy(alpha = 0.5f))
187
- .border(0.5.dp, Colors.black_01.copy(alpha = 0.2f), shape)
188
- } else {
189
- shadow(3.dp, shape)
190
- .background(Colors.black_01)
191
- .border(0.5.dp, Colors.black_20.copy(alpha = 0.08f), shape)
192
- }
@@ -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
- }