@blakesteve/roster 5.11.0 → 5.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 +137 -16
- package/dist/components/atoms/Chip/chip-variants.cjs +1 -1
- package/dist/components/atoms/Chip/chip-variants.js +8 -2
- package/dist/components/atoms/Combobox/Combobox.cjs +1 -1
- package/dist/components/atoms/Combobox/Combobox.js +20 -18
- package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/atoms/MultiSelect/MultiSelect.js +22 -20
- package/dist/components/atoms/Select/Select.cjs +1 -1
- package/dist/components/atoms/Select/Select.js +19 -17
- package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
- package/dist/components/molecules/Carousel/Carousel.js +31 -29
- package/dist/components/molecules/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/molecules/FileUpload/FileUpload.js +21 -19
- package/dist/components/molecules/LiquidTabs/LiquidCount.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/LiquidCount.d.ts +29 -0
- package/dist/components/molecules/LiquidTabs/LiquidCount.js +21 -0
- package/dist/components/molecules/LiquidTabs/LiquidNav.cjs +1 -1
- package/dist/components/molecules/LiquidTabs/LiquidNav.d.ts +12 -1
- package/dist/components/molecules/LiquidTabs/LiquidNav.js +50 -44
- package/dist/components/molecules/LiquidTabs/LiquidTabPanel.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabPanel.d.ts +52 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabPanel.js +32 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabs.cjs +1 -1
- package/dist/components/molecules/LiquidTabs/LiquidTabs.d.ts +20 -1
- package/dist/components/molecules/LiquidTabs/LiquidTabs.js +59 -52
- package/dist/components/molecules/LiquidTabs/liquid-count.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/liquid-count.d.ts +37 -0
- package/dist/components/molecules/LiquidTabs/liquid-count.js +9 -0
- package/dist/components/molecules/Menu/Menu.cjs +1 -1
- package/dist/components/molecules/Menu/Menu.js +104 -102
- package/dist/components/molecules/RadioGroup/RadioGroup.cjs +1 -1
- package/dist/components/molecules/RadioGroup/RadioGroup.js +23 -21
- package/dist/components/molecules/RangeSlider/RangeSlider.cjs +1 -1
- package/dist/components/molecules/RangeSlider/RangeSlider.d.ts +8 -3
- package/dist/components/molecules/RangeSlider/RangeSlider.js +38 -36
- package/dist/components/molecules/Slider/Slider.cjs +1 -1
- package/dist/components/molecules/Slider/Slider.d.ts +7 -3
- package/dist/components/molecules/Slider/Slider.js +30 -28
- package/dist/components/molecules/Slider/track-parts.d.ts +2 -1
- package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
- package/dist/components/organisms/Dialog/Dialog.js +19 -17
- package/dist/components/organisms/ModerationQueue/ModerationQueue.cjs +1 -1
- package/dist/components/organisms/ModerationQueue/ModerationQueue.js +230 -207
- package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
- package/dist/components/organisms/Navbar/Navbar.js +24 -22
- package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
- package/dist/components/organisms/Sheet/Sheet.js +25 -23
- package/dist/index.d.ts +2 -0
- package/dist/internal/key-focus.cjs +1 -0
- package/dist/internal/key-focus.d.ts +32 -0
- package/dist/internal/key-focus.js +60 -0
- package/dist/internal/popup.cjs +1 -1
- package/dist/internal/popup.d.ts +15 -1
- package/dist/internal/popup.js +17 -12
- package/dist/meta.json +3 -3
- package/dist/roster.cjs +1 -1
- package/dist/roster.css +1 -1
- package/dist/roster.js +150 -145
- package/package.json +2 -2
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as q, jsx as
|
|
3
|
-
import { useId as Qe, useRef as g, useState as
|
|
4
|
-
import { cn as
|
|
2
|
+
import { jsxs as q, jsx as i, Fragment as qe } from "react/jsx-runtime";
|
|
3
|
+
import { useId as Qe, useRef as g, useState as R, useCallback as re, useLayoutEffect as ne } from "react";
|
|
4
|
+
import { cn as j } from "../../../lib/utils.js";
|
|
5
5
|
import { withLabels as Ge } from "../../../lib/labels.js";
|
|
6
|
-
import { Button as
|
|
6
|
+
import { Button as $e } from "../../atoms/Button/Button.js";
|
|
7
7
|
import { Card as We } from "../../atoms/Card/Card.js";
|
|
8
8
|
import { Spinner as Je } from "../../atoms/Spinner/Spinner.js";
|
|
9
9
|
import { Textarea as Ue } from "../../atoms/Textarea/Textarea.js";
|
|
10
|
-
import { Alert as
|
|
10
|
+
import { Alert as oe } from "../../molecules/Alert/Alert.js";
|
|
11
11
|
import { EmptyState as Ve } from "../../molecules/EmptyState/EmptyState.js";
|
|
12
12
|
import { RadioGroup as Xe } from "../../molecules/RadioGroup/RadioGroup.js";
|
|
13
13
|
import { editAction as Ye } from "./queue-actions.js";
|
|
14
|
-
|
|
14
|
+
import { useKeyFocus as Ze } from "../../../internal/key-focus.js";
|
|
15
|
+
const _e = {
|
|
15
16
|
loading: (n) => `Loading ${n}`,
|
|
16
17
|
loadFailed: "The queue couldn't load.",
|
|
17
18
|
retry: "Retry",
|
|
18
19
|
busy: "loading",
|
|
19
20
|
cancel: "Cancel",
|
|
20
21
|
decide: (n) => `Decide: ${n}`,
|
|
21
|
-
decided: (n,
|
|
22
|
-
failed: (n,
|
|
22
|
+
decided: (n, c) => `${n}: ${c}.`,
|
|
23
|
+
failed: (n, c, f) => `${n} didn't go through for ${c}. ${f}`,
|
|
23
24
|
unknownError: "Something went wrong.",
|
|
24
25
|
decidedElsewhere: (n) => `${n} was decided elsewhere.`,
|
|
25
26
|
left: (n) => n === 0 ? "None left." : `${n} left.`,
|
|
@@ -29,86 +30,89 @@ const Ze = {
|
|
|
29
30
|
reasonOptional: "Reason (optional)",
|
|
30
31
|
note: "Note",
|
|
31
32
|
noteOptional: "Note (optional)"
|
|
32
|
-
},
|
|
33
|
+
}, Se = {
|
|
33
34
|
primary: { colorScheme: "primary", variant: "solid" },
|
|
34
35
|
success: { colorScheme: "success", variant: "solid" },
|
|
35
36
|
danger: { colorScheme: "error", variant: "soft" },
|
|
36
37
|
neutral: { colorScheme: "neutral", variant: "outline" }
|
|
37
|
-
},
|
|
38
|
-
function O(n,
|
|
38
|
+
}, et = { edit: Ye }, B = (n) => n.edit ? n : null, tt = (n) => Math.min(6, Math.max(1, n)), rt = (n, c) => n instanceof Error && n.message ? n.message : c;
|
|
39
|
+
function O(n, c) {
|
|
39
40
|
const f = { ...n };
|
|
40
|
-
return delete f[
|
|
41
|
+
return delete f[c], f;
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function se({
|
|
43
44
|
busy: n = !1,
|
|
44
|
-
blocked:
|
|
45
|
-
|
|
45
|
+
blocked: c = !1,
|
|
46
|
+
onBlockedPress: f,
|
|
47
|
+
onClick: v,
|
|
46
48
|
children: y,
|
|
47
49
|
className: x,
|
|
48
50
|
...S
|
|
49
51
|
}) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
const $ = /* @__PURE__ */ i(
|
|
53
|
+
$e,
|
|
52
54
|
{
|
|
53
55
|
size: "lg",
|
|
54
56
|
...S,
|
|
55
57
|
isLoading: n,
|
|
56
|
-
"aria-disabled":
|
|
57
|
-
className:
|
|
58
|
-
onClick: (
|
|
59
|
-
if (
|
|
60
|
-
|
|
58
|
+
"aria-disabled": c || void 0,
|
|
59
|
+
className: j(c && !n && "rst:cursor-not-allowed rst:opacity-50", x),
|
|
60
|
+
onClick: (M) => {
|
|
61
|
+
if (c) {
|
|
62
|
+
M.preventDefault();
|
|
61
63
|
return;
|
|
62
64
|
}
|
|
63
|
-
|
|
65
|
+
v?.(M);
|
|
64
66
|
},
|
|
65
67
|
children: y
|
|
66
68
|
}
|
|
67
69
|
);
|
|
70
|
+
return f ? /* @__PURE__ */ i("span", { style: { display: "contents" }, onClickCapture: () => c && !n && f(), children: $ }) : $;
|
|
68
71
|
}
|
|
69
|
-
function
|
|
72
|
+
function vt({
|
|
70
73
|
label: n,
|
|
71
|
-
hideLabel:
|
|
74
|
+
hideLabel: c = !1,
|
|
72
75
|
headingLevel: f = 2,
|
|
73
|
-
itemHeadingLevel:
|
|
74
|
-
items:
|
|
75
|
-
getKey:
|
|
76
|
-
itemLabel:
|
|
77
|
-
renderMeta:
|
|
78
|
-
renderContent:
|
|
79
|
-
actions:
|
|
80
|
-
status:
|
|
81
|
-
error:
|
|
76
|
+
itemHeadingLevel: v,
|
|
77
|
+
items: y,
|
|
78
|
+
getKey: x,
|
|
79
|
+
itemLabel: S,
|
|
80
|
+
renderMeta: $,
|
|
81
|
+
renderContent: M,
|
|
82
|
+
actions: G,
|
|
83
|
+
status: ie = "ready",
|
|
84
|
+
error: Ne,
|
|
82
85
|
onRetry: ce,
|
|
83
|
-
empty:
|
|
84
|
-
density:
|
|
85
|
-
footer:
|
|
86
|
-
labels:
|
|
87
|
-
className:
|
|
86
|
+
empty: ae = { title: "Nothing waiting" },
|
|
87
|
+
density: le = "comfortable",
|
|
88
|
+
footer: we,
|
|
89
|
+
labels: Ce,
|
|
90
|
+
className: Ie
|
|
88
91
|
}) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
Ze();
|
|
93
|
+
const p = Ge(_e, Ce), Re = typeof G == "function" ? G(et) : G, E = Qe(), w = g(null), C = y.map(x), A = g(/* @__PURE__ */ new Map());
|
|
94
|
+
A.current = new Map(y.map((e, t) => [C[t], e]));
|
|
95
|
+
const [W, Be] = R({}), I = g({}), ue = (e) => {
|
|
96
|
+
I.current = e(I.current), Be(I.current);
|
|
97
|
+
}, [de, P] = R({}), [fe, Ee] = R({}), h = g({}), b = (e, t) => {
|
|
98
|
+
h.current = t ? { ...h.current, [e]: t } : O(h.current, e), Ee(h.current);
|
|
99
|
+
}, [J, Fe] = R({ text: "", n: 0 }), U = g([]), F = g(null), me = re((e) => {
|
|
100
|
+
U.current.push(e), !F.current && (F.current = setTimeout(() => {
|
|
101
|
+
F.current = null;
|
|
102
|
+
const t = U.current.join(" ");
|
|
103
|
+
U.current = [], Fe((r) => ({ text: t, n: r.n + 1 }));
|
|
100
104
|
}, 0));
|
|
101
105
|
}, []);
|
|
102
|
-
|
|
106
|
+
ne(
|
|
103
107
|
() => () => {
|
|
104
|
-
|
|
108
|
+
F.current && clearTimeout(F.current);
|
|
105
109
|
},
|
|
106
110
|
[]
|
|
107
111
|
);
|
|
108
|
-
const [Te,
|
|
109
|
-
|
|
110
|
-
}, []),
|
|
111
|
-
const t =
|
|
112
|
+
const [Te, Le] = R(0), V = g(null), N = re((e) => {
|
|
113
|
+
V.current = e, Le((t) => t + 1);
|
|
114
|
+
}, []), pe = re((e) => {
|
|
115
|
+
const t = w.current;
|
|
112
116
|
if (!t) return null;
|
|
113
117
|
const r = "key" in e ? CSS.escape(e.key) : "";
|
|
114
118
|
switch (e.kind) {
|
|
@@ -122,148 +126,167 @@ function ht({
|
|
|
122
126
|
return t.querySelector(`[data-queue-item="${r}"] [data-queue-step]`);
|
|
123
127
|
}
|
|
124
128
|
}, []);
|
|
125
|
-
|
|
126
|
-
const e =
|
|
129
|
+
ne(() => {
|
|
130
|
+
const e = V.current;
|
|
127
131
|
if (!e) return;
|
|
128
|
-
|
|
129
|
-
}, [Te,
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
e.relatedTarget && !
|
|
134
|
-
},
|
|
135
|
-
if (
|
|
132
|
+
V.current = null, (pe(e) ?? w.current?.querySelector("[data-queue-item]") ?? w.current?.querySelector("[data-queue-empty]"))?.focus();
|
|
133
|
+
}, [Te, pe]);
|
|
134
|
+
const X = g(null), Oe = (e) => () => {
|
|
135
|
+
X.current = e;
|
|
136
|
+
}, je = (e) => {
|
|
137
|
+
e.relatedTarget && !w.current?.contains(e.relatedTarget) && (X.current = null);
|
|
138
|
+
}, K = (e) => {
|
|
139
|
+
if (X.current !== e) return !1;
|
|
136
140
|
const t = document.activeElement;
|
|
137
|
-
return !t || t === document.body ? !0 :
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
},
|
|
141
|
-
const s = t.indexOf(e), d = t.slice(s + 1).find((
|
|
141
|
+
return !t || t === document.body ? !0 : w.current?.contains(t) ? !!t.closest(`[data-queue-item="${CSS.escape(e)}"]`) : !1;
|
|
142
|
+
}, T = g(null), z = (e, t) => {
|
|
143
|
+
T.current = t, b(e.key, { ...e, open: !1 });
|
|
144
|
+
}, ge = g(C), Y = g(/* @__PURE__ */ new Map()), [, Me] = R(0), Z = g(/* @__PURE__ */ new Set()), he = (e, t, r) => {
|
|
145
|
+
const s = t.indexOf(e), d = t.slice(s + 1).find((a) => r.has(a));
|
|
142
146
|
if (d) return { kind: "item", key: d };
|
|
143
|
-
const o = t.slice(0, s).reverse().find((
|
|
147
|
+
const o = t.slice(0, s).reverse().find((a) => r.has(a));
|
|
144
148
|
return o ? { kind: "item", key: o } : { kind: "empty" };
|
|
145
149
|
};
|
|
146
|
-
|
|
147
|
-
const e =
|
|
148
|
-
|
|
149
|
-
const t = new Set(
|
|
150
|
-
|
|
150
|
+
ne(() => {
|
|
151
|
+
const e = ge.current;
|
|
152
|
+
ge.current = C;
|
|
153
|
+
const t = new Set(C), r = Y.current;
|
|
154
|
+
Y.current = /* @__PURE__ */ new Map();
|
|
151
155
|
const s = [];
|
|
152
156
|
let d = !1;
|
|
153
|
-
for (const [o,
|
|
157
|
+
for (const [o, a] of r) {
|
|
154
158
|
const l = t.has(o);
|
|
155
|
-
s.push(
|
|
156
|
-
const u = l ? { kind: "trigger", key: o, actionId:
|
|
159
|
+
s.push(a.announce ?? a.sentence), l || (d = !0), Z.current.delete(o);
|
|
160
|
+
const u = l ? { kind: "trigger", key: o, actionId: a.actionId } : e.includes(o) ? he(o, e, t) : null, m = h.current[o];
|
|
157
161
|
if (m?.surface)
|
|
158
|
-
|
|
162
|
+
z(m, u ?? { kind: "empty" });
|
|
159
163
|
else {
|
|
160
|
-
const L =
|
|
161
|
-
m &&
|
|
164
|
+
const L = K(o);
|
|
165
|
+
m && b(o, null), u && L && N(u);
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
|
-
for (const o of e.filter((
|
|
168
|
+
for (const o of e.filter((a) => !t.has(a))) {
|
|
165
169
|
if (r.has(o)) continue;
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
if (l && "key" in l && l.key === o && (
|
|
169
|
-
|
|
170
|
+
P((m) => o in m ? O(m, o) : m);
|
|
171
|
+
const a = he(o, e, t), l = T.current;
|
|
172
|
+
if (l && "key" in l && l.key === o && (T.current = a), I.current[o]) {
|
|
173
|
+
Z.current.add(o), K(o) && N(a);
|
|
170
174
|
continue;
|
|
171
175
|
}
|
|
172
176
|
const u = h.current[o];
|
|
173
177
|
if (u && !(u.surface && !u.open))
|
|
174
|
-
if (s.push(p.decidedElsewhere(u.label)), d = !0, u.surface)
|
|
178
|
+
if (s.push(p.decidedElsewhere(u.label)), d = !0, u.surface) z(u, a);
|
|
175
179
|
else {
|
|
176
|
-
const m =
|
|
177
|
-
|
|
180
|
+
const m = K(o);
|
|
181
|
+
b(o, null), m && N(a);
|
|
178
182
|
}
|
|
179
|
-
else !u &&
|
|
183
|
+
else !u && K(o) && N(a);
|
|
180
184
|
}
|
|
181
|
-
s.length &&
|
|
185
|
+
s.length && me(`${s.join(" ")}${d ? ` ${p.left(C.length)}` : ""}`);
|
|
182
186
|
});
|
|
183
|
-
const
|
|
184
|
-
const d =
|
|
185
|
-
|
|
187
|
+
const D = async (e, t, r, s) => {
|
|
188
|
+
const d = A.current.get(e) ?? t, o = S(d), a = r.edit ? B(r).run : r.run;
|
|
189
|
+
ue((l) => ({ ...l, [e]: r.id })), P((l) => O(l, e));
|
|
186
190
|
try {
|
|
187
|
-
const l = await
|
|
188
|
-
|
|
191
|
+
const l = await a(d, s);
|
|
192
|
+
Y.current.set(e, {
|
|
189
193
|
actionId: r.id,
|
|
190
194
|
sentence: p.decided(r.done ?? r.label, o),
|
|
191
195
|
announce: l ? l.announce : void 0
|
|
192
|
-
}),
|
|
196
|
+
}), Me((u) => u + 1);
|
|
193
197
|
} catch (l) {
|
|
194
|
-
const u =
|
|
195
|
-
|
|
198
|
+
const u = rt(l, p.unknownError);
|
|
199
|
+
me(p.failed(r.label, o, u));
|
|
196
200
|
const m = h.current[e];
|
|
197
|
-
|
|
201
|
+
Z.current.delete(e) ? m?.surface ? z(m, { kind: "empty" }) : m && b(e, null) : m ? b(e, { ...m, error: u }) : P((L) => ({ ...L, [e]: u }));
|
|
198
202
|
} finally {
|
|
199
|
-
|
|
203
|
+
ue((l) => O(l, e));
|
|
200
204
|
}
|
|
201
|
-
},
|
|
202
|
-
const r =
|
|
205
|
+
}, Ae = (e, t) => {
|
|
206
|
+
const r = x(e), s = B(t);
|
|
203
207
|
if (!t.confirm && !t.reason && !s) {
|
|
204
|
-
|
|
208
|
+
D(r, e, t, {});
|
|
205
209
|
return;
|
|
206
210
|
}
|
|
207
|
-
|
|
211
|
+
P((d) => O(d, r)), b(r, {
|
|
208
212
|
key: r,
|
|
209
|
-
label:
|
|
213
|
+
label: S(e),
|
|
210
214
|
item: e,
|
|
211
215
|
action: t,
|
|
212
216
|
draft: s ? s.edit.initial(e) : void 0,
|
|
213
217
|
reason: {},
|
|
214
218
|
surface: !!s?.edit.surface,
|
|
215
219
|
open: !0
|
|
216
|
-
}), s?.edit.surface ||
|
|
217
|
-
},
|
|
220
|
+
}), s?.edit.surface || N({ kind: "step", key: r });
|
|
221
|
+
}, _ = (e) => {
|
|
218
222
|
const t = h.current[e];
|
|
219
|
-
if (!t ||
|
|
223
|
+
if (!t || I.current[e]) return;
|
|
220
224
|
const r = { kind: "trigger", key: e, actionId: t.action.id };
|
|
221
|
-
t.surface ?
|
|
222
|
-
},
|
|
225
|
+
t.surface ? z(t, r) : (b(e, null), N(r));
|
|
226
|
+
}, be = (e) => {
|
|
223
227
|
const t = h.current[e];
|
|
224
|
-
!t ||
|
|
228
|
+
if (!(!t || I.current[e])) {
|
|
229
|
+
if (ke(t, A.current.get(e) ?? t.item, p)) {
|
|
230
|
+
t.tried || b(e, { ...t, tried: !0 });
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
t.action.edit ? D(e, t.item, t.action, { draft: t.draft }) : t.action.reason ? D(e, t.item, t.action, { reason: nt(t.reason) }) : D(e, t.item, t.action, {});
|
|
234
|
+
}
|
|
225
235
|
}, Pe = (e) => {
|
|
226
|
-
const t =
|
|
227
|
-
|
|
228
|
-
},
|
|
229
|
-
const { action: r } = e, s =
|
|
230
|
-
|
|
236
|
+
const t = T.current;
|
|
237
|
+
T.current = null, b(e, null), t && N(t);
|
|
238
|
+
}, Ke = `h${f}`, ve = v ?? tt(f + 1), ze = `h${ve}`, ee = `${E}-label`, ye = (e, t) => {
|
|
239
|
+
const { action: r } = e, s = B(r), d = A.current.get(e.key) ?? e.item, o = !!W[e.key], a = ke(e, d, p), l = `${E}-step-${t}-message`, u = /* @__PURE__ */ i(
|
|
240
|
+
se,
|
|
231
241
|
{
|
|
232
|
-
...
|
|
242
|
+
...Se[r.tone ?? "neutral"],
|
|
233
243
|
busy: o,
|
|
234
244
|
loadingLabel: p.busy,
|
|
235
|
-
blocked: !!
|
|
236
|
-
|
|
237
|
-
|
|
245
|
+
blocked: !!a,
|
|
246
|
+
onBlockedPress: () => be(e.key),
|
|
247
|
+
"aria-describedby": a ? l : void 0,
|
|
248
|
+
onClick: () => be(e.key),
|
|
238
249
|
"data-queue-submit": "",
|
|
239
250
|
children: s ? s.edit.submitLabel : r.label
|
|
240
251
|
}
|
|
241
|
-
), m = /* @__PURE__ */
|
|
242
|
-
r.reason && /* @__PURE__ */
|
|
243
|
-
|
|
252
|
+
), m = /* @__PURE__ */ i(se, { variant: "ghost", colorScheme: "neutral", blocked: o, onClick: () => _(e.key), children: p.cancel }), L = /* @__PURE__ */ q(qe, { children: [
|
|
253
|
+
r.reason && /* @__PURE__ */ i(
|
|
254
|
+
ot,
|
|
244
255
|
{
|
|
245
256
|
id: `${E}-step-${t}`,
|
|
246
257
|
step: r.reason,
|
|
247
258
|
labels: p,
|
|
248
259
|
value: e.reason,
|
|
249
260
|
disabled: o,
|
|
250
|
-
onChange: (
|
|
261
|
+
onChange: (te) => b(e.key, { ...h.current[e.key], reason: te })
|
|
251
262
|
}
|
|
252
263
|
),
|
|
253
|
-
s && /* @__PURE__ */
|
|
264
|
+
s && /* @__PURE__ */ i(
|
|
254
265
|
s.edit.Form,
|
|
255
266
|
{
|
|
256
267
|
item: d,
|
|
257
268
|
value: e.draft,
|
|
258
|
-
onChange: (
|
|
269
|
+
onChange: (te) => b(e.key, { ...h.current[e.key], draft: te })
|
|
259
270
|
}
|
|
260
271
|
),
|
|
261
|
-
|
|
262
|
-
|
|
272
|
+
a && /* @__PURE__ */ i(
|
|
273
|
+
"p",
|
|
274
|
+
{
|
|
275
|
+
id: l,
|
|
276
|
+
className: j(
|
|
277
|
+
"rst:text-sm",
|
|
278
|
+
e.tried ? "rst:text-error-600 rst:dark:text-error-400" : "rst:text-gray-500 rst:dark:text-gray-400"
|
|
279
|
+
),
|
|
280
|
+
"data-queue-validation": "",
|
|
281
|
+
"data-tried": e.tried ? "" : void 0,
|
|
282
|
+
children: a
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
e.error && /* @__PURE__ */ i(oe, { colorScheme: "error", role: "group", "aria-live": "off", children: e.error })
|
|
263
286
|
] });
|
|
264
287
|
return { submitButton: u, cancelButton: m, fields: L };
|
|
265
|
-
},
|
|
266
|
-
const { submitButton: r, cancelButton: s, fields: d } =
|
|
288
|
+
}, De = (e, t) => {
|
|
289
|
+
const { submitButton: r, cancelButton: s, fields: d } = ye(e, t), o = `${E}-step-${t}-prompt`, a = B(e.action), l = e.action.reason?.prompt ?? e.action.confirm?.prompt ?? a?.edit.title;
|
|
267
290
|
return /* @__PURE__ */ q(
|
|
268
291
|
"div",
|
|
269
292
|
{
|
|
@@ -272,12 +295,12 @@ function ht({
|
|
|
272
295
|
tabIndex: -1,
|
|
273
296
|
"data-queue-step": "",
|
|
274
297
|
onKeyDown: (u) => {
|
|
275
|
-
u.key === "Escape" && (u.stopPropagation(),
|
|
298
|
+
u.key === "Escape" && (u.stopPropagation(), _(e.key));
|
|
276
299
|
},
|
|
277
300
|
className: "rst:flex rst:flex-col rst:gap-3 rst:rounded-lg rst:border rst:border-[var(--roster-card-border)] rst:p-4 rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring",
|
|
278
301
|
children: [
|
|
279
|
-
/* @__PURE__ */
|
|
280
|
-
|
|
302
|
+
/* @__PURE__ */ i("p", { id: o, className: "rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]", children: l }),
|
|
303
|
+
a?.edit.description && /* @__PURE__ */ i("p", { className: "rst:text-sm rst:text-gray-600 rst:dark:text-gray-300", children: a.edit.description }),
|
|
281
304
|
d,
|
|
282
305
|
/* @__PURE__ */ q("div", { className: "rst:flex rst:flex-wrap rst:gap-2", children: [
|
|
283
306
|
r,
|
|
@@ -286,37 +309,37 @@ function ht({
|
|
|
286
309
|
]
|
|
287
310
|
}
|
|
288
311
|
);
|
|
289
|
-
},
|
|
290
|
-
const r =
|
|
291
|
-
return /* @__PURE__ */
|
|
292
|
-
|
|
312
|
+
}, He = (e, t) => {
|
|
313
|
+
const r = W[t];
|
|
314
|
+
return /* @__PURE__ */ i("div", { role: "group", "aria-label": p.decide(S(e)), className: "rst:flex rst:flex-wrap rst:gap-2", children: Re.filter((s) => !s.hidden?.(e)).map((s) => /* @__PURE__ */ i(
|
|
315
|
+
se,
|
|
293
316
|
{
|
|
294
|
-
...
|
|
317
|
+
...Se[s.tone ?? "neutral"],
|
|
295
318
|
"data-queue-action": s.id,
|
|
296
319
|
busy: r === s.id,
|
|
297
320
|
loadingLabel: p.busy,
|
|
298
321
|
blocked: !!r && r !== s.id,
|
|
299
|
-
onClick: () =>
|
|
322
|
+
onClick: () => Ae(e, s),
|
|
300
323
|
children: s.label
|
|
301
324
|
},
|
|
302
325
|
s.id
|
|
303
326
|
)) });
|
|
304
|
-
}, k = Object.values(
|
|
327
|
+
}, k = Object.values(fe).find((e) => e.surface) ?? null, H = k ? B(k.action) : null, xe = H?.edit.surface, Q = k ? ye(k, -1) : null;
|
|
305
328
|
return /* @__PURE__ */ q(
|
|
306
329
|
"section",
|
|
307
330
|
{
|
|
308
|
-
ref:
|
|
309
|
-
"aria-labelledby":
|
|
310
|
-
onBlur:
|
|
311
|
-
className:
|
|
331
|
+
ref: w,
|
|
332
|
+
"aria-labelledby": ee,
|
|
333
|
+
onBlur: je,
|
|
334
|
+
className: j("rst:font-ui rst:flex rst:flex-col rst:gap-4", Ie),
|
|
312
335
|
children: [
|
|
313
|
-
/* @__PURE__ */
|
|
314
|
-
|
|
336
|
+
/* @__PURE__ */ i(
|
|
337
|
+
Ke,
|
|
315
338
|
{
|
|
316
|
-
id:
|
|
317
|
-
className:
|
|
339
|
+
id: ee,
|
|
340
|
+
className: j(
|
|
318
341
|
"rst:text-lg rst:font-semibold rst:text-[var(--roster-control-text)]",
|
|
319
|
-
|
|
342
|
+
c && "rst:sr-only"
|
|
320
343
|
),
|
|
321
344
|
children: n
|
|
322
345
|
}
|
|
@@ -329,22 +352,22 @@ function ht({
|
|
|
329
352
|
"aria-atomic": "true",
|
|
330
353
|
className: "rst:sr-only",
|
|
331
354
|
"data-queue-live": "",
|
|
332
|
-
"data-queue-live-n":
|
|
355
|
+
"data-queue-live-n": J.n,
|
|
333
356
|
children: [
|
|
334
|
-
|
|
335
|
-
|
|
357
|
+
J.text,
|
|
358
|
+
J.n % 2 ? " " : ""
|
|
336
359
|
]
|
|
337
360
|
}
|
|
338
361
|
),
|
|
339
|
-
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
ce && /* @__PURE__ */
|
|
342
|
-
] }) }) :
|
|
362
|
+
ie === "loading" ? /* @__PURE__ */ i("div", { className: "rst:flex rst:justify-center rst:py-12", "aria-busy": "true", children: /* @__PURE__ */ i(Je, { size: "lg", label: p.loading(n) }) }) : ie === "error" ? /* @__PURE__ */ i(oe, { colorScheme: "error", children: /* @__PURE__ */ q("div", { className: "rst:flex rst:flex-col rst:items-start rst:gap-3", children: [
|
|
363
|
+
/* @__PURE__ */ i("div", { children: Ne ?? p.loadFailed }),
|
|
364
|
+
ce && /* @__PURE__ */ i($e, { size: "lg", variant: "outline", colorScheme: "neutral", onClick: ce, children: p.retry })
|
|
365
|
+
] }) }) : y.length === 0 ? /* @__PURE__ */ i(
|
|
343
366
|
Ve,
|
|
344
367
|
{
|
|
345
|
-
title:
|
|
346
|
-
description:
|
|
347
|
-
headingLevel:
|
|
368
|
+
title: ae.title,
|
|
369
|
+
description: ae.description,
|
|
370
|
+
headingLevel: ve,
|
|
348
371
|
tabIndex: -1,
|
|
349
372
|
"data-queue-empty": "",
|
|
350
373
|
className: "rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring"
|
|
@@ -352,30 +375,30 @@ function ht({
|
|
|
352
375
|
) : (
|
|
353
376
|
/* `role="list"` is restated because Safari drops a list's role once
|
|
354
377
|
its markers are styled away. */
|
|
355
|
-
/* @__PURE__ */
|
|
378
|
+
/* @__PURE__ */ i(
|
|
356
379
|
"ul",
|
|
357
380
|
{
|
|
358
381
|
role: "list",
|
|
359
|
-
"aria-labelledby":
|
|
382
|
+
"aria-labelledby": ee,
|
|
360
383
|
className: "rst:m-0 rst:flex rst:list-none rst:flex-col rst:gap-3 rst:p-0",
|
|
361
|
-
children:
|
|
362
|
-
const r =
|
|
363
|
-
return /* @__PURE__ */
|
|
384
|
+
children: y.map((e, t) => {
|
|
385
|
+
const r = C[t], s = `${E}-item-${t}`, d = $?.(e), o = fe[r];
|
|
386
|
+
return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
|
|
364
387
|
"article",
|
|
365
388
|
{
|
|
366
389
|
"data-queue-item": r,
|
|
367
390
|
tabIndex: -1,
|
|
368
391
|
"aria-labelledby": s,
|
|
369
|
-
onFocus:
|
|
392
|
+
onFocus: Oe(r),
|
|
370
393
|
className: "rst:rounded-xl rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",
|
|
371
|
-
children: /* @__PURE__ */
|
|
394
|
+
children: /* @__PURE__ */ i(We, { padding: le === "compact" ? "sm" : "md", children: /* @__PURE__ */ q("div", { className: j("rst:flex rst:flex-col", le === "compact" ? "rst:gap-3" : "rst:gap-4"), children: [
|
|
372
395
|
/* @__PURE__ */ q("div", { className: "rst:flex rst:flex-wrap rst:items-baseline rst:gap-x-3 rst:gap-y-1", children: [
|
|
373
|
-
/* @__PURE__ */
|
|
374
|
-
d && /* @__PURE__ */
|
|
396
|
+
/* @__PURE__ */ i(ze, { id: s, className: "rst:text-base rst:font-semibold", children: S(e) }),
|
|
397
|
+
d && /* @__PURE__ */ i("div", { className: "rst:flex rst:flex-wrap rst:items-center rst:gap-2 rst:text-sm rst:text-gray-600 rst:dark:text-gray-300", children: d })
|
|
375
398
|
] }),
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
|
|
378
|
-
o && !o.surface ?
|
|
399
|
+
/* @__PURE__ */ i("div", { className: "rst:min-w-0", children: M(e) }),
|
|
400
|
+
de[r] && /* @__PURE__ */ i(oe, { colorScheme: "error", role: "group", "aria-live": "off", children: de[r] }),
|
|
401
|
+
o && !o.surface ? De(o, t) : He(e, r)
|
|
379
402
|
] }) })
|
|
380
403
|
}
|
|
381
404
|
) }, r);
|
|
@@ -383,71 +406,71 @@ function ht({
|
|
|
383
406
|
}
|
|
384
407
|
)
|
|
385
408
|
),
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
409
|
+
we,
|
|
410
|
+
xe && k && H && Q && /* @__PURE__ */ i(
|
|
411
|
+
xe,
|
|
389
412
|
{
|
|
390
413
|
open: k.open,
|
|
391
|
-
title:
|
|
392
|
-
description:
|
|
393
|
-
busy: !!
|
|
394
|
-
onCancel: () =>
|
|
414
|
+
title: H.edit.title,
|
|
415
|
+
description: H.edit.description,
|
|
416
|
+
busy: !!W[k.key],
|
|
417
|
+
onCancel: () => _(k.key),
|
|
395
418
|
onAfterClose: () => Pe(k.key),
|
|
396
|
-
submitButton:
|
|
397
|
-
cancelButton:
|
|
419
|
+
submitButton: Q.submitButton,
|
|
420
|
+
cancelButton: Q.cancelButton,
|
|
398
421
|
closeLabel: p.close,
|
|
399
|
-
children: /* @__PURE__ */
|
|
422
|
+
children: /* @__PURE__ */ i("div", { className: "rst:flex rst:flex-col rst:gap-4", children: Q.fields })
|
|
400
423
|
}
|
|
401
424
|
)
|
|
402
425
|
]
|
|
403
426
|
}
|
|
404
427
|
);
|
|
405
428
|
}
|
|
406
|
-
function
|
|
407
|
-
const
|
|
408
|
-
if (
|
|
429
|
+
function ke(n, c, f) {
|
|
430
|
+
const v = B(n.action);
|
|
431
|
+
if (v) return v.edit.validate?.(n.draft, c);
|
|
409
432
|
if (n.action.reason) {
|
|
410
433
|
if (n.action.reason.required && n.action.reason.options?.length && !n.reason.value) return f.pickReason;
|
|
411
434
|
if (n.action.reason.note === "required" && !n.reason.note?.trim()) return f.addNote;
|
|
412
435
|
}
|
|
413
436
|
}
|
|
414
|
-
function
|
|
415
|
-
const
|
|
416
|
-
return { ...n.value ? { value: n.value } : {}, ...
|
|
437
|
+
function nt(n) {
|
|
438
|
+
const c = n.note?.trim();
|
|
439
|
+
return { ...n.value ? { value: n.value } : {}, ...c ? { note: c } : {} };
|
|
417
440
|
}
|
|
418
|
-
function
|
|
441
|
+
function ot({
|
|
419
442
|
id: n,
|
|
420
|
-
step:
|
|
443
|
+
step: c,
|
|
421
444
|
value: f,
|
|
422
|
-
disabled:
|
|
423
|
-
onChange:
|
|
424
|
-
labels:
|
|
445
|
+
disabled: v,
|
|
446
|
+
onChange: y,
|
|
447
|
+
labels: x
|
|
425
448
|
}) {
|
|
426
|
-
const
|
|
427
|
-
return /* @__PURE__ */ q(
|
|
428
|
-
|
|
449
|
+
const S = c.note ?? "optional";
|
|
450
|
+
return /* @__PURE__ */ q(qe, { children: [
|
|
451
|
+
c.options && c.options.length > 0 && /* @__PURE__ */ i(
|
|
429
452
|
Xe,
|
|
430
453
|
{
|
|
431
|
-
label:
|
|
432
|
-
options:
|
|
454
|
+
label: c.required ? x.reason : x.reasonOptional,
|
|
455
|
+
options: c.options,
|
|
433
456
|
value: f.value ?? "",
|
|
434
|
-
onChange: (
|
|
435
|
-
disabled:
|
|
457
|
+
onChange: ($) => y({ ...f, value: $ }),
|
|
458
|
+
disabled: v
|
|
436
459
|
}
|
|
437
460
|
),
|
|
438
|
-
|
|
461
|
+
S !== "none" && /* @__PURE__ */ i(
|
|
439
462
|
Ue,
|
|
440
463
|
{
|
|
441
464
|
id: `${n}-note`,
|
|
442
|
-
label:
|
|
465
|
+
label: c.noteLabel ?? (S === "required" ? x.note : x.noteOptional),
|
|
443
466
|
rows: 3,
|
|
444
467
|
value: f.note ?? "",
|
|
445
|
-
onChange: (
|
|
446
|
-
disabled:
|
|
468
|
+
onChange: ($) => y({ ...f, note: $.target.value }),
|
|
469
|
+
disabled: v
|
|
447
470
|
}
|
|
448
471
|
)
|
|
449
472
|
] });
|
|
450
473
|
}
|
|
451
474
|
export {
|
|
452
|
-
|
|
475
|
+
vt as ModerationQueue
|
|
453
476
|
};
|