@matteoaliano/forest-ui 0.3.6 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { bg, navColors, text, forestTheme, getPreset, buildTheme, lineHeight, fontSize } from './chunk-G2ZXCZKP.mjs';
2
- export { alpha, avatarColors, base, bg, border, breadcrumbColors, buildTheme, buildThemeOptions, buttonColors, chartColors, container, display, error, fg, focusRings, fontFamily, fontSize, fontWeight, forestAgencyPreset, forestExternalPreset, forestInternalPreset, forestTheme, forestThemeOptions, getAvailablePresets, getPreset, iconColors, info, lineHeight, navColors, radius, registerPreset, sliderColors, spacing, success, text, toggleColors, shadows as tokenShadows, warning, widths } from './chunk-G2ZXCZKP.mjs';
1
+ import { misc, bg, navColors, text, forestTheme, getPreset, buildTheme, lineHeight, fontSize } from './chunk-IWYN6REP.mjs';
2
+ export { alpha, avatarColors, base, bg, border, breadcrumbColors, buildTheme, buildThemeOptions, buttonColors, chartColors, container, display, error, fg, focusRings, fontFamily, fontFamilyMono, fontSize, fontWeight, forestAgencyPreset, forestExternalPreset, forestInternalPreset, forestTheme, forestThemeOptions, getAvailablePresets, getPreset, iconColors, info, lineHeight, navColors, radius, registerPreset, sliderColors, spacing, success, text, toggleColors, shadows as tokenShadows, warning, widths } from './chunk-IWYN6REP.mjs';
3
3
  import React2, { forwardRef, createContext, useMemo, useState, useCallback, useContext } from 'react';
4
4
  import { ThemeProvider, useTheme } from '@mui/material/styles';
5
5
  import CssBaseline from '@mui/material/CssBaseline';
