import{a as N,N as h,u as w}from"./NcNoteCard-C6xb7vi0-DTJz1zPW.chunk.mjs";import{d as L,r as u,c as i}from"./vue.runtime.esm-Ccc28AWB.chunk.mjs";import{n as B,G as T}from"./NcLoadingIcon-BcbRVau3.chunk.mjs";const q=L({name:"NcDialog",components:{NcDialogButton:N,NcModal:h},props:{name:{type:String,required:!0},message:{type:String,default:""},additionalTrapElements:{type:Array,validator:a=>Array.isArray(a)&&a.every(t=>typeof t=="string"||t instanceof HTMLElement),default:()=>[]},container:{type:String,required:!1,default:"body"},open:{type:Boolean,default:!0},size:{type:String,required:!1,default:"small",validator:a=>typeof a=="string"&&["small","normal","large","full"].includes(a)},buttons:{type:Array,required:!1,default:()=>[],validator:a=>Array.isArray(a)&&a.every(t=>typeof t=="object")},noClose:{type:Boolean,default:!1},canClose:{type:Boolean,default:!0},closeOnClickOutside:{type:Boolean,default:!1},isForm:{type:Boolean,default:!1},outTransition:{type:Boolean,default:!1},navigationClasses:{type:[String,Array,Object],required:!1,default:""},navigationAriaLabel:{type:String,required:!1,default:""},navigationAriaLabelledby:{type:String,required:!1,default:""},contentClasses:{type:[String,Array,Object],required:!1,default:""},dialogClasses:{type:[String,Array,Object],required:!1,default:""}},emits:["closing","update:open","submit"],setup(a,{emit:t,slots:o}){const l=u(),{width:g}=w(l,{width:900}),n=i(()=>g.value<876),p=i(()=>o?.navigation!==void 0),s=T(),y=i(()=>a.navigationAriaLabel||void 0),m=i(()=>{if(!a.navigationAriaLabel)return a.navigationAriaLabelledby||s}),c=u(),r=i(()=>a.isForm&&!p.value?"form":"div"),b=i(()=>r.value==="form"?{submit(e){e.preventDefault(),t("submit",e)},reset(e){e.preventDefault(),t("reset",e)}}:{}),d=u(!0);function C(e,A){e.nativeType==="submit"&&r.value==="form"&&!c.value.reportValidity()||(v(A),window.setTimeout(()=>f(),300))}const v=e=>{d.value=!1,t("closing",e)},f=()=>{d.value=!0,t("update:open",!1)},_=i(()=>({noClose:a.noClose||!a.canClose,container:a.container===void 0?"body":a.container,labelId:s,size:a.size,show:a.open&&d.value,outTransition:a.outTransition,closeOnClickOutside:a.closeOnClickOutside,additionalTrapElements:a.additionalTrapElements}));return{dialogElement:c,dialogListeners:b,dialogTagName:r,handleButtonClose:C,handleClosing:v,handleClosed:f,hasNavigation:p,navigationId:s,navigationAriaLabelAttr:y,navigationAriaLabelledbyAttr:m,isNavigationCollapsed:n,modalProps:_,wrapper:l}}});var O=function(){var a=this,t=a._self._c;return a._self._setupProxy,a.open?t("NcModal",a._b({staticClass:"dialog__modal",attrs:{"enable-slideshow":!1,"enable-swipe":!1},on:{close:a.handleClosed,"update:show":function(o){return a.handleClosing()}}},"NcModal",a.modalProps,!1),[t("h2",{staticClass:"dialog__name",attrs:{id:a.navigationId},domProps:{textContent:a._s(a.name)}}),t(a.dialogTagName,a._g({ref:"dialogElement",tag:"component",staticClass:"dialog",class:a.dialogClasses},a.dialogListeners),[t("div",{ref:"wrapper",class:["dialog__wrapper",{"dialog__wrapper--collapsed":a.isNavigationCollapsed}]},[a.hasNavigation?t("nav",{staticClass:"dialog__navigation",class:a.navigationClasses,attrs:{"aria-label":a.navigationAriaLabelAttr,"aria-labelledby":a.navigationAriaLabelledbyAttr}},[a._t("navigation",null,{isCollapsed:a.isNavigationCollapsed})],2):a._e(),t("div",{staticClass:"dialog__content",class:a.contentClasses},[a._t("default",function(){return[t("p",{staticClass:"dialog__text"},[a._v(" "+a._s(a.message)+" ")])]})],2)]),t("div",{staticClass:"dialog__actions"},[a._t("actions",function(){return a._l(a.buttons,function(o,l){return t("NcDialogButton",a._b({key:l,on:{click:(g,n)=>a.handleButtonClose(o,n)}},"NcDialogButton",o,!1))})})],2)])],1):a._e()},S=[],x=B(q,O,S,!1,null,"1aa5fbdd");const j=x.exports;export{j as N};
//# sourceMappingURL=NcDialog-CKgpZOiy-D6ykmTf9.chunk.mjs.map
