@czi-sds/components 22.5.3 → 22.5.4

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.
@@ -1634,6 +1634,7 @@ type IconButtonProps = SdsIconButtonProps & {
1634
1634
  };
1635
1635
  declare const NavigationHeader: React.ForwardRefExoticComponent<Omit<NavigationHeaderProps<string>, "ref"> & React.RefAttributes<HTMLDivElement>>;
1636
1636
  interface NavigationJumpToExtraProps extends Omit<TabsProps, "onChange">, CommonThemeProps {
1637
+ width?: CSSProperties["width"];
1637
1638
  }
1638
1639
  type Item = {
1639
1640
  title: string;
@@ -1643,6 +1644,7 @@ interface NavigationJumpToProps extends NavigationJumpToExtraProps {
1643
1644
  items: Array<Item>;
1644
1645
  offsetTop?: number;
1645
1646
  onChange?: (value: number, event?: React.SyntheticEvent, type?: "click" | "scroll") => void;
1647
+ width?: CSSProperties["width"];
1646
1648
  }
1647
1649
  declare const NavigationJumpTo: React.ForwardRefExoticComponent<Omit<NavigationJumpToProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
1648
1650
  type NotificationIntentType = "info" | "negative" | "positive" | "notice";
package/dist/index.cjs.js CHANGED
@@ -15093,14 +15093,15 @@ var useScrollStopListener = function (callback, timeout) {
15093
15093
  }, [timeout]);
15094
15094
  };
15095
15095
 
15096
- var doNotForwardProps$5 = ["items", "sdsIndicatorColor"];
15096
+ var doNotForwardProps$5 = ["items", "sdsIndicatorColor", "width"];
15097
15097
  var StyledTabs$1 = styled__default.default(material.Tabs, {
15098
15098
  shouldForwardProp: function (prop) { return !doNotForwardProps$5.includes(prop); },
15099
15099
  })(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
15100
15100
  var _a, _b;
15101
+ var _c = props.width, width = _c === void 0 ? "180px" : _c;
15101
15102
  var spaces = getSpaces(props);
15102
15103
  var semanticColors = getSemanticColors(props);
15103
- return "\n &:before {\n background-color: ".concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.divider, ";\n border-radius: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n content: \"\";\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n }\n\n max-width: 180px;\n top: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xl, "px;\n margin-bottom: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n margin-right: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n position: sticky;\n overflow: visible;\n\n .").concat(material.tabsClasses.indicator, " {\n background-color: ").concat((_b = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.accent) === null || _b === void 0 ? void 0 : _b.borderSelected, " !important;\n border-radius: 2px;\n left: 0;\n width: 2px;\n }\n\n .").concat(material.tabsClasses.scroller, " {\n overflow: visible !important;\n }\n ");
15104
+ return "\n &:before {\n background-color: ".concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.divider, ";\n border-radius: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n content: \"\";\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n }\n\n width: ").concat(width, ";\n top: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xl, "px;\n margin-bottom: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n margin-right: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n position: sticky;\n overflow: visible;\n\n .").concat(material.tabsClasses.indicator, " {\n background-color: ").concat((_b = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.accent) === null || _b === void 0 ? void 0 : _b.borderSelected, " !important;\n border-radius: 2px;\n left: 0;\n width: 2px;\n }\n\n .").concat(material.tabsClasses.scroller, " {\n overflow: visible !important;\n }\n ");
15104
15105
  });
