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 { S as SelectParent } from '../select-menu-BvA3x4Nf.js';
export { O as Option, a as Select } from '../select-menu-BvA3x4Nf.js';
import AutoComplete from './autocomplete.js';
import '../slicedToArray-BB-AwwkK.js';
import '../defineProperty-CEd-kZQW.js';
import '../floating-ui.react-cWPyyUrN.js';
import '../typeof-CgC7Bq6K.js';
import '../toConsumableArray-dKQYsfpV.js';
import '../index-qSfOyGhk.js';
import 'react-dom';
import 'classnames';
import '../_commonjsHelpers-_1FafXWI.js';
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';

var _excluded = ["type"];
var TYPES = {
  select: SelectParent,
  autocomplete: AutoComplete
};
var SelectMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
  var _ref$type = _ref.type,
      type = _ref$type === void 0 ? "select" : _ref$type,
      props = _objectWithoutProperties(_ref, _excluded);

  if (props.async || props.create) type = "autocomplete";
  var Component = TYPES[type];
  return /*#__PURE__*/React__default.createElement(Component, _extends({}, props, {
    ref: ref
  }));
});

function Separator() {
  return /*#__PURE__*/React__default.createElement("div", {
    className: "border-b border-gray-200 my-1",
    role: "separator"
  });
}

var separator = Separator();
SelectMenu.propTypes = {
  type: PropTypes.oneOf(["select", "autocomplete"]),
  className: PropTypes.string,
  label: PropTypes.string,
  "aria-label": PropTypes.string,
  "aria-labelledby": PropTypes.string,
  name: PropTypes.string,
  error: PropTypes.bool,
  onChange: PropTypes.func,

  /** When using async, the options should be a function */
  options: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.func]).isRequired,
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  placeholder: PropTypes.string,

  /** Setting the async prop will change the type to 'autocomplete' */
  async: PropTypes.bool,

  /** With type="autocomplete", this allows to add search input. When a string, it overrides default prefix */
  create: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
  disabled: PropTypes.bool
};

export { SelectMenu as default, separator };
