"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _typeof = require("@babel/runtime/helpers/typeof");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.States = exports.Regular = exports.default = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

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

var _README = _interopRequireDefault(require("./README.mdx"));

var _ContextMenu = _interopRequireWildcard(require("./ContextMenu"));

var _Link = _interopRequireDefault(require("../Link"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

var _default = {
  title: 'Components/UI Elements/ContextMenu',
  component: _Link.default,
  parameters: {
    componentSubtitle: 'Component',
    status: 'released',
    mdx: _README.default
  }
};
exports.default = _default;

var Regular = function Regular(args) {
  return /*#__PURE__*/_react.default.createElement(_ContextMenu.default, (0, _extends2.default)({}, args, {
    content: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuGroup, null, /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, null, "Itemgroup 1"), /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, null, "Itemgroup 2"), /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, null, "Itemgroup 3")), /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, null, "Item 1"), /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, null, "Item 2"), /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, null, "Item 3"))
  }), /*#__PURE__*/_react.default.createElement("span", null, "Open context menu"));
};

exports.Regular = Regular;
Regular.args = {
  children: 'WFP Homepage',
  href: 'https://www.wfp.org'
};

var States = function States(args) {
  return /*#__PURE__*/_react.default.createElement(_ContextMenu.default, (0, _extends2.default)({}, args, {
    content: function content(_ref) {
      var setVisibility = _ref.setVisibility,
          visibilityChange = _ref.visibilityChange;
      return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuGroup, null, /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, null, "Itemgroup 1"), /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, null, "Itemgroup 2"), /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, null, "Itemgroup 3")), /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, {
        onClick: function onClick() {
          console.log('hide', setVisibility);
          setVisibility(true);
          visibilityChange(true);
        }
      }, "Hide ContextMenu"), /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, null, "Item 2"), /*#__PURE__*/_react.default.createElement(_ContextMenu.ContextMenuItem, null, "Item 3"));
    }
  }), /*#__PURE__*/_react.default.createElement("span", null, "Open context menu"));
};

exports.States = States;
States.args = _objectSpread(_objectSpread({}, Regular.args), {}, {
  style: {
    marginRight: '1rem'
  }
});
States.story = {
  parameters: {
    docs: {
      storyDescription: "Content as function\n      "
    }
  }
};