"use strict";

exports.__esModule = true;
exports.default = exports.ItemIcon = exports.Item = exports.List = exports.Drawer = void 0;

var _react = _interopRequireDefault(require("react"));

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _styledTransitionGroup = _interopRequireDefault(require("styled-transition-group"));

var _utils = require("../../utils");

var _Icon = _interopRequireDefault(require("../Icon"));

var _Text = _interopRequireDefault(require("../Text"));

var _templateObject;

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }

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 Drawer = _styledTransitionGroup.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tposition: absolute;\n\tz-index: 19999;\n\tmargin: 4px 0 0;\n\t", ": 0;\n\n\ttransition: opacity ", "ms ease-out;\n\n\t&:enter {\n\t\topacity: 0.01;\n\t}\n\t&:enter-active {\n\t\topacity: 1;\n\t}\n\t&:exit {\n\t\topacity: 1;\n\t}\n\t&:exit-active {\n\t\topacity: 0.01;\n\t}\n"])), (0, _utils.ifFlag)("alignRight", "right", "left"), function (props) {
  return props.timeout;
});

exports.Drawer = Drawer;
Drawer.defaultProps = {
  unmountOnExit: true,
  timeout: 100
};

var List = _styledComponents.default.ul.withConfig({
  displayName: "Menu__List",
  componentId: "sc-hgz6l0-0"
})(["color:", ";background-color:white;border:1px solid ", ";border-radius:5px;list-style-type:none;padding:5px 0;margin:0;font-family:Open Sans,sans-serif;font-size:12px;width:max-content;"], (0, _utils.getThemeProp)(["colors", "text"], "#333333"), (0, _utils.getThemeProp)(["colors", "border"], "#999999"));

exports.List = List;

var Item = _styledComponents.default.li.withConfig({
  displayName: "Menu__Item",
  componentId: "sc-hgz6l0-1"
})(["box-sizing:border-box;height:30px;min-width:178px;padding:9px 12px;display:flex;align-items:center;cursor:pointer;&:hover{background-color:", ";color:white;}"], (0, _utils.getThemeProp)(["colors", "application", "base"], "#ffffff"));

exports.Item = Item;
var ItemIcon = (0, _styledComponents.default)(_Icon.default).withConfig({
  displayName: "Menu__ItemIcon",
  componentId: "sc-hgz6l0-2"
})(["padding-right:11px;font-size:17px;"]);
exports.ItemIcon = ItemIcon;

var Menu = function Menu(_ref) {
  var id = _ref.id,
      open = _ref.open,
      menuItems = _ref.menuItems,
      reset = _ref.reset,
      alignRight = _ref.alignRight;
  return /*#__PURE__*/_react.default.createElement(Drawer, {
    in: open,
    alignRight: alignRight
  }, /*#__PURE__*/_react.default.createElement(List, {
    id: id
  }, menuItems.map(function (item) {
    return /*#__PURE__*/_react.default.createElement(Item, {
      id: item.id,
      key: item.id || (item.label && (0, _utils.safeGet)(item.label, "id")) + (item.icon || ""),
      onClick: function onClick(event) {
        reset();
        item.handler(event);
      }
    }, item.icon ? /*#__PURE__*/_react.default.createElement(ItemIcon, {
      id: item.icon
    }) : null, /*#__PURE__*/_react.default.createElement(_Text.default, {
      message: item.label
    }));
  })));
};

var _default = Menu;
var _default2 = _default;
var _default3 = _default2;
exports.default = _default3;
;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(Drawer, "Drawer", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
  reactHotLoader.register(List, "List", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
  reactHotLoader.register(Item, "Item", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
  reactHotLoader.register(ItemIcon, "ItemIcon", "/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(Drawer, "Drawer", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
  reactHotLoader.register(List, "List", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
  reactHotLoader.register(Item, "Item", "/home/vsts/work/1/s/src/components/DropMenu/Menu.js");
  reactHotLoader.register(ItemIcon, "ItemIcon", "/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);
})();