import { _ as _extends } from '../extends-e61fd370.js';
import { _ as _objectWithoutProperties } from '../objectWithoutProperties-72d23964.js';
import React__default, { forwardRef } from 'react';
import PropTypes from 'prop-types';
import { S as StandaloneSelect, C as ComposableSelect } from '../select-74202a5d.js';
export { O as Option } from '../select-74202a5d.js';
import { AutoComplete, ComposableAutocomplete } from './autocomplete.js';
import '../defineProperty-18999f8e.js';
import '../slicedToArray-5b664d46.js';
import '../index-99927619.js';
import '../typeof-6c6d8d7a.js';
import '../toConsumableArray-f2f53597.js';
import '../index-81a9bdac.js';
import 'react-dom';
import 'classnames';
import '../icon/assets/icon-map/index.js';
import '../social-icon/index.js';
import '@fortawesome/react-fontawesome';
import '../social-icon/icons.js';
import '../social-icon/library.js';
import '@fortawesome/fontawesome-svg-core';
import '@fortawesome/free-solid-svg-icons';
import '@fortawesome/free-brands-svg-icons';
import '../tooltip/index.js';
import '../auto-id.esm-2b54f757.js';
import '../utils.esm-514fad91.js';
import '../warning-ed2bf294.js';
import '../portal.esm-613949dc.js';
import '@reach/visually-hidden';
import '../portal/index.js';
import '../use-rerender-once/index.js';
import '../use-force-update/index.js';
import '../button/button-group.js';
import '../inject-css-ccd0a386.js';
import '../_commonjsHelpers-57e89916.js';
import '../label/index.js';
import './util.js';

var _excluded = ["type"],
    _excluded2 = ["type"];
var TYPES = {
  standalone: {
    select: StandaloneSelect,
    autocomplete: AutoComplete
  },
  composable: {
    select: ComposableSelect,
    autocomplete: ComposableAutocomplete
  }
};
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.standalone[type];
  return /*#__PURE__*/React__default.createElement(Component, _extends({}, props, {
    ref: ref
  }));
});
var Select = /*#__PURE__*/forwardRef(function (_ref2, ref) {
  var _ref2$type = _ref2.type,
      type = _ref2$type === void 0 ? "select" : _ref2$type,
      props = _objectWithoutProperties(_ref2, _excluded2);

  if (props.async) {
    throw new Error("Select component does not support async prop. Use SelectMenu instead.");
  }

  var Component = TYPES.composable[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 { Select, SelectMenu as default, separator };
