@momo-kits/native-kits 0.162.44 → 0.162.45
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 +45 -3
- package/README.md +2 -2
- package/ios/Application/ApplicationEnvironment.swift +17 -0
- package/ios/Application/MaxApi.swift +30 -3
- package/ios/Avatar/Avatar.swift +4 -3
- package/ios/Badge/Badge.swift +6 -4
- package/ios/Badge/BadgeDot.swift +1 -1
- package/ios/Badge/BadgeRibbon.swift +0 -1
- package/ios/Button/Button.swift +15 -12
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +64 -18
- package/ios/Carousel/Carousel.swift +29 -12
- package/ios/Checkbox/Checkbox.swift +7 -3
- package/ios/Chip/Chip.swift +5 -4
- package/ios/Collapse/Collapse.swift +70 -19
- package/ios/Colors+Radius+Spacing/Colors.swift +10 -1
- package/ios/Colors+Radius+Spacing/Radius.swift +6 -0
- package/ios/DateTimePicker/DateTimePicker.swift +54 -20
- package/ios/DateTimePicker/WheelPicker.swift +103 -105
- package/ios/Divider/Divider.swift +37 -4
- package/ios/Extensions/Color++.swift +38 -9
- package/ios/Extensions/OptionalEnvironmentObject.swift +12 -0
- package/ios/Extensions/SkeletonUICompat.swift +11 -0
- package/ios/Icon/Icon.swift +21 -23
- package/ios/Icon/Icons.swift +1329 -0
- package/ios/IconButton/IconButton.swift +15 -7
- package/ios/Image/Image.swift +7 -23
- package/ios/Information/Information.swift +27 -9
- package/ios/Input/ErrorView.swift +2 -2
- package/ios/Input/Input.swift +160 -147
- package/ios/Input/InputPhoneNumber.swift +12 -9
- package/ios/Input/InputSearch.swift +107 -77
- 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 +187 -3
- package/ios/Layout/Item.swift +5 -4
- package/ios/Layout/ScreenLayout.swift +385 -0
- package/ios/Layout/Section.swift +4 -100
- package/ios/Loader/Loader.swift +5 -9
- package/ios/Lottie/LottieView.swift +14 -2
- package/ios/{Application/Navigation/Overplay → Navigation}/BottomSheet.swift +169 -29
- package/ios/Navigation/BottomTab/BottomTab.swift +332 -0
- package/ios/{Application/Navigation → Navigation}/BottomTab/BottomTabBar.swift +18 -7
- package/ios/Navigation/BottomTab/DuoBarCompression.swift +104 -0
- package/ios/Navigation/BottomTab/DuoTabBar.swift +329 -0
- package/ios/{Application → Navigation/Component}/FloatingButton.swift +43 -54
- package/ios/Navigation/Component/Header.swift +545 -0
- package/ios/Navigation/Component/HeaderBackground.swift +154 -0
- package/ios/Navigation/Component/HeaderJourney.swift +73 -0
- package/ios/Navigation/Component/HeaderLocation.swift +48 -0
- package/ios/Navigation/Component/HeaderRight.swift +425 -0
- package/ios/Navigation/Component/HeaderTitle.swift +36 -0
- package/ios/{Application/Navigation → Navigation/Component}/HeaderUser.swift +21 -24
- package/ios/Navigation/Component/SideBar.swift +183 -0
- package/ios/{Application/Navigation/Overplay → Navigation/Component}/SnackBar.swift +8 -8
- package/ios/Navigation/HostBackGestureBridge.swift +78 -0
- package/ios/{Application/Navigation/Overplay → Navigation}/ModalScreen.swift +9 -2
- package/ios/Navigation/Navigation.swift +204 -0
- package/ios/Navigation/NavigationContainer.swift +195 -0
- package/ios/{Application/Navigation → Navigation}/Navigator.swift +207 -107
- package/ios/Navigation/StackScreen.swift +930 -0
- package/ios/Navigation/StackTransition.swift +400 -0
- package/ios/Navigation/SwipeBackHaptic.swift +33 -0
- package/ios/{Application/Navigation → Navigation}/Tracking/ScreenTracker.swift +12 -5
- package/ios/OTPKeyboard/OTPKeyboard.swift +8 -11
- package/ios/Pagination/PaginationScroll.swift +2 -2
- package/ios/Popup/PopupDisplay.swift +72 -135
- package/ios/Popup/PopupInput.swift +10 -13
- package/ios/Popup/PopupLayout.swift +140 -0
- package/ios/Popup/PopupNotify.swift +59 -69
- package/ios/Popup/PopupPromotion.swift +31 -47
- package/ios/PopupView/FullscreenPopup.swift +13 -19
- package/ios/PopupView/PopupView.swift +1 -1
- package/ios/PopupView/Utils++.swift +0 -8
- package/ios/ProgressInfo/ProgressInfo.swift +4 -2
- package/ios/Radio/Radio.swift +2 -1
- package/ios/Rating/Rating.swift +9 -1
- package/ios/Resources/dot_loading.json +558 -0
- package/ios/Resources/lottie_circle_loader.json +1 -0
- package/ios/ScrollIndicator/ScrollIndicator.swift +11 -10
- package/ios/Skeleton/Skeleton.swift +22 -27
- package/ios/Slider/Slider.swift +16 -18
- package/ios/Stepper/Stepper.swift +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 +106 -54
- package/ios/Title/Title.swift +6 -17
- package/ios/Tooltip/Tooltip.swift +29 -14
- package/ios/Typography/FontScale.swift +3 -3
- package/ios/Typography/Text.swift +81 -19
- package/ios/Uploader/Uploader.swift +3 -1
- package/ios/native-kits.podspec +2 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DuoTabDemo.swift +80 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +2 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IPhoneDuoDemo.swift +173 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +77 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +2 -2
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +2 -0
- package/package.json +1 -1
- package/scripts/gen-ios-icons.mjs +36 -0
- package/ios/Application/Components.swift +0 -270
- package/ios/Application/ComposeApi.swift +0 -22
- package/ios/Application/HeaderRight.swift +0 -306
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +0 -104
- package/ios/Application/Navigation/HeaderBackProps.swift +0 -66
- package/ios/Application/Navigation/HeaderTitle.swift +0 -57
- package/ios/Application/Navigation/NavigationContainer.swift +0 -213
- package/ios/Application/Navigation/NavigationOptions.swift +0 -109
- package/ios/Application/Navigation/NavigatorManager.swift +0 -22
- package/ios/Application/Navigation/component/Header.swift +0 -178
- package/ios/Application/Navigation/component/HeaderBackground.swift +0 -83
- package/ios/Application/Navigation/component/HeaderColor.swift +0 -65
- package/ios/Application/Navigation/component/HeaderRightWidthKey.swift +0 -11
- package/ios/Application/Navigation/component/NavigationFooter.swift +0 -90
- package/ios/Application/Navigation/component/NavigationHeaderRight.swift +0 -196
- package/ios/Application/Screen.swift +0 -250
- package/ios/Application/StackScreen.swift +0 -492
- /package/ios/{Application/Navigation → Navigation}/BottomTab/CurvedContainer.swift +0 -0
|
@@ -76,16 +76,15 @@ public struct InputPhoneNumber: View {
|
|
|
76
76
|
}
|
|
77
77
|
)
|
|
78
78
|
|
|
79
|
-
VStack(alignment: .leading, spacing:
|
|
79
|
+
VStack(alignment: .leading, spacing: 0) {
|
|
80
80
|
HStack(spacing: 0) {
|
|
81
81
|
// 🇻🇳 Flag
|
|
82
82
|
ImageView("https://static.momocdn.net/app/img/icon/ic-qrcode-package/ic_vn_flag.png")
|
|
83
83
|
.frame(width: 24, height: 24)
|
|
84
84
|
.padding(.trailing, Spacing.XS)
|
|
85
|
-
|
|
86
|
-
MomoText("+84", typography: size == .small ? .headerSSemibold : .headerMBold)
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
|
|
86
|
+
MomoText("+84", typography: size == .small ? .headerSSemibold : .headerMBold, color: theme.colors.text.default)
|
|
87
|
+
|
|
89
88
|
Rectangle()
|
|
90
89
|
.fill(theme.colors.border.default)
|
|
91
90
|
.frame(width: 1, height: size == .small ? 24 : 32)
|
|
@@ -105,7 +104,9 @@ public struct InputPhoneNumber: View {
|
|
|
105
104
|
handleFocusChange(focused)
|
|
106
105
|
})
|
|
107
106
|
.keyboardType(.numberPad)
|
|
108
|
-
.font(size == .small
|
|
107
|
+
.font(size == .small
|
|
108
|
+
? fontScale.font(size: 14, weight: .semibold)
|
|
109
|
+
: fontScale.font(size: 18, weight: .bold))
|
|
109
110
|
.ignoreBoldTextSetting()
|
|
110
111
|
.foregroundColor(theme.colors.text.default)
|
|
111
112
|
.applyCursorColor(theme.colors.primary)
|
|
@@ -125,13 +126,14 @@ public struct InputPhoneNumber: View {
|
|
|
125
126
|
onChangeText?("")
|
|
126
127
|
}) {
|
|
127
128
|
Icon(source: "24_navigation_close_circle_full", size: 16, color: theme.colors.text.hint)
|
|
128
|
-
.padding(.
|
|
129
|
+
.padding(.horizontal, Spacing.S)
|
|
129
130
|
}
|
|
131
|
+
.accessibilityIdentifier("ic_clear")
|
|
130
132
|
}
|
|
131
|
-
|
|
133
|
+
|
|
132
134
|
// Loading indicator
|
|
133
135
|
if loading {
|
|
134
|
-
ActivityIndicator(isAnimating: .constant(true), style: .medium)
|
|
136
|
+
ActivityIndicator(isAnimating: .constant(true), style: .medium, color: rightIconColor ?? theme.colors.text.default)
|
|
135
137
|
.frame(width: 16, height: 16)
|
|
136
138
|
}
|
|
137
139
|
|
|
@@ -166,6 +168,7 @@ public struct InputPhoneNumber: View {
|
|
|
166
168
|
// MARK: - Helpers
|
|
167
169
|
|
|
168
170
|
private func handleFocusChange(_ focused: Bool) {
|
|
171
|
+
guard focused != isFocused else { return }
|
|
169
172
|
isFocused = focused
|
|
170
173
|
if focused {
|
|
171
174
|
onFocus?()
|
|
@@ -18,16 +18,17 @@ struct RenderRightIconSearch: View {
|
|
|
18
18
|
var body: some View {
|
|
19
19
|
HStack(spacing: 0) {
|
|
20
20
|
if loading {
|
|
21
|
-
ActivityIndicator(isAnimating: .constant(true), style: .medium)
|
|
21
|
+
ActivityIndicator(isAnimating: .constant(true), style: .medium, color: color)
|
|
22
22
|
.frame(width: 16, height: 16)
|
|
23
23
|
.padding(.horizontal, Spacing.S)
|
|
24
24
|
}
|
|
25
25
|
if !icon.isEmpty {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.
|
|
26
|
+
// Compose: a 1pt rule inset S from the top and bottom of the 36pt bar.
|
|
27
|
+
Rectangle()
|
|
28
|
+
.fill(theme.colors.primary)
|
|
29
|
+
.frame(width: 1, height: 36 - Spacing.S * 2)
|
|
29
30
|
.padding(.leading, Spacing.S)
|
|
30
|
-
|
|
31
|
+
|
|
31
32
|
Icon(source: icon, size: 24, color: color)
|
|
32
33
|
.padding(.leading, Spacing.S)
|
|
33
34
|
.onTapGesture(perform: onClick)
|
|
@@ -44,6 +45,8 @@ public struct InputSearchProps {
|
|
|
44
45
|
var placeholder: String = ""
|
|
45
46
|
var onChangeText: (String) -> Void = { _ in }
|
|
46
47
|
var onPressButtonText: () -> Void = {}
|
|
48
|
+
/// Without one, a header search's button text pops the screen (Compose `SearchAnimated`).
|
|
49
|
+
var hasButtonTextAction = false
|
|
47
50
|
var error: String = ""
|
|
48
51
|
var disabled: Bool = false
|
|
49
52
|
var icon: String = ""
|
|
@@ -58,6 +61,10 @@ public struct InputSearchProps {
|
|
|
58
61
|
var searchIcon: (() -> AnyView)? = nil
|
|
59
62
|
// Mirrors Compose's InputSearchProps.placeholderCustomRender — a custom placeholder view.
|
|
60
63
|
var placeholderCustomRender: (() -> AnyView)? = nil
|
|
64
|
+
var backgroundColor: Color? = nil
|
|
65
|
+
var clearCondition: (() -> Bool)? = nil
|
|
66
|
+
var onClearPress: () -> Void = {}
|
|
67
|
+
var onSubmit: () -> Void = {}
|
|
61
68
|
|
|
62
69
|
public init(text: Binding<String>,
|
|
63
70
|
buttonText: String = "",
|
|
@@ -65,7 +72,7 @@ public struct InputSearchProps {
|
|
|
65
72
|
showBorder: Bool = true,
|
|
66
73
|
placeholder: String = "",
|
|
67
74
|
onChangeText: @escaping (String) -> Void = { _ in },
|
|
68
|
-
onPressButtonText:
|
|
75
|
+
onPressButtonText: (() -> Void)? = nil,
|
|
69
76
|
error: String = "",
|
|
70
77
|
disabled: Bool = false,
|
|
71
78
|
icon: String = "",
|
|
@@ -77,14 +84,19 @@ public struct InputSearchProps {
|
|
|
77
84
|
fontWeight: Font.Weight = .regular,
|
|
78
85
|
keyboardType: UIKeyboardType = .default,
|
|
79
86
|
searchIcon: (() -> AnyView)? = nil,
|
|
80
|
-
placeholderCustomRender: (() -> AnyView)? = nil
|
|
87
|
+
placeholderCustomRender: (() -> AnyView)? = nil,
|
|
88
|
+
backgroundColor: Color? = nil,
|
|
89
|
+
clearCondition: (() -> Bool)? = nil,
|
|
90
|
+
onClearPress: @escaping () -> Void = {},
|
|
91
|
+
onSubmit: @escaping () -> Void = {}) {
|
|
81
92
|
self._text = text
|
|
82
93
|
self.buttonText = buttonText
|
|
83
94
|
self.showButtonText = showButtonText
|
|
84
95
|
self.showBorder = showBorder
|
|
85
96
|
self.placeholder = placeholder
|
|
86
97
|
self.onChangeText = onChangeText
|
|
87
|
-
self.onPressButtonText = onPressButtonText
|
|
98
|
+
self.onPressButtonText = onPressButtonText ?? {}
|
|
99
|
+
self.hasButtonTextAction = onPressButtonText != nil
|
|
88
100
|
self.error = error
|
|
89
101
|
self.disabled = disabled
|
|
90
102
|
self.icon = icon
|
|
@@ -97,6 +109,10 @@ public struct InputSearchProps {
|
|
|
97
109
|
self.keyboardType = keyboardType
|
|
98
110
|
self.searchIcon = searchIcon
|
|
99
111
|
self.placeholderCustomRender = placeholderCustomRender
|
|
112
|
+
self.backgroundColor = backgroundColor
|
|
113
|
+
self.clearCondition = clearCondition
|
|
114
|
+
self.onClearPress = onClearPress
|
|
115
|
+
self.onSubmit = onSubmit
|
|
100
116
|
}
|
|
101
117
|
}
|
|
102
118
|
|
|
@@ -124,6 +140,10 @@ public struct InputSearch: View {
|
|
|
124
140
|
var keyboardType: UIKeyboardType = .default
|
|
125
141
|
var searchIcon: (() -> AnyView)? = nil
|
|
126
142
|
var placeholderCustomRender: (() -> AnyView)? = nil
|
|
143
|
+
var backgroundColor: Color? = nil
|
|
144
|
+
var clearCondition: (() -> Bool)? = nil
|
|
145
|
+
var onClearPress: () -> Void = {}
|
|
146
|
+
var onSubmit: () -> Void = {}
|
|
127
147
|
|
|
128
148
|
@State private var isFocused = false
|
|
129
149
|
@State private var isBlurred = false
|
|
@@ -146,7 +166,11 @@ public struct InputSearch: View {
|
|
|
146
166
|
fontWeight: Font.Weight = .regular,
|
|
147
167
|
keyboardType: UIKeyboardType = .default,
|
|
148
168
|
searchIcon: (() -> AnyView)? = nil,
|
|
149
|
-
placeholderCustomRender: (() -> AnyView)? = nil
|
|
169
|
+
placeholderCustomRender: (() -> AnyView)? = nil,
|
|
170
|
+
backgroundColor: Color? = nil,
|
|
171
|
+
clearCondition: (() -> Bool)? = nil,
|
|
172
|
+
onClearPress: @escaping () -> Void = {},
|
|
173
|
+
onSubmit: @escaping () -> Void = {}) {
|
|
150
174
|
self._text = text
|
|
151
175
|
self.buttonText = buttonText
|
|
152
176
|
self.showButtonText = showButtonText
|
|
@@ -166,6 +190,10 @@ public struct InputSearch: View {
|
|
|
166
190
|
self.keyboardType = keyboardType
|
|
167
191
|
self.searchIcon = searchIcon
|
|
168
192
|
self.placeholderCustomRender = placeholderCustomRender
|
|
193
|
+
self.backgroundColor = backgroundColor
|
|
194
|
+
self.clearCondition = clearCondition
|
|
195
|
+
self.onClearPress = onClearPress
|
|
196
|
+
self.onSubmit = onSubmit
|
|
169
197
|
}
|
|
170
198
|
|
|
171
199
|
/// Convenience initializer mirroring Compose's `InputSearch(inputSearchProps)`.
|
|
@@ -189,88 +217,90 @@ public struct InputSearch: View {
|
|
|
189
217
|
fontWeight: props.fontWeight,
|
|
190
218
|
keyboardType: props.keyboardType,
|
|
191
219
|
searchIcon: props.searchIcon,
|
|
192
|
-
placeholderCustomRender: props.placeholderCustomRender
|
|
220
|
+
placeholderCustomRender: props.placeholderCustomRender,
|
|
221
|
+
backgroundColor: props.backgroundColor,
|
|
222
|
+
clearCondition: props.clearCondition,
|
|
223
|
+
onClearPress: props.onClearPress,
|
|
224
|
+
onSubmit: props.onSubmit
|
|
193
225
|
)
|
|
194
226
|
}
|
|
195
227
|
|
|
196
228
|
|
|
197
229
|
public var body: some View {
|
|
198
230
|
let iconColor: Color = disabled ? theme.colors.text.disable : (self.iconColor ?? theme.colors.text.default)
|
|
199
|
-
|
|
231
|
+
HStack(spacing: 0) {
|
|
200
232
|
HStack(spacing: 0) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
.frame(width: 24, height: 24)
|
|
208
|
-
.padding(.trailing, Spacing.XS)
|
|
209
|
-
}
|
|
233
|
+
if let searchIcon = searchIcon {
|
|
234
|
+
searchIcon()
|
|
235
|
+
} else {
|
|
236
|
+
Icon(source: "navigation_search", size: 24, color: theme.colors.text.hint)
|
|
237
|
+
.padding(.trailing, Spacing.XS)
|
|
238
|
+
}
|
|
210
239
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
240
|
+
ZStack(alignment: .leading) {
|
|
241
|
+
if text.isEmpty {
|
|
242
|
+
if let placeholderCustomRender = placeholderCustomRender {
|
|
243
|
+
placeholderCustomRender()
|
|
244
|
+
} else {
|
|
245
|
+
MomoText(
|
|
246
|
+
placeholder,
|
|
247
|
+
typography: fontWeight == .bold ? .actionSBold : .bodyDefaultRegular,
|
|
248
|
+
color: disabled ? theme.colors.text.disable : theme.colors.text.hint,
|
|
249
|
+
maxLines: 1
|
|
250
|
+
)
|
|
221
251
|
}
|
|
222
|
-
TextField("", text: $text, onEditingChanged: { editing in
|
|
223
|
-
isFocused = editing
|
|
224
|
-
if editing {
|
|
225
|
-
onFocus()
|
|
226
|
-
} else if isBlurred {
|
|
227
|
-
onBlur()
|
|
228
|
-
}
|
|
229
|
-
if editing && !isBlurred {
|
|
230
|
-
isBlurred = true
|
|
231
|
-
}
|
|
232
|
-
}, onCommit: {})
|
|
233
|
-
.disabled(disabled)
|
|
234
|
-
.foregroundColor(disabled ? theme.colors.text.disable : theme.colors.text.default)
|
|
235
|
-
.font(.system(size: fontScale(14), weight: fontWeight))
|
|
236
|
-
.ignoreBoldTextSetting()
|
|
237
|
-
.keyboardType(keyboardType)
|
|
238
|
-
.applyCursorColor(theme.colors.primary)
|
|
239
252
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
// through onChangeText so clearing isn't a silent no-op.
|
|
247
|
-
onChangeText("")
|
|
248
|
-
}) {
|
|
249
|
-
Image(systemName: "xmark.circle.fill")
|
|
250
|
-
.foregroundColor(theme.colors.text.hint)
|
|
251
|
-
.frame(width: 16, height: 16)
|
|
253
|
+
TextField("", text: $text, onEditingChanged: { editing in
|
|
254
|
+
isFocused = editing
|
|
255
|
+
if editing {
|
|
256
|
+
onFocus()
|
|
257
|
+
} else if isBlurred {
|
|
258
|
+
onBlur()
|
|
252
259
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
260
|
+
if editing && !isBlurred {
|
|
261
|
+
isBlurred = true
|
|
262
|
+
}
|
|
263
|
+
}, onCommit: onSubmit)
|
|
264
|
+
.disabled(disabled)
|
|
265
|
+
.foregroundColor(disabled ? theme.colors.text.disable : theme.colors.text.default)
|
|
266
|
+
.font(.system(size: fontScale(14), weight: fontWeight))
|
|
267
|
+
.ignoreBoldTextSetting()
|
|
268
|
+
.keyboardType(keyboardType)
|
|
269
|
+
.applyCursorColor(theme.colors.primary)
|
|
257
270
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if showButtonText {
|
|
269
|
-
SwiftButton(action: onPressButtonText) {
|
|
270
|
-
MomoText(buttonText, typography: .actionDefaultBold, color: theme.colors.text.default)
|
|
271
|
+
|
|
272
|
+
if clearCondition?() == true || (isFocused && !text.isEmpty) {
|
|
273
|
+
SwiftButton(action: {
|
|
274
|
+
text = ""
|
|
275
|
+
// Compose only fires onClearPress; onChangeText("") is kept so existing
|
|
276
|
+
// SwiftUI callers that filter on it still see the clear.
|
|
277
|
+
onChangeText("")
|
|
278
|
+
onClearPress()
|
|
279
|
+
}) {
|
|
280
|
+
Icon(source: "24_navigation_close_circle_full", size: 16, color: theme.colors.text.hint)
|
|
271
281
|
}
|
|
272
|
-
.padding(.leading, Spacing.
|
|
282
|
+
.padding(.leading, Spacing.XS)
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
RenderRightIconSearch(loading: loading, icon: icon, color: iconColor, onClick: onRightIconPressed)
|
|
286
|
+
}
|
|
287
|
+
.padding(.horizontal, Spacing.M)
|
|
288
|
+
.frame(maxWidth: .infinity, alignment: .leading)
|
|
289
|
+
.frame(height: 36)
|
|
290
|
+
.background(
|
|
291
|
+
RoundedRectangle(cornerRadius: Radius.XL)
|
|
292
|
+
.fill(backgroundColor ?? theme.colors.background.surface)
|
|
293
|
+
)
|
|
294
|
+
.overlay(
|
|
295
|
+
RoundedRectangle(cornerRadius: Radius.XL)
|
|
296
|
+
.stroke(showBorder ? getBorderColor(isFocused: isFocused, error: error, disabled: disabled) : .clear, lineWidth: 1)
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
if showButtonText {
|
|
300
|
+
SwiftButton(action: onPressButtonText) {
|
|
301
|
+
MomoText(buttonText, typography: .actionDefaultBold, color: theme.colors.text.default)
|
|
273
302
|
}
|
|
303
|
+
.padding(.leading, Spacing.L)
|
|
274
304
|
}
|
|
275
305
|
}
|
|
276
306
|
}
|