@faststore/ui 1.6.28 → 1.6.29
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/CHANGELOG.md +11 -0
- package/dist/ui.cjs.development.js +10 -6
- package/dist/ui.cjs.development.js.map +1 -1
- package/dist/ui.cjs.production.min.js +1 -1
- package/dist/ui.cjs.production.min.js.map +1 -1
- package/dist/ui.esm.js +10 -6
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/molecules/Dropdown/hooks/useDropdownPosition.ts +12 -5
package/dist/ui.esm.js
CHANGED
|
@@ -1738,18 +1738,22 @@ const DropdownItem = /*#__PURE__*/forwardRef(function Button({
|
|
|
1738
1738
|
*/
|
|
1739
1739
|
|
|
1740
1740
|
const useDropdownPosition = () => {
|
|
1741
|
-
var _dropdownButtonRef$cu, _buttonRect$top, _buttonRect$height, _buttonRect$left;
|
|
1741
|
+
var _dropdownButtonRef$cu, _buttonRect$top, _buttonRect$height, _buttonRect$left, _document, _document$documentEle, _document2, _document2$documentEl;
|
|
1742
1742
|
|
|
1743
1743
|
const {
|
|
1744
1744
|
dropdownButtonRef
|
|
1745
|
-
} = useDropdown();
|
|
1745
|
+
} = useDropdown(); // Necessary to use this component in SSR
|
|
1746
|
+
|
|
1747
|
+
const isBrowser = typeof window !== 'undefined';
|
|
1746
1748
|
const buttonRect = dropdownButtonRef == null ? void 0 : (_dropdownButtonRef$cu = dropdownButtonRef.current) == null ? void 0 : _dropdownButtonRef$cu.getBoundingClientRect();
|
|
1747
1749
|
const topLevel = (_buttonRect$top = buttonRect == null ? void 0 : buttonRect.top) != null ? _buttonRect$top : 0;
|
|
1748
|
-
const topOffset = (_buttonRect$height = buttonRect == null ? void 0 : buttonRect.height) != null ? _buttonRect$height : 0;
|
|
1750
|
+
const topOffset = (_buttonRect$height = buttonRect == null ? void 0 : buttonRect.height) != null ? _buttonRect$height : 0;
|
|
1751
|
+
const leftLevel = (_buttonRect$left = buttonRect == null ? void 0 : buttonRect.left) != null ? _buttonRect$left : 0; // The scroll properties fix the position of DropdownMenu when the scroll is activated.
|
|
1749
1752
|
|
|
1750
|
-
const
|
|
1751
|
-
const
|
|
1752
|
-
const
|
|
1753
|
+
const scrollTop = isBrowser ? (_document = document) == null ? void 0 : (_document$documentEle = _document.documentElement) == null ? void 0 : _document$documentEle.scrollTop : 0;
|
|
1754
|
+
const scrollLeft = isBrowser ? (_document2 = document) == null ? void 0 : (_document2$documentEl = _document2.documentElement) == null ? void 0 : _document2$documentEl.scrollLeft : 0;
|
|
1755
|
+
const topPosition = topLevel + topOffset + scrollTop;
|
|
1756
|
+
const leftPosition = leftLevel + scrollLeft;
|
|
1753
1757
|
return {
|
|
1754
1758
|
position: 'absolute',
|
|
1755
1759
|
top: topPosition,
|