Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radix-ui/react-portal

Package Overview
Dependencies
Maintainers
5
Versions
193
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-portal - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

3

dist/index.d.ts
import * as React from "react";
import { Primitive } from "@radix-ui/react-primitive";
import * as Polymorphic from "@radix-ui/react-polymorphic";
import { Merge } from "@radix-ui/utils";
type PortalOwnProps = Merge<Polymorphic.OwnProps<typeof Primitive>, {
type PortalOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Primitive>, {
containerRef?: React.RefObject<HTMLElement>;

@@ -7,0 +6,0 @@ }>;

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

var e,r,t,n=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/utils").getSelector,i=require("@radix-ui/react-utils").useLayoutEffect,u=(e=require("react-dom"))&&e.__esModule?e.default:e,c=(r={},t=require("react"),Object.keys(t).forEach((function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return t[e]}})})),r);function a(){return(a=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function f(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?l(Object(t),!0).forEach((function(r){y(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function y(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function s(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,i=void 0;try{for(var u,c=e[Symbol.iterator]();!(n=(u=c.next()).done)&&(t.push(u.value),!r||t.length!==r);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw i}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return b(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(e,r)}(e,r)||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 b(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function p(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var d=c.forwardRef((function(e,r){var t,l=e.selector,y=void 0===l?o("Portal"):l,b=e.containerRef,d=e.style,O=p(e,["selector","containerRef","style"]),v=null!==(t=null==b?void 0:b.current)&&void 0!==t?t:"undefined"!=typeof document?document.body:void 0,m=s(c.useState({}),2)[1];return i((function(){m({})}),[]),v?u.createPortal(c.createElement(n,a({selector:y},O,{ref:r,style:v===document.body?f({position:"absolute",top:0,left:0,zIndex:2147483647},d):void 0})),v):null}));exports.Portal=d;var O=d;exports.Root=O;
var e,r,t,n=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-use-layout-effect").useLayoutEffect,i=(e=require("react-dom"))&&e.__esModule?e.default:e,a=(r={},t=require("react"),Object.keys(t).forEach((function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(r,e,{enumerable:!0,get:function(){return t[e]}})})),r);function u(){return(u=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function c(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?l(Object(t),!0).forEach((function(r){f(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function f(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function y(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return s(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return s(e,r)}(e,r)||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 s(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function b(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.forwardRef((function(e,r){var t,l,f=e.containerRef,s=e.style,p=b(e,["containerRef","style"]),d=null!==(t=null==f?void 0:f.current)&&void 0!==t?t:null===globalThis||void 0===globalThis||null===(l=globalThis.document)||void 0===l?void 0:l.body,O=y(a.useState({}),2)[1];return o((function(){O({})}),[]),d?i.createPortal(a.createElement(n,u({"data-radix-portal":""},p,{ref:r,style:d===document.body?c({position:"absolute",top:0,left:0,zIndex:2147483647},s):void 0})),d):null}));exports.Portal=p,p.displayName="Portal";var d=p;exports.Root=d;
//# sourceMappingURL=index.js.map

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

import{Primitive as e}from"@radix-ui/react-primitive";import{getSelector as t}from"@radix-ui/utils";import{useLayoutEffect as r}from"@radix-ui/react-utils";import o from"react-dom";import*as n from"react";function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},c=Object.keys(e);for(o=0;o<c.length;o++)r=c[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;o<c.length;o++)r=c[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}const f="Portal";export const Portal=n.forwardRef(((i,u)=>{var p;const{selector:s=t(f),containerRef:b,style:O}=i,y=a(i,["selector","containerRef","style"]),m=null!==(p=null==b?void 0:b.current)&&void 0!==p?p:"undefined"!=typeof document?document.body:void 0,[,d]=n.useState({});return r((()=>{d({})}),[]),m?o.createPortal(n.createElement(e,c({selector:s},y,{ref:u,style:m===document.body?l({position:"absolute",top:0,left:0,zIndex:2147483647},O):void 0})),m):null}));export const Root=Portal;
import{Primitive as t}from"@radix-ui/react-primitive";import{useLayoutEffect as o}from"@radix-ui/react-use-layout-effect";import r from"react-dom";import*as e from"react";function a(){return(a=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}export const Portal=e.forwardRef(((l,i)=>{var n,c;const{containerRef:u,style:d,...s}=l,p=null!==(n=null==u?void 0:u.current)&&void 0!==n?n:null===globalThis||void 0===globalThis||null===(c=globalThis.document)||void 0===c?void 0:c.body,[,f]=e.useState({});return o((()=>{f({})}),[]),p?r.createPortal(e.createElement(t,a({"data-radix-portal":""},s,{ref:i,style:p===document.body?{position:"absolute",top:0,left:0,zIndex:2147483647,...d}:void 0})),p):null}));Portal.displayName="Portal";export const Root=Portal;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-portal",
"version": "0.0.5",
"version": "0.0.6",
"license": "MIT",

@@ -19,6 +19,5 @@ "source": "src/index.ts",

"dependencies": {
"@radix-ui/react-polymorphic": "0.0.5",
"@radix-ui/react-primitive": "0.0.4",
"@radix-ui/react-utils": "0.0.5",
"@radix-ui/utils": "0.0.3"
"@radix-ui/react-polymorphic": "0.0.6",
"@radix-ui/react-primitive": "0.0.5",
"@radix-ui/react-use-layout-effect": "0.0.1"
},

@@ -25,0 +24,0 @@ "peerDependencies": {

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