pdyform 2.2.0 → 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 $, unref as o, createBlock as y, 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 I, 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 W, 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,179 +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], c = /^\d+$/.test(u);
39
- !(s in t) || t[s] === null || typeof t[s] != "object" ? t[s] = c ? [] : {} : 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
- function H(e, l) {
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 $e(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]) return;
116
- const s = await J(M(l, r.name), r, n);
117
- s && (a[r.name] = s);
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 Ie(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 = (c, x) => {
127
- const f = typeof c == "function" ? c(l) : c;
128
- if (!Object.is(f, l)) {
129
- const V = l;
130
- l = x ?? (typeof f != "object" || f === null) ? f : Object.assign({}, l, f), i.forEach((F) => F(l, V));
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: (c) => (i.add(c), () => i.delete(c)) }, 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: Ie(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 ? H(s, r) : r;
143
- n((c) => ({
144
- values: Se(c.values, t, u),
145
- validatingFields: [...c.validatingFields, t]
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)
146
148
  }));
147
- try {
148
- const c = a().values, x = await G(e, t, u, l, c, i);
149
- n((f) => ({
150
- errors: { ...f.errors, [t]: x || "" },
151
- validatingFields: f.validatingFields.filter((V) => V !== t)
152
- }));
153
- } catch {
154
- n((x) => ({
155
- validatingFields: x.validatingFields.filter((f) => f !== 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]
156
153
  }));
154
+ try {
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)
159
+ }));
160
+ } catch {
161
+ a((b) => ({
162
+ validatingFields: b.validatingFields.filter((k) => k !== m)
163
+ }));
164
+ }
157
165
  }
158
166
  },
