@momo-kits/native-kits 0.162.2-beta.26 → 0.162.2-beta.27-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +1 -1
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +190 -0
- package/compose/build.gradle.kts.backup +190 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +123 -0
- package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
- package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +101 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +183 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +294 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +826 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +107 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +378 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +82 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +356 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +113 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +140 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +231 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +112 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +477 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +214 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +240 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +216 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +259 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +328 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +97 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +310 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +323 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +217 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +199 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +470 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +88 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +131 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +203 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +234 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +270 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +253 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +129 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +100 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +154 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +360 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +581 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +156 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +225 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +320 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +81 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +309 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +34 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +360 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +128 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +70 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +58 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +105 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +184 -0
- package/gradle/libs.versions.toml +69 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +26 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/Application/ApplicationEnvironment.swift +0 -11
- package/ios/Application/Components.swift +44 -34
- package/ios/Application/FloatingButton.swift +9 -10
- package/ios/Application/HeaderRight.swift +45 -79
- package/ios/Application/Screen.swift +1 -2
- package/ios/Badge/Badge.swift +14 -11
- package/ios/Badge/BadgeRibbon.swift +21 -12
- package/ios/Button/Button.swift +22 -61
- package/ios/Checkbox/Checkbox.swift +13 -14
- package/ios/Chip/Chip.swift +9 -23
- package/ios/Colors+Radius+Spacing/Colors.swift +12 -12
- package/ios/Extensions/Color++.swift +0 -32
- package/ios/Icon/Icon.swift +1 -6
- package/ios/Input/Input.swift +25 -41
- package/ios/Input/InputPhoneNumber.swift +19 -20
- package/ios/Input/InputSearch.swift +47 -100
- package/ios/Input/InputTextArea.swift +40 -66
- package/ios/Popup/PopupDisplay.swift +16 -8
- package/ios/Popup/PopupInput.swift +8 -2
- package/ios/Swipeable/SwipeCell.swift +0 -185
- package/ios/Swipeable/SwipeCellModel.swift +0 -21
- package/ios/Typography/Text.swift +5 -79
- package/ios/Typography/Typography.swift +0 -3
- package/ios/native-kits.podspec +8 -61
- package/package.json +1 -1
- package/publish.sh +0 -50
- package/settings.gradle.kts +64 -0
- package/.claude/settings.local.json +0 -39
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +0 -103
- package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +0 -215
- package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +0 -65
- package/ios/Application/Navigation/HeaderBackProps.swift +0 -66
- package/ios/Application/Navigation/HeaderTitle.swift +0 -57
- package/ios/Application/Navigation/HeaderUser.swift +0 -209
- package/ios/Application/Navigation/NavigationContainer.swift +0 -176
- package/ios/Application/Navigation/NavigationOptions.swift +0 -109
- package/ios/Application/Navigation/Navigator.swift +0 -364
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +0 -188
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +0 -68
- package/ios/Application/Navigation/Overplay/SnackBar.swift +0 -144
- package/ios/Application/Navigation/component/Header.swift +0 -178
- package/ios/Application/Navigation/component/HeaderBackground.swift +0 -83
- package/ios/Application/Navigation/component/HeaderColor.swift +0 -65
- package/ios/Application/StackScreen.swift +0 -453
- package/ios/Avatar/Avatar.swift +0 -193
- package/ios/BaselineView/BaselineView.swift +0 -163
- package/ios/Carousel/Carousel.swift +0 -181
- package/ios/Collapse/Collapse.swift +0 -182
- package/ios/Colors+Radius+Spacing/Theme.swift +0 -295
- package/ios/DateTimePicker/DateTimePicker.swift +0 -210
- package/ios/DateTimePicker/DateTimePickerTypes.swift +0 -55
- package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -167
- package/ios/DateTimePicker/WheelPicker.swift +0 -161
- package/ios/Divider/Divider.swift +0 -16
- package/ios/IconButton/IconButton.swift +0 -112
- package/ios/InputDropDown/InputDropDown.swift +0 -198
- package/ios/InputMoney/InputMoney.swift +0 -335
- package/ios/InputOTP/InputOTP.swift +0 -210
- package/ios/Loader/Loader.swift +0 -113
- package/ios/MoMoUIKits.podspec +0 -5
- package/ios/Pagination/PaginationDot.swift +0 -61
- package/ios/Pagination/PaginationNumber.swift +0 -35
- package/ios/Pagination/PaginationScroll.swift +0 -101
- package/ios/Pagination/PaginationWhiteDot.swift +0 -37
- package/ios/Popup/PopupNotify.swift +0 -219
- package/ios/ProgressInfo/ProgressInfo.swift +0 -294
- package/ios/Radio/Radio.swift +0 -70
- package/ios/Rating/Rating.swift +0 -82
- package/ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json +0 -11
- package/ios/Resources/MoMoUIKitsColors.xcassets/Background.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Border.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Card.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Contents.json +0 -6
- package/ios/Resources/MoMoUIKitsColors.xcassets/Error.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Primary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryDark.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryLight.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Success.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Text.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/TextSecondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +0 -9
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +0 -38
- package/ios/Resources/MoMoUIKitsColors.xcassets/Warning.colorset/Contents.json +0 -38
- package/ios/Skeleton/Skeleton.swift +0 -99
- package/ios/Slider/Slider.swift +0 -237
- package/ios/Stepper/Stepper.swift +0 -220
- package/ios/Steps/Steps.swift +0 -451
- package/ios/SuggestAction/SuggestAction.swift +0 -97
- package/ios/TabView/TabView.swift +0 -530
- package/ios/Tag/Tag.swift +0 -98
- package/ios/Title/Title.swift +0 -269
- package/ios/Tooltip/Tooltip.swift +0 -482
- package/ios/Typography/FontScaleStore.swift +0 -19
- package/ios/Uploader/Uploader.swift +0 -183
- package/ios-demo/MoMoUIKitsDemo.podspec +0 -20
- package/ios-demo/Resources/dot_loading.json +0 -558
- package/ios-demo/Resources/icon.json +0 -4052
- package/ios-demo/Resources/lottie_circle_loader.json +0 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +0 -48
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +0 -25
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +0 -26
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +0 -19
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +0 -33
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +0 -48
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +0 -21
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +0 -17
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +0 -28
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +0 -31
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +0 -24
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +0 -110
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +0 -93
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +0 -269
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +0 -117
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +0 -89
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +0 -100
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +0 -126
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +0 -63
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +0 -20
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +0 -93
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +0 -107
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +0 -124
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +0 -14
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +0 -49
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +0 -278
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +0 -58
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +0 -78
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +0 -138
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +0 -111
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +0 -136
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +0 -107
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +0 -73
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +0 -100
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +0 -32
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +0 -57
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +0 -70
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +0 -227
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +0 -72
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +0 -175
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +0 -121
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +0 -76
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +0 -89
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +0 -32
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +0 -56
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +0 -32
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +0 -150
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +0 -138
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +0 -103
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +0 -94
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +0 -79
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +0 -152
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +0 -33
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +0 -190
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +0 -34
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +0 -182
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +0 -109
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +0 -187
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +0 -87
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +0 -131
- package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +0 -51
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +0 -15
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +0 -73
- package/scripts/gen-ios-color.mjs +0 -136
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import SwiftUI
|
|
2
|
-
|
|
3
|
-
// ---------------------------------------------------------------------------
|
|
4
|
-
// Size variant
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
|
|
7
|
-
public enum StepperSize {
|
|
8
|
-
case large
|
|
9
|
-
case small
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
private struct StepperSizeSpec {
|
|
13
|
-
let buttonSize: CGFloat
|
|
14
|
-
let iconSize: CGFloat
|
|
15
|
-
let numberMinWidth: CGFloat
|
|
16
|
-
let numberHeight: CGFloat
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
private func stepperSizeSpec(_ size: StepperSize) -> StepperSizeSpec {
|
|
20
|
-
switch size {
|
|
21
|
-
case .large:
|
|
22
|
-
return StepperSizeSpec(buttonSize: 36, iconSize: 22, numberMinWidth: 32, numberHeight: 28)
|
|
23
|
-
case .small:
|
|
24
|
-
return StepperSizeSpec(buttonSize: 28, iconSize: 18, numberMinWidth: 28, numberHeight: 24)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// ---------------------------------------------------------------------------
|
|
29
|
-
// Disabled spec — mirrors Compose `disabled: Any` (Bool or per-part array)
|
|
30
|
-
// ---------------------------------------------------------------------------
|
|
31
|
-
|
|
32
|
-
public struct StepperDisabled {
|
|
33
|
-
let minus: Bool
|
|
34
|
-
let plus: Bool
|
|
35
|
-
|
|
36
|
-
fileprivate var number: Bool { minus && plus }
|
|
37
|
-
|
|
38
|
-
public init(minus: Bool, plus: Bool) {
|
|
39
|
-
self.minus = minus
|
|
40
|
-
self.plus = plus
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/// All parts share the same disabled state.
|
|
44
|
-
public init(_ all: Bool) {
|
|
45
|
-
self.minus = all
|
|
46
|
-
self.plus = all
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
extension StepperDisabled: ExpressibleByBooleanLiteral {
|
|
51
|
-
public init(booleanLiteral value: Bool) {
|
|
52
|
-
self.init(value)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// ---------------------------------------------------------------------------
|
|
57
|
-
// Private sub-views
|
|
58
|
-
// ---------------------------------------------------------------------------
|
|
59
|
-
|
|
60
|
-
private struct StepperButton: View {
|
|
61
|
-
@Environment(\.appTheme) private var theme
|
|
62
|
-
|
|
63
|
-
var sign: String
|
|
64
|
-
var size: StepperSize
|
|
65
|
-
var disabled: Bool
|
|
66
|
-
var onPress: () -> Void
|
|
67
|
-
|
|
68
|
-
var body: some View {
|
|
69
|
-
let specs = stepperSizeSpec(size)
|
|
70
|
-
let iconColor: Color = disabled ? theme.colors.text.disable : theme.colors.primary
|
|
71
|
-
let iconName = sign == "-" ? "24_navigation_minus_circle" : "24_navigation_plus_circle"
|
|
72
|
-
|
|
73
|
-
SwiftUI.Button(action: { if !disabled { onPress() } }) {
|
|
74
|
-
ZStack {
|
|
75
|
-
Circle().fill(theme.colors.background.disable)
|
|
76
|
-
Icon(source: iconName, size: specs.iconSize, color: iconColor)
|
|
77
|
-
}
|
|
78
|
-
.frame(width: specs.buttonSize, height: specs.buttonSize)
|
|
79
|
-
}
|
|
80
|
-
.buttonStyle(.plain)
|
|
81
|
-
.disabled(disabled)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
private struct StepperNumberView: View {
|
|
86
|
-
@Environment(\.appTheme) private var theme
|
|
87
|
-
|
|
88
|
-
@Binding var text: String
|
|
89
|
-
var size: StepperSize
|
|
90
|
-
var disabled: Bool
|
|
91
|
-
var editable: Bool
|
|
92
|
-
|
|
93
|
-
var body: some View {
|
|
94
|
-
let specs = stepperSizeSpec(size)
|
|
95
|
-
let textColor: Color = disabled ? theme.colors.text.disable : theme.colors.text.default
|
|
96
|
-
let borderColor: Color = disabled ? theme.colors.border.disable : theme.colors.border.default
|
|
97
|
-
|
|
98
|
-
Group {
|
|
99
|
-
if editable {
|
|
100
|
-
TextField("", text: $text)
|
|
101
|
-
.keyboardType(.numberPad)
|
|
102
|
-
.multilineTextAlignment(.center)
|
|
103
|
-
.disabled(disabled)
|
|
104
|
-
} else {
|
|
105
|
-
MomoText(text, typography: .descriptionDefaultRegular, color: textColor)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
.font(.system(size: scaleSize(12)))
|
|
109
|
-
.ignoreBoldTextSetting()
|
|
110
|
-
.foregroundColor(textColor)
|
|
111
|
-
.frame(minWidth: specs.numberMinWidth)
|
|
112
|
-
.frame(height: specs.numberHeight)
|
|
113
|
-
.padding(.horizontal, Spacing.XS)
|
|
114
|
-
.overlay(
|
|
115
|
-
RoundedRectangle(cornerRadius: Radius.S)
|
|
116
|
-
.stroke(borderColor, lineWidth: 1)
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// ---------------------------------------------------------------------------
|
|
122
|
-
// Public API — MomoStepper
|
|
123
|
-
// ---------------------------------------------------------------------------
|
|
124
|
-
|
|
125
|
-
/// MomoStepper — quantity +/- control. Layout: [- button] [value] [+ button].
|
|
126
|
-
///
|
|
127
|
-
/// Named `MomoStepper` to avoid shadowing SwiftUI's built-in `Stepper`.
|
|
128
|
-
///
|
|
129
|
-
/// - Parameters:
|
|
130
|
-
/// - value: Binding to the current value. Clamped to `min...max`.
|
|
131
|
-
/// - min: Minimum allowed value (default 0). Minus auto-disables at this bound.
|
|
132
|
-
/// - max: Maximum allowed value (default 100). Plus auto-disables at this bound.
|
|
133
|
-
/// - step: Amount added/subtracted per press (default 1).
|
|
134
|
-
/// - size: Visual size variant (default `.large`).
|
|
135
|
-
/// - disabled: Disable state — `true` for everything, or `StepperDisabled(minus:plus:)`.
|
|
136
|
-
/// - editable: When `true` the number display becomes a keyboard input (default false).
|
|
137
|
-
/// - onValueChange: Callback invoked with the new value on every change.
|
|
138
|
-
public struct MomoStepper: View {
|
|
139
|
-
@Binding private var value: Int
|
|
140
|
-
private let min: Int
|
|
141
|
-
private let max: Int
|
|
142
|
-
private let step: Int
|
|
143
|
-
private let size: StepperSize
|
|
144
|
-
private let disabled: StepperDisabled
|
|
145
|
-
private let editable: Bool
|
|
146
|
-
private let onValueChange: (Int) -> Void
|
|
147
|
-
|
|
148
|
-
@State private var editingText: String = ""
|
|
149
|
-
|
|
150
|
-
public init(
|
|
151
|
-
value: Binding<Int>,
|
|
152
|
-
min: Int = 0,
|
|
153
|
-
max: Int = 100,
|
|
154
|
-
step: Int = 1,
|
|
155
|
-
size: StepperSize = .large,
|
|
156
|
-
disabled: StepperDisabled = false,
|
|
157
|
-
editable: Bool = false,
|
|
158
|
-
onValueChange: @escaping (Int) -> Void = { _ in }
|
|
159
|
-
) {
|
|
160
|
-
self._value = value
|
|
161
|
-
self.min = min
|
|
162
|
-
self.max = max
|
|
163
|
-
self.step = step
|
|
164
|
-
self.size = size
|
|
165
|
-
self.disabled = disabled
|
|
166
|
-
self.editable = editable
|
|
167
|
-
self.onValueChange = onValueChange
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
private func clamp(_ raw: Int) -> Int {
|
|
171
|
-
Swift.max(min, Swift.min(max, raw))
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
private func applyValue(_ raw: Int) {
|
|
175
|
-
let parsed = clamp(raw)
|
|
176
|
-
value = parsed
|
|
177
|
-
editingText = String(parsed)
|
|
178
|
-
onValueChange(parsed)
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
public var body: some View {
|
|
182
|
-
let effectiveMinusDisabled = disabled.minus || value <= min
|
|
183
|
-
let effectivePlusDisabled = disabled.plus || value >= max
|
|
184
|
-
|
|
185
|
-
HStack(spacing: Spacing.S) {
|
|
186
|
-
StepperButton(
|
|
187
|
-
sign: "-",
|
|
188
|
-
size: size,
|
|
189
|
-
disabled: effectiveMinusDisabled,
|
|
190
|
-
onPress: { applyValue(value - step) }
|
|
191
|
-
)
|
|
192
|
-
|
|
193
|
-
StepperNumberView(
|
|
194
|
-
text: Binding(
|
|
195
|
-
get: { editable ? editingText : String(value) },
|
|
196
|
-
set: { newText in
|
|
197
|
-
editingText = newText
|
|
198
|
-
let parsed = Int(newText.filter { $0.isNumber }) ?? 0
|
|
199
|
-
applyValue(parsed)
|
|
200
|
-
}
|
|
201
|
-
),
|
|
202
|
-
size: size,
|
|
203
|
-
disabled: disabled.number,
|
|
204
|
-
editable: editable
|
|
205
|
-
)
|
|
206
|
-
|
|
207
|
-
StepperButton(
|
|
208
|
-
sign: "+",
|
|
209
|
-
size: size,
|
|
210
|
-
disabled: effectivePlusDisabled,
|
|
211
|
-
onPress: { applyValue(value + step) }
|
|
212
|
-
)
|
|
213
|
-
}
|
|
214
|
-
.onAppear {
|
|
215
|
-
let clamped = clamp(value)
|
|
216
|
-
if clamped != value { value = clamped }
|
|
217
|
-
editingText = String(clamped)
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
package/ios/Steps/Steps.swift
DELETED
|
@@ -1,451 +0,0 @@
|
|
|
1
|
-
import SwiftUI
|
|
2
|
-
|
|
3
|
-
// ─── Data model ────────────────────────────────────────────────────────────────
|
|
4
|
-
|
|
5
|
-
/// A single step rendered inside a ``Steps`` indicator.
|
|
6
|
-
public struct StepItem: Identifiable {
|
|
7
|
-
public let id = UUID()
|
|
8
|
-
public let title: String
|
|
9
|
-
public let description: String?
|
|
10
|
-
public let error: Bool
|
|
11
|
-
public let time: String?
|
|
12
|
-
|
|
13
|
-
public init(
|
|
14
|
-
title: String,
|
|
15
|
-
description: String? = nil,
|
|
16
|
-
error: Bool = false,
|
|
17
|
-
time: String? = nil
|
|
18
|
-
) {
|
|
19
|
-
self.title = title
|
|
20
|
-
self.description = description
|
|
21
|
-
self.error = error
|
|
22
|
-
self.time = time
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// ─── Enumerations ──────────────────────────────────────────────────────────────
|
|
27
|
-
|
|
28
|
-
public enum StepsSize {
|
|
29
|
-
case small
|
|
30
|
-
case large
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public enum StepsAlign {
|
|
34
|
-
case left
|
|
35
|
-
case right
|
|
36
|
-
case center
|
|
37
|
-
case stretch
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// ─── Internal status ───────────────────────────────────────────────────────────
|
|
41
|
-
|
|
42
|
-
private enum StepStatus {
|
|
43
|
-
case incomplete
|
|
44
|
-
case current
|
|
45
|
-
case completed
|
|
46
|
-
case error
|
|
47
|
-
case disabled
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
private func resolveStatus(
|
|
51
|
-
activeIndex: Int,
|
|
52
|
-
currentIndex: Int,
|
|
53
|
-
error: Bool,
|
|
54
|
-
disabled: Bool
|
|
55
|
-
) -> StepStatus {
|
|
56
|
-
if disabled { return .disabled }
|
|
57
|
-
if error { return .error }
|
|
58
|
-
if activeIndex == currentIndex { return .current }
|
|
59
|
-
if activeIndex > currentIndex { return .completed }
|
|
60
|
-
return .incomplete
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// ─── Color helpers ─────────────────────────────────────────────────────────────
|
|
64
|
-
|
|
65
|
-
private func resolveIconBgAndBorder(_ status: StepStatus, theme: Theme) -> (bg: Color, border: Color) {
|
|
66
|
-
switch status {
|
|
67
|
-
case .current, .completed:
|
|
68
|
-
return (theme.colors.primary, theme.colors.background.tonal)
|
|
69
|
-
case .error:
|
|
70
|
-
return (theme.colors.error.primary, theme.colors.error.container)
|
|
71
|
-
case .disabled:
|
|
72
|
-
return (Colors.pink08, Colors.pink10)
|
|
73
|
-
case .incomplete:
|
|
74
|
-
return (Colors.black06, theme.colors.border.default)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private func resolveTitleColor(_ status: StepStatus, theme: Theme) -> Color {
|
|
79
|
-
switch status {
|
|
80
|
-
case .current:
|
|
81
|
-
return theme.colors.primary
|
|
82
|
-
case .error:
|
|
83
|
-
return theme.colors.error.primary
|
|
84
|
-
case .disabled:
|
|
85
|
-
return theme.colors.text.disable
|
|
86
|
-
default:
|
|
87
|
-
return theme.colors.text.default
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// ─── Step bubble ───────────────────────────────────────────────────────────────
|
|
92
|
-
|
|
93
|
-
private struct StepBubble: View {
|
|
94
|
-
@Environment(\.appTheme) private var theme
|
|
95
|
-
|
|
96
|
-
let index: Int
|
|
97
|
-
let isActive: Bool
|
|
98
|
-
let error: Bool
|
|
99
|
-
let size: StepsSize
|
|
100
|
-
let status: StepStatus
|
|
101
|
-
let useNumber: Bool
|
|
102
|
-
let customIcon: String?
|
|
103
|
-
|
|
104
|
-
private var bubbleSize: CGFloat { size == .small ? 16 : 24 }
|
|
105
|
-
private var innerSize: CGFloat { size == .small ? 12 : 16 }
|
|
106
|
-
private var dotSize: CGFloat { size == .small ? 6 : 8 }
|
|
107
|
-
|
|
108
|
-
var body: some View {
|
|
109
|
-
let colors = resolveIconBgAndBorder(status, theme: theme)
|
|
110
|
-
ZStack {
|
|
111
|
-
Circle()
|
|
112
|
-
.fill(colors.bg)
|
|
113
|
-
.overlay(Circle().strokeBorder(colors.border, lineWidth: 2))
|
|
114
|
-
|
|
115
|
-
bubbleContent
|
|
116
|
-
}
|
|
117
|
-
.frame(width: bubbleSize, height: bubbleSize)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
@ViewBuilder
|
|
121
|
-
private var bubbleContent: some View {
|
|
122
|
-
if useNumber {
|
|
123
|
-
MomoText(
|
|
124
|
-
"\(index + 1)",
|
|
125
|
-
typography: .headerXsSemibold,
|
|
126
|
-
color: Colors.black01
|
|
127
|
-
)
|
|
128
|
-
} else if isActive {
|
|
129
|
-
if let customIcon = customIcon, !customIcon.isEmpty {
|
|
130
|
-
Icon(source: customIcon, size: innerSize, color: Colors.black01)
|
|
131
|
-
} else {
|
|
132
|
-
Circle()
|
|
133
|
-
.fill(Colors.black01)
|
|
134
|
-
.frame(width: dotSize, height: dotSize)
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
Icon(
|
|
138
|
-
source: error ? "navigation_close" : "notifications_check",
|
|
139
|
-
size: innerSize,
|
|
140
|
-
color: Colors.black01
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// ─── Horizontal layout ─────────────────────────────────────────────────────────
|
|
147
|
-
|
|
148
|
-
private struct StepsHorizontal: View {
|
|
149
|
-
@Environment(\.appTheme) private var theme
|
|
150
|
-
|
|
151
|
-
let steps: [StepItem]
|
|
152
|
-
let activeIndex: Int
|
|
153
|
-
let size: StepsSize
|
|
154
|
-
let useNumber: Bool
|
|
155
|
-
let align: StepsAlign
|
|
156
|
-
let customIcon: String?
|
|
157
|
-
let disabled: Bool
|
|
158
|
-
let onPress: ((StepItem, Int) -> Void)?
|
|
159
|
-
|
|
160
|
-
private var completedLine: Color { theme.colors.primary.opacity(0.2) }
|
|
161
|
-
private var defaultLine: Color { theme.colors.background.default }
|
|
162
|
-
|
|
163
|
-
var body: some View {
|
|
164
|
-
HStack(alignment: .top, spacing: 0) {
|
|
165
|
-
ForEach(Array(steps.enumerated()), id: \.element.id) { index, item in
|
|
166
|
-
column(index: index, item: item)
|
|
167
|
-
.frame(maxWidth: .infinity)
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
.frame(maxWidth: .infinity)
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
@ViewBuilder
|
|
174
|
-
private func column(index: Int, item: StepItem) -> some View {
|
|
175
|
-
let status = resolveStatus(
|
|
176
|
-
activeIndex: activeIndex,
|
|
177
|
-
currentIndex: index,
|
|
178
|
-
error: item.error,
|
|
179
|
-
disabled: disabled
|
|
180
|
-
)
|
|
181
|
-
let isActiveOrError = status == .current || status == .error
|
|
182
|
-
let titleStyle: TypographyStyle = isActiveOrError
|
|
183
|
-
? .headerXsSemibold : .descriptionDefaultRegular
|
|
184
|
-
let descStyle: TypographyStyle = size == .small
|
|
185
|
-
? .descriptionXsRegular : .descriptionDefaultRegular
|
|
186
|
-
let titleColor = resolveTitleColor(status, theme: theme)
|
|
187
|
-
let subColor = disabled ? theme.colors.text.disable : theme.colors.text.hint
|
|
188
|
-
|
|
189
|
-
let colAlignment = horizontalAlignment(for: index)
|
|
190
|
-
let textAlignment = textAlign(for: index)
|
|
191
|
-
|
|
192
|
-
let hideLineLeft = align == .left || (align == .stretch && index == 0)
|
|
193
|
-
let hideLineRight = align == .right || (align == .stretch && index == steps.count - 1)
|
|
194
|
-
|
|
195
|
-
let lineLeft: Color = index == 0
|
|
196
|
-
? Color.clear
|
|
197
|
-
: (activeIndex >= index ? completedLine : defaultLine)
|
|
198
|
-
let lineRight: Color = index == steps.count - 1
|
|
199
|
-
? Color.clear
|
|
200
|
-
: (activeIndex > index ? completedLine : defaultLine)
|
|
201
|
-
|
|
202
|
-
let clickable = status == .completed && onPress != nil && !disabled
|
|
203
|
-
|
|
204
|
-
VStack(alignment: colAlignment, spacing: 0) {
|
|
205
|
-
if let time = item.time, !time.isEmpty {
|
|
206
|
-
MomoText(time, typography: .descriptionXsRegular, color: subColor)
|
|
207
|
-
.multilineTextAlignment(textAlignment)
|
|
208
|
-
.frame(maxWidth: .infinity, alignment: frameAlignment(colAlignment))
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
HStack(spacing: 0) {
|
|
212
|
-
if !hideLineLeft {
|
|
213
|
-
lineLeft
|
|
214
|
-
.frame(height: 2)
|
|
215
|
-
.frame(maxWidth: .infinity)
|
|
216
|
-
.clipShape(RoundedCorner(radius: Radius.XS, corners: [.topRight, .bottomRight]))
|
|
217
|
-
}
|
|
218
|
-
StepBubble(
|
|
219
|
-
index: index,
|
|
220
|
-
isActive: activeIndex == index,
|
|
221
|
-
error: item.error,
|
|
222
|
-
size: size,
|
|
223
|
-
status: status,
|
|
224
|
-
useNumber: useNumber,
|
|
225
|
-
customIcon: customIcon
|
|
226
|
-
)
|
|
227
|
-
.padding(.leading, hideLineLeft ? 0 : Spacing.XS)
|
|
228
|
-
.padding(.trailing, hideLineRight ? 0 : Spacing.XS)
|
|
229
|
-
.padding(.vertical, Spacing.XS)
|
|
230
|
-
if !hideLineRight {
|
|
231
|
-
lineRight
|
|
232
|
-
.frame(height: 2)
|
|
233
|
-
.frame(maxWidth: .infinity)
|
|
234
|
-
.clipShape(RoundedCorner(radius: Radius.XS, corners: [.topLeft, .bottomLeft]))
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
.frame(maxWidth: .infinity)
|
|
238
|
-
|
|
239
|
-
if !item.title.isEmpty {
|
|
240
|
-
MomoText(item.title, typography: titleStyle, color: titleColor)
|
|
241
|
-
.multilineTextAlignment(textAlignment)
|
|
242
|
-
.frame(maxWidth: .infinity, alignment: frameAlignment(colAlignment))
|
|
243
|
-
.padding(.bottom, Spacing.XXS)
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if let desc = item.description, !desc.isEmpty {
|
|
247
|
-
MomoText(desc, typography: descStyle, color: subColor)
|
|
248
|
-
.multilineTextAlignment(textAlignment)
|
|
249
|
-
.frame(maxWidth: .infinity, alignment: frameAlignment(colAlignment))
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
.contentShape(Rectangle())
|
|
253
|
-
.onTapGesture {
|
|
254
|
-
if clickable { onPress?(item, index) }
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
private func horizontalAlignment(for index: Int) -> HorizontalAlignment {
|
|
259
|
-
switch align {
|
|
260
|
-
case .left: return .leading
|
|
261
|
-
case .right: return .trailing
|
|
262
|
-
case .center: return .center
|
|
263
|
-
case .stretch:
|
|
264
|
-
if index == 0 { return .leading }
|
|
265
|
-
if index == steps.count - 1 { return .trailing }
|
|
266
|
-
return .center
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
private func textAlign(for index: Int) -> TextAlignment {
|
|
271
|
-
switch align {
|
|
272
|
-
case .left: return .leading
|
|
273
|
-
case .right: return .trailing
|
|
274
|
-
case .center: return .center
|
|
275
|
-
case .stretch:
|
|
276
|
-
if index == 0 { return .leading }
|
|
277
|
-
if index == steps.count - 1 { return .trailing }
|
|
278
|
-
return .center
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
private func frameAlignment(_ h: HorizontalAlignment) -> Alignment {
|
|
283
|
-
switch h {
|
|
284
|
-
case .leading: return .leading
|
|
285
|
-
case .trailing: return .trailing
|
|
286
|
-
default: return .center
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
// ─── Vertical layout ───────────────────────────────────────────────────────────
|
|
292
|
-
|
|
293
|
-
private struct StepsVertical: View {
|
|
294
|
-
@Environment(\.appTheme) private var theme
|
|
295
|
-
|
|
296
|
-
let steps: [StepItem]
|
|
297
|
-
let activeIndex: Int
|
|
298
|
-
let size: StepsSize
|
|
299
|
-
let useNumber: Bool
|
|
300
|
-
let customIcon: String?
|
|
301
|
-
let disabled: Bool
|
|
302
|
-
let onPress: ((StepItem, Int) -> Void)?
|
|
303
|
-
|
|
304
|
-
private var completedLine: Color { theme.colors.primary.opacity(0.2) }
|
|
305
|
-
private var defaultLine: Color { theme.colors.background.default }
|
|
306
|
-
private var useSmall: Bool { size == .small }
|
|
307
|
-
private var connectorHeight: CGFloat { useSmall ? 24 : 32 }
|
|
308
|
-
|
|
309
|
-
var body: some View {
|
|
310
|
-
VStack(spacing: 0) {
|
|
311
|
-
ForEach(Array(steps.enumerated()), id: \.element.id) { index, item in
|
|
312
|
-
row(index: index, item: item)
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
.frame(maxWidth: .infinity)
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
@ViewBuilder
|
|
319
|
-
private func row(index: Int, item: StepItem) -> some View {
|
|
320
|
-
let status = resolveStatus(
|
|
321
|
-
activeIndex: activeIndex,
|
|
322
|
-
currentIndex: index,
|
|
323
|
-
error: item.error,
|
|
324
|
-
disabled: disabled
|
|
325
|
-
)
|
|
326
|
-
let isActiveOrError = status == .current || status == .error
|
|
327
|
-
let isLast = index == steps.count - 1
|
|
328
|
-
|
|
329
|
-
let titleStyle: TypographyStyle = isActiveOrError
|
|
330
|
-
? (useSmall ? .headerXsSemibold : .headerSSemibold)
|
|
331
|
-
: (useSmall ? .descriptionDefaultRegular : .bodyDefaultRegular)
|
|
332
|
-
let descStyle: TypographyStyle = useSmall
|
|
333
|
-
? .descriptionXsRegular : .descriptionDefaultRegular
|
|
334
|
-
|
|
335
|
-
let titleColor = resolveTitleColor(status, theme: theme)
|
|
336
|
-
let subColor = disabled ? theme.colors.text.disable : theme.colors.text.hint
|
|
337
|
-
let lineColor = activeIndex > index ? completedLine : defaultLine
|
|
338
|
-
|
|
339
|
-
let clickable = status == .completed && onPress != nil && !disabled
|
|
340
|
-
|
|
341
|
-
HStack(alignment: .top, spacing: 0) {
|
|
342
|
-
VStack(spacing: 0) {
|
|
343
|
-
StepBubble(
|
|
344
|
-
index: index,
|
|
345
|
-
isActive: activeIndex == index,
|
|
346
|
-
error: item.error,
|
|
347
|
-
size: size,
|
|
348
|
-
status: status,
|
|
349
|
-
useNumber: useNumber,
|
|
350
|
-
customIcon: customIcon
|
|
351
|
-
)
|
|
352
|
-
if !isLast {
|
|
353
|
-
lineColor
|
|
354
|
-
.frame(width: 2, height: connectorHeight)
|
|
355
|
-
.padding(.vertical, Spacing.XS)
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
.padding(.trailing, Spacing.M)
|
|
359
|
-
|
|
360
|
-
VStack(alignment: .leading, spacing: 0) {
|
|
361
|
-
HStack(alignment: .top, spacing: 0) {
|
|
362
|
-
MomoText(item.title, typography: titleStyle, color: titleColor)
|
|
363
|
-
.lineLimit(2)
|
|
364
|
-
.frame(maxWidth: .infinity, alignment: .leading)
|
|
365
|
-
.padding(.trailing, Spacing.S)
|
|
366
|
-
if let time = item.time, !time.isEmpty {
|
|
367
|
-
MomoText(time, typography: .descriptionXsRegular, color: subColor)
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
.frame(maxWidth: .infinity)
|
|
371
|
-
|
|
372
|
-
if let desc = item.description, !desc.isEmpty {
|
|
373
|
-
MomoText(desc, typography: descStyle, color: subColor)
|
|
374
|
-
.frame(maxWidth: .infinity, alignment: .leading)
|
|
375
|
-
.padding(.top, Spacing.XXS)
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
.frame(maxWidth: .infinity)
|
|
379
|
-
.padding(.bottom, isLast ? 0 : Spacing.S)
|
|
380
|
-
}
|
|
381
|
-
.frame(maxWidth: .infinity)
|
|
382
|
-
.contentShape(Rectangle())
|
|
383
|
-
.onTapGesture {
|
|
384
|
-
if clickable { onPress?(item, index) }
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// ─── Public API ────────────────────────────────────────────────────────────────
|
|
390
|
-
|
|
391
|
-
/// Steps — guided progress indicator through a sequence of procedural steps.
|
|
392
|
-
///
|
|
393
|
-
/// Mirrors the Compose `Steps` component.
|
|
394
|
-
public struct Steps: View {
|
|
395
|
-
private let steps: [StepItem]
|
|
396
|
-
private let activeIndex: Int
|
|
397
|
-
private let horizontal: Bool
|
|
398
|
-
private let size: StepsSize
|
|
399
|
-
private let useNumber: Bool
|
|
400
|
-
private let align: StepsAlign
|
|
401
|
-
private let customIcon: String?
|
|
402
|
-
private let disabled: Bool
|
|
403
|
-
private let onPress: ((StepItem, Int) -> Void)?
|
|
404
|
-
|
|
405
|
-
public init(
|
|
406
|
-
steps: [StepItem],
|
|
407
|
-
activeIndex: Int,
|
|
408
|
-
horizontal: Bool = false,
|
|
409
|
-
size: StepsSize = .large,
|
|
410
|
-
useNumber: Bool = false,
|
|
411
|
-
align: StepsAlign = .center,
|
|
412
|
-
customIcon: String? = nil,
|
|
413
|
-
disabled: Bool = false,
|
|
414
|
-
onPress: ((StepItem, Int) -> Void)? = nil
|
|
415
|
-
) {
|
|
416
|
-
self.steps = steps
|
|
417
|
-
self.activeIndex = activeIndex
|
|
418
|
-
self.horizontal = horizontal
|
|
419
|
-
self.size = size
|
|
420
|
-
self.useNumber = useNumber
|
|
421
|
-
self.align = align
|
|
422
|
-
self.customIcon = customIcon
|
|
423
|
-
self.disabled = disabled
|
|
424
|
-
self.onPress = onPress
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
public var body: some View {
|
|
428
|
-
if horizontal {
|
|
429
|
-
StepsHorizontal(
|
|
430
|
-
steps: steps,
|
|
431
|
-
activeIndex: activeIndex,
|
|
432
|
-
size: size,
|
|
433
|
-
useNumber: useNumber,
|
|
434
|
-
align: align,
|
|
435
|
-
customIcon: customIcon,
|
|
436
|
-
disabled: disabled,
|
|
437
|
-
onPress: onPress
|
|
438
|
-
)
|
|
439
|
-
} else {
|
|
440
|
-
StepsVertical(
|
|
441
|
-
steps: steps,
|
|
442
|
-
activeIndex: activeIndex,
|
|
443
|
-
size: size,
|
|
444
|
-
useNumber: useNumber,
|
|
445
|
-
customIcon: customIcon,
|
|
446
|
-
disabled: disabled,
|
|
447
|
-
onPress: onPress
|
|
448
|
-
)
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|