@@ -139,8 +139,16 @@ function RadioGroup(props) {
139
139
  function Radio(props) {
140
140
  return /* @__PURE__ */ jsx(MuiRadio, { ...props });
141
141
  }
142
- function Select(props) {
143
- return /* @__PURE__ */ jsx(MuiSelect, { ...props });
142
+ function Select({ onClose, ...props }) {
143
+ const handleClose = (e) => {
144
+ onClose == null ? void 0 : onClose(e);
145
+ setTimeout(() => {
146
+ if (document.activeElement instanceof HTMLElement) {
147
+ document.activeElement.blur();
148
+ }
149
+ });
150
+ };
151
+ return /* @__PURE__ */ jsx(MuiSelect, { onClose: handleClose, ...props });
144
152
  }
145
153
  function MenuItem(props) {
146
154
  return /* @__PURE__ */ jsx(MuiMenuItem, { ...props });
@@ -367,11 +375,47 @@ function Badge(props) {
367
375
  var CloseOutlined_default = createSvgIcon(/* @__PURE__ */ jsx("path", {
368
376
  d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
369
377
  }), "CloseOutlined");
370
- function Chip({ deleteIcon = /* @__PURE__ */ jsx(CloseOutlined_default, {}), ...props }) {
378
+ var customChipColors = {
379
+ teal: { bg: misc.teal[50], color: misc.teal[700], deleteIcon: misc.teal[400] },
380
+ orange: { bg: misc.orange[50], color: misc.orange[700], deleteIcon: misc.orange[400] },
381
+ purple: { bg: misc.purple[50], color: misc.purple[700], deleteIcon: misc.purple[400] },
382
+ pink: { bg: misc.pink[50], color: misc.pink[700], deleteIcon: misc.pink[400] },
383
+ fuchsia: { bg: misc.fuchsia[50], color: misc.fuchsia[700], deleteIcon: misc.fuchsia[400] },
384
+ orangeDark: { bg: misc.orangeDark[50], color: misc.orangeDark[700], deleteIcon: misc.orangeDark[400] },
385
+ green: { bg: misc.green[50], color: misc.green[700], deleteIcon: misc.green[400] },
386
+ indigo: { bg: misc.indigo[50], color: misc.indigo[700], deleteIcon: misc.indigo[400] },
387
+ rose: { bg: misc.rose[50], color: misc.rose[700], deleteIcon: misc.rose[400] },
388
+ blueLight: { bg: misc.blueLight[50], color: misc.blueLight[700], deleteIcon: misc.blueLight[400] }
389
+ };
390
+ function Chip({ color, deleteIcon = /* @__PURE__ */ jsx(CloseOutlined_default, {}), sx, ...props }) {
391
+ const custom = color && typeof color === "string" ? customChipColors[color] : void 0;
392
+ if (custom) {
393
+ return /* @__PURE__ */ jsx(
394
+ MuiChip,
395
+ {
396
+ deleteIcon,
397
+ ...props,
398
+ sx: [
399
+ {
400
+ "&.MuiChip-root": {
401
+ backgroundColor: custom.bg,
402
+ color: custom.color,
403
+ "& .MuiChip-deleteIcon": {
404
+ color: custom.deleteIcon
405
+ }
406
+ }
407
+ },
408
+ ...Array.isArray(sx) ? sx : [sx]
409
+ ]
410
+ }
411
+ );
412
+ }
371
413
  return /* @__PURE__ */ jsx(
372
414
  MuiChip,
373
415
  {
416
+ color,
374
417
  deleteIcon,
418
+ sx,
375
419
  ...props
376
420
  }
377
421
  );
@@ -445,8 +489,69 @@ function AppBar(props) {
445
489
  function Toolbar(props) {
446
490
  return /* @__PURE__ */ jsx(MuiToolbar, { ...props });
447
491
  }
448
- function Card(props) {
449
- return /* @__PURE__ */ jsx(MuiCard, { ...props });
492
+ function AppBarNavItem({
493
+ label,
494
+ icon,
495
+ selected = false,
496
+ href,
497
+ sx,
498
+ ...props
499
+ }) {
500
+ return /* @__PURE__ */ jsx(
501
+ MuiButton,
502
+ {
503
+ variant: "text",
504
+ href,
505
+ startIcon: icon,
506
+ disableElevation: true,
507
+ ...props,
508
+ sx: [
509
+ {
510
+ height: 32,
511
+ padding: "6px 12px",
512
+ fontSize: 14,
513
+ fontWeight: 500,
514
+ color: "action.active",
515
+ textTransform: "none",
516
+ boxShadow: "none",
517
+ "&:hover": {
518
+ backgroundColor: "action.hover",
519
+ color: "text.primary",
520
+ boxShadow: "none"
521
+ },
522
+ "&:focus-visible": {
523
+ boxShadow: "none"
524
+ },
525
+ "& .MuiButton-startIcon": {
526
+ marginRight: 0.5
527
+ }
528
+ },
529
+ selected && {
530
+ color: "primary.light",
531
+ fontWeight: 600,
532
+ "&:hover": {
533
+ backgroundColor: "action.selected",
534
+ color: "primary.light",
535
+ boxShadow: "none"
536
+ }
537
+ },
538
+ ...Array.isArray(sx) ? sx : [sx]
539
+ ],
540
+ children: label
541
+ }
542
+ );
543
+ }
544
+ function Card({ color = "primary", sx, ...props }) {
545
+ return /* @__PURE__ */ jsx(
546
+ MuiCard,
547
+ {
548
+ ...props,
549
+ sx: [
550
+ color === "secondary" && { backgroundColor: "background.paper" },
551
+ ...Array.isArray(sx) ? sx : [sx]
552
+ ]
553
+ }
554
+ );
450
555
  }
451
556
  function CardContent(props) {
452
557
  return /* @__PURE__ */ jsx(MuiCardContent, { ...props });
@@ -737,10 +842,7 @@ function CustomTooltip(props) {
737
842
  display: "flex",
738
843
  flexDirection: "column",
739
844
  gap: "12px",
740
- borderTop: `1px solid ${theme.palette.divider}`,
741
- borderRight: `1px solid ${theme.palette.divider}`,
742
- borderBottom: `1px solid ${theme.palette.divider}`,
743
- borderLeft: `4px solid ${theme.palette.chart.series[0].fg}`
845
+ border: `1px solid ${theme.palette.divider}`
744
846
  },
745
847
  children: [
746
848
  /* @__PURE__ */ jsx(
@@ -750,7 +852,8 @@ function CustomTooltip(props) {
750
852
  sx: {
751
853
  fontWeight: 600,
752
854
  color: theme.palette.text.primary,
753
- marginBottom: "4px"
855
+ paddingBottom: "12px",
856
+ borderBottom: `1px solid ${theme.palette.divider}`
754
857
  },
755
858
  children: formatDate(axisValue)
756
859
  }
@@ -1043,6 +1146,6 @@ function PieChart({ series, colors, ...props }) {
1043
1146
  );
1044
1147
  }
1045
1148
 
1046
- export { Accordion, AccordionActions, AccordionDetails, AccordionSummary, Alert, AlertTitle, AppBar, Autocomplete, Backdrop, Badge, BarChart, Breadcrumbs, Button, ButtonGroup, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Chip, CircularProgress, DataGrid, DatePicker, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Divider, Fab, ForestProvider, IconButton2 as IconButton, Input, LineChart, LinearProgress, Link, List, ListItem, ListItemAvatar, ListItemButton, ListItemIcon, ListItemText, ListSubheader, Logo, Menu, MenuItem, MenuList, Modal, MultiSelect, Pagination, Paper, PieChart, Popover, Radio, RadioGroup, Search, Select, SidebarItem, SidebarNav, Skeleton, Snackbar, Step, StepLabel, Stepper, Switch, Tab, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Tabs, TextField, ToggleButton, ToggleButtonGroup, Toolbar, Tooltip, Typography, useChartColors, useSidebar };
1149
+ export { Accordion, AccordionActions, AccordionDetails, AccordionSummary, Alert, AlertTitle, AppBar, AppBarNavItem, Autocomplete, Backdrop, Badge, BarChart, Breadcrumbs, Button, ButtonGroup, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Chip, CircularProgress, DataGrid, DatePicker, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, Divider, Fab, ForestProvider, IconButton2 as IconButton, Input, LineChart, LinearProgress, Link, List, ListItem, ListItemAvatar, ListItemButton, ListItemIcon, ListItemText, ListSubheader, Logo, Menu, MenuItem, MenuList, Modal, MultiSelect, Pagination, Paper, PieChart, Popover, Radio, RadioGroup, Search, Select, SidebarItem, SidebarNav, Skeleton, Snackbar, Step, StepLabel, Stepper, Switch, Tab, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Tabs, TextField, ToggleButton, ToggleButtonGroup, Toolbar, Tooltip, Typography, useChartColors, useSidebar };
1047
1150
  //# sourceMappingURL=index.mjs.map
1048
1151
  //# sourceMappingURL=index.mjs.map