@namroodinc/liquid-editorial 0.6.1 → 0.6.2
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 +27 -3
- package/UPGRADING.md +107 -0
- package/dist/chunks/Avatar-BTKqaJLP.cjs +2 -0
- package/dist/chunks/Avatar-BTKqaJLP.cjs.map +1 -0
- package/dist/chunks/Avatar-C1q2AUD-.js +149 -0
- package/dist/chunks/Avatar-C1q2AUD-.js.map +1 -0
- package/dist/chunks/{ColourField-Doew1hLw.js → ColourField-BmHHxU6T.js} +119 -162
- package/dist/chunks/ColourField-BmHHxU6T.js.map +1 -0
- package/dist/chunks/ColourField-DWdc4d9E.cjs +2 -0
- package/dist/chunks/ColourField-DWdc4d9E.cjs.map +1 -0
- package/dist/chunks/{DatePicker-DmeWUsOS.js → DatePicker-CFYwk6eA.js} +2 -1
- package/dist/chunks/{DatePicker-DmeWUsOS.js.map → DatePicker-CFYwk6eA.js.map} +1 -1
- package/dist/chunks/{DatePicker-C0-609Zx.cjs → DatePicker-D5-LzTXS.cjs} +2 -2
- package/dist/chunks/{DatePicker-C0-609Zx.cjs.map → DatePicker-D5-LzTXS.cjs.map} +1 -1
- package/dist/chunks/FormEditor-B-XLNrub.cjs +2 -0
- package/dist/chunks/FormEditor-B-XLNrub.cjs.map +1 -0
- package/dist/chunks/{FormEditor-DTnFO4oS.js → FormEditor-_gqfxL_g.js} +4 -3
- package/dist/chunks/{FormEditor-DTnFO4oS.js.map → FormEditor-_gqfxL_g.js.map} +1 -1
- package/dist/chunks/colour-BmtxDlWF.cjs +2 -0
- package/dist/chunks/colour-BmtxDlWF.cjs.map +1 -0
- package/dist/chunks/colour-CYEF4Q_n.js +48 -0
- package/dist/chunks/colour-CYEF4Q_n.js.map +1 -0
- package/dist/chunks/isComposing-8bRWyiLF.js +8 -0
- package/dist/chunks/isComposing-8bRWyiLF.js.map +1 -0
- package/dist/chunks/isComposing-BrBcAANm.cjs +2 -0
- package/dist/chunks/isComposing-BrBcAANm.cjs.map +1 -0
- package/dist/chunks/transitionDuration-B4UnScFc.cjs +2 -0
- package/dist/chunks/transitionDuration-B4UnScFc.cjs.map +1 -0
- package/dist/chunks/transitionDuration-BIBA3V7G.js +8 -0
- package/dist/chunks/transitionDuration-BIBA3V7G.js.map +1 -0
- package/dist/chunks/useModalDialog-Cgus9408.cjs +2 -0
- package/dist/chunks/useModalDialog-Cgus9408.cjs.map +1 -0
- package/dist/chunks/useModalDialog-Dh-_6A0j.js +85 -0
- package/dist/chunks/useModalDialog-Dh-_6A0j.js.map +1 -0
- package/dist/chunks/useTooltip-CCf79zE9.cjs +2 -0
- package/dist/chunks/useTooltip-CCf79zE9.cjs.map +1 -0
- package/dist/chunks/useTooltip-D6cJji8v.js +73 -0
- package/dist/chunks/useTooltip-D6cJji8v.js.map +1 -0
- package/dist/components/Avatar/colour.d.cts +6 -0
- package/dist/components/Avatar/colour.d.cts.map +1 -0
- package/dist/components/Avatar/colour.d.ts +6 -0
- package/dist/components/Avatar/colour.d.ts.map +1 -0
- package/dist/components/Avatar/index.cjs +1 -2
- package/dist/components/Avatar/index.d.cts +16 -9
- package/dist/components/Avatar/index.d.cts.map +1 -1
- package/dist/components/Avatar/index.d.ts +16 -9
- package/dist/components/Avatar/index.d.ts.map +1 -1
- package/dist/components/Avatar/index.js +1 -43
- package/dist/components/Avatar/style.css +65 -16
- 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/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.d.cts.map +1 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.cjs.map +1 -1
- package/dist/components/Drawer/index.d.cts.map +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +37 -36
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.d.cts.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +2 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.js +1 -1
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts +2 -2
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts +2 -2
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +69 -53
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Popover/style.css +33 -1
- package/dist/components/Popover/useTooltip.d.cts +33 -0
- package/dist/components/Popover/useTooltip.d.cts.map +1 -0
- package/dist/components/Popover/useTooltip.d.ts +33 -0
- package/dist/components/Popover/useTooltip.d.ts.map +1 -0
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.d.cts.map +1 -1
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +1 -0
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.cjs.map +1 -1
- package/dist/components/Time/index.d.cts.map +1 -1
- package/dist/components/Time/index.d.ts.map +1 -1
- package/dist/components/Time/index.js +25 -42
- package/dist/components/Time/index.js.map +1 -1
- package/dist/components/Time/style.css +1 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/internal/isComposing.d.cts +3 -0
- package/dist/internal/isComposing.d.cts.map +1 -0
- package/dist/internal/isComposing.d.ts +3 -0
- package/dist/internal/isComposing.d.ts.map +1 -0
- package/dist/internal/transitionDuration.d.cts +3 -0
- package/dist/internal/transitionDuration.d.cts.map +1 -0
- package/dist/internal/transitionDuration.d.ts +3 -0
- package/dist/internal/transitionDuration.d.ts.map +1 -0
- package/dist/internal/useModalDialog.d.cts.map +1 -1
- package/dist/internal/useModalDialog.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/chunks/ColourField-BQ4a5tAV.cjs +0 -2
- package/dist/chunks/ColourField-BQ4a5tAV.cjs.map +0 -1
- package/dist/chunks/ColourField-Doew1hLw.js.map +0 -1
- package/dist/chunks/FormEditor-DfQLJnsO.cjs +0 -2
- package/dist/chunks/FormEditor-DfQLJnsO.cjs.map +0 -1
- package/dist/chunks/useModalDialog-BVaG--b3.js +0 -87
- package/dist/chunks/useModalDialog-BVaG--b3.js.map +0 -1
- package/dist/chunks/useModalDialog-Ctu270Dp.cjs +0 -2
- package/dist/chunks/useModalDialog-Ctu270Dp.cjs.map +0 -1
- package/dist/components/Avatar/index.cjs.map +0 -1
- package/dist/components/Avatar/index.js.map +0 -1
|
@@ -5,74 +5,30 @@ import { s as r } from "./portalScope-AzzPM54i.js";
|
|
|
5
5
|
import { TextField as i } from "../components/TextField/index.js";
|
|
6
6
|
import { FieldAffix as a } from "../components/FieldAffix/index.js";
|
|
7
7
|
import { Popover as o } from "../components/Popover/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import b from "colord/plugins/names";
|
|
13
|
-
//#region src/components/ColourField/colour.ts
|
|
14
|
-
y([b]);
|
|
15
|
-
var x = {
|
|
16
|
-
h: 0,
|
|
17
|
-
s: 100,
|
|
18
|
-
v: 0,
|
|
19
|
-
a: 1
|
|
20
|
-
};
|
|
21
|
-
function S(e) {
|
|
22
|
-
let t = e.trim();
|
|
23
|
-
if (!t) return null;
|
|
24
|
-
let n = t.replace(/^#/, ""), r = n.length < 5 ? [...n].map((e) => e + e).join("") : n, i = /^(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i.test(n) ? v({
|
|
25
|
-
r: parseInt(r.slice(0, 2), 16),
|
|
26
|
-
g: parseInt(r.slice(2, 4), 16),
|
|
27
|
-
b: parseInt(r.slice(4, 6), 16),
|
|
28
|
-
a: r.length === 8 ? parseInt(r.slice(6), 16) / 255 : 1
|
|
29
|
-
}) : v(t);
|
|
30
|
-
return i.isValid() ? i : null;
|
|
31
|
-
}
|
|
32
|
-
function C(e) {
|
|
33
|
-
return v(e).toHex().toUpperCase();
|
|
34
|
-
}
|
|
35
|
-
function w(e) {
|
|
36
|
-
return S(e)?.toHex().toUpperCase() ?? "";
|
|
37
|
-
}
|
|
38
|
-
function T(e, t = x) {
|
|
39
|
-
let n = S(e);
|
|
40
|
-
if (!n || n.toHex().toUpperCase() === C(t)) return t;
|
|
41
|
-
let { r, g: i, b: a, a: o } = n.rgba, s = Math.max(r, i, a), c = s - Math.min(r, i, a), l = c === 0 ? t.h : s === r ? (i - a) / c * 60 : s === i ? ((a - r) / c + 2) * 60 : ((r - i) / c + 4) * 60;
|
|
42
|
-
l < 0 && (l += 360);
|
|
43
|
-
let u = {
|
|
44
|
-
h: l,
|
|
45
|
-
s: s ? c / s * 100 : 0,
|
|
46
|
-
v: s / 255 * 100,
|
|
47
|
-
a: o
|
|
48
|
-
};
|
|
49
|
-
return {
|
|
50
|
-
...u,
|
|
51
|
-
h: u.s === 0 ? t.h : u.h,
|
|
52
|
-
s: u.v === 0 ? t.s : u.s
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
8
|
+
import { i as s, n as c, r as l, t as u } from "./colour-CYEF4Q_n.js";
|
|
9
|
+
import { n as d } from "./Slider-vdMFLX-H.js";
|
|
10
|
+
import { forwardRef as f, useEffect as p, useId as m, useMemo as h, 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";
|
|
56
12
|
//#region src/components/ColourField/focus.ts
|
|
57
|
-
function
|
|
13
|
+
function S(e) {
|
|
58
14
|
let t = e.closest("[aria-modal='true']") ?? document.body, n = r(t).filter((e) => !e.closest(".ds-popover"));
|
|
59
15
|
(n[n.map((t) => e.contains(t)).lastIndexOf(!0) + 1] ?? n[0])?.focus({ preventScroll: !0 });
|
|
60
16
|
}
|
|
61
17
|
//#endregion
|
|
62
18
|
//#region src/components/ColourField/square.tsx
|
|
63
|
-
function
|
|
19
|
+
function C(e) {
|
|
64
20
|
return Math.max(0, Math.min(100, e));
|
|
65
21
|
}
|
|
66
|
-
function
|
|
67
|
-
let r =
|
|
22
|
+
function w({ colour: e, isDisabled: t, onChange: n }) {
|
|
23
|
+
let r = g(null), i = (t) => {
|
|
68
24
|
let r = t.currentTarget.getBoundingClientRect();
|
|
69
25
|
r.width && r.height && n({
|
|
70
26
|
...e,
|
|
71
|
-
s:
|
|
72
|
-
v:
|
|
27
|
+
s: C((t.clientX - r.left) / r.width * 100),
|
|
28
|
+
v: C((1 - (t.clientY - r.top) / r.height) * 100)
|
|
73
29
|
});
|
|
74
30
|
};
|
|
75
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ b("div", {
|
|
76
32
|
className: "ds-colour-panel__square",
|
|
77
33
|
role: "slider",
|
|
78
34
|
tabIndex: t ? -1 : 0,
|
|
@@ -85,10 +41,10 @@ function O({ colour: e, isDisabled: t, onChange: n }) {
|
|
|
85
41
|
onKeyDown: (r) => {
|
|
86
42
|
if (t) return;
|
|
87
43
|
let i = r.shiftKey ? 10 : 1, a = {
|
|
88
|
-
ArrowLeft: { s:
|
|
89
|
-
ArrowRight: { s:
|
|
90
|
-
ArrowDown: { v:
|
|
91
|
-
ArrowUp: { v:
|
|
44
|
+
ArrowLeft: { s: C(e.s - i) },
|
|
45
|
+
ArrowRight: { s: C(e.s + i) },
|
|
46
|
+
ArrowDown: { v: C(e.v - i) },
|
|
47
|
+
ArrowUp: { v: C(e.v + i) },
|
|
92
48
|
Home: { s: 0 },
|
|
93
49
|
End: { s: 100 }
|
|
94
50
|
}[r.key];
|
|
@@ -112,7 +68,7 @@ function O({ colour: e, isDisabled: t, onChange: n }) {
|
|
|
112
68
|
onLostPointerCapture: () => {
|
|
113
69
|
r.current = null;
|
|
114
70
|
},
|
|
115
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ b("span", {
|
|
116
72
|
className: "ds-colour-panel__thumb",
|
|
117
73
|
style: {
|
|
118
74
|
left: `${e.s}%`,
|
|
@@ -123,35 +79,35 @@ function O({ colour: e, isDisabled: t, onChange: n }) {
|
|
|
123
79
|
}
|
|
124
80
|
//#endregion
|
|
125
81
|
//#region src/components/ColourField/value.ts
|
|
126
|
-
function
|
|
127
|
-
let [r, i] =
|
|
82
|
+
function T({ value: e, defaultValue: t = "", onValueChange: n }) {
|
|
83
|
+
let [r, i] = _(t), a = e ?? r, [o, s] = _(() => ({
|
|
128
84
|
source: a,
|
|
129
|
-
colour:
|
|
130
|
-
})),
|
|
131
|
-
return o.source !== a && (
|
|
85
|
+
colour: c(a)
|
|
86
|
+
})), d = o.colour;
|
|
87
|
+
return o.source !== a && (d = c(a, d), s({
|
|
132
88
|
source: a,
|
|
133
|
-
colour:
|
|
89
|
+
colour: d
|
|
134
90
|
})), {
|
|
135
91
|
current: a,
|
|
136
|
-
colour:
|
|
92
|
+
colour: d,
|
|
137
93
|
commit: (t) => {
|
|
138
|
-
let r = typeof t == "string" ?
|
|
94
|
+
let r = typeof t == "string" ? l(t) : u(t);
|
|
139
95
|
s({
|
|
140
96
|
source: r,
|
|
141
|
-
colour: typeof t == "string" ?
|
|
97
|
+
colour: typeof t == "string" ? c(t, d) : t
|
|
142
98
|
}), e === void 0 && i(r), n?.(r);
|
|
143
99
|
}
|
|
144
100
|
};
|
|
145
101
|
}
|
|
146
|
-
function
|
|
147
|
-
let [n, r] =
|
|
102
|
+
function E(e, t) {
|
|
103
|
+
let [n, r] = _(null);
|
|
148
104
|
return n && n.source !== e && n.text === e && r({
|
|
149
105
|
source: e,
|
|
150
106
|
text: e
|
|
151
107
|
}), {
|
|
152
108
|
text: n?.source === e ? n.text : t || e,
|
|
153
109
|
type: (t, n) => r({
|
|
154
|
-
source: n ?
|
|
110
|
+
source: n ? l(t) : e,
|
|
155
111
|
text: t
|
|
156
112
|
}),
|
|
157
113
|
discard: () => r(null)
|
|
@@ -159,43 +115,43 @@ function A(e, t) {
|
|
|
159
115
|
}
|
|
160
116
|
//#endregion
|
|
161
117
|
//#region src/components/ColourField/panel.tsx
|
|
162
|
-
function
|
|
118
|
+
function D() {
|
|
163
119
|
return window.EyeDropper;
|
|
164
120
|
}
|
|
165
|
-
var
|
|
166
|
-
function
|
|
167
|
-
let r = t %
|
|
121
|
+
var O = () => () => {}, k = [], A = 8;
|
|
122
|
+
function j(e, t, n) {
|
|
123
|
+
let r = t % A, i = r + Math.floor((n - 1 - r) / A) * A;
|
|
168
124
|
switch (e) {
|
|
169
125
|
case "Home": return 0;
|
|
170
126
|
case "End": return n - 1;
|
|
171
127
|
case "ArrowRight": return (t + 1) % n;
|
|
172
128
|
case "ArrowLeft": return (t - 1 + n) % n;
|
|
173
|
-
case "ArrowDown": return t +
|
|
174
|
-
case "ArrowUp": return t >=
|
|
129
|
+
case "ArrowDown": return t + A < n ? t + A : r;
|
|
130
|
+
case "ArrowUp": return t >= A ? t - A : i;
|
|
175
131
|
default: return;
|
|
176
132
|
}
|
|
177
133
|
}
|
|
178
|
-
var
|
|
179
|
-
let { current: a, colour: o, commit: s } =
|
|
134
|
+
var M = f(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
135
|
+
let { current: a, colour: o, commit: s } = T({
|
|
180
136
|
value: e,
|
|
181
137
|
defaultValue: t,
|
|
182
138
|
onValueChange: n
|
|
183
139
|
});
|
|
184
|
-
return /* @__PURE__ */
|
|
140
|
+
return /* @__PURE__ */ b(N, {
|
|
185
141
|
...r,
|
|
186
142
|
ref: i,
|
|
187
143
|
colour: o,
|
|
188
144
|
current: a,
|
|
189
145
|
onColourChange: s
|
|
190
146
|
});
|
|
191
|
-
}),
|
|
192
|
-
let
|
|
147
|
+
}), N = f(function({ colour: n, current: r, onColourChange: i, presets: a = k, showPresets: o = !0, picker: f = "custom", isDisabled: S = !1, className: C, style: T, ...E }, M) {
|
|
148
|
+
let N = g(null), P = g(!0), F = g(S), [I, L] = _(!1), [R, z] = _(""), B = v(O, () => !!D(), () => !1), V = m(), H = l(r), U = u({
|
|
193
149
|
...n,
|
|
194
150
|
a: 1
|
|
195
|
-
}), W =
|
|
151
|
+
}), W = h(() => {
|
|
196
152
|
let e = /* @__PURE__ */ new Map();
|
|
197
153
|
for (let t of a) {
|
|
198
|
-
let n =
|
|
154
|
+
let n = l(t);
|
|
199
155
|
n && !e.has(n) && e.set(n, t);
|
|
200
156
|
}
|
|
201
157
|
return [...e].map(([e, t]) => ({
|
|
@@ -203,63 +159,63 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
203
159
|
preset: t
|
|
204
160
|
}));
|
|
205
161
|
}, [a]), G = W.findIndex((e) => e.normalised === H);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}, [
|
|
209
|
-
|
|
162
|
+
p(() => {
|
|
163
|
+
F.current = S;
|
|
164
|
+
}, [S]), p(() => (P.current = !0, () => {
|
|
165
|
+
P.current = !1;
|
|
210
166
|
}), []);
|
|
211
167
|
let K = async () => {
|
|
212
|
-
let e =
|
|
213
|
-
if (!(!e ||
|
|
168
|
+
let e = D();
|
|
169
|
+
if (!(!e || S || I)) {
|
|
214
170
|
L(!0), z("");
|
|
215
171
|
try {
|
|
216
172
|
let t = await new e().open();
|
|
217
|
-
|
|
218
|
-
...
|
|
173
|
+
P.current && !F.current && s(t.sRGBHex) && i({
|
|
174
|
+
...c(t.sRGBHex, n),
|
|
219
175
|
a: n.a
|
|
220
176
|
});
|
|
221
177
|
} catch (e) {
|
|
222
|
-
|
|
178
|
+
P.current && !(e instanceof DOMException && e.name === "AbortError") && z("Unable to pick a colour from the screen. Try again.");
|
|
223
179
|
} finally {
|
|
224
|
-
|
|
180
|
+
P.current && L(!1);
|
|
225
181
|
}
|
|
226
182
|
}
|
|
227
183
|
};
|
|
228
|
-
return /* @__PURE__ */
|
|
229
|
-
...
|
|
230
|
-
ref:
|
|
231
|
-
className: ["ds-colour-panel",
|
|
232
|
-
"data-disabled":
|
|
184
|
+
return /* @__PURE__ */ x("div", {
|
|
185
|
+
...E,
|
|
186
|
+
ref: M,
|
|
187
|
+
className: ["ds-colour-panel", C].filter(Boolean).join(" "),
|
|
188
|
+
"data-disabled": S || void 0,
|
|
233
189
|
style: {
|
|
234
|
-
...
|
|
190
|
+
...T,
|
|
235
191
|
"--colour-hue": `hsl(${n.h} 100% 50%)`,
|
|
236
192
|
"--colour-rgb": U,
|
|
237
|
-
"--colour-rgba":
|
|
193
|
+
"--colour-rgba": u(n)
|
|
238
194
|
},
|
|
239
195
|
children: [
|
|
240
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ x("div", {
|
|
241
197
|
className: "ds-colour-panel__head",
|
|
242
|
-
children: [/* @__PURE__ */
|
|
198
|
+
children: [/* @__PURE__ */ b("span", { children: "Colour" }), /* @__PURE__ */ b("span", {
|
|
243
199
|
className: "ds-colour-panel__value",
|
|
244
200
|
children: H || "No colour"
|
|
245
201
|
})]
|
|
246
202
|
}),
|
|
247
|
-
|
|
203
|
+
f === "custom" ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(w, {
|
|
248
204
|
colour: n,
|
|
249
|
-
isDisabled:
|
|
205
|
+
isDisabled: S,
|
|
250
206
|
onChange: i
|
|
251
|
-
}), /* @__PURE__ */
|
|
207
|
+
}), /* @__PURE__ */ x("div", {
|
|
252
208
|
className: "ds-colour-panel__hue-row",
|
|
253
|
-
children: [B && /* @__PURE__ */
|
|
209
|
+
children: [B && /* @__PURE__ */ b(t, {
|
|
254
210
|
variant: "simple",
|
|
255
211
|
size: "sm",
|
|
256
212
|
isIconOnly: !0,
|
|
257
213
|
iconStart: "pipette",
|
|
258
214
|
"aria-label": "Pick from screen",
|
|
259
|
-
isDisabled:
|
|
215
|
+
isDisabled: S,
|
|
260
216
|
"aria-busy": I || void 0,
|
|
261
217
|
onClick: () => void K()
|
|
262
|
-
}), /* @__PURE__ */
|
|
218
|
+
}), /* @__PURE__ */ b(d, {
|
|
263
219
|
className: "ds-colour-panel__hue",
|
|
264
220
|
value: n.h,
|
|
265
221
|
min: 0,
|
|
@@ -268,7 +224,7 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
268
224
|
hasValueLabel: !1,
|
|
269
225
|
"aria-label": "Hue",
|
|
270
226
|
"aria-valuetext": `${Math.round(n.h)} degrees`,
|
|
271
|
-
isDisabled:
|
|
227
|
+
isDisabled: S,
|
|
272
228
|
onValueChange: (e) => i({
|
|
273
229
|
...n,
|
|
274
230
|
h: e
|
|
@@ -288,28 +244,28 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
288
244
|
});
|
|
289
245
|
}
|
|
290
246
|
})]
|
|
291
|
-
})] }) : /* @__PURE__ */
|
|
247
|
+
})] }) : /* @__PURE__ */ x("div", {
|
|
292
248
|
className: "ds-colour-panel__native",
|
|
293
|
-
children: [/* @__PURE__ */
|
|
294
|
-
ref:
|
|
249
|
+
children: [/* @__PURE__ */ b("input", {
|
|
250
|
+
ref: N,
|
|
295
251
|
type: "color",
|
|
296
252
|
value: U,
|
|
297
253
|
tabIndex: -1,
|
|
298
254
|
"aria-hidden": "true",
|
|
299
|
-
disabled:
|
|
255
|
+
disabled: S,
|
|
300
256
|
onChange: (e) => {
|
|
301
|
-
|
|
302
|
-
...
|
|
257
|
+
s(e.target.value) && i({
|
|
258
|
+
...c(e.target.value, n),
|
|
303
259
|
a: n.a
|
|
304
260
|
});
|
|
305
261
|
}
|
|
306
|
-
}), /* @__PURE__ */
|
|
262
|
+
}), /* @__PURE__ */ b(t, {
|
|
307
263
|
variant: "neutral",
|
|
308
264
|
size: "sm",
|
|
309
265
|
iconStart: "pipette",
|
|
310
|
-
isDisabled:
|
|
266
|
+
isDisabled: S,
|
|
311
267
|
onClick: () => {
|
|
312
|
-
let e =
|
|
268
|
+
let e = N.current;
|
|
313
269
|
if (e) try {
|
|
314
270
|
e.showPicker ? e.showPicker() : e.click();
|
|
315
271
|
} catch {
|
|
@@ -319,12 +275,12 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
319
275
|
children: "Custom colour…"
|
|
320
276
|
})]
|
|
321
277
|
}),
|
|
322
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ x("div", {
|
|
323
279
|
className: "ds-colour-panel__opacity",
|
|
324
|
-
children: [/* @__PURE__ */
|
|
280
|
+
children: [/* @__PURE__ */ b("label", {
|
|
325
281
|
htmlFor: `${V}-opacity`,
|
|
326
282
|
children: "Opacity"
|
|
327
|
-
}), /* @__PURE__ */
|
|
283
|
+
}), /* @__PURE__ */ b(d, {
|
|
328
284
|
id: `${V}-opacity`,
|
|
329
285
|
className: "ds-colour-panel__alpha",
|
|
330
286
|
value: Math.round(n.a * 100),
|
|
@@ -332,31 +288,31 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
332
288
|
max: 100,
|
|
333
289
|
step: 1,
|
|
334
290
|
suffix: "%",
|
|
335
|
-
isDisabled:
|
|
291
|
+
isDisabled: S,
|
|
336
292
|
onValueChange: (e) => i({
|
|
337
293
|
...n,
|
|
338
294
|
a: e / 100
|
|
339
295
|
})
|
|
340
296
|
})]
|
|
341
297
|
}),
|
|
342
|
-
o && W.length > 0 && /* @__PURE__ */
|
|
298
|
+
o && W.length > 0 && /* @__PURE__ */ x("div", {
|
|
343
299
|
className: "ds-colour-panel__presets",
|
|
344
|
-
children: [/* @__PURE__ */
|
|
300
|
+
children: [/* @__PURE__ */ b("span", {
|
|
345
301
|
id: V,
|
|
346
302
|
className: "ds-colour-panel__presets-label",
|
|
347
303
|
children: "Presets"
|
|
348
|
-
}), /* @__PURE__ */
|
|
304
|
+
}), /* @__PURE__ */ b("div", {
|
|
349
305
|
className: "ds-colour-panel__grid",
|
|
350
306
|
role: "radiogroup",
|
|
351
307
|
"aria-labelledby": V,
|
|
352
|
-
style: { "--colour-preset-columns":
|
|
308
|
+
style: { "--colour-preset-columns": A },
|
|
353
309
|
onKeyDown: (e) => {
|
|
354
|
-
let t = Array.from(e.currentTarget.querySelectorAll("[role='radio']")), n = t.indexOf(e.target), r = n < 0 ? void 0 :
|
|
310
|
+
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);
|
|
355
311
|
r !== void 0 && (e.preventDefault(), t[r]?.focus(), t[r]?.click());
|
|
356
312
|
},
|
|
357
313
|
children: W.map(({ normalised: n, preset: r }, a) => {
|
|
358
314
|
let o = a === G;
|
|
359
|
-
return /* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ b(t, {
|
|
360
316
|
variant: "simple",
|
|
361
317
|
size: "xs",
|
|
362
318
|
isIconOnly: !0,
|
|
@@ -365,13 +321,13 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
365
321
|
"aria-label": r,
|
|
366
322
|
title: r,
|
|
367
323
|
tabIndex: a === Math.max(0, G) ? 0 : -1,
|
|
368
|
-
isDisabled:
|
|
324
|
+
isDisabled: S,
|
|
369
325
|
className: "ds-colour-panel__preset",
|
|
370
326
|
onClick: () => i(r),
|
|
371
|
-
children: /* @__PURE__ */
|
|
327
|
+
children: /* @__PURE__ */ b("span", {
|
|
372
328
|
className: "ds-colour-swatch",
|
|
373
329
|
style: { "--colour-swatch": n },
|
|
374
|
-
children: o && /* @__PURE__ */
|
|
330
|
+
children: o && /* @__PURE__ */ b(e, {
|
|
375
331
|
name: "check",
|
|
376
332
|
size: 16,
|
|
377
333
|
strokeWidth: 3
|
|
@@ -381,24 +337,24 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
381
337
|
})
|
|
382
338
|
})]
|
|
383
339
|
}),
|
|
384
|
-
R && /* @__PURE__ */
|
|
340
|
+
R && /* @__PURE__ */ b("span", {
|
|
385
341
|
className: "ds-colour-panel__error",
|
|
386
342
|
role: "status",
|
|
387
343
|
children: R
|
|
388
344
|
})
|
|
389
345
|
]
|
|
390
346
|
});
|
|
391
|
-
}),
|
|
392
|
-
let { current:
|
|
347
|
+
}), P = f(function({ value: e, defaultValue: c, onValueChange: u, onValidityChange: d, presets: f, showPresets: h, picker: v, placement: y, isDisabled: C = !1, disabled: w, readOnly: D, isInvalid: O, "aria-invalid": k, id: A, className: j, onBlur: M, onKeyDown: P, ...F }, I) {
|
|
348
|
+
let { current: L, colour: R, commit: z } = T({
|
|
393
349
|
value: e,
|
|
394
|
-
defaultValue:
|
|
395
|
-
onValueChange:
|
|
396
|
-
}), [B, V] =
|
|
397
|
-
B && (Q ||
|
|
398
|
-
let $ = B && !Q && !
|
|
399
|
-
|
|
350
|
+
defaultValue: c,
|
|
351
|
+
onValueChange: u
|
|
352
|
+
}), [B, V] = _(!1), H = g(null), U = g(null), W = g(null), G = g(null), K = m(), q = A ?? `${K}-input`, J = l(L), { text: Y, type: ee, discard: X } = E(L, J), Z = !(!Y.trim() || s(Y)), Q = C || w;
|
|
353
|
+
B && (Q || D) && V(!1);
|
|
354
|
+
let $ = B && !Q && !D;
|
|
355
|
+
p(() => {
|
|
400
356
|
d?.(!Z), U.current?.setCustomValidity(Z ? "Enter a colour, such as #0052CC or rebeccapurple." : "");
|
|
401
|
-
}, [Z, d]),
|
|
357
|
+
}, [Z, d]), p(() => {
|
|
402
358
|
if (!$) return;
|
|
403
359
|
G.current && r(G.current)[0]?.focus({ preventScroll: !0 });
|
|
404
360
|
let e = (e) => {
|
|
@@ -416,9 +372,9 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
416
372
|
"aria-haspopup": "dialog",
|
|
417
373
|
"aria-expanded": $,
|
|
418
374
|
"aria-controls": $ ? K : void 0,
|
|
419
|
-
isDisabled: Q ||
|
|
375
|
+
isDisabled: Q || D
|
|
420
376
|
};
|
|
421
|
-
return /* @__PURE__ */
|
|
377
|
+
return /* @__PURE__ */ x("div", {
|
|
422
378
|
className: "ds-colour-field",
|
|
423
379
|
ref: H,
|
|
424
380
|
onBlur: (e) => {
|
|
@@ -428,12 +384,12 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
428
384
|
onKeyDown: (e) => {
|
|
429
385
|
if ($ && e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), ne()), !$ || e.key !== "Tab" || !G.current?.contains(e.target)) return;
|
|
430
386
|
let t = r(G.current);
|
|
431
|
-
(e.shiftKey ? e.target === t[0] : e.target === t.at(-1)) && (e.preventDefault(), e.stopPropagation(), V(!1), e.shiftKey ? W.current?.focus({ preventScroll: !0 }) : H.current &&
|
|
387
|
+
(e.shiftKey ? e.target === t[0] : e.target === t.at(-1)) && (e.preventDefault(), e.stopPropagation(), V(!1), e.shiftKey ? W.current?.focus({ preventScroll: !0 }) : H.current && S(H.current));
|
|
432
388
|
},
|
|
433
|
-
children: [/* @__PURE__ */
|
|
389
|
+
children: [/* @__PURE__ */ b(a, {
|
|
434
390
|
isLeadInteractive: !0,
|
|
435
391
|
isTrailInteractive: !0,
|
|
436
|
-
lead: /* @__PURE__ */
|
|
392
|
+
lead: /* @__PURE__ */ b(t, {
|
|
437
393
|
"aria-hidden": "true",
|
|
438
394
|
tabIndex: -1,
|
|
439
395
|
isDisabled: re.isDisabled,
|
|
@@ -444,12 +400,12 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
444
400
|
onClick: () => {
|
|
445
401
|
W.current = U.current, $ ? ne() : V(!0);
|
|
446
402
|
},
|
|
447
|
-
children: /* @__PURE__ */
|
|
403
|
+
children: /* @__PURE__ */ b("span", {
|
|
448
404
|
className: "ds-colour-swatch ds-colour-field__swatch",
|
|
449
405
|
style: { "--colour-swatch": J || "transparent" }
|
|
450
406
|
})
|
|
451
407
|
}),
|
|
452
|
-
trail: /* @__PURE__ */
|
|
408
|
+
trail: /* @__PURE__ */ b(t, {
|
|
453
409
|
...re,
|
|
454
410
|
variant: "simple",
|
|
455
411
|
size: "xs",
|
|
@@ -457,34 +413,35 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
457
413
|
iconStart: "chevron-down",
|
|
458
414
|
onClick: (e) => te(e.currentTarget)
|
|
459
415
|
}),
|
|
460
|
-
children: /* @__PURE__ */
|
|
461
|
-
...
|
|
462
|
-
ref: n(U,
|
|
416
|
+
children: /* @__PURE__ */ b(i, {
|
|
417
|
+
...F,
|
|
418
|
+
ref: n(U, I),
|
|
463
419
|
id: q,
|
|
464
420
|
disabled: Q,
|
|
465
|
-
readOnly:
|
|
421
|
+
readOnly: D,
|
|
466
422
|
spellCheck: !1,
|
|
467
423
|
autoComplete: "off",
|
|
468
424
|
value: Y,
|
|
469
|
-
"aria-invalid": Z ||
|
|
425
|
+
"aria-invalid": Z || O || k || void 0,
|
|
470
426
|
"aria-haspopup": "dialog",
|
|
471
427
|
"aria-controls": $ ? K : void 0,
|
|
472
428
|
className: ["ds-colour-field__input", j].filter(Boolean).join(" "),
|
|
473
429
|
onChange: (e) => {
|
|
474
|
-
let t = e.target.value, n = !t.trim() || !!
|
|
430
|
+
let t = e.target.value, n = !t.trim() || !!s(t);
|
|
475
431
|
ee(t, n), n && z(t);
|
|
476
432
|
},
|
|
477
433
|
onBlur: (e) => {
|
|
478
434
|
Z || X(), M?.(e);
|
|
479
435
|
},
|
|
480
436
|
onKeyDown: (e) => {
|
|
481
|
-
|
|
437
|
+
P?.(e), !e.defaultPrevented && (e.key === "Enter" && !Z && (e.preventDefault(), X()), e.key === "ArrowDown" && !Q && !D && (e.preventDefault(), W.current = e.currentTarget, V(!0)));
|
|
482
438
|
}
|
|
483
439
|
})
|
|
484
|
-
}), /* @__PURE__ */
|
|
440
|
+
}), /* @__PURE__ */ b(o, {
|
|
485
441
|
anchorRef: U,
|
|
486
442
|
anchorId: q,
|
|
487
443
|
isOpen: $,
|
|
444
|
+
align: "start",
|
|
488
445
|
placement: y,
|
|
489
446
|
panelRef: G,
|
|
490
447
|
id: K,
|
|
@@ -492,10 +449,10 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
492
449
|
"aria-label": "Choose a colour",
|
|
493
450
|
tabIndex: -1,
|
|
494
451
|
className: "ds-colour-field__popover",
|
|
495
|
-
children: /* @__PURE__ */
|
|
452
|
+
children: /* @__PURE__ */ b(N, {
|
|
496
453
|
colour: R,
|
|
497
454
|
current: J,
|
|
498
|
-
presets:
|
|
455
|
+
presets: f,
|
|
499
456
|
showPresets: h,
|
|
500
457
|
picker: v,
|
|
501
458
|
onColourChange: (e) => {
|
|
@@ -506,6 +463,6 @@ var I = c(function({ value: e, defaultValue: t, onValueChange: n, ...r }, i) {
|
|
|
506
463
|
});
|
|
507
464
|
});
|
|
508
465
|
//#endregion
|
|
509
|
-
export {
|
|
466
|
+
export { M as n, P as t };
|
|
510
467
|
|
|
511
|
-
//# sourceMappingURL=ColourField-
|
|
468
|
+
//# sourceMappingURL=ColourField-BmHHxU6T.js.map
|