@momo-kits/native-kits 0.162.3-debug → 0.162.3-fontscale.1

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 (168) hide show
  1. package/.codegraph/.gitignore +5 -0
  2. package/CLAUDE.md +78 -0
  3. package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +32 -0
  4. package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  5. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  6. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +16 -0
  7. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
  8. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
  9. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
  10. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
  11. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
  12. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
  13. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
  14. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +58 -0
  15. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +58 -0
  16. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +60 -0
  17. package/ios/Application/Components.swift +1 -0
  18. package/ios/Application/FloatingButton.swift +1 -0
  19. package/ios/Badge/Badge.swift +1 -0
  20. package/ios/Badge/BadgeRibbon.swift +2 -0
  21. package/ios/Button/Button.swift +1 -1
  22. package/ios/Checkbox/Checkbox.swift +1 -0
  23. package/ios/Information/Information.swift +151 -0
  24. package/ios/Input/Input.swift +1 -0
  25. package/ios/Input/InputPhoneNumber.swift +1 -0
  26. package/ios/Input/InputSearch.swift +3 -0
  27. package/ios/Input/InputTextArea.swift +1 -0
  28. package/ios/OTPKeyboard/KeyboardButton.swift +1 -1
  29. package/ios/Popup/PopupDisplay.swift +6 -0
  30. package/ios/Popup/PopupInput.swift +2 -0
  31. package/ios/Template/TrustBanner/TrustBanner.swift +2 -0
  32. package/ios/Typography/Text.swift +1 -0
  33. package/ios/Typography/Typography.swift +14 -5
  34. package/package.json +1 -1
  35. package/build.gradle.kts +0 -11
  36. package/compose/build.gradle.kts +0 -186
  37. package/compose/build.gradle.kts.backup +0 -186
  38. package/compose/compose.podspec +0 -47
  39. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  40. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -123
  41. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  42. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  43. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  44. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  45. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  46. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  47. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  48. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  49. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  50. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  51. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  52. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  53. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  54. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -109
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -305
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -921
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -121
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -403
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -87
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -340
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -198
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -123
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -94
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -136
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -224
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -148
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -188
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -116
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -452
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -172
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -255
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -233
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -259
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -241
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -92
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -352
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -103
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -338
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -70
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -17
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -96
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -348
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -256
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -494
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -131
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -215
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -96
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -531
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -92
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -135
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -214
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -590
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -177
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -192
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -205
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -239
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -285
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -57
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -14
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -50
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -253
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -133
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -104
  139. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -145
  140. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -345
  141. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  142. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -556
  143. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -161
  144. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -243
  145. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  146. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -187
  147. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -315
  148. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
  149. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
  150. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -34
  151. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -370
  152. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -131
  153. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -167
  154. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -72
  155. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -66
  156. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  157. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -70
  158. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  159. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -105
  160. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -33
  161. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -186
  162. package/gradle/libs.versions.toml +0 -67
  163. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  164. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  165. package/gradle.properties +0 -26
  166. package/gradlew +0 -252
  167. package/gradlew.bat +0 -94
  168. package/settings.gradle.kts +0 -64
