@cere/cere-design-system 0.0.15 → 0.0.17

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
@@ -3431,11 +3431,11 @@ SideNav.displayName = "SideNav";
3431
3431
 
3432
3432
  // src/components/navigation/SideNav/SideNavHeader.tsx
3433
3433
  import React4 from "react";
3434
- import { Box as Box5, Typography as Typography4, IconButton as IconButton4, Tooltip as Tooltip2 } from "@mui/material";
3434
+ import { Box as Box5, Typography as Typography4, IconButton as IconButton4, Tooltip as Tooltip2, ButtonBase } from "@mui/material";
3435
3435
  import { styled as styled12 } from "@mui/material/styles";
3436
3436
  import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
3437
3437
  import ChevronRightIcon from "@mui/icons-material/ChevronRight";
3438
- import { jsx as jsx22, jsxs as jsxs8 } from "react/jsx-runtime";
3438
+ import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs8 } from "react/jsx-runtime";
3439
3439
  var HeaderContainer = styled12(Box5, {
3440
3440
  shouldForwardProp: (prop) => prop !== "isCollapsed"
3441
3441
  })(({ theme: theme2, isCollapsed }) => ({
@@ -3450,15 +3450,60 @@ var HeaderContainer = styled12(Box5, {
3450
3450
  duration: theme2.transitions.duration.shorter
3451
3451
  })
3452
3452
  }));
