"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _styles = require("@material-ui/core/styles");
var _reactIntl = require("react-intl");
var _Icon = _interopRequireDefault(require("../MaterialUI/DataDisplay/Icon"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var useStyles = (0, _styles.makeStyles)(function (theme) {
  return {
    drawer: {
      position: "absolute",
      zIndex: 19999,
      margin: "4px 0 0",
      left: function left(props) {
        return props.alignRight ? "auto" : "0";
      },
      right: function right(props) {
        return props.alignRight ? "0" : "auto";
      },
      transition: "opacity 100ms ease-out",
      "&.enter-active": {
        opacity: 1,
        visibility: "visible"
      },
      "&.exit-active": {
        opacity: 0,
        visibility: "hidden"
      }
    },
    list: {
      color: theme.palette.text.primary,
      backgroundColor: "white",
      border: "1px solid ".concat(theme.palette.text.hint),
      borderRadius: "5px",
      listStyleType: "none",
      padding: "5px 0",
      margin: "0",
      fontFamily: "Open Sans, sans-serif",
      fontSize: "12px",
      width: "max-content"
    },
    item: {
      boxSizing: "border-box",
      height: "30px",
      minWidth: "178px",
      padding: "9px 12px",
      display: "flex",
      alignItems: "center",
      cursor: "pointer",
      "&:hover": {
        backgroundColor: theme.palette.primary.main,
        color: "white"
      }
    },
    itemIcon: {
      paddingRight: "11px",
      fontSize: "17px"
    }
  };
});
var Menu = function Menu(_ref) {
  var id = _ref.id,
    open = _ref.open,
    menuItems = _ref.menuItems,
    reset = _ref.reset,
    alignRight = _ref.alignRight;
  var classes = useStyles({
    alignRight: alignRight
  });
  return /*#__PURE__*/_react.default.createElement("div", {
    className: "".concat(classes.drawer, " ").concat(open ? "enter-active" : "exit-active")
  }, /*#__PURE__*/_react.default.createElement("ul", {
    id: id,
    className: classes.list
  }, menuItems.map(function (item) {
    var _item$label;
    return /*#__PURE__*/_react.default.createElement("li", {
      id: item.id,
      key: item.id || ((_item$label = item.label) == null ? void 0 : _item$label.id) + (item.icon || ""),
      className: classes.item,
      onClick: function onClick(event) {
        reset();
        item.handler(event);
      }
    }, item.icon ? /*#__PURE__*/_react.default.createElement(_Icon.default, {
      id: item.icon,
      className: classes.itemIcon
    }) : null, typeof item.label === "string" ? item.label : /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, item.label));
  })));
};
__signature__(Menu, "useStyles{classes}", function () {
  return [useStyles];
});
__signature__(Menu, "useStyles{classes}", function () {
  return [useStyles];
});
var _default = Menu;
var _default2 = _default;
var _default3 = exports.default = _default2;
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
  reactHotLoader.register(Menu, "Menu", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
  reactHotLoader.register(Menu, "Menu", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();