@matteoaliano/forest-ui 0.2.8 → 0.2.10
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/bin/stamp-version.mjs +53 -0
- package/bin/sync.mjs +8 -1
- package/dist/{chunk-3FZJFTY7.mjs → chunk-7B6NCKX3.mjs} +144 -26
- package/dist/chunk-7B6NCKX3.mjs.map +1 -0
- package/dist/{index-C7JP9vAZ.d.mts → index-DiI9xbOM.d.mts} +61 -11
- package/dist/{index-C7JP9vAZ.d.ts → index-DiI9xbOM.d.ts} +61 -11
- package/dist/index.d.mts +89 -2
- package/dist/index.d.ts +89 -2
- package/dist/index.js +742 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +589 -10
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +142 -24
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1 -1
- package/guidelines/FOREST_AI_GUIDELINES.md +1 -1
- package/guidelines/FOREST_DEV_GUIDELINES.md +1 -1
- package/guidelines/themes/FOREST_THEME_ALKEMY_PLUS.md +1 -1
- package/guidelines/themes/FOREST_THEME_DEFAULT.md +1 -1
- package/package.json +11 -6
- package/dist/chunk-3FZJFTY7.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { forestTheme, getPreset, buildTheme } from './chunk-
|
|
2
|
-
export { alkemyPlusPreset, alpha, avatarColors, bg, border, breadcrumbColors, buildTheme, buildThemeOptions, buttonColors, chartColors, colors, container, display, fg, focusRings, fontFamily, fontSize, fontWeight, forestPreset, forestTheme, forestThemeOptions, getAvailablePresets, getPreset, iconColors, lineHeight, navColors, radius, registerPreset, sliderColors, spacing, text, toggleColors, shadows as tokenShadows, widths } from './chunk-
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
import { ThemeProvider } from '@mui/material/styles';
|
|
1
|
+
import { bg, navColors, text, forestTheme, getPreset, buildTheme } from './chunk-7B6NCKX3.mjs';
|
|
2
|
+
export { alkemyPlusPreset, alpha, avatarColors, bg, border, breadcrumbColors, buildTheme, buildThemeOptions, buttonColors, chartColors, colors, container, display, fg, focusRings, fontFamily, fontSize, fontWeight, forestPreset, forestTheme, forestThemeOptions, getAvailablePresets, getPreset, iconColors, lineHeight, navColors, radius, registerPreset, sliderColors, spacing, text, toggleColors, shadows as tokenShadows, widths } from './chunk-7B6NCKX3.mjs';
|
|
3
|
+
import { createContext, useMemo, useContext } from 'react';
|
|
4
|
+
import { ThemeProvider, useTheme } from '@mui/material/styles';
|
|
5
5
|
import CssBaseline from '@mui/material/CssBaseline';
|
|
6
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
7
|
import MuiAutocomplete from '@mui/material/Autocomplete';
|
|
@@ -13,6 +13,9 @@ import MuiRadioGroup from '@mui/material/RadioGroup';
|
|
|
13
13
|
import MuiRadio from '@mui/material/Radio';
|
|
14
14
|
import MuiSelect from '@mui/material/Select';
|
|
15
15
|
import MuiMenuItem from '@mui/material/MenuItem';
|
|
16
|
+
import MuiListItemText from '@mui/material/ListItemText';
|
|
17
|
+
import MuiFormControl from '@mui/material/FormControl';
|
|
18
|
+
import MuiInputLabel from '@mui/material/InputLabel';
|
|
16
19
|
import MuiSwitch from '@mui/material/Switch';
|
|
17
20
|
import MuiTextField from '@mui/material/TextField';
|
|
18
21
|
import MuiToggleButton from '@mui/material/ToggleButton';
|
|
@@ -23,9 +26,8 @@ import { createSvgIcon } from '@mui/material/utils';
|
|
|
23
26
|
import MuiDivider from '@mui/material/Divider';
|
|
24
27
|
import MuiList from '@mui/material/List';
|
|
25
28
|
import MuiListItem from '@mui/material/ListItem';
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import MuiListItemText from '@mui/material/ListItemText';
|
|
29
|
+
import MuiListItemButton2 from '@mui/material/ListItemButton';
|
|
30
|
+
import ListItemIcon2 from '@mui/material/ListItemIcon';
|
|
29
31
|
import MuiListItemAvatar from '@mui/material/ListItemAvatar';
|
|
30
32
|
import MuiListSubheader from '@mui/material/ListSubheader';
|
|
31
33
|
import MuiTable from '@mui/material/Table';
|
|
@@ -61,6 +63,13 @@ import MuiLinearProgress from '@mui/material/LinearProgress';
|
|
|
61
63
|
import MuiCircularProgress from '@mui/material/CircularProgress';
|
|
62
64
|
import MuiSkeleton from '@mui/material/Skeleton';
|
|
63
65
|
import MuiSnackbar from '@mui/material/Snackbar';
|
|
66
|
+
import MuiDrawer from '@mui/material/Drawer';
|
|
67
|
+
import Box from '@mui/material/Box';
|
|
68
|
+
import IconButton from '@mui/material/IconButton';
|
|
69
|
+
import { LineChart as LineChart$1 } from '@mui/x-charts/LineChart';
|
|
70
|
+
import { Box as Box$1, Typography as Typography$1 } from '@mui/material';
|
|
71
|
+
import { BarChart as BarChart$1 } from '@mui/x-charts/BarChart';
|
|
72
|
+
import { PieChart as PieChart$1 } from '@mui/x-charts/PieChart';
|
|
64
73
|
|
|
65
74
|
function ForestProvider({
|
|
66
75
|
children,
|
|
@@ -119,6 +128,64 @@ function Select(props) {
|
|
|
119
128
|
function MenuItem(props) {
|
|
120
129
|
return /* @__PURE__ */ jsx(MuiMenuItem, { ...props });
|
|
121
130
|
}
|
|
131
|
+
function MultiSelect({
|
|
132
|
+
options,
|
|
133
|
+
value,
|
|
134
|
+
onChange,
|
|
135
|
+
selectAll = true,
|
|
136
|
+
selectAllLabel = "Select All",
|
|
137
|
+
label,
|
|
138
|
+
...rest
|
|
139
|
+
}) {
|
|
140
|
+
const allSelected = options.length > 0 && value.length === options.length;
|
|
141
|
+
const handleChange = (event) => {
|
|
142
|
+
const selected = event.target.value;
|
|
143
|
+
const arr = typeof selected === "string" ? selected.split(",") : selected;
|
|
144
|
+
onChange(arr);
|
|
145
|
+
};
|
|
146
|
+
const handleSelectAll = (e) => {
|
|
147
|
+
e.stopPropagation();
|
|
148
|
+
onChange(allSelected ? [] : options.map((o) => o.value));
|
|
149
|
+
};
|
|
150
|
+
const labelMap = new Map(options.map((o) => [o.value, o.label]));
|
|
151
|
+
const renderValue2 = (selected) => selected.map((v) => {
|
|
152
|
+
var _a;
|
|
153
|
+
return (_a = labelMap.get(v)) != null ? _a : v;
|
|
154
|
+
}).join(", ");
|
|
155
|
+
const labelId = label ? `forest-multiselect-${String(label).replace(/\s+/g, "-").toLowerCase()}` : void 0;
|
|
156
|
+
return /* @__PURE__ */ jsxs(MuiFormControl, { fullWidth: true, children: [
|
|
157
|
+
label && /* @__PURE__ */ jsx(MuiInputLabel, { id: labelId, shrink: value.length > 0, children: label }),
|
|
158
|
+
/* @__PURE__ */ jsxs(
|
|
159
|
+
MuiSelect,
|
|
160
|
+
{
|
|
161
|
+
labelId,
|
|
162
|
+
label,
|
|
163
|
+
multiple: true,
|
|
164
|
+
notched: value.length > 0,
|
|
165
|
+
value,
|
|
166
|
+
onChange: handleChange,
|
|
167
|
+
displayEmpty: true,
|
|
168
|
+
renderValue: renderValue2,
|
|
169
|
+
...rest,
|
|
170
|
+
children: [
|
|
171
|
+
selectAll && /* @__PURE__ */ jsx(
|
|
172
|
+
MuiButton,
|
|
173
|
+
{
|
|
174
|
+
size: "small",
|
|
175
|
+
variant: "text",
|
|
176
|
+
onMouseDown: handleSelectAll,
|
|
177
|
+
children: allSelected ? "Deselect All" : selectAllLabel
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
options.map((option) => /* @__PURE__ */ jsxs(MuiMenuItem, { value: option.value, children: [
|
|
181
|
+
/* @__PURE__ */ jsx(MuiCheckbox, { checked: value.includes(option.value) }),
|
|
182
|
+
/* @__PURE__ */ jsx(MuiListItemText, { primary: option.label })
|
|
183
|
+
] }, option.value))
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] });
|
|
188
|
+
}
|
|
122
189
|
function Switch(props) {
|
|
123
190
|
return /* @__PURE__ */ jsx(MuiSwitch, { ...props });
|
|
124
191
|
}
|
|
@@ -156,10 +223,10 @@ function ListItem(props) {
|
|
|
156
223
|
return /* @__PURE__ */ jsx(MuiListItem, { ...props });
|
|
157
224
|
}
|
|
158
225
|
function ListItemButton(props) {
|
|
159
|
-
return /* @__PURE__ */ jsx(
|
|
226
|
+
return /* @__PURE__ */ jsx(MuiListItemButton2, { ...props });
|
|
160
227
|
}
|
|
161
228
|
function ListItemIcon(props) {
|
|
162
|
-
return /* @__PURE__ */ jsx(
|
|
229
|
+
return /* @__PURE__ */ jsx(ListItemIcon2, { ...props });
|
|
163
230
|
}
|
|
164
231
|
function ListItemText(props) {
|
|
165
232
|
return /* @__PURE__ */ jsx(MuiListItemText, { ...props });
|
|
@@ -269,7 +336,519 @@ function Skeleton(props) {
|
|
|
269
336
|
function Snackbar(props) {
|
|
270
337
|
return /* @__PURE__ */ jsx(MuiSnackbar, { ...props });
|
|
271
338
|
}
|
|
339
|
+
var ChevronLeftOutlined_default = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
340
|
+
d: "M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"
|
|
341
|
+
}), "ChevronLeftOutlined");
|
|
342
|
+
var ChevronRightOutlined_default = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
343
|
+
d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"
|
|
344
|
+
}), "ChevronRightOutlined");
|
|
345
|
+
var SidebarContext = createContext({
|
|
346
|
+
open: true,
|
|
347
|
+
collapsedWidth: 48,
|
|
348
|
+
expandedWidth: 240
|
|
349
|
+
});
|
|
350
|
+
function useSidebar() {
|
|
351
|
+
return useContext(SidebarContext);
|
|
352
|
+
}
|
|
353
|
+
function SidebarNav({
|
|
354
|
+
open,
|
|
355
|
+
onOpenChange,
|
|
356
|
+
expandedWidth = 240,
|
|
357
|
+
collapsedWidth = 48,
|
|
358
|
+
behavior = "permanent",
|
|
359
|
+
showToggle,
|
|
360
|
+
children,
|
|
361
|
+
header,
|
|
362
|
+
footer,
|
|
363
|
+
sx,
|
|
364
|
+
...rest
|
|
365
|
+
}) {
|
|
366
|
+
const isHover = behavior === "hover";
|
|
367
|
+
const drawerWidth = open ? expandedWidth : collapsedWidth;
|
|
368
|
+
const layoutWidth = isHover ? collapsedWidth : drawerWidth;
|
|
369
|
+
const shouldShowToggle = showToggle != null ? showToggle : !isHover;
|
|
370
|
+
const hoverHandlers = isHover ? {
|
|
371
|
+
onMouseEnter: () => onOpenChange(true),
|
|
372
|
+
onMouseLeave: () => onOpenChange(false)
|
|
373
|
+
} : {};
|
|
374
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: { open, collapsedWidth, expandedWidth }, children: /* @__PURE__ */ jsxs(Box, { sx: { position: "relative", width: layoutWidth, flexShrink: 0 }, children: [
|
|
375
|
+
/* @__PURE__ */ jsx(
|
|
376
|
+
MuiDrawer,
|
|
377
|
+
{
|
|
378
|
+
variant: "permanent",
|
|
379
|
+
...rest,
|
|
380
|
+
...hoverHandlers,
|
|
381
|
+
sx: {
|
|
382
|
+
width: drawerWidth,
|
|
383
|
+
flexShrink: 0,
|
|
384
|
+
"& .MuiDrawer-paper": {
|
|
385
|
+
width: drawerWidth,
|
|
386
|
+
transition: "width 200ms ease-in-out",
|
|
387
|
+
overflowX: "hidden",
|
|
388
|
+
boxSizing: "border-box",
|
|
389
|
+
...isHover && { zIndex: (theme) => theme.zIndex.drawer + 2 }
|
|
390
|
+
},
|
|
391
|
+
...sx
|
|
392
|
+
},
|
|
393
|
+
children: /* @__PURE__ */ jsxs(
|
|
394
|
+
Box,
|
|
395
|
+
{
|
|
396
|
+
sx: {
|
|
397
|
+
display: "flex",
|
|
398
|
+
flexDirection: "column",
|
|
399
|
+
height: "100%",
|
|
400
|
+
overflow: "hidden"
|
|
401
|
+
},
|
|
402
|
+
children: [
|
|
403
|
+
header && /* @__PURE__ */ jsx(Box, { sx: { flexShrink: 0 }, children: header }),
|
|
404
|
+
/* @__PURE__ */ jsx(Box, { sx: { flexGrow: 1, overflowY: "auto", overflowX: "hidden" }, children }),
|
|
405
|
+
footer && /* @__PURE__ */ jsx(Box, { sx: { flexShrink: 0 }, children: footer })
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
)
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
shouldShowToggle && /* @__PURE__ */ jsx(
|
|
412
|
+
IconButton,
|
|
413
|
+
{
|
|
414
|
+
size: "small",
|
|
415
|
+
onClick: () => onOpenChange(!open),
|
|
416
|
+
sx: {
|
|
417
|
+
position: "absolute",
|
|
418
|
+
top: "50%",
|
|
419
|
+
right: 0,
|
|
420
|
+
transform: "translate(50%, -50%)",
|
|
421
|
+
zIndex: (theme) => theme.zIndex.drawer + 1,
|
|
422
|
+
width: 28,
|
|
423
|
+
height: 28,
|
|
424
|
+
border: 1,
|
|
425
|
+
borderColor: "divider",
|
|
426
|
+
backgroundColor: "background.paper",
|
|
427
|
+
boxShadow: 1,
|
|
428
|
+
"&:hover": {
|
|
429
|
+
backgroundColor: "action.hover"
|
|
430
|
+
},
|
|
431
|
+
"& .MuiSvgIcon-root": {
|
|
432
|
+
fontSize: 18
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
children: open ? /* @__PURE__ */ jsx(ChevronLeftOutlined_default, {}) : /* @__PURE__ */ jsx(ChevronRightOutlined_default, {})
|
|
436
|
+
}
|
|
437
|
+
)
|
|
438
|
+
] }) });
|
|
439
|
+
}
|
|
440
|
+
var itemSx = {
|
|
441
|
+
borderRadius: 1,
|
|
442
|
+
backgroundColor: bg.primary,
|
|
443
|
+
color: text.secondary,
|
|
444
|
+
"& .MuiListItemIcon-root": {
|
|
445
|
+
color: navColors.itemIconFg
|
|
446
|
+
},
|
|
447
|
+
"&:hover": {
|
|
448
|
+
backgroundColor: bg.primaryHover
|
|
449
|
+
},
|
|
450
|
+
"&.Mui-selected": {
|
|
451
|
+
backgroundColor: bg.active,
|
|
452
|
+
color: text.primary,
|
|
453
|
+
"& .MuiListItemIcon-root": {
|
|
454
|
+
color: navColors.itemIconFgActive
|
|
455
|
+
},
|
|
456
|
+
"& .MuiListItemText-primary": {
|
|
457
|
+
fontWeight: 600
|
|
458
|
+
},
|
|
459
|
+
"&:hover": {
|
|
460
|
+
backgroundColor: bg.primaryHover
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
function SidebarItem({
|
|
465
|
+
icon,
|
|
466
|
+
label,
|
|
467
|
+
endAdornment,
|
|
468
|
+
sx,
|
|
469
|
+
...rest
|
|
470
|
+
}) {
|
|
471
|
+
const { open } = useSidebar();
|
|
472
|
+
if (!open) {
|
|
473
|
+
return /* @__PURE__ */ jsx(MuiTooltip, { title: label, placement: "right", arrow: true, children: /* @__PURE__ */ jsx(
|
|
474
|
+
MuiListItemButton2,
|
|
475
|
+
{
|
|
476
|
+
...rest,
|
|
477
|
+
sx: {
|
|
478
|
+
...itemSx,
|
|
479
|
+
display: "flex",
|
|
480
|
+
justifyContent: "center",
|
|
481
|
+
alignItems: "center",
|
|
482
|
+
width: 40,
|
|
483
|
+
height: 40,
|
|
484
|
+
padding: 0,
|
|
485
|
+
margin: "0 auto",
|
|
486
|
+
...sx
|
|
487
|
+
},
|
|
488
|
+
children: /* @__PURE__ */ jsx(ListItemIcon2, { sx: { minWidth: "unset", margin: 0, "& .MuiSvgIcon-root": { fontSize: 20 } }, children: icon })
|
|
489
|
+
}
|
|
490
|
+
) });
|
|
491
|
+
}
|
|
492
|
+
return /* @__PURE__ */ jsxs(MuiListItemButton2, { ...rest, sx: { ...itemSx, height: 40, ...sx }, children: [
|
|
493
|
+
/* @__PURE__ */ jsx(ListItemIcon2, { sx: { "& .MuiSvgIcon-root": { fontSize: 20 } }, children: icon }),
|
|
494
|
+
/* @__PURE__ */ jsx(MuiListItemText, { primary: label }),
|
|
495
|
+
endAdornment
|
|
496
|
+
] });
|
|
497
|
+
}
|
|
498
|
+
function useChartColors(count, palette = "categorical") {
|
|
499
|
+
const theme = useTheme();
|
|
500
|
+
const chart = theme.palette.chart;
|
|
501
|
+
const colors2 = chart[palette] || chart.categorical || [
|
|
502
|
+
"#7B61FF",
|
|
503
|
+
"#FF7E67",
|
|
504
|
+
"#76DFD5",
|
|
505
|
+
"#F6C343",
|
|
506
|
+
"#B36A6F"
|
|
507
|
+
];
|
|
508
|
+
return colors2.slice(0, Math.min(count, colors2.length));
|
|
509
|
+
}
|
|
510
|
+
function formatDate(date) {
|
|
511
|
+
if (!date) return "";
|
|
512
|
+
const d = new Date(date);
|
|
513
|
+
if (isNaN(d.getTime())) return String(date);
|
|
514
|
+
return d.toLocaleDateString("en-US", {
|
|
515
|
+
weekday: "short",
|
|
516
|
+
month: "short",
|
|
517
|
+
day: "numeric",
|
|
518
|
+
year: "numeric"
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
function renderValue(val) {
|
|
522
|
+
if (val == null) return "0";
|
|
523
|
+
if (typeof val === "object" && "y" in val) {
|
|
524
|
+
return String(val.y);
|
|
525
|
+
}
|
|
526
|
+
return String(val);
|
|
527
|
+
}
|
|
528
|
+
function CustomTooltip(props) {
|
|
529
|
+
const { series, axisValue, dataIndex } = props;
|
|
530
|
+
const theme = useTheme();
|
|
531
|
+
if (dataIndex == null) {
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
return /* @__PURE__ */ jsxs(
|
|
535
|
+
Box$1,
|
|
536
|
+
{
|
|
537
|
+
sx: {
|
|
538
|
+
backgroundColor: theme.palette.common.white,
|
|
539
|
+
borderRadius: "12px",
|
|
540
|
+
boxShadow: "0px 12px 24px -4px #1018281a, 0px 4px 8px -2px #1018280f",
|
|
541
|
+
// Very high elevation shadow per reference
|
|
542
|
+
padding: "16px",
|
|
543
|
+
minWidth: "200px",
|
|
544
|
+
display: "flex",
|
|
545
|
+
flexDirection: "column",
|
|
546
|
+
gap: "12px",
|
|
547
|
+
borderTop: `1px solid ${theme.palette.divider}`,
|
|
548
|
+
borderRight: `1px solid ${theme.palette.divider}`,
|
|
549
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
550
|
+
borderLeft: `4px solid ${theme.palette.chart.series1Fg}`
|
|
551
|
+
// Primary Accent line
|
|
552
|
+
},
|
|
553
|
+
children: [
|
|
554
|
+
/* @__PURE__ */ jsx(
|
|
555
|
+
Typography$1,
|
|
556
|
+
{
|
|
557
|
+
variant: "body2",
|
|
558
|
+
sx: {
|
|
559
|
+
fontWeight: 600,
|
|
560
|
+
color: theme.palette.text.primary,
|
|
561
|
+
marginBottom: "4px"
|
|
562
|
+
},
|
|
563
|
+
children: formatDate(axisValue)
|
|
564
|
+
}
|
|
565
|
+
),
|
|
566
|
+
series.map((s) => {
|
|
567
|
+
const color = typeof s.getColor === "function" ? s.getColor(dataIndex) : s.color;
|
|
568
|
+
const value = s.data ? s.data[dataIndex] : null;
|
|
569
|
+
if (value == null) return null;
|
|
570
|
+
return /* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", flexDirection: "column", gap: "6px" }, children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
571
|
+
/* @__PURE__ */ jsx(
|
|
572
|
+
Box$1,
|
|
573
|
+
{
|
|
574
|
+
sx: {
|
|
575
|
+
width: 16,
|
|
576
|
+
height: 16,
|
|
577
|
+
borderRadius: "4px",
|
|
578
|
+
backgroundColor: color,
|
|
579
|
+
flexShrink: 0
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
),
|
|
583
|
+
/* @__PURE__ */ jsxs(
|
|
584
|
+
Typography$1,
|
|
585
|
+
{
|
|
586
|
+
variant: "body2",
|
|
587
|
+
sx: {
|
|
588
|
+
color: theme.palette.text.secondary,
|
|
589
|
+
display: "flex",
|
|
590
|
+
alignItems: "center",
|
|
591
|
+
gap: "6px"
|
|
592
|
+
},
|
|
593
|
+
children: [
|
|
594
|
+
/* @__PURE__ */ jsx(
|
|
595
|
+
Box$1,
|
|
596
|
+
{
|
|
597
|
+
component: "span",
|
|
598
|
+
sx: {
|
|
599
|
+
backgroundColor: theme.palette.grey[50] || "#f9fafb",
|
|
600
|
+
padding: "2px 6px",
|
|
601
|
+
borderRadius: "4px",
|
|
602
|
+
fontWeight: 500,
|
|
603
|
+
color: theme.palette.text.primary,
|
|
604
|
+
border: `1px solid ${theme.palette.divider}`
|
|
605
|
+
},
|
|
606
|
+
children: renderValue(value)
|
|
607
|
+
}
|
|
608
|
+
),
|
|
609
|
+
" ",
|
|
610
|
+
"events"
|
|
611
|
+
]
|
|
612
|
+
}
|
|
613
|
+
)
|
|
614
|
+
] }) }, s.id);
|
|
615
|
+
})
|
|
616
|
+
]
|
|
617
|
+
}
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
function LineChart({ series, colors: colors2, palette = "categorical", ...props }) {
|
|
621
|
+
var _a, _b;
|
|
622
|
+
const theme = useTheme();
|
|
623
|
+
const chart = theme.palette.chart;
|
|
624
|
+
const seriesColors = useChartColors((_a = series == null ? void 0 : series.length) != null ? _a : 0, palette);
|
|
625
|
+
const modifiedSeries = series == null ? void 0 : series.map((s) => {
|
|
626
|
+
var _a2, _b2;
|
|
627
|
+
return {
|
|
628
|
+
...s,
|
|
629
|
+
curve: (_a2 = s.curve) != null ? _a2 : "monotoneX",
|
|
630
|
+
highlightScope: (_b2 = s.highlightScope) != null ? _b2 : { highlighted: "item", faded: "global" }
|
|
631
|
+
};
|
|
632
|
+
});
|
|
633
|
+
return /* @__PURE__ */ jsx(
|
|
634
|
+
LineChart$1,
|
|
635
|
+
{
|
|
636
|
+
series: modifiedSeries != null ? modifiedSeries : [],
|
|
637
|
+
colors: colors2 != null ? colors2 : seriesColors,
|
|
638
|
+
grid: { horizontal: true },
|
|
639
|
+
slots: {
|
|
640
|
+
axisContent: CustomTooltip
|
|
641
|
+
},
|
|
642
|
+
slotProps: {
|
|
643
|
+
legend: {
|
|
644
|
+
itemMarkWidth: 12,
|
|
645
|
+
itemMarkHeight: 12,
|
|
646
|
+
padding: { bottom: 20 }
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
sx: {
|
|
650
|
+
"& .MuiChartsAxis-line": { stroke: chart.axisFg },
|
|
651
|
+
"& .MuiChartsAxis-tick": { stroke: chart.axisFg },
|
|
652
|
+
"& .MuiChartsAxis-tickLabel": {
|
|
653
|
+
fill: chart.labelFg,
|
|
654
|
+
fontFamily: theme.typography.fontFamily,
|
|
655
|
+
fontSize: typeof theme.typography.body2.fontSize === "number" ? theme.typography.body2.fontSize : 12
|
|
656
|
+
},
|
|
657
|
+
"& .MuiChartsAxis-label": {
|
|
658
|
+
fill: chart.labelFgEmphasis,
|
|
659
|
+
fontFamily: theme.typography.fontFamily,
|
|
660
|
+
fontSize: typeof theme.typography.body1.fontSize === "number" ? theme.typography.body1.fontSize : 14,
|
|
661
|
+
fontWeight: theme.typography.fontWeightMedium
|
|
662
|
+
},
|
|
663
|
+
"& .MuiChartsGrid-line": {
|
|
664
|
+
stroke: chart.gridlineFg,
|
|
665
|
+
strokeDasharray: "4 4"
|
|
666
|
+
},
|
|
667
|
+
"& .MuiChartsLegend-series text": {
|
|
668
|
+
fill: chart.legendFg,
|
|
669
|
+
fontFamily: theme.typography.fontFamily,
|
|
670
|
+
fontSize: "14px !important"
|
|
671
|
+
},
|
|
672
|
+
"& .MuiChartsLegend-mark": {
|
|
673
|
+
ry: 4,
|
|
674
|
+
rx: 4,
|
|
675
|
+
width: 12,
|
|
676
|
+
height: 12
|
|
677
|
+
},
|
|
678
|
+
"& .MuiChartsTooltip-root": {
|
|
679
|
+
fontFamily: theme.typography.fontFamily,
|
|
680
|
+
fontSize: typeof theme.typography.body1.fontSize === "number" ? theme.typography.body1.fontSize : 14
|
|
681
|
+
},
|
|
682
|
+
"& .MuiChartsTooltip-table": {
|
|
683
|
+
backgroundColor: chart.tooltipBg,
|
|
684
|
+
color: chart.tooltipFg,
|
|
685
|
+
borderRadius: theme.shape.borderRadius,
|
|
686
|
+
boxShadow: theme.shadows[4]
|
|
687
|
+
},
|
|
688
|
+
"& .MuiLineElement-root": {
|
|
689
|
+
strokeWidth: 3
|
|
690
|
+
// Thicker lines for line charts
|
|
691
|
+
},
|
|
692
|
+
...(_b = props.sx) != null ? _b : {}
|
|
693
|
+
},
|
|
694
|
+
...props
|
|
695
|
+
}
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
function BarChart({ series, colors: colors2, palette = "categorical", ...props }) {
|
|
699
|
+
var _a, _b;
|
|
700
|
+
const theme = useTheme();
|
|
701
|
+
const chart = theme.palette.chart;
|
|
702
|
+
const seriesColors = useChartColors((_a = series == null ? void 0 : series.length) != null ? _a : 0, palette);
|
|
703
|
+
const resolvedColors = colors2 != null ? colors2 : seriesColors;
|
|
704
|
+
const modifiedSeries = series == null ? void 0 : series.map((s, idx) => {
|
|
705
|
+
var _a2;
|
|
706
|
+
const baseColor = s.color || resolvedColors[idx % resolvedColors.length];
|
|
707
|
+
const actualColor = s.variant === "striped" ? `url(#striped-pattern-${idx})` : baseColor;
|
|
708
|
+
const { variant, ...rest } = s;
|
|
709
|
+
return {
|
|
710
|
+
...rest,
|
|
711
|
+
color: actualColor,
|
|
712
|
+
highlightScope: (_a2 = s.highlightScope) != null ? _a2 : { highlighted: "item", faded: "global" }
|
|
713
|
+
};
|
|
714
|
+
});
|
|
715
|
+
return /* @__PURE__ */ jsx(
|
|
716
|
+
BarChart$1,
|
|
717
|
+
{
|
|
718
|
+
series: modifiedSeries != null ? modifiedSeries : [],
|
|
719
|
+
colors: colors2 != null ? colors2 : seriesColors,
|
|
720
|
+
grid: { horizontal: true },
|
|
721
|
+
borderRadius: 4,
|
|
722
|
+
slots: {
|
|
723
|
+
axisContent: CustomTooltip
|
|
724
|
+
},
|
|
725
|
+
slotProps: {
|
|
726
|
+
legend: {
|
|
727
|
+
itemMarkWidth: 12,
|
|
728
|
+
itemMarkHeight: 12,
|
|
729
|
+
padding: { bottom: 20 }
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
sx: {
|
|
733
|
+
"& .MuiChartsAxis-line": { stroke: chart.axisFg },
|
|
734
|
+
"& .MuiChartsAxis-tick": { stroke: chart.axisFg },
|
|
735
|
+
"& .MuiChartsAxis-tickLabel": {
|
|
736
|
+
fill: chart.labelFg,
|
|
737
|
+
fontFamily: theme.typography.fontFamily,
|
|
738
|
+
fontSize: typeof theme.typography.body2.fontSize === "number" ? theme.typography.body2.fontSize : 12
|
|
739
|
+
// fallback to xs value conceptually if needed
|
|
740
|
+
},
|
|
741
|
+
"& .MuiChartsAxis-label": {
|
|
742
|
+
fill: chart.labelFgEmphasis,
|
|
743
|
+
fontFamily: theme.typography.fontFamily,
|
|
744
|
+
fontSize: typeof theme.typography.body1.fontSize === "number" ? theme.typography.body1.fontSize : 14,
|
|
745
|
+
fontWeight: theme.typography.fontWeightMedium
|
|
746
|
+
},
|
|
747
|
+
"& .MuiChartsGrid-line": {
|
|
748
|
+
stroke: chart.gridlineFg,
|
|
749
|
+
strokeDasharray: "4 4"
|
|
750
|
+
},
|
|
751
|
+
"& .MuiChartsLegend-series text": {
|
|
752
|
+
fill: chart.legendFg,
|
|
753
|
+
fontFamily: theme.typography.fontFamily,
|
|
754
|
+
fontSize: "14px !important"
|
|
755
|
+
},
|
|
756
|
+
"& .MuiChartsLegend-mark": {
|
|
757
|
+
ry: 4,
|
|
758
|
+
rx: 4,
|
|
759
|
+
width: 12,
|
|
760
|
+
height: 12
|
|
761
|
+
},
|
|
762
|
+
"& .MuiChartsTooltip-root": {
|
|
763
|
+
fontFamily: theme.typography.fontFamily,
|
|
764
|
+
fontSize: typeof theme.typography.body1.fontSize === "number" ? theme.typography.body1.fontSize : 14
|
|
765
|
+
},
|
|
766
|
+
"& .MuiChartsTooltip-table": {
|
|
767
|
+
backgroundColor: chart.tooltipBg,
|
|
768
|
+
color: chart.tooltipFg,
|
|
769
|
+
borderRadius: theme.shape.borderRadius,
|
|
770
|
+
boxShadow: theme.shadows[4]
|
|
771
|
+
// md equivalent in MUI default array length
|
|
772
|
+
},
|
|
773
|
+
...(_b = props.sx) != null ? _b : {}
|
|
774
|
+
},
|
|
775
|
+
...props,
|
|
776
|
+
children: /* @__PURE__ */ jsx("defs", { children: series == null ? void 0 : series.map((s, idx) => {
|
|
777
|
+
if (s.variant !== "striped") return null;
|
|
778
|
+
const baseColor = s.color || resolvedColors[idx % resolvedColors.length];
|
|
779
|
+
return /* @__PURE__ */ jsxs(
|
|
780
|
+
"pattern",
|
|
781
|
+
{
|
|
782
|
+
id: `striped-pattern-${idx}`,
|
|
783
|
+
patternUnits: "userSpaceOnUse",
|
|
784
|
+
width: "8",
|
|
785
|
+
height: "8",
|
|
786
|
+
patternTransform: "rotate(45)",
|
|
787
|
+
children: [
|
|
788
|
+
/* @__PURE__ */ jsx("rect", { width: "8", height: "8", fill: theme.palette.background.paper }),
|
|
789
|
+
/* @__PURE__ */ jsx("line", { x1: "0", y: "0", x2: "0", y2: "8", stroke: baseColor, strokeWidth: "4" })
|
|
790
|
+
]
|
|
791
|
+
},
|
|
792
|
+
`striped-${idx}`
|
|
793
|
+
);
|
|
794
|
+
}) })
|
|
795
|
+
}
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
function PieChart({ series, colors: colors2, palette = "categorical", ...props }) {
|
|
799
|
+
var _a, _b, _c, _d;
|
|
800
|
+
const theme = useTheme();
|
|
801
|
+
const chart = theme.palette.chart;
|
|
802
|
+
const sliceCount = (_c = (_b = (_a = series == null ? void 0 : series[0]) == null ? void 0 : _a.data) == null ? void 0 : _b.length) != null ? _c : 0;
|
|
803
|
+
const seriesColors = useChartColors(sliceCount, palette);
|
|
804
|
+
const modifiedSeries = series == null ? void 0 : series.map((s) => {
|
|
805
|
+
var _a2;
|
|
806
|
+
return {
|
|
807
|
+
...s,
|
|
808
|
+
highlightScope: (_a2 = s.highlightScope) != null ? _a2 : { highlighted: "item", faded: "global" }
|
|
809
|
+
};
|
|
810
|
+
});
|
|
811
|
+
return /* @__PURE__ */ jsx(
|
|
812
|
+
PieChart$1,
|
|
813
|
+
{
|
|
814
|
+
series: modifiedSeries != null ? modifiedSeries : [],
|
|
815
|
+
colors: colors2 != null ? colors2 : seriesColors,
|
|
816
|
+
slotProps: {
|
|
817
|
+
legend: {
|
|
818
|
+
itemMarkWidth: 12,
|
|
819
|
+
itemMarkHeight: 12,
|
|
820
|
+
padding: { bottom: 20 }
|
|
821
|
+
}
|
|
822
|
+
},
|
|
823
|
+
sx: {
|
|
824
|
+
"& .MuiChartsLegend-series text": {
|
|
825
|
+
fill: chart.legendFg,
|
|
826
|
+
fontFamily: theme.typography.fontFamily,
|
|
827
|
+
fontSize: "14px !important"
|
|
828
|
+
},
|
|
829
|
+
"& .MuiChartsLegend-mark": {
|
|
830
|
+
ry: 4,
|
|
831
|
+
rx: 4,
|
|
832
|
+
width: 12,
|
|
833
|
+
height: 12
|
|
834
|
+
},
|
|
835
|
+
"& .MuiChartsTooltip-root": {
|
|
836
|
+
fontFamily: theme.typography.fontFamily,
|
|
837
|
+
fontSize: typeof theme.typography.body1.fontSize === "number" ? theme.typography.body1.fontSize : 14
|
|
838
|
+
},
|
|
839
|
+
"& .MuiChartsTooltip-table": {
|
|
840
|
+
backgroundColor: chart.tooltipBg,
|
|
841
|
+
color: chart.tooltipFg,
|
|
842
|
+
borderRadius: theme.shape.borderRadius,
|
|
843
|
+
boxShadow: theme.shadows[4]
|
|
844
|
+
},
|
|
845
|
+
...(_d = props.sx) != null ? _d : {}
|
|
846
|
+
},
|
|
847
|
+
...props
|
|
848
|
+
}
|
|
849
|
+
);
|
|
850
|
+
}
|
|
272
851
|
|
|
273
|
-
export { Accordion, AccordionActions, AccordionDetails, AccordionSummary, Alert, AlertTitle, AppBar, Autocomplete, Backdrop, Badge, Button, ButtonGroup, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Chip, CircularProgress, DataGrid, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Divider, Fab, ForestProvider, LinearProgress, List, ListItem, ListItemAvatar, ListItemButton, ListItemIcon, ListItemText, ListSubheader, MenuItem, Paper, Radio, RadioGroup, Select, Skeleton, Snackbar, Switch, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, ToggleButton, ToggleButtonGroup, Toolbar, Tooltip, Typography };
|
|
852
|
+
export { Accordion, AccordionActions, AccordionDetails, AccordionSummary, Alert, AlertTitle, AppBar, Autocomplete, Backdrop, Badge, BarChart, Button, ButtonGroup, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Chip, CircularProgress, DataGrid, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Divider, Fab, ForestProvider, LineChart, LinearProgress, List, ListItem, ListItemAvatar, ListItemButton, ListItemIcon, ListItemText, ListSubheader, MenuItem, MultiSelect, Paper, PieChart, Radio, RadioGroup, Select, SidebarItem, SidebarNav, Skeleton, Snackbar, Switch, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, ToggleButton, ToggleButtonGroup, Toolbar, Tooltip, Typography, useChartColors, useSidebar };
|
|
274
853
|
//# sourceMappingURL=index.mjs.map
|
|
275
854
|
//# sourceMappingURL=index.mjs.map
|