@middag-io/react 0.46.1 → 0.48.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.
- package/dist-lib/{FormField-M7Khc1eo.js → FormField-BGqAQLtX.js} +2155 -2130
- package/dist-lib/{FormPanelBlock-70gQ9d9K.js → FormPanelBlock-CGgA83Mu.js} +46 -45
- package/dist-lib/base/blocks/CardGridBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/DetailPanelBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/FormPanelBlock.d.ts.map +1 -1
- package/dist-lib/base/partials/ActionBar/index.d.ts.map +1 -1
- package/dist-lib/base/partials/FilterBar/index.d.ts.map +1 -1
- package/dist-lib/base/shell/BasicShell.d.ts +1 -1
- package/dist-lib/base/shell/BasicShell.js +1 -1
- package/dist-lib/base/shell/partials/InlineEditablePanel.d.ts.map +1 -1
- package/dist-lib/base/shell/partials/InlineEditablePanel.js +131 -127
- package/dist-lib/base/shell/partials/PageActionButton.d.ts.map +1 -1
- package/dist-lib/base/shell/partials/PageActionButton.js +1 -1
- package/dist-lib/base/theme/appearance.d.ts.map +1 -1
- package/dist-lib/base/theme/appearance.js +1 -1
- package/dist-lib/base/utils/action-intent.d.ts +3 -0
- package/dist-lib/base/utils/action-intent.d.ts.map +1 -0
- package/dist-lib/base/utils/action-intent.js +16 -0
- package/dist-lib/base/utils/icon-registry.d.ts +3 -2
- package/dist-lib/base/utils/icon-registry.d.ts.map +1 -1
- package/dist-lib/chunks/subpath-Bs35txZS.js +166 -0
- package/dist-lib/contracts/generated/index.d.ts +4 -4
- package/dist-lib/contracts/generated/index.d.ts.map +1 -1
- package/dist-lib/contracts/generated/schemas.d.ts +338 -243
- package/dist-lib/contracts/generated/schemas.d.ts.map +1 -1
- package/dist-lib/contracts/generated/types.d.ts +88 -52
- package/dist-lib/contracts/generated/types.d.ts.map +1 -1
- package/dist-lib/contracts/navigation.d.ts +5 -38
- package/dist-lib/contracts/navigation.d.ts.map +1 -1
- package/dist-lib/contracts/page-contract-schema.d.ts +11 -11
- package/dist-lib/contracts/shared-props.d.ts +10 -71
- package/dist-lib/contracts/shared-props.d.ts.map +1 -1
- package/dist-lib/engine/providers/auth.d.ts +2 -2
- package/dist-lib/engine/providers/auth.d.ts.map +1 -1
- package/dist-lib/engine/providers/flash.d.ts.map +1 -1
- package/dist-lib/index.d.ts +2 -2
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/middag-react.js +9837 -9773
- package/docs/public/schemas/ai-contract-manifest.json +9 -9
- package/docs/public/schemas/fragment.json +221 -89
- package/docs/public/schemas/manifest.json +4 -4
- package/docs/public/schemas/page-contract.json +221 -89
- package/docs/public/schemas/shared-props.json +2457 -114
- package/package.json +1 -1
- package/src/base/blocks/CardGridBlock.tsx +2 -1
- package/src/base/blocks/DenseTableBlock.tsx +2 -1
- package/src/base/blocks/DetailPanelBlock.tsx +2 -1
- package/src/base/blocks/FormPanelBlock.tsx +2 -1
- package/src/base/partials/ActionBar/index.tsx +3 -2
- package/src/base/partials/FilterBar/index.tsx +12 -1
- package/src/base/shell/BasicShell.tsx +7 -7
- package/src/base/shell/partials/InlineEditablePanel.tsx +14 -7
- package/src/base/shell/partials/PageActionButton.tsx +3 -1
- package/src/base/theme/appearance.ts +2 -1
- package/src/base/utils/action-intent.ts +22 -0
- package/src/base/utils/icon-registry.ts +3 -3
- package/src/contracts/generated/index.ts +4 -4
- package/src/contracts/generated/schemas.ts +85 -44
- package/src/contracts/generated/types.ts +107 -60
- package/src/contracts/navigation.ts +5 -52
- package/src/contracts/page-contract-schema.ts +2 -2
- package/src/contracts/shared-props.ts +10 -75
- package/src/engine/providers/auth.tsx +1 -1
- package/src/engine/providers/flash.tsx +0 -5
- package/dist-lib/chunks/subpath-Bh1MAmBT.js +0 -165
- package/docs/public/schemas/navigation.json +0 -72
|
@@ -18,42 +18,43 @@ import { NumberField as ee, NumberFieldDecrement as N, NumberFieldGroup as P, Nu
|
|
|
18
18
|
import { RadioGroup as L, RadioGroupItem as te } from "../../../primitives/reui/radio-group.js";
|
|
19
19
|
import { Rating as ne } from "../../../primitives/reui/rating.js";
|
|
20
20
|
import { Slider as re } from "../../../primitives/reui/slider.js";
|
|
21
|
+
import { renderLabel as ie } from "../../../i18n/render-label.js";
|
|
21
22
|
import { useTranslation as R } from "../../../i18n/useTranslation.js";
|
|
22
|
-
import { fieldTestId as
|
|
23
|
-
import { useEditablePanel as
|
|
24
|
-
import { beginPending as
|
|
23
|
+
import { fieldTestId as ae } from "../../../lib/test-ids.js";
|
|
24
|
+
import { useEditablePanel as oe } from "./EditablePanelContext.js";
|
|
25
|
+
import { beginPending as se, trackedFetch as ce } from "../../../lib/host-pending.js";
|
|
25
26
|
import { evaluateCondition as z } from "../../utils/conditions.js";
|
|
26
|
-
import { formatBytes as B, useFileUpload as
|
|
27
|
-
import { Fragment as
|
|
28
|
-
import { Fragment as
|
|
27
|
+
import { formatBytes as B, useFileUpload as le } from "../../../lib/hooks/use-file-upload.js";
|
|
28
|
+
import { Fragment as ue, Suspense as V, lazy as H, useCallback as U, useEffect as de, useId as fe, useMemo as W, useRef as pe, useState as G } from "react";
|
|
29
|
+
import { Fragment as me, jsx as K, jsxs as q } from "react/jsx-runtime";
|
|
29
30
|
import { HugeiconsIcon as J } from "@hugeicons/react";
|
|
30
|
-
import { Cancel01Icon as
|
|
31
|
-
import { REGEXP_ONLY_DIGITS as
|
|
31
|
+
import { Cancel01Icon as he, FileEmpty02Icon as ge, Upload01Icon as _e, ViewIcon as ve, ViewOffIcon as ye } from "@hugeicons/core-free-icons";
|
|
32
|
+
import { REGEXP_ONLY_DIGITS as be, REGEXP_ONLY_DIGITS_AND_CHARS as xe } from "input-otp";
|
|
32
33
|
import { z as Y } from "zod";
|
|
33
34
|
//#region src/base/form/form-utils.ts
|
|
34
|
-
function
|
|
35
|
+
function Se(e) {
|
|
35
36
|
let t = [];
|
|
36
|
-
for (let n of e) n.kind === "field" ? t.push(n) : (n.kind === "section" || n.kind === "group") && t.push(...
|
|
37
|
+
for (let n of e) n.kind === "field" ? t.push(n) : (n.kind === "section" || n.kind === "group") && t.push(...Se(n.children));
|
|
37
38
|
return t;
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
+
function Ce(e, t) {
|
|
40
41
|
if (e.component === "header") return !0;
|
|
41
42
|
let { props: n } = e;
|
|
42
43
|
return !(n.hidden_when && z(n.hidden_when, t) || n.visible_when && !z(n.visible_when, t));
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function we(e, t) {
|
|
45
46
|
if (e.component === "header") return !1;
|
|
46
47
|
let { props: n } = e;
|
|
47
48
|
return !!(n.disabled || n.disabled_when && z(n.disabled_when, t));
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
-
if (e.component === "header" ||
|
|
50
|
+
function Te(e, t) {
|
|
51
|
+
if (e.component === "header" || we(e, t)) return !1;
|
|
51
52
|
let { props: n } = e;
|
|
52
53
|
return !!(n.required || n.required_when && z(n.required_when, t));
|
|
53
54
|
}
|
|
54
55
|
//#endregion
|
|
55
56
|
//#region src/base/form/form-schema-builder.ts
|
|
56
|
-
function
|
|
57
|
+
function Ee(e, t, n) {
|
|
57
58
|
let { component: r, props: i } = e, a = i.validation, o = n;
|
|
58
59
|
switch (r) {
|
|
59
60
|
case "text":
|
|
@@ -120,14 +121,14 @@ function Te(e, t, n) {
|
|
|
120
121
|
default: return Y.any();
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
-
let r =
|
|
125
|
-
for (let e of r) e.component === "header" || e.component === "hidden" || e.component === "static" ||
|
|
124
|
+
function De(e, t, n) {
|
|
125
|
+
let r = Se(e), i = {};
|
|
126
|
+
for (let e of r) e.component === "header" || e.component === "hidden" || e.component === "static" || Ce(e, t) && (i[e.key] = Ee(e, n, Te(e, t)));
|
|
126
127
|
return Y.object(i);
|
|
127
128
|
}
|
|
128
129
|
//#endregion
|
|
129
130
|
//#region src/base/form/fields/CheckboxField.tsx
|
|
130
|
-
function
|
|
131
|
+
function Oe({ id: e, value: t, onChange: n, label: r, disabled: i, required: a, error: s, helpTextId: c, errorId: l }) {
|
|
131
132
|
let u = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
|
|
132
133
|
return /* @__PURE__ */ q("div", {
|
|
133
134
|
className: "flex items-center gap-2",
|
|
@@ -148,7 +149,7 @@ function De({ id: e, value: t, onChange: n, label: r, disabled: i, required: a,
|
|
|
148
149
|
}
|
|
149
150
|
//#endregion
|
|
150
151
|
//#region src/base/form/fields/ColorField.tsx
|
|
151
|
-
function
|
|
152
|
+
function ke({ id: e, value: t, onChange: n, placeholder: r, disabled: i, required: a, error: o, helpTextId: c, errorId: l }) {
|
|
152
153
|
let u = [o ? l : void 0, c].filter(Boolean).join(" ") || void 0, d = U((e) => {
|
|
153
154
|
n(e.target.value);
|
|
154
155
|
}, [n]), f = U((e) => {
|
|
@@ -180,7 +181,7 @@ function Oe({ id: e, value: t, onChange: n, placeholder: r, disabled: i, require
|
|
|
180
181
|
}
|
|
181
182
|
//#endregion
|
|
182
183
|
//#region src/base/form/fields/CurrencyField.tsx
|
|
183
|
-
var
|
|
184
|
+
var Ae = {
|
|
184
185
|
BRL: "R$",
|
|
185
186
|
USD: "$",
|
|
186
187
|
EUR: "€",
|
|
@@ -195,8 +196,8 @@ var ke = {
|
|
|
195
196
|
COP: "$",
|
|
196
197
|
PEN: "S/"
|
|
197
198
|
};
|
|
198
|
-
function
|
|
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 =
|
|
199
|
+
function je({ 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 }) {
|
|
200
|
+
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 = Ae[r] ?? r, T = U(() => {
|
|
200
201
|
y(!0), x(t == null ? "" : String(t));
|
|
201
202
|
}, [t]), E = U(() => {
|
|
202
203
|
y(!1);
|
|
@@ -232,23 +233,23 @@ function Ae({ id: e, value: t, onChange: n, currency: r = "BRL", placeholder: i,
|
|
|
232
233
|
}
|
|
233
234
|
//#endregion
|
|
234
235
|
//#region src/base/form/fields/EntityPickerField.tsx
|
|
235
|
-
function
|
|
236
|
+
function Me(e) {
|
|
236
237
|
return e.split(/\s+/).slice(0, 2).map((e) => e[0]?.toUpperCase() ?? "").join("");
|
|
237
238
|
}
|
|
238
|
-
function
|
|
239
|
-
let { t: w } = R(), [T, E] = G(s && t && s.value === t ? s.label : ""), [D, O] = G([]), [k, A] = G(!1), j =
|
|
240
|
-
|
|
239
|
+
function Ne({ 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 }) {
|
|
240
|
+
let { t: w } = R(), [T, E] = G(s && t && s.value === t ? s.label : ""), [D, O] = G([]), [k, A] = G(!1), j = pe(void 0), M = !!c, ee = [x ? C : void 0, S].filter(Boolean).join(" ") || void 0, N = W(() => [], []), P = W(() => o ?? N, [o, N]);
|
|
241
|
+
de(() => {
|
|
241
242
|
if (!M) return;
|
|
242
243
|
if (j.current && clearTimeout(j.current), T.length < l) return j.current = setTimeout(() => O([]), 0), () => {
|
|
243
244
|
j.current && clearTimeout(j.current);
|
|
244
245
|
};
|
|
245
|
-
let e =
|
|
246
|
+
let e = se();
|
|
246
247
|
return j.current = setTimeout(async () => {
|
|
247
248
|
A(!0);
|
|
248
249
|
try {
|
|
249
250
|
let e = new URL(c, window.location.origin);
|
|
250
251
|
e.searchParams.set("q", T);
|
|
251
|
-
let t = await
|
|
252
|
+
let t = await ce(e.toString());
|
|
252
253
|
if (t.ok) {
|
|
253
254
|
let e = await t.json(), n = (e.items ?? e.data ?? e).map((e) => ({
|
|
254
255
|
value: String(e.value ?? e.id),
|
|
@@ -315,7 +316,7 @@ function Me({ id: e, value: t, onChange: a, options: o, initialOption: s, autoco
|
|
|
315
316
|
alt: e.label
|
|
316
317
|
}), /* @__PURE__ */ K(r, {
|
|
317
318
|
className: "text-[10px]",
|
|
318
|
-
children:
|
|
319
|
+
children: Me(e.label)
|
|
319
320
|
})]
|
|
320
321
|
}), /* @__PURE__ */ q("div", {
|
|
321
322
|
className: "min-w-0 flex-1",
|
|
@@ -332,21 +333,21 @@ function Me({ id: e, value: t, onChange: a, options: o, initialOption: s, autoco
|
|
|
332
333
|
}
|
|
333
334
|
//#endregion
|
|
334
335
|
//#region src/base/form/fields/FileUploadField.tsx
|
|
335
|
-
function
|
|
336
|
+
function Pe(e) {
|
|
336
337
|
let t = e.split(/[?#]/)[0], n = t.split("/");
|
|
337
338
|
return n[n.length - 1] || t;
|
|
338
339
|
}
|
|
339
|
-
function
|
|
340
|
+
function Fe(e) {
|
|
340
341
|
if (e == null || e === "") return null;
|
|
341
342
|
if (typeof e == "string") return {
|
|
342
|
-
name:
|
|
343
|
+
name: Pe(e),
|
|
343
344
|
size: 0,
|
|
344
345
|
type: "",
|
|
345
346
|
url: e,
|
|
346
347
|
id: e
|
|
347
348
|
};
|
|
348
349
|
if (typeof e == "object" && !(e instanceof File)) {
|
|
349
|
-
let t = e, n = typeof t.url == "string" ? t.url : "", r = typeof t.name == "string" ? t.name : n ?
|
|
350
|
+
let t = e, n = typeof t.url == "string" ? t.url : "", r = typeof t.name == "string" ? t.name : n ? Pe(n) : "";
|
|
350
351
|
return !n && !r ? null : {
|
|
351
352
|
name: r,
|
|
352
353
|
size: typeof t.size == "number" ? t.size : 0,
|
|
@@ -357,11 +358,11 @@ function Pe(e) {
|
|
|
357
358
|
}
|
|
358
359
|
return null;
|
|
359
360
|
}
|
|
360
|
-
function
|
|
361
|
-
return (Array.isArray(e) ? e : [e]).map(
|
|
361
|
+
function Ie(e) {
|
|
362
|
+
return (Array.isArray(e) ? e : [e]).map(Fe).filter((e) => e !== null);
|
|
362
363
|
}
|
|
363
|
-
function
|
|
364
|
-
let { t: m } = R(), [h] = G(() =>
|
|
364
|
+
function Le({ 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 }) {
|
|
365
|
+
let { t: m } = R(), [h] = G(() => Ie(r)), [{ files: g, isDragging: _, errors: v }, { removeFile: y, handleDragEnter: b, handleDragLeave: x, handleDragOver: S, handleDrop: C, openFileDialog: w, getInputProps: T }] = le({
|
|
365
366
|
maxFiles: o ? s : 1,
|
|
366
367
|
maxSize: c,
|
|
367
368
|
accept: a,
|
|
@@ -390,7 +391,7 @@ function Ie({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
|
|
|
390
391
|
className: "flex flex-col items-center gap-2 py-4",
|
|
391
392
|
children: [
|
|
392
393
|
/* @__PURE__ */ K(J, {
|
|
393
|
-
icon:
|
|
394
|
+
icon: _e,
|
|
394
395
|
className: e("size-8", _ ? "text-primary" : "text-muted-foreground")
|
|
395
396
|
}),
|
|
396
397
|
/* @__PURE__ */ K("p", {
|
|
@@ -426,7 +427,7 @@ function Ie({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
|
|
|
426
427
|
}) : /* @__PURE__ */ K("div", {
|
|
427
428
|
className: "bg-muted flex size-10 shrink-0 items-center justify-center rounded border",
|
|
428
429
|
children: /* @__PURE__ */ K(J, {
|
|
429
|
-
icon:
|
|
430
|
+
icon: ge,
|
|
430
431
|
className: "text-muted-foreground size-5"
|
|
431
432
|
})
|
|
432
433
|
}),
|
|
@@ -447,7 +448,7 @@ function Ie({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
|
|
|
447
448
|
onClick: () => y(e.id),
|
|
448
449
|
disabled: l,
|
|
449
450
|
children: /* @__PURE__ */ K(J, {
|
|
450
|
-
icon:
|
|
451
|
+
icon: he,
|
|
451
452
|
className: "size-3.5"
|
|
452
453
|
})
|
|
453
454
|
})
|
|
@@ -471,10 +472,10 @@ function Ie({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
|
|
|
471
472
|
}
|
|
472
473
|
//#endregion
|
|
473
474
|
//#region src/base/form/fields/MultiSelectField.tsx
|
|
474
|
-
var
|
|
475
|
-
function
|
|
475
|
+
var Re = 8;
|
|
476
|
+
function ze({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: l, variant: u = "auto" }) {
|
|
476
477
|
let { t: d } = R(), f = t ?? [], p = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
|
|
477
|
-
return u === "checkbox" || u === "auto" && r.length <=
|
|
478
|
+
return u === "checkbox" || u === "auto" && r.length <= Re ? /* @__PURE__ */ K(Be, {
|
|
478
479
|
id: e,
|
|
479
480
|
options: r,
|
|
480
481
|
selected: f,
|
|
@@ -484,7 +485,7 @@ function Re({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled
|
|
|
484
485
|
error: s,
|
|
485
486
|
describedBy: p,
|
|
486
487
|
t: d
|
|
487
|
-
}) : /* @__PURE__ */ K(
|
|
488
|
+
}) : /* @__PURE__ */ K(Ve, {
|
|
488
489
|
id: e,
|
|
489
490
|
options: r,
|
|
490
491
|
selected: f,
|
|
@@ -497,7 +498,7 @@ function Re({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled
|
|
|
497
498
|
t: d
|
|
498
499
|
});
|
|
499
500
|
}
|
|
500
|
-
function
|
|
501
|
+
function Be({ id: e, options: t, selected: n, onChange: r, disabled: i, required: a, error: s, describedBy: c, t: l }) {
|
|
501
502
|
let u = (e) => {
|
|
502
503
|
n.includes(e) ? r(n.filter((t) => t !== e)) : r([...n, e]);
|
|
503
504
|
};
|
|
@@ -526,7 +527,7 @@ function ze({ id: e, options: t, selected: n, onChange: r, disabled: i, required
|
|
|
526
527
|
})]
|
|
527
528
|
});
|
|
528
529
|
}
|
|
529
|
-
function
|
|
530
|
+
function Ve({ id: e, options: t, selected: n, onChange: r, placeholder: i, disabled: s, required: c, error: l, describedBy: u, t: d }) {
|
|
530
531
|
let [f, y] = G(""), b = W(() => {
|
|
531
532
|
if (!f) return t;
|
|
532
533
|
let e = f.toLowerCase();
|
|
@@ -609,7 +610,7 @@ function Be({ id: e, options: t, selected: n, onChange: r, placeholder: i, disab
|
|
|
609
610
|
}
|
|
610
611
|
//#endregion
|
|
611
612
|
//#region src/base/form/fields/NativeSelectField.tsx
|
|
612
|
-
function
|
|
613
|
+
function He({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: l }) {
|
|
613
614
|
let { t: u } = R(), d = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
|
|
614
615
|
return /* @__PURE__ */ K("div", {
|
|
615
616
|
className: "w-full [&>div]:w-full",
|
|
@@ -657,14 +658,14 @@ function X({ id: e, value: t, onChange: n, min: r, max: i, step: a = 1, disabled
|
|
|
657
658
|
}
|
|
658
659
|
//#endregion
|
|
659
660
|
//#region src/base/form/fields/OtpField.tsx
|
|
660
|
-
function
|
|
661
|
+
function Ue(e, t) {
|
|
661
662
|
if (!t || t >= e) return [Array.from({ length: e }, (e, t) => t)];
|
|
662
663
|
let n = [];
|
|
663
664
|
for (let r = 0; r < e; r += t) n.push(Array.from({ length: Math.min(t, e - r) }, (e, t) => r + t));
|
|
664
665
|
return n;
|
|
665
666
|
}
|
|
666
|
-
function
|
|
667
|
-
let d = [c ? u : void 0, l].filter(Boolean).join(" ") || void 0, f = i === "alphanumeric" ?
|
|
667
|
+
function We({ id: e, value: t, onChange: n, maxLength: r = 6, pattern: i = "digits", groupSize: a, disabled: o, required: s, error: c, helpTextId: l, errorId: u }) {
|
|
668
|
+
let d = [c ? u : void 0, l].filter(Boolean).join(" ") || void 0, f = i === "alphanumeric" ? xe : be, p = Ue(r, a);
|
|
668
669
|
return /* @__PURE__ */ K(D, {
|
|
669
670
|
id: e,
|
|
670
671
|
maxLength: r,
|
|
@@ -675,7 +676,7 @@ function Ue({ id: e, value: t, onChange: n, maxLength: r = 6, pattern: i = "digi
|
|
|
675
676
|
"aria-invalid": c ? !0 : void 0,
|
|
676
677
|
"aria-required": s || void 0,
|
|
677
678
|
"aria-describedby": d,
|
|
678
|
-
children: p.map((e, t) => /* @__PURE__ */ q(
|
|
679
|
+
children: p.map((e, t) => /* @__PURE__ */ q(ue, { children: [/* @__PURE__ */ K(O, { children: e.map((e) => /* @__PURE__ */ K(A, {
|
|
679
680
|
index: e,
|
|
680
681
|
"aria-invalid": c ? !0 : void 0
|
|
681
682
|
}, e)) }), t < p.length - 1 && /* @__PURE__ */ K(k, {})] }, e[0]))
|
|
@@ -683,7 +684,7 @@ function Ue({ id: e, value: t, onChange: n, maxLength: r = 6, pattern: i = "digi
|
|
|
683
684
|
}
|
|
684
685
|
//#endregion
|
|
685
686
|
//#region src/base/form/fields/PasswordField.tsx
|
|
686
|
-
function
|
|
687
|
+
function Ge({ id: e, value: n, onChange: r, placeholder: i, disabled: a, required: o, error: c, helpTextId: l, errorId: u }) {
|
|
687
688
|
let [d, f] = G(!1), p = [c ? u : void 0, l].filter(Boolean).join(" ") || void 0;
|
|
688
689
|
return /* @__PURE__ */ q("div", {
|
|
689
690
|
className: "relative",
|
|
@@ -707,7 +708,7 @@ function We({ id: e, value: n, onChange: r, placeholder: i, disabled: a, require
|
|
|
707
708
|
tabIndex: -1,
|
|
708
709
|
"aria-label": d ? "Hide password" : "Show password",
|
|
709
710
|
children: /* @__PURE__ */ K(J, {
|
|
710
|
-
icon: d ?
|
|
711
|
+
icon: d ? ye : ve,
|
|
711
712
|
size: 16,
|
|
712
713
|
strokeWidth: 2
|
|
713
714
|
})
|
|
@@ -716,7 +717,7 @@ function We({ id: e, value: n, onChange: r, placeholder: i, disabled: a, require
|
|
|
716
717
|
}
|
|
717
718
|
//#endregion
|
|
718
719
|
//#region src/base/form/fields/RadioField.tsx
|
|
719
|
-
function
|
|
720
|
+
function Ke({ id: e, value: t, onChange: n, options: r, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
|
|
720
721
|
let l = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0;
|
|
721
722
|
return /* @__PURE__ */ K(L, {
|
|
722
723
|
id: e,
|
|
@@ -744,7 +745,7 @@ function Ge({ id: e, value: t, onChange: n, options: r, disabled: i, required: a
|
|
|
744
745
|
}
|
|
745
746
|
//#endregion
|
|
746
747
|
//#region src/base/form/fields/RatingField.tsx
|
|
747
|
-
function
|
|
748
|
+
function qe({ id: e, value: t, onChange: n, maxRating: r = 5, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
|
|
748
749
|
let l = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0;
|
|
749
750
|
return /* @__PURE__ */ K("div", {
|
|
750
751
|
id: e,
|
|
@@ -763,7 +764,7 @@ function Ke({ id: e, value: t, onChange: n, maxRating: r = 5, disabled: i, requi
|
|
|
763
764
|
}
|
|
764
765
|
//#endregion
|
|
765
766
|
//#region src/base/form/fields/SelectField.tsx
|
|
766
|
-
function
|
|
767
|
+
function Je({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: l }) {
|
|
767
768
|
let { t: u } = R(), d = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
|
|
768
769
|
return /* @__PURE__ */ q(y, {
|
|
769
770
|
value: t ?? "",
|
|
@@ -791,7 +792,7 @@ function qe({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled
|
|
|
791
792
|
}
|
|
792
793
|
//#endregion
|
|
793
794
|
//#region src/base/form/fields/SliderField.tsx
|
|
794
|
-
function
|
|
795
|
+
function Ye({ 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 }) {
|
|
795
796
|
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);
|
|
796
797
|
return /* @__PURE__ */ q("div", {
|
|
797
798
|
className: "flex items-center gap-4",
|
|
@@ -815,14 +816,14 @@ function Je({ id: e, value: t, onChange: n, min: r = 0, max: i = 100, step: a =
|
|
|
815
816
|
}
|
|
816
817
|
//#endregion
|
|
817
818
|
//#region src/base/form/fields/SlugField.tsx
|
|
818
|
-
function
|
|
819
|
+
function Xe(e) {
|
|
819
820
|
return e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
|
|
820
821
|
}
|
|
821
|
-
function
|
|
822
|
+
function Ze({ id: e, value: t, onChange: n, sourceValue: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: p, prefix: m }) {
|
|
822
823
|
let [h, g] = G(!1), _ = [s ? p : void 0, c].filter(Boolean).join(" ") || void 0;
|
|
823
|
-
|
|
824
|
+
de(() => {
|
|
824
825
|
if (!h && r !== void 0) {
|
|
825
|
-
let e =
|
|
826
|
+
let e = Xe(r);
|
|
826
827
|
e !== t && n(e);
|
|
827
828
|
}
|
|
828
829
|
}, [
|
|
@@ -832,7 +833,7 @@ function Xe({ id: e, value: t, onChange: n, sourceValue: r, placeholder: i, disa
|
|
|
832
833
|
t
|
|
833
834
|
]);
|
|
834
835
|
let v = U((e) => {
|
|
835
|
-
g(!0), n(
|
|
836
|
+
g(!0), n(Xe(e.target.value));
|
|
836
837
|
}, [n]);
|
|
837
838
|
return m ? /* @__PURE__ */ q(l, {
|
|
838
839
|
"data-disabled": a || void 0,
|
|
@@ -867,7 +868,7 @@ function Xe({ id: e, value: t, onChange: n, sourceValue: r, placeholder: i, disa
|
|
|
867
868
|
}
|
|
868
869
|
//#endregion
|
|
869
870
|
//#region src/base/form/fields/StaticField.tsx
|
|
870
|
-
function
|
|
871
|
+
function Qe({ id: e, value: t }) {
|
|
871
872
|
return /* @__PURE__ */ K("p", {
|
|
872
873
|
id: e,
|
|
873
874
|
className: "border-input bg-muted/50 text-foreground rounded-md border px-3 py-2 text-sm",
|
|
@@ -876,7 +877,7 @@ function Ze({ id: e, value: t }) {
|
|
|
876
877
|
}
|
|
877
878
|
//#endregion
|
|
878
879
|
//#region src/base/form/fields/SwitchField.tsx
|
|
879
|
-
function
|
|
880
|
+
function $e({ id: e, value: t, onChange: n, label: r, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
|
|
880
881
|
let l = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0;
|
|
881
882
|
return /* @__PURE__ */ q("div", {
|
|
882
883
|
className: "flex items-center gap-2",
|
|
@@ -897,8 +898,8 @@ function Qe({ id: e, value: t, onChange: n, label: r, disabled: i, required: a,
|
|
|
897
898
|
}
|
|
898
899
|
//#endregion
|
|
899
900
|
//#region src/base/form/fields/TagsField.tsx
|
|
900
|
-
function
|
|
901
|
-
let { t: u } = R(), [d, f] = G(""), p =
|
|
901
|
+
function et({ id: e, value: t, onChange: n, placeholder: r, disabled: i, required: a, error: o, helpTextId: s, errorId: c, maxTags: l }) {
|
|
902
|
+
let { t: u } = R(), [d, f] = G(""), p = pe(null), m = W(() => t ?? [], [t]), h = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0, g = U((e) => {
|
|
902
903
|
let t = e.trim();
|
|
903
904
|
t && (m.includes(t) || l && m.length >= l || (n([...m, t]), f("")));
|
|
904
905
|
}, [
|
|
@@ -948,7 +949,7 @@ function $e({ id: e, value: t, onChange: n, placeholder: r, disabled: i, require
|
|
|
948
949
|
}
|
|
949
950
|
//#endregion
|
|
950
951
|
//#region src/base/form/fields/TextareaField.tsx
|
|
951
|
-
function
|
|
952
|
+
function tt({ id: e, value: t, onChange: n, placeholder: r, rows: i = 4, disabled: a, readOnly: o, required: s, error: l, helpTextId: u, errorId: d }) {
|
|
952
953
|
let f = [l ? d : void 0, u].filter(Boolean).join(" ") || void 0;
|
|
953
954
|
return /* @__PURE__ */ K(c, {
|
|
954
955
|
id: e,
|
|
@@ -982,17 +983,17 @@ function Z({ id: e, value: t, onChange: n, type: r = "text", placeholder: i, dis
|
|
|
982
983
|
}
|
|
983
984
|
//#endregion
|
|
984
985
|
//#region src/base/form/fields/field-registry.ts
|
|
985
|
-
var
|
|
986
|
-
function
|
|
987
|
-
return
|
|
986
|
+
var nt = /* @__PURE__ */ new Map();
|
|
987
|
+
function rt(e) {
|
|
988
|
+
return nt.get(e);
|
|
988
989
|
}
|
|
989
990
|
//#endregion
|
|
990
991
|
//#region src/base/form/FormField.tsx
|
|
991
|
-
var
|
|
992
|
+
var it = H(() => import("../../../chunks/subpath-CJyJeTlw.js").then((e) => ({ default: e.PhoneField }))), at = H(() => import("../../../chunks/subpath-DjkzcIPp.js").then((e) => ({ default: e.DateField }))), ot = H(() => import("../../../chunks/subpath-BYl-9lKg.js").then((e) => ({ default: e.DocumentField }))), st = H(() => import("../../../chunks/subpath-DoiyWIYV.js").then((e) => ({ default: e.DateRangeField })));
|
|
992
993
|
function Q() {
|
|
993
994
|
return /* @__PURE__ */ K(w, { className: "h-9 w-full rounded-md" });
|
|
994
995
|
}
|
|
995
|
-
function
|
|
996
|
+
function ct({ label: e }) {
|
|
996
997
|
return /* @__PURE__ */ K("div", {
|
|
997
998
|
className: "pt-4 pb-1",
|
|
998
999
|
children: /* @__PURE__ */ K("h4", {
|
|
@@ -1001,24 +1002,24 @@ function st({ label: e }) {
|
|
|
1001
1002
|
})
|
|
1002
1003
|
});
|
|
1003
1004
|
}
|
|
1004
|
-
function
|
|
1005
|
+
function lt({ id: e, value: t }) {
|
|
1005
1006
|
return /* @__PURE__ */ K("input", {
|
|
1006
1007
|
type: "hidden",
|
|
1007
1008
|
id: e,
|
|
1008
1009
|
value: String(t ?? "")
|
|
1009
1010
|
});
|
|
1010
1011
|
}
|
|
1011
|
-
function
|
|
1012
|
-
let { t: a } = R(), o =
|
|
1013
|
-
if (u === "header") return /* @__PURE__ */ K(
|
|
1014
|
-
if (u === "hidden") return /* @__PURE__ */ K(
|
|
1012
|
+
function ut({ field: e, value: t, onChange: n, error: r, sourceValues: i = {} }) {
|
|
1013
|
+
let { t: a } = R(), o = fe(), s = `field-${e.key}-${o}`, c = `${s}-help`, l = `${s}-error`, { component: u, props: d } = e;
|
|
1014
|
+
if (u === "header") return /* @__PURE__ */ K(ct, { label: d.label });
|
|
1015
|
+
if (u === "hidden") return /* @__PURE__ */ K(lt, {
|
|
1015
1016
|
id: s,
|
|
1016
1017
|
value: t
|
|
1017
1018
|
});
|
|
1018
|
-
let f =
|
|
1019
|
+
let f = we(e, i), p = Te(e, i), m = u === "checkbox" || u === "switch", h = dt(u, s, t, n, d, r, c, l, a, i, f, p);
|
|
1019
1020
|
return /* @__PURE__ */ q("div", {
|
|
1020
1021
|
className: "space-y-1.5",
|
|
1021
|
-
"data-testid":
|
|
1022
|
+
"data-testid": ae(e.key),
|
|
1022
1023
|
children: [
|
|
1023
1024
|
!m && /* @__PURE__ */ q(T, {
|
|
1024
1025
|
htmlFor: s,
|
|
@@ -1042,7 +1043,7 @@ function lt({ field: e, value: t, onChange: n, error: r, sourceValues: i = {} })
|
|
|
1042
1043
|
]
|
|
1043
1044
|
});
|
|
1044
1045
|
}
|
|
1045
|
-
function
|
|
1046
|
+
function dt(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
1046
1047
|
let f = {
|
|
1047
1048
|
id: t,
|
|
1048
1049
|
error: a,
|
|
@@ -1076,7 +1077,7 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1076
1077
|
placeholder: i.placeholder,
|
|
1077
1078
|
readOnly: i.readOnly
|
|
1078
1079
|
});
|
|
1079
|
-
case "textarea": return /* @__PURE__ */ K(
|
|
1080
|
+
case "textarea": return /* @__PURE__ */ K(tt, {
|
|
1080
1081
|
...f,
|
|
1081
1082
|
value: n,
|
|
1082
1083
|
onChange: r,
|
|
@@ -1084,13 +1085,13 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1084
1085
|
rows: i.rows,
|
|
1085
1086
|
readOnly: i.readOnly
|
|
1086
1087
|
});
|
|
1087
|
-
case "password": return /* @__PURE__ */ K(
|
|
1088
|
+
case "password": return /* @__PURE__ */ K(Ge, {
|
|
1088
1089
|
...f,
|
|
1089
1090
|
value: n,
|
|
1090
1091
|
onChange: r,
|
|
1091
1092
|
placeholder: i.placeholder
|
|
1092
1093
|
});
|
|
1093
|
-
case "otp": return /* @__PURE__ */ K(
|
|
1094
|
+
case "otp": return /* @__PURE__ */ K(We, {
|
|
1094
1095
|
...f,
|
|
1095
1096
|
value: n,
|
|
1096
1097
|
onChange: r,
|
|
@@ -1098,21 +1099,21 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1098
1099
|
pattern: i.pattern,
|
|
1099
1100
|
groupSize: i.groupSize
|
|
1100
1101
|
});
|
|
1101
|
-
case "select": return /* @__PURE__ */ K(
|
|
1102
|
+
case "select": return /* @__PURE__ */ K(Je, {
|
|
1102
1103
|
...f,
|
|
1103
1104
|
value: n,
|
|
1104
1105
|
onChange: r,
|
|
1105
1106
|
options: i.options ?? [],
|
|
1106
1107
|
placeholder: i.placeholder
|
|
1107
1108
|
});
|
|
1108
|
-
case "native_select": return /* @__PURE__ */ K(
|
|
1109
|
+
case "native_select": return /* @__PURE__ */ K(He, {
|
|
1109
1110
|
...f,
|
|
1110
1111
|
value: n,
|
|
1111
1112
|
onChange: r,
|
|
1112
1113
|
options: i.options ?? [],
|
|
1113
1114
|
placeholder: i.placeholder
|
|
1114
1115
|
});
|
|
1115
|
-
case "multiselect": return /* @__PURE__ */ K(
|
|
1116
|
+
case "multiselect": return /* @__PURE__ */ K(ze, {
|
|
1116
1117
|
...f,
|
|
1117
1118
|
value: n,
|
|
1118
1119
|
onChange: r,
|
|
@@ -1120,7 +1121,7 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1120
1121
|
placeholder: i.placeholder,
|
|
1121
1122
|
variant: i.variant
|
|
1122
1123
|
});
|
|
1123
|
-
case "radio": return /* @__PURE__ */ K(
|
|
1124
|
+
case "radio": return /* @__PURE__ */ K(Ke, {
|
|
1124
1125
|
...f,
|
|
1125
1126
|
value: n,
|
|
1126
1127
|
onChange: r,
|
|
@@ -1142,7 +1143,7 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1142
1143
|
max: i.max,
|
|
1143
1144
|
step: i.step ?? .1
|
|
1144
1145
|
});
|
|
1145
|
-
case "slider": return /* @__PURE__ */ K(
|
|
1146
|
+
case "slider": return /* @__PURE__ */ K(Ye, {
|
|
1146
1147
|
...f,
|
|
1147
1148
|
value: n,
|
|
1148
1149
|
onChange: r,
|
|
@@ -1151,13 +1152,13 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1151
1152
|
step: i.step,
|
|
1152
1153
|
multiple: i.multiple
|
|
1153
1154
|
});
|
|
1154
|
-
case "checkbox": return /* @__PURE__ */ K(
|
|
1155
|
+
case "checkbox": return /* @__PURE__ */ K(Oe, {
|
|
1155
1156
|
...f,
|
|
1156
1157
|
value: n,
|
|
1157
1158
|
onChange: r,
|
|
1158
1159
|
label: i.label
|
|
1159
1160
|
});
|
|
1160
|
-
case "switch": return /* @__PURE__ */ K(
|
|
1161
|
+
case "switch": return /* @__PURE__ */ K($e, {
|
|
1161
1162
|
...f,
|
|
1162
1163
|
value: n,
|
|
1163
1164
|
onChange: r,
|
|
@@ -1165,7 +1166,7 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1165
1166
|
});
|
|
1166
1167
|
case "date": return /* @__PURE__ */ K(V, {
|
|
1167
1168
|
fallback: /* @__PURE__ */ K(Q, {}),
|
|
1168
|
-
children: /* @__PURE__ */ K(
|
|
1169
|
+
children: /* @__PURE__ */ K(at, {
|
|
1169
1170
|
...f,
|
|
1170
1171
|
mode: "date",
|
|
1171
1172
|
value: n,
|
|
@@ -1175,7 +1176,7 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1175
1176
|
});
|
|
1176
1177
|
case "datetime": return /* @__PURE__ */ K(V, {
|
|
1177
1178
|
fallback: /* @__PURE__ */ K(Q, {}),
|
|
1178
|
-
children: /* @__PURE__ */ K(
|
|
1179
|
+
children: /* @__PURE__ */ K(at, {
|
|
1179
1180
|
...f,
|
|
1180
1181
|
mode: "datetime",
|
|
1181
1182
|
value: n,
|
|
@@ -1183,7 +1184,7 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1183
1184
|
placeholder: i.placeholder
|
|
1184
1185
|
})
|
|
1185
1186
|
});
|
|
1186
|
-
case "file": return /* @__PURE__ */ K(
|
|
1187
|
+
case "file": return /* @__PURE__ */ K(Le, {
|
|
1187
1188
|
...f,
|
|
1188
1189
|
value: n,
|
|
1189
1190
|
onChange: r,
|
|
@@ -1192,7 +1193,7 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1192
1193
|
maxFiles: i.maxFiles,
|
|
1193
1194
|
maxSize: i.maxSize
|
|
1194
1195
|
});
|
|
1195
|
-
case "entity_picker": return /* @__PURE__ */ K(
|
|
1196
|
+
case "entity_picker": return /* @__PURE__ */ K(Ne, {
|
|
1196
1197
|
...f,
|
|
1197
1198
|
value: n,
|
|
1198
1199
|
onChange: r,
|
|
@@ -1204,13 +1205,13 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1204
1205
|
entitySubtitleField: i.entitySubtitleField,
|
|
1205
1206
|
placeholder: i.placeholder
|
|
1206
1207
|
});
|
|
1207
|
-
case "static": return /* @__PURE__ */ K(
|
|
1208
|
+
case "static": return /* @__PURE__ */ K(Qe, {
|
|
1208
1209
|
id: t,
|
|
1209
1210
|
value: n
|
|
1210
1211
|
});
|
|
1211
1212
|
case "phone": return /* @__PURE__ */ K(V, {
|
|
1212
1213
|
fallback: /* @__PURE__ */ K(Q, {}),
|
|
1213
|
-
children: /* @__PURE__ */ K(
|
|
1214
|
+
children: /* @__PURE__ */ K(it, {
|
|
1214
1215
|
...f,
|
|
1215
1216
|
value: n,
|
|
1216
1217
|
onChange: r,
|
|
@@ -1221,7 +1222,7 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1221
1222
|
});
|
|
1222
1223
|
case "document": return /* @__PURE__ */ K(V, {
|
|
1223
1224
|
fallback: /* @__PURE__ */ K(Q, {}),
|
|
1224
|
-
children: /* @__PURE__ */ K(
|
|
1225
|
+
children: /* @__PURE__ */ K(ot, {
|
|
1225
1226
|
...f,
|
|
1226
1227
|
value: n,
|
|
1227
1228
|
onChange: r,
|
|
@@ -1231,7 +1232,7 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1231
1232
|
placeholder: i.placeholder
|
|
1232
1233
|
})
|
|
1233
1234
|
});
|
|
1234
|
-
case "currency": return /* @__PURE__ */ K(
|
|
1235
|
+
case "currency": return /* @__PURE__ */ K(je, {
|
|
1235
1236
|
...f,
|
|
1236
1237
|
value: n,
|
|
1237
1238
|
onChange: r,
|
|
@@ -1240,13 +1241,13 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1240
1241
|
min: i.min,
|
|
1241
1242
|
max: i.max
|
|
1242
1243
|
});
|
|
1243
|
-
case "color": return /* @__PURE__ */ K(
|
|
1244
|
+
case "color": return /* @__PURE__ */ K(ke, {
|
|
1244
1245
|
...f,
|
|
1245
1246
|
value: n,
|
|
1246
1247
|
onChange: r,
|
|
1247
1248
|
placeholder: i.placeholder
|
|
1248
1249
|
});
|
|
1249
|
-
case "slug": return /* @__PURE__ */ K(
|
|
1250
|
+
case "slug": return /* @__PURE__ */ K(Ze, {
|
|
1250
1251
|
...f,
|
|
1251
1252
|
value: n,
|
|
1252
1253
|
onChange: r,
|
|
@@ -1254,7 +1255,7 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1254
1255
|
prefix: i.prefix,
|
|
1255
1256
|
placeholder: i.placeholder
|
|
1256
1257
|
});
|
|
1257
|
-
case "tags": return /* @__PURE__ */ K(
|
|
1258
|
+
case "tags": return /* @__PURE__ */ K(et, {
|
|
1258
1259
|
...f,
|
|
1259
1260
|
value: n,
|
|
1260
1261
|
onChange: r,
|
|
@@ -1263,21 +1264,21 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1263
1264
|
});
|
|
1264
1265
|
case "date_range": return /* @__PURE__ */ K(V, {
|
|
1265
1266
|
fallback: /* @__PURE__ */ K(Q, {}),
|
|
1266
|
-
children: /* @__PURE__ */ K(
|
|
1267
|
+
children: /* @__PURE__ */ K(st, {
|
|
1267
1268
|
...f,
|
|
1268
1269
|
value: n,
|
|
1269
1270
|
onChange: r,
|
|
1270
1271
|
operator: i.operator
|
|
1271
1272
|
})
|
|
1272
1273
|
});
|
|
1273
|
-
case "rating": return /* @__PURE__ */ K(
|
|
1274
|
+
case "rating": return /* @__PURE__ */ K(qe, {
|
|
1274
1275
|
...f,
|
|
1275
1276
|
value: n,
|
|
1276
1277
|
onChange: r,
|
|
1277
1278
|
maxRating: i.maxRating
|
|
1278
1279
|
});
|
|
1279
1280
|
default: {
|
|
1280
|
-
let t =
|
|
1281
|
+
let t = rt(e);
|
|
1281
1282
|
return t ? /* @__PURE__ */ K(t, {
|
|
1282
1283
|
...f,
|
|
1283
1284
|
value: n,
|
|
@@ -1292,7 +1293,7 @@ function ut(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1292
1293
|
}
|
|
1293
1294
|
//#endregion
|
|
1294
1295
|
//#region src/base/shell/partials/InlineEditablePanel.tsx
|
|
1295
|
-
function
|
|
1296
|
+
function ft(e) {
|
|
1296
1297
|
switch (e.component) {
|
|
1297
1298
|
case "int":
|
|
1298
1299
|
case "float":
|
|
@@ -1306,15 +1307,15 @@ function dt(e) {
|
|
|
1306
1307
|
default: return "";
|
|
1307
1308
|
}
|
|
1308
1309
|
}
|
|
1309
|
-
function
|
|
1310
|
-
return Object.prototype.hasOwnProperty.call(t, e.key) ? t[e.key] :
|
|
1310
|
+
function pt(e, t) {
|
|
1311
|
+
return Object.prototype.hasOwnProperty.call(t, e.key) ? t[e.key] : ft(e);
|
|
1311
1312
|
}
|
|
1312
|
-
function $(t, n, r, i) {
|
|
1313
|
-
return t.map((t,
|
|
1313
|
+
function $(t, n, r, i, a) {
|
|
1314
|
+
return t.map((t, o) => {
|
|
1314
1315
|
switch (t.kind) {
|
|
1315
|
-
case "field": return
|
|
1316
|
+
case "field": return Ce(t, n) ? /* @__PURE__ */ K(ut, {
|
|
1316
1317
|
field: t,
|
|
1317
|
-
value:
|
|
1318
|
+
value: pt(t, n),
|
|
1318
1319
|
onChange: (e) => i(t.key, e),
|
|
1319
1320
|
error: r[t.key],
|
|
1320
1321
|
sourceValues: n
|
|
@@ -1322,24 +1323,27 @@ function $(t, n, r, i) {
|
|
|
1322
1323
|
case "header": return /* @__PURE__ */ K("h4", {
|
|
1323
1324
|
className: "text-foreground pt-2 text-sm font-semibold",
|
|
1324
1325
|
children: t.label
|
|
1325
|
-
}, `header-${
|
|
1326
|
-
case "section":
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
className: "
|
|
1330
|
-
children:
|
|
1331
|
-
|
|
1332
|
-
|
|
1326
|
+
}, `header-${o}`);
|
|
1327
|
+
case "section": {
|
|
1328
|
+
let e = ie(t.label, a);
|
|
1329
|
+
return /* @__PURE__ */ q("section", {
|
|
1330
|
+
className: "space-y-3",
|
|
1331
|
+
children: [e && /* @__PURE__ */ K("div", {
|
|
1332
|
+
className: "text-muted-foreground text-[11px] font-medium tracking-[0.04em] uppercase",
|
|
1333
|
+
children: e
|
|
1334
|
+
}), $(t.children, n, r, i, a)]
|
|
1335
|
+
}, t.id);
|
|
1336
|
+
}
|
|
1333
1337
|
case "group": return /* @__PURE__ */ K("div", {
|
|
1334
1338
|
className: e(t.columns === 2 ? "grid grid-cols-2 gap-3" : "space-y-3"),
|
|
1335
|
-
children: $(t.children, n, r, i)
|
|
1339
|
+
children: $(t.children, n, r, i, a)
|
|
1336
1340
|
}, t.id);
|
|
1337
1341
|
default: return null;
|
|
1338
1342
|
}
|
|
1339
1343
|
});
|
|
1340
1344
|
}
|
|
1341
|
-
function
|
|
1342
|
-
let { t: e } = R(), { enabled: n, selectedId: r, descriptor: i, loading: a, saving: o, submit: s, close: c, width: l } =
|
|
1345
|
+
function mt() {
|
|
1346
|
+
let { t: e } = R(), { enabled: n, selectedId: r, descriptor: i, loading: a, saving: o, submit: s, close: c, width: l } = oe(), [u, d] = G(() => i?.values ? { ...i.values } : {}), [f, p] = G({}), [m, h] = G(i);
|
|
1343
1347
|
i !== m && (h(i), d(i?.values ? { ...i.values } : {}), p({}));
|
|
1344
1348
|
let [g, _] = G(null), v = g ?? l, y = W(() => (e, t) => {
|
|
1345
1349
|
d((n) => ({
|
|
@@ -1351,7 +1355,7 @@ function pt() {
|
|
|
1351
1355
|
return delete n[e], n;
|
|
1352
1356
|
});
|
|
1353
1357
|
}, []);
|
|
1354
|
-
return !n || r === null ? null : /* @__PURE__ */ q(
|
|
1358
|
+
return !n || r === null ? null : /* @__PURE__ */ q(me, { children: [/* @__PURE__ */ K("div", {
|
|
1355
1359
|
className: "fixed inset-0 z-40 bg-black/40",
|
|
1356
1360
|
onClick: c,
|
|
1357
1361
|
"aria-hidden": !0
|
|
@@ -1404,7 +1408,7 @@ function pt() {
|
|
|
1404
1408
|
children: /* @__PURE__ */ K("div", { className: "border-primary h-6 w-6 animate-spin rounded-full border-2 border-t-transparent" })
|
|
1405
1409
|
}) : /* @__PURE__ */ K("div", {
|
|
1406
1410
|
className: "space-y-3.5",
|
|
1407
|
-
children: $(i.schema, u, f, y)
|
|
1411
|
+
children: $(i.schema, u, f, y, e)
|
|
1408
1412
|
})
|
|
1409
1413
|
}),
|
|
1410
1414
|
i && !a && /* @__PURE__ */ q("div", {
|
|
@@ -1421,7 +1425,7 @@ function pt() {
|
|
|
1421
1425
|
size: "sm",
|
|
1422
1426
|
onClick: () => {
|
|
1423
1427
|
if (!i) return;
|
|
1424
|
-
let t =
|
|
1428
|
+
let t = De(i.schema, u, e).safeParse(u);
|
|
1425
1429
|
if (!t.success) {
|
|
1426
1430
|
let e = {};
|
|
1427
1431
|
for (let n of t.error.issues) {
|
|
@@ -1441,4 +1445,4 @@ function pt() {
|
|
|
1441
1445
|
})] });
|
|
1442
1446
|
}
|
|
1443
1447
|
//#endregion
|
|
1444
|
-
export {
|
|
1448
|
+
export { mt as InlineEditablePanel };
|