@blaze-cms/react-page-builder 0.143.0 → 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 +22 -0
- package/lib/components/Card/CardsRender.js +1 -1
- package/lib/components/Card/CardsRender.js.map +1 -1
- 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/List/ListRender.js +5 -7
- package/lib/components/List/ListRender.js.map +1 -1
- package/lib/components/List/helpers/get-sort-props.js +1 -1
- package/lib/components/List/helpers/get-sort-props.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/helpers/build-raw-query.js +2 -2
- package/lib/helpers/build-raw-query.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/Card/CardsRender.js +1 -1
- package/lib-es/components/Card/CardsRender.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/List/ListRender.js +3 -5
- package/lib-es/components/List/ListRender.js.map +1 -1
- package/lib-es/components/List/helpers/get-sort-props.js +1 -1
- package/lib-es/components/List/helpers/get-sort-props.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/helpers/build-raw-query.js +2 -2
- package/lib-es/helpers/build-raw-query.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/Card/CardsRender.js +4 -3
- 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/List/ListRender.js +4 -5
- package/src/components/List/helpers/get-sort-props.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/helpers/build-raw-query.js +15 -13
- 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/helpers/mocks.js +19 -16
- package/tests/unit/src/components/List/helpers/get-sort-props.test.js +10 -0
- package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/SearchFilter.test.js.snap +1 -8
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
const _excluded = ["entity", "dataRecordId", "propsToDisplay", "type", "useSelectedEntity", "elementTitle", "modifier", "headingStyle", "loopProperties", "loopLimit"];
|
|
3
1
|
import React, { useContext } from 'react';
|
|
4
2
|
import { useQuery } from '@apollo/client';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
@@ -8,21 +6,22 @@ import { getSingleEntitySchema } from '../../application/query';
|
|
|
8
6
|
import { buildPropsQuery, checkPropsToUse } from '../../helpers';
|
|
9
7
|
import { getDataSummaryQuery, getLinkProps } from './helpers';
|
|
10
8
|
import DataSummaryRender from './DataSummaryRender';
|
|
11
|
-
const DataSummaryFactory =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
const DataSummaryFactory = ({
|
|
10
|
+
entity,
|
|
11
|
+
dataRecordId,
|
|
12
|
+
propsToDisplay,
|
|
13
|
+
type,
|
|
14
|
+
useSelectedEntity,
|
|
15
|
+
elementTitle,
|
|
16
|
+
modifier,
|
|
17
|
+
headingStyle,
|
|
18
|
+
loopProperties,
|
|
19
|
+
loopLimit,
|
|
20
|
+
variant,
|
|
21
|
+
VariantComponent,
|
|
22
|
+
parent
|
|
23
|
+
}) => {
|
|
24
|
+
const entityForQuery = useSelectedEntity ? entity : parent.itemEntity;
|
|
26
25
|
const {
|
|
27
26
|
data,
|
|
28
27
|
error,
|
|
@@ -43,7 +42,8 @@ const DataSummaryFactory = _ref => {
|
|
|
43
42
|
const linkProps = getLinkProps(propsToDisplay);
|
|
44
43
|
const propsQueryString = buildPropsQuery(data, propsToDisplayValues, null, linkProps);
|
|
45
44
|
const dataSummaryQuery = getDataSummaryQuery(data, isPreview, propsQueryString);
|
|
46
|
-
const recordId = dataRecordId[0] ||
|
|
45
|
+
const recordId = dataRecordId[0] || parent.itemId;
|
|
46
|
+
const isSlider = variant === 'slideSummary';
|
|
47
47
|
return /*#__PURE__*/React.createElement(DataSummaryRender, {
|
|
48
48
|
recordId: recordId,
|
|
49
49
|
propsToDisplay: propsToDisplay,
|
|
@@ -53,10 +53,14 @@ const DataSummaryFactory = _ref => {
|
|
|
53
53
|
type: type,
|
|
54
54
|
elementTitle: elementTitle,
|
|
55
55
|
modifier: modifier,
|
|
56
|
-
htmlTag: headingStyle
|
|
56
|
+
htmlTag: headingStyle,
|
|
57
|
+
variant: variant,
|
|
58
|
+
VariantComponent: VariantComponent,
|
|
59
|
+
isSlider: isSlider
|
|
57
60
|
});
|
|
58
61
|
};
|
|
59
62
|
DataSummaryFactory.propTypes = {
|
|
63
|
+
parent: PropTypes.object.isRequired,
|
|
60
64
|
type: PropTypes.string,
|
|
61
65
|
dataRecordId: PropTypes.array,
|
|
62
66
|
propsToDisplay: PropTypes.array,
|
|
@@ -66,7 +70,9 @@ DataSummaryFactory.propTypes = {
|
|
|
66
70
|
modifier: PropTypes.string,
|
|
67
71
|
headingStyle: PropTypes.string,
|
|
68
72
|
loopProperties: PropTypes.array,
|
|
69
|
-
loopLimit: PropTypes.number
|
|
73
|
+
loopLimit: PropTypes.number,
|
|
74
|
+
variant: PropTypes.string,
|
|
75
|
+
VariantComponent: PropTypes.func
|
|
70
76
|
};
|
|
71
77
|
DataSummaryFactory.defaultProps = {
|
|
72
78
|
type: 'text',
|
|
@@ -78,7 +84,9 @@ DataSummaryFactory.defaultProps = {
|
|
|
78
84
|
modifier: '',
|
|
79
85
|
headingStyle: 'h2',
|
|
80
86
|
loopProperties: [],
|
|
81
|
-
loopLimit: 0
|
|
87
|
+
loopLimit: 0,
|
|
88
|
+
variant: null,
|
|
89
|
+
VariantComponent: null
|
|
82
90
|
};
|
|
83
91
|
export default DataSummaryFactory;
|
|
84
92
|
//# sourceMappingURL=DataSummaryFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataSummaryFactory.js","names":["React","useContext","useQuery","PropTypes","MainContext","getSingleEntitySchema","buildPropsQuery","checkPropsToUse","getDataSummaryQuery","getLinkProps","DataSummaryRender","DataSummaryFactory","
|
|
1
|
+
{"version":3,"file":"DataSummaryFactory.js","names":["React","useContext","useQuery","PropTypes","MainContext","getSingleEntitySchema","buildPropsQuery","checkPropsToUse","getDataSummaryQuery","getLinkProps","DataSummaryRender","DataSummaryFactory","entity","dataRecordId","propsToDisplay","type","useSelectedEntity","elementTitle","modifier","headingStyle","loopProperties","loopLimit","variant","VariantComponent","parent","entityForQuery","itemEntity","data","error","loading","variables","id","isPreview","message","length","propsToDisplayValues","linkProps","propsQueryString","dataSummaryQuery","recordId","itemId","isSlider","createElement","query","htmlTag","propTypes","object","isRequired","string","array","bool","number","func","defaultProps"],"sources":["../../../src/components/DataSummary/DataSummaryFactory.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { getSingleEntitySchema } from '../../application/query';\nimport { buildPropsQuery, checkPropsToUse } from '../../helpers';\nimport { getDataSummaryQuery, getLinkProps } from './helpers';\nimport DataSummaryRender from './DataSummaryRender';\n\nconst DataSummaryFactory = ({\n entity,\n dataRecordId,\n propsToDisplay,\n type,\n useSelectedEntity,\n elementTitle,\n modifier,\n headingStyle,\n loopProperties,\n loopLimit,\n variant,\n VariantComponent,\n parent\n}) => {\n const entityForQuery = useSelectedEntity ? entity : parent.itemEntity;\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: entityForQuery }\n });\n\n const { isPreview } = useContext(MainContext);\n if (loading) return '';\n if (error) return error.message;\n if (!data) return null;\n if (!propsToDisplay || !propsToDisplay.length) return null;\n const propsToDisplayValues = checkPropsToUse(propsToDisplay);\n const linkProps = getLinkProps(propsToDisplay);\n const propsQueryString = buildPropsQuery(data, propsToDisplayValues, null, linkProps);\n const dataSummaryQuery = getDataSummaryQuery(data, isPreview, propsQueryString);\n const recordId = dataRecordId[0] || parent.itemId;\n const isSlider = variant === 'slideSummary';\n\n return (\n <DataSummaryRender\n recordId={recordId}\n propsToDisplay={propsToDisplay}\n loopProperties={loopProperties}\n loopLimit={loopLimit}\n query={dataSummaryQuery}\n type={type}\n elementTitle={elementTitle}\n modifier={modifier}\n htmlTag={headingStyle}\n variant={variant}\n VariantComponent={VariantComponent}\n isSlider={isSlider}\n />\n );\n};\n\nDataSummaryFactory.propTypes = {\n parent: PropTypes.object.isRequired,\n type: PropTypes.string,\n dataRecordId: PropTypes.array,\n propsToDisplay: PropTypes.array,\n entity: PropTypes.string,\n useSelectedEntity: PropTypes.bool,\n elementTitle: PropTypes.string,\n modifier: PropTypes.string,\n headingStyle: PropTypes.string,\n loopProperties: PropTypes.array,\n loopLimit: PropTypes.number,\n variant: PropTypes.string,\n VariantComponent: PropTypes.func\n};\n\nDataSummaryFactory.defaultProps = {\n type: 'text',\n dataRecordId: [],\n propsToDisplay: [],\n useSelectedEntity: true,\n entity: '',\n elementTitle: '',\n modifier: '',\n headingStyle: 'h2',\n loopProperties: [],\n loopLimit: 0,\n variant: null,\n VariantComponent: null\n};\n\nexport default DataSummaryFactory;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ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kB,CAAC0C,YAAY,GAAG;EAChCtC,IAAI,EAAE,MAAM;EACZF,YAAY,EAAE,EAAE;EAChBC,cAAc,EAAE,EAAE;EAClBE,iBAAiB,EAAE,IAAI;EACvBJ,MAAM,EAAE,EAAE;EACVK,YAAY,EAAE,EAAE;EAChBC,QAAQ,EAAE,EAAE;EACZC,YAAY,EAAE,IAAI;EAClBC,cAAc,EAAE,EAAE;EAClBC,SAAS,EAAE,CAAC;EACZC,OAAO,EAAE,IAAI;EACbC,gBAAgB,EAAE;AACpB,CAAC;AAED,eAAeZ,kBAAkB"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
-
const _excluded = ["type", "htmlTag", "recordId", "query", "propsToDisplay", "elementTitle", "loopProperties", "loopLimit"];
|
|
2
|
+
const _excluded = ["type", "htmlTag", "recordId", "query", "propsToDisplay", "elementTitle", "loopProperties", "loopLimit", "VariantComponent", "isSlider"];
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { useQuery } from '@apollo/client';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { summaryComponents } from './DataSummaryTypes';
|
|
7
7
|
import { getClassModifiers } from '../../utils';
|
|
8
8
|
import { buildPropsToDisplayWithContent, stripSummaryPropsContent, buildLoopPropsContent } from './helpers';
|
|
9
|
+
import { parsePropsToDisplay } from '../../helpers';
|
|
9
10
|
const DataSummaryRender = _ref => {
|
|
10
11
|
let {
|
|
11
12
|
type,
|
|
@@ -15,9 +16,12 @@ const DataSummaryRender = _ref => {
|
|
|
15
16
|
propsToDisplay,
|
|
16
17
|
elementTitle,
|
|
17
18
|
loopProperties,
|
|
18
|
-
loopLimit
|
|
19
|
+
loopLimit,
|
|
20
|
+
VariantComponent,
|
|
21
|
+
isSlider
|
|
19
22
|
} = _ref,
|
|
20
23
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
const SummaryComponent = summaryComponents[type];
|
|
21
25
|
const {
|
|
22
26
|
data,
|
|
23
27
|
error,
|
|
@@ -35,10 +39,20 @@ const DataSummaryRender = _ref => {
|
|
|
35
39
|
} = data;
|
|
36
40
|
const shouldLoop = loopProperties && loopProperties.length;
|
|
37
41
|
const modifier = getClassModifiers('list', otherProps);
|
|
38
|
-
const summaryPropsWithContent = shouldLoop ? buildLoopPropsContent(loopProperties, propsToDisplay, loopLimit, entityData) : buildPropsToDisplayWithContent(entityData, propsToDisplay);
|
|
42
|
+
const summaryPropsWithContent = shouldLoop ? buildLoopPropsContent(loopProperties, propsToDisplay, loopLimit, entityData, isSlider) : buildPropsToDisplayWithContent(entityData, propsToDisplay);
|
|
39
43
|
const summaryPropsWithCleanContent = stripSummaryPropsContent(propsToDisplay, summaryPropsWithContent);
|
|
40
|
-
const
|
|
44
|
+
const parsedPropsToDisplay = parsePropsToDisplay(entityData, propsToDisplay);
|
|
41
45
|
if (!summaryPropsWithCleanContent.length) return null;
|
|
46
|
+
if (VariantComponent) return /*#__PURE__*/React.createElement(VariantComponent, {
|
|
47
|
+
propsToDisplay: propsToDisplay,
|
|
48
|
+
summaryPropsWithContent: summaryPropsWithCleanContent,
|
|
49
|
+
parsedPropsToDisplay: parsedPropsToDisplay
|
|
50
|
+
}, summaryPropsWithContent.map(summaryProps => /*#__PURE__*/React.createElement(SummaryComponent, {
|
|
51
|
+
modifier: modifier,
|
|
52
|
+
elementTitle: elementTitle,
|
|
53
|
+
summaryPropsWithContent: summaryProps,
|
|
54
|
+
htmlTag: htmlTag
|
|
55
|
+
})));
|
|
42
56
|
return /*#__PURE__*/React.createElement(SummaryComponent, {
|
|
43
57
|
modifier: modifier,
|
|
44
58
|
elementTitle: elementTitle,
|
|
@@ -47,16 +61,22 @@ const DataSummaryRender = _ref => {
|
|
|
47
61
|
});
|
|
48
62
|
};
|
|
49
63
|
DataSummaryRender.propTypes = {
|
|
64
|
+
entities: PropTypes.array.isRequired,
|
|
65
|
+
mainSchemas: PropTypes.object.isRequired,
|
|
66
|
+
isSlider: PropTypes.bool.isRequired,
|
|
50
67
|
type: PropTypes.string,
|
|
68
|
+
name: PropTypes.string,
|
|
51
69
|
query: PropTypes.object,
|
|
52
70
|
recordId: PropTypes.string,
|
|
53
71
|
propsToDisplay: PropTypes.array,
|
|
54
72
|
elementTitle: PropTypes.string,
|
|
55
73
|
htmlTag: PropTypes.string,
|
|
56
74
|
loopProperties: PropTypes.array,
|
|
57
|
-
loopLimit: PropTypes.number
|
|
75
|
+
loopLimit: PropTypes.number,
|
|
76
|
+
VariantComponent: PropTypes.func
|
|
58
77
|
};
|
|
59
78
|
DataSummaryRender.defaultProps = {
|
|
79
|
+
name: '',
|
|
60
80
|
type: 'text',
|
|
61
81
|
query: {},
|
|
62
82
|
recordId: '',
|
|
@@ -64,7 +84,8 @@ DataSummaryRender.defaultProps = {
|
|
|
64
84
|
elementTitle: '',
|
|
65
85
|
htmlTag: 'h2',
|
|
66
86
|
loopProperties: [],
|
|
67
|
-
loopLimit: 0
|
|
87
|
+
loopLimit: 0,
|
|
88
|
+
VariantComponent: null
|
|
68
89
|
};
|
|
69
90
|
export default DataSummaryRender;
|
|
70
91
|
//# sourceMappingURL=DataSummaryRender.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataSummaryRender.js","names":["React","useQuery","PropTypes","summaryComponents","getClassModifiers","buildPropsToDisplayWithContent","stripSummaryPropsContent","buildLoopPropsContent","DataSummaryRender","_ref","type","htmlTag","recordId","query","propsToDisplay","elementTitle","loopProperties","loopLimit","otherProps","_objectWithoutProperties","_excluded","data","error","loading","variables","id","message","entityData","shouldLoop","length","modifier","summaryPropsWithContent","summaryPropsWithCleanContent","
|
|
1
|
+
{"version":3,"file":"DataSummaryRender.js","names":["React","useQuery","PropTypes","summaryComponents","getClassModifiers","buildPropsToDisplayWithContent","stripSummaryPropsContent","buildLoopPropsContent","parsePropsToDisplay","DataSummaryRender","_ref","type","htmlTag","recordId","query","propsToDisplay","elementTitle","loopProperties","loopLimit","VariantComponent","isSlider","otherProps","_objectWithoutProperties","_excluded","SummaryComponent","data","error","loading","variables","id","message","entityData","shouldLoop","length","modifier","summaryPropsWithContent","summaryPropsWithCleanContent","parsedPropsToDisplay","createElement","map","summaryProps","propTypes","entities","array","isRequired","mainSchemas","object","bool","string","name","number","func","defaultProps"],"sources":["../../../src/components/DataSummary/DataSummaryRender.js"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { summaryComponents } from './DataSummaryTypes';\nimport { getClassModifiers } from '../../utils';\nimport {\n buildPropsToDisplayWithContent,\n stripSummaryPropsContent,\n buildLoopPropsContent\n} from './helpers';\nimport { parsePropsToDisplay } from '../../helpers';\n\nconst DataSummaryRender = ({\n type,\n htmlTag,\n recordId,\n query,\n propsToDisplay,\n elementTitle,\n loopProperties,\n loopLimit,\n VariantComponent,\n isSlider,\n ...otherProps\n}) => {\n const SummaryComponent = summaryComponents[type];\n const { data, error, loading } = useQuery(query, {\n variables: { id: recordId }\n });\n\n if (loading) return '';\n if (error) return error.message;\n if (!data || !data.entityData) return null;\n\n const { entityData } = data;\n const shouldLoop = loopProperties && loopProperties.length;\n const modifier = getClassModifiers('list', otherProps);\n const summaryPropsWithContent = shouldLoop\n ? buildLoopPropsContent(loopProperties, propsToDisplay, loopLimit, entityData, isSlider)\n : buildPropsToDisplayWithContent(entityData, propsToDisplay);\n\n const summaryPropsWithCleanContent = stripSummaryPropsContent(\n propsToDisplay,\n summaryPropsWithContent\n );\n const parsedPropsToDisplay = parsePropsToDisplay(entityData, propsToDisplay);\n if (!summaryPropsWithCleanContent.length) return null;\n\n if (VariantComponent)\n return (\n <VariantComponent\n propsToDisplay={propsToDisplay}\n summaryPropsWithContent={summaryPropsWithCleanContent}\n parsedPropsToDisplay={parsedPropsToDisplay}>\n {summaryPropsWithContent.map(summaryProps => (\n <SummaryComponent\n modifier={modifier}\n elementTitle={elementTitle}\n summaryPropsWithContent={summaryProps}\n htmlTag={htmlTag}\n />\n ))}\n </VariantComponent>\n );\n\n return (\n <SummaryComponent\n modifier={modifier}\n elementTitle={elementTitle}\n summaryPropsWithContent={summaryPropsWithCleanContent}\n htmlTag={htmlTag}\n />\n );\n};\n\nDataSummaryRender.propTypes = {\n entities: PropTypes.array.isRequired,\n mainSchemas: PropTypes.object.isRequired,\n isSlider: PropTypes.bool.isRequired,\n type: PropTypes.string,\n name: PropTypes.string,\n query: PropTypes.object,\n recordId: PropTypes.string,\n propsToDisplay: PropTypes.array,\n elementTitle: PropTypes.string,\n htmlTag: PropTypes.string,\n loopProperties: PropTypes.array,\n loopLimit: PropTypes.number,\n VariantComponent: PropTypes.func\n};\n\nDataSummaryRender.defaultProps = {\n name: '',\n type: 'text',\n query: {},\n recordId: '',\n propsToDisplay: [],\n elementTitle: '',\n htmlTag: 'h2',\n loopProperties: [],\n loopLimit: 0,\n VariantComponent: null\n};\n\nexport default DataSummaryRender;\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SACEC,8BAA8B,EAC9BC,wBAAwB,EACxBC,qBAAqB,QAChB,WAAW;AAClB,SAASC,mBAAmB,QAAQ,eAAe;AAEnD,MAAMC,iBAAiB,GAAGC,IAAA,IAYpB;EAAA,IAZqB;MACzBC,IAAI;MACJC,OAAO;MACPC,QAAQ;MACRC,KAAK;MACLC,cAAc;MACdC,YAAY;MACZC,cAAc;MACdC,SAAS;MACTC,gBAAgB;MAChBC;IAEF,CAAC,GAAAV,IAAA;IADIW,UAAU,GAAAC,wBAAA,CAAAZ,IAAA,EAAAa,SAAA;EAEb,MAAMC,gBAAgB,GAAGrB,iBAAiB,CAACQ,IAAI,CAAC;EAChD,MAAM;IAAEc,IAAI;IAAEC,KAAK;IAAEC;E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33
33
|
};
|
|
34
|
-
const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {
|
|
34
|
+
const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}, isSlider = false) => {
|
|
35
35
|
const loopPropsWithContent = [];
|
|
36
36
|
const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);
|
|
37
37
|
const loopLimit = getLoopPropsLimit(loopValues, limit);
|
|
@@ -54,6 +54,7 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
54
54
|
})).filter(Boolean);
|
|
55
55
|
loopPropsWithContent.push(propsArray);
|
|
56
56
|
}
|
|
57
|
+
if (isSlider) return loopPropsWithContent;
|
|
57
58
|
return flatten(loopPropsWithContent);
|
|
58
59
|
};
|
|
59
60
|
export default buildLoopPropsContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-loop-props-content.js","names":["upperFirst","flatten","getLinkToPublishedContent","getLoopPropsLimit","getPropValue","processDataSummaryValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","limit","loopPropsWithContent","loopLimit","i","propsArray","map","label","modifier","key","loopValue","loopValueItem","propValue","processedValue","linkToPublishedContent","filter","Boolean","push"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = []
|
|
1
|
+
{"version":3,"file":"build-loop-props-content.js","names":["upperFirst","flatten","getLinkToPublishedContent","getLoopPropsLimit","getPropValue","processDataSummaryValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","limit","isSlider","loopPropsWithContent","loopLimit","i","propsArray","map","label","modifier","key","loopValue","loopValueItem","propValue","processedValue","linkToPublishedContent","filter","Boolean","push"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (\n loopProps = [],\n propsToDisplay = [],\n limit = 0,\n data = {},\n isSlider = false\n) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const loopValueItem = loopValue && loopValue[i];\n const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];\n if (!propValue) return null;\n\n const processedValue = processDataSummaryValue(propValue, options);\n const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);\n return [upperFirst(label), processedValue, linkToPublishedContent, modifier];\n });\n })\n ).filter(Boolean);\n loopPropsWithContent.push(propsArray);\n }\n if (isSlider) return loopPropsWithContent;\n return flatten(loopPropsWithContent);\n};\n\nexport default buildLoopPropsContent;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,gBAAgB;AACpC,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,uBAAuB,QAAQ,kBAAkB;AAE1D,MAAMC,YAAY,GAAGC,KAAK,IAAI;EAC5B,MAAM;IAAEC;EAAS,CAAC,GAAGD,KAAK;EAC1B,OAAOA,KAAK,CAACC,QAAQ,CAAC;AACxB,CAAC;AAED,MAAMC,cAAc,GAAGA,CAACC,cAAc,EAAEC,SAAS,EAAEC,IAAI,KAAK;EAC1D,MAAMC,aAAa,GAAG,CAAC,CAAC;EACxB,MAAMC,UAAU,GAAG,CAAC,CAAC;EAErBJ,cAAc,CAACK,OAAO,CAACC,OAAO,IAAI;IAChC,MAAM;MAAEC;IAAoB,CAAC,GAAGD,OAAO;IACvCC,mBAAmB,CAACF,OAAO,CAACG,IAAI,IAAI;MAClC,MAAMX,KAAK,GAAGH,YAAY,CAACc,IAAI,EAAEN,IAAI,EAAEI,OAAO,CAAC;MAC/C,MAAMG,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Y,CAAC8B,aAAa,CAAC,GAAGvB,aAAa,CAACqB,GAAG,CAAC;QAClF,IAAI,CAACG,SAAS,EAAE,OAAO,IAAI;QAE3B,MAAMC,cAAc,GAAGjC,uBAAuB,CAACgC,SAAS,EAAErB,OAAO,CAAC;QAClE,MAAMuB,sBAAsB,GAAGrC,yBAAyB,CAACgC,GAAG,EAAEtB,IAAI,EAAEwB,aAAa,CAAC;QAClF,OAAO,CAACpC,UAAU,CAACgC,KAAK,CAAC,EAAEM,cAAc,EAAEC,sBAAsB,EAAEN,QAAQ,CAAC;MAC9E,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACO,MAAM,CAACC,OAAO,CAAC;IACjBd,oBAAoB,CAACe,IAAI,CAACZ,UAAU,CAAC;EACvC;EACA,IAAIJ,QAAQ,EAAE,OAAOC,oBAAoB;EACzC,OAAO1B,OAAO,CAAC0B,oBAAoB,CAAC;AACtC,CAAC;AAED,eAAeH,qBAAqB"}
|
|
@@ -9,7 +9,7 @@ const DateTime = ({
|
|
|
9
9
|
customFormat,
|
|
10
10
|
modifier
|
|
11
11
|
}) => {
|
|
12
|
-
const dateFormat = customFormat
|
|
12
|
+
const dateFormat = customFormat || format;
|
|
13
13
|
if (!dateFormat) return null;
|
|
14
14
|
const formatedDate = dayjs().format(dateFormat);
|
|
15
15
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.js","names":["React","PropTypes","dayjs","LocalizedFormat","Wrapper","extend","DateTime","format","customFormat","modifier","dateFormat","
|
|
1
|
+
{"version":3,"file":"DateTime.js","names":["React","PropTypes","dayjs","LocalizedFormat","Wrapper","extend","DateTime","format","customFormat","modifier","dateFormat","formatedDate","createElement","className","modifiers","propTypes","string","isRequired","defaultProps"],"sources":["../../../src/components/DateTime/DateTime.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport dayjs from 'dayjs';\nimport LocalizedFormat from 'dayjs/plugin/localizedFormat';\nimport Wrapper from '../Wrapper';\n\ndayjs.extend(LocalizedFormat);\n\nconst DateTime = ({ format, customFormat, modifier }) => {\n const dateFormat = customFormat || format;\n\n if (!dateFormat) return null;\n\n const formatedDate = dayjs().format(dateFormat);\n\n return (\n <Wrapper className=\"date\" modifiers={modifier}>\n {formatedDate}\n </Wrapper>\n );\n};\n\nDateTime.propTypes = {\n format: PropTypes.string.isRequired,\n customFormat: PropTypes.string,\n modifier: PropTypes.string\n};\n\nDateTime.defaultProps = {\n modifier: null,\n customFormat: ''\n};\n\nexport default DateTime;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,MAAM,8BAA8B;AAC1D,OAAOC,OAAO,MAAM,YAAY;AAEhCF,KAAK,CAACG,MAAM,CAACF,eAAe,CAAC;AAE7B,MAAMG,QAAQ,GAAGA,CAAC;EAAEC,MAAM;EAAEC,YAAY;EAAEC;AAAS,CAAC,KAAK;EACvD,MAAMC,UAAU,GAAGF,YAAY,IAAID,MAAM;EAEzC,IAAI,CAACG,UAAU,EAAE,OAAO,IAAI;EAE5B,MAAMC,YAAY,GAAGT,KAAK,CAAC,CAAC,CAACK,MAAM,CAACG,UAAU,CAAC;EAE/C,oBACEV,KAAA,CAAAY,aAAA,CAACR,OAAO;IAACS,SAAS,EAAC,MAAM;IAACC,SAAS,EAAEL;EAAS,GAC3CE,YACM,CAAC;AAEd,CAAC;AAEDL,QAAQ,CAACS,SAAS,GAAG;EACnBR,MAAM,EAAEN,SAAS,CAACe,MAAM,CAACC,UAAU;EACnCT,YAAY,EAAEP,SAAS,CAACe,MAAM;EAC9BP,QAAQ,EAAER,SAAS,CAACe;AACtB,CAAC;AAEDV,QAAQ,CAACY,YAAY,GAAG;EACtBT,QAAQ,EAAE,IAAI;EACdD,YAAY,EAAE;AAChB,CAAC;AAED,eAAeF,QAAQ"}
|
|
@@ -4,7 +4,6 @@ import { useQuery } from '@apollo/client';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import ListPagination from './components/Pagination';
|
|
6
6
|
import ListHeader from './components/Header';
|
|
7
|
-
import { sortResponseData } from '../../helpers';
|
|
8
7
|
import { LOAD_MORE } from '../../constants';
|
|
9
8
|
import { useAppSyncEventHook } from '../../hooks';
|
|
10
9
|
import { buildQueryBooster } from './helpers';
|
|
@@ -50,11 +49,10 @@ const ListRender = props => {
|
|
|
50
49
|
if (!data[actionKey] || !data[actionKey].results) return null;
|
|
51
50
|
const listData = data[actionKey].results;
|
|
52
51
|
const listTotal = data[actionKey].total;
|
|
53
|
-
|
|
54
|
-
if (!orderedListData || !orderedListData.length) return null;
|
|
52
|
+
if (!listData || !listData.length) return null;
|
|
55
53
|
const {
|
|
56
54
|
length: currentListLength
|
|
57
|
-
} =
|
|
55
|
+
} = listData;
|
|
58
56
|
const currentPage = Math.ceil((initialOffset + currentListLength) / itemsPerPageToUse);
|
|
59
57
|
const totalDisplay = limitToUse && listTotal > limitToUse ? limitToUse : listTotal;
|
|
60
58
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
@@ -66,7 +64,7 @@ const ListRender = props => {
|
|
|
66
64
|
}), displayTotal && /*#__PURE__*/React.createElement("div", {
|
|
67
65
|
className: "list_total_results w-full text-left p-4"
|
|
68
66
|
}, "Total results: ", totalDisplay), /*#__PURE__*/React.createElement(ListComponent, _extends({
|
|
69
|
-
orderedListData:
|
|
67
|
+
orderedListData: listData,
|
|
70
68
|
isInfinite: isInfinite,
|
|
71
69
|
initialOffset: initialOffset,
|
|
72
70
|
actionKey: actionKey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListRender.js","names":["React","useQuery","PropTypes","ListPagination","ListHeader","
|
|
1
|
+
{"version":3,"file":"ListRender.js","names":["React","useQuery","PropTypes","ListPagination","ListHeader","LOAD_MORE","useAppSyncEventHook","buildQueryBooster","ListRender","props","variables","actionKey","action","name","itemsToDisplay","itemsPerPageToUse","limitToUse","initialOffset","isInfinite","omitWrappers","paginationType","listComponent","ListComponent","query","url","listAggregations","isAZ","azFilter","displayTotal","data","updatedVariables","eventName","boostedVariables","error","loading","fetchMore","message","results","listData","listTotal","total","length","currentListLength","currentPage","Math","ceil","totalDisplay","createElement","Fragment","className","_extends","orderedListData","itemsPerPage","propTypes","string","isRequired","object","number","bool","func","array","defaultProps"],"sources":["../../../src/components/List/ListRender.js"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport ListPagination from './components/Pagination';\nimport ListHeader from './components/Header';\nimport { LOAD_MORE } from '../../constants';\nimport { useAppSyncEventHook } from '../../hooks';\nimport { buildQueryBooster } from './helpers';\n\nconst ListRender = props => {\n const {\n variables,\n actionKey,\n action,\n name,\n itemsToDisplay,\n itemsPerPageToUse,\n limitToUse,\n initialOffset,\n isInfinite,\n omitWrappers,\n paginationType,\n listComponent: ListComponent,\n query,\n url,\n listAggregations,\n isAZ,\n azFilter,\n displayTotal\n } = props;\n const { data: updatedVariables } = useAppSyncEventHook({\n eventName: 'list:query-variables',\n data: variables,\n props\n });\n const boostedVariables = buildQueryBooster(props, updatedVariables);\n\n const { data = {}, error, loading, fetchMore } = useQuery(action, {\n variables: boostedVariables\n });\n\n if (loading) return '';\n if (error) return error.message;\n if (!data[actionKey] || !data[actionKey].results) return null;\n\n const listData = data[actionKey].results;\n const listTotal = data[actionKey].total;\n\n if (!listData || !listData.length) return null;\n const { length: currentListLength } = listData;\n const currentPage = Math.ceil((initialOffset + currentListLength) / itemsPerPageToUse);\n const totalDisplay = limitToUse && listTotal > limitToUse ? limitToUse : listTotal;\n\n return (\n <>\n <span className=\"list-top\" />\n {isAZ && <ListHeader name={name} listAggregations={listAggregations} azFilter={azFilter} />}\n {displayTotal && (\n <div className=\"list_total_results w-full text-left p-4\">Total results: {totalDisplay}</div>\n )}\n <ListComponent\n orderedListData={listData}\n isInfinite={isInfinite}\n initialOffset={initialOffset}\n actionKey={actionKey}\n limitToUse={limitToUse}\n fetchMore={fetchMore}\n omitWrappers={omitWrappers}\n itemsPerPageToUse={itemsPerPageToUse || listData.length}\n listTotal={listTotal}\n currentListLength={currentListLength}\n currentPage={currentPage}\n query={query}\n url={url}\n itemsToDisplay={itemsToDisplay}\n {...props}\n />\n {paginationType !== LOAD_MORE && (\n <ListPagination\n limitToUse={limitToUse}\n itemsPerPage={itemsPerPageToUse}\n listTotal={listTotal}\n name={name}\n isInfinite={isInfinite}\n currentListLength={currentListLength}\n paginationType={paginationType}\n currentPage={currentPage}\n query={query}\n url={url}\n />\n )}\n </>\n );\n};\n\nListRender.propTypes = {\n name: PropTypes.string.isRequired,\n paginationType: PropTypes.string.isRequired,\n variables: PropTypes.object.isRequired,\n actionKey: PropTypes.string.isRequired,\n action: PropTypes.object.isRequired,\n itemsPerPageToUse: PropTypes.number.isRequired,\n limitToUse: PropTypes.number.isRequired,\n initialOffset: PropTypes.number.isRequired,\n isInfinite: PropTypes.bool.isRequired,\n omitWrappers: PropTypes.bool,\n query: PropTypes.object.isRequired,\n url: PropTypes.string.isRequired,\n listComponent: PropTypes.func.isRequired,\n isAZ: PropTypes.bool.isRequired,\n azFilter: PropTypes.string.isRequired,\n listAggregations: PropTypes.array,\n itemsToDisplay: PropTypes.array,\n displayTotal: PropTypes.bool\n};\n\nListRender.defaultProps = {\n omitWrappers: false,\n itemsToDisplay: [],\n listAggregations: [],\n displayTotal: false\n};\n\nexport default ListRender;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,cAAc,MAAM,yBAAyB;AACpD,OAAOC,UAAU,MAAM,qBAAqB;AAC5C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,mBAAmB,QAAQ,aAAa;AACjD,SAASC,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AE;EAClBW,gBAAgB,EAAE,EAAE;EACpBG,YAAY,EAAE;AAChB,CAAC;AAED,eAAepB,UAAU"}
|
|
@@ -7,7 +7,7 @@ const getSortProps = ({
|
|
|
7
7
|
isTextSearchFilterApplied
|
|
8
8
|
}) => {
|
|
9
9
|
const updatedSortProperties = [...sortProperties];
|
|
10
|
-
if (!querySort && !sortProperties.length) {
|
|
10
|
+
if (!querySort && !sortProperties.length && defaultSortBy && defaultSortBy.length) {
|
|
11
11
|
updatedSortProperties.unshift({
|
|
12
12
|
sort: defaultSort,
|
|
13
13
|
propsToDisplay: defaultSortBy
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-sort-props.js","names":["getSortProps","querySort","sortProperties","defaultSort","querySortBy","defaultSortBy","isTextSearchFilterApplied","updatedSortProperties","length","unshift","sort","propsToDisplay","isScore","sortbyFilters","map","filterProps","filter","Boolean","flat"],"sources":["../../../../src/components/List/helpers/get-sort-props.js"],"sourcesContent":["const getSortProps = ({\n querySort,\n sortProperties,\n defaultSort,\n querySortBy,\n defaultSortBy,\n isTextSearchFilterApplied\n}) => {\n const updatedSortProperties = [...sortProperties];\n if (!querySort && !sortProperties.length) {\n updatedSortProperties.unshift({ sort: defaultSort, propsToDisplay: defaultSortBy });\n }\n if (isTextSearchFilterApplied) updatedSortProperties.unshift({ isScore: true });\n if (querySort) updatedSortProperties.unshift({ sort: querySort, propsToDisplay: [querySortBy] });\n\n const sortbyFilters = updatedSortProperties\n .map(({ propsToDisplay: filterProps }) => filterProps)\n .filter(Boolean)\n .flat();\n return { sortbyFilters, updatedSortProperties };\n};\n\nexport default getSortProps;\n"],"mappings":"AAAA,MAAMA,YAAY,GAAGA,CAAC;EACpBC,SAAS;EACTC,cAAc;EACdC,WAAW;EACXC,WAAW;EACXC,aAAa;EACbC;AACF,CAAC,KAAK;EACJ,MAAMC,qBAAqB,GAAG,CAAC,GAAGL,cAAc,CAAC;EACjD,IAAI,CAACD,SAAS,IAAI,CAACC,cAAc,CAACM,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"get-sort-props.js","names":["getSortProps","querySort","sortProperties","defaultSort","querySortBy","defaultSortBy","isTextSearchFilterApplied","updatedSortProperties","length","unshift","sort","propsToDisplay","isScore","sortbyFilters","map","filterProps","filter","Boolean","flat"],"sources":["../../../../src/components/List/helpers/get-sort-props.js"],"sourcesContent":["const getSortProps = ({\n querySort,\n sortProperties,\n defaultSort,\n querySortBy,\n defaultSortBy,\n isTextSearchFilterApplied\n}) => {\n const updatedSortProperties = [...sortProperties];\n if (!querySort && !sortProperties.length && defaultSortBy && defaultSortBy.length) {\n updatedSortProperties.unshift({ sort: defaultSort, propsToDisplay: defaultSortBy });\n }\n if (isTextSearchFilterApplied) updatedSortProperties.unshift({ isScore: true });\n if (querySort) updatedSortProperties.unshift({ sort: querySort, propsToDisplay: [querySortBy] });\n\n const sortbyFilters = updatedSortProperties\n .map(({ propsToDisplay: filterProps }) => filterProps)\n .filter(Boolean)\n .flat();\n return { sortbyFilters, updatedSortProperties };\n};\n\nexport default getSortProps;\n"],"mappings":"AAAA,MAAMA,YAAY,GAAGA,CAAC;EACpBC,SAAS;EACTC,cAAc;EACdC,WAAW;EACXC,WAAW;EACXC,aAAa;EACbC;AACF,CAAC,KAAK;EACJ,MAAMC,qBAAqB,GAAG,CAAC,GAAGL,cAAc,CAAC;EACjD,IAAI,CAACD,SAAS,IAAI,CAACC,cAAc,CAACM,MAAM,IAAIH,aAAa,IAAIA,aAAa,CAACG,MAAM,EAAE;IACjFD,qBAAqB,CAACE,OAAO,CAAC;MAAEC,IAAI,EAAEP,WAAW;MAAEQ,cAAc,EAAEN;IAAc,CAAC,CAAC;EACrF;EACA,IAAIC,yBAAyB,EAAEC,qBAAqB,CAACE,OAAO,CAAC;IAAEG,OAAO,EAAE;EAAK,CAAC,CAAC;EAC/E,IAAIX,SAAS,EAAEM,qBAAqB,CAACE,OAAO,CAAC;IAAEC,IAAI,EAAET,SAAS;IAAEU,cAAc,EAAE,CAACP,WAAW;EAAE,CAAC,CAAC;EAEhG,MAAMS,aAAa,GAAGN,qBAAqB,CACxCO,GAAG,CAAC,CAAC;IAAEH,cAAc,EAAEI;EAAY,CAAC,KAAKA,WAAW,CAAC,CACrDC,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,CAAC;EACT,OAAO;IAAEL,aAAa;IAAEN;EAAsB,CAAC;AACjD,CAAC;AAED,eAAeP,YAAY"}
|
|
@@ -11,7 +11,9 @@ const SearchContent = ({
|
|
|
11
11
|
isMobile,
|
|
12
12
|
placeholder,
|
|
13
13
|
modifier,
|
|
14
|
-
collapsedSearch
|
|
14
|
+
collapsedSearch,
|
|
15
|
+
searchUrl,
|
|
16
|
+
navigateToSingleSearchResult
|
|
15
17
|
}) => {
|
|
16
18
|
const searchContentRef = useRef(null);
|
|
17
19
|
const [collapsed, setCollapsed] = useState(collapsedSearch);
|
|
@@ -58,9 +60,13 @@ const SearchContent = ({
|
|
|
58
60
|
e.preventDefault();
|
|
59
61
|
router.push(url);
|
|
60
62
|
};
|
|
61
|
-
const
|
|
63
|
+
const handleKeyDown = e => {
|
|
62
64
|
if (e.key === 'Enter' && e.target.value !== '') {
|
|
63
|
-
|
|
65
|
+
if (navigateToSingleSearchResult && results && results.length === 1 && results[0].url) {
|
|
66
|
+
router.push(results[0].url);
|
|
67
|
+
} else {
|
|
68
|
+
router.push(`${searchUrl || '/search'}?search_term=${e.target.value}`);
|
|
69
|
+
}
|
|
64
70
|
}
|
|
65
71
|
};
|
|
66
72
|
const handleIconClick = () => {
|
|
@@ -95,7 +101,7 @@ const SearchContent = ({
|
|
|
95
101
|
placeholder: placeholder,
|
|
96
102
|
value: searchTerm,
|
|
97
103
|
onChange: e => setSearchTerm(e.target.value),
|
|
98
|
-
|
|
104
|
+
onKeyDown: handleKeyDown,
|
|
99
105
|
onFocus: () => setShowResults(true),
|
|
100
106
|
"data-testid": "search-content-input"
|
|
101
107
|
}))), showResults && /*#__PURE__*/React.createElement(SearchContentResults, {
|
|
@@ -111,7 +117,9 @@ SearchContent.propTypes = {
|
|
|
111
117
|
isMobile: PropTypes.bool,
|
|
112
118
|
entities: PropTypes.array.isRequired,
|
|
113
119
|
modifier: PropTypes.string,
|
|
114
|
-
collapsedSearch: PropTypes.bool
|
|
120
|
+
collapsedSearch: PropTypes.bool,
|
|
121
|
+
searchUrl: PropTypes.string,
|
|
122
|
+
navigateToSingleSearchResult: PropTypes.bool
|
|
115
123
|
};
|
|
116
124
|
SearchContent.defaultProps = {
|
|
117
125
|
searchInputWrapperMobile: '',
|
|
@@ -119,7 +127,9 @@ SearchContent.defaultProps = {
|
|
|
119
127
|
placeholder: '',
|
|
120
128
|
isMobile: false,
|
|
121
129
|
modifier: '',
|
|
122
|
-
collapsedSearch: false
|
|
130
|
+
collapsedSearch: false,
|
|
131
|
+
searchUrl: '',
|
|
132
|
+
navigateToSingleSearchResult: false
|
|
123
133
|
};
|
|
124
134
|
export default SearchContent;
|
|
125
135
|
//# sourceMappingURL=SearchContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchContent.js","names":["React","useState","useEffect","useRef","PropTypes","useRouter","useDebounceSearch","SearchContentResults","SearchContentToggleIcon","SearchContent","entities","searchInputWrapperMobile","searchInputWrapperDesktop","isMobile","placeholder","modifier","collapsedSearch","searchContentRef","collapsed","setCollapsed","showResults","setShowResults","router","results","searchTerm","setSearchTerm","debouncedSearchTerm","initialSearchTerm","resultKeys","handleRouteChange","events","on","off","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener","responsiveClasses","handleNavigation","e","url","preventDefault","push","handleKeyPress","key","value","handleIconClick","isCloseIcon","className","filter","Boolean","join","searchModifier","createElement","ref","onClick","useCloseIcon","type","name","onChange","onKeyPress","onFocus","handleClick","propTypes","string","bool","array","isRequired","defaultProps"],"sources":["../../../src/components/SearchContent/SearchContent.js"],"sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useRouter } from 'next/router';\nimport { useDebounceSearch } from '@blaze-cms/plugin-search-ui';\nimport SearchContentResults from './SearchContentResults';\nimport SearchContentToggleIcon from './SearchContentToggleIcon';\n\nconst SearchContent = ({\n entities,\n searchInputWrapperMobile,\n searchInputWrapperDesktop,\n isMobile,\n placeholder,\n modifier,\n collapsedSearch\n}) => {\n const searchContentRef = useRef(null);\n const [collapsed, setCollapsed] = useState(collapsedSearch);\n const [showResults, setShowResults] = useState(false);\n const router = useRouter();\n\n const { results, searchTerm, setSearchTerm, debouncedSearchTerm } = useDebounceSearch({\n entities,\n initialSearchTerm: '',\n resultKeys: 'id, name, image { url }, url'\n });\n\n useEffect(\n () => {\n const handleRouteChange = () => {\n setSearchTerm('');\n setShowResults(false);\n if (collapsedSearch) setCollapsed(true);\n };\n router.events.on('routeChangeStart', handleRouteChange);\n\n return () => {\n router.events.off('routeChangeStart', handleRouteChange);\n };\n },\n [collapsedSearch, router.events, setSearchTerm]\n );\n\n useEffect(\n () => {\n const handleClickOutside = event => {\n if (searchContentRef.current && !searchContentRef.current.contains(event.target)) {\n setShowResults(false);\n if (collapsedSearch) {\n setCollapsed(true);\n setSearchTerm('');\n }\n }\n };\n\n document.addEventListener('click', handleClickOutside);\n\n return () => {\n document.removeEventListener('click', handleClickOutside);\n };\n },\n [collapsedSearch, setSearchTerm]\n );\n\n const responsiveClasses = isMobile ? searchInputWrapperMobile : searchInputWrapperDesktop;\n\n const handleNavigation = (e, url) => {\n e.preventDefault();\n router.push(url);\n };\n\n const handleKeyPress = e => {\n if (e.key === 'Enter' && e.target.value !== '') {\n router.push(`/search?search_term=${e.target.value}`);\n }\n };\n\n const handleIconClick = () => {\n const isCloseIcon = collapsedSearch ? !collapsed : debouncedSearchTerm;\n\n if (collapsedSearch) setCollapsed(!collapsed);\n\n if (isCloseIcon) {\n setSearchTerm('');\n setShowResults(false);\n } else {\n setShowResults(true);\n }\n };\n\n const className = ['search-content', modifier, responsiveClasses].filter(Boolean).join(' ');\n const searchModifier = collapsed ? 'search-content--collapse' : 'search-content--expanded';\n\n return (\n <div className={className} ref={searchContentRef}>\n <div className={`${searchModifier}__wrapper`}>\n <label className={`${searchModifier}__label`}>\n <span className={`${searchModifier}__icon_wrapper`}>\n <SearchContentToggleIcon\n searchTerm={debouncedSearchTerm}\n onClick={handleIconClick}\n useCloseIcon={collapsedSearch ? !collapsed : debouncedSearchTerm}\n />\n </span>\n {!collapsed && (\n <input\n className={`${searchModifier}__input`}\n type=\"text\"\n name=\"search\"\n placeholder={placeholder}\n value={searchTerm}\n onChange={e => setSearchTerm(e.target.value)}\n onKeyPress={handleKeyPress}\n onFocus={() => setShowResults(true)}\n data-testid=\"search-content-input\"\n />\n )}\n </label>\n </div>\n {showResults && (\n <SearchContentResults\n results={results}\n debouncedSearchTerm={debouncedSearchTerm}\n handleClick={handleNavigation}\n />\n )}\n </div>\n );\n};\n\nSearchContent.propTypes = {\n searchInputWrapperMobile: PropTypes.string,\n searchInputWrapperDesktop: PropTypes.string,\n placeholder: PropTypes.string,\n isMobile: PropTypes.bool,\n entities: PropTypes.array.isRequired,\n modifier: PropTypes.string,\n collapsedSearch: PropTypes.bool\n};\n\nSearchContent.defaultProps = {\n searchInputWrapperMobile: '',\n searchInputWrapperDesktop: '',\n placeholder: '',\n isMobile: false,\n modifier: '',\n collapsedSearch: false\n};\n\nexport default SearchContent;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC1D,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,OAAOC,oBAAoB,MAAM,wBAAwB;AACzD,OAAOC,uBAAuB,MAAM,2BAA2B;AAE/D,MAAMC,aAAa,GAAGA,CAAC;EACrBC,QAAQ;EACRC,wBAAwB;EACxBC,yBAAyB;EACzBC,QAAQ;EACRC,WAAW;EACXC,QAAQ;EACRC;A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E,IAAI;EACxB3D,QAAQ,EAAEN,SAAS,CAACkE,KAAK,CAACC,UAAU;EACpCxD,QAAQ,EAAEX,SAAS,CAACgE,MAAM;EAC1BpD,eAAe,EAAEZ,SAAS,CAACiE;AAC7B,CAAC;AAED5D,aAAa,CAAC+D,YAAY,GAAG;EAC3B7D,wBAAwB,EAAE,EAAE;EAC5BC,yBAAyB,EAAE,EAAE;EAC7BE,WAAW,EAAE,EAAE;EACfD,QAAQ,EAAE,KAAK;EACfE,QAAQ,EAAE,EAAE;EACZC,eAAe,EAAE;AACnB,CAAC;AAED,eAAeP,aAAa"}
|
|
1
|
+
{"version":3,"file":"SearchContent.js","names":["React","useState","useEffect","useRef","PropTypes","useRouter","useDebounceSearch","SearchContentResults","SearchContentToggleIcon","SearchContent","entities","searchInputWrapperMobile","searchInputWrapperDesktop","isMobile","placeholder","modifier","collapsedSearch","searchUrl","navigateToSingleSearchResult","searchContentRef","collapsed","setCollapsed","showResults","setShowResults","router","results","searchTerm","setSearchTerm","debouncedSearchTerm","initialSearchTerm","resultKeys","handleRouteChange","events","on","off","handleClickOutside","event","current","contains","target","document","addEventListener","removeEventListener","responsiveClasses","handleNavigation","e","url","preventDefault","push","handleKeyDown","key","value","length","handleIconClick","isCloseIcon","className","filter","Boolean","join","searchModifier","createElement","ref","onClick","useCloseIcon","type","name","onChange","onKeyDown","onFocus","handleClick","propTypes","string","bool","array","isRequired","defaultProps"],"sources":["../../../src/components/SearchContent/SearchContent.js"],"sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useRouter } from 'next/router';\nimport { useDebounceSearch } from '@blaze-cms/plugin-search-ui';\nimport SearchContentResults from './SearchContentResults';\nimport SearchContentToggleIcon from './SearchContentToggleIcon';\n\nconst SearchContent = ({\n entities,\n searchInputWrapperMobile,\n searchInputWrapperDesktop,\n isMobile,\n placeholder,\n modifier,\n collapsedSearch,\n searchUrl,\n navigateToSingleSearchResult\n}) => {\n const searchContentRef = useRef(null);\n const [collapsed, setCollapsed] = useState(collapsedSearch);\n const [showResults, setShowResults] = useState(false);\n const router = useRouter();\n\n const { results, searchTerm, setSearchTerm, debouncedSearchTerm } = useDebounceSearch({\n entities,\n initialSearchTerm: '',\n resultKeys: 'id, name, image { url }, url'\n });\n\n useEffect(\n () => {\n const handleRouteChange = () => {\n setSearchTerm('');\n setShowResults(false);\n if (collapsedSearch) setCollapsed(true);\n };\n router.events.on('routeChangeStart', handleRouteChange);\n\n return () => {\n router.events.off('routeChangeStart', handleRouteChange);\n };\n },\n [collapsedSearch, router.events, setSearchTerm]\n );\n\n useEffect(\n () => {\n const handleClickOutside = event => {\n if (searchContentRef.current && !searchContentRef.current.contains(event.target)) {\n setShowResults(false);\n if (collapsedSearch) {\n setCollapsed(true);\n setSearchTerm('');\n }\n }\n };\n\n document.addEventListener('click', handleClickOutside);\n\n return () => {\n document.removeEventListener('click', handleClickOutside);\n };\n },\n [collapsedSearch, setSearchTerm]\n );\n\n const responsiveClasses = isMobile ? searchInputWrapperMobile : searchInputWrapperDesktop;\n\n const handleNavigation = (e, url) => {\n e.preventDefault();\n router.push(url);\n };\n\n const handleKeyDown = e => {\n if (e.key === 'Enter' && e.target.value !== '') {\n if (navigateToSingleSearchResult && results && results.length === 1 && results[0].url) {\n router.push(results[0].url);\n } else {\n router.push(`${searchUrl || '/search'}?search_term=${e.target.value}`);\n }\n }\n };\n\n const handleIconClick = () => {\n const isCloseIcon = collapsedSearch ? !collapsed : debouncedSearchTerm;\n\n if (collapsedSearch) setCollapsed(!collapsed);\n\n if (isCloseIcon) {\n setSearchTerm('');\n setShowResults(false);\n } else {\n setShowResults(true);\n }\n };\n\n const className = ['search-content', modifier, responsiveClasses].filter(Boolean).join(' ');\n const searchModifier = collapsed ? 'search-content--collapse' : 'search-content--expanded';\n\n return (\n <div className={className} ref={searchContentRef}>\n <div className={`${searchModifier}__wrapper`}>\n <label className={`${searchModifier}__label`}>\n <span className={`${searchModifier}__icon_wrapper`}>\n <SearchContentToggleIcon\n searchTerm={debouncedSearchTerm}\n onClick={handleIconClick}\n useCloseIcon={collapsedSearch ? !collapsed : debouncedSearchTerm}\n />\n </span>\n {!collapsed && (\n <input\n className={`${searchModifier}__input`}\n type=\"text\"\n name=\"search\"\n placeholder={placeholder}\n value={searchTerm}\n onChange={e => setSearchTerm(e.target.value)}\n onKeyDown={handleKeyDown}\n onFocus={() => setShowResults(true)}\n data-testid=\"search-content-input\"\n />\n )}\n </label>\n </div>\n {showResults && (\n <SearchContentResults\n results={results}\n debouncedSearchTerm={debouncedSearchTerm}\n handleClick={handleNavigation}\n />\n )}\n </div>\n );\n};\n\nSearchContent.propTypes = {\n searchInputWrapperMobile: PropTypes.string,\n searchInputWrapperDesktop: PropTypes.string,\n placeholder: PropTypes.string,\n isMobile: PropTypes.bool,\n entities: PropTypes.array.isRequired,\n modifier: PropTypes.string,\n collapsedSearch: PropTypes.bool,\n searchUrl: PropTypes.string,\n navigateToSingleSearchResult: PropTypes.bool\n};\n\nSearchContent.defaultProps = {\n searchInputWrapperMobile: '',\n searchInputWrapperDesktop: '',\n placeholder: '',\n isMobile: false,\n modifier: '',\n collapsedSearch: false,\n searchUrl: '',\n navigateToSingleSearchResult: false\n};\n\nexport default SearchContent;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC1D,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,OAAOC,oBAAoB,MAAM,wBAAwB;AACzD,OAAOC,uBAAuB,MAAM,2BAA2B;AAE/D,MAAMC,aAAa,GAAGA,CAAC;EACrBC,QAAQ;EACRC,wBAAwB;EACxBC,yBAAyB;EACzBC,QAAQ;EACRC,WAAW;EACXC,QAAQ;EACRC,eAAe;EACfC,SAAS;EACTC;AACF,CAAC,KAAK;EACJ,MAAMC,gBAAgB,GAAGhB,MAAM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EV,CAAC;AAEDnC,aAAa,CAAC6D,SAAS,GAAG;EACxB3D,wBAAwB,EAAEP,SAAS,CAACmE,MAAM;EAC1C3D,yBAAyB,EAAER,SAAS,CAACmE,MAAM;EAC3CzD,WAAW,EAAEV,SAAS,CAACmE,MAAM;EAC7B1D,QAAQ,EAAET,SAAS,CAACoE,IAAI;EACxB9D,QAAQ,EAAEN,SAAS,CAACqE,KAAK,CAACC,UAAU;EACpC3D,QAAQ,EAAEX,SAAS,CAACmE,MAAM;EAC1BvD,eAAe,EAAEZ,SAAS,CAACoE,IAAI;EAC/BvD,SAAS,EAAEb,SAAS,CAACmE,MAAM;EAC3BrD,4BAA4B,EAAEd,SAAS,CAACoE;AAC1C,CAAC;AAED/D,aAAa,CAACkE,YAAY,GAAG;EAC3BhE,wBAAwB,EAAE,EAAE;EAC5BC,yBAAyB,EAAE,EAAE;EAC7BE,WAAW,EAAE,EAAE;EACfD,QAAQ,EAAE,KAAK;EACfE,QAAQ,EAAE,EAAE;EACZC,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAE,EAAE;EACbC,4BAA4B,EAAE;AAChC,CAAC;AAED,eAAeT,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchContentItems.js","names":["React","BlazeLink","LazyImage","SearchContentItems","results","onClick","map","item","url","id","name","image","createElement","href","key","className","src","alt","sizeKey"],"sources":["../../../src/components/SearchContent/SearchContentItems.js"],"sourcesContent":["import React from 'react';\nimport BlazeLink from '../BlazeLink';\nimport LazyImage from '../LazyImage';\n\nconst SearchContentItems = ({ results = [], onClick }) =>\n results.map(item => {\n if (!item.url) return null;\n\n const { id, name, image, url } = item;\n\n return (\n <BlazeLink href={url} onClick={onClick} key={id}>\n <div className=\"search-content--results__wrapper\">\n {image?.url ? (\n <LazyImage\n src={image.url}\n alt={name}\n className=\"search-content--results__image\"\n sizeKey=\"search-result\"\n />\n ) : null}\n <span className=\"search-content--results__title\">{name}</span>\n </div>\n </BlazeLink>\n );\n });\n\nexport default SearchContentItems;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,SAAS,MAAM,cAAc;AAEpC,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,OAAO,GAAG,EAAE;EAAEC;AAAQ,CAAC,KACnDD,OAAO,CAACE,GAAG,CAACC,IAAI,IAAI;EAClB,IAAI,CAACA,IAAI,CAACC,GAAG,EAAE,OAAO,IAAI;
|
|
1
|
+
{"version":3,"file":"SearchContentItems.js","names":["React","BlazeLink","LazyImage","SearchContentItems","results","onClick","map","item","url","id","name","image","createElement","href","key","className","src","alt","sizeKey"],"sources":["../../../src/components/SearchContent/SearchContentItems.js"],"sourcesContent":["import React from 'react';\nimport BlazeLink from '../BlazeLink';\nimport LazyImage from '../LazyImage';\n\nconst SearchContentItems = ({ results = [], onClick }) =>\n results.map(item => {\n if (!item || !item.url) return null;\n\n const { id, name, image, url } = item;\n\n return (\n <BlazeLink href={url} onClick={onClick} key={id}>\n <div className=\"search-content--results__wrapper\">\n {image?.url ? (\n <LazyImage\n src={image.url}\n alt={name}\n className=\"search-content--results__image\"\n sizeKey=\"search-result\"\n />\n ) : null}\n <span className=\"search-content--results__title\">{name}</span>\n </div>\n </BlazeLink>\n );\n });\n\nexport default SearchContentItems;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,SAAS,MAAM,cAAc;AAEpC,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,OAAO,GAAG,EAAE;EAAEC;AAAQ,CAAC,KACnDD,OAAO,CAACE,GAAG,CAACC,IAAI,IAAI;EAClB,IAAI,CAACA,IAAI,IAAI,CAACA,IAAI,CAACC,GAAG,EAAE,OAAO,IAAI;EAEnC,MAAM;IAAEC,EAAE;IAAEC,IAAI;IAAEC,KAAK;IAAEH;EAAI,CAAC,GAAGD,IAAI;EAErC,oBACEP,KAAA,CAAAY,aAAA,CAACX,SAAS;IAACY,IAAI,EAAEL,GAAI;IAACH,OAAO,EAAEA,OAAQ;IAACS,GAAG,EAAEL;EAAG,gBAC9CT,KAAA,CAAAY,aAAA;IAAKG,SAAS,EAAC;EAAkC,GAC9C,CAAAJ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEH,GAAG,iBACTR,KAAA,CAAAY,aAAA,CAACV,SAAS;IACRc,GAAG,EAAEL,KAAK,CAACH,GAAI;IACfS,GAAG,EAAEP,IAAK;IACVK,SAAS,EAAC,gCAAgC;IAC1CG,OAAO,EAAC;EAAe,CACxB,CAAC,GACA,IAAI,eACRlB,KAAA,CAAAY,aAAA;IAAMG,SAAS,EAAC;EAAgC,GAAEL,IAAW,CAC1D,CACI,CAAC;AAEhB,CAAC,CAAC;AAEJ,eAAeP,kBAAkB"}
|
|
@@ -151,7 +151,7 @@ const SearchFilter = ({
|
|
|
151
151
|
}), /*#__PURE__*/React.createElement("button", {
|
|
152
152
|
className: "button button--full-width",
|
|
153
153
|
type: "submit"
|
|
154
|
-
}, SEARCH)))),
|
|
154
|
+
}, SEARCH)))), !displaySearchFilter && /*#__PURE__*/React.createElement("button", {
|
|
155
155
|
className: "button button--full-width",
|
|
156
156
|
type: "submit"
|
|
157
157
|
}, SEARCH))), displaySearchFilter && /*#__PURE__*/React.createElement(MobileFormToolbar, {
|