@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
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# MoMoUIKitsDemo
|
|
2
|
+
|
|
3
|
+
SwiftUI demo browser for `MoMoUIKits`.
|
|
4
|
+
|
|
5
|
+
The package can optionally host a Compose UIKits screen by receiving a
|
|
6
|
+
`UIViewController` factory from the host app. It does not import the KMP
|
|
7
|
+
`shared` module directly.
|
|
8
|
+
|
|
9
|
+
SwiftUI mode reuses the full demo screen set from
|
|
10
|
+
`sample/iosApp/iosApp/Demo`, including the sample `HomeView` registry and demo
|
|
11
|
+
screens for all currently available components.
|
|
12
|
+
|
|
13
|
+
## CocoaPods
|
|
14
|
+
|
|
15
|
+
In the host app `Podfile`, include both local pods:
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
pod 'MoMoUIKits', :path => '../momo-native-kits/ios/native-kits.podspec'
|
|
19
|
+
pod 'MoMoUIKitsDemo', :path => '../momo-native-kits/ios-demo'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Adjust the relative paths to match the host app checkout.
|
|
23
|
+
|
|
24
|
+
## Host App Usage
|
|
25
|
+
|
|
26
|
+
```swift
|
|
27
|
+
import MoMoUIKitsDemo
|
|
28
|
+
import shared
|
|
29
|
+
|
|
30
|
+
class UIKitsViewController: BaseComposeAppViewController {
|
|
31
|
+
override func getViewController() -> UIViewController? {
|
|
32
|
+
let params = self.application.data as? [String: Any]
|
|
33
|
+
|
|
34
|
+
return MoMoUIKitsDemoViewControllerFactory.make(
|
|
35
|
+
context: MoMoUIKitsDemoContext(
|
|
36
|
+
appId: params?["appId"] as? String ?? "",
|
|
37
|
+
appCode: params?["code"] as? String ?? "",
|
|
38
|
+
appName: params?["name"] as? String,
|
|
39
|
+
appIcon: params?["icon"] as? String ?? ""
|
|
40
|
+
),
|
|
41
|
+
composeViewController: {
|
|
42
|
+
UIKitsScreenComposeViewControllerKt.UIKitsScreenComposeViewController(
|
|
43
|
+
params: params
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
override func viewDidDisappear(_ animated: Bool) {
|
|
50
|
+
super.viewDidDisappear(animated)
|
|
51
|
+
composeViewController = nil
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If the host does not pass `composeViewController`, the demo opens directly in
|
|
57
|
+
SwiftUI mode.
|
|
58
|
+
|
|
59
|
+
## Included SwiftUI Demos
|
|
60
|
+
|
|
61
|
+
The pod includes the sample demo screens for:
|
|
62
|
+
|
|
63
|
+
- Animated Header
|
|
64
|
+
- Avatar
|
|
65
|
+
- Badge
|
|
66
|
+
- Baseline View
|
|
67
|
+
- Bottom Tab
|
|
68
|
+
- Button
|
|
69
|
+
- Carousel
|
|
70
|
+
- Checkbox
|
|
71
|
+
- Chip
|
|
72
|
+
- Collapse
|
|
73
|
+
- DateTimePicker
|
|
74
|
+
- Divider
|
|
75
|
+
- Header User
|
|
76
|
+
- Icon Button
|
|
77
|
+
- Image
|
|
78
|
+
- Information
|
|
79
|
+
- Input
|
|
80
|
+
- Input DropDown
|
|
81
|
+
- Input Money
|
|
82
|
+
- Input OTP
|
|
83
|
+
- Input Phone Number
|
|
84
|
+
- Input Search
|
|
85
|
+
- Input TextArea
|
|
86
|
+
- Loader
|
|
87
|
+
- Navigation
|
|
88
|
+
- Pagination
|
|
89
|
+
- Popup Display
|
|
90
|
+
- Popup Notify
|
|
91
|
+
- Popup Promotion
|
|
92
|
+
- Progress Info
|
|
93
|
+
- Radio
|
|
94
|
+
- Rating
|
|
95
|
+
- Skeleton
|
|
96
|
+
- Slider
|
|
97
|
+
- SnackBar
|
|
98
|
+
- Stepper
|
|
99
|
+
- Steps
|
|
100
|
+
- Suggest Action
|
|
101
|
+
- Swipe
|
|
102
|
+
- Switch
|
|
103
|
+
- TabView
|
|
104
|
+
- Tag
|
|
105
|
+
- Theme
|
|
106
|
+
- Title
|
|
107
|
+
- Tooltip
|
|
108
|
+
- Typography
|
|
109
|
+
- Uploader
|
|
110
|
+
|
|
111
|
+
## Validation Notes
|
|
112
|
+
|
|
113
|
+
Validated locally with:
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
pod ipc spec ios/MoMoUIKits.podspec
|
|
117
|
+
pod ipc spec ios-demo/MoMoUIKitsDemo.podspec
|
|
118
|
+
pod lib lint ios/MoMoUIKits.podspec --allow-warnings --skip-import-validation
|
|
119
|
+
pod lib lint ios-demo/MoMoUIKitsDemo.podspec --allow-warnings --skip-import-validation --include-podspecs=ios/MoMoUIKits.podspec
|
|
120
|
+
```
|
|
@@ -2,92 +2,106 @@
|
|
|
2
2
|
// AvatarDemo.swift
|
|
3
3
|
// Example
|
|
4
4
|
//
|
|
5
|
+
// Preview + Playground demo (DemoScreen pattern).
|
|
6
|
+
//
|
|
5
7
|
|
|
6
|
-
import SwiftUI
|
|
7
8
|
import MoMoUIKits
|
|
9
|
+
import SwiftUI
|
|
8
10
|
|
|
9
11
|
struct AvatarDemo: View {
|
|
10
12
|
var body: some View {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Avatar(size: .size48)
|
|
19
|
-
Avatar(size: .size56)
|
|
20
|
-
Avatar(size: .size72)
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
section("Rounded vs Square") {
|
|
25
|
-
HStack(spacing: 8) {
|
|
26
|
-
Avatar(size: .size40, rounded: true)
|
|
27
|
-
Avatar(size: .size40, rounded: false)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
section("Name (initials)") {
|
|
32
|
-
HStack(spacing: 8) {
|
|
33
|
-
Avatar(size: .size40, name: "Nguyen Van A")
|
|
34
|
-
Avatar(size: .size40, name: "John Doe")
|
|
35
|
-
Avatar(size: .size40, name: "MoMo")
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
section("Image") {
|
|
40
|
-
HStack(spacing: 8) {
|
|
41
|
-
Avatar(size: .size40, image: "https://i.pravatar.cc/150?img=1")
|
|
42
|
-
Avatar(size: .size56, image: "https://i.pravatar.cc/150?img=2")
|
|
43
|
-
Avatar(size: .size72, image: "https://i.pravatar.cc/150?img=3")
|
|
44
|
-
}
|
|
45
|
-
}
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
DemoScreen(preview: { AvatarPreview() }, playground: { AvatarPlayground() })
|
|
15
|
+
} else {
|
|
16
|
+
Text("Requires iOS 16+").padding()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
46
20
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
21
|
+
private let avatarSizeList: [PlaygroundOption] = [
|
|
22
|
+
.init("size24", AvatarSize.size24),
|
|
23
|
+
.init("size32", AvatarSize.size32),
|
|
24
|
+
.init("size40", AvatarSize.size40),
|
|
25
|
+
.init("size48", AvatarSize.size48),
|
|
26
|
+
.init("size56", AvatarSize.size56),
|
|
27
|
+
.init("size72", AvatarSize.size72),
|
|
28
|
+
]
|
|
54
29
|
|
|
55
|
-
|
|
56
|
-
HStack(spacing: 8) {
|
|
57
|
-
Avatar(size: .size40, showIconSupport: true)
|
|
58
|
-
Avatar(size: .size48, name: "CS", showIconSupport: true)
|
|
59
|
-
Avatar(size: .size56, image: "https://i.pravatar.cc/150?img=5", showIconSupport: true)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
30
|
+
// MARK: - Preview
|
|
62
31
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
32
|
+
private struct AvatarPreview: View {
|
|
33
|
+
var body: some View {
|
|
34
|
+
BasicColumnBox("Size", alignment: .leading) {
|
|
35
|
+
HStack(alignment: .center, spacing: Spacing.S) {
|
|
36
|
+
Avatar(size: .size24)
|
|
37
|
+
Avatar(size: .size32)
|
|
38
|
+
Avatar(size: .size40)
|
|
39
|
+
Avatar(size: .size48)
|
|
40
|
+
Avatar(size: .size56)
|
|
41
|
+
Avatar(size: .size72)
|
|
69
42
|
}
|
|
70
|
-
.padding()
|
|
71
43
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
44
|
+
BasicColumnBox("Rounded vs Square", alignment: .leading) {
|
|
45
|
+
HStack(spacing: Spacing.S) {
|
|
46
|
+
Avatar(size: .size40, rounded: true)
|
|
47
|
+
Avatar(size: .size40, rounded: false)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
BasicColumnBox("Name (initials)", alignment: .leading) {
|
|
51
|
+
HStack(spacing: Spacing.S) {
|
|
52
|
+
Avatar(size: .size40, name: "Nguyen Van A")
|
|
53
|
+
Avatar(size: .size40, name: "John Doe")
|
|
54
|
+
Avatar(size: .size40, name: "MoMo")
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
BasicColumnBox("Image", alignment: .leading) {
|
|
58
|
+
HStack(spacing: Spacing.S) {
|
|
59
|
+
Avatar(size: .size40, image: "https://i.pravatar.cc/150?img=1")
|
|
60
|
+
Avatar(size: .size56, image: "https://i.pravatar.cc/150?img=2")
|
|
61
|
+
Avatar(size: .size72, image: "https://i.pravatar.cc/150?img=3")
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
BasicColumnBox("Icon badges", alignment: .leading) {
|
|
65
|
+
HStack(spacing: Spacing.S) {
|
|
66
|
+
Avatar(size: .size48, showIconMomo: true)
|
|
67
|
+
Avatar(size: .size48, showIconSupport: true)
|
|
68
|
+
Avatar(size: .size56, showIconMomo: true, showIconSupport: true)
|
|
69
|
+
}
|
|
83
70
|
}
|
|
84
71
|
}
|
|
85
72
|
}
|
|
86
73
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
74
|
+
// MARK: - Playground
|
|
75
|
+
|
|
76
|
+
@available(iOS 16.0, *)
|
|
77
|
+
private struct AvatarPlayground: View {
|
|
78
|
+
@State private var size: PlaygroundOption? = avatarSizeList.first { $0.key == "size48" }
|
|
79
|
+
@State private var rounded = true
|
|
80
|
+
@State private var name = ""
|
|
81
|
+
@State private var image = ""
|
|
82
|
+
@State private var showIconMomo = false
|
|
83
|
+
@State private var showIconSupport = false
|
|
84
|
+
|
|
85
|
+
var body: some View {
|
|
86
|
+
PlaygroundTab(
|
|
87
|
+
component: {
|
|
88
|
+
Avatar(
|
|
89
|
+
size: (size?.value as? AvatarSize) ?? .size48,
|
|
90
|
+
rounded: rounded,
|
|
91
|
+
name: name.isEmpty ? nil : name,
|
|
92
|
+
image: image.isEmpty ? nil : image,
|
|
93
|
+
showIconMomo: showIconMomo,
|
|
94
|
+
showIconSupport: showIconSupport
|
|
95
|
+
)
|
|
96
|
+
},
|
|
97
|
+
params: [
|
|
98
|
+
.radio("Size", avatarSizeList, $size),
|
|
99
|
+
.checkbox("Rounded", $rounded),
|
|
100
|
+
.string("Name", $name),
|
|
101
|
+
.string("Image", $image),
|
|
102
|
+
.checkbox("ShowIconMomo", $showIconMomo),
|
|
103
|
+
.checkbox("ShowIconSupport", $showIconSupport),
|
|
104
|
+
]
|
|
105
|
+
)
|
|
91
106
|
}
|
|
92
107
|
}
|
|
93
|
-
#endif
|
|
@@ -2,268 +2,74 @@
|
|
|
2
2
|
// BadgeDemo.swift
|
|
3
3
|
// Example
|
|
4
4
|
//
|
|
5
|
-
//
|
|
5
|
+
// Preview + Playground demo for Badge / BadgeDot / BadgeRibbon.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import MoMoUIKits
|
|
10
9
|
import SwiftUI
|
|
11
10
|
|
|
12
|
-
// MARK: - BadgeDemo
|
|
13
|
-
|
|
14
11
|
struct BadgeDemo: View {
|
|
15
|
-
|
|
12
|
+
var body: some View {
|
|
13
|
+
if #available(iOS 16.0, *) {
|
|
14
|
+
DemoScreen(preview: { BadgePreview() }, playground: { BadgePlayground() })
|
|
15
|
+
} else {
|
|
16
|
+
Text("Requires iOS 16+").padding()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
16
20
|
|
|
21
|
+
// MARK: - Preview
|
|
22
|
+
|
|
23
|
+
private struct BadgePreview: View {
|
|
17
24
|
var body: some View {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Text("Two Digits")
|
|
46
|
-
.font(.caption)
|
|
47
|
-
.foregroundColor(.gray)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
VStack(spacing: 8) {
|
|
51
|
-
Badge(label: "999")
|
|
52
|
-
Text("99+ Format")
|
|
53
|
-
.font(.caption)
|
|
54
|
-
.foregroundColor(.gray)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
HStack(spacing: 16) {
|
|
59
|
-
VStack(spacing: 8) {
|
|
60
|
-
Badge(label: "New")
|
|
61
|
-
Text("Text Label")
|
|
62
|
-
.font(.caption)
|
|
63
|
-
.foregroundColor(.gray)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
VStack(spacing: 8) {
|
|
67
|
-
Badge(label: "Hot", backgroundColor: Colors.pink03)
|
|
68
|
-
Text("Custom Color")
|
|
69
|
-
.font(.caption)
|
|
70
|
-
.foregroundColor(.gray)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
VStack(spacing: 8) {
|
|
74
|
-
Badge(label: "5", backgroundColor: Colors.green03)
|
|
75
|
-
Text("Green Badge")
|
|
76
|
-
.font(.caption)
|
|
77
|
-
.foregroundColor(.gray)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
.padding(.horizontal, 16)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
Divider()
|
|
85
|
-
|
|
86
|
-
// MARK: - Badge Dots
|
|
87
|
-
|
|
88
|
-
VStack(alignment: .leading, spacing: 12) {
|
|
89
|
-
Text("Badge Dots")
|
|
90
|
-
.font(.headline)
|
|
91
|
-
.padding(.horizontal, 16)
|
|
92
|
-
|
|
93
|
-
HStack(spacing: 32) {
|
|
94
|
-
VStack(spacing: 8) {
|
|
95
|
-
BadgeDot(size: .small)
|
|
96
|
-
Text("Small")
|
|
97
|
-
.font(.caption)
|
|
98
|
-
.foregroundColor(.gray)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
VStack(spacing: 8) {
|
|
102
|
-
BadgeDot(size: .large)
|
|
103
|
-
Text("Large")
|
|
104
|
-
.font(.caption)
|
|
105
|
-
.foregroundColor(.gray)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
.padding(.horizontal, 16)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
Divider()
|
|
112
|
-
|
|
113
|
-
// MARK: - Badge Ribbons
|
|
114
|
-
|
|
115
|
-
VStack(alignment: .leading, spacing: 12) {
|
|
116
|
-
Text("Badge Ribbons")
|
|
117
|
-
.font(.headline)
|
|
118
|
-
.padding(.horizontal, 16)
|
|
119
|
-
|
|
120
|
-
VStack(spacing: 20) {
|
|
121
|
-
HStack(spacing: 20) {
|
|
122
|
-
VStack(spacing: 8) {
|
|
123
|
-
BadgeRibbon(position: .topLeft, label: "Top Left", isRound: true)
|
|
124
|
-
.frame(width: 150, height: 30)
|
|
125
|
-
Text("Top Left")
|
|
126
|
-
.font(.caption)
|
|
127
|
-
.foregroundColor(.gray)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
VStack(spacing: 8) {
|
|
131
|
-
BadgeRibbon(position: .topRight, label: "Top Right", isRound: true)
|
|
132
|
-
.frame(width: 150, height: 30)
|
|
133
|
-
Text("Top Right")
|
|
134
|
-
.font(.caption)
|
|
135
|
-
.foregroundColor(.gray)
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
HStack(spacing: 20) {
|
|
140
|
-
VStack(spacing: 8) {
|
|
141
|
-
BadgeRibbon(position: .bottomLeft, label: "Bottom Left", isRound: true)
|
|
142
|
-
.frame(width: 150, height: 30)
|
|
143
|
-
Text("Bottom Left")
|
|
144
|
-
.font(.caption)
|
|
145
|
-
.foregroundColor(.gray)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
VStack(spacing: 8) {
|
|
149
|
-
BadgeRibbon(position: .bottomRight, label: "Bottom Right", isRound: true)
|
|
150
|
-
.frame(width: 150, height: 30)
|
|
151
|
-
Text("Bottom Right")
|
|
152
|
-
.font(.caption)
|
|
153
|
-
.foregroundColor(.gray)
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
.padding(.horizontal, 16)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
Divider()
|
|
161
|
-
|
|
162
|
-
// MARK: - Badge in Context (Real Usage Examples)
|
|
163
|
-
|
|
164
|
-
VStack(alignment: .leading, spacing: 12) {
|
|
165
|
-
Text("Real Usage Examples")
|
|
166
|
-
.font(.headline)
|
|
167
|
-
.padding(.horizontal, 16)
|
|
168
|
-
|
|
169
|
-
VStack(spacing: 16) {
|
|
170
|
-
// Notification with badge
|
|
171
|
-
HStack {
|
|
172
|
-
Image(systemName: "bell.fill")
|
|
173
|
-
.font(.system(size: 24))
|
|
174
|
-
.foregroundColor(Colors.primary)
|
|
175
|
-
|
|
176
|
-
Text("Notifications")
|
|
177
|
-
.font(.body)
|
|
178
|
-
|
|
179
|
-
Spacer()
|
|
180
|
-
|
|
181
|
-
Badge(label: "23")
|
|
182
|
-
}
|
|
183
|
-
.padding()
|
|
184
|
-
.background(Color(.systemGray6))
|
|
185
|
-
.cornerRadius(12)
|
|
186
|
-
|
|
187
|
-
// Message with badge
|
|
188
|
-
HStack {
|
|
189
|
-
Image(systemName: "message.fill")
|
|
190
|
-
.font(.system(size: 24))
|
|
191
|
-
.foregroundColor(Colors.primary)
|
|
192
|
-
|
|
193
|
-
Text("Messages")
|
|
194
|
-
.font(.body)
|
|
195
|
-
|
|
196
|
-
Spacer()
|
|
197
|
-
|
|
198
|
-
Badge(label: "5")
|
|
199
|
-
}
|
|
200
|
-
.padding()
|
|
201
|
-
.background(Color(.systemGray6))
|
|
202
|
-
.cornerRadius(12)
|
|
203
|
-
|
|
204
|
-
// Product card with ribbon
|
|
205
|
-
ZStack(alignment: .topTrailing) {
|
|
206
|
-
VStack(alignment: .leading, spacing: 8) {
|
|
207
|
-
Rectangle()
|
|
208
|
-
.fill(Color(.systemGray5))
|
|
209
|
-
.frame(height: 120)
|
|
210
|
-
.cornerRadius(8)
|
|
211
|
-
|
|
212
|
-
Text("Product Name")
|
|
213
|
-
.font(.headline)
|
|
214
|
-
|
|
215
|
-
Text("$99.99")
|
|
216
|
-
.font(.subheadline)
|
|
217
|
-
.foregroundColor(.gray)
|
|
218
|
-
}
|
|
219
|
-
.padding()
|
|
220
|
-
.background(Color(.systemGray6))
|
|
221
|
-
.cornerRadius(12)
|
|
222
|
-
|
|
223
|
-
BadgeRibbon(position: .topRight, label: "NEW")
|
|
224
|
-
.frame(width: 60, height: 40)
|
|
225
|
-
.offset(x: 5, y: 0)
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// Profile with dot indicator
|
|
229
|
-
HStack {
|
|
230
|
-
ZStack(alignment: .topTrailing) {
|
|
231
|
-
Circle()
|
|
232
|
-
.fill(Color(.systemGray5))
|
|
233
|
-
.frame(width: 50, height: 50)
|
|
234
|
-
|
|
235
|
-
BadgeDot(size: .small)
|
|
236
|
-
.offset(x: 2, y: 2)
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
VStack(alignment: .leading) {
|
|
240
|
-
Text("User Name")
|
|
241
|
-
.font(.headline)
|
|
242
|
-
Text("Online")
|
|
243
|
-
.font(.caption)
|
|
244
|
-
.foregroundColor(Colors.green03)
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
Spacer()
|
|
248
|
-
}
|
|
249
|
-
.padding()
|
|
250
|
-
.background(Color(.systemGray6))
|
|
251
|
-
.cornerRadius(12)
|
|
252
|
-
}
|
|
253
|
-
.padding(.horizontal, 16)
|
|
254
|
-
}
|
|
25
|
+
BasicColumnBox("Basic Badges", alignment: .leading) {
|
|
26
|
+
HStack(spacing: Spacing.L) {
|
|
27
|
+
Badge()
|
|
28
|
+
Badge(label: "9")
|
|
29
|
+
Badge(label: "99")
|
|
30
|
+
Badge(label: "999")
|
|
31
|
+
}
|
|
32
|
+
HStack(spacing: Spacing.L) {
|
|
33
|
+
Badge(label: "New")
|
|
34
|
+
Badge(label: "Hot", backgroundColor: Colors.pink03)
|
|
35
|
+
Badge(label: "5", backgroundColor: Colors.green03)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
BasicColumnBox("Badge Dots", alignment: .leading) {
|
|
40
|
+
HStack(spacing: Spacing.XL) {
|
|
41
|
+
BadgeDot(size: .small)
|
|
42
|
+
BadgeDot(size: .large)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
BasicColumnBox("Badge Ribbons", alignment: .leading) {
|
|
47
|
+
HStack(spacing: Spacing.L) {
|
|
48
|
+
BadgeRibbon(position: .topLeft, label: "Top Left", isRound: true)
|
|
49
|
+
.frame(width: 150, height: 30)
|
|
50
|
+
BadgeRibbon(position: .topRight, label: "Top Right", isRound: true)
|
|
51
|
+
.frame(width: 150, height: 30)
|
|
255
52
|
}
|
|
256
|
-
.padding(.vertical, 16)
|
|
257
53
|
}
|
|
258
54
|
}
|
|
259
55
|
}
|
|
260
56
|
|
|
261
|
-
// MARK: -
|
|
57
|
+
// MARK: - Playground
|
|
262
58
|
|
|
263
|
-
|
|
264
|
-
struct
|
|
265
|
-
|
|
266
|
-
|
|
59
|
+
@available(iOS 16.0, *)
|
|
60
|
+
private struct BadgePlayground: View {
|
|
61
|
+
@State private var label = "New"
|
|
62
|
+
@State private var color: PlaygroundOption? = playgroundColors.first { $0.key == "pink03" }
|
|
63
|
+
|
|
64
|
+
var body: some View {
|
|
65
|
+
PlaygroundTab(
|
|
66
|
+
component: {
|
|
67
|
+
Badge(label: label, backgroundColor: color?.value as? Color)
|
|
68
|
+
},
|
|
69
|
+
params: [
|
|
70
|
+
.string("Label", $label),
|
|
71
|
+
.color("BackgroundColor", playgroundColors, $color),
|
|
72
|
+
]
|
|
73
|
+
)
|
|
267
74
|
}
|
|
268
75
|
}
|
|
269
|
-
#endif
|