@namroodinc/liquid-editorial 0.6.5 → 0.6.7
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/README.md +23 -0
- package/UPGRADING.md +86 -0
- package/dist/chunks/{Avatar-C9ublbzK.cjs → Avatar-B_2lI7fS.cjs} +2 -2
- package/dist/chunks/{Avatar-C9ublbzK.cjs.map → Avatar-B_2lI7fS.cjs.map} +1 -1
- package/dist/chunks/{Avatar-BtblwihO.js → Avatar-DdFEOumt.js} +2 -2
- package/dist/chunks/{Avatar-BtblwihO.js.map → Avatar-DdFEOumt.js.map} +1 -1
- package/dist/chunks/{Board-z688-51u.js → Board-B8wK079I.js} +2 -2
- package/dist/chunks/{Board-z688-51u.js.map → Board-B8wK079I.js.map} +1 -1
- package/dist/chunks/{Board-CUt4j2-8.cjs → Board-CMf5Azt0.cjs} +2 -2
- package/dist/chunks/{Board-CUt4j2-8.cjs.map → Board-CMf5Azt0.cjs.map} +1 -1
- package/dist/chunks/{ColourField-DXGpNP08.js → ColourField-DC6cLb9h.js} +2 -2
- package/dist/chunks/{ColourField-DXGpNP08.js.map → ColourField-DC6cLb9h.js.map} +1 -1
- package/dist/chunks/{ColourField-BqhYB4ZE.cjs → ColourField-NnFxLEsh.cjs} +2 -2
- package/dist/chunks/{ColourField-BqhYB4ZE.cjs.map → ColourField-NnFxLEsh.cjs.map} +1 -1
- package/dist/chunks/EntryPicker-CR8Phuzl.js +180 -0
- package/dist/chunks/EntryPicker-CR8Phuzl.js.map +1 -0
- package/dist/chunks/EntryPicker-D7JIgx23.cjs +2 -0
- package/dist/chunks/EntryPicker-D7JIgx23.cjs.map +1 -0
- package/dist/chunks/{FormEditor-C5XtP-N7.js → FormEditor-BSfxVqLn.js} +192 -146
- package/dist/chunks/FormEditor-BSfxVqLn.js.map +1 -0
- package/dist/chunks/FormEditor-DNcSAnRF.cjs +2 -0
- package/dist/chunks/FormEditor-DNcSAnRF.cjs.map +1 -0
- package/dist/chunks/{RichTextEditor-DEJ-u-ZR.js → RichTextEditor-CNkwWist.js} +2 -2
- package/dist/chunks/{RichTextEditor-DEJ-u-ZR.js.map → RichTextEditor-CNkwWist.js.map} +1 -1
- package/dist/chunks/{RichTextEditor-Ddk7qaqg.cjs → RichTextEditor-DAnjElUO.cjs} +2 -2
- package/dist/chunks/{RichTextEditor-Ddk7qaqg.cjs.map → RichTextEditor-DAnjElUO.cjs.map} +1 -1
- package/dist/chunks/context-BONPXF-V.cjs.map +1 -1
- package/dist/chunks/context-CXvOl4Kt.js.map +1 -1
- package/dist/chunks/frame-BBVQTBcX.cjs +2 -0
- package/dist/chunks/frame-BBVQTBcX.cjs.map +1 -0
- package/dist/chunks/frame-De6IuTQz.js +189 -0
- package/dist/chunks/frame-De6IuTQz.js.map +1 -0
- package/dist/chunks/group-Bj9ZKc0R.cjs +2 -0
- package/dist/chunks/group-Bj9ZKc0R.cjs.map +1 -0
- package/dist/chunks/group-Ckz4Xya-.js +34 -0
- package/dist/chunks/group-Ckz4Xya-.js.map +1 -0
- package/dist/chunks/limit-BX6-o1a2.cjs +2 -0
- package/dist/chunks/limit-BX6-o1a2.cjs.map +1 -0
- package/dist/chunks/limit-ChteDN4T.js +18 -0
- package/dist/chunks/limit-ChteDN4T.js.map +1 -0
- package/dist/chunks/mergeRefs-C6_5pADN.js +19 -0
- package/dist/chunks/mergeRefs-C6_5pADN.js.map +1 -0
- package/dist/chunks/mergeRefs-CZ-SArlE.cjs +2 -0
- package/dist/chunks/mergeRefs-CZ-SArlE.cjs.map +1 -0
- package/dist/chunks/useLimit-BOmHKdJE.js +73 -0
- package/dist/chunks/useLimit-BOmHKdJE.js.map +1 -0
- package/dist/chunks/useLimit-DXe_VmYl.cjs +2 -0
- package/dist/chunks/useLimit-DXe_VmYl.cjs.map +1 -0
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.js +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.js +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.js +1 -1
- package/dist/components/EntryPicker/index.cjs +1 -2
- package/dist/components/EntryPicker/index.d.cts.map +1 -1
- package/dist/components/EntryPicker/index.d.ts.map +1 -1
- package/dist/components/EntryPicker/index.js +1 -171
- package/dist/components/EntryPicker/limit.d.cts +8 -0
- package/dist/components/EntryPicker/limit.d.cts.map +1 -0
- package/dist/components/EntryPicker/limit.d.ts +8 -0
- package/dist/components/EntryPicker/limit.d.ts.map +1 -0
- package/dist/components/Field/context.d.cts +6 -0
- package/dist/components/Field/context.d.cts.map +1 -1
- package/dist/components/Field/context.d.ts +6 -0
- package/dist/components/Field/context.d.ts.map +1 -1
- package/dist/components/Field/frame.d.cts +1 -1
- package/dist/components/Field/frame.d.cts.map +1 -1
- package/dist/components/Field/frame.d.ts +1 -1
- package/dist/components/Field/frame.d.ts.map +1 -1
- package/dist/components/Field/group.d.cts +1 -1
- package/dist/components/Field/group.d.cts.map +1 -1
- package/dist/components/Field/group.d.ts +1 -1
- package/dist/components/Field/group.d.ts.map +1 -1
- package/dist/components/Field/header.d.cts +12 -0
- package/dist/components/Field/header.d.cts.map +1 -0
- package/dist/components/Field/header.d.ts +12 -0
- package/dist/components/Field/header.d.ts.map +1 -0
- package/dist/components/Field/index.cjs +1 -1
- package/dist/components/Field/index.cjs.map +1 -1
- package/dist/components/Field/index.d.cts +1 -1
- package/dist/components/Field/index.d.cts.map +1 -1
- package/dist/components/Field/index.d.ts +1 -1
- package/dist/components/Field/index.d.ts.map +1 -1
- package/dist/components/Field/index.js +1 -1
- package/dist/components/Field/index.js.map +1 -1
- package/dist/components/Field/limit-reading.d.cts +12 -0
- package/dist/components/Field/limit-reading.d.cts.map +1 -0
- package/dist/components/Field/limit-reading.d.ts +12 -0
- package/dist/components/Field/limit-reading.d.ts.map +1 -0
- package/dist/components/Field/limit.d.cts +8 -0
- package/dist/components/Field/limit.d.cts.map +1 -0
- package/dist/components/Field/limit.d.ts +8 -0
- package/dist/components/Field/limit.d.ts.map +1 -0
- package/dist/components/Field/style.css +77 -0
- package/dist/components/Field/types.d.cts +12 -1
- package/dist/components/Field/types.d.cts.map +1 -1
- package/dist/components/Field/types.d.ts +12 -1
- package/dist/components/Field/types.d.ts.map +1 -1
- package/dist/components/Field/useLimit.d.cts +18 -0
- package/dist/components/Field/useLimit.d.cts.map +1 -0
- package/dist/components/Field/useLimit.d.ts +18 -0
- package/dist/components/Field/useLimit.d.ts.map +1 -0
- package/dist/components/FormEditor/README.md +62 -0
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.d.cts.map +1 -1
- package/dist/components/FormEditor/index.d.ts.map +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/FormEditor/model.d.cts +21 -8
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +21 -8
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.js +1 -1
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.js +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.cjs.map +1 -1
- package/dist/components/SearchField/index.d.cts.map +1 -1
- package/dist/components/SearchField/index.d.ts.map +1 -1
- package/dist/components/SearchField/index.js +27 -22
- package/dist/components/SearchField/index.js.map +1 -1
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.js +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/TagsInput/index.cjs +1 -1
- package/dist/components/TagsInput/index.cjs.map +1 -1
- package/dist/components/TagsInput/index.d.cts.map +1 -1
- package/dist/components/TagsInput/index.d.ts.map +1 -1
- package/dist/components/TagsInput/index.js +36 -30
- package/dist/components/TagsInput/index.js.map +1 -1
- package/dist/components/TextField/index.cjs +1 -1
- package/dist/components/TextField/index.cjs.map +1 -1
- package/dist/components/TextField/index.d.cts.map +1 -1
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/components/TextField/index.js +35 -20
- package/dist/components/TextField/index.js.map +1 -1
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/internal/mergeRefs.d.cts +5 -1
- package/dist/internal/mergeRefs.d.cts.map +1 -1
- package/dist/internal/mergeRefs.d.ts +5 -1
- package/dist/internal/mergeRefs.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/FormEditor-BbsvbufQ.cjs +0 -2
- package/dist/chunks/FormEditor-BbsvbufQ.cjs.map +0 -1
- package/dist/chunks/FormEditor-C5XtP-N7.js.map +0 -1
- package/dist/chunks/frame-Bs_jaQRw.js +0 -70
- package/dist/chunks/frame-Bs_jaQRw.js.map +0 -1
- package/dist/chunks/frame-CNxvbg0D.cjs +0 -2
- package/dist/chunks/frame-CNxvbg0D.cjs.map +0 -1
- package/dist/chunks/group-CzbacuAY.js +0 -29
- package/dist/chunks/group-CzbacuAY.js.map +0 -1
- package/dist/chunks/group-pKDQtq-9.cjs +0 -2
- package/dist/chunks/group-pKDQtq-9.cjs.map +0 -1
- package/dist/chunks/mergeRefs-Bc3qS0Tt.cjs +0 -2
- package/dist/chunks/mergeRefs-Bc3qS0Tt.cjs.map +0 -1
- package/dist/chunks/mergeRefs-DGM402mE.js +0 -10
- package/dist/chunks/mergeRefs-DGM402mE.js.map +0 -1
- package/dist/components/EntryPicker/index.cjs.map +0 -1
- package/dist/components/EntryPicker/index.js.map +0 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { Button as e } from "../components/Button/index.js";
|
|
2
2
|
import { Field as t } from "../components/Field/index.js";
|
|
3
3
|
import { TextArea as n, TextField as r } from "../components/TextField/index.js";
|
|
4
|
-
import { n as i, r as a, t as o } from "./RichTextEditor-
|
|
4
|
+
import { n as i, r as a, t as o } from "./RichTextEditor-CNkwWist.js";
|
|
5
5
|
import { Container as s } from "../components/Container/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import { NumberField as
|
|
8
|
-
import { Select as
|
|
9
|
-
import { Switch as
|
|
10
|
-
import { i as
|
|
11
|
-
import { t as
|
|
12
|
-
import { a as
|
|
13
|
-
import { a as
|
|
14
|
-
import { TagsInput as
|
|
15
|
-
import { Checkbox as
|
|
16
|
-
import { CheckboxCard as
|
|
6
|
+
import { n as c, t as l } from "./EntryPicker-CR8Phuzl.js";
|
|
7
|
+
import { NumberField as u } from "../components/NumberField/index.js";
|
|
8
|
+
import { Select as d } from "../components/Select/index.js";
|
|
9
|
+
import { Switch as f } from "../components/Switch/index.js";
|
|
10
|
+
import { i as p } from "./colour-CYEF4Q_n.js";
|
|
11
|
+
import { t as m } from "./ColourField-DC6cLb9h.js";
|
|
12
|
+
import { a as h, i as g, n as _, r as v, t as y } from "./Slider-vdMFLX-H.js";
|
|
13
|
+
import { a as b, n as x } from "./DatePicker-DJAqXUDJ.js";
|
|
14
|
+
import { TagsInput as S } from "../components/TagsInput/index.js";
|
|
15
|
+
import { Checkbox as C, ChoiceGroup as ee, Radio as te } from "../components/Choice/index.js";
|
|
16
|
+
import { CheckboxCard as ne, RadioCard as re, SelectionCardGroup as w } from "../components/SelectionCard/index.js";
|
|
17
17
|
import { useMemo as T, useState as E } from "react";
|
|
18
18
|
import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
19
19
|
//#region src/components/RichTextEditor/expanded-width.ts
|
|
20
|
-
var
|
|
20
|
+
var ie = ["wide", "full"], ae = [
|
|
21
21
|
"sm",
|
|
22
22
|
"md",
|
|
23
23
|
"lg"
|
|
24
|
-
],
|
|
24
|
+
], oe = /* @__PURE__ */ new Set([
|
|
25
25
|
"shortText",
|
|
26
26
|
"longText",
|
|
27
27
|
"richText",
|
|
@@ -40,28 +40,73 @@ var A = ["wide", "full"], j = [
|
|
|
40
40
|
"date",
|
|
41
41
|
"divider"
|
|
42
42
|
]);
|
|
43
|
-
function
|
|
43
|
+
function A(e) {
|
|
44
44
|
let t = /* @__PURE__ */ new Set();
|
|
45
45
|
for (let n of e.fields) {
|
|
46
46
|
if (!n.id?.trim() || t.has(n.id)) throw Error("Form field IDs must be nonempty and unique.");
|
|
47
|
-
if (!
|
|
48
|
-
(n.type === "select" || n.type === "radioGroup" || n.type === "checkboxGroup") &&
|
|
47
|
+
if (!oe.has(n.type)) throw Error(`Unsupported form field type: ${n.type}`);
|
|
48
|
+
(n.type === "select" || n.type === "radioGroup" || n.type === "checkboxGroup") && I(n), (n.type === "slider" || n.type === "rangeSlider") && F(n), n.type !== "divider" && (P(n), ce(n)), t.add(n.id);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
var se = /* @__PURE__ */ new Set([
|
|
52
|
+
"shortText",
|
|
53
|
+
"longText",
|
|
54
|
+
"tags",
|
|
55
|
+
"asset",
|
|
56
|
+
"reference"
|
|
57
|
+
]);
|
|
58
|
+
function j(e) {
|
|
59
|
+
return se.has(e.type);
|
|
60
|
+
}
|
|
61
|
+
function ce(e) {
|
|
62
|
+
if (j(e)) {
|
|
63
|
+
if (e.limitDisplay !== void 0 && !["used", "remaining"].includes(e.limitDisplay)) throw Error(`Field ${e.id} needs a limitDisplay of used or remaining.`);
|
|
64
|
+
if (e.limitVisibility !== void 0 && !["always", "nearLimit"].includes(e.limitVisibility)) throw Error(`Field ${e.id} needs a limitVisibility of always or nearLimit.`);
|
|
65
|
+
if (e.showLimitRing !== void 0 && typeof e.showLimitRing != "boolean") throw Error(`Field ${e.id} needs a boolean showLimitRing.`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function le(e, t, n) {
|
|
69
|
+
return j(e) ? {
|
|
70
|
+
limitDisplay: e.limitDisplay,
|
|
71
|
+
limitVisibility: e.limitVisibility,
|
|
72
|
+
showLimitRing: e.showLimitRing,
|
|
73
|
+
limit: ue(e, t, n ?? [])
|
|
74
|
+
} : {};
|
|
75
|
+
}
|
|
76
|
+
function ue(e, t, n) {
|
|
77
|
+
switch (e.type) {
|
|
78
|
+
case "shortText":
|
|
79
|
+
case "longText": return e.maxLength === void 0 ? void 0 : {
|
|
80
|
+
count: M(t).length,
|
|
81
|
+
max: e.maxLength
|
|
82
|
+
};
|
|
83
|
+
case "tags": return e.max === void 0 ? void 0 : {
|
|
84
|
+
count: q(t).length,
|
|
85
|
+
max: e.max
|
|
86
|
+
};
|
|
87
|
+
default: return c(N(e), n.length, z(e).max);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function M(e) {
|
|
91
|
+
return typeof e == "string" ? e : "";
|
|
92
|
+
}
|
|
93
|
+
function N(e) {
|
|
94
|
+
return e.multiple ? "multiple" : "single";
|
|
95
|
+
}
|
|
51
96
|
function P(e) {
|
|
52
|
-
if (e.width !== void 0 && !
|
|
53
|
-
if (e.type === "richText" && e.expandedWidth !== void 0 && !
|
|
97
|
+
if (e.width !== void 0 && !ae.includes(e.width)) throw Error(`Field ${e.id} needs a width of sm, md or lg.`);
|
|
98
|
+
if (e.type === "richText" && e.expandedWidth !== void 0 && !ie.includes(e.expandedWidth)) throw Error(`Rich text field ${e.id} needs an expandedWidth of wide or full.`);
|
|
54
99
|
}
|
|
55
|
-
function
|
|
56
|
-
let { min: t, max: n, step: r } =
|
|
100
|
+
function F(e) {
|
|
101
|
+
let { min: t, max: n, step: r } = h(e);
|
|
57
102
|
if (![
|
|
58
103
|
t,
|
|
59
104
|
n,
|
|
60
105
|
r
|
|
61
106
|
].every(Number.isFinite) || t >= n || r <= 0) throw Error(`Slider field ${e.id} needs finite min < max and a positive step.`);
|
|
62
|
-
if (e.type === "rangeSlider" && r >
|
|
107
|
+
if (e.type === "rangeSlider" && r > g(n, -t)) throw Error(`Range slider ${e.id} needs room for at least one step.`);
|
|
63
108
|
}
|
|
64
|
-
function
|
|
109
|
+
function I(e) {
|
|
65
110
|
if (!Array.isArray(e.options)) {
|
|
66
111
|
let t = e.type === "select" ? "Select" : "Choice";
|
|
67
112
|
throw Error(`${t} field ${e.id} needs an options array.`);
|
|
@@ -70,7 +115,7 @@ function ie(e) {
|
|
|
70
115
|
let t = e.options.map((e) => e.value);
|
|
71
116
|
if (t.some((e) => typeof e != "string" || !e.trim()) || new Set(t).size !== t.length) throw Error(`Choice field ${e.id} needs nonempty, unique option values.`);
|
|
72
117
|
}
|
|
73
|
-
var
|
|
118
|
+
var L = {
|
|
74
119
|
asset: {
|
|
75
120
|
key: "assetId",
|
|
76
121
|
itemLabel: "asset",
|
|
@@ -82,11 +127,11 @@ var F = {
|
|
|
82
127
|
itemsLabel: "entries"
|
|
83
128
|
}
|
|
84
129
|
};
|
|
85
|
-
function
|
|
130
|
+
function R(e) {
|
|
86
131
|
return e.type === "asset" || e.type === "reference" ? e.picker?.label ?? e.label : e.label;
|
|
87
132
|
}
|
|
88
|
-
function
|
|
89
|
-
let t =
|
|
133
|
+
function z(e) {
|
|
134
|
+
let t = L[e.type], { addLabel: n = `Choose ${R(e)}`, emptyLabel: r, itemLabel: i = t.itemLabel, itemsLabel: a = t.itemsLabel, max: o, isReorderable: s } = e.picker ?? {};
|
|
90
135
|
return {
|
|
91
136
|
addLabel: n,
|
|
92
137
|
emptyLabel: r,
|
|
@@ -96,69 +141,69 @@ function L(e) {
|
|
|
96
141
|
isReorderable: s
|
|
97
142
|
};
|
|
98
143
|
}
|
|
99
|
-
function
|
|
100
|
-
let { key: n } =
|
|
101
|
-
return (Array.isArray(t) ? t : t === void 0 ? [] : [t]).flatMap((e) =>
|
|
144
|
+
function B(e, t) {
|
|
145
|
+
let { key: n } = L[e.type];
|
|
146
|
+
return (Array.isArray(t) ? t : t === void 0 ? [] : [t]).flatMap((e) => H(e, n) ? [e[n]] : []);
|
|
102
147
|
}
|
|
103
|
-
function
|
|
148
|
+
function V(e) {
|
|
104
149
|
if (typeof e != "string") return;
|
|
105
150
|
let t = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(?:Z|\+00:00)$/.exec(e);
|
|
106
151
|
if (!t) return;
|
|
107
152
|
let n = `${t[1]}:${t[2] ?? "00"}.${(t[3] ?? "").padEnd(3, "0")}Z`, r = new Date(n);
|
|
108
153
|
if (Number.isFinite(r.getTime()) && r.toISOString() === n) return n;
|
|
109
154
|
}
|
|
110
|
-
function
|
|
155
|
+
function H(e, t) {
|
|
111
156
|
return !!e && typeof e == "object" && t in e && typeof e[t] == "string" && e[t].trim().length > 0;
|
|
112
157
|
}
|
|
113
|
-
function
|
|
114
|
-
return !!e.text?.trim() || e.type === "horizontalRule" || !!e.content?.some(
|
|
158
|
+
function U(e) {
|
|
159
|
+
return !!e.text?.trim() || e.type === "horizontalRule" || !!e.content?.some(U);
|
|
115
160
|
}
|
|
116
|
-
function
|
|
117
|
-
return `${
|
|
161
|
+
function W(e) {
|
|
162
|
+
return `${R(e)} is required.`;
|
|
118
163
|
}
|
|
119
|
-
function
|
|
164
|
+
function G(e, t) {
|
|
120
165
|
if (typeof t != "string") return "Enter text.";
|
|
121
|
-
if (e.required && !t.trim()) return
|
|
166
|
+
if (e.required && !t.trim()) return W(e);
|
|
122
167
|
if ((e.type === "shortText" || e.type === "longText") && e.maxLength !== void 0 && t.length > e.maxLength) return `Enter no more than ${e.maxLength} characters.`;
|
|
123
168
|
}
|
|
124
|
-
function
|
|
169
|
+
function de(e, t) {
|
|
125
170
|
let n = i(t);
|
|
126
171
|
if (n) return n;
|
|
127
|
-
if (e.required && !
|
|
172
|
+
if (e.required && !U(t)) return W(e);
|
|
128
173
|
}
|
|
129
|
-
function
|
|
174
|
+
function K(e, t) {
|
|
130
175
|
if (typeof t != "string") return "Choose an available option.";
|
|
131
|
-
if (t === "") return e.required ?
|
|
176
|
+
if (t === "") return e.required ? W(e) : void 0;
|
|
132
177
|
if ((e.type === "select" || e.type === "radioGroup") && e.options.length > 0 && !e.options.some((e) => e.value === t)) return "Choose an available option.";
|
|
133
178
|
}
|
|
134
|
-
function
|
|
179
|
+
function q(e) {
|
|
135
180
|
return Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
|
|
136
181
|
}
|
|
137
|
-
function
|
|
182
|
+
function J(e, t) {
|
|
138
183
|
if (!Array.isArray(t) || !t.every((e) => typeof e == "string" && e.trim()) || new Set(t).size !== t.length) return "Enter a list of unique, nonempty text values.";
|
|
139
|
-
if (e.required && !t.length) return
|
|
184
|
+
if (e.required && !t.length) return W(e);
|
|
140
185
|
if (e.type === "tags" && e.max !== void 0 && t.length > e.max) return `Enter no more than ${e.max} tags.`;
|
|
141
186
|
if (e.type === "checkboxGroup" && e.options.length && t.some((t) => !e.options.some((e) => e.value === t))) return "Choose available options.";
|
|
142
187
|
}
|
|
143
|
-
function
|
|
188
|
+
function Y(e, t) {
|
|
144
189
|
if (typeof t != "number" || !Number.isFinite(t)) return "Enter a finite number.";
|
|
145
|
-
let { min: n, max: r } = e.type === "slider" || e.type === "rangeSlider" ?
|
|
190
|
+
let { min: n, max: r } = e.type === "slider" || e.type === "rangeSlider" ? h(e) : e.type === "number" ? e : {};
|
|
146
191
|
if (n !== void 0 && t < n) return `Enter a number of at least ${n}.`;
|
|
147
192
|
if (r !== void 0 && t > r) return `Enter a number no greater than ${r}.`;
|
|
148
193
|
}
|
|
149
|
-
function
|
|
194
|
+
function fe(e, t) {
|
|
150
195
|
if (typeof t != "string") return "Enter a valid calendar date (YYYY-MM-DD).";
|
|
151
|
-
if (!t) return e.required ?
|
|
152
|
-
if (!
|
|
196
|
+
if (!t) return e.required ? W(e) : void 0;
|
|
197
|
+
if (!b(t)) return "Enter a valid calendar date (YYYY-MM-DD).";
|
|
153
198
|
if (e.type === "date") {
|
|
154
199
|
if (e.min && t < e.min) return `Choose a date on or after ${e.min}.`;
|
|
155
200
|
if (e.max && t > e.max) return `Choose a date on or before ${e.max}.`;
|
|
156
201
|
}
|
|
157
202
|
}
|
|
158
203
|
function X(e, t) {
|
|
159
|
-
return typeof e == "number" && Number.isFinite(e) ?
|
|
204
|
+
return typeof e == "number" && Number.isFinite(e) ? v(e, t) : void 0;
|
|
160
205
|
}
|
|
161
|
-
function
|
|
206
|
+
function pe(e, t) {
|
|
162
207
|
let n = e, r = X(n?.min, t), i = X(n?.max, t);
|
|
163
208
|
if (r === void 0 && i === void 0) return;
|
|
164
209
|
let [a, o] = [r ?? t.min, i ?? t.max].sort((e, t) => e - t);
|
|
@@ -167,56 +212,56 @@ function Z(e, t) {
|
|
|
167
212
|
max: o
|
|
168
213
|
};
|
|
169
214
|
}
|
|
170
|
-
function
|
|
215
|
+
function me(e, t) {
|
|
171
216
|
if (!t || typeof t != "object" || Array.isArray(t)) return "Enter a range.";
|
|
172
|
-
let n = t, r = n.min, i = n.max, a =
|
|
217
|
+
let n = t, r = n.min, i = n.max, a = Y(e, r) ?? Y(e, i);
|
|
173
218
|
if (a) return a;
|
|
174
219
|
if (r > i) return "The start must not be greater than the end.";
|
|
175
|
-
if (e.type === "rangeSlider" &&
|
|
220
|
+
if (e.type === "rangeSlider" && g(i, -r) < h(e).step) return "Keep the range endpoints at least one step apart.";
|
|
176
221
|
}
|
|
177
|
-
function
|
|
178
|
-
return typeof t == "string" ? t.trim() ?
|
|
222
|
+
function he(e, t) {
|
|
223
|
+
return typeof t == "string" ? t.trim() ? p(t) ? void 0 : "Enter a valid colour." : e.required ? W(e) : void 0 : "Enter a valid colour.";
|
|
179
224
|
}
|
|
180
|
-
function
|
|
225
|
+
function Z(e, t) {
|
|
181
226
|
if (e.type !== "asset" && e.type !== "reference") return;
|
|
182
|
-
let { key: n, itemLabel: r, itemsLabel: i } =
|
|
183
|
-
if (!e.multiple) return
|
|
184
|
-
if (!Array.isArray(t) || !t.every((e) =>
|
|
185
|
-
if (e.required && t.length === 0) return
|
|
227
|
+
let { key: n, itemLabel: r, itemsLabel: i } = L[e.type];
|
|
228
|
+
if (!e.multiple) return H(t, n) ? void 0 : `Choose an ${r}.`;
|
|
229
|
+
if (!Array.isArray(t) || !t.every((e) => H(e, n))) return `Choose a list of ${i}.`;
|
|
230
|
+
if (e.required && t.length === 0) return W(e);
|
|
186
231
|
let a = e.picker?.max;
|
|
187
|
-
if (a !== void 0 && t.length > a) return `Choose no more than ${a} ${
|
|
188
|
-
}
|
|
189
|
-
var
|
|
190
|
-
shortText:
|
|
191
|
-
longText:
|
|
192
|
-
richText:
|
|
193
|
-
number:
|
|
194
|
-
slider:
|
|
195
|
-
rangeSlider:
|
|
196
|
-
date:
|
|
197
|
-
colour:
|
|
198
|
-
radioGroup:
|
|
199
|
-
checkboxGroup:
|
|
200
|
-
tags:
|
|
232
|
+
if (a !== void 0 && t.length > a) return `Choose no more than ${a} ${z(e).itemsLabel}.`;
|
|
233
|
+
}
|
|
234
|
+
var ge = {
|
|
235
|
+
shortText: G,
|
|
236
|
+
longText: G,
|
|
237
|
+
richText: de,
|
|
238
|
+
number: Y,
|
|
239
|
+
slider: Y,
|
|
240
|
+
rangeSlider: me,
|
|
241
|
+
date: fe,
|
|
242
|
+
colour: he,
|
|
243
|
+
radioGroup: K,
|
|
244
|
+
checkboxGroup: J,
|
|
245
|
+
tags: J,
|
|
201
246
|
boolean: (e, t) => typeof t == "boolean" ? void 0 : "Choose a boolean value.",
|
|
202
|
-
dateTime: (e, t) =>
|
|
203
|
-
select:
|
|
204
|
-
asset:
|
|
205
|
-
reference:
|
|
247
|
+
dateTime: (e, t) => V(t) ? void 0 : "Enter a valid UTC date and time.",
|
|
248
|
+
select: K,
|
|
249
|
+
asset: Z,
|
|
250
|
+
reference: Z
|
|
206
251
|
};
|
|
207
|
-
function
|
|
208
|
-
return t === void 0 ? e.required ?
|
|
252
|
+
function Q(e, t) {
|
|
253
|
+
return t === void 0 ? e.required ? W(e) : void 0 : ge[e.type](e, t);
|
|
209
254
|
}
|
|
210
|
-
function
|
|
211
|
-
return
|
|
255
|
+
function _e(e, t) {
|
|
256
|
+
return A(e), Object.fromEntries(e.fields.flatMap((e) => {
|
|
212
257
|
if (e.type === "divider") return [];
|
|
213
|
-
let n =
|
|
258
|
+
let n = Q(e, Object.hasOwn(t, e.id) ? t[e.id] : void 0);
|
|
214
259
|
return n ? [[e.id, n]] : [];
|
|
215
260
|
}));
|
|
216
261
|
}
|
|
217
262
|
//#endregion
|
|
218
263
|
//#region src/components/FormEditor/choice-control.tsx
|
|
219
|
-
function
|
|
264
|
+
function ve({ field: e, option: t, name: n, checked: r, isDisabled: i, invalid: a, onChange: o }) {
|
|
220
265
|
let s = {
|
|
221
266
|
name: n,
|
|
222
267
|
value: t.value,
|
|
@@ -228,14 +273,14 @@ function le({ field: e, option: t, name: n, checked: r, isDisabled: i, invalid:
|
|
|
228
273
|
}
|
|
229
274
|
};
|
|
230
275
|
if (e.appearance === "card") {
|
|
231
|
-
let n = e.type === "radioGroup" ?
|
|
276
|
+
let n = e.type === "radioGroup" ? re : ne;
|
|
232
277
|
return /* @__PURE__ */ O(n, {
|
|
233
278
|
...s,
|
|
234
279
|
title: t.label,
|
|
235
280
|
description: t.description
|
|
236
281
|
});
|
|
237
282
|
}
|
|
238
|
-
let c = e.type === "radioGroup" ?
|
|
283
|
+
let c = e.type === "radioGroup" ? te : C;
|
|
239
284
|
return /* @__PURE__ */ O(c, {
|
|
240
285
|
...s,
|
|
241
286
|
children: /* @__PURE__ */ k("span", { children: [t.label, t.description && /* @__PURE__ */ O("span", {
|
|
@@ -244,13 +289,13 @@ function le({ field: e, option: t, name: n, checked: r, isDisabled: i, invalid:
|
|
|
244
289
|
})] })
|
|
245
290
|
});
|
|
246
291
|
}
|
|
247
|
-
function
|
|
248
|
-
let s = t.type === "checkboxGroup", c = s ?
|
|
292
|
+
function ye({ field: t, stored: n, isDisabled: r, required: i, accessibility: a, onChange: o }) {
|
|
293
|
+
let s = t.type === "checkboxGroup", c = s ? q(n) : typeof n == "string" && n ? [n] : [], l = t.appearance === "card" ? w : ee;
|
|
249
294
|
return /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(l, {
|
|
250
295
|
...a,
|
|
251
296
|
label: t.label,
|
|
252
297
|
columns: t.columns ?? (t.appearance === "card" ? 2 : 1),
|
|
253
|
-
children: t.options.map((e) => /* @__PURE__ */ O(
|
|
298
|
+
children: t.options.map((e) => /* @__PURE__ */ O(ve, {
|
|
254
299
|
field: t,
|
|
255
300
|
option: e,
|
|
256
301
|
name: a.id,
|
|
@@ -271,9 +316,9 @@ function ue({ field: t, stored: n, isDisabled: r, required: i, accessibility: a,
|
|
|
271
316
|
}
|
|
272
317
|
//#endregion
|
|
273
318
|
//#region src/components/FormEditor/additional-control.tsx
|
|
274
|
-
function
|
|
275
|
-
let a =
|
|
276
|
-
return /* @__PURE__ */ O(
|
|
319
|
+
function be({ field: e, stored: t, isDisabled: n, accessibility: r, onChange: i }) {
|
|
320
|
+
let a = h(e), o = X(t, a);
|
|
321
|
+
return /* @__PURE__ */ O(_, {
|
|
277
322
|
...r,
|
|
278
323
|
...a,
|
|
279
324
|
prefix: e.prefix,
|
|
@@ -289,9 +334,9 @@ function de({ field: e, stored: t, isDisabled: n, accessibility: r, onChange: i
|
|
|
289
334
|
}
|
|
290
335
|
});
|
|
291
336
|
}
|
|
292
|
-
function
|
|
293
|
-
let a =
|
|
294
|
-
return /* @__PURE__ */ O(
|
|
337
|
+
function $({ field: e, stored: t, isDisabled: n, accessibility: r, onChange: i }) {
|
|
338
|
+
let a = h(e), o = pe(t, a);
|
|
339
|
+
return /* @__PURE__ */ O(y, {
|
|
295
340
|
...r,
|
|
296
341
|
...a,
|
|
297
342
|
prefix: e.prefix,
|
|
@@ -312,7 +357,7 @@ function fe({ field: e, stored: t, isDisabled: n, accessibility: r, onChange: i
|
|
|
312
357
|
}
|
|
313
358
|
});
|
|
314
359
|
}
|
|
315
|
-
function
|
|
360
|
+
function xe({ field: e, stored: t, isDisabled: n, required: r, accessibility: i, onChange: a }) {
|
|
316
361
|
let o = {
|
|
317
362
|
stored: t,
|
|
318
363
|
isDisabled: n,
|
|
@@ -322,19 +367,19 @@ function pe({ field: e, stored: t, isDisabled: n, required: r, accessibility: i,
|
|
|
322
367
|
};
|
|
323
368
|
switch (e.type) {
|
|
324
369
|
case "radioGroup":
|
|
325
|
-
case "checkboxGroup": return /* @__PURE__ */ O(
|
|
370
|
+
case "checkboxGroup": return /* @__PURE__ */ O(ye, {
|
|
326
371
|
field: e,
|
|
327
372
|
...o
|
|
328
373
|
});
|
|
329
|
-
case "rangeSlider": return /* @__PURE__ */ O(
|
|
374
|
+
case "rangeSlider": return /* @__PURE__ */ O($, {
|
|
330
375
|
field: e,
|
|
331
376
|
...o
|
|
332
377
|
});
|
|
333
|
-
case "slider": return /* @__PURE__ */ O(
|
|
378
|
+
case "slider": return /* @__PURE__ */ O(be, {
|
|
334
379
|
field: e,
|
|
335
380
|
...o
|
|
336
381
|
});
|
|
337
|
-
case "colour": return /* @__PURE__ */ O(
|
|
382
|
+
case "colour": return /* @__PURE__ */ O(m, {
|
|
338
383
|
...i,
|
|
339
384
|
required: r,
|
|
340
385
|
placeholder: e.placeholder,
|
|
@@ -348,20 +393,20 @@ function pe({ field: e, stored: t, isDisabled: n, required: r, accessibility: i,
|
|
|
348
393
|
value: typeof t == "string" ? t : "",
|
|
349
394
|
onInput: (e) => {
|
|
350
395
|
let t = e.currentTarget.value;
|
|
351
|
-
t.trim() && !
|
|
396
|
+
t.trim() && !p(t) && a(t);
|
|
352
397
|
},
|
|
353
398
|
onValueChange: (e) => a(e === "" ? void 0 : e)
|
|
354
399
|
});
|
|
355
|
-
case "tags": return /* @__PURE__ */ O(
|
|
400
|
+
case "tags": return /* @__PURE__ */ O(S, {
|
|
356
401
|
...i,
|
|
357
402
|
required: r,
|
|
358
403
|
placeholder: e.placeholder,
|
|
359
404
|
max: e.max,
|
|
360
405
|
isDisabled: n,
|
|
361
|
-
value:
|
|
406
|
+
value: q(t),
|
|
362
407
|
onValueChange: a
|
|
363
408
|
});
|
|
364
|
-
case "date": return /* @__PURE__ */ O(
|
|
409
|
+
case "date": return /* @__PURE__ */ O(x, {
|
|
365
410
|
...i,
|
|
366
411
|
placeholder: e.placeholder,
|
|
367
412
|
min: e.min,
|
|
@@ -377,7 +422,7 @@ function pe({ field: e, stored: t, isDisabled: n, required: r, accessibility: i,
|
|
|
377
422
|
}
|
|
378
423
|
//#endregion
|
|
379
424
|
//#region src/components/FormEditor/control.tsx
|
|
380
|
-
function
|
|
425
|
+
function Se(e, t) {
|
|
381
426
|
if (e.type === "asset") {
|
|
382
427
|
let n = t.map((e) => ({ assetId: e }));
|
|
383
428
|
return e.multiple ? n : n[0];
|
|
@@ -385,8 +430,8 @@ function me(e, t) {
|
|
|
385
430
|
let n = t.map((e) => ({ entryId: e }));
|
|
386
431
|
return e.multiple ? n : n[0];
|
|
387
432
|
}
|
|
388
|
-
function
|
|
389
|
-
return /* @__PURE__ */ O(
|
|
433
|
+
function Ce({ field: e, stored: t, isDisabled: n, required: r, accessibility: i, onChange: a }) {
|
|
434
|
+
return /* @__PURE__ */ O(u, {
|
|
390
435
|
...i,
|
|
391
436
|
required: r,
|
|
392
437
|
isDisabled: n,
|
|
@@ -406,9 +451,9 @@ function he({ field: e, stored: t, isDisabled: n, required: r, accessibility: i,
|
|
|
406
451
|
}
|
|
407
452
|
});
|
|
408
453
|
}
|
|
409
|
-
function
|
|
454
|
+
function we({ field: e, stored: t, isDisabled: n, required: r, accessibility: i, onChange: a }) {
|
|
410
455
|
let o = !r && !e.options.some((e) => e.value === "");
|
|
411
|
-
return /* @__PURE__ */ O(
|
|
456
|
+
return /* @__PURE__ */ O(d, {
|
|
412
457
|
...i,
|
|
413
458
|
"aria-required": r || void 0,
|
|
414
459
|
isDisabled: n,
|
|
@@ -423,24 +468,24 @@ function ge({ field: e, stored: t, isDisabled: n, required: r, accessibility: i,
|
|
|
423
468
|
onValueChange: (e) => a(e === "" ? void 0 : e)
|
|
424
469
|
});
|
|
425
470
|
}
|
|
426
|
-
function
|
|
427
|
-
return /* @__PURE__ */ O(
|
|
471
|
+
function Te({ field: e, selected: t, items: n, isDisabled: r, accessibility: i, onChange: a }) {
|
|
472
|
+
return /* @__PURE__ */ O(l, {
|
|
428
473
|
...i,
|
|
429
474
|
items: n,
|
|
430
475
|
value: t,
|
|
431
|
-
...
|
|
432
|
-
mode: e
|
|
476
|
+
...z(e),
|
|
477
|
+
mode: N(e),
|
|
433
478
|
isDisabled: r,
|
|
434
|
-
onValueChange: (t) => a(
|
|
479
|
+
onValueChange: (t) => a(Se(e, t))
|
|
435
480
|
});
|
|
436
481
|
}
|
|
437
|
-
function
|
|
482
|
+
function Ee({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessibility: { required: l, ...u }, onChange: d }) {
|
|
438
483
|
let p = {
|
|
439
484
|
stored: t,
|
|
440
485
|
isDisabled: c,
|
|
441
486
|
required: l,
|
|
442
487
|
accessibility: u,
|
|
443
|
-
onChange:
|
|
488
|
+
onChange: d
|
|
444
489
|
};
|
|
445
490
|
switch (e.type) {
|
|
446
491
|
case "shortText": return /* @__PURE__ */ O(r, {
|
|
@@ -452,8 +497,8 @@ function ve({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessi
|
|
|
452
497
|
maxLength: e.maxLength,
|
|
453
498
|
readOnly: e.readOnly,
|
|
454
499
|
autoFocus: e.autoFocus,
|
|
455
|
-
value:
|
|
456
|
-
onChange: (e) =>
|
|
500
|
+
value: M(t),
|
|
501
|
+
onChange: (e) => d(e.target.value)
|
|
457
502
|
});
|
|
458
503
|
case "longText": return /* @__PURE__ */ O(n, {
|
|
459
504
|
...u,
|
|
@@ -464,19 +509,19 @@ function ve({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessi
|
|
|
464
509
|
maxLength: e.maxLength,
|
|
465
510
|
readOnly: e.readOnly,
|
|
466
511
|
autoFocus: e.autoFocus,
|
|
467
|
-
value:
|
|
468
|
-
onChange: (e) =>
|
|
512
|
+
value: M(t),
|
|
513
|
+
onChange: (e) => d(e.target.value)
|
|
469
514
|
});
|
|
470
|
-
case "number": return /* @__PURE__ */ O(
|
|
515
|
+
case "number": return /* @__PURE__ */ O(Ce, {
|
|
471
516
|
field: e,
|
|
472
517
|
...p
|
|
473
518
|
});
|
|
474
|
-
case "boolean": return /* @__PURE__ */ O(
|
|
519
|
+
case "boolean": return /* @__PURE__ */ O(f, {
|
|
475
520
|
...u,
|
|
476
521
|
isDisabled: c,
|
|
477
522
|
autoFocus: e.autoFocus,
|
|
478
523
|
isSelected: t === !0,
|
|
479
|
-
onSelectedChange:
|
|
524
|
+
onSelectedChange: d
|
|
480
525
|
});
|
|
481
526
|
case "dateTime": return /* @__PURE__ */ O(r, {
|
|
482
527
|
...u,
|
|
@@ -485,8 +530,8 @@ function ve({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessi
|
|
|
485
530
|
type: "datetime-local",
|
|
486
531
|
step: "0.001",
|
|
487
532
|
autoFocus: e.autoFocus,
|
|
488
|
-
value:
|
|
489
|
-
onChange: (e) =>
|
|
533
|
+
value: V(t)?.slice(0, -1) ?? "",
|
|
534
|
+
onChange: (e) => d(V(`${e.target.value}Z`))
|
|
490
535
|
});
|
|
491
536
|
case "richText": return /* @__PURE__ */ O(o, {
|
|
492
537
|
...u,
|
|
@@ -497,20 +542,20 @@ function ve({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessi
|
|
|
497
542
|
placeholder: e.placeholder,
|
|
498
543
|
format: "json",
|
|
499
544
|
value: t === void 0 ? a : t,
|
|
500
|
-
onChange:
|
|
545
|
+
onChange: d
|
|
501
546
|
});
|
|
502
|
-
case "select": return /* @__PURE__ */ O(
|
|
547
|
+
case "select": return /* @__PURE__ */ O(we, {
|
|
503
548
|
field: e,
|
|
504
549
|
...p
|
|
505
550
|
});
|
|
506
551
|
case "asset":
|
|
507
|
-
case "reference": return /* @__PURE__ */ O(
|
|
552
|
+
case "reference": return /* @__PURE__ */ O(Te, {
|
|
508
553
|
field: e,
|
|
509
554
|
items: s,
|
|
510
555
|
selected: i ?? [],
|
|
511
556
|
...p
|
|
512
557
|
});
|
|
513
|
-
default: return /* @__PURE__ */ O(
|
|
558
|
+
default: return /* @__PURE__ */ O(xe, {
|
|
514
559
|
field: e,
|
|
515
560
|
...p
|
|
516
561
|
});
|
|
@@ -518,26 +563,27 @@ function ve({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessi
|
|
|
518
563
|
}
|
|
519
564
|
//#endregion
|
|
520
565
|
//#region src/components/FormEditor/index.tsx
|
|
521
|
-
function
|
|
522
|
-
let l = T(() => a === void 0 && o ?
|
|
566
|
+
function De({ field: e, stored: n, items: r, isDisabled: i, error: a, isErrorVisible: o, onChange: c }) {
|
|
567
|
+
let l = T(() => a === void 0 && o ? Q(e, n) : void 0, [
|
|
523
568
|
a,
|
|
524
569
|
o,
|
|
525
570
|
e,
|
|
526
571
|
n
|
|
527
|
-
]), u = T(() => e.type === "asset" || e.type === "reference" ?
|
|
572
|
+
]), u = T(() => e.type === "asset" || e.type === "reference" ? B(e, n) : void 0, [e, n]);
|
|
528
573
|
return /* @__PURE__ */ O(s, {
|
|
529
574
|
width: e.width,
|
|
530
575
|
padded: !1,
|
|
531
576
|
center: !1,
|
|
532
577
|
className: "ds-form-editor__field",
|
|
533
578
|
children: /* @__PURE__ */ O(t, {
|
|
534
|
-
|
|
579
|
+
...le(e, n, u),
|
|
580
|
+
label: e.type === "dateTime" ? `${e.label} (UTC)` : R(e),
|
|
535
581
|
hint: e.hint,
|
|
536
582
|
error: a ?? l,
|
|
537
583
|
isRequired: e.required,
|
|
538
|
-
count: u?.length ?? (e.type === "checkboxGroup" ?
|
|
539
|
-
isGroup: u !== void 0 ||
|
|
540
|
-
children: (t) => /* @__PURE__ */ O(
|
|
584
|
+
count: u?.length ?? (e.type === "checkboxGroup" ? q(n).length : void 0),
|
|
585
|
+
isGroup: u !== void 0 || Oe.has(e.type),
|
|
586
|
+
children: (t) => /* @__PURE__ */ O(Ee, {
|
|
541
587
|
field: e,
|
|
542
588
|
stored: n,
|
|
543
589
|
selected: u,
|
|
@@ -549,19 +595,19 @@ function ye({ field: e, stored: n, items: r, isDisabled: i, error: a, isErrorVis
|
|
|
549
595
|
})
|
|
550
596
|
});
|
|
551
597
|
}
|
|
552
|
-
var
|
|
598
|
+
var Oe = /* @__PURE__ */ new Set([
|
|
553
599
|
"radioGroup",
|
|
554
600
|
"checkboxGroup",
|
|
555
601
|
"rangeSlider"
|
|
556
|
-
]),
|
|
602
|
+
]), ke = /* @__PURE__ */ new Set([
|
|
557
603
|
"slider",
|
|
558
604
|
"rangeSlider",
|
|
559
605
|
"date",
|
|
560
606
|
"colour"
|
|
561
607
|
]);
|
|
562
|
-
function
|
|
608
|
+
function Ae({ schema: e, value: t, defaultValue: n = {}, onValueChange: r, pickerItems: i = {}, errors: a = {}, isDisabled: o = !1, showAllErrors: s = !1, columns: c = 1, minColumnWidth: l = "16rem", className: u, style: d, ...f }) {
|
|
563
609
|
let [p, m] = E(n), [h, g] = E(() => /* @__PURE__ */ new Set()), _ = t ?? p;
|
|
564
|
-
T(() =>
|
|
610
|
+
T(() => A(e), [e]);
|
|
565
611
|
let v = (e, n) => {
|
|
566
612
|
let i = { ..._ };
|
|
567
613
|
n === void 0 ? delete i[e] : i[e] = n, t === void 0 && m(i), g((t) => new Set(t).add(e)), r?.(i, { fieldId: e });
|
|
@@ -582,8 +628,8 @@ function Se({ schema: e, value: t, defaultValue: n = {}, onValueChange: r, picke
|
|
|
582
628
|
...f,
|
|
583
629
|
children: e.fields.map((e) => {
|
|
584
630
|
if (e.type === "divider") return /* @__PURE__ */ O("hr", { className: "ds-form-editor__divider" }, e.id);
|
|
585
|
-
let t = Object.hasOwn(_, e.id) ? _[e.id] : void 0, n = o || !!e.isDisabled, r = n || "readOnly" in e && !!e.readOnly, c = typeof t == "string" ? t.trim() !== "" : t !== void 0, l = s || h.has(e.id) || c &&
|
|
586
|
-
return /* @__PURE__ */ O(
|
|
631
|
+
let t = Object.hasOwn(_, e.id) ? _[e.id] : void 0, n = o || !!e.isDisabled, r = n || "readOnly" in e && !!e.readOnly, c = typeof t == "string" ? t.trim() !== "" : t !== void 0, l = s || h.has(e.id) || c && ke.has(e.type) || e.type === "number" && typeof t == "number";
|
|
632
|
+
return /* @__PURE__ */ O(De, {
|
|
587
633
|
field: e,
|
|
588
634
|
stored: t,
|
|
589
635
|
items: i[e.id] ?? [],
|
|
@@ -598,6 +644,6 @@ function Se({ schema: e, value: t, defaultValue: n = {}, onValueChange: r, picke
|
|
|
598
644
|
});
|
|
599
645
|
}
|
|
600
646
|
//#endregion
|
|
601
|
-
export {
|
|
647
|
+
export { _e as n, Ae as t };
|
|
602
648
|
|
|
603
|
-
//# sourceMappingURL=FormEditor-
|
|
649
|
+
//# sourceMappingURL=FormEditor-BSfxVqLn.js.map
|