@namroodinc/liquid-editorial 0.4.0 → 0.5.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.
Files changed (174) hide show
  1. package/README.md +13 -5
  2. package/UPGRADING.md +152 -0
  3. package/dist/chunks/{Board-BaQ04nWg.cjs → Board-BPA6mVhf.cjs} +2 -2
  4. package/dist/chunks/{Board-BaQ04nWg.cjs.map → Board-BPA6mVhf.cjs.map} +1 -1
  5. package/dist/chunks/{Board-CUhF8pTX.js → Board-CcIF7jS0.js} +2 -2
  6. package/dist/chunks/{Board-CUhF8pTX.js.map → Board-CcIF7jS0.js.map} +1 -1
  7. package/dist/chunks/{ColourField-CJicr3OT.cjs → ColourField-BQ4a5tAV.cjs} +2 -2
  8. package/dist/chunks/{ColourField-CJicr3OT.cjs.map → ColourField-BQ4a5tAV.cjs.map} +1 -1
  9. package/dist/chunks/{ColourField-DjHRiFDU.js → ColourField-Doew1hLw.js} +3 -3
  10. package/dist/chunks/{ColourField-DjHRiFDU.js.map → ColourField-Doew1hLw.js.map} +1 -1
  11. package/dist/chunks/{DatePicker-aSlYLjtW.cjs → DatePicker-C0-609Zx.cjs} +2 -2
  12. package/dist/chunks/{DatePicker-aSlYLjtW.cjs.map → DatePicker-C0-609Zx.cjs.map} +1 -1
  13. package/dist/chunks/{DatePicker-D_6CQpUd.js → DatePicker-DmeWUsOS.js} +2 -2
  14. package/dist/chunks/{DatePicker-D_6CQpUd.js.map → DatePicker-DmeWUsOS.js.map} +1 -1
  15. package/dist/chunks/{FormEditor-M7tNidFo.js → FormEditor-DTnFO4oS.js} +172 -154
  16. package/dist/chunks/FormEditor-DTnFO4oS.js.map +1 -0
  17. package/dist/chunks/FormEditor-DfQLJnsO.cjs +2 -0
  18. package/dist/chunks/FormEditor-DfQLJnsO.cjs.map +1 -0
  19. package/dist/chunks/Icon-D1kx7-1c.js +81 -0
  20. package/dist/chunks/Icon-D1kx7-1c.js.map +1 -0
  21. package/dist/chunks/Icon-D38lQXNe.cjs +2 -0
  22. package/dist/chunks/Icon-D38lQXNe.cjs.map +1 -0
  23. package/dist/chunks/RichTextEditor-DEJ-u-ZR.js +483 -0
  24. package/dist/chunks/RichTextEditor-DEJ-u-ZR.js.map +1 -0
  25. package/dist/chunks/RichTextEditor-Ddk7qaqg.cjs +2 -0
  26. package/dist/chunks/RichTextEditor-Ddk7qaqg.cjs.map +1 -0
  27. package/dist/chunks/movableHost-CajG9_5Z.cjs +2 -0
  28. package/dist/chunks/movableHost-CajG9_5Z.cjs.map +1 -0
  29. package/dist/chunks/movableHost-NJj_FsAu.js +23 -0
  30. package/dist/chunks/movableHost-NJj_FsAu.js.map +1 -0
  31. package/dist/chunks/portalScope-AzzPM54i.js +105 -0
  32. package/dist/chunks/portalScope-AzzPM54i.js.map +1 -0
  33. package/dist/chunks/portalScope-BVA1-Ypu.cjs +2 -0
  34. package/dist/chunks/portalScope-BVA1-Ypu.cjs.map +1 -0
  35. package/dist/chunks/useModalDialog-BVaG--b3.js +87 -0
  36. package/dist/chunks/useModalDialog-BVaG--b3.js.map +1 -0
  37. package/dist/chunks/useModalDialog-Ctu270Dp.cjs +2 -0
  38. package/dist/chunks/useModalDialog-Ctu270Dp.cjs.map +1 -0
  39. package/dist/components/AssetCard/index.cjs +1 -1
  40. package/dist/components/AssetCard/index.js +1 -1
  41. package/dist/components/AssetGrid/index.cjs +1 -1
  42. package/dist/components/AssetGrid/index.js +1 -1
  43. package/dist/components/Board/index.cjs +1 -1
  44. package/dist/components/Board/index.js +1 -1
  45. package/dist/components/Button/index.cjs +1 -1
  46. package/dist/components/Button/index.js +1 -1
  47. package/dist/components/ColourField/index.cjs +1 -1
  48. package/dist/components/ColourField/index.js +1 -1
  49. package/dist/components/DatePicker/index.cjs +1 -1
  50. package/dist/components/DatePicker/index.js +1 -1
  51. package/dist/components/Drawer/index.cjs +1 -1
  52. package/dist/components/Drawer/index.cjs.map +1 -1
  53. package/dist/components/Drawer/index.d.cts.map +1 -1
  54. package/dist/components/Drawer/index.d.ts.map +1 -1
  55. package/dist/components/Drawer/index.js +59 -75
  56. package/dist/components/Drawer/index.js.map +1 -1
  57. package/dist/components/Drawer/style.css +3 -0
  58. package/dist/components/EditLayout/index.cjs +1 -1
  59. package/dist/components/EditLayout/index.cjs.map +1 -1
  60. package/dist/components/EditLayout/index.d.cts.map +1 -1
  61. package/dist/components/EditLayout/index.d.ts.map +1 -1
  62. package/dist/components/EditLayout/index.js +107 -121
  63. package/dist/components/EditLayout/index.js.map +1 -1
  64. package/dist/components/EntryPicker/index.cjs +1 -1
  65. package/dist/components/EntryPicker/index.js +1 -1
  66. package/dist/components/FormEditor/README.md +75 -4
  67. package/dist/components/FormEditor/control.d.cts.map +1 -1
  68. package/dist/components/FormEditor/control.d.ts.map +1 -1
  69. package/dist/components/FormEditor/index.cjs +1 -1
  70. package/dist/components/FormEditor/index.d.cts.map +1 -1
  71. package/dist/components/FormEditor/index.d.ts.map +1 -1
  72. package/dist/components/FormEditor/index.js +2 -1
  73. package/dist/components/FormEditor/model.d.cts +8 -0
  74. package/dist/components/FormEditor/model.d.cts.map +1 -1
  75. package/dist/components/FormEditor/model.d.ts +8 -0
  76. package/dist/components/FormEditor/model.d.ts.map +1 -1
  77. package/dist/components/FormEditor/style.css +7 -0
  78. package/dist/components/Icon/icons.d.cts +2 -0
  79. package/dist/components/Icon/icons.d.cts.map +1 -1
  80. package/dist/components/Icon/icons.d.ts +2 -0
  81. package/dist/components/Icon/icons.d.ts.map +1 -1
  82. package/dist/components/Icon/index.cjs +1 -1
  83. package/dist/components/Icon/index.js +1 -1
  84. package/dist/components/Modal/index.cjs +1 -1
  85. package/dist/components/Modal/index.cjs.map +1 -1
  86. package/dist/components/Modal/index.d.cts +9 -1
  87. package/dist/components/Modal/index.d.cts.map +1 -1
  88. package/dist/components/Modal/index.d.ts +9 -1
  89. package/dist/components/Modal/index.d.ts.map +1 -1
  90. package/dist/components/Modal/index.js +37 -45
  91. package/dist/components/Modal/index.js.map +1 -1
  92. package/dist/components/Modal/style.css +8 -1
  93. package/dist/components/Popover/index.cjs +1 -1
  94. package/dist/components/Popover/index.cjs.map +1 -1
  95. package/dist/components/Popover/index.d.cts.map +1 -1
  96. package/dist/components/Popover/index.d.ts.map +1 -1
  97. package/dist/components/Popover/index.js +44 -37
  98. package/dist/components/Popover/index.js.map +1 -1
  99. package/dist/components/Popover/style.css +3 -0
  100. package/dist/components/RichTextEditor/expanded-width.d.cts +4 -0
  101. package/dist/components/RichTextEditor/expanded-width.d.cts.map +1 -0
  102. package/dist/components/RichTextEditor/expanded-width.d.ts +4 -0
  103. package/dist/components/RichTextEditor/expanded-width.d.ts.map +1 -0
  104. package/dist/components/RichTextEditor/expansion.d.cts +28 -0
  105. package/dist/components/RichTextEditor/expansion.d.cts.map +1 -0
  106. package/dist/components/RichTextEditor/expansion.d.ts +28 -0
  107. package/dist/components/RichTextEditor/expansion.d.ts.map +1 -0
  108. package/dist/components/RichTextEditor/index.cjs +1 -1
  109. package/dist/components/RichTextEditor/index.d.cts +4 -4
  110. package/dist/components/RichTextEditor/index.d.cts.map +1 -1
  111. package/dist/components/RichTextEditor/index.d.ts +4 -4
  112. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  113. package/dist/components/RichTextEditor/index.js +1 -1
  114. package/dist/components/RichTextEditor/style.css +85 -4
  115. package/dist/components/SearchField/index.cjs +1 -1
  116. package/dist/components/SearchField/index.js +1 -1
  117. package/dist/components/Select/index.cjs +1 -1
  118. package/dist/components/Select/index.js +1 -1
  119. package/dist/components/SideNav/index.cjs +1 -1
  120. package/dist/components/SideNav/index.js +1 -1
  121. package/dist/components/SortableList/index.cjs +1 -1
  122. package/dist/components/SortableList/index.js +1 -1
  123. package/dist/components/Stepper/index.cjs +1 -1
  124. package/dist/components/Stepper/index.js +1 -1
  125. package/dist/components/SubNav/index.cjs +1 -1
  126. package/dist/components/SubNav/index.js +1 -1
  127. package/dist/components/Table/index.cjs +1 -1
  128. package/dist/components/Table/index.js +1 -1
  129. package/dist/components/Toast/index.cjs +1 -1
  130. package/dist/components/Toast/index.js +1 -1
  131. package/dist/components/TopNav/index.cjs +1 -1
  132. package/dist/components/TopNav/index.js +1 -1
  133. package/dist/index.cjs +1 -1
  134. package/dist/index.d.cts +1 -1
  135. package/dist/index.d.cts.map +1 -1
  136. package/dist/index.d.ts +1 -1
  137. package/dist/index.d.ts.map +1 -1
  138. package/dist/index.js +30 -30
  139. package/dist/internal/dialogFocus.d.cts +8 -0
  140. package/dist/internal/dialogFocus.d.cts.map +1 -1
  141. package/dist/internal/dialogFocus.d.ts +8 -0
  142. package/dist/internal/dialogFocus.d.ts.map +1 -1
  143. package/dist/internal/movableHost.d.cts +20 -0
  144. package/dist/internal/movableHost.d.cts.map +1 -0
  145. package/dist/internal/movableHost.d.ts +20 -0
  146. package/dist/internal/movableHost.d.ts.map +1 -0
  147. package/dist/internal/portalScope.d.cts +23 -0
  148. package/dist/internal/portalScope.d.cts.map +1 -0
  149. package/dist/internal/portalScope.d.ts +23 -0
  150. package/dist/internal/portalScope.d.ts.map +1 -0
  151. package/dist/internal/useModalDialog.d.cts +22 -0
  152. package/dist/internal/useModalDialog.d.cts.map +1 -0
  153. package/dist/internal/useModalDialog.d.ts +22 -0
  154. package/dist/internal/useModalDialog.d.ts.map +1 -0
  155. package/package.json +1 -1
  156. package/dist/chunks/FormEditor-M7tNidFo.js.map +0 -1
  157. package/dist/chunks/FormEditor-UzbPdiJo.cjs +0 -2
  158. package/dist/chunks/FormEditor-UzbPdiJo.cjs.map +0 -1
  159. package/dist/chunks/Icon-BBoWP_Y6.cjs +0 -2
  160. package/dist/chunks/Icon-BBoWP_Y6.cjs.map +0 -1
  161. package/dist/chunks/Icon-XNismJDm.js +0 -79
  162. package/dist/chunks/Icon-XNismJDm.js.map +0 -1
  163. package/dist/chunks/RichTextEditor-C7nMfDmE.cjs +0 -2
  164. package/dist/chunks/RichTextEditor-C7nMfDmE.cjs.map +0 -1
  165. package/dist/chunks/RichTextEditor-DjR10XJ-.js +0 -370
  166. package/dist/chunks/RichTextEditor-DjR10XJ-.js.map +0 -1
  167. package/dist/chunks/dialogFocus-B9iqKl3I.cjs +0 -2
  168. package/dist/chunks/dialogFocus-B9iqKl3I.cjs.map +0 -1
  169. package/dist/chunks/dialogFocus-BFoyeTpA.js +0 -48
  170. package/dist/chunks/dialogFocus-BFoyeTpA.js.map +0 -1
  171. package/dist/chunks/dialogStack-6yv3NXFD.js +0 -43
  172. package/dist/chunks/dialogStack-6yv3NXFD.js.map +0 -1
  173. package/dist/chunks/dialogStack-C9SLVu6Q.cjs +0 -2
  174. package/dist/chunks/dialogStack-C9SLVu6Q.cjs.map +0 -1
