@momo-kits/native-kits 0.163.1-beta.8 → 0.163.1-beta.9-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 (334) hide show
  1. package/CLAUDE.md +1 -1
  2. package/build.gradle.kts +11 -0
  3. package/compose/build.gradle.kts +190 -0
  4. package/compose/build.gradle.kts.backup +190 -0
  5. package/compose/compose.podspec +47 -0
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +150 -0
  9. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  10. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  11. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  12. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +52 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +106 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +183 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +207 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +39 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +294 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +826 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +110 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +378 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +82 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +356 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +113 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +231 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +112 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +477 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +214 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +240 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +216 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +259 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +182 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +328 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +97 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +310 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +323 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +217 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +199 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +470 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +88 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +131 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +203 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +175 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +234 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +188 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +188 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +276 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +65 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +48 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +51 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +253 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +129 -0
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +100 -0
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +172 -0
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +360 -0
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +581 -0
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +156 -0
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +225 -0
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +320 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +81 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +309 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +34 -0
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +360 -0
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +128 -0
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +91 -0
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +69 -0
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +105 -0
  132. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
  133. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
  134. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +207 -0
  135. package/gradle/libs.versions.toml +69 -0
  136. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  137. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  138. package/gradle.properties +26 -0
  139. package/gradlew +252 -0
  140. package/gradlew.bat +94 -0
  141. package/ios/Application/ApplicationEnvironment.swift +15 -2
  142. package/ios/Application/Components.swift +50 -44
  143. package/ios/Application/FloatingButton.swift +10 -9
  144. package/ios/Application/HeaderRight.swift +79 -45
  145. package/ios/Application/Localize.swift +277 -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 +200 -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/Screen.swift +2 -1
  164. package/ios/Application/StackScreen.swift +501 -0
  165. package/ios/Avatar/Avatar.swift +193 -0
  166. package/ios/Badge/Badge.swift +11 -14
  167. package/ios/Badge/BadgeRibbon.swift +92 -21
  168. package/ios/BaselineView/BaselineView.swift +163 -0
  169. package/ios/Button/Button.swift +124 -29
  170. package/ios/Carousel/Carousel.swift +196 -0
  171. package/ios/Checkbox/Checkbox.swift +23 -28
  172. package/ios/Chip/Chip.swift +56 -33
  173. package/ios/Collapse/Collapse.swift +192 -0
  174. package/ios/Colors+Radius+Spacing/Colors.swift +20 -17
  175. package/ios/Colors+Radius+Spacing/Spacing.swift +3 -1
  176. package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
  177. package/ios/DateTimePicker/DateTimePicker.swift +212 -0
  178. package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
  179. package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
  180. package/ios/DateTimePicker/WheelPicker.swift +165 -0
  181. package/ios/Divider/Divider.swift +16 -0
  182. package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
  183. package/ios/Extensions/Color++.swift +32 -0
  184. package/ios/Icon/Icon.swift +10 -1
  185. package/ios/IconButton/IconButton.swift +140 -0
  186. package/ios/Image/Image.swift +16 -3
  187. package/ios/Information/Information.swift +3 -1
  188. package/ios/Input/ErrorView.swift +3 -1
  189. package/ios/Input/Input.swift +72 -33
  190. package/ios/Input/InputPhoneNumber.swift +33 -21
  191. package/ios/Input/InputSearch.swift +107 -48
  192. package/ios/Input/InputTextArea.swift +134 -64
  193. package/ios/InputDropDown/InputDropDown.swift +201 -0
  194. package/ios/InputMoney/InputMoney.swift +347 -0
  195. package/ios/InputOTP/InputOTP.swift +210 -0
  196. package/ios/Loader/Loader.swift +113 -0
  197. package/ios/MoMoUIKits.podspec +5 -0
  198. package/ios/Pagination/PaginationDot.swift +61 -0
  199. package/ios/Pagination/PaginationNumber.swift +35 -0
  200. package/ios/Pagination/PaginationScroll.swift +101 -0
  201. package/ios/Pagination/PaginationWhiteDot.swift +37 -0
  202. package/ios/Popup/PopupDisplay.swift +11 -20
  203. package/ios/Popup/PopupInput.swift +2 -8
  204. package/ios/Popup/PopupNotify.swift +218 -0
  205. package/ios/Popup/PopupPromotion.swift +16 -8
  206. package/ios/ProgressInfo/ProgressInfo.swift +296 -0
  207. package/ios/Radio/Radio.swift +69 -0
  208. package/ios/Rating/Rating.swift +82 -0
  209. package/ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json +11 -0
  210. package/ios/Resources/MoMoUIKitsColors.xcassets/Background.colorset/Contents.json +38 -0
  211. package/ios/Resources/MoMoUIKitsColors.xcassets/Border.colorset/Contents.json +38 -0
  212. package/ios/Resources/MoMoUIKitsColors.xcassets/Card.colorset/Contents.json +38 -0
  213. package/ios/Resources/MoMoUIKitsColors.xcassets/Contents.json +6 -0
  214. package/ios/Resources/MoMoUIKitsColors.xcassets/Error.colorset/Contents.json +38 -0
  215. package/ios/Resources/MoMoUIKitsColors.xcassets/Primary.colorset/Contents.json +38 -0
  216. package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryDark.colorset/Contents.json +38 -0
  217. package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryLight.colorset/Contents.json +38 -0
  218. package/ios/Resources/MoMoUIKitsColors.xcassets/Secondary.colorset/Contents.json +38 -0
  219. package/ios/Resources/MoMoUIKitsColors.xcassets/Success.colorset/Contents.json +38 -0
  220. package/ios/Resources/MoMoUIKitsColors.xcassets/Text.colorset/Contents.json +38 -0
  221. package/ios/Resources/MoMoUIKitsColors.xcassets/TextSecondary.colorset/Contents.json +38 -0
  222. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +9 -0
  223. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +38 -0
  224. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +38 -0
  225. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +38 -0
  226. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +38 -0
  227. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +38 -0
  228. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +38 -0
  229. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +38 -0
  230. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +38 -0
  231. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +38 -0
  232. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +38 -0
  233. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +38 -0
  234. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +38 -0
  235. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +38 -0
  236. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +38 -0
  237. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +38 -0
  238. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +38 -0
  239. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +38 -0
  240. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +38 -0
  241. package/ios/Resources/MoMoUIKitsColors.xcassets/Warning.colorset/Contents.json +38 -0
  242. package/ios/Skeleton/Skeleton.swift +99 -0
  243. package/ios/Slider/Slider.swift +237 -0
  244. package/ios/Stepper/Stepper.swift +220 -0
  245. package/ios/Steps/Steps.swift +467 -0
  246. package/ios/SuggestAction/SuggestAction.swift +99 -0
  247. package/ios/Swipeable/SwipeCell.swift +187 -0
  248. package/ios/Swipeable/SwipeCellModel.swift +21 -0
  249. package/ios/Switch/Switch.swift +53 -28
  250. package/ios/TabView/TabView.swift +534 -0
  251. package/ios/Tag/Tag.swift +98 -0
  252. package/ios/Template/TrustBanner/TrustBanner.swift +6 -7
  253. package/ios/Title/Title.swift +269 -0
  254. package/ios/Tooltip/Tooltip.swift +485 -0
  255. package/ios/Typography/FontScaleStore.swift +19 -0
  256. package/ios/Typography/Text.swift +79 -5
  257. package/ios/Typography/Typography.swift +3 -0
  258. package/ios/Uploader/Uploader.swift +174 -0
  259. package/ios/native-kits.podspec +61 -8
  260. package/ios-demo/MoMoUIKitsDemo.podspec +20 -0
  261. package/ios-demo/README.md +120 -0
  262. package/ios-demo/Resources/dot_loading.json +558 -0
  263. package/ios-demo/Resources/icon.json +4052 -0
  264. package/ios-demo/Resources/lottie_circle_loader.json +1 -0
  265. package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
  266. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
  267. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
  268. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
  269. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
  270. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
  271. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
  272. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
  273. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
  274. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
  275. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +24 -0
  276. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
  277. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +93 -0
  278. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +269 -0
  279. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
  280. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
  281. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +100 -0
  282. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +126 -0
  283. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +63 -0
  284. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +20 -0
  285. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +93 -0
  286. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
  287. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +124 -0
  288. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +14 -0
  289. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
  290. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +279 -0
  291. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +58 -0
  292. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +78 -0
  293. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +138 -0
  294. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +111 -0
  295. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +136 -0
  296. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +107 -0
  297. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +73 -0
  298. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +100 -0
  299. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +32 -0
  300. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +57 -0
  301. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +70 -0
  302. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +188 -0
  303. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +229 -0
  304. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +72 -0
  305. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
  306. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +121 -0
  307. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +76 -0
  308. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +89 -0
  309. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +32 -0
  310. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +56 -0
  311. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +32 -0
  312. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +150 -0
  313. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +138 -0
  314. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +103 -0
  315. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +94 -0
  316. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +79 -0
  317. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +152 -0
  318. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +33 -0
  319. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +190 -0
  320. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +34 -0
  321. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +182 -0
  322. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +109 -0
  323. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +187 -0
  324. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
  325. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +131 -0
  326. package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +51 -0
  327. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
  328. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
  329. package/local.properties +8 -0
  330. package/package.json +1 -1
  331. package/publish.sh +53 -0
  332. package/scripts/gen-ios-color.mjs +136 -0
  333. package/settings.gradle.kts +64 -0
  334. package/.claude/settings.local.json +0 -62
