@atlaskit/portal
Advanced tools
Comparing version 0.0.11 to 0.0.12
# @atlaskit/portal | ||
## 0.0.12 | ||
- [patch] fixes problem with the DOM container for portal not creating a new stacking context [aaab348](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/aaab348) | ||
## 0.0.11 | ||
@@ -4,0 +7,0 @@ - [patch] Adds missing implicit @babel/runtime dependency [b71751b](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/b71751b) |
@@ -42,5 +42,20 @@ "use strict"; | ||
return document.body; | ||
}; | ||
var portalParent = function portalParent() { | ||
var parentElement = document.querySelector('body > .atlaskit-portal-container'); | ||
if (!parentElement) { | ||
var parent = document.createElement('div'); | ||
parent.setAttribute('class', 'atlaskit-portal-container'); | ||
parent.setAttribute('style', "display: flex;"); | ||
body().appendChild(parent); | ||
return parent; | ||
} | ||
return parentElement; | ||
}; // This is a generic component does two things: | ||
// 1. Portals it's children using React.createPortal | ||
// 2. Creates the DOM node container for the portal based on props | ||
// 3. Ensures DOM the container creates it's own stacking context | ||
@@ -79,3 +94,3 @@ | ||
var newContainer = createContainer(zIndex); | ||
body().replaceChild(container, newContainer); // eslint-disable-next-line react/no-did-update-set-state | ||
portalParent().replaceChild(container, newContainer); // eslint-disable-next-line react/no-did-update-set-state | ||
@@ -87,3 +102,3 @@ this.setState({ | ||
// SSR path | ||
body().appendChild(container); | ||
portalParent().appendChild(container); | ||
} | ||
@@ -98,3 +113,3 @@ } | ||
if (container) { | ||
body().appendChild(container); | ||
portalParent().appendChild(container); | ||
} else { | ||
@@ -115,3 +130,9 @@ // SSR path | ||
if (container) { | ||
body().removeChild(container); | ||
portalParent().removeChild(container); // clean up parent element if there are no more portals | ||
var portals = !!document.querySelector('body > .atlaskit-portal-container > .atlaskit-portal'); | ||
if (!portals) { | ||
body().removeChild(portalParent()); | ||
} | ||
} | ||
@@ -118,0 +139,0 @@ } |
@@ -23,5 +23,20 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
return document.body; | ||
}; | ||
var portalParent = function portalParent() { | ||
var parentElement = document.querySelector('body > .atlaskit-portal-container'); | ||
if (!parentElement) { | ||
var parent = document.createElement('div'); | ||
parent.setAttribute('class', 'atlaskit-portal-container'); | ||
parent.setAttribute('style', "display: flex;"); | ||
body().appendChild(parent); | ||
return parent; | ||
} | ||
return parentElement; | ||
}; // This is a generic component does two things: | ||
// 1. Portals it's children using React.createPortal | ||
// 2. Creates the DOM node container for the portal based on props | ||
// 3. Ensures DOM the container creates it's own stacking context | ||
@@ -62,3 +77,3 @@ | ||
var newContainer = createContainer(zIndex); | ||
body().replaceChild(container, newContainer); // eslint-disable-next-line react/no-did-update-set-state | ||
portalParent().replaceChild(container, newContainer); // eslint-disable-next-line react/no-did-update-set-state | ||
@@ -70,3 +85,3 @@ this.setState({ | ||
// SSR path | ||
body().appendChild(container); | ||
portalParent().appendChild(container); | ||
} | ||
@@ -81,3 +96,3 @@ } | ||
if (container) { | ||
body().appendChild(container); | ||
portalParent().appendChild(container); | ||
} else { | ||
@@ -98,3 +113,9 @@ // SSR path | ||
if (container) { | ||
body().removeChild(container); | ||
portalParent().removeChild(container); // clean up parent element if there are no more portals | ||
var portals = !!document.querySelector('body > .atlaskit-portal-container > .atlaskit-portal'); | ||
if (!portals) { | ||
body().removeChild(portalParent()); | ||
} | ||
} | ||
@@ -101,0 +122,0 @@ } |
{ | ||
"name": "@atlaskit/portal", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"sideEffects": false | ||
} |
{ | ||
"name": "@atlaskit/portal", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Atlaskit wrapper for rendering components in React portals", | ||
@@ -32,8 +32,9 @@ "license": "Apache-2.0", | ||
"@atlaskit/docs": "^5.0.8", | ||
"@atlaskit/flag": "^9.1.1", | ||
"@atlaskit/flag": "^9.1.2", | ||
"@atlaskit/icon": "^14.0.2", | ||
"@atlaskit/inline-dialog": "^9.0.7", | ||
"@atlaskit/modal-dialog": "^7.0.3", | ||
"@atlaskit/onboarding": "^6.0.3", | ||
"@atlaskit/tooltip": "^12.1.4", | ||
"@atlaskit/modal-dialog": "^7.0.4", | ||
"@atlaskit/onboarding": "^6.0.4", | ||
"@atlaskit/tooltip": "^12.1.5", | ||
"@atlaskit/visual-regression": "^0.0.1", | ||
"enzyme": "https://registry.npmjs.org/@pgleeson/enzyme/-/enzyme-3.3.7.tgz", | ||
@@ -40,0 +41,0 @@ "styled-components": "^3.2.6" |
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
22178
244
11