@blakesteve/roster 5.7.0 → 5.8.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.
Files changed (84) hide show
  1. package/README.md +84 -4
  2. package/dist/components/atoms/Avatar/Avatar.cjs +1 -1
  3. package/dist/components/atoms/Avatar/Avatar.d.ts +4 -0
  4. package/dist/components/atoms/Avatar/Avatar.js +1 -1
  5. package/dist/components/atoms/AvatarStrip/AvatarStrip.cjs +1 -1
  6. package/dist/components/atoms/AvatarStrip/AvatarStrip.d.ts +10 -1
  7. package/dist/components/atoms/AvatarStrip/AvatarStrip.js +34 -30
  8. package/dist/components/atoms/Button/button-variants.cjs +1 -1
  9. package/dist/components/atoms/Button/button-variants.js +5 -3
  10. package/dist/components/atoms/Eyebrow/eyebrow-variants.cjs +1 -1
  11. package/dist/components/atoms/Eyebrow/eyebrow-variants.js +8 -4
  12. package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
  13. package/dist/components/atoms/MultiSelect/MultiSelect.d.ts +3 -1
  14. package/dist/components/atoms/MultiSelect/MultiSelect.js +87 -89
  15. package/dist/components/atoms/Progress/Progress.cjs +1 -1
  16. package/dist/components/atoms/Progress/Progress.d.ts +1 -0
  17. package/dist/components/atoms/Progress/Progress.js +28 -27
  18. package/dist/components/atoms/Stat/Stat.cjs +1 -1
  19. package/dist/components/atoms/Stat/Stat.js +5 -5
  20. package/dist/components/atoms/Stat/stat-variants.cjs +1 -1
  21. package/dist/components/atoms/Stat/stat-variants.js +10 -8
  22. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.cjs +1 -1
  23. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.ts +10 -1
  24. package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js +31 -29
  25. package/dist/components/molecules/CallToAction/CallToAction.cjs +1 -1
  26. package/dist/components/molecules/CallToAction/CallToAction.d.ts +8 -1
  27. package/dist/components/molecules/CallToAction/CallToAction.js +34 -29
  28. package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
  29. package/dist/components/molecules/Carousel/Carousel.d.ts +7 -0
  30. package/dist/components/molecules/Carousel/Carousel.js +155 -155
  31. package/dist/components/molecules/ErrorState/ErrorState.cjs +1 -1
  32. package/dist/components/molecules/ErrorState/ErrorState.d.ts +8 -1
  33. package/dist/components/molecules/ErrorState/ErrorState.js +44 -39
  34. package/dist/components/molecules/FileUpload/FileUpload.cjs +1 -1
  35. package/dist/components/molecules/FileUpload/FileUpload.js +23 -22
  36. package/dist/components/molecules/MediaPreview/MediaPreview.cjs +1 -1
  37. package/dist/components/molecules/MediaPreview/MediaPreview.d.ts +3 -1
  38. package/dist/components/molecules/MediaPreview/MediaPreview.js +13 -12
  39. package/dist/components/molecules/Pagination/Pagination.cjs +1 -1
  40. package/dist/components/molecules/Pagination/Pagination.d.ts +1 -0
  41. package/dist/components/molecules/Pagination/Pagination.js +47 -46
  42. package/dist/components/molecules/ProgressField/ProgressField.d.ts +1 -0
  43. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -1
  44. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +2 -2
  45. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +17 -17
  46. package/dist/components/molecules/StepProgress/StepProgress.cjs +1 -1
  47. package/dist/components/molecules/StepProgress/StepProgress.d.ts +1 -0
  48. package/dist/components/molecules/StepProgress/StepProgress.js +9 -8
  49. package/dist/components/organisms/Countdown/Countdown.cjs +1 -1
  50. package/dist/components/organisms/Countdown/Countdown.d.ts +13 -0
  51. package/dist/components/organisms/Countdown/Countdown.js +54 -47
  52. package/dist/components/organisms/DataTable/DataTable.cjs +1 -1
  53. package/dist/components/organisms/DataTable/DataTable.d.ts +5 -3
  54. package/dist/components/organisms/DataTable/DataTable.js +27 -26
  55. package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
  56. package/dist/components/organisms/Dialog/Dialog.d.ts +8 -1
  57. package/dist/components/organisms/Dialog/Dialog.js +25 -23
  58. package/dist/components/organisms/Footer/Footer.cjs +1 -1
  59. package/dist/components/organisms/Footer/Footer.d.ts +9 -0
  60. package/dist/components/organisms/Footer/Footer.js +21 -23
  61. package/dist/components/organisms/ModerationQueue/ModerationQueue.cjs +1 -1
  62. package/dist/components/organisms/ModerationQueue/ModerationQueue.d.ts +40 -1
  63. package/dist/components/organisms/ModerationQueue/ModerationQueue.js +262 -237
  64. package/dist/components/organisms/ModerationQueue/QueueEditDialog.cjs +1 -1
  65. package/dist/components/organisms/ModerationQueue/QueueEditDialog.d.ts +1 -1
  66. package/dist/components/organisms/ModerationQueue/QueueEditDialog.js +23 -21
  67. package/dist/components/organisms/ModerationQueue/QueueEditSheet.cjs +1 -1
  68. package/dist/components/organisms/ModerationQueue/QueueEditSheet.d.ts +1 -1
  69. package/dist/components/organisms/ModerationQueue/QueueEditSheet.js +22 -20
  70. package/dist/components/organisms/ModerationQueue/queue-actions.d.ts +29 -10
  71. package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
  72. package/dist/components/organisms/Navbar/Navbar.d.ts +38 -3
  73. package/dist/components/organisms/Navbar/Navbar.js +210 -187
  74. package/dist/components/organisms/Navbar/navbar-variants.cjs +1 -1
  75. package/dist/components/organisms/Navbar/navbar-variants.js +4 -2
  76. package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
  77. package/dist/components/organisms/Sheet/Sheet.d.ts +8 -1
  78. package/dist/components/organisms/Sheet/Sheet.js +65 -63
  79. package/dist/lib/labels.cjs +1 -0
  80. package/dist/lib/labels.d.ts +7 -0
  81. package/dist/lib/labels.js +12 -0
  82. package/dist/meta.json +3 -3
  83. package/dist/roster.css +1 -1
  84. package/package.json +1 -1
