"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _menu = _interopRequireDefault(require("@alifd/next/lib/menu"));
var _react = _interopRequireDefault(require("react"));
var ContextMenu = function ContextMenu(props) {
  var position = props.position,
    onSelect = props.onSelect,
    items = props.items,
    open = props.open;
  return /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      display: open ? "block" : "none",
      position: "absolute",
      top: position === null || position === void 0 ? void 0 : position.top,
      left: position === null || position === void 0 ? void 0 : position.left
    }
  }, /*#__PURE__*/_react["default"].createElement(_menu["default"], null, items.map(function (item) {
    return /*#__PURE__*/_react["default"].createElement(_menu["default"].Item, {
      onClick: function onClick() {
        onSelect(item.key);
      },
      key: item.key
    }, item.label);
  })));
};
var _default = exports["default"] = ContextMenu;