@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.
@@ -1,95 +1,93 @@
1
1
  "use client";
2
- import { jsxs as y, jsx as c, Fragment as ye } from "react/jsx-runtime";
3
- import { useId as Ke, useRef as p, useState as C, useCallback as ee, useLayoutEffect as te } from "react";
4
- import { cn as H } from "../../../lib/utils.js";
5
- import { Button as Se } from "../../atoms/Button/Button.js";
6
- import { Card as Qe } from "../../atoms/Card/Card.js";
7
- import { Spinner as ke } from "../../atoms/Spinner/Spinner.js";
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 re } from "../../molecules/Alert/Alert.js";
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 be = {
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 = (s) => s.edit ? s : null, Xe = (s) => s === 0 ? "None left." : `${s} left.`, Ye = (s) => Math.min(6, Math.max(1, s)), Ze = (s) => s instanceof Error && s.message ? s.message : "Something went wrong.";
19
- function E(s, d) {
20
- const m = { ...s };
21
- return delete m[d], 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 ne({
24
- busy: s = !1,
25
- blocked: d = !1,
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
- Se,
32
+ ye,
34
33
  {
35
34
  size: "lg",
36
35
  ...S,
37
- "aria-disabled": g || void 0,
38
- "aria-busy": s || void 0,
39
- startIcon: s ? /* @__PURE__ */ c(ke, { size: "sm", variant: "current" }) : void 0,
40
- className: H(d && !s && "rst:cursor-not-allowed rst:opacity-50", b),
41
- onClick: (j) => {
42
- if (g) {
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?.(j);
44
+ m?.(g);
47
45
  },
48
46
  children: q
49
47
  }
50
48
  );
51
49
  }
52
50
  function ft({
53
- label: s,
54
- hideLabel: d = !1,
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: j,
61
- renderContent: qe,
62
- actions: K,
63
- status: se = "ready",
64
- error: $e,
65
- onRetry: oe,
66
- empty: ce = { title: "Nothing waiting" },
67
- density: ie = "comfortable",
68
- footer: Ne,
69
- className: we
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 Ce = typeof K == "function" ? K(Ve) : K, B = Ke(), $ = p(null), N = b.map(S), M = p(/* @__PURE__ */ new Map());
72
- M.current = new Map(b.map((e, t) => [N[t], e]));
73
- const [Q, Ie] = C({}), w = p({}), ae = (e) => {
74
- w.current = e(w.current), Ie(w.current);
75
- }, [le, A] = C({}), [ue, Be] = C({}), h = p({}), v = (e, t) => {
76
- h.current = t ? { ...h.current, [e]: t } : E(h.current, e), Be(h.current);
77
- }, [G, Re] = C({ text: "", n: 0 }), W = p([]), R = p(null), de = ee((e) => {
78
- W.current.push(e), !R.current && (R.current = setTimeout(() => {
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 = W.current.join(" ");
81
- W.current = [], Re((r) => ({ text: t, n: r.n + 1 }));
78
+ const t = G.current.join(" ");
79
+ G.current = [], Be((r) => ({ text: t, n: r.n + 1 }));
82
80
  }, 0));
83
81
  }, []);
84
- te(
82
+ ee(
85
83
  () => () => {
86
84
  R.current && clearTimeout(R.current);
87
85
  },
88
86
  []
89
87
  );
90
- const [Te, Fe] = C(0), J = p(null), k = ee((e) => {
91
- J.current = e, Fe((t) => t + 1);
92
- }, []), fe = ee((e) => {
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
- te(() => {
108
- const e = J.current;
105
+ ee(() => {
106
+ const e = W.current;
109
107
  if (!e) return;
110
- J.current = null, (fe(e) ?? $.current?.querySelector("[data-queue-item]") ?? $.current?.querySelector("[data-queue-empty]"))?.focus();
111
- }, [Te, fe]);
112
- const U = p(null), Ee = (e) => () => {
113
- U.current = e;
114
- }, je = (e) => {
115
- e.relatedTarget && !$.current?.contains(e.relatedTarget) && (U.current = null);
116
- }, O = (e) => {
117
- if (U.current !== e) return !1;
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), P = (e, t) => {
118
+ }, T = p(null), L = (e, t) => {
121
119
  T.current = t, v(e.key, { ...e, open: !1 });
122
- }, me = p(N), V = p(/* @__PURE__ */ new Map()), [, Me] = C(0), X = p(/* @__PURE__ */ new Set()), pe = (e, t, r) => {
123
- const o = t.indexOf(e), u = t.slice(o + 1).find((i) => r.has(i));
124
- if (u) return { kind: "item", key: u };
125
- const n = t.slice(0, o).reverse().find((i) => r.has(i));
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
- te(() => {
129
- const e = me.current;
130
- me.current = N;
131
- const t = new Set(N), r = V.current;
132
- V.current = /* @__PURE__ */ new Map();
133
- const o = [];
134
- let u = !1;
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
- o.push(i.announce ?? i.sentence), a || (u = !0), X.current.delete(n);
138
- const l = a ? { kind: "trigger", key: n, actionId: i.actionId } : e.includes(n) ? pe(n, e, t) : null, f = h.current[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
- P(f, l ?? { kind: "empty" });
138
+ L(f, l ?? { kind: "empty" });
141
139
  else {
142
- const F = O(n);
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
- A((f) => n in f ? E(f, n) : f);
149
- const i = pe(n, e, t), a = T.current;
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
- X.current.add(n), O(n) && k(i);
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 (o.push(`${l.label} was decided elsewhere.`), u = !0, l.surface) P(l, i);
154
+ if (s.push(`${l.label} was decided elsewhere.`), d = !0, l.surface) L(l, i);
157
155
  else {
158
- const f = O(n);
156
+ const f = A(n);
159
157
  v(n, null), f && k(i);
160
158
  }
161
- else !l && O(n) && k(i);
159
+ else !l && A(n) && k(i);
162
160
  }
163
- o.length && de(`${o.join(" ")}${u ? ` ${Xe(N.length)}` : ""}`);
161
+ s.length && ue(`${s.join(" ")}${d ? ` ${Xe(N.length)}` : ""}`);
164
162
  });
165
- const z = async (e, t, r, o) => {
166
- const u = M.current.get(e) ?? t, n = g(u), i = r.edit ? I(r).run : r.run;
167
- ae((a) => ({ ...a, [e]: r.id })), A((a) => E(a, e));
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(u, o);
170
- V.current.set(e, {
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
- }), Me((l) => l + 1);
172
+ }), je((l) => l + 1);
175
173
  } catch (a) {
176
174
  const l = Ze(a);
177
- de(`${r.label} didn't go through for ${n}. ${l}`);
175
+ ue(`${r.label} didn't go through for ${n}. ${l}`);
178
176
  const f = h.current[e];
179
- X.current.delete(e) ? f?.surface ? P(f, { kind: "empty" }) : f && v(e, null) : f ? v(e, { ...f, error: l }) : A((F) => ({ ...F, [e]: l }));
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
- ae((a) => E(a, e));
179
+ ie((a) => E(a, e));
182
180
  }
183
- }, Ae = (e, t) => {
184
- const r = S(e), o = I(t);
185
- if (!t.confirm && !t.reason && !o) {
186
- z(r, e, t, {});
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
- A((u) => E(u, r)), v(r, {
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: o ? o.edit.initial(e) : void 0,
192
+ draft: s ? s.edit.initial(e) : void 0,
195
193
  reason: {},
196
- surface: !!o?.edit.surface,
194
+ surface: !!s?.edit.surface,
197
195
  open: !0
198
- }), o?.edit.surface || k({ kind: "step", key: r });
199
- }, Y = (e) => {
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 ? P(t, r) : (v(e, null), k(r));
204
- }, Oe = (e) => {
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] || xe(t, M.current.get(e) ?? t.item) || (t.action.edit ? z(e, t.item, t.action, { draft: t.draft }) : t.action.reason ? z(e, t.item, t.action, { reason: _e(t.reason) }) : z(e, t.item, t.action, {}));
207
- }, Pe = (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) => {
208
206
  const t = T.current;
209
207
  T.current = null, v(e, null), t && k(t);
210
- }, ze = `h${m}`, ge = q ?? Ye(m + 1), Le = `h${ge}`, Z = `${B}-label`, he = (e, t) => {
211
- const { action: r } = e, o = I(r), u = M.current.get(e.key) ?? e.item, n = !!Q[e.key], i = xe(e, u), a = `${B}-step-${t}-message`, l = /* @__PURE__ */ c(
212
- ne,
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
- ...be[r.tone ?? "neutral"],
212
+ ...ve[r.tone ?? "neutral"],
215
213
  busy: n,
216
214
  blocked: !!i,
217
215
  "aria-describedby": i ? a : void 0,
218
- onClick: () => Oe(e.key),
216
+ onClick: () => Ae(e.key),
219
217
  "data-queue-submit": "",
220
- children: o ? o.edit.submitLabel : r.label
218
+ children: s ? s.edit.submitLabel : r.label
221
219
  }
222
- ), f = /* @__PURE__ */ c(ne, { variant: "ghost", colorScheme: "neutral", blocked: n, onClick: () => Y(e.key), children: "Cancel" }), F = /* @__PURE__ */ y(ye, { children: [
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: (_) => v(e.key, { ...h.current[e.key], reason: _ })
228
+ onChange: (Z) => v(e.key, { ...h.current[e.key], reason: Z })
231
229
  }
232
230
  ),
233
- o && /* @__PURE__ */ c(
234
- o.edit.Form,
231
+ s && /* @__PURE__ */ c(
232
+ s.edit.Form,
235
233
  {
236
- item: u,
234
+ item: d,
237
235
  value: e.draft,
238
- onChange: (_) => v(e.key, { ...h.current[e.key], draft: _ })
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(re, { colorScheme: "error", role: "group", "aria-live": "off", children: e.error })
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
- }, De = (e, t) => {
246
- const { submitButton: r, cancelButton: o, fields: u } = he(e, t), n = `${B}-step-${t}-prompt`, i = I(e.action), a = e.action.confirm?.prompt ?? e.action.reason?.prompt ?? i?.edit.title;
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(), Y(e.key));
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
- u,
259
+ d,
262
260
  /* @__PURE__ */ y("div", { className: "rst:flex rst:flex-wrap rst:gap-2", children: [
263
261
  r,
264
- o
262
+ s
265
263
  ] })
266
264
  ]
267
265
  }
268
266
  );
269
- }, He = (e, t) => {
270
- const r = Q[t];
271
- return /* @__PURE__ */ c("div", { role: "group", "aria-label": `Decide: ${g(e)}`, className: "rst:flex rst:flex-wrap rst:gap-2", children: Ce.filter((o) => !o.hidden?.(e)).map((o) => /* @__PURE__ */ c(
272
- ne,
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
- ...be[o.tone ?? "neutral"],
275
- "data-queue-action": o.id,
276
- busy: r === o.id,
277
- blocked: !!r && r !== o.id,
278
- onClick: () => Ae(e, o),
279
- children: o.label
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
- o.id
279
+ s.id
282
280
  )) });
283
- }, x = Object.values(ue).find((e) => e.surface) ?? null, L = x ? I(x.action) : null, ve = L?.edit.surface, D = x ? he(x, -1) : null;
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": Z,
289
- onBlur: je,
290
- className: H("rst:font-ui rst:flex rst:flex-col rst:gap-4", we),
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
- ze,
291
+ Oe,
294
292
  {
295
- id: Z,
296
- className: H(
293
+ id: Y,
294
+ className: D(
297
295
  "rst:text-lg rst:font-semibold rst:text-[var(--roster-control-text)]",
298
- d && "rst:sr-only"
296
+ u && "rst:sr-only"
299
297
  ),
300
- children: s
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": G.n,
309
+ "data-queue-live-n": Q.n,
312
310
  children: [
313
- G.text,
314
- G.n % 2 ? " " : ""
311
+ Q.text,
312
+ Q.n % 2 ? " " : ""
315
313
  ]
316
314
  }
317
315
  ),
318
- se === "loading" ? /* @__PURE__ */ c("div", { className: "rst:flex rst:justify-center rst:py-12", "aria-busy": "true", children: /* @__PURE__ */ c(ke, { size: "lg", label: `Loading ${s}` }) }) : se === "error" ? /* @__PURE__ */ c(re, { colorScheme: "error", children: /* @__PURE__ */ y("div", { className: "rst:flex rst:flex-col rst:items-start rst:gap-3", children: [
319
- /* @__PURE__ */ c("div", { children: $e ?? "The queue couldn't load." }),
320
- oe && /* @__PURE__ */ c(Se, { size: "lg", variant: "outline", colorScheme: "neutral", onClick: oe, children: "Retry" })
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: ce.title,
325
- description: ce.description,
326
- headingLevel: ge,
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": Z,
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], o = `${B}-item-${t}`, u = j?.(e), n = ue[r];
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": o,
348
- onFocus: Ee(r),
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(Qe, { padding: ie === "compact" ? "sm" : "md", children: /* @__PURE__ */ y("div", { className: H("rst:flex rst:flex-col", ie === "compact" ? "rst:gap-3" : "rst:gap-4"), children: [
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(Le, { id: o, className: "rst:text-base rst:font-semibold", children: g(e) }),
353
- u && /* @__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: u })
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: qe(e) }),
356
- le[r] && /* @__PURE__ */ c(re, { colorScheme: "error", role: "group", "aria-live": "off", children: le[r] }),
357
- n && !n.surface ? De(n, t) : He(e, r)
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
- Ne,
366
- ve && x && L && D && /* @__PURE__ */ c(
367
- ve,
363
+ $e,
364
+ he && x && P && z && /* @__PURE__ */ c(
365
+ he,
368
366
  {
369
367
  open: x.open,
370
- title: L.edit.title,
371
- description: L.edit.description,
372
- busy: !!Q[x.key],
373
- onCancel: () => Y(x.key),
374
- onAfterClose: () => Pe(x.key),
375
- submitButton: D.submitButton,
376
- cancelButton: D.cancelButton,
377
- children: /* @__PURE__ */ c("div", { className: "rst:flex rst:flex-col rst:gap-4", children: D.fields })
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 xe(s, d) {
385
- const m = I(s.action);
386
- if (m) return m.edit.validate?.(s.draft, d);
387
- if (s.action.reason) {
388
- if (s.action.reason.required && !s.reason.value) return "Pick a reason.";
389
- if (s.action.reason.note === "required" && !s.reason.note?.trim()) return "Add a note.";
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(s) {
393
- const d = s.note?.trim();
394
- return { ...s.value ? { value: s.value } : {}, ...d ? { note: d } : {} };
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: s,
398
- step: d,
395
+ id: o,
396
+ step: u,
399
397
  value: m,
400
398
  disabled: q,
401
399
  onChange: b
402
400
  }) {
403
- const S = d.note ?? "optional";
404
- return /* @__PURE__ */ y(ye, { children: [
405
- d.options && d.options.length > 0 && /* @__PURE__ */ c(
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: d.required ? "Reason" : "Reason (optional)",
409
- options: d.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: `${s}-note`,
419
- label: d.noteLabel ?? (S === "required" ? "Note" : "Note (optional)"),
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 }),