@stackwright-pro/display-components 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,930 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/components/MetricCard.tsx
2
+ var _react = require('motion/react');
3
+
4
+ // src/types/index.ts
5
+ var THEME_COLORS = {
6
+ primary: "#0066CC",
7
+ success: "#10B981",
8
+ warning: "#F59E0B",
9
+ error: "#EF4444",
10
+ info: "#3B82F6",
11
+ background: "#FFFFFF",
12
+ surface: "#F3F4F6",
13
+ text: "#111827",
14
+ textSecondary: "#6B7280"
15
+ };
16
+ var STATUS_COLORS = {
17
+ operational: "#10B981",
18
+ degraded: "#F59E0B",
19
+ outage: "#EF4444",
20
+ maintenance: "#6B7280"
21
+ };
22
+
23
+ // src/components/MetricCard.tsx
24
+ var _jsxruntime = require('react/jsx-runtime');
25
+ var TrendArrow = ({ direction }) => {
26
+ const color = direction === "up" ? THEME_COLORS.success : direction === "down" ? THEME_COLORS.error : THEME_COLORS.textSecondary;
27
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
28
+ "svg",
29
+ {
30
+ width: "16",
31
+ height: "16",
32
+ viewBox: "0 0 24 24",
33
+ fill: "none",
34
+ stroke: color,
35
+ strokeWidth: "2",
36
+ strokeLinecap: "round",
37
+ strokeLinejoin: "round",
38
+ style: {
39
+ transform: direction === "down" ? "rotate(180deg)" : void 0
40
+ },
41
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M12 19V5M5 12l7-7 7 7" })
42
+ }
43
+ );
44
+ };
45
+ var AnimatedNumber = ({ value }) => {
46
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
47
+ _react.motion.span,
48
+ {
49
+ initial: { opacity: 0, y: 10 },
50
+ animate: { opacity: 1, y: 0 },
51
+ transition: { duration: 0.5, ease: "easeOut" },
52
+ children: value.toLocaleString()
53
+ }
54
+ );
55
+ };
56
+ var MetricCard = ({
57
+ label,
58
+ value,
59
+ trend,
60
+ trendValue,
61
+ color = THEME_COLORS.primary,
62
+ icon
63
+ }) => {
64
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
65
+ _react.motion.div,
66
+ {
67
+ initial: { opacity: 0, scale: 0.95 },
68
+ animate: { opacity: 1, scale: 1 },
69
+ whileHover: { scale: 1.02, boxShadow: "0 4px 20px rgba(0,0,0,0.1)" },
70
+ transition: { duration: 0.3 },
71
+ style: {
72
+ backgroundColor: "white",
73
+ borderRadius: "12px",
74
+ padding: "24px",
75
+ boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
76
+ border: "1px solid #E5E7EB",
77
+ position: "relative",
78
+ overflow: "hidden"
79
+ },
80
+ children: [
81
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
82
+ "div",
83
+ {
84
+ style: {
85
+ position: "absolute",
86
+ top: 0,
87
+ left: 0,
88
+ right: 0,
89
+ height: "4px",
90
+ backgroundColor: color
91
+ }
92
+ }
93
+ ),
94
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between" }, children: [
95
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { flex: 1 }, children: [
96
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
97
+ "p",
98
+ {
99
+ style: {
100
+ fontSize: "14px",
101
+ color: THEME_COLORS.textSecondary,
102
+ margin: "0 0 8px 0",
103
+ fontWeight: 500
104
+ },
105
+ children: label
106
+ }
107
+ ),
108
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
109
+ "p",
110
+ {
111
+ style: {
112
+ fontSize: "36px",
113
+ fontWeight: 700,
114
+ color: THEME_COLORS.text,
115
+ margin: 0,
116
+ lineHeight: 1
117
+ },
118
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AnimatedNumber, { value })
119
+ }
120
+ ),
121
+ trend && trendValue && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
122
+ "div",
123
+ {
124
+ style: {
125
+ display: "flex",
126
+ alignItems: "center",
127
+ gap: "4px",
128
+ marginTop: "12px"
129
+ },
130
+ children: [
131
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TrendArrow, { direction: trend }),
132
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
133
+ "span",
134
+ {
135
+ style: {
136
+ fontSize: "13px",
137
+ color: THEME_COLORS.textSecondary
138
+ },
139
+ children: trendValue
140
+ }
141
+ )
142
+ ]
143
+ }
144
+ )
145
+ ] }),
146
+ icon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
147
+ "div",
148
+ {
149
+ style: {
150
+ width: "48px",
151
+ height: "48px",
152
+ borderRadius: "12px",
153
+ backgroundColor: `${color}15`,
154
+ display: "flex",
155
+ alignItems: "center",
156
+ justifyContent: "center",
157
+ color
158
+ },
159
+ children: icon
160
+ }
161
+ )
162
+ ] })
163
+ ]
164
+ }
165
+ );
166
+ };
167
+
168
+ // src/components/StatusBadge.tsx
169
+
170
+
171
+ var StatusBadge = ({ status, label, pulse = false }) => {
172
+ const color = STATUS_COLORS[status];
173
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
174
+ "div",
175
+ {
176
+ style: {
177
+ display: "inline-flex",
178
+ alignItems: "center",
179
+ gap: "8px",
180
+ padding: "6px 12px",
181
+ borderRadius: "9999px",
182
+ backgroundColor: `${color}15`,
183
+ border: `1px solid ${color}30`
184
+ },
185
+ children: [
186
+ pulse && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
187
+ _react.motion.div,
188
+ {
189
+ animate: {
190
+ scale: [1, 1.2, 1],
191
+ opacity: [1, 0.6, 1]
192
+ },
193
+ transition: {
194
+ duration: 1.5,
195
+ repeat: Infinity,
196
+ ease: "easeInOut"
197
+ },
198
+ style: {
199
+ width: "8px",
200
+ height: "8px",
201
+ borderRadius: "50%",
202
+ backgroundColor: color,
203
+ boxShadow: `0 0 8px ${color}`
204
+ }
205
+ }
206
+ ),
207
+ !pulse && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
208
+ "div",
209
+ {
210
+ style: {
211
+ width: "8px",
212
+ height: "8px",
213
+ borderRadius: "50%",
214
+ backgroundColor: color
215
+ }
216
+ }
217
+ ),
218
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
219
+ "span",
220
+ {
221
+ style: {
222
+ fontSize: "13px",
223
+ fontWeight: 600,
224
+ color,
225
+ textTransform: "capitalize"
226
+ },
227
+ children: label
228
+ }
229
+ )
230
+ ]
231
+ }
232
+ );
233
+ };
234
+
235
+ // src/components/StatBar.tsx
236
+
237
+
238
+ var StatBar = ({
239
+ current,
240
+ max,
241
+ label,
242
+ color = THEME_COLORS.primary,
243
+ showPercentage = true
244
+ }) => {
245
+ const percentage = Math.min(100, Math.round(current / max * 100));
246
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { width: "100%" }, children: [
247
+ (label || showPercentage) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
248
+ "div",
249
+ {
250
+ style: {
251
+ display: "flex",
252
+ justifyContent: "space-between",
253
+ marginBottom: "8px"
254
+ },
255
+ children: [
256
+ label && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
257
+ "span",
258
+ {
259
+ style: {
260
+ fontSize: "14px",
261
+ color: THEME_COLORS.text,
262
+ fontWeight: 500
263
+ },
264
+ children: label
265
+ }
266
+ ),
267
+ showPercentage && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
268
+ "span",
269
+ {
270
+ style: {
271
+ fontSize: "14px",
272
+ color: THEME_COLORS.textSecondary,
273
+ fontWeight: 600
274
+ },
275
+ children: [
276
+ percentage,
277
+ "%"
278
+ ]
279
+ }
280
+ )
281
+ ]
282
+ }
283
+ ),
284
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
285
+ "div",
286
+ {
287
+ style: {
288
+ width: "100%",
289
+ height: "8px",
290
+ backgroundColor: `${color}20`,
291
+ borderRadius: "4px",
292
+ overflow: "hidden"
293
+ },
294
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
295
+ _react.motion.div,
296
+ {
297
+ initial: { width: 0 },
298
+ animate: { width: `${percentage}%` },
299
+ transition: { duration: 0.8, ease: "easeOut" },
300
+ style: {
301
+ height: "100%",
302
+ backgroundColor: color,
303
+ borderRadius: "4px"
304
+ }
305
+ }
306
+ )
307
+ }
308
+ ),
309
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
310
+ "div",
311
+ {
312
+ style: {
313
+ display: "flex",
314
+ justifyContent: "space-between",
315
+ marginTop: "4px",
316
+ fontSize: "12px",
317
+ color: THEME_COLORS.textSecondary
318
+ },
319
+ children: [
320
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: current.toLocaleString() }),
321
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: max.toLocaleString() })
322
+ ]
323
+ }
324
+ )
325
+ ] });
326
+ };
327
+
328
+ // src/components/Sparkline.tsx
329
+
330
+
331
+ var Sparkline = ({
332
+ data,
333
+ width = 100,
334
+ height = 30,
335
+ color = THEME_COLORS.primary,
336
+ fill = false
337
+ }) => {
338
+ if (!data || data.length < 2) {
339
+ return null;
340
+ }
341
+ const min = Math.min(...data);
342
+ const max = Math.max(...data);
343
+ const range = max - min || 1;
344
+ const points = data.map((value, index) => {
345
+ const x = index / (data.length - 1) * width;
346
+ const y = height - (value - min) / range * height;
347
+ return `${x},${y}`;
348
+ });
349
+ const pathD = `M ${points.join(" L ")}`;
350
+ const fillPath = `${pathD} L ${width},${height} L 0,${height} Z`;
351
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
352
+ "svg",
353
+ {
354
+ width,
355
+ height,
356
+ viewBox: `0 0 ${width} ${height}`,
357
+ style: { overflow: "visible" },
358
+ children: [
359
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "defs", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "linearGradient", { id: `gradient-${color.replace("#", "")}`, x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
360
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "stop", { offset: "0%", stopColor: color, stopOpacity: 0.3 }),
361
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "stop", { offset: "100%", stopColor: color, stopOpacity: 0 })
362
+ ] }) }),
363
+ fill && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
364
+ _react.motion.path,
365
+ {
366
+ d: fillPath,
367
+ fill: `url(#gradient-${color.replace("#", "")})`,
368
+ initial: { opacity: 0 },
369
+ animate: { opacity: 1 },
370
+ transition: { duration: 0.5 }
371
+ }
372
+ ),
373
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
374
+ _react.motion.path,
375
+ {
376
+ d: pathD,
377
+ fill: "none",
378
+ stroke: color,
379
+ strokeWidth: "2",
380
+ strokeLinecap: "round",
381
+ strokeLinejoin: "round",
382
+ initial: { pathLength: 0 },
383
+ animate: { pathLength: 1 },
384
+ transition: { duration: 1, ease: "easeOut" }
385
+ }
386
+ ),
387
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
388
+ _react.motion.circle,
389
+ {
390
+ cx: width,
391
+ cy: height - (data[data.length - 1] - min) / range * height,
392
+ r: "3",
393
+ fill: color,
394
+ initial: { scale: 0 },
395
+ animate: { scale: 1 },
396
+ transition: { delay: 0.9, duration: 0.2 }
397
+ }
398
+ )
399
+ ]
400
+ }
401
+ );
402
+ };
403
+
404
+ // src/components/ActivityFeed.tsx
405
+
406
+
407
+ var ActivityIcon = ({ type }) => {
408
+ const color = type === "success" ? THEME_COLORS.success : type === "warning" ? THEME_COLORS.warning : type === "error" ? THEME_COLORS.error : THEME_COLORS.info;
409
+ const iconPaths = {
410
+ success: "M20 6L9 17l-5-5",
411
+ warning: "M12 9v4M12 17h.01",
412
+ error: "M18 6L6 18M6 6l12 12",
413
+ info: "M12 16v-4M12 8h.01"
414
+ };
415
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
416
+ "div",
417
+ {
418
+ style: {
419
+ width: "32px",
420
+ height: "32px",
421
+ borderRadius: "8px",
422
+ backgroundColor: `${color}15`,
423
+ display: "flex",
424
+ alignItems: "center",
425
+ justifyContent: "center"
426
+ },
427
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
428
+ "svg",
429
+ {
430
+ width: "16",
431
+ height: "16",
432
+ viewBox: "0 0 24 24",
433
+ fill: "none",
434
+ stroke: color,
435
+ strokeWidth: "2",
436
+ strokeLinecap: "round",
437
+ strokeLinejoin: "round",
438
+ children: [
439
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "10" }),
440
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: iconPaths[type] })
441
+ ]
442
+ }
443
+ )
444
+ }
445
+ );
446
+ };
447
+ var formatTimestamp = (timestamp) => {
448
+ const date = typeof timestamp === "string" ? new Date(timestamp) : timestamp;
449
+ const now = /* @__PURE__ */ new Date();
450
+ const diffMs = now.getTime() - date.getTime();
451
+ const diffMins = Math.floor(diffMs / 6e4);
452
+ const diffHours = Math.floor(diffMs / 36e5);
453
+ const diffDays = Math.floor(diffMs / 864e5);
454
+ if (diffMins < 1) return "Just now";
455
+ if (diffMins < 60) return `${diffMins}m ago`;
456
+ if (diffHours < 24) return `${diffHours}h ago`;
457
+ if (diffDays < 7) return `${diffDays}d ago`;
458
+ return date.toLocaleDateString();
459
+ };
460
+ var ActivityFeedItem = ({
461
+ item,
462
+ index
463
+ }) => {
464
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
465
+ _react.motion.div,
466
+ {
467
+ initial: { opacity: 0, x: -20 },
468
+ animate: { opacity: 1, x: 0 },
469
+ transition: { delay: index * 0.1, duration: 0.3 },
470
+ style: {
471
+ display: "flex",
472
+ gap: "12px",
473
+ padding: "12px 0",
474
+ borderBottom: "1px solid #E5E7EB"
475
+ },
476
+ children: [
477
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ActivityIcon, { type: item.type }),
478
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { flex: 1 }, children: [
479
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
480
+ "p",
481
+ {
482
+ style: {
483
+ fontSize: "14px",
484
+ fontWeight: 500,
485
+ color: THEME_COLORS.text,
486
+ margin: 0
487
+ },
488
+ children: item.title
489
+ }
490
+ ),
491
+ item.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
492
+ "p",
493
+ {
494
+ style: {
495
+ fontSize: "13px",
496
+ color: THEME_COLORS.textSecondary,
497
+ margin: "4px 0 0 0"
498
+ },
499
+ children: item.description
500
+ }
501
+ )
502
+ ] }),
503
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
504
+ "span",
505
+ {
506
+ style: {
507
+ fontSize: "12px",
508
+ color: THEME_COLORS.textSecondary,
509
+ whiteSpace: "nowrap"
510
+ },
511
+ children: formatTimestamp(item.timestamp)
512
+ }
513
+ )
514
+ ]
515
+ }
516
+ );
517
+ };
518
+ var ActivityFeed = ({ items, maxItems }) => {
519
+ const displayItems = maxItems ? items.slice(0, maxItems) : items;
520
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
521
+ "div",
522
+ {
523
+ style: {
524
+ backgroundColor: "white",
525
+ borderRadius: "12px",
526
+ padding: "20px",
527
+ boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
528
+ border: "1px solid #E5E7EB"
529
+ },
530
+ children: [
531
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
532
+ "h3",
533
+ {
534
+ style: {
535
+ fontSize: "16px",
536
+ fontWeight: 600,
537
+ color: THEME_COLORS.text,
538
+ margin: "0 0 16px 0"
539
+ },
540
+ children: "Recent Activity"
541
+ }
542
+ ),
543
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: displayItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ActivityFeedItem, { item, index }, item.id)) })
544
+ ]
545
+ }
546
+ );
547
+ };
548
+
549
+ // src/components/DashboardGrid.tsx
550
+
551
+
552
+ var DashboardGrid = ({
553
+ columns = 3,
554
+ cards,
555
+ gap = 24
556
+ }) => {
557
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
558
+ "div",
559
+ {
560
+ style: {
561
+ display: "grid",
562
+ gridTemplateColumns: `repeat(${columns}, 1fr)`,
563
+ gap: `${gap}px`,
564
+ width: "100%"
565
+ },
566
+ children: cards.map((card, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
567
+ _react.motion.div,
568
+ {
569
+ initial: { opacity: 0, y: 20 },
570
+ animate: { opacity: 1, y: 0 },
571
+ transition: { delay: index * 0.1, duration: 0.4 },
572
+ children: card
573
+ },
574
+ index
575
+ ))
576
+ }
577
+ );
578
+ };
579
+
580
+ // src/components/DataTable.tsx
581
+
582
+
583
+
584
+
585
+
586
+ var _reacttable = require('@tanstack/react-table');
587
+
588
+ var _react3 = require('react');
589
+
590
+ function DataTable({
591
+ data,
592
+ columns,
593
+ loading = false,
594
+ emptyMessage = "No data available",
595
+ onRowClick
596
+ }) {
597
+ const [sorting, setSorting] = _react3.useState.call(void 0, []);
598
+ const tableColumns = columns.map((col) => ({
599
+ id: String(col.field),
600
+ accessorKey: String(col.field),
601
+ header: col.header,
602
+ cell: (info) => {
603
+ const value = info.getValue();
604
+ if (col.type === "date" && value) {
605
+ return new Date(value).toLocaleDateString();
606
+ }
607
+ if (col.type === "number") {
608
+ return value.toLocaleString();
609
+ }
610
+ if (col.type === "badge") {
611
+ const badgeColor = value === "available" || value === "operational" ? THEME_COLORS.success : value === "pending" ? THEME_COLORS.warning : THEME_COLORS.error;
612
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
613
+ "span",
614
+ {
615
+ style: {
616
+ padding: "4px 8px",
617
+ borderRadius: "4px",
618
+ backgroundColor: `${badgeColor}15`,
619
+ color: badgeColor,
620
+ fontSize: "12px",
621
+ fontWeight: 500
622
+ },
623
+ children: String(value)
624
+ }
625
+ );
626
+ }
627
+ return String(_nullishCoalesce(value, () => ( "")));
628
+ },
629
+ sortingFn: col.sortable ? "alphanumeric" : void 0,
630
+ enableSorting: _nullishCoalesce(col.sortable, () => ( false))
631
+ }));
632
+ const table = _reacttable.useReactTable.call(void 0, {
633
+ data,
634
+ columns: tableColumns,
635
+ state: { sorting },
636
+ onSortingChange: setSorting,
637
+ getCoreRowModel: _reacttable.getCoreRowModel.call(void 0, ),
638
+ getSortedRowModel: _reacttable.getSortedRowModel.call(void 0, )
639
+ });
640
+ if (loading) {
641
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
642
+ "div",
643
+ {
644
+ style: {
645
+ display: "flex",
646
+ alignItems: "center",
647
+ justifyContent: "center",
648
+ padding: "48px",
649
+ color: THEME_COLORS.textSecondary
650
+ },
651
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
652
+ _react.motion.div,
653
+ {
654
+ animate: { rotate: 360 },
655
+ transition: { duration: 1, repeat: Infinity, ease: "linear" },
656
+ style: { width: "24px", height: "24px", border: "3px solid #E5E7EB", borderTopColor: THEME_COLORS.primary, borderRadius: "50%" }
657
+ }
658
+ )
659
+ }
660
+ );
661
+ }
662
+ if (data.length === 0) {
663
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
664
+ "div",
665
+ {
666
+ style: {
667
+ display: "flex",
668
+ alignItems: "center",
669
+ justifyContent: "center",
670
+ padding: "48px",
671
+ color: THEME_COLORS.textSecondary
672
+ },
673
+ children: emptyMessage
674
+ }
675
+ );
676
+ }
677
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
678
+ "div",
679
+ {
680
+ style: {
681
+ backgroundColor: "white",
682
+ borderRadius: "12px",
683
+ overflow: "hidden",
684
+ boxShadow: "0 1px 3px rgba(0,0,0,0.1)",
685
+ border: "1px solid #E5E7EB"
686
+ },
687
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "table", { style: { width: "100%", borderCollapse: "collapse" }, children: [
688
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
689
+ "th",
690
+ {
691
+ onClick: header.column.getToggleSortingHandler(),
692
+ style: {
693
+ padding: "12px 16px",
694
+ textAlign: "left",
695
+ fontSize: "12px",
696
+ fontWeight: 600,
697
+ color: THEME_COLORS.textSecondary,
698
+ textTransform: "uppercase",
699
+ letterSpacing: "0.05em",
700
+ backgroundColor: THEME_COLORS.surface,
701
+ borderBottom: "1px solid #E5E7EB",
702
+ cursor: _optionalChain([columns, 'access', _ => _.find, 'call', _2 => _2((c) => c.field === header.column.id), 'optionalAccess', _3 => _3.sortable]) ? "pointer" : "default",
703
+ userSelect: "none"
704
+ },
705
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
706
+ _reacttable.flexRender.call(void 0, header.column.columnDef.header, header.getContext()),
707
+ header.column.getIsSorted() && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: header.column.getIsSorted() === "asc" ? "\u2191" : "\u2193" })
708
+ ] })
709
+ },
710
+ header.id
711
+ )) }, headerGroup.id)) }),
712
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: table.getRowModel().rows.map((row) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
713
+ _react.motion.tr,
714
+ {
715
+ whileHover: { backgroundColor: "#F9FAFB" },
716
+ onClick: () => _optionalChain([onRowClick, 'optionalCall', _4 => _4(row.original)]),
717
+ style: {
718
+ cursor: onRowClick ? "pointer" : "default",
719
+ transition: "background-color 0.15s"
720
+ },
721
+ children: row.getVisibleCells().map((cell) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
722
+ "td",
723
+ {
724
+ style: {
725
+ padding: "12px 16px",
726
+ fontSize: "14px",
727
+ color: THEME_COLORS.text,
728
+ borderBottom: "1px solid #E5E7EB"
729
+ },
730
+ children: _reacttable.flexRender.call(void 0, cell.column.columnDef.cell, cell.getContext())
731
+ },
732
+ cell.id
733
+ ))
734
+ },
735
+ row.id
736
+ )) })
737
+ ] }) })
738
+ }
739
+ );
740
+ }
741
+
742
+ // src/components/JsonViewer.tsx
743
+
744
+
745
+
746
+ var syntaxColors = {
747
+ key: "#0066CC",
748
+ string: "#10B981",
749
+ number: "#F59E0B",
750
+ boolean: "#8B5CF6",
751
+ null: "#6B7280",
752
+ bracket: "#111827"
753
+ };
754
+ var JsonNode = ({
755
+ data,
756
+ depth = 0,
757
+ collapsible,
758
+ maxHeight
759
+ }) => {
760
+ const [expanded, setExpanded] = _react3.useState.call(void 0, depth < 2);
761
+ const indent = depth * 16;
762
+ const renderValue = (value, key) => {
763
+ if (value === null) {
764
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { color: syntaxColors.null }, children: "null" });
765
+ }
766
+ if (typeof value === "boolean") {
767
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { color: syntaxColors.boolean }, children: String(value) });
768
+ }
769
+ if (typeof value === "number") {
770
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { color: syntaxColors.number }, children: value });
771
+ }
772
+ if (typeof value === "string") {
773
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: syntaxColors.string }, children: [
774
+ '"',
775
+ value,
776
+ '"'
777
+ ] });
778
+ }
779
+ if (Array.isArray(value)) {
780
+ if (value.length === 0) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { color: syntaxColors.bracket }, children: "[]" });
781
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: syntaxColors.bracket }, children: [
782
+ "[",
783
+ " ",
784
+ expanded ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: value.map((item, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
785
+ renderValue(item),
786
+ i < value.length - 1 && ", "
787
+ ] }, i)) }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: syntaxColors.null }, children: [
788
+ "...",
789
+ value.length,
790
+ " items"
791
+ ] }),
792
+ " ",
793
+ "]"
794
+ ] });
795
+ }
796
+ if (typeof value === "object") {
797
+ const entries = Object.entries(value);
798
+ if (entries.length === 0) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { color: syntaxColors.bracket }, children: "{}" });
799
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: syntaxColors.bracket }, children: [
800
+ expanded ? "{ " : "{ ... ",
801
+ expanded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
802
+ _react.motion.div,
803
+ {
804
+ initial: false,
805
+ animate: { height: "auto", opacity: 1 },
806
+ style: { paddingLeft: 16 },
807
+ children: entries.map(([k, v], i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
808
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: syntaxColors.key }, children: [
809
+ '"',
810
+ k,
811
+ '"'
812
+ ] }),
813
+ ": ",
814
+ renderValue(v, k),
815
+ i < entries.length - 1 && ","
816
+ ] }, k))
817
+ }
818
+ ),
819
+ expanded ? "}" : "}"
820
+ ] });
821
+ }
822
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: String(value) });
823
+ };
824
+ if (collapsible && depth > 0 && typeof data === "object" && data !== null) {
825
+ const entries = Object.entries(data);
826
+ const isExpandable = entries.length > 0 || Array.isArray(data);
827
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { marginLeft: indent }, children: [
828
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
829
+ _react.motion.button,
830
+ {
831
+ onClick: () => setExpanded(!expanded),
832
+ whileHover: { scale: 1.02 },
833
+ style: {
834
+ background: "none",
835
+ border: "none",
836
+ cursor: "pointer",
837
+ padding: "2px 4px",
838
+ fontFamily: "monospace",
839
+ fontSize: "13px",
840
+ color: THEME_COLORS.textSecondary,
841
+ display: "flex",
842
+ alignItems: "center",
843
+ gap: "4px"
844
+ },
845
+ children: [
846
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { transition: "transform 0.2s", transform: expanded ? "rotate(90deg)" : "rotate(0deg)" }, children: "\u25B6" }),
847
+ expanded ? "collapse" : "expand"
848
+ ]
849
+ }
850
+ ),
851
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.AnimatePresence, { children: expanded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
852
+ _react.motion.div,
853
+ {
854
+ initial: { height: 0, opacity: 0 },
855
+ animate: { height: "auto", opacity: 1 },
856
+ exit: { height: 0, opacity: 0 },
857
+ style: { overflow: maxHeight ? expanded ? "auto" : "hidden" : void 0, maxHeight },
858
+ children: renderValue(data)
859
+ }
860
+ ) })
861
+ ] });
862
+ }
863
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { marginLeft: indent }, children: renderValue(data) });
864
+ };
865
+ var CopyButton = ({ data }) => {
866
+ const [copied, setCopied] = _react3.useState.call(void 0, false);
867
+ const handleCopy = async () => {
868
+ await navigator.clipboard.writeText(JSON.stringify(data, null, 2));
869
+ setCopied(true);
870
+ setTimeout(() => setCopied(false), 2e3);
871
+ };
872
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
873
+ _react.motion.button,
874
+ {
875
+ onClick: handleCopy,
876
+ whileHover: { scale: 1.05 },
877
+ whileTap: { scale: 0.95 },
878
+ style: {
879
+ position: "absolute",
880
+ top: "12px",
881
+ right: "12px",
882
+ padding: "6px 12px",
883
+ backgroundColor: copied ? THEME_COLORS.success : THEME_COLORS.surface,
884
+ color: copied ? "white" : THEME_COLORS.text,
885
+ border: "none",
886
+ borderRadius: "6px",
887
+ fontSize: "12px",
888
+ fontWeight: 500,
889
+ cursor: "pointer",
890
+ transition: "background-color 0.2s"
891
+ },
892
+ children: copied ? "Copied!" : "Copy"
893
+ }
894
+ );
895
+ };
896
+ var JsonViewer = ({ data, collapsible = true, maxHeight }) => {
897
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
898
+ "div",
899
+ {
900
+ style: {
901
+ position: "relative",
902
+ backgroundColor: "#F8FAFC",
903
+ borderRadius: "8px",
904
+ padding: "16px",
905
+ fontFamily: "monospace",
906
+ fontSize: "13px",
907
+ lineHeight: 1.6,
908
+ overflow: maxHeight ? "hidden" : void 0,
909
+ maxHeight
910
+ },
911
+ children: [
912
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CopyButton, { data }),
913
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, JsonNode, { data, collapsible, maxHeight })
914
+ ]
915
+ }
916
+ );
917
+ };
918
+
919
+
920
+
921
+
922
+
923
+
924
+
925
+
926
+
927
+
928
+
929
+ exports.ActivityFeed = ActivityFeed; exports.DashboardGrid = DashboardGrid; exports.DataTable = DataTable; exports.JsonViewer = JsonViewer; exports.MetricCard = MetricCard; exports.STATUS_COLORS = STATUS_COLORS; exports.Sparkline = Sparkline; exports.StatBar = StatBar; exports.StatusBadge = StatusBadge; exports.THEME_COLORS = THEME_COLORS;
930
+ //# sourceMappingURL=index.js.map