@momo-kits/native-kits 0.163.1-beta.2 → 0.163.1-beta.20-debug

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 (345) hide show
  1. package/.claude/settings.local.json +112 -0
  2. package/CLAUDE.md +1 -1
  3. package/build.gradle.kts +11 -0
  4. package/compose/build.gradle.kts +190 -0
  5. package/compose/build.gradle.kts.backup +190 -0
  6. package/compose/compose.podspec +47 -0
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +150 -0
  10. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  11. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  12. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  23. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +52 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +106 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +183 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +207 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +39 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +293 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +826 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +110 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +378 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +82 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +356 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +113 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +542 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +231 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +112 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +477 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +214 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +240 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +216 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +259 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +182 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +328 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +97 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +310 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +323 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +217 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +199 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +470 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +88 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +131 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +203 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +175 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +234 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +188 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +188 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +276 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +52 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +38 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +39 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +299 -0
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +129 -0
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +100 -0
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +172 -0
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +372 -0
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +581 -0
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +156 -0
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +225 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +320 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +81 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +309 -0
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +34 -0
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +360 -0
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +127 -0
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +91 -0
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +69 -0
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +105 -0
  133. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
  134. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
  135. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +207 -0
  136. package/gradle/libs.versions.toml +69 -0
  137. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  138. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  139. package/gradle.properties +26 -0
  140. package/gradlew +252 -0
  141. package/gradlew.bat +94 -0
  142. package/ios/Application/ApplicationEnvironment.swift +15 -3
  143. package/ios/Application/Components.swift +36 -30
  144. package/ios/Application/FloatingButton.swift +10 -9
  145. package/ios/Application/Localize.swift +309 -0
  146. package/ios/Application/MaxApi.swift +18 -0
  147. package/ios/Application/Navigation/BottomTab/BottomTab.swift +104 -0
  148. package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
  149. package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
  150. package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
  151. package/ios/Application/Navigation/HeaderTitle.swift +57 -0
  152. package/ios/Application/Navigation/HeaderUser.swift +209 -0
  153. package/ios/Application/Navigation/NavigationContainer.swift +203 -0
  154. package/ios/Application/Navigation/NavigationOptions.swift +109 -0
  155. package/ios/Application/Navigation/Navigator.swift +385 -0
  156. package/ios/Application/Navigation/Overplay/BottomSheet.swift +256 -0
  157. package/ios/Application/Navigation/Overplay/ModalScreen.swift +74 -0
  158. package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
  159. package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
  160. package/ios/Application/Navigation/component/Header.swift +178 -0
  161. package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
  162. package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
  163. package/ios/Application/Navigation/component/HeaderRightWidthKey.swift +11 -0
  164. package/ios/Application/Navigation/component/NavigationHeaderRight.swift +196 -0
  165. package/ios/Application/Screen.swift +2 -1
  166. package/ios/Application/StackScreen.swift +501 -0
  167. package/ios/Avatar/Avatar.swift +193 -0
  168. package/ios/Badge/Badge.swift +11 -14
  169. package/ios/Badge/BadgeRibbon.swift +91 -17
  170. package/ios/BaselineView/BaselineView.swift +163 -0
  171. package/ios/Button/Button.swift +137 -28
  172. package/ios/Carousel/Carousel.swift +196 -0
  173. package/ios/Checkbox/Checkbox.swift +23 -28
  174. package/ios/Chip/Chip.swift +56 -33
  175. package/ios/Collapse/Collapse.swift +192 -0
  176. package/ios/Colors+Radius+Spacing/Colors.swift +20 -17
  177. package/ios/Colors+Radius+Spacing/Spacing.swift +3 -1
  178. package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
  179. package/ios/DateTimePicker/DateTimePicker.swift +212 -0
  180. package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
  181. package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
  182. package/ios/DateTimePicker/WheelPicker.swift +165 -0
  183. package/ios/Divider/Divider.swift +16 -0
  184. package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
  185. package/ios/Extensions/Color++.swift +32 -0
  186. package/ios/Icon/Icon.swift +10 -1
  187. package/ios/IconButton/IconButton.swift +140 -0
  188. package/ios/Image/Image.swift +16 -3
  189. package/ios/Information/Information.swift +3 -1
  190. package/ios/Input/ErrorView.swift +3 -1
  191. package/ios/Input/Input.swift +72 -33
  192. package/ios/Input/InputPhoneNumber.swift +33 -21
  193. package/ios/Input/InputSearch.swift +107 -48
  194. package/ios/Input/InputTextArea.swift +134 -64
  195. package/ios/InputDropDown/InputDropDown.swift +201 -0
  196. package/ios/InputMoney/InputMoney.swift +347 -0
  197. package/ios/InputOTP/InputOTP.swift +210 -0
  198. package/ios/Loader/Loader.swift +113 -0
  199. package/ios/MoMoUIKits.podspec +5 -0
  200. package/ios/Pagination/PaginationDot.swift +61 -0
  201. package/ios/Pagination/PaginationNumber.swift +35 -0
  202. package/ios/Pagination/PaginationScroll.swift +101 -0
  203. package/ios/Pagination/PaginationWhiteDot.swift +37 -0
  204. package/ios/Popup/PopupDisplay.swift +11 -20
  205. package/ios/Popup/PopupInput.swift +2 -8
  206. package/ios/Popup/PopupNotify.swift +218 -0
  207. package/ios/Popup/PopupPromotion.swift +5 -3
  208. package/ios/ProgressInfo/ProgressInfo.swift +296 -0
  209. package/ios/Radio/Radio.swift +69 -0
  210. package/ios/Rating/Rating.swift +82 -0
  211. package/ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json +11 -0
  212. package/ios/Resources/MoMoUIKitsColors.xcassets/Background.colorset/Contents.json +38 -0
  213. package/ios/Resources/MoMoUIKitsColors.xcassets/Border.colorset/Contents.json +38 -0
  214. package/ios/Resources/MoMoUIKitsColors.xcassets/Card.colorset/Contents.json +38 -0
  215. package/ios/Resources/MoMoUIKitsColors.xcassets/Contents.json +6 -0
  216. package/ios/Resources/MoMoUIKitsColors.xcassets/Error.colorset/Contents.json +38 -0
  217. package/ios/Resources/MoMoUIKitsColors.xcassets/Primary.colorset/Contents.json +38 -0
  218. package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryDark.colorset/Contents.json +38 -0
  219. package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryLight.colorset/Contents.json +38 -0
  220. package/ios/Resources/MoMoUIKitsColors.xcassets/Secondary.colorset/Contents.json +38 -0
  221. package/ios/Resources/MoMoUIKitsColors.xcassets/Success.colorset/Contents.json +38 -0
  222. package/ios/Resources/MoMoUIKitsColors.xcassets/Text.colorset/Contents.json +38 -0
  223. package/ios/Resources/MoMoUIKitsColors.xcassets/TextSecondary.colorset/Contents.json +38 -0
  224. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +9 -0
  225. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +38 -0
  226. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +38 -0
  227. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +38 -0
  228. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +38 -0
  229. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +38 -0
  230. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +38 -0
  231. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +38 -0
  232. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +38 -0
  233. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +38 -0
  234. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +38 -0
  235. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +38 -0
  236. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +38 -0
  237. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +38 -0
  238. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +38 -0
  239. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +38 -0
  240. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +38 -0
  241. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +38 -0
  242. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +38 -0
  243. package/ios/Resources/MoMoUIKitsColors.xcassets/Warning.colorset/Contents.json +38 -0
  244. package/ios/Skeleton/Skeleton.swift +99 -0
  245. package/ios/Slider/Slider.swift +237 -0
  246. package/ios/Stepper/Stepper.swift +220 -0
  247. package/ios/Steps/Steps.swift +467 -0
  248. package/ios/SuggestAction/SuggestAction.swift +99 -0
  249. package/ios/Swipeable/SwipeCell.swift +187 -0
  250. package/ios/Swipeable/SwipeCellModel.swift +21 -0
  251. package/ios/Switch/Switch.swift +53 -28
  252. package/ios/TabView/TabView.swift +534 -0
  253. package/ios/Tag/Tag.swift +98 -0
  254. package/ios/Template/TrustBanner/TrustBanner.swift +7 -8
  255. package/ios/Title/Title.swift +269 -0
  256. package/ios/Tooltip/Tooltip.swift +485 -0
  257. package/ios/Typography/FontScaleStore.swift +19 -0
  258. package/ios/Typography/Text.swift +86 -17
  259. package/ios/Typography/Typography.swift +12 -14
  260. package/ios/Uploader/Uploader.swift +174 -0
  261. package/ios/native-kits.podspec +61 -8
  262. package/ios-demo/MoMoUIKitsDemo.podspec +20 -0
  263. package/ios-demo/README.md +120 -0
  264. package/ios-demo/Resources/dot_loading.json +558 -0
  265. package/ios-demo/Resources/icon.json +4052 -0
  266. package/ios-demo/Resources/lottie_circle_loader.json +1 -0
  267. package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
  268. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
  269. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
  270. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
  271. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
  272. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
  273. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
  274. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
  275. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
  276. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
  277. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +24 -0
  278. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
  279. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +93 -0
  280. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +269 -0
  281. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
  282. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
  283. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +100 -0
  284. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +126 -0
  285. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +64 -0
  286. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +20 -0
  287. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +93 -0
  288. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
  289. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +124 -0
  290. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +14 -0
  291. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
  292. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +279 -0
  293. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +58 -0
  294. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +78 -0
  295. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +138 -0
  296. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +111 -0
  297. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +136 -0
  298. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +107 -0
  299. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +73 -0
  300. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +100 -0
  301. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +32 -0
  302. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +57 -0
  303. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +70 -0
  304. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +188 -0
  305. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +229 -0
  306. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +72 -0
  307. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
  308. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +121 -0
  309. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +76 -0
  310. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +89 -0
  311. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +32 -0
  312. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +56 -0
  313. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +32 -0
  314. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +150 -0
  315. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +138 -0
  316. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +103 -0
  317. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +94 -0
  318. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +79 -0
  319. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +152 -0
  320. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +33 -0
  321. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +190 -0
  322. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +34 -0
  323. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +182 -0
  324. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +109 -0
  325. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +187 -0
  326. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
  327. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +131 -0
  328. package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +51 -0
  329. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
  330. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
  331. package/local.properties +8 -0
  332. package/package.json +1 -1
  333. package/publish.sh +53 -0
  334. package/scripts/gen-ios-color.mjs +136 -0
  335. package/settings.gradle.kts +64 -0
  336. package/example/ios/Example.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  337. package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  338. package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
  339. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
  340. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
  341. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
  342. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
  343. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
  344. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -46
  345. package/ios/Application/FontScaleStore.swift +0 -59