@@ -1,177 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.clickable
6
- import androidx.compose.foundation.layout.Arrangement
7
- import androidx.compose.foundation.layout.Column
8
- import androidx.compose.foundation.layout.Row
9
- import androidx.compose.foundation.layout.fillMaxWidth
10
- import androidx.compose.foundation.layout.height
11
- import androidx.compose.foundation.layout.padding
12
- import androidx.compose.foundation.layout.width
13
- import androidx.compose.foundation.shape.RoundedCornerShape
14
- import androidx.compose.runtime.Composable
15
- import androidx.compose.ui.Alignment
16
- import androidx.compose.ui.Modifier
17
- import androidx.compose.ui.draw.clip
18
- import androidx.compose.ui.graphics.Color
19
- import androidx.compose.ui.layout.ContentScale
20
- import androidx.compose.ui.unit.dp
21
- import vn.momo.kits.application.AppConfig
22
- import vn.momo.kits.application.AppLanguage
23
- import vn.momo.kits.application.IsShowBaseLineDebug
24
- import vn.momo.kits.const.Colors
25
- import vn.momo.kits.const.Typography
26
- import vn.momo.kits.modifier.conditional
27
- import vn.momo.kits.modifier.noFeedbackClickable
28
-
29
- val defaultBanner = TrustBannerData(
30
- content = mapOf(
31
- "vi" to "An toàn tài sản & Bảo mật thông tin của bạn là ưu tiên hàng đầu của MoMo.",
32
- "en" to "Ensuring financial security and data privacy is MoMo's highest priority."
33
- ),
34
- subContent = mapOf(
35
- "vi" to "Tìm hiểu thêm",
36
- "en" to "Learn more"
37
- ),
38
- pciImage = "https://static.momocdn.net/app/img/kits/trustBanner/pci_dss.png",
39
- sslImage = "https://static.momocdn.net/app/img/kits/trustBanner/ssl.png",
40
- urlConfig = "login_and_security",
41
- icons = listOf(
42
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png",
43
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_agribank.png",
44
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png",
45
- "https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png"
46
- ),
47
- momoImage = "https://static.momocdn.net/app/img/kits/trustBanner/ic_secu.png"
48
- )
49
-
50
- const val backgroundBlue = 0xFFF2F8FF
51
- const val contentColor = 0xFF484848
52
- const val subContentColor = 0xFFEB2F96
53
-
54
- data class TrustBannerData(
55
- val content: Map<String, String> = mapOf("vi" to "", "en" to ""),
56
- val subContent: Map<String, String> = mapOf("vi" to "", "en" to ""),
57
- val pciImage: String? = null,
58
- val momoImage: String? = null,
59
- val sslImage: String? = null,
60
- val icons: List<String>? = null,
61
- val urlConfig: String = ""
62
- )
63
-
64
- @Composable
65
- fun TrustBanner(
66
- serviceName: String = "",
67
- screenName: String = "",
68
- onPress: ((Map<String, String>) -> Unit)? = null,
69
- trackEvent: ((String, Map<String, String>) -> Unit)? = null
70
- ) {
71
- val appConfig = AppConfig.current
72
- val language = AppLanguage.current ?: "vi"
73
- val trustBanner = appConfig?.trustBanner ?: defaultBanner
74
- val trackParams = mapOf(
75
- "service_name" to serviceName,
76
- "screen_name" to screenName,
77
- "component_name" to "logo_trust",
78
- "url_config" to trustBanner.urlConfig
79
- )
80
-
81
- Row(
82
- modifier = Modifier
83
- .clip(RoundedCornerShape(12.dp))
84
- .background(color = Color(backgroundBlue))
85
- .conditional(IsShowBaseLineDebug) {
86
- border(1.dp, Colors.blue_03)
87
- }
88
- .padding(12.dp)
89
- .then(
90
- if (onPress != null) {
91
- Modifier.clickable {
92
- trackEvent?.invoke(
93
- "service_component_clicked", trackParams
94
- )
95
-
96
- onPress(
97
- mapOf(
98
- "service_name" to serviceName,
99
- "screen_name" to screenName,
100
- "url_config" to trustBanner.urlConfig,
101
- )
102
- )
103
-
104
- }
105
- } else {
106
- Modifier.noFeedbackClickable {
107
- trackEvent?.invoke(
108
- "service_component_clicked", trackParams
109
- )
110
- }
111
- }
112
- )
113
- ) {
114
- if (trustBanner.momoImage != null) {
115
- Image(
116
- source = trustBanner.momoImage,
117
- modifier = Modifier
118
- .width(64.dp)
119
- .height(64.dp)
120
- )
121
- }
122
- Column(
123
- modifier = Modifier
124
- .padding(start = 10.dp)
125
- ) {
126
- Text(
127
- text = trustBanner.content[language] ?: "",
128
- modifier = Modifier.padding(bottom = 8.dp),
129
- color = Color(contentColor),
130
- style = Typography.descriptionDefaultRegular,
131
- maxLines = 2
132
- )
133
- Row(
134
- modifier = Modifier.fillMaxWidth(),
135
- horizontalArrangement = Arrangement.SpaceBetween
136
- ) {
137
- Row(
138
- verticalAlignment = Alignment.CenterVertically,
139
- ) {
140
- Text(
141
- text = trustBanner.subContent[language] ?: "",
142
- color = Color(subContentColor),
143
- style = Typography.actionXsBold,
144
- maxLines = 2
145
- )
146
- Icon(
147
- source = "https://img.mservice.io/momo_app_v2/new_version/img/appx_icon/16_arrow_chevron_right_small.png",
148
- color = Color(subContentColor),
149
- )
150
- }
151
- Row {
152
- if (trustBanner.pciImage != null) {
153
- Image(
154
- source = trustBanner.pciImage, modifier = Modifier
155
- .padding(end = 4.dp)
156
- .width(27.dp)
157
- .height(20.dp), options = Options(
158
- contentScale = ContentScale.Fit,
159
- )
160
- )
161
- }
162
- if (trustBanner.sslImage != null) {
163
- Image(
164
- source = trustBanner.sslImage, modifier = Modifier
165
- .width(52.dp)
166
- .height(20.dp),
167
- options = Options(
168
- contentScale = ContentScale.Fit,
169
- )
170
- )
171
- }
172
-
173
- }
174
- }
175
- }
176
- }
177
- }
@@ -1,192 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.horizontalScroll
6
- import androidx.compose.foundation.layout.Arrangement
7
- import androidx.compose.foundation.layout.Box
8
- import androidx.compose.foundation.layout.Column
9
- import androidx.compose.foundation.layout.Row
10
- import androidx.compose.foundation.layout.fillMaxSize
11
- import androidx.compose.foundation.layout.padding
12
- import androidx.compose.foundation.layout.size
13
- import androidx.compose.foundation.rememberScrollState
14
- import androidx.compose.foundation.shape.RoundedCornerShape
15
- import androidx.compose.runtime.Composable
16
- import androidx.compose.runtime.remember
17
- import androidx.compose.ui.Alignment
18
- import androidx.compose.ui.Modifier
19
- import androidx.compose.ui.draw.clip
20
- import androidx.compose.ui.draw.drawBehind
21
- import androidx.compose.ui.geometry.CornerRadius
22
- import androidx.compose.ui.graphics.Color
23
- import androidx.compose.ui.graphics.PathEffect
24
- import androidx.compose.ui.graphics.drawscope.Stroke
25
- import androidx.compose.ui.unit.Dp
26
- import androidx.compose.ui.unit.dp
27
- import vn.momo.kits.application.IsShowBaseLineDebug
28
- import vn.momo.kits.const.AppTheme
29
- import vn.momo.kits.const.Colors
30
- import vn.momo.kits.const.Radius
31
- import vn.momo.kits.const.Spacing
32
- import vn.momo.kits.const.Typography
33
- import vn.momo.kits.modifier.activeOpacityClickable
34
- import vn.momo.kits.modifier.conditional
35
-
36
- data class UploadImage(
37
- val uri: String? = null,
38
- val loading: Boolean = false,
39
- )
40
-
41
- @Composable
42
- fun Uploader(
43
- images: List<UploadImage>,
44
- modifier: Modifier = Modifier,
45
- numberOfImages: Int = 1,
46
- disabled: Boolean = false,
47
- width: Dp = 64.dp,
48
- height: Dp = 64.dp,
49
- onAdd: () -> Unit = {},
50
- onCancel: ((image: UploadImage, index: Int) -> Unit)? = null,
51
- onPressImage: (image: UploadImage, index: Int) -> Unit = { _, _ -> },
52
- ) {
53
- val shouldShowPicker = remember(images.size, numberOfImages) {
54
- images.size < numberOfImages
55
- }
56
-
57
- Row(
58
- modifier = modifier
59
- .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
60
- horizontalArrangement = Arrangement.spacedBy(Spacing.S),
61
- verticalAlignment = Alignment.Top,
62
- ) {
63
- if (shouldShowPicker) {
64
- UploaderPickerCell(
65
- disabled = disabled,
66
- width = width,
67
- height = height,
68
- onAdd = onAdd,
69
- )
70
- }
71
-
72
- Row(
73
- modifier = Modifier.horizontalScroll(rememberScrollState()),
74
- horizontalArrangement = Arrangement.spacedBy(Spacing.S),
75
- ) {
76
- images.forEachIndexed { index, image ->
77
- UploaderImageItem(
78
- image = image,
79
- width = width,
80
- height = height,
81
- index = index,
82
- onCancel = onCancel,
83
- onPressImage = { onPressImage(image, index) },
84
- )
85
- }
86
- }
87
- }
88
- }
89
-
90
- @Composable
91
- private fun UploaderPickerCell(
92
- disabled: Boolean,
93
- width: Dp,
94
- height: Dp,
95
- onAdd: () -> Unit,
96
- ) {
97
- val theme = AppTheme.current
98
- val mainColor = if (disabled) theme.colors.text.disable else theme.colors.text.hint
99
- val borderColor = if (disabled) theme.colors.border.disable else theme.colors.border.default
100
-
101
- Box(
102
- modifier = Modifier
103
- .size(width = width, height = height)
104
- .clip(RoundedCornerShape(Radius.XS))
105
- .dashedBorder(color = borderColor, radius = Radius.XS)
106
- .activeOpacityClickable(enabled = !disabled, onClick = onAdd),
107
- contentAlignment = Alignment.Center,
108
- ) {
109
- Column(
110
- horizontalAlignment = Alignment.CenterHorizontally,
111
- verticalArrangement = Arrangement.spacedBy(Spacing.XXS),
112
- ) {
113
- Icon(
114
- source = "16_navigation_plus",
115
- color = mainColor,
116
- size = 16.dp,
117
- )
118
- Text(
119
- text = "Thêm hình",
120
- style = Typography.descriptionXsRegular,
121
- color = mainColor,
122
- )
123
- }
124
- }
125
- }
126
-
127
- @Composable
128
- private fun UploaderImageItem(
129
- image: UploadImage,
130
- width: Dp,
131
- height: Dp,
132
- index: Int,
133
- onCancel: ((image: UploadImage, index: Int) -> Unit)?,
134
- onPressImage: () -> Unit,
135
- ) {
136
- Box(
137
- modifier = Modifier
138
- .size(width = width, height = height)
139
- .activeOpacityClickable(onClick = onPressImage),
140
- ) {
141
- Image(
142
- source = image.uri ?: "",
143
- modifier = Modifier
144
- .fillMaxSize()
145
- .clip(RoundedCornerShape(Radius.XS)),
146
- )
147
-
148
- if (onCancel != null && !image.loading) {
149
- Icon(
150
- source = "navigation_close_circle_full",
151
- size = 16.dp,
152
- color = null,
153
- modifier = Modifier
154
- .align(Alignment.TopEnd)
155
- .padding(top = Spacing.XXS, end = Spacing.XXS)
156
- .activeOpacityClickable { onCancel(image, index) },
157
- )
158
- }
159
-
160
- if (image.loading) {
161
- Box(
162
- modifier = Modifier
163
- .fillMaxSize()
164
- .clip(RoundedCornerShape(Radius.XS))
165
- .background(Color(0x66FFFFFF)),
166
- contentAlignment = Alignment.Center,
167
- ) {
168
- Skeleton()
169
- }
170
- }
171
- }
172
- }
173
-
174
- private fun Modifier.dashedBorder(
175
- color: Color,
176
- radius: Dp,
177
- strokeWidth: Dp = 1.dp,
178
- dashWidth: Float = 10f,
179
- dashGap: Float = 6f,
180
- ): Modifier = this.drawBehind {
181
- val strokePx = strokeWidth.toPx()
182
- val pathEffect = PathEffect.dashPathEffect(floatArrayOf(dashWidth, dashGap), 0f)
183
- val cornerRadiusPx = radius.toPx()
184
- drawRoundRect(
185
- color = color,
186
- style = Stroke(
187
- width = strokePx,
188
- pathEffect = pathEffect,
189
- ),
190
- cornerRadius = CornerRadius(cornerRadiusPx, cornerRadiusPx),
191
- )
192
- }
@@ -1,205 +0,0 @@
1
- package vn.momo.kits.components.datetimepicker
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.Column
6
- import androidx.compose.foundation.layout.Row
7
- import androidx.compose.foundation.layout.Spacer
8
- import androidx.compose.foundation.layout.fillMaxWidth
9
- import androidx.compose.foundation.layout.height
10
- import androidx.compose.foundation.layout.padding
11
- import androidx.compose.foundation.layout.width
12
- import androidx.compose.runtime.Composable
13
- import androidx.compose.runtime.LaunchedEffect
14
- import androidx.compose.runtime.getValue
15
- import androidx.compose.runtime.mutableStateOf
16
- import androidx.compose.runtime.remember
17
- import androidx.compose.runtime.setValue
18
- import androidx.compose.runtime.snapshotFlow
19
- import androidx.compose.ui.Alignment
20
- import androidx.compose.ui.Modifier
21
- import androidx.compose.ui.unit.dp
22
- import kotlinx.coroutines.flow.collect
23
- import kotlinx.coroutines.flow.mapNotNull
24
- import kotlinx.coroutines.flow.onEach
25
- import kotlinx.datetime.LocalDateTime
26
- import kotlinx.datetime.number
27
- import vn.momo.kits.application.IsShowBaseLineDebug
28
- import vn.momo.kits.components.Text
29
- import vn.momo.kits.const.AppTheme
30
- import vn.momo.kits.const.Colors
31
- import vn.momo.kits.const.Spacing
32
- import vn.momo.kits.const.Typography
33
- import vn.momo.kits.modifier.conditional
34
-
35
- private val datePickerHeight = 210.dp
36
- private val datePickerWithLabelsHeight = 238.dp
37
-
38
- @Composable
39
- fun DateTimePicker(
40
- modifier: Modifier = Modifier,
41
- format: String = "DD-MM-YYYY",
42
- minuteInterval: Int = 1,
43
- onChange: (LocalDateTime) -> Unit,
44
- selectedValue: LocalDateTime? = null,
45
- minDate: LocalDateTime? = null,
46
- maxDate: LocalDateTime? = null,
47
- arrayLabelTime: List<String> = emptyList()
48
- ) {
49
- val effectiveSelectedValue = remember(selectedValue) {
50
- selectedValue ?: getCurrentDateTime()
51
- }
52
-
53
- val effectiveMinDate = remember(minDate) {
54
- minDate ?: createRelativeDate(-10)
55
- }
56
-
57
- val effectiveMaxDate = remember(maxDate) {
58
- maxDate ?: createRelativeDate(10)
59
- }
60
-
61
- val needCheckRange = remember(minDate, maxDate) {
62
- minDate == null && maxDate == null
63
- }
64
-
65
- val initialValue = remember(effectiveMinDate, effectiveMaxDate, effectiveSelectedValue) {
66
- when {
67
- !needCheckRange -> effectiveSelectedValue
68
- effectiveSelectedValue < effectiveMinDate -> effectiveMinDate
69
- effectiveSelectedValue > effectiveMaxDate -> effectiveMaxDate
70
- else -> effectiveSelectedValue
71
- }
72
- }
73
-
74
- var currentDate by remember(initialValue) {
75
- mutableStateOf(
76
- PickerData(
77
- day = initialValue.dayOfMonth,
78
- month = initialValue.month.number,
79
- year = initialValue.year,
80
- hour = initialValue.hour,
81
- minute = initialValue.minute
82
- )
83
- )
84
- }
85
-
86
- val onWheelChangeValue = remember(currentDate, effectiveMinDate, effectiveMaxDate) {
87
- { name: String, value: String ->
88
- var day = if (name == "day") value.toInt() else currentDate.day
89
- var month = if (name == "month") value.toInt() else currentDate.month
90
- val year = if (name == "year") value.toInt() else currentDate.year
91
- val hour = if (name == "hour") value.toInt() else currentDate.hour
92
- val minute = if (name == "minute") value.toInt() else currentDate.minute
93
- val timeMode = if (name == "timeMode") value else currentDate.timeMode
94
- if (name == "year") {
95
- month = when (year) {
96
- effectiveMaxDate.year -> month.coerceIn(
97
- 1,
98
- effectiveMaxDate.monthNumber
99
- )
100
- effectiveMinDate.year -> month.coerceIn(
101
- effectiveMinDate.monthNumber,
102
- 12,
103
- )
104
- else -> month
105
- }
106
- }
107
- if (name == "month" || name == "year") {
108
- val maxDayOfMonth = when (month) {
109
- 4, 6, 9, 11 -> 30
110
- 2 -> if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) 29 else 28
111
- else -> 31
112
- }
113
-
114
- day = when {
115
- year == effectiveMaxDate.year && month == effectiveMaxDate.monthNumber ->
116
- day.coerceIn(1, effectiveMaxDate.dayOfMonth)
117
-
118
- year == effectiveMinDate.year && month == effectiveMinDate.monthNumber ->
119
- day.coerceIn(effectiveMinDate.dayOfMonth, maxDayOfMonth)
120
-
121
- day > maxDayOfMonth -> maxDayOfMonth
122
- else -> day
123
- }
124
- }
125
- currentDate = PickerData(
126
- day = day,
127
- month = month,
128
- year = year,
129
- hour = hour,
130
- minute = minute,
131
- timeMode = timeMode,
132
- )
133
- }
134
- }
135
-
136
- LaunchedEffect(effectiveMinDate, effectiveMaxDate) {
137
- snapshotFlow { currentDate }
138
- .mapNotNull {
139
- val dateTime = it.toLocalDateTime()
140
- if (!needCheckRange || dateTime in effectiveMinDate..effectiveMaxDate) dateTime
141
- else null
142
- }
143
- .onEach(onChange)
144
- .collect()
145
- }
146
-
147
- val pickerHeight = if (arrayLabelTime.isNotEmpty())
148
- datePickerWithLabelsHeight else
149
- datePickerHeight
150
-
151
- Row(
152
- modifier = modifier
153
- .fillMaxWidth()
154
- .height(pickerHeight)
155
- .background(AppTheme.current.colors.background.surface)
156
- .conditional(IsShowBaseLineDebug) {
157
- border(1.dp, Colors.blue_03)
158
- }
159
- .padding(horizontal = Spacing.M),
160
- verticalAlignment = Alignment.CenterVertically
161
- ) {
162
- val dateComponents = getDateComponents(
163
- format,
164
- currentDate,
165
- effectiveMinDate,
166
- effectiveMaxDate,
167
- minuteInterval,
168
- )
169
- dateComponents.forEachIndexed { index, component ->
170
- val hasLabel = index < arrayLabelTime.size && arrayLabelTime[index].isNotEmpty()
171
-
172
- Column(
173
- horizontalAlignment = Alignment.CenterHorizontally,
174
- modifier = Modifier.weight(1f)
175
- ) {
176
- if (hasLabel) {
177
- Text(
178
- text = arrayLabelTime[index],
179
- style = Typography.actionSBold,
180
- modifier = Modifier.padding(bottom = Spacing.S)
181
- )
182
- }
183
-
184
- WheelPicker(
185
- name = component.name,
186
- data = component.data,
187
- selectedData = when (component.name) {
188
- "day" -> paddingNum(currentDate.day)
189
- "month" -> paddingNum(currentDate.month)
190
- "year" -> currentDate.year.toString()
191
- "hour" -> paddingNum(currentDate.hour)
192
- "minute" -> paddingNum(currentDate.minute)
193
- "timeMode" -> currentDate.timeMode
194
- else -> ""
195
- },
196
- onChange = onWheelChangeValue,
197
- )
198
- }
199
-
200
- if (index < dateComponents.size - 1) {
201
- Spacer(modifier = Modifier.width(Spacing.M))
202
- }
203
- }
204
- }
205
- }
@@ -1,29 +0,0 @@
1
- package vn.momo.kits.components.datetimepicker
2
-
3
- import kotlinx.datetime.LocalDateTime
4
-
5
- data class PickerData(
6
- var day: Int,
7
- var month: Int,
8
- var year: Int,
9
- var hour: Int = 0,
10
- var minute: Int = 0,
11
- var timeMode: String = ""
12
- ) {
13
- fun toLocalDateTime(): LocalDateTime {
14
- return LocalDateTime(
15
- year = year,
16
- monthNumber = month,
17
- dayOfMonth = day,
18
- hour = hour,
19
- minute = minute,
20
- second = 0,
21
- nanosecond = 0
22
- )
23
- }
24
- }
25
-
26
- data class DateComponent(
27
- val name: String,
28
- val data: List<String>
29
- )