"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactstrap = require("reactstrap");
var _useValidClassnames = require("../../../helpers/useValidClassnames.cjs");
var _makeId = require("../../../helpers/props/makeId.cjs");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var FISInput = props => {
  var {
    id,
    name,
    placeholder,
    readOnly,
    autocomplete,
    required,
    options,
    inputStyle,
    clearable,
    showValidity,
    bsSize,
    value,
    valid,
    inputRef,
    onInputChange,
    enabledOptions
  } = props;
  var className = "custom-select ".concat(bsSize != undefined ? 'custom-select-' + bsSize : '', " ").concat((0, _useValidClassnames.useValidClassnames)(valid, showValidity));
  var showValidProps = showValidity == 1 || showValidity == 4 ? {
    valid: valid,
    invalid: !valid
  } : {};
  return /*#__PURE__*/_react.default.createElement(_reactstrap.Input, _extends({
    id: id || (0, _makeId.makeId)(options),
    name: name,
    type: "select",
    className: className,
    innerRef: inputRef,
    placeholder: placeholder || "",
    readOnly: readOnly != undefined ? readOnly : false,
    required: required,
    autoComplete: autocomplete,
    style: inputStyle,
    value: value,
    bsSize: bsSize,
    onChange: onInputChange
  }, showValidProps), clearable && enabledOptions.filter(opt => opt.value == '').length == 0 ? /*#__PURE__*/_react.default.createElement("option", {
    key: "".concat(name, "_option_empty"),
    value: ''
  }, '') : null, enabledOptions.map(opt => /*#__PURE__*/_react.default.createElement("option", _extends({
    key: "".concat(name, "_option_").concat(opt.value),
    value: opt.value
  }, opt.disabled ? {
    disabled: true
  } : {}), opt.label)), clearable ? /*#__PURE__*/_react.default.createElement("option", {
    style: {
      display: "none"
    },
    value: ""
  }) : null);
};
var _default = FISInput;
exports.default = _default;