@elliemae/ds-portal 2.3.0-alpha.9 → 2.3.0-next.0
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 +94 -0
- 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 +22 -0
- package/cjs/index.js +10 -0
- package/esm/DSPortal.js +84 -0
- 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 +19 -0
- package/esm/index.js +1 -0
- package/package.json +22 -24
- package/{dist/types → types}/DSPortal.d.ts +0 -0
- package/{dist/types → types}/ie-remove-polyfill.d.ts +0 -0
- package/{dist/types → types}/index.d.ts +0 -0
- package/dist/cjs/DSPortal.js +0 -88
- package/dist/cjs/DSPortal.js.map +0 -7
- package/dist/cjs/ie-remove-polyfill.js +0 -32
- package/dist/cjs/ie-remove-polyfill.js.map +0 -7
- package/dist/cjs/index.js +0 -36
- package/dist/cjs/index.js.map +0 -7
- package/dist/esm/DSPortal.js +0 -59
- package/dist/esm/DSPortal.js.map +0 -7
- package/dist/esm/ie-remove-polyfill.js +0 -14
- package/dist/esm/ie-remove-polyfill.js.map +0 -7
- package/dist/esm/index.js +0 -7
- package/dist/esm/index.js.map +0 -7
package/cjs/DSPortal.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
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 {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.state = {
|
|
25
|
+
isMounted: false
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
componentDidMount() {
|
|
30
|
+
const {
|
|
31
|
+
onRender
|
|
32
|
+
} = this.props;
|
|
33
|
+
this.portalEl = this.createPortalContainer();
|
|
34
|
+
|
|
35
|
+
if (dsUtilities.DOCUMENT && this.portalEl) {
|
|
36
|
+
dsUtilities.DOCUMENT.body.appendChild(this.portalEl);
|
|
37
|
+
onRender();
|
|
38
|
+
this.setState({
|
|
39
|
+
isMounted: true
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
componentDidUpdate() {
|
|
45
|
+
if (!canRenderPortal) {
|
|
46
|
+
this.renderNoPortal();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
componentWillUnmount() {
|
|
51
|
+
if (this.portalEl) {
|
|
52
|
+
this.portalEl.parentNode.removeChild(this.portalEl);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
createPortalContainer() {
|
|
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');
|
|
65
|
+
container.classList.add(cssClassName);
|
|
66
|
+
container.setAttribute('data-testid', 'portal');
|
|
67
|
+
return container;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
renderNoPortal() {
|
|
71
|
+
const {
|
|
72
|
+
children
|
|
73
|
+
} = this.props;
|
|
74
|
+
ReactDOM__default["default"].unstable_renderSubtreeIntoContainer(this, /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, children), this.portalEl);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
render() {
|
|
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);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
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;
|
|
@@ -0,0 +1,22 @@
|
|
|
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 () {
|
|
10
|
+
this.parentElement.removeChild(this);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
NodeList.prototype.remove = HTMLCollection.prototype.remove = function () {
|
|
14
|
+
for (let i = this.length - 1; i >= 0; i--) {
|
|
15
|
+
if (this[i] && this[i].parentElement) {
|
|
16
|
+
this[i].parentElement.removeChild(this[i]);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = ieRemovePolyfill.__exports;
|
package/cjs/index.js
ADDED
package/esm/DSPortal.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
|
|
12
|
+
class DSPortal extends Component {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.state = {
|
|
16
|
+
isMounted: false
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
componentDidMount() {
|
|
21
|
+
const {
|
|
22
|
+
onRender
|
|
23
|
+
} = this.props;
|
|
24
|
+
this.portalEl = this.createPortalContainer();
|
|
25
|
+
|
|
26
|
+
if (DOCUMENT && this.portalEl) {
|
|
27
|
+
DOCUMENT.body.appendChild(this.portalEl);
|
|
28
|
+
onRender();
|
|
29
|
+
this.setState({
|
|
30
|
+
isMounted: true
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
componentDidUpdate() {
|
|
36
|
+
if (!canRenderPortal) {
|
|
37
|
+
this.renderNoPortal();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
componentWillUnmount() {
|
|
42
|
+
if (this.portalEl) {
|
|
43
|
+
this.portalEl.parentNode.removeChild(this.portalEl);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
createPortalContainer() {
|
|
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');
|
|
56
|
+
container.classList.add(cssClassName);
|
|
57
|
+
container.setAttribute('data-testid', 'portal');
|
|
58
|
+
return container;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
renderNoPortal() {
|
|
62
|
+
const {
|
|
63
|
+
children
|
|
64
|
+
} = this.props;
|
|
65
|
+
ReactDOM.unstable_renderSubtreeIntoContainer(this, /*#__PURE__*/_jsx("div", {}, void 0, children), this.portalEl);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
render() {
|
|
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);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
DSPortal.defaultProps = {
|
|
81
|
+
onRender: () => null
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export { DSPortal, DSPortal as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
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 () {
|
|
9
|
+
this.parentElement.removeChild(this);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
NodeList.prototype.remove = HTMLCollection.prototype.remove = function () {
|
|
13
|
+
for (let i = this.length - 1; i >= 0; i--) {
|
|
14
|
+
if (this[i] && this[i].parentElement) {
|
|
15
|
+
this[i].parentElement.removeChild(this[i]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
package/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DSPortal, DSPortal as default } from './DSPortal.js';
|
package/package.json
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-portal",
|
|
3
|
-
"version": "2.3.0-
|
|
3
|
+
"version": "2.3.0-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Portal",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"module": "./dist/esm/index.js",
|
|
10
|
-
"main": "./dist/cjs/index.js",
|
|
11
|
-
"types": "./dist/types/index.d.ts",
|
|
6
|
+
"module": "./esm/index.js",
|
|
7
|
+
"main": "./cjs/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
12
9
|
"exports": {
|
|
13
10
|
".": {
|
|
14
|
-
"import": "./
|
|
15
|
-
"require": "./
|
|
11
|
+
"import": "./esm/index.js",
|
|
12
|
+
"require": "./cjs/index.js"
|
|
16
13
|
},
|
|
17
14
|
"./ie-remove-polyfill": {
|
|
18
|
-
"import": "./
|
|
19
|
-
"require": "./
|
|
15
|
+
"import": "./esm/ie-remove-polyfill.js",
|
|
16
|
+
"require": "./cjs/ie-remove-polyfill.js"
|
|
20
17
|
},
|
|
21
18
|
"./DSPortal": {
|
|
22
|
-
"import": "./
|
|
23
|
-
"require": "./
|
|
19
|
+
"import": "./esm/DSPortal.js",
|
|
20
|
+
"require": "./cjs/DSPortal.js"
|
|
24
21
|
}
|
|
25
22
|
},
|
|
26
23
|
"sideEffects": [
|
|
@@ -32,13 +29,19 @@
|
|
|
32
29
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
33
30
|
},
|
|
34
31
|
"engines": {
|
|
35
|
-
"
|
|
36
|
-
"node": ">=
|
|
32
|
+
"npm": ">=7",
|
|
33
|
+
"node": ">=14"
|
|
37
34
|
},
|
|
38
35
|
"author": "ICE MT",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
38
|
+
"prebuild": "exit 0",
|
|
39
|
+
"predev": "exit 0",
|
|
40
|
+
"build": "node ../../scripts/build/build.js"
|
|
41
|
+
},
|
|
39
42
|
"dependencies": {
|
|
40
|
-
"@elliemae/ds-classnames": "2.3.0-
|
|
41
|
-
"@elliemae/ds-utilities": "2.3.0-
|
|
43
|
+
"@elliemae/ds-classnames": "2.3.0-next.0",
|
|
44
|
+
"@elliemae/ds-utilities": "2.3.0-next.0"
|
|
42
45
|
},
|
|
43
46
|
"peerDependencies": {
|
|
44
47
|
"react": "^17.0.2",
|
|
@@ -46,12 +49,7 @@
|
|
|
46
49
|
},
|
|
47
50
|
"publishConfig": {
|
|
48
51
|
"access": "public",
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
"scripts": {
|
|
52
|
-
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
53
|
-
"prebuild": "exit 0",
|
|
54
|
-
"predev": "exit 0",
|
|
55
|
-
"build": "node ../../scripts/build/build.js"
|
|
52
|
+
"directory": "dist",
|
|
53
|
+
"generateSubmodules": true
|
|
56
54
|
}
|
|
57
55
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/cjs/DSPortal.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
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 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 {
|
|
42
|
-
constructor() {
|
|
43
|
-
super(...arguments);
|
|
44
|
-
this.state = { isMounted: false };
|
|
45
|
-
}
|
|
46
|
-
componentDidMount() {
|
|
47
|
-
const { onRender } = this.props;
|
|
48
|
-
this.portalEl = this.createPortalContainer();
|
|
49
|
-
if (import_ds_utilities.DOCUMENT && this.portalEl) {
|
|
50
|
-
import_ds_utilities.DOCUMENT.body.appendChild(this.portalEl);
|
|
51
|
-
onRender();
|
|
52
|
-
this.setState({ isMounted: true });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
componentDidUpdate() {
|
|
56
|
-
if (!canRenderPortal) {
|
|
57
|
-
this.renderNoPortal();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
componentWillUnmount() {
|
|
61
|
-
if (this.portalEl) {
|
|
62
|
-
this.portalEl.parentNode.removeChild(this.portalEl);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
createPortalContainer() {
|
|
66
|
-
if (!import_ds_utilities.DOCUMENT)
|
|
67
|
-
return null;
|
|
68
|
-
const { className } = this.props;
|
|
69
|
-
const { cssClassName } = (0, import_ds_classnames.convertPropToCssClassName)(blockName, className);
|
|
70
|
-
const container = import_ds_utilities.DOCUMENT.createElement("div");
|
|
71
|
-
container.classList.add(cssClassName);
|
|
72
|
-
container.setAttribute("data-testid", "portal");
|
|
73
|
-
return container;
|
|
74
|
-
}
|
|
75
|
-
renderNoPortal() {
|
|
76
|
-
const { children } = this.props;
|
|
77
|
-
import_react_dom.default.unstable_renderSubtreeIntoContainer(this, /* @__PURE__ */ import_react.default.createElement("div", null, children), this.portalEl);
|
|
78
|
-
}
|
|
79
|
-
render() {
|
|
80
|
-
const { children } = this.props;
|
|
81
|
-
const { isMounted } = this.state;
|
|
82
|
-
return !canRenderPortal || !isMounted ? null : import_react_dom.default.createPortal(children, this.portalEl);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
DSPortal.defaultProps = { onRender: () => null };
|
|
86
|
-
var DSPortal_default = DSPortal;
|
|
87
|
-
module.exports = __toCommonJS(DSPortal_exports);
|
|
88
|
-
//# sourceMappingURL=DSPortal.js.map
|
package/dist/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 };\nexport default DSPortal;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAiC;AACjC,uBAAqB;AACrB,2BAA0C;AAC1C,0BAAqC;AACrC,gCAAO;AAEP,MAAM,YAAY;AAElB,MAAM,kBAAkB,oCAAW,yBAAS;AAI5C,uBAAuB,uBAAU;AAAA,EAAjC,cAbA;AAaA;AAKE,iBAAQ,EAAE,WAAW;AAAA;AAAA,EAErB,oBAAoB;AAClB,UAAM,EAAE,aAAa,KAAK;AAC1B,SAAK,WAAW,KAAK;AACrB,QAAI,gCAAY,KAAK,UAAU;AAC7B,mCAAS,KAAK,YAAY,KAAK;AAC/B;AACA,WAAK,SAAS,EAAE,WAAW;AAAA;AAAA;AAAA,EAI/B,qBAAqB;AACnB,QAAI,CAAC,iBAAiB;AACpB,WAAK;AAAA;AAAA;AAAA,EAIT,uBAAuB;AACrB,QAAI,KAAK,UAAU;AACjB,WAAK,SAAS,WAAW,YAAY,KAAK;AAAA;AAAA;AAAA,EAI9C,wBAAwB;AACtB,QAAI,CAAC;AAAU,aAAO;AAEtB,UAAM,EAAE,cAAc,KAAK;AAC3B,UAAM,EAAE,iBAAiB,oDAA0B,WAAW;AAC9D,UAAM,YAAY,6BAAS,cAAc;AACzC,cAAU,UAAU,IAAI;AACxB,cAAU,aAAa,eAAe;AAEtC,WAAO;AAAA;AAAA,EAGT,iBAAiB;AACf,UAAM,EAAE,aAAa,KAAK;AAC1B,6BAAS,oCACP,MACA,mDAAC,OAAD,MAAM,WACN,KAAK;AAAA;AAAA,EAIT,SAAS;AACP,UAAM,EAAE,aAAa,KAAK;AAC1B,UAAM,EAAE,cAAc,KAAK;AAC3B,WAAO,CAAC,mBAAmB,CAAC,YACxB,OACA,yBAAS,aAAa,UAAU,KAAK;AAAA;AAAA;AArDpC,AAFT,SAES,eAAe,EAAE,UAAU,MAAM;AAyD1C,IAAO,mBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
9
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
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() {
|
|
22
|
-
this.parentElement.removeChild(this);
|
|
23
|
-
};
|
|
24
|
-
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
|
|
25
|
-
for (let i = this.length - 1; i >= 0; i--) {
|
|
26
|
-
if (this[i] && this[i].parentElement) {
|
|
27
|
-
this[i].parentElement.removeChild(this[i]);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=ie-remove-polyfill.js.map
|
|
@@ -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/dist/cjs/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
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 = __toESM(require("./DSPortal"));
|
|
35
|
-
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
package/dist/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/dist/esm/DSPortal.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2, { Component } from "react";
|
|
3
|
-
import ReactDOM from "react-dom";
|
|
4
|
-
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
5
|
-
import { isFunction, DOCUMENT } from "@elliemae/ds-utilities";
|
|
6
|
-
import "./ie-remove-polyfill";
|
|
7
|
-
const blockName = "portal";
|
|
8
|
-
const canRenderPortal = isFunction(ReactDOM.createPortal);
|
|
9
|
-
class DSPortal extends Component {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this.state = { isMounted: false };
|
|
13
|
-
}
|
|
14
|
-
componentDidMount() {
|
|
15
|
-
const { onRender } = this.props;
|
|
16
|
-
this.portalEl = this.createPortalContainer();
|
|
17
|
-
if (DOCUMENT && this.portalEl) {
|
|
18
|
-
DOCUMENT.body.appendChild(this.portalEl);
|
|
19
|
-
onRender();
|
|
20
|
-
this.setState({ isMounted: true });
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
componentDidUpdate() {
|
|
24
|
-
if (!canRenderPortal) {
|
|
25
|
-
this.renderNoPortal();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
componentWillUnmount() {
|
|
29
|
-
if (this.portalEl) {
|
|
30
|
-
this.portalEl.parentNode.removeChild(this.portalEl);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
createPortalContainer() {
|
|
34
|
-
if (!DOCUMENT)
|
|
35
|
-
return null;
|
|
36
|
-
const { className } = this.props;
|
|
37
|
-
const { cssClassName } = convertPropToCssClassName(blockName, className);
|
|
38
|
-
const container = DOCUMENT.createElement("div");
|
|
39
|
-
container.classList.add(cssClassName);
|
|
40
|
-
container.setAttribute("data-testid", "portal");
|
|
41
|
-
return container;
|
|
42
|
-
}
|
|
43
|
-
renderNoPortal() {
|
|
44
|
-
const { children } = this.props;
|
|
45
|
-
ReactDOM.unstable_renderSubtreeIntoContainer(this, /* @__PURE__ */ React2.createElement("div", null, children), this.portalEl);
|
|
46
|
-
}
|
|
47
|
-
render() {
|
|
48
|
-
const { children } = this.props;
|
|
49
|
-
const { isMounted } = this.state;
|
|
50
|
-
return !canRenderPortal || !isMounted ? null : ReactDOM.createPortal(children, this.portalEl);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
DSPortal.defaultProps = { onRender: () => null };
|
|
54
|
-
var DSPortal_default = DSPortal;
|
|
55
|
-
export {
|
|
56
|
-
DSPortal,
|
|
57
|
-
DSPortal_default as default
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=DSPortal.js.map
|
package/dist/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 ? null\n : ReactDOM.createPortal(children, this.portalEl);\n }\n}\nexport { DSPortal };\nexport default DSPortal;\n"],
|
|
5
|
-
"mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AAEA,MAAM,YAAY;AAElB,MAAM,kBAAkB,WAAW,SAAS;AAI5C,uBAAuB,UAAU;AAAA,EAAjC,cAbA;AAaA;AAKE,iBAAQ,EAAE,WAAW;AAAA;AAAA,EAErB,oBAAoB;AAClB,UAAM,EAAE,aAAa,KAAK;AAC1B,SAAK,WAAW,KAAK;AACrB,QAAI,YAAY,KAAK,UAAU;AAC7B,eAAS,KAAK,YAAY,KAAK;AAC/B;AACA,WAAK,SAAS,EAAE,WAAW;AAAA;AAAA;AAAA,EAI/B,qBAAqB;AACnB,QAAI,CAAC,iBAAiB;AACpB,WAAK;AAAA;AAAA;AAAA,EAIT,uBAAuB;AACrB,QAAI,KAAK,UAAU;AACjB,WAAK,SAAS,WAAW,YAAY,KAAK;AAAA;AAAA;AAAA,EAI9C,wBAAwB;AACtB,QAAI,CAAC;AAAU,aAAO;AAEtB,UAAM,EAAE,cAAc,KAAK;AAC3B,UAAM,EAAE,iBAAiB,0BAA0B,WAAW;AAC9D,UAAM,YAAY,SAAS,cAAc;AACzC,cAAU,UAAU,IAAI;AACxB,cAAU,aAAa,eAAe;AAEtC,WAAO;AAAA;AAAA,EAGT,iBAAiB;AACf,UAAM,EAAE,aAAa,KAAK;AAC1B,aAAS,oCACP,MACA,qCAAC,OAAD,MAAM,WACN,KAAK;AAAA;AAAA,EAIT,SAAS;AACP,UAAM,EAAE,aAAa,KAAK;AAC1B,UAAM,EAAE,cAAc,KAAK;AAC3B,WAAO,CAAC,mBAAmB,CAAC,YACxB,OACA,SAAS,aAAa,UAAU,KAAK;AAAA;AAAA;AArDpC,AAFT,SAES,eAAe,EAAE,UAAU,MAAM;AAyD1C,IAAO,mBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
if (global && global.Element && global.Element.prototype && global.Element.prototype.remove === void 0) {
|
|
3
|
-
window.Element.prototype.remove = function() {
|
|
4
|
-
this.parentElement.removeChild(this);
|
|
5
|
-
};
|
|
6
|
-
NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {
|
|
7
|
-
for (let i = this.length - 1; i >= 0; i--) {
|
|
8
|
-
if (this[i] && this[i].parentElement) {
|
|
9
|
-
this[i].parentElement.removeChild(this[i]);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=ie-remove-polyfill.js.map
|
|
@@ -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;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/dist/esm/index.js
DELETED
package/dist/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
|
-
}
|