-
-
- hasSelection && !multiple ? optionLabel?.(selected) : ""
- }
- onChange={({ target }) => setQuery(target.value)}
- onFocus={props.onFocus}
- onBlur={() => {
- props.onBlur?.();
- }}
- autoComplete="off"
- />
- {!disabled && (
-
-
- {hasSelection && !loading && !required && (
-
- {
- e.preventDefault();
- onChange(null);
- }}
- />
-
- {t("clear_selection")}
-
-
- )}
- {loading ? (
-
- ) : (
-
- )}
-
-
- )}
-
-
-
- {data?.length === 0 ? (
-
- {query !== ""
- ? "Nothing found."
- : "Start typing to search..."}
-
- ) : (
- data?.map((item: any) => (
-
- {({ selected }) => (
-
-
- {optionLabel(item)}
- {optionLabelChip(item) && (
-
- {optionLabelChip(item)}
-
- )}
-
- {selected && (
-
- )}
-
- )}
-
- ))
- )}
-
-
- {multiple && selected?.length > 0 && (
-
- {selected?.map((option: any, index: number) => (
-
- onChange(
- selected.filter((item: any) => item.id !== option.id),
- )
- }
- />
- ))}
-
- )}
- {error && (
-
- {error}
-
- )}
-
-