@@ -0,0 +1,477 @@
1
+ package vn.momo.kits.components
2
+
3
+ import vn.momo.kits.modifier.InternalApi
4
+
5
+ import androidx.compose.foundation.background
6
+ import androidx.compose.foundation.border
7
+ import androidx.compose.foundation.clickable
8
+ import androidx.compose.foundation.interaction.MutableInteractionSource
9
+ import androidx.compose.foundation.layout.*
10
+ import androidx.compose.foundation.shape.RoundedCornerShape
11
+ import androidx.compose.foundation.text.BasicTextField
12
+ import androidx.compose.foundation.text.KeyboardOptions
13
+ import androidx.compose.material3.CircularProgressIndicator
14
+ import androidx.compose.runtime.*
15
+ import androidx.compose.ui.Alignment
16
+ import androidx.compose.ui.Modifier
17
+ import androidx.compose.ui.focus.onFocusChanged
18
+ import androidx.compose.ui.graphics.Color
19
+ import androidx.compose.ui.text.AnnotatedString
20
+ import androidx.compose.ui.text.SpanStyle
21
+ import androidx.compose.ui.text.TextStyle
22
+ import androidx.compose.ui.text.font.FontFamily
23
+ import androidx.compose.ui.text.font.FontWeight
24
+ import androidx.compose.ui.text.input.KeyboardType
25
+ import androidx.compose.ui.text.input.OffsetMapping
26
+ import androidx.compose.ui.text.input.TransformedText
27
+ import androidx.compose.ui.text.input.VisualTransformation
28
+ import androidx.compose.ui.text.style.TextAlign
29
+ import androidx.compose.ui.unit.Dp
30
+ import androidx.compose.ui.unit.TextUnit
31
+ import androidx.compose.ui.unit.dp
32
+ import androidx.compose.ui.unit.sp
33
+ import androidx.compose.ui.zIndex
34
+ import vn.momo.kits.application.IsShowBaseLineDebug
35
+ import vn.momo.kits.const.*
36
+ import vn.momo.kits.modifier.conditional
37
+ import vn.momo.kits.modifier.setAutomationId
38
+ import vn.momo.uikits.resources.Res
39
+ import vn.momo.uikits.resources.sfprotext_regular
40
+
41
+ data class InputSizeDetail(
42
+ val borderWidth: Dp,
43
+ val borderRadius: Dp,
44
+ val height: Dp,
45
+ )
46
+
47
+ enum class InputSize(val values: InputSizeDetail) {
48
+ SMALL(
49
+ InputSizeDetail(
50
+ borderWidth = 1.dp,
51
+ borderRadius = Radius.S,
52
+ height = 48.dp
53
+ )
54
+ ),
55
+ LARGE(
56
+ InputSizeDetail(
57
+ borderWidth = 1.dp,
58
+ borderRadius = Radius.S,
59
+ height = 56.dp
60
+ )
61
+ )
62
+ }
63
+
64
+ enum class InputFontWeight(val value: FontWeight) {
65
+ REGULAR(
66
+ FontWeight(400)
67
+ ),
68
+ BOLD(
69
+ FontWeight(700)
70
+ )
71
+ }
72
+
73
+ data class InputState(
74
+ val isFocused: Boolean = false,
75
+ val passHidden: Boolean = false,
76
+ val hasBeenBlurred: Boolean = false
77
+ )
78
+
79
+ private class PasswordVisualTransformation(
80
+ private val fontFamily: FontFamily,
81
+ private val fontSize: TextUnit
82
+ ) : VisualTransformation {
83
+ private val mask: Char = '\u2022'
84
+
85
+ override fun filter(text: AnnotatedString): TransformedText {
86
+
87
+ val maskedText = AnnotatedString(
88
+ text = mask.toString().repeat(text.length),
89
+ spanStyles = listOf(
90
+ AnnotatedString.Range(
91
+ SpanStyle(fontSize = fontSize, letterSpacing = 0.sp, fontFamily = fontFamily),
92
+ 0,
93
+ text.length
94
+ )
95
+ )
96
+ )
97
+ return TransformedText(maskedText, OffsetMapping.Identity)
98
+ }
99
+
100
+ override fun equals(other: Any?): Boolean {
101
+ if (this === other) return true
102
+ if (other !is PasswordVisualTransformation) return false
103
+ return mask == other.mask && fontSize == other.fontSize
104
+ }
105
+
106
+ override fun hashCode(): Int {
107
+ return 31 * mask.hashCode() + fontSize.hashCode()
108
+ }
109
+ }
110
+
111
+ @Composable
112
+ @InternalApi
113
+ fun getBorderColor(isFocused: Boolean, error: String, disabled: Boolean): Color {
114
+ val theme = AppTheme.current
115
+ return remember(isFocused, error, disabled, theme) {
116
+ when {
117
+ disabled -> theme.colors.border.disable
118
+ error.isNotEmpty() -> theme.colors.error.primary
119
+ isFocused -> theme.colors.primary
120
+ else -> theme.colors.border.default
121
+ }
122
+ }
123
+ }
124
+
125
+ @Composable
126
+ @InternalApi
127
+ fun RenderRightIcon(loading: Boolean, icon: String, color: Color, onClick: () -> Unit, modifier: Modifier = Modifier) {
128
+ if (loading) {
129
+ Box {
130
+ CircularProgressIndicator(
131
+ modifier = Modifier.size(16.dp),
132
+ color = color,
133
+ trackColor = Color.Transparent,
134
+ strokeWidth = 2.dp
135
+ )
136
+ }
137
+ }
138
+ if (icon.isNotEmpty()) {
139
+ Icon(
140
+ source = icon,
141
+ color = color,
142
+ size = 24.dp,
143
+ modifier = modifier.clickable(
144
+ onClick = onClick,
145
+ interactionSource = remember { MutableInteractionSource() },
146
+ indication = null
147
+ )
148
+ )
149
+ }
150
+ }
151
+
152
+ @Composable
153
+ @InternalApi
154
+ fun ErrorView(errorMessage: String, errorSpacing: Boolean, hintText: String) {
155
+ val theme = AppTheme.current
156
+ val errorColor = remember(theme) { theme.colors.error.primary }
157
+ val hintColor = remember(theme) { theme.colors.text.hint }
158
+ val hintTextDefault = remember(hintText) { hintText.ifEmpty { "Không thể chỉnh sửa" } }
159
+
160
+ if (errorMessage.isNotEmpty() || hintText.isNotEmpty()) {
161
+ val color = if (errorMessage.isNotEmpty()) errorColor else hintColor
162
+ Row(
163
+ Modifier.padding(top = Spacing.XS),
164
+ verticalAlignment = Alignment.Top
165
+ ) {
166
+ Icon(
167
+ size = 16.dp,
168
+ color = color,
169
+ source = "ic_error"
170
+ )
171
+ Text(
172
+ errorMessage.ifEmpty { hintTextDefault },
173
+ style = Typography.descriptionDefaultRegular,
174
+ modifier = Modifier.padding(start = Spacing.XS),
175
+ color = color,
176
+ )
177
+ }
178
+ } else if (errorSpacing) {
179
+ Spacer(Modifier.padding(top = Spacing.XS).height(18.dp))
180
+ }
181
+ }
182
+
183
+ @Composable
184
+ fun Input(
185
+ text: MutableState<String> = remember { mutableStateOf("") },
186
+ floatingValue: String = "",
187
+ floatingValueColor: Color = AppTheme.current.colors.text.hint,
188
+ floatingIcon: String = "",
189
+ floatingIconColor: Color = AppTheme.current.colors.text.default,
190
+ placeholder: String = "",
191
+ size: InputSize = InputSize.SMALL,
192
+ onChangeText: (String) -> Unit = {},
193
+ hintText: String = "",
194
+ error: String = "",
195
+ errorSpacing: Boolean = false,
196
+ disabled: Boolean = false,
197
+ readOnly: Boolean = false,
198
+ secureTextEntry: Boolean = false,
199
+ icon: String = "",
200
+ iconColor: Color = AppTheme.current.colors.text.default,
201
+ onRightIconPressed: () -> Unit = {},
202
+ leadingIcon: String = "",
203
+ leadingIconColor: Color = AppTheme.current.colors.text.hint,
204
+ onFocus: () -> Unit = {},
205
+ onBlur: () -> Unit = {},
206
+ loading: Boolean = false,
207
+ required: Boolean = false,
208
+ maxLength: Int? = null,
209
+ fontWeight: InputFontWeight = InputFontWeight.REGULAR,
210
+ keyboardType: KeyboardType = KeyboardType.Text,
211
+ modifier: Modifier = Modifier,
212
+ inputModifier: Modifier = Modifier,
213
+ ) {
214
+ // Consolidated state management
215
+ var inputState by remember { mutableStateOf(InputState()) }
216
+
217
+ // Memoized color calculations
218
+ val theme = AppTheme.current
219
+ val colors = remember(disabled, theme) {
220
+ if (disabled) {
221
+ val disabledColor = theme.colors.text.disable
222
+ Triple(disabledColor, disabledColor, disabledColor)
223
+ } else {
224
+ Triple(
225
+ theme.colors.text.default, // textColor
226
+ theme.colors.text.hint, // placeholderColor
227
+ iconColor // iconTintColor
228
+ )
229
+ }
230
+ }
231
+
232
+ val (textColor, placeholderColor, iconTintColor) = colors
233
+
234
+ val floatingTitleColor = remember(disabled, floatingValueColor, theme) {
235
+ if (disabled) theme.colors.text.disable else floatingValueColor
236
+ }
237
+
238
+ val floatingIconTintColor = remember(disabled, floatingIconColor, theme) {
239
+ if (disabled) theme.colors.text.disable else floatingIconColor
240
+ }
241
+
242
+ val fontSize = 14.sp
243
+ val lineHeight = 24.sp
244
+ val scaleFontSize = scaleSize(fontSize)
245
+ val scaleLineHeight = scaleSize(lineHeight)
246
+
247
+ val textStyle = remember(textColor, fontWeight) {
248
+ TextStyle(
249
+ color = textColor,
250
+ fontSize = scaleFontSize,
251
+ lineHeight = scaleLineHeight,
252
+ fontWeight = fontWeight.value
253
+ )
254
+ }
255
+
256
+ val placeholderStyle = remember(placeholderColor, fontWeight) {
257
+ TextStyle(
258
+ fontSize = fontSize,
259
+ lineHeight = lineHeight,
260
+ fontWeight = fontWeight.value,
261
+ textAlign = TextAlign.Center
262
+ )
263
+ }
264
+
265
+ val keyboardOptionsConfig = remember(secureTextEntry, keyboardType) {
266
+ KeyboardOptions.Default.copy(
267
+ keyboardType = keyboardType
268
+ )
269
+ }
270
+
271
+ val passwordFontFamily = getFont(Res.font.sfprotext_regular)
272
+ val passwordFontSize = scaleSize(24.sp)
273
+ val visualTransformation = remember(secureTextEntry, inputState.passHidden, passwordFontFamily) {
274
+ if (secureTextEntry && !inputState.passHidden)
275
+ PasswordVisualTransformation(fontFamily = passwordFontFamily, fontSize = passwordFontSize)
276
+ else
277
+ VisualTransformation.None
278
+ }
279
+
280
+ Column(modifier = modifier
281
+ .conditional(IsShowBaseLineDebug) {
282
+ border(1.dp, Colors.blue_03)
283
+ }) {
284
+ BasicTextField(
285
+ enabled = !disabled,
286
+ readOnly = readOnly,
287
+ singleLine = true,
288
+ value = text.value,
289
+ textStyle = textStyle,
290
+ visualTransformation = visualTransformation,
291
+ keyboardOptions = keyboardOptionsConfig,
292
+ modifier = inputModifier
293
+ .height(scaleSize(size.values.height.value).dp)
294
+ .onFocusChanged { focusState ->
295
+ val wasFocused = inputState.isFocused
296
+ inputState = inputState.copy(
297
+ isFocused = focusState.isFocused,
298
+ hasBeenBlurred = inputState.hasBeenBlurred || wasFocused
299
+ )
300
+
301
+ if (focusState.isFocused) {
302
+ onFocus()
303
+ } else if (inputState.hasBeenBlurred) {
304
+ onBlur()
305
+ }
306
+ },
307
+ onValueChange = { newText ->
308
+ val limitedText = maxLength?.let { newText.take(it) } ?: newText
309
+ onChangeText(limitedText)
310
+ },
311
+ decorationBox = { innerTextField ->
312
+ // Floating label
313
+ FloatingLabel(
314
+ floatingValue = floatingValue,
315
+ floatingIcon = floatingIcon,
316
+ titleColor = floatingTitleColor,
317
+ iconColor = floatingIconTintColor,
318
+ offsetY = -size.values.height / 2,
319
+ required = required,
320
+ )
321
+
322
+ // Input container
323
+ Box(
324
+ modifier = Modifier
325
+ .fillMaxWidth()
326
+ .background(
327
+ color = AppTheme.current.colors.background.surface,
328
+ shape = RoundedCornerShape(size.values.borderRadius)
329
+ )
330
+ .border(
331
+ 1.dp,
332
+ getBorderColor(inputState.isFocused, error, disabled),
333
+ RoundedCornerShape(size.values.borderRadius)
334
+ ),
335
+ contentAlignment = Alignment.CenterStart
336
+ ) {
337
+ Row(
338
+ modifier = Modifier.padding(horizontal = Spacing.M),
339
+ verticalAlignment = Alignment.CenterVertically
340
+ ) {
341
+ // Leading icon
342
+ if (leadingIcon.isNotEmpty()) {
343
+ Icon(
344
+ source = leadingIcon,
345
+ modifier = Modifier.padding(end = Spacing.M),
346
+ size = if (size == InputSize.SMALL) 24.dp else 32.dp,
347
+ color = leadingIconColor
348
+ )
349
+ }
350
+
351
+ Box(Modifier.weight(1f), contentAlignment = Alignment.CenterStart) {
352
+ if (text.value.isEmpty()) {
353
+ Text(
354
+ text = placeholder,
355
+ style = placeholderStyle,
356
+ color = placeholderColor
357
+ )
358
+
359
+ }
360
+ innerTextField()
361
+ }
362
+
363
+ // Clear button
364
+ if (inputState.isFocused && text.value.isNotEmpty()) {
365
+ Row(Modifier.padding(horizontal = Spacing.XS)) {
366
+ Icon(
367
+ source = "24_navigation_close_circle_full",
368
+ size = 16.dp,
369
+ color = theme.colors.text.hint,
370
+ modifier = Modifier.clickable(
371
+ onClick = {
372
+ text.value = ""
373
+ onChangeText.invoke("")
374
+ },
375
+ interactionSource = remember { MutableInteractionSource() },
376
+ indication = null
377
+ ).setAutomationId("ic_clear")
378
+ )
379
+ }
380
+ }
381
+
382
+ // Right icon (password toggle or custom icon)
383
+ when {
384
+ secureTextEntry && text.value.isNotEmpty() -> {
385
+ val iconName = if (inputState.passHidden) "24_security_eye_open" else "24_security_eye_off"
386
+ val togglePassword = {
387
+ onRightIconPressed()
388
+ inputState = inputState.copy(passHidden = !inputState.passHidden)
389
+ }
390
+ RenderRightIcon(
391
+ loading = loading,
392
+ icon = iconName,
393
+ color = iconTintColor,
394
+ onClick = togglePassword,
395
+ modifier = Modifier.setAutomationId("ic_show_hide"))
396
+ }
397
+ else -> {
398
+ RenderRightIcon(loading, icon, iconTintColor, onRightIconPressed)
399
+ }
400
+ }
401
+ }
402
+ }
403
+ },
404
+ )
405
+
406
+ // Error/hint display
407
+ ErrorView(error, errorSpacing, hintText)
408
+ }
409
+ }
410
+
411
+ internal data class InputColors(
412
+ val text: Color,
413
+ val placeholder: Color,
414
+ val iconTint: Color,
415
+ val floatingTitle: Color,
416
+ val floatingIcon: Color,
417
+ )
418
+
419
+ @Composable
420
+ internal fun getInputColors(
421
+ disabled: Boolean,
422
+ iconColor: Color,
423
+ floatingValueColor: Color,
424
+ floatingIconColor: Color,
425
+ ): InputColors {
426
+ val theme = AppTheme.current
427
+ val disabledColor = theme.colors.text.disable
428
+ return InputColors(
429
+ text = if (disabled) disabledColor else theme.colors.text.default,
430
+ placeholder = if (disabled) disabledColor else theme.colors.text.hint,
431
+ iconTint = if (disabled) disabledColor else iconColor,
432
+ floatingTitle = if (disabled) disabledColor else floatingValueColor,
433
+ floatingIcon = if (disabled) disabledColor else floatingIconColor,
434
+ )
435
+ }
436
+
437
+ @Composable
438
+ internal fun FloatingLabel(
439
+ floatingValue: String,
440
+ floatingIcon: String,
441
+ titleColor: Color,
442
+ iconColor: Color,
443
+ offsetY: Dp,
444
+ offsetX: Dp = Spacing.S,
445
+ required: Boolean = false,
446
+ ) {
447
+ if (floatingValue.isEmpty() && floatingIcon.isEmpty()) return
448
+ Box(
449
+ modifier = Modifier
450
+ .wrapContentSize()
451
+ .offset(y = offsetY, x = offsetX)
452
+ .background(AppTheme.current.colors.background.surface)
453
+ .zIndex(10f),
454
+ ) {
455
+ Row(
456
+ modifier = Modifier.padding(horizontal = Spacing.S),
457
+ verticalAlignment = Alignment.CenterVertically,
458
+ ) {
459
+ Text(floatingValue, style = Typography.labelSMedium, color = titleColor)
460
+ if (required) {
461
+ Text(
462
+ "*",
463
+ style = Typography.labelSMedium,
464
+ color = AppTheme.current.colors.error.primary,
465
+ )
466
+ }
467
+ if (floatingIcon.isNotEmpty()) {
468
+ Icon(
469
+ source = floatingIcon,
470
+ modifier = Modifier.padding(start = Spacing.XS),
471
+ size = 16.dp,
472
+ color = iconColor,
473
+ )
474
+ }
475
+ }
476
+ }
477
+ }
@@ -0,0 +1,114 @@
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.*
7
+ import androidx.compose.foundation.shape.RoundedCornerShape
8
+ import androidx.compose.runtime.*
9
+ import androidx.compose.ui.Alignment
10
+ import androidx.compose.ui.Modifier
11
+ import androidx.compose.ui.graphics.Color
12
+ import androidx.compose.ui.semantics.contentDescription
13
+ import androidx.compose.ui.semantics.semantics
14
+ import androidx.compose.ui.semantics.testTag
15
+ import androidx.compose.ui.text.TextStyle
16
+ import androidx.compose.ui.unit.dp
17
+ import androidx.compose.ui.unit.sp
18
+ import androidx.compose.ui.zIndex
19
+ import vn.momo.kits.application.IsShowBaseLineDebug
20
+ import vn.momo.kits.const.*
21
+ import vn.momo.kits.modifier.conditional
22
+
23
+ @Composable
24
+ fun InputDropDown(
25
+ value: MutableState<String> = remember { mutableStateOf("") },
26
+ floatingValue: String = "",
27
+ floatingValueColor: Color = AppTheme.current.colors.text.hint,
28
+ floatingIcon: String = "",
29
+ floatingIconColor: Color = AppTheme.current.colors.text.default,
30
+ placeholder: String = "",
31
+ size: InputSize = InputSize.SMALL,
32
+ onPress: () -> Unit = {},
33
+ hintText: String = "",
34
+ error: String = "",
35
+ errorSpacing: Boolean = false,
36
+ disabled: Boolean = false,
37
+ icon: String = "arrow_chevron_down_small",
38
+ iconColor: Color = AppTheme.current.colors.text.default,
39
+ onRightIconPressed: () -> Unit = {},
40
+ leadingIcon: String = "",
41
+ leadingIconColor: Color = AppTheme.current.colors.text.hint,
42
+ loading: Boolean = false,
43
+ required: Boolean = false,
44
+ ) {
45
+ val isFocused by remember { mutableStateOf(false) }
46
+
47
+ val (textColor, placeholderColor, iconTintColor, floatingTitleColor, floatingIconTintColor) =
48
+ getInputColors(disabled, iconColor, floatingValueColor, floatingIconColor)
49
+
50
+ val testId = if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
51
+
52
+ val fontSize = scaleSize(16.sp)
53
+ val lineHeight = scaleSize(24.sp)
54
+
55
+ Column(modifier = Modifier
56
+ .conditional(IsShowBaseLineDebug) {
57
+ border(1.dp, Colors.blue_03)
58
+ }
59
+ .clickable(enabled = !disabled, onClick = onPress)
60
+ .semantics {
61
+ contentDescription = floatingValue; testTag = testId
62
+ }) {
63
+ Box {
64
+ FloatingLabel(
65
+ floatingValue = floatingValue,
66
+ floatingIcon = floatingIcon,
67
+ titleColor = floatingTitleColor,
68
+ iconColor = floatingIconTintColor,
69
+ offsetY = -Spacing.S,
70
+ required = required,
71
+ )
72
+ Box(
73
+ modifier = Modifier.fillMaxWidth()
74
+ .height(if (size == InputSize.SMALL) 48.dp else 56.dp)
75
+ .border(
76
+ 1.dp,
77
+ getBorderColor(isFocused, error, disabled),
78
+ RoundedCornerShape(size.values.borderRadius)
79
+ ),
80
+ contentAlignment = Alignment.CenterStart
81
+ ) {
82
+ Row(
83
+ modifier = Modifier.padding(horizontal = Spacing.M),
84
+ verticalAlignment = Alignment.CenterVertically
85
+ ) {
86
+ //leading icon
87
+ if (leadingIcon.isNotEmpty()) {
88
+ Icon(
89
+ source = leadingIcon,
90
+ modifier = Modifier.padding(end = Spacing.M),
91
+ size = if (size.name == InputSize.SMALL.name) 24.dp else 32.dp,
92
+ color = leadingIconColor
93
+ )
94
+ }
95
+ Box(Modifier.weight(1f)) {
96
+ Text(
97
+ text = value.value.ifEmpty { placeholder },
98
+ style = TextStyle(
99
+ fontSize = fontSize,
100
+ lineHeight = lineHeight
101
+ ),
102
+ color = if (value.value.isEmpty()) placeholderColor else textColor
103
+ )
104
+ }
105
+ RenderRightIcon(
106
+ loading, icon, iconTintColor,
107
+ onRightIconPressed
108
+ )
109
+ }
110
+ }
111
+ }
112
+ ErrorView(error, errorSpacing, hintText)
113
+ }
114
+ }