@norges-domstoler/dds-components 0.0.0-dev-20250122123924 → 0.0.0-dev-20250124101957

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.js CHANGED
@@ -11473,8 +11473,11 @@ Table.displayName = "Table";
11473
11473
  var import_react140 = require("react");
11474
11474
  var import_jsx_runtime295 = require("react/jsx-runtime");
11475
11475
  var TableWrapper = ({ className, ...rest }) => {
11476
+ const themeContext = (0, import_react140.useContext)(ThemeContext);
11477
+ const container = themeContext == null ? void 0 : themeContext.el;
11478
+ const containerWidth = container ? container.clientWidth : 0;
11476
11479
  const [overflowX, setOverflowX] = (0, import_react140.useState)(false);
11477
- const [windowWidth, setWindowWidth] = (0, import_react140.useState)(window.innerWidth);
11480
+ const [themeContainerWidth, setThemeContainerWidth] = (0, import_react140.useState)(containerWidth);
11478
11481
  function isOverflowingX(event) {
11479
11482
  return event.offsetWidth < event.scrollWidth;
11480
11483
  }
@@ -11485,10 +11488,10 @@ var TableWrapper = ({ className, ...rest }) => {
11485
11488
  return;
11486
11489
  }
11487
11490
  setOverflowX(false);
11488
- }, [windowWidth]);
11491
+ }, [themeContainerWidth]);
11489
11492
  (0, import_react140.useEffect)(() => {
11490
11493
  function handleResize() {
11491
- setWindowWidth(window.innerWidth);
11494
+ setThemeContainerWidth(containerWidth);
11492
11495
  }
11493
11496
  window.addEventListener("resize", handleResize);
11494
11497
  return () => window.removeEventListener("resize", handleResize);