@blaze-cms/react-page-builder 0.126.0-alpha.0 → 0.126.0-alpha.5
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/ContentGroup/ContentGroup.js +13 -4
- package/lib/components/ContentGroup/ContentGroup.js.map +1 -1
- package/lib/components/ContentGroup/ContentGroupTabs.js +43 -31
- package/lib/components/ContentGroup/ContentGroupTabs.js.map +1 -1
- package/lib/components/ContentGroup/constants.js +18 -0
- package/lib/components/ContentGroup/constants.js.map +1 -0
- package/lib/components/ContentGroup/helpers/get-active-tab.js +23 -0
- package/lib/components/ContentGroup/helpers/get-active-tab.js.map +1 -0
- package/lib/components/ContentGroup/helpers/get-sections-data.js +25 -0
- package/lib/components/ContentGroup/helpers/get-sections-data.js.map +1 -0
- package/lib/components/ContentGroup/helpers/index.js +22 -0
- package/lib/components/ContentGroup/helpers/index.js.map +1 -0
- package/lib/components/ContentGroupSection/ContentGroupSection.js +4 -1
- package/lib/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
- package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js +5 -1
- package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
- package/lib-es/components/ContentGroup/ContentGroup.js +14 -5
- package/lib-es/components/ContentGroup/ContentGroup.js.map +1 -1
- package/lib-es/components/ContentGroup/ContentGroupTabs.js +48 -39
- package/lib-es/components/ContentGroup/ContentGroupTabs.js.map +1 -1
- package/lib-es/components/ContentGroup/constants.js +7 -0
- package/lib-es/components/ContentGroup/constants.js.map +1 -0
- package/lib-es/components/ContentGroup/helpers/get-active-tab.js +10 -0
- package/lib-es/components/ContentGroup/helpers/get-active-tab.js.map +1 -0
- package/lib-es/components/ContentGroup/helpers/get-sections-data.js +15 -0
- package/lib-es/components/ContentGroup/helpers/get-sections-data.js.map +1 -0
- package/lib-es/components/ContentGroup/helpers/index.js +4 -0
- package/lib-es/components/ContentGroup/helpers/index.js.map +1 -0
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js +4 -2
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
- package/lib-es/components/Video/providers/YouTube/YoutubeEmbeded.js +5 -1
- package/lib-es/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
- package/package.json +2 -2
- package/src/components/ContentGroup/ContentGroup.js +16 -4
- package/src/components/ContentGroup/ContentGroupTabs.js +44 -28
- package/src/components/ContentGroup/constants.js +7 -0
- package/src/components/ContentGroup/helpers/get-active-tab.js +11 -0
- package/src/components/ContentGroup/helpers/get-sections-data.js +7 -0
- package/src/components/ContentGroup/helpers/index.js +4 -0
- package/src/components/ContentGroupSection/ContentGroupSection.js +6 -2
- package/src/components/Video/providers/YouTube/YoutubeEmbeded.js +5 -1
- package/tests/unit/src/components/ContentGroup/ContentGroupTabs.test.js +14 -1
- package/tests/unit/src/components/ContentGroup/__snapshots__/ContentGroupTabs.test.js.snap +88 -2
- package/tests/unit/src/components/ContentGroup/helpers/get-active-tab.test.js +19 -0
- package/tests/unit/src/components/ContentGroup/helpers/get-sections-data.test.js +14 -0
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.126.0-alpha.5](https://github.com/thebyte9/blaze/compare/v0.126.0-alpha.4...v0.126.0-alpha.5) (2023-01-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* content groups anchor links in the url ([#3736](https://github.com/thebyte9/blaze/issues/3736)) ([b0fb981](https://github.com/thebyte9/blaze/commit/b0fb9814a62bba34e005537a7410550b1ac79afc))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [0.126.0-alpha.0](https://github.com/thebyte9/blaze/compare/v0.125.0...v0.126.0-alpha.0) (2022-12-02)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -11,16 +11,25 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _ContentGroupTabs = _interopRequireDefault(require("./ContentGroupTabs"));
|
|
14
|
-
var
|
|
14
|
+
var _helpers = require("./helpers");
|
|
15
|
+
var _excluded = ["contentType", "children"];
|
|
15
16
|
var ContentGroup = function ContentGroup(_ref) {
|
|
17
|
+
var _children$props;
|
|
16
18
|
var contentType = _ref.contentType,
|
|
19
|
+
children = _ref.children,
|
|
17
20
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
var groupSections = children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.children[1];
|
|
22
|
+
if (!groupSections || !groupSections.length) return '';
|
|
23
|
+
if (contentType !== 'tab' && contentType !== 'sidepanel') return '';
|
|
24
|
+
var sectionsData = (0, _helpers.getSectionsData)(groupSections);
|
|
25
|
+
return /*#__PURE__*/_react["default"].createElement(_ContentGroupTabs["default"], (0, _extends2["default"])({
|
|
26
|
+
contentType: contentType,
|
|
27
|
+
groupSections: groupSections,
|
|
28
|
+
sectionsData: sectionsData
|
|
20
29
|
}, props));
|
|
21
|
-
return '';
|
|
22
30
|
};
|
|
23
31
|
ContentGroup.propTypes = {
|
|
32
|
+
children: _propTypes["default"].object.isRequired,
|
|
24
33
|
contentType: _propTypes["default"].string.isRequired
|
|
25
34
|
};
|
|
26
35
|
ContentGroup.defaultProps = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentGroup.js","names":["ContentGroup","contentType","props","propTypes","PropTypes","
|
|
1
|
+
{"version":3,"file":"ContentGroup.js","names":["ContentGroup","contentType","children","props","groupSections","length","sectionsData","getSectionsData","propTypes","PropTypes","object","isRequired","string","defaultProps"],"sources":["../../../src/components/ContentGroup/ContentGroup.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport ContentGroupTabs from './ContentGroupTabs';\nimport { getSectionsData } from './helpers';\n\nconst ContentGroup = ({ contentType, children, ...props }) => {\n const groupSections = children?.props?.children[1];\n if (!groupSections || !groupSections.length) return '';\n if (contentType !== 'tab' && contentType !== 'sidepanel') return '';\n const sectionsData = getSectionsData(groupSections);\n\n return (\n <ContentGroupTabs\n contentType={contentType}\n groupSections={groupSections}\n sectionsData={sectionsData}\n {...props}\n />\n );\n};\n\nContentGroup.propTypes = {\n children: PropTypes.object.isRequired,\n contentType: PropTypes.string.isRequired\n};\n\nContentGroup.defaultProps = {};\n\nexport default ContentGroup;\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AAA4C;AAE5C,IAAMA,YAAY,GAAG,SAAfA,YAAY,OAA4C;EAAA;EAAA,IAAtCC,WAAW,QAAXA,WAAW;IAAEC,QAAQ,QAARA,QAAQ;IAAKC,KAAK;EACrD,IAAMC,aAAa,GAAGF,QAAQ,aAARA,QAAQ,0CAARA,QAAQ,CAAEC,KAAK,oDAAf,gBAAiBD,QAAQ,CAAC,CAAC,CAAC;EAClD,IAAI,CAACE,aAAa,IAAI,CAACA,aAAa,CAACC,MAAM,EAAE,OAAO,EAAE;EACtD,IAAIJ,WAAW,KAAK,KAAK,IAAIA,WAAW,KAAK,WAAW,EAAE,OAAO,EAAE;EACnE,IAAMK,YAAY,GAAG,IAAAC,wBAAe,EAACH,aAAa,CAAC;EAEnD,oBACE,gCAAC,4BAAgB;IACf,WAAW,EAAEH,WAAY;IACzB,aAAa,EAAEG,aAAc;IAC7B,YAAY,EAAEE;EAAa,GACvBH,KAAK,EACT;AAEN,CAAC;AAEDH,YAAY,CAACQ,SAAS,GAAG;EACvBN,QAAQ,EAAEO,qBAAS,CAACC,MAAM,CAACC,UAAU;EACrCV,WAAW,EAAEQ,qBAAS,CAACG,MAAM,CAACD;AAChC,CAAC;AAEDX,YAAY,CAACa,YAAY,GAAG,CAAC,CAAC;AAAC,eAEhBb,YAAY;AAAA"}
|
|
@@ -13,47 +13,51 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
13
13
|
value: true
|
|
14
14
|
});
|
|
15
15
|
exports["default"] = void 0;
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
17
|
require("core-js/modules/es.function.name.js");
|
|
18
|
+
require("core-js/modules/es.array.concat.js");
|
|
17
19
|
require("core-js/modules/es.array.map.js");
|
|
18
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
21
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
22
|
-
var
|
|
22
|
+
var _router = require("next/router");
|
|
23
|
+
var _helpers = require("./helpers");
|
|
24
|
+
var _constants = require("./constants");
|
|
23
25
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
27
|
var ContentGroupTabs = function ContentGroupTabs(_ref) {
|
|
26
|
-
var _children$props;
|
|
27
28
|
var name = _ref.name,
|
|
28
29
|
contentType = _ref.contentType,
|
|
29
30
|
modifier = _ref.modifier,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var
|
|
31
|
+
groupSections = _ref.groupSections,
|
|
32
|
+
sectionsData = _ref.sectionsData;
|
|
33
|
+
var router = (0, _router.useRouter)();
|
|
34
|
+
var _useState = (0, _react.useState)((0, _helpers.getActiveTab)(sectionsData, '')),
|
|
33
35
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
34
36
|
selectedTab = _useState2[0],
|
|
35
37
|
setSelectedTab = _useState2[1];
|
|
36
|
-
var
|
|
37
|
-
var contentClassame = contentType ===
|
|
38
|
-
|
|
38
|
+
var asPath = router.asPath;
|
|
39
|
+
var contentClassame = contentType === _constants.TAB ? _constants.TABS : _constants.SIDEPANEL;
|
|
40
|
+
var mainDivClass = "".concat(_constants.CONTENT_GROUP, "-").concat(contentClassame);
|
|
41
|
+
var contentGroupClass = "".concat(_constants.CONTENT_GROUP, "-").concat(contentClassame, "__buttons-wrapper");
|
|
42
|
+
var sectionClass = "".concat(_constants.CONTENT_GROUP, "-").concat(contentClassame, "__content-section");
|
|
43
|
+
(0, _react.useEffect)(function () {
|
|
44
|
+
var activeTab = (0, _helpers.getActiveTab)(sectionsData, asPath);
|
|
45
|
+
if (activeTab !== selectedTab) setSelectedTab(activeTab);
|
|
46
|
+
}, [asPath, sectionsData, selectedTab]);
|
|
39
47
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
40
|
-
className:
|
|
48
|
+
className: mainDivClass
|
|
41
49
|
}, /*#__PURE__*/_react["default"].createElement("ul", {
|
|
42
|
-
className:
|
|
50
|
+
className: contentGroupClass,
|
|
43
51
|
role: "tablist",
|
|
44
52
|
"aria-label": name
|
|
45
53
|
}, groupSections.map(function (groupSection, index) {
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
_groupSection$props$c2 = _groupSection$props$c2 === void 0 ? {} : _groupSection$props$c2;
|
|
52
|
-
var sectionLabel = _groupSection$props$c2.label;
|
|
53
|
-
var tabId = "tab-".concat(index);
|
|
54
|
-
var panelId = "panel-".concat(index);
|
|
54
|
+
var _sectionsData$index = (0, _slicedToArray2["default"])(sectionsData[index], 2),
|
|
55
|
+
sectionName = _sectionsData$index[0],
|
|
56
|
+
sectioLabel = _sectionsData$index[1];
|
|
57
|
+
var tabId = "".concat(_constants.TAB, "-").concat(sectionName);
|
|
58
|
+
var panelId = "".concat(_constants.PANEL, "-").concat(sectionName);
|
|
55
59
|
var isSelected = selectedTab === tabId;
|
|
56
|
-
var buttonClassName =
|
|
60
|
+
var buttonClassName = "".concat(_constants.CONTENT_GROUP, "-").concat(contentClassame, "__button").concat(isSelected ? '--is-active' : '');
|
|
57
61
|
return /*#__PURE__*/_react["default"].createElement("button", {
|
|
58
62
|
id: tabId,
|
|
59
63
|
key: tabId,
|
|
@@ -63,17 +67,25 @@ var ContentGroupTabs = function ContentGroupTabs(_ref) {
|
|
|
63
67
|
"aria-selected": isSelected,
|
|
64
68
|
"aria-controls": panelId,
|
|
65
69
|
onClick: function onClick() {
|
|
66
|
-
|
|
70
|
+
var baseUrl = asPath.split('#')[0];
|
|
71
|
+
var newUrl = "".concat(baseUrl, "#").concat(sectionName);
|
|
72
|
+
if (asPath === newUrl) return;
|
|
73
|
+
router.push("/Resolver", newUrl, {
|
|
74
|
+
shallow: true
|
|
75
|
+
});
|
|
76
|
+
setSelectedTab(tabId);
|
|
67
77
|
}
|
|
68
|
-
},
|
|
78
|
+
}, sectioLabel);
|
|
69
79
|
})), groupSections.map(function (groupSection, index) {
|
|
70
|
-
var
|
|
71
|
-
|
|
80
|
+
var _sectionsData$index2 = (0, _slicedToArray2["default"])(sectionsData[index], 1),
|
|
81
|
+
sectionName = _sectionsData$index2[0];
|
|
82
|
+
var tabId = "".concat(_constants.TAB, "-").concat(sectionName);
|
|
83
|
+
var panelId = "".concat(_constants.PANEL, "-").concat(sectionName);
|
|
72
84
|
if (selectedTab !== tabId) return null;
|
|
73
85
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
74
|
-
id:
|
|
86
|
+
id: sectionName,
|
|
75
87
|
key: panelId,
|
|
76
|
-
className:
|
|
88
|
+
className: sectionClass,
|
|
77
89
|
role: "tabpanel",
|
|
78
90
|
"aria-labelledby": tabId
|
|
79
91
|
}, groupSection);
|
|
@@ -83,11 +95,11 @@ ContentGroupTabs.propTypes = {
|
|
|
83
95
|
name: _propTypes["default"].string.isRequired,
|
|
84
96
|
contentType: _propTypes["default"].string.isRequired,
|
|
85
97
|
modifier: _propTypes["default"].string,
|
|
86
|
-
|
|
98
|
+
groupSections: _propTypes["default"].array.isRequired,
|
|
99
|
+
sectionsData: _propTypes["default"].array.isRequired
|
|
87
100
|
};
|
|
88
101
|
ContentGroupTabs.defaultProps = {
|
|
89
|
-
modifier: ''
|
|
90
|
-
children: {}
|
|
102
|
+
modifier: ''
|
|
91
103
|
};
|
|
92
104
|
var _default = ContentGroupTabs;
|
|
93
105
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentGroupTabs.js","names":["ContentGroupTabs","name","contentType","modifier","
|
|
1
|
+
{"version":3,"file":"ContentGroupTabs.js","names":["ContentGroupTabs","name","contentType","modifier","groupSections","sectionsData","router","useRouter","useState","getActiveTab","selectedTab","setSelectedTab","asPath","contentClassame","TAB","TABS","SIDEPANEL","mainDivClass","CONTENT_GROUP","contentGroupClass","sectionClass","useEffect","activeTab","map","groupSection","index","sectionName","sectioLabel","tabId","panelId","PANEL","isSelected","buttonClassName","baseUrl","split","newUrl","push","shallow","propTypes","PropTypes","string","isRequired","array","defaultProps"],"sources":["../../../src/components/ContentGroup/ContentGroupTabs.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { useRouter } from 'next/router';\nimport { getActiveTab } from './helpers';\nimport { TAB, TABS, SIDEPANEL, CONTENT_GROUP, PANEL } from './constants';\n\nconst ContentGroupTabs = ({ name, contentType, modifier, groupSections, sectionsData }) => {\n const router = useRouter();\n const [selectedTab, setSelectedTab] = useState(getActiveTab(sectionsData, ''));\n const { asPath } = router;\n const contentClassame = contentType === TAB ? TABS : SIDEPANEL;\n const mainDivClass = `${CONTENT_GROUP}-${contentClassame}`;\n const contentGroupClass = `${CONTENT_GROUP}-${contentClassame}__buttons-wrapper`;\n const sectionClass = `${CONTENT_GROUP}-${contentClassame}__content-section`;\n\n useEffect(\n () => {\n const activeTab = getActiveTab(sectionsData, asPath);\n if (activeTab !== selectedTab) setSelectedTab(activeTab);\n },\n [asPath, sectionsData, selectedTab]\n );\n\n return (\n <div className={mainDivClass}>\n <ul className={contentGroupClass} role=\"tablist\" aria-label={name}>\n {groupSections.map((groupSection, index) => {\n const [sectionName, sectioLabel] = sectionsData[index];\n const tabId = `${TAB}-${sectionName}`;\n const panelId = `${PANEL}-${sectionName}`;\n const isSelected = selectedTab === tabId;\n const buttonClassName = `${CONTENT_GROUP}-${contentClassame}__button${\n isSelected ? '--is-active' : ''\n }`;\n\n return (\n <button\n id={tabId}\n key={tabId}\n className={buttonClassName}\n type=\"button\"\n role=\"tab\"\n aria-selected={isSelected}\n aria-controls={panelId}\n onClick={() => {\n const baseUrl = asPath.split('#')[0];\n const newUrl = `${baseUrl}#${sectionName}`;\n if (asPath === newUrl) return;\n router.push(`/Resolver`, newUrl, { shallow: true });\n setSelectedTab(tabId);\n }}>\n {sectioLabel}\n </button>\n );\n })}\n </ul>\n {groupSections.map((groupSection, index) => {\n const [sectionName] = sectionsData[index];\n const tabId = `${TAB}-${sectionName}`;\n const panelId = `${PANEL}-${sectionName}`;\n if (selectedTab !== tabId) return null;\n\n return (\n <div\n id={sectionName}\n key={panelId}\n className={sectionClass}\n role=\"tabpanel\"\n aria-labelledby={tabId}>\n {groupSection}\n </div>\n );\n })}\n </div>\n );\n};\n\nContentGroupTabs.propTypes = {\n name: PropTypes.string.isRequired,\n contentType: PropTypes.string.isRequired,\n modifier: PropTypes.string,\n groupSections: PropTypes.array.isRequired,\n sectionsData: PropTypes.array.isRequired\n};\n\nContentGroupTabs.defaultProps = {\n modifier: ''\n};\n\nexport default ContentGroupTabs;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAAyE;AAAA;AAEzE,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgB,OAAqE;EAAA,IAA/DC,IAAI,QAAJA,IAAI;IAAEC,WAAW,QAAXA,WAAW;IAAEC,QAAQ,QAARA,QAAQ;IAAEC,aAAa,QAAbA,aAAa;IAAEC,YAAY,QAAZA,YAAY;EAClF,IAAMC,MAAM,GAAG,IAAAC,iBAAS,GAAE;EAC1B,gBAAsC,IAAAC,eAAQ,EAAC,IAAAC,qBAAY,EAACJ,YAAY,EAAE,EAAE,CAAC,CAAC;IAAA;IAAvEK,WAAW;IAAEC,cAAc;EAClC,IAAQC,MAAM,GAAKN,MAAM,CAAjBM,MAAM;EACd,IAAMC,eAAe,GAAGX,WAAW,KAAKY,cAAG,GAAGC,eAAI,GAAGC,oBAAS;EAC9D,IAAMC,YAAY,aAAMC,wBAAa,cAAIL,eAAe,CAAE;EAC1D,IAAMM,iBAAiB,aAAMD,wBAAa,cAAIL,eAAe,sBAAmB;EAChF,IAAMO,YAAY,aAAMF,wBAAa,cAAIL,eAAe,sBAAmB;EAE3E,IAAAQ,gBAAS,EACP,YAAM;IACJ,IAAMC,SAAS,GAAG,IAAAb,qBAAY,EAACJ,YAAY,EAAEO,MAAM,CAAC;IACpD,IAAIU,SAAS,KAAKZ,WAAW,EAAEC,cAAc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AAK,CAAC;MAAlCC,WAAW;IAClB,IAAME,KAAK,aAAMd,cAAG,cAAIY,WAAW,CAAE;IACrC,IAAMG,OAAO,aAAMC,gBAAK,cAAIJ,WAAW,CAAE;IACzC,IAAIhB,WAAW,KAAKkB,KAAK,EAAE,OAAO,IAAI;IAEtC,oBACE;MACE,EAAE,EAAEF,WAAY;MAChB,GAAG,EAAEG,OAAQ;MACb,SAAS,EAAET,YAAa;MACxB,IAAI,EAAC,UAAU;MACf,mBAAiBQ;IAAM,GACtBJ,YAAY,CACT;EAEV,CAAC,CAAC,CACE;AAEV,CAAC;AAEDxB,gBAAgB,CAACsC,SAAS,GAAG;EAC3BrC,IAAI,EAAEsC,qBAAS,CAACC,MAAM,CAACC,UAAU;EACjCvC,WAAW,EAAEqC,qBAAS,CAACC,MAAM,CAACC,UAAU;EACxCtC,QAAQ,EAAEoC,qBAAS,CAACC,MAAM;EAC1BpC,aAAa,EAAEmC,qBAAS,CAACG,KAAK,CAACD,UAAU;EACzCpC,YAAY,EAAEkC,qBAAS,CAACG,KAAK,CAACD;AAChC,CAAC;AAEDzC,gBAAgB,CAAC2C,YAAY,GAAG;EAC9BxC,QAAQ,EAAE;AACZ,CAAC;AAAC,eAEaH,gBAAgB;AAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TABS = exports.TAB = exports.SIDEPANEL = exports.PANEL = exports.CONTENT_GROUP = void 0;
|
|
8
|
+
var TAB = 'tab';
|
|
9
|
+
exports.TAB = TAB;
|
|
10
|
+
var TABS = 'tabs';
|
|
11
|
+
exports.TABS = TABS;
|
|
12
|
+
var SIDEPANEL = 'sidepanel';
|
|
13
|
+
exports.SIDEPANEL = SIDEPANEL;
|
|
14
|
+
var CONTENT_GROUP = 'content-group';
|
|
15
|
+
exports.CONTENT_GROUP = CONTENT_GROUP;
|
|
16
|
+
var PANEL = 'panel';
|
|
17
|
+
exports.PANEL = PANEL;
|
|
18
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":["TAB","TABS","SIDEPANEL","CONTENT_GROUP","PANEL"],"sources":["../../../src/components/ContentGroup/constants.js"],"sourcesContent":["const TAB = 'tab';\nconst TABS = 'tabs';\nconst SIDEPANEL = 'sidepanel';\nconst CONTENT_GROUP = 'content-group';\nconst PANEL = 'panel';\n\nexport { TAB, TABS, SIDEPANEL, CONTENT_GROUP, PANEL };\n"],"mappings":";;;;;;;AAAA,IAAMA,GAAG,GAAG,KAAK;AAAC;AAClB,IAAMC,IAAI,GAAG,MAAM;AAAC;AACpB,IAAMC,SAAS,GAAG,WAAW;AAAC;AAC9B,IAAMC,aAAa,GAAG,eAAe;AAAC;AACtC,IAAMC,KAAK,GAAG,OAAO;AAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
require("core-js/modules/es.array.find.js");
|
|
9
|
+
require("core-js/modules/es.object.to-string.js");
|
|
10
|
+
require("core-js/modules/es.array.concat.js");
|
|
11
|
+
var _constants = require("../constants");
|
|
12
|
+
var getActiveTab = function getActiveTab(sections, url) {
|
|
13
|
+
var decodedUrl = decodeURI(url);
|
|
14
|
+
var activeTabName = decodedUrl.split('#')[1];
|
|
15
|
+
var isUrlTabValid = !!sections.find(function (section) {
|
|
16
|
+
return section[0] === activeTabName;
|
|
17
|
+
});
|
|
18
|
+
var tabToUse = isUrlTabValid && activeTabName || sections[0][0];
|
|
19
|
+
return "".concat(_constants.TAB, "-").concat(tabToUse);
|
|
20
|
+
};
|
|
21
|
+
var _default = getActiveTab;
|
|
22
|
+
exports["default"] = _default;
|
|
23
|
+
//# sourceMappingURL=get-active-tab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-active-tab.js","names":["getActiveTab","sections","url","decodedUrl","decodeURI","activeTabName","split","isUrlTabValid","find","section","tabToUse","TAB"],"sources":["../../../../src/components/ContentGroup/helpers/get-active-tab.js"],"sourcesContent":["import { TAB } from '../constants';\n\nconst getActiveTab = (sections, url) => {\n const decodedUrl = decodeURI(url);\n const activeTabName = decodedUrl.split('#')[1];\n const isUrlTabValid = !!sections.find(section => section[0] === activeTabName);\n const tabToUse = (isUrlTabValid && activeTabName) || sections[0][0];\n return `${TAB}-${tabToUse}`;\n};\n\nexport default getActiveTab;\n"],"mappings":";;;;;;;;;;AAAA;AAEA,IAAMA,YAAY,GAAG,SAAfA,YAAY,CAAIC,QAAQ,EAAEC,GAAG,EAAK;EACtC,IAAMC,UAAU,GAAGC,SAAS,CAACF,GAAG,CAAC;EACjC,IAAMG,aAAa,GAAGF,UAAU,CAACG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EAC9C,IAAMC,aAAa,GAAG,CAAC,CAACN,QAAQ,CAACO,IAAI,CAAC,UAAAC,OAAO;IAAA,OAAIA,OAAO,CAAC,CAAC,CAAC,KAAKJ,aAAa;EAAA,EAAC;EAC9E,IAAMK,QAAQ,GAAIH,aAAa,IAAIF,aAAa,IAAKJ,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;EACnE,iBAAUU,cAAG,cAAID,QAAQ;AAC3B,CAAC;AAAC,eAEaV,YAAY;AAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
require("core-js/modules/es.array.map.js");
|
|
9
|
+
require("core-js/modules/es.function.name.js");
|
|
10
|
+
var getSectionsData = function getSectionsData(sections) {
|
|
11
|
+
return sections.map(function (section) {
|
|
12
|
+
var _section$props = section.props;
|
|
13
|
+
_section$props = _section$props === void 0 ? {} : _section$props;
|
|
14
|
+
var _section$props$compon = _section$props.component;
|
|
15
|
+
_section$props$compon = _section$props$compon === void 0 ? {} : _section$props$compon;
|
|
16
|
+
var _section$props$compon2 = _section$props$compon.settings;
|
|
17
|
+
_section$props$compon2 = _section$props$compon2 === void 0 ? {} : _section$props$compon2;
|
|
18
|
+
var label = _section$props$compon2.label,
|
|
19
|
+
name = _section$props$compon2.name;
|
|
20
|
+
return [name, label];
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var _default = getSectionsData;
|
|
24
|
+
exports["default"] = _default;
|
|
25
|
+
//# sourceMappingURL=get-sections-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-sections-data.js","names":["getSectionsData","sections","map","section","props","component","settings","label","name"],"sources":["../../../../src/components/ContentGroup/helpers/get-sections-data.js"],"sourcesContent":["const getSectionsData = sections =>\n sections.map(section => {\n const { props: { component: { settings: { label, name } = {} } = {} } = {} } = section;\n return [name, label];\n });\n\nexport default getSectionsData;\n"],"mappings":";;;;;;;;;AAAA,IAAMA,eAAe,GAAG,SAAlBA,eAAe,CAAGC,QAAQ;EAAA,OAC9BA,QAAQ,CAACC,GAAG,CAAC,UAAAC,OAAO,EAAI;IACtB,qBAA+EA,OAAO,CAA9EC,KAAK;IAAb,6CAAwE,CAAC,CAAC;IAA1E,2CAAiBC,SAAS;IAA1B,2DAAiE,CAAC,CAAC;IAAnE,mDAA8BC,QAAQ;IAAtC,6DAA0D,CAAC,CAAC;IAA5D,IAA0CC,KAAK,0BAALA,KAAK;MAAEC,IAAI,0BAAJA,IAAI;IACrD,OAAO,CAACA,IAAI,EAAED,KAAK,CAAC;EACtB,CAAC,CAAC;AAAA;AAAC,eAEUP,eAAe;AAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
Object.defineProperty(exports, "getActiveTab", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _getActiveTab["default"];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "getSectionsData", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _getSectionsData["default"];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var _getSectionsData = _interopRequireDefault(require("./get-sections-data"));
|
|
21
|
+
var _getActiveTab = _interopRequireDefault(require("./get-active-tab"));
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"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;AACA"}
|
|
@@ -6,16 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
|
+
require("core-js/modules/es.function.name.js");
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
13
|
var _helpers = require("../../helpers");
|
|
13
|
-
var _excluded = ["children"];
|
|
14
|
+
var _excluded = ["children", "name"];
|
|
14
15
|
var ContentGroupSection = function ContentGroupSection(_ref) {
|
|
15
16
|
var children = _ref.children,
|
|
17
|
+
name = _ref.name,
|
|
16
18
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
17
19
|
if (!(0, _helpers.hasChildren)(children)) return null;
|
|
18
20
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
21
|
+
key: name,
|
|
19
22
|
className: "content-group-section"
|
|
20
23
|
}, children);
|
|
21
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentGroupSection.js","names":["ContentGroupSection","children","props","hasChildren","propTypes","PropTypes","oneOfType","arrayOf","node","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, ...props }) => {\n if (!hasChildren(children)) return null;\n\n return <div className=\"content-group-section\"
|
|
1
|
+
{"version":3,"file":"ContentGroupSection.js","names":["ContentGroupSection","children","name","props","hasChildren","propTypes","PropTypes","oneOfType","arrayOf","node","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, ...props }) => {\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};\n\nContentGroupSection.defaultProps = { children: null };\n\nexport default ContentGroupSection;\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AAA4C;AAE5C,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmB,OAAqC;EAAA,IAA/BC,QAAQ,QAARA,QAAQ;IAAEC,IAAI,QAAJA,IAAI;IAAKC,KAAK;EACrD,IAAI,CAAC,IAAAC,oBAAW,EAACH,QAAQ,CAAC,EAAE,OAAO,IAAI;EAEvC,oBACE;IAAK,GAAG,EAAEC,IAAK;IAAC,SAAS,EAAC;EAAuB,GAC9CD,QAAQ,CACL;AAEV,CAAC;AAEDD,mBAAmB,CAACK,SAAS,GAAG;EAC9BJ,QAAQ,EAAEK,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,OAAO,CAACF,qBAAS,CAACG,IAAI,CAAC,EAAEH,qBAAS,CAACG,IAAI,CAAC;AACnF,CAAC;AAEDT,mBAAmB,CAACU,YAAY,GAAG;EAAET,QAAQ,EAAE;AAAK,CAAC;AAAC,eAEvCD,mBAAmB;AAAA"}
|
|
@@ -76,18 +76,22 @@ var YoutubeEmbeded = function YoutubeEmbeded(_ref) {
|
|
|
76
76
|
var iframeSrc = !playlist ? "".concat(ytUrl, "/embed/").concat(encodedId, "?autoplay=1").concat(mutedValue).concat(paramsImp) : "".concat(ytUrl, "/embed/videoseries?autoplay=1").concat(mutedValue, "&list=").concat(encodedId).concat(paramsImp);
|
|
77
77
|
var parsedWrapperClassname = "yt-facade ".concat(renderIframe ? 'yt-activated' : '');
|
|
78
78
|
(0, _react.useEffect)(function () {
|
|
79
|
+
var isMounted = true;
|
|
79
80
|
if (!priority && !isIntersecting || imageSize === _helpers.YT_HQ_FORMAT) return;
|
|
80
81
|
var img = new Image();
|
|
81
82
|
// eslint-disable-next-line func-names
|
|
82
83
|
img.onload = function () {
|
|
83
84
|
var newImageSize = imageSize;
|
|
84
85
|
if (this && this.width === 120) newImageSize = _helpers.YT_HQ_FORMAT;
|
|
85
|
-
setImageDetails({
|
|
86
|
+
if (isMounted) setImageDetails({
|
|
86
87
|
imageSize: newImageSize,
|
|
87
88
|
displayImage: true
|
|
88
89
|
});
|
|
89
90
|
};
|
|
90
91
|
img.src = posterUrl;
|
|
92
|
+
return function () {
|
|
93
|
+
isMounted = false;
|
|
94
|
+
};
|
|
91
95
|
}, [imageSize, isIntersecting, posterUrl, priority]);
|
|
92
96
|
var warmConnections = function warmConnections() {
|
|
93
97
|
if (preconnected) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YoutubeEmbeded.js","names":["YoutubeEmbeded","autoplay","videoId","playlistCoverId","videoTitle","poster","videoParams","announce","noCookie","webp","playlist","onIframeAdded","muted","adNetwork","iframeClass","priority","placeholderOnly","imageData","useInView","IN_VIEW_CONFIG","isIntersecting","outerRef","useState","preconnected","setPreconnected","renderIframe","setRenderIframe","imageSize","displayImage","setImageDetails","encodedId","encodeURIComponent","paramsImp","ytUrl","posterUrl","getPosterUrl","mutedValue","iframeSrc","parsedWrapperClassname","useEffect","YT_HQ_FORMAT","img","Image","onload","newImageSize","width","src","warmConnections","addIframe","YT_IMAGE_URL","backgroundImage","propTypes","PropTypes","bool","func","string","object","defaultProps"],"sources":["../../../../../src/components/Video/providers/YouTube/YoutubeEmbeded.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { useInView } from '@blaze-react/utils/lib/customHooks';\nimport { IN_VIEW_CONFIG } from '../../../../constants';\nimport { getPosterUrl, YT_HQ_FORMAT, YT_IMAGE_URL } from './helpers';\n\nconst YoutubeEmbeded = ({\n autoplay,\n videoId,\n playlistCoverId,\n videoTitle,\n poster,\n videoParams,\n announce,\n noCookie,\n webp,\n playlist,\n onIframeAdded,\n muted,\n adNetwork,\n iframeClass,\n priority,\n placeholderOnly,\n imageData\n}) => {\n const [isIntersecting, outerRef] = useInView(IN_VIEW_CONFIG);\n const [preconnected, setPreconnected] = useState(false);\n const [renderIframe, setRenderIframe] = useState(!!autoplay);\n const [{ imageSize, displayImage }, setImageDetails] = useState({\n imageSize: poster,\n displayImage: priority\n });\n\n const encodedId = encodeURIComponent(videoId);\n const paramsImp = videoParams ? `&${videoParams}` : '';\n const ytUrl = noCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com';\n const posterUrl = getPosterUrl({\n imageData,\n playlistCoverId,\n playlist,\n encodedId,\n imageSize,\n webp\n });\n const mutedValue = muted ? '&mute=1' : '';\n const iframeSrc = !playlist\n ? `${ytUrl}/embed/${encodedId}?autoplay=1${mutedValue}${paramsImp}`\n : `${ytUrl}/embed/videoseries?autoplay=1${mutedValue}&list=${encodedId}${paramsImp}`;\n const parsedWrapperClassname = `yt-facade ${renderIframe ? 'yt-activated' : ''}`;\n\n useEffect(\n () => {\n if ((!priority && !isIntersecting) || imageSize === YT_HQ_FORMAT) return;\n\n const img = new Image();\n // eslint-disable-next-line func-names\n img.onload = function() {\n let newImageSize = imageSize;\n if (this && this.width === 120) newImageSize = YT_HQ_FORMAT;\n setImageDetails({ imageSize: newImageSize, displayImage: true });\n };\n\n img.src = posterUrl;\n },\n [imageSize, isIntersecting, posterUrl, priority]\n );\n\n const warmConnections = () => {\n if (preconnected) return;\n setPreconnected(true);\n };\n\n const addIframe = () => {\n if (renderIframe || placeholderOnly) return;\n onIframeAdded();\n setRenderIframe(true);\n };\n\n return (\n <>\n {preconnected && (\n <>\n <link rel=\"preconnect\" href={YT_IMAGE_URL} />\n <link rel=\"preconnect\" href={ytUrl} />\n <link rel=\"preconnect\" href=\"https://www.google.com\" />\n {adNetwork && (\n <>\n <link rel=\"preconnect\" href=\"https://static.doubleclick.net\" />\n <link rel=\"preconnect\" href=\"https://googleads.g.doubleclick.net\" />\n </>\n )}\n </>\n )}\n <div\n ref={outerRef}\n role=\"button\"\n onPointerOver={warmConnections}\n onClick={addIframe}\n className={parsedWrapperClassname}\n data-title={videoTitle}\n style={{\n backgroundImage: `url(${displayImage ? posterUrl : ''})`\n }}>\n <div\n type=\"button\"\n className=\"yt-facade-button-wrapper\"\n aria-label={`${announce} ${videoTitle}`}>\n <div className=\"yt-facade-button\" />\n </div>\n {renderIframe && (\n <iframe\n className={iframeClass}\n title={videoTitle}\n allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n src={iframeSrc}\n />\n )}\n </div>\n </>\n );\n};\n\nYoutubeEmbeded.propTypes = {\n priority: PropTypes.bool,\n onIframeAdded: PropTypes.func,\n adNetwork: PropTypes.bool,\n autoplay: PropTypes.bool,\n playlist: PropTypes.bool,\n muted: PropTypes.bool,\n webp: PropTypes.bool,\n noCookie: PropTypes.bool,\n videoId: PropTypes.string,\n iframeClass: PropTypes.string,\n poster: PropTypes.string,\n announce: PropTypes.string,\n playlistCoverId: PropTypes.string,\n videoParams: PropTypes.string,\n videoTitle: PropTypes.string,\n placeholderOnly: PropTypes.bool,\n imageData: PropTypes.object\n};\n\nYoutubeEmbeded.defaultProps = {\n priority: true,\n onIframeAdded: () => {},\n adNetwork: false,\n autoplay: false,\n playlist: false,\n muted: false,\n webp: false,\n noCookie: false,\n iframeClass: '',\n poster: 'sddefault',\n announce: 'Watch',\n videoId: '',\n playlistCoverId: '',\n videoParams: '',\n videoTitle: '',\n placeholderOnly: false,\n imageData: {}\n};\n\nexport default YoutubeEmbeded;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAAqE;AAAA;AAErE,IAAMA,cAAc,GAAG,SAAjBA,cAAc,OAkBd;EAAA,IAjBJC,QAAQ,QAARA,QAAQ;IACRC,OAAO,QAAPA,OAAO;IACPC,eAAe,QAAfA,eAAe;IACfC,UAAU,QAAVA,UAAU;IACVC,MAAM,QAANA,MAAM;IACNC,WAAW,QAAXA,WAAW;IACXC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IACRC,IAAI,QAAJA,IAAI;IACJC,QAAQ,QAARA,QAAQ;IACRC,aAAa,QAAbA,aAAa;IACbC,KAAK,QAALA,KAAK;IACLC,SAAS,QAATA,SAAS;IACTC,WAAW,QAAXA,WAAW;IACXC,QAAQ,QAARA,QAAQ;IACRC,eAAe,QAAfA,eAAe;IACfC,SAAS,QAATA,SAAS;EAET,iBAAmC,IAAAC,sBAAS,EAACC,yBAAc,CAAC;IAAA;IAArDC,cAAc;IAAEC,QAAQ;EAC/B,gBAAwC,IAAAC,eAAQ,EAAC,KAAK,CAAC;IAAA;IAAhDC,YAAY;IAAEC,eAAe;EACpC,iBAAwC,IAAAF,eAAQ,EAAC,CAAC,CAACrB,QAAQ,CAAC;IAAA;IAArDwB,YAAY;IAAEC,eAAe;EACpC,iBAAuD,IAAAJ,eAAQ,EAAC;MAC9DK,SAAS,EAAEtB,MAAM;MACjBuB,YAAY,EAAEb;IAChB,CAAC,CAAC;IAAA;IAAA;IAHOY,SAAS,eAATA,SAAS;IAAEC,YAAY,eAAZA,YAAY;IAAIC,eAAe;EAKnD,IAAMC,SAAS,GAAGC,kBAAkB,CAAC7B,OAAO,CAAC;EAC7C,IAAM8B,SAAS,GAAG1B,WAAW,cAAOA,WAAW,IAAK,EAAE;EACtD,IAAM2B,KAAK,GAAGzB,QAAQ,GAAG,kCAAkC,GAAG,yBAAyB;EACvF,IAAM0B,SAAS,GAAG,IAAAC,qBAAY,EAAC;IAC7BlB,SAAS,EAATA,SAAS;IACTd,eAAe,EAAfA,eAAe;IACfO,QAAQ,EAARA,QAAQ;IACRoB,SAAS,EAATA,SAAS;IACTH,SAAS,EAATA,SAAS;IACTlB,IAAI,EAAJA;EACF,CAAC,CAAC;EACF,IAAM2B,UAAU,GAAGxB,KAAK,GAAG,SAAS,GAAG,EAAE;EACzC,IAAMyB,SAAS,GAAG,CAAC3B,QAAQ,aACpBuB,KAAK,oBAAUH,SAAS,wBAAcM,UAAU,SAAGJ,SAAS,cAC5DC,KAAK,0CAAgCG,UAAU,mBAASN,SAAS,SAAGE,SAAS,CAAE;EACtF,IAAMM,sBAAsB,uBAAgBb,YAAY,GAAG,cAAc,GAAG,EAAE,CAAE;EAEhF,IAAAc,gBAAS,EACP,YAAM;IACJ,IAAK,
|
|
1
|
+
{"version":3,"file":"YoutubeEmbeded.js","names":["YoutubeEmbeded","autoplay","videoId","playlistCoverId","videoTitle","poster","videoParams","announce","noCookie","webp","playlist","onIframeAdded","muted","adNetwork","iframeClass","priority","placeholderOnly","imageData","useInView","IN_VIEW_CONFIG","isIntersecting","outerRef","useState","preconnected","setPreconnected","renderIframe","setRenderIframe","imageSize","displayImage","setImageDetails","encodedId","encodeURIComponent","paramsImp","ytUrl","posterUrl","getPosterUrl","mutedValue","iframeSrc","parsedWrapperClassname","useEffect","isMounted","YT_HQ_FORMAT","img","Image","onload","newImageSize","width","src","warmConnections","addIframe","YT_IMAGE_URL","backgroundImage","propTypes","PropTypes","bool","func","string","object","defaultProps"],"sources":["../../../../../src/components/Video/providers/YouTube/YoutubeEmbeded.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { useInView } from '@blaze-react/utils/lib/customHooks';\nimport { IN_VIEW_CONFIG } from '../../../../constants';\nimport { getPosterUrl, YT_HQ_FORMAT, YT_IMAGE_URL } from './helpers';\n\nconst YoutubeEmbeded = ({\n autoplay,\n videoId,\n playlistCoverId,\n videoTitle,\n poster,\n videoParams,\n announce,\n noCookie,\n webp,\n playlist,\n onIframeAdded,\n muted,\n adNetwork,\n iframeClass,\n priority,\n placeholderOnly,\n imageData\n}) => {\n const [isIntersecting, outerRef] = useInView(IN_VIEW_CONFIG);\n const [preconnected, setPreconnected] = useState(false);\n const [renderIframe, setRenderIframe] = useState(!!autoplay);\n const [{ imageSize, displayImage }, setImageDetails] = useState({\n imageSize: poster,\n displayImage: priority\n });\n\n const encodedId = encodeURIComponent(videoId);\n const paramsImp = videoParams ? `&${videoParams}` : '';\n const ytUrl = noCookie ? 'https://www.youtube-nocookie.com' : 'https://www.youtube.com';\n const posterUrl = getPosterUrl({\n imageData,\n playlistCoverId,\n playlist,\n encodedId,\n imageSize,\n webp\n });\n const mutedValue = muted ? '&mute=1' : '';\n const iframeSrc = !playlist\n ? `${ytUrl}/embed/${encodedId}?autoplay=1${mutedValue}${paramsImp}`\n : `${ytUrl}/embed/videoseries?autoplay=1${mutedValue}&list=${encodedId}${paramsImp}`;\n const parsedWrapperClassname = `yt-facade ${renderIframe ? 'yt-activated' : ''}`;\n\n useEffect(\n () => {\n let isMounted = true;\n if ((!priority && !isIntersecting) || imageSize === YT_HQ_FORMAT) return;\n\n const img = new Image();\n // eslint-disable-next-line func-names\n img.onload = function() {\n let newImageSize = imageSize;\n if (this && this.width === 120) newImageSize = YT_HQ_FORMAT;\n if (isMounted) setImageDetails({ imageSize: newImageSize, displayImage: true });\n };\n\n img.src = posterUrl;\n return () => {\n isMounted = false;\n };\n },\n [imageSize, isIntersecting, posterUrl, priority]\n );\n\n const warmConnections = () => {\n if (preconnected) return;\n setPreconnected(true);\n };\n\n const addIframe = () => {\n if (renderIframe || placeholderOnly) return;\n onIframeAdded();\n setRenderIframe(true);\n };\n\n return (\n <>\n {preconnected && (\n <>\n <link rel=\"preconnect\" href={YT_IMAGE_URL} />\n <link rel=\"preconnect\" href={ytUrl} />\n <link rel=\"preconnect\" href=\"https://www.google.com\" />\n {adNetwork && (\n <>\n <link rel=\"preconnect\" href=\"https://static.doubleclick.net\" />\n <link rel=\"preconnect\" href=\"https://googleads.g.doubleclick.net\" />\n </>\n )}\n </>\n )}\n <div\n ref={outerRef}\n role=\"button\"\n onPointerOver={warmConnections}\n onClick={addIframe}\n className={parsedWrapperClassname}\n data-title={videoTitle}\n style={{\n backgroundImage: `url(${displayImage ? posterUrl : ''})`\n }}>\n <div\n type=\"button\"\n className=\"yt-facade-button-wrapper\"\n aria-label={`${announce} ${videoTitle}`}>\n <div className=\"yt-facade-button\" />\n </div>\n {renderIframe && (\n <iframe\n className={iframeClass}\n title={videoTitle}\n allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n src={iframeSrc}\n />\n )}\n </div>\n </>\n );\n};\n\nYoutubeEmbeded.propTypes = {\n priority: PropTypes.bool,\n onIframeAdded: PropTypes.func,\n adNetwork: PropTypes.bool,\n autoplay: PropTypes.bool,\n playlist: PropTypes.bool,\n muted: PropTypes.bool,\n webp: PropTypes.bool,\n noCookie: PropTypes.bool,\n videoId: PropTypes.string,\n iframeClass: PropTypes.string,\n poster: PropTypes.string,\n announce: PropTypes.string,\n playlistCoverId: PropTypes.string,\n videoParams: PropTypes.string,\n videoTitle: PropTypes.string,\n placeholderOnly: PropTypes.bool,\n imageData: PropTypes.object\n};\n\nYoutubeEmbeded.defaultProps = {\n priority: true,\n onIframeAdded: () => {},\n adNetwork: false,\n autoplay: false,\n playlist: false,\n muted: false,\n webp: false,\n noCookie: false,\n iframeClass: '',\n poster: 'sddefault',\n announce: 'Watch',\n videoId: '',\n playlistCoverId: '',\n videoParams: '',\n videoTitle: '',\n placeholderOnly: false,\n imageData: {}\n};\n\nexport default YoutubeEmbeded;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAAqE;AAAA;AAErE,IAAMA,cAAc,GAAG,SAAjBA,cAAc,OAkBd;EAAA,IAjBJC,QAAQ,QAARA,QAAQ;IACRC,OAAO,QAAPA,OAAO;IACPC,eAAe,QAAfA,eAAe;IACfC,UAAU,QAAVA,UAAU;IACVC,MAAM,QAANA,MAAM;IACNC,WAAW,QAAXA,WAAW;IACXC,QAAQ,QAARA,QAAQ;IACRC,QAAQ,QAARA,QAAQ;IACRC,IAAI,QAAJA,IAAI;IACJC,QAAQ,QAARA,QAAQ;IACRC,aAAa,QAAbA,aAAa;IACbC,KAAK,QAALA,KAAK;IACLC,SAAS,QAATA,SAAS;IACTC,WAAW,QAAXA,WAAW;IACXC,QAAQ,QAARA,QAAQ;IACRC,eAAe,QAAfA,eAAe;IACfC,SAAS,QAATA,SAAS;EAET,iBAAmC,IAAAC,sBAAS,EAACC,yBAAc,CAAC;IAAA;IAArDC,cAAc;IAAEC,QAAQ;EAC/B,gBAAwC,IAAAC,eAAQ,EAAC,KAAK,CAAC;IAAA;IAAhDC,YAAY;IAAEC,eAAe;EACpC,iBAAwC,IAAAF,eAAQ,EAAC,CAAC,CAACrB,QAAQ,CAAC;IAAA;IAArDwB,YAA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ACXD,QAAQ,EAAE,KAAK;EACfM,WAAW,EAAE,EAAE;EACfT,MAAM,EAAE,WAAW;EACnBE,QAAQ,EAAE,OAAO;EACjBL,OAAO,EAAE,EAAE;EACXC,eAAe,EAAE,EAAE;EACnBG,WAAW,EAAE,EAAE;EACfF,UAAU,EAAE,EAAE;EACdY,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAE,CAAC;AACd,CAAC;AAAC,eAEajB,cAAc;AAAA"}
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["contentType"];
|
|
3
|
+
const _excluded = ["contentType", "children"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import ContentGroupTabs from './ContentGroupTabs';
|
|
7
|
+
import { getSectionsData } from './helpers';
|
|
7
8
|
const ContentGroup = _ref => {
|
|
9
|
+
var _children$props;
|
|
8
10
|
let {
|
|
9
|
-
contentType
|
|
11
|
+
contentType,
|
|
12
|
+
children
|
|
10
13
|
} = _ref,
|
|
11
14
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
const groupSections = children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.children[1];
|
|
16
|
+
if (!groupSections || !groupSections.length) return '';
|
|
17
|
+
if (contentType !== 'tab' && contentType !== 'sidepanel') return '';
|
|
18
|
+
const sectionsData = getSectionsData(groupSections);
|
|
19
|
+
return /*#__PURE__*/React.createElement(ContentGroupTabs, _extends({
|
|
20
|
+
contentType: contentType,
|
|
21
|
+
groupSections: groupSections,
|
|
22
|
+
sectionsData: sectionsData
|
|
14
23
|
}, props));
|
|
15
|
-
return '';
|
|
16
24
|
};
|
|
17
25
|
ContentGroup.propTypes = {
|
|
26
|
+
children: PropTypes.object.isRequired,
|
|
18
27
|
contentType: PropTypes.string.isRequired
|
|
19
28
|
};
|
|
20
29
|
ContentGroup.defaultProps = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentGroup.js","names":["React","PropTypes","ContentGroupTabs","ContentGroup","contentType","props","propTypes","
|
|
1
|
+
{"version":3,"file":"ContentGroup.js","names":["React","PropTypes","ContentGroupTabs","getSectionsData","ContentGroup","contentType","children","props","groupSections","length","sectionsData","propTypes","object","isRequired","string","defaultProps"],"sources":["../../../src/components/ContentGroup/ContentGroup.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport ContentGroupTabs from './ContentGroupTabs';\nimport { getSectionsData } from './helpers';\n\nconst ContentGroup = ({ contentType, children, ...props }) => {\n const groupSections = children?.props?.children[1];\n if (!groupSections || !groupSections.length) return '';\n if (contentType !== 'tab' && contentType !== 'sidepanel') return '';\n const sectionsData = getSectionsData(groupSections);\n\n return (\n <ContentGroupTabs\n contentType={contentType}\n groupSections={groupSections}\n sectionsData={sectionsData}\n {...props}\n />\n );\n};\n\nContentGroup.propTypes = {\n children: PropTypes.object.isRequired,\n contentType: PropTypes.string.isRequired\n};\n\nContentGroup.defaultProps = {};\n\nexport default ContentGroup;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,eAAe,QAAQ,WAAW;AAE3C,MAAMC,YAAY,GAAG,QAAyC;EAAA;EAAA,IAAxC;MAAEC,WAAW;MAAEC;IAAmB,CAAC;IAAPC,KAAK;EACrD,MAAMC,aAAa,GAAGF,QAAQ,aAARA,QAAQ,0CAARA,QAAQ,CAAEC,KAAK,oDAAf,gBAAiBD,QAAQ,CAAC,CAAC,CAAC;EAClD,IAAI,CAACE,aAAa,IAAI,CAACA,aAAa,CAACC,MAAM,EAAE,OAAO,EAAE;EACtD,IAAIJ,WAAW,KAAK,KAAK,IAAIA,WAAW,KAAK,WAAW,EAAE,OAAO,EAAE;EACnE,MAAMK,YAAY,GAAGP,eAAe,CAACK,aAAa,CAAC;EAEnD,oBACE,oBAAC,gBAAgB;IACf,WAAW,EAAEH,WAAY;IACzB,aAAa,EAAEG,aAAc;IAC7B,YAAY,EAAEE;EAAa,GACvBH,KAAK,EACT;AAEN,CAAC;AAEDH,YAAY,CAACO,SAAS,GAAG;EACvBL,QAAQ,EAAEL,SAAS,CAACW,MAAM,CAACC,UAAU;EACrCR,WAAW,EAAEJ,SAAS,CAACa,MAAM,CAACD;AAChC,CAAC;AAEDT,YAAY,CAACW,YAAY,GAAG,CAAC,CAAC;AAE9B,eAAeX,YAAY"}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
const _excluded = ["name", "contentType", "modifier", "children"];
|
|
3
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
4
2
|
import PropTypes from 'prop-types';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
3
|
+
import { useRouter } from 'next/router';
|
|
4
|
+
import { getActiveTab } from './helpers';
|
|
5
|
+
import { TAB, TABS, SIDEPANEL, CONTENT_GROUP, PANEL } from './constants';
|
|
6
|
+
const ContentGroupTabs = ({
|
|
7
|
+
name,
|
|
8
|
+
contentType,
|
|
9
|
+
modifier,
|
|
10
|
+
groupSections,
|
|
11
|
+
sectionsData
|
|
12
|
+
}) => {
|
|
13
|
+
const router = useRouter();
|
|
14
|
+
const [selectedTab, setSelectedTab] = useState(getActiveTab(sectionsData, ''));
|
|
15
|
+
const {
|
|
16
|
+
asPath
|
|
17
|
+
} = router;
|
|
18
|
+
const contentClassame = contentType === TAB ? TABS : SIDEPANEL;
|
|
19
|
+
const mainDivClass = `${CONTENT_GROUP}-${contentClassame}`;
|
|
20
|
+
const contentGroupClass = `${CONTENT_GROUP}-${contentClassame}__buttons-wrapper`;
|
|
21
|
+
const sectionClass = `${CONTENT_GROUP}-${contentClassame}__content-section`;
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const activeTab = getActiveTab(sectionsData, asPath);
|
|
24
|
+
if (activeTab !== selectedTab) setSelectedTab(activeTab);
|
|
25
|
+
}, [asPath, sectionsData, selectedTab]);
|
|
18
26
|
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
-
className:
|
|
27
|
+
className: mainDivClass
|
|
20
28
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
21
|
-
className:
|
|
29
|
+
className: contentGroupClass,
|
|
22
30
|
role: "tablist",
|
|
23
31
|
"aria-label": name
|
|
24
32
|
}, groupSections.map((groupSection, index) => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
settings: {
|
|
29
|
-
label: sectionLabel
|
|
30
|
-
} = {}
|
|
31
|
-
} = {}
|
|
32
|
-
} = {}
|
|
33
|
-
} = groupSection;
|
|
34
|
-
const tabId = `tab-${index}`;
|
|
35
|
-
const panelId = `panel-${index}`;
|
|
33
|
+
const [sectionName, sectioLabel] = sectionsData[index];
|
|
34
|
+
const tabId = `${TAB}-${sectionName}`;
|
|
35
|
+
const panelId = `${PANEL}-${sectionName}`;
|
|
36
36
|
const isSelected = selectedTab === tabId;
|
|
37
|
-
const buttonClassName = isSelected ?
|
|
37
|
+
const buttonClassName = `${CONTENT_GROUP}-${contentClassame}__button${isSelected ? '--is-active' : ''}`;
|
|
38
38
|
return /*#__PURE__*/React.createElement("button", {
|
|
39
39
|
id: tabId,
|
|
40
40
|
key: tabId,
|
|
@@ -43,16 +43,25 @@ const ContentGroupTabs = _ref => {
|
|
|
43
43
|
role: "tab",
|
|
44
44
|
"aria-selected": isSelected,
|
|
45
45
|
"aria-controls": panelId,
|
|
46
|
-
onClick: () =>
|
|
47
|
-
|
|
46
|
+
onClick: () => {
|
|
47
|
+
const baseUrl = asPath.split('#')[0];
|
|
48
|
+
const newUrl = `${baseUrl}#${sectionName}`;
|
|
49
|
+
if (asPath === newUrl) return;
|
|
50
|
+
router.push(`/Resolver`, newUrl, {
|
|
51
|
+
shallow: true
|
|
52
|
+
});
|
|
53
|
+
setSelectedTab(tabId);
|
|
54
|
+
}
|
|
55
|
+
}, sectioLabel);
|
|
48
56
|
})), groupSections.map((groupSection, index) => {
|
|
49
|
-
const
|
|
50
|
-
const
|
|
57
|
+
const [sectionName] = sectionsData[index];
|
|
58
|
+
const tabId = `${TAB}-${sectionName}`;
|
|
59
|
+
const panelId = `${PANEL}-${sectionName}`;
|
|
51
60
|
if (selectedTab !== tabId) return null;
|
|
52
61
|
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
-
id:
|
|
62
|
+
id: sectionName,
|
|
54
63
|
key: panelId,
|
|
55
|
-
className:
|
|
64
|
+
className: sectionClass,
|
|
56
65
|
role: "tabpanel",
|
|
57
66
|
"aria-labelledby": tabId
|
|
58
67
|
}, groupSection);
|
|
@@ -62,11 +71,11 @@ ContentGroupTabs.propTypes = {
|
|
|
62
71
|
name: PropTypes.string.isRequired,
|
|
63
72
|
contentType: PropTypes.string.isRequired,
|
|
64
73
|
modifier: PropTypes.string,
|
|
65
|
-
|
|
74
|
+
groupSections: PropTypes.array.isRequired,
|
|
75
|
+
sectionsData: PropTypes.array.isRequired
|
|
66
76
|
};
|
|
67
77
|
ContentGroupTabs.defaultProps = {
|
|
68
|
-
modifier: ''
|
|
69
|
-
children: {}
|
|
78
|
+
modifier: ''
|
|
70
79
|
};
|
|
71
80
|
export default ContentGroupTabs;
|
|
72
81
|
//# sourceMappingURL=ContentGroupTabs.js.map
|