@blaze-cms/react-page-builder 0.147.0-rc-eagle.2 → 0.147.0-rc-eagle.6
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/lib/components/ContentGroup/ContentGroup.js +40 -8
- package/lib/components/ContentGroup/ContentGroup.js.map +1 -1
- package/lib/components/ContentGroup/ContentGroupDataFetcher.js +96 -0
- package/lib/components/ContentGroup/ContentGroupDataFetcher.js.map +1 -0
- package/lib/components/ContentGroup/helpers/build-data-sections.js +46 -0
- package/lib/components/ContentGroup/helpers/build-data-sections.js.map +1 -0
- package/lib/components/ContentGroup/helpers/index.js +7 -0
- package/lib/components/ContentGroup/helpers/index.js.map +1 -1
- package/lib/components/ContentGroupSection/ContentGroupSection.js +3 -2
- package/lib/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
- package/lib/components/Iframe/Iframe.js +16 -6
- package/lib/components/Iframe/Iframe.js.map +1 -1
- package/lib/components/Layout/Layout.js +14 -3
- package/lib/components/Layout/Layout.js.map +1 -1
- package/lib/components/Menu/Menu.js +4 -1
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/MenuContext.js +2 -1
- package/lib/components/Menu/MenuContext.js.map +1 -1
- package/lib/components/MenuItem/MenuItemRender.js +24 -9
- package/lib/components/MenuItem/MenuItemRender.js.map +1 -1
- package/lib/components/MenuItem/helpers/has-active-child.js +12 -0
- package/lib/components/MenuItem/helpers/has-active-child.js.map +1 -0
- package/lib/components/MenuItem/helpers/index.js +14 -0
- package/lib/components/MenuItem/helpers/index.js.map +1 -1
- package/lib/components/MenuItem/helpers/isUrlPathMatch.js +14 -0
- package/lib/components/MenuItem/helpers/isUrlPathMatch.js.map +1 -0
- package/lib/helpers/get-component-id.js +9 -3
- package/lib/helpers/get-component-id.js.map +1 -1
- package/lib-es/components/ContentGroup/ContentGroup.js +41 -9
- package/lib-es/components/ContentGroup/ContentGroup.js.map +1 -1
- package/lib-es/components/ContentGroup/ContentGroupDataFetcher.js +88 -0
- package/lib-es/components/ContentGroup/ContentGroupDataFetcher.js.map +1 -0
- package/lib-es/components/ContentGroup/helpers/build-data-sections.js +38 -0
- package/lib-es/components/ContentGroup/helpers/build-data-sections.js.map +1 -0
- package/lib-es/components/ContentGroup/helpers/index.js +2 -1
- package/lib-es/components/ContentGroup/helpers/index.js.map +1 -1
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js +3 -2
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
- package/lib-es/components/Iframe/Iframe.js +16 -6
- package/lib-es/components/Iframe/Iframe.js.map +1 -1
- package/lib-es/components/Layout/Layout.js +14 -3
- package/lib-es/components/Layout/Layout.js.map +1 -1
- package/lib-es/components/Menu/Menu.js +4 -1
- package/lib-es/components/Menu/Menu.js.map +1 -1
- package/lib-es/components/Menu/MenuContext.js +2 -1
- package/lib-es/components/Menu/MenuContext.js.map +1 -1
- package/lib-es/components/MenuItem/MenuItemRender.js +25 -11
- package/lib-es/components/MenuItem/MenuItemRender.js.map +1 -1
- package/lib-es/components/MenuItem/helpers/has-active-child.js +5 -0
- package/lib-es/components/MenuItem/helpers/has-active-child.js.map +1 -0
- package/lib-es/components/MenuItem/helpers/index.js +3 -1
- package/lib-es/components/MenuItem/helpers/index.js.map +1 -1
- package/lib-es/components/MenuItem/helpers/isUrlPathMatch.js +8 -0
- package/lib-es/components/MenuItem/helpers/isUrlPathMatch.js.map +1 -0
- package/lib-es/helpers/get-component-id.js +9 -3
- package/lib-es/helpers/get-component-id.js.map +1 -1
- package/package.json +10 -11
- package/src/components/ContentGroup/ContentGroup.js +54 -8
- package/src/components/ContentGroup/ContentGroupDataFetcher.js +74 -0
- package/src/components/ContentGroup/helpers/build-data-sections.js +35 -0
- package/src/components/ContentGroup/helpers/index.js +2 -1
- package/src/components/ContentGroupSection/ContentGroupSection.js +2 -2
- package/src/components/Iframe/Iframe.js +22 -6
- package/src/components/Layout/Layout.js +13 -2
- package/src/components/Menu/Menu.js +3 -1
- package/src/components/Menu/MenuContext.js +1 -1
- package/src/components/MenuItem/MenuItemRender.js +40 -12
- package/src/components/MenuItem/helpers/has-active-child.js +10 -0
- package/src/components/MenuItem/helpers/index.js +3 -1
- package/src/components/MenuItem/helpers/isUrlPathMatch.js +10 -0
- package/src/helpers/get-component-id.js +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getSectionsData","getActiveTab"],"sources":["../../../../src/components/ContentGroup/helpers/index.js"],"sourcesContent":["import getSectionsData from './get-sections-data';\nimport getActiveTab from './get-active-tab';\n\nexport { getSectionsData, getActiveTab };\n"],"mappings":"AAAA,OAAOA,eAAe,MAAM,qBAAqB;AACjD,OAAOC,YAAY,MAAM,kBAAkB;
|
|
1
|
+
{"version":3,"file":"index.js","names":["getSectionsData","getActiveTab","buildDataSections"],"sources":["../../../../src/components/ContentGroup/helpers/index.js"],"sourcesContent":["import getSectionsData from './get-sections-data';\nimport getActiveTab from './get-active-tab';\nimport buildDataSections from './build-data-sections';\n\nexport { getSectionsData, getActiveTab, buildDataSections };\n"],"mappings":"AAAA,OAAOA,eAAe,MAAM,qBAAqB;AACjD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,iBAAiB,MAAM,uBAAuB;AAErD,SAASF,eAAe,EAAEC,YAAY,EAAEC,iBAAiB","ignoreList":[]}
|
|
@@ -3,9 +3,10 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { hasChildren } from '../../helpers';
|
|
4
4
|
const ContentGroupSection = ({
|
|
5
5
|
children,
|
|
6
|
-
name
|
|
6
|
+
name,
|
|
7
|
+
disableChildCheck
|
|
7
8
|
}) => {
|
|
8
|
-
if (!hasChildren(children)) return null;
|
|
9
|
+
if (!disableChildCheck && !hasChildren(children)) return null;
|
|
9
10
|
return /*#__PURE__*/React.createElement("div", {
|
|
10
11
|
key: name,
|
|
11
12
|
className: "content-group-section"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentGroupSection.js","names":["React","PropTypes","hasChildren","ContentGroupSection","children","name","createElement","key","className","propTypes","oneOfType","arrayOf","node","string","defaultProps"],"sources":["../../../src/components/ContentGroupSection/ContentGroupSection.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { hasChildren } from '../../helpers';\n\nconst ContentGroupSection = ({ children, name }) => {\n if (!hasChildren(children)) return null;\n\n return (\n <div key={name} className=\"content-group-section\">\n {children}\n </div>\n );\n};\n\nContentGroupSection.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n name: PropTypes.string\n};\n\nContentGroupSection.defaultProps = { children: null, name: '' };\n\nexport default ContentGroupSection;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,WAAW,QAAQ,eAAe;AAE3C,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;
|
|
1
|
+
{"version":3,"file":"ContentGroupSection.js","names":["React","PropTypes","hasChildren","ContentGroupSection","children","name","disableChildCheck","createElement","key","className","propTypes","oneOfType","arrayOf","node","string","defaultProps"],"sources":["../../../src/components/ContentGroupSection/ContentGroupSection.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { hasChildren } from '../../helpers';\n\nconst ContentGroupSection = ({ children, name, disableChildCheck }) => {\n if (!disableChildCheck && !hasChildren(children)) return null;\n\n return (\n <div key={name} className=\"content-group-section\">\n {children}\n </div>\n );\n};\n\nContentGroupSection.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n name: PropTypes.string\n};\n\nContentGroupSection.defaultProps = { children: null, name: '' };\n\nexport default ContentGroupSection;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,WAAW,QAAQ,eAAe;AAE3C,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,IAAI;EAAEC;AAAkB,CAAC,KAAK;EACrE,IAAI,CAACA,iBAAiB,IAAI,CAACJ,WAAW,CAACE,QAAQ,CAAC,EAAE,OAAO,IAAI;EAE7D,oBACEJ,KAAA,CAAAO,aAAA;IAAKC,GAAG,EAAEH,IAAK;IAACI,SAAS,EAAC;EAAuB,GAC9CL,QACE,CAAC;AAEV,CAAC;AAEDD,mBAAmB,CAACO,SAAS,GAAG;EAC9BN,QAAQ,EAAEH,SAAS,CAACU,SAAS,CAAC,CAACV,SAAS,CAACW,OAAO,CAACX,SAAS,CAACY,IAAI,CAAC,EAAEZ,SAAS,CAACY,IAAI,CAAC,CAAC;EAClFR,IAAI,EAAEJ,SAAS,CAACa;AAClB,CAAC;AAEDX,mBAAmB,CAACY,YAAY,GAAG;EAAEX,QAAQ,EAAE,IAAI;EAAEC,IAAI,EAAE;AAAG,CAAC;AAE/D,eAAeF,mBAAmB","ignoreList":[]}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import IframeResizer from 'iframe-resizer-react';
|
|
4
|
+
import { useStringTemplate } from '@blaze-cms/utils-handlebars';
|
|
4
5
|
import { IFRAME_CLASS, DEFAULT_WIDTH } from './constants';
|
|
6
|
+
const UNSAFE_URL_PATTERN = /^(javascript|data):/i;
|
|
7
|
+
const isSafeUrl = url => !UNSAFE_URL_PATTERN.test(url.trim());
|
|
5
8
|
const Iframe = ({
|
|
6
9
|
src,
|
|
7
10
|
modifier,
|
|
8
11
|
width,
|
|
9
12
|
height,
|
|
10
|
-
enableScrolling
|
|
13
|
+
enableScrolling,
|
|
14
|
+
parent
|
|
11
15
|
}) => {
|
|
12
|
-
|
|
16
|
+
const {
|
|
17
|
+
data: [resolvedSrc]
|
|
18
|
+
} = useStringTemplate(parent, [src || '']);
|
|
19
|
+
if (!resolvedSrc || !isSafeUrl(resolvedSrc)) return null;
|
|
13
20
|
const modifierString = modifier ? ` ${modifier}` : '';
|
|
14
21
|
const iframeClassName = `${IFRAME_CLASS}${modifierString}`;
|
|
15
22
|
const defaultWidth = !width ? DEFAULT_WIDTH : {};
|
|
@@ -18,7 +25,7 @@ const Iframe = ({
|
|
|
18
25
|
}, /*#__PURE__*/React.createElement(IframeResizer, {
|
|
19
26
|
scrolling: enableScrolling,
|
|
20
27
|
autoResize: true,
|
|
21
|
-
src:
|
|
28
|
+
src: resolvedSrc,
|
|
22
29
|
sizeHeight: !height,
|
|
23
30
|
height: height,
|
|
24
31
|
width: width,
|
|
@@ -26,17 +33,20 @@ const Iframe = ({
|
|
|
26
33
|
}));
|
|
27
34
|
};
|
|
28
35
|
Iframe.propTypes = {
|
|
29
|
-
src: PropTypes.string
|
|
36
|
+
src: PropTypes.string,
|
|
30
37
|
enableScrolling: PropTypes.bool,
|
|
31
38
|
modifier: PropTypes.string,
|
|
32
39
|
width: PropTypes.string,
|
|
33
|
-
height: PropTypes.string
|
|
40
|
+
height: PropTypes.string,
|
|
41
|
+
parent: PropTypes.object
|
|
34
42
|
};
|
|
35
43
|
Iframe.defaultProps = {
|
|
44
|
+
src: '',
|
|
36
45
|
enableScrolling: false,
|
|
37
46
|
modifier: '',
|
|
38
47
|
width: '',
|
|
39
|
-
height: ''
|
|
48
|
+
height: '',
|
|
49
|
+
parent: {}
|
|
40
50
|
};
|
|
41
51
|
export default Iframe;
|
|
42
52
|
//# sourceMappingURL=Iframe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Iframe.js","names":["React","PropTypes","IframeResizer","IFRAME_CLASS","DEFAULT_WIDTH","Iframe","src","modifier","width","height","enableScrolling","modifierString","iframeClassName","defaultWidth","createElement","className","scrolling","autoResize","sizeHeight","style","propTypes","string","
|
|
1
|
+
{"version":3,"file":"Iframe.js","names":["React","PropTypes","IframeResizer","useStringTemplate","IFRAME_CLASS","DEFAULT_WIDTH","UNSAFE_URL_PATTERN","isSafeUrl","url","test","trim","Iframe","src","modifier","width","height","enableScrolling","parent","data","resolvedSrc","modifierString","iframeClassName","defaultWidth","createElement","className","scrolling","autoResize","sizeHeight","style","propTypes","string","bool","object","defaultProps"],"sources":["../../../src/components/Iframe/Iframe.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport IframeResizer from 'iframe-resizer-react';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport { IFRAME_CLASS, DEFAULT_WIDTH } from './constants';\n\nconst UNSAFE_URL_PATTERN = /^(javascript|data):/i;\n\nconst isSafeUrl = url => !UNSAFE_URL_PATTERN.test(url.trim());\n\nconst Iframe = ({ src, modifier, width, height, enableScrolling, parent }) => {\n const {\n data: [resolvedSrc]\n } = useStringTemplate(parent, [src || '']);\n if (!resolvedSrc || !isSafeUrl(resolvedSrc)) return null;\n const modifierString = modifier ? ` ${modifier}` : '';\n const iframeClassName = `${IFRAME_CLASS}${modifierString}`;\n const defaultWidth = !width ? DEFAULT_WIDTH : {};\n return (\n <div className={iframeClassName}>\n <IframeResizer\n scrolling={enableScrolling}\n autoResize\n src={resolvedSrc}\n sizeHeight={!height}\n height={height}\n width={width}\n style={defaultWidth}\n />\n </div>\n );\n};\n\nIframe.propTypes = {\n src: PropTypes.string,\n enableScrolling: PropTypes.bool,\n modifier: PropTypes.string,\n width: PropTypes.string,\n height: PropTypes.string,\n parent: PropTypes.object\n};\n\nIframe.defaultProps = {\n src: '',\n enableScrolling: false,\n modifier: '',\n width: '',\n height: '',\n parent: {}\n};\n\nexport default Iframe;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,aAAa,MAAM,sBAAsB;AAChD,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,SAASC,YAAY,EAAEC,aAAa,QAAQ,aAAa;AAEzD,MAAMC,kBAAkB,GAAG,sBAAsB;AAEjD,MAAMC,SAAS,GAAGC,GAAG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AACsB,YAAY,GAAG;EACpBrB,GAAG,EAAE,EAAE;EACPI,eAAe,EAAE,KAAK;EACtBH,QAAQ,EAAE,EAAE;EACZC,KAAK,EAAE,EAAE;EACTC,MAAM,EAAE,EAAE;EACVE,MAAM,EAAE,CAAC;AACX,CAAC;AAED,eAAeN,MAAM","ignoreList":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
const _excluded = ["type", "children", "settings", "modifier", "backgroundImage", "tagType", "dataNoSnippet", "sticky", "VariantComponent", "customHtmlProps"];
|
|
4
|
+
const _excluded = ["type", "children", "settings", "modifier", "backgroundImage", "backgroundImageUrl", "parent", "tagType", "dataNoSnippet", "sticky", "VariantComponent", "customHtmlProps"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import { useStringTemplate } from '@blaze-cms/utils-handlebars';
|
|
9
10
|
import Wrapper from '../Wrapper';
|
|
10
11
|
import { getClassModifiers } from '../../utils';
|
|
11
12
|
import { useGetImages } from '../../hooks';
|
|
@@ -19,6 +20,8 @@ const Layout = React.forwardRef((_ref, ref) => {
|
|
|
19
20
|
settings,
|
|
20
21
|
modifier,
|
|
21
22
|
backgroundImage,
|
|
23
|
+
backgroundImageUrl,
|
|
24
|
+
parent,
|
|
22
25
|
tagType,
|
|
23
26
|
dataNoSnippet,
|
|
24
27
|
sticky,
|
|
@@ -26,15 +29,19 @@ const Layout = React.forwardRef((_ref, ref) => {
|
|
|
26
29
|
customHtmlProps = []
|
|
27
30
|
} = _ref,
|
|
28
31
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
const {
|
|
33
|
+
data: [resolvedBackgroundImageUrl]
|
|
34
|
+
} = useStringTemplate(parent, [backgroundImageUrl || '']);
|
|
29
35
|
const {
|
|
30
36
|
data: {
|
|
31
37
|
getFile: {
|
|
32
38
|
url = null
|
|
33
39
|
} = {}
|
|
34
40
|
}
|
|
35
|
-
} = useGetImages(backgroundImage);
|
|
41
|
+
} = useGetImages(backgroundImage, false, !!resolvedBackgroundImageUrl);
|
|
42
|
+
const backgroundUrl = resolvedBackgroundImageUrl || url;
|
|
36
43
|
const style = getStylesToUpdate({
|
|
37
|
-
backgroundImage:
|
|
44
|
+
backgroundImage: backgroundUrl
|
|
38
45
|
});
|
|
39
46
|
const {
|
|
40
47
|
title
|
|
@@ -69,6 +76,8 @@ Layout.propTypes = {
|
|
|
69
76
|
}),
|
|
70
77
|
modifier: PropTypes.string,
|
|
71
78
|
backgroundImage: PropTypes.string,
|
|
79
|
+
backgroundImageUrl: PropTypes.string,
|
|
80
|
+
parent: PropTypes.object,
|
|
72
81
|
tagType: PropTypes.string,
|
|
73
82
|
dataNoSnippet: PropTypes.bool,
|
|
74
83
|
VariantComponent: PropTypes.func,
|
|
@@ -83,6 +92,8 @@ Layout.defaultProps = {
|
|
|
83
92
|
title: ''
|
|
84
93
|
},
|
|
85
94
|
backgroundImage: '',
|
|
95
|
+
backgroundImageUrl: '',
|
|
96
|
+
parent: {},
|
|
86
97
|
modifier: '',
|
|
87
98
|
tagType: '',
|
|
88
99
|
dataNoSnippet: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.js","names":["React","PropTypes","Wrapper","getClassModifiers","useGetImages","getStylesToUpdate","checkIfRowHasColumns","renderChildren","hasChildren","getCustomHtmlProperties","COLUMN","Layout","forwardRef","_ref","ref","type","children","settings","modifier","backgroundImage","tagType","dataNoSnippet","sticky","VariantComponent","customHtmlProps","otherProps","_objectWithoutProperties","_excluded","data","getFile","url","style","title","classModifiers","_objectSpread","additionalRowModifier","otherWrapperProps","customHtmlProperties","WrapperComponent","createElement","_extends","className","modifiers","propTypes","string","isRequired","bool","shape","func","arrayOf","name","value","oneOfType","node","defaultProps"],"sources":["../../../src/components/Layout/Layout.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Wrapper from '../Wrapper';\nimport { getClassModifiers } from '../../utils';\nimport { useGetImages } from '../../hooks';\nimport { getStylesToUpdate, checkIfRowHasColumns } from './helpers';\nimport { renderChildren, hasChildren, getCustomHtmlProperties } from '../../helpers';\nimport { COLUMN } from '../../constants';\n\nconst Layout = React.forwardRef(\n (\n {\n type,\n children,\n settings,\n modifier,\n backgroundImage,\n tagType,\n dataNoSnippet,\n sticky,\n VariantComponent,\n customHtmlProps = [],\n ...otherProps\n },\n ref\n ) => {\n const {\n data: { getFile: { url = null } = {} }\n } = useGetImages(backgroundImage);\n const style = getStylesToUpdate({ backgroundImage:
|
|
1
|
+
{"version":3,"file":"Layout.js","names":["React","PropTypes","useStringTemplate","Wrapper","getClassModifiers","useGetImages","getStylesToUpdate","checkIfRowHasColumns","renderChildren","hasChildren","getCustomHtmlProperties","COLUMN","Layout","forwardRef","_ref","ref","type","children","settings","modifier","backgroundImage","backgroundImageUrl","parent","tagType","dataNoSnippet","sticky","VariantComponent","customHtmlProps","otherProps","_objectWithoutProperties","_excluded","data","resolvedBackgroundImageUrl","getFile","url","backgroundUrl","style","title","classModifiers","_objectSpread","additionalRowModifier","otherWrapperProps","customHtmlProperties","WrapperComponent","createElement","_extends","className","modifiers","propTypes","string","isRequired","bool","shape","object","func","arrayOf","name","value","oneOfType","node","defaultProps"],"sources":["../../../src/components/Layout/Layout.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport Wrapper from '../Wrapper';\nimport { getClassModifiers } from '../../utils';\nimport { useGetImages } from '../../hooks';\nimport { getStylesToUpdate, checkIfRowHasColumns } from './helpers';\nimport { renderChildren, hasChildren, getCustomHtmlProperties } from '../../helpers';\nimport { COLUMN } from '../../constants';\n\nconst Layout = React.forwardRef(\n (\n {\n type,\n children,\n settings,\n modifier,\n backgroundImage,\n backgroundImageUrl,\n parent,\n tagType,\n dataNoSnippet,\n sticky,\n VariantComponent,\n customHtmlProps = [],\n ...otherProps\n },\n ref\n ) => {\n const {\n data: [resolvedBackgroundImageUrl]\n } = useStringTemplate(parent, [backgroundImageUrl || '']);\n const {\n data: { getFile: { url = null } = {} }\n } = useGetImages(backgroundImage, false, !!resolvedBackgroundImageUrl);\n const backgroundUrl = resolvedBackgroundImageUrl || url;\n const style = getStylesToUpdate({ backgroundImage: backgroundUrl });\n const { title } = settings;\n const classModifiers = getClassModifiers(type, { modifier, sticky, ...otherProps });\n const additionalRowModifier = checkIfRowHasColumns(type, children) ? ' display-row' : '';\n\n if (type === COLUMN && !hasChildren(children)) return null;\n\n const otherWrapperProps = {};\n if (dataNoSnippet) otherWrapperProps['data-nosnippet'] = true;\n\n const customHtmlProperties = getCustomHtmlProperties({ customHtmlProps });\n\n const WrapperComponent = VariantComponent || Wrapper;\n\n return (\n <WrapperComponent\n ref={ref}\n tagType={tagType}\n className={type}\n modifiers={`${classModifiers}${additionalRowModifier}`}\n style={style}\n {...otherWrapperProps}\n {...customHtmlProperties}>\n {title && <h2 className=\"heading heading--section\">{title}</h2>}\n {renderChildren(children, otherProps)}\n </WrapperComponent>\n );\n }\n);\n\nLayout.propTypes = {\n type: PropTypes.string.isRequired,\n sticky: PropTypes.bool,\n settings: PropTypes.shape({\n title: PropTypes.string\n }),\n modifier: PropTypes.string,\n backgroundImage: PropTypes.string,\n backgroundImageUrl: PropTypes.string,\n parent: PropTypes.object,\n tagType: PropTypes.string,\n dataNoSnippet: PropTypes.bool,\n VariantComponent: PropTypes.func,\n customHtmlProps: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string,\n value: PropTypes.string\n })\n ),\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired\n};\n\nLayout.defaultProps = {\n settings: {\n title: ''\n },\n backgroundImage: '',\n backgroundImageUrl: '',\n parent: {},\n modifier: '',\n tagType: '',\n dataNoSnippet: false,\n sticky: false,\n VariantComponent: null,\n customHtmlProps: []\n};\n\nexport default Layout;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,YAAY,QAAQ,aAAa;AAC1C,SAASC,iBAAiB,EAAEC,oBAAoB,QAAQ,WAAW;AACnE,SAASC,cAAc,EAAEC,WAAW,EAAEC,uBAAuB,QAAQ,eAAe;AACpF,SAASC,MAAM,QAAQ,iBAAiB;AAExC,MAAMC,MAAM,GAAGZ,KAAK,CAACa,UAAU,CAC7B,CAAAC,IAAA,EAgBEC,GAAG,KACA;EAAA,IAhBH;MACEC,IAAI;MACJC,QAAQ;MACRC,QAAQ;MACRC,QAAQ;MACRC,eAAe;MACfC,kBAAkB;MAClBC,MAAM;MACNC,OAAO;MACPC,aAAa;MACbC,MAAM;MACNC,gBAAgB;MAChBC,eAAe,GAAG;IAEpB,CAAC,GAAAb,IAAA;IADIc,UAAU,GAAAC,wBAAA,CAAAf,IAAA,EAAAgB,SAAA;EAIf,MAAM;IACJC,IAA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AC;EACVH,QAAQ,EAAE,EAAE;EACZI,OAAO,EAAE,EAAE;EACXC,aAAa,EAAE,KAAK;EACpBC,MAAM,EAAE,KAAK;EACbC,gBAAgB,EAAE,IAAI;EACtBC,eAAe,EAAE;AACnB,CAAC;AAED,eAAef,MAAM","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ import BlazeLink from '../BlazeLink';
|
|
|
10
10
|
const Menu = ({
|
|
11
11
|
children,
|
|
12
12
|
collapse,
|
|
13
|
+
openActiveSubmenus,
|
|
13
14
|
modifier,
|
|
14
15
|
mobileMenuModifier,
|
|
15
16
|
mobileMenuChildrenModifier,
|
|
@@ -45,7 +46,8 @@ const Menu = ({
|
|
|
45
46
|
});
|
|
46
47
|
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
47
48
|
value: {
|
|
48
|
-
showMobileMenu
|
|
49
|
+
showMobileMenu,
|
|
50
|
+
openActiveSubmenus
|
|
49
51
|
}
|
|
50
52
|
}, /*#__PURE__*/React.createElement("div", {
|
|
51
53
|
className: menuWrapperClasses
|
|
@@ -83,6 +85,7 @@ const Menu = ({
|
|
|
83
85
|
};
|
|
84
86
|
Menu.propTypes = {
|
|
85
87
|
collapse: PropTypes.bool.isRequired,
|
|
88
|
+
openActiveSubmenus: PropTypes.bool.isRequired,
|
|
86
89
|
logoOnMobile: PropTypes.bool.isRequired,
|
|
87
90
|
logoOnDesktop: PropTypes.bool,
|
|
88
91
|
logoOnMobileUrl: PropTypes.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","names":["React","useState","useEffect","PropTypes","BlazeButton","classnames","useRouter","MdMenu","MdClose","Link","MenuContext","BlazeLink","Menu","children","collapse","modifier","mobileMenuModifier","mobileMenuChildrenModifier","mobileIconAlignment","mobileButtonModifier","hamburgerIconModifier","logoOnMobile","logoOnDesktop","logoOnMobileUrl","logoOnMobileAlt","logoOnMobileModifier","logoOnDesktopModifier","closeIconModifier","router","showMobileMenu","setShowMobileMenu","handleRouteChange","events","on","off","shouldDisplayChildren","childModifiers","isMobileMenuExpanded","menuWrapperClasses","createElement","Provider","value","className","onClick","label","href","name","src","alt","propTypes","bool","isRequired","string","oneOfType","arrayOf","node","defaultProps"],"sources":["../../../src/components/Menu/Menu.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport BlazeButton from '@blaze-react/button';\nimport classnames from 'classnames';\nimport { useRouter } from 'next/router';\nimport { MdMenu, MdClose } from 'react-icons/md';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport MenuContext from './MenuContext';\nimport BlazeLink from '../BlazeLink';\n\nconst Menu = ({\n children,\n collapse,\n modifier,\n mobileMenuModifier,\n mobileMenuChildrenModifier,\n mobileIconAlignment,\n mobileButtonModifier,\n hamburgerIconModifier,\n logoOnMobile,\n logoOnDesktop,\n logoOnMobileUrl,\n logoOnMobileAlt,\n logoOnMobileModifier,\n logoOnDesktopModifier,\n closeIconModifier\n}) => {\n const router = useRouter();\n const [showMobileMenu, setShowMobileMenu] = useState(false);\n\n useEffect(() => {\n const handleRouteChange = () => setShowMobileMenu(false);\n router.events.on('routeChangeStart', handleRouteChange);\n\n return () => {\n router.events.off('routeChangeStart', handleRouteChange);\n };\n }, [router.events]);\n\n const shouldDisplayChildren = collapse ? showMobileMenu : true;\n\n const childModifiers = classnames({\n [mobileMenuChildrenModifier]: shouldDisplayChildren,\n [modifier]: !showMobileMenu\n });\n\n const isMobileMenuExpanded = showMobileMenu ? `${mobileMenuModifier}` : '';\n const menuWrapperClasses = classnames('menu--wrapper', {\n 'menu--wrapper--mobile-open': showMobileMenu,\n 'menu--wrapper--mobile-closed': collapse && !showMobileMenu\n });\n\n return (\n <MenuContext.Provider value={{ showMobileMenu }}>\n <div className={menuWrapperClasses}>\n {collapse && (\n <div className=\"menu--mobile-wrapper\">\n <div\n className={`flex w-screen z-50 justify-${mobileIconAlignment} ${isMobileMenuExpanded}`}>\n <BlazeButton\n className={`menu--mobile-button ${mobileButtonModifier}`}\n onClick={() => setShowMobileMenu(!showMobileMenu)}\n label={showMobileMenu ? 'Close mobile menu' : 'Open mobile menu'}>\n <i>\n {showMobileMenu ? (\n <MdClose className={closeIconModifier} />\n ) : (\n <MdMenu className={hamburgerIconModifier} />\n )}\n </i>\n </BlazeButton>\n </div>\n </div>\n )}\n {logoOnMobile && !showMobileMenu && (\n <Link href=\"/\" name=\"mobile menu\">\n <img src={logoOnMobileUrl} alt={logoOnMobileAlt} className={logoOnMobileModifier} />\n </Link>\n )}\n\n <div className=\"menu--desktop-wrapper\">\n <ul className={childModifiers}>\n {logoOnDesktop && (\n <BlazeLink href=\"/\" className=\"\">\n <img\n src={logoOnMobileUrl}\n alt={logoOnMobileAlt}\n className={logoOnDesktopModifier}\n />\n </BlazeLink>\n )}\n {children}\n </ul>\n </div>\n </div>\n </MenuContext.Provider>\n );\n};\n\nMenu.propTypes = {\n collapse: PropTypes.bool.isRequired,\n logoOnMobile: PropTypes.bool.isRequired,\n logoOnDesktop: PropTypes.bool,\n logoOnMobileUrl: PropTypes.string,\n logoOnMobileAlt: PropTypes.string,\n logoOnMobileModifier: PropTypes.string,\n logoOnDesktopModifier: PropTypes.string,\n hamburgerIconModifier: PropTypes.string,\n closeIconModifier: PropTypes.string,\n mobileButtonModifier: PropTypes.string,\n mobileMenuModifier: PropTypes.string,\n mobileMenuChildrenModifier: PropTypes.string,\n modifier: PropTypes.string,\n mobileIconAlignment: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nMenu.defaultProps = {\n logoOnDesktop: false,\n logoOnMobileUrl: '',\n logoOnMobileAlt: '',\n logoOnMobileModifier: '',\n logoOnDesktopModifier: '',\n hamburgerIconModifier: '',\n closeIconModifier: '',\n mobileButtonModifier: '',\n mobileIconAlignment: '',\n mobileMenuModifier: '',\n mobileMenuChildrenModifier: '',\n modifier: '',\n children: []\n};\n\nexport default Menu;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,WAAW,MAAM,qBAAqB;AAC7C,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,MAAM,EAAEC,OAAO,QAAQ,gBAAgB;AAChD,SAASC,IAAI,QAAQ,8BAA8B;AACnD,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,SAAS,MAAM,cAAc;AAEpC,MAAMC,IAAI,GAAGA,CAAC;EACZC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,kBAAkB;EAClBC,0BAA0B;EAC1BC,mBAAmB;EACnBC,oBAAoB;EACpBC,qBAAqB;EACrBC,YAAY;EACZC,aAAa;EACbC,eAAe;EACfC,eAAe;EACfC,oBAAoB;EACpBC,qBAAqB;EACrBC;AACF,CAAC,KAAK;EACJ,MAAMC,MAAM,
|
|
1
|
+
{"version":3,"file":"Menu.js","names":["React","useState","useEffect","PropTypes","BlazeButton","classnames","useRouter","MdMenu","MdClose","Link","MenuContext","BlazeLink","Menu","children","collapse","openActiveSubmenus","modifier","mobileMenuModifier","mobileMenuChildrenModifier","mobileIconAlignment","mobileButtonModifier","hamburgerIconModifier","logoOnMobile","logoOnDesktop","logoOnMobileUrl","logoOnMobileAlt","logoOnMobileModifier","logoOnDesktopModifier","closeIconModifier","router","showMobileMenu","setShowMobileMenu","handleRouteChange","events","on","off","shouldDisplayChildren","childModifiers","isMobileMenuExpanded","menuWrapperClasses","createElement","Provider","value","className","onClick","label","href","name","src","alt","propTypes","bool","isRequired","string","oneOfType","arrayOf","node","defaultProps"],"sources":["../../../src/components/Menu/Menu.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport BlazeButton from '@blaze-react/button';\nimport classnames from 'classnames';\nimport { useRouter } from 'next/router';\nimport { MdMenu, MdClose } from 'react-icons/md';\nimport { Link } from '@blaze-cms/nextjs-components';\nimport MenuContext from './MenuContext';\nimport BlazeLink from '../BlazeLink';\n\nconst Menu = ({\n children,\n collapse,\n openActiveSubmenus,\n modifier,\n mobileMenuModifier,\n mobileMenuChildrenModifier,\n mobileIconAlignment,\n mobileButtonModifier,\n hamburgerIconModifier,\n logoOnMobile,\n logoOnDesktop,\n logoOnMobileUrl,\n logoOnMobileAlt,\n logoOnMobileModifier,\n logoOnDesktopModifier,\n closeIconModifier\n}) => {\n const router = useRouter();\n const [showMobileMenu, setShowMobileMenu] = useState(false);\n\n useEffect(() => {\n const handleRouteChange = () => setShowMobileMenu(false);\n router.events.on('routeChangeStart', handleRouteChange);\n\n return () => {\n router.events.off('routeChangeStart', handleRouteChange);\n };\n }, [router.events]);\n\n const shouldDisplayChildren = collapse ? showMobileMenu : true;\n\n const childModifiers = classnames({\n [mobileMenuChildrenModifier]: shouldDisplayChildren,\n [modifier]: !showMobileMenu\n });\n\n const isMobileMenuExpanded = showMobileMenu ? `${mobileMenuModifier}` : '';\n const menuWrapperClasses = classnames('menu--wrapper', {\n 'menu--wrapper--mobile-open': showMobileMenu,\n 'menu--wrapper--mobile-closed': collapse && !showMobileMenu\n });\n\n return (\n <MenuContext.Provider value={{ showMobileMenu, openActiveSubmenus }}>\n <div className={menuWrapperClasses}>\n {collapse && (\n <div className=\"menu--mobile-wrapper\">\n <div\n className={`flex w-screen z-50 justify-${mobileIconAlignment} ${isMobileMenuExpanded}`}>\n <BlazeButton\n className={`menu--mobile-button ${mobileButtonModifier}`}\n onClick={() => setShowMobileMenu(!showMobileMenu)}\n label={showMobileMenu ? 'Close mobile menu' : 'Open mobile menu'}>\n <i>\n {showMobileMenu ? (\n <MdClose className={closeIconModifier} />\n ) : (\n <MdMenu className={hamburgerIconModifier} />\n )}\n </i>\n </BlazeButton>\n </div>\n </div>\n )}\n {logoOnMobile && !showMobileMenu && (\n <Link href=\"/\" name=\"mobile menu\">\n <img src={logoOnMobileUrl} alt={logoOnMobileAlt} className={logoOnMobileModifier} />\n </Link>\n )}\n\n <div className=\"menu--desktop-wrapper\">\n <ul className={childModifiers}>\n {logoOnDesktop && (\n <BlazeLink href=\"/\" className=\"\">\n <img\n src={logoOnMobileUrl}\n alt={logoOnMobileAlt}\n className={logoOnDesktopModifier}\n />\n </BlazeLink>\n )}\n {children}\n </ul>\n </div>\n </div>\n </MenuContext.Provider>\n );\n};\n\nMenu.propTypes = {\n collapse: PropTypes.bool.isRequired,\n openActiveSubmenus: PropTypes.bool.isRequired,\n logoOnMobile: PropTypes.bool.isRequired,\n logoOnDesktop: PropTypes.bool,\n logoOnMobileUrl: PropTypes.string,\n logoOnMobileAlt: PropTypes.string,\n logoOnMobileModifier: PropTypes.string,\n logoOnDesktopModifier: PropTypes.string,\n hamburgerIconModifier: PropTypes.string,\n closeIconModifier: PropTypes.string,\n mobileButtonModifier: PropTypes.string,\n mobileMenuModifier: PropTypes.string,\n mobileMenuChildrenModifier: PropTypes.string,\n modifier: PropTypes.string,\n mobileIconAlignment: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nMenu.defaultProps = {\n logoOnDesktop: false,\n logoOnMobileUrl: '',\n logoOnMobileAlt: '',\n logoOnMobileModifier: '',\n logoOnDesktopModifier: '',\n hamburgerIconModifier: '',\n closeIconModifier: '',\n mobileButtonModifier: '',\n mobileIconAlignment: '',\n mobileMenuModifier: '',\n mobileMenuChildrenModifier: '',\n modifier: '',\n children: []\n};\n\nexport default Menu;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,WAAW,MAAM,qBAAqB;AAC7C,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,MAAM,EAAEC,OAAO,QAAQ,gBAAgB;AAChD,SAASC,IAAI,QAAQ,8BAA8B;AACnD,OAAOC,WAAW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iB,EAAE,EAAE;EACrBR,oBAAoB,EAAE,EAAE;EACxBD,mBAAmB,EAAE,EAAE;EACvBF,kBAAkB,EAAE,EAAE;EACtBC,0BAA0B,EAAE,EAAE;EAC9BF,QAAQ,EAAE,EAAE;EACZH,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeD,IAAI","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuContext.js","names":["React","MenuContext","createContext","showMobileMenu"],"sources":["../../../src/components/Menu/MenuContext.js"],"sourcesContent":["import React from 'react';\n\nconst MenuContext = React.createContext({ showMobileMenu: false });\n\nexport default MenuContext;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,WAAW,GAAGD,KAAK,CAACE,aAAa,CAAC;EAAEC,cAAc,EAAE;AAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"MenuContext.js","names":["React","MenuContext","createContext","showMobileMenu","openActiveSubmenus"],"sources":["../../../src/components/Menu/MenuContext.js"],"sourcesContent":["import React from 'react';\n\nconst MenuContext = React.createContext({ showMobileMenu: false, openActiveSubmenus: false });\n\nexport default MenuContext;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,WAAW,GAAGD,KAAK,CAACE,aAAa,CAAC;EAAEC,cAAc,EAAE,KAAK;EAAEC,kBAAkB,EAAE;AAAM,CAAC,CAAC;AAE7F,eAAeH,WAAW","ignoreList":[]}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
1
2
|
import React, { useState, useContext, useEffect } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { FaChevronDown, FaChevronUp } from 'react-icons/fa';
|
|
5
|
+
import classnames from 'classnames';
|
|
4
6
|
import { useRouter } from 'next/router';
|
|
5
7
|
import { useStringTemplate } from '@blaze-cms/utils-handlebars';
|
|
6
|
-
import { HOVER, MOUSE_ENTER, MOUSE_LEAVE, HIDDEN } from '../../constants';
|
|
8
|
+
import { HOVER, MOUSE_ENTER, MOUSE_LEAVE, HIDDEN, CLICK } from '../../constants';
|
|
7
9
|
import { hasChildren } from '../../helpers';
|
|
8
10
|
import BlazeLink from '../BlazeLink';
|
|
9
11
|
import MenuContext from '../Menu/MenuContext';
|
|
10
|
-
import { injectHelperIntoTemplate } from './helpers';
|
|
12
|
+
import { injectHelperIntoTemplate, isUrlPathMatch, hasActiveChild } from './helpers';
|
|
11
13
|
const MenuItemRender = ({
|
|
12
14
|
children,
|
|
13
15
|
eventType,
|
|
@@ -16,10 +18,13 @@ const MenuItemRender = ({
|
|
|
16
18
|
url,
|
|
17
19
|
parent
|
|
18
20
|
}) => {
|
|
19
|
-
const
|
|
21
|
+
const router = useRouter();
|
|
20
22
|
const {
|
|
21
|
-
showMobileMenu
|
|
23
|
+
showMobileMenu,
|
|
24
|
+
openActiveSubmenus
|
|
22
25
|
} = useContext(MenuContext);
|
|
26
|
+
const isHoverEvent = eventType === HOVER;
|
|
27
|
+
const isClickEvent = eventType === CLICK;
|
|
23
28
|
const {
|
|
24
29
|
loading: loadingText,
|
|
25
30
|
data: [textToUse]
|
|
@@ -28,19 +33,21 @@ const MenuItemRender = ({
|
|
|
28
33
|
loading: loadingUrl,
|
|
29
34
|
data: [urlToUse]
|
|
30
35
|
} = useStringTemplate(parent, [injectHelperIntoTemplate(url, 'url_encode')]);
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
36
|
+
const isActive = router ? isUrlPathMatch(router.asPath, urlToUse) : false;
|
|
37
|
+
const isActiveParent = router ? hasActiveChild(router.asPath, children) : false;
|
|
38
|
+
const shouldPreOpen = openActiveSubmenus && isActiveParent && isClickEvent;
|
|
34
39
|
const hasValidChildren = hasChildren(children);
|
|
40
|
+
const [displayChildren, setDisplayChildren] = useState(shouldPreOpen);
|
|
35
41
|
useEffect(() => {
|
|
36
|
-
if (!showMobileMenu) setDisplayChildren(false);
|
|
37
|
-
}, [showMobileMenu]);
|
|
42
|
+
if (!showMobileMenu && !shouldPreOpen) setDisplayChildren(false);
|
|
43
|
+
}, [children, isClickEvent, loadingUrl, openActiveSubmenus, router, shouldPreOpen, showMobileMenu]);
|
|
38
44
|
useEffect(() => {
|
|
39
45
|
if (isHoverEvent) {
|
|
40
46
|
setDisplayChildren(false);
|
|
41
47
|
}
|
|
42
48
|
}, [router.asPath, isHoverEvent]);
|
|
43
49
|
if (loadingUrl || loadingText) return '';
|
|
50
|
+
const childrenDisplayClass = displayChildren ? '' : HIDDEN;
|
|
44
51
|
const handleItemEvent = ({
|
|
45
52
|
type
|
|
46
53
|
}) => {
|
|
@@ -58,18 +65,25 @@ const MenuItemRender = ({
|
|
|
58
65
|
setDisplayChildren(!displayChildren);
|
|
59
66
|
}
|
|
60
67
|
};
|
|
68
|
+
const menuItemLinkClassname = classnames('menu--item--link', {
|
|
69
|
+
'menu--item--link--active': isActive,
|
|
70
|
+
'menu--item--link--active-parent': isActiveParent
|
|
71
|
+
});
|
|
61
72
|
return /*#__PURE__*/React.createElement("li", {
|
|
62
73
|
className: modifier,
|
|
63
74
|
onMouseEnter: handleItemEvent,
|
|
64
75
|
onMouseLeave: handleItemEvent
|
|
65
76
|
}, /*#__PURE__*/React.createElement("div", {
|
|
66
|
-
className:
|
|
77
|
+
className: menuItemLinkClassname,
|
|
67
78
|
onClick: handleMobileClick,
|
|
68
79
|
role: !urlToUse && hasValidChildren ? 'button' : undefined,
|
|
69
80
|
tabIndex: !urlToUse && hasValidChildren ? 0 : undefined
|
|
70
81
|
}, urlToUse ? /*#__PURE__*/React.createElement(BlazeLink, {
|
|
71
82
|
href: urlToUse
|
|
72
|
-
}, textToUse) : /*#__PURE__*/React.createElement("span",
|
|
83
|
+
}, textToUse) : /*#__PURE__*/React.createElement("span", {
|
|
84
|
+
role: "button",
|
|
85
|
+
onClick: handleItemEvent
|
|
86
|
+
}, textToUse), hasValidChildren && /*#__PURE__*/React.createElement("i", {
|
|
73
87
|
role: "button",
|
|
74
88
|
className: "menu--item--link--icon",
|
|
75
89
|
onClick: e => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItemRender.js","names":["React","useState","useContext","useEffect","PropTypes","FaChevronDown","FaChevronUp","useRouter","useStringTemplate","HOVER","MOUSE_ENTER","MOUSE_LEAVE","HIDDEN","hasChildren","BlazeLink","MenuContext","injectHelperIntoTemplate","MenuItemRender","children","eventType","text","modifier","url","parent","
|
|
1
|
+
{"version":3,"file":"MenuItemRender.js","names":["React","useState","useContext","useEffect","PropTypes","FaChevronDown","FaChevronUp","classnames","useRouter","useStringTemplate","HOVER","MOUSE_ENTER","MOUSE_LEAVE","HIDDEN","CLICK","hasChildren","BlazeLink","MenuContext","injectHelperIntoTemplate","isUrlPathMatch","hasActiveChild","MenuItemRender","children","eventType","text","modifier","url","parent","router","showMobileMenu","openActiveSubmenus","isHoverEvent","isClickEvent","loading","loadingText","data","textToUse","loadingUrl","urlToUse","isActive","asPath","isActiveParent","shouldPreOpen","hasValidChildren","displayChildren","setDisplayChildren","childrenDisplayClass","handleItemEvent","type","handleMobileClick","menuItemLinkClassname","createElement","className","onMouseEnter","onMouseLeave","onClick","role","undefined","tabIndex","href","e","stopPropagation","propTypes","string","isRequired","object","oneOfType","arrayOf","node","defaultProps"],"sources":["../../../src/components/MenuItem/MenuItemRender.js"],"sourcesContent":["/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport React, { useState, useContext, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { FaChevronDown, FaChevronUp } from 'react-icons/fa';\nimport classnames from 'classnames';\nimport { useRouter } from 'next/router';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport { HOVER, MOUSE_ENTER, MOUSE_LEAVE, HIDDEN, CLICK } from '../../constants';\nimport { hasChildren } from '../../helpers';\nimport BlazeLink from '../BlazeLink';\nimport MenuContext from '../Menu/MenuContext';\nimport { injectHelperIntoTemplate, isUrlPathMatch, hasActiveChild } from './helpers';\n\nconst MenuItemRender = ({ children, eventType, text, modifier, url, parent }) => {\n const router = useRouter();\n const { showMobileMenu, openActiveSubmenus } = useContext(MenuContext);\n\n const isHoverEvent = eventType === HOVER;\n const isClickEvent = eventType === CLICK;\n\n const {\n loading: loadingText,\n data: [textToUse]\n } = useStringTemplate(parent, [text]);\n const {\n loading: loadingUrl,\n data: [urlToUse]\n } = useStringTemplate(parent, [injectHelperIntoTemplate(url, 'url_encode')]);\n\n const isActive = router ? isUrlPathMatch(router.asPath, urlToUse) : false;\n const isActiveParent = router ? hasActiveChild(router.asPath, children) : false;\n const shouldPreOpen = openActiveSubmenus && isActiveParent && isClickEvent;\n const hasValidChildren = hasChildren(children);\n\n const [displayChildren, setDisplayChildren] = useState(shouldPreOpen);\n\n useEffect(() => {\n if (!showMobileMenu && !shouldPreOpen) setDisplayChildren(false);\n }, [\n children,\n isClickEvent,\n loadingUrl,\n openActiveSubmenus,\n router,\n shouldPreOpen,\n showMobileMenu\n ]);\n\n useEffect(() => {\n if (isHoverEvent) {\n setDisplayChildren(false);\n }\n }, [router.asPath, isHoverEvent]);\n\n if (loadingUrl || loadingText) return '';\n\n const childrenDisplayClass = displayChildren ? '' : HIDDEN;\n\n const handleItemEvent = ({ type }) => {\n if (isHoverEvent) {\n if (type === MOUSE_ENTER) {\n setDisplayChildren(true);\n }\n if (type === MOUSE_LEAVE) {\n setDisplayChildren(false);\n }\n }\n };\n\n const handleMobileClick = () => {\n if (!urlToUse && hasValidChildren) {\n setDisplayChildren(!displayChildren);\n }\n };\n\n const menuItemLinkClassname = classnames('menu--item--link', {\n 'menu--item--link--active': isActive,\n 'menu--item--link--active-parent': isActiveParent\n });\n\n return (\n <li className={modifier} onMouseEnter={handleItemEvent} onMouseLeave={handleItemEvent}>\n <div\n className={menuItemLinkClassname}\n onClick={handleMobileClick}\n role={!urlToUse && hasValidChildren ? 'button' : undefined}\n tabIndex={!urlToUse && hasValidChildren ? 0 : undefined}>\n {urlToUse ? (\n <BlazeLink href={urlToUse}>{textToUse}</BlazeLink>\n ) : (\n <span role=\"button\" onClick={handleItemEvent}>\n {textToUse}\n </span>\n )}\n {hasValidChildren && (\n <i\n role=\"button\"\n className=\"menu--item--link--icon\"\n onClick={e => {\n e.stopPropagation();\n setDisplayChildren(!displayChildren);\n }}\n tabIndex={0}>\n {displayChildren ? <FaChevronUp /> : <FaChevronDown />}\n </i>\n )}\n </div>\n\n {hasValidChildren && (\n <div className={`menu--item-children ${childrenDisplayClass}`}>{children}</div>\n )}\n </li>\n );\n};\n\nMenuItemRender.propTypes = {\n modifier: PropTypes.string,\n text: PropTypes.string,\n url: PropTypes.string,\n eventType: PropTypes.string.isRequired,\n parent: PropTypes.object,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nMenuItemRender.defaultProps = {\n url: '',\n modifier: '',\n text: '',\n children: null,\n parent: {}\n};\n\nexport default MenuItemRender;\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC9D,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,aAAa,EAAEC,WAAW,QAAQ,gBAAgB;AAC3D,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,SAASC,KAAK,EAAEC,WAAW,EAAEC,WAAW,EAAEC,MAAM,EAAEC,KAAK,QAAQ,iBAAiB;AAChF,SAASC,WAAW,QAAQ,eAAe;AAC3C,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,WAAW,MAAM,qBAAqB;AAC7C,SAASC,wBAAwB,EAAEC,cAAc,EAAEC,cAAc,QAAQ,WAAW;AAEpF,MAAMC,cAAc,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,SAAS;EAAEC,IAAI;EAAEC,QAAQ;EAAEC,GAAG;EAAEC;AAAO,CAAC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5 @@
|
|
|
1
|
+
import isUrlPathMatch from './isUrlPathMatch';
|
|
2
|
+
import { hasChildren } from '../../../helpers';
|
|
3
|
+
const hasActiveChild = (path, children) => hasChildren(children) && children.props.children[1][0].props.component.items.find(menuItem => isUrlPathMatch(path, menuItem.settings.url));
|
|
4
|
+
export default hasActiveChild;
|
|
5
|
+
//# sourceMappingURL=has-active-child.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-active-child.js","names":["isUrlPathMatch","hasChildren","hasActiveChild","path","children","props","component","items","find","menuItem","settings","url"],"sources":["../../../../src/components/MenuItem/helpers/has-active-child.js"],"sourcesContent":["import isUrlPathMatch from './isUrlPathMatch';\nimport { hasChildren } from '../../../helpers';\n\nconst hasActiveChild = (path, children) =>\n hasChildren(children) &&\n children.props.children[1][0].props.component.items.find(menuItem =>\n isUrlPathMatch(path, menuItem.settings.url)\n );\n\nexport default hasActiveChild;\n"],"mappings":"AAAA,OAAOA,cAAc,MAAM,kBAAkB;AAC7C,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,MAAMC,cAAc,GAAGA,CAACC,IAAI,EAAEC,QAAQ,KACpCH,WAAW,CAACG,QAAQ,CAAC,IACrBA,QAAQ,CAACC,KAAK,CAACD,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAACC,KAAK,CAACC,SAAS,CAACC,KAAK,CAACC,IAAI,CAACC,QAAQ,IAC/DT,cAAc,CAACG,IAAI,EAAEM,QAAQ,CAACC,QAAQ,CAACC,GAAG,CAC5C,CAAC;AAEH,eAAeT,cAAc","ignoreList":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import injectHelperIntoTemplate from './inject-helper-into-template';
|
|
2
|
-
|
|
2
|
+
import isUrlPathMatch from './isUrlPathMatch';
|
|
3
|
+
import hasActiveChild from './has-active-child';
|
|
4
|
+
export { injectHelperIntoTemplate, isUrlPathMatch, hasActiveChild };
|
|
3
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["injectHelperIntoTemplate"],"sources":["../../../../src/components/MenuItem/helpers/index.js"],"sourcesContent":["import injectHelperIntoTemplate from './inject-helper-into-template';\n\nexport { injectHelperIntoTemplate };\n"],"mappings":"AAAA,OAAOA,wBAAwB,MAAM,+BAA+B;
|
|
1
|
+
{"version":3,"file":"index.js","names":["injectHelperIntoTemplate","isUrlPathMatch","hasActiveChild"],"sources":["../../../../src/components/MenuItem/helpers/index.js"],"sourcesContent":["import injectHelperIntoTemplate from './inject-helper-into-template';\nimport isUrlPathMatch from './isUrlPathMatch';\nimport hasActiveChild from './has-active-child';\n\nexport { injectHelperIntoTemplate, isUrlPathMatch, hasActiveChild };\n"],"mappings":"AAAA,OAAOA,wBAAwB,MAAM,+BAA+B;AACpE,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,cAAc,MAAM,oBAAoB;AAE/C,SAASF,wBAAwB,EAAEC,cAAc,EAAEC,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const isUrlPathMatch = (path, itemUrl) => {
|
|
2
|
+
if (!itemUrl || !path) return false;
|
|
3
|
+
const reg = new RegExp(/^[^#?]+/);
|
|
4
|
+
const _path = reg.exec(path)[0];
|
|
5
|
+
return _path === itemUrl || _path === `/${itemUrl}`;
|
|
6
|
+
};
|
|
7
|
+
export default isUrlPathMatch;
|
|
8
|
+
//# sourceMappingURL=isUrlPathMatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isUrlPathMatch.js","names":["isUrlPathMatch","path","itemUrl","reg","RegExp","_path","exec"],"sources":["../../../../src/components/MenuItem/helpers/isUrlPathMatch.js"],"sourcesContent":["const isUrlPathMatch = (path, itemUrl) => {\n if (!itemUrl || !path) return false;\n\n const reg = new RegExp(/^[^#?]+/);\n const _path = reg.exec(path)[0];\n\n return _path === itemUrl || _path === `/${itemUrl}`;\n};\n\nexport default isUrlPathMatch;\n"],"mappings":"AAAA,MAAMA,cAAc,GAAGA,CAACC,IAAI,EAAEC,OAAO,KAAK;EACxC,IAAI,CAACA,OAAO,IAAI,CAACD,IAAI,EAAE,OAAO,KAAK;EAEnC,MAAME,GAAG,GAAG,IAAIC,MAAM,CAAC,SAAS,CAAC;EACjC,MAAMC,KAAK,GAAGF,GAAG,CAACG,IAAI,CAACL,IAAI,CAAC,CAAC,CAAC,CAAC;EAE/B,OAAOI,KAAK,KAAKH,OAAO,IAAIG,KAAK,KAAK,IAAIH,OAAO,EAAE;AACrD,CAAC;AAED,eAAeF,cAAc","ignoreList":[]}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import cssesc from 'cssesc';
|
|
2
2
|
import { COMPONENT_ID_PREFIX } from '../constants';
|
|
3
|
-
const getComponentId = componentName
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const getComponentId = (componentName, noPrefix = false, toLowerCase = false) => {
|
|
4
|
+
let id = `${noPrefix ? '' : COMPONENT_ID_PREFIX}${componentName.replace(/\s+/g, '-')}`;
|
|
5
|
+
if (toLowerCase) {
|
|
6
|
+
id = id.toLowerCase();
|
|
7
|
+
}
|
|
8
|
+
return cssesc(id, {
|
|
9
|
+
isIdentifier: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
6
12
|
export default getComponentId;
|
|
7
13
|
//# sourceMappingURL=get-component-id.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-component-id.js","names":["cssesc","COMPONENT_ID_PREFIX","getComponentId","componentName","replace","isIdentifier"],"sources":["../../src/helpers/get-component-id.js"],"sourcesContent":["import cssesc from 'cssesc';\nimport { COMPONENT_ID_PREFIX } from '../constants';\n\nconst getComponentId = componentName
|
|
1
|
+
{"version":3,"file":"get-component-id.js","names":["cssesc","COMPONENT_ID_PREFIX","getComponentId","componentName","noPrefix","toLowerCase","id","replace","isIdentifier"],"sources":["../../src/helpers/get-component-id.js"],"sourcesContent":["import cssesc from 'cssesc';\nimport { COMPONENT_ID_PREFIX } from '../constants';\n\nconst getComponentId = (componentName, noPrefix = false, toLowerCase = false) => {\n let id = `${noPrefix ? '' : COMPONENT_ID_PREFIX}${componentName.replace(/\\s+/g, '-')}`;\n if (toLowerCase) {\n id = id.toLowerCase();\n }\n return cssesc(id, { isIdentifier: true });\n};\n\nexport default getComponentId;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,QAAQ;AAC3B,SAASC,mBAAmB,QAAQ,cAAc;AAElD,MAAMC,cAAc,GAAGA,CAACC,aAAa,EAAEC,QAAQ,GAAG,KAAK,EAAEC,WAAW,GAAG,KAAK,KAAK;EAC/E,IAAIC,EAAE,GAAG,GAAGF,QAAQ,GAAG,EAAE,GAAGH,mBAAmB,GAAGE,aAAa,CAACI,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;EACtF,IAAIF,WAAW,EAAE;IACfC,EAAE,GAAGA,EAAE,CAACD,WAAW,CAAC,CAAC;EACvB;EACA,OAAOL,MAAM,CAACM,EAAE,EAAE;IAAEE,YAAY,EAAE;EAAK,CAAC,CAAC;AAC3C,CAAC;AAED,eAAeN,cAAc","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.147.0-rc-eagle.
|
|
3
|
+
"version": "0.147.0-rc-eagle.6",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
},
|
|
33
33
|
"license": "GPL-3.0",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@blaze-cms/core-auth-ui": "0.147.0-rc-eagle.
|
|
36
|
-
"@blaze-cms/core-errors": "0.147.0-rc-eagle.
|
|
37
|
-
"@blaze-cms/core-errors-ui": "0.147.0-rc-eagle.
|
|
35
|
+
"@blaze-cms/core-auth-ui": "0.147.0-rc-eagle.4",
|
|
36
|
+
"@blaze-cms/core-errors": "0.147.0-rc-eagle.4",
|
|
37
|
+
"@blaze-cms/core-errors-ui": "0.147.0-rc-eagle.4",
|
|
38
38
|
"@blaze-cms/image-cdn-react": "0.3.0-alpha.7",
|
|
39
|
-
"@blaze-cms/nextjs-components": "0.147.0-rc-eagle.
|
|
40
|
-
"@blaze-cms/plugin-search-ui": "0.147.0-rc-eagle.
|
|
41
|
-
"@blaze-cms/setup-ui": "0.147.0-rc-eagle.
|
|
42
|
-
"@blaze-cms/utils": "0.147.0-rc-eagle.
|
|
43
|
-
"@blaze-cms/utils-handlebars": "0.147.0-rc-eagle.
|
|
39
|
+
"@blaze-cms/nextjs-components": "0.147.0-rc-eagle.6",
|
|
40
|
+
"@blaze-cms/plugin-search-ui": "0.147.0-rc-eagle.6",
|
|
41
|
+
"@blaze-cms/setup-ui": "0.147.0-rc-eagle.4",
|
|
42
|
+
"@blaze-cms/utils": "0.147.0-rc-eagle.4",
|
|
43
|
+
"@blaze-cms/utils-handlebars": "0.147.0-rc-eagle.6",
|
|
44
44
|
"@blaze-react/badge": "^0.7.0",
|
|
45
45
|
"@blaze-react/breadcrumb": "0.8.0-alpha.60",
|
|
46
46
|
"@blaze-react/button": "0.8.0-alpha.82",
|
|
@@ -70,7 +70,6 @@
|
|
|
70
70
|
"react-jw-player": "^1.19.1",
|
|
71
71
|
"react-player": "^2.10.1",
|
|
72
72
|
"react-waypoint": "^9.0.2",
|
|
73
|
-
"regenerator-runtime": "^0.13.3",
|
|
74
73
|
"uuid": "^3.3.3",
|
|
75
74
|
"video-react": "0.14.1"
|
|
76
75
|
},
|
|
@@ -90,5 +89,5 @@
|
|
|
90
89
|
"lib/*",
|
|
91
90
|
"lib-es/*"
|
|
92
91
|
],
|
|
93
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "bcec507f4cd89a2573e960c326852e44b103feb0"
|
|
94
93
|
}
|