Skip to content

Commit 528c97f

Browse files
committed
Resolve an issue that React does not recognize the disableOverlay prop on a DOM element.
1 parent fbcf8a4 commit 528c97f

File tree

7 files changed

+109
-56
lines changed

7 files changed

+109
-56
lines changed

dist/react-modal.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-modal.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/bundle.js

Lines changed: 90 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -68,30 +68,49 @@
6868
/***/ "../node_modules/@trendmicro/react-buttons/dist/react-buttons.css":
6969
/***/ (function(module, exports, __webpack_require__) {
7070

71-
// style-loader: Adds some css to the DOM by adding a <style> tag
7271

73-
// load the styles
7472
var content = __webpack_require__("../node_modules/css-loader/index.js!../node_modules/@trendmicro/react-buttons/dist/react-buttons.css");
73+
7574
if(typeof content === 'string') content = [[module.i, content, '']];
76-
// Prepare cssTransformation
75+
7776
var transform;
77+
var insertInto;
78+
79+
7880

7981
var options = {"hmr":true}
82+
8083
options.transform = transform
81-
// add the styles to the DOM
84+
options.insertInto = undefined;
85+
8286
var update = __webpack_require__("../node_modules/style-loader/lib/addStyles.js")(content, options);
87+
8388
if(content.locals) module.exports = content.locals;
84-
// Hot Module Replacement
89+
8590
if(false) {
86-
// When the styles change, update the <style> tags
87-
if(!content.locals) {
88-
module.hot.accept("!!../../../css-loader/index.js!./react-buttons.css", function() {
89-
var newContent = require("!!../../../css-loader/index.js!./react-buttons.css");
90-
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
91-
update(newContent);
92-
});
93-
}
94-
// When the module is disposed, remove the <style> tags
91+
module.hot.accept("!!../../../css-loader/index.js!./react-buttons.css", function() {
92+
var newContent = require("!!../../../css-loader/index.js!./react-buttons.css");
93+
94+
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
95+
96+
var locals = (function(a, b) {
97+
var key, idx = 0;
98+
99+
for(key in a) {
100+
if(!b || a[key] !== b[key]) return false;
101+
idx++;
102+
}
103+
104+
for(key in b) idx--;
105+
106+
return idx === 0;
107+
}(content.locals, newContent.locals));
108+
109+
if(!locals) throw new Error('Aborting CSS HMR due to changed css-modules locals.');
110+
111+
update(newContent);
112+
});
113+
95114
module.hot.dispose(function() { update(); });
96115
}
97116

@@ -19742,14 +19761,26 @@ var isOldIE = memoize(function () {
1974219761
return window && document && document.all && !window.atob;
1974319762
});
1974419763

19764+
var getTarget = function (target) {
19765+
return document.querySelector(target);
19766+
};
19767+
1974519768
var getElement = (function (fn) {
1974619769
var memo = {};
1974719770

19748-
return function(selector) {
19749-
if (typeof memo[selector] === "undefined") {
19750-
var styleTarget = fn.call(this, selector);
19771+
return function(target) {
19772+
// If passing function in options, then use it for resolve "head" element.
19773+
// Useful for Shadow Root style i.e
19774+
// {
19775+
// insertInto: function () { return document.querySelector("#foo").shadowRoot }
19776+
// }
19777+
if (typeof target === 'function') {
19778+
return target();
19779+
}
19780+
if (typeof memo[target] === "undefined") {
19781+
var styleTarget = getTarget.call(this, target);
1975119782
// Special case to return head of iframe instead of iframe itself
19752-
if (styleTarget instanceof window.HTMLIFrameElement) {
19783+
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
1975319784
try {
1975419785
// This will throw an exception if access to iframe is blocked
1975519786
// due to cross-origin restrictions
@@ -19758,13 +19789,11 @@ var getElement = (function (fn) {
1975819789
styleTarget = null;
1975919790
}
1976019791
}
19761-
memo[selector] = styleTarget;
19792+
memo[target] = styleTarget;
1976219793
}
19763-
return memo[selector]
19794+
return memo[target]
1976419795
};
19765-
})(function (target) {
19766-
return document.querySelector(target)
19767-
});
19796+
})();
1976819797

1976919798
var singleton = null;
1977019799
var singletonCounter = 0;
@@ -19786,7 +19815,7 @@ module.exports = function(list, options) {
1978619815
if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
1978719816

1978819817
// By default, add <style> tags to the <head> element
19789-
if (!options.insertInto) options.insertInto = "head";
19818+
if (!options.insertInto) options.insertInto = "head";
1979019819

1979119820
// By default, add <style> tags to the bottom of the target
1979219821
if (!options.insertAt) options.insertAt = "bottom";
@@ -20154,7 +20183,7 @@ module.exports = function (css) {
2015420183
.replace(/^'(.*)'$/, function(o, $1){ return $1; });
2015520184

2015620185
// already a full url? no change
20157-
if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) {
20186+
if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
2015820187
return fullMatch;
2015920188
}
2016020189

@@ -20721,8 +20750,9 @@ var ModalOverlay = (_temp2 = _class = function (_PureComponent) {
2072120750
var _this2 = this;
2072220751

2072320752
var _props = this.props,
20753+
disableOverlay = _props.disableOverlay,
2072420754
className = _props.className,
20725-
props = _objectWithoutProperties(_props, ['className']);
20755+
props = _objectWithoutProperties(_props, ['disableOverlay', 'className']);
2072620756

2072720757
return _react2.default.createElement(
2072820758
_reactPortal2.default,
@@ -20841,30 +20871,49 @@ module.exports = _Modal2.default;
2084120871
/***/ "../src/index.styl":
2084220872
/***/ (function(module, exports, __webpack_require__) {
2084320873

20844-
// style-loader: Adds some css to the DOM by adding a <style> tag
2084520874

20846-
// load the styles
2084720875
var content = __webpack_require__("../node_modules/css-loader/index.js?camelCase&modules&importLoaders=1&localIdentName=[local]---[hash:base64:5]!../node_modules/stylus-loader/index.js!../node_modules/stylint-loader/index.js!../src/index.styl");
20876+
2084820877
if(typeof content === 'string') content = [[module.i, content, '']];
20849-
// Prepare cssTransformation
20878+
2085020879
var transform;
20880+
var insertInto;
20881+
20882+
2085120883

2085220884
var options = {"hmr":true}
20885+
2085320886
options.transform = transform
20854-
// add the styles to the DOM
20887+
options.insertInto = undefined;
20888+
2085520889
var update = __webpack_require__("../node_modules/style-loader/lib/addStyles.js")(content, options);
20890+
2085620891
if(content.locals) module.exports = content.locals;
20857-
// Hot Module Replacement
20892+
2085820893
if(false) {
20859-
// When the styles change, update the <style> tags
20860-
if(!content.locals) {
20861-
module.hot.accept("!!../node_modules/css-loader/index.js?camelCase&modules&importLoaders=1&localIdentName=[local]---[hash:base64:5]!../node_modules/stylus-loader/index.js!../node_modules/stylint-loader/index.js!./index.styl", function() {
20862-
var newContent = require("!!../node_modules/css-loader/index.js?camelCase&modules&importLoaders=1&localIdentName=[local]---[hash:base64:5]!../node_modules/stylus-loader/index.js!../node_modules/stylint-loader/index.js!./index.styl");
20863-
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
20864-
update(newContent);
20865-
});
20866-
}
20867-
// When the module is disposed, remove the <style> tags
20894+
module.hot.accept("!!../node_modules/css-loader/index.js?camelCase&modules&importLoaders=1&localIdentName=[local]---[hash:base64:5]!../node_modules/stylus-loader/index.js!../node_modules/stylint-loader/index.js!./index.styl", function() {
20895+
var newContent = require("!!../node_modules/css-loader/index.js?camelCase&modules&importLoaders=1&localIdentName=[local]---[hash:base64:5]!../node_modules/stylus-loader/index.js!../node_modules/stylint-loader/index.js!./index.styl");
20896+
20897+
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
20898+
20899+
var locals = (function(a, b) {
20900+
var key, idx = 0;
20901+
20902+
for(key in a) {
20903+
if(!b || a[key] !== b[key]) return false;
20904+
idx++;
20905+
}
20906+
20907+
for(key in b) idx--;
20908+
20909+
return idx === 0;
20910+
}(content.locals, newContent.locals));
20911+
20912+
if(!locals) throw new Error('Aborting CSS HMR due to changed css-modules locals.');
20913+
20914+
update(newContent);
20915+
});
20916+
2086820917
module.hot.dispose(function() { update(); });
2086920918
}
2087020919

@@ -21536,4 +21585,4 @@ exports.default = function (Component) {
2153621585
/***/ })
2153721586

2153821587
/******/ });
21539-
//# sourceMappingURL=bundle.js.map?50e5bec724f4afd6cfc1
21588+
//# sourceMappingURL=bundle.js.map?6a3b71b90cc56bdeeff3

docs/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@
4242
</nav>
4343
<div id="container"></div>
4444
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
45-
<script type="text/javascript" src="bundle.js?50e5bec724f4afd6cfc1"></script></body>
45+
<script type="text/javascript" src="bundle.js?6a3b71b90cc56bdeeff3"></script></body>
4646
</html>

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@trendmicro/react-modal",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "React Modal component",
55
"main": "lib/index.js",
66
"files": [
@@ -55,8 +55,8 @@
5555
"@trendmicro/react-buttons": "~1.3.0",
5656
"babel-cli": "~6.26.0",
5757
"babel-core": "~6.26.0",
58-
"babel-eslint": "~8.2.1",
59-
"babel-loader": "~7.1.2",
58+
"babel-eslint": "~8.2.2",
59+
"babel-loader": "~7.1.4",
6060
"babel-plugin-transform-decorators-legacy": "~1.3.4",
6161
"babel-preset-env": "^1.6.1",
6262
"babel-preset-react": "~6.24.1",
@@ -68,26 +68,26 @@
6868
"css-loader": "~0.28.9",
6969
"enzyme": "~3.3.0",
7070
"enzyme-adapter-react-16": "~1.1.1",
71-
"eslint": "~4.16.0",
71+
"eslint": "~4.18.2",
7272
"eslint-config-trendmicro": "~1.3.0",
73-
"eslint-loader": "~1.9.0",
74-
"eslint-plugin-import": "~2.8.0",
73+
"eslint-loader": "~2.0.0",
74+
"eslint-plugin-import": "~2.9.0",
7575
"eslint-plugin-jsx-a11y": "~6.0.3",
76-
"eslint-plugin-react": "~7.5.1",
76+
"eslint-plugin-react": "~7.7.0",
7777
"extract-text-webpack-plugin": "~3.0.2",
7878
"file-loader": "~1.1.6",
7979
"find-imports": "~0.5.2",
80-
"html-webpack-plugin": "~2.30.1",
80+
"html-webpack-plugin": "~3.0.6",
8181
"http-server": "~0.11.1",
8282
"jsdom": "~11.6.0",
8383
"nib": "~1.1.2",
8484
"react": "^0.14.0 || >=15.0.0",
8585
"react-dom": "^0.14.0 || >=15.0.0",
86-
"style-loader": "~0.19.1",
86+
"style-loader": "~0.20.3",
8787
"stylint": "~1.5.9",
8888
"stylint-loader": "~1.0.0",
8989
"stylus-loader": "~3.0.1",
90-
"tap": "~11.0.1",
90+
"tap": "~11.1.2",
9191
"trendmicro-ui": "~0.5.1",
9292
"url-loader": "~0.6.2",
9393
"webpack": "~3.10.0",

src/ModalOverlay.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ class ModalOverlay extends PureComponent {
3737
};
3838

3939
render() {
40-
const { className, ...props } = this.props;
40+
const {
41+
disableOverlay, // eslint-disable-line
42+
className,
43+
...props
44+
} = this.props;
4145

4246
return (
4347
<Portal

0 commit comments

Comments
 (0)