@momo-kits/native-kits 0.300.3 → 0.300.4-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 (272) hide show
  1. package/CLAUDE.md +51 -7
  2. package/README.md +2 -2
  3. package/build.gradle.kts +13 -0
  4. package/compose/build.gradle.kts +197 -0
  5. package/compose/build.gradle.kts.backup +197 -0
  6. package/compose/compose.podspec +47 -0
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +20 -0
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +153 -0
  12. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +62 -0
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1071 -0
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +65 -0
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +81 -0
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +357 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +542 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +49 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +231 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +189 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +478 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +265 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +235 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +223 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +265 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +185 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +361 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +308 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +330 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +220 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +207 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +92 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +560 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +125 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +207 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +501 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +236 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +17 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +194 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +287 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +306 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +338 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +137 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +116 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +215 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +404 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +732 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +148 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +40 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +233 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +217 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +97 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +377 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +455 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +103 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +413 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HelpCenterRequest.kt +37 -0
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +192 -0
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/ToolkitRequests.kt +41 -0
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +135 -0
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +91 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +74 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +20 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +118 -0
  124. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +44 -0
  125. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +62 -0
  126. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
  127. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
  128. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +36 -0
  129. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
  130. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
  131. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +217 -0
  132. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +138 -0
  133. package/gradle/libs.versions.toml +68 -0
  134. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  135. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  136. package/gradle.properties +26 -0
  137. package/gradlew +252 -0
  138. package/gradlew.bat +94 -0
  139. package/ios/Application/ApplicationEnvironment.swift +24 -6
  140. package/ios/Application/DesignSystemKits.swift +100 -0
  141. package/ios/Application/DesignSystemKitsPayload.swift +68 -0
  142. package/ios/Application/MaxApi.swift +30 -3
  143. package/ios/Avatar/Avatar.swift +4 -3
  144. package/ios/Badge/Badge.swift +6 -4
  145. package/ios/Badge/BadgeDot.swift +1 -1
  146. package/ios/Badge/BadgeRibbon.swift +8 -2
  147. package/ios/Button/Button.swift +15 -12
  148. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +64 -18
  149. package/ios/Carousel/Carousel.swift +29 -12
  150. package/ios/Checkbox/Checkbox.swift +7 -3
  151. package/ios/Chip/Chip.swift +5 -4
  152. package/ios/Collapse/Collapse.swift +70 -19
  153. package/ios/Colors+Radius+Spacing/Colors.swift +10 -1
  154. package/ios/Colors+Radius+Spacing/Radius.swift +6 -0
  155. package/ios/DateTimePicker/DateTimePicker.swift +54 -20
  156. package/ios/DateTimePicker/WheelPicker.swift +103 -105
  157. package/ios/Divider/Divider.swift +37 -4
  158. package/ios/Extensions/Color++.swift +38 -9
  159. package/ios/Extensions/OptionalEnvironmentObject.swift +12 -0
  160. package/ios/Extensions/SkeletonUICompat.swift +11 -0
  161. package/ios/Icon/Icon.swift +21 -23
  162. package/ios/Icon/Icons.swift +1329 -0
  163. package/ios/IconButton/IconButton.swift +15 -7
  164. package/ios/Image/Image.swift +7 -23
  165. package/ios/Information/Information.swift +27 -9
  166. package/ios/Input/ErrorView.swift +2 -2
  167. package/ios/Input/Input.swift +171 -148
  168. package/ios/Input/InputPhoneNumber.swift +10 -9
  169. package/ios/Input/InputSearch.swift +107 -78
  170. package/ios/Input/InputTextArea.swift +133 -148
  171. package/ios/InputDropDown/InputDropDown.swift +10 -7
  172. package/ios/InputMoney/InputMoney.swift +32 -11
  173. package/ios/InputOTP/InputOTP.swift +22 -12
  174. package/ios/Layout/Card.swift +50 -0
  175. package/ios/Layout/GridContext.swift +187 -3
  176. package/ios/Layout/Item.swift +5 -4
  177. package/ios/Layout/ScreenLayout.swift +415 -0
  178. package/ios/Layout/Section.swift +4 -100
  179. package/ios/Loader/Loader.swift +5 -9
  180. package/ios/Lottie/LottieView.swift +14 -2
  181. package/ios/{Application/Navigation/Overplay → Navigation}/BottomSheet.swift +169 -29
  182. package/ios/Navigation/BottomTab/BottomTab.swift +332 -0
  183. package/ios/{Application/Navigation → Navigation}/BottomTab/BottomTabBar.swift +18 -7
  184. package/ios/Navigation/BottomTab/DuoBarCompression.swift +104 -0
  185. package/ios/Navigation/BottomTab/DuoTabBar.swift +329 -0
  186. package/ios/{Application → Navigation/Component}/FloatingButton.swift +43 -54
  187. package/ios/Navigation/Component/Header.swift +545 -0
  188. package/ios/Navigation/Component/HeaderBackground.swift +154 -0
  189. package/ios/Navigation/Component/HeaderJourney.swift +73 -0
  190. package/ios/Navigation/Component/HeaderLocation.swift +48 -0
  191. package/ios/Navigation/Component/HeaderRight.swift +425 -0
  192. package/ios/Navigation/Component/HeaderTitle.swift +36 -0
  193. package/ios/{Application/Navigation → Navigation/Component}/HeaderUser.swift +21 -24
  194. package/ios/Navigation/Component/SideBar.swift +183 -0
  195. package/ios/{Application/Navigation/Overplay → Navigation/Component}/SnackBar.swift +8 -8
  196. package/ios/Navigation/HostBackGestureBridge.swift +78 -0
  197. package/ios/{Application/Navigation/Overplay → Navigation}/ModalScreen.swift +9 -2
  198. package/ios/Navigation/Navigation.swift +204 -0
  199. package/ios/Navigation/NavigationContainer.swift +195 -0
  200. package/ios/{Application/Navigation → Navigation}/Navigator.swift +207 -107
  201. package/ios/Navigation/StackScreen.swift +930 -0
  202. package/ios/Navigation/StackTransition.swift +400 -0
  203. package/ios/Navigation/SwipeBackHaptic.swift +33 -0
  204. package/ios/{Application/Navigation → Navigation}/Tracking/ScreenTracker.swift +12 -5
  205. package/ios/OTPKeyboard/OTPKeyboard.swift +8 -11
  206. package/ios/Pagination/PaginationScroll.swift +2 -2
  207. package/ios/Popup/PopupDisplay.swift +72 -135
  208. package/ios/Popup/PopupInput.swift +10 -13
  209. package/ios/Popup/PopupLayout.swift +138 -0
  210. package/ios/Popup/PopupNotify.swift +59 -69
  211. package/ios/Popup/PopupPromotion.swift +31 -47
  212. package/ios/PopupView/FullscreenPopup.swift +13 -19
  213. package/ios/PopupView/PopupView.swift +1 -1
  214. package/ios/PopupView/Utils++.swift +0 -8
  215. package/ios/ProgressInfo/ProgressInfo.swift +4 -2
  216. package/ios/Radio/Radio.swift +2 -1
  217. package/ios/Rating/Rating.swift +9 -1
  218. package/ios/Resources/dot_loading.json +558 -0
  219. package/ios/Resources/lottie_circle_loader.json +1 -0
  220. package/ios/ScrollIndicator/ScrollIndicator.swift +11 -10
  221. package/ios/Skeleton/Skeleton.swift +22 -27
  222. package/ios/Slider/Slider.swift +16 -18
  223. package/ios/Stepper/Stepper.swift +7 -3
  224. package/ios/Steps/Steps.swift +8 -6
  225. package/ios/SuggestAction/SuggestAction.swift +5 -0
  226. package/ios/Swipeable/SwipeCell.swift +10 -6
  227. package/ios/Switch/Switch.swift +22 -20
  228. package/ios/TabView/TabView.swift +102 -21
  229. package/ios/Tag/Tag.swift +15 -4
  230. package/ios/Template/Logo/Logo.swift +2 -1
  231. package/ios/Template/TrustBanner/TrustBanner.swift +109 -55
  232. package/ios/Title/Title.swift +6 -17
  233. package/ios/Tooltip/Tooltip.swift +29 -14
  234. package/ios/Typography/FontScale.swift +17 -14
  235. package/ios/Typography/Text.swift +156 -20
  236. package/ios/Typography/Typography.swift +2 -2
  237. package/ios/Uploader/Uploader.swift +3 -1
  238. package/ios/native-kits.podspec +2 -3
  239. package/ios-demo/MoMoUIKitsDemo.podspec +1 -3
  240. package/ios-demo/README.md +120 -0
  241. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +1 -1
  242. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DuoTabDemo.swift +80 -0
  243. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +2 -0
  244. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IPhoneDuoDemo.swift +173 -0
  245. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +77 -1
  246. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +1 -0
  247. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +2 -2
  248. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +2 -0
  249. package/package.json +1 -1
  250. package/publish.sh +19 -2
  251. package/scripts/gen-ios-icons.mjs +36 -0
  252. package/settings.gradle.kts +64 -0
  253. package/ios/Application/Components.swift +0 -270
  254. package/ios/Application/ComposeApi.swift +0 -22
  255. package/ios/Application/HeaderRight.swift +0 -306
  256. package/ios/Application/Navigation/BottomTab/BottomTab.swift +0 -104
  257. package/ios/Application/Navigation/HeaderBackProps.swift +0 -66
  258. package/ios/Application/Navigation/HeaderTitle.swift +0 -57
  259. package/ios/Application/Navigation/NavigationContainer.swift +0 -213
  260. package/ios/Application/Navigation/NavigationOptions.swift +0 -109
  261. package/ios/Application/Navigation/NavigatorManager.swift +0 -22
  262. package/ios/Application/Navigation/component/Header.swift +0 -178
  263. package/ios/Application/Navigation/component/HeaderBackground.swift +0 -83
  264. package/ios/Application/Navigation/component/HeaderColor.swift +0 -65
  265. package/ios/Application/Navigation/component/HeaderRightWidthKey.swift +0 -11
  266. package/ios/Application/Navigation/component/NavigationFooter.swift +0 -90
  267. package/ios/Application/Navigation/component/NavigationHeaderRight.swift +0 -196
  268. package/ios/Application/Screen.swift +0 -250
  269. package/ios/Application/StackScreen.swift +0 -492
  270. package/ios/Typography/FontScaleStore.swift +0 -58
  271. package/ios/Typography/KitDesignSystem.swift +0 -17
  272. /package/ios/{Application/Navigation → Navigation}/BottomTab/CurvedContainer.swift +0 -0
