@elliemae/ds-portal 2.0.0-alpha.1 → 2.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DSPortal.js +16 -19
- package/cjs/_virtual/{ie-remove-polyfill.tsx_commonjs-exports → ie-remove-polyfill.tsx_commonjs-exports.js} +0 -0
- package/cjs/ie-remove-polyfill.js +1 -1
- package/cjs/index.js +1 -1
- package/esm/DSPortal.js +8 -10
- package/esm/_virtual/{ie-remove-polyfill.tsx_commonjs-exports → ie-remove-polyfill.tsx_commonjs-exports.js} +0 -0
- package/esm/ie-remove-polyfill.js +2 -2
- package/package.json +3 -3
- package/types/DSPortal.d.ts +1 -1
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
package/cjs/DSPortal.js
CHANGED
|
@@ -3,30 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var ReactDOM = require('react-dom');
|
|
9
9
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
10
|
-
var
|
|
11
|
-
var platform = require('@elliemae/ds-utilities/platform');
|
|
10
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
12
11
|
require('./ie-remove-polyfill.js');
|
|
13
12
|
|
|
14
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
14
|
|
|
16
15
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
18
16
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
19
17
|
|
|
20
18
|
const blockName = 'portal';
|
|
21
|
-
const canRenderPortal =
|
|
19
|
+
const canRenderPortal = dsUtilities.isFunction(ReactDOM__default["default"].createPortal); // TODO: If this is rendered on server, is going to break
|
|
22
20
|
|
|
23
21
|
class DSPortal extends react.Component {
|
|
24
|
-
constructor(
|
|
25
|
-
super(...
|
|
26
|
-
|
|
27
|
-
_defineProperty__default['default'](this, "state", {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.state = {
|
|
28
25
|
isMounted: false
|
|
29
|
-
}
|
|
26
|
+
};
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
componentDidMount() {
|
|
@@ -35,8 +32,8 @@ class DSPortal extends react.Component {
|
|
|
35
32
|
} = this.props;
|
|
36
33
|
this.portalEl = this.createPortalContainer();
|
|
37
34
|
|
|
38
|
-
if (
|
|
39
|
-
|
|
35
|
+
if (dsUtilities.DOCUMENT && this.portalEl) {
|
|
36
|
+
dsUtilities.DOCUMENT.body.appendChild(this.portalEl);
|
|
40
37
|
onRender();
|
|
41
38
|
this.setState({
|
|
42
39
|
isMounted: true
|
|
@@ -57,14 +54,14 @@ class DSPortal extends react.Component {
|
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
createPortalContainer() {
|
|
60
|
-
if (!
|
|
57
|
+
if (!dsUtilities.DOCUMENT) return null;
|
|
61
58
|
const {
|
|
62
59
|
className
|
|
63
60
|
} = this.props;
|
|
64
61
|
const {
|
|
65
62
|
cssClassName
|
|
66
63
|
} = dsClassnames.convertPropToCssClassName(blockName, className);
|
|
67
|
-
const container =
|
|
64
|
+
const container = dsUtilities.DOCUMENT.createElement('div');
|
|
68
65
|
container.classList.add(cssClassName);
|
|
69
66
|
container.setAttribute('data-testid', 'portal');
|
|
70
67
|
return container;
|
|
@@ -74,7 +71,7 @@ class DSPortal extends react.Component {
|
|
|
74
71
|
const {
|
|
75
72
|
children
|
|
76
73
|
} = this.props;
|
|
77
|
-
ReactDOM__default[
|
|
74
|
+
ReactDOM__default["default"].unstable_renderSubtreeIntoContainer(this, /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, children), this.portalEl);
|
|
78
75
|
}
|
|
79
76
|
|
|
80
77
|
render() {
|
|
@@ -84,14 +81,14 @@ class DSPortal extends react.Component {
|
|
|
84
81
|
const {
|
|
85
82
|
isMounted
|
|
86
83
|
} = this.state;
|
|
87
|
-
return !canRenderPortal || !isMounted ? null : /*#__PURE__*/ReactDOM__default[
|
|
84
|
+
return !canRenderPortal || !isMounted ? null : /*#__PURE__*/ReactDOM__default["default"].createPortal(children, this.portalEl);
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
}
|
|
91
88
|
|
|
92
|
-
|
|
89
|
+
DSPortal.defaultProps = {
|
|
93
90
|
onRender: () => null
|
|
94
|
-
}
|
|
91
|
+
};
|
|
95
92
|
|
|
96
93
|
exports.DSPortal = DSPortal;
|
|
97
|
-
exports[
|
|
94
|
+
exports["default"] = DSPortal;
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _commonjsHelpers = require('./_virtual/_commonjsHelpers.js');
|
|
4
|
-
var ieRemovePolyfill = require('./_virtual/ie-remove-polyfill.tsx_commonjs-exports');
|
|
4
|
+
var ieRemovePolyfill = require('./_virtual/ie-remove-polyfill.tsx_commonjs-exports.js');
|
|
5
5
|
|
|
6
6
|
/* eslint-disable no-multi-assign,no-loops/no-loops, no-plusplus */
|
|
7
7
|
|
package/cjs/index.js
CHANGED
package/esm/DSPortal.js
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
3
|
import { Component } from 'react';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
5
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
6
|
-
import { isFunction } from '@elliemae/ds-utilities
|
|
7
|
-
import { DOCUMENT } from '@elliemae/ds-utilities/platform';
|
|
6
|
+
import { isFunction, DOCUMENT } from '@elliemae/ds-utilities';
|
|
8
7
|
import './ie-remove-polyfill.js';
|
|
9
8
|
|
|
10
9
|
const blockName = 'portal';
|
|
11
10
|
const canRenderPortal = isFunction(ReactDOM.createPortal); // TODO: If this is rendered on server, is going to break
|
|
12
11
|
|
|
13
12
|
class DSPortal extends Component {
|
|
14
|
-
constructor(
|
|
15
|
-
super(...
|
|
16
|
-
|
|
17
|
-
_defineProperty(this, "state", {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.state = {
|
|
18
16
|
isMounted: false
|
|
19
|
-
}
|
|
17
|
+
};
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
componentDidMount() {
|
|
@@ -79,8 +77,8 @@ class DSPortal extends Component {
|
|
|
79
77
|
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
|
|
80
|
+
DSPortal.defaultProps = {
|
|
83
81
|
onRender: () => null
|
|
84
|
-
}
|
|
82
|
+
};
|
|
85
83
|
|
|
86
84
|
export { DSPortal, DSPortal as default };
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { commonjsGlobal } from './_virtual/_commonjsHelpers.js';
|
|
2
|
-
import { __exports as ieRemovePolyfill } from './_virtual/ie-remove-polyfill.tsx_commonjs-exports';
|
|
3
|
-
export { __exports as default } from './_virtual/ie-remove-polyfill.tsx_commonjs-exports';
|
|
2
|
+
import { __exports as ieRemovePolyfill } from './_virtual/ie-remove-polyfill.tsx_commonjs-exports.js';
|
|
3
|
+
export { __exports as default } from './_virtual/ie-remove-polyfill.tsx_commonjs-exports.js';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable no-multi-assign,no-loops/no-loops, no-plusplus */
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-portal",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Portal",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"build": "node ../../scripts/build/build.js"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elliemae/ds-classnames": "2.0.0-alpha.
|
|
44
|
-
"@elliemae/ds-utilities": "2.0.0-alpha.
|
|
43
|
+
"@elliemae/ds-classnames": "2.0.0-alpha.13",
|
|
44
|
+
"@elliemae/ds-utilities": "2.0.0-alpha.13"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^17.0.2",
|
package/types/DSPortal.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare class DSPortal extends Component {
|
|
|
10
10
|
componentDidMount(): void;
|
|
11
11
|
componentDidUpdate(): void;
|
|
12
12
|
componentWillUnmount(): void;
|
|
13
|
-
createPortalContainer():
|
|
13
|
+
createPortalContainer(): HTMLDivElement | null;
|
|
14
14
|
renderNoPortal(): void;
|
|
15
15
|
render(): React.ReactPortal | null;
|
|
16
16
|
}
|
package/cjs/package.json
DELETED