@czi-sds/data-viz 0.14.3 → 0.16.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 +24 -0
- package/dist/index.cjs.js +104 -48
- package/dist/index.esm.d.ts +24 -0
- package/dist/index.esm.js +104 -48
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/index.cjs.d.ts
CHANGED
|
@@ -237,6 +237,30 @@ interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
237
237
|
* Callback when legend selection changes
|
|
238
238
|
*/
|
|
239
239
|
onSelectionChange?: (selectedIndices: number[], selectedData: StackedBarChartDataItem[]) => void;
|
|
240
|
+
/**
|
|
241
|
+
* Callback when mouse enters a bar segment
|
|
242
|
+
*/
|
|
243
|
+
onSegmentMouseEnter?: (item: StackedBarChartDataItem, index: number) => void;
|
|
244
|
+
/**
|
|
245
|
+
* Callback when mouse leaves a bar segment
|
|
246
|
+
*/
|
|
247
|
+
onSegmentMouseLeave?: (item: StackedBarChartDataItem, index: number) => void;
|
|
248
|
+
/**
|
|
249
|
+
* Callback when mouse enters a legend item
|
|
250
|
+
*/
|
|
251
|
+
onLegendItemMouseEnter?: (item: StackedBarChartDataItem, index: number) => void;
|
|
252
|
+
/**
|
|
253
|
+
* Callback when mouse leaves a legend item
|
|
254
|
+
*/
|
|
255
|
+
onLegendItemMouseLeave?: (item: StackedBarChartDataItem, index: number) => void;
|
|
256
|
+
/**
|
|
257
|
+
* Callback when a bar segment is clicked
|
|
258
|
+
*/
|
|
259
|
+
onSegmentClick?: (item: StackedBarChartDataItem, index: number) => void;
|
|
260
|
+
/**
|
|
261
|
+
* Callback when a legend item is clicked
|
|
262
|
+
*/
|
|
263
|
+
onLegendItemClick?: (item: StackedBarChartDataItem, index: number) => void;
|
|
240
264
|
/**
|
|
241
265
|
* Behavior to apply when items are selected
|
|
242
266
|
* - "dim": Non-selected segments become semi-transparent (20% opacity)
|
package/dist/index.cjs.js
CHANGED
|
@@ -989,15 +989,16 @@ const Shadows = {
|
|
|
989
989
|
};
|
|
990
990
|
|
|
991
991
|
const Spaces = {
|
|
992
|
+
xxxs: 2,
|
|
993
|
+
xxs: 4,
|
|
994
|
+
xs: 6,
|
|
995
|
+
s: 8,
|
|
996
|
+
m: 12,
|
|
992
997
|
default: 12,
|
|
993
998
|
l: 16,
|
|
994
|
-
m: 12,
|
|
995
|
-
s: 8,
|
|
996
999
|
xl: 24,
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
xxs: 4,
|
|
1000
|
-
xxxs: 2
|
|
1000
|
+
xxl: 32,
|
|
1001
|
+
xxxl: 40
|
|
1001
1002
|
};
|
|
1002
1003
|
|
|
1003
1004
|
const SDSLightThemeColors = {
|
|
@@ -1760,6 +1761,7 @@ function makeThemeOptions(appTheme, mode) {
|
|
|
1760
1761
|
appTheme.spacing.l,
|
|
1761
1762
|
appTheme.spacing.xl,
|
|
1762
1763
|
appTheme.spacing.xxl,
|
|
1764
|
+
appTheme.spacing.xxxl,
|
|
1763
1765
|
],
|
|
1764
1766
|
transitions: {
|
|
1765
1767
|
duration: {
|
|
@@ -9170,9 +9172,9 @@ const StyledPaper = styled$2__default.default(material.Paper, {
|
|
|
9170
9172
|
background-color: ${semanticColors?.base?.surface};
|
|
9171
9173
|
background-image: none;
|
|
9172
9174
|
box-shadow: ${shadows?.l};
|
|
9173
|
-
max-height: calc(100vh - ${2 * (spaces?.
|
|
9175
|
+
max-height: calc(100vh - ${2 * (spaces?.xxxl || 40)}px);
|
|
9174
9176
|
border-radius: ${corners?.xl}px;
|
|
9175
|
-
padding: ${isSmall ? spaces?.xl : spaces?.
|
|
9177
|
+
padding: ${isSmall ? spaces?.xl : spaces?.xxxl}px;
|
|
9176
9178
|
outline: 1px solid ${addOpacityToHex(semanticColors?.base?.borderSecondary || "#000000", 15)};
|
|
9177
9179
|
`;
|
|
9178
9180
|
}}
|
|
@@ -9222,7 +9224,7 @@ const StyledButton$1 = styled$2__default.default(Button) `
|
|
|
9222
9224
|
const { sdsSize } = props;
|
|
9223
9225
|
const isSmall = sdsSize === "small" || sdsSize === "medium";
|
|
9224
9226
|
const spaces = getSpaces(props);
|
|
9225
|
-
const right = isSmall ? spaces?.xl : spaces?.
|
|
9227
|
+
const right = isSmall ? spaces?.xl : spaces?.xxxl;
|
|
9226
9228
|
return `
|
|
9227
9229
|
right: ${right}px;
|
|
9228
9230
|
`;
|
|
@@ -9322,7 +9324,7 @@ const StyledDialogActions = styled$2__default.default(material.DialogActions, {
|
|
|
9322
9324
|
return `
|
|
9323
9325
|
justify-content: ${buttonPosition === "right" ? "flex-end" : "flex-start"};;
|
|
9324
9326
|
|
|
9325
|
-
margin-top: ${isSmall ? spaces?.xl : spaces?.
|
|
9327
|
+
margin-top: ${isSmall ? spaces?.xl : spaces?.xxxl}px;
|
|
9326
9328
|
|
|
9327
9329
|
&.${material.dialogActionsClasses.spacing} > :not(:first-of-type) {
|
|
9328
9330
|
margin-left: ${spaces?.m}px;
|
|
@@ -9429,16 +9431,16 @@ const getResponsivePadding = (props) => {
|
|
|
9429
9431
|
const spaces = getSpaces(props);
|
|
9430
9432
|
const breakpoints = getBreakpoints(props);
|
|
9431
9433
|
return react.css `
|
|
9432
|
-
padding: ${spaces?.
|
|
9434
|
+
padding: ${spaces?.xxxl}px
|
|
9433
9435
|
${overlayContainerMinMargin?.small || HeroMargins.SMALL};
|
|
9434
9436
|
|
|
9435
9437
|
${breakpoints?.up("md")} {
|
|
9436
|
-
padding: ${spaces?.
|
|
9438
|
+
padding: ${spaces?.xxxl}px
|
|
9437
9439
|
${overlayContainerMinMargin?.medium || HeroMargins.MEDIUM};
|
|
9438
9440
|
}
|
|
9439
9441
|
|
|
9440
9442
|
${breakpoints?.up("lg")} {
|
|
9441
|
-
padding: ${spaces?.
|
|
9443
|
+
padding: ${spaces?.xxxl}px
|
|
9442
9444
|
${overlayContainerMinMargin?.large || HeroMargins.LARGE};
|
|
9443
9445
|
}
|
|
9444
9446
|
`;
|
|
@@ -10530,7 +10532,7 @@ const LegendContainer = styled$2__default.default("div") `
|
|
|
10530
10532
|
`;
|
|
10531
10533
|
const LegendItem = styled$2__default.default("div") `
|
|
10532
10534
|
${(props) => {
|
|
10533
|
-
const { isSelected, disabled } = props;
|
|
10535
|
+
const { isSelected, disabled, isHovered } = props;
|
|
10534
10536
|
const spaces = getSpaces(props);
|
|
10535
10537
|
const semanticColors = getSemanticColors(props);
|
|
10536
10538
|
const corners = getCorners(props);
|
|
@@ -10541,7 +10543,7 @@ const LegendItem = styled$2__default.default("div") `
|
|
|
10541
10543
|
transition: background-color 0.2s ease-in-out;
|
|
10542
10544
|
padding: ${spaces?.xxxs}px ${spaces?.xxs}px;
|
|
10543
10545
|
border-radius: ${corners?.s}px;
|
|
10544
|
-
background-color: ${isSelected ? semanticColors?.base?.backgroundTertiary : "transparent"};
|
|
10546
|
+
background-color: ${isSelected ? semanticColors?.base?.backgroundTertiary : isHovered ? semanticColors?.base?.backgroundSecondary : "transparent"};
|
|
10545
10547
|
pointer-events: ${disabled ? "none" : "auto"};
|
|
10546
10548
|
|
|
10547
10549
|
&:hover {
|
|
@@ -10640,7 +10642,7 @@ const Legend = (props) => {
|
|
|
10640
10642
|
: hasSelection && !isSelected;
|
|
10641
10643
|
// Determine color: use colors prop, then item color, then fallback to gray
|
|
10642
10644
|
const itemColor = colors?.[index] || item.color || fallbackColor;
|
|
10643
|
-
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"
|
|
10645
|
+
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"
|
|
10644
10646
|
? item.value.toLocaleString()
|
|
10645
10647
|
: item.value }))] }, `${item.name}-${index}`));
|
|
10646
10648
|
}) })));
|
|
@@ -17398,6 +17400,7 @@ React.memo(StyledDivider$1);
|
|
|
17398
17400
|
|
|
17399
17401
|
/* eslint-disable sonarjs/cognitive-complexity */
|
|
17400
17402
|
/* eslint-disable sonarjs/no-duplicate-string */
|
|
17403
|
+
const TOOLBAR_HEIGHT = 48;
|
|
17401
17404
|
const doNotForwardProps$a = [
|
|
17402
17405
|
"hasInvertedStyle",
|
|
17403
17406
|
"isNarrow",
|
|
@@ -17413,7 +17416,7 @@ const doNotForwardProps$a = [
|
|
|
17413
17416
|
const StyledTopComponentSlot = styled$2__default.default("div") `
|
|
17414
17417
|
position: sticky;
|
|
17415
17418
|
top: 0;
|
|
17416
|
-
z-index:
|
|
17419
|
+
z-index: 2100;
|
|
17417
17420
|
`;
|
|
17418
17421
|
const StyledAppBar = styled$2__default.default(material.AppBar, {
|
|
17419
17422
|
shouldForwardProp: (prop) => ![...doNotForwardProps$a, "sdsStyle"].includes(prop)
|
|
@@ -17425,7 +17428,7 @@ const StyledAppBar = styled$2__default.default(material.AppBar, {
|
|
|
17425
17428
|
background-image: none;
|
|
17426
17429
|
max-width: 100%;
|
|
17427
17430
|
overflow-x: auto;
|
|
17428
|
-
z-index:
|
|
17431
|
+
z-index: 2100;
|
|
17429
17432
|
`;
|
|
17430
17433
|
}}
|
|
17431
17434
|
`;
|
|
@@ -17454,8 +17457,8 @@ const StyledToolbar = styled$2__default.default(material.Toolbar, {
|
|
|
17454
17457
|
const spaces = getSpaces(props);
|
|
17455
17458
|
return material.css `
|
|
17456
17459
|
&.MuiToolbar-root {
|
|
17457
|
-
min-height:
|
|
17458
|
-
max-height:
|
|
17460
|
+
min-height: ${TOOLBAR_HEIGHT}px;
|
|
17461
|
+
max-height: ${TOOLBAR_HEIGHT}px;
|
|
17459
17462
|
padding: ${spaces?.s}px ${spaces?.l}px;
|
|
17460
17463
|
|
|
17461
17464
|
${isNarrow && NarrowToolbar(props)}
|
|
@@ -17618,7 +17621,7 @@ const StyledTitleContainer = styled$2__default.default("div", {
|
|
|
17618
17621
|
color: ${props.hasInvertedStyle
|
|
17619
17622
|
? colors?.base.textPrimaryOnDark
|
|
17620
17623
|
: colors?.base.textPrimary};
|
|
17621
|
-
margin-right: ${spaces?.
|
|
17624
|
+
margin-right: ${spaces?.xxxl}px;
|
|
17622
17625
|
width: 100%;
|
|
17623
17626
|
|
|
17624
17627
|
${isNarrow && NarrowTitleContainer()}
|
|
@@ -17660,8 +17663,8 @@ const StyledPrimaryNavContainer = styled$2__default.default("div", {
|
|
|
17660
17663
|
const primaryNavPositionWithoutSearch = primaryNavPosition === "left" ? "flex-start" : "flex-end";
|
|
17661
17664
|
return material.css `
|
|
17662
17665
|
flex-direction: ${isNarrow ? "column" : "row"};
|
|
17663
|
-
gap: ${spaces?.
|
|
17664
|
-
margin-right: ${spaces?.
|
|
17666
|
+
gap: ${spaces?.xxxl}px;
|
|
17667
|
+
margin-right: ${spaces?.xxxl}px;
|
|
17665
17668
|
flex: 1;
|
|
17666
17669
|
justify-content: ${showSearch
|
|
17667
17670
|
? primaryNavPositionWithSearch
|
|
@@ -17788,14 +17791,14 @@ const NarrowButtonStyles = (props) => {
|
|
|
17788
17791
|
&::before {
|
|
17789
17792
|
content: "";
|
|
17790
17793
|
position: absolute;
|
|
17791
|
-
height: ${spaces?.
|
|
17794
|
+
height: ${spaces?.xxxl}px;
|
|
17792
17795
|
width: 100%;
|
|
17793
17796
|
background: linear-gradient(
|
|
17794
17797
|
to top,
|
|
17795
17798
|
${backgroundColor} 0%,
|
|
17796
17799
|
${backgroundColor}00 100%
|
|
17797
17800
|
);
|
|
17798
|
-
top: -${spaces?.
|
|
17801
|
+
top: -${spaces?.xxxl}px;
|
|
17799
17802
|
}
|
|
17800
17803
|
|
|
17801
17804
|
.MuiButton-icon .MuiSvgIcon-root {
|
|
@@ -17816,7 +17819,7 @@ const StyledButtonSection = styled$2__default.default("section", {
|
|
|
17816
17819
|
const spaces = getSpaces(props);
|
|
17817
17820
|
return material.css `
|
|
17818
17821
|
gap: ${spaces?.m}px;
|
|
17819
|
-
margin-left: ${spaces?.
|
|
17822
|
+
margin-left: ${spaces?.xxxl}px;
|
|
17820
17823
|
|
|
17821
17824
|
${isNarrow && NarrowButtonStyles(props)}
|
|
17822
17825
|
`;
|
|
@@ -17836,8 +17839,8 @@ const StyledDrawer$1 = styled$2__default.default(material.Drawer, {
|
|
|
17836
17839
|
width: 100%;
|
|
17837
17840
|
display: flex;
|
|
17838
17841
|
flex-direction: column;
|
|
17839
|
-
top: ${topOffset}px;
|
|
17840
|
-
height: calc(100% - ${topOffset}px);
|
|
17842
|
+
top: ${topOffset + TOOLBAR_HEIGHT}px;
|
|
17843
|
+
height: calc(100% - ${topOffset + TOOLBAR_HEIGHT}px);
|
|
17841
17844
|
justify-content: space-between;
|
|
17842
17845
|
}
|
|
17843
17846
|
`;
|
|
@@ -17887,7 +17890,7 @@ const DrawerAccordionStyles = (props) => {
|
|
|
17887
17890
|
&[aria-expanded="true"] {
|
|
17888
17891
|
position: sticky;
|
|
17889
17892
|
border-radius: 0;
|
|
17890
|
-
top:
|
|
17893
|
+
top: ${spaces?.s}px;
|
|
17891
17894
|
z-index: 11;
|
|
17892
17895
|
backdrop-filter: blur(0px);
|
|
17893
17896
|
color: ${textOpenColor};
|
|
@@ -18072,6 +18075,7 @@ const StyledMegaMenuDrawer = styled$2__default.default(material.Drawer, {
|
|
|
18072
18075
|
return material.css `
|
|
18073
18076
|
pointer-events: none;
|
|
18074
18077
|
top: ${topOffset}px;
|
|
18078
|
+
z-index: 2000;
|
|
18075
18079
|
|
|
18076
18080
|
.MuiDrawer-paper {
|
|
18077
18081
|
background-color: ${hasInvertedStyle
|
|
@@ -18084,7 +18088,7 @@ const StyledMegaMenuDrawer = styled$2__default.default(material.Drawer, {
|
|
|
18084
18088
|
box-shadow: 0 8px 8px 0 rgba(0, 0, 0, 0.1);
|
|
18085
18089
|
background-image: none;
|
|
18086
18090
|
padding: ${spaces?.xl ? spaces?.xl + 48 : 48}px ${spaces?.xl}px
|
|
18087
|
-
${spaces?.
|
|
18091
|
+
${spaces?.xxxl}px;
|
|
18088
18092
|
transform: translateY(48px);
|
|
18089
18093
|
top: ${topOffset}px;
|
|
18090
18094
|
}
|
|
@@ -18110,7 +18114,7 @@ const StyledMegaMenuContent = styled$2__default.default("div", {
|
|
|
18110
18114
|
: semanticColors?.base.backgroundPrimary};
|
|
18111
18115
|
display: flex;
|
|
18112
18116
|
flex-wrap: wrap;
|
|
18113
|
-
gap: ${spaces?.
|
|
18117
|
+
gap: ${spaces?.xxxl}px;
|
|
18114
18118
|
width: 100%;
|
|
18115
18119
|
max-width: 1200px;
|
|
18116
18120
|
margin: 0 auto;
|
|
@@ -18129,7 +18133,7 @@ const StyledHoverDrawerColumn = styled$2__default.default("div", {
|
|
|
18129
18133
|
// Account for gaps between columns
|
|
18130
18134
|
const columnsPerRow = totalColumns > 4 ? 4 : totalColumns;
|
|
18131
18135
|
const gapCount = columnsPerRow - 1;
|
|
18132
|
-
const columnWidth = `calc((100% - (${gapCount} * ${spaces?.
|
|
18136
|
+
const columnWidth = `calc((100% - (${gapCount} * ${spaces?.xxxl}px)) / ${columnsPerRow})`;
|
|
18133
18137
|
return material.css `
|
|
18134
18138
|
display: flex;
|
|
18135
18139
|
flex-direction: column;
|
|
@@ -18330,7 +18334,7 @@ const StyledHoverDrawerActions = styled$2__default.default("div", {
|
|
|
18330
18334
|
margin-top: ${spaces?.l}px;
|
|
18331
18335
|
padding-left: ${isNarrow
|
|
18332
18336
|
? `calc(${spaces?.l}px + ${spaces?.m}px)`
|
|
18333
|
-
: `calc(${spaces?.
|
|
18337
|
+
: `calc(${spaces?.xxxl}px + ${spaces?.xs}px)`};
|
|
18334
18338
|
flex-wrap: wrap;
|
|
18335
18339
|
`;
|
|
18336
18340
|
}}
|
|
@@ -19213,9 +19217,10 @@ function useNavigationState() {
|
|
|
19213
19217
|
};
|
|
19214
19218
|
}
|
|
19215
19219
|
|
|
19216
|
-
function NavigationHeaderPrimaryNav({ menuProps, hasInvertedStyle, isNarrow, items, onChange, value, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, }) {
|
|
19220
|
+
function NavigationHeaderPrimaryNav({ menuProps, hasInvertedStyle, isNarrow, items, onChange, value, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, onDrawerStyleNavItemHover, }) {
|
|
19217
19221
|
const theme = material.useTheme();
|
|
19218
19222
|
const { anchorEl, activeDropdownKey, activeDrawerKey, contentKey, isContentFading, open, drawerOpen, buttonRef, menuWidth, setAnchorEl, setActiveDropdownKey, setActiveDrawerKey, setContentKey, onClose: handleClose, onDrawerClose, onDrawerOpen, cancelDrawerClose, } = useNavigationState();
|
|
19223
|
+
const [clickedDrawerKey, setClickedDrawerKey] = React.useState(null);
|
|
19219
19224
|
// Helper function to wrap dropdown items' onClick handlers
|
|
19220
19225
|
// This automatically sets the parent dropdown as active when an item is clicked
|
|
19221
19226
|
const wrapDropdownItemsWithActiveKey = (dropdownItems, parentKey) => {
|
|
@@ -19254,8 +19259,23 @@ function NavigationHeaderPrimaryNav({ menuProps, hasInvertedStyle, isNarrow, ite
|
|
|
19254
19259
|
const handleClick = (e) => {
|
|
19255
19260
|
onChange(key);
|
|
19256
19261
|
parentOnClick?.(e);
|
|
19262
|
+
if (drawerOpen) {
|
|
19263
|
+
setActiveDrawerKey(null);
|
|
19264
|
+
setContentKey(null);
|
|
19265
|
+
setClickedDrawerKey(key);
|
|
19266
|
+
}
|
|
19257
19267
|
};
|
|
19258
|
-
return (jsxRuntime.jsx(StyledHoverDrawerContainer, { onMouseEnter: () =>
|
|
19268
|
+
return (jsxRuntime.jsx(StyledHoverDrawerContainer, { onMouseEnter: () => {
|
|
19269
|
+
onDrawerStyleNavItemHover?.(item);
|
|
19270
|
+
if (clickedDrawerKey !== key) {
|
|
19271
|
+
onDrawerOpen(key);
|
|
19272
|
+
}
|
|
19273
|
+
}, onMouseLeave: () => {
|
|
19274
|
+
if (clickedDrawerKey === key) {
|
|
19275
|
+
setClickedDrawerKey(null);
|
|
19276
|
+
}
|
|
19277
|
+
onDrawerClose();
|
|
19278
|
+
}, 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));
|
|
19259
19279
|
};
|
|
19260
19280
|
const renderDropdownItem = (item, key, label, parentOnClick, rest) => {
|
|
19261
19281
|
const isDropdownOpen = open && activeDropdownKey === key;
|
|
@@ -19498,7 +19518,7 @@ const StyledTag = styled$2__default.default(Tag) `
|
|
|
19498
19518
|
margin: 0;
|
|
19499
19519
|
`;
|
|
19500
19520
|
|
|
19501
|
-
function NavigationHeaderSecondaryNav({ menuProps, items, hasInvertedStyle, isNarrow, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, }) {
|
|
19521
|
+
function NavigationHeaderSecondaryNav({ menuProps, items, hasInvertedStyle, isNarrow, sdsStyle = "dropdown", expandedAccordion, setExpandedAccordion, accordionRefs, scrollToAccordion, onDrawerStateChange, topOffset = 0, onClose: onCloseProp, onDrawerStyleNavItemHover, }) {
|
|
19502
19522
|
const theme = material.useTheme();
|
|
19503
19523
|
const { anchorEl, activeDropdownKey, activeDrawerKey, contentKey, isContentFading, open, drawerOpen, buttonRef, menuWidth, setAnchorEl, setActiveDropdownKey, setActiveDrawerKey, setContentKey, onClose: handleClose, onDrawerClose, onDrawerOpen, cancelDrawerClose, } = useNavigationState();
|
|
19504
19524
|
function onClose() {
|
|
@@ -19522,7 +19542,10 @@ function NavigationHeaderSecondaryNav({ menuProps, items, hasInvertedStyle, isNa
|
|
|
19522
19542
|
const handleClick = (e) => {
|
|
19523
19543
|
parentOnClick?.(e);
|
|
19524
19544
|
};
|
|
19525
|
-
return (jsxRuntime.jsx(StyledHoverDrawerContainer, { onMouseEnter: () =>
|
|
19545
|
+
return (jsxRuntime.jsx(StyledHoverDrawerContainer, { onMouseEnter: () => {
|
|
19546
|
+
onDrawerStyleNavItemHover?.(item);
|
|
19547
|
+
onDrawerOpen(key);
|
|
19548
|
+
}, 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));
|
|
19526
19549
|
};
|
|
19527
19550
|
const renderDropdownItem = (item, key, label, parentOnClick, rest) => {
|
|
19528
19551
|
const isDropdownOpen = open && activeDropdownKey === key;
|
|
@@ -19694,7 +19717,7 @@ React.forwardRef((props, ref) => {
|
|
|
19694
19717
|
const { activePrimaryNavKey: controlledActivePrimaryNavKey, buttons, sdsStyle = "dropdown", menuProps = {
|
|
19695
19718
|
disableScrollLock: true,
|
|
19696
19719
|
disablePortal: true
|
|
19697
|
-
}, 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;
|
|
19720
|
+
}, 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;
|
|
19698
19721
|
const navRef = React.useRef(null);
|
|
19699
19722
|
const topSlotRef = React.useRef(null);
|
|
19700
19723
|
const [topOffset, setTopOffset] = React.useState(0);
|
|
@@ -19847,11 +19870,11 @@ React.forwardRef((props, ref) => {
|
|
|
19847
19870
|
};
|
|
19848
19871
|
const renderPrimaryNav = () => {
|
|
19849
19872
|
return (primaryNavItems &&
|
|
19850
|
-
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) })));
|
|
19873
|
+
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 })));
|
|
19851
19874
|
};
|
|
19852
19875
|
const renderSecondaryNav = () => {
|
|
19853
19876
|
return (secondaryNavItems &&
|
|
19854
|
-
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) })));
|
|
19877
|
+
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 })));
|
|
19855
19878
|
};
|
|
19856
19879
|
const renderButtonsNode = () => {
|
|
19857
19880
|
if (!buttons || buttons.length === 0)
|
|
@@ -19931,7 +19954,7 @@ React.forwardRef((props, ref) => {
|
|
|
19931
19954
|
const position = sdsStyle === "drawer" ? "sticky" : isSticky ? "sticky" : "relative";
|
|
19932
19955
|
// Disable elevation when drawer style is active and any drawer is open
|
|
19933
19956
|
const effectiveScrollElevation = scrollElevation && !(sdsStyle === "drawer" && isAnyDrawerOpen);
|
|
19934
|
-
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.
|
|
19957
|
+
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] }) }))] }));
|
|
19935
19958
|
});
|
|
19936
19959
|
|
|
19937
19960
|
/**
|
|
@@ -24981,7 +25004,7 @@ var renderBarSegment = function (item, index, options) {
|
|
|
24981
25004
|
};
|
|
24982
25005
|
var StackedBarChart = function (props) {
|
|
24983
25006
|
var _a, _b, _c;
|
|
24984
|
-
var title = props.title, badge = props.badge, _d = props.hideBadge, hideBadge = _d === void 0 ? false : _d, data = props.data, _e = props.width, width = _e === void 0 ? "100%" : _e, _f = props.barHeight, barHeightProp = _f === void 0 ? 16 : _f, _g = props.showLegend, showLegend = _g === void 0 ? true : _g, _h = props.showLegendValues, showLegendValues = _h === void 0 ? true : _h, _j = props.legendValueFormat, legendValueFormat = _j === void 0 ? "percentage" : _j, _k = props.selectedIndices, selectedIndices = _k === void 0 ? [] : _k, onSelectionChange = props.onSelectionChange, _l = props.selectionBehavior, selectionBehavior = _l === void 0 ? "dim" : _l, _m = props.mode, mode = _m === void 0 ? "proportional" : _m, maxAmount = props.maxAmount, _o = props.remainingLabel, remainingLabel = _o === void 0 ? "Remaining" : _o, remainingUnit = props.remainingUnit, unit = props.unit, colorGeneratorOptions = props.colorGeneratorOptions, rest = __rest(props, ["title", "badge", "hideBadge", "data", "width", "barHeight", "showLegend", "showLegendValues", "legendValueFormat", "selectedIndices", "onSelectionChange", "selectionBehavior", "mode", "maxAmount", "remainingLabel", "remainingUnit", "unit", "colorGeneratorOptions"]);
|
|
25007
|
+
var title = props.title, badge = props.badge, _d = props.hideBadge, hideBadge = _d === void 0 ? false : _d, data = props.data, _e = props.width, width = _e === void 0 ? "100%" : _e, _f = props.barHeight, barHeightProp = _f === void 0 ? 16 : _f, _g = props.showLegend, showLegend = _g === void 0 ? true : _g, _h = props.showLegendValues, showLegendValues = _h === void 0 ? true : _h, _j = props.legendValueFormat, legendValueFormat = _j === void 0 ? "percentage" : _j, _k = props.selectedIndices, selectedIndices = _k === void 0 ? [] : _k, onSelectionChange = props.onSelectionChange, onSegmentMouseEnter = props.onSegmentMouseEnter, onSegmentMouseLeave = props.onSegmentMouseLeave, onLegendItemMouseEnter = props.onLegendItemMouseEnter, onLegendItemMouseLeave = props.onLegendItemMouseLeave, onSegmentClick = props.onSegmentClick, onLegendItemClick = props.onLegendItemClick, _l = props.selectionBehavior, selectionBehavior = _l === void 0 ? "dim" : _l, _m = props.mode, mode = _m === void 0 ? "proportional" : _m, maxAmount = props.maxAmount, _o = props.remainingLabel, remainingLabel = _o === void 0 ? "Remaining" : _o, remainingUnit = props.remainingUnit, unit = props.unit, colorGeneratorOptions = props.colorGeneratorOptions, rest = __rest(props, ["title", "badge", "hideBadge", "data", "width", "barHeight", "showLegend", "showLegendValues", "legendValueFormat", "selectedIndices", "onSelectionChange", "onSegmentMouseEnter", "onSegmentMouseLeave", "onLegendItemMouseEnter", "onLegendItemMouseLeave", "onSegmentClick", "onLegendItemClick", "selectionBehavior", "mode", "maxAmount", "remainingLabel", "remainingUnit", "unit", "colorGeneratorOptions"]);
|
|
24985
25008
|
// Ensure barHeight is at least 1px
|
|
24986
25009
|
var barHeight = Math.max(1, barHeightProp);
|
|
24987
25010
|
var theme = material.useTheme();
|
|
@@ -25214,8 +25237,24 @@ var StackedBarChart = function (props) {
|
|
|
25214
25237
|
theme,
|
|
25215
25238
|
]);
|
|
25216
25239
|
// Handle legend item hover and leave
|
|
25217
|
-
var handleLegendItemHover = React.useCallback(function (_item, index) {
|
|
25218
|
-
|
|
25240
|
+
var handleLegendItemHover = React.useCallback(function (_item, index) {
|
|
25241
|
+
setHoveredIndex(index);
|
|
25242
|
+
if (onLegendItemMouseEnter && data[index]) {
|
|
25243
|
+
onLegendItemMouseEnter(data[index], index);
|
|
25244
|
+
}
|
|
25245
|
+
}, [onLegendItemMouseEnter, data]);
|
|
25246
|
+
var handleLegendItemLeave = React.useCallback(function (_item, index) {
|
|
25247
|
+
setHoveredIndex(null);
|
|
25248
|
+
if (onLegendItemMouseLeave && data[index]) {
|
|
25249
|
+
onLegendItemMouseLeave(data[index], index);
|
|
25250
|
+
}
|
|
25251
|
+
}, [onLegendItemMouseLeave, data]);
|
|
25252
|
+
// Handle legend item click
|
|
25253
|
+
var handleLegendItemClickInternal = React.useCallback(function (_item, index) {
|
|
25254
|
+
if (onLegendItemClick && data[index]) {
|
|
25255
|
+
onLegendItemClick(data[index], index);
|
|
25256
|
+
}
|
|
25257
|
+
}, [onLegendItemClick, data]);
|
|
25219
25258
|
// Handle selection change - reusable logic for both segment and legend
|
|
25220
25259
|
var handleSelectionChange = React.useCallback(function (newSelectedIndices) {
|
|
25221
25260
|
if (!onSelectionChange)
|
|
@@ -25225,8 +25264,13 @@ var StackedBarChart = function (props) {
|
|
|
25225
25264
|
});
|
|
25226
25265
|
onSelectionChange(newSelectedIndices, selectedData);
|
|
25227
25266
|
}, [onSelectionChange, data]);
|
|
25228
|
-
// Handle segment click - toggle selection
|
|
25267
|
+
// Handle segment click - toggle selection and call onSegmentClick
|
|
25229
25268
|
var handleSegmentClick = React.useCallback(function (index) {
|
|
25269
|
+
// Call onSegmentClick callback if provided
|
|
25270
|
+
if (onSegmentClick && data[index]) {
|
|
25271
|
+
onSegmentClick(data[index], index);
|
|
25272
|
+
}
|
|
25273
|
+
// Handle selection change
|
|
25230
25274
|
if (!onSelectionChange)
|
|
25231
25275
|
return;
|
|
25232
25276
|
var isSelected = selectedIndicesSet.has(index);
|
|
@@ -25236,6 +25280,8 @@ var StackedBarChart = function (props) {
|
|
|
25236
25280
|
handleSelectionChange(newSelectedIndices);
|
|
25237
25281
|
}, [
|
|
25238
25282
|
onSelectionChange,
|
|
25283
|
+
onSegmentClick,
|
|
25284
|
+
data,
|
|
25239
25285
|
selectedIndices,
|
|
25240
25286
|
selectedIndicesSet,
|
|
25241
25287
|
handleSelectionChange,
|
|
@@ -25258,14 +25304,24 @@ var StackedBarChart = function (props) {
|
|
|
25258
25304
|
selectionBehavior: selectionBehavior,
|
|
25259
25305
|
isLast: isLastVisible,
|
|
25260
25306
|
onMouseEnter: function () {
|
|
25261
|
-
|
|
25307
|
+
if (!item.isExiting) {
|
|
25308
|
+
setHoveredIndex(item.originalIndex);
|
|
25309
|
+
if (onSegmentMouseEnter && data[item.originalIndex]) {
|
|
25310
|
+
onSegmentMouseEnter(data[item.originalIndex], item.originalIndex);
|
|
25311
|
+
}
|
|
25312
|
+
}
|
|
25313
|
+
},
|
|
25314
|
+
onMouseLeave: function () {
|
|
25315
|
+
setHoveredIndex(null);
|
|
25316
|
+
if (onSegmentMouseLeave && data[item.originalIndex]) {
|
|
25317
|
+
onSegmentMouseLeave(data[item.originalIndex], item.originalIndex);
|
|
25318
|
+
}
|
|
25262
25319
|
},
|
|
25263
|
-
onMouseLeave: function () { return setHoveredIndex(null); },
|
|
25264
25320
|
onClick: function () {
|
|
25265
25321
|
return !item.isExiting && handleSegmentClick(item.originalIndex);
|
|
25266
25322
|
},
|
|
25267
25323
|
});
|
|
25268
|
-
}), hasRemaining && (jsxRuntime.jsx(BarSegment, { color: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.sds) === null || _b === void 0 ? void 0 : _b.base) === null || _c === void 0 ? void 0 : _c.backgroundTertiary, percentage: displayRemainingPercentage, height: barHeight, isLast: true, opacity: 1, disabled: true }, "remaining"))] }), showLegend && (jsxRuntime.jsx(Legend, { items: legendItems, showValues: showLegendValues, onItemMouseEnter: handleLegendItemHover, onItemMouseLeave: handleLegendItemLeave, selectedIndices: selectedIndices, onSelectionChange: onSelectionChange ? handleSelectionChange : undefined, hoveredIndex: hoveredIndex }))] }));
|
|
25324
|
+
}), hasRemaining && (jsxRuntime.jsx(BarSegment, { color: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.sds) === null || _b === void 0 ? void 0 : _b.base) === null || _c === void 0 ? void 0 : _c.backgroundTertiary, percentage: displayRemainingPercentage, height: barHeight, isLast: true, opacity: 1, disabled: true }, "remaining"))] }), showLegend && (jsxRuntime.jsx(Legend, { items: legendItems, showValues: showLegendValues, onItemMouseEnter: handleLegendItemHover, onItemMouseLeave: handleLegendItemLeave, onItemClick: onLegendItemClick ? handleLegendItemClickInternal : undefined, selectedIndices: selectedIndices, onSelectionChange: onSelectionChange ? handleSelectionChange : undefined, hoveredIndex: hoveredIndex }))] }));
|
|
25269
25325
|
// If no title, render chart and optional legend without wrapper
|
|
25270
25326
|
if (!title) {
|
|
25271
25327
|
return (jsxRuntime.jsx(ChartWrapper, __assign$1({ width: width }, rest, { children: chartContent })));
|
package/dist/index.esm.d.ts
CHANGED
|
@@ -237,6 +237,30 @@ interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
237
237
|
* Callback when legend selection changes
|
|
238
238
|
*/
|
|
239
239
|
onSelectionChange?: (selectedIndices: number[], selectedData: StackedBarChartDataItem[]) => void;
|
|
240
|
+
/**
|
|
241
|
+
* Callback when mouse enters a bar segment
|
|
242
|
+
*/
|
|
243
|
+
onSegmentMouseEnter?: (item: StackedBarChartDataItem, index: number) => void;
|
|
244
|
+
/**
|
|
245
|
+
* Callback when mouse leaves a bar segment
|
|
246
|
+
*/
|
|
247
|
+
onSegmentMouseLeave?: (item: StackedBarChartDataItem, index: number) => void;
|
|
248
|
+
/**
|
|
249
|
+
* Callback when mouse enters a legend item
|
|
250
|
+
*/
|
|
251
|
+
onLegendItemMouseEnter?: (item: StackedBarChartDataItem, index: number) => void;
|
|
252
|
+
/**
|
|
253
|
+
* Callback when mouse leaves a legend item
|
|
254
|
+
*/
|
|
255
|
+
onLegendItemMouseLeave?: (item: StackedBarChartDataItem, index: number) => void;
|
|
256
|
+
/**
|
|
257
|
+
* Callback when a bar segment is clicked
|
|
258
|
+
*/
|
|
259
|
+
onSegmentClick?: (item: StackedBarChartDataItem, index: number) => void;
|
|
260
|
+
/**
|
|
261
|
+
* Callback when a legend item is clicked
|
|
262
|
+
*/
|
|
263
|
+
onLegendItemClick?: (item: StackedBarChartDataItem, index: number) => void;
|
|
240
264
|
/**
|
|
241
265
|
* Behavior to apply when items are selected
|
|
242
266
|
* - "dim": Non-selected segments become semi-transparent (20% opacity)
|