@@ -0,0 +1,330 @@
1
+ package vn.momo.kits.components
2
+
3
+ import androidx.compose.animation.core.animateFloatAsState
4
+ import androidx.compose.animation.core.spring
5
+ import androidx.compose.foundation.background
6
+ import androidx.compose.foundation.border
7
+ import androidx.compose.foundation.layout.*
8
+ import androidx.compose.foundation.shape.RoundedCornerShape
9
+ import androidx.compose.runtime.*
10
+ import androidx.compose.ui.Alignment
11
+ import androidx.compose.ui.Modifier
12
+ import androidx.compose.ui.draw.clip
13
+ import androidx.compose.ui.input.pointer.pointerInput
14
+ import androidx.compose.ui.layout.onGloballyPositioned
15
+ import androidx.compose.ui.platform.LocalDensity
16
+ import androidx.compose.ui.text.style.TextAlign
17
+ import androidx.compose.ui.unit.IntOffset
18
+ import androidx.compose.ui.unit.dp
19
+ import vn.momo.kits.application.IsShowBaseLineDebug
20
+ import vn.momo.kits.const.*
21
+ import vn.momo.kits.modifier.conditional
22
+ import kotlin.math.abs
23
+ import kotlin.math.min
24
+ import kotlin.math.roundToInt
25
+
26
+ private val THUMB_SIZE = 20.dp
27
+ private val THUMB_BORDER = 3.dp
28
+ private val TRACK_HEIGHT = 4.dp
29
+ private val LABEL_PAD_H = Spacing.XS
30
+ private val LABEL_PAD_V = Spacing.XXS
31
+ private val LABEL_GAP = Spacing.XS // space between label and thumb top
32
+
33
+
34
+ private fun clamp(value: Float, min: Float, max: Float): Float =
35
+ min(kotlin.math.max(value, min), max)
36
+
37
+ private fun getValueForPosition(
38
+ positionInView: Float,
39
+ containerWidth: Float,
40
+ thumbWidth: Float,
41
+ min: Float,
42
+ max: Float,
43
+ step: Float,
44
+ ): Float {
45
+ val availableSpace = containerWidth - thumbWidth
46
+ if (availableSpace <= 0f || max <= min) return min
47
+ var relPosition = (positionInView - thumbWidth / 2f) / availableSpace
48
+ // A zero step would make the snap math NaN, and NaN.roundToInt() throws.
49
+ if (step <= 0f) return clamp(min + relPosition * (max - min), min, max)
50
+ val relStepUnit = step / (max - min)
51
+ val relOffset = relPosition % relStepUnit
52
+ relPosition -= relOffset
53
+ if (relOffset / relStepUnit >= 0.5f) relPosition += relStepUnit
54
+ return clamp(min + (relPosition / relStepUnit).roundToInt() * step, min, max)
55
+ }
56
+
57
+ /** Direct port of RN isLowCloser(). */
58
+ private fun isLowCloser(downX: Float, lowPosition: Float, highPosition: Float): Boolean {
59
+ if (lowPosition == highPosition) return downX < lowPosition
60
+ return abs(downX - lowPosition) < abs(downX - highPosition)
61
+ }
62
+
63
+ private fun valueToFraction(value: Float, min: Float, max: Float): Float {
64
+ if (max == min) return 0f
65
+ return clamp((value - min) / (max - min), 0f, 1f)
66
+ }
67
+
68
+ private fun formatLabel(value: Float): String =
69
+ if (value == value.toLong().toFloat()) value.toLong().toString()
70
+ else ((value * 10).toLong() / 10.0).toString()
71
+
72
+ // ── Component ─────────────────────────────────────────────────────────────────
73
+
74
+ /**
75
+ * Range slider (or single-thumb when [disableRange] = true), migrated from React Native.
76
+ *
77
+ * @param min Minimum selectable value.
78
+ * @param max Maximum selectable value.
79
+ * @param step Snap increment between values.
80
+ * @param modifier Modifier applied to the root container.
81
+ * @param low Initial lower-thumb value (defaults to [min]).
82
+ * @param high Initial upper-thumb value (defaults to [max]).
83
+ * @param minRange Minimum required gap between low and high (default 0).
84
+ * @param disableRange When true only the low thumb is shown (single-value mode).
85
+ * @param floatingLabel When true a value label floats above the active thumb during drag.
86
+ * @param disabled Non-interactive; rendered in the disabled colour.
87
+ * @param onValueChanged Invoked with (low, high, byUser) on every value change.
88
+ * @param onSliderTouchStart Invoked when a drag gesture begins.
89
+ * @param onSliderTouchEnd Invoked when a drag gesture ends.
90
+ */
91
+ @Composable
92
+ fun Slider(
93
+ min: Float,
94
+ max: Float,
95
+ step: Float,
96
+ modifier: Modifier = Modifier,
97
+ low: Float? = null,
98
+ high: Float? = null,
99
+ minRange: Float = 0f,
100
+ disableRange: Boolean = false,
101
+ floatingLabel: Boolean = false,
102
+ disabled: Boolean = false,
103
+ onValueChanged: (low: Float, high: Float, byUser: Boolean) -> Unit = { _, _, _ -> },
104
+ onSliderTouchStart: (low: Float, high: Float) -> Unit = { _, _ -> },
105
+ onSliderTouchEnd: (low: Float, high: Float) -> Unit = { _, _ -> },
106
+ ) {
107
+ val theme = AppTheme.current
108
+ val density = LocalDensity.current
109
+
110
+ // Validated, step-snapped initial values
111
+ val initLow = remember(low, min, max, step) {
112
+ clamp(low ?: min, min, max)
113
+ }
114
+ val initHigh = remember(high, min, max, step, disableRange) {
115
+ if (disableRange) max else clamp(high ?: max, min, max)
116
+ }
117
+
118
+ var lowValue by remember { mutableFloatStateOf(initLow) }
119
+ var highValue by remember { mutableFloatStateOf(initHigh) }
120
+
121
+ // Smoothly animated display fractions
122
+ val lowFraction by animateFloatAsState(
123
+ targetValue = valueToFraction(lowValue, min, max),
124
+ animationSpec = spring(stiffness = 1200f),
125
+ label = "lowFraction"
126
+ )
127
+ val highFraction by animateFloatAsState(
128
+ targetValue = valueToFraction(highValue, min, max),
129
+ animationSpec = spring(stiffness = 1200f),
130
+ label = "highFraction"
131
+ )
132
+
133
+ var draggingLow by remember { mutableStateOf(true) }
134
+ var isDragging by remember { mutableStateOf(false) }
135
+
136
+ // pointerInput is not keyed on the callbacks, so read their latest values.
137
+ val currentOnValueChanged by rememberUpdatedState(onValueChanged)
138
+ val currentOnTouchStart by rememberUpdatedState(onSliderTouchStart)
139
+ val currentOnTouchEnd by rememberUpdatedState(onSliderTouchEnd)
140
+
141
+ val thumbColor = if (disabled) theme.colors.text.disable else theme.colors.primary
142
+ val trackActiveColor = if (disabled) theme.colors.text.disable else theme.colors.primary
143
+ val trackInactiveColor = theme.colors.background.default
144
+
145
+ // trackWidthPx is the full pixel width of the BoxWithConstraints (incl. thumb padding)
146
+ var trackWidthPx by remember { mutableFloatStateOf(0f) }
147
+ val thumbSizePx = with(density) { THUMB_SIZE.toPx() }
148
+
149
+ Box(
150
+ modifier = modifier
151
+ .fillMaxWidth()
152
+ .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) }
153
+ ) {
154
+ BoxWithConstraints(
155
+ modifier = Modifier
156
+ .fillMaxWidth()
157
+ .onGloballyPositioned { coords -> trackWidthPx = coords.size.width.toFloat() }
158
+ // ── Gesture handling ──────────────────────────────────────────
159
+ .pointerInput(disabled, min, max, step, minRange, disableRange) {
160
+ if (disabled) return@pointerInput
161
+
162
+ awaitPointerEventScope {
163
+ while (true) {
164
+ // Finger down
165
+ val downEvent = awaitPointerEvent()
166
+ val downChange = downEvent.changes.firstOrNull() ?: continue
167
+ val touchX = downChange.position.x
168
+
169
+ // Pick the closer thumb
170
+ val lowCenterX = thumbSizePx / 2f +
171
+ valueToFraction(lowValue, min, max) * (trackWidthPx - thumbSizePx)
172
+ val highCenterX = thumbSizePx / 2f +
173
+ valueToFraction(highValue, min, max) * (trackWidthPx - thumbSizePx)
174
+
175
+ draggingLow = disableRange || isLowCloser(touchX, lowCenterX, highCenterX)
176
+ isDragging = true
177
+ currentOnTouchStart(lowValue, highValue)
178
+
179
+ // Apply initial press
180
+ applyDrag(touchX, trackWidthPx, thumbSizePx,
181
+ min, max, step, minRange, draggingLow,
182
+ lowValue, highValue) { nl, nh ->
183
+ lowValue = nl
184
+ highValue = nh
185
+ currentOnValueChanged(nl, nh, true)
186
+ }
187
+
188
+ // Track move / release
189
+ while (true) {
190
+ val moveEvent = awaitPointerEvent()
191
+ val moveChange = moveEvent.changes.firstOrNull() ?: break
192
+ moveChange.consume()
193
+
194
+ if (!moveChange.pressed) {
195
+ isDragging = false
196
+ currentOnTouchEnd(lowValue, highValue)
197
+ break
198
+ }
199
+
200
+ applyDrag(moveChange.position.x, trackWidthPx, thumbSizePx,
201
+ min, max, step, minRange, draggingLow,
202
+ lowValue, highValue) { nl, nh ->
203
+ lowValue = nl
204
+ highValue = nh
205
+ currentOnValueChanged(nl, nh, true)
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
211
+ ) {
212
+ val trackWidth = maxWidth
213
+ val availableWidth = trackWidth - THUMB_SIZE
214
+
215
+ // ── Floating label ────────────────────────────────────────────────
216
+ if (floatingLabel && isDragging) {
217
+ val activeFraction = if (draggingLow) lowFraction else highFraction
218
+ val activeValue = if (draggingLow) lowValue else highValue
219
+ val labelOffsetDp = availableWidth * activeFraction
220
+
221
+ Box(
222
+ modifier = Modifier
223
+ .align(Alignment.TopStart)
224
+ .offset { IntOffset(x = with(density) { labelOffsetDp.toPx().roundToInt() }, y = 0) }
225
+ ) {
226
+ Box(
227
+ modifier = Modifier
228
+ .background(
229
+ color = Colors.black_01,
230
+ shape = RoundedCornerShape(Radius.XS)
231
+ )
232
+ .padding(horizontal = LABEL_PAD_H, vertical = LABEL_PAD_V)
233
+ ) {
234
+ Text(
235
+ text = formatLabel(activeValue),
236
+ style = Typography.descriptionXsRegular,
237
+ color = theme.colors.text.default,
238
+ textAlign = TextAlign.Center
239
+ )
240
+ }
241
+ }
242
+ }
243
+
244
+ // Top padding pushes track + thumbs below the label when floatingLabel is on
245
+ val topPad = if (floatingLabel) THUMB_SIZE + LABEL_GAP else 0.dp
246
+
247
+ // ── Inactive track (full width) ───────────────────────────────────
248
+ Box(
249
+ modifier = Modifier
250
+ .align(Alignment.TopStart)
251
+ .padding(top = topPad + (THUMB_SIZE - TRACK_HEIGHT) / 2)
252
+ .padding(horizontal = THUMB_SIZE / 2)
253
+ .fillMaxWidth()
254
+ .height(TRACK_HEIGHT)
255
+ .clip(RoundedCornerShape(percent = 50))
256
+ .background(trackInactiveColor)
257
+ )
258
+
259
+ // ── Active track (selected range / single value) ──────────────────
260
+ val activeStartFraction = if (disableRange) 0f else lowFraction
261
+ val activeEndFraction = if (disableRange) lowFraction else highFraction
262
+ val activeStartDp = THUMB_SIZE / 2 + availableWidth * activeStartFraction
263
+ val activeWidthDp = availableWidth * (activeEndFraction - activeStartFraction)
264
+
265
+ if (activeWidthDp > 0.dp) {
266
+ Box(
267
+ modifier = Modifier
268
+ .align(Alignment.TopStart)
269
+ .padding(top = topPad + (THUMB_SIZE - TRACK_HEIGHT) / 2)
270
+ .offset(x = activeStartDp)
271
+ .width(activeWidthDp)
272
+ .height(TRACK_HEIGHT)
273
+ .clip(RoundedCornerShape(percent = 50))
274
+ .background(trackActiveColor)
275
+ )
276
+ }
277
+
278
+ // ── Low thumb ─────────────────────────────────────────────────────
279
+ Box(
280
+ modifier = Modifier
281
+ .align(Alignment.TopStart)
282
+ .padding(top = topPad)
283
+ .offset(x = availableWidth * lowFraction)
284
+ .size(THUMB_SIZE)
285
+ .clip(RoundedCornerShape(percent = 100))
286
+ .background(thumbColor)
287
+ .border(THUMB_BORDER, theme.colors.background.surface, RoundedCornerShape(percent = 100))
288
+ )
289
+
290
+ // ── High thumb (range mode only) ──────────────────────────────────
291
+ if (!disableRange) {
292
+ Box(
293
+ modifier = Modifier
294
+ .align(Alignment.TopStart)
295
+ .padding(top = topPad)
296
+ .offset(x = availableWidth * highFraction)
297
+ .size(THUMB_SIZE)
298
+ .clip(RoundedCornerShape(percent = 100))
299
+ .background(thumbColor)
300
+ .border(THUMB_BORDER, theme.colors.background.surface, RoundedCornerShape(percent = 100))
301
+ )
302
+ }
303
+ }
304
+ }
305
+ }
306
+
307
+ // ── Private drag helper ───────────────────────────────────────────────────────
308
+
309
+ private fun applyDrag(
310
+ positionX: Float,
311
+ trackWidthPx: Float,
312
+ thumbSizePx: Float,
313
+ min: Float,
314
+ max: Float,
315
+ step: Float,
316
+ minRange: Float,
317
+ isLow: Boolean,
318
+ currentLow: Float,
319
+ currentHigh: Float,
320
+ onUpdate: (Float, Float) -> Unit,
321
+ ) {
322
+ val snapped = getValueForPosition(positionX, trackWidthPx, thumbSizePx, min, max, step)
323
+ if (isLow) {
324
+ val newLow = clamp(snapped, min, currentHigh - minRange)
325
+ if (newLow != currentLow) onUpdate(newLow, currentHigh)
326
+ } else {
327
+ val newHigh = clamp(snapped, currentLow + minRange, max)
328
+ if (newHigh != currentHigh) onUpdate(currentLow, newHigh)
329
+ }
330
+ }
@@ -0,0 +1,220 @@
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.*
6
+ import androidx.compose.foundation.shape.CircleShape
7
+ import androidx.compose.foundation.shape.RoundedCornerShape
8
+ import androidx.compose.foundation.text.BasicTextField
9
+ import androidx.compose.foundation.text.KeyboardOptions
10
+ import androidx.compose.runtime.*
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.TextStyle
15
+ import androidx.compose.ui.text.font.FontWeight
16
+ import androidx.compose.ui.text.input.KeyboardType
17
+ import androidx.compose.ui.text.style.TextAlign
18
+ import androidx.compose.ui.unit.Dp
19
+ import androidx.compose.ui.unit.dp
20
+ import androidx.compose.ui.unit.sp
21
+ import vn.momo.kits.application.IsShowBaseLineDebug
22
+ import vn.momo.kits.const.*
23
+ import vn.momo.kits.const.getFontFamily
24
+ import vn.momo.kits.modifier.activeOpacityClickable
25
+ import vn.momo.kits.modifier.conditional
26
+
27
+ enum class StepperSize {
28
+ LARGE,
29
+ SMALL
30
+ }
31
+
32
+ private data class StepperSizeSpec(
33
+ val buttonSize: Dp,
34
+ val iconSize: Dp,
35
+ val numberMinWidth: Dp,
36
+ val numberHeight: Dp,
37
+ )
38
+
39
+ private val stepperSizeSpecs: Map<StepperSize, StepperSizeSpec> = mapOf(
40
+ StepperSize.LARGE to StepperSizeSpec(
41
+ buttonSize = 36.dp,
42
+ iconSize = 22.dp,
43
+ numberMinWidth = 32.dp,
44
+ numberHeight = 28.dp,
45
+ ),
46
+ StepperSize.SMALL to StepperSizeSpec(
47
+ buttonSize = 28.dp,
48
+ iconSize = 18.dp,
49
+ numberMinWidth = 28.dp,
50
+ numberHeight = 24.dp,
51
+ ),
52
+ )
53
+
54
+ @Composable
55
+ private fun StepperButton(
56
+ sign: String = "+",
57
+ size: StepperSize = StepperSize.LARGE,
58
+ disabled: Boolean = false,
59
+ onPress: () -> Unit = {},
60
+ modifier: Modifier = Modifier,
61
+ ) {
62
+ val theme = AppTheme.current
63
+ val specs = remember(size) { stepperSizeSpecs[size] ?: stepperSizeSpecs[StepperSize.LARGE]!! }
64
+
65
+ val iconColor: Color = if (disabled) theme.colors.text.disable else theme.colors.primary
66
+ val iconName: String =
67
+ if (sign == "-") "24_navigation_minus_circle" else "24_navigation_plus_circle"
68
+
69
+ val clickableModifier: Modifier = if (!disabled) {
70
+ Modifier.activeOpacityClickable(onClick = onPress)
71
+ } else {
72
+ Modifier
73
+ }
74
+
75
+ Box(
76
+ modifier = modifier
77
+ .size(specs.buttonSize)
78
+ .background(color = theme.colors.background.disable, shape = CircleShape)
79
+ .then(clickableModifier)
80
+ .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
81
+ contentAlignment = Alignment.Center,
82
+ ) {
83
+ Icon(
84
+ source = iconName,
85
+ size = specs.iconSize,
86
+ color = iconColor,
87
+ )
88
+ }
89
+ }
90
+
91
+ @Composable
92
+ private fun StepperNumberView(
93
+ value: Int,
94
+ size: StepperSize = StepperSize.LARGE,
95
+ disabled: Boolean = false,
96
+ editable: Boolean = false,
97
+ onValueChange: (String) -> Unit = {},
98
+ modifier: Modifier = Modifier,
99
+ ) {
100
+ val theme = AppTheme.current
101
+ val specs = remember(size) { stepperSizeSpecs[size] ?: stepperSizeSpecs[StepperSize.LARGE]!! }
102
+
103
+ val textColor: Color = if (disabled) theme.colors.text.disable else theme.colors.text.default
104
+ val borderColor: Color =
105
+ if (disabled) theme.colors.border.disable else theme.colors.border.default
106
+
107
+ val scaledFontSize = scaleSize(12.sp)
108
+
109
+ val textStyle = TextStyle(
110
+ color = textColor,
111
+ fontSize = scaledFontSize,
112
+ textAlign = TextAlign.Center,
113
+ fontFamily = getFontFamily(theme.font, FontWeight.Normal),
114
+ )
115
+
116
+ Box(
117
+ modifier = modifier
118
+ .defaultMinSize(minWidth = specs.numberMinWidth)
119
+ .height(specs.numberHeight)
120
+ .border(
121
+ width = 1.dp,
122
+ color = borderColor,
123
+ shape = RoundedCornerShape(Radius.S),
124
+ )
125
+ .padding(horizontal = Spacing.XS)
126
+ .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
127
+ contentAlignment = Alignment.Center,
128
+ ) {
129
+ BasicTextField(
130
+ value = value.toString(),
131
+ onValueChange = { if (editable) onValueChange(it) },
132
+ enabled = editable && !disabled,
133
+ readOnly = !editable,
134
+ singleLine = true,
135
+ textStyle = textStyle,
136
+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
137
+ decorationBox = { innerTextField -> innerTextField() },
138
+ )
139
+ }
140
+ }
141
+
142
+ @Composable
143
+ fun Stepper(
144
+ defaultValue: Int = 0,
145
+ min: Int = 0,
146
+ max: Int = 100,
147
+ step: Int = 1,
148
+ disabled: Any = false,
149
+ size: StepperSize = StepperSize.LARGE,
150
+ editable: Boolean = false,
151
+ onValueChange: (Int) -> Unit = {},
152
+ modifier: Modifier = Modifier,
153
+ ) {
154
+ var value by remember(defaultValue) { mutableStateOf(defaultValue.coerceIn(min, max)) }
155
+
156
+ fun applyValue(raw: String) {
157
+ var parsed = raw.toIntOrNull() ?: 0
158
+ parsed = parsed.coerceIn(min, max)
159
+ value = parsed
160
+ onValueChange(parsed)
161
+ }
162
+
163
+ // Resolve per-part disabled state — mirrors RN getViewDisabledStatus()
164
+ val disabledMinus: Boolean
165
+ val disabledPlus: Boolean
166
+ val disabledNumber: Boolean
167
+
168
+ when (disabled) {
169
+ is BooleanArray if disabled.size >= 2 -> {
170
+ disabledMinus = disabled[0]
171
+ disabledPlus = disabled[1]
172
+ disabledNumber = disabled[0] && disabled[1]
173
+ }
174
+
175
+ is Boolean if disabled -> {
176
+ disabledMinus = true
177
+ disabledPlus = true
178
+ disabledNumber = true
179
+ }
180
+
181
+ else -> {
182
+ disabledMinus = false
183
+ disabledPlus = false
184
+ disabledNumber = false
185
+ }
186
+ }
187
+
188
+ // Auto-disable buttons when the value is already at a bound
189
+ val effectiveMinusDisabled = disabledMinus || value <= min
190
+ val effectivePlusDisabled = disabledPlus || value >= max
191
+
192
+ Row(
193
+ modifier = modifier
194
+ .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) },
195
+ verticalAlignment = Alignment.CenterVertically,
196
+ ) {
197
+ StepperButton(
198
+ sign = "-",
199
+ size = size,
200
+ disabled = effectiveMinusDisabled,
201
+ onPress = { applyValue((value - step).toString()) },
202
+ )
203
+
204
+ StepperNumberView(
205
+ value = value,
206
+ size = size,
207
+ disabled = disabledNumber,
208
+ editable = editable,
209
+ onValueChange = { applyValue(it) },
210
+ modifier = Modifier.padding(horizontal = Spacing.S),
211
+ )
212
+
213
+ StepperButton(
214
+ sign = "+",
215
+ size = size,
216
+ disabled = effectivePlusDisabled,
217
+ onPress = { applyValue((value + step).toString()) },
218
+ )
219
+ }
220
+ }