var __awaiter=this&&this.__awaiter||function(t,e,n,i){function r(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i["throw"](t))}catch(t){o(t)}}function u(t){t.done?n(t.value):r(t.value).then(s,a)}u((i=i.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(e){return u([t,e])}}function u(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(i=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;r=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1];o=a;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(a);break}if(o[2])n.ops.pop();n.trys.pop();continue}a=e.call(t,n)}catch(t){a=[6,t];r=0}finally{i=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-2bf16536.js";import{g as getScrollParent,a as positionElement}from"./position-element-4e9000bc.js";var menuCss=".menu{position:fixed;pointer-events:none;top:0;left:0;padding:2px;background-color:var(--color-surface-1, #F6F6F6);border-radius:8px;-webkit-box-shadow:0px 8px 12px rgba(0, 0, 0, 0.08);box-shadow:0px 8px 12px rgba(0, 0, 0, 0.08);width:240px;opacity:0;-webkit-transition:opacity 0.5s;-moz-transition:opacity 0.5s;transition:opacity 0.5s;z-index:90000}.menu__open{pointer-events:auto;opacity:1}.outzone{position:fixed;top:0;left:0;width:100%;height:100vh;z-index:80000}";var BdsMenuStyle0=menuCss;var BdsMenu=function(){function t(t){var e=this;registerInstance(this,t);this.bdsToggle=createEvent(this,"bdsToggle",7);this.refMenuElement=function(t){e.menuElement=t};this.onClickCloseButtom=function(t){e.open=false;t.stopPropagation()};this.refElement=null;this.intoView=null;this.menupositionTop=0;this.menupositionLeft=0;this.menu=null;this.position="right";this.open=false}t.prototype.componentWillLoad=function(){this.refElement=document.getElementById(this.menu);this.intoView=getScrollParent(this.refElement)};t.prototype.toggle=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.open=!this.open;return[2]}))}))};t.prototype.openMenu=function(){this.bdsToggle.emit({value:this.open});if(this.open){var t=positionElement({actionElement:this.refElement,changedElement:this.menuElement,intoView:this.intoView});this.menupositionTop=t.top;this.menupositionLeft=t.left}};t.prototype.render=function(){var t;var e=this;var n={top:"".concat(this.menupositionTop,"px"),left:"".concat(this.menupositionLeft,"px")};return h(Host,{key:"c6d6665307bc889fce632b4dc0757319bd7d53f9"},h("div",{key:"e2fbdd3122c159f2e162e1050560c74c0e36860c",ref:this.refMenuElement,class:(t={menu:true},t["menu__".concat(this.position)]=true,t["menu__open"]=this.open,t),style:n},h("slot",{key:"e6ca6e31b4af181de7dd071f48a9026e3a68d458"})),this.open&&h("div",{key:"bdeffea095ddc8e81bde07fbc03b640a0ed7a45f",class:{outzone:true},onClick:function(t){return e.onClickCloseButtom(t)}}))};Object.defineProperty(t,"watchers",{get:function(){return{open:["openMenu"]}},enumerable:false,configurable:true});return t}();BdsMenu.style=BdsMenuStyle0;export{BdsMenu as bds_menu};
//# sourceMappingURL=bds-menu.entry.js.map