@momo-kits/native-kits 0.167.1-duo.1-debug → 0.167.1-duo.10

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 (260) hide show
  1. package/CLAUDE.md +32 -0
  2. package/ios/Application/ApplicationEnvironment.swift +17 -0
  3. package/ios/Application/ComposeApi.swift +2 -1
  4. package/ios/Application/{Components.swift → LegacyHeader.swift} +7 -65
  5. package/ios/Application/Screen.swift +3 -2
  6. package/ios/Avatar/Avatar.swift +4 -3
  7. package/ios/Badge/Badge.swift +6 -4
  8. package/ios/Badge/BadgeDot.swift +1 -1
  9. package/ios/Badge/BadgeRibbon.swift +0 -1
  10. package/ios/Button/Button.swift +15 -12
  11. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +64 -18
  12. package/ios/Carousel/Carousel.swift +29 -12
  13. package/ios/Checkbox/Checkbox.swift +7 -3
  14. package/ios/Chip/Chip.swift +5 -4
  15. package/ios/Collapse/Collapse.swift +70 -19
  16. package/ios/Colors+Radius+Spacing/Colors.swift +10 -1
  17. package/ios/DateTimePicker/DateTimePicker.swift +54 -20
  18. package/ios/DateTimePicker/WheelPicker.swift +103 -105
  19. package/ios/Divider/Divider.swift +37 -4
  20. package/ios/Extensions/Color++.swift +38 -9
  21. package/ios/Extensions/OptionalEnvironmentObject.swift +12 -0
  22. package/ios/Extensions/SkeletonUICompat.swift +11 -0
  23. package/ios/Icon/Icon.swift +21 -23
  24. package/ios/Icon/Icons.swift +1329 -0
  25. package/ios/IconButton/IconButton.swift +15 -7
  26. package/ios/Image/Image.swift +7 -23
  27. package/ios/Information/Information.swift +27 -9
  28. package/ios/Input/ErrorView.swift +2 -2
  29. package/ios/Input/Input.swift +160 -147
  30. package/ios/Input/InputPhoneNumber.swift +12 -9
  31. package/ios/Input/InputSearch.swift +102 -75
  32. package/ios/Input/InputTextArea.swift +128 -145
  33. package/ios/InputDropDown/InputDropDown.swift +10 -7
  34. package/ios/InputMoney/InputMoney.swift +33 -11
  35. package/ios/InputOTP/InputOTP.swift +22 -12
  36. package/ios/Layout/Card.swift +50 -0
  37. package/ios/Layout/GridContext.swift +123 -3
  38. package/ios/Layout/Item.swift +5 -4
  39. package/ios/Layout/ScreenLayout.swift +312 -0
  40. package/ios/Layout/Section.swift +4 -100
  41. package/ios/Loader/Loader.swift +5 -9
  42. package/ios/Lottie/LottieView.swift +14 -2
  43. package/ios/{Application/Navigation/Overplay → Navigation}/BottomSheet.swift +97 -8
  44. package/ios/Navigation/BottomTab/BottomTab.swift +187 -0
  45. package/ios/{Application/Navigation → Navigation}/BottomTab/BottomTabBar.swift +15 -7
  46. package/ios/Navigation/BottomTab/DuoBarCompression.swift +105 -0
  47. package/ios/Navigation/BottomTab/DuoTabBar.swift +304 -0
  48. package/ios/{Application → Navigation/Component}/FloatingButton.swift +14 -3
  49. package/ios/Navigation/Component/Header.swift +493 -0
  50. package/ios/Navigation/Component/HeaderBackground.swift +134 -0
  51. package/ios/Navigation/Component/HeaderJourney.swift +73 -0
  52. package/ios/Navigation/Component/HeaderLocation.swift +48 -0
  53. package/ios/Navigation/Component/HeaderRight.swift +386 -0
  54. package/ios/Navigation/Component/HeaderTitle.swift +36 -0
  55. package/ios/{Application/Navigation → Navigation/Component}/HeaderUser.swift +21 -24
  56. package/ios/Navigation/Component/SideBar.swift +176 -0
  57. package/ios/{Application/Navigation/Overplay → Navigation/Component}/SnackBar.swift +5 -5
  58. package/ios/Navigation/HostBackGestureBridge.swift +57 -0
  59. package/ios/{Application/Navigation/Overplay → Navigation}/ModalScreen.swift +5 -1
  60. package/ios/Navigation/Navigation.swift +190 -0
  61. package/ios/{Application/Navigation → Navigation}/NavigationContainer.swift +92 -81
  62. package/ios/{Application/Navigation → Navigation}/Navigator.swift +185 -36
  63. package/ios/Navigation/StackScreen.swift +782 -0
  64. package/ios/{Application/Navigation → Navigation}/Tracking/ScreenTracker.swift +12 -5
  65. package/ios/OTPKeyboard/OTPKeyboard.swift +8 -11
  66. package/ios/Pagination/PaginationScroll.swift +2 -2
  67. package/ios/Popup/PopupDisplay.swift +72 -136
  68. package/ios/Popup/PopupInput.swift +10 -13
  69. package/ios/Popup/PopupLayout.swift +140 -0
  70. package/ios/Popup/PopupNotify.swift +56 -73
  71. package/ios/Popup/PopupPromotion.swift +31 -47
  72. package/ios/PopupView/FullscreenPopup.swift +13 -19
  73. package/ios/PopupView/PopupView.swift +1 -1
  74. package/ios/PopupView/Utils++.swift +0 -8
  75. package/ios/ProgressInfo/ProgressInfo.swift +4 -2
  76. package/ios/Radio/Radio.swift +2 -1
  77. package/ios/Rating/Rating.swift +9 -1
  78. package/ios/Resources/dot_loading.json +558 -0
  79. package/ios/Resources/lottie_circle_loader.json +1 -0
  80. package/ios/ScrollIndicator/ScrollIndicator.swift +11 -10
  81. package/ios/Skeleton/Skeleton.swift +22 -27
  82. package/ios/Slider/Slider.swift +16 -18
  83. package/ios/Stepper/Stepper.swift +6 -1
  84. package/ios/Steps/Steps.swift +8 -6
  85. package/ios/SuggestAction/SuggestAction.swift +5 -0
  86. package/ios/Swipeable/SwipeCell.swift +10 -6
  87. package/ios/Switch/Switch.swift +22 -20
  88. package/ios/TabView/TabView.swift +102 -21
  89. package/ios/Tag/Tag.swift +15 -4
  90. package/ios/Template/Logo/Logo.swift +2 -1
  91. package/ios/Template/TrustBanner/TrustBanner.swift +106 -54
  92. package/ios/Title/Title.swift +6 -17
  93. package/ios/Tooltip/Tooltip.swift +29 -14
  94. package/ios/Typography/Text.swift +61 -19
  95. package/ios/Uploader/Uploader.swift +3 -1
  96. package/ios/native-kits.podspec +2 -1
  97. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  98. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +1 -1
  99. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DuoTabDemo.swift +80 -0
  100. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +1 -0
  101. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IPhoneDuoDemo.swift +173 -0
  102. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +77 -1
  103. package/package.json +1 -1
  104. package/scripts/gen-ios-icons.mjs +36 -0
  105. package/.claude/settings.local.json +0 -185
  106. package/build.gradle.kts +0 -11
  107. package/compose/build.gradle.kts +0 -190
  108. package/compose/build.gradle.kts.backup +0 -190
  109. package/compose/compose.podspec +0 -47
  110. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  111. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  112. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  113. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  114. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -151
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -52
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -124
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -183
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -207
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -39
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -293
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -831
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -110
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -378
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -113
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  139. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  140. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  141. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  142. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  143. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  144. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  145. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  146. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
  147. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -475
  148. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  149. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -266
  150. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -240
  151. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  152. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -264
  153. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  154. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  155. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  156. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  157. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  158. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  159. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  160. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -334
  161. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -98
  162. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -310
  163. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  164. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  165. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  166. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  167. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -323
  168. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  169. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  170. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  171. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -199
  172. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  173. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -552
  174. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -88
  175. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  176. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  177. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  178. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  179. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  180. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  181. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  182. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -234
  183. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -188
  184. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  185. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -16
  186. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +0 -18
  187. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
  188. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  189. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  190. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
  191. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -297
  192. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -52
  193. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -38
  194. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -39
  195. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  196. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  197. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  198. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  199. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  200. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  201. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -299
  202. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  203. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -129
  204. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -106
  205. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -201
  206. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -393
  207. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  208. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -596
  209. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  210. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  211. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -175
  212. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -225
  213. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  214. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  215. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -360
  216. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -83
  217. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  218. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -75
  219. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -309
  220. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -37
  221. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -364
  222. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
  223. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  224. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  225. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
  226. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  227. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -71
  228. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  229. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  230. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  231. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -115
  232. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -40
  233. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  234. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  235. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  236. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  237. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -213
  238. package/gradle/libs.versions.toml +0 -69
  239. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  240. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  241. package/gradle.properties +0 -26
  242. package/gradlew +0 -252
  243. package/gradlew.bat +0 -94
  244. package/ios/Application/HeaderRight.swift +0 -306
  245. package/ios/Application/Navigation/BottomTab/BottomTab.swift +0 -104
  246. package/ios/Application/Navigation/HeaderBackProps.swift +0 -66
  247. package/ios/Application/Navigation/HeaderTitle.swift +0 -57
  248. package/ios/Application/Navigation/NavigationOptions.swift +0 -109
  249. package/ios/Application/Navigation/NavigatorManager.swift +0 -22
  250. package/ios/Application/Navigation/component/Header.swift +0 -178
  251. package/ios/Application/Navigation/component/HeaderBackground.swift +0 -83
  252. package/ios/Application/Navigation/component/HeaderColor.swift +0 -65
  253. package/ios/Application/Navigation/component/HeaderRightWidthKey.swift +0 -11
  254. package/ios/Application/Navigation/component/NavigationFooter.swift +0 -90
  255. package/ios/Application/Navigation/component/NavigationHeaderRight.swift +0 -196
  256. package/ios/Application/StackScreen.swift +0 -492
  257. package/ios-demo/README.md +0 -120
  258. package/local.properties +0 -8
  259. package/settings.gradle.kts +0 -64
  260. /package/ios/{Application/Navigation → Navigation}/BottomTab/CurvedContainer.swift +0 -0
