import{e as v,q as h,D as k,x as w,b as p,T as C,w as b,E as B,o as s,c as a,a as t,t as V,n,a3 as r,G as g,_ as E}from"./cgAj8pMR.js";const O={class:"custom-modal__header"},L={key:0,class:"custom-modal__title"},M={class:"custom-modal__body"},S={key:0,class:"custom-modal__footer"},$=v({__name:"CustomModal",props:{modelValue:{type:Boolean},title:{},width:{default:"30rem"},closeOnOverlay:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(o,{emit:m}){const d=o,y=m;function i(){y("update:modelValue",!1)}function f(){d.closeOnOverlay&&i()}function _(e){e.stopPropagation()}function c(e){e.key==="Escape"&&d.modelValue&&i()}function u(e){e?document.body.style.overflow="hidden":document.body.style.overflow=""}return h(()=>d.modelValue,e=>{u(e),e?document.addEventListener("keydown",c):document.removeEventListener("keydown",c)}),k(()=>{u(!1),document.removeEventListener("keydown",c)}),(e,l)=>(s(),w(B,{to:"body"},[p(C,{name:"modal"},{default:b(()=>[o.modelValue?(s(),a("div",{key:0,class:"custom-modal",onClick:f},[l[1]||(l[1]=t("div",{class:"custom-modal__overlay"},null,-1)),t("div",{class:"custom-modal__content",style:g({width:o.width}),onClick:_},[t("div",O,[o.title?(s(),a("h3",L,V(o.title),1)):n("",!0),r(e.$slots,"header",{},void 0,!0),o.showClose?(s(),a("button",{key:1,type:"button",class:"custom-modal__close","aria-label":"关闭",onClick:i},[...l[0]||(l[0]=[t("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},[t("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])])):n("",!0)]),t("div",M,[r(e.$slots,"default",{},void 0,!0)]),e.$slots.footer?(s(),a("div",S,[r(e.$slots,"footer",{},void 0,!0)])):n("",!0)],4)])):n("",!0)]),_:3})]))}}),N=Object.assign(E($,[["__scopeId","data-v-503de887"]]),{__name:"CustomModal"});export{N as _};
