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