|| value.toString() ); const onViewMoreClick = (event: any) => { // Set the index for the next item to focus after view more clicked, then call view more callback setViewMoreNextIndex(); onClick(event); }; const renderOption = ( onSelect: ( event: React.MouseEvent | React.ChangeEvent, value: string | SelectOptionObject, isPlaceholder?: boolean ) => void, onClose: () => void, variant: string, inputIdPrefix: string, onFavorite: (itemId: string, isFavorite: boolean) => void, shouldResetOnSelect: boolean ) => { if (variant !== SelectVariant.checkbox && isLoading && isGrouped) { return (
{children}
); } else if (variant !== SelectVariant.checkbox && isLoad && isGrouped) { return (
); } else if (variant !== SelectVariant.checkbox) { return (
- {isLoading && children} {isLoad && !isGrouped && (
  )} {!isLoading && !isLoad && ( <> { if (!isDisabled) { onClick(event); onSelect(event, value, isPlaceholder); shouldResetOnSelect && onClose(); } }} role="option" aria-selected={isSelected || null} ref={this.ref} onKeyDown={(event: React.KeyboardEvent) => { this.onKeyDown(event, 0); }} type="button" > {description && ( {itemDisplay} {isSelected && ( )} {description} )} {!description && ( {itemDisplay} {isSelected && ( )} )} {isFavorite !== null && id && favoriteButton(onFavorite)} )}
); } else if (variant === SelectVariant.checkbox && isLoad) { return (
); } else if (variant === SelectVariant.checkbox && isLoading) { return (
{children}
); } else if (variant === SelectVariant.checkbox && !isNoResultsOption && !isLoading && !isLoad) { return ( { this.onKeyDown(event, 0, undefined, true); }} > { if (!isDisabled) { onClick(event); onSelect(event, value); } }} ref={this.ref} checked={isChecked || false} disabled={isDisabled} /> {itemDisplay} {description &&
{description}
} ); } else if (variant === SelectVariant.checkbox && isNoResultsOption && !isLoading && !isLoad) { return (
{ this.onKeyDown(event, 0, undefined, true); }} type="button" > {itemDisplay}
); } }; return ( {({ onSelect, onClose, variant, inputIdPrefix, onFavorite, shouldResetOnSelect }) => ( {renderOption(onSelect, onClose, variant, inputIdPrefix, onFavorite, shouldResetOnSelect)} )} ); } } export { SelectOption };