@norges-domstoler/dds-components 23.0.0 → 23.0.1

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
@@ -633,6 +633,7 @@ interface FloatingStyles {
633
633
  }
634
634
  interface UseFloatPosition {
635
635
  refs: UseFloatingReturn['refs'];
636
+ isPositioned: boolean;
636
637
  styles: {
637
638
  floating: FloatingStyles;
638
639
  arrow: {
package/dist/index.d.ts CHANGED
@@ -633,6 +633,7 @@ interface FloatingStyles {
633
633
  }
634
634
  interface UseFloatPosition {
635
635
  refs: UseFloatingReturn['refs'];
636
+ isPositioned: boolean;
636
637
  styles: {
637
638
  floating: FloatingStyles;
638
639
  arrow: {
package/dist/index.js CHANGED
@@ -642,7 +642,8 @@ var useFloatPosition = (arrowRef, options = {}) => {
642
642
  strategy,
643
643
  middlewareData,
644
644
  placement: actualPlacement,
645
- refs
645
+ refs,
646
+ isPositioned
646
647
  } = (0, import_react_dom.useFloating)({
647
648
  placement,
648
649
  middleware,
@@ -650,6 +651,7 @@ var useFloatPosition = (arrowRef, options = {}) => {
650
651
  });
651
652
  return {
652
653
  refs,
654
+ isPositioned,
653
655
  styles: {
654
656
  floating: {
655
657
  position: strategy,
@@ -13101,7 +13103,11 @@ var Popover = ({
13101
13103
  ref,
13102
13104
  ...rest
13103
13105
  }) => {
13104
- const { refs, styles: positionStyles } = useFloatPosition(null, {
13106
+ const {
13107
+ refs,
13108
+ styles: positionStyles,
13109
+ isPositioned: localIsPositioned
13110
+ } = useFloatPosition(null, {
13105
13111
  offset,
13106
13112
  placement
13107
13113
  });
@@ -13111,6 +13117,7 @@ var Popover = ({
13111
13117
  const portalTarget = parentElement != null ? parentElement : themeContext == null ? void 0 : themeContext.el;
13112
13118
  const {
13113
13119
  floatStyling: contextFloatStyling,
13120
+ isPositioned: contextIsPositioned,
13114
13121
  setFloatOptions,
13115
13122
  floatingRef: contextFloatingRef,
13116
13123
  popoverId: contextPopoverId,
@@ -13128,28 +13135,31 @@ var Popover = ({
13128
13135
  isOpen = false,
13129
13136
  floatingRef,
13130
13137
  floatStyling,
13131
- onClose
13138
+ onClose,
13139
+ isPositioned = false
13132
13140
  ] = hasContext ? [
13133
13141
  contextPopoverId,
13134
13142
  contextAnchorEl,
13135
13143
  contextIsOpen,
13136
13144
  contextFloatingRef,
13137
13145
  contextFloatStyling,
13138
- contextOnClose
13146
+ contextOnClose,
13147
+ contextIsPositioned
13139
13148
  ] : [
13140
13149
  uniquePopoverId,
13141
13150
  (anchorRef == null ? void 0 : anchorRef.current) && anchorRef.current,
13142
13151
  propIsOpen,
13143
13152
  refs.setFloating,
13144
13153
  positionStyles.floating,
13145
- propOnClose
13154
+ propOnClose,
13155
+ localIsPositioned
13146
13156
  ];
13147
13157
  if (!hasContext) {
13148
13158
  refs.setReference(anchorEl || null);
13149
13159
  }
13150
13160
  const hasTransitionedIn = useMountTransition(isOpen, 400);
13151
13161
  const popoverRef = useReturnFocusOnBlur(
13152
- isOpen && hasTransitionedIn && returnFocusOnBlur,
13162
+ isOpen && hasTransitionedIn && isPositioned && returnFocusOnBlur,
13153
13163
  () => {
13154
13164
  onClose == null ? void 0 : onClose();
13155
13165
  onBlur == null ? void 0 : onBlur();
@@ -13244,7 +13254,11 @@ var PopoverGroup = ({
13244
13254
  const generatedId = (0, import_react80.useId)();
13245
13255
  const uniquePopoverId = popoverId != null ? popoverId : `${generatedId}-popover`;
13246
13256
  const [floatOptions, setFloatOptions] = (0, import_react80.useState)();
13247
- const { refs, styles: positionStyles } = useFloatPosition(null, floatOptions);
13257
+ const {
13258
+ refs,
13259
+ styles: positionStyles,
13260
+ isPositioned
13261
+ } = useFloatPosition(null, floatOptions);
13248
13262
  const handleClose = () => {
13249
13263
  setOpen(false);
13250
13264
  onClose == null ? void 0 : onClose();
@@ -13293,6 +13307,7 @@ var PopoverGroup = ({
13293
13307
  {
13294
13308
  value: {
13295
13309
  floatStyling: positionStyles.floating,
13310
+ isPositioned,
13296
13311
  setFloatOptions,
13297
13312
  floatingRef: combinedPopoverRef,
13298
13313
  popoverId: uniquePopoverId,