@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.
Files changed (59) hide show
  1. package/README.md +137 -16
  2. package/dist/components/atoms/Chip/chip-variants.cjs +1 -1
  3. package/dist/components/atoms/Chip/chip-variants.js +8 -2
  4. package/dist/components/atoms/Combobox/Combobox.cjs +1 -1
  5. package/dist/components/atoms/Combobox/Combobox.js +20 -18
  6. package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
  7. package/dist/components/atoms/MultiSelect/MultiSelect.js +22 -20
  8. package/dist/components/atoms/Select/Select.cjs +1 -1
  9. package/dist/components/atoms/Select/Select.js +19 -17
  10. package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
  11. package/dist/components/molecules/Carousel/Carousel.js +31 -29
  12. package/dist/components/molecules/FileUpload/FileUpload.cjs +1 -1
  13. package/dist/components/molecules/FileUpload/FileUpload.js +21 -19
  14. package/dist/components/molecules/LiquidTabs/LiquidCount.cjs +1 -0
  15. package/dist/components/molecules/LiquidTabs/LiquidCount.d.ts +29 -0
  16. package/dist/components/molecules/LiquidTabs/LiquidCount.js +21 -0
  17. package/dist/components/molecules/LiquidTabs/LiquidNav.cjs +1 -1
  18. package/dist/components/molecules/LiquidTabs/LiquidNav.d.ts +12 -1
  19. package/dist/components/molecules/LiquidTabs/LiquidNav.js +50 -44
  20. package/dist/components/molecules/LiquidTabs/LiquidTabPanel.cjs +1 -0
  21. package/dist/components/molecules/LiquidTabs/LiquidTabPanel.d.ts +52 -0
  22. package/dist/components/molecules/LiquidTabs/LiquidTabPanel.js +32 -0
  23. package/dist/components/molecules/LiquidTabs/LiquidTabs.cjs +1 -1
  24. package/dist/components/molecules/LiquidTabs/LiquidTabs.d.ts +20 -1
  25. package/dist/components/molecules/LiquidTabs/LiquidTabs.js +59 -52
  26. package/dist/components/molecules/LiquidTabs/liquid-count.cjs +1 -0
  27. package/dist/components/molecules/LiquidTabs/liquid-count.d.ts +37 -0
  28. package/dist/components/molecules/LiquidTabs/liquid-count.js +9 -0
  29. package/dist/components/molecules/Menu/Menu.cjs +1 -1
  30. package/dist/components/molecules/Menu/Menu.js +104 -102
  31. package/dist/components/molecules/RadioGroup/RadioGroup.cjs +1 -1
  32. package/dist/components/molecules/RadioGroup/RadioGroup.js +23 -21
  33. package/dist/components/molecules/RangeSlider/RangeSlider.cjs +1 -1
  34. package/dist/components/molecules/RangeSlider/RangeSlider.d.ts +8 -3
  35. package/dist/components/molecules/RangeSlider/RangeSlider.js +38 -36
  36. package/dist/components/molecules/Slider/Slider.cjs +1 -1
  37. package/dist/components/molecules/Slider/Slider.d.ts +7 -3
  38. package/dist/components/molecules/Slider/Slider.js +30 -28
  39. package/dist/components/molecules/Slider/track-parts.d.ts +2 -1
  40. package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
  41. package/dist/components/organisms/Dialog/Dialog.js +19 -17
  42. package/dist/components/organisms/ModerationQueue/ModerationQueue.cjs +1 -1
  43. package/dist/components/organisms/ModerationQueue/ModerationQueue.js +230 -207
  44. package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
  45. package/dist/components/organisms/Navbar/Navbar.js +24 -22
  46. package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
  47. package/dist/components/organisms/Sheet/Sheet.js +25 -23
  48. package/dist/index.d.ts +2 -0
  49. package/dist/internal/key-focus.cjs +1 -0
  50. package/dist/internal/key-focus.d.ts +32 -0
  51. package/dist/internal/key-focus.js +60 -0
  52. package/dist/internal/popup.cjs +1 -1
  53. package/dist/internal/popup.d.ts +15 -1
  54. package/dist/internal/popup.js +17 -12
  55. package/dist/meta.json +3 -3
  56. package/dist/roster.cjs +1 -1
  57. package/dist/roster.css +1 -1
  58. package/dist/roster.js +150 -145
  59. package/package.json +2 -2
