@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,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn as e } from "../lib/cn.js";
|
|
4
|
+
import { forwardRef as t, useEffect as n, useId as r, useRef as i } from "react";
|
|
5
|
+
import { X as a } from "lucide-react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal as c } from "react-dom";
|
|
8
|
+
//#region src/components/Modal.tsx
|
|
9
|
+
var l = t(function({ title: t, children: l, actions: u, onClose: d, maxWidth: f = "var(--modal-max-width)", className: p, initialFocus: m }, h) {
|
|
10
|
+
let g = i(null), _ = i(null), v = i(null), y = r();
|
|
11
|
+
return n(() => {
|
|
12
|
+
v.current = document.activeElement;
|
|
13
|
+
let e = (e) => {
|
|
14
|
+
e.key === "Escape" && d();
|
|
15
|
+
};
|
|
16
|
+
document.addEventListener("keydown", e), document.body.style.overflow = "hidden";
|
|
17
|
+
let t = Array.from(new Set([...Array.from(document.body.children).filter((e) => e !== _.current && e.getAttribute("data-component") !== "Modal"), ...Array.from(document.querySelectorAll("main, header, footer")).filter((e) => !_.current?.contains(e))])), n = t.map((e) => ({
|
|
18
|
+
element: e,
|
|
19
|
+
inert: e.inert,
|
|
20
|
+
ariaHidden: e.getAttribute("aria-hidden")
|
|
21
|
+
}));
|
|
22
|
+
return t.forEach((e) => {
|
|
23
|
+
e.inert = !0, e.setAttribute("aria-hidden", "true");
|
|
24
|
+
}), () => {
|
|
25
|
+
document.removeEventListener("keydown", e), document.body.style.overflow = "", n.forEach(({ element: e, inert: t, ariaHidden: n }) => {
|
|
26
|
+
e.inert = t, n === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", n);
|
|
27
|
+
}), v.current?.focus?.();
|
|
28
|
+
};
|
|
29
|
+
}, [d]), n(() => {
|
|
30
|
+
let e = g.current;
|
|
31
|
+
e && (m?.current ?? e.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])"))?.focus();
|
|
32
|
+
}, [m]), c(/* @__PURE__ */ o("div", {
|
|
33
|
+
ref: (e) => {
|
|
34
|
+
_.current = e, typeof h == "function" ? h(e) : h && (h.current = e);
|
|
35
|
+
},
|
|
36
|
+
"data-component": "Modal",
|
|
37
|
+
className: e("cs-component-modal-14 ", p),
|
|
38
|
+
onClick: (e) => {
|
|
39
|
+
e.target === e.currentTarget && d();
|
|
40
|
+
},
|
|
41
|
+
children: /* @__PURE__ */ s("div", {
|
|
42
|
+
ref: g,
|
|
43
|
+
"data-modal-dialog": "",
|
|
44
|
+
role: "dialog",
|
|
45
|
+
"aria-modal": "true",
|
|
46
|
+
"aria-labelledby": y,
|
|
47
|
+
className: e("cs-component-modal-18 ", "cs-component-modal-19 ", "cs-component-modal-20 "),
|
|
48
|
+
style: {
|
|
49
|
+
maxWidth: f,
|
|
50
|
+
width: "calc(100% - var(--space-6))",
|
|
51
|
+
maxHeight: "var(--modal-max-height)"
|
|
52
|
+
},
|
|
53
|
+
onClick: (e) => e.stopPropagation(),
|
|
54
|
+
onKeyDown: (e) => {
|
|
55
|
+
if (e.key !== "Tab") return;
|
|
56
|
+
let t = g.current?.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])");
|
|
57
|
+
if (!t || t.length === 0) return;
|
|
58
|
+
let n = t[0], r = t[t.length - 1];
|
|
59
|
+
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
60
|
+
},
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ s("div", {
|
|
63
|
+
className: "cs-component-modal-23 ",
|
|
64
|
+
children: [/* @__PURE__ */ o("h2", {
|
|
65
|
+
id: y,
|
|
66
|
+
"data-modal-title": "",
|
|
67
|
+
className: "cs-component-modal-25 ",
|
|
68
|
+
children: t
|
|
69
|
+
}), /* @__PURE__ */ o("button", {
|
|
70
|
+
"data-modal-close": "",
|
|
71
|
+
onClick: d,
|
|
72
|
+
className: "cs-component-modal-26 ",
|
|
73
|
+
"aria-label": "Close dialog",
|
|
74
|
+
children: /* @__PURE__ */ o(a, { className: "cs-component-modal-28 " })
|
|
75
|
+
})]
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ o("div", {
|
|
78
|
+
"data-modal-content": "",
|
|
79
|
+
className: "cs-component-modal-29 ",
|
|
80
|
+
children: l
|
|
81
|
+
}),
|
|
82
|
+
u && /* @__PURE__ */ o("div", {
|
|
83
|
+
className: "cs-component-modal-30 ",
|
|
84
|
+
children: u
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
})
|
|
88
|
+
}), document.body);
|
|
89
|
+
});
|
|
90
|
+
//#endregion
|
|
91
|
+
export { l as Modal };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface PanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
2
|
+
/** Heading, and the accessible name of the group. */
|
|
3
|
+
title: string;
|
|
4
|
+
width?: number | string;
|
|
5
|
+
collapsed?: boolean;
|
|
6
|
+
onCollapse?: () => void;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
actions?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const Panel: import("react").ForwardRefExoticComponent<PanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=Panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../src/components/Panel.tsx"],"names":[],"mappings":"AAIA,UAAU,UAAW,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAC9E,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAuDD,eAAO,MAAM,KAAK,uGAA0D,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { forwardRefToRoot as e } from "../lib/forwardRefToRoot.js";
|
|
2
|
+
import { cn as t } from "../lib/cn.js";
|
|
3
|
+
import { PanelLeftClose as n } from "lucide-react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Panel.tsx
|
|
6
|
+
function a({ title: e, width: a, collapsed: o, onCollapse: s, children: c, className: l, actions: u, ...d }) {
|
|
7
|
+
return /* @__PURE__ */ i("div", {
|
|
8
|
+
role: "group",
|
|
9
|
+
"aria-label": e,
|
|
10
|
+
...d,
|
|
11
|
+
"data-component": "Panel",
|
|
12
|
+
className: t("cs-component-panel-4 ", o && "cs-component-panel-5 ", l),
|
|
13
|
+
style: {
|
|
14
|
+
width: o ? 0 : typeof a == "number" ? `${a}px` : a,
|
|
15
|
+
flexShrink: o || a ? 0 : void 0,
|
|
16
|
+
flex: o || a ? void 0 : 1,
|
|
17
|
+
minWidth: o ? 0 : a ? void 0 : 0,
|
|
18
|
+
overflow: o ? "hidden" : void 0,
|
|
19
|
+
transition: "width var(--transition-normal)"
|
|
20
|
+
},
|
|
21
|
+
children: [/* @__PURE__ */ i("div", {
|
|
22
|
+
className: "cs-component-panel-11 ",
|
|
23
|
+
children: [/* @__PURE__ */ r("span", {
|
|
24
|
+
className: "text-label-upper cs-component-panel-12",
|
|
25
|
+
children: e
|
|
26
|
+
}), /* @__PURE__ */ i("div", {
|
|
27
|
+
className: "cs-component-panel-13 ",
|
|
28
|
+
children: [u, s && /* @__PURE__ */ r("button", {
|
|
29
|
+
onClick: s,
|
|
30
|
+
className: "cs-component-panel-14 ",
|
|
31
|
+
"aria-label": o ? `Expand ${e} panel` : `Collapse ${e} panel`,
|
|
32
|
+
"aria-expanded": !o,
|
|
33
|
+
children: /* @__PURE__ */ r(n, { className: "cs-component-panel-19 " })
|
|
34
|
+
})]
|
|
35
|
+
})]
|
|
36
|
+
}), !o && /* @__PURE__ */ r("div", {
|
|
37
|
+
className: "cs-component-panel-20 ",
|
|
38
|
+
children: c
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
var o = e(a);
|
|
43
|
+
//#endregion
|
|
44
|
+
export { o as Panel };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface PulseBadgeProps {
|
|
2
|
+
/** Disable the pulse animation (renders a static dot). Default: false */
|
|
3
|
+
paused?: boolean;
|
|
4
|
+
/** Dot size. Default: "md" */
|
|
5
|
+
size?: "sm" | "md" | "lg";
|
|
6
|
+
/** CSS color (token-friendly). Default: var(--color-accent) */
|
|
7
|
+
color?: string;
|
|
8
|
+
/** Accessible label. Defaults to "Live activity". */
|
|
9
|
+
"aria-label"?: string;
|
|
10
|
+
/** Additional className. */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const PulseBadge: import("react").ForwardRefExoticComponent<PulseBadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=PulseBadge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PulseBadge.d.ts","sourceRoot":"","sources":["../../src/components/PulseBadge.tsx"],"names":[],"mappings":"AAIA,UAAU,eAAe;IACvB,yEAAyE;IACzE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoCD,eAAO,MAAM,UAAU,6GAAqE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { forwardRefToRoot as e } from "../lib/forwardRefToRoot.js";
|
|
2
|
+
import { cn as t } from "../lib/cn.js";
|
|
3
|
+
import { accentToken as n } from "../lib/accentToken.js";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/PulseBadge.tsx
|
|
6
|
+
var i = {
|
|
7
|
+
sm: "cs-component-pulse-badge-9",
|
|
8
|
+
md: "cs-component-pulse-badge-10 ",
|
|
9
|
+
lg: "cs-component-pulse-badge-11"
|
|
10
|
+
};
|
|
11
|
+
function a({ paused: e = !1, size: a = "md", color: o, className: s, "aria-label": c = "Live activity" }) {
|
|
12
|
+
return /* @__PURE__ */ r("span", {
|
|
13
|
+
"data-component": "PulseBadge",
|
|
14
|
+
role: "status",
|
|
15
|
+
"aria-label": c,
|
|
16
|
+
className: t(e ? "cs-component-pulse-badge-17 " : "cs-pulse", i[a], "cs-component-pulse-badge-19", s),
|
|
17
|
+
style: { background: o ?? n() }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
var o = e(a);
|
|
21
|
+
//#endregion
|
|
22
|
+
export { o as PulseBadge };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface RadioOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: React.ReactNode;
|
|
4
|
+
/** Secondary line under the label — a cost, a caveat, a "use when". */
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** Accessible name, when the label alone does not read well out of context. */
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
11
|
+
options: RadioOption[];
|
|
12
|
+
value: string;
|
|
13
|
+
onChange: (value: string) => void;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Stacked by default; `horizontal` for a short row of short labels. */
|
|
16
|
+
orientation?: "vertical" | "horizontal";
|
|
17
|
+
}
|
|
18
|
+
export declare const RadioGroup: import("react").ForwardRefExoticComponent<RadioGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=RadioGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../src/components/RadioGroup.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,uEAAuE;IACvE,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,eAAgB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACtF,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;CACzC;AAmHD,eAAO,MAAM,UAAU,4GAAoE,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 { useRef as n } from "react";
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/RadioGroup.tsx
|
|
8
|
+
function a({ options: e, value: a, onChange: o, disabled: s = !1, orientation: c = "vertical", className: l, "aria-label": u = "Options", ...d }) {
|
|
9
|
+
if (e.length < 2) throw Error("RadioGroup requires at least 2 options");
|
|
10
|
+
let f = n([]), p = e.map((e, t) => !s && !e.disabled ? t : -1).filter((e) => e >= 0), m = e.findIndex((e) => e.value === a), h = p.includes(m) ? m : p[0], g = (t) => {
|
|
11
|
+
f.current[t]?.focus(), o(e[t].value);
|
|
12
|
+
}, _ = (e, t) => {
|
|
13
|
+
let n = p.indexOf(t);
|
|
14
|
+
if (n < 0 || p.length === 0) return;
|
|
15
|
+
let r;
|
|
16
|
+
e.key === "ArrowDown" || e.key === "ArrowRight" ? r = p[(n + 1) % p.length] : e.key === "ArrowUp" || e.key === "ArrowLeft" ? r = p[(n - 1 + p.length) % p.length] : e.key === "Home" ? r = p[0] : e.key === "End" && (r = p[p.length - 1]), r != null && (e.preventDefault(), g(r));
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ r("div", {
|
|
19
|
+
...d,
|
|
20
|
+
"data-component": "RadioGroup",
|
|
21
|
+
"data-radio-orientation": c,
|
|
22
|
+
role: "radiogroup",
|
|
23
|
+
"aria-label": u,
|
|
24
|
+
className: t("cs-component-radio-group-1", c === "horizontal" ? "cs-component-radio-group-2" : "cs-component-radio-group-3", l),
|
|
25
|
+
children: e.map((e, n) => {
|
|
26
|
+
let c = e.value === a, l = s || e.disabled;
|
|
27
|
+
return /* @__PURE__ */ i("button", {
|
|
28
|
+
"data-radio-option": e.value,
|
|
29
|
+
"data-radio-active": c ? "" : void 0,
|
|
30
|
+
ref: (e) => {
|
|
31
|
+
f.current[n] = e;
|
|
32
|
+
},
|
|
33
|
+
type: "button",
|
|
34
|
+
role: "radio",
|
|
35
|
+
"aria-checked": c,
|
|
36
|
+
"aria-label": e.ariaLabel,
|
|
37
|
+
disabled: l,
|
|
38
|
+
tabIndex: n === h ? 0 : -1,
|
|
39
|
+
onClick: () => o(e.value),
|
|
40
|
+
onKeyDown: (e) => _(e, n),
|
|
41
|
+
className: t("cs-component-radio-group-4", c && "cs-component-radio-group-5", l && "cs-component-radio-group-6"),
|
|
42
|
+
children: [/* @__PURE__ */ r("span", {
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
className: "cs-component-radio-group-7"
|
|
45
|
+
}), /* @__PURE__ */ i("span", {
|
|
46
|
+
className: "cs-component-radio-group-8",
|
|
47
|
+
children: [/* @__PURE__ */ r("span", {
|
|
48
|
+
"data-radio-label": "",
|
|
49
|
+
className: "cs-component-radio-group-9",
|
|
50
|
+
children: e.label
|
|
51
|
+
}), e.description && /* @__PURE__ */ r("span", {
|
|
52
|
+
"data-radio-description": "",
|
|
53
|
+
className: "cs-component-radio-group-10",
|
|
54
|
+
children: e.description
|
|
55
|
+
})]
|
|
56
|
+
})]
|
|
57
|
+
}, e.value);
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
var o = e(a);
|
|
62
|
+
//#endregion
|
|
63
|
+
export { o as RadioGroup };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PluggableList } from "unified";
|
|
2
|
+
import type { MarkdownRendererProps } from "./MarkdownViewer";
|
|
3
|
+
export interface RichMarkdownOptions {
|
|
4
|
+
/** Extra remark plugins. GFM is always enabled before these plugins. */
|
|
5
|
+
remarkPlugins?: PluggableList;
|
|
6
|
+
/** Extra rehype plugins. Heading slugs are always enabled before these plugins. */
|
|
7
|
+
rehypePlugins?: PluggableList;
|
|
8
|
+
}
|
|
9
|
+
export declare function RichMarkdownRenderer({ content, components, remarkPlugins, rehypePlugins, }: MarkdownRendererProps & RichMarkdownOptions): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=RichMarkdownRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichMarkdownRenderer.d.ts","sourceRoot":"","sources":["../../src/components/RichMarkdownRenderer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG9D,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,mFAAmF;IACnF,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,UAAU,EACV,aAAa,EACb,aAAa,GACd,EAAE,qBAAqB,GAAG,mBAAmB,2CAe7C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { sanitizeMarkdownUrl as e } from "../lib/markdownUrl.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import n from "react-markdown";
|
|
4
|
+
import r from "rehype-slug";
|
|
5
|
+
import i from "remark-gfm";
|
|
6
|
+
//#region src/components/RichMarkdownRenderer.tsx
|
|
7
|
+
function a({ content: a, components: o, remarkPlugins: s, rehypePlugins: c }) {
|
|
8
|
+
return /* @__PURE__ */ t(n, {
|
|
9
|
+
remarkRehypeOptions: { footnoteBackContent: "↑" },
|
|
10
|
+
remarkPlugins: [i, ...s ?? []],
|
|
11
|
+
rehypePlugins: [r, ...c ?? []],
|
|
12
|
+
components: o,
|
|
13
|
+
urlTransform: e,
|
|
14
|
+
children: a
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { a as RichMarkdownRenderer };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface SearchInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "onKeyDown" | "placeholder" | "disabled" | "className" | "type" | "children"> {
|
|
2
|
+
value: string;
|
|
3
|
+
onChange: (value: string) => void;
|
|
4
|
+
onSearch: (value: string) => void;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** Min characters before auto-search fires. 0 = no auto-search (manual only). Default: 0 */
|
|
8
|
+
minChars?: number;
|
|
9
|
+
/** Debounce delay in ms for auto-search. Default: 300 */
|
|
10
|
+
debounceMs?: number;
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* When true, render a "no results" message inline below the input.
|
|
14
|
+
* Consumers set this based on their search result state. Default: false.
|
|
15
|
+
* Added v1.2.0.
|
|
16
|
+
*/
|
|
17
|
+
noResults?: boolean;
|
|
18
|
+
/** Message shown when noResults=true. Default: "No results." */
|
|
19
|
+
noResultsMessage?: string;
|
|
20
|
+
/** Optional result/status content displayed below the input. */
|
|
21
|
+
status?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare const SearchInput: import("react").ForwardRefExoticComponent<SearchInputProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=SearchInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchInput.d.ts","sourceRoot":"","sources":["../../src/components/SearchInput.tsx"],"names":[],"mappings":"AAQA,UAAU,gBAAiB,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;IACvL,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAiLD,eAAO,MAAM,WAAW,6GAAsE,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
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 { useCallback as n, useEffect as r, useRef as i } from "react";
|
|
6
|
+
import { Search as a, X as o } from "lucide-react";
|
|
7
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/SearchInput.tsx
|
|
9
|
+
function l({ value: e, onChange: l, onSearch: u, placeholder: d = "Search...", disabled: f = !1, minChars: p = 0, debounceMs: m = 300, className: h, noResults: g = !1, noResultsMessage: _ = "No results.", status: v, "aria-label": y, ...b }) {
|
|
10
|
+
let x = i(null), S = i(null), C = i(u), w = i(!1);
|
|
11
|
+
r(() => {
|
|
12
|
+
C.current = u;
|
|
13
|
+
}, [u]);
|
|
14
|
+
let T = n((e) => {
|
|
15
|
+
e === "" && (w.current = !1), C.current(e);
|
|
16
|
+
}, []), E = n(() => {
|
|
17
|
+
x.current !== null && (clearTimeout(x.current), x.current = null);
|
|
18
|
+
}, []);
|
|
19
|
+
r(() => {
|
|
20
|
+
if (!(p <= 0)) return E(), e.length >= p && (w.current = !0), (e.length >= p || e.length === 0 && w.current) && (x.current = setTimeout(() => {
|
|
21
|
+
T(e);
|
|
22
|
+
}, m)), E;
|
|
23
|
+
}, [
|
|
24
|
+
e,
|
|
25
|
+
p,
|
|
26
|
+
m,
|
|
27
|
+
E,
|
|
28
|
+
T
|
|
29
|
+
]);
|
|
30
|
+
let D = () => {
|
|
31
|
+
l(""), T(""), S.current?.focus();
|
|
32
|
+
}, O = (t) => {
|
|
33
|
+
t.key === "Enter" ? (E(), T(e)) : t.key === "Escape" && D();
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ c("div", {
|
|
36
|
+
"data-component": "SearchInput",
|
|
37
|
+
className: t("cs-component-search-input-11 ", f && "cs-component-search-input-12 ", h),
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ c("div", {
|
|
40
|
+
className: t("cs-component-search-input-13 ", "cs-component-search-input-14 ", "cs-component-search-input-15", "cs-component-search-input-16 ", "cs-component-search-input-17", "cs-component-search-input-18"),
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ s("input", {
|
|
43
|
+
...b,
|
|
44
|
+
"data-search-input": "",
|
|
45
|
+
ref: S,
|
|
46
|
+
type: "text",
|
|
47
|
+
value: e,
|
|
48
|
+
onChange: (e) => l(e.target.value),
|
|
49
|
+
onKeyDown: O,
|
|
50
|
+
placeholder: d,
|
|
51
|
+
"aria-label": y ?? d,
|
|
52
|
+
disabled: f,
|
|
53
|
+
className: t("cs-component-search-input-20 ", "cs-component-search-input-21 ", "cs-component-search-input-22 ", "cs-component-search-input-23 ", "cs-component-search-input-24", "cs-component-search-input-25", f && "cs-component-search-input-26")
|
|
54
|
+
}),
|
|
55
|
+
e.length > 0 && /* @__PURE__ */ s("button", {
|
|
56
|
+
type: "button",
|
|
57
|
+
onClick: D,
|
|
58
|
+
disabled: f,
|
|
59
|
+
className: t("cs-component-search-input-28 ", "cs-component-search-input-29 ", "cs-component-search-input-21 ", "cs-component-search-input-30 ", f && "cs-component-search-input-31 "),
|
|
60
|
+
"aria-label": "Clear search",
|
|
61
|
+
children: /* @__PURE__ */ s(o, { className: "cs-component-search-input-33 " })
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ s("button", {
|
|
64
|
+
"data-search-submit": "",
|
|
65
|
+
type: "button",
|
|
66
|
+
onClick: () => {
|
|
67
|
+
E(), T(e);
|
|
68
|
+
},
|
|
69
|
+
disabled: f,
|
|
70
|
+
className: t("cs-component-search-input-28 ", "cs-component-search-input-29 ", "cs-component-search-input-21 ", "cs-component-search-input-30 ", f && "cs-component-search-input-31 "),
|
|
71
|
+
"aria-label": "Search",
|
|
72
|
+
children: /* @__PURE__ */ s(a, { className: "cs-component-search-input-33 " })
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
}),
|
|
76
|
+
g && e.length > 0 && /* @__PURE__ */ s("span", {
|
|
77
|
+
"data-testid": "searchinput-noresults",
|
|
78
|
+
className: "cs-component-search-input-37 ",
|
|
79
|
+
children: _
|
|
80
|
+
}),
|
|
81
|
+
v && /* @__PURE__ */ s("div", {
|
|
82
|
+
"data-search-status": "",
|
|
83
|
+
role: "status",
|
|
84
|
+
className: "cs-component-search-input-37",
|
|
85
|
+
children: v
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
var u = e(l);
|
|
91
|
+
//#endregion
|
|
92
|
+
export { u as SearchInput };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ReactElement, type RefAttributes } from "react";
|
|
2
|
+
import { type TreeNode } from "./Tree";
|
|
3
|
+
export interface TreeSection<T extends TreeNode = TreeNode> {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
nodes: T[];
|
|
7
|
+
}
|
|
8
|
+
interface SectionedTreeProps<T extends TreeNode = TreeNode> {
|
|
9
|
+
sections: TreeSection<T>[];
|
|
10
|
+
selectedId?: string | null;
|
|
11
|
+
onSelect?: (node: T) => void;
|
|
12
|
+
className?: string;
|
|
13
|
+
renderLabel?: (node: T) => React.ReactNode;
|
|
14
|
+
/** Mirror the tree: indent right-to-left, right-align content */
|
|
15
|
+
flipped?: boolean;
|
|
16
|
+
/** Loading state: render skeleton sections instead of content. */
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
/** Error state: when set, render the error block. */
|
|
19
|
+
error?: Error | string | null;
|
|
20
|
+
/** Override the error primary text (default: "Something went wrong"). */
|
|
21
|
+
errorMessage?: string;
|
|
22
|
+
/** Retry handler — when provided, renders a Retry button in the error block. */
|
|
23
|
+
onRetry?: () => void;
|
|
24
|
+
/** Empty state primary text. Default: "No sections." */
|
|
25
|
+
emptyMessage?: string;
|
|
26
|
+
/** Empty state secondary text. */
|
|
27
|
+
emptyHint?: string;
|
|
28
|
+
/** Empty state CTA. */
|
|
29
|
+
emptyAction?: {
|
|
30
|
+
label: string;
|
|
31
|
+
onClick: () => void;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare const SectionedTree: <T extends TreeNode = TreeNode>(props: SectionedTreeProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=SectionedTree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SectionedTree.d.ts","sourceRoot":"","sources":["../../src/components/SectionedTree.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkC,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAU9F,OAAO,EAAQ,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAO7C,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,CAAC,EAAE,CAAC;CACZ;AAED,UAAU,kBAAkB,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ;IACxD,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAC3C,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qDAAqD;IACrD,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,wDAAwD;IACxD,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;AAwRD,eAAO,MAAM,aAAa,EAA2B,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EACjF,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,cAAc,CAAC,KACzD,YAAY,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
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 { Tree as i } from "./Tree.js";
|
|
8
|
+
import { useCallback as a, useMemo as o, useState as s } from "react";
|
|
9
|
+
import { AlertCircle as c, ChevronDown as l, ChevronLeft as u, ChevronRight as d, Inbox as f } from "lucide-react";
|
|
10
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/SectionedTree.tsx
|
|
12
|
+
var h = 3, g = 3;
|
|
13
|
+
function _(e) {
|
|
14
|
+
let t = 0;
|
|
15
|
+
for (let n of e) t++, n.children && (t += _(n.children));
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
18
|
+
function v(e) {
|
|
19
|
+
let t = [];
|
|
20
|
+
for (let n of e) n.type === "branch" && (t.push(n.id), n.children && t.push(...v(n.children)));
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
23
|
+
function y({ sections: e, selectedId: y, onSelect: b, className: x, renderLabel: S, flipped: C = !1, loading: w, error: T, errorMessage: E, onRetry: D, emptyMessage: O = "No sections.", emptyHint: k, emptyAction: A }) {
|
|
24
|
+
let [j, M] = s(/* @__PURE__ */ new Set()), [N, P] = s({}), [F, I] = s({}), L = e.length > 0 && e.every((e) => j.has(e.id));
|
|
25
|
+
e.every((e) => !j.has(e.id));
|
|
26
|
+
let R = (e) => {
|
|
27
|
+
M((t) => {
|
|
28
|
+
let n = new Set(t);
|
|
29
|
+
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
30
|
+
});
|
|
31
|
+
}, z = () => {
|
|
32
|
+
M(L ? /* @__PURE__ */ new Set() : new Set(e.map((e) => e.id)));
|
|
33
|
+
}, B = a((e) => N[e] ?? /* @__PURE__ */ new Set(), [N]), V = a((e, t) => {
|
|
34
|
+
P((n) => {
|
|
35
|
+
let r = n[e] ?? /* @__PURE__ */ new Set(), i = new Set(r);
|
|
36
|
+
return i.has(t) ? i.delete(t) : i.add(t), {
|
|
37
|
+
...n,
|
|
38
|
+
[e]: i
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
}, []), H = a((e, t) => {
|
|
42
|
+
I((t) => {
|
|
43
|
+
let n = t[e] ?? !1;
|
|
44
|
+
return {
|
|
45
|
+
...t,
|
|
46
|
+
[e]: !n
|
|
47
|
+
};
|
|
48
|
+
}), P((n) => {
|
|
49
|
+
if (F[e] ?? !1) return {
|
|
50
|
+
...n,
|
|
51
|
+
[e]: /* @__PURE__ */ new Set()
|
|
52
|
+
};
|
|
53
|
+
{
|
|
54
|
+
let r = v(t);
|
|
55
|
+
return {
|
|
56
|
+
...n,
|
|
57
|
+
[e]: new Set(r)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}, [F]), U = o(() => {
|
|
62
|
+
let t = {};
|
|
63
|
+
for (let n of e) t[n.id] = _(n.nodes);
|
|
64
|
+
return t;
|
|
65
|
+
}, [e]);
|
|
66
|
+
return w ? /* @__PURE__ */ p("div", {
|
|
67
|
+
"data-component": "SectionedTree",
|
|
68
|
+
"data-testid": "sectionedtree-loading",
|
|
69
|
+
className: t("cs-component-sectioned-tree-11 ", x),
|
|
70
|
+
children: Array.from({ length: h }).map((e, t) => /* @__PURE__ */ m("div", {
|
|
71
|
+
className: "cs-component-sectioned-tree-14 ",
|
|
72
|
+
children: [/* @__PURE__ */ p(r, {
|
|
73
|
+
variant: "text",
|
|
74
|
+
width: "40%"
|
|
75
|
+
}), Array.from({ length: g }).map((e, t) => /* @__PURE__ */ p("div", {
|
|
76
|
+
className: "cs-component-sectioned-tree-17",
|
|
77
|
+
children: /* @__PURE__ */ p(r, {
|
|
78
|
+
variant: "text",
|
|
79
|
+
width: "70%"
|
|
80
|
+
})
|
|
81
|
+
}, t))]
|
|
82
|
+
}, `__sk-section-${t}`))
|
|
83
|
+
}) : T ? /* @__PURE__ */ m("div", {
|
|
84
|
+
"data-component": "SectionedTree",
|
|
85
|
+
"data-testid": "sectionedtree-error",
|
|
86
|
+
className: t("cs-component-sectioned-tree-22 ", x),
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ p(c, { className: "cs-component-sectioned-tree-23 " }),
|
|
89
|
+
/* @__PURE__ */ p("div", {
|
|
90
|
+
className: "cs-component-sectioned-tree-24 ",
|
|
91
|
+
children: E ?? "Something went wrong"
|
|
92
|
+
}),
|
|
93
|
+
(typeof T == "string" ? T : T?.message) && /* @__PURE__ */ p("div", {
|
|
94
|
+
className: "cs-component-sectioned-tree-27 ",
|
|
95
|
+
children: typeof T == "string" ? T : T.message
|
|
96
|
+
}),
|
|
97
|
+
D && /* @__PURE__ */ p(n, {
|
|
98
|
+
variant: "secondary",
|
|
99
|
+
size: "sm",
|
|
100
|
+
onClick: D,
|
|
101
|
+
children: "Retry"
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
}) : e.length === 0 ? /* @__PURE__ */ m("div", {
|
|
105
|
+
"data-component": "SectionedTree",
|
|
106
|
+
"data-testid": "sectionedtree-empty",
|
|
107
|
+
className: t("cs-component-sectioned-tree-22 ", x),
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ p(f, { className: "cs-component-sectioned-tree-33 " }),
|
|
110
|
+
/* @__PURE__ */ p("div", {
|
|
111
|
+
className: "cs-component-sectioned-tree-24 ",
|
|
112
|
+
children: O
|
|
113
|
+
}),
|
|
114
|
+
k && /* @__PURE__ */ p("div", {
|
|
115
|
+
className: "cs-component-sectioned-tree-27 ",
|
|
116
|
+
children: k
|
|
117
|
+
}),
|
|
118
|
+
A && /* @__PURE__ */ p(n, {
|
|
119
|
+
variant: "secondary",
|
|
120
|
+
size: "sm",
|
|
121
|
+
onClick: A.onClick,
|
|
122
|
+
children: A.label
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
}) : /* @__PURE__ */ m("div", {
|
|
126
|
+
"data-component": "SectionedTree",
|
|
127
|
+
className: t("cs-component-sectioned-tree-37 ", x),
|
|
128
|
+
children: [/* @__PURE__ */ p("button", {
|
|
129
|
+
type: "button",
|
|
130
|
+
onClick: z,
|
|
131
|
+
className: t("cs-component-sectioned-tree-39 ", "cs-component-sectioned-tree-40 ", "cs-component-sectioned-tree-41 ", "cs-component-sectioned-tree-42 ", C ? "cs-component-sectioned-tree-43" : "cs-component-sectioned-tree-44"),
|
|
132
|
+
children: L ? "Expand all" : "Collapse all"
|
|
133
|
+
}), e.map((e) => {
|
|
134
|
+
let n = j.has(e.id), r = U[e.id] ?? 0;
|
|
135
|
+
return /* @__PURE__ */ m("div", {
|
|
136
|
+
className: "cs-component-sectioned-tree-37 ",
|
|
137
|
+
children: [/* @__PURE__ */ m("button", {
|
|
138
|
+
type: "button",
|
|
139
|
+
onClick: () => R(e.id),
|
|
140
|
+
className: t("cs-component-sectioned-tree-49 ", "cs-component-sectioned-tree-50 ", "text-label-upper", "cs-component-sectioned-tree-52 ", "cs-component-sectioned-tree-41 ", "cs-component-sectioned-tree-53 ", C ? "cs-component-sectioned-tree-54 " : "cs-component-sectioned-tree-44"),
|
|
141
|
+
children: [
|
|
142
|
+
p(n ? C ? u : d : l, { className: "cs-component-sectioned-tree-55 " }),
|
|
143
|
+
/* @__PURE__ */ p("span", {
|
|
144
|
+
className: "cs-component-sectioned-tree-56",
|
|
145
|
+
children: e.label
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ p("span", {
|
|
148
|
+
className: "cs-component-sectioned-tree-57 ",
|
|
149
|
+
children: r
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
}), !n && /* @__PURE__ */ p("div", {
|
|
153
|
+
className: "cs-component-sectioned-tree-58",
|
|
154
|
+
children: /* @__PURE__ */ p(i, {
|
|
155
|
+
nodes: e.nodes,
|
|
156
|
+
expandedIds: B(e.id),
|
|
157
|
+
selectedId: y,
|
|
158
|
+
onSelect: b,
|
|
159
|
+
onToggle: (t) => V(e.id, t),
|
|
160
|
+
renderLabel: S,
|
|
161
|
+
filterable: !0,
|
|
162
|
+
onToggleExpandAll: () => H(e.id, e.nodes),
|
|
163
|
+
allExpanded: F[e.id] ?? !1,
|
|
164
|
+
flipped: C
|
|
165
|
+
})
|
|
166
|
+
})]
|
|
167
|
+
}, e.id);
|
|
168
|
+
})]
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
var b = e(y);
|
|
172
|
+
//#endregion
|
|
173
|
+
export { b as SectionedTree };
|