@momo-kits/native-kits 0.163.1-beta.1-debug → 0.163.1-beta.10-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/compose/build.gradle.kts +12 -8
- package/compose/build.gradle.kts.backup +11 -7
- package/compose/compose.podspec +1 -1
- 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 +30 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +2 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +6 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +6 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +4 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +1 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +5 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +6 -101
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +6 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +8 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +22 -25
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +27 -29
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +3 -26
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +30 -31
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +3 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +3 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +3 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +11 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +42 -65
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +69 -26
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +84 -59
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +13 -71
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +10 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +6 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +4 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +16 -75
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +5 -26
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +3 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +16 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +3 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -28
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +2 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +4 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +4 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +3 -28
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +8 -47
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +4 -25
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +2 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +1 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +1 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +50 -111
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +1 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +4 -96
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +5 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +2 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +9 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +9 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +8 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +19 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +11 -20
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +22 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +37 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +94 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +5 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +4 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +12 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +121 -84
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +48 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +88 -63
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +9 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +13 -31
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +6 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +11 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +9 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +3 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +3 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +1 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +23 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +10 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +2 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +3 -3
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +2 -3
- 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 +26 -5
- package/gradle/libs.versions.toml +2 -0
- package/gradle.properties +1 -1
- package/ios/Application/ApplicationEnvironment.swift +15 -2
- package/ios/Application/Components.swift +50 -43
- package/ios/Application/FloatingButton.swift +10 -8
- 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 -13
- package/ios/Badge/BadgeRibbon.swift +92 -19
- 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 -27
- 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 +153 -0
- package/ios/Input/ErrorView.swift +3 -1
- package/ios/Input/Input.swift +73 -33
- package/ios/Input/InputPhoneNumber.swift +34 -21
- package/ios/Input/InputSearch.swift +108 -46
- package/ios/Input/InputTextArea.swift +135 -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/OTPKeyboard/KeyboardButton.swift +1 -1
- 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 +13 -16
- package/ios/Popup/PopupInput.swift +2 -6
- 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 +8 -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 +80 -5
- package/ios/Typography/Typography.swift +17 -5
- 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/package.json +1 -1
- package/publish.sh +53 -0
- package/scripts/gen-ios-color.mjs +136 -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/local.properties +0 -8
package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt
CHANGED
|
@@ -2,15 +2,10 @@ package vn.momo.kits.components.datetimepicker
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.runtime.Composable
|
|
4
4
|
import androidx.compose.runtime.remember
|
|
5
|
+
import kotlinx.datetime.*
|
|
6
|
+
import kotlinx.datetime.number
|
|
5
7
|
import kotlin.time.Clock
|
|
6
8
|
import kotlin.time.ExperimentalTime
|
|
7
|
-
import kotlinx.datetime.DatePeriod
|
|
8
|
-
import kotlinx.datetime.LocalDateTime
|
|
9
|
-
import kotlinx.datetime.TimeZone
|
|
10
|
-
import kotlinx.datetime.minus
|
|
11
|
-
import kotlinx.datetime.number
|
|
12
|
-
import kotlinx.datetime.plus
|
|
13
|
-
import kotlinx.datetime.toLocalDateTime
|
|
14
9
|
|
|
15
10
|
/**
|
|
16
11
|
* Format a LocalDateTime object into a string
|
|
@@ -19,13 +14,13 @@ fun formatLocalDateTime(dateTime: LocalDateTime, format: String = "yyyy-MM-dd HH
|
|
|
19
14
|
return when (format) {
|
|
20
15
|
"yyyy-MM-dd HH:mm" -> "${dateTime.year}-${paddingNum(dateTime.month.number)}-${
|
|
21
16
|
paddingNum(
|
|
22
|
-
dateTime.
|
|
17
|
+
dateTime.day
|
|
23
18
|
)
|
|
24
19
|
} ${paddingNum(dateTime.hour)}:${paddingNum(dateTime.minute)}"
|
|
25
20
|
|
|
26
|
-
"dd-MM-yyyy" -> "${paddingNum(dateTime.
|
|
21
|
+
"dd-MM-yyyy" -> "${paddingNum(dateTime.day)}-${paddingNum(dateTime.month.number)}-${dateTime.year}"
|
|
27
22
|
"HH:mm" -> "${paddingNum(dateTime.hour)}:${paddingNum(dateTime.minute)}"
|
|
28
|
-
else -> "${dateTime.year}-${paddingNum(dateTime.month.number)}-${paddingNum(dateTime.
|
|
23
|
+
else -> "${dateTime.year}-${paddingNum(dateTime.month.number)}-${paddingNum(dateTime.day)} ${
|
|
29
24
|
paddingNum(
|
|
30
25
|
dateTime.hour
|
|
31
26
|
)
|
|
@@ -60,11 +55,11 @@ fun getDaysInMonth(
|
|
|
60
55
|
var endDay = daysInMonth
|
|
61
56
|
|
|
62
57
|
if (year == minDate.year && month == minDate.month.number) {
|
|
63
|
-
startDay = minDate.
|
|
58
|
+
startDay = minDate.day
|
|
64
59
|
}
|
|
65
60
|
|
|
66
61
|
if (year == maxDate.year && month == maxDate.month.number) {
|
|
67
|
-
endDay = maxDate.
|
|
62
|
+
endDay = maxDate.day
|
|
68
63
|
}
|
|
69
64
|
|
|
70
65
|
val days = mutableListOf<String>()
|
|
@@ -170,8 +165,8 @@ fun createRelativeDate(years: Int): LocalDateTime {
|
|
|
170
165
|
|
|
171
166
|
return LocalDateTime(
|
|
172
167
|
adjustedDate.year,
|
|
173
|
-
adjustedDate.
|
|
174
|
-
adjustedDate.
|
|
168
|
+
adjustedDate.month.number,
|
|
169
|
+
adjustedDate.day,
|
|
175
170
|
currentDateTime.hour,
|
|
176
171
|
currentDateTime.minute
|
|
177
172
|
)
|
|
@@ -10,13 +10,7 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|
|
10
10
|
import androidx.compose.foundation.lazy.LazyListState
|
|
11
11
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
|
12
12
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
13
|
-
import androidx.compose.runtime
|
|
14
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
15
|
-
import androidx.compose.runtime.getValue
|
|
16
|
-
import androidx.compose.runtime.mutableStateOf
|
|
17
|
-
import androidx.compose.runtime.remember
|
|
18
|
-
import androidx.compose.runtime.setValue
|
|
19
|
-
import androidx.compose.runtime.snapshotFlow
|
|
13
|
+
import androidx.compose.runtime.*
|
|
20
14
|
import androidx.compose.ui.Alignment
|
|
21
15
|
import androidx.compose.ui.Modifier
|
|
22
16
|
import androidx.compose.ui.draw.alpha
|
|
@@ -25,6 +19,7 @@ import androidx.compose.ui.platform.LocalDensity
|
|
|
25
19
|
import androidx.compose.ui.unit.Dp
|
|
26
20
|
import androidx.compose.ui.unit.dp
|
|
27
21
|
import androidx.compose.ui.zIndex
|
|
22
|
+
import kotlinx.coroutines.FlowPreview
|
|
28
23
|
import kotlinx.coroutines.delay
|
|
29
24
|
import kotlinx.coroutines.flow.collect
|
|
30
25
|
import kotlinx.coroutines.flow.debounce
|
|
@@ -36,12 +31,14 @@ import vn.momo.kits.const.Colors
|
|
|
36
31
|
import vn.momo.kits.const.Radius
|
|
37
32
|
import vn.momo.kits.const.Typography
|
|
38
33
|
import kotlin.math.abs
|
|
34
|
+
import kotlin.time.Duration.Companion.milliseconds
|
|
39
35
|
|
|
40
36
|
private val wheelItemHeight = 42.dp
|
|
41
37
|
private val wheelPickerBorderWidth = 1.dp
|
|
42
38
|
|
|
39
|
+
@OptIn(FlowPreview::class)
|
|
43
40
|
@Composable
|
|
44
|
-
fun WheelPicker(
|
|
41
|
+
internal fun WheelPicker(
|
|
45
42
|
name: String,
|
|
46
43
|
data: List<String>,
|
|
47
44
|
selectedData: String,
|
|
@@ -68,7 +65,7 @@ fun WheelPicker(
|
|
|
68
65
|
LaunchedEffect(paddedData) {
|
|
69
66
|
snapshotFlow { selectedIndex }
|
|
70
67
|
.distinctUntilChanged()
|
|
71
|
-
.debounce(50)
|
|
68
|
+
.debounce(50.milliseconds)
|
|
72
69
|
.onEach {
|
|
73
70
|
val value = paddedData.getOrNull(it)
|
|
74
71
|
if (!value.isNullOrEmpty()) {
|
|
@@ -95,7 +92,7 @@ fun WheelPicker(
|
|
|
95
92
|
} else {
|
|
96
93
|
-abs(firstItemOffset)
|
|
97
94
|
}
|
|
98
|
-
delay(50)
|
|
95
|
+
delay(50.milliseconds)
|
|
99
96
|
listState.animateScrollBy(offset.toFloat())
|
|
100
97
|
val centeredIndex = firstItemIdx + (if (isScrollUp) 1 else 0) + 2
|
|
101
98
|
if (centeredIndex in 2 until paddedData.size - 2) {
|
|
@@ -145,7 +142,7 @@ fun WheelPicker(
|
|
|
145
142
|
}
|
|
146
143
|
|
|
147
144
|
@Composable
|
|
148
|
-
fun WheelPickerItem(
|
|
145
|
+
internal fun WheelPickerItem(
|
|
149
146
|
text: String,
|
|
150
147
|
isSelected: Boolean,
|
|
151
148
|
index: Int,
|
|
@@ -147,6 +147,17 @@ object Colors {
|
|
|
147
147
|
val red_10 = Color(0xFFFEF4F4)
|
|
148
148
|
val red_11 = Color(0xFFFEF8F8)
|
|
149
149
|
|
|
150
|
+
// Translucent overlays, ported from the React kit's Consts (the reference
|
|
151
|
+
// palette). React spells them `#RRGGBBAA`; Compose's Color takes `0xAARRGGBB`.
|
|
152
|
+
val opacity_black_20 = Color(0x33000000)
|
|
153
|
+
val opacity_black_40 = Color(0x66000000)
|
|
154
|
+
val opacity_black_60 = Color(0x99000000)
|
|
155
|
+
val opacity_black_80 = Color(0xCC000000)
|
|
156
|
+
val opacity_white_20 = Color(0x33FFFFFF)
|
|
157
|
+
val opacity_white_40 = Color(0x66FFFFFF)
|
|
158
|
+
val opacity_white_60 = Color(0x99FFFFFF)
|
|
159
|
+
val opacity_white_80 = Color(0xCCFFFFFF)
|
|
160
|
+
|
|
150
161
|
val colorList: Map<String, Color> = mapOf(
|
|
151
162
|
"black_01" to black_01,
|
|
152
163
|
"black_02" to black_02,
|
|
@@ -302,5 +313,13 @@ object Colors {
|
|
|
302
313
|
"red_09" to red_09,
|
|
303
314
|
"red_10" to red_10,
|
|
304
315
|
"red_11" to red_11,
|
|
316
|
+
"opacity_black_20" to opacity_black_20,
|
|
317
|
+
"opacity_black_40" to opacity_black_40,
|
|
318
|
+
"opacity_black_60" to opacity_black_60,
|
|
319
|
+
"opacity_black_80" to opacity_black_80,
|
|
320
|
+
"opacity_white_20" to opacity_white_20,
|
|
321
|
+
"opacity_white_40" to opacity_white_40,
|
|
322
|
+
"opacity_white_60" to opacity_white_60,
|
|
323
|
+
"opacity_white_80" to opacity_white_80,
|
|
305
324
|
)
|
|
306
325
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package vn.momo.kits.const
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.getValue
|
|
4
|
+
import androidx.compose.runtime.mutableStateOf
|
|
5
|
+
import androidx.compose.runtime.setValue
|
|
6
|
+
|
|
7
|
+
// App-wide font-scale holder. The kit is sandboxed and can't read the host cache directly, so the
|
|
8
|
+
// host (which sees both core and this kit) seeds this once at startup and pushes runtime updates into
|
|
9
|
+
// it. scaleSize() reads it as the fallback, so every screen — including direct NavigationContainer
|
|
10
|
+
// screens with no host-pushed MiniAppContext — scales with no per-render prop and no async flicker.
|
|
11
|
+
// Backed by snapshot state: writes recompose text automatically.
|
|
12
|
+
object KitFontScale {
|
|
13
|
+
var userScaleRate by mutableStateOf(1f)
|
|
14
|
+
private set
|
|
15
|
+
var useOSScaleRate by mutableStateOf(true)
|
|
16
|
+
private set
|
|
17
|
+
|
|
18
|
+
fun update(userScaleRate: Float, useOSScaleRate: Boolean) {
|
|
19
|
+
this.userScaleRate = userScaleRate
|
|
20
|
+
this.useOSScaleRate = useOSScaleRate
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -7,28 +7,13 @@ import androidx.compose.ui.text.TextStyle
|
|
|
7
7
|
import androidx.compose.ui.text.font.FontFamily
|
|
8
8
|
import androidx.compose.ui.text.font.FontWeight
|
|
9
9
|
import androidx.compose.ui.text.style.TextDecoration
|
|
10
|
-
import androidx.compose.ui.unit
|
|
11
|
-
import androidx.compose.ui.unit.TextUnit
|
|
12
|
-
import androidx.compose.ui.unit.TextUnitType
|
|
13
|
-
import androidx.compose.ui.unit.dp
|
|
14
|
-
import androidx.compose.ui.unit.sp
|
|
10
|
+
import androidx.compose.ui.unit.*
|
|
15
11
|
import org.jetbrains.compose.resources.Font
|
|
16
12
|
import org.jetbrains.compose.resources.FontResource
|
|
17
13
|
import org.jetbrains.compose.resources.InternalResourceApi
|
|
18
|
-
import vn.momo.kits.application.
|
|
14
|
+
import vn.momo.kits.application.LocalContext
|
|
19
15
|
import vn.momo.kits.platform.getScreenDimensions
|
|
20
|
-
import vn.momo.uikits.resources
|
|
21
|
-
import vn.momo.uikits.resources.momosignature
|
|
22
|
-
import vn.momo.uikits.resources.momotrustdisplay
|
|
23
|
-
import vn.momo.uikits.resources.sfprotext_black
|
|
24
|
-
import vn.momo.uikits.resources.sfprotext_bold
|
|
25
|
-
import vn.momo.uikits.resources.sfprotext_heavy
|
|
26
|
-
import vn.momo.uikits.resources.sfprotext_light
|
|
27
|
-
import vn.momo.uikits.resources.sfprotext_medium
|
|
28
|
-
import vn.momo.uikits.resources.sfprotext_regular
|
|
29
|
-
import vn.momo.uikits.resources.sfprotext_semibold
|
|
30
|
-
import vn.momo.uikits.resources.sfprotext_thin
|
|
31
|
-
import vn.momo.uikits.resources.sfprotext_ultralight
|
|
16
|
+
import vn.momo.uikits.resources.*
|
|
32
17
|
import kotlin.math.max
|
|
33
18
|
import kotlin.math.min
|
|
34
19
|
|
|
@@ -38,7 +23,13 @@ const val MAX_DEVICE_SCALE = 5
|
|
|
38
23
|
|
|
39
24
|
@Composable
|
|
40
25
|
fun scaleSize(size: Float): Float {
|
|
41
|
-
val
|
|
26
|
+
val context = LocalContext.current
|
|
27
|
+
// Host-pushed context wins; otherwise fall back to the app-wide KitFontScale holder.
|
|
28
|
+
val useOsScale = context?.useOSScaleRate ?: KitFontScale.useOSScaleRate
|
|
29
|
+
if (!useOsScale) {
|
|
30
|
+
return size * (context?.userScaleRate ?: KitFontScale.userScaleRate)
|
|
31
|
+
}
|
|
32
|
+
val scaleSizeMaxRate: Float = MAX_FONT_SCALE
|
|
42
33
|
val deviceWidth = getScreenDimensions().width
|
|
43
34
|
val deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
|
|
44
35
|
|
|
@@ -98,7 +89,7 @@ fun scaleSize(textStyle: TextStyle): TextStyle {
|
|
|
98
89
|
|
|
99
90
|
@OptIn(InternalResourceApi::class)
|
|
100
91
|
@Composable
|
|
101
|
-
fun getFont(font: FontResource): FontFamily {
|
|
92
|
+
internal fun getFont(font: FontResource): FontFamily {
|
|
102
93
|
return FontFamily(Font(font))
|
|
103
94
|
}
|
|
104
95
|
|
|
@@ -1,2 +1,52 @@
|
|
|
1
1
|
package vn.momo.kits.layout
|
|
2
2
|
|
|
3
|
+
import androidx.compose.foundation.background
|
|
4
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
5
|
+
import androidx.compose.foundation.layout.Box
|
|
6
|
+
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
7
|
+
import androidx.compose.foundation.layout.FlowRow
|
|
8
|
+
import androidx.compose.foundation.layout.PaddingValues
|
|
9
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
10
|
+
import androidx.compose.foundation.layout.padding
|
|
11
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
12
|
+
import androidx.compose.runtime.Composable
|
|
13
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
14
|
+
import androidx.compose.ui.Modifier
|
|
15
|
+
import androidx.compose.ui.draw.clip
|
|
16
|
+
import androidx.compose.ui.draw.shadow
|
|
17
|
+
import androidx.compose.ui.unit.dp
|
|
18
|
+
import vn.momo.kits.components.Image
|
|
19
|
+
import vn.momo.kits.const.AppTheme
|
|
20
|
+
import vn.momo.kits.const.Radius
|
|
21
|
+
import vn.momo.kits.const.Spacing
|
|
22
|
+
|
|
23
|
+
@Composable
|
|
24
|
+
internal fun Card(
|
|
25
|
+
useShadow: Boolean = false,
|
|
26
|
+
backgroundImage: String? = null,
|
|
27
|
+
contentPadding: PaddingValues = PaddingValues(Spacing.M),
|
|
28
|
+
modifier: Modifier = Modifier,
|
|
29
|
+
content: @Composable () -> Unit,
|
|
30
|
+
) {
|
|
31
|
+
val columns = 12
|
|
32
|
+
val gutter = 8.dp
|
|
33
|
+
val shape = RoundedCornerShape(Radius.M)
|
|
34
|
+
var surface = modifier.fillMaxWidth().padding(horizontal = 12.dp)
|
|
35
|
+
if (useShadow) surface = surface.shadow(4.dp, shape)
|
|
36
|
+
surface = surface.clip(shape)
|
|
37
|
+
if (backgroundImage == null) surface = surface.background(AppTheme.current.colors.background.surface)
|
|
38
|
+
Box(modifier = surface) {
|
|
39
|
+
if (backgroundImage != null) {
|
|
40
|
+
Image(source = backgroundImage, modifier = Modifier.matchParentSize())
|
|
41
|
+
}
|
|
42
|
+
BoxWithConstraints(modifier = Modifier.fillMaxWidth().padding(contentPadding)) {
|
|
43
|
+
val sizePerSpan = (maxWidth - gutter * (columns - 1)) / columns - 1.dp / columns
|
|
44
|
+
CompositionLocalProvider(LocalGridContext provides GridContext(columns, gutter, sizePerSpan)) {
|
|
45
|
+
FlowRow(
|
|
46
|
+
horizontalArrangement = Arrangement.spacedBy(gutter),
|
|
47
|
+
verticalArrangement = Arrangement.spacedBy(gutter),
|
|
48
|
+
) { content() }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -4,32 +4,33 @@ import androidx.compose.foundation.layout.Box
|
|
|
4
4
|
import androidx.compose.foundation.layout.height
|
|
5
5
|
import androidx.compose.foundation.layout.width
|
|
6
6
|
import androidx.compose.runtime.Composable
|
|
7
|
+
import androidx.compose.runtime.compositionLocalOf
|
|
7
8
|
import androidx.compose.ui.Modifier
|
|
8
9
|
import androidx.compose.ui.unit.Dp
|
|
10
|
+
import androidx.compose.ui.unit.dp
|
|
9
11
|
|
|
10
|
-
data class GridContext(
|
|
11
|
-
val numberOfColumns:
|
|
12
|
-
val
|
|
13
|
-
val sizePerSpan:
|
|
14
|
-
|
|
15
|
-
)
|
|
12
|
+
internal data class GridContext(
|
|
13
|
+
val numberOfColumns: Int = 12,
|
|
14
|
+
val gutter: Dp = 12.dp,
|
|
15
|
+
val sizePerSpan: Dp = 0.dp,
|
|
16
|
+
) {
|
|
17
|
+
fun sizeForSpan(span: Int): Dp = sizePerSpan * span + gutter * (span - 1)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
internal val LocalGridContext = compositionLocalOf<GridContext?> { null }
|
|
16
21
|
|
|
17
22
|
@Composable
|
|
18
|
-
fun Item(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
content: @Composable() () -> Unit,
|
|
23
|
+
internal fun Item(
|
|
24
|
+
widthSpan: Int = 12,
|
|
25
|
+
heightSpan: Int = 0,
|
|
22
26
|
modifier: Modifier = Modifier,
|
|
23
|
-
|
|
27
|
+
content: @Composable () -> Unit,
|
|
24
28
|
) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
modifier = modifier.width(width = Dp(widthItem.toFloat()))
|
|
31
|
-
.height(height = Dp(heightItem.toFloat()))
|
|
32
|
-
) {
|
|
33
|
-
content()
|
|
29
|
+
val grid = LocalGridContext.current
|
|
30
|
+
var m = modifier
|
|
31
|
+
if (grid != null) {
|
|
32
|
+
m = m.width(grid.sizeForSpan(widthSpan))
|
|
33
|
+
if (heightSpan > 0) m = m.height(grid.sizeForSpan(heightSpan))
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
Box(modifier = m) { content() }
|
|
36
|
+
}
|
|
@@ -1,2 +1,39 @@
|
|
|
1
1
|
package vn.momo.kits.layout
|
|
2
2
|
|
|
3
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
4
|
+
import androidx.compose.foundation.layout.Box
|
|
5
|
+
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
6
|
+
import androidx.compose.foundation.layout.FlowRow
|
|
7
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
8
|
+
import androidx.compose.foundation.layout.padding
|
|
9
|
+
import androidx.compose.runtime.Composable
|
|
10
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
11
|
+
import androidx.compose.ui.Modifier
|
|
12
|
+
import androidx.compose.ui.unit.dp
|
|
13
|
+
import vn.momo.kits.components.Image
|
|
14
|
+
|
|
15
|
+
@Composable
|
|
16
|
+
internal fun Section(
|
|
17
|
+
useMargin: Boolean = true,
|
|
18
|
+
backgroundImage: String? = null,
|
|
19
|
+
modifier: Modifier = Modifier,
|
|
20
|
+
content: @Composable () -> Unit,
|
|
21
|
+
) {
|
|
22
|
+
val columns = 12
|
|
23
|
+
val gutter = 12.dp
|
|
24
|
+
val margin = if (useMargin) 12.dp else 0.dp
|
|
25
|
+
Box(modifier = modifier.fillMaxWidth().padding(horizontal = margin)) {
|
|
26
|
+
if (backgroundImage != null) {
|
|
27
|
+
Image(source = backgroundImage, modifier = Modifier.matchParentSize())
|
|
28
|
+
}
|
|
29
|
+
BoxWithConstraints(modifier = Modifier.fillMaxWidth()) {
|
|
30
|
+
val sizePerSpan = (maxWidth - gutter * (columns - 1)) / columns - 1.dp / columns
|
|
31
|
+
CompositionLocalProvider(LocalGridContext provides GridContext(columns, gutter, sizePerSpan)) {
|
|
32
|
+
FlowRow(
|
|
33
|
+
horizontalArrangement = Arrangement.spacedBy(gutter),
|
|
34
|
+
verticalArrangement = Arrangement.spacedBy(gutter),
|
|
35
|
+
) { content() }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -20,11 +20,6 @@ fun Modifier.setAutomationId(accessibilityId: String, mergeDescendants: Boolean
|
|
|
20
20
|
}
|
|
21
21
|
}}
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* Alternative for [setAutomationId]
|
|
25
|
-
*
|
|
26
|
-
* reason: [link](https://developer.android.com/develop/ui/compose/custom-modifiers#composable_function_modifiers_are_never_skipped)
|
|
27
|
-
* */
|
|
28
23
|
fun Modifier.kitsAutomationId(accessibilityId: String, label: String? = null) =
|
|
29
24
|
this then KitsAutomationIdElement(accessibilityId, label)
|
|
30
25
|
|
|
@@ -1,14 +1,104 @@
|
|
|
1
1
|
package vn.momo.kits.modifier
|
|
2
2
|
|
|
3
|
-
import androidx.compose.
|
|
3
|
+
import androidx.compose.animation.core.LinearEasing
|
|
4
|
+
import androidx.compose.animation.core.RepeatMode
|
|
5
|
+
import androidx.compose.animation.core.animateFloat
|
|
6
|
+
import androidx.compose.animation.core.infiniteRepeatable
|
|
7
|
+
import androidx.compose.animation.core.rememberInfiniteTransition
|
|
8
|
+
import androidx.compose.animation.core.tween
|
|
4
9
|
import androidx.compose.runtime.Composable
|
|
10
|
+
import androidx.compose.runtime.getValue
|
|
5
11
|
import androidx.compose.ui.Modifier
|
|
12
|
+
import androidx.compose.ui.draw.drawWithContent
|
|
13
|
+
import androidx.compose.ui.geometry.Offset
|
|
14
|
+
import androidx.compose.ui.graphics.Color
|
|
15
|
+
import androidx.compose.ui.graphics.drawscope.clipRect
|
|
16
|
+
import androidx.compose.ui.text.TextStyle
|
|
17
|
+
import androidx.compose.ui.text.drawText
|
|
18
|
+
import androidx.compose.ui.text.font.FontWeight
|
|
19
|
+
import androidx.compose.ui.text.rememberTextMeasurer
|
|
20
|
+
import androidx.compose.ui.unit.sp
|
|
6
21
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
7
22
|
import vn.momo.kits.const.Colors
|
|
8
23
|
|
|
24
|
+
@Suppress("ExperimentalAnnotationRetention")
|
|
25
|
+
@RequiresOptIn(
|
|
26
|
+
message = "This is internal API of native-kits, become internal in next sprint",
|
|
27
|
+
level = RequiresOptIn.Level.WARNING,
|
|
28
|
+
)
|
|
29
|
+
@Retention(AnnotationRetention.BINARY)
|
|
30
|
+
@Target(
|
|
31
|
+
AnnotationTarget.CLASS,
|
|
32
|
+
AnnotationTarget.FUNCTION,
|
|
33
|
+
AnnotationTarget.PROPERTY,
|
|
34
|
+
)
|
|
35
|
+
annotation class InternalApi
|
|
36
|
+
|
|
37
|
+
@Composable
|
|
38
|
+
fun DeprecatedModifier(text: String = "Deprecated component"): Modifier = debugMarker(
|
|
39
|
+
label = text,
|
|
40
|
+
background = Colors.red_04.copy(alpha = 0.7f),
|
|
41
|
+
textColor = Colors.red_01,
|
|
42
|
+
animationLabel = "deprecatedMarquee",
|
|
43
|
+
)
|
|
44
|
+
|
|
9
45
|
@Composable
|
|
10
|
-
fun
|
|
11
|
-
|
|
12
|
-
|
|
46
|
+
private fun debugMarker(
|
|
47
|
+
label: String,
|
|
48
|
+
background: Color,
|
|
49
|
+
textColor: Color,
|
|
50
|
+
animationLabel: String,
|
|
51
|
+
): Modifier {
|
|
52
|
+
if (!IsShowBaseLineDebug) return Modifier
|
|
53
|
+
|
|
54
|
+
val textMeasurer = rememberTextMeasurer()
|
|
55
|
+
val marquee = rememberInfiniteTransition(label = animationLabel)
|
|
56
|
+
val progress by marquee.animateFloat(
|
|
57
|
+
initialValue = 0f,
|
|
58
|
+
targetValue = 1f,
|
|
59
|
+
animationSpec = infiniteRepeatable(
|
|
60
|
+
animation = tween(durationMillis = 4000, easing = LinearEasing),
|
|
61
|
+
repeatMode = RepeatMode.Restart,
|
|
62
|
+
),
|
|
63
|
+
label = "${animationLabel}Progress",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
return Modifier.drawWithContent {
|
|
67
|
+
drawContent()
|
|
68
|
+
drawRect(color = background)
|
|
69
|
+
|
|
70
|
+
if (size.width <= 0f || size.height <= 0f) return@drawWithContent
|
|
71
|
+
|
|
72
|
+
val fontPx = (size.width * 0.1f).coerceIn(12.sp.toPx(), 20.sp.toPx())
|
|
73
|
+
val style = TextStyle(
|
|
74
|
+
color = textColor,
|
|
75
|
+
fontSize = fontPx.toSp(),
|
|
76
|
+
fontWeight = FontWeight.Bold,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
val intrinsic = textMeasurer.measure(
|
|
80
|
+
text = label,
|
|
81
|
+
style = style,
|
|
82
|
+
maxLines = 1,
|
|
83
|
+
softWrap = false,
|
|
84
|
+
)
|
|
85
|
+
val textW = intrinsic.size.width
|
|
86
|
+
val textH = intrinsic.size.height
|
|
87
|
+
val y = (size.height - textH) / 2f
|
|
88
|
+
|
|
89
|
+
if (textW <= size.width) {
|
|
90
|
+
drawText(
|
|
91
|
+
textLayoutResult = intrinsic,
|
|
92
|
+
topLeft = Offset((size.width - textW) / 2f, y),
|
|
93
|
+
)
|
|
94
|
+
} else {
|
|
95
|
+
clipRect(right = size.width, bottom = size.height) {
|
|
96
|
+
val gap = textW * 0.5f
|
|
97
|
+
val travel = textW + gap
|
|
98
|
+
val x = -progress * travel
|
|
99
|
+
drawText(textLayoutResult = intrinsic, topLeft = Offset(x, y))
|
|
100
|
+
drawText(textLayoutResult = intrinsic, topLeft = Offset(x + travel, y))
|
|
101
|
+
}
|
|
102
|
+
}
|
|
13
103
|
}
|
|
14
104
|
}
|
|
@@ -41,8 +41,9 @@ import vn.momo.kits.const.AppTheme
|
|
|
41
41
|
import vn.momo.kits.const.Colors
|
|
42
42
|
import vn.momo.kits.const.Radius
|
|
43
43
|
import vn.momo.kits.const.Spacing
|
|
44
|
-
import vn.momo.kits.application.
|
|
44
|
+
import vn.momo.kits.application.LocalContext
|
|
45
45
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
46
|
+
import vn.momo.kits.const.AppNavigationBar
|
|
46
47
|
import vn.momo.kits.const.Typography
|
|
47
48
|
import vn.momo.kits.navigation.tracking.ScreenTracker
|
|
48
49
|
import vn.momo.kits.modifier.conditional
|
|
@@ -58,8 +59,6 @@ internal fun BottomSheet(
|
|
|
58
59
|
barrierDismissible: Boolean = true,
|
|
59
60
|
onDismiss: (() -> Unit)?
|
|
60
61
|
) {
|
|
61
|
-
val navigator = LocalNavigator.current
|
|
62
|
-
|
|
63
62
|
val screenHeightDp = getScreenHeight()
|
|
64
63
|
val screenHeightPx = with(LocalDensity.current) { screenHeightDp.toPx() }
|
|
65
64
|
val sheetOffset = remember { Animatable(screenHeightPx) }
|
|
@@ -73,7 +72,7 @@ internal fun BottomSheet(
|
|
|
73
72
|
val coroutineScope = rememberCoroutineScope()
|
|
74
73
|
|
|
75
74
|
val maxApi = LocalMaxApi.current
|
|
76
|
-
val context =
|
|
75
|
+
val context = LocalContext.current
|
|
77
76
|
|
|
78
77
|
DisposableEffect(Unit) {
|
|
79
78
|
ScreenTracker.trackPopupDisplayed(
|
|
@@ -117,7 +116,7 @@ internal fun BottomSheet(
|
|
|
117
116
|
easing = CubicBezierEasing(0.3f, 0.0f, 0.8f, 0.15f)
|
|
118
117
|
)
|
|
119
118
|
)
|
|
120
|
-
|
|
119
|
+
OverplayComponentRegistry.hardClearAfterDismiss()
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
122
|
|
|
@@ -162,7 +161,7 @@ internal fun BottomSheet(
|
|
|
162
161
|
.noFeedbackClickable { },
|
|
163
162
|
contentAlignment = Alignment.BottomCenter
|
|
164
163
|
) {
|
|
165
|
-
Column {
|
|
164
|
+
Column(Modifier.padding(bottom = AppNavigationBar.current)) {
|
|
166
165
|
Box(
|
|
167
166
|
modifier = Modifier
|
|
168
167
|
.height(72.dp)
|
|
@@ -10,11 +10,7 @@ import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
|
10
10
|
import androidx.compose.foundation.layout.Box
|
|
11
11
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
12
12
|
import androidx.compose.foundation.layout.wrapContentSize
|
|
13
|
-
import androidx.compose.runtime
|
|
14
|
-
import androidx.compose.runtime.DisposableEffect
|
|
15
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
16
|
-
import androidx.compose.runtime.remember
|
|
17
|
-
import androidx.compose.runtime.rememberCoroutineScope
|
|
13
|
+
import androidx.compose.runtime.*
|
|
18
14
|
import androidx.compose.ui.Alignment
|
|
19
15
|
import androidx.compose.ui.Modifier
|
|
20
16
|
import androidx.compose.ui.draw.alpha
|
|
@@ -22,7 +18,7 @@ import androidx.compose.ui.draw.scale
|
|
|
22
18
|
import androidx.compose.ui.graphics.Color
|
|
23
19
|
import androidx.compose.ui.unit.dp
|
|
24
20
|
import kotlinx.coroutines.launch
|
|
25
|
-
import vn.momo.kits.application.
|
|
21
|
+
import vn.momo.kits.application.LocalContext
|
|
26
22
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
27
23
|
import vn.momo.kits.const.Colors
|
|
28
24
|
import vn.momo.kits.modifier.conditional
|
|
@@ -44,7 +40,7 @@ internal fun ModalScreen(
|
|
|
44
40
|
val coroutineScope = rememberCoroutineScope()
|
|
45
41
|
|
|
46
42
|
val maxApi = LocalMaxApi.current
|
|
47
|
-
val context =
|
|
43
|
+
val context = LocalContext.current
|
|
48
44
|
|
|
49
45
|
DisposableEffect(Unit) {
|
|
50
46
|
ScreenTracker.trackPopupDisplayed(
|
|
@@ -85,7 +81,7 @@ internal fun ModalScreen(
|
|
|
85
81
|
targetValue = 0.8f,
|
|
86
82
|
animationSpec = tween(durationMillis = 200)
|
|
87
83
|
)
|
|
88
|
-
|
|
84
|
+
OverplayComponentRegistry.hardClearAfterDismiss()
|
|
89
85
|
}
|
|
90
86
|
}
|
|
91
87
|
|