@elliemae/ds-portal 1.60.0 → 2.0.0-alpha.12
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 -94
- 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 +5 -7
- package/cjs/index.js +1 -12
- package/esm/DSPortal.js +62 -84
- 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 +4 -7
- package/esm/index.js +0 -11
- package/package.json +34 -9
- package/types/DSPortal.d.ts +18 -0
- package/types/ie-remove-polyfill.d.ts +0 -0
- package/types/index.d.ts +2 -0
- package/DSPortal/package.json +0 -10
- package/cjs/DSPortal.js.map +0 -1
- package/cjs/ie-remove-polyfill.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/esm/DSPortal.js.map +0 -1
- package/esm/ie-remove-polyfill.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/ie-remove-polyfill/package.json +0 -10
package/cjs/DSPortal.js
CHANGED
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var _possibleConstructorReturn = require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
9
|
-
var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
|
|
10
|
-
var React = require('react');
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
var react = require('react');
|
|
11
8
|
var ReactDOM = require('react-dom');
|
|
12
9
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
13
10
|
var dsUtilities = require('@elliemae/ds-utilities');
|
|
@@ -15,107 +12,83 @@ require('./ie-remove-polyfill.js');
|
|
|
15
12
|
|
|
16
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
14
|
|
|
18
|
-
var
|
|
19
|
-
var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
|
|
20
|
-
var _inherits__default = /*#__PURE__*/_interopDefaultLegacy(_inherits);
|
|
21
|
-
var _possibleConstructorReturn__default = /*#__PURE__*/_interopDefaultLegacy(_possibleConstructorReturn);
|
|
22
|
-
var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeOf);
|
|
23
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
24
16
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
25
17
|
|
|
26
|
-
|
|
18
|
+
const blockName = 'portal';
|
|
19
|
+
const canRenderPortal = dsUtilities.isFunction(ReactDOM__default["default"].createPortal); // TODO: If this is rendered on server, is going to break
|
|
27
20
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var DSPortal = /*#__PURE__*/function (_Component) {
|
|
33
|
-
_inherits__default['default'](DSPortal, _Component);
|
|
34
|
-
|
|
35
|
-
var _super = _createSuper(DSPortal);
|
|
36
|
-
|
|
37
|
-
function DSPortal() {
|
|
38
|
-
var _this;
|
|
39
|
-
|
|
40
|
-
_classCallCheck__default['default'](this, DSPortal);
|
|
41
|
-
|
|
42
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
43
|
-
args[_key] = arguments[_key];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
47
|
-
_this.state = {
|
|
21
|
+
class DSPortal extends react.Component {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.state = {
|
|
48
25
|
isMounted: false
|
|
49
26
|
};
|
|
50
|
-
return _this;
|
|
51
27
|
}
|
|
52
28
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, {
|
|
68
|
-
key: "componentDidUpdate",
|
|
69
|
-
value: function componentDidUpdate() {
|
|
70
|
-
if (!canRenderPortal) {
|
|
71
|
-
this.renderNoPortal();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}, {
|
|
75
|
-
key: "componentWillUnmount",
|
|
76
|
-
value: function componentWillUnmount() {
|
|
77
|
-
if (this.portalEl) {
|
|
78
|
-
this.portalEl.parentNode.removeChild(this.portalEl);
|
|
79
|
-
}
|
|
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
|
+
});
|
|
80
41
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var _convertPropToCssClas = dsClassnames.convertPropToCssClassName(blockName, className),
|
|
88
|
-
cssClassName = _convertPropToCssClas.cssClassName;
|
|
89
|
-
|
|
90
|
-
var container = dsUtilities.DOCUMENT.createElement('div');
|
|
91
|
-
container.classList.add(cssClassName);
|
|
92
|
-
container.setAttribute('data-testid', 'portal');
|
|
93
|
-
return container;
|
|
94
|
-
}
|
|
95
|
-
}, {
|
|
96
|
-
key: "renderNoPortal",
|
|
97
|
-
value: function renderNoPortal() {
|
|
98
|
-
var children = this.props.children;
|
|
99
|
-
ReactDOM__default['default'].unstable_renderSubtreeIntoContainer(this, /*#__PURE__*/React__default['default'].createElement("div", null, children), this.portalEl);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
componentDidUpdate() {
|
|
45
|
+
if (!canRenderPortal) {
|
|
46
|
+
this.renderNoPortal();
|
|
100
47
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return !canRenderPortal || !isMounted ? null : /*#__PURE__*/ReactDOM__default['default'].createPortal(children, this.portalEl);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
componentWillUnmount() {
|
|
51
|
+
if (this.portalEl) {
|
|
52
|
+
this.portalEl.parentNode.removeChild(this.portalEl);
|
|
107
53
|
}
|
|
108
|
-
}
|
|
54
|
+
}
|
|
109
55
|
|
|
110
|
-
|
|
111
|
-
|
|
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
|
+
}
|
|
112
69
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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);
|
|
116
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
|
|
117
91
|
};
|
|
118
92
|
|
|
119
93
|
exports.DSPortal = DSPortal;
|
|
120
|
-
exports[
|
|
121
|
-
//# sourceMappingURL=DSPortal.js.map
|
|
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,18 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var ieRemovePolyfill = {};
|
|
3
|
+
var _commonjsHelpers = require('./_virtual/_commonjsHelpers.js');
|
|
4
|
+
var ieRemovePolyfill = require('./_virtual/ie-remove-polyfill.tsx_commonjs-exports.js');
|
|
6
5
|
|
|
7
6
|
/* eslint-disable no-multi-assign,no-loops/no-loops, no-plusplus */
|
|
8
7
|
|
|
9
|
-
if (commonjsGlobal && commonjsGlobal.Element && commonjsGlobal.Element.prototype && commonjsGlobal.Element.prototype.remove === undefined) {
|
|
8
|
+
if (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.Element && _commonjsHelpers.commonjsGlobal.Element.prototype && _commonjsHelpers.commonjsGlobal.Element.prototype.remove === undefined) {
|
|
10
9
|
window.Element.prototype.remove = function () {
|
|
11
10
|
this.parentElement.removeChild(this);
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
NodeList.prototype.remove = HTMLCollection.prototype.remove = function () {
|
|
15
|
-
for (
|
|
14
|
+
for (let i = this.length - 1; i >= 0; i--) {
|
|
16
15
|
if (this[i] && this[i].parentElement) {
|
|
17
16
|
this[i].parentElement.removeChild(this[i]);
|
|
18
17
|
}
|
|
@@ -20,5 +19,4 @@ if (commonjsGlobal && commonjsGlobal.Element && commonjsGlobal.Element.prototype
|
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
module.exports = ieRemovePolyfill;
|
|
24
|
-
//# sourceMappingURL=ie-remove-polyfill.js.map
|
|
22
|
+
module.exports = ieRemovePolyfill.__exports;
|
package/cjs/index.js
CHANGED
|
@@ -3,19 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var DSPortal = require('./DSPortal.js');
|
|
6
|
-
require('@babel/runtime/helpers/classCallCheck');
|
|
7
|
-
require('@babel/runtime/helpers/createClass');
|
|
8
|
-
require('@babel/runtime/helpers/inherits');
|
|
9
|
-
require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
10
|
-
require('@babel/runtime/helpers/getPrototypeOf');
|
|
11
|
-
require('react');
|
|
12
|
-
require('react-dom');
|
|
13
|
-
require('@elliemae/ds-classnames');
|
|
14
|
-
require('@elliemae/ds-utilities');
|
|
15
|
-
require('./ie-remove-polyfill.js');
|
|
16
6
|
|
|
17
7
|
|
|
18
8
|
|
|
19
9
|
exports.DSPortal = DSPortal.DSPortal;
|
|
20
|
-
exports
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
10
|
+
exports["default"] = DSPortal.DSPortal;
|
package/esm/DSPortal.js
CHANGED
|
@@ -1,106 +1,84 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';
|
|
5
|
-
import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
|
|
6
|
-
import React, { Component } from 'react';
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import { Component } from 'react';
|
|
7
4
|
import ReactDOM from 'react-dom';
|
|
8
5
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
9
6
|
import { isFunction, DOCUMENT } from '@elliemae/ds-utilities';
|
|
10
7
|
import './ie-remove-polyfill.js';
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
const blockName = 'portal';
|
|
10
|
+
const canRenderPortal = isFunction(ReactDOM.createPortal); // TODO: If this is rendered on server, is going to break
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var DSPortal = /*#__PURE__*/function (_Component) {
|
|
19
|
-
_inherits(DSPortal, _Component);
|
|
20
|
-
|
|
21
|
-
var _super = _createSuper(DSPortal);
|
|
22
|
-
|
|
23
|
-
function DSPortal() {
|
|
24
|
-
var _this;
|
|
25
|
-
|
|
26
|
-
_classCallCheck(this, DSPortal);
|
|
27
|
-
|
|
28
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
|
-
args[_key] = arguments[_key];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
33
|
-
_this.state = {
|
|
12
|
+
class DSPortal extends Component {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.state = {
|
|
34
16
|
isMounted: false
|
|
35
17
|
};
|
|
36
|
-
return _this;
|
|
37
18
|
}
|
|
38
19
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
20
|
+
componentDidMount() {
|
|
21
|
+
const {
|
|
22
|
+
onRender
|
|
23
|
+
} = this.props;
|
|
24
|
+
this.portalEl = this.createPortalContainer();
|
|
44
25
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
26
|
+
if (DOCUMENT && this.portalEl) {
|
|
27
|
+
DOCUMENT.body.appendChild(this.portalEl);
|
|
28
|
+
onRender();
|
|
29
|
+
this.setState({
|
|
30
|
+
isMounted: true
|
|
31
|
+
});
|
|
52
32
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
componentDidUpdate() {
|
|
36
|
+
if (!canRenderPortal) {
|
|
37
|
+
this.renderNoPortal();
|
|
59
38
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
componentWillUnmount() {
|
|
42
|
+
if (this.portalEl) {
|
|
43
|
+
this.portalEl.parentNode.removeChild(this.portalEl);
|
|
66
44
|
}
|
|
67
|
-
}
|
|
68
|
-
key: "createPortalContainer",
|
|
69
|
-
value: function createPortalContainer() {
|
|
70
|
-
if (!DOCUMENT) return null;
|
|
71
|
-
var className = this.props.className;
|
|
45
|
+
}
|
|
72
46
|
|
|
73
|
-
|
|
74
|
-
|
|
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
|
+
}
|
|
75
60
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
key: "renderNoPortal",
|
|
83
|
-
value: function renderNoPortal() {
|
|
84
|
-
var children = this.props.children;
|
|
85
|
-
ReactDOM.unstable_renderSubtreeIntoContainer(this, /*#__PURE__*/React.createElement("div", null, children), this.portalEl);
|
|
86
|
-
}
|
|
87
|
-
}, {
|
|
88
|
-
key: "render",
|
|
89
|
-
value: function render() {
|
|
90
|
-
var children = this.props.children;
|
|
91
|
-
var isMounted = this.state.isMounted;
|
|
92
|
-
return !canRenderPortal || !isMounted ? null : /*#__PURE__*/ReactDOM.createPortal(children, this.portalEl);
|
|
93
|
-
}
|
|
94
|
-
}]);
|
|
61
|
+
renderNoPortal() {
|
|
62
|
+
const {
|
|
63
|
+
children
|
|
64
|
+
} = this.props;
|
|
65
|
+
ReactDOM.unstable_renderSubtreeIntoContainer(this, /*#__PURE__*/_jsx("div", {}, void 0, children), this.portalEl);
|
|
66
|
+
}
|
|
95
67
|
|
|
96
|
-
|
|
97
|
-
|
|
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
|
+
}
|
|
98
79
|
|
|
99
80
|
DSPortal.defaultProps = {
|
|
100
|
-
onRender:
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
81
|
+
onRender: () => null
|
|
103
82
|
};
|
|
104
83
|
|
|
105
84
|
export { DSPortal, DSPortal as default };
|
|
106
|
-
//# sourceMappingURL=DSPortal.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
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
4
|
|
|
5
5
|
/* eslint-disable no-multi-assign,no-loops/no-loops, no-plusplus */
|
|
6
6
|
|
|
@@ -10,13 +10,10 @@ if (commonjsGlobal && commonjsGlobal.Element && commonjsGlobal.Element.prototype
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
NodeList.prototype.remove = HTMLCollection.prototype.remove = function () {
|
|
13
|
-
for (
|
|
13
|
+
for (let i = this.length - 1; i >= 0; i--) {
|
|
14
14
|
if (this[i] && this[i].parentElement) {
|
|
15
15
|
this[i].parentElement.removeChild(this[i]);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
export { ieRemovePolyfill as default };
|
|
22
|
-
//# sourceMappingURL=ie-remove-polyfill.js.map
|
package/esm/index.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
1
|
export { DSPortal, DSPortal as default } from './DSPortal.js';
|
|
2
|
-
import '@babel/runtime/helpers/esm/classCallCheck';
|
|
3
|
-
import '@babel/runtime/helpers/esm/createClass';
|
|
4
|
-
import '@babel/runtime/helpers/esm/inherits';
|
|
5
|
-
import '@babel/runtime/helpers/esm/possibleConstructorReturn';
|
|
6
|
-
import '@babel/runtime/helpers/esm/getPrototypeOf';
|
|
7
|
-
import 'react';
|
|
8
|
-
import 'react-dom';
|
|
9
|
-
import '@elliemae/ds-classnames';
|
|
10
|
-
import '@elliemae/ds-utilities';
|
|
11
|
-
import './ie-remove-polyfill.js';
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-portal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.12",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "
|
|
6
|
-
"module": "esm/index.js",
|
|
7
|
-
"main": "cjs/index.js",
|
|
5
|
+
"description": "ICE MT - Dimsum - Portal",
|
|
6
|
+
"module": "./esm/index.js",
|
|
7
|
+
"main": "./cjs/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./esm/index.js",
|
|
12
|
+
"require": "./cjs/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./ie-remove-polyfill": {
|
|
15
|
+
"import": "./esm/ie-remove-polyfill.js",
|
|
16
|
+
"require": "./cjs/ie-remove-polyfill.js"
|
|
17
|
+
},
|
|
18
|
+
"./DSPortal": {
|
|
19
|
+
"import": "./esm/DSPortal.js",
|
|
20
|
+
"require": "./cjs/DSPortal.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
8
23
|
"sideEffects": [
|
|
9
24
|
"*.css",
|
|
10
25
|
"*.scss"
|
|
11
26
|
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"npm": ">=7",
|
|
33
|
+
"node": ">=14"
|
|
34
|
+
},
|
|
35
|
+
"author": "ICE MT",
|
|
12
36
|
"scripts": {
|
|
13
37
|
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
14
38
|
"prebuild": "exit 0",
|
|
@@ -16,15 +40,16 @@
|
|
|
16
40
|
"build": "node ../../scripts/build/build.js"
|
|
17
41
|
},
|
|
18
42
|
"dependencies": {
|
|
19
|
-
"@elliemae/ds-classnames": "
|
|
20
|
-
"@elliemae/ds-utilities": "
|
|
43
|
+
"@elliemae/ds-classnames": "2.0.0-alpha.12",
|
|
44
|
+
"@elliemae/ds-utilities": "2.0.0-alpha.12"
|
|
21
45
|
},
|
|
22
46
|
"peerDependencies": {
|
|
23
|
-
"react": "^17.0.
|
|
24
|
-
"react-dom": "^17.0.
|
|
47
|
+
"react": "^17.0.2",
|
|
48
|
+
"react-dom": "^17.0.2"
|
|
25
49
|
},
|
|
26
50
|
"publishConfig": {
|
|
27
51
|
"access": "public",
|
|
28
|
-
"directory": "dist"
|
|
52
|
+
"directory": "dist",
|
|
53
|
+
"generateSubmodules": true
|
|
29
54
|
}
|
|
30
55
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import './ie-remove-polyfill';
|
|
3
|
+
declare class DSPortal extends Component {
|
|
4
|
+
static defaultProps: {
|
|
5
|
+
onRender: () => null;
|
|
6
|
+
};
|
|
7
|
+
state: {
|
|
8
|
+
isMounted: boolean;
|
|
9
|
+
};
|
|
10
|
+
componentDidMount(): void;
|
|
11
|
+
componentDidUpdate(): void;
|
|
12
|
+
componentWillUnmount(): void;
|
|
13
|
+
createPortalContainer(): HTMLDivElement | null;
|
|
14
|
+
renderNoPortal(): void;
|
|
15
|
+
render(): React.ReactPortal | null;
|
|
16
|
+
}
|
|
17
|
+
export { DSPortal };
|
|
18
|
+
export default DSPortal;
|
|
File without changes
|
package/types/index.d.ts
ADDED
package/DSPortal/package.json
DELETED
package/cjs/DSPortal.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSPortal.js","sources":["../../src/DSPortal.tsx"],"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"],"names":["blockName","canRenderPortal","isFunction","ReactDOM","createPortal","DSPortal","state","isMounted","onRender","props","portalEl","createPortalContainer","DOCUMENT","body","appendChild","setState","renderNoPortal","parentNode","removeChild","className","convertPropToCssClassName","cssClassName","container","createElement","classList","add","setAttribute","children","unstable_renderSubtreeIntoContainer","React","Component","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAMA,SAAS,GAAG,QAAlB;AAEA,IAAMC,eAAe,GAAGC,sBAAU,CAACC,4BAAQ,CAACC,YAAV,CAAlC;;IAIMC;;;;;;;;;;;;;;;UAKJC,QAAQ;AAAEC,MAAAA,SAAS,EAAE;AAAb;;;;;;WAER,6BAAoB;AAClB,UAAQC,QAAR,GAAqB,KAAKC,KAA1B,CAAQD,QAAR;AACA,WAAKE,QAAL,GAAgB,KAAKC,qBAAL,EAAhB;;AACA,UAAIC,oBAAQ,IAAI,KAAKF,QAArB,EAA+B;AAC7BE,QAAAA,oBAAQ,CAACC,IAAT,CAAcC,WAAd,CAA0B,KAAKJ,QAA/B;AACAF,QAAAA,QAAQ;AACR,aAAKO,QAAL,CAAc;AAAER,UAAAA,SAAS,EAAE;AAAb,SAAd;AACD;AACF;;;WAED,8BAAqB;AACnB,UAAI,CAACN,eAAL,EAAsB;AACpB,aAAKe,cAAL;AACD;AACF;;;WAED,gCAAuB;AACrB,UAAI,KAAKN,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcO,UAAd,CAAyBC,WAAzB,CAAqC,KAAKR,QAA1C;AACD;AACF;;;WAED,iCAAwB;AACtB,UAAI,CAACE,oBAAL,EAAe,OAAO,IAAP;AAEf,UAAQO,SAAR,GAAsB,KAAKV,KAA3B,CAAQU,SAAR;;AACA,kCAAyBC,sCAAyB,CAACpB,SAAD,EAAYmB,SAAZ,CAAlD;AAAA,UAAQE,YAAR,yBAAQA,YAAR;;AACA,UAAMC,SAAS,GAAGV,oBAAQ,CAACW,aAAT,CAAuB,KAAvB,CAAlB;AACAD,MAAAA,SAAS,CAACE,SAAV,CAAoBC,GAApB,CAAwBJ,YAAxB;AACAC,MAAAA,SAAS,CAACI,YAAV,CAAuB,aAAvB,EAAsC,QAAtC;AAEA,aAAOJ,SAAP;AACD;;;WAED,0BAAiB;AACf,UAAQK,QAAR,GAAqB,KAAKlB,KAA1B,CAAQkB,QAAR;AACAxB,MAAAA,4BAAQ,CAACyB,mCAAT,CACE,IADF,eAEEC,qDAAMF,QAAN,CAFF,EAGE,KAAKjB,QAHP;AAKD;;;WAED,kBAAS;AACP,UAAQiB,QAAR,GAAqB,KAAKlB,KAA1B,CAAQkB,QAAR;AACA,UAAQpB,SAAR,GAAsB,KAAKD,KAA3B,CAAQC,SAAR;AACA,aAAO,CAACN,eAAD,IAAoB,CAACM,SAArB,GACH,IADG,gBAEHJ,4BAAQ,CAACC,YAAT,CAAsBuB,QAAtB,EAAgC,KAAKjB,QAArC,CAFJ;AAGD;;;;EAxDoBoB;;AAAjBzB,SAEG0B,eAAe;AAAEvB,EAAAA,QAAQ,EAAE;AAAA,WAAM,IAAN;AAAA;AAAZ;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ie-remove-polyfill.js","sources":["../../src/ie-remove-polyfill.tsx"],"sourcesContent":["/* 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"],"names":["global","Element","prototype","remove","undefined","window","parentElement","removeChild","NodeList","HTMLCollection","i","length"],"mappings":";;;;;;;;AACA,IACEA,cAAM,IACNA,cAAM,CAACC,OADP,IAEAD,cAAM,CAACC,OAAP,CAAeC,SAFf,IAGAF,cAAM,CAACC,OAAP,CAAeC,SAAf,CAAyBC,MAAzB,KAAoCC,SAJtC,EAKE;AACAC,EAAAA,MAAM,CAACJ,OAAP,CAAeC,SAAf,CAAyBC,MAAzB,GAAkC,YAAW;AAC3C,SAAKG,aAAL,CAAmBC,WAAnB,CAA+B,IAA/B;AACD,GAFD;;AAGAC,EAAAA,QAAQ,CAACN,SAAT,CAAmBC,MAAnB,GAA4BM,cAAc,CAACP,SAAf,CAAyBC,MAAzB,GAAkC,YAAW;AACvE,SAAK,IAAIO,CAAC,GAAG,KAAKC,MAAL,GAAc,CAA3B,EAA8BD,CAAC,IAAI,CAAnC,EAAsCA,CAAC,EAAvC,EAA2C;AACzC,UAAI,KAAKA,CAAL,KAAW,KAAKA,CAAL,EAAQJ,aAAvB,EAAsC;AACpC,aAAKI,CAAL,EAAQJ,aAAR,CAAsBC,WAAtB,CAAkC,KAAKG,CAAL,CAAlC;AACD;AACF;AACF,GAND;AAOD;;;;"}
|
package/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
package/esm/DSPortal.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSPortal.js","sources":["../../src/DSPortal.tsx"],"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"],"names":["blockName","canRenderPortal","isFunction","ReactDOM","createPortal","DSPortal","state","isMounted","onRender","props","portalEl","createPortalContainer","DOCUMENT","body","appendChild","setState","renderNoPortal","parentNode","removeChild","className","convertPropToCssClassName","cssClassName","container","createElement","classList","add","setAttribute","children","unstable_renderSubtreeIntoContainer","Component","defaultProps"],"mappings":";;;;;;;;;;;;;;AAOA,IAAMA,SAAS,GAAG,QAAlB;AAEA,IAAMC,eAAe,GAAGC,UAAU,CAACC,QAAQ,CAACC,YAAV,CAAlC;;IAIMC;;;;;;;;;;;;;;;UAKJC,QAAQ;AAAEC,MAAAA,SAAS,EAAE;AAAb;;;;;;WAER,6BAAoB;AAClB,UAAQC,QAAR,GAAqB,KAAKC,KAA1B,CAAQD,QAAR;AACA,WAAKE,QAAL,GAAgB,KAAKC,qBAAL,EAAhB;;AACA,UAAIC,QAAQ,IAAI,KAAKF,QAArB,EAA+B;AAC7BE,QAAAA,QAAQ,CAACC,IAAT,CAAcC,WAAd,CAA0B,KAAKJ,QAA/B;AACAF,QAAAA,QAAQ;AACR,aAAKO,QAAL,CAAc;AAAER,UAAAA,SAAS,EAAE;AAAb,SAAd;AACD;AACF;;;WAED,8BAAqB;AACnB,UAAI,CAACN,eAAL,EAAsB;AACpB,aAAKe,cAAL;AACD;AACF;;;WAED,gCAAuB;AACrB,UAAI,KAAKN,QAAT,EAAmB;AACjB,aAAKA,QAAL,CAAcO,UAAd,CAAyBC,WAAzB,CAAqC,KAAKR,QAA1C;AACD;AACF;;;WAED,iCAAwB;AACtB,UAAI,CAACE,QAAL,EAAe,OAAO,IAAP;AAEf,UAAQO,SAAR,GAAsB,KAAKV,KAA3B,CAAQU,SAAR;;AACA,kCAAyBC,yBAAyB,CAACpB,SAAD,EAAYmB,SAAZ,CAAlD;AAAA,UAAQE,YAAR,yBAAQA,YAAR;;AACA,UAAMC,SAAS,GAAGV,QAAQ,CAACW,aAAT,CAAuB,KAAvB,CAAlB;AACAD,MAAAA,SAAS,CAACE,SAAV,CAAoBC,GAApB,CAAwBJ,YAAxB;AACAC,MAAAA,SAAS,CAACI,YAAV,CAAuB,aAAvB,EAAsC,QAAtC;AAEA,aAAOJ,SAAP;AACD;;;WAED,0BAAiB;AACf,UAAQK,QAAR,GAAqB,KAAKlB,KAA1B,CAAQkB,QAAR;AACAxB,MAAAA,QAAQ,CAACyB,mCAAT,CACE,IADF,eAEE,iCAAMD,QAAN,CAFF,EAGE,KAAKjB,QAHP;AAKD;;;WAED,kBAAS;AACP,UAAQiB,QAAR,GAAqB,KAAKlB,KAA1B,CAAQkB,QAAR;AACA,UAAQpB,SAAR,GAAsB,KAAKD,KAA3B,CAAQC,SAAR;AACA,aAAO,CAACN,eAAD,IAAoB,CAACM,SAArB,GACH,IADG,gBAEHJ,QAAQ,CAACC,YAAT,CAAsBuB,QAAtB,EAAgC,KAAKjB,QAArC,CAFJ;AAGD;;;;EAxDoBmB;;AAAjBxB,SAEGyB,eAAe;AAAEtB,EAAAA,QAAQ,EAAE;AAAA,WAAM,IAAN;AAAA;AAAZ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ie-remove-polyfill.js","sources":["../../src/ie-remove-polyfill.tsx"],"sourcesContent":["/* 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"],"names":["global","Element","prototype","remove","undefined","window","parentElement","removeChild","NodeList","HTMLCollection","i","length"],"mappings":";;;;;;AACA,IACEA,cAAM,IACNA,cAAM,CAACC,OADP,IAEAD,cAAM,CAACC,OAAP,CAAeC,SAFf,IAGAF,cAAM,CAACC,OAAP,CAAeC,SAAf,CAAyBC,MAAzB,KAAoCC,SAJtC,EAKE;AACAC,EAAAA,MAAM,CAACJ,OAAP,CAAeC,SAAf,CAAyBC,MAAzB,GAAkC,YAAW;AAC3C,SAAKG,aAAL,CAAmBC,WAAnB,CAA+B,IAA/B;AACD,GAFD;;AAGAC,EAAAA,QAAQ,CAACN,SAAT,CAAmBC,MAAnB,GAA4BM,cAAc,CAACP,SAAf,CAAyBC,MAAzB,GAAkC,YAAW;AACvE,SAAK,IAAIO,CAAC,GAAG,KAAKC,MAAL,GAAc,CAA3B,EAA8BD,CAAC,IAAI,CAAnC,EAAsCA,CAAC,EAAvC,EAA2C;AACzC,UAAI,KAAKA,CAAL,KAAW,KAAKA,CAAL,EAAQJ,aAAvB,EAAsC;AACpC,aAAKI,CAAL,EAAQJ,aAAR,CAAsBC,WAAtB,CAAkC,KAAKG,CAAL,CAAlC;AACD;AACF;AACF,GAND;AAOD;;;;"}
|
package/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|