@bach.software/vue-dynamic-form 0.5.0 → 0.7.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 (50) hide show
  1. package/dist/examples.cjs.js +9 -9
  2. package/dist/examples.cjs.js.map +1 -1
  3. package/dist/examples.es.js +1726 -293
  4. package/dist/examples.es.js.map +1 -1
  5. package/dist/mapEachMetadataItem-DwSDJyzo.cjs +2 -0
  6. package/dist/mapEachMetadataItem-DwSDJyzo.cjs.map +1 -0
  7. package/dist/mapEachMetadataItem-DxEO1PDs.js +1186 -0
  8. package/dist/mapEachMetadataItem-DxEO1PDs.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.formApi.test.d.ts +1 -0
  12. package/dist/src/components/__tests__/DynamicFormItem.unmount.logic.test.d.ts +1 -0
  13. package/dist/src/components/__tests__/DynamicFormItemArray.analytics.test.d.ts +1 -0
  14. package/dist/src/components/__tests__/DynamicFormItemArray.formApi.test.d.ts +1 -0
  15. package/dist/src/components/__tests__/DynamicFormItemArray.test-helpers.d.ts +9 -0
  16. package/dist/src/components/__tests__/DynamicFormItemChoice.analytics.test.d.ts +1 -0
  17. package/dist/src/components/__tests__/DynamicFormItemChoice.formApi.test.d.ts +1 -0
  18. package/dist/src/components/__tests__/DynamicFormItemChoice.test-helpers.d.ts +100 -0
  19. package/dist/src/components/__tests__/DynamicFormItemWizard.analytics.test.d.ts +1 -0
  20. package/dist/src/components/__tests__/DynamicFormItemWizard.formApi.test.d.ts +1 -0
  21. package/dist/src/components/__tests__/DynamicFormItemWizard.logic.test.d.ts +1 -0
  22. package/dist/src/components/__tests__/DynamicFormItemWizard.test-helpers.d.ts +24 -0
  23. package/dist/src/components/__tests__/DynamicFormItemWizard.validation.test.d.ts +1 -0
  24. package/dist/src/components/__tests__/DynamicFormTemplate.test.d.ts +1 -0
  25. package/dist/src/core/__tests__/useIsResetPending.test.d.ts +1 -0
  26. package/dist/src/core/__tests__/useIsValidationSuppressed.test.d.ts +1 -0
  27. package/dist/src/core/useIsResetPending.d.ts +13 -0
  28. package/dist/src/core/useIsValidationSuppressed.d.ts +20 -0
  29. package/dist/src/core/validation.d.ts +8 -2
  30. package/dist/src/examples/KeepValuesOnUnmountTestCase.vue.d.ts +2 -0
  31. package/dist/src/examples/ProgrammaticWritesTestCase.vue.d.ts +2 -0
  32. package/dist/src/examples/TestForm.vue.d.ts +7 -1
  33. package/dist/src/examples/TestFormTemplate.vue.d.ts +48 -13
  34. package/dist/src/examples/__tests__/TestFormTemplate.testcases.d.ts +2317 -7
  35. package/dist/src/examples/index.d.ts +2 -0
  36. package/dist/src/index.d.ts +1 -0
  37. package/dist/src/types/DynamicFormItemProps.d.ts +39 -2
  38. package/dist/src/types/DynamicFormSettings.d.ts +16 -0
  39. package/dist/src/types/FieldMetadata.d.ts +123 -1
  40. package/dist/src/utils/__tests__/deepCloneValue.test.d.ts +1 -0
  41. package/dist/src/utils/__tests__/mapEachMetadataItem.test.d.ts +1 -1
  42. package/dist/src/utils/deepCloneValue.d.ts +10 -0
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/dist/vue-dynamic-form.cjs.js +1 -1
  45. package/dist/vue-dynamic-form.es.js +28 -27
  46. package/package.json +8 -6
  47. package/dist/mapEachMetadataItem-B4xJvJDj.js +0 -732
  48. package/dist/mapEachMetadataItem-B4xJvJDj.js.map +0 -1
  49. package/dist/mapEachMetadataItem-CDDSsb0c.cjs +0 -6
  50. package/dist/mapEachMetadataItem-CDDSsb0c.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
