cr-ui-lib 1.1.49 → 1.1.50
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.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4052,8 +4052,12 @@ var GroupedCheckboxDropdown = ({
|
|
|
4052
4052
|
React.useLayoutEffect(() => {
|
|
4053
4053
|
if (isDropdownOpen && containerRef.current && usePortal) {
|
|
4054
4054
|
const rect = containerRef.current.getBoundingClientRect();
|
|
4055
|
+
const viewportHeight = window.innerHeight;
|
|
4056
|
+
const dropdownHeight = 300;
|
|
4057
|
+
const shouldOpenUpward = rect.bottom + dropdownHeight > viewportHeight;
|
|
4055
4058
|
setDropdownPosition({
|
|
4056
|
-
top: rect.bottom + window.scrollY,
|
|
4059
|
+
top: shouldOpenUpward ? rect.top + window.scrollY - dropdownHeight - 4 : rect.bottom + window.scrollY + 4,
|
|
4060
|
+
// open downward
|
|
4057
4061
|
left: rect.left + window.scrollX,
|
|
4058
4062
|
width: rect.width
|
|
4059
4063
|
});
|