"use strict";

exports.__esModule = true;
exports.default = void 0;
var _find2 = _interopRequireDefault(require("lodash/fp/find"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _select = _interopRequireWildcard(require("../../../atom/select"));
var _style = _interopRequireDefault(require("./style.css"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const DropDown = props => {
  const {
    options,
    onChange,
    theme: propsTheme,
    'aria-label': ariaLabel,
    groupAriaLabel
  } = props;
  const currentSelection = (0, _find2.default)('selected', options);
  const defaultTheme = !currentSelection || currentSelection.validOption === false ? 'invalid' : 'question';
  const theme = propsTheme || defaultTheme;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.wrapper,
    role: "group",
    "aria-label": groupAriaLabel
  }, /*#__PURE__*/_react.default.createElement(_select.default, {
    "aria-label": ariaLabel,
    theme: theme,
    options: options,
    onChange: onChange
  }));
};
DropDown.propTypes = process.env.NODE_ENV !== "production" ? {
  onChange: _select.default.propTypes.onChange,
  options: _propTypes.default.arrayOf(_propTypes.default.shape(_select.SelectOptionPropTypes)),
  theme: _select.default.propTypes.theme,
  'aria-label': _propTypes.default.string,
  groupAriaLabel: _propTypes.default.string
} : {};
var _default = exports.default = DropDown;
//# sourceMappingURL=index.js.map