import{d as u,K as _,I as p,j as b,M as k,c as d,E as B,a as s,t as v,b as n,n as c,a5 as m,g as w,o as a}from"./index-CXwCk-SR.js";import{_ as h}from"./_plugin-vue_export-helper-DlAUqK2U.js";const M={class:"modal__header"},C={class:"modal__title"},E={key:0,class:"modal__footer"},$=u({__name:"Modal",props:{open:{type:Boolean},title:{},width:{default:"520px"},fitBody:{type:Boolean,default:!1},dismissable:{type:Boolean,default:!0}},emits:["close"],setup(e,{emit:f}){const t=e,l=f;function y(){t.dismissable&&l("close")}function i(o){t.open&&t.dismissable&&o.key==="Escape"&&l("close")}return _(()=>window.addEventListener("keydown",i)),p(()=>window.removeEventListener("keydown",i)),(o,r)=>(a(),b(k,{to:"body"},[e.open?(a(),d("div",{key:0,class:"modal",role:"dialog","aria-modal":"true",onClick:B(y,["self"])},[s("div",{class:c(["modal__panel",{"modal__panel--fit":e.fitBody}]),style:w({width:t.width})},[s("header",M,[s("span",C,v(e.title),1),e.dismissable?(a(),d("button",{key:0,type:"button",class:"modal__close","aria-label":"close",onClick:r[0]||(r[0]=g=>l("close"))}," × ")):n("",!0)]),s("div",{class:c(["modal__body",{"modal__body--fit":e.fitBody}])},[m(o.$slots,"default",{},void 0)],2),o.$slots.footer?(a(),d("footer",E,[m(o.$slots,"footer",{},void 0)])):n("",!0)],6)])):n("",!0)]))}}),I=h($,[["__scopeId","data-v-1d2be849"]]);export{I as M};