@@ -1,25 +1,26 @@
1
1
  "use client";
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";
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 ke } from "../../atoms/Button/Button.js";
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 ne } from "../../molecules/Alert/Alert.js";
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
- const Ze = {
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, a) => `${n}: ${a}.`,
22
- failed: (n, a, f) => `${n} didn't go through for ${a}. ${f}`,
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
- }, ye = {
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
- }, _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) {
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[a], f;
41
+ return delete f[c], f;
41
42
  }
42
- function oe({
43
+ function se({
43
44
  busy: n = !1,
44
- blocked: a = !1,
45
- onClick: f,
45
+ blocked: c = !1,
46
+ onBlockedPress: f,
47
+ onClick: v,
46
48
  children: y,
47
49
  className: x,
48
50
  ...S
49
51
  }) {
50
- return /* @__PURE__ */ c(
51
- ke,
52
+ const $ = /* @__PURE__ */ i(
53
+ $e,
52
54
  {
53
55
  size: "lg",
54
56
  ...S,
55
57
  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();
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
- f?.(b);
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 ht({
72
+ function vt({
70
73
  label: n,
71
- hideLabel: a = !1,
74
+ hideLabel: c = !1,
72
75
  headingLevel: f = 2,
73
- itemHeadingLevel: y,
74
- items: x,
75
- getKey: S,
76
- itemLabel: b,
77
- renderMeta: B,
78
- renderContent: qe,
79
- actions: Q,
80
- status: se = "ready",
81
- error: $e,
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: ie = { title: "Nothing waiting" },
84
- density: ae = "comfortable",
85
- footer: Ne,
86
- labels: we,
87
- className: Ce
86
+ empty: ae = { title: "Nothing waiting" },
87
+ density: le = "comfortable",
88
+ footer: we,
89
+ labels: Ce,
90
+ className: Ie
88
91
  }) {
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 }));
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
- re(
106
+ ne(
103
107
  () => () => {
104
- T.current && clearTimeout(T.current);
108
+ F.current && clearTimeout(F.current);
105
109
  },
106
110
  []
107
111
  );
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;
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
- re(() => {
126
- const e = U.current;
129
+ ne(() => {
130
+ const e = V.current;
127
131
  if (!e) return;
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);
134
- }, A = (e) => {
135
- if (V.current !== e) return !1;
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 : 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) => {
141
- const s = t.indexOf(e), d = t.slice(s + 1).find((i) => r.has(i));
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((i) => r.has(i));
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
- 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();
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, i] of r) {
157
+ for (const [o, a] of r) {
154
158
  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];
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
- P(m, u ?? { kind: "empty" });
162
+ z(m, u ?? { kind: "empty" });
159
163
  else {
160
- const L = A(o);
161
- m && v(o, null), u && L && $(u);
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((i) => !t.has(i))) {
168
+ for (const o of e.filter((a) => !t.has(a))) {
165
169
  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);
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) P(u, i);
178
+ if (s.push(p.decidedElsewhere(u.label)), d = !0, u.surface) z(u, a);
175
179
  else {
176
- const m = A(o);
177
- v(o, null), m && $(i);
180
+ const m = K(o);
181
+ b(o, null), m && N(a);
178
182
  }
179
- else !u && A(o) && $(i);
183
+ else !u && K(o) && N(a);
180
184
  }
181
- s.length && fe(`${s.join(" ")}${d ? ` ${p.left(w.length)}` : ""}`);
185
+ s.length && me(`${s.join(" ")}${d ? ` ${p.left(C.length)}` : ""}`);
182
186
  });
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));
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 i(d, s);
188
- X.current.set(e, {
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
- }), je((u) => u + 1);
196
+ }), Me((u) => u + 1);
193
197
  } catch (l) {
194
- const u = tt(l, p.unknownError);
195
- fe(p.failed(r.label, o, u));
198
+ const u = rt(l, p.unknownError);
199
+ me(p.failed(r.label, o, u));
196
200
  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 }));
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
- le((l) => O(l, e));
203
+ ue((l) => O(l, e));
200
204
  }
