@blaze-cms/react-page-builder 0.146.0-core-styles.45 → 0.146.0-core-styles.52
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 +20 -0
- package/lib/BannerContext/index.js +1 -2
- package/lib/BannerContext/index.js.map +1 -1
- package/lib/HOC/withInfiniteScroll.js +1 -2
- package/lib/HOC/withInfiniteScroll.js.map +1 -1
- package/lib/HOC/withTitle.js +1 -2
- package/lib/HOC/withTitle.js.map +1 -1
- package/lib/application/query/index.js +19 -15
- package/lib/application/query/index.js.map +1 -1
- package/lib/components/BackToTop/BackToTop.js +1 -2
- package/lib/components/BackToTop/BackToTop.js.map +1 -1
- package/lib/components/Banner/AdSlotRender.js +2 -3
- package/lib/components/Banner/AdSlotRender.js.map +1 -1
- package/lib/components/Banner/Banner.js +2 -3
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/index.js +1 -2
- package/lib/components/Banner/index.js.map +1 -1
- package/lib/components/BlazeLink.js +1 -2
- package/lib/components/BlazeLink.js.map +1 -1
- package/lib/components/Breadcrumb/Breadcrumb.js +2 -3
- package/lib/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/components/Button.js +1 -2
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/Card.js +4 -3
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardsContainer.js +2 -3
- package/lib/components/Card/CardsContainer.js.map +1 -1
- package/lib/components/Card/CardsRender.js +1 -2
- package/lib/components/Card/CardsRender.js.map +1 -1
- package/lib/components/Carousel/CarouselRender/CarouselRender.js +1 -0
- package/lib/components/Carousel/CarouselRender/CarouselRender.js.map +1 -1
- package/lib/components/CarouselWrapper/DefaultCarousel.js +1 -2
- package/lib/components/CarouselWrapper/DefaultCarousel.js.map +1 -1
- package/lib/components/ClickWrapper.js +1 -2
- package/lib/components/ClickWrapper.js.map +1 -1
- package/lib/components/Code/Code.js +1 -2
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/Code/ScriptTag.js +1 -2
- package/lib/components/Code/ScriptTag.js.map +1 -1
- package/lib/components/ContentGroup/ContentGroupTabs.js +2 -3
- package/lib/components/ContentGroup/ContentGroupTabs.js.map +1 -1
- package/lib/components/ContentGroup/helpers/get-sections-data.js +1 -0
- package/lib/components/ContentGroup/helpers/get-sections-data.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryFactory.js +1 -2
- package/lib/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryRender.js +1 -0
- package/lib/components/DataSummary/DataSummaryRender.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummaryContent.js +2 -3
- package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +2 -3
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummaryContent.js +2 -3
- package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummaryContent.js +2 -3
- package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummaryContent.js +2 -3
- package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/index.js +1 -2
- package/lib/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
- package/lib/components/EmailConfirm/EmailConfirm.js +1 -2
- package/lib/components/EmailConfirm/EmailConfirm.js.map +1 -1
- package/lib/components/ErrorMessage/index.js +1 -2
- package/lib/components/ErrorMessage/index.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/GlobalLightbox.js +1 -2
- package/lib/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/index.js +1 -2
- package/lib/components/Image/GlobalLightbox/index.js.map +1 -1
- package/lib/components/Image/Image.js +1 -2
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Image/ImageFactory.js +2 -3
- package/lib/components/Image/ImageFactory.js.map +1 -1
- package/lib/components/Image/Lightbox/Lightbox.js +1 -2
- package/lib/components/Image/Lightbox/Lightbox.js.map +1 -1
- package/lib/components/ItemList/ItemListButton/ItemListButton.js +23 -8
- package/lib/components/ItemList/ItemListButton/ItemListButton.js.map +1 -1
- package/lib/components/ItemList/ItemListCounter/ItemListCounter.js +2 -2
- package/lib/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -1
- package/lib/components/ItemList/helpers/get-item-list-ids.js +1 -0
- package/lib/components/ItemList/helpers/get-item-list-ids.js.map +1 -1
- package/lib/components/ItemList/icons/AddedBookmark.js +45 -0
- package/lib/components/ItemList/icons/AddedBookmark.js.map +1 -0
- package/lib/components/ItemList/icons/BaseBookmark.js +50 -0
- package/lib/components/ItemList/icons/BaseBookmark.js.map +1 -0
- package/lib/components/ItemList/icons/FocusedBookmark.js +45 -0
- package/lib/components/ItemList/icons/FocusedBookmark.js.map +1 -0
- package/lib/components/ItemList/icons/HoverBookmark.js +45 -0
- package/lib/components/ItemList/icons/HoverBookmark.js.map +1 -0
- package/lib/components/ItemList/icons/RemoveBookmark.js +45 -0
- package/lib/components/ItemList/icons/RemoveBookmark.js.map +1 -0
- package/lib/components/ItemList/icons/index.js +43 -0
- package/lib/components/ItemList/icons/index.js.map +1 -0
- package/lib/components/Layout/LayoutFactory.js +1 -2
- package/lib/components/Layout/LayoutFactory.js.map +1 -1
- package/lib/components/Layout/LayoutWithStickyTimer.js +1 -2
- package/lib/components/Layout/LayoutWithStickyTimer.js.map +1 -1
- package/lib/components/LazyImage/index.js +1 -2
- package/lib/components/LazyImage/index.js.map +1 -1
- package/lib/components/List/ListFactory.js +12 -7
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRender.js +1 -2
- package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRenderWrapper.js +2 -3
- package/lib/components/List/components/Cards/CardsRenderWrapper.js.map +1 -1
- package/lib/components/List/components/Full/FullRender.js +2 -3
- package/lib/components/List/components/Full/FullRender.js.map +1 -1
- package/lib/components/List/components/Full/FullRenderItem.js +34 -32
- package/lib/components/List/components/Full/FullRenderItem.js.map +1 -1
- package/lib/components/List/components/Header/ListHeader.js +1 -0
- package/lib/components/List/components/Header/ListHeader.js.map +1 -1
- package/lib/components/List/components/Pagination/ListPagination.js +1 -2
- package/lib/components/List/components/Pagination/ListPagination.js.map +1 -1
- package/lib/components/List/helpers/build-query-booster.js +1 -1
- package/lib/components/Menu/Menu.js +1 -2
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/MenuItem/MenuItemRender.js +1 -2
- package/lib/components/MenuItem/MenuItemRender.js.map +1 -1
- package/lib/components/ModalAdapter/index.js +1 -2
- package/lib/components/ModalAdapter/index.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js +1 -2
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchContent/SearchContentItems.js +1 -0
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js +2 -3
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +1 -2
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +1 -2
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/components/Checkbox.js +1 -2
- package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js +1 -0
- package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-select-options.js +1 -0
- package/lib/components/SearchFilter/helpers/get-select-options.js.map +1 -1
- package/lib/components/SearchFilter/helpers/parse-filter-value.js +1 -0
- package/lib/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
- package/lib/components/SearchFilterSort/SearchFilterSort.js +1 -0
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SocialFollow/SocialFollowRender.js +1 -0
- package/lib/components/SocialFollow/SocialFollowRender.js.map +1 -1
- package/lib/components/Video/VideoModal.js +1 -2
- package/lib/components/Video/VideoModal.js.map +1 -1
- package/lib/components/Video/VideoRender.js +1 -2
- package/lib/components/Video/VideoRender.js.map +1 -1
- package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js +1 -2
- package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js.map +1 -1
- package/lib/components/Video/providers/Vimeo/VimeoProvider.js +1 -2
- package/lib/components/Video/providers/Vimeo/VimeoProvider.js.map +1 -1
- package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js +1 -2
- package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
- package/lib/components/Video/providers/get-provider.js +1 -2
- package/lib/components/Video/providers/get-provider.js.map +1 -1
- package/lib/components/index.js +1 -2
- package/lib/components/index.js.map +1 -1
- package/lib/helpers/build-props-query.js +4 -2
- package/lib/helpers/build-props-query.js.map +1 -1
- package/lib/helpers/build-query-fields.js +1 -0
- package/lib/helpers/build-query-fields.js.map +1 -1
- package/lib/helpers/check-props-to-use.js +1 -0
- package/lib/helpers/check-props-to-use.js.map +1 -1
- package/lib/helpers/get-entities-with-banner.js +1 -1
- package/lib/helpers/get-wrapped-value-with-link.js +1 -0
- package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-entities/get-banners-for-entities.js +1 -0
- package/lib/helpers/inject-multiple-banners/get-banners-for-entities/get-banners-for-entities.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js +1 -1
- package/lib/helpers/is-filter-entitys-id.js +0 -1
- package/lib/helpers/is-filter-entitys-id.js.map +1 -1
- package/lib/helpers/parse-TextBlock.js +1 -2
- package/lib/helpers/parse-TextBlock.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js +1 -2
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib/helpers/process-data-summary-value.js +1 -1
- package/lib/helpers/remove-unwanted-characters.js +1 -1
- package/lib/hooks/helpers/RenderComponent.js +0 -1
- package/lib/hooks/helpers/RenderComponent.js.map +1 -1
- package/lib/hooks/helpers/check-collisions.js +0 -1
- package/lib/hooks/helpers/check-collisions.js.map +1 -1
- package/lib/hooks/helpers/get-lightbox-images.js +1 -2
- package/lib/hooks/helpers/get-lightbox-images.js.map +1 -1
- package/lib/hooks/use-portal.js +1 -2
- package/lib/hooks/use-portal.js.map +1 -1
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -1
- package/lib/utils/get-class-modifiers.js +0 -1
- package/lib/utils/get-class-modifiers.js.map +1 -1
- package/lib/utils/get-props-to-display-modifiers.js +1 -0
- package/lib/utils/get-props-to-display-modifiers.js.map +1 -1
- package/lib/variants/Infographic/index.js +1 -2
- package/lib/variants/Infographic/index.js.map +1 -1
- package/lib/variants/LiveBlogList/LiveBlogList.js +115 -0
- package/lib/variants/LiveBlogList/LiveBlogList.js.map +1 -0
- package/lib/variants/LiveBlogList/index.js +42 -0
- package/lib/variants/LiveBlogList/index.js.map +1 -0
- package/lib/variants/LongformGallery/LongformGallery.js +1 -0
- package/lib/variants/LongformGallery/LongformGallery.js.map +1 -1
- package/lib/variants/LongformGallery/index.js +1 -2
- package/lib/variants/LongformGallery/index.js.map +1 -1
- package/lib/variants/SlideSummary/index.js +1 -2
- package/lib/variants/SlideSummary/index.js.map +1 -1
- package/lib/variants/ThumbnailCarousel/ThumbnailCarousel.js +1 -0
- package/lib/variants/ThumbnailCarousel/ThumbnailCarousel.js.map +1 -1
- package/lib/variants/ThumbnailCarousel/index.js +1 -2
- package/lib/variants/ThumbnailCarousel/index.js.map +1 -1
- package/lib/variants/index.js +3 -1
- package/lib/variants/index.js.map +1 -1
- package/lib-es/application/query/index.js +9 -1
- package/lib-es/application/query/index.js.map +1 -1
- package/lib-es/components/Card/Card.js +3 -1
- package/lib-es/components/Card/Card.js.map +1 -1
- package/lib-es/components/ItemList/ItemListButton/ItemListButton.js +15 -6
- package/lib-es/components/ItemList/ItemListButton/ItemListButton.js.map +1 -1
- package/lib-es/components/ItemList/ItemListCounter/ItemListCounter.js +2 -2
- package/lib-es/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -1
- package/lib-es/components/ItemList/icons/AddedBookmark.js +36 -0
- package/lib-es/components/ItemList/icons/AddedBookmark.js.map +1 -0
- package/lib-es/components/ItemList/icons/BaseBookmark.js +41 -0
- package/lib-es/components/ItemList/icons/BaseBookmark.js.map +1 -0
- package/lib-es/components/ItemList/icons/FocusedBookmark.js +36 -0
- package/lib-es/components/ItemList/icons/FocusedBookmark.js.map +1 -0
- package/lib-es/components/ItemList/icons/HoverBookmark.js +36 -0
- package/lib-es/components/ItemList/icons/HoverBookmark.js.map +1 -0
- package/lib-es/components/ItemList/icons/RemoveBookmark.js +36 -0
- package/lib-es/components/ItemList/icons/RemoveBookmark.js.map +1 -0
- package/lib-es/components/ItemList/icons/index.js +6 -0
- package/lib-es/components/ItemList/icons/index.js.map +1 -0
- package/lib-es/components/List/ListFactory.js +10 -4
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/components/Full/FullRenderItem.js +34 -30
- package/lib-es/components/List/components/Full/FullRenderItem.js.map +1 -1
- package/lib-es/helpers/build-props-query.js +4 -2
- package/lib-es/helpers/build-props-query.js.map +1 -1
- package/lib-es/index.js +1 -1
- package/lib-es/index.js.map +1 -1
- package/lib-es/variants/LiveBlogList/LiveBlogList.js +90 -0
- package/lib-es/variants/LiveBlogList/LiveBlogList.js.map +1 -0
- package/lib-es/variants/LiveBlogList/index.js +12 -0
- package/lib-es/variants/LiveBlogList/index.js.map +1 -0
- package/lib-es/variants/index.js +3 -1
- package/lib-es/variants/index.js.map +1 -1
- package/package.json +6 -6
- package/src/application/query/index.js +11 -1
- package/src/components/Card/Card.js +2 -1
- package/src/components/ItemList/ItemListButton/ItemListButton.js +23 -12
- package/src/components/ItemList/ItemListCounter/ItemListCounter.js +2 -2
- package/src/components/ItemList/icons/AddedBookmark.js +33 -0
- package/src/components/ItemList/icons/BaseBookmark.js +39 -0
- package/src/components/ItemList/icons/FocusedBookmark.js +33 -0
- package/src/components/ItemList/icons/HoverBookmark.js +33 -0
- package/src/components/ItemList/icons/RemoveBookmark.js +33 -0
- package/src/components/ItemList/icons/index.js +5 -0
- package/src/components/List/ListFactory.js +13 -4
- package/src/components/List/components/Full/FullRenderItem.js +45 -28
- package/src/helpers/build-props-query.js +3 -2
- package/src/index.js +2 -1
- package/src/variants/LiveBlogList/LiveBlogList.js +109 -0
- package/src/variants/LiveBlogList/index.js +13 -0
- package/src/variants/index.js +3 -1
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListButton.test.js.snap +151 -43
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListCounter.test.js.snap +35 -9
- package/tests/unit/src/helpers/build-props-query.test.js +13 -11
|
@@ -6,44 +6,39 @@ import React, { useContext } from 'react';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { Waypoint } from 'react-waypoint';
|
|
8
8
|
import { MainContext } from '@blaze-cms/nextjs-components';
|
|
9
|
+
import { VariantContext } from '../../ListFactory';
|
|
9
10
|
import BuildPBComponents from '../../../../hooks/helpers/buildPBComponents';
|
|
10
11
|
import Banner from '../../../Banner';
|
|
11
12
|
import { parsePropsToDisplay, shouldRenderWaypoint } from '../../../../helpers';
|
|
12
|
-
const FullRenderItem =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
const FullRenderItem = props => {
|
|
14
|
+
const {
|
|
15
|
+
isInfinite,
|
|
16
|
+
pageBuilderComponents,
|
|
17
|
+
entityProps,
|
|
18
|
+
propsToDisplay,
|
|
19
|
+
entity,
|
|
20
|
+
index,
|
|
21
|
+
itemId,
|
|
22
|
+
listTotal,
|
|
23
|
+
initialOffset,
|
|
24
|
+
currentListLength,
|
|
25
|
+
triggerInfiniteScroll,
|
|
26
|
+
parent,
|
|
27
|
+
pageBuilderID,
|
|
28
|
+
displayCount,
|
|
29
|
+
shouldRenderBanner,
|
|
30
|
+
bannerProps,
|
|
31
|
+
bannerIndex
|
|
32
|
+
} = props;
|
|
31
33
|
const {
|
|
32
34
|
hasGTM
|
|
33
35
|
} = useContext(MainContext);
|
|
36
|
+
const VariantComponent = useContext(VariantContext);
|
|
34
37
|
if (!pageBuilderComponents) return null;
|
|
35
38
|
const parsedPropsToDisplay = parsePropsToDisplay(entityProps, propsToDisplay);
|
|
36
39
|
const currentItemIndex = initialOffset + index;
|
|
37
40
|
const renderWaypoint = isInfinite && shouldRenderWaypoint(index, currentListLength, currentItemIndex, listTotal);
|
|
38
|
-
|
|
39
|
-
onEnter: triggerInfiniteScroll
|
|
40
|
-
}), displayCount && /*#__PURE__*/React.createElement("div", {
|
|
41
|
-
className: "heading heading--section heading--section--count"
|
|
42
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
43
|
-
className: "section-number"
|
|
44
|
-
}, currentItemIndex + 1), /*#__PURE__*/React.createElement("span", {
|
|
45
|
-
className: "section-total"
|
|
46
|
-
}, "/", listTotal)), /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
const defaultContent = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
47
42
|
className: "list__item list__item--full"
|
|
48
43
|
}, BuildPBComponents(pageBuilderComponents, {
|
|
49
44
|
parent: _objectSpread(_objectSpread({}, parent), {}, {
|
|
@@ -52,9 +47,18 @@ const FullRenderItem = ({
|
|
|
52
47
|
}),
|
|
53
48
|
hasGTM,
|
|
54
49
|
pageBuilderID
|
|
55
|
-
})), !!parsedPropsToDisplay.length && /*#__PURE__*/React.createElement(React.Fragment, null, parsedPropsToDisplay.map(prop => prop ? /*#__PURE__*/React.createElement("span", {
|
|
50
|
+
})), !VariantComponent && !!parsedPropsToDisplay.length && /*#__PURE__*/React.createElement(React.Fragment, null, parsedPropsToDisplay.map(prop => prop ? /*#__PURE__*/React.createElement("span", {
|
|
56
51
|
key: prop
|
|
57
|
-
}, prop) : null))
|
|
52
|
+
}, prop) : null)));
|
|
53
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderWaypoint && /*#__PURE__*/React.createElement(Waypoint, {
|
|
54
|
+
onEnter: triggerInfiniteScroll
|
|
55
|
+
}), displayCount && /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: "heading heading--section heading--section--count"
|
|
57
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
58
|
+
className: "section-number"
|
|
59
|
+
}, currentItemIndex + 1), /*#__PURE__*/React.createElement("span", {
|
|
60
|
+
className: "section-total"
|
|
61
|
+
}, "/", listTotal)), VariantComponent ? /*#__PURE__*/React.createElement(VariantComponent, props, defaultContent) : defaultContent, shouldRenderBanner && /*#__PURE__*/React.createElement(Banner, _extends({}, bannerProps, {
|
|
58
62
|
renderCounter: bannerIndex
|
|
59
63
|
})));
|
|
60
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullRenderItem.js","names":["React","useContext","PropTypes","Waypoint","MainContext","BuildPBComponents","Banner","parsePropsToDisplay","shouldRenderWaypoint","FullRenderItem","isInfinite","pageBuilderComponents","entityProps","propsToDisplay","entity","index","itemId","listTotal","initialOffset","currentListLength","triggerInfiniteScroll","parent","pageBuilderID","displayCount","shouldRenderBanner","bannerProps","bannerIndex","hasGTM","parsedPropsToDisplay","currentItemIndex","renderWaypoint","
|
|
1
|
+
{"version":3,"file":"FullRenderItem.js","names":["React","useContext","PropTypes","Waypoint","MainContext","VariantContext","BuildPBComponents","Banner","parsePropsToDisplay","shouldRenderWaypoint","FullRenderItem","props","isInfinite","pageBuilderComponents","entityProps","propsToDisplay","entity","index","itemId","listTotal","initialOffset","currentListLength","triggerInfiniteScroll","parent","pageBuilderID","displayCount","shouldRenderBanner","bannerProps","bannerIndex","hasGTM","VariantComponent","parsedPropsToDisplay","currentItemIndex","renderWaypoint","defaultContent","createElement","Fragment","className","_objectSpread","itemEntity","length","map","prop","key","onEnter","_extends","renderCounter","propTypes","array","object","isRequired","number","bool","func","string","data","itemsToDisplay","defaultProps"],"sources":["../../../../../src/components/List/components/Full/FullRenderItem.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport { Waypoint } from 'react-waypoint';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { VariantContext } from '../../ListFactory';\nimport BuildPBComponents from '../../../../hooks/helpers/buildPBComponents';\nimport Banner from '../../../Banner';\nimport { parsePropsToDisplay, shouldRenderWaypoint } from '../../../../helpers';\n\nconst FullRenderItem = props => {\n const {\n isInfinite,\n pageBuilderComponents,\n entityProps,\n propsToDisplay,\n entity,\n index,\n itemId,\n listTotal,\n initialOffset,\n currentListLength,\n triggerInfiniteScroll,\n parent,\n pageBuilderID,\n displayCount,\n shouldRenderBanner,\n bannerProps,\n bannerIndex\n } = props;\n const { hasGTM } = useContext(MainContext);\n const VariantComponent = useContext(VariantContext);\n\n if (!pageBuilderComponents) return null;\n const parsedPropsToDisplay = parsePropsToDisplay(entityProps, propsToDisplay);\n const currentItemIndex = initialOffset + index;\n const renderWaypoint =\n isInfinite && shouldRenderWaypoint(index, currentListLength, currentItemIndex, listTotal);\n\n const defaultContent = (\n <>\n <div className=\"list__item list__item--full\">\n {BuildPBComponents(pageBuilderComponents, {\n parent: { ...parent, itemId, itemEntity: entity },\n hasGTM,\n pageBuilderID\n })}\n </div>\n {!VariantComponent &&\n !!parsedPropsToDisplay.length && (\n <>{parsedPropsToDisplay.map(prop => (prop ? <span key={prop}>{prop}</span> : null))}</>\n )}\n </>\n );\n\n return (\n <>\n {renderWaypoint && <Waypoint onEnter={triggerInfiniteScroll} />}\n {displayCount && (\n <div className=\"heading heading--section heading--section--count\">\n <span className=\"section-number\">{currentItemIndex + 1}</span>\n <span className=\"section-total\">/{listTotal}</span>\n </div>\n )}\n {VariantComponent ? (\n <VariantComponent {...props}>{defaultContent}</VariantComponent>\n ) : (\n defaultContent\n )}\n\n {shouldRenderBanner && <Banner {...bannerProps} renderCounter={bannerIndex} />}\n </>\n );\n};\n\nFullRenderItem.propTypes = {\n pageBuilderComponents: PropTypes.array,\n entityProps: PropTypes.object.isRequired,\n parent: PropTypes.object.isRequired,\n currentListLength: PropTypes.number.isRequired,\n listTotal: PropTypes.number.isRequired,\n initialOffset: PropTypes.number.isRequired,\n displayCount: PropTypes.bool.isRequired,\n triggerInfiniteScroll: PropTypes.func,\n entity: PropTypes.string.isRequired,\n pageBuilderID: PropTypes.string.isRequired,\n itemId: PropTypes.string.isRequired,\n index: PropTypes.number.isRequired,\n isInfinite: PropTypes.bool.isRequired,\n shouldRenderBanner: PropTypes.bool.isRequired,\n bannerIndex: PropTypes.number.isRequired,\n propsToDisplay: PropTypes.array,\n data: PropTypes.array,\n itemsToDisplay: PropTypes.array,\n bannerProps: PropTypes.object\n};\n\nFullRenderItem.defaultProps = {\n pageBuilderComponents: null,\n data: [],\n propsToDisplay: [],\n itemsToDisplay: [],\n triggerInfiniteScroll: null,\n bannerProps: null\n};\n\nexport default FullRenderItem;\n"],"mappings":";;;;AAAA,OA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AAS,CAACiD,MAAM,CAACD,UAAU;EAC9C/B,SAAS,EAAEjB,SAAS,CAACiD,MAAM,CAACD,UAAU;EACtC9B,aAAa,EAAElB,SAAS,CAACiD,MAAM,CAACD,UAAU;EAC1CzB,YAAY,EAAEvB,SAAS,CAACkD,IAAI,CAACF,UAAU;EACvC5B,qBAAqB,EAAEpB,SAAS,CAACmD,IAAI;EACrCrC,MAAM,EAAEd,SAAS,CAACoD,MAAM,CAACJ,UAAU;EACnC1B,aAAa,EAAEtB,SAAS,CAACoD,MAAM,CAACJ,UAAU;EAC1ChC,MAAM,EAAEhB,SAAS,CAACoD,MAAM,CAACJ,UAAU;EACnCjC,KAAK,EAAEf,SAAS,CAACiD,MAAM,CAACD,UAAU;EAClCtC,UAAU,EAAEV,SAAS,CAACkD,IAAI,CAACF,UAAU;EACrCxB,kBAAkB,EAAExB,SAAS,CAACkD,IAAI,CAACF,UAAU;EAC7CtB,WAAW,EAAE1B,SAAS,CAACiD,MAAM,CAACD,UAAU;EACxCnC,cAAc,EAAEb,SAAS,CAAC8C,KAAK;EAC/BO,IAAI,EAAErD,SAAS,CAAC8C,KAAK;EACrBQ,cAAc,EAAEtD,SAAS,CAAC8C,KAAK;EAC/BrB,WAAW,EAAEzB,SAAS,CAAC+C;AACzB,CAAC;AAEDvC,cAAc,CAAC+C,YAAY,GAAG;EAC5B5C,qBAAqB,EAAE,IAAI;EAC3B0C,IAAI,EAAE,EAAE;EACRxC,cAAc,EAAE,EAAE;EAClByC,cAAc,EAAE,EAAE;EAClBlC,qBAAqB,EAAE,IAAI;EAC3BK,WAAW,EAAE;AACf,CAAC;AAED,eAAejB,cAAc","ignoreList":[]}
|
|
@@ -64,7 +64,7 @@ const getTypeBaseProps = (entitySchema, cardOptions, extraPropsHaveCategory) =>
|
|
|
64
64
|
dynamicProperties,
|
|
65
65
|
relations
|
|
66
66
|
} = entitySchema;
|
|
67
|
-
const isContent = !!interfaces.includes('content/content');
|
|
67
|
+
const isContent = !!interfaces.includes('content/content-base');
|
|
68
68
|
const hasCategory = checkProps(properties) || checkProps(dynamicProperties);
|
|
69
69
|
const hasPreheader = properties[PREHEADER_PROP];
|
|
70
70
|
const typeBasedProps = [...defaultProps];
|
|
@@ -81,7 +81,9 @@ const getTypeBaseProps = (entitySchema, cardOptions, extraPropsHaveCategory) =>
|
|
|
81
81
|
shouldAddCategoryProps
|
|
82
82
|
};
|
|
83
83
|
};
|
|
84
|
-
|
|
84
|
+
|
|
85
|
+
// make sure all props are supported by content/content-base interface
|
|
86
|
+
const getContentProps = isContent => isContent ? ['url', 'sponsored', 'featured', 'live'] : [];
|
|
85
87
|
const getCategoyProps = (shouldAddCategoryProps, hasCategory, hasPreheader) => {
|
|
86
88
|
if (!shouldAddCategoryProps) return [];
|
|
87
89
|
const props = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-props-query.js","names":["CATEGORY_ID","ID","PREHEADER_PROP","HEADLINE_PROP","defaultProps","categoryProps","checkProps","props","Object","keys","filter","prop","length","buildPropsQuery","entitySchema","extraProps","cardOptions","linkProps","parsedSchema","getEntitySchema","extraPropsHaveCategory","includes","typeBasedProps","shouldAddCategoryProps","getTypeBaseProps","allProps","uniqueProps","Set","basicProps","nestedProps","forEach","push","base","nested","split","complexProps","buildComplexProps","join","relations","dynamicProperties","properties","map","hasLink","find","linkProp","matchingProperty","matchingRelation","localField","matchingDynamicProp","dynamicKey","jointNestedProps","isCard","displayCategory","displayThumbnail","interfaces","isContent","hasCategory","hasPreheader","getCategoyProps","getContentProps","url"],"sources":["../../src/helpers/build-props-query.js"],"sourcesContent":["import { CATEGORY_ID, ID, PREHEADER_PROP, HEADLINE_PROP } from '../constants';\n\nconst defaultProps = [ID, 'name'];\nconst categoryProps = 'id publishedListingPage{id, url}';\n\nconst checkProps = props =>\n !!(props && Object.keys(props).filter(prop => prop === CATEGORY_ID).length);\n\nconst buildPropsQuery = (entitySchema, extraProps = [], cardOptions = null, linkProps = []) => {\n const parsedSchema = entitySchema.getEntitySchema ? entitySchema.getEntitySchema : entitySchema;\n const extraPropsHaveCategory = !!extraProps.filter(prop => prop.includes('category.')).length;\n const { typeBasedProps, shouldAddCategoryProps } = getTypeBaseProps(\n parsedSchema,\n cardOptions,\n extraPropsHaveCategory\n );\n\n const allProps = [...typeBasedProps, ...extraProps];\n const uniqueProps = [...new Set([...allProps])];\n const basicProps = [];\n const nestedProps = {};\n uniqueProps.forEach(prop => {\n if (prop) {\n if (!prop.includes('.')) {\n basicProps.push(prop);\n return;\n }\n const [base, nested] = prop.split('.');\n if (!nestedProps[base]) nestedProps[base] = [nested];\n else nestedProps[base].push(nested);\n }\n });\n\n const complexProps = buildComplexProps(\n shouldAddCategoryProps,\n nestedProps,\n parsedSchema,\n linkProps\n );\n\n return [...basicProps, ...complexProps].join(',');\n};\n\nconst buildComplexProps = (\n shouldAddCategoryProps,\n props,\n { relations = [], dynamicProperties = {}, properties = {} },\n linkProps\n) =>\n Object.keys(props).map(base => {\n const nestedProps = props[base];\n const hasLink = !!linkProps.find(linkProp => linkProp.includes(base));\n const matchingProperty = !!properties[base];\n const matchingRelation = relations.find(({ localField }) => localField === base);\n const matchingDynamicProp = Object.keys(dynamicProperties).find(\n dynamicKey => dynamicKey === base\n );\n\n if (matchingRelation && !nestedProps.includes('id')) nestedProps.push('id');\n if (hasLink && (!!matchingProperty || !!matchingRelation || !!matchingDynamicProp))\n nestedProps.push('url');\n const jointNestedProps = nestedProps.join(',');\n if (base === 'category' && shouldAddCategoryProps)\n return `${base}{${jointNestedProps}, ${categoryProps}}`;\n if (base.includes('published')) {\n return `${base}{${jointNestedProps},url}`;\n }\n return `${base}{${jointNestedProps}}`;\n });\n\nconst getTypeBaseProps = (entitySchema, cardOptions, extraPropsHaveCategory) => {\n const isCard = !!cardOptions;\n const { displayCategory = true, displayThumbnail = true } = cardOptions || {};\n\n const shouldAddCategoryProps =\n (isCard && displayCategory) || (!isCard && !extraPropsHaveCategory);\n\n if (!isCard) return { typeBasedProps: [ID], shouldAddCategoryProps };\n\n const { interfaces, properties, dynamicProperties, relations } = entitySchema;\n\n const isContent = !!interfaces.includes('content/content');\n const hasCategory = checkProps(properties) || checkProps(dynamicProperties);\n const hasPreheader = properties[PREHEADER_PROP];\n\n const typeBasedProps = [...defaultProps];\n\n typeBasedProps.push(...getCategoyProps(shouldAddCategoryProps, hasCategory, hasPreheader));\n typeBasedProps.push(...getContentProps(isContent));\n\n if (properties.url || dynamicProperties.url) typeBasedProps.push('url');\n\n if (displayThumbnail && relations.find(({ localField }) => localField === 'image')) {\n typeBasedProps.push('image.id', 'image.url', 'image.data');\n }\n\n return { typeBasedProps, shouldAddCategoryProps };\n};\n\nconst getContentProps = isContent => (isContent ? ['url', 'sponsored', 'featured'] : []);\n\nconst getCategoyProps = (shouldAddCategoryProps, hasCategory, hasPreheader) => {\n if (!shouldAddCategoryProps) return [];\n const props = [];\n if (hasCategory)\n props.push('category.name', 'category.listingPageId', 'category.listingPageEntity');\n\n if (hasPreheader) {\n props.push(`${PREHEADER_PROP}{name}`);\n props.push(HEADLINE_PROP);\n }\n\n return props;\n};\n\nexport default buildPropsQuery;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,EAAE,EAAEC,cAAc,EAAEC,aAAa,QAAQ,cAAc;AAE7E,MAAMC,YAAY,GAAG,CAACH,EAAE,EAAE,MAAM,CAAC;AACjC,MAAMI,aAAa,GAAG,kCAAkC;AAExD,MAAMC,UAAU,GAAGC,KAAK,IACtB,CAAC,EAAEA,KAAK,IAAIC,MAAM,CAACC,IAAI,CAACF,KAAK,CAAC,CAACG,MAAM,CAACC,IAAI,IAAIA,IAAI,KAAKX,WAAW,CAAC,CAACY,MAAM,CAAC;AAE7E,MAAMC,eAAe,GAAGA,CAACC,YAAY,EAAEC,UAAU,GAAG,EAAE,EAAEC,WAAW,GAAG,IAAI,EAAEC,SAAS,GAAG,EAAE,KAAK;EAC7F,MAAMC,YAAY,GAAGJ,YAAY,CAACK,eAAe,GAAGL,YAAY,C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AGlB,IAAI,IAAIkB,gBAAgB,GAAG;AACvC,CAAC,CAAC;AAEJ,MAAM1B,gBAAgB,GAAGA,CAACV,YAAY,EAAEE,WAAW,EAAEI,sBAAsB,KAAK;EAC9E,MAAM+B,MAAM,GAAG,CAAC,CAACnC,WAAW;EAC5B,MAAM;IAAEoC,eAAe,GAAG,IAAI;IAAEC,gBAAgB,GAAG;EAAK,CAAC,GAAGrC,WAAW,IAAI,CAAC,CAAC;EAE7E,MAAMO,sBAAsB,GACzB4B,MAAM,IAAIC,eAAe,IAAM,CAACD,MAAM,IAAI,CAAC/B,sBAAuB;EAErE,IAAI,CAAC+B,MAAM,EAAE,OAAO;IAAE7B,cAAc,EAAE,CAACrB,EAAE,CAAC;IAAEsB;EAAuB,CAAC;EAEpE,MAAM;IAAE+B,UAAU;IAAEd,UAAU;IAAED,iBAAiB;IAAED;EAAU,CAAC,GAAGxB,YAAY;EAE7E,MAAMyC,SAAS,GAAG,CAAC,CAACD,UAAU,CAACjC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"build-props-query.js","names":["CATEGORY_ID","ID","PREHEADER_PROP","HEADLINE_PROP","defaultProps","categoryProps","checkProps","props","Object","keys","filter","prop","length","buildPropsQuery","entitySchema","extraProps","cardOptions","linkProps","parsedSchema","getEntitySchema","extraPropsHaveCategory","includes","typeBasedProps","shouldAddCategoryProps","getTypeBaseProps","allProps","uniqueProps","Set","basicProps","nestedProps","forEach","push","base","nested","split","complexProps","buildComplexProps","join","relations","dynamicProperties","properties","map","hasLink","find","linkProp","matchingProperty","matchingRelation","localField","matchingDynamicProp","dynamicKey","jointNestedProps","isCard","displayCategory","displayThumbnail","interfaces","isContent","hasCategory","hasPreheader","getCategoyProps","getContentProps","url"],"sources":["../../src/helpers/build-props-query.js"],"sourcesContent":["import { CATEGORY_ID, ID, PREHEADER_PROP, HEADLINE_PROP } from '../constants';\n\nconst defaultProps = [ID, 'name'];\nconst categoryProps = 'id publishedListingPage{id, url}';\n\nconst checkProps = props =>\n !!(props && Object.keys(props).filter(prop => prop === CATEGORY_ID).length);\n\nconst buildPropsQuery = (entitySchema, extraProps = [], cardOptions = null, linkProps = []) => {\n const parsedSchema = entitySchema.getEntitySchema ? entitySchema.getEntitySchema : entitySchema;\n const extraPropsHaveCategory = !!extraProps.filter(prop => prop.includes('category.')).length;\n const { typeBasedProps, shouldAddCategoryProps } = getTypeBaseProps(\n parsedSchema,\n cardOptions,\n extraPropsHaveCategory\n );\n\n const allProps = [...typeBasedProps, ...extraProps];\n const uniqueProps = [...new Set([...allProps])];\n const basicProps = [];\n const nestedProps = {};\n uniqueProps.forEach(prop => {\n if (prop) {\n if (!prop.includes('.')) {\n basicProps.push(prop);\n return;\n }\n const [base, nested] = prop.split('.');\n if (!nestedProps[base]) nestedProps[base] = [nested];\n else nestedProps[base].push(nested);\n }\n });\n\n const complexProps = buildComplexProps(\n shouldAddCategoryProps,\n nestedProps,\n parsedSchema,\n linkProps\n );\n\n return [...basicProps, ...complexProps].join(',');\n};\n\nconst buildComplexProps = (\n shouldAddCategoryProps,\n props,\n { relations = [], dynamicProperties = {}, properties = {} },\n linkProps\n) =>\n Object.keys(props).map(base => {\n const nestedProps = props[base];\n const hasLink = !!linkProps.find(linkProp => linkProp.includes(base));\n const matchingProperty = !!properties[base];\n const matchingRelation = relations.find(({ localField }) => localField === base);\n const matchingDynamicProp = Object.keys(dynamicProperties).find(\n dynamicKey => dynamicKey === base\n );\n\n if (matchingRelation && !nestedProps.includes('id')) nestedProps.push('id');\n if (hasLink && (!!matchingProperty || !!matchingRelation || !!matchingDynamicProp))\n nestedProps.push('url');\n const jointNestedProps = nestedProps.join(',');\n if (base === 'category' && shouldAddCategoryProps)\n return `${base}{${jointNestedProps}, ${categoryProps}}`;\n if (base.includes('published')) {\n return `${base}{${jointNestedProps},url}`;\n }\n return `${base}{${jointNestedProps}}`;\n });\n\nconst getTypeBaseProps = (entitySchema, cardOptions, extraPropsHaveCategory) => {\n const isCard = !!cardOptions;\n const { displayCategory = true, displayThumbnail = true } = cardOptions || {};\n\n const shouldAddCategoryProps =\n (isCard && displayCategory) || (!isCard && !extraPropsHaveCategory);\n\n if (!isCard) return { typeBasedProps: [ID], shouldAddCategoryProps };\n\n const { interfaces, properties, dynamicProperties, relations } = entitySchema;\n\n const isContent = !!interfaces.includes('content/content-base');\n const hasCategory = checkProps(properties) || checkProps(dynamicProperties);\n const hasPreheader = properties[PREHEADER_PROP];\n\n const typeBasedProps = [...defaultProps];\n\n typeBasedProps.push(...getCategoyProps(shouldAddCategoryProps, hasCategory, hasPreheader));\n typeBasedProps.push(...getContentProps(isContent));\n\n if (properties.url || dynamicProperties.url) typeBasedProps.push('url');\n\n if (displayThumbnail && relations.find(({ localField }) => localField === 'image')) {\n typeBasedProps.push('image.id', 'image.url', 'image.data');\n }\n\n return { typeBasedProps, shouldAddCategoryProps };\n};\n\n// make sure all props are supported by content/content-base interface\nconst getContentProps = isContent => (isContent ? ['url', 'sponsored', 'featured', 'live'] : []);\n\nconst getCategoyProps = (shouldAddCategoryProps, hasCategory, hasPreheader) => {\n if (!shouldAddCategoryProps) return [];\n const props = [];\n if (hasCategory)\n props.push('category.name', 'category.listingPageId', 'category.listingPageEntity');\n\n if (hasPreheader) {\n props.push(`${PREHEADER_PROP}{name}`);\n props.push(HEADLINE_PROP);\n }\n\n return props;\n};\n\nexport default buildPropsQuery;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,EAAE,EAAEC,cAAc,EAAEC,aAAa,QAAQ,cAAc;AAE7E,MAAMC,YAAY,GAAG,CAACH,EAAE,EAAE,MAAM,CAAC;AACjC,MAAMI,aAAa,GAAG,kCAAkC;AAExD,MAAMC,UAAU,GAAGC,KAAK,IACtB,CAAC,EAAEA,KAAK,IAAIC,MAAM,CAACC,IAAI,CAACF,KAAK,CAAC,CAACG,MAAM,CAACC,IAAI,IAAIA,IAAI,KAAKX,WAAW,CAAC,CAACY,MAAM,CAAC;AAE7E,MAAMC,eAAe,GAAGA,CAACC,Y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AAEtC,cAAc,CAACS,IAAI,CAAC,KAAK,CAAC;EAEvE,IAAIsB,gBAAgB,IAAIf,SAAS,CAACK,IAAI,CAAC,CAAC;IAAEI;EAAW,CAAC,KAAKA,UAAU,KAAK,OAAO,CAAC,EAAE;IAClFzB,cAAc,CAACS,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,YAAY,CAAC;EAC5D;EAEA,OAAO;IAAET,cAAc;IAAEC;EAAuB,CAAC;AACnD,CAAC;;AAED;AACA,MAAMoC,eAAe,GAAGJ,SAAS,IAAKA,SAAS,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,GAAG,EAAG;AAEhG,MAAMG,eAAe,GAAGA,CAACnC,sBAAsB,EAAEiC,WAAW,EAAEC,YAAY,KAAK;EAC7E,IAAI,CAAClC,sBAAsB,EAAE,OAAO,EAAE;EACtC,MAAMhB,KAAK,GAAG,EAAE;EAChB,IAAIiD,WAAW,EACbjD,KAAK,CAACwB,IAAI,CAAC,eAAe,EAAE,wBAAwB,EAAE,4BAA4B,CAAC;EAErF,IAAI0B,YAAY,EAAE;IAChBlD,KAAK,CAACwB,IAAI,CAAC,GAAG7B,cAAc,QAAQ,CAAC;IACrCK,KAAK,CAACwB,IAAI,CAAC5B,aAAa,CAAC;EAC3B;EAEA,OAAOI,KAAK;AACd,CAAC;AAED,eAAeM,eAAe","ignoreList":[]}
|
package/lib-es/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export { default as variants } from './variants';
|
|
|
7
7
|
export { default as LoadingComponent } from './components/Loading';
|
|
8
8
|
export { default as Modal } from './components/ModalAdapter';
|
|
9
9
|
export { default as ErrorMessage } from './components/ErrorMessage';
|
|
10
|
-
export { getAction, generateSingleItemQuery, generateMultiItemQuery, getEntitySchema, getSingleEntitySchema, getUser } from './application/query';
|
|
10
|
+
export { getAction, generateSingleItemQuery, generateMultiItemQuery, getEntitySchema, getSingleEntitySchema, getUser, getCurrentUser } from './application/query';
|
|
11
11
|
export { getInheritedFilters, getQueryProps, buildRawQuery, buildPropsQuery, buildRawQueryStringified, buildFiltersQuery, getUnpublishedEntityName, renderChildren, hasChildren } from './helpers';
|
|
12
12
|
export { withTitle } from './HOC';
|
|
13
13
|
export { useGetEntitySchema, useGetEntitySchemasAsObj, useGetSingleEntitySchema } from './hooks';
|
package/lib-es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","buildPBComponents","getLightboxImages","getComponent","componentMap","variantHandler","getClassModifiers","components","variants","LoadingComponent","Modal","ErrorMessage","getAction","generateSingleItemQuery","generateMultiItemQuery","getEntitySchema","getSingleEntitySchema","getUser","getInheritedFilters","getQueryProps","buildRawQuery","buildPropsQuery","buildRawQueryStringified","buildFiltersQuery","getUnpublishedEntityName","renderChildren","hasChildren","withTitle","useGetEntitySchema","useGetEntitySchemasAsObj","useGetSingleEntitySchema","summaryComponents","buildPropsToDisplayWithContent"],"sources":["../src/index.js"],"sourcesContent":["export { default as buildPBComponents } from './hooks/helpers/buildPBComponents';\nexport { default as getLightboxImages } from './hooks/helpers/get-lightbox-images';\nexport { default as getComponent } from './hooks/helpers/getComponent';\nexport { componentMap, variantHandler, getClassModifiers } from './utils';\nexport { default as components } from './components';\nexport { default as variants } from './variants';\nexport { default as LoadingComponent } from './components/Loading';\nexport { default as Modal } from './components/ModalAdapter';\nexport { default as ErrorMessage } from './components/ErrorMessage';\nexport {\n getAction,\n generateSingleItemQuery,\n generateMultiItemQuery,\n getEntitySchema,\n getSingleEntitySchema,\n getUser\n} from './application/query';\nexport {\n getInheritedFilters,\n getQueryProps,\n buildRawQuery,\n buildPropsQuery,\n buildRawQueryStringified,\n buildFiltersQuery,\n getUnpublishedEntityName,\n renderChildren,\n hasChildren\n} from './helpers';\nexport { withTitle } from './HOC';\nexport { useGetEntitySchema, useGetEntitySchemasAsObj, useGetSingleEntitySchema } from './hooks';\nexport { summaryComponents } from './components/DataSummary/DataSummaryTypes';\nexport { buildPropsToDisplayWithContent } from './components/DataSummary/helpers';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,iBAAiB,QAAQ,mCAAmC;AAChF,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,qCAAqC;AAClF,SAASF,OAAO,IAAIG,YAAY,QAAQ,8BAA8B;AACtE,SAASC,YAAY,EAAEC,cAAc,EAAEC,iBAAiB,QAAQ,SAAS;AACzE,SAASN,OAAO,IAAIO,UAAU,QAAQ,cAAc;AACpD,SAASP,OAAO,IAAIQ,QAAQ,QAAQ,YAAY;AAChD,SAASR,OAAO,IAAIS,gBAAgB,QAAQ,sBAAsB;AAClE,SAAST,OAAO,IAAIU,KAAK,QAAQ,2BAA2B;AAC5D,SAASV,OAAO,IAAIW,YAAY,QAAQ,2BAA2B;AACnE,SACEC,SAAS,EACTC,uBAAuB,EACvBC,sBAAsB,EACtBC,eAAe,EACfC,qBAAqB,EACrBC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","buildPBComponents","getLightboxImages","getComponent","componentMap","variantHandler","getClassModifiers","components","variants","LoadingComponent","Modal","ErrorMessage","getAction","generateSingleItemQuery","generateMultiItemQuery","getEntitySchema","getSingleEntitySchema","getUser","getCurrentUser","getInheritedFilters","getQueryProps","buildRawQuery","buildPropsQuery","buildRawQueryStringified","buildFiltersQuery","getUnpublishedEntityName","renderChildren","hasChildren","withTitle","useGetEntitySchema","useGetEntitySchemasAsObj","useGetSingleEntitySchema","summaryComponents","buildPropsToDisplayWithContent"],"sources":["../src/index.js"],"sourcesContent":["export { default as buildPBComponents } from './hooks/helpers/buildPBComponents';\nexport { default as getLightboxImages } from './hooks/helpers/get-lightbox-images';\nexport { default as getComponent } from './hooks/helpers/getComponent';\nexport { componentMap, variantHandler, getClassModifiers } from './utils';\nexport { default as components } from './components';\nexport { default as variants } from './variants';\nexport { default as LoadingComponent } from './components/Loading';\nexport { default as Modal } from './components/ModalAdapter';\nexport { default as ErrorMessage } from './components/ErrorMessage';\nexport {\n getAction,\n generateSingleItemQuery,\n generateMultiItemQuery,\n getEntitySchema,\n getSingleEntitySchema,\n getUser,\n getCurrentUser\n} from './application/query';\nexport {\n getInheritedFilters,\n getQueryProps,\n buildRawQuery,\n buildPropsQuery,\n buildRawQueryStringified,\n buildFiltersQuery,\n getUnpublishedEntityName,\n renderChildren,\n hasChildren\n} from './helpers';\nexport { withTitle } from './HOC';\nexport { useGetEntitySchema, useGetEntitySchemasAsObj, useGetSingleEntitySchema } from './hooks';\nexport { summaryComponents } from './components/DataSummary/DataSummaryTypes';\nexport { buildPropsToDisplayWithContent } from './components/DataSummary/helpers';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,iBAAiB,QAAQ,mCAAmC;AAChF,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,qCAAqC;AAClF,SAASF,OAAO,IAAIG,YAAY,QAAQ,8BAA8B;AACtE,SAASC,YAAY,EAAEC,cAAc,EAAEC,iBAAiB,QAAQ,SAAS;AACzE,SAASN,OAAO,IAAIO,UAAU,QAAQ,cAAc;AACpD,SAASP,OAAO,IAAIQ,QAAQ,QAAQ,YAAY;AAChD,SAASR,OAAO,IAAIS,gBAAgB,QAAQ,sBAAsB;AAClE,SAAST,OAAO,IAAIU,KAAK,QAAQ,2BAA2B;AAC5D,SAASV,OAAO,IAAIW,YAAY,QAAQ,2BAA2B;AACnE,SACEC,SAAS,EACTC,uBAAuB,EACvBC,sBAAsB,EACtBC,eAAe,EACfC,qBAAqB,EACrBC,OAAO,EACPC,cAAc,QACT,qBAAqB;AAC5B,SACEC,mBAAmB,EACnBC,aAAa,EACbC,aAAa,EACbC,eAAe,EACfC,wBAAwB,EACxBC,iBAAiB,EACjBC,wBAAwB,EACxBC,cAAc,EACdC,WAAW,QACN,WAAW;AAClB,SAASC,SAAS,QAAQ,OAAO;AACjC,SAASC,kBAAkB,EAAEC,wBAAwB,EAAEC,wBAAwB,QAAQ,SAAS;AAChG,SAASC,iBAAiB,QAAQ,2CAA2C;AAC7E,SAASC,8BAA8B,QAAQ,kCAAkC","ignoreList":[]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
4
|
+
import Button from '@blaze-react/button';
|
|
5
|
+
import { FaPlus, FaMinus } from 'react-icons/fa';
|
|
6
|
+
import { BsPinAngleFill } from 'react-icons/bs';
|
|
7
|
+
dayjs.extend(relativeTime);
|
|
8
|
+
const LiveBlogList = props => {
|
|
9
|
+
const {
|
|
10
|
+
children,
|
|
11
|
+
date,
|
|
12
|
+
published,
|
|
13
|
+
featured
|
|
14
|
+
} = props;
|
|
15
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
16
|
+
const [shouldShowButton, setShouldShowButton] = useState(false);
|
|
17
|
+
const [{
|
|
18
|
+
displayedDate,
|
|
19
|
+
displayedTime
|
|
20
|
+
}, setDisplayedDate] = useState({
|
|
21
|
+
displayedDate: ' ',
|
|
22
|
+
displayTime: ''
|
|
23
|
+
});
|
|
24
|
+
const usedDate = date || published;
|
|
25
|
+
const contentRef = useRef(null);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const timeout = setTimeout(() => {
|
|
28
|
+
if (contentRef.current) {
|
|
29
|
+
const contentHeight = contentRef.current.scrollHeight;
|
|
30
|
+
if (contentHeight > 380) {
|
|
31
|
+
setShouldShowButton(true);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}, 500); // delay to wait for content load
|
|
35
|
+
// todo: change to use mutation observer
|
|
36
|
+
|
|
37
|
+
return () => {
|
|
38
|
+
clearTimeout(timeout);
|
|
39
|
+
};
|
|
40
|
+
}, [children]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
// delay setting time so no SSR issues based on timezone
|
|
43
|
+
let newDate = '';
|
|
44
|
+
if (usedDate) {
|
|
45
|
+
const diffInDays = dayjs().diff(dayjs(usedDate), 'day');
|
|
46
|
+
if (diffInDays < 1) {
|
|
47
|
+
newDate = dayjs(usedDate).fromNow();
|
|
48
|
+
} else if (diffInDays < 365) {
|
|
49
|
+
newDate = dayjs(usedDate).format('DD MMM');
|
|
50
|
+
} else {
|
|
51
|
+
newDate = dayjs(usedDate).format('DD MMM YYYY');
|
|
52
|
+
}
|
|
53
|
+
setDisplayedDate({
|
|
54
|
+
displayedDate: newDate,
|
|
55
|
+
displayedTime: dayjs(usedDate).format('HH:mm')
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}, [date, published, usedDate]);
|
|
59
|
+
const toggleExpanded = () => {
|
|
60
|
+
setIsExpanded(!isExpanded);
|
|
61
|
+
};
|
|
62
|
+
const isCollapsed = !isExpanded;
|
|
63
|
+
const baseClass = 'live-blog-container';
|
|
64
|
+
const modifier = featured ? ` ${baseClass}--featured` : '';
|
|
65
|
+
const className = `${baseClass}${modifier}`;
|
|
66
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: className
|
|
68
|
+
}, usedDate && /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "live-blog-date"
|
|
70
|
+
}, featured && /*#__PURE__*/React.createElement(BsPinAngleFill, null), /*#__PURE__*/React.createElement("span", {
|
|
71
|
+
className: "live-blog-date--date"
|
|
72
|
+
}, displayedDate), /*#__PURE__*/React.createElement("span", {
|
|
73
|
+
className: "live-blog-date--time"
|
|
74
|
+
}, displayedTime)), /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
ref: contentRef,
|
|
76
|
+
className: `live-blog-content ${isCollapsed ? 'live-blog-content--collapsed' : 'live-blog-content--opened'}`
|
|
77
|
+
}, children), shouldShowButton && /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: "live-blog-button-wrapper"
|
|
79
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
80
|
+
className: "live-blog-toggle",
|
|
81
|
+
onClick: toggleExpanded,
|
|
82
|
+
type: "button"
|
|
83
|
+
}, isExpanded ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FaMinus, {
|
|
84
|
+
className: "toggle-icon"
|
|
85
|
+
}), " Show Less") : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FaPlus, {
|
|
86
|
+
className: "toggle-icon"
|
|
87
|
+
}), " Show More"))));
|
|
88
|
+
};
|
|
89
|
+
export default LiveBlogList;
|
|
90
|
+
//# sourceMappingURL=LiveBlogList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveBlogList.js","names":["React","useRef","useState","useEffect","dayjs","relativeTime","Button","FaPlus","FaMinus","BsPinAngleFill","extend","LiveBlogList","props","children","date","published","featured","isExpanded","setIsExpanded","shouldShowButton","setShouldShowButton","displayedDate","displayedTime","setDisplayedDate","displayTime","usedDate","contentRef","timeout","setTimeout","current","contentHeight","scrollHeight","clearTimeout","newDate","diffInDays","diff","fromNow","format","toggleExpanded","isCollapsed","baseClass","modifier","className","createElement","ref","onClick","type","Fragment"],"sources":["../../../src/variants/LiveBlogList/LiveBlogList.js"],"sourcesContent":["import React, { useRef, useState, useEffect } from 'react';\nimport dayjs from 'dayjs';\nimport relativeTime from 'dayjs/plugin/relativeTime';\nimport Button from '@blaze-react/button';\nimport { FaPlus, FaMinus } from 'react-icons/fa';\nimport { BsPinAngleFill } from 'react-icons/bs';\n\ndayjs.extend(relativeTime);\n\nconst LiveBlogList = props => {\n const { children, date, published, featured } = props;\n const [isExpanded, setIsExpanded] = useState(false);\n const [shouldShowButton, setShouldShowButton] = useState(false);\n const [{ displayedDate, displayedTime }, setDisplayedDate] = useState({\n displayedDate: ' ',\n displayTime: ''\n });\n const usedDate = date || published;\n\n const contentRef = useRef(null);\n\n useEffect(\n () => {\n const timeout = setTimeout(() => {\n if (contentRef.current) {\n const contentHeight = contentRef.current.scrollHeight;\n if (contentHeight > 380) {\n setShouldShowButton(true);\n }\n }\n }, 500); // delay to wait for content load\n // todo: change to use mutation observer\n\n return () => {\n clearTimeout(timeout);\n };\n },\n [children]\n );\n\n useEffect(\n () => {\n // delay setting time so no SSR issues based on timezone\n let newDate = '';\n if (usedDate) {\n const diffInDays = dayjs().diff(dayjs(usedDate), 'day');\n if (diffInDays < 1) {\n newDate = dayjs(usedDate).fromNow();\n } else if (diffInDays < 365) {\n newDate = dayjs(usedDate).format('DD MMM');\n } else {\n newDate = dayjs(usedDate).format('DD MMM YYYY');\n }\n setDisplayedDate({\n displayedDate: newDate,\n displayedTime: dayjs(usedDate).format('HH:mm')\n });\n }\n },\n [date, published, usedDate]\n );\n\n const toggleExpanded = () => {\n setIsExpanded(!isExpanded);\n };\n\n const isCollapsed = !isExpanded;\n const baseClass = 'live-blog-container';\n const modifier = featured ? ` ${baseClass}--featured` : '';\n const className = `${baseClass}${modifier}`;\n\n return (\n <div className={className}>\n {usedDate && (\n <div className=\"live-blog-date\">\n {featured && <BsPinAngleFill />}\n <span className=\"live-blog-date--date\">{displayedDate}</span>\n <span className=\"live-blog-date--time\">{displayedTime}</span>\n </div>\n )}\n\n <div\n ref={contentRef}\n className={`live-blog-content ${\n isCollapsed ? 'live-blog-content--collapsed' : 'live-blog-content--opened'\n }`}>\n {children}\n </div>\n\n {shouldShowButton && (\n <div className=\"live-blog-button-wrapper\">\n <Button className=\"live-blog-toggle\" onClick={toggleExpanded} type=\"button\">\n {isExpanded ? (\n <>\n <FaMinus className=\"toggle-icon\" /> Show Less\n </>\n ) : (\n <>\n <FaPlus className=\"toggle-icon\" /> Show More\n </>\n )}\n </Button>\n </div>\n )}\n </div>\n );\n};\n\nexport default LiveBlogList;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAC1D,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,YAAY,MAAM,2BAA2B;AACpD,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,MAAM,EAAEC,OAAO,QAAQ,gBAAgB;AAChD,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C,GAAG,EAAElB,UAAW;IAChBgB,SAAS,EAAE,qBACTH,WAAW,GAAG,8BAA8B,GAAG,2BAA2B;EACzE,GACF1B,QACE,CAAC,EAELM,gBAAgB,iBACfnB,KAAA,CAAA2C,aAAA;IAAKD,SAAS,EAAC;EAA0B,gBACvC1C,KAAA,CAAA2C,aAAA,CAACrC,MAAM;IAACoC,SAAS,EAAC,kBAAkB;IAACG,OAAO,EAAEP,cAAe;IAACQ,IAAI,EAAC;EAAQ,GACxE7B,UAAU,gBACTjB,KAAA,CAAA2C,aAAA,CAAA3C,KAAA,CAAA+C,QAAA,qBACE/C,KAAA,CAAA2C,aAAA,CAACnC,OAAO;IAACkC,SAAS,EAAC;EAAa,CAAE,CAAC,cACnC,CAAC,gBAEH1C,KAAA,CAAA2C,aAAA,CAAA3C,KAAA,CAAA+C,QAAA,qBACE/C,KAAA,CAAA2C,aAAA,CAACpC,MAAM;IAACmC,SAAS,EAAC;EAAa,CAAE,CAAC,cAClC,CAEE,CACL,CAEJ,CAAC;AAEV,CAAC;AAED,eAAe/B,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
import dynamic from 'next/dynamic';
|
|
5
|
+
const liveBlogList = {
|
|
6
|
+
VariantComponent: dynamic(() => import(/* webpackChunkName: "blazePbliveBlogList" */'./LiveBlogList')),
|
|
7
|
+
getSettings: componentSettings => _objectSpread(_objectSpread({}, componentSettings), {}, {
|
|
8
|
+
modifier: 'liveBlogList'
|
|
9
|
+
})
|
|
10
|
+
};
|
|
11
|
+
export default liveBlogList;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["dynamic","liveBlogList","VariantComponent","getSettings","componentSettings","_objectSpread","modifier"],"sources":["../../../src/variants/LiveBlogList/index.js"],"sourcesContent":["import dynamic from 'next/dynamic';\n\nconst liveBlogList = {\n VariantComponent: dynamic(() =>\n import(/* webpackChunkName: \"blazePbliveBlogList\" */ './LiveBlogList')\n ),\n getSettings: componentSettings => ({\n ...componentSettings,\n modifier: 'liveBlogList'\n })\n};\n\nexport default liveBlogList;\n"],"mappings":";;;AAAA,OAAOA,OAAO,MAAM,cAAc;AAElC,MAAMC,YAAY,GAAG;EACnBC,gBAAgB,EAAEF,OAAO,CAAC,MACxB,MAAM,CAAC,6CAA8C,gBAAgB,CACvE,CAAC;EACDG,WAAW,EAAEC,iBAAiB,IAAAC,aAAA,CAAAA,aAAA,KACzBD,iBAAiB;IACpBE,QAAQ,EAAE;EAAc;AAE5B,CAAC;AAED,eAAeL,YAAY","ignoreList":[]}
|
package/lib-es/variants/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import parallaxImageTextRight from './ParallaxImageTextRight';
|
|
|
6
6
|
import thumbnailCarousel from './ThumbnailCarousel';
|
|
7
7
|
import slideSummary from './SlideSummary';
|
|
8
8
|
import floatingSideButton from './FloatingSideButton';
|
|
9
|
+
import liveBlogList from './LiveBlogList';
|
|
9
10
|
export default {
|
|
10
11
|
heroImage,
|
|
11
12
|
infographic,
|
|
@@ -14,6 +15,7 @@ export default {
|
|
|
14
15
|
parallaxImageTextRight,
|
|
15
16
|
thumbnailCarousel,
|
|
16
17
|
slideSummary,
|
|
17
|
-
floatingSideButton
|
|
18
|
+
floatingSideButton,
|
|
19
|
+
liveBlogList
|
|
18
20
|
};
|
|
19
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["heroImage","infographic","longformGallery","longformRow","parallaxImageTextRight","thumbnailCarousel","slideSummary","floatingSideButton"],"sources":["../../src/variants/index.js"],"sourcesContent":["import heroImage from './HeroImage';\nimport infographic from './Infographic';\nimport longformGallery from './LongformGallery';\nimport longformRow from './LongformRow';\nimport parallaxImageTextRight from './ParallaxImageTextRight';\nimport thumbnailCarousel from './ThumbnailCarousel';\nimport slideSummary from './SlideSummary';\nimport floatingSideButton from './FloatingSideButton';\n\nexport default {\n heroImage,\n infographic,\n longformGallery,\n longformRow,\n parallaxImageTextRight,\n thumbnailCarousel,\n slideSummary,\n floatingSideButton\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,aAAa;AACnC,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,kBAAkB,MAAM,sBAAsB;
|
|
1
|
+
{"version":3,"file":"index.js","names":["heroImage","infographic","longformGallery","longformRow","parallaxImageTextRight","thumbnailCarousel","slideSummary","floatingSideButton","liveBlogList"],"sources":["../../src/variants/index.js"],"sourcesContent":["import heroImage from './HeroImage';\nimport infographic from './Infographic';\nimport longformGallery from './LongformGallery';\nimport longformRow from './LongformRow';\nimport parallaxImageTextRight from './ParallaxImageTextRight';\nimport thumbnailCarousel from './ThumbnailCarousel';\nimport slideSummary from './SlideSummary';\nimport floatingSideButton from './FloatingSideButton';\nimport liveBlogList from './LiveBlogList';\n\nexport default {\n heroImage,\n infographic,\n longformGallery,\n longformRow,\n parallaxImageTextRight,\n thumbnailCarousel,\n slideSummary,\n floatingSideButton,\n liveBlogList\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,aAAa;AACnC,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,kBAAkB,MAAM,sBAAsB;AACrD,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,eAAe;EACbR,SAAS;EACTC,WAAW;EACXC,eAAe;EACfC,WAAW;EACXC,sBAAsB;EACtBC,iBAAiB;EACjBC,YAAY;EACZC,kBAAkB;EAClBC;AACF,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.146.0-core-styles.
|
|
3
|
+
"version": "0.146.0-core-styles.52",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/core-auth-ui": "0.146.0-core-styles.
|
|
31
|
-
"@blaze-cms/core-errors": "0.146.0-core-styles.
|
|
30
|
+
"@blaze-cms/core-auth-ui": "0.146.0-core-styles.52",
|
|
31
|
+
"@blaze-cms/core-errors": "0.146.0-core-styles.52",
|
|
32
32
|
"@blaze-cms/core-errors-ui": "0.145.1-core-styles.0",
|
|
33
33
|
"@blaze-cms/image-cdn-react": "0.3.0-alpha.7",
|
|
34
34
|
"@blaze-cms/nextjs-components": "0.146.0-core-styles.42",
|
|
35
|
-
"@blaze-cms/plugin-search-ui": "0.146.0-core-styles.
|
|
35
|
+
"@blaze-cms/plugin-search-ui": "0.146.0-core-styles.52",
|
|
36
36
|
"@blaze-cms/setup-ui": "0.145.1-core-styles.0",
|
|
37
|
-
"@blaze-cms/utils": "0.146.0-core-styles.
|
|
37
|
+
"@blaze-cms/utils": "0.146.0-core-styles.52",
|
|
38
38
|
"@blaze-cms/utils-handlebars": "0.146.0-core-styles.42",
|
|
39
39
|
"@blaze-react/breadcrumb": "0.8.0-alpha.60",
|
|
40
40
|
"@blaze-react/button": "0.8.0-alpha.82",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"lib/*",
|
|
91
91
|
"lib-es/*"
|
|
92
92
|
],
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "b3ac6c631d3363ef099165ca1a055d2a09b3705b"
|
|
94
94
|
}
|
|
@@ -29,6 +29,15 @@ const getUser = userProps => gql`
|
|
|
29
29
|
}
|
|
30
30
|
`;
|
|
31
31
|
|
|
32
|
+
const getCurrentUser = userProps => gql`
|
|
33
|
+
query {
|
|
34
|
+
getUser: getCurrentUser {
|
|
35
|
+
id
|
|
36
|
+
${userProps}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
|
|
32
41
|
const getEntitySchema = gql`
|
|
33
42
|
query getEntitySchemas($identifier: String!) {
|
|
34
43
|
getEntitySchemas(identifier: $identifier) {
|
|
@@ -201,5 +210,6 @@ export {
|
|
|
201
210
|
getRecordParents,
|
|
202
211
|
getItemList,
|
|
203
212
|
addItemsToList,
|
|
204
|
-
removeItemsFromList
|
|
213
|
+
removeItemsFromList,
|
|
214
|
+
getCurrentUser
|
|
205
215
|
};
|
|
@@ -284,9 +284,10 @@ const getImageDefinedProps = ({ image, displayThumbnail, name }) => {
|
|
|
284
284
|
|
|
285
285
|
const getInitialModifiers = ({ modifier, style, otherProps }) => {
|
|
286
286
|
const modifiers = [modifier, style];
|
|
287
|
-
const { sponsored, featured } = otherProps;
|
|
287
|
+
const { sponsored, featured, live } = otherProps;
|
|
288
288
|
if (sponsored) modifiers.push('sponsored');
|
|
289
289
|
if (featured) modifiers.push('featured');
|
|
290
|
+
if (live) modifiers.push('live');
|
|
290
291
|
|
|
291
292
|
return modifiers;
|
|
292
293
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
BsBookmarkStarFill,
|
|
5
|
-
BsBookmarkCheckFill,
|
|
6
|
-
BsBookmarkStar,
|
|
7
|
-
BsBookmarkXFill
|
|
8
|
-
} from 'react-icons/bs';
|
|
9
3
|
import { useQuery, useMutation } from '@apollo/client';
|
|
4
|
+
import {
|
|
5
|
+
AddedBookmark,
|
|
6
|
+
BaseBookmark,
|
|
7
|
+
FocusedBookmark,
|
|
8
|
+
HoverBookmark,
|
|
9
|
+
RemoveBookmark
|
|
10
|
+
} from '../icons';
|
|
10
11
|
import { getItemList, addItemsToList, removeItemsFromList } from '../../../application/query';
|
|
11
12
|
import { getItemListData, setItemListId } from '../helpers';
|
|
12
13
|
import { useItemListId } from '../hooks';
|
|
@@ -14,13 +15,9 @@ import { useItemListId } from '../hooks';
|
|
|
14
15
|
const ItemListButton = ({ listName, parent, modifier }) => {
|
|
15
16
|
const { itemId, itemEntity } = parent;
|
|
16
17
|
const [isHover, setIsHover] = useState(false);
|
|
18
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
17
19
|
const { listId } = useItemListId({ listName });
|
|
18
20
|
|
|
19
|
-
const getIcon = () => {
|
|
20
|
-
if (isInList) return isHover ? BsBookmarkXFill : BsBookmarkCheckFill;
|
|
21
|
-
return isHover ? BsBookmarkStarFill : BsBookmarkStar;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
21
|
const { data, error, loading } = useQuery(getItemList, {
|
|
25
22
|
variables: { id: listId },
|
|
26
23
|
skip: !listId
|
|
@@ -42,6 +39,7 @@ const ItemListButton = ({ listName, parent, modifier }) => {
|
|
|
42
39
|
|
|
43
40
|
const clickHandler = () => {
|
|
44
41
|
setIsHover(false);
|
|
42
|
+
setIsFocused(false);
|
|
45
43
|
isInList
|
|
46
44
|
? removeListItem({
|
|
47
45
|
variables: { listId, listItems: [{ itemId, itemEntity }] },
|
|
@@ -61,6 +59,17 @@ const ItemListButton = ({ listName, parent, modifier }) => {
|
|
|
61
59
|
({ itemId: idToCheck, itemEntity: entityToCheck }) =>
|
|
62
60
|
idToCheck === itemId && entityToCheck === itemEntity
|
|
63
61
|
);
|
|
62
|
+
|
|
63
|
+
const getIcon = () => {
|
|
64
|
+
if (isFocused && !isHover) {
|
|
65
|
+
return FocusedBookmark;
|
|
66
|
+
}
|
|
67
|
+
if (isInList) {
|
|
68
|
+
return isHover ? RemoveBookmark : AddedBookmark;
|
|
69
|
+
}
|
|
70
|
+
return isHover ? HoverBookmark : BaseBookmark;
|
|
71
|
+
};
|
|
72
|
+
|
|
64
73
|
const Icon = getIcon();
|
|
65
74
|
const stateClassName = isInList ? 'item-list-button--selected' : '';
|
|
66
75
|
const className = ['item-list-button', stateClassName, modifier].filter(Boolean).join(' ');
|
|
@@ -69,10 +78,12 @@ const ItemListButton = ({ listName, parent, modifier }) => {
|
|
|
69
78
|
<div
|
|
70
79
|
className={className}
|
|
71
80
|
role="button"
|
|
81
|
+
tabIndex="0"
|
|
72
82
|
onClick={clickHandler}
|
|
73
83
|
onMouseEnter={() => setIsHover(true)}
|
|
74
84
|
onMouseLeave={() => setIsHover(false)}
|
|
75
|
-
|
|
85
|
+
onFocus={() => setIsFocused(true)}
|
|
86
|
+
onBlur={() => setIsFocused(false)}>
|
|
76
87
|
<i>
|
|
77
88
|
<Icon />
|
|
78
89
|
</i>
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useRouter } from 'next/router';
|
|
4
4
|
import { useQuery } from '@apollo/client';
|
|
5
|
-
import {
|
|
5
|
+
import { AddedBookmark, BaseBookmark } from '../icons';
|
|
6
6
|
import { getItemList } from '../../../application/query';
|
|
7
7
|
import { useItemListId } from '../hooks';
|
|
8
8
|
import { getItemListData } from '../helpers';
|
|
@@ -21,7 +21,7 @@ const ItemListCounter = ({ listName, modifier, url }) => {
|
|
|
21
21
|
|
|
22
22
|
const listItems = getItemListData(data);
|
|
23
23
|
const listLength = listItems.length;
|
|
24
|
-
const CounterIcon = listLength ?
|
|
24
|
+
const CounterIcon = listLength ? AddedBookmark : BaseBookmark;
|
|
25
25
|
|
|
26
26
|
const handleClick = () => router.push('/Resolver', `${url}?itemListId=${listId}`);
|
|
27
27
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
function AddedBookmark({ width = '24px', height = '33px' }) {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
width={width}
|
|
7
|
+
height={height}
|
|
8
|
+
viewBox="0 0 24 33"
|
|
9
|
+
version="1.1"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
11
|
+
<title>wishlist-button/added</title>
|
|
12
|
+
<g id="Wishlist" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
13
|
+
<g id="components" transform="translate(-417, -433)">
|
|
14
|
+
<g id="Group" transform="translate(417, 433.0588)">
|
|
15
|
+
<path
|
|
16
|
+
d="M2.68249844e-07,30.9992911 L2.68249844e-07,3.99990852 C2.68249844e-07,1.79082005 1.79082058,0 3.99990906,0 L19.9995432,0 C22.2086316,0 23.9994519,1.79082005 23.9994519,3.99990852 L23.9994519,30.9992911 C23.9997102,31.3525836 23.8135276,31.6797933 23.5096796,31.860049 C23.2058317,32.0403048 22.829418,32.0468515 22.5194855,31.877271 L11.9997261,26.1374022 L1.47996669,31.877271 C1.17003424,32.0468515 0.79362051,32.0403048 0.489772584,31.860049 C0.185924659,31.6797933 -0.000257952496,31.3525836 2.68249844e-07,30.9992911 Z"
|
|
17
|
+
id="Shape"
|
|
18
|
+
fill="#C31629"
|
|
19
|
+
fillRule="nonzero"
|
|
20
|
+
/>
|
|
21
|
+
<path
|
|
22
|
+
d="M19.5735342,9.48562495 C20.1421553,8.91700384 20.1421553,7.99508691 19.5735342,7.42646583 C19.0049131,6.85784474 18.0829962,6.85784472 17.514375,7.42646579 L9.81870394,15.1250453 L6.48565817,11.7890911 C6.11782481,11.4212578 5.58169601,11.2776025 5.0792263,11.4122388 C4.57675658,11.5468752 4.18428306,11.9393487 4.04964671,12.4418184 C3.91501035,12.9442881 4.05866564,13.4804169 4.42649901,13.8482503 L8.78912435,18.2108756 C9.06194626,18.4843881 9.43238689,18.638104 9.81870394,18.638104 C10.205021,18.638104 10.5754616,18.4843881 10.8482835,18.2108756 L19.5735342,9.48562495 Z"
|
|
23
|
+
id="Path"
|
|
24
|
+
fill="#FFFFFF"
|
|
25
|
+
/>
|
|
26
|
+
</g>
|
|
27
|
+
</g>
|
|
28
|
+
</g>
|
|
29
|
+
</svg>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default AddedBookmark;
|