import React__default from 'react';
import { OptionItem } from '../../dropdown/styles.js';
import { NoResultsText, ItemValue } from '../styles.js';
import { getSlicedValue } from '../utils.js';

function SearchOptions({ searchOptions, noResultsText, value, focusElement, onClick, setFocusElement, }) {
    return (React__default.createElement(React__default.Fragment, null, searchOptions.length < 1 ? (React__default.createElement(NoResultsText, { onMouseDown: (e) => e.preventDefault() }, noResultsText)) : (searchOptions.map((opt, index) => {
        const slicedValue = getSlicedValue(opt, value);
        return (React__default.createElement(OptionItem, { "data-testid": opt.dataTestId, tabIndex: 0, role: "option", isDisabled: opt.isDisabled, isHovered: focusElement === index, key: String(opt.value), isSelected: value === opt.value, onClick: () => !opt.isDisabled && onClick(opt), onFocus: () => setFocusElement(index), onMouseEnter: () => setFocusElement(index), onMouseDown: (e) => e.preventDefault() }, slicedValue ? (React__default.createElement(ItemValue, null,
            React__default.createElement("b", null, slicedValue.bolded),
            slicedValue.end)) : (React__default.createElement(React__default.Fragment, null,
            React__default.createElement("div", null, opt.label),
            opt.altText && React__default.createElement("div", null, opt.altText)))));
    }))));
}

export { SearchOptions };
