@momo-kits/native-kits 0.163.1-beta.8-debug → 0.163.1-beta.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 +1 -1
- package/compose/build.gradle.kts +1 -1
- package/compose/compose.podspec +1 -1
- 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 +30 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +5 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +3 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +4 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +8 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +63 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +32 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +49 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +93 -75
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +26 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +23 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +11 -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 +26 -3
- package/gradle.properties +1 -1
- package/ios/Application/ApplicationEnvironment.swift +15 -2
- package/ios/Application/Components.swift +50 -44
- package/ios/Application/FloatingButton.swift +10 -9
- package/ios/Application/HeaderRight.swift +79 -45
- package/ios/Application/Localize.swift +277 -0
- package/ios/Application/MaxApi.swift +18 -0
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +104 -0
- package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
- package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
- package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
- package/ios/Application/Navigation/HeaderTitle.swift +57 -0
- package/ios/Application/Navigation/HeaderUser.swift +209 -0
- package/ios/Application/Navigation/NavigationContainer.swift +200 -0
- package/ios/Application/Navigation/NavigationOptions.swift +109 -0
- package/ios/Application/Navigation/Navigator.swift +385 -0
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +256 -0
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +74 -0
- package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
- package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
- package/ios/Application/Navigation/component/Header.swift +178 -0
- package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
- package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
- package/ios/Application/Screen.swift +2 -1
- package/ios/Application/StackScreen.swift +501 -0
- package/ios/Avatar/Avatar.swift +193 -0
- package/ios/Badge/Badge.swift +11 -14
- package/ios/Badge/BadgeRibbon.swift +92 -21
- package/ios/BaselineView/BaselineView.swift +163 -0
- package/ios/Button/Button.swift +124 -29
- package/ios/Carousel/Carousel.swift +196 -0
- package/ios/Checkbox/Checkbox.swift +23 -28
- package/ios/Chip/Chip.swift +56 -33
- package/ios/Collapse/Collapse.swift +192 -0
- package/ios/Colors+Radius+Spacing/Colors.swift +20 -17
- package/ios/Colors+Radius+Spacing/Spacing.swift +3 -1
- package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
- package/ios/DateTimePicker/DateTimePicker.swift +212 -0
- package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
- package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
- package/ios/DateTimePicker/WheelPicker.swift +165 -0
- package/ios/Divider/Divider.swift +16 -0
- package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
- package/ios/Extensions/Color++.swift +32 -0
- package/ios/Icon/Icon.swift +10 -1
- package/ios/IconButton/IconButton.swift +140 -0
- package/ios/Image/Image.swift +16 -3
- package/ios/Information/Information.swift +3 -1
- package/ios/Input/ErrorView.swift +3 -1
- package/ios/Input/Input.swift +72 -33
- package/ios/Input/InputPhoneNumber.swift +33 -21
- package/ios/Input/InputSearch.swift +107 -48
- package/ios/Input/InputTextArea.swift +134 -64
- package/ios/InputDropDown/InputDropDown.swift +201 -0
- package/ios/InputMoney/InputMoney.swift +347 -0
- package/ios/InputOTP/InputOTP.swift +210 -0
- package/ios/Loader/Loader.swift +113 -0
- package/ios/MoMoUIKits.podspec +5 -0
- package/ios/Pagination/PaginationDot.swift +61 -0
- package/ios/Pagination/PaginationNumber.swift +35 -0
- package/ios/Pagination/PaginationScroll.swift +101 -0
- package/ios/Pagination/PaginationWhiteDot.swift +37 -0
- package/ios/Popup/PopupDisplay.swift +11 -20
- package/ios/Popup/PopupInput.swift +2 -8
- package/ios/Popup/PopupNotify.swift +218 -0
- package/ios/Popup/PopupPromotion.swift +16 -8
- package/ios/ProgressInfo/ProgressInfo.swift +296 -0
- package/ios/Radio/Radio.swift +69 -0
- package/ios/Rating/Rating.swift +82 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Background.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Border.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Card.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Contents.json +6 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Error.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryDark.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryLight.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Success.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Text.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/TextSecondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +9 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Warning.colorset/Contents.json +38 -0
- package/ios/Skeleton/Skeleton.swift +99 -0
- package/ios/Slider/Slider.swift +237 -0
- package/ios/Stepper/Stepper.swift +220 -0
- package/ios/Steps/Steps.swift +467 -0
- package/ios/SuggestAction/SuggestAction.swift +99 -0
- package/ios/Swipeable/SwipeCell.swift +187 -0
- package/ios/Swipeable/SwipeCellModel.swift +21 -0
- package/ios/Switch/Switch.swift +53 -28
- package/ios/TabView/TabView.swift +534 -0
- package/ios/Tag/Tag.swift +98 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +6 -7
- package/ios/Title/Title.swift +269 -0
- package/ios/Tooltip/Tooltip.swift +485 -0
- package/ios/Typography/FontScaleStore.swift +19 -0
- package/ios/Typography/Text.swift +79 -5
- package/ios/Typography/Typography.swift +3 -0
- package/ios/Uploader/Uploader.swift +174 -0
- package/ios/native-kits.podspec +61 -8
- package/ios-demo/MoMoUIKitsDemo.podspec +20 -0
- package/ios-demo/README.md +120 -0
- package/ios-demo/Resources/dot_loading.json +558 -0
- package/ios-demo/Resources/icon.json +4052 -0
- package/ios-demo/Resources/lottie_circle_loader.json +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +24 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +269 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +126 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +63 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +20 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +124 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +14 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +279 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +58 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +78 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +138 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +111 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +136 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +73 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +57 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +70 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +188 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +229 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +72 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +121 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +76 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +89 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +56 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +150 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +138 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +103 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +94 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +79 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +152 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +33 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +190 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +34 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +182 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +109 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +187 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +131 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +51 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
- package/local.properties +2 -2
- package/package.json +1 -1
- package/publish.sh +53 -0
- package/scripts/gen-ios-color.mjs +136 -0
- package/.claude/settings.local.json +0 -62
|
@@ -9,11 +9,12 @@ import SwiftUI
|
|
|
9
9
|
// MARK: - RenderRightIconSearch
|
|
10
10
|
|
|
11
11
|
struct RenderRightIconSearch: View {
|
|
12
|
+
@Environment(\.appTheme) private var theme
|
|
12
13
|
let loading: Bool
|
|
13
14
|
let icon: String
|
|
14
15
|
let color: Color
|
|
15
16
|
let onClick: () -> Void
|
|
16
|
-
|
|
17
|
+
|
|
17
18
|
var body: some View {
|
|
18
19
|
HStack(spacing: 0) {
|
|
19
20
|
if loading {
|
|
@@ -24,12 +25,10 @@ struct RenderRightIconSearch: View {
|
|
|
24
25
|
if !icon.isEmpty {
|
|
25
26
|
Divider()
|
|
26
27
|
.frame(width: 1)
|
|
27
|
-
.background(
|
|
28
|
+
.background(theme.colors.primary)
|
|
28
29
|
.padding(.leading, Spacing.S)
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
.foregroundColor(color)
|
|
32
|
-
.frame(width: 24, height: 24)
|
|
31
|
+
Icon(source: icon, size: 24, color: color)
|
|
33
32
|
.padding(.leading, Spacing.S)
|
|
34
33
|
.onTapGesture(perform: onClick)
|
|
35
34
|
}
|
|
@@ -48,14 +47,18 @@ public struct InputSearchProps {
|
|
|
48
47
|
var error: String = ""
|
|
49
48
|
var disabled: Bool = false
|
|
50
49
|
var icon: String = ""
|
|
51
|
-
var iconColor: Color =
|
|
50
|
+
var iconColor: Color? = nil
|
|
52
51
|
var onRightIconPressed: () -> Void = {}
|
|
53
52
|
var onFocus: () -> Void = {}
|
|
54
53
|
var onBlur: () -> Void = {}
|
|
55
54
|
var loading: Bool = false
|
|
56
55
|
var fontWeight: Font.Weight = .regular
|
|
57
56
|
var keyboardType: UIKeyboardType = .default
|
|
58
|
-
|
|
57
|
+
// Mirrors Compose's InputSearchProps.searchIcon — a custom leading icon view.
|
|
58
|
+
var searchIcon: (() -> AnyView)? = nil
|
|
59
|
+
// Mirrors Compose's InputSearchProps.placeholderCustomRender — a custom placeholder view.
|
|
60
|
+
var placeholderCustomRender: (() -> AnyView)? = nil
|
|
61
|
+
|
|
59
62
|
public init(text: Binding<String>,
|
|
60
63
|
buttonText: String = "",
|
|
61
64
|
showButtonText: Bool = false,
|
|
@@ -66,13 +69,15 @@ public struct InputSearchProps {
|
|
|
66
69
|
error: String = "",
|
|
67
70
|
disabled: Bool = false,
|
|
68
71
|
icon: String = "",
|
|
69
|
-
iconColor: Color =
|
|
72
|
+
iconColor: Color? = nil,
|
|
70
73
|
onRightIconPressed: @escaping () -> Void = {},
|
|
71
74
|
onFocus: @escaping () -> Void = {},
|
|
72
75
|
onBlur: @escaping () -> Void = {},
|
|
73
76
|
loading: Bool = false,
|
|
74
77
|
fontWeight: Font.Weight = .regular,
|
|
75
|
-
keyboardType: UIKeyboardType = .default
|
|
78
|
+
keyboardType: UIKeyboardType = .default,
|
|
79
|
+
searchIcon: (() -> AnyView)? = nil,
|
|
80
|
+
placeholderCustomRender: (() -> AnyView)? = nil) {
|
|
76
81
|
self._text = text
|
|
77
82
|
self.buttonText = buttonText
|
|
78
83
|
self.showButtonText = showButtonText
|
|
@@ -90,12 +95,15 @@ public struct InputSearchProps {
|
|
|
90
95
|
self.loading = loading
|
|
91
96
|
self.fontWeight = fontWeight
|
|
92
97
|
self.keyboardType = keyboardType
|
|
98
|
+
self.searchIcon = searchIcon
|
|
99
|
+
self.placeholderCustomRender = placeholderCustomRender
|
|
93
100
|
}
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
// MARK: - InputSearch
|
|
97
104
|
|
|
98
105
|
public struct InputSearch: View {
|
|
106
|
+
@Environment(\.appTheme) private var theme
|
|
99
107
|
@Binding var text: String
|
|
100
108
|
var buttonText: String = ""
|
|
101
109
|
var showButtonText: Bool = false
|
|
@@ -106,17 +114,19 @@ public struct InputSearch: View {
|
|
|
106
114
|
var error: String = ""
|
|
107
115
|
var disabled: Bool = false
|
|
108
116
|
var icon: String = ""
|
|
109
|
-
var iconColor: Color =
|
|
117
|
+
var iconColor: Color? = nil
|
|
110
118
|
var onRightIconPressed: () -> Void = {}
|
|
111
119
|
var onFocus: () -> Void = {}
|
|
112
120
|
var onBlur: () -> Void = {}
|
|
113
121
|
var loading: Bool = false
|
|
114
122
|
var fontWeight: Font.Weight = .regular
|
|
115
123
|
var keyboardType: UIKeyboardType = .default
|
|
116
|
-
|
|
124
|
+
var searchIcon: (() -> AnyView)? = nil
|
|
125
|
+
var placeholderCustomRender: (() -> AnyView)? = nil
|
|
126
|
+
|
|
117
127
|
@State private var isFocused = false
|
|
118
128
|
@State private var isBlurred = false
|
|
119
|
-
|
|
129
|
+
|
|
120
130
|
public init(text: Binding<String>,
|
|
121
131
|
buttonText: String = "",
|
|
122
132
|
showButtonText: Bool = false,
|
|
@@ -127,13 +137,15 @@ public struct InputSearch: View {
|
|
|
127
137
|
error: String = "",
|
|
128
138
|
disabled: Bool = false,
|
|
129
139
|
icon: String = "",
|
|
130
|
-
iconColor: Color =
|
|
140
|
+
iconColor: Color? = nil,
|
|
131
141
|
onRightIconPressed: @escaping () -> Void = {},
|
|
132
142
|
onFocus: @escaping () -> Void = {},
|
|
133
143
|
onBlur: @escaping () -> Void = {},
|
|
134
144
|
loading: Bool = false,
|
|
135
145
|
fontWeight: Font.Weight = .regular,
|
|
136
|
-
keyboardType: UIKeyboardType = .default
|
|
146
|
+
keyboardType: UIKeyboardType = .default,
|
|
147
|
+
searchIcon: (() -> AnyView)? = nil,
|
|
148
|
+
placeholderCustomRender: (() -> AnyView)? = nil) {
|
|
137
149
|
self._text = text
|
|
138
150
|
self.buttonText = buttonText
|
|
139
151
|
self.showButtonText = showButtonText
|
|
@@ -151,24 +163,60 @@ public struct InputSearch: View {
|
|
|
151
163
|
self.loading = loading
|
|
152
164
|
self.fontWeight = fontWeight
|
|
153
165
|
self.keyboardType = keyboardType
|
|
166
|
+
self.searchIcon = searchIcon
|
|
167
|
+
self.placeholderCustomRender = placeholderCustomRender
|
|
154
168
|
}
|
|
155
169
|
|
|
156
|
-
|
|
170
|
+
/// Convenience initializer mirroring Compose's `InputSearch(inputSearchProps)`.
|
|
171
|
+
public init(props: InputSearchProps) {
|
|
172
|
+
self.init(
|
|
173
|
+
text: props.$text,
|
|
174
|
+
buttonText: props.buttonText,
|
|
175
|
+
showButtonText: props.showButtonText,
|
|
176
|
+
showBorder: props.showBorder,
|
|
177
|
+
placeholder: props.placeholder,
|
|
178
|
+
onChangeText: props.onChangeText,
|
|
179
|
+
onPressButtonText: props.onPressButtonText,
|
|
180
|
+
error: props.error,
|
|
181
|
+
disabled: props.disabled,
|
|
182
|
+
icon: props.icon,
|
|
183
|
+
iconColor: props.iconColor,
|
|
184
|
+
onRightIconPressed: props.onRightIconPressed,
|
|
185
|
+
onFocus: props.onFocus,
|
|
186
|
+
onBlur: props.onBlur,
|
|
187
|
+
loading: props.loading,
|
|
188
|
+
fontWeight: props.fontWeight,
|
|
189
|
+
keyboardType: props.keyboardType,
|
|
190
|
+
searchIcon: props.searchIcon,
|
|
191
|
+
placeholderCustomRender: props.placeholderCustomRender
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
|
|
157
196
|
public var body: some View {
|
|
197
|
+
let iconColor: Color = disabled ? theme.colors.text.disable : (self.iconColor ?? theme.colors.text.default)
|
|
158
198
|
VStack(alignment: .leading, spacing: 0) {
|
|
159
199
|
HStack(spacing: 0) {
|
|
160
200
|
HStack {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
201
|
+
if let searchIcon = searchIcon {
|
|
202
|
+
searchIcon()
|
|
203
|
+
} else {
|
|
204
|
+
Image(systemName: "magnifyingglass")
|
|
205
|
+
.foregroundColor(theme.colors.text.hint)
|
|
206
|
+
.frame(width: 24, height: 24)
|
|
207
|
+
.padding(.trailing, Spacing.XS)
|
|
208
|
+
}
|
|
209
|
+
|
|
166
210
|
ZStack(alignment: .leading) {
|
|
167
211
|
if text.isEmpty {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
212
|
+
if let placeholderCustomRender = placeholderCustomRender {
|
|
213
|
+
placeholderCustomRender()
|
|
214
|
+
} else {
|
|
215
|
+
Text(placeholder)
|
|
216
|
+
.foregroundColor(disabled ? theme.colors.text.disable : theme.colors.text.hint)
|
|
217
|
+
.font(.system(size: scaleSize(14), weight: fontWeight))
|
|
218
|
+
.ignoreBoldTextSetting()
|
|
219
|
+
}
|
|
172
220
|
}
|
|
173
221
|
TextField("", text: $text, onEditingChanged: { editing in
|
|
174
222
|
isFocused = editing
|
|
@@ -182,26 +230,33 @@ public struct InputSearch: View {
|
|
|
182
230
|
}
|
|
183
231
|
}, onCommit: {})
|
|
184
232
|
.disabled(disabled)
|
|
185
|
-
.foregroundColor(disabled ?
|
|
186
|
-
.font(.system(size:
|
|
233
|
+
.foregroundColor(disabled ? theme.colors.text.disable : theme.colors.text.default)
|
|
234
|
+
.font(.system(size: scaleSize(14), weight: fontWeight))
|
|
187
235
|
.ignoreBoldTextSetting()
|
|
188
236
|
.keyboardType(keyboardType)
|
|
237
|
+
.applyCursorColor(theme.colors.primary)
|
|
189
238
|
}
|
|
190
239
|
|
|
191
240
|
if isFocused && !text.isEmpty {
|
|
192
|
-
SwiftButton(action: {
|
|
241
|
+
SwiftButton(action: {
|
|
242
|
+
text = ""
|
|
243
|
+
// Kotlin's clear icon fires a callback distinct from
|
|
244
|
+
// onChangeText (`onClearPress`, not ported here); route
|
|
245
|
+
// through onChangeText so clearing isn't a silent no-op.
|
|
246
|
+
onChangeText("")
|
|
247
|
+
}) {
|
|
193
248
|
Image(systemName: "xmark.circle.fill")
|
|
194
|
-
.foregroundColor(
|
|
249
|
+
.foregroundColor(theme.colors.text.hint)
|
|
195
250
|
.frame(width: 16, height: 16)
|
|
196
251
|
}
|
|
197
252
|
.padding(.leading, Spacing.S)
|
|
198
253
|
}
|
|
199
254
|
|
|
200
|
-
RenderRightIconSearch(loading: loading, icon: icon, color:
|
|
255
|
+
RenderRightIconSearch(loading: loading, icon: icon, color: iconColor, onClick: onRightIconPressed)
|
|
201
256
|
}
|
|
202
257
|
.padding(.horizontal, Spacing.M)
|
|
203
258
|
.padding(.vertical, Spacing.S)
|
|
204
|
-
.background(
|
|
259
|
+
.background(theme.colors.background.surface)
|
|
205
260
|
.cornerRadius(Radius.XL)
|
|
206
261
|
.overlay(
|
|
207
262
|
RoundedRectangle(cornerRadius: Radius.XL)
|
|
@@ -211,31 +266,35 @@ public struct InputSearch: View {
|
|
|
211
266
|
|
|
212
267
|
if showButtonText {
|
|
213
268
|
SwiftButton(action: onPressButtonText) {
|
|
214
|
-
|
|
215
|
-
.foregroundColor(Colors.black17)
|
|
216
|
-
.font(.system(size: 14, weight: .medium))
|
|
217
|
-
.ignoreBoldTextSetting()
|
|
269
|
+
MomoText(buttonText, typography: .actionDefaultBold, color: theme.colors.text.default)
|
|
218
270
|
}
|
|
219
271
|
.padding(.leading, Spacing.L)
|
|
220
272
|
}
|
|
221
273
|
}
|
|
222
274
|
}
|
|
223
275
|
}
|
|
224
|
-
}
|
|
225
276
|
|
|
226
|
-
// MARK: - Helper Functions
|
|
227
|
-
|
|
228
|
-
func getBorderColor(isFocused: Bool, error: String, disabled: Bool) -> Color {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
277
|
+
// MARK: - Helper Functions
|
|
278
|
+
|
|
279
|
+
func getBorderColor(isFocused: Bool, error: String, disabled: Bool) -> Color {
|
|
280
|
+
if disabled {
|
|
281
|
+
return theme.colors.border.disable
|
|
282
|
+
} else if !error.isEmpty {
|
|
283
|
+
return theme.colors.error.primary
|
|
284
|
+
} else if isFocused {
|
|
285
|
+
return theme.colors.primary
|
|
286
|
+
} else {
|
|
287
|
+
return theme.colors.border.default
|
|
288
|
+
}
|
|
237
289
|
}
|
|
238
290
|
}
|
|
239
291
|
|
|
240
|
-
|
|
241
|
-
|
|
292
|
+
private extension View {
|
|
293
|
+
func applyCursorColor(_ color: Color) -> some View {
|
|
294
|
+
if #available(iOS 15.0, *) {
|
|
295
|
+
return self.tint(color)
|
|
296
|
+
} else {
|
|
297
|
+
return self
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
@@ -12,6 +12,12 @@ public let DEFAULT_HEIGHT: CGFloat = 104
|
|
|
12
12
|
|
|
13
13
|
struct UITextViewWrapper: UIViewRepresentable {
|
|
14
14
|
@Binding var text: String
|
|
15
|
+
var maxLength: Int
|
|
16
|
+
var textColor: Color
|
|
17
|
+
var cursorColor: Color
|
|
18
|
+
var fontWeight: Font.Weight
|
|
19
|
+
var disabled: Bool
|
|
20
|
+
var onChangeText: (String) -> Void
|
|
15
21
|
var onDone: (() -> Void)?
|
|
16
22
|
var onFocus: (() -> Void)?
|
|
17
23
|
var onBlur: (() -> Void)?
|
|
@@ -19,11 +25,20 @@ struct UITextViewWrapper: UIViewRepresentable {
|
|
|
19
25
|
func makeUIView(context: Context) -> UITextView {
|
|
20
26
|
let textView = UITextView()
|
|
21
27
|
textView.delegate = context.coordinator
|
|
28
|
+
textView.backgroundColor = .clear
|
|
29
|
+
textView.textContainerInset = .zero
|
|
30
|
+
textView.textContainer.lineFragmentPadding = 0
|
|
22
31
|
return textView
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
func updateUIView(_ uiView: UITextView, context: Context) {
|
|
26
|
-
uiView.text
|
|
35
|
+
if uiView.text != text {
|
|
36
|
+
uiView.text = text
|
|
37
|
+
}
|
|
38
|
+
uiView.textColor = UIColor(textColor)
|
|
39
|
+
uiView.tintColor = UIColor(cursorColor)
|
|
40
|
+
uiView.font = UIFont.systemFont(ofSize: scaleSize(16), weight: fontWeight == .bold ? .bold : .regular)
|
|
41
|
+
uiView.isEditable = !disabled
|
|
27
42
|
}
|
|
28
43
|
|
|
29
44
|
func makeCoordinator() -> Coordinator {
|
|
@@ -38,7 +53,12 @@ struct UITextViewWrapper: UIViewRepresentable {
|
|
|
38
53
|
}
|
|
39
54
|
|
|
40
55
|
func textViewDidChange(_ textView: UITextView) {
|
|
41
|
-
|
|
56
|
+
let limited = String(textView.text.prefix(parent.maxLength))
|
|
57
|
+
if textView.text != limited {
|
|
58
|
+
textView.text = limited
|
|
59
|
+
}
|
|
60
|
+
parent.text = limited
|
|
61
|
+
parent.onChangeText(limited)
|
|
42
62
|
}
|
|
43
63
|
|
|
44
64
|
func textViewDidBeginEditing(_ textView: UITextView) {
|
|
@@ -54,27 +74,31 @@ struct UITextViewWrapper: UIViewRepresentable {
|
|
|
54
74
|
parent.onDone?()
|
|
55
75
|
return false
|
|
56
76
|
}
|
|
57
|
-
|
|
77
|
+
let current = textView.text ?? ""
|
|
78
|
+
guard let range = Range(range, in: current) else { return false }
|
|
79
|
+
let proposed = current.replacingCharacters(in: range, with: text)
|
|
80
|
+
return proposed.count <= parent.maxLength
|
|
58
81
|
}
|
|
59
82
|
}
|
|
60
83
|
}
|
|
61
84
|
|
|
62
85
|
// Make the struct public
|
|
63
86
|
public struct InputTextArea: View {
|
|
87
|
+
@Environment(\.appTheme) private var theme
|
|
64
88
|
@Binding var text: String
|
|
65
89
|
var maxLength: Int = MAX_LENGTH
|
|
66
90
|
var height: CGFloat = DEFAULT_HEIGHT
|
|
67
91
|
var floatingValue: String = ""
|
|
68
|
-
var floatingValueColor: Color
|
|
92
|
+
var floatingValueColor: Color?
|
|
69
93
|
var floatingIcon: String = ""
|
|
70
|
-
var floatingIconColor: Color
|
|
94
|
+
var floatingIconColor: Color?
|
|
71
95
|
var placeholder: String = ""
|
|
72
96
|
var onChangeText: (String) -> Void = { _ in }
|
|
73
97
|
var error: String = ""
|
|
74
98
|
var errorSpacing: Bool = false
|
|
75
99
|
var disabled: Bool = false
|
|
76
100
|
var icon: String = ""
|
|
77
|
-
var iconColor: Color
|
|
101
|
+
var iconColor: Color?
|
|
78
102
|
var onRightIconPressed: () -> Void = {}
|
|
79
103
|
var onFocus: () -> Void = {}
|
|
80
104
|
var onBlur: () -> Void = {}
|
|
@@ -85,6 +109,7 @@ public struct InputTextArea: View {
|
|
|
85
109
|
|
|
86
110
|
@State private var isFocused = false
|
|
87
111
|
@State private var isBlurred = false
|
|
112
|
+
@State private var floatingLabelHeight: CGFloat = 16
|
|
88
113
|
|
|
89
114
|
// Make the initializer public
|
|
90
115
|
public init(
|
|
@@ -92,16 +117,16 @@ public struct InputTextArea: View {
|
|
|
92
117
|
maxLength: Int = MAX_LENGTH,
|
|
93
118
|
height: CGFloat = DEFAULT_HEIGHT,
|
|
94
119
|
floatingValue: String = "",
|
|
95
|
-
floatingValueColor: Color =
|
|
120
|
+
floatingValueColor: Color? = nil,
|
|
96
121
|
floatingIcon: String = "",
|
|
97
|
-
floatingIconColor: Color =
|
|
122
|
+
floatingIconColor: Color? = nil,
|
|
98
123
|
placeholder: String = "",
|
|
99
124
|
onChangeText: @escaping (String) -> Void = { _ in },
|
|
100
125
|
error: String = "",
|
|
101
126
|
errorSpacing: Bool = false,
|
|
102
127
|
disabled: Bool = false,
|
|
103
128
|
icon: String = "",
|
|
104
|
-
iconColor: Color =
|
|
129
|
+
iconColor: Color? = nil,
|
|
105
130
|
onRightIconPressed: @escaping () -> Void = {},
|
|
106
131
|
onFocus: @escaping () -> Void = {},
|
|
107
132
|
onBlur: @escaping () -> Void = {},
|
|
@@ -138,77 +163,124 @@ public struct InputTextArea: View {
|
|
|
138
163
|
ZStack(alignment: .topLeading) {
|
|
139
164
|
if !floatingValue.isEmpty || !floatingIcon.isEmpty {
|
|
140
165
|
HStack(spacing: 4) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
166
|
+
MomoText(
|
|
167
|
+
floatingValue,
|
|
168
|
+
typography: .labelSMedium,
|
|
169
|
+
color: disabled ? theme.colors.text.disable : (floatingValueColor ?? theme.colors.text.hint)
|
|
170
|
+
)
|
|
144
171
|
|
|
145
172
|
if required {
|
|
146
|
-
|
|
147
|
-
.font(.caption)
|
|
148
|
-
.foregroundColor(.red)
|
|
173
|
+
MomoText("*", typography: .labelSMedium, color: theme.colors.error.primary)
|
|
149
174
|
}
|
|
150
175
|
|
|
151
176
|
if !floatingIcon.isEmpty {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
177
|
+
Icon(
|
|
178
|
+
source: floatingIcon,
|
|
179
|
+
size: 16,
|
|
180
|
+
color: disabled ? theme.colors.text.disable : (floatingIconColor ?? theme.colors.text.default)
|
|
181
|
+
)
|
|
182
|
+
.padding(.leading, Spacing.XS)
|
|
155
183
|
}
|
|
156
184
|
}
|
|
157
|
-
.padding(.horizontal,
|
|
158
|
-
.background(
|
|
159
|
-
|
|
185
|
+
.padding(.horizontal, Spacing.S)
|
|
186
|
+
.background(
|
|
187
|
+
GeometryReader { geo in
|
|
188
|
+
Color.clear.onAppear { floatingLabelHeight = geo.size.height }
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
.background(theme.colors.background.surface)
|
|
192
|
+
// Kotlin centers the label within the box-height-tall decorationBox
|
|
193
|
+
// by default, then applies `offsetY = -scaleHeight / 2` — net effect:
|
|
194
|
+
// the label ends up centered exactly on the box's top border. Our
|
|
195
|
+
// ZStack anchors top-leading instead, so matching that requires
|
|
196
|
+
// offsetting by half the label's OWN measured height, not half the
|
|
197
|
+
// (104pt-tall) text-area box height.
|
|
198
|
+
.offset(x: Spacing.S, y: -floatingLabelHeight / 2)
|
|
160
199
|
.zIndex(10)
|
|
161
200
|
}
|
|
162
|
-
|
|
201
|
+
|
|
163
202
|
VStack {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
203
|
+
HStack(alignment: .top, spacing: 0) {
|
|
204
|
+
ZStack(alignment: .topLeading) {
|
|
205
|
+
if text.isEmpty {
|
|
206
|
+
Text(placeholder)
|
|
207
|
+
.foregroundColor(disabled ? theme.colors.text.disable : theme.colors.text.hint)
|
|
208
|
+
.font(.system(size: 16, weight: fontWeight))
|
|
209
|
+
.padding(.horizontal, 16)
|
|
210
|
+
.padding(.vertical, 12)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
UITextViewWrapper(
|
|
214
|
+
text: $text,
|
|
215
|
+
maxLength: maxLength,
|
|
216
|
+
textColor: disabled ? theme.colors.text.disable : theme.colors.text.default,
|
|
217
|
+
cursorColor: theme.colors.primary,
|
|
218
|
+
fontWeight: fontWeight,
|
|
219
|
+
disabled: disabled,
|
|
220
|
+
onChangeText: onChangeText,
|
|
221
|
+
onDone: {
|
|
222
|
+
// Handle done action if needed
|
|
223
|
+
},
|
|
224
|
+
onFocus: {
|
|
225
|
+
isFocused = true
|
|
226
|
+
onFocus()
|
|
227
|
+
}, onBlur: {
|
|
228
|
+
isFocused = false
|
|
229
|
+
isBlurred = true
|
|
230
|
+
onBlur()
|
|
231
|
+
})
|
|
232
|
+
.frame(height: height)
|
|
233
|
+
.padding(.horizontal, 12)
|
|
234
|
+
.padding(.vertical, 8)
|
|
235
|
+
.disabled(disabled)
|
|
171
236
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
.
|
|
188
|
-
|
|
237
|
+
.frame(maxWidth: .infinity)
|
|
238
|
+
|
|
239
|
+
// Clear button (mirrors Compose: focused + non-empty).
|
|
240
|
+
if isFocused && !text.isEmpty {
|
|
241
|
+
SwiftUI.Button(action: {
|
|
242
|
+
text = ""
|
|
243
|
+
onChangeText("")
|
|
244
|
+
}) {
|
|
245
|
+
Icon(source: "24_navigation_close_circle_full", size: 16, color: theme.colors.text.hint)
|
|
246
|
+
}
|
|
247
|
+
.padding(.leading, Spacing.XS)
|
|
248
|
+
.padding(.top, 12)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Loading indicator and right icon (independent, mirrors
|
|
252
|
+
// Compose's RenderRightIcon: both can render at once).
|
|
253
|
+
if loading {
|
|
254
|
+
ActivityIndicator(isAnimating: .constant(true), style: .medium)
|
|
255
|
+
.frame(width: 16, height: 16)
|
|
256
|
+
.padding(.leading, Spacing.XS)
|
|
257
|
+
.padding(.top, 12)
|
|
258
|
+
}
|
|
259
|
+
if !icon.isEmpty {
|
|
260
|
+
SwiftUI.Button(action: onRightIconPressed) {
|
|
261
|
+
Icon(source: icon, size: 24, color: disabled ? theme.colors.text.disable : (iconColor ?? theme.colors.text.default))
|
|
262
|
+
}
|
|
263
|
+
.padding(.leading, Spacing.XS)
|
|
264
|
+
.padding(.top, 12)
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
189
268
|
HStack {
|
|
190
269
|
Spacer()
|
|
191
|
-
|
|
192
|
-
.font(.caption)
|
|
193
|
-
.foregroundColor(.gray)
|
|
270
|
+
MomoText("\(text.count)/\(maxLength)", typography: .descriptionXsRegular, color: theme.colors.text.hint)
|
|
194
271
|
}
|
|
195
272
|
.padding(.horizontal, 16)
|
|
196
273
|
.padding(.bottom, 12)
|
|
197
274
|
}
|
|
198
|
-
.background(
|
|
199
|
-
.cornerRadius(
|
|
275
|
+
.background(theme.colors.background.surface)
|
|
276
|
+
.cornerRadius(Radius.S)
|
|
200
277
|
.overlay(
|
|
201
|
-
RoundedRectangle(cornerRadius:
|
|
278
|
+
RoundedRectangle(cornerRadius: Radius.S)
|
|
202
279
|
.stroke(borderColor, lineWidth: 1)
|
|
203
280
|
)
|
|
204
281
|
}
|
|
205
282
|
|
|
206
|
-
|
|
207
|
-
Text(error)
|
|
208
|
-
.font(.caption)
|
|
209
|
-
.foregroundColor(.red)
|
|
210
|
-
.padding(.top, errorSpacing ? 8 : 4)
|
|
211
|
-
}
|
|
283
|
+
ErrorView(errorMessage: error, errorSpacing: errorSpacing, hintText: "")
|
|
212
284
|
}
|
|
213
285
|
.onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardWillShowNotification)) { _ in
|
|
214
286
|
if !isBlurred {
|
|
@@ -228,16 +300,14 @@ public struct InputTextArea: View {
|
|
|
228
300
|
|
|
229
301
|
private var borderColor: Color {
|
|
230
302
|
if disabled {
|
|
231
|
-
return
|
|
303
|
+
return theme.colors.border.disable
|
|
232
304
|
} else if !error.isEmpty {
|
|
233
|
-
return .
|
|
305
|
+
return theme.colors.error.primary
|
|
234
306
|
} else if isFocused {
|
|
235
|
-
return
|
|
307
|
+
return theme.colors.primary
|
|
236
308
|
} else {
|
|
237
|
-
return
|
|
309
|
+
return theme.colors.border.default
|
|
238
310
|
}
|
|
239
311
|
|
|
240
312
|
}
|
|
241
313
|
}
|
|
242
|
-
|
|
243
|
-
|