@blaze-cms/react-page-builder 0.128.0-admin-updates.5 → 0.128.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +6 -23
  2. package/lib/components/Card/Card.js +1 -1
  3. package/lib/components/Card/Card.js.map +1 -1
  4. package/lib/components/Card/CardsContainer.js +53 -24
  5. package/lib/components/Card/CardsContainer.js.map +1 -1
  6. package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +3 -1
  7. package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
  8. package/lib/components/Image/Image.js +1 -1
  9. package/lib/components/Image/Image.js.map +1 -1
  10. package/lib/components/List/components/Full/FullRender.js.map +1 -1
  11. package/lib/components/List/components/helpers/check-if-should-render-banner.js +27 -5
  12. package/lib/components/List/components/helpers/check-if-should-render-banner.js.map +1 -1
  13. package/lib/components/List/components/helpers/index.js +8 -2
  14. package/lib/components/List/components/helpers/index.js.map +1 -1
  15. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  16. package/lib/components/SearchFilter/components/Checkbox.js +6 -1
  17. package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
  18. package/lib/components/SearchFilter/components/Range.js +9 -5
  19. package/lib/components/SearchFilter/components/Range.js.map +1 -1
  20. package/lib/components/SearchFilter/components/Select.js +9 -5
  21. package/lib/components/SearchFilter/components/Select.js.map +1 -1
  22. package/lib/components/SearchFilter/components/TextSearch.js +9 -5
  23. package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
  24. package/lib-es/components/Card/Card.js +1 -1
  25. package/lib-es/components/Card/Card.js.map +1 -1
  26. package/lib-es/components/Card/CardsContainer.js +59 -35
  27. package/lib-es/components/Card/CardsContainer.js.map +1 -1
  28. package/lib-es/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +3 -1
  29. package/lib-es/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
  30. package/lib-es/components/Image/Image.js +1 -1
  31. package/lib-es/components/Image/Image.js.map +1 -1
  32. package/lib-es/components/List/components/Full/FullRender.js.map +1 -1
  33. package/lib-es/components/List/components/helpers/check-if-should-render-banner.js +29 -3
  34. package/lib-es/components/List/components/helpers/check-if-should-render-banner.js.map +1 -1
  35. package/lib-es/components/List/components/helpers/index.js +3 -2
  36. package/lib-es/components/List/components/helpers/index.js.map +1 -1
  37. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  38. package/lib-es/components/SearchFilter/components/Checkbox.js +6 -1
  39. package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
  40. package/lib-es/components/SearchFilter/components/Range.js +9 -5
  41. package/lib-es/components/SearchFilter/components/Range.js.map +1 -1
  42. package/lib-es/components/SearchFilter/components/Select.js +9 -5
  43. package/lib-es/components/SearchFilter/components/Select.js.map +1 -1
  44. package/lib-es/components/SearchFilter/components/TextSearch.js +9 -5
  45. package/lib-es/components/SearchFilter/components/TextSearch.js.map +1 -1
  46. package/package.json +9 -9
  47. package/src/components/Card/Card.js +2 -2
  48. package/src/components/Card/CardsContainer.js +54 -35
  49. package/src/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js +1 -1
  50. package/src/components/Image/Image.js +1 -1
  51. package/src/components/List/components/Full/FullRender.js +0 -1
  52. package/src/components/List/components/helpers/check-if-should-render-banner.js +24 -3
  53. package/src/components/List/components/helpers/index.js +4 -2
  54. package/src/components/SearchFilter/SearchFilter/SearchFilter.js +0 -1
  55. package/src/components/SearchFilter/components/Checkbox.js +4 -0
  56. package/src/components/SearchFilter/components/Range.js +7 -4
  57. package/src/components/SearchFilter/components/Select.js +23 -17
  58. package/src/components/SearchFilter/components/TextSearch.js +30 -26
  59. package/tests/unit/src/components/Card/__snapshots__/Card.test.js.snap +10 -10
  60. package/tests/unit/src/components/Card/__snapshots__/CardContainer.test.js.snap +8 -8
  61. package/tests/unit/src/components/DataSummary/DataSummaryTypes/__snapshots__/ItemDetailsSummary.test.js.snap +24 -4
  62. package/tests/unit/src/components/List/components/Cards/__snapshots__/CardsRender.test.js.snap +12 -12
  63. package/tests/unit/src/components/List/components/helpers/check-if-should-render-banner.test.js +59 -28
@@ -12,6 +12,7 @@ const Checkbox = ({
12
12
  updateFilterValues,
13
13
  filterValues,
14
14
  label,
15
+ elementTitle,
15
16
  shouldSearch,
16
17
  displayFilterCount
17
18
  }) => {
@@ -55,7 +56,9 @@ const Checkbox = ({
55
56
  disabled: value[2]
56
57
  }));
57
58
  const shouldDisplayMore = !checkboxLimit || checkboxLimit[prop] === LIMIT_MIN;