201
- }, Me = (e, t) => {
202
- const r = S(e), s = R(t);
205
+ }, Ae = (e, t) => {
206
+ const r = x(e), s = B(t);
203
207
  if (!t.confirm && !t.reason && !s) {
204
- z(r, e, t, {});
208
+ D(r, e, t, {});
205
209
  return;
206
210
  }
207
- M((d) => O(d, r)), v(r, {
211
+ P((d) => O(d, r)), b(r, {
208
212
  key: r,
209
- label: b(e),
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 || $({ kind: "step", key: r });
217
- }, Z = (e) => {
220
+ }), s?.edit.surface || N({ kind: "step", key: r });
221
+ }, _ = (e) => {
218
222
  const t = h.current[e];
219
- if (!t || C.current[e]) return;
223
+ if (!t || I.current[e]) return;
220
224
  const r = { kind: "trigger", key: e, actionId: t.action.id };
221
- t.surface ? P(t, r) : (v(e, null), $(r));
222
- }, Ae = (e) => {
225
+ t.surface ? z(t, r) : (b(e, null), N(r));
226
+ }, be = (e) => {
223
227
  const t = h.current[e];
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, {}));
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 = 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,
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
- ...ye[r.tone ?? "neutral"],
242
+ ...Se[r.tone ?? "neutral"],
233
243
  busy: o,
234
244
  loadingLabel: p.busy,
235
- blocked: !!i,
236
- "aria-describedby": i ? l : void 0,
237
- onClick: () => Ae(e.key),
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__ */ c(oe, { variant: "ghost", colorScheme: "neutral", blocked: o, onClick: () => Z(e.key), children: p.cancel }), L = /* @__PURE__ */ q(Se, { children: [
242
- r.reason && /* @__PURE__ */ c(
243
- nt,
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: (ee) => v(e.key, { ...h.current[e.key], reason: ee })
261
+ onChange: (te) => b(e.key, { ...h.current[e.key], reason: te })
251
262
  }
252
263
  ),
253
- s && /* @__PURE__ */ c(
264
+ s && /* @__PURE__ */ i(
254
265
  s.edit.Form,
255
266
  {
256
267
  item: d,
257
268
  value: e.draft,
258
- onChange: (ee) => v(e.key, { ...h.current[e.key], draft: ee })
269
+ onChange: (te) => b(e.key, { ...h.current[e.key], draft: te })
259
270
  }
260
271
  ),
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 })
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
- }, 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;
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(), Z(e.key));
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__ */ c("p", { id: o, className: "rst:text-sm rst:font-medium rst:text-[var(--roster-control-text)]", children: l }),
280
- i?.edit.description && /* @__PURE__ */ c("p", { className: "rst:text-sm rst:text-gray-600 rst:dark:text-gray-300", children: i.edit.description }),
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
- }, 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,
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
- ...ye[s.tone ?? "neutral"],
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: () => Me(e, s),
322
+ onClick: () => Ae(e, s),
300
323
  children: s.label
301
324
  },
302
325
  s.id
