@namroodinc/liquid-editorial 0.12.0 → 0.13.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 (161) hide show
  1. package/README.md +17 -7
  2. package/UPGRADING.md +70 -0
  3. package/dist/chunks/{Avatar-DPnrvkwd.cjs → Avatar-BY0dAItT.cjs} +2 -2
  4. package/dist/chunks/{Avatar-DPnrvkwd.cjs.map → Avatar-BY0dAItT.cjs.map} +1 -1
  5. package/dist/chunks/{Avatar-BK8IdL5W.js → Avatar-UjhjcHh5.js} +2 -2
  6. package/dist/chunks/{Avatar-BK8IdL5W.js.map → Avatar-UjhjcHh5.js.map} +1 -1
  7. package/dist/chunks/{CollectionView-DrszOUOt.cjs → CollectionView-CIJdNwcq.cjs} +2 -2
  8. package/dist/chunks/{CollectionView-DrszOUOt.cjs.map → CollectionView-CIJdNwcq.cjs.map} +1 -1
  9. package/dist/chunks/{CollectionView-B0ZJxkNK.js → CollectionView-JRNdXHti.js} +2 -2
  10. package/dist/chunks/{CollectionView-B0ZJxkNK.js.map → CollectionView-JRNdXHti.js.map} +1 -1
  11. package/dist/chunks/{ColourField-C39pcjkG.js → ColourField-BTj9NHgI.js} +146 -152
  12. package/dist/chunks/ColourField-BTj9NHgI.js.map +1 -0
  13. package/dist/chunks/ColourField-DuoVeXjG.cjs +2 -0
  14. package/dist/chunks/ColourField-DuoVeXjG.cjs.map +1 -0
  15. package/dist/chunks/{DatePicker-Dpvfomrm.cjs → DatePicker-BYpGsfL4.cjs} +2 -2
  16. package/dist/chunks/{DatePicker-Dpvfomrm.cjs.map → DatePicker-BYpGsfL4.cjs.map} +1 -1
  17. package/dist/chunks/{DatePicker-DDc1nDTb.js → DatePicker-Cb5WspIC.js} +21 -21
  18. package/dist/chunks/{DatePicker-DDc1nDTb.js.map → DatePicker-Cb5WspIC.js.map} +1 -1
  19. package/dist/chunks/{Drawer-C3mWT9Kh.js → Drawer-Ck5XKT_V.js} +3 -3
  20. package/dist/chunks/{Drawer-C3mWT9Kh.js.map → Drawer-Ck5XKT_V.js.map} +1 -1
  21. package/dist/chunks/{Drawer-DTKZptua.cjs → Drawer-DdIH9jpe.cjs} +2 -2
  22. package/dist/chunks/{Drawer-DTKZptua.cjs.map → Drawer-DdIH9jpe.cjs.map} +1 -1
  23. package/dist/chunks/{EntryPicker-CgWbgWnc.cjs → EntryPicker-CCCoJxbd.cjs} +2 -2
  24. package/dist/chunks/{EntryPicker-CgWbgWnc.cjs.map → EntryPicker-CCCoJxbd.cjs.map} +1 -1
  25. package/dist/chunks/{EntryPicker-DlEsVCvA.js → EntryPicker-DLCP4S-q.js} +3 -3
  26. package/dist/chunks/{EntryPicker-DlEsVCvA.js.map → EntryPicker-DLCP4S-q.js.map} +1 -1
  27. package/dist/chunks/{FormEditor-iACd0El-.cjs → FormEditor-ArvjKtJJ.cjs} +2 -2
  28. package/dist/chunks/{FormEditor-iACd0El-.cjs.map → FormEditor-ArvjKtJJ.cjs.map} +1 -1
  29. package/dist/chunks/{FormEditor-CLLOHKiO.js → FormEditor-DnNBv9Xf.js} +16 -16
  30. package/dist/chunks/{FormEditor-CLLOHKiO.js.map → FormEditor-DnNBv9Xf.js.map} +1 -1
  31. package/dist/chunks/{Message-CyLq9ef-.js → Message-C73sJfdo.js} +4 -8
  32. package/dist/chunks/{Message-CyLq9ef-.js.map → Message-C73sJfdo.js.map} +1 -1
  33. package/dist/chunks/{Message-D3b8HDhm.cjs → Message-CIKSTXp8.cjs} +2 -2
  34. package/dist/chunks/{Message-D3b8HDhm.cjs.map → Message-CIKSTXp8.cjs.map} +1 -1
  35. package/dist/chunks/RichTextEditor--kMao88d.cjs +2 -0
  36. package/dist/chunks/RichTextEditor--kMao88d.cjs.map +1 -0
  37. package/dist/chunks/{RichTextEditor-B0P53GFt.js → RichTextEditor-CvbboqJY.js} +391 -374
  38. package/dist/chunks/RichTextEditor-CvbboqJY.js.map +1 -0
  39. package/dist/chunks/{dialogLabel-D18maX-p.js → dialogLabel-DT7rCr3_.js} +19 -19
  40. package/dist/chunks/{dialogLabel-D18maX-p.js.map → dialogLabel-DT7rCr3_.js.map} +1 -1
  41. package/dist/chunks/{dialogLabel-2HRYMHbF.cjs → dialogLabel-_-MTckE_.cjs} +2 -2
  42. package/dist/chunks/{dialogLabel-2HRYMHbF.cjs.map → dialogLabel-_-MTckE_.cjs.map} +1 -1
  43. package/dist/chunks/overlayLayer-iGhuAByk.cjs +2 -0
  44. package/dist/chunks/overlayLayer-iGhuAByk.cjs.map +1 -0
  45. package/dist/chunks/{overlayLayer-IuoPVwTO.js → overlayLayer-lU4iWSjO.js} +32 -28
  46. package/dist/chunks/overlayLayer-lU4iWSjO.js.map +1 -0
  47. package/dist/chunks/{group-7Z_xRlQx.js → style-7Z_xRlQx.js} +1 -1
  48. package/dist/chunks/{group-7Z_xRlQx.js.map → style-7Z_xRlQx.js.map} +1 -1
  49. package/dist/chunks/{group-nulIa2_8.cjs → style-nulIa2_8.cjs} +1 -1
  50. package/dist/chunks/{group-nulIa2_8.cjs.map → style-nulIa2_8.cjs.map} +1 -1
  51. package/dist/chunks/{use-picker-session-DbfOJstX.cjs → use-picker-session-Bue5MJHQ.cjs} +2 -2
  52. package/dist/chunks/{use-picker-session-DbfOJstX.cjs.map → use-picker-session-Bue5MJHQ.cjs.map} +1 -1
  53. package/dist/chunks/{use-picker-session-BnMxbGAZ.js → use-picker-session-DUO4G8Cs.js} +2 -2
  54. package/dist/chunks/{use-picker-session-BnMxbGAZ.js.map → use-picker-session-DUO4G8Cs.js.map} +1 -1
  55. package/dist/chunks/{useTooltip-BXAvQwt4.cjs → useTooltip-C7ON4nkV.cjs} +2 -2
  56. package/dist/chunks/{useTooltip-BXAvQwt4.cjs.map → useTooltip-C7ON4nkV.cjs.map} +1 -1
  57. package/dist/chunks/{useTooltip-BrC7FdeH.js → useTooltip-DnJEFBLg.js} +2 -2
  58. package/dist/chunks/{useTooltip-BrC7FdeH.js.map → useTooltip-DnJEFBLg.js.map} +1 -1
  59. package/dist/components/AppShell/index.cjs +1 -1
  60. package/dist/components/AppShell/index.js +1 -1
  61. package/dist/components/Avatar/index.cjs +1 -1
  62. package/dist/components/Avatar/index.js +1 -1
  63. package/dist/components/Badge/style.css +9 -9
  64. package/dist/components/Banner/index.cjs +1 -1
  65. package/dist/components/Banner/index.js +1 -1
  66. package/dist/components/Board/style.css +3 -3
  67. package/dist/components/Button/style.css +4 -8
  68. package/dist/components/Choice/index.cjs +1 -1
  69. package/dist/components/Choice/index.cjs.map +1 -1
  70. package/dist/components/Choice/index.js +3 -3
  71. package/dist/components/Choice/index.js.map +1 -1
  72. package/dist/components/Choice/style.css +29 -18
  73. package/dist/components/CollectionView/index.cjs +1 -1
  74. package/dist/components/CollectionView/index.js +1 -1
  75. package/dist/components/ColourField/index.cjs +1 -1
  76. package/dist/components/ColourField/index.d.cts.map +1 -1
  77. package/dist/components/ColourField/index.d.ts.map +1 -1
  78. package/dist/components/ColourField/index.js +1 -1
  79. package/dist/components/ColourField/style.css +4 -4
  80. package/dist/components/DatePicker/index.cjs +1 -1
  81. package/dist/components/DatePicker/index.js +1 -1
  82. package/dist/components/Drawer/index.cjs +1 -1
  83. package/dist/components/Drawer/index.js +1 -1
  84. package/dist/components/Drawer/style.css +2 -4
  85. package/dist/components/EditLayout/index.cjs +1 -1
  86. package/dist/components/EditLayout/index.js +3 -3
  87. package/dist/components/EditLayout/style.css +1 -7
  88. package/dist/components/EntryPicker/index.cjs +1 -1
  89. package/dist/components/EntryPicker/index.js +1 -1
  90. package/dist/components/EntryPicker/style.css +3 -1
  91. package/dist/components/Field/style.css +1 -1
  92. package/dist/components/FormEditor/README.md +26 -33
  93. package/dist/components/FormEditor/index.cjs +1 -1
  94. package/dist/components/FormEditor/index.js +1 -1
  95. package/dist/components/FormEditor/style.css +1 -0
  96. package/dist/components/LimitReading/style.css +1 -1
  97. package/dist/components/Menu/index.cjs +1 -1
  98. package/dist/components/Menu/index.js +1 -1
  99. package/dist/components/Menu/style.css +3 -2
  100. package/dist/components/Modal/index.cjs +1 -1
  101. package/dist/components/Modal/index.js +2 -2
  102. package/dist/components/Modal/style.css +1 -3
  103. package/dist/components/Popover/index.cjs +1 -1
  104. package/dist/components/Popover/index.cjs.map +1 -1
  105. package/dist/components/Popover/index.d.cts.map +1 -1
  106. package/dist/components/Popover/index.d.ts.map +1 -1
  107. package/dist/components/Popover/index.js +58 -55
  108. package/dist/components/Popover/index.js.map +1 -1
  109. package/dist/components/RichTextEditor/index.cjs +1 -1
  110. package/dist/components/RichTextEditor/index.d.cts.map +1 -1
  111. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  112. package/dist/components/RichTextEditor/index.js +1 -1
  113. package/dist/components/RichTextEditor/storyblock-view.d.cts.map +1 -1
  114. package/dist/components/RichTextEditor/storyblock-view.d.ts.map +1 -1
  115. package/dist/components/RichTextEditor/style.css +91 -60
  116. package/dist/components/Select/index.cjs +1 -1
  117. package/dist/components/Select/index.js +1 -1
  118. package/dist/components/SelectionCard/index.cjs +1 -1
  119. package/dist/components/SelectionCard/index.cjs.map +1 -1
  120. package/dist/components/SelectionCard/index.d.cts.map +1 -1
  121. package/dist/components/SelectionCard/index.d.ts.map +1 -1
  122. package/dist/components/SelectionCard/index.js +2 -2
  123. package/dist/components/SelectionCard/index.js.map +1 -1
  124. package/dist/components/SelectionCard/style.css +20 -65
  125. package/dist/components/Skeleton/style.css +1 -1
  126. package/dist/components/Slider/style.css +12 -23
  127. package/dist/components/Switch/index.cjs +1 -1
  128. package/dist/components/Switch/index.cjs.map +1 -1
  129. package/dist/components/Switch/index.d.cts.map +1 -1
  130. package/dist/components/Switch/index.d.ts.map +1 -1
  131. package/dist/components/Switch/index.js +2 -1
  132. package/dist/components/Switch/index.js.map +1 -1
  133. package/dist/components/Switch/style.css +14 -2
  134. package/dist/components/TagsInput/style.css +3 -21
  135. package/dist/components/Time/index.cjs +1 -1
  136. package/dist/components/Time/index.js +1 -1
  137. package/dist/components/Toast/index.cjs +1 -1
  138. package/dist/components/Toast/index.js +1 -1
  139. package/dist/elements.css +2 -1
  140. package/dist/index.cjs +1 -1
  141. package/dist/index.js +29 -29
  142. package/dist/internal/dialogFocus.d.cts +2 -0
  143. package/dist/internal/dialogFocus.d.cts.map +1 -1
  144. package/dist/internal/dialogFocus.d.ts +2 -0
  145. package/dist/internal/dialogFocus.d.ts.map +1 -1
  146. package/dist/message.css +5 -3
  147. package/dist/tokens.css +83 -309
  148. package/package.json +1 -1
  149. package/dist/chunks/ColourField-BdobU76j.cjs +0 -2
  150. package/dist/chunks/ColourField-BdobU76j.cjs.map +0 -1
  151. package/dist/chunks/ColourField-C39pcjkG.js.map +0 -1
  152. package/dist/chunks/RichTextEditor-B0P53GFt.js.map +0 -1
  153. package/dist/chunks/RichTextEditor-Wu_yjvD7.cjs +0 -2
  154. package/dist/chunks/RichTextEditor-Wu_yjvD7.cjs.map +0 -1
  155. package/dist/chunks/overlayLayer-IuoPVwTO.js.map +0 -1
  156. package/dist/chunks/overlayLayer-seJG-EFn.cjs +0 -2
  157. package/dist/chunks/overlayLayer-seJG-EFn.cjs.map +0 -1
  158. package/dist/components/ColourField/focus.d.cts +0 -3
  159. package/dist/components/ColourField/focus.d.cts.map +0 -1
  160. package/dist/components/ColourField/focus.d.ts +0 -3
  161. package/dist/components/ColourField/focus.d.ts.map +0 -1
