|
|
@ -22,6 +22,7 @@ type Props = Readonly<{
|
|
|
|
) => void;
|
|
|
|
) => void;
|
|
|
|
onSelect: (option: TypeaheadOption) => void;
|
|
|
|
onSelect: (option: TypeaheadOption) => void;
|
|
|
|
options: ReadonlyArray<TypeaheadOption>;
|
|
|
|
options: ReadonlyArray<TypeaheadOption>;
|
|
|
|
|
|
|
|
placeholder?: string;
|
|
|
|
value?: TypeaheadOption;
|
|
|
|
value?: TypeaheadOption;
|
|
|
|
}>;
|
|
|
|
}>;
|
|
|
|
|
|
|
|
|
|
|
@ -35,6 +36,7 @@ export default function Typeahead({
|
|
|
|
onQueryChange,
|
|
|
|
onQueryChange,
|
|
|
|
value,
|
|
|
|
value,
|
|
|
|
onSelect,
|
|
|
|
onSelect,
|
|
|
|
|
|
|
|
placeholder,
|
|
|
|
}: Props) {
|
|
|
|
}: Props) {
|
|
|
|
const [query, setQuery] = useState('');
|
|
|
|
const [query, setQuery] = useState('');
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -77,6 +79,7 @@ export default function Typeahead({
|
|
|
|
displayValue={(option) =>
|
|
|
|
displayValue={(option) =>
|
|
|
|
(option as unknown as TypeaheadOption)?.label
|
|
|
|
(option as unknown as TypeaheadOption)?.label
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
placeholder={placeholder}
|
|
|
|
onChange={(event) => {
|
|
|
|
onChange={(event) => {
|
|
|
|
setQuery(event.target.value);
|
|
|
|
setQuery(event.target.value);
|
|
|
|
onQueryChange(event.target.value, event);
|
|
|
|
onQueryChange(event.target.value, event);
|
|
|
|