x-ui-design 0.8.97 → 0.9.11

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
@@ -2653,11 +2653,11 @@ const usePopupPosition = ({
2653
2653
  top: (relativePosition.top || 0) + (targetRef.current?.offsetTop || 0) - (scrollableParents?.offsetTop || 0) + OFFSET,
2654
2654
  left: relativePosition.left + (targetRef.current?.offsetLeft || 0) - (targetRef.current?.clientWidth || 0) / 2
2655
2655
  };
2656
- console.log({
2657
- popupContainer: !popupContainer,
2658
- _containsElement,
2659
- inBody
2660
- });
2656
+ if (e?.target && inBody) {
2657
+ setOpen(false);
2658
+ setPopupPosition({});
2659
+ return;
2660
+ }
2661
2661
  if (popupRef.current) {
2662
2662
  const popupRect = popupRef.current.getBoundingClientRect();
2663
2663
  const availableSpace = {
@@ -2666,6 +2666,13 @@ 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.log({
2670
+ popupRect,
2671
+ container,
2672
+ scrollableParents,
2673
+ innerWidth: window.innerWidth,
2674
+ innerHeight: window.innerHeight
2675
+ });
2669
2676
  let newPlacement = _placement;
2670
2677
  if (availableSpace.bottom < 0 && availableSpace.top > 0) {
2671
2678
  newPlacement = newPlacement.replace('bottom', 'top');
@@ -2687,17 +2694,8 @@ const usePopupPosition = ({
2687
2694
  positions.left = positions.left - popupRef.current.clientWidth + container.width;
2688
2695
  }
2689
2696
  }
2690
- console.log({
2691
- availableSpace,
2692
- newPlacement
2693
- });
2694
2697
  _setPlacement(newPlacement);
2695
2698
  }
2696
- if (e?.target === scrollableParents && inBody) {
2697
- setOpen(false);
2698
- setPopupPosition({});
2699
- return;
2700
- }
2701
2699
  const _calculation = () => {
2702
2700
  switch (_placement) {
2703
2701
  case "bottom":