New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@leafygreen-ui/portal

Package Overview
Dependencies
Maintainers
0
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leafygreen-ui/portal - npm Package Compare versions

Comparing version 5.1.1 to 6.0.0

12

CHANGELOG.md
# @leafygreen-ui/portal
## 6.0.0
### Major Changes
- 274d7e1a7: Removes prop-types from LeafyGreen UI
### Patch Changes
- Updated dependencies [274d7e1a7]
- @leafygreen-ui/lib@14.0.0
- @leafygreen-ui/hooks@8.3.2
## 5.1.1

@@ -4,0 +16,0 @@

2

dist/esm/index.js

@@ -1,2 +0,2 @@

import r from"react";import{createPortal as t}from"react-dom";import e from"prop-types";import{useIsomorphicLayoutEffect as n}from"@leafygreen-ui/hooks";function o(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=e){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(e=e.call(r)).next,0===t){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=a.call(e)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(r){c=!0,o=r}finally{try{if(!u&&null!=e.return&&(i=e.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(r,t)||function(r,t){if(!r)return;if("string"==typeof r)return a(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))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 e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function i(t,e){var a=o(r.useState(),2),i=a[0],l=a[1];return n((function(){if(t)return e&&(e.current=t),void l(t);var r=document.createElement("div");return document.body.appendChild(r),e&&(e.current=r),l(r),function(){r.remove()}}),[t,e]),i}function l(r){var e=r.children,o=r.className,a=r.container,l=r.portalRef,u=i(null!=a?a:void 0,l);return n((function(){u&&!a&&(u.className=null!=o?o:"")}),[a,u,o]),u?t(e,u):null}l.displayName="Portal",l.propTypes={children:e.node,className:e.string,container:e.oneOfType([e.node,e.object])};export{l as default,i as usePortalContainer};
import r from"react";import{createPortal as t}from"react-dom";import{useIsomorphicLayoutEffect as e}from"@leafygreen-ui/hooks";function n(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=e){var n,o,a,u,i=[],l=!0,c=!1;try{if(a=(e=e.call(r)).next,0===t);else for(;!(l=(n=a.call(e)).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(r){c=!0,o=r}finally{try{if(!l&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(c)throw o}}return i}}(r,t)||function(r,t){if(!r)return;if("string"==typeof r)return o(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return o(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 o(r,t){t>r.length&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function a(t,o){var a=n(r.useState(),2),u=a[0],i=a[1];return e((function(){if(t)return o&&(o.current=t),void i(t);var r=document.createElement("div");return document.body.appendChild(r),o&&(o.current=r),i(r),function(){r.remove()}}),[t,o]),u}function u(r){var n=r.children,o=r.className,u=r.container,i=r.portalRef,l=a(null!=u?u:void 0,i);return e((function(){l&&!u&&(l.className=null!=o?o:"")}),[u,l,o]),l?t(n,l):null}u.displayName="Portal";export{u as default,a as usePortalContainer};
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("prop-types"),require("@leafygreen-ui/hooks")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","prop-types","@leafygreen-ui/hooks"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/portal"]={},e.React,e["react-dom"],e.PropTypes,e["@leafygreen-ui/hooks"])}(this,(function(e,t,r,n,o){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=u(t),i=u(n);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,u,a,i=[],l=!0,f=!1;try{if(u=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=u.call(r)).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){f=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return f(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 f(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 f(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 c(e,t){var r=l(a.default.useState(),2),n=r[0],u=r[1];return o.useIsomorphicLayoutEffect((function(){if(e)return t&&(t.current=e),void u(e);var r=document.createElement("div");return document.body.appendChild(r),t&&(t.current=r),u(r),function(){r.remove()}}),[e,t]),n}function d(e){var t=e.children,n=e.className,u=e.container,a=e.portalRef,i=c(null!=u?u:void 0,a);return o.useIsomorphicLayoutEffect((function(){i&&!u&&(i.className=null!=n?n:"")}),[u,i,n]),i?r.createPortal(t,i):null}d.displayName="Portal",d.propTypes={children:i.default.node,className:i.default.string,container:i.default.oneOfType([i.default.node,i.default.object])},e.default=d,e.usePortalContainer=c,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("@leafygreen-ui/hooks")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","@leafygreen-ui/hooks"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/portal"]={},e.React,e["react-dom"],e["@leafygreen-ui/hooks"])}(this,(function(e,t,r,n){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=o(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){var n,o,u,a,i=[],l=!0,f=!1;try{if(u=(r=r.call(e)).next,0===t);else for(;!(l=(n=u.call(r)).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){f=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw o}}return i}}(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){t>e.length&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){var r=a(u.default.useState(),2),o=r[0],i=r[1];return n.useIsomorphicLayoutEffect((function(){if(e)return t&&(t.current=e),void i(e);var r=document.createElement("div");return document.body.appendChild(r),t&&(t.current=r),i(r),function(){r.remove()}}),[e,t]),o}function f(e){var t=e.children,o=e.className,u=e.container,a=e.portalRef,i=l(null!=u?u:void 0,a);return n.useIsomorphicLayoutEffect((function(){i&&!u&&(i.className=null!=o?o:"")}),[u,i,o]),i?r.createPortal(t,i):null}f.displayName="Portal",e.default=f,e.usePortalContainer=l,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.js.map
import React, { MutableRefObject } from 'react';
import PropTypes from 'prop-types';
import { PortalProps } from './Portal.types';

@@ -11,9 +10,4 @@ export declare function usePortalContainer(customContainer?: HTMLElement, portalRef?: MutableRefObject<HTMLElement | null>): HTMLElement | undefined;

var displayName: string;
var propTypes: {
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
className: PropTypes.Requireable<string>;
container: PropTypes.Requireable<NonNullable<object | PropTypes.ReactNodeLike>>;
};
}
export default Portal;
//# sourceMappingURL=Portal.d.ts.map
{
"name": "@leafygreen-ui/portal",
"version": "5.1.1",
"version": "6.0.0",
"description": "LeafyGreen UI Kit Portal",

@@ -28,4 +28,4 @@ "main": "./dist/index.js",

"dependencies": {
"@leafygreen-ui/hooks": "^8.1.3",
"@leafygreen-ui/lib": "^13.3.0"
"@leafygreen-ui/hooks": "^8.3.2",
"@leafygreen-ui/lib": "^14.0.0"
},

@@ -32,0 +32,0 @@ "gitHead": "dd71a2d404218ccec2e657df9c0263dc1c15b9e0",

@@ -5,3 +5,3 @@ # Portal

#### [View on MongoDB.design](https://www.mongodb.design/component/portal/example/)
#### [View on MongoDB.design](https://www.mongodb.design/component/portal/live-example/)

@@ -8,0 +8,0 @@ ## Installation

@@ -1,1 +0,1 @@

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};
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{useIsomorphicLayoutEffect as o}from"@leafygreen-ui/hooks";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){var n,o,a,l,i=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t);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)||l(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 l(e,t){if(e){if("string"==typeof e)return i(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)?i(e,t):void 0}}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 c(t){var r=t.children,l=t.className,i=t.container,c=t.portalRef,u=function(t,r){var n=a(e.useState(),2),l=n[0],i=n[1];return o((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]),l}(null!=i?i:void 0,c);return o((function(){u&&!i&&(u.className=null!=l?l:"")}),[i,u,l]),u?n(r,u):null}var u;c.displayName="Portal";var m,d,f=r(u||(m=["\n text-align: center;\n"],d||(d=m.slice(0)),u=Object.freeze(Object.defineProperties(m,{raw:{value:Object.freeze(d)}}))));var s,y={title:"Components/Portal",component:c,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:f},"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((s=t,function(e){if(Array.isArray(e))return i(e)}(s)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(s)||l(s)||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}}},p=function(t){return e.createElement(c,t)};export{p 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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc