@blakesteve/roster 5.12.0 → 5.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -13
- package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
- package/dist/components/molecules/Carousel/Carousel.d.ts +65 -3
- package/dist/components/molecules/Carousel/Carousel.js +376 -225
- package/dist/components/molecules/Carousel/carousel-math.cjs +1 -1
- package/dist/components/molecules/Carousel/carousel-math.d.ts +16 -0
- package/dist/components/molecules/Carousel/carousel-math.js +63 -44
- package/dist/components/molecules/Carousel/carousel-selection.cjs +1 -0
- package/dist/components/molecules/Carousel/carousel-selection.d.ts +28 -0
- package/dist/components/molecules/Carousel/carousel-selection.js +23 -0
- package/dist/components/molecules/LiquidTabs/LiquidCount.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/LiquidCount.d.ts +29 -0
- package/dist/components/molecules/LiquidTabs/LiquidCount.js +21 -0
- package/dist/components/molecules/LiquidTabs/LiquidNav.cjs +1 -1
- package/dist/components/molecules/LiquidTabs/LiquidNav.d.ts +12 -1
- package/dist/components/molecules/LiquidTabs/LiquidNav.js +50 -44
- package/dist/components/molecules/LiquidTabs/LiquidTabPanel.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabPanel.d.ts +52 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabPanel.js +32 -0
- package/dist/components/molecules/LiquidTabs/LiquidTabs.cjs +1 -1
- package/dist/components/molecules/LiquidTabs/LiquidTabs.d.ts +20 -1
- package/dist/components/molecules/LiquidTabs/LiquidTabs.js +60 -55
- package/dist/components/molecules/LiquidTabs/liquid-count.cjs +1 -0
- package/dist/components/molecules/LiquidTabs/liquid-count.d.ts +37 -0
- package/dist/components/molecules/LiquidTabs/liquid-count.js +9 -0
- package/dist/components/organisms/ModerationQueue/ModerationQueue.cjs +1 -1
- package/dist/components/organisms/ModerationQueue/ModerationQueue.js +214 -193
- package/dist/index.d.ts +2 -0
- package/dist/internal/dev.cjs +1 -0
- package/dist/internal/dev.d.ts +10 -0
- package/dist/internal/dev.js +10 -0
- package/dist/internal/key-focus.d.ts +27 -2
- package/dist/meta.json +3 -3
- package/dist/roster.cjs +1 -1
- package/dist/roster.css +1 -1
- package/dist/roster.js +150 -145
- package/package.json +2 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as q, jsx as
|
|
3
|
-
import { useId as Qe, useRef as g, useState as
|
|
4
|
-
import { cn as
|
|
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
|
|
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
|
|
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,
|
|
23
|
-
failed: (n,
|
|
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
|
-
},
|
|
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 },
|
|
39
|
-
function O(n,
|
|
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[
|
|
41
|
+
return delete f[c], f;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function se({
|
|
44
44
|
busy: n = !1,
|
|
45
|
-
blocked:
|
|
46
|
-
|
|
45
|
+
blocked: c = !1,
|
|
46
|
+
onBlockedPress: f,
|
|
47
|
+
onClick: v,
|
|
47
48
|
children: y,
|
|
48
49
|
className: x,
|
|
49
50
|
...S
|
|
50
51
|
}) {
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
const $ = /* @__PURE__ */ i(
|
|
53
|
+
$e,
|
|
53
54
|
{
|
|
54
55
|
size: "lg",
|
|
55
56
|
...S,
|
|
56
57
|
isLoading: n,
|
|
57
|
-
"aria-disabled":
|
|
58
|
-
className:
|
|
59
|
-
onClick: (
|
|
60
|
-
if (
|
|
61
|
-
|
|
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
|
-
|
|
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:
|
|
74
|
+
hideLabel: c = !1,
|
|
73
75
|
headingLevel: f = 2,
|
|
74
|
-
itemHeadingLevel:
|
|
75
|
-
items:
|
|
76
|
-
getKey:
|
|
77
|
-
itemLabel:
|
|
78
|
-
renderMeta:
|
|
79
|
-
renderContent:
|
|
80
|
-
actions:
|
|
81
|
-
status:
|
|
82
|
-
error:
|
|
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:
|
|
85
|
-
density:
|
|
86
|
-
footer:
|
|
87
|
-
labels:
|
|
88
|
-
className:
|
|
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,
|
|
92
|
-
|
|
93
|
-
const [
|
|
94
|
-
|
|
95
|
-
}, [
|
|
96
|
-
h.current = t ? { ...h.current, [e]: t } : O(h.current, e),
|
|
97
|
-
}, [
|
|
98
|
-
|
|
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 =
|
|
101
|
-
|
|
102
|
+
const t = U.current.join(" ");
|
|
103
|
+
U.current = [], Fe((r) => ({ text: t, n: r.n + 1 }));
|
|
102
104
|
}, 0));
|
|
103
105
|
}, []);
|
|
104
|
-
|
|
106
|
+
ne(
|
|
105
107
|
() => () => {
|
|
106
108
|
F.current && clearTimeout(F.current);
|
|
107
109
|
},
|
|
108
110
|
[]
|
|
109
111
|
);
|
|
110
|
-
const [
|
|
111
|
-
|
|
112
|
-
}, []),
|
|
113
|
-
const t =
|
|
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
|
-
|
|
128
|
-
const e =
|
|
129
|
+
ne(() => {
|
|
130
|
+
const e = V.current;
|
|
129
131
|
if (!e) return;
|
|
130
|
-
|
|
131
|
-
}, [
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
e.relatedTarget && !
|
|
136
|
-
},
|
|
137
|
-
if (
|
|
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 :
|
|
140
|
-
}, T = g(null),
|
|
141
|
-
T.current = t,
|
|
142
|
-
},
|
|
143
|
-
const s = t.indexOf(e), d = t.slice(s + 1).find((
|
|
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((
|
|
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
|
-
|
|
149
|
-
const e =
|
|
150
|
-
|
|
151
|
-
const t = new Set(
|
|
152
|
-
|
|
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,
|
|
157
|
+
for (const [o, a] of r) {
|
|
156
158
|
const l = t.has(o);
|
|
157
|
-
s.push(
|
|
158
|
-
const u = l ? { kind: "trigger", key: o, actionId:
|
|
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
|
-
|
|
162
|
+
z(m, u ?? { kind: "empty" });
|
|
161
163
|
else {
|
|
162
|
-
const L =
|
|
163
|
-
m &&
|
|
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((
|
|
168
|
+
for (const o of e.filter((a) => !t.has(a))) {
|
|
167
169
|
if (r.has(o)) continue;
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
if (l && "key" in l && l.key === o && (T.current =
|
|
171
|
-
|
|
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)
|
|
178
|
+
if (s.push(p.decidedElsewhere(u.label)), d = !0, u.surface) z(u, a);
|
|
177
179
|
else {
|
|
178
|
-
const m =
|
|
179
|
-
|
|
180
|
+
const m = K(o);
|
|
181
|
+
b(o, null), m && N(a);
|
|
180
182
|
}
|
|
181
|
-
else !u &&
|
|
183
|
+
else !u && K(o) && N(a);
|
|
182
184
|
}
|
|
183
|
-
s.length &&
|
|
185
|
+
s.length && me(`${s.join(" ")}${d ? ` ${p.left(C.length)}` : ""}`);
|
|
184
186
|
});
|
|
185
|
-
const
|
|
186
|
-
const d =
|
|
187
|
-
|
|
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
|
|
190
|
-
|
|
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
|
-
}),
|
|
196
|
+
}), Me((u) => u + 1);
|
|
195
197
|
} catch (l) {
|
|
196
198
|
const u = rt(l, p.unknownError);
|
|
197
|
-
|
|
199
|
+
me(p.failed(r.label, o, u));
|
|
198
200
|
const m = h.current[e];
|
|
199
|
-
|
|
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
|
-
|
|
203
|
+
ue((l) => O(l, e));
|
|
202
204
|
}
|
|
203
|
-
},
|
|
204
|
-
const r =
|
|
205
|
+
}, Ae = (e, t) => {
|
|
206
|
+
const r = x(e), s = B(t);
|
|
205
207
|
if (!t.confirm && !t.reason && !s) {
|
|
206
|
-
|
|
208
|
+
D(r, e, t, {});
|
|
207
209
|
return;
|
|
208
210
|
}
|
|
209
|
-
|
|
211
|
+
P((d) => O(d, r)), b(r, {
|
|
210
212
|
key: r,
|
|
211
|
-
label:
|
|
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 ||
|
|
219
|
-
},
|
|
220
|
+
}), s?.edit.surface || N({ kind: "step", key: r });
|
|
221
|
+
}, _ = (e) => {
|
|
220
222
|
const t = h.current[e];
|
|
221
|
-
if (!t ||
|
|
223
|
+
if (!t || I.current[e]) return;
|
|
222
224
|
const r = { kind: "trigger", key: e, actionId: t.action.id };
|
|
223
|
-
t.surface ?
|
|
224
|
-
},
|
|
225
|
+
t.surface ? z(t, r) : (b(e, null), N(r));
|
|
226
|
+
}, be = (e) => {
|
|
225
227
|
const t = h.current[e];
|
|
226
|
-
!t ||
|
|
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,
|
|
230
|
-
}, Ke = `h${f}`,
|
|
231
|
-
const { action: r } = e, s =
|
|
232
|
-
|
|
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
|
-
...
|
|
242
|
+
...Se[r.tone ?? "neutral"],
|
|
235
243
|
busy: o,
|
|
236
244
|
loadingLabel: p.busy,
|
|
237
|
-
blocked: !!
|
|
238
|
-
|
|
239
|
-
|
|
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__ */
|
|
244
|
-
r.reason && /* @__PURE__ */
|
|
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: (
|
|
261
|
+
onChange: (te) => b(e.key, { ...h.current[e.key], reason: te })
|
|
253
262
|
}
|
|
254
263
|
),
|
|
255
|
-
s && /* @__PURE__ */
|
|
264
|
+
s && /* @__PURE__ */ i(
|
|
256
265
|
s.edit.Form,
|
|
257
266
|
{
|
|
258
267
|
item: d,
|
|
259
268
|
value: e.draft,
|
|
260
|
-
onChange: (
|
|
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
|
-
|
|
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 } =
|
|
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(),
|
|
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__ */
|
|
282
|
-
|
|
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 =
|
|
293
|
-
return /* @__PURE__ */
|
|
294
|
-
|
|
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
|
-
...
|
|
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: () =>
|
|
322
|
+
onClick: () => Ae(e, s),
|
|
302
323
|
children: s.label
|
|
303
324
|
},
|
|
304
325
|
s.id
|
|
305
326
|
)) });
|
|
306
|
-
}, k = Object.values(
|
|
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:
|
|
311
|
-
"aria-labelledby":
|
|
312
|
-
onBlur:
|
|
313
|
-
className:
|
|
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__ */
|
|
336
|
+
/* @__PURE__ */ i(
|
|
316
337
|
Ke,
|
|
317
338
|
{
|
|
318
|
-
id:
|
|
319
|
-
className:
|
|
339
|
+
id: ee,
|
|
340
|
+
className: j(
|
|
320
341
|
"rst:text-lg rst:font-semibold rst:text-[var(--roster-control-text)]",
|
|
321
|
-
|
|
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":
|
|
355
|
+
"data-queue-live-n": J.n,
|
|
335
356
|
children: [
|
|
336
|
-
|
|
337
|
-
|
|
357
|
+
J.text,
|
|
358
|
+
J.n % 2 ? " " : ""
|
|
338
359
|
]
|
|
339
360
|
}
|
|
340
361
|
),
|
|
341
|
-
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
ce && /* @__PURE__ */
|
|
344
|
-
] }) }) :
|
|
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:
|
|
348
|
-
description:
|
|
349
|
-
headingLevel:
|
|
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__ */
|
|
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:
|
|
364
|
-
const r =
|
|
365
|
-
return /* @__PURE__ */
|
|
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:
|
|
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__ */
|
|
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__ */
|
|
376
|
-
d && /* @__PURE__ */
|
|
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__ */
|
|
379
|
-
|
|
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
|
-
|
|
389
|
-
|
|
390
|
-
|
|
409
|
+
we,
|
|
410
|
+
xe && k && H && Q && /* @__PURE__ */ i(
|
|
411
|
+
xe,
|
|
391
412
|
{
|
|
392
413
|
open: k.open,
|
|
393
|
-
title:
|
|
394
|
-
description:
|
|
395
|
-
busy: !!
|
|
396
|
-
onCancel: () =>
|
|
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:
|
|
399
|
-
cancelButton:
|
|
419
|
+
submitButton: Q.submitButton,
|
|
420
|
+
cancelButton: Q.cancelButton,
|
|
400
421
|
closeLabel: p.close,
|
|
401
|
-
children: /* @__PURE__ */
|
|
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
|
|
409
|
-
const
|
|
410
|
-
if (
|
|
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
|
|
418
|
-
return { ...n.value ? { value: n.value } : {}, ...
|
|
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:
|
|
443
|
+
step: c,
|
|
423
444
|
value: f,
|
|
424
|
-
disabled:
|
|
425
|
-
onChange:
|
|
426
|
-
labels:
|
|
445
|
+
disabled: v,
|
|
446
|
+
onChange: y,
|
|
447
|
+
labels: x
|
|
427
448
|
}) {
|
|
428
|
-
const
|
|
429
|
-
return /* @__PURE__ */ q(
|
|
430
|
-
|
|
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:
|
|
434
|
-
options:
|
|
454
|
+
label: c.required ? x.reason : x.reasonOptional,
|
|
455
|
+
options: c.options,
|
|
435
456
|
value: f.value ?? "",
|
|
436
|
-
onChange: (
|
|
437
|
-
disabled:
|
|
457
|
+
onChange: ($) => y({ ...f, value: $ }),
|
|
458
|
+
disabled: v
|
|
438
459
|
}
|
|
439
460
|
),
|
|
440
|
-
|
|
461
|
+
S !== "none" && /* @__PURE__ */ i(
|
|
441
462
|
Ue,
|
|
442
463
|
{
|
|
443
464
|
id: `${n}-note`,
|
|
444
|
-
label:
|
|
465
|
+
label: c.noteLabel ?? (S === "required" ? x.note : x.noteOptional),
|
|
445
466
|
rows: 3,
|
|
446
467
|
value: f.note ?? "",
|
|
447
|
-
onChange: (
|
|
448
|
-
disabled:
|
|
468
|
+
onChange: ($) => y({ ...f, note: $.target.value }),
|
|
469
|
+
disabled: v
|
|
449
470
|
}
|
|
450
471
|
)
|
|
451
472
|
] });
|