@norges-domstoler/dds-components 0.0.0-dev-20250306095911 → 0.0.0-dev-20250331113238

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.d.mts CHANGED
@@ -2164,6 +2164,14 @@ type PopoverProps = BaseComponentPropsWithChildren<HTMLDivElement, {
2164
2164
  * @default "bottom"
2165
2165
  */
2166
2166
  placement?: Placement;
2167
+ /**Angir rotnode hvor popover skal rendres.
2168
+ * @default themeProviderRef
2169
+ */
2170
+ parentElement?: HTMLElement;
2171
+ /**Angir om popover skal rendre i en portal eller ikke.
2172
+ * @default "false"
2173
+ */
2174
+ portal?: boolean;
2167
2175
  /**Avstand fra anchor-elementet i px.
2168
2176
  * @default 8
2169
2177
  */
@@ -2184,7 +2192,7 @@ type PopoverProps = BaseComponentPropsWithChildren<HTMLDivElement, {
2184
2192
  onClose?: () => void;
2185
2193
  }>;
2186
2194
  declare const Popover: {
2187
- ({ id, header, withCloseButton, onBlur, children, placement, offset, sizeProps, returnFocusOnBlur, className, htmlProps, anchorRef, isOpen: propIsOpen, onClose: propOnClose, ref, ...rest }: PopoverProps): react_jsx_runtime.JSX.Element | null;
2195
+ ({ id, header, withCloseButton, onBlur, children, placement, parentElement, portal, offset, sizeProps, returnFocusOnBlur, className, htmlProps, anchorRef, isOpen: propIsOpen, onClose: propOnClose, ref, ...rest }: PopoverProps): react_jsx_runtime.JSX.Element | null;
2188
2196
  displayName: string;
2189
2197
  };
2190
2198
 
@@ -2757,6 +2765,7 @@ declare const Tabs: {
2757
2765
  displayName: string;
2758
2766
  };
2759
2767
 
2768
+ type PickedAttributes = Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>;
2760
2769
  type TabProps = BaseComponentPropsWithChildren<HTMLButtonElement, {
2761
2770
  /**Spesifiserer om fanen er aktiv.
2762
2771
  * @default false
@@ -2774,7 +2783,7 @@ type TabProps = BaseComponentPropsWithChildren<HTMLButtonElement, {
2774
2783
  * @default "1fr"
2775
2784
  */
2776
2785
  width?: CSS.Properties['width'];
2777
- } & Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>>;
2786
+ } & PickedAttributes, Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof PickedAttributes>>;
2778
2787
  declare const Tab: {
2779
2788
  ({ active, icon, children, focus, setFocus, index, onClick, onKeyDown, id, className, htmlProps, width, ref, ...rest }: TabProps): react_jsx_runtime.JSX.Element;
2780
2789
  displayName: string;
package/dist/index.d.ts CHANGED
@@ -2164,6 +2164,14 @@ type PopoverProps = BaseComponentPropsWithChildren<HTMLDivElement, {
2164
2164
  * @default "bottom"
2165
2165
  */
2166
2166
  placement?: Placement;
2167
+ /**Angir rotnode hvor popover skal rendres.
2168
+ * @default themeProviderRef
2169
+ */
2170
+ parentElement?: HTMLElement;
2171
+ /**Angir om popover skal rendre i en portal eller ikke.
2172
+ * @default "false"
2173
+ */
2174
+ portal?: boolean;
2167
2175
  /**Avstand fra anchor-elementet i px.
2168
2176
  * @default 8
2169
2177
  */
@@ -2184,7 +2192,7 @@ type PopoverProps = BaseComponentPropsWithChildren<HTMLDivElement, {
2184
2192
  onClose?: () => void;
2185
2193
  }>;
2186
2194
  declare const Popover: {
2187
- ({ id, header, withCloseButton, onBlur, children, placement, offset, sizeProps, returnFocusOnBlur, className, htmlProps, anchorRef, isOpen: propIsOpen, onClose: propOnClose, ref, ...rest }: PopoverProps): react_jsx_runtime.JSX.Element | null;
2195
+ ({ id, header, withCloseButton, onBlur, children, placement, parentElement, portal, offset, sizeProps, returnFocusOnBlur, className, htmlProps, anchorRef, isOpen: propIsOpen, onClose: propOnClose, ref, ...rest }: PopoverProps): react_jsx_runtime.JSX.Element | null;
2188
2196
  displayName: string;
2189
2197
  };
2190
2198
 
@@ -2757,6 +2765,7 @@ declare const Tabs: {
2757
2765
  displayName: string;
2758
2766
  };
2759
2767
 
2768
+ type PickedAttributes = Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>;
2760
2769
  type TabProps = BaseComponentPropsWithChildren<HTMLButtonElement, {
2761
2770
  /**Spesifiserer om fanen er aktiv.
2762
2771
  * @default false
@@ -2774,7 +2783,7 @@ type TabProps = BaseComponentPropsWithChildren<HTMLButtonElement, {
2774
2783
  * @default "1fr"
2775
2784
  */
2776
2785
  width?: CSS.Properties['width'];
2777
- } & Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown'>>;
2786
+ } & PickedAttributes, Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof PickedAttributes>>;
2778
2787
  declare const Tab: {
2779
2788
  ({ active, icon, children, focus, setFocus, index, onClick, onKeyDown, id, className, htmlProps, width, ref, ...rest }: TabProps): react_jsx_runtime.JSX.Element;
2780
2789
  displayName: string;
package/dist/index.js CHANGED
@@ -9606,6 +9606,7 @@ var getCallingCode = (s) => {
9606
9606
 
9607
9607
  // src/components/Popover/Popover.tsx
9608
9608
  var import_react61 = require("react");
9609
+ var import_react_dom5 = require("react-dom");
9609
9610
 
9610
9611
  // src/components/Popover/Popover.module.css
9611
9612
  var Popover_default = {
@@ -9629,6 +9630,8 @@ var Popover = ({
9629
9630
  onBlur,
9630
9631
  children,
9631
9632
  placement = "bottom",
9633
+ parentElement,
9634
+ portal = false,
9632
9635
  offset = 8,
9633
9636
  sizeProps,
9634
9637
  returnFocusOnBlur = true,
@@ -9645,6 +9648,8 @@ var Popover = ({
9645
9648
  placement
9646
9649
  });
9647
9650
  const context = usePopoverContext();
9651
+ const themeContext = (0, import_react61.useContext)(ThemeContext);
9652
+ const portalTarget = parentElement != null ? parentElement : themeContext == null ? void 0 : themeContext.el;
9648
9653
  const {
9649
9654
  floatStyling: contextFloatStyling,
9650
9655
  setFloatOptions,
@@ -9703,7 +9708,7 @@ var Popover = ({
9703
9708
  });
9704
9709
  const hasTitle = !!header;
9705
9710
  const openCn = hasTransitionedIn && isOpen ? "open" : "closed";
9706
- return isOpen || hasTransitionedIn ? /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
9711
+ const popover = /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
9707
9712
  Paper,
9708
9713
  {
9709
9714
  ...getBaseHTMLProps(
@@ -9750,7 +9755,8 @@ var Popover = ({
9750
9755
  )
9751
9756
  ]
9752
9757
  }
9753
- ) : null;
9758
+ );
9759
+ return isOpen || hasTransitionedIn ? portal && portalTarget ? (0, import_react_dom5.createPortal)(popover, portalTarget) : popover : null;
9754
9760
  };
9755
9761
  Popover.displayName = "Popover";
9756
9762
 
@@ -11663,7 +11669,7 @@ var Tab = ({
11663
11669
  onKeyDown,
11664
11670
  id,
11665
11671
  className,
11666
- htmlProps,
11672
+ htmlProps = {},
11667
11673
  width = "1fr",
11668
11674
  ref,
11669
11675
  ...rest
@@ -11672,6 +11678,8 @@ var Tab = ({
11672
11678
  const itemRef = (0, import_react86.useRef)(null);
11673
11679
  const combinedRef = useCombinedRef(ref, itemRef);
11674
11680
  const { tabContentDirection, size: size2 } = useTabsContext();
11681
+ const { type = "button", ...restHtmlProps } = htmlProps;
11682
+ const fixedHtmlProps = { type, ...restHtmlProps };
11675
11683
  (0, import_react86.useEffect)(() => {
11676
11684
  var _a;
11677
11685
  if (focus) {
@@ -11685,11 +11693,11 @@ var Tab = ({
11685
11693
  }, [index, setFocus]);
11686
11694
  const handleOnClick = (e) => {
11687
11695
  handleSelect();
11688
- onClick && onClick(e);
11696
+ onClick == null ? void 0 : onClick(e);
11689
11697
  };
11690
11698
  const handleOnKeyDown = (e) => {
11691
11699
  handleSelect();
11692
- onKeyDown && onKeyDown(e);
11700
+ onKeyDown == null ? void 0 : onKeyDown(e);
11693
11701
  };
11694
11702
  return /* @__PURE__ */ (0, import_jsx_runtime302.jsxs)(
11695
11703
  "button",
@@ -11705,7 +11713,7 @@ var Tab = ({
11705
11713
  typographyStyles_default[`body-${size2}`],
11706
11714
  focus_default["focusable--inset"]
11707
11715
  ),
11708
- htmlProps,
11716
+ fixedHtmlProps,
11709
11717
  rest
11710
11718
  ),
11711
11719
  ref: combinedRef,
@@ -11755,6 +11763,7 @@ var TabList = ({
11755
11763
  return (0, import_react87.isValidElement)(child) && (0, import_react87.cloneElement)(child, {
11756
11764
  id: `${tabsId}-tab-${index}`,
11757
11765
  htmlProps: {
11766
+ ...child.props.htmlProps,
11758
11767
  "aria-controls": `${tabsId}-panel-${index}`
11759
11768
  },
11760
11769
  active: activeTab === index,