"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var FISSList = props => {
  var {
    name,
    maxShownOptions,
    listRef,
    optionsMap,
    onSelect,
    optActive
  } = props;
  var getListStyle = () => {
    // TODO
    // Check where this gap (13 / 6) comes from and try to make better
    /*if (filterRef.current) {  
      return {
        left: filterRef.current.parentNode.children[0].offsetWidth+13+'px',
        minWidth: filterRef.current.offsetWidth+'px',
        maxWidth: filterRef.current.offsetWidth+'px'
      }
    }*/
    return {};
  };
  return /*#__PURE__*/_react.default.createElement("div", {
    className: "formiga-reactstrap-select-search-list list-group shadow-lg",
    ref: listRef,
    style: getListStyle()
  }, optionsMap.map((opt, idx) => {
    if (idx <= maxShownOptions - 1) {
      return /*#__PURE__*/_react.default.createElement("div", {
        key: "".concat(name, "_option_").concat(opt.value),
        value: opt.value,
        className: "formiga-reactstrap-select-search-list-item list-group-item list-group-item-action ".concat(opt.disabled ? 'disabled' : '', " ").concat(optActive == idx ? 'active' : ''),
        onClick: ev => !opt.disabled && onSelect(opt.value, ev)
      }, opt.label || /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "\xA0"));
    }
  }), optionsMap.length > maxShownOptions ? /*#__PURE__*/_react.default.createElement("div", {
    key: "".concat(name, "_option_ellipsis"),
    className: "formiga-reactstrap-select-search-list-item list-group-item list-group-item-action disabled ellipsis"
  }, "...") : null);
};
var _default = FISSList;
exports.default = _default;