@@ -0,0 +1,51 @@
1
+ package vn.momo.kits.modifier
2
+
3
+ import androidx.compose.runtime.Composable
4
+ import androidx.compose.runtime.State
5
+ import androidx.compose.ui.Modifier
6
+ import androidx.compose.ui.layout.Measurable
7
+ import androidx.compose.ui.layout.MeasureResult
8
+ import androidx.compose.ui.layout.MeasureScope
9
+ import androidx.compose.ui.node.LayoutModifierNode
10
+ import androidx.compose.ui.node.ModifierNodeElement
11
+ import androidx.compose.ui.unit.Constraints
12
+ import androidx.compose.ui.unit.IntOffset
13
+
14
+ @Composable
15
+ fun Modifier.dynamicSize(
16
+ widthState: State<Int>? = null,
17
+ heightState: State<Int>? = null,
18
+ ) = this then DynamicSizeElement(widthState, heightState)
19
+
20
+ private data class DynamicSizeElement(
21
+ val widthState: State<Int>?,
22
+ val heightState: State<Int>?,
23
+ ) : ModifierNodeElement<DynamicSizeNode>() {
24
+ override fun create(): DynamicSizeNode {
25
+ return DynamicSizeNode(widthState, heightState)
26
+ }
27
+
28
+ override fun update(node: DynamicSizeNode) {
29
+ node.widthState = widthState
30
+ node.heightState = heightState
31
+ }
32
+
33
+ }
34
+
35
+ private class DynamicSizeNode(
36
+ var widthState: State<Int>?,
37
+ var heightState: State<Int>?,
38
+ ) : Modifier.Node(), LayoutModifierNode {
39
+ override fun MeasureScope.measure(
40
+ measurable: Measurable,
41
+ constraints: Constraints
42
+ ): MeasureResult {
43
+ val p = measurable.measure(constraints)
44
+ return layout(
45
+ width = widthState?.value ?: p.width,
46
+ height = heightState?.value ?: p.height,
47
+ ) {
48
+ p.place(IntOffset.Zero)
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,299 @@
1
+ package vn.momo.kits.navigation
2
+
3
+ import androidx.compose.animation.core.Animatable
4
+ import androidx.compose.animation.core.CubicBezierEasing
5
+ import androidx.compose.animation.core.tween
6
+ import androidx.compose.foundation.background
7
+ import androidx.compose.foundation.border
8
+ import androidx.compose.foundation.gestures.detectDragGestures
9
+ import androidx.compose.foundation.layout.Box
10
+ import androidx.compose.foundation.layout.BoxWithConstraints
11
+ import androidx.compose.foundation.layout.Column
12
+ import androidx.compose.foundation.layout.Row
13
+ import androidx.compose.foundation.layout.Spacer
14
+ import androidx.compose.foundation.layout.fillMaxHeight
15
+ import androidx.compose.foundation.layout.fillMaxSize
16
+ import androidx.compose.foundation.layout.fillMaxWidth
17
+ import androidx.compose.foundation.layout.height
18
+ import androidx.compose.foundation.layout.heightIn
19
+ import androidx.compose.foundation.layout.offset
20
+ import androidx.compose.foundation.layout.padding
21
+ import androidx.compose.foundation.layout.size
22
+ import androidx.compose.foundation.layout.width
23
+ import androidx.compose.foundation.shape.RoundedCornerShape
24
+ import androidx.compose.runtime.Composable
25
+ import androidx.compose.runtime.DisposableEffect
26
+ import androidx.compose.runtime.LaunchedEffect
27
+ import androidx.compose.runtime.remember
28
+ import androidx.compose.runtime.rememberCoroutineScope
29
+ import androidx.compose.ui.Alignment
30
+ import androidx.compose.ui.Modifier
31
+ import androidx.compose.ui.graphics.Brush
32
+ import androidx.compose.ui.graphics.Color
33
+ import androidx.compose.ui.input.pointer.pointerInput
34
+ import androidx.compose.ui.platform.LocalDensity
35
+ import androidx.compose.ui.unit.IntOffset
36
+ import androidx.compose.ui.unit.dp
37
+ import kotlinx.coroutines.launch
38
+ import vn.momo.kits.components.Divider
39
+ import vn.momo.kits.components.Icon
40
+ import vn.momo.kits.components.Text
41
+ import vn.momo.kits.const.AppTheme
42
+ import vn.momo.kits.const.Colors
43
+ import vn.momo.kits.const.Radius
44
+ import vn.momo.kits.const.Spacing
45
+ import vn.momo.kits.application.LocalContext
46
+ import vn.momo.kits.application.IsShowBaseLineDebug
47
+ import vn.momo.kits.const.AppNavigationBar
48
+ import vn.momo.kits.const.Typography
49
+ import vn.momo.kits.navigation.tracking.ScreenTracker
50
+ import vn.momo.kits.modifier.conditional
51
+ import vn.momo.kits.modifier.noFeedbackClickable
52
+ import vn.momo.kits.platform.BackHandler
53
+ import vn.momo.kits.platform.getScreenHeight
54
+
55
+ @Composable
56
+ internal fun BottomSheet(
57
+ content: @Composable () -> Unit,
58
+ header: BottomHeader,
59
+ isSurface: Boolean = false,
60
+ barrierDismissible: Boolean = true,
61
+ draggable: Boolean = true,
62
+ useBottomInset: Boolean = true,
63
+ footerComponent: (@Composable () -> Unit)? = null,
64
+ onDismiss: (() -> Unit)?
65
+ ) {
66
+ val screenHeightDp = getScreenHeight()
67
+ val screenHeightPx = with(LocalDensity.current) { screenHeightDp.toPx() }
68
+ val sheetOffset = remember { Animatable(screenHeightPx) }
69
+
70
+ val backgroundAlpha = remember { Animatable(0f) }
71
+ val dynamicAlpha = ((1f - (sheetOffset.value / screenHeightPx)).coerceIn(0f, 1f)) * 0.3f
72
+ val alpha = backgroundAlpha.value + dynamicAlpha
73
+
74
+ val sheetCloseOffset = with(LocalDensity.current) { 100.dp.toPx() }
75
+
76
+ val coroutineScope = rememberCoroutineScope()
77
+
78
+ val maxApi = LocalMaxApi.current
79
+ val context = LocalContext.current
80
+
81
+ DisposableEffect(Unit) {
82
+ ScreenTracker.trackPopupDisplayed(
83
+ maxApi = maxApi,
84
+ context = context,
85
+ parentScreenName = ScreenTracker.getLastScreenName()
86
+ )
87
+ onDispose { }
88
+ }
89
+
90
+ suspend fun openEvent(){
91
+ backgroundAlpha.animateTo(
92
+ targetValue = 0.3f,
93
+ animationSpec = tween(
94
+ durationMillis = 100,
95
+ easing = CubicBezierEasing(0.05f, 0.7f, 0.1f, 1f)
96
+ )
97
+ )
98
+ sheetOffset.animateTo(
99
+ targetValue = 0f,
100
+ animationSpec = tween(
101
+ durationMillis = 350,
102
+ easing = CubicBezierEasing(0.05f, 0.7f, 0.1f, 1f)
103
+ )
104
+ )
105
+ }
106
+
107
+ fun closeEvent(){
108
+ coroutineScope.launch {
109
+ sheetOffset.animateTo(
110
+ targetValue = screenHeightPx,
111
+ animationSpec = tween(
112
+ durationMillis = 200,
113
+ easing = CubicBezierEasing(0.3f, 0.0f, 0.8f, 0.15f)
114
+ )
115
+ )
116
+ backgroundAlpha.animateTo(
117
+ targetValue = 0f,
118
+ animationSpec = tween(
119
+ durationMillis = 100,
120
+ easing = CubicBezierEasing(0.3f, 0.0f, 0.8f, 0.15f)
121
+ )
122
+ )
123
+ OverplayComponentRegistry.hardClearAfterDismiss()
124
+ }
125
+ }
126
+
127
+ LaunchedEffect(Unit) {
128
+ openEvent()
129
+ }
130
+
131
+ DisposableEffect(Unit) {
132
+ OverplayComponentRegistry.bindClose { closeEvent() }
133
+ onDispose {
134
+ onDismiss?.invoke()
135
+ }
136
+ }
137
+
138
+ BackHandler(true){
139
+ closeEvent()
140
+ }
141
+
142
+ BoxWithConstraints(
143
+ modifier = Modifier
144
+ .fillMaxSize()
145
+ .background(Color.Black.copy(alpha = alpha))
146
+ .noFeedbackClickable {
147
+ if(barrierDismissible) closeEvent()
148
+ }
149
+ ) {
150
+ val parentHeight = with(LocalDensity.current) { constraints.maxHeight.toDp() }
151
+
152
+ Box(
153
+ modifier = Modifier
154
+ .align(Alignment.BottomCenter)
155
+ .offset { IntOffset(x = 0, y = sheetOffset.value.toInt()) }
156
+ .fillMaxWidth()
157
+ .heightIn(max = parentHeight - 90.dp)
158
+ .background(
159
+ color = if (isSurface) AppTheme.current.colors.background.surface else AppTheme.current.colors.background.default,
160
+ shape = RoundedCornerShape(topStart = Radius.M, topEnd = Radius.M)
161
+ )
162
+ .conditional(IsShowBaseLineDebug) {
163
+ border(1.dp, Colors.blue_03)
164
+ }
165
+ .noFeedbackClickable { },
166
+ contentAlignment = Alignment.BottomCenter
167
+ ) {
168
+ val bottomInset = if (useBottomInset) {
169
+ (AppNavigationBar.current - keyboardSizeState().value).coerceAtLeast(0.dp)
170
+ } else 0.dp
171
+ Column(Modifier.padding(bottom = bottomInset)) {
172
+ Box(
173
+ modifier = Modifier
174
+ .height(72.dp)
175
+ .fillMaxWidth()
176
+ .conditional(draggable) {
177
+ pointerInput(Unit) {
178
+ detectDragGestures(
179
+ onDrag = { change, dragAmount ->
180
+ change.consume()
181
+ coroutineScope.launch {
182
+ val newOffset = (sheetOffset.value + dragAmount.y).coerceAtLeast(0f)
183
+ sheetOffset.snapTo(newOffset)
184
+ }
185
+ },
186
+ onDragEnd = {
187
+ coroutineScope.launch {
188
+ if (sheetOffset.value > sheetCloseOffset) {
189
+ closeEvent()
190
+ } else {
191
+ sheetOffset.animateTo(0f)
192
+ }
193
+ }
194
+ }
195
+ )
196
+ }
197
+ }
198
+ ) {
199
+ Column(
200
+ modifier = Modifier
201
+ .fillMaxSize()
202
+ .padding(horizontal = Spacing.M),
203
+ horizontalAlignment = Alignment.CenterHorizontally
204
+ ) {
205
+ Spacer(Modifier.height(8.dp))
206
+ Box(
207
+ modifier = Modifier
208
+ .height(4.dp)
209
+ .width(40.dp)
210
+ .background(
211
+ color = Colors.black_06,
212
+ shape = RoundedCornerShape(Radius.S)
213
+ )
214
+ )
215
+ Spacer(Modifier.height(4.dp))
216
+ Box(Modifier.fillMaxWidth().height(56.dp), contentAlignment = Alignment.Center){
217
+ when (header) {
218
+ is BottomHeader.Title -> {
219
+ Row(modifier = Modifier.fillMaxSize(), verticalAlignment = Alignment.CenterVertically) {
220
+ Box(Modifier.size(24.dp))
221
+ Box(Modifier.fillMaxHeight().weight(1f), contentAlignment = Alignment.Center){
222
+ Text(
223
+ text = header.data,
224
+ color = Colors.black_17,
225
+ style = Typography.headerDefaultBold
226
+ )
227
+ }
228
+ Box(Modifier
229
+ .size(24.dp)
230
+ .noFeedbackClickable {
231
+ closeEvent()
232
+ },
233
+ contentAlignment = Alignment.Center
234
+ ){
235
+ Icon(source = "navigation_close")
236
+ }
237
+ }
238
+ }
239
+ is BottomHeader.Custom -> {
240
+ header.content()
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }
246
+ Divider()
247
+ if (footerComponent != null) {
248
+ Box(Modifier.weight(1f, fill = false)) {
249
+ content()
250
+ }
251
+ BottomSheetFooter(footerComponent)
252
+ } else {
253
+ content()
254
+ }
255
+ }
256
+ }
257
+ }
258
+ }
259
+
260
+ @Composable
261
+ private fun BottomSheetFooter(footerComponent: @Composable () -> Unit) {
262
+ val shadowBrush = remember {
263
+ Brush.verticalGradient(
264
+ colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.05f))
265
+ )
266
+ }
267
+
268
+ Box {
269
+ Box(
270
+ Modifier
271
+ .fillMaxWidth()
272
+ .background(AppTheme.current.colors.background.surface)
273
+ .conditional(IsShowBaseLineDebug) {
274
+ border(1.dp, Colors.blue_03)
275
+ }
276
+ .padding(vertical = Spacing.S)
277
+ ) {
278
+ footerComponent()
279
+ }
280
+
281
+ Box(
282
+ modifier = Modifier
283
+ .fillMaxWidth()
284
+ .height(6.dp)
285
+ .offset(x = 0.dp, y = (-6).dp)
286
+ .background(shadowBrush)
287
+ )
288
+ }
289
+ }
290
+
291
+ sealed class BottomHeader {
292
+ data class Title(
293
+ val data: String = "Bottom Sheet Title",
294
+ ) : BottomHeader()
295
+
296
+ data class Custom(
297
+ val content: @Composable () -> Unit
298
+ ) : BottomHeader()
299
+ }
@@ -0,0 +1,129 @@
1
+ package vn.momo.kits.navigation
2
+
3
+ import androidx.compose.animation.core.Animatable
4
+ import androidx.compose.animation.core.CubicBezierEasing
5
+ import androidx.compose.animation.core.tween
6
+ import androidx.compose.foundation.background
7
+ import androidx.compose.foundation.border
8
+ import androidx.compose.foundation.clickable
9
+ import androidx.compose.foundation.interaction.MutableInteractionSource
10
+ import androidx.compose.foundation.layout.Box
11
+ import androidx.compose.foundation.layout.fillMaxSize
12
+ import androidx.compose.foundation.layout.wrapContentSize
13
+ import androidx.compose.runtime.*
14
+ import androidx.compose.ui.Alignment
15
+ import androidx.compose.ui.Modifier
16
+ import androidx.compose.ui.draw.alpha
17
+ import androidx.compose.ui.draw.scale
18
+ import androidx.compose.ui.graphics.Color
19
+ import androidx.compose.ui.unit.dp
20
+ import kotlinx.coroutines.launch
21
+ import vn.momo.kits.application.LocalContext
22
+ import vn.momo.kits.application.IsShowBaseLineDebug
23
+ import vn.momo.kits.const.Colors
24
+ import vn.momo.kits.modifier.conditional
25
+ import vn.momo.kits.modifier.noFeedbackClickable
26
+ import vn.momo.kits.navigation.tracking.ScreenTracker
27
+ import vn.momo.kits.platform.BackHandler
28
+
29
+ @Composable
30
+ internal fun ModalScreen(
31
+ content: @Composable () -> Unit,
32
+ barrierDismissible: Boolean = true,
33
+ onDismiss: (() -> Unit)? = null
34
+ ) {
35
+ val navigator = LocalNavigator.current
36
+
37
+ val alpha = remember { Animatable(0f) }
38
+ val scale = remember { Animatable(0.8f) }
39
+
40
+ val coroutineScope = rememberCoroutineScope()
41
+
42
+ val maxApi = LocalMaxApi.current
43
+ val context = LocalContext.current
44
+
45
+ DisposableEffect(Unit) {
46
+ ScreenTracker.trackPopupDisplayed(
47
+ maxApi = maxApi,
48
+ context = context,
49
+ parentScreenName = ScreenTracker.getLastScreenName()
50
+ )
51
+ onDispose { }
52
+ }
53
+
54
+ fun openEvent() {
55
+ coroutineScope.launch {
56
+ launch {
57
+ alpha.animateTo(
58
+ targetValue = 1f,
59
+ animationSpec = tween(durationMillis = 250)
60
+ )
61
+ }
62
+ launch {
63
+ scale.animateTo(
64
+ targetValue = 1f,
65
+ animationSpec = tween(
66
+ durationMillis = 250,
67
+ easing = CubicBezierEasing(0.2f, 0.0f, 0f, 1f)
68
+ )
69
+ )
70
+ }
71
+ }
72
+ }
73
+
74
+ fun closeEvent() {
75
+ coroutineScope.launch {
76
+ alpha.animateTo(
77
+ targetValue = 0f,
78
+ animationSpec = tween(durationMillis = 200)
79
+ )
80
+ scale.animateTo(
81
+ targetValue = 0.8f,
82
+ animationSpec = tween(durationMillis = 200)
83
+ )
84
+ OverplayComponentRegistry.hardClearAfterDismiss()
85
+ }
86
+ }
87
+
88
+ LaunchedEffect(Unit) {
89
+ openEvent()
90
+ }
91
+
92
+ DisposableEffect(Unit) {
93
+ OverplayComponentRegistry.bindClose { closeEvent() }
94
+ onDispose {
95
+ onDismiss?.invoke()
96
+ }
97
+ }
98
+
99
+ BackHandler(enabled = true) {
100
+ closeEvent()
101
+ }
102
+
103
+ Box(
104
+ modifier = Modifier
105
+ .fillMaxSize()
106
+ .background(Color.Black.copy(alpha = 0.6f * alpha.value))
107
+ .noFeedbackClickable {
108
+ if(barrierDismissible) closeEvent()
109
+ },
110
+ contentAlignment = Alignment.Center
111
+ ) {
112
+ Box(
113
+ modifier = Modifier
114
+ .scale(scale.value)
115
+ .alpha(alpha.value)
116
+ .wrapContentSize()
117
+ .conditional(IsShowBaseLineDebug) {
118
+ border(1.dp, Colors.blue_03)
119
+ }
120
+ .clickable(
121
+ indication = null,
122
+ interactionSource = remember { MutableInteractionSource() }
123
+ ) {},
124
+ contentAlignment = Alignment.Center
125
+ ) {
126
+ content()
127
+ }
128
+ }
129
+ }
@@ -0,0 +1,100 @@
1
+ package vn.momo.kits.navigation
2
+
3
+ import androidx.compose.foundation.gestures.ScrollableState
4
+ import androidx.compose.runtime.*
5
+ import androidx.compose.ui.graphics.Color
6
+ import vn.momo.kits.navigation.bottomtab.setBottomTabOption
7
+ import vn.momo.kits.navigation.component.*
8
+
9
+ class Navigation(
10
+ val id: Int = -1,
11
+ val bottomTabIndex: Int = -1,
12
+ val initOptions: NavigationOptions? = null,
13
+ private val registry: DynamicScreenRegistry? = null
14
+ ) {
15
+ private val _options = mutableStateOf(initOptions ?: NavigationOptions())
16
+ val currentOptions: State<NavigationOptions> get() = _options
17
+ val options: NavigationOptions get() = _options.value
18
+
19
+ private val _isBottomTabRoot = mutableStateOf(false)
20
+ internal val isBottomTabRoot: Boolean get() = _isBottomTabRoot.value
21
+ internal fun markAsBottomTabRoot() { _isBottomTabRoot.value = true }
22
+
23
+ fun setOptions(
24
+ onBackHandler: (() -> Unit)? = null,
25
+ hiddenBack: Boolean? = null,
26
+ headerBackProps: HeaderBackProps? = null,
27
+ headerTitle: HeaderTitle? = null,
28
+ titlePosition: TitlePosition? = null,
29
+ headerRight: HeaderRight? = null,
30
+ headerType: HeaderType? = null,
31
+ scrollData: ScrollData? = null,
32
+ backgroundColor: Color? = null,
33
+ tintColor: Color? = null,
34
+ footerComponent: (@Composable () -> Unit)? = null,
35
+ floatingButtonProps: FloatingButtonProps? = null,
36
+ keyboardOptions: KeyboardOptions? = null
37
+ ) {
38
+ updateOptions(
39
+ options.copy(
40
+ onBackHandler = onBackHandler ?: options.onBackHandler,
41
+ hiddenBack = hiddenBack ?: options.hiddenBack,
42
+ headerBackProps = headerBackProps ?: options.headerBackProps,
43
+ headerTitle = headerTitle ?: options.headerTitle,
44
+ titlePosition = titlePosition ?: options.titlePosition,
45
+ headerRight = headerRight ?: options.headerRight,
46
+ headerType = headerType ?: options.headerType,
47
+ scrollData = scrollData ?: options.scrollData,
48
+ backgroundColor = backgroundColor ?: options.backgroundColor,
49
+ tintColor = tintColor ?: options.tintColor,
50
+ footerComponent = footerComponent ?: options.footerComponent,
51
+ floatingButtonProps = floatingButtonProps ?: options.floatingButtonProps,
52
+ keyboardOptions = keyboardOptions ?: options.keyboardOptions,
53
+ )
54
+ )
55
+ }
56
+
57
+ fun setOptions(newOptions: NavigationOptions) {
58
+ updateOptions(newOptions)
59
+ }
60
+
61
+ private fun updateOptions(updated: NavigationOptions) {
62
+ _options.value = updated
63
+ if (bottomTabIndex != -1) setBottomTabOption(bottomTabIndex, updated)
64
+ if (id != -1) registry?.setOptions(id, updated)
65
+ }
66
+ }
67
+
68
+ val LocalNavigation = staticCompositionLocalOf<Navigation> {
69
+ error("No NavigationStack provided")
70
+ }
71
+
72
+ @Stable
73
+ data class NavigationOptions(
74
+ val screenName: String? = null,
75
+ val onBackHandler: (() -> Unit)? = null,
76
+ val hiddenBack: Boolean = false,
77
+ val headerBackProps: HeaderBackProps = HeaderBackProps(),
78
+ val headerTitle: HeaderTitle = HeaderTitle.Default("Stack"),
79
+ val titlePosition: TitlePosition = TitlePosition.LEFT,
80
+ val headerRight: HeaderRight = HeaderRight.Toolkit(),
81
+ val headerType: HeaderType = HeaderType.Default(),
82
+ val scrollData: ScrollData = ScrollData(),
83
+ val backgroundColor: Color? = null,
84
+ val tintColor: Color? = null,
85
+ val footerComponent: @Composable (() -> Unit)? = null,
86
+ val floatingButtonProps: FloatingButtonProps? = null,
87
+ val keyboardOptions: KeyboardOptions = KeyboardOptions()
88
+ ) {
89
+ internal fun hasFooter() : Boolean = footerComponent != null
90
+ }
91
+
92
+ data class KeyboardOptions(
93
+ val keyboardShouldPersistTaps: Boolean = false,
94
+ val useAvoidKeyboard: Boolean = true
95
+ )
96
+ data class ScrollData(
97
+ val scrollable: Boolean = true,
98
+ val scrollState: ScrollableState? = null,
99
+ val scrollToTopCallback: (() -> Unit)? = null,
100
+ )