@elliemae/ds-portal 2.2.0-alpha.4 → 3.0.0-next.2
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 +67 -61
- package/cjs/_virtual/_commonjsHelpers.js +7 -0
- package/cjs/_virtual/ie-remove-polyfill.tsx_commonjs-exports.js +7 -0
- package/cjs/ie-remove-polyfill.js +13 -23
- package/cjs/index.js +10 -36
- package/esm/DSPortal.js +53 -28
- package/esm/_virtual/_commonjsHelpers.js +3 -0
- package/esm/_virtual/ie-remove-polyfill.tsx_commonjs-exports.js +3 -0
- package/esm/ie-remove-polyfill.js +10 -5
- package/esm/index.js +1 -7
- package/package.json +3 -3
- package/cjs/DSPortal.js.map +0 -7
- package/cjs/ie-remove-polyfill.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/esm/DSPortal.js.map +0 -7
- package/esm/ie-remove-polyfill.js.map +0 -7
- package/esm/index.js.map +0 -7
package/cjs/DSPortal.js
CHANGED
|
@@ -1,88 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var DSPortal_exports = {};
|
|
29
|
-
__export(DSPortal_exports, {
|
|
30
|
-
DSPortal: () => DSPortal,
|
|
31
|
-
default: () => DSPortal_default
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_react_dom = __toESM(require("react-dom"));
|
|
36
|
-
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
37
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
38
|
-
var import_ie_remove_polyfill = require("./ie-remove-polyfill");
|
|
39
|
-
const blockName = "portal";
|
|
40
|
-
const canRenderPortal = (0, import_ds_utilities.isFunction)(import_react_dom.default.createPortal);
|
|
41
|
-
class DSPortal extends import_react.Component {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var ReactDOM = require('react-dom');
|
|
9
|
+
var dsClassnames = require('@elliemae/ds-classnames');
|
|
10
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
11
|
+
require('./ie-remove-polyfill.js');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
|
+
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
17
|
+
|
|
18
|
+
const blockName = 'portal';
|
|
19
|
+
const canRenderPortal = dsUtilities.isFunction(ReactDOM__default["default"].createPortal); // TODO: If this is rendered on server, is going to break
|
|
20
|
+
|
|
21
|
+
class DSPortal extends react.Component {
|
|
42
22
|
constructor() {
|
|
43
23
|
super(...arguments);
|
|
44
|
-
this.state = {
|
|
24
|
+
this.state = {
|
|
25
|
+
isMounted: false
|
|
26
|
+
};
|
|
45
27
|
}
|
|
28
|
+
|
|
46
29
|
componentDidMount() {
|
|
47
|
-
const {
|
|
30
|
+
const {
|
|
31
|
+
onRender
|
|
32
|
+
} = this.props;
|
|
48
33
|
this.portalEl = this.createPortalContainer();
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
|
|
35
|
+
if (dsUtilities.DOCUMENT && this.portalEl) {
|
|
36
|
+
dsUtilities.DOCUMENT.body.appendChild(this.portalEl);
|
|
51
37
|
onRender();
|
|
52
|
-
this.setState({
|
|
38
|
+
this.setState({
|
|
39
|
+
isMounted: true
|
|
40
|
+
});
|
|
53
41
|
}
|
|
54
42
|
}
|
|
43
|
+
|
|
55
44
|
componentDidUpdate() {
|
|
56
45
|
if (!canRenderPortal) {
|
|
57
46
|
this.renderNoPortal();
|
|
58
47
|
}
|
|
59
48
|
}
|
|
49
|
+
|
|
60
50
|
componentWillUnmount() {
|
|
61
51
|
if (this.portalEl) {
|
|
62
52
|
this.portalEl.parentNode.removeChild(this.portalEl);
|
|
63
53
|
}
|
|
64
54
|
}
|
|
55
|
+
|
|
65
56
|
createPortalContainer() {
|
|
66
|
-
if (!
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
57
|
+
if (!dsUtilities.DOCUMENT) return null;
|
|
58
|
+
const {
|
|
59
|
+
className
|
|
60
|
+
} = this.props;
|
|
61
|
+
const {
|
|
62
|
+
cssClassName
|
|
63
|
+
} = dsClassnames.convertPropToCssClassName(blockName, className);
|
|
64
|
+
const container = dsUtilities.DOCUMENT.createElement('div');
|
|
71
65
|
container.classList.add(cssClassName);
|
|
72
|
-
container.setAttribute(
|
|
66
|
+
container.setAttribute('data-testid', 'portal');
|
|
73
67
|
return container;
|
|
74
68
|
}
|
|
69
|
+
|
|
75
70
|
renderNoPortal() {
|
|
76
|
-
const {
|
|
77
|
-
|
|
71
|
+
const {
|
|
72
|
+
children
|
|
73
|
+
} = this.props;
|
|
74
|
+
ReactDOM__default["default"].unstable_renderSubtreeIntoContainer(this, /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, children), this.portalEl);
|
|
78
75
|
}
|
|
76
|
+
|
|
79
77
|
render() {
|
|
80
|
-
const {
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
const {
|
|
79
|
+
children
|
|
80
|
+
} = this.props;
|
|
81
|
+
const {
|
|
82
|
+
isMounted
|
|
83
|
+
} = this.state;
|
|
84
|
+
return !canRenderPortal || !isMounted ? null : /*#__PURE__*/ReactDOM__default["default"].createPortal(children, this.portalEl);
|
|
83
85
|
}
|
|
86
|
+
|
|
84
87
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
|
|
89
|
+
DSPortal.defaultProps = {
|
|
90
|
+
onRender: () => null
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
exports.DSPortal = DSPortal;
|
|
94
|
+
exports["default"] = DSPortal;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
6
|
+
|
|
7
|
+
exports.commonjsGlobal = commonjsGlobal;
|
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
for (let key of __getOwnPropNames(module2))
|
|
11
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
12
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (module2, isNodeMode) => {
|
|
17
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
18
|
-
};
|
|
19
|
-
var React = __toESM(require("react"));
|
|
20
|
-
if (global && global.Element && global.Element.prototype && global.Element.prototype.remove === void 0) {
|
|
21
|
-
window.Element.prototype.remove = function() {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _commonjsHelpers = require('./_virtual/_commonjsHelpers.js');
|
|
4
|
+
var ieRemovePolyfill = require('./_virtual/ie-remove-polyfill.tsx_commonjs-exports.js');
|
|
5
|
+
|
|
6
|
+
/* eslint-disable no-multi-assign,no-loops/no-loops, no-plusplus */
|
|
7
|
+
|
|
8
|
+
if (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.Element && _commonjsHelpers.commonjsGlobal.Element.prototype && _commonjsHelpers.commonjsGlobal.Element.prototype.remove === undefined) {
|
|
9
|
+
window.Element.prototype.remove = function () {
|
|
22
10
|
this.parentElement.removeChild(this);
|
|
23
11
|
};
|
|
24
|
-
|
|
12
|
+
|
|
13
|
+
NodeList.prototype.remove = HTMLCollection.prototype.remove = function () {
|
|
25
14
|
for (let i = this.length - 1; i >= 0; i--) {
|
|
26
15
|
if (this[i] && this[i].parentElement) {
|
|
27
16
|
this[i].parentElement.removeChild(this[i]);
|
|
@@ -29,4 +18,5 @@ if (global && global.Element && global.Element.prototype && global.Element.proto
|
|
|
29
18
|
}
|
|
30
19
|
};
|
|
31
20
|
}
|
|
32
|
-
|
|
21
|
+
|
|
22
|
+
module.exports = ieRemovePolyfill.__exports;
|
package/cjs/index.js
CHANGED
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
default: () => import_DSPortal.default
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
__reExport(src_exports, require("./DSPortal"));
|
|
34
|
-
var import_DSPortal = require("./DSPortal");
|
|
35
|
-
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var DSPortal = require('./DSPortal.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.DSPortal = DSPortal.DSPortal;
|
|
10
|
+
exports["default"] = DSPortal.DSPortal;
|
package/esm/DSPortal.js
CHANGED
|
@@ -1,59 +1,84 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import { Component } from 'react';
|
|
4
|
+
import ReactDOM from 'react-dom';
|
|
5
|
+
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
6
|
+
import { isFunction, DOCUMENT } from '@elliemae/ds-utilities';
|
|
7
|
+
import './ie-remove-polyfill.js';
|
|
8
|
+
|
|
9
|
+
const blockName = 'portal';
|
|
10
|
+
const canRenderPortal = isFunction(ReactDOM.createPortal); // TODO: If this is rendered on server, is going to break
|
|
11
|
+
|
|
9
12
|
class DSPortal extends Component {
|
|
10
13
|
constructor() {
|
|
11
14
|
super(...arguments);
|
|
12
|
-
this.state = {
|
|
15
|
+
this.state = {
|
|
16
|
+
isMounted: false
|
|
17
|
+
};
|
|
13
18
|
}
|
|
19
|
+
|
|
14
20
|
componentDidMount() {
|
|
15
|
-
const {
|
|
21
|
+
const {
|
|
22
|
+
onRender
|
|
23
|
+
} = this.props;
|
|
16
24
|
this.portalEl = this.createPortalContainer();
|
|
25
|
+
|
|
17
26
|
if (DOCUMENT && this.portalEl) {
|
|
18
27
|
DOCUMENT.body.appendChild(this.portalEl);
|
|
19
28
|
onRender();
|
|
20
|
-
this.setState({
|
|
29
|
+
this.setState({
|
|
30
|
+
isMounted: true
|
|
31
|
+
});
|
|
21
32
|
}
|
|
22
33
|
}
|
|
34
|
+
|
|
23
35
|
componentDidUpdate() {
|
|
24
36
|
if (!canRenderPortal) {
|
|
25
37
|
this.renderNoPortal();
|
|
26
38
|
}
|
|
27
39
|
}
|
|
40
|
+
|
|
28
41
|
componentWillUnmount() {
|
|
29
42
|
if (this.portalEl) {
|
|
30
43
|
this.portalEl.parentNode.removeChild(this.portalEl);
|
|
31
44
|
}
|
|
32
45
|
}
|
|
46
|
+
|
|
33
47
|
createPortalContainer() {
|
|
34
|
-
if (!DOCUMENT)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
48
|
+
if (!DOCUMENT) return null;
|
|
49
|
+
const {
|
|
50
|
+
className
|
|
51
|
+
} = this.props;
|
|
52
|
+
const {
|
|
53
|
+
cssClassName
|
|
54
|
+
} = convertPropToCssClassName(blockName, className);
|
|
55
|
+
const container = DOCUMENT.createElement('div');
|
|
39
56
|
container.classList.add(cssClassName);
|
|
40
|
-
container.setAttribute(
|
|
57
|
+
container.setAttribute('data-testid', 'portal');
|
|
41
58
|
return container;
|
|
42
59
|
}
|
|
60
|
+
|
|
43
61
|
renderNoPortal() {
|
|
44
|
-
const {
|
|
45
|
-
|
|
62
|
+
const {
|
|
63
|
+
children
|
|
64
|
+
} = this.props;
|
|
65
|
+
ReactDOM.unstable_renderSubtreeIntoContainer(this, /*#__PURE__*/_jsx("div", {}, void 0, children), this.portalEl);
|
|
46
66
|
}
|
|
67
|
+
|
|
47
68
|
render() {
|
|
48
|
-
const {
|
|
49
|
-
|
|
50
|
-
|
|
69
|
+
const {
|
|
70
|
+
children
|
|
71
|
+
} = this.props;
|
|
72
|
+
const {
|
|
73
|
+
isMounted
|
|
74
|
+
} = this.state;
|
|
75
|
+
return !canRenderPortal || !isMounted ? null : /*#__PURE__*/ReactDOM.createPortal(children, this.portalEl);
|
|
51
76
|
}
|
|
77
|
+
|
|
52
78
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
DSPortal,
|
|
57
|
-
DSPortal_default as default
|
|
79
|
+
|
|
80
|
+
DSPortal.defaultProps = {
|
|
81
|
+
onRender: () => null
|
|
58
82
|
};
|
|
59
|
-
|
|
83
|
+
|
|
84
|
+
export { DSPortal, DSPortal as default };
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { commonjsGlobal } from './_virtual/_commonjsHelpers.js';
|
|
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
|
+
|
|
5
|
+
/* eslint-disable no-multi-assign,no-loops/no-loops, no-plusplus */
|
|
6
|
+
|
|
7
|
+
if (commonjsGlobal && commonjsGlobal.Element && commonjsGlobal.Element.prototype && commonjsGlobal.Element.prototype.remove === undefined) {
|
|
8
|
+
window.Element.prototype.remove = function () {
|
|
4
9
|
this.parentElement.removeChild(this);
|
|
5
10
|
};
|
|
6
|
-
|
|
11
|
+
|
|
12
|
+
NodeList.prototype.remove = HTMLCollection.prototype.remove = function () {
|
|
7
13
|
for (let i = this.length - 1; i >= 0; i--) {
|
|
8
14
|
if (this[i] && this[i].parentElement) {
|
|
9
15
|
this[i].parentElement.removeChild(this[i]);
|
|
@@ -11,4 +17,3 @@ if (global && global.Element && global.Element.prototype && global.Element.proto
|
|
|
11
17
|
}
|
|
12
18
|
};
|
|
13
19
|
}
|
|
14
|
-
//# sourceMappingURL=ie-remove-polyfill.js.map
|
package/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-portal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-next.2",
|
|
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": "
|
|
44
|
-
"@elliemae/ds-utilities": "
|
|
43
|
+
"@elliemae/ds-classnames": "3.0.0-next.2",
|
|
44
|
+
"@elliemae/ds-utilities": "3.0.0-next.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^17.0.2",
|
package/cjs/DSPortal.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/DSPortal.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable react/prop-types */\nimport React, { Component } from 'react';\nimport ReactDOM from 'react-dom';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { isFunction, DOCUMENT } from '@elliemae/ds-utilities';\nimport './ie-remove-polyfill';\n\nconst blockName = 'portal';\n\nconst canRenderPortal = isFunction(ReactDOM.createPortal);\n\n// TODO: If this is rendered on server, is going to break\n\nclass DSPortal extends Component {\n // eslint-disable-next-line react/static-property-placement\n static defaultProps = { onRender: () => null };\n\n // eslint-disable-next-line react/state-in-constructor\n state = { isMounted: false };\n\n componentDidMount() {\n const { onRender } = this.props;\n this.portalEl = this.createPortalContainer();\n if (DOCUMENT && this.portalEl) {\n DOCUMENT.body.appendChild(this.portalEl);\n onRender();\n this.setState({ isMounted: true });\n }\n }\n\n componentDidUpdate() {\n if (!canRenderPortal) {\n this.renderNoPortal();\n }\n }\n\n componentWillUnmount() {\n if (this.portalEl) {\n this.portalEl.parentNode.removeChild(this.portalEl);\n }\n }\n\n createPortalContainer() {\n if (!DOCUMENT) return null;\n\n const { className } = this.props;\n const { cssClassName } = convertPropToCssClassName(blockName, className);\n const container = DOCUMENT.createElement('div');\n container.classList.add(cssClassName);\n container.setAttribute('data-testid', 'portal');\n\n return container;\n }\n\n renderNoPortal() {\n const { children } = this.props;\n ReactDOM.unstable_renderSubtreeIntoContainer(\n this,\n <div>{children}</div>,\n this.portalEl,\n );\n }\n\n render() {\n const { children } = this.props;\n const { isMounted } = this.state;\n return !canRenderPortal || !isMounted\n ? null\n : ReactDOM.createPortal(children, this.portalEl);\n }\n}\nexport { DSPortal };\nex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AAyD1C,IAAO,mBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ie-remove-polyfill.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-multi-assign,no-loops/no-loops, no-plusplus */\nif (\n global &&\n global.Element &&\n global.Element.prototype &&\n global.Element.prototype.remove === undefined\n) {\n window.Element.prototype.remove = function() {\n this.parentElement.removeChild(this);\n };\n NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {\n for (let i = this.length - 1; i >= 0; i--) {\n if (this[i] && this[i].parentElement) {\n this[i].parentElement.removeChild(this[i]);\n }\n }\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACCvB,IACE,UACA,OAAO,WACP,OAAO,QAAQ,aACf,OAAO,QAAQ,UAAU,WAAW,QACpC;AACA,SAAO,QAAQ,UAAU,SAAS,WAAW;AAC3C,SAAK,cAAc,YAAY;AAAA;AAEjC,WAAS,UAAU,SAAS,eAAe,UAAU,SAAS,WAAW;AACvE,aAAS,IAAI,KAAK,SAAS,GAAG,KAAK,GAAG,KAAK;AACzC,UAAI,KAAK,MAAM,KAAK,GAAG,eAAe;AACpC,aAAK,GAAG,cAAc,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/cjs/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export * from './DSPortal';\nexport { default } from './DSPortal';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AACd,sBAAwB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/esm/DSPortal.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSPortal.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { Component } from 'react';\nimport ReactDOM from 'react-dom';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { isFunction, DOCUMENT } from '@elliemae/ds-utilities';\nimport './ie-remove-polyfill';\n\nconst blockName = 'portal';\n\nconst canRenderPortal = isFunction(ReactDOM.createPortal);\n\n// TODO: If this is rendered on server, is going to break\n\nclass DSPortal extends Component {\n // eslint-disable-next-line react/static-property-placement\n static defaultProps = { onRender: () => null };\n\n // eslint-disable-next-line react/state-in-constructor\n state = { isMounted: false };\n\n componentDidMount() {\n const { onRender } = this.props;\n this.portalEl = this.createPortalContainer();\n if (DOCUMENT && this.portalEl) {\n DOCUMENT.body.appendChild(this.portalEl);\n onRender();\n this.setState({ isMounted: true });\n }\n }\n\n componentDidUpdate() {\n if (!canRenderPortal) {\n this.renderNoPortal();\n }\n }\n\n componentWillUnmount() {\n if (this.portalEl) {\n this.portalEl.parentNode.removeChild(this.portalEl);\n }\n }\n\n createPortalContainer() {\n if (!DOCUMENT) return null;\n\n const { className } = this.props;\n const { cssClassName } = convertPropToCssClassName(blockName, className);\n const container = DOCUMENT.createElement('div');\n container.classList.add(cssClassName);\n container.setAttribute('data-testid', 'portal');\n\n return container;\n }\n\n renderNoPortal() {\n const { children } = this.props;\n ReactDOM.unstable_renderSubtreeIntoContainer(\n this,\n <div>{children}</div>,\n this.portalEl,\n );\n }\n\n render() {\n const { children } = this.props;\n const { isMounted } = this.state;\n return !canRenderPortal || !isMounted\n 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{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ie-remove-polyfill.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-multi-assign,no-loops/no-loops, no-plusplus */\nif (\n global &&\n global.Element &&\n global.Element.prototype &&\n global.Element.prototype.remove === undefined\n) {\n window.Element.prototype.remove = function() {\n this.parentElement.removeChild(this);\n };\n NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {\n for (let i = this.length - 1; i >= 0; i--) {\n if (this[i] && this[i].parentElement) {\n this[i].parentElement.removeChild(this[i]);\n }\n }\n };\n}\n"],
|
|
5
|
-
"mappings": "AAAA;ACCA,IACE,UACA,OAAO,WACP,OAAO,QAAQ,aACf,OAAO,QAAQ,UAAU,WAAW,QACpC;AACA,SAAO,QAAQ,UAAU,SAAS,WAAW;AAC3C,SAAK,cAAc,YAAY;AAAA;AAEjC,WAAS,UAAU,SAAS,eAAe,UAAU,SAAS,WAAW;AACvE,aAAS,IAAI,KAAK,SAAS,GAAG,KAAK,GAAG,KAAK;AACzC,UAAI,KAAK,MAAM,KAAK,GAAG,eAAe;AACpC,aAAK,GAAG,cAAc,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/esm/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSPortal';\nexport { default } from './DSPortal';\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|