@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,445 @@
|
|
|
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 { ChartTooltip as n } from "./ChartTooltip.js";
|
|
6
|
+
import { useCallback as r, useEffect as i, useId as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/EventLanes.tsx
|
|
9
|
+
var d = 10, f = 28, p = 24, m = 40, h = 2;
|
|
10
|
+
function ee(e) {
|
|
11
|
+
return Math.max(5, Math.min(14, e - 1));
|
|
12
|
+
}
|
|
13
|
+
function g(e) {
|
|
14
|
+
let t = (ee(e) + 7) / 2 + 3;
|
|
15
|
+
return Math.max(0, t - e / 2 + 1);
|
|
16
|
+
}
|
|
17
|
+
function _(e) {
|
|
18
|
+
let t = h, n = m - h, r = (n - t) / Math.max(1, e), i = Math.min(1, r / 4), a = Math.max(1, r - i * 2);
|
|
19
|
+
return {
|
|
20
|
+
chromeTop: t,
|
|
21
|
+
chromeBottom: n,
|
|
22
|
+
band: r,
|
|
23
|
+
markHeight: a,
|
|
24
|
+
markTop: (e) => Math.min(t + e * r + i, n - a)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
var v = 4, y = [];
|
|
28
|
+
function b(e) {
|
|
29
|
+
return Number.isInteger(e) && e >= 0;
|
|
30
|
+
}
|
|
31
|
+
function te(e, t, n, r) {
|
|
32
|
+
let i = [], a = /* @__PURE__ */ new Set();
|
|
33
|
+
for (let t of e) a.has(t.id) && i.push(`duplicate lane id "${t.id}"`), a.add(t.id);
|
|
34
|
+
let o = /* @__PURE__ */ new Set(), s = [];
|
|
35
|
+
for (let e of t) {
|
|
36
|
+
if (!a.has(e.lane)) {
|
|
37
|
+
i.push(`event ${e.i} references unknown lane "${e.lane}"`);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (!b(e.i)) {
|
|
41
|
+
i.push(`event index ${e.i} is not a non-negative integer`);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (o.has(e.i)) {
|
|
45
|
+
i.push(`duplicate global event index ${e.i}`);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
r[e.kind] || i.push(`event kind "${e.kind}" has no palette token`), o.add(e.i), s.push(e);
|
|
49
|
+
}
|
|
50
|
+
s.sort((e, t) => e.i - t.i);
|
|
51
|
+
let c = [];
|
|
52
|
+
for (let e of n) {
|
|
53
|
+
if (!a.has(e.lane) || !b(e.from) || !b(e.to) || e.from > e.to) {
|
|
54
|
+
i.push(`invalid span ${e.lane}:${e.from}-${e.to}`);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
c.push(e);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
events: s,
|
|
61
|
+
spans: c,
|
|
62
|
+
warnings: i
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function x(e, t, n) {
|
|
66
|
+
return t && e.getPropertyValue(t).trim() || n;
|
|
67
|
+
}
|
|
68
|
+
function ne(e, t, n, r, i, a, o) {
|
|
69
|
+
let s = i / 2;
|
|
70
|
+
e.beginPath(), t === "circle" || t === "hollow-circle" ? e.arc(n, r, s, 0, Math.PI * 2) : e.roundRect(n - s, r - s, i, i, 2), t === "hollow" || t === "hollow-circle" ? (e.fillStyle = o, e.fill(), e.strokeStyle = a, e.lineWidth = 2, e.stroke()) : (e.fillStyle = a, e.fill());
|
|
71
|
+
}
|
|
72
|
+
function S(e, t, n, r, i, a, o) {
|
|
73
|
+
let s = i / 2 + o;
|
|
74
|
+
e.beginPath(), t === "circle" || t === "hollow-circle" ? e.arc(n, r, s, 0, Math.PI * 2) : e.roundRect(n - s, r - s, s * 2, s * 2, 3), e.strokeStyle = a, e.lineWidth = o, e.stroke();
|
|
75
|
+
}
|
|
76
|
+
function re(e, t, n) {
|
|
77
|
+
let r = [
|
|
78
|
+
t?.label ?? e.lane,
|
|
79
|
+
...t?.description ? [t.description] : [],
|
|
80
|
+
e.label,
|
|
81
|
+
e.kind,
|
|
82
|
+
`global index ${e.i}`,
|
|
83
|
+
e.at
|
|
84
|
+
];
|
|
85
|
+
e.error && r.push("error"), e.tick && r.push("boundary"), e.marker && r.push(e.marker);
|
|
86
|
+
for (let t of n) (t.from === e.i || t.to === e.i) && r.push(`span from ${t.from} to ${t.to}`);
|
|
87
|
+
return r.join(", ");
|
|
88
|
+
}
|
|
89
|
+
function C({ lanes: e, events: b, spans: C = y, palette: w, selected: T = null, linked: E, hiddenKinds: ie, emphasis: D, cellWidth: ae = d, overview: oe = "auto", ruler: O, rulerLabel: se = "Index", renderTooltip: ce, onSelect: k, onHover: le, "aria-label": ue = "Event timeline", id: A, className: de }) {
|
|
90
|
+
let fe = a().replace(/:/g, ""), pe = `${A ?? `event-lanes-${fe}`}-option`, me = `${A ?? `event-lanes-${fe}`}-tooltip`, j = s(null), M = s(null), N = s(null), P = s(null), [F, he] = c(0), [I, L] = c(0), [R, z] = c(T), [ge, _e] = c(null), [ve, B] = c(!1), V = s(!1), ye = r(() => {
|
|
91
|
+
V.current = !0, B(!1);
|
|
92
|
+
}, []), [be, xe] = c(0), Se = s(null), H = Number.isFinite(ae) && ae > 0 ? ae : d, U = o(() => te(e, b, C, w), [
|
|
93
|
+
b,
|
|
94
|
+
e,
|
|
95
|
+
w,
|
|
96
|
+
C
|
|
97
|
+
]), W = o(() => new Map(e.map((e, t) => [e.id, t])), [e]), Ce = o(() => new Map(e.map((e) => [e.id, e])), [e]), G = o(() => U.events.filter((e) => !ie?.has(e.kind)), [ie, U.events]), K = o(() => new Map(G.map((e) => [e.i, e])), [G]), we = o(() => new Map(G.map((e) => [`${e.lane}:${e.i}`, e])), [G]), q = o(() => {
|
|
98
|
+
let e = -1;
|
|
99
|
+
for (let t of U.events) e = Math.max(e, t.i);
|
|
100
|
+
for (let t of U.spans) e = Math.max(e, t.to);
|
|
101
|
+
return e;
|
|
102
|
+
}, [U.events, U.spans]), J = g(H), Y = q < 0 ? 0 : (q + 1) * H + J * 2, X = Math.max(f, e.length * f), Te = O != null, Ee = oe === !0 || oe === "auto" && Y > F + 1, De = R == null ? void 0 : K.get(R), Z = ge == null ? ve ? De : void 0 : K.get(ge);
|
|
103
|
+
i(() => {}, [U.warnings]), i(() => {
|
|
104
|
+
let e = M.current;
|
|
105
|
+
if (!e) return;
|
|
106
|
+
let t = () => he(e.clientWidth);
|
|
107
|
+
t();
|
|
108
|
+
let n = new ResizeObserver(t);
|
|
109
|
+
return n.observe(e), () => n.disconnect();
|
|
110
|
+
}, []), i(() => {
|
|
111
|
+
let e = document.documentElement, t = new MutationObserver(() => xe((e) => e + 1));
|
|
112
|
+
return t.observe(e, {
|
|
113
|
+
attributes: !0,
|
|
114
|
+
attributeFilter: [
|
|
115
|
+
"class",
|
|
116
|
+
"data-theme",
|
|
117
|
+
"style"
|
|
118
|
+
]
|
|
119
|
+
}), () => t.disconnect();
|
|
120
|
+
}, []);
|
|
121
|
+
let Q = r((e) => {
|
|
122
|
+
let t = M.current;
|
|
123
|
+
if (!t) return;
|
|
124
|
+
let n = e === 0 ? 0 : J + e * H, r = e === q ? Y : J + (e + 1) * H, i = t.scrollLeft;
|
|
125
|
+
n < i ? i = n : r > i + t.clientWidth && (i = r - t.clientWidth);
|
|
126
|
+
let a = Math.max(0, Y - t.clientWidth);
|
|
127
|
+
i = Math.max(0, Math.min(a, i)), i !== t.scrollLeft && (t.scrollLeft = i), L(i);
|
|
128
|
+
}, [
|
|
129
|
+
J,
|
|
130
|
+
Y,
|
|
131
|
+
H,
|
|
132
|
+
q,
|
|
133
|
+
F
|
|
134
|
+
]);
|
|
135
|
+
i(() => {
|
|
136
|
+
T != null && K.has(T) && (z(T), Q(T));
|
|
137
|
+
}, [
|
|
138
|
+
Q,
|
|
139
|
+
T,
|
|
140
|
+
K
|
|
141
|
+
]), i(() => {
|
|
142
|
+
z((e) => e != null && K.has(e) ? e : G.length === 0 ? null : e == null ? T != null && K.has(T) ? T : G[0].i : G.find((t) => t.i > e)?.i ?? [...G].reverse().find((t) => t.i < e)?.i ?? G[0].i);
|
|
143
|
+
}, [
|
|
144
|
+
T,
|
|
145
|
+
K,
|
|
146
|
+
G
|
|
147
|
+
]), i(() => {
|
|
148
|
+
let e = N.current, t = j.current;
|
|
149
|
+
if (!e || !t) return;
|
|
150
|
+
let n = Math.max(1, F), r = window.devicePixelRatio || 1;
|
|
151
|
+
e.width = Math.ceil(n * r), e.height = Math.ceil(X * r), e.style.width = `${n}px`, e.style.height = `${X}px`;
|
|
152
|
+
let i = e.getContext("2d");
|
|
153
|
+
if (!i) return;
|
|
154
|
+
i.setTransform(r, 0, 0, r, 0, 0), i.clearRect(0, 0, n, X);
|
|
155
|
+
let a = getComputedStyle(t), o = a.getPropertyValue("--bg").trim() || "transparent", s = a.getPropertyValue("--fg").trim() || "currentColor", c = a.getPropertyValue("--muted").trim() || s, l = a.getPropertyValue("--color-link").trim() || s, u = a.getPropertyValue("--color-error").trim() || s, d = a.getPropertyValue("--color-accent").trim() || s, p = Math.max(0, Math.floor((I - J) / H) - v), m = Math.min(q, Math.ceil((I + n - J) / H) + v);
|
|
156
|
+
e.dataset.windowStart = String(p), e.dataset.windowEnd = String(m), i.lineCap = "round";
|
|
157
|
+
for (let e of U.spans) {
|
|
158
|
+
if (e.to < p || e.from > m) continue;
|
|
159
|
+
let t = W.get(e.lane);
|
|
160
|
+
if (t == null) continue;
|
|
161
|
+
let n = t * f + f / 2, r = J + (e.from + .5) * H - I, a = J + (e.to + .5) * H - I;
|
|
162
|
+
i.beginPath(), i.moveTo(r, n), i.lineTo(a, n), i.strokeStyle = o, i.lineWidth = 5, i.stroke(), i.strokeStyle = s, i.lineWidth = 2, i.stroke();
|
|
163
|
+
}
|
|
164
|
+
for (let e = p; e <= m; e += 1) {
|
|
165
|
+
let t = K.get(e);
|
|
166
|
+
if (!t) continue;
|
|
167
|
+
let r = W.get(t.lane);
|
|
168
|
+
if (r == null) continue;
|
|
169
|
+
let p = J + (t.i + .5) * H - I, m = r * f + f / 2, h = ee(H), g = (h + 7) / 2 + 3, _ = t.i === 0 ? Math.max(Math.min(g + 1, n / 2), p) : t.i === q ? Math.min(Math.max(n - g - 1, n / 2), p) : p, v = T === t.i, y = E?.has(t.i) ?? !1;
|
|
170
|
+
i.globalAlpha = D === void 0 || D.has(t.i) || v || y ? 1 : .3, t.halo && S(i, t.shape, _, m, h + 3, x(a, t.halo, c), 2), y && (S(i, t.shape, _, m, h + 5, l, 3), S(i, t.shape, _, m, h + 2, o, 2)), v && (S(i, t.shape, _, m, h + 7, s, 3), S(i, t.shape, _, m, h + 3, o, 2));
|
|
171
|
+
let b = x(a, w[t.kind], c);
|
|
172
|
+
if (ne(i, t.shape, _, m, h, b, o), v && y && (i.beginPath(), i.arc(_, m, Math.max(1.5, h / 5), 0, Math.PI * 2), i.fillStyle = l, i.fill()), t.error) {
|
|
173
|
+
let e = h / 2 + 2;
|
|
174
|
+
i.beginPath(), i.moveTo(_ - e, m - e), i.lineTo(_ + e, m + e), i.moveTo(_ + e, m - e), i.lineTo(_ - e, m + e), i.strokeStyle = u, i.lineWidth = 2, i.stroke();
|
|
175
|
+
}
|
|
176
|
+
if (t.tick) {
|
|
177
|
+
let e = J + (t.i + 1) * H - I - 1;
|
|
178
|
+
i.beginPath(), i.moveTo(e, m - f / 3), i.lineTo(e, m + f / 3), i.strokeStyle = s, i.lineWidth = 2, i.stroke();
|
|
179
|
+
}
|
|
180
|
+
t.marker && (i.beginPath(), i.arc(_, m - h / 2 - 4, 2, 0, Math.PI * 2), i.fillStyle = d, i.fill());
|
|
181
|
+
}
|
|
182
|
+
i.globalAlpha = 1;
|
|
183
|
+
}, [
|
|
184
|
+
Y,
|
|
185
|
+
J,
|
|
186
|
+
X,
|
|
187
|
+
H,
|
|
188
|
+
D,
|
|
189
|
+
q,
|
|
190
|
+
W,
|
|
191
|
+
E,
|
|
192
|
+
w,
|
|
193
|
+
I,
|
|
194
|
+
T,
|
|
195
|
+
be,
|
|
196
|
+
U.spans,
|
|
197
|
+
F,
|
|
198
|
+
K
|
|
199
|
+
]), i(() => {
|
|
200
|
+
let t = P.current, n = j.current;
|
|
201
|
+
if (!t || !n || !Ee) return;
|
|
202
|
+
let r = Math.max(1, F), i = window.devicePixelRatio || 1;
|
|
203
|
+
t.width = Math.ceil(r * i), t.height = Math.ceil(m * i), t.style.width = `${r}px`, t.style.height = `${m}px`;
|
|
204
|
+
let a = t.getContext("2d");
|
|
205
|
+
if (!a) return;
|
|
206
|
+
a.setTransform(i, 0, 0, i, 0, 0), a.clearRect(0, 0, r, m);
|
|
207
|
+
let o = getComputedStyle(n), s = o.getPropertyValue("--fg").trim() || "currentColor", c = o.getPropertyValue("--muted").trim() || s, l = o.getPropertyValue("--color-link").trim() || s, u = _(e.length), d = r / Math.max(Y, 1);
|
|
208
|
+
for (let e of G) {
|
|
209
|
+
let t = W.get(e.lane);
|
|
210
|
+
if (t == null) continue;
|
|
211
|
+
let n = T === e.i, r = E?.has(e.i) ?? !1;
|
|
212
|
+
a.globalAlpha = D === void 0 || D.has(e.i) || n || r ? 1 : .3, a.fillStyle = x(o, w[e.kind], c), a.fillRect((J + e.i * H) * d, u.markTop(t), Math.max(1, H * d), u.markHeight);
|
|
213
|
+
}
|
|
214
|
+
a.globalAlpha = 1;
|
|
215
|
+
let f = I * d, p = Math.min(r, F * d);
|
|
216
|
+
a.strokeStyle = l, a.lineWidth = h, a.strokeRect(f, h / 2, Math.max(2, p), m - h);
|
|
217
|
+
}, [
|
|
218
|
+
Y,
|
|
219
|
+
J,
|
|
220
|
+
H,
|
|
221
|
+
D,
|
|
222
|
+
W,
|
|
223
|
+
e.length,
|
|
224
|
+
E,
|
|
225
|
+
w,
|
|
226
|
+
I,
|
|
227
|
+
T,
|
|
228
|
+
Ee,
|
|
229
|
+
be,
|
|
230
|
+
F,
|
|
231
|
+
G
|
|
232
|
+
]);
|
|
233
|
+
let Oe = r((e) => {
|
|
234
|
+
let t = e?.i ?? null;
|
|
235
|
+
_e(t), Se.current !== t && (Se.current = t, le?.(e));
|
|
236
|
+
}, [le]), ke = r((t) => {
|
|
237
|
+
let n = N.current, r = M.current;
|
|
238
|
+
if (!n || !r) return null;
|
|
239
|
+
let i = n.getBoundingClientRect(), a = t.clientX - i.left + r.scrollLeft - J, o = t.clientY - i.top, s = e[Math.floor(o / f)], c = Math.floor(a / H);
|
|
240
|
+
return s ? we.get(`${s.id}:${c}`) ?? null : null;
|
|
241
|
+
}, [
|
|
242
|
+
J,
|
|
243
|
+
H,
|
|
244
|
+
e,
|
|
245
|
+
we
|
|
246
|
+
]), Ae = (e) => {
|
|
247
|
+
Oe(ke(e));
|
|
248
|
+
}, je = (e) => {
|
|
249
|
+
ye();
|
|
250
|
+
let t = ke(e);
|
|
251
|
+
t && (M.current?.focus(), z(t.i), Oe(t), k?.(t));
|
|
252
|
+
}, Me = r((e) => {
|
|
253
|
+
let t = G[e];
|
|
254
|
+
t && (z(t.i), Q(t.i), k?.(t));
|
|
255
|
+
}, [
|
|
256
|
+
k,
|
|
257
|
+
Q,
|
|
258
|
+
G
|
|
259
|
+
]), Ne = (e) => {
|
|
260
|
+
if (G.length === 0) return;
|
|
261
|
+
[
|
|
262
|
+
"ArrowRight",
|
|
263
|
+
"ArrowLeft",
|
|
264
|
+
"Home",
|
|
265
|
+
"End"
|
|
266
|
+
].includes(e.key) && B(!0), e.key === "Escape" && B(!1);
|
|
267
|
+
let t = Math.max(0, G.findIndex((e) => e.i === R)), n = null;
|
|
268
|
+
if (e.key === "ArrowRight") n = Math.min(G.length - 1, t + 1);
|
|
269
|
+
else if (e.key === "ArrowLeft") n = Math.max(0, t - 1);
|
|
270
|
+
else if (e.key === "Home") n = 0;
|
|
271
|
+
else if (e.key === "End") n = G.length - 1;
|
|
272
|
+
else if (e.key === "Enter" || e.key === " ") {
|
|
273
|
+
e.preventDefault(), e.stopPropagation();
|
|
274
|
+
let n = G[t];
|
|
275
|
+
n && k?.(n);
|
|
276
|
+
return;
|
|
277
|
+
} else return;
|
|
278
|
+
e.preventDefault(), e.stopPropagation(), (n !== t || e.key === "Home" || e.key === "End") && Me(n);
|
|
279
|
+
}, Pe = (e) => {
|
|
280
|
+
let t = P.current, n = M.current;
|
|
281
|
+
if (!t || !n) return;
|
|
282
|
+
let r = t.getBoundingClientRect(), i = Math.max(0, Math.min(1, (e.clientX - r.left) / Math.max(1, r.width))), a = Math.max(0, Y - n.clientWidth), o = Math.max(0, Math.min(a, i * Y - n.clientWidth / 2));
|
|
283
|
+
n.scrollLeft = o, L(o);
|
|
284
|
+
}, Fe = (e) => {
|
|
285
|
+
e.currentTarget.setPointerCapture(e.pointerId), Pe(e);
|
|
286
|
+
}, Ie = (e) => {
|
|
287
|
+
e.currentTarget.hasPointerCapture(e.pointerId) && Pe(e);
|
|
288
|
+
}, $ = Z ? ce ? ce(Z) : /* @__PURE__ */ u("div", {
|
|
289
|
+
className: "cs-component-event-lanes-tooltip-content",
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ l("strong", { children: Z.label }),
|
|
292
|
+
/* @__PURE__ */ u("span", { children: [
|
|
293
|
+
Z.kind,
|
|
294
|
+
" · ",
|
|
295
|
+
Z.at
|
|
296
|
+
] }),
|
|
297
|
+
Z.error && /* @__PURE__ */ l("span", { children: "Error" }),
|
|
298
|
+
Z.tick && /* @__PURE__ */ l("span", { children: "Boundary" }),
|
|
299
|
+
Z.marker && /* @__PURE__ */ l("span", { children: Z.marker })
|
|
300
|
+
]
|
|
301
|
+
}) : null, Le = Z ? W.get(Z.lane) ?? 0 : 0, Re = Z ? J + (Z.i + .5) * H - I : 0, ze = Math.max(48, Math.min(Math.max(48, F - 48), Re)), Be = (Te ? p : 0) + Le * f + f / 2, Ve = {
|
|
302
|
+
start: 0,
|
|
303
|
+
end: q,
|
|
304
|
+
cellWidth: H,
|
|
305
|
+
width: Y,
|
|
306
|
+
xForIndex: (e) => J + (e + .5) * H
|
|
307
|
+
}, He = De ? `${pe}-${De.i}` : void 0, Ue = {
|
|
308
|
+
"--event-lanes-ruler-height": `${p / 16}rem`,
|
|
309
|
+
"--event-lanes-lane-height": `${f / 16}rem`,
|
|
310
|
+
"--event-lanes-lane-count": Math.max(1, e.length)
|
|
311
|
+
};
|
|
312
|
+
return /* @__PURE__ */ u("div", {
|
|
313
|
+
ref: j,
|
|
314
|
+
id: A,
|
|
315
|
+
"data-component": "EventLanes",
|
|
316
|
+
className: t("cs-component-event-lanes-root", de),
|
|
317
|
+
style: Ue,
|
|
318
|
+
children: [/* @__PURE__ */ u("div", {
|
|
319
|
+
className: "cs-component-event-lanes-main",
|
|
320
|
+
children: [/* @__PURE__ */ u("div", {
|
|
321
|
+
"data-event-lanes-labels": "",
|
|
322
|
+
className: "cs-component-event-lanes-labels",
|
|
323
|
+
"aria-hidden": "true",
|
|
324
|
+
children: [Te && /* @__PURE__ */ l("div", {
|
|
325
|
+
className: "cs-component-event-lanes-ruler-label",
|
|
326
|
+
children: se
|
|
327
|
+
}), (e.length > 0 ? e : [{
|
|
328
|
+
id: "empty",
|
|
329
|
+
label: "Events"
|
|
330
|
+
}]).map((e) => /* @__PURE__ */ l("div", {
|
|
331
|
+
"data-event-lane-label": e.id,
|
|
332
|
+
"data-event-lane-title": e.title,
|
|
333
|
+
"data-event-lane-description": e.description,
|
|
334
|
+
title: e.title,
|
|
335
|
+
className: t("cs-component-event-lanes-label", "className" in e && e.className),
|
|
336
|
+
children: e.label
|
|
337
|
+
}, e.id))]
|
|
338
|
+
}), /* @__PURE__ */ u("div", {
|
|
339
|
+
className: "cs-component-event-lanes-axis-cell",
|
|
340
|
+
children: [/* @__PURE__ */ l("div", {
|
|
341
|
+
ref: M,
|
|
342
|
+
role: "listbox",
|
|
343
|
+
tabIndex: 0,
|
|
344
|
+
"aria-label": ue,
|
|
345
|
+
"aria-orientation": "horizontal",
|
|
346
|
+
"aria-activedescendant": He,
|
|
347
|
+
"aria-disabled": G.length === 0 ? "true" : void 0,
|
|
348
|
+
"data-event-lanes-scroller": "",
|
|
349
|
+
"data-event-count": G.length,
|
|
350
|
+
"data-span-count": U.spans.length,
|
|
351
|
+
className: "cs-component-event-lanes-scroller",
|
|
352
|
+
onKeyDown: Ne,
|
|
353
|
+
onPointerDown: ye,
|
|
354
|
+
onFocus: () => {
|
|
355
|
+
B(!V.current), V.current = !1;
|
|
356
|
+
},
|
|
357
|
+
onBlur: (e) => {
|
|
358
|
+
e.currentTarget.contains(e.relatedTarget) || (B(!1), V.current = !1);
|
|
359
|
+
},
|
|
360
|
+
onScroll: (e) => L(e.currentTarget.scrollLeft),
|
|
361
|
+
children: /* @__PURE__ */ u("div", {
|
|
362
|
+
className: "cs-component-event-lanes-axis",
|
|
363
|
+
style: { width: Math.max(Y, F) },
|
|
364
|
+
children: [
|
|
365
|
+
Te && /* @__PURE__ */ l("div", {
|
|
366
|
+
role: "presentation",
|
|
367
|
+
className: "cs-component-event-lanes-ruler",
|
|
368
|
+
style: { width: Math.max(Y, F) },
|
|
369
|
+
children: typeof O == "function" ? O(Ve) : O
|
|
370
|
+
}),
|
|
371
|
+
/* @__PURE__ */ l("div", {
|
|
372
|
+
className: "cs-component-event-lanes-canvas-window",
|
|
373
|
+
children: /* @__PURE__ */ l("canvas", {
|
|
374
|
+
ref: N,
|
|
375
|
+
"data-event-lanes-canvas": "",
|
|
376
|
+
"aria-hidden": "true",
|
|
377
|
+
onPointerMove: Ae,
|
|
378
|
+
onPointerDown: je,
|
|
379
|
+
onPointerLeave: () => Oe(null)
|
|
380
|
+
})
|
|
381
|
+
}),
|
|
382
|
+
/* @__PURE__ */ u("div", {
|
|
383
|
+
role: "presentation",
|
|
384
|
+
"data-event-lanes-census": "",
|
|
385
|
+
className: "cs-component-event-lanes-census",
|
|
386
|
+
children: [
|
|
387
|
+
G.map((e, t) => /* @__PURE__ */ l("div", {
|
|
388
|
+
id: `${pe}-${e.i}`,
|
|
389
|
+
role: "option",
|
|
390
|
+
"aria-label": re(e, Ce.get(e.lane), U.spans.filter((t) => t.lane === e.lane)),
|
|
391
|
+
"aria-posinset": t + 1,
|
|
392
|
+
"aria-setsize": G.length,
|
|
393
|
+
"aria-selected": T === e.i,
|
|
394
|
+
"aria-describedby": Z?.i === e.i && $ != null ? me : void 0,
|
|
395
|
+
"data-event-index": e.i,
|
|
396
|
+
"data-event-kind": e.kind,
|
|
397
|
+
"data-event-lane": e.lane,
|
|
398
|
+
"data-event-linked": E?.has(e.i) ? "true" : void 0,
|
|
399
|
+
"data-event-emphasized": D === void 0 ? void 0 : String(D.has(e.i))
|
|
400
|
+
}, e.i)),
|
|
401
|
+
U.spans.map((e, t) => /* @__PURE__ */ l("span", {
|
|
402
|
+
"data-span-lane": e.lane,
|
|
403
|
+
"data-span-from": e.from,
|
|
404
|
+
"data-span-to": e.to
|
|
405
|
+
}, `${e.lane}-${e.from}-${e.to}-${t}`)),
|
|
406
|
+
G.length === 0 && /* @__PURE__ */ l("span", {
|
|
407
|
+
role: "status",
|
|
408
|
+
children: "No visible events."
|
|
409
|
+
})
|
|
410
|
+
]
|
|
411
|
+
})
|
|
412
|
+
]
|
|
413
|
+
})
|
|
414
|
+
}), Z && $ != null && /* @__PURE__ */ l("div", {
|
|
415
|
+
id: me,
|
|
416
|
+
className: "cs-component-event-lanes-tooltip-layer",
|
|
417
|
+
children: /* @__PURE__ */ l(n, {
|
|
418
|
+
x: ze,
|
|
419
|
+
y: Be,
|
|
420
|
+
anchor: Be < 64 ? "bottom" : "top",
|
|
421
|
+
children: $
|
|
422
|
+
})
|
|
423
|
+
})]
|
|
424
|
+
})]
|
|
425
|
+
}), Ee && /* @__PURE__ */ u("div", {
|
|
426
|
+
className: "cs-component-event-lanes-overview-row",
|
|
427
|
+
children: [/* @__PURE__ */ l("div", {
|
|
428
|
+
"data-event-lanes-overview-label": "",
|
|
429
|
+
className: "cs-component-event-lanes-overview-label",
|
|
430
|
+
"aria-hidden": "true",
|
|
431
|
+
children: "Overview"
|
|
432
|
+
}), /* @__PURE__ */ l("canvas", {
|
|
433
|
+
ref: P,
|
|
434
|
+
"data-event-lanes-overview": "",
|
|
435
|
+
"aria-hidden": "true",
|
|
436
|
+
className: "cs-component-event-lanes-overview",
|
|
437
|
+
onPointerDown: Fe,
|
|
438
|
+
onPointerMove: Ie
|
|
439
|
+
})]
|
|
440
|
+
})]
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
var w = e(C);
|
|
444
|
+
//#endregion
|
|
445
|
+
export { w as EventLanes };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface FormGroupProps {
|
|
2
|
+
/**
|
|
3
|
+
* Field label rendered above the control (uppercase label utility).
|
|
4
|
+
* Optional — when omitted, no label renders but helper/error still work.
|
|
5
|
+
* Used internally by composite controls (CheckboxGroup, Dropdown) that
|
|
6
|
+
* want the helper/error treatment without an extra label row.
|
|
7
|
+
*/
|
|
8
|
+
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* `id` to associate the label with the control. Required when the control
|
|
11
|
+
* is a single native input/select/textarea. May be omitted when wrapping a
|
|
12
|
+
* composite control (CheckboxGroup, fieldset-style content) — in that case
|
|
13
|
+
* the group renders an `aria-label`-friendly label without an htmlFor.
|
|
14
|
+
*/
|
|
15
|
+
htmlFor?: string;
|
|
16
|
+
/** Renders a `*` after the label and forwards `required` to the child input. */
|
|
17
|
+
required?: boolean;
|
|
18
|
+
/** Grey hint text below the control. Hidden when `error` is set. */
|
|
19
|
+
helper?: string;
|
|
20
|
+
/** Red message below the control. Replaces helper when set; forwards `aria-invalid` to the child. */
|
|
21
|
+
error?: string;
|
|
22
|
+
/** Additional className on the wrapper. */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** The control (Input, Dropdown, CheckboxGroup, custom input). */
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
export declare const FormGroup: import("react").ForwardRefExoticComponent<FormGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=FormGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormGroup.d.ts","sourceRoot":"","sources":["../../src/components/FormGroup.tsx"],"names":[],"mappings":"AAOA,UAAU,cAAc;IACtB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qGAAqG;IACrG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AA+FD,eAAO,MAAM,SAAS,2GAAkE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { Children as n, cloneElement as r, isValidElement as i, useId as a } from "react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/FormGroup.tsx
|
|
8
|
+
function c({ label: e, htmlFor: c, required: l = !1, helper: u, error: d, className: f, children: p }) {
|
|
9
|
+
let m = a(), h = c ?? `formgroup-${m}`, g = u ? `${h}-helper` : void 0, _ = d ? `${h}-error` : void 0, v = _ ?? g, y = n.toArray(p), b = p;
|
|
10
|
+
if (y.length === 1 && i(y[0])) {
|
|
11
|
+
let e = y[0], t = typeof e.type == "string", n = {
|
|
12
|
+
id: e.props.id ?? h,
|
|
13
|
+
"aria-describedby": e.props["aria-describedby"] ?? v,
|
|
14
|
+
"aria-invalid": e.props["aria-invalid"] ?? (d ? !0 : void 0),
|
|
15
|
+
required: e.props.required ?? (l || void 0)
|
|
16
|
+
};
|
|
17
|
+
t || (n.error = e.props.error ?? (d ? !0 : void 0)), b = r(e, n);
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ s("div", {
|
|
20
|
+
"data-component": "FormGroup",
|
|
21
|
+
className: t("cs-component-form-group-15 ", f),
|
|
22
|
+
children: [
|
|
23
|
+
e && /* @__PURE__ */ s("label", {
|
|
24
|
+
htmlFor: c ? h : void 0,
|
|
25
|
+
className: t("text-label-upper cs-component-form-group-16"),
|
|
26
|
+
children: [e, l && /* @__PURE__ */ o("span", {
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
className: "cs-component-form-group-18 ",
|
|
29
|
+
children: "*"
|
|
30
|
+
})]
|
|
31
|
+
}),
|
|
32
|
+
b,
|
|
33
|
+
d ? /* @__PURE__ */ o("span", {
|
|
34
|
+
id: _,
|
|
35
|
+
role: "alert",
|
|
36
|
+
className: "cs-component-form-group-20 ",
|
|
37
|
+
children: d
|
|
38
|
+
}) : u ? /* @__PURE__ */ o("span", {
|
|
39
|
+
id: g,
|
|
40
|
+
className: "cs-component-form-group-21 ",
|
|
41
|
+
children: u
|
|
42
|
+
}) : null
|
|
43
|
+
]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
var l = e(c);
|
|
47
|
+
//#endregion
|
|
48
|
+
export { l as FormGroup };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface HighlightTextProps {
|
|
2
|
+
/** The full text to display */
|
|
3
|
+
text: string;
|
|
4
|
+
/** The substring to highlight. Empty string or undefined = no highlighting. */
|
|
5
|
+
query?: string;
|
|
6
|
+
/** Case-insensitive matching. Default: true */
|
|
7
|
+
ignoreCase?: boolean;
|
|
8
|
+
/** Additional className applied to the root span */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Additional className applied to the highlighted mark elements */
|
|
11
|
+
highlightClassName?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const HighlightText: import("react").ForwardRefExoticComponent<HighlightTextProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=HighlightText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HighlightText.d.ts","sourceRoot":"","sources":["../../src/components/HighlightText.tsx"],"names":[],"mappings":"AAGA,UAAU,kBAAkB;IAC1B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AA6CD,eAAO,MAAM,aAAa,gHAA2E,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { forwardRefToRoot as e } from "../lib/forwardRefToRoot.js";
|
|
2
|
+
import { cn as t } from "../lib/cn.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/HighlightText.tsx
|
|
5
|
+
function r({ text: e, query: r, ignoreCase: i = !0, className: a, highlightClassName: o }) {
|
|
6
|
+
if (!r || r.length === 0) return /* @__PURE__ */ n("span", {
|
|
7
|
+
"data-component": "HighlightText",
|
|
8
|
+
className: a,
|
|
9
|
+
children: e
|
|
10
|
+
});
|
|
11
|
+
let s = i ? "gi" : "g", c = r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), l = RegExp(`(${c})`, s), u = e.split(l);
|
|
12
|
+
return u.length === 1 ? /* @__PURE__ */ n("span", {
|
|
13
|
+
"data-component": "HighlightText",
|
|
14
|
+
className: a,
|
|
15
|
+
children: e
|
|
16
|
+
}) : /* @__PURE__ */ n("span", {
|
|
17
|
+
"data-component": "HighlightText",
|
|
18
|
+
className: a,
|
|
19
|
+
children: u.map((e, r) => l.test(e) ? /* @__PURE__ */ n("mark", {
|
|
20
|
+
"data-highlight-match": "",
|
|
21
|
+
className: t("cs-component-highlight-text-10 ", o),
|
|
22
|
+
children: e
|
|
23
|
+
}, r) : /* @__PURE__ */ n("span", { children: e }, r))
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
var i = e(r);
|
|
27
|
+
//#endregion
|
|
28
|
+
export { i as HighlightText };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type NativeInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "prefix" | "type">;
|
|
2
|
+
type NativeTextareaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "prefix">;
|
|
3
|
+
type InputType = "text" | "email" | "password" | "number" | "tel" | "url";
|
|
4
|
+
interface InputBaseProps {
|
|
5
|
+
/** Visual size. Default: "md" */
|
|
6
|
+
size?: "sm" | "md";
|
|
7
|
+
/** Error state — paints the red border + ring. */
|
|
8
|
+
error?: boolean;
|
|
9
|
+
/** Inline content rendered inside the left edge (icon or short label). */
|
|
10
|
+
prefix?: React.ReactNode;
|
|
11
|
+
/** Inline content rendered inside the right edge (icon, unit suffix). */
|
|
12
|
+
suffix?: React.ReactNode;
|
|
13
|
+
/** Additional className on the wrapper. */
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
interface SingleLineInputProps extends InputBaseProps, NativeInputProps {
|
|
17
|
+
/** HTML type attribute. Default: "text". Ignored when `multiline` is true. */
|
|
18
|
+
type?: InputType;
|
|
19
|
+
multiline?: false;
|
|
20
|
+
}
|
|
21
|
+
interface MultilineInputProps extends InputBaseProps, NativeTextareaProps {
|
|
22
|
+
/** Render a <textarea> instead of <input>. */
|
|
23
|
+
multiline: true;
|
|
24
|
+
/** Visible row count when multiline. Default: 3 */
|
|
25
|
+
rows?: number;
|
|
26
|
+
}
|
|
27
|
+
type InputProps = SingleLineInputProps | MultilineInputProps;
|
|
28
|
+
/**
|
|
29
|
+
* Standard text input. Use `multiline` for textareas. For search-specific
|
|
30
|
+
* patterns use `SearchInput`. For label + helper + error composition, wrap
|
|
31
|
+
* this in `FormGroup`.
|
|
32
|
+
*/
|
|
33
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":"AAGA,KAAK,gBAAgB,GAAG,IAAI,CAC1B,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAC3C,MAAM,GAAG,QAAQ,GAAG,MAAM,CAC3B,CAAC;AACF,KAAK,mBAAmB,GAAG,IAAI,CAC7B,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,EACjD,MAAM,GAAG,QAAQ,CAClB,CAAC;AAEF,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;AAE1E,UAAU,cAAc;IACtB,iCAAiC;IACjC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,kDAAkD;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,yEAAyE;IACzE,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,oBAAqB,SAAQ,cAAc,EAAE,gBAAgB;IACrE,8EAA8E;IAC9E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB;AAED,UAAU,mBAAoB,SAAQ,cAAc,EAAE,mBAAmB;IACvE,8CAA8C;IAC9C,SAAS,EAAE,IAAI,CAAC;IAChB,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,KAAK,UAAU,GAAG,oBAAoB,GAAG,mBAAmB,CAAC;AAO7D;;;;GAIG;AACH,eAAO,MAAM,KAAK,+HA4EjB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { cn as e } from "../lib/cn.js";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/Input.tsx
|
|
5
|
+
var i = {
|
|
6
|
+
sm: "cs-component-input-18",
|
|
7
|
+
md: "cs-component-input-19"
|
|
8
|
+
}, a = t(function(t, a) {
|
|
9
|
+
let { size: o = "md", error: s = !1, prefix: c, suffix: l, className: u, disabled: d, readOnly: f, ...p } = t, m = e("cs-component-input-21 ", "cs-component-input-22 ", "cs-component-input-23", s ? "cs-component-input-24" : "cs-component-input-25 ", d && "cs-component-input-26 ", f && "cs-component-input-27", u), h = e("cs-component-input-28 ", "cs-component-input-29 ", "cs-component-input-30", "cs-component-input-31", i[o], c && "cs-component-input-32", l && "cs-component-input-33"), g = e("cs-component-input-34 ", "cs-component-input-35", o === "sm" ? "cs-component-input-37" : "cs-component-input-38");
|
|
10
|
+
if (t.multiline) {
|
|
11
|
+
let { multiline: t, rows: i = 3, ...o } = p;
|
|
12
|
+
return /* @__PURE__ */ r("div", {
|
|
13
|
+
"data-component": "Input",
|
|
14
|
+
"data-multiline": "true",
|
|
15
|
+
className: m,
|
|
16
|
+
children: [
|
|
17
|
+
c && /* @__PURE__ */ n("span", {
|
|
18
|
+
className: g,
|
|
19
|
+
children: c
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ n("textarea", {
|
|
22
|
+
ref: a,
|
|
23
|
+
rows: i,
|
|
24
|
+
disabled: d,
|
|
25
|
+
readOnly: f,
|
|
26
|
+
className: e(h, "cs-component-input-41 "),
|
|
27
|
+
...o
|
|
28
|
+
}),
|
|
29
|
+
l && /* @__PURE__ */ n("span", {
|
|
30
|
+
className: g,
|
|
31
|
+
children: l
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
let { type: _ = "text", ...v } = p;
|
|
37
|
+
return /* @__PURE__ */ r("div", {
|
|
38
|
+
"data-component": "Input",
|
|
39
|
+
className: m,
|
|
40
|
+
children: [
|
|
41
|
+
c && /* @__PURE__ */ n("span", {
|
|
42
|
+
className: g,
|
|
43
|
+
children: c
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ n("input", {
|
|
46
|
+
ref: a,
|
|
47
|
+
type: _,
|
|
48
|
+
disabled: d,
|
|
49
|
+
readOnly: f,
|
|
50
|
+
className: h,
|
|
51
|
+
...v
|
|
52
|
+
}),
|
|
53
|
+
l && /* @__PURE__ */ n("span", {
|
|
54
|
+
className: g,
|
|
55
|
+
children: l
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
//#endregion
|
|
61
|
+
export { a as Input };
|