import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
import React__default, { useState } from 'react';
import { Multiselect } from 'multiselect-react-dropdown';
import { DropdownWrapper } from './style.js';
import DropdownArrowIcon from '../../Icons/DropdownArrowIcon/index.js';
import DropdownArrowIconSmall from '../../Icons/DropdownArrowIconSmall/index.js';
import CloseDropdownIcon from '../../Icons/CloseDropdownIcon/index.js';
import RequiredLabel from '../../labels/RequiredLabel/index.js';
import theme from '../../../Globals/theme.js';
import { ThemeProvider } from 'styled-components';
import globalStyle from '../../../Globals/global-styles.js';

var Dropdown = function Dropdown(_ref) {
  var items = _ref.items,
      label = _ref.label,
      placeholder = _ref.placeholder,
      size = _ref.size,
      isDisable = _ref.isDisable,
      onChange = _ref.onChange;

  var _useState = useState(items),
      _useState2 = _slicedToArray(_useState, 1),
      option = _useState2[0];

  return /*#__PURE__*/React__default.createElement(ThemeProvider, {
    theme: theme
  }, /*#__PURE__*/React__default.createElement(globalStyle, null), /*#__PURE__*/React__default.createElement(DropdownWrapper, {
    size: size === "small" ? "10px" : "14px"
  }, label && /*#__PURE__*/React__default.createElement(RequiredLabel, {
    label: label
  }), /*#__PURE__*/React__default.createElement("div", {
    className: "DropdownContainer"
  }, /*#__PURE__*/React__default.createElement(Multiselect, {
    options: option,
    displayValue: "options",
    showArrow: true,
    customArrow: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, size === "small" ? /*#__PURE__*/React__default.createElement(DropdownArrowIconSmall, null) : /*#__PURE__*/React__default.createElement(DropdownArrowIcon, null)),
    disable: isDisable,
    singleSelect: true,
    id: "DropdownSelect",
    placeholder: placeholder,
    avoidHighlightFirstOption: "true",
    customCloseIcon: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CloseDropdownIcon, null)),
    onSelect: function onSelect(selectedList, selectedItem) {
      return onChange(selectedList, selectedItem);
    }
  }))));
};

export { Dropdown as default };
//# sourceMappingURL=index.js.map