15105
15106
  var StyledTab$1 = styled__default.default(material.Tab, {
15106
15107
  shouldForwardProp: function (prop) { return !doNotForwardProps$5.includes(prop); },
@@ -15108,7 +15109,7 @@ var StyledTab$1 = styled__default.default(material.Tab, {
15108
15109
  var _a, _b, _c;
15109
15110
  var spaces = getSpaces(props);
15110
15111
  var semanticColors = getSemanticColors(props);
15111
- return "\n ".concat(focusVisibleA11yStyle(props), "\n box-sizing: border-box;\n max-width: 180px;\n padding-left: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n margin: 0 ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n align-items: start;\n min-height: unset;\n max-height: unset;\n text-transform: none;\n &:last-child {\n margin-bottom: 0;\n }\n &:before {\n content: \"\";\n position: absolute;\n left: -").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n width: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n height: 100%;\n background-color: ").concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.borderPrimary, ";\n display: none;\n border-radius: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n }\n &:hover {\n color: ").concat((_b = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _b === void 0 ? void 0 : _b.textPrimary, ";\n &:before {\n display: block;\n }\n }\n &.Mui-selected {\n color: ").concat((_c = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _c === void 0 ? void 0 : _c.textPrimary, ";\n font-weight: 600;\n }\n &.MuiButtonBase-root {\n white-space: nowrap;\n padding: 0;\n overflow: visible;\n }\n ");
15112
+ return "\n ".concat(focusVisibleA11yStyle(props), "\n box-sizing: border-box;\n padding-left: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n margin: 0 ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n align-items: start;\n min-height: unset;\n max-height: unset;\n text-transform: none;\n &:last-child {\n margin-bottom: 0;\n }\n &:before {\n content: \"\";\n position: absolute;\n left: -").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n width: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n height: 100%;\n background-color: ").concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.borderPrimary, ";\n display: none;\n border-radius: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n }\n &:hover {\n color: ").concat((_b = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _b === void 0 ? void 0 : _b.textPrimary, ";\n &:before {\n display: block;\n }\n }\n &.Mui-selected {\n color: ").concat((_c = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _c === void 0 ? void 0 : _c.textPrimary, ";\n font-weight: 600;\n }\n &.MuiButtonBase-root {\n text-align: left;\n padding: 0;\n overflow: visible;\n }\n ");
15112
15113
  });
15113
15114
  var templateObject_1$f, templateObject_2$8;
15114
15115
 
@@ -15116,9 +15117,12 @@ var templateObject_1$f, templateObject_2$8;
15116
15117
  * Custom hook that observes elements to determine if they are in the viewport.
15117
15118
  *
15118
15119
  * @param items - Array of items to observe.
15120
+ * @param offsetTop - Offset from the top of the viewport to consider when
15121
+ * determining if an element is in view. The default is 0.
15119
15122
  * @returns Object containing the visibility status of each observed item.
15120
15123
  */
