import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _extends from "@babel/runtime/helpers/extends";

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) { _defineProperty(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; }

import React from 'react';
import markdown from './README.mdx';
import ContextMenu, { ContextMenuGroup, ContextMenuItem } from './ContextMenu';
import Link from '../Link';
export default {
  title: 'Components/UI Elements/ContextMenu',
  component: Link,
  parameters: {
    componentSubtitle: 'Component',
    status: 'released',
    mdx: markdown
  }
};
export var Regular = function Regular(args) {
  return /*#__PURE__*/React.createElement(ContextMenu, _extends({}, args, {
    content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ContextMenuGroup, null, /*#__PURE__*/React.createElement(ContextMenuItem, null, "Itemgroup 1"), /*#__PURE__*/React.createElement(ContextMenuItem, null, "Itemgroup 2"), /*#__PURE__*/React.createElement(ContextMenuItem, null, "Itemgroup 3")), /*#__PURE__*/React.createElement(ContextMenuItem, null, "Item 1"), /*#__PURE__*/React.createElement(ContextMenuItem, null, "Item 2"), /*#__PURE__*/React.createElement(ContextMenuItem, null, "Item 3"))
  }), /*#__PURE__*/React.createElement("span", null, "Open context menu"));
};
Regular.args = {
  children: 'WFP Homepage',
  href: 'https://www.wfp.org'
};
export var States = function States(args) {
  return /*#__PURE__*/React.createElement(ContextMenu, _extends({}, args, {
    content: function content(_ref) {
      var setVisibility = _ref.setVisibility,
          visibilityChange = _ref.visibilityChange;
      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ContextMenuGroup, null, /*#__PURE__*/React.createElement(ContextMenuItem, null, "Itemgroup 1"), /*#__PURE__*/React.createElement(ContextMenuItem, null, "Itemgroup 2"), /*#__PURE__*/React.createElement(ContextMenuItem, null, "Itemgroup 3")), /*#__PURE__*/React.createElement(ContextMenuItem, {
        onClick: function onClick() {
          console.log('hide', setVisibility);
          setVisibility(true);
          visibilityChange(true);
        }
      }, "Hide ContextMenu"), /*#__PURE__*/React.createElement(ContextMenuItem, null, "Item 2"), /*#__PURE__*/React.createElement(ContextMenuItem, null, "Item 3"));
    }
  }), /*#__PURE__*/React.createElement("span", null, "Open context menu"));
};
States.args = _objectSpread(_objectSpread({}, Regular.args), {}, {
  style: {
    marginRight: '1rem'
  }
});
States.story = {
  parameters: {
    docs: {
      storyDescription: "Content as function\n      "
    }
  }
};