@trembus/ui 0.1.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/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/index.d.ts +1867 -0
- package/dist/index.js +4038 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +94 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4038 @@
|
|
|
1
|
+
import { useCallback as j, isValidElement as gt, Children as Nt, cloneElement as yt, useState as A, useEffect as H, useRef as ee, useId as z, createContext as ue, useContext as he, useLayoutEffect as Bt, useMemo as B, Fragment as Ot } from "react";
|
|
2
|
+
import { createPortal as Pt } from "react-dom";
|
|
3
|
+
import { jsx as t, jsxs as u, Fragment as K } from "react/jsx-runtime";
|
|
4
|
+
const wl = {
|
|
5
|
+
color: {
|
|
6
|
+
bg: "var(--tcl-bg)",
|
|
7
|
+
surface: "var(--tcl-surface)",
|
|
8
|
+
surfaceRaised: "var(--tcl-surface-raised)",
|
|
9
|
+
surfaceSunken: "var(--tcl-surface-sunken)",
|
|
10
|
+
surfaceHover: "var(--tcl-surface-hover)",
|
|
11
|
+
overlay: "var(--tcl-overlay)",
|
|
12
|
+
border: "var(--tcl-border)",
|
|
13
|
+
borderSoft: "var(--tcl-border-soft)",
|
|
14
|
+
borderStrong: "var(--tcl-border-strong)",
|
|
15
|
+
text: "var(--tcl-text)",
|
|
16
|
+
textDim: "var(--tcl-text-dim)",
|
|
17
|
+
textFaint: "var(--tcl-text-faint)",
|
|
18
|
+
accent: "var(--tcl-accent)",
|
|
19
|
+
accentHover: "var(--tcl-accent-hover)",
|
|
20
|
+
accentActive: "var(--tcl-accent-active)",
|
|
21
|
+
accentFg: "var(--tcl-accent-fg)",
|
|
22
|
+
focusRing: "var(--tcl-focus-ring)"
|
|
23
|
+
},
|
|
24
|
+
/** The color-coded ontology — each tone resolves a base / bg / fg triad. */
|
|
25
|
+
status: (e) => ({
|
|
26
|
+
base: `var(--tcl-status-${e})`,
|
|
27
|
+
bg: `var(--tcl-status-${e}-bg)`,
|
|
28
|
+
fg: `var(--tcl-status-${e}-fg)`
|
|
29
|
+
}),
|
|
30
|
+
font: {
|
|
31
|
+
sans: "var(--tcl-font-sans)",
|
|
32
|
+
mono: "var(--tcl-font-mono)",
|
|
33
|
+
display: "var(--tcl-font-display)"
|
|
34
|
+
},
|
|
35
|
+
fontSize: (e) => `var(--tcl-text-${e})`,
|
|
36
|
+
radius: (e) => `var(--tcl-radius-${e})`,
|
|
37
|
+
space: (e) => `var(--tcl-space-${e})`,
|
|
38
|
+
z: (e) => `var(--tcl-z-${e})`,
|
|
39
|
+
elevation: (e) => `var(--tcl-elevation-${e})`,
|
|
40
|
+
motion: {
|
|
41
|
+
easeCalm: "var(--tcl-ease-calm)",
|
|
42
|
+
easeExit: "var(--tcl-ease-exit)",
|
|
43
|
+
durFast: "var(--tcl-dur-fast)",
|
|
44
|
+
durBase: "var(--tcl-dur-base)",
|
|
45
|
+
durSlow: "var(--tcl-dur-slow)"
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
function k(...e) {
|
|
49
|
+
return e.filter(Boolean).join(" ");
|
|
50
|
+
}
|
|
51
|
+
function jt(e, n) {
|
|
52
|
+
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
53
|
+
}
|
|
54
|
+
function xt(...e) {
|
|
55
|
+
return (n) => {
|
|
56
|
+
for (const l of e) jt(l, n);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function Ht(...e) {
|
|
60
|
+
return j(xt(...e), e);
|
|
61
|
+
}
|
|
62
|
+
function Wt(e, n) {
|
|
63
|
+
const l = { ...n };
|
|
64
|
+
for (const s in e) {
|
|
65
|
+
const c = e[s], a = n[s];
|
|
66
|
+
/^on[A-Z]/.test(s) && typeof c == "function" ? l[s] = typeof a == "function" ? (...h) => {
|
|
67
|
+
a(...h), c(...h);
|
|
68
|
+
} : c : s === "style" ? l[s] = { ...a, ...c } : s === "className" ? l[s] = [a, c].filter(Boolean).join(" ") : l[s] = c;
|
|
69
|
+
}
|
|
70
|
+
return l;
|
|
71
|
+
}
|
|
72
|
+
function Ke({ children: e, ref: n, ...l }) {
|
|
73
|
+
if (!gt(e)) {
|
|
74
|
+
if (Nt.count(e) > 1)
|
|
75
|
+
throw new Error("Slot (asChild) expects exactly one React element child.");
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
const s = e, c = s.props, a = Wt(l, c), i = c.ref;
|
|
79
|
+
return (n || i) && (a.ref = xt(n, i)), yt(s, a);
|
|
80
|
+
}
|
|
81
|
+
function Me({ children: e, container: n }) {
|
|
82
|
+
if (typeof document > "u") return null;
|
|
83
|
+
const l = n ?? document.body;
|
|
84
|
+
return Pt(e, l);
|
|
85
|
+
}
|
|
86
|
+
const tt = /* @__PURE__ */ new Set([" ", "Enter", "Spacebar"]);
|
|
87
|
+
function Vt(e = {}) {
|
|
88
|
+
const { disabled: n = !1, loading: l = !1, onPress: s } = e, c = n || l, [a, i] = A(!1), [h, d] = A(!1), [g, r] = A(!1), _ = c ? "disabled" : h ? "pressed" : g ? "focus-visible" : a ? "hover" : "idle", o = j(() => i(!0), []), m = j(() => {
|
|
89
|
+
i(!1), d(!1);
|
|
90
|
+
}, []), b = j(
|
|
91
|
+
(N) => {
|
|
92
|
+
c || "button" in N && N.button !== 0 || d(!0);
|
|
93
|
+
},
|
|
94
|
+
[c]
|
|
95
|
+
), p = j(() => d(!1), []), f = j(
|
|
96
|
+
(N) => {
|
|
97
|
+
c || tt.has(N.key) && d(!0);
|
|
98
|
+
},
|
|
99
|
+
[c]
|
|
100
|
+
), x = j((N) => {
|
|
101
|
+
tt.has(N.key) && d(!1);
|
|
102
|
+
}, []), v = j((N) => {
|
|
103
|
+
N.target.matches?.(":focus-visible") && r(!0);
|
|
104
|
+
}, []), $ = j(() => {
|
|
105
|
+
r(!1), d(!1);
|
|
106
|
+
}, []), y = j(
|
|
107
|
+
(N) => {
|
|
108
|
+
if (c) {
|
|
109
|
+
N.preventDefault(), N.stopPropagation();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
s?.(N);
|
|
113
|
+
},
|
|
114
|
+
[c, s]
|
|
115
|
+
), w = { "data-state": _ };
|
|
116
|
+
return c && (w["aria-disabled"] = !0), l && (w["aria-busy"] = !0), {
|
|
117
|
+
state: _,
|
|
118
|
+
handlers: {
|
|
119
|
+
onPointerEnter: o,
|
|
120
|
+
onPointerLeave: m,
|
|
121
|
+
onPointerDown: b,
|
|
122
|
+
onPointerUp: p,
|
|
123
|
+
onKeyDown: f,
|
|
124
|
+
onKeyUp: x,
|
|
125
|
+
onFocus: v,
|
|
126
|
+
onBlur: $,
|
|
127
|
+
onClick: y
|
|
128
|
+
},
|
|
129
|
+
dataAttrs: w
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function kl() {
|
|
133
|
+
const [e, n] = A(!1);
|
|
134
|
+
return H(() => {
|
|
135
|
+
if (typeof window > "u" || !window.matchMedia) return;
|
|
136
|
+
const l = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
137
|
+
n(l.matches);
|
|
138
|
+
const s = () => n(l.matches);
|
|
139
|
+
return l.addEventListener("change", s), () => l.removeEventListener("change", s);
|
|
140
|
+
}, []), e;
|
|
141
|
+
}
|
|
142
|
+
function Yt(e) {
|
|
143
|
+
const n = ee(null);
|
|
144
|
+
H(() => {
|
|
145
|
+
if (e)
|
|
146
|
+
return n.current = document.activeElement ?? null, () => {
|
|
147
|
+
n.current?.focus?.();
|
|
148
|
+
};
|
|
149
|
+
}, [e]);
|
|
150
|
+
}
|
|
151
|
+
const Xt = [
|
|
152
|
+
"a[href]",
|
|
153
|
+
"button:not([disabled])",
|
|
154
|
+
"textarea:not([disabled])",
|
|
155
|
+
"input:not([disabled])",
|
|
156
|
+
"select:not([disabled])",
|
|
157
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
158
|
+
].join(",");
|
|
159
|
+
function zt(e) {
|
|
160
|
+
const n = ee(null);
|
|
161
|
+
return H(() => {
|
|
162
|
+
if (!e) return;
|
|
163
|
+
const l = n.current;
|
|
164
|
+
if (!l) return;
|
|
165
|
+
const s = () => Array.from(l.querySelectorAll(Xt)).filter(
|
|
166
|
+
(i) => !i.hasAttribute("hidden") && i.getAttribute("aria-hidden") !== "true"
|
|
167
|
+
);
|
|
168
|
+
(s()[0] ?? l).focus();
|
|
169
|
+
const a = (i) => {
|
|
170
|
+
if (i.key !== "Tab") return;
|
|
171
|
+
const h = s();
|
|
172
|
+
if (h.length === 0) {
|
|
173
|
+
i.preventDefault(), l.focus();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const d = h[0], g = h[h.length - 1], r = document.activeElement;
|
|
177
|
+
i.shiftKey && r === d ? (i.preventDefault(), g.focus()) : !i.shiftKey && r === g && (i.preventDefault(), d.focus());
|
|
178
|
+
};
|
|
179
|
+
return l.addEventListener("keydown", a), () => l.removeEventListener("keydown", a);
|
|
180
|
+
}, [e]), n;
|
|
181
|
+
}
|
|
182
|
+
function Cl({ enabled: e = !0, onDismiss: n, ref: l }) {
|
|
183
|
+
H(() => {
|
|
184
|
+
if (!e) return;
|
|
185
|
+
const s = (a) => {
|
|
186
|
+
a.key === "Escape" && n();
|
|
187
|
+
}, c = (a) => {
|
|
188
|
+
const i = l.current;
|
|
189
|
+
i && !i.contains(a.target) && n();
|
|
190
|
+
};
|
|
191
|
+
return document.addEventListener("keydown", s), document.addEventListener("pointerdown", c, !0), () => {
|
|
192
|
+
document.removeEventListener("keydown", s), document.removeEventListener("pointerdown", c, !0);
|
|
193
|
+
};
|
|
194
|
+
}, [e, n, l]);
|
|
195
|
+
}
|
|
196
|
+
const pe = (e) => e === void 0 ? void 0 : `var(--tcl-space-${e})`;
|
|
197
|
+
function Kt(e) {
|
|
198
|
+
const n = {}, { p: l, px: s, py: c, pt: a, pr: i, pb: h, pl: d, radius: g, z: r } = e, _ = a ?? c ?? l, o = i ?? s ?? l, m = h ?? c ?? l, b = d ?? s ?? l;
|
|
199
|
+
return [_, o, m, b].some((p) => p !== void 0) && (n.padding = `${pe(_) ?? "0"} ${pe(o) ?? "0"} ${pe(m) ?? "0"} ${pe(b) ?? "0"}`), g && (n.borderRadius = `var(--tcl-radius-${g})`), r && (n.zIndex = `var(--tcl-z-${r})`), n;
|
|
200
|
+
}
|
|
201
|
+
function Ut(e) {
|
|
202
|
+
const {
|
|
203
|
+
as: n,
|
|
204
|
+
surface: l = "none",
|
|
205
|
+
material: s,
|
|
206
|
+
radius: c,
|
|
207
|
+
border: a,
|
|
208
|
+
z: i,
|
|
209
|
+
p: h,
|
|
210
|
+
px: d,
|
|
211
|
+
py: g,
|
|
212
|
+
pt: r,
|
|
213
|
+
pr: _,
|
|
214
|
+
pb: o,
|
|
215
|
+
pl: m,
|
|
216
|
+
className: b,
|
|
217
|
+
style: p,
|
|
218
|
+
...f
|
|
219
|
+
} = e, x = n ?? "div", v = Kt({ p: h, px: d, py: g, pt: r, pr: _, pb: o, pl: m, radius: c, z: i }), $ = k(
|
|
220
|
+
"tcl-box",
|
|
221
|
+
l !== "none" && `tcl-box--surface-${l}`,
|
|
222
|
+
a === !0 && "tcl-box--border",
|
|
223
|
+
a === "soft" && "tcl-box--border-soft",
|
|
224
|
+
a === "strong" && "tcl-box--border-strong",
|
|
225
|
+
b
|
|
226
|
+
);
|
|
227
|
+
return /* @__PURE__ */ t(
|
|
228
|
+
x,
|
|
229
|
+
{
|
|
230
|
+
className: $,
|
|
231
|
+
"data-material": s,
|
|
232
|
+
style: { ...v, ...p },
|
|
233
|
+
...f
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
const Gt = {
|
|
238
|
+
start: "flex-start",
|
|
239
|
+
center: "center",
|
|
240
|
+
end: "flex-end",
|
|
241
|
+
stretch: "stretch",
|
|
242
|
+
baseline: "baseline"
|
|
243
|
+
}, Zt = {
|
|
244
|
+
start: "flex-start",
|
|
245
|
+
center: "center",
|
|
246
|
+
end: "flex-end",
|
|
247
|
+
between: "space-between",
|
|
248
|
+
around: "space-around",
|
|
249
|
+
evenly: "space-evenly"
|
|
250
|
+
};
|
|
251
|
+
function $t(e, n) {
|
|
252
|
+
const { gap: l, align: s, justify: c, wrap: a, style: i, ...h } = n, d = {
|
|
253
|
+
display: "flex",
|
|
254
|
+
flexDirection: e,
|
|
255
|
+
...l !== void 0 ? { gap: `var(--tcl-space-${l})` } : {},
|
|
256
|
+
...s ? { alignItems: Gt[s] } : {},
|
|
257
|
+
...c ? { justifyContent: Zt[c] } : {},
|
|
258
|
+
...a ? { flexWrap: "wrap" } : {}
|
|
259
|
+
};
|
|
260
|
+
return /* @__PURE__ */ t(Ut, { ...h, style: { ...d, ...i } });
|
|
261
|
+
}
|
|
262
|
+
function Ml(e) {
|
|
263
|
+
return $t("column", e);
|
|
264
|
+
}
|
|
265
|
+
function Il(e) {
|
|
266
|
+
return $t("row", e);
|
|
267
|
+
}
|
|
268
|
+
const qt = {
|
|
269
|
+
regular: "var(--tcl-weight-regular)",
|
|
270
|
+
medium: "var(--tcl-weight-medium)",
|
|
271
|
+
semibold: "var(--tcl-weight-semibold)",
|
|
272
|
+
bold: "var(--tcl-weight-bold)"
|
|
273
|
+
};
|
|
274
|
+
function Jt(e) {
|
|
275
|
+
switch (e) {
|
|
276
|
+
case "default":
|
|
277
|
+
return "var(--tcl-text)";
|
|
278
|
+
case "dim":
|
|
279
|
+
return "var(--tcl-text-dim)";
|
|
280
|
+
case "faint":
|
|
281
|
+
return "var(--tcl-text-faint)";
|
|
282
|
+
case "accent":
|
|
283
|
+
return "var(--tcl-accent)";
|
|
284
|
+
default:
|
|
285
|
+
return `var(--tcl-status-${e})`;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function Sl(e) {
|
|
289
|
+
const {
|
|
290
|
+
as: n,
|
|
291
|
+
size: l,
|
|
292
|
+
weight: s,
|
|
293
|
+
tone: c = "default",
|
|
294
|
+
mono: a,
|
|
295
|
+
truncate: i,
|
|
296
|
+
align: h,
|
|
297
|
+
className: d,
|
|
298
|
+
style: g,
|
|
299
|
+
...r
|
|
300
|
+
} = e, _ = n ?? "span", o = {
|
|
301
|
+
color: Jt(c),
|
|
302
|
+
...l ? { fontSize: `var(--tcl-text-${l})` } : {},
|
|
303
|
+
...s ? { fontWeight: qt[s] } : {},
|
|
304
|
+
...h ? { textAlign: h } : {}
|
|
305
|
+
}, m = k(
|
|
306
|
+
"tcl-text",
|
|
307
|
+
a && "tcl-text--mono",
|
|
308
|
+
i && "tcl-text--truncate",
|
|
309
|
+
d
|
|
310
|
+
);
|
|
311
|
+
return /* @__PURE__ */ t(_, { className: m, style: { ...o, ...g }, ...r });
|
|
312
|
+
}
|
|
313
|
+
const wt = (() => {
|
|
314
|
+
try {
|
|
315
|
+
return !1;
|
|
316
|
+
} catch {
|
|
317
|
+
return !1;
|
|
318
|
+
}
|
|
319
|
+
})();
|
|
320
|
+
function nt(e) {
|
|
321
|
+
const { as: n, asChild: l, disabled: s, loading: c, onPress: a, className: i, ...h } = e, { handlers: d, dataAttrs: g } = Vt({ disabled: s, loading: c, onPress: a }), r = l ? Ke : n ?? "button", o = {
|
|
322
|
+
className: k("tcl-pressable", i),
|
|
323
|
+
...d,
|
|
324
|
+
...g,
|
|
325
|
+
...h
|
|
326
|
+
};
|
|
327
|
+
if (!l && r === "button" && (o.type = h.type ?? "button", o.disabled = !!(s || c), delete o["aria-disabled"]), wt && !l) {
|
|
328
|
+
const m = typeof r == "string" ? r : "";
|
|
329
|
+
m && m !== "button" && m !== "a" && console.warn(
|
|
330
|
+
`[Pressable] Rendering as <${m}> risks an invisible or unreachable affordance. Prefer <button>, <a href>, or asChild with a real interactive element.`
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
return /* @__PURE__ */ t(r, { ...o });
|
|
334
|
+
}
|
|
335
|
+
function Qt({
|
|
336
|
+
variant: e = "solid",
|
|
337
|
+
tone: n = "accent",
|
|
338
|
+
size: l = "md",
|
|
339
|
+
loading: s = !1,
|
|
340
|
+
disabled: c = !1,
|
|
341
|
+
fullWidth: a = !1,
|
|
342
|
+
asChild: i = !1,
|
|
343
|
+
startSlot: h,
|
|
344
|
+
endSlot: d,
|
|
345
|
+
onPress: g,
|
|
346
|
+
className: r,
|
|
347
|
+
children: _,
|
|
348
|
+
...o
|
|
349
|
+
}) {
|
|
350
|
+
const m = k(
|
|
351
|
+
"tcl-button",
|
|
352
|
+
`tcl-button--${e}`,
|
|
353
|
+
`tcl-button--${n}`,
|
|
354
|
+
`tcl-button--${l}`,
|
|
355
|
+
a && "tcl-button--full",
|
|
356
|
+
s && "is-loading",
|
|
357
|
+
r
|
|
358
|
+
);
|
|
359
|
+
return i ? /* @__PURE__ */ t(
|
|
360
|
+
nt,
|
|
361
|
+
{
|
|
362
|
+
asChild: !0,
|
|
363
|
+
className: m,
|
|
364
|
+
disabled: c,
|
|
365
|
+
loading: s,
|
|
366
|
+
onPress: g,
|
|
367
|
+
...o,
|
|
368
|
+
children: _
|
|
369
|
+
}
|
|
370
|
+
) : /* @__PURE__ */ u(
|
|
371
|
+
nt,
|
|
372
|
+
{
|
|
373
|
+
className: m,
|
|
374
|
+
disabled: c,
|
|
375
|
+
loading: s,
|
|
376
|
+
onPress: g,
|
|
377
|
+
...o,
|
|
378
|
+
children: [
|
|
379
|
+
s && /* @__PURE__ */ t("span", { className: "tcl-button__spinner", "aria-hidden": "true" }),
|
|
380
|
+
h && /* @__PURE__ */ t("span", { className: "tcl-button__icon", children: h }),
|
|
381
|
+
_ != null && /* @__PURE__ */ t("span", { className: "tcl-button__label", children: _ }),
|
|
382
|
+
d && /* @__PURE__ */ t("span", { className: "tcl-button__icon", children: d })
|
|
383
|
+
]
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
function kt({
|
|
388
|
+
tone: e = "neutral",
|
|
389
|
+
variant: n = "soft",
|
|
390
|
+
size: l = "md",
|
|
391
|
+
dot: s = !1,
|
|
392
|
+
className: c,
|
|
393
|
+
children: a,
|
|
394
|
+
...i
|
|
395
|
+
}) {
|
|
396
|
+
return /* @__PURE__ */ u(
|
|
397
|
+
"span",
|
|
398
|
+
{
|
|
399
|
+
className: k(
|
|
400
|
+
"tcl-badge",
|
|
401
|
+
`tcl-badge--${n}`,
|
|
402
|
+
`tcl-badge--${e}`,
|
|
403
|
+
`tcl-badge--${l}`,
|
|
404
|
+
c
|
|
405
|
+
),
|
|
406
|
+
...i,
|
|
407
|
+
children: [
|
|
408
|
+
s && /* @__PURE__ */ t("span", { className: "tcl-badge__dot", "aria-hidden": "true" }),
|
|
409
|
+
a
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
function Ue(e, n, l) {
|
|
415
|
+
const s = z(), c = e ?? s, a = n ? `${c}-desc` : void 0, i = l ? `${c}-err` : void 0, h = [a, i].filter(Boolean).join(" ") || void 0;
|
|
416
|
+
return { controlId: c, describedBy: h, descId: a, errId: i };
|
|
417
|
+
}
|
|
418
|
+
function Ge({
|
|
419
|
+
label: e,
|
|
420
|
+
description: n,
|
|
421
|
+
error: l,
|
|
422
|
+
required: s,
|
|
423
|
+
htmlFor: c,
|
|
424
|
+
descId: a,
|
|
425
|
+
errId: i,
|
|
426
|
+
className: h,
|
|
427
|
+
children: d
|
|
428
|
+
}) {
|
|
429
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-field", h), children: [
|
|
430
|
+
e && /* @__PURE__ */ u("label", { htmlFor: c, className: "tcl-field__label", children: [
|
|
431
|
+
e,
|
|
432
|
+
s && /* @__PURE__ */ u("span", { className: "tcl-field__req", "aria-hidden": "true", children: [
|
|
433
|
+
" ",
|
|
434
|
+
"*"
|
|
435
|
+
] })
|
|
436
|
+
] }),
|
|
437
|
+
n && /* @__PURE__ */ t("p", { id: a, className: "tcl-field__desc", children: n }),
|
|
438
|
+
d,
|
|
439
|
+
l && /* @__PURE__ */ t("p", { id: i, className: "tcl-field__error", role: "alert", children: l })
|
|
440
|
+
] });
|
|
441
|
+
}
|
|
442
|
+
function Tl({
|
|
443
|
+
label: e,
|
|
444
|
+
description: n,
|
|
445
|
+
error: l,
|
|
446
|
+
size: s = "md",
|
|
447
|
+
startSlot: c,
|
|
448
|
+
endSlot: a,
|
|
449
|
+
id: i,
|
|
450
|
+
className: h,
|
|
451
|
+
containerClassName: d,
|
|
452
|
+
disabled: g,
|
|
453
|
+
required: r,
|
|
454
|
+
ref: _,
|
|
455
|
+
...o
|
|
456
|
+
}) {
|
|
457
|
+
const { controlId: m, describedBy: b, descId: p, errId: f } = Ue(i, !!n, !!l);
|
|
458
|
+
return /* @__PURE__ */ t(
|
|
459
|
+
Ge,
|
|
460
|
+
{
|
|
461
|
+
label: e,
|
|
462
|
+
description: n,
|
|
463
|
+
error: l,
|
|
464
|
+
required: r,
|
|
465
|
+
htmlFor: m,
|
|
466
|
+
descId: p,
|
|
467
|
+
errId: f,
|
|
468
|
+
className: d,
|
|
469
|
+
children: /* @__PURE__ */ u(
|
|
470
|
+
"div",
|
|
471
|
+
{
|
|
472
|
+
className: k(
|
|
473
|
+
"tcl-input",
|
|
474
|
+
`tcl-input--${s}`,
|
|
475
|
+
l && "is-invalid",
|
|
476
|
+
g && "is-disabled"
|
|
477
|
+
),
|
|
478
|
+
children: [
|
|
479
|
+
c && /* @__PURE__ */ t("span", { className: "tcl-input__slot", children: c }),
|
|
480
|
+
/* @__PURE__ */ t(
|
|
481
|
+
"input",
|
|
482
|
+
{
|
|
483
|
+
id: m,
|
|
484
|
+
ref: _,
|
|
485
|
+
className: k("tcl-input__control", h),
|
|
486
|
+
disabled: g,
|
|
487
|
+
required: r,
|
|
488
|
+
"aria-invalid": l ? !0 : void 0,
|
|
489
|
+
"aria-describedby": b,
|
|
490
|
+
...o
|
|
491
|
+
}
|
|
492
|
+
),
|
|
493
|
+
a && /* @__PURE__ */ t("span", { className: "tcl-input__slot", children: a })
|
|
494
|
+
]
|
|
495
|
+
}
|
|
496
|
+
)
|
|
497
|
+
}
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
function El({
|
|
501
|
+
open: e,
|
|
502
|
+
onClose: n,
|
|
503
|
+
title: l,
|
|
504
|
+
description: s,
|
|
505
|
+
children: c,
|
|
506
|
+
footer: a,
|
|
507
|
+
size: i = "md",
|
|
508
|
+
closeOnOverlayClick: h = !0,
|
|
509
|
+
closeOnEsc: d = !0,
|
|
510
|
+
className: g
|
|
511
|
+
}) {
|
|
512
|
+
const r = z(), _ = z();
|
|
513
|
+
Yt(e);
|
|
514
|
+
const o = zt(e);
|
|
515
|
+
return H(() => {
|
|
516
|
+
if (!e || !d) return;
|
|
517
|
+
const m = (b) => {
|
|
518
|
+
b.key === "Escape" && n();
|
|
519
|
+
};
|
|
520
|
+
return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
|
|
521
|
+
}, [e, d, n]), H(() => {
|
|
522
|
+
if (!e || !h) return;
|
|
523
|
+
const m = (b) => {
|
|
524
|
+
const p = o.current;
|
|
525
|
+
p && !p.contains(b.target) && n();
|
|
526
|
+
};
|
|
527
|
+
return document.addEventListener("pointerdown", m, !0), () => document.removeEventListener("pointerdown", m, !0);
|
|
528
|
+
}, [e, h, n, o]), H(() => {
|
|
529
|
+
if (!e) return;
|
|
530
|
+
const m = document.body.style.overflow;
|
|
531
|
+
return document.body.style.overflow = "hidden", () => {
|
|
532
|
+
document.body.style.overflow = m;
|
|
533
|
+
};
|
|
534
|
+
}, [e]), e ? /* @__PURE__ */ t(Me, { children: /* @__PURE__ */ t("div", { className: "tcl-dialog__overlay", children: /* @__PURE__ */ u(
|
|
535
|
+
"div",
|
|
536
|
+
{
|
|
537
|
+
ref: o,
|
|
538
|
+
role: "dialog",
|
|
539
|
+
"aria-modal": "true",
|
|
540
|
+
"aria-labelledby": l ? r : void 0,
|
|
541
|
+
"aria-describedby": s ? _ : void 0,
|
|
542
|
+
tabIndex: -1,
|
|
543
|
+
className: k("tcl-dialog", `tcl-dialog--${i}`, g),
|
|
544
|
+
children: [
|
|
545
|
+
l && /* @__PURE__ */ t("h2", { id: r, className: "tcl-dialog__title", children: l }),
|
|
546
|
+
s && /* @__PURE__ */ t("p", { id: _, className: "tcl-dialog__desc", children: s }),
|
|
547
|
+
c != null && /* @__PURE__ */ t("div", { className: "tcl-dialog__body", children: c }),
|
|
548
|
+
a && /* @__PURE__ */ t("div", { className: "tcl-dialog__footer", children: a })
|
|
549
|
+
]
|
|
550
|
+
}
|
|
551
|
+
) }) }) : null;
|
|
552
|
+
}
|
|
553
|
+
function Ll({
|
|
554
|
+
variant: e = "ghost",
|
|
555
|
+
size: n = "md",
|
|
556
|
+
className: l,
|
|
557
|
+
children: s,
|
|
558
|
+
...c
|
|
559
|
+
}) {
|
|
560
|
+
return wt && !c["aria-label"] && console.warn("[IconButton] requires an `aria-label` to give the icon an accessible name."), /* @__PURE__ */ t(
|
|
561
|
+
Qt,
|
|
562
|
+
{
|
|
563
|
+
variant: e,
|
|
564
|
+
size: n,
|
|
565
|
+
className: k("tcl-icon-button", `tcl-icon-button--${n}`, l),
|
|
566
|
+
...c,
|
|
567
|
+
children: s
|
|
568
|
+
}
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
const Ct = ue(null);
|
|
572
|
+
function Ze(e) {
|
|
573
|
+
const n = he(Ct);
|
|
574
|
+
if (!n) throw new Error(`<Tabs.${e}> must be used within <Tabs>.`);
|
|
575
|
+
return n;
|
|
576
|
+
}
|
|
577
|
+
function en({
|
|
578
|
+
value: e,
|
|
579
|
+
defaultValue: n,
|
|
580
|
+
onValueChange: l,
|
|
581
|
+
orientation: s = "horizontal",
|
|
582
|
+
className: c,
|
|
583
|
+
style: a,
|
|
584
|
+
children: i
|
|
585
|
+
}) {
|
|
586
|
+
const [h, d] = A(n ?? ""), g = e ?? h, r = z(), _ = (o) => {
|
|
587
|
+
e === void 0 && d(o), l?.(o);
|
|
588
|
+
};
|
|
589
|
+
return /* @__PURE__ */ t(Ct.Provider, { value: { value: g, setValue: _, baseId: r, orientation: s }, children: /* @__PURE__ */ t("div", { className: k("tcl-tabs", `tcl-tabs--${s}`, c), style: a, children: i }) });
|
|
590
|
+
}
|
|
591
|
+
function tn({ children: e, className: n, ...l }) {
|
|
592
|
+
const { orientation: s } = Ze("List");
|
|
593
|
+
return /* @__PURE__ */ t(
|
|
594
|
+
"div",
|
|
595
|
+
{
|
|
596
|
+
role: "tablist",
|
|
597
|
+
"aria-orientation": s,
|
|
598
|
+
className: k("tcl-tabs__list", n),
|
|
599
|
+
...l,
|
|
600
|
+
children: e
|
|
601
|
+
}
|
|
602
|
+
);
|
|
603
|
+
}
|
|
604
|
+
function nn({ value: e, disabled: n = !1, children: l, className: s }) {
|
|
605
|
+
const { value: c, setValue: a, baseId: i, orientation: h } = Ze("Tab"), d = c === e, g = (r) => {
|
|
606
|
+
const _ = r.currentTarget.closest('[role="tablist"]');
|
|
607
|
+
if (!_) return;
|
|
608
|
+
const o = Array.from(_.querySelectorAll('[role="tab"]:not([disabled])')), m = o.indexOf(r.currentTarget);
|
|
609
|
+
if (m < 0) return;
|
|
610
|
+
const b = h === "horizontal", p = b ? "ArrowRight" : "ArrowDown", f = b ? "ArrowLeft" : "ArrowUp";
|
|
611
|
+
let x = -1;
|
|
612
|
+
if (r.key === p ? x = (m + 1) % o.length : r.key === f ? x = (m - 1 + o.length) % o.length : r.key === "Home" ? x = 0 : r.key === "End" && (x = o.length - 1), x >= 0) {
|
|
613
|
+
r.preventDefault();
|
|
614
|
+
const v = o[x];
|
|
615
|
+
v.focus(), v.dataset.value !== void 0 && a(v.dataset.value);
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
return /* @__PURE__ */ t(
|
|
619
|
+
"button",
|
|
620
|
+
{
|
|
621
|
+
type: "button",
|
|
622
|
+
role: "tab",
|
|
623
|
+
id: `${i}-tab-${e}`,
|
|
624
|
+
"aria-selected": d,
|
|
625
|
+
"aria-controls": `${i}-panel-${e}`,
|
|
626
|
+
tabIndex: d ? 0 : -1,
|
|
627
|
+
"data-value": e,
|
|
628
|
+
"data-state": d ? "active" : "inactive",
|
|
629
|
+
disabled: n,
|
|
630
|
+
className: k("tcl-tab", d && "is-active", s),
|
|
631
|
+
onClick: () => a(e),
|
|
632
|
+
onKeyDown: g,
|
|
633
|
+
children: l
|
|
634
|
+
}
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
function ln({ value: e, children: n, className: l }) {
|
|
638
|
+
const { value: s, baseId: c } = Ze("Panel"), a = s === e;
|
|
639
|
+
return /* @__PURE__ */ t(
|
|
640
|
+
"div",
|
|
641
|
+
{
|
|
642
|
+
role: "tabpanel",
|
|
643
|
+
id: `${c}-panel-${e}`,
|
|
644
|
+
"aria-labelledby": `${c}-tab-${e}`,
|
|
645
|
+
hidden: !a,
|
|
646
|
+
tabIndex: a ? 0 : void 0,
|
|
647
|
+
className: k("tcl-tabpanel", l),
|
|
648
|
+
children: a ? n : null
|
|
649
|
+
}
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
const Rl = Object.assign(en, {
|
|
653
|
+
List: tn,
|
|
654
|
+
Tab: nn,
|
|
655
|
+
Panel: ln
|
|
656
|
+
}), Mt = ue(null);
|
|
657
|
+
function qe(e) {
|
|
658
|
+
const n = he(Mt);
|
|
659
|
+
if (!n) throw new Error(`<Menu.${e}> must be used within <Menu>.`);
|
|
660
|
+
return n;
|
|
661
|
+
}
|
|
662
|
+
function sn({ open: e, defaultOpen: n = !1, onOpenChange: l, children: s }) {
|
|
663
|
+
const [c, a] = A(n), i = e ?? c, h = ee(null), d = ee(null), g = z(), r = (_) => {
|
|
664
|
+
e === void 0 && a(_), l?.(_);
|
|
665
|
+
};
|
|
666
|
+
return /* @__PURE__ */ t(
|
|
667
|
+
Mt.Provider,
|
|
668
|
+
{
|
|
669
|
+
value: {
|
|
670
|
+
open: i,
|
|
671
|
+
setOpen: r,
|
|
672
|
+
triggerRef: h,
|
|
673
|
+
contentRef: d,
|
|
674
|
+
triggerId: `${g}-trigger`,
|
|
675
|
+
contentId: `${g}-menu`
|
|
676
|
+
},
|
|
677
|
+
children: s
|
|
678
|
+
}
|
|
679
|
+
);
|
|
680
|
+
}
|
|
681
|
+
function cn({ children: e }) {
|
|
682
|
+
const { open: n, setOpen: l, triggerRef: s, triggerId: c, contentId: a } = qe("Trigger");
|
|
683
|
+
return /* @__PURE__ */ t(
|
|
684
|
+
Ke,
|
|
685
|
+
{
|
|
686
|
+
ref: s,
|
|
687
|
+
id: c,
|
|
688
|
+
"aria-haspopup": "menu",
|
|
689
|
+
"aria-expanded": n,
|
|
690
|
+
"aria-controls": n ? a : void 0,
|
|
691
|
+
onClick: () => l(!n),
|
|
692
|
+
onKeyDown: (i) => {
|
|
693
|
+
i.key === "ArrowDown" && (i.preventDefault(), l(!0));
|
|
694
|
+
},
|
|
695
|
+
children: e
|
|
696
|
+
}
|
|
697
|
+
);
|
|
698
|
+
}
|
|
699
|
+
function an({ align: e = "start", className: n, children: l, ...s }) {
|
|
700
|
+
const { open: c, setOpen: a, triggerRef: i, contentRef: h, triggerId: d, contentId: g } = qe("Content"), [r, _] = A({ top: 0, left: 0, minWidth: 0 });
|
|
701
|
+
return Bt(() => {
|
|
702
|
+
if (!c) return;
|
|
703
|
+
const o = () => {
|
|
704
|
+
const m = i.current;
|
|
705
|
+
if (!m) return;
|
|
706
|
+
const b = m.getBoundingClientRect();
|
|
707
|
+
_({ top: b.bottom + 4, left: e === "end" ? b.right : b.left, minWidth: b.width });
|
|
708
|
+
};
|
|
709
|
+
return o(), window.addEventListener("scroll", o, !0), window.addEventListener("resize", o), () => {
|
|
710
|
+
window.removeEventListener("scroll", o, !0), window.removeEventListener("resize", o);
|
|
711
|
+
};
|
|
712
|
+
}, [c, e, i]), H(() => {
|
|
713
|
+
if (!c) return;
|
|
714
|
+
const o = h.current;
|
|
715
|
+
if (!o) return;
|
|
716
|
+
const m = () => Array.from(
|
|
717
|
+
o.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')
|
|
718
|
+
);
|
|
719
|
+
m()[0]?.focus();
|
|
720
|
+
const b = (p) => {
|
|
721
|
+
const f = m();
|
|
722
|
+
if (f.length === 0) return;
|
|
723
|
+
const x = f.indexOf(document.activeElement);
|
|
724
|
+
p.key === "ArrowDown" ? (p.preventDefault(), f[(x + 1) % f.length]?.focus()) : p.key === "ArrowUp" ? (p.preventDefault(), f[(x - 1 + f.length) % f.length]?.focus()) : p.key === "Home" ? (p.preventDefault(), f[0]?.focus()) : p.key === "End" ? (p.preventDefault(), f[f.length - 1]?.focus()) : p.key === "Escape" ? (p.preventDefault(), a(!1), i.current?.focus()) : p.key === "Tab" && a(!1);
|
|
725
|
+
};
|
|
726
|
+
return o.addEventListener("keydown", b), () => o.removeEventListener("keydown", b);
|
|
727
|
+
}, [c, h, a, i]), H(() => {
|
|
728
|
+
if (!c) return;
|
|
729
|
+
const o = (m) => {
|
|
730
|
+
const b = m.target;
|
|
731
|
+
h.current?.contains(b) || i.current?.contains(b) || a(!1);
|
|
732
|
+
};
|
|
733
|
+
return document.addEventListener("pointerdown", o, !0), () => document.removeEventListener("pointerdown", o, !0);
|
|
734
|
+
}, [c, h, i, a]), c ? /* @__PURE__ */ t(Me, { children: /* @__PURE__ */ t(
|
|
735
|
+
"div",
|
|
736
|
+
{
|
|
737
|
+
ref: h,
|
|
738
|
+
role: "menu",
|
|
739
|
+
id: g,
|
|
740
|
+
"aria-labelledby": d,
|
|
741
|
+
className: k("tcl-menu", n),
|
|
742
|
+
style: {
|
|
743
|
+
position: "fixed",
|
|
744
|
+
top: r.top,
|
|
745
|
+
left: r.left,
|
|
746
|
+
minWidth: r.minWidth,
|
|
747
|
+
transform: e === "end" ? "translateX(-100%)" : void 0
|
|
748
|
+
},
|
|
749
|
+
...s,
|
|
750
|
+
children: l
|
|
751
|
+
}
|
|
752
|
+
) }) : null;
|
|
753
|
+
}
|
|
754
|
+
function rn({ onSelect: e, disabled: n = !1, className: l, children: s, ...c }) {
|
|
755
|
+
const { setOpen: a, triggerRef: i } = qe("Item"), h = () => {
|
|
756
|
+
n || (e?.(), a(!1), i.current?.focus());
|
|
757
|
+
};
|
|
758
|
+
return /* @__PURE__ */ t(
|
|
759
|
+
"div",
|
|
760
|
+
{
|
|
761
|
+
role: "menuitem",
|
|
762
|
+
tabIndex: -1,
|
|
763
|
+
"aria-disabled": n || void 0,
|
|
764
|
+
className: k("tcl-menu__item", n && "is-disabled", l),
|
|
765
|
+
onClick: h,
|
|
766
|
+
onKeyDown: (d) => {
|
|
767
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), h());
|
|
768
|
+
},
|
|
769
|
+
...c,
|
|
770
|
+
children: s
|
|
771
|
+
}
|
|
772
|
+
);
|
|
773
|
+
}
|
|
774
|
+
const Al = Object.assign(sn, {
|
|
775
|
+
Trigger: cn,
|
|
776
|
+
Content: an,
|
|
777
|
+
Item: rn
|
|
778
|
+
});
|
|
779
|
+
function Dl({
|
|
780
|
+
label: e,
|
|
781
|
+
description: n,
|
|
782
|
+
error: l,
|
|
783
|
+
id: s,
|
|
784
|
+
className: c,
|
|
785
|
+
containerClassName: a,
|
|
786
|
+
disabled: i,
|
|
787
|
+
required: h,
|
|
788
|
+
rows: d = 4,
|
|
789
|
+
ref: g,
|
|
790
|
+
...r
|
|
791
|
+
}) {
|
|
792
|
+
const { controlId: _, describedBy: o, descId: m, errId: b } = Ue(s, !!n, !!l);
|
|
793
|
+
return /* @__PURE__ */ t(
|
|
794
|
+
Ge,
|
|
795
|
+
{
|
|
796
|
+
label: e,
|
|
797
|
+
description: n,
|
|
798
|
+
error: l,
|
|
799
|
+
required: h,
|
|
800
|
+
htmlFor: _,
|
|
801
|
+
descId: m,
|
|
802
|
+
errId: b,
|
|
803
|
+
className: a,
|
|
804
|
+
children: /* @__PURE__ */ t(
|
|
805
|
+
"textarea",
|
|
806
|
+
{
|
|
807
|
+
id: _,
|
|
808
|
+
ref: g,
|
|
809
|
+
rows: d,
|
|
810
|
+
className: k("tcl-textarea", l && "is-invalid", c),
|
|
811
|
+
disabled: i,
|
|
812
|
+
required: h,
|
|
813
|
+
"aria-invalid": l ? !0 : void 0,
|
|
814
|
+
"aria-describedby": o,
|
|
815
|
+
...r
|
|
816
|
+
}
|
|
817
|
+
)
|
|
818
|
+
}
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
function Fl({
|
|
822
|
+
label: e,
|
|
823
|
+
description: n,
|
|
824
|
+
error: l,
|
|
825
|
+
size: s = "md",
|
|
826
|
+
placeholder: c,
|
|
827
|
+
id: a,
|
|
828
|
+
className: i,
|
|
829
|
+
containerClassName: h,
|
|
830
|
+
disabled: d,
|
|
831
|
+
required: g,
|
|
832
|
+
ref: r,
|
|
833
|
+
children: _,
|
|
834
|
+
...o
|
|
835
|
+
}) {
|
|
836
|
+
const { controlId: m, describedBy: b, descId: p, errId: f } = Ue(a, !!n, !!l), x = "value" in o || "defaultValue" in o;
|
|
837
|
+
return /* @__PURE__ */ t(
|
|
838
|
+
Ge,
|
|
839
|
+
{
|
|
840
|
+
label: e,
|
|
841
|
+
description: n,
|
|
842
|
+
error: l,
|
|
843
|
+
required: g,
|
|
844
|
+
htmlFor: m,
|
|
845
|
+
descId: p,
|
|
846
|
+
errId: f,
|
|
847
|
+
className: h,
|
|
848
|
+
children: /* @__PURE__ */ u(
|
|
849
|
+
"div",
|
|
850
|
+
{
|
|
851
|
+
className: k(
|
|
852
|
+
"tcl-select",
|
|
853
|
+
`tcl-select--${s}`,
|
|
854
|
+
l && "is-invalid",
|
|
855
|
+
d && "is-disabled"
|
|
856
|
+
),
|
|
857
|
+
children: [
|
|
858
|
+
/* @__PURE__ */ u(
|
|
859
|
+
"select",
|
|
860
|
+
{
|
|
861
|
+
id: m,
|
|
862
|
+
ref: r,
|
|
863
|
+
className: k("tcl-select__control", i),
|
|
864
|
+
disabled: d,
|
|
865
|
+
required: g,
|
|
866
|
+
"aria-invalid": l ? !0 : void 0,
|
|
867
|
+
"aria-describedby": b,
|
|
868
|
+
defaultValue: c !== void 0 && !x ? "" : void 0,
|
|
869
|
+
...o,
|
|
870
|
+
children: [
|
|
871
|
+
c !== void 0 && /* @__PURE__ */ t("option", { value: "", disabled: !0, children: c }),
|
|
872
|
+
_
|
|
873
|
+
]
|
|
874
|
+
}
|
|
875
|
+
),
|
|
876
|
+
/* @__PURE__ */ t("span", { className: "tcl-select__chevron", "aria-hidden": "true", children: /* @__PURE__ */ t("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ t(
|
|
877
|
+
"path",
|
|
878
|
+
{
|
|
879
|
+
d: "M3 4.5L6 7.5L9 4.5",
|
|
880
|
+
stroke: "currentColor",
|
|
881
|
+
strokeWidth: "1.4",
|
|
882
|
+
strokeLinecap: "round",
|
|
883
|
+
strokeLinejoin: "round"
|
|
884
|
+
}
|
|
885
|
+
) }) })
|
|
886
|
+
]
|
|
887
|
+
}
|
|
888
|
+
)
|
|
889
|
+
}
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
function It({
|
|
893
|
+
label: e,
|
|
894
|
+
description: n,
|
|
895
|
+
indeterminate: l = !1,
|
|
896
|
+
disabled: s,
|
|
897
|
+
className: c,
|
|
898
|
+
id: a,
|
|
899
|
+
ref: i,
|
|
900
|
+
...h
|
|
901
|
+
}) {
|
|
902
|
+
const d = ee(null), g = Ht(d, i), r = z(), _ = a ?? r, o = n ? `${_}-desc` : void 0;
|
|
903
|
+
return H(() => {
|
|
904
|
+
d.current && (d.current.indeterminate = l);
|
|
905
|
+
}, [l]), /* @__PURE__ */ u("div", { className: k("tcl-checkbox-field", s && "is-disabled", c), children: [
|
|
906
|
+
/* @__PURE__ */ u("label", { className: "tcl-checkbox", children: [
|
|
907
|
+
/* @__PURE__ */ t(
|
|
908
|
+
"input",
|
|
909
|
+
{
|
|
910
|
+
id: _,
|
|
911
|
+
ref: g,
|
|
912
|
+
type: "checkbox",
|
|
913
|
+
className: "tcl-checkbox__input tcl-sr-only",
|
|
914
|
+
disabled: s,
|
|
915
|
+
"aria-describedby": o,
|
|
916
|
+
...h
|
|
917
|
+
}
|
|
918
|
+
),
|
|
919
|
+
/* @__PURE__ */ t("span", { className: "tcl-checkbox__box", "aria-hidden": "true", children: /* @__PURE__ */ t("svg", { className: "tcl-checkbox__check", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ t(
|
|
920
|
+
"path",
|
|
921
|
+
{
|
|
922
|
+
d: "M2.5 6.5L4.8 8.8L9.5 3.5",
|
|
923
|
+
stroke: "currentColor",
|
|
924
|
+
strokeWidth: "1.8",
|
|
925
|
+
strokeLinecap: "round",
|
|
926
|
+
strokeLinejoin: "round"
|
|
927
|
+
}
|
|
928
|
+
) }) }),
|
|
929
|
+
e && /* @__PURE__ */ t("span", { className: "tcl-checkbox__label", children: e })
|
|
930
|
+
] }),
|
|
931
|
+
n && /* @__PURE__ */ t("p", { id: o, className: "tcl-checkbox__desc", children: n })
|
|
932
|
+
] });
|
|
933
|
+
}
|
|
934
|
+
const St = ue(null);
|
|
935
|
+
function on() {
|
|
936
|
+
const e = he(St);
|
|
937
|
+
if (!e) throw new Error("<RadioGroup.Item> must be used within <RadioGroup>.");
|
|
938
|
+
return e;
|
|
939
|
+
}
|
|
940
|
+
function dn({
|
|
941
|
+
name: e,
|
|
942
|
+
value: n,
|
|
943
|
+
defaultValue: l,
|
|
944
|
+
onValueChange: s,
|
|
945
|
+
label: c,
|
|
946
|
+
description: a,
|
|
947
|
+
error: i,
|
|
948
|
+
className: h,
|
|
949
|
+
children: d
|
|
950
|
+
}) {
|
|
951
|
+
const [g, r] = A(l), _ = n ?? g, o = z(), m = z(), b = e ?? m, p = c ? `${o}-label` : void 0, f = a ? `${o}-desc` : void 0, x = i ? `${o}-err` : void 0, v = [f, x].filter(Boolean).join(" ") || void 0, $ = (y) => {
|
|
952
|
+
n === void 0 && r(y), s?.(y);
|
|
953
|
+
};
|
|
954
|
+
return /* @__PURE__ */ t(St.Provider, { value: { name: b, value: _, setValue: $ }, children: /* @__PURE__ */ u(
|
|
955
|
+
"div",
|
|
956
|
+
{
|
|
957
|
+
role: "radiogroup",
|
|
958
|
+
"aria-labelledby": p,
|
|
959
|
+
"aria-describedby": v,
|
|
960
|
+
className: k("tcl-radio-group", h),
|
|
961
|
+
children: [
|
|
962
|
+
c && /* @__PURE__ */ t("span", { id: p, className: "tcl-field__label", children: c }),
|
|
963
|
+
a && /* @__PURE__ */ t("p", { id: f, className: "tcl-field__desc", children: a }),
|
|
964
|
+
/* @__PURE__ */ t("div", { className: "tcl-radio-group__items", children: d }),
|
|
965
|
+
i && /* @__PURE__ */ t("p", { id: x, className: "tcl-field__error", role: "alert", children: i })
|
|
966
|
+
]
|
|
967
|
+
}
|
|
968
|
+
) });
|
|
969
|
+
}
|
|
970
|
+
function un({ value: e, label: n, description: l, disabled: s = !1, className: c }) {
|
|
971
|
+
const a = on(), i = a.value === e, h = z(), d = l ? `${h}-desc` : void 0;
|
|
972
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-radio-field", s && "is-disabled", c), children: [
|
|
973
|
+
/* @__PURE__ */ u("label", { className: "tcl-radio", children: [
|
|
974
|
+
/* @__PURE__ */ t(
|
|
975
|
+
"input",
|
|
976
|
+
{
|
|
977
|
+
type: "radio",
|
|
978
|
+
name: a.name,
|
|
979
|
+
value: e,
|
|
980
|
+
checked: i,
|
|
981
|
+
disabled: s,
|
|
982
|
+
onChange: () => a.setValue(e),
|
|
983
|
+
className: "tcl-radio__input tcl-sr-only",
|
|
984
|
+
"aria-describedby": d
|
|
985
|
+
}
|
|
986
|
+
),
|
|
987
|
+
/* @__PURE__ */ t("span", { className: "tcl-radio__dot", "aria-hidden": "true" }),
|
|
988
|
+
n && /* @__PURE__ */ t("span", { className: "tcl-radio__label", children: n })
|
|
989
|
+
] }),
|
|
990
|
+
l && /* @__PURE__ */ t("p", { id: d, className: "tcl-radio__desc", children: l })
|
|
991
|
+
] });
|
|
992
|
+
}
|
|
993
|
+
const Bl = Object.assign(dn, { Item: un });
|
|
994
|
+
function Ol({ label: e, description: n, disabled: l, className: s, id: c, ref: a, ...i }) {
|
|
995
|
+
const h = z(), d = c ?? h, g = n ? `${d}-desc` : void 0;
|
|
996
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-switch-field", l && "is-disabled", s), children: [
|
|
997
|
+
/* @__PURE__ */ u("label", { className: "tcl-switch", children: [
|
|
998
|
+
/* @__PURE__ */ t(
|
|
999
|
+
"input",
|
|
1000
|
+
{
|
|
1001
|
+
id: d,
|
|
1002
|
+
ref: a,
|
|
1003
|
+
type: "checkbox",
|
|
1004
|
+
role: "switch",
|
|
1005
|
+
className: "tcl-switch__input tcl-sr-only",
|
|
1006
|
+
disabled: l,
|
|
1007
|
+
"aria-describedby": g,
|
|
1008
|
+
...i
|
|
1009
|
+
}
|
|
1010
|
+
),
|
|
1011
|
+
/* @__PURE__ */ t("span", { className: "tcl-switch__track", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { className: "tcl-switch__thumb" }) }),
|
|
1012
|
+
e && /* @__PURE__ */ t("span", { className: "tcl-switch__label", children: e })
|
|
1013
|
+
] }),
|
|
1014
|
+
n && /* @__PURE__ */ t("p", { id: g, className: "tcl-switch__desc", children: n })
|
|
1015
|
+
] });
|
|
1016
|
+
}
|
|
1017
|
+
function Pl({ content: e, children: n, openDelay: l = 400, side: s = "top", className: c }) {
|
|
1018
|
+
const [a, i] = A(!1), [h, d] = A({ top: 0, left: 0 }), g = ee(null), r = ee(void 0), _ = z(), o = () => {
|
|
1019
|
+
const f = g.current;
|
|
1020
|
+
if (!f) return;
|
|
1021
|
+
const x = f.getBoundingClientRect();
|
|
1022
|
+
d({ top: s === "top" ? x.top - 8 : x.bottom + 8, left: x.left + x.width / 2 });
|
|
1023
|
+
}, m = () => {
|
|
1024
|
+
window.clearTimeout(r.current), r.current = window.setTimeout(() => {
|
|
1025
|
+
o(), i(!0);
|
|
1026
|
+
}, l);
|
|
1027
|
+
}, b = () => {
|
|
1028
|
+
window.clearTimeout(r.current), o(), i(!0);
|
|
1029
|
+
}, p = () => {
|
|
1030
|
+
window.clearTimeout(r.current), i(!1);
|
|
1031
|
+
};
|
|
1032
|
+
return H(() => () => window.clearTimeout(r.current), []), H(() => {
|
|
1033
|
+
if (!a) return;
|
|
1034
|
+
const f = (v) => {
|
|
1035
|
+
v.key === "Escape" && p();
|
|
1036
|
+
}, x = () => o();
|
|
1037
|
+
return document.addEventListener("keydown", f), window.addEventListener("scroll", x, !0), window.addEventListener("resize", x), () => {
|
|
1038
|
+
document.removeEventListener("keydown", f), window.removeEventListener("scroll", x, !0), window.removeEventListener("resize", x);
|
|
1039
|
+
};
|
|
1040
|
+
}, [a, s]), /* @__PURE__ */ u(K, { children: [
|
|
1041
|
+
/* @__PURE__ */ t(
|
|
1042
|
+
Ke,
|
|
1043
|
+
{
|
|
1044
|
+
ref: g,
|
|
1045
|
+
"aria-describedby": a ? _ : void 0,
|
|
1046
|
+
onPointerEnter: m,
|
|
1047
|
+
onPointerLeave: p,
|
|
1048
|
+
onFocus: b,
|
|
1049
|
+
onBlur: p,
|
|
1050
|
+
children: n
|
|
1051
|
+
}
|
|
1052
|
+
),
|
|
1053
|
+
a && /* @__PURE__ */ t(Me, { children: /* @__PURE__ */ t(
|
|
1054
|
+
"div",
|
|
1055
|
+
{
|
|
1056
|
+
role: "tooltip",
|
|
1057
|
+
id: _,
|
|
1058
|
+
className: k("tcl-tooltip", `tcl-tooltip--${s}`, c),
|
|
1059
|
+
style: { position: "fixed", top: h.top, left: h.left },
|
|
1060
|
+
children: e
|
|
1061
|
+
}
|
|
1062
|
+
) })
|
|
1063
|
+
] });
|
|
1064
|
+
}
|
|
1065
|
+
const Tt = ue(null);
|
|
1066
|
+
function jl() {
|
|
1067
|
+
const e = he(Tt);
|
|
1068
|
+
if (!e) throw new Error("useToast must be used within <ToastProvider>.");
|
|
1069
|
+
return e;
|
|
1070
|
+
}
|
|
1071
|
+
let lt = 0;
|
|
1072
|
+
function Hl({ children: e, duration: n = 5e3, placement: l = "bottom" }) {
|
|
1073
|
+
const [s, c] = A([]), a = j((h) => {
|
|
1074
|
+
c((d) => d.filter((g) => g.id !== h));
|
|
1075
|
+
}, []), i = j(
|
|
1076
|
+
(h) => {
|
|
1077
|
+
lt += 1;
|
|
1078
|
+
const d = `tcl-toast-${lt}`;
|
|
1079
|
+
return c((g) => [
|
|
1080
|
+
...g,
|
|
1081
|
+
{ id: d, tone: "neutral", duration: n, ...h }
|
|
1082
|
+
]), d;
|
|
1083
|
+
},
|
|
1084
|
+
[n]
|
|
1085
|
+
);
|
|
1086
|
+
return /* @__PURE__ */ u(Tt.Provider, { value: { toast: i, dismiss: a }, children: [
|
|
1087
|
+
e,
|
|
1088
|
+
/* @__PURE__ */ t(Me, { children: /* @__PURE__ */ t(
|
|
1089
|
+
"div",
|
|
1090
|
+
{
|
|
1091
|
+
className: k("tcl-toast-viewport", `tcl-toast-viewport--${l}`),
|
|
1092
|
+
role: "region",
|
|
1093
|
+
"aria-label": "Notifications",
|
|
1094
|
+
children: s.map((h) => /* @__PURE__ */ t(hn, { toast: h, onDismiss: a }, h.id))
|
|
1095
|
+
}
|
|
1096
|
+
) })
|
|
1097
|
+
] });
|
|
1098
|
+
}
|
|
1099
|
+
function hn({ toast: e, onDismiss: n }) {
|
|
1100
|
+
const { id: l, title: s, description: c, tone: a, duration: i } = e, h = ee(void 0), d = j(() => {
|
|
1101
|
+
i && (h.current = window.setTimeout(() => n(l), i));
|
|
1102
|
+
}, [i, l, n]), g = j(() => window.clearTimeout(h.current), []);
|
|
1103
|
+
H(() => (d(), g), [d, g]);
|
|
1104
|
+
const r = a === "danger" || a === "warning";
|
|
1105
|
+
return /* @__PURE__ */ u(
|
|
1106
|
+
"div",
|
|
1107
|
+
{
|
|
1108
|
+
className: k("tcl-toast", `tcl-toast--${a}`),
|
|
1109
|
+
role: r ? "alert" : "status",
|
|
1110
|
+
"aria-live": r ? "assertive" : "polite",
|
|
1111
|
+
onPointerEnter: g,
|
|
1112
|
+
onPointerLeave: d,
|
|
1113
|
+
children: [
|
|
1114
|
+
/* @__PURE__ */ u("div", { className: "tcl-toast__body", children: [
|
|
1115
|
+
/* @__PURE__ */ t("p", { className: "tcl-toast__title", children: s }),
|
|
1116
|
+
c && /* @__PURE__ */ t("p", { className: "tcl-toast__desc", children: c })
|
|
1117
|
+
] }),
|
|
1118
|
+
/* @__PURE__ */ t("button", { type: "button", className: "tcl-toast__close", "aria-label": "Dismiss", onClick: () => n(l), children: /* @__PURE__ */ t("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t("path", { d: "M3.5 3.5l7 7M10.5 3.5l-7 7", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }) }) })
|
|
1119
|
+
]
|
|
1120
|
+
}
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
function mn(e) {
|
|
1124
|
+
return e ? e.trim().split(/\s+/).slice(0, 2).map((l) => l[0]?.toUpperCase() ?? "").join("") : "";
|
|
1125
|
+
}
|
|
1126
|
+
function Wl({
|
|
1127
|
+
src: e,
|
|
1128
|
+
alt: n,
|
|
1129
|
+
name: l,
|
|
1130
|
+
size: s = "md",
|
|
1131
|
+
shape: c = "circle",
|
|
1132
|
+
tone: a = "neutral",
|
|
1133
|
+
className: i,
|
|
1134
|
+
...h
|
|
1135
|
+
}) {
|
|
1136
|
+
const [d, g] = A(!1), r = !!e && !d, _ = mn(l), o = n ?? l ?? void 0, m = !o;
|
|
1137
|
+
return /* @__PURE__ */ t(
|
|
1138
|
+
"span",
|
|
1139
|
+
{
|
|
1140
|
+
className: k(
|
|
1141
|
+
"tcl-avatar",
|
|
1142
|
+
`tcl-avatar--${s}`,
|
|
1143
|
+
`tcl-avatar--${c}`,
|
|
1144
|
+
!r && `tcl-avatar--tone-${a}`,
|
|
1145
|
+
i
|
|
1146
|
+
),
|
|
1147
|
+
role: m ? void 0 : "img",
|
|
1148
|
+
"aria-label": o,
|
|
1149
|
+
"aria-hidden": m || void 0,
|
|
1150
|
+
...h,
|
|
1151
|
+
children: r ? /* @__PURE__ */ t("img", { className: "tcl-avatar__img", src: e, alt: "", onError: () => g(!0) }) : _ ? /* @__PURE__ */ t("span", { className: "tcl-avatar__initials", "aria-hidden": "true", children: _ }) : /* @__PURE__ */ t("svg", { className: "tcl-avatar__fallback", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ t("path", { d: "M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2c-4.4 0-8 2.7-8 6v1h16v-1c0-3.3-3.6-6-8-6Z" }) })
|
|
1152
|
+
}
|
|
1153
|
+
);
|
|
1154
|
+
}
|
|
1155
|
+
function Vl({
|
|
1156
|
+
size: e = "md",
|
|
1157
|
+
tone: n = "current",
|
|
1158
|
+
label: l = "Loading",
|
|
1159
|
+
className: s,
|
|
1160
|
+
...c
|
|
1161
|
+
}) {
|
|
1162
|
+
return /* @__PURE__ */ u(
|
|
1163
|
+
"span",
|
|
1164
|
+
{
|
|
1165
|
+
className: k("tcl-spinner", `tcl-spinner--${e}`, `tcl-spinner--tone-${n}`, s),
|
|
1166
|
+
role: "status",
|
|
1167
|
+
...c,
|
|
1168
|
+
children: [
|
|
1169
|
+
/* @__PURE__ */ t("span", { className: "tcl-spinner__ring", "aria-hidden": "true" }),
|
|
1170
|
+
/* @__PURE__ */ t("span", { className: "tcl-sr-only", children: l })
|
|
1171
|
+
]
|
|
1172
|
+
}
|
|
1173
|
+
);
|
|
1174
|
+
}
|
|
1175
|
+
const st = (e) => typeof e == "number" ? `${e}px` : e;
|
|
1176
|
+
function Yl({
|
|
1177
|
+
variant: e = "rect",
|
|
1178
|
+
width: n,
|
|
1179
|
+
height: l,
|
|
1180
|
+
lines: s = 1,
|
|
1181
|
+
className: c,
|
|
1182
|
+
style: a,
|
|
1183
|
+
...i
|
|
1184
|
+
}) {
|
|
1185
|
+
if (e === "text" && s > 1)
|
|
1186
|
+
return /* @__PURE__ */ t("span", { className: k("tcl-skeleton-group", c), "aria-hidden": "true", ...i, children: Array.from({ length: s }).map((d, g) => /* @__PURE__ */ t(
|
|
1187
|
+
"span",
|
|
1188
|
+
{
|
|
1189
|
+
className: "tcl-skeleton tcl-skeleton--text",
|
|
1190
|
+
style: { width: g === s - 1 ? "60%" : "100%" }
|
|
1191
|
+
},
|
|
1192
|
+
g
|
|
1193
|
+
)) });
|
|
1194
|
+
const h = { width: st(n), height: st(l), ...a };
|
|
1195
|
+
return /* @__PURE__ */ t(
|
|
1196
|
+
"span",
|
|
1197
|
+
{
|
|
1198
|
+
className: k("tcl-skeleton", `tcl-skeleton--${e}`, c),
|
|
1199
|
+
style: h,
|
|
1200
|
+
"aria-hidden": "true",
|
|
1201
|
+
...i
|
|
1202
|
+
}
|
|
1203
|
+
);
|
|
1204
|
+
}
|
|
1205
|
+
function pn({ interactive: e = !1, className: n, children: l, ...s }) {
|
|
1206
|
+
return /* @__PURE__ */ t(
|
|
1207
|
+
"div",
|
|
1208
|
+
{
|
|
1209
|
+
className: k("tcl-card", e && "tcl-card--interactive", n),
|
|
1210
|
+
...s,
|
|
1211
|
+
children: l
|
|
1212
|
+
}
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
function fn({ className: e, children: n, ...l }) {
|
|
1216
|
+
return /* @__PURE__ */ t("div", { className: k("tcl-card__header", e), ...l, children: n });
|
|
1217
|
+
}
|
|
1218
|
+
function _n({ className: e, children: n, ...l }) {
|
|
1219
|
+
return /* @__PURE__ */ t("div", { className: k("tcl-card__body", e), ...l, children: n });
|
|
1220
|
+
}
|
|
1221
|
+
function bn({ className: e, children: n, ...l }) {
|
|
1222
|
+
return /* @__PURE__ */ t("div", { className: k("tcl-card__footer", e), ...l, children: n });
|
|
1223
|
+
}
|
|
1224
|
+
const Xl = Object.assign(pn, {
|
|
1225
|
+
Header: fn,
|
|
1226
|
+
Body: _n,
|
|
1227
|
+
Footer: bn
|
|
1228
|
+
}), vn = {
|
|
1229
|
+
accent: "var(--tcl-accent)",
|
|
1230
|
+
info: "var(--tcl-status-info)",
|
|
1231
|
+
success: "var(--tcl-status-success)",
|
|
1232
|
+
warning: "var(--tcl-status-warning)",
|
|
1233
|
+
danger: "var(--tcl-status-danger)",
|
|
1234
|
+
neutral: "var(--tcl-status-neutral)"
|
|
1235
|
+
};
|
|
1236
|
+
function R(e) {
|
|
1237
|
+
return vn[e];
|
|
1238
|
+
}
|
|
1239
|
+
function Z(e, n, l) {
|
|
1240
|
+
return l <= n ? 0 : Math.min(100, Math.max(0, (e - n) / (l - n) * 100));
|
|
1241
|
+
}
|
|
1242
|
+
function L(e, n) {
|
|
1243
|
+
return { ...n ?? {}, ...e };
|
|
1244
|
+
}
|
|
1245
|
+
function xe({
|
|
1246
|
+
role: e,
|
|
1247
|
+
value: n,
|
|
1248
|
+
min: l = 0,
|
|
1249
|
+
max: s = 100,
|
|
1250
|
+
valueText: c,
|
|
1251
|
+
ariaLabel: a,
|
|
1252
|
+
showValue: i = !0,
|
|
1253
|
+
valueLabel: h,
|
|
1254
|
+
icon: d,
|
|
1255
|
+
size: g = "md",
|
|
1256
|
+
glow: r = !1,
|
|
1257
|
+
tone: _ = "accent",
|
|
1258
|
+
className: o,
|
|
1259
|
+
trackClassName: m,
|
|
1260
|
+
children: b,
|
|
1261
|
+
trackStyle: p
|
|
1262
|
+
}) {
|
|
1263
|
+
const f = Z(n, l, s);
|
|
1264
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-fillbar-row", o), children: [
|
|
1265
|
+
d && /* @__PURE__ */ t("span", { className: "tcl-fillbar__icon", "aria-hidden": "true", children: d }),
|
|
1266
|
+
/* @__PURE__ */ t(
|
|
1267
|
+
"div",
|
|
1268
|
+
{
|
|
1269
|
+
role: e,
|
|
1270
|
+
"aria-valuenow": Math.round(Math.min(s, Math.max(l, n))),
|
|
1271
|
+
"aria-valuemin": l,
|
|
1272
|
+
"aria-valuemax": s,
|
|
1273
|
+
"aria-valuetext": c,
|
|
1274
|
+
"aria-label": a,
|
|
1275
|
+
className: k(
|
|
1276
|
+
"tcl-fillbar",
|
|
1277
|
+
`tcl-fillbar--${g}`,
|
|
1278
|
+
`tcl-fillbar--${_}`,
|
|
1279
|
+
r && "is-glow",
|
|
1280
|
+
m
|
|
1281
|
+
),
|
|
1282
|
+
style: L({ "--value": `${f}%` }, p),
|
|
1283
|
+
children: b
|
|
1284
|
+
}
|
|
1285
|
+
),
|
|
1286
|
+
i && /* @__PURE__ */ t("span", { className: "tcl-fillbar__value", children: h ?? `${Math.round(f)}%` })
|
|
1287
|
+
] });
|
|
1288
|
+
}
|
|
1289
|
+
function zl({
|
|
1290
|
+
value: e,
|
|
1291
|
+
max: n = 100,
|
|
1292
|
+
tone: l = "accent",
|
|
1293
|
+
variant: s = "solid",
|
|
1294
|
+
segments: c = 10,
|
|
1295
|
+
size: a = "md",
|
|
1296
|
+
glow: i = !1,
|
|
1297
|
+
showValue: h = !0,
|
|
1298
|
+
icon: d,
|
|
1299
|
+
label: g,
|
|
1300
|
+
className: r
|
|
1301
|
+
}) {
|
|
1302
|
+
const _ = Z(e, 0, n);
|
|
1303
|
+
let o;
|
|
1304
|
+
if (s === "segments") {
|
|
1305
|
+
const m = Math.round(_ / 100 * c);
|
|
1306
|
+
o = Array.from({ length: c }).map((b, p) => /* @__PURE__ */ t("span", { className: k("tcl-fillbar__cell", p < m && "is-on") }, p));
|
|
1307
|
+
} else
|
|
1308
|
+
o = /* @__PURE__ */ t("span", { className: "tcl-fillbar__fill" });
|
|
1309
|
+
return /* @__PURE__ */ t(
|
|
1310
|
+
xe,
|
|
1311
|
+
{
|
|
1312
|
+
role: "progressbar",
|
|
1313
|
+
value: e,
|
|
1314
|
+
max: n,
|
|
1315
|
+
ariaLabel: g,
|
|
1316
|
+
showValue: h,
|
|
1317
|
+
icon: d,
|
|
1318
|
+
size: a,
|
|
1319
|
+
glow: i,
|
|
1320
|
+
tone: l,
|
|
1321
|
+
className: r,
|
|
1322
|
+
trackClassName: s === "segments" ? "tcl-fillbar--segmented" : void 0,
|
|
1323
|
+
children: o
|
|
1324
|
+
}
|
|
1325
|
+
);
|
|
1326
|
+
}
|
|
1327
|
+
function Kl({
|
|
1328
|
+
value: e = 0,
|
|
1329
|
+
min: n = 0,
|
|
1330
|
+
max: l = 100,
|
|
1331
|
+
tone: s = "success",
|
|
1332
|
+
variant: c = "solid",
|
|
1333
|
+
segments: a = [],
|
|
1334
|
+
thresholds: i = [],
|
|
1335
|
+
size: h = "md",
|
|
1336
|
+
glow: d = !1,
|
|
1337
|
+
showValue: g,
|
|
1338
|
+
icon: r,
|
|
1339
|
+
label: _,
|
|
1340
|
+
className: o
|
|
1341
|
+
}) {
|
|
1342
|
+
if (c === "stacked") {
|
|
1343
|
+
const m = a.reduce((b, p) => b + p.value, 0);
|
|
1344
|
+
return /* @__PURE__ */ t(
|
|
1345
|
+
xe,
|
|
1346
|
+
{
|
|
1347
|
+
role: "meter",
|
|
1348
|
+
value: m,
|
|
1349
|
+
min: n,
|
|
1350
|
+
max: l,
|
|
1351
|
+
ariaLabel: _,
|
|
1352
|
+
valueText: a.map((b) => `${b.label ?? "segment"}: ${b.value}`).join(", "),
|
|
1353
|
+
showValue: g ?? !1,
|
|
1354
|
+
icon: r,
|
|
1355
|
+
size: h,
|
|
1356
|
+
glow: d,
|
|
1357
|
+
tone: s,
|
|
1358
|
+
className: o,
|
|
1359
|
+
trackClassName: "tcl-fillbar--stacked",
|
|
1360
|
+
children: a.map((b, p) => /* @__PURE__ */ t(
|
|
1361
|
+
"span",
|
|
1362
|
+
{
|
|
1363
|
+
className: "tcl-fillbar__seg",
|
|
1364
|
+
style: L(
|
|
1365
|
+
{ "--seg": R(b.tone ?? s) },
|
|
1366
|
+
{ width: `${Z(b.value, 0, l)}%` }
|
|
1367
|
+
),
|
|
1368
|
+
children: b.label
|
|
1369
|
+
},
|
|
1370
|
+
p
|
|
1371
|
+
))
|
|
1372
|
+
}
|
|
1373
|
+
);
|
|
1374
|
+
}
|
|
1375
|
+
if (c === "threshold") {
|
|
1376
|
+
const m = [...i].sort((p, f) => p.value - f.value);
|
|
1377
|
+
let b = s;
|
|
1378
|
+
for (const p of m) e >= p.value && (b = p.tone ?? b);
|
|
1379
|
+
return /* @__PURE__ */ u(
|
|
1380
|
+
xe,
|
|
1381
|
+
{
|
|
1382
|
+
role: "meter",
|
|
1383
|
+
value: e,
|
|
1384
|
+
min: n,
|
|
1385
|
+
max: l,
|
|
1386
|
+
ariaLabel: _,
|
|
1387
|
+
showValue: g ?? !0,
|
|
1388
|
+
icon: r,
|
|
1389
|
+
size: h,
|
|
1390
|
+
glow: d,
|
|
1391
|
+
tone: b,
|
|
1392
|
+
className: o,
|
|
1393
|
+
trackClassName: "tcl-fillbar--threshold",
|
|
1394
|
+
children: [
|
|
1395
|
+
/* @__PURE__ */ t("span", { className: "tcl-fillbar__fill" }),
|
|
1396
|
+
m.map((p, f) => /* @__PURE__ */ t(
|
|
1397
|
+
"span",
|
|
1398
|
+
{
|
|
1399
|
+
className: "tcl-fillbar__marker",
|
|
1400
|
+
"aria-hidden": "true",
|
|
1401
|
+
style: L(
|
|
1402
|
+
{ "--mk": R(p.tone ?? "neutral") },
|
|
1403
|
+
{ left: `${Z(p.value, n, l)}%` }
|
|
1404
|
+
)
|
|
1405
|
+
},
|
|
1406
|
+
f
|
|
1407
|
+
))
|
|
1408
|
+
]
|
|
1409
|
+
}
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1412
|
+
return /* @__PURE__ */ t(
|
|
1413
|
+
xe,
|
|
1414
|
+
{
|
|
1415
|
+
role: "meter",
|
|
1416
|
+
value: e,
|
|
1417
|
+
min: n,
|
|
1418
|
+
max: l,
|
|
1419
|
+
ariaLabel: _,
|
|
1420
|
+
showValue: g ?? !0,
|
|
1421
|
+
icon: r,
|
|
1422
|
+
size: h,
|
|
1423
|
+
glow: d,
|
|
1424
|
+
tone: s,
|
|
1425
|
+
className: o,
|
|
1426
|
+
children: /* @__PURE__ */ t("span", { className: "tcl-fillbar__fill" })
|
|
1427
|
+
}
|
|
1428
|
+
);
|
|
1429
|
+
}
|
|
1430
|
+
function gn({
|
|
1431
|
+
values: e,
|
|
1432
|
+
tone: n = "accent",
|
|
1433
|
+
color: l,
|
|
1434
|
+
width: s = 100,
|
|
1435
|
+
height: c = 30,
|
|
1436
|
+
area: a = !0,
|
|
1437
|
+
markLast: i = !0,
|
|
1438
|
+
min: h,
|
|
1439
|
+
max: d,
|
|
1440
|
+
label: g,
|
|
1441
|
+
className: r
|
|
1442
|
+
}) {
|
|
1443
|
+
const _ = s, o = c, m = 2, b = [];
|
|
1444
|
+
e.forEach((T, W) => {
|
|
1445
|
+
T != null && Number.isFinite(T) && b.push({ i: W, v: T });
|
|
1446
|
+
});
|
|
1447
|
+
const p = b.map((T) => T.v);
|
|
1448
|
+
let f = p.length ? Math.min(...p) : 0, x = p.length ? Math.max(...p) : 1;
|
|
1449
|
+
if (f === x) {
|
|
1450
|
+
const T = Math.abs(f) * 0.1 + 1;
|
|
1451
|
+
f -= T, x += T;
|
|
1452
|
+
}
|
|
1453
|
+
const v = (x - f) * 0.15, $ = h ?? f - v;
|
|
1454
|
+
let y = d ?? x + v;
|
|
1455
|
+
y <= $ && (y = $ + (Math.abs($) * 0.1 + 1));
|
|
1456
|
+
const w = y - $, N = e.length, C = (T) => N <= 1 ? _ / 2 : m + T / (N - 1) * (_ - 2 * m), I = (T) => m + (1 - (T - $) / w) * (o - 2 * m), D = l ?? R(n), O = g ? { role: "img", "aria-label": g } : { "aria-hidden": !0 };
|
|
1457
|
+
if (!b.length)
|
|
1458
|
+
return /* @__PURE__ */ t(
|
|
1459
|
+
"svg",
|
|
1460
|
+
{
|
|
1461
|
+
className: k("tcl-sparkline", r),
|
|
1462
|
+
width: _,
|
|
1463
|
+
height: o,
|
|
1464
|
+
viewBox: `0 0 ${_} ${o}`,
|
|
1465
|
+
...O
|
|
1466
|
+
}
|
|
1467
|
+
);
|
|
1468
|
+
const E = b.map((T) => `${C(T.i).toFixed(2)},${I(T.v).toFixed(2)}`).join(" "), F = b[0], M = b[b.length - 1], S = `${E} ${C(M.i).toFixed(2)},${o} ${C(F.i).toFixed(2)},${o}`;
|
|
1469
|
+
return /* @__PURE__ */ u(
|
|
1470
|
+
"svg",
|
|
1471
|
+
{
|
|
1472
|
+
className: k("tcl-sparkline", r),
|
|
1473
|
+
width: _,
|
|
1474
|
+
height: o,
|
|
1475
|
+
viewBox: `0 0 ${_} ${o}`,
|
|
1476
|
+
preserveAspectRatio: "none",
|
|
1477
|
+
style: L({ "--spark-color": D }),
|
|
1478
|
+
...O,
|
|
1479
|
+
children: [
|
|
1480
|
+
g && /* @__PURE__ */ t("title", { children: g }),
|
|
1481
|
+
a && b.length > 1 && /* @__PURE__ */ t("polygon", { className: "tcl-sparkline__area", points: S }),
|
|
1482
|
+
b.length > 1 && /* @__PURE__ */ t(
|
|
1483
|
+
"polyline",
|
|
1484
|
+
{
|
|
1485
|
+
className: "tcl-sparkline__line",
|
|
1486
|
+
points: E,
|
|
1487
|
+
vectorEffect: "non-scaling-stroke"
|
|
1488
|
+
}
|
|
1489
|
+
),
|
|
1490
|
+
i && /* @__PURE__ */ t(
|
|
1491
|
+
"circle",
|
|
1492
|
+
{
|
|
1493
|
+
className: "tcl-sparkline__dot",
|
|
1494
|
+
cx: C(M.i).toFixed(2),
|
|
1495
|
+
cy: I(M.v).toFixed(2),
|
|
1496
|
+
r: 2,
|
|
1497
|
+
vectorEffect: "non-scaling-stroke"
|
|
1498
|
+
}
|
|
1499
|
+
)
|
|
1500
|
+
]
|
|
1501
|
+
}
|
|
1502
|
+
);
|
|
1503
|
+
}
|
|
1504
|
+
function Nn({ delta: e }) {
|
|
1505
|
+
const { value: n, text: l, invert: s = !1 } = e, c = n > 0 ? "up" : n < 0 ? "down" : "flat", a = c === "flat" ? "flat" : (c === "up" ? !s : s) ? "good" : "bad", i = c === "up" ? "▲" : c === "down" ? "▼" : "→", h = l ?? `${n > 0 ? "+" : ""}${n}`, d = h.replace(/^\+/, ""), g = c === "flat" ? `no change, ${d}` : `${c} by ${d}`;
|
|
1506
|
+
return /* @__PURE__ */ u("span", { className: k("tcl-stat__delta", `tcl-stat__delta--${a}`), "aria-label": g, children: [
|
|
1507
|
+
/* @__PURE__ */ t("span", { className: "tcl-stat__delta-arrow", "aria-hidden": "true", children: i }),
|
|
1508
|
+
h
|
|
1509
|
+
] });
|
|
1510
|
+
}
|
|
1511
|
+
function Ul({
|
|
1512
|
+
label: e,
|
|
1513
|
+
value: n = "—",
|
|
1514
|
+
unit: l,
|
|
1515
|
+
strap: s,
|
|
1516
|
+
delta: c,
|
|
1517
|
+
target: a,
|
|
1518
|
+
trend: i,
|
|
1519
|
+
badge: h,
|
|
1520
|
+
tone: d = "accent",
|
|
1521
|
+
onSelect: g,
|
|
1522
|
+
href: r,
|
|
1523
|
+
className: _
|
|
1524
|
+
}) {
|
|
1525
|
+
const o = r != null || g != null, m = k(
|
|
1526
|
+
"tcl-stat",
|
|
1527
|
+
`tcl-stat--${d}`,
|
|
1528
|
+
o && "tcl-stat--interactive",
|
|
1529
|
+
_
|
|
1530
|
+
), b = /* @__PURE__ */ u(K, { children: [
|
|
1531
|
+
/* @__PURE__ */ u("span", { className: "tcl-stat__head", children: [
|
|
1532
|
+
/* @__PURE__ */ u("span", { className: "tcl-stat__heading", children: [
|
|
1533
|
+
s && /* @__PURE__ */ t("span", { className: "tcl-stat__strap", children: s }),
|
|
1534
|
+
/* @__PURE__ */ t("span", { className: "tcl-stat__label", children: e })
|
|
1535
|
+
] }),
|
|
1536
|
+
h && /* @__PURE__ */ t("span", { className: "tcl-stat__badge", children: h })
|
|
1537
|
+
] }),
|
|
1538
|
+
/* @__PURE__ */ u("span", { className: "tcl-stat__body", children: [
|
|
1539
|
+
/* @__PURE__ */ u("span", { className: "tcl-stat__value", children: [
|
|
1540
|
+
n,
|
|
1541
|
+
l && /* @__PURE__ */ t("span", { className: "tcl-stat__unit", children: l })
|
|
1542
|
+
] }),
|
|
1543
|
+
c && /* @__PURE__ */ t(Nn, { delta: c }),
|
|
1544
|
+
a && /* @__PURE__ */ t("span", { className: "tcl-stat__target", children: a }),
|
|
1545
|
+
i && i.length > 0 && /* @__PURE__ */ t(gn, { values: i, tone: d, className: "tcl-stat__spark" })
|
|
1546
|
+
] })
|
|
1547
|
+
] });
|
|
1548
|
+
return r != null ? /* @__PURE__ */ t("a", { className: m, href: r, children: b }) : g != null ? /* @__PURE__ */ t("button", { type: "button", className: m, onClick: g, children: b }) : /* @__PURE__ */ t("div", { className: m, children: b });
|
|
1549
|
+
}
|
|
1550
|
+
const Et = ue(null);
|
|
1551
|
+
function Ie(e) {
|
|
1552
|
+
const n = he(Et);
|
|
1553
|
+
if (!n) throw new Error(`<Table.${e}> must be used within <Table>.`);
|
|
1554
|
+
return n;
|
|
1555
|
+
}
|
|
1556
|
+
const Se = ue("body");
|
|
1557
|
+
function yn({
|
|
1558
|
+
density: e = "comfortable",
|
|
1559
|
+
striped: n = !1,
|
|
1560
|
+
sticky: l = !1,
|
|
1561
|
+
maxHeight: s,
|
|
1562
|
+
sortDescriptor: c = null,
|
|
1563
|
+
onSortChange: a,
|
|
1564
|
+
selectionMode: i = "none",
|
|
1565
|
+
selectedKeys: h,
|
|
1566
|
+
defaultSelectedKeys: d,
|
|
1567
|
+
onSelectionChange: g,
|
|
1568
|
+
className: r,
|
|
1569
|
+
style: _,
|
|
1570
|
+
children: o,
|
|
1571
|
+
...m
|
|
1572
|
+
}) {
|
|
1573
|
+
const b = h !== void 0, [p, f] = A(() => new Set(d ?? [])), x = b ? new Set(h) : p, [v, $] = A(() => /* @__PURE__ */ new Set()), y = j((E) => {
|
|
1574
|
+
$((F) => F.has(E) ? F : new Set(F).add(E));
|
|
1575
|
+
}, []), w = j((E) => {
|
|
1576
|
+
$((F) => {
|
|
1577
|
+
if (!F.has(E)) return F;
|
|
1578
|
+
const M = new Set(F);
|
|
1579
|
+
return M.delete(E), M;
|
|
1580
|
+
});
|
|
1581
|
+
}, []), N = (E) => {
|
|
1582
|
+
b || f(E), g?.(E);
|
|
1583
|
+
};
|
|
1584
|
+
let C = 0;
|
|
1585
|
+
v.forEach((E) => {
|
|
1586
|
+
x.has(E) && (C += 1);
|
|
1587
|
+
});
|
|
1588
|
+
const I = v.size > 0 && C === v.size, D = C > 0 && !I, O = {
|
|
1589
|
+
density: e,
|
|
1590
|
+
sortDescriptor: c,
|
|
1591
|
+
onSortChange: a,
|
|
1592
|
+
selectionMode: i,
|
|
1593
|
+
isSelected: (E) => x.has(E),
|
|
1594
|
+
toggleRow: (E) => {
|
|
1595
|
+
const F = new Set(x);
|
|
1596
|
+
F.has(E) ? F.delete(E) : F.add(E), N(F);
|
|
1597
|
+
},
|
|
1598
|
+
registerRow: y,
|
|
1599
|
+
unregisterRow: w,
|
|
1600
|
+
allSelected: I,
|
|
1601
|
+
someSelected: D,
|
|
1602
|
+
toggleAll: () => {
|
|
1603
|
+
const E = new Set(x);
|
|
1604
|
+
I ? v.forEach((F) => E.delete(F)) : v.forEach((F) => E.add(F)), N(E);
|
|
1605
|
+
}
|
|
1606
|
+
};
|
|
1607
|
+
return /* @__PURE__ */ t(Et.Provider, { value: O, children: /* @__PURE__ */ t(
|
|
1608
|
+
"div",
|
|
1609
|
+
{
|
|
1610
|
+
className: "tcl-table-scroll",
|
|
1611
|
+
style: s != null ? { maxHeight: s } : void 0,
|
|
1612
|
+
children: /* @__PURE__ */ t(
|
|
1613
|
+
"table",
|
|
1614
|
+
{
|
|
1615
|
+
className: k(
|
|
1616
|
+
"tcl-table",
|
|
1617
|
+
e === "compact" && "tcl-table--compact",
|
|
1618
|
+
n && "tcl-table--striped",
|
|
1619
|
+
l && "tcl-table--sticky",
|
|
1620
|
+
r
|
|
1621
|
+
),
|
|
1622
|
+
style: _,
|
|
1623
|
+
...m,
|
|
1624
|
+
children: o
|
|
1625
|
+
}
|
|
1626
|
+
)
|
|
1627
|
+
}
|
|
1628
|
+
) });
|
|
1629
|
+
}
|
|
1630
|
+
function xn({ className: e, children: n, ...l }) {
|
|
1631
|
+
return /* @__PURE__ */ t("caption", { className: k("tcl-table__caption", e), ...l, children: n });
|
|
1632
|
+
}
|
|
1633
|
+
function $n({ className: e, children: n, ...l }) {
|
|
1634
|
+
return /* @__PURE__ */ t(Se.Provider, { value: "head", children: /* @__PURE__ */ t("thead", { className: k("tcl-table__head", e), ...l, children: n }) });
|
|
1635
|
+
}
|
|
1636
|
+
function wn({ className: e, children: n, ...l }) {
|
|
1637
|
+
return /* @__PURE__ */ t(Se.Provider, { value: "body", children: /* @__PURE__ */ t("tbody", { className: k("tcl-table__body", e), ...l, children: n }) });
|
|
1638
|
+
}
|
|
1639
|
+
function kn({ className: e, children: n, ...l }) {
|
|
1640
|
+
return /* @__PURE__ */ t(Se.Provider, { value: "foot", children: /* @__PURE__ */ t("tfoot", { className: k("tcl-table__foot", e), ...l, children: n }) });
|
|
1641
|
+
}
|
|
1642
|
+
function Cn() {
|
|
1643
|
+
const { allSelected: e, someSelected: n, toggleAll: l } = Ie("Row");
|
|
1644
|
+
return /* @__PURE__ */ t("th", { scope: "col", className: "tcl-table__th tcl-table__select", children: /* @__PURE__ */ t(
|
|
1645
|
+
It,
|
|
1646
|
+
{
|
|
1647
|
+
"aria-label": "Select all rows",
|
|
1648
|
+
checked: e,
|
|
1649
|
+
indeterminate: n,
|
|
1650
|
+
onChange: l
|
|
1651
|
+
}
|
|
1652
|
+
) });
|
|
1653
|
+
}
|
|
1654
|
+
function Mn({ rowKey: e, href: n, onClick: l, className: s, children: c, ...a }) {
|
|
1655
|
+
const { selectionMode: i, isSelected: h, toggleRow: d, registerRow: g, unregisterRow: r } = Ie("Row"), _ = he(Se), o = i !== "none", m = _ === "body";
|
|
1656
|
+
H(() => {
|
|
1657
|
+
if (!(!o || !m || e == null))
|
|
1658
|
+
return g(e), () => r(e);
|
|
1659
|
+
}, [o, m, e, g, r]);
|
|
1660
|
+
const b = o && m && e != null ? h(e) : !1, p = m && (n != null || l != null);
|
|
1661
|
+
let f = c;
|
|
1662
|
+
if (p) {
|
|
1663
|
+
const v = { href: n, onClick: l };
|
|
1664
|
+
let $ = !1;
|
|
1665
|
+
f = Nt.map(c, (y) => !$ && gt(y) ? ($ = !0, yt(y, { _primaryLink: v })) : y);
|
|
1666
|
+
}
|
|
1667
|
+
let x = null;
|
|
1668
|
+
return o && (_ === "head" ? x = /* @__PURE__ */ t(Cn, {}) : m && e != null ? x = /* @__PURE__ */ t("td", { className: "tcl-table__td tcl-table__select", children: /* @__PURE__ */ t(It, { "aria-label": "Select row", checked: b, onChange: () => d(e) }) }) : x = /* @__PURE__ */ t("td", { className: "tcl-table__td tcl-table__select", "aria-hidden": "true" })), /* @__PURE__ */ u(
|
|
1669
|
+
"tr",
|
|
1670
|
+
{
|
|
1671
|
+
className: k("tcl-table__row", p && "tcl-table__row--interactive", s),
|
|
1672
|
+
"data-selected": b || void 0,
|
|
1673
|
+
...a,
|
|
1674
|
+
children: [
|
|
1675
|
+
x,
|
|
1676
|
+
f
|
|
1677
|
+
]
|
|
1678
|
+
}
|
|
1679
|
+
);
|
|
1680
|
+
}
|
|
1681
|
+
function In({
|
|
1682
|
+
align: e = "start",
|
|
1683
|
+
sortKey: n,
|
|
1684
|
+
className: l,
|
|
1685
|
+
children: s,
|
|
1686
|
+
...c
|
|
1687
|
+
}) {
|
|
1688
|
+
const { sortDescriptor: a, onSortChange: i } = Ie("HeaderCell"), h = n != null, d = h && a?.column === n, g = d ? a.direction : void 0, r = h ? d ? g === "asc" ? "ascending" : "descending" : "none" : void 0, _ = () => {
|
|
1689
|
+
if (!h) return;
|
|
1690
|
+
i?.({ column: n, direction: d && g === "asc" ? "desc" : "asc" });
|
|
1691
|
+
};
|
|
1692
|
+
return /* @__PURE__ */ t(
|
|
1693
|
+
"th",
|
|
1694
|
+
{
|
|
1695
|
+
scope: "col",
|
|
1696
|
+
"aria-sort": r,
|
|
1697
|
+
className: k("tcl-table__th", e !== "start" && `tcl-table__cell--${e}`, l),
|
|
1698
|
+
...c,
|
|
1699
|
+
children: h ? /* @__PURE__ */ u(
|
|
1700
|
+
"button",
|
|
1701
|
+
{
|
|
1702
|
+
type: "button",
|
|
1703
|
+
className: "tcl-table__sort",
|
|
1704
|
+
"data-active": d || void 0,
|
|
1705
|
+
onClick: _,
|
|
1706
|
+
children: [
|
|
1707
|
+
/* @__PURE__ */ t("span", { children: s }),
|
|
1708
|
+
/* @__PURE__ */ t(
|
|
1709
|
+
"span",
|
|
1710
|
+
{
|
|
1711
|
+
className: "tcl-table__sort-icon",
|
|
1712
|
+
"aria-hidden": "true",
|
|
1713
|
+
"data-direction": g ?? "none",
|
|
1714
|
+
children: /* @__PURE__ */ t("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ t(
|
|
1715
|
+
"path",
|
|
1716
|
+
{
|
|
1717
|
+
d: "M3 4.5 L6 7.5 L9 4.5",
|
|
1718
|
+
stroke: "currentColor",
|
|
1719
|
+
strokeWidth: "1.5",
|
|
1720
|
+
strokeLinecap: "round",
|
|
1721
|
+
strokeLinejoin: "round"
|
|
1722
|
+
}
|
|
1723
|
+
) })
|
|
1724
|
+
}
|
|
1725
|
+
)
|
|
1726
|
+
]
|
|
1727
|
+
}
|
|
1728
|
+
) : s
|
|
1729
|
+
}
|
|
1730
|
+
);
|
|
1731
|
+
}
|
|
1732
|
+
function Sn({
|
|
1733
|
+
align: e,
|
|
1734
|
+
numeric: n = !1,
|
|
1735
|
+
className: l,
|
|
1736
|
+
children: s,
|
|
1737
|
+
_primaryLink: c,
|
|
1738
|
+
...a
|
|
1739
|
+
}) {
|
|
1740
|
+
const i = e ?? (n ? "end" : "start");
|
|
1741
|
+
let h = s;
|
|
1742
|
+
return c && (h = c.href != null ? /* @__PURE__ */ t("a", { className: "tcl-table__rowlink", href: c.href, children: s }) : /* @__PURE__ */ t("button", { type: "button", className: "tcl-table__rowlink", onClick: c.onClick, children: s })), /* @__PURE__ */ t(
|
|
1743
|
+
"td",
|
|
1744
|
+
{
|
|
1745
|
+
className: k(
|
|
1746
|
+
"tcl-table__td",
|
|
1747
|
+
i !== "start" && `tcl-table__cell--${i}`,
|
|
1748
|
+
n && "tcl-table__cell--numeric",
|
|
1749
|
+
l
|
|
1750
|
+
),
|
|
1751
|
+
...a,
|
|
1752
|
+
children: h
|
|
1753
|
+
}
|
|
1754
|
+
);
|
|
1755
|
+
}
|
|
1756
|
+
function Tn({ colSpan: e, className: n, children: l, ...s }) {
|
|
1757
|
+
const { selectionMode: c } = Ie("Empty"), a = e + (c !== "none" ? 1 : 0);
|
|
1758
|
+
return /* @__PURE__ */ t("tr", { className: "tcl-table__row", children: /* @__PURE__ */ t("td", { colSpan: a, className: k("tcl-table__td tcl-table__empty", n), ...s, children: l }) });
|
|
1759
|
+
}
|
|
1760
|
+
const P = Object.assign(yn, {
|
|
1761
|
+
Caption: xn,
|
|
1762
|
+
Head: $n,
|
|
1763
|
+
Body: wn,
|
|
1764
|
+
Foot: kn,
|
|
1765
|
+
Row: Mn,
|
|
1766
|
+
HeaderCell: In,
|
|
1767
|
+
Cell: Sn,
|
|
1768
|
+
Empty: Tn
|
|
1769
|
+
}), En = {
|
|
1770
|
+
hub: "center",
|
|
1771
|
+
center: "center",
|
|
1772
|
+
robot: "n",
|
|
1773
|
+
n: "n",
|
|
1774
|
+
top: "n",
|
|
1775
|
+
north: "n",
|
|
1776
|
+
blood: "ne",
|
|
1777
|
+
ne: "ne",
|
|
1778
|
+
decay: "se",
|
|
1779
|
+
se: "se",
|
|
1780
|
+
spirit: "s",
|
|
1781
|
+
s: "s",
|
|
1782
|
+
bottom: "s",
|
|
1783
|
+
south: "s",
|
|
1784
|
+
fate: "sw",
|
|
1785
|
+
sw: "sw",
|
|
1786
|
+
shared: "nw",
|
|
1787
|
+
nw: "nw"
|
|
1788
|
+
}, Ln = ["n", "ne", "se", "s", "sw", "nw"];
|
|
1789
|
+
function Rn(e) {
|
|
1790
|
+
const n = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
|
|
1791
|
+
for (const c of e) {
|
|
1792
|
+
const a = c.pos ? En[c.pos.toLowerCase()] : c.kind === "center" ? "center" : void 0;
|
|
1793
|
+
a && !n.has(a) && (l.set(c.id, a), n.add(a));
|
|
1794
|
+
}
|
|
1795
|
+
const s = Ln.filter((c) => !n.has(c));
|
|
1796
|
+
for (const c of e) {
|
|
1797
|
+
if (l.has(c.id)) continue;
|
|
1798
|
+
if (c.kind === "center" && !n.has("center")) {
|
|
1799
|
+
l.set(c.id, "center"), n.add("center");
|
|
1800
|
+
continue;
|
|
1801
|
+
}
|
|
1802
|
+
const a = s.shift();
|
|
1803
|
+
a && (l.set(c.id, a), n.add(a));
|
|
1804
|
+
}
|
|
1805
|
+
return l;
|
|
1806
|
+
}
|
|
1807
|
+
function An(e, n, l) {
|
|
1808
|
+
switch (e) {
|
|
1809
|
+
case "n":
|
|
1810
|
+
return { x: 0, y: -l };
|
|
1811
|
+
case "s":
|
|
1812
|
+
return { x: 0, y: l };
|
|
1813
|
+
case "ne":
|
|
1814
|
+
return { x: 0.75 * n, y: -l / 2 };
|
|
1815
|
+
case "se":
|
|
1816
|
+
return { x: 0.75 * n, y: l / 2 };
|
|
1817
|
+
case "nw":
|
|
1818
|
+
return { x: -0.75 * n, y: -l / 2 };
|
|
1819
|
+
case "sw":
|
|
1820
|
+
return { x: -0.75 * n, y: l / 2 };
|
|
1821
|
+
default:
|
|
1822
|
+
return { x: 0, y: 0 };
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
function Gl({
|
|
1826
|
+
data: e,
|
|
1827
|
+
selectedId: n,
|
|
1828
|
+
defaultSelectedId: l,
|
|
1829
|
+
onSelect: s,
|
|
1830
|
+
size: c = 200,
|
|
1831
|
+
className: a
|
|
1832
|
+
}) {
|
|
1833
|
+
const [i, h] = A(l), d = n ?? i, g = (v) => {
|
|
1834
|
+
n === void 0 && h(v), s?.(v);
|
|
1835
|
+
}, r = c, _ = Math.round(c * 0.866), o = 2.5 * r, m = 3 * _, b = 1.25 * r, p = 1.5 * _, f = B(() => Rn(e.domains), [e.domains]), x = e.domains.find((v) => v.id === d);
|
|
1836
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-hub", a), children: [
|
|
1837
|
+
/* @__PURE__ */ u("header", { className: "tcl-hub__header", children: [
|
|
1838
|
+
e.brand && /* @__PURE__ */ t("p", { className: "tcl-hub__brand", children: e.brand }),
|
|
1839
|
+
e.code && /* @__PURE__ */ t("p", { className: "tcl-hub__code", children: e.code }),
|
|
1840
|
+
(e.tagline || e.taglineNote) && /* @__PURE__ */ u("div", { className: "tcl-hub__tagrow", children: [
|
|
1841
|
+
e.tagline && /* @__PURE__ */ t(
|
|
1842
|
+
"span",
|
|
1843
|
+
{
|
|
1844
|
+
className: "tcl-hub__pill",
|
|
1845
|
+
style: e.tone ? { borderColor: e.tone, color: e.tone } : void 0,
|
|
1846
|
+
children: e.tagline
|
|
1847
|
+
}
|
|
1848
|
+
),
|
|
1849
|
+
e.taglineNote && /* @__PURE__ */ t("span", { className: "tcl-hub__tagnote", children: e.taglineNote })
|
|
1850
|
+
] }),
|
|
1851
|
+
e.sub && /* @__PURE__ */ t("p", { className: "tcl-hub__sub", children: e.sub }),
|
|
1852
|
+
e.stats && e.stats.length > 0 && /* @__PURE__ */ t("div", { className: "tcl-hub__stats", children: e.stats.map((v, $) => /* @__PURE__ */ u("div", { className: "tcl-hub__stat", children: [
|
|
1853
|
+
/* @__PURE__ */ t("span", { className: "tcl-hub__stat-value", style: v.color ? { color: v.color } : void 0, children: v.value }),
|
|
1854
|
+
/* @__PURE__ */ t("span", { className: "tcl-hub__stat-label", children: v.label })
|
|
1855
|
+
] }, $)) })
|
|
1856
|
+
] }),
|
|
1857
|
+
/* @__PURE__ */ t(
|
|
1858
|
+
"div",
|
|
1859
|
+
{
|
|
1860
|
+
className: "tcl-hub__flower",
|
|
1861
|
+
role: "group",
|
|
1862
|
+
"aria-label": e.tagline ?? e.brand ?? "Domain map",
|
|
1863
|
+
style: { width: o, height: m },
|
|
1864
|
+
children: e.domains.map((v) => {
|
|
1865
|
+
const $ = f.get(v.id);
|
|
1866
|
+
if (!$) return null;
|
|
1867
|
+
const { x: y, y: w } = An($, r, _), N = v.id === d;
|
|
1868
|
+
return /* @__PURE__ */ u(
|
|
1869
|
+
"button",
|
|
1870
|
+
{
|
|
1871
|
+
type: "button",
|
|
1872
|
+
className: k("tcl-hub__tile", `tcl-hub__tile--${v.kind}`, N && "is-selected"),
|
|
1873
|
+
style: { left: b + y - r / 2, top: p + w - _ / 2, width: r, height: _ },
|
|
1874
|
+
"aria-pressed": N,
|
|
1875
|
+
"aria-label": `${v.name}, ${v.tag}, ${v.status}`,
|
|
1876
|
+
onClick: () => g(v.id),
|
|
1877
|
+
children: [
|
|
1878
|
+
/* @__PURE__ */ t("span", { className: "tcl-hub__dot", style: v.dot ? { color: v.dot } : void 0, "aria-hidden": "true" }),
|
|
1879
|
+
/* @__PURE__ */ t("span", { className: "tcl-hub__tag", children: v.tag }),
|
|
1880
|
+
/* @__PURE__ */ t("span", { className: "tcl-hub__name", children: v.name }),
|
|
1881
|
+
/* @__PURE__ */ t("span", { className: "tcl-hub__tile-sub", children: v.sub }),
|
|
1882
|
+
/* @__PURE__ */ t("span", { className: "tcl-hub__status", children: v.status })
|
|
1883
|
+
]
|
|
1884
|
+
},
|
|
1885
|
+
v.id
|
|
1886
|
+
);
|
|
1887
|
+
})
|
|
1888
|
+
}
|
|
1889
|
+
),
|
|
1890
|
+
/* @__PURE__ */ t("div", { className: "tcl-hub__inspector", "aria-live": "polite", children: x ? /* @__PURE__ */ u(K, { children: [
|
|
1891
|
+
/* @__PURE__ */ u("p", { className: "tcl-hub__inspector-title", children: [
|
|
1892
|
+
x.name,
|
|
1893
|
+
/* @__PURE__ */ u("span", { className: "tcl-hub__inspector-status", children: [
|
|
1894
|
+
" · ",
|
|
1895
|
+
x.status
|
|
1896
|
+
] })
|
|
1897
|
+
] }),
|
|
1898
|
+
x.note && /* @__PURE__ */ t("p", { className: "tcl-hub__inspector-note", children: x.note }),
|
|
1899
|
+
x.sources && x.sources.length > 0 && /* @__PURE__ */ t("ul", { className: "tcl-hub__sources", children: x.sources.map((v, $) => /* @__PURE__ */ t("li", { children: typeof v == "string" ? v : v.label }, $)) })
|
|
1900
|
+
] }) : /* @__PURE__ */ t("p", { className: "tcl-hub__inspector-hint", children: "Select a domain to inspect its detail." }) }),
|
|
1901
|
+
e.axis && /* @__PURE__ */ t("p", { className: "tcl-hub__axis", children: e.axis })
|
|
1902
|
+
] });
|
|
1903
|
+
}
|
|
1904
|
+
const Dn = {
|
|
1905
|
+
claude: "Claude",
|
|
1906
|
+
agents: "Agents",
|
|
1907
|
+
plan: "Plan",
|
|
1908
|
+
spec: "Spec"
|
|
1909
|
+
}, Ve = {
|
|
1910
|
+
prose: "Notes",
|
|
1911
|
+
rules: "Rules",
|
|
1912
|
+
commands: "Commands",
|
|
1913
|
+
checklist: "Checklist",
|
|
1914
|
+
phases: "Phases",
|
|
1915
|
+
artifacts: "Artifacts",
|
|
1916
|
+
boundaries: "Boundaries",
|
|
1917
|
+
decisions: "Decisions",
|
|
1918
|
+
reference: "Reference"
|
|
1919
|
+
};
|
|
1920
|
+
function Fn(e) {
|
|
1921
|
+
return typeof e == "string" ? { text: e } : e;
|
|
1922
|
+
}
|
|
1923
|
+
function Bn(e) {
|
|
1924
|
+
return e && e in Ve ? e : "prose";
|
|
1925
|
+
}
|
|
1926
|
+
function On(e) {
|
|
1927
|
+
return /^https?:\/\//.test(e);
|
|
1928
|
+
}
|
|
1929
|
+
function Pn({ value: e }) {
|
|
1930
|
+
return On(e) ? /* @__PURE__ */ t("a", { className: "tcl-brief__chip", href: e, rel: "noreferrer", children: e }) : /* @__PURE__ */ t("code", { className: "tcl-brief__chip", children: e });
|
|
1931
|
+
}
|
|
1932
|
+
function fe({ text: e }) {
|
|
1933
|
+
return /* @__PURE__ */ u("span", { className: "tcl-brief__desc", children: [
|
|
1934
|
+
" — ",
|
|
1935
|
+
e
|
|
1936
|
+
] });
|
|
1937
|
+
}
|
|
1938
|
+
function jn({ kind: e, section: n }) {
|
|
1939
|
+
const l = (n.items ?? []).map(Fn);
|
|
1940
|
+
if (e === "prose") {
|
|
1941
|
+
const s = n.body ? n.body.split(/\n{2,}/) : l.map((c) => c.text);
|
|
1942
|
+
return /* @__PURE__ */ t(K, { children: s.map((c, a) => /* @__PURE__ */ t("p", { className: "tcl-brief__prose", children: c }, a)) });
|
|
1943
|
+
}
|
|
1944
|
+
return e === "rules" ? /* @__PURE__ */ t("ol", { className: "tcl-brief__rules", children: l.map((s, c) => /* @__PURE__ */ u("li", { className: "tcl-brief__rule", children: [
|
|
1945
|
+
/* @__PURE__ */ t("span", { className: "tcl-brief__rule-text", children: s.text }),
|
|
1946
|
+
s.desc && /* @__PURE__ */ t(fe, { text: s.desc })
|
|
1947
|
+
] }, c)) }) : e === "commands" ? /* @__PURE__ */ t("ul", { className: "tcl-brief__list", children: l.map((s, c) => /* @__PURE__ */ u("li", { className: "tcl-brief__command", children: [
|
|
1948
|
+
/* @__PURE__ */ t("code", { className: "tcl-brief__code", children: s.text }),
|
|
1949
|
+
s.desc && /* @__PURE__ */ t("span", { className: "tcl-brief__command-desc", children: s.desc })
|
|
1950
|
+
] }, c)) }) : e === "checklist" ? /* @__PURE__ */ t("ul", { className: "tcl-brief__list", children: l.map((s, c) => /* @__PURE__ */ u("li", { className: "tcl-brief__check", "data-severity": s.severity ?? "info", children: [
|
|
1951
|
+
/* @__PURE__ */ t("span", { className: "tcl-brief__check-glyph", "aria-hidden": "true" }),
|
|
1952
|
+
/* @__PURE__ */ u("span", { className: "tcl-brief__check-text", children: [
|
|
1953
|
+
s.text,
|
|
1954
|
+
s.desc && /* @__PURE__ */ t(fe, { text: s.desc })
|
|
1955
|
+
] })
|
|
1956
|
+
] }, c)) }) : e === "phases" ? /* @__PURE__ */ t("ol", { className: "tcl-brief__list tcl-brief__phases", children: l.map((s, c) => /* @__PURE__ */ u("li", { className: "tcl-brief__phase", "data-status": s.status ?? "pending", children: [
|
|
1957
|
+
/* @__PURE__ */ t("span", { className: "tcl-brief__phase-pip", "aria-hidden": "true" }),
|
|
1958
|
+
/* @__PURE__ */ u("span", { className: "tcl-brief__phase-text", children: [
|
|
1959
|
+
s.text,
|
|
1960
|
+
s.desc && /* @__PURE__ */ t(fe, { text: s.desc })
|
|
1961
|
+
] }),
|
|
1962
|
+
s.status && /* @__PURE__ */ t("span", { className: "tcl-brief__phase-status", children: s.status })
|
|
1963
|
+
] }, c)) }) : e === "decisions" ? /* @__PURE__ */ t("ul", { className: "tcl-brief__list", children: l.map((s, c) => /* @__PURE__ */ u("li", { className: "tcl-brief__decision", children: [
|
|
1964
|
+
/* @__PURE__ */ t("span", { className: "tcl-brief__decision-title", children: s.text }),
|
|
1965
|
+
s.choice && /* @__PURE__ */ u("span", { className: "tcl-brief__decision-choice", children: [
|
|
1966
|
+
/* @__PURE__ */ u("span", { className: "tcl-brief__arrow", "aria-hidden": "true", children: [
|
|
1967
|
+
"→",
|
|
1968
|
+
" "
|
|
1969
|
+
] }),
|
|
1970
|
+
s.choice
|
|
1971
|
+
] })
|
|
1972
|
+
] }, c)) }) : /* @__PURE__ */ t("ul", { className: "tcl-brief__list", children: l.map((s, c) => /* @__PURE__ */ u("li", { className: "tcl-brief__ref", children: [
|
|
1973
|
+
/* @__PURE__ */ u("span", { className: "tcl-brief__ref-main", children: [
|
|
1974
|
+
/* @__PURE__ */ t("span", { className: "tcl-brief__ref-text", children: s.text }),
|
|
1975
|
+
s.desc && /* @__PURE__ */ t(fe, { text: s.desc })
|
|
1976
|
+
] }),
|
|
1977
|
+
s.ref && /* @__PURE__ */ t(Pn, { value: s.ref }),
|
|
1978
|
+
s.status && /* @__PURE__ */ t("span", { className: "tcl-brief__status", children: s.status })
|
|
1979
|
+
] }, c)) });
|
|
1980
|
+
}
|
|
1981
|
+
function Zl({ data: e, defaultCollapsed: n, className: l }) {
|
|
1982
|
+
const s = z(), [c, a] = A(() => new Set(n)), i = (r) => a((_) => {
|
|
1983
|
+
const o = new Set(_);
|
|
1984
|
+
return o.has(r) ? o.delete(r) : o.add(r), o;
|
|
1985
|
+
}), h = e.kind ?? "spec", d = e.title ?? e.id ?? "Untitled", g = e.sections ?? [];
|
|
1986
|
+
return /* @__PURE__ */ u("article", { className: k("tcl-brief", l), "data-kind": h, "aria-label": d, children: [
|
|
1987
|
+
/* @__PURE__ */ u("header", { className: "tcl-brief__header", children: [
|
|
1988
|
+
/* @__PURE__ */ u("div", { className: "tcl-brief__kindrow", children: [
|
|
1989
|
+
/* @__PURE__ */ t("span", { className: "tcl-brief__kind", children: Dn[h] ?? h }),
|
|
1990
|
+
e.id && /* @__PURE__ */ t("span", { className: "tcl-brief__id", children: e.id })
|
|
1991
|
+
] }),
|
|
1992
|
+
/* @__PURE__ */ t("h2", { className: "tcl-brief__title", children: d }),
|
|
1993
|
+
e.summary && /* @__PURE__ */ t("p", { className: "tcl-brief__summary", children: e.summary }),
|
|
1994
|
+
e.meta && e.meta.length > 0 && /* @__PURE__ */ t("div", { className: "tcl-brief__meta", children: e.meta.map((r, _) => /* @__PURE__ */ u(
|
|
1995
|
+
"span",
|
|
1996
|
+
{
|
|
1997
|
+
className: "tcl-brief__metapill",
|
|
1998
|
+
style: r.tone ? { borderColor: r.tone, color: r.tone } : void 0,
|
|
1999
|
+
children: [
|
|
2000
|
+
/* @__PURE__ */ t("span", { className: "tcl-brief__metalabel", children: r.label }),
|
|
2001
|
+
/* @__PURE__ */ t("span", { className: "tcl-brief__metavalue", children: r.value })
|
|
2002
|
+
]
|
|
2003
|
+
},
|
|
2004
|
+
_
|
|
2005
|
+
)) })
|
|
2006
|
+
] }),
|
|
2007
|
+
/* @__PURE__ */ u("div", { className: "tcl-brief__sections", children: [
|
|
2008
|
+
g.length === 0 && /* @__PURE__ */ t("p", { className: "tcl-brief__empty", children: "No sections." }),
|
|
2009
|
+
g.map((r, _) => {
|
|
2010
|
+
const o = r.id ?? `s${_}`, m = Bn(r.kind), b = r.heading ?? Ve[m], p = !c.has(o), f = `${s}-${o}`;
|
|
2011
|
+
return /* @__PURE__ */ u(
|
|
2012
|
+
"section",
|
|
2013
|
+
{
|
|
2014
|
+
className: "tcl-brief__section",
|
|
2015
|
+
"data-kind": m,
|
|
2016
|
+
"data-state": p ? "open" : "collapsed",
|
|
2017
|
+
children: [
|
|
2018
|
+
/* @__PURE__ */ u("div", { className: "tcl-brief__section-head", children: [
|
|
2019
|
+
/* @__PURE__ */ t("h3", { className: "tcl-brief__section-h", children: /* @__PURE__ */ u(
|
|
2020
|
+
"button",
|
|
2021
|
+
{
|
|
2022
|
+
type: "button",
|
|
2023
|
+
className: "tcl-brief__toggle",
|
|
2024
|
+
"aria-expanded": p,
|
|
2025
|
+
"aria-controls": f,
|
|
2026
|
+
onClick: () => i(o),
|
|
2027
|
+
children: [
|
|
2028
|
+
/* @__PURE__ */ t("span", { className: "tcl-brief__chevron", "aria-hidden": "true" }),
|
|
2029
|
+
b
|
|
2030
|
+
]
|
|
2031
|
+
}
|
|
2032
|
+
) }),
|
|
2033
|
+
/* @__PURE__ */ t("span", { className: "tcl-brief__section-kind", children: Ve[m] ?? m })
|
|
2034
|
+
] }),
|
|
2035
|
+
/* @__PURE__ */ u("div", { id: f, className: "tcl-brief__section-body", hidden: !p, children: [
|
|
2036
|
+
r.note && /* @__PURE__ */ t("p", { className: "tcl-brief__note", children: r.note }),
|
|
2037
|
+
/* @__PURE__ */ t(jn, { kind: m, section: r })
|
|
2038
|
+
] })
|
|
2039
|
+
]
|
|
2040
|
+
},
|
|
2041
|
+
o
|
|
2042
|
+
);
|
|
2043
|
+
})
|
|
2044
|
+
] })
|
|
2045
|
+
] });
|
|
2046
|
+
}
|
|
2047
|
+
const Ee = ["claude", "agents", "plan", "spec"], Le = [
|
|
2048
|
+
"prose",
|
|
2049
|
+
"rules",
|
|
2050
|
+
"commands",
|
|
2051
|
+
"checklist",
|
|
2052
|
+
"phases",
|
|
2053
|
+
"artifacts",
|
|
2054
|
+
"boundaries",
|
|
2055
|
+
"decisions",
|
|
2056
|
+
"reference"
|
|
2057
|
+
], Re = ["info", "warn", "danger"];
|
|
2058
|
+
function Te(e) {
|
|
2059
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
2060
|
+
}
|
|
2061
|
+
function Hn(e, n) {
|
|
2062
|
+
const l = Array.from({ length: e.length + 1 }, () => new Array(n.length + 1).fill(0));
|
|
2063
|
+
for (let s = 0; s <= e.length; s++) l[s][0] = s;
|
|
2064
|
+
for (let s = 0; s <= n.length; s++) l[0][s] = s;
|
|
2065
|
+
for (let s = 1; s <= e.length; s++)
|
|
2066
|
+
for (let c = 1; c <= n.length; c++) {
|
|
2067
|
+
const a = e[s - 1] === n[c - 1] ? 0 : 1;
|
|
2068
|
+
l[s][c] = Math.min(l[s - 1][c] + 1, l[s][c - 1] + 1, l[s - 1][c - 1] + a);
|
|
2069
|
+
}
|
|
2070
|
+
return l[e.length][n.length];
|
|
2071
|
+
}
|
|
2072
|
+
function Je(e, n) {
|
|
2073
|
+
let l, s = 1 / 0;
|
|
2074
|
+
for (const c of n) {
|
|
2075
|
+
const a = Hn(e.toLowerCase(), c);
|
|
2076
|
+
a < s && (s = a, l = c);
|
|
2077
|
+
}
|
|
2078
|
+
return l !== void 0 && s <= Math.max(2, Math.floor(l.length / 3)) ? l : void 0;
|
|
2079
|
+
}
|
|
2080
|
+
function Wn(e, n, l) {
|
|
2081
|
+
if (typeof e == "string") return { text: e };
|
|
2082
|
+
if (!Te(e))
|
|
2083
|
+
return l.push({
|
|
2084
|
+
path: n,
|
|
2085
|
+
level: "warn",
|
|
2086
|
+
message: "item should be a string or object",
|
|
2087
|
+
got: e === null ? "null" : typeof e,
|
|
2088
|
+
expected: "string | object"
|
|
2089
|
+
}), { text: String(e) };
|
|
2090
|
+
const s = { text: "" };
|
|
2091
|
+
if (typeof e.text == "string" ? s.text = e.text : l.push({
|
|
2092
|
+
path: `${n}.text`,
|
|
2093
|
+
level: "warn",
|
|
2094
|
+
message: 'item missing "text"',
|
|
2095
|
+
expected: "string"
|
|
2096
|
+
}), typeof e.desc == "string" && (s.desc = e.desc), typeof e.status == "string" && (s.status = e.status), typeof e.ref == "string" && (s.ref = e.ref), typeof e.choice == "string" && (s.choice = e.choice), e.severity !== void 0)
|
|
2097
|
+
if (typeof e.severity == "string" && Re.includes(e.severity))
|
|
2098
|
+
s.severity = e.severity;
|
|
2099
|
+
else {
|
|
2100
|
+
const c = String(e.severity);
|
|
2101
|
+
l.push({
|
|
2102
|
+
path: `${n}.severity`,
|
|
2103
|
+
level: "info",
|
|
2104
|
+
message: `unknown severity "${c}"`,
|
|
2105
|
+
got: c,
|
|
2106
|
+
expected: Re.join(" | "),
|
|
2107
|
+
didYouMean: Je(c, Re)
|
|
2108
|
+
});
|
|
2109
|
+
}
|
|
2110
|
+
return s;
|
|
2111
|
+
}
|
|
2112
|
+
function Vn(e, n, l) {
|
|
2113
|
+
const s = `sections[${n}]`;
|
|
2114
|
+
if (!Te(e))
|
|
2115
|
+
return l.push({
|
|
2116
|
+
path: s,
|
|
2117
|
+
level: "error",
|
|
2118
|
+
message: "section must be an object",
|
|
2119
|
+
got: e === null ? "null" : typeof e,
|
|
2120
|
+
expected: "object"
|
|
2121
|
+
}), { heading: `Section ${n + 1}`, kind: "prose" };
|
|
2122
|
+
const c = {};
|
|
2123
|
+
if (typeof e.id == "string" && (c.id = e.id), typeof e.heading == "string" && e.heading.trim() ? c.heading = e.heading : l.push({
|
|
2124
|
+
path: `${s}.heading`,
|
|
2125
|
+
level: "warn",
|
|
2126
|
+
message: 'section missing "heading" (falls back to the kind label)',
|
|
2127
|
+
expected: "string"
|
|
2128
|
+
}), e.kind !== void 0) {
|
|
2129
|
+
const a = String(e.kind);
|
|
2130
|
+
typeof e.kind == "string" && Le.includes(e.kind) || l.push({
|
|
2131
|
+
path: `${s}.kind`,
|
|
2132
|
+
level: "info",
|
|
2133
|
+
message: `unknown section kind "${a}" (renders as prose)`,
|
|
2134
|
+
got: a,
|
|
2135
|
+
expected: Le.join(" | "),
|
|
2136
|
+
didYouMean: Je(a, Le)
|
|
2137
|
+
}), c.kind = e.kind;
|
|
2138
|
+
}
|
|
2139
|
+
return typeof e.note == "string" && (c.note = e.note), typeof e.body == "string" && (c.body = e.body), e.items !== void 0 && (Array.isArray(e.items) ? c.items = e.items.map((a, i) => Wn(a, `${s}.items[${i}]`, l)) : l.push({
|
|
2140
|
+
path: `${s}.items`,
|
|
2141
|
+
level: "warn",
|
|
2142
|
+
message: '"items" should be an array',
|
|
2143
|
+
got: typeof e.items,
|
|
2144
|
+
expected: "array"
|
|
2145
|
+
})), c;
|
|
2146
|
+
}
|
|
2147
|
+
function Yn(e, n) {
|
|
2148
|
+
if (e === void 0) return;
|
|
2149
|
+
if (!Array.isArray(e)) {
|
|
2150
|
+
n.push({
|
|
2151
|
+
path: "meta",
|
|
2152
|
+
level: "warn",
|
|
2153
|
+
message: '"meta" should be an array',
|
|
2154
|
+
got: typeof e,
|
|
2155
|
+
expected: "array"
|
|
2156
|
+
});
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
2159
|
+
const l = [];
|
|
2160
|
+
return e.forEach((s, c) => {
|
|
2161
|
+
if (Te(s) && typeof s.label == "string" && (typeof s.value == "string" || typeof s.value == "number")) {
|
|
2162
|
+
const a = { label: s.label, value: s.value };
|
|
2163
|
+
typeof s.tone == "string" && (a.tone = s.tone), l.push(a);
|
|
2164
|
+
} else
|
|
2165
|
+
n.push({
|
|
2166
|
+
path: `meta[${c}]`,
|
|
2167
|
+
level: "info",
|
|
2168
|
+
message: "meta entry needs { label, value }",
|
|
2169
|
+
expected: "{ label: string, value: string | number }"
|
|
2170
|
+
});
|
|
2171
|
+
}), l.length ? l : void 0;
|
|
2172
|
+
}
|
|
2173
|
+
function ql(e) {
|
|
2174
|
+
const n = [];
|
|
2175
|
+
let l = e;
|
|
2176
|
+
if (typeof e == "string")
|
|
2177
|
+
try {
|
|
2178
|
+
l = JSON.parse(e);
|
|
2179
|
+
} catch {
|
|
2180
|
+
return n.push({
|
|
2181
|
+
path: "",
|
|
2182
|
+
level: "error",
|
|
2183
|
+
message: "input is not valid JSON",
|
|
2184
|
+
got: "string",
|
|
2185
|
+
expected: "JSON object"
|
|
2186
|
+
}), { data: { view: "brief", sections: [] }, issues: n, ok: !1 };
|
|
2187
|
+
}
|
|
2188
|
+
if (!Te(l))
|
|
2189
|
+
return n.push({
|
|
2190
|
+
path: "",
|
|
2191
|
+
level: "error",
|
|
2192
|
+
message: "expected a brief contract object",
|
|
2193
|
+
got: Array.isArray(l) ? "array" : l === null ? "null" : typeof l,
|
|
2194
|
+
expected: "object"
|
|
2195
|
+
}), { data: { view: "brief", sections: [] }, issues: n, ok: !1 };
|
|
2196
|
+
l.view !== "brief" && n.push({
|
|
2197
|
+
path: "view",
|
|
2198
|
+
level: "warn",
|
|
2199
|
+
message: l.view === void 0 ? 'missing "view"; defaulting to "brief"' : 'view should be "brief"',
|
|
2200
|
+
got: String(l.view),
|
|
2201
|
+
expected: "brief"
|
|
2202
|
+
});
|
|
2203
|
+
const s = { view: "brief", sections: [] };
|
|
2204
|
+
l.kind !== void 0 && (typeof l.kind == "string" ? (s.kind = l.kind, Ee.includes(l.kind) || n.push({
|
|
2205
|
+
path: "kind",
|
|
2206
|
+
level: "info",
|
|
2207
|
+
message: `unrecognized kind "${l.kind}" (renders neutral)`,
|
|
2208
|
+
got: l.kind,
|
|
2209
|
+
expected: Ee.join(" | "),
|
|
2210
|
+
didYouMean: Je(l.kind, Ee)
|
|
2211
|
+
})) : n.push({
|
|
2212
|
+
path: "kind",
|
|
2213
|
+
level: "warn",
|
|
2214
|
+
message: '"kind" should be a string',
|
|
2215
|
+
got: typeof l.kind
|
|
2216
|
+
})), typeof l.id == "string" && (s.id = l.id), typeof l.title == "string" && (s.title = l.title), typeof l.summary == "string" && (s.summary = l.summary);
|
|
2217
|
+
const c = Yn(l.meta, n);
|
|
2218
|
+
return c && (s.meta = c), l.sections === void 0 ? n.push({
|
|
2219
|
+
path: "sections",
|
|
2220
|
+
level: "warn",
|
|
2221
|
+
message: 'no "sections" — nothing to render',
|
|
2222
|
+
expected: "array"
|
|
2223
|
+
}) : Array.isArray(l.sections) ? s.sections = l.sections.map((a, i) => Vn(a, i, n)) : n.push({
|
|
2224
|
+
path: "sections",
|
|
2225
|
+
level: "error",
|
|
2226
|
+
message: '"sections" must be an array',
|
|
2227
|
+
got: typeof l.sections,
|
|
2228
|
+
expected: "array"
|
|
2229
|
+
}), { data: s, issues: n, ok: !n.some((a) => a.level === "error") };
|
|
2230
|
+
}
|
|
2231
|
+
function Q(e) {
|
|
2232
|
+
return e.replace(/!\[[^\]]*\]\([^)]*\)/g, "").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").trim();
|
|
2233
|
+
}
|
|
2234
|
+
function Xn(e) {
|
|
2235
|
+
const n = e.trim(), l = n.match(/^`([^`]+)`\s*(?:[—–-]|:)?\s*(.*)$/);
|
|
2236
|
+
if (l)
|
|
2237
|
+
return { text: l[1].trim(), desc: Q(l[2]).trim() || void 0, codey: !0 };
|
|
2238
|
+
const s = n.match(/^\*\*([^*]+)\*\*\s*(?:[—–-]|:)?\s*(.*)$/);
|
|
2239
|
+
if (s)
|
|
2240
|
+
return { text: s[1].trim(), desc: Q(s[2]).trim() || void 0, codey: !1 };
|
|
2241
|
+
const c = n.match(/^(.+?)\s+[—–]\s+(.+)$/);
|
|
2242
|
+
return c ? { text: Q(c[1]).trim(), desc: Q(c[2]).trim(), codey: !1 } : { text: Q(n), codey: !1 };
|
|
2243
|
+
}
|
|
2244
|
+
function zn(e, n) {
|
|
2245
|
+
const l = /^\s*(?:[-*+]\s+|(\d+)[.)]\s+)(.*)$/, s = [], c = [];
|
|
2246
|
+
let a = !1;
|
|
2247
|
+
for (const m of n) {
|
|
2248
|
+
const b = m.match(l);
|
|
2249
|
+
b ? (a = !0, c.push({ text: b[2], numbered: b[1] !== void 0 })) : m.trim() === "" || (a ? c.length && (c[c.length - 1].text += " " + m.trim()) : s.push(m));
|
|
2250
|
+
}
|
|
2251
|
+
const i = Q(s.join(" ")).replace(/\s+/g, " ").trim();
|
|
2252
|
+
if (c.length === 0) {
|
|
2253
|
+
const m = { heading: e, kind: "prose" };
|
|
2254
|
+
return i && (m.body = i), m;
|
|
2255
|
+
}
|
|
2256
|
+
const h = c.map((m) => Xn(m.text)), d = h.filter((m) => m.codey).length >= Math.ceil(h.length / 2), g = e.toLowerCase();
|
|
2257
|
+
let r = "rules";
|
|
2258
|
+
d && (r = "commands"), /gotcha|caveat|checklist|pitfall|warning/.test(g) ? r = "checklist" : /decision/.test(g) ? r = "decisions" : /phase|milestone|roadmap/.test(g) && (r = "phases");
|
|
2259
|
+
const _ = h.map((m) => {
|
|
2260
|
+
const b = { text: m.text };
|
|
2261
|
+
return m.desc && (b.desc = m.desc), b;
|
|
2262
|
+
}), o = { heading: e, kind: r, items: _ };
|
|
2263
|
+
return i && (o.note = i), o;
|
|
2264
|
+
}
|
|
2265
|
+
function Jl(e) {
|
|
2266
|
+
const n = e.replace(/\r\n/g, `
|
|
2267
|
+
`).split(`
|
|
2268
|
+
`), l = { view: "brief", sections: [] };
|
|
2269
|
+
let s = 0;
|
|
2270
|
+
if (n[0]?.trim() === "---") {
|
|
2271
|
+
let d = 1;
|
|
2272
|
+
const g = [];
|
|
2273
|
+
for (; d < n.length && n[d].trim() !== "---"; ) g.push(n[d++]);
|
|
2274
|
+
if (d < n.length) {
|
|
2275
|
+
for (const r of g) {
|
|
2276
|
+
const _ = r.match(/^(\w+):\s*(.+)$/);
|
|
2277
|
+
if (!_) continue;
|
|
2278
|
+
const o = _[2].trim();
|
|
2279
|
+
_[1] === "kind" ? l.kind = o : _[1] === "id" ? l.id = o : _[1] === "title" && (l.title = o);
|
|
2280
|
+
}
|
|
2281
|
+
s = d + 1;
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
const c = [], a = [];
|
|
2285
|
+
let i = null;
|
|
2286
|
+
for (; s < n.length; s++) {
|
|
2287
|
+
const d = n[s], g = d.match(/^##\s+(.+)$/), r = d.match(/^#\s+(.+)$/);
|
|
2288
|
+
g ? (i && a.push(i), i = { heading: Q(g[1]).trim(), lines: [] }) : r && !l.title ? l.title = Q(r[1]).trim() : i ? i.lines.push(d) : c.push(d);
|
|
2289
|
+
}
|
|
2290
|
+
i && a.push(i);
|
|
2291
|
+
const h = Q(c.join(" ")).replace(/\s+/g, " ").trim();
|
|
2292
|
+
return h && (l.summary = h), l.sections = a.map((d) => zn(d.heading, d.lines)), l;
|
|
2293
|
+
}
|
|
2294
|
+
const _e = ["accent", "info", "success", "warning", "danger", "neutral"], ct = (e) => e.id ?? e.label, $e = (e, n) => e.id ?? `g${n}`, at = (e, n, l) => `${$e(e, n)}#${l}`, se = (e, n) => `${e}${n ?? ""}`;
|
|
2295
|
+
function Ql({
|
|
2296
|
+
data: e,
|
|
2297
|
+
selectedId: n,
|
|
2298
|
+
defaultSelectedId: l,
|
|
2299
|
+
onSelect: s,
|
|
2300
|
+
height: c = 240,
|
|
2301
|
+
className: a
|
|
2302
|
+
}) {
|
|
2303
|
+
const [i, h] = A(l), d = n ?? i, g = (w) => {
|
|
2304
|
+
n === void 0 && h(w), s?.(w);
|
|
2305
|
+
}, { unit: r, markers: _ = [] } = e, o = B(() => e.bars ?? [], [e.bars]), m = B(() => e.series ?? [], [e.series]), b = B(() => e.categories ?? [], [e.categories]), p = m.length > 0, f = e.orientation ?? "vertical", x = f === "vertical", v = B(() => {
|
|
2306
|
+
if (e.max != null) return e.max;
|
|
2307
|
+
const w = p ? m.flatMap((C) => C.values.filter((I) => I != null && Number.isFinite(I))) : o.map((C) => C.value), N = Math.max(0, ...w, ..._.map((C) => C.value));
|
|
2308
|
+
return N > 0 ? N : 1;
|
|
2309
|
+
}, [e.max, p, m, o, _]), $ = p ? b : o.map((w) => w.label), y = B(() => {
|
|
2310
|
+
if (d == null) return;
|
|
2311
|
+
if (p) {
|
|
2312
|
+
for (let N = 0; N < m.length; N++) {
|
|
2313
|
+
const C = m[N];
|
|
2314
|
+
for (let I = 0; I < b.length; I++) {
|
|
2315
|
+
const D = C.values[I];
|
|
2316
|
+
if (!(D == null || !Number.isFinite(D)) && at(C, N, I) === d)
|
|
2317
|
+
return {
|
|
2318
|
+
title: C.name,
|
|
2319
|
+
valueText: `${b[I] ?? `#${I + 1}`} · ${se(D, r)}`
|
|
2320
|
+
};
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
return;
|
|
2324
|
+
}
|
|
2325
|
+
const w = o.find((N) => ct(N) === d);
|
|
2326
|
+
return w ? { title: w.label, valueText: se(w.value, r), sub: w.sub, note: w.note } : void 0;
|
|
2327
|
+
}, [d, p, m, b, o, r]);
|
|
2328
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-bar-chart", `tcl-bar-chart--${f}`, a), children: [
|
|
2329
|
+
(e.code || e.title || e.caption || e.brand) && /* @__PURE__ */ u("header", { className: "tcl-bar-chart__header", children: [
|
|
2330
|
+
e.brand && /* @__PURE__ */ t("p", { className: "tcl-bar-chart__brand", children: e.brand }),
|
|
2331
|
+
e.code && /* @__PURE__ */ t("p", { className: "tcl-bar-chart__code", children: e.code }),
|
|
2332
|
+
e.title && /* @__PURE__ */ t("p", { className: "tcl-bar-chart__title", children: e.title }),
|
|
2333
|
+
e.caption && /* @__PURE__ */ t("p", { className: "tcl-bar-chart__caption", children: e.caption })
|
|
2334
|
+
] }),
|
|
2335
|
+
/* @__PURE__ */ u("div", { className: "tcl-bar-chart__plot", style: x ? { height: c } : void 0, children: [
|
|
2336
|
+
/* @__PURE__ */ u(
|
|
2337
|
+
"div",
|
|
2338
|
+
{
|
|
2339
|
+
className: "tcl-bar-chart__canvas",
|
|
2340
|
+
role: "group",
|
|
2341
|
+
"aria-label": e.title ?? e.code ?? "Bar chart",
|
|
2342
|
+
children: [
|
|
2343
|
+
_.map((w, N) => {
|
|
2344
|
+
const C = Z(w.value, 0, v);
|
|
2345
|
+
return /* @__PURE__ */ t(
|
|
2346
|
+
"span",
|
|
2347
|
+
{
|
|
2348
|
+
className: "tcl-bar-chart__marker",
|
|
2349
|
+
"aria-hidden": "true",
|
|
2350
|
+
style: L({ "--mk": R(w.tone ?? "neutral"), "--at": `${C}%` }),
|
|
2351
|
+
children: w.label && /* @__PURE__ */ t("span", { className: "tcl-bar-chart__marker-label", children: `${w.label} · ${se(w.value, r)}` })
|
|
2352
|
+
},
|
|
2353
|
+
`mk-${N}`
|
|
2354
|
+
);
|
|
2355
|
+
}),
|
|
2356
|
+
p ? b.map((w, N) => /* @__PURE__ */ t("div", { className: "tcl-bar-chart__group", children: m.map((C, I) => {
|
|
2357
|
+
const D = C.values[N];
|
|
2358
|
+
if (D == null || !Number.isFinite(D))
|
|
2359
|
+
return /* @__PURE__ */ t(
|
|
2360
|
+
"span",
|
|
2361
|
+
{
|
|
2362
|
+
className: "tcl-bar-chart__spacer",
|
|
2363
|
+
"aria-hidden": "true"
|
|
2364
|
+
},
|
|
2365
|
+
$e(C, I)
|
|
2366
|
+
);
|
|
2367
|
+
const O = at(C, I, N), E = Z(D, 0, v), F = O === d, M = C.color ?? R(C.tone ?? _e[I % _e.length]);
|
|
2368
|
+
return /* @__PURE__ */ t(
|
|
2369
|
+
"button",
|
|
2370
|
+
{
|
|
2371
|
+
type: "button",
|
|
2372
|
+
className: k("tcl-bar-chart__cell", F && "is-selected"),
|
|
2373
|
+
"aria-pressed": F,
|
|
2374
|
+
"aria-label": `${C.name}, ${w}: ${se(D, r)}`,
|
|
2375
|
+
onClick: () => g(O),
|
|
2376
|
+
children: /* @__PURE__ */ t(
|
|
2377
|
+
"span",
|
|
2378
|
+
{
|
|
2379
|
+
className: "tcl-bar-chart__bar",
|
|
2380
|
+
style: L({ "--pct": `${E}%`, "--bar-color": M })
|
|
2381
|
+
}
|
|
2382
|
+
)
|
|
2383
|
+
},
|
|
2384
|
+
$e(C, I)
|
|
2385
|
+
);
|
|
2386
|
+
}) }, `grp-${N}`)) : o.map((w) => {
|
|
2387
|
+
const N = ct(w), C = Z(w.value, 0, v), I = N === d, D = w.color ?? R(w.tone ?? "accent");
|
|
2388
|
+
return /* @__PURE__ */ t(
|
|
2389
|
+
"button",
|
|
2390
|
+
{
|
|
2391
|
+
type: "button",
|
|
2392
|
+
className: k("tcl-bar-chart__cell", I && "is-selected"),
|
|
2393
|
+
"aria-pressed": I,
|
|
2394
|
+
"aria-label": `${w.label}: ${se(w.value, r)}`,
|
|
2395
|
+
onClick: () => g(N),
|
|
2396
|
+
children: /* @__PURE__ */ t(
|
|
2397
|
+
"span",
|
|
2398
|
+
{
|
|
2399
|
+
className: "tcl-bar-chart__bar",
|
|
2400
|
+
style: L({ "--pct": `${C}%`, "--bar-color": D }),
|
|
2401
|
+
children: /* @__PURE__ */ t("span", { className: "tcl-bar-chart__value", children: se(w.value, r) })
|
|
2402
|
+
}
|
|
2403
|
+
)
|
|
2404
|
+
},
|
|
2405
|
+
N
|
|
2406
|
+
);
|
|
2407
|
+
})
|
|
2408
|
+
]
|
|
2409
|
+
}
|
|
2410
|
+
),
|
|
2411
|
+
/* @__PURE__ */ t("div", { className: "tcl-bar-chart__axis", "aria-hidden": "true", children: $.map((w, N) => /* @__PURE__ */ t("span", { className: "tcl-bar-chart__tick", title: w, children: w }, `tick-${N}`)) })
|
|
2412
|
+
] }),
|
|
2413
|
+
p && /* @__PURE__ */ t("div", { className: "tcl-bar-chart__legend", children: m.map((w, N) => /* @__PURE__ */ u("span", { className: "tcl-bar-chart__legend-item", children: [
|
|
2414
|
+
/* @__PURE__ */ t(
|
|
2415
|
+
"span",
|
|
2416
|
+
{
|
|
2417
|
+
className: "tcl-bar-chart__legend-swatch",
|
|
2418
|
+
style: L({
|
|
2419
|
+
"--sw": w.color ?? R(w.tone ?? _e[N % _e.length])
|
|
2420
|
+
}),
|
|
2421
|
+
"aria-hidden": "true"
|
|
2422
|
+
}
|
|
2423
|
+
),
|
|
2424
|
+
w.name
|
|
2425
|
+
] }, $e(w, N))) }),
|
|
2426
|
+
/* @__PURE__ */ t("div", { className: "tcl-bar-chart__inspector", "aria-live": "polite", children: y ? /* @__PURE__ */ u(K, { children: [
|
|
2427
|
+
/* @__PURE__ */ u("p", { className: "tcl-bar-chart__inspector-title", children: [
|
|
2428
|
+
y.title,
|
|
2429
|
+
/* @__PURE__ */ u("span", { className: "tcl-bar-chart__inspector-value", children: [
|
|
2430
|
+
" · ",
|
|
2431
|
+
y.valueText
|
|
2432
|
+
] }),
|
|
2433
|
+
y.sub && /* @__PURE__ */ u("span", { className: "tcl-bar-chart__inspector-sub", children: [
|
|
2434
|
+
" ",
|
|
2435
|
+
y.sub
|
|
2436
|
+
] })
|
|
2437
|
+
] }),
|
|
2438
|
+
y.note && /* @__PURE__ */ t("p", { className: "tcl-bar-chart__inspector-note", children: y.note })
|
|
2439
|
+
] }) : /* @__PURE__ */ t("p", { className: "tcl-bar-chart__inspector-hint", children: "Select a bar to inspect its value." }) })
|
|
2440
|
+
] });
|
|
2441
|
+
}
|
|
2442
|
+
const G = 600, X = 46, q = 12, be = 14, ve = 26, rt = ["accent", "info", "success", "warning", "danger"], Ae = (e, n) => e.id ?? `s${n}`, De = (e, n) => e.color ?? R(e.tone ?? rt[n % rt.length]), it = (e) => String(Math.round(e * 100) / 100);
|
|
2443
|
+
function es({
|
|
2444
|
+
data: e,
|
|
2445
|
+
selectedId: n,
|
|
2446
|
+
defaultSelectedId: l,
|
|
2447
|
+
onSelect: s,
|
|
2448
|
+
height: c = 220,
|
|
2449
|
+
className: a
|
|
2450
|
+
}) {
|
|
2451
|
+
const [i, h] = A(l), d = n ?? i, g = (M) => {
|
|
2452
|
+
n === void 0 && h(M), s?.(M);
|
|
2453
|
+
}, { series: r, unit: _, band: o, target: m } = e, b = c, p = (M) => `${it(M)}${_ ?? ""}`, f = Math.max(1, ...r.map((M) => M.points.length)), { lo: x, hi: v } = B(() => {
|
|
2454
|
+
const M = r.flatMap((Y) => Y.points.map((me) => me.y)).filter((Y) => Y != null && Number.isFinite(Y));
|
|
2455
|
+
let S = M.length ? Math.min(...M) : 0, T = M.length ? Math.max(...M) : 1;
|
|
2456
|
+
if (o && (S = Math.min(S, o.lo), T = Math.max(T, o.hi)), m && (S = Math.min(S, m.value), T = Math.max(T, m.value)), S === T) {
|
|
2457
|
+
const Y = Math.abs(S) * 0.1 + 1;
|
|
2458
|
+
S -= Y, T += Y;
|
|
2459
|
+
}
|
|
2460
|
+
const W = (T - S) * 0.08;
|
|
2461
|
+
let U = e.yMin ?? S - W, V = e.yMax ?? T + W;
|
|
2462
|
+
return V < U && ([U, V] = [V, U]), V === U && (V = U + (Math.abs(U) * 0.1 + 1)), { lo: U, hi: V };
|
|
2463
|
+
}, [r, o, m, e.yMin, e.yMax]), $ = (M) => f <= 1 ? X + (G - X - q) / 2 : X + M / (f - 1) * (G - X - q), y = (M) => be + (1 - (M - x) / (v - x)) * (b - be - ve), N = r.reduce(
|
|
2464
|
+
(M, S) => S.points.length > M.points.length ? S : M,
|
|
2465
|
+
r[0] ?? { points: [] }
|
|
2466
|
+
).points.map((M) => M.x), C = Math.max(1, Math.ceil(f / 8)), I = [0, 1, 2, 3, 4].map((M) => x + (v - x) * M / 4), D = (M) => M.points.map((S, T) => ({ i: T, p: S, v: S.y })).filter((S) => S.p.y != null && Number.isFinite(S.p.y)), O = `lc-clip-${z().replace(/:/g, "")}`, E = B(() => {
|
|
2467
|
+
for (let M = 0; M < r.length; M++) {
|
|
2468
|
+
const S = r[M];
|
|
2469
|
+
for (const { i: T, p: W } of D(S))
|
|
2470
|
+
if (`${Ae(S, M)}#${T}` === d) return { s: S, i: T, p: W };
|
|
2471
|
+
}
|
|
2472
|
+
}, [r, d]), F = (e.title ?? e.code ?? "Line chart") + (m ? `, target ${p(m.value)}` : "") + (o ? `, tolerance band ${p(o.lo)} to ${p(o.hi)}` : "");
|
|
2473
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-line-chart", a), children: [
|
|
2474
|
+
(e.code || e.title || e.caption || e.brand) && /* @__PURE__ */ u("header", { className: "tcl-line-chart__header", children: [
|
|
2475
|
+
e.brand && /* @__PURE__ */ t("p", { className: "tcl-line-chart__brand", children: e.brand }),
|
|
2476
|
+
e.code && /* @__PURE__ */ t("p", { className: "tcl-line-chart__code", children: e.code }),
|
|
2477
|
+
e.title && /* @__PURE__ */ t("p", { className: "tcl-line-chart__title", children: e.title }),
|
|
2478
|
+
e.caption && /* @__PURE__ */ t("p", { className: "tcl-line-chart__caption", children: e.caption })
|
|
2479
|
+
] }),
|
|
2480
|
+
/* @__PURE__ */ u("div", { className: "tcl-line-chart__plot", children: [
|
|
2481
|
+
/* @__PURE__ */ u("div", { className: "tcl-line-chart__canvas", role: "group", "aria-label": F, children: [
|
|
2482
|
+
/* @__PURE__ */ u(
|
|
2483
|
+
"svg",
|
|
2484
|
+
{
|
|
2485
|
+
className: "tcl-line-chart__svg",
|
|
2486
|
+
viewBox: `0 0 ${G} ${b}`,
|
|
2487
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
2488
|
+
"aria-hidden": "true",
|
|
2489
|
+
children: [
|
|
2490
|
+
/* @__PURE__ */ t("defs", { children: /* @__PURE__ */ t("clipPath", { id: O, children: /* @__PURE__ */ t("rect", { x: X, y: be, width: G - X - q, height: b - be - ve }) }) }),
|
|
2491
|
+
I.map((M, S) => /* @__PURE__ */ u("g", { children: [
|
|
2492
|
+
/* @__PURE__ */ t(
|
|
2493
|
+
"line",
|
|
2494
|
+
{
|
|
2495
|
+
className: "tcl-line-chart__grid",
|
|
2496
|
+
x1: X,
|
|
2497
|
+
y1: y(M),
|
|
2498
|
+
x2: G - q,
|
|
2499
|
+
y2: y(M)
|
|
2500
|
+
}
|
|
2501
|
+
),
|
|
2502
|
+
/* @__PURE__ */ t(
|
|
2503
|
+
"text",
|
|
2504
|
+
{
|
|
2505
|
+
className: "tcl-line-chart__axis-text",
|
|
2506
|
+
x: X - 6,
|
|
2507
|
+
y: y(M) + 3,
|
|
2508
|
+
textAnchor: "end",
|
|
2509
|
+
children: it(M)
|
|
2510
|
+
}
|
|
2511
|
+
)
|
|
2512
|
+
] }, `t-${S}`)),
|
|
2513
|
+
o && /* @__PURE__ */ u("g", { style: L({ "--bnd": R(o.tone ?? "success") }), children: [
|
|
2514
|
+
/* @__PURE__ */ t(
|
|
2515
|
+
"rect",
|
|
2516
|
+
{
|
|
2517
|
+
className: "tcl-line-chart__band",
|
|
2518
|
+
x: X,
|
|
2519
|
+
y: y(o.hi),
|
|
2520
|
+
width: G - X - q,
|
|
2521
|
+
height: Math.abs(y(o.lo) - y(o.hi))
|
|
2522
|
+
}
|
|
2523
|
+
),
|
|
2524
|
+
/* @__PURE__ */ t(
|
|
2525
|
+
"line",
|
|
2526
|
+
{
|
|
2527
|
+
className: "tcl-line-chart__band-edge",
|
|
2528
|
+
x1: X,
|
|
2529
|
+
y1: y(o.hi),
|
|
2530
|
+
x2: G - q,
|
|
2531
|
+
y2: y(o.hi)
|
|
2532
|
+
}
|
|
2533
|
+
),
|
|
2534
|
+
/* @__PURE__ */ t(
|
|
2535
|
+
"line",
|
|
2536
|
+
{
|
|
2537
|
+
className: "tcl-line-chart__band-edge",
|
|
2538
|
+
x1: X,
|
|
2539
|
+
y1: y(o.lo),
|
|
2540
|
+
x2: G - q,
|
|
2541
|
+
y2: y(o.lo)
|
|
2542
|
+
}
|
|
2543
|
+
),
|
|
2544
|
+
o.label && /* @__PURE__ */ t(
|
|
2545
|
+
"text",
|
|
2546
|
+
{
|
|
2547
|
+
className: "tcl-line-chart__band-label",
|
|
2548
|
+
x: G - q,
|
|
2549
|
+
y: y(o.hi) - 3,
|
|
2550
|
+
textAnchor: "end",
|
|
2551
|
+
children: o.label
|
|
2552
|
+
}
|
|
2553
|
+
)
|
|
2554
|
+
] }),
|
|
2555
|
+
m && /* @__PURE__ */ u("g", { style: L({ "--tgt": R(m.tone ?? "warning") }), children: [
|
|
2556
|
+
/* @__PURE__ */ t(
|
|
2557
|
+
"line",
|
|
2558
|
+
{
|
|
2559
|
+
className: "tcl-line-chart__target",
|
|
2560
|
+
x1: X,
|
|
2561
|
+
y1: y(m.value),
|
|
2562
|
+
x2: G - q,
|
|
2563
|
+
y2: y(m.value)
|
|
2564
|
+
}
|
|
2565
|
+
),
|
|
2566
|
+
m.label && /* @__PURE__ */ t(
|
|
2567
|
+
"text",
|
|
2568
|
+
{
|
|
2569
|
+
className: "tcl-line-chart__target-label",
|
|
2570
|
+
x: G - q,
|
|
2571
|
+
y: y(m.value) - 4,
|
|
2572
|
+
textAnchor: "end",
|
|
2573
|
+
children: m.label
|
|
2574
|
+
}
|
|
2575
|
+
)
|
|
2576
|
+
] }),
|
|
2577
|
+
N.map(
|
|
2578
|
+
(M, S) => S % C === 0 || S === f - 1 ? /* @__PURE__ */ t(
|
|
2579
|
+
"text",
|
|
2580
|
+
{
|
|
2581
|
+
className: "tcl-line-chart__axis-text",
|
|
2582
|
+
x: $(S),
|
|
2583
|
+
y: b - 8,
|
|
2584
|
+
textAnchor: "middle",
|
|
2585
|
+
children: M
|
|
2586
|
+
},
|
|
2587
|
+
`x-${S}`
|
|
2588
|
+
) : null
|
|
2589
|
+
),
|
|
2590
|
+
/* @__PURE__ */ t("g", { clipPath: `url(#${O})`, children: r.map((M, S) => {
|
|
2591
|
+
const T = D(M);
|
|
2592
|
+
if (!T.length) return null;
|
|
2593
|
+
const W = De(M, S), U = T.map((Y) => `${$(Y.i).toFixed(2)},${y(Y.v).toFixed(2)}`).join(" "), V = `${U} ${$(T[T.length - 1].i).toFixed(2)},${b - ve} ${$(
|
|
2594
|
+
T[0].i
|
|
2595
|
+
).toFixed(2)},${b - ve}`;
|
|
2596
|
+
return /* @__PURE__ */ u("g", { children: [
|
|
2597
|
+
M.fill && T.length > 1 && /* @__PURE__ */ t(
|
|
2598
|
+
"polygon",
|
|
2599
|
+
{
|
|
2600
|
+
className: "tcl-line-chart__area",
|
|
2601
|
+
points: V,
|
|
2602
|
+
style: { fill: W }
|
|
2603
|
+
}
|
|
2604
|
+
),
|
|
2605
|
+
T.length > 1 && /* @__PURE__ */ t(
|
|
2606
|
+
"polyline",
|
|
2607
|
+
{
|
|
2608
|
+
className: k("tcl-line-chart__line", M.dashed && "is-dashed"),
|
|
2609
|
+
points: U,
|
|
2610
|
+
style: { stroke: W },
|
|
2611
|
+
vectorEffect: "non-scaling-stroke"
|
|
2612
|
+
}
|
|
2613
|
+
)
|
|
2614
|
+
] }, `s-${S}`);
|
|
2615
|
+
}) })
|
|
2616
|
+
]
|
|
2617
|
+
}
|
|
2618
|
+
),
|
|
2619
|
+
/* @__PURE__ */ t("div", { className: "tcl-line-chart__points", children: r.map((M, S) => {
|
|
2620
|
+
const T = De(M, S);
|
|
2621
|
+
return D(M).map(({ i: W, p: U, v: V }) => {
|
|
2622
|
+
if (V < x || V > v) return null;
|
|
2623
|
+
const Y = `${Ae(M, S)}#${W}`, me = Y === d;
|
|
2624
|
+
return /* @__PURE__ */ t(
|
|
2625
|
+
"button",
|
|
2626
|
+
{
|
|
2627
|
+
type: "button",
|
|
2628
|
+
className: k("tcl-line-chart__dot", me && "is-selected"),
|
|
2629
|
+
style: L({
|
|
2630
|
+
"--dot": T,
|
|
2631
|
+
left: `${$(W) / G * 100}%`,
|
|
2632
|
+
top: `${y(V) / b * 100}%`
|
|
2633
|
+
}),
|
|
2634
|
+
"aria-pressed": me,
|
|
2635
|
+
"aria-label": `${M.name}, ${U.x}: ${p(V)}`,
|
|
2636
|
+
onClick: () => g(Y)
|
|
2637
|
+
},
|
|
2638
|
+
`${S}#${W}`
|
|
2639
|
+
);
|
|
2640
|
+
});
|
|
2641
|
+
}) })
|
|
2642
|
+
] }),
|
|
2643
|
+
r.length > 0 && /* @__PURE__ */ t("div", { className: "tcl-line-chart__legend", children: r.map((M, S) => /* @__PURE__ */ u("span", { className: "tcl-line-chart__legend-item", children: [
|
|
2644
|
+
/* @__PURE__ */ t(
|
|
2645
|
+
"span",
|
|
2646
|
+
{
|
|
2647
|
+
className: k("tcl-line-chart__legend-swatch", M.dashed && "is-dashed"),
|
|
2648
|
+
style: L({ "--dot": De(M, S) }),
|
|
2649
|
+
"aria-hidden": "true"
|
|
2650
|
+
}
|
|
2651
|
+
),
|
|
2652
|
+
M.name
|
|
2653
|
+
] }, Ae(M, S))) })
|
|
2654
|
+
] }),
|
|
2655
|
+
/* @__PURE__ */ t("div", { className: "tcl-line-chart__inspector", "aria-live": "polite", children: E ? /* @__PURE__ */ u(K, { children: [
|
|
2656
|
+
/* @__PURE__ */ u("p", { className: "tcl-line-chart__inspector-title", children: [
|
|
2657
|
+
E.s.name,
|
|
2658
|
+
/* @__PURE__ */ u("span", { className: "tcl-line-chart__inspector-value", children: [
|
|
2659
|
+
" · ",
|
|
2660
|
+
E.p.x,
|
|
2661
|
+
" · ",
|
|
2662
|
+
p(E.p.y)
|
|
2663
|
+
] })
|
|
2664
|
+
] }),
|
|
2665
|
+
E.p.note && /* @__PURE__ */ t("p", { className: "tcl-line-chart__inspector-note", children: E.p.note })
|
|
2666
|
+
] }) : /* @__PURE__ */ t("p", { className: "tcl-line-chart__inspector-hint", children: "Select a point to inspect its value." }) })
|
|
2667
|
+
] });
|
|
2668
|
+
}
|
|
2669
|
+
const Kn = 240, Un = 176, Ye = 120, Xe = 120, te = 88, ge = (e, n) => `${Math.round(e * 100) / 100}${n ?? ""}`, J = (e, n, l) => 180 - Z(e, n, l) / 100 * 180, ne = (e, n = te) => {
|
|
2670
|
+
const l = e * Math.PI / 180;
|
|
2671
|
+
return { x: Ye + n * Math.cos(l), y: Xe - n * Math.sin(l) };
|
|
2672
|
+
}, Fe = (e, n, l = te) => {
|
|
2673
|
+
const s = ne(e, l), c = ne(n, l), a = Math.abs(n - e) > 180 ? 1 : 0, i = n < e ? 1 : 0;
|
|
2674
|
+
return `M ${s.x.toFixed(2)} ${s.y.toFixed(2)} A ${l} ${l} 0 ${a} ${i} ${c.x.toFixed(2)} ${c.y.toFixed(2)}`;
|
|
2675
|
+
};
|
|
2676
|
+
function ts({
|
|
2677
|
+
value: e,
|
|
2678
|
+
min: n = 0,
|
|
2679
|
+
max: l,
|
|
2680
|
+
unit: s,
|
|
2681
|
+
zones: c,
|
|
2682
|
+
target: a,
|
|
2683
|
+
label: i,
|
|
2684
|
+
ariaLabel: h,
|
|
2685
|
+
tone: d = "accent",
|
|
2686
|
+
className: g
|
|
2687
|
+
}) {
|
|
2688
|
+
const r = Number.isFinite(e) ? Math.min(l, Math.max(n, e)) : n, _ = J(r, n, l), o = ne(_, te - 12), m = c ? [...c].sort((f, x) => f.upTo - x.upTo) : [], b = m.find((f) => r <= f.upTo), p = `${ge(r, s)}${b?.label ? `, ${b.label}` : ""}`;
|
|
2689
|
+
return /* @__PURE__ */ u(
|
|
2690
|
+
"div",
|
|
2691
|
+
{
|
|
2692
|
+
className: k("tcl-gauge", g),
|
|
2693
|
+
role: "meter",
|
|
2694
|
+
"aria-valuenow": Math.round(r * 100) / 100,
|
|
2695
|
+
"aria-valuemin": n,
|
|
2696
|
+
"aria-valuemax": l,
|
|
2697
|
+
"aria-valuetext": p,
|
|
2698
|
+
"aria-label": h ?? i,
|
|
2699
|
+
children: [
|
|
2700
|
+
/* @__PURE__ */ u("div", { className: "tcl-gauge__dial", children: [
|
|
2701
|
+
/* @__PURE__ */ u("svg", { className: "tcl-gauge__svg", viewBox: `0 0 ${Kn} ${Un}`, "aria-hidden": "true", children: [
|
|
2702
|
+
/* @__PURE__ */ t(
|
|
2703
|
+
"path",
|
|
2704
|
+
{
|
|
2705
|
+
className: "tcl-gauge__track",
|
|
2706
|
+
d: Fe(J(n, n, l), J(l, n, l))
|
|
2707
|
+
}
|
|
2708
|
+
),
|
|
2709
|
+
m.length > 0 ? m.map((f, x) => {
|
|
2710
|
+
const v = Math.min(x === 0 ? n : m[x - 1].upTo, l);
|
|
2711
|
+
return /* @__PURE__ */ t(
|
|
2712
|
+
"path",
|
|
2713
|
+
{
|
|
2714
|
+
className: "tcl-gauge__zone",
|
|
2715
|
+
d: Fe(J(v, n, l), J(Math.min(f.upTo, l), n, l)),
|
|
2716
|
+
style: { stroke: f.color ?? R(f.tone ?? "neutral") }
|
|
2717
|
+
},
|
|
2718
|
+
x
|
|
2719
|
+
);
|
|
2720
|
+
}) : /* @__PURE__ */ t(
|
|
2721
|
+
"path",
|
|
2722
|
+
{
|
|
2723
|
+
className: "tcl-gauge__zone",
|
|
2724
|
+
d: Fe(J(n, n, l), _),
|
|
2725
|
+
style: { stroke: R(d) }
|
|
2726
|
+
}
|
|
2727
|
+
),
|
|
2728
|
+
a && /* @__PURE__ */ t(
|
|
2729
|
+
"line",
|
|
2730
|
+
{
|
|
2731
|
+
className: "tcl-gauge__target",
|
|
2732
|
+
x1: ne(J(a.value, n, l), te + 9).x,
|
|
2733
|
+
y1: ne(J(a.value, n, l), te + 9).y,
|
|
2734
|
+
x2: ne(J(a.value, n, l), te - 17).x,
|
|
2735
|
+
y2: ne(J(a.value, n, l), te - 17).y
|
|
2736
|
+
}
|
|
2737
|
+
),
|
|
2738
|
+
/* @__PURE__ */ u("g", { className: "tcl-gauge__needle", children: [
|
|
2739
|
+
/* @__PURE__ */ t("line", { x1: Ye, y1: Xe, x2: o.x, y2: o.y, vectorEffect: "non-scaling-stroke" }),
|
|
2740
|
+
/* @__PURE__ */ t("circle", { cx: Ye, cy: Xe, r: 5 })
|
|
2741
|
+
] })
|
|
2742
|
+
] }),
|
|
2743
|
+
/* @__PURE__ */ u("div", { className: "tcl-gauge__readout", children: [
|
|
2744
|
+
/* @__PURE__ */ u("span", { className: "tcl-gauge__value", children: [
|
|
2745
|
+
Math.round(r * 100) / 100,
|
|
2746
|
+
s && /* @__PURE__ */ t("span", { className: "tcl-gauge__unit", children: s })
|
|
2747
|
+
] }),
|
|
2748
|
+
i && /* @__PURE__ */ t("span", { className: "tcl-gauge__label", children: i })
|
|
2749
|
+
] })
|
|
2750
|
+
] }),
|
|
2751
|
+
a && /* @__PURE__ */ u("p", { className: "tcl-gauge__target-label", children: [
|
|
2752
|
+
"target ",
|
|
2753
|
+
a.label ?? ge(a.value, s)
|
|
2754
|
+
] }),
|
|
2755
|
+
/* @__PURE__ */ u("div", { className: "tcl-gauge__scale", "aria-hidden": "true", children: [
|
|
2756
|
+
/* @__PURE__ */ t("span", { children: ge(n, s) }),
|
|
2757
|
+
/* @__PURE__ */ t("span", { children: ge(l, s) })
|
|
2758
|
+
] })
|
|
2759
|
+
]
|
|
2760
|
+
}
|
|
2761
|
+
);
|
|
2762
|
+
}
|
|
2763
|
+
const ot = ["accent", "info", "success", "warning", "danger", "neutral"], Be = (e, n) => e.id ?? `s${n}`, dt = (e, n) => e.color ?? R(e.tone ?? ot[n % ot.length]), Ne = (e, n) => `${Math.round(e * 100) / 100}${n ?? ""}`, Lt = 54, ut = 2 * Math.PI * Lt;
|
|
2764
|
+
function ns({
|
|
2765
|
+
data: e,
|
|
2766
|
+
selectedId: n,
|
|
2767
|
+
defaultSelectedId: l,
|
|
2768
|
+
onSelect: s,
|
|
2769
|
+
size: c = 160,
|
|
2770
|
+
className: a
|
|
2771
|
+
}) {
|
|
2772
|
+
const [i, h] = A(l), d = n ?? i, g = (y) => {
|
|
2773
|
+
n === void 0 && h(y), s?.(y);
|
|
2774
|
+
}, { segments: r, unit: _ } = e, o = B(
|
|
2775
|
+
() => r.reduce((y, w) => y + Math.max(0, w.value), 0),
|
|
2776
|
+
[r]
|
|
2777
|
+
), m = r.findIndex((y, w) => Be(y, w) === d), b = m >= 0 ? r[m] : void 0, p = (y) => o > 0 ? Math.round(100 * Math.max(0, y) / o) : 0;
|
|
2778
|
+
let f = 0;
|
|
2779
|
+
const x = r.map((y, w) => {
|
|
2780
|
+
const N = o > 0 ? Math.max(0, y.value) / o : 0, C = ut * N, I = { id: Be(y, w), len: C, offset: -f, color: dt(y, w) };
|
|
2781
|
+
return f += C, I;
|
|
2782
|
+
}), v = b ? Ne(Math.max(0, b.value), _) : e.centerValue ?? Ne(o, _), $ = b ? `${p(b.value)}%` : e.centerLabel ?? "total";
|
|
2783
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-donut", a), children: [
|
|
2784
|
+
(e.code || e.title || e.caption || e.brand) && /* @__PURE__ */ u("header", { className: "tcl-donut__header", children: [
|
|
2785
|
+
e.brand && /* @__PURE__ */ t("p", { className: "tcl-donut__brand", children: e.brand }),
|
|
2786
|
+
e.code && /* @__PURE__ */ t("p", { className: "tcl-donut__code", children: e.code }),
|
|
2787
|
+
e.title && /* @__PURE__ */ t("p", { className: "tcl-donut__title", children: e.title }),
|
|
2788
|
+
e.caption && /* @__PURE__ */ t("p", { className: "tcl-donut__caption", children: e.caption })
|
|
2789
|
+
] }),
|
|
2790
|
+
/* @__PURE__ */ u("div", { className: "tcl-donut__body", children: [
|
|
2791
|
+
/* @__PURE__ */ u("div", { className: "tcl-donut__ring", style: { width: c, height: c }, children: [
|
|
2792
|
+
/* @__PURE__ */ t("svg", { viewBox: "0 0 160 160", "aria-hidden": "true", children: /* @__PURE__ */ t("g", { transform: "rotate(-90 80 80)", children: x.map((y, w) => /* @__PURE__ */ t(
|
|
2793
|
+
"circle",
|
|
2794
|
+
{
|
|
2795
|
+
className: k(
|
|
2796
|
+
"tcl-donut__seg",
|
|
2797
|
+
b && y.id !== d && "is-dim",
|
|
2798
|
+
y.id === d && "is-selected"
|
|
2799
|
+
),
|
|
2800
|
+
cx: 80,
|
|
2801
|
+
cy: 80,
|
|
2802
|
+
r: Lt,
|
|
2803
|
+
strokeDasharray: `${y.len.toFixed(2)} ${(ut - y.len).toFixed(2)}`,
|
|
2804
|
+
strokeDashoffset: y.offset.toFixed(2),
|
|
2805
|
+
style: { stroke: y.color }
|
|
2806
|
+
},
|
|
2807
|
+
w
|
|
2808
|
+
)) }) }),
|
|
2809
|
+
/* @__PURE__ */ u("div", { className: "tcl-donut__center", children: [
|
|
2810
|
+
/* @__PURE__ */ t("span", { className: "tcl-donut__center-value", children: v }),
|
|
2811
|
+
/* @__PURE__ */ t("span", { className: "tcl-donut__center-label", children: $ })
|
|
2812
|
+
] })
|
|
2813
|
+
] }),
|
|
2814
|
+
/* @__PURE__ */ t("div", { className: "tcl-donut__legend", role: "group", "aria-label": e.title ?? "Segments", children: r.map((y, w) => {
|
|
2815
|
+
const N = Be(y, w), C = N === d;
|
|
2816
|
+
return /* @__PURE__ */ u(
|
|
2817
|
+
"button",
|
|
2818
|
+
{
|
|
2819
|
+
type: "button",
|
|
2820
|
+
className: k("tcl-donut__legend-item", C && "is-selected"),
|
|
2821
|
+
"aria-pressed": C,
|
|
2822
|
+
"aria-label": `${y.label}: ${Ne(Math.max(0, y.value), _)}, ${p(y.value)}%`,
|
|
2823
|
+
onClick: () => g(N),
|
|
2824
|
+
children: [
|
|
2825
|
+
/* @__PURE__ */ t(
|
|
2826
|
+
"span",
|
|
2827
|
+
{
|
|
2828
|
+
className: "tcl-donut__swatch",
|
|
2829
|
+
style: L({ "--seg": dt(y, w) }),
|
|
2830
|
+
"aria-hidden": "true"
|
|
2831
|
+
}
|
|
2832
|
+
),
|
|
2833
|
+
/* @__PURE__ */ t("span", { className: "tcl-donut__legend-label", children: y.label }),
|
|
2834
|
+
/* @__PURE__ */ u("span", { className: "tcl-donut__legend-pct", children: [
|
|
2835
|
+
p(y.value),
|
|
2836
|
+
"%"
|
|
2837
|
+
] })
|
|
2838
|
+
]
|
|
2839
|
+
},
|
|
2840
|
+
w
|
|
2841
|
+
);
|
|
2842
|
+
}) })
|
|
2843
|
+
] }),
|
|
2844
|
+
/* @__PURE__ */ t("div", { className: "tcl-donut__inspector", "aria-live": "polite", children: b ? /* @__PURE__ */ u(K, { children: [
|
|
2845
|
+
/* @__PURE__ */ u("p", { className: "tcl-donut__inspector-title", children: [
|
|
2846
|
+
b.label,
|
|
2847
|
+
/* @__PURE__ */ u("span", { className: "tcl-donut__inspector-value", children: [
|
|
2848
|
+
" · ",
|
|
2849
|
+
Ne(Math.max(0, b.value), _),
|
|
2850
|
+
" · ",
|
|
2851
|
+
p(b.value),
|
|
2852
|
+
"%"
|
|
2853
|
+
] })
|
|
2854
|
+
] }),
|
|
2855
|
+
b.note && /* @__PURE__ */ t("p", { className: "tcl-donut__inspector-note", children: b.note })
|
|
2856
|
+
] }) : /* @__PURE__ */ t("p", { className: "tcl-donut__inspector-hint", children: "Select a segment to inspect its share." }) })
|
|
2857
|
+
] });
|
|
2858
|
+
}
|
|
2859
|
+
const ce = (e, n) => `${Math.round(e * 100) / 100}${n ?? ""}`;
|
|
2860
|
+
function ls({
|
|
2861
|
+
data: e,
|
|
2862
|
+
selectedId: n,
|
|
2863
|
+
defaultSelectedId: l,
|
|
2864
|
+
onSelect: s,
|
|
2865
|
+
className: c
|
|
2866
|
+
}) {
|
|
2867
|
+
const [a, i] = A(l), h = n ?? a, d = ($) => {
|
|
2868
|
+
n === void 0 && i($), s?.($);
|
|
2869
|
+
}, { columns: g, rows: r, unit: _, stops: o, tone: m = "accent" } = e, [b, p] = B(() => {
|
|
2870
|
+
const $ = r.flatMap((N) => N.cells).filter((N) => N != null && Number.isFinite(N)), y = $.length ? Math.min(...$) : 0, w = $.length ? Math.max(...$) : 1;
|
|
2871
|
+
return [e.min ?? y, e.max ?? w];
|
|
2872
|
+
}, [r, e.min, e.max]), f = B(
|
|
2873
|
+
() => o ? [...o].sort(($, y) => $.at - y.at) : null,
|
|
2874
|
+
[o]
|
|
2875
|
+
), x = ($) => {
|
|
2876
|
+
if (f) {
|
|
2877
|
+
let N = f[0];
|
|
2878
|
+
for (const C of f) $ >= C.at && (N = C);
|
|
2879
|
+
return N.color ?? R(N.tone ?? "accent");
|
|
2880
|
+
}
|
|
2881
|
+
const w = 15 + Z($, b, p) / 100 * 85;
|
|
2882
|
+
return `color-mix(in oklab, ${R(m)} ${w.toFixed(1)}%, var(--tcl-surface-sunken))`;
|
|
2883
|
+
}, v = B(() => {
|
|
2884
|
+
if (!h) return;
|
|
2885
|
+
const [$, y] = h.split("#").map(Number);
|
|
2886
|
+
if (!Number.isInteger($) || !Number.isInteger(y)) return;
|
|
2887
|
+
const w = r[$], N = w?.cells[y];
|
|
2888
|
+
if (!(!w || y < 0 || y >= g.length || N == null || !Number.isFinite(N)))
|
|
2889
|
+
return { row: w, col: g[y], value: N, ri: $, ci: y };
|
|
2890
|
+
}, [h, r, g]);
|
|
2891
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-heatmap", c), children: [
|
|
2892
|
+
(e.code || e.title || e.caption || e.brand) && /* @__PURE__ */ u("header", { className: "tcl-heatmap__header", children: [
|
|
2893
|
+
e.brand && /* @__PURE__ */ t("p", { className: "tcl-heatmap__brand", children: e.brand }),
|
|
2894
|
+
e.code && /* @__PURE__ */ t("p", { className: "tcl-heatmap__code", children: e.code }),
|
|
2895
|
+
e.title && /* @__PURE__ */ t("p", { className: "tcl-heatmap__title", children: e.title }),
|
|
2896
|
+
e.caption && /* @__PURE__ */ t("p", { className: "tcl-heatmap__caption", children: e.caption })
|
|
2897
|
+
] }),
|
|
2898
|
+
/* @__PURE__ */ u(
|
|
2899
|
+
"div",
|
|
2900
|
+
{
|
|
2901
|
+
className: "tcl-heatmap__grid",
|
|
2902
|
+
role: "group",
|
|
2903
|
+
"aria-label": e.title ?? "Heatmap",
|
|
2904
|
+
style: { gridTemplateColumns: `auto repeat(${g.length}, minmax(0, 1fr))` },
|
|
2905
|
+
children: [
|
|
2906
|
+
/* @__PURE__ */ t("span", { className: "tcl-heatmap__corner", "aria-hidden": "true" }),
|
|
2907
|
+
g.map(($, y) => /* @__PURE__ */ t("span", { className: "tcl-heatmap__colhead", "aria-hidden": "true", title: $, children: $ }, `c-${y}`)),
|
|
2908
|
+
r.map(($, y) => /* @__PURE__ */ u(Ot, { children: [
|
|
2909
|
+
/* @__PURE__ */ t(
|
|
2910
|
+
"span",
|
|
2911
|
+
{
|
|
2912
|
+
className: "tcl-heatmap__rowhead",
|
|
2913
|
+
"aria-hidden": "true",
|
|
2914
|
+
title: $.sub ? `${$.label} · ${$.sub}` : $.label,
|
|
2915
|
+
children: $.label
|
|
2916
|
+
}
|
|
2917
|
+
),
|
|
2918
|
+
g.map((w, N) => {
|
|
2919
|
+
const C = $.cells[N];
|
|
2920
|
+
if (C == null || !Number.isFinite(C))
|
|
2921
|
+
return /* @__PURE__ */ t(
|
|
2922
|
+
"span",
|
|
2923
|
+
{
|
|
2924
|
+
className: "tcl-heatmap__cell tcl-heatmap__cell--empty",
|
|
2925
|
+
"aria-hidden": "true",
|
|
2926
|
+
title: `${$.label}, ${w}: no data`
|
|
2927
|
+
},
|
|
2928
|
+
`cell-${y}-${N}`
|
|
2929
|
+
);
|
|
2930
|
+
const I = `${y}#${N}`, D = I === h;
|
|
2931
|
+
return /* @__PURE__ */ t(
|
|
2932
|
+
"button",
|
|
2933
|
+
{
|
|
2934
|
+
type: "button",
|
|
2935
|
+
className: k("tcl-heatmap__cell", D && "is-selected"),
|
|
2936
|
+
style: { background: x(C) },
|
|
2937
|
+
"aria-pressed": D,
|
|
2938
|
+
"aria-label": `${$.label}, ${w}: ${ce(C, _)}`,
|
|
2939
|
+
onClick: () => d(I),
|
|
2940
|
+
children: e.showValues && /* @__PURE__ */ t("span", { className: "tcl-heatmap__cell-value", children: ce(C, _) })
|
|
2941
|
+
},
|
|
2942
|
+
`cell-${y}-${N}`
|
|
2943
|
+
);
|
|
2944
|
+
})
|
|
2945
|
+
] }, `r-${y}`))
|
|
2946
|
+
]
|
|
2947
|
+
}
|
|
2948
|
+
),
|
|
2949
|
+
/* @__PURE__ */ t("div", { className: "tcl-heatmap__scale", "aria-hidden": "true", children: f ? f.map(($, y) => /* @__PURE__ */ u("span", { className: "tcl-heatmap__scale-stop", children: [
|
|
2950
|
+
/* @__PURE__ */ t(
|
|
2951
|
+
"span",
|
|
2952
|
+
{
|
|
2953
|
+
className: "tcl-heatmap__scale-swatch",
|
|
2954
|
+
style: L({ "--sw": $.color ?? R($.tone ?? "accent") })
|
|
2955
|
+
}
|
|
2956
|
+
),
|
|
2957
|
+
$.label ?? `≥ ${ce($.at, _)}`
|
|
2958
|
+
] }, y)) : /* @__PURE__ */ u(K, { children: [
|
|
2959
|
+
/* @__PURE__ */ t("span", { children: ce(b, _) }),
|
|
2960
|
+
/* @__PURE__ */ t(
|
|
2961
|
+
"span",
|
|
2962
|
+
{
|
|
2963
|
+
className: "tcl-heatmap__scale-gradient",
|
|
2964
|
+
style: L({
|
|
2965
|
+
"--g0": `color-mix(in oklab, ${R(m)} 15%, var(--tcl-surface-sunken))`,
|
|
2966
|
+
"--g1": R(m)
|
|
2967
|
+
})
|
|
2968
|
+
}
|
|
2969
|
+
),
|
|
2970
|
+
/* @__PURE__ */ t("span", { children: ce(p, _) })
|
|
2971
|
+
] }) }),
|
|
2972
|
+
/* @__PURE__ */ t("div", { className: "tcl-heatmap__inspector", "aria-live": "polite", children: v ? /* @__PURE__ */ u("p", { className: "tcl-heatmap__inspector-title", children: [
|
|
2973
|
+
v.row.label,
|
|
2974
|
+
v.row.sub && /* @__PURE__ */ u("span", { className: "tcl-heatmap__inspector-sub", children: [
|
|
2975
|
+
" · ",
|
|
2976
|
+
v.row.sub
|
|
2977
|
+
] }),
|
|
2978
|
+
/* @__PURE__ */ u("span", { className: "tcl-heatmap__inspector-value", children: [
|
|
2979
|
+
" · ",
|
|
2980
|
+
v.col,
|
|
2981
|
+
" · ",
|
|
2982
|
+
ce(v.value, _)
|
|
2983
|
+
] })
|
|
2984
|
+
] }) : /* @__PURE__ */ t("p", { className: "tcl-heatmap__inspector-hint", children: "Select a cell to inspect its value." }) })
|
|
2985
|
+
] });
|
|
2986
|
+
}
|
|
2987
|
+
const ht = (e, n) => e.id ?? `s${n}`, ye = (e, n) => `${Math.round(e * 100) / 100}${n ?? ""}`, Rt = (e, n) => n > 0 ? Math.round(100 * e / n) : 0, Oe = (e, n) => Math.min(100, Rt(e, n));
|
|
2988
|
+
function ss({
|
|
2989
|
+
data: e,
|
|
2990
|
+
selectedId: n,
|
|
2991
|
+
defaultSelectedId: l,
|
|
2992
|
+
onSelect: s,
|
|
2993
|
+
className: c
|
|
2994
|
+
}) {
|
|
2995
|
+
const [a, i] = A(l), h = n ?? a, d = (x) => {
|
|
2996
|
+
n === void 0 && i(x), s?.(x);
|
|
2997
|
+
}, { stages: g, unit: r } = e, _ = B(() => Math.max(0, g[0]?.value ?? 0), [g]), o = g[0]?.label ?? "top", m = B(
|
|
2998
|
+
() => Math.max(_, 0, ...g.map((x) => Math.max(0, x.value))),
|
|
2999
|
+
[g, _]
|
|
3000
|
+
), b = g.findIndex((x, v) => ht(x, v) === h), p = b >= 0 ? g[b] : void 0, f = b > 0 ? g[b - 1] : void 0;
|
|
3001
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-funnel", c), children: [
|
|
3002
|
+
(e.code || e.title || e.caption || e.brand) && /* @__PURE__ */ u("header", { className: "tcl-funnel__header", children: [
|
|
3003
|
+
e.brand && /* @__PURE__ */ t("p", { className: "tcl-funnel__brand", children: e.brand }),
|
|
3004
|
+
e.code && /* @__PURE__ */ t("p", { className: "tcl-funnel__code", children: e.code }),
|
|
3005
|
+
e.title && /* @__PURE__ */ t("p", { className: "tcl-funnel__title", children: e.title }),
|
|
3006
|
+
e.caption && /* @__PURE__ */ t("p", { className: "tcl-funnel__caption", children: e.caption })
|
|
3007
|
+
] }),
|
|
3008
|
+
/* @__PURE__ */ t("div", { className: "tcl-funnel__stages", role: "group", "aria-label": e.title ?? "Funnel", children: g.map((x, v) => {
|
|
3009
|
+
const $ = ht(x, v), y = Math.max(0, x.value), w = Z(y, 0, m), N = Oe(y, _), C = $ === h, I = x.color ?? R(x.tone ?? "accent");
|
|
3010
|
+
return /* @__PURE__ */ u(
|
|
3011
|
+
"button",
|
|
3012
|
+
{
|
|
3013
|
+
type: "button",
|
|
3014
|
+
className: k("tcl-funnel__stage", C && "is-selected"),
|
|
3015
|
+
"aria-pressed": C,
|
|
3016
|
+
"aria-label": `${x.label}: ${ye(y, r)}, ${N}% of ${o}`,
|
|
3017
|
+
onClick: () => d($),
|
|
3018
|
+
children: [
|
|
3019
|
+
/* @__PURE__ */ t("span", { className: "tcl-funnel__label", title: x.label, children: x.label }),
|
|
3020
|
+
/* @__PURE__ */ t("span", { className: "tcl-funnel__track", children: /* @__PURE__ */ t(
|
|
3021
|
+
"span",
|
|
3022
|
+
{
|
|
3023
|
+
className: "tcl-funnel__bar",
|
|
3024
|
+
style: L({ "--pct": `${w}%`, "--bar-color": I })
|
|
3025
|
+
}
|
|
3026
|
+
) }),
|
|
3027
|
+
/* @__PURE__ */ u("span", { className: "tcl-funnel__readout", children: [
|
|
3028
|
+
/* @__PURE__ */ t("span", { className: "tcl-funnel__value", children: ye(y, r) }),
|
|
3029
|
+
/* @__PURE__ */ u("span", { className: "tcl-funnel__conv", children: [
|
|
3030
|
+
N,
|
|
3031
|
+
"%"
|
|
3032
|
+
] })
|
|
3033
|
+
] })
|
|
3034
|
+
]
|
|
3035
|
+
},
|
|
3036
|
+
$
|
|
3037
|
+
);
|
|
3038
|
+
}) }),
|
|
3039
|
+
/* @__PURE__ */ t("div", { className: "tcl-funnel__inspector", "aria-live": "polite", children: p ? /* @__PURE__ */ u(K, { children: [
|
|
3040
|
+
/* @__PURE__ */ u("p", { className: "tcl-funnel__inspector-title", children: [
|
|
3041
|
+
p.label,
|
|
3042
|
+
/* @__PURE__ */ u("span", { className: "tcl-funnel__inspector-value", children: [
|
|
3043
|
+
" · ",
|
|
3044
|
+
ye(Math.max(0, p.value), r),
|
|
3045
|
+
" ·",
|
|
3046
|
+
" ",
|
|
3047
|
+
Oe(Math.max(0, p.value), _),
|
|
3048
|
+
"% of ",
|
|
3049
|
+
o
|
|
3050
|
+
] })
|
|
3051
|
+
] }),
|
|
3052
|
+
f && /* @__PURE__ */ t("p", { className: "tcl-funnel__inspector-drop", children: (() => {
|
|
3053
|
+
const x = Math.max(0, p.value), v = Math.max(0, f.value), $ = v - x;
|
|
3054
|
+
return $ > 0 ? `Down ${ye($, r)} (${Rt($, v)}%) from ${f.label}` : `No drop from ${f.label} (${Oe(x, v)}% retained)`;
|
|
3055
|
+
})() }),
|
|
3056
|
+
p.note && /* @__PURE__ */ t("p", { className: "tcl-funnel__inspector-note", children: p.note })
|
|
3057
|
+
] }) : /* @__PURE__ */ t("p", { className: "tcl-funnel__inspector-hint", children: "Select a stage to inspect its conversion." }) })
|
|
3058
|
+
] });
|
|
3059
|
+
}
|
|
3060
|
+
const mt = ["accent", "info", "success", "warning", "danger", "neutral"], Gn = {
|
|
3061
|
+
accent: "var(--tcl-accent-fg)",
|
|
3062
|
+
info: "var(--tcl-status-info-fg)",
|
|
3063
|
+
success: "var(--tcl-status-success-fg)",
|
|
3064
|
+
warning: "var(--tcl-status-warning-fg)",
|
|
3065
|
+
danger: "var(--tcl-status-danger-fg)",
|
|
3066
|
+
neutral: "var(--tcl-status-neutral-fg)"
|
|
3067
|
+
}, Zn = (e, n) => e.id ?? `s${n}`, qn = (e, n) => e.tone ?? mt[n % mt.length], Pe = (e, n) => `${Math.round(e * 100) / 100}${n ?? ""}`, re = 600, ie = 400, Jn = 66, Qn = 38;
|
|
3068
|
+
function el(e) {
|
|
3069
|
+
const n = [];
|
|
3070
|
+
let l = 0, s = 0, c = re, a = ie, i = [];
|
|
3071
|
+
const h = e.slice(), d = (r, _) => {
|
|
3072
|
+
const o = r.reduce((p, f) => p + f.area, 0);
|
|
3073
|
+
if (o <= 0 || _ <= 0) return 1 / 0;
|
|
3074
|
+
const m = o / _;
|
|
3075
|
+
let b = 0;
|
|
3076
|
+
for (const p of r) {
|
|
3077
|
+
const f = p.area / m;
|
|
3078
|
+
if (f <= 0) return 1 / 0;
|
|
3079
|
+
b = Math.max(b, m / f, f / m);
|
|
3080
|
+
}
|
|
3081
|
+
return b;
|
|
3082
|
+
}, g = (r, _) => {
|
|
3083
|
+
const m = r.reduce((p, f) => p + f.area, 0) / _;
|
|
3084
|
+
let b = 0;
|
|
3085
|
+
for (const p of r) {
|
|
3086
|
+
const f = m > 0 ? p.area / m : 0;
|
|
3087
|
+
c >= a ? n.push({ ...p, x: l, y: s + b, w: m, h: f }) : n.push({ ...p, x: l + b, y: s, w: f, h: m }), b += f;
|
|
3088
|
+
}
|
|
3089
|
+
c >= a ? (l += m, c -= m) : (s += m, a -= m);
|
|
3090
|
+
};
|
|
3091
|
+
for (; h.length; ) {
|
|
3092
|
+
const r = Math.min(c, a), _ = h.shift();
|
|
3093
|
+
if (!i.length) {
|
|
3094
|
+
i.push(_);
|
|
3095
|
+
continue;
|
|
3096
|
+
}
|
|
3097
|
+
d([...i, _], r) <= d(i, r) ? i.push(_) : (g(i, r), i = [_]);
|
|
3098
|
+
}
|
|
3099
|
+
return i.length && g(i, Math.min(c, a)), n;
|
|
3100
|
+
}
|
|
3101
|
+
function cs({
|
|
3102
|
+
data: e,
|
|
3103
|
+
selectedId: n,
|
|
3104
|
+
defaultSelectedId: l,
|
|
3105
|
+
onSelect: s,
|
|
3106
|
+
className: c
|
|
3107
|
+
}) {
|
|
3108
|
+
const [a, i] = A(l), h = n ?? a, d = (p) => {
|
|
3109
|
+
n === void 0 && i(p), s?.(p);
|
|
3110
|
+
}, { nodes: g, unit: r } = e, { cells: _, total: o } = B(() => {
|
|
3111
|
+
const p = g.map((v, $) => ({ node: v, i: $ })).filter(({ node: v }) => Number.isFinite(v.value) && v.value > 0), f = p.reduce((v, { node: $ }) => v + $.value, 0);
|
|
3112
|
+
if (f <= 0) return { cells: [], total: 0 };
|
|
3113
|
+
const x = p.map(({ node: v, i: $ }) => ({
|
|
3114
|
+
id: Zn(v, $),
|
|
3115
|
+
i: $,
|
|
3116
|
+
node: v,
|
|
3117
|
+
area: v.value / f * re * ie
|
|
3118
|
+
}));
|
|
3119
|
+
return { cells: el(x), total: f };
|
|
3120
|
+
}, [g]), m = (p) => o > 0 ? Math.round(100 * p / o) : 0, b = _.find((p) => p.id === h)?.node;
|
|
3121
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-treemap", c), children: [
|
|
3122
|
+
(e.code || e.title || e.caption || e.brand) && /* @__PURE__ */ u("header", { className: "tcl-treemap__header", children: [
|
|
3123
|
+
e.brand && /* @__PURE__ */ t("p", { className: "tcl-treemap__brand", children: e.brand }),
|
|
3124
|
+
e.code && /* @__PURE__ */ t("p", { className: "tcl-treemap__code", children: e.code }),
|
|
3125
|
+
e.title && /* @__PURE__ */ t("p", { className: "tcl-treemap__title", children: e.title }),
|
|
3126
|
+
e.caption && /* @__PURE__ */ t("p", { className: "tcl-treemap__caption", children: e.caption })
|
|
3127
|
+
] }),
|
|
3128
|
+
/* @__PURE__ */ t(
|
|
3129
|
+
"div",
|
|
3130
|
+
{
|
|
3131
|
+
className: "tcl-treemap__plot",
|
|
3132
|
+
role: "group",
|
|
3133
|
+
"aria-label": e.title ?? "Treemap",
|
|
3134
|
+
style: { aspectRatio: `${re} / ${ie}` },
|
|
3135
|
+
children: _.length === 0 ? /* @__PURE__ */ t("p", { className: "tcl-treemap__empty", children: "No data in range" }) : _.map((p) => {
|
|
3136
|
+
const f = p.id === h, x = p.x / re * 100, v = p.y / ie * 100, $ = Math.min(p.w, re - p.x) / re * 100, y = Math.min(p.h, ie - p.y) / ie * 100, w = p.w >= Jn && p.h >= Qn, N = qn(p.node, p.i), C = p.node.color ? "var(--tcl-text)" : Gn[N];
|
|
3137
|
+
return /* @__PURE__ */ t(
|
|
3138
|
+
"button",
|
|
3139
|
+
{
|
|
3140
|
+
type: "button",
|
|
3141
|
+
className: k("tcl-treemap__cell", f && "is-selected"),
|
|
3142
|
+
style: L({
|
|
3143
|
+
"--cell": p.node.color ?? R(N),
|
|
3144
|
+
"--cell-fg": C,
|
|
3145
|
+
"--cell-halo": p.node.color ? "0 0 2px var(--tcl-bg), 0 1px 1px var(--tcl-bg)" : "none",
|
|
3146
|
+
left: `${x}%`,
|
|
3147
|
+
top: `${v}%`,
|
|
3148
|
+
width: `${$}%`,
|
|
3149
|
+
height: `${y}%`
|
|
3150
|
+
}),
|
|
3151
|
+
"aria-pressed": f,
|
|
3152
|
+
"aria-label": `${p.node.label}: ${Pe(p.node.value, r)}, ${m(p.node.value)}% of total`,
|
|
3153
|
+
onClick: () => d(p.id),
|
|
3154
|
+
children: w && /* @__PURE__ */ u("span", { className: "tcl-treemap__cell-text", children: [
|
|
3155
|
+
/* @__PURE__ */ t("span", { className: "tcl-treemap__cell-label", children: p.node.label }),
|
|
3156
|
+
/* @__PURE__ */ t("span", { className: "tcl-treemap__cell-value", children: Pe(p.node.value, r) })
|
|
3157
|
+
] })
|
|
3158
|
+
},
|
|
3159
|
+
p.id
|
|
3160
|
+
);
|
|
3161
|
+
})
|
|
3162
|
+
}
|
|
3163
|
+
),
|
|
3164
|
+
/* @__PURE__ */ t("div", { className: "tcl-treemap__inspector", "aria-live": "polite", children: b ? /* @__PURE__ */ u(K, { children: [
|
|
3165
|
+
/* @__PURE__ */ u("p", { className: "tcl-treemap__inspector-title", children: [
|
|
3166
|
+
b.label,
|
|
3167
|
+
b.sub && /* @__PURE__ */ u("span", { className: "tcl-treemap__inspector-sub", children: [
|
|
3168
|
+
" · ",
|
|
3169
|
+
b.sub
|
|
3170
|
+
] }),
|
|
3171
|
+
/* @__PURE__ */ u("span", { className: "tcl-treemap__inspector-value", children: [
|
|
3172
|
+
" · ",
|
|
3173
|
+
Pe(b.value, r),
|
|
3174
|
+
" · ",
|
|
3175
|
+
m(b.value),
|
|
3176
|
+
"%"
|
|
3177
|
+
] })
|
|
3178
|
+
] }),
|
|
3179
|
+
b.note && /* @__PURE__ */ t("p", { className: "tcl-treemap__inspector-note", children: b.note })
|
|
3180
|
+
] }) : /* @__PURE__ */ t("p", { className: "tcl-treemap__inspector-hint", children: "Select a cell to inspect its share." }) })
|
|
3181
|
+
] });
|
|
3182
|
+
}
|
|
3183
|
+
const tl = (e, n) => e.id ?? `l${n}`, nl = (e, n) => e.id ?? `s${n}`, ll = {
|
|
3184
|
+
human: "info",
|
|
3185
|
+
ai: "accent",
|
|
3186
|
+
system: "neutral",
|
|
3187
|
+
tool: "warning",
|
|
3188
|
+
neutral: "neutral"
|
|
3189
|
+
}, pt = {
|
|
3190
|
+
done: { tone: "success", word: "Done" },
|
|
3191
|
+
active: { tone: "accent", word: "Active" },
|
|
3192
|
+
pending: { tone: "neutral", word: "Pending" },
|
|
3193
|
+
blocked: { tone: "danger", word: "Blocked" },
|
|
3194
|
+
skipped: { tone: "neutral", word: "Skipped" }
|
|
3195
|
+
}, ft = 168, ze = 140, de = 88, we = 60, je = 14;
|
|
3196
|
+
function sl(e) {
|
|
3197
|
+
const n = e.lanes ?? [], l = e.steps ?? [], s = n.map((r, _) => ({ id: tl(r, _), lane: r, row: _ })), c = /* @__PURE__ */ new Map();
|
|
3198
|
+
s.forEach(({ id: r, lane: _, row: o }) => {
|
|
3199
|
+
c.set(r, o), c.set(_.label, o);
|
|
3200
|
+
});
|
|
3201
|
+
let a = 0;
|
|
3202
|
+
const i = [];
|
|
3203
|
+
l.forEach((r, _) => {
|
|
3204
|
+
const o = c.get(r.lane);
|
|
3205
|
+
if (o === void 0) return;
|
|
3206
|
+
const m = Math.max(0, Number.isFinite(r.col) ? r.col : a);
|
|
3207
|
+
a = Math.max(a, m + 1), i.push({
|
|
3208
|
+
id: nl(r, _),
|
|
3209
|
+
i: _,
|
|
3210
|
+
step: r,
|
|
3211
|
+
laneLabel: s[o].lane.label,
|
|
3212
|
+
row: o,
|
|
3213
|
+
col: m,
|
|
3214
|
+
x: je + m * ft,
|
|
3215
|
+
y: o * de + (de - we) / 2
|
|
3216
|
+
});
|
|
3217
|
+
});
|
|
3218
|
+
const h = new Map(i.map((r) => [r.id, r])), d = [];
|
|
3219
|
+
i.forEach((r, _) => {
|
|
3220
|
+
const o = i[_ + 1], m = r.step.to ?? (o ? [o.id] : []), b = /* @__PURE__ */ new Set();
|
|
3221
|
+
m.forEach((p) => {
|
|
3222
|
+
if (p === r.id || b.has(p)) return;
|
|
3223
|
+
b.add(p);
|
|
3224
|
+
const f = h.get(p);
|
|
3225
|
+
if (!f) return;
|
|
3226
|
+
const x = r.x + ze, v = r.y + we / 2, $ = f.x, y = f.y + we / 2, w = Math.max(24, Math.abs($ - x) * 0.5);
|
|
3227
|
+
d.push({
|
|
3228
|
+
key: `${r.id}->${f.id}`,
|
|
3229
|
+
from: r.id,
|
|
3230
|
+
to: f.id,
|
|
3231
|
+
d: `M ${x} ${v} C ${x + w} ${v}, ${$ - w} ${y}, ${$} ${y}`,
|
|
3232
|
+
ax: $,
|
|
3233
|
+
ay: y
|
|
3234
|
+
});
|
|
3235
|
+
});
|
|
3236
|
+
});
|
|
3237
|
+
const g = i.reduce((r, _) => Math.max(r, _.col), 0);
|
|
3238
|
+
return {
|
|
3239
|
+
lanes: s,
|
|
3240
|
+
steps: i,
|
|
3241
|
+
edges: d,
|
|
3242
|
+
width: je + g * ft + ze + je,
|
|
3243
|
+
height: Math.max(1, s.length) * de
|
|
3244
|
+
};
|
|
3245
|
+
}
|
|
3246
|
+
function as({
|
|
3247
|
+
data: e,
|
|
3248
|
+
selectedId: n,
|
|
3249
|
+
defaultSelectedId: l,
|
|
3250
|
+
onSelect: s,
|
|
3251
|
+
className: c
|
|
3252
|
+
}) {
|
|
3253
|
+
const [a, i] = A(l), h = n ?? a, d = (v) => {
|
|
3254
|
+
n === void 0 && i(v), s?.(v);
|
|
3255
|
+
}, g = B(() => sl(e), [e]), { lanes: r, steps: _, edges: o, width: m, height: b } = g, p = _.find((v) => v.id === h), f = p ? o.filter((v) => v.from === p.id).map((v) => _.find(($) => $.id === v.to)) : [], x = _.length > 0;
|
|
3256
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-swimlane", c), children: [
|
|
3257
|
+
(e.code || e.title || e.caption || e.brand) && /* @__PURE__ */ u("header", { className: "tcl-swimlane__header", children: [
|
|
3258
|
+
e.brand && /* @__PURE__ */ t("p", { className: "tcl-swimlane__brand", children: e.brand }),
|
|
3259
|
+
e.code && /* @__PURE__ */ t("p", { className: "tcl-swimlane__code", children: e.code }),
|
|
3260
|
+
e.title && /* @__PURE__ */ t("p", { className: "tcl-swimlane__title", children: e.title }),
|
|
3261
|
+
e.caption && /* @__PURE__ */ t("p", { className: "tcl-swimlane__caption", children: e.caption })
|
|
3262
|
+
] }),
|
|
3263
|
+
x ? /* @__PURE__ */ u("div", { className: "tcl-swimlane__board", children: [
|
|
3264
|
+
/* @__PURE__ */ t("div", { className: "tcl-swimlane__lanes", "aria-hidden": "true", children: r.map(({ id: v, lane: $ }) => {
|
|
3265
|
+
const y = ll[$.kind ?? "neutral"];
|
|
3266
|
+
return /* @__PURE__ */ u(
|
|
3267
|
+
"div",
|
|
3268
|
+
{
|
|
3269
|
+
className: "tcl-swimlane__lane-head",
|
|
3270
|
+
style: L({ "--lane-tone": R(y), height: `${de}px` }),
|
|
3271
|
+
children: [
|
|
3272
|
+
/* @__PURE__ */ t("span", { className: "tcl-swimlane__lane-dot" }),
|
|
3273
|
+
/* @__PURE__ */ t("span", { className: "tcl-swimlane__lane-label", children: $.label }),
|
|
3274
|
+
$.kind && $.kind !== "neutral" && /* @__PURE__ */ t("span", { className: "tcl-swimlane__lane-kind", children: $.kind })
|
|
3275
|
+
]
|
|
3276
|
+
},
|
|
3277
|
+
v
|
|
3278
|
+
);
|
|
3279
|
+
}) }),
|
|
3280
|
+
/* @__PURE__ */ u(
|
|
3281
|
+
"div",
|
|
3282
|
+
{
|
|
3283
|
+
className: "tcl-swimlane__track",
|
|
3284
|
+
style: L({ width: `${m}px`, height: `${b}px` }),
|
|
3285
|
+
children: [
|
|
3286
|
+
r.map(({ id: v, row: $ }) => /* @__PURE__ */ t(
|
|
3287
|
+
"div",
|
|
3288
|
+
{
|
|
3289
|
+
className: k("tcl-swimlane__stripe", $ % 2 === 1 && "is-alt"),
|
|
3290
|
+
style: L({ top: `${$ * de}px`, height: `${de}px` }),
|
|
3291
|
+
"aria-hidden": "true"
|
|
3292
|
+
},
|
|
3293
|
+
v
|
|
3294
|
+
)),
|
|
3295
|
+
/* @__PURE__ */ t(
|
|
3296
|
+
"svg",
|
|
3297
|
+
{
|
|
3298
|
+
className: "tcl-swimlane__edges",
|
|
3299
|
+
width: m,
|
|
3300
|
+
height: b,
|
|
3301
|
+
viewBox: `0 0 ${m} ${b}`,
|
|
3302
|
+
"aria-hidden": "true",
|
|
3303
|
+
children: o.map((v) => {
|
|
3304
|
+
const $ = h != null && (v.from === h || v.to === h);
|
|
3305
|
+
return /* @__PURE__ */ u("g", { className: k("tcl-swimlane__edge", $ && "is-active"), children: [
|
|
3306
|
+
/* @__PURE__ */ t("path", { className: "tcl-swimlane__edge-line", d: v.d }),
|
|
3307
|
+
/* @__PURE__ */ t(
|
|
3308
|
+
"path",
|
|
3309
|
+
{
|
|
3310
|
+
className: "tcl-swimlane__edge-arrow",
|
|
3311
|
+
d: `M ${v.ax} ${v.ay} L ${v.ax - 7} ${v.ay - 4} L ${v.ax - 7} ${v.ay + 4} Z`
|
|
3312
|
+
}
|
|
3313
|
+
)
|
|
3314
|
+
] }, v.key);
|
|
3315
|
+
})
|
|
3316
|
+
}
|
|
3317
|
+
),
|
|
3318
|
+
/* @__PURE__ */ t("div", { className: "tcl-swimlane__steps", role: "group", "aria-label": e.title ?? "Swimlane", children: _.map((v) => {
|
|
3319
|
+
const $ = v.step.status ?? "pending", y = pt[$], w = v.id === h;
|
|
3320
|
+
return /* @__PURE__ */ u(
|
|
3321
|
+
"button",
|
|
3322
|
+
{
|
|
3323
|
+
type: "button",
|
|
3324
|
+
className: k(
|
|
3325
|
+
"tcl-swimlane__step",
|
|
3326
|
+
`is-${$}`,
|
|
3327
|
+
w && "is-selected"
|
|
3328
|
+
),
|
|
3329
|
+
style: L({
|
|
3330
|
+
"--step-tone": R(y.tone),
|
|
3331
|
+
left: `${v.x}px`,
|
|
3332
|
+
top: `${v.y}px`,
|
|
3333
|
+
width: `${ze}px`,
|
|
3334
|
+
height: `${we}px`
|
|
3335
|
+
}),
|
|
3336
|
+
"aria-pressed": w,
|
|
3337
|
+
"aria-label": `${v.laneLabel}: ${v.step.label} — ${y.word}`,
|
|
3338
|
+
onClick: () => d(v.id),
|
|
3339
|
+
children: [
|
|
3340
|
+
/* @__PURE__ */ u("span", { className: "tcl-swimlane__step-top", children: [
|
|
3341
|
+
/* @__PURE__ */ t("span", { className: "tcl-swimlane__step-dot", "aria-hidden": "true" }),
|
|
3342
|
+
/* @__PURE__ */ t("span", { className: "tcl-swimlane__step-label", title: v.step.label, children: v.step.label })
|
|
3343
|
+
] }),
|
|
3344
|
+
v.step.detail && /* @__PURE__ */ t("span", { className: "tcl-swimlane__step-detail", children: v.step.detail })
|
|
3345
|
+
]
|
|
3346
|
+
},
|
|
3347
|
+
v.id
|
|
3348
|
+
);
|
|
3349
|
+
}) })
|
|
3350
|
+
]
|
|
3351
|
+
}
|
|
3352
|
+
)
|
|
3353
|
+
] }) : /* @__PURE__ */ t("p", { className: "tcl-swimlane__empty", children: "No steps to lay out" }),
|
|
3354
|
+
/* @__PURE__ */ t("div", { className: "tcl-swimlane__inspector", "aria-live": "polite", children: p ? /* @__PURE__ */ u(K, { children: [
|
|
3355
|
+
/* @__PURE__ */ u("p", { className: "tcl-swimlane__inspector-title", children: [
|
|
3356
|
+
/* @__PURE__ */ t("span", { className: "tcl-swimlane__inspector-lane", children: p.laneLabel }),
|
|
3357
|
+
" · ",
|
|
3358
|
+
p.step.label,
|
|
3359
|
+
/* @__PURE__ */ u("span", { className: "tcl-swimlane__inspector-status", children: [
|
|
3360
|
+
" · ",
|
|
3361
|
+
pt[p.step.status ?? "pending"].word
|
|
3362
|
+
] })
|
|
3363
|
+
] }),
|
|
3364
|
+
p.step.note && /* @__PURE__ */ t("p", { className: "tcl-swimlane__inspector-note", children: p.step.note }),
|
|
3365
|
+
f.length > 0 && /* @__PURE__ */ u("p", { className: "tcl-swimlane__inspector-handoff", children: [
|
|
3366
|
+
"Hands off to",
|
|
3367
|
+
" ",
|
|
3368
|
+
f.filter((v) => v != null).map((v) => `${v.laneLabel} · ${v.step.label}`).join(", ")
|
|
3369
|
+
] })
|
|
3370
|
+
] }) : /* @__PURE__ */ t("p", { className: "tcl-swimlane__inspector-hint", children: "Select a step to inspect its handoff." }) })
|
|
3371
|
+
] });
|
|
3372
|
+
}
|
|
3373
|
+
const At = {
|
|
3374
|
+
succeeded: { tone: "success", word: "Succeeded" },
|
|
3375
|
+
failed: { tone: "danger", word: "Failed" },
|
|
3376
|
+
running: { tone: "accent", word: "Running" },
|
|
3377
|
+
cancelled: { tone: "warning", word: "Cancelled" },
|
|
3378
|
+
partial: { tone: "warning", word: "Partial" },
|
|
3379
|
+
queued: { tone: "neutral", word: "Queued" }
|
|
3380
|
+
}, He = {
|
|
3381
|
+
done: { tone: "success", word: "done" },
|
|
3382
|
+
active: { tone: "accent", word: "active" },
|
|
3383
|
+
blocked: { tone: "danger", word: "blocked" },
|
|
3384
|
+
pending: { tone: "neutral", word: "pending" },
|
|
3385
|
+
skipped: { tone: "neutral", word: "skipped" }
|
|
3386
|
+
}, cl = ["done", "active", "blocked", "pending", "skipped"], al = {
|
|
3387
|
+
pr: "accent",
|
|
3388
|
+
deploy: "success",
|
|
3389
|
+
doc: "info",
|
|
3390
|
+
dataset: "info",
|
|
3391
|
+
log: "neutral",
|
|
3392
|
+
link: "neutral"
|
|
3393
|
+
}, rl = 8, il = (e, n) => e.id ?? `r${n}`, ol = (e, n) => e.id ?? `o${n}`;
|
|
3394
|
+
function ke(e) {
|
|
3395
|
+
const n = e instanceof Date ? e.getTime() : typeof e == "number" ? e : Date.parse(e);
|
|
3396
|
+
return Number.isFinite(n) ? n : null;
|
|
3397
|
+
}
|
|
3398
|
+
function dl(e) {
|
|
3399
|
+
const n = ke(e);
|
|
3400
|
+
return n == null ? typeof e == "string" ? e : void 0 : new Date(n).toISOString();
|
|
3401
|
+
}
|
|
3402
|
+
function ul(e, n) {
|
|
3403
|
+
const l = ke(e);
|
|
3404
|
+
if (l == null) return "";
|
|
3405
|
+
const s = n - l >= 0, c = Math.round(Math.abs(n - l) / 1e3);
|
|
3406
|
+
if (c < 45) return "just now";
|
|
3407
|
+
const a = Math.round(c / 60);
|
|
3408
|
+
if (a < 60) return s ? `${a}m ago` : `in ${a}m`;
|
|
3409
|
+
const i = Math.round(a / 60);
|
|
3410
|
+
if (i < 24) return s ? `${i}h ago` : `in ${i}h`;
|
|
3411
|
+
const h = Math.round(i / 24);
|
|
3412
|
+
return h === 1 ? s ? "yesterday" : "tomorrow" : h < 7 ? s ? `${h}d ago` : `in ${h}d` : new Date(l).toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
3413
|
+
}
|
|
3414
|
+
function Dt(e) {
|
|
3415
|
+
if (e == null || !Number.isFinite(e) || e < 0) return "—";
|
|
3416
|
+
const n = Math.round(e / 1e3);
|
|
3417
|
+
if (n < 60) return `${n}s`;
|
|
3418
|
+
const l = Math.floor(n / 60), s = n % 60;
|
|
3419
|
+
if (l < 60) return s ? `${l}m ${s}s` : `${l}m`;
|
|
3420
|
+
const c = Math.floor(l / 60), a = l % 60;
|
|
3421
|
+
return a ? `${c}h ${a}m` : `${c}h`;
|
|
3422
|
+
}
|
|
3423
|
+
function Ft(e) {
|
|
3424
|
+
const n = e.tally ?? {};
|
|
3425
|
+
if (!e.tally && e.stepOutcomes)
|
|
3426
|
+
for (const l of e.stepOutcomes) n[l.status] = (n[l.status] ?? 0) + 1;
|
|
3427
|
+
return cl.filter((l) => (n[l] ?? 0) > 0).map((l) => [l, n[l]]);
|
|
3428
|
+
}
|
|
3429
|
+
function hl(e) {
|
|
3430
|
+
return Ft(e).reduce((n, [, l]) => n + l, 0);
|
|
3431
|
+
}
|
|
3432
|
+
function rs({
|
|
3433
|
+
data: e,
|
|
3434
|
+
selectedRunId: n,
|
|
3435
|
+
defaultSelectedRunId: l,
|
|
3436
|
+
onSelectRun: s,
|
|
3437
|
+
density: c = "comfortable",
|
|
3438
|
+
className: a
|
|
3439
|
+
}) {
|
|
3440
|
+
const [i, h] = A(l), d = n ?? i, g = (f) => {
|
|
3441
|
+
n === void 0 && h(f), s?.(f);
|
|
3442
|
+
}, [r, _] = A({ column: "started", direction: "desc" }), o = B(
|
|
3443
|
+
() => (e.runs ?? []).map((f, x) => ({ run: f, id: il(f, x) })),
|
|
3444
|
+
[e.runs]
|
|
3445
|
+
), m = B(() => {
|
|
3446
|
+
const f = r.direction === "asc" ? 1 : -1;
|
|
3447
|
+
return [...o].sort((x, v) => {
|
|
3448
|
+
if (r.column === "duration") {
|
|
3449
|
+
const $ = x.run.durationMs, y = v.run.durationMs;
|
|
3450
|
+
return $ == null && y == null ? 0 : $ == null ? 1 : y == null ? -1 : ($ - y) * f;
|
|
3451
|
+
}
|
|
3452
|
+
return ((ke(x.run.startedAt) ?? 0) - (ke(v.run.startedAt) ?? 0)) * f;
|
|
3453
|
+
});
|
|
3454
|
+
}, [o, r]), b = o.find((f) => f.id === d)?.run, p = Date.now();
|
|
3455
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-run-history", a), children: [
|
|
3456
|
+
(e.code || e.title || e.caption || e.brand) && /* @__PURE__ */ u("header", { className: "tcl-run-history__header", children: [
|
|
3457
|
+
e.brand && /* @__PURE__ */ t("p", { className: "tcl-run-history__brand", children: e.brand }),
|
|
3458
|
+
e.code && /* @__PURE__ */ t("p", { className: "tcl-run-history__code", children: e.code }),
|
|
3459
|
+
e.title && /* @__PURE__ */ t("p", { className: "tcl-run-history__title", children: e.title }),
|
|
3460
|
+
e.caption && /* @__PURE__ */ t("p", { className: "tcl-run-history__caption", children: e.caption })
|
|
3461
|
+
] }),
|
|
3462
|
+
/* @__PURE__ */ u(
|
|
3463
|
+
P,
|
|
3464
|
+
{
|
|
3465
|
+
density: c,
|
|
3466
|
+
sortDescriptor: r,
|
|
3467
|
+
onSortChange: _,
|
|
3468
|
+
"aria-label": e.title ?? "Run history",
|
|
3469
|
+
children: [
|
|
3470
|
+
/* @__PURE__ */ t(P.Head, { children: /* @__PURE__ */ u(P.Row, { children: [
|
|
3471
|
+
/* @__PURE__ */ t(P.HeaderCell, { children: "Run" }),
|
|
3472
|
+
/* @__PURE__ */ t(P.HeaderCell, { sortKey: "started", children: "Started" }),
|
|
3473
|
+
/* @__PURE__ */ t(P.HeaderCell, { sortKey: "duration", align: "end", children: "Duration" }),
|
|
3474
|
+
/* @__PURE__ */ t(P.HeaderCell, { children: "Steps" }),
|
|
3475
|
+
/* @__PURE__ */ t(P.HeaderCell, { align: "end", children: "Outputs" })
|
|
3476
|
+
] }) }),
|
|
3477
|
+
/* @__PURE__ */ t(P.Body, { children: m.length === 0 ? /* @__PURE__ */ t(P.Empty, { colSpan: 5, children: "No runs yet" }) : m.map(({ run: f, id: x }) => {
|
|
3478
|
+
const v = At[f.status], $ = x === d, y = f.label ?? x, w = ul(f.startedAt, p), N = Dt(f.durationMs), C = Ft(f), I = f.outputs?.length ?? 0, D = C.length > 0 ? C.map(([O, E]) => `${E} ${He[O].word}`).join(", ") : "no step detail";
|
|
3479
|
+
return /* @__PURE__ */ u(
|
|
3480
|
+
P.Row,
|
|
3481
|
+
{
|
|
3482
|
+
rowKey: x,
|
|
3483
|
+
onClick: () => g(x),
|
|
3484
|
+
className: k($ && "is-run-selected"),
|
|
3485
|
+
children: [
|
|
3486
|
+
/* @__PURE__ */ t(P.Cell, { children: /* @__PURE__ */ u("span", { className: "tcl-run-history__run", children: [
|
|
3487
|
+
/* @__PURE__ */ t(
|
|
3488
|
+
"span",
|
|
3489
|
+
{
|
|
3490
|
+
"aria-hidden": "true",
|
|
3491
|
+
className: k(
|
|
3492
|
+
"tcl-run-history__status",
|
|
3493
|
+
f.status === "running" && "is-running"
|
|
3494
|
+
),
|
|
3495
|
+
children: /* @__PURE__ */ t(kt, { tone: v.tone, dot: !0, variant: "soft", size: "sm", children: v.word })
|
|
3496
|
+
}
|
|
3497
|
+
),
|
|
3498
|
+
/* @__PURE__ */ t("span", { "aria-hidden": "true", className: "tcl-run-history__run-label", children: y }),
|
|
3499
|
+
/* @__PURE__ */ u("span", { className: "tcl-run-history__sr", children: [
|
|
3500
|
+
v.word,
|
|
3501
|
+
" ",
|
|
3502
|
+
y,
|
|
3503
|
+
", started ",
|
|
3504
|
+
w || "unknown",
|
|
3505
|
+
",",
|
|
3506
|
+
" ",
|
|
3507
|
+
N === "—" ? "in progress" : N,
|
|
3508
|
+
", ",
|
|
3509
|
+
D,
|
|
3510
|
+
", ",
|
|
3511
|
+
I,
|
|
3512
|
+
" output",
|
|
3513
|
+
I === 1 ? "" : "s"
|
|
3514
|
+
] })
|
|
3515
|
+
] }) }),
|
|
3516
|
+
/* @__PURE__ */ t(P.Cell, { children: /* @__PURE__ */ t("time", { className: "tcl-run-history__when", dateTime: dl(f.startedAt), children: w }) }),
|
|
3517
|
+
/* @__PURE__ */ t(P.Cell, { numeric: !0, children: N }),
|
|
3518
|
+
/* @__PURE__ */ t(P.Cell, { children: /* @__PURE__ */ t("span", { className: "tcl-run-history__steps", children: C.length === 0 ? /* @__PURE__ */ t("span", { className: "tcl-run-history__steps-none", children: "—" }) : C.map(([O, E], F) => /* @__PURE__ */ u(
|
|
3519
|
+
"span",
|
|
3520
|
+
{
|
|
3521
|
+
className: k("tcl-run-history__tally", `is-${He[O].tone}`),
|
|
3522
|
+
children: [
|
|
3523
|
+
F > 0 && /* @__PURE__ */ t("span", { className: "tcl-run-history__tally-sep", children: " · " }),
|
|
3524
|
+
E,
|
|
3525
|
+
" ",
|
|
3526
|
+
He[O].word
|
|
3527
|
+
]
|
|
3528
|
+
},
|
|
3529
|
+
O
|
|
3530
|
+
)) }) }),
|
|
3531
|
+
/* @__PURE__ */ t(P.Cell, { numeric: !0, children: I })
|
|
3532
|
+
]
|
|
3533
|
+
},
|
|
3534
|
+
x
|
|
3535
|
+
);
|
|
3536
|
+
}) })
|
|
3537
|
+
]
|
|
3538
|
+
}
|
|
3539
|
+
),
|
|
3540
|
+
/* @__PURE__ */ t("div", { className: "tcl-run-history__inspector", "aria-live": "polite", children: b ? /* @__PURE__ */ t(ml, { run: b }) : /* @__PURE__ */ t("p", { className: "tcl-run-history__inspector-hint", children: "Select a run to see its outputs and results." }) })
|
|
3541
|
+
] });
|
|
3542
|
+
}
|
|
3543
|
+
function ml({ run: e }) {
|
|
3544
|
+
const n = At[e.status], l = Dt(e.durationMs), s = hl(e), c = e.outputs ?? [], a = c.slice(0, rl), i = c.length - a.length;
|
|
3545
|
+
return /* @__PURE__ */ u(K, { children: [
|
|
3546
|
+
/* @__PURE__ */ u("p", { className: "tcl-run-history__inspector-title", children: [
|
|
3547
|
+
/* @__PURE__ */ t("span", { className: k("tcl-run-history__status", e.status === "running" && "is-running"), children: /* @__PURE__ */ t(kt, { tone: n.tone, dot: !0, variant: "soft", size: "sm", children: n.word }) }),
|
|
3548
|
+
/* @__PURE__ */ t("span", { className: "tcl-run-history__inspector-label", children: e.label ?? "Run" }),
|
|
3549
|
+
/* @__PURE__ */ u("span", { className: "tcl-run-history__inspector-meta", children: [
|
|
3550
|
+
" · ",
|
|
3551
|
+
l === "—" ? "in progress" : l,
|
|
3552
|
+
s > 0 && ` · ran ${s} step${s === 1 ? "" : "s"}`,
|
|
3553
|
+
e.trigger && ` · ${e.trigger}`
|
|
3554
|
+
] })
|
|
3555
|
+
] }),
|
|
3556
|
+
e.note && /* @__PURE__ */ t("p", { className: "tcl-run-history__inspector-note", children: e.note }),
|
|
3557
|
+
c.length > 0 ? /* @__PURE__ */ u("div", { className: "tcl-run-history__outputs", children: [
|
|
3558
|
+
a.map((h, d) => /* @__PURE__ */ t(pl, { output: h }, ol(h, d))),
|
|
3559
|
+
i > 0 && /* @__PURE__ */ u("span", { className: "tcl-run-history__more", children: [
|
|
3560
|
+
"+",
|
|
3561
|
+
i,
|
|
3562
|
+
" more"
|
|
3563
|
+
] })
|
|
3564
|
+
] }) : /* @__PURE__ */ t("p", { className: "tcl-run-history__no-outputs", children: "No outputs recorded for this run." })
|
|
3565
|
+
] });
|
|
3566
|
+
}
|
|
3567
|
+
function pl({ output: e }) {
|
|
3568
|
+
const n = al[e.kind ?? "link"], l = k("tcl-run-history__chip", `is-${n}`);
|
|
3569
|
+
return e.href ? /* @__PURE__ */ u("a", { className: l, href: e.href, children: [
|
|
3570
|
+
e.label,
|
|
3571
|
+
/* @__PURE__ */ t("span", { className: "tcl-run-history__chip-ext", "aria-hidden": "true", children: "↗" })
|
|
3572
|
+
] }) : /* @__PURE__ */ t("span", { className: l, children: e.label });
|
|
3573
|
+
}
|
|
3574
|
+
const fl = {
|
|
3575
|
+
info: "ℹ",
|
|
3576
|
+
success: "✓",
|
|
3577
|
+
warning: "⚠",
|
|
3578
|
+
danger: "⚠",
|
|
3579
|
+
neutral: "ℹ",
|
|
3580
|
+
accent: "ℹ"
|
|
3581
|
+
};
|
|
3582
|
+
function is({
|
|
3583
|
+
tone: e = "info",
|
|
3584
|
+
title: n,
|
|
3585
|
+
icon: l,
|
|
3586
|
+
onDismiss: s,
|
|
3587
|
+
dismissLabel: c = "Dismiss",
|
|
3588
|
+
className: a,
|
|
3589
|
+
children: i,
|
|
3590
|
+
...h
|
|
3591
|
+
}) {
|
|
3592
|
+
const d = l === void 0 ? fl[e] : l;
|
|
3593
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-callout", `tcl-callout--${e}`, a), ...h, children: [
|
|
3594
|
+
d != null && d !== !1 && /* @__PURE__ */ t("span", { className: "tcl-callout__icon", "aria-hidden": "true", children: d }),
|
|
3595
|
+
/* @__PURE__ */ u("div", { className: "tcl-callout__content", children: [
|
|
3596
|
+
n != null && n !== !1 && /* @__PURE__ */ t("p", { className: "tcl-callout__title", children: n }),
|
|
3597
|
+
i != null && i !== !1 && /* @__PURE__ */ t("div", { className: "tcl-callout__body", children: i })
|
|
3598
|
+
] }),
|
|
3599
|
+
s && /* @__PURE__ */ t(
|
|
3600
|
+
"button",
|
|
3601
|
+
{
|
|
3602
|
+
type: "button",
|
|
3603
|
+
className: "tcl-callout__dismiss",
|
|
3604
|
+
"aria-label": c,
|
|
3605
|
+
onClick: s,
|
|
3606
|
+
children: /* @__PURE__ */ t("span", { "aria-hidden": "true", children: "✕" })
|
|
3607
|
+
}
|
|
3608
|
+
)
|
|
3609
|
+
] });
|
|
3610
|
+
}
|
|
3611
|
+
function os({
|
|
3612
|
+
icon: e,
|
|
3613
|
+
title: n,
|
|
3614
|
+
description: l,
|
|
3615
|
+
pendingSource: s,
|
|
3616
|
+
badge: c,
|
|
3617
|
+
action: a,
|
|
3618
|
+
className: i,
|
|
3619
|
+
...h
|
|
3620
|
+
}) {
|
|
3621
|
+
const d = e === void 0 ? "∅" : e;
|
|
3622
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-empty", i), ...h, children: [
|
|
3623
|
+
c && /* @__PURE__ */ t("span", { className: "tcl-empty__badge", children: c }),
|
|
3624
|
+
d != null && d !== !1 && /* @__PURE__ */ t("span", { className: "tcl-empty__icon", "aria-hidden": "true", children: d }),
|
|
3625
|
+
/* @__PURE__ */ t("p", { className: "tcl-empty__title", children: n }),
|
|
3626
|
+
l != null && l !== !1 && /* @__PURE__ */ t("p", { className: "tcl-empty__description", children: l }),
|
|
3627
|
+
s && /* @__PURE__ */ u("p", { className: "tcl-empty__pending", children: [
|
|
3628
|
+
"Source not yet exposed: ",
|
|
3629
|
+
/* @__PURE__ */ t("code", { className: "tcl-empty__source", children: s })
|
|
3630
|
+
] }),
|
|
3631
|
+
a && /* @__PURE__ */ t("div", { className: "tcl-empty__action", children: a })
|
|
3632
|
+
] });
|
|
3633
|
+
}
|
|
3634
|
+
const _l = {
|
|
3635
|
+
live: { tone: "success", label: "Live" },
|
|
3636
|
+
stale: { tone: "warning", label: "Stale" },
|
|
3637
|
+
loading: { tone: "info", label: "Loading" },
|
|
3638
|
+
error: { tone: "danger", label: "Error" },
|
|
3639
|
+
partial: { tone: "warning", label: "Partial" },
|
|
3640
|
+
paused: { tone: "neutral", label: "Paused" }
|
|
3641
|
+
};
|
|
3642
|
+
function bl(e) {
|
|
3643
|
+
return e instanceof Date ? e.toISOString() : typeof e == "number" ? new Date(e).toISOString() : e;
|
|
3644
|
+
}
|
|
3645
|
+
function ds({
|
|
3646
|
+
status: e = "live",
|
|
3647
|
+
statusLabel: n,
|
|
3648
|
+
title: l,
|
|
3649
|
+
updatedAt: s,
|
|
3650
|
+
updatedLabel: c,
|
|
3651
|
+
metrics: a,
|
|
3652
|
+
filters: i,
|
|
3653
|
+
onRemoveFilter: h,
|
|
3654
|
+
removeFilterLabel: d = (p) => `Remove ${p.label} filter`,
|
|
3655
|
+
onRefresh: g,
|
|
3656
|
+
refreshLabel: r = "Refresh",
|
|
3657
|
+
"aria-label": _ = "Data status",
|
|
3658
|
+
dense: o = !1,
|
|
3659
|
+
className: m,
|
|
3660
|
+
...b
|
|
3661
|
+
}) {
|
|
3662
|
+
const p = _l[e], f = n ?? p.label, x = e === "loading", v = i != null && i.length > 0, $ = c != null && c !== !1;
|
|
3663
|
+
return /* @__PURE__ */ u(
|
|
3664
|
+
"section",
|
|
3665
|
+
{
|
|
3666
|
+
className: k(
|
|
3667
|
+
"tcl-data-status-bar",
|
|
3668
|
+
`tcl-data-status-bar--${p.tone}`,
|
|
3669
|
+
o && "tcl-data-status-bar--dense",
|
|
3670
|
+
m
|
|
3671
|
+
),
|
|
3672
|
+
"aria-label": _,
|
|
3673
|
+
"data-status": e,
|
|
3674
|
+
...b,
|
|
3675
|
+
children: [
|
|
3676
|
+
/* @__PURE__ */ u("div", { className: "tcl-data-status-bar__lead", children: [
|
|
3677
|
+
l != null && l !== !1 && /* @__PURE__ */ t("span", { className: "tcl-data-status-bar__title", children: l }),
|
|
3678
|
+
/* @__PURE__ */ u("span", { className: "tcl-data-status-bar__status", children: [
|
|
3679
|
+
/* @__PURE__ */ u("span", { className: "tcl-data-status-bar__signal", role: "status", "aria-live": "polite", children: [
|
|
3680
|
+
/* @__PURE__ */ t(
|
|
3681
|
+
"span",
|
|
3682
|
+
{
|
|
3683
|
+
className: k(
|
|
3684
|
+
"tcl-data-status-bar__dot",
|
|
3685
|
+
x && "tcl-data-status-bar__dot--pulse",
|
|
3686
|
+
e === "live" && "tcl-data-status-bar__dot--beacon"
|
|
3687
|
+
),
|
|
3688
|
+
"aria-hidden": "true"
|
|
3689
|
+
}
|
|
3690
|
+
),
|
|
3691
|
+
/* @__PURE__ */ t("span", { className: "tcl-data-status-bar__status-word", children: f })
|
|
3692
|
+
] }),
|
|
3693
|
+
$ && (s != null ? /* @__PURE__ */ t("time", { className: "tcl-data-status-bar__fresh", dateTime: bl(s), children: c }) : /* @__PURE__ */ t("span", { className: "tcl-data-status-bar__fresh", children: c }))
|
|
3694
|
+
] }),
|
|
3695
|
+
a && a.length > 0 && /* @__PURE__ */ t("ul", { className: "tcl-data-status-bar__metrics", children: a.map((y, w) => /* @__PURE__ */ u("li", { className: "tcl-data-status-bar__metric", children: [
|
|
3696
|
+
/* @__PURE__ */ t("span", { className: "tcl-data-status-bar__metric-value", children: y.value }),
|
|
3697
|
+
" ",
|
|
3698
|
+
/* @__PURE__ */ t("span", { className: "tcl-data-status-bar__metric-label", children: y.label })
|
|
3699
|
+
] }, y.id ?? `m${w}`)) })
|
|
3700
|
+
] }),
|
|
3701
|
+
(v || g) && /* @__PURE__ */ u("div", { className: "tcl-data-status-bar__controls", children: [
|
|
3702
|
+
i && i.length > 0 && /* @__PURE__ */ t("ul", { className: "tcl-data-status-bar__filters", "aria-label": "Active filters", children: i.map((y, w) => {
|
|
3703
|
+
const N = y.id ?? `f${w}`, C = y.tone ?? "neutral";
|
|
3704
|
+
return /* @__PURE__ */ u(
|
|
3705
|
+
"li",
|
|
3706
|
+
{
|
|
3707
|
+
className: k(
|
|
3708
|
+
"tcl-data-status-bar__chip",
|
|
3709
|
+
`tcl-data-status-bar__chip--${C}`
|
|
3710
|
+
),
|
|
3711
|
+
children: [
|
|
3712
|
+
/* @__PURE__ */ t("span", { className: "tcl-data-status-bar__chip-label", children: y.label }),
|
|
3713
|
+
/* @__PURE__ */ t("span", { className: "tcl-data-status-bar__chip-value", children: y.value }),
|
|
3714
|
+
h && /* @__PURE__ */ t(
|
|
3715
|
+
"button",
|
|
3716
|
+
{
|
|
3717
|
+
type: "button",
|
|
3718
|
+
className: "tcl-data-status-bar__chip-remove",
|
|
3719
|
+
"aria-label": d(y),
|
|
3720
|
+
onClick: () => h(N, y),
|
|
3721
|
+
children: /* @__PURE__ */ t("span", { "aria-hidden": "true", children: "✕" })
|
|
3722
|
+
}
|
|
3723
|
+
)
|
|
3724
|
+
]
|
|
3725
|
+
},
|
|
3726
|
+
N
|
|
3727
|
+
);
|
|
3728
|
+
}) }),
|
|
3729
|
+
g && /* @__PURE__ */ u(
|
|
3730
|
+
"button",
|
|
3731
|
+
{
|
|
3732
|
+
type: "button",
|
|
3733
|
+
className: "tcl-data-status-bar__refresh",
|
|
3734
|
+
onClick: g,
|
|
3735
|
+
disabled: x,
|
|
3736
|
+
"aria-busy": x || void 0,
|
|
3737
|
+
children: [
|
|
3738
|
+
/* @__PURE__ */ t("span", { className: "tcl-data-status-bar__refresh-icon", "aria-hidden": "true", children: "⟳" }),
|
|
3739
|
+
r
|
|
3740
|
+
]
|
|
3741
|
+
}
|
|
3742
|
+
)
|
|
3743
|
+
] })
|
|
3744
|
+
]
|
|
3745
|
+
}
|
|
3746
|
+
);
|
|
3747
|
+
}
|
|
3748
|
+
const vl = (e, n) => e.id ?? `e${n}`, _t = (e) => e === "accent" ? "var(--tcl-text)" : R(e), bt = 224, le = 196, Ce = 132, Qe = 26, vt = 6, ae = 28, et = 18, gl = le * 0.58, oe = et + Ce + Qe, We = 2 * et + 2 * Ce + 2 * Qe;
|
|
3749
|
+
function Nl(e) {
|
|
3750
|
+
const n = e.events ?? [], l = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
3751
|
+
(e.categories ?? []).forEach((f) => {
|
|
3752
|
+
l.set(f.key, f.tone ?? "neutral"), s.set(f.key, f.label);
|
|
3753
|
+
});
|
|
3754
|
+
const c = n.map((f, x) => ({ event: f, i: x })).sort((f, x) => f.event.at - x.event.at || f.i - x.i), a = e.scale ?? "ordinal", i = c.map((f) => f.event.at), h = e.range?.min ?? (i.length ? Math.min(...i) : 0), d = e.range?.max ?? (i.length ? Math.max(...i) : 0), g = a === "time" && d > h, r = Math.max(0, (c.length - 1) * bt);
|
|
3755
|
+
let _ = -1 / 0;
|
|
3756
|
+
const o = c.map(({ event: f, i: x }, v) => {
|
|
3757
|
+
const $ = g ? ae + le / 2 + Z(f.at, h, d) / 100 * r : ae + le / 2 + v * bt, y = g ? Math.max($, _ + gl) : $;
|
|
3758
|
+
_ = y;
|
|
3759
|
+
const w = f.tone ?? (f.category ? l.get(f.category) ?? "neutral" : "neutral"), N = f.side ?? (v % 2 === 0 ? "above" : "below");
|
|
3760
|
+
return {
|
|
3761
|
+
id: vl(f, x),
|
|
3762
|
+
i: x,
|
|
3763
|
+
event: f,
|
|
3764
|
+
tone: w,
|
|
3765
|
+
side: N,
|
|
3766
|
+
categoryLabel: f.category ? s.get(f.category) : void 0,
|
|
3767
|
+
dateText: f.dateLabel ?? String(f.at),
|
|
3768
|
+
nodeX: y,
|
|
3769
|
+
cardX: y - le / 2,
|
|
3770
|
+
cardY: N === "above" ? et : oe + Qe
|
|
3771
|
+
};
|
|
3772
|
+
}), m = o.length ? o[0].nodeX : ae, b = o.length ? o[o.length - 1].nodeX : ae, p = o.length ? b + le / 2 + ae : ae * 2;
|
|
3773
|
+
return { events: o, width: p, axisFrom: m, axisTo: b };
|
|
3774
|
+
}
|
|
3775
|
+
function us({
|
|
3776
|
+
data: e,
|
|
3777
|
+
selectedId: n,
|
|
3778
|
+
defaultSelectedId: l,
|
|
3779
|
+
onSelect: s,
|
|
3780
|
+
className: c
|
|
3781
|
+
}) {
|
|
3782
|
+
const [a, i] = A(l), h = n ?? a, d = (N) => {
|
|
3783
|
+
n === void 0 && i(N), s?.(N);
|
|
3784
|
+
}, g = B(() => Nl(e), [e]), { events: r, width: _, axisFrom: o, axisTo: m } = g, b = ee(null), p = r.findIndex((N) => N.id === h), f = p >= 0 ? r[p] : void 0, x = r.length > 0;
|
|
3785
|
+
H(() => {
|
|
3786
|
+
const N = b.current;
|
|
3787
|
+
if (!N || !f || typeof N.scrollTo != "function") return;
|
|
3788
|
+
const C = f.cardX - (N.clientWidth - le) / 2;
|
|
3789
|
+
try {
|
|
3790
|
+
N.scrollTo({ left: Math.max(0, C), behavior: "smooth" });
|
|
3791
|
+
} catch {
|
|
3792
|
+
}
|
|
3793
|
+
}, [f]);
|
|
3794
|
+
const v = (N) => {
|
|
3795
|
+
const C = p < 0 ? N > 0 ? 0 : r.length - 1 : p + N, I = r[C];
|
|
3796
|
+
I && d(I.id);
|
|
3797
|
+
}, $ = e.categories ?? [], y = x && p >= 0 ? (p + 1) / r.length * 100 : 0, w = !!(e.brand || e.code || e.title || e.caption || e.meta);
|
|
3798
|
+
return /* @__PURE__ */ u("div", { className: k("tcl-timeline", c), children: [
|
|
3799
|
+
w && /* @__PURE__ */ u("header", { className: "tcl-timeline__header", children: [
|
|
3800
|
+
e.code && /* @__PURE__ */ t("span", { className: "tcl-timeline__code", "aria-hidden": "true", children: e.code }),
|
|
3801
|
+
/* @__PURE__ */ u("div", { className: "tcl-timeline__heading", children: [
|
|
3802
|
+
e.brand && /* @__PURE__ */ t("p", { className: "tcl-timeline__brand", children: e.brand }),
|
|
3803
|
+
e.title && /* @__PURE__ */ t("p", { className: "tcl-timeline__title", children: e.title }),
|
|
3804
|
+
e.caption && /* @__PURE__ */ t("p", { className: "tcl-timeline__caption", children: e.caption })
|
|
3805
|
+
] }),
|
|
3806
|
+
e.meta && /* @__PURE__ */ t("span", { className: "tcl-timeline__meta", children: e.meta })
|
|
3807
|
+
] }),
|
|
3808
|
+
x ? /* @__PURE__ */ t("div", { className: "tcl-timeline__scroller", ref: b, children: /* @__PURE__ */ u(
|
|
3809
|
+
"div",
|
|
3810
|
+
{
|
|
3811
|
+
className: "tcl-timeline__track",
|
|
3812
|
+
style: L({ width: `${_}px`, height: `${We}px` }),
|
|
3813
|
+
children: [
|
|
3814
|
+
/* @__PURE__ */ u(
|
|
3815
|
+
"svg",
|
|
3816
|
+
{
|
|
3817
|
+
className: "tcl-timeline__axis",
|
|
3818
|
+
width: _,
|
|
3819
|
+
height: We,
|
|
3820
|
+
viewBox: `0 0 ${_} ${We}`,
|
|
3821
|
+
"aria-hidden": "true",
|
|
3822
|
+
children: [
|
|
3823
|
+
/* @__PURE__ */ t(
|
|
3824
|
+
"line",
|
|
3825
|
+
{
|
|
3826
|
+
className: "tcl-timeline__rail",
|
|
3827
|
+
x1: o,
|
|
3828
|
+
y1: oe,
|
|
3829
|
+
x2: m,
|
|
3830
|
+
y2: oe
|
|
3831
|
+
}
|
|
3832
|
+
),
|
|
3833
|
+
r.map((N) => {
|
|
3834
|
+
const C = N.id === h, I = N.side === "above" ? N.cardY + Ce : oe, D = N.side === "above" ? oe : N.cardY;
|
|
3835
|
+
return /* @__PURE__ */ u(
|
|
3836
|
+
"g",
|
|
3837
|
+
{
|
|
3838
|
+
className: k("tcl-timeline__mark", C && "is-selected"),
|
|
3839
|
+
style: L({ "--event-tone": R(N.tone) }),
|
|
3840
|
+
children: [
|
|
3841
|
+
/* @__PURE__ */ t(
|
|
3842
|
+
"line",
|
|
3843
|
+
{
|
|
3844
|
+
className: "tcl-timeline__stem",
|
|
3845
|
+
x1: N.nodeX,
|
|
3846
|
+
y1: I,
|
|
3847
|
+
x2: N.nodeX,
|
|
3848
|
+
y2: D
|
|
3849
|
+
}
|
|
3850
|
+
),
|
|
3851
|
+
/* @__PURE__ */ t(
|
|
3852
|
+
"circle",
|
|
3853
|
+
{
|
|
3854
|
+
className: "tcl-timeline__node",
|
|
3855
|
+
cx: N.nodeX,
|
|
3856
|
+
cy: oe,
|
|
3857
|
+
r: C ? vt + 2 : vt
|
|
3858
|
+
}
|
|
3859
|
+
)
|
|
3860
|
+
]
|
|
3861
|
+
},
|
|
3862
|
+
N.id
|
|
3863
|
+
);
|
|
3864
|
+
})
|
|
3865
|
+
]
|
|
3866
|
+
}
|
|
3867
|
+
),
|
|
3868
|
+
/* @__PURE__ */ t(
|
|
3869
|
+
"div",
|
|
3870
|
+
{
|
|
3871
|
+
className: "tcl-timeline__events",
|
|
3872
|
+
role: "group",
|
|
3873
|
+
"aria-label": e.title ?? "Timeline",
|
|
3874
|
+
children: r.map((N) => {
|
|
3875
|
+
const C = N.id === h, I = `${N.dateText}: ${N.event.label}${N.categoryLabel ? ` — ${N.categoryLabel}` : ""}`;
|
|
3876
|
+
return /* @__PURE__ */ u(
|
|
3877
|
+
"button",
|
|
3878
|
+
{
|
|
3879
|
+
type: "button",
|
|
3880
|
+
"data-event-id": N.id,
|
|
3881
|
+
className: k(
|
|
3882
|
+
"tcl-timeline__event",
|
|
3883
|
+
`is-${N.side}`,
|
|
3884
|
+
C && "is-selected"
|
|
3885
|
+
),
|
|
3886
|
+
style: L({
|
|
3887
|
+
"--event-tone": R(N.tone),
|
|
3888
|
+
"--event-ink": _t(N.tone),
|
|
3889
|
+
left: `${N.cardX}px`,
|
|
3890
|
+
top: `${N.cardY}px`,
|
|
3891
|
+
width: `${le}px`,
|
|
3892
|
+
height: `${Ce}px`
|
|
3893
|
+
}),
|
|
3894
|
+
"aria-pressed": C,
|
|
3895
|
+
"aria-label": I,
|
|
3896
|
+
onClick: () => d(N.id),
|
|
3897
|
+
children: [
|
|
3898
|
+
/* @__PURE__ */ t("span", { className: "tcl-timeline__date", children: N.dateText }),
|
|
3899
|
+
N.event.sub && /* @__PURE__ */ t("span", { className: "tcl-timeline__sub", children: N.event.sub }),
|
|
3900
|
+
/* @__PURE__ */ t("span", { className: "tcl-timeline__label", title: N.event.label, children: N.event.label }),
|
|
3901
|
+
N.event.detail && /* @__PURE__ */ t("span", { className: "tcl-timeline__detail", children: N.event.detail }),
|
|
3902
|
+
N.categoryLabel && /* @__PURE__ */ t("span", { className: "tcl-timeline__tag", children: N.categoryLabel })
|
|
3903
|
+
]
|
|
3904
|
+
},
|
|
3905
|
+
N.id
|
|
3906
|
+
);
|
|
3907
|
+
})
|
|
3908
|
+
}
|
|
3909
|
+
)
|
|
3910
|
+
]
|
|
3911
|
+
}
|
|
3912
|
+
) }) : /* @__PURE__ */ t("p", { className: "tcl-timeline__empty", children: "No events to chronicle" }),
|
|
3913
|
+
x && /* @__PURE__ */ t("div", { className: "tcl-timeline__scrubber", "aria-hidden": "true", children: /* @__PURE__ */ t(
|
|
3914
|
+
"span",
|
|
3915
|
+
{
|
|
3916
|
+
className: "tcl-timeline__scrubber-fill",
|
|
3917
|
+
style: L({ "--progress": `${y}%` })
|
|
3918
|
+
}
|
|
3919
|
+
) }),
|
|
3920
|
+
/* @__PURE__ */ t("div", { className: "tcl-timeline__inspector", "aria-live": "polite", children: f ? /* @__PURE__ */ u(K, { children: [
|
|
3921
|
+
/* @__PURE__ */ u("p", { className: "tcl-timeline__inspector-title", children: [
|
|
3922
|
+
/* @__PURE__ */ t(
|
|
3923
|
+
"span",
|
|
3924
|
+
{
|
|
3925
|
+
className: "tcl-timeline__inspector-date",
|
|
3926
|
+
style: L({ "--event-ink": _t(f.tone) }),
|
|
3927
|
+
children: f.dateText
|
|
3928
|
+
}
|
|
3929
|
+
),
|
|
3930
|
+
" · ",
|
|
3931
|
+
f.event.label,
|
|
3932
|
+
f.categoryLabel && /* @__PURE__ */ u("span", { className: "tcl-timeline__inspector-cat", children: [
|
|
3933
|
+
" · ",
|
|
3934
|
+
f.categoryLabel
|
|
3935
|
+
] })
|
|
3936
|
+
] }),
|
|
3937
|
+
f.event.sub && /* @__PURE__ */ t("p", { className: "tcl-timeline__inspector-sub", children: f.event.sub }),
|
|
3938
|
+
f.event.note && /* @__PURE__ */ t("p", { className: "tcl-timeline__inspector-note", children: f.event.note })
|
|
3939
|
+
] }) : /* @__PURE__ */ t("p", { className: "tcl-timeline__inspector-hint", children: "Select an event to inspect it." }) }),
|
|
3940
|
+
(x || $.length > 0) && /* @__PURE__ */ u("div", { className: "tcl-timeline__footer", children: [
|
|
3941
|
+
/* @__PURE__ */ t(
|
|
3942
|
+
"button",
|
|
3943
|
+
{
|
|
3944
|
+
type: "button",
|
|
3945
|
+
className: "tcl-timeline__nav",
|
|
3946
|
+
"aria-label": "Previous event",
|
|
3947
|
+
disabled: !x || p === 0,
|
|
3948
|
+
onClick: () => v(-1),
|
|
3949
|
+
children: /* @__PURE__ */ t("span", { "aria-hidden": "true", children: "◀" })
|
|
3950
|
+
}
|
|
3951
|
+
),
|
|
3952
|
+
$.length > 0 && /* @__PURE__ */ t("ul", { className: "tcl-timeline__legend", children: $.map((N) => /* @__PURE__ */ u("li", { className: "tcl-timeline__legend-item", children: [
|
|
3953
|
+
/* @__PURE__ */ t(
|
|
3954
|
+
"span",
|
|
3955
|
+
{
|
|
3956
|
+
className: "tcl-timeline__legend-dot",
|
|
3957
|
+
style: L({ "--event-tone": R(N.tone ?? "neutral") }),
|
|
3958
|
+
"aria-hidden": "true"
|
|
3959
|
+
}
|
|
3960
|
+
),
|
|
3961
|
+
N.label
|
|
3962
|
+
] }, N.key)) }),
|
|
3963
|
+
/* @__PURE__ */ t(
|
|
3964
|
+
"button",
|
|
3965
|
+
{
|
|
3966
|
+
type: "button",
|
|
3967
|
+
className: "tcl-timeline__nav",
|
|
3968
|
+
"aria-label": "Next event",
|
|
3969
|
+
disabled: !x || p === r.length - 1,
|
|
3970
|
+
onClick: () => v(1),
|
|
3971
|
+
children: /* @__PURE__ */ t("span", { "aria-hidden": "true", children: "▶" })
|
|
3972
|
+
}
|
|
3973
|
+
)
|
|
3974
|
+
] })
|
|
3975
|
+
] });
|
|
3976
|
+
}
|
|
3977
|
+
export {
|
|
3978
|
+
Wl as Avatar,
|
|
3979
|
+
kt as Badge,
|
|
3980
|
+
Ql as BarChart,
|
|
3981
|
+
Ut as Box,
|
|
3982
|
+
Zl as Brief,
|
|
3983
|
+
Qt as Button,
|
|
3984
|
+
is as Callout,
|
|
3985
|
+
Xl as Card,
|
|
3986
|
+
It as Checkbox,
|
|
3987
|
+
ds as DataStatusBar,
|
|
3988
|
+
El as Dialog,
|
|
3989
|
+
ns as DonutChart,
|
|
3990
|
+
os as EmptyState,
|
|
3991
|
+
ss as Funnel,
|
|
3992
|
+
ts as Gauge,
|
|
3993
|
+
ls as Heatmap,
|
|
3994
|
+
Gl as Hub,
|
|
3995
|
+
Ll as IconButton,
|
|
3996
|
+
Il as Inline,
|
|
3997
|
+
Tl as Input,
|
|
3998
|
+
es as LineChart,
|
|
3999
|
+
Al as Menu,
|
|
4000
|
+
Kl as Meter,
|
|
4001
|
+
Me as Portal,
|
|
4002
|
+
nt as Pressable,
|
|
4003
|
+
zl as Progress,
|
|
4004
|
+
Bl as RadioGroup,
|
|
4005
|
+
rs as RunHistory,
|
|
4006
|
+
Fl as Select,
|
|
4007
|
+
Yl as Skeleton,
|
|
4008
|
+
Ke as Slot,
|
|
4009
|
+
gn as Sparkline,
|
|
4010
|
+
Vl as Spinner,
|
|
4011
|
+
Ml as Stack,
|
|
4012
|
+
Ul as Stat,
|
|
4013
|
+
as as Swimlane,
|
|
4014
|
+
Ol as Switch,
|
|
4015
|
+
P as Table,
|
|
4016
|
+
Rl as Tabs,
|
|
4017
|
+
Sl as Text,
|
|
4018
|
+
Dl as Textarea,
|
|
4019
|
+
us as Timeline,
|
|
4020
|
+
Hl as ToastProvider,
|
|
4021
|
+
Pl as Tooltip,
|
|
4022
|
+
cs as Treemap,
|
|
4023
|
+
Kt as buildBoxStyle,
|
|
4024
|
+
xt as composeRefs,
|
|
4025
|
+
k as cx,
|
|
4026
|
+
Jl as fromMarkdown,
|
|
4027
|
+
ql as parseBrief,
|
|
4028
|
+
jt as setRef,
|
|
4029
|
+
wl as tokens,
|
|
4030
|
+
Vt as useAffordanceState,
|
|
4031
|
+
Ht as useComposedRefs,
|
|
4032
|
+
Cl as useDismissable,
|
|
4033
|
+
zt as useFocusTrap,
|
|
4034
|
+
kl as useReducedMotion,
|
|
4035
|
+
Yt as useReturnFocus,
|
|
4036
|
+
jl as useToast
|
|
4037
|
+
};
|
|
4038
|
+
//# sourceMappingURL=index.js.map
|