@bach.software/vue-dynamic-form 0.5.0 → 0.6.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.
Files changed (41) hide show
  1. package/dist/examples.cjs.js +6 -6
  2. package/dist/examples.cjs.js.map +1 -1
  3. package/dist/examples.es.js +1643 -280
  4. package/dist/examples.es.js.map +1 -1
  5. package/dist/mapEachMetadataItem-Cxfn86Z2.cjs +2 -0
  6. package/dist/mapEachMetadataItem-Cxfn86Z2.cjs.map +1 -0
  7. package/dist/mapEachMetadataItem-Dvf3R5jd.js +1159 -0
  8. package/dist/mapEachMetadataItem-Dvf3R5jd.js.map +1 -0
  9. package/dist/src/components/DynamicFormItemWizard.vue.d.ts +25 -0
  10. package/dist/src/components/DynamicFormTemplate.vue.d.ts +97 -4
  11. package/dist/src/components/__tests__/DynamicFormItem.unmount.logic.test.d.ts +1 -0
  12. package/dist/src/components/__tests__/DynamicFormItemArray.analytics.test.d.ts +1 -0
  13. package/dist/src/components/__tests__/DynamicFormItemArray.test-helpers.d.ts +9 -0
  14. package/dist/src/components/__tests__/DynamicFormItemChoice.analytics.test.d.ts +1 -0
  15. package/dist/src/components/__tests__/DynamicFormItemChoice.test-helpers.d.ts +100 -0
  16. package/dist/src/components/__tests__/DynamicFormItemWizard.analytics.test.d.ts +1 -0
  17. package/dist/src/components/__tests__/DynamicFormItemWizard.logic.test.d.ts +1 -0
  18. package/dist/src/components/__tests__/DynamicFormItemWizard.test-helpers.d.ts +24 -0
  19. package/dist/src/components/__tests__/DynamicFormItemWizard.validation.test.d.ts +1 -0
  20. package/dist/src/components/__tests__/DynamicFormTemplate.test.d.ts +1 -0
  21. package/dist/src/core/validation.d.ts +8 -2
  22. package/dist/src/examples/KeepValuesOnUnmountTestCase.vue.d.ts +2 -0
  23. package/dist/src/examples/TestForm.vue.d.ts +1 -0
  24. package/dist/src/examples/TestFormTemplate.vue.d.ts +48 -13
  25. package/dist/src/examples/__tests__/TestFormTemplate.testcases.d.ts +2317 -7
  26. package/dist/src/examples/index.d.ts +1 -0
  27. package/dist/src/index.d.ts +1 -0
  28. package/dist/src/types/DynamicFormItemProps.d.ts +39 -2
  29. package/dist/src/types/DynamicFormSettings.d.ts +16 -0
  30. package/dist/src/types/FieldMetadata.d.ts +123 -1
  31. package/dist/src/utils/__tests__/deepCloneValue.test.d.ts +1 -0
  32. package/dist/src/utils/__tests__/mapEachMetadataItem.test.d.ts +1 -1
  33. package/dist/src/utils/deepCloneValue.d.ts +10 -0
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/dist/vue-dynamic-form.cjs.js +1 -1
  36. package/dist/vue-dynamic-form.es.js +28 -27
  37. package/package.json +6 -4
  38. package/dist/mapEachMetadataItem-B4xJvJDj.js +0 -732
  39. package/dist/mapEachMetadataItem-B4xJvJDj.js.map +0 -1
  40. package/dist/mapEachMetadataItem-CDDSsb0c.cjs +0 -6
  41. package/dist/mapEachMetadataItem-CDDSsb0c.cjs.map +0 -1