@@ -1,21 +1,26 @@
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-DjR10XJ-.js";
5
- import { EntryPicker as s } from "../components/EntryPicker/index.js";
6
- import { NumberField as c } from "../components/NumberField/index.js";
7
- import { Select as l } from "../components/Select/index.js";
8
- import { Switch as u } from "../components/Switch/index.js";
9
- import { r as d, t as f } from "./ColourField-DjHRiFDU.js";
10
- import { a as p, i as m, n as h, r as g, t as _ } from "./Slider-vdMFLX-H.js";
11
- import { a as v, n as y } from "./DatePicker-D_6CQpUd.js";
12
- import { TagsInput as b } from "../components/TagsInput/index.js";
13
- import { Checkbox as ee, ChoiceGroup as te, Radio as x } from "../components/Choice/index.js";
14
- import { CheckboxCard as S, RadioCard as C, SelectionCardGroup as w } from "../components/SelectionCard/index.js";
4
+ import { n as i, r as a, t as o } from "./RichTextEditor-DEJ-u-ZR.js";
5
+ import { Container as s } from "../components/Container/index.js";
6
+ import { EntryPicker as c } from "../components/EntryPicker/index.js";
7
+ import { NumberField as l } from "../components/NumberField/index.js";
8
+ import { Select as u } from "../components/Select/index.js";
9
+ import { Switch as d } from "../components/Switch/index.js";
10
+ import { r as f, t as p } from "./ColourField-Doew1hLw.js";
11
+ import { a as m, i as h, n as g, r as _, t as v } from "./Slider-vdMFLX-H.js";
12
+ import { a as y, n as ee } from "./DatePicker-DmeWUsOS.js";
13
+ import { TagsInput as te } from "../components/TagsInput/index.js";
14
+ import { Checkbox as b, ChoiceGroup as x, Radio as S } from "../components/Choice/index.js";
15
+ import { CheckboxCard as C, RadioCard as w, SelectionCardGroup as ne } from "../components/SelectionCard/index.js";
15
16
  import { useMemo as T, useState as E } from "react";