58
- return /*#__PURE__*/React.createElement(React.Fragment, null, label ? /*#__PURE__*/React.createElement("p", null, label) : '', /*#__PURE__*/React.createElement(Checkboxes, {
59
+ return /*#__PURE__*/React.createElement(React.Fragment, null, elementTitle && /*#__PURE__*/React.createElement("div", {
60
+ className: "heading heading--section"
61
+ }, elementTitle), label ? /*#__PURE__*/React.createElement("p", null, label) : '', /*#__PURE__*/React.createElement(Checkboxes, {
59
62
  className: "form-checkbox",
60
63
  options: multiple,
61
64
  onChange: ({
@@ -87,11 +90,13 @@ Checkbox.propTypes = {
87
90
  updateFilterValues: PropTypes.func.isRequired,
88
91
  shouldSearch: PropTypes.bool,
89
92
  label: PropTypes.string,
93
+ elementTitle: PropTypes.string,
90
94
  displayFilterCount: PropTypes.bool
91
95
  };
92
96
  Checkbox.defaultProps = {
93
97
  shouldSearch: false,
94
98
  label: '',
99
+ elementTitle: '',
95
100
  displayFilterCount: false
96
101
  };
97
102
  export default withTitle(Checkbox);
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","names":["React","useState","PropTypes","upperFirst","Checkboxes","FaChevronDown","FaChevronUp","withTitle","decodeValue","LIMIT_MIN","LIMIT_MAX","MORE","LESS","Checkbox","data","prop","updateFilterValues","filterValues","label","shouldSearch","displayFilterCount","checkboxLimit","setCheckboxLimit","handleCheckboxOptions","checkboxQueryParams","map","val","multiple","sortedValues","buckets","key","doc_count","count","optionLabel","filter","Boolean","sort","forEach","value","i","push","name","checked","includes","id","disabled","shouldDisplayMore","createElement","Fragment","className","options","onChange","eData","newCheckboxValues","length","role","onClick","propTypes","object","isRequired","string","func","bool","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Checkbox.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport upperFirst from 'lodash.upperfirst';\nimport { Checkboxes } from '@blaze-react/checkboxes';\nimport { FaChevronDown, FaChevronUp } from 'react-icons/fa';\nimport { withTitle } from '../../../HOC';\nimport { decodeValue } from '../helpers';\nimport { LIMIT_MIN, LIMIT_MAX, MORE, LESS } from '../constants';\n\nconst Checkbox = ({\n data,\n prop,\n updateFilterValues,\n filterValues,\n label,\n shouldSearch,\n displayFilterCount\n}) => {\n const [checkboxLimit, setCheckboxLimit] = useState(null);\n if (!data[prop]) return null;\n\n const handleCheckboxOptions = () => {\n if (checkboxLimit[prop] === LIMIT_MIN) {\n setCheckboxLimit({ [prop]: LIMIT_MAX });\n } else {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n };\n\n if (!checkboxLimit) {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n\n if (!checkboxLimit) return null;\n\n let checkboxQueryParams = [];\n\n if (filterValues && filterValues[prop]) {\n checkboxQueryParams =\n typeof filterValues[prop] === 'string'\n ? [decodeValue(filterValues[prop])]\n : filterValues[prop].map(val => decodeValue(val));\n }\n const multiple = [];\n\n const sortedValues = data[prop].buckets\n .map(({ key, doc_count: count }) => {\n const optionLabel = displayFilterCount ? `${key} (${count})` : key;\n return [key, optionLabel, !count];\n })\n .filter(Boolean)\n .sort();\n\n sortedValues.forEach(\n (value, i) =>\n i < checkboxLimit[prop] &&\n multiple.push({\n label: upperFirst(value[1]),\n value: value[0],\n name: prop,\n checked: checkboxQueryParams.includes(value[0]),\n id: value[0],\n disabled: value[2]\n })\n );\n\n const shouldDisplayMore = !checkboxLimit || checkboxLimit[prop] === LIMIT_MIN;\n\n return (\n <>\n {label ? <p>{label}</p> : ''}\n <Checkboxes\n className=\"form-checkbox\"\n options={multiple}\n onChange={({ data: eData }) => {\n const newCheckboxValues = eData\n .filter(({ checked }) => checked)\n .map(({ value }) => value);\n updateFilterValues({ [prop]: newCheckboxValues }, shouldSearch);\n }}\n />\n {data[prop].buckets.length > LIMIT_MIN && (\n <div role=\"button\" className=\"see-more\" onClick={handleCheckboxOptions}>\n {shouldDisplayMore ? (\n <>\n <i>\n <FaChevronDown className=\"inline-icon\" />\n </i>\n {` See ${MORE}`}\n </>\n ) : (\n <>\n <i>\n <FaChevronUp className=\"inline-icon\" />\n </i>\n {` See ${LESS}`}\n </>\n )}\n </div>\n )}\n </>\n );\n};\n\nCheckbox.propTypes = {\n data: PropTypes.object.isRequired,\n prop: PropTypes.string.isRequired,\n filterValues: PropTypes.object.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n label: PropTypes.string,\n displayFilterCount: PropTypes.bool\n};\n\nCheckbox.defaultProps = {\n shouldSearch: false,\n label: '',\n displayFilterCount: false\n};\n\nexport default withTitle(Checkbox);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,aAAa,EAAEC,WAAW,QAAQ,gBAAgB;AAC3D,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,WAAW,QAAQ,YAAY;AACxC,SAASC,SAAS,EAAEC,SAAS,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAE/D,MAAMC,QAAQ,GAAGA,CAAC;EAChBC,IAAI;EACJC,IAAI;EACJC,k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CAACc,OAAO,CAACyB,MAAM,GAAG7C,SAAS,iBACpCT,KAAA,CAAA+C,aAAA;IAAKQ,IAAI,EAAC,QAAQ;IAACN,SAAS,EAAC,UAAU;IAACO,OAAO,EAAEjC;EAAsB,GACpEuB,iBAAiB,gBAChB9C,KAAA,CAAA+C,aAAA,CAAA/C,KAAA,CAAAgD,QAAA,qBACEhD,KAAA,CAAA+C,aAAA,yBACE/C,KAAA,CAAA+C,aAAA,CAAC1C,aAAa;IAAC4C,SAAS,EAAC;EAAa,EAAG,CACvC,EACF,QAAOtC,IAAK,EAAC,CACd,gBAEHX,KAAA,CAAA+C,aAAA,CAAA/C,KAAA,CAAAgD,QAAA,qBACEhD,KAAA,CAAA+C,aAAA,yBACE/C,KAAA,CAAA+C,aAAA,CAACzC,WAAW;IAAC2C,SAAS,EAAC;EAAa,EAAG,CACrC,EACF,QAAOrC,IAAK,EAAC,CAElB,CAEJ,CACA;AAEP,CAAC;AAEDC,QAAQ,CAAC4C,SAAS,GAAG;EACnB3C,IAAI,EAAEZ,SAAS,CAACwD,MAAM,CAACC,UAAU;EACjC5C,IAAI,EAAEb,SAAS,CAAC0D,MAAM,CAACD,UAAU;EACjC1C,YAAY,EAAEf,SAAS,CAACwD,MAAM,CAACC,UAAU;EACzC3C,kBAAkB,EAAEd,SAAS,CAAC2D,IAAI,CAACF,UAAU;EAC7CxC,YAAY,EAAEjB,SAAS,CAAC4D,IAAI;EAC5B5C,KAAK,EAAEhB,SAAS,CAAC0D,MAAM;EACvBxC,kBAAkB,EAAElB,SAAS,CAAC4D;AAChC,CAAC;AAEDjD,QAAQ,CAACkD,YAAY,GAAG;EACtB5C,YAAY,EAAE,KAAK;EACnBD,KAAK,EAAE,EAAE;EACTE,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAeb,SAAS,CAACM,QAAQ,CAAC"}
1
+ {"version":3,"file":"Checkbox.js","names":["React","useState","PropTypes","upperFirst","Checkboxes","FaChevronDown","FaChevronUp","withTitle","decodeValue","LIMIT_MIN","LIMIT_MAX","MORE","LESS","Checkbox","data","prop","updateFilterValues","filterValues","label","elementTitle","shouldSearch","displayFilterCount","checkboxLimit","setCheckboxLimit","handleCheckboxOptions","checkboxQueryParams","map","val","multiple","sortedValues","buckets","key","doc_count","count","optionLabel","filter","Boolean","sort","forEach","value","i","push","name","checked","includes","id","disabled","shouldDisplayMore","createElement","Fragment","className","options","onChange","eData","newCheckboxValues","length","role","onClick","propTypes","object","isRequired","string","func","bool","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Checkbox.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport upperFirst from 'lodash.upperfirst';\nimport { Checkboxes } from '@blaze-react/checkboxes';\nimport { FaChevronDown, FaChevronUp } from 'react-icons/fa';\nimport { withTitle } from '../../../HOC';\nimport { decodeValue } from '../helpers';\nimport { LIMIT_MIN, LIMIT_MAX, MORE, LESS } from '../constants';\n\nconst Checkbox = ({\n data,\n prop,\n updateFilterValues,\n filterValues,\n label,\n elementTitle,\n shouldSearch,\n displayFilterCount\n}) => {\n const [checkboxLimit, setCheckboxLimit] = useState(null);\n if (!data[prop]) return null;\n\n const handleCheckboxOptions = () => {\n if (checkboxLimit[prop] === LIMIT_MIN) {\n setCheckboxLimit({ [prop]: LIMIT_MAX });\n } else {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n };\n\n if (!checkboxLimit) {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n\n if (!checkboxLimit) return null;\n\n let checkboxQueryParams = [];\n\n if (filterValues && filterValues[prop]) {\n checkboxQueryParams =\n typeof filterValues[prop] === 'string'\n ? [decodeValue(filterValues[prop])]\n : filterValues[prop].map(val => decodeValue(val));\n }\n const multiple = [];\n\n const sortedValues = data[prop].buckets\n .map(({ key, doc_count: count }) => {\n const optionLabel = displayFilterCount ? `${key} (${count})` : key;\n return [key, optionLabel, !count];\n })\n .filter(Boolean)\n .sort();\n\n sortedValues.forEach(\n (value, i) =>\n i < checkboxLimit[prop] &&\n multiple.push({\n label: upperFirst(value[1]),\n value: value[0],\n name: prop,\n checked: checkboxQueryParams.includes(value[0]),\n id: value[0],\n disabled: value[2]\n })\n );\n\n const shouldDisplayMore = !checkboxLimit || checkboxLimit[prop] === LIMIT_MIN;\n\n return (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n {label ? <p>{label}</p> : ''}\n <Checkboxes\n className=\"form-checkbox\"\n options={multiple}\n onChange={({ data: eData }) => {\n const newCheckboxValues = eData\n .filter(({ checked }) => checked)\n .map(({ value }) => value);\n updateFilterValues({ [prop]: newCheckboxValues }, shouldSearch);\n }}\n />\n {data[prop].buckets.length > LIMIT_MIN && (\n <div role=\"button\" className=\"see-more\" onClick={handleCheckboxOptions}>\n {shouldDisplayMore ? (\n <>\n <i>\n <FaChevronDown className=\"inline-icon\" />\n </i>\n {` See ${MORE}`}\n </>\n ) : (\n <>\n <i>\n <FaChevronUp className=\"inline-icon\" />\n </i>\n {` See ${LESS}`}\n </>\n )}\n </div>\n )}\n </>\n );\n};\n\nCheckbox.propTypes = {\n data: PropTypes.object.isRequired,\n prop: PropTypes.string.isRequired,\n filterValues: PropTypes.object.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n label: PropTypes.string,\n elementTitle: PropTypes.string,\n displayFilterCount: PropTypes.bool\n};\n\nCheckbox.defaultProps = {\n shouldSearch: false,\n label: '',\n elementTitle: '',\n displayFilterCount: false\n};\n\nexport default withTitle(Checkbox);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,aAAa,EAAEC,WAAW,QAAQ,gBAAgB;AAC3D,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,WAAW,QAAQ,YAAY;AACxC,SAASC,S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AAC6D;AAChC,CAAC;AAEDlD,QAAQ,CAACmD,YAAY,GAAG;EACtB5C,YAAY,EAAE,KAAK;EACnBF,KAAK,EAAE,EAAE;EACTC,YAAY,EAAE,EAAE;EAChBE,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAed,SAAS,CAACM,QAAQ,CAAC"}
@@ -9,7 +9,6 @@ import { useRouter } from 'next/router';
9
9
  import Select from '@blaze-react/select';
10
10
  import { parseUrl } from 'query-string';
11
11
  import { useGetSingleEntitySchema } from '../../../hooks';
12
- import { withTitle } from '../../../HOC';
13
12
  import { getSelectOptions, getIntersectedProp, getRangeValue, calculateMinMax } from '../helpers';
14
13
  import { decodeValue } from '../helpers/decode-encode';
15
14
  const Range = ({
@@ -20,7 +19,8 @@ const Range = ({
20
19
  dataAggregations,
21
20
  updateFilterValues,
22
21
  filterValues,
23
- shouldSearch
22
+ shouldSearch,
23
+ elementTitle
24
24
  }) => {
25
25
  const router = useRouter();
26
26
  const debounceAmount = shouldSearch ? 1200 : 400;
@@ -59,7 +59,9 @@ const Range = ({
59
59
  })
60
60
  }, shouldSearch);
61
61
  }, debounceAmount);
62
- return /*#__PURE__*/React.createElement(React.Fragment, null, hasMultipleOptions && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("label", null, label), /*#__PURE__*/React.createElement(Select, {
62
+ return /*#__PURE__*/React.createElement(React.Fragment, null, elementTitle && /*#__PURE__*/React.createElement("div", {
63
+ className: "heading heading--section"
64
+ }, elementTitle), hasMultipleOptions && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("label", null, label), /*#__PURE__*/React.createElement(Select, {
63
65
  value: rangeOption,
64
66
  id: rangeOption,
65
67
  options: options,
@@ -101,12 +103,14 @@ Range.propTypes = {
101
103
  shouldSearch: PropTypes.bool,
102
104
  rangeInterval: PropTypes.number,
103
105
  label: PropTypes.string,
106
+ elementTitle: PropTypes.string,
104
107
  dataAggregations: PropTypes.object.isRequired
105
108
  };
106
109
  Range.defaultProps = {
107
110
  shouldSearch: false,
108
111
  rangeInterval: 1,
109
- label: ''
112
+ label: '',
113
+ elementTitle: ''
110
114
  };
111
- export default withTitle(Range);
115
+ export default Range;
112
116
  //# sourceMappingURL=Range.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Range.js","names":["React","PropTypes","debounce","RangeFilter","useRouter","Select","parseUrl","useGetSingleEntitySchema","withTitle","getSelectOptions","getIntersectedProp","getRangeValue","calculateMinMax","decodeValue","Range","rangeInterval","label","entity","propsToDisplay","dataAggregations","updateFilterValues","filterValues","shouldSearch","router","debounceAmount","query","asPath","hasMultipleOptions","length","initialRangeOption","rangeOption","selectedOption","rangeValue","data","getEntitySchema","loading","options","min","max","minValue","maxValue","valueToUse","_objectSpread","handleChange","option","value","createElement","Fragment","id","required","onChange","updatedOptions","forEach","prop","eMin","eMax","initValue","key","name","propTypes","array","isRequired","string","object","func","bool","number","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Range.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash.debounce';\nimport RangeFilter from '@blaze-react/range-filter';\nimport { useRouter } from 'next/router';\nimport Select from '@blaze-react/select';\nimport { parseUrl } from 'query-string';\nimport { useGetSingleEntitySchema } from '../../../hooks';\nimport { withTitle } from '../../../HOC';\nimport { getSelectOptions, getIntersectedProp, getRangeValue, calculateMinMax } from '../helpers';\nimport { decodeValue } from '../helpers/decode-encode';\n\nconst Range = ({\n rangeInterval,\n label,\n entity,\n propsToDisplay,\n dataAggregations,\n updateFilterValues,\n filterValues,\n shouldSearch\n}) => {\n const router = useRouter();\n const debounceAmount = shouldSearch ? 1200 : 400;\n const { query } = parseUrl(decodeValue(router.asPath));\n const hasMultipleOptions = propsToDisplay.length > 1;\n const initialRangeOption = getIntersectedProp(query, propsToDisplay) || propsToDisplay[0];\n const rangeOption =\n (filterValues[initialRangeOption] && filterValues[initialRangeOption].selectedOption) ||\n initialRangeOption;\n const rangeValue = filterValues[rangeOption];\n\n const { data: { getEntitySchema = {} } = {}, loading } = useGetSingleEntitySchema(\n entity,\n !hasMultipleOptions\n );\n\n if (loading || !rangeOption || !rangeValue) return '';\n\n const options = getSelectOptions(getEntitySchema, propsToDisplay);\n // get range from aggregations so it updates\n const { min, max } = calculateMinMax(dataAggregations[rangeOption], rangeInterval);\n const minValue = rangeValue.minValue < min ? min : rangeValue.minValue;\n const maxValue = rangeValue.maxValue > max ? max : rangeValue.maxValue;\n const valueToUse = { ...rangeValue, min, max, minValue, maxValue };\n\n const handleChange = debounce((option, value) => {\n updateFilterValues({ [option]: { ...value, selectedOption: rangeOption } }, shouldSearch);\n }, debounceAmount);\n\n return (\n <>\n {hasMultipleOptions && (\n <>\n <label>{label}</label>\n <Select\n value={rangeOption}\n id={rangeOption}\n options={options}\n required\n onChange={({ value }) => {\n const updatedOptions = {};\n propsToDisplay.forEach(prop => {\n const { min: eMin, max: eMax } = filterValues[prop];\n const initValue = getRangeValue(null, rangeInterval, eMin, eMax);\n updatedOptions[prop] = { ...initValue, selectedOption: value };\n });\n\n updateFilterValues(updatedOptions, false);\n }}\n />\n </>\n )}\n <RangeFilter\n key={`${rangeOption}-${minValue}-${maxValue}`}\n name={rangeOption}\n label={hasMultipleOptions ? '' : label}\n value={valueToUse}\n id={rangeOption}\n onChange={({ value }) => {\n handleChange(rangeOption, value);\n }}\n />\n </>\n );\n};\n\nRange.propTypes = {\n propsToDisplay: PropTypes.array.isRequired,\n entity: PropTypes.string.isRequired,\n filterValues: PropTypes.object.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n rangeInterval: PropTypes.number,\n label: PropTypes.string,\n dataAggregations: PropTypes.object.isRequired\n};\n\nRange.defaultProps = {\n shouldSearch: false,\n rangeInterval: 1,\n label: ''\n};\n\nexport default withTitle(Range);\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAO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K,CAACqD,YAAY,GAAG;EACnB7C,YAAY,EAAE,KAAK;EACnBP,aAAa,EAAE,CAAC;EAChBC,KAAK,EAAE;AACT,CAAC;AAED,eAAeR,SAAS,CAACM,KAAK,CAAC"}
1
+ {"version":3,"file":"Range.js","names":["React","PropTypes","debounce","RangeFilter","useRouter","Select","parseUrl","useGetSingleEntitySchema","getSelectOptions","getIntersectedProp","getRangeValue","calculateMinMax","decodeValue","Range","rangeInterval","label","entity","propsToDisplay","dataAggregations","updateFilterValues","filterValues","shouldSearch","elementTitle","router","debounceAmount","query","asPath","hasMultipleOptions","length","initialRangeOption","rangeOption","selectedOption","rangeValue","data","getEntitySchema","loading","options","min","max","minValue","maxValue","valueToUse","_objectSpread","handleChange","option","value","createElement","Fragment","className","id","required","onChange","updatedOptions","forEach","prop","eMin","eMax","initValue","key","name","propTypes","array","isRequired","string","object","func","bool","number","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Range.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash.debounce';\nimport RangeFilter from '@blaze-react/range-filter';\nimport { useRouter } from 'next/router';\nimport Select from '@blaze-react/select';\nimport { parseUrl } from 'query-string';\nimport { useGetSingleEntitySchema } from '../../../hooks';\nimport { getSelectOptions, getIntersectedProp, getRangeValue, calculateMinMax } from '../helpers';\nimport { decodeValue } from '../helpers/decode-encode';\n\nconst Range = ({\n rangeInterval,\n label,\n entity,\n propsToDisplay,\n dataAggregations,\n updateFilterValues,\n filterValues,\n shouldSearch,\n elementTitle\n}) => {\n const router = useRouter();\n const debounceAmount = shouldSearch ? 1200 : 400;\n const { query } = parseUrl(decodeValue(router.asPath));\n const hasMultipleOptions = propsToDisplay.length > 1;\n const initialRangeOption = getIntersectedProp(query, propsToDisplay) || propsToDisplay[0];\n const rangeOption =\n (filterValues[initialRangeOption] && filterValues[initialRangeOption].selectedOption) ||\n initialRangeOption;\n const rangeValue = filterValues[rangeOption];\n\n const { data: { getEntitySchema = {} } = {}, loading } = useGetSingleEntitySchema(\n entity,\n !hasMultipleOptions\n );\n\n if (loading || !rangeOption || !rangeValue) return '';\n\n const options = getSelectOptions(getEntitySchema, propsToDisplay);\n // get range from aggregations so it updates\n const { min, max } = calculateMinMax(dataAggregations[rangeOption], rangeInterval);\n const minValue = rangeValue.minValue < min ? min : rangeValue.minValue;\n const maxValue = rangeValue.maxValue > max ? max : rangeValue.maxValue;\n const valueToUse = { ...rangeValue, min, max, minValue, maxValue };\n\n const handleChange = debounce((option, value) => {\n updateFilterValues({ [option]: { ...value, selectedOption: rangeOption } }, shouldSearch);\n }, debounceAmount);\n\n return (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n {hasMultipleOptions && (\n <>\n <label>{label}</label>\n <Select\n value={rangeOption}\n id={rangeOption}\n options={options}\n required\n onChange={({ value }) => {\n const updatedOptions = {};\n propsToDisplay.forEach(prop => {\n const { min: eMin, max: eMax } = filterValues[prop];\n const initValue = getRangeValue(null, rangeInterval, eMin, eMax);\n updatedOptions[prop] = { ...initValue, selectedOption: value };\n });\n\n updateFilterValues(updatedOptions, false);\n }}\n />\n </>\n )}\n <RangeFilter\n key={`${rangeOption}-${minValue}-${maxValue}`}\n name={rangeOption}\n label={hasMultipleOptions ? '' : label}\n value={valueToUse}\n id={rangeOption}\n onChange={({ value }) => {\n handleChange(rangeOption, value);\n }}\n />\n </>\n );\n};\n\nRange.propTypes = {\n propsToDisplay: PropTypes.array.isRequired,\n entity: PropTypes.string.isRequired,\n filterValues: PropTypes.object.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n rangeInterval: PropTypes.number,\n label: PropTypes.string,\n elementTitle: PropTypes.string,\n dataAggregations: PropTypes.object.isRequired\n};\n\nRange.defaultProps = {\n shouldSearch: false,\n rangeInterval: 1,\n label: '',\n elementTitle: ''\n};\n\nexport default Range;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SA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EAAEd,SAAS,CAAC8D,MAAM;EACvBzC,YAAY,EAAErB,SAAS,CAAC8D,MAAM;EAC9B7C,gBAAgB,EAAEjB,SAAS,CAAC+D,MAAM,CAACF;AACrC,CAAC;AAEDjD,KAAK,CAACuD,YAAY,GAAG;EACnB/C,YAAY,EAAE,KAAK;EACnBP,aAAa,EAAE,CAAC;EAChBC,KAAK,EAAE,EAAE;EACTO,YAAY,EAAE;AAChB,CAAC;AAED,eAAeT,KAAK"}
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Select from '@blaze-react/select';
4
- import { withTitle } from '../../../HOC';
5
4
  import { DEFAULT_OPTION } from '../constants';
6
5
  const SelectFilter = ({
7
6
  data,
@@ -11,7 +10,8 @@ const SelectFilter = ({
11
10
  filterValues,
12
11
  shouldSearch,
13
12
  displayLabelAsPlaceholder,
14
- displayFilterCount
13
+ displayFilterCount,
14
+ elementTitle
15
15
  }) => {
16
16
  const filterValue = filterValues[prop] || '';
17
17
  const disabledOptions = [];
@@ -33,7 +33,9 @@ const SelectFilter = ({
33
33
  defaultTextValue = labelToUse;
34
34
  labelToUse = null;
35
35
  }
36
- return /*#__PURE__*/React.createElement(Select, {
36
+ return /*#__PURE__*/React.createElement(React.Fragment, null, elementTitle && /*#__PURE__*/React.createElement("div", {
37
+ className: "heading heading--section"
38
+ }, elementTitle), /*#__PURE__*/React.createElement(Select, {
37
39
  label: labelToUse,
38
40
  value: filterValue,
39
41
  id: prop,
@@ -50,7 +52,7 @@ const SelectFilter = ({
50
52
  }, shouldSearch);
51
53
  },
52
54
  disabled: disabledOptions
53
- });
55
+ }));
54
56
  };
55
57
  SelectFilter.propTypes = {
56
58
  data: PropTypes.object.isRequired,
@@ -59,6 +61,7 @@ SelectFilter.propTypes = {
59
61
  updateFilterValues: PropTypes.func.isRequired,
60
62
  shouldSearch: PropTypes.bool,
61
63
  label: PropTypes.string,
64
+ elementTitle: PropTypes.string,
62
65
  displayLabelAsPlaceholder: PropTypes.bool,
63
66
  displayFilterCount: PropTypes.bool
64
67
  };
@@ -66,8 +69,9 @@ SelectFilter.defaultProps = {
66
69
  filterValues: {},
67
70
  shouldSearch: false,
68
71
  label: '',
72
+ elementTitle: '',
69
73
  displayLabelAsPlaceholder: false,
70
74
  displayFilterCount: false
71
75
  };
72
- export default withTitle(SelectFilter);
76
+ export default SelectFilter;
73
77
  //# sourceMappingURL=Select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","names":["React","PropTypes","Select","withTitle","DEFAULT_OPTION","SelectFilter","data","label","prop","updateFilterValues","filterValues","shouldSearch","displayLabelAsPlaceholder","displayFilterCount","filterValue","disabledOptions","buckets","options","map","key","doc_count","count","push","optionLabel","filter","Boolean","sort","labelText","labelToUse","defaultTextValue","createElement","value","id","onChange","valueToUse","disabled","propTypes","object","isRequired","string","func","bool","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Select.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Select from '@blaze-react/select';\nimport { withTitle } from '../../../HOC';\nimport { DEFAULT_OPTION } from '../constants';\n\nconst SelectFilter = ({\n data,\n label,\n prop,\n updateFilterValues,\n filterValues,\n shouldSearch,\n displayLabelAsPlaceholder,\n displayFilterCount\n}) => {\n const filterValue = filterValues[prop] || '';\n const disabledOptions = [];\n const { buckets = [] } = data[prop] || {};\n const options = buckets\n .map(({ key, doc_count: count }) => {\n if (!count) disabledOptions.push(key);\n const optionLabel = displayFilterCount ? `${key} (${count})` : key;\n return [key, optionLabel];\n })\n .filter(Boolean)\n .sort();\n\n const labelText = label || prop;\n let labelToUse = labelText;\n let defaultTextValue = DEFAULT_OPTION;\n if (displayLabelAsPlaceholder) {\n defaultTextValue = labelToUse;\n labelToUse = null;\n }\n\n return (\n <Select\n label={labelToUse}\n value={filterValue}\n id={prop}\n data-testid={`filter-${prop}`}\n options={options}\n defaultTextValue={defaultTextValue}\n onChange={({ value }) => {\n let valueToUse = value;\n if (value === defaultTextValue) valueToUse = '';\n updateFilterValues({ [prop]: valueToUse }, shouldSearch);\n }}\n disabled={disabledOptions}\n />\n );\n};\n\nSelectFilter.propTypes = {\n data: PropTypes.object.isRequired,\n prop: PropTypes.string.isRequired,\n filterValues: PropTypes.object,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n label: PropTypes.string,\n displayLabelAsPlaceholder: PropTypes.bool,\n displayFilterCount: PropTypes.bool\n};\n\nSelectFilter.defaultProps = {\n filterValues: {},\n shouldSearch: false,\n label: '',\n displayLabelAsPlaceholder: false,\n displayFilterCount: false\n};\n\nexport default withTitle(SelectFilter);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,cAAc,QAAQ,cAAc;AAE7C,MAAMC,YAAY,GAAGA,CAAC;EACpBC,IAAI;EACJC,KAAK;EACLC,IAAI;EACJC,kBAAkB;EAClBC,YAAY;EACZC,YAAY;EACZC,yBAAyB;EACzBC;AACF,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAGJ,YAAY,CAACF,IAAI,CAAC,IAAI,EAAE;EAC5C,MAAMO,eAAe,GAAG,EAAE;EAC1B,MAAM;IAAEC,OAAO,GAAG;EAAG,CAAC,GAAGV,IAAI,CAACE,IAAI,CAAC,IAAI,CAAC,CAAC;EACzC,MAAMS,OAAO,GAAGD,OAAO,CACpBE,GAAG,CAAC,CAAC;IAAEC,GAAG;IAAEC,SAAS,EAAEC;EAAM,CAAC,KAAK;IAClC,IAAI,CAACA,KAAK,EAAEN,eAAe,CAACO,IAAI,CAACH,GAAG,CAAC;IACrC,MAAMI,WAAW,GAAGV,kBAAkB,GAAI,GAAEM,GAAI,KAAIE,KAAM,GAAE,GAAGF,GAAG;IAClE,OAAO,CAACA,GAAG,EAAEI,WAAW,CAAC;EAC3B,CAA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C,YAAY,EAAE,CAAC,CAAC;EAChBC,YAAY,EAAE,KAAK;EACnBJ,KAAK,EAAE,EAAE;EACTK,yBAAyB,EAAE,KAAK;EAChCC,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAeV,SAAS,CAACE,YAAY,CAAC"}
1
+ {"version":3,"file":"Select.js","names":["React","PropTypes","Select","DEFAULT_OPTION","SelectFilter","data","label","prop","updateFilterValues","filterValues","shouldSearch","displayLabelAsPlaceholder","displayFilterCount","elementTitle","filterValue","disabledOptions","buckets","options","map","key","doc_count","count","push","optionLabel","filter","Boolean","sort","labelText","labelToUse","defaultTextValue","createElement","Fragment","className","value","id","onChange","valueToUse","disabled","propTypes","object","isRequired","string","func","bool","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Select.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Select from '@blaze-react/select';\nimport { DEFAULT_OPTION } from '../constants';\n\nconst SelectFilter = ({\n data,\n label,\n prop,\n updateFilterValues,\n filterValues,\n shouldSearch,\n displayLabelAsPlaceholder,\n displayFilterCount,\n elementTitle\n}) => {\n const filterValue = filterValues[prop] || '';\n const disabledOptions = [];\n const { buckets = [] } = data[prop] || {};\n const options = buckets\n .map(({ key, doc_count: count }) => {\n if (!count) disabledOptions.push(key);\n const optionLabel = displayFilterCount ? `${key} (${count})` : key;\n return [key, optionLabel];\n })\n .filter(Boolean)\n .sort();\n\n const labelText = label || prop;\n let labelToUse = labelText;\n let defaultTextValue = DEFAULT_OPTION;\n if (displayLabelAsPlaceholder) {\n defaultTextValue = labelToUse;\n labelToUse = null;\n }\n\n return (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n <Select\n label={labelToUse}\n value={filterValue}\n id={prop}\n data-testid={`filter-${prop}`}\n options={options}\n defaultTextValue={defaultTextValue}\n onChange={({ value }) => {\n let valueToUse = value;\n if (value === defaultTextValue) valueToUse = '';\n updateFilterValues({ [prop]: valueToUse }, shouldSearch);\n }}\n disabled={disabledOptions}\n />\n </>\n );\n};\n\nSelectFilter.propTypes = {\n data: PropTypes.object.isRequired,\n prop: PropTypes.string.isRequired,\n filterValues: PropTypes.object,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n label: PropTypes.string,\n elementTitle: PropTypes.string,\n\n displayLabelAsPlaceholder: PropTypes.bool,\n displayFilterCount: PropTypes.bool\n};\n\nSelectFilter.defaultProps = {\n filterValues: {},\n shouldSearch: false,\n label: '',\n elementTitle: '',\n displayLabelAsPlaceholder: false,\n displayFilterCount: false\n};\n\nexport default SelectFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,cAAc,QAAQ,cAAc;AAE7C,MAAMC,YAAY,GAAGA,CAAC;EACpBC,IAAI;EACJC,KAAK;EACLC,IAAI;EACJC,kBAAkB;EAClBC,YAAY;EACZC,YAAY;EACZC,yBAAyB;EACzBC,kBAAkB;EAClBC;AACF,CAAC,KAAK;EACJ,MAAMC,WAAW,GAAGL,YAAY,CAACF,IAAI,CAAC,IAAI,EAAE;EAC5C,MAAMQ,eAAe,GAAG,EAAE;EAC1B,MAAM;IAAEC,OAAO,GAAG;EAAG,CAAC,GAAGX,IAAI,CAACE,IAAI,CAAC,IAAI,CAAC,CAAC;EACzC,MAAMU,OAAO,GAAGD,OAAO,CACpBE,GAAG,CAAC,CAAC;IAAEC,GAAG;IAAEC,SAAS,EAAEC;EAAM,CAAC,KAAK;IAClC,IAAI,CAACA,KAAK,EAAEN,eAAe,CAACO,IAAI,CAACH,GAAG,CAAC;IACrC,MAAMI,WAAW,GAAGX,kBAAkB,GAAI,GAAEO,GAAI,KAAIE,KAAM,GAAE,GAAGF,GAAG;IAClE,OAAO,CAACA,GAAG,EAAEI,WAAW,CAAC;EAC3B,CAAC,CAAC,CACDC,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,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CAACwC,MAAM;EAE9B9B,yBAAyB,EAAEV,SAAS,CAAC0C,IAAI;EACzC/B,kBAAkB,EAAEX,SAAS,CAAC0C;AAChC,CAAC;AAEDvC,YAAY,CAACwC,YAAY,GAAG;EAC1BnC,YAAY,EAAE,CAAC,CAAC;EAChBC,YAAY,EAAE,KAAK;EACnBJ,KAAK,EAAE,EAAE;EACTO,YAAY,EAAE,EAAE;EAChBF,yBAAyB,EAAE,KAAK;EAChCC,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAeR,YAAY"}
@@ -2,13 +2,15 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Input from '@blaze-react/input';
4
4
  import { MdSearch } from 'react-icons/md';
5
- import { withTitle } from '../../../HOC';
6
5
  import { SEARCH_TERM } from '../constants';
7
6
  const TextSearch = ({
8
7
  label,
9
8
  searchValue,
10
- updateFilterValues
11
- }) => /*#__PURE__*/React.createElement("div", {
9
+ updateFilterValues,
10
+ elementTitle
11
+ }) => /*#__PURE__*/React.createElement(React.Fragment, null, elementTitle && /*#__PURE__*/React.createElement("div", {
12
+ className: "heading heading--section"
13
+ }, elementTitle), /*#__PURE__*/React.createElement("div", {
12
14
  className: "search"
13
15
  }, /*#__PURE__*/React.createElement("div", {
14
16
  className: "search__wrapper"
@@ -34,14 +36,16 @@ const TextSearch = ({
34
36
  [SEARCH_TERM]: searchValue
35
37
  }, true);
36
38
  }
37
- }, /*#__PURE__*/React.createElement("i", null, /*#__PURE__*/React.createElement(MdSearch, null)))));
39
+ }, /*#__PURE__*/React.createElement("i", null, /*#__PURE__*/React.createElement(MdSearch, null))))));
38
40
  TextSearch.propTypes = {
39
41
  searchValue: PropTypes.string.isRequired,
40
42
  updateFilterValues: PropTypes.func.isRequired,
43
+ elementTitle: PropTypes.string,
41
44
  label: PropTypes.string
42
45
  };
43
46
  TextSearch.defaultProps = {
47
+ elementTitle: '',
44
48
  label: ''
45
49
  };
46
- export default withTitle(TextSearch);
50
+ export default TextSearch;
47
51
  //# sourceMappingURL=TextSearch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextSearch.js","names":["React","PropTypes","Input","MdSearch","withTitle","SEARCH_TERM","TextSearch","label","searchValue","updateFilterValues","createElement","className","id","value","placeholder","onChange","eValue","type","onClick","e","preventDefault","propTypes","string","isRequired","func","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/TextSearch.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Input from '@blaze-react/input';\nimport { MdSearch } from 'react-icons/md';\nimport { withTitle } from '../../../HOC';\nimport { SEARCH_TERM } from '../constants';\n\nconst TextSearch = ({ label, searchValue, updateFilterValues }) => (\n <div className=\"search\">\n <div className=\"search__wrapper\">\n <div className=\"form-field form-field--input form-field--search\">\n <Input\n id={SEARCH_TERM}\n value={searchValue}\n placeholder={label || 'Search'}\n onChange={({ value: eValue }) => {\n updateFilterValues({ [SEARCH_TERM]: eValue }, false);\n }}\n />\n </div>\n <button\n type=\"button\"\n className=\"icon-button icon-button--search\"\n onClick={e => {\n e.preventDefault();\n updateFilterValues({ [SEARCH_TERM]: searchValue }, true);\n }}>\n <i>\n <MdSearch />\n </i>\n </button>\n </div>\n </div>\n);\n\nTextSearch.propTypes = {\n searchValue: PropTypes.string.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n label: PropTypes.string\n};\n\nTextSearch.defaultProps = {\n label: ''\n};\n\nexport default withTitle(TextSearch);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,oBAAoB;AACtC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,WAAW,QAAQ,cAAc;AAE1C,MAAMC,UAAU,GAAGA,CAAC;EAAEC,KAAK;EAAEC,WAAW;EAAEC;AAAmB,CAAC,kBAC5DT,KAAA,CAAAU,aAAA;EAAKC,SAAS,EAAC;AAAQ,gBACrBX,KAAA,CAAAU,aAAA;EAAKC,SAAS,EAAC;AAAiB,gBAC9BX,KAAA,CAAAU,aAAA;EAAKC,SAAS,EAAC;AAAiD,gBAC9DX,KAAA,CAAAU,aAAA,CAACR,KAAK;EACJU,EAAE,EAAEP,WAAY;EAChBQ,KAAK,EAAEL,WAAY;EACnBM,WAAW,EAAEP,KAAK,IAAI,QAAS;EAC/BQ,QAAQ,EAAEA,CAAC;IAAEF,KAAK,EAAEG;EAAO,CAAC,KAAK;IAC/BP,kBAAkB,CAAC;MAAE,CAACJ,WAAW,GAAGW;IAAO,CAAC,EAAE,KAAK,CAAC;EACtD;AAAE,EACF,CACE,eACNhB,KAAA,CAAAU,aAAA;EACEO,IAAI,EAAC,QAAQ;EACbN,SAAS,EAAC,iCAAiC;EAC3CO,OAAO,EAAEC,CAAC,IAAI;IACZA,CAAC,CAACC,cAAc,EAAE;IAClBX,kBAAkB,CAAC;MAAE,CAACJ,WAAW,GAAGG;IAAY,CAAC,EAAE,IAAI,CAAC;EAC1D;AAAE,gBACFR,KAAA,CAAAU,aAAA,yBACEV,KAAA,CAAAU,aAAA,CAACP,QAAQ,OAAG,CACV,CACG,CACL,CAET;AAEDG,UAAU,CAACe,SAAS,GAAG;EACrBb,WAAW,EAAEP,SAAS,CAACqB,MAAM,CAACC,UAAU;EACxCd,kBAAkB,EAAER,SAAS,CAACuB,IAAI,CAACD,UAAU;EAC7ChB,KAAK,EAAEN,SAAS,CAACqB;AACnB,CAAC;AAEDhB,UAAU,CAACmB,YAAY,GAAG;EACxBlB,KAAK,EAAE;AACT,CAAC;AAED,eAAeH,SAAS,CAACE,UAAU,CAAC"}
1
+ {"version":3,"file":"TextSearch.js","names":["React","PropTypes","Input","MdSearch","SEARCH_TERM","TextSearch","label","searchValue","updateFilterValues","elementTitle","createElement","Fragment","className","id","value","placeholder","onChange","eValue","type","onClick","e","preventDefault","propTypes","string","isRequired","func","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/TextSearch.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Input from '@blaze-react/input';\nimport { MdSearch } from 'react-icons/md';\nimport { SEARCH_TERM } from '../constants';\n\nconst TextSearch = ({ label, searchValue, updateFilterValues, elementTitle }) => (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n <div className=\"search\">\n <div className=\"search__wrapper\">\n <div className=\"form-field form-field--input form-field--search\">\n <Input\n id={SEARCH_TERM}\n value={searchValue}\n placeholder={label || 'Search'}\n onChange={({ value: eValue }) => {\n updateFilterValues({ [SEARCH_TERM]: eValue }, false);\n }}\n />\n </div>\n <button\n type=\"button\"\n className=\"icon-button icon-button--search\"\n onClick={e => {\n e.preventDefault();\n updateFilterValues({ [SEARCH_TERM]: searchValue }, true);\n }}>\n <i>\n <MdSearch />\n </i>\n </button>\n </div>\n </div>\n </>\n);\n\nTextSearch.propTypes = {\n searchValue: PropTypes.string.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n elementTitle: PropTypes.string,\n label: PropTypes.string\n};\n\nTextSearch.defaultProps = {\n elementTitle: '',\n label: ''\n};\n\nexport default TextSearch;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,oBAAoB;AACtC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,WAAW,QAAQ,cAAc;AAE1C,MAAMC,UAAU,GAAGA,CAAC;EAAEC,KAAK;EAAEC,WAAW;EAAEC,kBAAkB;EAAEC;AAAa,CAAC,kBAC1ET,KAAA,CAAAU,aAAA,CAAAV,KAAA,CAAAW,QAAA,QACGF,YAAY,iBAAIT,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAA0B,GAAEH,YAAY,CAAO,eAC/ET,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAQ,gBACrBZ,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAiB,gBAC9BZ,KAAA,CAAAU,aAAA;EAAKE,SAAS,EAAC;AAAiD,gBAC9DZ,KAAA,CAAAU,aAAA,CAACR,KAAK;EACJW,EAAE,EAAET,WAAY;EAChBU,KAAK,EAAEP,WAAY;EACnBQ,WAAW,EAAET,KAAK,IAAI,QAAS;EAC/BU,QAAQ,EAAEA,CAAC;IAAEF,KAAK,EAAEG;EAAO,CAAC,KAAK;IAC/BT,kBAAkB,CAAC;MAAE,CAACJ,WAAW,GAAGa;IAAO,CAAC,EAAE,KAAK,CAAC;EACtD;AAAE,EACF,CACE,eACNjB,KAAA,CAAAU,aAAA;EACEQ,IAAI,EAAC,QAAQ;EACbN,SAAS,EAAC,iCAAiC;EAC3CO,OAAO,EAAEC,CAAC,IAAI;IACZA,CAAC,CAACC,cAAc,EAAE;IAClBb,kBAAkB,CAAC;MAAE,CAACJ,WAAW,GAAGG;IAAY,CAAC,EAAE,IAAI,CAAC;EAC1D;AAAE,gBACFP,KAAA,CAAAU,aAAA,yBACEV,KAAA,CAAAU,aAAA,CAACP,QAAQ,OAAG,CACV,CACG,CACL,CACF,CAET;AAEDE,UAAU,CAACiB,SAAS,GAAG;EACrBf,WAAW,EAAEN,SAAS,CAACsB,MAAM,CAACC,UAAU;EACxChB,kBAAkB,EAAEP,SAAS,CAACwB,IAAI,CAACD,UAAU;EAC7Cf,YAAY,EAAER,SAAS,CAACsB,MAAM;EAC9BjB,KAAK,EAAEL,SAAS,CAACsB;AACnB,CAAC;AAEDlB,UAAU,CAACqB,YAAY,GAAG;EACxBjB,YAAY,EAAE,EAAE;EAChBH,KAAK,EAAE;AACT,CAAC;AAED,eAAeD,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaze-cms/react-page-builder",
3
- "version": "0.128.0-admin-updates.5",
3
+ "version": "0.128.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": "0.128.0-admin-updates.0",
31
- "@blaze-cms/core-errors": "0.128.0-admin-updates.0",
30
+ "@blaze-cms/core-auth-ui": "0.128.0-alpha.0",
31
+ "@blaze-cms/core-errors": "^0.127.0",
32
32
  "@blaze-cms/image-cdn-react": "0.3.0-alpha.3",
33
- "@blaze-cms/nextjs-components": "0.128.0-admin-updates.0",
34
- "@blaze-cms/plugin-search-ui": "0.128.0-admin-updates.3",
35
- "@blaze-cms/setup-ui": "0.128.0-admin-updates.0",
36
- "@blaze-cms/utils": "0.128.0-admin-updates.0",
37
- "@blaze-cms/utils-handlebars": "0.128.0-admin-updates.0",
33
+ "@blaze-cms/nextjs-components": "0.128.0-alpha.0",
34
+ "@blaze-cms/plugin-search-ui": "0.128.0-alpha.0",
35
+ "@blaze-cms/setup-ui": "0.128.0-alpha.0",
36
+ "@blaze-cms/utils": "0.128.0-alpha.0",
37
+ "@blaze-cms/utils-handlebars": "0.128.0-alpha.0",
38
38
  "@blaze-react/breadcrumb": "0.8.0-alpha.60",
39
39
  "@blaze-react/button": "0.5.19",
40
40
  "@blaze-react/checkboxes": "0.5.31",
@@ -88,5 +88,5 @@
88
88
  "lib/*",
89
89
  "lib-es/*"
90
90
  ],
91
- "gitHead": "6dc291cfd27848dd80149526f6f26c4a0d17a708"
91
+ "gitHead": "a9b5b67a3521c59b311b09996c49fb1a65c2ca04"
92
92
  }
@@ -134,11 +134,11 @@ const Card = ({
134
134
  <div className="badge badge--label">{label}</div>
135
135
  ))}
136
136
  {displayTitle && (
137
- <h2 className={titleWrapperModifier}>
137
+ <div className={titleWrapperModifier}>
138
138
  <BlazeLink title={linkTitle} gtmId={gtmId} href={url} scroll>
139
139
  {headline}
140
140
  </BlazeLink>
141
- </h2>
141
+ </div>
142
142
  )}
143
143
  {!!parsedPropsToDisplay.length && (
144
144
  <div className={getModifiers('card__details', modifiers)}>
@@ -9,8 +9,9 @@ import Card from './Card';
9
9
  import { getDynamicGridClasses } from './helpers';
10
10
  import { getEntitiesWithBanner, parsePropsToDisplay } from '../../helpers';
11
11
  import { getPropsToDisplayModifiers } from '../../utils';
12
+ import { checkIfShouldRenderBanner, checkNewBannerSettings } from '../List/components/helpers';
12
13
 
13
- const CardsContainer = ({
14
+ const CardContainer = ({
14
15
  cardData,
15
16
  gridModifier,
16
17
  style,
@@ -36,14 +37,20 @@ const CardsContainer = ({
36
37
  titleOverlayModifier,
37
38
  ...cardProps
38
39
  }) => {
39
- const cardsWithBanners = getEntitiesWithBanner(cardData, cardProps);
40
40
  const { itemId } = useContext(MainContext);
41
+ const { banner } = cardProps;
42
+ // TODO: remove this check and all associated code once old banner setup is no longer supported
43
+ const hasNewBannerSettings = checkNewBannerSettings(banner);
44
+ const parsedCardsData = hasNewBannerSettings
45
+ ? cardData
46
+ : getEntitiesWithBanner(cardData, cardProps);
41
47
  const propsToDisplayModifiers = getPropsToDisplayModifiers(propsToDisplay);
42
48
  const dynamicWrapperSizes = enableCarousel
43
49
  ? ''
44
50
  : getDynamicGridClasses('grid', itemsPerRow, designConfig);
45
- let renderCounter = 0;
46
51
  const CardWrapper = enableCarousel ? CarouselWrapper : Wrapper;
52
+ let bannerIndex = 0;
53
+ const bannerProps = banner ? { ...cardProps, ...banner, type: 'banner' } : null;
47
54
 
48
55
  return (
49
56
  <CardWrapper
@@ -53,13 +60,48 @@ const CardsContainer = ({
53
60
  bannerModifier={bannerModifier}
54
61
  enableAutoScroll={enableAutoScroll}
55
62
  autoScrollTimer={autoScrollTimer}>
56
- {cardsWithBanners.map(({ baseAdunit, id, ...entityProps }, index) => {
63
+ {parsedCardsData.map((currentEntity, index) => {
64
+ const { baseAdunit, id, ...entityProps } = currentEntity;
65
+ const shouldRenderBanner = !!bannerProps && checkIfShouldRenderBanner(index, banner);
57
66
  const extraProps = parsePropsToDisplay(entityProps, propsToDisplay);
58
67
  const dynamicKey = [itemId, index].join('-');
59
- if (baseAdunit) renderCounter += 1;
60
-
61
68
  const priority = priorityLimit > 0 && index + 1 <= priorityLimit;
69
+ if (hasNewBannerSettings && shouldRenderBanner) bannerIndex += 1;
70
+ if (!hasNewBannerSettings && baseAdunit) bannerIndex += 1;
71
+ const parsedCardProps = {
72
+ key: id,
73
+ id,
74
+ enableCarousel,
75
+ graphqlEntityMap,
76
+ propsToDisplay,
77
+ parsedPropsToDisplay: extraProps,
78
+ propsToDisplayModifiers,
79
+ modifier,
80
+ style,
81
+ cardChildren,
82
+ gtmChildren,
83
+ gtmId: name,
84
+ gridModifier,
85
+ entityProps,
86
+ displayCategory,
87
+ displayThumbnail,
88
+ displayTitle,
89
+ priority,
90
+ enableOverlay,
91
+ overlayModifier,
92
+ titleOverlayModifier,
93
+ ...entityProps
94
+ };
62
95
 
96
+ if (hasNewBannerSettings)
97
+ return (
98
+ <>
99
+ <Card key={id} {...parsedCardProps} />
100
+ {shouldRenderBanner && (
101
+ <Banner key={dynamicKey} {...bannerProps} renderCounter={bannerIndex} />
102
+ )}
103
+ </>
104
+ );
63
105
  return baseAdunit ? (
64
106
  <Banner
65
107
  key={dynamicKey}
@@ -67,44 +109,21 @@ const CardsContainer = ({
67
109
  baseAdunit={baseAdunit}
68
110
  {...entityProps}
69
111
  modifier={modifier}
70
- renderCounter={renderCounter}
112
+ renderCounter={bannerIndex}
71
113
  />
72
114
  ) : (
73
- <Card
74
- key={id}
75
- id={id}
76
- enableCarousel={enableCarousel}
77
- graphqlEntityMap={graphqlEntityMap}
78
- propsToDisplay={propsToDisplay}
79
- parsedPropsToDisplay={extraProps}
80
- propsToDisplayModifiers={propsToDisplayModifiers}
81
- modifier={modifier}
82
- style={style}
83
- cardChildren={cardChildren}
84
- gtmChildren={gtmChildren}
85
- gtmId={name}
86
- gridModifier={gridModifier}
87
- entityProps={entityProps}
88
- displayCategory={displayCategory}
89
- displayThumbnail={displayThumbnail}
90
- displayTitle={displayTitle}
91
- priority={priority}
92
- enableOverlay={enableOverlay}
93
- overlayModifier={overlayModifier}
94
- titleOverlayModifier={titleOverlayModifier}
95
- {...entityProps}
96
- />
115
+ <Card key={id} {...parsedCardProps} />
97
116
  );
98
117
  })}
99
118
  </CardWrapper>
100
119
  );
101
120
  };
102
121
 
103
- CardsContainer.propTypes = {
122
+ CardContainer.propTypes = {
104
123
  cardData: PropTypes.array.isRequired,
124
+ graphqlEntityMap: PropTypes.object.isRequired,
105
125
  name: PropTypes.string,
106
126
  entity: PropTypes.string.isRequired,
107
- graphqlEntityMap: PropTypes.object.isRequired,
108
127
  gridModifier: PropTypes.string,
109
128
  gtmChildren: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
110
129
  cardChildren: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
@@ -126,7 +145,7 @@ CardsContainer.propTypes = {
126
145
  autoScrollTimer: PropTypes.number
127
146
  };
128
147
 
129
- CardsContainer.defaultProps = {
148
+ CardContainer.defaultProps = {
130
149
  gtmChildren: [],
131
150
  cardChildren: [],
132
151
  name: '',
@@ -149,4 +168,4 @@ CardsContainer.defaultProps = {
149
168
  titleOverlayModifier: ''
150
169
  };
151
170
 
152
- export default withTitle(CardsContainer);
171
+ export default withTitle(CardContainer);
@@ -13,7 +13,7 @@ const ItemDetailsSummaryContent = ({ summaryPropsWithContent }) => {
13
13
 
14
14
  return (
15
15
  <span className={modifier} key={dynamicKey}>
16
- {wrappedValue}
16
+ {key && <span className="item-details-summary-label">{key}</span>} {wrappedValue}
17
17
  </span>
18
18
  );
19
19
  });
@@ -78,7 +78,7 @@ const Image = ({
78
78
 
79
79
  return (
80
80
  <Wrapper ref={outerRef} className={wrapperClassName} modifiers={modifiers} {...otherProps}>
81
- {elementTitle && <h2 className="heading heading--section">{elementTitle}</h2>}
81
+ {elementTitle && <div className="heading heading--section">{elementTitle}</div>}
82
82
  {shouldDisplayImage && (
83
83
  <ImgWrapper {...imgWrapperProps}>
84
84
  <ImageRender
@@ -17,7 +17,6 @@ const FullRender = ({ orderedListData, omitWrappers, paginationType, ...props })
17
17
  ? { hasBanner, parent, entity, propsToDisplay, ...banner, type: BANNER }
18
18
  : null;
19
19
  let bannerIndex = 0;
20
-
21
20
  const WrapperToUse = omitWrappers ? Fragment : Wrapper;
22
21
 
23
22
  return (
@@ -1,5 +1,4 @@
1
- const checkIfShouldRenderBanner = (elementIndex, banner) => {
2
- if (!banner) return false;
1
+ const legacyCheckIfShouldRenderBanner = (elementIndex, banner) => {
3
2
  const { interval, repeat, hasBanner } = banner;
4
3
  if (!hasBanner || !interval) return false;
5
4
  const position = elementIndex + 1;
@@ -8,5 +7,27 @@ const checkIfShouldRenderBanner = (elementIndex, banner) => {
8
7
  if (repeat && repeatMatch) return true;
9
8
  return false;
10
9
  };
10
+ const checkNewBannerSettings = banner => {
11
+ if (!banner) return false;
12
+
13
+ const { repeatEvery, startingPoint, maxRepetitions } = banner;
14
+ return repeatEvery > 0 || startingPoint > 0 || maxRepetitions > 0;
15
+ };
16
+
17
+ const checkIfShouldRenderBanner = (elementIndex, banner) => {
18
+ if (!banner) return false;
19
+ if (!checkNewBannerSettings(banner)) return legacyCheckIfShouldRenderBanner(elementIndex, banner);
20
+
21
+ const { repeatEvery, startingPoint, maxRepetitions } = banner;
22
+ const position = elementIndex + 1;
23
+ if (position < startingPoint) return false;
24
+ if (position === startingPoint) return true;
25
+ const positionDifference = position - startingPoint;
26
+ if (positionDifference < repeatEvery) return false;
27
+ const timesRepeated = positionDifference / repeatEvery;
28
+ const repeatMatch = Number.isInteger(timesRepeated);
29
+ if (!repeatMatch) return false;
30
+ return timesRepeated < maxRepetitions;
31
+ };
11
32
 
12
- export default checkIfShouldRenderBanner;
33
+ export { checkIfShouldRenderBanner, checkNewBannerSettings };
@@ -1,2 +1,4 @@
1
- export { default as checkIfShouldRenderGtm } from './check-if-should-render-gtm';
2
- export { default as checkIfShouldRenderBanner } from './check-if-should-render-banner';
1
+ import { checkIfShouldRenderBanner, checkNewBannerSettings } from './check-if-should-render-banner';
2
+ import checkIfShouldRenderGtm from './check-if-should-render-gtm';
3
+
4
+ export { checkIfShouldRenderBanner, checkNewBannerSettings, checkIfShouldRenderGtm };
@@ -80,7 +80,6 @@ const SearchFilter = ({
80
80
 
81
81
  const shouldGroup = !!(groupAfterDesktop || groupAfterMobile);
82
82
  const shouldSearch = !hasUrl;
83
-
84
83
  return (
85
84
  <>
86
85
  <form
@@ -13,6 +13,7 @@ const Checkbox = ({
13
13
  updateFilterValues,
14
14
  filterValues,
15
15
  label,
16
+ elementTitle,
16
17
  shouldSearch,
17
18
  displayFilterCount
18
19
  }) => {
@@ -68,6 +69,7 @@ const Checkbox = ({
68
69
 
69
70
  return (
70
71
  <>
72
+ {elementTitle && <div className="heading heading--section">{elementTitle}</div>}
71
73
  {label ? <p>{label}</p> : ''}
72
74
  <Checkboxes
73
75
  className="form-checkbox"
@@ -109,12 +111,14 @@ Checkbox.propTypes = {
109
111
  updateFilterValues: PropTypes.func.isRequired,
110
112
  shouldSearch: PropTypes.bool,
111
113
  label: PropTypes.string,
114
+ elementTitle: PropTypes.string,
112
115
  displayFilterCount: PropTypes.bool
113
116
  };
114
117
 
115
118
  Checkbox.defaultProps = {
116
119
  shouldSearch: false,
117
120
  label: '',
121
+ elementTitle: '',
118
122
  displayFilterCount: false
119
123
  };
120
124