303
326
  )) });
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;
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: N,
309
- "aria-labelledby": _,
310
- onBlur: Oe,
311
- className: K("rst:font-ui rst:flex rst:flex-col rst:gap-4", Ce),
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__ */ c(
314
- ze,
336
+ /* @__PURE__ */ i(
337
+ Ke,
315
338
  {
316
- id: _,
317
- className: K(
339
+ id: ee,
340
+ className: j(
318
341
  "rst:text-lg rst:font-semibold rst:text-[var(--roster-control-text)]",
319
- a && "rst:sr-only"
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": W.n,
355
+ "data-queue-live-n": J.n,
333
356
  children: [
334
- W.text,
335
- W.n % 2 ? " " : ""
357
+ J.text,
358
+ J.n % 2 ? " " : ""
336
359
  ]
337
360
  }
338
361
  ),
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(
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: ie.title,
346
- description: ie.description,
347
- headingLevel: he,
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__ */ c(
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: x.map((e, t) => {
362
- const r = w[t], s = `${E}-item-${t}`, d = B?.(e), o = de[r];
363
- return /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c(
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: Le(r),
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__ */ 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: [
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__ */ c(De, { id: s, className: "rst:text-base rst:font-semibold", children: b(e) }),
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 })
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__ */ 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)
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
- Ne,
387
- ve && k && D && H && /* @__PURE__ */ c(
388
- ve,
409
+ we,
410
+ xe && k && H && Q && /* @__PURE__ */ i(
411
+ xe,
389
412
  {
390
413
  open: k.open,
391
- title: D.edit.title,
392
- description: D.edit.description,
393
- busy: !!G[k.key],
394
- onCancel: () => Z(k.key),
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: H.submitButton,
397
- cancelButton: H.cancelButton,
419
+ submitButton: Q.submitButton,
420
+ cancelButton: Q.cancelButton,
398
421
  closeLabel: p.close,
399
- children: /* @__PURE__ */ c("div", { className: "rst:flex rst:flex-col rst:gap-4", children: H.fields })
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 xe(n, a, f) {
407
- const y = R(n.action);
408
- if (y) return y.edit.validate?.(n.draft, a);
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 rt(n) {
415
- const a = n.note?.trim();
416
- return { ...n.value ? { value: n.value } : {}, ...a ? { note: a } : {} };
437
+ function nt(n) {
438
+ const c = n.note?.trim();
439
+ return { ...n.value ? { value: n.value } : {}, ...c ? { note: c } : {} };
417
440
  }
418
- function nt({
441
+ function ot({
419
442
  id: n,
420
- step: a,
443
+ step: c,
421
444
  value: f,
422
- disabled: y,
423
- onChange: x,
424
- labels: S
445
+ disabled: v,
446
+ onChange: y,
447
+ labels: x
425
448
  }) {
426
- const b = a.note ?? "optional";
427
- return /* @__PURE__ */ q(Se, { children: [
428
- a.options && a.options.length > 0 && /* @__PURE__ */ c(
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: a.required ? S.reason : S.reasonOptional,
432
- options: a.options,
454
+ label: c.required ? x.reason : x.reasonOptional,
455
+ options: c.options,
433
456
  value: f.value ?? "",
434
- onChange: (B) => x({ ...f, value: B }),
435
- disabled: y
457
+ onChange: ($) => y({ ...f, value: $ }),
458
+ disabled: v
436
459
  }
437
460
  ),
438
- b !== "none" && /* @__PURE__ */ c(
461
+ S !== "none" && /* @__PURE__ */ i(
439
462
  Ue,
440
463
  {
441
464
  id: `${n}-note`,
442
- label: a.noteLabel ?? (b === "required" ? S.note : S.noteOptional),
465
+ label: c.noteLabel ?? (S === "required" ? x.note : x.noteOptional),
443
466
  rows: 3,
444
467
  value: f.note ?? "",
445
- onChange: (B) => x({ ...f, note: B.target.value }),
446
- disabled: y
468
+ onChange: ($) => y({ ...f, note: $.target.value }),
469
+ disabled: v
447
470
  }
448
471
  )
449
472
  ] });
450
473
  }
451
474
  export {
452
- ht as ModerationQueue
475
+ vt as ModerationQueue
453
476
  };