{isSearching ? (
// Filtered results when searching
filteredOptions.length === 0 ? (
{__('No options found')}
) : (
filteredOptions.map((option, index) =>
renderOptionItem(option, index, index === highlightedIndex)
)
)
) : (
// Split view: selected first, then unselected
{selectedOptions.length > 0 && (
{__('Selected')}
{selectedOptions.map((option, index) =>
renderOptionItem(option, index, index === highlightedIndex)
)}
)}
{unselectedOptions.length > 0 && (
{__('Available')}
{unselectedOptions.map((option, index) => {
const optionIndex = selectedOptions.length + index
return renderOptionItem(option, optionIndex, optionIndex === highlightedIndex)
})}
)}
{selectedOptions.length === 0 && unselectedOptions.length === 0 && (
{__('No options available')}
)}