import { _ as _extends } from '../extends-C4cduGrv.js';
import { _ as _objectWithoutProperties } from '../objectWithoutProperties-TXwlfNxG.js';
import React__default, { forwardRef } from 'react';
import PropTypes from 'prop-types';
import MultiSelectInput from './input.js';
import MultiSelectFilter from './filter.js';
import '../defineProperty-CEd-kZQW.js';
import '../toConsumableArray-dKQYsfpV.js';
import '../slicedToArray-BB-AwwkK.js';
import '../floating-ui.react-cWPyyUrN.js';
import '../typeof-CgC7Bq6K.js';
import '../index-qSfOyGhk.js';
import 'react-dom';
import 'classnames';
import '../label/index.js';
import '@reach/visually-hidden';
import '../ck-icon/index.js';
import '../ck-icon/assets/icon-map/index.js';
import '../icon/index.js';
import '@fortawesome/react-fontawesome';
import '../icon/icons.js';
import '../icon/library.js';
import '@fortawesome/fontawesome-svg-core';
import '@fortawesome/pro-solid-svg-icons';
import '@fortawesome/pro-light-svg-icons';
import '@fortawesome/free-brands-svg-icons';
import '../portal/index.js';
import '../use-rerender-once/index.js';
import '../use-force-update/index.js';
import '../checkbox/index.js';
import '../select-menu-BvA3x4Nf.js';
import '../_commonjsHelpers-_1FafXWI.js';

var _excluded = ["type"];
var TYPES = {
  input: MultiSelectInput,
  filter: MultiSelectFilter
};
var MultiSelect = /*#__PURE__*/forwardRef(function (_ref, forwardedRef) {
  var _ref$type = _ref.type,
      type = _ref$type === void 0 ? "input" : _ref$type,
      props = _objectWithoutProperties(_ref, _excluded);

  if (props.create) type = "input";
  var Component = TYPES[type];
  return /*#__PURE__*/React__default.createElement(Component, _extends({}, props, {
    ref: forwardedRef
  }));
});
MultiSelect.propTypes = {
  type: PropTypes.oneOf(Object.keys(TYPES)),
  name: PropTypes.string,
  className: PropTypes.string,
  options: PropTypes.array.isRequired,
  value: PropTypes.array,
  label: PropTypes.node,
  placeholder: PropTypes.string,
  onChange: PropTypes.func,
  filter: PropTypes.func,
  error: PropTypes.bool,
  disabled: PropTypes.bool,

  /** With type="input", this allows to add a new option. When a string, it overrides default prefix */
  create: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
  "aria-label": PropTypes.string,
  "aria-labelledby": PropTypes.string
};

export { MultiSelect as default };
