"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),n=require("@babel/runtime/helpers/objectWithoutProperties"),o=require("react"),r=require("clsx"),i=require("@prom-ui/core/Button"),a=require("@prom-ui/core/Icon"),u=require("@prom-ui/core/Overlay"),c=require("@prom-ui/core/Tooltip"),l=require("@prom-ui/core/useMedia");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var m=d(e),b=d(t),p=d(n),f=s(o),_=d(r),x={buttonContent:"_5zen8",buttonIcon:"X6HfE",buttonText:"-FPMX",list:"_0Zx8o",listItem:"bLGxL","buttonContentColor_red-900":"gQpHo"},h=["children","items","onOpen","onClose","isRenderPortal","placement"],q=function(e){var t=e.children,n=e.items,o=e.onOpen,r=e.onClose,d=e.isRenderPortal,s=void 0===d||d,q=e.placement,C=void 0===q?"bottom-end":q,v=p.default(e,h),y=f.useState(!1),g=b.default(y,2),O=g[0],E=g[1],P=l.useMedia({minWidth:"medium"}),j=function(){o&&o(),E(!0)},k=function(){r&&r(),E(!1)},w=f.createElement("ul",{className:x.list,"data-qaid":v["data-qaid"]||"context_menu","data-testid":v["data-testid"]||"context_menu"},n.map((function(e,t){var n=e.icon,o=e.onClick,r=e.isCloseOnClick,u=void 0===r||r,c=e.color,l=e.children;return f.createElement("li",{key:t,className:x.listItem,"data-qaid":"context_menu_item","data-testid":"context_menu_item"},f.createElement(i.Button,{type:"button","button-theme":"white","button-width":"1-1","button-round":"none","button-padding":"xs m","button-blackhole":["border-none","awesome-content"],"button-weight":"normal","data-qaid":"context_menu_button","data-testid":"context_menu_button",onClick:function(e){u&&k(),o&&o(e)}},f.createElement("div",{className:_.default(x.buttonContent,m.default({},x["buttonContentColor_".concat(c)],Boolean(c)))},!!n&&f.createElement(a.Icon,{className:x.buttonIcon,"icon-as":n,style:{width:24,height:24},"data-qaid":"context_menu_button_icon","data-testid":"context_menu_button_icon"}),f.createElement("div",{className:x.buttonText,"data-qaid":"context_menu_button_text","data-testid":"context_menu_button_text"},l))))})));return P?f.createElement(c.Tooltip,{isRenderPortal:s,trigger:"click",placement:C,isShowArrow:!1,content:w,isVisible:O,padding:"0",onVisibleChange:function(e){O?e||k():e&&j()}},t):f.createElement(f.Fragment,null,f.cloneElement(t,{onClick:j}),f.createElement(u.Overlay,{isRenderPortal:s,isOpen:O,onClose:k,header:null,padding:"0"},w))};q.displayName="ContextMenu",exports.ContextMenu=q,require("./style.production.v2.css");
