@momo-kits/native-kits 0.162.30 → 0.162.31-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 +19 -0
- 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 +103 -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 +589 -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 +14 -6
- package/ios/Application/LanguageSource.swift +93 -0
- package/ios/Application/Localize.swift +73 -4
- package/ios/Application/LocalizeModifier.swift +30 -0
- package/ios/Application/Navigation/NavigationContainer.swift +28 -18
- package/ios/Application/Navigation/Navigator.swift +121 -53
- package/ios/Application/Navigation/NavigatorManager.swift +49 -0
- package/ios/Application/Navigation/component/NavigationFooter.swift +90 -0
- package/ios/Application/StackScreen.swift +19 -28
- package/ios/Badge/Badge.swift +2 -1
- package/ios/Badge/BadgeRibbon.swift +6 -2
- package/ios/Button/Button.swift +41 -61
- package/ios/Chip/Chip.swift +6 -5
- package/ios/Icon/Icon.swift +13 -4
- package/ios/Input/ErrorView.swift +2 -1
- package/ios/Input/Input.swift +9 -2
- package/ios/Input/InputPhoneNumber.swift +2 -1
- package/ios/Input/InputSearch.swift +3 -2
- package/ios/Input/InputTextArea.swift +6 -1
- package/ios/InputMoney/InputMoney.swift +5 -2
- package/ios/InputOTP/InputOTP.swift +2 -1
- package/ios/Layout/GridContext.swift +30 -0
- package/ios/Layout/Item.swift +42 -0
- package/ios/Layout/Section.swift +134 -0
- package/ios/Popup/PopupNotify.swift +2 -1
- package/ios/ProgressInfo/ProgressInfo.swift +4 -3
- package/ios/Rating/Rating.swift +2 -1
- package/ios/Stepper/Stepper.swift +2 -1
- package/ios/SuggestAction/SuggestAction.swift +3 -2
- package/ios/Tag/Tag.swift +2 -1
- package/ios/Template/TrustBanner/TrustBanner.swift +4 -2
- package/ios/Title/Title.swift +3 -2
- package/ios/Tooltip/Tooltip.swift +2 -1
- package/ios/Typography/FontScale.swift +103 -0
- package/ios/Typography/FontScaleStore.swift +52 -13
- package/ios/Typography/Text.swift +12 -29
- package/ios/Typography/Typography.swift +66 -86
- package/ios/native-kits.podspec +2 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/README.md +120 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +87 -73
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +55 -249
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +90 -82
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +74 -104
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +47 -50
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +63 -7
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +90 -81
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +73 -97
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DemoScreen.swift +420 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +46 -4
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +54 -57
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +80 -45
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconDemo.swift +81 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +49 -62
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +66 -116
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +104 -98
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +76 -118
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +73 -86
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +69 -54
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +74 -54
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +73 -20
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +68 -38
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +55 -52
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +51 -4
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +14 -2
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +47 -51
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PlaygroundData.swift +76 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +67 -93
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +34 -43
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +83 -71
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +55 -23
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +58 -46
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SectionDemo.swift +83 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +41 -12
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +67 -127
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +54 -110
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +69 -79
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +78 -58
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +76 -65
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +82 -127
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +44 -19
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +92 -168
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +79 -27
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +0 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +87 -92
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +94 -163
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +70 -70
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +68 -114
- package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +3 -1
- package/package.json +2 -2
- package/settings.gradle.kts +64 -0
|
@@ -2,186 +2,117 @@
|
|
|
2
2
|
// TooltipDemo.swift
|
|
3
3
|
// Example
|
|
4
4
|
//
|
|
5
|
+
// Preview + Playground demo (mirrors the Compose DemoScreen pattern).
|
|
6
|
+
//
|
|
5
7
|
|
|
6
|
-
import Foundation
|
|
7
8
|
import MoMoUIKits
|
|
8
9
|
import SwiftUI
|
|
9
10
|
|
|
10
|
-
// MARK: - TooltipDemo
|
|
11
|
-
|
|
12
11
|
struct TooltipDemo: View {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@StateObject private var centerState = TooltipState()
|
|
22
|
-
@StateObject private var endState = TooltipState()
|
|
12
|
+
var body: some View {
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
DemoScreen(preview: { TooltipPreview() }, playground: { TooltipPlayground() })
|
|
15
|
+
} else {
|
|
16
|
+
Text("Requires iOS 16+").padding()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
@StateObject private var singleBtnState = TooltipState()
|
|
26
|
-
@StateObject private var twoBtnState = TooltipState()
|
|
21
|
+
// MARK: - Preview
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
private struct TooltipPreview: View {
|
|
24
|
+
@StateObject private var topState = TooltipState()
|
|
25
|
+
@StateObject private var bottomState = TooltipState()
|
|
26
|
+
@StateObject private var btnState = TooltipState()
|
|
29
27
|
@StateObject private var descState = TooltipState()
|
|
30
28
|
|
|
31
29
|
var body: some View {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
HStack {
|
|
58
|
-
Tooltip(
|
|
59
|
-
state: rightState,
|
|
60
|
-
title: "Right",
|
|
61
|
-
description: "Tooltip on the right.",
|
|
62
|
-
placement: .right,
|
|
63
|
-
onPressClose: { rightState.hide() }
|
|
64
|
-
) {
|
|
65
|
-
Button(title: "Right", action: { rightState.toggle() }, size: .small, isFull: false)
|
|
66
|
-
}
|
|
67
|
-
Spacer().frame(width: 12)
|
|
68
|
-
Tooltip(
|
|
69
|
-
state: leftState,
|
|
70
|
-
title: "Left",
|
|
71
|
-
description: "Tooltip on the left.",
|
|
72
|
-
placement: .left,
|
|
73
|
-
onPressClose: { leftState.hide() }
|
|
74
|
-
) {
|
|
75
|
-
Button(title: "Left", action: { leftState.toggle() }, size: .small, isFull: false)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// MARK: - Alignment
|
|
81
|
-
|
|
82
|
-
section("Alignment") {
|
|
83
|
-
Tooltip(
|
|
84
|
-
state: startState,
|
|
85
|
-
title: "Start",
|
|
86
|
-
description: "Aligned to start.",
|
|
87
|
-
placement: .bottom,
|
|
88
|
-
align: .start,
|
|
89
|
-
onPressClose: { startState.hide() }
|
|
90
|
-
) {
|
|
91
|
-
Button(title: "Start", action: { startState.toggle() }, size: .small, isFull: false)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
Tooltip(
|
|
95
|
-
state: centerState,
|
|
96
|
-
title: "Center",
|
|
97
|
-
description: "Aligned to center.",
|
|
98
|
-
placement: .bottom,
|
|
99
|
-
align: .center,
|
|
100
|
-
onPressClose: { centerState.hide() }
|
|
101
|
-
) {
|
|
102
|
-
Button(title: "Center", action: { centerState.toggle() }, size: .small, isFull: false)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
Tooltip(
|
|
106
|
-
state: endState,
|
|
107
|
-
title: "End",
|
|
108
|
-
description: "Aligned to end.",
|
|
109
|
-
placement: .bottom,
|
|
110
|
-
align: .end,
|
|
111
|
-
onPressClose: { endState.hide() }
|
|
112
|
-
) {
|
|
113
|
-
Button(title: "End", action: { endState.toggle() }, size: .small, isFull: false)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// MARK: - With Buttons
|
|
118
|
-
|
|
119
|
-
section("With Buttons") {
|
|
120
|
-
Tooltip(
|
|
121
|
-
state: singleBtnState,
|
|
122
|
-
title: "Single Button",
|
|
123
|
-
description: "Tooltip with one action button.",
|
|
124
|
-
buttons: [
|
|
125
|
-
TooltipButton(title: "Got it", onPress: { singleBtnState.hide() })
|
|
126
|
-
],
|
|
127
|
-
placement: .bottom,
|
|
128
|
-
onPressClose: { singleBtnState.hide() }
|
|
129
|
-
) {
|
|
130
|
-
Button(title: "1 Button", action: { singleBtnState.toggle() }, size: .small, isFull: false)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
Tooltip(
|
|
134
|
-
state: twoBtnState,
|
|
135
|
-
title: "Two Buttons",
|
|
136
|
-
description: "Tooltip with primary and secondary actions.",
|
|
137
|
-
buttons: [
|
|
138
|
-
TooltipButton(title: "Confirm", onPress: { twoBtnState.hide() }),
|
|
139
|
-
TooltipButton(title: "Cancel", onPress: { twoBtnState.hide() })
|
|
140
|
-
],
|
|
141
|
-
placement: .bottom,
|
|
142
|
-
onPressClose: { twoBtnState.hide() }
|
|
143
|
-
) {
|
|
144
|
-
Button(title: "2 Buttons", action: { twoBtnState.toggle() }, size: .small, isFull: false)
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// MARK: - Description Only
|
|
149
|
-
|
|
150
|
-
section("Description Only") {
|
|
151
|
-
Tooltip(
|
|
152
|
-
state: descState,
|
|
153
|
-
description: "This tooltip has no title, just a description.",
|
|
154
|
-
placement: .top,
|
|
155
|
-
onPressClose: { descState.hide() }
|
|
156
|
-
) {
|
|
157
|
-
Button(title: "No Title", action: { descState.toggle() }, size: .small, isFull: false)
|
|
158
|
-
}
|
|
159
|
-
}
|
|
30
|
+
BasicColumnBox("Placement", alignment: .leading) {
|
|
31
|
+
Tooltip(state: topState, title: "Top", description: "Tooltip on top of the anchor.",
|
|
32
|
+
placement: .top, onPressClose: { topState.hide() }) {
|
|
33
|
+
MoMoUIKits.Button(title: "Top", action: { topState.toggle() }, size: .small, isFull: false)
|
|
34
|
+
}
|
|
35
|
+
Tooltip(state: bottomState, title: "Bottom", description: "Tooltip below the anchor.",
|
|
36
|
+
placement: .bottom, onPressClose: { bottomState.hide() }) {
|
|
37
|
+
MoMoUIKits.Button(title: "Bottom", action: { bottomState.toggle() }, size: .small, isFull: false)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
BasicColumnBox("With Buttons", alignment: .leading) {
|
|
41
|
+
Tooltip(state: btnState, title: "Two Buttons",
|
|
42
|
+
description: "Tooltip with primary and secondary actions.",
|
|
43
|
+
buttons: [
|
|
44
|
+
TooltipButton(title: "Confirm", onPress: { btnState.hide() }),
|
|
45
|
+
TooltipButton(title: "Cancel", onPress: { btnState.hide() }),
|
|
46
|
+
],
|
|
47
|
+
placement: .bottom, onPressClose: { btnState.hide() }) {
|
|
48
|
+
MoMoUIKits.Button(title: "2 Buttons", action: { btnState.toggle() }, size: .small, isFull: false)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
BasicColumnBox("Description Only", alignment: .leading) {
|
|
52
|
+
Tooltip(state: descState, description: "This tooltip has no title, just a description.",
|
|
53
|
+
placement: .top, onPressClose: { descState.hide() }) {
|
|
54
|
+
MoMoUIKits.Button(title: "No Title", action: { descState.toggle() }, size: .small, isFull: false)
|
|
160
55
|
}
|
|
161
|
-
.padding(.vertical, 48)
|
|
162
|
-
.padding(.horizontal, 16)
|
|
163
56
|
}
|
|
164
57
|
}
|
|
58
|
+
}
|
|
165
59
|
|
|
166
|
-
|
|
60
|
+
// MARK: - Playground
|
|
61
|
+
|
|
62
|
+
// String-keyed so the demo doesn't depend on the exact enum type name;
|
|
63
|
+
// the literal cases below are resolved against Tooltip's own parameter types.
|
|
64
|
+
private let tooltipPlacementList: [PlaygroundOption] = [
|
|
65
|
+
.init("top", "top"), .init("bottom", "bottom"), .init("left", "left"), .init("right", "right"),
|
|
66
|
+
]
|
|
67
|
+
private let tooltipAlignList: [PlaygroundOption] = [
|
|
68
|
+
.init("start", "start"), .init("center", "center"), .init("end", "end"),
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
@available(iOS 16.0, *)
|
|
72
|
+
private struct TooltipPlayground: View {
|
|
73
|
+
@StateObject private var state = TooltipState()
|
|
74
|
+
@State private var title = "Tooltip"
|
|
75
|
+
@State private var desc = "This is a tooltip description."
|
|
76
|
+
@State private var placement: PlaygroundOption? = tooltipPlacementList.first { $0.key == "bottom" }
|
|
77
|
+
@State private var align: PlaygroundOption? = tooltipAlignList.first { $0.key == "center" }
|
|
167
78
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
79
|
+
var body: some View {
|
|
80
|
+
PlaygroundTab(
|
|
81
|
+
component: {
|
|
82
|
+
Tooltip(
|
|
83
|
+
state: state,
|
|
84
|
+
title: title,
|
|
85
|
+
description: desc,
|
|
86
|
+
placement: placementCase,
|
|
87
|
+
align: alignCase,
|
|
88
|
+
onPressClose: { state.hide() }
|
|
89
|
+
) {
|
|
90
|
+
MoMoUIKits.Button(title: "Show tooltip", action: { state.toggle() }, size: .small, isFull: false)
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
params: [
|
|
94
|
+
.string("Title", $title),
|
|
95
|
+
.string("Description", $desc),
|
|
96
|
+
.radio("Placement", tooltipPlacementList, $placement),
|
|
97
|
+
.radio("Align", tooltipAlignList, $align),
|
|
98
|
+
]
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private var placementCase: TooltipPlacement {
|
|
103
|
+
switch placement?.key {
|
|
104
|
+
case "top": return .top
|
|
105
|
+
case "left": return .left
|
|
106
|
+
case "right": return .right
|
|
107
|
+
default: return .bottom
|
|
177
108
|
}
|
|
178
109
|
}
|
|
179
|
-
}
|
|
180
110
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
111
|
+
private var alignCase: TooltipAlign {
|
|
112
|
+
switch align?.key {
|
|
113
|
+
case "start": return .start
|
|
114
|
+
case "end": return .end
|
|
115
|
+
default: return .center
|
|
116
|
+
}
|
|
185
117
|
}
|
|
186
118
|
}
|
|
187
|
-
#endif
|
|
@@ -2,86 +2,86 @@
|
|
|
2
2
|
// TypographyDemo.swift
|
|
3
3
|
// Example
|
|
4
4
|
//
|
|
5
|
-
//
|
|
5
|
+
// Preview + Playground demo for the Text (MomoText) component (DemoScreen pattern).
|
|
6
6
|
//
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
private let typographyList: [PlaygroundOption] = [
|
|
12
|
+
.init("headlineDefaultBold", TypographyStyle.headlineDefaultBold),
|
|
13
|
+
.init("headerMBold", TypographyStyle.headerMBold),
|
|
14
|
+
.init("headerDefaultBold", TypographyStyle.headerDefaultBold),
|
|
15
|
+
.init("headerSSemibold", TypographyStyle.headerSSemibold),
|
|
16
|
+
.init("headerXsSemibold", TypographyStyle.headerXsSemibold),
|
|
17
|
+
.init("bodyDefaultRegular", TypographyStyle.bodyDefaultRegular),
|
|
18
|
+
.init("descriptionDefaultRegular", TypographyStyle.descriptionDefaultRegular),
|
|
19
|
+
.init("descriptionXsRegular", TypographyStyle.descriptionXsRegular),
|
|
20
|
+
.init("labelDefaultMedium", TypographyStyle.labelDefaultMedium),
|
|
21
|
+
.init("labelSMedium", TypographyStyle.labelSMedium),
|
|
22
|
+
.init("labelXsMedium", TypographyStyle.labelXsMedium),
|
|
23
|
+
.init("actionDefaultBold", TypographyStyle.actionDefaultBold),
|
|
24
|
+
.init("actionSBold", TypographyStyle.actionSBold),
|
|
25
|
+
.init("actionXsBold", TypographyStyle.actionXsBold),
|
|
26
|
+
.init("actionXxsBold", TypographyStyle.actionXxsBold),
|
|
27
|
+
]
|
|
9
28
|
|
|
10
29
|
struct TypographyDemo: View {
|
|
11
30
|
var body: some View {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.background(Color.red.opacity(0.3))
|
|
17
|
-
.cornerRadius(4)
|
|
18
|
-
MomoText("Header M Bold", typography: .headerMBold)
|
|
19
|
-
.background(Color.orange.opacity(0.3))
|
|
20
|
-
.cornerRadius(4)
|
|
21
|
-
MomoText("Header Default Bold", typography: .headerDefaultBold)
|
|
22
|
-
.background(Color.yellow.opacity(0.3))
|
|
23
|
-
.cornerRadius(4)
|
|
24
|
-
MomoText("Header S Semibold", typography: .headerSSemibold)
|
|
25
|
-
.background(Color.green.opacity(0.3))
|
|
26
|
-
.cornerRadius(4)
|
|
27
|
-
MomoText("Header XS Semibold", typography: .headerXsSemibold)
|
|
28
|
-
.background(Color.blue.opacity(0.3))
|
|
29
|
-
.cornerRadius(4)
|
|
30
|
-
|
|
31
|
-
Divider().padding(.vertical, 8)
|
|
32
|
-
|
|
33
|
-
// Body Default Regular
|
|
34
|
-
MomoText("Body Default Regular", typography: .bodyDefaultRegular)
|
|
35
|
-
.background(Color.purple.opacity(0.3))
|
|
36
|
-
.cornerRadius(4)
|
|
37
|
-
MomoText("Description Default Regular", typography: .descriptionDefaultRegular)
|
|
38
|
-
.background(Color.pink.opacity(0.3))
|
|
39
|
-
.cornerRadius(4)
|
|
40
|
-
MomoText("Description XS Regular", typography: .descriptionXsRegular)
|
|
41
|
-
.background(Color.gray.opacity(0.3))
|
|
42
|
-
.cornerRadius(4)
|
|
43
|
-
|
|
44
|
-
Divider().padding(.vertical, 8)
|
|
45
|
-
|
|
46
|
-
// Label Default Medium
|
|
47
|
-
MomoText("Label Default Medium", typography: .labelDefaultMedium)
|
|
48
|
-
.background(Color.red.opacity(0.3))
|
|
49
|
-
.cornerRadius(4)
|
|
50
|
-
MomoText("Label S Medium", typography: .labelSMedium)
|
|
51
|
-
.background(Color.orange.opacity(0.3))
|
|
52
|
-
.cornerRadius(4)
|
|
53
|
-
MomoText("Label XS Medium", typography: .labelXsMedium)
|
|
54
|
-
.background(Color.yellow.opacity(0.3))
|
|
55
|
-
.cornerRadius(4)
|
|
56
|
-
|
|
57
|
-
Divider().padding(.vertical, 8)
|
|
58
|
-
|
|
59
|
-
// Action Default Bold
|
|
60
|
-
MomoText("Action Default Bold", typography: .actionDefaultBold)
|
|
61
|
-
.background(Color.green.opacity(0.3))
|
|
62
|
-
.cornerRadius(4)
|
|
63
|
-
MomoText("Action S Bold", typography: .actionSBold)
|
|
64
|
-
.background(Color.blue.opacity(0.3))
|
|
65
|
-
.cornerRadius(4)
|
|
66
|
-
MomoText("Action XS Bold", typography: .actionXsBold)
|
|
67
|
-
.background(Color.purple.opacity(0.3))
|
|
68
|
-
.cornerRadius(4)
|
|
69
|
-
MomoText("Action XXS Bold", typography: .actionXxsBold)
|
|
70
|
-
.background(Color.pink.opacity(0.3))
|
|
71
|
-
.cornerRadius(4)
|
|
72
|
-
|
|
73
|
-
Divider().padding(.vertical, 16)
|
|
74
|
-
}
|
|
75
|
-
.padding(16)
|
|
31
|
+
if #available(iOS 16.0, *) {
|
|
32
|
+
DemoScreen(preview: { TypographyPreview() }, playground: { TypographyPlayground() })
|
|
33
|
+
} else {
|
|
34
|
+
Text("Requires iOS 16+").padding()
|
|
76
35
|
}
|
|
77
36
|
}
|
|
78
37
|
}
|
|
79
38
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
39
|
+
// MARK: - Preview
|
|
40
|
+
|
|
41
|
+
private struct TypographyPreview: View {
|
|
42
|
+
var body: some View {
|
|
43
|
+
BasicColumnBox("Headers", alignment: .leading) {
|
|
44
|
+
MomoText("Headline Default Bold", typography: .headlineDefaultBold)
|
|
45
|
+
MomoText("Header M Bold", typography: .headerMBold)
|
|
46
|
+
MomoText("Header Default Bold", typography: .headerDefaultBold)
|
|
47
|
+
MomoText("Header S Semibold", typography: .headerSSemibold)
|
|
48
|
+
MomoText("Header XS Semibold", typography: .headerXsSemibold)
|
|
49
|
+
}
|
|
50
|
+
BasicColumnBox("Body & Description", alignment: .leading) {
|
|
51
|
+
MomoText("Body Default Regular", typography: .bodyDefaultRegular)
|
|
52
|
+
MomoText("Description Default Regular", typography: .descriptionDefaultRegular)
|
|
53
|
+
MomoText("Description XS Regular", typography: .descriptionXsRegular)
|
|
54
|
+
}
|
|
55
|
+
BasicColumnBox("Labels", alignment: .leading) {
|
|
56
|
+
MomoText("Label Default Medium", typography: .labelDefaultMedium)
|
|
57
|
+
MomoText("Label S Medium", typography: .labelSMedium)
|
|
58
|
+
MomoText("Label XS Medium", typography: .labelXsMedium)
|
|
59
|
+
}
|
|
60
|
+
BasicColumnBox("Actions", alignment: .leading) {
|
|
61
|
+
MomoText("Action Default Bold", typography: .actionDefaultBold)
|
|
62
|
+
MomoText("Action S Bold", typography: .actionSBold)
|
|
63
|
+
MomoText("Action XS Bold", typography: .actionXsBold)
|
|
64
|
+
MomoText("Action XXS Bold", typography: .actionXxsBold)
|
|
84
65
|
}
|
|
85
66
|
}
|
|
86
67
|
}
|
|
87
68
|
|
|
69
|
+
// MARK: - Playground
|
|
70
|
+
|
|
71
|
+
@available(iOS 16.0, *)
|
|
72
|
+
private struct TypographyPlayground: View {
|
|
73
|
+
@State private var text = "The quick brown fox"
|
|
74
|
+
@State private var typography: PlaygroundOption? = typographyList.first { $0.key == "bodyDefaultRegular" }
|
|
75
|
+
|
|
76
|
+
var body: some View {
|
|
77
|
+
PlaygroundTab(
|
|
78
|
+
component: {
|
|
79
|
+
MomoText(text, typography: (typography?.value as? TypographyStyle) ?? .bodyDefaultRegular)
|
|
80
|
+
},
|
|
81
|
+
params: [
|
|
82
|
+
.string("Text", $text),
|
|
83
|
+
.radio("Typography", typographyList, $typography),
|
|
84
|
+
]
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -2,130 +2,84 @@
|
|
|
2
2
|
// UploaderDemo.swift
|
|
3
3
|
// Example
|
|
4
4
|
//
|
|
5
|
+
// Preview + Playground demo, mirroring Compose's UploaderUsage.kt.
|
|
6
|
+
//
|
|
5
7
|
|
|
6
|
-
import SwiftUI
|
|
7
8
|
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
private let uploaderMockURL = "https://static.momocdn.net/app/img/kits/navigation-bar.png"
|
|
8
12
|
|
|
9
13
|
struct UploaderDemo: View {
|
|
10
|
-
|
|
14
|
+
var body: some View {
|
|
15
|
+
if #available(iOS 16.0, *) {
|
|
16
|
+
DemoScreen(preview: { UploaderPreview() }, playground: { UploaderPlayground() })
|
|
17
|
+
} else {
|
|
18
|
+
Text("Requires iOS 16+").padding()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// MARK: - Preview
|
|
11
24
|
|
|
12
|
-
|
|
13
|
-
|
|
25
|
+
private struct UploaderPreview: View {
|
|
26
|
+
var body: some View {
|
|
27
|
+
BasicColumnBox("Default — single slot, no images", alignment: .leading) {
|
|
28
|
+
Uploader(images: [], numberOfImages: 1, onAdd: {})
|
|
29
|
+
}
|
|
30
|
+
BasicColumnBox("With image + cancel button", alignment: .leading) {
|
|
31
|
+
Uploader(images: [UploadImage(uri: uploaderMockURL)], numberOfImages: 3, onAdd: {}, onCancel: { _, _ in })
|
|
32
|
+
}
|
|
33
|
+
BasicColumnBox("Multiple images (slot full)", alignment: .leading) {
|
|
34
|
+
Uploader(
|
|
35
|
+
images: [UploadImage(uri: uploaderMockURL), UploadImage(uri: uploaderMockURL), UploadImage(uri: uploaderMockURL)],
|
|
36
|
+
numberOfImages: 3, onAdd: {}, onCancel: { _, _ in }
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
BasicColumnBox("Loading state", alignment: .leading) {
|
|
40
|
+
Uploader(images: [UploadImage(uri: uploaderMockURL, loading: true)], numberOfImages: 3, onAdd: {}, onCancel: { _, _ in })
|
|
41
|
+
}
|
|
42
|
+
BasicColumnBox("Disabled", alignment: .leading) {
|
|
43
|
+
Uploader(images: [], numberOfImages: 1, disabled: true, onAdd: {})
|
|
44
|
+
}
|
|
45
|
+
BasicColumnBox("Custom size (80 x 80)", alignment: .leading) {
|
|
46
|
+
Uploader(images: [UploadImage(uri: uploaderMockURL)], numberOfImages: 3, width: 80, height: 80, onAdd: {}, onCancel: { _, _ in })
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// MARK: - Playground
|
|
52
|
+
|
|
53
|
+
@available(iOS 16.0, *)
|
|
54
|
+
private struct UploaderPlayground: View {
|
|
55
|
+
@State private var images: [UploadImage] = []
|
|
14
56
|
@State private var numberOfImages: Double = 3
|
|
15
57
|
@State private var disabled = false
|
|
16
58
|
@State private var width: Double = 64
|
|
17
59
|
@State private var height: Double = 64
|
|
18
60
|
|
|
19
61
|
var body: some View {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
UploadImage(uri: mockURL),
|
|
43
|
-
UploadImage(uri: mockURL),
|
|
44
|
-
UploadImage(uri: mockURL),
|
|
45
|
-
],
|
|
46
|
-
numberOfImages: 3,
|
|
47
|
-
onAdd: {},
|
|
48
|
-
onCancel: { _, _ in }
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
section("Loading state") {
|
|
53
|
-
Uploader(
|
|
54
|
-
images: [UploadImage(uri: mockURL, loading: true)],
|
|
55
|
-
numberOfImages: 3,
|
|
56
|
-
onAdd: {},
|
|
57
|
-
onCancel: { _, _ in }
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
section("Disabled") {
|
|
62
|
-
Uploader(
|
|
63
|
-
images: [],
|
|
64
|
-
numberOfImages: 1,
|
|
65
|
-
disabled: true,
|
|
66
|
-
onAdd: {}
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
section("Custom size (80 x 80)") {
|
|
71
|
-
Uploader(
|
|
72
|
-
images: [UploadImage(uri: mockURL)],
|
|
73
|
-
numberOfImages: 3,
|
|
74
|
-
width: 80,
|
|
75
|
-
height: 80,
|
|
76
|
-
onAdd: {},
|
|
77
|
-
onCancel: { _, _ in }
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
Divider()
|
|
82
|
-
|
|
83
|
-
section("Playground") {
|
|
84
|
-
VStack(alignment: .leading, spacing: 12) {
|
|
85
|
-
Uploader(
|
|
86
|
-
images: playgroundImages,
|
|
87
|
-
numberOfImages: Int(numberOfImages),
|
|
88
|
-
disabled: disabled,
|
|
89
|
-
width: CGFloat(width),
|
|
90
|
-
height: CGFloat(height),
|
|
91
|
-
onAdd: {
|
|
92
|
-
playgroundImages.append(UploadImage(uri: mockURL))
|
|
93
|
-
},
|
|
94
|
-
onCancel: { _, index in
|
|
95
|
-
if playgroundImages.indices.contains(index) {
|
|
96
|
-
playgroundImages.remove(at: index)
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
onPressImage: { _, _ in }
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
VStack(alignment: .leading, spacing: 4) {
|
|
103
|
-
Text("numberOfImages: \(Int(numberOfImages))")
|
|
104
|
-
Slider(value: $numberOfImages, in: 1...6, step: 1)
|
|
105
|
-
|
|
106
|
-
Toggle("disabled", isOn: $disabled)
|
|
107
|
-
|
|
108
|
-
Text("width: \(Int(width))")
|
|
109
|
-
Slider(value: $width, in: 48...120, step: 1)
|
|
110
|
-
|
|
111
|
-
Text("height: \(Int(height))")
|
|
112
|
-
Slider(value: $height, in: 48...120, step: 1)
|
|
113
|
-
}
|
|
114
|
-
.font(.footnote)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
.padding()
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@ViewBuilder
|
|
123
|
-
private func section<Content: View>(_ title: String, @ViewBuilder content: () -> Content) -> some View {
|
|
124
|
-
VStack(alignment: .leading, spacing: 8) {
|
|
125
|
-
Text(title)
|
|
126
|
-
.font(.subheadline)
|
|
127
|
-
.foregroundColor(.secondary)
|
|
128
|
-
content()
|
|
129
|
-
}
|
|
62
|
+
PlaygroundTab(
|
|
63
|
+
component: {
|
|
64
|
+
Uploader(
|
|
65
|
+
images: images,
|
|
66
|
+
numberOfImages: Int(numberOfImages),
|
|
67
|
+
disabled: disabled,
|
|
68
|
+
width: CGFloat(width),
|
|
69
|
+
height: CGFloat(height),
|
|
70
|
+
onAdd: { images.append(UploadImage(uri: uploaderMockURL)) },
|
|
71
|
+
onCancel: { _, index in
|
|
72
|
+
if images.indices.contains(index) { images.remove(at: index) }
|
|
73
|
+
},
|
|
74
|
+
onPressImage: { _, _ in }
|
|
75
|
+
)
|
|
76
|
+
},
|
|
77
|
+
params: [
|
|
78
|
+
.slider("NumberOfImages", $numberOfImages, min: 1, max: 6, step: 1),
|
|
79
|
+
.checkbox("Disabled", $disabled),
|
|
80
|
+
.slider("Width", $width, min: 48, max: 120, step: 1),
|
|
81
|
+
.slider("Height", $height, min: 48, max: 120, step: 1),
|
|
82
|
+
]
|
|
83
|
+
)
|
|
130
84
|
}
|
|
131
85
|
}
|
|
@@ -7,7 +7,7 @@ struct SwiftUIDemoBrowserView: View {
|
|
|
7
7
|
@State private var searchText = ""
|
|
8
8
|
|
|
9
9
|
var body: some View {
|
|
10
|
-
|
|
10
|
+
ZStack {
|
|
11
11
|
if #available(iOS 16.0, *) {
|
|
12
12
|
HomeView(
|
|
13
13
|
onOpenCompose: onOpenCompose,
|
|
@@ -16,6 +16,8 @@ struct SwiftUIDemoBrowserView: View {
|
|
|
16
16
|
} else {
|
|
17
17
|
fallbackBrowser
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
BaselineView()
|
|
19
21
|
}
|
|
20
22
|
.environment(\.appTheme, defaultTheme)
|
|
21
23
|
}
|