@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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 1.6.29 (2022-03-31)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix dropdown render in SSR ([#1202](https://github.com/vtex/faststore/issues/1202)) ([60f65b0](https://github.com/vtex/faststore/commit/60f65b0864c2fb59dff61e914c69a326b5229984))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 1.6.28 (2022-03-31)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -1746,18 +1746,22 @@ const DropdownItem = /*#__PURE__*/React.forwardRef(function Button({
|
|
|
1746
1746
|
*/
|
|
1747
1747
|
|
|
1748
1748
|
const useDropdownPosition = () => {
|
|
1749
|
-
var _dropdownButtonRef$cu, _buttonRect$top, _buttonRect$height, _buttonRect$left;
|
|
1749
|
+
var _dropdownButtonRef$cu, _buttonRect$top, _buttonRect$height, _buttonRect$left, _document, _document$documentEle, _document2, _document2$documentEl;
|
|
1750
1750
|
|
|
1751
1751
|
const {
|
|
1752
1752
|
dropdownButtonRef
|
|
1753
|
-
} = useDropdown();
|
|
1753
|
+
} = useDropdown(); // Necessary to use this component in SSR
|
|
1754
|
+
|
|
1755
|
+
const isBrowser = typeof window !== 'undefined';
|
|
1754
1756
|
const buttonRect = dropdownButtonRef == null ? void 0 : (_dropdownButtonRef$cu = dropdownButtonRef.current) == null ? void 0 : _dropdownButtonRef$cu.getBoundingClientRect();
|
|
1755
1757
|
const topLevel = (_buttonRect$top = buttonRect == null ? void 0 : buttonRect.top) != null ? _buttonRect$top : 0;
|
|
1756
|
-
const topOffset = (_buttonRect$height = buttonRect == null ? void 0 : buttonRect.height) != null ? _buttonRect$height : 0;
|
|
1758
|
+
const topOffset = (_buttonRect$height = buttonRect == null ? void 0 : buttonRect.height) != null ? _buttonRect$height : 0;
|
|
1759
|
+
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.
|
|
1757
1760
|
|
|
1758
|
-
const
|
|
1759
|
-
const
|
|
1760
|
-
const
|
|
1761
|
+
const scrollTop = isBrowser ? (_document = document) == null ? void 0 : (_document$documentEle = _document.documentElement) == null ? void 0 : _document$documentEle.scrollTop : 0;
|
|
1762
|
+
const scrollLeft = isBrowser ? (_document2 = document) == null ? void 0 : (_document2$documentEl = _document2.documentElement) == null ? void 0 : _document2$documentEl.scrollLeft : 0;
|
|
1763
|
+
const topPosition = topLevel + topOffset + scrollTop;
|
|
1764
|
+
const leftPosition = leftLevel + scrollLeft;
|
|
1761
1765
|
return {
|
|
1762
1766
|
position: 'absolute',
|
|
1763
1767
|
top: topPosition,
|