@momo-kits/native-kits 0.163.1-beta.2 → 0.163.1-beta.20-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +112 -0
- package/CLAUDE.md +1 -1
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +190 -0
- package/compose/build.gradle.kts.backup +190 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +150 -0
- package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
- package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +106 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +183 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +293 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +826 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +110 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +378 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +82 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +356 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +113 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +542 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +231 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +112 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +477 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +214 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +240 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +216 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +259 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +328 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +97 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +310 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +323 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +217 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +199 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +470 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +88 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +131 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +203 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +234 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +276 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +38 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +299 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +129 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +100 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +172 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +372 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +581 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +156 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +225 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +320 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +81 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +309 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +34 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +360 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +127 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +91 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +69 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +105 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +207 -0
- package/gradle/libs.versions.toml +69 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +26 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/Application/ApplicationEnvironment.swift +15 -3
- package/ios/Application/Components.swift +36 -30
- package/ios/Application/FloatingButton.swift +10 -9
- package/ios/Application/Localize.swift +309 -0
- package/ios/Application/MaxApi.swift +18 -0
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +104 -0
- package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
- package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
- package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
- package/ios/Application/Navigation/HeaderTitle.swift +57 -0
- package/ios/Application/Navigation/HeaderUser.swift +209 -0
- package/ios/Application/Navigation/NavigationContainer.swift +203 -0
- package/ios/Application/Navigation/NavigationOptions.swift +109 -0
- package/ios/Application/Navigation/Navigator.swift +385 -0
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +256 -0
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +74 -0
- package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
- package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
- package/ios/Application/Navigation/component/Header.swift +178 -0
- package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
- package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
- package/ios/Application/Navigation/component/HeaderRightWidthKey.swift +11 -0
- package/ios/Application/Navigation/component/NavigationHeaderRight.swift +196 -0
- package/ios/Application/Screen.swift +2 -1
- package/ios/Application/StackScreen.swift +501 -0
- package/ios/Avatar/Avatar.swift +193 -0
- package/ios/Badge/Badge.swift +11 -14
- package/ios/Badge/BadgeRibbon.swift +91 -17
- package/ios/BaselineView/BaselineView.swift +163 -0
- package/ios/Button/Button.swift +137 -28
- package/ios/Carousel/Carousel.swift +196 -0
- package/ios/Checkbox/Checkbox.swift +23 -28
- package/ios/Chip/Chip.swift +56 -33
- package/ios/Collapse/Collapse.swift +192 -0
- package/ios/Colors+Radius+Spacing/Colors.swift +20 -17
- package/ios/Colors+Radius+Spacing/Spacing.swift +3 -1
- package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
- package/ios/DateTimePicker/DateTimePicker.swift +212 -0
- package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
- package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
- package/ios/DateTimePicker/WheelPicker.swift +165 -0
- package/ios/Divider/Divider.swift +16 -0
- package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
- package/ios/Extensions/Color++.swift +32 -0
- package/ios/Icon/Icon.swift +10 -1
- package/ios/IconButton/IconButton.swift +140 -0
- package/ios/Image/Image.swift +16 -3
- package/ios/Information/Information.swift +3 -1
- package/ios/Input/ErrorView.swift +3 -1
- package/ios/Input/Input.swift +72 -33
- package/ios/Input/InputPhoneNumber.swift +33 -21
- package/ios/Input/InputSearch.swift +107 -48
- package/ios/Input/InputTextArea.swift +134 -64
- package/ios/InputDropDown/InputDropDown.swift +201 -0
- package/ios/InputMoney/InputMoney.swift +347 -0
- package/ios/InputOTP/InputOTP.swift +210 -0
- package/ios/Loader/Loader.swift +113 -0
- package/ios/MoMoUIKits.podspec +5 -0
- package/ios/Pagination/PaginationDot.swift +61 -0
- package/ios/Pagination/PaginationNumber.swift +35 -0
- package/ios/Pagination/PaginationScroll.swift +101 -0
- package/ios/Pagination/PaginationWhiteDot.swift +37 -0
- package/ios/Popup/PopupDisplay.swift +11 -20
- package/ios/Popup/PopupInput.swift +2 -8
- package/ios/Popup/PopupNotify.swift +218 -0
- package/ios/Popup/PopupPromotion.swift +5 -3
- package/ios/ProgressInfo/ProgressInfo.swift +296 -0
- package/ios/Radio/Radio.swift +69 -0
- package/ios/Rating/Rating.swift +82 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Background.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Border.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Card.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Contents.json +6 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Error.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryDark.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryLight.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Success.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Text.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/TextSecondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +9 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Warning.colorset/Contents.json +38 -0
- package/ios/Skeleton/Skeleton.swift +99 -0
- package/ios/Slider/Slider.swift +237 -0
- package/ios/Stepper/Stepper.swift +220 -0
- package/ios/Steps/Steps.swift +467 -0
- package/ios/SuggestAction/SuggestAction.swift +99 -0
- package/ios/Swipeable/SwipeCell.swift +187 -0
- package/ios/Swipeable/SwipeCellModel.swift +21 -0
- package/ios/Switch/Switch.swift +53 -28
- package/ios/TabView/TabView.swift +534 -0
- package/ios/Tag/Tag.swift +98 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +7 -8
- package/ios/Title/Title.swift +269 -0
- package/ios/Tooltip/Tooltip.swift +485 -0
- package/ios/Typography/FontScaleStore.swift +19 -0
- package/ios/Typography/Text.swift +86 -17
- package/ios/Typography/Typography.swift +12 -14
- package/ios/Uploader/Uploader.swift +174 -0
- package/ios/native-kits.podspec +61 -8
- package/ios-demo/MoMoUIKitsDemo.podspec +20 -0
- package/ios-demo/README.md +120 -0
- package/ios-demo/Resources/dot_loading.json +558 -0
- package/ios-demo/Resources/icon.json +4052 -0
- package/ios-demo/Resources/lottie_circle_loader.json +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +24 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +269 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +126 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +64 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +20 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +124 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +14 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +279 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +58 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +78 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +138 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +111 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +136 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +73 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +57 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +70 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +188 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +229 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +72 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +121 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +76 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +89 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +56 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +150 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +138 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +103 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +94 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +79 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +152 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +33 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +190 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +34 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +182 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +109 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +187 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +131 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +51 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
- package/local.properties +8 -0
- package/package.json +1 -1
- package/publish.sh +53 -0
- package/scripts/gen-ios-color.mjs +136 -0
- package/settings.gradle.kts +64 -0
- package/example/ios/Example.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -46
- package/ios/Application/FontScaleStore.swift +0 -59
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LocalizeDemo.swift
|
|
3
|
+
// MoMoUIKitsDemo
|
|
4
|
+
//
|
|
5
|
+
// SwiftUI port of the Compose demo `sample/shared/.../screens/LocalizeUsage.kt`,
|
|
6
|
+
// showcasing the `Localize` i18n port (ios/Application/Localize.swift).
|
|
7
|
+
// Synced from sample/iosApp/iosApp/Demo/LocalizeDemo.swift.
|
|
8
|
+
//
|
|
9
|
+
|
|
10
|
+
import MoMoUIKits
|
|
11
|
+
import SwiftUI
|
|
12
|
+
|
|
13
|
+
// App-specific dictionary. Keys here do NOT exist in the kit defaults, so addTranslations
|
|
14
|
+
// registers them cleanly (addTranslations keeps existing keys on clash, host-default wins).
|
|
15
|
+
private let AppTranslations = LocalizationObject(
|
|
16
|
+
vi: [
|
|
17
|
+
"demo_greeting": "Xin chào MoMo!",
|
|
18
|
+
"demo_cart_title": "Giỏ hàng của bạn",
|
|
19
|
+
],
|
|
20
|
+
en: [
|
|
21
|
+
"demo_greeting": "Hello MoMo!",
|
|
22
|
+
"demo_cart_title": "Your cart",
|
|
23
|
+
]
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
struct LocalizeDemo: View {
|
|
27
|
+
@EnvironmentObject private var localize: Localize
|
|
28
|
+
|
|
29
|
+
private var isEnglish: Bool { localize.currentLanguage == Localize.EN }
|
|
30
|
+
|
|
31
|
+
var body: some View {
|
|
32
|
+
ScrollView {
|
|
33
|
+
VStack(alignment: .leading, spacing: 0) {
|
|
34
|
+
|
|
35
|
+
LocalizeSectionBox(title: "Đổi ngôn ngữ (toàn app)") {
|
|
36
|
+
MomoText(
|
|
37
|
+
"localize.changeLanguage(...) đổi ngôn ngữ cho cả NavigationContainer — mọi màn hình đang đọc translate() sẽ cập nhật theo.",
|
|
38
|
+
typography: .descriptionDefaultRegular
|
|
39
|
+
)
|
|
40
|
+
Switch(
|
|
41
|
+
.constant(isEnglish),
|
|
42
|
+
onChange: { _ in localize.changeLanguage(isEnglish ? Localize.VI : Localize.EN) },
|
|
43
|
+
title: "English"
|
|
44
|
+
)
|
|
45
|
+
MomoText("currentLanguage = \(localize.currentLanguage)", typography: .labelDefaultMedium)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
LocalizeSectionBox(title: "translate(key) — từ điển mặc định của kit") {
|
|
49
|
+
TranslationRow(key: "confirm", value: localize.translate("confirm"))
|
|
50
|
+
TranslationRow(key: "cancel", value: localize.translate("cancel"))
|
|
51
|
+
TranslationRow(key: "done", value: localize.translate("done"))
|
|
52
|
+
TranslationRow(key: "seeMore", value: localize.translate("seeMore"))
|
|
53
|
+
TranslationRow(key: "balance", value: localize.translate("balance"))
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
LocalizeSectionBox(title: "Key thiếu → trả về chính key") {
|
|
57
|
+
MomoText(
|
|
58
|
+
"translate() với key không có (hoặc giá trị rỗng) sẽ trả lại đúng key để dễ phát hiện thiếu bản dịch.",
|
|
59
|
+
typography: .descriptionDefaultRegular
|
|
60
|
+
)
|
|
61
|
+
TranslationRow(key: "not_a_real_key", value: localize.translate("not_a_real_key"))
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
LocalizeSectionBox(title: "Chèn tham số vào bản dịch") {
|
|
65
|
+
MomoText(
|
|
66
|
+
"Bản port không tự nội suy {placeholder} — tự replace ở nơi dùng.",
|
|
67
|
+
typography: .descriptionDefaultRegular
|
|
68
|
+
)
|
|
69
|
+
TranslationRow(
|
|
70
|
+
key: "voucherRemindHour",
|
|
71
|
+
value: localize.translate("voucherRemindHour").replacingOccurrences(of: "{hours}", with: "3")
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
LocalizeSectionBox(title: "translateData(vi:en:) — dịch nội tuyến") {
|
|
76
|
+
MomoText(
|
|
77
|
+
"Cho chuỗi dùng một lần, không cần khai báo key trong từ điển.",
|
|
78
|
+
typography: .descriptionDefaultRegular
|
|
79
|
+
)
|
|
80
|
+
MomoText(localize.translateData(vi: "Thanh toán ngay", en: "Pay now"), typography: .headerDefaultBold)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
LocalizeSectionBox(title: "translateData(map) — chọn theo ngôn ngữ") {
|
|
84
|
+
MomoText(
|
|
85
|
+
localize.translateData([
|
|
86
|
+
Localize.VI: "Lịch sử giao dịch",
|
|
87
|
+
Localize.EN: "Transaction history",
|
|
88
|
+
]),
|
|
89
|
+
typography: .headerDefaultBold
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
LocalizeSectionBox(title: "addTranslations — từ điển riêng của app") {
|
|
94
|
+
MomoText(
|
|
95
|
+
"Host đăng ký key riêng (đã add khi màn hình xuất hiện), rồi dùng translate() như key mặc định.",
|
|
96
|
+
typography: .descriptionDefaultRegular
|
|
97
|
+
)
|
|
98
|
+
TranslationRow(key: "demo_greeting", value: localize.translate("demo_greeting"))
|
|
99
|
+
TranslationRow(key: "demo_cart_title", value: localize.translate("demo_cart_title"))
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
LocalizeSectionBox(title: "Ví dụ thực tế") {
|
|
103
|
+
// errorCode already ends with a separator ("Mã lỗi: " / "Error code: ").
|
|
104
|
+
MomoText(localize.translate("errorCode") + "E-4097", typography: .bodyDefaultRegular)
|
|
105
|
+
HStack(spacing: Spacing.M) {
|
|
106
|
+
Button(
|
|
107
|
+
title: localize.translate("cancel"),
|
|
108
|
+
action: {},
|
|
109
|
+
type: .outline,
|
|
110
|
+
size: .medium,
|
|
111
|
+
isFull: false
|
|
112
|
+
)
|
|
113
|
+
Button(
|
|
114
|
+
title: localize.translate("confirm"),
|
|
115
|
+
action: {},
|
|
116
|
+
type: .primary,
|
|
117
|
+
size: .medium,
|
|
118
|
+
isFull: false
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
Spacer(minLength: 32)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Registers the app-specific dictionary once per appearance; addTranslations'
|
|
127
|
+
// merge is idempotent, so re-entry (e.g. re-navigating back to this screen) is safe.
|
|
128
|
+
.onAppear {
|
|
129
|
+
localize.addTranslations(AppTranslations)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// MARK: - LocalizeSectionBox
|
|
135
|
+
|
|
136
|
+
/// Titled rounded-card section container, mirroring Compose's `BasicColumnBox`
|
|
137
|
+
/// (title label above a `theme.colors.background.surface` card with `Radius.M` corners).
|
|
138
|
+
private struct LocalizeSectionBox<Content: View>: View {
|
|
139
|
+
@Environment(\.appTheme) private var theme
|
|
140
|
+
let title: String
|
|
141
|
+
@ViewBuilder let content: () -> Content
|
|
142
|
+
|
|
143
|
+
var body: some View {
|
|
144
|
+
VStack(alignment: .leading, spacing: 8) {
|
|
145
|
+
if !title.isEmpty {
|
|
146
|
+
MomoText(title, typography: .headerMBold)
|
|
147
|
+
.padding(.top, 8)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
VStack(alignment: .leading, spacing: 8) {
|
|
151
|
+
content()
|
|
152
|
+
}
|
|
153
|
+
.frame(maxWidth: .infinity, alignment: .leading)
|
|
154
|
+
.padding(12)
|
|
155
|
+
.background(theme.colors.background.surface)
|
|
156
|
+
.clipShape(RoundedRectangle(cornerRadius: Radius.M))
|
|
157
|
+
}
|
|
158
|
+
.padding(12)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// MARK: - TranslationRow
|
|
163
|
+
|
|
164
|
+
private struct TranslationRow: View {
|
|
165
|
+
@Environment(\.appTheme) private var theme
|
|
166
|
+
let key: String
|
|
167
|
+
let value: String
|
|
168
|
+
|
|
169
|
+
var body: some View {
|
|
170
|
+
VStack(alignment: .leading, spacing: 2) {
|
|
171
|
+
MomoText(key, typography: .labelDefaultMedium, color: theme.colors.text.secondary)
|
|
172
|
+
MomoText(value, typography: .bodyDefaultRegular)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// MARK: - Preview
|
|
178
|
+
|
|
179
|
+
#Preview {
|
|
180
|
+
if #available(iOS 16.0, *) {
|
|
181
|
+
NavigationStack {
|
|
182
|
+
LocalizeDemo()
|
|
183
|
+
.environmentObject(Localize())
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
// Fallback on earlier versions
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NavigationDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Usage demo for the navigation flow. Mirrors Compose's `NavigationUsage`:
|
|
6
|
+
// exercises push / present / replace / reset, the modal & bottom-sheet
|
|
7
|
+
// overplays, the snack bar, the user header title and the bottom-tab layout.
|
|
8
|
+
//
|
|
9
|
+
|
|
10
|
+
import MoMoUIKits
|
|
11
|
+
import SwiftUI
|
|
12
|
+
|
|
13
|
+
struct NavigationDemo: View {
|
|
14
|
+
var body: some View {
|
|
15
|
+
if #available(iOS 16.0, *) {
|
|
16
|
+
NavigationDemoContent()
|
|
17
|
+
} else {
|
|
18
|
+
Text("Navigation demo requires iOS 16+").padding()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@available(iOS 16.0, *)
|
|
24
|
+
private struct NavigationDemoContent: View {
|
|
25
|
+
@EnvironmentObject private var navigator: Navigator
|
|
26
|
+
@State private var textValue1 = ""
|
|
27
|
+
|
|
28
|
+
var body: some View {
|
|
29
|
+
ScrollView {
|
|
30
|
+
VStack(spacing: 12) {
|
|
31
|
+
row("Push Screen") {
|
|
32
|
+
navigator.push(
|
|
33
|
+
{ DemoLeafScreen(title: "Pushed Screen", color: Colors.blue09) },
|
|
34
|
+
options: NavigationOptions(title: "Pushed Screen")
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
row("Present Screen") {
|
|
39
|
+
navigator.present(
|
|
40
|
+
{ PresentedScreen() },
|
|
41
|
+
options: NavigationOptions(title: "Presented Screen")
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
row("Replace Screen") {
|
|
46
|
+
navigator.replace(
|
|
47
|
+
{ DemoLeafScreen(title: "Replaced Screen", color: Colors.pink09) },
|
|
48
|
+
options: NavigationOptions(title: "Replaced Screen")
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
row("Reset Screen") {
|
|
53
|
+
// Clears the whole stack and installs a new root (no back).
|
|
54
|
+
navigator.reset(
|
|
55
|
+
{ ResetTargetScreen() },
|
|
56
|
+
options: NavigationOptions(title: "Reset Screen", hiddenBack: true)
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
row("Show Modal") {
|
|
61
|
+
navigator.showModal({
|
|
62
|
+
VStack(spacing: 16) {
|
|
63
|
+
MomoText("This is a modal", typography: .headerDefaultBold)
|
|
64
|
+
MoMoUIKits.Button(title: "Close", action: { navigator.hideOverplay() }, type: .primary, size: .medium)
|
|
65
|
+
}
|
|
66
|
+
.padding(24)
|
|
67
|
+
.frame(width: 300)
|
|
68
|
+
.background(Colors.black01)
|
|
69
|
+
.clipShape(RoundedRectangle(cornerRadius: Radius.L))
|
|
70
|
+
}, barrierDismissible: true, onDismiss: { print("Modal dismissed") })
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
row("Show Bottom Sheet") {
|
|
74
|
+
navigator.showBottomSheet({
|
|
75
|
+
VStack(spacing: 12) {
|
|
76
|
+
Input(text: $textValue1, placeholder: "Test Bottom Sheet")
|
|
77
|
+
ForEach(0..<4, id: \.self) { i in
|
|
78
|
+
MomoText("Bottom sheet row \(i + 1)")
|
|
79
|
+
.frame(maxWidth: .infinity, alignment: .leading)
|
|
80
|
+
}
|
|
81
|
+
MoMoUIKits.Button(title: "Close", action: { navigator.hideOverplay() }, type: .primary, size: .large)
|
|
82
|
+
}
|
|
83
|
+
.padding(Spacing.L)
|
|
84
|
+
}, isSurface: true, barrierDismissible: true, header: .title("Bottom Sheet"), onDismiss: { print("Bottom Sheet dismissed") })
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
row("Show Snack Bar") {
|
|
88
|
+
navigator.showSnackBar(.custom(duration: 2.0) {
|
|
89
|
+
HStack {
|
|
90
|
+
MomoText("Snack bar !!!", color: Colors.black01)
|
|
91
|
+
Spacer()
|
|
92
|
+
}
|
|
93
|
+
.padding(.horizontal, 20)
|
|
94
|
+
.frame(height: 56)
|
|
95
|
+
.frame(maxWidth: .infinity)
|
|
96
|
+
.background(Colors.black17)
|
|
97
|
+
.clipShape(RoundedRectangle(cornerRadius: Radius.M))
|
|
98
|
+
.padding(.horizontal, Spacing.M)
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
Divider().padding(.vertical, 4)
|
|
103
|
+
|
|
104
|
+
row("Prevent Back") {
|
|
105
|
+
// Tapping the header back button shows a confirm popup before
|
|
106
|
+
// leaving (mirrors Compose's headerBackProps.preventBack).
|
|
107
|
+
navigator.push(
|
|
108
|
+
{ DemoLeafScreen(title: "Tap the header back button", color: Colors.pink09) },
|
|
109
|
+
options: NavigationOptions(
|
|
110
|
+
title: "Prevent Back",
|
|
111
|
+
headerBackProps: HeaderBackProps(
|
|
112
|
+
preventBack: PreventBackProps(
|
|
113
|
+
title: "Leave this screen?",
|
|
114
|
+
description: "Your changes won't be saved.",
|
|
115
|
+
primary: PopupAction(title: "Leave", onPress: { print("left") }),
|
|
116
|
+
secondary: PopupAction(title: "Stay")
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
row("Header User Title") {
|
|
124
|
+
navigator.push(
|
|
125
|
+
{ HeaderUserDemoContent() },
|
|
126
|
+
options: NavigationOptions(
|
|
127
|
+
headerTitle: .user(
|
|
128
|
+
HeaderUserData(
|
|
129
|
+
title: "Nguyen Van A",
|
|
130
|
+
subTitle: "0900 000 000",
|
|
131
|
+
image: ["https://images.unsplash.com/photo-1599566150163-29194dcaad36"],
|
|
132
|
+
dotColor: Colors.primary,
|
|
133
|
+
icons: ["https://static.momocdn.net/app/img/kits/verified.png"]
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
row("Header Animated") {
|
|
141
|
+
navigator.push(
|
|
142
|
+
{ AnimatedHeaderDemoContent() },
|
|
143
|
+
options: NavigationOptions(title: "Animated Header")
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
row("Bottom Tabs") {
|
|
148
|
+
navigator.push(
|
|
149
|
+
{ BottomTabDemoContent() },
|
|
150
|
+
// Parent screen has no chrome; each tab renders its own
|
|
151
|
+
// header (mirrors Compose setting parent headerType = None).
|
|
152
|
+
options: NavigationOptions(headerType: .none, scrollable: false)
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
.padding(16)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@ViewBuilder
|
|
161
|
+
private func row(_ title: String, action: @escaping () -> Void) -> some View {
|
|
162
|
+
MoMoUIKits.Button(title: title, action: action, size: .large)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// MARK: - Leaf / presented screens
|
|
167
|
+
|
|
168
|
+
@available(iOS 16.0, *)
|
|
169
|
+
private struct DemoLeafScreen: View {
|
|
170
|
+
@EnvironmentObject private var navigator: Navigator
|
|
171
|
+
let title: String
|
|
172
|
+
let color: Color
|
|
173
|
+
|
|
174
|
+
var body: some View {
|
|
175
|
+
VStack(spacing: 16) {
|
|
176
|
+
MomoText(title, typography: .headerDefaultBold)
|
|
177
|
+
MoMoUIKits.Button(title: "Go back", action: { navigator.pop() }, type: .primary, size: .large)
|
|
178
|
+
}
|
|
179
|
+
.frame(maxWidth: .infinity)
|
|
180
|
+
.padding(24)
|
|
181
|
+
.background(color)
|
|
182
|
+
.clipShape(RoundedRectangle(cornerRadius: Radius.L))
|
|
183
|
+
.padding(16)
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@available(iOS 16.0, *)
|
|
188
|
+
private struct ResetTargetScreen: View {
|
|
189
|
+
@EnvironmentObject private var navigator: Navigator
|
|
190
|
+
|
|
191
|
+
var body: some View {
|
|
192
|
+
VStack(spacing: 16) {
|
|
193
|
+
MomoText("Stack was reset — this is the new root.", typography: .headerDefaultBold)
|
|
194
|
+
// `reset` again to re-root back into the navigation demo.
|
|
195
|
+
MoMoUIKits.Button(
|
|
196
|
+
title: "Back to Navigation demo",
|
|
197
|
+
action: {
|
|
198
|
+
navigator.reset(
|
|
199
|
+
{ NavigationDemoContent() },
|
|
200
|
+
options: NavigationOptions(title: "Navigation")
|
|
201
|
+
)
|
|
202
|
+
},
|
|
203
|
+
type: .primary,
|
|
204
|
+
size: .large
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
.frame(maxWidth: .infinity)
|
|
208
|
+
.padding(24)
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@available(iOS 16.0, *)
|
|
213
|
+
private struct PresentedScreen: View {
|
|
214
|
+
@EnvironmentObject private var navigator: Navigator
|
|
215
|
+
|
|
216
|
+
var body: some View {
|
|
217
|
+
VStack(spacing: 16) {
|
|
218
|
+
MomoText("Presented modally (slides up)", typography: .headerDefaultBold)
|
|
219
|
+
MoMoUIKits.Button(title: "Dismiss", action: { navigator.dismiss() }, type: .primary, size: .large)
|
|
220
|
+
}
|
|
221
|
+
.padding(24)
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
#if DEBUG
|
|
226
|
+
struct NavigationDemo_Previews: PreviewProvider {
|
|
227
|
+
static var previews: some View { NavigationDemo() }
|
|
228
|
+
}
|
|
229
|
+
#endif
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PaginationDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Combined demo for the four pagination variants.
|
|
6
|
+
// Mirrors shared PaginationUsage.kt: a configurable Data Length plus
|
|
7
|
+
// Prev/Next controls drive PaginationScroll, PaginationNumber,
|
|
8
|
+
// PaginationDot and PaginationWhiteDot.
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
import MoMoUIKits
|
|
12
|
+
import SwiftUI
|
|
13
|
+
|
|
14
|
+
struct PaginationDemo: View {
|
|
15
|
+
@State private var dataLengthText: String = "3"
|
|
16
|
+
@State private var activeIndex: Int = 0
|
|
17
|
+
|
|
18
|
+
private var dataLength: Int {
|
|
19
|
+
let n = Int(dataLengthText) ?? 1
|
|
20
|
+
return max(n, 1)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var body: some View {
|
|
24
|
+
ScrollView {
|
|
25
|
+
VStack(alignment: .center, spacing: Spacing.L) {
|
|
26
|
+
PaginationScroll {
|
|
27
|
+
ForEach(0..<10, id: \.self) { i in
|
|
28
|
+
MomoText("\(i)", typography: .bodyDefaultRegular)
|
|
29
|
+
.frame(width: 120, height: 60)
|
|
30
|
+
.background(Colors.blue08)
|
|
31
|
+
.overlay(
|
|
32
|
+
Rectangle().stroke(Colors.black06, lineWidth: 1)
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
PaginationNumber(activeIndex: activeIndex, dataLength: dataLength)
|
|
38
|
+
|
|
39
|
+
PaginationDot(activeIndex: activeIndex, dataLength: dataLength)
|
|
40
|
+
|
|
41
|
+
PaginationWhiteDot(activeIndex: activeIndex, dataLength: dataLength)
|
|
42
|
+
.padding(Spacing.S)
|
|
43
|
+
.background(Colors.black17) // dark backdrop so white dots are visible
|
|
44
|
+
|
|
45
|
+
MomoText("Data Length", typography: .labelSMedium, color: Colors.textSecondary)
|
|
46
|
+
TextField("Data Length", text: $dataLengthText)
|
|
47
|
+
.keyboardType(.numberPad)
|
|
48
|
+
.textFieldStyle(.roundedBorder)
|
|
49
|
+
.onChange(of: dataLengthText) { _ in activeIndex = 0 }
|
|
50
|
+
.frame(maxWidth: 200)
|
|
51
|
+
|
|
52
|
+
HStack {
|
|
53
|
+
Button("Prev") {
|
|
54
|
+
if activeIndex != 0 { activeIndex -= 1 }
|
|
55
|
+
}
|
|
56
|
+
.frame(maxWidth: .infinity)
|
|
57
|
+
|
|
58
|
+
Button("Next") {
|
|
59
|
+
if activeIndex != dataLength - 1 { activeIndex += 1 }
|
|
60
|
+
}
|
|
61
|
+
.frame(maxWidth: .infinity)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
.padding(Spacing.L)
|
|
65
|
+
}
|
|
66
|
+
.background(Colors.background)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#Preview {
|
|
71
|
+
PaginationDemo()
|
|
72
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PopupDisplayDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Usage demo for PopupDisplay component.
|
|
6
|
+
// Mirrors Compose's PopupNotifyUsage: a configurable form whose action
|
|
7
|
+
// button presents the popup through `navigator.showModal`.
|
|
8
|
+
//
|
|
9
|
+
|
|
10
|
+
import MoMoUIKits
|
|
11
|
+
import SwiftUI
|
|
12
|
+
|
|
13
|
+
// MARK: - PopupDisplayDemo
|
|
14
|
+
|
|
15
|
+
struct PopupDisplayDemo: View {
|
|
16
|
+
var body: some View {
|
|
17
|
+
if #available(iOS 16.0, *) {
|
|
18
|
+
PopupDisplayDemoContent()
|
|
19
|
+
} else {
|
|
20
|
+
Text("PopupDisplay demo requires iOS 16+")
|
|
21
|
+
.padding()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// MARK: - PopupDisplayDemoContent
|
|
27
|
+
|
|
28
|
+
@available(iOS 16.0, *)
|
|
29
|
+
private struct PopupDisplayDemoContent: View {
|
|
30
|
+
@EnvironmentObject private var navigator: Navigator
|
|
31
|
+
|
|
32
|
+
@State private var image = "https://static.momocdn.net/app/img/popup_permission/img_permission_popup_camera.png"
|
|
33
|
+
@State private var title = "Title"
|
|
34
|
+
@State private var description = "Check lại một nhịp auto chuyển sang dạng CTA."
|
|
35
|
+
@State private var errorCode = "9004"
|
|
36
|
+
@State private var buttonDirection: PopupButtonDirection = .auto
|
|
37
|
+
@State private var primaryTitle = "Primary"
|
|
38
|
+
@State private var secondaryTitle = "Secondary"
|
|
39
|
+
@State private var showCloseIcon = false
|
|
40
|
+
|
|
41
|
+
var body: some View {
|
|
42
|
+
ScrollView {
|
|
43
|
+
VStack(alignment: .leading, spacing: 12) {
|
|
44
|
+
// MARK: - Image URL
|
|
45
|
+
|
|
46
|
+
HStack(alignment: .center, spacing: 8) {
|
|
47
|
+
Input(
|
|
48
|
+
text: $image,
|
|
49
|
+
placeholder: "Image URL",
|
|
50
|
+
floatingValue: "Image URL"
|
|
51
|
+
)
|
|
52
|
+
Checkbox(
|
|
53
|
+
Binding(
|
|
54
|
+
get: { image.isEmpty },
|
|
55
|
+
set: { checked in
|
|
56
|
+
image = checked ? "" : "https://static.momocdn.net/app/img/popup_permission/img_permission_popup_camera.png"
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
title: "undefined"
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// MARK: - Title
|
|
64
|
+
|
|
65
|
+
Input(
|
|
66
|
+
text: $title,
|
|
67
|
+
placeholder: "Title",
|
|
68
|
+
floatingValue: "Title"
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
// MARK: - Description
|
|
72
|
+
|
|
73
|
+
Input(
|
|
74
|
+
text: $description,
|
|
75
|
+
placeholder: "Description",
|
|
76
|
+
floatingValue: "Description"
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
// MARK: - Error code
|
|
80
|
+
|
|
81
|
+
HStack(alignment: .center, spacing: 8) {
|
|
82
|
+
Input(
|
|
83
|
+
text: $errorCode,
|
|
84
|
+
placeholder: "Error",
|
|
85
|
+
floatingValue: "Error"
|
|
86
|
+
)
|
|
87
|
+
Checkbox(
|
|
88
|
+
Binding(
|
|
89
|
+
get: { errorCode.isEmpty },
|
|
90
|
+
set: { checked in
|
|
91
|
+
errorCode = checked ? "" : "9004"
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
title: "undefined"
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// MARK: - Button direction
|
|
99
|
+
|
|
100
|
+
VStack(alignment: .leading, spacing: 6) {
|
|
101
|
+
Text("Button Direction")
|
|
102
|
+
.font(.caption)
|
|
103
|
+
.foregroundColor(.secondary)
|
|
104
|
+
Picker("Button Direction", selection: $buttonDirection) {
|
|
105
|
+
Text("Auto").tag(PopupButtonDirection.auto)
|
|
106
|
+
Text("Row").tag(PopupButtonDirection.row)
|
|
107
|
+
Text("Column").tag(PopupButtonDirection.column)
|
|
108
|
+
}
|
|
109
|
+
.pickerStyle(.segmented)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// MARK: - Button titles
|
|
113
|
+
|
|
114
|
+
Input(
|
|
115
|
+
text: $primaryTitle,
|
|
116
|
+
placeholder: "Primary Button Title",
|
|
117
|
+
floatingValue: "Primary Button Title"
|
|
118
|
+
)
|
|
119
|
+
Input(
|
|
120
|
+
text: $secondaryTitle,
|
|
121
|
+
placeholder: "Secondary Button Title",
|
|
122
|
+
floatingValue: "Secondary Button Title"
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
// MARK: - Show close icon
|
|
126
|
+
|
|
127
|
+
Checkbox($showCloseIcon, title: "Show Close Button")
|
|
128
|
+
.padding(.vertical, 4)
|
|
129
|
+
|
|
130
|
+
// MARK: - Action
|
|
131
|
+
|
|
132
|
+
Button(
|
|
133
|
+
title: "Show popup",
|
|
134
|
+
action: showPopup,
|
|
135
|
+
type: .primary,
|
|
136
|
+
size: .large
|
|
137
|
+
)
|
|
138
|
+
.padding(.top, 8)
|
|
139
|
+
}
|
|
140
|
+
.padding(16)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// MARK: - Helpers
|
|
145
|
+
|
|
146
|
+
private func showPopup() {
|
|
147
|
+
navigator.showModal {
|
|
148
|
+
PopupDisplay(
|
|
149
|
+
isPresented: .constant(true),
|
|
150
|
+
title: title,
|
|
151
|
+
description: description,
|
|
152
|
+
url: image,
|
|
153
|
+
buttonDirection: buttonDirection,
|
|
154
|
+
buttonType: .button,
|
|
155
|
+
actionButtonTitle: primaryTitle,
|
|
156
|
+
closeButtonTitle: secondaryTitle,
|
|
157
|
+
onPressAction: { navigator.hideOverplay() },
|
|
158
|
+
onPressCloseButton: { navigator.hideOverplay() },
|
|
159
|
+
onClose: { navigator.hideOverplay() },
|
|
160
|
+
errorCode: errorCode,
|
|
161
|
+
isShowCloseIcon: showCloseIcon
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// MARK: - Preview
|
|
168
|
+
|
|
169
|
+
#if DEBUG
|
|
170
|
+
struct PopupDisplayDemo_Previews: PreviewProvider {
|
|
171
|
+
static var previews: some View {
|
|
172
|
+
PopupDisplayDemo()
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
#endif
|