@sb1/ffe-modals-react 0.4.9 → 0.5.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/es/Modal.js +12 -0
- package/lib/Modal.js +12 -0
- package/package.json +4 -3
package/es/Modal.js
CHANGED
|
@@ -54,6 +54,18 @@ export var Modal = React.forwardRef(function (_a, ref) {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}, [isOpen]);
|
|
57
|
+
useEffect(function () {
|
|
58
|
+
if (typeof window !== 'undefined' && // to support Gatsby build(server side rendering)
|
|
59
|
+
dialogRef.current &&
|
|
60
|
+
typeof dialogRef.current.showModal !== 'function') {
|
|
61
|
+
import('dialog-polyfill').then(function (_a) {
|
|
62
|
+
var dialogPolyfill = _a.default;
|
|
63
|
+
if (dialogRef.current) {
|
|
64
|
+
dialogPolyfill.registerDialog(dialogRef.current);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
57
69
|
return createPortal(
|
|
58
70
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
59
71
|
React.createElement("dialog", __assign({}, rest, { ref: dialogRef, className: classnames('ffe-modal', className), "aria-labelledby": ariaLabelledby, onClick: function (event) {
|
package/lib/Modal.js
CHANGED
|
@@ -83,6 +83,18 @@ exports.Modal = react_1.default.forwardRef(function (_a, ref) {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}, [isOpen]);
|
|
86
|
+
(0, react_1.useEffect)(function () {
|
|
87
|
+
if (typeof window !== 'undefined' && // to support Gatsby build(server side rendering)
|
|
88
|
+
dialogRef.current &&
|
|
89
|
+
typeof dialogRef.current.showModal !== 'function') {
|
|
90
|
+
Promise.resolve().then(function () { return __importStar(require('dialog-polyfill')); }).then(function (_a) {
|
|
91
|
+
var dialogPolyfill = _a.default;
|
|
92
|
+
if (dialogRef.current) {
|
|
93
|
+
dialogPolyfill.registerDialog(dialogRef.current);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}, []);
|
|
86
98
|
return (0, react_dom_1.createPortal)(
|
|
87
99
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
88
100
|
react_1.default.createElement("dialog", __assign({}, rest, { ref: dialogRef, className: (0, classnames_1.default)('ffe-modal', className), "aria-labelledby": ariaLabelledby, onClick: function (event) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-modals-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "SpareBank 1",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@sb1/ffe-icons-react": "^11.0.2",
|
|
29
|
-
"@sb1/ffe-modals": "^0.2.10"
|
|
29
|
+
"@sb1/ffe-modals": "^0.2.10",
|
|
30
|
+
"dialog-polyfill": "^0.5.6"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@sb1/ffe-buildtool": "^0.7.1",
|
|
@@ -40,5 +41,5 @@
|
|
|
40
41
|
"publishConfig": {
|
|
41
42
|
"access": "public"
|
|
42
43
|
},
|
|
43
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "e1cc39a5b2e0ba606a37c1206bf3a8859941b27a"
|
|
44
45
|
}
|