@momo-kits/native-kits 0.300.3 → 0.300.4
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 +51 -7
- package/README.md +2 -2
- package/ios/Application/ApplicationEnvironment.swift +24 -6
- package/ios/Application/DesignSystemKits.swift +100 -0
- package/ios/Application/DesignSystemKitsPayload.swift +68 -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 +8 -2
- 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 +171 -148
- package/ios/Input/InputPhoneNumber.swift +10 -9
- package/ios/Input/InputSearch.swift +107 -78
- package/ios/Input/InputTextArea.swift +133 -148
- package/ios/InputDropDown/InputDropDown.swift +10 -7
- package/ios/InputMoney/InputMoney.swift +32 -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 +415 -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 +138 -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 +7 -3
- 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 +109 -55
- package/ios/Title/Title.swift +6 -17
- package/ios/Tooltip/Tooltip.swift +29 -14
- package/ios/Typography/FontScale.swift +17 -14
- package/ios/Typography/Text.swift +156 -20
- package/ios/Typography/Typography.swift +2 -2
- package/ios/Uploader/Uploader.swift +3 -1
- package/ios/native-kits.podspec +2 -3
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -3
- 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/publish.sh +19 -2
- 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/Typography/FontScaleStore.swift +0 -58
- package/ios/Typography/KitDesignSystem.swift +0 -17
- /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,7 @@ public struct InputPhoneNumber: View {
|
|
|
105
104
|
handleFocusChange(focused)
|
|
106
105
|
})
|
|
107
106
|
.keyboardType(.numberPad)
|
|
108
|
-
.
|
|
107
|
+
.kitFont(size == .small ? .headerSSemibold : .headerMBold)
|
|
109
108
|
.ignoreBoldTextSetting()
|
|
110
109
|
.foregroundColor(theme.colors.text.default)
|
|
111
110
|
.applyCursorColor(theme.colors.primary)
|
|
@@ -125,13 +124,14 @@ public struct InputPhoneNumber: View {
|
|
|
125
124
|
onChangeText?("")
|
|
126
125
|
}) {
|
|
127
126
|
Icon(source: "24_navigation_close_circle_full", size: 16, color: theme.colors.text.hint)
|
|
128
|
-
.padding(.
|
|
127
|
+
.padding(.horizontal, Spacing.S)
|
|
129
128
|
}
|
|
129
|
+
.accessibilityIdentifier("ic_clear")
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
// Loading indicator
|
|
133
133
|
if loading {
|
|
134
|
-
ActivityIndicator(isAnimating: .constant(true), style: .medium)
|
|
134
|
+
ActivityIndicator(isAnimating: .constant(true), style: .medium, color: rightIconColor ?? theme.colors.text.default)
|
|
135
135
|
.frame(width: 16, height: 16)
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -166,6 +166,7 @@ public struct InputPhoneNumber: View {
|
|
|
166
166
|
// MARK: - Helpers
|
|
167
167
|
|
|
168
168
|
private func handleFocusChange(_ focused: Bool) {
|
|
169
|
+
guard focused != isFocused else { return }
|
|
169
170
|
isFocused = focused
|
|
170
171
|
if focused {
|
|
171
172
|
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
|
|
|
@@ -104,7 +120,6 @@ public struct InputSearchProps {
|
|
|
104
120
|
|
|
105
121
|
public struct InputSearch: View {
|
|
106
122
|
@Environment(\.appTheme) private var theme
|
|
107
|
-
@Environment(\.momoFontScale) private var fontScale
|
|
108
123
|
@Binding var text: String
|
|
109
124
|
var buttonText: String = ""
|
|
110
125
|
var showButtonText: Bool = false
|
|
@@ -124,6 +139,10 @@ public struct InputSearch: View {
|
|
|
124
139
|
var keyboardType: UIKeyboardType = .default
|
|
125
140
|
var searchIcon: (() -> AnyView)? = nil
|
|
126
141
|
var placeholderCustomRender: (() -> AnyView)? = nil
|
|
142
|
+
var backgroundColor: Color? = nil
|
|
143
|
+
var clearCondition: (() -> Bool)? = nil
|
|
144
|
+
var onClearPress: () -> Void = {}
|
|
145
|
+
var onSubmit: () -> Void = {}
|
|
127
146
|
|
|
128
147
|
@State private var isFocused = false
|
|
129
148
|
@State private var isBlurred = false
|
|
@@ -146,7 +165,11 @@ public struct InputSearch: View {
|
|
|
146
165
|
fontWeight: Font.Weight = .regular,
|
|
147
166
|
keyboardType: UIKeyboardType = .default,
|
|
148
167
|
searchIcon: (() -> AnyView)? = nil,
|
|
149
|
-
placeholderCustomRender: (() -> AnyView)? = nil
|
|
168
|
+
placeholderCustomRender: (() -> AnyView)? = nil,
|
|
169
|
+
backgroundColor: Color? = nil,
|
|
170
|
+
clearCondition: (() -> Bool)? = nil,
|
|
171
|
+
onClearPress: @escaping () -> Void = {},
|
|
172
|
+
onSubmit: @escaping () -> Void = {}) {
|
|
150
173
|
self._text = text
|
|
151
174
|
self.buttonText = buttonText
|
|
152
175
|
self.showButtonText = showButtonText
|
|
@@ -166,6 +189,10 @@ public struct InputSearch: View {
|
|
|
166
189
|
self.keyboardType = keyboardType
|
|
167
190
|
self.searchIcon = searchIcon
|
|
168
191
|
self.placeholderCustomRender = placeholderCustomRender
|
|
192
|
+
self.backgroundColor = backgroundColor
|
|
193
|
+
self.clearCondition = clearCondition
|
|
194
|
+
self.onClearPress = onClearPress
|
|
195
|
+
self.onSubmit = onSubmit
|
|
169
196
|
}
|
|
170
197
|
|
|
171
198
|
/// Convenience initializer mirroring Compose's `InputSearch(inputSearchProps)`.
|
|
@@ -189,88 +216,90 @@ public struct InputSearch: View {
|
|
|
189
216
|
fontWeight: props.fontWeight,
|
|
190
217
|
keyboardType: props.keyboardType,
|
|
191
218
|
searchIcon: props.searchIcon,
|
|
192
|
-
placeholderCustomRender: props.placeholderCustomRender
|
|
219
|
+
placeholderCustomRender: props.placeholderCustomRender,
|
|
220
|
+
backgroundColor: props.backgroundColor,
|
|
221
|
+
clearCondition: props.clearCondition,
|
|
222
|
+
onClearPress: props.onClearPress,
|
|
223
|
+
onSubmit: props.onSubmit
|
|
193
224
|
)
|
|
194
225
|
}
|
|
195
226
|
|
|
196
227
|
|
|
197
228
|
public var body: some View {
|
|
198
229
|
let iconColor: Color = disabled ? theme.colors.text.disable : (self.iconColor ?? theme.colors.text.default)
|
|
199
|
-
|
|
230
|
+
HStack(spacing: 0) {
|
|
200
231
|
HStack(spacing: 0) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
.frame(width: 24, height: 24)
|
|
208
|
-
.padding(.trailing, Spacing.XS)
|
|
209
|
-
}
|
|
232
|
+
if let searchIcon = searchIcon {
|
|
233
|
+
searchIcon()
|
|
234
|
+
} else {
|
|
235
|
+
Icon(source: "navigation_search", size: 24, color: theme.colors.text.hint)
|
|
236
|
+
.padding(.trailing, Spacing.XS)
|
|
237
|
+
}
|
|
210
238
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
239
|
+
ZStack(alignment: .leading) {
|
|
240
|
+
if text.isEmpty {
|
|
241
|
+
if let placeholderCustomRender = placeholderCustomRender {
|
|
242
|
+
placeholderCustomRender()
|
|
243
|
+
} else {
|
|
244
|
+
MomoText(
|
|
245
|
+
placeholder,
|
|
246
|
+
typography: fontWeight == .bold ? .actionSBold : .bodyDefaultRegular,
|
|
247
|
+
color: disabled ? theme.colors.text.disable : theme.colors.text.hint,
|
|
248
|
+
maxLines: 1
|
|
249
|
+
)
|
|
221
250
|
}
|
|
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
251
|
}
|
|
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)
|
|
252
|
+
TextField("", text: $text, onEditingChanged: { editing in
|
|
253
|
+
isFocused = editing
|
|
254
|
+
if editing {
|
|
255
|
+
onFocus()
|
|
256
|
+
} else if isBlurred {
|
|
257
|
+
onBlur()
|
|
252
258
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
259
|
+
if editing && !isBlurred {
|
|
260
|
+
isBlurred = true
|
|
261
|
+
}
|
|
262
|
+
}, onCommit: onSubmit)
|
|
263
|
+
.disabled(disabled)
|
|
264
|
+
.foregroundColor(disabled ? theme.colors.text.disable : theme.colors.text.default)
|
|
265
|
+
.kitFont(size: 14, weight: fontWeight)
|
|
266
|
+
.ignoreBoldTextSetting()
|
|
267
|
+
.keyboardType(keyboardType)
|
|
268
|
+
.applyCursorColor(theme.colors.primary)
|
|
257
269
|
}
|
|
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)
|
|
270
|
+
|
|
271
|
+
if clearCondition?() == true || (isFocused && !text.isEmpty) {
|
|
272
|
+
SwiftButton(action: {
|
|
273
|
+
text = ""
|
|
274
|
+
// Compose only fires onClearPress; onChangeText("") is kept so existing
|
|
275
|
+
// SwiftUI callers that filter on it still see the clear.
|
|
276
|
+
onChangeText("")
|
|
277
|
+
onClearPress()
|
|
278
|
+
}) {
|
|
279
|
+
Icon(source: "24_navigation_close_circle_full", size: 16, color: theme.colors.text.hint)
|
|
271
280
|
}
|
|
272
|
-
.padding(.leading, Spacing.
|
|
281
|
+
.padding(.leading, Spacing.XS)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
RenderRightIconSearch(loading: loading, icon: icon, color: iconColor, onClick: onRightIconPressed)
|
|
285
|
+
}
|
|
286
|
+
.padding(.horizontal, Spacing.M)
|
|
287
|
+
.frame(maxWidth: .infinity, alignment: .leading)
|
|
288
|
+
.frame(height: 36)
|
|
289
|
+
.background(
|
|
290
|
+
RoundedRectangle(cornerRadius: Radius.XL)
|
|
291
|
+
.fill(backgroundColor ?? theme.colors.background.surface)
|
|
292
|
+
)
|
|
293
|
+
.overlay(
|
|
294
|
+
RoundedRectangle(cornerRadius: Radius.XL)
|
|
295
|
+
.stroke(showBorder ? getBorderColor(isFocused: isFocused, error: error, disabled: disabled) : .clear, lineWidth: 1)
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
if showButtonText {
|
|
299
|
+
SwiftButton(action: onPressButtonText) {
|
|
300
|
+
MomoText(buttonText, typography: .actionDefaultBold, color: theme.colors.text.default)
|
|
273
301
|
}
|
|
302
|
+
.padding(.leading, Spacing.L)
|
|
274
303
|
}
|
|
275
304
|
}
|
|
276
305
|
}
|