@blaze-cms/react-page-builder 0.124.0-alpha.39 → 0.124.0-alpha.42
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 +27 -0
- package/lib/BannerContext/index.js.map +1 -1
- package/lib/HOC/withInfiniteScroll.js.map +1 -1
- package/lib/HOC/withTitle.js.map +1 -1
- package/lib/PBContext/index.js.map +1 -1
- package/lib/application/query/index.js.map +1 -1
- package/lib/components/BackToTop/BackToTop.js.map +1 -1
- package/lib/components/Banner/AdSlotRender.js.map +1 -1
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/BannerRender.js.map +1 -1
- package/lib/components/Banner/helpers.js.map +1 -1
- package/lib/components/Banner/index.js.map +1 -1
- package/lib/components/BlazeLink.js.map +1 -1
- package/lib/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/components/Button.js +18 -5
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardContainer.js.map +1 -1
- package/lib/components/Card/CardFactory.js.map +1 -1
- package/lib/components/Card/CardRender.js.map +1 -1
- package/lib/components/Card/helpers/filter-query-setup.js.map +1 -1
- package/lib/components/Card/helpers/filters-setup.js.map +1 -1
- package/lib/components/Card/helpers/get-dynamic-grid-classes.js.map +1 -1
- package/lib/components/Carousel/Carousel.js.map +1 -1
- package/lib/components/Carousel/CarouselImage/CarouselImage.js.map +1 -1
- package/lib/components/Carousel/CarouselRender/CarouselRender.js +2 -2
- package/lib/components/Carousel/CarouselRender/CarouselRender.js.map +1 -1
- package/lib/components/CarouselWrapper.js +2 -2
- package/lib/components/CarouselWrapper.js.map +1 -1
- package/lib/components/ClickWrapper.js.map +1 -1
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/Code/ScriptTag.js.map +1 -1
- package/lib/components/Code/helpers/wrap-script-tags.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryRender.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-data-summary-query.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-based-on-value.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-prop-value.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-value-from-array.js.map +1 -1
- package/lib/components/DataSummary/helpers/strip-summary-props-content.js.map +1 -1
- package/lib/components/EmailConfirm/EmailConfirm.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/NavButton.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/index.js.map +1 -1
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Image/ImageDetails.js.map +1 -1
- package/lib/components/Image/ImageFactory.js.map +1 -1
- package/lib/components/Image/ImageRender.js.map +1 -1
- package/lib/components/Image/Lightbox/Lightbox.js.map +1 -1
- package/lib/components/ItemList/ItemListButton/ItemListButton.js.map +1 -1
- package/lib/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -1
- package/lib/components/ItemList/ItemListNew/ItemListNew.js.map +1 -1
- package/lib/components/ItemList/helpers/get-item-list-ids.js.map +1 -1
- package/lib/components/ItemList/hooks/use-item-list-id.js.map +1 -1
- package/lib/components/Layout/Layout.js.map +1 -1
- package/lib/components/Layout/helpers/check-if-row-has-columns.js.map +1 -1
- package/lib/components/LazyImage/LazyImage.js.map +1 -1
- package/lib/components/LazyImage/index.js.map +1 -1
- package/lib/components/List/ListBuilder.js.map +1 -1
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/ListRender.js.map +1 -1
- package/lib/components/List/components/Cards/CardRenderWithInfiniteScroll.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRenderItem.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRenderWrapper.js.map +1 -1
- package/lib/components/List/components/Full/FullRender.js.map +1 -1
- package/lib/components/List/components/Full/FullRenderItem.js.map +1 -1
- package/lib/components/List/components/Full/FullRenderWithInfiniteScroll.js.map +1 -1
- package/lib/components/List/components/Header/ListHeader.js.map +1 -1
- package/lib/components/List/components/Pagination/Classic.js.map +1 -1
- package/lib/components/List/components/Pagination/ListPagination.js.map +1 -1
- package/lib/components/List/components/Pagination/LoadMore.js.map +1 -1
- package/lib/components/List/helpers/build-az-aggregations.js.map +1 -1
- package/lib/components/List/helpers/build-az-url.js.map +1 -1
- package/lib/components/List/helpers/build-pagination-items.js.map +1 -1
- package/lib/components/List/helpers/build-pagination-url.js.map +1 -1
- package/lib/components/List/helpers/has-required-item-list-details.js.map +1 -1
- package/lib/components/Login/LoggedInMessage.js.map +1 -1
- package/lib/components/Login/Login.js.map +1 -1
- package/lib/components/Login/LoginForm.js.map +1 -1
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/MenuContext.js.map +1 -1
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/PasswordReset/PasswordReset.js.map +1 -1
- package/lib/components/PasswordReset/helpers/validatePassword.js.map +1 -1
- package/lib/components/PasswordResetRequest/PasswordResetRequest.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/CloseMobileForm.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/MobileFormToolbar.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/ResetDesktopForm.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib/components/SearchFilter/components/Range.js.map +1 -1
- package/lib/components/SearchFilter/components/Select.js.map +1 -1
- package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-query.js +1 -1
- package/lib/components/SearchFilter/helpers/build-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/calculate-min-max.js.map +1 -1
- package/lib/components/SearchFilter/helpers/check-if-range-updated.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-intersected-prop.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-range-value.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-responsive-filter-classnames.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-select-options.js.map +1 -1
- package/lib/components/SearchFilter/helpers/parse-filter-value.js +3 -7
- package/lib/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/components/SocialFollow/SFItem.js.map +1 -1
- package/lib/components/SocialFollow/SocialFollow.js.map +1 -1
- package/lib/components/SocialFollow/SocialFollowRender.js.map +1 -1
- package/lib/components/SubMenu/SubMenu.js.map +1 -1
- package/lib/components/TextBlock/TextBlockRender.js.map +1 -1
- package/lib/components/TextBlock/index.js.map +1 -1
- package/lib/components/Video/Video.js.map +1 -1
- package/lib/components/Video/VideoModal.js.map +1 -1
- package/lib/components/Video/VideoRender.js.map +1 -1
- package/lib/components/Video/providers/Default.js.map +1 -1
- package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js.map +1 -1
- package/lib/components/Video/providers/YouTube/YouTubeProvider.js.map +1 -1
- package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
- package/lib/components/Video/providers/get-provider.js.map +1 -1
- package/lib/components/Wrapper.js.map +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/helpers/build-inherited-filters.js.map +1 -1
- package/lib/helpers/build-raw-query-base.js.map +1 -1
- package/lib/helpers/build-raw-query.js.map +1 -1
- package/lib/helpers/build-search-values-checkbox-select.js.map +1 -1
- package/lib/helpers/check-props-to-use.js.map +1 -1
- package/lib/helpers/get-entities-with-banner.js.map +1 -1
- package/lib/helpers/get-entity-data.js.map +1 -1
- package/lib/helpers/get-entity-render-props.js.map +1 -1
- package/lib/helpers/get-filter-props.js.map +1 -1
- package/lib/helpers/get-generic-props.js.map +1 -1
- package/lib/helpers/get-generic-render-variables.js.map +1 -1
- package/lib/helpers/get-image-ids.js.map +1 -1
- package/lib/helpers/get-parsed-prop-values.js.map +1 -1
- package/lib/helpers/get-prop-values.js.map +1 -1
- package/lib/helpers/get-query-filters.js.map +1 -1
- package/lib/helpers/get-query-props.js.map +1 -1
- package/lib/helpers/get-updated-filter-by.js.map +1 -1
- package/lib/helpers/inject-banner.js.map +1 -1
- package/lib/helpers/inject-banners-to-entities.js.map +1 -1
- 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.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/helpers/group-node-entities.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/inject-multiple-banners.js.map +1 -1
- package/lib/helpers/is-filter-entitys-id.js.map +1 -1
- package/lib/helpers/parse-TextBlock.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib/helpers/render-children.js.map +1 -1
- package/lib/helpers/sort-response-data.js.map +1 -1
- package/lib/hooks/helpers/RenderComponent.js.map +1 -1
- package/lib/hooks/helpers/buildPBComponents.js.map +1 -1
- package/lib/hooks/helpers/getComponent.js.map +1 -1
- package/lib/hooks/helpers/inject-element-banners.js.map +1 -1
- package/lib/hooks/helpers/inject-textblock-banners.js.map +1 -1
- package/lib/hooks/helpers/insert-banners.js.map +1 -1
- package/lib/hooks/helpers/update-targetings.js.map +1 -1
- package/lib/hooks/use-banner-insertion.js.map +1 -1
- package/lib/hooks/use-check-mobile-screen.js.map +1 -1
- package/lib/hooks/use-get-entity-schema.js.map +1 -1
- package/lib/hooks/use-get-entity-schemas-as-obj.js.map +1 -1
- package/lib/hooks/use-get-image-id-from-relation.js.map +1 -1
- package/lib/hooks/use-get-images.js.map +1 -1
- package/lib/hooks/use-get-single-entity-schema.js.map +1 -1
- package/lib/hooks/use-page-builder.js.map +1 -1
- package/lib/utils/get-class-modifiers.js.map +1 -1
- package/lib/utils/get-image-data.js.map +1 -1
- package/lib-es/components/Button.js +18 -6
- package/lib-es/components/Button.js.map +1 -1
- package/lib-es/components/Carousel/CarouselRender/CarouselRender.js +2 -2
- package/lib-es/components/Carousel/CarouselRender/CarouselRender.js.map +1 -1
- package/lib-es/components/CarouselWrapper.js +2 -2
- package/lib-es/components/CarouselWrapper.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-query.js +1 -1
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/parse-filter-value.js +3 -3
- package/lib-es/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Button.js +27 -5
- package/src/components/Carousel/CarouselRender/CarouselRender.js +2 -2
- package/src/components/CarouselWrapper.js +2 -2
- package/src/components/SearchFilter/helpers/build-query.js +3 -1
- package/src/components/SearchFilter/helpers/parse-filter-value.js +3 -3
- package/tests/unit/src/components/Button.test.js +55 -1
- package/tests/unit/src/components/Carousel/__snapshots__/Carousel.test.js.snap +2 -2
- package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +2 -2
- package/tests/unit/src/components/SearchFilter/helpers/parse-filter-value.test.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["React","useState","Fragment","useCookies","useRouter","BlazeButton","handleLogout","useApolloClient","PropTypes","ClickWrapper","BlazeLink","withTitle","getClassModifiers","LOGOUT","renderChildren","updateChildrensParent","hasChildren","getClickWrapperOptions","Button","props","type","text","url","icon","name","style","children","clickAction","otherProps","client","router","isLogoutButton","cookies","blaze_auth","blazeCookie","showChildren","setShowChildren","checkIfButtonShouldRender","logout","reload","handleClick","buttonType","modifiers","currentProps","href","title","DynamicButton","parent","itemId","itemEntity","renderedChildren","onClose","shouldUseClickWrapper","wrapperProps","Wrapper","
|
|
1
|
+
{"version":3,"file":"Button.js","names":["React","useState","Fragment","useCookies","useRouter","classnames","BlazeButton","handleLogout","useApolloClient","PropTypes","bool","string","ClickWrapper","BlazeLink","withTitle","getClassModifiers","LOGOUT","renderChildren","updateChildrensParent","hasChildren","getClickWrapperOptions","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","otherProps","client","router","isLogoutButton","cookies","blaze_auth","blazeCookie","showChildren","setShowChildren","checkIfButtonShouldRender","logout","reload","handleClick","buttonType","modifiers","currentProps","href","title","DynamicButton","parent","itemId","itemEntity","renderedChildren","onClose","shouldUseClickWrapper","wrapperProps","Wrapper","contentClassName","propTypes","size","oneOfType","arrayOf","node","defaultProps"],"sources":["../../src/components/Button.js"],"sourcesContent":["import React, { useState, Fragment } from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useRouter } from 'next/router';\nimport classnames from 'classnames';\nimport BlazeButton from '@blaze-react/button';\nimport { handleLogout } from '@blaze-cms/core-auth-ui';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes, { bool, string } from 'prop-types';\nimport ClickWrapper from './ClickWrapper';\nimport BlazeLink from './BlazeLink';\nimport { withTitle } from '../HOC';\nimport { getClassModifiers } from '../utils';\nimport { LOGOUT } from '../constants';\nimport {\n renderChildren,\n updateChildrensParent,\n hasChildren,\n getClickWrapperOptions\n} from '../helpers';\n\nconst Button = props => {\n const {\n type,\n text,\n url,\n icon,\n name,\n style,\n children,\n clickAction,\n childSeoVisibility,\n afterClickText,\n ...otherProps\n } = props;\n const client = useApolloClient();\n const router = useRouter();\n const isLogoutButton = clickAction === LOGOUT;\n const [cookies] = useCookies();\n const { blaze_auth: blazeCookie } = cookies;\n const [showChildren, setShowChildren] = useState(false);\n\n const checkIfButtonShouldRender = () => {\n if (isLogoutButton) return !!blazeCookie;\n if (!text && !icon) return false;\n return !!(url || hasChildren(children));\n };\n\n const logout = () => {\n handleLogout(client);\n url ? router.reload(url) : router.reload();\n };\n\n const handleClick = () => {\n if (isLogoutButton) logout();\n if (!url && !isLogoutButton) setShowChildren(!showChildren);\n };\n\n if (!checkIfButtonShouldRender()) return null;\n\n const buttonType = !text && icon ? 'icon' : type;\n const modifiers = getClassModifiers(buttonType, { icon, style, ...otherProps });\n const currentProps = url ? { href: url, title: name } : { name };\n const DynamicButton = url && !isLogoutButton ? BlazeLink : BlazeButton;\n updateChildrensParent(children, otherProps.parent.itemId, otherProps.parent.itemEntity);\n\n const renderedChildren = renderChildren(children, { onClose: handleClick });\n const { shouldUseClickWrapper, wrapperProps } = getClickWrapperOptions(children, props);\n const Wrapper = shouldUseClickWrapper ? ClickWrapper : Fragment;\n\n const contentClassName = classnames('button__content', {\n 'button__content--show': showChildren\n });\n\n return (\n <Wrapper {...wrapperProps}>\n {childSeoVisibility && <div className={contentClassName}>{renderedChildren}</div>}\n {!childSeoVisibility && showChildren && renderedChildren}\n <DynamicButton className={modifiers} onClick={handleClick} {...currentProps}>\n {icon && <i className={icon} />}\n {showChildren ? afterClickText : text}\n </DynamicButton>\n </Wrapper>\n );\n};\n\nButton.propTypes = {\n clickAction: PropTypes.string,\n text: PropTypes.string,\n afterClickText: string,\n name: PropTypes.string,\n type: PropTypes.string,\n url: PropTypes.string,\n size: PropTypes.string,\n icon: PropTypes.string,\n style: PropTypes.string,\n childSeoVisibility: bool,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nButton.defaultProps = {\n clickAction: '',\n text: '',\n afterClickText: '',\n name: '',\n type: '',\n url: null,\n size: '',\n icon: '',\n style: '',\n children: [],\n childSeoVisibility: false\n};\n\nexport default withTitle(Button);\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,QAA1B,QAA0C,OAA1C;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,WAAP,MAAwB,qBAAxB;AACA,SAASC,YAAT,QAA6B,yBAA7B;AACA,SAASC,eAAT,QAAgC,gBAAhC;AACA,OAAOC,SAAP,IAAoBC,IAApB,EAA0BC,MAA1B,QAAwC,YAAxC;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,SAAP,MAAsB,aAAtB;AACA,SAASC,SAAT,QAA0B,QAA1B;AACA,SAASC,iBAAT,QAAkC,UA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AAUD,CA/DD;;AAiEAH,MAAM,CAACwC,SAAP,GAAmB;EACjB/B,WAAW,EAAErB,SAAS,CAACE,MADN;EAEjBa,IAAI,EAAEf,SAAS,CAACE,MAFC;EAGjBqB,cAAc,EAAErB,MAHC;EAIjBgB,IAAI,EAAElB,SAAS,CAACE,MAJC;EAKjBY,IAAI,EAAEd,SAAS,CAACE,MALC;EAMjBc,GAAG,EAAEhB,SAAS,CAACE,MANE;EAOjBmD,IAAI,EAAErD,SAAS,CAACE,MAPC;EAQjBe,IAAI,EAAEjB,SAAS,CAACE,MARC;EASjBiB,KAAK,EAAEnB,SAAS,CAACE,MATA;EAUjBoB,kBAAkB,EAAErB,IAVH;EAWjBmB,QAAQ,EAAEpB,SAAS,CAACsD,SAAV,CAAoB,CAACtD,SAAS,CAACuD,OAAV,CAAkBvD,SAAS,CAACwD,IAA5B,CAAD,EAAoCxD,SAAS,CAACwD,IAA9C,CAApB;AAXO,CAAnB;AAcA5C,MAAM,CAAC6C,YAAP,GAAsB;EACpBpC,WAAW,EAAE,EADO;EAEpBN,IAAI,EAAE,EAFc;EAGpBQ,cAAc,EAAE,EAHI;EAIpBL,IAAI,EAAE,EAJc;EAKpBJ,IAAI,EAAE,EALc;EAMpBE,GAAG,EAAE,IANe;EAOpBqC,IAAI,EAAE,EAPc;EAQpBpC,IAAI,EAAE,EARc;EASpBE,KAAK,EAAE,EATa;EAUpBC,QAAQ,EAAE,EAVU;EAWpBE,kBAAkB,EAAE;AAXA,CAAtB;AAcA,eAAejB,SAAS,CAACO,MAAD,CAAxB"}
|
|
@@ -67,7 +67,7 @@ const CarouselRender = _ref => {
|
|
|
67
67
|
role: "button",
|
|
68
68
|
onClick: () => handleNavigation(navigation.back)
|
|
69
69
|
}, /*#__PURE__*/React.createElement("div", {
|
|
70
|
-
className: "
|
|
70
|
+
className: "arrow arrow--left"
|
|
71
71
|
})), /*#__PURE__*/React.createElement("div", {
|
|
72
72
|
className: "carousel__list",
|
|
73
73
|
ref: listRef
|
|
@@ -79,7 +79,7 @@ const CarouselRender = _ref => {
|
|
|
79
79
|
role: "button",
|
|
80
80
|
onClick: () => handleNavigation(navigation.next)
|
|
81
81
|
}, shouldDisplayCount && /*#__PURE__*/React.createElement("p", null, countMessage), /*#__PURE__*/React.createElement("div", {
|
|
82
|
-
className: "
|
|
82
|
+
className: "arrow arrow--right"
|
|
83
83
|
})));
|
|
84
84
|
};
|
|
85
85
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselRender.js","names":["React","useRef","useState","PropTypes","CarouselImage","withTitle","getDisplayCountData","CarouselRender","imageIds","displayCount","otherProps","showCount","setShowCount","listRef","getListElement","current","moveScroll","numberOfPixels","isNext","listElement","totalDistance","scrollLeft","offsetWidth","scrollWidth","leftPosition","Math","max","scrollTo","top","left","behavior","handleNavigation","direction","offset","length","navigation","next","back","shouldDisplayCount","countMessage","map","imageId","propTypes","array","bool","defaultProps"],"sources":["../../../../src/components/Carousel/CarouselRender/CarouselRender.js"],"sourcesContent":["import React, { useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport CarouselImage from '../CarouselImage';\nimport { withTitle } from '../../../HOC';\nimport { getDisplayCountData } from '../../../helpers';\n\nconst CarouselRender = ({ imageIds, displayCount, ...otherProps }) => {\n const [showCount, setShowCount] = useState(displayCount);\n const listRef = useRef(null);\n\n const getListElement = () => {\n if (!listRef) return null;\n const { current } = listRef;\n return current;\n };\n\n const moveScroll = (numberOfPixels, isNext) => {\n const listElement = getListElement();\n if (!listElement) return;\n\n const totalDistance = listElement.scrollLeft + numberOfPixels;\n const { scrollLeft, offsetWidth, scrollWidth } = listElement;\n if (isNext && offsetWidth + scrollLeft >= scrollWidth) return;\n\n const leftPosition = totalDistance < 0 ? 0 : Math.max(-scrollLeft, totalDistance);\n\n listElement.scrollTo({\n top: 0,\n left: leftPosition,\n behavior: 'smooth'\n });\n };\n\n const handleNavigation = direction => {\n setShowCount(false);\n\n const listElement = getListElement();\n if (!listElement) return;\n\n const { scrollWidth } = listElement;\n const offset = scrollWidth / imageIds.length;\n\n direction ? moveScroll(offset, direction) : moveScroll(-offset, direction);\n };\n\n const navigation = {\n next: true,\n back: false\n };\n\n const { shouldDisplayCount, countMessage } = getDisplayCountData(showCount, imageIds);\n\n return (\n <>\n <div\n className=\"carousel__button carousel__button--previous\"\n role=\"button\"\n onClick={() => handleNavigation(navigation.back)}>\n <div className=\"
|
|
1
|
+
{"version":3,"file":"CarouselRender.js","names":["React","useRef","useState","PropTypes","CarouselImage","withTitle","getDisplayCountData","CarouselRender","imageIds","displayCount","otherProps","showCount","setShowCount","listRef","getListElement","current","moveScroll","numberOfPixels","isNext","listElement","totalDistance","scrollLeft","offsetWidth","scrollWidth","leftPosition","Math","max","scrollTo","top","left","behavior","handleNavigation","direction","offset","length","navigation","next","back","shouldDisplayCount","countMessage","map","imageId","propTypes","array","bool","defaultProps"],"sources":["../../../../src/components/Carousel/CarouselRender/CarouselRender.js"],"sourcesContent":["import React, { useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport CarouselImage from '../CarouselImage';\nimport { withTitle } from '../../../HOC';\nimport { getDisplayCountData } from '../../../helpers';\n\nconst CarouselRender = ({ imageIds, displayCount, ...otherProps }) => {\n const [showCount, setShowCount] = useState(displayCount);\n const listRef = useRef(null);\n\n const getListElement = () => {\n if (!listRef) return null;\n const { current } = listRef;\n return current;\n };\n\n const moveScroll = (numberOfPixels, isNext) => {\n const listElement = getListElement();\n if (!listElement) return;\n\n const totalDistance = listElement.scrollLeft + numberOfPixels;\n const { scrollLeft, offsetWidth, scrollWidth } = listElement;\n if (isNext && offsetWidth + scrollLeft >= scrollWidth) return;\n\n const leftPosition = totalDistance < 0 ? 0 : Math.max(-scrollLeft, totalDistance);\n\n listElement.scrollTo({\n top: 0,\n left: leftPosition,\n behavior: 'smooth'\n });\n };\n\n const handleNavigation = direction => {\n setShowCount(false);\n\n const listElement = getListElement();\n if (!listElement) return;\n\n const { scrollWidth } = listElement;\n const offset = scrollWidth / imageIds.length;\n\n direction ? moveScroll(offset, direction) : moveScroll(-offset, direction);\n };\n\n const navigation = {\n next: true,\n back: false\n };\n\n const { shouldDisplayCount, countMessage } = getDisplayCountData(showCount, imageIds);\n\n return (\n <>\n <div\n className=\"carousel__button carousel__button--previous\"\n role=\"button\"\n onClick={() => handleNavigation(navigation.back)}>\n <div className=\"arrow arrow--left\" />\n </div>\n <div className=\"carousel__list\" ref={listRef}>\n {imageIds.map(imageId => <CarouselImage key={imageId} imageId={imageId} {...otherProps} />)}\n </div>\n <div\n className=\"carousel__button carousel__button--next\"\n role=\"button\"\n onClick={() => handleNavigation(navigation.next)}>\n {shouldDisplayCount && <p>{countMessage}</p>}\n <div className=\"arrow arrow--right\" />\n </div>\n </>\n );\n};\n\nCarouselRender.propTypes = {\n imageIds: PropTypes.array,\n displayCount: PropTypes.bool\n};\n\nCarouselRender.defaultProps = {\n imageIds: [],\n displayCount: false\n};\n\nexport default withTitle(CarouselRender);\n"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,MAAhB,EAAwBC,QAAxB,QAAwC,OAAxC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,SAASC,SAAT,QAA0B,cAA1B;AACA,SAASC,mBAAT,QAAoC,kBAApC;;AAEA,MAAMC,cAAc,GAAG,QAA+C;EAAA,IAA9C;IAAEC,QAAF;IAAYC;EAAZ,CAA8C;EAAA,IAAjBC,UAAiB;;EACpE,MAAM,CAACC,SAAD,EAAYC,YAAZ,IAA4BV,QAAQ,CAACO,YAAD,CAA1C;EACA,MAAMI,OAAO,GAAGZ,MAAM,CAAC,IAAD,CAAtB;;EAEA,MAAMa,cAAc,GAAG,MAAM;IAC3B,IAAI,CAACD,OAAL,EAAc,OAAO,IAAP;IACd,MAAM;MAAEE;IAAF,IAAcF,OAApB;IACA,OAAOE,OAAP;EACD,CAJD;;EAMA,MAAMC,UAAU,GAAG,CAACC,cAAD,EAA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C,gBAIE;IAAK,SAAS,EAAC;EAAf,EAJF,CADF,eAOE;IAAK,SAAS,EAAC,gBAAf;IAAgC,GAAG,EAAExB;EAArC,GACGL,QAAQ,CAACgC,GAAT,CAAaC,OAAO,iBAAI,oBAAC,aAAD;IAAe,GAAG,EAAEA,OAApB;IAA6B,OAAO,EAAEA;EAAtC,GAAmD/B,UAAnD,EAAxB,CADH,CAPF,eAUE;IACE,SAAS,EAAC,yCADZ;IAEE,IAAI,EAAC,QAFP;IAGE,OAAO,EAAE,MAAMqB,gBAAgB,CAACI,UAAU,CAACC,IAAZ;EAHjC,GAIGE,kBAAkB,iBAAI,+BAAIC,YAAJ,CAJzB,eAKE;IAAK,SAAS,EAAC;EAAf,EALF,CAVF,CADF;AAoBD,CAlED;;AAoEAhC,cAAc,CAACmC,SAAf,GAA2B;EACzBlC,QAAQ,EAAEL,SAAS,CAACwC,KADK;EAEzBlC,YAAY,EAAEN,SAAS,CAACyC;AAFC,CAA3B;AAKArC,cAAc,CAACsC,YAAf,GAA8B;EAC5BrC,QAAQ,EAAE,EADkB;EAE5BC,YAAY,EAAE;AAFc,CAA9B;AAKA,eAAeJ,SAAS,CAACE,cAAD,CAAxB"}
|
|
@@ -95,7 +95,7 @@ const CarouselWrapper = ({
|
|
|
95
95
|
handleButtonNavigation();
|
|
96
96
|
}
|
|
97
97
|
}, /*#__PURE__*/React.createElement("i", {
|
|
98
|
-
className: "cards-carousel--arrow__left"
|
|
98
|
+
className: "cards-carousel--arrow cards-carousel--arrow__left"
|
|
99
99
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
100
100
|
className: "cards-carousel--right-button-wrapper"
|
|
101
101
|
}, displayRight && /*#__PURE__*/React.createElement("button", {
|
|
@@ -106,7 +106,7 @@ const CarouselWrapper = ({
|
|
|
106
106
|
handleButtonNavigation(true);
|
|
107
107
|
}
|
|
108
108
|
}, /*#__PURE__*/React.createElement("i", {
|
|
109
|
-
className: "cards-carousel--arrow__right"
|
|
109
|
+
className: "cards-carousel--arrow cards-carousel--arrow__right"
|
|
110
110
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
111
111
|
className: contentClassName,
|
|
112
112
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselWrapper.js","names":["React","useRef","useState","useEffect","PropTypes","CarouselWrapper","children","bannerModifier","itemsPerRow","enableAutoScroll","autoScrollTimer","arrowSize","ref","buttonDisplay","setButtonDisplays","displayLeft","displayRight","shouldAutoScroll","setShouldAutoScroll","autoScrollRef","current","id","setInterval","scrollCheck","clearInterval","handleButtonNavigation","offsetWidth","scrollWidth","handleScroll","scrollLeft","updatedDisplayLeft","updatedDisplayRight","direction","wrapperClassName","contentClassName","propTypes","string","number","oneOfType","arrayOf","node","bool","defaultProps"],"sources":["../../src/components/CarouselWrapper.js"],"sourcesContent":["import React, { useRef, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\n\nconst CarouselWrapper = ({\n children,\n bannerModifier,\n itemsPerRow,\n enableAutoScroll,\n autoScrollTimer,\n arrowSize\n}) => {\n const ref = useRef();\n const [buttonDisplay, setButtonDisplays] = useState({ displayLeft: false, displayRight: true });\n const [shouldAutoScroll, setShouldAutoScroll] = useState(false);\n const autoScrollRef = useRef();\n\n useEffect(\n () => {\n autoScrollRef.current = shouldAutoScroll;\n const id = setInterval(scrollCheck, autoScrollTimer);\n function scrollCheck() {\n if (!autoScrollRef.current) {\n clearInterval(id);\n } else {\n handleButtonNavigation(true);\n }\n }\n\n return () => clearInterval(id);\n },\n [autoScrollTimer, shouldAutoScroll]\n );\n\n useEffect(\n () => {\n const {\n current: { offsetWidth, scrollWidth }\n } = ref;\n if (scrollWidth <= offsetWidth)\n setButtonDisplays({ displayLeft: false, displayRight: false });\n setShouldAutoScroll(enableAutoScroll);\n },\n [enableAutoScroll]\n );\n\n const handleScroll = () => {\n const {\n current: { offsetWidth, scrollLeft, scrollWidth }\n } = ref;\n const updatedDisplayLeft = !!scrollLeft;\n const updatedDisplayRight = scrollLeft + offsetWidth + 1 < scrollWidth;\n setButtonDisplays({ displayLeft: updatedDisplayLeft, displayRight: updatedDisplayRight });\n };\n\n const handleButtonNavigation = direction => {\n if (!ref || !ref.current) return;\n const {\n current: { offsetWidth, scrollLeft, scrollWidth }\n } = ref;\n\n if (autoScrollRef.current && scrollLeft + offsetWidth >= scrollWidth) {\n ref.current.scrollLeft = 0;\n } else {\n ref.current.scrollLeft = direction ? scrollLeft + offsetWidth : scrollLeft - offsetWidth;\n }\n };\n\n const { displayLeft, displayRight } = buttonDisplay;\n const wrapperClassName = `cards-carousel${bannerModifier}`;\n const contentClassName = `cards-carousel--content items-per-row-${itemsPerRow}`;\n\n return (\n <div className={wrapperClassName}>\n <div className=\"cards-carousel--left-button-wrapper\">\n {displayLeft && (\n <button\n type=\"button\"\n className=\"cards-carousel--button-back icon-button icon\"\n onClick={() => {\n setShouldAutoScroll(false);\n handleButtonNavigation();\n }}>\n <i className=\"cards-carousel--arrow__left\" />\n </button>\n )}\n </div>\n <div className=\"cards-carousel--right-button-wrapper\">\n {displayRight && (\n <button\n type=\"button\"\n className=\"cards-carousel--button-forward icon-button icon\"\n onClick={() => {\n setShouldAutoScroll(false);\n handleButtonNavigation(true);\n }}>\n <i className=\"cards-carousel--arrow__right\" />\n </button>\n )}\n </div>\n <div className={contentClassName} ref={ref} onScroll={handleScroll}>\n {children}\n </div>\n </div>\n );\n};\n\nCarouselWrapper.propTypes = {\n bannerModifier: PropTypes.string,\n itemsPerRow: PropTypes.number,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n enableAutoScroll: PropTypes.bool,\n autoScrollTimer: PropTypes.number,\n arrowSize: PropTypes.number\n};\n\nCarouselWrapper.defaultProps = {\n itemsPerRow: 0,\n bannerModifier: '',\n children: [],\n enableAutoScroll: false,\n autoScrollTimer: 0,\n arrowSize: 14\n};\n\nexport default CarouselWrapper;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,MAA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IAAK,SAAS,EAAC;EAAf,GACGT,YAAY,iBACX;IACE,IAAI,EAAC,QADP;IAEE,SAAS,EAAC,iDAFZ;IAGE,OAAO,EAAE,MAAM;MACbE,mBAAmB,CAAC,KAAD,CAAnB;MACAO,sBAAsB,CAAC,IAAD,CAAtB;IACD;EANH,gBAOE;IAAG,SAAS,EAAC;EAAb,EAPF,CAFJ,CAdF,eA2BE;IAAK,SAAS,EAAES,gBAAhB;IAAkC,GAAG,EAAEtB,GAAvC;IAA4C,QAAQ,EAAEgB;EAAtD,GACGtB,QADH,CA3BF,CADF;AAiCD,CArGD;;AAuGAD,eAAe,CAAC8B,SAAhB,GAA4B;EAC1B5B,cAAc,EAAEH,SAAS,CAACgC,MADA;EAE1B5B,WAAW,EAAEJ,SAAS,CAACiC,MAFG;EAG1B/B,QAAQ,EAAEF,SAAS,CAACkC,SAAV,CAAoB,CAAClC,SAAS,CAACmC,OAAV,CAAkBnC,SAAS,CAACoC,IAA5B,CAAD,EAAoCpC,SAAS,CAACoC,IAA9C,CAApB,CAHgB;EAI1B/B,gBAAgB,EAAEL,SAAS,CAACqC,IAJF;EAK1B/B,eAAe,EAAEN,SAAS,CAACiC,MALD;EAM1B1B,SAAS,EAAEP,SAAS,CAACiC;AANK,CAA5B;AASAhC,eAAe,CAACqC,YAAhB,GAA+B;EAC7BlC,WAAW,EAAE,CADgB;EAE7BD,cAAc,EAAE,EAFa;EAG7BD,QAAQ,EAAE,EAHmB;EAI7BG,gBAAgB,EAAE,KAJW;EAK7BC,eAAe,EAAE,CALY;EAM7BC,SAAS,EAAE;AANkB,CAA/B;AASA,eAAeN,eAAf"}
|
|
1
|
+
{"version":3,"file":"CarouselWrapper.js","names":["React","useRef","useState","useEffect","PropTypes","CarouselWrapper","children","bannerModifier","itemsPerRow","enableAutoScroll","autoScrollTimer","arrowSize","ref","buttonDisplay","setButtonDisplays","displayLeft","displayRight","shouldAutoScroll","setShouldAutoScroll","autoScrollRef","current","id","setInterval","scrollCheck","clearInterval","handleButtonNavigation","offsetWidth","scrollWidth","handleScroll","scrollLeft","updatedDisplayLeft","updatedDisplayRight","direction","wrapperClassName","contentClassName","propTypes","string","number","oneOfType","arrayOf","node","bool","defaultProps"],"sources":["../../src/components/CarouselWrapper.js"],"sourcesContent":["import React, { useRef, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\n\nconst CarouselWrapper = ({\n children,\n bannerModifier,\n itemsPerRow,\n enableAutoScroll,\n autoScrollTimer,\n arrowSize\n}) => {\n const ref = useRef();\n const [buttonDisplay, setButtonDisplays] = useState({ displayLeft: false, displayRight: true });\n const [shouldAutoScroll, setShouldAutoScroll] = useState(false);\n const autoScrollRef = useRef();\n\n useEffect(\n () => {\n autoScrollRef.current = shouldAutoScroll;\n const id = setInterval(scrollCheck, autoScrollTimer);\n function scrollCheck() {\n if (!autoScrollRef.current) {\n clearInterval(id);\n } else {\n handleButtonNavigation(true);\n }\n }\n\n return () => clearInterval(id);\n },\n [autoScrollTimer, shouldAutoScroll]\n );\n\n useEffect(\n () => {\n const {\n current: { offsetWidth, scrollWidth }\n } = ref;\n if (scrollWidth <= offsetWidth)\n setButtonDisplays({ displayLeft: false, displayRight: false });\n setShouldAutoScroll(enableAutoScroll);\n },\n [enableAutoScroll]\n );\n\n const handleScroll = () => {\n const {\n current: { offsetWidth, scrollLeft, scrollWidth }\n } = ref;\n const updatedDisplayLeft = !!scrollLeft;\n const updatedDisplayRight = scrollLeft + offsetWidth + 1 < scrollWidth;\n setButtonDisplays({ displayLeft: updatedDisplayLeft, displayRight: updatedDisplayRight });\n };\n\n const handleButtonNavigation = direction => {\n if (!ref || !ref.current) return;\n const {\n current: { offsetWidth, scrollLeft, scrollWidth }\n } = ref;\n\n if (autoScrollRef.current && scrollLeft + offsetWidth >= scrollWidth) {\n ref.current.scrollLeft = 0;\n } else {\n ref.current.scrollLeft = direction ? scrollLeft + offsetWidth : scrollLeft - offsetWidth;\n }\n };\n\n const { displayLeft, displayRight } = buttonDisplay;\n const wrapperClassName = `cards-carousel${bannerModifier}`;\n const contentClassName = `cards-carousel--content items-per-row-${itemsPerRow}`;\n\n return (\n <div className={wrapperClassName}>\n <div className=\"cards-carousel--left-button-wrapper\">\n {displayLeft && (\n <button\n type=\"button\"\n className=\"cards-carousel--button-back icon-button icon\"\n onClick={() => {\n setShouldAutoScroll(false);\n handleButtonNavigation();\n }}>\n <i className=\"cards-carousel--arrow cards-carousel--arrow__left\" />\n </button>\n )}\n </div>\n <div className=\"cards-carousel--right-button-wrapper\">\n {displayRight && (\n <button\n type=\"button\"\n className=\"cards-carousel--button-forward icon-button icon\"\n onClick={() => {\n setShouldAutoScroll(false);\n handleButtonNavigation(true);\n }}>\n <i className=\"cards-carousel--arrow cards-carousel--arrow__right\" />\n </button>\n )}\n </div>\n <div className={contentClassName} ref={ref} onScroll={handleScroll}>\n {children}\n </div>\n </div>\n );\n};\n\nCarouselWrapper.propTypes = {\n bannerModifier: PropTypes.string,\n itemsPerRow: PropTypes.number,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n enableAutoScroll: PropTypes.bool,\n autoScrollTimer: PropTypes.number,\n arrowSize: PropTypes.number\n};\n\nCarouselWrapper.defaultProps = {\n itemsPerRow: 0,\n bannerModifier: '',\n children: [],\n enableAutoScroll: false,\n autoScrollTimer: 0,\n arrowSize: 14\n};\n\nexport default CarouselWrapper;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,MAAhB,EAAwBC,QAAxB,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,SAAP,MAAsB,YAAtB;;AAEA,MAAMC,eAAe,GAAG,CAAC;EACvBC,QADuB;EAEvBC,cAFuB;EAGvBC,WAHuB;EAIvBC,gBAJuB;EAKvBC,eALuB;EAMvBC;AANuB,CAAD,KAOlB;EACJ,MAAMC,GAAG,GAAGX,MAAM,EAAlB;EACA,MAAM,CAACY,aAAD,EAAgBC,iBAAhB,IAAqCZ,QAAQ,CAAC;IAAEa,WA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AtD,GACGtB,QADH,CA3BF,CADF;AAiCD,CArGD;;AAuGAD,eAAe,CAAC8B,SAAhB,GAA4B;EAC1B5B,cAAc,EAAEH,SAAS,CAACgC,MADA;EAE1B5B,WAAW,EAAEJ,SAAS,CAACiC,MAFG;EAG1B/B,QAAQ,EAAEF,SAAS,CAACkC,SAAV,CAAoB,CAAClC,SAAS,CAACmC,OAAV,CAAkBnC,SAAS,CAACoC,IAA5B,CAAD,EAAoCpC,SAAS,CAACoC,IAA9C,CAApB,CAHgB;EAI1B/B,gBAAgB,EAAEL,SAAS,CAACqC,IAJF;EAK1B/B,eAAe,EAAEN,SAAS,CAACiC,MALD;EAM1B1B,SAAS,EAAEP,SAAS,CAACiC;AANK,CAA5B;AASAhC,eAAe,CAACqC,YAAhB,GAA+B;EAC7BlC,WAAW,EAAE,CADgB;EAE7BD,cAAc,EAAE,EAFa;EAG7BD,QAAQ,EAAE,EAHmB;EAI7BG,gBAAgB,EAAE,KAJW;EAK7BC,eAAe,EAAE,CALY;EAM7BC,SAAS,EAAE;AANkB,CAA/B;AASA,eAAeN,eAAf"}
|
|
@@ -3,7 +3,7 @@ import parseFilterValue from './parse-filter-value';
|
|
|
3
3
|
|
|
4
4
|
const buildQuery = (filterValues, filters) => {
|
|
5
5
|
const newQuery = [];
|
|
6
|
-
const searchValue = filterValues[SEARCH_TERM];
|
|
6
|
+
const searchValue = filterValues[SEARCH_TERM] ? encodeURIComponent(filterValues[SEARCH_TERM]) : '';
|
|
7
7
|
if (searchValue) newQuery.push(`${SEARCH_TERM}=${searchValue}`);
|
|
8
8
|
filters.forEach(({
|
|
9
9
|
propsToDisplay,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-query.js","names":["SEARCH_TERM","TEXT_SEARCH","parseFilterValue","buildQuery","filterValues","filters","newQuery","searchValue","push","forEach","propsToDisplay","type","prop","value","parsedValue","includes","join"],"sources":["../../../../src/components/SearchFilter/helpers/build-query.js"],"sourcesContent":["import { SEARCH_TERM, TEXT_SEARCH } from '../constants';\nimport parseFilterValue from './parse-filter-value';\n\nconst buildQuery = (filterValues, filters) => {\n const newQuery = [];\n const searchValue = filterValues[SEARCH_TERM];\n if (searchValue) newQuery.push(`${SEARCH_TERM}=${searchValue}`);\n\n filters.forEach(({ propsToDisplay, type }) => {\n if (type === TEXT_SEARCH) return;\n\n propsToDisplay.forEach(prop => {\n const value = filterValues[prop];\n const parsedValue = parseFilterValue(prop, type, value);\n if (parsedValue && !newQuery.includes(parsedValue)) {\n newQuery.push(parsedValue);\n }\n });\n });\n\n return newQuery.join('&');\n};\n\nexport default buildQuery;\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,cAAzC;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;;AAEA,MAAMC,UAAU,GAAG,CAACC,YAAD,EAAeC,OAAf,KAA2B;EAC5C,MAAMC,QAAQ,GAAG,EAAjB;EACA,MAAMC,WAAW,GAAGH,YAAY,CAACJ,WAAD,
|
|
1
|
+
{"version":3,"file":"build-query.js","names":["SEARCH_TERM","TEXT_SEARCH","parseFilterValue","buildQuery","filterValues","filters","newQuery","searchValue","encodeURIComponent","push","forEach","propsToDisplay","type","prop","value","parsedValue","includes","join"],"sources":["../../../../src/components/SearchFilter/helpers/build-query.js"],"sourcesContent":["import { SEARCH_TERM, TEXT_SEARCH } from '../constants';\nimport parseFilterValue from './parse-filter-value';\n\nconst buildQuery = (filterValues, filters) => {\n const newQuery = [];\n const searchValue = filterValues[SEARCH_TERM]\n ? encodeURIComponent(filterValues[SEARCH_TERM])\n : '';\n if (searchValue) newQuery.push(`${SEARCH_TERM}=${searchValue}`);\n\n filters.forEach(({ propsToDisplay, type }) => {\n if (type === TEXT_SEARCH) return;\n\n propsToDisplay.forEach(prop => {\n const value = filterValues[prop];\n const parsedValue = parseFilterValue(prop, type, value);\n if (parsedValue && !newQuery.includes(parsedValue)) {\n newQuery.push(parsedValue);\n }\n });\n });\n\n return newQuery.join('&');\n};\n\nexport default buildQuery;\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,cAAzC;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;;AAEA,MAAMC,UAAU,GAAG,CAACC,YAAD,EAAeC,OAAf,KAA2B;EAC5C,MAAMC,QAAQ,GAAG,EAAjB;EACA,MAAMC,WAAW,GAAGH,YAAY,CAACJ,WAAD,CAAZ,GAChBQ,kBAAkB,CAACJ,YAAY,CAACJ,WAAD,CAAb,CADF,GAEhB,EAFJ;EAGA,IAAIO,WAAJ,EAAiBD,QAAQ,CAACG,IAAT,CAAe,GAAET,WAAY,IAAGO,WAAY,EAA5C;EAEjBF,OAAO,CAACK,OAAR,CAAgB,CAAC;IAAEC,cAAF;IAAkBC;EAAlB,CAAD,KAA8B;IAC5C,IAAIA,IAAI,KAAKX,WAAb,EAA0B;IAE1BU,cAAc,CAACD,OAAf,CAAuBG,IAAI,IAAI;MAC7B,MAAMC,KAAK,GAAGV,YAAY,CAACS,IAAD,CAA1B;MACA,MAAME,WAAW,GAAGb,gBAAgB,CAACW,IAAD,EAAOD,IAAP,EAAaE,KAAb,CAApC;;MACA,IAAIC,WAAW,IAAI,CAACT,QAAQ,CAACU,QAAT,CAAkBD,WAAlB,CAApB,EAAoD;QAClDT,QAAQ,CAACG,IAAT,CAAcM,WAAd;MACD;IACF,CAND;EAOD,CAVD;EAYA,OAAOT,QAAQ,CAACW,IAAT,CAAc,GAAd,CAAP;AACD,CApBD;;AAsBA,eAAed,UAAf"}
|
|
@@ -9,12 +9,12 @@ const parseFilterValue = (key, type, value) => {
|
|
|
9
9
|
return `${key}=${value.minValue}-${value.maxValue}`;
|
|
10
10
|
|
|
11
11
|
case CHECKBOX:
|
|
12
|
-
if (typeof value === 'string') return `${key}=${value}`;
|
|
13
|
-
return value.map(val => `${key}=${val}`).join('&');
|
|
12
|
+
if (typeof value === 'string') return `${key}=${encodeURIComponent(value)}`;
|
|
13
|
+
return value.map(val => `${key}=${encodeURIComponent(val)}`).join('&');
|
|
14
14
|
|
|
15
15
|
case SELECT:
|
|
16
16
|
{
|
|
17
|
-
const parsedValue = value
|
|
17
|
+
const parsedValue = encodeURIComponent(value);
|
|
18
18
|
return `${key}=${parsedValue}`;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-filter-value.js","names":["RANGE","CHECKBOX","SELECT","parseFilterValue","key","type","value","minValue","min","maxValue","max","map","val","join","parsedValue"
|
|
1
|
+
{"version":3,"file":"parse-filter-value.js","names":["RANGE","CHECKBOX","SELECT","parseFilterValue","key","type","value","minValue","min","maxValue","max","encodeURIComponent","map","val","join","parsedValue"],"sources":["../../../../src/components/SearchFilter/helpers/parse-filter-value.js"],"sourcesContent":["import { RANGE, CHECKBOX, SELECT } from '../constants';\n\nconst parseFilterValue = (key, type, value) => {\n if (!value) return null;\n\n switch (type) {\n case RANGE:\n if (value.minValue === value.min && value.maxValue === value.max) return null;\n return `${key}=${value.minValue}-${value.maxValue}`;\n case CHECKBOX:\n if (typeof value === 'string') return `${key}=${encodeURIComponent(value)}`;\n return value.map(val => `${key}=${encodeURIComponent(val)}`).join('&');\n case SELECT: {\n const parsedValue = encodeURIComponent(value);\n return `${key}=${parsedValue}`;\n }\n\n default:\n return null;\n }\n};\n\nexport default parseFilterValue;\n"],"mappings":"AAAA,SAASA,KAAT,EAAgBC,QAAhB,EAA0BC,MAA1B,QAAwC,cAAxC;;AAEA,MAAMC,gBAAgB,GAAG,CAACC,GAAD,EAAMC,IAAN,EAAYC,KAAZ,KAAsB;EAC7C,IAAI,CAACA,KAAL,EAAY,OAAO,IAAP;;EAEZ,QAAQD,IAAR;IACE,KAAKL,KAAL;MACE,IAAIM,KAAK,CAACC,QAAN,KAAmBD,KAAK,CAACE,GAAzB,IAAgCF,KAAK,CAACG,QAAN,KAAmBH,KAAK,CAACI,GAA7D,EAAkE,OAAO,IAAP;MAClE,OAAQ,GAAEN,GAAI,IAAGE,KAAK,CAACC,QAAS,IAAGD,KAAK,CAACG,QAAS,EAAlD;;IACF,KAAKR,QAAL;MACE,IAAI,OAAOK,KAAP,KAAiB,QAArB,EAA+B,OAAQ,GAAEF,GAAI,IAAGO,kBAAkB,CAACL,KAAD,CAAQ,EAA3C;MAC/B,OAAOA,KAAK,CAACM,GAAN,CAAUC,GAAG,IAAK,GAAET,GAAI,IAAGO,kBAAkB,CAACE,GAAD,CAAM,EAAnD,EAAsDC,IAAtD,CAA2D,GAA3D,CAAP;;IACF,KAAKZ,MAAL;MAAa;QACX,MAAMa,WAAW,GAAGJ,kBAAkB,CAACL,KAAD,CAAtC;QACA,OAAQ,GAAEF,GAAI,IAAGW,WAAY,EAA7B;MACD;;IAED;MACE,OAAO,IAAP;EAbJ;AAeD,CAlBD;;AAoBA,eAAeZ,gBAAf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.124.0-alpha.
|
|
3
|
+
"version": "0.124.0-alpha.42",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"lib/*",
|
|
86
86
|
"lib-es/*"
|
|
87
87
|
],
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "ad2771e3cb49b2ed2a7ab69b1d2489047c952df7"
|
|
89
89
|
}
|
package/src/components/Button.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useState, Fragment } from 'react';
|
|
2
2
|
import { useCookies } from 'react-cookie';
|
|
3
3
|
import { useRouter } from 'next/router';
|
|
4
|
+
import classnames from 'classnames';
|
|
4
5
|
import BlazeButton from '@blaze-react/button';
|
|
5
6
|
import { handleLogout } from '@blaze-cms/core-auth-ui';
|
|
6
7
|
import { useApolloClient } from '@apollo/client';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
+
import PropTypes, { bool, string } from 'prop-types';
|
|
8
9
|
import ClickWrapper from './ClickWrapper';
|
|
9
10
|
import BlazeLink from './BlazeLink';
|
|
10
11
|
import { withTitle } from '../HOC';
|
|
@@ -18,7 +19,19 @@ import {
|
|
|
18
19
|
} from '../helpers';
|
|
19
20
|
|
|
20
21
|
const Button = props => {
|
|
21
|
-
const {
|
|
22
|
+
const {
|
|
23
|
+
type,
|
|
24
|
+
text,
|
|
25
|
+
url,
|
|
26
|
+
icon,
|
|
27
|
+
name,
|
|
28
|
+
style,
|
|
29
|
+
children,
|
|
30
|
+
clickAction,
|
|
31
|
+
childSeoVisibility,
|
|
32
|
+
afterClickText,
|
|
33
|
+
...otherProps
|
|
34
|
+
} = props;
|
|
22
35
|
const client = useApolloClient();
|
|
23
36
|
const router = useRouter();
|
|
24
37
|
const isLogoutButton = clickAction === LOGOUT;
|
|
@@ -54,13 +67,18 @@ const Button = props => {
|
|
|
54
67
|
const { shouldUseClickWrapper, wrapperProps } = getClickWrapperOptions(children, props);
|
|
55
68
|
const Wrapper = shouldUseClickWrapper ? ClickWrapper : Fragment;
|
|
56
69
|
|
|
70
|
+
const contentClassName = classnames('button__content', {
|
|
71
|
+
'button__content--show': showChildren
|
|
72
|
+
});
|
|
73
|
+
|
|
57
74
|
return (
|
|
58
75
|
<Wrapper {...wrapperProps}>
|
|
76
|
+
{childSeoVisibility && <div className={contentClassName}>{renderedChildren}</div>}
|
|
77
|
+
{!childSeoVisibility && showChildren && renderedChildren}
|
|
59
78
|
<DynamicButton className={modifiers} onClick={handleClick} {...currentProps}>
|
|
60
79
|
{icon && <i className={icon} />}
|
|
61
|
-
{text}
|
|
80
|
+
{showChildren ? afterClickText : text}
|
|
62
81
|
</DynamicButton>
|
|
63
|
-
{showChildren && renderedChildren}
|
|
64
82
|
</Wrapper>
|
|
65
83
|
);
|
|
66
84
|
};
|
|
@@ -68,25 +86,29 @@ const Button = props => {
|
|
|
68
86
|
Button.propTypes = {
|
|
69
87
|
clickAction: PropTypes.string,
|
|
70
88
|
text: PropTypes.string,
|
|
89
|
+
afterClickText: string,
|
|
71
90
|
name: PropTypes.string,
|
|
72
91
|
type: PropTypes.string,
|
|
73
92
|
url: PropTypes.string,
|
|
74
93
|
size: PropTypes.string,
|
|
75
94
|
icon: PropTypes.string,
|
|
76
95
|
style: PropTypes.string,
|
|
96
|
+
childSeoVisibility: bool,
|
|
77
97
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
|
|
78
98
|
};
|
|
79
99
|
|
|
80
100
|
Button.defaultProps = {
|
|
81
101
|
clickAction: '',
|
|
82
102
|
text: '',
|
|
103
|
+
afterClickText: '',
|
|
83
104
|
name: '',
|
|
84
105
|
type: '',
|
|
85
106
|
url: null,
|
|
86
107
|
size: '',
|
|
87
108
|
icon: '',
|
|
88
109
|
style: '',
|
|
89
|
-
children: []
|
|
110
|
+
children: [],
|
|
111
|
+
childSeoVisibility: false
|
|
90
112
|
};
|
|
91
113
|
|
|
92
114
|
export default withTitle(Button);
|
|
@@ -56,7 +56,7 @@ const CarouselRender = ({ imageIds, displayCount, ...otherProps }) => {
|
|
|
56
56
|
className="carousel__button carousel__button--previous"
|
|
57
57
|
role="button"
|
|
58
58
|
onClick={() => handleNavigation(navigation.back)}>
|
|
59
|
-
<div className="
|
|
59
|
+
<div className="arrow arrow--left" />
|
|
60
60
|
</div>
|
|
61
61
|
<div className="carousel__list" ref={listRef}>
|
|
62
62
|
{imageIds.map(imageId => <CarouselImage key={imageId} imageId={imageId} {...otherProps} />)}
|
|
@@ -66,7 +66,7 @@ const CarouselRender = ({ imageIds, displayCount, ...otherProps }) => {
|
|
|
66
66
|
role="button"
|
|
67
67
|
onClick={() => handleNavigation(navigation.next)}>
|
|
68
68
|
{shouldDisplayCount && <p>{countMessage}</p>}
|
|
69
|
-
<div className="
|
|
69
|
+
<div className="arrow arrow--right" />
|
|
70
70
|
</div>
|
|
71
71
|
</>
|
|
72
72
|
);
|
|
@@ -80,7 +80,7 @@ const CarouselWrapper = ({
|
|
|
80
80
|
setShouldAutoScroll(false);
|
|
81
81
|
handleButtonNavigation();
|
|
82
82
|
}}>
|
|
83
|
-
<i className="cards-carousel--arrow__left" />
|
|
83
|
+
<i className="cards-carousel--arrow cards-carousel--arrow__left" />
|
|
84
84
|
</button>
|
|
85
85
|
)}
|
|
86
86
|
</div>
|
|
@@ -93,7 +93,7 @@ const CarouselWrapper = ({
|
|
|
93
93
|
setShouldAutoScroll(false);
|
|
94
94
|
handleButtonNavigation(true);
|
|
95
95
|
}}>
|
|
96
|
-
<i className="cards-carousel--arrow__right" />
|
|
96
|
+
<i className="cards-carousel--arrow cards-carousel--arrow__right" />
|
|
97
97
|
</button>
|
|
98
98
|
)}
|
|
99
99
|
</div>
|
|
@@ -3,7 +3,9 @@ import parseFilterValue from './parse-filter-value';
|
|
|
3
3
|
|
|
4
4
|
const buildQuery = (filterValues, filters) => {
|
|
5
5
|
const newQuery = [];
|
|
6
|
-
const searchValue = filterValues[SEARCH_TERM]
|
|
6
|
+
const searchValue = filterValues[SEARCH_TERM]
|
|
7
|
+
? encodeURIComponent(filterValues[SEARCH_TERM])
|
|
8
|
+
: '';
|
|
7
9
|
if (searchValue) newQuery.push(`${SEARCH_TERM}=${searchValue}`);
|
|
8
10
|
|
|
9
11
|
filters.forEach(({ propsToDisplay, type }) => {
|
|
@@ -8,10 +8,10 @@ const parseFilterValue = (key, type, value) => {
|
|
|
8
8
|
if (value.minValue === value.min && value.maxValue === value.max) return null;
|
|
9
9
|
return `${key}=${value.minValue}-${value.maxValue}`;
|
|
10
10
|
case CHECKBOX:
|
|
11
|
-
if (typeof value === 'string') return `${key}=${value}`;
|
|
12
|
-
return value.map(val => `${key}=${val}`).join('&');
|
|
11
|
+
if (typeof value === 'string') return `${key}=${encodeURIComponent(value)}`;
|
|
12
|
+
return value.map(val => `${key}=${encodeURIComponent(val)}`).join('&');
|
|
13
13
|
case SELECT: {
|
|
14
|
-
const parsedValue = value
|
|
14
|
+
const parsedValue = encodeURIComponent(value);
|
|
15
15
|
return `${key}=${parsedValue}`;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { act, render } from '@testing-library/react';
|
|
2
|
+
import { act, render, fireEvent, waitFor } from '@testing-library/react';
|
|
3
3
|
import '@testing-library/jest-dom/extend-expect';
|
|
4
4
|
import Button from '../../../../src/components/Button';
|
|
5
5
|
|
|
@@ -20,6 +20,16 @@ const componentProps = {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
const contentToShow = 'Content to show';
|
|
24
|
+
|
|
25
|
+
const seoVisivilityProps = {
|
|
26
|
+
text: 'show more',
|
|
27
|
+
afterClickText: 'show less',
|
|
28
|
+
url: '',
|
|
29
|
+
icon: '',
|
|
30
|
+
children: [<p>Content to show</p>]
|
|
31
|
+
};
|
|
32
|
+
|
|
23
33
|
const renderComponent = async props => {
|
|
24
34
|
let renderResults;
|
|
25
35
|
|
|
@@ -68,4 +78,48 @@ describe('Button component', () => {
|
|
|
68
78
|
const { container } = await renderComponent(logoutButton);
|
|
69
79
|
expect(container.innerHTML).toBe('');
|
|
70
80
|
});
|
|
81
|
+
|
|
82
|
+
it('should toggle button text and render child components for SEO visibility ', async () => {
|
|
83
|
+
const props = {
|
|
84
|
+
...componentProps,
|
|
85
|
+
...seoVisivilityProps,
|
|
86
|
+
childSeoVisibility: true
|
|
87
|
+
};
|
|
88
|
+
const { container, getByText } = await renderComponent(props);
|
|
89
|
+
|
|
90
|
+
const element = await waitFor(() => getByText('show more'));
|
|
91
|
+
expect(container.innerHTML).toContain(contentToShow);
|
|
92
|
+
|
|
93
|
+
fireEvent(
|
|
94
|
+
element,
|
|
95
|
+
new MouseEvent('click', {
|
|
96
|
+
bubbles: true,
|
|
97
|
+
cancelable: true
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
expect(container.innerHTML).toContain('show less');
|
|
101
|
+
expect(container.innerHTML).toContain(contentToShow);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('should toggle button text hide child components when SEO visibility is disabled', async () => {
|
|
105
|
+
const props = {
|
|
106
|
+
...componentProps,
|
|
107
|
+
...seoVisivilityProps,
|
|
108
|
+
childSeoVisibility: false
|
|
109
|
+
};
|
|
110
|
+
const { container, getByText } = await renderComponent(props);
|
|
111
|
+
|
|
112
|
+
const element = await waitFor(() => getByText('show more'));
|
|
113
|
+
expect(container.innerHTML).not.toContain(contentToShow);
|
|
114
|
+
|
|
115
|
+
fireEvent(
|
|
116
|
+
element,
|
|
117
|
+
new MouseEvent('click', {
|
|
118
|
+
bubbles: true,
|
|
119
|
+
cancelable: true
|
|
120
|
+
})
|
|
121
|
+
);
|
|
122
|
+
expect(container.innerHTML).toContain('show less');
|
|
123
|
+
expect(container.innerHTML).toContain(contentToShow);
|
|
124
|
+
});
|
|
71
125
|
});
|
|
@@ -11,7 +11,7 @@ exports[`Carousel component should render carousel and match snapshot 1`] = `
|
|
|
11
11
|
role="button"
|
|
12
12
|
>
|
|
13
13
|
<div
|
|
14
|
-
class="
|
|
14
|
+
class="arrow arrow--left"
|
|
15
15
|
/>
|
|
16
16
|
</div>
|
|
17
17
|
<div
|
|
@@ -28,7 +28,7 @@ exports[`Carousel component should render carousel and match snapshot 1`] = `
|
|
|
28
28
|
role="button"
|
|
29
29
|
>
|
|
30
30
|
<div
|
|
31
|
-
class="
|
|
31
|
+
class="arrow arrow--right"
|
|
32
32
|
/>
|
|
33
33
|
</div>
|
|
34
34
|
</div>
|
|
@@ -24,10 +24,10 @@ describe('buildQuery helper function', () => {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it('should return new query string with search term if available', () => {
|
|
27
|
-
expect(withTextSearch).toEqual('search_term=new
|
|
27
|
+
expect(withTextSearch).toEqual('search_term=new%20search%20value');
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
it('should return new query string with search text and all other available query values', () => {
|
|
31
|
-
expect(withSearchAndRange).toEqual('search_term=new
|
|
31
|
+
expect(withSearchAndRange).toEqual('search_term=new%20search%20value&rangeFilter=2-10');
|
|
32
32
|
});
|
|
33
33
|
});
|
|
@@ -30,6 +30,6 @@ describe('parseFilterValue helper function', () => {
|
|
|
30
30
|
expect(rangeValue).toEqual('rangeVal=10-20');
|
|
31
31
|
expect(checkboxArrayValue).toEqual('checkVal=check1&checkVal=check2');
|
|
32
32
|
expect(checkboxStringValue).toEqual('checkVal2=check3');
|
|
33
|
-
expect(selectValue).toEqual('selectVal=select
|
|
33
|
+
expect(selectValue).toEqual('selectVal=select%20value');
|
|
34
34
|
});
|
|
35
35
|
});
|