@semcore/portal
Advanced tools
Comparing version 2.5.17 to 2.6.0
@@ -5,2 +5,8 @@ # Changelog | ||
## [2.6.0] - 2023-03-27 | ||
### Added | ||
- Supported ignoring parent portals nesting via `ignorePortalsStacking`. | ||
## [2.5.17] - 2023-03-28 | ||
@@ -7,0 +13,0 @@ |
@@ -31,6 +31,7 @@ "use strict"; | ||
var Children = props.Children, | ||
disablePortal = props.disablePortal; | ||
disablePortal = props.disablePortal, | ||
ignorePortalsStacking = props.ignorePortalsStacking; | ||
var container = (0, _react.useContext)(PortalContext); | ||
var _useState = (0, _react.useState)((0, _ref.getNodeByRef)(container)), | ||
var _useState = (0, _react.useState)(ignorePortalsStacking ? document.body : (0, _ref.getNodeByRef)(container)), | ||
_useState2 = (0, _slicedToArray2["default"])(_useState, 2), | ||
@@ -42,3 +43,3 @@ mountNode = _useState2[0], | ||
if (!disablePortal) { | ||
setMountNode((0, _ref.getNodeByRef)(container)); | ||
setMountNode(ignorePortalsStacking ? document.body : (0, _ref.getNodeByRef)(container)); | ||
} | ||
@@ -45,0 +46,0 @@ }, [container, disablePortal]); |
@@ -14,6 +14,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; | ||
var Children = props.Children, | ||
disablePortal = props.disablePortal; | ||
disablePortal = props.disablePortal, | ||
ignorePortalsStacking = props.ignorePortalsStacking; | ||
var container = useContext(PortalContext); | ||
var _useState = useState(getNodeByRef(container)), | ||
var _useState = useState(ignorePortalsStacking ? document.body : getNodeByRef(container)), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
@@ -25,3 +26,3 @@ mountNode = _useState2[0], | ||
if (!disablePortal) { | ||
setMountNode(getNodeByRef(container)); | ||
setMountNode(ignorePortalsStacking ? document.body : getNodeByRef(container)); | ||
} | ||
@@ -28,0 +29,0 @@ }, [container, disablePortal]); |
@@ -6,2 +6,4 @@ import React from 'react'; | ||
disablePortal?: boolean; | ||
/** Disabled attaching portals to the parent portals and enabling attaching directly to document.body */ | ||
ignorePortalsStacking?: boolean; | ||
} | ||
@@ -8,0 +10,0 @@ declare const PortalProvider: React.Provider<NodeByRef>; |
{ | ||
"name": "@semcore/portal", | ||
"description": "Semrush Portal Component", | ||
"version": "2.5.17", | ||
"version": "2.6.0", | ||
"main": "lib/cjs/index.js", | ||
@@ -6,0 +6,0 @@ "module": "lib/es6/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18925
114