x-ui-design 0.9.34 → 0.9.36
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 +15 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/lib/helpers/index.ts +20 -15
- package/lib/hooks/usePopupPosition.ts +9 -9
- package/package.json +1 -1
- package/src/app/page.tsx +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1639,14 +1639,17 @@ function getElementParentDetails(el, includeSelf = false) {
|
|
|
1639
1639
|
left: 0,
|
|
1640
1640
|
top: 0
|
|
1641
1641
|
};
|
|
1642
|
+
function hasActualScroll(element) {
|
|
1643
|
+
return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
|
|
1644
|
+
}
|
|
1642
1645
|
while (current) {
|
|
1643
1646
|
const style = getComputedStyle(current);
|
|
1644
|
-
const
|
|
1645
|
-
if (current.style.position ===
|
|
1647
|
+
const allowScroll = style.overflowY !== "visible" || style.overflowX !== "visible";
|
|
1648
|
+
if (current.style.position === "relative") {
|
|
1646
1649
|
relativePosition.left += current.offsetLeft;
|
|
1647
1650
|
relativePosition.top += current.offsetTop;
|
|
1648
1651
|
}
|
|
1649
|
-
if (
|
|
1652
|
+
if (allowScroll && hasActualScroll(current)) {
|
|
1650
1653
|
return {
|
|
1651
1654
|
relativePosition,
|
|
1652
1655
|
scrollableParents: current
|
|
@@ -1655,10 +1658,7 @@ function getElementParentDetails(el, includeSelf = false) {
|
|
|
1655
1658
|
current = current.parentElement;
|
|
1656
1659
|
}
|
|
1657
1660
|
return {
|
|
1658
|
-
relativePosition
|
|
1659
|
-
left: 0,
|
|
1660
|
-
top: 0
|
|
1661
|
-
},
|
|
1661
|
+
relativePosition,
|
|
1662
1662
|
scrollableParents: document.scrollingElement
|
|
1663
1663
|
};
|
|
1664
1664
|
}
|
|
@@ -2686,14 +2686,14 @@ const usePopupPosition = ({
|
|
|
2686
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
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
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 = () => {
|