@czi-sds/components 23.0.0 → 23.1.0

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.
@@ -1969,6 +1969,7 @@ interface NavigationHeaderPrimaryNavProps<T extends string> {
1969
1969
  onDrawerStateChange?: (isOpen: boolean) => void;
1970
1970
  topOffset?: number;
1971
1971
  onClose?: () => void;
1972
+ onDrawerStyleNavItemHover?: (item: NavigationHeaderPrimaryNavItem<T>) => void;
1972
1973
  }
1973
1974
  interface BaseNavigationHeaderSecondaryNavItem<T extends string> extends Record<string, unknown> {
1974
1975
  key: T;
@@ -2003,6 +2004,7 @@ interface NavigationHeaderSecondaryNavProps<T extends string> {
2003
2004
  onDrawerStateChange?: (isOpen: boolean) => void;
2004
2005
  topOffset?: number;
2005
2006
  onClose?: () => void;
2007
+ onDrawerStyleNavItemHover?: (item: NavigationHeaderSecondaryNavItem<T>) => void;
2006
2008
  }
2007
2009
  interface NavigationHeaderProps<T extends string = string> extends Omit<AppBarProps, "position"> {
2008
2010
  activePrimaryNavKey?: string;
@@ -2026,6 +2028,7 @@ interface NavigationHeaderProps<T extends string = string> extends Omit<AppBarPr
2026
2028
  setDrawerOpen?: (open: boolean) => void;
2027
2029
  menuProps?: Partial<MenuProps$0>;
2028
2030
  sdsStyle?: "dropdown" | "drawer";
2031
+ onDrawerStyleNavItemHover?: (item: NavigationHeaderPrimaryNavItem<T> | NavigationHeaderSecondaryNavItem<T>) => void;
2029
2032
  isSticky?: boolean;
2030
2033
  topComponentSlot?: ReactNode;
2031
2034
  }
package/dist/index.cjs.js CHANGED
@@ -1304,6 +1304,7 @@ function makeThemeOptions(appTheme, mode) {
1304
1304
  appTheme.spacing.l,
1305
1305
  appTheme.spacing.xl,
1306
1306
  appTheme.spacing.xxl,
1307
+ appTheme.spacing.xxxl,
1307
1308
  ],
1308
1309
  transitions: {
1309
1310
  duration: {
@@ -20164,7 +20165,7 @@ function useNavigationState() {
20164
20165
  };
20165
20166
  }
20166
20167
 
20167
- function NavigationHeaderPrimaryNav({ menuProps, hasInvertedStyle, isNarrow, items, onChange, value, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, }) {
20168
+ function NavigationHeaderPrimaryNav({ menuProps, hasInvertedStyle, isNarrow, items, onChange, value, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, onDrawerStyleNavItemHover, }) {
20168
20169
  const theme = material.useTheme();
20169
20170
  const { anchorEl, activeDropdownKey, activeDrawerKey, contentKey, isContentFading, open, drawerOpen, buttonRef, menuWidth, setAnchorEl, setActiveDropdownKey, setActiveDrawerKey, setContentKey, onClose: handleClose, onDrawerClose, onDrawerOpen, cancelDrawerClose, } = useNavigationState();
20170
20171
  const [clickedDrawerKey, setClickedDrawerKey] = React.useState(null);
@@ -20213,6 +20214,7 @@ function NavigationHeaderPrimaryNav({ menuProps, hasInvertedStyle, isNarrow, ite
20213
20214
  }
20214
20215
  };
20215
20216
  return (jsxRuntime.jsx(StyledHoverDrawerContainer, { onMouseEnter: () => {
20217
+ onDrawerStyleNavItemHover?.(item);
20216
20218
  if (clickedDrawerKey !== key) {
20217
20219
  onDrawerOpen(key);
20218
20220
  }
@@ -20464,7 +20466,7 @@ const StyledTag = styled__default.default(Tag) `
20464
20466
  margin: 0;
20465
20467
  `;
20466
20468
 
20467
- function NavigationHeaderSecondaryNav({ menuProps, items, hasInvertedStyle, isNarrow, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, }) {
20469
+ function NavigationHeaderSecondaryNav({ menuProps, items, hasInvertedStyle, isNarrow, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, onDrawerStyleNavItemHover, }) {
20468
20470
  const theme = material.useTheme();
20469
20471
  const { anchorEl, activeDropdownKey, activeDrawerKey, contentKey, isContentFading, open, drawerOpen, buttonRef, menuWidth, setAnchorEl, setActiveDropdownKey, setActiveDrawerKey, setContentKey, onClose: handleClose, onDrawerClose, onDrawerOpen, cancelDrawerClose, } = useNavigationState();
20470
20472
  function onClose() {
@@ -20488,7 +20490,10 @@ function NavigationHeaderSecondaryNav({ menuProps, items, hasInvertedStyle, isNa
20488
20490
  const handleClick = (e) => {
20489
20491
  parentOnClick?.(e);
20490
20492
  };
20491
- return (jsxRuntime.jsx(StyledHoverDrawerContainer, { onMouseEnter: () => onDrawerOpen(key), onMouseLeave: onDrawerClose, children: jsxRuntime.jsxs(UnifiedNavItem, __assign({}, rest, { hasInvertedStyle: hasInvertedStyle, active: isDrawerOpen, isNarrow: isNarrow, sdsStyle: "minimal", innerSdsStyle: sdsStyle, navVariant: "secondary", onClick: handleClick, component: componentProp, href: defaultUrl, target: target, rel: rel, children: [jsxRuntime.jsx(StyledLabelTextWrapper$1, { active: isDrawerOpen, isNarrow: isNarrow, children: label }), jsxRuntime.jsx(StyledLabelTextWrapperShadow$1, { "aria-hidden": "true", isNarrow: isNarrow, children: label }), jsxRuntime.jsx(Icon, { sdsIcon: isDrawerOpen ? "ChevronUp" : "ChevronDown", sdsSize: "xs" })] })) }, key));
20493
+ return (jsxRuntime.jsx(StyledHoverDrawerContainer, { onMouseEnter: () => {
20494
+ onDrawerStyleNavItemHover?.(item);
20495
+ onDrawerOpen(key);
20496
+ }, onMouseLeave: onDrawerClose, children: jsxRuntime.jsxs(UnifiedNavItem, __assign({}, rest, { hasInvertedStyle: hasInvertedStyle, active: isDrawerOpen, isNarrow: isNarrow, sdsStyle: "minimal", innerSdsStyle: sdsStyle, navVariant: "secondary", onClick: handleClick, component: componentProp, href: defaultUrl, target: target, rel: rel, children: [jsxRuntime.jsx(StyledLabelTextWrapper$1, { active: isDrawerOpen, isNarrow: isNarrow, children: label }), jsxRuntime.jsx(StyledLabelTextWrapperShadow$1, { "aria-hidden": "true", isNarrow: isNarrow, children: label }), jsxRuntime.jsx(Icon, { sdsIcon: isDrawerOpen ? "ChevronUp" : "ChevronDown", sdsSize: "xs" })] })) }, key));
20492
20497
  };
20493
20498
  const renderDropdownItem = (item, key, label, parentOnClick, rest) => {
20494
20499
  const isDropdownOpen = open && activeDropdownKey === key;
@@ -20660,7 +20665,7 @@ const NavigationHeader = React.forwardRef((props, ref) => {
20660
20665
  const { activePrimaryNavKey: controlledActivePrimaryNavKey, buttons, sdsStyle = "dropdown", menuProps = {
20661
20666
  disableScrollLock: true,
20662
20667
  disablePortal: true
20663
- }, backgroundAppearance = "matchBackground", logo, logoUrl, logoLinkComponent = "a", logoLinkProps, scrollElevation = true, primaryNavItems, primaryNavPosition = "left", searchProps, secondaryNavItems, setActivePrimaryNavKey: onActivePrimaryNavKeyChange, showSearch = true, tag, tagColor, title, drawerOpen: controlledDrawerOpen, setDrawerOpen: onDrawerOpenChange, isSticky = true, topComponentSlot, ...rest } = props;
20668
+ }, backgroundAppearance = "matchBackground", logo, logoUrl, logoLinkComponent = "a", logoLinkProps, scrollElevation = true, primaryNavItems, primaryNavPosition = "left", searchProps, secondaryNavItems, setActivePrimaryNavKey: onActivePrimaryNavKeyChange, showSearch = true, tag, tagColor, title, drawerOpen: controlledDrawerOpen, setDrawerOpen: onDrawerOpenChange, isSticky = true, topComponentSlot, onDrawerStyleNavItemHover, ...rest } = props;
20664
20669
  const navRef = React.useRef(null);
20665
20670
  const topSlotRef = React.useRef(null);
20666
20671
  const [topOffset, setTopOffset] = React.useState(0);
@@ -20813,11 +20818,11 @@ const NavigationHeader = React.forwardRef((props, ref) => {
20813
20818
  };
20814
20819
  const renderPrimaryNav = () => {
20815
20820
  return (primaryNavItems &&
20816
- primaryNavItems.length > 0 && (jsxRuntime.jsx(NavigationHeaderPrimaryNav, { items: primaryNavItems, value: activePrimaryNavKey, onChange: setActivePrimaryNavKey, hasInvertedStyle: hasInvertedStyle, isNarrow: dimensions.isNarrow, menuProps: menuProps, sdsStyle: sdsStyle, expandedAccordion: expandedAccordion, setExpandedAccordion: setExpandedAccordion, accordionRefs: accordionRefs, scrollToAccordion: scrollToAccordion, onDrawerStateChange: handlePrimaryDrawerStateChange, topOffset: topOffset, onClose: () => setDrawerOpen(false) })));
20821
+ primaryNavItems.length > 0 && (jsxRuntime.jsx(NavigationHeaderPrimaryNav, { items: primaryNavItems, value: activePrimaryNavKey, onChange: setActivePrimaryNavKey, hasInvertedStyle: hasInvertedStyle, isNarrow: dimensions.isNarrow, menuProps: menuProps, sdsStyle: sdsStyle, expandedAccordion: expandedAccordion, setExpandedAccordion: setExpandedAccordion, accordionRefs: accordionRefs, scrollToAccordion: scrollToAccordion, onDrawerStateChange: handlePrimaryDrawerStateChange, topOffset: topOffset, onClose: () => setDrawerOpen(false), onDrawerStyleNavItemHover: onDrawerStyleNavItemHover })));
20817
20822
  };
20818
20823
  const renderSecondaryNav = () => {
20819
20824
  return (secondaryNavItems &&
20820
- secondaryNavItems.length > 0 && (jsxRuntime.jsx(NavigationHeaderSecondaryNav, { items: secondaryNavItems, hasInvertedStyle: hasInvertedStyle, isNarrow: dimensions.isNarrow, menuProps: menuProps, sdsStyle: sdsStyle, expandedAccordion: expandedAccordion, setExpandedAccordion: setExpandedAccordion, accordionRefs: accordionRefs, scrollToAccordion: scrollToAccordion, onDrawerStateChange: handleSecondaryDrawerStateChange, topOffset: topOffset, onClose: () => setDrawerOpen(false) })));
20825
+ secondaryNavItems.length > 0 && (jsxRuntime.jsx(NavigationHeaderSecondaryNav, { items: secondaryNavItems, hasInvertedStyle: hasInvertedStyle, isNarrow: dimensions.isNarrow, menuProps: menuProps, sdsStyle: sdsStyle, expandedAccordion: expandedAccordion, setExpandedAccordion: setExpandedAccordion, accordionRefs: accordionRefs, scrollToAccordion: scrollToAccordion, onDrawerStateChange: handleSecondaryDrawerStateChange, topOffset: topOffset, onClose: () => setDrawerOpen(false), onDrawerStyleNavItemHover: onDrawerStyleNavItemHover })));
20821
20826
  };
20822
20827
  const renderButtonsNode = () => {
20823
20828
  if (!buttons || buttons.length === 0)
@@ -1969,6 +1969,7 @@ interface NavigationHeaderPrimaryNavProps<T extends string> {
1969
1969
  onDrawerStateChange?: (isOpen: boolean) => void;
1970
1970
  topOffset?: number;
1971
1971
  onClose?: () => void;
1972
+ onDrawerStyleNavItemHover?: (item: NavigationHeaderPrimaryNavItem<T>) => void;
1972
1973
  }
1973
1974
  interface BaseNavigationHeaderSecondaryNavItem<T extends string> extends Record<string, unknown> {
1974
1975
  key: T;
@@ -2003,6 +2004,7 @@ interface NavigationHeaderSecondaryNavProps<T extends string> {
2003
2004
  onDrawerStateChange?: (isOpen: boolean) => void;
2004
2005
  topOffset?: number;
2005
2006
  onClose?: () => void;
2007
+ onDrawerStyleNavItemHover?: (item: NavigationHeaderSecondaryNavItem<T>) => void;
2006
2008
  }
2007
2009
  interface NavigationHeaderProps<T extends string = string> extends Omit<AppBarProps, "position"> {
2008
2010
  activePrimaryNavKey?: string;
@@ -2026,6 +2028,7 @@ interface NavigationHeaderProps<T extends string = string> extends Omit<AppBarPr
2026
2028
  setDrawerOpen?: (open: boolean) => void;
2027
2029
  menuProps?: Partial<MenuProps$0>;
2028
2030
  sdsStyle?: "dropdown" | "drawer";
2031
+ onDrawerStyleNavItemHover?: (item: NavigationHeaderPrimaryNavItem<T> | NavigationHeaderSecondaryNavItem<T>) => void;
2029
2032
  isSticky?: boolean;
2030
2033
  topComponentSlot?: ReactNode;
2031
2034
  }
package/dist/index.esm.js CHANGED
@@ -1281,6 +1281,7 @@ function makeThemeOptions(appTheme, mode) {
1281
1281
  appTheme.spacing.l,
1282
1282
  appTheme.spacing.xl,
1283
1283
  appTheme.spacing.xxl,
1284
+ appTheme.spacing.xxxl,
1284
1285
  ],
1285
1286
  transitions: {
1286
1287
  duration: {
@@ -20141,7 +20142,7 @@ function useNavigationState() {
20141
20142
  };
20142
20143
  }
20143
20144
 
20144
- function NavigationHeaderPrimaryNav({ menuProps, hasInvertedStyle, isNarrow, items, onChange, value, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, }) {
20145
+ function NavigationHeaderPrimaryNav({ menuProps, hasInvertedStyle, isNarrow, items, onChange, value, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, onDrawerStyleNavItemHover, }) {
20145
20146
  const theme = useTheme$4();
20146
20147
  const { anchorEl, activeDropdownKey, activeDrawerKey, contentKey, isContentFading, open, drawerOpen, buttonRef, menuWidth, setAnchorEl, setActiveDropdownKey, setActiveDrawerKey, setContentKey, onClose: handleClose, onDrawerClose, onDrawerOpen, cancelDrawerClose, } = useNavigationState();
20147
20148
  const [clickedDrawerKey, setClickedDrawerKey] = useState(null);
@@ -20190,6 +20191,7 @@ function NavigationHeaderPrimaryNav({ menuProps, hasInvertedStyle, isNarrow, ite
20190
20191
  }
20191
20192
  };
20192
20193
  return (jsx(StyledHoverDrawerContainer, { onMouseEnter: () => {
20194
+ onDrawerStyleNavItemHover?.(item);
20193
20195
  if (clickedDrawerKey !== key) {
20194
20196
  onDrawerOpen(key);
20195
20197
  }
@@ -20441,7 +20443,7 @@ const StyledTag = styled$2(Tag) `
20441
20443
  margin: 0;
20442
20444
  `;
20443
20445
 
20444
- function NavigationHeaderSecondaryNav({ menuProps, items, hasInvertedStyle, isNarrow, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, }) {
20446
+ function NavigationHeaderSecondaryNav({ menuProps, items, hasInvertedStyle, isNarrow, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, onDrawerStyleNavItemHover, }) {
20445
20447
  const theme = useTheme$4();
20446
20448
  const { anchorEl, activeDropdownKey, activeDrawerKey, contentKey, isContentFading, open, drawerOpen, buttonRef, menuWidth, setAnchorEl, setActiveDropdownKey, setActiveDrawerKey, setContentKey, onClose: handleClose, onDrawerClose, onDrawerOpen, cancelDrawerClose, } = useNavigationState();
20447
20449
  function onClose() {
@@ -20465,7 +20467,10 @@ function NavigationHeaderSecondaryNav({ menuProps, items, hasInvertedStyle, isNa
20465
20467
  const handleClick = (e) => {
20466
20468
  parentOnClick?.(e);
20467
20469
  };
20468
- return (jsx(StyledHoverDrawerContainer, { onMouseEnter: () => onDrawerOpen(key), onMouseLeave: onDrawerClose, children: jsxs(UnifiedNavItem, __assign({}, rest, { hasInvertedStyle: hasInvertedStyle, active: isDrawerOpen, isNarrow: isNarrow, sdsStyle: "minimal", innerSdsStyle: sdsStyle, navVariant: "secondary", onClick: handleClick, component: componentProp, href: defaultUrl, target: target, rel: rel, children: [jsx(StyledLabelTextWrapper$1, { active: isDrawerOpen, isNarrow: isNarrow, children: label }), jsx(StyledLabelTextWrapperShadow$1, { "aria-hidden": "true", isNarrow: isNarrow, children: label }), jsx(Icon, { sdsIcon: isDrawerOpen ? "ChevronUp" : "ChevronDown", sdsSize: "xs" })] })) }, key));
20470
+ return (jsx(StyledHoverDrawerContainer, { onMouseEnter: () => {
20471
+ onDrawerStyleNavItemHover?.(item);
20472
+ onDrawerOpen(key);
20473
+ }, onMouseLeave: onDrawerClose, children: jsxs(UnifiedNavItem, __assign({}, rest, { hasInvertedStyle: hasInvertedStyle, active: isDrawerOpen, isNarrow: isNarrow, sdsStyle: "minimal", innerSdsStyle: sdsStyle, navVariant: "secondary", onClick: handleClick, component: componentProp, href: defaultUrl, target: target, rel: rel, children: [jsx(StyledLabelTextWrapper$1, { active: isDrawerOpen, isNarrow: isNarrow, children: label }), jsx(StyledLabelTextWrapperShadow$1, { "aria-hidden": "true", isNarrow: isNarrow, children: label }), jsx(Icon, { sdsIcon: isDrawerOpen ? "ChevronUp" : "ChevronDown", sdsSize: "xs" })] })) }, key));
20469
20474
  };
20470
20475
  const renderDropdownItem = (item, key, label, parentOnClick, rest) => {
20471
20476
  const isDropdownOpen = open && activeDropdownKey === key;
@@ -20637,7 +20642,7 @@ const NavigationHeader = forwardRef((props, ref) => {
20637
20642
  const { activePrimaryNavKey: controlledActivePrimaryNavKey, buttons, sdsStyle = "dropdown", menuProps = {
20638
20643
  disableScrollLock: true,
20639
20644
  disablePortal: true
20640
- }, backgroundAppearance = "matchBackground", logo, logoUrl, logoLinkComponent = "a", logoLinkProps, scrollElevation = true, primaryNavItems, primaryNavPosition = "left", searchProps, secondaryNavItems, setActivePrimaryNavKey: onActivePrimaryNavKeyChange, showSearch = true, tag, tagColor, title, drawerOpen: controlledDrawerOpen, setDrawerOpen: onDrawerOpenChange, isSticky = true, topComponentSlot, ...rest } = props;
20645
+ }, backgroundAppearance = "matchBackground", logo, logoUrl, logoLinkComponent = "a", logoLinkProps, scrollElevation = true, primaryNavItems, primaryNavPosition = "left", searchProps, secondaryNavItems, setActivePrimaryNavKey: onActivePrimaryNavKeyChange, showSearch = true, tag, tagColor, title, drawerOpen: controlledDrawerOpen, setDrawerOpen: onDrawerOpenChange, isSticky = true, topComponentSlot, onDrawerStyleNavItemHover, ...rest } = props;
20641
20646
  const navRef = useRef(null);
20642
20647
  const topSlotRef = useRef(null);
20643
20648
  const [topOffset, setTopOffset] = useState(0);
@@ -20790,11 +20795,11 @@ const NavigationHeader = forwardRef((props, ref) => {
20790
20795
  };
20791
20796
  const renderPrimaryNav = () => {
20792
20797
  return (primaryNavItems &&
20793
- primaryNavItems.length > 0 && (jsx(NavigationHeaderPrimaryNav, { items: primaryNavItems, value: activePrimaryNavKey, onChange: setActivePrimaryNavKey, hasInvertedStyle: hasInvertedStyle, isNarrow: dimensions.isNarrow, menuProps: menuProps, sdsStyle: sdsStyle, expandedAccordion: expandedAccordion, setExpandedAccordion: setExpandedAccordion, accordionRefs: accordionRefs, scrollToAccordion: scrollToAccordion, onDrawerStateChange: handlePrimaryDrawerStateChange, topOffset: topOffset, onClose: () => setDrawerOpen(false) })));
20798
+ primaryNavItems.length > 0 && (jsx(NavigationHeaderPrimaryNav, { items: primaryNavItems, value: activePrimaryNavKey, onChange: setActivePrimaryNavKey, hasInvertedStyle: hasInvertedStyle, isNarrow: dimensions.isNarrow, menuProps: menuProps, sdsStyle: sdsStyle, expandedAccordion: expandedAccordion, setExpandedAccordion: setExpandedAccordion, accordionRefs: accordionRefs, scrollToAccordion: scrollToAccordion, onDrawerStateChange: handlePrimaryDrawerStateChange, topOffset: topOffset, onClose: () => setDrawerOpen(false), onDrawerStyleNavItemHover: onDrawerStyleNavItemHover })));
20794
20799
  };
20795
20800
  const renderSecondaryNav = () => {
20796
20801
  return (secondaryNavItems &&
20797
- secondaryNavItems.length > 0 && (jsx(NavigationHeaderSecondaryNav, { items: secondaryNavItems, hasInvertedStyle: hasInvertedStyle, isNarrow: dimensions.isNarrow, menuProps: menuProps, sdsStyle: sdsStyle, expandedAccordion: expandedAccordion, setExpandedAccordion: setExpandedAccordion, accordionRefs: accordionRefs, scrollToAccordion: scrollToAccordion, onDrawerStateChange: handleSecondaryDrawerStateChange, topOffset: topOffset, onClose: () => setDrawerOpen(false) })));
20802
+ secondaryNavItems.length > 0 && (jsx(NavigationHeaderSecondaryNav, { items: secondaryNavItems, hasInvertedStyle: hasInvertedStyle, isNarrow: dimensions.isNarrow, menuProps: menuProps, sdsStyle: sdsStyle, expandedAccordion: expandedAccordion, setExpandedAccordion: setExpandedAccordion, accordionRefs: accordionRefs, scrollToAccordion: scrollToAccordion, onDrawerStateChange: handleSecondaryDrawerStateChange, topOffset: topOffset, onClose: () => setDrawerOpen(false), onDrawerStyleNavItemHover: onDrawerStyleNavItemHover })));
20798
20803
  };
20799
20804
  const renderButtonsNode = () => {
20800
20805
  if (!buttons || buttons.length === 0)