@middag-io/react 0.43.0 → 0.44.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.
@@ -12,47 +12,48 @@ import { Select as y, SelectContent as b, SelectItem as x, SelectTrigger as S, S
12
12
  import { Skeleton as w } from "../../../primitives/reui/skeleton.js";
13
13
  import { Label as T } from "../../../primitives/reui/label.js";
14
14
  import { Switch as E } from "../../../primitives/reui/switch.js";
15
- import { InputOTP as D, InputOTPGroup as O, InputOTPSeparator as ee, InputOTPSlot as k } from "../../../primitives/reui/input-otp.js";
16
- import { NativeSelect as A, NativeSelectOption as j } from "../../../primitives/reui/native-select.js";
17
- import { NumberField as te, NumberFieldDecrement as M, NumberFieldGroup as ne, NumberFieldIncrement as N, NumberFieldInput as P } from "../../../primitives/reui/number-field.js";
18
- import { RadioGroup as F, RadioGroupItem as re } from "../../../primitives/reui/radio-group.js";
19
- import { Rating as I } from "../../../primitives/reui/rating.js";
20
- import { Slider as L } from "../../../primitives/reui/slider.js";
15
+ import { InputOTP as D, InputOTPGroup as O, InputOTPSeparator as k, InputOTPSlot as A } from "../../../primitives/reui/input-otp.js";
16
+ import { NativeSelect as j, NativeSelectOption as M } from "../../../primitives/reui/native-select.js";
17
+ import { NumberField as ee, NumberFieldDecrement as N, NumberFieldGroup as P, NumberFieldIncrement as F, NumberFieldInput as I } from "../../../primitives/reui/number-field.js";
18
+ import { RadioGroup as L, RadioGroupItem as te } from "../../../primitives/reui/radio-group.js";
19
+ import { Rating as ne } from "../../../primitives/reui/rating.js";
20
+ import { Slider as re } from "../../../primitives/reui/slider.js";
21
21
  import { useTranslation as R } from "../../../i18n/useTranslation.js";
22
- import { useEditablePanel as ie } from "./EditablePanelContext.js";
23
- import { beginPending as ae, trackedFetch as oe } from "../../../lib/host-pending.js";
22
+ import { fieldTestId as ie } from "../../../lib/test-ids.js";
23
+ import { useEditablePanel as ae } from "./EditablePanelContext.js";
24
+ import { beginPending as oe, trackedFetch as se } from "../../../lib/host-pending.js";
24
25
  import { evaluateCondition as z } from "../../utils/conditions.js";
25
- import { formatBytes as se, useFileUpload as ce } from "../../../lib/hooks/use-file-upload.js";
26
- import { Fragment as le, Suspense as B, lazy as V, useCallback as H, useEffect as U, useId as ue, useMemo as W, useRef as G, useState as K } from "react";
27
- import { Fragment as de, jsx as q, jsxs as J } from "react/jsx-runtime";
28
- import { HugeiconsIcon as Y } from "@hugeicons/react";
29
- import { Cancel01Icon as fe, FileEmpty02Icon as pe, Upload01Icon as me, ViewIcon as he, ViewOffIcon as ge } from "@hugeicons/core-free-icons";
30
- import { REGEXP_ONLY_DIGITS as _e, REGEXP_ONLY_DIGITS_AND_CHARS as ve } from "input-otp";
31
- import { z as X } from "zod";
26
+ import { formatBytes as B, useFileUpload as ce } from "../../../lib/hooks/use-file-upload.js";
27
+ import { Fragment as le, Suspense as V, lazy as H, useCallback as U, useEffect as ue, useId as de, useMemo as W, useRef as fe, useState as G } from "react";
28
+ import { Fragment as pe, jsx as K, jsxs as q } from "react/jsx-runtime";
29
+ import { HugeiconsIcon as J } from "@hugeicons/react";
30
+ import { Cancel01Icon as me, FileEmpty02Icon as he, Upload01Icon as ge, ViewIcon as _e, ViewOffIcon as ve } from "@hugeicons/core-free-icons";
31
+ import { REGEXP_ONLY_DIGITS as ye, REGEXP_ONLY_DIGITS_AND_CHARS as be } from "input-otp";
32
+ import { z as Y } from "zod";
32
33
  //#region src/base/form/form-utils.ts
33
- function ye(e) {
34
+ function xe(e) {
34
35
  let t = [];
35
- for (let n of e) n.kind === "field" ? t.push(n) : (n.kind === "section" || n.kind === "group") && t.push(...ye(n.children));
36
+ for (let n of e) n.kind === "field" ? t.push(n) : (n.kind === "section" || n.kind === "group") && t.push(...xe(n.children));
36
37
  return t;
37
38
  }
38
- function be(e, t) {
39
+ function Se(e, t) {
39
40
  if (e.component === "header") return !0;
40
41
  let { props: n } = e;
41
42
  return !(n.hidden_when && z(n.hidden_when, t) || n.visible_when && !z(n.visible_when, t));
42
43
  }
43
- function xe(e, t) {
44
+ function Ce(e, t) {
44
45
  if (e.component === "header") return !1;
45
46
  let { props: n } = e;
46
47
  return !!(n.disabled || n.disabled_when && z(n.disabled_when, t));
47
48
  }
48
- function Se(e, t) {
49
- if (e.component === "header" || xe(e, t)) return !1;
49
+ function we(e, t) {
50
+ if (e.component === "header" || Ce(e, t)) return !1;
50
51
  let { props: n } = e;
51
52
  return !!(n.required || n.required_when && z(n.required_when, t));
52
53
  }
53
54
  //#endregion
54
55
  //#region src/base/form/form-schema-builder.ts
55
- function Ce(e, t, n) {
56
+ function Te(e, t, n) {
56
57
  let { component: r, props: i } = e, a = i.validation, o = n;
57
58
  switch (r) {
58
59
  case "text":
@@ -60,77 +61,77 @@ function Ce(e, t, n) {
60
61
  case "password":
61
62
  case "slug":
62
63
  case "color": {
63
- let e = X.string();
64
- return o && (e = e.min(1, t("middag.ui.validation.required"))), a?.minLength && (e = e.min(a.minLength, t("middag.ui.validation.min_length", { min: a.minLength }))), a?.maxLength && (e = e.max(a.maxLength, t("middag.ui.validation.max_length", { max: a.maxLength }))), a?.pattern && (e = e.regex(new RegExp(a.pattern), a.patternMessage ?? t("middag.ui.validation.pattern"))), o ? e : e.or(X.literal(""));
64
+ let e = Y.string();
65
+ return o && (e = e.min(1, t("middag.ui.validation.required"))), a?.minLength && (e = e.min(a.minLength, t("middag.ui.validation.min_length", { min: a.minLength }))), a?.maxLength && (e = e.max(a.maxLength, t("middag.ui.validation.max_length", { max: a.maxLength }))), a?.pattern && (e = e.regex(new RegExp(a.pattern), a.patternMessage ?? t("middag.ui.validation.pattern"))), o ? e : e.or(Y.literal(""));
65
66
  }
66
67
  case "email": {
67
- let e = X.string();
68
+ let e = Y.string();
68
69
  if (o) e = e.min(1, t("middag.ui.validation.required")).email(t("middag.ui.validation.email"));
69
- else return e.email(t("middag.ui.validation.email")).or(X.literal(""));
70
+ else return e.email(t("middag.ui.validation.email")).or(Y.literal(""));
70
71
  return e;
71
72
  }
72
73
  case "url": {
73
- let e = X.string();
74
+ let e = Y.string();
74
75
  if (o) e = e.min(1, t("middag.ui.validation.required")).url(t("middag.ui.validation.url"));
75
- else return e.url(t("middag.ui.validation.url")).or(X.literal(""));
76
+ else return e.url(t("middag.ui.validation.url")).or(Y.literal(""));
76
77
  return e;
77
78
  }
78
79
  case "int": {
79
- let e = X.number({ message: t("middag.ui.validation.integer") }).int(t("middag.ui.validation.integer"));
80
+ let e = Y.number({ message: t("middag.ui.validation.integer") }).int(t("middag.ui.validation.integer"));
80
81
  return i.min != null && (e = e.min(i.min, t("middag.ui.validation.min_value", { min: i.min }))), i.max != null && (e = e.max(i.max, t("middag.ui.validation.max_value", { max: i.max }))), o ? e : e.nullable();
81
82
  }
82
83
  case "float": {
83
- let e = X.number();
84
+ let e = Y.number();
84
85
  return i.min != null && (e = e.min(i.min, t("middag.ui.validation.min_value", { min: i.min }))), i.max != null && (e = e.max(i.max, t("middag.ui.validation.max_value", { max: i.max }))), o ? e : e.nullable();
85
86
  }
86
87
  case "currency": {
87
- let e = X.number();
88
+ let e = Y.number();
88
89
  return o ? e : e.nullable();
89
90
  }
90
91
  case "select":
91
92
  case "radio":
92
93
  case "entity_picker": {
93
- let e = X.string();
94
+ let e = Y.string();
94
95
  return o ? e.min(1, t("middag.ui.validation.required")) : e;
95
96
  }
96
97
  case "multiselect":
97
98
  case "tags": {
98
- let e = X.array(X.string());
99
+ let e = Y.array(Y.string());
99
100
  return o ? e.min(1, t("middag.ui.validation.required")) : e;
100
101
  }
101
102
  case "checkbox":
102
- case "switch": return X.boolean();
103
+ case "switch": return Y.boolean();
103
104
  case "date":
104
105
  case "datetime": {
105
- let e = X.string();
106
+ let e = Y.string();
106
107
  return o ? e.min(1, t("middag.ui.validation.required")) : e;
107
108
  }
108
109
  case "phone": {
109
- let e = X.string();
110
+ let e = Y.string();
110
111
  return o ? e.min(1, t("middag.ui.validation.required")) : e;
111
112
  }
112
113
  case "document": {
113
- let e = i.documentType ?? "generic", n = i.documentScope ?? "any", r = X.string(), a = async (t) => {
114
+ let e = i.documentType ?? "generic", n = i.documentScope ?? "any", r = Y.string(), a = async (t) => {
114
115
  let { isValidDocument: r } = await import("../../../chunks/subpath-YbXSVoyF.js");
115
116
  return r(t, e, n);
116
117
  };
117
118
  return o ? r.min(1, t("middag.ui.validation.required")).refine(a, t("middag.ui.validation.document_invalid")) : r.refine(async (e) => e === "" || await a(e), t("middag.ui.validation.document_invalid"));
118
119
  }
119
- default: return X.any();
120
+ default: return Y.any();
120
121
  }
121
122
  }
122
- function we(e, t, n) {
123
- let r = ye(e), i = {};
124
- for (let e of r) e.component === "header" || e.component === "hidden" || e.component === "static" || be(e, t) && (i[e.key] = Ce(e, n, Se(e, t)));
125
- return X.object(i);
123
+ function Ee(e, t, n) {
124
+ let r = xe(e), i = {};
125
+ for (let e of r) e.component === "header" || e.component === "hidden" || e.component === "static" || Se(e, t) && (i[e.key] = Te(e, n, we(e, t)));
126
+ return Y.object(i);
126
127
  }
127
128
  //#endregion
128
129
  //#region src/base/form/fields/CheckboxField.tsx
129
- function Te({ id: e, value: t, onChange: n, label: r, disabled: i, required: a, error: s, helpTextId: c, errorId: l }) {
130
+ function De({ id: e, value: t, onChange: n, label: r, disabled: i, required: a, error: s, helpTextId: c, errorId: l }) {
130
131
  let u = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
131
- return /* @__PURE__ */ J("div", {
132
+ return /* @__PURE__ */ q("div", {
132
133
  className: "flex items-center gap-2",
133
- children: [/* @__PURE__ */ q(o, {
134
+ children: [/* @__PURE__ */ K(o, {
134
135
  id: e,
135
136
  checked: !!t,
136
137
  onCheckedChange: (e) => n(e === !0),
@@ -138,7 +139,7 @@ function Te({ id: e, value: t, onChange: n, label: r, disabled: i, required: a,
138
139
  "aria-invalid": s ? !0 : void 0,
139
140
  "aria-required": a || void 0,
140
141
  "aria-describedby": u
141
- }), r && /* @__PURE__ */ q(T, {
142
+ }), r && /* @__PURE__ */ K(T, {
142
143
  htmlFor: e,
143
144
  className: "text-sm font-normal",
144
145
  children: r
@@ -147,22 +148,22 @@ function Te({ id: e, value: t, onChange: n, label: r, disabled: i, required: a,
147
148
  }
148
149
  //#endregion
149
150
  //#region src/base/form/fields/ColorField.tsx
150
- function Ee({ id: e, value: t, onChange: n, placeholder: r, disabled: i, required: a, error: o, helpTextId: c, errorId: l }) {
151
- let u = [o ? l : void 0, c].filter(Boolean).join(" ") || void 0, d = H((e) => {
151
+ function Oe({ id: e, value: t, onChange: n, placeholder: r, disabled: i, required: a, error: o, helpTextId: c, errorId: l }) {
152
+ let u = [o ? l : void 0, c].filter(Boolean).join(" ") || void 0, d = U((e) => {
152
153
  n(e.target.value);
153
- }, [n]), f = H((e) => {
154
+ }, [n]), f = U((e) => {
154
155
  n(e.target.value);
155
156
  }, [n]);
156
- return /* @__PURE__ */ J("div", {
157
+ return /* @__PURE__ */ q("div", {
157
158
  className: "flex items-center gap-2",
158
- children: [/* @__PURE__ */ q("input", {
159
+ children: [/* @__PURE__ */ K("input", {
159
160
  type: "color",
160
161
  value: t || "#000000",
161
162
  onChange: f,
162
163
  disabled: i,
163
164
  className: "border-input h-9 w-9 shrink-0 cursor-pointer rounded-md border p-0.5",
164
165
  "aria-label": "Color picker"
165
- }), /* @__PURE__ */ q(s, {
166
+ }), /* @__PURE__ */ K(s, {
166
167
  id: e,
167
168
  type: "text",
168
169
  value: t ?? "",
@@ -179,7 +180,7 @@ function Ee({ id: e, value: t, onChange: n, placeholder: r, disabled: i, require
179
180
  }
180
181
  //#endregion
181
182
  //#region src/base/form/fields/CurrencyField.tsx
182
- var De = {
183
+ var ke = {
183
184
  BRL: "R$",
184
185
  USD: "$",
185
186
  EUR: "€",
@@ -194,10 +195,10 @@ var De = {
194
195
  COP: "$",
195
196
  PEN: "S/"
196
197
  };
197
- function Oe({ id: e, value: t, onChange: n, currency: r = "BRL", placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: p, min: m, max: h }) {
198
- let { t: g, formatCurrency: _ } = R(), [v, y] = K(!1), [b, x] = K(""), S = [s ? p : void 0, c].filter(Boolean).join(" ") || void 0, C = v ? b : t == null ? "" : _(t, r), w = De[r] ?? r, T = H(() => {
198
+ function Ae({ id: e, value: t, onChange: n, currency: r = "BRL", placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: p, min: m, max: h }) {
199
+ let { t: g, formatCurrency: _ } = R(), [v, y] = G(!1), [b, x] = G(""), S = [s ? p : void 0, c].filter(Boolean).join(" ") || void 0, C = v ? b : t == null ? "" : _(t, r), w = ke[r] ?? r, T = U(() => {
199
200
  y(!0), x(t == null ? "" : String(t));
200
- }, [t]), E = H(() => {
201
+ }, [t]), E = U(() => {
201
202
  y(!1);
202
203
  let e = parseFloat(b.replace(/,/g, "."));
203
204
  n(Number.isNaN(e) ? null : Math.round((m !== void 0 && e < m ? m : h !== void 0 && e > h ? h : e) * 100) / 100);
@@ -206,15 +207,15 @@ function Oe({ id: e, value: t, onChange: n, currency: r = "BRL", placeholder: i,
206
207
  n,
207
208
  m,
208
209
  h
209
- ]), D = H((e) => {
210
+ ]), D = U((e) => {
210
211
  x(e.target.value);
211
212
  }, []);
212
- return /* @__PURE__ */ J(l, {
213
+ return /* @__PURE__ */ q(l, {
213
214
  "data-disabled": a || void 0,
214
- children: [/* @__PURE__ */ q(u, {
215
+ children: [/* @__PURE__ */ K(u, {
215
216
  align: "inline-start",
216
- children: /* @__PURE__ */ q(f, { children: w })
217
- }), /* @__PURE__ */ q(d, {
217
+ children: /* @__PURE__ */ K(f, { children: w })
218
+ }), /* @__PURE__ */ K(d, {
218
219
  id: e,
219
220
  inputMode: "decimal",
220
221
  value: v ? b : t == null ? "" : C.replace(w, "").trim(),
@@ -231,23 +232,23 @@ function Oe({ id: e, value: t, onChange: n, currency: r = "BRL", placeholder: i,
231
232
  }
232
233
  //#endregion
233
234
  //#region src/base/form/fields/EntityPickerField.tsx
234
- function ke(e) {
235
+ function je(e) {
235
236
  return e.split(/\s+/).slice(0, 2).map((e) => e[0]?.toUpperCase() ?? "").join("");
236
237
  }
237
- function Ae({ id: e, value: t, onChange: a, options: o, initialOption: s, autocompleteHref: c, autocompleteMinChars: l = 2, entityAvatarField: u, entitySubtitleField: d, placeholder: f, disabled: y, required: b, error: x, helpTextId: S, errorId: C }) {
238
- let { t: w } = R(), [T, E] = K(s && t && s.value === t ? s.label : ""), [D, O] = K([]), [ee, k] = K(!1), A = G(void 0), j = !!c, te = [x ? C : void 0, S].filter(Boolean).join(" ") || void 0, M = W(() => [], []), ne = W(() => o ?? M, [o, M]);
239
- U(() => {
240
- if (!j) return;
241
- if (A.current && clearTimeout(A.current), T.length < l) return A.current = setTimeout(() => O([]), 0), () => {
242
- A.current && clearTimeout(A.current);
238
+ function Me({ id: e, value: t, onChange: a, options: o, initialOption: s, autocompleteHref: c, autocompleteMinChars: l = 2, entityAvatarField: u, entitySubtitleField: d, placeholder: f, disabled: y, required: b, error: x, helpTextId: S, errorId: C }) {
239
+ let { t: w } = R(), [T, E] = G(s && t && s.value === t ? s.label : ""), [D, O] = G([]), [k, A] = G(!1), j = fe(void 0), M = !!c, ee = [x ? C : void 0, S].filter(Boolean).join(" ") || void 0, N = W(() => [], []), P = W(() => o ?? N, [o, N]);
240
+ ue(() => {
241
+ if (!M) return;
242
+ if (j.current && clearTimeout(j.current), T.length < l) return j.current = setTimeout(() => O([]), 0), () => {
243
+ j.current && clearTimeout(j.current);
243
244
  };
244
- let e = ae();
245
- return A.current = setTimeout(async () => {
246
- k(!0);
245
+ let e = oe();
246
+ return j.current = setTimeout(async () => {
247
+ A(!0);
247
248
  try {
248
249
  let e = new URL(c, window.location.origin);
249
250
  e.searchParams.set("q", T);
250
- let t = await oe(e.toString());
251
+ let t = await se(e.toString());
251
252
  if (t.ok) {
252
253
  let e = await t.json(), n = (e.items ?? e.data ?? e).map((e) => ({
253
254
  value: String(e.value ?? e.id),
@@ -258,70 +259,70 @@ function Ae({ id: e, value: t, onChange: a, options: o, initialOption: s, autoco
258
259
  O(n);
259
260
  }
260
261
  } catch {} finally {
261
- k(!1), e();
262
+ A(!1), e();
262
263
  }
263
264
  }, 300), () => {
264
- A.current && clearTimeout(A.current), e();
265
+ j.current && clearTimeout(j.current), e();
265
266
  };
266
267
  }, [
267
268
  T,
268
- j,
269
+ M,
269
270
  c,
270
271
  l,
271
272
  d,
272
273
  u
273
274
  ]);
274
- let N = j ? D : ne, P = W(() => s && t && s.value === t && !N.some((e) => e.value === t) ? [s, ...N] : N, [
275
- N,
275
+ let F = M ? D : P, I = W(() => s && t && s.value === t && !F.some((e) => e.value === t) ? [s, ...F] : F, [
276
+ F,
276
277
  s,
277
278
  t
278
- ]), F = W(() => {
279
- if (j || !T) return P;
279
+ ]), L = W(() => {
280
+ if (M || !T) return I;
280
281
  let e = T.toLowerCase();
281
- return P.filter((t) => t.label.toLowerCase().includes(e) || t.subtitle?.toLowerCase().includes(e));
282
+ return I.filter((t) => t.label.toLowerCase().includes(e) || t.subtitle?.toLowerCase().includes(e));
282
283
  }, [
283
- P,
284
+ I,
284
285
  T,
285
- j
286
- ]), re = H((e) => {
286
+ M
287
+ ]), te = U((e) => {
287
288
  a(e ?? "");
288
- }, [a]), I = ee ? w("middag.ui.form.entity_loading") : T.length < l && j ? w("middag.ui.form.entity_min_chars").replace("{min}", String(l)) : w("middag.ui.form.entity_no_results"), L = !!u || P.some((e) => e.avatarUrl);
289
- return /* @__PURE__ */ J(p, {
290
- items: F,
289
+ }, [a]), ne = k ? w("middag.ui.form.entity_loading") : T.length < l && M ? w("middag.ui.form.entity_min_chars").replace("{min}", String(l)) : w("middag.ui.form.entity_no_results"), re = !!u || I.some((e) => e.avatarUrl);
290
+ return /* @__PURE__ */ q(p, {
291
+ items: L,
291
292
  value: t || null,
292
- onValueChange: re,
293
- children: [/* @__PURE__ */ q(g, {
293
+ onValueChange: te,
294
+ children: [/* @__PURE__ */ K(g, {
294
295
  id: e,
295
296
  placeholder: f ?? w("middag.ui.form.entity_search"),
296
297
  disabled: y,
297
298
  "aria-invalid": x ? !0 : void 0,
298
299
  "aria-required": b || void 0,
299
- "aria-describedby": te,
300
+ "aria-describedby": ee,
300
301
  showClear: !!t,
301
302
  showTrigger: !0,
302
303
  value: T,
303
304
  onChange: (e) => E(e.target.value)
304
- }), /* @__PURE__ */ J(m, { children: [/* @__PURE__ */ q(h, {
305
+ }), /* @__PURE__ */ q(m, { children: [/* @__PURE__ */ K(h, {
305
306
  className: "px-4 py-3 text-sm",
306
- children: I
307
- }), /* @__PURE__ */ q(v, { children: F.map((e) => /* @__PURE__ */ J(_, {
307
+ children: ne
308
+ }), /* @__PURE__ */ K(v, { children: L.map((e) => /* @__PURE__ */ q(_, {
308
309
  value: e.value,
309
310
  className: "flex items-center gap-2.5 px-3 py-2",
310
- children: [L && /* @__PURE__ */ J(n, {
311
+ children: [re && /* @__PURE__ */ q(n, {
311
312
  className: "h-7 w-7 shrink-0",
312
- children: [e.avatarUrl && /* @__PURE__ */ q(i, {
313
+ children: [e.avatarUrl && /* @__PURE__ */ K(i, {
313
314
  src: e.avatarUrl,
314
315
  alt: e.label
315
- }), /* @__PURE__ */ q(r, {
316
+ }), /* @__PURE__ */ K(r, {
316
317
  className: "text-[10px]",
317
- children: ke(e.label)
318
+ children: je(e.label)
318
319
  })]
319
- }), /* @__PURE__ */ J("div", {
320
+ }), /* @__PURE__ */ q("div", {
320
321
  className: "min-w-0 flex-1",
321
- children: [/* @__PURE__ */ q("div", {
322
+ children: [/* @__PURE__ */ K("div", {
322
323
  className: "truncate text-sm",
323
324
  children: e.label
324
- }), e.subtitle && /* @__PURE__ */ q("div", {
325
+ }), e.subtitle && /* @__PURE__ */ K("div", {
325
326
  className: "text-muted-foreground truncate text-xs",
326
327
  children: e.subtitle
327
328
  })]
@@ -331,21 +332,21 @@ function Ae({ id: e, value: t, onChange: a, options: o, initialOption: s, autoco
331
332
  }
332
333
  //#endregion
333
334
  //#region src/base/form/fields/FileUploadField.tsx
334
- function je(e) {
335
+ function Ne(e) {
335
336
  let t = e.split(/[?#]/)[0], n = t.split("/");
336
337
  return n[n.length - 1] || t;
337
338
  }
338
- function Me(e) {
339
+ function Pe(e) {
339
340
  if (e == null || e === "") return null;
340
341
  if (typeof e == "string") return {
341
- name: je(e),
342
+ name: Ne(e),
342
343
  size: 0,
343
344
  type: "",
344
345
  url: e,
345
346
  id: e
346
347
  };
347
348
  if (typeof e == "object" && !(e instanceof File)) {
348
- let t = e, n = typeof t.url == "string" ? t.url : "", r = typeof t.name == "string" ? t.name : n ? je(n) : "";
349
+ let t = e, n = typeof t.url == "string" ? t.url : "", r = typeof t.name == "string" ? t.name : n ? Ne(n) : "";
349
350
  return !n && !r ? null : {
350
351
  name: r,
351
352
  size: typeof t.size == "number" ? t.size : 0,
@@ -356,11 +357,11 @@ function Me(e) {
356
357
  }
357
358
  return null;
358
359
  }
359
- function Ne(e) {
360
- return (Array.isArray(e) ? e : [e]).map(Me).filter((e) => e !== null);
360
+ function Fe(e) {
361
+ return (Array.isArray(e) ? e : [e]).map(Pe).filter((e) => e !== null);
361
362
  }
362
- function Pe({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, maxFiles: s = 10, maxSize: c = 10 * 1024 * 1024, disabled: l, required: u, error: d, helpTextId: f, errorId: p }) {
363
- let { t: m } = R(), [h] = K(() => Ne(r)), [{ files: g, isDragging: _, errors: v }, { removeFile: y, handleDragEnter: b, handleDragLeave: x, handleDragOver: S, handleDrop: C, openFileDialog: w, getInputProps: T }] = ce({
363
+ function Ie({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, maxFiles: s = 10, maxSize: c = 10 * 1024 * 1024, disabled: l, required: u, error: d, helpTextId: f, errorId: p }) {
364
+ let { t: m } = R(), [h] = G(() => Fe(r)), [{ files: g, isDragging: _, errors: v }, { removeFile: y, handleDragEnter: b, handleDragLeave: x, handleDragOver: S, handleDrop: C, openFileDialog: w, getInputProps: T }] = ce({
364
365
  maxFiles: o ? s : 1,
365
366
  maxSize: c,
366
367
  accept: a,
@@ -371,13 +372,13 @@ function Pe({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
371
372
  i(o ? t : t[0] ?? null);
372
373
  }
373
374
  }), E = [d ? p : void 0, f].filter(Boolean).join(" ") || void 0, D = (e) => e.type.startsWith("image/");
374
- return /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ J("div", {
375
+ return /* @__PURE__ */ q("div", { children: [/* @__PURE__ */ q("div", {
375
376
  className: e("rounded-lg border border-dashed p-4 transition-colors", _ ? "border-primary bg-primary/5" : "border-muted-foreground/25 hover:border-muted-foreground/50", l && "pointer-events-none opacity-50"),
376
377
  onDragEnter: b,
377
378
  onDragLeave: x,
378
379
  onDragOver: S,
379
380
  onDrop: C,
380
- children: [/* @__PURE__ */ q("input", {
381
+ children: [/* @__PURE__ */ K("input", {
381
382
  ...T(),
382
383
  id: n,
383
384
  className: "sr-only",
@@ -385,18 +386,18 @@ function Pe({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
385
386
  "aria-invalid": d ? !0 : void 0,
386
387
  "aria-required": u || void 0,
387
388
  "aria-describedby": E
388
- }), g.length === 0 ? /* @__PURE__ */ J("div", {
389
+ }), g.length === 0 ? /* @__PURE__ */ q("div", {
389
390
  className: "flex flex-col items-center gap-2 py-4",
390
391
  children: [
391
- /* @__PURE__ */ q(Y, {
392
- icon: me,
392
+ /* @__PURE__ */ K(J, {
393
+ icon: ge,
393
394
  className: e("size-8", _ ? "text-primary" : "text-muted-foreground")
394
395
  }),
395
- /* @__PURE__ */ q("p", {
396
+ /* @__PURE__ */ K("p", {
396
397
  className: "text-muted-foreground text-sm",
397
398
  children: m("middag.ui.form.file_drop_hint")
398
399
  }),
399
- /* @__PURE__ */ q(t, {
400
+ /* @__PURE__ */ K(t, {
400
401
  type: "button",
401
402
  variant: "outline",
402
403
  size: "sm",
@@ -404,54 +405,54 @@ function Pe({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
404
405
  disabled: l,
405
406
  children: m("middag.ui.form.file_browse")
406
407
  }),
407
- /* @__PURE__ */ J("p", {
408
+ /* @__PURE__ */ q("p", {
408
409
  className: "text-muted-foreground text-xs",
409
410
  children: [
410
411
  m("middag.ui.form.file_max_size"),
411
412
  " ",
412
- se(c)
413
+ B(c)
413
414
  ]
414
415
  })
415
416
  ]
416
- }) : /* @__PURE__ */ J("div", {
417
+ }) : /* @__PURE__ */ q("div", {
417
418
  className: "space-y-2",
418
- children: [g.map((e) => /* @__PURE__ */ J("div", {
419
+ children: [g.map((e) => /* @__PURE__ */ q("div", {
419
420
  className: "bg-muted/50 flex items-center gap-3 rounded-md px-3 py-2",
420
421
  children: [
421
- D(e.file) && e.preview ? /* @__PURE__ */ q("img", {
422
+ D(e.file) && e.preview ? /* @__PURE__ */ K("img", {
422
423
  src: e.preview,
423
424
  alt: e.file.name,
424
425
  className: "size-10 shrink-0 rounded border object-cover"
425
- }) : /* @__PURE__ */ q("div", {
426
+ }) : /* @__PURE__ */ K("div", {
426
427
  className: "bg-muted flex size-10 shrink-0 items-center justify-center rounded border",
427
- children: /* @__PURE__ */ q(Y, {
428
- icon: pe,
428
+ children: /* @__PURE__ */ K(J, {
429
+ icon: he,
429
430
  className: "text-muted-foreground size-5"
430
431
  })
431
432
  }),
432
- /* @__PURE__ */ J("div", {
433
+ /* @__PURE__ */ q("div", {
433
434
  className: "min-w-0 flex-1",
434
- children: [/* @__PURE__ */ q("p", {
435
+ children: [/* @__PURE__ */ K("p", {
435
436
  className: "truncate text-sm font-medium",
436
437
  children: e.file.name
437
- }), /* @__PURE__ */ q("p", {
438
+ }), /* @__PURE__ */ K("p", {
438
439
  className: "text-muted-foreground text-xs",
439
- children: se(e.file.size)
440
+ children: B(e.file.size)
440
441
  })]
441
442
  }),
442
- /* @__PURE__ */ q(t, {
443
+ /* @__PURE__ */ K(t, {
443
444
  type: "button",
444
445
  variant: "ghost",
445
446
  size: "icon-xs",
446
447
  onClick: () => y(e.id),
447
448
  disabled: l,
448
- children: /* @__PURE__ */ q(Y, {
449
- icon: fe,
449
+ children: /* @__PURE__ */ K(J, {
450
+ icon: me,
450
451
  className: "size-3.5"
451
452
  })
452
453
  })
453
454
  ]
454
- }, e.id)), o && g.length < s && /* @__PURE__ */ q(t, {
455
+ }, e.id)), o && g.length < s && /* @__PURE__ */ K(t, {
455
456
  type: "button",
456
457
  variant: "outline",
457
458
  size: "sm",
@@ -460,9 +461,9 @@ function Pe({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
460
461
  children: m("middag.ui.form.file_add_more")
461
462
  })]
462
463
  })]
463
- }), v.length > 0 && /* @__PURE__ */ q("div", {
464
+ }), v.length > 0 && /* @__PURE__ */ K("div", {
464
465
  className: "mt-1.5 space-y-0.5",
465
- children: v.map((e, t) => /* @__PURE__ */ q("p", {
466
+ children: v.map((e, t) => /* @__PURE__ */ K("p", {
466
467
  className: "text-destructive text-xs",
467
468
  children: e
468
469
  }, t))
@@ -470,10 +471,10 @@ function Pe({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
470
471
  }
471
472
  //#endregion
472
473
  //#region src/base/form/fields/MultiSelectField.tsx
473
- var Fe = 8;
474
- function Ie({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: l, variant: u = "auto" }) {
474
+ var Le = 8;
475
+ function Re({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: l, variant: u = "auto" }) {
475
476
  let { t: d } = R(), f = t ?? [], p = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
476
- return u === "checkbox" || u === "auto" && r.length <= Fe ? /* @__PURE__ */ q(Le, {
477
+ return u === "checkbox" || u === "auto" && r.length <= Le ? /* @__PURE__ */ K(ze, {
477
478
  id: e,
478
479
  options: r,
479
480
  selected: f,
@@ -483,7 +484,7 @@ function Ie({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled
483
484
  error: s,
484
485
  describedBy: p,
485
486
  t: d
486
- }) : /* @__PURE__ */ q(Re, {
487
+ }) : /* @__PURE__ */ K(Be, {
487
488
  id: e,
488
489
  options: r,
489
490
  selected: f,
@@ -496,37 +497,37 @@ function Ie({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled
496
497
  t: d
497
498
  });
498
499
  }
499
- function Le({ id: e, options: t, selected: n, onChange: r, disabled: i, required: a, error: s, describedBy: c, t: l }) {
500
+ function ze({ id: e, options: t, selected: n, onChange: r, disabled: i, required: a, error: s, describedBy: c, t: l }) {
500
501
  let u = (e) => {
501
502
  n.includes(e) ? r(n.filter((t) => t !== e)) : r([...n, e]);
502
503
  };
503
- return /* @__PURE__ */ J("div", {
504
+ return /* @__PURE__ */ q("div", {
504
505
  id: e,
505
506
  role: "group",
506
507
  "aria-invalid": s ? !0 : void 0,
507
508
  "aria-required": a || void 0,
508
509
  "aria-describedby": c,
509
510
  className: "border-input max-h-48 space-y-2 overflow-y-auto rounded-md border p-3",
510
- children: [t.map((t) => /* @__PURE__ */ J("div", {
511
+ children: [t.map((t) => /* @__PURE__ */ q("div", {
511
512
  className: "flex items-center gap-2",
512
- children: [/* @__PURE__ */ q(o, {
513
+ children: [/* @__PURE__ */ K(o, {
513
514
  id: `${e}-${t.value}`,
514
515
  checked: n.includes(t.value),
515
516
  onCheckedChange: () => u(t.value),
516
517
  disabled: i
517
- }), /* @__PURE__ */ q(T, {
518
+ }), /* @__PURE__ */ K(T, {
518
519
  htmlFor: `${e}-${t.value}`,
519
520
  className: "text-sm font-normal",
520
521
  children: t.label
521
522
  })]
522
- }, t.value)), t.length === 0 && /* @__PURE__ */ q("p", {
523
+ }, t.value)), t.length === 0 && /* @__PURE__ */ K("p", {
523
524
  className: "text-muted-foreground text-sm",
524
525
  children: l("middag.ui.multiselect.no_options")
525
526
  })]
526
527
  });
527
528
  }
528
- function Re({ id: e, options: t, selected: n, onChange: r, placeholder: i, disabled: s, required: c, error: l, describedBy: u, t: d }) {
529
- let [f, y] = K(""), b = W(() => {
529
+ function Be({ id: e, options: t, selected: n, onChange: r, placeholder: i, disabled: s, required: c, error: l, describedBy: u, t: d }) {
530
+ let [f, y] = G(""), b = W(() => {
530
531
  if (!f) return t;
531
532
  let e = f.toLowerCase();
532
533
  return t.filter((t) => t.label.toLowerCase().includes(e));
@@ -536,39 +537,39 @@ function Re({ id: e, options: t, selected: n, onChange: r, placeholder: i, disab
536
537
  value: t,
537
538
  label: e.get(t) ?? t
538
539
  }));
539
- }, [n, t]), S = H((e) => {
540
+ }, [n, t]), S = U((e) => {
540
541
  r(n.filter((t) => t !== e));
541
- }, [n, r]), C = H((e) => {
542
+ }, [n, r]), C = U((e) => {
542
543
  e && (n.includes(e) ? r(n.filter((t) => t !== e)) : r([...n, e]));
543
544
  }, [n, r]);
544
- return /* @__PURE__ */ J("div", {
545
+ return /* @__PURE__ */ q("div", {
545
546
  id: e,
546
547
  "aria-invalid": l ? !0 : void 0,
547
548
  "aria-required": c || void 0,
548
549
  "aria-describedby": u,
549
550
  className: "space-y-2",
550
- children: [x.length > 0 && /* @__PURE__ */ q("div", {
551
+ children: [x.length > 0 && /* @__PURE__ */ K("div", {
551
552
  className: "flex flex-wrap gap-1.5",
552
- children: x.map((e) => /* @__PURE__ */ J(a, {
553
+ children: x.map((e) => /* @__PURE__ */ q(a, {
553
554
  variant: "secondary",
554
555
  className: "gap-1 pr-1",
555
- children: [e.label, /* @__PURE__ */ q("button", {
556
+ children: [e.label, /* @__PURE__ */ K("button", {
556
557
  type: "button",
557
558
  onClick: () => S(e.value),
558
559
  className: "text-muted-foreground hover:text-foreground ml-0.5 rounded-full",
559
560
  "aria-label": d("middag.ui.form.multiselect_remove", { label: e.label }),
560
- children: /* @__PURE__ */ J("svg", {
561
+ children: /* @__PURE__ */ q("svg", {
561
562
  viewBox: "0 0 24 24",
562
563
  fill: "none",
563
564
  stroke: "currentColor",
564
565
  strokeWidth: 2,
565
566
  className: "h-3 w-3",
566
- children: [/* @__PURE__ */ q("line", {
567
+ children: [/* @__PURE__ */ K("line", {
567
568
  x1: "18",
568
569
  y1: "6",
569
570
  x2: "6",
570
571
  y2: "18"
571
- }), /* @__PURE__ */ q("line", {
572
+ }), /* @__PURE__ */ K("line", {
572
573
  x1: "6",
573
574
  y1: "6",
574
575
  x2: "18",
@@ -577,28 +578,28 @@ function Re({ id: e, options: t, selected: n, onChange: r, placeholder: i, disab
577
578
  })
578
579
  })]
579
580
  }, e.value))
580
- }), /* @__PURE__ */ J(p, {
581
+ }), /* @__PURE__ */ q(p, {
581
582
  items: b,
582
583
  value: null,
583
584
  onValueChange: C,
584
585
  filter: null,
585
- children: [/* @__PURE__ */ q(g, {
586
+ children: [/* @__PURE__ */ K(g, {
586
587
  placeholder: i ?? d("middag.ui.form.multiselect_search"),
587
588
  disabled: s,
588
589
  showTrigger: !0,
589
590
  value: f,
590
591
  onChange: (e) => y(e.target.value)
591
- }), /* @__PURE__ */ J(m, { children: [/* @__PURE__ */ q(h, {
592
+ }), /* @__PURE__ */ q(m, { children: [/* @__PURE__ */ K(h, {
592
593
  className: "px-4 py-3 text-sm",
593
594
  children: d("middag.ui.form.entity_no_results")
594
- }), /* @__PURE__ */ q(v, { children: b.map((e) => /* @__PURE__ */ J(_, {
595
+ }), /* @__PURE__ */ K(v, { children: b.map((e) => /* @__PURE__ */ q(_, {
595
596
  value: e.value,
596
597
  className: "flex items-center gap-2",
597
- children: [/* @__PURE__ */ q(o, {
598
+ children: [/* @__PURE__ */ K(o, {
598
599
  checked: n.includes(e.value),
599
600
  tabIndex: -1,
600
601
  className: "pointer-events-none"
601
- }), /* @__PURE__ */ q("span", {
602
+ }), /* @__PURE__ */ K("span", {
602
603
  className: "text-sm",
603
604
  children: e.label
604
605
  })]
@@ -608,11 +609,11 @@ function Re({ id: e, options: t, selected: n, onChange: r, placeholder: i, disab
608
609
  }
609
610
  //#endregion
610
611
  //#region src/base/form/fields/NativeSelectField.tsx
611
- function ze({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: l }) {
612
+ function Ve({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: l }) {
612
613
  let { t: u } = R(), d = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
613
- return /* @__PURE__ */ q("div", {
614
+ return /* @__PURE__ */ K("div", {
614
615
  className: "w-full [&>div]:w-full",
615
- children: /* @__PURE__ */ J(A, {
616
+ children: /* @__PURE__ */ q(j, {
616
617
  id: e,
617
618
  value: t ?? "",
618
619
  onChange: (e) => n(e.target.value),
@@ -621,11 +622,11 @@ function ze({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled
621
622
  "aria-required": o || void 0,
622
623
  "aria-invalid": s ? !0 : void 0,
623
624
  "aria-describedby": d,
624
- children: [/* @__PURE__ */ q(j, {
625
+ children: [/* @__PURE__ */ K(M, {
625
626
  value: "",
626
627
  disabled: o,
627
628
  children: i ?? u("middag.ui.form.select_placeholder")
628
- }), r.map((e) => /* @__PURE__ */ q(j, {
629
+ }), r.map((e) => /* @__PURE__ */ K(M, {
629
630
  value: e.value,
630
631
  children: e.label
631
632
  }, e.value))]
@@ -634,9 +635,9 @@ function ze({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled
634
635
  }
635
636
  //#endregion
636
637
  //#region src/base/form/fields/NumberField.tsx
637
- function Be({ id: e, value: t, onChange: n, min: r, max: i, step: a = 1, disabled: o, required: s, error: c, helpTextId: l, errorId: u }) {
638
+ function X({ id: e, value: t, onChange: n, min: r, max: i, step: a = 1, disabled: o, required: s, error: c, helpTextId: l, errorId: u }) {
638
639
  let d = [c ? u : void 0, l].filter(Boolean).join(" ") || void 0;
639
- return /* @__PURE__ */ q(te, {
640
+ return /* @__PURE__ */ K(ee, {
640
641
  id: e,
641
642
  value: t ?? void 0,
642
643
  onValueChange: (e) => n(e ?? null),
@@ -647,24 +648,24 @@ function Be({ id: e, value: t, onChange: n, min: r, max: i, step: a = 1, disable
647
648
  "aria-invalid": c ? !0 : void 0,
648
649
  "aria-required": s || void 0,
649
650
  "aria-describedby": d,
650
- children: /* @__PURE__ */ J(ne, { children: [
651
- /* @__PURE__ */ q(M, {}),
652
- /* @__PURE__ */ q(P, {}),
653
- /* @__PURE__ */ q(N, {})
651
+ children: /* @__PURE__ */ q(P, { children: [
652
+ /* @__PURE__ */ K(N, {}),
653
+ /* @__PURE__ */ K(I, {}),
654
+ /* @__PURE__ */ K(F, {})
654
655
  ] })
655
656
  });
656
657
  }
657
658
  //#endregion
658
659
  //#region src/base/form/fields/OtpField.tsx
659
- function Ve(e, t) {
660
+ function He(e, t) {
660
661
  if (!t || t >= e) return [Array.from({ length: e }, (e, t) => t)];
661
662
  let n = [];
662
663
  for (let r = 0; r < e; r += t) n.push(Array.from({ length: Math.min(t, e - r) }, (e, t) => r + t));
663
664
  return n;
664
665
  }
665
- function He({ id: e, value: t, onChange: n, maxLength: r = 6, pattern: i = "digits", groupSize: a, disabled: o, required: s, error: c, helpTextId: l, errorId: u }) {
666
- let d = [c ? u : void 0, l].filter(Boolean).join(" ") || void 0, f = i === "alphanumeric" ? ve : _e, p = Ve(r, a);
667
- return /* @__PURE__ */ q(D, {
666
+ function Ue({ id: e, value: t, onChange: n, maxLength: r = 6, pattern: i = "digits", groupSize: a, disabled: o, required: s, error: c, helpTextId: l, errorId: u }) {
667
+ let d = [c ? u : void 0, l].filter(Boolean).join(" ") || void 0, f = i === "alphanumeric" ? be : ye, p = He(r, a);
668
+ return /* @__PURE__ */ K(D, {
668
669
  id: e,
669
670
  maxLength: r,
670
671
  value: t ?? "",
@@ -674,19 +675,19 @@ function He({ id: e, value: t, onChange: n, maxLength: r = 6, pattern: i = "digi
674
675
  "aria-invalid": c ? !0 : void 0,
675
676
  "aria-required": s || void 0,
676
677
  "aria-describedby": d,
677
- children: p.map((e, t) => /* @__PURE__ */ J(le, { children: [/* @__PURE__ */ q(O, { children: e.map((e) => /* @__PURE__ */ q(k, {
678
+ children: p.map((e, t) => /* @__PURE__ */ q(le, { children: [/* @__PURE__ */ K(O, { children: e.map((e) => /* @__PURE__ */ K(A, {
678
679
  index: e,
679
680
  "aria-invalid": c ? !0 : void 0
680
- }, e)) }), t < p.length - 1 && /* @__PURE__ */ q(ee, {})] }, e[0]))
681
+ }, e)) }), t < p.length - 1 && /* @__PURE__ */ K(k, {})] }, e[0]))
681
682
  });
682
683
  }
683
684
  //#endregion
684
685
  //#region src/base/form/fields/PasswordField.tsx
685
- function Ue({ id: e, value: n, onChange: r, placeholder: i, disabled: a, required: o, error: c, helpTextId: l, errorId: u }) {
686
- let [d, f] = K(!1), p = [c ? u : void 0, l].filter(Boolean).join(" ") || void 0;
687
- return /* @__PURE__ */ J("div", {
686
+ function We({ id: e, value: n, onChange: r, placeholder: i, disabled: a, required: o, error: c, helpTextId: l, errorId: u }) {
687
+ let [d, f] = G(!1), p = [c ? u : void 0, l].filter(Boolean).join(" ") || void 0;
688
+ return /* @__PURE__ */ q("div", {
688
689
  className: "relative",
689
- children: [/* @__PURE__ */ q(s, {
690
+ children: [/* @__PURE__ */ K(s, {
690
691
  id: e,
691
692
  type: d ? "text" : "password",
692
693
  value: n ?? "",
@@ -697,7 +698,7 @@ function Ue({ id: e, value: n, onChange: r, placeholder: i, disabled: a, require
697
698
  "aria-invalid": c ? !0 : void 0,
698
699
  "aria-required": o || void 0,
699
700
  "aria-describedby": p
700
- }), /* @__PURE__ */ q(t, {
701
+ }), /* @__PURE__ */ K(t, {
701
702
  type: "button",
702
703
  variant: "ghost",
703
704
  size: "icon",
@@ -705,8 +706,8 @@ function Ue({ id: e, value: n, onChange: r, placeholder: i, disabled: a, require
705
706
  onClick: () => f(!d),
706
707
  tabIndex: -1,
707
708
  "aria-label": d ? "Hide password" : "Show password",
708
- children: /* @__PURE__ */ q(Y, {
709
- icon: d ? ge : he,
709
+ children: /* @__PURE__ */ K(J, {
710
+ icon: d ? ve : _e,
710
711
  size: 16,
711
712
  strokeWidth: 2
712
713
  })
@@ -715,9 +716,9 @@ function Ue({ id: e, value: n, onChange: r, placeholder: i, disabled: a, require
715
716
  }
716
717
  //#endregion
717
718
  //#region src/base/form/fields/RadioField.tsx
718
- function We({ id: e, value: t, onChange: n, options: r, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
719
+ function Ge({ id: e, value: t, onChange: n, options: r, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
719
720
  let l = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0;
720
- return /* @__PURE__ */ q(F, {
721
+ return /* @__PURE__ */ K(L, {
721
722
  id: e,
722
723
  value: t ?? "",
723
724
  onValueChange: n,
@@ -727,12 +728,12 @@ function We({ id: e, value: t, onChange: n, options: r, disabled: i, required: a
727
728
  "aria-describedby": l,
728
729
  children: r.map((t) => {
729
730
  let n = `${e}-${t.value}`;
730
- return /* @__PURE__ */ J("div", {
731
+ return /* @__PURE__ */ q("div", {
731
732
  className: "flex items-center gap-2",
732
- children: [/* @__PURE__ */ q(re, {
733
+ children: [/* @__PURE__ */ K(te, {
733
734
  value: t.value,
734
735
  id: n
735
- }), /* @__PURE__ */ q(T, {
736
+ }), /* @__PURE__ */ K(T, {
736
737
  htmlFor: n,
737
738
  className: "text-sm font-normal",
738
739
  children: t.label
@@ -743,15 +744,15 @@ function We({ id: e, value: t, onChange: n, options: r, disabled: i, required: a
743
744
  }
744
745
  //#endregion
745
746
  //#region src/base/form/fields/RatingField.tsx
746
- function Ge({ id: e, value: t, onChange: n, maxRating: r = 5, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
747
+ function Ke({ id: e, value: t, onChange: n, maxRating: r = 5, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
747
748
  let l = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0;
748
- return /* @__PURE__ */ q("div", {
749
+ return /* @__PURE__ */ K("div", {
749
750
  id: e,
750
751
  role: "radiogroup",
751
752
  "aria-required": a || void 0,
752
753
  "aria-invalid": o ? !0 : void 0,
753
754
  "aria-describedby": l,
754
- children: /* @__PURE__ */ q(I, {
755
+ children: /* @__PURE__ */ K(ne, {
755
756
  rating: t ?? 0,
756
757
  maxRating: r,
757
758
  editable: !i,
@@ -762,26 +763,26 @@ function Ge({ id: e, value: t, onChange: n, maxRating: r = 5, disabled: i, requi
762
763
  }
763
764
  //#endregion
764
765
  //#region src/base/form/fields/SelectField.tsx
765
- function Ke({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: l }) {
766
+ function qe({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: l }) {
766
767
  let { t: u } = R(), d = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
767
- return /* @__PURE__ */ J(y, {
768
+ return /* @__PURE__ */ q(y, {
768
769
  value: t ?? "",
769
770
  onValueChange: n,
770
771
  disabled: a,
771
772
  required: o,
772
- children: [/* @__PURE__ */ q(S, {
773
+ children: [/* @__PURE__ */ K(S, {
773
774
  id: e,
774
775
  className: "w-full",
775
776
  "aria-invalid": s ? !0 : void 0,
776
777
  "aria-required": o || void 0,
777
778
  "aria-describedby": d,
778
- children: /* @__PURE__ */ q(C, { placeholder: i ?? u("middag.ui.form.select_placeholder") })
779
- }), /* @__PURE__ */ q(b, {
779
+ children: /* @__PURE__ */ K(C, { placeholder: i ?? u("middag.ui.form.select_placeholder") })
780
+ }), /* @__PURE__ */ K(b, {
780
781
  position: "popper",
781
782
  sideOffset: 4,
782
783
  align: "start",
783
784
  className: "w-full",
784
- children: r.map((e) => /* @__PURE__ */ q(x, {
785
+ children: r.map((e) => /* @__PURE__ */ K(x, {
785
786
  value: e.value,
786
787
  children: e.label
787
788
  }, e.value))
@@ -790,11 +791,11 @@ function Ke({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled
790
791
  }
791
792
  //#endregion
792
793
  //#region src/base/form/fields/SliderField.tsx
793
- function qe({ id: e, value: t, onChange: n, min: r = 0, max: i = 100, step: a = 1, multiple: o = !1, disabled: s, required: c, error: l, helpTextId: u, errorId: d }) {
794
+ function Je({ id: e, value: t, onChange: n, min: r = 0, max: i = 100, step: a = 1, multiple: o = !1, disabled: s, required: c, error: l, helpTextId: u, errorId: d }) {
794
795
  let f = [l ? d : void 0, u].filter(Boolean).join(" ") || void 0, p = Array.isArray(t) ? t : t == null ? o ? [r, i] : [r] : [t], m = o ? p.join(" – ") : String(p[0] ?? r);
795
- return /* @__PURE__ */ J("div", {
796
+ return /* @__PURE__ */ q("div", {
796
797
  className: "flex items-center gap-4",
797
- children: [/* @__PURE__ */ q(L, {
798
+ children: [/* @__PURE__ */ K(re, {
798
799
  id: e,
799
800
  value: p,
800
801
  min: r,
@@ -805,7 +806,7 @@ function qe({ id: e, value: t, onChange: n, min: r = 0, max: i = 100, step: a =
805
806
  "aria-invalid": l ? !0 : void 0,
806
807
  "aria-required": c || void 0,
807
808
  "aria-describedby": f
808
- }), /* @__PURE__ */ q("span", {
809
+ }), /* @__PURE__ */ K("span", {
809
810
  "aria-hidden": "true",
810
811
  className: "text-muted-foreground min-w-12 text-right text-sm tabular-nums",
811
812
  children: m
@@ -814,14 +815,14 @@ function qe({ id: e, value: t, onChange: n, min: r = 0, max: i = 100, step: a =
814
815
  }
815
816
  //#endregion
816
817
  //#region src/base/form/fields/SlugField.tsx
817
- function Je(e) {
818
+ function Ye(e) {
818
819
  return e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
819
820
  }
820
- function Ye({ id: e, value: t, onChange: n, sourceValue: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: p, prefix: m }) {
821
- let [h, g] = K(!1), _ = [s ? p : void 0, c].filter(Boolean).join(" ") || void 0;
822
- U(() => {
821
+ function Xe({ id: e, value: t, onChange: n, sourceValue: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: p, prefix: m }) {
822
+ let [h, g] = G(!1), _ = [s ? p : void 0, c].filter(Boolean).join(" ") || void 0;
823
+ ue(() => {
823
824
  if (!h && r !== void 0) {
824
- let e = Je(r);
825
+ let e = Ye(r);
825
826
  e !== t && n(e);
826
827
  }
827
828
  }, [
@@ -830,15 +831,15 @@ function Ye({ id: e, value: t, onChange: n, sourceValue: r, placeholder: i, disa
830
831
  n,
831
832
  t
832
833
  ]);
833
- let v = H((e) => {
834
- g(!0), n(Je(e.target.value));
834
+ let v = U((e) => {
835
+ g(!0), n(Ye(e.target.value));
835
836
  }, [n]);
836
- return m ? /* @__PURE__ */ J(l, {
837
+ return m ? /* @__PURE__ */ q(l, {
837
838
  "data-disabled": a || void 0,
838
- children: [/* @__PURE__ */ q(u, {
839
+ children: [/* @__PURE__ */ K(u, {
839
840
  align: "inline-start",
840
- children: /* @__PURE__ */ q(f, { children: m })
841
- }), /* @__PURE__ */ q(d, {
841
+ children: /* @__PURE__ */ K(f, { children: m })
842
+ }), /* @__PURE__ */ K(d, {
842
843
  id: e,
843
844
  type: "text",
844
845
  value: t ?? "",
@@ -849,9 +850,9 @@ function Ye({ id: e, value: t, onChange: n, sourceValue: r, placeholder: i, disa
849
850
  "aria-required": o || void 0,
850
851
  "aria-describedby": _
851
852
  })]
852
- }) : /* @__PURE__ */ q(l, {
853
+ }) : /* @__PURE__ */ K(l, {
853
854
  "data-disabled": a || void 0,
854
- children: /* @__PURE__ */ q(d, {
855
+ children: /* @__PURE__ */ K(d, {
855
856
  id: e,
856
857
  type: "text",
857
858
  value: t ?? "",
@@ -866,8 +867,8 @@ function Ye({ id: e, value: t, onChange: n, sourceValue: r, placeholder: i, disa
866
867
  }
867
868
  //#endregion
868
869
  //#region src/base/form/fields/StaticField.tsx
869
- function Xe({ id: e, value: t }) {
870
- return /* @__PURE__ */ q("p", {
870
+ function Ze({ id: e, value: t }) {
871
+ return /* @__PURE__ */ K("p", {
871
872
  id: e,
872
873
  className: "border-input bg-muted/50 text-foreground rounded-md border px-3 py-2 text-sm",
873
874
  children: t == null ? "—" : String(t)
@@ -875,11 +876,11 @@ function Xe({ id: e, value: t }) {
875
876
  }
876
877
  //#endregion
877
878
  //#region src/base/form/fields/SwitchField.tsx
878
- function Ze({ id: e, value: t, onChange: n, label: r, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
879
+ function Qe({ id: e, value: t, onChange: n, label: r, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
879
880
  let l = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0;
880
- return /* @__PURE__ */ J("div", {
881
+ return /* @__PURE__ */ q("div", {
881
882
  className: "flex items-center gap-2",
882
- children: [/* @__PURE__ */ q(E, {
883
+ children: [/* @__PURE__ */ K(E, {
883
884
  id: e,
884
885
  checked: !!t,
885
886
  onCheckedChange: n,
@@ -887,7 +888,7 @@ function Ze({ id: e, value: t, onChange: n, label: r, disabled: i, required: a,
887
888
  "aria-invalid": o ? !0 : void 0,
888
889
  "aria-required": a || void 0,
889
890
  "aria-describedby": l
890
- }), r && /* @__PURE__ */ q(T, {
891
+ }), r && /* @__PURE__ */ K(T, {
891
892
  htmlFor: e,
892
893
  className: "text-sm font-normal",
893
894
  children: r
@@ -896,17 +897,17 @@ function Ze({ id: e, value: t, onChange: n, label: r, disabled: i, required: a,
896
897
  }
897
898
  //#endregion
898
899
  //#region src/base/form/fields/TagsField.tsx
899
- function Qe({ id: e, value: t, onChange: n, placeholder: r, disabled: i, required: a, error: o, helpTextId: s, errorId: c, maxTags: l }) {
900
- let { t: u } = R(), [d, f] = K(""), p = G(null), m = W(() => t ?? [], [t]), h = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0, g = H((e) => {
900
+ function $e({ id: e, value: t, onChange: n, placeholder: r, disabled: i, required: a, error: o, helpTextId: s, errorId: c, maxTags: l }) {
901
+ let { t: u } = R(), [d, f] = G(""), p = fe(null), m = W(() => t ?? [], [t]), h = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0, g = U((e) => {
901
902
  let t = e.trim();
902
903
  t && (m.includes(t) || l && m.length >= l || (n([...m, t]), f("")));
903
904
  }, [
904
905
  m,
905
906
  n,
906
907
  l
907
- ]), _ = H((e) => {
908
+ ]), _ = U((e) => {
908
909
  n(m.filter((t, n) => n !== e));
909
- }, [m, n]), v = H((e) => {
910
+ }, [m, n]), v = U((e) => {
910
911
  e.key === "Enter" || e.key === "," ? (e.preventDefault(), g(d)) : e.key === "Backspace" && !d && m.length > 0 && _(m.length - 1);
911
912
  }, [
912
913
  d,
@@ -914,12 +915,12 @@ function Qe({ id: e, value: t, onChange: n, placeholder: r, disabled: i, require
914
915
  g,
915
916
  _
916
917
  ]);
917
- return /* @__PURE__ */ J("div", {
918
+ return /* @__PURE__ */ q("div", {
918
919
  className: `focus-within:ring-ring flex min-h-9 w-full flex-wrap items-center gap-1.5 rounded-md border px-2 py-1.5 text-sm transition-colors focus-within:ring-1 ${o ? "border-destructive" : "border-input"} ${i ? "opacity-50" : ""}`,
919
920
  onClick: () => p.current?.focus(),
920
- children: [m.map((e, t) => /* @__PURE__ */ J("span", {
921
+ children: [m.map((e, t) => /* @__PURE__ */ q("span", {
921
922
  className: "bg-secondary text-secondary-foreground inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-xs font-medium",
922
- children: [e, !i && /* @__PURE__ */ q("button", {
923
+ children: [e, !i && /* @__PURE__ */ K("button", {
923
924
  type: "button",
924
925
  onClick: (e) => {
925
926
  e.stopPropagation(), _(t);
@@ -928,7 +929,7 @@ function Qe({ id: e, value: t, onChange: n, placeholder: r, disabled: i, require
928
929
  "aria-label": `${u("middag.ui.form.tags_remove")} ${e}`,
929
930
  children: "×"
930
931
  })]
931
- }, `${e}-${t}`)), /* @__PURE__ */ q("input", {
932
+ }, `${e}-${t}`)), /* @__PURE__ */ K("input", {
932
933
  ref: p,
933
934
  id: e,
934
935
  type: "text",
@@ -947,9 +948,9 @@ function Qe({ id: e, value: t, onChange: n, placeholder: r, disabled: i, require
947
948
  }
948
949
  //#endregion
949
950
  //#region src/base/form/fields/TextareaField.tsx
950
- function $e({ id: e, value: t, onChange: n, placeholder: r, rows: i = 4, disabled: a, readOnly: o, required: s, error: l, helpTextId: u, errorId: d }) {
951
+ function et({ id: e, value: t, onChange: n, placeholder: r, rows: i = 4, disabled: a, readOnly: o, required: s, error: l, helpTextId: u, errorId: d }) {
951
952
  let f = [l ? d : void 0, u].filter(Boolean).join(" ") || void 0;
952
- return /* @__PURE__ */ q(c, {
953
+ return /* @__PURE__ */ K(c, {
953
954
  id: e,
954
955
  value: t ?? "",
955
956
  onChange: (e) => n(e.target.value),
@@ -966,7 +967,7 @@ function $e({ id: e, value: t, onChange: n, placeholder: r, rows: i = 4, disable
966
967
  //#region src/base/form/fields/TextField.tsx
967
968
  function Z({ id: e, value: t, onChange: n, type: r = "text", placeholder: i, disabled: a, readOnly: o, required: c, error: l, helpTextId: u, errorId: d }) {
968
969
  let f = [l ? d : void 0, u].filter(Boolean).join(" ") || void 0;
969
- return /* @__PURE__ */ q(s, {
970
+ return /* @__PURE__ */ K(s, {
970
971
  id: e,
971
972
  type: r,
972
973
  value: t ?? "",
@@ -981,51 +982,52 @@ function Z({ id: e, value: t, onChange: n, type: r = "text", placeholder: i, dis
981
982
  }
982
983
  //#endregion
983
984
  //#region src/base/form/FormField.tsx
984
- var et = V(() => import("../../../chunks/subpath-CJyJeTlw.js").then((e) => ({ default: e.PhoneField }))), tt = V(() => import("../../../chunks/subpath-DjkzcIPp.js").then((e) => ({ default: e.DateField }))), nt = V(() => import("../../../chunks/subpath-BYl-9lKg.js").then((e) => ({ default: e.DocumentField }))), rt = V(() => import("../../../chunks/subpath-DoiyWIYV.js").then((e) => ({ default: e.DateRangeField })));
985
+ var tt = H(() => import("../../../chunks/subpath-CJyJeTlw.js").then((e) => ({ default: e.PhoneField }))), nt = H(() => import("../../../chunks/subpath-DjkzcIPp.js").then((e) => ({ default: e.DateField }))), rt = H(() => import("../../../chunks/subpath-BYl-9lKg.js").then((e) => ({ default: e.DocumentField }))), it = H(() => import("../../../chunks/subpath-DoiyWIYV.js").then((e) => ({ default: e.DateRangeField })));
985
986
  function Q() {
986
- return /* @__PURE__ */ q(w, { className: "h-9 w-full rounded-md" });
987
+ return /* @__PURE__ */ K(w, { className: "h-9 w-full rounded-md" });
987
988
  }
988
- function it({ label: e }) {
989
- return /* @__PURE__ */ q("div", {
989
+ function at({ label: e }) {
990
+ return /* @__PURE__ */ K("div", {
990
991
  className: "pt-4 pb-1",
991
- children: /* @__PURE__ */ q("h4", {
992
+ children: /* @__PURE__ */ K("h4", {
992
993
  className: "text-foreground text-sm font-semibold",
993
994
  children: e
994
995
  })
995
996
  });
996
997
  }
997
- function at({ id: e, value: t }) {
998
- return /* @__PURE__ */ q("input", {
998
+ function ot({ id: e, value: t }) {
999
+ return /* @__PURE__ */ K("input", {
999
1000
  type: "hidden",
1000
1001
  id: e,
1001
1002
  value: String(t ?? "")
1002
1003
  });
1003
1004
  }
1004
- function ot({ field: e, value: t, onChange: n, error: r, sourceValues: i = {} }) {
1005
- let { t: a } = R(), o = ue(), s = `field-${e.key}-${o}`, c = `${s}-help`, l = `${s}-error`, { component: u, props: d } = e;
1006
- if (u === "header") return /* @__PURE__ */ q(it, { label: d.label });
1007
- if (u === "hidden") return /* @__PURE__ */ q(at, {
1005
+ function st({ field: e, value: t, onChange: n, error: r, sourceValues: i = {} }) {
1006
+ let { t: a } = R(), o = de(), s = `field-${e.key}-${o}`, c = `${s}-help`, l = `${s}-error`, { component: u, props: d } = e;
1007
+ if (u === "header") return /* @__PURE__ */ K(at, { label: d.label });
1008
+ if (u === "hidden") return /* @__PURE__ */ K(ot, {
1008
1009
  id: s,
1009
1010
  value: t
1010
1011
  });
1011
- let f = xe(e, i), p = Se(e, i), m = u === "checkbox" || u === "switch", h = st(u, s, t, n, d, r, c, l, a, i, f, p);
1012
- return /* @__PURE__ */ J("div", {
1012
+ let f = Ce(e, i), p = we(e, i), m = u === "checkbox" || u === "switch", h = ct(u, s, t, n, d, r, c, l, a, i, f, p);
1013
+ return /* @__PURE__ */ q("div", {
1013
1014
  className: "space-y-1.5",
1015
+ "data-testid": ie(e.key),
1014
1016
  children: [
1015
- !m && /* @__PURE__ */ J(T, {
1017
+ !m && /* @__PURE__ */ q(T, {
1016
1018
  htmlFor: s,
1017
- children: [d.label, p && /* @__PURE__ */ q("span", {
1019
+ children: [d.label, p && /* @__PURE__ */ K("span", {
1018
1020
  className: "text-destructive ml-0.5",
1019
1021
  children: "*"
1020
1022
  })]
1021
1023
  }),
1022
- d.helpText && /* @__PURE__ */ q("p", {
1024
+ d.helpText && /* @__PURE__ */ K("p", {
1023
1025
  id: c,
1024
1026
  className: "text-muted-foreground text-xs",
1025
1027
  children: d.helpText
1026
1028
  }),
1027
1029
  h,
1028
- r && /* @__PURE__ */ q("p", {
1030
+ r && /* @__PURE__ */ K("p", {
1029
1031
  id: l,
1030
1032
  className: "text-destructive text-xs",
1031
1033
  "aria-live": "polite",
@@ -1034,7 +1036,7 @@ function ot({ field: e, value: t, onChange: n, error: r, sourceValues: i = {} })
1034
1036
  ]
1035
1037
  });
1036
1038
  }
1037
- function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1039
+ function ct(e, t, n, r, i, a, o, s, c, l, u, d) {
1038
1040
  let f = {
1039
1041
  id: t,
1040
1042
  error: a,
@@ -1044,7 +1046,7 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1044
1046
  required: d
1045
1047
  };
1046
1048
  switch (e) {
1047
- case "text": return /* @__PURE__ */ q(Z, {
1049
+ case "text": return /* @__PURE__ */ K(Z, {
1048
1050
  ...f,
1049
1051
  type: "text",
1050
1052
  value: n,
@@ -1052,7 +1054,7 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1052
1054
  placeholder: i.placeholder,
1053
1055
  readOnly: i.readOnly
1054
1056
  });
1055
- case "email": return /* @__PURE__ */ q(Z, {
1057
+ case "email": return /* @__PURE__ */ K(Z, {
1056
1058
  ...f,
1057
1059
  type: "email",
1058
1060
  value: n,
@@ -1060,7 +1062,7 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1060
1062
  placeholder: i.placeholder,
1061
1063
  readOnly: i.readOnly
1062
1064
  });
1063
- case "url": return /* @__PURE__ */ q(Z, {
1065
+ case "url": return /* @__PURE__ */ K(Z, {
1064
1066
  ...f,
1065
1067
  type: "url",
1066
1068
  value: n,
@@ -1068,7 +1070,7 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1068
1070
  placeholder: i.placeholder,
1069
1071
  readOnly: i.readOnly
1070
1072
  });
1071
- case "textarea": return /* @__PURE__ */ q($e, {
1073
+ case "textarea": return /* @__PURE__ */ K(et, {
1072
1074
  ...f,
1073
1075
  value: n,
1074
1076
  onChange: r,
@@ -1076,13 +1078,13 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1076
1078
  rows: i.rows,
1077
1079
  readOnly: i.readOnly
1078
1080
  });
1079
- case "password": return /* @__PURE__ */ q(Ue, {
1081
+ case "password": return /* @__PURE__ */ K(We, {
1080
1082
  ...f,
1081
1083
  value: n,
1082
1084
  onChange: r,
1083
1085
  placeholder: i.placeholder
1084
1086
  });
1085
- case "otp": return /* @__PURE__ */ q(He, {
1087
+ case "otp": return /* @__PURE__ */ K(Ue, {
1086
1088
  ...f,
1087
1089
  value: n,
1088
1090
  onChange: r,
@@ -1090,21 +1092,21 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1090
1092
  pattern: i.pattern,
1091
1093
  groupSize: i.groupSize
1092
1094
  });
1093
- case "select": return /* @__PURE__ */ q(Ke, {
1095
+ case "select": return /* @__PURE__ */ K(qe, {
1094
1096
  ...f,
1095
1097
  value: n,
1096
1098
  onChange: r,
1097
1099
  options: i.options ?? [],
1098
1100
  placeholder: i.placeholder
1099
1101
  });
1100
- case "native_select": return /* @__PURE__ */ q(ze, {
1102
+ case "native_select": return /* @__PURE__ */ K(Ve, {
1101
1103
  ...f,
1102
1104
  value: n,
1103
1105
  onChange: r,
1104
1106
  options: i.options ?? [],
1105
1107
  placeholder: i.placeholder
1106
1108
  });
1107
- case "multiselect": return /* @__PURE__ */ q(Ie, {
1109
+ case "multiselect": return /* @__PURE__ */ K(Re, {
1108
1110
  ...f,
1109
1111
  value: n,
1110
1112
  onChange: r,
@@ -1112,13 +1114,13 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1112
1114
  placeholder: i.placeholder,
1113
1115
  variant: i.variant
1114
1116
  });
1115
- case "radio": return /* @__PURE__ */ q(We, {
1117
+ case "radio": return /* @__PURE__ */ K(Ge, {
1116
1118
  ...f,
1117
1119
  value: n,
1118
1120
  onChange: r,
1119
1121
  options: i.options ?? []
1120
1122
  });
1121
- case "int": return /* @__PURE__ */ q(Be, {
1123
+ case "int": return /* @__PURE__ */ K(X, {
1122
1124
  ...f,
1123
1125
  value: n,
1124
1126
  onChange: r,
@@ -1126,7 +1128,7 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1126
1128
  max: i.max,
1127
1129
  step: 1
1128
1130
  });
1129
- case "float": return /* @__PURE__ */ q(Be, {
1131
+ case "float": return /* @__PURE__ */ K(X, {
1130
1132
  ...f,
1131
1133
  value: n,
1132
1134
  onChange: r,
@@ -1134,7 +1136,7 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1134
1136
  max: i.max,
1135
1137
  step: i.step ?? .1
1136
1138
  });
1137
- case "slider": return /* @__PURE__ */ q(qe, {
1139
+ case "slider": return /* @__PURE__ */ K(Je, {
1138
1140
  ...f,
1139
1141
  value: n,
1140
1142
  onChange: r,
@@ -1143,21 +1145,21 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1143
1145
  step: i.step,
1144
1146
  multiple: i.multiple
1145
1147
  });
1146
- case "checkbox": return /* @__PURE__ */ q(Te, {
1148
+ case "checkbox": return /* @__PURE__ */ K(De, {
1147
1149
  ...f,
1148
1150
  value: n,
1149
1151
  onChange: r,
1150
1152
  label: i.label
1151
1153
  });
1152
- case "switch": return /* @__PURE__ */ q(Ze, {
1154
+ case "switch": return /* @__PURE__ */ K(Qe, {
1153
1155
  ...f,
1154
1156
  value: n,
1155
1157
  onChange: r,
1156
1158
  label: i.label
1157
1159
  });
1158
- case "date": return /* @__PURE__ */ q(B, {
1159
- fallback: /* @__PURE__ */ q(Q, {}),
1160
- children: /* @__PURE__ */ q(tt, {
1160
+ case "date": return /* @__PURE__ */ K(V, {
1161
+ fallback: /* @__PURE__ */ K(Q, {}),
1162
+ children: /* @__PURE__ */ K(nt, {
1161
1163
  ...f,
1162
1164
  mode: "date",
1163
1165
  value: n,
@@ -1165,9 +1167,9 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1165
1167
  placeholder: i.placeholder
1166
1168
  })
1167
1169
  });
1168
- case "datetime": return /* @__PURE__ */ q(B, {
1169
- fallback: /* @__PURE__ */ q(Q, {}),
1170
- children: /* @__PURE__ */ q(tt, {
1170
+ case "datetime": return /* @__PURE__ */ K(V, {
1171
+ fallback: /* @__PURE__ */ K(Q, {}),
1172
+ children: /* @__PURE__ */ K(nt, {
1171
1173
  ...f,
1172
1174
  mode: "datetime",
1173
1175
  value: n,
@@ -1175,7 +1177,7 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1175
1177
  placeholder: i.placeholder
1176
1178
  })
1177
1179
  });
1178
- case "file": return /* @__PURE__ */ q(Pe, {
1180
+ case "file": return /* @__PURE__ */ K(Ie, {
1179
1181
  ...f,
1180
1182
  value: n,
1181
1183
  onChange: r,
@@ -1184,7 +1186,7 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1184
1186
  maxFiles: i.maxFiles,
1185
1187
  maxSize: i.maxSize
1186
1188
  });
1187
- case "entity_picker": return /* @__PURE__ */ q(Ae, {
1189
+ case "entity_picker": return /* @__PURE__ */ K(Me, {
1188
1190
  ...f,
1189
1191
  value: n,
1190
1192
  onChange: r,
@@ -1196,13 +1198,13 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1196
1198
  entitySubtitleField: i.entitySubtitleField,
1197
1199
  placeholder: i.placeholder
1198
1200
  });
1199
- case "static": return /* @__PURE__ */ q(Xe, {
1201
+ case "static": return /* @__PURE__ */ K(Ze, {
1200
1202
  id: t,
1201
1203
  value: n
1202
1204
  });
1203
- case "phone": return /* @__PURE__ */ q(B, {
1204
- fallback: /* @__PURE__ */ q(Q, {}),
1205
- children: /* @__PURE__ */ q(et, {
1205
+ case "phone": return /* @__PURE__ */ K(V, {
1206
+ fallback: /* @__PURE__ */ K(Q, {}),
1207
+ children: /* @__PURE__ */ K(tt, {
1206
1208
  ...f,
1207
1209
  value: n,
1208
1210
  onChange: r,
@@ -1211,9 +1213,9 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1211
1213
  fixedCountry: i.fixedCountry
1212
1214
  })
1213
1215
  });
1214
- case "document": return /* @__PURE__ */ q(B, {
1215
- fallback: /* @__PURE__ */ q(Q, {}),
1216
- children: /* @__PURE__ */ q(nt, {
1216
+ case "document": return /* @__PURE__ */ K(V, {
1217
+ fallback: /* @__PURE__ */ K(Q, {}),
1218
+ children: /* @__PURE__ */ K(rt, {
1217
1219
  ...f,
1218
1220
  value: n,
1219
1221
  onChange: r,
@@ -1223,7 +1225,7 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1223
1225
  placeholder: i.placeholder
1224
1226
  })
1225
1227
  });
1226
- case "currency": return /* @__PURE__ */ q(Oe, {
1228
+ case "currency": return /* @__PURE__ */ K(Ae, {
1227
1229
  ...f,
1228
1230
  value: n,
1229
1231
  onChange: r,
@@ -1232,13 +1234,13 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1232
1234
  min: i.min,
1233
1235
  max: i.max
1234
1236
  });
1235
- case "color": return /* @__PURE__ */ q(Ee, {
1237
+ case "color": return /* @__PURE__ */ K(Oe, {
1236
1238
  ...f,
1237
1239
  value: n,
1238
1240
  onChange: r,
1239
1241
  placeholder: i.placeholder
1240
1242
  });
1241
- case "slug": return /* @__PURE__ */ q(Ye, {
1243
+ case "slug": return /* @__PURE__ */ K(Xe, {
1242
1244
  ...f,
1243
1245
  value: n,
1244
1246
  onChange: r,
@@ -1246,29 +1248,29 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1246
1248
  prefix: i.prefix,
1247
1249
  placeholder: i.placeholder
1248
1250
  });
1249
- case "tags": return /* @__PURE__ */ q(Qe, {
1251
+ case "tags": return /* @__PURE__ */ K($e, {
1250
1252
  ...f,
1251
1253
  value: n,
1252
1254
  onChange: r,
1253
1255
  placeholder: i.placeholder,
1254
1256
  maxTags: i.maxTags
1255
1257
  });
1256
- case "date_range": return /* @__PURE__ */ q(B, {
1257
- fallback: /* @__PURE__ */ q(Q, {}),
1258
- children: /* @__PURE__ */ q(rt, {
1258
+ case "date_range": return /* @__PURE__ */ K(V, {
1259
+ fallback: /* @__PURE__ */ K(Q, {}),
1260
+ children: /* @__PURE__ */ K(it, {
1259
1261
  ...f,
1260
1262
  value: n,
1261
1263
  onChange: r,
1262
1264
  operator: i.operator
1263
1265
  })
1264
1266
  });
1265
- case "rating": return /* @__PURE__ */ q(Ge, {
1267
+ case "rating": return /* @__PURE__ */ K(Ke, {
1266
1268
  ...f,
1267
1269
  value: n,
1268
1270
  onChange: r,
1269
1271
  maxRating: i.maxRating
1270
1272
  });
1271
- default: return /* @__PURE__ */ J("p", {
1273
+ default: return /* @__PURE__ */ q("p", {
1272
1274
  className: "text-destructive text-xs",
1273
1275
  children: ["Unknown field component: ", e]
1274
1276
  });
@@ -1276,7 +1278,7 @@ function st(e, t, n, r, i, a, o, s, c, l, u, d) {
1276
1278
  }
1277
1279
  //#endregion
1278
1280
  //#region src/base/shell/partials/InlineEditablePanel.tsx
1279
- function ct(e) {
1281
+ function lt(e) {
1280
1282
  switch (e.component) {
1281
1283
  case "int":
1282
1284
  case "float":
@@ -1290,31 +1292,31 @@ function ct(e) {
1290
1292
  default: return "";
1291
1293
  }
1292
1294
  }
1293
- function lt(e, t) {
1294
- return Object.prototype.hasOwnProperty.call(t, e.key) ? t[e.key] : ct(e);
1295
+ function ut(e, t) {
1296
+ return Object.prototype.hasOwnProperty.call(t, e.key) ? t[e.key] : lt(e);
1295
1297
  }
1296
1298
  function $(t, n, r, i) {
1297
1299
  return t.map((t, a) => {
1298
1300
  switch (t.kind) {
1299
- case "field": return be(t, n) ? /* @__PURE__ */ q(ot, {
1301
+ case "field": return Se(t, n) ? /* @__PURE__ */ K(st, {
1300
1302
  field: t,
1301
- value: lt(t, n),
1303
+ value: ut(t, n),
1302
1304
  onChange: (e) => i(t.key, e),
1303
1305
  error: r[t.key],
1304
1306
  sourceValues: n
1305
1307
  }, t.key) : null;
1306
- case "header": return /* @__PURE__ */ q("h4", {
1308
+ case "header": return /* @__PURE__ */ K("h4", {
1307
1309
  className: "text-foreground pt-2 text-sm font-semibold",
1308
1310
  children: t.label
1309
1311
  }, `header-${a}`);
1310
- case "section": return /* @__PURE__ */ J("section", {
1312
+ case "section": return /* @__PURE__ */ q("section", {
1311
1313
  className: "space-y-3",
1312
- children: [/* @__PURE__ */ q("div", {
1314
+ children: [/* @__PURE__ */ K("div", {
1313
1315
  className: "text-muted-foreground text-[11px] font-medium tracking-[0.04em] uppercase",
1314
1316
  children: t.label
1315
1317
  }), $(t.children, n, r, i)]
1316
1318
  }, t.id);
1317
- case "group": return /* @__PURE__ */ q("div", {
1319
+ case "group": return /* @__PURE__ */ K("div", {
1318
1320
  className: e(t.columns === 2 ? "grid grid-cols-2 gap-3" : "space-y-3"),
1319
1321
  children: $(t.children, n, r, i)
1320
1322
  }, t.id);
@@ -1322,10 +1324,10 @@ function $(t, n, r, i) {
1322
1324
  }
1323
1325
  });
1324
1326
  }
1325
- function ut() {
1326
- let { t: e } = R(), { enabled: n, selectedId: r, descriptor: i, loading: a, saving: o, submit: s, close: c, width: l } = ie(), [u, d] = K(() => i?.values ? { ...i.values } : {}), [f, p] = K({}), [m, h] = K(i);
1327
+ function dt() {
1328
+ let { t: e } = R(), { enabled: n, selectedId: r, descriptor: i, loading: a, saving: o, submit: s, close: c, width: l } = ae(), [u, d] = G(() => i?.values ? { ...i.values } : {}), [f, p] = G({}), [m, h] = G(i);
1327
1329
  i !== m && (h(i), d(i?.values ? { ...i.values } : {}), p({}));
1328
- let [g, _] = K(null), v = g ?? l, y = W(() => (e, t) => {
1330
+ let [g, _] = G(null), v = g ?? l, y = W(() => (e, t) => {
1329
1331
  d((n) => ({
1330
1332
  ...n,
1331
1333
  [e]: t
@@ -1335,17 +1337,17 @@ function ut() {
1335
1337
  return delete n[e], n;
1336
1338
  });
1337
1339
  }, []);
1338
- return !n || r === null ? null : /* @__PURE__ */ J(de, { children: [/* @__PURE__ */ q("div", {
1340
+ return !n || r === null ? null : /* @__PURE__ */ q(pe, { children: [/* @__PURE__ */ K("div", {
1339
1341
  className: "fixed inset-0 z-40 bg-black/40",
1340
1342
  onClick: c,
1341
1343
  "aria-hidden": !0
1342
- }), /* @__PURE__ */ J("div", {
1344
+ }), /* @__PURE__ */ q("div", {
1343
1345
  role: "dialog",
1344
1346
  "aria-modal": "true",
1345
1347
  className: "bg-background fixed top-0 right-0 bottom-0 z-50 flex flex-col overflow-hidden border-l shadow-2xl",
1346
1348
  style: { width: v },
1347
1349
  children: [
1348
- /* @__PURE__ */ q("div", {
1350
+ /* @__PURE__ */ K("div", {
1349
1351
  onPointerDown: (e) => {
1350
1352
  e.preventDefault();
1351
1353
  let t = e.clientX, n = v, r = (e) => {
@@ -1358,54 +1360,54 @@ function ut() {
1358
1360
  className: "hover:bg-primary/30 absolute top-0 bottom-0 left-0 z-10 w-1.5 cursor-col-resize",
1359
1361
  "aria-hidden": !0
1360
1362
  }),
1361
- /* @__PURE__ */ J("div", {
1363
+ /* @__PURE__ */ q("div", {
1362
1364
  className: "border-border/60 flex items-start gap-2 border-b px-4 pt-3 pb-2.5",
1363
- children: [/* @__PURE__ */ J("div", {
1365
+ children: [/* @__PURE__ */ q("div", {
1364
1366
  className: "min-w-0 flex-1",
1365
- children: [i?.subtitle && /* @__PURE__ */ q("div", {
1367
+ children: [i?.subtitle && /* @__PURE__ */ K("div", {
1366
1368
  className: "text-muted-foreground mb-0.5 font-mono text-[11px] font-semibold tracking-wide uppercase",
1367
1369
  children: i.subtitle
1368
- }), /* @__PURE__ */ q("h3", {
1370
+ }), /* @__PURE__ */ K("h3", {
1369
1371
  className: "text-foreground truncate text-base leading-snug font-semibold",
1370
1372
  children: i?.title ?? e("middag.ui.loading")
1371
1373
  })]
1372
- }), /* @__PURE__ */ q("button", {
1374
+ }), /* @__PURE__ */ K("button", {
1373
1375
  type: "button",
1374
1376
  onClick: c,
1375
1377
  "aria-label": e("middag.ui.editable_panel.close"),
1376
1378
  className: "text-muted-foreground hover:text-foreground hover:bg-muted rounded p-1 transition-colors",
1377
- children: /* @__PURE__ */ q("span", {
1379
+ children: /* @__PURE__ */ K("span", {
1378
1380
  "aria-hidden": !0,
1379
1381
  className: "text-sm leading-none",
1380
1382
  children: "✕"
1381
1383
  })
1382
1384
  })]
1383
1385
  }),
1384
- /* @__PURE__ */ q("div", {
1386
+ /* @__PURE__ */ K("div", {
1385
1387
  className: "min-h-0 flex-1 overflow-y-auto p-4",
1386
- children: a || !i ? /* @__PURE__ */ q("div", {
1388
+ children: a || !i ? /* @__PURE__ */ K("div", {
1387
1389
  className: "flex items-center justify-center p-8",
1388
- children: /* @__PURE__ */ q("div", { className: "border-primary h-6 w-6 animate-spin rounded-full border-2 border-t-transparent" })
1389
- }) : /* @__PURE__ */ q("div", {
1390
+ children: /* @__PURE__ */ K("div", { className: "border-primary h-6 w-6 animate-spin rounded-full border-2 border-t-transparent" })
1391
+ }) : /* @__PURE__ */ K("div", {
1390
1392
  className: "space-y-3.5",
1391
1393
  children: $(i.schema, u, f, y)
1392
1394
  })
1393
1395
  }),
1394
- i && !a && /* @__PURE__ */ J("div", {
1396
+ i && !a && /* @__PURE__ */ q("div", {
1395
1397
  className: "flex justify-end gap-2 border-t p-3",
1396
- children: [/* @__PURE__ */ q(t, {
1398
+ children: [/* @__PURE__ */ K(t, {
1397
1399
  type: "button",
1398
1400
  variant: "outline",
1399
1401
  size: "sm",
1400
1402
  onClick: c,
1401
1403
  disabled: o,
1402
1404
  children: i.cancelLabel ?? e("middag.ui.cancel")
1403
- }), /* @__PURE__ */ q(t, {
1405
+ }), /* @__PURE__ */ K(t, {
1404
1406
  type: "button",
1405
1407
  size: "sm",
1406
1408
  onClick: () => {
1407
1409
  if (!i) return;
1408
- let t = we(i.schema, u, e).safeParse(u);
1410
+ let t = Ee(i.schema, u, e).safeParse(u);
1409
1411
  if (!t.success) {
1410
1412
  let e = {};
1411
1413
  for (let n of t.error.issues) {
@@ -1425,4 +1427,4 @@ function ut() {
1425
1427
  })] });
1426
1428
  }
1427
1429
  //#endregion
1428
- export { ut as InlineEditablePanel };
1430
+ export { dt as InlineEditablePanel };