@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,196 @@
|
|
|
1
|
+
import Combine
|
|
2
|
+
import SwiftUI
|
|
3
|
+
|
|
4
|
+
/// Native SwiftUI port of the Compose `Carousel` component.
|
|
5
|
+
///
|
|
6
|
+
/// Mirrors the Compose API: a paging horizontal carousel driven by an
|
|
7
|
+
/// `itemCount` and a `content` builder that receives the real (modulo) index.
|
|
8
|
+
/// Supports infinite `loop`, `autoplay` with a configurable interval,
|
|
9
|
+
/// inactive-slide `opacity`/`scale` effects, optional `contentPadding`,
|
|
10
|
+
/// snap behavior, and scroll enable/disable. Snap / scroll-index callbacks
|
|
11
|
+
/// report the real item index.
|
|
12
|
+
///
|
|
13
|
+
/// Available iOS 14+ (uses a custom paging ScrollView so behavior is identical
|
|
14
|
+
/// across versions and supports the loop virtualization + transform effects
|
|
15
|
+
/// that `TabView(.page)` cannot express).
|
|
16
|
+
public struct Carousel<Content: View>: View {
|
|
17
|
+
// MARK: Lifecycle
|
|
18
|
+
|
|
19
|
+
public init(
|
|
20
|
+
itemCount: Int,
|
|
21
|
+
loop: Bool = false,
|
|
22
|
+
autoplay: Bool = false,
|
|
23
|
+
autoplayInterval: TimeInterval = 3.0,
|
|
24
|
+
enableSnap: Bool = true,
|
|
25
|
+
scrollEnabled: Bool = true,
|
|
26
|
+
inactiveSlideOpacity: Double = 1.0,
|
|
27
|
+
inactiveSlideScale: Double = 1.0,
|
|
28
|
+
contentPadding: CGFloat = 0,
|
|
29
|
+
onSnapToItem: @escaping (Int) -> Void = { _ in },
|
|
30
|
+
onScrollIndexChanged: @escaping (Int) -> Void = { _ in },
|
|
31
|
+
@ViewBuilder content: @escaping (_ index: Int) -> Content
|
|
32
|
+
) {
|
|
33
|
+
self.itemCount = itemCount
|
|
34
|
+
self.loop = loop
|
|
35
|
+
self.autoplay = autoplay
|
|
36
|
+
self.autoplayInterval = autoplayInterval
|
|
37
|
+
self.enableSnap = enableSnap
|
|
38
|
+
self.scrollEnabled = scrollEnabled
|
|
39
|
+
self.inactiveSlideOpacity = inactiveSlideOpacity
|
|
40
|
+
self.inactiveSlideScale = inactiveSlideScale
|
|
41
|
+
self.contentPadding = contentPadding
|
|
42
|
+
self.onSnapToItem = onSnapToItem
|
|
43
|
+
self.onScrollIndexChanged = onScrollIndexChanged
|
|
44
|
+
self.content = content
|
|
45
|
+
|
|
46
|
+
let virtual = loop ? itemCount * 1000 : itemCount
|
|
47
|
+
let start = loop ? (virtual / 2) - ((virtual / 2) % max(itemCount, 1)) : 0
|
|
48
|
+
self.virtualPageCount = virtual
|
|
49
|
+
_currentPage = State(initialValue: start)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// MARK: Public
|
|
53
|
+
|
|
54
|
+
public var body: some View {
|
|
55
|
+
if itemCount <= 0 {
|
|
56
|
+
EmptyView()
|
|
57
|
+
} else {
|
|
58
|
+
GeometryReader { geo in
|
|
59
|
+
let pageWidth = max(geo.size.width - contentPadding * 2, 1)
|
|
60
|
+
carouselContent(pageWidth: pageWidth, viewportWidth: geo.size.width)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// MARK: Private
|
|
66
|
+
|
|
67
|
+
private let itemCount: Int
|
|
68
|
+
private let loop: Bool
|
|
69
|
+
private let autoplay: Bool
|
|
70
|
+
private let autoplayInterval: TimeInterval
|
|
71
|
+
private let enableSnap: Bool
|
|
72
|
+
private let scrollEnabled: Bool
|
|
73
|
+
private let inactiveSlideOpacity: Double
|
|
74
|
+
private let inactiveSlideScale: Double
|
|
75
|
+
private let contentPadding: CGFloat
|
|
76
|
+
private let onSnapToItem: (Int) -> Void
|
|
77
|
+
private let onScrollIndexChanged: (Int) -> Void
|
|
78
|
+
private let content: (Int) -> Content
|
|
79
|
+
|
|
80
|
+
private let virtualPageCount: Int
|
|
81
|
+
|
|
82
|
+
@State private var currentPage: Int
|
|
83
|
+
@State private var dragOffset: CGFloat = 0
|
|
84
|
+
@State private var isDragging: Bool = false
|
|
85
|
+
@State private var autoplayTick: Int = 0
|
|
86
|
+
|
|
87
|
+
private func realIndex(_ page: Int) -> Int {
|
|
88
|
+
((page % itemCount) + itemCount) % itemCount
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@ViewBuilder
|
|
92
|
+
private func carouselContent(pageWidth: CGFloat, viewportWidth: CGFloat) -> some View {
|
|
93
|
+
let step = pageWidth
|
|
94
|
+
// Offset so the current page is centered within the viewport padding.
|
|
95
|
+
let baseOffset = -CGFloat(currentPage) * step + contentPadding
|
|
96
|
+
|
|
97
|
+
// Windows the rendered range around `currentPage` instead of instantiating all
|
|
98
|
+
// `virtualPageCount` slides up front — with `loop=true`, that's `itemCount * 1000`
|
|
99
|
+
// eager views, a real memory/perf regression versus Compose's lazy `HorizontalPager`.
|
|
100
|
+
// Clear spacers of the skipped width keep the HStack's total layout size (and thus
|
|
101
|
+
// the existing `baseOffset` math) unchanged.
|
|
102
|
+
let windowRadius = 3
|
|
103
|
+
let windowStart = max(0, currentPage - windowRadius)
|
|
104
|
+
let windowEnd = min(virtualPageCount - 1, currentPage + windowRadius)
|
|
105
|
+
|
|
106
|
+
ZStack {
|
|
107
|
+
HStack(spacing: 0) {
|
|
108
|
+
if windowStart > 0 {
|
|
109
|
+
Color.clear.frame(width: CGFloat(windowStart) * step)
|
|
110
|
+
}
|
|
111
|
+
ForEach(windowStart...windowEnd, id: \.self) { page in
|
|
112
|
+
slide(page: page, step: step, viewportWidth: viewportWidth)
|
|
113
|
+
.frame(width: pageWidth)
|
|
114
|
+
}
|
|
115
|
+
if windowEnd < virtualPageCount - 1 {
|
|
116
|
+
Color.clear.frame(width: CGFloat(virtualPageCount - 1 - windowEnd) * step)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
.offset(x: baseOffset + dragOffset)
|
|
120
|
+
.animation(isDragging ? nil : .easeInOut(duration: 0.25), value: currentPage)
|
|
121
|
+
.frame(width: viewportWidth, alignment: .leading)
|
|
122
|
+
.contentShape(Rectangle())
|
|
123
|
+
.gesture(scrollEnabled ? dragGesture(step: step) : nil)
|
|
124
|
+
}
|
|
125
|
+
.frame(width: viewportWidth)
|
|
126
|
+
.clipped()
|
|
127
|
+
.onReceive(autoplayTimer) { _ in
|
|
128
|
+
guard autoplay, itemCount > 1, !isDragging else { return }
|
|
129
|
+
advance()
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@ViewBuilder
|
|
134
|
+
private func slide(page: Int, step: CGFloat, viewportWidth: CGFloat) -> some View {
|
|
135
|
+
// Fractional offset of this page from the current page (incl. drag).
|
|
136
|
+
let dragFraction = step > 0 ? -dragOffset / step : 0
|
|
137
|
+
let pageOffset = abs(CGFloat(currentPage - page) + dragFraction)
|
|
138
|
+
let isActive = pageOffset < 0.5
|
|
139
|
+
let scale = isActive ? 1.0 : inactiveSlideScale
|
|
140
|
+
let alpha = isActive ? 1.0 : inactiveSlideOpacity
|
|
141
|
+
|
|
142
|
+
content(realIndex(page))
|
|
143
|
+
.scaleEffect(scale)
|
|
144
|
+
.opacity(alpha)
|
|
145
|
+
.animation(.easeInOut(duration: 0.15), value: isActive)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private func dragGesture(step: CGFloat) -> some Gesture {
|
|
149
|
+
DragGesture(minimumDistance: 5)
|
|
150
|
+
.onChanged { value in
|
|
151
|
+
isDragging = true
|
|
152
|
+
dragOffset = value.translation.width
|
|
153
|
+
}
|
|
154
|
+
.onEnded { value in
|
|
155
|
+
isDragging = false
|
|
156
|
+
let predicted = value.predictedEndTranslation.width
|
|
157
|
+
let threshold = step / 4
|
|
158
|
+
var target = currentPage
|
|
159
|
+
if enableSnap {
|
|
160
|
+
if predicted < -threshold {
|
|
161
|
+
target = min(currentPage + 1, virtualPageCount - 1)
|
|
162
|
+
} else if predicted > threshold {
|
|
163
|
+
target = max(currentPage - 1, 0)
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
// Free scroll still settles to nearest page boundary.
|
|
167
|
+
let moved = step > 0 ? Int((-dragOffset / step).rounded()) : 0
|
|
168
|
+
target = min(max(currentPage + moved, 0), virtualPageCount - 1)
|
|
169
|
+
}
|
|
170
|
+
dragOffset = 0
|
|
171
|
+
setPage(target)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private func advance() {
|
|
176
|
+
let next = currentPage + 1
|
|
177
|
+
if next < virtualPageCount {
|
|
178
|
+
setPage(next)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
private func setPage(_ page: Int) {
|
|
183
|
+
let clamped = min(max(page, 0), virtualPageCount - 1)
|
|
184
|
+
let changed = clamped != currentPage
|
|
185
|
+
currentPage = clamped
|
|
186
|
+
if changed {
|
|
187
|
+
let real = realIndex(clamped)
|
|
188
|
+
onSnapToItem(real)
|
|
189
|
+
onScrollIndexChanged(real)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private var autoplayTimer: Publishers.Autoconnect<Timer.TimerPublisher> {
|
|
194
|
+
Timer.publish(every: autoplayInterval, on: .main, in: .common).autoconnect()
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -2,6 +2,7 @@ import Foundation
|
|
|
2
2
|
import SwiftUI
|
|
3
3
|
|
|
4
4
|
public struct Checkbox: View{
|
|
5
|
+
@Environment(\.appTheme) private var theme
|
|
5
6
|
@Binding var checked: Bool
|
|
6
7
|
var disabled: Bool
|
|
7
8
|
var onChange: ((Bool)->Void)?
|
|
@@ -27,54 +28,48 @@ public struct Checkbox: View{
|
|
|
27
28
|
public var body: some View {
|
|
28
29
|
HStack(spacing: Spacing.S) {
|
|
29
30
|
// Checkbox
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
.overlay(
|
|
35
|
-
RoundedRectangle(cornerRadius: Radius.XS)
|
|
36
|
-
.stroke(borderColor, lineWidth: Spacing.XXS)
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
if checked {
|
|
40
|
-
Image(systemName: indeterminate ? "minus.square.fill" : "checkmark.square.fill")
|
|
41
|
-
.resizable()
|
|
42
|
-
.foregroundColor(backgroundColor)
|
|
43
|
-
.background(Colors.black01)
|
|
31
|
+
SwiftUI.Button(action: onCheck) {
|
|
32
|
+
ZStack {
|
|
33
|
+
RoundedRectangle(cornerRadius: Radius.XS)
|
|
34
|
+
.fill(backgroundColor)
|
|
44
35
|
.frame(width: 20, height: 20)
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
.overlay(
|
|
37
|
+
RoundedRectangle(cornerRadius: Radius.XS)
|
|
38
|
+
.stroke(borderColor, lineWidth: Spacing.XXS)
|
|
39
|
+
)
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
if checked {
|
|
42
|
+
Icon(source: indeterminate ? "navigation_minus" : "ic_checked", size: 20, color: Colors.black01)
|
|
43
|
+
}
|
|
51
44
|
}
|
|
52
45
|
}
|
|
46
|
+
.buttonStyle(ActiveOpacityButtonStyle(activeOpacity: 0.8))
|
|
47
|
+
.disabled(disabled)
|
|
53
48
|
|
|
54
49
|
// Title
|
|
55
50
|
if !title.isEmpty {
|
|
56
|
-
|
|
57
|
-
.font(.description1)
|
|
58
|
-
.ignoreBoldTextSetting()
|
|
51
|
+
MomoText(title, typography: .descriptionDefaultRegular)
|
|
59
52
|
}
|
|
60
53
|
}
|
|
61
54
|
}
|
|
62
55
|
|
|
63
56
|
private var borderColor: Color {
|
|
64
|
-
if disabled {
|
|
65
|
-
return
|
|
57
|
+
if disabled && checked {
|
|
58
|
+
return theme.colors.background.tonal
|
|
59
|
+
} else if disabled {
|
|
60
|
+
return theme.colors.border.disable
|
|
66
61
|
} else if checked {
|
|
67
|
-
return
|
|
62
|
+
return theme.colors.primary
|
|
68
63
|
} else {
|
|
69
|
-
return
|
|
64
|
+
return theme.colors.text.default
|
|
70
65
|
}
|
|
71
66
|
}
|
|
72
67
|
|
|
73
68
|
private var backgroundColor: Color {
|
|
74
69
|
if disabled && checked {
|
|
75
|
-
return
|
|
70
|
+
return theme.colors.background.tonal
|
|
76
71
|
} else if checked {
|
|
77
|
-
return
|
|
72
|
+
return theme.colors.primary
|
|
78
73
|
} else {
|
|
79
74
|
return Color.clear
|
|
80
75
|
}
|
package/ios/Chip/Chip.swift
CHANGED
|
@@ -2,17 +2,18 @@ import SwiftUI
|
|
|
2
2
|
import Foundation
|
|
3
3
|
|
|
4
4
|
public struct Chip: View {
|
|
5
|
+
@Environment(\.appTheme) private var theme
|
|
5
6
|
public enum ChipSize { case small, large }
|
|
6
7
|
|
|
7
8
|
public struct Dimensions {
|
|
9
|
+
let height: CGFloat
|
|
8
10
|
let horizontal: CGFloat
|
|
9
|
-
let vertical: CGFloat
|
|
10
11
|
let iconSize: CGFloat
|
|
11
12
|
let iconSpacing: CGFloat
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
public static let Large = Dimensions(
|
|
15
|
-
public static let Small = Dimensions(
|
|
15
|
+
public static let Large = Dimensions(height: 32, horizontal: 12, iconSize: 20, iconSpacing: 4)
|
|
16
|
+
public static let Small = Dimensions(height: 24, horizontal: 10, iconSize: 16, iconSpacing: 4)
|
|
16
17
|
|
|
17
18
|
private let label: String?
|
|
18
19
|
private let iconLeft: String?
|
|
@@ -51,46 +52,68 @@ public struct Chip: View {
|
|
|
51
52
|
|
|
52
53
|
public var body: some View {
|
|
53
54
|
let dims = (size == .small) ? Self.Small : Self.Large
|
|
55
|
+
// Mirrors Compose's `scaleSize(...)` on every chip dimension so it responds
|
|
56
|
+
// to Dynamic Type scaling the same way the rest of the kit does.
|
|
57
|
+
let height = scaleSize(dims.height)
|
|
58
|
+
let horizontal = scaleSize(dims.horizontal)
|
|
59
|
+
let iconSize = scaleSize(dims.iconSize)
|
|
60
|
+
let iconSpacing = scaleSize(dims.iconSpacing)
|
|
61
|
+
let radius = scaleSize(Radius.L)
|
|
54
62
|
|
|
55
63
|
let bg: Color = {
|
|
56
|
-
if selected { return
|
|
64
|
+
if selected { return theme.colors.background.selected }
|
|
57
65
|
if let explicit = backgroundColor { return explicit }
|
|
58
66
|
return Colors.black03
|
|
59
67
|
}()
|
|
60
68
|
|
|
61
|
-
let textColor: Color = selected ?
|
|
62
|
-
let leftTint: Color = selected ?
|
|
63
|
-
let rightTint: Color = selected ?
|
|
69
|
+
let textColor: Color = selected ? theme.colors.primary : theme.colors.text.default
|
|
70
|
+
let leftTint: Color = selected ? theme.colors.primary : iconLeftTint ?? theme.colors.text.default
|
|
71
|
+
let rightTint: Color = selected ? theme.colors.primary : iconRightTint ?? theme.colors.text.default
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
SwiftUI.Button(action: onClick) {
|
|
74
|
+
HStack(spacing: iconSpacing) {
|
|
75
|
+
if let iconLeft {
|
|
76
|
+
Icon(source: iconLeft, size: iconSize, color: leftTint)
|
|
77
|
+
}
|
|
69
78
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
if let text = label, !text.isEmpty {
|
|
80
|
+
MomoText(text, typography: (size == .large) ? .labelDefaultMedium : .labelSMedium, color: textColor)
|
|
81
|
+
.lineLimit(1)
|
|
82
|
+
}
|
|
74
83
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
.padding(.horizontal, dims.horizontal)
|
|
80
|
-
.padding(.vertical, dims.vertical)
|
|
81
|
-
.background(
|
|
82
|
-
RoundedRectangle(cornerRadius: Radius.L, style: .continuous)
|
|
83
|
-
.fill(bg)
|
|
84
|
-
)
|
|
85
|
-
.overlay(
|
|
86
|
-
Group {
|
|
87
|
-
if selected {
|
|
88
|
-
RoundedRectangle(cornerRadius: Radius.L, style: .continuous)
|
|
89
|
-
.stroke(Colors.primary, lineWidth: 2)
|
|
84
|
+
if let iconRight {
|
|
85
|
+
Icon(source: iconRight, size: iconSize, color: rightTint)
|
|
90
86
|
}
|
|
91
87
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
.padding(.horizontal, horizontal)
|
|
89
|
+
.frame(height: height)
|
|
90
|
+
.background(
|
|
91
|
+
RoundedRectangle(cornerRadius: radius, style: .continuous)
|
|
92
|
+
.fill(bg)
|
|
93
|
+
)
|
|
94
|
+
.overlay(
|
|
95
|
+
Group {
|
|
96
|
+
if selected {
|
|
97
|
+
RoundedRectangle(cornerRadius: radius, style: .continuous)
|
|
98
|
+
.stroke(theme.colors.secondary, lineWidth: 2)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
.contentShape(RoundedRectangle(cornerRadius: radius, style: .continuous))
|
|
103
|
+
}
|
|
104
|
+
.buttonStyle(ActiveOpacityButtonStyle())
|
|
105
|
+
.modifier(ChipAccessibilityModifier(accessibilityLabel: accessibilityLabel))
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private struct ChipAccessibilityModifier: ViewModifier {
|
|
110
|
+
let accessibilityLabel: String?
|
|
111
|
+
|
|
112
|
+
func body(content: Content) -> some View {
|
|
113
|
+
if let id = accessibilityLabel {
|
|
114
|
+
content.accessibilityIdentifier(id)
|
|
115
|
+
} else {
|
|
116
|
+
content
|
|
117
|
+
}
|
|
95
118
|
}
|
|
96
119
|
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
public enum CollapseTitleSize {
|
|
4
|
+
case small
|
|
5
|
+
case medium
|
|
6
|
+
case large
|
|
7
|
+
|
|
8
|
+
var typography: TypographyStyle {
|
|
9
|
+
switch self {
|
|
10
|
+
case .small: return .headerSSemibold
|
|
11
|
+
case .medium: return .headerDefaultBold
|
|
12
|
+
case .large: return .headerMBold
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public struct Collapse<Content: View>: View {
|
|
18
|
+
@Environment(\.appTheme) private var theme
|
|
19
|
+
|
|
20
|
+
private let title: String
|
|
21
|
+
private let description: String?
|
|
22
|
+
private let image: String?
|
|
23
|
+
private let imageSize: CGFloat
|
|
24
|
+
private let subTitle: String?
|
|
25
|
+
private let tagLabel: String?
|
|
26
|
+
private let tagColor: Tag.TagColor
|
|
27
|
+
private let showBorder: Bool
|
|
28
|
+
private let expandDefault: Bool
|
|
29
|
+
private let titleSize: CollapseTitleSize
|
|
30
|
+
private let useBackgroundCollapseButton: Bool
|
|
31
|
+
private let backgroundColor: Color?
|
|
32
|
+
private let titleColor: Color?
|
|
33
|
+
private let accessibilityId: String?
|
|
34
|
+
private let onPress: ((Bool) -> Void)?
|
|
35
|
+
private let content: (() -> Content)?
|
|
36
|
+
|
|
37
|
+
@State private var expanded: Bool
|
|
38
|
+
|
|
39
|
+
public init(
|
|
40
|
+
title: String,
|
|
41
|
+
description: String? = nil,
|
|
42
|
+
image: String? = nil,
|
|
43
|
+
imageSize: CGFloat = 24,
|
|
44
|
+
subTitle: String? = nil,
|
|
45
|
+
tagLabel: String? = nil,
|
|
46
|
+
tagColor: Tag.TagColor = .default,
|
|
47
|
+
showBorder: Bool = false,
|
|
48
|
+
expandDefault: Bool = false,
|
|
49
|
+
titleSize: CollapseTitleSize = .medium,
|
|
50
|
+
useBackgroundCollapseButton: Bool = false,
|
|
51
|
+
backgroundColor: Color? = nil,
|
|
52
|
+
titleColor: Color? = nil,
|
|
53
|
+
accessibilityId: String? = nil,
|
|
54
|
+
onPress: ((Bool) -> Void)? = nil,
|
|
55
|
+
@ViewBuilder content: @escaping () -> Content
|
|
56
|
+
) {
|
|
57
|
+
self.title = title
|
|
58
|
+
self.description = description
|
|
59
|
+
self.image = image
|
|
60
|
+
self.imageSize = imageSize
|
|
61
|
+
self.subTitle = subTitle
|
|
62
|
+
self.tagLabel = tagLabel
|
|
63
|
+
self.tagColor = tagColor
|
|
64
|
+
self.showBorder = showBorder
|
|
65
|
+
self.expandDefault = expandDefault
|
|
66
|
+
self.titleSize = titleSize
|
|
67
|
+
self.useBackgroundCollapseButton = useBackgroundCollapseButton
|
|
68
|
+
self.backgroundColor = backgroundColor
|
|
69
|
+
self.titleColor = titleColor
|
|
70
|
+
self.accessibilityId = accessibilityId
|
|
71
|
+
self.onPress = onPress
|
|
72
|
+
self.content = content
|
|
73
|
+
_expanded = State(initialValue: expandDefault)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Mirrors Kotlin's `accessibilityId ?: "Collapse/$title"`.
|
|
77
|
+
private var automationId: String {
|
|
78
|
+
accessibilityId ?? "Collapse/\(title)"
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private var resolvedBackgroundColor: Color {
|
|
82
|
+
backgroundColor ?? theme.colors.background.surface
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public var body: some View {
|
|
86
|
+
VStack(spacing: 0) {
|
|
87
|
+
header
|
|
88
|
+
|
|
89
|
+
if let content {
|
|
90
|
+
if expanded {
|
|
91
|
+
VStack(spacing: 0) {
|
|
92
|
+
content()
|
|
93
|
+
}
|
|
94
|
+
.frame(maxWidth: .infinity)
|
|
95
|
+
.overlay(
|
|
96
|
+
showBorder
|
|
97
|
+
? RoundedRectangle(cornerRadius: 0)
|
|
98
|
+
.stroke(theme.colors.border.default, lineWidth: 1)
|
|
99
|
+
: nil
|
|
100
|
+
)
|
|
101
|
+
.transition(.move(edge: .top).combined(with: .opacity))
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
.frame(maxWidth: .infinity)
|
|
106
|
+
.background(resolvedBackgroundColor)
|
|
107
|
+
.clipShape(RoundedRectangle(cornerRadius: Radius.S, style: .continuous))
|
|
108
|
+
.accessibilityIdentifier(automationId)
|
|
109
|
+
.overlay(
|
|
110
|
+
showBorder
|
|
111
|
+
? RoundedRectangle(cornerRadius: Radius.S, style: .continuous)
|
|
112
|
+
.stroke(theme.colors.border.default, lineWidth: 1)
|
|
113
|
+
: nil
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private var header: some View {
|
|
118
|
+
SwiftUI.Button(action: {
|
|
119
|
+
onPress?(expanded)
|
|
120
|
+
withAnimation(.easeInOut(duration: 0.3)) {
|
|
121
|
+
expanded.toggle()
|
|
122
|
+
}
|
|
123
|
+
}) {
|
|
124
|
+
HStack(alignment: .top, spacing: 0) {
|
|
125
|
+
if let image {
|
|
126
|
+
ImageView(image, contentMode: .fill)
|
|
127
|
+
.frame(width: imageSize, height: imageSize)
|
|
128
|
+
.clipShape(RoundedRectangle(cornerRadius: Radius.XS, style: .continuous))
|
|
129
|
+
Spacer().frame(width: Spacing.S)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
VStack(alignment: .leading, spacing: 0) {
|
|
133
|
+
MomoText(
|
|
134
|
+
title,
|
|
135
|
+
typography: titleSize.typography,
|
|
136
|
+
color: titleColor ?? theme.colors.text.default
|
|
137
|
+
)
|
|
138
|
+
if let description {
|
|
139
|
+
MomoText(
|
|
140
|
+
description,
|
|
141
|
+
typography: .bodyDefaultRegular,
|
|
142
|
+
color: theme.colors.text.secondary
|
|
143
|
+
)
|
|
144
|
+
.lineLimit(2)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
.frame(maxWidth: .infinity, alignment: .leading)
|
|
148
|
+
|
|
149
|
+
if subTitle != nil || tagLabel != nil {
|
|
150
|
+
Spacer().frame(width: Spacing.S)
|
|
151
|
+
if let subTitle {
|
|
152
|
+
MomoText(
|
|
153
|
+
subTitle,
|
|
154
|
+
typography: .bodyDefaultRegular,
|
|
155
|
+
color: theme.colors.text.secondary
|
|
156
|
+
)
|
|
157
|
+
.lineLimit(1)
|
|
158
|
+
} else if let tagLabel {
|
|
159
|
+
Tag(label: tagLabel, color: tagColor)
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
Spacer().frame(width: Spacing.S)
|
|
164
|
+
chevron
|
|
165
|
+
}
|
|
166
|
+
.padding(.horizontal, Spacing.M)
|
|
167
|
+
.padding(.vertical, Spacing.S)
|
|
168
|
+
.frame(maxWidth: .infinity)
|
|
169
|
+
.contentShape(Rectangle())
|
|
170
|
+
}
|
|
171
|
+
.buttonStyle(ActiveOpacityButtonStyle())
|
|
172
|
+
.accessibilityIdentifier("\(automationId)|touch")
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private var chevron: some View {
|
|
176
|
+
Group {
|
|
177
|
+
if useBackgroundCollapseButton {
|
|
178
|
+
Icon(source: "arrow_chevron_down_small", size: 16, color: theme.colors.primary)
|
|
179
|
+
.rotationEffect(.degrees(expanded ? 180 : 0))
|
|
180
|
+
.frame(width: 24, height: 24)
|
|
181
|
+
.background(
|
|
182
|
+
RoundedRectangle(cornerRadius: Radius.M, style: .continuous)
|
|
183
|
+
.fill(theme.colors.background.tonal)
|
|
184
|
+
)
|
|
185
|
+
} else {
|
|
186
|
+
Icon(source: "arrow_chevron_down_small", size: 24, color: theme.colors.text.default)
|
|
187
|
+
.rotationEffect(.degrees(expanded ? 180 : 0))
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
.animation(.easeInOut(duration: 0.3), value: expanded)
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -3,18 +3,18 @@ import Foundation
|
|
|
3
3
|
import SwiftUI
|
|
4
4
|
|
|
5
5
|
public enum Colors {
|
|
6
|
-
public static let primary = Color("Primary")
|
|
7
|
-
public static let primaryDark = Color("PrimaryDark")
|
|
8
|
-
public static let primaryLight = Color("PrimaryLight")
|
|
9
|
-
public static let secondary = Color("Secondary")
|
|
10
|
-
public static let background = Color("Background")
|
|
11
|
-
public static let border = Color("Border")
|
|
12
|
-
public static let text = Color("
|
|
13
|
-
public static let textSecondary = Color("TextSecondary")
|
|
14
|
-
public static let card = Color("Card")
|
|
15
|
-
public static let error = Color("Error")
|
|
16
|
-
public static let info =
|
|
17
|
-
public static let success = Color("Success")
|
|
6
|
+
public static let primary = Color.momoAsset("Primary")
|
|
7
|
+
public static let primaryDark = Color.momoAsset("PrimaryDark")
|
|
8
|
+
public static let primaryLight = Color.momoAsset("PrimaryLight")
|
|
9
|
+
public static let secondary = Color.momoAsset("Secondary")
|
|
10
|
+
public static let background = Color.momoAsset("Background")
|
|
11
|
+
public static let border = Color.momoAsset("Border")
|
|
12
|
+
public static let text = Color.momoAsset("ThemeColors/text-default")
|
|
13
|
+
public static let textSecondary = Color.momoAsset("TextSecondary")
|
|
14
|
+
public static let card = Color.momoAsset("Card")
|
|
15
|
+
public static let error = Color.momoAsset("Error")
|
|
16
|
+
public static let info = blue03
|
|
17
|
+
public static let success = Color.momoAsset("Success")
|
|
18
18
|
|
|
19
19
|
public static let black20 = Color(hex: "000000")
|
|
20
20
|
public static let black19 = Color(hex: "18191a")
|
|
@@ -49,15 +49,18 @@ public enum Colors {
|
|
|
49
49
|
public static let pink03 = Color(hex: "eb2f96")
|
|
50
50
|
public static let pink02 = Color(hex: "d42a87")
|
|
51
51
|
public static let pink01 = Color(hex: "bc2678")
|
|
52
|
+
public static let pinkMoMoBranding = Color(hex: "a50064")
|
|
52
53
|
|
|
53
54
|
|
|
54
|
-
public static let
|
|
55
|
-
public static let
|
|
55
|
+
public static let violet11 = Color(hex: "fcf8fe")
|
|
56
|
+
public static let violet11Stroke = Color(hex: "dfe1e5")
|
|
57
|
+
public static let violet10 = Color(hex: "faf4fe")
|
|
58
|
+
public static let violet09 = Color(hex: "f4e9fd")
|
|
56
59
|
public static let violet08 = Color(hex: "ead4fc")
|
|
57
60
|
public static let violet07 = Color(hex: "d5aaf9")
|
|
58
|
-
public static let violet06 = Color(hex: "
|
|
59
|
-
public static let violet05 = Color(hex: "
|
|
60
|
-
public static let violet04 = Color(hex: "
|
|
61
|
+
public static let violet06 = Color(hex: "c07ff6")
|
|
62
|
+
public static let violet05 = Color(hex: "ab55f3")
|
|
63
|
+
public static let violet04 = Color(hex: "a03ff1")
|
|
61
64
|
public static let violet03 = Color(hex: "962af0")
|
|
62
65
|
public static let violet02 = Color(hex: "8726d8")
|
|
63
66
|
public static let violet01 = Color(hex: "7822c0")
|
|
@@ -8,5 +8,7 @@ public enum Spacing {
|
|
|
8
8
|
public static let L: CGFloat = 16
|
|
9
9
|
public static let XL: CGFloat = 24
|
|
10
10
|
public static let XXL: CGFloat = 32
|
|
11
|
-
public static let
|
|
11
|
+
public static let Size3XL: CGFloat = 48
|
|
12
|
+
public static let Size4XL: CGFloat = 56
|
|
13
|
+
public static let Size5XL: CGFloat = 64
|
|
12
14
|
}
|