@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.
- package/README.md +17 -7
- package/UPGRADING.md +70 -0
- package/dist/chunks/{Avatar-DPnrvkwd.cjs → Avatar-BY0dAItT.cjs} +2 -2
- package/dist/chunks/{Avatar-DPnrvkwd.cjs.map → Avatar-BY0dAItT.cjs.map} +1 -1
- package/dist/chunks/{Avatar-BK8IdL5W.js → Avatar-UjhjcHh5.js} +2 -2
- package/dist/chunks/{Avatar-BK8IdL5W.js.map → Avatar-UjhjcHh5.js.map} +1 -1
- package/dist/chunks/{CollectionView-DrszOUOt.cjs → CollectionView-CIJdNwcq.cjs} +2 -2
- package/dist/chunks/{CollectionView-DrszOUOt.cjs.map → CollectionView-CIJdNwcq.cjs.map} +1 -1
- package/dist/chunks/{CollectionView-B0ZJxkNK.js → CollectionView-JRNdXHti.js} +2 -2
- package/dist/chunks/{CollectionView-B0ZJxkNK.js.map → CollectionView-JRNdXHti.js.map} +1 -1
- package/dist/chunks/{ColourField-C39pcjkG.js → ColourField-BTj9NHgI.js} +146 -152
- package/dist/chunks/ColourField-BTj9NHgI.js.map +1 -0
- package/dist/chunks/ColourField-DuoVeXjG.cjs +2 -0
- package/dist/chunks/ColourField-DuoVeXjG.cjs.map +1 -0
- package/dist/chunks/{DatePicker-Dpvfomrm.cjs → DatePicker-BYpGsfL4.cjs} +2 -2
- package/dist/chunks/{DatePicker-Dpvfomrm.cjs.map → DatePicker-BYpGsfL4.cjs.map} +1 -1
- package/dist/chunks/{DatePicker-DDc1nDTb.js → DatePicker-Cb5WspIC.js} +21 -21
- package/dist/chunks/{DatePicker-DDc1nDTb.js.map → DatePicker-Cb5WspIC.js.map} +1 -1
- package/dist/chunks/{Drawer-C3mWT9Kh.js → Drawer-Ck5XKT_V.js} +3 -3
- package/dist/chunks/{Drawer-C3mWT9Kh.js.map → Drawer-Ck5XKT_V.js.map} +1 -1
- package/dist/chunks/{Drawer-DTKZptua.cjs → Drawer-DdIH9jpe.cjs} +2 -2
- package/dist/chunks/{Drawer-DTKZptua.cjs.map → Drawer-DdIH9jpe.cjs.map} +1 -1
- package/dist/chunks/{EntryPicker-CgWbgWnc.cjs → EntryPicker-CCCoJxbd.cjs} +2 -2
- package/dist/chunks/{EntryPicker-CgWbgWnc.cjs.map → EntryPicker-CCCoJxbd.cjs.map} +1 -1
- package/dist/chunks/{EntryPicker-DlEsVCvA.js → EntryPicker-DLCP4S-q.js} +3 -3
- package/dist/chunks/{EntryPicker-DlEsVCvA.js.map → EntryPicker-DLCP4S-q.js.map} +1 -1
- package/dist/chunks/{FormEditor-iACd0El-.cjs → FormEditor-ArvjKtJJ.cjs} +2 -2
- package/dist/chunks/{FormEditor-iACd0El-.cjs.map → FormEditor-ArvjKtJJ.cjs.map} +1 -1
- package/dist/chunks/{FormEditor-CLLOHKiO.js → FormEditor-DnNBv9Xf.js} +16 -16
- package/dist/chunks/{FormEditor-CLLOHKiO.js.map → FormEditor-DnNBv9Xf.js.map} +1 -1
- package/dist/chunks/{Message-CyLq9ef-.js → Message-C73sJfdo.js} +4 -8
- package/dist/chunks/{Message-CyLq9ef-.js.map → Message-C73sJfdo.js.map} +1 -1
- package/dist/chunks/{Message-D3b8HDhm.cjs → Message-CIKSTXp8.cjs} +2 -2
- package/dist/chunks/{Message-D3b8HDhm.cjs.map → Message-CIKSTXp8.cjs.map} +1 -1
- package/dist/chunks/RichTextEditor--kMao88d.cjs +2 -0
- package/dist/chunks/RichTextEditor--kMao88d.cjs.map +1 -0
- package/dist/chunks/{RichTextEditor-B0P53GFt.js → RichTextEditor-CvbboqJY.js} +391 -374
- package/dist/chunks/RichTextEditor-CvbboqJY.js.map +1 -0
- package/dist/chunks/{dialogLabel-D18maX-p.js → dialogLabel-DT7rCr3_.js} +19 -19
- package/dist/chunks/{dialogLabel-D18maX-p.js.map → dialogLabel-DT7rCr3_.js.map} +1 -1
- package/dist/chunks/{dialogLabel-2HRYMHbF.cjs → dialogLabel-_-MTckE_.cjs} +2 -2
- package/dist/chunks/{dialogLabel-2HRYMHbF.cjs.map → dialogLabel-_-MTckE_.cjs.map} +1 -1
- package/dist/chunks/overlayLayer-iGhuAByk.cjs +2 -0
- package/dist/chunks/overlayLayer-iGhuAByk.cjs.map +1 -0
- package/dist/chunks/{overlayLayer-IuoPVwTO.js → overlayLayer-lU4iWSjO.js} +32 -28
- package/dist/chunks/overlayLayer-lU4iWSjO.js.map +1 -0
- package/dist/chunks/{group-7Z_xRlQx.js → style-7Z_xRlQx.js} +1 -1
- package/dist/chunks/{group-7Z_xRlQx.js.map → style-7Z_xRlQx.js.map} +1 -1
- package/dist/chunks/{group-nulIa2_8.cjs → style-nulIa2_8.cjs} +1 -1
- package/dist/chunks/{group-nulIa2_8.cjs.map → style-nulIa2_8.cjs.map} +1 -1
- package/dist/chunks/{use-picker-session-DbfOJstX.cjs → use-picker-session-Bue5MJHQ.cjs} +2 -2
- package/dist/chunks/{use-picker-session-DbfOJstX.cjs.map → use-picker-session-Bue5MJHQ.cjs.map} +1 -1
- package/dist/chunks/{use-picker-session-BnMxbGAZ.js → use-picker-session-DUO4G8Cs.js} +2 -2
- package/dist/chunks/{use-picker-session-BnMxbGAZ.js.map → use-picker-session-DUO4G8Cs.js.map} +1 -1
- package/dist/chunks/{useTooltip-BXAvQwt4.cjs → useTooltip-C7ON4nkV.cjs} +2 -2
- package/dist/chunks/{useTooltip-BXAvQwt4.cjs.map → useTooltip-C7ON4nkV.cjs.map} +1 -1
- package/dist/chunks/{useTooltip-BrC7FdeH.js → useTooltip-DnJEFBLg.js} +2 -2
- package/dist/chunks/{useTooltip-BrC7FdeH.js.map → useTooltip-DnJEFBLg.js.map} +1 -1
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.js +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Badge/style.css +9 -9
- package/dist/components/Banner/index.cjs +1 -1
- package/dist/components/Banner/index.js +1 -1
- package/dist/components/Board/style.css +3 -3
- package/dist/components/Button/style.css +4 -8
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.cjs.map +1 -1
- package/dist/components/Choice/index.js +3 -3
- package/dist/components/Choice/index.js.map +1 -1
- package/dist/components/Choice/style.css +29 -18
- package/dist/components/CollectionView/index.cjs +1 -1
- package/dist/components/CollectionView/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.d.cts.map +1 -1
- package/dist/components/ColourField/index.d.ts.map +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/ColourField/style.css +4 -4
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.js +1 -1
- package/dist/components/Drawer/style.css +2 -4
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.js +3 -3
- package/dist/components/EditLayout/style.css +1 -7
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/EntryPicker/style.css +3 -1
- package/dist/components/Field/style.css +1 -1
- package/dist/components/FormEditor/README.md +26 -33
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/FormEditor/style.css +1 -0
- package/dist/components/LimitReading/style.css +1 -1
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/style.css +3 -2
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.js +2 -2
- package/dist/components/Modal/style.css +1 -3
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +58 -55
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.d.cts.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RichTextEditor/storyblock-view.d.cts.map +1 -1
- package/dist/components/RichTextEditor/storyblock-view.d.ts.map +1 -1
- package/dist/components/RichTextEditor/style.css +91 -60
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.cjs.map +1 -1
- package/dist/components/SelectionCard/index.d.cts.map +1 -1
- package/dist/components/SelectionCard/index.d.ts.map +1 -1
- package/dist/components/SelectionCard/index.js +2 -2
- package/dist/components/SelectionCard/index.js.map +1 -1
- package/dist/components/SelectionCard/style.css +20 -65
- package/dist/components/Skeleton/style.css +1 -1
- package/dist/components/Slider/style.css +12 -23
- package/dist/components/Switch/index.cjs +1 -1
- package/dist/components/Switch/index.cjs.map +1 -1
- package/dist/components/Switch/index.d.cts.map +1 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/Switch/index.js +2 -1
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/style.css +14 -2
- package/dist/components/TagsInput/style.css +3 -21
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/elements.css +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +29 -29
- package/dist/internal/dialogFocus.d.cts +2 -0
- package/dist/internal/dialogFocus.d.cts.map +1 -1
- package/dist/internal/dialogFocus.d.ts +2 -0
- package/dist/internal/dialogFocus.d.ts.map +1 -1
- package/dist/message.css +5 -3
- package/dist/tokens.css +83 -309
- package/package.json +1 -1
- package/dist/chunks/ColourField-BdobU76j.cjs +0 -2
- package/dist/chunks/ColourField-BdobU76j.cjs.map +0 -1
- package/dist/chunks/ColourField-C39pcjkG.js.map +0 -1
- package/dist/chunks/RichTextEditor-B0P53GFt.js.map +0 -1
- package/dist/chunks/RichTextEditor-Wu_yjvD7.cjs +0 -2
- package/dist/chunks/RichTextEditor-Wu_yjvD7.cjs.map +0 -1
- package/dist/chunks/overlayLayer-IuoPVwTO.js.map +0 -1
- package/dist/chunks/overlayLayer-seJG-EFn.cjs +0 -2
- package/dist/chunks/overlayLayer-seJG-EFn.cjs.map +0 -1
- package/dist/components/ColourField/focus.d.cts +0 -3
- package/dist/components/ColourField/focus.d.cts.map +0 -1
- package/dist/components/ColourField/focus.d.ts +0 -3
- 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 {
|
|
5
|
-
import { TextField as
|
|
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 {
|
|
9
|
-
import { n as f } from "./
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
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 =
|
|
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__ */
|
|
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__ */
|
|
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] =
|
|
77
|
+
let [r, i] = y(t), a = e ?? r, [o, s] = y(() => ({
|
|
84
78
|
source: a,
|
|
85
|
-
colour:
|
|
79
|
+
colour: u(a)
|
|
86
80
|
})), c = o.colour;
|
|
87
|
-
return o.source !== a && (c =
|
|
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" ?
|
|
88
|
+
let r = typeof t == "string" ? d(t) : f(t);
|
|
95
89
|
s({
|
|
96
90
|
source: r,
|
|
97
|
-
colour: typeof t == "string" ?
|
|
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
|
|
103
|
-
let [n, r] =
|
|
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 ?
|
|
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
|
|
112
|
+
function D() {
|
|
119
113
|
return window.EyeDropper;
|
|
120
114
|
}
|
|
121
|
-
var
|
|
122
|
-
function
|
|
123
|
-
let r = t %
|
|
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 +
|
|
130
|
-
case "ArrowUp": return t >=
|
|
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
|
|
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__ */
|
|
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
|
-
}),
|
|
148
|
-
let
|
|
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
|
-
}),
|
|
145
|
+
}), U = _(() => {
|
|
152
146
|
let e = /* @__PURE__ */ new Map();
|
|
153
147
|
for (let t of a) {
|
|
154
|
-
let n =
|
|
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]),
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}, [
|
|
165
|
-
|
|
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
|
|
168
|
-
let e =
|
|
169
|
-
if (!(!e ||
|
|
170
|
-
|
|
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
|
-
|
|
174
|
-
...
|
|
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
|
-
|
|
172
|
+
N.current && !(e instanceof DOMException && e.name === "AbortError") && R("Unable to pick a colour from the screen. Try again.");
|
|
179
173
|
} finally {
|
|
180
|
-
|
|
174
|
+
N.current && I(!1);
|
|
181
175
|
}
|
|
182
176
|
}
|
|
183
177
|
};
|
|
184
|
-
return /* @__PURE__ */
|
|
178
|
+
return /* @__PURE__ */ S("div", {
|
|
185
179
|
...T,
|
|
186
|
-
ref:
|
|
180
|
+
ref: E,
|
|
187
181
|
className: [
|
|
188
182
|
"ds-colour-panel",
|
|
189
183
|
"ds-field-surface",
|
|
190
|
-
|
|
184
|
+
m
|
|
191
185
|
].filter(Boolean).join(" "),
|
|
192
|
-
"data-disabled":
|
|
186
|
+
"data-disabled": c || void 0,
|
|
193
187
|
style: {
|
|
194
188
|
...C,
|
|
195
189
|
"--colour-hue": `hsl(${n.h} 100% 50%)`,
|
|
196
|
-
"--colour-rgb":
|
|
197
|
-
"--colour-rgba":
|
|
190
|
+
"--colour-rgb": H,
|
|
191
|
+
"--colour-rgba": f(n)
|
|
198
192
|
},
|
|
199
193
|
children: [
|
|
200
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ S("div", {
|
|
201
195
|
className: "ds-colour-panel__head ds-field-surface",
|
|
202
|
-
children: [/* @__PURE__ */
|
|
196
|
+
children: [/* @__PURE__ */ x("span", { children: "Colour" }), /* @__PURE__ */ x("span", {
|
|
203
197
|
className: "ds-colour-panel__value",
|
|
204
|
-
children:
|
|
198
|
+
children: V || "No colour"
|
|
205
199
|
})]
|
|
206
200
|
}),
|
|
207
|
-
s === "custom" ? /* @__PURE__ */
|
|
201
|
+
s === "custom" ? /* @__PURE__ */ S(ee, { children: [/* @__PURE__ */ x(w, {
|
|
208
202
|
colour: n,
|
|
209
|
-
isDisabled:
|
|
203
|
+
isDisabled: c,
|
|
210
204
|
onChange: i
|
|
211
|
-
}), /* @__PURE__ */
|
|
205
|
+
}), /* @__PURE__ */ S("div", {
|
|
212
206
|
className: "ds-colour-panel__hue-row",
|
|
213
|
-
children: [
|
|
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:
|
|
220
|
-
"aria-busy":
|
|
221
|
-
onClick: () => void
|
|
222
|
-
}), /* @__PURE__ */
|
|
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:
|
|
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__ */
|
|
245
|
+
})] }) : /* @__PURE__ */ S("div", {
|
|
252
246
|
className: "ds-colour-panel__native",
|
|
253
|
-
children: [/* @__PURE__ */
|
|
254
|
-
ref:
|
|
247
|
+
children: [/* @__PURE__ */ x("input", {
|
|
248
|
+
ref: M,
|
|
255
249
|
type: "color",
|
|
256
|
-
value:
|
|
250
|
+
value: H,
|
|
257
251
|
tabIndex: -1,
|
|
258
252
|
"aria-hidden": "true",
|
|
259
|
-
disabled:
|
|
253
|
+
disabled: c,
|
|
260
254
|
onChange: (e) => {
|
|
261
|
-
|
|
262
|
-
...
|
|
255
|
+
l(e.target.value) && i({
|
|
256
|
+
...u(e.target.value, n),
|
|
263
257
|
a: n.a
|
|
264
258
|
});
|
|
265
259
|
}
|
|
266
|
-
}), /* @__PURE__ */
|
|
260
|
+
}), /* @__PURE__ */ x(t, {
|
|
267
261
|
variant: "neutral",
|
|
268
262
|
size: "sm",
|
|
269
263
|
iconStart: "pipette",
|
|
270
|
-
isDisabled:
|
|
264
|
+
isDisabled: c,
|
|
271
265
|
onClick: () => {
|
|
272
|
-
let e =
|
|
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__ */
|
|
276
|
+
/* @__PURE__ */ S("div", {
|
|
283
277
|
className: "ds-colour-panel__opacity",
|
|
284
|
-
children: [/* @__PURE__ */
|
|
285
|
-
htmlFor: `${
|
|
278
|
+
children: [/* @__PURE__ */ x("label", {
|
|
279
|
+
htmlFor: `${B}-opacity`,
|
|
286
280
|
children: "Opacity"
|
|
287
|
-
}), /* @__PURE__ */
|
|
288
|
-
id: `${
|
|
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:
|
|
289
|
+
isDisabled: c,
|
|
296
290
|
onValueChange: (e) => i({
|
|
297
291
|
...n,
|
|
298
292
|
a: e / 100
|
|
299
293
|
})
|
|
300
294
|
})]
|
|
301
295
|
}),
|
|
302
|
-
o &&
|
|
296
|
+
o && U.length > 0 && /* @__PURE__ */ S("div", {
|
|
303
297
|
className: "ds-colour-panel__presets",
|
|
304
|
-
children: [/* @__PURE__ */
|
|
305
|
-
id:
|
|
298
|
+
children: [/* @__PURE__ */ x("span", {
|
|
299
|
+
id: B,
|
|
306
300
|
className: "ds-colour-panel__presets-label",
|
|
307
301
|
children: "Presets"
|
|
308
|
-
}), /* @__PURE__ */
|
|
302
|
+
}), /* @__PURE__ */ x("div", {
|
|
309
303
|
className: "ds-colour-panel__grid",
|
|
310
304
|
role: "radiogroup",
|
|
311
|
-
"aria-labelledby":
|
|
312
|
-
style: { "--colour-preset-columns":
|
|
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 :
|
|
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:
|
|
318
|
-
let o = a ===
|
|
319
|
-
return /* @__PURE__ */
|
|
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,
|
|
328
|
-
isDisabled:
|
|
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__ */
|
|
325
|
+
children: /* @__PURE__ */ x("span", {
|
|
332
326
|
className: "ds-colour-swatch",
|
|
333
327
|
style: { "--colour-swatch": n },
|
|
334
|
-
children: o && /* @__PURE__ */
|
|
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
|
-
|
|
338
|
+
L && /* @__PURE__ */ x("span", {
|
|
345
339
|
className: "ds-colour-panel__error",
|
|
346
340
|
role: "status",
|
|
347
|
-
children:
|
|
341
|
+
children: L
|
|
348
342
|
})
|
|
349
343
|
]
|
|
350
344
|
});
|
|
351
|
-
}),
|
|
352
|
-
let { current:
|
|
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:
|
|
355
|
-
onValueChange:
|
|
356
|
-
}), [
|
|
357
|
-
|
|
358
|
-
let $ =
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}, [Z,
|
|
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
|
-
|
|
357
|
+
K.current && i(K.current)[0]?.focus({ preventScroll: !0 });
|
|
364
358
|
let e = (e) => {
|
|
365
359
|
let t = e.target;
|
|
366
|
-
t && !
|
|
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
|
-
|
|
365
|
+
G.current = e, V(!$);
|
|
372
366
|
}, ie = () => {
|
|
373
|
-
|
|
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": $ ?
|
|
379
|
-
isDisabled: Q ||
|
|
372
|
+
"aria-controls": $ ? q : void 0,
|
|
373
|
+
isDisabled: Q || D
|
|
380
374
|
};
|
|
381
|
-
return /* @__PURE__ */
|
|
375
|
+
return /* @__PURE__ */ S("div", {
|
|
382
376
|
className: "ds-colour-field",
|
|
383
|
-
ref:
|
|
377
|
+
ref: U,
|
|
384
378
|
onBlur: (e) => {
|
|
385
379
|
let t = e.relatedTarget;
|
|
386
|
-
t && !
|
|
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" || !
|
|
390
|
-
let t =
|
|
391
|
-
(e.shiftKey ? e.target === t[0] : e.target === t.at(-1)) && (e.preventDefault(), e.stopPropagation(),
|
|
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__ */
|
|
387
|
+
children: [/* @__PURE__ */ x(c, {
|
|
394
388
|
isLeadInteractive: !0,
|
|
395
389
|
isTrailInteractive: !0,
|
|
396
|
-
lead: /* @__PURE__ */
|
|
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
|
-
|
|
399
|
+
G.current = W.current, $ ? ie() : V(!0);
|
|
406
400
|
},
|
|
407
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
421
|
-
...
|
|
422
|
-
ref: n(
|
|
423
|
-
id:
|
|
414
|
+
children: /* @__PURE__ */ x(o, {
|
|
415
|
+
...F,
|
|
416
|
+
ref: n(W, I),
|
|
417
|
+
id: te,
|
|
424
418
|
disabled: Q,
|
|
425
|
-
readOnly:
|
|
419
|
+
readOnly: D,
|
|
426
420
|
spellCheck: !1,
|
|
427
421
|
autoComplete: "off",
|
|
428
422
|
value: Y,
|
|
429
|
-
"aria-invalid": Z ||
|
|
423
|
+
"aria-invalid": Z || O || k || void 0,
|
|
430
424
|
"aria-haspopup": "dialog",
|
|
431
|
-
"aria-controls": $ ?
|
|
432
|
-
className: ["ds-colour-field__input",
|
|
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() || !!
|
|
435
|
-
ne(t, n), n &&
|
|
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(),
|
|
432
|
+
Z || X(), M?.(e);
|
|
439
433
|
},
|
|
440
434
|
onKeyDown: (e) => {
|
|
441
|
-
|
|
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__ */
|
|
445
|
-
anchorRef:
|
|
446
|
-
anchorId:
|
|
438
|
+
}), /* @__PURE__ */ x(s, {
|
|
439
|
+
anchorRef: W,
|
|
440
|
+
anchorId: te,
|
|
447
441
|
isOpen: $,
|
|
448
442
|
align: "start",
|
|
449
|
-
placement:
|
|
450
|
-
panelRef:
|
|
451
|
-
id:
|
|
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__ */
|
|
457
|
-
colour:
|
|
450
|
+
children: /* @__PURE__ */ x(N, {
|
|
451
|
+
colour: R,
|
|
458
452
|
current: J,
|
|
459
|
-
presets:
|
|
460
|
-
showPresets:
|
|
461
|
-
picker:
|
|
453
|
+
presets: m,
|
|
454
|
+
showPresets: _,
|
|
455
|
+
picker: b,
|
|
462
456
|
onColourChange: (e) => {
|
|
463
|
-
X(),
|
|
457
|
+
X(), z(e);
|
|
464
458
|
}
|
|
465
459
|
})
|
|
466
460
|
})]
|
|
467
461
|
});
|
|
468
462
|
});
|
|
469
463
|
//#endregion
|
|
470
|
-
export {
|
|
464
|
+
export { M as n, P as t };
|
|
471
465
|
|
|
472
|
-
//# sourceMappingURL=ColourField-
|
|
466
|
+
//# sourceMappingURL=ColourField-BTj9NHgI.js.map
|