- import { defineComponent as B, createElementBlock as l, openBlock as t, normalizeClass as g, createCommentVNode as s, createElementVNode as r, createBlock as O, unref as v, withCtx as x, withDirectives as W, vModelText as D, vModelCheckbox as I, Fragment as F, renderList as T, toDisplayString as u, vModelSelect as R, renderSlot as y, createTextVNode as w, createVNode as L, ref as V, computed as E, withModifiers as A, markRaw as U, h as j } from "vue";
2
- import { d as P, e as z, u as G, m as H, _ as J, h as Y } from "./mapEachMetadataItem-B4xJvJDj.js";
3
- const Q = {
1
+ import { defineComponent as E, createElementBlock as i, openBlock as t, normalizeClass as O, createCommentVNode as n, createElementVNode as a, createBlock as W, unref as F, withCtx as k, withDirectives as N, vModelText as K, vModelCheckbox as D, Fragment as $, renderList as A, toDisplayString as o, vModelSelect as Q, renderSlot as T, createTextVNode as x, createVNode as R, vShow as Y, computed as U, ref as L, withModifiers as Z, markRaw as X, h as M, useTemplateRef as ee } from "vue";
2
+ import { e as te, f as ie, u as ae, m as le, _ as ne, i as se } from "./mapEachMetadataItem-DxEO1PDs.js";
3
+ const oe = {
4
4
  key: 0,
5
5
  xmlns: "http://www.w3.org/2000/svg",
6
6
  fill: "none",
@@ -8,7 +8,7 @@ const Q = {
8
8
  "stroke-width": "1.5",
9
9
  stroke: "currentColor",
10
10
  class: "size-3"
11
- }, X = {
11
+ }, de = {
12
12
  key: 1,
13
13
  xmlns: "http://www.w3.org/2000/svg",
14
14
  fill: "none",
@@ -16,376 +16,630 @@ const Q = {
16
16
  "stroke-width": "1.5",
17
17
  stroke: "currentColor",
18
18
  class: "size-3"
19
- }, C = /* @__PURE__ */ B({
19
+ }, S = /* @__PURE__ */ E({
20
20
  __name: "IconButton",
21
21
  props: {
22
22
  icon: {},
23
23
  color: { default: "blue" }
24
24
  },
25
25
  emits: ["click"],
26
- setup(b) {
27
- return (k, c) => (t(), l("button", {
26
+ setup(u) {
27
+ return (h, d) => (t(), i("button", {
28
28
  type: "button",
29
- class: g(["cursor-pointer inline-flex items-center justify-center rounded-full size-5 text-white-800 cursor-pointer", {
30
- "bg-blue-200 hover:bg-blue-300": b.color === "blue",
31
- "bg-red-200 hover:bg-red-300": b.color === "red"
29
+ class: O(["cursor-pointer inline-flex items-center justify-center rounded-full size-5 text-white-800 cursor-pointer", {
30
+ "bg-blue-200 hover:bg-blue-300": u.color === "blue",
31
+ "bg-red-200 hover:bg-red-300": u.color === "red"
32
32
  }]),
33
- onClick: c[0] || (c[0] = (N) => k.$emit("click"))
33
+ onClick: d[0] || (d[0] = (c) => h.$emit("click"))
34
34
  }, [
35
- b.icon === "plus" ? (t(), l("svg", Q, [...c[1] || (c[1] = [
36
- r("path", {
35
+ u.icon === "plus" ? (t(), i("svg", oe, [...d[1] || (d[1] = [
36
+ a("path", {
37
37
  "stroke-linecap": "round",
38
38
  "stroke-linejoin": "round",
39
39
  d: "M12 4.5v15m7.5-7.5h-15"
40
40
  }, null, -1)
41
- ])])) : s("", !0),
42
- b.icon === "minus" ? (t(), l("svg", X, [...c[2] || (c[2] = [
43
- r("path", {
41
+ ])])) : n("", !0),
42
+ u.icon === "minus" ? (t(), i("svg", de, [...d[2] || (d[2] = [
43
+ a("path", {
44
44
  "stroke-linecap": "round",
45
45
  "stroke-linejoin": "round",
46
46
  d: "M5 12h14"
47
47
  }, null, -1)
48
- ])])) : s("", !0)
48
+ ])])) : n("", !0)
49
49
  ], 2));
50
50
  }
51
- }), Z = { class: "text-sm whitespace-pre-wrap" }, K = ["data-testid"], M = { class: "grid grid-cols-1 md:grid-cols-2 gap-6" }, ee = {
51
+ }), re = ["data-testid", "onClick"], ce = { class: "text-sm whitespace-pre-wrap" }, ue = ["data-testid"], pe = { class: "grid grid-cols-1 md:grid-cols-2 gap-6" }, me = {
52
52
  key: 0,
53
53
  class: "text-red-500 dark:text-rose-400"
54
- }, te = {
54
+ }, he = {
55
55
  key: 1,
56
56
  class: "text-sm text-gray-400"
57
- }, le = { class: "grid grid-cols-1 md:grid-cols-2 gap-6 ms-6" }, se = { class: "text-sm whitespace-pre-wrap" }, ie = ["data-testid"], ne = ["for"], de = {
57
+ }, be = ["data-testid"], fe = {
58
+ key: 0,
59
+ class: "flex gap-2 flex-wrap"
60
+ }, Oe = ["disabled", "data-testid", "onClick"], ge = ["data-testid", "onClick"], ye = { class: "grid grid-cols-1 md:grid-cols-2 gap-6 ms-6" }, xe = { class: "text-sm whitespace-pre-wrap" }, ve = ["data-testid"], we = {
61
+ key: 0,
62
+ class: "text-red-500 dark:text-rose-400"
63
+ }, ke = {
64
+ key: 1,
65
+ class: "text-sm text-gray-400"
66
+ }, Ce = ["data-testid"], Te = {
67
+ key: 0,
68
+ class: "flex gap-2 flex-wrap"
69
+ }, Ve = ["disabled", "data-testid", "onClick"], _e = ["data-testid", "onClick"], Se = { class: "grid grid-cols-1 md:grid-cols-2 gap-6 ms-6" }, We = { class: "text-sm whitespace-pre-wrap" }, Fe = ["data-testid"], $e = { class: "flex gap-2 items-center" }, Ae = ["data-testid"], Be = ["data-testid"], Ne = ["data-testid"], Pe = { class: "grid grid-cols-1 md:grid-cols-2 gap-6" }, qe = { class: "flex flex-col gap-2" }, Le = { class: "flex gap-2 flex-wrap" }, Ee = ["data-testid", "onClick"], Ie = { class: "flex gap-2" }, ze = ["data-testid", "onClick"], Re = ["data-testid", "onClick"], Ue = ["data-testid"], De = { class: "grid grid-cols-1 md:grid-cols-2 gap-6 ms-6" }, Je = ["data-testid"], Ge = ["data-testid"], je = ["data-testid"], He = ["data-testid"], Ke = ["data-testid"], Qe = ["data-testid"], Ye = ["data-testid"], Ze = ["data-testid", "data-current"], Xe = ["data-testid", "data-current"], Me = ["for"], et = {
58
70
  key: 0,
59
71
  class: "text-red-500 dark:text-rose-400"
60
- }, oe = {
72
+ }, tt = {
61
73
  key: 1,
62
74
  class: "text-sm text-gray-400"
63
- }, ae = { class: "text-sm whitespace-pre-wrap" }, re = ["data-testid"], ue = ["for"], ce = {
75
+ }, it = { class: "text-sm whitespace-pre-wrap" }, at = ["data-testid"], lt = ["for"], nt = {
64
76
  key: 0,
65
77
  class: "text-red-500 dark:text-rose-400"
66
- }, pe = {
78
+ }, st = {
67
79
  key: 1,
68
80
  class: "text-sm text-gray-400"
69
- }, he = { class: "flex gap-2 items-center" }, me = { class: "flex flex-col grow" }, be = { class: "text-sm whitespace-pre-wrap" }, fe = ["data-testid"], ge = {
81
+ }, ot = { class: "flex gap-2 items-center" }, dt = { class: "flex flex-col grow" }, rt = { class: "text-sm whitespace-pre-wrap" }, ct = ["data-testid"], ut = {
70
82
  key: 0,
71
83
  class: "text-red-500 dark:text-rose-400"
72
- }, xe = {
84
+ }, pt = {
73
85
  key: 1,
74
86
  class: "text-sm text-gray-400"
75
- }, ye = { class: "grid grid-cols-1 md:grid-cols-2 gap-6 ms-6" }, ve = { class: "text-sm whitespace-pre-wrap" }, ke = ["data-testid"], _e = {
87
+ }, mt = { class: "grid grid-cols-1 md:grid-cols-2 gap-6 ms-6" }, ht = { class: "text-sm whitespace-pre-wrap" }, bt = ["data-testid"], ft = {
76
88
  key: 0,
77
89
  class: "text-red-500 dark:text-rose-400"
78
- }, Oe = {
90
+ }, Ot = {
79
91
  key: 1,
80
92
  class: "text-sm text-gray-400"
81
- }, Ce = { class: "grid grid-cols-1 md:grid-cols-2 gap-6 ms-6" }, we = { class: "text-sm whitespace-pre-wrap" }, $e = ["data-testid"], Ne = ["id", "value", "disabled", "onChange", "onBlur"], Fe = ["value"], Be = ["id", "onUpdate:modelValue", "disabled", "onBlur"], We = ["value"], Ve = ["id", "checked", "disabled", "onChange", "onBlur"], Te = ["id", "onUpdate:modelValue", "disabled", "onBlur"], Se = ["id", "onUpdate:modelValue", "disabled", "onBlur"], Ee = ["id", "value", "disabled", "onInput", "onBlur"], Le = /* @__PURE__ */ B({
93
+ }, gt = { class: "grid grid-cols-1 md:grid-cols-2 gap-6 ms-6" }, yt = { class: "text-sm whitespace-pre-wrap" }, xt = ["data-testid"], vt = ["id", "value", "disabled", "onChange", "onBlur"], wt = ["value"], kt = ["id", "onUpdate:modelValue", "disabled", "onBlur"], Ct = ["value"], Tt = ["id", "checked", "disabled", "onChange", "onBlur"], Vt = ["id", "onUpdate:modelValue", "disabled", "onBlur"], _t = ["id", "onUpdate:modelValue", "disabled", "onBlur"], St = ["id", "value", "disabled", "onInput", "onBlur"], q = "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", Wt = "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", Ft = /* @__PURE__ */ E({
82
94
  __name: "TestFormTemplate",
83
- setup(b) {
84
- const k = z();
85
- return (c, N) => (t(), O(P, { "metadata-configuration": v(k) }, {
86
- heading: x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: o, canAddItems: d, addItem: p, canRemoveItems: h, removeItem: m, slotProps: a }) => [
87
- e.hidden ? s("", !0) : (t(), l("div", {
95
+ setup(u) {
96
+ const h = ie();
97
+ return (d, c) => (t(), W(te, { "metadata-configuration": F(h) }, {
98
+ heading: k(({ fieldMetadata: e, fieldContext: { errorMessage: l, label: r }, disabled: p, canAddItems: s, addItem: f, canRemoveItems: y, removeItem: b, slotProps: v }) => [
99
+ e.hidden ? n("", !0) : (t(), i("div", {
88
100
  key: 0,
89
- class: g(["mt-4", { "md:col-span-2": e.fullWidth }])
101
+ class: O(["mt-4", { "md:col-span-2": e.fullWidth }])
90
102
  }, [
91
- n ? (t(), l("h3", {
103
+ r ? (t(), i("h3", {
92
104
  key: 0,
93
- class: g(["flex text-xl font-bold gap-2 items-center mb-2", { "text-gray-500": e.disabled || o }])
105
+ class: O(["flex text-xl font-bold gap-2 items-center mb-2", { "text-gray-500": e.disabled || p }])
94
106
  }, [
95
- w(u(n) + " ", 1),
96
- d ? (t(), O(C, {
107
+ x(o(r) + " ", 1),
108
+ s ? (t(), W(S, {
97
109
  key: 0,
98
110
  icon: "plus",
99
111
  tabindex: "-1",
100
112
  "data-testid": `${e.path}-add-button`,
101
- onClick: p
102
- }, null, 8, ["data-testid", "onClick"])) : s("", !0),
103
- h ? (t(), O(C, {
113
+ onClick: f
114
+ }, null, 8, ["data-testid", "onClick"])) : n("", !0),
115
+ y ? (t(), W(S, {
104
116
  key: 1,
105
117
  icon: "minus",
106
118
  tabindex: "-1",
107
119
  color: "red",
108
120
  "data-testid": `${e.path}-remove-button`,
109
- onClick: m
110
- }, null, 8, ["data-testid", "onClick"])) : s("", !0)
111
- ], 2)) : s("", !0),
112
- r("pre", Z, u(e.description), 1),
113
- i.value ? (t(), l("span", {
121
+ onClick: b
122
+ }, null, 8, ["data-testid", "onClick"])) : n("", !0),
123
+ v?.gotoStep ? (t(), i("button", {
124
+ key: 2,
125
+ type: "button",
126
+ "data-testid": `${e.path}-goto-first-step-button`,
127
+ onClick: (V) => v.gotoStep(0)
128
+ }, " back to start ", 8, re)) : n("", !0)
129
+ ], 2)) : n("", !0),
130
+ a("pre", ce, o(e.description), 1),
131
+ l.value ? (t(), i("span", {
114
132
  key: 1,
115
133
  class: "text-red-600 text-sm",
116
134
  "data-testid": `${e.path}-error-message`
117
- }, u(i.value), 9, K)) : s("", !0),
118
- r("div", M, [
119
- y(c.$slots, "default", {
120
- level: (a?.level ?? 0) + 1
135
+ }, o(l.value), 9, ue)) : n("", !0),
136
+ a("div", pe, [
137
+ T(d.$slots, "default", {
138
+ level: (v?.level ?? 0) + 1
121
139
  })
122
140
  ])
123
141
  ], 2))
124
142
  ]),
125
- "heading-array": x(() => [
126
- y(c.$slots, "default")
143
+ "heading-array": k(({ fieldMetadata: e, fieldContext: { label: l }, disabled: r, canAddItems: p, addItem: s, slotProps: f }) => [
144
+ e.hidden ? n("", !0) : (t(), i("div", {
145
+ key: 0,
146
+ class: O(["mt-4 flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
147
+ }, [
148
+ l ? (t(), i("h3", {
149
+ key: 0,
150
+ class: O(["flex text-xl font-bold gap-2 items-center", { "text-gray-500": e.disabled || r }])
151
+ }, [
152
+ x(o(l) + " ", 1),
153
+ p ? (t(), W(S, {
154
+ key: 0,
155
+ icon: "plus",
156
+ tabindex: "-1",
157
+ "data-testid": `${e.path}-add-button`,
158
+ onClick: s
159
+ }, null, 8, ["data-testid", "onClick"])) : n("", !0)
160
+ ], 2)) : n("", !0),
161
+ T(d.$slots, "default", {
162
+ hideLabel: !0,
163
+ level: (f?.level ?? 0) + 1
164
+ })
165
+ ], 2))
127
166
  ]),
128
- "default-choice": x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: o, required: d, slotProps: p, settings: { showOptionalInsteadOfRequired: h } }) => [
129
- e.hidden ? s("", !0) : (t(), l("div", {
167
+ "default-choice": k(({ fieldMetadata: e, fieldContext: { errorMessage: l, label: r }, disabled: p, required: s, slotProps: f, settings: { showOptionalInsteadOfRequired: y }, addChoiceOccurrence: b, removeChoiceOccurrence: v, canAddChoiceOccurrence: V, usedChoiceOccurrences: _ }) => [
168
+ e.hidden ? n("", !0) : (t(), i("div", {
130
169
  key: 0,
131
- class: g(["flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
170
+ class: O(["flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
132
171
  }, [
133
- r("span", {
134
- class: g(["flex gap-2 items-center", { "text-gray-500": o }])
172
+ a("span", {
173
+ class: O(["flex gap-2 items-center", { "text-gray-500": p }])
135
174
  }, [
136
- w(u(n) + " ", 1),
137
- d && !h ? (t(), l("span", ee, "*")) : s("", !0),
138
- !d && h ? (t(), l("span", te, "(optional)")) : s("", !0)
175
+ x(o(r) + " ", 1),
176
+ s && !y ? (t(), i("span", me, "*")) : n("", !0),
177
+ !s && y ? (t(), i("span", he, "(optional)")) : n("", !0)
139
178
  ], 2),
140
- r("div", le, [
141
- y(c.$slots, "default", {
142
- level: (p?.level ?? 0) + 1,
179
+ a("div", null, [
180
+ c[0] || (c[0] = x("Used choice occurrences: ", -1)),
181
+ a("span", {
182
+ "data-testid": `${e.path}-used-choice-occurrences`
183
+ }, o(_), 9, be)
184
+ ]),
185
+ e.choice?.length ? (t(), i("div", fe, [
186
+ (t(!0), i($, null, A(e.choice, (g) => (t(), i("button", {
187
+ key: `${g.name}-add`,
188
+ type: "button",
189
+ class: O(q),
190
+ disabled: !V(g.name),
191
+ "data-testid": `${e.path}.${g.name}-add-choice-button`,
192
+ onClick: (B) => b(g.name)
193
+ }, " Add " + o(g.name), 9, Oe))), 128)),
194
+ (t(!0), i($, null, A(e.choice, (g) => (t(), i("button", {
195
+ key: `${g.name}-remove`,
196
+ type: "button",
197
+ class: O(q),
198
+ "data-testid": `${e.path}.${g.name}-remove-choice-button`,
199
+ onClick: (B) => v(g.name)
200
+ }, " Remove " + o(g.name), 9, ge))), 128))
201
+ ])) : n("", !0),
202
+ a("div", ye, [
203
+ T(d.$slots, "default", {
204
+ level: (f?.level ?? 0) + 1,
143
205
  belowChoiceField: !0
144
206
  })
145
207
  ]),
146
- r("pre", se, u(e.description), 1),
147
- i.value ? (t(), l("span", {
148
- key: 0,
208
+ a("pre", xe, o(e.description), 1),
209
+ l.value ? (t(), i("span", {
210
+ key: 1,
211
+ class: "text-red-600 text-sm",
212
+ "data-testid": `${e.path}-error-message`
213
+ }, o(l.value), 9, ve)) : n("", !0)
214
+ ], 2))
215
+ ]),
216
+ "default-choice-array": k(({ fieldMetadata: e, fieldContext: { errorMessage: l, label: r }, disabled: p, required: s, slotProps: f, settings: { showOptionalInsteadOfRequired: y }, addChoiceOccurrence: b, removeChoiceOccurrence: v, canAddChoiceOccurrence: V, usedChoiceOccurrences: _ }) => [
217
+ e.hidden ? n("", !0) : (t(), i("div", {
218
+ key: 0,
219
+ class: O(["flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
220
+ }, [
221
+ a("span", {
222
+ class: O(["flex gap-2 items-center", { "text-gray-500": p }])
223
+ }, [
224
+ x(o(r) + " ", 1),
225
+ s && !y ? (t(), i("span", we, "*")) : n("", !0),
226
+ !s && y ? (t(), i("span", ke, "(optional)")) : n("", !0)
227
+ ], 2),
228
+ a("div", null, [
229
+ c[1] || (c[1] = x("Used choice occurrences: ", -1)),
230
+ a("span", {
231
+ "data-testid": `${e.path}-used-choice-occurrences`
232
+ }, o(_), 9, Ce)
233
+ ]),
234
+ e.choice?.length ? (t(), i("div", Te, [
235
+ (t(!0), i($, null, A(e.choice, (g) => (t(), i("button", {
236
+ key: `${g.name}-add`,
237
+ type: "button",
238
+ class: O(q),
239
+ disabled: !V(g.name),
240
+ "data-testid": `${e.path}.${g.name}-add-choice-button`,
241
+ onClick: (B) => b(g.name)
242
+ }, " Add " + o(g.name), 9, Ve))), 128)),
243
+ (t(!0), i($, null, A(e.choice, (g) => (t(), i("button", {
244
+ key: `${g.name}-remove`,
245
+ type: "button",
246
+ class: O(q),
247
+ "data-testid": `${e.path}.${g.name}-remove-choice-button`,
248
+ onClick: (B) => v(g.name)
249
+ }, " Remove " + o(g.name), 9, _e))), 128))
250
+ ])) : n("", !0),
251
+ a("div", Se, [
252
+ T(d.$slots, "default", {
253
+ level: (f?.level ?? 0) + 1,
254
+ belowChoiceField: !0
255
+ })
256
+ ]),
257
+ a("pre", We, o(e.description), 1),
258
+ l.value ? (t(), i("span", {
259
+ key: 1,
149
260
  class: "text-red-600 text-sm",
150
261
  "data-testid": `${e.path}-error-message`
151
- }, u(i.value), 9, ie)) : s("", !0)
262
+ }, o(l.value), 9, Fe)) : n("", !0)
263
+ ], 2))
264
+ ]),
265
+ "default-choice-array-item": k(({ fieldMetadata: e, slotProps: l, branchKey: r, globalIndex: p, insertionOrder: s, canAddItems: f, addItem: y, removeItem: b }) => [
266
+ e.hidden ? n("", !0) : (t(), i("div", {
267
+ key: 0,
268
+ class: O(["flex flex-col gap-2 border-s-2 ps-2", { "md:col-span-2": e.fullWidth }])
269
+ }, [
270
+ a("div", $e, [
271
+ a("span", {
272
+ "data-testid": `${e.path}-kind-badge`
273
+ }, o(r), 9, Ae),
274
+ c[2] || (c[2] = x(" globalIndex: ", -1)),
275
+ a("span", {
276
+ "data-testid": `${e.path}-global-index`
277
+ }, o(p), 9, Be),
278
+ c[3] || (c[3] = x(" insertionOrder: ", -1)),
279
+ s !== void 0 ? (t(), i("span", {
280
+ key: 0,
281
+ "data-testid": `${e.path}-insertion-order`
282
+ }, o(s), 9, Ne)) : n("", !0),
283
+ f ? (t(), W(S, {
284
+ key: 1,
285
+ icon: "plus",
286
+ tabindex: "-1",
287
+ "data-testid": `${e.path}-add-choice-button`,
288
+ onClick: y
289
+ }, null, 8, ["data-testid", "onClick"])) : n("", !0),
290
+ R(S, {
291
+ icon: "minus",
292
+ tabindex: "-1",
293
+ color: "red",
294
+ "data-testid": `${e.path}-remove-choice-button`,
295
+ onClick: b
296
+ }, null, 8, ["data-testid", "onClick"])
297
+ ]),
298
+ a("div", Pe, [
299
+ T(d.$slots, "default", {
300
+ level: (l?.level ?? 0) + 1
301
+ })
302
+ ])
152
303
  ], 2))
153
304
  ]),
154
- "default-array": x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: o, required: d, canAddItems: p, addItem: h, settings: { showOptionalInsteadOfRequired: m } }) => [
155
- e.hidden ? s("", !0) : (t(), l("div", {
305
+ "default-wizard": k(({ fieldMetadata: e, fieldContext: { errorMessage: l, label: r }, pages: p, currentStepIndex: s, pageCount: f, isFirst: y, isLast: b, isValidating: v, wizardConfig: V, next: _, prev: g, gotoStep: B, slotProps: P }) => [
306
+ a("div", qe, [
307
+ a("span", null, o(r), 1),
308
+ a("div", Le, [
309
+ (t(!0), i($, null, A(p, (w, C) => (t(), i("button", {
310
+ key: w.path,
311
+ type: "button",
312
+ class: O(q),
313
+ "data-testid": `${e.path}-goto-${C}-button`,
314
+ onClick: (z) => B(C)
315
+ }, o(w.name), 9, Ee))), 128))
316
+ ]),
317
+ a("div", Ie, [
318
+ a("button", {
319
+ type: "button",
320
+ class: O(q),
321
+ "data-testid": `${e.path}-prev-button`,
322
+ onClick: g
323
+ }, " Previous ", 8, ze),
324
+ a("button", {
325
+ type: "button",
326
+ class: O(Wt),
327
+ "data-testid": `${e.path}-next-button`,
328
+ onClick: _
329
+ }, " Next ", 8, Re)
330
+ ]),
331
+ l.value ? (t(), i("span", {
332
+ key: 0,
333
+ class: "text-red-600 text-sm",
334
+ "data-testid": `${e.path}-error-message`
335
+ }, o(l.value), 9, Ue)) : n("", !0),
336
+ a("div", De, [
337
+ T(d.$slots, "default", {
338
+ level: (P?.level ?? 0) + 1
339
+ })
340
+ ]),
341
+ a("div", null, [
342
+ c[4] || (c[4] = x("currentStepIndex: ", -1)),
343
+ a("span", {
344
+ "data-testid": `${e.path}-currentStepIndex`
345
+ }, o(s), 9, Je)
346
+ ]),
347
+ a("div", null, [
348
+ c[5] || (c[5] = x("pageCount: ", -1)),
349
+ a("span", {
350
+ "data-testid": `${e.path}-pageCount`
351
+ }, o(f), 9, Ge)
352
+ ]),
353
+ a("div", null, [
354
+ c[6] || (c[6] = x("isFirst: ", -1)),
355
+ a("span", {
356
+ "data-testid": `${e.path}-isFirst`
357
+ }, o(y), 9, je)
358
+ ]),
359
+ a("div", null, [
360
+ c[7] || (c[7] = x("isLast: ", -1)),
361
+ a("span", {
362
+ "data-testid": `${e.path}-isLast`
363
+ }, o(b), 9, He)
364
+ ]),
365
+ a("div", null, [
366
+ c[8] || (c[8] = x("isValidating: ", -1)),
367
+ a("span", {
368
+ "data-testid": `${e.path}-isValidating`
369
+ }, o(v), 9, Ke)
370
+ ]),
371
+ a("div", null, [
372
+ c[9] || (c[9] = x("allowForwardJump: ", -1)),
373
+ a("span", {
374
+ "data-testid": `${e.path}-wizardConfig-allowForwardJump`
375
+ }, o(V.allowForwardJump), 9, Qe)
376
+ ]),
377
+ a("div", null, [
378
+ c[10] || (c[10] = x("validateOnJump: ", -1)),
379
+ a("span", {
380
+ "data-testid": `${e.path}-wizardConfig-validateOnJump`
381
+ }, o(V.validateOnJump), 9, Ye)
382
+ ])
383
+ ])
384
+ ]),
385
+ "default-wizard-page": k(({ fieldMetadata: e, isCurrent: l, gotoStep: r, slotProps: p, settings: { wizardPageUseVIf: s } }) => [
386
+ s ? l ? (t(), i("div", {
387
+ key: 1,
388
+ "data-testid": `${e.path}-page`,
389
+ "data-current": l
390
+ }, [
391
+ T(d.$slots, "default", {
392
+ gotoStep: r,
393
+ level: p?.level
394
+ })
395
+ ], 8, Xe)) : n("", !0) : N((t(), i("div", {
156
396
  key: 0,
157
- class: g(["flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
397
+ "data-testid": `${e.path}-page`,
398
+ "data-current": l
158
399
  }, [
159
- r("label", {
400
+ T(d.$slots, "default", {
401
+ gotoStep: r,
402
+ level: p?.level
403
+ })
404
+ ], 8, Ze)), [
405
+ [Y, l]
406
+ ])
407
+ ]),
408
+ "default-array": k(({ fieldMetadata: e, fieldContext: { errorMessage: l, label: r }, disabled: p, required: s, canAddItems: f, addItem: y, settings: { showOptionalInsteadOfRequired: b } }) => [
409
+ e.hidden ? n("", !0) : (t(), i("div", {
410
+ key: 0,
411
+ class: O(["flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
412
+ }, [
413
+ a("label", {
160
414
  for: `${e.path}[0]`,
161
- class: g([{ "text-gray-500": e.disabled || o }, "flex gap-2 items-center"])
415
+ class: O([{ "text-gray-500": e.disabled || p }, "flex gap-2 items-center"])
162
416
  }, [
163
- w(u(n) + " ", 1),
164
- d && !m ? (t(), l("span", de, "*")) : s("", !0),
165
- !d && m ? (t(), l("span", oe, "(optional)")) : s("", !0),
166
- p ? (t(), O(C, {
417
+ x(o(r) + " ", 1),
418
+ s && !b ? (t(), i("span", et, "*")) : n("", !0),
419
+ !s && b ? (t(), i("span", tt, "(optional)")) : n("", !0),
420
+ f ? (t(), W(S, {
167
421
  key: 2,
168
422
  icon: "plus",
169
423
  tabindex: "-1",
170
424
  "data-testid": `${e.path}-add-button`,
171
- onClick: h
172
- }, null, 8, ["data-testid", "onClick"])) : s("", !0)
173
- ], 10, ne),
174
- y(c.$slots, "default", { hideLabel: !0 }),
175
- r("pre", ae, u(e.description), 1),
176
- i.value ? (t(), l("span", {
425
+ onClick: y
426
+ }, null, 8, ["data-testid", "onClick"])) : n("", !0)
427
+ ], 10, Me),
428
+ T(d.$slots, "default", { hideLabel: !0 }),
429
+ a("pre", it, o(e.description), 1),
430
+ l.value ? (t(), i("span", {
177
431
  key: 0,
178
432
  class: "text-red-600 text-sm",
179
433
  "data-testid": `${e.path}-error-message`
180
- }, u(i.value), 9, re)) : s("", !0)
434
+ }, o(l.value), 9, at)) : n("", !0)
181
435
  ], 2))
182
436
  ]),
183
- default: x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: o, required: d, canRemoveItems: p, removeItem: h, slotProps: m, settings: { showOptionalInsteadOfRequired: a } }) => [
184
- e.hidden ? s("", !0) : (t(), l("div", {
437
+ default: k(({ fieldMetadata: e, fieldContext: { errorMessage: l, label: r }, disabled: p, required: s, canRemoveItems: f, removeItem: y, slotProps: b, settings: { showOptionalInsteadOfRequired: v } }) => [
438
+ e.hidden ? n("", !0) : (t(), i("div", {
185
439
  key: 0,
186
- class: g(["flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
440
+ class: O(["flex flex-col gap-2", { "md:col-span-2": e.fullWidth }])
187
441
  }, [
188
- m?.hideLabel ? s("", !0) : (t(), l("label", {
442
+ b?.hideLabel ? n("", !0) : (t(), i("label", {
189
443
  key: 0,
190
444
  for: e.path,
191
- class: g([{ "text-gray-500": e.disabled || o }, "flex gap-1 items-center"])
445
+ class: O([{ "text-gray-500": e.disabled || p }, "flex gap-1 items-center"])
192
446
  }, [
193
- w(u(n) + " ", 1),
194
- d && !a ? (t(), l("span", ce, "*")) : s("", !0),
195
- !d && a ? (t(), l("span", pe, "(optional)")) : s("", !0)
196
- ], 10, ue)),
197
- r("div", he, [
198
- r("div", me, [
199
- y(c.$slots, "default")
447
+ x(o(r) + " ", 1),
448
+ s && !v ? (t(), i("span", nt, "*")) : n("", !0),
449
+ !s && v ? (t(), i("span", st, "(optional)")) : n("", !0)
450
+ ], 10, lt)),
451
+ a("div", ot, [
452
+ a("div", dt, [
453
+ T(d.$slots, "default")
200
454
  ]),
201
- L(C, {
202
- class: g({ invisible: !p }),
455
+ R(S, {
456
+ class: O({ invisible: !f }),
203
457
  icon: "minus",
204
458
  tabindex: "-1",
205
459
  color: "red",
206
460
  "data-testid": `${e.path}-remove-button`,
207
- onClick: h
461
+ onClick: y
208
462
  }, null, 8, ["class", "data-testid", "onClick"])
209
463
  ]),
210
- r("pre", be, u(e.description), 1),
211
- i.value ? (t(), l("span", {
464
+ a("pre", rt, o(e.description), 1),
465
+ l.value ? (t(), i("span", {
212
466
  key: 1,
213
467
  class: "text-red-600 text-sm",
214
468
  "data-testid": `${e.path}-error-message`
215
- }, u(i.value), 9, fe)) : s("", !0)
469
+ }, o(l.value), 9, ct)) : n("", !0)
216
470
  ], 2)),
217
- y(c.$slots, "attributes")
471
+ T(d.$slots, "attributes")
218
472
  ]),
219
- "group-array": x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: o, required: d, canAddItems: p, addItem: h, slotProps: m, settings: { showOptionalInsteadOfRequired: a } }) => [
220
- e.hidden ? (t(), l(F, { key: 0 }, [], 64)) : m?.belowChoiceField ? (t(), l("div", {
473
+ "group-array": k(({ fieldMetadata: e, fieldContext: { errorMessage: l, label: r }, disabled: p, required: s, canAddItems: f, addItem: y, slotProps: b, settings: { showOptionalInsteadOfRequired: v } }) => [
474
+ e.hidden ? (t(), i($, { key: 0 }, [], 64)) : b?.belowChoiceField ? (t(), i("div", {
221
475
  key: 1,
222
- class: g({ "md:col-span-2": e.fullWidth })
476
+ class: O({ "md:col-span-2": e.fullWidth })
223
477
  }, [
224
- r("span", {
225
- class: g(["flex gap-2 items-center mb-2", { "text-gray-500": e.disabled || o }])
478
+ a("span", {
479
+ class: O(["flex gap-2 items-center mb-2", { "text-gray-500": e.disabled || p }])
226
480
  }, [
227
- w(u(n) + " ", 1),
228
- d && !a ? (t(), l("span", ge, "*")) : s("", !0),
229
- !d && a ? (t(), l("span", xe, "(optional)")) : s("", !0),
230
- p ? (t(), O(C, {
481
+ x(o(r) + " ", 1),
482
+ s && !v ? (t(), i("span", ut, "*")) : n("", !0),
483
+ !s && v ? (t(), i("span", pt, "(optional)")) : n("", !0),
484
+ f ? (t(), W(S, {
231
485
  key: 2,
232
486
  icon: "plus",
233
487
  tabindex: "-1",
234
488
  "data-testid": `${e.path}-add-button`,
235
- onClick: h
236
- }, null, 8, ["data-testid", "onClick"])) : s("", !0)
489
+ onClick: y
490
+ }, null, 8, ["data-testid", "onClick"])) : n("", !0)
237
491
  ], 2),
238
- r("div", ye, [
239
- y(c.$slots, "default", {
240
- level: (m?.level ?? 0) + 1
492
+ a("div", mt, [
493
+ T(d.$slots, "default", {
494
+ level: (b?.level ?? 0) + 1
241
495
  })
242
496
  ]),
243
- r("pre", ve, u(e.description), 1),
244
- i.value ? (t(), l("span", {
497
+ a("pre", ht, o(e.description), 1),
498
+ l.value ? (t(), i("span", {
245
499
  key: 0,
246
500
  class: "text-red-600 text-sm",
247
501
  "data-testid": `${e.path}-error-message`
248
- }, u(i.value), 9, ke)) : s("", !0)
249
- ], 2)) : y(c.$slots, "default", { key: 2 })
502
+ }, o(l.value), 9, bt)) : n("", !0)
503
+ ], 2)) : T(d.$slots, "default", {}, void 0, void 0, 2)
250
504
  ]),
251
- group: x(({ fieldMetadata: e, fieldContext: { errorMessage: i, label: n }, disabled: o, required: d, canAddItems: p, canRemoveItems: h, addItem: m, removeItem: a, slotProps: f, settings: { showOptionalInsteadOfRequired: _ } }) => [
252
- e.hidden ? s("", !0) : (t(), l("div", {
505
+ group: k(({ fieldMetadata: e, fieldContext: { errorMessage: l, label: r }, disabled: p, required: s, canAddItems: f, canRemoveItems: y, addItem: b, removeItem: v, slotProps: V, settings: { showOptionalInsteadOfRequired: _ } }) => [
506
+ e.hidden ? n("", !0) : (t(), i("div", {
253
507
  key: 0,
254
- class: g({ "md:col-span-2": e.fullWidth })
508
+ class: O({ "md:col-span-2": e.fullWidth })
255
509
  }, [
256
- f?.hideLabel ? s("", !0) : (t(), l("span", {
510
+ V?.hideLabel ? n("", !0) : (t(), i("span", {
257
511
  key: 0,
258
- class: g(["flex gap-2 items-center mb-2", { "text-gray-500": e.disabled || o }])
512
+ class: O(["flex gap-2 items-center mb-2", { "text-gray-500": e.disabled || p }])
259
513
  }, [
260
- w(u(n) + " ", 1),
261
- d && !_ ? (t(), l("span", _e, "*")) : s("", !0),
262
- !d && _ ? (t(), l("span", Oe, "(optional)")) : s("", !0),
263
- p ? (t(), O(C, {
514
+ x(o(r) + " ", 1),
515
+ s && !_ ? (t(), i("span", ft, "*")) : n("", !0),
516
+ !s && _ ? (t(), i("span", Ot, "(optional)")) : n("", !0),
517
+ f ? (t(), W(S, {
264
518
  key: 2,
265
519
  icon: "plus",
266
520
  tabindex: "-1",
267
521
  "data-testid": `${e.path}-add-button`,
268
- onClick: m
269
- }, null, 8, ["data-testid", "onClick"])) : s("", !0),
270
- h ? (t(), O(C, {
522
+ onClick: b
523
+ }, null, 8, ["data-testid", "onClick"])) : n("", !0),
524
+ y ? (t(), W(S, {
271
525
  key: 3,
272
526
  icon: "minus",
273
527
  tabindex: "-1",
274
528
  "data-testid": `${e.path}-remove-button`,
275
529
  color: "red",
276
- onClick: a
277
- }, null, 8, ["data-testid", "onClick"])) : s("", !0)
530
+ onClick: v
531
+ }, null, 8, ["data-testid", "onClick"])) : n("", !0)
278
532
  ], 2)),
279
- r("div", Ce, [
280
- y(c.$slots, "default", {
281
- level: (f?.level ?? 0) + 1
533
+ a("div", gt, [
534
+ T(d.$slots, "default", {
535
+ level: (V?.level ?? 0) + 1
282
536
  })
283
537
  ]),
284
- r("pre", we, u(e.description), 1),
285
- i.value ? (t(), l("span", {
538
+ a("pre", yt, o(e.description), 1),
539
+ l.value ? (t(), i("span", {
286
540
  key: 1,
287
541
  class: "text-red-600 text-sm",
288
542
  "data-testid": `${e.path}-error-message`
289
- }, u(i.value), 9, $e)) : s("", !0)
543
+ }, o(l.value), 9, xt)) : n("", !0)
290
544
  ], 2)),
291
- y(c.$slots, "attributes")
545
+ T(d.$slots, "attributes")
292
546
  ]),
293
- "select-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n, handleChange: o }, disabled: d }) => [
294
- r("select", {
547
+ "select-input": k(({ fieldMetadata: e, fieldContext: { value: l, handleBlur: r, handleChange: p }, disabled: s }) => [
548
+ a("select", {
295
549
  id: e.path,
296
- value: i.value,
297
- disabled: e.disabled || d,
550
+ value: l.value,
551
+ disabled: e.disabled || s,
298
552
  class: "h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
299
- onChange: o,
300
- onBlur: n
553
+ onChange: p,
554
+ onBlur: r
301
555
  }, [
302
- (t(!0), l(F, null, T(e.options, ({ key: p, value: h }) => (t(), l("option", {
303
- key: p,
304
- value: p
305
- }, u(h), 9, Fe))), 128))
306
- ], 40, Ne)
556
+ (t(!0), i($, null, A(e.options, ({ key: f, value: y }) => (t(), i("option", {
557
+ key: f,
558
+ value: f
559
+ }, o(y), 9, wt))), 128))
560
+ ], 40, vt)
307
561
  ]),
308
- "selectBoundByVModel-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n }, disabled: o }) => [
309
- W(r("select", {
562
+ "selectBoundByVModel-input": k(({ fieldMetadata: e, fieldContext: { value: l, handleBlur: r }, disabled: p }) => [
563
+ N(a("select", {
310
564
  id: e.path,
311
- "onUpdate:modelValue": (d) => i.value = d,
312
- disabled: e.disabled || o,
565
+ "onUpdate:modelValue": (s) => l.value = s,
566
+ disabled: e.disabled || p,
313
567
  class: "h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
314
- onBlur: n
568
+ onBlur: r
315
569
  }, [
316
- (t(!0), l(F, null, T(e.options, ({ key: d, value: p }) => (t(), l("option", {
317
- key: d,
318
- value: d
319
- }, u(p), 9, We))), 128))
320
- ], 40, Be), [
321
- [R, i.value]
570
+ (t(!0), i($, null, A(e.options, ({ key: s, value: f }) => (t(), i("option", {
571
+ key: s,
572
+ value: s
573
+ }, o(f), 9, Ct))), 128))
574
+ ], 40, kt), [
575
+ [Q, l.value]
322
576
  ])
323
577
  ]),
324
- "checkbox-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n, handleChange: o }, disabled: d }) => [
325
- r("input", {
578
+ "checkbox-input": k(({ fieldMetadata: e, fieldContext: { value: l, handleBlur: r, handleChange: p }, disabled: s }) => [
579
+ a("input", {
326
580
  id: e.path,
327
- checked: i.value,
328
- disabled: e.disabled || d,
581
+ checked: l.value,
582
+ disabled: e.disabled || s,
329
583
  type: "checkbox",
330
584
  class: "h-6 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
331
- onChange: (p) => o(p.target.checked),
332
- onBlur: n
333
- }, null, 40, Ve)
585
+ onChange: (f) => p(f.target.checked),
586
+ onBlur: r
587
+ }, null, 40, Tt)
334
588
  ]),
335
- "checkboxBoundByVModel-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n }, disabled: o }) => [
336
- W(r("input", {
589
+ "checkboxBoundByVModel-input": k(({ fieldMetadata: e, fieldContext: { value: l, handleBlur: r }, disabled: p }) => [
590
+ N(a("input", {
337
591
  id: e.path,
338
- "onUpdate:modelValue": (d) => i.value = d,
339
- disabled: e.disabled || o,
592
+ "onUpdate:modelValue": (s) => l.value = s,
593
+ disabled: e.disabled || p,
340
594
  type: "checkbox",
341
595
  class: "h-6 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
342
- onBlur: n
343
- }, null, 40, Te), [
344
- [I, i.value]
596
+ onBlur: r
597
+ }, null, 40, Vt), [
598
+ [D, l.value]
345
599
  ])
346
600
  ]),
347
- "textBoundByVModel-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n }, disabled: o }) => [
348
- W(r("input", {
601
+ "textBoundByVModel-input": k(({ fieldMetadata: e, fieldContext: { value: l, handleBlur: r }, disabled: p }) => [
602
+ N(a("input", {
349
603
  id: e.path,
350
- "onUpdate:modelValue": (d) => i.value = d,
351
- disabled: e.disabled || o,
604
+ "onUpdate:modelValue": (s) => l.value = s,
605
+ disabled: e.disabled || p,
352
606
  type: "text",
353
607
  class: "h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
354
- onBlur: n
355
- }, null, 40, Se), [
356
- [D, i.value]
608
+ onBlur: r
609
+ }, null, 40, _t), [
610
+ [K, l.value]
357
611
  ])
358
612
  ]),
359
- "default-input": x(({ fieldMetadata: e, fieldContext: { value: i, handleBlur: n, handleChange: o }, disabled: d }) => [
360
- r("input", {
613
+ "default-input": k(({ fieldMetadata: e, fieldContext: { value: l, handleBlur: r, handleChange: p }, disabled: s }) => [
614
+ a("input", {
361
615
  id: e.path,
362
- value: i.value,
363
- disabled: e.disabled || d,
616
+ value: l.value,
617
+ disabled: e.disabled || s,
364
618
  type: "text",
365
619
  class: "h-9 bg-gray-100 border-gray-200 border rounded px-3 text-sm",
366
- onInput: o,
367
- onBlur: n
368
- }, null, 40, Ee)
620
+ onInput: p,
621
+ onBlur: r
622
+ }, null, 40, St)
369
623
  ]),
370
624
  _: 3
371
625
  }, 8, ["metadata-configuration"]));
372
626
  }
373
- }), qe = { class: "flex justify-end gap-2" }, De = {
627
+ }), $t = { class: "flex justify-end gap-2" }, At = {
374
628
  key: 1,
375
629
  type: "submit",
376
630
  class: "cursor-pointer mt-4 bg-blue-500 text-white px-4 py-2 rounded",
377
631
  "data-testid": "submit"
378
- }, Ie = {
632
+ }, Bt = {
379
633
  key: 0,
380
634
  "data-testid": "errors",
381
635
  class: "col-12 text-red-600"
382
- }, Re = ["innerHTML"], Ae = {
636
+ }, Nt = ["innerHTML"], Pt = {
383
637
  key: 1,
384
638
  "data-testid": "isSubmitted"
385
- }, Ue = {
639
+ }, qt = {
386
640
  key: 2,
387
641
  class: "bg-gray-100 p-4 rounded-lg text-sm overflow-auto"
388
- }, je = /* @__PURE__ */ B({
642
+ }, G = /* @__PURE__ */ E({
389
643
  __name: "TestForm",
390
644
  props: {
391
645
  metadata: {},
@@ -393,23 +647,30 @@ const Q = {
393
647
  showDebugState: { type: Boolean, default: !1 },
394
648
  initialEdit: { type: Boolean, default: !0 },
395
649
  hideFieldsWithoutValue: { type: Boolean, default: !1 },
396
- initialValues: {}
650
+ initialValues: {},
651
+ keepValuesOnUnmount: { type: Boolean }
397
652
  },
398
- setup(b) {
399
- const { values: k, handleSubmit: c, errors: N, meta: e } = G({
400
- initialValues: b.initialValues
401
- }), i = V(), n = V(b.initialEdit), o = V(!1), d = E(() => b.metadata?.map((m) => H(m, (a) => (a.computedProps = a.computedProps ?? [], a.computedProps.push((f) => {
402
- n.value || (f.disabled = !0);
403
- }), b.hideFieldsWithoutValue && (a.computedProps.push((f, _) => {
404
- !n.value && !Y(_.value) && (f.hidden = !0);
405
- }), a.computedProps.push((f, _, S) => {
406
- !n.value && S.value.length > 0 && S.value.every((q) => q.hidden) && (f.hidden = !0);
407
- })), a)))), p = E(() => ({
653
+ setup(u, { expose: h }) {
654
+ const { values: d, handleSubmit: c, errors: e, meta: l, resetForm: r, resetField: p, setFieldValue: s, setValues: f } = ae({
655
+ initialValues: u.initialValues,
656
+ // Passed as a computed ref (not the destructured value directly) so a live toggle of the prop
657
+ // after mount keeps affecting unmount behaviour, instead of freezing whatever it was at setup time.
658
+ keepValuesOnUnmount: U(() => u.keepValuesOnUnmount)
659
+ }), y = L(), b = L(u.initialEdit), v = L(!1), V = U(() => u.metadata?.map((P) => le(P, (w) => (w.computedProps = w.computedProps ?? [], w.computedProps.push((C) => {
660
+ b.value || (C.disabled = !0);
661
+ }), u.hideFieldsWithoutValue && (w.computedProps.push((C, z) => {
662
+ !b.value && !se(z.value) && (C.hidden = !0);
663
+ }), w.computedProps.push((C, z, j) => {
664
+ !b.value && j.value.length > 0 && j.value.every((H) => H.hidden) && (C.hidden = !0);
665
+ })), w)))), _ = U(() => ({
408
666
  analytics: !0,
409
667
  messages: {
410
668
  required: "{field} is required",
411
669
  minOccurs: "At least {min} items required",
670
+ maxOccurs: "At most {max} items allowed",
412
671
  choiceMinOccurs: "The following fields need to occur at least {min} time(s): {field}",
672
+ choiceMaxOccurs: "The following fields may occur at most {max} time(s): {field}",
673
+ maxOccursTotal: "This branch may occur at most {max} time(s) in total: {field}",
413
674
  minLength: "The minimum length of {field} is {length}",
414
675
  maxLength: "The maximum length of {field} is {length}",
415
676
  length: "{field} must be exactly {length} characters",
@@ -423,153 +684,212 @@ const Q = {
423
684
  fractionDigits: "{field} may have at most {digits} decimal place(s)",
424
685
  totalDigits: "{field} may have at most {digits} significant digit(s)"
425
686
  },
426
- ...b.settings ?? {}
687
+ ...u.settings ?? {}
427
688
  }));
428
- function h(m) {
689
+ function g() {
690
+ p(u.metadata[0].name);
691
+ }
692
+ h({ setFieldValue: s, setValues: f });
693
+ function B(P) {
429
694
  c(
430
- (a) => {
431
- o.value = !0, n.value = !1;
695
+ (w) => {
696
+ v.value = !0, b.value = !1;
432
697
  },
433
- ({ errors: a }) => {
434
- o.value = !1;
698
+ ({ errors: w }) => {
699
+ v.value = !1;
435
700
  }
436
- )(m);
701
+ )(P);
437
702
  }
438
- return (m, a) => (t(), l("form", {
439
- onSubmit: A(h, ["prevent"])
703
+ return (P, w) => (t(), i("form", {
704
+ onSubmit: Z(B, ["prevent"])
440
705
  }, [
441
- r("div", qe, [
442
- n.value ? s("", !0) : (t(), l("button", {
706
+ a("div", $t, [
707
+ b.value ? n("", !0) : (t(), i("button", {
443
708
  key: 0,
444
709
  type: "button",
445
710
  class: "cursor-pointer mt-4 bg-blue-500 text-white px-4 py-2 rounded",
446
711
  "data-testid": "submit",
447
- onClick: a[0] || (a[0] = (f) => n.value = !0)
712
+ onClick: w[0] || (w[0] = (C) => b.value = !0)
448
713
  }, " Edit ")),
449
- n.value ? (t(), l("button", De, " Submit ")) : s("", !0),
450
- n.value ? (t(), l("button", {
714
+ b.value ? (t(), i("button", At, " Submit ")) : n("", !0),
715
+ b.value ? (t(), i("button", {
451
716
  key: 2,
452
717
  type: "button",
453
718
  class: "cursor-pointer mt-4 bg-gray-200 text-black px-4 py-2 rounded",
454
719
  "data-testid": "cancel",
455
- onClick: a[1] || (a[1] = (f) => n.value = !1)
456
- }, " Cancel ")) : s("", !0)
720
+ onClick: w[1] || (w[1] = (C) => b.value = !1)
721
+ }, " Cancel ")) : n("", !0),
722
+ b.value ? (t(), i("button", {
723
+ key: 3,
724
+ type: "button",
725
+ class: "cursor-pointer mt-4 bg-gray-200 text-black px-4 py-2 rounded",
726
+ "data-testid": "reset",
727
+ onClick: w[2] || (w[2] = (C) => F(r)())
728
+ }, " Reset ")) : n("", !0),
729
+ b.value ? (t(), i("button", {
730
+ key: 4,
731
+ type: "button",
732
+ class: "cursor-pointer mt-4 bg-gray-200 text-black px-4 py-2 rounded",
733
+ "data-testid": "resetField",
734
+ onClick: g
735
+ }, " Reset field ")) : n("", !0)
457
736
  ]),
458
- Object.values(v(N)).length ? (t(), l("div", Ie, [
459
- a[3] || (a[3] = w(" Errors: ", -1)),
460
- r("ul", null, [
461
- (t(!0), l(F, null, T(v(N), (f, _) => (t(), l("li", { key: _ }, [
462
- r("span", { innerHTML: f }, null, 8, Re)
737
+ Object.values(F(e)).length ? (t(), i("div", Bt, [
738
+ w[4] || (w[4] = x(" Errors: ", -1)),
739
+ a("ul", null, [
740
+ (t(!0), i($, null, A(F(e), (C, z) => (t(), i("li", { key: z }, [
741
+ a("span", { innerHTML: C }, null, 8, Nt)
463
742
  ]))), 128))
464
743
  ])
465
- ])) : s("", !0),
466
- L(J, {
467
- template: Le,
468
- metadata: d.value,
469
- settings: p.value,
470
- "onUpdate:modelValue": a[2] || (a[2] = (f) => i.value = f)
744
+ ])) : n("", !0),
745
+ R(ne, {
746
+ template: Ft,
747
+ metadata: V.value,
748
+ settings: _.value,
749
+ "onUpdate:modelValue": w[3] || (w[3] = (C) => y.value = C)
471
750
  }, null, 8, ["metadata", "settings"]),
472
- o.value ? (t(), l("span", Ae)) : s("", !0),
473
- b.showDebugState ? (t(), l("pre", Ue, "IsDirty: " + u(v(e).dirty) + `
474
- Pending: ` + u(v(e).pending) + `
475
- Touched: ` + u(v(e).touched) + `
476
- Valid: ` + u(v(e).valid) + `
477
- Submitted: ` + u(o.value) + `
751
+ v.value ? (t(), i("span", Pt)) : n("", !0),
752
+ u.showDebugState ? (t(), i("pre", qt, "IsDirty: " + o(F(l).dirty) + `
753
+ Pending: ` + o(F(l).pending) + `
754
+ Touched: ` + o(F(l).touched) + `
755
+ Valid: ` + o(F(l).valid) + `
756
+ Submitted: ` + o(v.value) + `
478
757
 
479
758
  // form values:
480
- ` + u(JSON.stringify(v(k), null, 2)) + `
481
- `, 1)) : s("", !0)
759
+ ` + o(JSON.stringify(F(d), null, 2)) + `
760
+ `, 1)) : n("", !0)
482
761
  ], 32));
483
762
  }
484
- }), Ge = $([{
763
+ }), Ht = m([{
485
764
  name: "text",
486
765
  type: "text",
487
766
  fieldOptions: { label: "Text Input" },
488
767
  path: "with.custom.structure",
489
768
  restriction: { maxLength: 10 }
490
- }]), He = $([{
769
+ }]), Kt = {
770
+ with: { custom: { structure: "Order A204" } }
771
+ }, Qt = m([{
772
+ name: "arrays",
491
773
  fieldOptions: { label: "Array Fields" },
492
774
  type: "heading",
493
775
  children: [
494
- { fieldOptions: { label: "Optional field (max 3)" }, minOccurs: 0, maxOccurs: 3 },
495
- { fieldOptions: { label: "Required field (max 3)" }, maxOccurs: 3 },
496
- { fieldOptions: { label: "2 Fields required" }, minOccurs: 2, maxOccurs: 4 },
497
- { fieldOptions: { label: "Section (2 sections required)" }, type: "heading", minOccurs: 2, maxOccurs: 4, fullWidth: !0, children: [
498
- { fieldOptions: { label: "Nested field 1" } },
499
- { fieldOptions: { label: "Required Nested field 2" }, type: "select", options: [
776
+ { name: "optionalItems", fieldOptions: { label: "Optional field (max 3)" }, minOccurs: 0, maxOccurs: 3 },
777
+ { name: "requiredItems", fieldOptions: { label: "Required field (max 3)" }, maxOccurs: 3 },
778
+ { name: "twoRequired", fieldOptions: { label: "2 Fields required" }, minOccurs: 2, maxOccurs: 4 },
779
+ { name: "sections", fieldOptions: { label: "Section (2 sections required)" }, type: "heading", minOccurs: 2, maxOccurs: 4, fullWidth: !0, children: [
780
+ { name: "note", fieldOptions: { label: "Nested field 1" } },
781
+ { name: "category", fieldOptions: { label: "Required Nested field 2" }, type: "select", options: [
500
782
  { key: "option1", value: "Option 1" },
501
783
  { key: "option2", value: "Option 2" },
502
784
  { key: "option3", value: "Option 3" }
503
785
  ] },
504
- { fieldOptions: { label: "Nested field 3" }, type: "checkbox" }
786
+ { name: "flag", fieldOptions: { label: "Nested field 3" }, type: "checkbox" }
505
787
  ] }
506
788
  ]
507
- }]), Je = $([{
789
+ }]), Yt = {
790
+ arrays: {
791
+ optionalItems: ["First note"],
792
+ requiredItems: ["Alpha", "Beta"],
793
+ twoRequired: ["One", "Two"],
794
+ sections: [
795
+ { note: "Section one", category: "option2", flag: !0 },
796
+ { note: "Section two", category: "option1", flag: !1 }
797
+ ]
798
+ }
799
+ }, Zt = m([{
800
+ name: "groups",
508
801
  fieldOptions: { label: "Grouped Fields" },
509
802
  type: "heading",
510
803
  children: [
511
- { fieldOptions: { label: "Required group" }, type: "group", children: [
512
- { fieldOptions: { label: "Required Nested field 1" }, fullWidth: !0 },
513
- { fieldOptions: { label: "Required Nested field 2" }, fullWidth: !0 }
804
+ { name: "requiredGroup", fieldOptions: { label: "Required group" }, type: "group", children: [
805
+ { name: "first", fieldOptions: { label: "Required Nested field 1" }, fullWidth: !0 },
806
+ { name: "second", fieldOptions: { label: "Required Nested field 2" }, fullWidth: !0 }
514
807
  ] },
515
- { 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.
516
-
808
+ { 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.
809
+
517
810
  You can test it by filling in one of the fields.`, children: [
518
- { fieldOptions: { label: "Required Nested field 1" }, fullWidth: !0 },
519
- { fieldOptions: { label: "Required Nested field 2" }, fullWidth: !0 }
811
+ { name: "first", fieldOptions: { label: "Required Nested field 1" }, fullWidth: !0 },
812
+ { name: "second", fieldOptions: { label: "Required Nested field 2" }, fullWidth: !0 }
520
813
  ] }
521
814
  ]
522
815
  }, {
816
+ name: "groupArrays",
523
817
  fieldOptions: { label: "Grouped Array Fields" },
524
818
  type: "heading",
525
819
  children: [
526
- { fieldOptions: { label: "Required group" }, type: "group", maxOccurs: 5, fullWidth: !0, children: [
527
- { fieldOptions: { label: "Required Nested field 1" } },
528
- { fieldOptions: { label: "Required Nested field 2" } }
820
+ { name: "requiredGroups", fieldOptions: { label: "Required group" }, type: "group", maxOccurs: 5, fullWidth: !0, children: [
821
+ { name: "first", fieldOptions: { label: "Required Nested field 1" } },
822
+ { name: "second", fieldOptions: { label: "Required Nested field 2" } }
529
823
  ] },
530
- { fieldOptions: { label: "Optional group" }, type: "group", minOccurs: 0, maxOccurs: 5, fullWidth: !0, children: [
531
- { fieldOptions: { label: "Required Nested field 1" } },
532
- { fieldOptions: { label: "Required Nested field 2" } }
824
+ { name: "optionalGroups", fieldOptions: { label: "Optional group" }, type: "group", minOccurs: 0, maxOccurs: 5, fullWidth: !0, children: [
825
+ { name: "first", fieldOptions: { label: "Required Nested field 1" } },
826
+ { name: "second", fieldOptions: { label: "Required Nested field 2" } }
533
827
  ] }
534
828
  ]
535
- }]), Ye = $([
829
+ }]), Xt = {
830
+ groups: {
831
+ requiredGroup: { first: "Ada", second: "Lovelace" },
832
+ optionalGroup: { first: "Grace", second: "Hopper" }
833
+ },
834
+ groupArrays: {
835
+ requiredGroups: [
836
+ { first: "Alan", second: "Turing" },
837
+ { first: "Edsger", second: "Dijkstra" }
838
+ ],
839
+ optionalGroups: [
840
+ { first: "Barbara", second: "Liskov" }
841
+ ]
842
+ }
843
+ }, Mt = m([
536
844
  {
845
+ name: "simpleChoiceSection",
537
846
  fieldOptions: { label: "Choice Fields (minOccurs 1, maxOccurs 1)" },
538
847
  type: "heading",
539
848
  children: [
540
- { fieldOptions: { label: "Simple Choice Field" }, fullWidth: !0, description: "In a choice field, only 1 of the fields can be filled in.", choice: [
541
- { fieldOptions: { label: "Nested Field 1" } },
542
- { fieldOptions: { label: "Nested Field 2" } }
849
+ { name: "contactMethod", fieldOptions: { label: "Simple Choice Field" }, fullWidth: !0, description: "In a choice field, only 1 of the fields can be filled in.", choice: [
850
+ { name: "primary", fieldOptions: { label: "Nested Field 1" } },
851
+ { name: "secondary", fieldOptions: { label: "Nested Field 2" } }
543
852
  ] }
544
853
  ]
545
854
  },
546
855
  {
856
+ name: "groupedChoiceSection",
547
857
  fieldOptions: { label: "Choice Grouped Fields (minOccurs 1, maxOccurs 3)" },
548
858
  type: "heading",
549
859
  children: [
550
- { 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: [
551
- { fieldOptions: { label: "Nested Field 1" }, type: "group", children: [
552
- { fieldOptions: { label: "Nested Child Field 1" }, fullWidth: !0 },
553
- { fieldOptions: { label: "Nested Child Field 2" }, fullWidth: !0 }
860
+ { 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: [
861
+ { name: "optionA", fieldOptions: { label: "Nested Field 1" }, type: "group", children: [
862
+ { name: "detail1", fieldOptions: { label: "Nested Child Field 1" }, fullWidth: !0 },
863
+ { name: "detail2", fieldOptions: { label: "Nested Child Field 2" }, fullWidth: !0 }
554
864
  ] },
555
- { fieldOptions: { label: "Nested Field 2" }, type: "group", children: [
556
- { fieldOptions: { label: "Nested Child Field 1" }, fullWidth: !0 },
557
- { fieldOptions: { label: "Nested Child Field 2" }, fullWidth: !0 }
865
+ { name: "optionB", fieldOptions: { label: "Nested Field 2" }, type: "group", children: [
866
+ { name: "detail1", fieldOptions: { label: "Nested Child Field 1" }, fullWidth: !0 },
867
+ { name: "detail2", fieldOptions: { label: "Nested Child Field 2" }, fullWidth: !0 }
558
868
  ] }
559
869
  ] }
560
870
  ]
561
871
  },
562
872
  {
873
+ name: "arrayChoiceSection",
563
874
  fieldOptions: { label: "Choice Array Fields (minOccurs 1, maxOccurs 3)" },
564
875
  type: "heading",
565
876
  children: [
566
- { 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: [
567
- { fieldOptions: { label: "Nested Field 1" }, maxOccurs: 3 },
568
- { fieldOptions: { label: "Nested Field 2" }, maxOccurs: 3 }
877
+ { 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: [
878
+ { name: "optionA", fieldOptions: { label: "Nested Field 1" }, maxOccurs: 3 },
879
+ { name: "optionB", fieldOptions: { label: "Nested Field 2" }, maxOccurs: 3 }
569
880
  ] }
570
881
  ]
571
882
  }
572
- ]), Qe = $([
883
+ ]), ei = {
884
+ // Only one branch per choice carries a value, honouring the mutually exclusive rule.
885
+ simpleChoiceSection: { contactMethod: { primary: "Picked the first branch" } },
886
+ groupedChoiceSection: {
887
+ pick: { optionA: [{ detail1: "Group A, item 1a", detail2: "Group A, item 1b" }] }
888
+ },
889
+ arrayChoiceSection: {
890
+ pick: { optionA: ["First entry", "Second entry"] }
891
+ }
892
+ }, ti = m([
573
893
  {
574
894
  fieldOptions: { label: "Personal Info" },
575
895
  type: "heading",
@@ -602,7 +922,611 @@ You can test it by filling in one of the fields.`, children: [
602
922
  lastName: "Smit"
603
923
  }
604
924
  }
605
- }), Xe = $(
925
+ }), ii = {
926
+ person: {
927
+ firstName: "Ada",
928
+ lastName: "Lovelace",
929
+ email: "ada@example.com"
930
+ },
931
+ address: {
932
+ street: "Baker Street 221B",
933
+ city: "London",
934
+ country: "United Kingdom"
935
+ }
936
+ }, ai = m([
937
+ {
938
+ name: "inputs",
939
+ fieldOptions: { label: "All Input Types" },
940
+ type: "heading",
941
+ description: "Every dedicated input slot plus the default fallback, in both handleChange and v-model binding styles.",
942
+ children: [
943
+ { name: "text", type: "text", fieldOptions: { label: "Text" } },
944
+ { name: "textBoundByVModel", type: "textBoundByVModel", fieldOptions: { label: "Text (v-model)" } },
945
+ { name: "select", type: "select", fieldOptions: { label: "Select" }, options: [
946
+ { key: "option1", value: "Option 1" },
947
+ { key: "option2", value: "Option 2" },
948
+ { key: "option3", value: "Option 3" }
949
+ ] },
950
+ { name: "selectBoundByVModel", type: "selectBoundByVModel", fieldOptions: { label: "Select (v-model)" }, options: [
951
+ { key: "option1", value: "Option 1" },
952
+ { key: "option2", value: "Option 2" },
953
+ { key: "option3", value: "Option 3" }
954
+ ] },
955
+ { name: "checkbox", type: "checkbox", minOccurs: 0, fieldOptions: { label: "Checkbox" } },
956
+ { name: "checkboxBoundByVModel", type: "checkboxBoundByVModel", minOccurs: 0, fieldOptions: { label: "Checkbox (v-model)" } },
957
+ { name: "noType", fieldOptions: { label: "No type (default-input fallback)" } }
958
+ ]
959
+ },
960
+ {
961
+ name: "staticProps",
962
+ fieldOptions: { label: "Static Field Props" },
963
+ type: "heading",
964
+ description: "One field here has hidden: true and should not render at all.",
965
+ children: [
966
+ { name: "optionalField", minOccurs: 0, fieldOptions: { label: "Optional field (minOccurs 0)" } },
967
+ { name: "disabledField", minOccurs: 0, disabled: !0, fieldOptions: { label: "Disabled field" } },
968
+ { name: "hiddenField", minOccurs: 0, hidden: !0, fieldOptions: { label: "Hidden field (should not be visible)" } },
969
+ { name: "fullWidthField", minOccurs: 0, fullWidth: !0, fieldOptions: { label: "Full width field" } },
970
+ { name: "describedField", minOccurs: 0, description: "A per-field description rendered below the input.", fieldOptions: { label: "Field with description" } }
971
+ ]
972
+ }
973
+ ]), li = {
974
+ inputs: {
975
+ text: "Hello world",
976
+ textBoundByVModel: "Two-way bound",
977
+ select: "option2",
978
+ selectBoundByVModel: "option3",
979
+ checkbox: !0,
980
+ checkboxBoundByVModel: !1,
981
+ noType: "Fallback input"
982
+ },
983
+ staticProps: {
984
+ optionalField: "Filled optional",
985
+ disabledField: "Preset while disabled",
986
+ fullWidthField: "Spans the full width",
987
+ describedField: "Described value"
988
+ }
989
+ }, ni = m([
990
+ {
991
+ name: "strings",
992
+ fieldOptions: { label: "String Restrictions" },
993
+ type: "heading",
994
+ description: "All fields are optional so only the restriction errors surface.",
995
+ children: [
996
+ { name: "minLength", minOccurs: 0, restriction: { minLength: 3 }, fieldOptions: { label: "minLength 3" } },
997
+ { name: "maxLength", minOccurs: 0, restriction: { maxLength: 5 }, fieldOptions: { label: "maxLength 5" } },
998
+ { name: "length", minOccurs: 0, restriction: { length: 4 }, fieldOptions: { label: "length 4 (exact)" } },
999
+ { 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" } },
1000
+ { name: "enumeration", minOccurs: 0, restriction: { enumeration: ["red", "green", "blue"] }, description: "Only red, green or blue are allowed.", fieldOptions: { label: "enumeration" } },
1001
+ { name: "whiteSpace", minOccurs: 0, restriction: { whiteSpace: "collapse" }, description: "Leading, trailing or double spaces are invalid.", fieldOptions: { label: "whiteSpace collapse" } }
1002
+ ]
1003
+ },
1004
+ {
1005
+ name: "numbers",
1006
+ fieldOptions: { label: "Numeric Restrictions" },
1007
+ type: "heading",
1008
+ children: [
1009
+ { name: "minInclusive", minOccurs: 0, restriction: { minInclusive: 5 }, fieldOptions: { label: "minInclusive 5 (value >= 5)" } },
1010
+ { name: "maxInclusive", minOccurs: 0, restriction: { maxInclusive: 10 }, fieldOptions: { label: "maxInclusive 10 (value <= 10)" } },
1011
+ { name: "minExclusive", minOccurs: 0, restriction: { minExclusive: 0 }, fieldOptions: { label: "minExclusive 0 (value > 0)" } },
1012
+ { name: "maxExclusive", minOccurs: 0, restriction: { maxExclusive: 100 }, fieldOptions: { label: "maxExclusive 100 (value < 100)" } },
1013
+ { name: "fractionDigits", minOccurs: 0, restriction: { fractionDigits: 2 }, fieldOptions: { label: "fractionDigits 2 (max 2 decimals)" } },
1014
+ { name: "totalDigits", minOccurs: 0, restriction: { totalDigits: 5 }, fieldOptions: { label: "totalDigits 5" } }
1015
+ ]
1016
+ },
1017
+ {
1018
+ name: "mixed",
1019
+ fieldOptions: { label: "Combined & Custom" },
1020
+ type: "heading",
1021
+ children: [
1022
+ { 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" } },
1023
+ { name: "requiredWithRestriction", restriction: { minLength: 3 }, fieldOptions: { label: "Required + minLength 3" } },
1024
+ { name: "customValidation", minOccurs: 0, validation: (u) => !u || String(u).startsWith("A") || 'Value must start with "A"', description: "Custom vee-validate function via the validation property.", fieldOptions: { label: "Custom validation function" } }
1025
+ ]
1026
+ }
1027
+ ]), si = {
1028
+ // Every value here satisfies its restriction, so loading the sample form validates cleanly.
1029
+ strings: {
1030
+ minLength: "abcd",
1031
+ maxLength: "abc",
1032
+ length: "code",
1033
+ pattern: "AB-123",
1034
+ enumeration: "green",
1035
+ whiteSpace: "clean text"
1036
+ },
1037
+ numbers: {
1038
+ minInclusive: "7",
1039
+ maxInclusive: "9",
1040
+ minExclusive: "3",
1041
+ maxExclusive: "42",
1042
+ fractionDigits: "3.14",
1043
+ totalDigits: "12345"
1044
+ },
1045
+ mixed: {
1046
+ combined: "hello",
1047
+ requiredWithRestriction: "valid",
1048
+ customValidation: "Apple"
1049
+ }
1050
+ }, oi = m([
1051
+ {
1052
+ name: "occurrences",
1053
+ fieldOptions: { label: "Occurrence Variants" },
1054
+ type: "heading",
1055
+ children: [
1056
+ { 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" } },
1057
+ { 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" } },
1058
+ { name: "manyAllowed", minOccurs: 0, maxOccurs: 10, fieldOptions: { label: "Optional, up to 10 items" } }
1059
+ ]
1060
+ },
1061
+ {
1062
+ name: "typedArrays",
1063
+ fieldOptions: { label: "Arrays of Other Input Types" },
1064
+ type: "heading",
1065
+ children: [
1066
+ { name: "selects", type: "select", minOccurs: 0, maxOccurs: 3, fieldOptions: { label: "Select array (max 3)" }, options: [
1067
+ { key: "option1", value: "Option 1" },
1068
+ { key: "option2", value: "Option 2" }
1069
+ ] },
1070
+ { name: "checkboxes", type: "checkbox", minOccurs: 0, maxOccurs: 3, fieldOptions: { label: "Checkbox array (max 3)" } },
1071
+ { name: "vModelTexts", type: "textBoundByVModel", minOccurs: 0, maxOccurs: 3, fieldOptions: { label: "v-model text array (max 3)" } }
1072
+ ]
1073
+ }
1074
+ ]), di = {
1075
+ occurrences: {
1076
+ manualFirstItem: ["Added by hand"],
1077
+ prefilledToMin: ["First", "Second"],
1078
+ manyAllowed: ["One", "Two", "Three"]
1079
+ },
1080
+ typedArrays: {
1081
+ selects: ["option1", "option2"],
1082
+ checkboxes: [!0, !1],
1083
+ vModelTexts: ["Alpha", "Beta"]
1084
+ }
1085
+ }, ri = m([
1086
+ {
1087
+ name: "overLimit",
1088
+ fieldOptions: { label: "Over-limit Arrays (loaded from initialValues)" },
1089
+ type: "heading",
1090
+ children: [
1091
+ { 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." },
1092
+ { 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." }
1093
+ ]
1094
+ }
1095
+ ]), ci = {
1096
+ overLimit: {
1097
+ requiredItems: ["First", "Second", "Third"],
1098
+ optionalItems: ["One", "Two", "Three"]
1099
+ }
1100
+ }, ui = m([
1101
+ {
1102
+ name: "optionalChoice",
1103
+ fieldOptions: { label: "Optional Choice (minOccurs 0)" },
1104
+ type: "heading",
1105
+ children: [
1106
+ { 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: [
1107
+ { name: "email", fieldOptions: { label: "Email" } },
1108
+ { name: "phone", fieldOptions: { label: "Phone" } }
1109
+ ] }
1110
+ ]
1111
+ },
1112
+ {
1113
+ name: "twoOccurrence",
1114
+ fieldOptions: { label: "Choice Requiring 2 Occurrences (minOccurs 2, maxOccurs 4)" },
1115
+ type: "heading",
1116
+ children: [
1117
+ { 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: [
1118
+ { name: "email", fieldOptions: { label: "Email" } },
1119
+ { name: "phone", fieldOptions: { label: "Phone" } }
1120
+ ] }
1121
+ ]
1122
+ },
1123
+ {
1124
+ name: "differentLimits",
1125
+ fieldOptions: { label: "Branches With Different Limits (maxOccurs 3)" },
1126
+ type: "heading",
1127
+ children: [
1128
+ { 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: [
1129
+ { name: "branchA", maxOccurs: 2, fieldOptions: { label: "Branch A (maxOccurs 2)" } },
1130
+ { name: "branchB", maxOccurs: 1, fieldOptions: { label: "Branch B (maxOccurs 1)" } }
1131
+ ] }
1132
+ ]
1133
+ },
1134
+ {
1135
+ name: "totalCap",
1136
+ fieldOptions: { label: "Branch Total Cap (maxOccursTotal, maxOccurs 4)" },
1137
+ type: "heading",
1138
+ children: [
1139
+ { 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: [
1140
+ { name: "capped", maxOccurs: 2, maxOccursTotal: 3, fieldOptions: { label: "Capped (maxOccurs 2, maxOccursTotal 3)" } },
1141
+ { name: "uncapped", maxOccurs: 2, fieldOptions: { label: "Uncapped (maxOccurs 2)" } }
1142
+ ] }
1143
+ ]
1144
+ },
1145
+ {
1146
+ name: "singleBranchCap",
1147
+ fieldOptions: { label: "Single-Branch Total Cap (maxOccursTotal 2)" },
1148
+ type: "heading",
1149
+ children: [
1150
+ { 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: [
1151
+ { name: "tag", maxOccurs: 3, maxOccursTotal: 2, fieldOptions: { label: "Tag (maxOccurs 3, maxOccursTotal 2)" } }
1152
+ ] },
1153
+ { 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: [
1154
+ { name: "item", maxOccurs: 2, maxOccursTotal: 5, fieldOptions: { label: "Item (maxOccurs 2, maxOccursTotal 5)" } }
1155
+ ] }
1156
+ ]
1157
+ }
1158
+ ]), pi = {
1159
+ optionalChoice: { contact: { email: "ada@example.com" } },
1160
+ // Two filled email occurrences satisfy the minOccurs 2 requirement.
1161
+ twoOccurrence: { contact: { email: ["ada@example.com", "grace@example.com"] } },
1162
+ differentLimits: { entries: { branchA: ["A-one", "A-two"] } },
1163
+ totalCap: { entries: { capped: ["C-one", "C-two"] } },
1164
+ // Both single branches filled exactly to their effective cap, so every add button is disabled.
1165
+ singleBranchCap: { tags: { tag: ["T-one", "T-two"] }, clamped: { item: ["I-one", "I-two"] } }
1166
+ }, mi = m([
1167
+ {
1168
+ name: "tooManyBranches",
1169
+ fieldOptions: { label: "Choice Over maxOccurs (auto mode, maxOccurs 1)" },
1170
+ type: "heading",
1171
+ children: [
1172
+ { 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: [
1173
+ { name: "email", fieldOptions: { label: "Email" } },
1174
+ { name: "phone", fieldOptions: { label: "Phone" } }
1175
+ ] }
1176
+ ]
1177
+ },
1178
+ {
1179
+ name: "branchOverTotal",
1180
+ fieldOptions: { label: "Branch Over maxOccursTotal (maxOccurs 4)" },
1181
+ type: "heading",
1182
+ children: [
1183
+ { 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: [
1184
+ { name: "capped", maxOccurs: 3, maxOccursTotal: 2, fieldOptions: { label: "Capped (maxOccursTotal 2)" } },
1185
+ { name: "uncapped", maxOccurs: 3, fieldOptions: { label: "Uncapped" } }
1186
+ ] }
1187
+ ]
1188
+ },
1189
+ {
1190
+ name: "singleBranchOverTotal",
1191
+ fieldOptions: { label: "Single Branch Over maxOccursTotal" },
1192
+ type: "heading",
1193
+ children: [
1194
+ { 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: [
1195
+ { name: "tag", maxOccurs: 3, maxOccursTotal: 2, fieldOptions: { label: "Tag (maxOccursTotal 2)" } }
1196
+ ] }
1197
+ ]
1198
+ }
1199
+ ]), hi = {
1200
+ tooManyBranches: { contact: { email: "ada@example.com", phone: "555-0100" } },
1201
+ branchOverTotal: { entries: { capped: ["C-one", "C-two", "C-three"] } },
1202
+ singleBranchOverTotal: { tags: { tag: ["T-one", "T-two", "T-three"] } }
1203
+ }, bi = m([
1204
+ {
1205
+ name: "explicitSection",
1206
+ fieldOptions: { label: "Explicit Choice (selection-first)" },
1207
+ type: "heading",
1208
+ children: [
1209
+ { 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: [
1210
+ { name: "email", type: "group", fieldOptions: { label: "Email" }, children: [
1211
+ { name: "address", fullWidth: !0, fieldOptions: { label: "Email address" } }
1212
+ ] },
1213
+ { name: "phone", type: "group", fieldOptions: { label: "Phone" }, children: [
1214
+ { name: "number", fullWidth: !0, fieldOptions: { label: "Phone number" } },
1215
+ { name: "allowSms", type: "checkbox", minOccurs: 0, fieldOptions: { label: "Allow SMS" } }
1216
+ ] }
1217
+ ] }
1218
+ ]
1219
+ }
1220
+ ]), fi = {
1221
+ // A loaded value auto-selects its branch, even though nothing was clicked.
1222
+ explicitSection: { contact: { email: { address: "jane@example.com" } } }
1223
+ }, Oi = m([
1224
+ {
1225
+ name: "preserveSection",
1226
+ fieldOptions: { label: "Explicit Choice With preserveOnSwitch" },
1227
+ type: "heading",
1228
+ children: [
1229
+ { 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: [
1230
+ { name: "email", type: "group", fieldOptions: { label: "Email" }, children: [
1231
+ { name: "address", fullWidth: !0, fieldOptions: { label: "Email address" } }
1232
+ ] },
1233
+ { name: "phone", type: "group", fieldOptions: { label: "Phone" }, children: [
1234
+ { name: "number", fullWidth: !0, fieldOptions: { label: "Phone number" } }
1235
+ ] }
1236
+ ] }
1237
+ ]
1238
+ }
1239
+ ]), gi = {
1240
+ preserveSection: { contact: { email: { address: "restore@example.com" } } }
1241
+ }, yi = m([
1242
+ {
1243
+ name: "integrationsSection",
1244
+ fieldOptions: { label: "Explicit Repeatable Choice (maxOccurs 5)" },
1245
+ type: "heading",
1246
+ children: [
1247
+ { 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: [
1248
+ { name: "crmExport", maxOccurs: 1, maxOccursTotal: 3, fullWidth: !0, fieldOptions: { label: "CRM export" }, children: [
1249
+ { name: "crmSystem", fieldOptions: { label: "CRM system" } },
1250
+ { name: "exportSchedule", fieldOptions: { label: "Export schedule" } }
1251
+ ] },
1252
+ { name: "apiEndpoint", maxOccurs: 1, maxOccursTotal: 3, fullWidth: !0, fieldOptions: { label: "API endpoint" }, children: [
1253
+ { name: "url", fieldOptions: { label: "Endpoint URL" } },
1254
+ { name: "apiKey", fieldOptions: { label: "API key" } }
1255
+ ] }
1256
+ ] }
1257
+ ]
1258
+ }
1259
+ ]), xi = {
1260
+ // A mix of both kinds; each branch is its own array of occurrences.
1261
+ integrationsSection: {
1262
+ integrations: {
1263
+ crmExport: [
1264
+ { crmSystem: "Salesforce", exportSchedule: "Nightly" }
1265
+ ],
1266
+ apiEndpoint: [
1267
+ { url: "https://api.example.com/orders", apiKey: "key-1234" },
1268
+ { url: "https://api.example.com/customers", apiKey: "key-5678" }
1269
+ ]
1270
+ }
1271
+ }
1272
+ }, vi = m([
1273
+ {
1274
+ name: "timelineSection",
1275
+ fieldOptions: { label: "Repeatable Explicit Choice (displayOrder: added)" },
1276
+ type: "heading",
1277
+ children: [
1278
+ { 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: [
1279
+ { name: "note", maxOccurs: 6, fullWidth: !0, fieldOptions: { label: "Note" }, children: [
1280
+ { name: "text", fullWidth: !0, fieldOptions: { label: "Note text" } }
1281
+ ] },
1282
+ { name: "milestone", maxOccurs: 6, fullWidth: !0, fieldOptions: { label: "Milestone" }, children: [
1283
+ { name: "title", fieldOptions: { label: "Milestone title" } },
1284
+ { name: "owner", fieldOptions: { label: "Owner" } }
1285
+ ] }
1286
+ ] }
1287
+ ]
1288
+ }
1289
+ ]), wi = {
1290
+ // Both pre-loaded occurrences lack an add-order, so they render first in grouped order;
1291
+ // anything added afterwards appends below them in add-press order.
1292
+ timelineSection: {
1293
+ events: {
1294
+ note: [{ text: "Loaded note (sorts first, grouped)" }],
1295
+ milestone: [{ title: "Loaded milestone", owner: "Ada" }]
1296
+ }
1297
+ }
1298
+ }, ki = m([
1299
+ {
1300
+ name: "stepsSection",
1301
+ fieldOptions: { label: "Repeatable Explicit Choice (preserveOrder + displayOrder: added)" },
1302
+ type: "heading",
1303
+ children: [
1304
+ { 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: [
1305
+ { name: "manual", maxOccurs: 6, fullWidth: !0, fieldOptions: { label: "Manual step" }, children: [
1306
+ { name: "instruction", fullWidth: !0, fieldOptions: { label: "Instruction" } }
1307
+ ] },
1308
+ { name: "automated", maxOccurs: 6, fullWidth: !0, fieldOptions: { label: "Automated step" }, children: [
1309
+ { name: "script", fullWidth: !0, fieldOptions: { label: "Script" } }
1310
+ ] }
1311
+ ] }
1312
+ ]
1313
+ }
1314
+ ]), Ci = {
1315
+ // Neither pre-loaded occurrence carries "order"; the mount-time backfill assigns 1 and 2 from
1316
+ // their grouped position before any add-press can occur.
1317
+ stepsSection: {
1318
+ steps: {
1319
+ manual: [{ instruction: "Backfilled order 1" }],
1320
+ automated: [{ script: "deploy.sh" }]
1321
+ }
1322
+ }
1323
+ }, Ti = m([
1324
+ {
1325
+ name: "labelsSection",
1326
+ fieldOptions: { label: "preserveOrder With a Scalar-Leaf Branch (per-branch no-op)" },
1327
+ type: "heading",
1328
+ children: [
1329
+ { 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: [
1330
+ { name: "labelled", maxOccurs: 6, fullWidth: !0, fieldOptions: { label: "Labelled item (object branch)" }, children: [
1331
+ { name: "label", fullWidth: !0, fieldOptions: { label: "Label" } }
1332
+ ] },
1333
+ { name: "tag", maxOccurs: 6, type: "text", fullWidth: !0, fieldOptions: { label: "Tag (scalar branch, no order)" } }
1334
+ ] }
1335
+ ]
1336
+ }
1337
+ ]), Vi = {
1338
+ labelsSection: {
1339
+ items: {
1340
+ labelled: [{ label: "Has an order field" }],
1341
+ tag: ["plain-tag-no-order"]
1342
+ }
1343
+ }
1344
+ }, _i = m([
1345
+ {
1346
+ name: "ownValue",
1347
+ fieldOptions: { label: "Reacting to Own Value" },
1348
+ type: "heading",
1349
+ children: [
1350
+ { name: "charCounter", minOccurs: 0, restriction: { maxLength: 10 }, fieldOptions: { label: "Character counter" }, computedProps: [
1351
+ (u, h) => {
1352
+ const d = typeof h.value == "string" ? h.value.length : 0;
1353
+ u.description = `${10 - d} character(s) remaining`;
1354
+ }
1355
+ ] },
1356
+ { name: "selfHiding", minOccurs: 0, fieldOptions: { label: 'Type "hide" to hide me' }, computedProps: [
1357
+ (u, h) => {
1358
+ h.value === "hide" && (u.hidden = !0);
1359
+ }
1360
+ ] },
1361
+ { name: "selfDisabling", minOccurs: 0, fieldOptions: { label: 'Type "lock" to disable me' }, computedProps: [
1362
+ (u, h) => {
1363
+ h.value === "lock" && (u.disabled = !0);
1364
+ }
1365
+ ] }
1366
+ ]
1367
+ },
1368
+ {
1369
+ name: "progress",
1370
+ fieldOptions: { label: "Parent Reacting to Child Values (computeOnChildValueChange)" },
1371
+ type: "heading",
1372
+ computeOnChildValueChange: !0,
1373
+ computedProps: [
1374
+ (u, h) => {
1375
+ const c = Object.values(h.value ?? {}).filter((e) => e != null && e !== "").length;
1376
+ u.description = `${c} of 3 fields filled in`;
1377
+ }
1378
+ ],
1379
+ children: [
1380
+ { name: "first", minOccurs: 0, fieldOptions: { label: "First" } },
1381
+ { name: "second", minOccurs: 0, fieldOptions: { label: "Second" } },
1382
+ { name: "third", minOccurs: 0, fieldOptions: { label: "Third" } }
1383
+ ]
1384
+ },
1385
+ {
1386
+ name: "childFieldsDemo",
1387
+ fieldOptions: { label: "Parent Reacting to Child Computed State (childFields)" },
1388
+ type: "heading",
1389
+ description: 'Each child hides itself when its value is "hide"; once every child is hidden the parent heading hides too.',
1390
+ computedProps: [
1391
+ (u, h, d) => {
1392
+ d.value.length > 0 && d.value.every((c) => c.hidden) && (u.hidden = !0);
1393
+ }
1394
+ ],
1395
+ children: [
1396
+ { name: "childA", minOccurs: 0, fieldOptions: { label: 'Child A (type "hide")' }, computedProps: [
1397
+ (u, h) => {
1398
+ h.value === "hide" && (u.hidden = !0);
1399
+ }
1400
+ ] },
1401
+ { name: "childB", minOccurs: 0, fieldOptions: { label: 'Child B (type "hide")' }, computedProps: [
1402
+ (u, h) => {
1403
+ h.value === "hide" && (u.hidden = !0);
1404
+ }
1405
+ ] }
1406
+ ]
1407
+ }
1408
+ ]), Si = {
1409
+ // Values that stay visible/enabled (typing "hide"/"lock" would trigger the self-hiding demos).
1410
+ ownValue: { charCounter: "Counting", selfHiding: "still shown", selfDisabling: "still on" },
1411
+ progress: { first: "Filled one", second: "Filled two" },
1412
+ childFieldsDemo: { childA: "kept visible" }
1413
+ }, Wi = m([
1414
+ {
1415
+ name: "attributes",
1416
+ fieldOptions: { label: "Attributes" },
1417
+ type: "heading",
1418
+ description: "Attributes render once the parent field has a value; the value becomes an object like { value, ...attributes }. Check the debug output below.",
1419
+ children: [
1420
+ { name: "nickname", minOccurs: 0, fullWidth: !0, fieldOptions: { label: "Optional attribute (lang)" }, attributes: [
1421
+ { name: "lang", minOccurs: 0, fieldOptions: { label: "Language" } }
1422
+ ] },
1423
+ { name: "verifiedPhone", fullWidth: !0, fieldOptions: { label: "Required attribute (certainty)" }, attributes: [
1424
+ { name: "certainty", type: "select", fieldOptions: { label: "Certainty" }, options: [
1425
+ { key: "verified", value: "Verified" },
1426
+ { key: "unverified", value: "Unverified" }
1427
+ ] }
1428
+ ] }
1429
+ ]
1430
+ },
1431
+ {
1432
+ name: "complexTypes",
1433
+ fieldOptions: { label: "Complex Types" },
1434
+ type: "heading",
1435
+ children: [
1436
+ { name: "complexValue", minOccurs: 0, fullWidth: !0, isComplexType: !0, description: "isComplexType without attributes: the value is stored as { value: ... }.", fieldOptions: { label: "isComplexType" } }
1437
+ ]
1438
+ }
1439
+ ]), Fi = {
1440
+ attributes: {
1441
+ // A complex type stores its value plus each attribute under one object.
1442
+ nickname: { value: "Ace", lang: "en" },
1443
+ verifiedPhone: { value: "+31 6 1234 5678", certainty: "verified" }
1444
+ },
1445
+ complexTypes: {
1446
+ complexValue: { value: "Wrapped in { value }" }
1447
+ }
1448
+ }, $i = m([
1449
+ {
1450
+ name: "customValueProp",
1451
+ fieldOptions: { label: "Custom complexTypeValueProperty" },
1452
+ type: "heading",
1453
+ description: 'The settings rename the complex type value property to "val", so the debug output shows { val: ..., lang: ... }.',
1454
+ children: [
1455
+ { name: "title", minOccurs: 0, fullWidth: !0, fieldOptions: { label: "Title with lang attribute" }, attributes: [
1456
+ { name: "lang", minOccurs: 0, fieldOptions: { label: "Language" } }
1457
+ ] }
1458
+ ]
1459
+ }
1460
+ ], {
1461
+ complexTypeValueProperty: "val"
1462
+ }), Ai = {
1463
+ // The value lives under "val" (not "value") because of the complexTypeValueProperty setting.
1464
+ customValueProp: { title: { val: "Hello world", lang: "en" } }
1465
+ };
1466
+ function J(u, h) {
1467
+ return m([
1468
+ {
1469
+ name: "timing",
1470
+ fieldOptions: { label: "Validation Timing" },
1471
+ type: "heading",
1472
+ description: u,
1473
+ children: [
1474
+ { name: "requiredField", fieldOptions: { label: "Required field" } },
1475
+ { name: "maxLengthField", minOccurs: 0, restriction: { maxLength: 5 }, fieldOptions: { label: "maxLength 5" } }
1476
+ ]
1477
+ }
1478
+ ], h);
1479
+ }
1480
+ const Bi = {
1481
+ timing: { requiredField: "Filled in", maxLengthField: "abc" }
1482
+ }, Ni = J(
1483
+ "validateOnValueUpdate: false, validateWhenInError: false. Errors only appear on submit and stay unchanged while typing until the next submit.",
1484
+ { validateOnValueUpdate: !1, validateWhenInError: !1 }
1485
+ ), Pi = J(
1486
+ "validateOnBlur: true, validateOnValueUpdate: false. Errors appear when leaving a field, not while typing.",
1487
+ { validateOnBlur: !0, validateOnValueUpdate: !1 }
1488
+ ), qi = J(
1489
+ "validateOnValueUpdateAfterSubmit: true, validateOnValueUpdate: false. Typing does not validate until the first submit; after that every change validates.",
1490
+ { validateOnValueUpdateAfterSubmit: !0, validateOnValueUpdate: !1 }
1491
+ ), Li = J(
1492
+ "validateOnValueUpdate: false, validateWhenInError: true. A field only starts live-validating once it is in error (after a submit).",
1493
+ { validateOnValueUpdate: !1, validateWhenInError: !0 }
1494
+ ), Ei = m([
1495
+ {
1496
+ name: "optionalMarkers",
1497
+ fieldOptions: { label: 'Show "(optional)" Instead of "*"' },
1498
+ type: "heading",
1499
+ description: "With showOptionalInsteadOfRequired the required markers disappear and optional fields are marked instead.",
1500
+ children: [
1501
+ { name: "requiredField", fieldOptions: { label: "Required field" } },
1502
+ { name: "optionalField", minOccurs: 0, fieldOptions: { label: "Optional field" } }
1503
+ ]
1504
+ }
1505
+ ], {
1506
+ showOptionalInsteadOfRequired: !0
1507
+ }), Ii = {
1508
+ optionalMarkers: { requiredField: "Required value", optionalField: "Optional value" }
1509
+ }, zi = m([
1510
+ {
1511
+ name: "messages",
1512
+ fieldOptions: { label: "Custom Validation Messages" },
1513
+ type: "heading",
1514
+ description: "The settings override the required, maxLength and minInclusive messages; rules without an override fall back to the library defaults.",
1515
+ children: [
1516
+ { name: "requiredField", fieldOptions: { label: "Required field" } },
1517
+ { name: "maxLengthField", minOccurs: 0, restriction: { maxLength: 5 }, fieldOptions: { label: "maxLength 5" } },
1518
+ { name: "minInclusiveField", minOccurs: 0, restriction: { minInclusive: 10 }, fieldOptions: { label: "minInclusive 10" } }
1519
+ ]
1520
+ }
1521
+ ], {
1522
+ messages: {
1523
+ required: "Custom message: please fill in {field}",
1524
+ maxLength: "Custom message: {field} must stay under {length} characters",
1525
+ minInclusive: "Custom message: {field} must be {min} or higher"
1526
+ }
1527
+ }), Ri = {
1528
+ messages: { requiredField: "Filled in", maxLengthField: "abcd", minInclusiveField: "15" }
1529
+ }, Ui = m(
606
1530
  [{
607
1531
  name: "items",
608
1532
  type: "text",
@@ -616,20 +1540,529 @@ You can test it by filling in one of the fields.`, children: [
616
1540
  // validateWhenInError: true,
617
1541
  // validateOnBlur: true,
618
1542
  }
619
- );
620
- function $(b, k, c = {}) {
621
- return U(B({
622
- render: () => j(je, { ...c, metadata: b, settings: k, showDebugState: !0 })
1543
+ ), Di = {
1544
+ // Each repeatable item is a complex type: its text under "value" plus the lang attribute.
1545
+ items: [
1546
+ { value: "First item", lang: "en" },
1547
+ { value: "Second item", lang: "nl" }
1548
+ ]
1549
+ }, I = [
1550
+ { key: "starter", value: "Starter" },
1551
+ { key: "growth", value: "Growth" },
1552
+ { key: "enterprise", value: "Enterprise" }
1553
+ ], Ji = m([{
1554
+ name: "onboarding",
1555
+ wizard: !0,
1556
+ fieldOptions: { label: "Onboarding wizard (backward-only)" },
1557
+ children: [
1558
+ {
1559
+ name: "company",
1560
+ type: "heading",
1561
+ fieldOptions: { label: "Company" },
1562
+ children: [
1563
+ { name: "companyName", fieldOptions: { label: "Company name (required)" }, fullWidth: !0 },
1564
+ { name: "website", minOccurs: 0, fieldOptions: { label: "Website (optional)" }, fullWidth: !0 }
1565
+ ]
1566
+ },
1567
+ {
1568
+ name: "plan",
1569
+ type: "heading",
1570
+ fieldOptions: { label: "Plan" },
1571
+ children: [
1572
+ { name: "planName", type: "select", fieldOptions: { label: "Plan (required)" }, options: I },
1573
+ { name: "seats", minOccurs: 0, fieldOptions: { label: "Seats (optional)" } }
1574
+ ]
1575
+ },
1576
+ {
1577
+ name: "review",
1578
+ type: "heading",
1579
+ fieldOptions: { label: "Review" },
1580
+ children: [
1581
+ { name: "termsAccepted", type: "checkbox", fieldOptions: { label: "I accept the terms (required)" } }
1582
+ ]
1583
+ }
1584
+ ]
1585
+ }]), Gi = {
1586
+ onboarding: {
1587
+ company: { companyName: "Acme Corp", website: "https://acme.example" },
1588
+ plan: { planName: "growth", seats: "25" },
1589
+ review: { termsAccepted: !0 }
1590
+ }
1591
+ }, ji = m([{
1592
+ name: "onboarding",
1593
+ wizard: { allowForwardJump: !0, validateOnJump: !1 },
1594
+ fieldOptions: { label: "Wizard with forward jumping" },
1595
+ children: [
1596
+ {
1597
+ name: "company",
1598
+ type: "heading",
1599
+ fieldOptions: { label: "Company" },
1600
+ children: [{ name: "companyName", fieldOptions: { label: "Company name (required)" }, fullWidth: !0 }]
1601
+ },
1602
+ {
1603
+ name: "plan",
1604
+ type: "heading",
1605
+ fieldOptions: { label: "Plan" },
1606
+ children: [{ name: "planName", type: "select", fieldOptions: { label: "Plan (required)" }, options: I }]
1607
+ },
1608
+ {
1609
+ name: "review",
1610
+ type: "heading",
1611
+ fieldOptions: { label: "Review" },
1612
+ children: [{ name: "termsAccepted", type: "checkbox", fieldOptions: { label: "I accept the terms (required)" } }]
1613
+ }
1614
+ ]
1615
+ }]), Lt = {
1616
+ onboarding: {
1617
+ company: { companyName: "Acme Corp" },
1618
+ plan: { planName: "enterprise" },
1619
+ review: { termsAccepted: !0 }
1620
+ }
1621
+ }, Hi = m([{
1622
+ name: "onboarding",
1623
+ wizard: { allowForwardJump: !0, validateOnJump: !0 },
1624
+ fieldOptions: { label: "Wizard with validate-on-jump" },
1625
+ children: [
1626
+ {
1627
+ name: "company",
1628
+ type: "heading",
1629
+ fieldOptions: { label: "Company" },
1630
+ children: [{ name: "companyName", fieldOptions: { label: "Company name (required)" }, fullWidth: !0 }]
1631
+ },
1632
+ {
1633
+ name: "plan",
1634
+ type: "heading",
1635
+ fieldOptions: { label: "Plan" },
1636
+ children: [{ name: "planName", type: "select", fieldOptions: { label: "Plan (required)" }, options: I }]
1637
+ },
1638
+ {
1639
+ name: "review",
1640
+ type: "heading",
1641
+ fieldOptions: { label: "Review" },
1642
+ children: [{ name: "termsAccepted", type: "checkbox", fieldOptions: { label: "I accept the terms (required)" } }]
1643
+ }
1644
+ ]
1645
+ }]), Ki = Lt, Qi = m([{
1646
+ name: "onboarding",
1647
+ wizard: { allowForwardJump: !0 },
1648
+ fieldOptions: { label: "Wizard with group / array / choice / summary pages" },
1649
+ children: [
1650
+ {
1651
+ name: "company",
1652
+ type: "heading",
1653
+ fieldOptions: { label: "Company (group page)" },
1654
+ children: [
1655
+ { name: "companyName", fieldOptions: { label: "Company name (required)" }, fullWidth: !0 }
1656
+ ]
1657
+ },
1658
+ {
1659
+ name: "contacts",
1660
+ type: "heading",
1661
+ maxOccurs: 4,
1662
+ minOccurs: 1,
1663
+ fullWidth: !0,
1664
+ fieldOptions: { label: "Contacts (repeatable array page)" },
1665
+ children: [
1666
+ { name: "fullName", fieldOptions: { label: "Full name" } },
1667
+ { name: "email", minOccurs: 0, fieldOptions: { label: "Email (optional)" } }
1668
+ ]
1669
+ },
1670
+ {
1671
+ name: "launchApproach",
1672
+ type: "heading",
1673
+ fullWidth: !0,
1674
+ fieldOptions: { label: "Launch approach (choice page)" },
1675
+ choice: [
1676
+ { name: "selfServe", type: "group", fieldOptions: { label: "Self serve" }, children: [
1677
+ { name: "startDate", fieldOptions: { label: "Start date" } }
1678
+ ] },
1679
+ { name: "guidedRollout", type: "group", fieldOptions: { label: "Guided rollout" }, children: [
1680
+ { name: "accountManager", fieldOptions: { label: "Account manager" } }
1681
+ ] }
1682
+ ]
1683
+ },
1684
+ {
1685
+ name: "summary",
1686
+ type: "heading",
1687
+ fieldOptions: { label: "Summary (field-less page)" }
1688
+ }
1689
+ ]
1690
+ }]), Yi = {
1691
+ onboarding: {
1692
+ company: { companyName: "Acme Corp" },
1693
+ contacts: [
1694
+ { fullName: "Ada Lovelace", email: "ada@acme.example" },
1695
+ { fullName: "Grace Hopper" }
1696
+ ],
1697
+ launchApproach: { guidedRollout: { accountManager: "Alan Turing" } }
1698
+ }
1699
+ }, Zi = m([{
1700
+ name: "setupPath",
1701
+ explicitChoiceSelection: !0,
1702
+ fullWidth: !0,
1703
+ fieldOptions: { label: "Pick a setup path (choice of wizards)" },
1704
+ choice: [
1705
+ {
1706
+ name: "quickStart",
1707
+ wizard: { allowForwardJump: !0 },
1708
+ fieldOptions: { label: "Quick start wizard" },
1709
+ children: [
1710
+ { name: "basics", type: "heading", fieldOptions: { label: "Basics" }, children: [
1711
+ { name: "projectName", fieldOptions: { label: "Project name (required)" }, fullWidth: !0 }
1712
+ ] },
1713
+ { name: "done", type: "heading", fieldOptions: { label: "Done" }, children: [
1714
+ { name: "confirm", type: "checkbox", fieldOptions: { label: "Looks good (required)" } }
1715
+ ] }
1716
+ ]
1717
+ },
1718
+ {
1719
+ name: "guidedSetup",
1720
+ wizard: { allowForwardJump: !0 },
1721
+ fieldOptions: { label: "Guided setup wizard" },
1722
+ children: [
1723
+ { name: "company", type: "heading", fieldOptions: { label: "Company" }, children: [
1724
+ { name: "companyName", fieldOptions: { label: "Company name (required)" }, fullWidth: !0 }
1725
+ ] },
1726
+ { name: "plan", type: "heading", fieldOptions: { label: "Plan" }, children: [
1727
+ { name: "planName", type: "select", fieldOptions: { label: "Plan (required)" }, options: I }
1728
+ ] },
1729
+ { name: "review", type: "heading", fieldOptions: { label: "Review" }, children: [
1730
+ { name: "termsAccepted", type: "checkbox", fieldOptions: { label: "Accept terms (required)" } }
1731
+ ] }
1732
+ ]
1733
+ }
1734
+ ]
1735
+ }]), Xi = {
1736
+ setupPath: {
1737
+ guidedSetup: {
1738
+ company: { companyName: "Acme Corp" },
1739
+ plan: { planName: "growth" },
1740
+ review: { termsAccepted: !0 }
1741
+ }
1742
+ }
1743
+ }, Mi = m([{
1744
+ name: "teams",
1745
+ type: "heading",
1746
+ maxOccurs: 3,
1747
+ minOccurs: 1,
1748
+ fullWidth: !0,
1749
+ fieldOptions: { label: "Teams (each team runs its own wizard)" },
1750
+ children: [{
1751
+ name: "setup",
1752
+ wizard: { allowForwardJump: !0 },
1753
+ fieldOptions: { label: "Team setup wizard" },
1754
+ children: [
1755
+ { name: "team", type: "heading", fieldOptions: { label: "Team" }, children: [
1756
+ { name: "teamName", fieldOptions: { label: "Team name (required)" }, fullWidth: !0 }
1757
+ ] },
1758
+ { name: "lead", type: "heading", fieldOptions: { label: "Lead" }, children: [
1759
+ { name: "leadName", fieldOptions: { label: "Lead name (required)" }, fullWidth: !0 }
1760
+ ] }
1761
+ ]
1762
+ }]
1763
+ }]), ea = {
1764
+ teams: [
1765
+ { setup: { team: { teamName: "Platform" }, lead: { leadName: "Ada Lovelace" } } },
1766
+ { setup: { team: { teamName: "Growth" }, lead: { leadName: "Grace Hopper" } } }
1767
+ ]
1768
+ }, ta = m([{
1769
+ name: "onboarding",
1770
+ wizard: { allowForwardJump: !0 },
1771
+ fieldOptions: { label: "Wizard: v-show vs v-if and keepValuesOnUnmount" },
1772
+ children: [
1773
+ {
1774
+ name: "company",
1775
+ type: "heading",
1776
+ fieldOptions: { label: "Company" },
1777
+ children: [{ name: "companyName", minOccurs: 1, fieldOptions: { label: "Company name (type something, then navigate away and back)" }, fullWidth: !0 }]
1778
+ },
1779
+ {
1780
+ name: "plan",
1781
+ type: "heading",
1782
+ fieldOptions: { label: "Plan" },
1783
+ children: [{ name: "planName", minOccurs: 1, fieldOptions: { label: "Plan name" }, fullWidth: !0 }]
1784
+ }
1785
+ ]
1786
+ }]), ia = {
1787
+ onboarding: {
1788
+ company: { companyName: "Acme Corp" },
1789
+ plan: { planName: "Growth" }
1790
+ }
1791
+ }, aa = m([{
1792
+ name: "registration",
1793
+ type: "heading",
1794
+ minOccurs: 0,
1795
+ fieldOptions: { label: "Optional section containing a wizard" },
1796
+ 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.",
1797
+ children: [{
1798
+ name: "onboarding",
1799
+ wizard: !0,
1800
+ fieldOptions: { label: "Onboarding wizard" },
1801
+ children: [
1802
+ {
1803
+ name: "company",
1804
+ type: "heading",
1805
+ fieldOptions: { label: "Company" },
1806
+ children: [
1807
+ { name: "companyName", fieldOptions: { label: "Company name (required once the section has a value)" }, fullWidth: !0 },
1808
+ { name: "website", minOccurs: 0, fieldOptions: { label: "Website (optional)" }, fullWidth: !0 }
1809
+ ]
1810
+ },
1811
+ {
1812
+ name: "plan",
1813
+ type: "heading",
1814
+ fieldOptions: { label: "Plan" },
1815
+ children: [
1816
+ { name: "planName", type: "select", fieldOptions: { label: "Plan (required once the section has a value)" }, options: I }
1817
+ ]
1818
+ }
1819
+ ]
1820
+ }]
1821
+ }]), la = {
1822
+ registration: {
1823
+ onboarding: {
1824
+ company: { companyName: "Acme Corp" }
1825
+ }
1826
+ }
1827
+ }, na = m([{
1828
+ name: "archived",
1829
+ type: "heading",
1830
+ maxOccurs: 0,
1831
+ fieldOptions: { label: "Disabled section containing a wizard" },
1832
+ description: "The whole section is disabled via maxOccurs: 0. Navigate the wizard: every page field is disabled and Submit passes without validating them.",
1833
+ children: [{
1834
+ name: "onboarding",
1835
+ wizard: { allowForwardJump: !0 },
1836
+ fieldOptions: { label: "Onboarding wizard" },
1837
+ children: [
1838
+ {
1839
+ name: "company",
1840
+ type: "heading",
1841
+ fieldOptions: { label: "Company" },
1842
+ children: [
1843
+ { name: "companyName", fieldOptions: { label: "Company name" }, fullWidth: !0 },
1844
+ { name: "website", minOccurs: 0, fieldOptions: { label: "Website" }, fullWidth: !0 }
1845
+ ]
1846
+ },
1847
+ {
1848
+ name: "plan",
1849
+ type: "heading",
1850
+ fieldOptions: { label: "Plan" },
1851
+ children: [
1852
+ { name: "planName", type: "select", fieldOptions: { label: "Plan" }, options: I }
1853
+ ]
1854
+ }
1855
+ ]
1856
+ }]
1857
+ }]), sa = {
1858
+ archived: {
1859
+ onboarding: {
1860
+ company: { companyName: "Acme Corp", website: "https://acme.example" },
1861
+ plan: { planName: "growth" }
1862
+ }
1863
+ }
1864
+ };
1865
+ function m(u, h, d = {}) {
1866
+ return X(E({
1867
+ // Overridable at runtime so a Storybook control can flip a case between empty and pre-filled
1868
+ // without a second component; an unset prop falls back to the baked testCaseConfig/settings.
1869
+ props: {
1870
+ initialValues: { type: Object, default: void 0 },
1871
+ initialEdit: { type: Boolean, default: void 0 },
1872
+ hideFieldsWithoutValue: { type: Boolean, default: void 0 },
1873
+ settings: { type: Object, default: void 0 },
1874
+ keepValuesOnUnmount: { type: Boolean, default: void 0 }
1875
+ },
1876
+ setup: (c) => () => M(G, {
1877
+ metadata: u,
1878
+ settings: c.settings ?? h,
1879
+ showDebugState: !0,
1880
+ initialValues: c.initialValues ?? d.initialValues,
1881
+ initialEdit: c.initialEdit ?? d.initialEdit,
1882
+ hideFieldsWithoutValue: c.hideFieldsWithoutValue ?? d.hideFieldsWithoutValue,
1883
+ keepValuesOnUnmount: c.keepValuesOnUnmount
1884
+ })
623
1885
  }));
624
1886
  }
1887
+ const Et = { class: "flex flex-col gap-4" }, It = { class: "flex gap-6 flex-wrap" }, zt = { class: "flex items-center gap-2" }, Rt = { class: "flex items-center gap-2" }, oa = /* @__PURE__ */ E({
1888
+ __name: "KeepValuesOnUnmountTestCase",
1889
+ setup(u) {
1890
+ const h = L(!0), d = L(!1), c = U(() => [
1891
+ ...h.value ? [{
1892
+ name: "contact",
1893
+ fieldOptions: { label: "Contact (complex field with an attribute)" },
1894
+ minOccurs: 0,
1895
+ fullWidth: !0,
1896
+ attributes: [
1897
+ {
1898
+ name: "certainty",
1899
+ type: "select",
1900
+ minOccurs: 0,
1901
+ fieldOptions: { label: "Certainty" },
1902
+ options: [
1903
+ { key: "verified", value: "Verified" },
1904
+ { key: "unverified", value: "Unverified" }
1905
+ ]
1906
+ }
1907
+ ]
1908
+ }] : [],
1909
+ { name: "note", fieldOptions: { label: "Sibling field (always mounted)" }, minOccurs: 0, fullWidth: !0 }
1910
+ ]);
1911
+ return (e, l) => (t(), i("div", Et, [
1912
+ a("div", It, [
1913
+ a("label", zt, [
1914
+ N(a("input", {
1915
+ "onUpdate:modelValue": l[0] || (l[0] = (r) => h.value = r),
1916
+ type: "checkbox",
1917
+ "data-testid": "toggle-show-contact"
1918
+ }, null, 512), [
1919
+ [D, h.value]
1920
+ ]),
1921
+ l[2] || (l[2] = x(" Show contact field (v-if unmount) ", -1))
1922
+ ]),
1923
+ a("label", Rt, [
1924
+ N(a("input", {
1925
+ "onUpdate:modelValue": l[1] || (l[1] = (r) => d.value = r),
1926
+ type: "checkbox",
1927
+ "data-testid": "toggle-keep-values-on-unmount"
1928
+ }, null, 512), [
1929
+ [D, d.value]
1930
+ ]),
1931
+ l[3] || (l[3] = x(" keepValuesOnUnmount ", -1))
1932
+ ])
1933
+ ]),
1934
+ R(G, {
1935
+ metadata: c.value,
1936
+ "keep-values-on-unmount": d.value,
1937
+ "show-debug-state": ""
1938
+ }, null, 8, ["metadata", "keep-values-on-unmount"])
1939
+ ]));
1940
+ }
1941
+ }), Ut = { class: "flex flex-col gap-4" }, Dt = { class: "flex items-center gap-4 flex-wrap" }, Jt = { class: "flex items-center gap-2" }, da = /* @__PURE__ */ E({
1942
+ __name: "ProgrammaticWritesTestCase",
1943
+ setup(u) {
1944
+ const h = ee("form"), d = L(!1), c = [
1945
+ { name: "code", fieldOptions: { label: "Code (required, maxLength 5)" }, restriction: { maxLength: 5 }, fullWidth: !0 },
1946
+ { name: "quantity", fieldOptions: { label: "Quantity (at most 10)" }, minOccurs: 0, restriction: { maxInclusive: 10 }, fullWidth: !0 },
1947
+ { name: "tags", fieldOptions: { label: "Tags (at least 2 items)" }, minOccurs: 2, maxOccurs: 4, fullWidth: !0 }
1948
+ ], e = {
1949
+ code: "far too long for five",
1950
+ quantity: "42",
1951
+ tags: ["only one"]
1952
+ };
1953
+ function l() {
1954
+ h.value?.setFieldValue("code", e.code, d.value);
1955
+ }
1956
+ function r() {
1957
+ h.value?.setValues({ ...e }, d.value);
1958
+ }
1959
+ return (p, s) => (t(), i("div", Ut, [
1960
+ a("div", Dt, [
1961
+ a("button", {
1962
+ type: "button",
1963
+ class: "cursor-pointer bg-gray-200 text-black px-4 py-2 rounded",
1964
+ "data-testid": "set-field-value",
1965
+ onClick: l
1966
+ }, " setFieldValue('code', ...) "),
1967
+ a("button", {
1968
+ type: "button",
1969
+ class: "cursor-pointer bg-gray-200 text-black px-4 py-2 rounded",
1970
+ "data-testid": "set-values",
1971
+ onClick: r
1972
+ }, " setValues({ ... }) "),
1973
+ a("label", Jt, [
1974
+ N(a("input", {
1975
+ "onUpdate:modelValue": s[0] || (s[0] = (f) => d.value = f),
1976
+ type: "checkbox",
1977
+ "data-testid": "toggle-should-validate"
1978
+ }, null, 512), [
1979
+ [D, d.value]
1980
+ ]),
1981
+ s[1] || (s[1] = x(" shouldValidate ", -1))
1982
+ ])
1983
+ ]),
1984
+ R(G, {
1985
+ ref_key: "form",
1986
+ ref: h,
1987
+ metadata: c,
1988
+ "show-debug-state": ""
1989
+ }, null, 512)
1990
+ ]));
1991
+ }
1992
+ });
625
1993
  export {
626
- Le as TestFormTemplate,
627
- He as arrayTestCase,
628
- Qe as childFieldsTestCase,
629
- Ye as choiceTestCase,
630
- $ as createTestCase,
631
- Ge as defaultTestCase,
632
- Je as groupTestCase,
633
- Xe as individualTestCase
1994
+ oa as KeepValuesOnUnmountTestCase,
1995
+ da as ProgrammaticWritesTestCase,
1996
+ Ft as TestFormTemplate,
1997
+ ci as arrayMaxOccursSampleValues,
1998
+ ri as arrayMaxOccursTestCase,
1999
+ di as arrayOccurrenceSampleValues,
2000
+ oi as arrayOccurrenceTestCase,
2001
+ Yt as arraySampleValues,
2002
+ Qt as arrayTestCase,
2003
+ Fi as attributesSampleValues,
2004
+ Wi as attributesTestCase,
2005
+ ii as childFieldsSampleValues,
2006
+ ti as childFieldsTestCase,
2007
+ wi as choiceDisplayOrderAddedSampleValues,
2008
+ vi as choiceDisplayOrderAddedTestCase,
2009
+ hi as choiceMaxOccursSampleValues,
2010
+ mi as choiceMaxOccursTestCase,
2011
+ pi as choiceOccurrenceSampleValues,
2012
+ ui as choiceOccurrenceTestCase,
2013
+ Xi as choiceOfWizardsSampleValues,
2014
+ Zi as choiceOfWizardsTestCase,
2015
+ Ci as choicePreserveOrderSampleValues,
2016
+ Vi as choicePreserveOrderScalarBranchSampleValues,
2017
+ Ti as choicePreserveOrderScalarBranchTestCase,
2018
+ ki as choicePreserveOrderTestCase,
2019
+ ei as choiceSampleValues,
2020
+ Mt as choiceTestCase,
2021
+ Ai as complexTypeValuePropertySampleValues,
2022
+ $i as complexTypeValuePropertyTestCase,
2023
+ Si as computedPropsSampleValues,
2024
+ _i as computedPropsTestCase,
2025
+ m as createTestCase,
2026
+ Ri as customMessagesSampleValues,
2027
+ zi as customMessagesTestCase,
2028
+ Kt as defaultSampleValues,
2029
+ Ht as defaultTestCase,
2030
+ fi as explicitChoiceSampleValues,
2031
+ bi as explicitChoiceTestCase,
2032
+ xi as explicitRepeatableChoiceSampleValues,
2033
+ yi as explicitRepeatableChoiceTestCase,
2034
+ Xt as groupSampleValues,
2035
+ Zt as groupTestCase,
2036
+ Di as individualSampleValues,
2037
+ Ui as individualTestCase,
2038
+ li as inputTypesSampleValues,
2039
+ ai as inputTypesTestCase,
2040
+ gi as preserveOnSwitchSampleValues,
2041
+ Oi as preserveOnSwitchTestCase,
2042
+ ea as repeatedWizardSampleValues,
2043
+ Mi as repeatedWizardTestCase,
2044
+ si as restrictionsSampleValues,
2045
+ ni as restrictionsTestCase,
2046
+ Ii as showOptionalInsteadOfRequiredSampleValues,
2047
+ Ei as showOptionalInsteadOfRequiredTestCase,
2048
+ qi as validateAfterSubmitTestCase,
2049
+ Pi as validateOnBlurTestCase,
2050
+ Ni as validateOnSubmitOnlyTestCase,
2051
+ Li as validateWhenInErrorTestCase,
2052
+ Bi as validationTimingSampleValues,
2053
+ Yi as wizardCompositePagesSampleValues,
2054
+ Qi as wizardCompositePagesTestCase,
2055
+ sa as wizardDisabledAncestorSampleValues,
2056
+ na as wizardDisabledAncestorTestCase,
2057
+ Lt as wizardForwardJumpSampleValues,
2058
+ ji as wizardForwardJumpTestCase,
2059
+ ia as wizardKeepValuesSampleValues,
2060
+ ta as wizardKeepValuesTestCase,
2061
+ la as wizardOptionalAncestorSampleValues,
2062
+ aa as wizardOptionalAncestorTestCase,
2063
+ Gi as wizardSampleValues,
2064
+ Ji as wizardTestCase,
2065
+ Ki as wizardValidateOnJumpSampleValues,
2066
+ Hi as wizardValidateOnJumpTestCase
634
2067
  };
635
2068
  //# sourceMappingURL=examples.es.js.map