@norges-domstoler/dds-components 0.0.0-dev-20250221073416 → 0.0.0-dev-20250221075132

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
@@ -4767,7 +4767,7 @@ var CalendarPopoverContent = ({
4767
4767
  if (!themeContext) {
4768
4768
  throw new Error("DatePicker must be used within a ThemeProvider");
4769
4769
  }
4770
- const portalTarget = themeContext == null ? void 0 : themeContext.el;
4770
+ const portalTarget = themeContext.el;
4771
4771
  const { isOpen, onClose, anchorRef, closeButtonRef } = (0, import_react53.useContext)(
4772
4772
  CalendarPopoverContext
4773
4773
  );
@@ -4779,14 +4779,18 @@ var CalendarPopoverContent = ({
4779
4779
  var _a;
4780
4780
  refs.setReference((_a = anchorRef == null ? void 0 : anchorRef.current) != null ? _a : null);
4781
4781
  }, []);
4782
+ const hasBreakpoint = !!smallScreenBreakpoint;
4782
4783
  (0, import_react53.useEffect)(() => {
4783
- if (isOpen) {
4784
- handleElementWithBackdropMount(document.body);
4785
- } else {
4786
- handleElementWithBackdropUnmount(document.body);
4784
+ var _a;
4785
+ if (hasBreakpoint && ((_a = modalRef.current) == null ? void 0 : _a.checkVisibility())) {
4786
+ if (isOpen) {
4787
+ handleElementWithBackdropMount(document.body);
4788
+ } else {
4789
+ handleElementWithBackdropUnmount(document.body);
4790
+ }
4791
+ return () => handleElementWithBackdropUnmount(document.body);
4787
4792
  }
4788
- return () => handleElementWithBackdropUnmount(document.body);
4789
- }, [isOpen]);
4793
+ }, [isOpen, hasBreakpoint]);
4790
4794
  const closeOnKeyboardBlurBack = (event) => {
4791
4795
  if (event.key === "Tab" && event.shiftKey === true) {
4792
4796
  onClose();
@@ -4794,7 +4798,7 @@ var CalendarPopoverContent = ({
4794
4798
  };
4795
4799
  if (!isOpen) return null;
4796
4800
  return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_jsx_runtime207.Fragment, { children: [
4797
- portalTarget && (0, import_react_dom2.createPortal)(
4801
+ portalTarget && hasBreakpoint && (0, import_react_dom2.createPortal)(
4798
4802
  /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
4799
4803
  "div",
4800
4804
  {