import{Host,h}from"@stencil/core";import{HtmlUtil}from"../../utils/html-util";export class OntoDialog{constructor(){this.handleClose=e=>{this.config.onClose(e)}}componentDidLoad(){this.documentOverflow=HtmlUtil.hideDocumentBodyOverflow(),this.hostElement.addEventListener("keydown",this.preventLeavingDialog.bind(this))}disconnectedCallback(){this.hostElement.removeEventListener("keydown",this.preventLeavingDialog.bind(this)),HtmlUtil.setDocumentBodyOverflow(this.documentOverflow)}render(){return h(Host,{key:"ab4b8093c0997aa2f6edc28df2fae1a518ba67ba",tabindex:"-1"},h("div",{key:"e500065a811dcd5540867cb6bcd490b4dc75cba4",class:`dialog-overlay ${this.config.modalClass?this.config.modalClass:""}`},h("dialog",{key:"4625bdcee25d1acb13a2483c1378d7624660cc2a",class:"dialog"},h("header",{key:"2a4f6a9f6c1792414199fd7f7b58034bcc697597",class:"dialog-header"},h("h3",{key:"7c5f1aecf01f2da7c8acd7cd3cea551c5f54902a",class:"dialog-title"},this.config.dialogTitle),this.config.onClose&&h("button",{key:"db2545a17c48cfe37132b4e18347e8a6f4b5e046","data-test":"close-dialog-btn",class:"close-btn onto-btn",onClick:this.handleClose},h("i",{key:"73f463091799ff17faf7bea9e5d523a7fae5dc81",class:"ri-close-line ri-2x"}))),h("main",{key:"c238ecbc94d02b4d1a7459751eb0a8cf78c2ef01",class:"dialog-body"},h("slot",{key:"99ede8e5090b26c63aa3f6add30505177b0eff5a",name:"body"})),h("footer",{key:"b4718b33ff8b4f2a9124a10a5dca4bdb468057fd",class:"dialog-footer"},h("slot",{key:"8f583242179fd0fc33aba35bf7ad3a655849d75b",name:"footer"})))))}preventLeavingDialog(e){HtmlUtil.preventLeavingDialog(this.hostElement,e)}static get is(){return"onto-dialog"}static get originalStyleUrls(){return{$:["onto-dialog.scss"]}}static get styleUrls(){return{$:["onto-dialog.css"]}}static get properties(){return{config:{type:"unknown",attribute:"config",mutable:!1,complexType:{original:"DialogConfig",resolved:"{ dialogTitle: string; onClose?: (evt: KeyboardEvent | MouseEvent) => void; modalClass?: string; }",references:{DialogConfig:{location:"local",path:"/home/ubuntu/workspace/PRO/GraphDB UI Jobs/workbench/graphdb-workbench-release/packages/shared-components/src/components/dialogs/onto-dialog.tsx",id:"src/components/dialogs/onto-dialog.tsx::DialogConfig"}}},required:!1,optional:!1,docs:{tags:[],text:"Configuration object for the dialog."},getter:!1,setter:!1}}}static get elementRef(){return"hostElement"}}