x-ui-design 0.9.33 → 0.9.35

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
@@ -2676,24 +2676,24 @@ const usePopupPosition = ({
2676
2676
  right: (inBody ? window.innerWidth : scrollableParents?.clientWidth || 0) - ((targetRef.current?.offsetLeft || 0 || container.right) + popupRect.width + OFFSET)
2677
2677
  };
2678
2678
  let newPlacement = _placement;
2679
- if (availableSpace.bottom < 0 && availableSpace.top > 0) {
2679
+ if (availableSpace.bottom < 0 && availableSpace.top > 0 && availableSpace.top > popupRect.height) {
2680
2680
  newPlacement = newPlacement.replace('bottom', 'top');
2681
- } else if (availableSpace.top < 0 && availableSpace.bottom > 0) {
2681
+ } else if (availableSpace.top < 0 && availableSpace.bottom > 0 && availableSpace.bottom > popupRect.height) {
2682
2682
  newPlacement = newPlacement.replace('top', 'bottom');
2683
2683
  }
2684
- if (availableSpace.left < 0 && availableSpace.right > 0) {
2684
+ if (availableSpace.left < 0 && availableSpace.right > 0 && availableSpace.right > popupRect.width) {
2685
2685
  newPlacement = newPlacement.replace('Right', 'Left');
2686
- } else if (availableSpace.right < 0 && availableSpace.left > 0) {
2686
+ } else if (availableSpace.right < 0 && availableSpace.left > 0 && availableSpace.left > popupRect.width) {
2687
2687
  newPlacement = newPlacement.replace('Left', 'Right');
2688
2688
  }
2689
- if (availableSpace.right < 0 && availableSpace.left < 0) {
2690
- if (newPlacement.includes('Right')) {
2691
- positions.left = popupRect.width - positions.left + container.left;
2692
- }
2693
- if (newPlacement.includes('Left')) {
2694
- positions.left = positions.left - popupRect.width + container.width;
2695
- }
2696
- }
2689
+ // if (availableSpace.right < 0 && availableSpace.left < 0) {
2690
+ // if (newPlacement.includes('Right')) {
2691
+ // positions.left = (popupRect.width - positions.left) + container.left
2692
+ // }
2693
+ // if (newPlacement.includes('Left')) {
2694
+ // positions.left = positions.left - popupRect.width + container.width
2695
+ // }
2696
+ // }
2697
2697
  _setPlacement(newPlacement);
2698
2698
  }
2699
2699
  const _calculation = () => {