@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.
- package/CLAUDE.md +1 -1
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +190 -0
- package/compose/build.gradle.kts.backup +190 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +150 -0
- package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
- package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +106 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +183 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +294 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +826 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +110 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +378 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +82 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +356 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +113 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +231 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +112 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +477 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +214 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +240 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +216 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +259 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +328 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +97 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +310 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +323 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +217 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +199 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +470 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +88 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +131 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +203 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +234 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +276 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +65 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +253 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +129 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +100 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +172 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +360 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +581 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +156 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +225 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +320 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +81 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +309 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +34 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +360 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +128 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +91 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +69 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +105 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +207 -0
- package/gradle/libs.versions.toml +69 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +26 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/Application/ApplicationEnvironment.swift +15 -2
- package/ios/Application/Components.swift +50 -44
- package/ios/Application/FloatingButton.swift +10 -9
- package/ios/Application/HeaderRight.swift +79 -45
- package/ios/Application/Localize.swift +277 -0
- package/ios/Application/MaxApi.swift +18 -0
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +104 -0
- package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
- package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
- package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
- package/ios/Application/Navigation/HeaderTitle.swift +57 -0
- package/ios/Application/Navigation/HeaderUser.swift +209 -0
- package/ios/Application/Navigation/NavigationContainer.swift +200 -0
- package/ios/Application/Navigation/NavigationOptions.swift +109 -0
- package/ios/Application/Navigation/Navigator.swift +385 -0
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +256 -0
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +74 -0
- package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
- package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
- package/ios/Application/Navigation/component/Header.swift +178 -0
- package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
- package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
- package/ios/Application/Screen.swift +2 -1
- package/ios/Application/StackScreen.swift +501 -0
- package/ios/Avatar/Avatar.swift +193 -0
- package/ios/Badge/Badge.swift +11 -14
- package/ios/Badge/BadgeRibbon.swift +92 -21
- package/ios/BaselineView/BaselineView.swift +163 -0
- package/ios/Button/Button.swift +124 -29
- package/ios/Carousel/Carousel.swift +196 -0
- package/ios/Checkbox/Checkbox.swift +23 -28
- package/ios/Chip/Chip.swift +56 -33
- package/ios/Collapse/Collapse.swift +192 -0
- package/ios/Colors+Radius+Spacing/Colors.swift +20 -17
- package/ios/Colors+Radius+Spacing/Spacing.swift +3 -1
- package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
- package/ios/DateTimePicker/DateTimePicker.swift +212 -0
- package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
- package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
- package/ios/DateTimePicker/WheelPicker.swift +165 -0
- package/ios/Divider/Divider.swift +16 -0
- package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
- package/ios/Extensions/Color++.swift +32 -0
- package/ios/Icon/Icon.swift +10 -1
- package/ios/IconButton/IconButton.swift +140 -0
- package/ios/Image/Image.swift +16 -3
- package/ios/Information/Information.swift +3 -1
- package/ios/Input/ErrorView.swift +3 -1
- package/ios/Input/Input.swift +72 -33
- package/ios/Input/InputPhoneNumber.swift +33 -21
- package/ios/Input/InputSearch.swift +107 -48
- package/ios/Input/InputTextArea.swift +134 -64
- package/ios/InputDropDown/InputDropDown.swift +201 -0
- package/ios/InputMoney/InputMoney.swift +347 -0
- package/ios/InputOTP/InputOTP.swift +210 -0
- package/ios/Loader/Loader.swift +113 -0
- package/ios/MoMoUIKits.podspec +5 -0
- package/ios/Pagination/PaginationDot.swift +61 -0
- package/ios/Pagination/PaginationNumber.swift +35 -0
- package/ios/Pagination/PaginationScroll.swift +101 -0
- package/ios/Pagination/PaginationWhiteDot.swift +37 -0
- package/ios/Popup/PopupDisplay.swift +11 -20
- package/ios/Popup/PopupInput.swift +2 -8
- package/ios/Popup/PopupNotify.swift +218 -0
- package/ios/Popup/PopupPromotion.swift +16 -8
- package/ios/ProgressInfo/ProgressInfo.swift +296 -0
- package/ios/Radio/Radio.swift +69 -0
- package/ios/Rating/Rating.swift +82 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Background.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Border.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Card.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Contents.json +6 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Error.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryDark.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryLight.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Success.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Text.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/TextSecondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +9 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Warning.colorset/Contents.json +38 -0
- package/ios/Skeleton/Skeleton.swift +99 -0
- package/ios/Slider/Slider.swift +237 -0
- package/ios/Stepper/Stepper.swift +220 -0
- package/ios/Steps/Steps.swift +467 -0
- package/ios/SuggestAction/SuggestAction.swift +99 -0
- package/ios/Swipeable/SwipeCell.swift +187 -0
- package/ios/Swipeable/SwipeCellModel.swift +21 -0
- package/ios/Switch/Switch.swift +53 -28
- package/ios/TabView/TabView.swift +534 -0
- package/ios/Tag/Tag.swift +98 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +6 -7
- package/ios/Title/Title.swift +269 -0
- package/ios/Tooltip/Tooltip.swift +485 -0
- package/ios/Typography/FontScaleStore.swift +19 -0
- package/ios/Typography/Text.swift +79 -5
- package/ios/Typography/Typography.swift +3 -0
- package/ios/Uploader/Uploader.swift +174 -0
- package/ios/native-kits.podspec +61 -8
- package/ios-demo/MoMoUIKitsDemo.podspec +20 -0
- package/ios-demo/README.md +120 -0
- package/ios-demo/Resources/dot_loading.json +558 -0
- package/ios-demo/Resources/icon.json +4052 -0
- package/ios-demo/Resources/lottie_circle_loader.json +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +24 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +269 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +126 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +63 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +20 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +124 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +14 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +279 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +58 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +78 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +138 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +111 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +136 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +73 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +57 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +70 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +188 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +229 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +72 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +121 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +76 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +89 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +56 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +150 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +138 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +103 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +94 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +79 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +152 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +33 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +190 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +34 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +182 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +109 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +187 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +131 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +51 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
- package/local.properties +8 -0
- package/package.json +1 -1
- package/publish.sh +53 -0
- package/scripts/gen-ios-color.mjs +136 -0
- package/settings.gradle.kts +64 -0
- package/.claude/settings.local.json +0 -62
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
package vn.momo.kits.application
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.core.Animatable
|
|
4
|
+
import androidx.compose.animation.core.animateFloatAsState
|
|
5
|
+
import androidx.compose.animation.core.tween
|
|
6
|
+
import androidx.compose.foundation.ScrollState
|
|
7
|
+
import androidx.compose.foundation.background
|
|
8
|
+
import androidx.compose.foundation.gestures.detectTapGestures
|
|
9
|
+
import androidx.compose.foundation.layout.*
|
|
10
|
+
import androidx.compose.foundation.rememberScrollState
|
|
11
|
+
import androidx.compose.foundation.verticalScroll
|
|
12
|
+
import androidx.compose.runtime.*
|
|
13
|
+
import androidx.compose.ui.Alignment
|
|
14
|
+
import androidx.compose.ui.Modifier
|
|
15
|
+
import androidx.compose.ui.graphics.Color
|
|
16
|
+
import androidx.compose.ui.input.pointer.pointerInput
|
|
17
|
+
import androidx.compose.ui.layout.LayoutCoordinates
|
|
18
|
+
import androidx.compose.ui.layout.onGloballyPositioned
|
|
19
|
+
import androidx.compose.ui.platform.LocalDensity
|
|
20
|
+
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
21
|
+
import androidx.compose.ui.unit.Dp
|
|
22
|
+
import androidx.compose.ui.unit.IntOffset
|
|
23
|
+
import androidx.compose.ui.unit.dp
|
|
24
|
+
import androidx.compose.ui.zIndex
|
|
25
|
+
import kotlinx.coroutines.*
|
|
26
|
+
import vn.momo.kits.components.InputSearchProps
|
|
27
|
+
import vn.momo.kits.const.AppNavigationBar
|
|
28
|
+
import vn.momo.kits.const.AppTheme
|
|
29
|
+
import vn.momo.kits.const.Colors
|
|
30
|
+
import vn.momo.kits.const.Spacing
|
|
31
|
+
import vn.momo.kits.modifier.conditional
|
|
32
|
+
import vn.momo.kits.modifier.DeprecatedModifier
|
|
33
|
+
import vn.momo.kits.modifier.shadow
|
|
34
|
+
import vn.momo.kits.navigation.component.SnackBar
|
|
35
|
+
import vn.momo.kits.platform.supportsImePadding
|
|
36
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
37
|
+
import vn.momo.kits.utils.getNavigationBarHeight
|
|
38
|
+
import kotlin.time.Duration.Companion.milliseconds
|
|
39
|
+
|
|
40
|
+
enum class HeaderType {
|
|
41
|
+
DEFAULT,
|
|
42
|
+
EXTENDED,
|
|
43
|
+
NONE
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const val HEADER_HEIGHT = 52
|
|
47
|
+
|
|
48
|
+
@Deprecated("Use NavigationContainer(StackScreen) instead", ReplaceWith("NavigationContainer(StackScreen)"))
|
|
49
|
+
@Composable
|
|
50
|
+
fun Screen(
|
|
51
|
+
backgroundColor: Color? = null,
|
|
52
|
+
tintColor: Color? = null,
|
|
53
|
+
headerTransparent: Boolean = false,
|
|
54
|
+
fullScreenContent: Boolean = false,
|
|
55
|
+
isBack: Boolean = true,
|
|
56
|
+
headerType: HeaderType = HeaderType.DEFAULT,
|
|
57
|
+
verticalArrangement: Arrangement.Vertical = Arrangement.Top,
|
|
58
|
+
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
|
|
59
|
+
title: String = "Stack",
|
|
60
|
+
titlePosition: TitlePosition = TitlePosition.LEFT,
|
|
61
|
+
goBack: (() -> Unit)? = null,
|
|
62
|
+
scrollable: Boolean = true,
|
|
63
|
+
scrollState: ScrollState = rememberScrollState(),
|
|
64
|
+
onContentLayout: ((LayoutCoordinates) -> Unit)? = null,
|
|
65
|
+
useAvoidKeyboard: Boolean = true,
|
|
66
|
+
footer: @Composable (() -> Unit)? = null,
|
|
67
|
+
headerRight: @Composable (() -> Unit)? = null,
|
|
68
|
+
fabProps: FabProps? = null,
|
|
69
|
+
animatedHeader: AnimatedHeader? = null,
|
|
70
|
+
layoutOffset: Dp = 56.dp,
|
|
71
|
+
inputSearchProps: InputSearchProps? = null,
|
|
72
|
+
useAnimationSearch: Boolean = false,
|
|
73
|
+
headerRightWidth: Dp = 0.dp,
|
|
74
|
+
content: @Composable () -> Unit,
|
|
75
|
+
) {
|
|
76
|
+
val statusBarHeight = getAppStatusBarHeight()
|
|
77
|
+
val keyboardController = LocalSoftwareKeyboardController.current
|
|
78
|
+
|
|
79
|
+
val isKeyboardVisible = isKeyboardVisible()
|
|
80
|
+
val indicator = getNavigationBarHeight()
|
|
81
|
+
val bottomPadding = if (isKeyboardVisible) 0.dp else indicator
|
|
82
|
+
|
|
83
|
+
val headerHeight = if (animatedHeader !== null)
|
|
84
|
+
with(LocalDensity.current) { layoutOffset.roundToPx() }
|
|
85
|
+
else HEADER_HEIGHT
|
|
86
|
+
val opacity by animateFloatAsState(
|
|
87
|
+
targetValue = ((scrollState.value.toFloat() / headerHeight)).coerceIn(0f, 1f),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
val headerAnimated =
|
|
91
|
+
@Composable {
|
|
92
|
+
Box(
|
|
93
|
+
modifier = Modifier
|
|
94
|
+
.fillMaxWidth()
|
|
95
|
+
.aspectRatio(animatedHeader?.aspectRatio?.value ?: AnimatedHeaderRatio.RATIO_16_9.value)
|
|
96
|
+
) {
|
|
97
|
+
animatedHeader?.composable?.invoke(scrollState.value)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
val helper = remember { ScreenHelper() }
|
|
101
|
+
|
|
102
|
+
DisposableEffect(Unit) {
|
|
103
|
+
onDispose { helper.dispose() }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
CompositionLocalProvider(
|
|
107
|
+
LocalScreenHelper provides helper
|
|
108
|
+
) {
|
|
109
|
+
Box(
|
|
110
|
+
Modifier.fillMaxSize()
|
|
111
|
+
.background(backgroundColor ?: AppTheme.current.colors.background.default)
|
|
112
|
+
.conditional(useAvoidKeyboard && supportsImePadding()) {
|
|
113
|
+
imePadding()
|
|
114
|
+
}.then(DeprecatedModifier())
|
|
115
|
+
) {
|
|
116
|
+
val footerHeightPx = remember { mutableStateOf(0) }
|
|
117
|
+
|
|
118
|
+
Box(Modifier.zIndex(1f)) {
|
|
119
|
+
if (animatedHeader === null) {
|
|
120
|
+
HeaderBackground(
|
|
121
|
+
headerType = headerType,
|
|
122
|
+
scrollState = scrollState.value,
|
|
123
|
+
headerTransparent = headerTransparent
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
Box(Modifier.zIndex(5f)) {
|
|
129
|
+
Header(
|
|
130
|
+
headerType = headerType,
|
|
131
|
+
title = title,
|
|
132
|
+
titlePosition = titlePosition,
|
|
133
|
+
headerRight = headerRight,
|
|
134
|
+
headerRightWidth = headerRightWidth,
|
|
135
|
+
goBack = goBack,
|
|
136
|
+
opacity = opacity,
|
|
137
|
+
animatedHeader = animatedHeader,
|
|
138
|
+
inputSearchProps = inputSearchProps,
|
|
139
|
+
scrollState = scrollState.value,
|
|
140
|
+
useAnimationSearch = useAnimationSearch,
|
|
141
|
+
tintColor = tintColor
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
Box(Modifier.zIndex(2f).fillMaxSize()){
|
|
146
|
+
Column(
|
|
147
|
+
modifier = Modifier.fillMaxSize()
|
|
148
|
+
.padding( top = when {
|
|
149
|
+
animatedHeader != null -> 0.dp
|
|
150
|
+
headerType == HeaderType.NONE -> 0.dp
|
|
151
|
+
fullScreenContent -> 0.dp
|
|
152
|
+
else -> statusBarHeight + HEADER_HEIGHT.dp
|
|
153
|
+
})
|
|
154
|
+
.pointerInput(Unit) {
|
|
155
|
+
detectTapGestures(onTap = {
|
|
156
|
+
keyboardController?.hide()
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
.zIndex(1f),
|
|
160
|
+
) {
|
|
161
|
+
|
|
162
|
+
Column(
|
|
163
|
+
modifier = Modifier
|
|
164
|
+
.conditional(scrollable) { weight(1f) }
|
|
165
|
+
.conditional(onContentLayout != null) {
|
|
166
|
+
onGloballyPositioned(onContentLayout ?: {})
|
|
167
|
+
}
|
|
168
|
+
.conditional(scrollable) { verticalScroll(scrollState) },
|
|
169
|
+
verticalArrangement = verticalArrangement,
|
|
170
|
+
horizontalAlignment = horizontalAlignment
|
|
171
|
+
) {
|
|
172
|
+
Box {
|
|
173
|
+
if (animatedHeader !== null) headerAnimated()
|
|
174
|
+
Column {
|
|
175
|
+
if (animatedHeader !== null) {
|
|
176
|
+
Spacer(modifier = Modifier.padding(top = statusBarHeight + HEADER_HEIGHT.dp + layoutOffset))
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (useAnimationSearch && inputSearchProps != null && headerType == HeaderType.EXTENDED) {
|
|
180
|
+
Spacer(modifier = Modifier.padding(top = (HEADER_HEIGHT.dp + Spacing.S)))
|
|
181
|
+
}
|
|
182
|
+
content()
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
footer?.let {
|
|
188
|
+
val footerHeight = with(LocalDensity.current) { footerHeightPx.value.toDp() }
|
|
189
|
+
Spacer(Modifier.height(footerHeight))
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
Box(Modifier.zIndex(4f).align(Alignment.BottomCenter)) {
|
|
195
|
+
footer?.let {
|
|
196
|
+
Footer(
|
|
197
|
+
footer = footer,
|
|
198
|
+
bottom = bottomPadding,
|
|
199
|
+
onFooterMeasured = { footerHeightPx.value = it }
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
Column (Modifier.zIndex(6f)) {
|
|
205
|
+
if (fabProps != null) {
|
|
206
|
+
FloatingButton(
|
|
207
|
+
scrollPosition = fabProps.scrollState?.value ?: scrollState.value,
|
|
208
|
+
onClick = fabProps.onClick,
|
|
209
|
+
containerColor = AppTheme.current.colors.primary,
|
|
210
|
+
bottom = fabProps.bottom
|
|
211
|
+
?: if (footer != null) bottomPadding + 76.dp else bottomPadding + 12.dp,
|
|
212
|
+
icon = fabProps.icon,
|
|
213
|
+
iconColor = fabProps.iconColor,
|
|
214
|
+
text = fabProps.label,
|
|
215
|
+
size = fabProps.size,
|
|
216
|
+
position = fabProps.position ?: FABPosition.END,
|
|
217
|
+
)
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
Box(
|
|
222
|
+
modifier = Modifier
|
|
223
|
+
.align(Alignment.BottomCenter)
|
|
224
|
+
.zIndex(3f)
|
|
225
|
+
) {
|
|
226
|
+
ScreenSnackBarHost(if (footer == null) 0 else footerHeightPx.value)
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@Composable
|
|
233
|
+
internal fun isKeyboardVisible(): Boolean {
|
|
234
|
+
val ime = WindowInsets.ime
|
|
235
|
+
val density = LocalDensity.current
|
|
236
|
+
val bottom = ime.getBottom(density)
|
|
237
|
+
return bottom > 0
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
@Composable
|
|
241
|
+
fun Footer(
|
|
242
|
+
footer: @Composable (() -> Unit)? = null,
|
|
243
|
+
bottom: Dp = 0.dp,
|
|
244
|
+
onFooterMeasured: ((Int) -> Unit)? = null
|
|
245
|
+
) {
|
|
246
|
+
Box(
|
|
247
|
+
Modifier
|
|
248
|
+
.shadow(
|
|
249
|
+
color = Colors.black_20.copy(alpha = 0.05f),
|
|
250
|
+
blurRadius = 24f,
|
|
251
|
+
offsetX = 0.dp,
|
|
252
|
+
offsetY = (-4).dp
|
|
253
|
+
)
|
|
254
|
+
.background(AppTheme.current.colors.background.surface)
|
|
255
|
+
.onGloballyPositioned {
|
|
256
|
+
onFooterMeasured?.invoke(it.size.height)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
) {
|
|
260
|
+
Box(
|
|
261
|
+
Modifier.fillMaxWidth()
|
|
262
|
+
.padding(bottom = bottom)
|
|
263
|
+
.padding(vertical = Spacing.S, horizontal = Spacing.M)
|
|
264
|
+
) {
|
|
265
|
+
footer?.invoke()
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
class ScreenHelper {
|
|
272
|
+
|
|
273
|
+
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
|
|
274
|
+
|
|
275
|
+
internal var snackBarState by mutableStateOf<SnackBarData?>(null)
|
|
276
|
+
|
|
277
|
+
internal var requestHide by mutableStateOf(false)
|
|
278
|
+
|
|
279
|
+
fun showSnackBar(snackBar: SnackBar, onDismiss: (() -> Unit)? = null) {
|
|
280
|
+
scope.launch {
|
|
281
|
+
requestHide = false
|
|
282
|
+
snackBarState = SnackBarData(snackBar, onDismiss)
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
fun hideSnackBar() {
|
|
287
|
+
scope.launch {
|
|
288
|
+
requestHide = true
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
internal fun removeSnackBarNow() {
|
|
293
|
+
snackBarState = null
|
|
294
|
+
requestHide = false
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
fun dispose() {
|
|
298
|
+
scope.cancel()
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
data class SnackBarData(
|
|
302
|
+
val type: SnackBar,
|
|
303
|
+
val onDismiss: (() -> Unit)?
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
val LocalScreenHelper = staticCompositionLocalOf<ScreenHelper> {
|
|
307
|
+
error("No Screen helper provided")
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
@Composable
|
|
311
|
+
internal fun ScreenSnackBarHost(footerHeightPx: Int) {
|
|
312
|
+
val helper = LocalScreenHelper.current
|
|
313
|
+
val snackBarData = helper.snackBarState ?: return
|
|
314
|
+
val density = LocalDensity.current
|
|
315
|
+
val navigationBar = AppNavigationBar.current
|
|
316
|
+
|
|
317
|
+
val footerHeight = if (footerHeightPx > 0) {
|
|
318
|
+
footerHeightPx
|
|
319
|
+
} else {
|
|
320
|
+
with(density) {
|
|
321
|
+
navigationBar.toPx()
|
|
322
|
+
}
|
|
323
|
+
}.toInt()
|
|
324
|
+
|
|
325
|
+
var startPosition by remember { mutableStateOf(Float.MAX_VALUE) }
|
|
326
|
+
val targetPosition = 0f
|
|
327
|
+
|
|
328
|
+
var offsetY by remember { mutableStateOf(Animatable(startPosition)) }
|
|
329
|
+
|
|
330
|
+
LaunchedEffect(startPosition) {
|
|
331
|
+
if (startPosition != Float.MAX_VALUE){
|
|
332
|
+
offsetY.snapTo(startPosition)
|
|
333
|
+
offsetY.animateTo(targetPosition, tween(350))
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
LaunchedEffect(helper.requestHide) {
|
|
338
|
+
if (helper.requestHide) {
|
|
339
|
+
offsetY.animateTo(startPosition, tween(200))
|
|
340
|
+
helper.removeSnackBarNow()
|
|
341
|
+
snackBarData.onDismiss?.invoke()
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
LaunchedEffect(snackBarData.type.duration) {
|
|
346
|
+
val duration = snackBarData.type.duration
|
|
347
|
+
if (duration != null) {
|
|
348
|
+
delay(duration.milliseconds)
|
|
349
|
+
helper.hideSnackBar()
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
DisposableEffect(Unit) {
|
|
354
|
+
onDispose { snackBarData.onDismiss?.invoke() }
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
Box(
|
|
358
|
+
modifier = Modifier
|
|
359
|
+
.offset { IntOffset(0, offsetY.value.toInt() - footerHeight) }
|
|
360
|
+
.onGloballyPositioned {
|
|
361
|
+
if (startPosition != it.size.height.toFloat()) {
|
|
362
|
+
startPosition = it.size.height.toFloat()
|
|
363
|
+
offsetY = Animatable(startPosition)
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
.fillMaxWidth()
|
|
367
|
+
) {
|
|
368
|
+
when (val type = snackBarData.type) {
|
|
369
|
+
is SnackBar.Custom -> type.content()
|
|
370
|
+
is SnackBar.Toast -> {}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
package vn.momo.kits.application
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.Composable
|
|
4
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
5
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
6
|
+
import androidx.compose.runtime.remember
|
|
7
|
+
import vn.momo.kits.const.AppTheme
|
|
8
|
+
import vn.momo.kits.const.Theme
|
|
9
|
+
import vn.momo.kits.navigation.LocalMaxApi
|
|
10
|
+
import vn.momo.kits.platform.ProvideOsFontScale
|
|
11
|
+
import vn.momo.maxapi.IMaxApi
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@Composable
|
|
15
|
+
fun WidgetContainer(
|
|
16
|
+
theme: Theme? = null,
|
|
17
|
+
miniAppContext: MiniAppContext? = null,
|
|
18
|
+
maxApi: IMaxApi? = null,
|
|
19
|
+
localize: Localize? = null,
|
|
20
|
+
content: @Composable () -> Unit,
|
|
21
|
+
) {
|
|
22
|
+
val parentContext = LocalContext.current
|
|
23
|
+
val mergedContext = remember(parentContext, miniAppContext) {
|
|
24
|
+
MiniAppContext.merge(parentContext, miniAppContext)
|
|
25
|
+
}
|
|
26
|
+
val resolvedTheme = theme ?: AppTheme.current
|
|
27
|
+
val resolvedLocalize = localize ?: LocalLocalize.current
|
|
28
|
+
val resolvedMaxApi = maxApi ?: LocalMaxApi.current
|
|
29
|
+
|
|
30
|
+
LaunchedEffect(resolvedMaxApi, localize) {
|
|
31
|
+
val api = resolvedMaxApi ?: return@LaunchedEffect
|
|
32
|
+
val target = localize ?: return@LaunchedEffect
|
|
33
|
+
runCatching {
|
|
34
|
+
api.getLanguage(callback = { data ->
|
|
35
|
+
if (parseLanguage(data) == Localize.EN) target.changeLanguage(Localize.EN)
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
ProvideOsFontScale {
|
|
41
|
+
CompositionLocalProvider(
|
|
42
|
+
AppTheme provides resolvedTheme,
|
|
43
|
+
LocalContext provides mergedContext,
|
|
44
|
+
LocalLocalize provides resolvedLocalize,
|
|
45
|
+
LocalMaxApi provides resolvedMaxApi,
|
|
46
|
+
) {
|
|
47
|
+
content()
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private fun parseLanguage(raw: Map<String, Any?>?): String? {
|
|
53
|
+
val code = (raw?.get("response") as? String)?.trim()?.lowercase()
|
|
54
|
+
if (code.isNullOrEmpty()) return null
|
|
55
|
+
return if (code.startsWith(Localize.EN)) Localize.EN else Localize.VI
|
|
56
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
package vn.momo.kits.application
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.animateColorAsState
|
|
4
|
+
import androidx.compose.animation.core.animateFloatAsState
|
|
5
|
+
import androidx.compose.runtime.Composable
|
|
6
|
+
import androidx.compose.runtime.getValue
|
|
7
|
+
import androidx.compose.ui.graphics.Color
|
|
8
|
+
import androidx.compose.ui.unit.Dp
|
|
9
|
+
import androidx.compose.ui.unit.dp
|
|
10
|
+
import vn.momo.kits.const.AppTheme
|
|
11
|
+
import vn.momo.kits.const.Colors
|
|
12
|
+
import vn.momo.kits.platform.getScreenDimensions
|
|
13
|
+
|
|
14
|
+
data class HeaderAnimations(
|
|
15
|
+
val opacity: Float,
|
|
16
|
+
val backgroundSearch: Color,
|
|
17
|
+
val translateX: Float,
|
|
18
|
+
val width: Float,
|
|
19
|
+
val translateY: Float
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
private const val SCREEN_PADDING = 12
|
|
23
|
+
private const val BACK_WIDTH = 28
|
|
24
|
+
|
|
25
|
+
@Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
|
|
26
|
+
@Composable
|
|
27
|
+
internal fun useHeaderSearchAnimation(
|
|
28
|
+
opacityAni: Float,
|
|
29
|
+
scrollState: Int,
|
|
30
|
+
headerRightWidth: Dp,
|
|
31
|
+
isBack: Boolean
|
|
32
|
+
): HeaderAnimations {
|
|
33
|
+
val screenWidth = getScreenDimensions().width
|
|
34
|
+
val leftPosition = if (isBack) (BACK_WIDTH + 20).dp else 12.dp
|
|
35
|
+
val searchWidth = screenWidth - (SCREEN_PADDING * 2)
|
|
36
|
+
|
|
37
|
+
val backgroundSearch by animateColorAsState(
|
|
38
|
+
targetValue = animateColor(
|
|
39
|
+
Colors.black_01,
|
|
40
|
+
AppTheme.current.colors.background.default,
|
|
41
|
+
opacityAni
|
|
42
|
+
),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
val animatedTranslateX by animateFloatAsState(
|
|
46
|
+
targetValue = (scrollState / HEADER_HEIGHT * 1f).coerceIn(
|
|
47
|
+
0f,
|
|
48
|
+
1f
|
|
49
|
+
) * (leftPosition.value - 12) + 12,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
val animatedWidth by animateFloatAsState(
|
|
53
|
+
targetValue = (scrollState / HEADER_HEIGHT * 1f).coerceIn(
|
|
54
|
+
0f,
|
|
55
|
+
1f
|
|
56
|
+
) * ((searchWidth - leftPosition.value - headerRightWidth.value + 12) - searchWidth) + searchWidth,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
val animatedTranslateY by animateFloatAsState(
|
|
60
|
+
targetValue = (1 - (scrollState / HEADER_HEIGHT * 1f).coerceIn(0f, 1f)) * HEADER_HEIGHT
|
|
61
|
+
)
|
|
62
|
+
return HeaderAnimations(
|
|
63
|
+
opacity = opacityAni,
|
|
64
|
+
backgroundSearch = backgroundSearch,
|
|
65
|
+
translateX = animatedTranslateX,
|
|
66
|
+
width = animatedWidth,
|
|
67
|
+
translateY = animatedTranslateY
|
|
68
|
+
)
|
|
69
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
package vn.momo.kits.components
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.background
|
|
4
|
+
import androidx.compose.foundation.border
|
|
5
|
+
import androidx.compose.foundation.layout.Box
|
|
6
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
7
|
+
import androidx.compose.foundation.layout.offset
|
|
8
|
+
import androidx.compose.foundation.layout.size
|
|
9
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
10
|
+
import androidx.compose.runtime.Composable
|
|
11
|
+
import androidx.compose.runtime.remember
|
|
12
|
+
import androidx.compose.ui.Alignment
|
|
13
|
+
import androidx.compose.ui.Modifier
|
|
14
|
+
import androidx.compose.ui.draw.clip
|
|
15
|
+
import androidx.compose.ui.semantics.contentDescription
|
|
16
|
+
import androidx.compose.ui.semantics.semantics
|
|
17
|
+
import androidx.compose.ui.unit.dp
|
|
18
|
+
import androidx.compose.ui.zIndex
|
|
19
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
20
|
+
import vn.momo.kits.const.AppTheme
|
|
21
|
+
import vn.momo.kits.const.Colors
|
|
22
|
+
import vn.momo.kits.const.Spacing
|
|
23
|
+
import vn.momo.kits.const.Typography
|
|
24
|
+
import vn.momo.kits.modifier.conditional
|
|
25
|
+
import vn.momo.kits.modifier.setAutomationId
|
|
26
|
+
|
|
27
|
+
private const val LOGO_MOMO_URL =
|
|
28
|
+
"https://static.momocdn.net/app/img/kits/logo_momo_circle.png"
|
|
29
|
+
private const val ICON_SUPPORT_DEFAULT_URL =
|
|
30
|
+
"https://static.momocdn.net/app/img/kits/_indicator.png"
|
|
31
|
+
|
|
32
|
+
enum class AvatarSize(val sizeDp: Int, val iconSizeDp: Int) {
|
|
33
|
+
SIZE_24(24, 16),
|
|
34
|
+
SIZE_32(32, 16),
|
|
35
|
+
SIZE_40(40, 24),
|
|
36
|
+
SIZE_48(48, 32),
|
|
37
|
+
SIZE_56(56, 32),
|
|
38
|
+
SIZE_72(72, 40),
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Composable
|
|
42
|
+
fun Avatar(
|
|
43
|
+
modifier: Modifier = Modifier,
|
|
44
|
+
size: AvatarSize = AvatarSize.SIZE_32,
|
|
45
|
+
rounded: Boolean = true,
|
|
46
|
+
name: String? = null,
|
|
47
|
+
image: String? = null,
|
|
48
|
+
showIconMomo: Boolean = false,
|
|
49
|
+
showIconSupport: Boolean = false,
|
|
50
|
+
iconSupport: String = ICON_SUPPORT_DEFAULT_URL,
|
|
51
|
+
accessibilityLabel: String? = null,
|
|
52
|
+
) {
|
|
53
|
+
val theme = AppTheme.current
|
|
54
|
+
|
|
55
|
+
val cornerRadius = remember(rounded, size) {
|
|
56
|
+
if (rounded) (size.sizeDp / 2).dp else Spacing.XS
|
|
57
|
+
}
|
|
58
|
+
val shape = remember(cornerRadius) { RoundedCornerShape(cornerRadius) }
|
|
59
|
+
|
|
60
|
+
val badgeSizeDp = remember(size) { (size.iconSizeDp / 2).dp }
|
|
61
|
+
val badgeShape = remember(size) {
|
|
62
|
+
RoundedCornerShape((size.iconSizeDp / 4).dp)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
val shouldShowIconTop = showIconMomo && rounded
|
|
66
|
+
val shouldShowIconBottom = showIconSupport && rounded
|
|
67
|
+
|
|
68
|
+
val initials = remember(name) {
|
|
69
|
+
name?.let { avatarInitials(it) }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
val automationId = remember(accessibilityLabel, name) {
|
|
73
|
+
accessibilityLabel ?: "Avatar${if (name != null) "/$name" else ""}"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
Box(
|
|
77
|
+
modifier = modifier
|
|
78
|
+
.size(size.sizeDp.dp)
|
|
79
|
+
.conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) }
|
|
80
|
+
.setAutomationId(automationId)
|
|
81
|
+
.semantics { contentDescription = automationId },
|
|
82
|
+
) {
|
|
83
|
+
// Inner box with clip — holds avatar content
|
|
84
|
+
Box(
|
|
85
|
+
modifier = Modifier
|
|
86
|
+
.fillMaxSize()
|
|
87
|
+
.clip(shape)
|
|
88
|
+
.background(color = Colors.pink_09)
|
|
89
|
+
.border(width = 1.dp, color = theme.colors.border.default, shape = shape),
|
|
90
|
+
contentAlignment = Alignment.Center,
|
|
91
|
+
) {
|
|
92
|
+
when {
|
|
93
|
+
image != null -> {
|
|
94
|
+
Image(
|
|
95
|
+
source = image,
|
|
96
|
+
modifier = Modifier
|
|
97
|
+
.fillMaxSize()
|
|
98
|
+
.clip(shape)
|
|
99
|
+
.semantics { contentDescription = "$automationId|img" },
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
name != null -> {
|
|
104
|
+
Text(
|
|
105
|
+
text = initials ?: "",
|
|
106
|
+
style = Typography.descriptionXsRegular,
|
|
107
|
+
color = Colors.pink_03,
|
|
108
|
+
modifier = Modifier
|
|
109
|
+
.semantics { contentDescription = "$automationId|text" },
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
else -> {
|
|
114
|
+
Icon(
|
|
115
|
+
source = "basic_person",
|
|
116
|
+
size = size.iconSizeDp.dp,
|
|
117
|
+
color = Colors.pink_03,
|
|
118
|
+
modifier = Modifier
|
|
119
|
+
.semantics { contentDescription = "$automationId|icon" },
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Badge icons — outside clip so they are not cut by border
|
|
126
|
+
if (shouldShowIconTop) {
|
|
127
|
+
Image(
|
|
128
|
+
source = LOGO_MOMO_URL,
|
|
129
|
+
modifier = Modifier
|
|
130
|
+
.zIndex(1f)
|
|
131
|
+
.align(Alignment.TopEnd)
|
|
132
|
+
.offset(x = 1.dp, y = (-1).dp)
|
|
133
|
+
.size(badgeSizeDp)
|
|
134
|
+
.clip(badgeShape)
|
|
135
|
+
.semantics { contentDescription = "$automationId|top-icon" },
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (shouldShowIconBottom) {
|
|
140
|
+
Image(
|
|
141
|
+
source = iconSupport,
|
|
142
|
+
modifier = Modifier
|
|
143
|
+
.zIndex(1f)
|
|
144
|
+
.align(Alignment.BottomEnd)
|
|
145
|
+
.offset(x = 1.dp, y = 1.dp)
|
|
146
|
+
.size(badgeSizeDp)
|
|
147
|
+
.clip(badgeShape)
|
|
148
|
+
.semantics { contentDescription = "$automationId|bottom-icon" },
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private fun avatarInitials(name: String): String {
|
|
155
|
+
val words = name.trim().split(" ").filter { it.isNotEmpty() }
|
|
156
|
+
return words.takeLast(2).joinToString("") { it.first().uppercaseChar().toString() }
|
|
157
|
+
}
|