@momo-kits/native-kits 0.0.1-beta.4 → 0.0.2-alpha.1
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 +99 -0
- package/PUBLISH_GUIDE.md +675 -0
- package/README.md +184 -5
- package/ios/Application/ApplicationEnvironment.swift +71 -0
- package/ios/Application/Components.swift +270 -0
- package/ios/Application/ComposeApi.swift +22 -0
- package/ios/Application/FloatingButton.swift +174 -0
- package/ios/Application/HeaderRight.swift +306 -0
- package/ios/Application/LanguageSource.swift +93 -0
- package/ios/Application/Localize.swift +378 -0
- package/ios/Application/LocalizeModifier.swift +30 -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 +213 -0
- package/ios/Application/Navigation/NavigationOptions.swift +109 -0
- package/ios/Application/Navigation/Navigator.swift +453 -0
- package/ios/Application/Navigation/NavigatorManager.swift +22 -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/NavigationFooter.swift +90 -0
- package/ios/Application/Navigation/component/NavigationHeaderRight.swift +196 -0
- package/ios/Application/Screen.swift +250 -0
- package/ios/Application/StackScreen.swift +492 -0
- package/ios/Avatar/Avatar.swift +193 -0
- package/ios/Badge/Badge.swift +84 -0
- package/ios/Badge/BadgeDot.swift +31 -0
- package/ios/Badge/BadgeRibbon.swift +319 -0
- package/ios/BaselineView/BaselineView.swift +163 -0
- package/ios/Button/Button.swift +232 -84
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
- package/ios/Carousel/Carousel.swift +196 -0
- package/ios/Checkbox/Checkbox.swift +77 -0
- package/ios/Chip/Chip.swift +120 -0
- package/ios/Collapse/Collapse.swift +192 -0
- package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Colors.swift +42 -37
- package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
- package/ios/{Colors+Spacing → 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 +69 -0
- package/ios/IconButton/IconButton.swift +140 -0
- package/ios/Image/Image.swift +87 -0
- package/ios/Information/Information.swift +156 -0
- package/ios/Input/ErrorView.swift +58 -0
- package/ios/Input/Input.swift +461 -77
- package/ios/Input/InputPhoneNumber.swift +192 -0
- package/ios/Input/InputSearch.swift +301 -0
- package/ios/Input/InputTextArea.swift +318 -0
- package/ios/InputDropDown/InputDropDown.swift +201 -0
- package/ios/InputMoney/InputMoney.swift +405 -0
- package/ios/InputOTP/InputOTP.swift +211 -0
- package/ios/Layout/GridContext.swift +30 -0
- package/ios/Layout/Item.swift +42 -0
- package/ios/Layout/Section.swift +134 -0
- package/ios/Loader/Loader.swift +113 -0
- package/ios/Lottie/LottieView.swift +86 -0
- package/ios/MoMoUIKits.podspec +5 -0
- package/ios/OTPKeyboard/KeyboardButton.swift +13 -5
- package/ios/OTPKeyboard/OTPKeyboard.swift +1 -1
- package/ios/Pagination/PaginationDot.swift +61 -0
- package/ios/Pagination/PaginationNumber.swift +35 -0
- package/ios/Pagination/PaginationScroll.swift +101 -0
- package/ios/Pagination/PaginationWhiteDot.swift +37 -0
- package/ios/Popup/PopupDisplay.swift +279 -0
- package/ios/Popup/PopupInput.swift +92 -0
- package/ios/Popup/PopupNotify.swift +219 -0
- package/ios/Popup/PopupPromotion.swift +74 -0
- package/ios/PopupView/FullscreenPopup.swift +251 -0
- package/ios/{Popup → PopupView}/Modifiers.swift +6 -20
- package/ios/{Popup → PopupView}/PopupView.swift +38 -146
- package/ios/PopupView/Utils++.swift +281 -0
- package/ios/ProgressInfo/ProgressInfo.swift +297 -0
- package/ios/Radio/Radio.swift +69 -0
- package/ios/Rating/Rating.swift +83 -0
- package/{example/ios/Example/Preview Content/Preview Assets.xcassets/Contents.json → ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json} +5 -0
- package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Text.colorset/Contents.json +3 -3
- 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/ScrollIndicator/ScrollIndicator.swift +110 -0
- package/ios/Skeleton/Skeleton.swift +99 -0
- package/ios/Slider/Slider.swift +237 -0
- package/ios/StatusBarTap/StatusBarTap.h +13 -0
- package/ios/StatusBarTap/StatusBarTap.m +75 -0
- package/ios/Stepper/Stepper.swift +221 -0
- package/ios/Steps/Steps.swift +467 -0
- package/ios/SuggestAction/SuggestAction.swift +100 -0
- package/ios/Swipeable/SwipeCell.swift +226 -31
- package/ios/Swipeable/SwipeCellModel.swift +21 -0
- package/ios/Switch/Switch.swift +69 -0
- package/ios/TabView/TabView.swift +534 -0
- package/ios/Tag/Tag.swift +99 -0
- package/ios/Template/Logo/Logo.swift +75 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +123 -0
- package/ios/Title/Title.swift +270 -0
- package/ios/Tooltip/Tooltip.swift +486 -0
- package/ios/Typography/FontScale.swift +103 -0
- package/ios/Typography/FontScaleStore.swift +58 -0
- package/ios/Typography/KitDesignSystem.swift +17 -0
- package/ios/Typography/Text.swift +262 -0
- package/ios/Typography/Typography.swift +80 -23
- package/ios/Uploader/Uploader.swift +174 -0
- package/ios/native-kits.podspec +73 -13
- package/ios-demo/MoMoUIKitsDemo.podspec +20 -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 +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +75 -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 +108 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +96 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +60 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +76 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +102 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DemoScreen.swift +420 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +56 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +276 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconDemo.swift +81 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +65 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +96 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +117 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +94 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +94 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +88 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +120 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +85 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +87 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +73 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +235 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +241 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +68 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PlaygroundData.swift +76 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +95 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +67 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +101 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +64 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +68 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SectionDemo.swift +83 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +61 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +90 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +82 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +114 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +90 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +58 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +114 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +86 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +181 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +104 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +118 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +85 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +53 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
- package/package.json +6 -6
- package/publish.sh +554 -20
- package/scripts/gen-ios-color.mjs +136 -0
- package/CODE_OF_CONDUCT.md +0 -133
- package/CONTRIBUTING.md +0 -114
- package/LICENSE +0 -20
- package/android/build.gradle +0 -82
- package/android/gradle.properties +0 -5
- package/android/src/main/AndroidManifest.xml +0 -4
- package/android/src/main/java/com/momoplatform/nativekits/NativeKitsPackage.kt +0 -17
- package/android/src/main/java/com/momoplatform/nativekits/NativeKitsViewManager.kt +0 -20
- package/example/ios/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -63
- package/example/ios/Example/ComponentDetail.swift +0 -35
- package/example/ios/Example/ComponentItem.swift +0 -24
- package/example/ios/Example/ComponentModel.swift +0 -33
- package/example/ios/Example/ContentView.swift +0 -53
- package/example/ios/Example/Example.entitlements +0 -10
- package/example/ios/Example/Foundation/ButtonDemo.swift +0 -80
- package/example/ios/Example/Foundation/Popup/ActionSheets.swift +0 -136
- package/example/ios/Example/Foundation/Popup/Floats.swift +0 -127
- package/example/ios/Example/Foundation/Popup/Popups.swift +0 -101
- package/example/ios/Example/Foundation/PopupDemo.swift +0 -366
- package/example/ios/Example/Foundation/TextInputDemo.swift +0 -31
- package/example/ios/Example/Foundation/TypographyDemo.swift +0 -53
- package/example/ios/Example/Foundation.swift +0 -26
- package/example/ios/Example/Info.plist +0 -18
- package/example/ios/Example/Library/SwipeableDemo.swift +0 -105
- package/example/ios/Example/Library.swift +0 -26
- package/example/ios/Example/Main.swift +0 -11
- package/example/ios/Example/Overview.swift +0 -20
- package/example/ios/Example/Resource/SFProText-Black.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Bold.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Heavy.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Light.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Medium.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Regular.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Semibold.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Thin.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Ultralight.ttf +0 -0
- package/example/ios/Example/Resource/foundation.json +0 -33
- package/example/ios/Example/Resource/library.json +0 -8
- package/example/ios/Example/Utils.swift +0 -30
- package/example/ios/Example/ViewModifier/DarkViewModifier.swift +0 -22
- package/example/ios/Example.xcodeproj/project.pbxproj +0 -570
- package/example/ios/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/example/ios/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/example/ios/Example.xcodeproj/project.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/example/ios/Example.xcworkspace/contents.xcworkspacedata +0 -10
- package/example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
- package/example/ios/Podfile +0 -6
- package/example/ios/Podfile.lock +0 -16
- package/example/ios/Pods/Local Podspecs/MoMoUIKits.podspec.json +0 -29
- package/example/ios/Pods/Manifest.lock +0 -16
- package/example/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -661
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -25
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-dummy.m +0 -5
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-prefix.pch +0 -12
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-umbrella.h +0 -16
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.debug.xcconfig +0 -12
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.modulemap +0 -6
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.release.xcconfig +0 -12
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown +0 -3
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist +0 -29
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m +0 -5
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h +0 -16
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig +0 -14
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.modulemap +0 -6
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig +0 -14
- package/ios/Colors+Spacing/Radius.swift +0 -11
- package/ios/Popup/Utils++.swift +0 -163
- package/ios/Theme.md +0 -18
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Background.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Border.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Card.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Error.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Primary.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/PrimaryDark.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/PrimaryLight.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Secondary.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Success.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/TextSecondary.colorset/Contents.json +0 -0
- /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Warning.colorset/Contents.json +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import MoMoUIKits
|
|
2
|
+
import SwiftUI
|
|
3
|
+
|
|
4
|
+
struct BaselineViewDemo: View {
|
|
5
|
+
@State private var enabled = true
|
|
6
|
+
|
|
7
|
+
var body: some View {
|
|
8
|
+
GeometryReader { geometry in
|
|
9
|
+
ZStack(alignment: .top) {
|
|
10
|
+
demoContent(
|
|
11
|
+
topInset: geometry.safeAreaInsets.top,
|
|
12
|
+
bottomInset: geometry.safeAreaInsets.bottom
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
MoMoUIKits.BaselineView(enabled: enabled)
|
|
16
|
+
}
|
|
17
|
+
.background(Colors.black02)
|
|
18
|
+
.ignoresSafeArea(.container, edges: [.top, .bottom])
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private func demoContent(topInset: CGFloat, bottomInset: CGFloat) -> some View {
|
|
23
|
+
VStack(spacing: 0) {
|
|
24
|
+
header(topInset: topInset)
|
|
25
|
+
|
|
26
|
+
ScrollView {
|
|
27
|
+
VStack(alignment: .leading, spacing: 16) {
|
|
28
|
+
Toggle(isOn: $enabled) {
|
|
29
|
+
MomoText("Show baseline overlay", typography: .headerDefaultBold)
|
|
30
|
+
}
|
|
31
|
+
.padding(16)
|
|
32
|
+
.background(Colors.black01)
|
|
33
|
+
.cornerRadius(Radius.M)
|
|
34
|
+
|
|
35
|
+
MomoText(
|
|
36
|
+
"Use this screen to inspect the safe area, header, horizontal spacing, bottom tab, and button baseline guides.",
|
|
37
|
+
typography: .bodyDefaultRegular,
|
|
38
|
+
color: Colors.textSecondary
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
ForEach(1...8, id: \.self) { index in
|
|
42
|
+
sampleRow(index)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
.padding(.horizontal, 16)
|
|
46
|
+
.padding(.top, 16)
|
|
47
|
+
.padding(.bottom, 88)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
bottomAction(bottomInset: bottomInset)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private func header(topInset: CGFloat) -> some View {
|
|
55
|
+
VStack(spacing: 0) {
|
|
56
|
+
Color.clear
|
|
57
|
+
.frame(height: topInset)
|
|
58
|
+
|
|
59
|
+
HStack(spacing: 12) {
|
|
60
|
+
Image(systemName: "chevron.left")
|
|
61
|
+
.font(.system(size: 18, weight: .semibold))
|
|
62
|
+
.frame(width: 40, height: 52)
|
|
63
|
+
|
|
64
|
+
MomoText("Baseline View", typography: .headerDefaultBold)
|
|
65
|
+
|
|
66
|
+
Spacer(minLength: 0)
|
|
67
|
+
}
|
|
68
|
+
.frame(height: 52)
|
|
69
|
+
.padding(.horizontal, 12)
|
|
70
|
+
.background(Colors.black01)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private func sampleRow(_ index: Int) -> some View {
|
|
75
|
+
HStack(spacing: 12) {
|
|
76
|
+
Circle()
|
|
77
|
+
.fill(Colors.primaryLight)
|
|
78
|
+
.frame(width: 36, height: 36)
|
|
79
|
+
.overlay(
|
|
80
|
+
MomoText("\(index)", typography: .labelSMedium, color: Colors.primary)
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
VStack(alignment: .leading, spacing: 4) {
|
|
84
|
+
MomoText("Content row \(index)", typography: .headerSSemibold)
|
|
85
|
+
MomoText("Scrollable content under the debug overlay.", color: Colors.textSecondary)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
Spacer(minLength: 0)
|
|
89
|
+
}
|
|
90
|
+
.padding(16)
|
|
91
|
+
.background(Colors.black01)
|
|
92
|
+
.cornerRadius(Radius.M)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private func bottomAction(bottomInset: CGFloat) -> some View {
|
|
96
|
+
VStack(spacing: 8) {
|
|
97
|
+
MoMoUIKits.Button(
|
|
98
|
+
title: "Primary action",
|
|
99
|
+
action: {},
|
|
100
|
+
type: .primary,
|
|
101
|
+
size: .large
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
.padding(.horizontal, 16)
|
|
105
|
+
.padding(.top, 8)
|
|
106
|
+
.padding(.bottom, bottomInset)
|
|
107
|
+
.background(Colors.black01)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
#if DEBUG
|
|
112
|
+
struct BaselineViewDemo_Previews: PreviewProvider {
|
|
113
|
+
static var previews: some View {
|
|
114
|
+
BaselineViewDemo()
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
#endif
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
//
|
|
2
|
+
// BottomTabDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Usage demo for the bottom-tab navigation. Mirrors Compose's `BottomTabUsage`:
|
|
6
|
+
// four tabs (each with its own header title + badge) and a center floating
|
|
7
|
+
// button. Must be hosted inside a `NavigationContainer` (uses the Navigator).
|
|
8
|
+
//
|
|
9
|
+
|
|
10
|
+
import MoMoUIKits
|
|
11
|
+
import SwiftUI
|
|
12
|
+
|
|
13
|
+
@available(iOS 16.0, *)
|
|
14
|
+
struct BottomTabDemoContent: View {
|
|
15
|
+
@EnvironmentObject private var navigator: Navigator
|
|
16
|
+
|
|
17
|
+
var body: some View {
|
|
18
|
+
BottomTab(
|
|
19
|
+
items: [
|
|
20
|
+
BottomTabItem(
|
|
21
|
+
name: "Tab1",
|
|
22
|
+
label: "Option 1",
|
|
23
|
+
icon: "16_basic_home",
|
|
24
|
+
badgeLabel: "",
|
|
25
|
+
options: NavigationOptions(headerTitle: .default("Option 1"), hiddenBack: false),
|
|
26
|
+
screen: { tabBody("Option 1", Colors.blue09) }
|
|
27
|
+
),
|
|
28
|
+
BottomTabItem(
|
|
29
|
+
name: "Tab2",
|
|
30
|
+
label: "Option 2",
|
|
31
|
+
icon: "help_center",
|
|
32
|
+
badgeLabel: "0", // hidden (mirrors Compose's "0" → no badge)
|
|
33
|
+
options: NavigationOptions(headerTitle: .default("Option 2")),
|
|
34
|
+
screen: { tabBody("Option 2", Colors.pink09) }
|
|
35
|
+
),
|
|
36
|
+
BottomTabItem(
|
|
37
|
+
name: "Tab3",
|
|
38
|
+
label: "Option 3 with a very long label",
|
|
39
|
+
icon: "pin_star",
|
|
40
|
+
badgeLabel: "New",
|
|
41
|
+
options: NavigationOptions(headerTitle: .default("Option 3")),
|
|
42
|
+
screen: { tabBody("Option 3", Colors.yellow09) }
|
|
43
|
+
),
|
|
44
|
+
BottomTabItem(
|
|
45
|
+
name: "Tab4",
|
|
46
|
+
label: "Option 4 also quite long here",
|
|
47
|
+
icon: "navigation_more_icon",
|
|
48
|
+
badgeLabel: "9999",
|
|
49
|
+
options: NavigationOptions(headerTitle: .default("Option 4")),
|
|
50
|
+
screen: { tabBody("Option 4", Colors.blue10) }
|
|
51
|
+
)
|
|
52
|
+
],
|
|
53
|
+
floatingButton: BottomTabFloatingButton(
|
|
54
|
+
icon: "16_basic_home",
|
|
55
|
+
label: "Quét QR",
|
|
56
|
+
onPress: { navigator.push({ qrScreen }, options: NavigationOptions(title: "QR")) }
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@ViewBuilder
|
|
62
|
+
private func tabBody(_ title: String, _ color: Color) -> some View {
|
|
63
|
+
VStack {
|
|
64
|
+
MomoText(title, typography: .headerDefaultBold)
|
|
65
|
+
.padding(.top, 24)
|
|
66
|
+
Spacer()
|
|
67
|
+
}
|
|
68
|
+
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
69
|
+
.background(color)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private var qrScreen: some View {
|
|
73
|
+
VStack { MomoText("QR scanner placeholder") }
|
|
74
|
+
.frame(maxWidth: .infinity)
|
|
75
|
+
.padding(24)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// MARK: - Standalone wrapper (so it can be opened directly from Home too)
|
|
80
|
+
|
|
81
|
+
struct BottomTabDemo: View {
|
|
82
|
+
var body: some View {
|
|
83
|
+
if #available(iOS 16.0, *) {
|
|
84
|
+
BottomTabDemoContent()
|
|
85
|
+
} else {
|
|
86
|
+
Text("Bottom tab demo requires iOS 16+").padding()
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ButtonDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo, mirroring Compose's ButtonUsage.kt.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
struct ButtonDemo: View {
|
|
12
|
+
var body: some View {
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
DemoScreen(preview: { ButtonPreview() }, playground: { ButtonPlayground() })
|
|
15
|
+
} else {
|
|
16
|
+
Text("Requires iOS 16+").padding()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// MARK: - Preview
|
|
22
|
+
|
|
23
|
+
private struct ButtonPreview: View {
|
|
24
|
+
private let url = "https://static-00.iconduck.com/assets.00/external-link-icon-512x512-h2zzryfc.png"
|
|
25
|
+
|
|
26
|
+
var body: some View {
|
|
27
|
+
BasicColumnBox("Title") {
|
|
28
|
+
MoMoUIKits.Button(title: "Open", action: {})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
BasicColumnBox("Type") {
|
|
32
|
+
MoMoUIKits.Button(title: "PRIMARY", action: {}, type: .primary)
|
|
33
|
+
MoMoUIKits.Button(title: "DANGER", action: {}, type: .danger)
|
|
34
|
+
MoMoUIKits.Button(title: "SECONDARY", action: {}, type: .secondary)
|
|
35
|
+
MoMoUIKits.Button(title: "TONAL", action: {}, type: .tonal)
|
|
36
|
+
MoMoUIKits.Button(title: "OUTLINE", action: {}, type: .outline)
|
|
37
|
+
MoMoUIKits.Button(title: "TEXT", action: {}, type: .text)
|
|
38
|
+
MoMoUIKits.Button(title: "DISABLED", action: {}, type: .disabled)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
BasicColumnBox("Size") {
|
|
42
|
+
MoMoUIKits.Button(title: "LARGE", action: {}, size: .large)
|
|
43
|
+
MoMoUIKits.Button(title: "MEDIUM", action: {}, size: .medium)
|
|
44
|
+
MoMoUIKits.Button(title: "SMALL", action: {}, size: .small)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
BasicColumnBox("Loading") {
|
|
48
|
+
MoMoUIKits.Button(title: "PRIMARY", action: {}, type: .primary, loading: true)
|
|
49
|
+
MoMoUIKits.Button(title: "DANGER", action: {}, type: .danger, loading: true)
|
|
50
|
+
MoMoUIKits.Button(title: "SECONDARY", action: {}, type: .secondary, loading: true)
|
|
51
|
+
MoMoUIKits.Button(title: "TONAL", action: {}, type: .tonal, loading: true)
|
|
52
|
+
MoMoUIKits.Button(title: "OUTLINE", action: {}, type: .outline, loading: true)
|
|
53
|
+
MoMoUIKits.Button(title: "TEXT", action: {}, type: .text, loading: true)
|
|
54
|
+
MoMoUIKits.Button(title: "DISABLED", action: {}, type: .disabled, loading: true)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
BasicColumnBox("Icon Right") {
|
|
58
|
+
MoMoUIKits.Button(title: "Icon", action: {}, iconRight: url)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
BasicColumnBox("Icon Left") {
|
|
62
|
+
MoMoUIKits.Button(title: "Icon", action: {}, iconLeft: url)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// MARK: - Playground
|
|
68
|
+
|
|
69
|
+
@available(iOS 16.0, *)
|
|
70
|
+
private struct ButtonPlayground: View {
|
|
71
|
+
@State private var title = "Button"
|
|
72
|
+
@State private var type: PlaygroundOption? = buttonTypeList.first { $0.key == "primary" }
|
|
73
|
+
@State private var size: PlaygroundOption? = buttonSizeList.first { $0.key == "large" }
|
|
74
|
+
@State private var iconRight: PlaygroundOption?
|
|
75
|
+
// Seeded (Compose leaves both nil) so the UseTintColor toggle has an icon to act on.
|
|
76
|
+
@State private var iconLeft: PlaygroundOption? = playgroundIcons.first { $0.key == "basic_home" }
|
|
77
|
+
@State private var full = true
|
|
78
|
+
@State private var loading = false
|
|
79
|
+
@State private var useTintColor = true
|
|
80
|
+
|
|
81
|
+
var body: some View {
|
|
82
|
+
PlaygroundTab(
|
|
83
|
+
component: {
|
|
84
|
+
MoMoUIKits.Button(
|
|
85
|
+
title: title,
|
|
86
|
+
action: {},
|
|
87
|
+
type: (type?.value as? ButtonType) ?? .primary,
|
|
88
|
+
size: (size?.value as? ButtonSize) ?? .large,
|
|
89
|
+
iconLeft: (iconLeft?.value as? String) ?? "",
|
|
90
|
+
iconRight: (iconRight?.value as? String) ?? "",
|
|
91
|
+
isFull: full,
|
|
92
|
+
loading: loading,
|
|
93
|
+
useTintColor: useTintColor
|
|
94
|
+
)
|
|
95
|
+
},
|
|
96
|
+
params: [
|
|
97
|
+
.string("Children", $title),
|
|
98
|
+
.radio("Type", buttonTypeList, $type),
|
|
99
|
+
.radio("Size", buttonSizeList, $size),
|
|
100
|
+
.checkbox("Full", $full),
|
|
101
|
+
.option("IconRight", playgroundIcons, $iconRight),
|
|
102
|
+
.option("IconLeft", playgroundIcons, $iconLeft),
|
|
103
|
+
.checkbox("Loading", $loading),
|
|
104
|
+
.checkbox("UseTintColor", $useTintColor),
|
|
105
|
+
]
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CarouselDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo (DemoScreen pattern).
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
private let slideColors: [Color] = [
|
|
12
|
+
Colors.pink09, Colors.blue08, Colors.green08, Colors.orange08, Colors.mint08,
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
@ViewBuilder
|
|
16
|
+
private func carouselSlide(_ index: Int) -> some View {
|
|
17
|
+
ZStack {
|
|
18
|
+
slideColors[index % slideColors.count]
|
|
19
|
+
Text("Slide \(index + 1)")
|
|
20
|
+
.font(.headline)
|
|
21
|
+
.foregroundColor(Colors.black01)
|
|
22
|
+
}
|
|
23
|
+
.frame(maxWidth: .infinity)
|
|
24
|
+
.frame(height: 160)
|
|
25
|
+
.cornerRadius(Radius.M)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
struct CarouselDemo: View {
|
|
29
|
+
var body: some View {
|
|
30
|
+
if #available(iOS 16.0, *) {
|
|
31
|
+
DemoScreen(preview: { CarouselPreview() }, playground: { CarouselPlayground() })
|
|
32
|
+
} else {
|
|
33
|
+
Text("Requires iOS 16+").padding()
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// MARK: - Preview
|
|
39
|
+
|
|
40
|
+
private struct CarouselPreview: View {
|
|
41
|
+
var body: some View {
|
|
42
|
+
BasicColumnBox("Basic (3 slides)", alignment: .leading) {
|
|
43
|
+
Carousel(itemCount: 3) { carouselSlide($0) }.frame(height: 160)
|
|
44
|
+
}
|
|
45
|
+
BasicColumnBox("Loop enabled", alignment: .leading) {
|
|
46
|
+
Carousel(itemCount: 5, loop: true) { carouselSlide($0) }.frame(height: 160)
|
|
47
|
+
}
|
|
48
|
+
BasicColumnBox("Autoplay (3s)", alignment: .leading) {
|
|
49
|
+
Carousel(itemCount: 5, loop: true, autoplay: true, autoplayInterval: 3.0) { carouselSlide($0) }
|
|
50
|
+
.frame(height: 160)
|
|
51
|
+
}
|
|
52
|
+
BasicColumnBox("Inactive effects", alignment: .leading) {
|
|
53
|
+
Carousel(itemCount: 5, loop: true, inactiveSlideOpacity: 0.5, inactiveSlideScale: 0.9, contentPadding: 32) {
|
|
54
|
+
carouselSlide($0)
|
|
55
|
+
}
|
|
56
|
+
.frame(height: 160)
|
|
57
|
+
}
|
|
58
|
+
BasicColumnBox("Scroll disabled", alignment: .leading) {
|
|
59
|
+
Carousel(itemCount: 3, scrollEnabled: false) { carouselSlide($0) }.frame(height: 160)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// MARK: - Playground
|
|
65
|
+
|
|
66
|
+
@available(iOS 16.0, *)
|
|
67
|
+
private struct CarouselPlayground: View {
|
|
68
|
+
@State private var loop = false
|
|
69
|
+
@State private var autoplay = false
|
|
70
|
+
@State private var scrollEnabled = true
|
|
71
|
+
@State private var inactiveOpacity: Double = 1.0
|
|
72
|
+
@State private var inactiveScale: Double = 1.0
|
|
73
|
+
|
|
74
|
+
var body: some View {
|
|
75
|
+
PlaygroundTab(
|
|
76
|
+
component: {
|
|
77
|
+
Carousel(
|
|
78
|
+
itemCount: 5,
|
|
79
|
+
loop: loop,
|
|
80
|
+
autoplay: autoplay,
|
|
81
|
+
scrollEnabled: scrollEnabled,
|
|
82
|
+
inactiveSlideOpacity: inactiveOpacity,
|
|
83
|
+
inactiveSlideScale: inactiveScale
|
|
84
|
+
) { carouselSlide($0) }
|
|
85
|
+
.frame(height: 160)
|
|
86
|
+
},
|
|
87
|
+
params: [
|
|
88
|
+
.checkbox("Loop", $loop),
|
|
89
|
+
.checkbox("Autoplay", $autoplay),
|
|
90
|
+
.checkbox("ScrollEnabled", $scrollEnabled),
|
|
91
|
+
.slider("InactiveOpacity", $inactiveOpacity, min: 0, max: 1, step: 0.1),
|
|
92
|
+
.slider("InactiveScale", $inactiveScale, min: 0.5, max: 1, step: 0.1),
|
|
93
|
+
]
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CheckboxDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo for Checkbox.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
struct CheckboxDemo: View {
|
|
12
|
+
var body: some View {
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
DemoScreen(preview: { CheckboxPreview() }, playground: { CheckboxPlayground() })
|
|
15
|
+
} else {
|
|
16
|
+
Text("Requires iOS 16+").padding()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// MARK: - Preview
|
|
22
|
+
|
|
23
|
+
private struct CheckboxPreview: View {
|
|
24
|
+
var body: some View {
|
|
25
|
+
BasicColumnBox("States", alignment: .leading) {
|
|
26
|
+
Checkbox(.constant(true), onChange: { _ in }, title: "Checked")
|
|
27
|
+
Checkbox(.constant(false), onChange: { _ in }, title: "Unchecked")
|
|
28
|
+
Checkbox(.constant(true), onChange: { _ in }, indeterminate: true, title: "Indeterminate")
|
|
29
|
+
}
|
|
30
|
+
BasicColumnBox("Disabled", alignment: .leading) {
|
|
31
|
+
Checkbox(.constant(true), disabled: true, onChange: { _ in }, title: "Disabled checked")
|
|
32
|
+
Checkbox(.constant(true), disabled: true, onChange: { _ in }, indeterminate: true, title: "Disabled indeterminate")
|
|
33
|
+
Checkbox(.constant(false), disabled: true, onChange: { _ in }, title: "Disabled unchecked")
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// MARK: - Playground
|
|
39
|
+
|
|
40
|
+
@available(iOS 16.0, *)
|
|
41
|
+
private struct CheckboxPlayground: View {
|
|
42
|
+
@State private var checked = false
|
|
43
|
+
@State private var disabled = false
|
|
44
|
+
@State private var indeterminate = false
|
|
45
|
+
@State private var title = "Check Box"
|
|
46
|
+
|
|
47
|
+
var body: some View {
|
|
48
|
+
PlaygroundTab(
|
|
49
|
+
component: {
|
|
50
|
+
Checkbox($checked, disabled: disabled, indeterminate: indeterminate, title: title)
|
|
51
|
+
},
|
|
52
|
+
params: [
|
|
53
|
+
.checkbox("Checked", $checked),
|
|
54
|
+
.checkbox("Disabled", $disabled),
|
|
55
|
+
.checkbox("Indeterminate", $indeterminate),
|
|
56
|
+
.string("Title", $title),
|
|
57
|
+
]
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ChipDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo for Chip.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
private let chipSizeList: [PlaygroundOption] = [
|
|
12
|
+
.init("large", Chip.ChipSize.large),
|
|
13
|
+
.init("small", Chip.ChipSize.small),
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
struct ChipDemo: View {
|
|
17
|
+
var body: some View {
|
|
18
|
+
if #available(iOS 16.0, *) {
|
|
19
|
+
DemoScreen(preview: { ChipPreview() }, playground: { ChipPlayground() })
|
|
20
|
+
} else {
|
|
21
|
+
Text("Requires iOS 16+").padding()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// MARK: - Preview
|
|
27
|
+
|
|
28
|
+
private struct ChipPreview: View {
|
|
29
|
+
var body: some View {
|
|
30
|
+
BasicColumnBox("Size", alignment: .leading) {
|
|
31
|
+
Chip(label: "Large", size: .large)
|
|
32
|
+
Chip(label: "Small", size: .small)
|
|
33
|
+
}
|
|
34
|
+
BasicColumnBox("Icons", alignment: .leading) {
|
|
35
|
+
Chip(label: "Apple", iconLeft: "basic_home")
|
|
36
|
+
Chip(label: "Banana", iconRight: "basic_home")
|
|
37
|
+
}
|
|
38
|
+
BasicColumnBox("State", alignment: .leading) {
|
|
39
|
+
Chip(label: "Orange", backgroundColor: Colors.black01)
|
|
40
|
+
Chip(label: "Grape", selected: true)
|
|
41
|
+
Chip(label: "Grape", iconRight: "basic_home", selected: true, iconRightTint: Colors.black05)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// MARK: - Playground
|
|
47
|
+
|
|
48
|
+
@available(iOS 16.0, *)
|
|
49
|
+
private struct ChipPlayground: View {
|
|
50
|
+
@State private var label = "Chip"
|
|
51
|
+
@State private var size: PlaygroundOption? = chipSizeList.first { $0.key == "large" }
|
|
52
|
+
@State private var selected = false
|
|
53
|
+
@State private var iconLeft: PlaygroundOption?
|
|
54
|
+
@State private var iconRight: PlaygroundOption?
|
|
55
|
+
|
|
56
|
+
var body: some View {
|
|
57
|
+
PlaygroundTab(
|
|
58
|
+
component: {
|
|
59
|
+
Chip(
|
|
60
|
+
label: label,
|
|
61
|
+
iconLeft: iconLeft?.value as? String,
|
|
62
|
+
iconRight: iconRight?.value as? String,
|
|
63
|
+
selected: selected,
|
|
64
|
+
size: (size?.value as? Chip.ChipSize) ?? .large
|
|
65
|
+
)
|
|
66
|
+
},
|
|
67
|
+
params: [
|
|
68
|
+
.string("Label", $label),
|
|
69
|
+
.radio("Size", chipSizeList, $size),
|
|
70
|
+
.checkbox("Selected", $selected),
|
|
71
|
+
.option("IconLeft", playgroundIcons, $iconLeft),
|
|
72
|
+
.option("IconRight", playgroundIcons, $iconRight),
|
|
73
|
+
]
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CollapseDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo (DemoScreen pattern).
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
private let collapseTitleSizeList: [PlaygroundOption] = [
|
|
12
|
+
.init("small", CollapseTitleSize.small),
|
|
13
|
+
.init("medium", CollapseTitleSize.medium),
|
|
14
|
+
.init("large", CollapseTitleSize.large),
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
struct CollapseDemo: View {
|
|
18
|
+
var body: some View {
|
|
19
|
+
if #available(iOS 16.0, *) {
|
|
20
|
+
DemoScreen(preview: { CollapsePreview() }, playground: { CollapsePlayground() })
|
|
21
|
+
} else {
|
|
22
|
+
Text("Requires iOS 16+").padding()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// MARK: - Preview
|
|
28
|
+
|
|
29
|
+
private struct CollapsePreview: View {
|
|
30
|
+
var body: some View {
|
|
31
|
+
BasicColumnBox("Default", alignment: .leading) {
|
|
32
|
+
Collapse(title: "Default collapse") {
|
|
33
|
+
MomoText("This is the expanded content.", typography: .bodyDefaultRegular).padding(Spacing.M)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
BasicColumnBox("With Border", alignment: .leading) {
|
|
37
|
+
Collapse(title: "With border", showBorder: true) {
|
|
38
|
+
MomoText("Content inside a bordered collapse.", typography: .bodyDefaultRegular).padding(Spacing.M)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
BasicColumnBox("Expanded by Default", alignment: .leading) {
|
|
42
|
+
Collapse(title: "Pre-expanded", expandDefault: true) {
|
|
43
|
+
MomoText("This collapse starts expanded.", typography: .bodyDefaultRegular).padding(Spacing.M)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
BasicColumnBox("With Description", alignment: .leading) {
|
|
47
|
+
Collapse(title: "Collapse with description", description: "A brief description below the title.") {
|
|
48
|
+
MomoText("Detailed content.", typography: .bodyDefaultRegular).padding(Spacing.M)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
BasicColumnBox("Title Sizes", alignment: .leading) {
|
|
52
|
+
Collapse(title: "Small title", titleSize: .small) {
|
|
53
|
+
MomoText("Content", typography: .bodyDefaultRegular).padding(Spacing.M)
|
|
54
|
+
}
|
|
55
|
+
Collapse(title: "Large title", titleSize: .large) {
|
|
56
|
+
MomoText("Content", typography: .bodyDefaultRegular).padding(Spacing.M)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
BasicColumnBox("With Tag", alignment: .leading) {
|
|
60
|
+
Collapse(title: "Collapse with tag", tagLabel: "New", tagColor: .red) {
|
|
61
|
+
MomoText("Content", typography: .bodyDefaultRegular).padding(Spacing.M)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// MARK: - Playground
|
|
68
|
+
|
|
69
|
+
@available(iOS 16.0, *)
|
|
70
|
+
private struct CollapsePlayground: View {
|
|
71
|
+
@State private var title = "Collapse title"
|
|
72
|
+
@State private var description = ""
|
|
73
|
+
@State private var showBorder = false
|
|
74
|
+
@State private var expandDefault = false
|
|
75
|
+
@State private var titleSize: PlaygroundOption? = collapseTitleSizeList.first { $0.key == "medium" }
|
|
76
|
+
@State private var useBackgroundCollapseButton = false
|
|
77
|
+
|
|
78
|
+
var body: some View {
|
|
79
|
+
PlaygroundTab(
|
|
80
|
+
component: {
|
|
81
|
+
Collapse(
|
|
82
|
+
title: title,
|
|
83
|
+
description: description.isEmpty ? nil : description,
|
|
84
|
+
showBorder: showBorder,
|
|
85
|
+
expandDefault: expandDefault,
|
|
86
|
+
titleSize: (titleSize?.value as? CollapseTitleSize) ?? .medium,
|
|
87
|
+
useBackgroundCollapseButton: useBackgroundCollapseButton
|
|
88
|
+
) {
|
|
89
|
+
MomoText("Expanded content.", typography: .bodyDefaultRegular).padding(Spacing.M)
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
params: [
|
|
93
|
+
.string("Title", $title),
|
|
94
|
+
.string("Description", $description),
|
|
95
|
+
.checkbox("ShowBorder", $showBorder),
|
|
96
|
+
.checkbox("ExpandDefault", $expandDefault),
|
|
97
|
+
.radio("TitleSize", collapseTitleSizeList, $titleSize),
|
|
98
|
+
.checkbox("BackgroundCollapseButton", $useBackgroundCollapseButton),
|
|
99
|
+
]
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
}
|