@@ -1,82 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.Box
6
- import androidx.compose.foundation.layout.height
7
- import androidx.compose.foundation.layout.padding
8
- import androidx.compose.foundation.layout.widthIn
9
- import androidx.compose.foundation.shape.RoundedCornerShape
10
- import androidx.compose.runtime.Composable
11
- import androidx.compose.ui.Alignment
12
- import androidx.compose.ui.Modifier
13
- import androidx.compose.ui.graphics.Color
14
- import androidx.compose.ui.text.style.TextOverflow
15
- import androidx.compose.ui.unit.dp
16
- import vn.momo.kits.application.IsShowBaseLineDebug
17
- import vn.momo.kits.const.*
18
- import vn.momo.kits.modifier.conditional
19
-
20
-
21
- @Composable
22
- fun Badge(label: String = "Label", backgroundColor: Color? = null, modifier: Modifier = Modifier) {
23
- val primaryColors = listOf(
24
- Color(0xFFF0F0F0),
25
- Color(0xFFEB2F96),
26
- Color(0xFF962AF0),
27
- Color(0xFF4E4BFF),
28
- Color(0xFF007AFF),
29
- Color(0xFF13C2C2),
30
- Color(0xFF34C759),
31
- Color(0xFFA0D911),
32
- Color(0xFFFFCC00),
33
- Color(0xFFFA8C16),
34
- Color(0xFFFA541C),
35
- Color(0xFFF5222D)
36
- )
37
-
38
- fun isNumber(label: String): Boolean {
39
- val numberRegex = "^\\d+$".toRegex()
40
- return numberRegex.matches(label)
41
- }
42
-
43
- fun formatTitle(label: String): String {
44
- if (isNumber(label) && label.toInt() > 99) {
45
- return "99+"
46
- }
47
- return label
48
- }
49
-
50
- var badgeColor =
51
- if (isNumber(label)) {
52
- AppTheme.current.colors.error.primary
53
- } else {
54
- AppTheme.current.colors.warning.primary
55
- }
56
-
57
- if (backgroundColor != null && primaryColors.contains(backgroundColor)) {
58
- badgeColor = backgroundColor
59
- }
60
- val scaleSize = scaleSize(16f)
61
-
62
- Box(
63
- modifier = modifier
64
- .height(scaleSize.dp)
65
- .widthIn(min = scaleSize.dp)
66
- .background(color = badgeColor, shape = RoundedCornerShape(Radius.M))
67
- .border(width = 1.dp, shape = RoundedCornerShape(Radius.M), color = Colors.black_01)
68
- .conditional(IsShowBaseLineDebug) {
69
- border(1.dp, Colors.blue_03)
70
- }
71
- .padding(horizontal = Spacing.XS),
72
- contentAlignment = Alignment.Center
73
- ) {
74
- Text(
75
- text = formatTitle(label),
76
- color = Colors.black_01,
77
- style = Typography.actionXxsBold,
78
- maxLines = 1,
79
- overflow = TextOverflow.Ellipsis
80
- )
81
- }
82
- }
@@ -1,32 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.Box
6
- import androidx.compose.foundation.layout.size
7
- import androidx.compose.foundation.shape.RoundedCornerShape
8
- import androidx.compose.runtime.Composable
9
- import androidx.compose.ui.Modifier
10
- import androidx.compose.ui.unit.dp
11
- import vn.momo.kits.application.IsShowBaseLineDebug
12
- import vn.momo.kits.const.Colors
13
- import vn.momo.kits.const.Radius
14
- import vn.momo.kits.modifier.conditional
15
-
16
- enum class DotSize(val size: Int) {
17
- Small(10),
18
- Large(16)
19
- }
20
-
21
- @Composable
22
- fun BadgeDot(size: DotSize = DotSize.Large, modifier: Modifier = Modifier) {
23
- Box(
24
- modifier = modifier
25
- .size(size.size.dp)
26
- .border(width = 1.dp, color = Colors.black_01, shape = RoundedCornerShape(Radius.S))
27
- .background(color = Colors.red_03, shape = RoundedCornerShape(Radius.S))
28
- .conditional(IsShowBaseLineDebug) {
29
- border(1.dp, Colors.blue_03)
30
- }
31
- )
32
- }
@@ -1,338 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.Canvas
4
- import androidx.compose.foundation.background
5
- import androidx.compose.foundation.border
6
- import androidx.compose.foundation.layout.Box
7
- import androidx.compose.foundation.layout.Row
8
- import androidx.compose.foundation.layout.height
9
- import androidx.compose.foundation.layout.padding
10
- import androidx.compose.foundation.layout.size
11
- import androidx.compose.foundation.layout.width
12
- import androidx.compose.foundation.shape.RoundedCornerShape
13
- import androidx.compose.runtime.Composable
14
- import androidx.compose.runtime.remember
15
- import androidx.compose.ui.Alignment
16
- import androidx.compose.ui.Modifier
17
- import androidx.compose.ui.geometry.CornerRadius
18
- import androidx.compose.ui.geometry.Offset
19
- import androidx.compose.ui.geometry.Rect
20
- import androidx.compose.ui.geometry.RoundRect
21
- import androidx.compose.ui.geometry.Size
22
- import androidx.compose.ui.graphics.Color
23
- import androidx.compose.ui.graphics.Path
24
- import androidx.compose.ui.graphics.graphicsLayer
25
- import androidx.compose.ui.layout.ContentScale
26
- import androidx.compose.ui.platform.LocalDensity
27
- import androidx.compose.ui.text.rememberTextMeasurer
28
- import androidx.compose.ui.text.style.TextAlign
29
- import androidx.compose.ui.text.style.TextOverflow
30
- import androidx.compose.ui.unit.Dp
31
- import androidx.compose.ui.unit.dp
32
- import androidx.compose.ui.unit.sp
33
- import vn.momo.kits.application.IsShowBaseLineDebug
34
- import vn.momo.kits.const.AppTheme
35
- import vn.momo.kits.const.Colors
36
- import vn.momo.kits.const.Typography
37
- import vn.momo.kits.const.getFontFamily
38
- import vn.momo.kits.const.scaleSize
39
- import vn.momo.kits.modifier.conditional
40
-
41
- @Composable
42
- fun BadgeRibbon(
43
- position: RibbonPosition = RibbonPosition.TopRight,
44
- label: String = "Label",
45
- isRound: Boolean = false,
46
- modifier: Modifier = Modifier,
47
- ) {
48
- val theme = AppTheme.current
49
-
50
- val rotate = if (position == RibbonPosition.TopRight || position == RibbonPosition.BottomRight) 180f else 0f
51
- val useUpTail = position == RibbonPosition.BottomLeft || position == RibbonPosition.TopRight
52
- val verticalAlignment = when(position){
53
- RibbonPosition.TopLeft, RibbonPosition.BottomRight -> Alignment.Top
54
- RibbonPosition.BottomLeft, RibbonPosition.TopRight -> Alignment.Bottom
55
- }
56
-
57
- Row(
58
- modifier = modifier
59
- .height(ribbonHeight)
60
- .conditional(IsShowBaseLineDebug) {
61
- border(1.dp, Colors.blue_03)
62
- }
63
- .graphicsLayer { rotationZ = rotate },
64
- verticalAlignment = verticalAlignment
65
- ) {
66
- if (useUpTail) {
67
- UpTail()
68
- } else {
69
- DownTail()
70
- }
71
-
72
- if (isRound) {
73
- RenderRoundContent(label, rotate, theme.colors.warning.primary)
74
- } else {
75
- RenderSkewContent(label, rotate, theme.colors.warning.primary)
76
- }
77
- }
78
- }
79
-
80
- @Composable
81
- internal fun RenderRoundContent(label: String, rotate: Float, backgroundColor: Color){
82
- Box(
83
- modifier = Modifier
84
- .height(roundHeight)
85
- .background(
86
- color = backgroundColor,
87
- shape = RoundedCornerShape(
88
- topEnd = roundRightRadius,
89
- bottomEnd = roundRightRadius,
90
- )
91
- )
92
- .padding(end = roundPaddingEnd),
93
- contentAlignment = Alignment.Center,
94
- ) {
95
- Label(label, rotate)
96
- }
97
- }
98
-
99
- @Composable
100
- internal fun RenderSkewContent(label: String, rotate: Float, backgroundColor: Color){
101
- Box(
102
- modifier = Modifier
103
- .height(skewBodyHeight)
104
- .background(backgroundColor),
105
- contentAlignment = Alignment.Center
106
- ) {
107
- Label(label, rotate)
108
- }
109
- RightTail()
110
- }
111
-
112
- @Composable
113
- internal fun Label(label: String, rotate: Float){
114
- Text(
115
- text = label,
116
- color = Colors.black_01,
117
- maxLines = 1,
118
- overflow = TextOverflow.Ellipsis,
119
- style = Typography.labelXsMedium,
120
- modifier = Modifier.graphicsLayer { rotationZ = rotate }
121
- )
122
- }
123
-
124
- @Composable
125
- internal fun UpTail() {
126
- Image(
127
- source = "https://static.momocdn.net/app/img/kits/utils/Head_down_4x.png",
128
- modifier = Modifier
129
- .graphicsLayer { rotationZ = 180f }
130
- .width(headTailWidth)
131
- .height(headTailHeight),
132
- options = Options(
133
- contentScale = ContentScale.FillBounds,
134
- )
135
- )
136
- }
137
-
138
- @Composable
139
- internal fun DownTail() {
140
- Image(
141
- source = "https://static.momocdn.net/app/img/kits/utils/Head_4x.png",
142
- modifier = Modifier
143
- .width(headTailWidth)
144
- .height(headTailHeight),
145
- options = Options(
146
- contentScale = ContentScale.FillBounds,
147
- )
148
- )
149
- }
150
-
151
- @Composable
152
- internal fun RightTail() {
153
- Image(
154
- source = "https://static.momocdn.net/app/img/kits/utils/Tail_4x.png",
155
- modifier = Modifier
156
- .width(skewTailWidth)
157
- .height(skewTailHeight),
158
- options = Options(
159
- contentScale = ContentScale.FillBounds,
160
- )
161
- )
162
- }
163
-
164
- @Composable
165
- fun RoundedBadgeRibbon(
166
- text: String = "Label",
167
- position: RibbonPosition = RibbonPosition.TopLeft,
168
- modifier: Modifier = Modifier
169
- ) {
170
- val theme = AppTheme.current
171
- val density = LocalDensity.current
172
- val style = Typography.labelXsMedium
173
- val fontFamily = style.fontFamily
174
-
175
- val scaledFontSize = scaleSize(style.fontSize.value).sp
176
- val fontFamilyResult = getFontFamily(fontFamily?.toString() ?: theme.font, style.fontWeight)
177
-
178
- val fontSize = remember(scaledFontSize) { scaledFontSize }
179
- val font = remember(fontFamilyResult) { fontFamilyResult }
180
- val textMeasurer = rememberTextMeasurer()
181
-
182
- val textLayoutResult = remember(text, fontSize, font) {
183
- textMeasurer.measure(
184
- text = text,
185
- style = style.copy(fontSize = fontSize, fontFamily = font)
186
- )
187
- }
188
-
189
- val textWidth = with(density) { textLayoutResult.size.width.toDp() }
190
- val textHeight = with(density) { textLayoutResult.size.height.toDp() }
191
-
192
- val minRibbonHeight = (textHeight * 1.2f).coerceAtLeast(16.dp)
193
- val padding = minRibbonHeight / 4f
194
- val badgeHeight = minRibbonHeight + padding
195
- val badgeWidth = (textWidth + padding * 2).coerceAtLeast(28.dp)
196
-
197
- val (rotateZ, scaleY, scaleX) = when (position) {
198
- RibbonPosition.TopLeft -> Triple(0f, 1f, -1f)
199
- RibbonPosition.TopRight -> Triple(0f, 1f, 1f)
200
- RibbonPosition.BottomRight -> Triple(0f, -1f, 1f)
201
- RibbonPosition.BottomLeft -> Triple(0f, -1f, -1f)
202
- }
203
-
204
- Box(
205
- modifier = modifier
206
- .size(width = badgeWidth, height = badgeHeight)
207
- .graphicsLayer {
208
- rotationZ = rotateZ
209
- this.scaleY = scaleY
210
- this.scaleX = scaleX
211
- }
212
- ) {
213
- val roundedRect = (badgeHeight - padding) / 2f
214
-
215
- Canvas(modifier = Modifier.matchParentSize()) {
216
- val width = size.width
217
- val height = size.height
218
- val ribbonHeight = height - padding.toPx()
219
- val cornerRadius = roundedRect.toPx()
220
-
221
- val mainColor = Color(0xFFFA541C)
222
- val tailColor = Color(0xFFC41B24)
223
-
224
- val headWidth = 4.dp.toPx()
225
- val leftSectionWidth = width * (9f / 28f)
226
- val middleSectionWidth = width - leftSectionWidth - headWidth
227
- val rightX = leftSectionWidth + middleSectionWidth
228
-
229
- // 1. Tail + 2. BG
230
- val leftMiddlePath = Path().apply {
231
- addRoundRect(
232
- RoundRect(
233
- rect = Rect(
234
- left = 0f,
235
- top = 0f,
236
- right = rightX + 1f,
237
- bottom = ribbonHeight
238
- ),
239
- topLeft = CornerRadius(cornerRadius, cornerRadius),
240
- topRight = CornerRadius.Zero,
241
- bottomRight = CornerRadius.Zero,
242
- bottomLeft = CornerRadius(cornerRadius, cornerRadius)
243
- )
244
- )
245
- }
246
- drawPath(
247
- path = leftMiddlePath,
248
- color = mainColor
249
- )
250
-
251
- // 3. Head
252
- val headPath = Path().apply {
253
- addRoundRect(
254
- RoundRect(
255
- rect = Rect(
256
- left = rightX,
257
- top = 0f,
258
- right = rightX + headWidth,
259
- bottom = ribbonHeight
260
- ),
261
- topLeft = CornerRadius.Zero,
262
- topRight = CornerRadius(cornerRadius, cornerRadius),
263
- bottomRight = CornerRadius.Zero,
264
- bottomLeft = CornerRadius.Zero
265
- )
266
- )
267
- }
268
- drawPath(
269
- path = headPath,
270
- color = mainColor
271
- )
272
-
273
- // Draw bottom tail section
274
- val tailY = ribbonHeight
275
- val tailHeight = padding.toPx()
276
- val halfHeadWidth = headWidth / 2f
277
- val tailStartX = rightX + headWidth - halfHeadWidth
278
-
279
- // Background square (main color)
280
- drawRect(
281
- color = mainColor,
282
- topLeft = Offset(tailStartX, tailY),
283
- size = Size(halfHeadWidth, halfHeadWidth)
284
- )
285
-
286
- val tailRightPath = Path().apply {
287
- addRoundRect(
288
- RoundRect(
289
- rect = Rect(
290
- left = tailStartX,
291
- top = tailY,
292
- right = tailStartX + halfHeadWidth,
293
- bottom = tailY + tailHeight
294
- ),
295
- topLeft = CornerRadius.Zero,
296
- topRight = CornerRadius(tailHeight, tailHeight),
297
- bottomRight = CornerRadius(tailHeight, tailHeight),
298
- bottomLeft = CornerRadius.Zero
299
- )
300
- )
301
- }
302
- drawPath(
303
- path = tailRightPath,
304
- color = tailColor
305
- )
306
- }
307
-
308
- Text(
309
- text = text,
310
- modifier = Modifier
311
- .padding(bottom = padding)
312
- .padding(horizontal = padding / 2)
313
- .align(Alignment.Center)
314
- .graphicsLayer {
315
- rotationZ = rotateZ
316
- this.scaleY = scaleY
317
- this.scaleX = scaleX
318
- },
319
- textAlign = TextAlign.Center,
320
- style = Typography.labelXsMedium,
321
- maxLines = 1,
322
- overflow = TextOverflow.Ellipsis,
323
- color = Colors.black_01
324
- )
325
- }
326
- }
327
-
328
- private val ribbonHeight: Dp = 20.dp
329
- private val roundHeight: Dp = 16.dp
330
- private val skewBodyHeight: Dp = 16.dp
331
- private val roundRightRadius: Dp = 12.dp
332
- private val roundPaddingEnd: Dp = 6.dp
333
- private val skewTailWidth: Dp = 8.dp
334
- private val skewTailHeight: Dp = 16.dp
335
- private val headTailWidth: Dp = 5.dp
336
- private val headTailHeight: Dp = 20.dp
337
-
338
- enum class RibbonPosition {TopLeft, TopRight, BottomLeft, BottomRight}
@@ -1,175 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.Canvas
4
- import androidx.compose.foundation.background
5
- import androidx.compose.foundation.layout.*
6
- import androidx.compose.runtime.Composable
7
- import androidx.compose.ui.Alignment
8
- import androidx.compose.ui.Modifier
9
- import androidx.compose.ui.geometry.Offset
10
- import androidx.compose.ui.graphics.Color
11
- import androidx.compose.ui.graphics.PathEffect
12
- import androidx.compose.ui.graphics.StrokeCap
13
- import androidx.compose.ui.unit.dp
14
- import vn.momo.kits.platform.getPlatformName
15
- import vn.momo.kits.platform.getStatusBarHeight
16
-
17
- @Composable
18
- fun BaselineView(enabled: Boolean = true) {
19
- if (!enabled) return
20
-
21
- val bottomInsetHeight = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding()
22
- val topInset = if (getPlatformName() == "Android") getStatusBarHeight() - 14.dp else getStatusBarHeight()
23
- val bottomInset = if (getPlatformName() == "iOS") minOf(bottomInsetHeight, 21.dp) else bottomInsetHeight
24
-
25
- Box(modifier = Modifier.fillMaxSize()) {
26
- // Danger zones
27
- Box(
28
- modifier = Modifier
29
- .fillMaxWidth()
30
- .height(topInset)
31
- .background(Color.Red.copy(alpha = 0.15f))
32
- )
33
- Box(
34
- modifier = Modifier
35
- .width(12.dp)
36
- .fillMaxHeight()
37
- .padding(top = topInset, bottom = bottomInset)
38
- .background(Color.Red.copy(alpha = 0.15f))
39
- )
40
- Box(
41
- modifier = Modifier
42
- .width(12.dp)
43
- .fillMaxHeight()
44
- .padding(top = topInset, bottom = bottomInset)
45
- .background(Color.Red.copy(alpha = 0.15f))
46
- .align(Alignment.TopEnd)
47
- )
48
- Box(
49
- modifier = Modifier
50
- .fillMaxWidth()
51
- .height(bottomInset)
52
- .background(Color.Red.copy(alpha = 0.15f))
53
- .align(Alignment.BottomCenter)
54
- )
55
-
56
- // Danger lines
57
- BaselineDottedLine(
58
- Modifier
59
- .padding(top = topInset)
60
- .fillMaxWidth(),
61
- isDotted = false,
62
- color = Color(0xFFE400FF)
63
- )
64
- BaselineDottedLine(
65
- Modifier
66
- .padding(top = topInset + 52.dp)
67
- .fillMaxWidth(),
68
- color = Color(0xFFE400FF)
69
- )
70
- BaselineDottedLine(
71
- Modifier
72
- .padding(top = topInset + 104.dp)
73
- .fillMaxWidth(),
74
- color = Color(0xFFE400FF)
75
- )
76
- BaselineDottedLine(
77
- Modifier
78
- .padding(bottom = bottomInset + 64.dp)
79
- .fillMaxWidth()
80
- .align(Alignment.BottomCenter),
81
- color = Color(0xFFE400FF)
82
- )
83
- BaselineDottedLine(
84
- Modifier
85
- .padding(bottom = bottomInset)
86
- .fillMaxWidth()
87
- .align(Alignment.BottomCenter),
88
- isDotted = false,
89
- color = Color(0xFFE400FF)
90
- )
91
- BaselineDottedLine(
92
- Modifier
93
- .padding(start = 12.dp)
94
- .fillMaxHeight(),
95
- orientation = BaselineOrientation.Vertical,
96
- isDotted = false,
97
- color = Color(0xFFE400FF)
98
- )
99
- BaselineDottedLine(
100
- Modifier
101
- .padding(end = 12.dp)
102
- .fillMaxHeight()
103
- .align(Alignment.BottomEnd),
104
- orientation = BaselineOrientation.Vertical,
105
- isDotted = false,
106
- color = Color(0xFFE400FF)
107
- )
108
-
109
- // Warning lines
110
- BaselineDottedLine(
111
- Modifier
112
- .padding(top = topInset + 26.dp)
113
- .fillMaxWidth(),
114
- color = Color(0xFFFF7A00)
115
- )
116
- BaselineDottedLine(
117
- Modifier
118
- .padding(bottom = bottomInset + 56.dp)
119
- .fillMaxWidth()
120
- .align(Alignment.BottomCenter),
121
- color = Color(0xFFFFCC00)
122
- )
123
- BaselineDottedLine(
124
- Modifier
125
- .padding(bottom = bottomInset + 8.dp)
126
- .fillMaxWidth()
127
- .align(Alignment.BottomCenter),
128
- color = Color(0xFFFFCC00)
129
- )
130
-
131
- // Header background warning lines
132
- BaselineDottedLine(
133
- Modifier
134
- .padding(start = 40.dp, top = topInset)
135
- .height(52.dp),
136
- color = Color(0xFF00C520),
137
- orientation = BaselineOrientation.Vertical
138
- )
139
- BaselineDottedLine(
140
- Modifier
141
- .padding(start = 48.dp, top = topInset)
142
- .height(52.dp),
143
- color = Color(0xFF00C520),
144
- orientation = BaselineOrientation.Vertical
145
- )
146
- }
147
- }
148
-
149
- private enum class BaselineOrientation { Horizontal, Vertical }
150
-
151
- @Composable
152
- private fun BaselineDottedLine(
153
- modifier: Modifier = Modifier,
154
- color: Color = Color.Red,
155
- orientation: BaselineOrientation = BaselineOrientation.Horizontal,
156
- isDotted: Boolean = true
157
- ) {
158
- Canvas(modifier = modifier) {
159
- val pathEffect = if (isDotted) PathEffect.dashPathEffect(floatArrayOf(8f, 8f)) else null
160
- drawLine(
161
- color = color,
162
- start = if (orientation == BaselineOrientation.Horizontal) Offset(
163
- 0f,
164
- size.height / 2
165
- ) else Offset(size.width / 2, 0f),
166
- end = if (orientation == BaselineOrientation.Horizontal) Offset(
167
- size.width,
168
- size.height / 2
169
- ) else Offset(size.width / 2, size.height),
170
- strokeWidth = 1.dp.toPx(),
171
- pathEffect = pathEffect,
172
- cap = StrokeCap.Round,
173
- )
174
- }
175
- }