'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');
var styles$1 = require('../../dropdown/styles.js');
var styles = require('../styles.js');
var utils = require('../utils.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

function SearchOptions({ searchOptions, noResultsText, value, focusElement, onClick, setFocusElement, }) {
    return (React__default['default'].createElement(React__default['default'].Fragment, null, searchOptions.length < 1 ? (React__default['default'].createElement(styles.NoResultsText, { onMouseDown: (e) => e.preventDefault() }, noResultsText)) : (searchOptions.map((opt, index) => {
        const slicedValue = utils.getSlicedValue(opt, value);
        return (React__default['default'].createElement(styles$1.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['default'].createElement(styles.ItemValue, null,
            React__default['default'].createElement("b", null, slicedValue.bolded),
            slicedValue.end)) : (React__default['default'].createElement(React__default['default'].Fragment, null,
            React__default['default'].createElement("div", null, opt.label),
            opt.altText && React__default['default'].createElement("div", null, opt.altText)))));
    }))));
}

exports.SearchOptions = SearchOptions;
