@czi-sds/components 22.17.1 → 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.
- package/dist/index.cjs.d.ts +7 -3
- package/dist/index.cjs.js +64 -41
- package/dist/index.esm.d.ts +7 -3
- package/dist/index.esm.js +64 -41
- package/dist/tailwind.json +7 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/variables.css +14 -12
- package/dist/variables.scss +7 -6
- package/package.json +2 -2
package/dist/index.cjs.d.ts
CHANGED
|
@@ -379,6 +379,7 @@ interface Spaces {
|
|
|
379
379
|
l: number;
|
|
380
380
|
xl: number;
|
|
381
381
|
xxl: number;
|
|
382
|
+
xxxl: number;
|
|
382
383
|
}
|
|
383
384
|
/**
|
|
384
385
|
* @deprecated
|
|
@@ -1087,7 +1088,7 @@ interface BannerExtraProps extends CommonThemeProps {
|
|
|
1087
1088
|
type ButtonType$0 = ButtonProps & {
|
|
1088
1089
|
bannerType: string;
|
|
1089
1090
|
} & CommonThemeProps;
|
|
1090
|
-
type BannerIntentType = "info" | "negative" | "notice" | "positive";
|
|
1091
|
+
type BannerIntentType = "accent" | "info" | "negative" | "notice" | "positive";
|
|
1091
1092
|
interface BannerProps extends BannerExtraProps {
|
|
1092
1093
|
children: React.ReactNode;
|
|
1093
1094
|
icon?: keyof IconNameToSizes | React.ReactElement<CustomSVGProps>;
|
|
@@ -1165,7 +1166,7 @@ interface ButtonToggleProps extends ButtonProps$0 {
|
|
|
1165
1166
|
declare const ButtonToggle: React.ForwardRefExoticComponent<Omit<ButtonToggleProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
1166
1167
|
declare const SDS_STAGE_OPEN = "open";
|
|
1167
1168
|
declare const SDS_STAGE_CLOSED = "closed";
|
|
1168
|
-
type CalloutIntentType = "info" | "negative" | "notice" | "positive";
|
|
1169
|
+
type CalloutIntentType = "accent" | "info" | "negative" | "notice" | "positive";
|
|
1169
1170
|
type CalloutSdsStyleType = "persistent" | "expandable" | "dismissible";
|
|
1170
1171
|
interface CalloutProps {
|
|
1171
1172
|
autoDismiss?: boolean | number;
|
|
@@ -1968,6 +1969,7 @@ interface NavigationHeaderPrimaryNavProps<T extends string> {
|
|
|
1968
1969
|
onDrawerStateChange?: (isOpen: boolean) => void;
|
|
1969
1970
|
topOffset?: number;
|
|
1970
1971
|
onClose?: () => void;
|
|
1972
|
+
onDrawerStyleNavItemHover?: (item: NavigationHeaderPrimaryNavItem<T>) => void;
|
|
1971
1973
|
}
|
|
1972
1974
|
interface BaseNavigationHeaderSecondaryNavItem<T extends string> extends Record<string, unknown> {
|
|
1973
1975
|
key: T;
|
|
@@ -2002,6 +2004,7 @@ interface NavigationHeaderSecondaryNavProps<T extends string> {
|
|
|
2002
2004
|
onDrawerStateChange?: (isOpen: boolean) => void;
|
|
2003
2005
|
topOffset?: number;
|
|
2004
2006
|
onClose?: () => void;
|
|
2007
|
+
onDrawerStyleNavItemHover?: (item: NavigationHeaderSecondaryNavItem<T>) => void;
|
|
2005
2008
|
}
|
|
2006
2009
|
interface NavigationHeaderProps<T extends string = string> extends Omit<AppBarProps, "position"> {
|
|
2007
2010
|
activePrimaryNavKey?: string;
|
|
@@ -2025,6 +2028,7 @@ interface NavigationHeaderProps<T extends string = string> extends Omit<AppBarPr
|
|
|
2025
2028
|
setDrawerOpen?: (open: boolean) => void;
|
|
2026
2029
|
menuProps?: Partial<MenuProps$0>;
|
|
2027
2030
|
sdsStyle?: "dropdown" | "drawer";
|
|
2031
|
+
onDrawerStyleNavItemHover?: (item: NavigationHeaderPrimaryNavItem<T> | NavigationHeaderSecondaryNavItem<T>) => void;
|
|
2028
2032
|
isSticky?: boolean;
|
|
2029
2033
|
topComponentSlot?: ReactNode;
|
|
2030
2034
|
}
|
|
@@ -2052,7 +2056,7 @@ interface NavigationJumpToProps extends NavigationJumpToExtraProps {
|
|
|
2052
2056
|
width?: CSSProperties["width"];
|
|
2053
2057
|
}
|
|
2054
2058
|
declare const NavigationJumpTo: React.ForwardRefExoticComponent<Omit<NavigationJumpToProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
2055
|
-
type NotificationIntentType = "info" | "negative" | "positive" | "notice";
|
|
2059
|
+
type NotificationIntentType = "accent" | "info" | "negative" | "positive" | "notice";
|
|
2056
2060
|
interface NotificationProps {
|
|
2057
2061
|
autoDismiss?: boolean | number;
|
|
2058
2062
|
buttonOnClick?: (event: React.SyntheticEvent) => void;
|
package/dist/index.cjs.js
CHANGED
|
@@ -521,15 +521,16 @@ const Shadows = {
|
|
|
521
521
|
};
|
|
522
522
|
|
|
523
523
|
const Spaces = {
|
|
524
|
+
xxxs: 2,
|
|
525
|
+
xxs: 4,
|
|
526
|
+
xs: 6,
|
|
527
|
+
s: 8,
|
|
528
|
+
m: 12,
|
|
524
529
|
default: 12,
|
|
525
530
|
l: 16,
|
|
526
|
-
m: 12,
|
|
527
|
-
s: 8,
|
|
528
531
|
xl: 24,
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
xxs: 4,
|
|
532
|
-
xxxs: 2
|
|
532
|
+
xxl: 32,
|
|
533
|
+
xxxl: 40
|
|
533
534
|
};
|
|
534
535
|
|
|
535
536
|
const SDSLightThemeColors = {
|
|
@@ -1303,6 +1304,7 @@ function makeThemeOptions(appTheme, mode) {
|
|
|
1303
1304
|
appTheme.spacing.l,
|
|
1304
1305
|
appTheme.spacing.xl,
|
|
1305
1306
|
appTheme.spacing.xxl,
|
|
1307
|
+
appTheme.spacing.xxxl,
|
|
1306
1308
|
],
|
|
1307
1309
|
transitions: {
|
|
1308
1310
|
duration: {
|
|
@@ -9866,9 +9868,9 @@ const StyledPaper = styled__default.default(material.Paper, {
|
|
|
9866
9868
|
background-color: ${semanticColors?.base?.surface};
|
|
9867
9869
|
background-image: none;
|
|
9868
9870
|
box-shadow: ${shadows?.l};
|
|
9869
|
-
max-height: calc(100vh - ${2 * (spaces?.
|
|
9871
|
+
max-height: calc(100vh - ${2 * (spaces?.xxxl || 40)}px);
|
|
9870
9872
|
border-radius: ${corners?.xl}px;
|
|
9871
|
-
padding: ${isSmall ? spaces?.xl : spaces?.
|
|
9873
|
+
padding: ${isSmall ? spaces?.xl : spaces?.xxxl}px;
|
|
9872
9874
|
outline: 1px solid ${addOpacityToHex(semanticColors?.base?.borderSecondary || "#000000", 15)};
|
|
9873
9875
|
`;
|
|
9874
9876
|
}}
|
|
@@ -9918,7 +9920,7 @@ const StyledButton$1 = styled__default.default(Button) `
|
|
|
9918
9920
|
const { sdsSize } = props;
|
|
9919
9921
|
const isSmall = sdsSize === "small" || sdsSize === "medium";
|
|
9920
9922
|
const spaces = getSpaces(props);
|
|
9921
|
-
const right = isSmall ? spaces?.xl : spaces?.
|
|
9923
|
+
const right = isSmall ? spaces?.xl : spaces?.xxxl;
|
|
9922
9924
|
return `
|
|
9923
9925
|
right: ${right}px;
|
|
9924
9926
|
`;
|
|
@@ -10018,7 +10020,7 @@ const StyledDialogActions = styled__default.default(material.DialogActions, {
|
|
|
10018
10020
|
return `
|
|
10019
10021
|
justify-content: ${buttonPosition === "right" ? "flex-end" : "flex-start"};;
|
|
10020
10022
|
|
|
10021
|
-
margin-top: ${isSmall ? spaces?.xl : spaces?.
|
|
10023
|
+
margin-top: ${isSmall ? spaces?.xl : spaces?.xxxl}px;
|
|
10022
10024
|
|
|
10023
10025
|
&.${material.dialogActionsClasses.spacing} > :not(:first-of-type) {
|
|
10024
10026
|
margin-left: ${spaces?.m}px;
|
|
@@ -10125,16 +10127,16 @@ const getResponsivePadding = (props) => {
|
|
|
10125
10127
|
const spaces = getSpaces(props);
|
|
10126
10128
|
const breakpoints = getBreakpoints(props);
|
|
10127
10129
|
return react.css `
|
|
10128
|
-
padding: ${spaces?.
|
|
10130
|
+
padding: ${spaces?.xxxl}px
|
|
10129
10131
|
${overlayContainerMinMargin?.small || HeroMargins.SMALL};
|
|
10130
10132
|
|
|
10131
10133
|
${breakpoints?.up("md")} {
|
|
10132
|
-
padding: ${spaces?.
|
|
10134
|
+
padding: ${spaces?.xxxl}px
|
|
10133
10135
|
${overlayContainerMinMargin?.medium || HeroMargins.MEDIUM};
|
|
10134
10136
|
}
|
|
10135
10137
|
|
|
10136
10138
|
${breakpoints?.up("lg")} {
|
|
10137
|
-
padding: ${spaces?.
|
|
10139
|
+
padding: ${spaces?.xxxl}px
|
|
10138
10140
|
${overlayContainerMinMargin?.large || HeroMargins.LARGE};
|
|
10139
10141
|
}
|
|
10140
10142
|
`;
|
|
@@ -11315,7 +11317,7 @@ const LegendContainer = styled__default.default("div") `
|
|
|
11315
11317
|
`;
|
|
11316
11318
|
const LegendItem = styled__default.default("div") `
|
|
11317
11319
|
${(props) => {
|
|
11318
|
-
const { isSelected, disabled } = props;
|
|
11320
|
+
const { isSelected, disabled, isHovered } = props;
|
|
11319
11321
|
const spaces = getSpaces(props);
|
|
11320
11322
|
const semanticColors = getSemanticColors(props);
|
|
11321
11323
|
const corners = getCorners(props);
|
|
@@ -11326,7 +11328,7 @@ const LegendItem = styled__default.default("div") `
|
|
|
11326
11328
|
transition: background-color 0.2s ease-in-out;
|
|
11327
11329
|
padding: ${spaces?.xxxs}px ${spaces?.xxs}px;
|
|
11328
11330
|
border-radius: ${corners?.s}px;
|
|
11329
|
-
background-color: ${isSelected ? semanticColors?.base?.backgroundTertiary : "transparent"};
|
|
11331
|
+
background-color: ${isSelected ? semanticColors?.base?.backgroundTertiary : isHovered ? semanticColors?.base?.backgroundSecondary : "transparent"};
|
|
11330
11332
|
pointer-events: ${disabled ? "none" : "auto"};
|
|
11331
11333
|
|
|
11332
11334
|
&:hover {
|
|
@@ -11425,7 +11427,7 @@ const Legend = (props) => {
|
|
|
11425
11427
|
: hasSelection && !isSelected;
|
|
11426
11428
|
// Determine color: use colors prop, then item color, then fallback to gray
|
|
11427
11429
|
const itemColor = colors?.[index] || item.color || fallbackColor;
|
|
11428
|
-
return (jsxRuntime.jsxs(LegendItem, { onMouseEnter: () => handleMouseEnter(item, index), onMouseLeave: () => handleMouseLeave(item, index), onClick: () => handleClick(item, index), role: "button", tabIndex: item.disabled ? -1 : 0, "aria-label": `${item.name}${item.value ? `: ${item.value}` : ""}`, "aria-pressed": isSelected, "aria-disabled": item.disabled, isSelected: isSelected, disabled: item.disabled, children: [jsxRuntime.jsx(LegendIcon, { color: itemColor, isDimmed: isDimmed }), jsxRuntime.jsx(LegendLabel, { disabled: item.disabled, children: item.name }), showValues && item.value !== undefined && (jsxRuntime.jsx(LegendValue, { disabled: item.disabled, children: typeof item.value === "number"
|
|
11430
|
+
return (jsxRuntime.jsxs(LegendItem, { onMouseEnter: () => handleMouseEnter(item, index), onMouseLeave: () => handleMouseLeave(item, index), onClick: () => handleClick(item, index), role: "button", tabIndex: item.disabled ? -1 : 0, "aria-label": `${item.name}${item.value ? `: ${item.value}` : ""}`, "aria-pressed": isSelected, "aria-disabled": item.disabled, isSelected: isSelected, disabled: item.disabled, isHovered: isHovered, children: [jsxRuntime.jsx(LegendIcon, { color: itemColor, isDimmed: isDimmed }), jsxRuntime.jsx(LegendLabel, { disabled: item.disabled, children: item.name }), showValues && item.value !== undefined && (jsxRuntime.jsx(LegendValue, { disabled: item.disabled, children: typeof item.value === "number"
|
|
11429
11431
|
? item.value.toLocaleString()
|
|
11430
11432
|
: item.value }))] }, `${item.name}-${index}`));
|
|
11431
11433
|
}) })));
|
|
@@ -18346,6 +18348,7 @@ function NavigationFooter({ backgroundAppearance = "matchBackground", images, lo
|
|
|
18346
18348
|
|
|
18347
18349
|
/* eslint-disable sonarjs/cognitive-complexity */
|
|
18348
18350
|
/* eslint-disable sonarjs/no-duplicate-string */
|
|
18351
|
+
const TOOLBAR_HEIGHT = 48;
|
|
18349
18352
|
const doNotForwardProps$a = [
|
|
18350
18353
|
"hasInvertedStyle",
|
|
18351
18354
|
"isNarrow",
|
|
@@ -18361,7 +18364,7 @@ const doNotForwardProps$a = [
|
|
|
18361
18364
|
const StyledTopComponentSlot = styled__default.default("div") `
|
|
18362
18365
|
position: sticky;
|
|
18363
18366
|
top: 0;
|
|
18364
|
-
z-index:
|
|
18367
|
+
z-index: 2100;
|
|
18365
18368
|
`;
|
|
18366
18369
|
const StyledAppBar = styled__default.default(material.AppBar, {
|
|
18367
18370
|
shouldForwardProp: (prop) => ![...doNotForwardProps$a, "sdsStyle"].includes(prop)
|
|
@@ -18373,7 +18376,7 @@ const StyledAppBar = styled__default.default(material.AppBar, {
|
|
|
18373
18376
|
background-image: none;
|
|
18374
18377
|
max-width: 100%;
|
|
18375
18378
|
overflow-x: auto;
|
|
18376
|
-
z-index:
|
|
18379
|
+
z-index: 2100;
|
|
18377
18380
|
`;
|
|
18378
18381
|
}}
|
|
18379
18382
|
`;
|
|
@@ -18402,8 +18405,8 @@ const StyledToolbar = styled__default.default(material.Toolbar, {
|
|
|
18402
18405
|
const spaces = getSpaces(props);
|
|
18403
18406
|
return material.css `
|
|
18404
18407
|
&.MuiToolbar-root {
|
|
18405
|
-
min-height:
|
|
18406
|
-
max-height:
|
|
18408
|
+
min-height: ${TOOLBAR_HEIGHT}px;
|
|
18409
|
+
max-height: ${TOOLBAR_HEIGHT}px;
|
|
18407
18410
|
padding: ${spaces?.s}px ${spaces?.l}px;
|
|
18408
18411
|
|
|
18409
18412
|
${isNarrow && NarrowToolbar(props)}
|
|
@@ -18566,7 +18569,7 @@ const StyledTitleContainer = styled__default.default("div", {
|
|
|
18566
18569
|
color: ${props.hasInvertedStyle
|
|
18567
18570
|
? colors?.base.textPrimaryOnDark
|
|
18568
18571
|
: colors?.base.textPrimary};
|
|
18569
|
-
margin-right: ${spaces?.
|
|
18572
|
+
margin-right: ${spaces?.xxxl}px;
|
|
18570
18573
|
width: 100%;
|
|
18571
18574
|
|
|
18572
18575
|
${isNarrow && NarrowTitleContainer()}
|
|
@@ -18608,8 +18611,8 @@ const StyledPrimaryNavContainer = styled__default.default("div", {
|
|
|
18608
18611
|
const primaryNavPositionWithoutSearch = primaryNavPosition === "left" ? "flex-start" : "flex-end";
|
|
18609
18612
|
return material.css `
|
|
18610
18613
|
flex-direction: ${isNarrow ? "column" : "row"};
|
|
18611
|
-
gap: ${spaces?.
|
|
18612
|
-
margin-right: ${spaces?.
|
|
18614
|
+
gap: ${spaces?.xxxl}px;
|
|
18615
|
+
margin-right: ${spaces?.xxxl}px;
|
|
18613
18616
|
flex: 1;
|
|
18614
18617
|
justify-content: ${showSearch
|
|
18615
18618
|
? primaryNavPositionWithSearch
|
|
@@ -18736,14 +18739,14 @@ const NarrowButtonStyles = (props) => {
|
|
|
18736
18739
|
&::before {
|
|
18737
18740
|
content: "";
|
|
18738
18741
|
position: absolute;
|
|
18739
|
-
height: ${spaces?.
|
|
18742
|
+
height: ${spaces?.xxxl}px;
|
|
18740
18743
|
width: 100%;
|
|
18741
18744
|
background: linear-gradient(
|
|
18742
18745
|
to top,
|
|
18743
18746
|
${backgroundColor} 0%,
|
|
18744
18747
|
${backgroundColor}00 100%
|
|
18745
18748
|
);
|
|
18746
|
-
top: -${spaces?.
|
|
18749
|
+
top: -${spaces?.xxxl}px;
|
|
18747
18750
|
}
|
|
18748
18751
|
|
|
18749
18752
|
.MuiButton-icon .MuiSvgIcon-root {
|
|
@@ -18764,7 +18767,7 @@ const StyledButtonSection = styled__default.default("section", {
|
|
|
18764
18767
|
const spaces = getSpaces(props);
|
|
18765
18768
|
return material.css `
|
|
18766
18769
|
gap: ${spaces?.m}px;
|
|
18767
|
-
margin-left: ${spaces?.
|
|
18770
|
+
margin-left: ${spaces?.xxxl}px;
|
|
18768
18771
|
|
|
18769
18772
|
${isNarrow && NarrowButtonStyles(props)}
|
|
18770
18773
|
`;
|
|
@@ -18784,8 +18787,8 @@ const StyledDrawer$1 = styled__default.default(material.Drawer, {
|
|
|
18784
18787
|
width: 100%;
|
|
18785
18788
|
display: flex;
|
|
18786
18789
|
flex-direction: column;
|
|
18787
|
-
top: ${topOffset}px;
|
|
18788
|
-
height: calc(100% - ${topOffset}px);
|
|
18790
|
+
top: ${topOffset + TOOLBAR_HEIGHT}px;
|
|
18791
|
+
height: calc(100% - ${topOffset + TOOLBAR_HEIGHT}px);
|
|
18789
18792
|
justify-content: space-between;
|
|
18790
18793
|
}
|
|
18791
18794
|
`;
|
|
@@ -18835,7 +18838,7 @@ const DrawerAccordionStyles = (props) => {
|
|
|
18835
18838
|
&[aria-expanded="true"] {
|
|
18836
18839
|
position: sticky;
|
|
18837
18840
|
border-radius: 0;
|
|
18838
|
-
top:
|
|
18841
|
+
top: ${spaces?.s}px;
|
|
18839
18842
|
z-index: 11;
|
|
18840
18843
|
backdrop-filter: blur(0px);
|
|
18841
18844
|
color: ${textOpenColor};
|
|
@@ -19020,6 +19023,7 @@ const StyledMegaMenuDrawer = styled__default.default(material.Drawer, {
|
|
|
19020
19023
|
return material.css `
|
|
19021
19024
|
pointer-events: none;
|
|
19022
19025
|
top: ${topOffset}px;
|
|
19026
|
+
z-index: 2000;
|
|
19023
19027
|
|
|
19024
19028
|
.MuiDrawer-paper {
|
|
19025
19029
|
background-color: ${hasInvertedStyle
|
|
@@ -19032,7 +19036,7 @@ const StyledMegaMenuDrawer = styled__default.default(material.Drawer, {
|
|
|
19032
19036
|
box-shadow: 0 8px 8px 0 rgba(0, 0, 0, 0.1);
|
|
19033
19037
|
background-image: none;
|
|
19034
19038
|
padding: ${spaces?.xl ? spaces?.xl + 48 : 48}px ${spaces?.xl}px
|
|
19035
|
-
${spaces?.
|
|
19039
|
+
${spaces?.xxxl}px;
|
|
19036
19040
|
transform: translateY(48px);
|
|
19037
19041
|
top: ${topOffset}px;
|
|
19038
19042
|
}
|
|
@@ -19058,7 +19062,7 @@ const StyledMegaMenuContent = styled__default.default("div", {
|
|
|
19058
19062
|
: semanticColors?.base.backgroundPrimary};
|
|
19059
19063
|
display: flex;
|
|
19060
19064
|
flex-wrap: wrap;
|
|
19061
|
-
gap: ${spaces?.
|
|
19065
|
+
gap: ${spaces?.xxxl}px;
|
|
19062
19066
|
width: 100%;
|
|
19063
19067
|
max-width: 1200px;
|
|
19064
19068
|
margin: 0 auto;
|
|
@@ -19077,7 +19081,7 @@ const StyledHoverDrawerColumn = styled__default.default("div", {
|
|
|
19077
19081
|
// Account for gaps between columns
|
|
19078
19082
|
const columnsPerRow = totalColumns > 4 ? 4 : totalColumns;
|
|
19079
19083
|
const gapCount = columnsPerRow - 1;
|
|
19080
|
-
const columnWidth = `calc((100% - (${gapCount} * ${spaces?.
|
|
19084
|
+
const columnWidth = `calc((100% - (${gapCount} * ${spaces?.xxxl}px)) / ${columnsPerRow})`;
|
|
19081
19085
|
return material.css `
|
|
19082
19086
|
display: flex;
|
|
19083
19087
|
flex-direction: column;
|
|
@@ -19278,7 +19282,7 @@ const StyledHoverDrawerActions = styled__default.default("div", {
|
|
|
19278
19282
|
margin-top: ${spaces?.l}px;
|
|
19279
19283
|
padding-left: ${isNarrow
|
|
19280
19284
|
? `calc(${spaces?.l}px + ${spaces?.m}px)`
|
|
19281
|
-
: `calc(${spaces?.
|
|
19285
|
+
: `calc(${spaces?.xxxl}px + ${spaces?.xs}px)`};
|
|
19282
19286
|
flex-wrap: wrap;
|
|
19283
19287
|
`;
|
|
19284
19288
|
}}
|
|
@@ -20161,9 +20165,10 @@ function useNavigationState() {
|
|
|
20161
20165
|
};
|
|
20162
20166
|
}
|
|
20163
20167
|
|
|
20164
|
-
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, }) {
|
|
20165
20169
|
const theme = material.useTheme();
|
|
20166
20170
|
const { anchorEl, activeDropdownKey, activeDrawerKey, contentKey, isContentFading, open, drawerOpen, buttonRef, menuWidth, setAnchorEl, setActiveDropdownKey, setActiveDrawerKey, setContentKey, onClose: handleClose, onDrawerClose, onDrawerOpen, cancelDrawerClose, } = useNavigationState();
|
|
20171
|
+
const [clickedDrawerKey, setClickedDrawerKey] = React.useState(null);
|
|
20167
20172
|
// Helper function to wrap dropdown items' onClick handlers
|
|
20168
20173
|
// This automatically sets the parent dropdown as active when an item is clicked
|
|
20169
20174
|
const wrapDropdownItemsWithActiveKey = (dropdownItems, parentKey) => {
|
|
@@ -20202,8 +20207,23 @@ function NavigationHeaderPrimaryNav({ menuProps, hasInvertedStyle, isNarrow, ite
|
|
|
20202
20207
|
const handleClick = (e) => {
|
|
20203
20208
|
onChange(key);
|
|
20204
20209
|
parentOnClick?.(e);
|
|
20210
|
+
if (drawerOpen) {
|
|
20211
|
+
setActiveDrawerKey(null);
|
|
20212
|
+
setContentKey(null);
|
|
20213
|
+
setClickedDrawerKey(key);
|
|
20214
|
+
}
|
|
20205
20215
|
};
|
|
20206
|
-
return (jsxRuntime.jsx(StyledHoverDrawerContainer, { onMouseEnter: () =>
|
|
20216
|
+
return (jsxRuntime.jsx(StyledHoverDrawerContainer, { onMouseEnter: () => {
|
|
20217
|
+
onDrawerStyleNavItemHover?.(item);
|
|
20218
|
+
if (clickedDrawerKey !== key) {
|
|
20219
|
+
onDrawerOpen(key);
|
|
20220
|
+
}
|
|
20221
|
+
}, onMouseLeave: () => {
|
|
20222
|
+
if (clickedDrawerKey === key) {
|
|
20223
|
+
setClickedDrawerKey(null);
|
|
20224
|
+
}
|
|
20225
|
+
onDrawerClose();
|
|
20226
|
+
}, children: jsxRuntime.jsx(UnifiedNavItem, __assign({}, rest, { itemType: item.itemType, active: isActive, hasInvertedStyle: hasInvertedStyle, isNarrow: isNarrow, sdsStyle: "minimal", onClick: handleClick, innerSdsStyle: sdsStyle, navVariant: "primary", component: componentProp, href: defaultUrl, target: target, rel: rel, children: jsxRuntime.jsxs(StyledLabel, { itemType: item.itemType, active: isActive, hasInvertedStyle: hasInvertedStyle, isNarrow: isNarrow, navVariant: "primary", children: [jsxRuntime.jsx(StyledLabelTextWrapper$1, { active: isActive, 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));
|
|
20207
20227
|
};
|
|
20208
20228
|
const renderDropdownItem = (item, key, label, parentOnClick, rest) => {
|
|
20209
20229
|
const isDropdownOpen = open && activeDropdownKey === key;
|
|
@@ -20446,7 +20466,7 @@ const StyledTag = styled__default.default(Tag) `
|
|
|
20446
20466
|
margin: 0;
|
|
20447
20467
|
`;
|
|
20448
20468
|
|
|
20449
|
-
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, }) {
|
|
20450
20470
|
const theme = material.useTheme();
|
|
20451
20471
|
const { anchorEl, activeDropdownKey, activeDrawerKey, contentKey, isContentFading, open, drawerOpen, buttonRef, menuWidth, setAnchorEl, setActiveDropdownKey, setActiveDrawerKey, setContentKey, onClose: handleClose, onDrawerClose, onDrawerOpen, cancelDrawerClose, } = useNavigationState();
|
|
20452
20472
|
function onClose() {
|
|
@@ -20470,7 +20490,10 @@ function NavigationHeaderSecondaryNav({ menuProps, items, hasInvertedStyle, isNa
|
|
|
20470
20490
|
const handleClick = (e) => {
|
|
20471
20491
|
parentOnClick?.(e);
|
|
20472
20492
|
};
|
|
20473
|
-
return (jsxRuntime.jsx(StyledHoverDrawerContainer, { onMouseEnter: () =>
|
|
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));
|
|
20474
20497
|
};
|
|
20475
20498
|
const renderDropdownItem = (item, key, label, parentOnClick, rest) => {
|
|
20476
20499
|
const isDropdownOpen = open && activeDropdownKey === key;
|
|
@@ -20642,7 +20665,7 @@ const NavigationHeader = React.forwardRef((props, ref) => {
|
|
|
20642
20665
|
const { activePrimaryNavKey: controlledActivePrimaryNavKey, buttons, sdsStyle = "dropdown", menuProps = {
|
|
20643
20666
|
disableScrollLock: true,
|
|
20644
20667
|
disablePortal: true
|
|
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, ...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;
|
|
20646
20669
|
const navRef = React.useRef(null);
|
|
20647
20670
|
const topSlotRef = React.useRef(null);
|
|
20648
20671
|
const [topOffset, setTopOffset] = React.useState(0);
|
|
@@ -20795,11 +20818,11 @@ const NavigationHeader = React.forwardRef((props, ref) => {
|
|
|
20795
20818
|
};
|
|
20796
20819
|
const renderPrimaryNav = () => {
|
|
20797
20820
|
return (primaryNavItems &&
|
|
20798
|
-
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 })));
|
|
20799
20822
|
};
|
|
20800
20823
|
const renderSecondaryNav = () => {
|
|
20801
20824
|
return (secondaryNavItems &&
|
|
20802
|
-
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 })));
|
|
20803
20826
|
};
|
|
20804
20827
|
const renderButtonsNode = () => {
|
|
20805
20828
|
if (!buttons || buttons.length === 0)
|
|
@@ -20879,7 +20902,7 @@ const NavigationHeader = React.forwardRef((props, ref) => {
|
|
|
20879
20902
|
const position = sdsStyle === "drawer" ? "sticky" : isSticky ? "sticky" : "relative";
|
|
20880
20903
|
// Disable elevation when drawer style is active and any drawer is open
|
|
20881
20904
|
const effectiveScrollElevation = scrollElevation && !(sdsStyle === "drawer" && isAnyDrawerOpen);
|
|
20882
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [topComponentSlot && (jsxRuntime.jsx(StyledTopComponentSlot, { ref: topSlotRef, children: topComponentSlot })), jsxRuntime.jsx(ElevationScroll, __assign({}, props, { shouldElevate: effectiveScrollElevation, children: jsxRuntime.jsx(StyledAppBar, __assign({ elevation: 0, hasInvertedStyle: hasInvertedStyle, ref: mergeRefs([ref, navRef]), "aria-label": "Main navigation", tabIndex: 0, position: position, style: { top: topOffset } }, rest, { children: headerContent })) })), dimensions.isNarrow && drawerOpen && (jsxRuntime.
|
|
20905
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [topComponentSlot && (jsxRuntime.jsx(StyledTopComponentSlot, { ref: topSlotRef, children: topComponentSlot })), jsxRuntime.jsx(ElevationScroll, __assign({}, props, { shouldElevate: effectiveScrollElevation, children: jsxRuntime.jsx(StyledAppBar, __assign({ elevation: 0, hasInvertedStyle: hasInvertedStyle, ref: mergeRefs([ref, navRef]), "aria-label": "Main navigation", tabIndex: 0, position: position, style: { top: topOffset } }, rest, { children: headerContent })) })), dimensions.isNarrow && drawerOpen && (jsxRuntime.jsx(StyledDrawer$1, { anchor: "right", open: drawerOpen, onClose: () => setDrawerOpen(false), hasInvertedStyle: hasInvertedStyle, topOffset: topOffset, role: "dialog", "aria-label": "Navigation menu", disableScrollLock: false, children: jsxRuntime.jsxs(StyledDrawerContent, { children: [jsxRuntime.jsxs("div", { children: [search, primaryNav, primaryNav && secondaryNav && (jsxRuntime.jsx(StyledSectionDivider, { hasInvertedStyle: hasInvertedStyle })), secondaryNav] }), buttonsNode] }) }))] }));
|
|
20883
20906
|
});
|
|
20884
20907
|
|
|
20885
20908
|
/**
|
package/dist/index.esm.d.ts
CHANGED
|
@@ -379,6 +379,7 @@ interface Spaces {
|
|
|
379
379
|
l: number;
|
|
380
380
|
xl: number;
|
|
381
381
|
xxl: number;
|
|
382
|
+
xxxl: number;
|
|
382
383
|
}
|
|
383
384
|
/**
|
|
384
385
|
* @deprecated
|
|
@@ -1087,7 +1088,7 @@ interface BannerExtraProps extends CommonThemeProps {
|
|
|
1087
1088
|
type ButtonType$0 = ButtonProps & {
|
|
1088
1089
|
bannerType: string;
|
|
1089
1090
|
} & CommonThemeProps;
|
|
1090
|
-
type BannerIntentType = "info" | "negative" | "notice" | "positive";
|
|
1091
|
+
type BannerIntentType = "accent" | "info" | "negative" | "notice" | "positive";
|
|
1091
1092
|
interface BannerProps extends BannerExtraProps {
|
|
1092
1093
|
children: React.ReactNode;
|
|
1093
1094
|
icon?: keyof IconNameToSizes | React.ReactElement<CustomSVGProps>;
|
|
@@ -1165,7 +1166,7 @@ interface ButtonToggleProps extends ButtonProps$0 {
|
|
|
1165
1166
|
declare const ButtonToggle: React.ForwardRefExoticComponent<Omit<ButtonToggleProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
1166
1167
|
declare const SDS_STAGE_OPEN = "open";
|
|
1167
1168
|
declare const SDS_STAGE_CLOSED = "closed";
|
|
1168
|
-
type CalloutIntentType = "info" | "negative" | "notice" | "positive";
|
|
1169
|
+
type CalloutIntentType = "accent" | "info" | "negative" | "notice" | "positive";
|
|
1169
1170
|
type CalloutSdsStyleType = "persistent" | "expandable" | "dismissible";
|
|
1170
1171
|
interface CalloutProps {
|
|
1171
1172
|
autoDismiss?: boolean | number;
|
|
@@ -1968,6 +1969,7 @@ interface NavigationHeaderPrimaryNavProps<T extends string> {
|
|
|
1968
1969
|
onDrawerStateChange?: (isOpen: boolean) => void;
|
|
1969
1970
|
topOffset?: number;
|
|
1970
1971
|
onClose?: () => void;
|
|
1972
|
+
onDrawerStyleNavItemHover?: (item: NavigationHeaderPrimaryNavItem<T>) => void;
|
|
1971
1973
|
}
|
|
1972
1974
|
interface BaseNavigationHeaderSecondaryNavItem<T extends string> extends Record<string, unknown> {
|
|
1973
1975
|
key: T;
|
|
@@ -2002,6 +2004,7 @@ interface NavigationHeaderSecondaryNavProps<T extends string> {
|
|
|
2002
2004
|
onDrawerStateChange?: (isOpen: boolean) => void;
|
|
2003
2005
|
topOffset?: number;
|
|
2004
2006
|
onClose?: () => void;
|
|
2007
|
+
onDrawerStyleNavItemHover?: (item: NavigationHeaderSecondaryNavItem<T>) => void;
|
|
2005
2008
|
}
|
|
2006
2009
|
interface NavigationHeaderProps<T extends string = string> extends Omit<AppBarProps, "position"> {
|
|
2007
2010
|
activePrimaryNavKey?: string;
|
|
@@ -2025,6 +2028,7 @@ interface NavigationHeaderProps<T extends string = string> extends Omit<AppBarPr
|
|
|
2025
2028
|
setDrawerOpen?: (open: boolean) => void;
|
|
2026
2029
|
menuProps?: Partial<MenuProps$0>;
|
|
2027
2030
|
sdsStyle?: "dropdown" | "drawer";
|
|
2031
|
+
onDrawerStyleNavItemHover?: (item: NavigationHeaderPrimaryNavItem<T> | NavigationHeaderSecondaryNavItem<T>) => void;
|
|
2028
2032
|
isSticky?: boolean;
|
|
2029
2033
|
topComponentSlot?: ReactNode;
|
|
2030
2034
|
}
|
|
@@ -2052,7 +2056,7 @@ interface NavigationJumpToProps extends NavigationJumpToExtraProps {
|
|
|
2052
2056
|
width?: CSSProperties["width"];
|
|
2053
2057
|
}
|
|
2054
2058
|
declare const NavigationJumpTo: React.ForwardRefExoticComponent<Omit<NavigationJumpToProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
2055
|
-
type NotificationIntentType = "info" | "negative" | "positive" | "notice";
|
|
2059
|
+
type NotificationIntentType = "accent" | "info" | "negative" | "positive" | "notice";
|
|
2056
2060
|
interface NotificationProps {
|
|
2057
2061
|
autoDismiss?: boolean | number;
|
|
2058
2062
|
buttonOnClick?: (event: React.SyntheticEvent) => void;
|