@momo-kits/native-kits 0.163.1-beta.2 → 0.163.1-beta.20-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +112 -0
- 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 +293 -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 +542 -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 +325 -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 +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +38 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +39 -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 +299 -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 +372 -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 +127 -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 -3
- package/ios/Application/Components.swift +36 -30
- package/ios/Application/FloatingButton.swift +10 -9
- package/ios/Application/Localize.swift +309 -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 +203 -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/Navigation/component/HeaderRightWidthKey.swift +11 -0
- package/ios/Application/Navigation/component/NavigationHeaderRight.swift +196 -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 +91 -17
- package/ios/BaselineView/BaselineView.swift +163 -0
- package/ios/Button/Button.swift +137 -28
- 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 +5 -3
- 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 +7 -8
- 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 +86 -17
- package/ios/Typography/Typography.swift +12 -14
- 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 +64 -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/example/ios/Example.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -46
- package/ios/Application/FontScaleStore.swift +0 -59
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
package vn.momo.kits.navigation
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.animateColorAsState
|
|
4
|
+
import androidx.compose.animation.core.animateDpAsState
|
|
5
|
+
import androidx.compose.foundation.ScrollState
|
|
6
|
+
import androidx.compose.foundation.background
|
|
7
|
+
import androidx.compose.foundation.border
|
|
8
|
+
import androidx.compose.foundation.gestures.ScrollableState
|
|
9
|
+
import androidx.compose.foundation.layout.Box
|
|
10
|
+
import androidx.compose.foundation.layout.Column
|
|
11
|
+
import androidx.compose.foundation.layout.ColumnScope
|
|
12
|
+
import androidx.compose.foundation.layout.Spacer
|
|
13
|
+
import androidx.compose.foundation.layout.WindowInsets
|
|
14
|
+
import androidx.compose.foundation.layout.asPaddingValues
|
|
15
|
+
import androidx.compose.foundation.layout.aspectRatio
|
|
16
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
17
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
18
|
+
import androidx.compose.foundation.layout.height
|
|
19
|
+
import androidx.compose.foundation.layout.ime
|
|
20
|
+
import androidx.compose.foundation.layout.imePadding
|
|
21
|
+
import androidx.compose.foundation.layout.offset
|
|
22
|
+
import androidx.compose.foundation.layout.padding
|
|
23
|
+
import androidx.compose.foundation.lazy.LazyListState
|
|
24
|
+
import androidx.compose.foundation.lazy.rememberLazyListState
|
|
25
|
+
import androidx.compose.foundation.rememberScrollState
|
|
26
|
+
import androidx.compose.foundation.verticalScroll
|
|
27
|
+
import androidx.compose.material.ExperimentalMaterialApi
|
|
28
|
+
import androidx.compose.runtime.Composable
|
|
29
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
30
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
31
|
+
import androidx.compose.runtime.State
|
|
32
|
+
import androidx.compose.runtime.getValue
|
|
33
|
+
import androidx.compose.runtime.mutableIntStateOf
|
|
34
|
+
import androidx.compose.runtime.mutableStateOf
|
|
35
|
+
import androidx.compose.runtime.remember
|
|
36
|
+
import androidx.compose.runtime.rememberUpdatedState
|
|
37
|
+
import androidx.compose.runtime.snapshotFlow
|
|
38
|
+
import androidx.compose.runtime.staticCompositionLocalOf
|
|
39
|
+
import androidx.compose.ui.Alignment
|
|
40
|
+
import androidx.compose.ui.Modifier
|
|
41
|
+
import androidx.compose.ui.graphics.Brush
|
|
42
|
+
import androidx.compose.ui.graphics.Color
|
|
43
|
+
import androidx.compose.ui.graphics.lerp
|
|
44
|
+
import androidx.compose.ui.layout.onGloballyPositioned
|
|
45
|
+
import androidx.compose.ui.platform.LocalDensity
|
|
46
|
+
import androidx.compose.ui.unit.Dp
|
|
47
|
+
import androidx.compose.ui.unit.dp
|
|
48
|
+
import androidx.compose.ui.zIndex
|
|
49
|
+
import kotlinx.coroutines.flow.Flow
|
|
50
|
+
import vn.momo.kits.components.InputSearch
|
|
51
|
+
import vn.momo.kits.const.AppNavigationBar
|
|
52
|
+
import vn.momo.kits.const.AppStatusBar
|
|
53
|
+
import vn.momo.kits.const.AppTheme
|
|
54
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
55
|
+
import vn.momo.kits.const.Colors
|
|
56
|
+
import vn.momo.kits.const.Spacing
|
|
57
|
+
import vn.momo.kits.modifier.conditional
|
|
58
|
+
import vn.momo.kits.modifier.hideKeyboardOnTap
|
|
59
|
+
import vn.momo.kits.navigation.bottomtab.BOTTOM_TAB_BAR_HEIGHT
|
|
60
|
+
import vn.momo.kits.navigation.component.FABPosition
|
|
61
|
+
import vn.momo.kits.navigation.component.FloatingButton
|
|
62
|
+
import vn.momo.kits.navigation.component.HEADER_HEIGHT
|
|
63
|
+
import vn.momo.kits.navigation.component.Header
|
|
64
|
+
import vn.momo.kits.navigation.component.HeaderBackground
|
|
65
|
+
import vn.momo.kits.navigation.component.HeaderRight
|
|
66
|
+
import vn.momo.kits.navigation.component.HeaderType
|
|
67
|
+
import vn.momo.kits.navigation.component.InputSearchType
|
|
68
|
+
import vn.momo.kits.platform.BackHandler
|
|
69
|
+
import vn.momo.kits.platform.supportsImePadding
|
|
70
|
+
import vn.momo.kits.navigation.tracking.ScreenTracker
|
|
71
|
+
import vn.momo.kits.navigation.tracking.ScreenTrackingState
|
|
72
|
+
import kotlinx.coroutines.delay
|
|
73
|
+
import vn.momo.kits.application.LocalContext
|
|
74
|
+
import kotlin.time.Clock
|
|
75
|
+
import kotlin.time.Duration.Companion.milliseconds
|
|
76
|
+
import kotlin.time.ExperimentalTime
|
|
77
|
+
|
|
78
|
+
internal val LocalFooterHeightPx = staticCompositionLocalOf { mutableIntStateOf(0) }
|
|
79
|
+
internal val LocalHeaderRightWidthPx = staticCompositionLocalOf { mutableIntStateOf(0) }
|
|
80
|
+
|
|
81
|
+
@Composable
|
|
82
|
+
private fun bottomTabBarInset(): Dp {
|
|
83
|
+
if (LocalNavigation.current.bottomTabIndex == -1) return 0.dp
|
|
84
|
+
val keyboard = keyboardSizeState().value
|
|
85
|
+
return (BOTTOM_TAB_BAR_HEIGHT.dp + Spacing.S - keyboard).coerceAtLeast(0.dp)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@OptIn(ExperimentalMaterialApi::class, ExperimentalTime::class)
|
|
89
|
+
@Composable
|
|
90
|
+
internal fun StackScreen(
|
|
91
|
+
content: @Composable () -> Unit,
|
|
92
|
+
navigationOptions: NavigationOptions? = null,
|
|
93
|
+
id: Int = -1,
|
|
94
|
+
name: String = "",
|
|
95
|
+
bottomTabIndex: Int = -1,
|
|
96
|
+
onBackHandler: (() -> Unit)? = null,
|
|
97
|
+
) {
|
|
98
|
+
val navigator = LocalNavigator.current
|
|
99
|
+
val maxApi = LocalMaxApi.current
|
|
100
|
+
val context = LocalContext.current
|
|
101
|
+
val statusBar = AppStatusBar.current
|
|
102
|
+
val density = LocalDensity.current
|
|
103
|
+
val screenRegistry = LocalDynamicScreenRegistry.current
|
|
104
|
+
val navigation = remember { Navigation(id = id, bottomTabIndex = bottomTabIndex, initOptions = navigationOptions, registry = screenRegistry) }
|
|
105
|
+
|
|
106
|
+
val options by navigation.currentOptions
|
|
107
|
+
val isBottomTabChild = bottomTabIndex != -1
|
|
108
|
+
val isBottomTabRoot = navigation.isBottomTabRoot
|
|
109
|
+
|
|
110
|
+
// Auto tracking state
|
|
111
|
+
val trackingState = remember {
|
|
112
|
+
ScreenTrackingState().apply {
|
|
113
|
+
time = Clock.System.now().toEpochMilliseconds()
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Determine action: push or back
|
|
118
|
+
val action = remember {
|
|
119
|
+
if (ScreenTracker.getLastScreenName() != null) "push" else "back"
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Auto tracking effects
|
|
123
|
+
LaunchedEffect(name) {
|
|
124
|
+
// Track screen navigated immediately
|
|
125
|
+
ScreenTracker.trackScreenNavigated(
|
|
126
|
+
maxApi = maxApi,
|
|
127
|
+
context = context,
|
|
128
|
+
screenName = name,
|
|
129
|
+
action = action,
|
|
130
|
+
state = trackingState
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
// Track screen displayed after 2 seconds (debounce)
|
|
134
|
+
delay(2000.milliseconds)
|
|
135
|
+
val loadTime = Clock.System.now().toEpochMilliseconds() - trackingState.time
|
|
136
|
+
ScreenTracker.trackScreenDisplayed(
|
|
137
|
+
maxApi = maxApi,
|
|
138
|
+
context = context,
|
|
139
|
+
screenName = name,
|
|
140
|
+
duration = loadTime,
|
|
141
|
+
state = trackingState
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
// Track screen interacted after displayed
|
|
145
|
+
val interactionTime = Clock.System.now().toEpochMilliseconds() - trackingState.time
|
|
146
|
+
ScreenTracker.trackScreenInteracted(
|
|
147
|
+
maxApi = maxApi,
|
|
148
|
+
context = context,
|
|
149
|
+
screenName = name,
|
|
150
|
+
duration = interactionTime - loadTime,
|
|
151
|
+
totalDuration = interactionTime,
|
|
152
|
+
state = trackingState
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
val limit = with(density) {
|
|
157
|
+
(statusBar).toPx() + HEADER_HEIGHT
|
|
158
|
+
}.toInt()
|
|
159
|
+
|
|
160
|
+
val (scrollState, scrollInProcess) = if (options.scrollData.scrollState is LazyListState)
|
|
161
|
+
(options.scrollData.scrollState as? LazyListState ?: rememberLazyListState()).proxyScrollState(limit, 15)
|
|
162
|
+
else
|
|
163
|
+
(options.scrollData.scrollState as? ScrollState ?: rememberScrollState()).proxyLimitedScrollState(limit, 15)
|
|
164
|
+
|
|
165
|
+
val footerHeightPx = remember { mutableIntStateOf(0) }
|
|
166
|
+
val headerRightWidthPx = remember { mutableIntStateOf(0) }
|
|
167
|
+
|
|
168
|
+
if (navigation.options.scrollData.scrollToTopCallback != null) {
|
|
169
|
+
RegisterScrollToTop(navigation.options.scrollData.scrollToTopCallback)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
BackHandler(true) { navigator.onBackSafe() }
|
|
173
|
+
|
|
174
|
+
CompositionLocalProvider(
|
|
175
|
+
StackScreenScrollableState provides options.scrollData.scrollState,
|
|
176
|
+
LocalNavigation provides navigation,
|
|
177
|
+
LocalScrollState provides scrollState,
|
|
178
|
+
LocalOptions provides options,
|
|
179
|
+
LocalFooterHeightPx provides footerHeightPx,
|
|
180
|
+
LocalHeaderRightWidthPx provides headerRightWidthPx
|
|
181
|
+
) {
|
|
182
|
+
Box(
|
|
183
|
+
Modifier
|
|
184
|
+
.fillMaxSize()
|
|
185
|
+
.background(options.backgroundColor ?: AppTheme.current.colors.background.default)
|
|
186
|
+
.conditional(options.keyboardOptions.keyboardShouldPersistTaps) {
|
|
187
|
+
hideKeyboardOnTap()
|
|
188
|
+
}
|
|
189
|
+
.conditional(options.keyboardOptions.useAvoidKeyboard && supportsImePadding()) {
|
|
190
|
+
imePadding()
|
|
191
|
+
}
|
|
192
|
+
) {
|
|
193
|
+
Box(Modifier.zIndex(1f)) {
|
|
194
|
+
HeaderBackground()
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
Box(Modifier.zIndex(4f)) {
|
|
198
|
+
Header(onBackHandler)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
Column(Modifier.zIndex(5f)) {
|
|
202
|
+
SearchAnimated(isScrollInProgress = scrollInProcess)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
Column(Modifier.zIndex(2f).fillMaxSize()) {
|
|
206
|
+
MainContent(content = content, isBottomTabRoot = isBottomTabRoot, isBottomTabChild = isBottomTabChild)
|
|
207
|
+
FooterContent()
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
Box(Modifier.zIndex(6f)) {
|
|
211
|
+
FloatingContent(isBottomTabChild = isBottomTabChild)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
OverplayView(isBottomTabChild = isBottomTabChild, id = id)
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@Suppress("FrequentlyChangingValue")
|
|
220
|
+
@Composable
|
|
221
|
+
internal fun FloatingContent(isBottomTabChild: Boolean) {
|
|
222
|
+
val options = LocalOptions.current
|
|
223
|
+
val density = LocalDensity.current
|
|
224
|
+
val footerHeightPx = LocalFooterHeightPx.current
|
|
225
|
+
val scrollState = LocalScrollState.current
|
|
226
|
+
val navigationBar = AppNavigationBar.current
|
|
227
|
+
|
|
228
|
+
val fabProps = options.floatingButtonProps ?: return
|
|
229
|
+
val bottomPadding = fabProps.bottom
|
|
230
|
+
?: (Spacing.M + when {
|
|
231
|
+
options.hasFooter() -> with(density) { footerHeightPx.intValue.toDp() }
|
|
232
|
+
isBottomTabChild -> bottomTabBarInset() + (navigationBar - keyboardSizeState().value).coerceAtLeast(0.dp)
|
|
233
|
+
else -> navigationBar
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
FloatingButton(
|
|
237
|
+
scrollPosition = fabProps.scrollState?.value ?: scrollState.value,
|
|
238
|
+
onClick = fabProps.onClick,
|
|
239
|
+
containerColor = AppTheme.current.colors.primary,
|
|
240
|
+
bottom = bottomPadding,
|
|
241
|
+
icon = fabProps.icon,
|
|
242
|
+
iconColor = fabProps.iconColor,
|
|
243
|
+
text = fabProps.label,
|
|
244
|
+
size = fabProps.size,
|
|
245
|
+
position = fabProps.position ?: FABPosition.END,
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@Composable
|
|
250
|
+
internal fun ColumnScope.MainContent(content: @Composable () -> Unit, isBottomTabRoot: Boolean, isBottomTabChild: Boolean) {
|
|
251
|
+
val options = LocalOptions.current
|
|
252
|
+
val inputSearchType = getInputSearchType(options)
|
|
253
|
+
val density = LocalDensity.current
|
|
254
|
+
val scrollState = LocalScrollState.current
|
|
255
|
+
val navigationBar = AppNavigationBar.current
|
|
256
|
+
|
|
257
|
+
Spacer(
|
|
258
|
+
Modifier.height(
|
|
259
|
+
if (options.headerType is HeaderType.DefaultOrExtended || (options.headerType is HeaderType.Transparent && !options.headerType.isFullScreenContent))
|
|
260
|
+
AppStatusBar.current + HEADER_HEIGHT.dp else 0.dp
|
|
261
|
+
)
|
|
262
|
+
)
|
|
263
|
+
if (inputSearchType == InputSearchType.Animated) {
|
|
264
|
+
val scrollDp = with(density) { scrollState.value.toDp() }
|
|
265
|
+
|
|
266
|
+
val animatedTopPadding by animateDpAsState(
|
|
267
|
+
targetValue = (HEADER_HEIGHT.dp - scrollDp).coerceIn(0.dp, HEADER_HEIGHT.dp),
|
|
268
|
+
label = "AnimatedTopPadding"
|
|
269
|
+
)
|
|
270
|
+
Spacer(Modifier.height(animatedTopPadding))
|
|
271
|
+
}
|
|
272
|
+
Column(
|
|
273
|
+
Modifier
|
|
274
|
+
.fillMaxWidth()
|
|
275
|
+
.weight(1f)
|
|
276
|
+
.conditional(options.scrollData.scrollable && options.scrollData.scrollState is ScrollState) {
|
|
277
|
+
verticalScroll(scrollState)
|
|
278
|
+
}
|
|
279
|
+
.padding(
|
|
280
|
+
bottom = when {
|
|
281
|
+
options.hasFooter() || isBottomTabRoot -> 0.dp
|
|
282
|
+
isBottomTabChild -> bottomTabBarInset() + (navigationBar - keyboardSizeState().value).coerceAtLeast(0.dp)
|
|
283
|
+
!options.scrollData.scrollable && options.scrollData.scrollState == null -> 0.dp
|
|
284
|
+
else -> navigationBar
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
) {
|
|
288
|
+
ScreenContent(content = content)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
@Composable
|
|
294
|
+
internal fun ScreenContent(content: @Composable () -> Unit) {
|
|
295
|
+
val scrollState = LocalScrollState.current
|
|
296
|
+
val options = LocalOptions.current
|
|
297
|
+
|
|
298
|
+
if (options.headerType is HeaderType.Animated) {
|
|
299
|
+
val animatedHeader = options.headerType
|
|
300
|
+
Box {
|
|
301
|
+
Box(Modifier.fillMaxWidth().aspectRatio(animatedHeader.aspectRatio.value)) {
|
|
302
|
+
animatedHeader.composable.invoke(scrollState.value)
|
|
303
|
+
}
|
|
304
|
+
Box(Modifier.padding(top = AppStatusBar.current + HEADER_HEIGHT.dp + animatedHeader.layoutOffSet)) {
|
|
305
|
+
content()
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
309
|
+
content()
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
@Composable
|
|
314
|
+
internal fun FooterContent() {
|
|
315
|
+
val options = LocalOptions.current
|
|
316
|
+
if (options.hasFooter()) {
|
|
317
|
+
val keyboardSize = keyboardSizeState()
|
|
318
|
+
val bottomPadding = (AppNavigationBar.current - keyboardSize.value).coerceAtLeast(0.dp)
|
|
319
|
+
Footer(footerComponent = options.footerComponent, bottomPadding = bottomPadding)
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
@Composable
|
|
324
|
+
internal fun keyboardSizeState(): State<Dp> {
|
|
325
|
+
val bottom = WindowInsets.ime.asPaddingValues()
|
|
326
|
+
return rememberUpdatedState(bottom.calculateBottomPadding())
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
@Composable
|
|
330
|
+
internal fun OverplayView(isBottomTabChild: Boolean, id: Int) {
|
|
331
|
+
val overplayType = OverplayComponentRegistry.getOverplayType()
|
|
332
|
+
|
|
333
|
+
if (overplayType != null) {
|
|
334
|
+
Box(Modifier.zIndex(if (overplayType == OverplayComponentType.SNACK_BAR) 3f else 7f).fillMaxSize()) {
|
|
335
|
+
if (isBottomTabChild) return@Box
|
|
336
|
+
if (OverplayComponentRegistry.currentRootId() != id) return@Box
|
|
337
|
+
OverplayComponentRegistry.OverlayComponent()
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
@Composable
|
|
343
|
+
fun Footer(footerComponent: @Composable (() -> Unit)?, bottomPadding: Dp) {
|
|
344
|
+
if (footerComponent == null) return
|
|
345
|
+
|
|
346
|
+
val footerHeightPx = LocalFooterHeightPx.current
|
|
347
|
+
|
|
348
|
+
val shadowBrush = remember {
|
|
349
|
+
Brush.verticalGradient(
|
|
350
|
+
colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.05f))
|
|
351
|
+
)
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
Box(Modifier.onGloballyPositioned {
|
|
355
|
+
if (footerHeightPx.intValue != it.size.height) footerHeightPx.intValue = it.size.height
|
|
356
|
+
}) {
|
|
357
|
+
Box(
|
|
358
|
+
Modifier
|
|
359
|
+
.fillMaxWidth()
|
|
360
|
+
.background(AppTheme.current.colors.background.surface)
|
|
361
|
+
.conditional(IsShowBaseLineDebug) {
|
|
362
|
+
border(1.dp, Colors.blue_03)
|
|
363
|
+
}
|
|
364
|
+
.padding(top = Spacing.S, start = Spacing.M, end = Spacing.M, bottom = bottomPadding + Spacing.S)
|
|
365
|
+
) {
|
|
366
|
+
footerComponent.invoke()
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
Box(
|
|
370
|
+
modifier = Modifier
|
|
371
|
+
.fillMaxWidth()
|
|
372
|
+
.height(6.dp)
|
|
373
|
+
.offset(x = 0.dp, y = (-6).dp)
|
|
374
|
+
.background(shadowBrush)
|
|
375
|
+
)
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
data class InputSearchLayoutParams(
|
|
380
|
+
val topPadding: Dp,
|
|
381
|
+
val startPadding: Dp,
|
|
382
|
+
val endPadding: Dp
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
@Suppress("FrequentlyChangingValue")
|
|
386
|
+
@Composable
|
|
387
|
+
internal fun SearchAnimated(
|
|
388
|
+
isScrollInProgress: Boolean
|
|
389
|
+
) {
|
|
390
|
+
val scrollState = LocalScrollState.current
|
|
391
|
+
val options = LocalOptions.current
|
|
392
|
+
val navigator = LocalNavigator.current
|
|
393
|
+
val density = LocalDensity.current
|
|
394
|
+
|
|
395
|
+
val scrollDp = with(density) { scrollState.value.toDp() }
|
|
396
|
+
|
|
397
|
+
val inputSearchType = getInputSearchType(options)
|
|
398
|
+
val headerRightWidthPx = LocalHeaderRightWidthPx.current
|
|
399
|
+
val headerRightWidthDp = with(density) { headerRightWidthPx.intValue.toDp() }
|
|
400
|
+
|
|
401
|
+
if (inputSearchType == InputSearchType.None) return
|
|
402
|
+
val inputSearchProps = (options.headerType as? HeaderType.DefaultOrExtended)?.inputSearchProps ?: return
|
|
403
|
+
|
|
404
|
+
val minTopPadding = AppStatusBar.current
|
|
405
|
+
val maxTopPadding = AppStatusBar.current + HEADER_HEIGHT.dp
|
|
406
|
+
val minStartPadding = Spacing.M
|
|
407
|
+
val maxStartPadding = if (options.hiddenBack) Spacing.M else 48.dp // button back: size + left +right = 28 + 12 + 8 = 48
|
|
408
|
+
val minEndPadding = Spacing.M
|
|
409
|
+
val maxEndPadding = headerRightWidthDp + if (options.headerRight is HeaderRight.None) Spacing.M else Spacing.M * 2
|
|
410
|
+
|
|
411
|
+
val targetColor = lerp(
|
|
412
|
+
AppTheme.current.colors.background.surface,
|
|
413
|
+
AppTheme.current.colors.background.default,
|
|
414
|
+
(scrollDp / minTopPadding).coerceIn(0f, 1f)
|
|
415
|
+
)
|
|
416
|
+
val animatedColor by animateColorAsState(targetValue = targetColor, label = "BackgroundColor")
|
|
417
|
+
|
|
418
|
+
val layoutParams = when (inputSearchType) {
|
|
419
|
+
InputSearchType.Header -> {
|
|
420
|
+
InputSearchLayoutParams(
|
|
421
|
+
topPadding = minTopPadding,
|
|
422
|
+
startPadding = maxStartPadding,
|
|
423
|
+
endPadding = maxEndPadding
|
|
424
|
+
)
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
InputSearchType.Animated -> {
|
|
428
|
+
val animatedTopPadding by animateDpAsState(
|
|
429
|
+
targetValue = (maxTopPadding - scrollDp).coerceIn(minTopPadding, maxTopPadding),
|
|
430
|
+
label = "AnimatedTopPadding"
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
val animatedStartPadding by animateDpAsState(
|
|
434
|
+
targetValue = (minStartPadding + scrollDp).coerceIn(minStartPadding, maxStartPadding),
|
|
435
|
+
label = "AnimatedStartPadding"
|
|
436
|
+
)
|
|
437
|
+
|
|
438
|
+
val animatedEndPadding by animateDpAsState(
|
|
439
|
+
targetValue = (minEndPadding + scrollDp).coerceIn(minEndPadding, maxEndPadding),
|
|
440
|
+
label = "AnimatedEndPadding"
|
|
441
|
+
)
|
|
442
|
+
|
|
443
|
+
val maxPadding = remember(maxTopPadding, maxStartPadding, maxEndPadding) {
|
|
444
|
+
maxOf(maxEndPadding, maxStartPadding, maxTopPadding)
|
|
445
|
+
}
|
|
446
|
+
val snapScrollValue = with(density) { maxPadding.toPx().toInt() }
|
|
447
|
+
|
|
448
|
+
LaunchedEffect(isScrollInProgress && scrollState.value != 0 && scrollState.value != snapScrollValue) {
|
|
449
|
+
if (scrollDp < maxPadding) {
|
|
450
|
+
if (!isScrollInProgress) {
|
|
451
|
+
val midpoint = (maxTopPadding - minTopPadding) / 2
|
|
452
|
+
|
|
453
|
+
if (scrollDp < midpoint) {
|
|
454
|
+
scrollState.animateScrollTo(0)
|
|
455
|
+
} else {
|
|
456
|
+
scrollState.animateScrollTo(snapScrollValue)
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
InputSearchLayoutParams(
|
|
463
|
+
topPadding = animatedTopPadding,
|
|
464
|
+
startPadding = animatedStartPadding,
|
|
465
|
+
endPadding = animatedEndPadding
|
|
466
|
+
)
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
InputSearchType.None -> return
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
Spacer(Modifier.height(layoutParams.topPadding))
|
|
473
|
+
Box(
|
|
474
|
+
modifier = Modifier
|
|
475
|
+
.height(HEADER_HEIGHT.dp)
|
|
476
|
+
.fillMaxWidth()
|
|
477
|
+
.padding(
|
|
478
|
+
start = layoutParams.startPadding,
|
|
479
|
+
end = layoutParams.endPadding
|
|
480
|
+
),
|
|
481
|
+
contentAlignment = Alignment.Center
|
|
482
|
+
) {
|
|
483
|
+
InputSearch(
|
|
484
|
+
inputSearchProps = inputSearchProps.copy(
|
|
485
|
+
backgroundColor = animatedColor,
|
|
486
|
+
onPressButtonText = {
|
|
487
|
+
navigator.pop()
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
)
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
private fun quantize(value: Int, stepPx: Int): Int {
|
|
495
|
+
if (stepPx <= 1) return value
|
|
496
|
+
return (value / stepPx) * stepPx
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
@Composable
|
|
500
|
+
internal fun LazyListState.proxyScrollState(
|
|
501
|
+
thresholdPx: Int = 200,
|
|
502
|
+
stepPx: Int = 4
|
|
503
|
+
): Pair<ScrollState, Boolean> = proxyScroll(
|
|
504
|
+
source = this,
|
|
505
|
+
thresholdPx = thresholdPx,
|
|
506
|
+
stepPx = stepPx,
|
|
507
|
+
isScrollInProgress = { isScrollInProgress },
|
|
508
|
+
rawTargetFlow = {
|
|
509
|
+
snapshotFlow {
|
|
510
|
+
if (firstVisibleItemIndex == 0) firstVisibleItemScrollOffset
|
|
511
|
+
else SCROLLED_PAST_FIRST_ITEM_THRESHOLD
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
)
|
|
515
|
+
|
|
516
|
+
@Composable
|
|
517
|
+
internal fun ScrollState.proxyLimitedScrollState(
|
|
518
|
+
thresholdPx: Int = 200,
|
|
519
|
+
stepPx: Int = 4
|
|
520
|
+
): Pair<ScrollState, Boolean> = proxyScroll(
|
|
521
|
+
source = this,
|
|
522
|
+
thresholdPx = thresholdPx,
|
|
523
|
+
stepPx = stepPx,
|
|
524
|
+
isScrollInProgress = { isScrollInProgress },
|
|
525
|
+
rawTargetFlow = { snapshotFlow { value } },
|
|
526
|
+
)
|
|
527
|
+
|
|
528
|
+
@Composable
|
|
529
|
+
private fun proxyScroll(
|
|
530
|
+
source: Any,
|
|
531
|
+
thresholdPx: Int,
|
|
532
|
+
stepPx: Int,
|
|
533
|
+
isScrollInProgress: () -> Boolean,
|
|
534
|
+
rawTargetFlow: () -> Flow<Int>,
|
|
535
|
+
): Pair<ScrollState, Boolean> {
|
|
536
|
+
val proxy = rememberScrollState()
|
|
537
|
+
val locked = remember { mutableStateOf(false) }
|
|
538
|
+
|
|
539
|
+
LaunchedEffect(source, proxy, thresholdPx, stepPx) {
|
|
540
|
+
rawTargetFlow().collect { rawTarget ->
|
|
541
|
+
val shouldLock = rawTarget > thresholdPx
|
|
542
|
+
if (locked.value != shouldLock) locked.value = shouldLock
|
|
543
|
+
|
|
544
|
+
val desired = if (shouldLock) thresholdPx else quantize(rawTarget, stepPx)
|
|
545
|
+
|
|
546
|
+
if (proxy.value != desired) {
|
|
547
|
+
proxy.scrollTo(desired.coerceAtLeast(0))
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
val inProgress = remember { mutableStateOf(false) }
|
|
553
|
+
LaunchedEffect(source, thresholdPx) {
|
|
554
|
+
snapshotFlow { isScrollInProgress() }
|
|
555
|
+
.collect { progressing ->
|
|
556
|
+
inProgress.value = if (locked.value) false else progressing
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
return proxy to inProgress.value
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
private const val SCROLLED_PAST_FIRST_ITEM_THRESHOLD = 10_000
|
|
564
|
+
|
|
565
|
+
internal val LocalScrollState = staticCompositionLocalOf<ScrollState> { error("No Scroll State provided") }
|
|
566
|
+
internal val LocalOptions = staticCompositionLocalOf<NavigationOptions> { error("No NavigationOptions provided") }
|
|
567
|
+
|
|
568
|
+
val StackScreenScrollableState = staticCompositionLocalOf<ScrollableState?> { null }
|
|
569
|
+
|
|
570
|
+
internal fun getInputSearchType(options: NavigationOptions): InputSearchType {
|
|
571
|
+
return when (val headerType = options.headerType) {
|
|
572
|
+
is HeaderType.DefaultOrExtended -> when {
|
|
573
|
+
headerType.inputSearchProps == null -> InputSearchType.None
|
|
574
|
+
headerType.useAnimated -> InputSearchType.Animated
|
|
575
|
+
else -> InputSearchType.Header
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
else -> InputSearchType.None
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|