@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.mjs CHANGED
@@ -237,7 +237,8 @@ var useFloatPosition = (arrowRef, options = {}) => {
237
237
  strategy,
238
238
  middlewareData,
239
239
  placement: actualPlacement,
240
- refs
240
+ refs,
241
+ isPositioned
241
242
  } = useFloating({
242
243
  placement,
243
244
  middleware,
@@ -245,6 +246,7 @@ var useFloatPosition = (arrowRef, options = {}) => {
245
246
  });
246
247
  return {
247
248
  refs,
249
+ isPositioned,
248
250
  styles: {
249
251
  floating: {
250
252
  position: strategy,
@@ -12803,7 +12805,11 @@ var Popover = ({
12803
12805
  ref,
12804
12806
  ...rest
12805
12807
  }) => {
12806
- const { refs, styles: positionStyles } = useFloatPosition(null, {
12808
+ const {
12809
+ refs,
12810
+ styles: positionStyles,
12811
+ isPositioned: localIsPositioned
12812
+ } = useFloatPosition(null, {
12807
12813
  offset,
12808
12814
  placement
12809
12815
  });
@@ -12813,6 +12819,7 @@ var Popover = ({
12813
12819
  const portalTarget = parentElement != null ? parentElement : themeContext == null ? void 0 : themeContext.el;
12814
12820
  const {
12815
12821
  floatStyling: contextFloatStyling,
12822
+ isPositioned: contextIsPositioned,
12816
12823
  setFloatOptions,
12817
12824
  floatingRef: contextFloatingRef,
12818
12825
  popoverId: contextPopoverId,
@@ -12830,28 +12837,31 @@ var Popover = ({
12830
12837
  isOpen = false,
12831
12838
  floatingRef,
12832
12839
  floatStyling,
12833
- onClose
12840
+ onClose,
12841
+ isPositioned = false
12834
12842
  ] = hasContext ? [
12835
12843
  contextPopoverId,
12836
12844
  contextAnchorEl,
12837
12845
  contextIsOpen,
12838
12846
  contextFloatingRef,
12839
12847
  contextFloatStyling,
12840
- contextOnClose
12848
+ contextOnClose,
12849
+ contextIsPositioned
12841
12850
  ] : [
12842
12851
  uniquePopoverId,
12843
12852
  (anchorRef == null ? void 0 : anchorRef.current) && anchorRef.current,
12844
12853
  propIsOpen,
12845
12854
  refs.setFloating,
12846
12855
  positionStyles.floating,
12847
- propOnClose
12856
+ propOnClose,
12857
+ localIsPositioned
12848
12858
  ];
12849
12859
  if (!hasContext) {
12850
12860
  refs.setReference(anchorEl || null);
12851
12861
  }
12852
12862
  const hasTransitionedIn = useMountTransition(isOpen, 400);
12853
12863
  const popoverRef = useReturnFocusOnBlur(
12854
- isOpen && hasTransitionedIn && returnFocusOnBlur,
12864
+ isOpen && hasTransitionedIn && isPositioned && returnFocusOnBlur,
12855
12865
  () => {
12856
12866
  onClose == null ? void 0 : onClose();
12857
12867
  onBlur == null ? void 0 : onBlur();
@@ -12953,7 +12963,11 @@ var PopoverGroup = ({
12953
12963
  const generatedId = useId25();
12954
12964
  const uniquePopoverId = popoverId != null ? popoverId : `${generatedId}-popover`;
12955
12965
  const [floatOptions, setFloatOptions] = useState25();
12956
- const { refs, styles: positionStyles } = useFloatPosition(null, floatOptions);
12966
+ const {
12967
+ refs,
12968
+ styles: positionStyles,
12969
+ isPositioned
12970
+ } = useFloatPosition(null, floatOptions);
12957
12971
  const handleClose = () => {
12958
12972
  setOpen(false);
12959
12973
  onClose == null ? void 0 : onClose();
@@ -13002,6 +13016,7 @@ var PopoverGroup = ({
13002
13016
  {
13003
13017
  value: {
13004
13018
  floatStyling: positionStyles.floating,
13019
+ isPositioned,
13005
13020
  setFloatOptions,
13006
13021
  floatingRef: combinedPopoverRef,
13007
13022
  popoverId: uniquePopoverId,