@blaze-cms/react-page-builder 0.143.1 → 0.144.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/lib/components/DataSummary/DataSummaryFactory.js +17 -8
- package/lib/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryRender.js +29 -5
- package/lib/components/DataSummary/DataSummaryRender.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +2 -0
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DateTime/DateTime.js +1 -1
- package/lib/components/DateTime/DateTime.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js +17 -6
- package/lib/components/SearchContent/SearchContent.js.map +1 -1
- package/lib/components/SearchContent/SearchContentItems.js +1 -1
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/hooks/helpers/getVariant.js.map +1 -1
- package/lib/variants/SlideSummary/SlideSummary.js +27 -0
- package/lib/variants/SlideSummary/SlideSummary.js.map +1 -0
- package/lib/variants/SlideSummary/index.js +43 -0
- package/lib/variants/SlideSummary/index.js.map +1 -0
- package/lib/variants/index.js +3 -1
- package/lib/variants/index.js.map +1 -1
- package/lib-es/components/DataSummary/DataSummaryFactory.js +29 -21
- package/lib-es/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib-es/components/DataSummary/DataSummaryRender.js +27 -6
- package/lib-es/components/DataSummary/DataSummaryRender.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +2 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DateTime/DateTime.js +1 -1
- package/lib-es/components/DateTime/DateTime.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContent.js +16 -6
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js +1 -1
- package/lib-es/components/SearchContent/SearchContentItems.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/hooks/helpers/getVariant.js.map +1 -1
- package/lib-es/variants/SlideSummary/SlideSummary.js +21 -0
- package/lib-es/variants/SlideSummary/SlideSummary.js.map +1 -0
- package/lib-es/variants/SlideSummary/index.js +12 -0
- package/lib-es/variants/SlideSummary/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 +5 -5
- package/src/components/DataSummary/DataSummaryFactory.js +17 -5
- package/src/components/DataSummary/DataSummaryRender.js +32 -4
- package/src/components/DataSummary/helpers/build-loop-props-content.js +8 -3
- package/src/components/DateTime/DateTime.js +1 -1
- package/src/components/SearchContent/SearchContent.js +16 -6
- package/src/components/SearchContent/SearchContentItems.js +1 -1
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +0 -2
- package/src/hooks/helpers/getVariant.js +1 -0
- package/src/variants/SlideSummary/SlideSummary.js +15 -0
- package/src/variants/SlideSummary/index.js +12 -0
- package/src/variants/index.js +3 -1
- package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/SearchFilter.test.js.snap +1 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFilter.js","names":["React","useState","useEffect","PropTypes","classnames","debounce","FiltersList","isDeviceDesktop","getResponsiveFilterClassnames","buildUrlQuery","CloseMobileForm","ResetDesktopForm","MobileFormToolbar","SEARCH","REFINE","MORE_FILTERS_CLASSES","SearchFilter","searchFilterRef","listComponentName","data","filters","hasUrl","entity","handleSearch","name","isCollapsedOnResponsive","displaySearchFilter","setDisplaySearchFilter","groupAfterDesktop","groupAfterMobile","filterValues","setAppliedFilters","query","moreFiltersMobileCollapsed","setMoreFiltersMobileCollapsed","moreFiltersDesktopCollapsed","setMoreFiltersDesktopCollapsed","doSubmit","newValues","newQuery","handleSubmit","shouldSearch","type","formClass","moreFiltersMobileWrapperClass","moreFiltersMobileTogglerClass","moreFiltersDesktopWrapperClass","moreFiltersDesktopTogglerClass","formId","handleReset","updateFilterValues","shouldSubmit","shouldGroup","createElement","Fragment","ref","className","id","onSubmit","e","preventDefault","handleClose","slice","onClick","MOBILE_CONTENT","DESKTOP_CONTENT","DESKTOP_BUTTONS","MOBILE_BUTTONS","role","propTypes","object","isRequired","array","bool","string","func","number","defaultProps"],"sources":["../../../../src/components/SearchFilter/SearchFilter/SearchFilter.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport debounce from 'lodash.debounce';\nimport FiltersList from './FiltersList';\nimport { isDeviceDesktop, getResponsiveFilterClassnames, buildUrlQuery } from '../helpers';\n\nimport CloseMobileForm from './CloseMobileForm';\nimport ResetDesktopForm from './ResetDesktopForm';\nimport MobileFormToolbar from './MobileFormToolbar';\nimport { SEARCH, REFINE, MORE_FILTERS_CLASSES } from '../constants';\n\nconst SearchFilter = ({\n searchFilterRef,\n listComponentName,\n data,\n filters,\n hasUrl,\n entity,\n handleSearch,\n name,\n isCollapsedOnResponsive,\n displaySearchFilter,\n setDisplaySearchFilter,\n groupAfterDesktop,\n groupAfterMobile,\n filterValues,\n setAppliedFilters,\n query\n}) => {\n const [moreFiltersMobileCollapsed, setMoreFiltersMobileCollapsed] = useState(true);\n const [moreFiltersDesktopCollapsed, setMoreFiltersDesktopCollapsed] = useState(true);\n\n const doSubmit = newValues => {\n const newQuery = filterValues\n ? buildUrlQuery(newValues, filters, listComponentName, query)\n : '';\n handleSearch(newQuery);\n setMoreFiltersDesktopCollapsed(true);\n setMoreFiltersMobileCollapsed(true);\n };\n\n const handleSubmit = debounce(newValues => {\n doSubmit(newValues);\n }, 200);\n\n useEffect(\n () => {\n if (filterValues.shouldSearch) {\n handleSubmit(filterValues);\n setAppliedFilters({ type: 'resetSearch' });\n }\n },\n [filterValues, handleSubmit, setAppliedFilters]\n );\n\n const formClass = classnames('filter__form filter__form--initial', {\n 'filter__form--mobile': isCollapsedOnResponsive && displaySearchFilter,\n 'filter__form--collapsible': isCollapsedOnResponsive\n });\n\n const {\n moreFiltersMobileWrapperClass,\n moreFiltersMobileTogglerClass,\n moreFiltersDesktopWrapperClass,\n moreFiltersDesktopTogglerClass\n } = getResponsiveFilterClassnames(moreFiltersDesktopCollapsed, moreFiltersMobileCollapsed);\n\n const formId = `filter-${name}-form`;\n\n const handleReset = () => {\n setAppliedFilters({ type: 'reset' });\n doSubmit();\n };\n\n const updateFilterValues = (newValues, shouldSubmit) => {\n setAppliedFilters({ newValues, shouldSearch: shouldSubmit, type: 'update' });\n };\n\n const shouldGroup = !!(groupAfterDesktop || groupAfterMobile);\n\n return (\n <>\n <form\n ref={searchFilterRef}\n className={formClass}\n data-testid={formId}\n id={formId}\n onSubmit={e => {\n e.preventDefault();\n doSubmit(filterValues);\n }}>\n {displaySearchFilter && (\n <CloseMobileForm handleClose={() => setDisplaySearchFilter(false)} />\n )}\n\n <div className=\"filter filter--search-refine\">\n <ResetDesktopForm handleReset={handleReset} />\n\n <div className=\"filter__wrapper filter__wrapper--search-refine\">\n {!shouldGroup && (\n <FiltersList\n shouldSearch={!hasUrl}\n data={data}\n filters={filters}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n )}\n\n {shouldGroup && (\n <>\n <FiltersList\n shouldSearch={!hasUrl}\n data={data}\n filters={filters.slice(0, groupAfterMobile)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterMobile && (\n <button\n data-testId=\"search-filter-mobile-toggler\"\n className={moreFiltersMobileTogglerClass}\n type=\"button\"\n onClick={() => setMoreFiltersMobileCollapsed(!moreFiltersMobileCollapsed)}>\n Filters\n </button>\n )}\n\n <div className={moreFiltersMobileWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.MOBILE_CONTENT}>\n <FiltersList\n shouldSearch={!hasUrl && isDeviceDesktop()}\n data={data}\n filters={filters.slice(\n groupAfterMobile,\n groupAfterDesktop ? groupAfterDesktop - 1 : 0\n )}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterDesktop && (\n <button\n data-testId=\"search-filter-desktop-toggler\"\n className={moreFiltersDesktopTogglerClass}\n type=\"button\"\n onClick={() =>\n setMoreFiltersDesktopCollapsed(!moreFiltersDesktopCollapsed)\n }>\n {moreFiltersDesktopCollapsed ? 'More filters' : 'Less filters'}\n </button>\n )}\n\n <div className={moreFiltersDesktopWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.DESKTOP_CONTENT}>\n <FiltersList\n shouldSearch={false}\n data={data}\n filters={filters.slice(groupAfterDesktop)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n </div>\n\n <div className={MORE_FILTERS_CLASSES.DESKTOP_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </div>\n\n <div className={MORE_FILTERS_CLASSES.MOBILE_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </>\n )}\n\n <br />\n\n {!displaySearchFilter && (\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n )}\n </div>\n </div>\n\n {displaySearchFilter && <MobileFormToolbar formId={formId} handleReset={handleReset} />}\n </form>\n\n {isCollapsedOnResponsive &&\n !displaySearchFilter && (\n <div className=\"filter__refine filter__refine--mobile-close\" data-testid=\"refine-mobile\">\n <div\n role=\"button\"\n onClick={() => setDisplaySearchFilter(true)}\n aria-label=\"Toggle Search Filter\">\n {REFINE}\n </div>\n </div>\n )}\n </>\n );\n};\n\nSearchFilter.propTypes = {\n data: PropTypes.object.isRequired,\n filters: PropTypes.array.isRequired,\n searchFilterRef: PropTypes.object.isRequired,\n hasUrl: PropTypes.bool.isRequired,\n entity: PropTypes.string.isRequired,\n handleSearch: PropTypes.func.isRequired,\n name: PropTypes.string.isRequired,\n displaySearchFilter: PropTypes.bool.isRequired,\n setDisplaySearchFilter: PropTypes.func.isRequired,\n isCollapsedOnResponsive: PropTypes.bool.isRequired,\n groupAfterDesktop: PropTypes.number.isRequired,\n groupAfterMobile: PropTypes.number.isRequired,\n filterValues: PropTypes.object.isRequired,\n setAppliedFilters: PropTypes.func.isRequired,\n listComponentName: PropTypes.string,\n query: PropTypes.object\n};\n\nSearchFilter.defaultProps = {\n listComponentName: '',\n query: {}\n};\n\nexport default SearchFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ,MAAM,iBAAiB;AACtC,OAAOC,WAAW,MAAM,eAAe;AACvC,SAASC,eAAe,EAAEC,6BAA6B,EAAEC,aAAa,QAAQ,YAAY;AAE1F,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,SAASC,MAAM,EAAEC,MAAM,EAAEC,oBAAoB,QAAQ,cAAc;AAEnE,MAAMC,YAAY,GAAGA,CAAC;EACpBC,eAAe;EACfC,iBAAiB;EACjBC,IAAI;EACJC,OAAO;EACPC,MAAM;EACNC,MAAM;EACNC,YAAY;EACZC,IAAI;EACJC,uBAAuB;EACvBC,mBAAmB;EACnBC,sBAAsB;EACtBC,iBAAiB;EACjBC,gBAAgB;EAChBC,YAAY;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,EAAEf,SAAS,CAACuE,MAAM;EACnC1C,KAAK,EAAE7B,SAAS,CAACmE;AACnB,CAAC;AAEDtD,YAAY,CAAC6D,YAAY,GAAG;EAC1B3D,iBAAiB,EAAE,EAAE;EACrBc,KAAK,EAAE,CAAC;AACV,CAAC;AAED,eAAehB,YAAY"}
|
|
1
|
+
{"version":3,"file":"SearchFilter.js","names":["React","useState","useEffect","PropTypes","classnames","debounce","FiltersList","isDeviceDesktop","getResponsiveFilterClassnames","buildUrlQuery","CloseMobileForm","ResetDesktopForm","MobileFormToolbar","SEARCH","REFINE","MORE_FILTERS_CLASSES","SearchFilter","searchFilterRef","listComponentName","data","filters","hasUrl","entity","handleSearch","name","isCollapsedOnResponsive","displaySearchFilter","setDisplaySearchFilter","groupAfterDesktop","groupAfterMobile","filterValues","setAppliedFilters","query","moreFiltersMobileCollapsed","setMoreFiltersMobileCollapsed","moreFiltersDesktopCollapsed","setMoreFiltersDesktopCollapsed","doSubmit","newValues","newQuery","handleSubmit","shouldSearch","type","formClass","moreFiltersMobileWrapperClass","moreFiltersMobileTogglerClass","moreFiltersDesktopWrapperClass","moreFiltersDesktopTogglerClass","formId","handleReset","updateFilterValues","shouldSubmit","shouldGroup","createElement","Fragment","ref","className","id","onSubmit","e","preventDefault","handleClose","slice","onClick","MOBILE_CONTENT","DESKTOP_CONTENT","DESKTOP_BUTTONS","MOBILE_BUTTONS","role","propTypes","object","isRequired","array","bool","string","func","number","defaultProps"],"sources":["../../../../src/components/SearchFilter/SearchFilter/SearchFilter.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport debounce from 'lodash.debounce';\nimport FiltersList from './FiltersList';\nimport { isDeviceDesktop, getResponsiveFilterClassnames, buildUrlQuery } from '../helpers';\n\nimport CloseMobileForm from './CloseMobileForm';\nimport ResetDesktopForm from './ResetDesktopForm';\nimport MobileFormToolbar from './MobileFormToolbar';\nimport { SEARCH, REFINE, MORE_FILTERS_CLASSES } from '../constants';\n\nconst SearchFilter = ({\n searchFilterRef,\n listComponentName,\n data,\n filters,\n hasUrl,\n entity,\n handleSearch,\n name,\n isCollapsedOnResponsive,\n displaySearchFilter,\n setDisplaySearchFilter,\n groupAfterDesktop,\n groupAfterMobile,\n filterValues,\n setAppliedFilters,\n query\n}) => {\n const [moreFiltersMobileCollapsed, setMoreFiltersMobileCollapsed] = useState(true);\n const [moreFiltersDesktopCollapsed, setMoreFiltersDesktopCollapsed] = useState(true);\n\n const doSubmit = newValues => {\n const newQuery = filterValues\n ? buildUrlQuery(newValues, filters, listComponentName, query)\n : '';\n handleSearch(newQuery);\n setMoreFiltersDesktopCollapsed(true);\n setMoreFiltersMobileCollapsed(true);\n };\n\n const handleSubmit = debounce(newValues => {\n doSubmit(newValues);\n }, 200);\n\n useEffect(\n () => {\n if (filterValues.shouldSearch) {\n handleSubmit(filterValues);\n setAppliedFilters({ type: 'resetSearch' });\n }\n },\n [filterValues, handleSubmit, setAppliedFilters]\n );\n\n const formClass = classnames('filter__form filter__form--initial', {\n 'filter__form--mobile': isCollapsedOnResponsive && displaySearchFilter,\n 'filter__form--collapsible': isCollapsedOnResponsive\n });\n\n const {\n moreFiltersMobileWrapperClass,\n moreFiltersMobileTogglerClass,\n moreFiltersDesktopWrapperClass,\n moreFiltersDesktopTogglerClass\n } = getResponsiveFilterClassnames(moreFiltersDesktopCollapsed, moreFiltersMobileCollapsed);\n\n const formId = `filter-${name}-form`;\n\n const handleReset = () => {\n setAppliedFilters({ type: 'reset' });\n doSubmit();\n };\n\n const updateFilterValues = (newValues, shouldSubmit) => {\n setAppliedFilters({ newValues, shouldSearch: shouldSubmit, type: 'update' });\n };\n\n const shouldGroup = !!(groupAfterDesktop || groupAfterMobile);\n\n return (\n <>\n <form\n ref={searchFilterRef}\n className={formClass}\n data-testid={formId}\n id={formId}\n onSubmit={e => {\n e.preventDefault();\n doSubmit(filterValues);\n }}>\n {displaySearchFilter && (\n <CloseMobileForm handleClose={() => setDisplaySearchFilter(false)} />\n )}\n\n <div className=\"filter filter--search-refine\">\n <ResetDesktopForm handleReset={handleReset} />\n\n <div className=\"filter__wrapper filter__wrapper--search-refine\">\n {!shouldGroup && (\n <FiltersList\n shouldSearch={!hasUrl}\n data={data}\n filters={filters}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n )}\n\n {shouldGroup && (\n <>\n <FiltersList\n shouldSearch={!hasUrl}\n data={data}\n filters={filters.slice(0, groupAfterMobile)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterMobile && (\n <button\n data-testId=\"search-filter-mobile-toggler\"\n className={moreFiltersMobileTogglerClass}\n type=\"button\"\n onClick={() => setMoreFiltersMobileCollapsed(!moreFiltersMobileCollapsed)}>\n Filters\n </button>\n )}\n\n <div className={moreFiltersMobileWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.MOBILE_CONTENT}>\n <FiltersList\n shouldSearch={!hasUrl && isDeviceDesktop()}\n data={data}\n filters={filters.slice(\n groupAfterMobile,\n groupAfterDesktop ? groupAfterDesktop - 1 : 0\n )}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterDesktop && (\n <button\n data-testId=\"search-filter-desktop-toggler\"\n className={moreFiltersDesktopTogglerClass}\n type=\"button\"\n onClick={() =>\n setMoreFiltersDesktopCollapsed(!moreFiltersDesktopCollapsed)\n }>\n {moreFiltersDesktopCollapsed ? 'More filters' : 'Less filters'}\n </button>\n )}\n\n <div className={moreFiltersDesktopWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.DESKTOP_CONTENT}>\n <FiltersList\n shouldSearch={false}\n data={data}\n filters={filters.slice(groupAfterDesktop)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n </div>\n\n <div className={MORE_FILTERS_CLASSES.DESKTOP_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </div>\n\n <div className={MORE_FILTERS_CLASSES.MOBILE_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </>\n )}\n\n {!displaySearchFilter && (\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n )}\n </div>\n </div>\n\n {displaySearchFilter && <MobileFormToolbar formId={formId} handleReset={handleReset} />}\n </form>\n\n {isCollapsedOnResponsive &&\n !displaySearchFilter && (\n <div className=\"filter__refine filter__refine--mobile-close\" data-testid=\"refine-mobile\">\n <div\n role=\"button\"\n onClick={() => setDisplaySearchFilter(true)}\n aria-label=\"Toggle Search Filter\">\n {REFINE}\n </div>\n </div>\n )}\n </>\n );\n};\n\nSearchFilter.propTypes = {\n data: PropTypes.object.isRequired,\n filters: PropTypes.array.isRequired,\n searchFilterRef: PropTypes.object.isRequired,\n hasUrl: PropTypes.bool.isRequired,\n entity: PropTypes.string.isRequired,\n handleSearch: PropTypes.func.isRequired,\n name: PropTypes.string.isRequired,\n displaySearchFilter: PropTypes.bool.isRequired,\n setDisplaySearchFilter: PropTypes.func.isRequired,\n isCollapsedOnResponsive: PropTypes.bool.isRequired,\n groupAfterDesktop: PropTypes.number.isRequired,\n groupAfterMobile: PropTypes.number.isRequired,\n filterValues: PropTypes.object.isRequired,\n setAppliedFilters: PropTypes.func.isRequired,\n listComponentName: PropTypes.string,\n query: PropTypes.object\n};\n\nSearchFilter.defaultProps = {\n listComponentName: '',\n query: {}\n};\n\nexport default SearchFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAA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EACvC/C,IAAI,EAAErB,SAAS,CAACuE,MAAM,CAACH,UAAU;EACjC7C,mBAAmB,EAAEvB,SAAS,CAACsE,IAAI,CAACF,UAAU;EAC9C5C,sBAAsB,EAAExB,SAAS,CAACwE,IAAI,CAACJ,UAAU;EACjD9C,uBAAuB,EAAEtB,SAAS,CAACsE,IAAI,CAACF,UAAU;EAClD3C,iBAAiB,EAAEzB,SAAS,CAACyE,MAAM,CAACL,UAAU;EAC9C1C,gBAAgB,EAAE1B,SAAS,CAACyE,MAAM,CAACL,UAAU;EAC7CzC,YAAY,EAAE3B,SAAS,CAACmE,MAAM,CAACC,UAAU;EACzCxC,iBAAiB,EAAE5B,SAAS,CAACwE,IAAI,CAACJ,UAAU;EAC5CrD,iBAAiB,EAAEf,SAAS,CAACuE,MAAM;EACnC1C,KAAK,EAAE7B,SAAS,CAACmE;AACnB,CAAC;AAEDtD,YAAY,CAAC6D,YAAY,GAAG;EAC1B3D,iBAAiB,EAAE,EAAE;EACrBc,KAAK,EAAE,CAAC;AACV,CAAC;AAED,eAAehB,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVariant.js","names":["variantHandler","getVariant","settings","variant","VariantComponent","getSettings","get","variantSettings"],"sources":["../../../src/hooks/helpers/getVariant.js"],"sourcesContent":["import { variantHandler } from '../../utils';\n\nexport default function getVariant(settings) {\n const { variant } = settings;\n if (!variant) return [null, {}];\n\n const { VariantComponent, getSettings } = variantHandler.get(variant) || {};\n const variantSettings =\n !!getSettings && typeof getSettings === 'function' ? getSettings(settings) : settings;\n\n return [VariantComponent, variantSettings];\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,aAAa;AAE5C,eAAe,SAASC,UAAUA,CAACC,QAAQ,EAAE;EAC3C,MAAM;IAAEC;EAAQ,CAAC,GAAGD,QAAQ;EAC5B,IAAI,CAACC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;EAE/B,MAAM;IAAEC,gBAAgB;IAAEC;EAAY,CAAC,GAAGL,cAAc,CAACM,GAAG,CAACH,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"getVariant.js","names":["variantHandler","getVariant","settings","variant","VariantComponent","getSettings","get","variantSettings"],"sources":["../../../src/hooks/helpers/getVariant.js"],"sourcesContent":["import { variantHandler } from '../../utils';\n\nexport default function getVariant(settings) {\n const { variant } = settings;\n if (!variant) return [null, {}];\n\n const { VariantComponent, getSettings } = variantHandler.get(variant) || {};\n\n const variantSettings =\n !!getSettings && typeof getSettings === 'function' ? getSettings(settings) : settings;\n\n return [VariantComponent, variantSettings];\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,aAAa;AAE5C,eAAe,SAASC,UAAUA,CAACC,QAAQ,EAAE;EAC3C,MAAM;IAAEC;EAAQ,CAAC,GAAGD,QAAQ;EAC5B,IAAI,CAACC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;EAE/B,MAAM;IAAEC,gBAAgB;IAAEC;EAAY,CAAC,GAAGL,cAAc,CAACM,GAAG,CAACH,OAAO,CAAC,IAAI,CAAC,CAAC;EAE3E,MAAMI,eAAe,GACnB,CAAC,CAACF,WAAW,IAAI,OAAOA,WAAW,KAAK,UAAU,GAAGA,WAAW,CAACH,QAAQ,CAAC,GAAGA,QAAQ;EAEvF,OAAO,CAACE,gBAAgB,EAAEG,eAAe,CAAC;AAC5C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
const _excluded = ["children"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import CarouselWrapper from '../../components/CarouselWrapper';
|
|
7
|
+
const SlideSummary = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
children
|
|
10
|
+
} = _ref,
|
|
11
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
return /*#__PURE__*/React.createElement(CarouselWrapper, _extends({}, otherProps, {
|
|
13
|
+
enableAutoScroll: true,
|
|
14
|
+
autoScrollTimer: 3000
|
|
15
|
+
}), children);
|
|
16
|
+
};
|
|
17
|
+
SlideSummary.propTypes = {
|
|
18
|
+
children: PropTypes.string.isRequired
|
|
19
|
+
};
|
|
20
|
+
export default SlideSummary;
|
|
21
|
+
//# sourceMappingURL=SlideSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlideSummary.js","names":["React","PropTypes","CarouselWrapper","SlideSummary","_ref","children","otherProps","_objectWithoutProperties","_excluded","createElement","_extends","enableAutoScroll","autoScrollTimer","propTypes","string","isRequired"],"sources":["../../../src/variants/SlideSummary/SlideSummary.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport CarouselWrapper from '../../components/CarouselWrapper';\n\nconst SlideSummary = ({ children, ...otherProps }) => (\n <CarouselWrapper {...otherProps} enableAutoScroll autoScrollTimer={3000}>\n {children}\n </CarouselWrapper>\n);\n\nSlideSummary.propTypes = {\n children: PropTypes.string.isRequired\n};\n\nexport default SlideSummary;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,eAAe,MAAM,kCAAkC;AAE9D,MAAMC,YAAY,GAAGC,IAAA;EAAA,IAAC;MAAEC;IAAwB,CAAC,GAAAD,IAAA;IAAZE,UAAU,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;EAAA,oBAC7CR,KAAA,CAAAS,aAAA,CAACP,eAAe,EAAAQ,QAAA,KAAKJ,UAAU;IAAEK,gBAAgB;IAACC,eAAe,EAAE;EAAK,IACrEP,QACc,CAAC;AAAA,CACnB;AAEDF,YAAY,CAACU,SAAS,GAAG;EACvBR,QAAQ,EAAEJ,SAAS,CAACa,MAAM,CAACC;AAC7B,CAAC;AAED,eAAeZ,YAAY"}
|
|
@@ -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 SlideSummary = {
|
|
6
|
+
getSettings: componentSettings => _objectSpread(_objectSpread({}, componentSettings), {}, {
|
|
7
|
+
modifier: 'slide-summary'
|
|
8
|
+
}),
|
|
9
|
+
VariantComponent: dynamic(() => import( /* webpackChunkName: "blazePbVariantSlideSummary" */'./SlideSummary'))
|
|
10
|
+
};
|
|
11
|
+
export default SlideSummary;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["dynamic","SlideSummary","getSettings","componentSettings","_objectSpread","modifier","VariantComponent"],"sources":["../../../src/variants/SlideSummary/index.js"],"sourcesContent":["import dynamic from 'next/dynamic';\n\nconst SlideSummary = {\n getSettings: componentSettings => ({\n ...componentSettings,\n modifier: 'slide-summary'\n }),\n VariantComponent: dynamic(() =>\n import(/* webpackChunkName: \"blazePbVariantSlideSummary\" */ './SlideSummary')\n )\n};\nexport default SlideSummary;\n"],"mappings":";;;AAAA,OAAOA,OAAO,MAAM,cAAc;AAElC,MAAMC,YAAY,GAAG;EACnBC,WAAW,EAAEC,iBAAiB,IAAAC,aAAA,CAAAA,aAAA,KACzBD,iBAAiB;IACpBE,QAAQ,EAAE;EAAe,EACzB;EACFC,gBAAgB,EAAEN,OAAO,CAAC,MACxB,MAAM,EAAC,oDAAqD,gBAAgB,CAC9E;AACF,CAAC;AACD,eAAeC,YAAY"}
|
package/lib-es/variants/index.js
CHANGED
|
@@ -4,12 +4,14 @@ import longformGallery from './LongformGallery';
|
|
|
4
4
|
import longformRow from './LongformRow';
|
|
5
5
|
import parallaxImageTextRight from './ParallaxImageTextRight';
|
|
6
6
|
import thumbnailCarousel from './ThumbnailCarousel';
|
|
7
|
+
import slideSummary from './SlideSummary';
|
|
7
8
|
export default {
|
|
8
9
|
heroImage,
|
|
9
10
|
infographic,
|
|
10
11
|
longformGallery,
|
|
11
12
|
longformRow,
|
|
12
13
|
parallaxImageTextRight,
|
|
13
|
-
thumbnailCarousel
|
|
14
|
+
thumbnailCarousel,
|
|
15
|
+
slideSummary
|
|
14
16
|
};
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["heroImage","infographic","longformGallery","longformRow","parallaxImageTextRight","thumbnailCarousel"],"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';\n\nexport default {\n heroImage,\n infographic,\n longformGallery,\n longformRow,\n parallaxImageTextRight,\n thumbnailCarousel\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;
|
|
1
|
+
{"version":3,"file":"index.js","names":["heroImage","infographic","longformGallery","longformRow","parallaxImageTextRight","thumbnailCarousel","slideSummary"],"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';\n\nexport default {\n heroImage,\n infographic,\n longformGallery,\n longformRow,\n parallaxImageTextRight,\n thumbnailCarousel,\n slideSummary\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;AAEzC,eAAe;EACbN,SAAS;EACTC,WAAW;EACXC,eAAe;EACfC,WAAW;EACXC,sBAAsB;EACtBC,iBAAiB;EACjBC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.144.0-alpha.0",
|
|
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": "
|
|
30
|
+
"@blaze-cms/core-auth-ui": "0.144.0-alpha.0",
|
|
31
31
|
"@blaze-cms/core-errors": "^0.140.3",
|
|
32
32
|
"@blaze-cms/core-errors-ui": "^0.140.3",
|
|
33
33
|
"@blaze-cms/image-cdn-react": "0.3.0-alpha.6",
|
|
34
34
|
"@blaze-cms/nextjs-components": "^0.143.0",
|
|
35
|
-
"@blaze-cms/plugin-search-ui": "
|
|
35
|
+
"@blaze-cms/plugin-search-ui": "0.144.0-alpha.0",
|
|
36
36
|
"@blaze-cms/setup-ui": "^0.140.3",
|
|
37
|
-
"@blaze-cms/utils": "
|
|
37
|
+
"@blaze-cms/utils": "0.144.0-alpha.0",
|
|
38
38
|
"@blaze-cms/utils-handlebars": "^0.143.0",
|
|
39
39
|
"@blaze-react/breadcrumb": "0.8.0-alpha.60",
|
|
40
40
|
"@blaze-react/button": "0.5.19",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"lib/*",
|
|
91
91
|
"lib-es/*"
|
|
92
92
|
],
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "dce87b273c13dd9750bb7e13ea675ba6797f84f7"
|
|
94
94
|
}
|
|
@@ -18,12 +18,15 @@ const DataSummaryFactory = ({
|
|
|
18
18
|
headingStyle,
|
|
19
19
|
loopProperties,
|
|
20
20
|
loopLimit,
|
|
21
|
-
|
|
21
|
+
variant,
|
|
22
|
+
VariantComponent,
|
|
23
|
+
parent
|
|
22
24
|
}) => {
|
|
23
|
-
const entityForQuery = useSelectedEntity ? entity :
|
|
25
|
+
const entityForQuery = useSelectedEntity ? entity : parent.itemEntity;
|
|
24
26
|
const { data, error, loading } = useQuery(getSingleEntitySchema, {
|
|
25
27
|
variables: { id: entityForQuery }
|
|
26
28
|
});
|
|
29
|
+
|
|
27
30
|
const { isPreview } = useContext(MainContext);
|
|
28
31
|
if (loading) return '';
|
|
29
32
|
if (error) return error.message;
|
|
@@ -33,7 +36,8 @@ const DataSummaryFactory = ({
|
|
|
33
36
|
const linkProps = getLinkProps(propsToDisplay);
|
|
34
37
|
const propsQueryString = buildPropsQuery(data, propsToDisplayValues, null, linkProps);
|
|
35
38
|
const dataSummaryQuery = getDataSummaryQuery(data, isPreview, propsQueryString);
|
|
36
|
-
const recordId = dataRecordId[0] ||
|
|
39
|
+
const recordId = dataRecordId[0] || parent.itemId;
|
|
40
|
+
const isSlider = variant === 'slideSummary';
|
|
37
41
|
|
|
38
42
|
return (
|
|
39
43
|
<DataSummaryRender
|
|
@@ -46,11 +50,15 @@ const DataSummaryFactory = ({
|
|
|
46
50
|
elementTitle={elementTitle}
|
|
47
51
|
modifier={modifier}
|
|
48
52
|
htmlTag={headingStyle}
|
|
53
|
+
variant={variant}
|
|
54
|
+
VariantComponent={VariantComponent}
|
|
55
|
+
isSlider={isSlider}
|
|
49
56
|
/>
|
|
50
57
|
);
|
|
51
58
|
};
|
|
52
59
|
|
|
53
60
|
DataSummaryFactory.propTypes = {
|
|
61
|
+
parent: PropTypes.object.isRequired,
|
|
54
62
|
type: PropTypes.string,
|
|
55
63
|
dataRecordId: PropTypes.array,
|
|
56
64
|
propsToDisplay: PropTypes.array,
|
|
@@ -60,7 +68,9 @@ DataSummaryFactory.propTypes = {
|
|
|
60
68
|
modifier: PropTypes.string,
|
|
61
69
|
headingStyle: PropTypes.string,
|
|
62
70
|
loopProperties: PropTypes.array,
|
|
63
|
-
loopLimit: PropTypes.number
|
|
71
|
+
loopLimit: PropTypes.number,
|
|
72
|
+
variant: PropTypes.string,
|
|
73
|
+
VariantComponent: PropTypes.func
|
|
64
74
|
};
|
|
65
75
|
|
|
66
76
|
DataSummaryFactory.defaultProps = {
|
|
@@ -73,7 +83,9 @@ DataSummaryFactory.defaultProps = {
|
|
|
73
83
|
modifier: '',
|
|
74
84
|
headingStyle: 'h2',
|
|
75
85
|
loopProperties: [],
|
|
76
|
-
loopLimit: 0
|
|
86
|
+
loopLimit: 0,
|
|
87
|
+
variant: null,
|
|
88
|
+
VariantComponent: null
|
|
77
89
|
};
|
|
78
90
|
|
|
79
91
|
export default DataSummaryFactory;
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
stripSummaryPropsContent,
|
|
9
9
|
buildLoopPropsContent
|
|
10
10
|
} from './helpers';
|
|
11
|
+
import { parsePropsToDisplay } from '../../helpers';
|
|
11
12
|
|
|
12
13
|
const DataSummaryRender = ({
|
|
13
14
|
type,
|
|
@@ -18,8 +19,11 @@ const DataSummaryRender = ({
|
|
|
18
19
|
elementTitle,
|
|
19
20
|
loopProperties,
|
|
20
21
|
loopLimit,
|
|
22
|
+
VariantComponent,
|
|
23
|
+
isSlider,
|
|
21
24
|
...otherProps
|
|
22
25
|
}) => {
|
|
26
|
+
const SummaryComponent = summaryComponents[type];
|
|
23
27
|
const { data, error, loading } = useQuery(query, {
|
|
24
28
|
variables: { id: recordId }
|
|
25
29
|
});
|
|
@@ -32,16 +36,33 @@ const DataSummaryRender = ({
|
|
|
32
36
|
const shouldLoop = loopProperties && loopProperties.length;
|
|
33
37
|
const modifier = getClassModifiers('list', otherProps);
|
|
34
38
|
const summaryPropsWithContent = shouldLoop
|
|
35
|
-
? buildLoopPropsContent(loopProperties, propsToDisplay, loopLimit, entityData)
|
|
39
|
+
? buildLoopPropsContent(loopProperties, propsToDisplay, loopLimit, entityData, isSlider)
|
|
36
40
|
: buildPropsToDisplayWithContent(entityData, propsToDisplay);
|
|
37
41
|
|
|
38
42
|
const summaryPropsWithCleanContent = stripSummaryPropsContent(
|
|
39
43
|
propsToDisplay,
|
|
40
44
|
summaryPropsWithContent
|
|
41
45
|
);
|
|
42
|
-
const
|
|
46
|
+
const parsedPropsToDisplay = parsePropsToDisplay(entityData, propsToDisplay);
|
|
43
47
|
if (!summaryPropsWithCleanContent.length) return null;
|
|
44
48
|
|
|
49
|
+
if (VariantComponent)
|
|
50
|
+
return (
|
|
51
|
+
<VariantComponent
|
|
52
|
+
propsToDisplay={propsToDisplay}
|
|
53
|
+
summaryPropsWithContent={summaryPropsWithCleanContent}
|
|
54
|
+
parsedPropsToDisplay={parsedPropsToDisplay}>
|
|
55
|
+
{summaryPropsWithContent.map(summaryProps => (
|
|
56
|
+
<SummaryComponent
|
|
57
|
+
modifier={modifier}
|
|
58
|
+
elementTitle={elementTitle}
|
|
59
|
+
summaryPropsWithContent={summaryProps}
|
|
60
|
+
htmlTag={htmlTag}
|
|
61
|
+
/>
|
|
62
|
+
))}
|
|
63
|
+
</VariantComponent>
|
|
64
|
+
);
|
|
65
|
+
|
|
45
66
|
return (
|
|
46
67
|
<SummaryComponent
|
|
47
68
|
modifier={modifier}
|
|
@@ -53,17 +74,23 @@ const DataSummaryRender = ({
|
|
|
53
74
|
};
|
|
54
75
|
|
|
55
76
|
DataSummaryRender.propTypes = {
|
|
77
|
+
entities: PropTypes.array.isRequired,
|
|
78
|
+
mainSchemas: PropTypes.object.isRequired,
|
|
79
|
+
isSlider: PropTypes.bool.isRequired,
|
|
56
80
|
type: PropTypes.string,
|
|
81
|
+
name: PropTypes.string,
|
|
57
82
|
query: PropTypes.object,
|
|
58
83
|
recordId: PropTypes.string,
|
|
59
84
|
propsToDisplay: PropTypes.array,
|
|
60
85
|
elementTitle: PropTypes.string,
|
|
61
86
|
htmlTag: PropTypes.string,
|
|
62
87
|
loopProperties: PropTypes.array,
|
|
63
|
-
loopLimit: PropTypes.number
|
|
88
|
+
loopLimit: PropTypes.number,
|
|
89
|
+
VariantComponent: PropTypes.func
|
|
64
90
|
};
|
|
65
91
|
|
|
66
92
|
DataSummaryRender.defaultProps = {
|
|
93
|
+
name: '',
|
|
67
94
|
type: 'text',
|
|
68
95
|
query: {},
|
|
69
96
|
recordId: '',
|
|
@@ -71,7 +98,8 @@ DataSummaryRender.defaultProps = {
|
|
|
71
98
|
elementTitle: '',
|
|
72
99
|
htmlTag: 'h2',
|
|
73
100
|
loopProperties: [],
|
|
74
|
-
loopLimit: 0
|
|
101
|
+
loopLimit: 0,
|
|
102
|
+
VariantComponent: null
|
|
75
103
|
};
|
|
76
104
|
|
|
77
105
|
export default DataSummaryRender;
|
|
@@ -32,10 +32,15 @@ const separateValues = (propsToDisplay, loopProps, data) => {
|
|
|
32
32
|
return [regularValues, loopValues];
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
const buildLoopPropsContent = (
|
|
35
|
+
const buildLoopPropsContent = (
|
|
36
|
+
loopProps = [],
|
|
37
|
+
propsToDisplay = [],
|
|
38
|
+
limit = 0,
|
|
39
|
+
data = {},
|
|
40
|
+
isSlider = false
|
|
41
|
+
) => {
|
|
36
42
|
const loopPropsWithContent = [];
|
|
37
43
|
const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);
|
|
38
|
-
|
|
39
44
|
const loopLimit = getLoopPropsLimit(loopValues, limit);
|
|
40
45
|
|
|
41
46
|
for (let i = 0; i < loopLimit; i += 1) {
|
|
@@ -57,7 +62,7 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
57
62
|
).filter(Boolean);
|
|
58
63
|
loopPropsWithContent.push(propsArray);
|
|
59
64
|
}
|
|
60
|
-
|
|
65
|
+
if (isSlider) return loopPropsWithContent;
|
|
61
66
|
return flatten(loopPropsWithContent);
|
|
62
67
|
};
|
|
63
68
|
|
|
@@ -7,7 +7,7 @@ import Wrapper from '../Wrapper';
|
|
|
7
7
|
dayjs.extend(LocalizedFormat);
|
|
8
8
|
|
|
9
9
|
const DateTime = ({ format, customFormat, modifier }) => {
|
|
10
|
-
const dateFormat = customFormat
|
|
10
|
+
const dateFormat = customFormat || format;
|
|
11
11
|
|
|
12
12
|
if (!dateFormat) return null;
|
|
13
13
|
|
|
@@ -12,7 +12,9 @@ const SearchContent = ({
|
|
|
12
12
|
isMobile,
|
|
13
13
|
placeholder,
|
|
14
14
|
modifier,
|
|
15
|
-
collapsedSearch
|
|
15
|
+
collapsedSearch,
|
|
16
|
+
searchUrl,
|
|
17
|
+
navigateToSingleSearchResult
|
|
16
18
|
}) => {
|
|
17
19
|
const searchContentRef = useRef(null);
|
|
18
20
|
const [collapsed, setCollapsed] = useState(collapsedSearch);
|
|
@@ -69,9 +71,13 @@ const SearchContent = ({
|
|
|
69
71
|
router.push(url);
|
|
70
72
|
};
|
|
71
73
|
|
|
72
|
-
const
|
|
74
|
+
const handleKeyDown = e => {
|
|
73
75
|
if (e.key === 'Enter' && e.target.value !== '') {
|
|
74
|
-
|
|
76
|
+
if (navigateToSingleSearchResult && results && results.length === 1 && results[0].url) {
|
|
77
|
+
router.push(results[0].url);
|
|
78
|
+
} else {
|
|
79
|
+
router.push(`${searchUrl || '/search'}?search_term=${e.target.value}`);
|
|
80
|
+
}
|
|
75
81
|
}
|
|
76
82
|
};
|
|
77
83
|
|
|
@@ -110,7 +116,7 @@ const SearchContent = ({
|
|
|
110
116
|
placeholder={placeholder}
|
|
111
117
|
value={searchTerm}
|
|
112
118
|
onChange={e => setSearchTerm(e.target.value)}
|
|
113
|
-
|
|
119
|
+
onKeyDown={handleKeyDown}
|
|
114
120
|
onFocus={() => setShowResults(true)}
|
|
115
121
|
data-testid="search-content-input"
|
|
116
122
|
/>
|
|
@@ -135,7 +141,9 @@ SearchContent.propTypes = {
|
|
|
135
141
|
isMobile: PropTypes.bool,
|
|
136
142
|
entities: PropTypes.array.isRequired,
|
|
137
143
|
modifier: PropTypes.string,
|
|
138
|
-
collapsedSearch: PropTypes.bool
|
|
144
|
+
collapsedSearch: PropTypes.bool,
|
|
145
|
+
searchUrl: PropTypes.string,
|
|
146
|
+
navigateToSingleSearchResult: PropTypes.bool
|
|
139
147
|
};
|
|
140
148
|
|
|
141
149
|
SearchContent.defaultProps = {
|
|
@@ -144,7 +152,9 @@ SearchContent.defaultProps = {
|
|
|
144
152
|
placeholder: '',
|
|
145
153
|
isMobile: false,
|
|
146
154
|
modifier: '',
|
|
147
|
-
collapsedSearch: false
|
|
155
|
+
collapsedSearch: false,
|
|
156
|
+
searchUrl: '',
|
|
157
|
+
navigateToSingleSearchResult: false
|
|
148
158
|
};
|
|
149
159
|
|
|
150
160
|
export default SearchContent;
|
|
@@ -5,6 +5,7 @@ export default function getVariant(settings) {
|
|
|
5
5
|
if (!variant) return [null, {}];
|
|
6
6
|
|
|
7
7
|
const { VariantComponent, getSettings } = variantHandler.get(variant) || {};
|
|
8
|
+
|
|
8
9
|
const variantSettings =
|
|
9
10
|
!!getSettings && typeof getSettings === 'function' ? getSettings(settings) : settings;
|
|
10
11
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import CarouselWrapper from '../../components/CarouselWrapper';
|
|
4
|
+
|
|
5
|
+
const SlideSummary = ({ children, ...otherProps }) => (
|
|
6
|
+
<CarouselWrapper {...otherProps} enableAutoScroll autoScrollTimer={3000}>
|
|
7
|
+
{children}
|
|
8
|
+
</CarouselWrapper>
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
SlideSummary.propTypes = {
|
|
12
|
+
children: PropTypes.string.isRequired
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default SlideSummary;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import dynamic from 'next/dynamic';
|
|
2
|
+
|
|
3
|
+
const SlideSummary = {
|
|
4
|
+
getSettings: componentSettings => ({
|
|
5
|
+
...componentSettings,
|
|
6
|
+
modifier: 'slide-summary'
|
|
7
|
+
}),
|
|
8
|
+
VariantComponent: dynamic(() =>
|
|
9
|
+
import(/* webpackChunkName: "blazePbVariantSlideSummary" */ './SlideSummary')
|
|
10
|
+
)
|
|
11
|
+
};
|
|
12
|
+
export default SlideSummary;
|
package/src/variants/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import longformGallery from './LongformGallery';
|
|
|
4
4
|
import longformRow from './LongformRow';
|
|
5
5
|
import parallaxImageTextRight from './ParallaxImageTextRight';
|
|
6
6
|
import thumbnailCarousel from './ThumbnailCarousel';
|
|
7
|
+
import slideSummary from './SlideSummary';
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
10
|
heroImage,
|
|
@@ -11,5 +12,6 @@ export default {
|
|
|
11
12
|
longformGallery,
|
|
12
13
|
longformRow,
|
|
13
14
|
parallaxImageTextRight,
|
|
14
|
-
thumbnailCarousel
|
|
15
|
+
thumbnailCarousel,
|
|
16
|
+
slideSummary
|
|
15
17
|
};
|
package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/SearchFilter.test.js.snap
CHANGED
|
@@ -46,7 +46,6 @@ exports[`SearchFilter component should render without throwing error and match s
|
|
|
46
46
|
<div
|
|
47
47
|
class="filter__wrapper filter__wrapper--search-refine"
|
|
48
48
|
>
|
|
49
|
-
<br />
|
|
50
49
|
<button
|
|
51
50
|
class="button button--full-width"
|
|
52
51
|
type="submit"
|
|
@@ -224,7 +223,6 @@ exports[`SearchFilter component when groupAfterMobile = 0 and groupAfterDesktop
|
|
|
224
223
|
</button>
|
|
225
224
|
</div>
|
|
226
225
|
</div>
|
|
227
|
-
<br />
|
|
228
226
|
<button
|
|
229
227
|
class="button button--full-width"
|
|
230
228
|
type="submit"
|
|
@@ -402,7 +400,6 @@ exports[`SearchFilter component when groupAfterMobile > 0 and groupAfterDesktop
|
|
|
402
400
|
</button>
|
|
403
401
|
</div>
|
|
404
402
|
</div>
|
|
405
|
-
<br />
|
|
406
403
|
<button
|
|
407
404
|
class="button button--full-width"
|
|
408
405
|
type="submit"
|
|
@@ -587,7 +584,6 @@ exports[`SearchFilter component when groupAfterMobile > 0 and groupAfterDesktop
|
|
|
587
584
|
</button>
|
|
588
585
|
</div>
|
|
589
586
|
</div>
|
|
590
|
-
<br />
|
|
591
587
|
<button
|
|
592
588
|
class="button button--full-width"
|
|
593
589
|
type="submit"
|
|
@@ -657,7 +653,6 @@ exports[`SearchFilter component when isCollapsedOnResponsive = false, displaySea
|
|
|
657
653
|
<div
|
|
658
654
|
class="filter__wrapper filter__wrapper--search-refine"
|
|
659
655
|
>
|
|
660
|
-
<br />
|
|
661
656
|
<button
|
|
662
657
|
class="button button--full-width"
|
|
663
658
|
type="submit"
|
|
@@ -744,9 +739,7 @@ exports[`SearchFilter component when isCollapsedOnResponsive = true, displaySear
|
|
|
744
739
|
</div>
|
|
745
740
|
<div
|
|
746
741
|
class="filter__wrapper filter__wrapper--search-refine"
|
|
747
|
-
|
|
748
|
-
<br />
|
|
749
|
-
</div>
|
|
742
|
+
/>
|
|
750
743
|
</div>
|
|
751
744
|
<div
|
|
752
745
|
class="filter__refine filter__refine--mobile-open"
|