@@ -1,26 +1,20 @@
1
1
  import { t as e } from "./Icon-CYXOo0Kt.js";
2
2
  import { Button as t } from "../components/Button/index.js";
3
3
  import { t as n } from "./mergeRefs-C6_5pADN.js";
4
- import { h as r, o as i } from "./overlayLayer-IuoPVwTO.js";
5
- import { TextField as a } from "../components/TextField/index.js";
6
- import { FieldAffix as o } from "../components/FieldAffix/index.js";
4
+ import { f as r, g as i, o as a } from "./overlayLayer-lU4iWSjO.js";
5
+ import { TextField as o } from "../components/TextField/index.js";
7
6
  import { Popover as s } from "../components/Popover/index.js";
8
- import { i as c, n as l, r as u, t as d } from "./colour-CYEF4Q_n.js";
9
- import { n as f } from "./Slider-Cab6NqhK.js";
10
- import { forwardRef as p, useEffect as m, useId as h, useMemo as ee, useRef as g, useState as _, useSyncExternalStore as v } from "react";
11
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
12
- //#region src/components/ColourField/focus.ts
13
- function S(e) {
14
- let t = e.closest("[aria-modal='true']") ?? document.body, n = r(t).filter((e) => !e.closest(".ds-popover"));
15
- (n[n.map((t) => e.contains(t)).lastIndexOf(!0) + 1] ?? n[0])?.focus({ preventScroll: !0 });
16
- }
17
- //#endregion
7
+ import { FieldAffix as c } from "../components/FieldAffix/index.js";
8
+ import { i as l, n as u, r as d, t as f } from "./colour-CYEF4Q_n.js";
9
+ import { n as p } from "./Slider-Cab6NqhK.js";
10
+ import { forwardRef as m, useEffect as h, useId as g, useMemo as _, useRef as v, useState as y, useSyncExternalStore as b } from "react";
11
+ import { Fragment as ee, jsx as x, jsxs as S } from "react/jsx-runtime";
18
12
  //#region src/components/ColourField/square.tsx