15121
- function useInView(items) {
15124
+ function useInView(items, offsetTop) {
15125
+ if (offsetTop === void 0) { offsetTop = 0; }
15122
15126
  var _a = React.useState({}), elements = _a[0], setElements = _a[1];
15123
15127
  React.useEffect(function () {
15124
15128
  /**
@@ -15139,7 +15143,9 @@ function useInView(items) {
15139
15143
  });
15140
15144
  });
15141
15145
  };
15142
- var observer = new IntersectionObserver(observerCallback);
15146
+ var observer = new IntersectionObserver(observerCallback, {
15147
+ rootMargin: "-".concat(offsetTop, "px 0px 0px 0px"),
15148
+ });
15143
15149
  // Observe each item's element
15144
15150
  items.forEach(function (item) {
15145
15151
  if (item.elementRef.current) {
@@ -15150,7 +15156,7 @@ function useInView(items) {
15150
15156
  return function () {
15151
15157
  observer.disconnect();
15152
15158
  };
15153
- }, [items]);
15159
+ }, [items, offsetTop]);
15154
15160
  // If the window object is not available (e.g., in a node environment) or
15155
15161
  // If the IntersectionObserver is not available (e.g., in a test environment),
15156
15162
  // return a default result indicating that all elements are not in view
@@ -15165,31 +15171,23 @@ function useInView(items) {
15165
15171
  return elements;
15166
15172
  }
15167
15173
 
15174
+ var scrollIntoViewWithOffset = function (selector, offset) {
15175
+ var element = document.querySelector(selector);
15176
+ if (!element)
15177
+ return;
15178
+ window.scrollTo({
15179
+ behavior: "smooth",
15180
+ top: element.getBoundingClientRect().top -
15181
+ document.body.getBoundingClientRect().top -
15182
+ offset,
15183
+ });
15184
+ };
15168
15185
  var NavigationJumpTo = React.forwardRef(function (props, ref) {
15169
- var items = props.items, _a = props.offsetTop, offsetTop = _a === void 0 ? 0 : _a, onChange = props.onChange, rest = __rest(props, ["items", "offsetTop", "onChange"]);
15186
+ var items = props.items, _a = props.offsetTop, offsetTop = _a === void 0 ? 0 : _a, onChange = props.onChange, width = props.width, rest = __rest(props, ["items", "offsetTop", "onChange", "width"]);
15170
15187
  var _b = React.useState(false), navItemClicked = _b[0], setNavItemClicked = _b[1];
15171
15188
  var _c = React.useState(0), firstTabIndexInview = _c[0], setFirstTabIndexInview = _c[1];
15172
15189
  var _d = React.useState(-1), emittedValue = _d[0], setEmittedValue = _d[1];
15173
- var sectionIsInView = useInView(items);
15174
- React.useEffect(function () {
15175
- items.forEach(function (item) {
15176
- var _a, _b;
15177
- if (offsetTop) {
15178
- var wrapper = document.createElement("div");
15179
- wrapper.style.position = "relative";
15180
- var hiddenDiv = document.createElement("div");
15181
- hiddenDiv.style.height = "".concat(offsetTop, "px");
15182
- hiddenDiv.style.top = "-".concat(offsetTop, "px");
15183
- hiddenDiv.style.position = "absolute";
15184
- hiddenDiv.style.pointerEvents = "none";
15185
- hiddenDiv.setAttribute("id", "".concat((_a = item.elementRef.current) === null || _a === void 0 ? void 0 : _a.getAttribute("id"), "-hiddenDiv"));
15186
- wrapper.appendChild(hiddenDiv);
15187
- (_b = item.elementRef.current) === null || _b === void 0 ? void 0 : _b.before(wrapper);
15188
- if (item.elementRef.current)
15189
- wrapper.appendChild(item.elementRef.current);
15190
- }
15191
- });
15192
- }, [items, offsetTop]);
15190
+ var sectionIsInView = useInView(items, offsetTop);
15193
15191
  var a11yProps = function (title, elementId) {
15194
15192
  return {
15195
15193
  "aria-controls": elementId,
@@ -15210,11 +15208,7 @@ var NavigationJumpTo = React.forwardRef(function (props, ref) {
15210
15208
  setNavItemClicked(true);
15211
15209
  // Smoothly scroll to the section of the page referenced by the clicked nav item
15212
15210
  if (offsetTop) {
15213
- var hiddenDiv = document.getElementById("".concat((_c = (_b = (_a = items[newValue]) === null || _a === void 0 ? void 0 : _a.elementRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.getAttribute("id"), "-hiddenDiv"));
15214
- hiddenDiv === null || hiddenDiv === void 0 ? void 0 : hiddenDiv.scrollIntoView({
15215
- behavior: "smooth",
15216
- block: "start",
15217
- });
15211
+ scrollIntoViewWithOffset("#".concat((_c = (_b = (_a = items[newValue]) === null || _a === void 0 ? void 0 : _a.elementRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.getAttribute("id")), offsetTop);
15218
15212
  }
15219
15213
  else {
15220
15214
  (_f = (_e = (_d = items[newValue]) === null || _d === void 0 ? void 0 : _d.elementRef) === null || _e === void 0 ? void 0 : _e.current) === null || _f === void 0 ? void 0 : _f.scrollIntoView({
@@ -15243,16 +15237,17 @@ var NavigationJumpTo = React.forwardRef(function (props, ref) {
15243
15237
  type: "scroll",
15244
15238
  }, "scroll");
15245
15239
  }
15246
- }, [handleOnChange, items, navItemClicked, sectionIsInView]);
15240
+ // eslint-disable-next-line react-hooks/exhaustive-deps
15241
+ }, [handleOnChange, items, sectionIsInView]);
15247
15242
  // Set navItemClicked to false to re-enable the option
15248
15243
  // to update the tab value based on scroll.
15249
15244
  useScrollStopListener(function () {
15250
15245
  setNavItemClicked(false);
15251
15246
  });
15252
- return (jsxRuntime.jsx(StyledTabs$1, __assign({ ref: ref, orientation: "vertical", variant: "fullWidth", value: firstTabIndexInview, onChange: handleChange, "aria-label": "navigation-jump-to" }, rest, { children: items.map(function (_a, index) {
15247
+ return (jsxRuntime.jsx(StyledTabs$1, __assign({ ref: ref, orientation: "vertical", variant: "fullWidth", value: firstTabIndexInview, onChange: handleChange, "aria-label": "navigation-jump-to", width: width }, rest, { children: items.map(function (_a, index) {
15253
15248
  var _b;
15254
15249
  var title = _a.title, elementRef = _a.elementRef;
15255
- return (jsxRuntime.jsx(StyledTab$1, __assign({ label: title, tabIndex: 0 }, a11yProps(toKebabCase(title), ((_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.getAttribute("id")) ||
15250
+ return (jsxRuntime.jsx(StyledTab$1, __assign({ label: title, tabIndex: 0, width: width }, a11yProps(toKebabCase(title), ((_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.getAttribute("id")) ||
15256
15251
  "navigation-panel-".concat(index + 1))), toKebabCase(title)));
15257
15252
  }) })));
15258
15253
  });
@@ -1634,6 +1634,7 @@ type IconButtonProps = SdsIconButtonProps & {
1634
1634
  };
1635
1635
  declare const NavigationHeader: React.ForwardRefExoticComponent<Omit<NavigationHeaderProps<string>, "ref"> & React.RefAttributes<HTMLDivElement>>;
1636
1636
  interface NavigationJumpToExtraProps extends Omit<TabsProps, "onChange">, CommonThemeProps {
1637
+ width?: CSSProperties["width"];
1637
1638
  }
1638
1639
  type Item = {
1639
1640
  title: string;
@@ -1643,6 +1644,7 @@ interface NavigationJumpToProps extends NavigationJumpToExtraProps {
1643
1644
  items: Array<Item>;
1644
1645
  offsetTop?: number;
1645
1646
  onChange?: (value: number, event?: React.SyntheticEvent, type?: "click" | "scroll") => void;
1647
+ width?: CSSProperties["width"];
1646
1648
  }
1647
1649
  declare const NavigationJumpTo: React.ForwardRefExoticComponent<Omit<NavigationJumpToProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
1648
1650
  type NotificationIntentType = "info" | "negative" | "positive" | "notice";
package/dist/index.esm.js CHANGED
@@ -15070,14 +15070,15 @@ var useScrollStopListener = function (callback, timeout) {
15070
15070
  }, [timeout]);
15071
15071
  };
15072
15072
 
15073
- var doNotForwardProps$5 = ["items", "sdsIndicatorColor"];
15073
+ var doNotForwardProps$5 = ["items", "sdsIndicatorColor", "width"];
15074
15074
  var StyledTabs$1 = styled$2(Tabs$1, {
15075
15075
  shouldForwardProp: function (prop) { return !doNotForwardProps$5.includes(prop); },
15076
15076
  })(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
15077
15077
  var _a, _b;
15078
+ var _c = props.width, width = _c === void 0 ? "180px" : _c;
15078
15079
  var spaces = getSpaces(props);
15079
15080
  var semanticColors = getSemanticColors(props);
15080
- return "\n &:before {\n background-color: ".concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.divider, ";\n border-radius: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n content: \"\";\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n }\n\n max-width: 180px;\n top: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xl, "px;\n margin-bottom: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n margin-right: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n position: sticky;\n overflow: visible;\n\n .").concat(tabsClasses.indicator, " {\n background-color: ").concat((_b = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.accent) === null || _b === void 0 ? void 0 : _b.borderSelected, " !important;\n border-radius: 2px;\n left: 0;\n width: 2px;\n }\n\n .").concat(tabsClasses.scroller, " {\n overflow: visible !important;\n }\n ");
15081
+ return "\n &:before {\n background-color: ".concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.divider, ";\n border-radius: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n content: \"\";\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n }\n\n width: ").concat(width, ";\n top: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xl, "px;\n margin-bottom: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n margin-right: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px;\n position: sticky;\n overflow: visible;\n\n .").concat(tabsClasses.indicator, " {\n background-color: ").concat((_b = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.accent) === null || _b === void 0 ? void 0 : _b.borderSelected, " !important;\n border-radius: 2px;\n left: 0;\n width: 2px;\n }\n\n .").concat(tabsClasses.scroller, " {\n overflow: visible !important;\n }\n ");
15081
15082
  });
15082
15083
  var StyledTab$1 = styled$2(Tab$1, {
15083
15084
  shouldForwardProp: function (prop) { return !doNotForwardProps$5.includes(prop); },
@@ -15085,7 +15086,7 @@ var StyledTab$1 = styled$2(Tab$1, {
15085
15086
  var _a, _b, _c;
15086
15087
  var spaces = getSpaces(props);
15087
15088
  var semanticColors = getSemanticColors(props);
15088
- return "\n ".concat(focusVisibleA11yStyle(props), "\n box-sizing: border-box;\n max-width: 180px;\n padding-left: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n margin: 0 ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n align-items: start;\n min-height: unset;\n max-height: unset;\n text-transform: none;\n &:last-child {\n margin-bottom: 0;\n }\n &:before {\n content: \"\";\n position: absolute;\n left: -").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n width: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n height: 100%;\n background-color: ").concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.borderPrimary, ";\n display: none;\n border-radius: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n }\n &:hover {\n color: ").concat((_b = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _b === void 0 ? void 0 : _b.textPrimary, ";\n &:before {\n display: block;\n }\n }\n &.Mui-selected {\n color: ").concat((_c = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _c === void 0 ? void 0 : _c.textPrimary, ";\n font-weight: 600;\n }\n &.MuiButtonBase-root {\n white-space: nowrap;\n padding: 0;\n overflow: visible;\n }\n ");
15089
+ return "\n ".concat(focusVisibleA11yStyle(props), "\n box-sizing: border-box;\n padding-left: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n margin: 0 ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.m, "px ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n align-items: start;\n min-height: unset;\n max-height: unset;\n text-transform: none;\n &:last-child {\n margin-bottom: 0;\n }\n &:before {\n content: \"\";\n position: absolute;\n left: -").concat(spaces === null || spaces === void 0 ? void 0 : spaces.l, "px;\n width: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n height: 100%;\n background-color: ").concat((_a = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _a === void 0 ? void 0 : _a.borderPrimary, ";\n display: none;\n border-radius: ").concat(spaces === null || spaces === void 0 ? void 0 : spaces.xxxs, "px;\n }\n &:hover {\n color: ").concat((_b = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _b === void 0 ? void 0 : _b.textPrimary, ";\n &:before {\n display: block;\n }\n }\n &.Mui-selected {\n color: ").concat((_c = semanticColors === null || semanticColors === void 0 ? void 0 : semanticColors.base) === null || _c === void 0 ? void 0 : _c.textPrimary, ";\n font-weight: 600;\n }\n &.MuiButtonBase-root {\n text-align: left;\n padding: 0;\n overflow: visible;\n }\n ");
15089
15090
  });
15090
15091
  var templateObject_1$f, templateObject_2$8;
15091
15092
 
@@ -15093,9 +15094,12 @@ var templateObject_1$f, templateObject_2$8;
15093
15094
  * Custom hook that observes elements to determine if they are in the viewport.
15094
15095
  *
15095
15096
  * @param items - Array of items to observe.
15097
+ * @param offsetTop - Offset from the top of the viewport to consider when
15098
+ * determining if an element is in view. The default is 0.
15096
15099
  * @returns Object containing the visibility status of each observed item.
15097
15100
  */
15098
- function useInView(items) {
15101
+ function useInView(items, offsetTop) {
15102
+ if (offsetTop === void 0) { offsetTop = 0; }
15099
15103
  var _a = useState({}), elements = _a[0], setElements = _a[1];
15100
15104
  useEffect(function () {
15101
15105
  /**
@@ -15116,7 +15120,9 @@ function useInView(items) {
15116
15120
  });
15117
15121
  });
15118
15122
  };
15119
- var observer = new IntersectionObserver(observerCallback);
15123
+ var observer = new IntersectionObserver(observerCallback, {
15124
+ rootMargin: "-".concat(offsetTop, "px 0px 0px 0px"),
15125
+ });
15120
15126
  // Observe each item's element
15121
15127
  items.forEach(function (item) {
15122
15128
  if (item.elementRef.current) {
@@ -15127,7 +15133,7 @@ function useInView(items) {
15127
15133
  return function () {
15128
15134
  observer.disconnect();
15129
15135
  };
15130
- }, [items]);
15136
+ }, [items, offsetTop]);
15131
15137
  // If the window object is not available (e.g., in a node environment) or
15132
15138
  // If the IntersectionObserver is not available (e.g., in a test environment),
15133
15139
  // return a default result indicating that all elements are not in view
@@ -15142,31 +15148,23 @@ function useInView(items) {
15142
15148
  return elements;
15143
15149
  }
15144
15150
 
15151
+ var scrollIntoViewWithOffset = function (selector, offset) {
15152
+ var element = document.querySelector(selector);
15153
+ if (!element)
15154
+ return;
15155
+ window.scrollTo({
15156
+ behavior: "smooth",
15157
+ top: element.getBoundingClientRect().top -
15158
+ document.body.getBoundingClientRect().top -
15159
+ offset,
15160
+ });
15161
+ };
15145
15162
  var NavigationJumpTo = forwardRef(function (props, ref) {
15146
- var items = props.items, _a = props.offsetTop, offsetTop = _a === void 0 ? 0 : _a, onChange = props.onChange, rest = __rest(props, ["items", "offsetTop", "onChange"]);
15163
+ var items = props.items, _a = props.offsetTop, offsetTop = _a === void 0 ? 0 : _a, onChange = props.onChange, width = props.width, rest = __rest(props, ["items", "offsetTop", "onChange", "width"]);
15147
15164
  var _b = useState(false), navItemClicked = _b[0], setNavItemClicked = _b[1];
15148
15165
  var _c = useState(0), firstTabIndexInview = _c[0], setFirstTabIndexInview = _c[1];
15149
15166
  var _d = useState(-1), emittedValue = _d[0], setEmittedValue = _d[1];
15150
- var sectionIsInView = useInView(items);
15151
- useEffect(function () {
15152
- items.forEach(function (item) {
15153
- var _a, _b;
15154
- if (offsetTop) {
15155
- var wrapper = document.createElement("div");
15156
- wrapper.style.position = "relative";
15157
- var hiddenDiv = document.createElement("div");
15158
- hiddenDiv.style.height = "".concat(offsetTop, "px");
15159
- hiddenDiv.style.top = "-".concat(offsetTop, "px");
15160
- hiddenDiv.style.position = "absolute";
15161
- hiddenDiv.style.pointerEvents = "none";
15162
- hiddenDiv.setAttribute("id", "".concat((_a = item.elementRef.current) === null || _a === void 0 ? void 0 : _a.getAttribute("id"), "-hiddenDiv"));
15163
- wrapper.appendChild(hiddenDiv);
15164
- (_b = item.elementRef.current) === null || _b === void 0 ? void 0 : _b.before(wrapper);
15165
- if (item.elementRef.current)
15166
- wrapper.appendChild(item.elementRef.current);
15167
- }
15168
- });
15169
- }, [items, offsetTop]);
15167
+ var sectionIsInView = useInView(items, offsetTop);
15170
15168
  var a11yProps = function (title, elementId) {
15171
15169
  return {
15172
15170
  "aria-controls": elementId,
@@ -15187,11 +15185,7 @@ var NavigationJumpTo = forwardRef(function (props, ref) {
15187
15185
  setNavItemClicked(true);
15188
15186
  // Smoothly scroll to the section of the page referenced by the clicked nav item
15189
15187
  if (offsetTop) {
15190
- var hiddenDiv = document.getElementById("".concat((_c = (_b = (_a = items[newValue]) === null || _a === void 0 ? void 0 : _a.elementRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.getAttribute("id"), "-hiddenDiv"));
15191
- hiddenDiv === null || hiddenDiv === void 0 ? void 0 : hiddenDiv.scrollIntoView({
15192
- behavior: "smooth",
15193
- block: "start",
15194
- });
15188
+ scrollIntoViewWithOffset("#".concat((_c = (_b = (_a = items[newValue]) === null || _a === void 0 ? void 0 : _a.elementRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.getAttribute("id")), offsetTop);
15195
15189
  }
15196
15190
  else {
15197
15191
  (_f = (_e = (_d = items[newValue]) === null || _d === void 0 ? void 0 : _d.elementRef) === null || _e === void 0 ? void 0 : _e.current) === null || _f === void 0 ? void 0 : _f.scrollIntoView({
@@ -15220,16 +15214,17 @@ var NavigationJumpTo = forwardRef(function (props, ref) {
15220
15214
  type: "scroll",
15221
15215
  }, "scroll");
15222
15216
  }
15223
- }, [handleOnChange, items, navItemClicked, sectionIsInView]);
15217
+ // eslint-disable-next-line react-hooks/exhaustive-deps
15218
+ }, [handleOnChange, items, sectionIsInView]);
15224
15219
  // Set navItemClicked to false to re-enable the option
15225
15220
  // to update the tab value based on scroll.
15226
15221
  useScrollStopListener(function () {
15227
15222
  setNavItemClicked(false);
15228
15223
  });
15229
- return (jsx(StyledTabs$1, __assign({ ref: ref, orientation: "vertical", variant: "fullWidth", value: firstTabIndexInview, onChange: handleChange, "aria-label": "navigation-jump-to" }, rest, { children: items.map(function (_a, index) {
15224
+ return (jsx(StyledTabs$1, __assign({ ref: ref, orientation: "vertical", variant: "fullWidth", value: firstTabIndexInview, onChange: handleChange, "aria-label": "navigation-jump-to", width: width }, rest, { children: items.map(function (_a, index) {
15230
15225
  var _b;
15231
15226
  var title = _a.title, elementRef = _a.elementRef;
15232
- return (jsx(StyledTab$1, __assign({ label: title, tabIndex: 0 }, a11yProps(toKebabCase(title), ((_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.getAttribute("id")) ||
15227
+ return (jsx(StyledTab$1, __assign({ label: title, tabIndex: 0, width: width }, a11yProps(toKebabCase(title), ((_b = elementRef.current) === null || _b === void 0 ? void 0 : _b.getAttribute("id")) ||
15233
15228
  "navigation-panel-".concat(index + 1))), toKebabCase(title)));
15234
15229
  }) })));
15235
15230
  });