@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.d.mts CHANGED
@@ -749,6 +749,12 @@ interface SideNavHeaderProps {
749
749
  * Wire this up to toggle sidebar expanded/collapsed state (V2).
750
750
  */
751
751
  onCollapse?: () => void;
752
+ /**
753
+ * Callback fired when the logo/title branding area is clicked.
754
+ * Use this for "go to home" navigation. Only the logo + title region
755
+ * is clickable — the collapse button and surrounding padding are excluded.
756
+ */
757
+ onLogoClick?: () => void;
752
758
  /**
753
759
  * Accessibility label for the header region
754
760
  * @default '{title} navigation header'
@@ -823,7 +829,11 @@ declare const SideNav: SideNavComponent;
823
829
  *
824
830
  * Renders the app branding area at the top of the side navigation.
825
831
  * Includes an optional logo, a title, and an optional collapse toggle button.
826
- * V2: In collapsed state, shows logo stacked vertically above toggle button
832
+ * V2: In collapsed state, shows logo stacked vertically above toggle button.
833
+ *
834
+ * If `onLogoClick` is provided, only the logo+title area is clickable
835
+ * (e.g. to navigate back to the home page). The rest of the header
836
+ * (collapse button, surrounding padding) does NOT trigger that callback.
827
837
  */
828
838
  declare const SideNavHeader: React__default.NamedExoticComponent<SideNavHeaderProps>;
829
839
 
package/dist/index.d.ts CHANGED
@@ -749,6 +749,12 @@ interface SideNavHeaderProps {
749
749
  * Wire this up to toggle sidebar expanded/collapsed state (V2).
750
750
  */
751
751
  onCollapse?: () => void;
752
+ /**
753
+ * Callback fired when the logo/title branding area is clicked.
754
+ * Use this for "go to home" navigation. Only the logo + title region
755
+ * is clickable — the collapse button and surrounding padding are excluded.
756
+ */
757
+ onLogoClick?: () => void;
752
758
  /**
753
759
  * Accessibility label for the header region
754
760
  * @default '{title} navigation header'
@@ -823,7 +829,11 @@ declare const SideNav: SideNavComponent;
823
829
  *
824
830
  * Renders the app branding area at the top of the side navigation.
825
831
  * Includes an optional logo, a title, and an optional collapse toggle button.
826
- * V2: In collapsed state, shows logo stacked vertically above toggle button
832
+ * V2: In collapsed state, shows logo stacked vertically above toggle button.
833
+ *
834
+ * If `onLogoClick` is provided, only the logo+title area is clickable
835
+ * (e.g. to navigate back to the home page). The rest of the header
836
+ * (collapse button, surrounding padding) does NOT trigger that callback.
827
837
  */
828
838
  declare const SideNavHeader: React__default.NamedExoticComponent<SideNavHeaderProps>;
829
839
 
package/dist/index.js CHANGED
@@ -3549,15 +3549,60 @@ var HeaderContainer = (0, import_styles11.styled)(import_material14.Box, {
3549
3549
  duration: theme2.transitions.duration.shorter
3550
3550
  })
3551
3551
  }));
3552
+ var BrandingButton = (0, import_styles11.styled)(import_material14.ButtonBase)(({ theme: theme2 }) => ({
3553
+ display: "flex",
3554
+ alignItems: "center",
3555
+ gap: theme2.spacing(1.5),
3556
+ minWidth: 0,
3557
+ padding: 0,
3558
+ borderRadius: theme2.shape.borderRadius,
3559
+ // Subtle hover feedback only when clickable
3560
+ "&:hover": {
3561
+ opacity: 0.8
3562
+ },
3563
+ "&:focus-visible": {
3564
+ outline: `2px solid ${theme2.palette.primary.main}`,
3565
+ outlineOffset: 2
3566
+ }
3567
+ }));
3552
3568
  var SideNavHeader = import_react7.default.memo(({
3553
3569
  logo,
3554
3570
  title,
3555
3571
  showCollapseButton = true,
3556
3572
  onCollapse,
3573
+ onLogoClick,
3557
3574
  ariaLabel,
3558
3575
  collapsed = false
3559
3576
  }) => {
3560
3577
  const headerAriaLabel = ariaLabel || `${title} navigation header`;
3578
+ const brandingContent = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
3579
+ logo && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3580
+ import_material14.Box,
3581
+ {
3582
+ sx: {
3583
+ display: "flex",
3584
+ alignItems: "center",
3585
+ justifyContent: "center",
3586
+ flexShrink: 0
3587
+ },
3588
+ children: logo
3589
+ }
3590
+ ),
3591
+ !collapsed && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3592
+ import_material14.Typography,
3593
+ {
3594
+ variant: "subtitle1",
3595
+ sx: {
3596
+ fontWeight: 700,
3597
+ overflow: "hidden",
3598
+ textOverflow: "ellipsis",
3599
+ whiteSpace: "nowrap",
3600
+ minWidth: 0
3601
+ },
3602
+ children: title
3603
+ }
3604
+ )
3605
+ ] });
3561
3606
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3562
3607
  HeaderContainer,
3563
3608
  {
@@ -3565,31 +3610,24 @@ var SideNavHeader = import_react7.default.memo(({
3565
3610
  "aria-label": headerAriaLabel,
3566
3611
  isCollapsed: collapsed,
3567
3612
  children: [
3568
- logo && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3613
+ onLogoClick ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3614
+ BrandingButton,
3615
+ {
3616
+ onClick: onLogoClick,
3617
+ "aria-label": `Go to ${title} home`,
3618
+ "data-testid": "sidenav-home-link",
3619
+ children: brandingContent
3620
+ }
3621
+ ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3569
3622
  import_material14.Box,
3570
3623
  {
3571
3624
  sx: {
3572
3625
  display: "flex",
3573
3626
  alignItems: "center",
3574
- justifyContent: "center",
3575
- flexShrink: 0
3576
- },
3577
- children: logo
3578
- }
3579
- ),
3580
- !collapsed && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3581
- import_material14.Typography,
3582
- {
3583
- variant: "subtitle1",
3584
- sx: {
3585
- flexGrow: 1,
3586
- fontWeight: 700,
3587
- overflow: "hidden",
3588
- textOverflow: "ellipsis",
3589
- whiteSpace: "nowrap",
3627
+ gap: 1.5,
3590
3628
  minWidth: 0
3591
3629
  },
3592
- children: title
3630
+ children: brandingContent
3593
3631
  }
3594
3632
  ),
3595
3633
  showCollapseButton && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
@@ -3607,6 +3645,7 @@ var SideNavHeader = import_react7.default.memo(({
3607
3645
  size: "small",
3608
3646
  sx: {
3609
3647
  flexShrink: 0,
3648
+ marginLeft: collapsed ? 0 : "auto",
3610
3649
  color: "text.secondary",
3611
3650
  "&:hover": {
3612
3651
  backgroundColor: "action.hover",