@middag-io/react 0.42.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.
- package/dist-lib/{DateField-x0Ot_z_i.js → DateField-lPZsiWfC.js} +5 -5
- package/dist-lib/{DateRangeField-DbWZ2f92.js → DateRangeField-B7zWB48D.js} +12 -8
- package/dist-lib/{DocumentField-fwq79IWM.js → DocumentField-DutGscEM.js} +3 -3
- package/dist-lib/{FormField-BDWkyFcl.js → FormField-Bj43PjHH.js} +3755 -2628
- package/dist-lib/{FormPanelBlock-mIvZ0IFE.js → FormPanelBlock-C6eDfGoI.js} +463 -462
- package/dist-lib/{PhoneField-DZQc97Eo.js → PhoneField-CP13cgq1.js} +2867 -2870
- package/dist-lib/base/blocks/FormPanelBlock.d.ts.map +1 -1
- package/dist-lib/base/form/FormField.d.ts.map +1 -1
- package/dist-lib/base/form/fields/EntityPickerField.d.ts.map +1 -1
- package/dist-lib/base/layout/BlockRegion.d.ts.map +1 -1
- package/dist-lib/base/layout/DashboardLayout.d.ts.map +1 -1
- package/dist-lib/base/partials/ActionBar/index.d.ts.map +1 -1
- package/dist-lib/base/partials/ConfirmationDialog/index.d.ts.map +1 -1
- package/dist-lib/base/partials/DataTable/index.d.ts.map +1 -1
- package/dist-lib/base/shell/BasicShell.js +1 -1
- package/dist-lib/base/shell/partials/EditablePanelProvider.d.ts.map +1 -1
- package/dist-lib/base/shell/partials/EditablePanelProvider.js +55 -54
- package/dist-lib/base/shell/partials/InlineEditablePanel.js +144 -140
- package/dist-lib/base/shell/partials/PageActionButton.d.ts.map +1 -1
- package/dist-lib/base/shell/partials/PageActionButton.js +2 -1
- package/dist-lib/base/utils/time.js +26 -26
- package/dist-lib/{button-CxyXN3nw.js → button-PJdZDEA8.js} +4 -4
- package/dist-lib/{calendar-BStHDcu3.js → calendar-CFrEYtPR.js} +22 -21
- package/dist-lib/{chevron-right-t5ALKicc.js → chevron-right-Dt7yZRj6.js} +1 -1
- package/dist-lib/chunks/{subpath-BhcZoWUz.js → subpath-BYl-9lKg.js} +1 -1
- package/dist-lib/chunks/subpath-D0ykpYEG.js +154 -0
- package/dist-lib/{combobox-RfE54yDL.js → combobox-Dk1Mr_PH.js} +1055 -1058
- package/dist-lib/{dist-tanBwm1t.js → dist-CJ4YN5HQ.js} +5 -5
- package/dist-lib/{dist-BUns-jcX.js → dist-Cwj39GRS.js} +1 -1
- package/dist-lib/{dist-axU0pUop.js → dist-CyQnd0TP.js} +4 -4
- package/dist-lib/{dist-EdxoDTPy.js → dist-DUhG8dAI.js} +2 -2
- package/dist-lib/{document-validation-BSjTDZhG.js → document-validation-D1y_WEv5.js} +4 -4
- package/dist-lib/{floating-ui.react-dom-CNntavPo.js → floating-ui.react-dom-BASAHo_L.js} +3 -3
- package/dist-lib/i18n/I18nProvider.js +1 -1
- package/dist-lib/i18n/instance.js +1 -1
- package/dist-lib/i18n/register-strings.js +1 -1
- package/dist-lib/index.d.ts +1 -0
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/{input-DpHIBsEp.js → input-D1w5GXsE.js} +1 -1
- package/dist-lib/lib/host-pending.d.ts +32 -0
- package/dist-lib/lib/host-pending.d.ts.map +1 -0
- package/dist-lib/lib/host-pending.js +35 -0
- package/dist-lib/lib/test-ids.d.ts +25 -0
- package/dist-lib/lib/test-ids.d.ts.map +1 -0
- package/dist-lib/lib/test-ids.js +25 -0
- package/dist-lib/middag-react.css +1 -1
- package/dist-lib/middag-react.js +22154 -8666
- package/dist-lib/{popover-CD3HfW3f.js → popover-7VNShhWQ.js} +6 -6
- package/dist-lib/primitives/reui/chart.js +12 -12
- package/dist-lib/primitives/reui/data-grid/data-grid-column-header.js +2 -2
- package/dist-lib/primitives/reui/data-grid/data-grid-pagination.js +28 -28
- package/dist-lib/primitives/reui/data-grid/data-grid-scroll-area.js +2 -2
- package/dist-lib/primitives/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
- package/dist-lib/primitives/reui/data-grid/data-grid-table-dnd.js +2 -2
- package/dist-lib/primitives/reui/data-grid/data-grid-table-virtual.js +1 -1
- package/dist-lib/primitives/reui/data-grid/data-grid-table.js +5 -5
- package/dist-lib/primitives/reui/data-grid-pagination.js +28 -28
- package/dist-lib/primitives/reui/date-selector.js +5 -1
- package/dist-lib/primitives/reui/filters.js +24 -24
- package/dist-lib/primitives/reui/scrollspy.js +3 -1
- package/dist-lib/primitives/reui/stepper.js +23 -23
- package/dist-lib/primitives/reui/tree.js +7 -7
- package/dist-lib/{chunk-DeC0fbbY.js → rolldown-runtime-CWhphoD1.js} +1 -1
- package/dist-lib/{scroll-area-C_NPU_rI.js → scroll-area-CcAvV3Hh.js} +14 -8
- package/dist-lib/{skeleton-DXDJbb2L.js → skeleton-DP7igcN6.js} +1 -1
- package/dist-lib/{use-mobile-B18-3oTE.js → use-mobile-CqtqNcAV.js} +5 -5
- package/dist-lib/{utils-CpaZ5_iF.js → utils-DXlQmFY8.js} +2 -2
- package/package.json +4 -1
- package/dist-lib/MarkdownContent-DgypTiL-.js +0 -13507
- package/dist-lib/chunks/subpath-52vC0Fzu.js +0 -146
- /package/dist-lib/{HugeiconsIcon-CKqc2W1S.js → HugeiconsIcon-C9KGSkIu.js} +0 -0
- /package/dist-lib/chunks/{subpath-B9beWkb2.js → subpath-AeMdleNB.js} +0 -0
- /package/dist-lib/chunks/{subpath-55YUOrvG.js → subpath-CJyJeTlw.js} +0 -0
- /package/dist-lib/chunks/{subpath--GXsYu-v.js → subpath-DjkzcIPp.js} +0 -0
- /package/dist-lib/chunks/{subpath-B30yU5uo.js → subpath-DoiyWIYV.js} +0 -0
- /package/dist-lib/chunks/{subpath-7b9-j7in.js → subpath-YbXSVoyF.js} +0 -0
- /package/dist-lib/{dist-3F0-lo64.js → dist-BxFR7CYi.js} +0 -0
- /package/dist-lib/{useTranslation-D-tjJhTn.js → useTranslation-u1Lygbup.js} +0 -0
|
@@ -19,39 +19,41 @@ import { RadioGroup as L, RadioGroupItem as te } from "../../../primitives/reui/
|
|
|
19
19
|
import { Rating as ne } from "../../../primitives/reui/rating.js";
|
|
20
20
|
import { Slider as re } from "../../../primitives/reui/slider.js";
|
|
21
21
|
import { useTranslation as R } from "../../../i18n/useTranslation.js";
|
|
22
|
-
import {
|
|
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";
|
|
23
25
|
import { evaluateCondition as z } from "../../utils/conditions.js";
|
|
24
|
-
import { formatBytes as B, useFileUpload as
|
|
25
|
-
import { Fragment as
|
|
26
|
-
import { Fragment as
|
|
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";
|
|
27
29
|
import { HugeiconsIcon as J } from "@hugeicons/react";
|
|
28
|
-
import { Cancel01Icon as
|
|
29
|
-
import { REGEXP_ONLY_DIGITS as
|
|
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";
|
|
30
32
|
import { z as Y } from "zod";
|
|
31
33
|
//#region src/base/form/form-utils.ts
|
|
32
|
-
function
|
|
34
|
+
function xe(e) {
|
|
33
35
|
let t = [];
|
|
34
|
-
for (let n of e) n.kind === "field" ? t.push(n) : (n.kind === "section" || n.kind === "group") && t.push(...
|
|
36
|
+
for (let n of e) n.kind === "field" ? t.push(n) : (n.kind === "section" || n.kind === "group") && t.push(...xe(n.children));
|
|
35
37
|
return t;
|
|
36
38
|
}
|
|
37
|
-
function
|
|
39
|
+
function Se(e, t) {
|
|
38
40
|
if (e.component === "header") return !0;
|
|
39
41
|
let { props: n } = e;
|
|
40
42
|
return !(n.hidden_when && z(n.hidden_when, t) || n.visible_when && !z(n.visible_when, t));
|
|
41
43
|
}
|
|
42
|
-
function
|
|
44
|
+
function Ce(e, t) {
|
|
43
45
|
if (e.component === "header") return !1;
|
|
44
46
|
let { props: n } = e;
|
|
45
47
|
return !!(n.disabled || n.disabled_when && z(n.disabled_when, t));
|
|
46
48
|
}
|
|
47
|
-
function
|
|
48
|
-
if (e.component === "header" ||
|
|
49
|
+
function we(e, t) {
|
|
50
|
+
if (e.component === "header" || Ce(e, t)) return !1;
|
|
49
51
|
let { props: n } = e;
|
|
50
52
|
return !!(n.required || n.required_when && z(n.required_when, t));
|
|
51
53
|
}
|
|
52
54
|
//#endregion
|
|
53
55
|
//#region src/base/form/form-schema-builder.ts
|
|
54
|
-
function
|
|
56
|
+
function Te(e, t, n) {
|
|
55
57
|
let { component: r, props: i } = e, a = i.validation, o = n;
|
|
56
58
|
switch (r) {
|
|
57
59
|
case "text":
|
|
@@ -110,7 +112,7 @@ function Se(e, t, n) {
|
|
|
110
112
|
}
|
|
111
113
|
case "document": {
|
|
112
114
|
let e = i.documentType ?? "generic", n = i.documentScope ?? "any", r = Y.string(), a = async (t) => {
|
|
113
|
-
let { isValidDocument: r } = await import("../../../chunks/subpath-
|
|
115
|
+
let { isValidDocument: r } = await import("../../../chunks/subpath-YbXSVoyF.js");
|
|
114
116
|
return r(t, e, n);
|
|
115
117
|
};
|
|
116
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,14 +120,14 @@ function Se(e, t, n) {
|
|
|
118
120
|
default: return Y.any();
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
|
-
function
|
|
122
|
-
let r =
|
|
123
|
-
for (let e of r) e.component === "header" || e.component === "hidden" || e.component === "static" ||
|
|
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)));
|
|
124
126
|
return Y.object(i);
|
|
125
127
|
}
|
|
126
128
|
//#endregion
|
|
127
129
|
//#region src/base/form/fields/CheckboxField.tsx
|
|
128
|
-
function
|
|
130
|
+
function De({ id: e, value: t, onChange: n, label: r, disabled: i, required: a, error: s, helpTextId: c, errorId: l }) {
|
|
129
131
|
let u = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
|
|
130
132
|
return /* @__PURE__ */ q("div", {
|
|
131
133
|
className: "flex items-center gap-2",
|
|
@@ -146,7 +148,7 @@ function we({ id: e, value: t, onChange: n, label: r, disabled: i, required: a,
|
|
|
146
148
|
}
|
|
147
149
|
//#endregion
|
|
148
150
|
//#region src/base/form/fields/ColorField.tsx
|
|
149
|
-
function
|
|
151
|
+
function Oe({ id: e, value: t, onChange: n, placeholder: r, disabled: i, required: a, error: o, helpTextId: c, errorId: l }) {
|
|
150
152
|
let u = [o ? l : void 0, c].filter(Boolean).join(" ") || void 0, d = U((e) => {
|
|
151
153
|
n(e.target.value);
|
|
152
154
|
}, [n]), f = U((e) => {
|
|
@@ -178,7 +180,7 @@ function Te({ id: e, value: t, onChange: n, placeholder: r, disabled: i, require
|
|
|
178
180
|
}
|
|
179
181
|
//#endregion
|
|
180
182
|
//#region src/base/form/fields/CurrencyField.tsx
|
|
181
|
-
var
|
|
183
|
+
var ke = {
|
|
182
184
|
BRL: "R$",
|
|
183
185
|
USD: "$",
|
|
184
186
|
EUR: "€",
|
|
@@ -193,8 +195,8 @@ var Ee = {
|
|
|
193
195
|
COP: "$",
|
|
194
196
|
PEN: "S/"
|
|
195
197
|
};
|
|
196
|
-
function
|
|
197
|
-
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 =
|
|
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(() => {
|
|
198
200
|
y(!0), x(t == null ? "" : String(t));
|
|
199
201
|
}, [t]), E = U(() => {
|
|
200
202
|
y(!1);
|
|
@@ -230,35 +232,38 @@ function De({ id: e, value: t, onChange: n, currency: r = "BRL", placeholder: i,
|
|
|
230
232
|
}
|
|
231
233
|
//#endregion
|
|
232
234
|
//#region src/base/form/fields/EntityPickerField.tsx
|
|
233
|
-
function
|
|
235
|
+
function je(e) {
|
|
234
236
|
return e.split(/\s+/).slice(0, 2).map((e) => e[0]?.toUpperCase() ?? "").join("");
|
|
235
237
|
}
|
|
236
|
-
function
|
|
237
|
-
let { t: w } = R(), [T, E] = G(s && t && s.value === t ? s.label : ""), [D, O] = G([]), [k, A] = G(!1), j =
|
|
238
|
-
|
|
239
|
-
if (M) return
|
|
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), () => {
|
|
240
243
|
j.current && clearTimeout(j.current);
|
|
241
|
-
}
|
|
244
|
+
};
|
|
245
|
+
let e = oe();
|
|
246
|
+
return j.current = setTimeout(async () => {
|
|
242
247
|
A(!0);
|
|
243
248
|
try {
|
|
244
249
|
let e = new URL(c, window.location.origin);
|
|
245
250
|
e.searchParams.set("q", T);
|
|
246
|
-
let t = await
|
|
251
|
+
let t = await se(e.toString());
|
|
247
252
|
if (t.ok) {
|
|
248
|
-
let e = await t.json()
|
|
249
|
-
O((e.items ?? e.data ?? e).map((e) => ({
|
|
253
|
+
let e = await t.json(), n = (e.items ?? e.data ?? e).map((e) => ({
|
|
250
254
|
value: String(e.value ?? e.id),
|
|
251
255
|
label: String(e.label ?? e.name ?? e.title ?? ""),
|
|
252
256
|
subtitle: d ? String(e[d] ?? "") : void 0,
|
|
253
257
|
avatarUrl: u ? String(e[u] ?? "") : void 0
|
|
254
|
-
}))
|
|
258
|
+
}));
|
|
259
|
+
O(n);
|
|
255
260
|
}
|
|
256
261
|
} catch {} finally {
|
|
257
|
-
A(!1);
|
|
262
|
+
A(!1), e();
|
|
258
263
|
}
|
|
259
264
|
}, 300), () => {
|
|
260
|
-
j.current && clearTimeout(j.current);
|
|
261
|
-
}
|
|
265
|
+
j.current && clearTimeout(j.current), e();
|
|
266
|
+
};
|
|
262
267
|
}, [
|
|
263
268
|
T,
|
|
264
269
|
M,
|
|
@@ -310,7 +315,7 @@ function ke({ id: e, value: t, onChange: a, options: o, initialOption: s, autoco
|
|
|
310
315
|
alt: e.label
|
|
311
316
|
}), /* @__PURE__ */ K(r, {
|
|
312
317
|
className: "text-[10px]",
|
|
313
|
-
children:
|
|
318
|
+
children: je(e.label)
|
|
314
319
|
})]
|
|
315
320
|
}), /* @__PURE__ */ q("div", {
|
|
316
321
|
className: "min-w-0 flex-1",
|
|
@@ -327,21 +332,21 @@ function ke({ id: e, value: t, onChange: a, options: o, initialOption: s, autoco
|
|
|
327
332
|
}
|
|
328
333
|
//#endregion
|
|
329
334
|
//#region src/base/form/fields/FileUploadField.tsx
|
|
330
|
-
function
|
|
335
|
+
function Ne(e) {
|
|
331
336
|
let t = e.split(/[?#]/)[0], n = t.split("/");
|
|
332
337
|
return n[n.length - 1] || t;
|
|
333
338
|
}
|
|
334
|
-
function
|
|
339
|
+
function Pe(e) {
|
|
335
340
|
if (e == null || e === "") return null;
|
|
336
341
|
if (typeof e == "string") return {
|
|
337
|
-
name:
|
|
342
|
+
name: Ne(e),
|
|
338
343
|
size: 0,
|
|
339
344
|
type: "",
|
|
340
345
|
url: e,
|
|
341
346
|
id: e
|
|
342
347
|
};
|
|
343
348
|
if (typeof e == "object" && !(e instanceof File)) {
|
|
344
|
-
let t = e, n = typeof t.url == "string" ? t.url : "", r = typeof t.name == "string" ? t.name : n ?
|
|
349
|
+
let t = e, n = typeof t.url == "string" ? t.url : "", r = typeof t.name == "string" ? t.name : n ? Ne(n) : "";
|
|
345
350
|
return !n && !r ? null : {
|
|
346
351
|
name: r,
|
|
347
352
|
size: typeof t.size == "number" ? t.size : 0,
|
|
@@ -352,11 +357,11 @@ function je(e) {
|
|
|
352
357
|
}
|
|
353
358
|
return null;
|
|
354
359
|
}
|
|
355
|
-
function
|
|
356
|
-
return (Array.isArray(e) ? e : [e]).map(
|
|
360
|
+
function Fe(e) {
|
|
361
|
+
return (Array.isArray(e) ? e : [e]).map(Pe).filter((e) => e !== null);
|
|
357
362
|
}
|
|
358
|
-
function
|
|
359
|
-
let { t: m } = R(), [h] = G(() =>
|
|
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({
|
|
360
365
|
maxFiles: o ? s : 1,
|
|
361
366
|
maxSize: c,
|
|
362
367
|
accept: a,
|
|
@@ -385,7 +390,7 @@ function Ne({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
|
|
|
385
390
|
className: "flex flex-col items-center gap-2 py-4",
|
|
386
391
|
children: [
|
|
387
392
|
/* @__PURE__ */ K(J, {
|
|
388
|
-
icon:
|
|
393
|
+
icon: ge,
|
|
389
394
|
className: e("size-8", _ ? "text-primary" : "text-muted-foreground")
|
|
390
395
|
}),
|
|
391
396
|
/* @__PURE__ */ K("p", {
|
|
@@ -421,7 +426,7 @@ function Ne({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
|
|
|
421
426
|
}) : /* @__PURE__ */ K("div", {
|
|
422
427
|
className: "bg-muted flex size-10 shrink-0 items-center justify-center rounded border",
|
|
423
428
|
children: /* @__PURE__ */ K(J, {
|
|
424
|
-
icon:
|
|
429
|
+
icon: he,
|
|
425
430
|
className: "text-muted-foreground size-5"
|
|
426
431
|
})
|
|
427
432
|
}),
|
|
@@ -442,7 +447,7 @@ function Ne({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
|
|
|
442
447
|
onClick: () => y(e.id),
|
|
443
448
|
disabled: l,
|
|
444
449
|
children: /* @__PURE__ */ K(J, {
|
|
445
|
-
icon:
|
|
450
|
+
icon: me,
|
|
446
451
|
className: "size-3.5"
|
|
447
452
|
})
|
|
448
453
|
})
|
|
@@ -466,10 +471,10 @@ function Ne({ id: n, value: r, onChange: i, accept: a = "*", multiple: o = !1, m
|
|
|
466
471
|
}
|
|
467
472
|
//#endregion
|
|
468
473
|
//#region src/base/form/fields/MultiSelectField.tsx
|
|
469
|
-
var
|
|
470
|
-
function
|
|
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" }) {
|
|
471
476
|
let { t: d } = R(), f = t ?? [], p = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
|
|
472
|
-
return u === "checkbox" || u === "auto" && r.length <=
|
|
477
|
+
return u === "checkbox" || u === "auto" && r.length <= Le ? /* @__PURE__ */ K(ze, {
|
|
473
478
|
id: e,
|
|
474
479
|
options: r,
|
|
475
480
|
selected: f,
|
|
@@ -479,7 +484,7 @@ function Fe({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled
|
|
|
479
484
|
error: s,
|
|
480
485
|
describedBy: p,
|
|
481
486
|
t: d
|
|
482
|
-
}) : /* @__PURE__ */ K(
|
|
487
|
+
}) : /* @__PURE__ */ K(Be, {
|
|
483
488
|
id: e,
|
|
484
489
|
options: r,
|
|
485
490
|
selected: f,
|
|
@@ -492,7 +497,7 @@ function Fe({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled
|
|
|
492
497
|
t: d
|
|
493
498
|
});
|
|
494
499
|
}
|
|
495
|
-
function
|
|
500
|
+
function ze({ id: e, options: t, selected: n, onChange: r, disabled: i, required: a, error: s, describedBy: c, t: l }) {
|
|
496
501
|
let u = (e) => {
|
|
497
502
|
n.includes(e) ? r(n.filter((t) => t !== e)) : r([...n, e]);
|
|
498
503
|
};
|
|
@@ -521,7 +526,7 @@ function Ie({ id: e, options: t, selected: n, onChange: r, disabled: i, required
|
|
|
521
526
|
})]
|
|
522
527
|
});
|
|
523
528
|
}
|
|
524
|
-
function
|
|
529
|
+
function Be({ id: e, options: t, selected: n, onChange: r, placeholder: i, disabled: s, required: c, error: l, describedBy: u, t: d }) {
|
|
525
530
|
let [f, y] = G(""), b = W(() => {
|
|
526
531
|
if (!f) return t;
|
|
527
532
|
let e = f.toLowerCase();
|
|
@@ -604,7 +609,7 @@ function Le({ id: e, options: t, selected: n, onChange: r, placeholder: i, disab
|
|
|
604
609
|
}
|
|
605
610
|
//#endregion
|
|
606
611
|
//#region src/base/form/fields/NativeSelectField.tsx
|
|
607
|
-
function
|
|
612
|
+
function Ve({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: l }) {
|
|
608
613
|
let { t: u } = R(), d = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
|
|
609
614
|
return /* @__PURE__ */ K("div", {
|
|
610
615
|
className: "w-full [&>div]:w-full",
|
|
@@ -652,14 +657,14 @@ function X({ id: e, value: t, onChange: n, min: r, max: i, step: a = 1, disabled
|
|
|
652
657
|
}
|
|
653
658
|
//#endregion
|
|
654
659
|
//#region src/base/form/fields/OtpField.tsx
|
|
655
|
-
function
|
|
660
|
+
function He(e, t) {
|
|
656
661
|
if (!t || t >= e) return [Array.from({ length: e }, (e, t) => t)];
|
|
657
662
|
let n = [];
|
|
658
663
|
for (let r = 0; r < e; r += t) n.push(Array.from({ length: Math.min(t, e - r) }, (e, t) => r + t));
|
|
659
664
|
return n;
|
|
660
665
|
}
|
|
661
|
-
function
|
|
662
|
-
let d = [c ? u : void 0, l].filter(Boolean).join(" ") || void 0, f = i === "alphanumeric" ?
|
|
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);
|
|
663
668
|
return /* @__PURE__ */ K(D, {
|
|
664
669
|
id: e,
|
|
665
670
|
maxLength: r,
|
|
@@ -670,7 +675,7 @@ function Be({ id: e, value: t, onChange: n, maxLength: r = 6, pattern: i = "digi
|
|
|
670
675
|
"aria-invalid": c ? !0 : void 0,
|
|
671
676
|
"aria-required": s || void 0,
|
|
672
677
|
"aria-describedby": d,
|
|
673
|
-
children: p.map((e, t) => /* @__PURE__ */ q(
|
|
678
|
+
children: p.map((e, t) => /* @__PURE__ */ q(le, { children: [/* @__PURE__ */ K(O, { children: e.map((e) => /* @__PURE__ */ K(A, {
|
|
674
679
|
index: e,
|
|
675
680
|
"aria-invalid": c ? !0 : void 0
|
|
676
681
|
}, e)) }), t < p.length - 1 && /* @__PURE__ */ K(k, {})] }, e[0]))
|
|
@@ -678,7 +683,7 @@ function Be({ id: e, value: t, onChange: n, maxLength: r = 6, pattern: i = "digi
|
|
|
678
683
|
}
|
|
679
684
|
//#endregion
|
|
680
685
|
//#region src/base/form/fields/PasswordField.tsx
|
|
681
|
-
function
|
|
686
|
+
function We({ id: e, value: n, onChange: r, placeholder: i, disabled: a, required: o, error: c, helpTextId: l, errorId: u }) {
|
|
682
687
|
let [d, f] = G(!1), p = [c ? u : void 0, l].filter(Boolean).join(" ") || void 0;
|
|
683
688
|
return /* @__PURE__ */ q("div", {
|
|
684
689
|
className: "relative",
|
|
@@ -702,7 +707,7 @@ function Ve({ id: e, value: n, onChange: r, placeholder: i, disabled: a, require
|
|
|
702
707
|
tabIndex: -1,
|
|
703
708
|
"aria-label": d ? "Hide password" : "Show password",
|
|
704
709
|
children: /* @__PURE__ */ K(J, {
|
|
705
|
-
icon: d ?
|
|
710
|
+
icon: d ? ve : _e,
|
|
706
711
|
size: 16,
|
|
707
712
|
strokeWidth: 2
|
|
708
713
|
})
|
|
@@ -711,7 +716,7 @@ function Ve({ id: e, value: n, onChange: r, placeholder: i, disabled: a, require
|
|
|
711
716
|
}
|
|
712
717
|
//#endregion
|
|
713
718
|
//#region src/base/form/fields/RadioField.tsx
|
|
714
|
-
function
|
|
719
|
+
function Ge({ id: e, value: t, onChange: n, options: r, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
|
|
715
720
|
let l = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0;
|
|
716
721
|
return /* @__PURE__ */ K(L, {
|
|
717
722
|
id: e,
|
|
@@ -739,7 +744,7 @@ function He({ id: e, value: t, onChange: n, options: r, disabled: i, required: a
|
|
|
739
744
|
}
|
|
740
745
|
//#endregion
|
|
741
746
|
//#region src/base/form/fields/RatingField.tsx
|
|
742
|
-
function
|
|
747
|
+
function Ke({ id: e, value: t, onChange: n, maxRating: r = 5, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
|
|
743
748
|
let l = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0;
|
|
744
749
|
return /* @__PURE__ */ K("div", {
|
|
745
750
|
id: e,
|
|
@@ -758,7 +763,7 @@ function Ue({ id: e, value: t, onChange: n, maxRating: r = 5, disabled: i, requi
|
|
|
758
763
|
}
|
|
759
764
|
//#endregion
|
|
760
765
|
//#region src/base/form/fields/SelectField.tsx
|
|
761
|
-
function
|
|
766
|
+
function qe({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled: a, required: o, error: s, helpTextId: c, errorId: l }) {
|
|
762
767
|
let { t: u } = R(), d = [s ? l : void 0, c].filter(Boolean).join(" ") || void 0;
|
|
763
768
|
return /* @__PURE__ */ q(y, {
|
|
764
769
|
value: t ?? "",
|
|
@@ -786,7 +791,7 @@ function We({ id: e, value: t, onChange: n, options: r, placeholder: i, disabled
|
|
|
786
791
|
}
|
|
787
792
|
//#endregion
|
|
788
793
|
//#region src/base/form/fields/SliderField.tsx
|
|
789
|
-
function
|
|
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 }) {
|
|
790
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);
|
|
791
796
|
return /* @__PURE__ */ q("div", {
|
|
792
797
|
className: "flex items-center gap-4",
|
|
@@ -810,14 +815,14 @@ function Ge({ id: e, value: t, onChange: n, min: r = 0, max: i = 100, step: a =
|
|
|
810
815
|
}
|
|
811
816
|
//#endregion
|
|
812
817
|
//#region src/base/form/fields/SlugField.tsx
|
|
813
|
-
function
|
|
818
|
+
function Ye(e) {
|
|
814
819
|
return e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
|
|
815
820
|
}
|
|
816
|
-
function
|
|
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 }) {
|
|
817
822
|
let [h, g] = G(!1), _ = [s ? p : void 0, c].filter(Boolean).join(" ") || void 0;
|
|
818
|
-
|
|
823
|
+
ue(() => {
|
|
819
824
|
if (!h && r !== void 0) {
|
|
820
|
-
let e =
|
|
825
|
+
let e = Ye(r);
|
|
821
826
|
e !== t && n(e);
|
|
822
827
|
}
|
|
823
828
|
}, [
|
|
@@ -827,7 +832,7 @@ function qe({ id: e, value: t, onChange: n, sourceValue: r, placeholder: i, disa
|
|
|
827
832
|
t
|
|
828
833
|
]);
|
|
829
834
|
let v = U((e) => {
|
|
830
|
-
g(!0), n(
|
|
835
|
+
g(!0), n(Ye(e.target.value));
|
|
831
836
|
}, [n]);
|
|
832
837
|
return m ? /* @__PURE__ */ q(l, {
|
|
833
838
|
"data-disabled": a || void 0,
|
|
@@ -862,7 +867,7 @@ function qe({ id: e, value: t, onChange: n, sourceValue: r, placeholder: i, disa
|
|
|
862
867
|
}
|
|
863
868
|
//#endregion
|
|
864
869
|
//#region src/base/form/fields/StaticField.tsx
|
|
865
|
-
function
|
|
870
|
+
function Ze({ id: e, value: t }) {
|
|
866
871
|
return /* @__PURE__ */ K("p", {
|
|
867
872
|
id: e,
|
|
868
873
|
className: "border-input bg-muted/50 text-foreground rounded-md border px-3 py-2 text-sm",
|
|
@@ -871,7 +876,7 @@ function Je({ id: e, value: t }) {
|
|
|
871
876
|
}
|
|
872
877
|
//#endregion
|
|
873
878
|
//#region src/base/form/fields/SwitchField.tsx
|
|
874
|
-
function
|
|
879
|
+
function Qe({ id: e, value: t, onChange: n, label: r, disabled: i, required: a, error: o, helpTextId: s, errorId: c }) {
|
|
875
880
|
let l = [o ? c : void 0, s].filter(Boolean).join(" ") || void 0;
|
|
876
881
|
return /* @__PURE__ */ q("div", {
|
|
877
882
|
className: "flex items-center gap-2",
|
|
@@ -892,8 +897,8 @@ function Ye({ id: e, value: t, onChange: n, label: r, disabled: i, required: a,
|
|
|
892
897
|
}
|
|
893
898
|
//#endregion
|
|
894
899
|
//#region src/base/form/fields/TagsField.tsx
|
|
895
|
-
function
|
|
896
|
-
let { t: u } = R(), [d, f] = G(""), p =
|
|
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) => {
|
|
897
902
|
let t = e.trim();
|
|
898
903
|
t && (m.includes(t) || l && m.length >= l || (n([...m, t]), f("")));
|
|
899
904
|
}, [
|
|
@@ -943,7 +948,7 @@ function Xe({ id: e, value: t, onChange: n, placeholder: r, disabled: i, require
|
|
|
943
948
|
}
|
|
944
949
|
//#endregion
|
|
945
950
|
//#region src/base/form/fields/TextareaField.tsx
|
|
946
|
-
function
|
|
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 }) {
|
|
947
952
|
let f = [l ? d : void 0, u].filter(Boolean).join(" ") || void 0;
|
|
948
953
|
return /* @__PURE__ */ K(c, {
|
|
949
954
|
id: e,
|
|
@@ -977,11 +982,11 @@ function Z({ id: e, value: t, onChange: n, type: r = "text", placeholder: i, dis
|
|
|
977
982
|
}
|
|
978
983
|
//#endregion
|
|
979
984
|
//#region src/base/form/FormField.tsx
|
|
980
|
-
var
|
|
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 })));
|
|
981
986
|
function Q() {
|
|
982
987
|
return /* @__PURE__ */ K(w, { className: "h-9 w-full rounded-md" });
|
|
983
988
|
}
|
|
984
|
-
function
|
|
989
|
+
function at({ label: e }) {
|
|
985
990
|
return /* @__PURE__ */ K("div", {
|
|
986
991
|
className: "pt-4 pb-1",
|
|
987
992
|
children: /* @__PURE__ */ K("h4", {
|
|
@@ -990,23 +995,24 @@ function nt({ label: e }) {
|
|
|
990
995
|
})
|
|
991
996
|
});
|
|
992
997
|
}
|
|
993
|
-
function
|
|
998
|
+
function ot({ id: e, value: t }) {
|
|
994
999
|
return /* @__PURE__ */ K("input", {
|
|
995
1000
|
type: "hidden",
|
|
996
1001
|
id: e,
|
|
997
1002
|
value: String(t ?? "")
|
|
998
1003
|
});
|
|
999
1004
|
}
|
|
1000
|
-
function
|
|
1001
|
-
let { t: a } = R(), o =
|
|
1002
|
-
if (u === "header") return /* @__PURE__ */ K(
|
|
1003
|
-
if (u === "hidden") return /* @__PURE__ */ K(
|
|
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, {
|
|
1004
1009
|
id: s,
|
|
1005
1010
|
value: t
|
|
1006
1011
|
});
|
|
1007
|
-
let f =
|
|
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);
|
|
1008
1013
|
return /* @__PURE__ */ q("div", {
|
|
1009
1014
|
className: "space-y-1.5",
|
|
1015
|
+
"data-testid": ie(e.key),
|
|
1010
1016
|
children: [
|
|
1011
1017
|
!m && /* @__PURE__ */ q(T, {
|
|
1012
1018
|
htmlFor: s,
|
|
@@ -1030,7 +1036,7 @@ function it({ field: e, value: t, onChange: n, error: r, sourceValues: i = {} })
|
|
|
1030
1036
|
]
|
|
1031
1037
|
});
|
|
1032
1038
|
}
|
|
1033
|
-
function
|
|
1039
|
+
function ct(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
1034
1040
|
let f = {
|
|
1035
1041
|
id: t,
|
|
1036
1042
|
error: a,
|
|
@@ -1064,7 +1070,7 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1064
1070
|
placeholder: i.placeholder,
|
|
1065
1071
|
readOnly: i.readOnly
|
|
1066
1072
|
});
|
|
1067
|
-
case "textarea": return /* @__PURE__ */ K(
|
|
1073
|
+
case "textarea": return /* @__PURE__ */ K(et, {
|
|
1068
1074
|
...f,
|
|
1069
1075
|
value: n,
|
|
1070
1076
|
onChange: r,
|
|
@@ -1072,13 +1078,13 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1072
1078
|
rows: i.rows,
|
|
1073
1079
|
readOnly: i.readOnly
|
|
1074
1080
|
});
|
|
1075
|
-
case "password": return /* @__PURE__ */ K(
|
|
1081
|
+
case "password": return /* @__PURE__ */ K(We, {
|
|
1076
1082
|
...f,
|
|
1077
1083
|
value: n,
|
|
1078
1084
|
onChange: r,
|
|
1079
1085
|
placeholder: i.placeholder
|
|
1080
1086
|
});
|
|
1081
|
-
case "otp": return /* @__PURE__ */ K(
|
|
1087
|
+
case "otp": return /* @__PURE__ */ K(Ue, {
|
|
1082
1088
|
...f,
|
|
1083
1089
|
value: n,
|
|
1084
1090
|
onChange: r,
|
|
@@ -1086,21 +1092,21 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1086
1092
|
pattern: i.pattern,
|
|
1087
1093
|
groupSize: i.groupSize
|
|
1088
1094
|
});
|
|
1089
|
-
case "select": return /* @__PURE__ */ K(
|
|
1095
|
+
case "select": return /* @__PURE__ */ K(qe, {
|
|
1090
1096
|
...f,
|
|
1091
1097
|
value: n,
|
|
1092
1098
|
onChange: r,
|
|
1093
1099
|
options: i.options ?? [],
|
|
1094
1100
|
placeholder: i.placeholder
|
|
1095
1101
|
});
|
|
1096
|
-
case "native_select": return /* @__PURE__ */ K(
|
|
1102
|
+
case "native_select": return /* @__PURE__ */ K(Ve, {
|
|
1097
1103
|
...f,
|
|
1098
1104
|
value: n,
|
|
1099
1105
|
onChange: r,
|
|
1100
1106
|
options: i.options ?? [],
|
|
1101
1107
|
placeholder: i.placeholder
|
|
1102
1108
|
});
|
|
1103
|
-
case "multiselect": return /* @__PURE__ */ K(
|
|
1109
|
+
case "multiselect": return /* @__PURE__ */ K(Re, {
|
|
1104
1110
|
...f,
|
|
1105
1111
|
value: n,
|
|
1106
1112
|
onChange: r,
|
|
@@ -1108,7 +1114,7 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1108
1114
|
placeholder: i.placeholder,
|
|
1109
1115
|
variant: i.variant
|
|
1110
1116
|
});
|
|
1111
|
-
case "radio": return /* @__PURE__ */ K(
|
|
1117
|
+
case "radio": return /* @__PURE__ */ K(Ge, {
|
|
1112
1118
|
...f,
|
|
1113
1119
|
value: n,
|
|
1114
1120
|
onChange: r,
|
|
@@ -1130,7 +1136,7 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1130
1136
|
max: i.max,
|
|
1131
1137
|
step: i.step ?? .1
|
|
1132
1138
|
});
|
|
1133
|
-
case "slider": return /* @__PURE__ */ K(
|
|
1139
|
+
case "slider": return /* @__PURE__ */ K(Je, {
|
|
1134
1140
|
...f,
|
|
1135
1141
|
value: n,
|
|
1136
1142
|
onChange: r,
|
|
@@ -1139,13 +1145,13 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1139
1145
|
step: i.step,
|
|
1140
1146
|
multiple: i.multiple
|
|
1141
1147
|
});
|
|
1142
|
-
case "checkbox": return /* @__PURE__ */ K(
|
|
1148
|
+
case "checkbox": return /* @__PURE__ */ K(De, {
|
|
1143
1149
|
...f,
|
|
1144
1150
|
value: n,
|
|
1145
1151
|
onChange: r,
|
|
1146
1152
|
label: i.label
|
|
1147
1153
|
});
|
|
1148
|
-
case "switch": return /* @__PURE__ */ K(
|
|
1154
|
+
case "switch": return /* @__PURE__ */ K(Qe, {
|
|
1149
1155
|
...f,
|
|
1150
1156
|
value: n,
|
|
1151
1157
|
onChange: r,
|
|
@@ -1153,7 +1159,7 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1153
1159
|
});
|
|
1154
1160
|
case "date": return /* @__PURE__ */ K(V, {
|
|
1155
1161
|
fallback: /* @__PURE__ */ K(Q, {}),
|
|
1156
|
-
children: /* @__PURE__ */ K(
|
|
1162
|
+
children: /* @__PURE__ */ K(nt, {
|
|
1157
1163
|
...f,
|
|
1158
1164
|
mode: "date",
|
|
1159
1165
|
value: n,
|
|
@@ -1163,7 +1169,7 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1163
1169
|
});
|
|
1164
1170
|
case "datetime": return /* @__PURE__ */ K(V, {
|
|
1165
1171
|
fallback: /* @__PURE__ */ K(Q, {}),
|
|
1166
|
-
children: /* @__PURE__ */ K(
|
|
1172
|
+
children: /* @__PURE__ */ K(nt, {
|
|
1167
1173
|
...f,
|
|
1168
1174
|
mode: "datetime",
|
|
1169
1175
|
value: n,
|
|
@@ -1171,7 +1177,7 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1171
1177
|
placeholder: i.placeholder
|
|
1172
1178
|
})
|
|
1173
1179
|
});
|
|
1174
|
-
case "file": return /* @__PURE__ */ K(
|
|
1180
|
+
case "file": return /* @__PURE__ */ K(Ie, {
|
|
1175
1181
|
...f,
|
|
1176
1182
|
value: n,
|
|
1177
1183
|
onChange: r,
|
|
@@ -1180,7 +1186,7 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1180
1186
|
maxFiles: i.maxFiles,
|
|
1181
1187
|
maxSize: i.maxSize
|
|
1182
1188
|
});
|
|
1183
|
-
case "entity_picker": return /* @__PURE__ */ K(
|
|
1189
|
+
case "entity_picker": return /* @__PURE__ */ K(Me, {
|
|
1184
1190
|
...f,
|
|
1185
1191
|
value: n,
|
|
1186
1192
|
onChange: r,
|
|
@@ -1192,13 +1198,13 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1192
1198
|
entitySubtitleField: i.entitySubtitleField,
|
|
1193
1199
|
placeholder: i.placeholder
|
|
1194
1200
|
});
|
|
1195
|
-
case "static": return /* @__PURE__ */ K(
|
|
1201
|
+
case "static": return /* @__PURE__ */ K(Ze, {
|
|
1196
1202
|
id: t,
|
|
1197
1203
|
value: n
|
|
1198
1204
|
});
|
|
1199
1205
|
case "phone": return /* @__PURE__ */ K(V, {
|
|
1200
1206
|
fallback: /* @__PURE__ */ K(Q, {}),
|
|
1201
|
-
children: /* @__PURE__ */ K(
|
|
1207
|
+
children: /* @__PURE__ */ K(tt, {
|
|
1202
1208
|
...f,
|
|
1203
1209
|
value: n,
|
|
1204
1210
|
onChange: r,
|
|
@@ -1209,7 +1215,7 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1209
1215
|
});
|
|
1210
1216
|
case "document": return /* @__PURE__ */ K(V, {
|
|
1211
1217
|
fallback: /* @__PURE__ */ K(Q, {}),
|
|
1212
|
-
children: /* @__PURE__ */ K(
|
|
1218
|
+
children: /* @__PURE__ */ K(rt, {
|
|
1213
1219
|
...f,
|
|
1214
1220
|
value: n,
|
|
1215
1221
|
onChange: r,
|
|
@@ -1219,7 +1225,7 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1219
1225
|
placeholder: i.placeholder
|
|
1220
1226
|
})
|
|
1221
1227
|
});
|
|
1222
|
-
case "currency": return /* @__PURE__ */ K(
|
|
1228
|
+
case "currency": return /* @__PURE__ */ K(Ae, {
|
|
1223
1229
|
...f,
|
|
1224
1230
|
value: n,
|
|
1225
1231
|
onChange: r,
|
|
@@ -1228,13 +1234,13 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1228
1234
|
min: i.min,
|
|
1229
1235
|
max: i.max
|
|
1230
1236
|
});
|
|
1231
|
-
case "color": return /* @__PURE__ */ K(
|
|
1237
|
+
case "color": return /* @__PURE__ */ K(Oe, {
|
|
1232
1238
|
...f,
|
|
1233
1239
|
value: n,
|
|
1234
1240
|
onChange: r,
|
|
1235
1241
|
placeholder: i.placeholder
|
|
1236
1242
|
});
|
|
1237
|
-
case "slug": return /* @__PURE__ */ K(
|
|
1243
|
+
case "slug": return /* @__PURE__ */ K(Xe, {
|
|
1238
1244
|
...f,
|
|
1239
1245
|
value: n,
|
|
1240
1246
|
onChange: r,
|
|
@@ -1242,7 +1248,7 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1242
1248
|
prefix: i.prefix,
|
|
1243
1249
|
placeholder: i.placeholder
|
|
1244
1250
|
});
|
|
1245
|
-
case "tags": return /* @__PURE__ */ K(
|
|
1251
|
+
case "tags": return /* @__PURE__ */ K($e, {
|
|
1246
1252
|
...f,
|
|
1247
1253
|
value: n,
|
|
1248
1254
|
onChange: r,
|
|
@@ -1251,14 +1257,14 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1251
1257
|
});
|
|
1252
1258
|
case "date_range": return /* @__PURE__ */ K(V, {
|
|
1253
1259
|
fallback: /* @__PURE__ */ K(Q, {}),
|
|
1254
|
-
children: /* @__PURE__ */ K(
|
|
1260
|
+
children: /* @__PURE__ */ K(it, {
|
|
1255
1261
|
...f,
|
|
1256
1262
|
value: n,
|
|
1257
1263
|
onChange: r,
|
|
1258
1264
|
operator: i.operator
|
|
1259
1265
|
})
|
|
1260
1266
|
});
|
|
1261
|
-
case "rating": return /* @__PURE__ */ K(
|
|
1267
|
+
case "rating": return /* @__PURE__ */ K(Ke, {
|
|
1262
1268
|
...f,
|
|
1263
1269
|
value: n,
|
|
1264
1270
|
onChange: r,
|
|
@@ -1272,7 +1278,7 @@ function at(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1272
1278
|
}
|
|
1273
1279
|
//#endregion
|
|
1274
1280
|
//#region src/base/shell/partials/InlineEditablePanel.tsx
|
|
1275
|
-
function
|
|
1281
|
+
function lt(e) {
|
|
1276
1282
|
switch (e.component) {
|
|
1277
1283
|
case "int":
|
|
1278
1284
|
case "float":
|
|
@@ -1286,15 +1292,15 @@ function ot(e) {
|
|
|
1286
1292
|
default: return "";
|
|
1287
1293
|
}
|
|
1288
1294
|
}
|
|
1289
|
-
function
|
|
1290
|
-
return Object.prototype.hasOwnProperty.call(t, e.key) ? t[e.key] :
|
|
1295
|
+
function ut(e, t) {
|
|
1296
|
+
return Object.prototype.hasOwnProperty.call(t, e.key) ? t[e.key] : lt(e);
|
|
1291
1297
|
}
|
|
1292
1298
|
function $(t, n, r, i) {
|
|
1293
1299
|
return t.map((t, a) => {
|
|
1294
1300
|
switch (t.kind) {
|
|
1295
|
-
case "field": return
|
|
1301
|
+
case "field": return Se(t, n) ? /* @__PURE__ */ K(st, {
|
|
1296
1302
|
field: t,
|
|
1297
|
-
value:
|
|
1303
|
+
value: ut(t, n),
|
|
1298
1304
|
onChange: (e) => i(t.key, e),
|
|
1299
1305
|
error: r[t.key],
|
|
1300
1306
|
sourceValues: n
|
|
@@ -1318,8 +1324,8 @@ function $(t, n, r, i) {
|
|
|
1318
1324
|
}
|
|
1319
1325
|
});
|
|
1320
1326
|
}
|
|
1321
|
-
function
|
|
1322
|
-
let { t: e } = R(), { enabled: n, selectedId: r, descriptor: i, loading: a, saving: o, submit: s, close: c, width: l } =
|
|
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);
|
|
1323
1329
|
i !== m && (h(i), d(i?.values ? { ...i.values } : {}), p({}));
|
|
1324
1330
|
let [g, _] = G(null), v = g ?? l, y = W(() => (e, t) => {
|
|
1325
1331
|
d((n) => ({
|
|
@@ -1331,30 +1337,7 @@ function ct() {
|
|
|
1331
1337
|
return delete n[e], n;
|
|
1332
1338
|
});
|
|
1333
1339
|
}, []);
|
|
1334
|
-
|
|
1335
|
-
let b = (e) => {
|
|
1336
|
-
e.preventDefault();
|
|
1337
|
-
let t = e.clientX, n = v, r = (e) => {
|
|
1338
|
-
_(Math.min(720, Math.max(320, n + (t - e.clientX))));
|
|
1339
|
-
}, i = () => {
|
|
1340
|
-
window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i);
|
|
1341
|
-
};
|
|
1342
|
-
window.addEventListener("pointermove", r), window.addEventListener("pointerup", i);
|
|
1343
|
-
}, x = () => {
|
|
1344
|
-
if (!i) return;
|
|
1345
|
-
let t = Ce(i.schema, u, e).safeParse(u);
|
|
1346
|
-
if (!t.success) {
|
|
1347
|
-
let e = {};
|
|
1348
|
-
for (let n of t.error.issues) {
|
|
1349
|
-
let t = String(n.path[0] ?? "");
|
|
1350
|
-
t && !e[t] && (e[t] = n.message);
|
|
1351
|
-
}
|
|
1352
|
-
p(e);
|
|
1353
|
-
return;
|
|
1354
|
-
}
|
|
1355
|
-
s(t.data);
|
|
1356
|
-
};
|
|
1357
|
-
return /* @__PURE__ */ q(ue, { children: [/* @__PURE__ */ K("div", {
|
|
1340
|
+
return !n || r === null ? null : /* @__PURE__ */ q(pe, { children: [/* @__PURE__ */ K("div", {
|
|
1358
1341
|
className: "fixed inset-0 z-40 bg-black/40",
|
|
1359
1342
|
onClick: c,
|
|
1360
1343
|
"aria-hidden": !0
|
|
@@ -1365,7 +1348,15 @@ function ct() {
|
|
|
1365
1348
|
style: { width: v },
|
|
1366
1349
|
children: [
|
|
1367
1350
|
/* @__PURE__ */ K("div", {
|
|
1368
|
-
onPointerDown:
|
|
1351
|
+
onPointerDown: (e) => {
|
|
1352
|
+
e.preventDefault();
|
|
1353
|
+
let t = e.clientX, n = v, r = (e) => {
|
|
1354
|
+
_(Math.min(720, Math.max(320, n + (t - e.clientX))));
|
|
1355
|
+
}, i = () => {
|
|
1356
|
+
window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i);
|
|
1357
|
+
};
|
|
1358
|
+
window.addEventListener("pointermove", r), window.addEventListener("pointerup", i);
|
|
1359
|
+
},
|
|
1369
1360
|
className: "hover:bg-primary/30 absolute top-0 bottom-0 left-0 z-10 w-1.5 cursor-col-resize",
|
|
1370
1361
|
"aria-hidden": !0
|
|
1371
1362
|
}),
|
|
@@ -1414,7 +1405,20 @@ function ct() {
|
|
|
1414
1405
|
}), /* @__PURE__ */ K(t, {
|
|
1415
1406
|
type: "button",
|
|
1416
1407
|
size: "sm",
|
|
1417
|
-
onClick:
|
|
1408
|
+
onClick: () => {
|
|
1409
|
+
if (!i) return;
|
|
1410
|
+
let t = Ee(i.schema, u, e).safeParse(u);
|
|
1411
|
+
if (!t.success) {
|
|
1412
|
+
let e = {};
|
|
1413
|
+
for (let n of t.error.issues) {
|
|
1414
|
+
let t = String(n.path[0] ?? "");
|
|
1415
|
+
t && !e[t] && (e[t] = n.message);
|
|
1416
|
+
}
|
|
1417
|
+
p(e);
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
s(t.data);
|
|
1421
|
+
},
|
|
1418
1422
|
disabled: o,
|
|
1419
1423
|
children: i.submitLabel ?? e("middag.ui.form.save")
|
|
1420
1424
|
})]
|
|
@@ -1423,4 +1427,4 @@ function ct() {
|
|
|
1423
1427
|
})] });
|
|
1424
1428
|
}
|
|
1425
1429
|
//#endregion
|
|
1426
|
-
export {
|
|
1430
|
+
export { dt as InlineEditablePanel };
|