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