@geekmidas/ui 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/index.cjs +5 -0
- package/dist/hooks/index.d.cts +2 -0
- package/dist/hooks/index.d.mts +2 -0
- package/dist/hooks/index.mjs +3 -0
- package/dist/hooks-DBc-Cw9X.mjs +206 -0
- package/dist/hooks-DBc-Cw9X.mjs.map +1 -0
- package/dist/hooks-DuxmSO-h.cjs +252 -0
- package/dist/hooks-DuxmSO-h.cjs.map +1 -0
- package/dist/index-DmtSyJ1q.d.mts +113 -0
- package/dist/index-DmtSyJ1q.d.mts.map +1 -0
- package/dist/index-QNnnyGjB.d.cts +113 -0
- package/dist/index-QNnnyGjB.d.cts.map +1 -0
- package/dist/index.cjs +2566 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +727 -1
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +727 -1
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2428 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles/theme.cjs +6 -0
- package/dist/styles/theme.d.cts +2 -0
- package/dist/styles/theme.d.mts +2 -0
- package/dist/styles/theme.mjs +3 -0
- package/dist/theme-B5mGkTlU.d.cts +103 -0
- package/dist/theme-B5mGkTlU.d.cts.map +1 -0
- package/dist/theme-BRGSS8qx.cjs +135 -0
- package/dist/theme-BRGSS8qx.cjs.map +1 -0
- package/dist/theme-DAiFBbyM.mjs +111 -0
- package/dist/theme-DAiFBbyM.mjs.map +1 -0
- package/dist/theme-vpDwDfcR.d.mts +103 -0
- package/dist/theme-vpDwDfcR.d.mts.map +1 -0
- package/package.json +96 -5
- package/src/styles/globals.css +175 -0
- package/src/styles/theme.ts +138 -0
- package/scripts/embed-ui.ts +0 -97
- package/src/index.ts +0 -1
package/dist/index.mjs
CHANGED
|
@@ -0,0 +1,2428 @@
|
|
|
1
|
+
import { getLogLevelColor, getMethodColor, getStatusColor, theme } from "./theme-DAiFBbyM.mjs";
|
|
2
|
+
import { useDebounce, useLocalStorage, useWebSocket } from "./hooks-DBc-Cw9X.mjs";
|
|
3
|
+
import { format, subDays, subHours } from "date-fns";
|
|
4
|
+
import { Area, AreaChart, Bar, BarChart, Cell, Pie, PieChart, ResponsiveContainer, Tooltip as Tooltip$1, XAxis, YAxis } from "recharts";
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ArrowDown, ArrowUp, ArrowUpDown, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsLeft, ChevronsRight, Circle, Copy, FileQuestion, Inbox, Loader2, PanelLeftClose, PanelLeftOpen, Pause, Play, Search, ServerOff, X } from "lucide-react";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
11
|
+
import { cva } from "class-variance-authority";
|
|
12
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
13
|
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
14
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
15
|
+
import { Highlight, themes } from "prism-react-renderer";
|
|
16
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
17
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
18
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
19
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
20
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
21
|
+
|
|
22
|
+
//#region src/lib/utils.ts
|
|
23
|
+
function cn(...inputs) {
|
|
24
|
+
return twMerge(clsx(inputs));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/components/data-display/charts/area-time-series-chart.tsx
|
|
29
|
+
const COLOR_MAP = {
|
|
30
|
+
blue: "hsl(217, 91%, 60%)",
|
|
31
|
+
red: "hsl(0, 84%, 60%)",
|
|
32
|
+
green: "hsl(142, 71%, 45%)",
|
|
33
|
+
amber: "hsl(38, 92%, 50%)",
|
|
34
|
+
purple: "hsl(263, 70%, 50%)"
|
|
35
|
+
};
|
|
36
|
+
function AreaTimeSeriesChart({ data, primaryLabel = "Value", secondaryLabel, primaryColor = "blue", secondaryColor = "red", timeFormat = "HH:mm", valueFormatter = (v) => v.toLocaleString(), className, showLegend }) {
|
|
37
|
+
if (data.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
38
|
+
className: "h-48 flex items-center justify-center text-sm text-muted-foreground",
|
|
39
|
+
children: "No data available"
|
|
40
|
+
});
|
|
41
|
+
const hasSecondary = secondaryLabel && data.some((p) => p.secondaryValue !== void 0);
|
|
42
|
+
const chartData = data.map((point) => ({
|
|
43
|
+
time: format(new Date(point.timestamp), timeFormat),
|
|
44
|
+
timestamp: point.timestamp,
|
|
45
|
+
[primaryLabel]: point.value,
|
|
46
|
+
...hasSecondary && secondaryLabel ? { [secondaryLabel]: point.secondaryValue ?? 0 } : {}
|
|
47
|
+
}));
|
|
48
|
+
const primaryColorValue = COLOR_MAP[primaryColor] ?? primaryColor;
|
|
49
|
+
const secondaryColorValue = COLOR_MAP[secondaryColor] ?? secondaryColor;
|
|
50
|
+
const shouldShowLegend = showLegend ?? hasSecondary;
|
|
51
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
52
|
+
className: cn("h-48", className),
|
|
53
|
+
children: [/* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
54
|
+
width: "100%",
|
|
55
|
+
height: "100%",
|
|
56
|
+
children: /* @__PURE__ */ jsxs(AreaChart, {
|
|
57
|
+
data: chartData,
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsxs("defs", { children: [/* @__PURE__ */ jsxs("linearGradient", {
|
|
60
|
+
id: "primaryGradient",
|
|
61
|
+
x1: "0",
|
|
62
|
+
y1: "0",
|
|
63
|
+
x2: "0",
|
|
64
|
+
y2: "1",
|
|
65
|
+
children: [/* @__PURE__ */ jsx("stop", {
|
|
66
|
+
offset: "5%",
|
|
67
|
+
stopColor: primaryColorValue,
|
|
68
|
+
stopOpacity: .3
|
|
69
|
+
}), /* @__PURE__ */ jsx("stop", {
|
|
70
|
+
offset: "95%",
|
|
71
|
+
stopColor: primaryColorValue,
|
|
72
|
+
stopOpacity: 0
|
|
73
|
+
})]
|
|
74
|
+
}), hasSecondary && /* @__PURE__ */ jsxs("linearGradient", {
|
|
75
|
+
id: "secondaryGradient",
|
|
76
|
+
x1: "0",
|
|
77
|
+
y1: "0",
|
|
78
|
+
x2: "0",
|
|
79
|
+
y2: "1",
|
|
80
|
+
children: [/* @__PURE__ */ jsx("stop", {
|
|
81
|
+
offset: "5%",
|
|
82
|
+
stopColor: secondaryColorValue,
|
|
83
|
+
stopOpacity: .3
|
|
84
|
+
}), /* @__PURE__ */ jsx("stop", {
|
|
85
|
+
offset: "95%",
|
|
86
|
+
stopColor: secondaryColorValue,
|
|
87
|
+
stopOpacity: 0
|
|
88
|
+
})]
|
|
89
|
+
})] }),
|
|
90
|
+
/* @__PURE__ */ jsx(XAxis, {
|
|
91
|
+
dataKey: "time",
|
|
92
|
+
tick: {
|
|
93
|
+
fill: "hsl(var(--muted-foreground))",
|
|
94
|
+
fontSize: 12
|
|
95
|
+
},
|
|
96
|
+
axisLine: false,
|
|
97
|
+
tickLine: false
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ jsx(YAxis, {
|
|
100
|
+
tick: {
|
|
101
|
+
fill: "hsl(var(--muted-foreground))",
|
|
102
|
+
fontSize: 12
|
|
103
|
+
},
|
|
104
|
+
axisLine: false,
|
|
105
|
+
tickLine: false,
|
|
106
|
+
tickFormatter: valueFormatter,
|
|
107
|
+
width: 50
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsx(Tooltip$1, { content: ({ active, payload, label }) => {
|
|
110
|
+
if (!active || !payload?.length) return null;
|
|
111
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
112
|
+
className: "rounded-lg border bg-popover px-3 py-2 text-sm shadow-md",
|
|
113
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
114
|
+
className: "font-medium mb-1",
|
|
115
|
+
children: label
|
|
116
|
+
}), payload.map((entry, index) => /* @__PURE__ */ jsxs("p", {
|
|
117
|
+
className: "flex items-center gap-2 text-muted-foreground",
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ jsx("span", {
|
|
120
|
+
className: "w-2 h-2 rounded-full",
|
|
121
|
+
style: { backgroundColor: entry.color }
|
|
122
|
+
}),
|
|
123
|
+
entry.name,
|
|
124
|
+
": ",
|
|
125
|
+
valueFormatter(entry.value)
|
|
126
|
+
]
|
|
127
|
+
}, index))]
|
|
128
|
+
});
|
|
129
|
+
} }),
|
|
130
|
+
/* @__PURE__ */ jsx(Area, {
|
|
131
|
+
type: "monotone",
|
|
132
|
+
dataKey: primaryLabel,
|
|
133
|
+
stroke: primaryColorValue,
|
|
134
|
+
fill: "url(#primaryGradient)",
|
|
135
|
+
strokeWidth: 2
|
|
136
|
+
}),
|
|
137
|
+
hasSecondary && secondaryLabel && /* @__PURE__ */ jsx(Area, {
|
|
138
|
+
type: "monotone",
|
|
139
|
+
dataKey: secondaryLabel,
|
|
140
|
+
stroke: secondaryColorValue,
|
|
141
|
+
fill: "url(#secondaryGradient)",
|
|
142
|
+
strokeWidth: 2
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
})
|
|
146
|
+
}), shouldShowLegend && /* @__PURE__ */ jsxs("div", {
|
|
147
|
+
className: "flex justify-center gap-4 mt-2",
|
|
148
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
149
|
+
className: "flex items-center gap-2 text-xs",
|
|
150
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
151
|
+
className: "w-3 h-3 rounded-full",
|
|
152
|
+
style: { backgroundColor: primaryColorValue }
|
|
153
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
154
|
+
className: "text-muted-foreground",
|
|
155
|
+
children: primaryLabel
|
|
156
|
+
})]
|
|
157
|
+
}), hasSecondary && secondaryLabel && /* @__PURE__ */ jsxs("div", {
|
|
158
|
+
className: "flex items-center gap-2 text-xs",
|
|
159
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
160
|
+
className: "w-3 h-3 rounded-full",
|
|
161
|
+
style: { backgroundColor: secondaryColorValue }
|
|
162
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
163
|
+
className: "text-muted-foreground",
|
|
164
|
+
children: secondaryLabel
|
|
165
|
+
})]
|
|
166
|
+
})]
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/components/data-display/charts/bar-list-chart.tsx
|
|
173
|
+
function BarListChart({ data, valueFormatter = (v) => v.toLocaleString(), onItemClick, className, emptyMessage = "No data available", color = "hsl(217, 91%, 60%)" }) {
|
|
174
|
+
if (data.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
175
|
+
className: "h-48 flex items-center justify-center text-sm text-muted-foreground",
|
|
176
|
+
children: emptyMessage
|
|
177
|
+
});
|
|
178
|
+
const maxValue = Math.max(...data.map((d) => d.value));
|
|
179
|
+
return /* @__PURE__ */ jsx("div", {
|
|
180
|
+
className: cn("space-y-3", className),
|
|
181
|
+
children: data.map((item, index) => {
|
|
182
|
+
const percentage = maxValue > 0 ? item.value / maxValue * 100 : 0;
|
|
183
|
+
const isClickable = !!onItemClick;
|
|
184
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
185
|
+
className: cn("group", isClickable && "cursor-pointer"),
|
|
186
|
+
onClick: () => onItemClick?.(item),
|
|
187
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
188
|
+
className: "flex items-center justify-between mb-1",
|
|
189
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
190
|
+
className: cn("text-sm truncate flex-1 mr-4", isClickable && "group-hover:text-foreground"),
|
|
191
|
+
children: item.name
|
|
192
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
193
|
+
className: "text-sm font-medium tabular-nums",
|
|
194
|
+
children: valueFormatter(item.value)
|
|
195
|
+
})]
|
|
196
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
197
|
+
className: "h-2 bg-muted rounded-full overflow-hidden",
|
|
198
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
199
|
+
className: cn("h-full rounded-full transition-all duration-300", isClickable && "group-hover:opacity-80"),
|
|
200
|
+
style: {
|
|
201
|
+
width: `${percentage}%`,
|
|
202
|
+
backgroundColor: color
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
})]
|
|
206
|
+
}, index);
|
|
207
|
+
})
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/components/data-display/charts/latency-percentiles-chart.tsx
|
|
213
|
+
function defaultFormatDuration(ms) {
|
|
214
|
+
if (ms < 1) return "<1ms";
|
|
215
|
+
if (ms < 1e3) return `${Math.round(ms)}ms`;
|
|
216
|
+
return `${(ms / 1e3).toFixed(2)}s`;
|
|
217
|
+
}
|
|
218
|
+
const PERCENTILE_COLORS = {
|
|
219
|
+
p50: "hsl(217, 91%, 60%)",
|
|
220
|
+
p95: "hsl(38, 92%, 50%)",
|
|
221
|
+
p99: "hsl(0, 84%, 60%)"
|
|
222
|
+
};
|
|
223
|
+
function LatencyPercentilesChart({ p50, p95, p99, className, valueFormatter = defaultFormatDuration }) {
|
|
224
|
+
const chartData = [
|
|
225
|
+
{
|
|
226
|
+
name: "p50",
|
|
227
|
+
label: "p50 (Median)",
|
|
228
|
+
value: p50,
|
|
229
|
+
color: PERCENTILE_COLORS.p50
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: "p95",
|
|
233
|
+
label: "p95",
|
|
234
|
+
value: p95,
|
|
235
|
+
color: PERCENTILE_COLORS.p95
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: "p99",
|
|
239
|
+
label: "p99",
|
|
240
|
+
value: p99,
|
|
241
|
+
color: PERCENTILE_COLORS.p99
|
|
242
|
+
}
|
|
243
|
+
];
|
|
244
|
+
if (p99 === 0) return /* @__PURE__ */ jsx("div", {
|
|
245
|
+
className: "h-48 flex items-center justify-center text-sm text-muted-foreground",
|
|
246
|
+
children: "No data available"
|
|
247
|
+
});
|
|
248
|
+
return /* @__PURE__ */ jsx("div", {
|
|
249
|
+
className: cn("h-48", className),
|
|
250
|
+
children: /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
251
|
+
width: "100%",
|
|
252
|
+
height: "100%",
|
|
253
|
+
children: /* @__PURE__ */ jsxs(BarChart, {
|
|
254
|
+
data: chartData,
|
|
255
|
+
layout: "vertical",
|
|
256
|
+
barSize: 20,
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ jsx(XAxis, {
|
|
259
|
+
type: "number",
|
|
260
|
+
tickFormatter: valueFormatter,
|
|
261
|
+
tick: {
|
|
262
|
+
fill: "hsl(var(--muted-foreground))",
|
|
263
|
+
fontSize: 12
|
|
264
|
+
},
|
|
265
|
+
axisLine: false,
|
|
266
|
+
tickLine: false
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ jsx(YAxis, {
|
|
269
|
+
type: "category",
|
|
270
|
+
dataKey: "label",
|
|
271
|
+
width: 90,
|
|
272
|
+
tick: {
|
|
273
|
+
fill: "hsl(var(--muted-foreground))",
|
|
274
|
+
fontSize: 12
|
|
275
|
+
},
|
|
276
|
+
axisLine: false,
|
|
277
|
+
tickLine: false
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ jsx(Tooltip$1, { content: ({ active, payload }) => {
|
|
280
|
+
if (!active || !payload?.length) return null;
|
|
281
|
+
const item = payload[0]?.payload;
|
|
282
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
283
|
+
className: "rounded-lg border bg-popover px-3 py-2 text-sm shadow-md",
|
|
284
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
285
|
+
className: "font-medium",
|
|
286
|
+
children: item.label
|
|
287
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
288
|
+
className: "text-muted-foreground",
|
|
289
|
+
children: valueFormatter(item.value)
|
|
290
|
+
})]
|
|
291
|
+
});
|
|
292
|
+
} }),
|
|
293
|
+
/* @__PURE__ */ jsx(Bar, {
|
|
294
|
+
dataKey: "value",
|
|
295
|
+
radius: [
|
|
296
|
+
0,
|
|
297
|
+
4,
|
|
298
|
+
4,
|
|
299
|
+
0
|
|
300
|
+
],
|
|
301
|
+
children: chartData.map((entry, index) => /* @__PURE__ */ jsx(Cell, { fill: entry.color }, `cell-${index}`))
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
})
|
|
305
|
+
})
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/components/data-display/charts/status-distribution-chart.tsx
|
|
311
|
+
const STATUS_CONFIG = {
|
|
312
|
+
"2xx": {
|
|
313
|
+
label: "2xx Success",
|
|
314
|
+
color: "hsl(142, 71%, 45%)"
|
|
315
|
+
},
|
|
316
|
+
"3xx": {
|
|
317
|
+
label: "3xx Redirect",
|
|
318
|
+
color: "hsl(217, 91%, 60%)"
|
|
319
|
+
},
|
|
320
|
+
"4xx": {
|
|
321
|
+
label: "4xx Client Error",
|
|
322
|
+
color: "hsl(38, 92%, 50%)"
|
|
323
|
+
},
|
|
324
|
+
"5xx": {
|
|
325
|
+
label: "5xx Server Error",
|
|
326
|
+
color: "hsl(0, 84%, 60%)"
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
function StatusDistributionChart({ data, className }) {
|
|
330
|
+
const chartData = Object.entries(data).filter(([, value]) => value > 0).map(([key, value]) => ({
|
|
331
|
+
name: STATUS_CONFIG[key].label,
|
|
332
|
+
value,
|
|
333
|
+
color: STATUS_CONFIG[key].color
|
|
334
|
+
}));
|
|
335
|
+
const total = chartData.reduce((sum, d) => sum + d.value, 0);
|
|
336
|
+
if (total === 0) return /* @__PURE__ */ jsx("div", {
|
|
337
|
+
className: "h-48 flex items-center justify-center text-sm text-muted-foreground",
|
|
338
|
+
children: "No data available"
|
|
339
|
+
});
|
|
340
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
341
|
+
className: cn("h-48", className),
|
|
342
|
+
children: [/* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
343
|
+
width: "100%",
|
|
344
|
+
height: "100%",
|
|
345
|
+
children: /* @__PURE__ */ jsxs(PieChart, { children: [/* @__PURE__ */ jsx(Pie, {
|
|
346
|
+
data: chartData,
|
|
347
|
+
cx: "50%",
|
|
348
|
+
cy: "50%",
|
|
349
|
+
innerRadius: 50,
|
|
350
|
+
outerRadius: 70,
|
|
351
|
+
paddingAngle: 2,
|
|
352
|
+
dataKey: "value",
|
|
353
|
+
nameKey: "name",
|
|
354
|
+
children: chartData.map((entry, index) => /* @__PURE__ */ jsx(Cell, { fill: entry.color }, `cell-${index}`))
|
|
355
|
+
}), /* @__PURE__ */ jsx(Tooltip$1, { content: ({ active, payload }) => {
|
|
356
|
+
if (!active || !payload?.length) return null;
|
|
357
|
+
const item = payload[0];
|
|
358
|
+
const percent = (item.value / total * 100).toFixed(1);
|
|
359
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
360
|
+
className: "rounded-lg border bg-popover px-3 py-2 text-sm shadow-md",
|
|
361
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
362
|
+
className: "font-medium",
|
|
363
|
+
children: item.name
|
|
364
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
365
|
+
className: "text-muted-foreground",
|
|
366
|
+
children: [
|
|
367
|
+
item.value.toLocaleString(),
|
|
368
|
+
" (",
|
|
369
|
+
percent,
|
|
370
|
+
"%)"
|
|
371
|
+
]
|
|
372
|
+
})]
|
|
373
|
+
});
|
|
374
|
+
} })] })
|
|
375
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
376
|
+
className: "flex flex-wrap justify-center gap-4 mt-2",
|
|
377
|
+
children: chartData.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
378
|
+
className: "flex items-center gap-2 text-xs",
|
|
379
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
380
|
+
className: "w-3 h-3 rounded-full",
|
|
381
|
+
style: { backgroundColor: item.color }
|
|
382
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
383
|
+
className: "text-muted-foreground",
|
|
384
|
+
children: item.name
|
|
385
|
+
})]
|
|
386
|
+
}, item.name))
|
|
387
|
+
})]
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/components/data-display/charts/time-range-selector.tsx
|
|
393
|
+
const defaultPresets = [
|
|
394
|
+
{
|
|
395
|
+
label: "1h",
|
|
396
|
+
value: "1h"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
label: "6h",
|
|
400
|
+
value: "6h"
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
label: "24h",
|
|
404
|
+
value: "24h"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
label: "7d",
|
|
408
|
+
value: "7d"
|
|
409
|
+
}
|
|
410
|
+
];
|
|
411
|
+
function getPresetRange(preset) {
|
|
412
|
+
const end = /* @__PURE__ */ new Date();
|
|
413
|
+
switch (preset) {
|
|
414
|
+
case "1h": return {
|
|
415
|
+
start: subHours(end, 1),
|
|
416
|
+
end
|
|
417
|
+
};
|
|
418
|
+
case "6h": return {
|
|
419
|
+
start: subHours(end, 6),
|
|
420
|
+
end
|
|
421
|
+
};
|
|
422
|
+
case "24h": return {
|
|
423
|
+
start: subHours(end, 24),
|
|
424
|
+
end
|
|
425
|
+
};
|
|
426
|
+
case "7d": return {
|
|
427
|
+
start: subDays(end, 7),
|
|
428
|
+
end
|
|
429
|
+
};
|
|
430
|
+
default: return {
|
|
431
|
+
start: subHours(end, 1),
|
|
432
|
+
end
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
function TimeRangeSelector({ value, onChange, presets = defaultPresets, className }) {
|
|
437
|
+
const handlePresetClick = (preset) => {
|
|
438
|
+
const range = getPresetRange(preset);
|
|
439
|
+
onChange({
|
|
440
|
+
preset,
|
|
441
|
+
...range
|
|
442
|
+
});
|
|
443
|
+
};
|
|
444
|
+
return /* @__PURE__ */ jsx("div", {
|
|
445
|
+
className: cn("flex items-center gap-2", className),
|
|
446
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
447
|
+
className: "flex rounded-md border border-border overflow-hidden",
|
|
448
|
+
children: presets.map(({ label, value: preset }, index) => /* @__PURE__ */ jsx("button", {
|
|
449
|
+
type: "button",
|
|
450
|
+
onClick: () => handlePresetClick(preset),
|
|
451
|
+
className: cn("px-3 py-1.5 text-sm font-medium transition-colors", value.preset === preset ? "bg-primary text-primary-foreground" : "bg-card hover:bg-muted text-foreground", index > 0 && "border-l border-border"),
|
|
452
|
+
children: label
|
|
453
|
+
}, preset))
|
|
454
|
+
})
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Create a time range from a preset
|
|
459
|
+
*/
|
|
460
|
+
function createTimeRange(preset = "1h") {
|
|
461
|
+
const range = getPresetRange(preset);
|
|
462
|
+
return {
|
|
463
|
+
preset,
|
|
464
|
+
...range
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
//#endregion
|
|
469
|
+
//#region src/components/ui/button.tsx
|
|
470
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", {
|
|
471
|
+
variants: {
|
|
472
|
+
variant: {
|
|
473
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
474
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
475
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
476
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
477
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
478
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
479
|
+
},
|
|
480
|
+
size: {
|
|
481
|
+
default: "h-9 px-4 py-2",
|
|
482
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
483
|
+
lg: "h-10 rounded-md px-8",
|
|
484
|
+
icon: "h-9 w-9"
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
defaultVariants: {
|
|
488
|
+
variant: "default",
|
|
489
|
+
size: "default"
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
const Button = React.forwardRef(({ className, variant, size, asChild = false,...props }, ref) => {
|
|
493
|
+
const Comp = asChild ? Slot : "button";
|
|
494
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
495
|
+
className: cn(buttonVariants({
|
|
496
|
+
variant,
|
|
497
|
+
size,
|
|
498
|
+
className
|
|
499
|
+
})),
|
|
500
|
+
ref,
|
|
501
|
+
...props
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
Button.displayName = "Button";
|
|
505
|
+
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/components/ui/select.tsx
|
|
508
|
+
const Select = SelectPrimitive.Root;
|
|
509
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
510
|
+
const SelectValue = SelectPrimitive.Value;
|
|
511
|
+
const SelectTrigger = React.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
|
|
512
|
+
ref,
|
|
513
|
+
className: cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className),
|
|
514
|
+
...props,
|
|
515
|
+
children: [children, /* @__PURE__ */ jsx(SelectPrimitive.Icon, {
|
|
516
|
+
asChild: true,
|
|
517
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 opacity-50" })
|
|
518
|
+
})]
|
|
519
|
+
}));
|
|
520
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
521
|
+
const SelectScrollUpButton = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.ScrollUpButton, {
|
|
522
|
+
ref,
|
|
523
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
524
|
+
...props,
|
|
525
|
+
children: /* @__PURE__ */ jsx(ChevronUp, { className: "h-4 w-4" })
|
|
526
|
+
}));
|
|
527
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
528
|
+
const SelectScrollDownButton = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.ScrollDownButton, {
|
|
529
|
+
ref,
|
|
530
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
531
|
+
...props,
|
|
532
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
|
|
533
|
+
}));
|
|
534
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
535
|
+
const SelectContent = React.forwardRef(({ className, children, position = "popper",...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(SelectPrimitive.Content, {
|
|
536
|
+
ref,
|
|
537
|
+
className: cn("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
|
|
538
|
+
position,
|
|
539
|
+
...props,
|
|
540
|
+
children: [
|
|
541
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
542
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Viewport, {
|
|
543
|
+
className: cn("p-1", position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),
|
|
544
|
+
children
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
547
|
+
]
|
|
548
|
+
}) }));
|
|
549
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
550
|
+
const SelectLabel = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Label, {
|
|
551
|
+
ref,
|
|
552
|
+
className: cn("px-2 py-1.5 text-sm font-semibold", className),
|
|
553
|
+
...props
|
|
554
|
+
}));
|
|
555
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
556
|
+
const SelectItem = React.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
|
|
557
|
+
ref,
|
|
558
|
+
className: cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
559
|
+
...props,
|
|
560
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
561
|
+
className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
562
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) })
|
|
563
|
+
}), /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })]
|
|
564
|
+
}));
|
|
565
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
566
|
+
const SelectSeparator = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Separator, {
|
|
567
|
+
ref,
|
|
568
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
569
|
+
...props
|
|
570
|
+
}));
|
|
571
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
572
|
+
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region src/components/ui/table.tsx
|
|
575
|
+
const Table = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
576
|
+
className: "relative w-full overflow-auto",
|
|
577
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
578
|
+
ref,
|
|
579
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
580
|
+
...props
|
|
581
|
+
})
|
|
582
|
+
}));
|
|
583
|
+
Table.displayName = "Table";
|
|
584
|
+
const TableHeader = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("thead", {
|
|
585
|
+
ref,
|
|
586
|
+
className: cn("[&_tr]:border-b", className),
|
|
587
|
+
...props
|
|
588
|
+
}));
|
|
589
|
+
TableHeader.displayName = "TableHeader";
|
|
590
|
+
const TableBody = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("tbody", {
|
|
591
|
+
ref,
|
|
592
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
593
|
+
...props
|
|
594
|
+
}));
|
|
595
|
+
TableBody.displayName = "TableBody";
|
|
596
|
+
const TableFooter = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("tfoot", {
|
|
597
|
+
ref,
|
|
598
|
+
className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
|
|
599
|
+
...props
|
|
600
|
+
}));
|
|
601
|
+
TableFooter.displayName = "TableFooter";
|
|
602
|
+
const TableRow = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("tr", {
|
|
603
|
+
ref,
|
|
604
|
+
className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", className),
|
|
605
|
+
...props
|
|
606
|
+
}));
|
|
607
|
+
TableRow.displayName = "TableRow";
|
|
608
|
+
const TableHead = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("th", {
|
|
609
|
+
ref,
|
|
610
|
+
className: cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
611
|
+
...props
|
|
612
|
+
}));
|
|
613
|
+
TableHead.displayName = "TableHead";
|
|
614
|
+
const TableCell = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("td", {
|
|
615
|
+
ref,
|
|
616
|
+
className: cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
617
|
+
...props
|
|
618
|
+
}));
|
|
619
|
+
TableCell.displayName = "TableCell";
|
|
620
|
+
const TableCaption = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("caption", {
|
|
621
|
+
ref,
|
|
622
|
+
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
623
|
+
...props
|
|
624
|
+
}));
|
|
625
|
+
TableCaption.displayName = "TableCaption";
|
|
626
|
+
|
|
627
|
+
//#endregion
|
|
628
|
+
//#region src/components/data-display/data-table.tsx
|
|
629
|
+
function DataTableInner({ className, columns, data, getRowKey = (_, index) => index, sortColumn, sortDirection, onSortChange, pagination = false, page = 1, pageSize = 10, totalItems, onPageChange, onPageSizeChange, pageSizeOptions = [
|
|
630
|
+
10,
|
|
631
|
+
20,
|
|
632
|
+
50,
|
|
633
|
+
100
|
|
634
|
+
], loading = false, emptyState, onRowClick, selectedKeys, striped = false, hoverable = true, compact = false,...props }, ref) {
|
|
635
|
+
const total = totalItems ?? data.length;
|
|
636
|
+
const totalPages = Math.ceil(total / pageSize);
|
|
637
|
+
const handleSort = (columnKey) => {
|
|
638
|
+
if (!onSortChange) return;
|
|
639
|
+
if (sortColumn === columnKey) onSortChange(columnKey, sortDirection === "asc" ? "desc" : "asc");
|
|
640
|
+
else onSortChange(columnKey, "asc");
|
|
641
|
+
};
|
|
642
|
+
const getSortIcon = (columnKey) => {
|
|
643
|
+
if (sortColumn !== columnKey) return /* @__PURE__ */ jsx(ArrowUpDown, { className: "ml-1 h-3.5 w-3.5 text-muted-foreground" });
|
|
644
|
+
return sortDirection === "asc" ? /* @__PURE__ */ jsx(ArrowUp, { className: "ml-1 h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(ArrowDown, { className: "ml-1 h-3.5 w-3.5" });
|
|
645
|
+
};
|
|
646
|
+
const getAlignClass = (align) => {
|
|
647
|
+
switch (align) {
|
|
648
|
+
case "center": return "text-center";
|
|
649
|
+
case "right": return "text-right";
|
|
650
|
+
default: return "text-left";
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
654
|
+
ref,
|
|
655
|
+
className: cn("w-full", className),
|
|
656
|
+
...props,
|
|
657
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
658
|
+
className: "rounded-md border border-border overflow-hidden",
|
|
659
|
+
children: /* @__PURE__ */ jsxs(Table, { children: [/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsx(TableRow, {
|
|
660
|
+
className: "hover:bg-transparent",
|
|
661
|
+
children: columns.map((column) => /* @__PURE__ */ jsx(TableHead, {
|
|
662
|
+
className: cn(getAlignClass(column.align), column.sortable && "cursor-pointer select-none", compact ? "py-2" : "py-3", column.headerClassName),
|
|
663
|
+
style: { width: column.width },
|
|
664
|
+
onClick: column.sortable ? () => handleSort(column.key) : void 0,
|
|
665
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
666
|
+
className: cn("flex items-center", column.align === "center" && "justify-center", column.align === "right" && "justify-end"),
|
|
667
|
+
children: [column.header, column.sortable && getSortIcon(column.key)]
|
|
668
|
+
})
|
|
669
|
+
}, column.key))
|
|
670
|
+
}) }), /* @__PURE__ */ jsx(TableBody, { children: loading ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, {
|
|
671
|
+
colSpan: columns.length,
|
|
672
|
+
className: "h-24 text-center text-muted-foreground",
|
|
673
|
+
children: "Loading..."
|
|
674
|
+
}) }) : data.length === 0 ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, {
|
|
675
|
+
colSpan: columns.length,
|
|
676
|
+
className: "h-24 text-center text-muted-foreground",
|
|
677
|
+
children: emptyState ?? "No data available"
|
|
678
|
+
}) }) : data.map((row, rowIndex) => {
|
|
679
|
+
const rowKey = getRowKey(row, rowIndex);
|
|
680
|
+
const isSelected = selectedKeys?.has(rowKey);
|
|
681
|
+
return /* @__PURE__ */ jsx(TableRow, {
|
|
682
|
+
className: cn(striped && rowIndex % 2 === 1 && "bg-surface/50", hoverable && "hover:bg-surface-hover cursor-pointer", isSelected && "bg-accent/10", onRowClick && "cursor-pointer"),
|
|
683
|
+
onClick: onRowClick ? () => onRowClick(row, rowIndex) : void 0,
|
|
684
|
+
children: columns.map((column) => /* @__PURE__ */ jsx(TableCell, {
|
|
685
|
+
className: cn(getAlignClass(column.align), compact ? "py-2" : "py-3", column.cellClassName),
|
|
686
|
+
children: column.cell ? column.cell(row, rowIndex) : column.accessor ? column.accessor(row) : row[column.key]
|
|
687
|
+
}, column.key))
|
|
688
|
+
}, rowKey);
|
|
689
|
+
}) })] })
|
|
690
|
+
}), pagination && totalPages > 0 && /* @__PURE__ */ jsxs("div", {
|
|
691
|
+
className: "flex items-center justify-between px-2 py-4",
|
|
692
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
693
|
+
className: "flex items-center gap-2 text-sm text-muted-foreground",
|
|
694
|
+
children: [/* @__PURE__ */ jsx("span", { children: "Rows per page:" }), /* @__PURE__ */ jsxs(Select, {
|
|
695
|
+
value: String(pageSize),
|
|
696
|
+
onValueChange: (value) => onPageSizeChange?.(Number(value)),
|
|
697
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
698
|
+
className: "h-8 w-[70px]",
|
|
699
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
700
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx(SelectItem, {
|
|
701
|
+
value: String(size),
|
|
702
|
+
children: size
|
|
703
|
+
}, size)) })]
|
|
704
|
+
})]
|
|
705
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
706
|
+
className: "flex items-center gap-2",
|
|
707
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
708
|
+
className: "text-sm text-muted-foreground",
|
|
709
|
+
children: [
|
|
710
|
+
"Page ",
|
|
711
|
+
page,
|
|
712
|
+
" of ",
|
|
713
|
+
totalPages
|
|
714
|
+
]
|
|
715
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
716
|
+
className: "flex items-center gap-1",
|
|
717
|
+
children: [
|
|
718
|
+
/* @__PURE__ */ jsx(Button, {
|
|
719
|
+
variant: "outline",
|
|
720
|
+
size: "icon",
|
|
721
|
+
className: "h-8 w-8",
|
|
722
|
+
onClick: () => onPageChange?.(1),
|
|
723
|
+
disabled: page <= 1,
|
|
724
|
+
children: /* @__PURE__ */ jsx(ChevronsLeft, { className: "h-4 w-4" })
|
|
725
|
+
}),
|
|
726
|
+
/* @__PURE__ */ jsx(Button, {
|
|
727
|
+
variant: "outline",
|
|
728
|
+
size: "icon",
|
|
729
|
+
className: "h-8 w-8",
|
|
730
|
+
onClick: () => onPageChange?.(page - 1),
|
|
731
|
+
disabled: page <= 1,
|
|
732
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
|
|
733
|
+
}),
|
|
734
|
+
/* @__PURE__ */ jsx(Button, {
|
|
735
|
+
variant: "outline",
|
|
736
|
+
size: "icon",
|
|
737
|
+
className: "h-8 w-8",
|
|
738
|
+
onClick: () => onPageChange?.(page + 1),
|
|
739
|
+
disabled: page >= totalPages,
|
|
740
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
741
|
+
}),
|
|
742
|
+
/* @__PURE__ */ jsx(Button, {
|
|
743
|
+
variant: "outline",
|
|
744
|
+
size: "icon",
|
|
745
|
+
className: "h-8 w-8",
|
|
746
|
+
onClick: () => onPageChange?.(totalPages),
|
|
747
|
+
disabled: page >= totalPages,
|
|
748
|
+
children: /* @__PURE__ */ jsx(ChevronsRight, { className: "h-4 w-4" })
|
|
749
|
+
})
|
|
750
|
+
]
|
|
751
|
+
})]
|
|
752
|
+
})]
|
|
753
|
+
})]
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
const DataTable = React.forwardRef(DataTableInner);
|
|
757
|
+
|
|
758
|
+
//#endregion
|
|
759
|
+
//#region src/components/data-display/json-viewer.tsx
|
|
760
|
+
const JsonViewer = React.forwardRef(({ className, data, defaultExpanded = true, expandDepth = 2, copyable = true, keyClassName, valueClassName,...props }, ref) => {
|
|
761
|
+
const [copied, setCopied] = React.useState(false);
|
|
762
|
+
const handleCopy = async () => {
|
|
763
|
+
await navigator.clipboard.writeText(JSON.stringify(data, null, 2));
|
|
764
|
+
setCopied(true);
|
|
765
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
766
|
+
};
|
|
767
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
768
|
+
ref,
|
|
769
|
+
className: cn("relative rounded-md bg-surface border border-border font-mono text-sm", className),
|
|
770
|
+
...props,
|
|
771
|
+
children: [copyable && /* @__PURE__ */ jsx("button", {
|
|
772
|
+
type: "button",
|
|
773
|
+
onClick: handleCopy,
|
|
774
|
+
className: "absolute right-2 top-2 p-1.5 rounded-md hover:bg-surface-hover text-muted-foreground hover:text-foreground transition-colors",
|
|
775
|
+
"aria-label": "Copy JSON",
|
|
776
|
+
children: copied ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-green-500" }) : /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4" })
|
|
777
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
778
|
+
className: "p-3 overflow-auto",
|
|
779
|
+
children: /* @__PURE__ */ jsx(JsonNode, {
|
|
780
|
+
data,
|
|
781
|
+
depth: 0,
|
|
782
|
+
defaultExpanded,
|
|
783
|
+
expandDepth,
|
|
784
|
+
keyClassName,
|
|
785
|
+
valueClassName
|
|
786
|
+
})
|
|
787
|
+
})]
|
|
788
|
+
});
|
|
789
|
+
});
|
|
790
|
+
JsonViewer.displayName = "JsonViewer";
|
|
791
|
+
function JsonNode({ data, depth, defaultExpanded, expandDepth, keyClassName, valueClassName, propertyKey, isLast = true }) {
|
|
792
|
+
const [expanded, setExpanded] = React.useState(defaultExpanded && depth < expandDepth);
|
|
793
|
+
const indent = depth * 16;
|
|
794
|
+
if (data === null) return /* @__PURE__ */ jsxs("span", {
|
|
795
|
+
className: "inline",
|
|
796
|
+
children: [
|
|
797
|
+
propertyKey && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
798
|
+
className: cn("text-purple-400", keyClassName),
|
|
799
|
+
children: [
|
|
800
|
+
"\"",
|
|
801
|
+
propertyKey,
|
|
802
|
+
"\""
|
|
803
|
+
]
|
|
804
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
805
|
+
className: "text-muted-foreground",
|
|
806
|
+
children: ": "
|
|
807
|
+
})] }),
|
|
808
|
+
/* @__PURE__ */ jsx("span", {
|
|
809
|
+
className: cn("text-orange-400", valueClassName),
|
|
810
|
+
children: "null"
|
|
811
|
+
}),
|
|
812
|
+
!isLast && /* @__PURE__ */ jsx("span", {
|
|
813
|
+
className: "text-muted-foreground",
|
|
814
|
+
children: ","
|
|
815
|
+
})
|
|
816
|
+
]
|
|
817
|
+
});
|
|
818
|
+
if (data === void 0) return /* @__PURE__ */ jsxs("span", {
|
|
819
|
+
className: "inline",
|
|
820
|
+
children: [
|
|
821
|
+
propertyKey && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
822
|
+
className: cn("text-purple-400", keyClassName),
|
|
823
|
+
children: [
|
|
824
|
+
"\"",
|
|
825
|
+
propertyKey,
|
|
826
|
+
"\""
|
|
827
|
+
]
|
|
828
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
829
|
+
className: "text-muted-foreground",
|
|
830
|
+
children: ": "
|
|
831
|
+
})] }),
|
|
832
|
+
/* @__PURE__ */ jsx("span", {
|
|
833
|
+
className: cn("text-gray-500", valueClassName),
|
|
834
|
+
children: "undefined"
|
|
835
|
+
}),
|
|
836
|
+
!isLast && /* @__PURE__ */ jsx("span", {
|
|
837
|
+
className: "text-muted-foreground",
|
|
838
|
+
children: ","
|
|
839
|
+
})
|
|
840
|
+
]
|
|
841
|
+
});
|
|
842
|
+
if (typeof data === "boolean") return /* @__PURE__ */ jsxs("span", {
|
|
843
|
+
className: "inline",
|
|
844
|
+
children: [
|
|
845
|
+
propertyKey && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
846
|
+
className: cn("text-purple-400", keyClassName),
|
|
847
|
+
children: [
|
|
848
|
+
"\"",
|
|
849
|
+
propertyKey,
|
|
850
|
+
"\""
|
|
851
|
+
]
|
|
852
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
853
|
+
className: "text-muted-foreground",
|
|
854
|
+
children: ": "
|
|
855
|
+
})] }),
|
|
856
|
+
/* @__PURE__ */ jsx("span", {
|
|
857
|
+
className: cn("text-blue-400", valueClassName),
|
|
858
|
+
children: String(data)
|
|
859
|
+
}),
|
|
860
|
+
!isLast && /* @__PURE__ */ jsx("span", {
|
|
861
|
+
className: "text-muted-foreground",
|
|
862
|
+
children: ","
|
|
863
|
+
})
|
|
864
|
+
]
|
|
865
|
+
});
|
|
866
|
+
if (typeof data === "number") return /* @__PURE__ */ jsxs("span", {
|
|
867
|
+
className: "inline",
|
|
868
|
+
children: [
|
|
869
|
+
propertyKey && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
870
|
+
className: cn("text-purple-400", keyClassName),
|
|
871
|
+
children: [
|
|
872
|
+
"\"",
|
|
873
|
+
propertyKey,
|
|
874
|
+
"\""
|
|
875
|
+
]
|
|
876
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
877
|
+
className: "text-muted-foreground",
|
|
878
|
+
children: ": "
|
|
879
|
+
})] }),
|
|
880
|
+
/* @__PURE__ */ jsx("span", {
|
|
881
|
+
className: cn("text-amber-400", valueClassName),
|
|
882
|
+
children: data
|
|
883
|
+
}),
|
|
884
|
+
!isLast && /* @__PURE__ */ jsx("span", {
|
|
885
|
+
className: "text-muted-foreground",
|
|
886
|
+
children: ","
|
|
887
|
+
})
|
|
888
|
+
]
|
|
889
|
+
});
|
|
890
|
+
if (typeof data === "string") return /* @__PURE__ */ jsxs("span", {
|
|
891
|
+
className: "inline",
|
|
892
|
+
children: [
|
|
893
|
+
propertyKey && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
894
|
+
className: cn("text-purple-400", keyClassName),
|
|
895
|
+
children: [
|
|
896
|
+
"\"",
|
|
897
|
+
propertyKey,
|
|
898
|
+
"\""
|
|
899
|
+
]
|
|
900
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
901
|
+
className: "text-muted-foreground",
|
|
902
|
+
children: ": "
|
|
903
|
+
})] }),
|
|
904
|
+
/* @__PURE__ */ jsxs("span", {
|
|
905
|
+
className: cn("text-green-400", valueClassName),
|
|
906
|
+
children: [
|
|
907
|
+
"\"",
|
|
908
|
+
data,
|
|
909
|
+
"\""
|
|
910
|
+
]
|
|
911
|
+
}),
|
|
912
|
+
!isLast && /* @__PURE__ */ jsx("span", {
|
|
913
|
+
className: "text-muted-foreground",
|
|
914
|
+
children: ","
|
|
915
|
+
})
|
|
916
|
+
]
|
|
917
|
+
});
|
|
918
|
+
if (Array.isArray(data)) {
|
|
919
|
+
if (data.length === 0) return /* @__PURE__ */ jsxs("span", {
|
|
920
|
+
className: "inline",
|
|
921
|
+
children: [
|
|
922
|
+
propertyKey && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
923
|
+
className: cn("text-purple-400", keyClassName),
|
|
924
|
+
children: [
|
|
925
|
+
"\"",
|
|
926
|
+
propertyKey,
|
|
927
|
+
"\""
|
|
928
|
+
]
|
|
929
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
930
|
+
className: "text-muted-foreground",
|
|
931
|
+
children: ": "
|
|
932
|
+
})] }),
|
|
933
|
+
/* @__PURE__ */ jsx("span", {
|
|
934
|
+
className: "text-muted-foreground",
|
|
935
|
+
children: "[]"
|
|
936
|
+
}),
|
|
937
|
+
!isLast && /* @__PURE__ */ jsx("span", {
|
|
938
|
+
className: "text-muted-foreground",
|
|
939
|
+
children: ","
|
|
940
|
+
})
|
|
941
|
+
]
|
|
942
|
+
});
|
|
943
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
944
|
+
className: "inline-block",
|
|
945
|
+
children: [
|
|
946
|
+
/* @__PURE__ */ jsxs("span", {
|
|
947
|
+
className: "inline-flex items-center cursor-pointer hover:text-foreground text-muted-foreground",
|
|
948
|
+
onClick: () => setExpanded(!expanded),
|
|
949
|
+
children: [
|
|
950
|
+
expanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3.5 w-3.5 mr-0.5" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3.5 w-3.5 mr-0.5" }),
|
|
951
|
+
propertyKey && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
952
|
+
className: cn("text-purple-400", keyClassName),
|
|
953
|
+
children: [
|
|
954
|
+
"\"",
|
|
955
|
+
propertyKey,
|
|
956
|
+
"\""
|
|
957
|
+
]
|
|
958
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
959
|
+
className: "text-muted-foreground",
|
|
960
|
+
children: ": "
|
|
961
|
+
})] }),
|
|
962
|
+
/* @__PURE__ */ jsx("span", {
|
|
963
|
+
className: "text-muted-foreground",
|
|
964
|
+
children: "["
|
|
965
|
+
}),
|
|
966
|
+
!expanded && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
967
|
+
className: "text-muted-foreground mx-1",
|
|
968
|
+
children: [data.length, " items"]
|
|
969
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
970
|
+
className: "text-muted-foreground",
|
|
971
|
+
children: "]"
|
|
972
|
+
})] })
|
|
973
|
+
]
|
|
974
|
+
}),
|
|
975
|
+
expanded && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
976
|
+
style: { paddingLeft: indent + 16 },
|
|
977
|
+
children: data.map((item, index) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(JsonNode, {
|
|
978
|
+
data: item,
|
|
979
|
+
depth: depth + 1,
|
|
980
|
+
defaultExpanded,
|
|
981
|
+
expandDepth,
|
|
982
|
+
keyClassName,
|
|
983
|
+
valueClassName,
|
|
984
|
+
isLast: index === data.length - 1
|
|
985
|
+
}) }, index))
|
|
986
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
987
|
+
className: "text-muted-foreground",
|
|
988
|
+
children: "]"
|
|
989
|
+
})] }),
|
|
990
|
+
!isLast && /* @__PURE__ */ jsx("span", {
|
|
991
|
+
className: "text-muted-foreground",
|
|
992
|
+
children: ","
|
|
993
|
+
})
|
|
994
|
+
]
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
if (typeof data === "object") {
|
|
998
|
+
const entries = Object.entries(data);
|
|
999
|
+
if (entries.length === 0) return /* @__PURE__ */ jsxs("span", {
|
|
1000
|
+
className: "inline",
|
|
1001
|
+
children: [
|
|
1002
|
+
propertyKey && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
1003
|
+
className: cn("text-purple-400", keyClassName),
|
|
1004
|
+
children: [
|
|
1005
|
+
"\"",
|
|
1006
|
+
propertyKey,
|
|
1007
|
+
"\""
|
|
1008
|
+
]
|
|
1009
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1010
|
+
className: "text-muted-foreground",
|
|
1011
|
+
children: ": "
|
|
1012
|
+
})] }),
|
|
1013
|
+
/* @__PURE__ */ jsx("span", {
|
|
1014
|
+
className: "text-muted-foreground",
|
|
1015
|
+
children: "{}"
|
|
1016
|
+
}),
|
|
1017
|
+
!isLast && /* @__PURE__ */ jsx("span", {
|
|
1018
|
+
className: "text-muted-foreground",
|
|
1019
|
+
children: ","
|
|
1020
|
+
})
|
|
1021
|
+
]
|
|
1022
|
+
});
|
|
1023
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1024
|
+
className: "inline-block",
|
|
1025
|
+
children: [
|
|
1026
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1027
|
+
className: "inline-flex items-center cursor-pointer hover:text-foreground text-muted-foreground",
|
|
1028
|
+
onClick: () => setExpanded(!expanded),
|
|
1029
|
+
children: [
|
|
1030
|
+
expanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3.5 w-3.5 mr-0.5" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3.5 w-3.5 mr-0.5" }),
|
|
1031
|
+
propertyKey && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
1032
|
+
className: cn("text-purple-400", keyClassName),
|
|
1033
|
+
children: [
|
|
1034
|
+
"\"",
|
|
1035
|
+
propertyKey,
|
|
1036
|
+
"\""
|
|
1037
|
+
]
|
|
1038
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1039
|
+
className: "text-muted-foreground",
|
|
1040
|
+
children: ": "
|
|
1041
|
+
})] }),
|
|
1042
|
+
/* @__PURE__ */ jsx("span", {
|
|
1043
|
+
className: "text-muted-foreground",
|
|
1044
|
+
children: "{"
|
|
1045
|
+
}),
|
|
1046
|
+
!expanded && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
1047
|
+
className: "text-muted-foreground mx-1",
|
|
1048
|
+
children: "..."
|
|
1049
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1050
|
+
className: "text-muted-foreground",
|
|
1051
|
+
children: "}"
|
|
1052
|
+
})] })
|
|
1053
|
+
]
|
|
1054
|
+
}),
|
|
1055
|
+
expanded && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
1056
|
+
style: { paddingLeft: indent + 16 },
|
|
1057
|
+
children: entries.map(([key, value], index) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(JsonNode, {
|
|
1058
|
+
data: value,
|
|
1059
|
+
depth: depth + 1,
|
|
1060
|
+
defaultExpanded,
|
|
1061
|
+
expandDepth,
|
|
1062
|
+
keyClassName,
|
|
1063
|
+
valueClassName,
|
|
1064
|
+
propertyKey: key,
|
|
1065
|
+
isLast: index === entries.length - 1
|
|
1066
|
+
}) }, key))
|
|
1067
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1068
|
+
className: "text-muted-foreground",
|
|
1069
|
+
children: "}"
|
|
1070
|
+
})] }),
|
|
1071
|
+
!isLast && /* @__PURE__ */ jsx("span", {
|
|
1072
|
+
className: "text-muted-foreground",
|
|
1073
|
+
children: ","
|
|
1074
|
+
})
|
|
1075
|
+
]
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1079
|
+
className: cn("text-muted-foreground", valueClassName),
|
|
1080
|
+
children: String(data)
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
//#endregion
|
|
1085
|
+
//#region src/components/data-display/sparkline.tsx
|
|
1086
|
+
const Sparkline = React.forwardRef(({ className, data, width = 100, height = 32, color = "currentColor", strokeWidth = 2, filled = false, fillOpacity = .2, showDots = false, curved = true, min: minProp, max: maxProp,...props }, ref) => {
|
|
1087
|
+
if (data.length === 0) return /* @__PURE__ */ jsx("svg", {
|
|
1088
|
+
ref,
|
|
1089
|
+
className: cn("text-accent", className),
|
|
1090
|
+
width,
|
|
1091
|
+
height,
|
|
1092
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
1093
|
+
...props
|
|
1094
|
+
});
|
|
1095
|
+
const min = minProp ?? Math.min(...data);
|
|
1096
|
+
const max = maxProp ?? Math.max(...data);
|
|
1097
|
+
const range = max - min || 1;
|
|
1098
|
+
const padding = strokeWidth;
|
|
1099
|
+
const chartWidth = width - padding * 2;
|
|
1100
|
+
const chartHeight = height - padding * 2;
|
|
1101
|
+
const points = data.map((value, index) => {
|
|
1102
|
+
const x = padding + index / (data.length - 1 || 1) * chartWidth;
|
|
1103
|
+
const y = padding + chartHeight - (value - min) / range * chartHeight;
|
|
1104
|
+
return {
|
|
1105
|
+
x,
|
|
1106
|
+
y
|
|
1107
|
+
};
|
|
1108
|
+
});
|
|
1109
|
+
let pathD;
|
|
1110
|
+
if (curved && points.length > 2) pathD = points.reduce((acc, point, index) => {
|
|
1111
|
+
if (index === 0) return `M ${point.x},${point.y}`;
|
|
1112
|
+
const prev = points[index - 1];
|
|
1113
|
+
const cpX = (prev.x + point.x) / 2;
|
|
1114
|
+
return `${acc} Q ${prev.x},${prev.y} ${cpX},${(prev.y + point.y) / 2} T ${point.x},${point.y}`;
|
|
1115
|
+
}, "");
|
|
1116
|
+
else pathD = points.map((point, index) => index === 0 ? `M ${point.x},${point.y}` : `L ${point.x},${point.y}`).join(" ");
|
|
1117
|
+
const fillPathD = filled ? `${pathD} L ${points[points.length - 1]?.x},${height - padding} L ${points[0]?.x},${height - padding} Z` : "";
|
|
1118
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
1119
|
+
ref,
|
|
1120
|
+
className: cn("text-accent", className),
|
|
1121
|
+
width,
|
|
1122
|
+
height,
|
|
1123
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
1124
|
+
...props,
|
|
1125
|
+
children: [
|
|
1126
|
+
filled && /* @__PURE__ */ jsx("path", {
|
|
1127
|
+
d: fillPathD,
|
|
1128
|
+
fill: color,
|
|
1129
|
+
opacity: fillOpacity,
|
|
1130
|
+
strokeWidth: 0
|
|
1131
|
+
}),
|
|
1132
|
+
/* @__PURE__ */ jsx("path", {
|
|
1133
|
+
d: pathD,
|
|
1134
|
+
fill: "none",
|
|
1135
|
+
stroke: color,
|
|
1136
|
+
strokeWidth,
|
|
1137
|
+
strokeLinecap: "round",
|
|
1138
|
+
strokeLinejoin: "round"
|
|
1139
|
+
}),
|
|
1140
|
+
showDots && points.map((point, index) => /* @__PURE__ */ jsx("circle", {
|
|
1141
|
+
cx: point.x,
|
|
1142
|
+
cy: point.y,
|
|
1143
|
+
r: strokeWidth + 1,
|
|
1144
|
+
fill: color
|
|
1145
|
+
}, index))
|
|
1146
|
+
]
|
|
1147
|
+
});
|
|
1148
|
+
});
|
|
1149
|
+
Sparkline.displayName = "Sparkline";
|
|
1150
|
+
const SparkBar = React.forwardRef(({ className, data, width = 100, height = 32, color = "currentColor", gap = .2, min: minProp = 0, max: maxProp, radius = 2,...props }, ref) => {
|
|
1151
|
+
if (data.length === 0) return /* @__PURE__ */ jsx("svg", {
|
|
1152
|
+
ref,
|
|
1153
|
+
className: cn("text-accent", className),
|
|
1154
|
+
width,
|
|
1155
|
+
height,
|
|
1156
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
1157
|
+
...props
|
|
1158
|
+
});
|
|
1159
|
+
const min = minProp;
|
|
1160
|
+
const max = maxProp ?? Math.max(...data);
|
|
1161
|
+
const range = max - min || 1;
|
|
1162
|
+
const barWidth = width / data.length;
|
|
1163
|
+
const gapWidth = barWidth * gap;
|
|
1164
|
+
const actualBarWidth = barWidth - gapWidth;
|
|
1165
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
1166
|
+
ref,
|
|
1167
|
+
className: cn("text-accent", className),
|
|
1168
|
+
width,
|
|
1169
|
+
height,
|
|
1170
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
1171
|
+
...props,
|
|
1172
|
+
children: data.map((value, index) => {
|
|
1173
|
+
const barHeight = (value - min) / range * height;
|
|
1174
|
+
const x = index * barWidth + gapWidth / 2;
|
|
1175
|
+
const y = height - barHeight;
|
|
1176
|
+
return /* @__PURE__ */ jsx("rect", {
|
|
1177
|
+
x,
|
|
1178
|
+
y,
|
|
1179
|
+
width: actualBarWidth,
|
|
1180
|
+
height: barHeight,
|
|
1181
|
+
fill: color,
|
|
1182
|
+
rx: radius,
|
|
1183
|
+
ry: radius
|
|
1184
|
+
}, index);
|
|
1185
|
+
})
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1188
|
+
SparkBar.displayName = "SparkBar";
|
|
1189
|
+
const MetricCard = React.forwardRef(({ className, title, value, description, sparklineData, trend, trendValue, icon,...props }, ref) => {
|
|
1190
|
+
const trendColor = trend === "up" ? "text-green-500" : trend === "down" ? "text-red-500" : "text-muted-foreground";
|
|
1191
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1192
|
+
ref,
|
|
1193
|
+
className: cn("rounded-lg border border-border bg-surface p-4", className),
|
|
1194
|
+
...props,
|
|
1195
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1196
|
+
className: "flex items-center justify-between",
|
|
1197
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1198
|
+
className: "text-sm font-medium text-muted-foreground",
|
|
1199
|
+
children: title
|
|
1200
|
+
}), icon && /* @__PURE__ */ jsx("span", {
|
|
1201
|
+
className: "text-muted-foreground",
|
|
1202
|
+
children: icon
|
|
1203
|
+
})]
|
|
1204
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1205
|
+
className: "mt-2 flex items-end justify-between",
|
|
1206
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
|
|
1207
|
+
className: "text-2xl font-bold text-foreground",
|
|
1208
|
+
children: value
|
|
1209
|
+
}), (description || trendValue) && /* @__PURE__ */ jsxs("div", {
|
|
1210
|
+
className: "mt-1 flex items-center gap-1",
|
|
1211
|
+
children: [trendValue && /* @__PURE__ */ jsx("span", {
|
|
1212
|
+
className: cn("text-xs font-medium", trendColor),
|
|
1213
|
+
children: trendValue
|
|
1214
|
+
}), description && /* @__PURE__ */ jsx("span", {
|
|
1215
|
+
className: "text-xs text-muted-foreground",
|
|
1216
|
+
children: description
|
|
1217
|
+
})]
|
|
1218
|
+
})] }), sparklineData && sparklineData.length > 0 && /* @__PURE__ */ jsx(Sparkline, {
|
|
1219
|
+
data: sparklineData,
|
|
1220
|
+
width: 80,
|
|
1221
|
+
height: 32,
|
|
1222
|
+
filled: true,
|
|
1223
|
+
className: trend === "up" ? "text-green-500" : trend === "down" ? "text-red-500" : "text-accent"
|
|
1224
|
+
})]
|
|
1225
|
+
})]
|
|
1226
|
+
});
|
|
1227
|
+
});
|
|
1228
|
+
MetricCard.displayName = "MetricCard";
|
|
1229
|
+
|
|
1230
|
+
//#endregion
|
|
1231
|
+
//#region src/components/data-display/timeline.tsx
|
|
1232
|
+
const timelineVariants = cva("relative", {
|
|
1233
|
+
variants: { orientation: {
|
|
1234
|
+
vertical: "flex flex-col",
|
|
1235
|
+
horizontal: "flex flex-row"
|
|
1236
|
+
} },
|
|
1237
|
+
defaultVariants: { orientation: "vertical" }
|
|
1238
|
+
});
|
|
1239
|
+
const Timeline = React.forwardRef(({ className, orientation = "vertical", children,...props }, ref) => {
|
|
1240
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1241
|
+
ref,
|
|
1242
|
+
className: cn(timelineVariants({
|
|
1243
|
+
orientation,
|
|
1244
|
+
className
|
|
1245
|
+
})),
|
|
1246
|
+
...props,
|
|
1247
|
+
children
|
|
1248
|
+
});
|
|
1249
|
+
});
|
|
1250
|
+
Timeline.displayName = "Timeline";
|
|
1251
|
+
const timelineItemVariants = cva("relative flex", {
|
|
1252
|
+
variants: { orientation: {
|
|
1253
|
+
vertical: "flex-row gap-4 pb-8 last:pb-0",
|
|
1254
|
+
horizontal: "flex-col gap-2 pr-8 last:pr-0"
|
|
1255
|
+
} },
|
|
1256
|
+
defaultVariants: { orientation: "vertical" }
|
|
1257
|
+
});
|
|
1258
|
+
const TimelineItem = React.forwardRef(({ className, orientation = "vertical", active, children,...props }, ref) => {
|
|
1259
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1260
|
+
ref,
|
|
1261
|
+
className: cn(timelineItemVariants({
|
|
1262
|
+
orientation,
|
|
1263
|
+
className
|
|
1264
|
+
})),
|
|
1265
|
+
"data-active": active,
|
|
1266
|
+
...props,
|
|
1267
|
+
children
|
|
1268
|
+
});
|
|
1269
|
+
});
|
|
1270
|
+
TimelineItem.displayName = "TimelineItem";
|
|
1271
|
+
const timelineIndicatorVariants = cva("flex items-center justify-center rounded-full border-2 shrink-0", {
|
|
1272
|
+
variants: {
|
|
1273
|
+
size: {
|
|
1274
|
+
sm: "h-3 w-3",
|
|
1275
|
+
md: "h-4 w-4",
|
|
1276
|
+
lg: "h-6 w-6"
|
|
1277
|
+
},
|
|
1278
|
+
variant: {
|
|
1279
|
+
default: "border-border bg-surface",
|
|
1280
|
+
primary: "border-accent bg-accent",
|
|
1281
|
+
success: "border-green-500 bg-green-500",
|
|
1282
|
+
warning: "border-amber-500 bg-amber-500",
|
|
1283
|
+
error: "border-red-500 bg-red-500",
|
|
1284
|
+
info: "border-blue-500 bg-blue-500",
|
|
1285
|
+
muted: "border-muted-foreground bg-muted"
|
|
1286
|
+
}
|
|
1287
|
+
},
|
|
1288
|
+
defaultVariants: {
|
|
1289
|
+
size: "md",
|
|
1290
|
+
variant: "default"
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
const TimelineIndicator = React.forwardRef(({ className, size, variant, showLine = true, linePosition = "after", orientation = "vertical", children,...props }, ref) => {
|
|
1294
|
+
const isVertical = orientation === "vertical";
|
|
1295
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1296
|
+
ref,
|
|
1297
|
+
className: cn("relative flex items-center", isVertical ? "flex-col" : "flex-row"),
|
|
1298
|
+
children: [
|
|
1299
|
+
showLine && (linePosition === "before" || linePosition === "both") && /* @__PURE__ */ jsx("div", { className: cn("bg-border", isVertical ? "w-0.5 flex-1" : "h-0.5 flex-1") }),
|
|
1300
|
+
/* @__PURE__ */ jsx("div", {
|
|
1301
|
+
className: cn(timelineIndicatorVariants({
|
|
1302
|
+
size,
|
|
1303
|
+
variant,
|
|
1304
|
+
className
|
|
1305
|
+
})),
|
|
1306
|
+
...props,
|
|
1307
|
+
children
|
|
1308
|
+
}),
|
|
1309
|
+
showLine && (linePosition === "after" || linePosition === "both") && /* @__PURE__ */ jsx("div", { className: cn("bg-border", isVertical ? "w-0.5 flex-1" : "h-0.5 flex-1") })
|
|
1310
|
+
]
|
|
1311
|
+
});
|
|
1312
|
+
});
|
|
1313
|
+
TimelineIndicator.displayName = "TimelineIndicator";
|
|
1314
|
+
const TimelineConnector = React.forwardRef(({ className, orientation = "vertical",...props }, ref) => {
|
|
1315
|
+
const isVertical = orientation === "vertical";
|
|
1316
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1317
|
+
ref,
|
|
1318
|
+
className: cn("bg-border", isVertical ? "absolute left-[7px] top-4 bottom-0 w-0.5" : "absolute top-[7px] left-4 right-0 h-0.5", className),
|
|
1319
|
+
...props
|
|
1320
|
+
});
|
|
1321
|
+
});
|
|
1322
|
+
TimelineConnector.displayName = "TimelineConnector";
|
|
1323
|
+
const TimelineContent = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1324
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1325
|
+
ref,
|
|
1326
|
+
className: cn("flex-1 pt-0.5", className),
|
|
1327
|
+
...props,
|
|
1328
|
+
children
|
|
1329
|
+
});
|
|
1330
|
+
});
|
|
1331
|
+
TimelineContent.displayName = "TimelineContent";
|
|
1332
|
+
const TimelineTitle = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1333
|
+
return /* @__PURE__ */ jsx("h4", {
|
|
1334
|
+
ref,
|
|
1335
|
+
className: cn("text-sm font-medium text-foreground", className),
|
|
1336
|
+
...props,
|
|
1337
|
+
children
|
|
1338
|
+
});
|
|
1339
|
+
});
|
|
1340
|
+
TimelineTitle.displayName = "TimelineTitle";
|
|
1341
|
+
const TimelineDescription = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1342
|
+
return /* @__PURE__ */ jsx("p", {
|
|
1343
|
+
ref,
|
|
1344
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
1345
|
+
...props,
|
|
1346
|
+
children
|
|
1347
|
+
});
|
|
1348
|
+
});
|
|
1349
|
+
TimelineDescription.displayName = "TimelineDescription";
|
|
1350
|
+
const TimelineTime = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1351
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1352
|
+
ref,
|
|
1353
|
+
className: cn("text-xs text-muted-foreground", className),
|
|
1354
|
+
...props,
|
|
1355
|
+
children
|
|
1356
|
+
});
|
|
1357
|
+
});
|
|
1358
|
+
TimelineTime.displayName = "TimelineTime";
|
|
1359
|
+
|
|
1360
|
+
//#endregion
|
|
1361
|
+
//#region src/components/feedback/empty-state.tsx
|
|
1362
|
+
const emptyStateVariants = cva("flex flex-col items-center justify-center text-center", {
|
|
1363
|
+
variants: { size: {
|
|
1364
|
+
sm: "gap-2 p-4",
|
|
1365
|
+
md: "gap-3 p-6",
|
|
1366
|
+
lg: "gap-4 p-8"
|
|
1367
|
+
} },
|
|
1368
|
+
defaultVariants: { size: "md" }
|
|
1369
|
+
});
|
|
1370
|
+
const EmptyState = React.forwardRef(({ className, size, icon, title, description, action, secondaryAction, children,...props }, ref) => {
|
|
1371
|
+
const iconSize = size === "sm" ? "h-8 w-8" : size === "lg" ? "h-16 w-16" : "h-12 w-12";
|
|
1372
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1373
|
+
ref,
|
|
1374
|
+
className: cn(emptyStateVariants({
|
|
1375
|
+
size,
|
|
1376
|
+
className
|
|
1377
|
+
})),
|
|
1378
|
+
...props,
|
|
1379
|
+
children: [
|
|
1380
|
+
icon && /* @__PURE__ */ jsx("div", {
|
|
1381
|
+
className: cn("text-muted-foreground", iconSize),
|
|
1382
|
+
children: icon
|
|
1383
|
+
}),
|
|
1384
|
+
title && /* @__PURE__ */ jsx("h3", {
|
|
1385
|
+
className: cn("font-semibold text-foreground", size === "sm" && "text-sm", size === "lg" && "text-xl"),
|
|
1386
|
+
children: title
|
|
1387
|
+
}),
|
|
1388
|
+
description && /* @__PURE__ */ jsx("p", {
|
|
1389
|
+
className: cn("text-muted-foreground max-w-sm", size === "sm" && "text-xs", size === "lg" && "text-base", !size && "text-sm"),
|
|
1390
|
+
children: description
|
|
1391
|
+
}),
|
|
1392
|
+
children,
|
|
1393
|
+
(action || secondaryAction) && /* @__PURE__ */ jsxs("div", {
|
|
1394
|
+
className: "flex items-center gap-2 mt-2",
|
|
1395
|
+
children: [action && /* @__PURE__ */ jsx(Button, {
|
|
1396
|
+
size: size === "sm" ? "sm" : size === "lg" ? "default" : "sm",
|
|
1397
|
+
onClick: action.onClick,
|
|
1398
|
+
children: action.label
|
|
1399
|
+
}), secondaryAction && /* @__PURE__ */ jsx(Button, {
|
|
1400
|
+
variant: "outline",
|
|
1401
|
+
size: size === "sm" ? "sm" : size === "lg" ? "default" : "sm",
|
|
1402
|
+
onClick: secondaryAction.onClick,
|
|
1403
|
+
children: secondaryAction.label
|
|
1404
|
+
})]
|
|
1405
|
+
})
|
|
1406
|
+
]
|
|
1407
|
+
});
|
|
1408
|
+
});
|
|
1409
|
+
EmptyState.displayName = "EmptyState";
|
|
1410
|
+
const NoData = React.forwardRef(({ title = "No data",...props }, ref) => {
|
|
1411
|
+
return /* @__PURE__ */ jsx(EmptyState, {
|
|
1412
|
+
ref,
|
|
1413
|
+
icon: /* @__PURE__ */ jsx(Inbox, { className: "h-full w-full" }),
|
|
1414
|
+
title,
|
|
1415
|
+
...props
|
|
1416
|
+
});
|
|
1417
|
+
});
|
|
1418
|
+
NoData.displayName = "NoData";
|
|
1419
|
+
const NoResults = React.forwardRef(({ title = "No results found", searchTerm, description,...props }, ref) => {
|
|
1420
|
+
const desc = description ?? (searchTerm ? `No results found for "${searchTerm}". Try adjusting your search.` : "Try adjusting your search or filters.");
|
|
1421
|
+
return /* @__PURE__ */ jsx(EmptyState, {
|
|
1422
|
+
ref,
|
|
1423
|
+
icon: /* @__PURE__ */ jsx(Search, { className: "h-full w-full" }),
|
|
1424
|
+
title,
|
|
1425
|
+
description: desc,
|
|
1426
|
+
...props
|
|
1427
|
+
});
|
|
1428
|
+
});
|
|
1429
|
+
NoResults.displayName = "NoResults";
|
|
1430
|
+
const NotFound = React.forwardRef(({ title = "Page not found", description = "The page you're looking for doesn't exist or has been moved.",...props }, ref) => {
|
|
1431
|
+
return /* @__PURE__ */ jsx(EmptyState, {
|
|
1432
|
+
ref,
|
|
1433
|
+
icon: /* @__PURE__ */ jsx(FileQuestion, { className: "h-full w-full" }),
|
|
1434
|
+
title,
|
|
1435
|
+
description,
|
|
1436
|
+
...props
|
|
1437
|
+
});
|
|
1438
|
+
});
|
|
1439
|
+
NotFound.displayName = "NotFound";
|
|
1440
|
+
const ServerError = React.forwardRef(({ title = "Something went wrong", description = "An unexpected error occurred. Please try again later.",...props }, ref) => {
|
|
1441
|
+
return /* @__PURE__ */ jsx(EmptyState, {
|
|
1442
|
+
ref,
|
|
1443
|
+
icon: /* @__PURE__ */ jsx(ServerOff, { className: "h-full w-full" }),
|
|
1444
|
+
title,
|
|
1445
|
+
description,
|
|
1446
|
+
...props
|
|
1447
|
+
});
|
|
1448
|
+
});
|
|
1449
|
+
ServerError.displayName = "ServerError";
|
|
1450
|
+
|
|
1451
|
+
//#endregion
|
|
1452
|
+
//#region src/components/feedback/live-indicator.tsx
|
|
1453
|
+
const liveIndicatorVariants = cva("inline-flex items-center gap-2 rounded-full text-sm font-medium", {
|
|
1454
|
+
variants: {
|
|
1455
|
+
size: {
|
|
1456
|
+
sm: "h-6 px-2 text-xs",
|
|
1457
|
+
md: "h-7 px-2.5",
|
|
1458
|
+
lg: "h-8 px-3"
|
|
1459
|
+
},
|
|
1460
|
+
variant: {
|
|
1461
|
+
default: "bg-surface border border-border",
|
|
1462
|
+
solid: ""
|
|
1463
|
+
}
|
|
1464
|
+
},
|
|
1465
|
+
defaultVariants: {
|
|
1466
|
+
size: "md",
|
|
1467
|
+
variant: "default"
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
const LiveIndicator = React.forwardRef(({ className, size, variant, live = true, liveLabel = "Live", pausedLabel = "Paused", toggleable = false, onLiveToggle, liveColor = "#22c55e",...props }, ref) => {
|
|
1471
|
+
const handleToggle = () => {
|
|
1472
|
+
onLiveToggle?.(!live);
|
|
1473
|
+
};
|
|
1474
|
+
const dotColor = live ? liveColor : "#6b7280";
|
|
1475
|
+
const textColor = live ? liveColor : void 0;
|
|
1476
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1477
|
+
ref,
|
|
1478
|
+
className: cn(liveIndicatorVariants({
|
|
1479
|
+
size,
|
|
1480
|
+
variant,
|
|
1481
|
+
className
|
|
1482
|
+
}), variant === "solid" && live && "bg-green-500/10", variant === "solid" && !live && "bg-muted"),
|
|
1483
|
+
...props,
|
|
1484
|
+
children: [
|
|
1485
|
+
/* @__PURE__ */ jsx("span", {
|
|
1486
|
+
className: cn("rounded-full", live && "animate-pulse"),
|
|
1487
|
+
style: {
|
|
1488
|
+
backgroundColor: dotColor,
|
|
1489
|
+
width: size === "sm" ? 6 : size === "lg" ? 10 : 8,
|
|
1490
|
+
height: size === "sm" ? 6 : size === "lg" ? 10 : 8
|
|
1491
|
+
}
|
|
1492
|
+
}),
|
|
1493
|
+
/* @__PURE__ */ jsx("span", {
|
|
1494
|
+
style: { color: textColor },
|
|
1495
|
+
children: live ? liveLabel : pausedLabel
|
|
1496
|
+
}),
|
|
1497
|
+
toggleable && /* @__PURE__ */ jsx(Button, {
|
|
1498
|
+
variant: "ghost",
|
|
1499
|
+
size: "icon",
|
|
1500
|
+
className: cn("ml-1 rounded-full", size === "sm" && "h-4 w-4", size === "md" && "h-5 w-5", size === "lg" && "h-6 w-6"),
|
|
1501
|
+
onClick: handleToggle,
|
|
1502
|
+
children: live ? /* @__PURE__ */ jsx(Pause, { className: cn(size === "sm" && "h-2.5 w-2.5", size === "md" && "h-3 w-3", size === "lg" && "h-3.5 w-3.5") }) : /* @__PURE__ */ jsx(Play, { className: cn(size === "sm" && "h-2.5 w-2.5", size === "md" && "h-3 w-3", size === "lg" && "h-3.5 w-3.5") })
|
|
1503
|
+
})
|
|
1504
|
+
]
|
|
1505
|
+
});
|
|
1506
|
+
});
|
|
1507
|
+
LiveIndicator.displayName = "LiveIndicator";
|
|
1508
|
+
const connectionStatusConfig = {
|
|
1509
|
+
connected: {
|
|
1510
|
+
color: "#22c55e",
|
|
1511
|
+
label: "Connected",
|
|
1512
|
+
pulse: false
|
|
1513
|
+
},
|
|
1514
|
+
connecting: {
|
|
1515
|
+
color: "#f59e0b",
|
|
1516
|
+
label: "Connecting...",
|
|
1517
|
+
pulse: true
|
|
1518
|
+
},
|
|
1519
|
+
disconnected: {
|
|
1520
|
+
color: "#6b7280",
|
|
1521
|
+
label: "Disconnected",
|
|
1522
|
+
pulse: false
|
|
1523
|
+
},
|
|
1524
|
+
error: {
|
|
1525
|
+
color: "#ef4444",
|
|
1526
|
+
label: "Error",
|
|
1527
|
+
pulse: true
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1530
|
+
const ConnectionStatus = React.forwardRef(({ className, status, showLabel = true, size = "md",...props }, ref) => {
|
|
1531
|
+
const config = connectionStatusConfig[status];
|
|
1532
|
+
const dotSize = size === "sm" ? 6 : size === "lg" ? 10 : 8;
|
|
1533
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1534
|
+
ref,
|
|
1535
|
+
className: cn("inline-flex items-center gap-2", className),
|
|
1536
|
+
...props,
|
|
1537
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1538
|
+
className: cn("rounded-full", config.pulse && "animate-pulse"),
|
|
1539
|
+
style: {
|
|
1540
|
+
backgroundColor: config.color,
|
|
1541
|
+
width: dotSize,
|
|
1542
|
+
height: dotSize
|
|
1543
|
+
}
|
|
1544
|
+
}), showLabel && /* @__PURE__ */ jsx("span", {
|
|
1545
|
+
className: cn("text-sm", size === "sm" && "text-xs", size === "lg" && "text-base"),
|
|
1546
|
+
style: { color: config.color },
|
|
1547
|
+
children: config.label
|
|
1548
|
+
})]
|
|
1549
|
+
});
|
|
1550
|
+
});
|
|
1551
|
+
ConnectionStatus.displayName = "ConnectionStatus";
|
|
1552
|
+
|
|
1553
|
+
//#endregion
|
|
1554
|
+
//#region src/components/feedback/loading.tsx
|
|
1555
|
+
const spinnerVariants = cva("animate-spin text-muted-foreground", {
|
|
1556
|
+
variants: { size: {
|
|
1557
|
+
xs: "h-3 w-3",
|
|
1558
|
+
sm: "h-4 w-4",
|
|
1559
|
+
md: "h-6 w-6",
|
|
1560
|
+
lg: "h-8 w-8",
|
|
1561
|
+
xl: "h-12 w-12"
|
|
1562
|
+
} },
|
|
1563
|
+
defaultVariants: { size: "md" }
|
|
1564
|
+
});
|
|
1565
|
+
const Spinner = React.forwardRef(({ className, size,...props }, ref) => {
|
|
1566
|
+
return /* @__PURE__ */ jsx(Loader2, {
|
|
1567
|
+
ref,
|
|
1568
|
+
className: cn(spinnerVariants({
|
|
1569
|
+
size,
|
|
1570
|
+
className
|
|
1571
|
+
})),
|
|
1572
|
+
...props
|
|
1573
|
+
});
|
|
1574
|
+
});
|
|
1575
|
+
Spinner.displayName = "Spinner";
|
|
1576
|
+
const loadingOverlayVariants = cva("absolute inset-0 flex items-center justify-center bg-background/80 backdrop-blur-sm", {
|
|
1577
|
+
variants: { variant: {
|
|
1578
|
+
default: "bg-background/80",
|
|
1579
|
+
dark: "bg-background/90",
|
|
1580
|
+
light: "bg-background/50"
|
|
1581
|
+
} },
|
|
1582
|
+
defaultVariants: { variant: "default" }
|
|
1583
|
+
});
|
|
1584
|
+
const LoadingOverlay = React.forwardRef(({ className, variant, loading = true, text, spinnerSize = "lg", children,...props }, ref) => {
|
|
1585
|
+
if (!loading) return null;
|
|
1586
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1587
|
+
ref,
|
|
1588
|
+
className: cn(loadingOverlayVariants({
|
|
1589
|
+
variant,
|
|
1590
|
+
className
|
|
1591
|
+
})),
|
|
1592
|
+
...props,
|
|
1593
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1594
|
+
className: "flex flex-col items-center gap-3",
|
|
1595
|
+
children: [
|
|
1596
|
+
/* @__PURE__ */ jsx(Spinner, { size: spinnerSize }),
|
|
1597
|
+
text && /* @__PURE__ */ jsx("span", {
|
|
1598
|
+
className: "text-sm text-muted-foreground",
|
|
1599
|
+
children: text
|
|
1600
|
+
}),
|
|
1601
|
+
children
|
|
1602
|
+
]
|
|
1603
|
+
})
|
|
1604
|
+
});
|
|
1605
|
+
});
|
|
1606
|
+
LoadingOverlay.displayName = "LoadingOverlay";
|
|
1607
|
+
const LoadingContainer = React.forwardRef(({ className, loading = false, loadingText, spinnerSize, overlayVariant, children,...props }, ref) => {
|
|
1608
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1609
|
+
ref,
|
|
1610
|
+
className: cn("relative", className),
|
|
1611
|
+
...props,
|
|
1612
|
+
children: [children, /* @__PURE__ */ jsx(LoadingOverlay, {
|
|
1613
|
+
loading,
|
|
1614
|
+
text: loadingText,
|
|
1615
|
+
spinnerSize,
|
|
1616
|
+
variant: overlayVariant
|
|
1617
|
+
})]
|
|
1618
|
+
});
|
|
1619
|
+
});
|
|
1620
|
+
LoadingContainer.displayName = "LoadingContainer";
|
|
1621
|
+
const LoadingDots = React.forwardRef(({ className, size = "md",...props }, ref) => {
|
|
1622
|
+
const dotSize = size === "sm" ? "h-1 w-1" : size === "lg" ? "h-2.5 w-2.5" : "h-1.5 w-1.5";
|
|
1623
|
+
const gap = size === "sm" ? "gap-1" : size === "lg" ? "gap-2" : "gap-1.5";
|
|
1624
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1625
|
+
ref,
|
|
1626
|
+
className: cn("flex items-center", gap, className),
|
|
1627
|
+
...props,
|
|
1628
|
+
children: [
|
|
1629
|
+
/* @__PURE__ */ jsx("span", {
|
|
1630
|
+
className: cn(dotSize, "rounded-full bg-muted-foreground animate-bounce"),
|
|
1631
|
+
style: { animationDelay: "0ms" }
|
|
1632
|
+
}),
|
|
1633
|
+
/* @__PURE__ */ jsx("span", {
|
|
1634
|
+
className: cn(dotSize, "rounded-full bg-muted-foreground animate-bounce"),
|
|
1635
|
+
style: { animationDelay: "150ms" }
|
|
1636
|
+
}),
|
|
1637
|
+
/* @__PURE__ */ jsx("span", {
|
|
1638
|
+
className: cn(dotSize, "rounded-full bg-muted-foreground animate-bounce"),
|
|
1639
|
+
style: { animationDelay: "300ms" }
|
|
1640
|
+
})
|
|
1641
|
+
]
|
|
1642
|
+
});
|
|
1643
|
+
});
|
|
1644
|
+
LoadingDots.displayName = "LoadingDots";
|
|
1645
|
+
const Skeleton = React.forwardRef(({ className, width, height, rounded = "md", style,...props }, ref) => {
|
|
1646
|
+
const roundedClass = rounded === true ? "rounded-md" : rounded === false ? "" : rounded === "sm" ? "rounded-sm" : rounded === "lg" ? "rounded-lg" : rounded === "full" ? "rounded-full" : "rounded-md";
|
|
1647
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1648
|
+
ref,
|
|
1649
|
+
className: cn("animate-pulse bg-muted", roundedClass, className),
|
|
1650
|
+
style: {
|
|
1651
|
+
width,
|
|
1652
|
+
height,
|
|
1653
|
+
...style
|
|
1654
|
+
},
|
|
1655
|
+
...props
|
|
1656
|
+
});
|
|
1657
|
+
});
|
|
1658
|
+
Skeleton.displayName = "Skeleton";
|
|
1659
|
+
|
|
1660
|
+
//#endregion
|
|
1661
|
+
//#region src/components/feedback/status-badge.tsx
|
|
1662
|
+
const statusBadgeVariants = cva("inline-flex items-center justify-center rounded-full text-xs font-medium", {
|
|
1663
|
+
variants: { size: {
|
|
1664
|
+
sm: "h-5 min-w-5 px-1.5",
|
|
1665
|
+
md: "h-6 min-w-6 px-2",
|
|
1666
|
+
lg: "h-7 min-w-7 px-2.5"
|
|
1667
|
+
} },
|
|
1668
|
+
defaultVariants: { size: "md" }
|
|
1669
|
+
});
|
|
1670
|
+
const StatusBadge = React.forwardRef(({ className, size, status, method, logLevel, color: customColor, pulse, children, style,...props }, ref) => {
|
|
1671
|
+
let color = customColor;
|
|
1672
|
+
let content = children;
|
|
1673
|
+
if (status !== void 0) {
|
|
1674
|
+
color = color ?? getStatusColor(status);
|
|
1675
|
+
content = content ?? String(status);
|
|
1676
|
+
} else if (method) {
|
|
1677
|
+
color = color ?? getMethodColor(method);
|
|
1678
|
+
content = content ?? method.toUpperCase();
|
|
1679
|
+
} else if (logLevel) {
|
|
1680
|
+
color = color ?? getLogLevelColor(logLevel);
|
|
1681
|
+
content = content ?? logLevel.toUpperCase();
|
|
1682
|
+
}
|
|
1683
|
+
const backgroundColor = color ? `${color}20` : void 0;
|
|
1684
|
+
const textColor = color;
|
|
1685
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
1686
|
+
ref,
|
|
1687
|
+
className: cn(statusBadgeVariants({
|
|
1688
|
+
size,
|
|
1689
|
+
className
|
|
1690
|
+
})),
|
|
1691
|
+
style: {
|
|
1692
|
+
backgroundColor,
|
|
1693
|
+
color: textColor,
|
|
1694
|
+
...style
|
|
1695
|
+
},
|
|
1696
|
+
...props,
|
|
1697
|
+
children: [pulse && /* @__PURE__ */ jsx("span", {
|
|
1698
|
+
className: "mr-1.5 h-1.5 w-1.5 rounded-full animate-pulse",
|
|
1699
|
+
style: { backgroundColor: color }
|
|
1700
|
+
}), content]
|
|
1701
|
+
});
|
|
1702
|
+
});
|
|
1703
|
+
StatusBadge.displayName = "StatusBadge";
|
|
1704
|
+
const HttpStatusBadge = React.forwardRef(({ code,...props }, ref) => {
|
|
1705
|
+
return /* @__PURE__ */ jsx(StatusBadge, {
|
|
1706
|
+
ref,
|
|
1707
|
+
status: code,
|
|
1708
|
+
...props
|
|
1709
|
+
});
|
|
1710
|
+
});
|
|
1711
|
+
HttpStatusBadge.displayName = "HttpStatusBadge";
|
|
1712
|
+
const HttpMethodBadge = React.forwardRef(({ method,...props }, ref) => {
|
|
1713
|
+
return /* @__PURE__ */ jsx(StatusBadge, {
|
|
1714
|
+
ref,
|
|
1715
|
+
method,
|
|
1716
|
+
...props
|
|
1717
|
+
});
|
|
1718
|
+
});
|
|
1719
|
+
HttpMethodBadge.displayName = "HttpMethodBadge";
|
|
1720
|
+
const LogLevelBadge = React.forwardRef(({ level,...props }, ref) => {
|
|
1721
|
+
return /* @__PURE__ */ jsx(StatusBadge, {
|
|
1722
|
+
ref,
|
|
1723
|
+
logLevel: level,
|
|
1724
|
+
...props
|
|
1725
|
+
});
|
|
1726
|
+
});
|
|
1727
|
+
LogLevelBadge.displayName = "LogLevelBadge";
|
|
1728
|
+
|
|
1729
|
+
//#endregion
|
|
1730
|
+
//#region src/components/layout/header.tsx
|
|
1731
|
+
const Header = React.forwardRef(({ className, sticky = false, children,...props }, ref) => {
|
|
1732
|
+
return /* @__PURE__ */ jsx("header", {
|
|
1733
|
+
ref,
|
|
1734
|
+
className: cn("flex h-14 items-center gap-4 border-b border-border bg-surface px-4", sticky && "sticky top-0 z-10", className),
|
|
1735
|
+
...props,
|
|
1736
|
+
children
|
|
1737
|
+
});
|
|
1738
|
+
});
|
|
1739
|
+
Header.displayName = "Header";
|
|
1740
|
+
const HeaderTitle = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1741
|
+
return /* @__PURE__ */ jsx("h1", {
|
|
1742
|
+
ref,
|
|
1743
|
+
className: cn("text-lg font-semibold text-foreground", className),
|
|
1744
|
+
...props,
|
|
1745
|
+
children
|
|
1746
|
+
});
|
|
1747
|
+
});
|
|
1748
|
+
HeaderTitle.displayName = "HeaderTitle";
|
|
1749
|
+
const HeaderDescription = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1750
|
+
return /* @__PURE__ */ jsx("p", {
|
|
1751
|
+
ref,
|
|
1752
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
1753
|
+
...props,
|
|
1754
|
+
children
|
|
1755
|
+
});
|
|
1756
|
+
});
|
|
1757
|
+
HeaderDescription.displayName = "HeaderDescription";
|
|
1758
|
+
const HeaderActions = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1759
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1760
|
+
ref,
|
|
1761
|
+
className: cn("ml-auto flex items-center gap-2", className),
|
|
1762
|
+
...props,
|
|
1763
|
+
children
|
|
1764
|
+
});
|
|
1765
|
+
});
|
|
1766
|
+
HeaderActions.displayName = "HeaderActions";
|
|
1767
|
+
const HeaderBreadcrumbs = React.forwardRef(({ className, items, separator,...props }, ref) => {
|
|
1768
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
1769
|
+
ref,
|
|
1770
|
+
"aria-label": "Breadcrumb",
|
|
1771
|
+
className: cn("flex items-center gap-1 text-sm", className),
|
|
1772
|
+
...props,
|
|
1773
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
1774
|
+
className: "flex items-center gap-1",
|
|
1775
|
+
children: items.map((item, index) => /* @__PURE__ */ jsxs("li", {
|
|
1776
|
+
className: "flex items-center gap-1",
|
|
1777
|
+
children: [index > 0 && /* @__PURE__ */ jsx("span", {
|
|
1778
|
+
className: "text-muted-foreground",
|
|
1779
|
+
children: separator ?? /* @__PURE__ */ jsx(ChevronRight, { className: "h-3.5 w-3.5" })
|
|
1780
|
+
}), item.href && !item.current ? /* @__PURE__ */ jsx("a", {
|
|
1781
|
+
href: item.href,
|
|
1782
|
+
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
1783
|
+
children: item.label
|
|
1784
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
1785
|
+
className: cn(item.current ? "text-foreground font-medium" : "text-muted-foreground"),
|
|
1786
|
+
"aria-current": item.current ? "page" : void 0,
|
|
1787
|
+
children: item.label
|
|
1788
|
+
})]
|
|
1789
|
+
}, item.label))
|
|
1790
|
+
})
|
|
1791
|
+
});
|
|
1792
|
+
});
|
|
1793
|
+
HeaderBreadcrumbs.displayName = "HeaderBreadcrumbs";
|
|
1794
|
+
const HeaderGroup = React.forwardRef(({ className, align = "start", children,...props }, ref) => {
|
|
1795
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1796
|
+
ref,
|
|
1797
|
+
className: cn("flex items-center gap-3", align === "center" && "justify-center", align === "end" && "justify-end ml-auto", className),
|
|
1798
|
+
...props,
|
|
1799
|
+
children
|
|
1800
|
+
});
|
|
1801
|
+
});
|
|
1802
|
+
HeaderGroup.displayName = "HeaderGroup";
|
|
1803
|
+
|
|
1804
|
+
//#endregion
|
|
1805
|
+
//#region src/components/layout/shell.tsx
|
|
1806
|
+
const Shell = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1807
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1808
|
+
ref,
|
|
1809
|
+
className: cn("flex h-screen w-full bg-background", className),
|
|
1810
|
+
...props,
|
|
1811
|
+
children
|
|
1812
|
+
});
|
|
1813
|
+
});
|
|
1814
|
+
Shell.displayName = "Shell";
|
|
1815
|
+
const ShellSidebar = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1816
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1817
|
+
ref,
|
|
1818
|
+
className: cn("shrink-0", className),
|
|
1819
|
+
...props,
|
|
1820
|
+
children
|
|
1821
|
+
});
|
|
1822
|
+
});
|
|
1823
|
+
ShellSidebar.displayName = "ShellSidebar";
|
|
1824
|
+
const ShellMain = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1825
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1826
|
+
ref,
|
|
1827
|
+
className: cn("flex flex-1 flex-col overflow-hidden", className),
|
|
1828
|
+
...props,
|
|
1829
|
+
children
|
|
1830
|
+
});
|
|
1831
|
+
});
|
|
1832
|
+
ShellMain.displayName = "ShellMain";
|
|
1833
|
+
const ShellHeader = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1834
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1835
|
+
ref,
|
|
1836
|
+
className: cn("shrink-0", className),
|
|
1837
|
+
...props,
|
|
1838
|
+
children
|
|
1839
|
+
});
|
|
1840
|
+
});
|
|
1841
|
+
ShellHeader.displayName = "ShellHeader";
|
|
1842
|
+
const ShellContent = React.forwardRef(({ className, scrollable = true, children,...props }, ref) => {
|
|
1843
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1844
|
+
ref,
|
|
1845
|
+
className: cn("flex-1", scrollable && "overflow-auto", className),
|
|
1846
|
+
...props,
|
|
1847
|
+
children
|
|
1848
|
+
});
|
|
1849
|
+
});
|
|
1850
|
+
ShellContent.displayName = "ShellContent";
|
|
1851
|
+
const ShellFooter = React.forwardRef(({ className, children,...props }, ref) => {
|
|
1852
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1853
|
+
ref,
|
|
1854
|
+
className: cn("shrink-0 border-t border-border bg-surface", className),
|
|
1855
|
+
...props,
|
|
1856
|
+
children
|
|
1857
|
+
});
|
|
1858
|
+
});
|
|
1859
|
+
ShellFooter.displayName = "ShellFooter";
|
|
1860
|
+
|
|
1861
|
+
//#endregion
|
|
1862
|
+
//#region src/components/ui/scroll-area.tsx
|
|
1863
|
+
const ScrollArea = React.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsxs(ScrollAreaPrimitive.Root, {
|
|
1864
|
+
ref,
|
|
1865
|
+
className: cn("relative overflow-hidden", className),
|
|
1866
|
+
...props,
|
|
1867
|
+
children: [
|
|
1868
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, {
|
|
1869
|
+
className: "h-full w-full rounded-[inherit]",
|
|
1870
|
+
children
|
|
1871
|
+
}),
|
|
1872
|
+
/* @__PURE__ */ jsx(ScrollBar, {}),
|
|
1873
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
|
|
1874
|
+
]
|
|
1875
|
+
}));
|
|
1876
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
1877
|
+
const ScrollBar = React.forwardRef(({ className, orientation = "vertical",...props }, ref) => /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, {
|
|
1878
|
+
ref,
|
|
1879
|
+
orientation,
|
|
1880
|
+
className: cn("flex touch-none select-none transition-colors", orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]", orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]", className),
|
|
1881
|
+
...props,
|
|
1882
|
+
children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
1883
|
+
}));
|
|
1884
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
1885
|
+
|
|
1886
|
+
//#endregion
|
|
1887
|
+
//#region src/components/ui/tooltip.tsx
|
|
1888
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
1889
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
1890
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1891
|
+
const TooltipContent = React.forwardRef(({ className, sideOffset = 4,...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Content, {
|
|
1892
|
+
ref,
|
|
1893
|
+
sideOffset,
|
|
1894
|
+
className: cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
1895
|
+
...props
|
|
1896
|
+
}) }));
|
|
1897
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
1898
|
+
|
|
1899
|
+
//#endregion
|
|
1900
|
+
//#region src/components/layout/sidebar.tsx
|
|
1901
|
+
const sidebarVariants = cva("flex flex-col border-r border-border bg-surface transition-all duration-200", {
|
|
1902
|
+
variants: { collapsed: {
|
|
1903
|
+
true: "w-16",
|
|
1904
|
+
false: "w-64"
|
|
1905
|
+
} },
|
|
1906
|
+
defaultVariants: { collapsed: false }
|
|
1907
|
+
});
|
|
1908
|
+
const SidebarContext = React.createContext({
|
|
1909
|
+
collapsed: false,
|
|
1910
|
+
setCollapsed: () => {}
|
|
1911
|
+
});
|
|
1912
|
+
function useSidebar() {
|
|
1913
|
+
const context = React.useContext(SidebarContext);
|
|
1914
|
+
if (!context) throw new Error("useSidebar must be used within a Sidebar");
|
|
1915
|
+
return context;
|
|
1916
|
+
}
|
|
1917
|
+
const Sidebar = React.forwardRef(({ className, collapsed: controlledCollapsed, onCollapsedChange, header, footer, children,...props }, ref) => {
|
|
1918
|
+
const [internalCollapsed, setInternalCollapsed] = React.useState(false);
|
|
1919
|
+
const collapsed = controlledCollapsed ?? internalCollapsed;
|
|
1920
|
+
const setCollapsed = React.useCallback((value) => {
|
|
1921
|
+
setInternalCollapsed(value);
|
|
1922
|
+
onCollapsedChange?.(value);
|
|
1923
|
+
}, [onCollapsedChange]);
|
|
1924
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, {
|
|
1925
|
+
value: {
|
|
1926
|
+
collapsed,
|
|
1927
|
+
setCollapsed
|
|
1928
|
+
},
|
|
1929
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
1930
|
+
delayDuration: 0,
|
|
1931
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1932
|
+
ref,
|
|
1933
|
+
className: cn(sidebarVariants({
|
|
1934
|
+
collapsed,
|
|
1935
|
+
className
|
|
1936
|
+
})),
|
|
1937
|
+
...props,
|
|
1938
|
+
children: [
|
|
1939
|
+
header && /* @__PURE__ */ jsx("div", {
|
|
1940
|
+
className: "flex h-14 items-center border-b border-border px-4",
|
|
1941
|
+
children: header
|
|
1942
|
+
}),
|
|
1943
|
+
/* @__PURE__ */ jsx(ScrollArea, {
|
|
1944
|
+
className: "flex-1",
|
|
1945
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1946
|
+
className: "flex flex-col gap-1 p-2",
|
|
1947
|
+
children
|
|
1948
|
+
})
|
|
1949
|
+
}),
|
|
1950
|
+
footer && /* @__PURE__ */ jsx("div", {
|
|
1951
|
+
className: "border-t border-border p-2",
|
|
1952
|
+
children: footer
|
|
1953
|
+
})
|
|
1954
|
+
]
|
|
1955
|
+
})
|
|
1956
|
+
})
|
|
1957
|
+
});
|
|
1958
|
+
});
|
|
1959
|
+
Sidebar.displayName = "Sidebar";
|
|
1960
|
+
const SidebarToggle = React.forwardRef(({ className,...props }, ref) => {
|
|
1961
|
+
const { collapsed, setCollapsed } = useSidebar();
|
|
1962
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
1963
|
+
ref,
|
|
1964
|
+
variant: "ghost",
|
|
1965
|
+
size: "icon",
|
|
1966
|
+
className: cn("h-8 w-8", className),
|
|
1967
|
+
onClick: () => setCollapsed(!collapsed),
|
|
1968
|
+
...props,
|
|
1969
|
+
children: [collapsed ? /* @__PURE__ */ jsx(PanelLeftOpen, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(PanelLeftClose, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", {
|
|
1970
|
+
className: "sr-only",
|
|
1971
|
+
children: collapsed ? "Expand sidebar" : "Collapse sidebar"
|
|
1972
|
+
})]
|
|
1973
|
+
});
|
|
1974
|
+
});
|
|
1975
|
+
SidebarToggle.displayName = "SidebarToggle";
|
|
1976
|
+
const SidebarSection = React.forwardRef(({ className, title, children,...props }, ref) => {
|
|
1977
|
+
const { collapsed } = useSidebar();
|
|
1978
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1979
|
+
ref,
|
|
1980
|
+
className: cn("flex flex-col gap-1", className),
|
|
1981
|
+
...props,
|
|
1982
|
+
children: [
|
|
1983
|
+
title && !collapsed && /* @__PURE__ */ jsx("div", {
|
|
1984
|
+
className: "px-2 py-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",
|
|
1985
|
+
children: title
|
|
1986
|
+
}),
|
|
1987
|
+
title && collapsed && /* @__PURE__ */ jsx("div", { className: "mx-auto my-1 h-px w-6 bg-border" }),
|
|
1988
|
+
children
|
|
1989
|
+
]
|
|
1990
|
+
});
|
|
1991
|
+
});
|
|
1992
|
+
SidebarSection.displayName = "SidebarSection";
|
|
1993
|
+
const SidebarItem = React.forwardRef(({ className, icon: Icon, active, badge, children,...props }, ref) => {
|
|
1994
|
+
const { collapsed } = useSidebar();
|
|
1995
|
+
const button = /* @__PURE__ */ jsxs("button", {
|
|
1996
|
+
ref,
|
|
1997
|
+
className: cn("flex w-full items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors", "text-muted-foreground hover:bg-surface-hover hover:text-foreground", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", active && "bg-surface-hover text-foreground", collapsed && "justify-center px-0", className),
|
|
1998
|
+
...props,
|
|
1999
|
+
children: [
|
|
2000
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4 shrink-0" }),
|
|
2001
|
+
!collapsed && /* @__PURE__ */ jsx("span", {
|
|
2002
|
+
className: "flex-1 truncate",
|
|
2003
|
+
children
|
|
2004
|
+
}),
|
|
2005
|
+
!collapsed && badge && /* @__PURE__ */ jsx("span", { children: badge })
|
|
2006
|
+
]
|
|
2007
|
+
});
|
|
2008
|
+
if (collapsed) return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
2009
|
+
asChild: true,
|
|
2010
|
+
children: button
|
|
2011
|
+
}), /* @__PURE__ */ jsxs(TooltipContent, {
|
|
2012
|
+
side: "right",
|
|
2013
|
+
className: "flex items-center gap-2",
|
|
2014
|
+
children: [children, badge]
|
|
2015
|
+
})] });
|
|
2016
|
+
return button;
|
|
2017
|
+
});
|
|
2018
|
+
SidebarItem.displayName = "SidebarItem";
|
|
2019
|
+
const SidebarLink = React.forwardRef(({ className, icon: Icon, active, badge, children,...props }, ref) => {
|
|
2020
|
+
const { collapsed } = useSidebar();
|
|
2021
|
+
const link = /* @__PURE__ */ jsxs("a", {
|
|
2022
|
+
ref,
|
|
2023
|
+
className: cn("flex w-full items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors", "text-muted-foreground hover:bg-surface-hover hover:text-foreground", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", active && "bg-surface-hover text-foreground", collapsed && "justify-center px-0", className),
|
|
2024
|
+
...props,
|
|
2025
|
+
children: [
|
|
2026
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4 shrink-0" }),
|
|
2027
|
+
!collapsed && /* @__PURE__ */ jsx("span", {
|
|
2028
|
+
className: "flex-1 truncate",
|
|
2029
|
+
children
|
|
2030
|
+
}),
|
|
2031
|
+
!collapsed && badge && /* @__PURE__ */ jsx("span", { children: badge })
|
|
2032
|
+
]
|
|
2033
|
+
});
|
|
2034
|
+
if (collapsed) return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
2035
|
+
asChild: true,
|
|
2036
|
+
children: link
|
|
2037
|
+
}), /* @__PURE__ */ jsxs(TooltipContent, {
|
|
2038
|
+
side: "right",
|
|
2039
|
+
className: "flex items-center gap-2",
|
|
2040
|
+
children: [children, badge]
|
|
2041
|
+
})] });
|
|
2042
|
+
return link;
|
|
2043
|
+
});
|
|
2044
|
+
SidebarLink.displayName = "SidebarLink";
|
|
2045
|
+
|
|
2046
|
+
//#endregion
|
|
2047
|
+
//#region src/components/layout/split-pane.tsx
|
|
2048
|
+
const SplitPane = React.forwardRef(({ className, direction = "horizontal", defaultSize = "50%", minSize = 100, maxSize, onSizeChange, resizable = true, children,...props }, ref) => {
|
|
2049
|
+
const containerRef = React.useRef(null);
|
|
2050
|
+
const [size, setSize] = React.useState(null);
|
|
2051
|
+
const [isDragging, setIsDragging] = React.useState(false);
|
|
2052
|
+
const childArray = React.Children.toArray(children);
|
|
2053
|
+
const firstPane = childArray[0];
|
|
2054
|
+
const secondPane = childArray[1];
|
|
2055
|
+
const isHorizontal = direction === "horizontal";
|
|
2056
|
+
React.useEffect(() => {
|
|
2057
|
+
if (size !== null || !containerRef.current) return;
|
|
2058
|
+
const containerSize = isHorizontal ? containerRef.current.offsetWidth : containerRef.current.offsetHeight;
|
|
2059
|
+
if (typeof defaultSize === "string" && defaultSize.endsWith("%")) {
|
|
2060
|
+
const percent = parseFloat(defaultSize) / 100;
|
|
2061
|
+
setSize(Math.round(containerSize * percent));
|
|
2062
|
+
} else if (typeof defaultSize === "number") setSize(defaultSize);
|
|
2063
|
+
else setSize(Math.round(containerSize / 2));
|
|
2064
|
+
}, [
|
|
2065
|
+
defaultSize,
|
|
2066
|
+
isHorizontal,
|
|
2067
|
+
size
|
|
2068
|
+
]);
|
|
2069
|
+
const handleMouseDown = React.useCallback((e) => {
|
|
2070
|
+
if (!resizable) return;
|
|
2071
|
+
e.preventDefault();
|
|
2072
|
+
setIsDragging(true);
|
|
2073
|
+
}, [resizable]);
|
|
2074
|
+
React.useEffect(() => {
|
|
2075
|
+
if (!isDragging) return;
|
|
2076
|
+
const handleMouseMove = (e) => {
|
|
2077
|
+
if (!containerRef.current) return;
|
|
2078
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
2079
|
+
const containerSize = isHorizontal ? containerRect.width : containerRect.height;
|
|
2080
|
+
let newSize = isHorizontal ? e.clientX - containerRect.left : e.clientY - containerRect.top;
|
|
2081
|
+
newSize = Math.max(minSize, newSize);
|
|
2082
|
+
if (maxSize) newSize = Math.min(maxSize, newSize);
|
|
2083
|
+
newSize = Math.min(containerSize - minSize, newSize);
|
|
2084
|
+
setSize(newSize);
|
|
2085
|
+
onSizeChange?.(newSize);
|
|
2086
|
+
};
|
|
2087
|
+
const handleMouseUp = () => {
|
|
2088
|
+
setIsDragging(false);
|
|
2089
|
+
};
|
|
2090
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
2091
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
2092
|
+
return () => {
|
|
2093
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
2094
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
2095
|
+
};
|
|
2096
|
+
}, [
|
|
2097
|
+
isDragging,
|
|
2098
|
+
isHorizontal,
|
|
2099
|
+
minSize,
|
|
2100
|
+
maxSize,
|
|
2101
|
+
onSizeChange
|
|
2102
|
+
]);
|
|
2103
|
+
const firstPaneStyle = {
|
|
2104
|
+
[isHorizontal ? "width" : "height"]: size !== null ? `${size}px` : defaultSize,
|
|
2105
|
+
flexShrink: 0
|
|
2106
|
+
};
|
|
2107
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2108
|
+
ref: (node) => {
|
|
2109
|
+
containerRef.current = node;
|
|
2110
|
+
if (typeof ref === "function") ref(node);
|
|
2111
|
+
else if (ref) ref.current = node;
|
|
2112
|
+
},
|
|
2113
|
+
className: cn("flex overflow-hidden", isHorizontal ? "flex-row" : "flex-col", isDragging && "cursor-col-resize select-none", className),
|
|
2114
|
+
...props,
|
|
2115
|
+
children: [
|
|
2116
|
+
/* @__PURE__ */ jsx("div", {
|
|
2117
|
+
className: cn("overflow-auto", isHorizontal ? "min-w-0" : "min-h-0"),
|
|
2118
|
+
style: firstPaneStyle,
|
|
2119
|
+
children: firstPane
|
|
2120
|
+
}),
|
|
2121
|
+
resizable && /* @__PURE__ */ jsx("div", {
|
|
2122
|
+
className: cn("flex shrink-0 items-center justify-center bg-border transition-colors", isHorizontal ? "w-1 cursor-col-resize hover:bg-border-hover active:bg-accent" : "h-1 cursor-row-resize hover:bg-border-hover active:bg-accent", isDragging && "bg-accent"),
|
|
2123
|
+
onMouseDown: handleMouseDown,
|
|
2124
|
+
children: /* @__PURE__ */ jsx("div", { className: cn("rounded-full bg-muted-foreground/50", isHorizontal ? "h-8 w-1" : "h-1 w-8") })
|
|
2125
|
+
}),
|
|
2126
|
+
/* @__PURE__ */ jsx("div", {
|
|
2127
|
+
className: cn("flex-1 overflow-auto", isHorizontal ? "min-w-0" : "min-h-0"),
|
|
2128
|
+
children: secondPane
|
|
2129
|
+
})
|
|
2130
|
+
]
|
|
2131
|
+
});
|
|
2132
|
+
});
|
|
2133
|
+
SplitPane.displayName = "SplitPane";
|
|
2134
|
+
const SplitPanePanel = React.forwardRef(({ className, children,...props }, ref) => {
|
|
2135
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2136
|
+
ref,
|
|
2137
|
+
className: cn("h-full w-full", className),
|
|
2138
|
+
...props,
|
|
2139
|
+
children
|
|
2140
|
+
});
|
|
2141
|
+
});
|
|
2142
|
+
SplitPanePanel.displayName = "SplitPanePanel";
|
|
2143
|
+
|
|
2144
|
+
//#endregion
|
|
2145
|
+
//#region src/components/ui/badge.tsx
|
|
2146
|
+
const badgeVariants = cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", {
|
|
2147
|
+
variants: { variant: {
|
|
2148
|
+
default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
|
|
2149
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
2150
|
+
destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
|
|
2151
|
+
outline: "text-foreground",
|
|
2152
|
+
success: "border-transparent bg-emerald-500/15 text-emerald-400",
|
|
2153
|
+
warning: "border-transparent bg-amber-500/15 text-amber-400",
|
|
2154
|
+
info: "border-transparent bg-blue-500/15 text-blue-400",
|
|
2155
|
+
get: "border-transparent bg-blue-500/15 text-blue-400 font-mono",
|
|
2156
|
+
post: "border-transparent bg-emerald-500/15 text-emerald-400 font-mono",
|
|
2157
|
+
put: "border-transparent bg-amber-500/15 text-amber-400 font-mono",
|
|
2158
|
+
patch: "border-transparent bg-violet-500/15 text-violet-400 font-mono",
|
|
2159
|
+
delete: "border-transparent bg-red-500/15 text-red-400 font-mono"
|
|
2160
|
+
} },
|
|
2161
|
+
defaultVariants: { variant: "default" }
|
|
2162
|
+
});
|
|
2163
|
+
function Badge({ className, variant,...props }) {
|
|
2164
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2165
|
+
className: cn(badgeVariants({ variant }), className),
|
|
2166
|
+
...props
|
|
2167
|
+
});
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
//#endregion
|
|
2171
|
+
//#region src/components/ui/card.tsx
|
|
2172
|
+
const Card = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
2173
|
+
ref,
|
|
2174
|
+
className: cn("rounded-xl border bg-card text-card-foreground shadow", className),
|
|
2175
|
+
...props
|
|
2176
|
+
}));
|
|
2177
|
+
Card.displayName = "Card";
|
|
2178
|
+
const CardHeader = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
2179
|
+
ref,
|
|
2180
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
2181
|
+
...props
|
|
2182
|
+
}));
|
|
2183
|
+
CardHeader.displayName = "CardHeader";
|
|
2184
|
+
const CardTitle = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
2185
|
+
ref,
|
|
2186
|
+
className: cn("font-semibold leading-none tracking-tight", className),
|
|
2187
|
+
...props
|
|
2188
|
+
}));
|
|
2189
|
+
CardTitle.displayName = "CardTitle";
|
|
2190
|
+
const CardDescription = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
2191
|
+
ref,
|
|
2192
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
2193
|
+
...props
|
|
2194
|
+
}));
|
|
2195
|
+
CardDescription.displayName = "CardDescription";
|
|
2196
|
+
const CardContent = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
2197
|
+
ref,
|
|
2198
|
+
className: cn("p-6 pt-0", className),
|
|
2199
|
+
...props
|
|
2200
|
+
}));
|
|
2201
|
+
CardContent.displayName = "CardContent";
|
|
2202
|
+
const CardFooter = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
2203
|
+
ref,
|
|
2204
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
2205
|
+
...props
|
|
2206
|
+
}));
|
|
2207
|
+
CardFooter.displayName = "CardFooter";
|
|
2208
|
+
|
|
2209
|
+
//#endregion
|
|
2210
|
+
//#region src/components/ui/code-block.tsx
|
|
2211
|
+
const CodeBlock = React.forwardRef(({ code, language = "typescript", showLineNumbers = false, className }, ref) => {
|
|
2212
|
+
return /* @__PURE__ */ jsx(Highlight, {
|
|
2213
|
+
theme: themes.vsDark,
|
|
2214
|
+
code: code.trim(),
|
|
2215
|
+
language,
|
|
2216
|
+
children: ({ className: highlightClassName, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ jsx("pre", {
|
|
2217
|
+
ref,
|
|
2218
|
+
className: cn("overflow-auto rounded-md border bg-[#1e1e1e] p-4 text-sm", className),
|
|
2219
|
+
style,
|
|
2220
|
+
children: /* @__PURE__ */ jsx("code", {
|
|
2221
|
+
className: highlightClassName,
|
|
2222
|
+
children: tokens.map((line, i) => {
|
|
2223
|
+
const lineProps = getLineProps({
|
|
2224
|
+
line,
|
|
2225
|
+
key: i
|
|
2226
|
+
});
|
|
2227
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2228
|
+
...lineProps,
|
|
2229
|
+
className: "table-row",
|
|
2230
|
+
children: [showLineNumbers && /* @__PURE__ */ jsx("span", {
|
|
2231
|
+
className: "table-cell select-none pr-4 text-right text-muted-foreground opacity-50",
|
|
2232
|
+
children: i + 1
|
|
2233
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2234
|
+
className: "table-cell",
|
|
2235
|
+
children: line.map((token, key) => /* @__PURE__ */ jsx("span", { ...getTokenProps({
|
|
2236
|
+
token,
|
|
2237
|
+
key
|
|
2238
|
+
}) }, key))
|
|
2239
|
+
})]
|
|
2240
|
+
}, i);
|
|
2241
|
+
})
|
|
2242
|
+
})
|
|
2243
|
+
})
|
|
2244
|
+
});
|
|
2245
|
+
});
|
|
2246
|
+
CodeBlock.displayName = "CodeBlock";
|
|
2247
|
+
|
|
2248
|
+
//#endregion
|
|
2249
|
+
//#region src/components/ui/dialog.tsx
|
|
2250
|
+
const Dialog = DialogPrimitive.Root;
|
|
2251
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
2252
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
2253
|
+
const DialogClose = DialogPrimitive.Close;
|
|
2254
|
+
const DialogOverlay = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
2255
|
+
ref,
|
|
2256
|
+
className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
|
|
2257
|
+
...props
|
|
2258
|
+
}));
|
|
2259
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
2260
|
+
const DialogContent = React.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(DialogPrimitive.Content, {
|
|
2261
|
+
ref,
|
|
2262
|
+
className: cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", className),
|
|
2263
|
+
...props,
|
|
2264
|
+
children: [children, /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
|
|
2265
|
+
className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
|
2266
|
+
children: [/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", {
|
|
2267
|
+
className: "sr-only",
|
|
2268
|
+
children: "Close"
|
|
2269
|
+
})]
|
|
2270
|
+
})]
|
|
2271
|
+
})] }));
|
|
2272
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
2273
|
+
const DialogHeader = ({ className,...props }) => /* @__PURE__ */ jsx("div", {
|
|
2274
|
+
className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className),
|
|
2275
|
+
...props
|
|
2276
|
+
});
|
|
2277
|
+
DialogHeader.displayName = "DialogHeader";
|
|
2278
|
+
const DialogFooter = ({ className,...props }) => /* @__PURE__ */ jsx("div", {
|
|
2279
|
+
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
2280
|
+
...props
|
|
2281
|
+
});
|
|
2282
|
+
DialogFooter.displayName = "DialogFooter";
|
|
2283
|
+
const DialogTitle = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Title, {
|
|
2284
|
+
ref,
|
|
2285
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
2286
|
+
...props
|
|
2287
|
+
}));
|
|
2288
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
2289
|
+
const DialogDescription = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, {
|
|
2290
|
+
ref,
|
|
2291
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
2292
|
+
...props
|
|
2293
|
+
}));
|
|
2294
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
2295
|
+
|
|
2296
|
+
//#endregion
|
|
2297
|
+
//#region src/components/ui/dropdown-menu.tsx
|
|
2298
|
+
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
2299
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
2300
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
2301
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
2302
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
2303
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
2304
|
+
const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children,...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
2305
|
+
ref,
|
|
2306
|
+
className: cn("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", inset && "pl-8", className),
|
|
2307
|
+
...props,
|
|
2308
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto" })]
|
|
2309
|
+
}));
|
|
2310
|
+
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
2311
|
+
const DropdownMenuSubContent = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.SubContent, {
|
|
2312
|
+
ref,
|
|
2313
|
+
className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
2314
|
+
...props
|
|
2315
|
+
}));
|
|
2316
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
2317
|
+
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4,...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Content, {
|
|
2318
|
+
ref,
|
|
2319
|
+
sideOffset,
|
|
2320
|
+
className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
2321
|
+
...props
|
|
2322
|
+
}) }));
|
|
2323
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
2324
|
+
const DropdownMenuItem = React.forwardRef(({ className, inset,...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
|
|
2325
|
+
ref,
|
|
2326
|
+
className: cn("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0", inset && "pl-8", className),
|
|
2327
|
+
...props
|
|
2328
|
+
}));
|
|
2329
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
2330
|
+
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked,...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.CheckboxItem, {
|
|
2331
|
+
ref,
|
|
2332
|
+
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
2333
|
+
checked,
|
|
2334
|
+
...props,
|
|
2335
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2336
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
2337
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) })
|
|
2338
|
+
}), children]
|
|
2339
|
+
}));
|
|
2340
|
+
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
2341
|
+
const DropdownMenuRadioItem = React.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsxs(DropdownMenuPrimitive.RadioItem, {
|
|
2342
|
+
ref,
|
|
2343
|
+
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
2344
|
+
...props,
|
|
2345
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2346
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
2347
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" }) })
|
|
2348
|
+
}), children]
|
|
2349
|
+
}));
|
|
2350
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
2351
|
+
const DropdownMenuLabel = React.forwardRef(({ className, inset,...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Label, {
|
|
2352
|
+
ref,
|
|
2353
|
+
className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
|
|
2354
|
+
...props
|
|
2355
|
+
}));
|
|
2356
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
2357
|
+
const DropdownMenuSeparator = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, {
|
|
2358
|
+
ref,
|
|
2359
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
2360
|
+
...props
|
|
2361
|
+
}));
|
|
2362
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
2363
|
+
const DropdownMenuShortcut = ({ className,...props }) => {
|
|
2364
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2365
|
+
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
2366
|
+
...props
|
|
2367
|
+
});
|
|
2368
|
+
};
|
|
2369
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
2370
|
+
|
|
2371
|
+
//#endregion
|
|
2372
|
+
//#region src/components/ui/input.tsx
|
|
2373
|
+
const Input = React.forwardRef(({ className, type,...props }, ref) => {
|
|
2374
|
+
return /* @__PURE__ */ jsx("input", {
|
|
2375
|
+
type,
|
|
2376
|
+
className: cn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className),
|
|
2377
|
+
ref,
|
|
2378
|
+
...props
|
|
2379
|
+
});
|
|
2380
|
+
});
|
|
2381
|
+
Input.displayName = "Input";
|
|
2382
|
+
|
|
2383
|
+
//#endregion
|
|
2384
|
+
//#region src/components/ui/label.tsx
|
|
2385
|
+
const labelVariants = cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
2386
|
+
const Label = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(LabelPrimitive.Root, {
|
|
2387
|
+
ref,
|
|
2388
|
+
className: cn(labelVariants(), className),
|
|
2389
|
+
...props
|
|
2390
|
+
}));
|
|
2391
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
2392
|
+
|
|
2393
|
+
//#endregion
|
|
2394
|
+
//#region src/components/ui/separator.tsx
|
|
2395
|
+
const Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true,...props }, ref) => /* @__PURE__ */ jsx(SeparatorPrimitive.Root, {
|
|
2396
|
+
ref,
|
|
2397
|
+
decorative,
|
|
2398
|
+
orientation,
|
|
2399
|
+
className: cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className),
|
|
2400
|
+
...props
|
|
2401
|
+
}));
|
|
2402
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
2403
|
+
|
|
2404
|
+
//#endregion
|
|
2405
|
+
//#region src/components/ui/tabs.tsx
|
|
2406
|
+
const Tabs = TabsPrimitive.Root;
|
|
2407
|
+
const TabsList = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.List, {
|
|
2408
|
+
ref,
|
|
2409
|
+
className: cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground", className),
|
|
2410
|
+
...props
|
|
2411
|
+
}));
|
|
2412
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
2413
|
+
const TabsTrigger = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.Trigger, {
|
|
2414
|
+
ref,
|
|
2415
|
+
className: cn("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow", className),
|
|
2416
|
+
...props
|
|
2417
|
+
}));
|
|
2418
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
2419
|
+
const TabsContent = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.Content, {
|
|
2420
|
+
ref,
|
|
2421
|
+
className: cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", className),
|
|
2422
|
+
...props
|
|
2423
|
+
}));
|
|
2424
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
2425
|
+
|
|
2426
|
+
//#endregion
|
|
2427
|
+
export { AreaTimeSeriesChart, Badge, BarListChart, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CodeBlock, ConnectionStatus, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Header, HeaderActions, HeaderBreadcrumbs, HeaderDescription, HeaderGroup, HeaderTitle, HttpMethodBadge, HttpStatusBadge, Input, JsonViewer, Label, LatencyPercentilesChart, LiveIndicator, LoadingContainer, LoadingDots, LoadingOverlay, LogLevelBadge, MetricCard, NoData, NoResults, NotFound, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerError, Shell, ShellContent, ShellFooter, ShellHeader, ShellMain, ShellSidebar, Sidebar, SidebarItem, SidebarLink, SidebarSection, SidebarToggle, Skeleton, SparkBar, Sparkline, Spinner, SplitPane, SplitPanePanel, StatusBadge, StatusDistributionChart, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TimeRangeSelector, Timeline, TimelineConnector, TimelineContent, TimelineDescription, TimelineIndicator, TimelineItem, TimelineTime, TimelineTitle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, createTimeRange, emptyStateVariants, getLogLevelColor, getMethodColor, getStatusColor, liveIndicatorVariants, loadingOverlayVariants, sidebarVariants, spinnerVariants, statusBadgeVariants, theme, timelineIndicatorVariants, timelineItemVariants, timelineVariants, useDebounce, useLocalStorage, useSidebar, useWebSocket };
|
|
2428
|
+
//# sourceMappingURL=index.mjs.map
|