diff --git a/components/form/field/Typeahead.tsx b/components/form/field/Typeahead.tsx index 7a21077..3f416b7 100644 --- a/components/form/field/Typeahead.tsx +++ b/components/form/field/Typeahead.tsx @@ -513,6 +513,7 @@ export const Typeahead: FC<{ resetSearch(); } }} + loading={local.loading} showEmpty={!allow_new} className={popupClassName} open={local.open} diff --git a/components/form/field/typeahead-opt.tsx b/components/form/field/typeahead-opt.tsx index 1813172..6ac28b8 100644 --- a/components/form/field/typeahead-opt.tsx +++ b/components/form/field/typeahead-opt.tsx @@ -6,6 +6,7 @@ import { ButtonBetter } from "../../ui/button"; export type OptionItem = { value: string; label: string }; export const TypeaheadOptions: FC<{ popup?: boolean; + loading?: boolean; open?: boolean; children: any; onOpenChange?: (open: boolean) => void; @@ -25,6 +26,7 @@ export const TypeaheadOptions: FC<{ fitur?: "search-add"; }> = ({ popup, + loading, children, open, onOpenChange, @@ -61,33 +63,41 @@ export const TypeaheadOptions: FC<{ ` )} > - {options.map((item, idx) => { - const is_selected = selected?.({ item, options, idx }); + {!loading ? ( + <> + {options.map((item, idx) => { + const is_selected = selected?.({ item, options, idx }); - if (is_selected) { - local.selectedIdx = idx; - } + if (is_selected) { + local.selectedIdx = idx; + } - return ( -