@blaze-cms/react-page-builder 0.146.0-core-styles.6 → 0.146.0-core-styles.7
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/CHANGELOG.md +11 -0
- package/lib/components/Image/Lightbox/Lightbox.js +2 -2
- package/lib/components/Image/Lightbox/Lightbox.js.map +1 -1
- package/lib/components/Modal/Modal.js +2 -2
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/ModalAdapter/ModalAdapter.js +21 -0
- package/lib/components/ModalAdapter/ModalAdapter.js.map +1 -0
- package/lib/components/ModalAdapter/index.js +11 -0
- package/lib/components/ModalAdapter/index.js.map +1 -0
- package/lib/components/Video/VideoModal.js +2 -2
- package/lib/components/Video/VideoModal.js.map +1 -1
- package/lib/hooks/index.js +7 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/use-portal.js +30 -0
- package/lib/hooks/use-portal.js.map +1 -0
- package/lib-es/components/Image/Lightbox/Lightbox.js +1 -1
- package/lib-es/components/Image/Lightbox/Lightbox.js.map +1 -1
- package/lib-es/components/Modal/Modal.js +1 -1
- package/lib-es/components/Modal/Modal.js.map +1 -1
- package/lib-es/components/ModalAdapter/ModalAdapter.js +13 -0
- package/lib-es/components/ModalAdapter/ModalAdapter.js.map +1 -0
- package/lib-es/components/ModalAdapter/index.js +3 -0
- package/lib-es/components/ModalAdapter/index.js.map +1 -0
- package/lib-es/components/Video/VideoModal.js +1 -1
- package/lib-es/components/Video/VideoModal.js.map +1 -1
- package/lib-es/hooks/index.js +1 -0
- package/lib-es/hooks/index.js.map +1 -1
- package/lib-es/hooks/use-portal.js +14 -0
- package/lib-es/hooks/use-portal.js.map +1 -0
- package/package.json +2 -2
- package/src/components/Image/Lightbox/Lightbox.js +1 -1
- package/src/components/Modal/Modal.js +1 -1
- package/src/components/ModalAdapter/ModalAdapter.js +12 -0
- package/src/components/ModalAdapter/index.js +3 -0
- package/src/components/Video/VideoModal.js +1 -1
- package/src/hooks/index.js +1 -0
- package/src/hooks/use-portal.js +18 -0
- package/tests/unit/src/components/Image/Lightbox/Lightbox.test.js +4 -0
- package/tests/unit/src/components/Image/Lightbox/__snapshots__/Lightbox.test.js.snap +3 -38
- package/tests/unit/src/components/Modal/Modal.test.js +4 -0
- package/tests/unit/src/components/Modal/__snapshots__/Modal.test.js.snap +7 -42
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.146.0-core-styles.7](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.6...v0.146.0-core-styles.7) (2024-09-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* use modal adapter in frontend ([#4485](https://github.com/thebyte9/blaze/issues/4485)) ([f35adbc](https://github.com/thebyte9/blaze/commit/f35adbcd9a76a069000126a30b3c680c169a5357))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [0.146.0-core-styles.6](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.5...v0.146.0-core-styles.6) (2024-09-20)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -19,9 +19,9 @@ require("core-js/modules/es.function.name.js");
|
|
|
19
19
|
require("core-js/modules/es.object.keys.js");
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
21
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
22
|
-
var _modal = _interopRequireDefault(require("@blaze-react/modal"));
|
|
23
22
|
var _customHooks = require("@blaze-react/utils/lib/customHooks");
|
|
24
23
|
var _imageCdnReact = require("@blaze-cms/image-cdn-react");
|
|
24
|
+
var _ModalAdapter = _interopRequireDefault(require("../../ModalAdapter"));
|
|
25
25
|
var _BlazeLink = _interopRequireDefault(require("../../BlazeLink"));
|
|
26
26
|
var _constants = require("../../../constants");
|
|
27
27
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -40,7 +40,7 @@ var Lightbox = function Lightbox(_ref) {
|
|
|
40
40
|
outerRef = _useInView2[1];
|
|
41
41
|
var hasLink = Object.keys(imgWrapperProps).length;
|
|
42
42
|
var ImgWrapper = hasLink ? _BlazeLink["default"] : _react.Fragment;
|
|
43
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
43
|
+
return /*#__PURE__*/_react["default"].createElement(_ModalAdapter["default"], {
|
|
44
44
|
title: name,
|
|
45
45
|
onClose: closeModal,
|
|
46
46
|
isFullScreen: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lightbox.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","
|
|
1
|
+
{"version":3,"file":"Lightbox.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_customHooks","_imageCdnReact","_ModalAdapter","_BlazeLink","_constants","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Lightbox","_ref","name","imageUrl","altTxt","closeModal","imageCaption","imgWrapperProps","_useInView","useInView","IN_VIEW_CONFIG","_useInView2","_slicedToArray2","isIntersecting","outerRef","hasLink","keys","length","ImgWrapper","BlazeLink","Fragment","createElement","title","onClose","isFullScreen","className","ref","_extends2","role","ResponsiveImage","src","alt","sizeKey","propTypes","PropTypes","string","func","isRequired","object","modifier","defaultProps","_default","exports"],"sources":["../../../../src/components/Image/Lightbox/Lightbox.js"],"sourcesContent":["import React, { Fragment } from 'react';\nimport PropTypes from 'prop-types';\nimport { useInView } from '@blaze-react/utils/lib/customHooks';\nimport { ResponsiveImage } from '@blaze-cms/image-cdn-react';\nimport Modal from '../../ModalAdapter';\nimport BlazeLink from '../../BlazeLink';\nimport { IN_VIEW_CONFIG } from '../../../constants';\n\n// add for full screen modal based on blaze, and pass modifiers(lightbox)\nconst Lightbox = ({ name, imageUrl, altTxt, closeModal, imageCaption, imgWrapperProps }) => {\n const [isIntersecting, outerRef] = useInView(IN_VIEW_CONFIG);\n\n const hasLink = Object.keys(imgWrapperProps).length;\n const ImgWrapper = hasLink ? BlazeLink : Fragment;\n\n return (\n <Modal title={name} onClose={closeModal} isFullScreen>\n <div className=\"row row--display-row\">\n <div className=\"column column--two-thirds\">\n <div ref={outerRef} className=\"image\">\n {isIntersecting && (\n <ImgWrapper {...imgWrapperProps} role={hasLink ? 'link' : ''}>\n <ResponsiveImage src={imageUrl} alt={altTxt} sizeKey=\"lightbox\" />\n </ImgWrapper>\n )}\n </div>\n </div>\n </div>\n {imageCaption && (\n <div className=\"row row--display-row\">\n <div className=\"caption\">{imageCaption}</div>\n </div>\n )}\n </Modal>\n );\n};\n\nLightbox.propTypes = {\n name: PropTypes.string,\n closeModal: PropTypes.func.isRequired,\n imgWrapperProps: PropTypes.object,\n imageUrl: PropTypes.string,\n imageCaption: PropTypes.string,\n altTxt: PropTypes.string,\n modifier: PropTypes.string\n};\n\nLightbox.defaultProps = {\n name: '',\n imgWrapperProps: {},\n modifier: '',\n imageCaption: '',\n altTxt: '',\n imageUrl: ''\n};\n\nexport default Lightbox;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,UAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAAoD,SAAAQ,yBAAAC,CAAA,6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C;AAEZ,CAAC;AAEDN,QAAQ,CAACiC,SAAS,GAAG;EACnB/B,IAAI,EAAEgC,qBAAS,CAACC,MAAM;EACtB9B,UAAU,EAAE6B,qBAAS,CAACE,IAAI,CAACC,UAAU;EACrC9B,eAAe,EAAE2B,qBAAS,CAACI,MAAM;EACjCnC,QAAQ,EAAE+B,qBAAS,CAACC,MAAM;EAC1B7B,YAAY,EAAE4B,qBAAS,CAACC,MAAM;EAC9B/B,MAAM,EAAE8B,qBAAS,CAACC,MAAM;EACxBI,QAAQ,EAAEL,qBAAS,CAACC;AACtB,CAAC;AAEDnC,QAAQ,CAACwC,YAAY,GAAG;EACtBtC,IAAI,EAAE,EAAE;EACRK,eAAe,EAAE,CAAC,CAAC;EACnBgC,QAAQ,EAAE,EAAE;EACZjC,YAAY,EAAE,EAAE;EAChBF,MAAM,EAAE,EAAE;EACVD,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAAsC,QAAA,GAAAC,OAAA,cAEa1C,QAAQ"}
|
|
@@ -9,7 +9,7 @@ exports["default"] = void 0;
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var
|
|
12
|
+
var _ModalAdapter = _interopRequireDefault(require("../ModalAdapter"));
|
|
13
13
|
var _helpers = require("../../helpers");
|
|
14
14
|
var _excluded = ["children", "elementTitle", "onClose"];
|
|
15
15
|
var Modal = function Modal(_ref) {
|
|
@@ -19,7 +19,7 @@ var Modal = function Modal(_ref) {
|
|
|
19
19
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
20
20
|
if (!(0, _helpers.hasChildren)(children)) return null;
|
|
21
21
|
(0, _helpers.updateChildrensParent)(children, otherProps.parent.itemId, otherProps.parent.itemEntity);
|
|
22
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
22
|
+
return /*#__PURE__*/_react["default"].createElement(_ModalAdapter["default"], {
|
|
23
23
|
title: elementTitle,
|
|
24
24
|
onClose: onClose
|
|
25
25
|
}, (0, _helpers.renderChildren)(children));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":["_react","_interopRequireDefault","require","_propTypes","
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["_react","_interopRequireDefault","require","_propTypes","_ModalAdapter","_helpers","_excluded","Modal","_ref","children","elementTitle","onClose","otherProps","_objectWithoutProperties2","hasChildren","updateChildrensParent","parent","itemId","itemEntity","createElement","title","renderChildren","propTypes","PropTypes","func","string","oneOfType","arrayOf","node","defaultProps","_default","exports"],"sources":["../../../src/components/Modal/Modal.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport BlazeModal from '../ModalAdapter';\nimport { renderChildren, updateChildrensParent, hasChildren } from '../../helpers';\n\nconst Modal = ({ children, elementTitle, onClose, ...otherProps }) => {\n if (!hasChildren(children)) return null;\n\n updateChildrensParent(children, otherProps.parent.itemId, otherProps.parent.itemEntity);\n return (\n <BlazeModal title={elementTitle} onClose={onClose}>\n {renderChildren(children)}\n </BlazeModal>\n );\n};\n\nModal.propTypes = {\n onClose: PropTypes.func,\n elementTitle: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nModal.defaultProps = {\n onClose: () => {},\n elementTitle: '',\n children: []\n};\n\nexport default Modal;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAAmF,IAAAI,SAAA;AAEnF,IAAMC,KAAK,GAAG,SAARA,KAAKA,CAAAC,IAAA,EAA2D;EAAA,IAArDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IAAEC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IAAKC,UAAU,OAAAC,yBAAA,aAAAL,IAAA,EAAAF,SAAA;EAC7D,IAAI,CAAC,IAAAQ,oBAAW,EAACL,QAAQ,CAAC,EAAE,OAAO,IAAI;EAEvC,IAAAM,8BAAqB,EAACN,QAAQ,EAAEG,UAAU,CAACI,MAAM,CAACC,MAAM,EAAEL,UAAU,CAACI,MAAM,CAACE,UAAU,CAAC;EACvF,oBACElB,MAAA,YAAAmB,aAAA,CAACf,aAAA,WAAU;IAACgB,KAAK,EAAEV,YAAa;IAACC,OAAO,EAAEA;EAAQ,GAC/C,IAAAU,uBAAc,EAACZ,QAAQ,CACd,CAAC;AAEjB,CAAC;AAEDF,KAAK,CAACe,SAAS,GAAG;EAChBX,OAAO,EAAEY,qBAAS,CAACC,IAAI;EACvBd,YAAY,EAAEa,qBAAS,CAACE,MAAM;EAC9BhB,QAAQ,EAAEc,qBAAS,CAACG,SAAS,CAAC,CAACH,qBAAS,CAACI,OAAO,CAACJ,qBAAS,CAACK,IAAI,CAAC,EAAEL,qBAAS,CAACK,IAAI,CAAC;AACnF,CAAC;AAEDrB,KAAK,CAACsB,YAAY,GAAG;EACnBlB,OAAO,EAAE,SAAAA,QAAA,EAAM,CAAC,CAAC;EACjBD,YAAY,EAAE,EAAE;EAChBD,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAAqB,QAAA,GAAAC,OAAA,cAEaxB,KAAK"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _modal = _interopRequireDefault(require("@blaze-react/modal"));
|
|
13
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
14
|
+
var _hooks = require("../../hooks");
|
|
15
|
+
var ModalAdapter = function ModalAdapter(_ref) {
|
|
16
|
+
var props = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref), _ref));
|
|
17
|
+
var target = (0, _hooks.usePortal)();
|
|
18
|
+
return /*#__PURE__*/_reactDom["default"].createPortal( /*#__PURE__*/_react["default"].createElement(_modal["default"], props), target);
|
|
19
|
+
};
|
|
20
|
+
var _default = exports["default"] = ModalAdapter;
|
|
21
|
+
//# sourceMappingURL=ModalAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalAdapter.js","names":["_react","_interopRequireDefault","require","_modal","_reactDom","_hooks","ModalAdapter","_ref","props","_extends2","_objectDestructuringEmpty2","target","usePortal","ReactDOM","createPortal","createElement","_default","exports"],"sources":["../../../src/components/ModalAdapter/ModalAdapter.js"],"sourcesContent":["import React from 'react';\nimport Modal from '@blaze-react/modal';\nimport ReactDOM from 'react-dom';\nimport { usePortal } from '../../hooks';\n\nconst ModalAdapter = ({ ...props }) => {\n const target = usePortal();\n\n return ReactDOM.createPortal(<Modal {...props} />, target);\n};\n\nexport default ModalAdapter;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAMI,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAAqB;EAAA,IAAZC,KAAK,OAAAC,SAAA,sBAAAC,0BAAA,aAAAH,IAAA,GAAAA,IAAA;EAC9B,IAAMI,MAAM,GAAG,IAAAC,gBAAS,EAAC,CAAC;EAE1B,oBAAOC,oBAAQ,CAACC,YAAY,eAACd,MAAA,YAAAe,aAAA,CAACZ,MAAA,WAAK,EAAKK,KAAQ,CAAC,EAAEG,MAAM,CAAC;AAC5D,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,cAEaX,YAAY"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _ModalAdapter = _interopRequireDefault(require("./ModalAdapter"));
|
|
10
|
+
var _default = exports["default"] = _ModalAdapter["default"];
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_ModalAdapter","_interopRequireDefault","require","_default","exports","ModalAdapter"],"sources":["../../../src/components/ModalAdapter/index.js"],"sourcesContent":["import ModalAdapter from './ModalAdapter';\n\nexport default ModalAdapter;\n"],"mappings":";;;;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0C,IAAAC,QAAA,GAAAC,OAAA,cAE3BC,wBAAY"}
|
|
@@ -17,7 +17,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
17
17
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
18
18
|
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
|
|
19
19
|
var _react = _interopRequireWildcard(require("react"));
|
|
20
|
-
var
|
|
20
|
+
var _ModalAdapter = _interopRequireDefault(require("../ModalAdapter"));
|
|
21
21
|
var _VideoRender = _interopRequireDefault(require("./VideoRender"));
|
|
22
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
@@ -36,7 +36,7 @@ var VideoModal = function VideoModal(_ref) {
|
|
|
36
36
|
}, /*#__PURE__*/_react["default"].createElement(_VideoRender["default"], (0, _extends2["default"])({
|
|
37
37
|
placeholderOnly: true,
|
|
38
38
|
autoplay: false
|
|
39
|
-
}, props))), displayModal && /*#__PURE__*/_react["default"].createElement(
|
|
39
|
+
}, props))), displayModal && /*#__PURE__*/_react["default"].createElement(_ModalAdapter["default"], {
|
|
40
40
|
className: "modal--video",
|
|
41
41
|
isFullScreen: true,
|
|
42
42
|
showFooter: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoModal.js","names":["_react","_interopRequireWildcard","require","
|
|
1
|
+
{"version":3,"file":"VideoModal.js","names":["_react","_interopRequireWildcard","require","_ModalAdapter","_interopRequireDefault","_VideoRender","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","VideoModal","_ref","props","_extends2","_objectDestructuringEmpty2","_useState","useState","_useState2","_slicedToArray2","displayModal","setDisplayModal","createElement","Fragment","role","onClick","placeholderOnly","autoplay","className","isFullScreen","showFooter","isSimple","onClose","_default","exports"],"sources":["../../../src/components/Video/VideoModal.js"],"sourcesContent":["import React, { useState } from 'react';\nimport Modal from '../ModalAdapter';\nimport VideoRender from './VideoRender';\n\nconst VideoModal = ({ ...props }) => {\n const [displayModal, setDisplayModal] = useState(false);\n\n return (\n <>\n <div\n role=\"button\"\n aria-label=\"Open video\"\n onClick={() => {\n setDisplayModal(!displayModal);\n }}>\n <VideoRender placeholderOnly autoplay={false} {...props} />\n </div>\n {displayModal && (\n <Modal\n className=\"modal--video\"\n isFullScreen\n showFooter={false}\n isSimple\n onClose={() => setDisplayModal(!displayModal)}>\n <VideoRender {...props} placeholderOnly={false} autoplay />\n </Modal>\n )}\n </>\n );\n};\n\nexport default VideoModal;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAwC,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAA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AAAsC,aAAA,CAACnC,aAAA,WAAK;IACJyC,SAAS,EAAC,cAAc;IACxBC,YAAY;IACZC,UAAU,EAAE,KAAM;IAClBC,QAAQ;IACRC,OAAO,EAAE,SAAAA,QAAA;MAAA,OAAMX,eAAe,CAAC,CAACD,YAAY,CAAC;IAAA;EAAC,gBAC9CpC,MAAA,YAAAsC,aAAA,CAACjC,YAAA,WAAW,MAAAyB,SAAA,iBAAKD,KAAK;IAAEa,eAAe,EAAE,KAAM;IAACC,QAAQ;EAAA,EAAE,CACrD,CAET,CAAC;AAEP,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,cAEavB,UAAU"}
|
package/lib/hooks/index.js
CHANGED
|
@@ -59,6 +59,12 @@ Object.defineProperty(exports, "usePageBuilder", {
|
|
|
59
59
|
return _usePageBuilder["default"];
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
+
Object.defineProperty(exports, "usePortal", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function get() {
|
|
65
|
+
return _usePortal["default"];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
62
68
|
var _useGetEntitySchema = _interopRequireDefault(require("./use-get-entity-schema"));
|
|
63
69
|
var _useGetEntitySchemasAsObj = _interopRequireDefault(require("./use-get-entity-schemas-as-obj"));
|
|
64
70
|
var _useGetImageIdFromRelation = _interopRequireDefault(require("./use-get-image-id-from-relation"));
|
|
@@ -68,4 +74,5 @@ var _useGetSingleEntitySchema = _interopRequireDefault(require("./use-get-single
|
|
|
68
74
|
var _useCheckMobileScreen = _interopRequireDefault(require("./use-check-mobile-screen"));
|
|
69
75
|
var _useBannerInsertion = _interopRequireDefault(require("./use-banner-insertion"));
|
|
70
76
|
var _useAppSyncEventHook = _interopRequireDefault(require("./use-app-sync-event-hook"));
|
|
77
|
+
var _usePortal = _interopRequireDefault(require("./use-portal"));
|
|
71
78
|
//# sourceMappingURL=index.js.map
|
package/lib/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_useGetEntitySchema","_interopRequireDefault","require","_useGetEntitySchemasAsObj","_useGetImageIdFromRelation","_useGetImages","_usePageBuilder","_useGetSingleEntitySchema","_useCheckMobileScreen","_useBannerInsertion","_useAppSyncEventHook"],"sources":["../../src/hooks/index.js"],"sourcesContent":["export { default as useGetEntitySchema } from './use-get-entity-schema';\nexport { default as useGetEntitySchemasAsObj } from './use-get-entity-schemas-as-obj';\nexport { default as useGetImageIdFromRelation } from './use-get-image-id-from-relation';\nexport { default as useGetImages } from './use-get-images';\nexport { default as usePageBuilder } from './use-page-builder';\nexport { default as useGetSingleEntitySchema } from './use-get-single-entity-schema';\nexport { default as useCheckMobileScreen } from './use-check-mobile-screen';\nexport { default as useBannerInsertion } from './use-banner-insertion';\nexport { default as useAppSyncEventHook } from './use-app-sync-event-hook';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_useGetEntitySchema","_interopRequireDefault","require","_useGetEntitySchemasAsObj","_useGetImageIdFromRelation","_useGetImages","_usePageBuilder","_useGetSingleEntitySchema","_useCheckMobileScreen","_useBannerInsertion","_useAppSyncEventHook","_usePortal"],"sources":["../../src/hooks/index.js"],"sourcesContent":["export { default as useGetEntitySchema } from './use-get-entity-schema';\nexport { default as useGetEntitySchemasAsObj } from './use-get-entity-schemas-as-obj';\nexport { default as useGetImageIdFromRelation } from './use-get-image-id-from-relation';\nexport { default as useGetImages } from './use-get-images';\nexport { default as usePageBuilder } from './use-page-builder';\nexport { default as useGetSingleEntitySchema } from './use-get-single-entity-schema';\nexport { default as useCheckMobileScreen } from './use-check-mobile-screen';\nexport { default as useBannerInsertion } from './use-banner-insertion';\nexport { default as useAppSyncEventHook } from './use-app-sync-event-hook';\nexport { default as usePortal } from './use-portal';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,yBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,qBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,mBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,oBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,UAAA,GAAAV,sBAAA,CAAAC,OAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.array.iterator.js");
|
|
4
|
+
require("core-js/modules/es.object.to-string.js");
|
|
5
|
+
require("core-js/modules/es.string.iterator.js");
|
|
6
|
+
require("core-js/modules/es.weak-map.js");
|
|
7
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
|
+
require("core-js/modules/es.object.define-property.js");
|
|
9
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
10
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports["default"] = void 0;
|
|
15
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
18
|
+
function usePortal() {
|
|
19
|
+
var rootElemRef = _react["default"].useRef(document.createElement('div'));
|
|
20
|
+
(0, _react.useEffect)(function () {
|
|
21
|
+
document.body.appendChild(rootElemRef.current);
|
|
22
|
+
var element = rootElemRef.current;
|
|
23
|
+
return function removeElement() {
|
|
24
|
+
element.remove();
|
|
25
|
+
};
|
|
26
|
+
}, []);
|
|
27
|
+
return rootElemRef.current;
|
|
28
|
+
}
|
|
29
|
+
var _default = exports["default"] = usePortal;
|
|
30
|
+
//# sourceMappingURL=use-portal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-portal.js","names":["_react","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","usePortal","rootElemRef","React","useRef","document","createElement","useEffect","body","appendChild","current","element","removeElement","remove","_default","exports"],"sources":["../../src/hooks/use-portal.js"],"sourcesContent":["import React, { useEffect } from 'react';\n\nfunction usePortal() {\n const rootElemRef = React.useRef(document.createElement('div'));\n\n useEffect(() => {\n document.body.appendChild(rootElemRef.current);\n\n const element = rootElemRef.current;\n return function removeElement() {\n element.remove();\n };\n }, []);\n\n return rootElemRef.current;\n}\n\nexport default usePortal;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAyC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAA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A,EAAG;MAC9BD,OAAO,CAACE,MAAM,CAAC,CAAC;IAClB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOX,WAAW,CAACQ,OAAO;AAC5B;AAAC,IAAAI,QAAA,GAAAC,OAAA,cAEcd,SAAS"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { Fragment } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import Modal from '@blaze-react/modal';
|
|
5
4
|
import { useInView } from '@blaze-react/utils/lib/customHooks';
|
|
6
5
|
import { ResponsiveImage } from '@blaze-cms/image-cdn-react';
|
|
6
|
+
import Modal from '../../ModalAdapter';
|
|
7
7
|
import BlazeLink from '../../BlazeLink';
|
|
8
8
|
import { IN_VIEW_CONFIG } from '../../../constants';
|
|
9
9
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lightbox.js","names":["React","Fragment","PropTypes","
|
|
1
|
+
{"version":3,"file":"Lightbox.js","names":["React","Fragment","PropTypes","useInView","ResponsiveImage","Modal","BlazeLink","IN_VIEW_CONFIG","Lightbox","name","imageUrl","altTxt","closeModal","imageCaption","imgWrapperProps","isIntersecting","outerRef","hasLink","Object","keys","length","ImgWrapper","createElement","title","onClose","isFullScreen","className","ref","_extends","role","src","alt","sizeKey","propTypes","string","func","isRequired","object","modifier","defaultProps"],"sources":["../../../../src/components/Image/Lightbox/Lightbox.js"],"sourcesContent":["import React, { Fragment } from 'react';\nimport PropTypes from 'prop-types';\nimport { useInView } from '@blaze-react/utils/lib/customHooks';\nimport { ResponsiveImage } from '@blaze-cms/image-cdn-react';\nimport Modal from '../../ModalAdapter';\nimport BlazeLink from '../../BlazeLink';\nimport { IN_VIEW_CONFIG } from '../../../constants';\n\n// add for full screen modal based on blaze, and pass modifiers(lightbox)\nconst Lightbox = ({ name, imageUrl, altTxt, closeModal, imageCaption, imgWrapperProps }) => {\n const [isIntersecting, outerRef] = useInView(IN_VIEW_CONFIG);\n\n const hasLink = Object.keys(imgWrapperProps).length;\n const ImgWrapper = hasLink ? BlazeLink : Fragment;\n\n return (\n <Modal title={name} onClose={closeModal} isFullScreen>\n <div className=\"row row--display-row\">\n <div className=\"column column--two-thirds\">\n <div ref={outerRef} className=\"image\">\n {isIntersecting && (\n <ImgWrapper {...imgWrapperProps} role={hasLink ? 'link' : ''}>\n <ResponsiveImage src={imageUrl} alt={altTxt} sizeKey=\"lightbox\" />\n </ImgWrapper>\n )}\n </div>\n </div>\n </div>\n {imageCaption && (\n <div className=\"row row--display-row\">\n <div className=\"caption\">{imageCaption}</div>\n </div>\n )}\n </Modal>\n );\n};\n\nLightbox.propTypes = {\n name: PropTypes.string,\n closeModal: PropTypes.func.isRequired,\n imgWrapperProps: PropTypes.object,\n imageUrl: PropTypes.string,\n imageCaption: PropTypes.string,\n altTxt: PropTypes.string,\n modifier: PropTypes.string\n};\n\nLightbox.defaultProps = {\n name: '',\n imgWrapperProps: {},\n modifier: '',\n imageCaption: '',\n altTxt: '',\n imageUrl: ''\n};\n\nexport default Lightbox;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,SAAS,QAAQ,oCAAoC;AAC9D,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,SAAS,MAAM,iBAAiB;AACvC,SAASC,cAAc,QAAQ,oBAAoB;;AAEnD;AACA,MAAMC,QAAQ,GAAGA,CAAC;EAAEC,IAAI;EAAEC,QAAQ;EAAEC,MAAM;EAAEC,UAAU;EAAEC,YAAY;EAAEC;AAAgB,CAAC,KAAK;EAC1F,MAAM,CAACC,cAAc,EAAEC,QAAQ,CAAC,GAAGb,SAAS,CAACI,cAAc,CAAC;EAE5D,MAAMU,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACL,eAAe,CAAC,C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I,EAAE,EAAE;EACRK,eAAe,EAAE,CAAC,CAAC;EACnBwB,QAAQ,EAAE,EAAE;EACZzB,YAAY,EAAE,EAAE;EAChBF,MAAM,EAAE,EAAE;EACVD,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeF,QAAQ"}
|
|
@@ -2,7 +2,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
2
2
|
const _excluded = ["children", "elementTitle", "onClose"];
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import BlazeModal from '
|
|
5
|
+
import BlazeModal from '../ModalAdapter';
|
|
6
6
|
import { renderChildren, updateChildrensParent, hasChildren } from '../../helpers';
|
|
7
7
|
const Modal = _ref => {
|
|
8
8
|
let {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":["React","PropTypes","BlazeModal","renderChildren","updateChildrensParent","hasChildren","Modal","_ref","children","elementTitle","onClose","otherProps","_objectWithoutProperties","_excluded","parent","itemId","itemEntity","createElement","title","propTypes","func","string","oneOfType","arrayOf","node","defaultProps"],"sources":["../../../src/components/Modal/Modal.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport BlazeModal from '
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["React","PropTypes","BlazeModal","renderChildren","updateChildrensParent","hasChildren","Modal","_ref","children","elementTitle","onClose","otherProps","_objectWithoutProperties","_excluded","parent","itemId","itemEntity","createElement","title","propTypes","func","string","oneOfType","arrayOf","node","defaultProps"],"sources":["../../../src/components/Modal/Modal.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport BlazeModal from '../ModalAdapter';\nimport { renderChildren, updateChildrensParent, hasChildren } from '../../helpers';\n\nconst Modal = ({ children, elementTitle, onClose, ...otherProps }) => {\n if (!hasChildren(children)) return null;\n\n updateChildrensParent(children, otherProps.parent.itemId, otherProps.parent.itemEntity);\n return (\n <BlazeModal title={elementTitle} onClose={onClose}>\n {renderChildren(children)}\n </BlazeModal>\n );\n};\n\nModal.propTypes = {\n onClose: PropTypes.func,\n elementTitle: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nModal.defaultProps = {\n onClose: () => {},\n elementTitle: '',\n children: []\n};\n\nexport default Modal;\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,iBAAiB;AACxC,SAASC,cAAc,EAAEC,qBAAqB,EAAEC,WAAW,QAAQ,eAAe;AAElF,MAAMC,KAAK,GAAGC,IAAA,IAAwD;EAAA,IAAvD;MAAEC,QAAQ;MAAEC,YAAY;MAAEC;IAAuB,CAAC,GAAAH,IAAA;IAAZI,UAAU,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAC7D,IAAI,CAACR,WAAW,CAACG,QAAQ,CAAC,EAAE,OAAO,IAAI;EAEvCJ,qBAAqB,CAACI,QAAQ,EAAEG,UAAU,CAACG,MAAM,CAACC,MAAM,EAAEJ,UAAU,CAACG,MAAM,CAACE,UAAU,CAAC;EACvF,oBACEhB,KAAA,CAAAiB,aAAA,CAACf,UAAU;IAACgB,KAAK,EAAET,YAAa;IAACC,OAAO,EAAEA;EAAQ,GAC/CP,cAAc,CAACK,QAAQ,CACd,CAAC;AAEjB,CAAC;AAEDF,KAAK,CAACa,SAAS,GAAG;EAChBT,OAAO,EAAET,SAAS,CAACmB,IAAI;EACvBX,YAAY,EAAER,SAAS,CAACoB,MAAM;EAC9Bb,QAAQ,EAAEP,SAAS,CAACqB,SAAS,CAAC,CAACrB,SAAS,CAACsB,OAAO,CAACtB,SAAS,CAACuB,IAAI,CAAC,EAAEvB,SAAS,CAACuB,IAAI,CAAC;AACnF,CAAC;AAEDlB,KAAK,CAACmB,YAAY,GAAG;EACnBf,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBD,YAAY,EAAE,EAAE;EAChBD,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeF,KAAK"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Modal from '@blaze-react/modal';
|
|
5
|
+
import ReactDOM from 'react-dom';
|
|
6
|
+
import { usePortal } from '../../hooks';
|
|
7
|
+
const ModalAdapter = _ref => {
|
|
8
|
+
let props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
9
|
+
const target = usePortal();
|
|
10
|
+
return ReactDOM.createPortal( /*#__PURE__*/React.createElement(Modal, props), target);
|
|
11
|
+
};
|
|
12
|
+
export default ModalAdapter;
|
|
13
|
+
//# sourceMappingURL=ModalAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalAdapter.js","names":["React","Modal","ReactDOM","usePortal","ModalAdapter","_ref","props","_extends","_objectDestructuringEmpty","target","createPortal","createElement"],"sources":["../../../src/components/ModalAdapter/ModalAdapter.js"],"sourcesContent":["import React from 'react';\nimport Modal from '@blaze-react/modal';\nimport ReactDOM from 'react-dom';\nimport { usePortal } from '../../hooks';\n\nconst ModalAdapter = ({ ...props }) => {\n const target = usePortal();\n\n return ReactDOM.createPortal(<Modal {...props} />, target);\n};\n\nexport default ModalAdapter;\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,QAAQ,MAAM,WAAW;AAChC,SAASC,SAAS,QAAQ,aAAa;AAEvC,MAAMC,YAAY,GAAGC,IAAA,IAAkB;EAAA,IAAZC,KAAK,GAAAC,QAAA,MAAAC,yBAAA,CAAAH,IAAA,GAAAA,IAAA;EAC9B,MAAMI,MAAM,GAAGN,SAAS,CAAC,CAAC;EAE1B,OAAOD,QAAQ,CAACQ,YAAY,eAACV,KAAA,CAAAW,aAAA,CAACV,KAAK,EAAKK,KAAQ,CAAC,EAAEG,MAAM,CAAC;AAC5D,CAAC;AAED,eAAeL,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ModalAdapter"],"sources":["../../../src/components/ModalAdapter/index.js"],"sourcesContent":["import ModalAdapter from './ModalAdapter';\n\nexport default ModalAdapter;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,gBAAgB;AAEzC,eAAeA,YAAY"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
-
import Modal from '
|
|
4
|
+
import Modal from '../ModalAdapter';
|
|
5
5
|
import VideoRender from './VideoRender';
|
|
6
6
|
const VideoModal = _ref => {
|
|
7
7
|
let props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoModal.js","names":["React","useState","Modal","VideoRender","VideoModal","_ref","props","_extends","_objectDestructuringEmpty","displayModal","setDisplayModal","createElement","Fragment","role","onClick","placeholderOnly","autoplay","className","isFullScreen","showFooter","isSimple","onClose"],"sources":["../../../src/components/Video/VideoModal.js"],"sourcesContent":["import React, { useState } from 'react';\nimport Modal from '
|
|
1
|
+
{"version":3,"file":"VideoModal.js","names":["React","useState","Modal","VideoRender","VideoModal","_ref","props","_extends","_objectDestructuringEmpty","displayModal","setDisplayModal","createElement","Fragment","role","onClick","placeholderOnly","autoplay","className","isFullScreen","showFooter","isSimple","onClose"],"sources":["../../../src/components/Video/VideoModal.js"],"sourcesContent":["import React, { useState } from 'react';\nimport Modal from '../ModalAdapter';\nimport VideoRender from './VideoRender';\n\nconst VideoModal = ({ ...props }) => {\n const [displayModal, setDisplayModal] = useState(false);\n\n return (\n <>\n <div\n role=\"button\"\n aria-label=\"Open video\"\n onClick={() => {\n setDisplayModal(!displayModal);\n }}>\n <VideoRender placeholderOnly autoplay={false} {...props} />\n </div>\n {displayModal && (\n <Modal\n className=\"modal--video\"\n isFullScreen\n showFooter={false}\n isSimple\n onClose={() => setDisplayModal(!displayModal)}>\n <VideoRender {...props} placeholderOnly={false} autoplay />\n </Modal>\n )}\n </>\n );\n};\n\nexport default VideoModal;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,KAAK,MAAM,iBAAiB;AACnC,OAAOC,WAAW,MAAM,eAAe;AAEvC,MAAMC,UAAU,GAAGC,IAAA,IAAkB;EAAA,IAAZC,KAAK,GAAAC,QAAA,MAAAC,yBAAA,CAAAH,IAAA,GAAAA,IAAA;EAC5B,MAAM,CAACI,YAAY,EAAEC,eAAe,CAAC,GAAGT,QAAQ,CAAC,KAAK,CAAC;EAEvD,oBACED,KAAA,CAAAW,aAAA,CAAAX,KAAA,CAAAY,QAAA,qBACEZ,KAAA,CAAAW,aAAA;IACEE,IAAI,EAAC,QAAQ;IACb,cAAW,YAAY;IACvBC,OAAO,EAAEA,CAAA,KAAM;MACbJ,eAAe,CAAC,CAACD,YAAY,CAAC;IAChC;EAAE,gBACFT,KAAA,CAAAW,aAAA,CAACR,WAAW,EAAAI,QAAA;IAACQ,eAAe;IAACC,QAAQ,EAAE;EAAM,GAAKV,KAAK,CAAG,CACvD,CAAC,EACLG,YAAY,iBACXT,KAAA,CAAAW,aAAA,CAACT,KAAK;IACJe,SAAS,EAAC,cAAc;IACxBC,YAAY;IACZC,UAAU,EAAE,KAAM;IAClBC,QAAQ;IACRC,OAAO,EAAEA,CAAA,KAAMX,eAAe,CAAC,CAACD,YAAY;EAAE,gBAC9CT,KAAA,CAAAW,aAAA,CAACR,WAAW,EAAAI,QAAA,KAAKD,KAAK;IAAES,eAAe,EAAE,KAAM;IAACC,QAAQ;EAAA,EAAE,CACrD,CAET,CAAC;AAEP,CAAC;AAED,eAAeZ,UAAU"}
|
package/lib-es/hooks/index.js
CHANGED
|
@@ -7,4 +7,5 @@ export { default as useGetSingleEntitySchema } from './use-get-single-entity-sch
|
|
|
7
7
|
export { default as useCheckMobileScreen } from './use-check-mobile-screen';
|
|
8
8
|
export { default as useBannerInsertion } from './use-banner-insertion';
|
|
9
9
|
export { default as useAppSyncEventHook } from './use-app-sync-event-hook';
|
|
10
|
+
export { default as usePortal } from './use-portal';
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","useGetEntitySchema","useGetEntitySchemasAsObj","useGetImageIdFromRelation","useGetImages","usePageBuilder","useGetSingleEntitySchema","useCheckMobileScreen","useBannerInsertion","useAppSyncEventHook"],"sources":["../../src/hooks/index.js"],"sourcesContent":["export { default as useGetEntitySchema } from './use-get-entity-schema';\nexport { default as useGetEntitySchemasAsObj } from './use-get-entity-schemas-as-obj';\nexport { default as useGetImageIdFromRelation } from './use-get-image-id-from-relation';\nexport { default as useGetImages } from './use-get-images';\nexport { default as usePageBuilder } from './use-page-builder';\nexport { default as useGetSingleEntitySchema } from './use-get-single-entity-schema';\nexport { default as useCheckMobileScreen } from './use-check-mobile-screen';\nexport { default as useBannerInsertion } from './use-banner-insertion';\nexport { default as useAppSyncEventHook } from './use-app-sync-event-hook';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,kBAAkB,QAAQ,yBAAyB;AACvE,SAASD,OAAO,IAAIE,wBAAwB,QAAQ,iCAAiC;AACrF,SAASF,OAAO,IAAIG,yBAAyB,QAAQ,kCAAkC;AACvF,SAASH,OAAO,IAAII,YAAY,QAAQ,kBAAkB;AAC1D,SAASJ,OAAO,IAAIK,cAAc,QAAQ,oBAAoB;AAC9D,SAASL,OAAO,IAAIM,wBAAwB,QAAQ,gCAAgC;AACpF,SAASN,OAAO,IAAIO,oBAAoB,QAAQ,2BAA2B;AAC3E,SAASP,OAAO,IAAIQ,kBAAkB,QAAQ,wBAAwB;AACtE,SAASR,OAAO,IAAIS,mBAAmB,QAAQ,2BAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","useGetEntitySchema","useGetEntitySchemasAsObj","useGetImageIdFromRelation","useGetImages","usePageBuilder","useGetSingleEntitySchema","useCheckMobileScreen","useBannerInsertion","useAppSyncEventHook","usePortal"],"sources":["../../src/hooks/index.js"],"sourcesContent":["export { default as useGetEntitySchema } from './use-get-entity-schema';\nexport { default as useGetEntitySchemasAsObj } from './use-get-entity-schemas-as-obj';\nexport { default as useGetImageIdFromRelation } from './use-get-image-id-from-relation';\nexport { default as useGetImages } from './use-get-images';\nexport { default as usePageBuilder } from './use-page-builder';\nexport { default as useGetSingleEntitySchema } from './use-get-single-entity-schema';\nexport { default as useCheckMobileScreen } from './use-check-mobile-screen';\nexport { default as useBannerInsertion } from './use-banner-insertion';\nexport { default as useAppSyncEventHook } from './use-app-sync-event-hook';\nexport { default as usePortal } from './use-portal';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,kBAAkB,QAAQ,yBAAyB;AACvE,SAASD,OAAO,IAAIE,wBAAwB,QAAQ,iCAAiC;AACrF,SAASF,OAAO,IAAIG,yBAAyB,QAAQ,kCAAkC;AACvF,SAASH,OAAO,IAAII,YAAY,QAAQ,kBAAkB;AAC1D,SAASJ,OAAO,IAAIK,cAAc,QAAQ,oBAAoB;AAC9D,SAASL,OAAO,IAAIM,wBAAwB,QAAQ,gCAAgC;AACpF,SAASN,OAAO,IAAIO,oBAAoB,QAAQ,2BAA2B;AAC3E,SAASP,OAAO,IAAIQ,kBAAkB,QAAQ,wBAAwB;AACtE,SAASR,OAAO,IAAIS,mBAAmB,QAAQ,2BAA2B;AAC1E,SAAST,OAAO,IAAIU,SAAS,QAAQ,cAAc"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
function usePortal() {
|
|
3
|
+
const rootElemRef = React.useRef(document.createElement('div'));
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
document.body.appendChild(rootElemRef.current);
|
|
6
|
+
const element = rootElemRef.current;
|
|
7
|
+
return function removeElement() {
|
|
8
|
+
element.remove();
|
|
9
|
+
};
|
|
10
|
+
}, []);
|
|
11
|
+
return rootElemRef.current;
|
|
12
|
+
}
|
|
13
|
+
export default usePortal;
|
|
14
|
+
//# sourceMappingURL=use-portal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-portal.js","names":["React","useEffect","usePortal","rootElemRef","useRef","document","createElement","body","appendChild","current","element","removeElement","remove"],"sources":["../../src/hooks/use-portal.js"],"sourcesContent":["import React, { useEffect } from 'react';\n\nfunction usePortal() {\n const rootElemRef = React.useRef(document.createElement('div'));\n\n useEffect(() => {\n document.body.appendChild(rootElemRef.current);\n\n const element = rootElemRef.current;\n return function removeElement() {\n element.remove();\n };\n }, []);\n\n return rootElemRef.current;\n}\n\nexport default usePortal;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AAExC,SAASC,SAASA,CAAA,EAAG;EACnB,MAAMC,WAAW,GAAGH,KAAK,CAACI,MAAM,CAACC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,CAAC;EAE/DL,SAAS,CAAC,MAAM;IACdI,QAAQ,CAACE,IAAI,CAACC,WAAW,CAACL,WAAW,CAACM,OAAO,CAAC;IAE9C,MAAMC,OAAO,GAAGP,WAAW,CAACM,OAAO;IACnC,OAAO,SAASE,aAAaA,CAAA,EAAG;MAC9BD,OAAO,CAACE,MAAM,CAAC,CAAC;IAClB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOT,WAAW,CAACM,OAAO;AAC5B;AAEA,eAAeP,SAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.146.0-core-styles.
|
|
3
|
+
"version": "0.146.0-core-styles.7",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"lib/*",
|
|
91
91
|
"lib-es/*"
|
|
92
92
|
],
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "b811f3e32b6d7faaaf35fad93a76a0b7bbf76468"
|
|
94
94
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import Modal from '@blaze-react/modal';
|
|
4
3
|
import { useInView } from '@blaze-react/utils/lib/customHooks';
|
|
5
4
|
import { ResponsiveImage } from '@blaze-cms/image-cdn-react';
|
|
5
|
+
import Modal from '../../ModalAdapter';
|
|
6
6
|
import BlazeLink from '../../BlazeLink';
|
|
7
7
|
import { IN_VIEW_CONFIG } from '../../../constants';
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import BlazeModal from '
|
|
3
|
+
import BlazeModal from '../ModalAdapter';
|
|
4
4
|
import { renderChildren, updateChildrensParent, hasChildren } from '../../helpers';
|
|
5
5
|
|
|
6
6
|
const Modal = ({ children, elementTitle, onClose, ...otherProps }) => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Modal from '@blaze-react/modal';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
4
|
+
import { usePortal } from '../../hooks';
|
|
5
|
+
|
|
6
|
+
const ModalAdapter = ({ ...props }) => {
|
|
7
|
+
const target = usePortal();
|
|
8
|
+
|
|
9
|
+
return ReactDOM.createPortal(<Modal {...props} />, target);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default ModalAdapter;
|
package/src/hooks/index.js
CHANGED
|
@@ -7,3 +7,4 @@ export { default as useGetSingleEntitySchema } from './use-get-single-entity-sch
|
|
|
7
7
|
export { default as useCheckMobileScreen } from './use-check-mobile-screen';
|
|
8
8
|
export { default as useBannerInsertion } from './use-banner-insertion';
|
|
9
9
|
export { default as useAppSyncEventHook } from './use-app-sync-event-hook';
|
|
10
|
+
export { default as usePortal } from './use-portal';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
function usePortal() {
|
|
4
|
+
const rootElemRef = React.useRef(document.createElement('div'));
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
document.body.appendChild(rootElemRef.current);
|
|
8
|
+
|
|
9
|
+
const element = rootElemRef.current;
|
|
10
|
+
return function removeElement() {
|
|
11
|
+
element.remove();
|
|
12
|
+
};
|
|
13
|
+
}, []);
|
|
14
|
+
|
|
15
|
+
return rootElemRef.current;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default usePortal;
|
|
@@ -10,6 +10,10 @@ jest.mock('../../../../../../src/components/Banner', () =>
|
|
|
10
10
|
jest.fn().mockImplementation(() => <span>Banner</span>)
|
|
11
11
|
);
|
|
12
12
|
|
|
13
|
+
jest.mock('../../../../../../src/components/ModalAdapter', () =>
|
|
14
|
+
jest.fn().mockImplementation(({ children }) => children)
|
|
15
|
+
);
|
|
16
|
+
|
|
13
17
|
const mockProps = {
|
|
14
18
|
imageUrl: 'some-url',
|
|
15
19
|
altTxt: 'atl text',
|
|
@@ -3,48 +3,13 @@
|
|
|
3
3
|
exports[`LightBox component should render without throwing an error and match snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="
|
|
7
|
-
/>
|
|
8
|
-
<div
|
|
9
|
-
class=" modal modal--show modal--full-screen"
|
|
6
|
+
class="row row--display-row"
|
|
10
7
|
>
|
|
11
8
|
<div
|
|
12
|
-
class="
|
|
13
|
-
>
|
|
14
|
-
<div
|
|
15
|
-
class="modal__title"
|
|
16
|
-
/>
|
|
17
|
-
<div
|
|
18
|
-
class="modal__close"
|
|
19
|
-
role="button"
|
|
20
|
-
>
|
|
21
|
-
<i
|
|
22
|
-
class="material-icons"
|
|
23
|
-
>
|
|
24
|
-
close
|
|
25
|
-
</i>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
<div
|
|
29
|
-
class="modal__content"
|
|
30
|
-
>
|
|
31
|
-
<div
|
|
32
|
-
class="row row--display-row"
|
|
33
|
-
>
|
|
34
|
-
<div
|
|
35
|
-
class="column column--two-thirds"
|
|
36
|
-
>
|
|
37
|
-
<div
|
|
38
|
-
class="image"
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
<div
|
|
44
|
-
class="modal__footer"
|
|
9
|
+
class="column column--two-thirds"
|
|
45
10
|
>
|
|
46
11
|
<div
|
|
47
|
-
class="
|
|
12
|
+
class="image"
|
|
48
13
|
/>
|
|
49
14
|
</div>
|
|
50
15
|
</div>
|
|
@@ -19,6 +19,10 @@ const props = {
|
|
|
19
19
|
]
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
jest.mock('../../../../../src/components/ModalAdapter', () =>
|
|
23
|
+
jest.fn().mockImplementation(({ children }) => children)
|
|
24
|
+
);
|
|
25
|
+
|
|
22
26
|
describe('Modal component', () => {
|
|
23
27
|
it('should be defined', () => {
|
|
24
28
|
expect(Modal).toBeDefined();
|
|
@@ -3,50 +3,15 @@
|
|
|
3
3
|
exports[`Modal component should render without throwing an error and match snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="
|
|
7
|
-
|
|
6
|
+
class="child_1"
|
|
7
|
+
>
|
|
8
|
+
some stuff
|
|
9
|
+
</div>
|
|
8
10
|
<div
|
|
9
|
-
class="
|
|
11
|
+
class="child_2"
|
|
12
|
+
modifier="child-modi"
|
|
10
13
|
>
|
|
11
|
-
|
|
12
|
-
class="modal__header"
|
|
13
|
-
>
|
|
14
|
-
<div
|
|
15
|
-
class="modal__title"
|
|
16
|
-
/>
|
|
17
|
-
<div
|
|
18
|
-
class="modal__close"
|
|
19
|
-
role="button"
|
|
20
|
-
>
|
|
21
|
-
<i
|
|
22
|
-
class="material-icons"
|
|
23
|
-
>
|
|
24
|
-
close
|
|
25
|
-
</i>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
<div
|
|
29
|
-
class="modal__content"
|
|
30
|
-
>
|
|
31
|
-
<div
|
|
32
|
-
class="child_1"
|
|
33
|
-
>
|
|
34
|
-
some stuff
|
|
35
|
-
</div>
|
|
36
|
-
<div
|
|
37
|
-
class="child_2"
|
|
38
|
-
modifier="child-modi"
|
|
39
|
-
>
|
|
40
|
-
another child
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
<div
|
|
44
|
-
class="modal__footer"
|
|
45
|
-
>
|
|
46
|
-
<div
|
|
47
|
-
class="modal__button"
|
|
48
|
-
/>
|
|
49
|
-
</div>
|
|
14
|
+
another child
|
|
50
15
|
</div>
|
|
51
16
|
</DocumentFragment>
|
|
52
17
|
`;
|