3453
+ var BrandingButton = styled12(ButtonBase)(({ theme: theme2 }) => ({
3454
+ display: "flex",
3455
+ alignItems: "center",
3456
+ gap: theme2.spacing(1.5),
3457
+ minWidth: 0,
3458
+ padding: 0,
3459
+ borderRadius: theme2.shape.borderRadius,
3460
+ // Subtle hover feedback only when clickable
3461
+ "&:hover": {
3462
+ opacity: 0.8
3463
+ },
3464
+ "&:focus-visible": {
3465
+ outline: `2px solid ${theme2.palette.primary.main}`,
3466
+ outlineOffset: 2
3467
+ }
3468
+ }));
3453
3469
  var SideNavHeader = React4.memo(({
3454
3470
  logo,
3455
3471
  title,
3456
3472
  showCollapseButton = true,
3457
3473
  onCollapse,
3474
+ onLogoClick,
3458
3475
  ariaLabel,
3459
3476
  collapsed = false
3460
3477
  }) => {
3461
3478
  const headerAriaLabel = ariaLabel || `${title} navigation header`;
3479
+ const brandingContent = /* @__PURE__ */ jsxs8(Fragment4, { children: [
3480
+ logo && /* @__PURE__ */ jsx22(
3481
+ Box5,
3482
+ {
3483
+ sx: {
3484
+ display: "flex",
3485
+ alignItems: "center",
3486
+ justifyContent: "center",
3487
+ flexShrink: 0
3488
+ },
3489
+ children: logo
3490
+ }
3491
+ ),
3492
+ !collapsed && /* @__PURE__ */ jsx22(
3493
+ Typography4,
3494
+ {
3495
+ variant: "subtitle1",
3496
+ sx: {
3497
+ fontWeight: 700,
3498
+ overflow: "hidden",
3499
+ textOverflow: "ellipsis",
3500
+ whiteSpace: "nowrap",
3501
+ minWidth: 0
3502
+ },
3503
+ children: title
3504
+ }
3505
+ )
3506
+ ] });
3462
3507
  return /* @__PURE__ */ jsxs8(
3463
3508
  HeaderContainer,
3464
3509
  {
@@ -3466,31 +3511,24 @@ var SideNavHeader = React4.memo(({
3466
3511
  "aria-label": headerAriaLabel,
3467
3512
  isCollapsed: collapsed,
3468
3513
  children: [
3469
- logo && /* @__PURE__ */ jsx22(
3514
+ onLogoClick ? /* @__PURE__ */ jsx22(
3515
+ BrandingButton,
3516
+ {
3517
+ onClick: onLogoClick,
3518
+ "aria-label": `Go to ${title} home`,
3519
+ "data-testid": "sidenav-home-link",
3520
+ children: brandingContent
3521
+ }
3522
+ ) : /* @__PURE__ */ jsx22(
3470
3523
  Box5,
3471
3524
  {
3472
3525
  sx: {
3473
3526
  display: "flex",
3474
3527
  alignItems: "center",
3475
- justifyContent: "center",
3476
- flexShrink: 0
3477
- },
3478
- children: logo
3479
- }
3480
- ),
3481
- !collapsed && /* @__PURE__ */ jsx22(
3482
- Typography4,
3483
- {
3484
- variant: "subtitle1",
3485
- sx: {
3486
- flexGrow: 1,
3487
- fontWeight: 700,
3488
- overflow: "hidden",
3489
- textOverflow: "ellipsis",
3490
- whiteSpace: "nowrap",
3528
+ gap: 1.5,
3491
3529
  minWidth: 0
3492
3530
  },
3493
- children: title
3531
+ children: brandingContent
3494
3532
  }
3495
3533
  ),
3496
3534
  showCollapseButton && /* @__PURE__ */ jsx22(
@@ -3508,6 +3546,7 @@ var SideNavHeader = React4.memo(({
3508
3546
  size: "small",
3509
3547
  sx: {
3510
3548
  flexShrink: 0,
3549
+ marginLeft: collapsed ? 0 : "auto",
3511
3550
  color: "text.secondary",
3512
3551
  "&:hover": {
3513
3552
  backgroundColor: "action.hover",
@@ -4246,7 +4285,7 @@ import {
4246
4285
  Divider
4247
4286
  } from "@mui/material";
4248
4287
  import { styled as styled21 } from "@mui/material/styles";
4249
- import { Fragment as Fragment4, jsx as jsx32, jsxs as jsxs12 } from "react/jsx-runtime";
4288
+ import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs12 } from "react/jsx-runtime";
4250
4289
  var StyledMenu = styled21(MuiMenu)({
4251
4290
  "& .MuiPaper-root": {
4252
4291
  borderRadius: 8,
@@ -4287,7 +4326,7 @@ var MenuItem = ({
4287
4326
  disabled = false,
4288
4327
  divider = false
4289
4328
  }) => {
4290
- return /* @__PURE__ */ jsxs12(Fragment4, { children: [
4329
+ return /* @__PURE__ */ jsxs12(Fragment5, { children: [
4291
4330
  /* @__PURE__ */ jsxs12(MuiMenuItem, { onClick, disabled, children: [
4292
4331
  icon && /* @__PURE__ */ jsx32(ListItemIcon3, { children: icon }),
4293
4332
  /* @__PURE__ */ jsx32(ListItemText5, { children: label })
@@ -4351,7 +4390,7 @@ var Link3 = ({ underline = "hover", ...props }) => {
4351
4390
  };
4352
4391
 
4353
4392
  // src/components/navigation/Selector.tsx
4354
- import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs13 } from "react/jsx-runtime";
4393
+ import { Fragment as Fragment6, jsx as jsx35, jsxs as jsxs13 } from "react/jsx-runtime";
4355
4394
  var Selector = ({
4356
4395
  options: options2,
4357
4396
  selectedId,
@@ -4388,7 +4427,7 @@ var Selector = ({
4388
4427
  /* @__PURE__ */ jsx35(Typography7, { variant: "body2", children: option.name })
4389
4428
  ] });
4390
4429
  if (compact) {
4391
- return /* @__PURE__ */ jsxs13(Fragment5, { children: [
4430
+ return /* @__PURE__ */ jsxs13(Fragment6, { children: [
4392
4431
  /* @__PURE__ */ jsx35(IconButton, { onClick: handleOpen, size: "small", children: selectedOption ? selectedOption.avatar ? /* @__PURE__ */ jsx35(Avatar4, { src: selectedOption.avatar, sx: { width: 32, height: 32 } }) : /* @__PURE__ */ jsx35(Avatar4, { sx: { width: 32, height: 32, bgcolor: colors.primary.main }, children: selectedOption.name.charAt(0) }) : /* @__PURE__ */ jsx35(Avatar4, { sx: { width: 32, height: 32, bgcolor: colors.grey[400] }, children: "?" }) }),
4393
4432
  /* @__PURE__ */ jsx35(
4394
4433
  Menu4,
@@ -4399,7 +4438,7 @@ var Selector = ({
4399
4438
  PaperProps: {
4400
4439
  sx: { width, maxHeight: 600, mt: 1 }
4401
4440
  },
4402
- children: loading ? /* @__PURE__ */ jsx35(Box9, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ jsx35(CircularProgress2, { size: 24 }) }) : /* @__PURE__ */ jsxs13(Fragment5, { children: [
4441
+ children: loading ? /* @__PURE__ */ jsx35(Box9, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ jsx35(CircularProgress2, { size: 24 }) }) : /* @__PURE__ */ jsxs13(Fragment6, { children: [
4403
4442
  options2.length > 5 && /* @__PURE__ */ jsx35(Box9, { sx: { p: 1, borderBottom: `1px solid ${colors.grey[200]}` }, children: /* @__PURE__ */ jsx35(
4404
4443
  TextField,
4405
4444
  {
@@ -4446,7 +4485,7 @@ var Selector = ({
4446
4485
  )
4447
4486
  ] });
4448
4487
  }
4449
- return /* @__PURE__ */ jsxs13(Fragment5, { children: [
4488
+ return /* @__PURE__ */ jsxs13(Fragment6, { children: [
4450
4489
  /* @__PURE__ */ jsxs13(Box9, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
4451
4490
  selectedOption ? renderSelected ? /* @__PURE__ */ jsx35(Link3, { onClick: handleOpen, underline: "hover", children: renderSelected(selectedOption) }) : /* @__PURE__ */ jsx35(Link3, { onClick: handleOpen, underline: "hover", children: defaultRenderSelected(selectedOption) }) : /* @__PURE__ */ jsx35(Typography7, { variant: "body2", color: "text.secondary", children: placeholder }),
4452
4491
  /* @__PURE__ */ jsx35(IconButton, { onClick: handleOpen, size: "small", sx: { p: 0.2, ml: 0.5 }, children: /* @__PURE__ */ jsx35(KeyboardArrowDownIcon3, { fontSize: "small" }) })
@@ -4460,7 +4499,7 @@ var Selector = ({
4460
4499
  PaperProps: {
4461
4500
  sx: { width, maxHeight: 600, mt: 1 }
4462
4501
  },
4463
- children: loading ? /* @__PURE__ */ jsx35(Box9, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ jsx35(CircularProgress2, { size: 24 }) }) : /* @__PURE__ */ jsxs13(Fragment5, { children: [
4502
+ children: loading ? /* @__PURE__ */ jsx35(Box9, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ jsx35(CircularProgress2, { size: 24 }) }) : /* @__PURE__ */ jsxs13(Fragment6, { children: [
4464
4503
  options2.length > 5 && /* @__PURE__ */ jsx35(Box9, { sx: { p: 1, borderBottom: `1px solid ${colors.grey[200]}` }, children: /* @__PURE__ */ jsx35(
4465
4504
  TextField,
4466
4505
  {
@@ -4557,7 +4596,7 @@ import {
4557
4596
  CircularProgress as CircularProgress3
4558
4597
  } from "@mui/material";
4559
4598
  import CloseIcon from "@mui/icons-material/Close";
4560
- import { Fragment as Fragment6, jsx as jsx38, jsxs as jsxs16 } from "react/jsx-runtime";
4599
+ import { Fragment as Fragment7, jsx as jsx38, jsxs as jsxs16 } from "react/jsx-runtime";
4561
4600
  var Dialog = ({
4562
4601
  open,
4563
4602
  title,
@@ -4616,9 +4655,9 @@ var Dialog = ({
4616
4655
  ] }),
4617
4656
  dividers && /* @__PURE__ */ jsx38(Divider2, {}),
4618
4657
  /* @__PURE__ */ jsx38(DialogContent, { dividers, children }),
4619
- (showActions || customActions) && /* @__PURE__ */ jsxs16(Fragment6, { children: [
4658
+ (showActions || customActions) && /* @__PURE__ */ jsxs16(Fragment7, { children: [
4620
4659
  dividers && /* @__PURE__ */ jsx38(Divider2, {}),
4621
- /* @__PURE__ */ jsx38(DialogActions, { children: customActions || /* @__PURE__ */ jsxs16(Fragment6, { children: [
4660
+ /* @__PURE__ */ jsx38(DialogActions, { children: customActions || /* @__PURE__ */ jsxs16(Fragment7, { children: [
4622
4661
  /* @__PURE__ */ jsx38(
4623
4662
  Button6,
4624
4663
  {
@@ -4650,7 +4689,7 @@ import MuiDrawer from "@mui/material/Drawer";
4650
4689
  import { styled as styled25 } from "@mui/material/styles";
4651
4690
  import { Box as Box11, IconButton as IconButton7, Typography as Typography9, Divider as Divider3, Tabs, Tab as Tab2 } from "@mui/material";
4652
4691
  import CloseIcon2 from "@mui/icons-material/Close";
4653
- import { Fragment as Fragment7, jsx as jsx39, jsxs as jsxs17 } from "react/jsx-runtime";
4692
+ import { Fragment as Fragment8, jsx as jsx39, jsxs as jsxs17 } from "react/jsx-runtime";
4654
4693
  var StyledDrawer2 = styled25(MuiDrawer, {
4655
4694
  shouldForwardProp: (prop) => prop !== "width" && prop !== "miniWidth" && prop !== "collapsed" && prop !== "topOffset"
4656
4695
  })(({ theme: theme2, width = 240, miniWidth = 72, collapsed, topOffset = 0 }) => ({
@@ -4722,7 +4761,7 @@ var Drawer2 = ({
4722
4761
  },
4723
4762
  ...props,
4724
4763
  children: [
4725
- hasHeader && /* @__PURE__ */ jsxs17(Fragment7, { children: [
4764
+ hasHeader && /* @__PURE__ */ jsxs17(Fragment8, { children: [
4726
4765
  /* @__PURE__ */ jsx39(
4727
4766
  Box11,
4728
4767
  {
@@ -4735,7 +4774,7 @@ var Drawer2 = ({
4735
4774
  borderBottom: 1,
4736
4775
  borderColor: "divider"
4737
4776
  },
4738
- children: header || /* @__PURE__ */ jsxs17(Fragment7, { children: [
4777
+ children: header || /* @__PURE__ */ jsxs17(Fragment8, { children: [
4739
4778
  /* @__PURE__ */ jsx39(Box11, { sx: { flex: 1 }, children: typeof title === "string" ? /* @__PURE__ */ jsx39(Typography9, { variant: "h6", children: title }) : title }),
4740
4779
  shouldShowClose && onClose && /* @__PURE__ */ jsx39(
4741
4780
  IconButton7,
@@ -4785,7 +4824,7 @@ var Drawer2 = ({
4785
4824
  children
4786
4825
  }
4787
4826
  ),
4788
- footer && /* @__PURE__ */ jsxs17(Fragment7, { children: [
4827
+ footer && /* @__PURE__ */ jsxs17(Fragment8, { children: [
4789
4828
  /* @__PURE__ */ jsx39(Divider3, {}),
4790
4829
  /* @__PURE__ */ jsx39(
4791
4830
  Box11,
@@ -5987,9 +6026,9 @@ var Truncate = ({
5987
6026
 
5988
6027
  // src/components/utilities/BytesSize/BytesSize.tsx
5989
6028
  import size from "byte-size";
5990
- import { Fragment as Fragment8, jsx as jsx75 } from "react/jsx-runtime";
6029
+ import { Fragment as Fragment9, jsx as jsx75 } from "react/jsx-runtime";
5991
6030
  var BytesSize = ({ bytes }) => {
5992
- return /* @__PURE__ */ jsx75(Fragment8, { children: size(bytes).toString() });
6031
+ return /* @__PURE__ */ jsx75(Fragment9, { children: size(bytes).toString() });
5993
6032
  };
5994
6033
 
5995
6034
  // src/components/utilities/QRCode/QRCode.tsx