@lotics/ui 2.1.0 → 2.2.0
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/package.json +1 -1
- package/src/combobox.tsx +14 -0
package/package.json
CHANGED
package/src/combobox.tsx
CHANGED
|
@@ -63,6 +63,14 @@ export interface ComboboxProps<T extends string = string, D = unknown> {
|
|
|
63
63
|
emptyText?: string;
|
|
64
64
|
accessibilityLabel?: string;
|
|
65
65
|
disabled?: boolean;
|
|
66
|
+
/** Single-select only: show an in-input clear ✕ whenever the input has text
|
|
67
|
+
* (a reflected selection or a typed query). Pressing it empties the input,
|
|
68
|
+
* resets the search, and fires `onClear` so the consumer can deselect. */
|
|
69
|
+
clearable?: boolean;
|
|
70
|
+
/** Fired when the clear ✕ is pressed (the input + search are reset first). */
|
|
71
|
+
onClear?: () => void;
|
|
72
|
+
/** Accessible label for the clear ✕ (default "Clear"). */
|
|
73
|
+
clearLabel?: string;
|
|
66
74
|
autoFocus?: boolean;
|
|
67
75
|
testID?: string;
|
|
68
76
|
style?: StyleProp<ViewStyle>;
|
|
@@ -106,6 +114,9 @@ export function Combobox<T extends string = string, D = unknown>(props: Combobox
|
|
|
106
114
|
emptyText = "No results",
|
|
107
115
|
accessibilityLabel = "Results",
|
|
108
116
|
disabled = false,
|
|
117
|
+
clearable = false,
|
|
118
|
+
onClear,
|
|
119
|
+
clearLabel,
|
|
109
120
|
autoFocus = false,
|
|
110
121
|
testID,
|
|
111
122
|
style,
|
|
@@ -262,6 +273,9 @@ export function Combobox<T extends string = string, D = unknown>(props: Combobox
|
|
|
262
273
|
testID={testID}
|
|
263
274
|
icon={multi ? undefined : "search"}
|
|
264
275
|
value={query}
|
|
276
|
+
clearable={!multi && clearable}
|
|
277
|
+
clearLabel={clearLabel}
|
|
278
|
+
onClear={onClear}
|
|
265
279
|
onChangeText={handleChangeText}
|
|
266
280
|
onFocus={() => {
|
|
267
281
|
if (!disabled) setOpen(true);
|