159
- setFieldBlur: async (t) => {
160
- n((r) => ({
161
- validatingFields: [...r.validatingFields, t]
167
+ setFieldBlur: async (m) => {
168
+ a((f) => ({
169
+ validatingFields: [...f.validatingFields, m]
162
170
  }));
163
171
  try {
164
- const r = a().values, s = M(r, t), u = await G(e, t, s, l, r, i);
165
- n((c) => ({
166
- errors: { ...c.errors, [t]: u || "" },
167
- validatingFields: c.validatingFields.filter((x) => x !== 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)
168
176
  }));
169
177
  } catch {
170
- n((s) => ({
171
- validatingFields: s.validatingFields.filter((u) => u !== t)
178
+ a((f) => ({
179
+ validatingFields: f.validatingFields.filter((v) => v !== m)
172
180
  }));
173
181
  }
174
182
  },
175
- setSubmitting: (t) => n({ isSubmitting: t }),
183
+ setSubmitting: (m) => a({ isSubmitting: m }),
176
184
  runSubmitValidation: async () => {
177
- n({ isSubmitting: !0 });
178
- const t = a(), r = await $e(e, t.values, l, i), s = Object.keys(r).length > 0;
179
- return n({
180
- 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,
181
189
  isSubmitting: !1
182
190
  }), {
183
- state: a(),
184
- hasError: s
191
+ state: t(),
192
+ hasError: v
185
193
  };
186
194
  }
187
- }));
195
+ };
188
196
  }
189
- function w(...e) {
190
- return le(ae(e));
197
+ function B(...e) {
198
+ return ie(le(e));
191
199
  }
192
- const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
200
+ const qe = ["type", "value"], Q = /* @__PURE__ */ y({
193
201
  __name: "Input",
194
202
  props: {
195
203
  class: {},
@@ -198,16 +206,16 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
198
206
  },
199
207
  emits: ["update:modelValue", "blur"],
200
208
  setup(e, { emit: l }) {
201
- const i = e, n = l;
202
- return (a, t) => (d(), g("input", $(a.$attrs, {
209
+ const i = e, s = l;
210
+ return (t, a) => (d(), h("input", I(t.$attrs, {
203
211
  type: e.type,
204
- 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),
205
213
  value: e.modelValue,
206
- onInput: t[0] || (t[0] = (r) => n("update:modelValue", r.target.value)),
207
- onBlur: t[1] || (t[1] = (r) => n("blur", r))
208
- }), 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));
209
217
  }
210
- }), P = /* @__PURE__ */ p({
218
+ }), P = /* @__PURE__ */ y({
211
219
  __name: "InputRenderer",
212
220
  props: {
213
221
  field: {},
@@ -219,21 +227,21 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
219
227
  },
220
228
  emits: ["update:modelValue", "blur"],
221
229
  setup(e, { emit: l }) {
222
- const i = e, n = l, a = (t) => {
223
- n("update:modelValue", H(i.field, t));
230
+ const i = e, s = l, t = (a) => {
231
+ s("update:modelValue", W(i.field, a));
224
232
  };
225
- return (t, r) => (d(), y(Q, {
233
+ return (a, r) => (d(), x(Q, {
226
234
  id: e.fieldId,
227
235
  type: e.field.type,
228
236
  placeholder: e.field.placeholder,
229
237
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
230
238
  name: e.field.name,
231
- modelValue: e.modelValue ?? "",
232
- "onUpdate:modelValue": a,
233
- onBlur: r[0] || (r[0] = (s) => n("blur", s))
234
- }, 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"]));
235
243
  }
236
- }), qe = ["value"], Pe = /* @__PURE__ */ p({
244
+ }), Pe = ["value"], De = /* @__PURE__ */ y({
237
245
  __name: "Textarea",
238
246
  props: {
239
247
  class: {},
@@ -241,15 +249,15 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
241
249
  },
242
250
  emits: ["update:modelValue", "blur"],
243
251
  setup(e, { emit: l }) {
244
- const i = e, n = l;
245
- return (a, t) => (d(), g("textarea", $(a.$attrs, {
246
- 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),
247
255
  value: e.modelValue,
248
- onInput: t[0] || (t[0] = (r) => n("update:modelValue", r.target.value)),
249
- onBlur: t[1] || (t[1] = (r) => n("blur", r))
250
- }), 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));
251
259
  }
252
- }), De = /* @__PURE__ */ p({
260
+ }), Ne = /* @__PURE__ */ y({
253
261
  __name: "TextareaRenderer",
254
262
  props: {
255
263
  field: {},
@@ -262,16 +270,16 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
262
270
  emits: ["update:modelValue"],
263
271
  setup(e, { emit: l }) {
264
272
  const i = l;
265
- return (n, a) => (d(), y(Pe, {
273
+ return (s, t) => (d(), x(De, {
266
274
  id: e.fieldId,
267
275
  placeholder: e.field.placeholder,
268
276
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
269
277
  name: e.field.name,
270
- modelValue: e.modelValue ?? "",
271
- "onUpdate:modelValue": a[0] || (a[0] = (t) => i("update:modelValue", t))
272
- }, 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"]));
273
281
  }
274
- }), Ne = /* @__PURE__ */ p({
282
+ }), Ee = /* @__PURE__ */ y({
275
283
  __name: "SelectTrigger",
276
284
  props: {
277
285
  disabled: { type: Boolean },
@@ -280,18 +288,18 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
280
288
  class: {}
281
289
  },
282
290
  setup(e) {
283
- const l = e, i = h(() => {
284
- const { class: a, ...t } = l;
285
- return t;
286
- }), n = j(i);
287
- return (a, t) => (d(), y(o(ie), $(o(n), {
288
- 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)
289
297
  }), {
290
- default: m(() => [
291
- q(a.$slots, "default"),
292
- b(o(ne), { "as-child": "" }, {
293
- default: m(() => [
294
- 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" })
295
303
  ]),
296
304
  _: 1
297
305
  })
@@ -299,7 +307,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
299
307
  _: 3
300
308
  }, 16, ["class"]));
301
309
  }
302
- }), Ee = /* @__PURE__ */ p({
310
+ }), Ue = /* @__PURE__ */ y({
303
311
  __name: "SelectContent",
304
312
  props: {
305
313
  forceMount: { type: Boolean },
@@ -322,21 +330,21 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
322
330
  class: {}
323
331
  },
324
332
  setup(e) {
325
- const l = e, i = h(() => {
326
- const { class: a, ...t } = l;
327
- return t;
328
- }), n = j(i);
329
- return (a, t) => (d(), y(o(se), null, {
330
- default: m(() => [
331
- b(o(re), $(o(n), {
332
- 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)
333
341
  }), {
334
- default: m(() => [
335
- b(o(oe), {
336
- 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)]"))
337
345
  }, {
338
- default: m(() => [
339
- q(a.$slots, "default")
346
+ default: c(() => [
347
+ q(t.$slots, "default")
340
348
  ]),
341
349
  _: 3
342
350
  }, 8, ["class"])
@@ -347,7 +355,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
347
355
  _: 3
348
356
  }));
349
357
  }
350
- }), 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({
351
359
  __name: "SelectItem",
352
360
  props: {
353
361
  value: {},
@@ -358,28 +366,28 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
358
366
  class: {}
359
367
  },
360
368
  setup(e) {
361
- const l = e, i = h(() => {
362
- const { class: a, ...t } = l;
363
- return t;
364
- }), n = j(i);
365
- return (a, t) => (d(), y(o(de), $(o(n), {
366
- 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)(
367
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",
368
376
  l.class
369
377
  )
370
378
  }), {
371
- default: m(() => [
372
- O("span", Ue, [
373
- b(o(ue), null, {
374
- default: m(() => [
375
- b(o(W), { 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" })
376
384
  ]),
377
385
  _: 1
378
386
  })
379
387
  ]),
380
- b(o(ce), null, {
381
- default: m(() => [
382
- q(a.$slots, "default")
388
+ g(o(me), null, {
389
+ default: c(() => [
390
+ q(t.$slots, "default")
383
391
  ]),
384
392
  _: 3
385
393
  })
@@ -387,7 +395,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
387
395
  _: 3
388
396
  }, 16, ["class"]));
389
397
  }
390
- }), Ae = /* @__PURE__ */ p({
398
+ }), Me = /* @__PURE__ */ y({
391
399
  __name: "Select",
392
400
  props: {
393
401
  open: { type: Boolean },
@@ -402,15 +410,15 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
402
410
  },
403
411
  emits: ["update:modelValue", "update:open"],
404
412
  setup(e, { emit: l }) {
405
- const a = A(e, l);
406
- return (t, r) => (d(), y(o(me), X(Y(o(a))), {
407
- default: m(() => [
408
- 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")
409
417
  ]),
410
418
  _: 3
411
419
  }, 16));
412
420
  }
413
- }), Me = /* @__PURE__ */ p({
421
+ }), ze = /* @__PURE__ */ y({
414
422
  __name: "SelectRenderer",
415
423
  props: {
416
424
  field: {},
@@ -423,29 +431,29 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
423
431
  emits: ["update:modelValue"],
424
432
  setup(e, { emit: l }) {
425
433
  const i = l;
426
- return (n, a) => (d(), y(Ae, {
434
+ return (s, t) => (d(), x(Me, {
427
435
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
428
436
  name: e.field.name,
429
- modelValue: e.modelValue != null ? String(e.modelValue) : "",
430
- "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))
431
439
  }, {
432
- default: m(() => [
433
- b(Ne, { id: e.fieldId }, {
434
- default: m(() => [
435
- b(o(fe), {
440
+ default: c(() => [
441
+ g(Ee, { id: e.fieldId }, {
442
+ default: c(() => [
443
+ g(o(be), {
436
444
  placeholder: e.field.placeholder || "Select an option"
437
445
  }, null, 8, ["placeholder"])
438
446
  ]),
439
447
  _: 1
440
448
  }, 8, ["id"]),
441
- b(Ee, null, {
442
- default: m(() => [
443
- (d(!0), g(N, null, E(e.field.options, (t) => (d(), y(je, {
444
- key: t.value,
445
- 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)
446
454
  }, {
447
- default: m(() => [
448
- U(I(t.label), 1)
455
+ default: c(() => [
456
+ U(R(a.label), 1)
449
457
  ]),
450
458
  _: 2
451
459
  }, 1032, ["value"]))), 128))
@@ -454,9 +462,9 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
454
462
  })
455
463
  ]),
456
464
  _: 1
457
- }, 8, ["disabled", "name", "modelValue"]));
465
+ }, 8, ["disabled", "name", "model-value"]));
458
466
  }
459
- }), Oe = /* @__PURE__ */ p({
467
+ }), Oe = /* @__PURE__ */ y({
460
468
  __name: "Checkbox",
461
469
  props: {
462
470
  defaultChecked: { type: Boolean },
@@ -472,18 +480,18 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
472
480
  },
473
481
  emits: ["update:checked", "blur"],
474
482
  setup(e, { emit: l }) {
475
- const i = e, n = l, a = h(() => {
476
- const { class: r, ...s } = i;
477
- return s;
478
- }), t = A(a, n);
479
- return (r, s) => (d(), y(o(be), $(o(t), {
480
- 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),
481
- 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"))
482
490
  }), {
483
- default: m(() => [
484
- b(o(pe), { class: "flex h-full w-full items-center justify-center text-current" }, {
485
- default: m(() => [
486
- b(o(W), { 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" })
487
495
  ]),
488
496
  _: 1
489
497
  })
@@ -491,7 +499,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
491
499
  _: 1
492
500
  }, 16, ["class"]));
493
501
  }
494
- }), T = /* @__PURE__ */ p({
502
+ }), T = /* @__PURE__ */ y({
495
503
  __name: "Label",
496
504
  props: {
497
505
  for: {},
@@ -500,20 +508,20 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
500
508
  class: {}
501
509
  },
502
510
  setup(e) {
503
- const l = e, i = h(() => {
504
- const { class: n, ...a } = l;
505
- return a;
511
+ const l = e, i = V(() => {
512
+ const { class: s, ...t } = l;
513
+ return t;
506
514
  });
507
- return (n, a) => (d(), y(o(ge), $(i.value, {
508
- 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)
509
517
  }), {
510
- default: m(() => [
511
- q(n.$slots, "default")
518
+ default: c(() => [
519
+ q(s.$slots, "default")
512
520
  ]),
513
521
  _: 3
514
522
  }, 16, ["class"]));
515
523
  }
516
- }), ze = { class: "flex flex-wrap gap-4" }, Te = /* @__PURE__ */ p({
524
+ }), Te = { class: "flex flex-wrap gap-4" }, Ge = /* @__PURE__ */ y({
517
525
  __name: "CheckboxRenderer",
518
526
  props: {
519
527
  field: {},
@@ -525,40 +533,40 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
525
533
  },
526
534
  emits: ["update:modelValue"],
527
535
  setup(e, { emit: l }) {
528
- const i = e, n = l, a = (t, r) => {
529
- 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] : [];
530
538
  if (r)
531
- s.push(t);
539
+ n.push(a);
532
540
  else {
533
- const u = s.indexOf(t);
534
- u > -1 && s.splice(u, 1);
541
+ const u = n.indexOf(a);
542
+ u > -1 && n.splice(u, 1);
535
543
  }
536
- n("update:modelValue", s);
544
+ s("update:modelValue", n);
537
545
  };
538
- return (t, r) => (d(), g("div", ze, [
539
- (d(!0), g(N, null, E(e.field.options, (s) => (d(), g("div", {
540
- 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,
541
549
  class: "flex items-center space-x-2"
542
550
  }, [
543
- b(Oe, {
544
- id: `checkbox-${e.field.name}-${s.value}`,
551
+ g(Oe, {
552
+ id: `checkbox-${e.field.name}-${n.value}`,
545
553
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
546
- checked: Array.isArray(e.modelValue) && e.modelValue.includes(s.value),
547
- "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)
548
556
  }, null, 8, ["id", "disabled", "checked", "onUpdate:checked"]),
549
- b(T, {
550
- for: `checkbox-${e.field.name}-${s.value}`,
557
+ g(T, {
558
+ for: `checkbox-${e.field.name}-${n.value}`,
551
559
  class: "font-normal"
552
560
  }, {
553
- default: m(() => [
554
- U(I(s.label), 1)
561
+ default: c(() => [
562
+ U(R(n.label), 1)
555
563
  ]),
556
564
  _: 2
557
565
  }, 1032, ["for"])
558
566
  ]))), 128))
559
567
  ]));
560
568
  }
561
- }), Ge = /* @__PURE__ */ p({
569
+ }), Le = /* @__PURE__ */ y({
562
570
  __name: "RadioGroupItem",
563
571
  props: {
564
572
  id: {},
@@ -571,17 +579,17 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
571
579
  class: {}
572
580
  },
573
581
  setup(e) {
574
- const l = e, i = h(() => {
575
- const { class: a, ...t } = l;
576
- return t;
577
- }), n = j(i);
578
- return (a, t) => (d(), y(o(ye), $(o(n), {
579
- 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)
580
588
  }), {
581
- default: m(() => [
582
- b(o(ve), { class: "flex items-center justify-center" }, {
583
- default: m(() => [
584
- 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" })
585
593
  ]),
586
594
  _: 1
587
595
  })
@@ -589,7 +597,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
589
597
  _: 1
590
598
  }, 16, ["class"]));
591
599
  }
592
- }), Le = /* @__PURE__ */ p({
600
+ }), He = /* @__PURE__ */ y({
593
601
  __name: "RadioGroup",
594
602
  props: {
595
603
  modelValue: {},
@@ -606,20 +614,20 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
606
614
  },
607
615
  emits: ["update:modelValue"],
608
616
  setup(e, { emit: l }) {
609
- const i = e, n = l, a = h(() => {
610
- const { class: r, ...s } = i;
611
- return s;
612
- }), t = A(a, n);
613
- return (r, s) => (d(), y(o(he), $(o(t), {
614
- 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)
615
623
  }), {
616
- default: m(() => [
624
+ default: c(() => [
617
625
  q(r.$slots, "default")
618
626
  ]),
619
627
  _: 3
620
628
  }, 16, ["class"]));
621
629
  }
622
- }), Ke = /* @__PURE__ */ p({
630
+ }), Ke = /* @__PURE__ */ y({
623
631
  __name: "RadioRenderer",
624
632
  props: {
625
633
  field: {},
@@ -632,37 +640,37 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
632
640
  emits: ["update:modelValue"],
633
641
  setup(e, { emit: l }) {
634
642
  const i = l;
635
- return (n, a) => (d(), y(Le, {
643
+ return (s, t) => (d(), x(He, {
636
644
  class: "flex flex-wrap gap-4",
637
645
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
638
646
  name: e.field.name,
639
- modelValue: e.modelValue != null ? String(e.modelValue) : "",
640
- "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))
641
649
  }, {
642
- default: m(() => [
643
- (d(!0), g(N, null, E(e.field.options, (t) => (d(), g("div", {
644
- key: t.value,
650
+ default: c(() => [
651
+ (d(!0), h(N, null, E(e.field.options, (a) => (d(), h("div", {
652
+ key: a.value,
645
653
  class: "flex items-center space-x-2"
646
654
  }, [
647
- b(Ge, {
648
- id: `radio-${e.field.name}-${t.value}`,
649
- value: String(t.value)
655
+ g(Le, {
656
+ id: `radio-${e.field.name}-${a.value}`,
657
+ value: String(a.value)
650
658
  }, null, 8, ["id", "value"]),
651
- b(T, {
652
- for: `radio-${e.field.name}-${t.value}`,
659
+ g(T, {
660
+ for: `radio-${e.field.name}-${a.value}`,
653
661
  class: "font-normal"
654
662
  }, {
655
- default: m(() => [
656
- U(I(t.label), 1)
663
+ default: c(() => [
664
+ U(R(a.label), 1)
657
665
  ]),
658
666
  _: 2
659
667
  }, 1032, ["for"])
660
668
  ]))), 128))
661
669
  ]),
662
670
  _: 1
663
- }, 8, ["disabled", "name", "modelValue"]));
671
+ }, 8, ["disabled", "name", "model-value"]));
664
672
  }
665
- }), We = /* @__PURE__ */ p({
673
+ }), We = /* @__PURE__ */ y({
666
674
  __name: "DateRenderer",
667
675
  props: {
668
676
  field: {},
@@ -675,21 +683,21 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
675
683
  emits: ["update:modelValue", "blur"],
676
684
  setup(e, { emit: l }) {
677
685
  const i = l;
678
- return (n, a) => (d(), y(Q, {
686
+ return (s, t) => (d(), x(Q, {
679
687
  id: e.fieldId,
680
688
  type: "date",
681
- modelValue: e.modelValue,
689
+ "model-value": e.modelValue,
682
690
  placeholder: e.field.placeholder,
683
691
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
684
692
  name: e.field.name,
685
693
  "aria-invalid": e.ariaInvalid,
686
694
  "aria-required": e.ariaRequired,
687
695
  "aria-describedby": e.ariaDescribedby,
688
- "onUpdate:modelValue": a[0] || (a[0] = (t) => i("update:modelValue", t)),
689
- onBlur: a[1] || (a[1] = (t) => i("blur", t))
690
- }, 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"]));
691
699
  }
692
- }), He = /* @__PURE__ */ p({
700
+ }), Je = /* @__PURE__ */ y({
693
701
  __name: "Switch",
694
702
  props: {
695
703
  defaultChecked: { type: Boolean },
@@ -705,19 +713,19 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
705
713
  },
706
714
  emits: ["update:checked"],
707
715
  setup(e, { emit: l }) {
708
- const i = e, n = l, a = h(() => {
709
- const { class: r, ...s } = i;
710
- return s;
711
- }), t = A(a, n);
712
- return (r, s) => (d(), y(o(xe), $(o(t), {
713
- 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)(
714
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",
715
723
  i.class
716
724
  )
717
725
  }), {
718
- default: m(() => [
719
- b(o(Ve), {
720
- class: D(o(w)(
726
+ default: c(() => [
727
+ g(o(ke), {
728
+ class: D(o(B)(
721
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"
722
730
  ))
723
731
  }, null, 8, ["class"])
@@ -725,7 +733,7 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
725
733
  _: 1
726
734
  }, 16, ["class"]));
727
735
  }
728
- }), Je = { class: "flex items-center space-x-2" }, Qe = /* @__PURE__ */ p({
736
+ }), Qe = { class: "flex items-center space-x-2" }, Xe = /* @__PURE__ */ y({
729
737
  __name: "SwitchRenderer",
730
738
  props: {
731
739
  field: {},
@@ -738,33 +746,33 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
738
746
  emits: ["update:modelValue", "blur"],
739
747
  setup(e, { emit: l }) {
740
748
  const i = l;
741
- return (n, a) => (d(), g("div", Je, [
742
- b(He, {
749
+ return (s, t) => (d(), h("div", Qe, [
750
+ g(Je, {
743
751
  id: e.fieldId,
744
752
  checked: e.modelValue,
745
753
  disabled: typeof e.field.disabled == "boolean" ? e.field.disabled : void 0,
746
754
  "aria-invalid": e.ariaInvalid,
747
755
  "aria-required": e.ariaRequired,
748
756
  "aria-describedby": e.ariaDescribedby,
749
- "onUpdate:checked": a[0] || (a[0] = (t) => i("update:modelValue", t))
757
+ "onUpdate:checked": t[0] || (t[0] = (a) => i("update:modelValue", a))
750
758
  }, null, 8, ["id", "checked", "disabled", "aria-invalid", "aria-required", "aria-describedby"])
751
759
  ]));
752
760
  }
753
- }), K = {
761
+ }), H = {
754
762
  text: P,
755
763
  number: P,
756
764
  password: P,
757
765
  email: P,
758
- textarea: De,
759
- select: Me,
760
- checkbox: Te,
766
+ textarea: Ne,
767
+ select: ze,
768
+ checkbox: Ge,
761
769
  radio: Ke,
762
770
  date: We,
763
- switch: Qe
764
- }, Xe = {
771
+ switch: Xe
772
+ }, Ye = {
765
773
  key: 0,
766
774
  class: "text-destructive"
767
- }, Ye = ["id"], Ze = ["id"], _e = /* @__PURE__ */ p({
775
+ }, Ze = ["id"], _e = ["id"], et = /* @__PURE__ */ y({
768
776
  __name: "FormFieldRenderer",
769
777
  props: {
770
778
  field: {},
@@ -774,74 +782,74 @@ const Ce = ["type", "value"], Q = /* @__PURE__ */ p({
774
782
  },
775
783
  emits: ["update:modelValue", "blur"],
776
784
  setup(e, { emit: l }) {
777
- const i = e, n = l, a = h(() => `field-${i.field.name}`), t = h(() => `${a.value}-description`), r = h(() => `${a.value}-error`), s = 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(() => {
778
786
  var f;
779
- return (f = i.field.validations) == null ? void 0 : f.some((V) => V.type === "required");
780
- }), u = h(() => {
787
+ return (f = i.field.validations) == null ? void 0 : f.some((v) => v.type === "required");
788
+ }), u = V(() => {
781
789
  const f = [];
782
- return i.field.description && f.push(t.value), i.error && f.push(r.value), f.length > 0 ? f.join(" ") : void 0;
783
- }), c = h(
784
- () => i.componentMap ? { ...K, ...i.componentMap } : K
785
- ), x = h(
786
- () => c.value[i.field.type] ?? P
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(
792
+ () => i.componentMap ? { ...H, ...i.componentMap } : H
793
+ ), m = V(
794
+ () => w.value[i.field.type] ?? P
787
795
  );
788
- return (f, V) => (d(), g("div", {
796
+ return (f, v) => (d(), h("div", {
789
797
  class: D(["space-y-2", e.field.className])
790
798
  }, [
791
- e.field.label ? (d(), y(T, {
799
+ e.field.label ? (d(), x(T, {
792
800
  key: 0,
793
- for: a.value,
794
- class: D(s.value ? "flex items-center gap-1" : "")
801
+ for: t.value,
802
+ class: D(n.value ? "flex items-center gap-1" : "")
795
803
  }, {
796
- default: m(() => [
797
- U(I(e.field.label) + " ", 1),
798
- 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)
799
807
  ]),
800
808
  _: 1
801
- }, 8, ["for", "class"])) : R("", !0),
802
- (d(), y(Z(x.value), {
809
+ }, 8, ["for", "class"])) : C("", !0),
810
+ (d(), x(_(m.value), {
803
811
  field: e.field,
804
- fieldId: a.value,
805
- modelValue: e.modelValue,
812
+ "field-id": t.value,
813
+ "model-value": e.modelValue,
806
814
  "aria-invalid": !!e.error,
807
- "aria-required": s.value,
815
+ "aria-required": n.value,
808
816
  "aria-describedby": u.value,
809
- "onUpdate:modelValue": V[0] || (V[0] = (F) => n("update:modelValue", F)),
810
- onBlur: V[1] || (V[1] = (F) => n("blur", F))
811
- }, null, 40, ["field", "fieldId", "modelValue", "aria-invalid", "aria-required", "aria-describedby"])),
812
- 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", {
813
821
  key: 1,
814
- id: t.value,
822
+ id: a.value,
815
823
  class: "text-[0.8rem] text-muted-foreground"
816
- }, I(e.field.description), 9, Ye)) : R("", !0),
817
- e.error ? (d(), g("p", {
824
+ }, R(e.field.description), 9, Ze)) : C("", !0),
825
+ e.error ? (d(), h("p", {
818
826
  key: 2,
819
827
  id: r.value,
820
828
  class: "text-[0.8rem] font-medium text-destructive"
821
- }, I(e.error), 9, Ze)) : R("", !0)
829
+ }, R(e.error), 9, _e)) : C("", !0)
822
830
  ], 2));
823
831
  }
824
832
  });
825
- function et({ schema: e }) {
826
- 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) => {
827
835
  i.value = u;
828
836
  });
829
- return ee(() => {
830
- n();
837
+ return te(() => {
838
+ s();
831
839
  }), {
832
- store: l,
840
+ engine: l,
833
841
  state: i,
834
842
  // This is a Ref
835
- setValue: async (u, c) => {
836
- await l.getState().setFieldValue(u, c);
843
+ setValue: async (u, w) => {
844
+ await l.setFieldValue(u, w);
837
845
  },
838
846
  getValue: (u) => M(i.value.values, u),
839
847
  validate: async () => {
840
- const { hasError: u, state: c } = await l.getState().runSubmitValidation();
841
- return { hasError: u, values: c.values };
848
+ const { hasError: u, state: w } = await l.runSubmitValidation();
849
+ return { hasError: u, values: w.values };
842
850
  },
843
851
  reset: () => {
844
- l.setState({
852
+ l.store.setState({
845
853
  values: {},
846
854
  errors: {},
847
855
  isSubmitting: !1
@@ -849,16 +857,16 @@ function et({ schema: e }) {
849
857
  }
850
858
  };
851
859
  }
852
- const tt = {
860
+ const at = {
853
861
  key: 0,
854
862
  class: "space-y-1"
855
- }, at = {
863
+ }, lt = {
856
864
  key: 0,
857
865
  class: "text-2xl font-bold tracking-tight"
858
- }, lt = {
866
+ }, it = {
859
867
  key: 1,
860
868
  class: "text-muted-foreground"
861
- }, it = { class: "space-y-4" }, nt = ["disabled"], ct = /* @__PURE__ */ p({
869
+ }, st = { class: "space-y-4" }, nt = ["disabled"], mt = /* @__PURE__ */ y({
862
870
  __name: "DynamicForm",
863
871
  props: {
864
872
  schema: {},
@@ -867,58 +875,58 @@ const tt = {
867
875
  },
868
876
  emits: ["submit"],
869
877
  setup(e, { emit: l }) {
870
- const i = e, n = l, a = et({ schema: i.schema }), t = i.form || a, { store: r, state: s } = t, u = async (v, C) => {
871
- await r.getState().setFieldValue(v, C);
872
- }, c = async (v) => {
873
- await r.getState().setFieldBlur(v);
874
- }, x = (v) => typeof v.hidden == "function" ? v.hidden(s.value.values) : !!v.hidden, f = (v) => {
875
- const C = typeof v.disabled == "function" ? v.disabled(s.value.values) : !!v.disabled, k = s.value.validatingFields.includes(v.name);
876
- return { ...v, disabled: C || k };
877
- }, V = async () => {
878
- const { hasError: v, values: C } = await t.validate();
879
- if (v) {
880
- const k = i.schema.fields.find((B) => s.value.errors[B.name]);
881
- if (k) {
882
- const B = document.getElementById(`field-${k.name}`);
883
- 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" });
884
892
  }
885
893
  return;
886
894
  }
887
- n("submit", C);
888
- }, F = h(() => s.value.validatingFields.length > 0);
889
- return (v, C) => (d(), g("form", {
895
+ await s("submit", F);
896
+ }, S = V(() => n.value.validatingFields.length > 0);
897
+ return (p, F) => (d(), h("form", {
890
898
  class: D(["space-y-6", e.className]),
891
- onSubmit: te(V, ["prevent"])
899
+ onSubmit: ae(v, ["prevent"])
892
900
  }, [
893
- e.schema.title || e.schema.description ? (d(), g("div", tt, [
894
- e.schema.title ? (d(), g("h2", at, I(e.schema.title), 1)) : R("", !0),
895
- e.schema.description ? (d(), g("p", lt, I(e.schema.description), 1)) : R("", !0)
896
- ])) : R("", !0),
897
- O("div", it, [
898
- (d(!0), g(N, null, E(e.schema.fields, (k) => (d(), g(N, {
899
- 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
900
908
  }, [
901
- x(k) ? R("", !0) : (d(), y(_e, {
909
+ m(b) ? C("", !0) : (d(), x(et, {
902
910
  key: 0,
903
- field: f(k),
904
- "model-value": o(M)(o(s).values, k.name),
905
- error: o(s).errors[k.name],
906
- "onUpdate:modelValue": (B) => u(k.name, B),
907
- onBlur: (B) => c(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)
908
916
  }, null, 8, ["field", "model-value", "error", "onUpdate:modelValue", "onBlur"]))
909
917
  ], 64))), 128))
910
918
  ]),
911
- O("button", {
919
+ z("button", {
912
920
  type: "submit",
913
- disabled: o(s).isSubmitting || F.value,
921
+ disabled: o(n).isSubmitting || S.value,
914
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"
915
- }, I(o(s).isSubmitting ? "Submitting..." : F.value ? "Validating..." : e.schema.submitButtonText || "Submit"), 9, nt)
923
+ }, R(o(n).isSubmitting ? "Submitting..." : S.value ? "Validating..." : e.schema.submitButtonText || "Submit"), 9, nt)
916
924
  ], 34));
917
925
  }
918
926
  });
919
927
  export {
920
- ct as DynamicForm,
921
- _e as FormFieldRenderer,
922
- K as defaultComponentMap,
923
- et as useForm
928
+ mt as DynamicForm,
929
+ et as FormFieldRenderer,
930
+ H as defaultComponentMap,
931
+ tt as useForm
924
932
  };