@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
|
+
//
|
|
2
|
+
// InputDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo, mirroring Compose's InputUsage.kt.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
struct InputDemo: View {
|
|
12
|
+
var body: some View {
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
DemoScreen(preview: { InputPreview() }, playground: { InputPlayground() })
|
|
15
|
+
} else {
|
|
16
|
+
Text("Requires iOS 16+").padding()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// MARK: - Preview
|
|
22
|
+
|
|
23
|
+
private struct InputPreview: View {
|
|
24
|
+
@State private var t1 = ""
|
|
25
|
+
@State private var t2 = ""
|
|
26
|
+
@State private var t3 = ""
|
|
27
|
+
@State private var t4 = ""
|
|
28
|
+
@State private var t5 = ""
|
|
29
|
+
@State private var t6 = ""
|
|
30
|
+
@State private var t7 = ""
|
|
31
|
+
|
|
32
|
+
var body: some View {
|
|
33
|
+
BasicColumnBox("Size", alignment: .leading) {
|
|
34
|
+
Input(text: $t1, placeholder: "Small", size: .small)
|
|
35
|
+
Input(text: $t1, placeholder: "Large", size: .large)
|
|
36
|
+
}
|
|
37
|
+
BasicColumnBox("Floating Value", alignment: .leading) {
|
|
38
|
+
Input(text: $t2, placeholder: "Enter here", floatingValue: "Momo", floatingIcon: "01.MoMo")
|
|
39
|
+
}
|
|
40
|
+
BasicColumnBox("Secure Text Entry", alignment: .leading) {
|
|
41
|
+
Input(text: $t3, placeholder: "Enter here", floatingValue: "Momo", secureTextEntry: true)
|
|
42
|
+
}
|
|
43
|
+
BasicColumnBox("Hint", alignment: .leading) {
|
|
44
|
+
Input(text: $t4, placeholder: "Enter here", hintText: "Hint text")
|
|
45
|
+
}
|
|
46
|
+
BasicColumnBox("Error", alignment: .leading) {
|
|
47
|
+
Input(text: $t5, placeholder: "Enter here", error: "Error")
|
|
48
|
+
}
|
|
49
|
+
BasicColumnBox("Disabled", alignment: .leading) {
|
|
50
|
+
Input(text: $t6, placeholder: "Enter here", disabled: true, leadingIcon: "01.MoMo")
|
|
51
|
+
}
|
|
52
|
+
BasicColumnBox("Loading", alignment: .leading) {
|
|
53
|
+
Input(text: $t7, placeholder: "Loading", floatingValue: "Loading", loading: true, required: true)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// MARK: - Playground
|
|
59
|
+
|
|
60
|
+
@available(iOS 16.0, *)
|
|
61
|
+
private struct InputPlayground: View {
|
|
62
|
+
@State private var text = ""
|
|
63
|
+
@State private var placeholder = "Placeholder"
|
|
64
|
+
@State private var floatingValue = ""
|
|
65
|
+
@State private var hintText = ""
|
|
66
|
+
@State private var error = ""
|
|
67
|
+
@State private var size: PlaygroundOption? = inputSizeList.first { $0.key == "small" }
|
|
68
|
+
@State private var fontWeight: PlaygroundOption? = inputFontWeightList.first { $0.key == "regular" }
|
|
69
|
+
@State private var keyboardType: PlaygroundOption? = keyboardTypeList.first { $0.key == "default" }
|
|
70
|
+
@State private var leadingIcon: PlaygroundOption?
|
|
71
|
+
@State private var rightIcon: PlaygroundOption?
|
|
72
|
+
@State private var maxLength = ""
|
|
73
|
+
@State private var disabled = false
|
|
74
|
+
@State private var secure = false
|
|
75
|
+
@State private var loading = false
|
|
76
|
+
@State private var required = false
|
|
77
|
+
|
|
78
|
+
var body: some View {
|
|
79
|
+
PlaygroundTab(
|
|
80
|
+
component: {
|
|
81
|
+
Input(
|
|
82
|
+
text: $text,
|
|
83
|
+
placeholder: placeholder,
|
|
84
|
+
floatingValue: floatingValue,
|
|
85
|
+
size: (size?.value as? InputSize) ?? .small,
|
|
86
|
+
hintText: hintText,
|
|
87
|
+
error: error,
|
|
88
|
+
disabled: disabled,
|
|
89
|
+
secureTextEntry: secure,
|
|
90
|
+
rightIcon: (rightIcon?.value as? String) ?? "",
|
|
91
|
+
leadingIcon: (leadingIcon?.value as? String) ?? "",
|
|
92
|
+
loading: loading,
|
|
93
|
+
required: required,
|
|
94
|
+
maxLength: maxLength.isEmpty ? nil : Int(maxLength),
|
|
95
|
+
fontWeight: (fontWeight?.value as? InputFontWeight) ?? .regular,
|
|
96
|
+
keyboardType: (keyboardType?.value as? UIKeyboardType) ?? .default
|
|
97
|
+
)
|
|
98
|
+
},
|
|
99
|
+
params: [
|
|
100
|
+
.string("Placeholder", $placeholder),
|
|
101
|
+
.string("FloatingValue", $floatingValue),
|
|
102
|
+
.string("HintText", $hintText),
|
|
103
|
+
.string("Error", $error),
|
|
104
|
+
.radio("Size", inputSizeList, $size),
|
|
105
|
+
.radio("FontWeight", inputFontWeightList, $fontWeight),
|
|
106
|
+
.radio("KeyboardType", keyboardTypeList, $keyboardType),
|
|
107
|
+
.option("LeadingIcon", playgroundIcons, $leadingIcon),
|
|
108
|
+
.option("RightIcon", playgroundIcons, $rightIcon),
|
|
109
|
+
.number("MaxLength", $maxLength),
|
|
110
|
+
.checkbox("Disabled", $disabled),
|
|
111
|
+
.checkbox("SecureTextEntry", $secure),
|
|
112
|
+
.checkbox("Loading", $loading),
|
|
113
|
+
.checkbox("Required", $required),
|
|
114
|
+
]
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
//
|
|
2
|
+
// InputDropDownDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo for InputDropDown.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
struct InputDropDownDemo: View {
|
|
12
|
+
var body: some View {
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
DemoScreen(preview: { InputDropDownPreview() }, playground: { InputDropDownPlayground() })
|
|
15
|
+
} else {
|
|
16
|
+
Text("Requires iOS 16+").padding()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// MARK: - Preview
|
|
22
|
+
|
|
23
|
+
private struct InputDropDownPreview: View {
|
|
24
|
+
@State private var empty = ""
|
|
25
|
+
@State private var errorValue = "Error input"
|
|
26
|
+
|
|
27
|
+
var body: some View {
|
|
28
|
+
BasicColumnBox("Size", alignment: .leading) {
|
|
29
|
+
InputDropDown(value: $empty, placeholder: "Input small", size: .small)
|
|
30
|
+
InputDropDown(value: $empty, placeholder: "Input large", size: .large)
|
|
31
|
+
}
|
|
32
|
+
BasicColumnBox("Floating Value", alignment: .leading) {
|
|
33
|
+
InputDropDown(value: $empty, floatingValue: "Title", floatingIcon: "basic_home", placeholder: "Select options")
|
|
34
|
+
}
|
|
35
|
+
BasicColumnBox("Error message", alignment: .leading) {
|
|
36
|
+
InputDropDown(value: $errorValue, placeholder: "Error input", error: "Error message")
|
|
37
|
+
}
|
|
38
|
+
BasicColumnBox("Disabled", alignment: .leading) {
|
|
39
|
+
InputDropDown(value: $empty, floatingValue: "Title", floatingIcon: "basic_home", placeholder: "Disabled input", disabled: true)
|
|
40
|
+
}
|
|
41
|
+
BasicColumnBox("Leading Icon", alignment: .leading) {
|
|
42
|
+
InputDropDown(value: $empty, floatingValue: "Small input", placeholder: "Leading icon", leadingIcon: "basic_home")
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// MARK: - Playground
|
|
48
|
+
|
|
49
|
+
@available(iOS 16.0, *)
|
|
50
|
+
private struct InputDropDownPlayground: View {
|
|
51
|
+
@State private var value = ""
|
|
52
|
+
@State private var placeholder = "Select options"
|
|
53
|
+
@State private var floatingValue = ""
|
|
54
|
+
@State private var hintText = ""
|
|
55
|
+
@State private var error = ""
|
|
56
|
+
@State private var size: PlaygroundOption? = inputSizeList.first { $0.key == "small" }
|
|
57
|
+
@State private var leadingIcon: PlaygroundOption?
|
|
58
|
+
@State private var disabled = false
|
|
59
|
+
@State private var errorSpacing = false
|
|
60
|
+
@State private var loading = false
|
|
61
|
+
@State private var required = false
|
|
62
|
+
|
|
63
|
+
var body: some View {
|
|
64
|
+
PlaygroundTab(
|
|
65
|
+
component: {
|
|
66
|
+
InputDropDown(
|
|
67
|
+
value: $value,
|
|
68
|
+
floatingValue: floatingValue,
|
|
69
|
+
placeholder: placeholder,
|
|
70
|
+
size: (size?.value as? InputSize) ?? .small,
|
|
71
|
+
hintText: hintText,
|
|
72
|
+
error: error,
|
|
73
|
+
errorSpacing: errorSpacing,
|
|
74
|
+
disabled: disabled,
|
|
75
|
+
leadingIcon: (leadingIcon?.value as? String) ?? "",
|
|
76
|
+
loading: loading,
|
|
77
|
+
required: required
|
|
78
|
+
)
|
|
79
|
+
},
|
|
80
|
+
params: [
|
|
81
|
+
.string("Placeholder", $placeholder),
|
|
82
|
+
.string("FloatingValue", $floatingValue),
|
|
83
|
+
.string("HintText", $hintText),
|
|
84
|
+
.string("Error", $error),
|
|
85
|
+
.radio("Size", inputSizeList, $size),
|
|
86
|
+
.option("LeadingIcon", playgroundIcons, $leadingIcon),
|
|
87
|
+
.checkbox("Disabled", $disabled),
|
|
88
|
+
.checkbox("ErrorSpacing", $errorSpacing),
|
|
89
|
+
.checkbox("Loading", $loading),
|
|
90
|
+
.checkbox("Required", $required),
|
|
91
|
+
]
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
//
|
|
2
|
+
// InputMoneyDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo for InputMoney.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
struct InputMoneyDemo: View {
|
|
12
|
+
var body: some View {
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
DemoScreen(preview: { InputMoneyPreview() }, playground: { InputMoneyPlayground() })
|
|
15
|
+
} else {
|
|
16
|
+
Text("Requires iOS 16+").padding()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// MARK: - Preview
|
|
22
|
+
|
|
23
|
+
private struct InputMoneyPreview: View {
|
|
24
|
+
@State private var t1 = ""
|
|
25
|
+
@State private var t2 = ""
|
|
26
|
+
@State private var t3 = ""
|
|
27
|
+
@State private var t4 = ""
|
|
28
|
+
|
|
29
|
+
var body: some View {
|
|
30
|
+
BasicColumnBox("Size", alignment: .leading) {
|
|
31
|
+
InputMoney(text: $t1, placeholder: "Small", size: .small, onChangeText: { t1 = $0 })
|
|
32
|
+
InputMoney(text: $t2, placeholder: "Large", size: .large, onChangeText: { t2 = $0 })
|
|
33
|
+
}
|
|
34
|
+
BasicColumnBox("Floating Value", alignment: .leading) {
|
|
35
|
+
InputMoney(text: $t3, floatingValue: "Amount", floatingIcon: "basic_home", floatingIconColor: Colors.pink03, placeholder: "Enter amount", onChangeText: { t3 = $0 })
|
|
36
|
+
}
|
|
37
|
+
BasicColumnBox("Error", alignment: .leading) {
|
|
38
|
+
InputMoney(text: $t4, placeholder: "Enter amount", error: "Invalid amount", onChangeText: { t4 = $0 })
|
|
39
|
+
}
|
|
40
|
+
BasicColumnBox("Disabled", alignment: .leading) {
|
|
41
|
+
InputMoney(text: .constant(""), placeholder: "Enter amount", disabled: true, icon: "basic_home")
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// MARK: - Playground
|
|
47
|
+
|
|
48
|
+
@available(iOS 16.0, *)
|
|
49
|
+
private struct InputMoneyPlayground: View {
|
|
50
|
+
@State private var text = ""
|
|
51
|
+
@State private var placeholder = "0đ"
|
|
52
|
+
@State private var floatingValue = ""
|
|
53
|
+
@State private var error = ""
|
|
54
|
+
@State private var size: PlaygroundOption? = inputSizeList.first { $0.key == "small" }
|
|
55
|
+
@State private var fontWeight: PlaygroundOption? = inputFontWeightList.first { $0.key == "bold" }
|
|
56
|
+
@State private var icon: PlaygroundOption?
|
|
57
|
+
@State private var disabled = false
|
|
58
|
+
@State private var errorSpacing = false
|
|
59
|
+
@State private var loading = false
|
|
60
|
+
@State private var required = false
|
|
61
|
+
|
|
62
|
+
var body: some View {
|
|
63
|
+
PlaygroundTab(
|
|
64
|
+
component: {
|
|
65
|
+
InputMoney(
|
|
66
|
+
text: $text,
|
|
67
|
+
floatingValue: floatingValue,
|
|
68
|
+
placeholder: placeholder,
|
|
69
|
+
size: (size?.value as? InputSize) ?? .small,
|
|
70
|
+
error: error,
|
|
71
|
+
errorSpacing: errorSpacing,
|
|
72
|
+
disabled: disabled,
|
|
73
|
+
icon: (icon?.value as? String) ?? "",
|
|
74
|
+
loading: loading,
|
|
75
|
+
required: required,
|
|
76
|
+
fontWeight: (fontWeight?.value as? InputFontWeight) ?? .bold,
|
|
77
|
+
onChangeText: { text = $0 }
|
|
78
|
+
)
|
|
79
|
+
},
|
|
80
|
+
params: [
|
|
81
|
+
.string("Placeholder", $placeholder),
|
|
82
|
+
.string("FloatingValue", $floatingValue),
|
|
83
|
+
.string("Error", $error),
|
|
84
|
+
.radio("Size", inputSizeList, $size),
|
|
85
|
+
.radio("FontWeight", inputFontWeightList, $fontWeight),
|
|
86
|
+
.option("Icon", playgroundIcons, $icon),
|
|
87
|
+
.checkbox("Disabled", $disabled),
|
|
88
|
+
.checkbox("ErrorSpacing", $errorSpacing),
|
|
89
|
+
.checkbox("Loading", $loading),
|
|
90
|
+
.checkbox("Required", $required),
|
|
91
|
+
]
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//
|
|
2
|
+
// InputOTPDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo for InputOTP.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
// Component-specific option maps (mirror otpLengthList / otpDataTypeList in DemoScreen.kt).
|
|
12
|
+
private let otpLengthList: [PlaygroundOption] = [
|
|
13
|
+
.init("2", 2), .init("4", 4), .init("6", 6), .init("8", 8), .init("10", 10),
|
|
14
|
+
]
|
|
15
|
+
private let otpDataTypeList: [PlaygroundOption] = [
|
|
16
|
+
.init("number", "number"), .init("string", "string"),
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
struct InputOTPDemo: View {
|
|
20
|
+
var body: some View {
|
|
21
|
+
if #available(iOS 16.0, *) {
|
|
22
|
+
DemoScreen(preview: { InputOTPPreview() }, playground: { InputOTPPlayground() })
|
|
23
|
+
} else {
|
|
24
|
+
Text("Requires iOS 16+").padding()
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// MARK: - Preview
|
|
30
|
+
|
|
31
|
+
private struct InputOTPPreview: View {
|
|
32
|
+
@State private var v1 = ""
|
|
33
|
+
@State private var v2 = ""
|
|
34
|
+
@State private var v3 = ""
|
|
35
|
+
@State private var v4 = ""
|
|
36
|
+
|
|
37
|
+
var body: some View {
|
|
38
|
+
BasicColumnBox("Floating Value", alignment: .leading) {
|
|
39
|
+
InputOTP(value: $v1, floatingValue: "Nhập mã xác thực OTP")
|
|
40
|
+
}
|
|
41
|
+
BasicColumnBox("Placeholder", alignment: .leading) {
|
|
42
|
+
InputOTP(value: $v2, floatingValue: "", placeholder: "Placeholder text")
|
|
43
|
+
}
|
|
44
|
+
BasicColumnBox("Error Message", alignment: .leading) {
|
|
45
|
+
InputOTP(value: $v3, errorMessage: "Error", floatingValue: "")
|
|
46
|
+
}
|
|
47
|
+
BasicColumnBox("Length 6, number", alignment: .leading) {
|
|
48
|
+
InputOTP(value: $v4, length: 6, floatingValue: "", dataType: "number")
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// MARK: - Playground
|
|
54
|
+
|
|
55
|
+
@available(iOS 16.0, *)
|
|
56
|
+
private struct InputOTPPlayground: View {
|
|
57
|
+
@State private var value = ""
|
|
58
|
+
@State private var floatingValue = "Label"
|
|
59
|
+
@State private var placeholder = ""
|
|
60
|
+
@State private var errorMessage = ""
|
|
61
|
+
@State private var length: PlaygroundOption? = otpLengthList.first { $0.key == "6" }
|
|
62
|
+
@State private var dataType: PlaygroundOption? = otpDataTypeList.first { $0.key == "number" }
|
|
63
|
+
@State private var errorSpacing = false
|
|
64
|
+
|
|
65
|
+
var body: some View {
|
|
66
|
+
PlaygroundTab(
|
|
67
|
+
component: {
|
|
68
|
+
InputOTP(
|
|
69
|
+
value: $value,
|
|
70
|
+
length: length?.value as? Int,
|
|
71
|
+
errorMessage: errorMessage,
|
|
72
|
+
errorSpacing: errorSpacing,
|
|
73
|
+
floatingValue: floatingValue,
|
|
74
|
+
placeholder: placeholder,
|
|
75
|
+
dataType: (dataType?.value as? String) ?? "number"
|
|
76
|
+
)
|
|
77
|
+
},
|
|
78
|
+
params: [
|
|
79
|
+
.string("FloatingValue", $floatingValue),
|
|
80
|
+
.string("Placeholder", $placeholder),
|
|
81
|
+
.string("ErrorMessage", $errorMessage),
|
|
82
|
+
.radio("Length", otpLengthList, $length),
|
|
83
|
+
.radio("DataType", otpDataTypeList, $dataType),
|
|
84
|
+
.checkbox("ErrorSpacing", $errorSpacing),
|
|
85
|
+
]
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
//
|
|
2
|
+
// InputPhoneNumberDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo for InputPhoneNumber.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
public struct InputPhoneNumberDemo: View {
|
|
12
|
+
public init() {}
|
|
13
|
+
|
|
14
|
+
public var body: some View {
|
|
15
|
+
if #available(iOS 16.0, *) {
|
|
16
|
+
DemoScreen(preview: { InputPhoneNumberPreview() }, playground: { InputPhoneNumberPlayground() })
|
|
17
|
+
} else {
|
|
18
|
+
Text("Requires iOS 16+").padding()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// MARK: - Preview
|
|
24
|
+
|
|
25
|
+
private struct InputPhoneNumberPreview: View {
|
|
26
|
+
@State private var t1 = ""
|
|
27
|
+
@State private var t2 = ""
|
|
28
|
+
@State private var t3 = ""
|
|
29
|
+
@State private var t4 = ""
|
|
30
|
+
@State private var t5 = ""
|
|
31
|
+
|
|
32
|
+
var body: some View {
|
|
33
|
+
BasicColumnBox("Size", alignment: .leading) {
|
|
34
|
+
InputPhoneNumber(text: $t1, placeholder: "Small", size: .small)
|
|
35
|
+
InputPhoneNumber(text: $t2, placeholder: "Large", size: .large)
|
|
36
|
+
}
|
|
37
|
+
BasicColumnBox("Hint text", alignment: .leading) {
|
|
38
|
+
InputPhoneNumber(text: $t3, placeholder: "Enter here", hintText: "Hint text")
|
|
39
|
+
}
|
|
40
|
+
BasicColumnBox("Error", alignment: .leading) {
|
|
41
|
+
InputPhoneNumber(text: $t4, placeholder: "Enter here", error: "error message")
|
|
42
|
+
}
|
|
43
|
+
BasicColumnBox("Trailing Icon", alignment: .leading) {
|
|
44
|
+
InputPhoneNumber(text: $t5, placeholder: "Phone", rightIcon: "24_ic_public", rightIconColor: Colors.pink03)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// MARK: - Playground
|
|
50
|
+
|
|
51
|
+
@available(iOS 16.0, *)
|
|
52
|
+
private struct InputPhoneNumberPlayground: View {
|
|
53
|
+
@State private var text = ""
|
|
54
|
+
@State private var placeholder = "0123456789"
|
|
55
|
+
@State private var hintText = ""
|
|
56
|
+
@State private var error = ""
|
|
57
|
+
@State private var size: PlaygroundOption? = inputSizeList.first { $0.key == "small" }
|
|
58
|
+
@State private var rightIcon: PlaygroundOption?
|
|
59
|
+
@State private var loading = false
|
|
60
|
+
@State private var required = false
|
|
61
|
+
|
|
62
|
+
var body: some View {
|
|
63
|
+
PlaygroundTab(
|
|
64
|
+
component: {
|
|
65
|
+
InputPhoneNumber(
|
|
66
|
+
text: $text,
|
|
67
|
+
placeholder: placeholder,
|
|
68
|
+
size: (size?.value as? InputSize) ?? .small,
|
|
69
|
+
hintText: hintText,
|
|
70
|
+
error: error,
|
|
71
|
+
loading: loading,
|
|
72
|
+
required: required,
|
|
73
|
+
rightIcon: (rightIcon?.value as? String) ?? ""
|
|
74
|
+
)
|
|
75
|
+
},
|
|
76
|
+
params: [
|
|
77
|
+
.string("Placeholder", $placeholder),
|
|
78
|
+
.string("HintText", $hintText),
|
|
79
|
+
.string("Error", $error),
|
|
80
|
+
.radio("Size", inputSizeList, $size),
|
|
81
|
+
.option("RightIcon", playgroundIcons, $rightIcon),
|
|
82
|
+
.checkbox("Loading", $loading),
|
|
83
|
+
.checkbox("Required", $required),
|
|
84
|
+
]
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public struct PhoneUtil {
|
|
90
|
+
public static func formatPhoneNumber(_ phone: String) -> String {
|
|
91
|
+
phone.filter { $0.isNumber }
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@discardableResult
|
|
95
|
+
public static func checkValidPhoneNumber(_ phone: String) -> (formatted: String, isValid: Bool, message: String) {
|
|
96
|
+
var phoneNumber = phone
|
|
97
|
+
var message = ""
|
|
98
|
+
var isValid = false
|
|
99
|
+
|
|
100
|
+
if !phoneNumber.isEmpty,
|
|
101
|
+
let first = phoneNumber.first,
|
|
102
|
+
first != "0",
|
|
103
|
+
first.isNumber,
|
|
104
|
+
phoneNumber.count == 9 {
|
|
105
|
+
phoneNumber = "0" + phoneNumber
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
let formatted = formatPhoneNumber(phoneNumber)
|
|
109
|
+
|
|
110
|
+
if formatted.isEmpty {
|
|
111
|
+
message = "Vui lòng nhập số điện thoại"
|
|
112
|
+
} else if formatted.count < 9 || formatted.count > 11 {
|
|
113
|
+
message = "Số điện thoại không đúng"
|
|
114
|
+
} else {
|
|
115
|
+
isValid = true
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return (formatted, isValid, message)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
//
|
|
2
|
+
// InputSearchDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo for InputSearch.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
public struct InputSearchDemo: View {
|
|
12
|
+
public init() {}
|
|
13
|
+
|
|
14
|
+
public var body: some View {
|
|
15
|
+
if #available(iOS 16.0, *) {
|
|
16
|
+
DemoScreen(preview: { InputSearchPreview() }, playground: { InputSearchPlayground() })
|
|
17
|
+
} else {
|
|
18
|
+
Text("Requires iOS 16+").padding()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// MARK: - Preview
|
|
24
|
+
|
|
25
|
+
private struct InputSearchPreview: View {
|
|
26
|
+
@State private var t1 = ""
|
|
27
|
+
@State private var t2 = ""
|
|
28
|
+
@State private var t3 = ""
|
|
29
|
+
|
|
30
|
+
var body: some View {
|
|
31
|
+
BasicColumnBox("Default", alignment: .leading) {
|
|
32
|
+
InputSearch(text: $t1, placeholder: "Search")
|
|
33
|
+
.frame(height: 40)
|
|
34
|
+
}
|
|
35
|
+
BasicColumnBox("With cancel button", alignment: .leading) {
|
|
36
|
+
InputSearch(text: $t2, buttonText: "Huỷ", showButtonText: true, placeholder: "Search")
|
|
37
|
+
.frame(height: 40)
|
|
38
|
+
}
|
|
39
|
+
BasicColumnBox("Disabled", alignment: .leading) {
|
|
40
|
+
InputSearch(text: $t3, placeholder: "Search", disabled: true)
|
|
41
|
+
.frame(height: 40)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// MARK: - Playground
|
|
47
|
+
|
|
48
|
+
@available(iOS 16.0, *)
|
|
49
|
+
private struct InputSearchPlayground: View {
|
|
50
|
+
@State private var text = ""
|
|
51
|
+
@State private var placeholder = "Search"
|
|
52
|
+
@State private var buttonText = "Huỷ"
|
|
53
|
+
@State private var error = ""
|
|
54
|
+
@State private var showButtonText = false
|
|
55
|
+
@State private var showBorder = true
|
|
56
|
+
@State private var disabled = false
|
|
57
|
+
@State private var loading = false
|
|
58
|
+
|
|
59
|
+
var body: some View {
|
|
60
|
+
PlaygroundTab(
|
|
61
|
+
component: {
|
|
62
|
+
InputSearch(
|
|
63
|
+
text: $text,
|
|
64
|
+
buttonText: buttonText,
|
|
65
|
+
showButtonText: showButtonText,
|
|
66
|
+
showBorder: showBorder,
|
|
67
|
+
placeholder: placeholder,
|
|
68
|
+
error: error,
|
|
69
|
+
disabled: disabled,
|
|
70
|
+
loading: loading
|
|
71
|
+
)
|
|
72
|
+
.frame(height: 40)
|
|
73
|
+
},
|
|
74
|
+
params: [
|
|
75
|
+
.string("Placeholder", $placeholder),
|
|
76
|
+
.string("ButtonText", $buttonText),
|
|
77
|
+
.string("Error", $error),
|
|
78
|
+
.checkbox("ShowButtonText", $showButtonText),
|
|
79
|
+
.checkbox("ShowBorder", $showBorder),
|
|
80
|
+
.checkbox("Disabled", $disabled),
|
|
81
|
+
.checkbox("Loading", $loading),
|
|
82
|
+
]
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//
|
|
2
|
+
// InputTextAreaDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Preview + Playground demo for InputTextArea.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
struct InputTextAreaDemo: View {
|
|
12
|
+
var body: some View {
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
DemoScreen(preview: { TextAreaPreview() }, playground: { TextAreaPlayground() })
|
|
15
|
+
} else {
|
|
16
|
+
Text("Requires iOS 16+").padding()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// MARK: - Preview
|
|
22
|
+
|
|
23
|
+
private struct TextAreaPreview: View {
|
|
24
|
+
@State private var text = ""
|
|
25
|
+
private let url = "https://img.mservice.io/momo_app_v2/new_version/img/appx_icon/momomain_momo.png"
|
|
26
|
+
|
|
27
|
+
var body: some View {
|
|
28
|
+
BasicColumnBox("Floating Value", alignment: .leading) {
|
|
29
|
+
InputTextArea(text: $text, floatingValue: "Momo", floatingIcon: url, floatingIconColor: Colors.pink03)
|
|
30
|
+
}
|
|
31
|
+
BasicColumnBox("Error", alignment: .leading) {
|
|
32
|
+
InputTextArea(text: .constant("Error"), error: "Error")
|
|
33
|
+
}
|
|
34
|
+
BasicColumnBox("Error Spacing", alignment: .leading) {
|
|
35
|
+
InputTextArea(text: .constant("Error"), errorSpacing: true)
|
|
36
|
+
}
|
|
37
|
+
BasicColumnBox("Disabled", alignment: .leading) {
|
|
38
|
+
InputTextArea(text: .constant("Disabled"), disabled: true)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// MARK: - Playground
|
|
44
|
+
|
|
45
|
+
@available(iOS 16.0, *)
|
|
46
|
+
private struct TextAreaPlayground: View {
|
|
47
|
+
@State private var text = ""
|
|
48
|
+
@State private var placeholder = "Enter text"
|
|
49
|
+
@State private var floatingValue = "Label"
|
|
50
|
+
@State private var error = ""
|
|
51
|
+
@State private var maxLength = "200"
|
|
52
|
+
@State private var height: Double = 120
|
|
53
|
+
@State private var disabled = false
|
|
54
|
+
@State private var errorSpacing = false
|
|
55
|
+
@State private var loading = false
|
|
56
|
+
@State private var required = false
|
|
57
|
+
|
|
58
|
+
var body: some View {
|
|
59
|
+
PlaygroundTab(
|
|
60
|
+
component: {
|
|
61
|
+
InputTextArea(
|
|
62
|
+
text: $text,
|
|
63
|
+
maxLength: Int(maxLength) ?? 200,
|
|
64
|
+
height: CGFloat(height),
|
|
65
|
+
floatingValue: floatingValue,
|
|
66
|
+
placeholder: placeholder,
|
|
67
|
+
error: error,
|
|
68
|
+
errorSpacing: errorSpacing,
|
|
69
|
+
disabled: disabled,
|
|
70
|
+
loading: loading,
|
|
71
|
+
required: required
|
|
72
|
+
)
|
|
73
|
+
},
|
|
74
|
+
params: [
|
|
75
|
+
.string("Placeholder", $placeholder),
|
|
76
|
+
.string("FloatingValue", $floatingValue),
|
|
77
|
+
.string("Error", $error),
|
|
78
|
+
.number("MaxLength", $maxLength),
|
|
79
|
+
.slider("Height", $height, min: 60, max: 240, step: 10),
|
|
80
|
+
.checkbox("Disabled", $disabled),
|
|
81
|
+
.checkbox("ErrorSpacing", $errorSpacing),
|
|
82
|
+
.checkbox("Loading", $loading),
|
|
83
|
+
.checkbox("Required", $required),
|
|
84
|
+
]
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
}
|