@macrulez/vue-form-schema 0.1.9 → 0.2.1

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.
Files changed (82) hide show
  1. package/README.md +461 -180
  2. package/dist/MaskEngine-BEXwX4BK.js +144 -0
  3. package/dist/MaskEngine-CPr-fSPy.cjs +1 -0
  4. package/dist/ValidationEngine-BC4U1ef1.js +135 -0
  5. package/dist/ValidationEngine-Diz-qTFs.cjs +1 -0
  6. package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
  7. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  8. package/dist/core/ConditionEvaluator.d.ts.map +1 -1
  9. package/dist/core/MaskEngine.d.ts.map +1 -1
  10. package/dist/core/ValidationEngine.d.ts +7 -0
  11. package/dist/core/ValidationEngine.d.ts.map +1 -1
  12. package/dist/core/formRegistry.d.ts +33 -0
  13. package/dist/core/formRegistry.d.ts.map +1 -0
  14. package/dist/core/inferTypes.d.ts.map +1 -1
  15. package/dist/core/schemaUtils.d.ts +38 -0
  16. package/dist/core/schemaUtils.d.ts.map +1 -1
  17. package/dist/core/serverErrors.d.ts +69 -0
  18. package/dist/core/serverErrors.d.ts.map +1 -0
  19. package/dist/core/types.d.ts +12 -0
  20. package/dist/core/types.d.ts.map +1 -1
  21. package/dist/core/useForm.d.ts +4 -1
  22. package/dist/core/useForm.d.ts.map +1 -1
  23. package/dist/core/useMultiStepForm.d.ts.map +1 -1
  24. package/dist/devtools/index.d.ts +26 -0
  25. package/dist/devtools/index.d.ts.map +1 -0
  26. package/dist/devtools.cjs +1 -0
  27. package/dist/devtools.d.ts +6 -0
  28. package/dist/devtools.js +93 -0
  29. package/dist/formRegistry-Bv1eaWQ-.js +31 -0
  30. package/dist/formRegistry-DaDmXyYY.cjs +1 -0
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.d.ts +4 -2
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +393 -368
  35. package/dist/openapi.cjs +1 -0
  36. package/dist/openapi.d.ts +202 -0
  37. package/dist/openapi.js +118 -0
  38. package/dist/parsers/json.d.ts.map +1 -1
  39. package/dist/parsers/openapi.d.ts +139 -0
  40. package/dist/parsers/openapi.d.ts.map +1 -0
  41. package/dist/parsers/valibot.d.ts +13 -4
  42. package/dist/parsers/valibot.d.ts.map +1 -1
  43. package/dist/parsers/yup.d.ts +10 -4
  44. package/dist/parsers/yup.d.ts.map +1 -1
  45. package/dist/parsers/zod.d.ts +18 -4
  46. package/dist/parsers/zod.d.ts.map +1 -1
  47. package/dist/schemaUtils-Cc7CwGXB.cjs +1 -0
  48. package/dist/schemaUtils-Cvlsk24U.js +337 -0
  49. package/dist/style.css +1 -0
  50. package/dist/ui/naive/index.d.ts +11 -0
  51. package/dist/ui/naive/index.d.ts.map +1 -0
  52. package/dist/ui/primevue/index.d.ts +11 -0
  53. package/dist/ui/primevue/index.d.ts.map +1 -0
  54. package/dist/ui/shadcn/index.d.ts +11 -0
  55. package/dist/ui/shadcn/index.d.ts.map +1 -0
  56. package/dist/ui-naive.cjs +1 -0
  57. package/dist/ui-naive.d.ts +276 -0
  58. package/dist/ui-naive.js +667 -0
  59. package/dist/ui-primevue.cjs +1 -0
  60. package/dist/ui-primevue.d.ts +276 -0
  61. package/dist/ui-primevue.js +651 -0
  62. package/dist/ui-shadcn.cjs +1 -0
  63. package/dist/ui-shadcn.d.ts +276 -0
  64. package/dist/ui-shadcn.js +650 -0
  65. package/dist/ui-tailwind.cjs +1 -1
  66. package/dist/ui-tailwind.d.ts +153 -274
  67. package/dist/ui-tailwind.js +180 -161
  68. package/dist/ui.cjs +1 -1
  69. package/dist/ui.d.ts +170 -308
  70. package/dist/ui.js +130 -131
  71. package/dist/valibot.cjs +1 -1
  72. package/dist/valibot.d.ts +25 -2
  73. package/dist/valibot.js +47 -20
  74. package/dist/yup.cjs +1 -1
  75. package/dist/yup.d.ts +23 -3
  76. package/dist/yup.js +16 -15
  77. package/dist/zod.cjs +1 -1
  78. package/dist/zod.d.ts +31 -3
  79. package/dist/zod.js +58 -28
  80. package/package.json +69 -7
  81. package/dist/MaskEngine-DAKSNIHQ.cjs +0 -1
  82. package/dist/MaskEngine-mLoXKd4d.js +0 -251
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),x=require("primevue/button"),g=require("./MaskEngine-CPr-fSPy.cjs"),q=require("./ValidationEngine-Diz-qTFs.cjs"),R=require("primevue/inputtext"),z=require("primevue/message"),w=require("primevue/inputnumber"),T=require("primevue/textarea"),A=require("primevue/select"),U=require("primevue/checkbox"),I=require("primevue/radiobutton"),L=require("primevue/datepicker"),M=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),j={class:"mb-4 flex flex-col gap-1.5"},H=["for"],K={key:0,class:"ml-0.5 text-red-500","aria-hidden":"true"},O=["id"],b=e.defineComponent({__name:"BaseField",props:{field:{},error:{},touched:{type:Boolean}},setup(t){const i=t,o=e.computed(()=>{var c;return!!(i.touched&&((c=i.error)!=null&&c.length))}),s=e.computed(()=>`${i.field.name}-error`),n=e.computed(()=>({invalid:o.value,"aria-required":i.field.required?"true":void 0,"aria-invalid":o.value?"true":"false","aria-describedby":o.value?s.value:void 0}));return(c,u)=>(e.openBlock(),e.createElementBlock("div",j,[t.field.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.field.name,class:"text-sm font-medium"},[e.createTextVNode(e.toDisplayString(t.field.label)+" ",1),t.field.required?(e.openBlock(),e.createElementBlock("span",K,"*")):e.createCommentVNode("",!0)],8,H)):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"default",e.normalizeProps(e.guardReactiveProps(n.value))),o.value?(e.openBlock(),e.createElementBlock("div",{key:1,id:s.value,role:"alert","aria-live":"polite",class:"flex flex-col gap-1"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.error,(d,m)=>(e.openBlock(),e.createBlock(e.unref(z),{key:m,severity:"error",size:"small",variant:"simple"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d),1)]),_:2},1024))),128))],8,O)):e.createCommentVNode("",!0)]))}}),h=e.defineComponent({__name:"TextField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=t,s=i,n=e.ref(null);let c=null;return e.onMounted(()=>{var d;const u=(d=n.value)==null?void 0:d.$el;u&&o.field.mask&&(c=g.bindMask(u,o.field.mask))}),e.onUnmounted(()=>c==null?void 0:c()),(u,d)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(m=>[e.createVNode(e.unref(R),e.mergeProps({id:t.field.name,ref_key:"inputRef",ref:n,type:t.field.type==="email"?"email":"text",name:t.field.name,"model-value":t.modelValue??"",placeholder:t.field.placeholder,disabled:t.field.disabled===!0,required:t.field.required,fluid:""},m,{"onUpdate:modelValue":d[0]||(d[0]=f=>s("update:modelValue",f??"")),onBlur:d[1]||(d[1]=f=>s("blur"))}),null,16,["id","type","name","model-value","placeholder","disabled","required"])]),_:1},8,["field","error","touched"]))}}),$=e.defineComponent({__name:"NumberField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=i;return(s,n)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(c=>[e.createVNode(e.unref(w),e.mergeProps({"input-id":t.field.name,name:t.field.name,"model-value":t.modelValue,placeholder:t.field.placeholder,disabled:t.field.disabled===!0,fluid:""},c,{"onUpdate:modelValue":n[0]||(n[0]=u=>o("update:modelValue",u)),onBlur:n[1]||(n[1]=u=>o("blur"))}),null,16,["input-id","name","model-value","placeholder","disabled"])]),_:1},8,["field","error","touched"]))}}),C=e.defineComponent({__name:"TextareaField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=i;return(s,n)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(c=>[e.createVNode(e.unref(T),e.mergeProps({id:t.field.name,name:t.field.name,"model-value":t.modelValue??"",placeholder:t.field.placeholder,disabled:t.field.disabled===!0,required:t.field.required,rows:"3",fluid:""},c,{"onUpdate:modelValue":n[0]||(n[0]=u=>o("update:modelValue",u)),onBlur:n[1]||(n[1]=u=>o("blur"))}),null,16,["id","name","model-value","placeholder","disabled","required"])]),_:1},8,["field","error","touched"]))}}),E=e.defineComponent({__name:"SelectField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=t,s=i,n=e.computed(()=>Array.isArray(o.field.options)?o.field.options:[]);return(c,u)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(d=>[e.createVNode(e.unref(A),e.mergeProps({"input-id":t.field.name,name:t.field.name,"model-value":t.modelValue,options:n.value,"option-label":"label","option-value":"value",placeholder:t.field.placeholder??"Select an option",disabled:t.field.disabled===!0||t.field.optionsLoading,loading:t.field.optionsLoading,fluid:""},d,{"onUpdate:modelValue":u[0]||(u[0]=m=>s("update:modelValue",m)),onBlur:u[1]||(u[1]=m=>s("blur"))}),null,16,["input-id","name","model-value","options","placeholder","disabled","loading"])]),_:1},8,["field","error","touched"]))}}),Y={class:"flex cursor-pointer items-center gap-2.5"},G={key:0,class:"text-sm"},N=e.defineComponent({__name:"CheckboxField",props:{field:{},modelValue:{type:[Boolean,null]},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=i;return(s,n)=>(e.openBlock(),e.createBlock(b,{field:{...t.field,label:void 0},error:t.error,touched:t.touched},{default:e.withCtx(c=>[e.createElementVNode("label",Y,[e.createVNode(e.unref(U),e.mergeProps({"input-id":t.field.name,name:t.field.name,"model-value":!!t.modelValue,binary:"",disabled:t.field.disabled===!0},c,{"onUpdate:modelValue":n[0]||(n[0]=u=>o("update:modelValue",u)),onBlur:n[1]||(n[1]=u=>o("blur"))}),null,16,["input-id","name","model-value","disabled"]),t.field.label?(e.openBlock(),e.createElementBlock("span",G,e.toDisplayString(t.field.label),1)):e.createCommentVNode("",!0)])]),_:1},8,["field","error","touched"]))}}),J=["aria-required","aria-invalid","aria-describedby"],Q={key:0,class:"text-sm font-medium"},W={key:0,class:"ml-0.5 text-red-500","aria-hidden":"true"},X={class:"flex flex-col gap-2"},Z={class:"text-sm"},_=["id"],F=e.defineComponent({__name:"RadioField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=t,s=i,n=e.computed(()=>{var d;return!!(o.touched&&((d=o.error)!=null&&d.length))}),c=e.computed(()=>`${o.field.name}-error`),u=e.computed(()=>Array.isArray(o.field.options)?o.field.options:[]);return(d,m)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"mb-4 flex flex-col gap-2","aria-required":t.field.required?"true":void 0,"aria-invalid":n.value?"true":"false","aria-describedby":n.value?c.value:void 0},[t.field.label?(e.openBlock(),e.createElementBlock("legend",Q,[e.createTextVNode(e.toDisplayString(t.field.label)+" ",1),t.field.required?(e.openBlock(),e.createElementBlock("span",W,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",X,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,f=>(e.openBlock(),e.createElementBlock("label",{key:String(f.value),class:"flex cursor-pointer items-center gap-2.5"},[e.createVNode(e.unref(I),{name:t.field.name,value:f.value,"model-value":t.modelValue,disabled:t.field.disabled===!0,"onUpdate:modelValue":m[0]||(m[0]=k=>s("update:modelValue",k)),onBlur:m[1]||(m[1]=k=>s("blur"))},null,8,["name","value","model-value","disabled"]),e.createElementVNode("span",Z,e.toDisplayString(f.label),1)]))),128))]),n.value?(e.openBlock(),e.createElementBlock("div",{key:1,id:c.value,role:"alert","aria-live":"polite"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.error,(f,k)=>(e.openBlock(),e.createElementBlock("p",{key:k,class:"text-sm font-medium text-red-500"},e.toDisplayString(f),1))),128))],8,_)):e.createCommentVNode("",!0)],8,J))}}),S=e.defineComponent({__name:"DateField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=t,s=i;function n(d){if(!d)return null;const[m,f,k]=d.split("-").map(Number);return!m||!f||!k?null:new Date(m,f-1,k)}function c(d){if(!(d instanceof Date))return"";const m=d.getFullYear(),f=String(d.getMonth()+1).padStart(2,"0"),k=String(d.getDate()).padStart(2,"0");return`${m}-${f}-${k}`}const u=e.computed(()=>n(o.modelValue));return(d,m)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(f=>[e.createVNode(e.unref(L),e.mergeProps({"input-id":t.field.name,name:t.field.name,"model-value":u.value,"date-format":"yy-mm-dd","show-icon":"","icon-display":"input",disabled:t.field.disabled===!0,fluid:""},f,{"onUpdate:modelValue":m[0]||(m[0]=k=>s("update:modelValue",c(k))),onBlur:m[1]||(m[1]=k=>s("blur"))}),null,16,["input-id","name","model-value","disabled"])]),_:1},8,["field","error","touched"]))}}),ee=["id","name","accept","multiple","disabled","required"],te={class:"vfs-pv-dropzone__hint"},le={key:0,class:"vfs-pv-dropzone__accept"},oe={key:0,class:"vfs-pv-filelist"},ne={class:"vfs-pv-filelist__name"},re={class:"vfs-pv-filelist__size"},ae=["aria-label","onClick"],de=e.defineComponent({__name:"FileField",props:{field:{},modelValue:{},error:{},touched:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:i}){const o=t,s=i,n=e.ref(!1),c=e.ref(null),u=e.computed(()=>o.modelValue?Array.isArray(o.modelValue)?o.modelValue:[o.modelValue]:[]),d=e.computed(()=>o.field.multiple??!1);function m(r){if(!r||r.length===0){s("update:modelValue",null);return}s("update:modelValue",d.value?Array.from(r):r[0])}function f(r){m(r.target.files),s("blur")}function k(r){var l;n.value=!1,r.preventDefault(),m(((l=r.dataTransfer)==null?void 0:l.files)??null),s("blur")}function V(r){const l=u.value.filter((p,v)=>v!==r);l.length===0?(s("update:modelValue",null),c.value&&(c.value.value="")):s("update:modelValue",d.value?l:l[0])}function y(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}return(r,l)=>(e.openBlock(),e.createBlock(b,{field:t.field,error:t.error,touched:t.touched},{default:e.withCtx(p=>{var v;return[e.createElementVNode("div",{class:e.normalizeClass(["vfs-pv-dropzone",{"vfs-pv-dropzone--dragging":n.value,"vfs-pv-dropzone--error":t.touched&&((v=t.error)==null?void 0:v.length)}]),onDragover:l[0]||(l[0]=e.withModifiers(a=>n.value=!0,["prevent"])),onDragleave:l[1]||(l[1]=a=>n.value=!1),onDrop:k},[e.createElementVNode("input",e.mergeProps({id:t.field.name,ref_key:"inputRef",ref:c,type:"file",name:t.field.name,accept:t.field.accept,multiple:d.value,disabled:t.field.disabled===!0,required:t.field.required},p,{class:"vfs-pv-dropzone__input",onChange:f}),null,16,ee),e.createElementVNode("div",te,[e.createElementVNode("p",null,e.toDisplayString(n.value?"Drop files here":"Click to upload or drag & drop"),1),t.field.accept?(e.openBlock(),e.createElementBlock("p",le,e.toDisplayString(t.field.accept),1)):e.createCommentVNode("",!0)])],34),u.value.length?(e.openBlock(),e.createElementBlock("ul",oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(a,B)=>(e.openBlock(),e.createElementBlock("li",{key:`${a.name}-${B}`,class:"vfs-pv-filelist__item"},[e.createElementVNode("span",ne,e.toDisplayString(a.name),1),e.createElementVNode("span",re,e.toDisplayString(y(a.size)),1),e.createElementVNode("button",{type:"button","aria-label":`Remove ${a.name}`,class:"vfs-pv-filelist__remove",onClick:pe=>V(B)}," × ",8,ae)]))),128))])):e.createCommentVNode("",!0)]}),_:1},8,["field","error","touched"]))}}),D=M._export_sfc(de,[["__scopeId","data-v-1fed53d8"]]),ie={class:"mb-4"},ue={key:0,class:"mb-2 text-sm font-medium"},ce={class:"flex-1"},P=e.defineComponent({__name:"ArrayField",props:{field:{},form:{},components:{}},setup(t){const i=t,o=g.useRegistry(),s={text:h,email:h,number:$,textarea:C,select:E,checkbox:N,radio:F,date:S};function n(r){var l;return r.component?r.component:((l=i.components)==null?void 0:l[r.type])??o[r.type]??s[r.type]??null}const{rows:c,append:u,remove:d}=g.useFieldArray(i.form,i.field.name);function m(r){return q.getByPath(i.form.values.value,r.name)}function f(r,l){i.form.setField(r.name,l)}function k(r){var p;const l=i.form;(p=l.touchField)==null||p.call(l,r.name)}function V(r){return i.form.errors.value[r.name]??[]}function y(r){return i.form.touched.value[r.name]??!1}return(r,l)=>(e.openBlock(),e.createElementBlock("div",ie,[t.field.label?(e.openBlock(),e.createElementBlock("div",ue,e.toDisplayString(t.field.label),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(c),p=>(e.openBlock(),e.createElementBlock("div",{key:p.key,style:{border:"1px solid var(--p-surface-200, #e2e8f0)"},class:"mb-2 flex items-start gap-2 rounded-md p-3"},[e.createElementVNode("div",ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.fields,v=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:v.name},[n(v)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(v)),{key:0,field:v,"model-value":m(v),error:V(v),touched:y(v),"onUpdate:modelValue":a=>f(v,a),onBlur:a=>k(v)},null,40,["field","model-value","error","touched","onUpdate:modelValue","onBlur"])):e.createCommentVNode("",!0)],64))),128))]),e.createVNode(e.unref(x),{type:"button",label:"Remove",severity:"danger",text:"",size:"small",class:"mt-6",onClick:v=>e.unref(d)(p.index)},null,8,["onClick"])]))),128)),e.createVNode(e.unref(x),{type:"button",label:"+ Add row",severity:"secondary",text:"",size:"small",onClick:l[0]||(l[0]=p=>e.unref(u)())})]))}}),me={key:1,style:{border:"1px solid var(--p-surface-200, #e2e8f0)"},class:"mb-4 rounded-md p-4"},se={key:0,class:"px-1 text-sm font-medium"},fe=e.defineComponent({__name:"PrimeVueFormRenderer",props:{form:{},components:{},submitLabel:{},fields:{}},emits:["submit"],setup(t,{emit:i}){const o=t,s=g.useRegistry(),n=i,c={text:h,email:h,number:$,textarea:C,select:E,checkbox:N,radio:F,date:S,file:D};function u(l){var p;return l.component?l.component:((p=o.components)==null?void 0:p[l.type])??s[l.type]??c[l.type]??null}function d(l){return q.getByPath(o.form.values.value,l.name)}function m(l,p){o.form.setField(l.name,p)}function f(l){var v;const p=o.form;(v=p.touchField)==null||v.call(p,l.name)}function k(l){return o.form.errors.value[l.name]??[]}function V(l){return o.form.touched.value[l.name]??!1}const y=e.computed(()=>(o.fields??o.form.fields.value).filter(l=>l.visible!==!1));async function r(l){l.preventDefault(),await o.form.submit(),n("submit")}return(l,p)=>{const v=e.resolveComponent("PrimeVueFormRenderer",!0);return e.openBlock(),e.createElementBlock("form",{novalidate:"",onSubmit:r},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,a=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a.name},[l.$slots[`field-${a.name}`]?e.renderSlot(l.$slots,`field-${a.name}`,{key:0,field:a,value:d(a),error:k(a),touched:V(a),setValue:B=>m(a,B),touch:()=>f(a)}):a.type==="group"?(e.openBlock(),e.createElementBlock("fieldset",me,[a.label?(e.openBlock(),e.createElementBlock("legend",se,e.toDisplayString(a.label),1)):e.createCommentVNode("",!0),a.fields?(e.openBlock(),e.createBlock(v,{key:1,form:t.form,fields:a.fields,components:t.components},null,8,["form","fields","components"])):e.createCommentVNode("",!0)])):a.type==="array"?(e.openBlock(),e.createBlock(P,{key:2,field:a,form:t.form,components:t.components},null,8,["field","form","components"])):u(a)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u(a)),{key:3,field:a,"model-value":d(a),error:k(a),touched:V(a),"onUpdate:modelValue":B=>m(a,B),onBlur:B=>f(a)},null,40,["field","model-value","error","touched","onUpdate:modelValue","onBlur"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(l.$slots,"submit",{isSubmitting:t.form.isSubmitting.value,isValid:t.form.isValid.value},()=>[e.createVNode(e.unref(x),{type:"submit",label:t.submitLabel??"Submit",disabled:t.form.isSubmitting.value,class:"mt-2"},null,8,["label","disabled"])])],32)}}});exports.PrimeVueFormRenderer=fe;exports.PvArrayField=P;exports.PvCheckboxField=N;exports.PvDateField=S;exports.PvFileField=D;exports.PvNumberField=$;exports.PvRadioField=F;exports.PvSelectField=E;exports.PvTextField=h;exports.PvTextareaField=C;
@@ -0,0 +1,276 @@
1
+ import { Component } from 'vue';
2
+ import { ComponentOptionsMixin } from 'vue';
3
+ import { ComponentProvideOptions } from 'vue';
4
+ import { ComputedRef } from 'vue';
5
+ import { DefineComponent } from 'vue';
6
+ import { PublicProps } from 'vue';
7
+ import { Ref } from 'vue';
8
+
9
+ declare const __VLS_base: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
10
+ submit: () => any;
11
+ }, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onSubmit?: (() => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
14
+
15
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
16
+
17
+ declare const __VLS_export_10: DefineComponent<__VLS_Props_10, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_10> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
18
+
19
+ declare const __VLS_export_2: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
20
+ blur: () => any;
21
+ "update:modelValue": (value: string) => any;
22
+ }, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
23
+ onBlur?: (() => any) | undefined;
24
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
25
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
26
+
27
+ declare const __VLS_export_3: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
28
+ blur: () => any;
29
+ "update:modelValue": (value: number | null) => any;
30
+ }, string, PublicProps, Readonly<__VLS_Props_3> & Readonly<{
31
+ onBlur?: (() => any) | undefined;
32
+ "onUpdate:modelValue"?: ((value: number | null) => any) | undefined;
33
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
34
+
35
+ declare const __VLS_export_4: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
36
+ blur: () => any;
37
+ "update:modelValue": (value: string) => any;
38
+ }, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{
39
+ onBlur?: (() => any) | undefined;
40
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
41
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
42
+
43
+ declare const __VLS_export_5: DefineComponent<__VLS_Props_5, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
44
+ blur: () => any;
45
+ "update:modelValue": (value: unknown) => any;
46
+ }, string, PublicProps, Readonly<__VLS_Props_5> & Readonly<{
47
+ onBlur?: (() => any) | undefined;
48
+ "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
49
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
50
+
51
+ declare const __VLS_export_6: DefineComponent<__VLS_Props_6, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
52
+ blur: () => any;
53
+ "update:modelValue": (value: boolean) => any;
54
+ }, string, PublicProps, Readonly<__VLS_Props_6> & Readonly<{
55
+ onBlur?: (() => any) | undefined;
56
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
57
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
58
+
59
+ declare const __VLS_export_7: DefineComponent<__VLS_Props_7, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
60
+ blur: () => any;
61
+ "update:modelValue": (value: unknown) => any;
62
+ }, string, PublicProps, Readonly<__VLS_Props_7> & Readonly<{
63
+ onBlur?: (() => any) | undefined;
64
+ "onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
65
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
66
+
67
+ declare const __VLS_export_8: DefineComponent<__VLS_Props_8, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
68
+ blur: () => any;
69
+ "update:modelValue": (value: string) => any;
70
+ }, string, PublicProps, Readonly<__VLS_Props_8> & Readonly<{
71
+ onBlur?: (() => any) | undefined;
72
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
73
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
74
+
75
+ declare const __VLS_export_9: DefineComponent<__VLS_Props_9, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
76
+ blur: () => any;
77
+ "update:modelValue": (value: File | File[] | null) => any;
78
+ }, string, PublicProps, Readonly<__VLS_Props_9> & Readonly<{
79
+ onBlur?: (() => any) | undefined;
80
+ "onUpdate:modelValue"?: ((value: File | File[] | null) => any) | undefined;
81
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
82
+
83
+ declare type __VLS_Props = {
84
+ form: UseFormReturn;
85
+ components?: Partial<Record<FieldDefinition['type'], Component | string>>;
86
+ submitLabel?: string;
87
+ /**
88
+ * Internal: the field list to render. Used by the `group` case to recurse
89
+ * into `field.fields` instead of re-rendering the whole top-level schema
90
+ * (which would recurse into the same group forever). Defaults to the
91
+ * form's top-level fields — not meant to be passed by consumers.
92
+ */
93
+ fields?: FieldDefinition[];
94
+ };
95
+
96
+ declare type __VLS_Props_10 = {
97
+ field: FieldDefinition;
98
+ form: UseFormReturn;
99
+ components?: Partial<Record<FieldDefinition['type'], Component | string>>;
100
+ };
101
+
102
+ declare type __VLS_Props_2 = {
103
+ field: FieldDefinition;
104
+ modelValue: string | null;
105
+ error?: string[];
106
+ touched?: boolean;
107
+ };
108
+
109
+ declare type __VLS_Props_3 = {
110
+ field: FieldDefinition;
111
+ modelValue: number | null;
112
+ error?: string[];
113
+ touched?: boolean;
114
+ };
115
+
116
+ declare type __VLS_Props_4 = {
117
+ field: FieldDefinition;
118
+ modelValue: string | null;
119
+ error?: string[];
120
+ touched?: boolean;
121
+ };
122
+
123
+ declare type __VLS_Props_5 = {
124
+ field: FieldDefinition;
125
+ modelValue: unknown;
126
+ error?: string[];
127
+ touched?: boolean;
128
+ };
129
+
130
+ declare type __VLS_Props_6 = {
131
+ field: FieldDefinition;
132
+ modelValue: boolean | null;
133
+ error?: string[];
134
+ touched?: boolean;
135
+ };
136
+
137
+ declare type __VLS_Props_7 = {
138
+ field: FieldDefinition;
139
+ modelValue: unknown;
140
+ error?: string[];
141
+ touched?: boolean;
142
+ };
143
+
144
+ declare type __VLS_Props_8 = {
145
+ field: FieldDefinition;
146
+ modelValue: string | null;
147
+ error?: string[];
148
+ touched?: boolean;
149
+ };
150
+
151
+ declare type __VLS_Props_9 = {
152
+ field: FieldDefinition;
153
+ modelValue: File | File[] | null;
154
+ error?: string[];
155
+ touched?: boolean;
156
+ };
157
+
158
+ declare type __VLS_Slots = {} & {
159
+ [K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
160
+ } & {
161
+ submit?: (props: typeof __VLS_23) => any;
162
+ };
163
+
164
+ declare type __VLS_WithSlots<T, S> = T & {
165
+ new (): {
166
+ $slots: S;
167
+ };
168
+ };
169
+
170
+ declare type AsyncValidatorFn = (value: unknown, values: Record<string, unknown>) => Promise<string | null>;
171
+
172
+ declare interface FieldDefinition {
173
+ type: FieldType;
174
+ /** Dot-path for nested fields, e.g. "address.city" */
175
+ name: string;
176
+ label?: string;
177
+ placeholder?: string;
178
+ defaultValue?: unknown | ((values: Record<string, unknown>) => unknown);
179
+ required?: boolean;
180
+ /** Static or dynamic disabled state */
181
+ disabled?: boolean | ((values: Record<string, unknown>) => boolean);
182
+ /** Static or dynamic visibility; string is evaluated as expression */
183
+ visible?: boolean | string | ((values: Record<string, unknown>) => boolean);
184
+ validators?: ValidatorFn[];
185
+ asyncValidators?: AsyncValidatorFn[];
186
+ mask?: string | MaskConfig;
187
+ /** For select / radio — static list, sync function, or async function */
188
+ options?: FieldOption[] | ((values: Record<string, unknown>) => FieldOption[] | Promise<FieldOption[]>);
189
+ /**
190
+ * Field names whose values trigger re-fetching of async options.
191
+ * Only relevant when `options` is an async function.
192
+ */
193
+ optionsDeps?: string[];
194
+ /** Internal: set by useForm when async options are loading. Read-only for consumers. */
195
+ optionsLoading?: boolean;
196
+ /** For group and array */
197
+ fields?: FieldDefinition[];
198
+ /**
199
+ * Applied on every setField call before the value is stored.
200
+ * Use for trimming, type coercion, formatting, etc.
201
+ */
202
+ transform?: (value: unknown, values: Record<string, unknown>) => unknown;
203
+ /**
204
+ * Applied at submit time to produce the final payload value.
205
+ * Runs after all validation passes.
206
+ */
207
+ parse?: (raw: unknown) => unknown;
208
+ /**
209
+ * Custom Vue component to render this field.
210
+ * Receives FormFieldProps and must emit 'update:modelValue' and 'blur'.
211
+ */
212
+ component?: Component | string;
213
+ /** Accepted file types, e.g. "image/*,.pdf" — passed to <input accept> */
214
+ accept?: string;
215
+ /** Allow selecting multiple files */
216
+ multiple?: boolean;
217
+ /** Maximum file size in bytes */
218
+ maxSize?: number;
219
+ /** Maximum number of files (only relevant when multiple=true) */
220
+ maxFiles?: number;
221
+ }
222
+
223
+ declare interface FieldOption {
224
+ label: string;
225
+ value: unknown;
226
+ }
227
+
228
+ declare type FieldType = 'text' | 'number' | 'email' | 'select' | 'checkbox' | 'radio' | 'textarea' | 'date' | 'array' | 'group' | 'file';
229
+
230
+ declare interface MaskConfig {
231
+ preset?: MaskPreset;
232
+ /** Custom mask pattern: '#' = digit, 'A' = letter, other chars are literals */
233
+ pattern?: string;
234
+ }
235
+
236
+ declare type MaskPreset = 'phone-ru' | 'phone-eu' | 'date' | 'inn' | 'iban';
237
+
238
+ export declare const PrimeVueFormRenderer: typeof __VLS_export;
239
+
240
+ export declare const PvArrayField: typeof __VLS_export_10;
241
+
242
+ export declare const PvCheckboxField: typeof __VLS_export_6;
243
+
244
+ export declare const PvDateField: typeof __VLS_export_8;
245
+
246
+ export declare const PvFileField: typeof __VLS_export_9;
247
+
248
+ export declare const PvNumberField: typeof __VLS_export_3;
249
+
250
+ export declare const PvRadioField: typeof __VLS_export_7;
251
+
252
+ export declare const PvSelectField: typeof __VLS_export_5;
253
+
254
+ export declare const PvTextareaField: typeof __VLS_export_4;
255
+
256
+ export declare const PvTextField: typeof __VLS_export_2;
257
+
258
+ declare interface UseFormReturn<T extends Record<string, unknown> = Record<string, unknown>> {
259
+ fields: ComputedRef<FieldDefinition[]>;
260
+ values: Ref<T>;
261
+ errors: Ref<Record<string, string[]>>;
262
+ touched: Ref<Record<string, boolean>>;
263
+ /** Per-field async options loading state */
264
+ optionsLoading: Ref<Record<string, boolean>>;
265
+ isDirty: ComputedRef<boolean>;
266
+ isValid: ComputedRef<boolean>;
267
+ isSubmitting: Ref<boolean>;
268
+ submit(): Promise<void>;
269
+ reset(values?: Partial<T>): void;
270
+ setField(path: string, value: unknown): void;
271
+ getField(path: string): unknown;
272
+ }
273
+
274
+ declare type ValidatorFn = (value: unknown, values: Record<string, unknown>) => string | null;
275
+
276
+ export { }