@momo-kits/native-kits 0.169.10-beta.1-debug → 0.169.10
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/ios/Application/DesignSystemKits.swift +2 -3
- package/ios/Application/LanguageSource.swift +2 -3
- package/ios/Application/Localize.swift +4 -7
- package/ios/Application/LocalizeModifier.swift +2 -3
- package/ios/Badge/Badge.swift +5 -7
- package/ios/Button/Button.swift +2 -3
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +3 -5
- package/ios/Carousel/Carousel.swift +2 -3
- package/ios/Collapse/Collapse.swift +17 -11
- package/ios/Extensions/ActiveOpacityButtonStyle.swift +2 -3
- package/ios/Icon/Icon.swift +2 -3
- package/ios/IconButton/IconButton.swift +2 -3
- package/ios/Input/InputSearch.swift +6 -23
- package/ios/Layout/ModalLayout.swift +2 -3
- package/ios/Layout/ScreenLayout.swift +10 -12
- package/ios/Layout/Section.swift +2 -3
- package/ios/Navigation/BottomSheet.swift +6 -9
- package/ios/Navigation/BottomTab/BottomTab.swift +6 -9
- package/ios/Navigation/BottomTab/BottomTabBar.swift +4 -6
- package/ios/Navigation/BottomTab/CurvedContainer.swift +2 -3
- package/ios/Navigation/BottomTab/DuoBarCompression.swift +2 -3
- package/ios/Navigation/BottomTab/DuoTabBar.swift +6 -6
- package/ios/Navigation/BottomTab/TabBarMetrics.swift +4 -6
- package/ios/Navigation/Component/Header.swift +46 -31
- package/ios/Navigation/Component/HeaderJourney.swift +1 -2
- package/ios/Navigation/Component/HeaderLocation.swift +1 -2
- package/ios/Navigation/Component/HeaderRight.swift +15 -18
- package/ios/Navigation/Component/HeaderUser.swift +1 -2
- package/ios/Navigation/Component/SideBar.swift +15 -7
- package/ios/Navigation/HostBackGestureBridge.swift +2 -3
- package/ios/Navigation/ModalScreen.swift +13 -11
- package/ios/Navigation/Navigation.swift +3 -9
- package/ios/Navigation/NavigationContainer.swift +4 -6
- package/ios/Navigation/Navigator.swift +12 -18
- package/ios/Navigation/StackScreen.swift +25 -40
- package/ios/Navigation/StackTransition.swift +7 -6
- package/ios/Skeleton/Skeleton.swift +3 -6
- package/ios/Steps/Steps.swift +20 -15
- package/ios/TabView/TabView.swift +2 -3
- package/ios/Title/Title.swift +1 -3
- package/ios/Typography/FontScale.swift +6 -9
- package/ios/Typography/Text.swift +2 -3
- package/ios/Typography/Typography.swift +3 -4
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +2 -11
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +0 -11
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +1 -1
- package/package.json +1 -1
- package/build.gradle.kts +0 -11
- package/compose/build.gradle.kts +0 -198
- package/compose/compose.podspec +0 -47
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -154
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +0 -17
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1067
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -267
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -482
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -224
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -195
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -473
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -113
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -263
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -228
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -280
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -183
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -82
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -39
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -363
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -307
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -88
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -306
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -457
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -205
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -89
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -542
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -120
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -201
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -210
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -292
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +0 -67
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +0 -184
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -316
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -397
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -153
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -118
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -422
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -747
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -242
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -400
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -100
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -97
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -207
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +0 -132
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -167
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -446
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -105
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -398
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -197
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -114
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +0 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
- package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -218
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +0 -48
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -144
- package/gradle/libs.versions.toml +0 -67
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +0 -8
- package/gradle.properties +0 -24
- package/gradlew +0 -252
- package/gradlew.bat +0 -94
- package/ios/Layout/HeaderLayout.swift +0 -67
- package/ios-demo/README.md +0 -120
- package/settings.gradle.kts +0 -64
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// SwiftUI mirror of Compose's `navigation/StackScreen.kt`: header layer, scrollable content
|
|
2
|
-
//
|
|
3
|
-
// iPhone Duo side bar.
|
|
1
|
+
// SwiftUI mirror of Compose's `navigation/StackScreen.kt`: header layer, scrollable content (`StackScreenContent`),
|
|
2
|
+
// animated search, floating button, footer (`NavigationFooter`) and the iPhone Duo side bar.
|
|
4
3
|
|
|
5
4
|
import SwiftUI
|
|
6
5
|
|
|
@@ -34,7 +33,6 @@ public struct StackScreen<Content: View>: View {
|
|
|
34
33
|
var layoutOffset: CGFloat
|
|
35
34
|
var inputSearchProps: InputSearchProps?
|
|
36
35
|
var fabProps: FabProps?
|
|
37
|
-
var contentLayout: ContentLayout = .grid
|
|
38
36
|
var screenName: String = ""
|
|
39
37
|
var content: () -> Content
|
|
40
38
|
|
|
@@ -66,7 +64,6 @@ public struct StackScreen<Content: View>: View {
|
|
|
66
64
|
layoutOffset: CGFloat = 56,
|
|
67
65
|
inputSearchProps: InputSearchProps? = nil,
|
|
68
66
|
fabProps: FabProps? = nil,
|
|
69
|
-
contentLayout: ContentLayout = .grid,
|
|
70
67
|
screenName: String = "",
|
|
71
68
|
@ViewBuilder content: @escaping () -> Content
|
|
72
69
|
) {
|
|
@@ -97,7 +94,6 @@ public struct StackScreen<Content: View>: View {
|
|
|
97
94
|
self.layoutOffset = layoutOffset
|
|
98
95
|
self.inputSearchProps = inputSearchProps
|
|
99
96
|
self.fabProps = fabProps
|
|
100
|
-
self.contentLayout = contentLayout
|
|
101
97
|
self.screenName = screenName
|
|
102
98
|
self.content = content
|
|
103
99
|
}
|
|
@@ -160,8 +156,8 @@ public struct StackScreen<Content: View>: View {
|
|
|
160
156
|
|
|
161
157
|
/// iPhone Duo: content scrolls under a glass header instead of starting below it.
|
|
162
158
|
private var useDuoGlass: Bool {
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
let hasPlainHeader = headerType != .none && animatedHeader == nil && inputSearchProps == nil
|
|
160
|
+
return layout.sideBar != nil && hasPlainHeader && !headerTransparent && !fullScreenContent
|
|
165
161
|
}
|
|
166
162
|
|
|
167
163
|
/// Bottom room for the tab's content: clear of the floating bar, unless the tab runs edge to edge
|
|
@@ -310,7 +306,6 @@ public struct StackScreen<Content: View>: View {
|
|
|
310
306
|
}
|
|
311
307
|
}
|
|
312
308
|
.ignoresSafeArea(.keyboard, edges: .bottom)
|
|
313
|
-
.environment(\.contentLayout, contentLayout)
|
|
314
309
|
.onChange(of: scrollOffset) { updateHeaderHide($0) }
|
|
315
310
|
.onAppear { reportEmptySideBar() }
|
|
316
311
|
.onChange(of: showsSideBar) { _ in reportEmptySideBar() }
|
|
@@ -337,9 +332,8 @@ public struct StackScreen<Content: View>: View {
|
|
|
337
332
|
.onDisappear { tracking?.cancel() }
|
|
338
333
|
}
|
|
339
334
|
|
|
340
|
-
/// Compose tracks from a `LaunchedEffect
|
|
341
|
-
///
|
|
342
|
-
/// `@State` and doesn't re-run `.task`, so the run hangs off appear / disappear instead.
|
|
335
|
+
/// Compose tracks from a `LaunchedEffect`, fresh on every visit (first show, pop back, tab switch). A covered
|
|
336
|
+
/// hosting controller keeps its `@State` and doesn't re-run `.task`, so tracking hangs off appear / disappear.
|
|
343
337
|
private func startTracking() {
|
|
344
338
|
tracking?.cancel()
|
|
345
339
|
let state = ScreenTrackingState()
|
|
@@ -510,28 +504,18 @@ public struct StackScreen<Content: View>: View {
|
|
|
510
504
|
}
|
|
511
505
|
|
|
512
506
|
private func heroGlassStart(_ animatedHeader: AnimatedHeader) -> CGFloat {
|
|
513
|
-
max(
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
/// Wide windows and the iPhone Duo inner display keep the phone banner size, centered; phones fill the width.
|
|
517
|
-
private var bannerWidth: CGFloat {
|
|
518
|
-
layout.headerLayout(contentLayout).isBannerCentered ? HeaderLayoutMetrics.bannerWidth : layout.width
|
|
507
|
+
max(layout.width / animatedHeader.aspectRatio.value - layout.headerHeight, 0)
|
|
519
508
|
}
|
|
520
509
|
|
|
521
510
|
/// The banner fills the width at its aspect ratio; the body starts `layoutOffset` below the
|
|
522
|
-
/// header band so it overlaps the banner's lower part.
|
|
523
|
-
/// `bannerBackgroundColor` fills the sides, fading out downward.
|
|
511
|
+
/// header band so it overlaps the banner's lower part.
|
|
524
512
|
@ViewBuilder
|
|
525
513
|
private func animatedHeroBody(_ animatedHeader: AnimatedHeader) -> some View {
|
|
526
|
-
let width =
|
|
514
|
+
let width = layout.width
|
|
527
515
|
let imageHeight = width / animatedHeader.aspectRatio.value
|
|
528
516
|
let contentTopInset = layout.headerHeight + layoutOffset
|
|
529
517
|
|
|
530
518
|
ZStack(alignment: .top) {
|
|
531
|
-
if width < layout.width, let fill = animatedHeader.bannerBackgroundColor {
|
|
532
|
-
LinearGradient(colors: [fill, fill.opacity(0)], startPoint: .top, endPoint: .bottom)
|
|
533
|
-
.frame(width: layout.width, height: imageHeight)
|
|
534
|
-
}
|
|
535
519
|
animatedHeader.composable(scrollOffset)
|
|
536
520
|
.frame(width: width, height: imageHeight)
|
|
537
521
|
.clipped()
|
|
@@ -749,10 +733,16 @@ private struct SearchAnimatedHeader: View {
|
|
|
749
733
|
var hasToolkit: Bool = false
|
|
750
734
|
|
|
751
735
|
@Environment(\.screenLayout) private var layout
|
|
752
|
-
@Environment(\.contentLayout) private var contentLayout
|
|
753
736
|
@Environment(\.appTheme) private var theme
|
|
754
737
|
@OptionalEnvironmentObject private var navigator: Navigator?
|
|
755
738
|
|
|
739
|
+
private var maxEndInset: CGFloat {
|
|
740
|
+
if useSideBar && hasToolkit {
|
|
741
|
+
return Spacing.M
|
|
742
|
+
}
|
|
743
|
+
return headerRightWidth + (hasHeaderRight ? Spacing.M * 2 : Spacing.M)
|
|
744
|
+
}
|
|
745
|
+
|
|
756
746
|
var body: some View {
|
|
757
747
|
let scroll = max(scrollOffset, 0)
|
|
758
748
|
|
|
@@ -760,14 +750,12 @@ private struct SearchAnimatedHeader: View {
|
|
|
760
750
|
let rowTop = layout.headerStatusBarHeight - layout.insets.top
|
|
761
751
|
let minTop = rowTop + (layout.headerBarHeight - HEADER_HEIGHT) / 2
|
|
762
752
|
let maxTop = layout.headerHeight - layout.insets.top
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
// collapsed on the iPhone Duo status bar row, the search stays between its clusters
|
|
753
|
+
let minSide = Spacing.M
|
|
754
|
+
// collapsed on the iPhone Duo status bar row, the search stays between its clusters (48pt back there)
|
|
766
755
|
let clearance = layout.statusBarClearance
|
|
767
|
-
let
|
|
768
|
-
let
|
|
769
|
-
|
|
770
|
-
: headerRightWidth + (hasHeaderRight ? minSide + Spacing.M : minSide))
|
|
756
|
+
let backWidth: CGFloat = clearance != nil && !useSideBar ? DuoMetrics.controlSize : 28
|
|
757
|
+
let maxStart = (clearance?.left ?? 0) + (hiddenBack || useSideBar ? Spacing.M : backWidth + Spacing.M + Spacing.S)
|
|
758
|
+
let maxEnd = (clearance?.right ?? 0) + maxEndInset
|
|
771
759
|
|
|
772
760
|
// one progress for all three, so the field docks with its final insets and never covers the toolkit
|
|
773
761
|
let progress = min(scroll / HEADER_HEIGHT, 1)
|
|
@@ -783,7 +771,6 @@ private struct SearchAnimatedHeader: View {
|
|
|
783
771
|
theme: theme,
|
|
784
772
|
pop: navigator.map { navigator in { navigator.pop() } }
|
|
785
773
|
))
|
|
786
|
-
.headerSize()
|
|
787
774
|
.frame(height: HEADER_HEIGHT)
|
|
788
775
|
.padding(.leading, start)
|
|
789
776
|
.padding(.trailing, end)
|
|
@@ -803,9 +790,8 @@ private struct FloatingContent: View {
|
|
|
803
790
|
let hasFooter: Bool
|
|
804
791
|
let scrollOffset: CGFloat
|
|
805
792
|
|
|
806
|
-
/// Compose keeps the FAB `Spacing.M + AppNavigationBar`
|
|
807
|
-
///
|
|
808
|
-
/// nothing lifts it, so the difference is applied as an offset (see NavigationFooter).
|
|
793
|
+
/// Compose keeps the FAB `Spacing.M + AppNavigationBar` up and lifts it with `imePadding()`; here it sits
|
|
794
|
+
/// `Spacing.M` above the safe area with nothing lifting it, so the difference is an offset (see NavigationFooter).
|
|
809
795
|
private var verticalOffset: CGFloat {
|
|
810
796
|
if hasFooter { return NavigationFooter.verticalOffset(keyboardSize: keyboardSize) }
|
|
811
797
|
return NavigationFooter.safeAreaBottom - NavigationFooter.navigationBarInset - keyboardSize
|
|
@@ -869,9 +855,8 @@ public struct NavigationFooter: View {
|
|
|
869
855
|
max(navigationBarInset + Spacing.S - safeAreaBottom, 0)
|
|
870
856
|
}
|
|
871
857
|
|
|
872
|
-
/// An offset, not padding: growing the footer feeds back into
|
|
873
|
-
///
|
|
874
|
-
/// `FloatingContent` rides the same amount so the FAB keeps its distance above the band.
|
|
858
|
+
/// An offset, not padding: growing the footer feeds back into keyboard avoidance and never settles. Lands at
|
|
859
|
+
/// Compose's `max(navigationBar, keyboard) + Spacing.S`; `FloatingContent` rides it so the FAB keeps its gap.
|
|
875
860
|
static func verticalOffset(keyboardSize: CGFloat) -> CGFloat {
|
|
876
861
|
(safeAreaBottom + bottomPadding) - (max(navigationBarInset, keyboardSize) + Spacing.S)
|
|
877
862
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// SwiftUI mirror of Compose's `navigation/StackTransition.kt` (RN `forStackTransitionWithOverlay`)
|
|
2
|
-
//
|
|
3
|
-
// with UINavigationController; motion is a SwiftUI `offset`, which unlike a transform keeps the safe area.
|
|
1
|
+
// SwiftUI mirror of Compose's `navigation/StackTransition.kt` (RN `forStackTransitionWithOverlay`) and its NavHost.
|
|
2
|
+
// One UIHostingController per entry, out of the window while covered; motion is an `offset` to keep the safe area.
|
|
4
3
|
|
|
5
4
|
import SwiftUI
|
|
6
5
|
import UIKit
|
|
@@ -219,9 +218,11 @@ final class StackController: UIViewController {
|
|
|
219
218
|
let fraction = min(max((link.targetTimestamp - start) / transition.duration, 0), 1)
|
|
220
219
|
// linear for the stack: the gesture maps the finger straight onto this timeline
|
|
221
220
|
let eased = transition.kind == .rise ? fastOutSlowIn(CGFloat(fraction)) : CGFloat(fraction)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
if fraction >= 1 {
|
|
222
|
+
transition.coverage = transition.target
|
|
223
|
+
} else {
|
|
224
|
+
transition.coverage = transition.from + (transition.target - transition.from) * eased
|
|
225
|
+
}
|
|
225
226
|
apply(transition)
|
|
226
227
|
if fraction >= 1 { finish(transition) }
|
|
227
228
|
}
|
|
@@ -29,9 +29,7 @@ public struct Skeleton: View {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
///
|
|
33
|
-
/// a linear gradient band (60% of the container width) translated across the
|
|
34
|
-
/// surface on an infinite, restarting, linearly-eased loop.
|
|
32
|
+
/// Compose's `Modifier.shimmerLoadingAnimation`: a gradient band 60% of the width sweeps across on a linear loop.
|
|
35
33
|
private struct ShimmerLoading: View {
|
|
36
34
|
let size: CGSize
|
|
37
35
|
let durationMillis: Int
|
|
@@ -50,9 +48,8 @@ private struct ShimmerLoading: View {
|
|
|
50
48
|
(size.width * Self.shadowBrushPercentage).rounded(.towardZero)
|
|
51
49
|
}
|
|
52
50
|
|
|
53
|
-
// Compose animates
|
|
54
|
-
//
|
|
55
|
-
// from off-screen-left to off-screen-right: -widthOfShadowBrush ... maxWidth.
|
|
51
|
+
// Compose animates to `durationMillis + widthOfShadowBrush`; the band is anchored at the value, so the travel
|
|
52
|
+
// that shows runs from fully off-screen left to fully off-screen right: -widthOfShadowBrush ... maxWidth.
|
|
56
53
|
private var animationTarget: CGFloat {
|
|
57
54
|
size.width + widthOfShadowBrush
|
|
58
55
|
}
|
package/ios/Steps/Steps.swift
CHANGED
|
@@ -180,10 +180,8 @@ private struct StepsHorizontal: View {
|
|
|
180
180
|
disabled: disabled
|
|
181
181
|
)
|
|
182
182
|
let isActiveOrError = status == .current || status == .error
|
|
183
|
-
let titleStyle: TypographyStyle = isActiveOrError
|
|
184
|
-
|
|
185
|
-
let descStyle: TypographyStyle = size == .small
|
|
186
|
-
? .descriptionXsRegular : .descriptionDefaultRegular
|
|
183
|
+
let titleStyle: TypographyStyle = isActiveOrError ? .headerXsSemibold : .descriptionDefaultRegular
|
|
184
|
+
let descStyle: TypographyStyle = size == .small ? .descriptionXsRegular : .descriptionDefaultRegular
|
|
187
185
|
let titleColor = resolveTitleColor(status, theme: theme)
|
|
188
186
|
let subColor = disabled ? theme.colors.text.disable : theme.colors.text.hint
|
|
189
187
|
|
|
@@ -193,12 +191,8 @@ private struct StepsHorizontal: View {
|
|
|
193
191
|
let hideLineLeft = align == .left || (align == .stretch && index == 0)
|
|
194
192
|
let hideLineRight = align == .right || (align == .stretch && index == steps.count - 1)
|
|
195
193
|
|
|
196
|
-
let lineLeft
|
|
197
|
-
|
|
198
|
-
: (activeIndex >= index ? completedLine : defaultLine)
|
|
199
|
-
let lineRight: Color = index == steps.count - 1
|
|
200
|
-
? Color.clear
|
|
201
|
-
: (activeIndex > index ? completedLine : defaultLine)
|
|
194
|
+
let lineLeft = lineColor(isOuterEnd: index == 0, isCompleted: activeIndex >= index)
|
|
195
|
+
let lineRight = lineColor(isOuterEnd: index == steps.count - 1, isCompleted: activeIndex > index)
|
|
202
196
|
|
|
203
197
|
let clickable = status == .completed && onPress != nil && !disabled
|
|
204
198
|
|
|
@@ -264,6 +258,13 @@ private struct StepsHorizontal: View {
|
|
|
264
258
|
}
|
|
265
259
|
}
|
|
266
260
|
|
|
261
|
+
private func lineColor(isOuterEnd: Bool, isCompleted: Bool) -> Color {
|
|
262
|
+
if isOuterEnd {
|
|
263
|
+
return .clear
|
|
264
|
+
}
|
|
265
|
+
return isCompleted ? completedLine : defaultLine
|
|
266
|
+
}
|
|
267
|
+
|
|
267
268
|
private func horizontalAlignment(for index: Int) -> HorizontalAlignment {
|
|
268
269
|
switch align {
|
|
269
270
|
case .left: return .leading
|
|
@@ -335,11 +336,8 @@ private struct StepsVertical: View {
|
|
|
335
336
|
let isActiveOrError = status == .current || status == .error
|
|
336
337
|
let isLast = index == steps.count - 1
|
|
337
338
|
|
|
338
|
-
let titleStyle
|
|
339
|
-
|
|
340
|
-
: (useSmall ? .descriptionDefaultRegular : .bodyDefaultRegular)
|
|
341
|
-
let descStyle: TypographyStyle = useSmall
|
|
342
|
-
? .descriptionXsRegular : .descriptionDefaultRegular
|
|
339
|
+
let titleStyle = resolveTitleStyle(isActiveOrError: isActiveOrError)
|
|
340
|
+
let descStyle: TypographyStyle = useSmall ? .descriptionXsRegular : .descriptionDefaultRegular
|
|
343
341
|
|
|
344
342
|
let titleColor = resolveTitleColor(status, theme: theme)
|
|
345
343
|
let subColor = disabled ? theme.colors.text.disable : theme.colors.text.hint
|
|
@@ -402,6 +400,13 @@ private struct StepsVertical: View {
|
|
|
402
400
|
rowBody
|
|
403
401
|
}
|
|
404
402
|
}
|
|
403
|
+
|
|
404
|
+
private func resolveTitleStyle(isActiveOrError: Bool) -> TypographyStyle {
|
|
405
|
+
if isActiveOrError {
|
|
406
|
+
return useSmall ? .headerXsSemibold : .headerSSemibold
|
|
407
|
+
}
|
|
408
|
+
return useSmall ? .descriptionDefaultRegular : .bodyDefaultRegular
|
|
409
|
+
}
|
|
405
410
|
}
|
|
406
411
|
|
|
407
412
|
// MARK: - Public API
|
|
@@ -465,9 +465,8 @@ private struct CardTabEarShape: Shape {
|
|
|
465
465
|
)
|
|
466
466
|
path.addLine(to: CGPoint(x: 0, y: 44))
|
|
467
467
|
path.closeSubpath()
|
|
468
|
-
return
|
|
469
|
-
|
|
470
|
-
: path
|
|
468
|
+
guard mirrored else { return path }
|
|
469
|
+
return path.applying(CGAffineTransform(a: -1, b: 0, c: 0, d: 1, tx: rect.width, ty: 0))
|
|
471
470
|
}
|
|
472
471
|
}
|
|
473
472
|
|
package/ios/Title/Title.swift
CHANGED
|
@@ -129,9 +129,7 @@ public struct Title: View {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
private var trailingBackground: Color {
|
|
132
|
-
type == .section
|
|
133
|
-
? Colors.black06.opacity(0.6)
|
|
134
|
-
: Colors.black06.opacity(0.3)
|
|
132
|
+
Colors.black06.opacity(type == .section ? 0.6 : 0.3)
|
|
135
133
|
}
|
|
136
134
|
|
|
137
135
|
// MARK: - Body
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import SwiftUI
|
|
2
2
|
|
|
3
|
-
/// Immutable snapshot of the
|
|
4
|
-
///
|
|
5
|
-
/// computed independently and the larger one wins.
|
|
3
|
+
/// Immutable snapshot of the font-scale inputs; formula 1:1 with Compose's `scaleSize()` (`const/Typography.kt`):
|
|
4
|
+
/// the device-width and OS Dynamic Type scales are computed independently and the larger wins.
|
|
6
5
|
public struct FontScale: Equatable {
|
|
7
6
|
private static let defaultScreenSize: CGFloat = 375
|
|
8
7
|
private static let maxFontScale: CGFloat = 1.5
|
|
@@ -14,9 +13,8 @@ public struct FontScale: Equatable {
|
|
|
14
13
|
public let osFontScale: CGFloat
|
|
15
14
|
/// From the app window, not UIScreen.main (which stays on one display on iPhone Duo).
|
|
16
15
|
public let windowShortSide: CGFloat
|
|
17
|
-
///
|
|
18
|
-
///
|
|
19
|
-
/// `MiniAppContext.scaleSizeMaxRate`.
|
|
16
|
+
/// Caps the result at size × maxScaleRate on both the userScaleRate and OS paths, nil = no cap. Set it with
|
|
17
|
+
/// `ScaleSizeScope` or `MiniAppContext.scaleSizeMaxRate` (Compose parity).
|
|
20
18
|
public let maxScaleRate: CGFloat?
|
|
21
19
|
|
|
22
20
|
public init(
|
|
@@ -101,9 +99,8 @@ public extension EnvironmentValues {
|
|
|
101
99
|
}
|
|
102
100
|
|
|
103
101
|
public extension View {
|
|
104
|
-
/// Injects a
|
|
105
|
-
///
|
|
106
|
-
/// Use at every `UIHostingController` root that is not inside a `NavigationContainer`.
|
|
102
|
+
/// Injects a live font scale plus `\.designSystemKitsConfigs` (whitelist, remote config). Needed at every
|
|
103
|
+
/// `UIHostingController` root outside a `NavigationContainer`.
|
|
107
104
|
func momoFontScale(_ store: DesignSystemKits = .shared, context: MiniAppContext? = nil) -> some View {
|
|
108
105
|
modifier(MomoFontScaleModifier(store: store, context: context))
|
|
109
106
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import SwiftUI
|
|
2
2
|
|
|
3
|
-
/// Non-reactive
|
|
4
|
-
///
|
|
5
|
-
/// re-renders when Dynamic Type or the host preference changes.
|
|
3
|
+
/// Non-reactive, for call sites that can't read the environment (UIKit bridges, free functions). In a view use
|
|
4
|
+
/// `@Environment(\.momoFontScale)` so it re-renders when Dynamic Type or the host preference changes.
|
|
6
5
|
public func scaleSize(_ size: CGFloat) -> CGFloat {
|
|
7
6
|
DesignSystemKits.shared.fontScale(size)
|
|
8
7
|
}
|
|
@@ -9,14 +9,13 @@ public extension View {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
public extension Font {
|
|
12
|
-
/// Non-reactive: reads the
|
|
13
|
-
///
|
|
14
|
-
/// `fontScale.font(size:weight:)` also re-renders on change.
|
|
12
|
+
/// Non-reactive: reads the scale on each access, so the styles below are computed (a `static let` would freeze
|
|
13
|
+
/// it). In a view, `@Environment(\.momoFontScale)` + `fontScale.font(size:weight:)` also re-renders on change.
|
|
15
14
|
static func appFont(size: CGFloat) -> Font {
|
|
16
15
|
DesignSystemKits.shared.fontScale.font(size: size)
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
//
|
|
18
|
+
// Supported styles
|
|
20
19
|
static var headline_default_bold: Font { appFont(size: 24).weight(.bold) }
|
|
21
20
|
static var header_m_bold: Font { appFont(size: 18).weight(.bold) }
|
|
22
21
|
static var header_default_bold: Font { appFont(size: 16).weight(.bold) }
|
package/ios/native-kits.podspec
CHANGED
|
@@ -30,7 +30,6 @@ struct AnimatedHeaderDemoContent: View {
|
|
|
30
30
|
|
|
31
31
|
@State private var ratio: AnimatedHeaderRatio = .ratio16_9
|
|
32
32
|
@State private var isSurface = true
|
|
33
|
-
@State private var isStretch = true
|
|
34
33
|
|
|
35
34
|
private let imageUrl = "https://static.momocdn.net/app/img/booking/holiday/mid_atumn_dldl.jpeg"
|
|
36
35
|
|
|
@@ -48,11 +47,6 @@ struct AnimatedHeaderDemoContent: View {
|
|
|
48
47
|
MomoText("Surface")
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
// wide windows (short side >= 600): phone-sized banner, sides filled with the banner color
|
|
52
|
-
Toggle(isOn: $isStretch) {
|
|
53
|
-
MomoText("Stretch content layout")
|
|
54
|
-
}
|
|
55
|
-
|
|
56
50
|
MoMoUIKits.Button(
|
|
57
51
|
title: "Show Animated Header",
|
|
58
52
|
action: show,
|
|
@@ -69,7 +63,6 @@ struct AnimatedHeaderDemoContent: View {
|
|
|
69
63
|
private func show() {
|
|
70
64
|
let ratio = ratio
|
|
71
65
|
let isSurface = isSurface
|
|
72
|
-
let contentLayout: ContentLayout = isStretch ? .stretch : .grid
|
|
73
66
|
let url = imageUrl
|
|
74
67
|
navigator.push(
|
|
75
68
|
{ AnimatedHeaderTargetScreen(ratio: ratio) },
|
|
@@ -84,10 +77,8 @@ struct AnimatedHeaderDemoContent: View {
|
|
|
84
77
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
85
78
|
.clipped()
|
|
86
79
|
)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
),
|
|
90
|
-
contentLayout: contentLayout
|
|
80
|
+
}
|
|
81
|
+
)
|
|
91
82
|
)
|
|
92
83
|
)
|
|
93
84
|
}
|
|
@@ -273,9 +273,7 @@ private struct HeaderTypesScreen: View {
|
|
|
273
273
|
|
|
274
274
|
@EnvironmentObject private var navigation: Navigation
|
|
275
275
|
@Environment(\.applicationEnvironment) private var applicationEnvironment
|
|
276
|
-
@Environment(\.screenLayout) private var layout
|
|
277
276
|
@State private var kind: AnyHashable = Kind.default
|
|
278
|
-
@State private var contentLayout: AnyHashable = ContentLayout.grid
|
|
279
277
|
@State private var titlePosition: AnyHashable = TitlePosition.left
|
|
280
278
|
@State private var showBack = true
|
|
281
279
|
@State private var headerRight: AnyHashable = HeaderRightOption.toolkit
|
|
@@ -297,15 +295,6 @@ private struct HeaderTypesScreen: View {
|
|
|
297
295
|
}, label: position == .left ? "LEFT" : "CENTER")
|
|
298
296
|
}
|
|
299
297
|
Divider()
|
|
300
|
-
// stretch only differs on wide windows (short side >= 600, iPhone Duo excluded)
|
|
301
|
-
let headerLayout = layout.headerLayout(contentLayout.base as? ContentLayout ?? .grid)
|
|
302
|
-
MomoText("Content Layout · wide: \(headerLayout.isWide), frame inset: \(Int(headerLayout.frameInset))")
|
|
303
|
-
ForEach([ContentLayout.grid, ContentLayout.stretch], id: \.self) { item in
|
|
304
|
-
Radio(value: item, groupValue: $contentLayout, onChange: {
|
|
305
|
-
navigation.setOptions { $0.contentLayout = item }
|
|
306
|
-
}, label: item == .grid ? "Grid" : "Stretch")
|
|
307
|
-
}
|
|
308
|
-
Divider()
|
|
309
298
|
Checkbox($showBack, onChange: { checked in
|
|
310
299
|
navigation.setOptions { $0.hiddenBack = !checked }
|
|
311
300
|
}, title: "Show Back")
|
|
@@ -14,7 +14,7 @@ struct PopupNotifyDemo: View {
|
|
|
14
14
|
// MARK: - Preview
|
|
15
15
|
|
|
16
16
|
// Figma Risk - eKYC (node 51445-177824)
|
|
17
|
-
private let popupHighlightTitle = "Tạm khoá giao dịch để
|
|
17
|
+
private let popupHighlightTitle = "Tạm khoá giao dịch để bảo vệ bạn"
|
|
18
18
|
private let popupHighlightSentence =
|
|
19
19
|
"Mỗi ngày có ít nhất 20 người bị lừa đảo hơn 100 triệu đồng trong các giao dịch có dấu hiệu tương tự"
|
|
20
20
|
private let popupHighlightDescription =
|
package/package.json
CHANGED
package/build.gradle.kts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
plugins {
|
|
2
|
-
// this is necessary to avoid the plugins to be loaded multiple times
|
|
3
|
-
// in each subproject's classloader
|
|
4
|
-
alias(libs.plugins.android.application) apply false
|
|
5
|
-
alias(libs.plugins.android.library) apply false
|
|
6
|
-
alias(libs.plugins.compose) apply false
|
|
7
|
-
alias(libs.plugins.kotlin.compose.compiler) apply false
|
|
8
|
-
alias(libs.plugins.jetbrains.kotlin.multiplatform) apply false
|
|
9
|
-
alias(libs.plugins.jetbrains.kotlin.serialization) apply false
|
|
10
|
-
alias(libs.plugins.vanniktech.mavenPublish) apply false
|
|
11
|
-
}
|