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

@alfalab/core-components-portal

Package Overview
Dependencies
Maintainers
16
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alfalab/core-components-portal - npm Package Compare versions

Comparing version 1.3.3 to 1.4.0

dist/cssm/utils.d.ts

6

dist/Component.d.ts
/// <reference types="react" />
import React from 'react';
import { ReactNode } from 'react';
type PortalProps = {
/** Контент */
children?: ReactNode;
/**

@@ -9,3 +11,3 @@ * Функция, возвращающая контейнер, в который будут рендериться дочерние элементы

};
declare const Portal: React.FC<PortalProps>;
declare const Portal: import("react").ForwardRefExoticComponent<PortalProps & import("react").RefAttributes<Element>>;
export { PortalProps, Portal };

@@ -7,13 +7,22 @@ 'use strict';

var reactDom = require('react-dom');
var portalContainer = require('./portalContainer.js');
var utils = require('./utils.js');
var Portal = function (_a) {
var children = _a.children, _b = _a.getPortalContainer, getPortalContainer = _b === void 0 ? portalContainer.getDefaultPortalContainer : _b;
var _c = react.useState(false), isMount = _c[0], setIsMount = _c[1];
var Portal = react.forwardRef(function (_a, ref) {
var _b = _a.getPortalContainer, getPortalContainer = _b === void 0 ? utils.getDefaultPortalContainer : _b, children = _a.children;
var _c = react.useState(null), mountNode = _c[0], setMountNode = _c[1];
react.useEffect(function () {
setIsMount(true);
}, []);
return isMount ? reactDom.createPortal(children, getPortalContainer()) : null;
};
setMountNode(getPortalContainer());
}, [getPortalContainer]);
react.useEffect(function () {
if (mountNode) {
utils.setRef(ref, mountNode);
return function () {
utils.setRef(ref, null);
};
}
return function () { return null; };
}, [ref, mountNode]);
return mountNode ? reactDom.createPortal(children, mountNode) : mountNode;
});
exports.Portal = Portal;
/// <reference types="react" />
import React from 'react';
import { ReactNode } from 'react';
type PortalProps = {
/** Контент */
children?: ReactNode;
/**

@@ -9,3 +11,3 @@ * Функция, возвращающая контейнер, в который будут рендериться дочерние элементы

};
declare const Portal: React.FC<PortalProps>;
declare const Portal: import("react").ForwardRefExoticComponent<PortalProps & import("react").RefAttributes<Element>>;
export { PortalProps, Portal };

@@ -7,13 +7,22 @@ 'use strict';

var reactDom = require('react-dom');
var portalContainer = require('./portalContainer.js');
var utils = require('./utils.js');
var Portal = function (_a) {
var children = _a.children, _b = _a.getPortalContainer, getPortalContainer = _b === void 0 ? portalContainer.getDefaultPortalContainer : _b;
var _c = react.useState(false), isMount = _c[0], setIsMount = _c[1];
var Portal = react.forwardRef(function (_a, ref) {
var _b = _a.getPortalContainer, getPortalContainer = _b === void 0 ? utils.getDefaultPortalContainer : _b, children = _a.children;
var _c = react.useState(null), mountNode = _c[0], setMountNode = _c[1];
react.useEffect(function () {
setIsMount(true);
}, []);
return isMount ? reactDom.createPortal(children, getPortalContainer()) : null;
};
setMountNode(getPortalContainer());
}, [getPortalContainer]);
react.useEffect(function () {
if (mountNode) {
utils.setRef(ref, mountNode);
return function () {
utils.setRef(ref, null);
};
}
return function () { return null; };
}, [ref, mountNode]);
return mountNode ? reactDom.createPortal(children, mountNode) : mountNode;
});
exports.Portal = Portal;

@@ -7,3 +7,3 @@ 'use strict';

require('react-dom');
require('./portalContainer.js');
require('./utils.js');
var Component = require('./Component.js');

@@ -10,0 +10,0 @@

/// <reference types="react" />
import React from 'react';
import { ReactNode } from 'react';
type PortalProps = {
/** Контент */
children?: ReactNode;
/**

@@ -9,3 +11,3 @@ * Функция, возвращающая контейнер, в который будут рендериться дочерние элементы

};
declare const Portal: React.FC<PortalProps>;
declare const Portal: import("react").ForwardRefExoticComponent<PortalProps & import("react").RefAttributes<Element>>;
export { PortalProps, Portal };

@@ -1,14 +0,23 @@

import { useState, useEffect } from 'react';
import { forwardRef, useState, useEffect } from 'react';
import { createPortal } from 'react-dom';
import { getDefaultPortalContainer } from './portalContainer.js';
import { setRef, getDefaultPortalContainer } from './utils.js';
var Portal = function (_a) {
var children = _a.children, _b = _a.getPortalContainer, getPortalContainer = _b === void 0 ? getDefaultPortalContainer : _b;
var _c = useState(false), isMount = _c[0], setIsMount = _c[1];
var Portal = forwardRef(function (_a, ref) {
var _b = _a.getPortalContainer, getPortalContainer = _b === void 0 ? getDefaultPortalContainer : _b, children = _a.children;
var _c = useState(null), mountNode = _c[0], setMountNode = _c[1];
useEffect(function () {
setIsMount(true);
}, []);
return isMount ? createPortal(children, getPortalContainer()) : null;
};
setMountNode(getPortalContainer());
}, [getPortalContainer]);
useEffect(function () {
if (mountNode) {
setRef(ref, mountNode);
return function () {
setRef(ref, null);
};
}
return function () { return null; };
}, [ref, mountNode]);
return mountNode ? createPortal(children, mountNode) : mountNode;
});
export { Portal };
import 'react';
import 'react-dom';
import './portalContainer.js';
import './utils.js';
export { Portal } from './Component.js';

@@ -7,3 +7,3 @@ 'use strict';

require('react-dom');
require('./portalContainer.js');
require('./utils.js');
var Component = require('./Component.js');

@@ -10,0 +10,0 @@

/// <reference types="react" />
import React from 'react';
import { ReactNode } from 'react';
type PortalProps = {
/** Контент */
children?: ReactNode;
/**

@@ -9,3 +11,3 @@ * Функция, возвращающая контейнер, в который будут рендериться дочерние элементы

};
declare const Portal: React.FC<PortalProps>;
declare const Portal: import("react").ForwardRefExoticComponent<PortalProps & import("react").RefAttributes<Element>>;
export { PortalProps, Portal };

@@ -1,13 +0,22 @@

import { useState, useEffect } from 'react';
import { forwardRef, useState, useEffect } from 'react';
import { createPortal } from 'react-dom';
import { getDefaultPortalContainer } from './portalContainer.js';
import { getDefaultPortalContainer, setRef } from './utils.js';
const Portal = ({ children, getPortalContainer = getDefaultPortalContainer, }) => {
const [isMount, setIsMount] = useState(false);
const Portal = forwardRef(({ getPortalContainer = getDefaultPortalContainer, children }, ref) => {
const [mountNode, setMountNode] = useState(null);
useEffect(() => {
setIsMount(true);
}, []);
return isMount ? createPortal(children, getPortalContainer()) : null;
};
setMountNode(getPortalContainer());
}, [getPortalContainer]);
useEffect(() => {
if (mountNode) {
setRef(ref, mountNode);
return () => {
setRef(ref, null);
};
}
return () => null;
}, [ref, mountNode]);
return mountNode ? createPortal(children, mountNode) : mountNode;
});
export { Portal };
import 'react';
import 'react-dom';
import './portalContainer.js';
import './utils.js';
export { Portal } from './Component.js';
{
"name": "@alfalab/core-components-portal",
"version": "1.3.3",
"version": "1.4.0",
"description": "Portal component",

@@ -19,3 +19,3 @@ "keywords": [],

},
"gitHead": "b8e497302de3841540914c3918284a73df9f84bd"
"gitHead": "6b303f53b28575eff35ef92e9438826324cde107"
}
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