@leafygreen-ui/portal
Advanced tools
Comparing version 5.1.0 to 5.1.1
# @leafygreen-ui/portal | ||
## 5.1.1 | ||
### Patch Changes | ||
- 356a53fd: Update TS builds to use `typescript@4.9.5` | ||
- Updated dependencies [15185af0] | ||
- Updated dependencies [356a53fd] | ||
- Updated dependencies [66df9ab8] | ||
- @leafygreen-ui/lib@13.3.0 | ||
- @leafygreen-ui/hooks@8.1.3 | ||
## 5.1.0 | ||
@@ -4,0 +15,0 @@ |
@@ -14,3 +14,3 @@ import React, { MutableRefObject } from 'react'; | ||
className: PropTypes.Requireable<string>; | ||
container: PropTypes.Requireable<string | number | boolean | object | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>; | ||
container: PropTypes.Requireable<NonNullable<object | PropTypes.ReactNodeLike>>; | ||
}; | ||
@@ -17,0 +17,0 @@ } |
import React from 'react'; | ||
import { OneOf } from '@leafygreen-ui/lib'; | ||
export declare type PortalProps = { | ||
export type PortalProps = { | ||
children?: React.ReactNode; | ||
@@ -5,0 +5,0 @@ portalRef?: React.MutableRefObject<HTMLElement | null>; |
{ | ||
"name": "@leafygreen-ui/portal", | ||
"version": "5.1.0", | ||
"version": "5.1.1", | ||
"description": "LeafyGreen UI Kit Portal", | ||
@@ -28,4 +28,4 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"@leafygreen-ui/hooks": "^8.1.2", | ||
"@leafygreen-ui/lib": "^13.0.0" | ||
"@leafygreen-ui/hooks": "^8.1.3", | ||
"@leafygreen-ui/lib": "^13.3.0" | ||
}, | ||
@@ -42,4 +42,5 @@ "gitHead": "dd71a2d404218ccec2e657df9c0263dc1c15b9e0", | ||
"devDependencies": { | ||
"@leafygreen-ui/emotion": "^4.0.7" | ||
"@leafygreen-ui/emotion": "^4.0.8", | ||
"@lg-tools/storybook-utils": "^0.1.0" | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
import e from"react";import{css as t}from"@leafygreen-ui/emotion";import{storybookExcludedControlParams as r}from"@leafygreen-ui/lib";import{createPortal as n}from"react-dom";import o from"prop-types";import{useIsomorphicLayoutEffect as a}from"@leafygreen-ui/hooks";function l(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){var n,o,a,l,i=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(u)throw o}}return i}}(e,t)||i(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){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(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 r=t.children,o=t.className,i=t.container,c=t.portalRef,u=function(t,r){var n=l(e.useState(),2),o=n[0],i=n[1];return a((function(){if(t)return r&&(r.current=t),void i(t);var e=document.createElement("div");return document.body.appendChild(e),r&&(r.current=e),i(e),function(){e.remove()}}),[t,r]),o}(null!=i?i:void 0,c);return a((function(){u&&!i&&(u.className=null!=o?o:"")}),[i,u,o]),u?n(r,u):null}var m;u.displayName="Portal",u.propTypes={children:o.node,className:o.string,container:o.oneOfType([o.node,o.object])};var d,f,s=t(m||(d=["\n text-align: center;\n"],f||(f=d.slice(0)),m=Object.freeze(Object.defineProperties(d,{raw:{value:Object.freeze(f)}}))));var p,y={title:"Components/Portal",component:u,args:{container:function(){var e=document.getElementById("root")||document.getElementById("storybook-root")||document.getElementById("story-container");if(null==e)throw new Error("Could not find root element");return e}(),children:e.createElement("div",{className:s},"Portals transport their children to a ",e.createElement("code",null,"div")," that is appended to the end of the ",e.createElement("code",null,"document.body")," to or a ",e.createElement("code",null,"node")," ","that can be specified with a ",e.createElement("code",null,"container")," prop.")},argTypes:{className:{type:"string"}},parameters:{default:"Basic",controls:{exclude:[].concat((p=r,function(e){if(Array.isArray(e))return c(e)}(p)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(p)||i(p)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),["children","container"])},chromatic:{disableSnapshot:!0}}},b=function(t){return e.createElement(u,t)};export{b as Basic,y as default}; | ||
import e from"react";import{storybookExcludedControlParams as t}from"@lg-tools/storybook-utils";import{css as r}from"@leafygreen-ui/emotion";import{createPortal as n}from"react-dom";import o from"prop-types";import{useIsomorphicLayoutEffect as a}from"@leafygreen-ui/hooks";function l(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){var n,o,a,l,i=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(i.push(n.value),i.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(u)throw o}}return i}}(e,t)||i(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){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(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 r=t.children,o=t.className,i=t.container,c=t.portalRef,u=function(t,r){var n=l(e.useState(),2),o=n[0],i=n[1];return a((function(){if(t)return r&&(r.current=t),void i(t);var e=document.createElement("div");return document.body.appendChild(e),r&&(r.current=e),i(e),function(){e.remove()}}),[t,r]),o}(null!=i?i:void 0,c);return a((function(){u&&!i&&(u.className=null!=o?o:"")}),[i,u,o]),u?n(r,u):null}var m;u.displayName="Portal",u.propTypes={children:o.node,className:o.string,container:o.oneOfType([o.node,o.object])};var d,f,s=r(m||(d=["\n text-align: center;\n"],f||(f=d.slice(0)),m=Object.freeze(Object.defineProperties(d,{raw:{value:Object.freeze(f)}}))));var p,y={title:"Components/Portal",component:u,args:{container:function(){var e=document.getElementById("root")||document.getElementById("storybook-root")||document.getElementById("story-container");if(null==e)throw new Error("Could not find root element");return e}(),children:e.createElement("div",{className:s},"Portals transport their children to a ",e.createElement("code",null,"div")," that is appended to the end of the ",e.createElement("code",null,"document.body")," to or a ",e.createElement("code",null,"node")," ","that can be specified with a ",e.createElement("code",null,"container")," prop.")},argTypes:{className:{type:"string"}},parameters:{default:"Basic",controls:{exclude:[].concat((p=t,function(e){if(Array.isArray(e))return c(e)}(p)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(p)||i(p)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),["children","container"])},chromatic:{disableSnapshot:!0}}},b=function(t){return e.createElement(u,t)};export{b as Basic,y as default}; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
41520
0
2
Updated@leafygreen-ui/hooks@^8.1.3
Updated@leafygreen-ui/lib@^13.3.0