@norges-domstoler/dds-components 19.0.0 → 19.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.mjs CHANGED
@@ -4459,7 +4459,7 @@ var CalendarPopoverContent = ({
4459
4459
  if (!themeContext) {
4460
4460
  throw new Error("DatePicker must be used within a ThemeProvider");
4461
4461
  }
4462
- const portalTarget = themeContext == null ? void 0 : themeContext.el;
4462
+ const portalTarget = themeContext.el;
4463
4463
  const { isOpen, onClose, anchorRef, closeButtonRef } = useContext4(
4464
4464
  CalendarPopoverContext
4465
4465
  );
@@ -4471,14 +4471,18 @@ var CalendarPopoverContent = ({
4471
4471
  var _a;
4472
4472
  refs.setReference((_a = anchorRef == null ? void 0 : anchorRef.current) != null ? _a : null);
4473
4473
  }, []);
4474
+ const hasBreakpoint = !!smallScreenBreakpoint;
4474
4475
  useEffect16(() => {
4475
- if (isOpen) {
4476
- handleElementWithBackdropMount(document.body);
4477
- } else {
4478
- handleElementWithBackdropUnmount(document.body);
4476
+ var _a;
4477
+ if (hasBreakpoint && ((_a = modalRef.current) == null ? void 0 : _a.checkVisibility())) {
4478
+ if (isOpen) {
4479
+ handleElementWithBackdropMount(document.body);
4480
+ } else {
4481
+ handleElementWithBackdropUnmount(document.body);
4482
+ }
4483
+ return () => handleElementWithBackdropUnmount(document.body);
4479
4484
  }
4480
- return () => handleElementWithBackdropUnmount(document.body);
4481
- }, [isOpen]);
4485
+ }, [isOpen, hasBreakpoint]);
4482
4486
  const closeOnKeyboardBlurBack = (event) => {
4483
4487
  if (event.key === "Tab" && event.shiftKey === true) {
4484
4488
  onClose();
@@ -4486,7 +4490,7 @@ var CalendarPopoverContent = ({
4486
4490
  };
4487
4491
  if (!isOpen) return null;
4488
4492
  return /* @__PURE__ */ jsxs34(Fragment3, { children: [
4489
- portalTarget && createPortal(
4493
+ portalTarget && hasBreakpoint && createPortal(
4490
4494
  /* @__PURE__ */ jsx207(
4491
4495
  "div",
4492
4496
  {
@@ -11637,6 +11641,7 @@ import { createContext as createContext13, useContext as useContext20 } from "re
11637
11641
  var TabsContext = createContext13({
11638
11642
  activeTab: 0,
11639
11643
  tabsId: "",
11644
+ size: "small",
11640
11645
  handleTabChange: () => null,
11641
11646
  tabListRef: null,
11642
11647
  tabPanelsRef: null,
@@ -11654,6 +11659,10 @@ var Tabs_default = {
11654
11659
  "tab-row--standard-widths": "Tabs_tab-row--standard-widths",
11655
11660
  "tab-row--custom-widths": "Tabs_tab-row--custom-widths",
11656
11661
  tab: "Tabs_tab",
11662
+ "tab--medium--row": "Tabs_tab--medium--row",
11663
+ "tab--small--row": "Tabs_tab--small--row",
11664
+ "tab--medium--column": "Tabs_tab--medium--column",
11665
+ "tab--small--column": "Tabs_tab--small--column",
11657
11666
  "tab--row": "Tabs_tab--row",
11658
11667
  "tab--column": "Tabs_tab--column",
11659
11668
  "tab--active": "Tabs_tab--active",
@@ -11711,7 +11720,7 @@ var AddTabButton = forwardRef101(
11711
11720
  useSetTabWidth(index, width);
11712
11721
  const buttonRef = useRef34(null);
11713
11722
  const combinedRef = useCombinedRef(ref, buttonRef);
11714
- const { tabContentDirection } = useTabsContext();
11723
+ const { tabContentDirection, size: size2 } = useTabsContext();
11715
11724
  return /* @__PURE__ */ jsxs76(
11716
11725
  "button",
11717
11726
  {
@@ -11721,7 +11730,7 @@ var AddTabButton = forwardRef101(
11721
11730
  className,
11722
11731
  Tabs_default.tab,
11723
11732
  Tabs_default[`tab--${tabContentDirection}`],
11724
- typographyStyles_default[getTypographyCn(defaultTypographyType)],
11733
+ typographyStyles_default[`body-${size2}`],
11725
11734
  focus_default["focusable--inset"]
11726
11735
  ),
11727
11736
  children: [
@@ -11749,6 +11758,7 @@ var Tabs = forwardRef102((props, ref) => {
11749
11758
  activeTab,
11750
11759
  onChange,
11751
11760
  tabContentDirection = "row",
11761
+ size: size2 = "small",
11752
11762
  addTabButtonProps,
11753
11763
  width,
11754
11764
  children,
@@ -11781,6 +11791,7 @@ var Tabs = forwardRef102((props, ref) => {
11781
11791
  value: {
11782
11792
  tabsId: uniqueId,
11783
11793
  activeTab: thisActiveTab,
11794
+ size: size2,
11784
11795
  handleTabChange,
11785
11796
  tabListRef,
11786
11797
  tabPanelsRef,
@@ -11835,7 +11846,7 @@ var Tab = forwardRef103((props, ref) => {
11835
11846
  useSetTabWidth(index, width);
11836
11847
  const itemRef = useRef36(null);
11837
11848
  const combinedRef = useCombinedRef(ref, itemRef);
11838
- const { tabContentDirection } = useTabsContext();
11849
+ const { tabContentDirection, size: size2 } = useTabsContext();
11839
11850
  useEffect32(() => {
11840
11851
  var _a;
11841
11852
  if (focus) {
@@ -11863,9 +11874,10 @@ var Tab = forwardRef103((props, ref) => {
11863
11874
  cn(
11864
11875
  className,
11865
11876
  Tabs_default.tab,
11877
+ Tabs_default[`tab--${size2}--${tabContentDirection}`],
11866
11878
  active && Tabs_default["tab--active"],
11867
11879
  Tabs_default[`tab--${tabContentDirection}`],
11868
- typographyStyles_default[getTypographyCn(defaultTypographyType)],
11880
+ typographyStyles_default[`body-${size2}`],
11869
11881
  focus_default["focusable--inset"]
11870
11882
  ),
11871
11883
  htmlProps,
@@ -11919,7 +11931,11 @@ var TabList = forwardRef104(
11919
11931
  index,
11920
11932
  focus: focus === index && hasTabFocus,
11921
11933
  setFocus,
11922
- onClick: () => handleTabChange(index)
11934
+ onClick: () => {
11935
+ var _a, _b;
11936
+ handleTabChange(index);
11937
+ (_b = (_a = child.props).onClick) == null ? void 0 : _b.call(_a);
11938
+ }
11923
11939
  });
11924
11940
  }) : [];
11925
11941
  if (hasButton && tabListChildren) {