@momo-kits/native-kits 0.167.1-duo.8 → 0.167.1-duo.9-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 +4 -1
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +204 -0
- package/compose/build.gradle.kts.backup +204 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +19 -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/AnimationSearchInput.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +124 -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 +831 -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 +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 +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 +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 +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +18 -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 +297 -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 +232 -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 +106 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +205 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +393 -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 +708 -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 +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +209 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +231 -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 +98 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +312 -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 +408 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +92 -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 +366 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +37 -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/SideBar.kt +185 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +127 -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 +13 -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/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +40 -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 +32 -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 +86 -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 +11 -0
- package/ios/Application/ComposeApi.swift +2 -1
- package/ios/Application/{Components.swift → LegacyHeader.swift} +6 -62
- package/ios/Application/Screen.swift +3 -2
- 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 +0 -1
- package/ios/Button/Button.swift +15 -12
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +12 -20
- 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 +9 -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 +18 -0
- package/ios/Icon/Icon.swift +7 -1
- package/ios/IconButton/IconButton.swift +15 -7
- package/ios/Image/Image.swift +7 -34
- package/ios/Information/Information.swift +27 -9
- package/ios/Input/ErrorView.swift +2 -2
- package/ios/Input/Input.swift +160 -147
- package/ios/Input/InputPhoneNumber.swift +12 -9
- package/ios/Input/InputSearch.swift +102 -75
- package/ios/Input/InputTextArea.swift +128 -145
- package/ios/InputDropDown/InputDropDown.swift +10 -7
- package/ios/InputMoney/InputMoney.swift +33 -11
- package/ios/InputOTP/InputOTP.swift +22 -12
- package/ios/Layout/Card.swift +50 -0
- package/ios/Layout/GridContext.swift +123 -3
- package/ios/Layout/Item.swift +5 -4
- package/ios/Layout/Section.swift +4 -100
- package/ios/Loader/Loader.swift +5 -9
- package/ios/Lottie/LottieView.swift +10 -0
- package/ios/{Application/Navigation/Overplay → Navigation}/BottomSheet.swift +61 -9
- package/ios/{Application/Navigation → Navigation}/BottomTab/BottomTab.swift +60 -34
- package/ios/{Application/Navigation → Navigation}/BottomTab/BottomTabBar.swift +11 -6
- package/ios/{Application → Navigation/Component}/FloatingButton.swift +14 -3
- package/ios/Navigation/Component/Header.swift +493 -0
- package/ios/Navigation/Component/HeaderBackground.swift +134 -0
- package/ios/Navigation/Component/HeaderJourney.swift +73 -0
- package/ios/Navigation/Component/HeaderLocation.swift +48 -0
- package/ios/Navigation/Component/HeaderRight.swift +386 -0
- package/ios/Navigation/Component/HeaderTitle.swift +36 -0
- package/ios/{Application/Navigation → Navigation/Component}/HeaderUser.swift +20 -23
- package/ios/{Application/Navigation/component → Navigation/Component}/SideBar.swift +49 -28
- package/ios/{Application/Navigation/Overplay → Navigation/Component}/SnackBar.swift +5 -5
- package/ios/Navigation/HostBackGestureBridge.swift +57 -0
- package/ios/Navigation/Navigation.swift +190 -0
- package/ios/{Application/Navigation → Navigation}/NavigationContainer.swift +46 -41
- package/ios/{Application/Navigation → Navigation}/Navigator.swift +65 -9
- package/ios/{Application → Navigation}/StackScreen.swift +236 -103
- 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 +79 -159
- package/ios/Popup/PopupInput.swift +10 -13
- package/ios/Popup/PopupLayout.swift +97 -2
- package/ios/Popup/PopupNotify.swift +27 -55
- package/ios/Popup/PopupPromotion.swift +22 -50
- 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/ScrollIndicator/ScrollIndicator.swift +11 -10
- package/ios/Skeleton/Skeleton.swift +22 -27
- package/ios/Slider/Slider.swift +16 -18
- package/ios/Stepper/Stepper.swift +6 -1
- 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 +41 -27
- package/ios/Title/Title.swift +6 -17
- package/ios/Tooltip/Tooltip.swift +29 -14
- package/ios/Typography/Text.swift +61 -19
- package/ios/Uploader/Uploader.swift +3 -1
- package/ios/native-kits.podspec +1 -0
- package/ios-demo/README.md +120 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +77 -1
- package/package.json +1 -1
- package/settings.gradle.kts +64 -0
- package/ios/Application/HeaderRight.swift +0 -324
- package/ios/Application/Navigation/HeaderBackProps.swift +0 -66
- package/ios/Application/Navigation/HeaderTitle.swift +0 -57
- package/ios/Application/Navigation/NavigationOptions.swift +0 -109
- package/ios/Application/Navigation/NavigatorManager.swift +0 -29
- package/ios/Application/Navigation/component/DuoScrollGradient.swift +0 -54
- package/ios/Application/Navigation/component/Header.swift +0 -183
- package/ios/Application/Navigation/component/HeaderBackground.swift +0 -84
- 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 -280
- /package/ios/{Application/Layout → Layout}/ScreenLayout.swift +0 -0
- /package/ios/{Application/Navigation → Navigation}/BottomTab/CurvedContainer.swift +0 -0
- /package/ios/{Application/Navigation → Navigation}/BottomTab/DuoBarCompression.swift +0 -0
- /package/ios/{Application/Navigation → Navigation}/BottomTab/DuoTabBar.swift +0 -0
- /package/ios/{Application/Navigation/Overplay → Navigation}/ModalScreen.swift +0 -0
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import SwiftUI
|
|
2
|
-
import Foundation
|
|
3
|
-
|
|
4
|
-
/// Keyed (`@Environment(\.applicationEnvironment)`) variant of `HeaderRight`, for hosts
|
|
5
|
-
/// wired through `NavigationContainer`/`KitContainer` (the injection style introduced by
|
|
6
|
-
/// MR 227 / DS-637). Reuses the shared data types (`HeaderRightData`, `Tool`, `ToolGroup`)
|
|
7
|
-
/// and `NavigationButton` from `HeaderRight.swift`. The legacy `HeaderRight` there stays on
|
|
8
|
-
/// `@EnvironmentObject` for hosts that render `Screen` directly with
|
|
9
|
-
/// `.environmentObject(ApplicationEnvironment(...))`. Opt in per screen with
|
|
10
|
-
/// `headerRight: { NavigationHeaderRight() }`.
|
|
11
|
-
public struct NavigationHeaderRight: View {
|
|
12
|
-
public init(headerRight: HeaderRightData? = nil, tintColor: Color? = nil) {
|
|
13
|
-
self.headerRight = headerRight
|
|
14
|
-
self.tintColor = tintColor
|
|
15
|
-
}
|
|
16
|
-
var headerRight: HeaderRightData?
|
|
17
|
-
var tintColor: Color? = nil
|
|
18
|
-
|
|
19
|
-
public var body: some View {
|
|
20
|
-
HStack(alignment: .center) {
|
|
21
|
-
ToolkitNavigationHeaderRight(headerRight: headerRight, tintColor: tintColor)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
struct ToolkitNavigationHeaderRight: View {
|
|
27
|
-
var headerRight: HeaderRightData?
|
|
28
|
-
var tintColor: Color?
|
|
29
|
-
/// iPhone Duo side bar column instead of the bar row.
|
|
30
|
-
var vertical: Bool = false
|
|
31
|
-
@State private var isFavorite: Bool = false
|
|
32
|
-
@State private var isLoading: Bool = false
|
|
33
|
-
@Environment(\.applicationEnvironment) private var environment
|
|
34
|
-
@Environment(\.duoBarCompression) private var compression
|
|
35
|
-
|
|
36
|
-
private func apiValue(_ value: Any?) -> Any {
|
|
37
|
-
value ?? NSNull()
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
private var contextMap: [String: Any] {
|
|
41
|
-
let context = environment.applicationContext
|
|
42
|
-
return [
|
|
43
|
-
"appId": apiValue(context?.appId),
|
|
44
|
-
"code": apiValue(context?.appCode),
|
|
45
|
-
"name": apiValue(context?.appName),
|
|
46
|
-
"icon": apiValue(context?.appIcon),
|
|
47
|
-
"description": apiValue(context?.description),
|
|
48
|
-
"support": apiValue(context?.support),
|
|
49
|
-
"toolkitConfig": apiValue(context?.toolkitConfig),
|
|
50
|
-
"providerId": apiValue(context?.providerId),
|
|
51
|
-
"permissions": apiValue(context?.permissions)
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
private var shouldShowShortcut: Bool {
|
|
56
|
-
headerRight?.useShortcut == true && !(headerRight?.useMore == true && environment.applicationContext == nil)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private func parseResponse(_ response: String) -> Any? {
|
|
60
|
-
guard let jsonData = response.data(using: .utf8),
|
|
61
|
-
let json = try? JSONSerialization.jsonObject(with: jsonData) as? [String: Any] else {
|
|
62
|
-
return nil
|
|
63
|
-
}
|
|
64
|
-
return json["response"]
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// MARK: - Actions
|
|
68
|
-
private func loadFavoriteState() {
|
|
69
|
-
environment.composeApi?.request(
|
|
70
|
-
funcName: "isFavoriteApp",
|
|
71
|
-
params: ["code": apiValue(environment.applicationContext?.appCode)]
|
|
72
|
-
) { response in
|
|
73
|
-
if let isFavorite = parseResponse(response) as? Bool {
|
|
74
|
-
self.isFavorite = isFavorite
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
private func onPressShortcut() {
|
|
80
|
-
environment.composeApi?.request(
|
|
81
|
-
funcName: "onToolAction",
|
|
82
|
-
params: [
|
|
83
|
-
"item": ["key": "onFavorite"],
|
|
84
|
-
"context": contextMap
|
|
85
|
-
]
|
|
86
|
-
) { response in
|
|
87
|
-
if let result = parseResponse(response) as? [String: Any],
|
|
88
|
-
result["success"] as? Bool == true {
|
|
89
|
-
isFavorite.toggle()
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
private func onPressHelpCenter() {
|
|
95
|
-
environment.composeApi?.request(
|
|
96
|
-
funcName: "showHelpCenter",
|
|
97
|
-
params: [
|
|
98
|
-
"appId": apiValue(environment.applicationContext?.appId),
|
|
99
|
-
"code": apiValue(environment.applicationContext?.appCode),
|
|
100
|
-
"name": apiValue(environment.applicationContext?.appName),
|
|
101
|
-
"icon": apiValue(environment.applicationContext?.appIcon),
|
|
102
|
-
"description": apiValue(environment.applicationContext?.description)
|
|
103
|
-
]
|
|
104
|
-
) { _ in }
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
private func onPressClose() {
|
|
108
|
-
environment.composeApi?.request(
|
|
109
|
-
funcName: "dismissAll",
|
|
110
|
-
params: nil
|
|
111
|
-
) { _ in }
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
private func onPressMore() {
|
|
115
|
-
let params: [String: Any] = [
|
|
116
|
-
"useSystemTools": headerRight?.useSystemTools ?? true,
|
|
117
|
-
"tools": headerRight?.tools.map { $0.toMap() } ?? [],
|
|
118
|
-
"context": contextMap
|
|
119
|
-
]
|
|
120
|
-
environment.composeApi?.request(
|
|
121
|
-
funcName: "showTools",
|
|
122
|
-
params: params
|
|
123
|
-
) { response in
|
|
124
|
-
if let toolResponse = parseResponse(response) as? String {
|
|
125
|
-
headerRight?.toolCallback?(toolResponse)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
private func getNavigationButtonConfig() -> NavigationButtonConfig {
|
|
131
|
-
let totalTools = headerRight?.tools.reduce(0) { $0 + $1.items.count } ?? 0
|
|
132
|
-
var icon = isFavorite ? "pin_star_checked" : "pin_star"
|
|
133
|
-
var onClickHandler: () -> Void = onPressShortcut
|
|
134
|
-
|
|
135
|
-
if totalTools > 1 || headerRight?.useMore == true {
|
|
136
|
-
icon = "navigation_more_icon"
|
|
137
|
-
onClickHandler = onPressMore
|
|
138
|
-
} else if totalTools == 1, let singleTool = headerRight?.tools.first?.items.first {
|
|
139
|
-
icon = singleTool.icon
|
|
140
|
-
onClickHandler = {
|
|
141
|
-
headerRight?.toolCallback?(singleTool.key)
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return NavigationButtonConfig(icon: icon, onPress: onClickHandler)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
private var showHelpCenter: Bool {
|
|
149
|
-
environment.applicationContext != nil && showsHelpCenter(environment.applicationContext)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
private var closeIcon: String { headerRight?.closeIcon ?? "16_basic_home" }
|
|
153
|
-
|
|
154
|
-
var body: some View {
|
|
155
|
-
Group {
|
|
156
|
-
if vertical {
|
|
157
|
-
verticalBody
|
|
158
|
-
} else {
|
|
159
|
-
horizontalBody
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
.onAppear {
|
|
163
|
-
loadFavoriteState()
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
private var showBadge: Bool {
|
|
168
|
-
headerRight?.tools.contains { group in
|
|
169
|
-
group.items.contains { $0.showBadge }
|
|
170
|
-
} ?? false
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/// Back slot, the optional shortcut, then the help/home capsule.
|
|
174
|
-
private var fullToolbarHeight: CGFloat {
|
|
175
|
-
DuoMetrics.controlSize + Spacing.M
|
|
176
|
-
+ (shouldShowShortcut ? DuoMetrics.controlSize + Spacing.M : 0)
|
|
177
|
-
+ (showHelpCenter ? 2 * DuoMetrics.itemPitch : DuoMetrics.controlSize)
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
@ViewBuilder
|
|
181
|
-
private var verticalBody: some View {
|
|
182
|
-
Group {
|
|
183
|
-
if compression.toolbarHidden {
|
|
184
|
-
// an open tab rail takes this slot for a moment
|
|
185
|
-
EmptyView()
|
|
186
|
-
} else if compression.toolbarCompressed {
|
|
187
|
-
// HIG "Toolbar compressed": tools fold into one button, distinct from the useMore icon
|
|
188
|
-
SideBarButton(
|
|
189
|
-
icon: "navigation_menu",
|
|
190
|
-
tintColor: tintColor,
|
|
191
|
-
showBadge: showBadge,
|
|
192
|
-
accessibilityId: "btn_navigation_toolbar",
|
|
193
|
-
action: compression.expandToolbar
|
|
194
|
-
)
|
|
195
|
-
} else {
|
|
196
|
-
toolbarColumn
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
// full height, so the tab bar compression decision matches this screen's toolkit
|
|
200
|
-
.onAppear { compression.setToolbarHeight(fullToolbarHeight) }
|
|
201
|
-
.onChange(of: fullToolbarHeight) { compression.setToolbarHeight($0) }
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
private var toolbarColumn: some View {
|
|
205
|
-
let navButtonConfig = getNavigationButtonConfig()
|
|
206
|
-
return VStack(spacing: Spacing.M) {
|
|
207
|
-
if shouldShowShortcut {
|
|
208
|
-
SideBarButton(
|
|
209
|
-
icon: navButtonConfig.icon,
|
|
210
|
-
tintColor: tintColor,
|
|
211
|
-
showBadge: showBadge,
|
|
212
|
-
disabled: isLoading,
|
|
213
|
-
action: navButtonConfig.onPress
|
|
214
|
-
)
|
|
215
|
-
}
|
|
216
|
-
SideBarGroup(tintColor: tintColor, itemCount: showHelpCenter ? 2 : 1) {
|
|
217
|
-
if showHelpCenter {
|
|
218
|
-
SideBarGroupItem(
|
|
219
|
-
icon: "help_center",
|
|
220
|
-
tintColor: tintColor,
|
|
221
|
-
accessibilityId: "btn_navigation_help_center",
|
|
222
|
-
action: onPressHelpCenter
|
|
223
|
-
)
|
|
224
|
-
}
|
|
225
|
-
SideBarGroupItem(
|
|
226
|
-
icon: closeIcon,
|
|
227
|
-
tintColor: tintColor,
|
|
228
|
-
accessibilityId: "btn_navigation_close",
|
|
229
|
-
action: onPressClose
|
|
230
|
-
)
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
private var horizontalBody: some View {
|
|
236
|
-
let backgroundButtonColor: Color = tintColor == Colors.black01 ? Colors.black20.opacity(0.6) : Colors.black01.opacity(0.6)
|
|
237
|
-
let borderColor: Color = tintColor == Colors.black01 ? Colors.black01.opacity(0.2) : Colors.black20.opacity(0.2)
|
|
238
|
-
let navButtonConfig = getNavigationButtonConfig()
|
|
239
|
-
|
|
240
|
-
return HStack(alignment: .center, spacing: 0) {
|
|
241
|
-
if shouldShowShortcut {
|
|
242
|
-
NavigationButton(
|
|
243
|
-
disabled: isLoading,
|
|
244
|
-
icon: navButtonConfig.icon,
|
|
245
|
-
showBadge: showBadge,
|
|
246
|
-
onClick: navButtonConfig.onPress,
|
|
247
|
-
tintColor: tintColor
|
|
248
|
-
)
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
HStack(alignment: .center, spacing: 0) {
|
|
252
|
-
if showHelpCenter {
|
|
253
|
-
Icon(source: "help_center", size: 20, color: tintColor ?? Colors.black17)
|
|
254
|
-
.padding(4)
|
|
255
|
-
.onTapGesture {
|
|
256
|
-
onPressHelpCenter()
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
Rectangle()
|
|
260
|
-
.fill(tintColor ?? Colors.black20)
|
|
261
|
-
.frame(width: 0.5, height: 12)
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
Icon(source: closeIcon, size: 20, color: tintColor ?? Colors.black17)
|
|
265
|
-
.padding(4)
|
|
266
|
-
.onTapGesture {
|
|
267
|
-
onPressClose()
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
.frame(width: 65, height: 28)
|
|
271
|
-
.background(backgroundButtonColor)
|
|
272
|
-
.cornerRadius(14)
|
|
273
|
-
.overlay(
|
|
274
|
-
RoundedRectangle(cornerRadius: 14)
|
|
275
|
-
.stroke(borderColor, lineWidth: 0.2)
|
|
276
|
-
)
|
|
277
|
-
.padding(.leading, Spacing.S)
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|