@momo-kits/native-kits 0.300.7 → 0.300.8-beta.1-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 +12 -8
- package/README.md +8 -7
- package/build.gradle.kts +13 -0
- package/compose/build.gradle.kts +195 -0
- package/compose/build.gradle.kts.backup +195 -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 +154 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -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 +61 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/KitsBinding.kt +60 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/KitsHost.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1067 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +268 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +55 -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 +354 -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 +130 -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 +482 -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 +224 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +137 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +473 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +113 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +262 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +237 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +228 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +280 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +183 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +342 -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 +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +82 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +362 -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 +304 -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 +88 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +308 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +218 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +456 -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 +205 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +89 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +542 -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 +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +201 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +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 +208 -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 +12 -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 +291 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +71 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +184 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +315 -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 +54 -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 +397 -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 +153 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +118 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +212 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +422 -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 +750 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +152 -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 +244 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +398 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +103 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +93 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +208 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +167 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +446 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +105 -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 +387 -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 +33 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +197 -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 +38 -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 +114 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +7 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +21 -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 +117 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/application/KitsHostTest.kt +44 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +39 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +53 -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 +31 -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 +65 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +217 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +48 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +143 -0
- package/gradle/libs.versions.toml +66 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +24 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/Application/ApplicationEnvironment.swift +6 -4
- package/ios/Application/DesignSystemKits.swift +59 -13
- package/ios/Application/DesignSystemKitsPayload.swift +0 -8
- package/ios/Application/LanguageSource.swift +2 -11
- package/ios/Application/Localize.swift +8 -35
- package/ios/Application/LocalizeModifier.swift +2 -11
- package/ios/Application/MaxApi.swift +3 -11
- package/ios/Avatar/Avatar.swift +0 -1
- package/ios/Badge/Badge.swift +5 -8
- package/ios/Badge/BadgeRibbon.swift +2 -5
- package/ios/Button/Button.swift +4 -8
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +5 -7
- package/ios/Carousel/Carousel.swift +4 -17
- package/ios/Checkbox/Checkbox.swift +0 -2
- package/ios/Collapse/Collapse.swift +17 -11
- package/ios/Colors+Radius+Spacing/Theme.swift +0 -7
- package/ios/DateTimePicker/DateTimePicker.swift +4 -10
- package/ios/DateTimePicker/DateTimePickerTypes.swift +1 -3
- package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -3
- package/ios/DateTimePicker/WheelPicker.swift +2 -4
- package/ios/Extensions/ActiveOpacityButtonStyle.swift +2 -3
- package/ios/Extensions/Color++.swift +2 -4
- package/ios/Extensions/SkeletonUICompat.swift +0 -8
- package/ios/Icon/Icon.swift +3 -6
- package/ios/IconButton/IconButton.swift +2 -5
- package/ios/Input/ErrorView.swift +0 -7
- package/ios/Input/Input.swift +9 -20
- package/ios/Input/InputPhoneNumber.swift +37 -20
- package/ios/Input/InputSearch.swift +23 -12
- package/ios/Input/InputTextArea.swift +4 -13
- package/ios/InputDropDown/InputDropDown.swift +1 -11
- package/ios/InputMoney/InputMoney.swift +9 -28
- package/ios/InputOTP/InputOTP.swift +2 -9
- package/ios/Layout/HeaderLayout.swift +72 -0
- package/ios/Layout/Item.swift +1 -2
- package/ios/Layout/ModalLayout.swift +144 -0
- package/ios/Layout/ScreenLayout.swift +48 -31
- package/ios/Layout/Section.swift +2 -3
- package/ios/Loader/Loader.swift +3 -12
- package/ios/Lottie/LottieView.swift +0 -11
- package/ios/Navigation/BottomSheet.swift +73 -94
- package/ios/Navigation/BottomTab/BottomTab.swift +58 -73
- package/ios/Navigation/BottomTab/BottomTabBar.swift +286 -121
- package/ios/Navigation/BottomTab/CurvedContainer.swift +52 -54
- package/ios/Navigation/BottomTab/DuoBarCompression.swift +5 -12
- package/ios/Navigation/BottomTab/DuoTabBar.swift +67 -202
- package/ios/Navigation/BottomTab/TabBarMetrics.swift +97 -0
- package/ios/Navigation/Component/FloatingButton.swift +4 -11
- package/ios/Navigation/Component/Header.swift +35 -54
- package/ios/Navigation/Component/HeaderBackground.swift +2 -8
- package/ios/Navigation/Component/HeaderJourney.swift +4 -8
- package/ios/Navigation/Component/HeaderLocation.swift +4 -8
- package/ios/Navigation/Component/HeaderRight.swift +20 -22
- package/ios/Navigation/Component/HeaderTitle.swift +1 -6
- package/ios/Navigation/Component/HeaderUser.swift +4 -10
- package/ios/Navigation/Component/SideBar.swift +6 -21
- package/ios/Navigation/Component/SnackBar.swift +9 -13
- package/ios/Navigation/HostBackGestureBridge.swift +2 -9
- package/ios/Navigation/ModalScreen.swift +24 -13
- package/ios/Navigation/Navigation.swift +35 -19
- package/ios/Navigation/NavigationContainer.swift +4 -15
- package/ios/Navigation/Navigator.swift +21 -39
- package/ios/Navigation/StackScreen.swift +64 -51
- package/ios/Navigation/StackTransition.swift +7 -14
- package/ios/Navigation/SwipeBackHaptic.swift +2 -7
- package/ios/Navigation/Tracking/ScreenTracker.swift +2 -7
- package/ios/Pagination/PaginationDot.swift +0 -9
- package/ios/Pagination/PaginationNumber.swift +1 -9
- package/ios/Pagination/PaginationScroll.swift +2 -14
- package/ios/Pagination/PaginationWhiteDot.swift +1 -10
- package/ios/Popup/PopupDisplay.swift +7 -5
- package/ios/Popup/PopupInput.swift +6 -4
- package/ios/Popup/PopupLayout.swift +17 -9
- package/ios/Popup/PopupNotify.swift +32 -25
- package/ios/PopupView/FullscreenPopup.swift +3 -4
- package/ios/PopupView/PopupView.swift +2 -2
- package/ios/PopupView/Utils++.swift +1 -2
- package/ios/ProgressInfo/ProgressInfo.swift +2 -13
- package/ios/Skeleton/Skeleton.swift +5 -16
- package/ios/Slider/Slider.swift +5 -12
- package/ios/StatusBarTap/StatusBarTap.h +2 -3
- package/ios/StatusBarTap/StatusBarTap.m +3 -16
- package/ios/Stepper/Stepper.swift +8 -27
- package/ios/Steps/Steps.swift +29 -26
- package/ios/Swipeable/SwipeCell.swift +2 -2
- package/ios/Swipeable/SwipeCellModel.swift +3 -6
- package/ios/TabView/TabView.swift +14 -28
- package/ios/Template/TrustBanner/TrustBanner.swift +2 -9
- package/ios/Title/Title.swift +1 -3
- package/ios/Tooltip/Tooltip.swift +4 -9
- package/ios/Typography/FontScale.swift +79 -24
- package/ios/Typography/Text.swift +6 -12
- package/ios/Typography/Typography.swift +8 -11
- package/ios/Uploader/Uploader.swift +2 -17
- package/ios-demo/README.md +120 -0
- package/ios-demo/Resources/tabbar_scan_qr_button.json +1 -0
- package/ios-demo/Resources/tabbar_scan_qr_label.json +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +11 -2
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +296 -59
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +15 -4
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +0 -8
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +114 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +29 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +16 -0
- package/package.json +1 -1
- package/publish.sh +8 -2
- package/scripts/ci/build-swiftui.sh +22 -0
- package/scripts/ci/resolve-version.mjs +144 -0
- package/settings.gradle.kts +63 -0
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
// InputPhoneNumber.swift
|
|
3
|
-
// Pods
|
|
4
|
-
//
|
|
5
|
-
// Created by sophia on 20/10/25.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
1
|
import SwiftUI
|
|
9
2
|
public struct InputPhoneNumber: View {
|
|
10
3
|
@Environment(\.appTheme) private var theme
|
|
@@ -18,13 +11,22 @@ public struct InputPhoneNumber: View {
|
|
|
18
11
|
public var errorSpacing: Bool
|
|
19
12
|
public var loading: Bool
|
|
20
13
|
public var required: Bool
|
|
14
|
+
/// Deprecated: use `trailing`.
|
|
21
15
|
public var rightIcon: String
|
|
16
|
+
/// Deprecated: use `trailingColor`.
|
|
22
17
|
public var rightIconColor: Color?
|
|
18
|
+
/// Icon key or URL; wins over `rightIcon` when not empty.
|
|
19
|
+
public var trailing: String
|
|
20
|
+
/// Wins over `rightIconColor` when set.
|
|
21
|
+
public var trailingColor: Color?
|
|
23
22
|
public var autofocus: Bool
|
|
24
23
|
public var onChangeText: ((String) -> Void)?
|
|
25
24
|
public var onFocus: (() -> Void)?
|
|
26
25
|
public var onBlur: (() -> Void)?
|
|
26
|
+
/// Deprecated: use `onPressTrailing`.
|
|
27
27
|
public var onRightIconPressed: (() -> Void)?
|
|
28
|
+
/// Wins over `onRightIconPressed` when set.
|
|
29
|
+
public var onPressTrailing: (() -> Void)?
|
|
28
30
|
public var accessibilityLabel: String?
|
|
29
31
|
|
|
30
32
|
@State private var isFocused: Bool = false
|
|
@@ -41,11 +43,14 @@ public struct InputPhoneNumber: View {
|
|
|
41
43
|
required: Bool = false,
|
|
42
44
|
rightIcon: String = "",
|
|
43
45
|
rightIconColor: Color? = nil,
|
|
46
|
+
trailing: String = "",
|
|
47
|
+
trailingColor: Color? = nil,
|
|
44
48
|
autofocus: Bool = false,
|
|
45
49
|
onChangeText: ((String) -> Void)? = nil,
|
|
46
50
|
onFocus: (() -> Void)? = nil,
|
|
47
51
|
onBlur: (() -> Void)? = nil,
|
|
48
52
|
onRightIconPressed: (() -> Void)? = nil,
|
|
53
|
+
onPressTrailing: (() -> Void)? = nil,
|
|
49
54
|
accessibilityLabel: String? = nil
|
|
50
55
|
) {
|
|
51
56
|
self._text = text
|
|
@@ -58,11 +63,14 @@ public struct InputPhoneNumber: View {
|
|
|
58
63
|
self.required = required
|
|
59
64
|
self.rightIcon = rightIcon
|
|
60
65
|
self.rightIconColor = rightIconColor
|
|
66
|
+
self.trailing = trailing
|
|
67
|
+
self.trailingColor = trailingColor
|
|
61
68
|
self.autofocus = autofocus
|
|
62
69
|
self.onChangeText = onChangeText
|
|
63
70
|
self.onFocus = onFocus
|
|
64
71
|
self.onBlur = onBlur
|
|
65
72
|
self.onRightIconPressed = onRightIconPressed
|
|
73
|
+
self.onPressTrailing = onPressTrailing
|
|
66
74
|
self.accessibilityLabel = accessibilityLabel
|
|
67
75
|
}
|
|
68
76
|
|
|
@@ -78,7 +86,6 @@ public struct InputPhoneNumber: View {
|
|
|
78
86
|
|
|
79
87
|
VStack(alignment: .leading, spacing: 0) {
|
|
80
88
|
HStack(spacing: 0) {
|
|
81
|
-
// 🇻🇳 Flag
|
|
82
89
|
ImageView("https://static.momocdn.net/app/img/icon/ic-qrcode-package/ic_vn_flag.png")
|
|
83
90
|
.frame(width: 24, height: 24)
|
|
84
91
|
.padding(.trailing, Spacing.XS)
|
|
@@ -90,7 +97,6 @@ public struct InputPhoneNumber: View {
|
|
|
90
97
|
.frame(width: 1, height: size == .small ? 24 : 32)
|
|
91
98
|
.padding(.horizontal, Spacing.M)
|
|
92
99
|
|
|
93
|
-
// Text input
|
|
94
100
|
ZStack(alignment: .leading) {
|
|
95
101
|
if text.isEmpty {
|
|
96
102
|
MomoText(
|
|
@@ -117,7 +123,6 @@ public struct InputPhoneNumber: View {
|
|
|
117
123
|
.accessibilityValue(textBinding.wrappedValue.isEmpty ? placeholder : textBinding.wrappedValue)
|
|
118
124
|
}
|
|
119
125
|
|
|
120
|
-
// Clear button
|
|
121
126
|
if isFocused && !text.isEmpty {
|
|
122
127
|
SwiftUI.Button(action: {
|
|
123
128
|
text = ""
|
|
@@ -129,16 +134,13 @@ public struct InputPhoneNumber: View {
|
|
|
129
134
|
.accessibilityIdentifier("ic_clear")
|
|
130
135
|
}
|
|
131
136
|
|
|
132
|
-
//
|
|
137
|
+
// Spinner replaces the trailing icon while loading (RN RenderTrailing)
|
|
133
138
|
if loading {
|
|
134
|
-
ActivityIndicator(isAnimating: .constant(true), style: .medium, color:
|
|
139
|
+
ActivityIndicator(isAnimating: .constant(true), style: .medium, color: trailingTint)
|
|
135
140
|
.frame(width: 16, height: 16)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if !rightIcon.isEmpty {
|
|
140
|
-
SwiftUI.Button(action: { onRightIconPressed?() }) {
|
|
141
|
-
Icon(source: rightIcon, size: 24, color: rightIconColor ?? theme.colors.text.default)
|
|
141
|
+
} else if !trailingIcon.isEmpty {
|
|
142
|
+
SwiftUI.Button(action: pressTrailing) {
|
|
143
|
+
Icon(source: trailingIcon, size: 24, color: trailingTint)
|
|
142
144
|
.padding(.leading, Spacing.S)
|
|
143
145
|
}
|
|
144
146
|
}
|
|
@@ -154,7 +156,6 @@ public struct InputPhoneNumber: View {
|
|
|
154
156
|
.stroke(borderColor(), lineWidth: isFocused ? 1.5 : 1)
|
|
155
157
|
)
|
|
156
158
|
|
|
157
|
-
// Error or hint
|
|
158
159
|
ErrorView(
|
|
159
160
|
errorMessage: error,
|
|
160
161
|
errorSpacing: errorSpacing,
|
|
@@ -164,7 +165,23 @@ public struct InputPhoneNumber: View {
|
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
// MARK: - Helpers
|
|
167
|
-
|
|
168
|
+
|
|
169
|
+
private var trailingIcon: String {
|
|
170
|
+
return trailing.isEmpty ? rightIcon : trailing
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private var trailingTint: Color {
|
|
174
|
+
return trailingColor ?? rightIconColor ?? theme.colors.text.default
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private func pressTrailing() {
|
|
178
|
+
if let onPressTrailing {
|
|
179
|
+
onPressTrailing()
|
|
180
|
+
return
|
|
181
|
+
}
|
|
182
|
+
onRightIconPressed?()
|
|
183
|
+
}
|
|
184
|
+
|
|
168
185
|
private func handleFocusChange(_ focused: Bool) {
|
|
169
186
|
guard focused != isFocused else { return }
|
|
170
187
|
isFocused = focused
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
//
|
|
2
|
-
// InputSearch.swift
|
|
3
|
-
// Pods
|
|
4
|
-
//
|
|
5
|
-
// Created by dung.pham2 on 3/12/24.
|
|
6
|
-
//
|
|
7
1
|
import SwiftUI
|
|
8
2
|
|
|
3
|
+
/// Body searches keep 36 / 24; the header search matches the 32pt header buttons.
|
|
4
|
+
enum InputSearchSize {
|
|
5
|
+
case `default`, header
|
|
6
|
+
|
|
7
|
+
var height: CGFloat { self == .header ? HeaderLayoutMetrics.searchHeight : 36 }
|
|
8
|
+
var iconSize: CGFloat { self == .header ? HeaderLayoutMetrics.iconSize : 24 }
|
|
9
|
+
}
|
|
10
|
+
|
|
9
11
|
// MARK: - RenderRightIconSearch
|
|
10
12
|
|
|
11
13
|
struct RenderRightIconSearch: View {
|
|
@@ -13,6 +15,7 @@ struct RenderRightIconSearch: View {
|
|
|
13
15
|
let loading: Bool
|
|
14
16
|
let icon: String
|
|
15
17
|
let color: Color
|
|
18
|
+
var size: InputSearchSize = .default
|
|
16
19
|
let onClick: () -> Void
|
|
17
20
|
|
|
18
21
|
var body: some View {
|
|
@@ -23,13 +26,13 @@ struct RenderRightIconSearch: View {
|
|
|
23
26
|
.padding(.horizontal, Spacing.S)
|
|
24
27
|
}
|
|
25
28
|
if !icon.isEmpty {
|
|
26
|
-
// Compose: a 1pt rule inset S from the top and bottom of the
|
|
29
|
+
// Compose: a 1pt rule inset S from the top and bottom of the bar.
|
|
27
30
|
Rectangle()
|
|
28
31
|
.fill(theme.colors.primary)
|
|
29
|
-
.frame(width: 1, height:
|
|
32
|
+
.frame(width: 1, height: size.height - Spacing.S * 2)
|
|
30
33
|
.padding(.leading, Spacing.S)
|
|
31
34
|
|
|
32
|
-
Icon(source: icon, size:
|
|
35
|
+
Icon(source: icon, size: size.iconSize, color: color)
|
|
33
36
|
.padding(.leading, Spacing.S)
|
|
34
37
|
.onTapGesture(perform: onClick)
|
|
35
38
|
}
|
|
@@ -143,6 +146,7 @@ public struct InputSearch: View {
|
|
|
143
146
|
var clearCondition: (() -> Bool)? = nil
|
|
144
147
|
var onClearPress: () -> Void = {}
|
|
145
148
|
var onSubmit: () -> Void = {}
|
|
149
|
+
var size: InputSearchSize = .default
|
|
146
150
|
|
|
147
151
|
@State private var isFocused = false
|
|
148
152
|
@State private var isBlurred = false
|
|
@@ -232,7 +236,7 @@ public struct InputSearch: View {
|
|
|
232
236
|
if let searchIcon = searchIcon {
|
|
233
237
|
searchIcon()
|
|
234
238
|
} else {
|
|
235
|
-
Icon(source: "navigation_search", size:
|
|
239
|
+
Icon(source: "navigation_search", size: size.iconSize, color: theme.colors.text.hint)
|
|
236
240
|
.padding(.trailing, Spacing.XS)
|
|
237
241
|
}
|
|
238
242
|
|
|
@@ -281,11 +285,11 @@ public struct InputSearch: View {
|
|
|
281
285
|
.padding(.leading, Spacing.XS)
|
|
282
286
|
}
|
|
283
287
|
|
|
284
|
-
RenderRightIconSearch(loading: loading, icon: icon, color: iconColor, onClick: onRightIconPressed)
|
|
288
|
+
RenderRightIconSearch(loading: loading, icon: icon, color: iconColor, size: size, onClick: onRightIconPressed)
|
|
285
289
|
}
|
|
286
290
|
.padding(.horizontal, Spacing.M)
|
|
287
291
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
288
|
-
.frame(height:
|
|
292
|
+
.frame(height: size.height)
|
|
289
293
|
.background(
|
|
290
294
|
RoundedRectangle(cornerRadius: Radius.XL)
|
|
291
295
|
.fill(backgroundColor ?? theme.colors.background.surface)
|
|
@@ -304,6 +308,13 @@ public struct InputSearch: View {
|
|
|
304
308
|
}
|
|
305
309
|
}
|
|
306
310
|
|
|
311
|
+
/// The header search: 32pt tall with a 20pt icon, level with the header buttons.
|
|
312
|
+
func headerSize() -> InputSearch {
|
|
313
|
+
var copy = self
|
|
314
|
+
copy.size = .header
|
|
315
|
+
return copy
|
|
316
|
+
}
|
|
317
|
+
|
|
307
318
|
// MARK: - Helper Functions
|
|
308
319
|
|
|
309
320
|
func getBorderColor(isFocused: Bool, error: String, disabled: Bool) -> Color {
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
// InputTextArea.swift
|
|
3
|
-
// Pods
|
|
4
|
-
//
|
|
5
|
-
// Created by dung.pham2 on 2/12/24.
|
|
6
|
-
//
|
|
7
1
|
import SwiftUI
|
|
8
2
|
|
|
9
|
-
// Make these constants public
|
|
10
3
|
public let MAX_LENGTH = 300
|
|
11
4
|
public let DEFAULT_HEIGHT: CGFloat = 104
|
|
12
5
|
|
|
@@ -92,7 +85,6 @@ struct UITextViewWrapper: UIViewRepresentable {
|
|
|
92
85
|
}
|
|
93
86
|
}
|
|
94
87
|
|
|
95
|
-
// Make the struct public
|
|
96
88
|
public struct InputTextArea: View {
|
|
97
89
|
@Environment(\.appTheme) private var theme
|
|
98
90
|
@Environment(\.momoFontScale) private var fontScale
|
|
@@ -120,7 +112,6 @@ public struct InputTextArea: View {
|
|
|
120
112
|
|
|
121
113
|
@State private var isFocused = false
|
|
122
114
|
|
|
123
|
-
// Make the initializer public
|
|
124
115
|
public init(
|
|
125
116
|
text: Binding<String>,
|
|
126
117
|
maxLength: Int = MAX_LENGTH,
|
|
@@ -204,7 +195,6 @@ public struct InputTextArea: View {
|
|
|
204
195
|
}
|
|
205
196
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
|
206
197
|
|
|
207
|
-
// Clear button (mirrors Compose: focused + non-empty).
|
|
208
198
|
if isFocused && !text.isEmpty {
|
|
209
199
|
SwiftUI.Button(action: {
|
|
210
200
|
text = ""
|
|
@@ -215,8 +205,7 @@ public struct InputTextArea: View {
|
|
|
215
205
|
.padding(.leading, Spacing.XS)
|
|
216
206
|
}
|
|
217
207
|
|
|
218
|
-
//
|
|
219
|
-
// Compose's RenderRightIcon: both can render at once).
|
|
208
|
+
// Not if/else: Compose's RenderRightIcon can show the spinner and the icon together.
|
|
220
209
|
if loading {
|
|
221
210
|
ActivityIndicator(isAnimating: .constant(true), style: .medium, color: iconTintColor)
|
|
222
211
|
.frame(width: 16, height: 16)
|
|
@@ -279,7 +268,9 @@ public struct InputTextArea: View {
|
|
|
279
268
|
}
|
|
280
269
|
.padding(.horizontal, Spacing.S)
|
|
281
270
|
.background(theme.colors.background.surface)
|
|
282
|
-
|
|
271
|
+
// A zero-height frame on the top edge centers the label on the border, re-laid out with font scale.
|
|
272
|
+
.fixedSize(horizontal: false, vertical: true)
|
|
273
|
+
.frame(height: 0)
|
|
283
274
|
.offset(x: Spacing.S)
|
|
284
275
|
}
|
|
285
276
|
}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
// InputDropDown.swift
|
|
3
|
-
// Pods
|
|
4
|
-
//
|
|
5
|
-
// Hand-written SwiftUI reimplementation of Compose `InputDropDown`.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
1
|
import SwiftUI
|
|
9
2
|
|
|
10
3
|
// MARK: - RenderRightIcon (mirrors Compose RenderRightIcon for InputDropDown)
|
|
@@ -16,8 +9,7 @@ private struct RenderRightIcon: View {
|
|
|
16
9
|
let onPressed: () -> Void
|
|
17
10
|
|
|
18
11
|
var body: some View {
|
|
19
|
-
//
|
|
20
|
-
// can both render at once, not exclusively (not an if/else).
|
|
12
|
+
// Not if/else, as in Compose: the spinner and the icon can show together.
|
|
21
13
|
if loading {
|
|
22
14
|
ActivityIndicator(isAnimating: .constant(true), style: .medium, color: color)
|
|
23
15
|
.frame(width: 16, height: 16)
|
|
@@ -100,7 +92,6 @@ public struct InputDropDown: View {
|
|
|
100
92
|
public var body: some View {
|
|
101
93
|
VStack(alignment: .leading, spacing: 0) {
|
|
102
94
|
ZStack(alignment: .topLeading) {
|
|
103
|
-
// Floating label
|
|
104
95
|
if !floatingValue.isEmpty || !floatingIcon.isEmpty {
|
|
105
96
|
HStack(spacing: 0) {
|
|
106
97
|
MomoText(floatingValue, typography: .labelSMedium, color: floatingTitleColor)
|
|
@@ -118,7 +109,6 @@ public struct InputDropDown: View {
|
|
|
118
109
|
.zIndex(10)
|
|
119
110
|
}
|
|
120
111
|
|
|
121
|
-
// Input container
|
|
122
112
|
HStack(alignment: .center, spacing: 0) {
|
|
123
113
|
if !leadingIcon.isEmpty {
|
|
124
114
|
Icon(source: leadingIcon, size: size == .small ? 24 : 32, color: leadingIconTintColor)
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
//
|
|
2
|
-
// InputMoney.swift
|
|
3
|
-
// MoMoUIKits
|
|
4
|
-
//
|
|
5
|
-
// Native SwiftUI reimplementation of Compose `InputMoney`.
|
|
6
|
-
// The bound `text` holds RAW DIGITS only, as in Compose; the field shows
|
|
7
|
-
// the thousands-separated currency and edits apply at the caret.
|
|
8
|
-
//
|
|
9
|
-
|
|
10
1
|
import Foundation
|
|
11
2
|
import SwiftUI
|
|
12
3
|
import UIKit
|
|
@@ -35,7 +26,6 @@ public func formatNumberToMoney(_ digits: String, currency: String = "đ") -> St
|
|
|
35
26
|
for i in 0..<reversed.count {
|
|
36
27
|
count += 1
|
|
37
28
|
chars.append(reversed[i])
|
|
38
|
-
// i counts from the least significant digit; original index = len-1-i.
|
|
39
29
|
let originalIndex = reversed.count - 1 - i
|
|
40
30
|
if count == 3 && originalIndex >= 1 {
|
|
41
31
|
chars.append(".")
|
|
@@ -47,9 +37,8 @@ public func formatNumberToMoney(_ digits: String, currency: String = "đ") -> St
|
|
|
47
37
|
|
|
48
38
|
private func isMoneyDigit(_ char: Character) -> Bool { char.isASCII && char.isNumber }
|
|
49
39
|
|
|
50
|
-
/// Applies
|
|
51
|
-
///
|
|
52
|
-
/// digit before it instead, removing only the currency leaves the digits untouched. Returns the new digits and the caret as a digit index.
|
|
40
|
+
/// Applies the edit `display[start..<end]` → `inserted` to the digits of `display`. Separators and
|
|
41
|
+
/// currency are never deleted: removing a separator deletes the digit before it instead.
|
|
53
42
|
private func applyMoneyEdit(_ display: String, start: Int, end: Int, inserted: String) -> (digits: String, caretDigit: Int) {
|
|
54
43
|
let chars = Array(display)
|
|
55
44
|
let start = min(start, chars.count)
|
|
@@ -83,6 +72,8 @@ private func moneyCaret(_ display: String, digitIndex: Int) -> Int {
|
|
|
83
72
|
|
|
84
73
|
// MARK: - InputMoney
|
|
85
74
|
|
|
75
|
+
/// Compose `InputMoney`: the bound `text` holds raw digits only; the field shows the
|
|
76
|
+
/// thousands-separated currency and edits apply at the caret.
|
|
86
77
|
public struct InputMoney: View {
|
|
87
78
|
@Environment(\.appTheme) private var theme
|
|
88
79
|
@Environment(\.momoFontScale) private var fontScale
|
|
@@ -166,7 +157,6 @@ public struct InputMoney: View {
|
|
|
166
157
|
public var body: some View {
|
|
167
158
|
VStack(alignment: .leading, spacing: 0) {
|
|
168
159
|
ZStack(alignment: .topLeading) {
|
|
169
|
-
// Floating label
|
|
170
160
|
if !floatingValue.isEmpty || !floatingIcon.isEmpty {
|
|
171
161
|
HStack(spacing: 0) {
|
|
172
162
|
MomoText(floatingValue, typography: .labelSMedium, color: floatingTitleColor)
|
|
@@ -185,24 +175,18 @@ public struct InputMoney: View {
|
|
|
185
175
|
}
|
|
186
176
|
)
|
|
187
177
|
.background(theme.colors.background.surface)
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
// the label ends up centered exactly on the box's top border. Our ZStack
|
|
191
|
-
// anchors top-leading instead, so matching that requires offsetting by
|
|
192
|
-
// half the label's OWN measured height, not half the box height.
|
|
178
|
+
// Compose centers the label in the box and offsets it by -box height / 2, onto the
|
|
179
|
+
// top border; this ZStack anchors top-leading, so it offsets by half the label height.
|
|
193
180
|
.offset(x: Spacing.S, y: -floatingLabelHeight / 2)
|
|
194
181
|
.zIndex(10)
|
|
195
182
|
}
|
|
196
183
|
|
|
197
|
-
// Input container
|
|
198
184
|
HStack(alignment: .center, spacing: 0) {
|
|
199
|
-
// Leading icon
|
|
200
185
|
if !leadingIcon.isEmpty {
|
|
201
186
|
Icon(source: leadingIcon, size: size == .small ? 24 : 32, color: leadingIconTintColor)
|
|
202
187
|
.padding(.trailing, Spacing.XS)
|
|
203
188
|
}
|
|
204
189
|
|
|
205
|
-
// Money field
|
|
206
190
|
ZStack(alignment: .leading) {
|
|
207
191
|
if !hasDigits {
|
|
208
192
|
MomoText(
|
|
@@ -226,7 +210,6 @@ public struct InputMoney: View {
|
|
|
226
210
|
}
|
|
227
211
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
228
212
|
|
|
229
|
-
// Clear button (focused + has value)
|
|
230
213
|
if isFocused && hasDigits {
|
|
231
214
|
SwiftUI.Button(action: {
|
|
232
215
|
text = ""
|
|
@@ -238,8 +221,7 @@ public struct InputMoney: View {
|
|
|
238
221
|
}
|
|
239
222
|
}
|
|
240
223
|
|
|
241
|
-
//
|
|
242
|
-
// Compose's two independent `if` blocks, not if/else).
|
|
224
|
+
// Not if/else, as in Compose: the spinner and the icon can show together.
|
|
243
225
|
if loading {
|
|
244
226
|
ActivityIndicator(isAnimating: .constant(true), style: .medium, color: iconTintColor)
|
|
245
227
|
.frame(width: 16, height: 16)
|
|
@@ -303,9 +285,8 @@ public struct InputMoney: View {
|
|
|
303
285
|
|
|
304
286
|
// MARK: - MoneyTextField (UIViewRepresentable)
|
|
305
287
|
|
|
306
|
-
///
|
|
307
|
-
///
|
|
308
|
-
/// but never past the trailing currency symbol; edits apply at the caret.
|
|
288
|
+
/// Shows the formatted currency while `digits` holds the raw value; the caret never passes the
|
|
289
|
+
/// currency suffix.
|
|
309
290
|
private struct MoneyTextField: UIViewRepresentable {
|
|
310
291
|
@Binding var digits: String
|
|
311
292
|
var keyboardType: UIKeyboardType
|
|
@@ -27,11 +27,8 @@ private struct OTPCaret: View {
|
|
|
27
27
|
|
|
28
28
|
// MARK: - InputOTP
|
|
29
29
|
|
|
30
|
-
///
|
|
31
|
-
///
|
|
32
|
-
/// A row of OTP cells driven by a hidden `TextField`. When `length` is provided
|
|
33
|
-
/// it renders fixed-count slots (`-` placeholders + blinking caret); otherwise it
|
|
34
|
-
/// renders the typed characters followed by a trailing caret while focused.
|
|
30
|
+
/// Compose `InputOTP`: cells driven by a hidden `TextField`. With `length`, fixed slots (`-`
|
|
31
|
+
/// placeholders + blinking caret); without, the typed characters and a trailing caret while focused.
|
|
35
32
|
public struct InputOTP: View {
|
|
36
33
|
@Environment(\.appTheme) private var theme
|
|
37
34
|
@Binding public var value: String
|
|
@@ -80,10 +77,8 @@ public struct InputOTP: View {
|
|
|
80
77
|
public var body: some View {
|
|
81
78
|
VStack(alignment: .leading, spacing: 0) {
|
|
82
79
|
ZStack {
|
|
83
|
-
// Hidden text field that owns the keyboard / cursor.
|
|
84
80
|
hiddenField
|
|
85
81
|
|
|
86
|
-
// Floating label over the border.
|
|
87
82
|
if !floatingValue.isEmpty {
|
|
88
83
|
HStack {
|
|
89
84
|
MomoText(floatingValue, typography: .labelSMedium, color: theme.colors.text.hint)
|
|
@@ -94,7 +89,6 @@ public struct InputOTP: View {
|
|
|
94
89
|
.zIndex(10)
|
|
95
90
|
}
|
|
96
91
|
|
|
97
|
-
// Bordered container with cells.
|
|
98
92
|
cells
|
|
99
93
|
.frame(maxWidth: .infinity)
|
|
100
94
|
.frame(height: 56)
|
|
@@ -103,7 +97,6 @@ public struct InputOTP: View {
|
|
|
103
97
|
.stroke(borderColor, lineWidth: 1)
|
|
104
98
|
)
|
|
105
99
|
|
|
106
|
-
// Trailing clear button.
|
|
107
100
|
HStack {
|
|
108
101
|
Spacer()
|
|
109
102
|
SwiftUI.Button(action: clearText) {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Top navigation spec (Figma "Top Navigation · Màn hình gập"). Mirrors Compose `layout/HeaderLayout.kt`
|
|
2
|
+
// and RN; keep the three in sync.
|
|
3
|
+
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
/// Stretch frame on hold until design confirms it: `.stretch` lays out like `.grid`.
|
|
7
|
+
private let isStretchFrameEnabled = false
|
|
8
|
+
|
|
9
|
+
/// Header spec values, in points. Public so custom header rights and extensions can match them.
|
|
10
|
+
public enum HeaderLayoutMetrics {
|
|
11
|
+
public static let buttonSize: CGFloat = 32
|
|
12
|
+
public static let iconSize: CGFloat = 20
|
|
13
|
+
public static let pillWidth: CGFloat = 72
|
|
14
|
+
public static let searchHeight: CGFloat = 32
|
|
15
|
+
public static let titleGap: CGFloat = Spacing.S
|
|
16
|
+
public static let sidePadding: CGFloat = Spacing.M
|
|
17
|
+
/// shortcut + gap + help/home pill
|
|
18
|
+
public static let clusterWidth: CGFloat = buttonSize + titleGap + pillWidth
|
|
19
|
+
public static let frameMaxWidth: CGFloat = 600
|
|
20
|
+
/// Banner image width on every device: wide windows keep the phone size, centered.
|
|
21
|
+
public static let bannerWidth: CGFloat = 375
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/// How a screen lays out its content on wide windows; the header row follows it.
|
|
25
|
+
public enum ContentLayout: Equatable {
|
|
26
|
+
/// 12 column grid: the header keeps the 12pt side padding.
|
|
27
|
+
case grid
|
|
28
|
+
/// One column of at most `HeaderLayoutMetrics.frameMaxWidth`, centered: the header row sits in the same frame.
|
|
29
|
+
/// On hold: same as `.grid` for now.
|
|
30
|
+
case stretch
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// Header geometry for a window; see `ScreenLayout.headerLayout(_:)`.
|
|
34
|
+
public struct HeaderLayout: Equatable {
|
|
35
|
+
/// Short side >= 600, iPhone Duo excluded (it has its own layout).
|
|
36
|
+
public let isWide: Bool
|
|
37
|
+
/// Banner kept at `HeaderLayoutMetrics.bannerWidth`, centered: wide windows plus the iPhone Duo inner display.
|
|
38
|
+
public let isBannerCentered: Bool
|
|
39
|
+
/// Padding from each side of the safe area to the header row (back, title / search, right cluster).
|
|
40
|
+
public let frameInset: CGFloat
|
|
41
|
+
/// Width of the header row, so tabs and other header extensions can line up with it.
|
|
42
|
+
public let frameWidth: CGFloat
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public extension ScreenLayout {
|
|
46
|
+
func headerLayout(_ contentLayout: ContentLayout = .grid) -> HeaderLayout {
|
|
47
|
+
let isLargeWindow = min(width, height) >= ModalMetrics.foldableMinWidth
|
|
48
|
+
let isWide = !isIPhoneDuo && !isDuoDevice && isLargeWindow
|
|
49
|
+
let safeWidth = width - insets.leading - insets.trailing
|
|
50
|
+
let isStretch = isStretchFrameEnabled && contentLayout == .stretch
|
|
51
|
+
let frameInset = isWide && isStretch
|
|
52
|
+
? max(HeaderLayoutMetrics.sidePadding, (safeWidth - HeaderLayoutMetrics.frameMaxWidth) / 2)
|
|
53
|
+
: HeaderLayoutMetrics.sidePadding
|
|
54
|
+
return HeaderLayout(
|
|
55
|
+
isWide: isWide,
|
|
56
|
+
isBannerCentered: isLargeWindow,
|
|
57
|
+
frameInset: frameInset,
|
|
58
|
+
frameWidth: safeWidth - frameInset * 2)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private struct ContentLayoutKey: EnvironmentKey {
|
|
63
|
+
static let defaultValue: ContentLayout = .grid
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public extension EnvironmentValues {
|
|
67
|
+
/// The enclosing screen's `NavigationOptions.contentLayout`, set by `StackScreen`.
|
|
68
|
+
var contentLayout: ContentLayout {
|
|
69
|
+
get { self[ContentLayoutKey.self] }
|
|
70
|
+
set { self[ContentLayoutKey.self] = newValue }
|
|
71
|
+
}
|
|
72
|
+
}
|
package/ios/Layout/Item.swift
CHANGED
|
@@ -19,8 +19,7 @@ public struct ItemView<Content: View>: View {
|
|
|
19
19
|
// MARK: Public
|
|
20
20
|
|
|
21
21
|
public var body: some View {
|
|
22
|
-
//
|
|
23
|
-
// on top of each other — matches the React Item's flex-column content.
|
|
22
|
+
// VStack, not ZStack: children flow vertically like RN Item's flex-column content.
|
|
24
23
|
VStack(alignment: .leading, spacing: 0) { content() }
|
|
25
24
|
.frame(width: width, height: height, alignment: .topLeading)
|
|
26
25
|
}
|