@codesweep-ai/ui 0.2.1-dev.20260830023458.856ea8f
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 +202 -0
- package/NOTICE +2 -0
- package/README.md +124 -0
- package/dist/BUILD.json +1 -0
- package/dist/chart.d.ts +3 -0
- package/dist/chart.d.ts.map +1 -0
- package/dist/chart.js +3 -0
- package/dist/code.d.ts +2 -0
- package/dist/code.d.ts.map +1 -0
- package/dist/code.js +2 -0
- package/dist/components/AgentStatus.d.ts +15 -0
- package/dist/components/AgentStatus.d.ts.map +1 -0
- package/dist/components/AgentStatus.js +38 -0
- package/dist/components/AgentTrace.d.ts +42 -0
- package/dist/components/AgentTrace.d.ts.map +1 -0
- package/dist/components/AgentTrace.js +140 -0
- package/dist/components/AppShell.d.ts +29 -0
- package/dist/components/AppShell.d.ts.map +1 -0
- package/dist/components/AppShell.js +71 -0
- package/dist/components/Button.d.ts +10 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +41 -0
- package/dist/components/Card.d.ts +19 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Card.js +96 -0
- package/dist/components/CardGroup.d.ts +16 -0
- package/dist/components/CardGroup.d.ts.map +1 -0
- package/dist/components/CardGroup.js +33 -0
- package/dist/components/CardGroupContext.d.ts +14 -0
- package/dist/components/CardGroupContext.d.ts.map +1 -0
- package/dist/components/CardGroupContext.js +8 -0
- package/dist/components/ChartFrame.d.ts +30 -0
- package/dist/components/ChartFrame.d.ts.map +1 -0
- package/dist/components/ChartFrame.js +96 -0
- package/dist/components/ChartTooltip.d.ts +22 -0
- package/dist/components/ChartTooltip.d.ts.map +1 -0
- package/dist/components/ChartTooltip.js +26 -0
- package/dist/components/CheckboxGroup.d.ts +37 -0
- package/dist/components/CheckboxGroup.d.ts.map +1 -0
- package/dist/components/CheckboxGroup.js +198 -0
- package/dist/components/Chip.d.ts +9 -0
- package/dist/components/Chip.d.ts.map +1 -0
- package/dist/components/Chip.js +31 -0
- package/dist/components/CodeBlock.d.ts +30 -0
- package/dist/components/CodeBlock.d.ts.map +1 -0
- package/dist/components/CodeBlock.js +112 -0
- package/dist/components/Dropdown.d.ts +28 -0
- package/dist/components/Dropdown.d.ts.map +1 -0
- package/dist/components/Dropdown.js +50 -0
- package/dist/components/EventLanes.d.ts +93 -0
- package/dist/components/EventLanes.d.ts.map +1 -0
- package/dist/components/EventLanes.js +445 -0
- package/dist/components/FormGroup.d.ts +29 -0
- package/dist/components/FormGroup.d.ts.map +1 -0
- package/dist/components/FormGroup.js +48 -0
- package/dist/components/HighlightText.d.ts +15 -0
- package/dist/components/HighlightText.d.ts.map +1 -0
- package/dist/components/HighlightText.js +28 -0
- package/dist/components/Input.d.ts +35 -0
- package/dist/components/Input.d.ts.map +1 -0
- package/dist/components/Input.js +61 -0
- package/dist/components/Legend.d.ts +21 -0
- package/dist/components/Legend.d.ts.map +1 -0
- package/dist/components/Legend.js +61 -0
- package/dist/components/LightweightMarkdown.d.ts +3 -0
- package/dist/components/LightweightMarkdown.d.ts.map +1 -0
- package/dist/components/LightweightMarkdown.js +249 -0
- package/dist/components/MarkdownMinimap.d.ts +7 -0
- package/dist/components/MarkdownMinimap.d.ts.map +1 -0
- package/dist/components/MarkdownMinimap.js +84 -0
- package/dist/components/MarkdownViewer.d.ts +51 -0
- package/dist/components/MarkdownViewer.d.ts.map +1 -0
- package/dist/components/MarkdownViewer.js +455 -0
- package/dist/components/MermaidDiagram.d.ts +11 -0
- package/dist/components/MermaidDiagram.d.ts.map +1 -0
- package/dist/components/MermaidDiagram.js +119 -0
- package/dist/components/Modal.d.ts +13 -0
- package/dist/components/Modal.d.ts.map +1 -0
- package/dist/components/Modal.js +91 -0
- package/dist/components/Panel.d.ts +13 -0
- package/dist/components/Panel.d.ts.map +1 -0
- package/dist/components/Panel.js +44 -0
- package/dist/components/PulseBadge.d.ts +15 -0
- package/dist/components/PulseBadge.d.ts.map +1 -0
- package/dist/components/PulseBadge.js +22 -0
- package/dist/components/RadioGroup.d.ts +20 -0
- package/dist/components/RadioGroup.d.ts.map +1 -0
- package/dist/components/RadioGroup.js +63 -0
- package/dist/components/RichMarkdownRenderer.d.ts +10 -0
- package/dist/components/RichMarkdownRenderer.d.ts.map +1 -0
- package/dist/components/RichMarkdownRenderer.js +18 -0
- package/dist/components/SearchInput.d.ts +25 -0
- package/dist/components/SearchInput.d.ts.map +1 -0
- package/dist/components/SearchInput.js +92 -0
- package/dist/components/SectionedTree.d.ts +36 -0
- package/dist/components/SectionedTree.d.ts.map +1 -0
- package/dist/components/SectionedTree.js +173 -0
- package/dist/components/SegmentedControl.d.ts +16 -0
- package/dist/components/SegmentedControl.d.ts.map +1 -0
- package/dist/components/SegmentedControl.js +48 -0
- package/dist/components/Skeleton.d.ts +8 -0
- package/dist/components/Skeleton.d.ts.map +1 -0
- package/dist/components/Skeleton.js +25 -0
- package/dist/components/SplitPane.d.ts +16 -0
- package/dist/components/SplitPane.d.ts.map +1 -0
- package/dist/components/SplitPane.js +118 -0
- package/dist/components/StatusBadge.d.ts +15 -0
- package/dist/components/StatusBadge.d.ts.map +1 -0
- package/dist/components/StatusBadge.js +40 -0
- package/dist/components/StreamingText.d.ts +20 -0
- package/dist/components/StreamingText.d.ts.map +1 -0
- package/dist/components/StreamingText.js +50 -0
- package/dist/components/Table.d.ts +62 -0
- package/dist/components/Table.d.ts.map +1 -0
- package/dist/components/Table.js +256 -0
- package/dist/components/ThemeToggle.d.ts +11 -0
- package/dist/components/ThemeToggle.d.ts.map +1 -0
- package/dist/components/ThemeToggle.js +55 -0
- package/dist/components/Toast.d.ts +8 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/Toast.js +51 -0
- package/dist/components/ToastContainer.d.ts +5 -0
- package/dist/components/ToastContainer.d.ts.map +1 -0
- package/dist/components/ToastContainer.js +29 -0
- package/dist/components/Tree.d.ts +50 -0
- package/dist/components/Tree.d.ts.map +1 -0
- package/dist/components/Tree.js +528 -0
- package/dist/components/TreeDnd.d.ts +18 -0
- package/dist/components/TreeDnd.d.ts.map +1 -0
- package/dist/components/TreeDnd.js +39 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/lib/accentToken.d.ts +3 -0
- package/dist/lib/accentToken.d.ts.map +1 -0
- package/dist/lib/accentToken.js +12 -0
- package/dist/lib/chartTheme.d.ts +45 -0
- package/dist/lib/chartTheme.d.ts.map +1 -0
- package/dist/lib/chartTheme.js +64 -0
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +11 -0
- package/dist/lib/forwardRefToRoot.d.ts +8 -0
- package/dist/lib/forwardRefToRoot.d.ts.map +1 -0
- package/dist/lib/forwardRefToRoot.js +18 -0
- package/dist/lib/markdownUrl.d.ts +5 -0
- package/dist/lib/markdownUrl.d.ts.map +1 -0
- package/dist/lib/markdownUrl.js +24 -0
- package/dist/lib/toast.d.ts +30 -0
- package/dist/lib/toast.d.ts.map +1 -0
- package/dist/lib/toast.js +34 -0
- package/dist/lib/useTheme.d.ts +22 -0
- package/dist/lib/useTheme.d.ts.map +1 -0
- package/dist/lib/useTheme.js +62 -0
- package/dist/markdown/rich.d.ts +10 -0
- package/dist/markdown/rich.d.ts.map +1 -0
- package/dist/markdown/rich.js +8 -0
- package/dist/markdown.d.ts +3 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +2 -0
- package/dist/mermaid.d.ts +2 -0
- package/dist/mermaid.d.ts.map +1 -0
- package/dist/mermaid.js +2 -0
- package/dist/minimap.d.ts +2 -0
- package/dist/minimap.d.ts.map +1 -0
- package/dist/minimap.js +2 -0
- package/dist/styles/base.css +98 -0
- package/dist/styles/components/agent-status.css +52 -0
- package/dist/styles/components/agent-trace.css +206 -0
- package/dist/styles/components/app-shell.css +195 -0
- package/dist/styles/components/button.css +172 -0
- package/dist/styles/components/card-group.css +20 -0
- package/dist/styles/components/card.css +200 -0
- package/dist/styles/components/chart-frame.css +144 -0
- package/dist/styles/components/chart-tooltip.css +54 -0
- package/dist/styles/components/checkbox-group.css +281 -0
- package/dist/styles/components/chip.css +61 -0
- package/dist/styles/components/code-block.css +215 -0
- package/dist/styles/components/dropdown.css +131 -0
- package/dist/styles/components/event-lanes.css +159 -0
- package/dist/styles/components/form-group.css +34 -0
- package/dist/styles/components/highlight-text.css +17 -0
- package/dist/styles/components/input.css +168 -0
- package/dist/styles/components/legend.css +80 -0
- package/dist/styles/components/markdown-minimap.css +13 -0
- package/dist/styles/components/markdown-viewer.css +354 -0
- package/dist/styles/components/mermaid-diagram.css +8 -0
- package/dist/styles/components/modal.css +167 -0
- package/dist/styles/components/panel.css +126 -0
- package/dist/styles/components/pulse-badge.css +56 -0
- package/dist/styles/components/radio-group.css +89 -0
- package/dist/styles/components/search-input.css +153 -0
- package/dist/styles/components/sectioned-tree.css +183 -0
- package/dist/styles/components/segmented-control.css +54 -0
- package/dist/styles/components/skeleton.css +21 -0
- package/dist/styles/components/split-pane.css +78 -0
- package/dist/styles/components/status-badge.css +94 -0
- package/dist/styles/components/streaming-text.css +38 -0
- package/dist/styles/components/table.css +235 -0
- package/dist/styles/components/theme-toggle.css +123 -0
- package/dist/styles/components/toast-container.css +34 -0
- package/dist/styles/components/toast.css +169 -0
- package/dist/styles/components/tree.css +375 -0
- package/dist/styles/components.css +37 -0
- package/dist/styles/core.css +3 -0
- package/dist/styles/markdown-content.css +368 -0
- package/dist/styles/print.css +55 -0
- package/dist/styles/reset.css +202 -0
- package/dist/styles/syntax.css +62 -0
- package/dist/styles/tokens.css +344 -0
- package/dist/styles/utilities.css +7 -0
- package/dist/testing/index.d.ts +39 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +119 -0
- package/package.json +138 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { forwardRefToRoot as e } from "../lib/forwardRefToRoot.js";
|
|
4
|
+
import { cn as t } from "../lib/cn.js";
|
|
5
|
+
import { Button as n } from "./Button.js";
|
|
6
|
+
import { Skeleton as r } from "./Skeleton.js";
|
|
7
|
+
import { Dropdown as i } from "./Dropdown.js";
|
|
8
|
+
import { SearchInput as a } from "./SearchInput.js";
|
|
9
|
+
import { useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
10
|
+
import { AlertCircle as ee, ArrowUpDown as te, ChevronDown as ne, ChevronLeft as re, ChevronRight as ie, ChevronUp as ae, Inbox as oe } from "lucide-react";
|
|
11
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
12
|
+
//#region src/components/Table.tsx
|
|
13
|
+
var se = 8;
|
|
14
|
+
function p(e) {
|
|
15
|
+
let t = e.currentTarget;
|
|
16
|
+
t.title = t.scrollWidth > t.clientWidth && t.textContent || "";
|
|
17
|
+
}
|
|
18
|
+
function m(e, t, n, r) {
|
|
19
|
+
let i = t.toLowerCase();
|
|
20
|
+
return (r === "all" ? n.filter((e) => e.searchValue) : n.filter((e) => e.id === r && e.searchValue)).some((t) => t.searchValue(e).toLowerCase().includes(i));
|
|
21
|
+
}
|
|
22
|
+
function h({ columns: e, data: h, rowKey: g, onSort: _, sort: v, onRowClick: y, selectedKey: b, fixed: ce, className: le, filterable: x, filterPlaceholder: ue = "Filter...", filter: S, onFilterChange: C, pageSize: w, page: T, onPageChange: E, loading: D, error: O, errorMessage: de, onRetry: k, emptyMessage: fe = "No results.", emptyHint: A, emptyAction: j }) {
|
|
23
|
+
let [pe, M] = u(""), [N, P] = u(""), [F, I] = u("all"), [L, R] = u(0), [z, B] = u(null), V = S ?? pe, H = T ?? L, U = l(null), W = l(/* @__PURE__ */ new Map()), me = o((e) => {
|
|
24
|
+
S === void 0 && M(e), C?.(e);
|
|
25
|
+
}, [S, C]), G = o((e) => {
|
|
26
|
+
let t = typeof e == "function" ? e(H) : e;
|
|
27
|
+
T === void 0 && R(t), E?.(t);
|
|
28
|
+
}, [
|
|
29
|
+
T,
|
|
30
|
+
E,
|
|
31
|
+
H
|
|
32
|
+
]);
|
|
33
|
+
s(() => (U.current !== null && clearTimeout(U.current), U.current = setTimeout(() => {
|
|
34
|
+
P(V);
|
|
35
|
+
}, 200), () => {
|
|
36
|
+
U.current !== null && clearTimeout(U.current);
|
|
37
|
+
}), [V]), s(() => {
|
|
38
|
+
G(0);
|
|
39
|
+
}, [N, F]);
|
|
40
|
+
let K = c(() => e.filter((e) => e.searchValue), [e]), q = x && K.length > 0, he = K.length > 1, J = c(() => !N || !q ? h : h.filter((t) => m(t, N, e, F)), [
|
|
41
|
+
h,
|
|
42
|
+
N,
|
|
43
|
+
e,
|
|
44
|
+
F,
|
|
45
|
+
q
|
|
46
|
+
]), Y = w && w > 0 ? Math.ceil(J.length / w) : 1, ge = w != null && w > 0 && J.length > w, X = c(() => !w || w <= 0 ? J : J.slice(H * w, (H + 1) * w), [
|
|
47
|
+
J,
|
|
48
|
+
H,
|
|
49
|
+
w
|
|
50
|
+
]), Z = c(() => X.map(g), [X, g]);
|
|
51
|
+
s(() => {
|
|
52
|
+
if (!y || Z.length === 0) {
|
|
53
|
+
B(null);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
B((e) => b != null && Z.includes(b) ? b : e != null && Z.includes(e) ? e : Z[0]);
|
|
57
|
+
}, [
|
|
58
|
+
y,
|
|
59
|
+
Z,
|
|
60
|
+
b
|
|
61
|
+
]);
|
|
62
|
+
let _e = o((e) => {
|
|
63
|
+
B(e), requestAnimationFrame(() => W.current.get(e)?.focus());
|
|
64
|
+
}, []), Q = (e) => {
|
|
65
|
+
if (!_) return;
|
|
66
|
+
let t = e.sortDirection ?? (v?.columnId === e.id && v.direction === "asc" ? "desc" : "asc");
|
|
67
|
+
_(e.id, t);
|
|
68
|
+
}, ve = o((e) => {
|
|
69
|
+
P(e);
|
|
70
|
+
}, []), $ = q ? N : void 0;
|
|
71
|
+
return /* @__PURE__ */ f("div", {
|
|
72
|
+
"data-component": "Table",
|
|
73
|
+
className: t("cs-component-table-27 ", le),
|
|
74
|
+
children: [
|
|
75
|
+
q && /* @__PURE__ */ f("div", {
|
|
76
|
+
className: "cs-component-table-28 ",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ d("div", {
|
|
79
|
+
className: "cs-component-table-29",
|
|
80
|
+
children: /* @__PURE__ */ d(a, {
|
|
81
|
+
value: V,
|
|
82
|
+
onChange: me,
|
|
83
|
+
onSearch: ve,
|
|
84
|
+
"aria-label": "Filter rows",
|
|
85
|
+
placeholder: ue,
|
|
86
|
+
minChars: 1,
|
|
87
|
+
debounceMs: 200
|
|
88
|
+
})
|
|
89
|
+
}),
|
|
90
|
+
he && /* @__PURE__ */ d(i, {
|
|
91
|
+
value: F,
|
|
92
|
+
onChange: I,
|
|
93
|
+
"aria-label": "Filter column",
|
|
94
|
+
options: [{
|
|
95
|
+
value: "all",
|
|
96
|
+
label: "All columns"
|
|
97
|
+
}, ...K.map((e) => ({
|
|
98
|
+
value: e.id,
|
|
99
|
+
label: e.header
|
|
100
|
+
}))]
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ d("span", {
|
|
103
|
+
role: "status",
|
|
104
|
+
"aria-live": "polite",
|
|
105
|
+
className: "cs-component-table-91",
|
|
106
|
+
children: N ? `${J.length} results` : `${h.length} rows`
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ f("table", {
|
|
111
|
+
className: t("cs-component-table-32 ", "cs-component-table-33"),
|
|
112
|
+
style: { tableLayout: ce ? "fixed" : void 0 },
|
|
113
|
+
children: [/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ d("tr", { children: e.map((e) => /* @__PURE__ */ d("th", {
|
|
114
|
+
className: t("cs-component-table-35 ", "cs-component-table-36 ", "cs-component-table-37 ", e.sortable && "cs-component-table-38 ", e.align === "right" && "cs-component-table-40", e.align === "center" && "cs-component-table-42", !e.align && "cs-component-table-43"),
|
|
115
|
+
style: { width: e.width },
|
|
116
|
+
onClick: () => e.sortable && Q(e),
|
|
117
|
+
tabIndex: e.sortable ? 0 : void 0,
|
|
118
|
+
role: e.sortable ? "columnheader" : void 0,
|
|
119
|
+
"aria-sort": v?.columnId === e.id ? v.direction === "asc" ? "ascending" : "descending" : e.sortable ? "none" : void 0,
|
|
120
|
+
onKeyDown: (t) => {
|
|
121
|
+
e.sortable && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), Q(e));
|
|
122
|
+
},
|
|
123
|
+
children: /* @__PURE__ */ f("span", {
|
|
124
|
+
className: "cs-component-table-51 ",
|
|
125
|
+
children: [e.header, e.sortable && v?.columnId === e.id ? v.direction === "asc" ? /* @__PURE__ */ d(ae, { className: "cs-component-table-53 " }) : /* @__PURE__ */ d(ne, { className: "cs-component-table-53 " }) : e.sortable ? /* @__PURE__ */ d(te, { className: "cs-component-table-54 " }) : null]
|
|
126
|
+
})
|
|
127
|
+
}, e.id)) }) }), /* @__PURE__ */ d("tbody", { children: D ? Array.from({ length: se }).map((t, n) => /* @__PURE__ */ d("tr", {
|
|
128
|
+
"data-testid": "table-loading-row",
|
|
129
|
+
children: e.map((e) => /* @__PURE__ */ d("td", {
|
|
130
|
+
className: "cs-component-table-58 ",
|
|
131
|
+
children: /* @__PURE__ */ d(r, { variant: "text" })
|
|
132
|
+
}, e.id))
|
|
133
|
+
}, `__skeleton-${n}`)) : O ? /* @__PURE__ */ d("tr", { children: /* @__PURE__ */ d("td", {
|
|
134
|
+
colSpan: e.length,
|
|
135
|
+
className: "cs-component-table-60 ",
|
|
136
|
+
children: /* @__PURE__ */ f("div", {
|
|
137
|
+
"data-testid": "table-error",
|
|
138
|
+
className: "cs-component-table-62 ",
|
|
139
|
+
children: [
|
|
140
|
+
/* @__PURE__ */ d(ee, { className: "cs-component-table-63 " }),
|
|
141
|
+
/* @__PURE__ */ d("div", {
|
|
142
|
+
className: "cs-component-table-64 ",
|
|
143
|
+
children: de ?? "Something went wrong"
|
|
144
|
+
}),
|
|
145
|
+
(typeof O == "string" ? O : O?.message) && /* @__PURE__ */ d("div", {
|
|
146
|
+
className: "cs-component-table-67 ",
|
|
147
|
+
children: typeof O == "string" ? O : O.message
|
|
148
|
+
}),
|
|
149
|
+
k && /* @__PURE__ */ d(n, {
|
|
150
|
+
variant: "secondary",
|
|
151
|
+
size: "sm",
|
|
152
|
+
onClick: k,
|
|
153
|
+
children: "Retry"
|
|
154
|
+
})
|
|
155
|
+
]
|
|
156
|
+
})
|
|
157
|
+
}) }) : X.length === 0 ? /* @__PURE__ */ d("tr", { children: /* @__PURE__ */ d("td", {
|
|
158
|
+
colSpan: e.length,
|
|
159
|
+
className: "cs-component-table-60 ",
|
|
160
|
+
children: /* @__PURE__ */ f("div", {
|
|
161
|
+
"data-testid": "table-empty",
|
|
162
|
+
className: "cs-component-table-62 ",
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ d(oe, { className: "cs-component-table-72 " }),
|
|
165
|
+
/* @__PURE__ */ d("div", {
|
|
166
|
+
className: "cs-component-table-64 ",
|
|
167
|
+
children: fe
|
|
168
|
+
}),
|
|
169
|
+
A && /* @__PURE__ */ d("div", {
|
|
170
|
+
className: "cs-component-table-67 ",
|
|
171
|
+
children: A
|
|
172
|
+
}),
|
|
173
|
+
j && /* @__PURE__ */ d(n, {
|
|
174
|
+
variant: "secondary",
|
|
175
|
+
size: "sm",
|
|
176
|
+
onClick: j.onClick,
|
|
177
|
+
children: j.label
|
|
178
|
+
})
|
|
179
|
+
]
|
|
180
|
+
})
|
|
181
|
+
}) }) : X.map((n) => {
|
|
182
|
+
let r = g(n), i = b != null && r === b;
|
|
183
|
+
return /* @__PURE__ */ d("tr", {
|
|
184
|
+
"data-table-row": r,
|
|
185
|
+
ref: (e) => {
|
|
186
|
+
e ? W.current.set(r, e) : W.current.delete(r);
|
|
187
|
+
},
|
|
188
|
+
onClick: y ? () => y(n) : void 0,
|
|
189
|
+
tabIndex: y ? r === z ? 0 : -1 : void 0,
|
|
190
|
+
"aria-current": y && i ? "true" : void 0,
|
|
191
|
+
onFocus: y ? () => B(r) : void 0,
|
|
192
|
+
onKeyDown: y ? (e) => {
|
|
193
|
+
if (e.key === "Enter" || e.key === " ") e.preventDefault(), e.stopPropagation(), y(n);
|
|
194
|
+
else if ([
|
|
195
|
+
"ArrowUp",
|
|
196
|
+
"ArrowDown",
|
|
197
|
+
"Home",
|
|
198
|
+
"End"
|
|
199
|
+
].includes(e.key)) {
|
|
200
|
+
e.preventDefault(), e.stopPropagation();
|
|
201
|
+
let t = Z.indexOf(r);
|
|
202
|
+
_e(Z[e.key === "Home" ? 0 : e.key === "End" ? Z.length - 1 : e.key === "ArrowUp" ? Math.max(0, t - 1) : Math.min(Z.length - 1, t + 1)]);
|
|
203
|
+
}
|
|
204
|
+
} : void 0,
|
|
205
|
+
className: t("cs-component-table-75", y && "cs-component-table-76", i ? "cs-component-table-77" : "cs-component-table-78"),
|
|
206
|
+
children: e.map((e) => /* @__PURE__ */ d("td", {
|
|
207
|
+
className: t("cs-component-table-35 ", "cs-component-table-79 ", e.align === "right" && "cs-component-table-81 ", e.align === "center" && "cs-component-table-42"),
|
|
208
|
+
children: e.wrap ? e.cell(n, $) : /* @__PURE__ */ d("div", {
|
|
209
|
+
className: "cs-component-table-83 ",
|
|
210
|
+
onMouseEnter: p,
|
|
211
|
+
children: e.cell(n, $)
|
|
212
|
+
})
|
|
213
|
+
}, e.id))
|
|
214
|
+
}, r);
|
|
215
|
+
}) })]
|
|
216
|
+
}),
|
|
217
|
+
ge && !D && !O && X.length > 0 && /* @__PURE__ */ f("div", {
|
|
218
|
+
className: "cs-component-table-84 ",
|
|
219
|
+
children: [
|
|
220
|
+
/* @__PURE__ */ f("div", {
|
|
221
|
+
className: "cs-component-table-85 ",
|
|
222
|
+
children: [/* @__PURE__ */ f(n, {
|
|
223
|
+
variant: "ghost",
|
|
224
|
+
size: "sm",
|
|
225
|
+
disabled: H === 0,
|
|
226
|
+
onClick: () => G((e) => Math.max(0, e - 1)),
|
|
227
|
+
children: [/* @__PURE__ */ d(re, { className: "cs-component-table-88 " }), "Prev"]
|
|
228
|
+
}), /* @__PURE__ */ f(n, {
|
|
229
|
+
variant: "ghost",
|
|
230
|
+
size: "sm",
|
|
231
|
+
disabled: H >= Y - 1,
|
|
232
|
+
onClick: () => G((e) => Math.min(Y - 1, e + 1)),
|
|
233
|
+
children: ["Next", /* @__PURE__ */ d(ie, { className: "cs-component-table-88 " })]
|
|
234
|
+
})]
|
|
235
|
+
}),
|
|
236
|
+
/* @__PURE__ */ f("span", {
|
|
237
|
+
className: "cs-component-table-91 ",
|
|
238
|
+
children: [
|
|
239
|
+
"Page ",
|
|
240
|
+
H + 1,
|
|
241
|
+
" of ",
|
|
242
|
+
Y
|
|
243
|
+
]
|
|
244
|
+
}),
|
|
245
|
+
/* @__PURE__ */ d("span", {
|
|
246
|
+
className: "cs-component-table-91 ",
|
|
247
|
+
children: N ? `${J.length} of ${h.length}` : `${h.length} rows`
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
})
|
|
251
|
+
]
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
var g = e(h);
|
|
255
|
+
//#endregion
|
|
256
|
+
export { g as Table };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface ThemeToggleProps {
|
|
2
|
+
variant?: "icon-cycle" | "radio-group";
|
|
3
|
+
className?: string;
|
|
4
|
+
/** localStorage key the mode persists under (default "cs-theme"). */
|
|
5
|
+
storageKey?: string;
|
|
6
|
+
/** Query parameter honoured for this load only (default "theme"); `false` disables it. */
|
|
7
|
+
urlParam?: string | false;
|
|
8
|
+
}
|
|
9
|
+
export declare const ThemeToggle: import("react").ForwardRefExoticComponent<ThemeToggleProps & import("react").RefAttributes<HTMLElement>>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ThemeToggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../src/components/ThemeToggle.tsx"],"names":[],"mappings":"AAQA,UAAU,gBAAgB;IACxB,OAAO,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAC3B;AAsED,eAAO,MAAM,WAAW,0GAAmE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { forwardRefToRoot as e } from "../lib/forwardRefToRoot.js";
|
|
4
|
+
import { cn as t } from "../lib/cn.js";
|
|
5
|
+
import { useTheme as n } from "../lib/useTheme.js";
|
|
6
|
+
import { Monitor as r, Moon as i, Sun as a } from "lucide-react";
|
|
7
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/ThemeToggle.tsx
|
|
9
|
+
function s({ variant: e = "icon-cycle", className: s, storageKey: c, urlParam: l }) {
|
|
10
|
+
let { mode: u, resolved: d, setMode: f, cycle: p } = n({
|
|
11
|
+
storageKey: c,
|
|
12
|
+
urlParam: l
|
|
13
|
+
});
|
|
14
|
+
if (e === "radio-group") {
|
|
15
|
+
let e = [
|
|
16
|
+
{
|
|
17
|
+
value: "light",
|
|
18
|
+
label: "Light"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: "dark",
|
|
22
|
+
label: "Dark"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "system",
|
|
26
|
+
label: `System (${d === "dark" ? "Dark" : "Light"})`
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
return /* @__PURE__ */ o("div", {
|
|
30
|
+
"data-component": "ThemeToggle",
|
|
31
|
+
role: "radiogroup",
|
|
32
|
+
"aria-label": "Theme",
|
|
33
|
+
className: t("cs-component-theme-toggle-24 ", s),
|
|
34
|
+
children: e.map((e) => /* @__PURE__ */ o("button", {
|
|
35
|
+
role: "radio",
|
|
36
|
+
"aria-checked": u === e.value,
|
|
37
|
+
onClick: () => f(e.value),
|
|
38
|
+
className: t("cs-component-theme-toggle-26 ", u === e.value ? "cs-component-theme-toggle-27 " : "cs-component-theme-toggle-28 "),
|
|
39
|
+
children: e.label
|
|
40
|
+
}, e.value))
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
let m = u === "light" ? a : u === "dark" ? i : r;
|
|
44
|
+
return /* @__PURE__ */ o("button", {
|
|
45
|
+
"data-component": "ThemeToggle",
|
|
46
|
+
onClick: p,
|
|
47
|
+
className: t("cs-component-theme-toggle-32 ", "cs-component-theme-toggle-33 ", "cs-component-theme-toggle-34 ", "cs-component-theme-toggle-35 ", "cs-component-theme-toggle-36 ", "cs-component-theme-toggle-37 ", s),
|
|
48
|
+
"aria-label": `Toggle theme. Current: ${u}`,
|
|
49
|
+
title: `Theme: ${u}. Click to cycle.`,
|
|
50
|
+
children: /* @__PURE__ */ o(m, { className: "cs-component-theme-toggle-42 " })
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
var c = e(s);
|
|
54
|
+
//#endregion
|
|
55
|
+
export { c as ThemeToggle };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToastItem } from "../lib/toast";
|
|
2
|
+
export interface ToastProps {
|
|
3
|
+
item: ToastItem;
|
|
4
|
+
onDismiss: () => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const Toast: import("react").ForwardRefExoticComponent<ToastProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/components/Toast.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,cAAc,CAAC;AAwB5D,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA8CD,eAAO,MAAM,KAAK,uGAA0D,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { forwardRefToRoot as e } from "../lib/forwardRefToRoot.js";
|
|
2
|
+
import { cn as t } from "../lib/cn.js";
|
|
3
|
+
import { AlertTriangle as n, CheckCircle as r, Info as i, X as a, XCircle as o } from "lucide-react";
|
|
4
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Toast.tsx
|
|
6
|
+
var l = {
|
|
7
|
+
success: r,
|
|
8
|
+
warning: n,
|
|
9
|
+
error: o,
|
|
10
|
+
info: i
|
|
11
|
+
}, u = {
|
|
12
|
+
success: "cs-component-toast-4",
|
|
13
|
+
warning: "cs-component-toast-5",
|
|
14
|
+
error: "cs-component-toast-6",
|
|
15
|
+
info: "cs-component-toast-7"
|
|
16
|
+
}, d = {
|
|
17
|
+
success: "cs-component-toast-8",
|
|
18
|
+
warning: "cs-component-toast-9",
|
|
19
|
+
error: "cs-component-toast-10",
|
|
20
|
+
info: "cs-component-toast-11"
|
|
21
|
+
};
|
|
22
|
+
function f({ item: e, onDismiss: n, className: r }) {
|
|
23
|
+
let i = l[e.variant], o = e.variant === "warning" || e.variant === "error";
|
|
24
|
+
return /* @__PURE__ */ c("div", {
|
|
25
|
+
"data-component": "Toast",
|
|
26
|
+
"data-variant": e.variant,
|
|
27
|
+
role: o ? "alert" : "status",
|
|
28
|
+
"aria-live": o ? "assertive" : "polite",
|
|
29
|
+
className: t("cs-toast-enter cs-component-toast-19 ", "cs-component-toast-20 ", "cs-component-toast-21 ", u[e.variant], r),
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ s(i, {
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
className: t("cs-component-toast-23 ", d[e.variant])
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ s("div", {
|
|
36
|
+
className: "cs-component-toast-24 ",
|
|
37
|
+
children: e.message
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ s("button", {
|
|
40
|
+
type: "button",
|
|
41
|
+
onClick: n,
|
|
42
|
+
"aria-label": "Dismiss notification",
|
|
43
|
+
className: "cs-component-toast-27 ",
|
|
44
|
+
children: /* @__PURE__ */ s(a, { className: "cs-component-toast-28 " })
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
var p = e(f);
|
|
50
|
+
//#endregion
|
|
51
|
+
export { p as Toast };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastContainer.d.ts","sourceRoot":"","sources":["../../src/components/ToastContainer.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6CD,eAAO,MAAM,cAAc,gHAA4E,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { forwardRefToRoot as e } from "../lib/forwardRefToRoot.js";
|
|
4
|
+
import { cn as t } from "../lib/cn.js";
|
|
5
|
+
import { Toast as n } from "./Toast.js";
|
|
6
|
+
import { subscribeToasts as r, toast as i } from "../lib/toast.js";
|
|
7
|
+
import { useEffect as a, useState as o } from "react";
|
|
8
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/ToastContainer.tsx
|
|
10
|
+
function c({ className: e }) {
|
|
11
|
+
let [c, l] = o([]);
|
|
12
|
+
return a(() => r(l), []), a(() => {
|
|
13
|
+
let e = [];
|
|
14
|
+
for (let t of c) t.duration && t.duration > 0 && e.push(window.setTimeout(() => i.dismiss(t.id), t.duration));
|
|
15
|
+
return () => {
|
|
16
|
+
for (let t of e) window.clearTimeout(t);
|
|
17
|
+
};
|
|
18
|
+
}, [c]), /* @__PURE__ */ s("div", {
|
|
19
|
+
"data-component": "ToastContainer",
|
|
20
|
+
className: t("cs-component-toast-container-6 ", "cs-component-toast-container-7 ", e),
|
|
21
|
+
children: c.map((e) => /* @__PURE__ */ s(n, {
|
|
22
|
+
item: e,
|
|
23
|
+
onDismiss: () => i.dismiss(e.id)
|
|
24
|
+
}, e.id))
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
var l = e(c);
|
|
28
|
+
//#endregion
|
|
29
|
+
export { l as ToastContainer };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type ReactElement, type RefAttributes } from "react";
|
|
2
|
+
export interface TreeNode {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: "branch" | "leaf";
|
|
6
|
+
children?: TreeNode[];
|
|
7
|
+
}
|
|
8
|
+
interface TreeProps<T extends TreeNode> {
|
|
9
|
+
nodes: T[];
|
|
10
|
+
expandedIds: Set<string>;
|
|
11
|
+
selectedId?: string | null;
|
|
12
|
+
onSelect?: (node: T) => void;
|
|
13
|
+
onToggle?: (nodeId: string) => void;
|
|
14
|
+
className?: string;
|
|
15
|
+
renderLabel?: (node: T) => React.ReactNode;
|
|
16
|
+
/** Opt-in search/filter toolbar */
|
|
17
|
+
filterable?: boolean;
|
|
18
|
+
/** Placeholder for the filter input */
|
|
19
|
+
filterPlaceholder?: string;
|
|
20
|
+
/** Callback to toggle expand-all state */
|
|
21
|
+
onToggleExpandAll?: () => void;
|
|
22
|
+
/** Whether all nodes are currently expanded */
|
|
23
|
+
allExpanded?: boolean;
|
|
24
|
+
/** Mirror the tree: indent right-to-left, right-align content */
|
|
25
|
+
flipped?: boolean;
|
|
26
|
+
/** Enable drag-to-reorder within sibling groups */
|
|
27
|
+
reorderable?: boolean;
|
|
28
|
+
/** Called when items are reordered via drag */
|
|
29
|
+
onReorder?: (parentId: string | null, orderedIds: string[]) => void;
|
|
30
|
+
/** Loading state: render skeleton rows instead of nodes. */
|
|
31
|
+
loading?: boolean;
|
|
32
|
+
/** Error state: when set (Error or string), render the error block. */
|
|
33
|
+
error?: Error | string | null;
|
|
34
|
+
/** Override the error primary text (default: "Something went wrong"). */
|
|
35
|
+
errorMessage?: string;
|
|
36
|
+
/** Retry handler — when provided, renders a Retry button in the error block. */
|
|
37
|
+
onRetry?: () => void;
|
|
38
|
+
/** Empty state primary text. Default: "No nodes." */
|
|
39
|
+
emptyMessage?: string;
|
|
40
|
+
/** Empty state secondary text. */
|
|
41
|
+
emptyHint?: string;
|
|
42
|
+
/** Empty state CTA. */
|
|
43
|
+
emptyAction?: {
|
|
44
|
+
label: string;
|
|
45
|
+
onClick: () => void;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export declare const Tree: <T extends TreeNode>(props: TreeProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=Tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../src/components/Tree.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AA+BjI,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,UAAU,SAAS,CAAC,CAAC,SAAS,QAAQ;IACpC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAC3C,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uCAAuC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,+CAA+C;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpE,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uEAAuE;IACvE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;IAC9B,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;CACtD;AA29BD,eAAO,MAAM,IAAI,EAAkB,CAAC,CAAC,SAAS,QAAQ,EACpD,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,cAAc,CAAC,KAChD,YAAY,GAAG,IAAI,CAAC"}
|