@gspa/ui 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),d=require("class-variance-authority"),n=require("./utils/cn.cjs"),C=require("./lib/form-field.cjs"),N=require("./DatePicker.vue_vue_type_script_setup_true_lang-CIKiZaO1.cjs"),S=["for"],q={key:0,class:"ui-danger ml-1","aria-hidden":"true"},T={key:1,class:"sr-only"},D=["id"],M={class:"relative"},I=["disabled","aria-controls","aria-label"],P={key:0,class:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true"},L={key:1,class:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true"},$=["id"],j=["id"],F=["id"],A=e.defineComponent({inheritAttrs:!1,__name:"FormField",props:{label:String,description:String,error:String,serverError:String,success:String,helpText:String,required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},autocomplete:String,name:String,type:{type:String,default:"text"},modelValue:{type:[String,Date],default:""},size:{type:String,default:"md"},id:String,showPasswordLabel:{type:String,default:"Show password"},hidePasswordLabel:{type:String,default:"Hide password"}},emits:["update:modelValue"],setup(t,{emit:g}){const s=t,b=g,x=`field-${e.useId()}`,i=e.computed(()=>s.id||x),u=e.computed(()=>s.serverError||s.error||""),r=e.computed(()=>!!u.value),o=e.ref(!1),m=e.computed(()=>s.type==="password"&&o.value?"text":s.type),v=e.computed(()=>`${i.value}-description`),f=e.computed(()=>`${i.value}-error`),p=e.computed(()=>`${i.value}-help`),k=e.computed(()=>`${i.value}-success`),h=()=>{s.disabled||(o.value=!o.value)},c=e.computed(()=>{const l=[];return s.description&&l.push(v.value),r.value?l.push(f.value):s.helpText&&l.push(p.value),s.success&&!r.value&&l.push(k.value),l.length?l.join(" "):void 0});e.provide(C.FORM_FIELD_CONTEXT_KEY,{id:i,describedBy:c,invalid:r,required:e.computed(()=>s.required),disabled:e.computed(()=>s.disabled),autocomplete:e.computed(()=>s.autocomplete),name:e.computed(()=>s.name),inputType:m,originalType:e.computed(()=>s.type),hasPasswordToggle:e.computed(()=>s.type==="password")});const V=d.cva("ui-text",{variants:{size:{sm:"space-y-1",md:"space-y-2",lg:"space-y-3"}},defaultVariants:{size:"md"}}),w=d.cva("block ui-text",{variants:{size:{sm:"text-xs font-medium",md:"text-sm font-medium",lg:"text-base font-medium"}},defaultVariants:{size:"md"}}),B=d.cva("ui-text-muted",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},defaultVariants:{size:"md"}}),y=d.cva("flex items-start gap-2",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-sm"},intent:{error:"ui-danger",success:"ui-success"}},defaultVariants:{size:"md",intent:"error"}}),z=d.cva("ui-text-muted",{variants:{size:{sm:"text-xs",md:"text-sm",lg:"text-sm"}},defaultVariants:{size:"md"}});return(l,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(n.cn)(e.unref(V)({size:t.size}),l.$attrs.class))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:i.value,class:e.normalizeClass(e.unref(n.cn)(e.unref(w)({size:t.size})))},[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",q,"*")):e.createCommentVNode("",!0),t.required?(e.openBlock(),e.createElementBlock("span",T," (required)")):e.createCommentVNode("",!0)],10,S)):e.createCommentVNode("",!0),t.description?(e.openBlock(),e.createElementBlock("p",{key:1,id:v.value,class:e.normalizeClass(e.unref(n.cn)(e.unref(B)({size:t.size})))},e.toDisplayString(t.description),11,D)):e.createCommentVNode("",!0),e.createElementVNode("div",M,[t.type==="date"?(e.openBlock(),e.createBlock(N._sfc_main,{key:0,id:i.value,"model-value":t.modelValue,disabled:t.disabled,required:t.required,"aria-describedby":c.value,"aria-invalid":r.value,class:e.normalizeClass(r.value?"border-(--ui-danger)":""),"onUpdate:modelValue":a[0]||(a[0]=E=>b("update:modelValue",E))},null,8,["id","model-value","disabled","required","aria-describedby","aria-invalid","class"])):e.renderSlot(l.$slots,"default",{key:1,fieldId:i.value,hasError:r.value,ariaDescribedBy:c.value,inputType:m.value,showPassword:o.value,togglePasswordVisibility:h}),t.type==="password"?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"absolute inset-y-0 right-0 flex items-center pr-3 ui-text-muted transition-colors hover:text-(--ui-text) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--ui-ring) focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",disabled:t.disabled,"aria-controls":i.value,"aria-label":o.value?t.hidePasswordLabel:t.showPasswordLabel,onClick:h},[o.value?(e.openBlock(),e.createElementBlock("svg",P,[...a[1]||(a[1]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 3l18 18M10.6 10.7a2 2 0 002.7 2.7M9.9 4.2A10.7 10.7 0 0112 4c5 0 8.7 4.4 9.6 6.5.2.3.2.7 0 1a15 15 0 01-2.2 3.3M6.2 6.2A15.8 15.8 0 002.4 10.5c-.2.3-.2.7 0 1C3.3 13.6 7 18 12 18c1 0 2-.2 2.9-.5"},null,-1)])])):(e.openBlock(),e.createElementBlock("svg",L,[...a[2]||(a[2]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M2.4 10.5C3.3 8.4 7 4 12 4s8.7 4.4 9.6 6.5c.2.3.2.7 0 1C20.7 13.6 17 18 12 18s-8.7-4.4-9.6-6.5a1.1 1.1 0 010-1z"},null,-1),e.createElementVNode("circle",{cx:"12",cy:"11",r:"3","stroke-width":"2"},null,-1)])]))],8,I)):e.createCommentVNode("",!0)]),e.createVNode(e.Transition,{name:"ui-field-message"},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("div",{key:0,id:f.value,class:e.normalizeClass(e.unref(n.cn)(e.unref(y)({size:t.size,intent:"error"}))),role:"alert","aria-live":"polite","aria-atomic":"true"},[a[3]||(a[3]=e.createElementVNode("svg",{class:"mt-0.5 h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v4m0 4h.01M10.3 4.1L2 18.2a1.2 1.2 0 001 1.8h18a1.2 1.2 0 001-1.8L13.7 4.1a2 2 0 00-3.4 0z"})],-1)),e.createElementVNode("span",null,e.toDisplayString(u.value),1)],10,$)):e.createCommentVNode("",!0)]),_:1}),t.helpText&&!r.value?(e.openBlock(),e.createElementBlock("p",{key:2,id:p.value,class:e.normalizeClass(e.unref(n.cn)(e.unref(z)({size:t.size})))},e.toDisplayString(t.helpText),11,j)):e.createCommentVNode("",!0),e.createVNode(e.Transition,{name:"ui-field-message"},{default:e.withCtx(()=>[t.success&&!r.value?(e.openBlock(),e.createElementBlock("div",{key:0,id:k.value,class:e.normalizeClass(e.unref(n.cn)(e.unref(y)({size:t.size,intent:"success"}))),role:"status","aria-live":"polite"},[a[4]||(a[4]=e.createElementVNode("svg",{class:"mt-0.5 h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12l4 4L19 6"})],-1)),e.createElementVNode("span",null,e.toDisplayString(t.success),1)],10,F)):e.createCommentVNode("",!0)]),_:1})],2))}});exports._sfc_main=A;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),K={class:"relative w-full bg-(--ui-surface) rounded-md"},Q={class:"relative"},X=["id","value","disabled","placeholder","required","aria-describedby"],Z={class:"flex items-center justify-between mb-3"},ee={class:"text-sm font-semibold ui-text"},te={class:"grid grid-cols-7 gap-1 mb-1"},ne={class:"grid grid-cols-7 gap-1"},oe=["disabled","onClick"],re={key:0,class:"mt-3 pt-2 border-t ui-border"},ae={key:0,class:"border-l pl-3 ui-border"},le={class:"max-h-[260px] overflow-y-auto pr-1 space-y-1"},ie=["onClick"],se={__name:"DatePicker",props:{id:String,modelValue:[String,Date],disabled:Boolean,required:Boolean,min:[String,Date],max:[String,Date],placeholder:{type:String,default:"Select date"},format:{type:String,default:"DD/MM/YYYY"},clearable:{type:Boolean,default:!0},showToday:{type:Boolean,default:!0},ariaDescribedby:String,customValidation:{type:Function,default:null},disabledDates:{type:[Array,Function],default:null},enableTime:{type:Boolean,default:!1},minuteInterval:{type:Number,default:1}},emits:["update:modelValue","validation-error"],setup(s,{emit:L}){const a=s,v=L,m=e.ref(!1),x=e.ref(null),D=e.ref(null),w=e.ref({}),f=new Date,l=e.ref(f.getMonth()),i=e.ref(f.getFullYear()),u=e.ref(null),b=e.ref(!1),y=e.ref("00:00"),H=["Su","Mo","Tu","We","Th","Fr","Sa"],R=e.computed(()=>new Date(i.value,l.value).toLocaleString("default",{month:"long"})),E=e.computed(()=>new Date(i.value,l.value+1,0).getDate()),j=e.computed(()=>new Date(i.value,l.value,1).getDay()),B=e.computed(()=>{const o=new Date(i.value,l.value,0).getDate(),t=j.value;return Array.from({length:t},(n,r)=>o-t+r+1)}),A=e.computed(()=>{const o=B.value.length+E.value,t=o%7===0?0:7-o%7;return Array.from({length:t},(n,r)=>r+1)}),S=e.computed(()=>u.value?a.enableTime?q(u.value):V(u.value):""),P=e.computed(()=>{const o=Math.min(60,Math.max(1,Number(a.minuteInterval)||1)),t=[];for(let n=0;n<24;n++)for(let r=0;r<60;r+=o){const d=String(n).padStart(2,"0"),c=String(r).padStart(2,"0");t.push(`${d}:${c}`)}return t});function V(o){if(!o)return"";const t=new Date(o),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),d=t.getFullYear();return a.format.replace("MM",n).replace("DD",r).replace("YYYY",d)}function q(o){const t=V(o),n=String(o.getHours()).padStart(2,"0"),r=String(o.getMinutes()).padStart(2,"0");return`${t} ${n}:${r}`}function h(o){if(!o)return null;if(o instanceof Date)return o;if(typeof o=="string"){if(o.includes("T")){const[r,d]=o.split("T"),c=h(r);if(!c)return null;const[g="00",p="00"]=(d||"").slice(0,5).split(":");return c.setHours(parseInt(g,10)||0,parseInt(p,10)||0,0,0),c}const n=o.split("-");if(n.length===3){const r=parseInt(n[0],10),d=parseInt(n[1],10)-1,c=parseInt(n[2],10);return new Date(r,d,c)}}const t=new Date(o);return isNaN(t.getTime())?null:t}function O(o){return f.getDate()===o&&f.getMonth()===l.value&&f.getFullYear()===i.value}function M(o){if(!u.value)return!1;const t=new Date(u.value);return t.getDate()===o&&t.getMonth()===l.value&&t.getFullYear()===i.value}function k(o){const t=new Date(i.value,l.value,o);if(a.min){const n=h(a.min);if(n&&t<n)return!0}if(a.max){const n=h(a.max);if(n&&t>n)return!0}if(a.disabledDates){if(typeof a.disabledDates=="function")return a.disabledDates(t);if(Array.isArray(a.disabledDates))return a.disabledDates.some(n=>{const r=h(n);return r&&r.getTime()===t.getTime()})}return!!(a.customValidation&&a.customValidation(t))}function N(o){if(!o)return b.value=!1,v("validation-error",null),!0;if(a.customValidation){const t=a.customValidation(o);if(t)return b.value=!0,v("validation-error",t),!1}return b.value=!1,v("validation-error",null),!0}async function C(){await e.nextTick();const o=D.value||(a.id?document.getElementById(a.id):null);if(!o||!x.value)return;const t=o.getBoundingClientRect(),n=320,r=window.innerHeight-t.bottom,d=t.top,c=8;let g,p;r>=n||r>d?g=t.bottom+c:g=t.top-n-c,p=t.left;const I=256;p+I>window.innerWidth&&(p=window.innerWidth-I-16),p<16&&(p=16),w.value={top:`${g}px`,left:`${p}px`}}async function W(){a.disabled||(m.value=!m.value,m.value&&await C())}function T(){m.value=!1}function _(){l.value===0?(l.value=11,i.value--):l.value--}function U(){l.value===11?(l.value=0,i.value++):l.value++}function $(o){if(k(o))return;const t=new Date(i.value,l.value,o);N(t)&&(u.value=t,Y(t),setTimeout(()=>{a.enableTime||(m.value=!1)},150))}function Y(o){const t=o.getFullYear(),n=String(o.getMonth()+1).padStart(2,"0"),r=String(o.getDate()).padStart(2,"0");if(!a.enableTime){v("update:modelValue",`${t}-${n}-${r}`);return}const[d="00",c="00"]=y.value.split(":"),g=`${t}-${n}-${r}T${d}:${c}`;v("update:modelValue",g)}function G(){l.value=f.getMonth(),i.value=f.getFullYear(),$(f.getDate())}function J(){u.value=null,y.value="00:00",b.value=!1,v("update:modelValue",""),v("validation-error",null)}e.watch(()=>a.modelValue,o=>{if(o){const t=h(o);if(t){u.value=t;const n=String(t.getHours()).padStart(2,"0"),r=String(t.getMinutes()).padStart(2,"0");y.value=`${n}:${r}`,l.value=t.getMonth(),i.value=t.getFullYear(),N(t)}}else u.value=null,b.value=!1},{immediate:!0}),e.watch(y,o=>{if(!a.enableTime||!u.value)return;const[t="00",n="00"]=(o||"00:00").split(":");u.value.setHours(parseInt(t,10)||0,parseInt(n,10)||0,0,0),Y(u.value)});function F(){m.value&&C()}function z(o){o.key==="Escape"&&m.value&&T()}return e.onMounted(()=>{document.addEventListener("keydown",z),window.addEventListener("resize",F)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",z),window.removeEventListener("resize",F)}),(o,t)=>(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("div",Q,[e.createElementVNode("input",{id:s.id,ref_key:"inputRef",ref:D,type:"text",value:S.value,readonly:"",disabled:s.disabled,placeholder:s.placeholder,required:s.required,"aria-describedby":s.ariaDescribedby,class:e.normalizeClass(["w-full px-3 py-2 pr-10 border rounded-md ui-surface ui-text placeholder-slate-400 text-sm ","focus:outline-none focus:ring-2 focus:ring-(--ui-primary) focus:border-(--ui-primary) cursor-pointer transition-colors","disabled:bg-(--ui-bg) disabled:text-(--ui-text) disabled:cursor-not-allowed",b.value?"border-(--ui-danger) focus:ring-(--ui-danger) focus:border-(--ui-danger)":"ui-border"]),onClick:W},null,10,X),t[2]||(t[2]=e.createElementVNode("div",{class:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none"},[e.createElementVNode("svg",{class:"w-4 h-4 ui-text",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})])],-1)),s.clearable&&S.value&&!s.disabled?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-9 top-1/2 -translate-y-1/2 p-1 hover:bg-(--ui-bg) rounded transition-colors","aria-label":"Clear date",onClick:e.withModifiers(J,["stop"])},[...t[1]||(t[1]=[e.createElementVNode("svg",{class:"w-3.5 h-3.5 ui-text",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{"enter-active-class":"transition ease-out duration-100","enter-from-class":"transform opacity-0 scale-95","enter-to-class":"transform opacity-100 scale-100","leave-active-class":"transition ease-in duration-75","leave-from-class":"transform opacity-100 scale-100","leave-to-class":"transform opacity-0 scale-95"},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"calendarRef",ref:x,style:e.normalizeStyle(w.value),class:e.normalizeClass(["fixed z-10000 rounded-lg shadow-xl p-3 ui-surface ui-border-strong",s.enableTime?"w-[420px]":"w-64"]),onClick:t[0]||(t[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(s.enableTime?"grid grid-cols-[1fr_124px] gap-3":"block")},[e.createElementVNode("div",null,[e.createElementVNode("div",Z,[e.createElementVNode("button",{type:"button",class:"p-1.5 rounded hover:bg-(--ui-bg) transition-colors","aria-label":"Previous Month",onClick:_},[...t[3]||(t[3]=[e.createElementVNode("svg",{class:"w-4 h-4 ui-text",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 18l-6-6 6-6"})],-1)])]),e.createElementVNode("div",ee,e.toDisplayString(R.value)+" "+e.toDisplayString(i.value),1),e.createElementVNode("button",{type:"button",class:"p-1.5 rounded hover:bg-(--ui-bg) transition-colors","aria-label":"Next Month",onClick:U},[...t[4]||(t[4]=[e.createElementVNode("svg",{class:"w-4 h-4 ui-text",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 18l6-6-6-6"})],-1)])])]),e.createElementVNode("div",te,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(H,n=>e.createElementVNode("div",{key:n,class:"text-center text-xs font-medium ui-text py-1"},e.toDisplayString(n),1)),64))]),e.createElementVNode("div",ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,(n,r)=>(e.openBlock(),e.createElementBlock("div",{key:"prev-"+r,class:"text-center text-xs ui-text py-1.5"},e.toDisplayString(n),1))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,n=>(e.openBlock(),e.createElementBlock("button",{key:n,type:"button",disabled:k(n),class:e.normalizeClass(["w-8 h-8 rounded text-xs font-medium transition-colors",O(n)&&!M(n)?"ui-primary-soft ui-primary ring-1 ring-(--ui-primary)":"",M(n)?"ui-primary-bg ui-text hover:bg-(--ui-primary)":"ui-text hover:bg-(--ui-bg)",k(n)?"ui-text cursor-not-allowed hover:bg-transparent line-through":"cursor-pointer"]),onClick:r=>$(n)},e.toDisplayString(n),11,oe))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,(n,r)=>(e.openBlock(),e.createElementBlock("div",{key:"next-"+r,class:"text-center text-xs ui-text py-1.5"},e.toDisplayString(n),1))),128))]),s.showToday?(e.openBlock(),e.createElementBlock("div",re,[e.createElementVNode("button",{type:"button",class:"w-full px-3 py-1.5 text-xs font-medium ui-primary hover:bg-(--ui-primary-soft) rounded transition-colors",onClick:G}," Today ")])):e.createCommentVNode("",!0)]),s.enableTime?(e.openBlock(),e.createElementBlock("div",ae,[t[5]||(t[5]=e.createElementVNode("div",{class:"text-xs font-semibold ui-text mb-2"},"Time",-1)),e.createElementVNode("div",le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P.value,n=>(e.openBlock(),e.createElementBlock("button",{key:n,type:"button",class:e.normalizeClass(["w-full px-2 py-1.5 text-left text-sm rounded transition-colors",n===y.value?"ui-primary-bg ui-text":"ui-text hover:bg-(--ui-bg)"]),onClick:r=>y.value=n},e.toDisplayString(n),11,ie))),128))])])):e.createCommentVNode("",!0)],2)],6)):e.createCommentVNode("",!0)]),_:1}),m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed inset-0 z-9999",onClick:T})):e.createCommentVNode("",!0)]))]))}};exports.default=se;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../DatePicker.vue_vue_type_script_setup_true_lang-CIKiZaO1.cjs");exports.default=e._sfc_main;
@@ -1,401 +1,4 @@
1
- import { ref as p, computed as x, watch as _, onMounted as le, onBeforeUnmount as se, createElementBlock as s, openBlock as l, createElementVNode as o, createBlock as ue, createCommentVNode as M, normalizeClass as T, withModifiers as U, Teleport as de, createVNode as ce, Transition as fe, withCtx as ve, normalizeStyle as me, toDisplayString as w, Fragment as C, renderList as V, nextTick as pe } from "vue";
2
- const ge = { class: "relative w-full bg-(--ui-surface) rounded-md" }, be = { class: "relative" }, ye = ["id", "value", "disabled", "placeholder", "required", "aria-describedby"], he = { class: "flex items-center justify-between mb-3" }, xe = { class: "text-sm font-semibold ui-text" }, we = { class: "grid grid-cols-7 gap-1 mb-1" }, De = { class: "grid grid-cols-7 gap-1" }, ke = ["disabled", "onClick"], Se = {
3
- key: 0,
4
- class: "mt-3 pt-2 border-t ui-border"
5
- }, Me = {
6
- key: 0,
7
- class: "border-l pl-3 ui-border"
8
- }, Te = { class: "max-h-[260px] overflow-y-auto pr-1 space-y-1" }, Ce = ["onClick"], $e = {
9
- __name: "DatePicker",
10
- props: {
11
- id: String,
12
- modelValue: [String, Date],
13
- disabled: Boolean,
14
- required: Boolean,
15
- min: [String, Date],
16
- max: [String, Date],
17
- placeholder: {
18
- type: String,
19
- default: "Select date"
20
- },
21
- format: {
22
- type: String,
23
- default: "DD/MM/YYYY"
24
- },
25
- clearable: {
26
- type: Boolean,
27
- default: !0
28
- },
29
- showToday: {
30
- type: Boolean,
31
- default: !0
32
- },
33
- ariaDescribedby: String,
34
- // Custom validation function: (date: Date) => string | null
35
- // Return error message string if invalid, null if valid
36
- customValidation: {
37
- type: Function,
38
- default: null
39
- },
40
- // Array of disabled dates or function to determine if date is disabled
41
- disabledDates: {
42
- type: [Array, Function],
43
- default: null
44
- },
45
- enableTime: {
46
- type: Boolean,
47
- default: !1
48
- },
49
- minuteInterval: {
50
- type: Number,
51
- default: 1
52
- }
53
- },
54
- emits: ["update:modelValue", "validation-error"],
55
- setup(d, { emit: G }) {
56
- const r = d, y = G, m = p(!1), B = p(null), Y = p(null), F = p({}), g = /* @__PURE__ */ new Date(), i = p(g.getMonth()), u = p(g.getFullYear()), c = p(null), D = p(!1), k = p("00:00"), J = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], K = x(
57
- () => new Date(u.value, i.value).toLocaleString("default", {
58
- month: "long"
59
- })
60
- ), I = x(() => new Date(u.value, i.value + 1, 0).getDate()), Q = x(() => new Date(u.value, i.value, 1).getDay()), E = x(() => {
61
- const n = new Date(u.value, i.value, 0).getDate(), e = Q.value;
62
- return Array.from({ length: e }, (t, a) => n - e + a + 1);
63
- }), X = x(() => {
64
- const n = E.value.length + I.value, e = n % 7 === 0 ? 0 : 7 - n % 7;
65
- return Array.from({ length: e }, (t, a) => a + 1);
66
- }), N = x(() => c.value ? r.enableTime ? ee(c.value) : z(c.value) : ""), Z = x(() => {
67
- const n = Math.min(60, Math.max(1, Number(r.minuteInterval) || 1)), e = [];
68
- for (let t = 0; t < 24; t++)
69
- for (let a = 0; a < 60; a += n) {
70
- const v = String(t).padStart(2, "0"), f = String(a).padStart(2, "0");
71
- e.push(`${v}:${f}`);
72
- }
73
- return e;
74
- });
75
- function z(n) {
76
- if (!n) return "";
77
- const e = new Date(n), t = String(e.getMonth() + 1).padStart(2, "0"), a = String(e.getDate()).padStart(2, "0"), v = e.getFullYear();
78
- return r.format.replace("MM", t).replace("DD", a).replace("YYYY", v);
79
- }
80
- function ee(n) {
81
- const e = z(n), t = String(n.getHours()).padStart(2, "0"), a = String(n.getMinutes()).padStart(2, "0");
82
- return `${e} ${t}:${a}`;
83
- }
84
- function S(n) {
85
- if (!n) return null;
86
- if (n instanceof Date) return n;
87
- if (typeof n == "string") {
88
- if (n.includes("T")) {
89
- const [a, v] = n.split("T"), f = S(a);
90
- if (!f) return null;
91
- const [h = "00", b = "00"] = (v || "").slice(0, 5).split(":");
92
- return f.setHours(parseInt(h, 10) || 0, parseInt(b, 10) || 0, 0, 0), f;
93
- }
94
- const t = n.split("-");
95
- if (t.length === 3) {
96
- const a = parseInt(t[0], 10), v = parseInt(t[1], 10) - 1, f = parseInt(t[2], 10);
97
- return new Date(a, v, f);
98
- }
99
- }
100
- const e = new Date(n);
101
- return isNaN(e.getTime()) ? null : e;
102
- }
103
- function te(n) {
104
- return g.getDate() === n && g.getMonth() === i.value && g.getFullYear() === u.value;
105
- }
106
- function H(n) {
107
- if (!c.value) return !1;
108
- const e = new Date(c.value);
109
- return e.getDate() === n && e.getMonth() === i.value && e.getFullYear() === u.value;
110
- }
111
- function $(n) {
112
- const e = new Date(u.value, i.value, n);
113
- if (r.min) {
114
- const t = S(r.min);
115
- if (t && e < t) return !0;
116
- }
117
- if (r.max) {
118
- const t = S(r.max);
119
- if (t && e > t) return !0;
120
- }
121
- if (r.disabledDates) {
122
- if (typeof r.disabledDates == "function")
123
- return r.disabledDates(e);
124
- if (Array.isArray(r.disabledDates))
125
- return r.disabledDates.some((t) => {
126
- const a = S(t);
127
- return a && a.getTime() === e.getTime();
128
- });
129
- }
130
- return !!(r.customValidation && r.customValidation(e));
131
- }
132
- function L(n) {
133
- if (!n)
134
- return D.value = !1, y("validation-error", null), !0;
135
- if (r.customValidation) {
136
- const e = r.customValidation(n);
137
- if (e)
138
- return D.value = !0, y("validation-error", e), !1;
139
- }
140
- return D.value = !1, y("validation-error", null), !0;
141
- }
142
- async function R() {
143
- await pe();
144
- const n = Y.value || (r.id ? document.getElementById(r.id) : null);
145
- if (!n || !B.value) return;
146
- const e = n.getBoundingClientRect(), t = 320, a = window.innerHeight - e.bottom, v = e.top, f = 8;
147
- let h, b;
148
- a >= t || a > v ? h = e.bottom + f : h = e.top - t - f, b = e.left;
149
- const O = 256;
150
- b + O > window.innerWidth && (b = window.innerWidth - O - 16), b < 16 && (b = 16), F.value = {
151
- top: `${h}px`,
152
- left: `${b}px`
153
- };
154
- }
155
- async function ne() {
156
- r.disabled || (m.value = !m.value, m.value && await R());
157
- }
158
- function A() {
159
- m.value = !1;
160
- }
161
- function ae() {
162
- i.value === 0 ? (i.value = 11, u.value--) : i.value--;
163
- }
164
- function re() {
165
- i.value === 11 ? (i.value = 0, u.value++) : i.value++;
166
- }
167
- function j(n) {
168
- if ($(n)) return;
169
- const e = new Date(u.value, i.value, n);
170
- L(e) && (c.value = e, P(e), setTimeout(() => {
171
- r.enableTime || (m.value = !1);
172
- }, 150));
173
- }
174
- function P(n) {
175
- const e = n.getFullYear(), t = String(n.getMonth() + 1).padStart(2, "0"), a = String(n.getDate()).padStart(2, "0");
176
- if (!r.enableTime) {
177
- y("update:modelValue", `${e}-${t}-${a}`);
178
- return;
179
- }
180
- const [v = "00", f = "00"] = k.value.split(":"), h = `${e}-${t}-${a}T${v}:${f}`;
181
- y("update:modelValue", h);
182
- }
183
- function oe() {
184
- i.value = g.getMonth(), u.value = g.getFullYear(), j(g.getDate());
185
- }
186
- function ie() {
187
- c.value = null, k.value = "00:00", D.value = !1, y("update:modelValue", ""), y("validation-error", null);
188
- }
189
- _(() => r.modelValue, (n) => {
190
- if (n) {
191
- const e = S(n);
192
- if (e) {
193
- c.value = e;
194
- const t = String(e.getHours()).padStart(2, "0"), a = String(e.getMinutes()).padStart(2, "0");
195
- k.value = `${t}:${a}`, i.value = e.getMonth(), u.value = e.getFullYear(), L(e);
196
- }
197
- } else
198
- c.value = null, D.value = !1;
199
- }, { immediate: !0 }), _(k, (n) => {
200
- if (!r.enableTime || !c.value) return;
201
- const [e = "00", t = "00"] = (n || "00:00").split(":");
202
- c.value.setHours(parseInt(e, 10) || 0, parseInt(t, 10) || 0, 0, 0), P(c.value);
203
- });
204
- function q() {
205
- m.value && R();
206
- }
207
- function W(n) {
208
- n.key === "Escape" && m.value && A();
209
- }
210
- return le(() => {
211
- document.addEventListener("keydown", W), window.addEventListener("resize", q);
212
- }), se(() => {
213
- document.removeEventListener("keydown", W), window.removeEventListener("resize", q);
214
- }), (n, e) => (l(), s("div", ge, [
215
- o("div", be, [
216
- o("input", {
217
- id: d.id,
218
- ref_key: "inputRef",
219
- ref: Y,
220
- type: "text",
221
- value: N.value,
222
- readonly: "",
223
- disabled: d.disabled,
224
- placeholder: d.placeholder,
225
- required: d.required,
226
- "aria-describedby": d.ariaDescribedby,
227
- class: T([
228
- "w-full px-3 py-2 pr-10 border rounded-md ui-surface ui-text placeholder-slate-400 text-sm ",
229
- "focus:outline-none focus:ring-2 focus:ring-(--ui-primary) focus:border-(--ui-primary) cursor-pointer transition-colors",
230
- "disabled:bg-(--ui-bg) disabled:text-(--ui-text) disabled:cursor-not-allowed",
231
- D.value ? "border-(--ui-danger) focus:ring-(--ui-danger) focus:border-(--ui-danger)" : "ui-border"
232
- ]),
233
- onClick: ne
234
- }, null, 10, ye),
235
- e[2] || (e[2] = o("div", { class: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none" }, [
236
- o("svg", {
237
- class: "w-4 h-4 ui-text",
238
- fill: "none",
239
- stroke: "currentColor",
240
- viewBox: "0 0 24 24"
241
- }, [
242
- o("path", {
243
- "stroke-linecap": "round",
244
- "stroke-linejoin": "round",
245
- "stroke-width": "2",
246
- d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
247
- })
248
- ])
249
- ], -1)),
250
- d.clearable && N.value && !d.disabled ? (l(), s("button", {
251
- key: 0,
252
- type: "button",
253
- class: "absolute right-9 top-1/2 -translate-y-1/2 p-1 hover:bg-(--ui-bg) rounded transition-colors",
254
- "aria-label": "Clear date",
255
- onClick: U(ie, ["stop"])
256
- }, [...e[1] || (e[1] = [
257
- o("svg", {
258
- class: "w-3.5 h-3.5 ui-text",
259
- fill: "none",
260
- stroke: "currentColor",
261
- viewBox: "0 0 24 24"
262
- }, [
263
- o("path", {
264
- "stroke-linecap": "round",
265
- "stroke-linejoin": "round",
266
- "stroke-width": "2",
267
- d: "M6 18L18 6M6 6l12 12"
268
- })
269
- ], -1)
270
- ])])) : M("", !0)
271
- ]),
272
- (l(), ue(de, { to: "body" }, [
273
- ce(fe, {
274
- "enter-active-class": "transition ease-out duration-100",
275
- "enter-from-class": "transform opacity-0 scale-95",
276
- "enter-to-class": "transform opacity-100 scale-100",
277
- "leave-active-class": "transition ease-in duration-75",
278
- "leave-from-class": "transform opacity-100 scale-100",
279
- "leave-to-class": "transform opacity-0 scale-95"
280
- }, {
281
- default: ve(() => [
282
- m.value ? (l(), s("div", {
283
- key: 0,
284
- ref_key: "calendarRef",
285
- ref: B,
286
- style: me(F.value),
287
- class: T(["fixed z-10000 rounded-lg shadow-xl p-3 ui-surface ui-border-strong", d.enableTime ? "w-[420px]" : "w-64"]),
288
- onClick: e[0] || (e[0] = U(() => {
289
- }, ["stop"]))
290
- }, [
291
- o("div", {
292
- class: T(d.enableTime ? "grid grid-cols-[1fr_124px] gap-3" : "block")
293
- }, [
294
- o("div", null, [
295
- o("div", he, [
296
- o("button", {
297
- type: "button",
298
- class: "p-1.5 rounded hover:bg-(--ui-bg) transition-colors",
299
- "aria-label": "Previous Month",
300
- onClick: ae
301
- }, [...e[3] || (e[3] = [
302
- o("svg", {
303
- class: "w-4 h-4 ui-text",
304
- fill: "none",
305
- stroke: "currentColor",
306
- viewBox: "0 0 24 24"
307
- }, [
308
- o("path", {
309
- "stroke-linecap": "round",
310
- "stroke-linejoin": "round",
311
- "stroke-width": "2",
312
- d: "M15 18l-6-6 6-6"
313
- })
314
- ], -1)
315
- ])]),
316
- o("div", xe, w(K.value) + " " + w(u.value), 1),
317
- o("button", {
318
- type: "button",
319
- class: "p-1.5 rounded hover:bg-(--ui-bg) transition-colors",
320
- "aria-label": "Next Month",
321
- onClick: re
322
- }, [...e[4] || (e[4] = [
323
- o("svg", {
324
- class: "w-4 h-4 ui-text",
325
- fill: "none",
326
- stroke: "currentColor",
327
- viewBox: "0 0 24 24"
328
- }, [
329
- o("path", {
330
- "stroke-linecap": "round",
331
- "stroke-linejoin": "round",
332
- "stroke-width": "2",
333
- d: "M9 18l6-6-6-6"
334
- })
335
- ], -1)
336
- ])])
337
- ]),
338
- o("div", we, [
339
- (l(), s(C, null, V(J, (t) => o("div", {
340
- key: t,
341
- class: "text-center text-xs font-medium ui-text py-1"
342
- }, w(t), 1)), 64))
343
- ]),
344
- o("div", De, [
345
- (l(!0), s(C, null, V(E.value, (t, a) => (l(), s("div", {
346
- key: "prev-" + a,
347
- class: "text-center text-xs ui-text py-1.5"
348
- }, w(t), 1))), 128)),
349
- (l(!0), s(C, null, V(I.value, (t) => (l(), s("button", {
350
- key: t,
351
- type: "button",
352
- disabled: $(t),
353
- class: T([
354
- "w-8 h-8 rounded text-xs font-medium transition-colors",
355
- te(t) && !H(t) ? "ui-primary-soft ui-primary ring-1 ring-(--ui-primary)" : "",
356
- H(t) ? "ui-primary-bg ui-text hover:bg-(--ui-primary)" : "ui-text hover:bg-(--ui-bg)",
357
- $(t) ? "ui-text cursor-not-allowed hover:bg-transparent line-through" : "cursor-pointer"
358
- ]),
359
- onClick: (a) => j(t)
360
- }, w(t), 11, ke))), 128)),
361
- (l(!0), s(C, null, V(X.value, (t, a) => (l(), s("div", {
362
- key: "next-" + a,
363
- class: "text-center text-xs ui-text py-1.5"
364
- }, w(t), 1))), 128))
365
- ]),
366
- d.showToday ? (l(), s("div", Se, [
367
- o("button", {
368
- type: "button",
369
- class: "w-full px-3 py-1.5 text-xs font-medium ui-primary hover:bg-(--ui-primary-soft) rounded transition-colors",
370
- onClick: oe
371
- }, " Today ")
372
- ])) : M("", !0)
373
- ]),
374
- d.enableTime ? (l(), s("div", Me, [
375
- e[5] || (e[5] = o("div", { class: "text-xs font-semibold ui-text mb-2" }, "Time", -1)),
376
- o("div", Te, [
377
- (l(!0), s(C, null, V(Z.value, (t) => (l(), s("button", {
378
- key: t,
379
- type: "button",
380
- class: T(["w-full px-2 py-1.5 text-left text-sm rounded transition-colors", t === k.value ? "ui-primary-bg ui-text" : "ui-text hover:bg-(--ui-bg)"]),
381
- onClick: (a) => k.value = t
382
- }, w(t), 11, Ce))), 128))
383
- ])
384
- ])) : M("", !0)
385
- ], 2)
386
- ], 6)) : M("", !0)
387
- ]),
388
- _: 1
389
- }),
390
- m.value ? (l(), s("div", {
391
- key: 0,
392
- class: "fixed inset-0 z-9999",
393
- onClick: A
394
- })) : M("", !0)
395
- ]))
396
- ]));
397
- }
398
- };
1
+ import { _ as f } from "../DatePicker.vue_vue_type_script_setup_true_lang-Dx_9f8DO.js";
399
2
  export {
400
- $e as default
3
+ f as default
401
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../FormField.vue_vue_type_script_setup_true_lang-mEO-VA6R.cjs");exports.default=e._sfc_main;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../FormField.vue_vue_type_script_setup_true_lang-FWitIR3U.cjs");exports.default=e._sfc_main;
@@ -1,4 +1,4 @@
1
- import { _ as f } from "../FormField.vue_vue_type_script_setup_true_lang-DimMUyA-.js";
1
+ import { _ as f } from "../FormField.vue_vue_type_script_setup_true_lang-BljDj5YZ.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),ge=require("./Slider.cjs"),J=require("./DatePicker.cjs"),ke=require("../FormField.vue_vue_type_script_setup_true_lang-mEO-VA6R.cjs"),g=require("../Input.vue_vue_type_script_setup_true_lang-C1OQn24h.cjs"),Be=require("./Textarea.cjs"),G=require("./Select.cjs"),_e=require("./MultiSelect.cjs"),V=require("../Button.vue_vue_type_script_setup_true_lang-DZxttvYH.cjs"),z=require("./Label.cjs"),K=require("./FileUpload.cjs"),w=require("../lib/toast.cjs"),xe=require("../_plugin-vue_export-helper-BHFhmbuH.cjs"),Ce={class:"w-full p-2"},Ve={key:0,class:"mb-6"},we={class:"text-xl font-semibold ui-text"},Se={key:0,class:"mt-1 text-sm ui-text-muted"},Fe={key:0,class:"mb-4"},Ne={key:0,class:"text-base font-semibold ui-text"},Ee={key:1,class:"mt-1 text-sm ui-text-muted"},Te=["value"],Ae=["title","aria-label","disabled","onClick"],Ue={key:0,class:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true"},ze={key:0,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 3l18 18M10.6 10.7a2 2 0 002.7 2.7M9.9 4.2A10.7 10.7 0 0112 4c5 0 8.7 4.4 9.6 6.5.2.3.2.7 0 1a15 15 0 01-2.2 3.3M6.2 6.2A15.8 15.8 0 002.4 10.5c-.2.3-.2.7 0 1C3.3 13.6 7 18 12 18c1 0 2-.2 2.9-.5"},qe={key:2,class:"flex w-full items-center gap-2"},$e={class:"min-w-0 flex-1"},De={key:3,class:"flex w-full items-center gap-2"},Me={class:"min-w-0 flex-1"},je={key:5,class:"flex items-center"},Le={key:6,class:"flex items-center"},Pe=["id","aria-checked","disabled","onClick"],Re={key:7,class:"space-y-2"},Oe={key:11,class:"space-y-2"},Ye={class:"flex items-center gap-4"},Ie={class:"min-w-12 text-right text-sm font-medium ui-text"},He={key:0,class:"flex justify-end gap-3 pt-6"},Je={key:0,class:"hidden"},Ge={__name:"ReusableForm",props:{title:{type:String,default:""},description:{type:String,default:""},entityName:{type:String,default:"Item"},fields:{type:Array,required:!0,validator:y=>Array.isArray(y)&&y.every(B=>B?.name&&B?.label&&B?.type)},sections:{type:Array,default:()=>[]},initialData:{type:Object,default:null},loading:{type:Boolean,default:!1},customValidation:{type:Function,default:null},crossValidate:{type:Function,default:null},submitLabel:{type:String,default:"Submit"},showReset:{type:Boolean,default:!0},showCancel:{type:Boolean,default:!0},showSubmit:{type:Boolean,default:!0},formType:{type:String,default:"create",validator:y=>["create","edit"].includes(y)}},emits:["submit","reset","cancel","form-change"],setup(y,{emit:B}){const v=y,S=B,Q=a.useSlots(),i=a.computed(()=>v.loading),c=a.ref({}),m=a.ref({}),F=a.ref({}),q=a.ref({}),N=a.ref(!1),W=a.computed(()=>Array.isArray(v.sections)&&v.sections.length>0),X=a.computed(()=>!!Q.actions),$=a.computed(()=>W.value?v.sections.map((e,o)=>{const l=e?.id||`section-${o+1}`,n=Array.isArray(e?.fields)?e.fields:(v.fields||[]).filter(t=>t.sectionId===l);return{id:l,title:e?.title||"",description:e?.description||"",icon:e?.icon||"",wrapperClass:e?.wrapperClass||"",gridClass:e?.gridClass||"grid grid-cols-12 gap-4",card:e?.card!==!1,fields:n}}):[{id:"default",title:"",description:"",icon:"",wrapperClass:"",gridClass:"grid grid-cols-12 gap-4",card:!1,fields:v.fields||[]}]),_=a.computed(()=>$.value.flatMap(e=>e.fields||[])),Z=a.computed(()=>Object.keys(m.value).length===0),D=e=>{try{return JSON.stringify(e??{})}catch{return""}},E=(e,o)=>{if(!(!e||!o))return o.split(".").reduce((l,n)=>l?.[n],e)},x=(e,o,l)=>{const n=o.split("."),t=n.pop(),s=n.reduce((p,b)=>((!p[b]||typeof p[b]!="object")&&(p[b]={}),p[b]),e);s[t]=l},T=e=>e.type==="checkbox"||e.type==="switch"?!1:e.type==="number"||e.type==="slider"||e.type==="range"?e.min??0:e.type==="file"?null:e.type==="multifile"||e.type==="multiselect"?[]:e.type==="radio"&&e.options?.[0]?.value||"",M=()=>{const e={};return _.value.forEach(o=>{o.name.includes(".")?x(e,o.name,T(o)):e[o.name]=T(o)}),e},f=e=>{const o={};return _.value.forEach(l=>{const n=l.name.includes(".")?E(e,l.name):e?.[l.name],t=T(l),s=n===void 0?t:n;if(l.name.includes(".")){x(o,l.name,s);return}l.type==="file"?o[l.name]=null:l.type==="multifile"||l.type==="multiselect"?o[l.name]=Array.isArray(s)?s:[]:o[l.name]=s}),o};a.watch(()=>v.initialData,e=>{const o=e?f(e):M();D(o)!==D(c.value)&&(N.value=!0,c.value=o,queueMicrotask(()=>{N.value=!1}))},{immediate:!0}),a.watch(c,e=>{N.value||S("form-change",e)},{deep:!0});const u=e=>e.includes(".")?E(c.value,e):c.value[e],A=e=>{const o=m.value?.[e];return o||(e.includes(".")?E(m.value,e):void 0)},d=(e,o)=>{e.includes(".")?x(c.value,e,o):c.value[e]=o},h=e=>e?.type==="password",C=e=>!!F.value[e.name],ee=e=>h(e)?C(e)?"text":"password":e.type,te=e=>{e?.name&&(F.value={...F.value,[e.name]:!F.value[e.name]})},ae=()=>{if(m.value={},_.value.forEach(e=>{const o=u(e.name);if(e.required&&!e.disabled&&e.type!=="hidden"&&(e.type==="checkbox"||e.type==="switch"?o||(m.value[e.name]=e.errorMessage||`${e.label} is required`):e.type==="multiselect"||e.type==="multifile"?(!Array.isArray(o)||o.length===0)&&(m.value[e.name]=e.errorMessage||`${e.label} is required`):e.type==="number"||e.type==="slider"||e.type==="range"?o===""||o===null||o===void 0?m.value[e.name]=e.errorMessage||`${e.label} is required`:e.min!==void 0&&Number(o)<e.min?m.value[e.name]=`${e.label} must be at least ${e.min}`:e.max!==void 0&&Number(o)>e.max&&(m.value[e.name]=`${e.label} must be at most ${e.max}`):e.type==="email"?!o||!String(o).trim()?m.value[e.name]=e.errorMessage||`${e.label} is required`:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(o))||(m.value[e.name]="Please enter a valid email address"):e.type==="url"?!o||!String(o).trim()?m.value[e.name]=e.errorMessage||`${e.label} is required`:/^https?:\/\/.+/.test(String(o))||(m.value[e.name]="Please enter a valid URL"):(o==null||typeof o=="string"&&!o.trim())&&(m.value[e.name]=e.errorMessage||`${e.label} is required`)),typeof e.validate=="function"){const l=e.validate(o,c.value);l&&(m.value[e.name]=l)}}),typeof v.customValidation=="function"){const e=v.customValidation(c.value);e&&typeof e=="object"&&(m.value={...m.value,...e})}if(typeof v.crossValidate=="function"){const e=v.crossValidate(c.value);e&&typeof e=="object"&&(m.value={...m.value,...e})}return Object.keys(m.value).length===0},k=(e,o,l=void 0)=>typeof e=="function"?e(c.value,o):e===void 0?l:e,j=e=>!!e?.actionButton&&e.actionButton.show!==!1,L=e=>{if(!e?.actionButton)return!0;const o=typeof e.actionButton.disabled=="function"?e.actionButton.disabled(c.value,e):e.actionButton.disabled;return!!(i.value||e.disabled||o)},P=e=>e?.actionButton?typeof e.actionButton.loading=="function"?e.actionButton.loading(c.value,e):!!e.actionButton.loading:!1,R=e=>{typeof e?.actionButton?.onClick=="function"&&e.actionButton.onClick(c.value,e)},O=e=>h(e)||!!k(e.trailingIcon,e,null),oe=e=>h(e)?C(e)?"eye-slash":"eye":k(e.trailingIcon,e,null),Y=e=>h(e)?C(e)?"Hide password":"Show password":k(e.trailingIconTitle,e,"Action"),ne=e=>h(e)?C(e)?"Hide password":"Show password":k(e.trailingIconAriaLabel,e,Y(e)),re=e=>k(e.trailingIconClass,e,"w-4 h-4"),U=e=>!!(i.value||e.disabled||k(e.trailingIconDisabled,e,!1)),le=e=>{if(!U(e)){if(h(e)){te(e);return}typeof e?.onTrailingIconClick=="function"&&e.onTrailingIconClick(c.value,e)}},I=async(e,o)=>{if(d(e.name,o),typeof e?.onChange=="function")try{await e.onChange(o,c.value)}catch{w.toast.error("An error occurred while processing the change")}},se=(e,o)=>{if(d(e.name,o),typeof e?.onChange=="function")try{e.onChange(o,c.value)}catch{w.toast.error("An error occurred while processing the change")}},ce=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},ie=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},ue=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},me=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},de=e=>{const o=new FormData;return Object.keys(e).forEach(l=>{const n=e[l];n!=null&&(n instanceof File?o.append(l,n):Array.isArray(n)?n.forEach((t,s)=>{t instanceof File?o.append(`${l}[]`,t):o.append(`${l}[${s}]`,t)}):typeof n=="object"&&!(n instanceof Date)?Object.keys(n).forEach(t=>{o.append(`${l}[${t}]`,n[t])}):o.append(l,n))}),o},pe=()=>{const e={};let o=!1;_.value.forEach(n=>{const t=u(n.name);if(n.type==="number"||n.type==="slider"||n.type==="range"){const p=t===""||t===null||t===void 0?t:Number(t);n.name.includes(".")?x(e,n.name,p):e[n.name]=p;return}if(n.type==="file"){t instanceof File?(o=!0,e[n.name]=t):v.formType==="edit"&&t&&(e[n.name]=t);return}if(n.type==="multifile"){Array.isArray(t)&&t.some(p=>p instanceof File)?(o=!0,e[n.name]=t):v.formType==="edit"&&Array.isArray(t)&&t.length>0&&(e[n.name]=t);return}const s=["text","textarea","date","email","url","tel","search","time","datetime-local","month","week"].includes(n.type)&&typeof t=="string"?t.trim():t;n.name.includes(".")?x(e,n.name,s):e[n.name]=s});let l=e;return o&&(l=de(e),v.formType==="edit"&&l.append("_method","PUT")),{formData:l,hasFiles:o}},H=async()=>{if(_.value.some(l=>l.type!=="multifile"&&(q.value[l.name]||[]).length>0))return w.toast.error("Please wait for all files to finish uploading"),!1;if(!ae())return w.toast.error("Please fix the validation errors before submitting"),!1;const o=pe();return S("submit",{formData:o.formData,formType:v.formType,originalData:v.initialData,hasFiles:o.hasFiles}),!0},be=async()=>{try{await H()}catch{w.toast.error("An error occurred during submission")}},ye=()=>{c.value=M(),m.value={},q.value={},S("reset")},ve=()=>S("cancel");return(e,o)=>{const l=a.resolveComponent("font-awesome-icon");return a.openBlock(),a.createElementBlock("div",Ce,[y.title?(a.openBlock(),a.createElementBlock("div",Ve,[a.createElementVNode("h2",we,a.toDisplayString(y.title),1),y.description?(a.openBlock(),a.createElementBlock("p",Se,a.toDisplayString(y.description),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.createElementVNode("form",{class:"space-y-6",onSubmit:a.withModifiers(be,["prevent"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList($.value,n=>(a.openBlock(),a.createElementBlock("div",{key:n.id,class:a.normalizeClass(n.wrapperClass||"")},[a.createElementVNode("div",{class:a.normalizeClass(n.card?"ui-surface border ui-border-strong rounded-xl p-4 sm:p-5":"")},[a.renderSlot(e.$slots,"section-header",{section:n},()=>[n.title||n.description?(a.openBlock(),a.createElementBlock("div",Fe,[n.title?(a.openBlock(),a.createElementBlock("h3",Ne,a.toDisplayString(n.title),1)):a.createCommentVNode("",!0),n.description?(a.openBlock(),a.createElementBlock("p",Ee,a.toDisplayString(n.description),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)],!0),a.createElementVNode("div",{class:a.normalizeClass(n.gridClass)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.fields,t=>(a.openBlock(),a.createElementBlock("div",{key:t.name,class:a.normalizeClass(t.wrapperClass||"col-span-12")},[t.type==="hidden"?(a.openBlock(),a.createElementBlock("input",{key:0,value:u(t.name),type:"hidden"},null,8,Te)):(a.openBlock(),a.createBlock(ke._sfc_main,{key:1,id:`form-${y.entityName}-${t.name}`,label:t.label,required:!!t.required,error:A(t.name),"error-message":A(t.name),"help-text":t.helpText,class:a.normalizeClass(t.labelClass||"")},{default:a.withCtx(({fieldId:s,hasError:p,ariaDescribedBy:b})=>[a.renderSlot(e.$slots,`field-${t.name}`,{field:t,formData:c.value,error:A(t.name),update:r=>d(t.name,r)},()=>[["text","number","password","color","email","tel","url","search"].includes(t.type)?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["relative",O(t)?"has-trailing-icon":""])},[a.createVNode(g._sfc_main,{id:s,"model-value":u(t.name),type:ee(t),placeholder:t.placeholder,disabled:i.value||t.disabled,readonly:t.readonly||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","type","placeholder","disabled","readonly","class","aria-describedby","onUpdate:modelValue"]),O(t)?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:a.normalizeClass(["absolute right-3 top-1/2 -translate-y-1/2 ui-text hover:text-(--ui-text) transition-colors",U(t)?"opacity-50 cursor-not-allowed":""]),title:Y(t),"aria-label":ne(t),disabled:U(t),onClick:r=>le(t)},[h(t)?(a.openBlock(),a.createElementBlock("svg",Ue,[C(t)?(a.openBlock(),a.createElementBlock("path",ze)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[o[0]||(o[0]=a.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M2.4 10.5C3.3 8.4 7 4 12 4s8.7 4.4 9.6 6.5c.2.3.2.7 0 1C20.7 13.6 17 18 12 18s-8.7-4.4-9.6-6.5a1.1 1.1 0 010-1z"},null,-1)),o[1]||(o[1]=a.createElementVNode("circle",{cx:"12",cy:"11",r:"3","stroke-width":"2"},null,-1))],64))])):(a.openBlock(),a.createBlock(l,{key:1,icon:oe(t),class:a.normalizeClass(re(t))},null,8,["icon","class"]))],10,Ae)):a.createCommentVNode("",!0)],2)):t.type==="textarea"?(a.openBlock(),a.createBlock(Be.default,{key:1,id:s,"model-value":u(t.name),placeholder:t.placeholder,disabled:i.value||t.disabled,readonly:t.readonly||t.disabled,rows:t.rows||3,class:a.normalizeClass(["w-full rounded-md border px-3 py-2 focus:outline-none focus:ring-2 focus:ring-(--ui-primary)",p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","placeholder","disabled","readonly","rows","class","aria-describedby","onUpdate:modelValue"])):t.type==="select"?(a.openBlock(),a.createElementBlock("div",qe,[a.createElementVNode("div",$e,[a.createVNode(G.default,{id:s,"model-value":u(t.name),options:t.options,placeholder:t.placeholder||"Select an option",disabled:i.value||t.disabled,"has-error":p,"aria-describedby":b,"onUpdate:modelValue":r=>I(t,r)},null,8,["id","model-value","options","placeholder","disabled","has-error","aria-describedby","onUpdate:modelValue"])]),j(t)?(a.openBlock(),a.createBlock(V._sfc_main,{key:0,type:"button",variant:t.actionButton.variant||"outline",size:t.actionButton.size||"icon",class:a.normalizeClass(t.actionButton.class||""),title:t.actionButton.title||t.actionButton.label||"Action",disabled:L(t),loading:P(t),onClick:r=>R(t)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.actionButton.label||"+"),1)]),_:2},1032,["variant","size","class","title","disabled","loading","onClick"])):a.createCommentVNode("",!0)])):t.type==="multiselect"?(a.openBlock(),a.createElementBlock("div",De,[a.createElementVNode("div",Me,[a.createVNode(_e.default,{id:s,"model-value":u(t.name),options:t.options,disabled:i.value||t.disabled,placeholder:t.placeholder||"Select options","has-error":p,"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","options","disabled","placeholder","has-error","aria-describedby","onUpdate:modelValue"])]),j(t)?(a.openBlock(),a.createBlock(V._sfc_main,{key:0,type:"button",variant:t.actionButton.variant||"outline",size:t.actionButton.size||"icon",class:a.normalizeClass(t.actionButton.class||""),title:t.actionButton.title||t.actionButton.label||"Action",disabled:L(t),loading:P(t),onClick:r=>R(t)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.actionButton.label||"+"),1)]),_:2},1032,["variant","size","class","title","disabled","loading","onClick"])):a.createCommentVNode("",!0)])):t.type==="combobox"?(a.openBlock(),a.createBlock(G.default,{key:4,id:s,"model-value":u(t.name),options:t.options,placeholder:t.placeholder||"Select or type to add new",disabled:i.value||t.disabled,"has-error":p,"aria-describedby":b,"allow-create":t.allowCreate,"onUpdate:modelValue":r=>I(t,r)},null,8,["id","model-value","options","placeholder","disabled","has-error","aria-describedby","allow-create","onUpdate:modelValue"])):t.type==="checkbox"?(a.openBlock(),a.createElementBlock("div",je,[a.createVNode(g._sfc_main,{id:s,"model-value":u(t.name),type:"checkbox",disabled:i.value||t.disabled,class:"h-4 w-4 rounded ui-border-strong","aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","aria-describedby","onUpdate:modelValue"]),a.createVNode(z.default,{for:s,class:"ml-2 text-sm ui-text"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.checkboxLabel||t.label),1)]),_:2},1032,["for"])])):t.type==="switch"?(a.openBlock(),a.createElementBlock("div",Le,[a.createElementVNode("button",{id:s,type:"button",role:"switch","aria-checked":u(t.name),disabled:i.value||t.disabled,class:a.normalizeClass(["relative inline-flex h-6 w-11 items-center rounded-full border-2 transition-colors focus:outline-none focus:ring-2 focus:ring-(--ui-primary) focus:ring-offset-2",u(t.name)?"ui-primary-bg border-(--ui-primary)":"ui-surface-soft border-(--ui-border-strong)",i.value||t.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"]),onClick:r=>d(t.name,!u(t.name))},[a.createElementVNode("span",{class:a.normalizeClass(["inline-block h-4 w-4 transform rounded-full ui-surface border ui-border-strong transition-transform",u(t.name)?"translate-x-6":"translate-x-1"])},null,2)],10,Pe),a.createVNode(z.default,{for:s,class:"ml-3 text-sm ui-text"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.checkboxLabel||t.label),1)]),_:2},1032,["for"])])):t.type==="radio"?(a.openBlock(),a.createElementBlock("div",Re,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.options,r=>(a.openBlock(),a.createElementBlock("div",{key:r.value,class:"flex items-center"},[a.createVNode(g._sfc_main,{id:`${s}-${r.value}`,"model-value":u(t.name),type:"radio",value:r.value,disabled:i.value||t.disabled,class:"h-4 w-4 ui-border-strong","aria-describedby":b,"onUpdate:modelValue":he=>d(t.name,he)},null,8,["id","model-value","value","disabled","aria-describedby","onUpdate:modelValue"]),a.createVNode(z.default,{for:`${s}-${r.value}`,class:"ml-2 text-sm ui-text"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(r.label),1)]),_:2},1032,["for"])]))),128))])):t.type==="file"?(a.openBlock(),a.createBlock(K.default,{key:8,multiple:!1,accept:t.accept,"max-size":t.maxSize,variant:t.variant||"default",onFilesSelected:r=>ce(t,r),onFileRemoved:r=>ie(t,r)},null,8,["accept","max-size","variant","onFilesSelected","onFileRemoved"])):t.type==="multifile"?(a.openBlock(),a.createBlock(K.default,{key:9,multiple:t.multiple!==!1,accept:t.accept,"max-size":t.maxSize,"max-files":t.maxFiles,variant:t.variant||"default",onFilesSelected:r=>ue(t,r),onFileRemoved:r=>me(t,r)},null,8,["multiple","accept","max-size","max-files","variant","onFilesSelected","onFileRemoved"])):t.type==="slider"?(a.openBlock(),a.createBlock(ge.default,{key:10,"model-value":u(t.name),min:t.min,max:t.max,step:t.step,disabled:i.value||t.disabled,"onUpdate:modelValue":r=>se(t,r)},null,8,["model-value","min","max","step","disabled","onUpdate:modelValue"])):t.type==="range"?(a.openBlock(),a.createElementBlock("div",Oe,[a.createElementVNode("div",Ye,[a.createVNode(g._sfc_main,{id:s,"model-value":u(t.name),type:"range",min:t.min,max:t.max,step:t.step||1,disabled:i.value||t.disabled,class:"flex-1","aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","min","max","step","disabled","aria-describedby","onUpdate:modelValue"]),a.createElementVNode("span",Ie,a.toDisplayString(u(t.name)),1)])])):t.type==="date"?(a.openBlock(),a.createBlock(J.default,{key:12,id:s,"model-value":u(t.name),disabled:i.value||t.disabled,required:t.required,min:t.min,max:t.max,placeholder:t.placeholder||"Select date",format:t.format||"DD/MM/YYYY","enable-time":t.enableTime===!0,"minute-interval":t.minuteInterval||1,clearable:t.clearable!==!1,"show-today":t.showToday!==!1,"calendar-position":t.calendarPosition||"left-0 bottom-full","aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","required","min","max","placeholder","format","enable-time","minute-interval","clearable","show-today","calendar-position","aria-describedby","onUpdate:modelValue"])):t.type==="time"?(a.openBlock(),a.createBlock(g._sfc_main,{key:13,id:s,"model-value":u(t.name),type:"time",disabled:i.value||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","class","aria-describedby","onUpdate:modelValue"])):t.type==="datetime-local"?(a.openBlock(),a.createBlock(J.default,{key:14,id:s,"model-value":u(t.name),disabled:i.value||t.disabled,required:t.required,min:t.min,max:t.max,placeholder:t.placeholder||"Select date and time",format:t.format||"DD/MM/YYYY","enable-time":!0,"minute-interval":t.minuteInterval||1,clearable:t.clearable!==!1,"show-today":t.showToday!==!1,"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","required","min","max","placeholder","format","minute-interval","clearable","show-today","aria-describedby","onUpdate:modelValue"])):t.type==="month"?(a.openBlock(),a.createBlock(g._sfc_main,{key:15,id:s,"model-value":u(t.name),type:"month",disabled:i.value||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","class","aria-describedby","onUpdate:modelValue"])):t.type==="week"?(a.openBlock(),a.createBlock(g._sfc_main,{key:16,id:s,"model-value":u(t.name),type:"week",disabled:i.value||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","class","aria-describedby","onUpdate:modelValue"])):a.createCommentVNode("",!0)],!0)]),_:2},1032,["id","label","required","error","error-message","help-text","class"]))],2))),128))],2)],2)],2))),128)),a.renderSlot(e.$slots,"actions",{formData:c.value,isValid:Z.value,submit:H},()=>[y.showSubmit?(a.openBlock(),a.createElementBlock("div",He,[y.showReset?(a.openBlock(),a.createBlock(V._sfc_main,{key:0,type:"button",variant:"outline",disabled:i.value,onClick:ye},{default:a.withCtx(()=>[...o[2]||(o[2]=[a.createTextVNode(" Reset ",-1)])]),_:1},8,["disabled"])):a.createCommentVNode("",!0),y.showCancel?(a.openBlock(),a.createBlock(V._sfc_main,{key:1,type:"button",variant:"outline",disabled:i.value,onClick:ve},{default:a.withCtx(()=>[...o[3]||(o[3]=[a.createTextVNode(" Cancel ",-1)])]),_:1},8,["disabled"])):a.createCommentVNode("",!0),a.createVNode(V._sfc_main,{type:"submit",disabled:i.value,loading:i.value,variant:"default"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(y.submitLabel),1)]),_:1},8,["disabled","loading"])])):a.createCommentVNode("",!0)],!0),y.showSubmit&&X.value?(a.openBlock(),a.createElementBlock("div",Je)):a.createCommentVNode("",!0)],32)])}}},Ke=xe._export_sfc(Ge,[["__scopeId","data-v-7f79d2a2"]]);exports.default=Ke;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),ge=require("./Slider.cjs"),J=require("../DatePicker.vue_vue_type_script_setup_true_lang-CIKiZaO1.cjs"),ke=require("../FormField.vue_vue_type_script_setup_true_lang-FWitIR3U.cjs"),g=require("../Input.vue_vue_type_script_setup_true_lang-C1OQn24h.cjs"),_e=require("./Textarea.cjs"),G=require("./Select.cjs"),Be=require("./MultiSelect.cjs"),V=require("../Button.vue_vue_type_script_setup_true_lang-DZxttvYH.cjs"),z=require("./Label.cjs"),K=require("./FileUpload.cjs"),w=require("../lib/toast.cjs"),xe=require("../_plugin-vue_export-helper-BHFhmbuH.cjs"),Ce={class:"w-full p-2"},Ve={key:0,class:"mb-6"},we={class:"text-xl font-semibold ui-text"},Se={key:0,class:"mt-1 text-sm ui-text-muted"},Fe={key:0,class:"mb-4"},Ne={key:0,class:"text-base font-semibold ui-text"},Ee={key:1,class:"mt-1 text-sm ui-text-muted"},Te=["value"],Ae=["title","aria-label","disabled","onClick"],Ue={key:0,class:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true"},ze={key:0,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 3l18 18M10.6 10.7a2 2 0 002.7 2.7M9.9 4.2A10.7 10.7 0 0112 4c5 0 8.7 4.4 9.6 6.5.2.3.2.7 0 1a15 15 0 01-2.2 3.3M6.2 6.2A15.8 15.8 0 002.4 10.5c-.2.3-.2.7 0 1C3.3 13.6 7 18 12 18c1 0 2-.2 2.9-.5"},qe={key:2,class:"flex w-full items-center gap-2"},$e={class:"min-w-0 flex-1"},De={key:3,class:"flex w-full items-center gap-2"},Me={class:"min-w-0 flex-1"},je={key:5,class:"flex items-center"},Le={key:6,class:"flex items-center"},Pe=["id","aria-checked","disabled","onClick"],Re={key:7,class:"space-y-2"},Oe={key:11,class:"space-y-2"},Ye={class:"flex items-center gap-4"},Ie={class:"min-w-12 text-right text-sm font-medium ui-text"},He={key:0,class:"flex justify-end gap-3 pt-6"},Je={key:0,class:"hidden"},Ge={__name:"ReusableForm",props:{title:{type:String,default:""},description:{type:String,default:""},entityName:{type:String,default:"Item"},fields:{type:Array,required:!0,validator:y=>Array.isArray(y)&&y.every(_=>_?.name&&_?.label&&_?.type)},sections:{type:Array,default:()=>[]},initialData:{type:Object,default:null},loading:{type:Boolean,default:!1},customValidation:{type:Function,default:null},crossValidate:{type:Function,default:null},submitLabel:{type:String,default:"Submit"},showReset:{type:Boolean,default:!0},showCancel:{type:Boolean,default:!0},showSubmit:{type:Boolean,default:!0},formType:{type:String,default:"create",validator:y=>["create","edit"].includes(y)}},emits:["submit","reset","cancel","form-change"],setup(y,{emit:_}){const v=y,S=_,Q=a.useSlots(),i=a.computed(()=>v.loading),c=a.ref({}),m=a.ref({}),F=a.ref({}),q=a.ref({}),N=a.ref(!1),W=a.computed(()=>Array.isArray(v.sections)&&v.sections.length>0),X=a.computed(()=>!!Q.actions),$=a.computed(()=>W.value?v.sections.map((e,o)=>{const s=e?.id||`section-${o+1}`,n=Array.isArray(e?.fields)?e.fields:(v.fields||[]).filter(t=>t.sectionId===s);return{id:s,title:e?.title||"",description:e?.description||"",icon:e?.icon||"",wrapperClass:e?.wrapperClass||"",gridClass:e?.gridClass||"grid grid-cols-12 gap-4",card:e?.card!==!1,fields:n}}):[{id:"default",title:"",description:"",icon:"",wrapperClass:"",gridClass:"grid grid-cols-12 gap-4",card:!1,fields:v.fields||[]}]),B=a.computed(()=>$.value.flatMap(e=>e.fields||[])),Z=a.computed(()=>Object.keys(m.value).length===0),D=e=>{try{return JSON.stringify(e??{})}catch{return""}},E=(e,o)=>{if(!(!e||!o))return o.split(".").reduce((s,n)=>s?.[n],e)},x=(e,o,s)=>{const n=o.split("."),t=n.pop(),l=n.reduce((p,b)=>((!p[b]||typeof p[b]!="object")&&(p[b]={}),p[b]),e);l[t]=s},T=e=>e.type==="checkbox"||e.type==="switch"?!1:e.type==="number"||e.type==="slider"||e.type==="range"?e.min??0:e.type==="file"?null:e.type==="multifile"||e.type==="multiselect"?[]:e.type==="radio"&&e.options?.[0]?.value||"",M=()=>{const e={};return B.value.forEach(o=>{o.name.includes(".")?x(e,o.name,T(o)):e[o.name]=T(o)}),e},f=e=>{const o={};return B.value.forEach(s=>{const n=s.name.includes(".")?E(e,s.name):e?.[s.name],t=T(s),l=n===void 0?t:n;if(s.name.includes(".")){x(o,s.name,l);return}s.type==="file"?o[s.name]=null:s.type==="multifile"||s.type==="multiselect"?o[s.name]=Array.isArray(l)?l:[]:o[s.name]=l}),o};a.watch(()=>v.initialData,e=>{const o=e?f(e):M();D(o)!==D(c.value)&&(N.value=!0,c.value=o,queueMicrotask(()=>{N.value=!1}))},{immediate:!0}),a.watch(c,e=>{N.value||S("form-change",e)},{deep:!0});const u=e=>e.includes(".")?E(c.value,e):c.value[e],A=e=>{const o=m.value?.[e];return o||(e.includes(".")?E(m.value,e):void 0)},d=(e,o)=>{e.includes(".")?x(c.value,e,o):c.value[e]=o},h=e=>e?.type==="password",C=e=>!!F.value[e.name],ee=e=>h(e)?C(e)?"text":"password":e.type,te=e=>{e?.name&&(F.value={...F.value,[e.name]:!F.value[e.name]})},ae=()=>{if(m.value={},B.value.forEach(e=>{const o=u(e.name);if(e.required&&!e.disabled&&e.type!=="hidden"&&(e.type==="checkbox"||e.type==="switch"?o||(m.value[e.name]=e.errorMessage||`${e.label} is required`):e.type==="multiselect"||e.type==="multifile"?(!Array.isArray(o)||o.length===0)&&(m.value[e.name]=e.errorMessage||`${e.label} is required`):e.type==="number"||e.type==="slider"||e.type==="range"?o===""||o===null||o===void 0?m.value[e.name]=e.errorMessage||`${e.label} is required`:e.min!==void 0&&Number(o)<e.min?m.value[e.name]=`${e.label} must be at least ${e.min}`:e.max!==void 0&&Number(o)>e.max&&(m.value[e.name]=`${e.label} must be at most ${e.max}`):e.type==="email"?!o||!String(o).trim()?m.value[e.name]=e.errorMessage||`${e.label} is required`:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(o))||(m.value[e.name]="Please enter a valid email address"):e.type==="url"?!o||!String(o).trim()?m.value[e.name]=e.errorMessage||`${e.label} is required`:/^https?:\/\/.+/.test(String(o))||(m.value[e.name]="Please enter a valid URL"):(o==null||typeof o=="string"&&!o.trim())&&(m.value[e.name]=e.errorMessage||`${e.label} is required`)),typeof e.validate=="function"){const s=e.validate(o,c.value);s&&(m.value[e.name]=s)}}),typeof v.customValidation=="function"){const e=v.customValidation(c.value);e&&typeof e=="object"&&(m.value={...m.value,...e})}if(typeof v.crossValidate=="function"){const e=v.crossValidate(c.value);e&&typeof e=="object"&&(m.value={...m.value,...e})}return Object.keys(m.value).length===0},k=(e,o,s=void 0)=>typeof e=="function"?e(c.value,o):e===void 0?s:e,j=e=>!!e?.actionButton&&e.actionButton.show!==!1,L=e=>{if(!e?.actionButton)return!0;const o=typeof e.actionButton.disabled=="function"?e.actionButton.disabled(c.value,e):e.actionButton.disabled;return!!(i.value||e.disabled||o)},P=e=>e?.actionButton?typeof e.actionButton.loading=="function"?e.actionButton.loading(c.value,e):!!e.actionButton.loading:!1,R=e=>{typeof e?.actionButton?.onClick=="function"&&e.actionButton.onClick(c.value,e)},O=e=>h(e)||!!k(e.trailingIcon,e,null),oe=e=>h(e)?C(e)?"eye-slash":"eye":k(e.trailingIcon,e,null),Y=e=>h(e)?C(e)?"Hide password":"Show password":k(e.trailingIconTitle,e,"Action"),ne=e=>h(e)?C(e)?"Hide password":"Show password":k(e.trailingIconAriaLabel,e,Y(e)),re=e=>k(e.trailingIconClass,e,"w-4 h-4"),U=e=>!!(i.value||e.disabled||k(e.trailingIconDisabled,e,!1)),se=e=>{if(!U(e)){if(h(e)){te(e);return}typeof e?.onTrailingIconClick=="function"&&e.onTrailingIconClick(c.value,e)}},I=async(e,o)=>{if(d(e.name,o),typeof e?.onChange=="function")try{await e.onChange(o,c.value)}catch{w.toast.error("An error occurred while processing the change")}},le=(e,o)=>{if(d(e.name,o),typeof e?.onChange=="function")try{e.onChange(o,c.value)}catch{w.toast.error("An error occurred while processing the change")}},ce=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},ie=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},ue=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},me=(e,o)=>{d(e.name,o),typeof e?.onChange=="function"&&e.onChange(o,c.value)},de=e=>{const o=new FormData;return Object.keys(e).forEach(s=>{const n=e[s];n!=null&&(n instanceof File?o.append(s,n):Array.isArray(n)?n.forEach((t,l)=>{t instanceof File?o.append(`${s}[]`,t):o.append(`${s}[${l}]`,t)}):typeof n=="object"&&!(n instanceof Date)?Object.keys(n).forEach(t=>{o.append(`${s}[${t}]`,n[t])}):o.append(s,n))}),o},pe=()=>{const e={};let o=!1;B.value.forEach(n=>{const t=u(n.name);if(n.type==="number"||n.type==="slider"||n.type==="range"){const p=t===""||t===null||t===void 0?t:Number(t);n.name.includes(".")?x(e,n.name,p):e[n.name]=p;return}if(n.type==="file"){t instanceof File?(o=!0,e[n.name]=t):v.formType==="edit"&&t&&(e[n.name]=t);return}if(n.type==="multifile"){Array.isArray(t)&&t.some(p=>p instanceof File)?(o=!0,e[n.name]=t):v.formType==="edit"&&Array.isArray(t)&&t.length>0&&(e[n.name]=t);return}const l=["text","textarea","date","email","url","tel","search","time","datetime-local","month","week"].includes(n.type)&&typeof t=="string"?t.trim():t;n.name.includes(".")?x(e,n.name,l):e[n.name]=l});let s=e;return o&&(s=de(e),v.formType==="edit"&&s.append("_method","PUT")),{formData:s,hasFiles:o}},H=async()=>{if(B.value.some(s=>s.type!=="multifile"&&(q.value[s.name]||[]).length>0))return w.toast.error("Please wait for all files to finish uploading"),!1;if(!ae())return w.toast.error("Please fix the validation errors before submitting"),!1;const o=pe();return S("submit",{formData:o.formData,formType:v.formType,originalData:v.initialData,hasFiles:o.hasFiles}),!0},be=async()=>{try{await H()}catch{w.toast.error("An error occurred during submission")}},ye=()=>{c.value=M(),m.value={},q.value={},S("reset")},ve=()=>S("cancel");return(e,o)=>{const s=a.resolveComponent("font-awesome-icon");return a.openBlock(),a.createElementBlock("div",Ce,[y.title?(a.openBlock(),a.createElementBlock("div",Ve,[a.createElementVNode("h2",we,a.toDisplayString(y.title),1),y.description?(a.openBlock(),a.createElementBlock("p",Se,a.toDisplayString(y.description),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),a.createElementVNode("form",{class:"space-y-6",onSubmit:a.withModifiers(be,["prevent"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList($.value,n=>(a.openBlock(),a.createElementBlock("div",{key:n.id,class:a.normalizeClass(n.wrapperClass||"")},[a.createElementVNode("div",{class:a.normalizeClass(n.card?"ui-surface border ui-border-strong rounded-xl p-4 sm:p-5":"")},[a.renderSlot(e.$slots,"section-header",{section:n},()=>[n.title||n.description?(a.openBlock(),a.createElementBlock("div",Fe,[n.title?(a.openBlock(),a.createElementBlock("h3",Ne,a.toDisplayString(n.title),1)):a.createCommentVNode("",!0),n.description?(a.openBlock(),a.createElementBlock("p",Ee,a.toDisplayString(n.description),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)],!0),a.createElementVNode("div",{class:a.normalizeClass(n.gridClass)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(n.fields,t=>(a.openBlock(),a.createElementBlock("div",{key:t.name,class:a.normalizeClass(t.wrapperClass||"col-span-12")},[t.type==="hidden"?(a.openBlock(),a.createElementBlock("input",{key:0,value:u(t.name),type:"hidden"},null,8,Te)):(a.openBlock(),a.createBlock(ke._sfc_main,{key:1,id:`form-${y.entityName}-${t.name}`,label:t.label,required:!!t.required,error:A(t.name),"error-message":A(t.name),"help-text":t.helpText,class:a.normalizeClass(t.labelClass||"")},{default:a.withCtx(({fieldId:l,hasError:p,ariaDescribedBy:b})=>[a.renderSlot(e.$slots,`field-${t.name}`,{field:t,formData:c.value,error:A(t.name),update:r=>d(t.name,r)},()=>[["text","number","password","color","email","tel","url","search"].includes(t.type)?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["relative",O(t)?"has-trailing-icon":""])},[a.createVNode(g._sfc_main,{id:l,"model-value":u(t.name),type:ee(t),placeholder:t.placeholder,disabled:i.value||t.disabled,readonly:t.readonly||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","type","placeholder","disabled","readonly","class","aria-describedby","onUpdate:modelValue"]),O(t)?(a.openBlock(),a.createElementBlock("button",{key:0,type:"button",class:a.normalizeClass(["absolute right-3 top-1/2 -translate-y-1/2 ui-text hover:text-(--ui-text) transition-colors",U(t)?"opacity-50 cursor-not-allowed":""]),title:Y(t),"aria-label":ne(t),disabled:U(t),onClick:r=>se(t)},[h(t)?(a.openBlock(),a.createElementBlock("svg",Ue,[C(t)?(a.openBlock(),a.createElementBlock("path",ze)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[o[0]||(o[0]=a.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M2.4 10.5C3.3 8.4 7 4 12 4s8.7 4.4 9.6 6.5c.2.3.2.7 0 1C20.7 13.6 17 18 12 18s-8.7-4.4-9.6-6.5a1.1 1.1 0 010-1z"},null,-1)),o[1]||(o[1]=a.createElementVNode("circle",{cx:"12",cy:"11",r:"3","stroke-width":"2"},null,-1))],64))])):(a.openBlock(),a.createBlock(s,{key:1,icon:oe(t),class:a.normalizeClass(re(t))},null,8,["icon","class"]))],10,Ae)):a.createCommentVNode("",!0)],2)):t.type==="textarea"?(a.openBlock(),a.createBlock(_e.default,{key:1,id:l,"model-value":u(t.name),placeholder:t.placeholder,disabled:i.value||t.disabled,readonly:t.readonly||t.disabled,rows:t.rows||3,class:a.normalizeClass(["w-full rounded-md border px-3 py-2 focus:outline-none focus:ring-2 focus:ring-(--ui-primary)",p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","placeholder","disabled","readonly","rows","class","aria-describedby","onUpdate:modelValue"])):t.type==="select"?(a.openBlock(),a.createElementBlock("div",qe,[a.createElementVNode("div",$e,[a.createVNode(G.default,{id:l,"model-value":u(t.name),options:t.options,placeholder:t.placeholder||"Select an option",disabled:i.value||t.disabled,"has-error":p,"aria-describedby":b,"onUpdate:modelValue":r=>I(t,r)},null,8,["id","model-value","options","placeholder","disabled","has-error","aria-describedby","onUpdate:modelValue"])]),j(t)?(a.openBlock(),a.createBlock(V._sfc_main,{key:0,type:"button",variant:t.actionButton.variant||"outline",size:t.actionButton.size||"icon",class:a.normalizeClass(t.actionButton.class||""),title:t.actionButton.title||t.actionButton.label||"Action",disabled:L(t),loading:P(t),onClick:r=>R(t)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.actionButton.label||"+"),1)]),_:2},1032,["variant","size","class","title","disabled","loading","onClick"])):a.createCommentVNode("",!0)])):t.type==="multiselect"?(a.openBlock(),a.createElementBlock("div",De,[a.createElementVNode("div",Me,[a.createVNode(Be.default,{id:l,"model-value":u(t.name),options:t.options,disabled:i.value||t.disabled,placeholder:t.placeholder||"Select options","has-error":p,"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","options","disabled","placeholder","has-error","aria-describedby","onUpdate:modelValue"])]),j(t)?(a.openBlock(),a.createBlock(V._sfc_main,{key:0,type:"button",variant:t.actionButton.variant||"outline",size:t.actionButton.size||"icon",class:a.normalizeClass(t.actionButton.class||""),title:t.actionButton.title||t.actionButton.label||"Action",disabled:L(t),loading:P(t),onClick:r=>R(t)},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.actionButton.label||"+"),1)]),_:2},1032,["variant","size","class","title","disabled","loading","onClick"])):a.createCommentVNode("",!0)])):t.type==="combobox"?(a.openBlock(),a.createBlock(G.default,{key:4,id:l,"model-value":u(t.name),options:t.options,placeholder:t.placeholder||"Select or type to add new",disabled:i.value||t.disabled,"has-error":p,"aria-describedby":b,"allow-create":t.allowCreate,"onUpdate:modelValue":r=>I(t,r)},null,8,["id","model-value","options","placeholder","disabled","has-error","aria-describedby","allow-create","onUpdate:modelValue"])):t.type==="checkbox"?(a.openBlock(),a.createElementBlock("div",je,[a.createVNode(g._sfc_main,{id:l,"model-value":u(t.name),type:"checkbox",disabled:i.value||t.disabled,class:"h-4 w-4 rounded ui-border-strong","aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","aria-describedby","onUpdate:modelValue"]),a.createVNode(z.default,{for:l,class:"ml-2 text-sm ui-text"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.checkboxLabel||t.label),1)]),_:2},1032,["for"])])):t.type==="switch"?(a.openBlock(),a.createElementBlock("div",Le,[a.createElementVNode("button",{id:l,type:"button",role:"switch","aria-checked":u(t.name),disabled:i.value||t.disabled,class:a.normalizeClass(["relative inline-flex h-6 w-11 items-center rounded-full border-2 transition-colors focus:outline-none focus:ring-2 focus:ring-(--ui-primary) focus:ring-offset-2",u(t.name)?"ui-primary-bg border-(--ui-primary)":"ui-surface-soft border-(--ui-border-strong)",i.value||t.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"]),onClick:r=>d(t.name,!u(t.name))},[a.createElementVNode("span",{class:a.normalizeClass(["inline-block h-4 w-4 transform rounded-full ui-surface border ui-border-strong transition-transform",u(t.name)?"translate-x-6":"translate-x-1"])},null,2)],10,Pe),a.createVNode(z.default,{for:l,class:"ml-3 text-sm ui-text"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(t.checkboxLabel||t.label),1)]),_:2},1032,["for"])])):t.type==="radio"?(a.openBlock(),a.createElementBlock("div",Re,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.options,r=>(a.openBlock(),a.createElementBlock("div",{key:r.value,class:"flex items-center"},[a.createVNode(g._sfc_main,{id:`${l}-${r.value}`,"model-value":u(t.name),type:"radio",value:r.value,disabled:i.value||t.disabled,class:"h-4 w-4 ui-border-strong","aria-describedby":b,"onUpdate:modelValue":he=>d(t.name,he)},null,8,["id","model-value","value","disabled","aria-describedby","onUpdate:modelValue"]),a.createVNode(z.default,{for:`${l}-${r.value}`,class:"ml-2 text-sm ui-text"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(r.label),1)]),_:2},1032,["for"])]))),128))])):t.type==="file"?(a.openBlock(),a.createBlock(K.default,{key:8,multiple:!1,accept:t.accept,"max-size":t.maxSize,variant:t.variant||"default",onFilesSelected:r=>ce(t,r),onFileRemoved:r=>ie(t,r)},null,8,["accept","max-size","variant","onFilesSelected","onFileRemoved"])):t.type==="multifile"?(a.openBlock(),a.createBlock(K.default,{key:9,multiple:t.multiple!==!1,accept:t.accept,"max-size":t.maxSize,"max-files":t.maxFiles,variant:t.variant||"default",onFilesSelected:r=>ue(t,r),onFileRemoved:r=>me(t,r)},null,8,["multiple","accept","max-size","max-files","variant","onFilesSelected","onFileRemoved"])):t.type==="slider"?(a.openBlock(),a.createBlock(ge.default,{key:10,"model-value":u(t.name),min:t.min,max:t.max,step:t.step,disabled:i.value||t.disabled,"onUpdate:modelValue":r=>le(t,r)},null,8,["model-value","min","max","step","disabled","onUpdate:modelValue"])):t.type==="range"?(a.openBlock(),a.createElementBlock("div",Oe,[a.createElementVNode("div",Ye,[a.createVNode(g._sfc_main,{id:l,"model-value":u(t.name),type:"range",min:t.min,max:t.max,step:t.step||1,disabled:i.value||t.disabled,class:"flex-1","aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","min","max","step","disabled","aria-describedby","onUpdate:modelValue"]),a.createElementVNode("span",Ie,a.toDisplayString(u(t.name)),1)])])):t.type==="date"?(a.openBlock(),a.createBlock(J._sfc_main,{key:12,id:l,"model-value":u(t.name),disabled:i.value||t.disabled,required:t.required,min:t.min,max:t.max,placeholder:t.placeholder||"Select date",format:t.format||"DD/MM/YYYY","enable-time":t.enableTime===!0,"minute-interval":t.minuteInterval||1,clearable:t.clearable!==!1,"show-today":t.showToday!==!1,"calendar-position":t.calendarPosition||"left-0 bottom-full","aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","required","min","max","placeholder","format","enable-time","minute-interval","clearable","show-today","calendar-position","aria-describedby","onUpdate:modelValue"])):t.type==="time"?(a.openBlock(),a.createBlock(g._sfc_main,{key:13,id:l,"model-value":u(t.name),type:"time",disabled:i.value||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","class","aria-describedby","onUpdate:modelValue"])):t.type==="datetime-local"?(a.openBlock(),a.createBlock(J._sfc_main,{key:14,id:l,"model-value":u(t.name),disabled:i.value||t.disabled,required:t.required,min:t.min,max:t.max,placeholder:t.placeholder||"Select date and time",format:t.format||"DD/MM/YYYY","enable-time":!0,"minute-interval":t.minuteInterval||1,clearable:t.clearable!==!1,"show-today":t.showToday!==!1,"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","required","min","max","placeholder","format","minute-interval","clearable","show-today","aria-describedby","onUpdate:modelValue"])):t.type==="month"?(a.openBlock(),a.createBlock(g._sfc_main,{key:15,id:l,"model-value":u(t.name),type:"month",disabled:i.value||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","class","aria-describedby","onUpdate:modelValue"])):t.type==="week"?(a.openBlock(),a.createBlock(g._sfc_main,{key:16,id:l,"model-value":u(t.name),type:"week",disabled:i.value||t.disabled,class:a.normalizeClass([p?"border-(--ui-danger)":"ui-border-strong",t.inputClass||""]),"aria-describedby":b,"onUpdate:modelValue":r=>d(t.name,r)},null,8,["id","model-value","disabled","class","aria-describedby","onUpdate:modelValue"])):a.createCommentVNode("",!0)],!0)]),_:2},1032,["id","label","required","error","error-message","help-text","class"]))],2))),128))],2)],2)],2))),128)),a.renderSlot(e.$slots,"actions",{formData:c.value,isValid:Z.value,submit:H},()=>[y.showSubmit?(a.openBlock(),a.createElementBlock("div",He,[y.showReset?(a.openBlock(),a.createBlock(V._sfc_main,{key:0,type:"button",variant:"outline",disabled:i.value,onClick:ye},{default:a.withCtx(()=>[...o[2]||(o[2]=[a.createTextVNode(" Reset ",-1)])]),_:1},8,["disabled"])):a.createCommentVNode("",!0),y.showCancel?(a.openBlock(),a.createBlock(V._sfc_main,{key:1,type:"button",variant:"outline",disabled:i.value,onClick:ve},{default:a.withCtx(()=>[...o[3]||(o[3]=[a.createTextVNode(" Cancel ",-1)])]),_:1},8,["disabled"])):a.createCommentVNode("",!0),a.createVNode(V._sfc_main,{type:"submit",disabled:i.value,loading:i.value,variant:"default"},{default:a.withCtx(()=>[a.createTextVNode(a.toDisplayString(y.submitLabel),1)]),_:1},8,["disabled","loading"])])):a.createCommentVNode("",!0)],!0),y.showSubmit&&X.value?(a.openBlock(),a.createElementBlock("div",Je)):a.createCommentVNode("",!0)],32)])}}},Ke=xe._export_sfc(Ge,[["__scopeId","data-v-7f79d2a2"]]);exports.default=Ke;
@@ -1,7 +1,7 @@
1
1
  import { useSlots as qe, computed as U, ref as z, watch as re, resolveComponent as ze, createElementBlock as i, openBlock as s, createCommentVNode as w, createElementVNode as k, toDisplayString as _, withModifiers as De, renderSlot as H, Fragment as L, renderList as J, normalizeClass as v, createBlock as x, withCtx as V, createVNode as C, createTextVNode as F } from "vue";
2
2
  import Re from "./Slider.js";
3
- import le from "./DatePicker.js";
4
- import { _ as je } from "../FormField.vue_vue_type_script_setup_true_lang-DimMUyA-.js";
3
+ import { _ as le } from "../DatePicker.vue_vue_type_script_setup_true_lang-Dx_9f8DO.js";
4
+ import { _ as je } from "../FormField.vue_vue_type_script_setup_true_lang-BljDj5YZ.js";
5
5
  import { _ as $ } from "../Input.vue_vue_type_script_setup_true_lang-CpBoY97r.js";
6
6
  import Pe from "./Textarea.js";
7
7
  import ie from "./Select.js";