@momo-kits/native-kits 0.300.3 → 0.300.4-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 +51 -7
- package/README.md +2 -2
- package/build.gradle.kts +13 -0
- package/compose/build.gradle.kts +197 -0
- package/compose/build.gradle.kts.backup +197 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +20 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -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 +153 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +62 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1071 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +65 -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 +81 -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 +357 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -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 +49 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -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 +189 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +478 -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 +265 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +235 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +223 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +265 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +185 -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 +361 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +308 -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 +330 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +220 -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 +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +560 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +125 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +501 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -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 +236 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +17 -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 +194 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +287 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -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 +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +137 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +116 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +215 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +404 -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 +732 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +148 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +233 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +217 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +97 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +377 -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 +455 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +103 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +413 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HelpCenterRequest.kt +37 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +192 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/ToolkitRequests.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +135 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -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 +74 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +20 -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 +118 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +44 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +62 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +36 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -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 +217 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +138 -0
- package/gradle/libs.versions.toml +68 -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 +24 -6
- package/ios/Application/DesignSystemKits.swift +100 -0
- package/ios/Application/DesignSystemKitsPayload.swift +68 -0
- package/ios/Application/MaxApi.swift +30 -3
- package/ios/Avatar/Avatar.swift +4 -3
- package/ios/Badge/Badge.swift +6 -4
- package/ios/Badge/BadgeDot.swift +1 -1
- package/ios/Badge/BadgeRibbon.swift +8 -2
- package/ios/Button/Button.swift +15 -12
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +64 -18
- package/ios/Carousel/Carousel.swift +29 -12
- package/ios/Checkbox/Checkbox.swift +7 -3
- package/ios/Chip/Chip.swift +5 -4
- package/ios/Collapse/Collapse.swift +70 -19
- package/ios/Colors+Radius+Spacing/Colors.swift +10 -1
- package/ios/Colors+Radius+Spacing/Radius.swift +6 -0
- package/ios/DateTimePicker/DateTimePicker.swift +54 -20
- package/ios/DateTimePicker/WheelPicker.swift +103 -105
- package/ios/Divider/Divider.swift +37 -4
- package/ios/Extensions/Color++.swift +38 -9
- package/ios/Extensions/OptionalEnvironmentObject.swift +12 -0
- package/ios/Extensions/SkeletonUICompat.swift +11 -0
- package/ios/Icon/Icon.swift +21 -23
- package/ios/Icon/Icons.swift +1329 -0
- package/ios/IconButton/IconButton.swift +15 -7
- package/ios/Image/Image.swift +7 -23
- package/ios/Information/Information.swift +27 -9
- package/ios/Input/ErrorView.swift +2 -2
- package/ios/Input/Input.swift +171 -148
- package/ios/Input/InputPhoneNumber.swift +10 -9
- package/ios/Input/InputSearch.swift +107 -78
- package/ios/Input/InputTextArea.swift +133 -148
- package/ios/InputDropDown/InputDropDown.swift +10 -7
- package/ios/InputMoney/InputMoney.swift +32 -11
- package/ios/InputOTP/InputOTP.swift +22 -12
- package/ios/Layout/Card.swift +50 -0
- package/ios/Layout/GridContext.swift +187 -3
- package/ios/Layout/Item.swift +5 -4
- package/ios/Layout/ScreenLayout.swift +415 -0
- package/ios/Layout/Section.swift +4 -100
- package/ios/Loader/Loader.swift +5 -9
- package/ios/Lottie/LottieView.swift +14 -2
- package/ios/{Application/Navigation/Overplay → Navigation}/BottomSheet.swift +169 -29
- package/ios/Navigation/BottomTab/BottomTab.swift +332 -0
- package/ios/{Application/Navigation → Navigation}/BottomTab/BottomTabBar.swift +18 -7
- package/ios/Navigation/BottomTab/DuoBarCompression.swift +104 -0
- package/ios/Navigation/BottomTab/DuoTabBar.swift +329 -0
- package/ios/{Application → Navigation/Component}/FloatingButton.swift +43 -54
- package/ios/Navigation/Component/Header.swift +545 -0
- package/ios/Navigation/Component/HeaderBackground.swift +154 -0
- package/ios/Navigation/Component/HeaderJourney.swift +73 -0
- package/ios/Navigation/Component/HeaderLocation.swift +48 -0
- package/ios/Navigation/Component/HeaderRight.swift +425 -0
- package/ios/Navigation/Component/HeaderTitle.swift +36 -0
- package/ios/{Application/Navigation → Navigation/Component}/HeaderUser.swift +21 -24
- package/ios/Navigation/Component/SideBar.swift +183 -0
- package/ios/{Application/Navigation/Overplay → Navigation/Component}/SnackBar.swift +8 -8
- package/ios/Navigation/HostBackGestureBridge.swift +78 -0
- package/ios/{Application/Navigation/Overplay → Navigation}/ModalScreen.swift +9 -2
- package/ios/Navigation/Navigation.swift +204 -0
- package/ios/Navigation/NavigationContainer.swift +195 -0
- package/ios/{Application/Navigation → Navigation}/Navigator.swift +207 -107
- package/ios/Navigation/StackScreen.swift +930 -0
- package/ios/Navigation/StackTransition.swift +400 -0
- package/ios/Navigation/SwipeBackHaptic.swift +33 -0
- package/ios/{Application/Navigation → Navigation}/Tracking/ScreenTracker.swift +12 -5
- package/ios/OTPKeyboard/OTPKeyboard.swift +8 -11
- package/ios/Pagination/PaginationScroll.swift +2 -2
- package/ios/Popup/PopupDisplay.swift +72 -135
- package/ios/Popup/PopupInput.swift +10 -13
- package/ios/Popup/PopupLayout.swift +138 -0
- package/ios/Popup/PopupNotify.swift +59 -69
- package/ios/Popup/PopupPromotion.swift +31 -47
- package/ios/PopupView/FullscreenPopup.swift +13 -19
- package/ios/PopupView/PopupView.swift +1 -1
- package/ios/PopupView/Utils++.swift +0 -8
- package/ios/ProgressInfo/ProgressInfo.swift +4 -2
- package/ios/Radio/Radio.swift +2 -1
- package/ios/Rating/Rating.swift +9 -1
- package/ios/Resources/dot_loading.json +558 -0
- package/ios/Resources/lottie_circle_loader.json +1 -0
- package/ios/ScrollIndicator/ScrollIndicator.swift +11 -10
- package/ios/Skeleton/Skeleton.swift +22 -27
- package/ios/Slider/Slider.swift +16 -18
- package/ios/Stepper/Stepper.swift +7 -3
- package/ios/Steps/Steps.swift +8 -6
- package/ios/SuggestAction/SuggestAction.swift +5 -0
- package/ios/Swipeable/SwipeCell.swift +10 -6
- package/ios/Switch/Switch.swift +22 -20
- package/ios/TabView/TabView.swift +102 -21
- package/ios/Tag/Tag.swift +15 -4
- package/ios/Template/Logo/Logo.swift +2 -1
- package/ios/Template/TrustBanner/TrustBanner.swift +109 -55
- package/ios/Title/Title.swift +6 -17
- package/ios/Tooltip/Tooltip.swift +29 -14
- package/ios/Typography/FontScale.swift +17 -14
- package/ios/Typography/Text.swift +156 -20
- package/ios/Typography/Typography.swift +2 -2
- package/ios/Uploader/Uploader.swift +3 -1
- package/ios/native-kits.podspec +2 -3
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -3
- package/ios-demo/README.md +120 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DuoTabDemo.swift +80 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +2 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IPhoneDuoDemo.swift +173 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +77 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +2 -2
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +2 -0
- package/package.json +1 -1
- package/publish.sh +19 -2
- package/scripts/gen-ios-icons.mjs +36 -0
- package/settings.gradle.kts +64 -0
- package/ios/Application/Components.swift +0 -270
- package/ios/Application/ComposeApi.swift +0 -22
- package/ios/Application/HeaderRight.swift +0 -306
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +0 -104
- package/ios/Application/Navigation/HeaderBackProps.swift +0 -66
- package/ios/Application/Navigation/HeaderTitle.swift +0 -57
- package/ios/Application/Navigation/NavigationContainer.swift +0 -213
- package/ios/Application/Navigation/NavigationOptions.swift +0 -109
- package/ios/Application/Navigation/NavigatorManager.swift +0 -22
- 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/Navigation/component/HeaderRightWidthKey.swift +0 -11
- package/ios/Application/Navigation/component/NavigationFooter.swift +0 -90
- package/ios/Application/Navigation/component/NavigationHeaderRight.swift +0 -196
- package/ios/Application/Screen.swift +0 -250
- package/ios/Application/StackScreen.swift +0 -492
- package/ios/Typography/FontScaleStore.swift +0 -58
- package/ios/Typography/KitDesignSystem.swift +0 -17
- /package/ios/{Application/Navigation → Navigation}/BottomTab/CurvedContainer.swift +0 -0
|
@@ -10,12 +10,12 @@ public extension View {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
public extension Font {
|
|
13
|
-
/// Non-reactive: resolves against the current `
|
|
13
|
+
/// Non-reactive: resolves against the current `DesignSystemKits` font scale at each access. The
|
|
14
14
|
/// styles below are computed properties for that reason — as stored `static let`s they would
|
|
15
15
|
/// freeze the scale at first access and never pick up a Dynamic Type change.
|
|
16
16
|
/// Inside a view, `@Environment(\.momoFontScale)` + `fontScale.font(size:weight:)` also re-renders.
|
|
17
17
|
static func appFont(size: CGFloat) -> Font {
|
|
18
|
-
|
|
18
|
+
DesignSystemKits.shared.fontScale.font(size: size)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// New supported typography styles
|
|
@@ -80,7 +80,9 @@ public struct Uploader: View {
|
|
|
80
80
|
|
|
81
81
|
ScrollView(.horizontal, showsIndicators: false) {
|
|
82
82
|
HStack(alignment: .top, spacing: Spacing.S) {
|
|
83
|
-
|
|
83
|
+
// Positional like Compose: `UploadImage.id` is a fresh UUID per init, so hosts that
|
|
84
|
+
// rebuild the array each render would otherwise re-create (and reload) every thumbnail.
|
|
85
|
+
ForEach(Array(images.enumerated()), id: \.offset) { index, image in
|
|
84
86
|
UploaderImageItem(
|
|
85
87
|
image: image,
|
|
86
88
|
width: width,
|
package/ios/native-kits.podspec
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
Pod::Spec.new do |s|
|
|
2
2
|
s.name = 'MoMoUIKits'
|
|
3
|
-
|
|
4
|
-
s.version = '0.300.3'
|
|
5
|
-
# AI-GENERATED END: match the SDK 36 compatible Kits release
|
|
3
|
+
s.version = '0.300.4'
|
|
6
4
|
s.summary = 'MoMoUIKits for iOS'
|
|
7
5
|
s.homepage = 'https://momo.vn'
|
|
8
6
|
s.license = { :type => 'MIT' }
|
|
@@ -39,6 +37,7 @@ Pod::Spec.new do |s|
|
|
|
39
37
|
"Layout/**/*.{swift,m,h}",
|
|
40
38
|
"Loader/**/*.{swift,m,h}",
|
|
41
39
|
"Lottie/**/*.{swift,m,h}",
|
|
40
|
+
"Navigation/**/*.{swift,m,h}",
|
|
42
41
|
"OTPKeyboard/**/*.{swift,m,h}",
|
|
43
42
|
"Pagination/**/*.{swift,m,h}",
|
|
44
43
|
"Popup/**/*.{swift,m,h}",
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
Pod::Spec.new do |s|
|
|
2
2
|
s.name = 'MoMoUIKitsDemo'
|
|
3
|
-
|
|
4
|
-
s.version = '0.300.3'
|
|
5
|
-
# AI-GENERATED END: match the SDK 36 compatible Kits release
|
|
3
|
+
s.version = '0.300.4'
|
|
6
4
|
s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
|
|
7
5
|
s.homepage = 'https://momo.vn'
|
|
8
6
|
s.license = { :type => 'MIT' }
|
|
@@ -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
|
+
```
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//
|
|
2
|
+
// DuoTabDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Mirrors RN `app/screens/IPhoneDuo/DuoTabUsage`: glass rail in the Duo side bar, floating
|
|
6
|
+
// glass bar when unfolded portrait. `useShortcut` gives the tallest side bar header, for the
|
|
7
|
+
// overlap review; `compressTabBar` folds the tab bar instead of the toolbar when the side bar
|
|
8
|
+
// is short (HIG "Tab bar compressed").
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
import MoMoUIKits
|
|
12
|
+
import SwiftUI
|
|
13
|
+
|
|
14
|
+
private let swatches = [Colors.pink03, Colors.orange03, Colors.green03]
|
|
15
|
+
private let history = (1...18).map { "Giao dịch #\($0)" }
|
|
16
|
+
|
|
17
|
+
struct DuoTabDemo: View {
|
|
18
|
+
let useShortcut: Bool
|
|
19
|
+
var compressTabBar = false
|
|
20
|
+
|
|
21
|
+
var body: some View {
|
|
22
|
+
if #available(iOS 16.0, *) {
|
|
23
|
+
DuoTabDemoContent(useShortcut: useShortcut, compressTabBar: compressTabBar)
|
|
24
|
+
} else {
|
|
25
|
+
Text("Requires iOS 16+").padding()
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@available(iOS 16.0, *)
|
|
31
|
+
private struct DuoTabDemoContent: View {
|
|
32
|
+
let useShortcut: Bool
|
|
33
|
+
let compressTabBar: Bool
|
|
34
|
+
|
|
35
|
+
var body: some View {
|
|
36
|
+
BottomTab(
|
|
37
|
+
items: [
|
|
38
|
+
tab("DuoMoMo", label: "MoMo", icon: "basic_home", title: "MoMo"),
|
|
39
|
+
tab("DuoPromotion", label: "Ưu đãi", icon: "shopping_coupon", title: "Ưu đãi", badge: ""),
|
|
40
|
+
tab("DuoHistory", label: "Lịch sử GD", icon: "time_clock_reset", title: "Lịch sử giao dịch", badge: "3"),
|
|
41
|
+
tab("DuoMe", label: "Tôi", icon: "basic_person", title: "Tôi"),
|
|
42
|
+
],
|
|
43
|
+
floatingButton: BottomTabFloatingButton(icon: "navigation_full_screen", label: "Quét mọi QR", onPress: {}),
|
|
44
|
+
compressionBehavior: compressTabBar ? .tabBar : .toolbar
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private func tab(_ name: String, label: String, icon: String, title: String, badge: String? = nil) -> BottomTabItem {
|
|
49
|
+
BottomTabItem(
|
|
50
|
+
name: name,
|
|
51
|
+
label: label,
|
|
52
|
+
icon: icon,
|
|
53
|
+
badgeLabel: badge,
|
|
54
|
+
options: NavigationOptions(title: title, headerRightData: HeaderRightData(useShortcut: useShortcut)),
|
|
55
|
+
screen: { DuoTabList() }
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private struct DuoTabList: View {
|
|
61
|
+
var body: some View {
|
|
62
|
+
VStack(spacing: 0) {
|
|
63
|
+
ForEach(history.indices, id: \.self) { index in
|
|
64
|
+
if index > 0 { MomoDivider() }
|
|
65
|
+
HStack(spacing: Spacing.M) {
|
|
66
|
+
RoundedRectangle(cornerRadius: Radius.S)
|
|
67
|
+
.fill(swatches[index % swatches.count])
|
|
68
|
+
.frame(width: Spacing.XL, height: Spacing.XL)
|
|
69
|
+
MomoText(history[index], typography: .bodyDefaultRegular)
|
|
70
|
+
Spacer()
|
|
71
|
+
}
|
|
72
|
+
.padding(.vertical, Spacing.M)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.padding(.horizontal, Spacing.M)
|
|
76
|
+
.background(Colors.black01)
|
|
77
|
+
.clipShape(RoundedRectangle(cornerRadius: Radius.M))
|
|
78
|
+
.padding(Spacing.M)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -51,6 +51,7 @@ public let ScreenUsages: [ScreenUsage] = [
|
|
|
51
51
|
ScreenUsage(title: "InputTextArea", destination: AnyView(InputTextAreaDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
|
|
52
52
|
ScreenUsage(title: "InputSearch", destination: AnyView(InputSearchDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
|
|
53
53
|
ScreenUsage(title: "PopupNotify", destination: AnyView(PopupNotifyDemo()), icon: getIcon(icon: "Popup"), hostsOwnChrome: true),
|
|
54
|
+
ScreenUsage(title: "PopupDisplay", destination: AnyView(PopupDisplayDemo()), icon: getIcon(icon: "Popup"), hostsOwnChrome: true),
|
|
54
55
|
ScreenUsage(title: "PopupPromotion", destination: AnyView(PopupPromotionDemo()), icon: getIcon(icon: "Popup"), hostsOwnChrome: true),
|
|
55
56
|
ScreenUsage(title: "SnackBar", destination: AnyView(SnackBarDemo()), icon: getIcon(icon: "Popup"), hostsOwnChrome: true),
|
|
56
57
|
ScreenUsage(title: "Switch", destination: AnyView(SwitchDemo()), icon: getIcon(icon: "Toggle"), hostsOwnChrome: true),
|
|
@@ -84,6 +85,7 @@ public let ScreenUsages: [ScreenUsage] = [
|
|
|
84
85
|
ScreenUsage(title: "DateTimePicker", destination: AnyView(DateTimePickerDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
85
86
|
ScreenUsage(title: "Navigation", destination: AnyView(NavigationDemo()), icon: getIcon(icon: "Layout")),
|
|
86
87
|
ScreenUsage(title: "Bottom Tab", destination: AnyView(BottomTabDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
|
|
88
|
+
ScreenUsage(title: "iPhone Duo", destination: AnyView(IPhoneDuoDemo()), icon: getIcon(icon: "Layout")),
|
|
87
89
|
ScreenUsage(title: "Animated Header", destination: AnyView(AnimatedHeaderDemo()), icon: getIcon(icon: "Layout")),
|
|
88
90
|
ScreenUsage(title: "Theme", destination: AnyView(ThemeDemo()), icon: getIcon(icon: "Typography")),
|
|
89
91
|
ScreenUsage(title: "Localize", destination: AnyView(LocalizeDemo()), icon: getIcon(icon: "Typography")),
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
//
|
|
2
|
+
// IPhoneDuoDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Mirrors RN `app/screens/IPhoneDuo`: the live screen layout, an extended header + search
|
|
6
|
+
// + footer screen, the Duo tab bars, the popup / bottom sheet behaviour and a grid to scroll.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import MoMoUIKits
|
|
10
|
+
import SwiftUI
|
|
11
|
+
|
|
12
|
+
private let gridRows: [[Int]] = [[12], [6, 6], [4, 4, 4], [3, 3, 3, 3]]
|
|
13
|
+
|
|
14
|
+
// enough rows to scroll, so the header glass and side bar can be checked
|
|
15
|
+
private let scrollRows: [[Int]] = Array(repeating: gridRows, count: 4).flatMap { $0 }
|
|
16
|
+
|
|
17
|
+
struct IPhoneDuoDemo: View {
|
|
18
|
+
var body: some View {
|
|
19
|
+
if #available(iOS 16.0, *) {
|
|
20
|
+
IPhoneDuoDemoContent()
|
|
21
|
+
} else {
|
|
22
|
+
Text("Requires iOS 16+").padding()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@available(iOS 16.0, *)
|
|
28
|
+
private struct IPhoneDuoDemoContent: View {
|
|
29
|
+
@EnvironmentObject private var navigator: Navigator
|
|
30
|
+
@Environment(\.screenLayout) private var layout
|
|
31
|
+
|
|
32
|
+
var body: some View {
|
|
33
|
+
VStack(alignment: .leading, spacing: Spacing.M) {
|
|
34
|
+
VStack(spacing: 0) {
|
|
35
|
+
ForEach(info, id: \.0) { label, value in
|
|
36
|
+
HStack {
|
|
37
|
+
MomoText(label, typography: .bodyDefaultRegular)
|
|
38
|
+
Spacer()
|
|
39
|
+
MomoText(value, typography: .headerSSemibold)
|
|
40
|
+
}
|
|
41
|
+
.padding(.vertical, Spacing.XS)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.padding(.horizontal, Spacing.M)
|
|
45
|
+
|
|
46
|
+
VStack(spacing: Spacing.S) {
|
|
47
|
+
demoButton("Extended header + footer") {
|
|
48
|
+
navigator.push({ DuoGridScreen() }, options: extendedOptions)
|
|
49
|
+
}
|
|
50
|
+
demoButton("Glass tab bar") {
|
|
51
|
+
navigator.push({ DuoTabDemo(useShortcut: false) }, options: tabOptions)
|
|
52
|
+
}
|
|
53
|
+
demoButton("Glass tab bar + useShortcut") {
|
|
54
|
+
navigator.push({ DuoTabDemo(useShortcut: true) }, options: tabOptions)
|
|
55
|
+
}
|
|
56
|
+
demoButton("Glass tab bar + compress tab bar") {
|
|
57
|
+
navigator.push({ DuoTabDemo(useShortcut: true, compressTabBar: true) }, options: tabOptions)
|
|
58
|
+
}
|
|
59
|
+
demoButton("Bottom sheet: iPhone Duo safe area") {
|
|
60
|
+
navigator.showBottomSheet({ BottomSheetSafeArea() }, isSurface: true, header: .title("Safe area"))
|
|
61
|
+
}
|
|
62
|
+
demoButton("PopupNotify") {
|
|
63
|
+
navigator.showModal {
|
|
64
|
+
PopupNotify(props: PopupNotifyProps(
|
|
65
|
+
image: "https://static.momocdn.net/app/img/popup_permission/img_permission_popup_camera.png",
|
|
66
|
+
title: "Title",
|
|
67
|
+
description: String(repeating: "Check lại một nhịp auto chuyển sang dạng CTA. ", count: 8),
|
|
68
|
+
primary: PopupAction(title: "Đồng ý", onPress: { navigator.hideOverplay() }),
|
|
69
|
+
secondary: PopupAction(title: "Đóng", onPress: { navigator.hideOverplay() }),
|
|
70
|
+
onIconClose: { navigator.hideOverplay() }
|
|
71
|
+
))
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.padding(.horizontal, Spacing.M)
|
|
76
|
+
|
|
77
|
+
DuoGrid()
|
|
78
|
+
}
|
|
79
|
+
.padding(.vertical, Spacing.M)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private var info: [(String, String)] {
|
|
83
|
+
let insets = layout.insets
|
|
84
|
+
return [
|
|
85
|
+
("iPhone Duo", layout.isIPhoneDuo ? "yes" : "no"),
|
|
86
|
+
("Window", "\(Int(layout.width)) x \(Int(layout.height))"),
|
|
87
|
+
("Safe area (T R B L)", "\(Int(insets.top)) \(Int(insets.trailing)) \(Int(insets.bottom)) \(Int(insets.leading))"),
|
|
88
|
+
("Content inset (L R)", "\(Int(layout.insetLeft)) \(Int(layout.insetRight))"),
|
|
89
|
+
("Content width", "\(Int(layout.contentWidth))"),
|
|
90
|
+
("Header height", "\(Int(layout.headerHeight))"),
|
|
91
|
+
("Side bar", layout.sideBar.map { "\($0.edge == .left ? "left" : "right"), \(Int($0.width))pt, top \(Int($0.top))" } ?? "none"),
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private var extendedOptions: NavigationOptions {
|
|
96
|
+
NavigationOptions(
|
|
97
|
+
title: "Extended",
|
|
98
|
+
headerType: .extended,
|
|
99
|
+
headerRightData: HeaderRightData(useShortcut: true),
|
|
100
|
+
footer: { AnyView(MoMoUIKits.Button(title: "Footer action", action: {}, size: .large)) }
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private var tabOptions: NavigationOptions {
|
|
105
|
+
NavigationOptions(title: "Duo tabs", headerType: .none, scrollable: false)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private func demoButton(_ title: String, action: @escaping () -> Void) -> some View {
|
|
109
|
+
MoMoUIKits.Button(title: title, action: action, type: .secondary, size: .small)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private struct DuoGridScreen: View {
|
|
114
|
+
var body: some View {
|
|
115
|
+
DuoGrid().padding(.vertical, Spacing.M)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private struct DuoGrid: View {
|
|
120
|
+
var body: some View {
|
|
121
|
+
VStack(spacing: Spacing.M) {
|
|
122
|
+
ForEach(scrollRows.indices, id: \.self) { row in
|
|
123
|
+
SectionView {
|
|
124
|
+
ForEach(scrollRows[row].indices, id: \.self) { index in
|
|
125
|
+
let span = scrollRows[row][index]
|
|
126
|
+
ItemView(widthSpan: span) {
|
|
127
|
+
MomoText("span \(span)", typography: .descriptionDefaultRegular)
|
|
128
|
+
.frame(maxWidth: .infinity)
|
|
129
|
+
.frame(height: 48)
|
|
130
|
+
.background(Colors.black04)
|
|
131
|
+
.clipShape(RoundedRectangle(cornerRadius: Radius.S))
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/// Markers on the content edges show the side safe area inside the sheet.
|
|
141
|
+
private struct BottomSheetSafeArea: View {
|
|
142
|
+
@Environment(\.screenLayout) private var layout
|
|
143
|
+
|
|
144
|
+
var body: some View {
|
|
145
|
+
VStack(alignment: .leading, spacing: Spacing.XS) {
|
|
146
|
+
HStack {
|
|
147
|
+
marker("← content edge")
|
|
148
|
+
Spacer()
|
|
149
|
+
marker("content edge →")
|
|
150
|
+
}
|
|
151
|
+
.padding(.bottom, Spacing.S)
|
|
152
|
+
MomoText("Window: \(Int(layout.width)) × \(Int(layout.height))", typography: .bodyDefaultRegular)
|
|
153
|
+
MomoText(
|
|
154
|
+
"Insets: top \(Int(layout.insets.top)) · right \(Int(layout.insets.trailing)) · bottom \(Int(layout.insets.bottom)) · left \(Int(layout.insets.leading))",
|
|
155
|
+
typography: .bodyDefaultRegular
|
|
156
|
+
)
|
|
157
|
+
MomoText(
|
|
158
|
+
"On iPhone Duo: the outer display keeps a full-width sheet with content inside the side safe area; the inner display centers the sheet, still attached to the bottom edge. Other devices are unchanged.",
|
|
159
|
+
typography: .descriptionDefaultRegular,
|
|
160
|
+
color: Colors.black12
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
.padding(.vertical, Spacing.M)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private func marker(_ text: String) -> some View {
|
|
167
|
+
MomoText(text, typography: .labelSMedium, color: Colors.pink03)
|
|
168
|
+
.padding(.vertical, Spacing.XS)
|
|
169
|
+
.padding(.horizontal, Spacing.S)
|
|
170
|
+
.background(Colors.black04)
|
|
171
|
+
.clipShape(RoundedRectangle(cornerRadius: Radius.XS))
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
//
|
|
5
5
|
// Usage demo for the navigation flow. Mirrors Compose's `NavigationUsage`:
|
|
6
6
|
// exercises push / present / replace / reset, the modal & bottom-sheet
|
|
7
|
-
// overplays, the snack bar, the
|
|
7
|
+
// overplays, the snack bar, the header titles, runtime options and the bottom-tab layout.
|
|
8
8
|
//
|
|
9
9
|
|
|
10
10
|
import MoMoUIKits
|
|
@@ -149,6 +149,52 @@ private struct NavigationDemoContent: View {
|
|
|
149
149
|
)
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
row("Header Location Title") {
|
|
153
|
+
navigator.push(
|
|
154
|
+
{ DemoLeafScreen(title: "Location title", color: Colors.blue09) },
|
|
155
|
+
options: NavigationOptions(
|
|
156
|
+
headerTitle: .location(
|
|
157
|
+
HeaderLocationData(description: "Deliver to", location: "123 Nguyen Hue, District 1", onPress: { print("location") })
|
|
158
|
+
)
|
|
159
|
+
)
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
row("Header Journey Title") {
|
|
164
|
+
navigator.push(
|
|
165
|
+
{ DemoLeafScreen(title: "Journey title", color: Colors.pink09) },
|
|
166
|
+
options: NavigationOptions(
|
|
167
|
+
headerTitle: .journey(
|
|
168
|
+
HeaderJourneyData(start: "Ho Chi Minh", end: "Ha Noi", description: "Mon, 12/10 · 1 adult", icon: "16_arrow_chevron_right", onPress: { print("journey") })
|
|
169
|
+
)
|
|
170
|
+
)
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
row("Update Options At Runtime") {
|
|
175
|
+
navigator.push(
|
|
176
|
+
{ UpdateOptionsScreen() },
|
|
177
|
+
options: NavigationOptions(title: "Before update")
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
row("Bottom Sheet With Footer") {
|
|
182
|
+
navigator.showBottomSheet({
|
|
183
|
+
VStack(spacing: 12) {
|
|
184
|
+
ForEach(0..<6, id: \.self) { i in
|
|
185
|
+
MomoText("Bottom sheet row \(i + 1)")
|
|
186
|
+
.frame(maxWidth: .infinity, alignment: .leading)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
.padding(Spacing.L)
|
|
190
|
+
}, header: .title("Footer"), draggable: false, footer: {
|
|
191
|
+
AnyView(
|
|
192
|
+
MoMoUIKits.Button(title: "Confirm", action: { navigator.hideOverplay() }, type: .primary, size: .large)
|
|
193
|
+
.padding(.horizontal, Spacing.M)
|
|
194
|
+
)
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
|
|
152
198
|
row("Header Animated") {
|
|
153
199
|
navigator.push(
|
|
154
200
|
{ AnimatedHeaderDemoContent() },
|
|
@@ -177,6 +223,36 @@ private struct NavigationDemoContent: View {
|
|
|
177
223
|
|
|
178
224
|
// MARK: - Leaf / presented screens
|
|
179
225
|
|
|
226
|
+
/// A screen changing its own header and footer after it is shown (Compose `LocalNavigation`).
|
|
227
|
+
@available(iOS 16.0, *)
|
|
228
|
+
private struct UpdateOptionsScreen: View {
|
|
229
|
+
@EnvironmentObject private var navigation: Navigation
|
|
230
|
+
@EnvironmentObject private var navigator: Navigator
|
|
231
|
+
|
|
232
|
+
var body: some View {
|
|
233
|
+
VStack(spacing: 16) {
|
|
234
|
+
MoMoUIKits.Button(title: "Change title", action: {
|
|
235
|
+
navigation.setOptions { $0.title = "Updated at \(Date().formatted(date: .omitted, time: .standard))" }
|
|
236
|
+
}, type: .primary, size: .large)
|
|
237
|
+
MoMoUIKits.Button(title: "Add footer", action: {
|
|
238
|
+
navigation.setOptions {
|
|
239
|
+
$0.footer = { AnyView(MoMoUIKits.Button(title: "Footer action", action: {}, type: .primary, size: .large)) }
|
|
240
|
+
}
|
|
241
|
+
}, type: .secondary, size: .large)
|
|
242
|
+
MoMoUIKits.Button(title: "Show snack bar above the footer", action: {
|
|
243
|
+
navigator.showSnackBar(.custom(duration: 2.0) {
|
|
244
|
+
MomoText("Snack bar", color: Colors.black01)
|
|
245
|
+
.frame(maxWidth: .infinity, minHeight: 48)
|
|
246
|
+
.background(Colors.black17)
|
|
247
|
+
.clipShape(RoundedRectangle(cornerRadius: Radius.M))
|
|
248
|
+
.padding(.horizontal, Spacing.M)
|
|
249
|
+
})
|
|
250
|
+
}, type: .secondary, size: .large)
|
|
251
|
+
}
|
|
252
|
+
.padding(16)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
180
256
|
@available(iOS 16.0, *)
|
|
181
257
|
private struct DemoLeafScreen: View {
|
|
182
258
|
@EnvironmentObject private var navigator: Navigator
|
|
@@ -26,7 +26,7 @@ private struct PopupNotifyPreview: View {
|
|
|
26
26
|
private func show() {
|
|
27
27
|
navigator.showModal {
|
|
28
28
|
PopupNotify(props: PopupNotifyProps(
|
|
29
|
-
image: "https://
|
|
29
|
+
image: "https://static.momocdn.net/app/img/popup_permission/img_permission_popup_camera.png",
|
|
30
30
|
title: "Title",
|
|
31
31
|
description: "Check lại một nhịp auto chuyển sang dạng CTA.",
|
|
32
32
|
error: "9004",
|
|
@@ -50,7 +50,7 @@ private let popupDirectionList: [PlaygroundOption] = [
|
|
|
50
50
|
@available(iOS 16.0, *)
|
|
51
51
|
private struct PopupNotifyPlayground: View {
|
|
52
52
|
@EnvironmentObject private var navigator: Navigator
|
|
53
|
-
@State private var image = "https://
|
|
53
|
+
@State private var image = "https://static.momocdn.net/app/img/popup_permission/img_permission_popup_camera.png"
|
|
54
54
|
@State private var title = "Title"
|
|
55
55
|
@State private var description = "Check lại một nhịp auto chuyển sang dạng CTA."
|
|
56
56
|
@State private var error = "9004"
|
|
@@ -37,6 +37,7 @@ private struct PopupPromotionPreview: View {
|
|
|
37
37
|
private func show(_ url: String) {
|
|
38
38
|
navigator.showModal {
|
|
39
39
|
PopupPromotion(imageUrl: url, onIconClose: { navigator.hideOverplay() }, onAction: { navigator.hideOverplay() })
|
|
40
|
+
.padding(.horizontal, Spacing.M)
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
}
|
|
@@ -62,6 +63,7 @@ private struct PopupPromotionPlayground: View {
|
|
|
62
63
|
private func show() {
|
|
63
64
|
navigator.showModal {
|
|
64
65
|
PopupPromotion(imageUrl: imageUrl, onIconClose: { navigator.hideOverplay() }, onAction: { navigator.hideOverplay() })
|
|
66
|
+
.padding(.horizontal, Spacing.M)
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
}
|