@leafygreen-ui/portal
Advanced tools
Comparing version 4.0.0 to 4.0.1
# @leafygreen-ui/portal | ||
## 4.0.1 | ||
### Patch Changes | ||
- 8df11bf4: Use useLayoutEffect hook internally to fix tests broken by Portal showing async behavior | ||
## 4.0.0 | ||
@@ -4,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
import{useEffect as r,useState as t}from"react";import n from"prop-types";import{createPortal as e}from"react-dom";function o(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(r)))return;var n=[],e=!0,o=!1,a=void 0;try{for(var i,u=r[Symbol.iterator]();!(e=(i=u.next()).done)&&(n.push(i.value),!t||n.length!==t);e=!0);}catch(r){o=!0,a=r}finally{try{e||null==u.return||u.return()}finally{if(o)throw a}}return n}(r,t)||function(r,t){if(!r)return;if("string"==typeof r)return a(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(r,t)}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=new Array(t);n<t;n++)e[n]=r[n];return e}function i(n){var a,i=function(n){var e=o(t(),2),a=e[0],i=e[1];return r((function(){if(!n){var r=document.createElement("div");return document.body.appendChild(r),i(r),function(){r.remove()}}i(n)}),[n]),a}(null!==(a=n.container)&&void 0!==a?a:void 0);return r((function(){var r;i&&!n.container&&(i.className=null!==(r=n.className)&&void 0!==r?r:"")}),[i,n.container,n.className]),i?e(n.children,i):null}i.displayName="Portal",i.propTypes={children:n.node,className:n.string,container:n.oneOfType([n.node,n.object])};export default i; | ||
import{useLayoutEffect as r,useState as t}from"react";import n from"prop-types";import{createPortal as e}from"react-dom";function o(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null==n)return;var e,o,a=[],i=!0,l=!1;try{for(n=n.call(r);!(i=(e=n.next()).done)&&(a.push(e.value),!t||a.length!==t);i=!0);}catch(r){l=!0,o=r}finally{try{i||null==n.return||n.return()}finally{if(l)throw o}}return a}(r,t)||function(r,t){if(!r)return;if("string"==typeof r)return a(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);"Object"===n&&r.constructor&&(n=r.constructor.name);if("Map"===n||"Set"===n)return Array.from(r);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(r,t)}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(r,t){(null==t||t>r.length)&&(t=r.length);for(var n=0,e=new Array(t);n<t;n++)e[n]=r[n];return e}function i(n){var a,i=function(n){var e=o(t(),2),a=e[0],i=e[1];return r((function(){if(!n){var r=document.createElement("div");return document.body.appendChild(r),i(r),function(){r.remove()}}i(n)}),[n]),a}(null!==(a=n.container)&&void 0!==a?a:void 0);return r((function(){var r;i&&!n.container&&(i.className=null!==(r=n.className)&&void 0!==r?r:"")}),[i,n.container,n.className]),i?e(n.children,i):null}i.displayName="Portal",i.propTypes={children:n.node,className:n.string,container:n.oneOfType([n.node,n.object])};export default i; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","prop-types","react-dom"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/portal"]=t(e.React,e.PropTypes,e.ReactDOM)}(this,(function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t);function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function u(t){var n,o=function(t){var r=a(e.useState(),2),n=r[0],o=r[1];return e.useEffect((function(){if(!t){var e=document.createElement("div");return document.body.appendChild(e),o(e),function(){e.remove()}}o(t)}),[t]),n}(null!==(n=t.container)&&void 0!==n?n:void 0);return e.useEffect((function(){var e;o&&!t.container&&(o.className=null!==(e=t.className)&&void 0!==e?e:"")}),[o,t.container,t.className]),o?r.createPortal(t.children,o):null}return u.displayName="Portal",u.propTypes={children:o.default.node,className:o.default.string,container:o.default.oneOfType([o.default.node,o.default.object])},u})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","prop-types","react-dom"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/portal"]=t(e.React,e.PropTypes,e.ReactDOM)}(this,(function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t);function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,a=[],u=!0,i=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);u=!0);}catch(e){i=!0,o=e}finally{try{u||null==r.return||r.return()}finally{if(i)throw o}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(t){var n,o=function(t){var r=a(e.useState(),2),n=r[0],o=r[1];return e.useLayoutEffect((function(){if(!t){var e=document.createElement("div");return document.body.appendChild(e),o(e),function(){e.remove()}}o(t)}),[t]),n}(null!==(n=t.container)&&void 0!==n?n:void 0);return e.useLayoutEffect((function(){var e;o&&!t.container&&(o.className=null!==(e=t.className)&&void 0!==e?e:"")}),[o,t.container,t.className]),o?r.createPortal(t.children,o):null}return i.displayName="Portal",i.propTypes={children:o.default.node,className:o.default.string,container:o.default.oneOfType([o.default.node,o.default.object])},i})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@leafygreen-ui/portal", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "LeafyGreen UI Kit Portal", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
178208