x-ui-design 0.9.17 → 0.9.19

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.esm.js CHANGED
@@ -2666,6 +2666,10 @@ const usePopupPosition = ({
2666
2666
  left: container.left - (popupRect.width + OFFSET),
2667
2667
  right: (inBody ? window.innerWidth : scrollableParents?.clientWidth || 0) - (container.right + popupRect.width + OFFSET)
2668
2668
  };
2669
+ console.info({
2670
+ popupRect,
2671
+ availableSpace
2672
+ });
2669
2673
  let newPlacement = _placement;
2670
2674
  if (availableSpace.bottom < 0 && availableSpace.top > 0) {
2671
2675
  newPlacement = newPlacement.replace('bottom', 'top');
@@ -2681,10 +2685,10 @@ const usePopupPosition = ({
2681
2685
  }
2682
2686
  if (availableSpace.right < 0 && availableSpace.left < 0) {
2683
2687
  if (newPlacement.includes('Right')) {
2684
- positions.left = popupRef.current.clientWidth - positions.left + container.left;
2688
+ positions.left = popupRect.width - positions.left + container.left;
2685
2689
  }
2686
2690
  if (newPlacement.includes('Left')) {
2687
- positions.left = positions.left - popupRef.current.clientWidth + container.width;
2691
+ positions.left = positions.left - popupRect.width + container.width;
2688
2692
  }
2689
2693
  }
2690
2694
  _setPlacement(newPlacement);
@@ -2730,7 +2734,7 @@ const usePopupPosition = ({
2730
2734
  }
2731
2735
  };
2732
2736
  _calculation();
2733
- }, [targetRef, popupRef, popupContainer, inBody, _placement, setOpen]);
2737
+ }, [targetRef, popupRef.current, popupContainer, inBody, _placement, setOpen]);
2734
2738
  useEffect(() => {
2735
2739
  if (!open) {
2736
2740
  return;