19
13
  function C(e) {
20
14
  return Math.max(0, Math.min(100, e));
21
15
  }
22
16
  function w({ colour: e, isDisabled: t, onChange: n }) {
23
- let r = g(null), i = (t) => {
17
+ let r = v(null), i = (t) => {
24
18
  let r = t.currentTarget.getBoundingClientRect();
25
19
  r.width && r.height && n({
26
20
  ...e,
@@ -28,7 +22,7 @@ function w({ colour: e, isDisabled: t, onChange: n }) {
28
22
  v: C((1 - (t.clientY - r.top) / r.height) * 100)
29
23
  });
30
24
  };
31
- return /* @__PURE__ */ b("div", {
25
+ return /* @__PURE__ */ x("div", {
32
26
  className: "ds-colour-panel__square",
33
27
  role: "slider",
34
28
  tabIndex: t ? -1 : 0,
@@ -68,7 +62,7 @@ function w({ colour: e, isDisabled: t, onChange: n }) {
68
62
  onLostPointerCapture: () => {
69
63
  r.current = null;
70
64
  },
71
- children: /* @__PURE__ */ b("span", {
65
+ children: /* @__PURE__ */ x("span", {
72
66
  className: "ds-colour-panel__thumb",
73
67
  style: {
74
68
  left: `${e.s}%`,
@@ -80,34 +74,34 @@ function w({ colour: e, isDisabled: t, onChange: n }) {
80
74
  //#endregion
81
75
  //#region src/components/ColourField/value.ts
82
76
  function T({ value: e, defaultValue: t = "", onValueChange: n }) {
83
- let [r, i] = _(t), a = e ?? r, [o, s] = _(() => ({
77
+ let [r, i] = y(t), a = e ?? r, [o, s] = y(() => ({
84
78
  source: a,
85
- colour: l(a)
79
+ colour: u(a)
86
80
  })), c = o.colour;
87
- return o.source !== a && (c = l(a, c), s({
81
+ return o.source !== a && (c = u(a, c), s({
88
82
  source: a,
89
83
  colour: c
90
84
  })), {
91
85
  current: a,
92
86
  colour: c,
93
87
  commit: (t) => {
94
- let r = typeof t == "string" ? u(t) : d(t);
88
+ let r = typeof t == "string" ? d(t) : f(t);
95
89
  s({
96
90
  source: r,
97
- colour: typeof t == "string" ? l(t, c) : t
91
+ colour: typeof t == "string" ? u(t, c) : t
98
92
  }), e === void 0 && i(r), n?.(r);
99
93
  }
100
94
  };
101
95
  }
102
- function te(e, t) {
103
- let [n, r] = _(null);
96
+ function E(e, t) {
97
+ let [n, r] = y(null);
104
98
  return n && n.source !== e && n.text === e && r({
105
99
  source: e,
106
100
  text: e
107
101
  }), {
108
102
  text: n?.source === e ? n.text : t || e,
109
103
  type: (t, n) => r({
110
- source: n ? u(t) : e,
104
+ source: n ? d(t) : e,
111
105
  text: t
112
106
  }),
113
107
  discard: () => r(null)
@@ -115,111 +109,111 @@ function te(e, t) {
115
109
  }
116
110
  //#endregion
117
111
  //#region src/components/ColourField/panel.tsx
118
- function E() {
112
+ function D() {
119
113
  return window.EyeDropper;
120
114
  }
121
- var D = () => () => {}, O = [], k = 8;
122
- function A(e, t, n) {
123
- let r = t % k, i = r + Math.floor((n - 1 - r) / k) * k;
115
+ var O = () => () => {}, k = [], A = 8;
116
+ function j(e, t, n) {
117
+ let r = t % A, i = r + Math.floor((n - 1 - r) / A) * A;
124
118
  switch (e) {
125
119
  case "Home": return 0;
126
120
  case "End": return n - 1;
127
121
  case "ArrowRight": return (t + 1) % n;
128
122
  case "ArrowLeft": return (t - 1 + n) % n;
129
- case "ArrowDown": return t + k < n ? t + k : r;
130
- case "ArrowUp": return t >= k ? t - k : i;
123
+ case "ArrowDown": return t + A < n ? t + A : r;
124
+ case "ArrowUp": return t >= A ? t - A : i;
131
125
  default: return;
132
126
  }
133
127
  }
134
- var j = p(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
128
+ var M = m(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
135
129
  let { current: a, colour: o, commit: s } = T({
136
130
  value: e,
137
131
  defaultValue: t,
138
132
  onValueChange: n
139
133
  });
140
- return /* @__PURE__ */ b(M, {
134
+ return /* @__PURE__ */ x(N, {
141
135
  ...r,
142
136
  ref: i,
143
137
  colour: o,
144
138
  current: a,
145
139
  onColourChange: s
146
140
  });
147
- }), M = p(function({ colour: n, current: r, onColourChange: i, presets: a = O, showPresets: o = !0, picker: s = "custom", isDisabled: p = !1, className: S, style: C, ...T }, te) {
148
- let j = g(null), M = g(!0), N = g(p), [P, F] = _(!1), [I, L] = _(""), R = v(D, () => !!E(), () => !1), z = h(), B = u(r), V = d({
141
+ }), N = m(function({ colour: n, current: r, onColourChange: i, presets: a = k, showPresets: o = !0, picker: s = "custom", isDisabled: c = !1, className: m, style: C, ...T }, E) {
142
+ let M = v(null), N = v(!0), P = v(c), [F, I] = y(!1), [L, R] = y(""), z = b(O, () => !!D(), () => !1), B = g(), V = d(r), H = f({
149
143
  ...n,
150
144
  a: 1
151
- }), H = ee(() => {
145
+ }), U = _(() => {
152
146
  let e = /* @__PURE__ */ new Map();
153
147
  for (let t of a) {
154
- let n = u(t);
148
+ let n = d(t);
155
149
  n && !e.has(n) && e.set(n, t);
156
150
  }
157
151
  return [...e].map(([e, t]) => ({
158
152
  normalised: e,
159
153
  preset: t
160
154
  }));
161
- }, [a]), U = H.findIndex((e) => e.normalised === B);
162
- m(() => {
163
- N.current = p;
164
- }, [p]), m(() => (M.current = !0, () => {
165
- M.current = !1;
155
+ }, [a]), W = U.findIndex((e) => e.normalised === V);
156
+ h(() => {
157
+ P.current = c;
158
+ }, [c]), h(() => (N.current = !0, () => {
159
+ N.current = !1;
166
160
  }), []);
167
- let W = async () => {
168
- let e = E();
169
- if (!(!e || p || P)) {
170
- F(!0), L("");
161
+ let G = async () => {
162
+ let e = D();
163
+ if (!(!e || c || F)) {
164
+ I(!0), R("");
171
165
  try {
172
166
  let t = await new e().open();
173
- M.current && !N.current && c(t.sRGBHex) && i({
174
- ...l(t.sRGBHex, n),
167
+ N.current && !P.current && l(t.sRGBHex) && i({
168
+ ...u(t.sRGBHex, n),
175
169
  a: n.a
176
170
  });
177
171
  } catch (e) {
178
- M.current && !(e instanceof DOMException && e.name === "AbortError") && L("Unable to pick a colour from the screen. Try again.");
172
+ N.current && !(e instanceof DOMException && e.name === "AbortError") && R("Unable to pick a colour from the screen. Try again.");
179
173
  } finally {
180
- M.current && F(!1);
174
+ N.current && I(!1);
181
175
  }
182
176
  }
183
177
  };
184
- return /* @__PURE__ */ x("div", {
178
+ return /* @__PURE__ */ S("div", {
185
179
  ...T,
186
- ref: te,
180
+ ref: E,
187
181
  className: [
188
182
  "ds-colour-panel",
189
183
  "ds-field-surface",
190
- S
184
+ m
191
185
  ].filter(Boolean).join(" "),
192
- "data-disabled": p || void 0,
186
+ "data-disabled": c || void 0,
193
187
  style: {
194
188
  ...C,
195
189
  "--colour-hue": `hsl(${n.h} 100% 50%)`,
196
- "--colour-rgb": V,
197
- "--colour-rgba": d(n)
190
+ "--colour-rgb": H,
191
+ "--colour-rgba": f(n)
198
192
  },
199
193
  children: [
200
- /* @__PURE__ */ x("div", {
194
+ /* @__PURE__ */ S("div", {
201
195
  className: "ds-colour-panel__head ds-field-surface",
202
- children: [/* @__PURE__ */ b("span", { children: "Colour" }), /* @__PURE__ */ b("span", {
196
+ children: [/* @__PURE__ */ x("span", { children: "Colour" }), /* @__PURE__ */ x("span", {
203
197
  className: "ds-colour-panel__value",
204
- children: B || "No colour"
198
+ children: V || "No colour"
205
199
  })]
206
200
  }),
207
- s === "custom" ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(w, {
201
+ s === "custom" ? /* @__PURE__ */ S(ee, { children: [/* @__PURE__ */ x(w, {
208
202
  colour: n,
209
- isDisabled: p,
203
+ isDisabled: c,
210
204
  onChange: i
211
- }), /* @__PURE__ */ x("div", {
205
+ }), /* @__PURE__ */ S("div", {
212
206
  className: "ds-colour-panel__hue-row",
213
- children: [R && /* @__PURE__ */ b(t, {
207
+ children: [z && /* @__PURE__ */ x(t, {
214
208
  variant: "simple",
215
209
  size: "sm",
216
210
  isIconOnly: !0,
217
211
  iconStart: "pipette",
218
212
  "aria-label": "Pick from screen",
219
- isDisabled: p,
220
- "aria-busy": P || void 0,
221
- onClick: () => void W()
222
- }), /* @__PURE__ */ b(f, {
213
+ isDisabled: c,
214
+ "aria-busy": F || void 0,
215
+ onClick: () => void G()
216
+ }), /* @__PURE__ */ x(p, {
223
217
  className: "ds-colour-panel__hue",
224
218
  value: n.h,
225
219
  min: 0,
@@ -228,7 +222,7 @@ var j = p(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
228
222
  hasValueLabel: !1,
229
223
  "aria-label": "Hue",
230
224
  "aria-valuetext": `${Math.round(n.h)} degrees`,
231
- isDisabled: p,
225
+ isDisabled: c,
232
226
  onValueChange: (e) => i({
233
227
  ...n,
234
228
  h: e
@@ -248,28 +242,28 @@ var j = p(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
248
242
  });
249
243
  }
250
244
  })]
251
- })] }) : /* @__PURE__ */ x("div", {
245
+ })] }) : /* @__PURE__ */ S("div", {
252
246
  className: "ds-colour-panel__native",
253
- children: [/* @__PURE__ */ b("input", {
254
- ref: j,
247
+ children: [/* @__PURE__ */ x("input", {
248
+ ref: M,
255
249
  type: "color",
256
- value: V,
250
+ value: H,
257
251
  tabIndex: -1,
258
252
  "aria-hidden": "true",
259
- disabled: p,
253
+ disabled: c,
260
254
  onChange: (e) => {
261
- c(e.target.value) && i({
262
- ...l(e.target.value, n),
255
+ l(e.target.value) && i({
256
+ ...u(e.target.value, n),
263
257
  a: n.a
264
258
  });
265
259
  }
266
- }), /* @__PURE__ */ b(t, {
260
+ }), /* @__PURE__ */ x(t, {
267
261
  variant: "neutral",
268
262
  size: "sm",
269
263
  iconStart: "pipette",
270
- isDisabled: p,
264
+ isDisabled: c,
271
265
  onClick: () => {
272
- let e = j.current;
266
+ let e = M.current;
273
267
  if (e) try {
274
268
  e.showPicker ? e.showPicker() : e.click();
275
269
  } catch {
@@ -279,44 +273,44 @@ var j = p(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
279
273
  children: "Custom colour…"
280
274
  })]
281
275
  }),
282
- /* @__PURE__ */ x("div", {
276
+ /* @__PURE__ */ S("div", {
283
277
  className: "ds-colour-panel__opacity",
284
- children: [/* @__PURE__ */ b("label", {
285
- htmlFor: `${z}-opacity`,
278
+ children: [/* @__PURE__ */ x("label", {
279
+ htmlFor: `${B}-opacity`,
286
280
  children: "Opacity"
287
- }), /* @__PURE__ */ b(f, {
288
- id: `${z}-opacity`,
281
+ }), /* @__PURE__ */ x(p, {
282
+ id: `${B}-opacity`,
289
283
  className: "ds-colour-panel__alpha",
290
284
  value: Math.round(n.a * 100),
291
285
  min: 0,
292
286
  max: 100,
293
287
  step: 1,
294
288
  suffix: "%",
295
- isDisabled: p,
289
+ isDisabled: c,
296
290
  onValueChange: (e) => i({
297
291
  ...n,
298
292
  a: e / 100
299
293
  })
300
294
  })]
301
295
  }),
302
- o && H.length > 0 && /* @__PURE__ */ x("div", {
296
+ o && U.length > 0 && /* @__PURE__ */ S("div", {
303
297
  className: "ds-colour-panel__presets",
304
- children: [/* @__PURE__ */ b("span", {
305
- id: z,
298
+ children: [/* @__PURE__ */ x("span", {
299
+ id: B,
306
300
  className: "ds-colour-panel__presets-label",
307
301
  children: "Presets"
308
- }), /* @__PURE__ */ b("div", {
302
+ }), /* @__PURE__ */ x("div", {
309
303
  className: "ds-colour-panel__grid",
310
304
  role: "radiogroup",
311
- "aria-labelledby": z,
312
- style: { "--colour-preset-columns": k },
305
+ "aria-labelledby": B,
306
+ style: { "--colour-preset-columns": A },
313
307
  onKeyDown: (e) => {
314
- let t = Array.from(e.currentTarget.querySelectorAll("[role='radio']")), n = t.indexOf(e.target), r = n < 0 ? void 0 : A(e.key, n, t.length);
308
+ let t = Array.from(e.currentTarget.querySelectorAll("[role='radio']")), n = t.indexOf(e.target), r = n < 0 ? void 0 : j(e.key, n, t.length);
315
309
  r !== void 0 && (e.preventDefault(), t[r]?.focus(), t[r]?.click());
316
310
  },
317
- children: H.map(({ normalised: n, preset: r }, a) => {
318
- let o = a === U;
319
- return /* @__PURE__ */ b(t, {
311
+ children: U.map(({ normalised: n, preset: r }, a) => {
312
+ let o = a === W;
313
+ return /* @__PURE__ */ x(t, {
320
314
  variant: "simple",
321
315
  size: "xs",
322
316
  isIconOnly: !0,
@@ -324,14 +318,14 @@ var j = p(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
324
318
  "aria-checked": o,
325
319
  "aria-label": r,
326
320
  title: r,
327
- tabIndex: a === Math.max(0, U) ? 0 : -1,
328
- isDisabled: p,
321
+ tabIndex: a === Math.max(0, W) ? 0 : -1,
322
+ isDisabled: c,
329
323
  className: "ds-colour-panel__preset",
330
324
  onClick: () => i(r),
331
- children: /* @__PURE__ */ b("span", {
325
+ children: /* @__PURE__ */ x("span", {
332
326
  className: "ds-colour-swatch",
333
327
  style: { "--colour-swatch": n },
334
- children: o && /* @__PURE__ */ b(e, {
328
+ children: o && /* @__PURE__ */ x(e, {
335
329
  name: "check",
336
330
  size: 16,
337
331
  strokeWidth: 3
@@ -341,59 +335,59 @@ var j = p(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
341
335
  })
342
336
  })]
343
337
  }),
344
- I && /* @__PURE__ */ b("span", {
338
+ L && /* @__PURE__ */ x("span", {
345
339
  className: "ds-colour-panel__error",
346
340
  role: "status",
347
- children: I
341
+ children: L
348
342
  })
349
343
  ]
350
344
  });
351
- }), N = p(function({ value: e, defaultValue: l, onValueChange: d, onValidityChange: f, presets: p, showPresets: ee, picker: v, placement: y, isDisabled: C = !1, disabled: w, readOnly: E, isInvalid: D, "aria-invalid": O, id: k, className: A, onBlur: j, onKeyDown: N, ...P }, F) {
352
- let { current: I, colour: L, commit: R } = T({
345
+ }), P = m(function({ value: e, defaultValue: u, onValueChange: f, onValidityChange: p, presets: m, showPresets: _, picker: b, placement: ee, isDisabled: C = !1, disabled: w, readOnly: D, isInvalid: O, "aria-invalid": k, id: A, className: j, onBlur: M, onKeyDown: P, ...F }, I) {
346
+ let { current: L, colour: R, commit: z } = T({
353
347
  value: e,
354
- defaultValue: l,
355
- onValueChange: d
356
- }), [z, B] = _(!1), V = i(z), H = g(null), U = g(null), W = g(null), G = g(null), K = h(), q = k ?? `${K}-input`, J = u(I), { text: Y, type: ne, discard: X } = te(I, J), Z = !(!Y.trim() || c(Y)), Q = C || w;
357
- V && (Q || E) && B(!1);
358
- let $ = V && !Q && !E;
359
- m(() => {
360
- f?.(!Z), U.current?.setCustomValidity(Z ? "Enter a colour, such as #0052CC or rebeccapurple." : "");
361
- }, [Z, f]), m(() => {
348
+ defaultValue: u,
349
+ onValueChange: f
350
+ }), [B, V] = y(!1), H = a(B), U = v(null), W = v(null), G = v(null), K = v(null), q = g(), te = A ?? `${q}-input`, J = d(L), { text: Y, type: ne, discard: X } = E(L, J), Z = !(!Y.trim() || l(Y)), Q = C || w;
351
+ H && (Q || D) && V(!1);
352
+ let $ = H && !Q && !D;
353
+ h(() => {
354
+ p?.(!Z), W.current?.setCustomValidity(Z ? "Enter a colour, such as #0052CC or rebeccapurple." : "");
355
+ }, [Z, p]), h(() => {
362
356
  if (!$) return;
363
- G.current && r(G.current)[0]?.focus({ preventScroll: !0 });
357
+ K.current && i(K.current)[0]?.focus({ preventScroll: !0 });
364
358
  let e = (e) => {
365
359
  let t = e.target;
366
- t && !H.current?.contains(t) && !G.current?.contains(t) && B(!1);
360
+ t && !U.current?.contains(t) && !K.current?.contains(t) && V(!1);
367
361
  };
368
362
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
369
363
  }, [$]);
370
364
  let re = (e) => {
371
- W.current = e, B(!$);
365
+ G.current = e, V(!$);
372
366
  }, ie = () => {
373
- B(!1), W.current?.focus({ preventScroll: !0 });
367
+ V(!1), G.current?.focus({ preventScroll: !0 });
374
368
  }, ae = {
375
369
  "aria-label": $ ? "Close colour picker" : "Open colour picker",
376
370
  "aria-haspopup": "dialog",
377
371
  "aria-expanded": $,
378
- "aria-controls": $ ? K : void 0,
379
- isDisabled: Q || E
372
+ "aria-controls": $ ? q : void 0,
373
+ isDisabled: Q || D
380
374
  };
381
- return /* @__PURE__ */ x("div", {
375
+ return /* @__PURE__ */ S("div", {
382
376
  className: "ds-colour-field",
383
- ref: H,
377
+ ref: U,
384
378
  onBlur: (e) => {
385
379
  let t = e.relatedTarget;
386
- t && !H.current?.contains(t) && !G.current?.contains(t) && B(!1);
380
+ t && !U.current?.contains(t) && !K.current?.contains(t) && V(!1);
387
381
  },
388
382
  onKeyDown: (e) => {
389
- if ($ && e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), ie()), !$ || e.key !== "Tab" || !G.current?.contains(e.target)) return;
390
- let t = r(G.current);
391
- (e.shiftKey ? e.target === t[0] : e.target === t.at(-1)) && (e.preventDefault(), e.stopPropagation(), B(!1), e.shiftKey ? W.current?.focus({ preventScroll: !0 }) : H.current && S(H.current));
383
+ if ($ && e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), ie()), !$ || e.key !== "Tab" || !K.current?.contains(e.target)) return;
384
+ let t = i(K.current);
385
+ (e.shiftKey ? e.target === t[0] : e.target === t.at(-1)) && (e.preventDefault(), e.stopPropagation(), V(!1), e.shiftKey ? G.current?.focus({ preventScroll: !0 }) : U.current && r(U.current));
392
386
  },
393
- children: [/* @__PURE__ */ b(o, {
387
+ children: [/* @__PURE__ */ x(c, {
394
388
  isLeadInteractive: !0,
395
389
  isTrailInteractive: !0,
396
- lead: /* @__PURE__ */ b(t, {
390
+ lead: /* @__PURE__ */ x(t, {
397
391
  "aria-hidden": "true",
398
392
  tabIndex: -1,
399
393
  isDisabled: ae.isDisabled,
@@ -402,14 +396,14 @@ var j = p(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
402
396
  isIconOnly: !0,
403
397
  onMouseDown: (e) => e.preventDefault(),
404
398
  onClick: () => {
405
- W.current = U.current, $ ? ie() : B(!0);
399
+ G.current = W.current, $ ? ie() : V(!0);
406
400
  },
407
- children: /* @__PURE__ */ b("span", {
401
+ children: /* @__PURE__ */ x("span", {
408
402
  className: "ds-colour-swatch ds-colour-field__swatch",
409
403
  style: { "--colour-swatch": J || "transparent" }
410
404
  })
411
405
  }),
412
- trail: /* @__PURE__ */ b(t, {
406
+ trail: /* @__PURE__ */ x(t, {
413
407
  ...ae,
414
408
  variant: "simple",
415
409
  size: "xs",
@@ -417,56 +411,56 @@ var j = p(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
417
411
  iconStart: "chevron-down",
418
412
  onClick: (e) => re(e.currentTarget)
419
413
  }),
420
- children: /* @__PURE__ */ b(a, {
421
- ...P,
422
- ref: n(U, F),
423
- id: q,
414
+ children: /* @__PURE__ */ x(o, {
415
+ ...F,
416
+ ref: n(W, I),
417
+ id: te,
424
418
  disabled: Q,
425
- readOnly: E,
419
+ readOnly: D,
426
420
  spellCheck: !1,
427
421
  autoComplete: "off",
428
422
  value: Y,
429
- "aria-invalid": Z || D || O || void 0,
423
+ "aria-invalid": Z || O || k || void 0,
430
424
  "aria-haspopup": "dialog",
431
- "aria-controls": $ ? K : void 0,
432
- className: ["ds-colour-field__input", A].filter(Boolean).join(" "),
425
+ "aria-controls": $ ? q : void 0,
426
+ className: ["ds-colour-field__input", j].filter(Boolean).join(" "),
433
427
  onChange: (e) => {
434
- let t = e.target.value, n = !t.trim() || !!c(t);
435
- ne(t, n), n && R(t);
428
+ let t = e.target.value, n = !t.trim() || !!l(t);
429
+ ne(t, n), n && z(t);
436
430
  },
437
431
  onBlur: (e) => {
438
- Z || X(), j?.(e);
432
+ Z || X(), M?.(e);
439
433
  },
440
434
  onKeyDown: (e) => {
441
- N?.(e), !e.defaultPrevented && (e.key === "Enter" && !Z && (e.preventDefault(), X()), e.key === "ArrowDown" && !Q && !E && (e.preventDefault(), W.current = e.currentTarget, B(!0)));
435
+ P?.(e), !e.defaultPrevented && (e.key === "Enter" && !Z && (e.preventDefault(), X()), e.key === "ArrowDown" && !Q && !D && (e.preventDefault(), G.current = e.currentTarget, V(!0)));
442
436
  }
443
437
  })
444
- }), /* @__PURE__ */ b(s, {
445
- anchorRef: U,
446
- anchorId: q,
438
+ }), /* @__PURE__ */ x(s, {
439
+ anchorRef: W,
440
+ anchorId: te,
447
441
  isOpen: $,
448
442
  align: "start",
449
- placement: y,
450
- panelRef: G,
451
- id: K,
443
+ placement: ee,
444
+ panelRef: K,
445
+ id: q,
452
446
  role: "dialog",
453
447
  "aria-label": "Choose a colour",
454
448
  tabIndex: -1,
455
449
  className: "ds-colour-field__popover",
456
- children: /* @__PURE__ */ b(M, {
457
- colour: L,
450
+ children: /* @__PURE__ */ x(N, {
451
+ colour: R,
458
452
  current: J,
459
- presets: p,
460
- showPresets: ee,
461
- picker: v,
453
+ presets: m,
454
+ showPresets: _,
455
+ picker: b,
462
456
  onColourChange: (e) => {
463
- X(), R(e);
457
+ X(), z(e);
464
458
  }
465
459
  })
466
460
  })]
467
461
  });
468
462
  });
469
463
  //#endregion
470
- export { j as n, N as t };
464
+ export { M as n, P as t };
471
465
 
472
- //# sourceMappingURL=ColourField-C39pcjkG.js.map
466
+ //# sourceMappingURL=ColourField-BTj9NHgI.js.map