@momo-kits/native-kits 0.162.2-beta.26 → 0.162.2-beta.27-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +1 -1
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +190 -0
- package/compose/build.gradle.kts.backup +190 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +123 -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 +101 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +183 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +294 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +826 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +107 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +378 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +82 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +356 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +113 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +140 -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 +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +323 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +217 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +199 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +470 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +88 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +131 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +203 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +234 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/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 +270 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +253 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +129 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +100 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +154 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +360 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +581 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +156 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +225 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +320 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +81 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +309 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +34 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +360 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +128 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +70 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +58 -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/Platform.ios.kt +184 -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 +0 -11
- package/ios/Application/Components.swift +44 -34
- package/ios/Application/FloatingButton.swift +9 -10
- package/ios/Application/HeaderRight.swift +45 -79
- package/ios/Application/Screen.swift +1 -2
- package/ios/Badge/Badge.swift +14 -11
- package/ios/Badge/BadgeRibbon.swift +21 -12
- package/ios/Button/Button.swift +22 -61
- package/ios/Checkbox/Checkbox.swift +13 -14
- package/ios/Chip/Chip.swift +9 -23
- package/ios/Colors+Radius+Spacing/Colors.swift +12 -12
- package/ios/Extensions/Color++.swift +0 -32
- package/ios/Icon/Icon.swift +1 -6
- package/ios/Input/Input.swift +25 -41
- package/ios/Input/InputPhoneNumber.swift +19 -20
- package/ios/Input/InputSearch.swift +47 -100
- package/ios/Input/InputTextArea.swift +40 -66
- package/ios/Popup/PopupDisplay.swift +16 -8
- package/ios/Popup/PopupInput.swift +8 -2
- package/ios/Swipeable/SwipeCell.swift +0 -185
- package/ios/Swipeable/SwipeCellModel.swift +0 -21
- package/ios/Typography/Text.swift +5 -79
- package/ios/Typography/Typography.swift +0 -3
- package/ios/native-kits.podspec +8 -61
- package/package.json +1 -1
- package/publish.sh +0 -50
- package/settings.gradle.kts +64 -0
- package/.claude/settings.local.json +0 -39
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +0 -103
- package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +0 -215
- package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +0 -65
- package/ios/Application/Navigation/HeaderBackProps.swift +0 -66
- package/ios/Application/Navigation/HeaderTitle.swift +0 -57
- package/ios/Application/Navigation/HeaderUser.swift +0 -209
- package/ios/Application/Navigation/NavigationContainer.swift +0 -176
- package/ios/Application/Navigation/NavigationOptions.swift +0 -109
- package/ios/Application/Navigation/Navigator.swift +0 -364
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +0 -188
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +0 -68
- package/ios/Application/Navigation/Overplay/SnackBar.swift +0 -144
- package/ios/Application/Navigation/component/Header.swift +0 -178
- package/ios/Application/Navigation/component/HeaderBackground.swift +0 -83
- package/ios/Application/Navigation/component/HeaderColor.swift +0 -65
- package/ios/Application/StackScreen.swift +0 -453
- package/ios/Avatar/Avatar.swift +0 -193
- package/ios/BaselineView/BaselineView.swift +0 -163
- package/ios/Carousel/Carousel.swift +0 -181
- package/ios/Collapse/Collapse.swift +0 -182
- package/ios/Colors+Radius+Spacing/Theme.swift +0 -295
- package/ios/DateTimePicker/DateTimePicker.swift +0 -210
- package/ios/DateTimePicker/DateTimePickerTypes.swift +0 -55
- package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -167
- package/ios/DateTimePicker/WheelPicker.swift +0 -161
- package/ios/Divider/Divider.swift +0 -16
- package/ios/IconButton/IconButton.swift +0 -112
- package/ios/InputDropDown/InputDropDown.swift +0 -198
- package/ios/InputMoney/InputMoney.swift +0 -335
- package/ios/InputOTP/InputOTP.swift +0 -210
- package/ios/Loader/Loader.swift +0 -113
- package/ios/MoMoUIKits.podspec +0 -5
- package/ios/Pagination/PaginationDot.swift +0 -61
- package/ios/Pagination/PaginationNumber.swift +0 -35
- package/ios/Pagination/PaginationScroll.swift +0 -101
- package/ios/Pagination/PaginationWhiteDot.swift +0 -37
- package/ios/Popup/PopupNotify.swift +0 -219
- package/ios/ProgressInfo/ProgressInfo.swift +0 -294
- package/ios/Radio/Radio.swift +0 -70
- package/ios/Rating/Rating.swift +0 -82
- package/ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json +0 -11
- package/ios/Resources/MoMoUIKitsColors.xcassets/Background.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Border.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Card.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Contents.json +0 -6
- package/ios/Resources/MoMoUIKitsColors.xcassets/Error.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Primary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryDark.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryLight.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Success.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Text.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/TextSecondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +0 -9
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Warning.colorset/Contents.json +0 -38
- package/ios/Skeleton/Skeleton.swift +0 -99
- package/ios/Slider/Slider.swift +0 -237
- package/ios/Stepper/Stepper.swift +0 -220
- package/ios/Steps/Steps.swift +0 -451
- package/ios/SuggestAction/SuggestAction.swift +0 -97
- package/ios/TabView/TabView.swift +0 -530
- package/ios/Tag/Tag.swift +0 -98
- package/ios/Title/Title.swift +0 -269
- package/ios/Tooltip/Tooltip.swift +0 -482
- package/ios/Typography/FontScaleStore.swift +0 -19
- package/ios/Uploader/Uploader.swift +0 -183
- package/ios-demo/MoMoUIKitsDemo.podspec +0 -20
- package/ios-demo/Resources/dot_loading.json +0 -558
- package/ios-demo/Resources/icon.json +0 -4052
- package/ios-demo/Resources/lottie_circle_loader.json +0 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +0 -48
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +0 -25
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +0 -26
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +0 -19
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +0 -33
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +0 -48
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +0 -21
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +0 -17
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +0 -28
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +0 -31
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +0 -24
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +0 -110
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +0 -93
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +0 -269
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +0 -117
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +0 -89
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +0 -100
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +0 -126
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +0 -63
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +0 -20
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +0 -93
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +0 -107
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +0 -124
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +0 -14
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +0 -49
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +0 -278
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +0 -58
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +0 -78
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +0 -138
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +0 -111
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +0 -136
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +0 -107
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +0 -73
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +0 -100
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +0 -32
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +0 -57
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +0 -70
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +0 -227
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +0 -72
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +0 -175
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +0 -121
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +0 -76
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +0 -89
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +0 -32
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +0 -56
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +0 -32
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +0 -150
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +0 -138
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +0 -103
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +0 -94
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +0 -79
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +0 -152
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +0 -33
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +0 -190
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +0 -34
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +0 -182
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +0 -109
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +0 -187
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +0 -87
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +0 -131
- package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +0 -51
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +0 -15
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +0 -73
- package/scripts/gen-ios-color.mjs +0 -136
|
@@ -101,98 +101,69 @@ struct ToolkitHeaderRight: View {
|
|
|
101
101
|
var tintColor: Color?
|
|
102
102
|
@State private var isFavorite: Bool = false
|
|
103
103
|
@State private var isLoading: Bool = false
|
|
104
|
-
@
|
|
105
|
-
|
|
106
|
-
private func apiValue(_ value: Any?) -> Any {
|
|
107
|
-
value ?? NSNull()
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
private var contextMap: [String: Any] {
|
|
111
|
-
let context = environment.applicationContext
|
|
112
|
-
return [
|
|
113
|
-
"appId": apiValue(context?.appId),
|
|
114
|
-
"code": apiValue(context?.appCode),
|
|
115
|
-
"name": apiValue(context?.appName),
|
|
116
|
-
"icon": apiValue(context?.appIcon),
|
|
117
|
-
"description": apiValue(context?.description),
|
|
118
|
-
"support": apiValue(context?.support),
|
|
119
|
-
"toolkitConfig": apiValue(context?.toolkitConfig),
|
|
120
|
-
"providerId": apiValue(context?.providerId),
|
|
121
|
-
"permissions": apiValue(context?.permissions)
|
|
122
|
-
]
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
private var shouldShowShortcut: Bool {
|
|
126
|
-
headerRight?.useShortcut == true && !(headerRight?.useMore == true && environment.applicationContext == nil)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
private func parseResponse(_ response: String) -> Any? {
|
|
130
|
-
guard let jsonData = response.data(using: .utf8),
|
|
131
|
-
let json = try? JSONSerialization.jsonObject(with: jsonData) as? [String: Any] else {
|
|
132
|
-
return nil
|
|
133
|
-
}
|
|
134
|
-
return json["response"]
|
|
135
|
-
}
|
|
104
|
+
@EnvironmentObject private var environment: ApplicationEnvironment
|
|
136
105
|
|
|
137
106
|
// MARK: - Actions
|
|
138
|
-
private func loadFavoriteState() {
|
|
139
|
-
environment.composeApi?.request(
|
|
140
|
-
funcName: "isFavoriteApp",
|
|
141
|
-
params: ["code": apiValue(environment.applicationContext?.appCode)]
|
|
142
|
-
) { response in
|
|
143
|
-
if let isFavorite = parseResponse(response) as? Bool {
|
|
144
|
-
self.isFavorite = isFavorite
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
107
|
private func onPressShortcut() {
|
|
150
108
|
environment.composeApi?.request(
|
|
151
109
|
funcName: "onToolAction",
|
|
152
|
-
params: [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
]
|
|
156
|
-
) { response in
|
|
157
|
-
if let result = parseResponse(response) as? [String: Any],
|
|
158
|
-
result["success"] as? Bool == true {
|
|
159
|
-
isFavorite.toggle()
|
|
160
|
-
}
|
|
110
|
+
params: ["item": ["key": "onFavorite"]]
|
|
111
|
+
) { _ in
|
|
112
|
+
isFavorite.toggle()
|
|
161
113
|
}
|
|
162
114
|
}
|
|
163
115
|
|
|
164
116
|
private func onPressHelpCenter() {
|
|
117
|
+
let context = environment.applicationContext
|
|
118
|
+
let paramMap: [String: Any] = [
|
|
119
|
+
"appId": context?.appId,
|
|
120
|
+
"code": context?.appCode,
|
|
121
|
+
"name": context?.appName,
|
|
122
|
+
"icon": context?.appIcon,
|
|
123
|
+
"description": context?.description
|
|
124
|
+
]
|
|
165
125
|
environment.composeApi?.request(
|
|
166
126
|
funcName: "showHelpCenter",
|
|
167
|
-
params:
|
|
168
|
-
"appId": apiValue(environment.applicationContext?.appId),
|
|
169
|
-
"code": apiValue(environment.applicationContext?.appCode),
|
|
170
|
-
"name": apiValue(environment.applicationContext?.appName),
|
|
171
|
-
"icon": apiValue(environment.applicationContext?.appIcon),
|
|
172
|
-
"description": apiValue(environment.applicationContext?.description)
|
|
173
|
-
]
|
|
127
|
+
params: paramMap
|
|
174
128
|
) { _ in }
|
|
175
129
|
}
|
|
176
130
|
|
|
177
131
|
private func onPressClose() {
|
|
178
132
|
environment.composeApi?.request(
|
|
179
133
|
funcName: "dismissAll",
|
|
180
|
-
params:
|
|
134
|
+
params: ""
|
|
181
135
|
) { _ in }
|
|
182
136
|
}
|
|
183
137
|
|
|
184
138
|
private func onPressMore() {
|
|
139
|
+
let context = environment.applicationContext
|
|
185
140
|
let params: [String: Any] = [
|
|
186
|
-
"useSystemTools": headerRight?.useSystemTools
|
|
141
|
+
"useSystemTools": headerRight?.useSystemTools,
|
|
187
142
|
"tools": headerRight?.tools.map { $0.toMap() } ?? [],
|
|
188
|
-
"context":
|
|
143
|
+
"context": [
|
|
144
|
+
"appId": context?.appId,
|
|
145
|
+
"code": context?.appCode,
|
|
146
|
+
"name": context?.appName,
|
|
147
|
+
"icon": context?.appIcon,
|
|
148
|
+
"description": context?.description,
|
|
149
|
+
"support": context?.support,
|
|
150
|
+
"toolkitConfig": context?.toolkitConfig,
|
|
151
|
+
"providerId": context?.providerId,
|
|
152
|
+
"permissions": context?.permissions
|
|
153
|
+
]
|
|
189
154
|
]
|
|
190
155
|
environment.composeApi?.request(
|
|
191
156
|
funcName: "showTools",
|
|
192
157
|
params: params
|
|
193
158
|
) { response in
|
|
194
|
-
|
|
195
|
-
|
|
159
|
+
do {
|
|
160
|
+
if let jsonData = response.data(using: .utf8),
|
|
161
|
+
let json = try JSONSerialization.jsonObject(with: jsonData) as? [String: Any],
|
|
162
|
+
let toolResponse = json["response"] as? String {
|
|
163
|
+
headerRight?.toolCallback?(toolResponse)
|
|
164
|
+
}
|
|
165
|
+
} catch {
|
|
166
|
+
print("Error parsing response:", error)
|
|
196
167
|
}
|
|
197
168
|
}
|
|
198
169
|
}
|
|
@@ -224,7 +195,7 @@ struct ToolkitHeaderRight: View {
|
|
|
224
195
|
} ?? false
|
|
225
196
|
|
|
226
197
|
HStack(alignment: .center, spacing: 0) {
|
|
227
|
-
if
|
|
198
|
+
if headerRight?.useShortcut == true {
|
|
228
199
|
NavigationButton(
|
|
229
200
|
disabled: isLoading,
|
|
230
201
|
icon: navButtonConfig.icon,
|
|
@@ -235,17 +206,15 @@ struct ToolkitHeaderRight: View {
|
|
|
235
206
|
}
|
|
236
207
|
|
|
237
208
|
HStack(alignment: .center, spacing: 0) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
.frame(width: 0.5, height: 12)
|
|
248
|
-
}
|
|
209
|
+
Icon(source: "help_center", size: 20, color: tintColor ?? Colors.black17)
|
|
210
|
+
.padding(4)
|
|
211
|
+
.onTapGesture {
|
|
212
|
+
onPressHelpCenter()
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
Rectangle()
|
|
216
|
+
.fill(tintColor ?? Colors.black20)
|
|
217
|
+
.frame(width: 0.5, height: 12)
|
|
249
218
|
|
|
250
219
|
Icon(source: "16_basic_home", size: 20, color: tintColor ?? Colors.black17)
|
|
251
220
|
.padding(4)
|
|
@@ -262,9 +231,6 @@ struct ToolkitHeaderRight: View {
|
|
|
262
231
|
)
|
|
263
232
|
.padding(.leading, Spacing.S)
|
|
264
233
|
}
|
|
265
|
-
.onAppear {
|
|
266
|
-
loadFavoriteState()
|
|
267
|
-
}
|
|
268
234
|
}
|
|
269
235
|
}
|
|
270
236
|
|
|
@@ -229,7 +229,6 @@ public struct Screen<Content: View>: View {
|
|
|
229
229
|
struct Footer: View {
|
|
230
230
|
var footerView: AnyView
|
|
231
231
|
var keyboardSize: CGFloat
|
|
232
|
-
var bottomInset: CGFloat = 0
|
|
233
232
|
|
|
234
233
|
var body: some View {
|
|
235
234
|
VStack {
|
|
@@ -237,7 +236,7 @@ struct Footer: View {
|
|
|
237
236
|
}
|
|
238
237
|
.padding(.vertical, Spacing.S)
|
|
239
238
|
.padding(.horizontal, Spacing.M)
|
|
240
|
-
.padding(.bottom, keyboardSize
|
|
239
|
+
.padding(.bottom, keyboardSize)
|
|
241
240
|
.background(Colors.black01)
|
|
242
241
|
.overlay(
|
|
243
242
|
Rectangle()
|
package/ios/Badge/Badge.swift
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import SwiftUI
|
|
2
2
|
|
|
3
3
|
public struct Badge: View {
|
|
4
|
-
@Environment(\.appTheme) private var theme
|
|
5
4
|
let label: String
|
|
6
5
|
let backgroundColor: Color?
|
|
7
6
|
|
|
@@ -39,21 +38,24 @@ public struct Badge: View {
|
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
private var badgeColor: Color {
|
|
42
|
-
//
|
|
43
|
-
let
|
|
44
|
-
? theme.colors.error.primary
|
|
45
|
-
: theme.colors.warning.primary
|
|
46
|
-
|
|
47
|
-
// Mirror Compose: only apply backgroundColor when it is one of the
|
|
48
|
-
// allowed primaryColors; otherwise fall back to the label-based default.
|
|
49
|
-
if let bgColor = backgroundColor, primaryColors.contains(bgColor) {
|
|
41
|
+
// If a custom background color is provided, use it
|
|
42
|
+
if let bgColor = backgroundColor {
|
|
50
43
|
return bgColor
|
|
51
44
|
}
|
|
52
|
-
|
|
45
|
+
|
|
46
|
+
// Otherwise, use default colors based on label type
|
|
47
|
+
if isNumber(label) {
|
|
48
|
+
return Colors.red03 // error.primary
|
|
49
|
+
} else {
|
|
50
|
+
return Colors.orange03 // warning.primary
|
|
51
|
+
}
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
public var body: some View {
|
|
56
|
-
|
|
55
|
+
Text(formatTitle(label))
|
|
56
|
+
.font(.system(size: scaleSize(10), weight: .bold))
|
|
57
|
+
.ignoreBoldTextSetting()
|
|
58
|
+
.foregroundColor(Colors.black01)
|
|
57
59
|
.padding(.horizontal, Spacing.XS)
|
|
58
60
|
.frame(minWidth: scaleSize(16), minHeight: scaleSize(16))
|
|
59
61
|
.background(badgeColor)
|
|
@@ -81,3 +83,4 @@ struct Badge_Previews: PreviewProvider {
|
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
#endif
|
|
86
|
+
|
|
@@ -77,11 +77,10 @@ public enum RibbonPosition {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
public struct BadgeRibbon: View {
|
|
80
|
-
@Environment(\.appTheme) private var theme
|
|
81
80
|
let position: RibbonPosition
|
|
82
81
|
let label: String
|
|
83
82
|
let isRound: Bool
|
|
84
|
-
let backgroundColor: Color
|
|
83
|
+
let backgroundColor: Color
|
|
85
84
|
|
|
86
85
|
public init(
|
|
87
86
|
position: RibbonPosition = .topRight,
|
|
@@ -92,7 +91,7 @@ public struct BadgeRibbon: View {
|
|
|
92
91
|
self.position = position
|
|
93
92
|
self.label = label
|
|
94
93
|
self.isRound = isRound
|
|
95
|
-
self.backgroundColor = backgroundColor
|
|
94
|
+
self.backgroundColor = backgroundColor ?? Colors.orange03
|
|
96
95
|
}
|
|
97
96
|
|
|
98
97
|
private var rotation: Angle {
|
|
@@ -118,8 +117,6 @@ public struct BadgeRibbon: View {
|
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
public var body: some View {
|
|
121
|
-
let bgColor = backgroundColor ?? theme.colors.warning.primary
|
|
122
|
-
|
|
123
120
|
HStack(alignment: verticalAlignment, spacing: 0) {
|
|
124
121
|
if useUpTail {
|
|
125
122
|
upTail
|
|
@@ -128,18 +125,22 @@ public struct BadgeRibbon: View {
|
|
|
128
125
|
}
|
|
129
126
|
|
|
130
127
|
if isRound {
|
|
131
|
-
roundContent
|
|
128
|
+
roundContent
|
|
132
129
|
} else {
|
|
133
|
-
skewContent
|
|
130
|
+
skewContent
|
|
134
131
|
}
|
|
135
132
|
}
|
|
136
133
|
.frame(height: RibbonConstants.ribbonHeight)
|
|
137
134
|
.rotationEffect(rotation)
|
|
138
135
|
}
|
|
139
136
|
|
|
140
|
-
private
|
|
137
|
+
private var roundContent: some View {
|
|
141
138
|
HStack(spacing: 0) {
|
|
142
|
-
|
|
139
|
+
Text(label)
|
|
140
|
+
.font(.system(size: scaleSize(12), weight: .medium))
|
|
141
|
+
.ignoreBoldTextSetting()
|
|
142
|
+
.foregroundColor(Colors.black01)
|
|
143
|
+
.lineLimit(1)
|
|
143
144
|
.rotationEffect(rotation)
|
|
144
145
|
}
|
|
145
146
|
.frame(height: RibbonConstants.roundHeight)
|
|
@@ -155,9 +156,13 @@ public struct BadgeRibbon: View {
|
|
|
155
156
|
)
|
|
156
157
|
}
|
|
157
158
|
|
|
158
|
-
private
|
|
159
|
+
private var skewContent: some View {
|
|
159
160
|
HStack(spacing: 0) {
|
|
160
|
-
|
|
161
|
+
Text(label)
|
|
162
|
+
.font(.system(size: scaleSize(12), weight: .medium))
|
|
163
|
+
.ignoreBoldTextSetting()
|
|
164
|
+
.foregroundColor(Colors.black01)
|
|
165
|
+
.lineLimit(1)
|
|
161
166
|
.rotationEffect(rotation)
|
|
162
167
|
.frame(height: RibbonConstants.skewBodyHeight)
|
|
163
168
|
.padding(.horizontal, 8)
|
|
@@ -174,6 +179,7 @@ public struct BadgeRibbon: View {
|
|
|
174
179
|
)
|
|
175
180
|
.frame(width: RibbonConstants.headTailWidth, height: RibbonConstants.headTailHeight)
|
|
176
181
|
.rotationEffect(.degrees(180))
|
|
182
|
+
.offset(x: 1)
|
|
177
183
|
.clipped()
|
|
178
184
|
}
|
|
179
185
|
|
|
@@ -183,6 +189,7 @@ public struct BadgeRibbon: View {
|
|
|
183
189
|
placeholder: AnyView(Color.clear)
|
|
184
190
|
)
|
|
185
191
|
.frame(width: RibbonConstants.headTailWidth, height: RibbonConstants.headTailHeight)
|
|
192
|
+
.offset(x: 1)
|
|
186
193
|
.clipped()
|
|
187
194
|
}
|
|
188
195
|
|
|
@@ -192,6 +199,7 @@ public struct BadgeRibbon: View {
|
|
|
192
199
|
placeholder: AnyView(Color.clear)
|
|
193
200
|
)
|
|
194
201
|
.frame(width: RibbonConstants.skewTailWidth, height: RibbonConstants.skewTailHeight)
|
|
202
|
+
.offset(x: -2)
|
|
195
203
|
.clipped()
|
|
196
204
|
}
|
|
197
205
|
}
|
|
@@ -201,7 +209,7 @@ private struct RibbonConstants {
|
|
|
201
209
|
static let ribbonHeight: CGFloat = 20
|
|
202
210
|
static let roundHeight: CGFloat = 16
|
|
203
211
|
static let skewBodyHeight: CGFloat = 16
|
|
204
|
-
static let roundRightRadius: CGFloat =
|
|
212
|
+
static let roundRightRadius: CGFloat = 8
|
|
205
213
|
static let roundPaddingEnd: CGFloat = 6
|
|
206
214
|
static let skewTailWidth: CGFloat = 8
|
|
207
215
|
static let skewTailHeight: CGFloat = 16
|
|
@@ -233,3 +241,4 @@ struct BadgeRibbon_Previews: PreviewProvider {
|
|
|
233
241
|
}
|
|
234
242
|
}
|
|
235
243
|
#endif
|
|
244
|
+
|
package/ios/Button/Button.swift
CHANGED
|
@@ -31,45 +31,33 @@ public struct ButtonStyleData {
|
|
|
31
31
|
|
|
32
32
|
public extension ButtonType {
|
|
33
33
|
func backgroundColor(loading: Bool) -> Color {
|
|
34
|
-
backgroundColor(loading: loading, theme: defaultTheme)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
func backgroundColor(loading: Bool, theme: Theme) -> Color {
|
|
38
34
|
switch self {
|
|
39
|
-
case .disabled: return
|
|
40
|
-
case .primary: return
|
|
41
|
-
case .secondary: return
|
|
42
|
-
case .outline: return
|
|
43
|
-
case .tonal: return
|
|
44
|
-
case .danger: return
|
|
35
|
+
case .disabled: return Colors.black05.opacity(loading ? 0.75 : 1)
|
|
36
|
+
case .primary: return Colors.primary.opacity(loading ? 0.75 : 1)
|
|
37
|
+
case .secondary: return Colors.card.opacity(loading ? 0.75 : 1)
|
|
38
|
+
case .outline: return Colors.card.opacity(loading ? 0.75 : 1)
|
|
39
|
+
case .tonal: return Colors.primaryLight.opacity(loading ? 0.75 : 1)
|
|
40
|
+
case .danger: return Colors.error.opacity(loading ? 0.75 : 1)
|
|
45
41
|
case .text: return .clear
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
func contentColor(loading: Bool) -> Color {
|
|
50
|
-
contentColor(loading: loading, theme: defaultTheme)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
func contentColor(loading: Bool, theme: Theme) -> Color {
|
|
54
46
|
switch self {
|
|
55
|
-
case .disabled: return
|
|
47
|
+
case .disabled: return Colors.black06.opacity(loading ? 0.75 : 1)
|
|
56
48
|
case .primary: return Colors.black01
|
|
57
|
-
case .secondary: return
|
|
58
|
-
case .outline: return
|
|
59
|
-
case .tonal: return
|
|
49
|
+
case .secondary: return Colors.black17
|
|
50
|
+
case .outline: return Colors.primary
|
|
51
|
+
case .tonal: return Colors.primary
|
|
60
52
|
case .danger: return Colors.black01
|
|
61
|
-
case .text: return
|
|
53
|
+
case .text: return Colors.primary
|
|
62
54
|
}
|
|
63
55
|
}
|
|
64
56
|
|
|
65
57
|
var borderColor: Color? {
|
|
66
|
-
borderColor(theme: defaultTheme)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
func borderColor(theme: Theme) -> Color? {
|
|
70
58
|
switch self {
|
|
71
|
-
case .outline: return
|
|
72
|
-
case .secondary: return
|
|
59
|
+
case .outline: return Colors.primary
|
|
60
|
+
case .secondary: return Colors.black04
|
|
73
61
|
default: return nil
|
|
74
62
|
}
|
|
75
63
|
}
|
|
@@ -129,7 +117,6 @@ extension ButtonSize {
|
|
|
129
117
|
}
|
|
130
118
|
|
|
131
119
|
public struct Button: View {
|
|
132
|
-
@Environment(\.appTheme) private var theme
|
|
133
120
|
var title: String
|
|
134
121
|
var action: () -> Void
|
|
135
122
|
var type: ButtonType
|
|
@@ -138,7 +125,6 @@ public struct Button: View {
|
|
|
138
125
|
var iconRight: AnyView?
|
|
139
126
|
var isFull: Bool
|
|
140
127
|
var loading: Bool
|
|
141
|
-
var useTintColor: Bool
|
|
142
128
|
|
|
143
129
|
public init(
|
|
144
130
|
title: String = "",
|
|
@@ -148,8 +134,7 @@ public struct Button: View {
|
|
|
148
134
|
iconLeft: AnyView? = nil,
|
|
149
135
|
iconRight: AnyView? = nil,
|
|
150
136
|
isFull: Bool = true,
|
|
151
|
-
loading: Bool = false
|
|
152
|
-
useTintColor: Bool = true
|
|
137
|
+
loading: Bool = false
|
|
153
138
|
) {
|
|
154
139
|
self.title = title
|
|
155
140
|
self.action = action
|
|
@@ -159,7 +144,6 @@ public struct Button: View {
|
|
|
159
144
|
self.iconRight = iconRight
|
|
160
145
|
self.isFull = isFull
|
|
161
146
|
self.loading = loading
|
|
162
|
-
self.useTintColor = useTintColor
|
|
163
147
|
}
|
|
164
148
|
|
|
165
149
|
private func shouldLoadingOnLeft(_ left: AnyView?, _ right: AnyView?) -> Bool {
|
|
@@ -176,15 +160,14 @@ public struct Button: View {
|
|
|
176
160
|
|
|
177
161
|
public var body: some View {
|
|
178
162
|
let loadingOnLeft = shouldLoadingOnLeft(iconLeft, iconRight)
|
|
179
|
-
let isEnabled = type != .disabled && !loading
|
|
180
163
|
|
|
181
|
-
let bg = type.backgroundColor(loading: loading
|
|
182
|
-
let fg = type.contentColor(loading: loading
|
|
183
|
-
let border = type.borderColor
|
|
164
|
+
let bg = type.backgroundColor(loading: loading)
|
|
165
|
+
let fg = type.contentColor(loading: loading)
|
|
166
|
+
let border = type.borderColor
|
|
184
167
|
let borderWidth = type.borderWidth
|
|
185
168
|
|
|
186
169
|
SwiftUI.Button(action: {
|
|
187
|
-
if
|
|
170
|
+
if !loading, type != .disabled {
|
|
188
171
|
action()
|
|
189
172
|
}
|
|
190
173
|
}) {
|
|
@@ -195,7 +178,7 @@ public struct Button: View {
|
|
|
195
178
|
.colorMultiply(fg)
|
|
196
179
|
|
|
197
180
|
} else if let iconLeft = iconLeft {
|
|
198
|
-
|
|
181
|
+
iconLeft.frame(width: size.iconSize, height: size.iconSize)
|
|
199
182
|
}
|
|
200
183
|
|
|
201
184
|
MomoText(title, typography: size.typographyStyle, color: fg)
|
|
@@ -208,7 +191,7 @@ public struct Button: View {
|
|
|
208
191
|
.colorMultiply(fg)
|
|
209
192
|
|
|
210
193
|
} else if let iconRight = iconRight {
|
|
211
|
-
|
|
194
|
+
iconRight.frame(width: size.iconSize, height: size.iconSize)
|
|
212
195
|
}
|
|
213
196
|
}
|
|
214
197
|
.frame(maxWidth: isFull ? .infinity : nil)
|
|
@@ -220,30 +203,8 @@ public struct Button: View {
|
|
|
220
203
|
.strokeBorder(border ?? .clear, lineWidth: border != nil ? borderWidth : 0)
|
|
221
204
|
)
|
|
222
205
|
.clipShape(RoundedRectangle(cornerRadius: size.radius))
|
|
206
|
+
.opacity(loading ? 0.75 : 1)
|
|
223
207
|
}
|
|
224
|
-
.
|
|
225
|
-
.disabled(!isEnabled)
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
@ViewBuilder
|
|
229
|
-
private func tintedIcon(_ icon: AnyView, color: Color) -> some View {
|
|
230
|
-
if useTintColor {
|
|
231
|
-
icon
|
|
232
|
-
.frame(width: size.iconSize, height: size.iconSize)
|
|
233
|
-
.colorMultiply(color)
|
|
234
|
-
} else {
|
|
235
|
-
icon
|
|
236
|
-
.frame(width: size.iconSize, height: size.iconSize)
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
private struct ButtonPressFeedbackStyle: ButtonStyle {
|
|
242
|
-
let isEnabled: Bool
|
|
243
|
-
|
|
244
|
-
func makeBody(configuration: Configuration) -> some View {
|
|
245
|
-
configuration.label
|
|
246
|
-
.opacity(configuration.isPressed && isEnabled ? 0.5 : 1)
|
|
247
|
-
.animation(.easeInOut(duration: 0.1), value: configuration.isPressed)
|
|
208
|
+
.disabled(type == .disabled || loading)
|
|
248
209
|
}
|
|
249
210
|
}
|
|
@@ -2,7 +2,6 @@ import Foundation
|
|
|
2
2
|
import SwiftUI
|
|
3
3
|
|
|
4
4
|
public struct Checkbox: View{
|
|
5
|
-
@Environment(\.appTheme) private var theme
|
|
6
5
|
@Binding var checked: Bool
|
|
7
6
|
var disabled: Bool
|
|
8
7
|
var onChange: ((Bool)->Void)?
|
|
@@ -38,11 +37,11 @@ public struct Checkbox: View{
|
|
|
38
37
|
)
|
|
39
38
|
|
|
40
39
|
if checked {
|
|
41
|
-
Image(systemName: indeterminate ? "minus" : "checkmark")
|
|
40
|
+
Image(systemName: indeterminate ? "minus.square.fill" : "checkmark.square.fill")
|
|
42
41
|
.resizable()
|
|
43
|
-
.
|
|
44
|
-
.
|
|
45
|
-
.frame(width:
|
|
42
|
+
.foregroundColor(backgroundColor)
|
|
43
|
+
.background(Colors.black01)
|
|
44
|
+
.frame(width: 20, height: 20)
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
|
|
@@ -54,28 +53,28 @@ public struct Checkbox: View{
|
|
|
54
53
|
|
|
55
54
|
// Title
|
|
56
55
|
if !title.isEmpty {
|
|
57
|
-
|
|
56
|
+
Text(title)
|
|
57
|
+
.font(.description1)
|
|
58
|
+
.ignoreBoldTextSetting()
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
private var borderColor: Color {
|
|
63
|
-
if disabled
|
|
64
|
-
return
|
|
65
|
-
} else if disabled {
|
|
66
|
-
return theme.colors.border.disable
|
|
64
|
+
if disabled {
|
|
65
|
+
return Colors.black03
|
|
67
66
|
} else if checked {
|
|
68
|
-
return
|
|
67
|
+
return Colors.primary
|
|
69
68
|
} else {
|
|
70
|
-
return
|
|
69
|
+
return Colors.text
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
private var backgroundColor: Color {
|
|
75
74
|
if disabled && checked {
|
|
76
|
-
return
|
|
75
|
+
return Colors.pink08
|
|
77
76
|
} else if checked {
|
|
78
|
-
return
|
|
77
|
+
return Colors.primary
|
|
79
78
|
} else {
|
|
80
79
|
return Color.clear
|
|
81
80
|
}
|
package/ios/Chip/Chip.swift
CHANGED
|
@@ -2,18 +2,17 @@ import SwiftUI
|
|
|
2
2
|
import Foundation
|
|
3
3
|
|
|
4
4
|
public struct Chip: View {
|
|
5
|
-
@Environment(\.appTheme) private var theme
|
|
6
5
|
public enum ChipSize { case small, large }
|
|
7
6
|
|
|
8
7
|
public struct Dimensions {
|
|
9
|
-
let height: CGFloat
|
|
10
8
|
let horizontal: CGFloat
|
|
9
|
+
let vertical: CGFloat
|
|
11
10
|
let iconSize: CGFloat
|
|
12
11
|
let iconSpacing: CGFloat
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
public static let Large = Dimensions(
|
|
16
|
-
public static let Small = Dimensions(
|
|
14
|
+
public static let Large = Dimensions(horizontal: 12, vertical: 8, iconSize: 20, iconSpacing: 8)
|
|
15
|
+
public static let Small = Dimensions(horizontal: 10, vertical: 6, iconSize: 16, iconSpacing: 6)
|
|
17
16
|
|
|
18
17
|
private let label: String?
|
|
19
18
|
private let iconLeft: String?
|
|
@@ -54,14 +53,14 @@ public struct Chip: View {
|
|
|
54
53
|
let dims = (size == .small) ? Self.Small : Self.Large
|
|
55
54
|
|
|
56
55
|
let bg: Color = {
|
|
57
|
-
if selected { return
|
|
56
|
+
if selected { return Colors.pink10 }
|
|
58
57
|
if let explicit = backgroundColor { return explicit }
|
|
59
58
|
return Colors.black03
|
|
60
59
|
}()
|
|
61
60
|
|
|
62
|
-
let textColor: Color = selected ?
|
|
63
|
-
let leftTint: Color = selected ?
|
|
64
|
-
let rightTint: Color = selected ?
|
|
61
|
+
let textColor: Color = selected ? Colors.primary : Colors.text
|
|
62
|
+
let leftTint: Color = selected ? Colors.primary : iconLeftTint ?? Colors.text
|
|
63
|
+
let rightTint: Color = selected ? Colors.primary : iconRightTint ?? Colors.text
|
|
65
64
|
|
|
66
65
|
HStack(spacing: dims.iconSpacing) {
|
|
67
66
|
if let iconLeft {
|
|
@@ -78,7 +77,7 @@ public struct Chip: View {
|
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
.padding(.horizontal, dims.horizontal)
|
|
81
|
-
.
|
|
80
|
+
.padding(.vertical, dims.vertical)
|
|
82
81
|
.background(
|
|
83
82
|
RoundedRectangle(cornerRadius: Radius.L, style: .continuous)
|
|
84
83
|
.fill(bg)
|
|
@@ -87,24 +86,11 @@ public struct Chip: View {
|
|
|
87
86
|
Group {
|
|
88
87
|
if selected {
|
|
89
88
|
RoundedRectangle(cornerRadius: Radius.L, style: .continuous)
|
|
90
|
-
.stroke(
|
|
89
|
+
.stroke(Colors.primary, lineWidth: 2)
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
)
|
|
94
93
|
.contentShape(RoundedRectangle(cornerRadius: Radius.L, style: .continuous))
|
|
95
94
|
.onTapGesture(perform: onClick)
|
|
96
|
-
.modifier(ChipAccessibilityModifier(accessibilityLabel: accessibilityLabel))
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
private struct ChipAccessibilityModifier: ViewModifier {
|
|
101
|
-
let accessibilityLabel: String?
|
|
102
|
-
|
|
103
|
-
func body(content: Content) -> some View {
|
|
104
|
-
if let id = accessibilityLabel {
|
|
105
|
-
content.accessibilityIdentifier(id)
|
|
106
|
-
} else {
|
|
107
|
-
content
|
|
108
|
-
}
|
|
109
95
|
}
|
|
110
96
|
}
|