@@ -578,53 +578,6 @@ const LookupDropdown: FC<LookupDropdownProps> = ({
578578 'slds-dropdown_fluid'
579579 ) ;
580580
581- const renderListHeader = ( ) => {
582- if ( ! listHeader ) return null ;
583-
584- return (
585- < li role = 'presentation' className = 'slds-listbox__item' >
586- < div
587- id = { getOptionId ( listHeaderIdSeed ) }
588- className = 'slds-media slds-media_center slds-listbox__option slds-listbox__option_entity slds-listbox__option_term'
589- role = 'option'
590- aria-selected = 'true'
591- tabIndex = { 0 }
592- onFocus = { ( ) => onOptionFocus ( listHeaderIdSeed ) }
593- >
594- { listHeader }
595- </ div >
596- </ li >
597- ) ;
598- } ;
599-
600- const renderListFooter = ( ) => {
601- if ( ! listFooter ) return null ;
602- return (
603- < li role = 'presentation' className = 'slds-listbox__item' >
604- < div
605- id = { getOptionId ( listFooterIdSeed ) }
606- className = 'slds-media slds-media_center slds-listbox__option slds-listbox__option_entity'
607- role = 'option'
608- tabIndex = { 0 }
609- onFocus = { ( ) => onOptionFocus ( listFooterIdSeed ) }
610- >
611- { listFooter }
612- </ div >
613- </ li >
614- ) ;
615- } ;
616-
617- const renderLoadingSpinner = ( ) => {
618- if ( ! loading ) return null ;
619- return (
620- < li role = 'option' className = 'slds-listbox__item' >
621- < div className = 'slds-align_absolute-center slds-p-top_medium' >
622- < Spinner container = { false } size = 'x-small' layout = 'inline' />
623- </ div >
624- </ li >
625- ) ;
626- } ;
627-
628581 return (
629582 < div
630583 id = { listboxId }
@@ -641,7 +594,20 @@ const LookupDropdown: FC<LookupDropdownProps> = ({
641594 onKeyDown = { onKeyDown }
642595 onBlur = { onBlur }
643596 >
644- { renderListHeader ( ) }
597+ { listHeader ? (
598+ < li role = 'presentation' className = 'slds-listbox__item' >
599+ < div
600+ id = { getOptionId ( listHeaderIdSeed ) }
601+ className = 'slds-media slds-media_center slds-listbox__option slds-listbox__option_entity slds-listbox__option_term'
602+ role = 'option'
603+ aria-selected = 'true'
604+ tabIndex = { 0 }
605+ onFocus = { ( ) => onOptionFocus ( listHeaderIdSeed ) }
606+ >
607+ { listHeader }
608+ </ div >
609+ </ li >
610+ ) : null }
645611 { filteredData . map ( ( entry ) => (
646612 < LookupOption
647613 key = { entry . value }
@@ -652,8 +618,26 @@ const LookupDropdown: FC<LookupDropdownProps> = ({
652618 onOptionFocus = { onOptionFocus }
653619 />
654620 ) ) }
655- { renderLoadingSpinner ( ) }
656- { renderListFooter ( ) }
621+ { loading ? (
622+ < li role = 'option' className = 'slds-listbox__item' >
623+ < div className = 'slds-align_absolute-center slds-p-top_medium' >
624+ < Spinner container = { false } size = 'x-small' layout = 'inline' />
625+ </ div >
626+ </ li >
627+ ) : null }
628+ { listFooter ? (
629+ < li role = 'presentation' className = 'slds-listbox__item' >
630+ < div
631+ id = { getOptionId ( listFooterIdSeed ) }
632+ className = 'slds-media slds-media_center slds-listbox__option slds-listbox__option_entity'
633+ role = 'option'
634+ tabIndex = { 0 }
635+ onFocus = { ( ) => onOptionFocus ( listFooterIdSeed ) }
636+ >
637+ { listFooter }
638+ </ div >
639+ </ li >
640+ ) : null }
657641 </ ul >
658642 </ div >
659643 ) ;
0 commit comments