@trinitydesign/design-system 1.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/data.js ADDED
@@ -0,0 +1,1516 @@
1
+ import { jsx as e, jsxs as c, Fragment as We } from "react/jsx-runtime";
2
+ import fr, { useState as H, useCallback as z, useMemo as ne } from "react";
3
+ import { useTheme as le, Box as x, Stack as j, FormControl as br, Select as xr, MenuItem as Y, TextField as Ae, InputAdornment as ge, Tooltip as O, IconButton as W, Menu as Le, ListItemIcon as yr, ListItemText as ie, Paper as He, Toolbar as Oe, Skeleton as A, alpha as ae, Chip as wr, Typography as L, Divider as Pe, Card as Sr, CardContent as Cr } from "@mui/material";
4
+ import { useGridApiRef as kr, GridRowEditStopReasons as vr, DataGrid as zr, GridToolbarColumnsButton as Mr, GridToolbarFilterButton as Rr, GridToolbarDensitySelector as Dr } from "@mui/x-data-grid";
5
+ import Tr from "@mui/icons-material/Search";
6
+ import Br from "@mui/icons-material/Refresh";
7
+ import Ir from "@mui/icons-material/FileDownload";
8
+ import _e from "@mui/icons-material/Add";
9
+ import je from "@mui/icons-material/Close";
10
+ import $r from "@mui/icons-material/Check";
11
+ import { b as a, s as k } from "./ai.js";
12
+ import Fr from "@mui/icons-material/MoreVert";
13
+ import "@mui/icons-material/CheckCircle";
14
+ import "@mui/icons-material/Error";
15
+ import "@mui/icons-material/Warning";
16
+ import "@mui/icons-material/Info";
17
+ import "@mui/icons-material/DragIndicator";
18
+ import { InfoOutlined as Gr, MoreVert as Hr, TrendingFlat as Pr, TrendingDown as Er, TrendingUp as Wr } from "@mui/icons-material";
19
+ const me = {
20
+ compact: {
21
+ rowHeight: 48,
22
+ headerHeight: 44,
23
+ fontSize: 12,
24
+ padding: "6px 8px",
25
+ cellPaddingY: 6,
26
+ avatarSize: 28,
27
+ avatarFontSize: 11,
28
+ chipHeight: 22,
29
+ iconSize: 14,
30
+ progressWidth: 80
31
+ },
32
+ standard: {
33
+ rowHeight: 52,
34
+ headerHeight: 56,
35
+ fontSize: 14,
36
+ padding: "8px 16px",
37
+ cellPaddingY: 8,
38
+ avatarSize: 32,
39
+ avatarFontSize: 12,
40
+ chipHeight: 24,
41
+ iconSize: 16,
42
+ progressWidth: 100
43
+ },
44
+ comfortable: {
45
+ rowHeight: 68,
46
+ headerHeight: 64,
47
+ fontSize: 14,
48
+ padding: "12px 16px",
49
+ cellPaddingY: 12,
50
+ avatarSize: 40,
51
+ avatarFontSize: 14,
52
+ chipHeight: 28,
53
+ iconSize: 18,
54
+ progressWidth: 120
55
+ }
56
+ }, Ve = {
57
+ light: {
58
+ headerBg: "#F3F4F6",
59
+ headerText: a.neutral.gray600,
60
+ headerBorder: "#D1D5DB",
61
+ background: a.neutral.white,
62
+ alternateRow: a.neutral.lightGray,
63
+ hover: a.neutral.gray100,
64
+ selected: `${a.primary.light}14`,
65
+ borderColor: a.neutral.gray100,
66
+ text: a.neutral.gray600,
67
+ textSecondary: a.neutral.gray500
68
+ },
69
+ dark: {
70
+ headerBg: "#3F3F46",
71
+ headerText: a.neutral.white,
72
+ headerBorder: "#52525B",
73
+ background: a.neutral.darkBg,
74
+ alternateRow: a.neutral.darkPaper,
75
+ hover: k.effects.onDark.tint,
76
+ // 4% white - subtle hover
77
+ selected: `${a.primary.light}24`,
78
+ borderColor: k.effects.onDark.divider,
79
+ // 12% white - divider lines
80
+ text: a.neutral.white,
81
+ textSecondary: a.neutral.gray400
82
+ }
83
+ }, V = {
84
+ fontFamily: '"Montserrat", sans-serif',
85
+ headerWeight: 600,
86
+ cellSecondary: {
87
+ color: a.neutral.gray500
88
+ }
89
+ }, Ar = {
90
+ hover: "background-color 0.15s ease"
91
+ };
92
+ a.neutral.gray100, a.neutral.gray600, a.neutral.gray400;
93
+ a.neutral.white, a.neutral.lightGray, a.neutral.white, a.neutral.lightGray, a.neutral.gray100, `${a.primary.light}`, a.neutral.gray100, a.neutral.gray600, a.neutral.gray500, a.neutral.darkBg, a.neutral.darkPaper, a.neutral.darkBg, a.neutral.darkPaper, k.effects.onDark.tint, `${a.primary.light}`, k.effects.onDark.divider, a.neutral.white, a.neutral.gray400;
94
+ const Lr = ({
95
+ columns: l,
96
+ config: n,
97
+ density: m,
98
+ onAdd: d,
99
+ onCancel: s,
100
+ isActive: v,
101
+ onActivate: C,
102
+ mode: g = "light"
103
+ }) => {
104
+ const [f, y] = H({}), [D, h] = H({}), t = me[m], M = Ve[g], G = le(), _ = l.filter((o) => n.excludeFields?.includes(o.field) || n.editableFields && !n.editableFields.includes(o.field) ? !1 : o.editable !== !1), P = z((o, p) => {
105
+ y((R) => ({
106
+ ...R,
107
+ [o]: p
108
+ })), D[o] && h((R) => {
109
+ const $ = { ...R };
110
+ return delete $[o], $;
111
+ });
112
+ }, [D]), T = z(() => {
113
+ const o = {};
114
+ if (n.requiredFields?.forEach((p) => {
115
+ const R = f[p];
116
+ (R == null || R === "") && (o[p] = "Required");
117
+ }), n.validation) {
118
+ const p = n.validation(f);
119
+ Object.assign(o, p);
120
+ }
121
+ return h(o), Object.keys(o).length === 0;
122
+ }, [f, n]), w = z(() => {
123
+ if (T()) {
124
+ const o = n.defaultValues ? { ...n.defaultValues, ...f } : f;
125
+ d(o), y({}), h({});
126
+ }
127
+ }, [T, n.defaultValues, f, d]), u = z(() => {
128
+ y({}), h({}), s();
129
+ }, [s]), B = z((o) => {
130
+ o.key === "Enter" && (o.metaKey || o.ctrlKey) ? w() : o.key === "Escape" && u();
131
+ }, [w, u]);
132
+ return v ? /* @__PURE__ */ c(
133
+ x,
134
+ {
135
+ onKeyDown: B,
136
+ sx: {
137
+ display: "flex",
138
+ alignItems: "center",
139
+ px: 2,
140
+ py: 1,
141
+ borderBottom: `2px solid ${G.palette.primary.main}`,
142
+ backgroundColor: M.background,
143
+ gap: 1
144
+ },
145
+ children: [
146
+ _.map((o) => {
147
+ const p = n.fieldConfigs?.[o.field], R = !!D[o.field], $ = f[o.field] ?? "";
148
+ return p?.type === "select" && p.options ? /* @__PURE__ */ e(
149
+ br,
150
+ {
151
+ size: "small",
152
+ error: R,
153
+ sx: { minWidth: o.width || 150 },
154
+ children: /* @__PURE__ */ c(
155
+ xr,
156
+ {
157
+ value: $,
158
+ onChange: (I) => P(o.field, I.target.value),
159
+ displayEmpty: !0,
160
+ sx: {
161
+ fontFamily: V.fontFamily,
162
+ fontSize: t.fontSize,
163
+ "& .MuiSelect-select": {
164
+ py: 0.75
165
+ }
166
+ },
167
+ children: [
168
+ /* @__PURE__ */ e(Y, { value: "", disabled: !0, children: /* @__PURE__ */ e("em", { children: o.headerName }) }),
169
+ p.options.map((I) => /* @__PURE__ */ e(Y, { value: I.value, children: I.label }, I.value))
170
+ ]
171
+ }
172
+ )
173
+ },
174
+ o.field
175
+ ) : /* @__PURE__ */ e(
176
+ Ae,
177
+ {
178
+ size: "small",
179
+ placeholder: o.headerName,
180
+ value: $,
181
+ onChange: (I) => P(o.field, I.target.value),
182
+ error: R,
183
+ helperText: D[o.field],
184
+ type: p?.type === "number" ? "number" : "text",
185
+ slotProps: {
186
+ input: {
187
+ sx: {
188
+ fontFamily: V.fontFamily,
189
+ fontSize: t.fontSize
190
+ },
191
+ startAdornment: p?.prefix ? /* @__PURE__ */ e(ge, { position: "start", children: p.prefix }) : void 0,
192
+ endAdornment: p?.suffix ? /* @__PURE__ */ e(ge, { position: "end", children: p.suffix }) : void 0
193
+ },
194
+ formHelperText: {
195
+ sx: { mx: 0, fontSize: 10 }
196
+ }
197
+ },
198
+ sx: {
199
+ flex: o.flex || 1,
200
+ minWidth: o.width || 100,
201
+ maxWidth: o.maxWidth,
202
+ "& .MuiOutlinedInput-root": {
203
+ "& input": {
204
+ py: 0.75
205
+ }
206
+ }
207
+ }
208
+ },
209
+ o.field
210
+ );
211
+ }),
212
+ /* @__PURE__ */ c(j, { direction: "row", spacing: 0.5, sx: { ml: "auto" }, children: [
213
+ /* @__PURE__ */ e(O, { title: "Save (⌘+Enter)", children: /* @__PURE__ */ e(
214
+ W,
215
+ {
216
+ size: "small",
217
+ color: "primary",
218
+ onClick: w,
219
+ sx: {
220
+ backgroundColor: "primary.main",
221
+ color: "common.white",
222
+ "&:hover": {
223
+ backgroundColor: "primary.dark"
224
+ }
225
+ },
226
+ children: /* @__PURE__ */ e($r, { fontSize: "small" })
227
+ }
228
+ ) }),
229
+ /* @__PURE__ */ e(O, { title: "Cancel (Esc)", children: /* @__PURE__ */ e(
230
+ W,
231
+ {
232
+ size: "small",
233
+ onClick: u,
234
+ sx: {
235
+ "&:hover": {
236
+ backgroundColor: M.hover
237
+ }
238
+ },
239
+ children: /* @__PURE__ */ e(je, { fontSize: "small" })
240
+ }
241
+ ) })
242
+ ] })
243
+ ]
244
+ }
245
+ ) : /* @__PURE__ */ e(
246
+ x,
247
+ {
248
+ onClick: C,
249
+ sx: {
250
+ display: "flex",
251
+ alignItems: "center",
252
+ px: 2,
253
+ py: t.cellPaddingY,
254
+ borderBottom: `1px solid ${M.borderColor}`,
255
+ backgroundColor: M.hover,
256
+ cursor: "pointer",
257
+ transition: "background-color 0.15s ease",
258
+ "&:hover": {
259
+ backgroundColor: M.selected
260
+ }
261
+ },
262
+ children: /* @__PURE__ */ c(j, { direction: "row", spacing: 1, alignItems: "center", children: [
263
+ /* @__PURE__ */ e(_e, { sx: { fontSize: 18, color: "primary.main" } }),
264
+ /* @__PURE__ */ e(
265
+ x,
266
+ {
267
+ sx: {
268
+ fontFamily: V.fontFamily,
269
+ fontSize: t.fontSize,
270
+ color: "primary.main",
271
+ fontWeight: 500
272
+ },
273
+ children: n.placeholder || "Add new row..."
274
+ }
275
+ )
276
+ ] })
277
+ }
278
+ );
279
+ }, Or = ({
280
+ row: l,
281
+ actions: n,
282
+ maxInline: m = 2
283
+ }) => {
284
+ const [d, s] = fr.useState(null), v = !!d, C = n.filter((t) => !t.showInMenu).slice(0, m), g = [
285
+ ...n.filter((t) => t.showInMenu),
286
+ ...n.filter((t) => !t.showInMenu).slice(m)
287
+ ], f = (t) => {
288
+ t.stopPropagation(), s(t.currentTarget);
289
+ }, y = () => {
290
+ s(null);
291
+ }, D = (t) => {
292
+ y(), t.onClick(l);
293
+ }, h = (t) => typeof t.disabled == "function" ? t.disabled(l) : t.disabled;
294
+ return /* @__PURE__ */ c(j, { direction: "row", spacing: 0.5, alignItems: "center", children: [
295
+ C.map((t) => /* @__PURE__ */ e(O, { title: t.label, children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
296
+ W,
297
+ {
298
+ size: "small",
299
+ color: t.color || "default",
300
+ onClick: (M) => {
301
+ M.stopPropagation(), t.onClick(l);
302
+ },
303
+ disabled: h(t),
304
+ sx: { p: 0.5 },
305
+ children: t.icon
306
+ }
307
+ ) }) }, t.id)),
308
+ g.length > 0 && /* @__PURE__ */ c(We, { children: [
309
+ /* @__PURE__ */ e(
310
+ W,
311
+ {
312
+ size: "small",
313
+ onClick: f,
314
+ sx: { p: 0.5 },
315
+ children: /* @__PURE__ */ e(Fr, { fontSize: "small" })
316
+ }
317
+ ),
318
+ /* @__PURE__ */ e(
319
+ Le,
320
+ {
321
+ anchorEl: d,
322
+ open: v,
323
+ onClose: y,
324
+ onClick: (t) => t.stopPropagation(),
325
+ transformOrigin: { horizontal: "right", vertical: "top" },
326
+ anchorOrigin: { horizontal: "right", vertical: "bottom" },
327
+ slotProps: {
328
+ paper: {
329
+ sx: {
330
+ minWidth: 160,
331
+ boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)"
332
+ }
333
+ }
334
+ },
335
+ children: g.map((t) => /* @__PURE__ */ c(
336
+ Y,
337
+ {
338
+ onClick: () => D(t),
339
+ disabled: h(t),
340
+ sx: {
341
+ fontFamily: V.fontFamily,
342
+ fontSize: 13
343
+ },
344
+ children: [
345
+ t.icon && /* @__PURE__ */ e(yr, { sx: { color: t.color ? `${t.color}.main` : void 0 }, children: t.icon }),
346
+ /* @__PURE__ */ e(ie, { children: t.label })
347
+ ]
348
+ },
349
+ t.id
350
+ ))
351
+ }
352
+ )
353
+ ] })
354
+ ] });
355
+ }, _r = ({
356
+ row: l,
357
+ actions: n,
358
+ isHovered: m = !1
359
+ }) => {
360
+ const d = (s) => typeof s.disabled == "function" ? s.disabled(l) : s.disabled;
361
+ return /* @__PURE__ */ e(
362
+ j,
363
+ {
364
+ direction: "row",
365
+ spacing: 0.5,
366
+ alignItems: "center",
367
+ sx: {
368
+ opacity: m ? 1 : 0,
369
+ transition: "opacity 0.15s ease-in-out",
370
+ visibility: m ? "visible" : "hidden"
371
+ },
372
+ children: n.map((s) => /* @__PURE__ */ e(O, { title: s.label, children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
373
+ W,
374
+ {
375
+ size: "small",
376
+ color: s.color || "default",
377
+ onClick: (v) => {
378
+ v.stopPropagation(), s.onClick(l);
379
+ },
380
+ disabled: d(s),
381
+ sx: {
382
+ p: 0.5,
383
+ "&:hover": {
384
+ backgroundColor: "action.hover"
385
+ }
386
+ },
387
+ children: s.icon
388
+ }
389
+ ) }) }, s.id))
390
+ }
391
+ );
392
+ }, jr = {
393
+ compact: "compact",
394
+ standard: "standard",
395
+ comfortable: "comfortable"
396
+ }, Ee = [75, 68, 82, 71, 88, 65, 79, 85, 72, 78], pe = [
397
+ [62, 78, 55, 85, 70, 48, 92, 65, 73, 58],
398
+ [71, 45, 88, 63, 52, 79, 67, 90, 54, 82],
399
+ [58, 82, 68, 75, 45, 87, 60, 72, 93, 55],
400
+ [85, 55, 73, 42, 88, 65, 78, 50, 82, 68],
401
+ [68, 75, 52, 90, 58, 82, 47, 73, 88, 62],
402
+ [45, 88, 65, 72, 82, 55, 78, 68, 50, 85],
403
+ [78, 62, 88, 55, 70, 45, 82, 72, 65, 90],
404
+ [52, 78, 70, 88, 62, 75, 55, 85, 48, 72]
405
+ ], Vr = (l) => `${Ee[l % Ee.length]}%`, Nr = (l, n) => `${pe[l % pe.length][n % pe[0].length]}%`, Ur = ({
406
+ columns: l,
407
+ rows: n,
408
+ density: m,
409
+ showCheckbox: d = !1,
410
+ colors: s
411
+ }) => {
412
+ const v = me[m];
413
+ return /* @__PURE__ */ c(x, { sx: { width: "100%", overflow: "hidden" }, children: [
414
+ /* @__PURE__ */ c(
415
+ x,
416
+ {
417
+ sx: {
418
+ display: "flex",
419
+ alignItems: "center",
420
+ height: v.headerHeight,
421
+ px: 2,
422
+ gap: 2,
423
+ backgroundColor: s.headerBg,
424
+ borderBottom: `2px solid ${s.headerBorder || s.borderColor}`
425
+ },
426
+ children: [
427
+ d && /* @__PURE__ */ e(
428
+ A,
429
+ {
430
+ variant: "rectangular",
431
+ width: 18,
432
+ height: 18,
433
+ sx: { borderRadius: "4px", flexShrink: 0 }
434
+ }
435
+ ),
436
+ Array.from({ length: l }).map((C, g) => /* @__PURE__ */ e(x, { sx: { flex: 1, px: 1 }, children: /* @__PURE__ */ e(A, { width: Vr(g), height: 14 }) }, g))
437
+ ]
438
+ }
439
+ ),
440
+ Array.from({ length: n }).map((C, g) => /* @__PURE__ */ c(
441
+ x,
442
+ {
443
+ sx: {
444
+ display: "flex",
445
+ alignItems: "center",
446
+ height: v.rowHeight,
447
+ px: 2,
448
+ gap: 2,
449
+ borderBottom: `1px solid ${s.borderColor}`,
450
+ backgroundColor: s.background
451
+ },
452
+ children: [
453
+ d && /* @__PURE__ */ e(
454
+ A,
455
+ {
456
+ variant: "rectangular",
457
+ width: 18,
458
+ height: 18,
459
+ sx: { borderRadius: "4px", flexShrink: 0 }
460
+ }
461
+ ),
462
+ Array.from({ length: l }).map((f, y) => /* @__PURE__ */ e(x, { sx: { flex: 1, px: 1 }, children: /* @__PURE__ */ e(
463
+ A,
464
+ {
465
+ width: Nr(g, y),
466
+ height: 12,
467
+ sx: { my: 0.5 }
468
+ }
469
+ ) }, y))
470
+ ]
471
+ },
472
+ g
473
+ ))
474
+ ] });
475
+ };
476
+ function Yr({
477
+ title: l,
478
+ subtitle: n,
479
+ searchValue: m,
480
+ onSearchChange: d,
481
+ showSearch: s = !0,
482
+ selectedCount: v,
483
+ totalCount: C,
484
+ bulkActions: g,
485
+ onBulkAction: f,
486
+ onClearSelection: y,
487
+ onAddRow: D,
488
+ onRefresh: h,
489
+ onExport: t,
490
+ showExport: M = !0,
491
+ showRefresh: G = !0,
492
+ showColumnSelector: _ = !0,
493
+ showFilterButton: P = !0,
494
+ showDensitySelector: T = !0,
495
+ colors: w
496
+ }) {
497
+ const u = le(), [B, o] = H(null), p = (F) => {
498
+ o(F.currentTarget);
499
+ }, R = () => {
500
+ o(null);
501
+ }, $ = (F) => {
502
+ t?.(F), R();
503
+ }, I = v > 0;
504
+ return /* @__PURE__ */ c(
505
+ Oe,
506
+ {
507
+ sx: {
508
+ pl: 2,
509
+ pr: 1.5,
510
+ py: 1.5,
511
+ borderBottom: `1px solid ${w.borderColor}`,
512
+ backgroundColor: I ? ae(u.palette.primary.main, 0.06) : w.background,
513
+ minHeight: "auto !important",
514
+ flexWrap: "wrap",
515
+ gap: 1,
516
+ transition: "background-color 0.2s ease"
517
+ },
518
+ children: [
519
+ /* @__PURE__ */ e(x, { sx: { flex: "1 1 auto", minWidth: 180 }, children: I ? /* @__PURE__ */ c(j, { direction: "row", spacing: 1.5, alignItems: "center", children: [
520
+ /* @__PURE__ */ e(
521
+ wr,
522
+ {
523
+ label: `${v} selected`,
524
+ size: "small",
525
+ onDelete: y,
526
+ deleteIcon: /* @__PURE__ */ e(je, { fontSize: "small" }),
527
+ sx: {
528
+ backgroundColor: ae(u.palette.primary.main, 0.12),
529
+ color: "primary.main",
530
+ fontWeight: 600,
531
+ "& .MuiChip-deleteIcon": {
532
+ color: "primary.main",
533
+ "&:hover": {
534
+ color: "primary.dark"
535
+ }
536
+ }
537
+ }
538
+ }
539
+ ),
540
+ g && g.length > 0 && /* @__PURE__ */ e(j, { direction: "row", spacing: 0.5, children: g.map((F, Z) => /* @__PURE__ */ e(O, { title: F.label, children: /* @__PURE__ */ e(
541
+ W,
542
+ {
543
+ size: "small",
544
+ onClick: () => f?.(F),
545
+ color: F.color || "default",
546
+ sx: {
547
+ borderRadius: "8px",
548
+ "&:hover": {
549
+ backgroundColor: ae(u.palette.primary.main, 0.1)
550
+ }
551
+ },
552
+ children: F.icon
553
+ }
554
+ ) }, Z)) })
555
+ ] }) : /* @__PURE__ */ c(x, { children: [
556
+ l && /* @__PURE__ */ e(
557
+ L,
558
+ {
559
+ variant: "subtitle1",
560
+ fontWeight: 600,
561
+ color: "text.primary",
562
+ sx: { lineHeight: 1.3 },
563
+ children: l
564
+ }
565
+ ),
566
+ n && /* @__PURE__ */ e(L, { variant: "caption", color: "text.secondary", children: n })
567
+ ] }) }),
568
+ /* @__PURE__ */ c(j, { direction: "row", spacing: 0.5, alignItems: "center", children: [
569
+ s && /* @__PURE__ */ e(
570
+ Ae,
571
+ {
572
+ size: "small",
573
+ placeholder: "Search...",
574
+ value: m,
575
+ onChange: (F) => d(F.target.value),
576
+ InputProps: {
577
+ startAdornment: /* @__PURE__ */ e(ge, { position: "start", children: /* @__PURE__ */ e(Tr, { fontSize: "small", sx: { color: w.textSecondary } }) })
578
+ },
579
+ sx: {
580
+ width: 200,
581
+ "& .MuiOutlinedInput-root": {
582
+ borderRadius: "8px",
583
+ backgroundColor: w.background,
584
+ fontSize: "0.875rem",
585
+ "& fieldset": {
586
+ borderColor: w.borderColor
587
+ },
588
+ "&:hover fieldset": {
589
+ borderColor: w.textSecondary
590
+ }
591
+ }
592
+ }
593
+ }
594
+ ),
595
+ D && /* @__PURE__ */ e(O, { title: "Add row", children: /* @__PURE__ */ e(
596
+ W,
597
+ {
598
+ size: "small",
599
+ onClick: D,
600
+ sx: {
601
+ borderRadius: "8px",
602
+ border: `1px solid ${w.borderColor}`,
603
+ "&:hover": {
604
+ backgroundColor: w.hover,
605
+ borderColor: w.textSecondary
606
+ }
607
+ },
608
+ children: /* @__PURE__ */ e(_e, { fontSize: "small" })
609
+ }
610
+ ) }),
611
+ /* @__PURE__ */ e(Pe, { orientation: "vertical", flexItem: !0, sx: { mx: 0.5, height: 24, alignSelf: "center" } }),
612
+ _ && /* @__PURE__ */ e(
613
+ Mr,
614
+ {
615
+ slotProps: {
616
+ button: {
617
+ size: "small",
618
+ style: {
619
+ borderRadius: "8px",
620
+ minWidth: "auto",
621
+ paddingLeft: 8,
622
+ paddingRight: 8
623
+ }
624
+ }
625
+ }
626
+ }
627
+ ),
628
+ P && /* @__PURE__ */ e(
629
+ Rr,
630
+ {
631
+ slotProps: {
632
+ button: {
633
+ size: "small",
634
+ style: {
635
+ borderRadius: "8px",
636
+ minWidth: "auto",
637
+ paddingLeft: 8,
638
+ paddingRight: 8
639
+ }
640
+ }
641
+ }
642
+ }
643
+ ),
644
+ T && /* @__PURE__ */ e(
645
+ Dr,
646
+ {
647
+ slotProps: {
648
+ button: {
649
+ size: "small",
650
+ style: {
651
+ borderRadius: "8px",
652
+ minWidth: "auto",
653
+ paddingLeft: 8,
654
+ paddingRight: 8
655
+ }
656
+ }
657
+ }
658
+ }
659
+ ),
660
+ M && t && /* @__PURE__ */ c(We, { children: [
661
+ /* @__PURE__ */ e(O, { title: "Export", children: /* @__PURE__ */ e(
662
+ W,
663
+ {
664
+ size: "small",
665
+ onClick: p,
666
+ sx: {
667
+ borderRadius: "8px",
668
+ "&:hover": { backgroundColor: w.hover }
669
+ },
670
+ children: /* @__PURE__ */ e(Ir, { fontSize: "small" })
671
+ }
672
+ ) }),
673
+ /* @__PURE__ */ c(
674
+ Le,
675
+ {
676
+ anchorEl: B,
677
+ open: !!B,
678
+ onClose: R,
679
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
680
+ transformOrigin: { vertical: "top", horizontal: "right" },
681
+ slotProps: {
682
+ paper: {
683
+ sx: { borderRadius: "8px", minWidth: 160 }
684
+ }
685
+ },
686
+ children: [
687
+ /* @__PURE__ */ e(Y, { onClick: () => $("csv"), children: /* @__PURE__ */ e(ie, { children: "Export as CSV" }) }),
688
+ /* @__PURE__ */ e(Y, { onClick: () => $("json"), children: /* @__PURE__ */ e(ie, { children: "Export as JSON" }) }),
689
+ /* @__PURE__ */ e(Pe, {}),
690
+ /* @__PURE__ */ e(Y, { onClick: () => $("clipboard"), children: /* @__PURE__ */ e(ie, { children: "Copy to clipboard" }) })
691
+ ]
692
+ }
693
+ )
694
+ ] }),
695
+ G && h && /* @__PURE__ */ e(O, { title: "Refresh", children: /* @__PURE__ */ e(
696
+ W,
697
+ {
698
+ size: "small",
699
+ onClick: h,
700
+ sx: {
701
+ borderRadius: "8px",
702
+ "&:hover": { backgroundColor: w.hover }
703
+ },
704
+ children: /* @__PURE__ */ e(Br, { fontSize: "small" })
705
+ }
706
+ ) })
707
+ ] })
708
+ ]
709
+ }
710
+ );
711
+ }
712
+ const ft = ({
713
+ // Core props
714
+ rows: l,
715
+ columns: n,
716
+ loading: m = !1,
717
+ getRowId: d,
718
+ // Density
719
+ density: s = "standard",
720
+ allowDensityChange: v = !0,
721
+ // Selection
722
+ selection: C,
723
+ // Pagination
724
+ pagination: g = { enabled: !0, pageSize: 25 },
725
+ // Sorting & Filtering
726
+ sorting: f = { enabled: !0 },
727
+ filtering: y = { enabled: !0 },
728
+ // Editing
729
+ editing: D,
730
+ // Tree Data
731
+ treeData: h,
732
+ // Row Grouping
733
+ rowGrouping: t,
734
+ // Inline Add
735
+ inlineAdd: M,
736
+ // Column Pinning
737
+ columnPinning: G,
738
+ // Row Reordering
739
+ rowReorder: _,
740
+ // Actions
741
+ rowActions: P,
742
+ rowActionsConfig: T,
743
+ bulkActions: w,
744
+ // Toolbar
745
+ toolbar: u = {
746
+ show: !0,
747
+ showSearch: !0,
748
+ showDensitySelector: !0,
749
+ showColumnVisibility: !0,
750
+ showExport: !0,
751
+ showFilter: !0,
752
+ showRefresh: !0
753
+ },
754
+ // Appearance
755
+ title: B,
756
+ subtitle: o,
757
+ height: p = 500,
758
+ maxHeight: R,
759
+ minHeight: $ = 300,
760
+ stickyHeader: I = !0,
761
+ stripedRows: F = !1,
762
+ showBorders: Z = !0,
763
+ elevation: fe = 0,
764
+ borderRadius: be = "12px",
765
+ // Callbacks
766
+ onRowClick: Ne,
767
+ onRowDoubleClick: Ue,
768
+ onCellClick: Ye,
769
+ onSelectionChange: ee,
770
+ onSortChange: xe,
771
+ onFilterChange: ye,
772
+ onPageChange: we,
773
+ onRowUpdate: de,
774
+ onRowAdd: Se,
775
+ onRowDelete: Jr,
776
+ onRefresh: Ce,
777
+ onExport: se,
778
+ // Styling
779
+ sx: ke,
780
+ className: ve,
781
+ getRowClassName: ce,
782
+ getCellClassName: Ke,
783
+ // Slot overrides
784
+ slots: qe,
785
+ slotProps: re
786
+ }) => {
787
+ const ze = le(), Me = ze.palette.mode, i = Ve[Me], N = kr(), [te, Qr] = H(s), [K, Re] = H({
788
+ type: "include",
789
+ ids: /* @__PURE__ */ new Set()
790
+ }), [Je, Qe] = H({
791
+ page: g.defaultPage || 0,
792
+ pageSize: g.pageSize || 25
793
+ }), [Xe, Ze] = H(
794
+ f.defaultSort ? [f.defaultSort] : []
795
+ ), [er, rr] = H({
796
+ items: y.defaultFilters || []
797
+ }), [tr, or] = H({}), [nr, oe] = H(!1), [q, ir] = H(""), [De, Te] = H(null), J = me[te], U = T?.actions || P || [], he = T?.mode || "menu", Be = ne(() => {
798
+ const r = [...n];
799
+ if (U.length > 0) {
800
+ const b = {
801
+ field: "__actions__",
802
+ headerName: "",
803
+ width: T?.width || (he === "hover" ? 180 : 60),
804
+ sortable: !1,
805
+ filterable: !1,
806
+ disableColumnMenu: !0,
807
+ align: "right",
808
+ headerAlign: "right",
809
+ renderCell: (S) => {
810
+ const E = d ? d(S.row) : S.row.id, X = String(De) === String(E);
811
+ return he === "hover" ? /* @__PURE__ */ e(
812
+ _r,
813
+ {
814
+ row: S.row,
815
+ actions: U,
816
+ isHovered: X
817
+ }
818
+ ) : /* @__PURE__ */ e(
819
+ Or,
820
+ {
821
+ row: S.row,
822
+ actions: U,
823
+ maxInline: T?.maxInline || 2
824
+ }
825
+ );
826
+ }
827
+ };
828
+ r.push(b);
829
+ }
830
+ return r;
831
+ }, [n, U, he, T, De, d]);
832
+ ne(() => {
833
+ if (G?.enabled)
834
+ return {
835
+ left: G.left || [],
836
+ right: G.right || (U.length > 0 && T?.pinned ? ["__actions__"] : [])
837
+ };
838
+ }, [G, U.length, T?.pinned]);
839
+ const Q = ne(() => {
840
+ if (!q.trim()) return l;
841
+ const r = q.toLowerCase();
842
+ return l.filter(
843
+ (b) => Object.values(b).some(
844
+ (S) => S != null && String(S).toLowerCase().includes(r)
845
+ )
846
+ );
847
+ }, [l, q]), ar = z(
848
+ (r) => {
849
+ Re(r), ee?.(Array.from(r.ids));
850
+ },
851
+ [ee]
852
+ ), Ie = z(() => {
853
+ Re({ type: "include", ids: /* @__PURE__ */ new Set() }), ee?.([]);
854
+ }, [ee]), lr = z(
855
+ (r) => {
856
+ Ze(r), r.length > 0 && xe?.(r[0].field, r[0].sort || "asc");
857
+ },
858
+ [xe]
859
+ ), dr = z(
860
+ (r) => {
861
+ rr(r), ye?.(r);
862
+ },
863
+ [ye]
864
+ ), sr = z(
865
+ (r) => {
866
+ Qe(r), we?.(r.page, r.pageSize);
867
+ },
868
+ [we]
869
+ ), cr = z((r, b) => {
870
+ r.reason === vr.rowFocusOut && (b.defaultMuiPrevented = !0);
871
+ }, []), hr = z(
872
+ async (r, b) => de ? await de(r, b) : r,
873
+ [de]
874
+ ), ur = z(
875
+ (r) => {
876
+ Se?.(r), oe(!1);
877
+ },
878
+ [Se]
879
+ ), $e = z(
880
+ (r) => {
881
+ const b = l.filter((S) => {
882
+ const E = d ? d(S) : S.id;
883
+ return K.ids.has(E);
884
+ });
885
+ r.onClick(b);
886
+ },
887
+ [l, K, d]
888
+ ), Fe = z((r) => {
889
+ ir(r);
890
+ }, []), Ge = z(
891
+ (r) => {
892
+ if (se)
893
+ se(r);
894
+ else if (N.current) {
895
+ if (r === "csv")
896
+ N.current.exportDataAsCsv();
897
+ else if (r === "json") {
898
+ const b = N.current.getRowModels(), S = JSON.stringify(Array.from(b.values()), null, 2), E = new Blob([S], { type: "application/json" }), X = URL.createObjectURL(E), ue = document.createElement("a");
899
+ ue.href = X, ue.download = `${B || "data"}.json`, ue.click(), URL.revokeObjectURL(X);
900
+ } else if (r === "clipboard") {
901
+ const b = N.current.getRowModels(), S = Array.from(b.values()).map((E) => Object.values(E).join(" ")).join(`
902
+ `);
903
+ navigator.clipboard.writeText(S);
904
+ }
905
+ }
906
+ },
907
+ [se, N, B]
908
+ ), pr = ne(() => h?.enabled ? {
909
+ treeData: !0,
910
+ getTreeDataPath: (r) => h.getTreeDataPath ? h.getTreeDataPath(r) : r.hierarchy || [String(r.id)],
911
+ groupingColDef: {
912
+ headerName: h.groupingColumnLabel || "Group",
913
+ width: h.groupingColumnWidth || 200
914
+ },
915
+ defaultGroupingExpansionDepth: h.defaultExpanded ? -1 : 0
916
+ } : {}, [h]), gr = z(
917
+ (r) => {
918
+ const b = [];
919
+ if (F && Q.findIndex((E) => (d ? d(E) : E.id) === r.id) % 2 === 1 && b.push("striped-row"), ce) {
920
+ const S = ce(r.row);
921
+ S && b.push(S);
922
+ }
923
+ return b.join(" ");
924
+ },
925
+ [F, ce, Q, d]
926
+ ), mr = z(
927
+ () => /* @__PURE__ */ e(
928
+ Yr,
929
+ {
930
+ title: B,
931
+ subtitle: o,
932
+ searchValue: q,
933
+ onSearchChange: Fe,
934
+ showSearch: u.showSearch,
935
+ selectedCount: K.ids.size,
936
+ totalCount: Q.length,
937
+ bulkActions: w,
938
+ onBulkAction: $e,
939
+ onClearSelection: Ie,
940
+ onAddRow: M?.enabled ? () => oe(!0) : void 0,
941
+ onRefresh: Ce,
942
+ onExport: u.showExport ? Ge : void 0,
943
+ showExport: u.showExport,
944
+ showRefresh: u.showRefresh,
945
+ showColumnSelector: u.showColumnVisibility,
946
+ showFilterButton: u.showFilter,
947
+ showDensitySelector: u.showDensitySelector && v,
948
+ colors: i
949
+ }
950
+ ),
951
+ [
952
+ B,
953
+ o,
954
+ q,
955
+ Fe,
956
+ u,
957
+ K.ids.size,
958
+ Q.length,
959
+ w,
960
+ $e,
961
+ Ie,
962
+ M?.enabled,
963
+ Ce,
964
+ Ge,
965
+ v,
966
+ i
967
+ ]
968
+ );
969
+ return m ? /* @__PURE__ */ c(
970
+ He,
971
+ {
972
+ elevation: fe,
973
+ sx: {
974
+ width: "100%",
975
+ height: p,
976
+ borderRadius: be,
977
+ overflow: "hidden",
978
+ border: Z ? `1px solid ${i.borderColor}` : "none",
979
+ backgroundColor: i.background,
980
+ ...ke
981
+ },
982
+ className: ve,
983
+ children: [
984
+ u.show && /* @__PURE__ */ c(
985
+ Oe,
986
+ {
987
+ sx: {
988
+ pl: 2,
989
+ pr: 1.5,
990
+ py: 1.5,
991
+ borderBottom: `1px solid ${i.borderColor}`,
992
+ minHeight: "auto !important",
993
+ gap: 2
994
+ },
995
+ children: [
996
+ /* @__PURE__ */ e(A, { width: 120, height: 24, sx: { borderRadius: "4px" } }),
997
+ /* @__PURE__ */ e(x, { sx: { flex: 1 } }),
998
+ /* @__PURE__ */ e(A, { width: 180, height: 36, sx: { borderRadius: "8px" } }),
999
+ /* @__PURE__ */ e(A, { width: 32, height: 32, sx: { borderRadius: "8px" } }),
1000
+ /* @__PURE__ */ e(A, { width: 32, height: 32, sx: { borderRadius: "8px" } })
1001
+ ]
1002
+ }
1003
+ ),
1004
+ /* @__PURE__ */ e(
1005
+ Ur,
1006
+ {
1007
+ columns: Math.min(n.length, 5),
1008
+ rows: Math.floor((p - 120) / J.rowHeight),
1009
+ density: te,
1010
+ showCheckbox: C?.enabled,
1011
+ colors: i
1012
+ }
1013
+ )
1014
+ ]
1015
+ }
1016
+ ) : /* @__PURE__ */ e(x, { sx: { width: "100%", ...ke }, className: ve, children: /* @__PURE__ */ c(
1017
+ He,
1018
+ {
1019
+ elevation: fe,
1020
+ sx: {
1021
+ width: "100%",
1022
+ height: p,
1023
+ maxHeight: R,
1024
+ minHeight: $,
1025
+ borderRadius: be,
1026
+ overflow: "hidden",
1027
+ border: Z ? `1px solid ${i.borderColor}` : "none",
1028
+ backgroundColor: i.background,
1029
+ display: "flex",
1030
+ flexDirection: "column"
1031
+ },
1032
+ children: [
1033
+ /* @__PURE__ */ e(
1034
+ zr,
1035
+ {
1036
+ apiRef: N,
1037
+ rows: Q,
1038
+ columns: Be,
1039
+ loading: !1,
1040
+ getRowId: d,
1041
+ density: jr[te],
1042
+ checkboxSelection: C?.enabled,
1043
+ rowSelectionModel: K,
1044
+ onRowSelectionModelChange: ar,
1045
+ disableRowSelectionOnClick: !C?.selectOnClick,
1046
+ pagination: !0,
1047
+ paginationModel: Je,
1048
+ onPaginationModelChange: sr,
1049
+ pageSizeOptions: g.pageSizeOptions || [10, 25, 50, 100],
1050
+ sortingMode: f.serverSide ? "server" : "client",
1051
+ sortModel: Xe,
1052
+ onSortModelChange: lr,
1053
+ disableColumnSorting: !f.enabled,
1054
+ filterMode: y.serverSide ? "server" : "client",
1055
+ filterModel: er,
1056
+ onFilterModelChange: dr,
1057
+ disableColumnFilter: !y.enabled,
1058
+ editMode: D?.mode || "cell",
1059
+ rowModesModel: tr,
1060
+ onRowModesModelChange: or,
1061
+ onRowEditStop: cr,
1062
+ processRowUpdate: hr,
1063
+ ...pr,
1064
+ disableColumnMenu: !1,
1065
+ columnHeaderHeight: J.headerHeight,
1066
+ rowHeight: J.rowHeight,
1067
+ onRowClick: Ne,
1068
+ onRowDoubleClick: Ue,
1069
+ onCellClick: Ye,
1070
+ getRowClassName: gr,
1071
+ getCellClassName: Ke,
1072
+ slots: {
1073
+ toolbar: u.show ? mr : void 0,
1074
+ ...qe
1075
+ },
1076
+ slotProps: {
1077
+ ...re,
1078
+ row: {
1079
+ ...re?.row,
1080
+ onMouseEnter: (r) => {
1081
+ const b = r.currentTarget.getAttribute("data-id");
1082
+ b && Te(b), re?.row?.onMouseEnter?.(r);
1083
+ },
1084
+ onMouseLeave: (r) => {
1085
+ Te(null), re?.row?.onMouseLeave?.(r);
1086
+ }
1087
+ }
1088
+ },
1089
+ sx: {
1090
+ border: "none",
1091
+ borderRadius: 0,
1092
+ // DataGrid itself should have no border radius (Paper handles it)
1093
+ fontFamily: V.fontFamily,
1094
+ flex: 1,
1095
+ // MUI X DataGrid v8 CSS Variables - these control the theme
1096
+ "--DataGrid-t-header-background-base": i.headerBg,
1097
+ "--DataGrid-t-color-border-base": i.headerBorder || i.borderColor,
1098
+ "--DataGrid-t-color-background-base": i.background,
1099
+ "--DataGrid-t-color-foreground-base": i.text,
1100
+ "--DataGrid-t-color-foreground-muted": i.textSecondary,
1101
+ "--DataGrid-t-cell-background-pinned": i.background,
1102
+ "--DataGrid-t-radius-base": "0px",
1103
+ // No internal border radius
1104
+ // Header styles - with !important to override CSS variables
1105
+ "& .MuiDataGrid-columnHeaders": {
1106
+ backgroundColor: `${i.headerBg} !important`,
1107
+ borderBottom: `2px solid ${i.headerBorder} !important`,
1108
+ borderRadius: "0 !important"
1109
+ // Remove any internal border radius
1110
+ },
1111
+ "& .MuiDataGrid-columnHeader": {
1112
+ fontWeight: V.headerWeight,
1113
+ fontSize: J.fontSize,
1114
+ color: `${i.headerText} !important`,
1115
+ backgroundColor: `${i.headerBg} !important`,
1116
+ borderRadius: "0 !important",
1117
+ // No rounded corners on header cells
1118
+ "&:focus, &:focus-within": {
1119
+ outline: "none"
1120
+ },
1121
+ // Remove rounded corners from first and last header cells
1122
+ "&:first-of-type": {
1123
+ borderTopLeftRadius: "0 !important",
1124
+ borderBottomLeftRadius: "0 !important"
1125
+ },
1126
+ "&:last-of-type": {
1127
+ borderTopRightRadius: "0 !important",
1128
+ borderBottomRightRadius: "0 !important"
1129
+ }
1130
+ },
1131
+ // Target the row containing headers
1132
+ "& .MuiDataGrid-columnHeaderRow": {
1133
+ backgroundColor: `${i.headerBg} !important`,
1134
+ borderRadius: 0
1135
+ },
1136
+ // Target the scrollable header container
1137
+ "& .MuiDataGrid-scrollableHeaders": {
1138
+ borderRadius: 0
1139
+ },
1140
+ // Main container to clip properly
1141
+ "& .MuiDataGrid-main": {
1142
+ borderRadius: 0
1143
+ },
1144
+ "& .MuiDataGrid-columnHeaderTitle": {
1145
+ fontWeight: V.headerWeight
1146
+ },
1147
+ "& .MuiDataGrid-columnSeparator": {
1148
+ color: i.borderColor,
1149
+ opacity: 0.5
1150
+ },
1151
+ // Cell styles
1152
+ "& .MuiDataGrid-cell": {
1153
+ fontSize: J.fontSize,
1154
+ borderBottom: `1px solid ${i.borderColor}`,
1155
+ color: i.text,
1156
+ display: "flex",
1157
+ alignItems: "center",
1158
+ "&:focus, &:focus-within": {
1159
+ outline: "none"
1160
+ }
1161
+ },
1162
+ // Row styles
1163
+ "& .MuiDataGrid-row": {
1164
+ transition: Ar.hover,
1165
+ "&:hover": {
1166
+ backgroundColor: i.hover
1167
+ },
1168
+ "&.Mui-selected": {
1169
+ backgroundColor: i.selected,
1170
+ "&:hover": {
1171
+ backgroundColor: ae(ze.palette.primary.main, 0.12)
1172
+ }
1173
+ }
1174
+ },
1175
+ "& .MuiDataGrid-row.striped-row": {
1176
+ backgroundColor: i.alternateRow,
1177
+ "&:hover": {
1178
+ backgroundColor: i.hover
1179
+ }
1180
+ },
1181
+ // Footer styles
1182
+ "& .MuiDataGrid-footerContainer": {
1183
+ borderTop: `1px solid ${i.borderColor}`,
1184
+ backgroundColor: i.background,
1185
+ minHeight: 48
1186
+ },
1187
+ "& .MuiTablePagination-root": {
1188
+ color: i.text
1189
+ },
1190
+ "& .MuiTablePagination-selectLabel, & .MuiTablePagination-displayedRows": {
1191
+ fontSize: "0.8125rem",
1192
+ color: i.textSecondary
1193
+ },
1194
+ // Checkbox styles
1195
+ "& .MuiCheckbox-root": {
1196
+ color: i.textSecondary,
1197
+ padding: "6px",
1198
+ "&.Mui-checked": {
1199
+ color: "primary.main"
1200
+ }
1201
+ },
1202
+ // Empty/loading overlay
1203
+ "& .MuiDataGrid-overlay": {
1204
+ backgroundColor: "transparent"
1205
+ },
1206
+ // Virtual scroller
1207
+ "& .MuiDataGrid-virtualScroller": {
1208
+ backgroundColor: i.background
1209
+ },
1210
+ // Toolbar container
1211
+ "& .MuiDataGrid-toolbarContainer": {
1212
+ padding: 0
1213
+ },
1214
+ // Scrollbar styling
1215
+ "& .MuiDataGrid-virtualScroller::-webkit-scrollbar": {
1216
+ width: 8,
1217
+ height: 8
1218
+ },
1219
+ "& .MuiDataGrid-virtualScroller::-webkit-scrollbar-track": {
1220
+ backgroundColor: "transparent"
1221
+ },
1222
+ "& .MuiDataGrid-virtualScroller::-webkit-scrollbar-thumb": {
1223
+ backgroundColor: i.borderColor,
1224
+ borderRadius: 4,
1225
+ "&:hover": {
1226
+ backgroundColor: i.textSecondary
1227
+ }
1228
+ }
1229
+ }
1230
+ }
1231
+ ),
1232
+ M?.enabled && /* @__PURE__ */ e(
1233
+ Lr,
1234
+ {
1235
+ columns: Be,
1236
+ config: M,
1237
+ density: te,
1238
+ onAdd: ur,
1239
+ onCancel: () => oe(!1),
1240
+ isActive: nr,
1241
+ onActivate: () => oe(!0),
1242
+ mode: Me
1243
+ }
1244
+ )
1245
+ ]
1246
+ }
1247
+ ) });
1248
+ }, Kr = ({ data: l, color: n, height: m = 40 }) => {
1249
+ if (!l || l.length < 2) return null;
1250
+ const d = Math.min(...l), v = Math.max(...l) - d || 1, C = 100, g = l.map((y, D) => {
1251
+ const h = D / (l.length - 1) * C, t = m - (y - d) / v * m;
1252
+ return `${h},${t}`;
1253
+ }).join(" "), f = `0,${m} ${g} ${C},${m}`;
1254
+ return /* @__PURE__ */ c("svg", { width: "100%", height: m, viewBox: `0 0 ${C} ${m}`, preserveAspectRatio: "none", children: [
1255
+ /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ c("linearGradient", { id: `sparkline-gradient-${n}`, x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
1256
+ /* @__PURE__ */ e("stop", { offset: "0%", stopColor: n, stopOpacity: 0.3 }),
1257
+ /* @__PURE__ */ e("stop", { offset: "100%", stopColor: n, stopOpacity: 0 })
1258
+ ] }) }),
1259
+ /* @__PURE__ */ e(
1260
+ "polygon",
1261
+ {
1262
+ points: f,
1263
+ fill: `url(#sparkline-gradient-${n})`
1264
+ }
1265
+ ),
1266
+ /* @__PURE__ */ e(
1267
+ "polyline",
1268
+ {
1269
+ points: g,
1270
+ fill: "none",
1271
+ stroke: n,
1272
+ strokeWidth: 2,
1273
+ strokeLinecap: "round",
1274
+ strokeLinejoin: "round"
1275
+ }
1276
+ )
1277
+ ] });
1278
+ }, qr = {
1279
+ small: {
1280
+ padding: k.density.standard.cellPadding,
1281
+ titleSize: "caption",
1282
+ valueSize: "h5",
1283
+ iconSize: 32
1284
+ },
1285
+ medium: {
1286
+ padding: k.density.comfortable.cellPadding,
1287
+ titleSize: "body2",
1288
+ valueSize: "h4",
1289
+ iconSize: 40
1290
+ },
1291
+ large: {
1292
+ padding: k.inline.relaxed,
1293
+ // 20px - relaxed breathing room
1294
+ titleSize: "body1",
1295
+ valueSize: "h3",
1296
+ iconSize: 48
1297
+ }
1298
+ }, bt = ({
1299
+ title: l,
1300
+ value: n,
1301
+ unit: m,
1302
+ trend: d,
1303
+ trendValue: s,
1304
+ trendLabel: v = "vs last period",
1305
+ sparklineData: C,
1306
+ subtitle: g,
1307
+ icon: f,
1308
+ iconColor: y = "primary",
1309
+ comparison: D,
1310
+ loading: h = !1,
1311
+ infoTooltip: t,
1312
+ onMoreClick: M,
1313
+ onClick: G,
1314
+ footer: _,
1315
+ size: P = "medium",
1316
+ variant: T = "default",
1317
+ fullHeight: w = !1
1318
+ }) => {
1319
+ const u = le(), B = qr[P], o = () => {
1320
+ switch (d) {
1321
+ case "up":
1322
+ return u.palette.success.main;
1323
+ case "down":
1324
+ return u.palette.error.main;
1325
+ default:
1326
+ return u.palette.text.secondary;
1327
+ }
1328
+ }, p = () => {
1329
+ switch (d) {
1330
+ case "up":
1331
+ return /* @__PURE__ */ e(Wr, { sx: { fontSize: 18 } });
1332
+ case "down":
1333
+ return /* @__PURE__ */ e(Er, { sx: { fontSize: 18 } });
1334
+ default:
1335
+ return /* @__PURE__ */ e(Pr, { sx: { fontSize: 18 } });
1336
+ }
1337
+ }, R = () => ({
1338
+ primary: k.effects.overlay.pressed,
1339
+ // 12% - close to 10%
1340
+ secondary: k.effects.overlay.pressed,
1341
+ success: k.effects.state.successSubtle,
1342
+ warning: k.effects.state.warningSubtle,
1343
+ error: k.effects.state.errorSubtle,
1344
+ info: k.effects.state.infoSubtle
1345
+ })[y] || k.effects.overlay.pressed, $ = {
1346
+ default: {},
1347
+ outlined: {
1348
+ border: `1px solid ${u.palette.divider}`,
1349
+ boxShadow: "none"
1350
+ },
1351
+ filled: {
1352
+ backgroundColor: k.effects.overlay.hoverSubtle,
1353
+ // 4% black
1354
+ boxShadow: "none"
1355
+ }
1356
+ };
1357
+ return /* @__PURE__ */ e(
1358
+ Sr,
1359
+ {
1360
+ elevation: T === "default" ? 1 : 0,
1361
+ onClick: G,
1362
+ sx: {
1363
+ borderRadius: k.borders.radiusPx.lg,
1364
+ // 12px to match AI StatCard
1365
+ height: w ? "100%" : "auto",
1366
+ cursor: G ? "pointer" : "default",
1367
+ transition: `all ${k.motion.duration.fast} ${k.motion.easing.default}`,
1368
+ "&:hover": G ? {
1369
+ boxShadow: u.shadows[4],
1370
+ transform: "translateY(-2px)"
1371
+ } : {},
1372
+ ...$[T]
1373
+ },
1374
+ children: /* @__PURE__ */ c(Cr, { sx: { p: `${B.padding}px !important` }, children: [
1375
+ /* @__PURE__ */ c(
1376
+ x,
1377
+ {
1378
+ sx: {
1379
+ display: "flex",
1380
+ alignItems: "flex-start",
1381
+ justifyContent: "space-between",
1382
+ mb: 2
1383
+ },
1384
+ children: [
1385
+ /* @__PURE__ */ c(x, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
1386
+ f && /* @__PURE__ */ e(
1387
+ x,
1388
+ {
1389
+ sx: {
1390
+ display: "flex",
1391
+ alignItems: "center",
1392
+ justifyContent: "center",
1393
+ width: B.iconSize,
1394
+ height: B.iconSize,
1395
+ borderRadius: `${k.borders.radius.iconContainer}px`,
1396
+ backgroundColor: R(),
1397
+ color: u.palette[y].main
1398
+ },
1399
+ children: f
1400
+ }
1401
+ ),
1402
+ /* @__PURE__ */ c(x, { children: [
1403
+ /* @__PURE__ */ c(x, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
1404
+ h ? /* @__PURE__ */ e(A, { width: 80, height: 20 }) : /* @__PURE__ */ e(
1405
+ L,
1406
+ {
1407
+ variant: B.titleSize,
1408
+ color: "text.secondary",
1409
+ fontWeight: 500,
1410
+ children: l
1411
+ }
1412
+ ),
1413
+ t && /* @__PURE__ */ e(O, { title: t, arrow: !0, children: /* @__PURE__ */ e(
1414
+ Gr,
1415
+ {
1416
+ sx: {
1417
+ fontSize: 14,
1418
+ color: u.palette.text.disabled,
1419
+ cursor: "help"
1420
+ }
1421
+ }
1422
+ ) })
1423
+ ] }),
1424
+ g && !h && /* @__PURE__ */ e(L, { variant: "caption", color: "text.secondary", children: g })
1425
+ ] })
1426
+ ] }),
1427
+ M && /* @__PURE__ */ e(
1428
+ W,
1429
+ {
1430
+ size: "small",
1431
+ onClick: (I) => {
1432
+ I.stopPropagation(), M(I);
1433
+ },
1434
+ sx: { mr: -1, mt: -0.5 },
1435
+ children: /* @__PURE__ */ e(Hr, { fontSize: "small" })
1436
+ }
1437
+ )
1438
+ ]
1439
+ }
1440
+ ),
1441
+ /* @__PURE__ */ e(x, { sx: { mb: C ? 2 : d ? 1 : 0 }, children: h ? /* @__PURE__ */ e(A, { width: 120, height: 40 }) : /* @__PURE__ */ c(
1442
+ L,
1443
+ {
1444
+ variant: B.valueSize,
1445
+ fontWeight: 700,
1446
+ sx: {
1447
+ display: "flex",
1448
+ alignItems: "baseline",
1449
+ gap: 0.5
1450
+ },
1451
+ children: [
1452
+ n,
1453
+ m && /* @__PURE__ */ e(
1454
+ L,
1455
+ {
1456
+ component: "span",
1457
+ variant: "body2",
1458
+ color: "text.secondary",
1459
+ fontWeight: 400,
1460
+ children: m
1461
+ }
1462
+ )
1463
+ ]
1464
+ }
1465
+ ) }),
1466
+ C && C.length > 1 && !h && /* @__PURE__ */ e(x, { sx: { mb: 2, mx: -1 }, children: /* @__PURE__ */ e(
1467
+ Kr,
1468
+ {
1469
+ data: C,
1470
+ color: o(),
1471
+ height: P === "small" ? 30 : P === "large" ? 50 : 40
1472
+ }
1473
+ ) }),
1474
+ d && !h && /* @__PURE__ */ c(
1475
+ x,
1476
+ {
1477
+ sx: {
1478
+ display: "flex",
1479
+ alignItems: "center",
1480
+ gap: 1,
1481
+ flexWrap: "wrap"
1482
+ },
1483
+ children: [
1484
+ /* @__PURE__ */ c(
1485
+ x,
1486
+ {
1487
+ sx: {
1488
+ display: "flex",
1489
+ alignItems: "center",
1490
+ gap: 0.5,
1491
+ color: o()
1492
+ },
1493
+ children: [
1494
+ p(),
1495
+ s !== void 0 && /* @__PURE__ */ c(L, { variant: "body2", fontWeight: 600, children: [
1496
+ s > 0 ? "+" : "",
1497
+ s,
1498
+ "%"
1499
+ ] })
1500
+ ]
1501
+ }
1502
+ ),
1503
+ /* @__PURE__ */ e(L, { variant: "caption", color: "text.secondary", children: v })
1504
+ ]
1505
+ }
1506
+ ),
1507
+ D && !h && /* @__PURE__ */ e(L, { variant: "caption", color: "text.secondary", sx: { mt: 1, display: "block" }, children: D }),
1508
+ _ && /* @__PURE__ */ e(x, { sx: { mt: 2, pt: 2, borderTop: `1px solid ${u.palette.divider}` }, children: _ })
1509
+ ] })
1510
+ }
1511
+ );
1512
+ };
1513
+ export {
1514
+ ft as D,
1515
+ bt as a
1516
+ };