pdyform 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- import { defineComponent as p, openBlock as d, createElementBlock as g, mergeProps as I, unref as o, createBlock as v, computed as h, withCtx as m, renderSlot as q, createVNode as b, normalizeClass as D, createElementVNode as O, normalizeProps as X, guardReactiveProps as Y, Fragment as N, renderList as E, createTextVNode as U, toDisplayString as F, createCommentVNode as R, resolveDynamicComponent as Z, ref as _, onUnmounted as ee, withModifiers as te } from "vue";
2
- import { clsx as ae } from "clsx";
3
- import { twMerge as le } from "tailwind-merge";
4
- import { useForwardProps as j, SelectTrigger as ie, SelectIcon as ne, SelectPortal as se, SelectContent as re, SelectViewport as oe, SelectItem as de, SelectItemIndicator as ue, SelectItemText as ce, useForwardPropsEmits as A, SelectRoot as me, SelectValue as fe, CheckboxRoot as be, CheckboxIndicator as pe, Label as ge, RadioGroupItem as ye, RadioGroupIndicator as ve, RadioGroupRoot as he, SwitchRoot as xe, SwitchThumb as Ve } from "radix-vue";
5
- import { ChevronDown as ke, Check as K, Circle as we } from "lucide-vue-next";
6
- function z(e) {
1
+ import { defineComponent as y, openBlock as d, createElementBlock as h, mergeProps as I, unref as o, createBlock as x, computed as V, withCtx as c, renderSlot as q, createVNode as g, normalizeClass as D, createElementVNode as z, normalizeProps as Y, guardReactiveProps as Z, Fragment as N, renderList as E, createTextVNode as U, toDisplayString as R, createCommentVNode as C, resolveDynamicComponent as _, ref as ee, onUnmounted as te, withModifiers as ae } from "vue";
2
+ import { clsx as le } from "clsx";
3
+ import { twMerge as ie } from "tailwind-merge";
4
+ import { useForwardProps as j, SelectTrigger as se, SelectIcon as ne, SelectPortal as re, SelectContent as oe, SelectViewport as de, SelectItem as ue, SelectItemIndicator as ce, SelectItemText as me, useForwardPropsEmits as A, SelectRoot as fe, SelectValue as be, CheckboxRoot as pe, CheckboxIndicator as ge, Label as ye, RadioGroupItem as ve, RadioGroupIndicator as he, RadioGroupRoot as xe, SwitchRoot as Ve, SwitchThumb as ke } from "radix-vue";
5
+ import { ChevronDown as we, Check as K, Circle as Be } from "lucide-vue-next";
6
+ function O(e) {
7
7
  if (typeof e == "number") return Number.isNaN(e) ? null : e;
8
8
  if (typeof e != "string" || e.trim() === "") return null;
9
9
  const l = Number(e);
10
10
  return Number.isNaN(l) ? null : l;
11
11
  }
12
- var Be = {
12
+ var Se = {
13
13
  required: "{label} is required",
14
14
  min: "{label} must be at least {value}",
15
15
  max: "{label} must be at most {value}",
@@ -17,184 +17,187 @@ var Be = {
17
17
  pattern: "Invalid format",
18
18
  custom: "Invalid value"
19
19
  };
20
- function S(e, l, i) {
21
- return e.replace("{label}", l.label).replace("{value}", String(i.value || ""));
20
+ function $(e, l, i) {
21
+ return e ? e.replace("{label}", l.label).replace("{value}", String(i.value || "")) : "";
22
22
  }
23
23
  function M(e, l, i) {
24
24
  if (!l) return i;
25
- const n = l.split(/[.[\]]/).filter(Boolean);
26
- let a = e;
27
- for (const t of n) {
28
- if (a == null) return i;
29
- a = a[t];
25
+ const s = l.split(/[.[\]]/).filter(Boolean);
26
+ let t = e;
27
+ for (const a of s) {
28
+ if (t == null) return i;
29
+ t = t[a];
30
30
  }
31
- return a === void 0 ? i : a;
31
+ return t === void 0 ? i : t;
32
32
  }
33
- function Se(e, l, i) {
33
+ function $e(e, l, i) {
34
34
  if (Object(e) !== e) return e;
35
- const n = l.split(/[.[\]]/).filter(Boolean), a = { ...e };
36
- let t = a;
37
- for (let r = 0; r < n.length - 1; r++) {
38
- const s = n[r], u = n[r + 1], f = /^\d+$/.test(u);
39
- !(s in t) || t[s] === null || typeof t[s] != "object" ? t[s] = f ? [] : {} : t[s] = Array.isArray(t[s]) ? [...t[s]] : { ...t[s] }, t = t[s];
35
+ const s = l.split(/[.[\]]/).filter(Boolean), t = { ...e };
36
+ let a = t;
37
+ for (let r = 0; r < s.length - 1; r++) {
38
+ const n = s[r], u = s[r + 1], w = /^\d+$/.test(u);
39
+ !(n in a) || a[n] === null || typeof a[n] != "object" ? a[n] = w ? [] : {} : a[n] = Array.isArray(a[n]) ? [...a[n]] : { ...a[n] }, a = a[n];
40
40
  }
41
- return t[n[n.length - 1]] = i, a;
41
+ return a[s[s.length - 1]] = i, t;
42
42
  }
43
43
  function W(e, l) {
44
44
  if (e.type !== "number") return l;
45
45
  if (l === "" || l === void 0 || l === null) return "";
46
- const i = z(l);
46
+ const i = O(l);
47
47
  return i === null ? l : i;
48
48
  }
49
49
  async function J(e, l, i) {
50
50
  if (!l.validations) return null;
51
- const n = { ...Be, ...i };
52
- for (const a of l.validations)
53
- switch (a.type) {
51
+ const s = { ...Se, ...i };
52
+ for (const t of l.validations)
53
+ switch (t.type) {
54
54
  case "required":
55
55
  if (e == null || e === "" || Array.isArray(e) && e.length === 0)
56
- return a.message || S(n.required, l, a);
56
+ return t.message || $(s.required, l, t);
57
57
  break;
58
58
  case "min":
59
59
  if (l.type === "number") {
60
- const t = z(e);
61
- if (t !== null && t < a.value) {
62
- const r = l.type === "number" ? n.min : typeof e == "string" ? "{label} must be at least {value} characters" : n.min;
63
- return a.message || S(r, l, a);
60
+ const a = O(e);
61
+ if (a !== null && a < t.value) {
62
+ const r = l.type === "number" ? s.min : typeof e == "string" ? "{label} must be at least {value} characters" : s.min;
63
+ return t.message || $(r, l, t);
64
64
  }
65
65
  break;
66
66
  }
67
- if (typeof e == "number" && e < a.value)
68
- return a.message || S(n.min, l, a);
69
- if (typeof e == "string" && e.length < a.value)
70
- return a.message || S("{label} must be at least {value} characters", l, a);
67
+ if (typeof e == "number" && e < t.value)
68
+ return t.message || $(s.min, l, t);
69
+ if (typeof e == "string" && e.length < t.value)
70
+ return t.message || $("{label} must be at least {value} characters", l, t);
71
71
  break;
72
72
  case "max":
73
73
  if (l.type === "number") {
74
- const t = z(e);
75
- if (t !== null && t > a.value)
76
- return a.message || S(n.max, l, a);
74
+ const a = O(e);
75
+ if (a !== null && a > t.value)
76
+ return t.message || $(s.max, l, t);
77
77
  break;
78
78
  }
79
- if (typeof e == "number" && e > a.value)
80
- return a.message || S(n.max, l, a);
81
- if (typeof e == "string" && e.length > a.value)
82
- return a.message || S("{label} must be at most {value} characters", l, a);
79
+ if (typeof e == "number" && e > t.value)
80
+ return t.message || $(s.max, l, t);
81
+ if (typeof e == "string" && e.length > t.value)
82
+ return t.message || $("{label} must be at most {value} characters", l, t);
83
83
  break;
84
84
  case "email": {
85
85
  if (e && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e))
86
- return a.message || S(n.email, l, a);
86
+ return t.message || $(s.email, l, t);
87
87
  break;
88
88
  }
89
89
  case "pattern":
90
- if (e && a.value && !new RegExp(a.value).test(e))
91
- return a.message || S(n.pattern, l, a);
90
+ if (e && t.value && !new RegExp(t.value).test(e))
91
+ return t.message || $(s.pattern, l, t);
92
92
  break;
93
93
  case "custom":
94
- if (a.validator) {
95
- const t = await a.validator(e);
96
- if (typeof t == "string") return t;
97
- if (t === !1) return a.message || S(n.custom, l, a);
94
+ if (t.validator) {
95
+ const a = await t.validator(e);
96
+ if (typeof a == "string") return a;
97
+ if (a === !1) return t.message || $(s.custom, l, t);
98
98
  }
99
99
  break;
100
100
  }
101
101
  return null;
102
102
  }
103
- async function G(e, l, i, n, a, t) {
104
- if (n && a) {
105
- const s = await n(a);
106
- if (s[l]) return s[l];
103
+ async function L(e, l, i, s, t, a) {
104
+ if (s && t) {
105
+ const n = await s(t);
106
+ if (n[l]) return n[l];
107
107
  }
108
- const r = e.find((s) => s.name === l);
109
- return r ? await J(i, r, t) : null;
108
+ const r = e.find((n) => n.name === l);
109
+ return r ? await J(i, r, a) : null;
110
110
  }
111
- async function Ie(e, l, i, n) {
112
- let a = {};
113
- i && (a = await i(l));
114
- const t = e.map(async (r) => {
115
- if (a[r.name] || (typeof r.hidden == "function" ? r.hidden(l) : r.hidden)) return;
116
- const u = await J(M(l, r.name), r, n);
117
- u && (a[r.name] = u);
111
+ async function Ie(e, l, i, s) {
112
+ let t = {};
113
+ i && (t = await i(l));
114
+ const a = e.map(async (r) => {
115
+ if (t[r.name] || (typeof r.hidden == "function" ? r.hidden(l) : r.hidden)) return;
116
+ const u = await J(M(l, r.name), r, s);
117
+ u && (t[r.name] = u);
118
118
  });
119
- return await Promise.all(t), a;
119
+ return await Promise.all(a), t;
120
120
  }
121
- function $e(e) {
121
+ function Fe(e) {
122
122
  return e.reduce((l, i) => (l[i.name] = i.defaultValue !== void 0 ? i.defaultValue : i.type === "checkbox" ? [] : "", l), {});
123
123
  }
124
- const L = (e) => {
125
- let l;
126
- const i = /* @__PURE__ */ new Set(), n = (f, $) => {
127
- const c = typeof f == "function" ? f(l) : f;
128
- if (!Object.is(c, l)) {
129
- const x = l;
130
- l = $ ?? (typeof c != "object" || c === null) ? c : Object.assign({}, l, c), i.forEach((V) => V(l, x));
124
+ function Re(e) {
125
+ let l = e;
126
+ const i = /* @__PURE__ */ new Set();
127
+ return { getState: () => l, setState: (r) => {
128
+ const n = typeof r == "function" ? r(l) : r;
129
+ if (!Object.is(n, l)) {
130
+ const u = l;
131
+ l = { ...l, ...n }, i.forEach((w) => w(l, u));
131
132
  }
132
- }, a = () => l, s = { setState: n, getState: a, getInitialState: () => u, subscribe: (f) => (i.add(f), () => i.delete(f)) }, u = l = e(n, a, s);
133
- return s;
134
- }, Fe = (e) => e ? L(e) : L;
135
- function Re(e, l, i) {
136
- return Fe()((n, a) => ({
137
- values: $e(e),
133
+ }, subscribe: (r) => (i.add(r), () => i.delete(r)) };
134
+ }
135
+ function Ce(e, l, i) {
136
+ const s = Re({
137
+ values: Fe(e),
138
138
  errors: {},
139
139
  validatingFields: [],
140
- isSubmitting: !1,
141
- setFieldValue: async (t, r) => {
142
- const s = e.find((c) => c.name === t), u = s ? W(s, r) : r;
143
- n((c) => ({
144
- values: Se(c.values, t, u)
140
+ isSubmitting: !1
141
+ }), { getState: t, setState: a } = s;
142
+ return {
143
+ store: s,
144
+ setFieldValue: async (m, f) => {
145
+ const v = e.find((b) => b.name === m), S = v ? W(v, f) : f;
146
+ a((b) => ({
147
+ values: $e(b.values, m, S)
145
148
  }));
146
- const f = !!a().errors[t];
147
- if (s && ["select", "checkbox", "radio", "switch", "date"].includes(s.type) || f) {
148
- n((c) => ({
149
- validatingFields: [...c.validatingFields, t]
149
+ const p = !!t().errors[m];
150
+ if (v && ["select", "checkbox", "radio", "switch", "date"].includes(v.type) || p) {
151
+ a((b) => ({
152
+ validatingFields: [...b.validatingFields, m]
150
153
  }));
151
154
  try {
152
- const c = a().values, x = await G(e, t, u, l, c, i);
153
- n((V) => ({
154
- errors: { ...V.errors, [t]: x || "" },
155
- validatingFields: V.validatingFields.filter((y) => y !== t)
155
+ const b = t().values, k = await L(e, m, S, l, b, i);
156
+ a((G) => ({
157
+ errors: { ...G.errors, [m]: k || "" },
158
+ validatingFields: G.validatingFields.filter((X) => X !== m)
156
159
  }));
157
160
  } catch {
158
- n((x) => ({
159
- validatingFields: x.validatingFields.filter((V) => V !== t)
161
+ a((b) => ({
162
+ validatingFields: b.validatingFields.filter((k) => k !== m)
160
163
  }));
161
164
  }
162
165
  }
163
166
  },
164
- setFieldBlur: async (t) => {
165
- n((r) => ({
166
- validatingFields: [...r.validatingFields, t]
167
+ setFieldBlur: async (m) => {
168
+ a((f) => ({
169
+ validatingFields: [...f.validatingFields, m]
167
170
  }));
168
171
  try {
169
- const r = a().values, s = M(r, t), u = await G(e, t, s, l, r, i);
170
- n((f) => ({
171
- errors: { ...f.errors, [t]: u || "" },
172
- validatingFields: f.validatingFields.filter(($) => $ !== t)
172
+ const f = t().values, v = M(f, m), S = await L(e, m, v, l, f, i);
173
+ a((p) => ({
174
+ errors: { ...p.errors, [m]: S || "" },
175
+ validatingFields: p.validatingFields.filter((F) => F !== m)
173
176
  }));
174
177
  } catch {
175
- n((s) => ({
176
- validatingFields: s.validatingFields.filter((u) => u !== t)
178
+ a((f) => ({
179
+ validatingFields: f.validatingFields.filter((v) => v !== m)
177
180
  }));
178
181
  }
179
182
  },
180
- setSubmitting: (t) => n({ isSubmitting: t }),
183
+ setSubmitting: (m) => a({ isSubmitting: m }),
181
184
  runSubmitValidation: async () => {
182
- n({ isSubmitting: !0 });
183
- const t = a(), r = await Ie(e, t.values, l, i), s = Object.keys(r).length > 0;
184
- return n({
185
- errors: r,
185
+ a({ isSubmitting: !0 });
186
+ const m = t().values, f = await Ie(e, m, l, i), v = Object.keys(f).length > 0;
187
+ return a({
188
+ errors: f,
186
189
  isSubmitting: !1
187
190
  }), {
188
- state: a(),
189
- hasError: s
191
+ state: t(),
192
+ hasError: v
190
193
  };
191
194
  }
192
- }));
195
+ };
193
196
  }
194
- function w(...e) {
195
- return le(ae(e));
197
+ function B(...e) {
198
+ return ie(le(e));
196
199
  }
197
- const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
200
+ const qe = ["type", "value"], Q = /* @__PURE__ */ y({
198
201
  __name: "Input",
199
202
  props: {
200
203
  class: {},
@@ -203,16 +206,16 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
203
206
  },
204
207
  emits: ["update:modelValue", "blur"],
205
208
  setup(e, { emit: l }) {
206
- const i = e, n = l;
207
- return (a, t) => (d(), g("input", I(a.$attrs, {
209
+ const i = e, s = l;
210
+ return (t, a) => (d(), h("input", I(t.$attrs, {
208
211
  type: e.type,
209
- class: o(w)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", i.class),
212
+ class: o(B)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", i.class),
210
213
  value: e.modelValue,
211
- onInput: t[0] || (t[0] = (r) => n("update:modelValue", r.target.value)),
212
- onBlur: t[1] || (t[1] = (r) => n("blur", r))
213
- }), null, 16, Ce));
214
+ onInput: a[0] || (a[0] = (r) => s("update:modelValue", r.target.value)),
215
+ onBlur: a[1] || (a[1] = (r) => s("blur", r))
216
+ }), null, 16, qe));
214
217
  }
215
- }), P = /* @__PURE__ */ p({
218
+ }), P = /* @__PURE__ */ y({
216
219
  __name: "InputRenderer",
217
220
  props: {
218
221
  field: {},
@@ -224,21 +227,21 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
224
227
  },
225
228
  emits: ["update:modelValue", "blur"],
226
229
  setup(e, { emit: l }) {
227
- const i = e, n = l, a = (t) => {
228
- n("update:modelValue", W(i.field, t));
230
+ const i = e, s = l, t = (a) => {
231
+ s("update:modelValue", W(i.field, a));
229
232
  };
230
- return (t, r) => (d(), v(Q, {
233
+ return (a, r) => (d(), x(Q, {
231
234
  id: e.fieldId,
232
235
  type: e.field.type,
233
236
  placeholder: e.field.placeholder,
234
237
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
235
238
  name: e.field.name,
236
- modelValue: e.modelValue ?? "",
237
- "onUpdate:modelValue": a,
238
- onBlur: r[0] || (r[0] = (s) => n("blur", s))
239
- }, null, 8, ["id", "type", "placeholder", "disabled", "name", "modelValue"]));
239
+ "model-value": e.modelValue ?? "",
240
+ "onUpdate:modelValue": t,
241
+ onBlur: r[0] || (r[0] = (n) => s("blur", n))
242
+ }, null, 8, ["id", "type", "placeholder", "disabled", "name", "model-value"]));
240
243
  }
241
- }), qe = ["value"], Pe = /* @__PURE__ */ p({
244
+ }), Pe = ["value"], De = /* @__PURE__ */ y({
242
245
  __name: "Textarea",
243
246
  props: {
244
247
  class: {},
@@ -246,15 +249,15 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
246
249
  },
247
250
  emits: ["update:modelValue", "blur"],
248
251
  setup(e, { emit: l }) {
249
- const i = e, n = l;
250
- return (a, t) => (d(), g("textarea", I(a.$attrs, {
251
- class: o(w)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", i.class),
252
+ const i = e, s = l;
253
+ return (t, a) => (d(), h("textarea", I(t.$attrs, {
254
+ class: o(B)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", i.class),
252
255
  value: e.modelValue,
253
- onInput: t[0] || (t[0] = (r) => n("update:modelValue", r.target.value)),
254
- onBlur: t[1] || (t[1] = (r) => n("blur", r))
255
- }), null, 16, qe));
256
+ onInput: a[0] || (a[0] = (r) => s("update:modelValue", r.target.value)),
257
+ onBlur: a[1] || (a[1] = (r) => s("blur", r))
258
+ }), null, 16, Pe));
256
259
  }
257
- }), De = /* @__PURE__ */ p({
260
+ }), Ne = /* @__PURE__ */ y({
258
261
  __name: "TextareaRenderer",
259
262
  props: {
260
263
  field: {},
@@ -267,16 +270,16 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
267
270
  emits: ["update:modelValue"],
268
271
  setup(e, { emit: l }) {
269
272
  const i = l;
270
- return (n, a) => (d(), v(Pe, {
273
+ return (s, t) => (d(), x(De, {
271
274
  id: e.fieldId,
272
275
  placeholder: e.field.placeholder,
273
276
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
274
277
  name: e.field.name,
275
- modelValue: e.modelValue ?? "",
276
- "onUpdate:modelValue": a[0] || (a[0] = (t) => i("update:modelValue", t))
277
- }, null, 8, ["id", "placeholder", "disabled", "name", "modelValue"]));
278
+ "model-value": e.modelValue ?? "",
279
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => i("update:modelValue", a))
280
+ }, null, 8, ["id", "placeholder", "disabled", "name", "model-value"]));
278
281
  }
279
- }), Ne = /* @__PURE__ */ p({
282
+ }), Ee = /* @__PURE__ */ y({
280
283
  __name: "SelectTrigger",
281
284
  props: {
282
285
  disabled: { type: Boolean },
@@ -285,18 +288,18 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
285
288
  class: {}
286
289
  },
287
290
  setup(e) {
288
- const l = e, i = h(() => {
289
- const { class: a, ...t } = l;
290
- return t;
291
- }), n = j(i);
292
- return (a, t) => (d(), v(o(ie), I(o(n), {
293
- class: o(w)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", l.class)
291
+ const l = e, i = V(() => {
292
+ const { class: t, ...a } = l;
293
+ return a;
294
+ }), s = j(i);
295
+ return (t, a) => (d(), x(o(se), I(o(s), {
296
+ class: o(B)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", l.class)
294
297
  }), {
295
- default: m(() => [
296
- q(a.$slots, "default"),
297
- b(o(ne), { "as-child": "" }, {
298
- default: m(() => [
299
- b(o(ke), { class: "h-4 w-4 opacity-50" })
298
+ default: c(() => [
299
+ q(t.$slots, "default"),
300
+ g(o(ne), { "as-child": "" }, {
301
+ default: c(() => [
302
+ g(o(we), { class: "h-4 w-4 opacity-50" })
300
303
  ]),
301
304
  _: 1
302
305
  })
@@ -304,7 +307,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
304
307
  _: 3
305
308
  }, 16, ["class"]));
306
309
  }
307
- }), Ee = /* @__PURE__ */ p({
310
+ }), Ue = /* @__PURE__ */ y({
308
311
  __name: "SelectContent",
309
312
  props: {
310
313
  forceMount: { type: Boolean },
@@ -327,21 +330,21 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
327
330
  class: {}
328
331
  },
329
332
  setup(e) {
330
- const l = e, i = h(() => {
331
- const { class: a, ...t } = l;
332
- return t;
333
- }), n = j(i);
334
- return (a, t) => (d(), v(o(se), null, {
335
- default: m(() => [
336
- b(o(re), I(o(n), {
337
- class: o(w)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", e.position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", l.class)
333
+ const l = e, i = V(() => {
334
+ const { class: t, ...a } = l;
335
+ return a;
336
+ }), s = j(i);
337
+ return (t, a) => (d(), x(o(re), null, {
338
+ default: c(() => [
339
+ g(o(oe), I(o(s), {
340
+ class: o(B)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", e.position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", l.class)
338
341
  }), {
339
- default: m(() => [
340
- b(o(oe), {
341
- class: D(o(w)("p-1", e.position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"))
342
+ default: c(() => [
343
+ g(o(de), {
344
+ class: D(o(B)("p-1", e.position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"))
342
345
  }, {
343
- default: m(() => [
344
- q(a.$slots, "default")
346
+ default: c(() => [
347
+ q(t.$slots, "default")
345
348
  ]),
346
349
  _: 3
347
350
  }, 8, ["class"])
@@ -352,7 +355,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
352
355
  _: 3
353
356
  }));
354
357
  }
355
- }), Ue = { class: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center" }, je = /* @__PURE__ */ p({
358
+ }), je = { class: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center" }, Ae = /* @__PURE__ */ y({
356
359
  __name: "SelectItem",
357
360
  props: {
358
361
  value: {},
@@ -363,28 +366,28 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
363
366
  class: {}
364
367
  },
365
368
  setup(e) {
366
- const l = e, i = h(() => {
367
- const { class: a, ...t } = l;
368
- return t;
369
- }), n = j(i);
370
- return (a, t) => (d(), v(o(de), I(o(n), {
371
- class: o(w)(
369
+ const l = e, i = V(() => {
370
+ const { class: t, ...a } = l;
371
+ return a;
372
+ }), s = j(i);
373
+ return (t, a) => (d(), x(o(ue), I(o(s), {
374
+ class: o(B)(
372
375
  "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
373
376
  l.class
374
377
  )
375
378
  }), {
376
- default: m(() => [
377
- O("span", Ue, [
378
- b(o(ue), null, {
379
- default: m(() => [
380
- b(o(K), { class: "h-4 w-4" })
379
+ default: c(() => [
380
+ z("span", je, [
381
+ g(o(ce), null, {
382
+ default: c(() => [
383
+ g(o(K), { class: "h-4 w-4" })
381
384
  ]),
382
385
  _: 1
383
386
  })
384
387
  ]),
385
- b(o(ce), null, {
386
- default: m(() => [
387
- q(a.$slots, "default")
388
+ g(o(me), null, {
389
+ default: c(() => [
390
+ q(t.$slots, "default")
388
391
  ]),
389
392
  _: 3
390
393
  })
@@ -392,7 +395,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
392
395
  _: 3
393
396
  }, 16, ["class"]));
394
397
  }
395
- }), Ae = /* @__PURE__ */ p({
398
+ }), Me = /* @__PURE__ */ y({
396
399
  __name: "Select",
397
400
  props: {
398
401
  open: { type: Boolean },
@@ -407,15 +410,15 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
407
410
  },
408
411
  emits: ["update:modelValue", "update:open"],
409
412
  setup(e, { emit: l }) {
410
- const a = A(e, l);
411
- return (t, r) => (d(), v(o(me), X(Y(o(a))), {
412
- default: m(() => [
413
- q(t.$slots, "default")
413
+ const t = A(e, l);
414
+ return (a, r) => (d(), x(o(fe), Y(Z(o(t))), {
415
+ default: c(() => [
416
+ q(a.$slots, "default")
414
417
  ]),
415
418
  _: 3
416
419
  }, 16));
417
420
  }
418
- }), Me = /* @__PURE__ */ p({
421
+ }), ze = /* @__PURE__ */ y({
419
422
  __name: "SelectRenderer",
420
423
  props: {
421
424
  field: {},
@@ -428,29 +431,29 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
428
431
  emits: ["update:modelValue"],
429
432
  setup(e, { emit: l }) {
430
433
  const i = l;
431
- return (n, a) => (d(), v(Ae, {
434
+ return (s, t) => (d(), x(Me, {
432
435
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
433
436
  name: e.field.name,
434
- modelValue: e.modelValue != null ? String(e.modelValue) : "",
435
- "onUpdate:modelValue": a[0] || (a[0] = (t) => i("update:modelValue", t))
437
+ "model-value": e.modelValue != null ? String(e.modelValue) : "",
438
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => i("update:modelValue", a))
436
439
  }, {
437
- default: m(() => [
438
- b(Ne, { id: e.fieldId }, {
439
- default: m(() => [
440
- b(o(fe), {
440
+ default: c(() => [
441
+ g(Ee, { id: e.fieldId }, {
442
+ default: c(() => [
443
+ g(o(be), {
441
444
  placeholder: e.field.placeholder || "Select an option"
442
445
  }, null, 8, ["placeholder"])
443
446
  ]),
444
447
  _: 1
445
448
  }, 8, ["id"]),
446
- b(Ee, null, {
447
- default: m(() => [
448
- (d(!0), g(N, null, E(e.field.options, (t) => (d(), v(je, {
449
- key: t.value,
450
- value: String(t.value)
449
+ g(Ue, null, {
450
+ default: c(() => [
451
+ (d(!0), h(N, null, E(e.field.options, (a) => (d(), x(Ae, {
452
+ key: a.value,
453
+ value: String(a.value)
451
454
  }, {
452
- default: m(() => [
453
- U(F(t.label), 1)
455
+ default: c(() => [
456
+ U(R(a.label), 1)
454
457
  ]),
455
458
  _: 2
456
459
  }, 1032, ["value"]))), 128))
@@ -459,9 +462,9 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
459
462
  })
460
463
  ]),
461
464
  _: 1
462
- }, 8, ["disabled", "name", "modelValue"]));
465
+ }, 8, ["disabled", "name", "model-value"]));
463
466
  }
464
- }), Oe = /* @__PURE__ */ p({
467
+ }), Oe = /* @__PURE__ */ y({
465
468
  __name: "Checkbox",
466
469
  props: {
467
470
  defaultChecked: { type: Boolean },
@@ -477,18 +480,18 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
477
480
  },
478
481
  emits: ["update:checked", "blur"],
479
482
  setup(e, { emit: l }) {
480
- const i = e, n = l, a = h(() => {
481
- const { class: r, ...s } = i;
482
- return s;
483
- }), t = A(a, n);
484
- return (r, s) => (d(), v(o(be), I(o(t), {
485
- class: o(w)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground", i.class),
486
- onBlur: s[0] || (s[0] = (u) => n("blur"))
483
+ const i = e, s = l, t = V(() => {
484
+ const { class: r, ...n } = i;
485
+ return n;
486
+ }), a = A(t, s);
487
+ return (r, n) => (d(), x(o(pe), I(o(a), {
488
+ class: o(B)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground", i.class),
489
+ onBlur: n[0] || (n[0] = (u) => s("blur"))
487
490
  }), {
488
- default: m(() => [
489
- b(o(pe), { class: "flex h-full w-full items-center justify-center text-current" }, {
490
- default: m(() => [
491
- b(o(K), { class: "h-4 w-4" })
491
+ default: c(() => [
492
+ g(o(ge), { class: "flex h-full w-full items-center justify-center text-current" }, {
493
+ default: c(() => [
494
+ g(o(K), { class: "h-4 w-4" })
492
495
  ]),
493
496
  _: 1
494
497
  })
@@ -496,7 +499,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
496
499
  _: 1
497
500
  }, 16, ["class"]));
498
501
  }
499
- }), T = /* @__PURE__ */ p({
502
+ }), T = /* @__PURE__ */ y({
500
503
  __name: "Label",
501
504
  props: {
502
505
  for: {},
@@ -505,20 +508,20 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
505
508
  class: {}
506
509
  },
507
510
  setup(e) {
508
- const l = e, i = h(() => {
509
- const { class: n, ...a } = l;
510
- return a;
511
+ const l = e, i = V(() => {
512
+ const { class: s, ...t } = l;
513
+ return t;
511
514
  });
512
- return (n, a) => (d(), v(o(ge), I(i.value, {
513
- class: o(w)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", l.class)
515
+ return (s, t) => (d(), x(o(ye), I(i.value, {
516
+ class: o(B)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", l.class)
514
517
  }), {
515
- default: m(() => [
516
- q(n.$slots, "default")
518
+ default: c(() => [
519
+ q(s.$slots, "default")
517
520
  ]),
518
521
  _: 3
519
522
  }, 16, ["class"]));
520
523
  }
521
- }), ze = { class: "flex flex-wrap gap-4" }, Te = /* @__PURE__ */ p({
524
+ }), Te = { class: "flex flex-wrap gap-4" }, Ge = /* @__PURE__ */ y({
522
525
  __name: "CheckboxRenderer",
523
526
  props: {
524
527
  field: {},
@@ -530,40 +533,40 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
530
533
  },
531
534
  emits: ["update:modelValue"],
532
535
  setup(e, { emit: l }) {
533
- const i = e, n = l, a = (t, r) => {
534
- const s = Array.isArray(i.modelValue) ? [...i.modelValue] : [];
536
+ const i = e, s = l, t = (a, r) => {
537
+ const n = Array.isArray(i.modelValue) ? [...i.modelValue] : [];
535
538
  if (r)
536
- s.push(t);
539
+ n.push(a);
537
540
  else {
538
- const u = s.indexOf(t);
539
- u > -1 && s.splice(u, 1);
541
+ const u = n.indexOf(a);
542
+ u > -1 && n.splice(u, 1);
540
543
  }
541
- n("update:modelValue", s);
544
+ s("update:modelValue", n);
542
545
  };
543
- return (t, r) => (d(), g("div", ze, [
544
- (d(!0), g(N, null, E(e.field.options, (s) => (d(), g("div", {
545
- key: s.value,
546
+ return (a, r) => (d(), h("div", Te, [
547
+ (d(!0), h(N, null, E(e.field.options, (n) => (d(), h("div", {
548
+ key: n.value,
546
549
  class: "flex items-center space-x-2"
547
550
  }, [
548
- b(Oe, {
549
- id: `checkbox-${e.field.name}-${s.value}`,
551
+ g(Oe, {
552
+ id: `checkbox-${e.field.name}-${n.value}`,
550
553
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
551
- checked: Array.isArray(e.modelValue) && e.modelValue.includes(s.value),
552
- "onUpdate:checked": (u) => a(s.value, !!u)
554
+ checked: Array.isArray(e.modelValue) && e.modelValue.includes(n.value),
555
+ "onUpdate:checked": (u) => t(n.value, !!u)
553
556
  }, null, 8, ["id", "disabled", "checked", "onUpdate:checked"]),
554
- b(T, {
555
- for: `checkbox-${e.field.name}-${s.value}`,
557
+ g(T, {
558
+ for: `checkbox-${e.field.name}-${n.value}`,
556
559
  class: "font-normal"
557
560
  }, {
558
- default: m(() => [
559
- U(F(s.label), 1)
561
+ default: c(() => [
562
+ U(R(n.label), 1)
560
563
  ]),
561
564
  _: 2
562
565
  }, 1032, ["for"])
563
566
  ]))), 128))
564
567
  ]));
565
568
  }
566
- }), Ge = /* @__PURE__ */ p({
569
+ }), Le = /* @__PURE__ */ y({
567
570
  __name: "RadioGroupItem",
568
571
  props: {
569
572
  id: {},
@@ -576,17 +579,17 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
576
579
  class: {}
577
580
  },
578
581
  setup(e) {
579
- const l = e, i = h(() => {
580
- const { class: a, ...t } = l;
581
- return t;
582
- }), n = j(i);
583
- return (a, t) => (d(), v(o(ye), I(o(n), {
584
- class: o(w)("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", l.class)
582
+ const l = e, i = V(() => {
583
+ const { class: t, ...a } = l;
584
+ return a;
585
+ }), s = j(i);
586
+ return (t, a) => (d(), x(o(ve), I(o(s), {
587
+ class: o(B)("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", l.class)
585
588
  }), {
586
- default: m(() => [
587
- b(o(ve), { class: "flex items-center justify-center" }, {
588
- default: m(() => [
589
- b(o(we), { class: "h-2.5 w-2.5 fill-current text-current" })
589
+ default: c(() => [
590
+ g(o(he), { class: "flex items-center justify-center" }, {
591
+ default: c(() => [
592
+ g(o(Be), { class: "h-2.5 w-2.5 fill-current text-current" })
590
593
  ]),
591
594
  _: 1
592
595
  })
@@ -594,7 +597,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
594
597
  _: 1
595
598
  }, 16, ["class"]));
596
599
  }
597
- }), Le = /* @__PURE__ */ p({
600
+ }), He = /* @__PURE__ */ y({
598
601
  __name: "RadioGroup",
599
602
  props: {
600
603
  modelValue: {},
@@ -611,20 +614,20 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
611
614
  },
612
615
  emits: ["update:modelValue"],
613
616
  setup(e, { emit: l }) {
614
- const i = e, n = l, a = h(() => {
615
- const { class: r, ...s } = i;
616
- return s;
617
- }), t = A(a, n);
618
- return (r, s) => (d(), v(o(he), I(o(t), {
619
- class: o(w)("grid gap-2", i.class)
617
+ const i = e, s = l, t = V(() => {
618
+ const { class: r, ...n } = i;
619
+ return n;
620
+ }), a = A(t, s);
621
+ return (r, n) => (d(), x(o(xe), I(o(a), {
622
+ class: o(B)("grid gap-2", i.class)
620
623
  }), {
621
- default: m(() => [
624
+ default: c(() => [
622
625
  q(r.$slots, "default")
623
626
  ]),
624
627
  _: 3
625
628
  }, 16, ["class"]));
626
629
  }
627
- }), He = /* @__PURE__ */ p({
630
+ }), Ke = /* @__PURE__ */ y({
628
631
  __name: "RadioRenderer",
629
632
  props: {
630
633
  field: {},
@@ -637,37 +640,37 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
637
640
  emits: ["update:modelValue"],
638
641
  setup(e, { emit: l }) {
639
642
  const i = l;
640
- return (n, a) => (d(), v(Le, {
643
+ return (s, t) => (d(), x(He, {
641
644
  class: "flex flex-wrap gap-4",
642
645
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
643
646
  name: e.field.name,
644
- modelValue: e.modelValue != null ? String(e.modelValue) : "",
645
- "onUpdate:modelValue": a[0] || (a[0] = (t) => i("update:modelValue", t))
647
+ "model-value": e.modelValue != null ? String(e.modelValue) : "",
648
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => i("update:modelValue", a))
646
649
  }, {
647
- default: m(() => [
648
- (d(!0), g(N, null, E(e.field.options, (t) => (d(), g("div", {
649
- key: t.value,
650
+ default: c(() => [
651
+ (d(!0), h(N, null, E(e.field.options, (a) => (d(), h("div", {
652
+ key: a.value,
650
653
  class: "flex items-center space-x-2"
651
654
  }, [
652
- b(Ge, {
653
- id: `radio-${e.field.name}-${t.value}`,
654
- value: String(t.value)
655
+ g(Le, {
656
+ id: `radio-${e.field.name}-${a.value}`,
657
+ value: String(a.value)
655
658
  }, null, 8, ["id", "value"]),
656
- b(T, {
657
- for: `radio-${e.field.name}-${t.value}`,
659
+ g(T, {
660
+ for: `radio-${e.field.name}-${a.value}`,
658
661
  class: "font-normal"
659
662
  }, {
660
- default: m(() => [
661
- U(F(t.label), 1)
663
+ default: c(() => [
664
+ U(R(a.label), 1)
662
665
  ]),
663
666
  _: 2
664
667
  }, 1032, ["for"])
665
668
  ]))), 128))
666
669
  ]),
667
670
  _: 1
668
- }, 8, ["disabled", "name", "modelValue"]));
671
+ }, 8, ["disabled", "name", "model-value"]));
669
672
  }
670
- }), Ke = /* @__PURE__ */ p({
673
+ }), We = /* @__PURE__ */ y({
671
674
  __name: "DateRenderer",
672
675
  props: {
673
676
  field: {},
@@ -680,21 +683,21 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
680
683
  emits: ["update:modelValue", "blur"],
681
684
  setup(e, { emit: l }) {
682
685
  const i = l;
683
- return (n, a) => (d(), v(Q, {
686
+ return (s, t) => (d(), x(Q, {
684
687
  id: e.fieldId,
685
688
  type: "date",
686
- modelValue: e.modelValue,
689
+ "model-value": e.modelValue,
687
690
  placeholder: e.field.placeholder,
688
691
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
689
692
  name: e.field.name,
690
693
  "aria-invalid": e.ariaInvalid,
691
694
  "aria-required": e.ariaRequired,
692
695
  "aria-describedby": e.ariaDescribedby,
693
- "onUpdate:modelValue": a[0] || (a[0] = (t) => i("update:modelValue", t)),
694
- onBlur: a[1] || (a[1] = (t) => i("blur", t))
695
- }, null, 8, ["id", "modelValue", "placeholder", "disabled", "name", "aria-invalid", "aria-required", "aria-describedby"]));
696
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => i("update:modelValue", a)),
697
+ onBlur: t[1] || (t[1] = (a) => i("blur", a))
698
+ }, null, 8, ["id", "model-value", "placeholder", "disabled", "name", "aria-invalid", "aria-required", "aria-describedby"]));
696
699
  }
697
- }), We = /* @__PURE__ */ p({
700
+ }), Je = /* @__PURE__ */ y({
698
701
  __name: "Switch",
699
702
  props: {
700
703
  defaultChecked: { type: Boolean },
@@ -710,19 +713,19 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
710
713
  },
711
714
  emits: ["update:checked"],
712
715
  setup(e, { emit: l }) {
713
- const i = e, n = l, a = h(() => {
714
- const { class: r, ...s } = i;
715
- return s;
716
- }), t = A(a, n);
717
- return (r, s) => (d(), v(o(xe), I(o(t), {
718
- class: o(w)(
716
+ const i = e, s = l, t = V(() => {
717
+ const { class: r, ...n } = i;
718
+ return n;
719
+ }), a = A(t, s);
720
+ return (r, n) => (d(), x(o(Ve), I(o(a), {
721
+ class: o(B)(
719
722
  "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
720
723
  i.class
721
724
  )
722
725
  }), {
723
- default: m(() => [
724
- b(o(Ve), {
725
- class: D(o(w)(
726
+ default: c(() => [
727
+ g(o(ke), {
728
+ class: D(o(B)(
726
729
  "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
727
730
  ))
728
731
  }, null, 8, ["class"])
@@ -730,7 +733,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
730
733
  _: 1
731
734
  }, 16, ["class"]));
732
735
  }
733
- }), Je = { class: "flex items-center space-x-2" }, Qe = /* @__PURE__ */ p({
736
+ }), Qe = { class: "flex items-center space-x-2" }, Xe = /* @__PURE__ */ y({
734
737
  __name: "SwitchRenderer",
735
738
  props: {
736
739
  field: {},
@@ -743,15 +746,15 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
743
746
  emits: ["update:modelValue", "blur"],
744
747
  setup(e, { emit: l }) {
745
748
  const i = l;
746
- return (n, a) => (d(), g("div", Je, [
747
- b(We, {
749
+ return (s, t) => (d(), h("div", Qe, [
750
+ g(Je, {
748
751
  id: e.fieldId,
749
752
  checked: e.modelValue,
750
753
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
751
754
  "aria-invalid": e.ariaInvalid,
752
755
  "aria-required": e.ariaRequired,
753
756
  "aria-describedby": e.ariaDescribedby,
754
- "onUpdate:checked": a[0] || (a[0] = (t) => i("update:modelValue", t))
757
+ "onUpdate:checked": t[0] || (t[0] = (a) => i("update:modelValue", a))
755
758
  }, null, 8, ["id", "checked", "disabled", "aria-invalid", "aria-required", "aria-describedby"])
756
759
  ]));
757
760
  }
@@ -760,16 +763,16 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
760
763
  number: P,
761
764
  password: P,
762
765
  email: P,
763
- textarea: De,
764
- select: Me,
765
- checkbox: Te,
766
- radio: He,
767
- date: Ke,
768
- switch: Qe
769
- }, Xe = {
766
+ textarea: Ne,
767
+ select: ze,
768
+ checkbox: Ge,
769
+ radio: Ke,
770
+ date: We,
771
+ switch: Xe
772
+ }, Ye = {
770
773
  key: 0,
771
774
  class: "text-destructive"
772
- }, Ye = ["id"], Ze = ["id"], _e = /* @__PURE__ */ p({
775
+ }, Ze = ["id"], _e = ["id"], et = /* @__PURE__ */ y({
773
776
  __name: "FormFieldRenderer",
774
777
  props: {
775
778
  field: {},
@@ -779,74 +782,74 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
779
782
  },
780
783
  emits: ["update:modelValue", "blur"],
781
784
  setup(e, { emit: l }) {
782
- const i = e, n = l, a = h(() => `field-${i.field.name}`), t = h(() => `${a.value}-description`), r = h(() => `${a.value}-error`), s = h(() => {
783
- var c;
784
- return (c = i.field.validations) == null ? void 0 : c.some((x) => x.type === "required");
785
- }), u = h(() => {
786
- const c = [];
787
- return i.field.description && c.push(t.value), i.error && c.push(r.value), c.length > 0 ? c.join(" ") : void 0;
788
- }), f = h(
785
+ const i = e, s = l, t = V(() => `field-${i.field.name}`), a = V(() => `${t.value}-description`), r = V(() => `${t.value}-error`), n = V(() => {
786
+ var f;
787
+ return (f = i.field.validations) == null ? void 0 : f.some((v) => v.type === "required");
788
+ }), u = V(() => {
789
+ const f = [];
790
+ return i.field.description && f.push(a.value), i.error && f.push(r.value), f.length > 0 ? f.join(" ") : void 0;
791
+ }), w = V(
789
792
  () => i.componentMap ? { ...H, ...i.componentMap } : H
790
- ), $ = h(
791
- () => f.value[i.field.type] ?? P
793
+ ), m = V(
794
+ () => w.value[i.field.type] ?? P
792
795
  );
793
- return (c, x) => (d(), g("div", {
796
+ return (f, v) => (d(), h("div", {
794
797
  class: D(["space-y-2", e.field.className])
795
798
  }, [
796
- e.field.label ? (d(), v(T, {
799
+ e.field.label ? (d(), x(T, {
797
800
  key: 0,
798
- for: a.value,
799
- class: D(s.value ? "flex items-center gap-1" : "")
801
+ for: t.value,
802
+ class: D(n.value ? "flex items-center gap-1" : "")
800
803
  }, {
801
- default: m(() => [
802
- U(F(e.field.label) + " ", 1),
803
- s.value ? (d(), g("span", Xe, "*")) : R("", !0)
804
+ default: c(() => [
805
+ U(R(e.field.label) + " ", 1),
806
+ n.value ? (d(), h("span", Ye, "*")) : C("", !0)
804
807
  ]),
805
808
  _: 1
806
- }, 8, ["for", "class"])) : R("", !0),
807
- (d(), v(Z($.value), {
809
+ }, 8, ["for", "class"])) : C("", !0),
810
+ (d(), x(_(m.value), {
808
811
  field: e.field,
809
- fieldId: a.value,
810
- modelValue: e.modelValue,
812
+ "field-id": t.value,
813
+ "model-value": e.modelValue,
811
814
  "aria-invalid": !!e.error,
812
- "aria-required": s.value,
815
+ "aria-required": n.value,
813
816
  "aria-describedby": u.value,
814
- "onUpdate:modelValue": x[0] || (x[0] = (V) => n("update:modelValue", V)),
815
- onBlur: x[1] || (x[1] = (V) => n("blur", V))
816
- }, null, 40, ["field", "fieldId", "modelValue", "aria-invalid", "aria-required", "aria-describedby"])),
817
- e.field.description ? (d(), g("p", {
817
+ "onUpdate:modelValue": v[0] || (v[0] = (S) => s("update:modelValue", S)),
818
+ onBlur: v[1] || (v[1] = (S) => s("blur", S))
819
+ }, null, 40, ["field", "field-id", "model-value", "aria-invalid", "aria-required", "aria-describedby"])),
820
+ e.field.description ? (d(), h("p", {
818
821
  key: 1,
819
- id: t.value,
822
+ id: a.value,
820
823
  class: "text-[0.8rem] text-muted-foreground"
821
- }, F(e.field.description), 9, Ye)) : R("", !0),
822
- e.error ? (d(), g("p", {
824
+ }, R(e.field.description), 9, Ze)) : C("", !0),
825
+ e.error ? (d(), h("p", {
823
826
  key: 2,
824
827
  id: r.value,
825
828
  class: "text-[0.8rem] font-medium text-destructive"
826
- }, F(e.error), 9, Ze)) : R("", !0)
829
+ }, R(e.error), 9, _e)) : C("", !0)
827
830
  ], 2));
828
831
  }
829
832
  });
830
- function et({ schema: e }) {
831
- const l = Re(e.fields, e.resolver, e.errorMessages), i = _(l.getState()), n = l.subscribe((u) => {
833
+ function tt({ schema: e }) {
834
+ const l = Ce(e.fields, e.resolver, e.errorMessages), i = ee(l.store.getState()), s = l.store.subscribe((u) => {
832
835
  i.value = u;
833
836
  });
834
- return ee(() => {
835
- n();
837
+ return te(() => {
838
+ s();
836
839
  }), {
837
- store: l,
840
+ engine: l,
838
841
  state: i,
839
842
  // This is a Ref
840
- setValue: async (u, f) => {
841
- await l.getState().setFieldValue(u, f);
843
+ setValue: async (u, w) => {
844
+ await l.setFieldValue(u, w);
842
845
  },
843
846
  getValue: (u) => M(i.value.values, u),
844
847
  validate: async () => {
845
- const { hasError: u, state: f } = await l.getState().runSubmitValidation();
846
- return { hasError: u, values: f.values };
848
+ const { hasError: u, state: w } = await l.runSubmitValidation();
849
+ return { hasError: u, values: w.values };
847
850
  },
848
851
  reset: () => {
849
- l.setState({
852
+ l.store.setState({
850
853
  values: {},
851
854
  errors: {},
852
855
  isSubmitting: !1
@@ -854,16 +857,16 @@ function et({ schema: e }) {
854
857
  }
855
858
  };
856
859
  }
857
- const tt = {
860
+ const at = {
858
861
  key: 0,
859
862
  class: "space-y-1"
860
- }, at = {
863
+ }, lt = {
861
864
  key: 0,
862
865
  class: "text-2xl font-bold tracking-tight"
863
- }, lt = {
866
+ }, it = {
864
867
  key: 1,
865
868
  class: "text-muted-foreground"
866
- }, it = { class: "space-y-4" }, nt = ["disabled"], ct = /* @__PURE__ */ p({
869
+ }, st = { class: "space-y-4" }, nt = ["disabled"], mt = /* @__PURE__ */ y({
867
870
  __name: "DynamicForm",
868
871
  props: {
869
872
  schema: {},
@@ -872,58 +875,58 @@ const tt = {
872
875
  },
873
876
  emits: ["submit"],
874
877
  setup(e, { emit: l }) {
875
- const i = e, n = l, a = et({ schema: i.schema }), t = i.form || a, { store: r, state: s } = t, u = async (y, C) => {
876
- await r.getState().setFieldValue(y, C);
877
- }, f = async (y) => {
878
- await r.getState().setFieldBlur(y);
879
- }, $ = (y) => typeof y.hidden == "function" ? y.hidden(s.value.values) : !!y.hidden, c = (y) => {
880
- const C = typeof y.disabled == "function" ? y.disabled(s.value.values) : !!y.disabled, k = s.value.validatingFields.includes(y.name);
881
- return { ...y, disabled: C || k };
882
- }, x = async () => {
883
- const { hasError: y, values: C } = await t.validate();
884
- if (y) {
885
- const k = i.schema.fields.find((B) => s.value.errors[B.name]);
886
- if (k) {
887
- const B = document.getElementById(`field-${k.name}`);
888
- B == null || B.focus(), B == null || B.scrollIntoView({ behavior: "smooth", block: "center" });
878
+ const i = e, s = l, t = tt({ schema: i.schema }), a = i.form || t, { engine: r, state: n } = a, u = async (p, F) => {
879
+ await r.setFieldValue(p, F);
880
+ }, w = async (p) => {
881
+ await r.setFieldBlur(p);
882
+ }, m = (p) => typeof p.hidden == "function" ? p.hidden(n.value.values) : !!p.hidden, f = (p) => {
883
+ const F = typeof p.disabled == "function" ? p.disabled(n.value.values) : !!p.disabled, b = n.value.validatingFields.includes(p.name);
884
+ return { ...p, disabled: F || b };
885
+ }, v = async () => {
886
+ const { hasError: p, values: F } = await a.validate();
887
+ if (p) {
888
+ const b = i.schema.fields.find((k) => n.value.errors[k.name]);
889
+ if (b) {
890
+ const k = document.getElementById(`field-${b.name}`);
891
+ k == null || k.focus(), k == null || k.scrollIntoView({ behavior: "smooth", block: "center" });
889
892
  }
890
893
  return;
891
894
  }
892
- await n("submit", C);
893
- }, V = h(() => s.value.validatingFields.length > 0);
894
- return (y, C) => (d(), g("form", {
895
+ await s("submit", F);
896
+ }, S = V(() => n.value.validatingFields.length > 0);
897
+ return (p, F) => (d(), h("form", {
895
898
  class: D(["space-y-6", e.className]),
896
- onSubmit: te(x, ["prevent"])
899
+ onSubmit: ae(v, ["prevent"])
897
900
  }, [
898
- e.schema.title || e.schema.description ? (d(), g("div", tt, [
899
- e.schema.title ? (d(), g("h2", at, F(e.schema.title), 1)) : R("", !0),
900
- e.schema.description ? (d(), g("p", lt, F(e.schema.description), 1)) : R("", !0)
901
- ])) : R("", !0),
902
- O("div", it, [
903
- (d(!0), g(N, null, E(e.schema.fields, (k) => (d(), g(N, {
904
- key: k.id
901
+ e.schema.title || e.schema.description ? (d(), h("div", at, [
902
+ e.schema.title ? (d(), h("h2", lt, R(e.schema.title), 1)) : C("", !0),
903
+ e.schema.description ? (d(), h("p", it, R(e.schema.description), 1)) : C("", !0)
904
+ ])) : C("", !0),
905
+ z("div", st, [
906
+ (d(!0), h(N, null, E(e.schema.fields, (b) => (d(), h(N, {
907
+ key: b.id
905
908
  }, [
906
- $(k) ? R("", !0) : (d(), v(_e, {
909
+ m(b) ? C("", !0) : (d(), x(et, {
907
910
  key: 0,
908
- field: c(k),
909
- "model-value": o(M)(o(s).values, k.name),
910
- error: o(s).errors[k.name],
911
- "onUpdate:modelValue": (B) => u(k.name, B),
912
- onBlur: (B) => f(k.name)
911
+ field: f(b),
912
+ "model-value": o(M)(o(n).values, b.name),
913
+ error: o(n).errors[b.name],
914
+ "onUpdate:modelValue": (k) => u(b.name, k),
915
+ onBlur: (k) => w(b.name)
913
916
  }, null, 8, ["field", "model-value", "error", "onUpdate:modelValue", "onBlur"]))
914
917
  ], 64))), 128))
915
918
  ]),
916
- O("button", {
919
+ z("button", {
917
920
  type: "submit",
918
- disabled: o(s).isSubmitting || V.value,
921
+ disabled: o(n).isSubmitting || S.value,
919
922
  class: "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-4 py-2 w-full"
920
- }, F(o(s).isSubmitting ? "Submitting..." : V.value ? "Validating..." : e.schema.submitButtonText || "Submit"), 9, nt)
923
+ }, R(o(n).isSubmitting ? "Submitting..." : S.value ? "Validating..." : e.schema.submitButtonText || "Submit"), 9, nt)
921
924
  ], 34));
922
925
  }
923
926
  });
924
927
  export {
925
- ct as DynamicForm,
926
- _e as FormFieldRenderer,
928
+ mt as DynamicForm,
929
+ et as FormFieldRenderer,
927
930
  H as defaultComponentMap,
928
- et as useForm
931
+ tt as useForm
929
932
  };