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