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