@@ -1,12 +1,12 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),f=require("./mapEachMetadataItem-CDDSsb0c.cjs"),B={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-3"},v={key:1,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-3"},k=e.defineComponent({__name:"IconButton",props:{icon:{},color:{default:"blue"}},emits:["click"],setup(u){return(p,a)=>(e.openBlock(),e.createElementBlock("button",{type:"button",class:e.normalizeClass(["cursor-pointer inline-flex items-center justify-center rounded-full size-5 text-white-800 cursor-pointer",{"bg-blue-200 hover:bg-blue-300":u.color==="blue","bg-red-200 hover:bg-red-300":u.color==="red"}]),onClick:a[0]||(a[0]=b=>p.$emit("click"))},[u.icon==="plus"?(e.openBlock(),e.createElementBlock("svg",B,[...a[1]||(a[1]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 4.5v15m7.5-7.5h-15"},null,-1)])])):e.createCommentVNode("",!0),u.icon==="minus"?(e.openBlock(),e.createElementBlock("svg",v,[...a[2]||(a[2]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"},null,-1)])])):e.createCommentVNode("",!0)],2))}}),N={class:"text-sm whitespace-pre-wrap"},V=["data-testid"],E={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},_={key:0,class:"text-red-500 dark:text-rose-400"},O={key:1,class:"text-sm text-gray-400"},w={class:"grid grid-cols-1 md:grid-cols-2 gap-6 ms-6"},S={class:"text-sm whitespace-pre-wrap"},$=["data-testid"],T=["for"],D={key:0,class:"text-red-500 dark:text-rose-400"},F={key:1,class:"text-sm text-gray-400"},W={class:"text-sm whitespace-pre-wrap"},z=["data-testid"],L=["for"],q={key:0,class:"text-red-500 dark:text-rose-400"},I={key:1,class:"text-sm text-gray-400"},R={class:"flex gap-2 items-center"},A={class:"flex flex-col grow"},U={class:"text-sm whitespace-pre-wrap"},j=["data-testid"],P={key:0,class:"text-red-500 dark:text-rose-400"},G={key:1,class:"text-sm text-gray-400"},H={class:"grid grid-cols-1 md:grid-cols-2 gap-6 ms-6"},J={class:"text-sm whitespace-pre-wrap"},Y=["data-testid"],Q={key:0,class:"text-red-500 dark:text-rose-400"},X={key:1,class:"text-sm text-gray-400"},Z={class:"grid grid-cols-1 md:grid-cols-2 gap-6 ms-6"},K={class:"text-sm whitespace-pre-wrap"},M=["data-testid"],ee=["id","value","disabled","onChange","onBlur"],te=["value"],le=["id","onUpdate:modelValue","disabled","onBlur"],oe=["value"],ne=["id","checked","disabled","onChange","onBlur"],ie=["id","onUpdate:modelValue","disabled","onBlur"],se=["id","onUpdate:modelValue","disabled","onBlur"],ae=["id","value","disabled","onInput","onBlur"],x=e.defineComponent({__name:"TestFormTemplate",setup(u){const p=f.defineMetadata();return(a,b)=>(e.openBlock(),e.createBlock(f._sfc_main$4,{"metadata-configuration":e.unref(p)},{heading:e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:l,label:o},disabled:i,canAddItems:n,addItem:r,canRemoveItems:d,removeItem:c,slotProps:s})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["mt-4",{"md:col-span-2":t.fullWidth}])},[o?(e.openBlock(),e.createElementBlock("h3",{key:0,class:e.normalizeClass(["flex text-xl font-bold gap-2 items-center mb-2",{"text-gray-500":t.disabled||i}])},[e.createTextVNode(e.toDisplayString(o)+" ",1),n?(e.openBlock(),e.createBlock(k,{key:0,icon:"plus",tabindex:"-1","data-testid":`${t.path}-add-button`,onClick:r},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0),d?(e.openBlock(),e.createBlock(k,{key:1,icon:"minus",tabindex:"-1",color:"red","data-testid":`${t.path}-remove-button`,onClick:c},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),e.createElementVNode("pre",N,e.toDisplayString(t.description),1),l.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(l.value),9,V)):e.createCommentVNode("",!0),e.createElementVNode("div",E,[e.renderSlot(a.$slots,"default",{level:(s?.level??0)+1})])],2))]),"heading-array":e.withCtx(()=>[e.renderSlot(a.$slots,"default")]),"default-choice":e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:l,label:o},disabled:i,required:n,slotProps:r,settings:{showOptionalInsteadOfRequired:d}})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex flex-col gap-2",{"md:col-span-2":t.fullWidth}])},[e.createElementVNode("span",{class:e.normalizeClass(["flex gap-2 items-center",{"text-gray-500":i}])},[e.createTextVNode(e.toDisplayString(o)+" ",1),n&&!d?(e.openBlock(),e.createElementBlock("span",_,"*")):e.createCommentVNode("",!0),!n&&d?(e.openBlock(),e.createElementBlock("span",O,"(optional)")):e.createCommentVNode("",!0)],2),e.createElementVNode("div",w,[e.renderSlot(a.$slots,"default",{level:(r?.level??0)+1,belowChoiceField:!0})]),e.createElementVNode("pre",S,e.toDisplayString(t.description),1),l.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(l.value),9,$)):e.createCommentVNode("",!0)],2))]),"default-array":e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:l,label:o},disabled:i,required:n,canAddItems:r,addItem:d,settings:{showOptionalInsteadOfRequired:c}})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex flex-col gap-2",{"md:col-span-2":t.fullWidth}])},[e.createElementVNode("label",{for:`${t.path}[0]`,class:e.normalizeClass([{"text-gray-500":t.disabled||i},"flex gap-2 items-center"])},[e.createTextVNode(e.toDisplayString(o)+" ",1),n&&!c?(e.openBlock(),e.createElementBlock("span",D,"*")):e.createCommentVNode("",!0),!n&&c?(e.openBlock(),e.createElementBlock("span",F,"(optional)")):e.createCommentVNode("",!0),r?(e.openBlock(),e.createBlock(k,{key:2,icon:"plus",tabindex:"-1","data-testid":`${t.path}-add-button`,onClick:d},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0)],10,T),e.renderSlot(a.$slots,"default",{hideLabel:!0}),e.createElementVNode("pre",W,e.toDisplayString(t.description),1),l.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(l.value),9,z)):e.createCommentVNode("",!0)],2))]),default:e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:l,label:o},disabled:i,required:n,canRemoveItems:r,removeItem:d,slotProps:c,settings:{showOptionalInsteadOfRequired:s}})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex flex-col gap-2",{"md:col-span-2":t.fullWidth}])},[c?.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("label",{key:0,for:t.path,class:e.normalizeClass([{"text-gray-500":t.disabled||i},"flex gap-1 items-center"])},[e.createTextVNode(e.toDisplayString(o)+" ",1),n&&!s?(e.openBlock(),e.createElementBlock("span",q,"*")):e.createCommentVNode("",!0),!n&&s?(e.openBlock(),e.createElementBlock("span",I,"(optional)")):e.createCommentVNode("",!0)],10,L)),e.createElementVNode("div",R,[e.createElementVNode("div",A,[e.renderSlot(a.$slots,"default")]),e.createVNode(k,{class:e.normalizeClass({invisible:!r}),icon:"minus",tabindex:"-1",color:"red","data-testid":`${t.path}-remove-button`,onClick:d},null,8,["class","data-testid","onClick"])]),e.createElementVNode("pre",U,e.toDisplayString(t.description),1),l.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(l.value),9,j)):e.createCommentVNode("",!0)],2)),e.renderSlot(a.$slots,"attributes")]),"group-array":e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:l,label:o},disabled:i,required:n,canAddItems:r,addItem:d,slotProps:c,settings:{showOptionalInsteadOfRequired:s}})=>[t.hidden?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[],64)):c?.belowChoiceField?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass({"md:col-span-2":t.fullWidth})},[e.createElementVNode("span",{class:e.normalizeClass(["flex gap-2 items-center mb-2",{"text-gray-500":t.disabled||i}])},[e.createTextVNode(e.toDisplayString(o)+" ",1),n&&!s?(e.openBlock(),e.createElementBlock("span",P,"*")):e.createCommentVNode("",!0),!n&&s?(e.openBlock(),e.createElementBlock("span",G,"(optional)")):e.createCommentVNode("",!0),r?(e.openBlock(),e.createBlock(k,{key:2,icon:"plus",tabindex:"-1","data-testid":`${t.path}-add-button`,onClick:d},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0)],2),e.createElementVNode("div",H,[e.renderSlot(a.$slots,"default",{level:(c?.level??0)+1})]),e.createElementVNode("pre",J,e.toDisplayString(t.description),1),l.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(l.value),9,Y)):e.createCommentVNode("",!0)],2)):e.renderSlot(a.$slots,"default",{key:2})]),group:e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:l,label:o},disabled:i,required:n,canAddItems:r,canRemoveItems:d,addItem:c,removeItem:s,slotProps:m,settings:{showOptionalInsteadOfRequired:h}})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass({"md:col-span-2":t.fullWidth})},[m?.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["flex gap-2 items-center mb-2",{"text-gray-500":t.disabled||i}])},[e.createTextVNode(e.toDisplayString(o)+" ",1),n&&!h?(e.openBlock(),e.createElementBlock("span",Q,"*")):e.createCommentVNode("",!0),!n&&h?(e.openBlock(),e.createElementBlock("span",X,"(optional)")):e.createCommentVNode("",!0),r?(e.openBlock(),e.createBlock(k,{key:2,icon:"plus",tabindex:"-1","data-testid":`${t.path}-add-button`,onClick:c},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0),d?(e.openBlock(),e.createBlock(k,{key:3,icon:"minus",tabindex:"-1","data-testid":`${t.path}-remove-button`,color:"red",onClick:s},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0)],2)),e.createElementVNode("div",Z,[e.renderSlot(a.$slots,"default",{level:(m?.level??0)+1})]),e.createElementVNode("pre",K,e.toDisplayString(t.description),1),l.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(l.value),9,M)):e.createCommentVNode("",!0)],2)),e.renderSlot(a.$slots,"attributes")]),"select-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:l,handleBlur:o,handleChange:i},disabled:n})=>[e.createElementVNode("select",{id:t.path,value:l.value,disabled:t.disabled||n,class:"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onChange:i,onBlur:o},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,({key:r,value:d})=>(e.openBlock(),e.createElementBlock("option",{key:r,value:r},e.toDisplayString(d),9,te))),128))],40,ee)]),"selectBoundByVModel-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:l,handleBlur:o},disabled:i})=>[e.withDirectives(e.createElementVNode("select",{id:t.path,"onUpdate:modelValue":n=>l.value=n,disabled:t.disabled||i,class:"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onBlur:o},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,({key:n,value:r})=>(e.openBlock(),e.createElementBlock("option",{key:n,value:n},e.toDisplayString(r),9,oe))),128))],40,le),[[e.vModelSelect,l.value]])]),"checkbox-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:l,handleBlur:o,handleChange:i},disabled:n})=>[e.createElementVNode("input",{id:t.path,checked:l.value,disabled:t.disabled||n,type:"checkbox",class:"h-6 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onChange:r=>i(r.target.checked),onBlur:o},null,40,ne)]),"checkboxBoundByVModel-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:l,handleBlur:o},disabled:i})=>[e.withDirectives(e.createElementVNode("input",{id:t.path,"onUpdate:modelValue":n=>l.value=n,disabled:t.disabled||i,type:"checkbox",class:"h-6 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onBlur:o},null,40,ie),[[e.vModelCheckbox,l.value]])]),"textBoundByVModel-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:l,handleBlur:o},disabled:i})=>[e.withDirectives(e.createElementVNode("input",{id:t.path,"onUpdate:modelValue":n=>l.value=n,disabled:t.disabled||i,type:"text",class:"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onBlur:o},null,40,se),[[e.vModelText,l.value]])]),"default-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:l,handleBlur:o,handleChange:i},disabled:n})=>[e.createElementVNode("input",{id:t.path,value:l.value,disabled:t.disabled||n,type:"text",class:"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onInput:i,onBlur:o},null,40,ae)]),_:3},8,["metadata-configuration"]))}}),re={class:"flex justify-end gap-2"},de={key:1,type:"submit",class:"cursor-pointer mt-4 bg-blue-500 text-white px-4 py-2 rounded","data-testid":"submit"},ce={key:0,"data-testid":"errors",class:"col-12 text-red-600"},ue=["innerHTML"],me={key:1,"data-testid":"isSubmitted"},pe={key:2,class:"bg-gray-100 p-4 rounded-lg text-sm overflow-auto"},he=e.defineComponent({__name:"TestForm",props:{metadata:{},settings:{},showDebugState:{type:Boolean,default:!1},initialEdit:{type:Boolean,default:!0},hideFieldsWithoutValue:{type:Boolean,default:!1},initialValues:{}},setup(u){const{values:p,handleSubmit:a,errors:b,meta:t}=f.useDynamicForm({initialValues:u.initialValues}),l=e.ref(),o=e.ref(u.initialEdit),i=e.ref(!1),n=e.computed(()=>u.metadata?.map(c=>f.mapEachMetadataItem(c,s=>(s.computedProps=s.computedProps??[],s.computedProps.push(m=>{o.value||(m.disabled=!0)}),u.hideFieldsWithoutValue&&(s.computedProps.push((m,h)=>{!o.value&&!f.checkTreeHasValue(h.value)&&(m.hidden=!0)}),s.computedProps.push((m,h,y)=>{!o.value&&y.value.length>0&&y.value.every(C=>C.hidden)&&(m.hidden=!0)})),s)))),r=e.computed(()=>({analytics:!0,messages:{required:"{field} is required",minOccurs:"At least {min} items required",choiceMinOccurs:"The following fields need to occur at least {min} time(s): {field}",minLength:"The minimum length of {field} is {length}",maxLength:"The maximum length of {field} is {length}",length:"{field} must be exactly {length} characters",pattern:"{field} does not match the required pattern",minInclusive:"{field} must be at least {min}",maxInclusive:"{field} must be at most {max}",minExclusive:"{field} must be greater than {min}",maxExclusive:"{field} must be less than {max}",enumeration:"{field} must be one of the allowed values",whiteSpace:"{field} contains invalid whitespace (mode: {mode})",fractionDigits:"{field} may have at most {digits} decimal place(s)",totalDigits:"{field} may have at most {digits} significant digit(s)"},...u.settings??{}}));function d(c){a(s=>{i.value=!0,o.value=!1},({errors:s})=>{i.value=!1})(c)}return(c,s)=>(e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(d,["prevent"])},[e.createElementVNode("div",re,[o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"cursor-pointer mt-4 bg-blue-500 text-white px-4 py-2 rounded","data-testid":"submit",onClick:s[0]||(s[0]=m=>o.value=!0)}," Edit ")),o.value?(e.openBlock(),e.createElementBlock("button",de," Submit ")):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"cursor-pointer mt-4 bg-gray-200 text-black px-4 py-2 rounded","data-testid":"cancel",onClick:s[1]||(s[1]=m=>o.value=!1)}," Cancel ")):e.createCommentVNode("",!0)]),Object.values(e.unref(b)).length?(e.openBlock(),e.createElementBlock("div",ce,[s[3]||(s[3]=e.createTextVNode(" Errors: ",-1)),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),(m,h)=>(e.openBlock(),e.createElementBlock("li",{key:h},[e.createElementVNode("span",{innerHTML:m},null,8,ue)]))),128))])])):e.createCommentVNode("",!0),e.createVNode(f._sfc_main,{template:x,metadata:n.value,settings:r.value,"onUpdate:modelValue":s[2]||(s[2]=m=>l.value=m)},null,8,["metadata","settings"]),i.value?(e.openBlock(),e.createElementBlock("span",me)):e.createCommentVNode("",!0),u.showDebugState?(e.openBlock(),e.createElementBlock("pre",pe,"IsDirty: "+e.toDisplayString(e.unref(t).dirty)+`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),v=require("./mapEachMetadataItem-Cxfn86Z2.cjs"),E={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-3"},_={key:1,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-3"},g=e.defineComponent({__name:"IconButton",props:{icon:{},color:{default:"blue"}},emits:["click"],setup(r){return(m,o)=>(e.openBlock(),e.createElementBlock("button",{type:"button",class:e.normalizeClass(["cursor-pointer inline-flex items-center justify-center rounded-full size-5 text-white-800 cursor-pointer",{"bg-blue-200 hover:bg-blue-300":r.color==="blue","bg-red-200 hover:bg-red-300":r.color==="red"}]),onClick:o[0]||(o[0]=s=>m.$emit("click"))},[r.icon==="plus"?(e.openBlock(),e.createElementBlock("svg",E,[...o[1]||(o[1]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 4.5v15m7.5-7.5h-15"},null,-1)])])):e.createCommentVNode("",!0),r.icon==="minus"?(e.openBlock(),e.createElementBlock("svg",_,[...o[2]||(o[2]=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"},null,-1)])])):e.createCommentVNode("",!0)],2))}}),W=["data-testid","onClick"],F={class:"text-sm whitespace-pre-wrap"},A=["data-testid"],z={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},$={key:0,class:"text-red-500 dark:text-rose-400"},D={key:1,class:"text-sm text-gray-400"},P=["data-testid"],L={key:0,class:"flex gap-2 flex-wrap"},q=["disabled","data-testid","onClick"],I=["data-testid","onClick"],R={class:"grid grid-cols-1 md:grid-cols-2 gap-6 ms-6"},U={class:"text-sm whitespace-pre-wrap"},J=["data-testid"],G={key:0,class:"text-red-500 dark:text-rose-400"},j={key:1,class:"text-sm text-gray-400"},H=["data-testid"],K={key:0,class:"flex gap-2 flex-wrap"},Q=["disabled","data-testid","onClick"],Y=["data-testid","onClick"],Z={class:"grid grid-cols-1 md:grid-cols-2 gap-6 ms-6"},X={class:"text-sm whitespace-pre-wrap"},M=["data-testid"],ee={class:"flex gap-2 items-center"},te=["data-testid"],ae=["data-testid"],le=["data-testid"],ie={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},ne={class:"flex flex-col gap-2"},oe={class:"flex gap-2 flex-wrap"},se=["data-testid","onClick"],re={class:"flex gap-2"},de=["data-testid","onClick"],ce=["data-testid","onClick"],pe=["data-testid"],me={class:"grid grid-cols-1 md:grid-cols-2 gap-6 ms-6"},ue=["data-testid"],he=["data-testid"],be=["data-testid"],fe=["data-testid"],Oe=["data-testid"],ge=["data-testid"],ye=["data-testid"],xe=["data-testid","data-current"],ve=["data-testid","data-current"],ke=["for"],Ce={key:0,class:"text-red-500 dark:text-rose-400"},Ve={key:1,class:"text-sm text-gray-400"},we={class:"text-sm whitespace-pre-wrap"},Se=["data-testid"],Be=["for"],Ne={key:0,class:"text-red-500 dark:text-rose-400"},Te={key:1,class:"text-sm text-gray-400"},Ee={class:"flex gap-2 items-center"},_e={class:"flex flex-col grow"},We={class:"text-sm whitespace-pre-wrap"},Fe=["data-testid"],Ae={key:0,class:"text-red-500 dark:text-rose-400"},ze={key:1,class:"text-sm text-gray-400"},$e={class:"grid grid-cols-1 md:grid-cols-2 gap-6 ms-6"},De={class:"text-sm whitespace-pre-wrap"},Pe=["data-testid"],Le={key:0,class:"text-red-500 dark:text-rose-400"},qe={key:1,class:"text-sm text-gray-400"},Ie={class:"grid grid-cols-1 md:grid-cols-2 gap-6 ms-6"},Re={class:"text-sm whitespace-pre-wrap"},Ue=["data-testid"],Je=["id","value","disabled","onChange","onBlur"],Ge=["value"],je=["id","onUpdate:modelValue","disabled","onBlur"],He=["value"],Ke=["id","checked","disabled","onChange","onBlur"],Qe=["id","onUpdate:modelValue","disabled","onBlur"],Ye=["id","onUpdate:modelValue","disabled","onBlur"],Ze=["id","value","disabled","onInput","onBlur"],x="inline-flex items-center h-9 px-3 text-sm border border-gray-300 rounded bg-gray-100 text-gray-900 cursor-pointer hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",Xe="inline-flex items-center h-9 px-3 text-sm border border-blue-600 rounded bg-blue-600 text-white cursor-pointer hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",S=e.defineComponent({__name:"TestFormTemplate",setup(r){const m=v.defineMetadata();return(o,s)=>(e.openBlock(),e.createBlock(v._sfc_main$5,{"metadata-configuration":e.unref(m)},{heading:e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:a,label:l},disabled:n,canAddItems:i,addItem:p,canRemoveItems:b,removeItem:h,slotProps:d})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["mt-4",{"md:col-span-2":t.fullWidth}])},[l?(e.openBlock(),e.createElementBlock("h3",{key:0,class:e.normalizeClass(["flex text-xl font-bold gap-2 items-center mb-2",{"text-gray-500":t.disabled||n}])},[e.createTextVNode(e.toDisplayString(l)+" ",1),i?(e.openBlock(),e.createBlock(g,{key:0,icon:"plus",tabindex:"-1","data-testid":`${t.path}-add-button`,onClick:p},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0),b?(e.openBlock(),e.createBlock(g,{key:1,icon:"minus",tabindex:"-1",color:"red","data-testid":`${t.path}-remove-button`,onClick:h},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0),d?.gotoStep?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button","data-testid":`${t.path}-goto-first-step-button`,onClick:f=>d.gotoStep(0)}," back to start ",8,W)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),e.createElementVNode("pre",F,e.toDisplayString(t.description),1),a.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(a.value),9,A)):e.createCommentVNode("",!0),e.createElementVNode("div",z,[e.renderSlot(o.$slots,"default",{level:(d?.level??0)+1})])],2))]),"heading-array":e.withCtx(({fieldMetadata:t,fieldContext:{label:a},disabled:l,canAddItems:n,addItem:i,slotProps:p})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["mt-4 flex flex-col gap-2",{"md:col-span-2":t.fullWidth}])},[a?(e.openBlock(),e.createElementBlock("h3",{key:0,class:e.normalizeClass(["flex text-xl font-bold gap-2 items-center",{"text-gray-500":t.disabled||l}])},[e.createTextVNode(e.toDisplayString(a)+" ",1),n?(e.openBlock(),e.createBlock(g,{key:0,icon:"plus",tabindex:"-1","data-testid":`${t.path}-add-button`,onClick:i},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"default",{hideLabel:!0,level:(p?.level??0)+1})],2))]),"default-choice":e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:a,label:l},disabled:n,required:i,slotProps:p,settings:{showOptionalInsteadOfRequired:b},addChoiceOccurrence:h,removeChoiceOccurrence:d,canAddChoiceOccurrence:f,usedChoiceOccurrences:O})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex flex-col gap-2",{"md:col-span-2":t.fullWidth}])},[e.createElementVNode("span",{class:e.normalizeClass(["flex gap-2 items-center",{"text-gray-500":n}])},[e.createTextVNode(e.toDisplayString(l)+" ",1),i&&!b?(e.openBlock(),e.createElementBlock("span",$,"*")):e.createCommentVNode("",!0),!i&&b?(e.openBlock(),e.createElementBlock("span",D,"(optional)")):e.createCommentVNode("",!0)],2),e.createElementVNode("div",null,[s[0]||(s[0]=e.createTextVNode("Used choice occurrences: ",-1)),e.createElementVNode("span",{"data-testid":`${t.path}-used-choice-occurrences`},e.toDisplayString(O),9,P)]),t.choice?.length?(e.openBlock(),e.createElementBlock("div",L,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.choice,u=>(e.openBlock(),e.createElementBlock("button",{key:`${u.name}-add`,type:"button",class:e.normalizeClass(x),disabled:!f(u.name),"data-testid":`${t.path}.${u.name}-add-choice-button`,onClick:y=>h(u.name)}," Add "+e.toDisplayString(u.name),9,q))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.choice,u=>(e.openBlock(),e.createElementBlock("button",{key:`${u.name}-remove`,type:"button",class:e.normalizeClass(x),"data-testid":`${t.path}.${u.name}-remove-choice-button`,onClick:y=>d(u.name)}," Remove "+e.toDisplayString(u.name),9,I))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",R,[e.renderSlot(o.$slots,"default",{level:(p?.level??0)+1,belowChoiceField:!0})]),e.createElementVNode("pre",U,e.toDisplayString(t.description),1),a.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(a.value),9,J)):e.createCommentVNode("",!0)],2))]),"default-choice-array":e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:a,label:l},disabled:n,required:i,slotProps:p,settings:{showOptionalInsteadOfRequired:b},addChoiceOccurrence:h,removeChoiceOccurrence:d,canAddChoiceOccurrence:f,usedChoiceOccurrences:O})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex flex-col gap-2",{"md:col-span-2":t.fullWidth}])},[e.createElementVNode("span",{class:e.normalizeClass(["flex gap-2 items-center",{"text-gray-500":n}])},[e.createTextVNode(e.toDisplayString(l)+" ",1),i&&!b?(e.openBlock(),e.createElementBlock("span",G,"*")):e.createCommentVNode("",!0),!i&&b?(e.openBlock(),e.createElementBlock("span",j,"(optional)")):e.createCommentVNode("",!0)],2),e.createElementVNode("div",null,[s[1]||(s[1]=e.createTextVNode("Used choice occurrences: ",-1)),e.createElementVNode("span",{"data-testid":`${t.path}-used-choice-occurrences`},e.toDisplayString(O),9,H)]),t.choice?.length?(e.openBlock(),e.createElementBlock("div",K,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.choice,u=>(e.openBlock(),e.createElementBlock("button",{key:`${u.name}-add`,type:"button",class:e.normalizeClass(x),disabled:!f(u.name),"data-testid":`${t.path}.${u.name}-add-choice-button`,onClick:y=>h(u.name)}," Add "+e.toDisplayString(u.name),9,Q))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.choice,u=>(e.openBlock(),e.createElementBlock("button",{key:`${u.name}-remove`,type:"button",class:e.normalizeClass(x),"data-testid":`${t.path}.${u.name}-remove-choice-button`,onClick:y=>d(u.name)}," Remove "+e.toDisplayString(u.name),9,Y))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",Z,[e.renderSlot(o.$slots,"default",{level:(p?.level??0)+1,belowChoiceField:!0})]),e.createElementVNode("pre",X,e.toDisplayString(t.description),1),a.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(a.value),9,M)):e.createCommentVNode("",!0)],2))]),"default-choice-array-item":e.withCtx(({fieldMetadata:t,slotProps:a,branchKey:l,globalIndex:n,insertionOrder:i,canAddItems:p,addItem:b,removeItem:h})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex flex-col gap-2 border-s-2 ps-2",{"md:col-span-2":t.fullWidth}])},[e.createElementVNode("div",ee,[e.createElementVNode("span",{"data-testid":`${t.path}-kind-badge`},e.toDisplayString(l),9,te),s[2]||(s[2]=e.createTextVNode(" globalIndex: ",-1)),e.createElementVNode("span",{"data-testid":`${t.path}-global-index`},e.toDisplayString(n),9,ae),s[3]||(s[3]=e.createTextVNode(" insertionOrder: ",-1)),i!==void 0?(e.openBlock(),e.createElementBlock("span",{key:0,"data-testid":`${t.path}-insertion-order`},e.toDisplayString(i),9,le)):e.createCommentVNode("",!0),p?(e.openBlock(),e.createBlock(g,{key:1,icon:"plus",tabindex:"-1","data-testid":`${t.path}-add-choice-button`,onClick:b},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0),e.createVNode(g,{icon:"minus",tabindex:"-1",color:"red","data-testid":`${t.path}-remove-choice-button`,onClick:h},null,8,["data-testid","onClick"])]),e.createElementVNode("div",ie,[e.renderSlot(o.$slots,"default",{level:(a?.level??0)+1})])],2))]),"default-wizard":e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:a,label:l},pages:n,currentStepIndex:i,pageCount:p,isFirst:b,isLast:h,isValidating:d,wizardConfig:f,next:O,prev:u,gotoStep:y,slotProps:T})=>[e.createElementVNode("div",ne,[e.createElementVNode("span",null,e.toDisplayString(l),1),e.createElementVNode("div",oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n,(V,w)=>(e.openBlock(),e.createElementBlock("button",{key:V.path,type:"button",class:e.normalizeClass(x),"data-testid":`${t.path}-goto-${w}-button`,onClick:Va=>y(w)},e.toDisplayString(V.name),9,se))),128))]),e.createElementVNode("div",re,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(x),"data-testid":`${t.path}-prev-button`,onClick:u}," Previous ",8,de),e.createElementVNode("button",{type:"button",class:e.normalizeClass(Xe),"data-testid":`${t.path}-next-button`,onClick:O}," Next ",8,ce)]),a.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(a.value),9,pe)):e.createCommentVNode("",!0),e.createElementVNode("div",me,[e.renderSlot(o.$slots,"default",{level:(T?.level??0)+1})]),e.createElementVNode("div",null,[s[4]||(s[4]=e.createTextVNode("currentStepIndex: ",-1)),e.createElementVNode("span",{"data-testid":`${t.path}-currentStepIndex`},e.toDisplayString(i),9,ue)]),e.createElementVNode("div",null,[s[5]||(s[5]=e.createTextVNode("pageCount: ",-1)),e.createElementVNode("span",{"data-testid":`${t.path}-pageCount`},e.toDisplayString(p),9,he)]),e.createElementVNode("div",null,[s[6]||(s[6]=e.createTextVNode("isFirst: ",-1)),e.createElementVNode("span",{"data-testid":`${t.path}-isFirst`},e.toDisplayString(b),9,be)]),e.createElementVNode("div",null,[s[7]||(s[7]=e.createTextVNode("isLast: ",-1)),e.createElementVNode("span",{"data-testid":`${t.path}-isLast`},e.toDisplayString(h),9,fe)]),e.createElementVNode("div",null,[s[8]||(s[8]=e.createTextVNode("isValidating: ",-1)),e.createElementVNode("span",{"data-testid":`${t.path}-isValidating`},e.toDisplayString(d),9,Oe)]),e.createElementVNode("div",null,[s[9]||(s[9]=e.createTextVNode("allowForwardJump: ",-1)),e.createElementVNode("span",{"data-testid":`${t.path}-wizardConfig-allowForwardJump`},e.toDisplayString(f.allowForwardJump),9,ge)]),e.createElementVNode("div",null,[s[10]||(s[10]=e.createTextVNode("validateOnJump: ",-1)),e.createElementVNode("span",{"data-testid":`${t.path}-wizardConfig-validateOnJump`},e.toDisplayString(f.validateOnJump),9,ye)])])]),"default-wizard-page":e.withCtx(({fieldMetadata:t,isCurrent:a,gotoStep:l,slotProps:n,settings:{wizardPageUseVIf:i}})=>[i?a?(e.openBlock(),e.createElementBlock("div",{key:1,"data-testid":`${t.path}-page`,"data-current":a},[e.renderSlot(o.$slots,"default",{gotoStep:l,level:n?.level})],8,ve)):e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:0,"data-testid":`${t.path}-page`,"data-current":a},[e.renderSlot(o.$slots,"default",{gotoStep:l,level:n?.level})],8,xe)),[[e.vShow,a]])]),"default-array":e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:a,label:l},disabled:n,required:i,canAddItems:p,addItem:b,settings:{showOptionalInsteadOfRequired:h}})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex flex-col gap-2",{"md:col-span-2":t.fullWidth}])},[e.createElementVNode("label",{for:`${t.path}[0]`,class:e.normalizeClass([{"text-gray-500":t.disabled||n},"flex gap-2 items-center"])},[e.createTextVNode(e.toDisplayString(l)+" ",1),i&&!h?(e.openBlock(),e.createElementBlock("span",Ce,"*")):e.createCommentVNode("",!0),!i&&h?(e.openBlock(),e.createElementBlock("span",Ve,"(optional)")):e.createCommentVNode("",!0),p?(e.openBlock(),e.createBlock(g,{key:2,icon:"plus",tabindex:"-1","data-testid":`${t.path}-add-button`,onClick:b},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0)],10,ke),e.renderSlot(o.$slots,"default",{hideLabel:!0}),e.createElementVNode("pre",we,e.toDisplayString(t.description),1),a.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(a.value),9,Se)):e.createCommentVNode("",!0)],2))]),default:e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:a,label:l},disabled:n,required:i,canRemoveItems:p,removeItem:b,slotProps:h,settings:{showOptionalInsteadOfRequired:d}})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex flex-col gap-2",{"md:col-span-2":t.fullWidth}])},[h?.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("label",{key:0,for:t.path,class:e.normalizeClass([{"text-gray-500":t.disabled||n},"flex gap-1 items-center"])},[e.createTextVNode(e.toDisplayString(l)+" ",1),i&&!d?(e.openBlock(),e.createElementBlock("span",Ne,"*")):e.createCommentVNode("",!0),!i&&d?(e.openBlock(),e.createElementBlock("span",Te,"(optional)")):e.createCommentVNode("",!0)],10,Be)),e.createElementVNode("div",Ee,[e.createElementVNode("div",_e,[e.renderSlot(o.$slots,"default")]),e.createVNode(g,{class:e.normalizeClass({invisible:!p}),icon:"minus",tabindex:"-1",color:"red","data-testid":`${t.path}-remove-button`,onClick:b},null,8,["class","data-testid","onClick"])]),e.createElementVNode("pre",We,e.toDisplayString(t.description),1),a.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(a.value),9,Fe)):e.createCommentVNode("",!0)],2)),e.renderSlot(o.$slots,"attributes")]),"group-array":e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:a,label:l},disabled:n,required:i,canAddItems:p,addItem:b,slotProps:h,settings:{showOptionalInsteadOfRequired:d}})=>[t.hidden?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[],64)):h?.belowChoiceField?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass({"md:col-span-2":t.fullWidth})},[e.createElementVNode("span",{class:e.normalizeClass(["flex gap-2 items-center mb-2",{"text-gray-500":t.disabled||n}])},[e.createTextVNode(e.toDisplayString(l)+" ",1),i&&!d?(e.openBlock(),e.createElementBlock("span",Ae,"*")):e.createCommentVNode("",!0),!i&&d?(e.openBlock(),e.createElementBlock("span",ze,"(optional)")):e.createCommentVNode("",!0),p?(e.openBlock(),e.createBlock(g,{key:2,icon:"plus",tabindex:"-1","data-testid":`${t.path}-add-button`,onClick:b},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0)],2),e.createElementVNode("div",$e,[e.renderSlot(o.$slots,"default",{level:(h?.level??0)+1})]),e.createElementVNode("pre",De,e.toDisplayString(t.description),1),a.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(a.value),9,Pe)):e.createCommentVNode("",!0)],2)):e.renderSlot(o.$slots,"default",{key:2})]),group:e.withCtx(({fieldMetadata:t,fieldContext:{errorMessage:a,label:l},disabled:n,required:i,canAddItems:p,canRemoveItems:b,addItem:h,removeItem:d,slotProps:f,settings:{showOptionalInsteadOfRequired:O}})=>[t.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass({"md:col-span-2":t.fullWidth})},[f?.hideLabel?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["flex gap-2 items-center mb-2",{"text-gray-500":t.disabled||n}])},[e.createTextVNode(e.toDisplayString(l)+" ",1),i&&!O?(e.openBlock(),e.createElementBlock("span",Le,"*")):e.createCommentVNode("",!0),!i&&O?(e.openBlock(),e.createElementBlock("span",qe,"(optional)")):e.createCommentVNode("",!0),p?(e.openBlock(),e.createBlock(g,{key:2,icon:"plus",tabindex:"-1","data-testid":`${t.path}-add-button`,onClick:h},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0),b?(e.openBlock(),e.createBlock(g,{key:3,icon:"minus",tabindex:"-1","data-testid":`${t.path}-remove-button`,color:"red",onClick:d},null,8,["data-testid","onClick"])):e.createCommentVNode("",!0)],2)),e.createElementVNode("div",Ie,[e.renderSlot(o.$slots,"default",{level:(f?.level??0)+1})]),e.createElementVNode("pre",Re,e.toDisplayString(t.description),1),a.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-red-600 text-sm","data-testid":`${t.path}-error-message`},e.toDisplayString(a.value),9,Ue)):e.createCommentVNode("",!0)],2)),e.renderSlot(o.$slots,"attributes")]),"select-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:a,handleBlur:l,handleChange:n},disabled:i})=>[e.createElementVNode("select",{id:t.path,value:a.value,disabled:t.disabled||i,class:"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onChange:n,onBlur:l},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,({key:p,value:b})=>(e.openBlock(),e.createElementBlock("option",{key:p,value:p},e.toDisplayString(b),9,Ge))),128))],40,Je)]),"selectBoundByVModel-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:a,handleBlur:l},disabled:n})=>[e.withDirectives(e.createElementVNode("select",{id:t.path,"onUpdate:modelValue":i=>a.value=i,disabled:t.disabled||n,class:"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onBlur:l},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,({key:i,value:p})=>(e.openBlock(),e.createElementBlock("option",{key:i,value:i},e.toDisplayString(p),9,He))),128))],40,je),[[e.vModelSelect,a.value]])]),"checkbox-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:a,handleBlur:l,handleChange:n},disabled:i})=>[e.createElementVNode("input",{id:t.path,checked:a.value,disabled:t.disabled||i,type:"checkbox",class:"h-6 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onChange:p=>n(p.target.checked),onBlur:l},null,40,Ke)]),"checkboxBoundByVModel-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:a,handleBlur:l},disabled:n})=>[e.withDirectives(e.createElementVNode("input",{id:t.path,"onUpdate:modelValue":i=>a.value=i,disabled:t.disabled||n,type:"checkbox",class:"h-6 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onBlur:l},null,40,Qe),[[e.vModelCheckbox,a.value]])]),"textBoundByVModel-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:a,handleBlur:l},disabled:n})=>[e.withDirectives(e.createElementVNode("input",{id:t.path,"onUpdate:modelValue":i=>a.value=i,disabled:t.disabled||n,type:"text",class:"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onBlur:l},null,40,Ye),[[e.vModelText,a.value]])]),"default-input":e.withCtx(({fieldMetadata:t,fieldContext:{value:a,handleBlur:l,handleChange:n},disabled:i})=>[e.createElementVNode("input",{id:t.path,value:a.value,disabled:t.disabled||i,type:"text",class:"h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",onInput:n,onBlur:l},null,40,Ze)]),_:3},8,["metadata-configuration"]))}}),Me={class:"flex justify-end gap-2"},et={key:1,type:"submit",class:"cursor-pointer mt-4 bg-blue-500 text-white px-4 py-2 rounded","data-testid":"submit"},tt={key:0,"data-testid":"errors",class:"col-12 text-red-600"},at=["innerHTML"],lt={key:1,"data-testid":"isSubmitted"},it={key:2,class:"bg-gray-100 p-4 rounded-lg text-sm overflow-auto"},B=e.defineComponent({__name:"TestForm",props:{metadata:{},settings:{},showDebugState:{type:Boolean,default:!1},initialEdit:{type:Boolean,default:!0},hideFieldsWithoutValue:{type:Boolean,default:!1},initialValues:{},keepValuesOnUnmount:{type:Boolean}},setup(r){const{values:m,handleSubmit:o,errors:s,meta:t}=v.useDynamicForm({initialValues:r.initialValues,keepValuesOnUnmount:e.computed(()=>r.keepValuesOnUnmount)}),a=e.ref(),l=e.ref(r.initialEdit),n=e.ref(!1),i=e.computed(()=>r.metadata?.map(h=>v.mapEachMetadataItem(h,d=>(d.computedProps=d.computedProps??[],d.computedProps.push(f=>{l.value||(f.disabled=!0)}),r.hideFieldsWithoutValue&&(d.computedProps.push((f,O)=>{!l.value&&!v.checkTreeHasValue(O.value)&&(f.hidden=!0)}),d.computedProps.push((f,O,u)=>{!l.value&&u.value.length>0&&u.value.every(y=>y.hidden)&&(f.hidden=!0)})),d)))),p=e.computed(()=>({analytics:!0,messages:{required:"{field} is required",minOccurs:"At least {min} items required",maxOccurs:"At most {max} items allowed",choiceMinOccurs:"The following fields need to occur at least {min} time(s): {field}",choiceMaxOccurs:"The following fields may occur at most {max} time(s): {field}",maxOccursTotal:"This branch may occur at most {max} time(s) in total: {field}",minLength:"The minimum length of {field} is {length}",maxLength:"The maximum length of {field} is {length}",length:"{field} must be exactly {length} characters",pattern:"{field} does not match the required pattern",minInclusive:"{field} must be at least {min}",maxInclusive:"{field} must be at most {max}",minExclusive:"{field} must be greater than {min}",maxExclusive:"{field} must be less than {max}",enumeration:"{field} must be one of the allowed values",whiteSpace:"{field} contains invalid whitespace (mode: {mode})",fractionDigits:"{field} may have at most {digits} decimal place(s)",totalDigits:"{field} may have at most {digits} significant digit(s)"},...r.settings??{}}));function b(h){o(d=>{n.value=!0,l.value=!1},({errors:d})=>{n.value=!1})(h)}return(h,d)=>(e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(b,["prevent"])},[e.createElementVNode("div",Me,[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"cursor-pointer mt-4 bg-blue-500 text-white px-4 py-2 rounded","data-testid":"submit",onClick:d[0]||(d[0]=f=>l.value=!0)}," Edit ")),l.value?(e.openBlock(),e.createElementBlock("button",et," Submit ")):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"cursor-pointer mt-4 bg-gray-200 text-black px-4 py-2 rounded","data-testid":"cancel",onClick:d[1]||(d[1]=f=>l.value=!1)}," Cancel ")):e.createCommentVNode("",!0)]),Object.values(e.unref(s)).length?(e.openBlock(),e.createElementBlock("div",tt,[d[3]||(d[3]=e.createTextVNode(" Errors: ",-1)),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),(f,O)=>(e.openBlock(),e.createElementBlock("li",{key:O},[e.createElementVNode("span",{innerHTML:f},null,8,at)]))),128))])])):e.createCommentVNode("",!0),e.createVNode(v._sfc_main,{template:S,metadata:i.value,settings:p.value,"onUpdate:modelValue":d[2]||(d[2]=f=>a.value=f)},null,8,["metadata","settings"]),n.value?(e.openBlock(),e.createElementBlock("span",lt)):e.createCommentVNode("",!0),r.showDebugState?(e.openBlock(),e.createElementBlock("pre",it,"IsDirty: "+e.toDisplayString(e.unref(t).dirty)+`
2
2
  Pending: `+e.toDisplayString(e.unref(t).pending)+`
3
3
  Touched: `+e.toDisplayString(e.unref(t).touched)+`
4
4
  Valid: `+e.toDisplayString(e.unref(t).valid)+`
5
- Submitted: `+e.toDisplayString(i.value)+`
5
+ Submitted: `+e.toDisplayString(n.value)+`
6
6
 
7
7
  // form values:
8
- `+e.toDisplayString(JSON.stringify(e.unref(p),null,2))+`
9
- `,1)):e.createCommentVNode("",!0)],32))}}),ke=g([{name:"text",type:"text",fieldOptions:{label:"Text Input"},path:"with.custom.structure",restriction:{maxLength:10}}]),ge=g([{fieldOptions:{label:"Array Fields"},type:"heading",children:[{fieldOptions:{label:"Optional field (max 3)"},minOccurs:0,maxOccurs:3},{fieldOptions:{label:"Required field (max 3)"},maxOccurs:3},{fieldOptions:{label:"2 Fields required"},minOccurs:2,maxOccurs:4},{fieldOptions:{label:"Section (2 sections required)"},type:"heading",minOccurs:2,maxOccurs:4,fullWidth:!0,children:[{fieldOptions:{label:"Nested field 1"}},{fieldOptions:{label:"Required Nested field 2"},type:"select",options:[{key:"option1",value:"Option 1"},{key:"option2",value:"Option 2"},{key:"option3",value:"Option 3"}]},{fieldOptions:{label:"Nested field 3"},type:"checkbox"}]}]}]),fe=g([{fieldOptions:{label:"Grouped Fields"},type:"heading",children:[{fieldOptions:{label:"Required group"},type:"group",children:[{fieldOptions:{label:"Required Nested field 1"},fullWidth:!0},{fieldOptions:{label:"Required Nested field 2"},fullWidth:!0}]},{fieldOptions:{label:"Optional group"},type:"group",minOccurs:0,description:`The group is optional, therefore the children will only be required once 1 value is filled in.
10
-
11
- You can test it by filling in one of the fields.`,children:[{fieldOptions:{label:"Required Nested field 1"},fullWidth:!0},{fieldOptions:{label:"Required Nested field 2"},fullWidth:!0}]}]},{fieldOptions:{label:"Grouped Array Fields"},type:"heading",children:[{fieldOptions:{label:"Required group"},type:"group",maxOccurs:5,fullWidth:!0,children:[{fieldOptions:{label:"Required Nested field 1"}},{fieldOptions:{label:"Required Nested field 2"}}]},{fieldOptions:{label:"Optional group"},type:"group",minOccurs:0,maxOccurs:5,fullWidth:!0,children:[{fieldOptions:{label:"Required Nested field 1"}},{fieldOptions:{label:"Required Nested field 2"}}]}]}]),be=g([{fieldOptions:{label:"Choice Fields (minOccurs 1, maxOccurs 1)"},type:"heading",children:[{fieldOptions:{label:"Simple Choice Field"},fullWidth:!0,description:"In a choice field, only 1 of the fields can be filled in.",choice:[{fieldOptions:{label:"Nested Field 1"}},{fieldOptions:{label:"Nested Field 2"}}]}]},{fieldOptions:{label:"Choice Grouped Fields (minOccurs 1, maxOccurs 3)"},type:"heading",children:[{fieldOptions:{label:"Array Choice Field"},type:"group",maxOccurs:3,fullWidth:!0,description:"In a choice field, only 1 of the fields can be filled in.",choice:[{fieldOptions:{label:"Nested Field 1"},type:"group",children:[{fieldOptions:{label:"Nested Child Field 1"},fullWidth:!0},{fieldOptions:{label:"Nested Child Field 2"},fullWidth:!0}]},{fieldOptions:{label:"Nested Field 2"},type:"group",children:[{fieldOptions:{label:"Nested Child Field 1"},fullWidth:!0},{fieldOptions:{label:"Nested Child Field 2"},fullWidth:!0}]}]}]},{fieldOptions:{label:"Choice Array Fields (minOccurs 1, maxOccurs 3)"},type:"heading",children:[{fieldOptions:{label:"Array Choice Field"},type:"group",maxOccurs:3,fullWidth:!0,description:"In a choice field, only 1 of the fields can be filled in.",choice:[{fieldOptions:{label:"Nested Field 1"},maxOccurs:3},{fieldOptions:{label:"Nested Field 2"},maxOccurs:3}]}]}]),ye=g([{fieldOptions:{label:"Personal Info"},type:"heading",name:"person",description:"Only showing the fields that have a value. Click edit to change.",fullWidth:!0,children:[{name:"firstName",fieldOptions:{label:"First Name"}},{name:"lastName",fieldOptions:{label:"Last Name"}},{name:"email",fieldOptions:{label:"Email"}}]},{fieldOptions:{label:"Address"},type:"heading",name:"address",fullWidth:!0,children:[{name:"street",fieldOptions:{label:"Street"},minOccurs:0},{name:"city",fieldOptions:{label:"City"},minOccurs:0},{name:"country",fieldOptions:{label:"Country"},minOccurs:0}]}],void 0,{initialEdit:!1,hideFieldsWithoutValue:!0,initialValues:{person:{firstName:"Jack",lastName:"Smit"}}}),xe=g([{name:"items",type:"text",fieldOptions:{label:"Items"},maxOccurs:3,attributes:[{name:"lang",type:"text",minOccurs:0}]}],{});function g(u,p,a={}){return e.markRaw(e.defineComponent({render:()=>e.h(he,{...a,metadata:u,settings:p,showDebugState:!0})}))}exports.TestFormTemplate=x;exports.arrayTestCase=ge;exports.childFieldsTestCase=ye;exports.choiceTestCase=be;exports.createTestCase=g;exports.defaultTestCase=ke;exports.groupTestCase=fe;exports.individualTestCase=xe;
8
+ `+e.toDisplayString(JSON.stringify(e.unref(m),null,2))+`
9
+ `,1)):e.createCommentVNode("",!0)],32))}}),nt=c([{name:"text",type:"text",fieldOptions:{label:"Text Input"},path:"with.custom.structure",restriction:{maxLength:10}}]),ot={with:{custom:{structure:"Order A204"}}},st=c([{name:"arrays",fieldOptions:{label:"Array Fields"},type:"heading",children:[{name:"optionalItems",fieldOptions:{label:"Optional field (max 3)"},minOccurs:0,maxOccurs:3},{name:"requiredItems",fieldOptions:{label:"Required field (max 3)"},maxOccurs:3},{name:"twoRequired",fieldOptions:{label:"2 Fields required"},minOccurs:2,maxOccurs:4},{name:"sections",fieldOptions:{label:"Section (2 sections required)"},type:"heading",minOccurs:2,maxOccurs:4,fullWidth:!0,children:[{name:"note",fieldOptions:{label:"Nested field 1"}},{name:"category",fieldOptions:{label:"Required Nested field 2"},type:"select",options:[{key:"option1",value:"Option 1"},{key:"option2",value:"Option 2"},{key:"option3",value:"Option 3"}]},{name:"flag",fieldOptions:{label:"Nested field 3"},type:"checkbox"}]}]}]),rt={arrays:{optionalItems:["First note"],requiredItems:["Alpha","Beta"],twoRequired:["One","Two"],sections:[{note:"Section one",category:"option2",flag:!0},{note:"Section two",category:"option1",flag:!1}]}},dt=c([{name:"groups",fieldOptions:{label:"Grouped Fields"},type:"heading",children:[{name:"requiredGroup",fieldOptions:{label:"Required group"},type:"group",children:[{name:"first",fieldOptions:{label:"Required Nested field 1"},fullWidth:!0},{name:"second",fieldOptions:{label:"Required Nested field 2"},fullWidth:!0}]},{name:"optionalGroup",fieldOptions:{label:"Optional group"},type:"group",minOccurs:0,description:`The group is optional, therefore the children will only be required once 1 value is filled in.
10
+
11
+ You can test it by filling in one of the fields.`,children:[{name:"first",fieldOptions:{label:"Required Nested field 1"},fullWidth:!0},{name:"second",fieldOptions:{label:"Required Nested field 2"},fullWidth:!0}]}]},{name:"groupArrays",fieldOptions:{label:"Grouped Array Fields"},type:"heading",children:[{name:"requiredGroups",fieldOptions:{label:"Required group"},type:"group",maxOccurs:5,fullWidth:!0,children:[{name:"first",fieldOptions:{label:"Required Nested field 1"}},{name:"second",fieldOptions:{label:"Required Nested field 2"}}]},{name:"optionalGroups",fieldOptions:{label:"Optional group"},type:"group",minOccurs:0,maxOccurs:5,fullWidth:!0,children:[{name:"first",fieldOptions:{label:"Required Nested field 1"}},{name:"second",fieldOptions:{label:"Required Nested field 2"}}]}]}]),ct={groups:{requiredGroup:{first:"Ada",second:"Lovelace"},optionalGroup:{first:"Grace",second:"Hopper"}},groupArrays:{requiredGroups:[{first:"Alan",second:"Turing"},{first:"Edsger",second:"Dijkstra"}],optionalGroups:[{first:"Barbara",second:"Liskov"}]}},pt=c([{name:"simpleChoiceSection",fieldOptions:{label:"Choice Fields (minOccurs 1, maxOccurs 1)"},type:"heading",children:[{name:"contactMethod",fieldOptions:{label:"Simple Choice Field"},fullWidth:!0,description:"In a choice field, only 1 of the fields can be filled in.",choice:[{name:"primary",fieldOptions:{label:"Nested Field 1"}},{name:"secondary",fieldOptions:{label:"Nested Field 2"}}]}]},{name:"groupedChoiceSection",fieldOptions:{label:"Choice Grouped Fields (minOccurs 1, maxOccurs 3)"},type:"heading",children:[{name:"pick",fieldOptions:{label:"Array Choice Field"},type:"group",maxOccurs:3,fullWidth:!0,description:"In a choice field, only 1 of the fields can be filled in.",choice:[{name:"optionA",fieldOptions:{label:"Nested Field 1"},type:"group",children:[{name:"detail1",fieldOptions:{label:"Nested Child Field 1"},fullWidth:!0},{name:"detail2",fieldOptions:{label:"Nested Child Field 2"},fullWidth:!0}]},{name:"optionB",fieldOptions:{label:"Nested Field 2"},type:"group",children:[{name:"detail1",fieldOptions:{label:"Nested Child Field 1"},fullWidth:!0},{name:"detail2",fieldOptions:{label:"Nested Child Field 2"},fullWidth:!0}]}]}]},{name:"arrayChoiceSection",fieldOptions:{label:"Choice Array Fields (minOccurs 1, maxOccurs 3)"},type:"heading",children:[{name:"pick",fieldOptions:{label:"Array Choice Field"},type:"group",maxOccurs:3,fullWidth:!0,description:"In a choice field, only 1 of the fields can be filled in.",choice:[{name:"optionA",fieldOptions:{label:"Nested Field 1"},maxOccurs:3},{name:"optionB",fieldOptions:{label:"Nested Field 2"},maxOccurs:3}]}]}]),mt={simpleChoiceSection:{contactMethod:{primary:"Picked the first branch"}},groupedChoiceSection:{pick:{optionA:[{detail1:"Group A, item 1a",detail2:"Group A, item 1b"}]}},arrayChoiceSection:{pick:{optionA:["First entry","Second entry"]}}},ut=c([{fieldOptions:{label:"Personal Info"},type:"heading",name:"person",description:"Only showing the fields that have a value. Click edit to change.",fullWidth:!0,children:[{name:"firstName",fieldOptions:{label:"First Name"}},{name:"lastName",fieldOptions:{label:"Last Name"}},{name:"email",fieldOptions:{label:"Email"}}]},{fieldOptions:{label:"Address"},type:"heading",name:"address",fullWidth:!0,children:[{name:"street",fieldOptions:{label:"Street"},minOccurs:0},{name:"city",fieldOptions:{label:"City"},minOccurs:0},{name:"country",fieldOptions:{label:"Country"},minOccurs:0}]}],void 0,{initialEdit:!1,hideFieldsWithoutValue:!0,initialValues:{person:{firstName:"Jack",lastName:"Smit"}}}),ht={person:{firstName:"Ada",lastName:"Lovelace",email:"ada@example.com"},address:{street:"Baker Street 221B",city:"London",country:"United Kingdom"}},bt=c([{name:"inputs",fieldOptions:{label:"All Input Types"},type:"heading",description:"Every dedicated input slot plus the default fallback, in both handleChange and v-model binding styles.",children:[{name:"text",type:"text",fieldOptions:{label:"Text"}},{name:"textBoundByVModel",type:"textBoundByVModel",fieldOptions:{label:"Text (v-model)"}},{name:"select",type:"select",fieldOptions:{label:"Select"},options:[{key:"option1",value:"Option 1"},{key:"option2",value:"Option 2"},{key:"option3",value:"Option 3"}]},{name:"selectBoundByVModel",type:"selectBoundByVModel",fieldOptions:{label:"Select (v-model)"},options:[{key:"option1",value:"Option 1"},{key:"option2",value:"Option 2"},{key:"option3",value:"Option 3"}]},{name:"checkbox",type:"checkbox",minOccurs:0,fieldOptions:{label:"Checkbox"}},{name:"checkboxBoundByVModel",type:"checkboxBoundByVModel",minOccurs:0,fieldOptions:{label:"Checkbox (v-model)"}},{name:"noType",fieldOptions:{label:"No type (default-input fallback)"}}]},{name:"staticProps",fieldOptions:{label:"Static Field Props"},type:"heading",description:"One field here has hidden: true and should not render at all.",children:[{name:"optionalField",minOccurs:0,fieldOptions:{label:"Optional field (minOccurs 0)"}},{name:"disabledField",minOccurs:0,disabled:!0,fieldOptions:{label:"Disabled field"}},{name:"hiddenField",minOccurs:0,hidden:!0,fieldOptions:{label:"Hidden field (should not be visible)"}},{name:"fullWidthField",minOccurs:0,fullWidth:!0,fieldOptions:{label:"Full width field"}},{name:"describedField",minOccurs:0,description:"A per-field description rendered below the input.",fieldOptions:{label:"Field with description"}}]}]),ft={inputs:{text:"Hello world",textBoundByVModel:"Two-way bound",select:"option2",selectBoundByVModel:"option3",checkbox:!0,checkboxBoundByVModel:!1,noType:"Fallback input"},staticProps:{optionalField:"Filled optional",disabledField:"Preset while disabled",fullWidthField:"Spans the full width",describedField:"Described value"}},Ot=c([{name:"strings",fieldOptions:{label:"String Restrictions"},type:"heading",description:"All fields are optional so only the restriction errors surface.",children:[{name:"minLength",minOccurs:0,restriction:{minLength:3},fieldOptions:{label:"minLength 3"}},{name:"maxLength",minOccurs:0,restriction:{maxLength:5},fieldOptions:{label:"maxLength 5"}},{name:"length",minOccurs:0,restriction:{length:4},fieldOptions:{label:"length 4 (exact)"}},{name:"pattern",minOccurs:0,restriction:{pattern:"^[A-Z]{2}-\\d{3}$"},description:"Two uppercase letters, a dash, three digits (e.g. AB-123).",fieldOptions:{label:"pattern"}},{name:"enumeration",minOccurs:0,restriction:{enumeration:["red","green","blue"]},description:"Only red, green or blue are allowed.",fieldOptions:{label:"enumeration"}},{name:"whiteSpace",minOccurs:0,restriction:{whiteSpace:"collapse"},description:"Leading, trailing or double spaces are invalid.",fieldOptions:{label:"whiteSpace collapse"}}]},{name:"numbers",fieldOptions:{label:"Numeric Restrictions"},type:"heading",children:[{name:"minInclusive",minOccurs:0,restriction:{minInclusive:5},fieldOptions:{label:"minInclusive 5 (value >= 5)"}},{name:"maxInclusive",minOccurs:0,restriction:{maxInclusive:10},fieldOptions:{label:"maxInclusive 10 (value <= 10)"}},{name:"minExclusive",minOccurs:0,restriction:{minExclusive:0},fieldOptions:{label:"minExclusive 0 (value > 0)"}},{name:"maxExclusive",minOccurs:0,restriction:{maxExclusive:100},fieldOptions:{label:"maxExclusive 100 (value < 100)"}},{name:"fractionDigits",minOccurs:0,restriction:{fractionDigits:2},fieldOptions:{label:"fractionDigits 2 (max 2 decimals)"}},{name:"totalDigits",minOccurs:0,restriction:{totalDigits:5},fieldOptions:{label:"totalDigits 5"}}]},{name:"mixed",fieldOptions:{label:"Combined & Custom"},type:"heading",children:[{name:"combined",minOccurs:0,restriction:{minLength:2,maxLength:6,pattern:"^[a-z]+$"},description:"minLength 2, maxLength 6 and lowercase-only pattern combined.",fieldOptions:{label:"Combined restrictions"}},{name:"requiredWithRestriction",restriction:{minLength:3},fieldOptions:{label:"Required + minLength 3"}},{name:"customValidation",minOccurs:0,validation:r=>!r||String(r).startsWith("A")||'Value must start with "A"',description:"Custom vee-validate function via the validation property.",fieldOptions:{label:"Custom validation function"}}]}]),gt={strings:{minLength:"abcd",maxLength:"abc",length:"code",pattern:"AB-123",enumeration:"green",whiteSpace:"clean text"},numbers:{minInclusive:"7",maxInclusive:"9",minExclusive:"3",maxExclusive:"42",fractionDigits:"3.14",totalDigits:"12345"},mixed:{combined:"hello",requiredWithRestriction:"valid",customValidation:"Apple"}},yt=c([{name:"occurrences",fieldOptions:{label:"Occurrence Variants"},type:"heading",children:[{name:"manualFirstItem",minOccurs:1,maxOccurs:3,autoAddMinOccurs:!1,description:"Starts empty even though 1 item is required (autoAddMinOccurs: false). Add the first item yourself; submitting while empty shows the minOccurs error.",fieldOptions:{label:"No auto first item"}},{name:"prefilledToMin",minOccurs:2,maxOccurs:4,description:"Auto-fills 2 empty items on first render (the default behaviour).",fieldOptions:{label:"Pre-filled to minOccurs 2"}},{name:"manyAllowed",minOccurs:0,maxOccurs:10,fieldOptions:{label:"Optional, up to 10 items"}}]},{name:"typedArrays",fieldOptions:{label:"Arrays of Other Input Types"},type:"heading",children:[{name:"selects",type:"select",minOccurs:0,maxOccurs:3,fieldOptions:{label:"Select array (max 3)"},options:[{key:"option1",value:"Option 1"},{key:"option2",value:"Option 2"}]},{name:"checkboxes",type:"checkbox",minOccurs:0,maxOccurs:3,fieldOptions:{label:"Checkbox array (max 3)"}},{name:"vModelTexts",type:"textBoundByVModel",minOccurs:0,maxOccurs:3,fieldOptions:{label:"v-model text array (max 3)"}}]}]),xt={occurrences:{manualFirstItem:["Added by hand"],prefilledToMin:["First","Second"],manyAllowed:["One","Two","Three"]},typedArrays:{selects:["option1","option2"],checkboxes:[!0,!1],vModelTexts:["Alpha","Beta"]}},vt=c([{name:"overLimit",fieldOptions:{label:"Over-limit Arrays (loaded from initialValues)"},type:"heading",children:[{name:"requiredItems",minOccurs:1,maxOccurs:2,fieldOptions:{label:"Required (max 2)"},description:"Loaded with 3 items, one over the maximum. Submit to see the xsd_maxOccurs error; the Add button is already disabled."},{name:"optionalItems",minOccurs:0,maxOccurs:2,fieldOptions:{label:"Optional (max 2)"},description:"A non-required array carried no occurrence rule before; loaded with 3 items it now fails xsd_maxOccurs on submit too."}]}]),kt={overLimit:{requiredItems:["First","Second","Third"],optionalItems:["One","Two","Three"]}},Ct=c([{name:"optionalChoice",fieldOptions:{label:"Optional Choice (minOccurs 0)"},type:"heading",children:[{name:"contact",fieldOptions:{label:"Optional choice"},minOccurs:0,fullWidth:!0,description:"Valid when left completely empty; still only one branch may hold a value.",choice:[{name:"email",fieldOptions:{label:"Email"}},{name:"phone",fieldOptions:{label:"Phone"}}]}]},{name:"twoOccurrence",fieldOptions:{label:"Choice Requiring 2 Occurrences (minOccurs 2, maxOccurs 4)"},type:"heading",children:[{name:"contact",fieldOptions:{label:"At least 2 occurrences"},minOccurs:2,maxOccurs:4,fullWidth:!0,description:"Submit with fewer than 2 filled occurrences to see the choiceMinOccurs error.",choice:[{name:"email",fieldOptions:{label:"Email"}},{name:"phone",fieldOptions:{label:"Phone"}}]}]},{name:"differentLimits",fieldOptions:{label:"Branches With Different Limits (maxOccurs 3)"},type:"heading",children:[{name:"entries",fieldOptions:{label:"Per-iteration branch limits"},maxOccurs:3,fullWidth:!0,description:"Branch A allows 2 items per choice iteration, branch B only 1; the choice itself may repeat 3 times.",choice:[{name:"branchA",maxOccurs:2,fieldOptions:{label:"Branch A (maxOccurs 2)"}},{name:"branchB",maxOccurs:1,fieldOptions:{label:"Branch B (maxOccurs 1)"}}]}]},{name:"totalCap",fieldOptions:{label:"Branch Total Cap (maxOccursTotal, maxOccurs 4)"},type:"heading",children:[{name:"entries",fieldOptions:{label:"Capped branch totals"},maxOccurs:4,fullWidth:!0,description:"The capped branch may reach at most 3 items in total across the whole choice, even though the shared budget would allow more.",choice:[{name:"capped",maxOccurs:2,maxOccursTotal:3,fieldOptions:{label:"Capped (maxOccurs 2, maxOccursTotal 3)"}},{name:"uncapped",maxOccurs:2,fieldOptions:{label:"Uncapped (maxOccurs 2)"}}]}]},{name:"singleBranchCap",fieldOptions:{label:"Single-Branch Total Cap (maxOccursTotal 2)"},type:"heading",children:[{name:"tags",fieldOptions:{label:"Capped single branch"},fullWidth:!0,description:"A one-branch choice renders its branch directly, with no occurrence budget to share. The branch declares maxOccurs 3 but maxOccursTotal 2, so the add button disables after 2 items.",choice:[{name:"tag",maxOccurs:3,maxOccursTotal:2,fieldOptions:{label:"Tag (maxOccurs 3, maxOccursTotal 2)"}}]},{name:"clamped",fieldOptions:{label:"Cap above maxOccurs has no effect"},fullWidth:!0,description:"maxOccursTotal can only tighten: this branch declares maxOccurs 2 with maxOccursTotal 5, and still stops at 2 items.",choice:[{name:"item",maxOccurs:2,maxOccursTotal:5,fieldOptions:{label:"Item (maxOccurs 2, maxOccursTotal 5)"}}]}]}]),Vt={optionalChoice:{contact:{email:"ada@example.com"}},twoOccurrence:{contact:{email:["ada@example.com","grace@example.com"]}},differentLimits:{entries:{branchA:["A-one","A-two"]}},totalCap:{entries:{capped:["C-one","C-two"]}},singleBranchCap:{tags:{tag:["T-one","T-two"]},clamped:{item:["I-one","I-two"]}}},wt=c([{name:"tooManyBranches",fieldOptions:{label:"Choice Over maxOccurs (auto mode, maxOccurs 1)"},type:"heading",children:[{name:"contact",fieldOptions:{label:"Only one branch allowed"},maxOccurs:1,fullWidth:!0,description:"Loaded with both email and phone filled at once. Two occupied branches exceed maxOccurs 1, so submit shows the xsd_choiceMaxOccurs error.",choice:[{name:"email",fieldOptions:{label:"Email"}},{name:"phone",fieldOptions:{label:"Phone"}}]}]},{name:"branchOverTotal",fieldOptions:{label:"Branch Over maxOccursTotal (maxOccurs 4)"},type:"heading",children:[{name:"entries",fieldOptions:{label:"Capped branch over its total"},maxOccurs:4,fullWidth:!0,description:"The capped branch allows at most 2 items in total across the whole choice (maxOccursTotal 2) but is loaded with 3. Submit shows the maxOccursTotal error.",choice:[{name:"capped",maxOccurs:3,maxOccursTotal:2,fieldOptions:{label:"Capped (maxOccursTotal 2)"}},{name:"uncapped",maxOccurs:3,fieldOptions:{label:"Uncapped"}}]}]},{name:"singleBranchOverTotal",fieldOptions:{label:"Single Branch Over maxOccursTotal"},type:"heading",children:[{name:"tags",fieldOptions:{label:"Capped single branch over its total"},fullWidth:!0,description:"A one-branch choice skips choice-level validation, so a breach surfaces as the branch's own maxOccurs error instead: the branch is capped at 2 items (maxOccursTotal 2) but loaded with 3. Submit to see it.",choice:[{name:"tag",maxOccurs:3,maxOccursTotal:2,fieldOptions:{label:"Tag (maxOccursTotal 2)"}}]}]}]),St={tooManyBranches:{contact:{email:"ada@example.com",phone:"555-0100"}},branchOverTotal:{entries:{capped:["C-one","C-two","C-three"]}},singleBranchOverTotal:{tags:{tag:["T-one","T-two","T-three"]}}},Bt=c([{name:"explicitSection",fieldOptions:{label:"Explicit Choice (selection-first)"},type:"heading",children:[{name:"contact",fieldOptions:{label:"Contact method"},fullWidth:!0,explicitChoiceSelection:!0,description:"No branch renders until one is chosen via the add buttons; switching to the other branch clears the current one.",choice:[{name:"email",type:"group",fieldOptions:{label:"Email"},children:[{name:"address",fullWidth:!0,fieldOptions:{label:"Email address"}}]},{name:"phone",type:"group",fieldOptions:{label:"Phone"},children:[{name:"number",fullWidth:!0,fieldOptions:{label:"Phone number"}},{name:"allowSms",type:"checkbox",minOccurs:0,fieldOptions:{label:"Allow SMS"}}]}]}]}]),Nt={explicitSection:{contact:{email:{address:"jane@example.com"}}}},Tt=c([{name:"preserveSection",fieldOptions:{label:"Explicit Choice With preserveOnSwitch"},type:"heading",children:[{name:"contact",fieldOptions:{label:"Contact method"},fullWidth:!0,explicitChoiceSelection:!0,preserveOnSwitch:!0,description:"Fill in Email, switch to Phone and back: the Email value is restored from the stash, with fresh touched/validation state.",choice:[{name:"email",type:"group",fieldOptions:{label:"Email"},children:[{name:"address",fullWidth:!0,fieldOptions:{label:"Email address"}}]},{name:"phone",type:"group",fieldOptions:{label:"Phone"},children:[{name:"number",fullWidth:!0,fieldOptions:{label:"Phone number"}}]}]}]}]),Et={preserveSection:{contact:{email:{address:"restore@example.com"}}}},_t=c([{name:"integrationsSection",fieldOptions:{label:"Explicit Repeatable Choice (maxOccurs 5)"},type:"heading",children:[{name:"integrations",fieldOptions:{label:"Integrations"},fullWidth:!0,maxOccurs:5,explicitChoiceSelection:!0,description:"Add up to 5 occurrences in any mix; each kind is additionally capped at 3 in total (maxOccursTotal), so its add button disables independently.",choice:[{name:"crmExport",maxOccurs:1,maxOccursTotal:3,fullWidth:!0,fieldOptions:{label:"CRM export"},children:[{name:"crmSystem",fieldOptions:{label:"CRM system"}},{name:"exportSchedule",fieldOptions:{label:"Export schedule"}}]},{name:"apiEndpoint",maxOccurs:1,maxOccursTotal:3,fullWidth:!0,fieldOptions:{label:"API endpoint"},children:[{name:"url",fieldOptions:{label:"Endpoint URL"}},{name:"apiKey",fieldOptions:{label:"API key"}}]}]}]}]),Wt={integrationsSection:{integrations:{crmExport:[{crmSystem:"Salesforce",exportSchedule:"Nightly"}],apiEndpoint:[{url:"https://api.example.com/orders",apiKey:"key-1234"},{url:"https://api.example.com/customers",apiKey:"key-5678"}]}}},Ft=c([{name:"timelineSection",fieldOptions:{label:"Repeatable Explicit Choice (displayOrder: added)"},type:"heading",children:[{name:"events",fieldOptions:{label:"Timeline entries"},fullWidth:!0,maxOccurs:6,explicitChoiceSelection:!0,displayOrder:"added",description:"Occurrences render in the order their add button was pressed, interleaved across both kinds, instead of grouped by kind. The global-index badge follows the rendered order; the insertion-order badge appears only on occurrences added this session. Pre-loaded occurrences have no add-order, so they sort first in grouped order; reloading drops the add-order entirely.",choice:[{name:"note",maxOccurs:6,fullWidth:!0,fieldOptions:{label:"Note"},children:[{name:"text",fullWidth:!0,fieldOptions:{label:"Note text"}}]},{name:"milestone",maxOccurs:6,fullWidth:!0,fieldOptions:{label:"Milestone"},children:[{name:"title",fieldOptions:{label:"Milestone title"}},{name:"owner",fieldOptions:{label:"Owner"}}]}]}]}]),At={timelineSection:{events:{note:[{text:"Loaded note (sorts first, grouped)"}],milestone:[{title:"Loaded milestone",owner:"Ada"}]}}},zt=c([{name:"stepsSection",fieldOptions:{label:"Repeatable Explicit Choice (preserveOrder + displayOrder: added)"},type:"heading",children:[{name:"steps",fieldOptions:{label:"Workflow steps"},fullWidth:!0,maxOccurs:6,explicitChoiceSelection:!0,displayOrder:"added",preserveOrder:!0,description:'Each added occurrence writes a 1-based "order" field into its own values (watch the debug output below), counted across both kinds. Removing one compacts the survivors back to a contiguous 1..N. Unlike the ephemeral displayOrder-only case, this order is real submitted data and survives a reload. The pre-loaded occurrences arrive without "order" and are backfilled once from their grouped position.',choice:[{name:"manual",maxOccurs:6,fullWidth:!0,fieldOptions:{label:"Manual step"},children:[{name:"instruction",fullWidth:!0,fieldOptions:{label:"Instruction"}}]},{name:"automated",maxOccurs:6,fullWidth:!0,fieldOptions:{label:"Automated step"},children:[{name:"script",fullWidth:!0,fieldOptions:{label:"Script"}}]}]}]}]),$t={stepsSection:{steps:{manual:[{instruction:"Backfilled order 1"}],automated:[{script:"deploy.sh"}]}}},Dt=c([{name:"labelsSection",fieldOptions:{label:"preserveOrder With a Scalar-Leaf Branch (per-branch no-op)"},type:"heading",children:[{name:"items",fieldOptions:{label:"Mixed branches"},fullWidth:!0,maxOccurs:6,explicitChoiceSelection:!0,displayOrder:"added",preserveOrder:!1,description:'The object branch (with children) gets an "order" field written into its values; the scalar-leaf branch (plain text, no children) has nowhere to attach "order", so preserveOrder is a no-op for it and logs a console.warn in development. Adding a scalar item still works, it just carries no persisted order.',choice:[{name:"labelled",maxOccurs:6,fullWidth:!0,fieldOptions:{label:"Labelled item (object branch)"},children:[{name:"label",fullWidth:!0,fieldOptions:{label:"Label"}}]},{name:"tag",maxOccurs:6,type:"text",fullWidth:!0,fieldOptions:{label:"Tag (scalar branch, no order)"}}]}]}]),Pt={labelsSection:{items:{labelled:[{label:"Has an order field"}],tag:["plain-tag-no-order"]}}},Lt=c([{name:"ownValue",fieldOptions:{label:"Reacting to Own Value"},type:"heading",children:[{name:"charCounter",minOccurs:0,restriction:{maxLength:10},fieldOptions:{label:"Character counter"},computedProps:[(r,m)=>{const o=typeof m.value=="string"?m.value.length:0;r.description=`${10-o} character(s) remaining`}]},{name:"selfHiding",minOccurs:0,fieldOptions:{label:'Type "hide" to hide me'},computedProps:[(r,m)=>{m.value==="hide"&&(r.hidden=!0)}]},{name:"selfDisabling",minOccurs:0,fieldOptions:{label:'Type "lock" to disable me'},computedProps:[(r,m)=>{m.value==="lock"&&(r.disabled=!0)}]}]},{name:"progress",fieldOptions:{label:"Parent Reacting to Child Values (computeOnChildValueChange)"},type:"heading",computeOnChildValueChange:!0,computedProps:[(r,m)=>{const s=Object.values(m.value??{}).filter(t=>t!=null&&t!=="").length;r.description=`${s} of 3 fields filled in`}],children:[{name:"first",minOccurs:0,fieldOptions:{label:"First"}},{name:"second",minOccurs:0,fieldOptions:{label:"Second"}},{name:"third",minOccurs:0,fieldOptions:{label:"Third"}}]},{name:"childFieldsDemo",fieldOptions:{label:"Parent Reacting to Child Computed State (childFields)"},type:"heading",description:'Each child hides itself when its value is "hide"; once every child is hidden the parent heading hides too.',computedProps:[(r,m,o)=>{o.value.length>0&&o.value.every(s=>s.hidden)&&(r.hidden=!0)}],children:[{name:"childA",minOccurs:0,fieldOptions:{label:'Child A (type "hide")'},computedProps:[(r,m)=>{m.value==="hide"&&(r.hidden=!0)}]},{name:"childB",minOccurs:0,fieldOptions:{label:'Child B (type "hide")'},computedProps:[(r,m)=>{m.value==="hide"&&(r.hidden=!0)}]}]}]),qt={ownValue:{charCounter:"Counting",selfHiding:"still shown",selfDisabling:"still on"},progress:{first:"Filled one",second:"Filled two"},childFieldsDemo:{childA:"kept visible"}},It=c([{name:"attributes",fieldOptions:{label:"Attributes"},type:"heading",description:"Attributes render once the parent field has a value; the value becomes an object like { value, ...attributes }. Check the debug output below.",children:[{name:"nickname",minOccurs:0,fullWidth:!0,fieldOptions:{label:"Optional attribute (lang)"},attributes:[{name:"lang",minOccurs:0,fieldOptions:{label:"Language"}}]},{name:"verifiedPhone",fullWidth:!0,fieldOptions:{label:"Required attribute (certainty)"},attributes:[{name:"certainty",type:"select",fieldOptions:{label:"Certainty"},options:[{key:"verified",value:"Verified"},{key:"unverified",value:"Unverified"}]}]}]},{name:"complexTypes",fieldOptions:{label:"Complex Types"},type:"heading",children:[{name:"complexValue",minOccurs:0,fullWidth:!0,isComplexType:!0,description:"isComplexType without attributes: the value is stored as { value: ... }.",fieldOptions:{label:"isComplexType"}}]}]),Rt={attributes:{nickname:{value:"Ace",lang:"en"},verifiedPhone:{value:"+31 6 1234 5678",certainty:"verified"}},complexTypes:{complexValue:{value:"Wrapped in { value }"}}},Ut=c([{name:"customValueProp",fieldOptions:{label:"Custom complexTypeValueProperty"},type:"heading",description:'The settings rename the complex type value property to "val", so the debug output shows { val: ..., lang: ... }.',children:[{name:"title",minOccurs:0,fullWidth:!0,fieldOptions:{label:"Title with lang attribute"},attributes:[{name:"lang",minOccurs:0,fieldOptions:{label:"Language"}}]}]}],{complexTypeValueProperty:"val"}),Jt={customValueProp:{title:{val:"Hello world",lang:"en"}}};function C(r,m){return c([{name:"timing",fieldOptions:{label:"Validation Timing"},type:"heading",description:r,children:[{name:"requiredField",fieldOptions:{label:"Required field"}},{name:"maxLengthField",minOccurs:0,restriction:{maxLength:5},fieldOptions:{label:"maxLength 5"}}]}],m)}const Gt={timing:{requiredField:"Filled in",maxLengthField:"abc"}},jt=C("validateOnValueUpdate: false, validateWhenInError: false. Errors only appear on submit and stay unchanged while typing until the next submit.",{validateOnValueUpdate:!1,validateWhenInError:!1}),Ht=C("validateOnBlur: true, validateOnValueUpdate: false. Errors appear when leaving a field, not while typing.",{validateOnBlur:!0,validateOnValueUpdate:!1}),Kt=C("validateOnValueUpdateAfterSubmit: true, validateOnValueUpdate: false. Typing does not validate until the first submit; after that every change validates.",{validateOnValueUpdateAfterSubmit:!0,validateOnValueUpdate:!1}),Qt=C("validateOnValueUpdate: false, validateWhenInError: true. A field only starts live-validating once it is in error (after a submit).",{validateOnValueUpdate:!1,validateWhenInError:!0}),Yt=c([{name:"optionalMarkers",fieldOptions:{label:'Show "(optional)" Instead of "*"'},type:"heading",description:"With showOptionalInsteadOfRequired the required markers disappear and optional fields are marked instead.",children:[{name:"requiredField",fieldOptions:{label:"Required field"}},{name:"optionalField",minOccurs:0,fieldOptions:{label:"Optional field"}}]}],{showOptionalInsteadOfRequired:!0}),Zt={optionalMarkers:{requiredField:"Required value",optionalField:"Optional value"}},Xt=c([{name:"messages",fieldOptions:{label:"Custom Validation Messages"},type:"heading",description:"The settings override the required, maxLength and minInclusive messages; rules without an override fall back to the library defaults.",children:[{name:"requiredField",fieldOptions:{label:"Required field"}},{name:"maxLengthField",minOccurs:0,restriction:{maxLength:5},fieldOptions:{label:"maxLength 5"}},{name:"minInclusiveField",minOccurs:0,restriction:{minInclusive:10},fieldOptions:{label:"minInclusive 10"}}]}],{messages:{required:"Custom message: please fill in {field}",maxLength:"Custom message: {field} must stay under {length} characters",minInclusive:"Custom message: {field} must be {min} or higher"}}),Mt={messages:{requiredField:"Filled in",maxLengthField:"abcd",minInclusiveField:"15"}},ea=c([{name:"items",type:"text",fieldOptions:{label:"Items"},maxOccurs:3,attributes:[{name:"lang",type:"text",minOccurs:0}]}],{}),ta={items:[{value:"First item",lang:"en"},{value:"Second item",lang:"nl"}]},k=[{key:"starter",value:"Starter"},{key:"growth",value:"Growth"},{key:"enterprise",value:"Enterprise"}],aa=c([{name:"onboarding",wizard:!0,fieldOptions:{label:"Onboarding wizard (backward-only)"},children:[{name:"company",type:"heading",fieldOptions:{label:"Company"},children:[{name:"companyName",fieldOptions:{label:"Company name (required)"},fullWidth:!0},{name:"website",minOccurs:0,fieldOptions:{label:"Website (optional)"},fullWidth:!0}]},{name:"plan",type:"heading",fieldOptions:{label:"Plan"},children:[{name:"planName",type:"select",fieldOptions:{label:"Plan (required)"},options:k},{name:"seats",minOccurs:0,fieldOptions:{label:"Seats (optional)"}}]},{name:"review",type:"heading",fieldOptions:{label:"Review"},children:[{name:"termsAccepted",type:"checkbox",fieldOptions:{label:"I accept the terms (required)"}}]}]}]),la={onboarding:{company:{companyName:"Acme Corp",website:"https://acme.example"},plan:{planName:"growth",seats:"25"},review:{termsAccepted:!0}}},ia=c([{name:"onboarding",wizard:{allowForwardJump:!0,validateOnJump:!1},fieldOptions:{label:"Wizard with forward jumping"},children:[{name:"company",type:"heading",fieldOptions:{label:"Company"},children:[{name:"companyName",fieldOptions:{label:"Company name (required)"},fullWidth:!0}]},{name:"plan",type:"heading",fieldOptions:{label:"Plan"},children:[{name:"planName",type:"select",fieldOptions:{label:"Plan (required)"},options:k}]},{name:"review",type:"heading",fieldOptions:{label:"Review"},children:[{name:"termsAccepted",type:"checkbox",fieldOptions:{label:"I accept the terms (required)"}}]}]}]),N={onboarding:{company:{companyName:"Acme Corp"},plan:{planName:"enterprise"},review:{termsAccepted:!0}}},na=c([{name:"onboarding",wizard:{allowForwardJump:!0,validateOnJump:!0},fieldOptions:{label:"Wizard with validate-on-jump"},children:[{name:"company",type:"heading",fieldOptions:{label:"Company"},children:[{name:"companyName",fieldOptions:{label:"Company name (required)"},fullWidth:!0}]},{name:"plan",type:"heading",fieldOptions:{label:"Plan"},children:[{name:"planName",type:"select",fieldOptions:{label:"Plan (required)"},options:k}]},{name:"review",type:"heading",fieldOptions:{label:"Review"},children:[{name:"termsAccepted",type:"checkbox",fieldOptions:{label:"I accept the terms (required)"}}]}]}]),oa=N,sa=c([{name:"onboarding",wizard:{allowForwardJump:!0},fieldOptions:{label:"Wizard with group / array / choice / summary pages"},children:[{name:"company",type:"heading",fieldOptions:{label:"Company (group page)"},children:[{name:"companyName",fieldOptions:{label:"Company name (required)"},fullWidth:!0}]},{name:"contacts",type:"heading",maxOccurs:4,minOccurs:1,fullWidth:!0,fieldOptions:{label:"Contacts (repeatable array page)"},children:[{name:"fullName",fieldOptions:{label:"Full name"}},{name:"email",minOccurs:0,fieldOptions:{label:"Email (optional)"}}]},{name:"launchApproach",type:"heading",fullWidth:!0,fieldOptions:{label:"Launch approach (choice page)"},choice:[{name:"selfServe",type:"group",fieldOptions:{label:"Self serve"},children:[{name:"startDate",fieldOptions:{label:"Start date"}}]},{name:"guidedRollout",type:"group",fieldOptions:{label:"Guided rollout"},children:[{name:"accountManager",fieldOptions:{label:"Account manager"}}]}]},{name:"summary",type:"heading",fieldOptions:{label:"Summary (field-less page)"}}]}]),ra={onboarding:{company:{companyName:"Acme Corp"},contacts:[{fullName:"Ada Lovelace",email:"ada@acme.example"},{fullName:"Grace Hopper"}],launchApproach:{guidedRollout:{accountManager:"Alan Turing"}}}},da=c([{name:"setupPath",explicitChoiceSelection:!0,fullWidth:!0,fieldOptions:{label:"Pick a setup path (choice of wizards)"},choice:[{name:"quickStart",wizard:{allowForwardJump:!0},fieldOptions:{label:"Quick start wizard"},children:[{name:"basics",type:"heading",fieldOptions:{label:"Basics"},children:[{name:"projectName",fieldOptions:{label:"Project name (required)"},fullWidth:!0}]},{name:"done",type:"heading",fieldOptions:{label:"Done"},children:[{name:"confirm",type:"checkbox",fieldOptions:{label:"Looks good (required)"}}]}]},{name:"guidedSetup",wizard:{allowForwardJump:!0},fieldOptions:{label:"Guided setup wizard"},children:[{name:"company",type:"heading",fieldOptions:{label:"Company"},children:[{name:"companyName",fieldOptions:{label:"Company name (required)"},fullWidth:!0}]},{name:"plan",type:"heading",fieldOptions:{label:"Plan"},children:[{name:"planName",type:"select",fieldOptions:{label:"Plan (required)"},options:k}]},{name:"review",type:"heading",fieldOptions:{label:"Review"},children:[{name:"termsAccepted",type:"checkbox",fieldOptions:{label:"Accept terms (required)"}}]}]}]}]),ca={setupPath:{guidedSetup:{company:{companyName:"Acme Corp"},plan:{planName:"growth"},review:{termsAccepted:!0}}}},pa=c([{name:"teams",type:"heading",maxOccurs:3,minOccurs:1,fullWidth:!0,fieldOptions:{label:"Teams (each team runs its own wizard)"},children:[{name:"setup",wizard:{allowForwardJump:!0},fieldOptions:{label:"Team setup wizard"},children:[{name:"team",type:"heading",fieldOptions:{label:"Team"},children:[{name:"teamName",fieldOptions:{label:"Team name (required)"},fullWidth:!0}]},{name:"lead",type:"heading",fieldOptions:{label:"Lead"},children:[{name:"leadName",fieldOptions:{label:"Lead name (required)"},fullWidth:!0}]}]}]}]),ma={teams:[{setup:{team:{teamName:"Platform"},lead:{leadName:"Ada Lovelace"}}},{setup:{team:{teamName:"Growth"},lead:{leadName:"Grace Hopper"}}}]},ua=c([{name:"onboarding",wizard:{allowForwardJump:!0},fieldOptions:{label:"Wizard: v-show vs v-if and keepValuesOnUnmount"},children:[{name:"company",type:"heading",fieldOptions:{label:"Company"},children:[{name:"companyName",minOccurs:1,fieldOptions:{label:"Company name (type something, then navigate away and back)"},fullWidth:!0}]},{name:"plan",type:"heading",fieldOptions:{label:"Plan"},children:[{name:"planName",minOccurs:1,fieldOptions:{label:"Plan name"},fullWidth:!0}]}]}]),ha={onboarding:{company:{companyName:"Acme Corp"},plan:{planName:"Growth"}}},ba=c([{name:"registration",type:"heading",minOccurs:0,fieldOptions:{label:"Optional section containing a wizard"},description:"While this section is empty, nothing in the wizard is required: Submit passes right away. Type into any field and the required fields gate again.",children:[{name:"onboarding",wizard:!0,fieldOptions:{label:"Onboarding wizard"},children:[{name:"company",type:"heading",fieldOptions:{label:"Company"},children:[{name:"companyName",fieldOptions:{label:"Company name (required once the section has a value)"},fullWidth:!0},{name:"website",minOccurs:0,fieldOptions:{label:"Website (optional)"},fullWidth:!0}]},{name:"plan",type:"heading",fieldOptions:{label:"Plan"},children:[{name:"planName",type:"select",fieldOptions:{label:"Plan (required once the section has a value)"},options:k}]}]}]}]),fa={registration:{onboarding:{company:{companyName:"Acme Corp"}}}},Oa=c([{name:"archived",type:"heading",maxOccurs:0,fieldOptions:{label:"Disabled section containing a wizard"},description:"The whole section is disabled via maxOccurs: 0. Navigate the wizard: every page field is disabled and Submit passes without validating them.",children:[{name:"onboarding",wizard:{allowForwardJump:!0},fieldOptions:{label:"Onboarding wizard"},children:[{name:"company",type:"heading",fieldOptions:{label:"Company"},children:[{name:"companyName",fieldOptions:{label:"Company name"},fullWidth:!0},{name:"website",minOccurs:0,fieldOptions:{label:"Website"},fullWidth:!0}]},{name:"plan",type:"heading",fieldOptions:{label:"Plan"},children:[{name:"planName",type:"select",fieldOptions:{label:"Plan"},options:k}]}]}]}]),ga={archived:{onboarding:{company:{companyName:"Acme Corp",website:"https://acme.example"},plan:{planName:"growth"}}}};function c(r,m,o={}){return e.markRaw(e.defineComponent({props:{initialValues:{type:Object,default:void 0},initialEdit:{type:Boolean,default:void 0},hideFieldsWithoutValue:{type:Boolean,default:void 0},settings:{type:Object,default:void 0},keepValuesOnUnmount:{type:Boolean,default:void 0}},setup:s=>()=>e.h(B,{metadata:r,settings:s.settings??m,showDebugState:!0,initialValues:s.initialValues??o.initialValues,initialEdit:s.initialEdit??o.initialEdit,hideFieldsWithoutValue:s.hideFieldsWithoutValue??o.hideFieldsWithoutValue,keepValuesOnUnmount:s.keepValuesOnUnmount})}))}const ya={class:"flex flex-col gap-4"},xa={class:"flex gap-6 flex-wrap"},va={class:"flex items-center gap-2"},ka={class:"flex items-center gap-2"},Ca=e.defineComponent({__name:"KeepValuesOnUnmountTestCase",setup(r){const m=e.ref(!0),o=e.ref(!1),s=e.computed(()=>[...m.value?[{name:"contact",fieldOptions:{label:"Contact (complex field with an attribute)"},minOccurs:0,fullWidth:!0,attributes:[{name:"certainty",type:"select",minOccurs:0,fieldOptions:{label:"Certainty"},options:[{key:"verified",value:"Verified"},{key:"unverified",value:"Unverified"}]}]}]:[],{name:"note",fieldOptions:{label:"Sibling field (always mounted)"},minOccurs:0,fullWidth:!0}]);return(t,a)=>(e.openBlock(),e.createElementBlock("div",ya,[e.createElementVNode("div",xa,[e.createElementVNode("label",va,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>m.value=l),type:"checkbox","data-testid":"toggle-show-contact"},null,512),[[e.vModelCheckbox,m.value]]),a[2]||(a[2]=e.createTextVNode(" Show contact field (v-if unmount) ",-1))]),e.createElementVNode("label",ka,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[1]||(a[1]=l=>o.value=l),type:"checkbox","data-testid":"toggle-keep-values-on-unmount"},null,512),[[e.vModelCheckbox,o.value]]),a[3]||(a[3]=e.createTextVNode(" keepValuesOnUnmount ",-1))])]),e.createVNode(B,{metadata:s.value,"keep-values-on-unmount":o.value,"show-debug-state":""},null,8,["metadata","keep-values-on-unmount"])]))}});exports.KeepValuesOnUnmountTestCase=Ca;exports.TestFormTemplate=S;exports.arrayMaxOccursSampleValues=kt;exports.arrayMaxOccursTestCase=vt;exports.arrayOccurrenceSampleValues=xt;exports.arrayOccurrenceTestCase=yt;exports.arraySampleValues=rt;exports.arrayTestCase=st;exports.attributesSampleValues=Rt;exports.attributesTestCase=It;exports.childFieldsSampleValues=ht;exports.childFieldsTestCase=ut;exports.choiceDisplayOrderAddedSampleValues=At;exports.choiceDisplayOrderAddedTestCase=Ft;exports.choiceMaxOccursSampleValues=St;exports.choiceMaxOccursTestCase=wt;exports.choiceOccurrenceSampleValues=Vt;exports.choiceOccurrenceTestCase=Ct;exports.choiceOfWizardsSampleValues=ca;exports.choiceOfWizardsTestCase=da;exports.choicePreserveOrderSampleValues=$t;exports.choicePreserveOrderScalarBranchSampleValues=Pt;exports.choicePreserveOrderScalarBranchTestCase=Dt;exports.choicePreserveOrderTestCase=zt;exports.choiceSampleValues=mt;exports.choiceTestCase=pt;exports.complexTypeValuePropertySampleValues=Jt;exports.complexTypeValuePropertyTestCase=Ut;exports.computedPropsSampleValues=qt;exports.computedPropsTestCase=Lt;exports.createTestCase=c;exports.customMessagesSampleValues=Mt;exports.customMessagesTestCase=Xt;exports.defaultSampleValues=ot;exports.defaultTestCase=nt;exports.explicitChoiceSampleValues=Nt;exports.explicitChoiceTestCase=Bt;exports.explicitRepeatableChoiceSampleValues=Wt;exports.explicitRepeatableChoiceTestCase=_t;exports.groupSampleValues=ct;exports.groupTestCase=dt;exports.individualSampleValues=ta;exports.individualTestCase=ea;exports.inputTypesSampleValues=ft;exports.inputTypesTestCase=bt;exports.preserveOnSwitchSampleValues=Et;exports.preserveOnSwitchTestCase=Tt;exports.repeatedWizardSampleValues=ma;exports.repeatedWizardTestCase=pa;exports.restrictionsSampleValues=gt;exports.restrictionsTestCase=Ot;exports.showOptionalInsteadOfRequiredSampleValues=Zt;exports.showOptionalInsteadOfRequiredTestCase=Yt;exports.validateAfterSubmitTestCase=Kt;exports.validateOnBlurTestCase=Ht;exports.validateOnSubmitOnlyTestCase=jt;exports.validateWhenInErrorTestCase=Qt;exports.validationTimingSampleValues=Gt;exports.wizardCompositePagesSampleValues=ra;exports.wizardCompositePagesTestCase=sa;exports.wizardDisabledAncestorSampleValues=ga;exports.wizardDisabledAncestorTestCase=Oa;exports.wizardForwardJumpSampleValues=N;exports.wizardForwardJumpTestCase=ia;exports.wizardKeepValuesSampleValues=ha;exports.wizardKeepValuesTestCase=ua;exports.wizardOptionalAncestorSampleValues=fa;exports.wizardOptionalAncestorTestCase=ba;exports.wizardSampleValues=la;exports.wizardTestCase=aa;exports.wizardValidateOnJumpSampleValues=oa;exports.wizardValidateOnJumpTestCase=na;
12
12
  //# sourceMappingURL=examples.cjs.js.map