@trinityui/design-system 1.0.6 → 1.0.8

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 CHANGED
@@ -1,1382 +1,139 @@
1
- import { jsx as e, jsxs as h, Fragment as We } from "react/jsx-runtime";
2
- import fr, { useState as G, 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 l, s as H } from "./navigation.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: l.neutral.gray600,
60
- headerBorder: "#D1D5DB",
61
- background: l.neutral.white,
62
- alternateRow: l.neutral.lightGray,
63
- hover: l.neutral.gray100,
64
- selected: `${l.primary.light}14`,
65
- borderColor: l.neutral.gray100,
66
- text: l.neutral.gray600,
67
- textSecondary: l.neutral.gray500
68
- },
69
- dark: {
70
- headerBg: "#3F3F46",
71
- headerText: l.neutral.white,
72
- headerBorder: "#52525B",
73
- background: l.neutral.darkBg,
74
- alternateRow: l.neutral.darkPaper,
75
- hover: H.effects.onDark.tint,
76
- // 4% white - subtle hover
77
- selected: `${l.primary.light}24`,
78
- borderColor: H.effects.onDark.divider,
79
- // 12% white - divider lines
80
- text: l.neutral.white,
81
- textSecondary: l.neutral.gray400
82
- }
83
- }, V = {
84
- fontFamily: '"Montserrat", sans-serif',
85
- headerWeight: 600,
86
- cellSecondary: {
87
- color: l.neutral.gray500
88
- }
89
- }, Ar = {
90
- hover: "background-color 0.15s ease"
91
- };
92
- l.neutral.gray100, l.neutral.gray600, l.neutral.gray400;
93
- l.neutral.white, l.neutral.lightGray, l.neutral.white, l.neutral.lightGray, l.neutral.gray100, `${l.primary.light}`, l.neutral.gray100, l.neutral.gray600, l.neutral.gray500, l.neutral.darkBg, l.neutral.darkPaper, l.neutral.darkBg, l.neutral.darkPaper, H.effects.onDark.tint, `${l.primary.light}`, H.effects.onDark.divider, l.neutral.white, l.neutral.gray400;
94
- const Lr = ({
95
- columns: d,
96
- config: n,
97
- density: m,
98
- onAdd: s,
99
- onCancel: c,
100
- isActive: v,
101
- onActivate: C,
102
- mode: g = "light"
103
- }) => {
104
- const [f, y] = G({}), [D, u] = G({}), t = me[m], M = Ve[g], F = le(), _ = d.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] && u((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 u(o), Object.keys(o).length === 0;
122
- }, [f, n]), w = z(() => {
123
- if (T()) {
124
- const o = n.defaultValues ? { ...n.defaultValues, ...f } : f;
125
- s(o), y({}), u({});
126
- }
127
- }, [T, n.defaultValues, f, s]), i = z(() => {
128
- y({}), u({}), c();
129
- }, [c]), B = z((o) => {
130
- o.key === "Enter" && (o.metaKey || o.ctrlKey) ? w() : o.key === "Escape" && i();
131
- }, [w, i]);
132
- return v ? /* @__PURE__ */ h(
133
- x,
134
- {
135
- onKeyDown: B,
136
- sx: {
137
- display: "flex",
138
- alignItems: "center",
139
- px: 2,
140
- py: 1,
141
- borderBottom: `2px solid ${F.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__ */ h(
155
- xr,
156
- {
157
- value: $,
158
- onChange: (k) => P(o.field, k.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((k) => /* @__PURE__ */ e(Y, { value: k.value, children: k.label }, k.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: (k) => P(o.field, k.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__ */ h(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: i,
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__ */ h(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: d,
281
- actions: n,
282
- maxInline: m = 2
283
- }) => {
284
- const [s, c] = fr.useState(null), v = !!s, 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(), c(t.currentTarget);
289
- }, y = () => {
290
- c(null);
291
- }, D = (t) => {
292
- y(), t.onClick(d);
293
- }, u = (t) => typeof t.disabled == "function" ? t.disabled(d) : t.disabled;
294
- return /* @__PURE__ */ h(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(d);
302
- },
303
- disabled: u(t),
304
- sx: { p: 0.5 },
305
- children: t.icon
306
- }
307
- ) }) }, t.id)),
308
- g.length > 0 && /* @__PURE__ */ h(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: s,
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__ */ h(
336
- Y,
337
- {
338
- onClick: () => D(t),
339
- disabled: u(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: d,
357
- actions: n,
358
- isHovered: m = !1
359
- }) => {
360
- const s = (c) => typeof c.disabled == "function" ? c.disabled(d) : c.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((c) => /* @__PURE__ */ e(O, { title: c.label, children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
373
- W,
374
- {
375
- size: "small",
376
- color: c.color || "default",
377
- onClick: (v) => {
378
- v.stopPropagation(), c.onClick(d);
379
- },
380
- disabled: s(c),
381
- sx: {
382
- p: 0.5,
383
- "&:hover": {
384
- backgroundColor: "action.hover"
385
- }
386
- },
387
- children: c.icon
388
- }
389
- ) }) }, c.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 = (d) => `${Ee[d % Ee.length]}%`, Nr = (d, n) => `${pe[d % pe.length][n % pe[0].length]}%`, Ur = ({
406
- columns: d,
407
- rows: n,
408
- density: m,
409
- showCheckbox: s = !1,
410
- colors: c
411
- }) => {
412
- const v = me[m];
413
- return /* @__PURE__ */ h(x, { sx: { width: "100%", overflow: "hidden" }, children: [
414
- /* @__PURE__ */ h(
415
- x,
416
- {
417
- sx: {
418
- display: "flex",
419
- alignItems: "center",
420
- height: v.headerHeight,
421
- px: 2,
422
- gap: 2,
423
- backgroundColor: c.headerBg,
424
- borderBottom: `2px solid ${c.headerBorder || c.borderColor}`
425
- },
426
- children: [
427
- s && /* @__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: d }).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__ */ h(
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 ${c.borderColor}`,
450
- backgroundColor: c.background
451
- },
452
- children: [
453
- s && /* @__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: d }).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: d,
478
- subtitle: n,
479
- searchValue: m,
480
- onSearchChange: s,
481
- showSearch: c = !0,
482
- selectedCount: v,
483
- totalCount: C,
484
- bulkActions: g,
485
- onBulkAction: f,
486
- onClearSelection: y,
487
- onAddRow: D,
488
- onRefresh: u,
489
- onExport: t,
490
- showExport: M = !0,
491
- showRefresh: F = !0,
492
- showColumnSelector: _ = !0,
493
- showFilterButton: P = !0,
494
- showDensitySelector: T = !0,
495
- colors: w
496
- }) {
497
- const i = le(), [B, o] = G(null), p = (I) => {
498
- o(I.currentTarget);
499
- }, R = () => {
500
- o(null);
501
- }, $ = (I) => {
502
- t?.(I), R();
503
- }, k = v > 0;
504
- return /* @__PURE__ */ h(
505
- Oe,
506
- {
507
- sx: {
508
- pl: 2,
509
- pr: 1.5,
510
- py: 1.5,
511
- borderBottom: `1px solid ${w.borderColor}`,
512
- backgroundColor: k ? ae(i.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: k ? /* @__PURE__ */ h(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(i.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((I, Z) => /* @__PURE__ */ e(O, { title: I.label, children: /* @__PURE__ */ e(
541
- W,
542
- {
543
- size: "small",
544
- onClick: () => f?.(I),
545
- color: I.color || "default",
546
- sx: {
547
- borderRadius: "8px",
548
- "&:hover": {
549
- backgroundColor: ae(i.palette.primary.main, 0.1)
550
- }
551
- },
552
- children: I.icon
553
- }
554
- ) }, Z)) })
555
- ] }) : /* @__PURE__ */ h(x, { children: [
556
- d && /* @__PURE__ */ e(
557
- L,
558
- {
559
- variant: "subtitle1",
560
- fontWeight: 600,
561
- color: "text.primary",
562
- sx: { lineHeight: 1.3 },
563
- children: d
564
- }
565
- ),
566
- n && /* @__PURE__ */ e(L, { variant: "caption", color: "text.secondary", children: n })
567
- ] }) }),
568
- /* @__PURE__ */ h(j, { direction: "row", spacing: 0.5, alignItems: "center", children: [
569
- c && /* @__PURE__ */ e(
570
- Ae,
571
- {
572
- size: "small",
573
- placeholder: "Search...",
574
- value: m,
575
- onChange: (I) => s(I.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__ */ h(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__ */ h(
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
- F && u && /* @__PURE__ */ e(O, { title: "Refresh", children: /* @__PURE__ */ e(
696
- W,
697
- {
698
- size: "small",
699
- onClick: u,
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: d,
715
- columns: n,
716
- loading: m = !1,
717
- getRowId: s,
718
- // Density
719
- density: c = "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: u,
732
- // Row Grouping
733
- rowGrouping: t,
734
- // Inline Add
735
- inlineAdd: M,
736
- // Column Pinning
737
- columnPinning: F,
738
- // Row Reordering
739
- rowReorder: _,
740
- // Actions
741
- rowActions: P,
742
- rowActionsConfig: T,
743
- bulkActions: w,
744
- // Toolbar
745
- toolbar: i = {
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: k = !0,
761
- stripedRows: I = !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, a = Ve[Me], N = kr(), [te, Qr] = G(c), [K, Re] = G({
788
- type: "include",
789
- ids: /* @__PURE__ */ new Set()
790
- }), [Je, Qe] = G({
791
- page: g.defaultPage || 0,
792
- pageSize: g.pageSize || 25
793
- }), [Xe, Ze] = G(
794
- f.defaultSort ? [f.defaultSort] : []
795
- ), [er, rr] = G({
796
- items: y.defaultFilters || []
797
- }), [tr, or] = G({}), [nr, oe] = G(!1), [q, ir] = G(""), [De, Te] = G(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 = s ? s(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, s]);
832
- ne(() => {
833
- if (F?.enabled)
834
- return {
835
- left: F.left || [],
836
- right: F.right || (U.length > 0 && T?.pinned ? ["__actions__"] : [])
837
- };
838
- }, [F, U.length, T?.pinned]);
839
- const Q = ne(() => {
840
- if (!q.trim()) return d;
841
- const r = q.toLowerCase();
842
- return d.filter(
843
- (b) => Object.values(b).some(
844
- (S) => S != null && String(S).toLowerCase().includes(r)
845
- )
846
- );
847
- }, [d, 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 = d.filter((S) => {
882
- const E = s ? s(S) : S.id;
883
- return K.ids.has(E);
884
- });
885
- r.onClick(b);
886
- },
887
- [d, K, s]
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(() => u?.enabled ? {
909
- treeData: !0,
910
- getTreeDataPath: (r) => u.getTreeDataPath ? u.getTreeDataPath(r) : r.hierarchy || [String(r.id)],
911
- groupingColDef: {
912
- headerName: u.groupingColumnLabel || "Group",
913
- width: u.groupingColumnWidth || 200
914
- },
915
- defaultGroupingExpansionDepth: u.defaultExpanded ? -1 : 0
916
- } : {}, [u]), gr = z(
917
- (r) => {
918
- const b = [];
919
- if (I && Q.findIndex((E) => (s ? s(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
- [I, ce, Q, s]
926
- ), mr = z(
927
- () => /* @__PURE__ */ e(
928
- Yr,
929
- {
930
- title: B,
931
- subtitle: o,
932
- searchValue: q,
933
- onSearchChange: Fe,
934
- showSearch: i.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: i.showExport ? Ge : void 0,
943
- showExport: i.showExport,
944
- showRefresh: i.showRefresh,
945
- showColumnSelector: i.showColumnVisibility,
946
- showFilterButton: i.showFilter,
947
- showDensitySelector: i.showDensitySelector && v,
948
- colors: a
949
- }
950
- ),
951
- [
952
- B,
953
- o,
954
- q,
955
- Fe,
956
- i,
957
- K.ids.size,
958
- Q.length,
959
- w,
960
- $e,
961
- Ie,
962
- M?.enabled,
963
- Ce,
964
- Ge,
965
- v,
966
- a
967
- ]
968
- );
969
- return m ? /* @__PURE__ */ h(
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 ${a.borderColor}` : "none",
979
- backgroundColor: a.background,
980
- ...ke
981
- },
982
- className: ve,
983
- children: [
984
- i.show && /* @__PURE__ */ h(
985
- Oe,
986
- {
987
- sx: {
988
- pl: 2,
989
- pr: 1.5,
990
- py: 1.5,
991
- borderBottom: `1px solid ${a.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: a
1012
- }
1013
- )
1014
- ]
1015
- }
1016
- ) : /* @__PURE__ */ e(x, { sx: { width: "100%", ...ke }, className: ve, children: /* @__PURE__ */ h(
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 ${a.borderColor}` : "none",
1028
- backgroundColor: a.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: s,
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: i.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": a.headerBg,
1097
- "--DataGrid-t-color-border-base": a.headerBorder || a.borderColor,
1098
- "--DataGrid-t-color-background-base": a.background,
1099
- "--DataGrid-t-color-foreground-base": a.text,
1100
- "--DataGrid-t-color-foreground-muted": a.textSecondary,
1101
- "--DataGrid-t-cell-background-pinned": a.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: `${a.headerBg} !important`,
1107
- borderBottom: `2px solid ${a.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: `${a.headerText} !important`,
1115
- backgroundColor: `${a.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: `${a.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: a.borderColor,
1149
- opacity: 0.5
1150
- },
1151
- // Cell styles
1152
- "& .MuiDataGrid-cell": {
1153
- fontSize: J.fontSize,
1154
- borderBottom: `1px solid ${a.borderColor}`,
1155
- color: a.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: a.hover
1167
- },
1168
- "&.Mui-selected": {
1169
- backgroundColor: a.selected,
1170
- "&:hover": {
1171
- backgroundColor: ae(ze.palette.primary.main, 0.12)
1172
- }
1173
- }
1174
- },
1175
- "& .MuiDataGrid-row.striped-row": {
1176
- backgroundColor: a.alternateRow,
1177
- "&:hover": {
1178
- backgroundColor: a.hover
1179
- }
1180
- },
1181
- // Footer styles
1182
- "& .MuiDataGrid-footerContainer": {
1183
- borderTop: `1px solid ${a.borderColor}`,
1184
- backgroundColor: a.background,
1185
- minHeight: 48
1186
- },
1187
- "& .MuiTablePagination-root": {
1188
- color: a.text
1189
- },
1190
- "& .MuiTablePagination-selectLabel, & .MuiTablePagination-displayedRows": {
1191
- fontSize: "0.8125rem",
1192
- color: a.textSecondary
1193
- },
1194
- // Checkbox styles
1195
- "& .MuiCheckbox-root": {
1196
- color: a.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: a.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: a.borderColor,
1224
- borderRadius: 4,
1225
- "&:hover": {
1226
- backgroundColor: a.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: d, color: n, height: m = 40 }) => {
1249
- if (!d || d.length < 2) return null;
1250
- const s = Math.min(...d), v = Math.max(...d) - s || 1, C = 100, g = d.map((y, D) => {
1251
- const u = D / (d.length - 1) * C, t = m - (y - s) / v * m;
1252
- return `${u},${t}`;
1253
- }).join(" "), f = `0,${m} ${g} ${C},${m}`;
1254
- return /* @__PURE__ */ h("svg", { width: "100%", height: m, viewBox: `0 0 ${C} ${m}`, preserveAspectRatio: "none", children: [
1255
- /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ h("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 })
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
+ import { useTheme as B, Card as M, CardContent as O, Box as i, Skeleton as C, Typography as p, Tooltip as R, IconButton as L } from "@mui/material";
3
+ import { InfoOutlined as A, MoreVert as F, TrendingFlat as G, TrendingDown as U, TrendingUp as Y } from "@mui/icons-material";
4
+ import { s as x } from "./navigation.js";
5
+ const q = ({ data: r, color: l, height: o = 40 }) => {
6
+ if (!r || r.length < 2) return null;
7
+ const d = Math.min(...r), S = Math.max(...r) - d || 1, a = 100, h = r.map((g, y) => {
8
+ const s = y / (r.length - 1) * a, b = o - (g - d) / S * o;
9
+ return `${s},${b}`;
10
+ }).join(" "), f = `0,${o} ${h} ${a},${o}`;
11
+ return /* @__PURE__ */ n("svg", { width: "100%", height: o, viewBox: `0 0 ${a} ${o}`, preserveAspectRatio: "none", children: [
12
+ /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ n("linearGradient", { id: `sparkline-gradient-${l}`, x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
13
+ /* @__PURE__ */ e("stop", { offset: "0%", stopColor: l, stopOpacity: 0.3 }),
14
+ /* @__PURE__ */ e("stop", { offset: "100%", stopColor: l, stopOpacity: 0 })
1258
15
  ] }) }),
1259
16
  /* @__PURE__ */ e(
1260
17
  "polygon",
1261
18
  {
1262
19
  points: f,
1263
- fill: `url(#sparkline-gradient-${n})`
20
+ fill: `url(#sparkline-gradient-${l})`
1264
21
  }
1265
22
  ),
1266
23
  /* @__PURE__ */ e(
1267
24
  "polyline",
1268
25
  {
1269
- points: g,
26
+ points: h,
1270
27
  fill: "none",
1271
- stroke: n,
28
+ stroke: l,
1272
29
  strokeWidth: 2,
1273
30
  strokeLinecap: "round",
1274
31
  strokeLinejoin: "round"
1275
32
  }
1276
33
  )
1277
34
  ] });
1278
- }, qr = {
35
+ }, D = {
1279
36
  small: {
1280
- padding: H.density.standard.cellPadding,
37
+ padding: x.density.standard.cellPadding,
1281
38
  titleSize: "caption",
1282
39
  valueSize: "h5",
1283
40
  iconSize: 32
1284
41
  },
1285
42
  medium: {
1286
- padding: H.density.comfortable.cellPadding,
43
+ padding: x.density.comfortable.cellPadding,
1287
44
  titleSize: "body2",
1288
45
  valueSize: "h4",
1289
46
  iconSize: 40
1290
47
  },
1291
48
  large: {
1292
- padding: H.inline.relaxed,
49
+ padding: x.inline.relaxed,
1293
50
  // 20px - relaxed breathing room
1294
51
  titleSize: "body1",
1295
52
  valueSize: "h3",
1296
53
  iconSize: 48
1297
54
  }
1298
- }, bt = ({
1299
- title: d,
1300
- value: n,
1301
- unit: m,
1302
- trend: s,
1303
- trendValue: c,
1304
- trendLabel: v = "vs last period",
1305
- sparklineData: C,
1306
- subtitle: g,
55
+ }, Q = ({
56
+ title: r,
57
+ value: l,
58
+ unit: o,
59
+ trend: d,
60
+ trendValue: m,
61
+ trendLabel: S = "vs last period",
62
+ sparklineData: a,
63
+ subtitle: h,
1307
64
  icon: f,
1308
- iconColor: y = "primary",
1309
- comparison: D,
1310
- loading: u = !1,
1311
- infoTooltip: t,
1312
- onMoreClick: M,
1313
- onClick: F,
1314
- footer: _,
1315
- size: P = "medium",
1316
- variant: T = "default",
1317
- fullHeight: w = !1
65
+ iconColor: g = "primary",
66
+ comparison: y,
67
+ loading: s = !1,
68
+ infoTooltip: b,
69
+ onMoreClick: z,
70
+ onClick: v,
71
+ footer: $,
72
+ size: w = "medium",
73
+ variant: k = "default",
74
+ fullHeight: T = !1
1318
75
  }) => {
1319
- const i = le(), B = qr[P], o = () => {
1320
- switch (s) {
76
+ const t = B(), u = D[w], I = () => {
77
+ switch (d) {
1321
78
  case "up":
1322
- return i.palette.success.main;
79
+ return t.palette.success.main;
1323
80
  case "down":
1324
- return i.palette.error.main;
81
+ return t.palette.error.main;
1325
82
  default:
1326
- return i.palette.text.secondary;
83
+ return t.palette.text.secondary;
1327
84
  }
1328
- }, p = () => {
1329
- switch (s) {
85
+ }, j = () => {
86
+ switch (d) {
1330
87
  case "up":
1331
- return /* @__PURE__ */ e(Wr, { sx: { fontSize: 18 } });
88
+ return /* @__PURE__ */ e(Y, { sx: { fontSize: 18 } });
1332
89
  case "down":
1333
- return /* @__PURE__ */ e(Er, { sx: { fontSize: 18 } });
90
+ return /* @__PURE__ */ e(U, { sx: { fontSize: 18 } });
1334
91
  default:
1335
- return /* @__PURE__ */ e(Pr, { sx: { fontSize: 18 } });
92
+ return /* @__PURE__ */ e(G, { sx: { fontSize: 18 } });
1336
93
  }
1337
- }, R = () => {
1338
- const k = i.palette.trinity?.status;
94
+ }, W = () => {
95
+ const c = t.palette.trinity?.status;
1339
96
  return {
1340
- primary: i.palette.action.selected,
97
+ primary: t.palette.action.selected,
1341
98
  // Theme-aware 12%
1342
- secondary: i.palette.action.selected,
1343
- success: k?.success?.background || i.palette.action.selected,
1344
- warning: k?.warning?.background || i.palette.action.selected,
1345
- error: k?.error?.background || i.palette.action.selected,
1346
- info: k?.info?.background || i.palette.action.selected
1347
- }[y] || i.palette.action.selected;
1348
- }, $ = {
99
+ secondary: t.palette.action.selected,
100
+ success: c?.success?.background || t.palette.action.selected,
101
+ warning: c?.warning?.background || t.palette.action.selected,
102
+ error: c?.error?.background || t.palette.action.selected,
103
+ info: c?.info?.background || t.palette.action.selected
104
+ }[g] || t.palette.action.selected;
105
+ }, P = {
1349
106
  default: {},
1350
107
  outlined: {
1351
- border: `1px solid ${i.palette.divider}`,
108
+ border: `1px solid ${t.palette.divider}`,
1352
109
  boxShadow: "none"
1353
110
  },
1354
111
  filled: {
1355
- backgroundColor: i.palette.action.hover,
112
+ backgroundColor: t.palette.action.hover,
1356
113
  // Theme-aware subtle background
1357
114
  boxShadow: "none"
1358
115
  }
1359
116
  };
1360
117
  return /* @__PURE__ */ e(
1361
- Sr,
118
+ M,
1362
119
  {
1363
- elevation: T === "default" ? 1 : 0,
1364
- onClick: F,
120
+ elevation: k === "default" ? 1 : 0,
121
+ onClick: v,
1365
122
  sx: {
1366
- borderRadius: H.borders.radiusPx.lg,
123
+ borderRadius: x.borders.radiusPx.lg,
1367
124
  // 12px to match AI StatCard
1368
- height: w ? "100%" : "auto",
1369
- cursor: F ? "pointer" : "default",
1370
- transition: `all ${H.motion.duration.fast} ${H.motion.easing.default}`,
1371
- "&:hover": F ? {
1372
- boxShadow: i.shadows[4],
125
+ height: T ? "100%" : "auto",
126
+ cursor: v ? "pointer" : "default",
127
+ transition: `all ${x.motion.duration.fast} ${x.motion.easing.default}`,
128
+ "&:hover": v ? {
129
+ boxShadow: t.shadows[4],
1373
130
  transform: "translateY(-2px)"
1374
131
  } : {},
1375
- ...$[T]
132
+ ...P[k]
1376
133
  },
1377
- children: /* @__PURE__ */ h(Cr, { sx: { p: `${B.padding}px !important` }, children: [
1378
- /* @__PURE__ */ h(
1379
- x,
134
+ children: /* @__PURE__ */ n(O, { sx: { p: `${u.padding}px !important` }, children: [
135
+ /* @__PURE__ */ n(
136
+ i,
1380
137
  {
1381
138
  sx: {
1382
139
  display: "flex",
@@ -1385,66 +142,66 @@ const ft = ({
1385
142
  mb: 2
1386
143
  },
1387
144
  children: [
1388
- /* @__PURE__ */ h(x, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
145
+ /* @__PURE__ */ n(i, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
1389
146
  f && /* @__PURE__ */ e(
1390
- x,
147
+ i,
1391
148
  {
1392
149
  sx: {
1393
150
  display: "flex",
1394
151
  alignItems: "center",
1395
152
  justifyContent: "center",
1396
- width: B.iconSize,
1397
- height: B.iconSize,
1398
- borderRadius: `${H.borders.radius.iconContainer}px`,
1399
- backgroundColor: R(),
1400
- color: i.palette[y].main
153
+ width: u.iconSize,
154
+ height: u.iconSize,
155
+ borderRadius: `${x.borders.radius.iconContainer}px`,
156
+ backgroundColor: W(),
157
+ color: t.palette[g].main
1401
158
  },
1402
159
  children: f
1403
160
  }
1404
161
  ),
1405
- /* @__PURE__ */ h(x, { children: [
1406
- /* @__PURE__ */ h(x, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
1407
- u ? /* @__PURE__ */ e(A, { width: 80, height: 20 }) : /* @__PURE__ */ e(
1408
- L,
162
+ /* @__PURE__ */ n(i, { children: [
163
+ /* @__PURE__ */ n(i, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
164
+ s ? /* @__PURE__ */ e(C, { width: 80, height: 20 }) : /* @__PURE__ */ e(
165
+ p,
1409
166
  {
1410
- variant: B.titleSize,
167
+ variant: u.titleSize,
1411
168
  color: "text.secondary",
1412
169
  fontWeight: 500,
1413
- children: d
170
+ children: r
1414
171
  }
1415
172
  ),
1416
- t && /* @__PURE__ */ e(O, { title: t, arrow: !0, children: /* @__PURE__ */ e(
1417
- Gr,
173
+ b && /* @__PURE__ */ e(R, { title: b, arrow: !0, children: /* @__PURE__ */ e(
174
+ A,
1418
175
  {
1419
176
  sx: {
1420
177
  fontSize: 14,
1421
- color: i.palette.text.disabled,
178
+ color: t.palette.text.disabled,
1422
179
  cursor: "help"
1423
180
  }
1424
181
  }
1425
182
  ) })
1426
183
  ] }),
1427
- g && !u && /* @__PURE__ */ e(L, { variant: "caption", color: "text.secondary", children: g })
184
+ h && !s && /* @__PURE__ */ e(p, { variant: "caption", color: "text.secondary", children: h })
1428
185
  ] })
1429
186
  ] }),
1430
- M && /* @__PURE__ */ e(
1431
- W,
187
+ z && /* @__PURE__ */ e(
188
+ L,
1432
189
  {
1433
190
  size: "small",
1434
- onClick: (k) => {
1435
- k.stopPropagation(), M(k);
191
+ onClick: (c) => {
192
+ c.stopPropagation(), z(c);
1436
193
  },
1437
194
  sx: { mr: -1, mt: -0.5 },
1438
- children: /* @__PURE__ */ e(Hr, { fontSize: "small" })
195
+ children: /* @__PURE__ */ e(F, { fontSize: "small" })
1439
196
  }
1440
197
  )
1441
198
  ]
1442
199
  }
1443
200
  ),
1444
- /* @__PURE__ */ e(x, { sx: { mb: C ? 2 : s ? 1 : 0 }, children: u ? /* @__PURE__ */ e(A, { width: 120, height: 40 }) : /* @__PURE__ */ h(
1445
- L,
201
+ /* @__PURE__ */ e(i, { sx: { mb: a ? 2 : d ? 1 : 0 }, children: s ? /* @__PURE__ */ e(C, { width: 120, height: 40 }) : /* @__PURE__ */ n(
202
+ p,
1446
203
  {
1447
- variant: B.valueSize,
204
+ variant: u.valueSize,
1448
205
  fontWeight: 700,
1449
206
  sx: {
1450
207
  display: "flex",
@@ -1452,30 +209,30 @@ const ft = ({
1452
209
  gap: 0.5
1453
210
  },
1454
211
  children: [
1455
- n,
1456
- m && /* @__PURE__ */ e(
1457
- L,
212
+ l,
213
+ o && /* @__PURE__ */ e(
214
+ p,
1458
215
  {
1459
216
  component: "span",
1460
217
  variant: "body2",
1461
218
  color: "text.secondary",
1462
219
  fontWeight: 400,
1463
- children: m
220
+ children: o
1464
221
  }
1465
222
  )
1466
223
  ]
1467
224
  }
1468
225
  ) }),
1469
- C && C.length > 1 && !u && /* @__PURE__ */ e(x, { sx: { mb: 2, mx: -1 }, children: /* @__PURE__ */ e(
1470
- Kr,
226
+ a && a.length > 1 && !s && /* @__PURE__ */ e(i, { sx: { mb: 2, mx: -1 }, children: /* @__PURE__ */ e(
227
+ q,
1471
228
  {
1472
- data: C,
1473
- color: o(),
1474
- height: P === "small" ? 30 : P === "large" ? 50 : 40
229
+ data: a,
230
+ color: I(),
231
+ height: w === "small" ? 30 : w === "large" ? 50 : 40
1475
232
  }
1476
233
  ) }),
1477
- s && !u && /* @__PURE__ */ h(
1478
- x,
234
+ d && !s && /* @__PURE__ */ n(
235
+ i,
1479
236
  {
1480
237
  sx: {
1481
238
  display: "flex",
@@ -1484,36 +241,35 @@ const ft = ({
1484
241
  flexWrap: "wrap"
1485
242
  },
1486
243
  children: [
1487
- /* @__PURE__ */ h(
1488
- x,
244
+ /* @__PURE__ */ n(
245
+ i,
1489
246
  {
1490
247
  sx: {
1491
248
  display: "flex",
1492
249
  alignItems: "center",
1493
250
  gap: 0.5,
1494
- color: o()
251
+ color: I()
1495
252
  },
1496
253
  children: [
1497
- p(),
1498
- c !== void 0 && /* @__PURE__ */ h(L, { variant: "body2", fontWeight: 600, children: [
1499
- c > 0 ? "+" : "",
1500
- c,
254
+ j(),
255
+ m !== void 0 && /* @__PURE__ */ n(p, { variant: "body2", fontWeight: 600, children: [
256
+ m > 0 ? "+" : "",
257
+ m,
1501
258
  "%"
1502
259
  ] })
1503
260
  ]
1504
261
  }
1505
262
  ),
1506
- /* @__PURE__ */ e(L, { variant: "caption", color: "text.secondary", children: v })
263
+ /* @__PURE__ */ e(p, { variant: "caption", color: "text.secondary", children: S })
1507
264
  ]
1508
265
  }
1509
266
  ),
1510
- D && !u && /* @__PURE__ */ e(L, { variant: "caption", color: "text.secondary", sx: { mt: 1, display: "block" }, children: D }),
1511
- _ && /* @__PURE__ */ e(x, { sx: { mt: 2, pt: 2, borderTop: `1px solid ${i.palette.divider}` }, children: _ })
267
+ y && !s && /* @__PURE__ */ e(p, { variant: "caption", color: "text.secondary", sx: { mt: 1, display: "block" }, children: y }),
268
+ $ && /* @__PURE__ */ e(i, { sx: { mt: 2, pt: 2, borderTop: `1px solid ${t.palette.divider}` }, children: $ })
1512
269
  ] })
1513
270
  }
1514
271
  );
1515
272
  };
1516
273
  export {
1517
- ft as D,
1518
- bt as a
274
+ Q as D
1519
275
  };