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