16
17
  import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
17
- //#region src/components/FormEditor/model.ts
18
- var A = /* @__PURE__ */ new Set([
18
+ //#region src/components/RichTextEditor/expanded-width.ts
19
+ var A = ["wide", "full"], j = [
20
+ "sm",
21
+ "md",
22
+ "lg"
23
+ ], M = /* @__PURE__ */ new Set([
19
24
  "shortText",
20
25
  "longText",
21
26
  "richText",
@@ -34,24 +39,28 @@ var A = /* @__PURE__ */ new Set([
34
39
  "date",
35
40
  "divider"
36
41
  ]);
37
- function j(e) {
42
+ function N(e) {
38
43
  let t = /* @__PURE__ */ new Set();
39
44
  for (let n of e.fields) {
40
45
  if (!n.id?.trim() || t.has(n.id)) throw Error("Form field IDs must be nonempty and unique.");
41
- if (!A.has(n.type)) throw Error(`Unsupported form field type: ${n.type}`);
42
- (n.type === "select" || n.type === "radioGroup" || n.type === "checkboxGroup") && N(n), (n.type === "slider" || n.type === "rangeSlider") && M(n), t.add(n.id);
46
+ if (!M.has(n.type)) throw Error(`Unsupported form field type: ${n.type}`);
47
+ (n.type === "select" || n.type === "radioGroup" || n.type === "checkboxGroup") && ie(n), (n.type === "slider" || n.type === "rangeSlider") && re(n), n.type !== "divider" && P(n), t.add(n.id);
43
48
  }
44
49
  }
45
- function M(e) {
46
- let { min: t, max: n, step: r } = p(e);
50
+ function P(e) {
51
+ if (e.width !== void 0 && !j.includes(e.width)) throw Error(`Field ${e.id} needs a width of sm, md or lg.`);
52
+ if (e.type === "richText" && e.expandedWidth !== void 0 && !A.includes(e.expandedWidth)) throw Error(`Rich text field ${e.id} needs an expandedWidth of wide or full.`);
53
+ }
54
+ function re(e) {
55
+ let { min: t, max: n, step: r } = m(e);
47
56
  if (![
48
57
  t,
49
58
  n,
50
59
  r
51
60
  ].every(Number.isFinite) || t >= n || r <= 0) throw Error(`Slider field ${e.id} needs finite min < max and a positive step.`);
52
- if (e.type === "rangeSlider" && r > m(n, -t)) throw Error(`Range slider ${e.id} needs room for at least one step.`);
61
+ if (e.type === "rangeSlider" && r > h(n, -t)) throw Error(`Range slider ${e.id} needs room for at least one step.`);
53
62
  }
54
- function N(e) {
63
+ function ie(e) {
55
64
  if (!Array.isArray(e.options)) {
56
65
  let t = e.type === "select" ? "Select" : "Choice";
57
66
  throw Error(`${t} field ${e.id} needs an options array.`);
@@ -60,7 +69,7 @@ function N(e) {
60
69
  let t = e.options.map((e) => e.value);
61
70
  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.`);
62
71
  }
63
- var P = {
72
+ var F = {
64
73
  asset: {
65
74
  key: "assetId",
66
75
  itemLabel: "asset",
@@ -72,11 +81,11 @@ var P = {
72
81
  itemsLabel: "entries"
73
82
  }
74
83
  };
75
- function F(e) {
84
+ function I(e) {
76
85
  return e.type === "asset" || e.type === "reference" ? e.picker?.label ?? e.label : e.label;
77
86
  }
78
- function I(e) {
79
- let t = P[e.type], { addLabel: n = `Choose ${F(e)}`, emptyLabel: r, itemLabel: i = t.itemLabel, itemsLabel: a = t.itemsLabel, max: o, isReorderable: s } = e.picker ?? {};
87
+ function L(e) {
88
+ let t = F[e.type], { addLabel: n = `Choose ${I(e)}`, emptyLabel: r, itemLabel: i = t.itemLabel, itemsLabel: a = t.itemsLabel, max: o, isReorderable: s } = e.picker ?? {};
80
89
  return {
81
90
  addLabel: n,
82
91
  emptyLabel: r,
@@ -86,70 +95,70 @@ function I(e) {
86
95
  isReorderable: s
87
96
  };
88
97
  }
89
- function ne(e, t) {
90
- let { key: n } = P[e.type];
91
- return (Array.isArray(t) ? t : t === void 0 ? [] : [t]).flatMap((e) => R(e, n) ? [e[n]] : []);
98
+ function R(e, t) {
99
+ let { key: n } = F[e.type];
100
+ return (Array.isArray(t) ? t : t === void 0 ? [] : [t]).flatMap((e) => B(e, n) ? [e[n]] : []);
92
101
  }
93
- function L(e) {
102
+ function z(e) {
94
103
  if (typeof e != "string") return;
95
104
  let t = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?(?:Z|\+00:00)$/.exec(e);
96
105
  if (!t) return;
97
106
  let n = `${t[1]}:${t[2] ?? "00"}.${(t[3] ?? "").padEnd(3, "0")}Z`, r = new Date(n);
98
107
  if (Number.isFinite(r.getTime()) && r.toISOString() === n) return n;
99
108
  }
100
- function R(e, t) {
109
+ function B(e, t) {
101
110
  return !!e && typeof e == "object" && t in e && typeof e[t] == "string" && e[t].trim().length > 0;
102
111
  }
103
- function z(e) {
104
- return !!e.text?.trim() || e.type === "horizontalRule" || !!e.content?.some(z);
112
+ function V(e) {
113
+ return !!e.text?.trim() || e.type === "horizontalRule" || !!e.content?.some(V);
105
114
  }
106
- function B(e) {
107
- return `${F(e)} is required.`;
115
+ function H(e) {
116
+ return `${I(e)} is required.`;
108
117
  }
109
- function V(e, t) {
118
+ function U(e, t) {
110
119
  if (typeof t != "string") return "Enter text.";
111
- if (e.required && !t.trim()) return B(e);
120
+ if (e.required && !t.trim()) return H(e);
112
121
  if ((e.type === "shortText" || e.type === "longText") && e.maxLength !== void 0 && t.length > e.maxLength) return `Enter no more than ${e.maxLength} characters.`;
113
122
  }
114
- function H(e, t) {
123
+ function W(e, t) {
115
124
  let n = i(t);
116
125
  if (n) return n;
117
- if (e.required && !z(t)) return B(e);
126
+ if (e.required && !V(t)) return H(e);
118
127
  }
119
- function U(e, t) {
128
+ function G(e, t) {
120
129
  if (typeof t != "string") return "Choose an available option.";
121
- if (t === "") return e.required ? B(e) : void 0;
130
+ if (t === "") return e.required ? H(e) : void 0;
122
131
  if ((e.type === "select" || e.type === "radioGroup") && e.options.length > 0 && !e.options.some((e) => e.value === t)) return "Choose an available option.";
123
132
  }
124
- function W(e) {
133
+ function K(e) {
125
134
  return Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
126
135
  }
127
- function G(e, t) {
136
+ function q(e, t) {
128
137
  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.";
129
- if (e.required && !t.length) return B(e);
138
+ if (e.required && !t.length) return H(e);
130
139
  if (e.type === "tags" && e.max !== void 0 && t.length > e.max) return `Enter no more than ${e.max} tags.`;
131
140
  if (e.type === "checkboxGroup" && e.options.length && t.some((t) => !e.options.some((e) => e.value === t))) return "Choose available options.";
132
141
  }
133
- function K(e, t) {
142
+ function J(e, t) {
134
143
  if (typeof t != "number" || !Number.isFinite(t)) return "Enter a finite number.";
135
- let { min: n, max: r } = e.type === "slider" || e.type === "rangeSlider" ? p(e) : e.type === "number" ? e : {};
144
+ let { min: n, max: r } = e.type === "slider" || e.type === "rangeSlider" ? m(e) : e.type === "number" ? e : {};
136
145
  if (n !== void 0 && t < n) return `Enter a number of at least ${n}.`;
137
146
  if (r !== void 0 && t > r) return `Enter a number no greater than ${r}.`;
138
147
  }
139
- function q(e, t) {
148
+ function Y(e, t) {
140
149
  if (typeof t != "string") return "Enter a valid calendar date (YYYY-MM-DD).";
141
- if (!t) return e.required ? B(e) : void 0;
142
- if (!v(t)) return "Enter a valid calendar date (YYYY-MM-DD).";
150
+ if (!t) return e.required ? H(e) : void 0;
151
+ if (!y(t)) return "Enter a valid calendar date (YYYY-MM-DD).";
143
152
  if (e.type === "date") {
144
153
  if (e.min && t < e.min) return `Choose a date on or after ${e.min}.`;
145
154
  if (e.max && t > e.max) return `Choose a date on or before ${e.max}.`;
146
155
  }
147
156
  }
148
- function J(e, t) {
149
- return typeof e == "number" && Number.isFinite(e) ? g(e, t) : void 0;
157
+ function X(e, t) {
158
+ return typeof e == "number" && Number.isFinite(e) ? _(e, t) : void 0;
150
159
  }
151
- function Y(e, t) {
152
- let n = e, r = J(n?.min, t), i = J(n?.max, t);
160
+ function Z(e, t) {
161
+ let n = e, r = X(n?.min, t), i = X(n?.max, t);
153
162
  if (r === void 0 && i === void 0) return;
154
163
  let [a, o] = [r ?? t.min, i ?? t.max].sort((e, t) => e - t);
155
164
  return {
@@ -157,56 +166,56 @@ function Y(e, t) {
157
166
  max: o
158
167
  };
159
168
  }
160
- function X(e, t) {
169
+ function ae(e, t) {
161
170
  if (!t || typeof t != "object" || Array.isArray(t)) return "Enter a range.";
162
- let n = t, r = n.min, i = n.max, a = K(e, r) ?? K(e, i);
171
+ let n = t, r = n.min, i = n.max, a = J(e, r) ?? J(e, i);
163
172
  if (a) return a;
164
173
  if (r > i) return "The start must not be greater than the end.";
165
- if (e.type === "rangeSlider" && m(i, -r) < p(e).step) return "Keep the range endpoints at least one step apart.";
174
+ if (e.type === "rangeSlider" && h(i, -r) < m(e).step) return "Keep the range endpoints at least one step apart.";
166
175
  }
167
- function re(e, t) {
168
- return typeof t == "string" ? t.trim() ? d(t) ? void 0 : "Enter a valid colour." : e.required ? B(e) : void 0 : "Enter a valid colour.";
176
+ function oe(e, t) {
177
+ return typeof t == "string" ? t.trim() ? f(t) ? void 0 : "Enter a valid colour." : e.required ? H(e) : void 0 : "Enter a valid colour.";
169
178
  }
170
- function Z(e, t) {
179
+ function Q(e, t) {
171
180
  if (e.type !== "asset" && e.type !== "reference") return;
172
- let { key: n, itemLabel: r, itemsLabel: i } = P[e.type];
173
- if (!e.multiple) return R(t, n) ? void 0 : `Choose an ${r}.`;
174
- if (!Array.isArray(t) || !t.every((e) => R(e, n))) return `Choose a list of ${i}.`;
175
- if (e.required && t.length === 0) return B(e);
181
+ let { key: n, itemLabel: r, itemsLabel: i } = F[e.type];
182
+ if (!e.multiple) return B(t, n) ? void 0 : `Choose an ${r}.`;
183
+ if (!Array.isArray(t) || !t.every((e) => B(e, n))) return `Choose a list of ${i}.`;
184
+ if (e.required && t.length === 0) return H(e);
176
185
  let a = e.picker?.max;
177
- if (a !== void 0 && t.length > a) return `Choose no more than ${a} ${I(e).itemsLabel}.`;
178
- }
179
- var ie = {
180
- shortText: V,
181
- longText: V,
182
- richText: H,
183
- number: K,
184
- slider: K,
185
- rangeSlider: X,
186
- date: q,
187
- colour: re,
188
- radioGroup: U,
189
- checkboxGroup: G,
190
- tags: G,
186
+ if (a !== void 0 && t.length > a) return `Choose no more than ${a} ${L(e).itemsLabel}.`;
187
+ }
188
+ var se = {
189
+ shortText: U,
190
+ longText: U,
191
+ richText: W,
192
+ number: J,
193
+ slider: J,
194
+ rangeSlider: ae,
195
+ date: Y,
196
+ colour: oe,
197
+ radioGroup: G,
198
+ checkboxGroup: q,
199
+ tags: q,
191
200
  boolean: (e, t) => typeof t == "boolean" ? void 0 : "Choose a boolean value.",
192
- dateTime: (e, t) => L(t) ? void 0 : "Enter a valid UTC date and time.",
193
- select: U,
194
- asset: Z,
195
- reference: Z
201
+ dateTime: (e, t) => z(t) ? void 0 : "Enter a valid UTC date and time.",
202
+ select: G,
203
+ asset: Q,
204
+ reference: Q
196
205
  };
197
- function Q(e, t) {
198
- return t === void 0 ? e.required ? B(e) : void 0 : ie[e.type](e, t);
206
+ function $(e, t) {
207
+ return t === void 0 ? e.required ? H(e) : void 0 : se[e.type](e, t);
199
208
  }
200
- function ae(e, t) {
201
- return j(e), Object.fromEntries(e.fields.flatMap((e) => {
209
+ function ce(e, t) {
210
+ return N(e), Object.fromEntries(e.fields.flatMap((e) => {
202
211
  if (e.type === "divider") return [];
203
- let n = Q(e, Object.hasOwn(t, e.id) ? t[e.id] : void 0);
212
+ let n = $(e, Object.hasOwn(t, e.id) ? t[e.id] : void 0);
204
213
  return n ? [[e.id, n]] : [];
205
214
  }));
206
215
  }
207
216
  //#endregion
208
217
  //#region src/components/FormEditor/choice-control.tsx
209
- function oe({ field: e, option: t, name: n, checked: r, isDisabled: i, invalid: a, onChange: o }) {
218
+ function le({ field: e, option: t, name: n, checked: r, isDisabled: i, invalid: a, onChange: o }) {
210
219
  let s = {
211
220
  name: n,
212
221
  value: t.value,
@@ -218,14 +227,14 @@ function oe({ field: e, option: t, name: n, checked: r, isDisabled: i, invalid:
218
227
  }
219
228
  };
220
229
  if (e.appearance === "card") {
221
- let n = e.type === "radioGroup" ? C : S;
230
+ let n = e.type === "radioGroup" ? w : C;
222
231
  return /* @__PURE__ */ O(n, {
223
232
  ...s,
224
233
  title: t.label,
225
234
  description: t.description
226
235
  });
227
236
  }
228
- let c = e.type === "radioGroup" ? x : ee;
237
+ let c = e.type === "radioGroup" ? S : b;
229
238
  return /* @__PURE__ */ O(c, {
230
239
  ...s,
231
240
  children: /* @__PURE__ */ k("span", { children: [t.label, t.description && /* @__PURE__ */ O("span", {
@@ -234,13 +243,13 @@ function oe({ field: e, option: t, name: n, checked: r, isDisabled: i, invalid:
234
243
  })] })
235
244
  });
236
245
  }
237
- function se({ field: t, stored: n, isDisabled: r, required: i, accessibility: a, onChange: o }) {
238
- let s = t.type === "checkboxGroup", c = s ? W(n) : typeof n == "string" && n ? [n] : [], l = t.appearance === "card" ? w : te;
246
+ function ue({ field: t, stored: n, isDisabled: r, required: i, accessibility: a, onChange: o }) {
247
+ let s = t.type === "checkboxGroup", c = s ? K(n) : typeof n == "string" && n ? [n] : [], l = t.appearance === "card" ? ne : x;
239
248
  return /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(l, {
240
249
  ...a,
241
250
  label: t.label,
242
251
  columns: t.columns ?? (t.appearance === "card" ? 2 : 1),
243
- children: t.options.map((e) => /* @__PURE__ */ O(oe, {
252
+ children: t.options.map((e) => /* @__PURE__ */ O(le, {
244
253
  field: t,
245
254
  option: e,
246
255
  name: a.id,
@@ -261,9 +270,9 @@ function se({ field: t, stored: n, isDisabled: r, required: i, accessibility: a,
261
270
  }
262
271
  //#endregion
263
272
  //#region src/components/FormEditor/additional-control.tsx
264
- function ce({ field: e, stored: t, isDisabled: n, accessibility: r, onChange: i }) {
265
- let a = p(e), o = J(t, a);
266
- return /* @__PURE__ */ O(h, {
273
+ function de({ field: e, stored: t, isDisabled: n, accessibility: r, onChange: i }) {
274
+ let a = m(e), o = X(t, a);
275
+ return /* @__PURE__ */ O(g, {
267
276
  ...r,
268
277
  ...a,
269
278
  prefix: e.prefix,
@@ -279,9 +288,9 @@ function ce({ field: e, stored: t, isDisabled: n, accessibility: r, onChange: i
279
288
  }
280
289
  });
281
290
  }
282
- function $({ field: e, stored: t, isDisabled: n, accessibility: r, onChange: i }) {
283
- let a = p(e), o = Y(t, a);
284
- return /* @__PURE__ */ O(_, {
291
+ function fe({ field: e, stored: t, isDisabled: n, accessibility: r, onChange: i }) {
292
+ let a = m(e), o = Z(t, a);
293
+ return /* @__PURE__ */ O(v, {
285
294
  ...r,
286
295
  ...a,
287
296
  prefix: e.prefix,
@@ -302,7 +311,7 @@ function $({ field: e, stored: t, isDisabled: n, accessibility: r, onChange: i }
302
311
  }
303
312
  });
304
313
  }
305
- function le({ field: e, stored: t, isDisabled: n, required: r, accessibility: i, onChange: a }) {
314
+ function pe({ field: e, stored: t, isDisabled: n, required: r, accessibility: i, onChange: a }) {
306
315
  let o = {
307
316
  stored: t,
308
317
  isDisabled: n,
@@ -312,19 +321,19 @@ function le({ field: e, stored: t, isDisabled: n, required: r, accessibility: i,
312
321
  };
313
322
  switch (e.type) {
314
323
  case "radioGroup":
315
- case "checkboxGroup": return /* @__PURE__ */ O(se, {
324
+ case "checkboxGroup": return /* @__PURE__ */ O(ue, {
316
325
  field: e,
317
326
  ...o
318
327
  });
319
- case "rangeSlider": return /* @__PURE__ */ O($, {
328
+ case "rangeSlider": return /* @__PURE__ */ O(fe, {
320
329
  field: e,
321
330
  ...o
322
331
  });
323
- case "slider": return /* @__PURE__ */ O(ce, {
332
+ case "slider": return /* @__PURE__ */ O(de, {
324
333
  field: e,
325
334
  ...o
326
335
  });
327
- case "colour": return /* @__PURE__ */ O(f, {
336
+ case "colour": return /* @__PURE__ */ O(p, {
328
337
  ...i,
329
338
  required: r,
330
339
  placeholder: e.placeholder,
@@ -338,20 +347,20 @@ function le({ field: e, stored: t, isDisabled: n, required: r, accessibility: i,
338
347
  value: typeof t == "string" ? t : "",
339
348
  onInput: (e) => {
340
349
  let t = e.currentTarget.value;
341
- t.trim() && !d(t) && a(t);
350
+ t.trim() && !f(t) && a(t);
342
351
  },
343
352
  onValueChange: (e) => a(e === "" ? void 0 : e)
344
353
  });
345
- case "tags": return /* @__PURE__ */ O(b, {
354
+ case "tags": return /* @__PURE__ */ O(te, {
346
355
  ...i,
347
356
  required: r,
348
357
  placeholder: e.placeholder,
349
358
  max: e.max,
350
359
  isDisabled: n,
351
- value: W(t),
360
+ value: K(t),
352
361
  onValueChange: a
353
362
  });
354
- case "date": return /* @__PURE__ */ O(y, {
363
+ case "date": return /* @__PURE__ */ O(ee, {
355
364
  ...i,
356
365
  placeholder: e.placeholder,
357
366
  min: e.min,
@@ -367,7 +376,7 @@ function le({ field: e, stored: t, isDisabled: n, required: r, accessibility: i,
367
376
  }
368
377
  //#endregion
369
378
  //#region src/components/FormEditor/control.tsx
370
- function ue(e, t) {
379
+ function me(e, t) {
371
380
  if (e.type === "asset") {
372
381
  let n = t.map((e) => ({ assetId: e }));
373
382
  return e.multiple ? n : n[0];
@@ -375,8 +384,8 @@ function ue(e, t) {
375
384
  let n = t.map((e) => ({ entryId: e }));
376
385
  return e.multiple ? n : n[0];
377
386
  }
378
- function de({ field: e, stored: t, isDisabled: n, required: r, accessibility: i, onChange: a }) {
379
- return /* @__PURE__ */ O(c, {
387
+ function he({ field: e, stored: t, isDisabled: n, required: r, accessibility: i, onChange: a }) {
388
+ return /* @__PURE__ */ O(l, {
380
389
  ...i,
381
390
  required: r,
382
391
  isDisabled: n,
@@ -385,6 +394,8 @@ function de({ field: e, stored: t, isDisabled: n, required: r, accessibility: i,
385
394
  max: e.max,
386
395
  step: e.step ?? "any",
387
396
  hasSteppers: e.hasSteppers ?? !1,
397
+ prefix: e.prefix,
398
+ suffix: e.suffix,
388
399
  autoFocus: e.autoFocus,
389
400
  decreaseLabel: `Decrease ${e.label}`,
390
401
  increaseLabel: `Increase ${e.label}`,
@@ -394,9 +405,9 @@ function de({ field: e, stored: t, isDisabled: n, required: r, accessibility: i,
394
405
  }
395
406
  });
396
407
  }
397
- function fe({ field: e, stored: t, isDisabled: n, required: r, accessibility: i, onChange: a }) {
408
+ function ge({ field: e, stored: t, isDisabled: n, required: r, accessibility: i, onChange: a }) {
398
409
  let o = !r && !e.options.some((e) => e.value === "");
399
- return /* @__PURE__ */ O(l, {
410
+ return /* @__PURE__ */ O(u, {
400
411
  ...i,
401
412
  "aria-required": r || void 0,
402
413
  isDisabled: n,
@@ -411,28 +422,28 @@ function fe({ field: e, stored: t, isDisabled: n, required: r, accessibility: i,
411
422
  onValueChange: (e) => a(e === "" ? void 0 : e)
412
423
  });
413
424
  }
414
- function pe({ field: e, selected: t, items: n, isDisabled: r, accessibility: i, onChange: a }) {
415
- return /* @__PURE__ */ O(s, {
425
+ function _e({ field: e, selected: t, items: n, isDisabled: r, accessibility: i, onChange: a }) {
426
+ return /* @__PURE__ */ O(c, {
416
427
  ...i,
417
428
  items: n,
418
429
  value: t,
419
- ...I(e),
430
+ ...L(e),
420
431
  mode: e.multiple ? "multiple" : "single",
421
432
  isDisabled: r,
422
- onValueChange: (t) => a(ue(e, t))
433
+ onValueChange: (t) => a(me(e, t))
423
434
  });
424
435
  }
425
- function me({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessibility: { required: l, ...d }, onChange: f }) {
436
+ function ve({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessibility: { required: l, ...u }, onChange: f }) {
426
437
  let p = {
427
438
  stored: t,
428
439
  isDisabled: c,
429
440
  required: l,
430
- accessibility: d,
441
+ accessibility: u,
431
442
  onChange: f
432
443
  };
433
444
  switch (e.type) {
434
445
  case "shortText": return /* @__PURE__ */ O(r, {
435
- ...d,
446
+ ...u,
436
447
  required: l,
437
448
  disabled: c,
438
449
  placeholder: e.placeholder,
@@ -444,7 +455,7 @@ function me({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessi
444
455
  onChange: (e) => f(e.target.value)
445
456
  });
446
457
  case "longText": return /* @__PURE__ */ O(n, {
447
- ...d,
458
+ ...u,
448
459
  required: l,
449
460
  disabled: c,
450
461
  placeholder: e.placeholder,
@@ -455,29 +466,30 @@ function me({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessi
455
466
  value: typeof t == "string" ? t : "",
456
467
  onChange: (e) => f(e.target.value)
457
468
  });
458
- case "number": return /* @__PURE__ */ O(de, {
469
+ case "number": return /* @__PURE__ */ O(he, {
459
470
  field: e,
460
471
  ...p
461
472
  });
462
- case "boolean": return /* @__PURE__ */ O(u, {
463
- ...d,
473
+ case "boolean": return /* @__PURE__ */ O(d, {
474
+ ...u,
464
475
  isDisabled: c,
465
476
  autoFocus: e.autoFocus,
466
477
  isSelected: t === !0,
467
478
  onSelectedChange: f
468
479
  });
469
480
  case "dateTime": return /* @__PURE__ */ O(r, {
470
- ...d,
481
+ ...u,
471
482
  required: l,
472
483
  disabled: c,
473
484
  type: "datetime-local",
474
485
  step: "0.001",
475
486
  autoFocus: e.autoFocus,
476
- value: L(t)?.slice(0, -1) ?? "",
477
- onChange: (e) => f(L(`${e.target.value}Z`))
487
+ value: z(t)?.slice(0, -1) ?? "",
488
+ onChange: (e) => f(z(`${e.target.value}Z`))
478
489
  });
479
490
  case "richText": return /* @__PURE__ */ O(o, {
480
- ...d,
491
+ ...u,
492
+ expandedWidth: e.expandedWidth,
481
493
  label: e.label,
482
494
  isRequired: l,
483
495
  isDisabled: c,
@@ -486,18 +498,18 @@ function me({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessi
486
498
  value: t === void 0 ? a : t,
487
499
  onChange: f
488
500
  });
489
- case "select": return /* @__PURE__ */ O(fe, {
501
+ case "select": return /* @__PURE__ */ O(ge, {
490
502
  field: e,
491
503
  ...p
492
504
  });
493
505
  case "asset":
494
- case "reference": return /* @__PURE__ */ O(pe, {
506
+ case "reference": return /* @__PURE__ */ O(_e, {
495
507
  field: e,
496
508
  items: s,
497
509
  selected: i ?? [],
498
510
  ...p
499
511
  });
500
- default: return /* @__PURE__ */ O(le, {
512
+ default: return /* @__PURE__ */ O(pe, {
501
513
  field: e,
502
514
  ...p
503
515
  });
@@ -505,44 +517,50 @@ function me({ field: e, stored: t, selected: i, items: s, isDisabled: c, accessi
505
517
  }
506
518
  //#endregion
507
519
  //#region src/components/FormEditor/index.tsx
508
- function he({ field: e, stored: n, items: r, isDisabled: i, error: a, isErrorVisible: o, onChange: s }) {
509
- let c = T(() => a === void 0 && o ? Q(e, n) : void 0, [
520
+ function ye({ field: e, stored: n, items: r, isDisabled: i, error: a, isErrorVisible: o, onChange: c }) {
521
+ let l = T(() => a === void 0 && o ? $(e, n) : void 0, [
510
522
  a,
511
523
  o,
512
524
  e,
513
525
  n
514
- ]), l = T(() => e.type === "asset" || e.type === "reference" ? ne(e, n) : void 0, [e, n]);
515
- return /* @__PURE__ */ O(t, {
516
- label: e.type === "dateTime" ? `${e.label} (UTC)` : F(e),
517
- hint: e.hint,
518
- error: a ?? c,
519
- isRequired: e.required,
520
- count: l?.length ?? (e.type === "checkboxGroup" ? W(n).length : void 0),
521
- isGroup: l !== void 0 || ge.has(e.type),
522
- children: (t) => /* @__PURE__ */ O(me, {
523
- field: e,
524
- stored: n,
525
- selected: l,
526
- items: r,
527
- isDisabled: i,
528
- accessibility: t,
529
- onChange: s
526
+ ]), u = T(() => e.type === "asset" || e.type === "reference" ? R(e, n) : void 0, [e, n]);
527
+ return /* @__PURE__ */ O(s, {
528
+ width: e.width,
529
+ padded: !1,
530
+ center: !1,
531
+ className: "ds-form-editor__field",
532
+ children: /* @__PURE__ */ O(t, {
533
+ label: e.type === "dateTime" ? `${e.label} (UTC)` : I(e),
534
+ hint: e.hint,
535
+ error: a ?? l,
536
+ isRequired: e.required,
537
+ count: u?.length ?? (e.type === "checkboxGroup" ? K(n).length : void 0),
538
+ isGroup: u !== void 0 || be.has(e.type),
539
+ children: (t) => /* @__PURE__ */ O(ve, {
540
+ field: e,
541
+ stored: n,
542
+ selected: u,
543
+ items: r,
544
+ isDisabled: i,
545
+ accessibility: t,
546
+ onChange: c
547
+ })
530
548
  })
531
549
  });
532
550
  }
533
- var ge = /* @__PURE__ */ new Set([
551
+ var be = /* @__PURE__ */ new Set([
534
552
  "radioGroup",
535
553
  "checkboxGroup",
536
554
  "rangeSlider"
537
- ]), _e = /* @__PURE__ */ new Set([
555
+ ]), xe = /* @__PURE__ */ new Set([
538
556
  "slider",
539
557
  "rangeSlider",
540
558
  "date",
541
559
  "colour"
542
560
  ]);
543
- function ve({ 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 }) {
561
+ function Se({ 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 }) {
544
562
  let [p, m] = E(n), [h, g] = E(() => /* @__PURE__ */ new Set()), _ = t ?? p;
545
- T(() => j(e), [e]);
563
+ T(() => N(e), [e]);
546
564
  let v = (e, n) => {
547
565
  let i = { ..._ };
548
566
  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 });
@@ -563,8 +581,8 @@ function ve({ schema: e, value: t, defaultValue: n = {}, onValueChange: r, picke
563
581
  ...f,
564
582
  children: e.fields.map((e) => {
565
583
  if (e.type === "divider") return /* @__PURE__ */ O("hr", { className: "ds-form-editor__divider" }, e.id);
566
- 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 && _e.has(e.type) || e.type === "number" && typeof t == "number";
567
- return /* @__PURE__ */ O(he, {
584
+ 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 && xe.has(e.type) || e.type === "number" && typeof t == "number";
585
+ return /* @__PURE__ */ O(ye, {
568
586
  field: e,
569
587
  stored: t,
570
588
  items: i[e.id] ?? [],
@@ -579,6 +597,6 @@ function ve({ schema: e, value: t, defaultValue: n = {}, onValueChange: r, picke
579
597
  });
580
598
  }
581
599
  //#endregion
582
- export { ae as n, ve as t };
600
+ export { ce as n, Se as t };
583
601
 
584
- //# sourceMappingURL=FormEditor-M7tNidFo.js.map
602
+ //# sourceMappingURL=FormEditor-DTnFO4oS.js.map