|
|
@ -28,6 +28,8 @@ type Props = Readonly<{
|
|
|
|
errorMessage?: React.ReactNode;
|
|
|
|
errorMessage?: React.ReactNode;
|
|
|
|
isLabelHidden?: boolean;
|
|
|
|
isLabelHidden?: boolean;
|
|
|
|
label: string;
|
|
|
|
label: string;
|
|
|
|
|
|
|
|
// Minimum query length before any results will be shown.
|
|
|
|
|
|
|
|
minQueryLength?: number;
|
|
|
|
noResultsMessage?: string;
|
|
|
|
noResultsMessage?: string;
|
|
|
|
onQueryChange: (
|
|
|
|
onQueryChange: (
|
|
|
|
value: string,
|
|
|
|
value: string,
|
|
|
@ -80,6 +82,7 @@ export default function Typeahead({
|
|
|
|
errorMessage,
|
|
|
|
errorMessage,
|
|
|
|
isLabelHidden,
|
|
|
|
isLabelHidden,
|
|
|
|
label,
|
|
|
|
label,
|
|
|
|
|
|
|
|
minQueryLength = 0,
|
|
|
|
noResultsMessage = 'No results',
|
|
|
|
noResultsMessage = 'No results',
|
|
|
|
nullable = false,
|
|
|
|
nullable = false,
|
|
|
|
options,
|
|
|
|
options,
|
|
|
@ -167,6 +170,7 @@ export default function Typeahead({
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</Combobox.Button>
|
|
|
|
</Combobox.Button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{query.length >= minQueryLength && (
|
|
|
|
<Transition
|
|
|
|
<Transition
|
|
|
|
afterLeave={() => setQuery('')}
|
|
|
|
afterLeave={() => setQuery('')}
|
|
|
|
as={Fragment}
|
|
|
|
as={Fragment}
|
|
|
@ -207,6 +211,7 @@ export default function Typeahead({
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
</Combobox.Options>
|
|
|
|
</Combobox.Options>
|
|
|
|
</Transition>
|
|
|
|
</Transition>
|
|
|
|
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Combobox>
|
|
|
|
</Combobox>
|
|
|
|
{errorMessage && (
|
|
|
|
{errorMessage && (
|
|
|
|