@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,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// HeaderUserDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Usage demo for the `HeaderTitle.user` header. Mirrors Compose's
|
|
6
|
+
// `HeaderUserUsage`: the avatar-group user title is supplied via the screen's
|
|
7
|
+
// NavigationOptions (see NavigationDemo's "Header User Title" entry), and this
|
|
8
|
+
// body explains the variations the title supports.
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
import MoMoUIKits
|
|
12
|
+
import SwiftUI
|
|
13
|
+
|
|
14
|
+
@available(iOS 16.0, *)
|
|
15
|
+
struct HeaderUserDemoContent: View {
|
|
16
|
+
var body: some View {
|
|
17
|
+
VStack(alignment: .leading, spacing: 16) {
|
|
18
|
+
MomoText("The header above renders a HeaderTitle.user:", typography: .headerDefaultBold)
|
|
19
|
+
bullet("Avatar group (1–4 avatars, then a “+n” overflow tile)")
|
|
20
|
+
bullet("Initials fallback when no avatar URLs are provided")
|
|
21
|
+
bullet("Title + optional inline verified icons")
|
|
22
|
+
bullet("Optional subtitle and status dot")
|
|
23
|
+
bullet("Skeleton shimmer while isLoading")
|
|
24
|
+
Spacer()
|
|
25
|
+
}
|
|
26
|
+
.frame(maxWidth: .infinity, alignment: .leading)
|
|
27
|
+
.padding(16)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@ViewBuilder
|
|
31
|
+
private func bullet(_ text: String) -> some View {
|
|
32
|
+
HStack(alignment: .top, spacing: 8) {
|
|
33
|
+
MomoText("•")
|
|
34
|
+
MomoText(text)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// MARK: - Standalone wrapper (header title is only visible when pushed via NavigationDemo)
|
|
40
|
+
|
|
41
|
+
struct HeaderUserDemo: View {
|
|
42
|
+
var body: some View {
|
|
43
|
+
if #available(iOS 16.0, *) {
|
|
44
|
+
HeaderUserDemoContent()
|
|
45
|
+
} else {
|
|
46
|
+
Text("Header user demo requires iOS 16+").padding()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Home.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Created by sophia on 7/2/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import SwiftUI
|
|
9
|
+
import MoMoUIKits
|
|
10
|
+
|
|
11
|
+
public struct ScreenUsage: Hashable, Identifiable {
|
|
12
|
+
public let id = UUID()
|
|
13
|
+
public let title: String
|
|
14
|
+
public let destination: AnyView
|
|
15
|
+
public let icon: String
|
|
16
|
+
/// True when the destination hosts its own chrome (e.g. a `BottomTab` — the
|
|
17
|
+
/// Preview/Playground `DemoScreen` or `BottomTabDemo`); such screens are pushed
|
|
18
|
+
/// with `headerType: .none, scrollable: false`.
|
|
19
|
+
public let hostsOwnChrome: Bool
|
|
20
|
+
|
|
21
|
+
public init(title: String, destination: AnyView, icon: String, hostsOwnChrome: Bool = false) {
|
|
22
|
+
self.title = title
|
|
23
|
+
self.destination = destination
|
|
24
|
+
self.icon = icon
|
|
25
|
+
self.hostsOwnChrome = hostsOwnChrome
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public static func == (lhs: ScreenUsage, rhs: ScreenUsage) -> Bool {
|
|
29
|
+
lhs.id == rhs.id
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public func hash(into hasher: inout Hasher) {
|
|
33
|
+
hasher.combine(id)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public func getIcon(icon: String) -> String {
|
|
38
|
+
return "https://static.momocdn.net/app/img/kits/UIKIT/\(icon).png"
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public let ScreenUsages: [ScreenUsage] = [
|
|
42
|
+
ScreenUsage(title: "Badge", destination: AnyView(BadgeDemo()), icon: getIcon(icon: "Badge"), hostsOwnChrome: true),
|
|
43
|
+
ScreenUsage(title: "Button", destination: AnyView(ButtonDemo()), icon: getIcon(icon: "Button"), hostsOwnChrome: true),
|
|
44
|
+
ScreenUsage(title: "CheckBox", destination: AnyView(CheckboxDemo()), icon: getIcon(icon: "Checkbox"), hostsOwnChrome: true),
|
|
45
|
+
ScreenUsage(title: "Chip", destination: AnyView(ChipDemo()), icon: getIcon(icon: "Chip"), hostsOwnChrome: true),
|
|
46
|
+
ScreenUsage(title: "Icon", destination: AnyView(IconDemo()), icon: getIcon(icon: "Icon"), hostsOwnChrome: true),
|
|
47
|
+
ScreenUsage(title: "Image", destination: AnyView(ImageDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
48
|
+
ScreenUsage(title: "Section", destination: AnyView(SectionDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
49
|
+
ScreenUsage(title: "Input", destination: AnyView(InputDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
|
|
50
|
+
ScreenUsage(title: "Input Phone Number", destination: AnyView(InputPhoneNumberDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
|
|
51
|
+
ScreenUsage(title: "InputTextArea", destination: AnyView(InputTextAreaDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
|
|
52
|
+
ScreenUsage(title: "InputSearch", destination: AnyView(InputSearchDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
|
|
53
|
+
ScreenUsage(title: "PopupNotify", destination: AnyView(PopupNotifyDemo()), icon: getIcon(icon: "Popup"), hostsOwnChrome: true),
|
|
54
|
+
ScreenUsage(title: "PopupPromotion", destination: AnyView(PopupPromotionDemo()), icon: getIcon(icon: "Popup"), hostsOwnChrome: true),
|
|
55
|
+
ScreenUsage(title: "SnackBar", destination: AnyView(SnackBarDemo()), icon: getIcon(icon: "Popup"), hostsOwnChrome: true),
|
|
56
|
+
ScreenUsage(title: "Switch", destination: AnyView(SwitchDemo()), icon: getIcon(icon: "Toggle"), hostsOwnChrome: true),
|
|
57
|
+
ScreenUsage(title: "Text", destination: AnyView(TypographyDemo()), icon: getIcon(icon: "Typography"), hostsOwnChrome: true),
|
|
58
|
+
// ScreenUsage(title: "TrustBanner", destination: AnyView(TrustBanner(onPress: {_ in })), icon: getIcon(icon: "Typography")),
|
|
59
|
+
ScreenUsage(title: "Information", destination: AnyView(InformationDemo()), icon: getIcon(icon: "Typography"), hostsOwnChrome: true),
|
|
60
|
+
ScreenUsage(title: "Avatar", destination: AnyView(AvatarDemo()), icon: getIcon(icon: "Avatar"), hostsOwnChrome: true),
|
|
61
|
+
ScreenUsage(title: "Carousel", destination: AnyView(CarouselDemo()), icon: getIcon(icon: "Carousel"), hostsOwnChrome: true),
|
|
62
|
+
ScreenUsage(title: "Divider", destination: AnyView(DividerDemo()), icon: getIcon(icon: "Divider"), hostsOwnChrome: true),
|
|
63
|
+
ScreenUsage(title: "IconButton", destination: AnyView(IconButtonDemo()), icon: getIcon(icon: "Button"), hostsOwnChrome: true),
|
|
64
|
+
ScreenUsage(title: "Loader", destination: AnyView(LoaderDemo()), icon: getIcon(icon: "Loader"), hostsOwnChrome: true),
|
|
65
|
+
ScreenUsage(title: "Pagination", destination: AnyView(PaginationDemo()), icon: getIcon(icon: "Badge"), hostsOwnChrome: true),
|
|
66
|
+
ScreenUsage(title: "Radio", destination: AnyView(RadioDemo()), icon: getIcon(icon: "Radio"), hostsOwnChrome: true),
|
|
67
|
+
ScreenUsage(title: "Rating", destination: AnyView(RatingDemo()), icon: getIcon(icon: "Rating"), hostsOwnChrome: true),
|
|
68
|
+
ScreenUsage(title: "Skeleton", destination: AnyView(SkeletonDemo()), icon: getIcon(icon: "Skeleton"), hostsOwnChrome: true),
|
|
69
|
+
ScreenUsage(title: "SuggestAction", destination: AnyView(SuggestActionDemo()), icon: getIcon(icon: "Information"), hostsOwnChrome: true),
|
|
70
|
+
ScreenUsage(title: "Tag", destination: AnyView(TagDemo()), icon: getIcon(icon: "Tag"), hostsOwnChrome: true),
|
|
71
|
+
ScreenUsage(title: "Title", destination: AnyView(TitleDemo()), icon: getIcon(icon: "Typography"), hostsOwnChrome: true),
|
|
72
|
+
ScreenUsage(title: "Collapse", destination: AnyView(CollapseDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
73
|
+
ScreenUsage(title: "Stepper", destination: AnyView(StepperDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
74
|
+
ScreenUsage(title: "Uploader", destination: AnyView(UploaderDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
|
|
75
|
+
ScreenUsage(title: "Swipe", destination: AnyView(SwipeDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
76
|
+
ScreenUsage(title: "InputDropDown", destination: AnyView(InputDropDownDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
|
|
77
|
+
ScreenUsage(title: "InputMoney", destination: AnyView(InputMoneyDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
|
|
78
|
+
ScreenUsage(title: "InputOTP", destination: AnyView(InputOTPDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
|
|
79
|
+
ScreenUsage(title: "ProgressInfo", destination: AnyView(ProgressInfoDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
80
|
+
ScreenUsage(title: "Steps", destination: AnyView(StepsDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
81
|
+
ScreenUsage(title: "Slider", destination: AnyView(SliderDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
82
|
+
ScreenUsage(title: "TabView", destination: AnyView(TabViewDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
83
|
+
ScreenUsage(title: "Tooltip", destination: AnyView(TooltipDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
84
|
+
ScreenUsage(title: "DateTimePicker", destination: AnyView(DateTimePickerDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
85
|
+
ScreenUsage(title: "Navigation", destination: AnyView(NavigationDemo()), icon: getIcon(icon: "Layout")),
|
|
86
|
+
ScreenUsage(title: "Bottom Tab", destination: AnyView(BottomTabDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
87
|
+
ScreenUsage(title: "Animated Header", destination: AnyView(AnimatedHeaderDemo()), icon: getIcon(icon: "Layout")),
|
|
88
|
+
ScreenUsage(title: "Theme", destination: AnyView(ThemeDemo()), icon: getIcon(icon: "Typography")),
|
|
89
|
+
ScreenUsage(title: "Localize", destination: AnyView(LocalizeDemo()), icon: getIcon(icon: "Typography")),
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
@available(iOS 16.0, *)
|
|
93
|
+
public struct HomeView: View {
|
|
94
|
+
// Mirrors Compose's `inputSearch` state: bound into the header search and
|
|
95
|
+
// forwarded into the content for filtering.
|
|
96
|
+
@State private var searchText = ""
|
|
97
|
+
private let onOpenCompose: () -> Void
|
|
98
|
+
private let applicationContext: MiniAppContext?
|
|
99
|
+
private let composeApi: KitComposeApi?
|
|
100
|
+
private let config: KitConfig?
|
|
101
|
+
|
|
102
|
+
public init(
|
|
103
|
+
onOpenCompose: @escaping () -> Void = {},
|
|
104
|
+
applicationContext: MiniAppContext? = nil,
|
|
105
|
+
composeApi: KitComposeApi? = nil,
|
|
106
|
+
config: KitConfig? = nil
|
|
107
|
+
) {
|
|
108
|
+
self.onOpenCompose = onOpenCompose
|
|
109
|
+
self.applicationContext = applicationContext
|
|
110
|
+
self.composeApi = composeApi
|
|
111
|
+
self.config = config
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public var body: some View {
|
|
115
|
+
NavigationContainer(
|
|
116
|
+
initialScreen: { HomeContentView(searchText: $searchText) },
|
|
117
|
+
options: NavigationOptions(
|
|
118
|
+
// headerTitle = HeaderTitle.Default("Design System")
|
|
119
|
+
title: "Design System",
|
|
120
|
+
titlePosition: .left,
|
|
121
|
+
// headerType = HeaderType.Extended(useAnimated = true, ...)
|
|
122
|
+
headerType: .extended,
|
|
123
|
+
useAnimated: true,
|
|
124
|
+
// hiddenBack = false
|
|
125
|
+
hiddenBack: false,
|
|
126
|
+
scrollable: true,
|
|
127
|
+
useAvoidKeyboard: true,
|
|
128
|
+
// keyboardOptions = KeyboardOptions(keyboardShouldPersistTaps = true)
|
|
129
|
+
keyboardShouldPersistTaps: true,
|
|
130
|
+
// headerRight = HeaderRight.Toolkit(useShortcut = true)
|
|
131
|
+
headerRight: {
|
|
132
|
+
HeaderRight(headerRight: HeaderRightData(useShortcut: true))
|
|
133
|
+
},
|
|
134
|
+
// footerComponent = { Button("Open SwiftUI (iOS only)") }
|
|
135
|
+
footer: {
|
|
136
|
+
AnyView(
|
|
137
|
+
MoMoUIKits.Button(
|
|
138
|
+
title: "Open Compose",
|
|
139
|
+
action: onOpenCompose,
|
|
140
|
+
type: .primary,
|
|
141
|
+
size: .large
|
|
142
|
+
)
|
|
143
|
+
)
|
|
144
|
+
},
|
|
145
|
+
// inputSearchProps = InputSearchProps(text = inputSearch, placeholder = "Search input",
|
|
146
|
+
// searchIcon = { Image("...search_ai.png") }, placeholderCustomRender = { gradient Text }, ...)
|
|
147
|
+
inputSearchProps: InputSearchProps(
|
|
148
|
+
text: $searchText,
|
|
149
|
+
placeholder: "Search input",
|
|
150
|
+
onChangeText: { newText in
|
|
151
|
+
searchText = newText.replacingOccurrences(of: "\n", with: " ")
|
|
152
|
+
},
|
|
153
|
+
searchIcon: {
|
|
154
|
+
AnyView(
|
|
155
|
+
ImageView("https://static.momocdn.net/app/app/appx/search_ai.png")
|
|
156
|
+
.frame(width: 24, height: 24)
|
|
157
|
+
.padding(.trailing, Spacing.S)
|
|
158
|
+
)
|
|
159
|
+
},
|
|
160
|
+
placeholderCustomRender: {
|
|
161
|
+
AnyView(
|
|
162
|
+
Text("Search input")
|
|
163
|
+
.font(.header_xs_semibold)
|
|
164
|
+
.lineLimit(1)
|
|
165
|
+
.foregroundStyle(
|
|
166
|
+
LinearGradient(
|
|
167
|
+
colors: [
|
|
168
|
+
Color(hex: 0x18A0FB),
|
|
169
|
+
Color(hex: 0xA851FF),
|
|
170
|
+
Color(hex: 0xFD5FA9),
|
|
171
|
+
Color(hex: 0xFF9040)
|
|
172
|
+
],
|
|
173
|
+
startPoint: .topLeading,
|
|
174
|
+
endPoint: .bottomTrailing
|
|
175
|
+
)
|
|
176
|
+
)
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
// floatingButtonProps = FloatingButtonProps(icon = "ic_warning", iconColor = White,
|
|
181
|
+
// label = "Warning", size = DEFAULT, position = END)
|
|
182
|
+
// Note: "ic_warning" is an Android asset key; the closest rendering iOS icon URL is used here.
|
|
183
|
+
fabProps: FabProps(
|
|
184
|
+
icon: "https://static.momocdn.net/app/img/authentication/floating_helper.png",
|
|
185
|
+
iconColor: .white,
|
|
186
|
+
label: "Warning",
|
|
187
|
+
onClick: { print("Warning") },
|
|
188
|
+
containerColor: Colors.primary,
|
|
189
|
+
size: .large,
|
|
190
|
+
scrollOffset: nil,
|
|
191
|
+
position: .right,
|
|
192
|
+
bottomPadding: nil
|
|
193
|
+
)
|
|
194
|
+
),
|
|
195
|
+
applicationContext: applicationContext,
|
|
196
|
+
composeApi: composeApi,
|
|
197
|
+
config: config
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@available(iOS 16.0, *)
|
|
203
|
+
public struct HomeContentView: View {
|
|
204
|
+
// Search lives in the header (inputSearchProps); the bound value flows here
|
|
205
|
+
// for filtering, mirroring Compose's `UIKitHome(searchQuery = inputSearch.value)`.
|
|
206
|
+
@Binding var searchText: String
|
|
207
|
+
|
|
208
|
+
public init(searchText: Binding<String>) {
|
|
209
|
+
self._searchText = searchText
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
private var filteredScreenUsages: [ScreenUsage] {
|
|
213
|
+
if searchText.isEmpty {
|
|
214
|
+
return ScreenUsages
|
|
215
|
+
}
|
|
216
|
+
return ScreenUsages.filter { $0.title.localizedCaseInsensitiveContains(searchText) }
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
public var body: some View {
|
|
220
|
+
ScrollView {
|
|
221
|
+
VStack(alignment: .leading, spacing: 16) {
|
|
222
|
+
HomeItemView(screenUsages: filteredScreenUsages)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@available(iOS 16.0, *)
|
|
229
|
+
public struct HomeItemView: View {
|
|
230
|
+
@EnvironmentObject var navigator: Navigator
|
|
231
|
+
let screenUsages: [ScreenUsage]
|
|
232
|
+
|
|
233
|
+
public init(screenUsages: [ScreenUsage]) {
|
|
234
|
+
self.screenUsages = screenUsages
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
public var body: some View {
|
|
238
|
+
ForEach(screenUsages) { screenUsage in
|
|
239
|
+
SwiftUI.Button {
|
|
240
|
+
let options = screenUsage.hostsOwnChrome
|
|
241
|
+
? NavigationOptions(
|
|
242
|
+
title: screenUsage.title,
|
|
243
|
+
headerType: .none,
|
|
244
|
+
scrollable: false
|
|
245
|
+
)
|
|
246
|
+
: NavigationOptions(title: screenUsage.title)
|
|
247
|
+
navigator.push(
|
|
248
|
+
{ screenUsage.destination },
|
|
249
|
+
options: options
|
|
250
|
+
)
|
|
251
|
+
} label: {
|
|
252
|
+
itemRow(screenUsage)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
@ViewBuilder
|
|
258
|
+
private func itemRow(_ screenUsage: ScreenUsage) -> some View {
|
|
259
|
+
VStack(alignment: .leading) {
|
|
260
|
+
HStack {
|
|
261
|
+
ImageView(screenUsage.icon).frame(width: 26, height: 26)
|
|
262
|
+
MomoText(screenUsage.title)
|
|
263
|
+
}
|
|
264
|
+
Divider()
|
|
265
|
+
}
|
|
266
|
+
.padding(.horizontal, 16)
|
|
267
|
+
.padding(.vertical, 16)
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
@available(iOS 16.0, *)
|
|
272
|
+
public struct HomeView_Previews: PreviewProvider {
|
|
273
|
+
public static var previews: some View {
|
|
274
|
+
HomeView()
|
|
275
|
+
}
|
|
276
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//
|
|
2
|
+
// IconButtonDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo (DemoScreen pattern).
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
private let iconButtonSizeList: [PlaygroundOption] = [
|
|
12
|
+
.init("large", IconSize.large),
|
|
13
|
+
.init("medium", IconSize.medium),
|
|
14
|
+
.init("small", IconSize.small),
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
private let iconShapeList: [PlaygroundOption] = [
|
|
18
|
+
.init("circle", IconShape.circle),
|
|
19
|
+
.init("square", IconShape.square),
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
struct IconButtonDemo: View {
|
|
23
|
+
var body: some View {
|
|
24
|
+
if #available(iOS 16.0, *) {
|
|
25
|
+
DemoScreen(preview: { IconButtonPreview() }, playground: { IconButtonPlayground() })
|
|
26
|
+
} else {
|
|
27
|
+
Text("Requires iOS 16+").padding()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// MARK: - Preview
|
|
33
|
+
|
|
34
|
+
private struct IconButtonPreview: View {
|
|
35
|
+
private let icon = "travel_plane"
|
|
36
|
+
|
|
37
|
+
var body: some View {
|
|
38
|
+
BasicColumnBox("Source", alignment: .leading) {
|
|
39
|
+
HStack(spacing: Spacing.M) {
|
|
40
|
+
IconButton(icon: "travel_plane", onClick: {})
|
|
41
|
+
IconButton(icon: "shopping_coupon", onClick: {})
|
|
42
|
+
IconButton(icon: "shopping_store", onClick: {})
|
|
43
|
+
IconButton(icon: "time_alarm_check", onClick: {})
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
BasicColumnBox("Type", alignment: .leading) {
|
|
47
|
+
HStack(spacing: Spacing.M) {
|
|
48
|
+
IconButton(icon: icon, onClick: {}, type: .primary)
|
|
49
|
+
IconButton(icon: icon, onClick: {}, type: .secondary)
|
|
50
|
+
IconButton(icon: icon, onClick: {}, type: .tonal)
|
|
51
|
+
IconButton(icon: icon, onClick: {}, type: .outline)
|
|
52
|
+
IconButton(icon: icon, onClick: {}, type: .disabled)
|
|
53
|
+
IconButton(icon: icon, onClick: {}, type: .danger)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
BasicColumnBox("Size", alignment: .leading) {
|
|
57
|
+
HStack(spacing: Spacing.M) {
|
|
58
|
+
IconButton(icon: icon, onClick: {}, type: .primary, size: .large)
|
|
59
|
+
IconButton(icon: icon, onClick: {}, type: .primary, size: .small)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// MARK: - Playground
|
|
66
|
+
|
|
67
|
+
@available(iOS 16.0, *)
|
|
68
|
+
private struct IconButtonPlayground: View {
|
|
69
|
+
@State private var icon: PlaygroundOption? = playgroundIcons.first { $0.key == "basic_home" }
|
|
70
|
+
@State private var type: PlaygroundOption? = buttonTypeList.first { $0.key == "primary" }
|
|
71
|
+
@State private var size: PlaygroundOption? = iconButtonSizeList.first { $0.key == "small" }
|
|
72
|
+
@State private var shape: PlaygroundOption? = iconShapeList.first { $0.key == "circle" }
|
|
73
|
+
|
|
74
|
+
var body: some View {
|
|
75
|
+
PlaygroundTab(
|
|
76
|
+
component: {
|
|
77
|
+
IconButton(
|
|
78
|
+
icon: (icon?.value as? String) ?? "basic_home",
|
|
79
|
+
onClick: {},
|
|
80
|
+
type: (type?.value as? ButtonType) ?? .primary,
|
|
81
|
+
size: (size?.value as? IconSize) ?? .small,
|
|
82
|
+
shape: (shape?.value as? IconShape) ?? .circle
|
|
83
|
+
)
|
|
84
|
+
},
|
|
85
|
+
params: [
|
|
86
|
+
.option("Icon", playgroundIcons, $icon),
|
|
87
|
+
.radio("Type", buttonTypeList, $type),
|
|
88
|
+
.radio("Size", iconButtonSizeList, $size),
|
|
89
|
+
.radio("Shape", iconShapeList, $shape),
|
|
90
|
+
]
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
//
|
|
2
|
+
// IconDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo, mirroring Compose's IconUsage.kt.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
struct IconDemo: View {
|
|
12
|
+
var body: some View {
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
DemoScreen(preview: { IconPreview() }, playground: { IconPlayground() })
|
|
15
|
+
} else {
|
|
16
|
+
Text("Requires iOS 16+").padding()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// MARK: - Preview
|
|
22
|
+
|
|
23
|
+
private struct IconPreview: View {
|
|
24
|
+
var body: some View {
|
|
25
|
+
BasicColumnBox("Source", alignment: .leading) {
|
|
26
|
+
HStack(spacing: Spacing.M) {
|
|
27
|
+
Icon(source: "basic_home", size: 24)
|
|
28
|
+
Icon(source: "basic_flag", size: 24)
|
|
29
|
+
Icon(source: "basic_filter", size: 24)
|
|
30
|
+
Icon(source: "basic_delete", size: 24)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
BasicColumnBox("Size", alignment: .leading) {
|
|
34
|
+
HStack(alignment: .center, spacing: Spacing.M) {
|
|
35
|
+
Icon(source: "basic_home", size: 16)
|
|
36
|
+
Icon(source: "basic_flag", size: 20)
|
|
37
|
+
Icon(source: "basic_filter", size: 24)
|
|
38
|
+
Icon(source: "basic_delete", size: 28)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
BasicColumnBox("Color", alignment: .leading) {
|
|
42
|
+
HStack(spacing: Spacing.M) {
|
|
43
|
+
Icon(source: "basic_home", size: 24, color: Colors.red03)
|
|
44
|
+
Icon(source: "basic_flag", size: 24, color: Colors.green04)
|
|
45
|
+
Icon(source: "basic_filter", size: 24, color: Colors.pink06)
|
|
46
|
+
Icon(source: "basic_delete", size: 24, color: Colors.yellow02)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
BasicColumnBox("No theme icon", alignment: .leading) {
|
|
50
|
+
HStack(spacing: Spacing.M) {
|
|
51
|
+
Icon(source: "ic_round_momo_tiny", size: 24)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// MARK: - Playground
|
|
58
|
+
|
|
59
|
+
@available(iOS 16.0, *)
|
|
60
|
+
private struct IconPlayground: View {
|
|
61
|
+
@State private var source: PlaygroundOption? = playgroundIcons.first { $0.key == "basic_home" }
|
|
62
|
+
@State private var color: PlaygroundOption? = playgroundColors.first { $0.key == "black17" }
|
|
63
|
+
@State private var size = "24"
|
|
64
|
+
|
|
65
|
+
var body: some View {
|
|
66
|
+
PlaygroundTab(
|
|
67
|
+
component: {
|
|
68
|
+
Icon(
|
|
69
|
+
source: (source?.value as? String) ?? "basic_home",
|
|
70
|
+
size: CGFloat(Int(size) ?? 24),
|
|
71
|
+
color: color?.value as? Color
|
|
72
|
+
)
|
|
73
|
+
},
|
|
74
|
+
params: [
|
|
75
|
+
.option("Source", playgroundIcons, $source),
|
|
76
|
+
.color("Color", playgroundColors, $color),
|
|
77
|
+
.number("Size (dp)", $size),
|
|
78
|
+
]
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ImageDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo for ImageView.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
struct ImageDemo: View {
|
|
12
|
+
var body: some View {
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
DemoScreen(preview: { ImagePreview() }, playground: { ImagePlayground() })
|
|
15
|
+
} else {
|
|
16
|
+
Text("Requires iOS 16+").padding()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// MARK: - Preview
|
|
22
|
+
|
|
23
|
+
private struct ImagePreview: View {
|
|
24
|
+
private let sample = "https://images.unsplash.com/photo-1509395062183-67c5ad6faff9"
|
|
25
|
+
|
|
26
|
+
var body: some View {
|
|
27
|
+
BasicColumnBox("Fixed size", alignment: .leading) {
|
|
28
|
+
ImageView(sample).frame(width: 100, height: 100)
|
|
29
|
+
}
|
|
30
|
+
BasicColumnBox("Fill width", alignment: .leading) {
|
|
31
|
+
ImageView(sample)
|
|
32
|
+
.frame(maxWidth: .infinity)
|
|
33
|
+
.frame(height: 120)
|
|
34
|
+
.aspectRatio(contentMode: .fill)
|
|
35
|
+
.clipped()
|
|
36
|
+
}
|
|
37
|
+
BasicColumnBox("Invalid URL (fallback)", alignment: .leading) {
|
|
38
|
+
ImageView("https://abc.com").frame(width: 100, height: 100)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// MARK: - Playground
|
|
44
|
+
|
|
45
|
+
@available(iOS 16.0, *)
|
|
46
|
+
private struct ImagePlayground: View {
|
|
47
|
+
@State private var url = "https://images.unsplash.com/photo-1509395062183-67c5ad6faff9"
|
|
48
|
+
@State private var height: Double = 120
|
|
49
|
+
|
|
50
|
+
var body: some View {
|
|
51
|
+
PlaygroundTab(
|
|
52
|
+
component: {
|
|
53
|
+
ImageView(url)
|
|
54
|
+
.frame(maxWidth: .infinity)
|
|
55
|
+
.frame(height: CGFloat(height))
|
|
56
|
+
.aspectRatio(contentMode: .fill)
|
|
57
|
+
.clipped()
|
|
58
|
+
},
|
|
59
|
+
params: [
|
|
60
|
+
.string("URL", $url),
|
|
61
|
+
.slider("Height", $height, min: 60, max: 240, step: 10),
|
|
62
|
+
]
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//
|
|
2
|
+
// InformationDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo (DemoScreen pattern).
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
private let informationStateList: [PlaygroundOption] = [
|
|
12
|
+
.init("default", InformationState.default),
|
|
13
|
+
.init("warning", InformationState.warning),
|
|
14
|
+
.init("error", InformationState.error),
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
struct InformationDemo: View {
|
|
18
|
+
var body: some View {
|
|
19
|
+
if #available(iOS 16.0, *) {
|
|
20
|
+
DemoScreen(preview: { InformationPreview() }, playground: { InformationPlayground() })
|
|
21
|
+
} else {
|
|
22
|
+
Text("Requires iOS 16+").padding()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// MARK: - Preview
|
|
28
|
+
|
|
29
|
+
private struct InformationPreview: View {
|
|
30
|
+
var body: some View {
|
|
31
|
+
BasicColumnBox("States", alignment: .leading) {
|
|
32
|
+
Information(title: "Default", description: "This is a default information message.",
|
|
33
|
+
showIconClose: true, onPressClose: {})
|
|
34
|
+
Information(title: "Warning", description: "This is a warning information message.", state: .warning)
|
|
35
|
+
Information(title: "Error", description: "This is an error information message.", state: .error)
|
|
36
|
+
}
|
|
37
|
+
BasicColumnBox("Description only", alignment: .leading) {
|
|
38
|
+
Information(description: "Information without a title, only a description.")
|
|
39
|
+
Information(description: "Warning without a title.", state: .warning)
|
|
40
|
+
}
|
|
41
|
+
BasicColumnBox("With action", alignment: .leading) {
|
|
42
|
+
Information(title: "Update available", description: "A new version is ready to install.",
|
|
43
|
+
onPressAction: {}, action: "Update now")
|
|
44
|
+
Information(title: "Payment failed", description: "We couldn't process your payment.",
|
|
45
|
+
state: .error, onPressAction: {}, action: "Retry")
|
|
46
|
+
}
|
|
47
|
+
BasicColumnBox("Highlight text", alignment: .leading) {
|
|
48
|
+
Information(description: "Bạn được hoàn 50.000đ, áp dụng đến hết 31/12/2026",
|
|
49
|
+
highlightText: ["50.000đ", "31/12/2026"])
|
|
50
|
+
}
|
|
51
|
+
BasicColumnBox("Without icon", alignment: .leading) {
|
|
52
|
+
Information(title: "No icon", description: "showIcon is set to false.", showIcon: false)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// MARK: - Playground
|
|
58
|
+
|
|
59
|
+
@available(iOS 16.0, *)
|
|
60
|
+
private struct InformationPlayground: View {
|
|
61
|
+
@State private var title = "Title"
|
|
62
|
+
@State private var description = "Information description."
|
|
63
|
+
@State private var state: PlaygroundOption? = informationStateList.first { $0.key == "default" }
|
|
64
|
+
@State private var showIcon = true
|
|
65
|
+
@State private var showIconClose = false
|
|
66
|
+
@State private var action = ""
|
|
67
|
+
@State private var highlightText = "description"
|
|
68
|
+
|
|
69
|
+
var body: some View {
|
|
70
|
+
PlaygroundTab(
|
|
71
|
+
component: {
|
|
72
|
+
Information(
|
|
73
|
+
title: title.isEmpty ? nil : title,
|
|
74
|
+
description: description,
|
|
75
|
+
state: (state?.value as? InformationState) ?? .default,
|
|
76
|
+
onPressAction: {},
|
|
77
|
+
showIcon: showIcon,
|
|
78
|
+
action: action.isEmpty ? nil : action,
|
|
79
|
+
showIconClose: showIconClose,
|
|
80
|
+
onPressClose: {},
|
|
81
|
+
highlightText: highlightText.components(separatedBy: ",")
|
|
82
|
+
.map { $0.trimmingCharacters(in: .whitespaces) }
|
|
83
|
+
)
|
|
84
|
+
},
|
|
85
|
+
params: [
|
|
86
|
+
.string("Title", $title),
|
|
87
|
+
.string("Description", $description),
|
|
88
|
+
.string("HighlightText: [String] (comma-separated)", $highlightText),
|
|
89
|
+
.radio("State", informationStateList, $state),
|
|
90
|
+
.checkbox("ShowIcon", $showIcon),
|
|
91
|
+
.checkbox("ShowIconClose", $showIconClose),
|
|
92
|
+
.string("Action", $action),
|
|
93
|
+
]
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
}
|