@@ -1,94 +1,114 @@
1
1
  "use client";
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
- import { Textarea as Ge } from "../../atoms/Textarea/Textarea.js";
9
- import { Alert as te } from "../../molecules/Alert/Alert.js";
10
- import { EmptyState as We } from "../../molecules/EmptyState/EmptyState.js";
11
- import { RadioGroup as Je } from "../../molecules/RadioGroup/RadioGroup.js";
12
- import { editAction as Ue } from "./queue-actions.js";
13
- const ve = {
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
- }, 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;
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 re({
24
- busy: o = !1,
25
- blocked: u = !1,
26
- onClick: m,
27
- children: q,
28
- className: b,
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
- ye,
51
+ ke,
33
52
  {
34
53
  size: "lg",
35
54
  ...S,
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();
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
- m?.(g);
63
+ f?.(b);
45
64
  },
46
- children: q
65
+ children: y
47
66
  }
48
67
  );
49
68
  }
50
- function ft({
51
- label: o,
52
- hideLabel: u = !1,
53
- headingLevel: m = 2,
54
- itemHeadingLevel: q,
55
- items: b,
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: g,
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
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 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(() => {
77
- R.current = null;
78
- const t = G.current.join(" ");
79
- G.current = [], Be((r) => ({ text: t, n: r.n + 1 }));
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
- ee(
102
+ re(
83
103
  () => () => {
84
- R.current && clearTimeout(R.current);
104
+ T.current && clearTimeout(T.current);
85
105
  },
86
106
  []
87
107
  );
88
- const [Re, Te] = C(0), W = p(null), k = _((e) => {
89
- W.current = e, Te((t) => t + 1);
90
- }, []), de = _((e) => {
91
- const t = $.current;
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
- ee(() => {
106
- const e = W.current;
125
+ re(() => {
126
+ const e = U.current;
107
127
  if (!e) return;
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);
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 (J.current !== e) return !1;
135
+ if (V.current !== e) return !1;
116
136
  const t = document.activeElement;
117
- return !t || t === document.body ? !0 : $.current?.contains(t) ? !!t.closest(`[data-queue-item="${CSS.escape(e)}"]`) : !1;
118
- }, T = p(null), L = (e, t) => {
119
- T.current = t, v(e.key, { ...e, open: !1 });
120
- }, fe = p(N), U = p(/* @__PURE__ */ new Map()), [, je] = C(0), V = p(/* @__PURE__ */ new Set()), me = (e, t, r) => {
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 n = t.slice(0, s).reverse().find((i) => r.has(i));
124
- return n ? { kind: "item", key: n } : { kind: "empty" };
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
- 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();
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 [n, i] of r) {
134
- const a = t.has(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];
137
- if (f?.surface)
138
- L(f, l ?? { kind: "empty" });
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 F = A(n);
141
- f && v(n, null), l && F && k(l);
160
+ const L = A(o);
161
+ m && v(o, null), u && L && $(u);
142
162
  }
143
163
  }
144
- for (const n of e.filter((i) => !t.has(i))) {
145
- if (r.has(n)) continue;
146
- M((f) => n in f ? E(f, n) : f);
147
- const i = me(n, e, t), a = T.current;
148
- if (a && "key" in a && a.key === n && (T.current = i), w.current[n]) {
149
- V.current.add(n), A(n) && k(i);
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 l = h.current[n];
153
- if (l && !(l.surface && !l.open))
154
- if (s.push(`${l.label} was decided elsewhere.`), d = !0, l.surface) L(l, i);
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 f = A(n);
157
- v(n, null), f && k(i);
176
+ const m = A(o);
177
+ v(o, null), m && $(i);
158
178
  }
159
- else !l && A(n) && k(i);
179
+ else !u && A(o) && $(i);
160
180
  }
161
- s.length && ue(`${s.join(" ")}${d ? ` ${Xe(N.length)}` : ""}`);
181
+ s.length && fe(`${s.join(" ")}${d ? ` ${p.left(w.length)}` : ""}`);
162
182
  });
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));
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 a = await i(d, s);
168
- U.current.set(e, {
187
+ const l = await i(d, s);
188
+ X.current.set(e, {
169
189
  actionId: r.id,
170
- sentence: `${r.done ?? r.label}: ${n}.`,
171
- announce: a ? a.announce : void 0
172
- }), je((l) => l + 1);
173
- } catch (a) {
174
- const l = Ze(a);
175
- ue(`${r.label} didn't go through for ${n}. ${l}`);
176
- const f = h.current[e];
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 }));
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
- ie((a) => E(a, e));
199
+ le((l) => O(l, e));
180
200
  }
181
201
  }, Me = (e, t) => {
182
- const r = S(e), s = I(t);
202
+ const r = S(e), s = R(t);
183
203
  if (!t.confirm && !t.reason && !s) {
184
- O(r, e, t, {});
204
+ z(r, e, t, {});
185
205
  return;
186
206
  }
187
- M((d) => E(d, r)), v(r, {
207
+ M((d) => O(d, r)), v(r, {
188
208
  key: r,
189
- label: g(e),
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 || k({ kind: "step", key: r });
197
- }, X = (e) => {
216
+ }), s?.edit.surface || $({ kind: "step", key: r });
217
+ }, Z = (e) => {
198
218
  const t = h.current[e];
199
- if (!t || w.current[e]) return;
219
+ if (!t || C.current[e]) return;
200
220
  const r = { kind: "trigger", key: e, actionId: t.action.id };
201
- t.surface ? L(t, r) : (v(e, null), k(r));
221
+ t.surface ? P(t, r) : (v(e, null), $(r));
202
222
  }, Ae = (e) => {
203
223
  const t = h.current[e];
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) => {
206
- const t = T.current;
207
- T.current = null, v(e, null), t && k(t);
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,
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
- ...ve[r.tone ?? "neutral"],
213
- busy: n,
232
+ ...ye[r.tone ?? "neutral"],
233
+ busy: o,
234
+ loadingLabel: p.busy,
214
235
  blocked: !!i,
215
- "aria-describedby": i ? a : void 0,
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
- ), f = /* @__PURE__ */ c(re, { variant: "ghost", colorScheme: "neutral", blocked: n, onClick: () => X(e.key), children: "Cancel" }), F = /* @__PURE__ */ y(xe, { children: [
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
- et,
243
+ nt,
223
244
  {
224
- id: `${B}-step-${t}`,
245
+ id: `${E}-step-${t}`,
225
246
  step: r.reason,
247
+ labels: p,
226
248
  value: e.reason,
227
- disabled: n,
228
- onChange: (Z) => v(e.key, { ...h.current[e.key], reason: Z })
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: (Z) => v(e.key, { ...h.current[e.key], draft: Z })
258
+ onChange: (ee) => v(e.key, { ...h.current[e.key], draft: ee })
237
259
  }
238
260
  ),
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 }),
240
- e.error && /* @__PURE__ */ c(te, { colorScheme: "error", role: "group", "aria-live": "off", children: e.error })
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: l, cancelButton: f, fields: F };
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;
245
- return /* @__PURE__ */ y(
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": n,
271
+ "aria-labelledby": o,
250
272
  tabIndex: -1,
251
273
  "data-queue-step": "",
252
- onKeyDown: (l) => {
253
- l.key === "Escape" && (l.stopPropagation(), X(e.key));
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: n, className: "rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]", children: a }),
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__ */ y("div", { className: "rst:flex rst:flex-wrap rst:gap-2", children: [
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
- }, 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,
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
- ...ve[s.tone ?? "neutral"],
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
- }, 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;
282
- return /* @__PURE__ */ y(
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": Y,
287
- onBlur: Ee,
288
- className: D("rst:font-ui rst:flex rst:flex-col rst:gap-4", Ne),
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
- Oe,
314
+ ze,
292
315
  {
293
- id: Y,
294
- className: D(
316
+ id: _,
317
+ className: K(
295
318
  "rst:text-lg rst:font-semibold rst:text-[var(--roster-control-text)]",
296
- u && "rst:sr-only"
319
+ a && "rst:sr-only"
297
320
  ),
298
- children: o
321
+ children: n
299
322
  }
300
323
  ),
301
- /* @__PURE__ */ y(
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": Q.n,
332
+ "data-queue-live-n": W.n,
310
333
  children: [
311
- Q.text,
312
- Q.n % 2 ? " " : ""
334
+ W.text,
335
+ W.n % 2 ? " " : ""
313
336
  ]
314
337
  }
315
338
  ),
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" })
319
- ] }) }) : b.length === 0 ? /* @__PURE__ */ c(
320
- We,
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: oe.title,
323
- description: oe.description,
324
- headingLevel: pe,
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": Y,
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: b.map((e, t) => {
339
- const r = N[t], s = `${B}-item-${t}`, d = Se?.(e), n = le[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: Fe(r),
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(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: [
349
- /* @__PURE__ */ y("div", { className: "rst:flex rst:flex-wrap rst:items-baseline rst:gap-x-3 rst:gap-y-1", children: [
350
- /* @__PURE__ */ c(Pe, { id: s, className: "rst:text-base rst:font-semibold", children: g(e) }),
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: 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)
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
- $e,
364
- he && x && P && z && /* @__PURE__ */ c(
365
- he,
386
+ Ne,
387
+ ve && k && D && H && /* @__PURE__ */ c(
388
+ ve,
366
389
  {
367
- open: x.open,
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 })
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 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.";
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 _e(o) {
391
- const u = o.note?.trim();
392
- return { ...o.value ? { value: o.value } : {}, ...u ? { note: u } : {} };
414
+ function rt(n) {
415
+ const a = n.note?.trim();
416
+ return { ...n.value ? { value: n.value } : {}, ...a ? { note: a } : {} };
393
417
  }
394
- function et({
395
- id: o,
396
- step: u,
397
- value: m,
398
- disabled: q,
399
- onChange: b
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 S = u.note ?? "optional";
402
- return /* @__PURE__ */ y(xe, { children: [
403
- u.options && u.options.length > 0 && /* @__PURE__ */ c(
404
- Je,
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: u.required ? "Reason" : "Reason (optional)",
407
- options: u.options,
408
- value: m.value ?? "",
409
- onChange: (g) => b({ ...m, value: g }),
410
- disabled: q
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
- S !== "none" && /* @__PURE__ */ c(
414
- Ge,
438
+ b !== "none" && /* @__PURE__ */ c(
439
+ Ue,
415
440
  {
416
- id: `${o}-note`,
417
- label: u.noteLabel ?? (S === "required" ? "Note" : "Note (optional)"),
441
+ id: `${n}-note`,
442
+ label: a.noteLabel ?? (b === "required" ? S.note : S.noteOptional),
418
443
  rows: 3,
419
- value: m.note ?? "",
420
- onChange: (g) => b({ ...m, note: g.target.value }),
421
- disabled: q
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
- ft as ModerationQueue
452
+ ht as ModerationQueue
428
453
  };