@momo-kits/native-kits 0.89.33-beta.20 → 0.89.33-beta.22
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.
|
@@ -91,6 +91,7 @@ data class InputSearchProps(
|
|
|
91
91
|
val fontWeight: InputFontWeight = InputFontWeight.REGULAR,
|
|
92
92
|
val keyboardType: KeyboardType = KeyboardType.Text,
|
|
93
93
|
val backgroundColor: Color = Colors.black_01,
|
|
94
|
+
val clearCondition: (() -> Boolean)? = null,
|
|
94
95
|
val keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
|
|
95
96
|
val keyboardActions: KeyboardActions = KeyboardActions.Default,
|
|
96
97
|
val modifier: Modifier = Modifier
|
|
@@ -102,7 +103,6 @@ fun InputSearch(
|
|
|
102
103
|
text = remember { mutableStateOf("") },
|
|
103
104
|
iconColor = AppTheme.current.colors.text.default
|
|
104
105
|
),
|
|
105
|
-
clearCondition: (() -> Boolean)? = null
|
|
106
106
|
) {
|
|
107
107
|
var isFocused by remember { mutableStateOf(false) }
|
|
108
108
|
var isBlurred = false
|
|
@@ -142,7 +142,12 @@ fun InputSearch(
|
|
|
142
142
|
decorationBox = { innerTextField ->
|
|
143
143
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
|
144
144
|
Row(
|
|
145
|
-
modifier = inputSearchProps.modifier.weight(
|
|
145
|
+
modifier = inputSearchProps.modifier.weight(
|
|
146
|
+
inputSearchProps.showButtonText.ifTrue(
|
|
147
|
+
8f,
|
|
148
|
+
1f
|
|
149
|
+
)
|
|
150
|
+
)
|
|
146
151
|
.background(
|
|
147
152
|
inputSearchProps.backgroundColor,
|
|
148
153
|
RoundedCornerShape(Radius.XL)
|
|
@@ -177,7 +182,7 @@ fun InputSearch(
|
|
|
177
182
|
}
|
|
178
183
|
innerTextField()
|
|
179
184
|
}
|
|
180
|
-
if (isFocused && inputSearchProps.text.value.isNotEmpty()) {
|
|
185
|
+
if (inputSearchProps.clearCondition?.invoke() == true || (isFocused && inputSearchProps.text.value.isNotEmpty())) {
|
|
181
186
|
Row {
|
|
182
187
|
Spacer(Modifier.width(Spacing.XS))
|
|
183
188
|
Icon(
|
|
@@ -192,14 +197,12 @@ fun InputSearch(
|
|
|
192
197
|
)
|
|
193
198
|
}
|
|
194
199
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
)
|
|
202
|
-
}
|
|
200
|
+
RenderRightIconSearch(
|
|
201
|
+
inputSearchProps.loading,
|
|
202
|
+
inputSearchProps.icon,
|
|
203
|
+
iconTintColor,
|
|
204
|
+
inputSearchProps.onRightIconPressed
|
|
205
|
+
)
|
|
203
206
|
}
|
|
204
207
|
}
|
|
205
208
|
if (inputSearchProps.showButtonText) {
|