@usereactify/search 5.0.0-beta.10 → 5.0.0-beta.11

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 (42) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/package.json +1 -1
  3. package/dist/src/components/Example/ExampleFilterList.js +1 -1
  4. package/dist/src/components/Example/ExampleFilterList.js.map +1 -1
  5. package/dist/src/components/Example/ExampleFilterRange.js +1 -1
  6. package/dist/src/components/Example/ExampleFilterRange.js.map +1 -1
  7. package/dist/src/components/Example/ExampleFilterSlider.js +1 -1
  8. package/dist/src/components/Example/ExampleFilterSlider.js.map +1 -1
  9. package/dist/src/components/Example/ExampleResultCardCallout.js +1 -1
  10. package/dist/src/components/Example/ExampleResultCardCallout.js.map +1 -1
  11. package/dist/src/components/Example/ExampleResultCardProduct.js +1 -1
  12. package/dist/src/components/Example/ExampleResultCardProduct.js.map +1 -1
  13. package/dist/src/components/Filter/Filter.js +7 -19
  14. package/dist/src/components/Filter/Filter.js.map +1 -1
  15. package/dist/src/components/ReactifySearchBase/ReactifySearchBase.js +12 -9
  16. package/dist/src/components/ReactifySearchBase/ReactifySearchBase.js.map +1 -1
  17. package/dist/src/components/Result/ResultStack.js +2 -2
  18. package/dist/src/components/Result/ResultStack.js.map +1 -1
  19. package/dist/src/hooks/reactivesearch/index.d.ts +3 -3
  20. package/dist/src/hooks/reactivesearch/index.js +3 -3
  21. package/dist/src/hooks/reactivesearch/index.js.map +1 -1
  22. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js +2 -1
  23. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js.map +1 -1
  24. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.d.ts +1 -1
  25. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js +2 -1
  26. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js.map +1 -1
  27. package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js +2 -1
  28. package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js.map +1 -1
  29. package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js +2 -1
  30. package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js.map +1 -1
  31. package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js +2 -1
  32. package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js.map +1 -1
  33. package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js +2 -1
  34. package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js.map +1 -1
  35. package/dist/src/hooks/reactivesearch/useReactiveReactiveListProps.d.ts +5 -0
  36. package/dist/src/hooks/reactivesearch/{useReactiveResultStackProps.js → useReactiveReactiveListProps.js} +6 -5
  37. package/dist/src/hooks/reactivesearch/useReactiveReactiveListProps.js.map +1 -0
  38. package/dist/src/hooks/useFilterListProps.js +36 -9
  39. package/dist/src/hooks/useFilterListProps.js.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/src/hooks/reactivesearch/useReactiveResultStackProps.d.ts +0 -17
  42. package/dist/src/hooks/reactivesearch/useReactiveResultStackProps.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,8 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [5.0.0-beta.11](https://bitbucket.org/usereactify/reactify-search-ui/compare/v5.0.0-beta.10...v5.0.0-beta.11) (2022-07-27)
6
+
5
7
  ## [5.0.0-beta.10](https://bitbucket.org/usereactify/reactify-search-ui/compare/v5.0.0-beta.9...v5.0.0-beta.10) (2022-07-27)
6
8
 
9
+
10
+ ### Features
11
+
12
+ * improve classnames ([19fcfa1](https://bitbucket.org/usereactify/reactify-search-ui/commit/19fcfa152c555cb2e78ec62371f1758e2d244557))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * check that window is defined before accessing ([e1ec0aa](https://bitbucket.org/usereactify/reactify-search-ui/commit/e1ec0aae22cab7eb86363ed09d47e422d08ff5c1))
18
+
7
19
  ## [5.0.0-beta.9](https://bitbucket.org/usereactify/reactify-search-ui/compare/v5.0.0-beta.8...v5.0.0-beta.9) (2022-07-27)
8
20
 
9
21
 
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.0.0-beta.9",
4
+ "version": "5.0.0-beta.11",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ExampleFilterList = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const ExampleFilterList = (props) => {
9
- return (react_1.default.createElement(react_1.default.Fragment, null,
9
+ return (react_1.default.createElement("div", { className: "rs__filter" },
10
10
  react_1.default.createElement("h3", { className: "rs__filter__name" }, props.filter.name),
11
11
  react_1.default.createElement("ul", { className: "rs__filter__list" }, props.filterListProps.options.map((option) => (react_1.default.createElement("li", { key: option.key, className: "rs__filter__list-item" },
12
12
  react_1.default.createElement("label", { className: "rs__filter__list-item-label" },
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleFilterList.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterList.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,iBAAiB,GAAqC,CAAC,KAAK,EAAE,EAAE;IAC3E,OAAO,CACL;QACE,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;QACzD,sCAAI,SAAS,EAAC,kBAAkB,IAC7B,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC7C,sCAAI,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,SAAS,EAAC,uBAAuB;YACpD,yCAAO,SAAS,EAAC,6BAA6B;gBAC5C,yCACE,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,MAAM,CAAC,GAAG,EACjB,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAClC,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,KAAK,CAAC,GAE3C;gBACF,wCAAM,SAAS,EAAC,2BAA2B,IAAE,MAAM,CAAC,GAAG,CAAQ;gBAC/D,wCAAM,SAAS,EAAC,6BAA6B;;oBACzC,MAAM,CAAC,SAAS;wBACb,CACD,CACL,CACN,CAAC,CACC,CACJ,CACJ,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,iBAAiB,qBA2B5B","sourcesContent":["import React from \"react\";\n\nimport { FilterProps } from \"../../components\";\n\nexport type ExampleFilterListProps = React.ComponentProps<\n NonNullable<FilterProps[\"renderFilterList\"]>\n>;\n\nexport const ExampleFilterList: React.FC<ExampleFilterListProps> = (props) => {\n return (\n <>\n <h3 className=\"rs__filter__name\">{props.filter.name}</h3>\n <ul className=\"rs__filter__list\">\n {props.filterListProps.options.map((option) => (\n <li key={option.key} className=\"rs__filter__list-item\">\n <label className=\"rs__filter__list-item-label\">\n <input\n className=\"rs__filter__list-item-input\"\n value={option.key}\n type=\"checkbox\"\n checked={option.checked}\n onChange={({ target: { value } }) =>\n props.filterListProps.handleChange(value)\n }\n />\n <span className=\"rs__filter__list-item-key\">{option.key}</span>\n <span className=\"rs__filter__list-item-count\">\n ({option.doc_count})\n </span>\n </label>\n </li>\n ))}\n </ul>\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"ExampleFilterList.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterList.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,iBAAiB,GAAqC,CAAC,KAAK,EAAE,EAAE;IAC3E,OAAO,CACL,uCAAK,SAAS,EAAC,YAAY;QACzB,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;QACzD,sCAAI,SAAS,EAAC,kBAAkB,IAC7B,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC7C,sCAAI,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,SAAS,EAAC,uBAAuB;YACpD,yCAAO,SAAS,EAAC,6BAA6B;gBAC5C,yCACE,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,MAAM,CAAC,GAAG,EACjB,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAClC,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,KAAK,CAAC,GAE3C;gBACF,wCAAM,SAAS,EAAC,2BAA2B,IAAE,MAAM,CAAC,GAAG,CAAQ;gBAC/D,wCAAM,SAAS,EAAC,6BAA6B;;oBACzC,MAAM,CAAC,SAAS;wBACb,CACD,CACL,CACN,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,iBAAiB,qBA2B5B","sourcesContent":["import React from \"react\";\n\nimport { FilterProps } from \"../../components\";\n\nexport type ExampleFilterListProps = React.ComponentProps<\n NonNullable<FilterProps[\"renderFilterList\"]>\n>;\n\nexport const ExampleFilterList: React.FC<ExampleFilterListProps> = (props) => {\n return (\n <div className=\"rs__filter\">\n <h3 className=\"rs__filter__name\">{props.filter.name}</h3>\n <ul className=\"rs__filter__list\">\n {props.filterListProps.options.map((option) => (\n <li key={option.key} className=\"rs__filter__list-item\">\n <label className=\"rs__filter__list-item-label\">\n <input\n className=\"rs__filter__list-item-input\"\n value={option.key}\n type=\"checkbox\"\n checked={option.checked}\n onChange={({ target: { value } }) =>\n props.filterListProps.handleChange(value)\n }\n />\n <span className=\"rs__filter__list-item-key\">{option.key}</span>\n <span className=\"rs__filter__list-item-count\">\n ({option.doc_count})\n </span>\n </label>\n </li>\n ))}\n </ul>\n </div>\n );\n};\n"]}
@@ -8,7 +8,7 @@ const react_1 = __importDefault(require("react"));
8
8
  const SingleRange_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/range/SingleRange"));
9
9
  const ExampleFilterRange = (props) => {
10
10
  if (props.filter.handle === "price") {
11
- return (react_1.default.createElement(react_1.default.Fragment, null,
11
+ return (react_1.default.createElement("div", { className: "rs__filter" },
12
12
  react_1.default.createElement("h3", { className: "rs__filter__name" }, props.filter.name),
13
13
  react_1.default.createElement(SingleRange_1.default, Object.assign({ data: [
14
14
  { start: "0", label: "All prices" },
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleFilterRange.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterRange.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6GAAqF;AAQ9E,MAAM,kBAAkB,GAAsC,CACnE,KAAK,EACL,EAAE;IACF,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE;QACnC,OAAO,CACL;YACE,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;YACzD,8BAAC,qBAAW,kBACV,IAAI,EAAE;oBACJ,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE;oBACnC,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE;oBAC9C,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE;iBAC9C,IACG,KAAK,CAAC,wBAAwB,EAClC,CACD,CACJ,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AApBW,QAAA,kBAAkB,sBAoB7B","sourcesContent":["import React from \"react\";\nimport SingleRange from \"@appbaseio/reactivesearch/lib/components/range/SingleRange\";\n\nimport { FilterProps } from \"../../components\";\n\nexport type ExampleFilterRangeProps = React.ComponentProps<\n NonNullable<FilterProps[\"renderFilterRange\"]>\n>;\n\nexport const ExampleFilterRange: React.FC<ExampleFilterRangeProps> = (\n props\n) => {\n if (props.filter.handle === \"price\") {\n return (\n <>\n <h3 className=\"rs__filter__name\">{props.filter.name}</h3>\n <SingleRange\n data={[\n { start: \"0\", label: \"All prices\" },\n { start: \"0\", end: \"99\", label: \"Under $100\" },\n { start: \"0\", end: \"49\", label: \"Under $50\" },\n ]}\n {...props.reactiveFilterRangeProps}\n />\n </>\n );\n }\n\n return null;\n};\n"]}
1
+ {"version":3,"file":"ExampleFilterRange.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterRange.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6GAAqF;AAQ9E,MAAM,kBAAkB,GAAsC,CACnE,KAAK,EACL,EAAE;IACF,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE;QACnC,OAAO,CACL,uCAAK,SAAS,EAAC,YAAY;YACzB,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;YACzD,8BAAC,qBAAW,kBACV,IAAI,EAAE;oBACJ,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE;oBACnC,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE;oBAC9C,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE;iBAC9C,IACG,KAAK,CAAC,wBAAwB,EAClC,CACE,CACP,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AApBW,QAAA,kBAAkB,sBAoB7B","sourcesContent":["import React from \"react\";\nimport SingleRange from \"@appbaseio/reactivesearch/lib/components/range/SingleRange\";\n\nimport { FilterProps } from \"../../components\";\n\nexport type ExampleFilterRangeProps = React.ComponentProps<\n NonNullable<FilterProps[\"renderFilterRange\"]>\n>;\n\nexport const ExampleFilterRange: React.FC<ExampleFilterRangeProps> = (\n props\n) => {\n if (props.filter.handle === \"price\") {\n return (\n <div className=\"rs__filter\">\n <h3 className=\"rs__filter__name\">{props.filter.name}</h3>\n <SingleRange\n data={[\n { start: \"0\", label: \"All prices\" },\n { start: \"0\", end: \"99\", label: \"Under $100\" },\n { start: \"0\", end: \"49\", label: \"Under $50\" },\n ]}\n {...props.reactiveFilterRangeProps}\n />\n </div>\n );\n }\n\n return null;\n};\n"]}
@@ -8,7 +8,7 @@ const react_1 = __importDefault(require("react"));
8
8
  const reactivesearch_1 = require("@appbaseio/reactivesearch");
9
9
  const ExampleFilterSlider = (props) => {
10
10
  if (props.filter.handle === "price") {
11
- return (react_1.default.createElement(react_1.default.Fragment, null,
11
+ return (react_1.default.createElement("div", { className: "rs__filter" },
12
12
  react_1.default.createElement("h3", { className: "rs__filter__name" }, props.filter.name),
13
13
  react_1.default.createElement(reactivesearch_1.RangeSlider, Object.assign({ range: {
14
14
  start: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleFilterSlider.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterSlider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,8DAAwD;AAQjD,MAAM,mBAAmB,GAAuC,CACrE,KAAK,EACL,EAAE;IACF,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE;QACnC,OAAO,CACL;YACE,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;YACzD,8BAAC,4BAAW,kBACV,KAAK,EAAE;oBACL,KAAK,EAAE,CAAC;oBACR,GAAG,EAAE,GAAG;iBACT,IACG,KAAK,CAAC,yBAAyB,EACnC,CACD,CACJ,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAnBW,QAAA,mBAAmB,uBAmB9B","sourcesContent":["import React from \"react\";\nimport { RangeSlider } from \"@appbaseio/reactivesearch\";\n\nimport { FilterProps } from \"../../components\";\n\nexport type ExampleFilterSliderProps = React.ComponentProps<\n NonNullable<FilterProps[\"renderFilterSlider\"]>\n>;\n\nexport const ExampleFilterSlider: React.FC<ExampleFilterSliderProps> = (\n props\n) => {\n if (props.filter.handle === \"price\") {\n return (\n <>\n <h3 className=\"rs__filter__name\">{props.filter.name}</h3>\n <RangeSlider\n range={{\n start: 0,\n end: 500,\n }}\n {...props.reactiveFilterSliderProps}\n />\n </>\n );\n }\n\n return null;\n};\n"]}
1
+ {"version":3,"file":"ExampleFilterSlider.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterSlider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,8DAAwD;AAQjD,MAAM,mBAAmB,GAAuC,CACrE,KAAK,EACL,EAAE;IACF,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,OAAO,EAAE;QACnC,OAAO,CACL,uCAAK,SAAS,EAAC,YAAY;YACzB,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;YACzD,8BAAC,4BAAW,kBACV,KAAK,EAAE;oBACL,KAAK,EAAE,CAAC;oBACR,GAAG,EAAE,GAAG;iBACT,IACG,KAAK,CAAC,yBAAyB,EACnC,CACE,CACP,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAnBW,QAAA,mBAAmB,uBAmB9B","sourcesContent":["import React from \"react\";\nimport { RangeSlider } from \"@appbaseio/reactivesearch\";\n\nimport { FilterProps } from \"../../components\";\n\nexport type ExampleFilterSliderProps = React.ComponentProps<\n NonNullable<FilterProps[\"renderFilterSlider\"]>\n>;\n\nexport const ExampleFilterSlider: React.FC<ExampleFilterSliderProps> = (\n props\n) => {\n if (props.filter.handle === \"price\") {\n return (\n <div className=\"rs__filter\">\n <h3 className=\"rs__filter__name\">{props.filter.name}</h3>\n <RangeSlider\n range={{\n start: 0,\n end: 500,\n }}\n {...props.reactiveFilterSliderProps}\n />\n </div>\n );\n }\n\n return null;\n};\n"]}
@@ -13,7 +13,7 @@ const ExampleResultCardCallout = (props) => {
13
13
  gridColumn: `span ${(_b = props.callout.displayColumns) !== null && _b !== void 0 ? _b : 1}`,
14
14
  });
15
15
  }, [props.callout]);
16
- return (react_1.default.createElement("div", { className: "rs__result-card-callout__wrapper", ref: props.itemRef, style: styleProp },
16
+ return (react_1.default.createElement("div", { className: "rs__result-card-callout", ref: props.itemRef, style: styleProp },
17
17
  react_1.default.createElement("a", { className: "rs__result-card-callout__link", href: props.callout.link, onClick: props.handleClick },
18
18
  props.callout.desktopImage && (react_1.default.createElement("img", { className: "rs__result-card-callout__image", src: props.callout.desktopImage, width: "100%" })),
19
19
  react_1.default.createElement("span", { className: "rs__result-card-callout__title" }, props.callout.title))));
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleResultCardCallout.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleResultCardCallout.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,wBAAwB,GACnC,CAAC,KAAK,EAAE,EAAE;IACR,MAAM,SAAS,GAAG,eAAK,CAAC,OAAO,CAC7B,GAAG,EAAE;;QAAC,OAAA,CAAC;YACL,OAAO,EAAE,QAAQ,MAAA,KAAK,CAAC,OAAO,CAAC,WAAW,mCAAI,CAAC,EAAE;YACjD,UAAU,EAAE,QAAQ,MAAA,KAAK,CAAC,OAAO,CAAC,cAAc,mCAAI,CAAC,EAAE;SACxD,CAAC,CAAA;KAAA,EACF,CAAC,KAAK,CAAC,OAAO,CAAC,CAChB,CAAC;IAEF,OAAO,CACL,uCACE,SAAS,EAAC,kCAAkC,EAC5C,GAAG,EAAE,KAAK,CAAC,OAAO,EAClB,KAAK,EAAE,SAAS;QAEhB,qCACE,SAAS,EAAC,+BAA+B,EACzC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,EACxB,OAAO,EAAE,KAAK,CAAC,WAAW;YAEzB,KAAK,CAAC,OAAO,CAAC,YAAY,IAAI,CAC7B,uCACE,SAAS,EAAC,gCAAgC,EAC1C,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY,EAC/B,KAAK,EAAC,MAAM,GACZ,CACH;YACD,wCAAM,SAAS,EAAC,gCAAgC,IAC7C,KAAK,CAAC,OAAO,CAAC,KAAK,CACf,CACL,CACA,CACP,CAAC;AACJ,CAAC,CAAC;AAlCS,QAAA,wBAAwB,4BAkCjC","sourcesContent":["import React from \"react\";\n\nimport { ResultCardCalloutProps } from \"../../components\";\n\nexport type ExampleResultCardCalloutProps = React.ComponentProps<\n NonNullable<ResultCardCalloutProps[\"render\"]>\n>;\n\nexport const ExampleResultCardCallout: React.FC<ExampleResultCardCalloutProps> =\n (props) => {\n const styleProp = React.useMemo<React.HTMLAttributes<HTMLElement>[\"style\"]>(\n () => ({\n gridRow: `span ${props.callout.displayRows ?? 1}`,\n gridColumn: `span ${props.callout.displayColumns ?? 1}`,\n }),\n [props.callout]\n );\n\n return (\n <div\n className=\"rs__result-card-callout__wrapper\"\n ref={props.itemRef}\n style={styleProp}\n >\n <a\n className=\"rs__result-card-callout__link\"\n href={props.callout.link}\n onClick={props.handleClick}\n >\n {props.callout.desktopImage && (\n <img\n className=\"rs__result-card-callout__image\"\n src={props.callout.desktopImage}\n width=\"100%\"\n />\n )}\n <span className=\"rs__result-card-callout__title\">\n {props.callout.title}\n </span>\n </a>\n </div>\n );\n };\n"]}
1
+ {"version":3,"file":"ExampleResultCardCallout.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleResultCardCallout.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,wBAAwB,GACnC,CAAC,KAAK,EAAE,EAAE;IACR,MAAM,SAAS,GAAG,eAAK,CAAC,OAAO,CAC7B,GAAG,EAAE;;QAAC,OAAA,CAAC;YACL,OAAO,EAAE,QAAQ,MAAA,KAAK,CAAC,OAAO,CAAC,WAAW,mCAAI,CAAC,EAAE;YACjD,UAAU,EAAE,QAAQ,MAAA,KAAK,CAAC,OAAO,CAAC,cAAc,mCAAI,CAAC,EAAE;SACxD,CAAC,CAAA;KAAA,EACF,CAAC,KAAK,CAAC,OAAO,CAAC,CAChB,CAAC;IAEF,OAAO,CACL,uCACE,SAAS,EAAC,yBAAyB,EACnC,GAAG,EAAE,KAAK,CAAC,OAAO,EAClB,KAAK,EAAE,SAAS;QAEhB,qCACE,SAAS,EAAC,+BAA+B,EACzC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,EACxB,OAAO,EAAE,KAAK,CAAC,WAAW;YAEzB,KAAK,CAAC,OAAO,CAAC,YAAY,IAAI,CAC7B,uCACE,SAAS,EAAC,gCAAgC,EAC1C,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY,EAC/B,KAAK,EAAC,MAAM,GACZ,CACH;YACD,wCAAM,SAAS,EAAC,gCAAgC,IAC7C,KAAK,CAAC,OAAO,CAAC,KAAK,CACf,CACL,CACA,CACP,CAAC;AACJ,CAAC,CAAC;AAlCS,QAAA,wBAAwB,4BAkCjC","sourcesContent":["import React from \"react\";\n\nimport { ResultCardCalloutProps } from \"../../components\";\n\nexport type ExampleResultCardCalloutProps = React.ComponentProps<\n NonNullable<ResultCardCalloutProps[\"render\"]>\n>;\n\nexport const ExampleResultCardCallout: React.FC<ExampleResultCardCalloutProps> =\n (props) => {\n const styleProp = React.useMemo<React.HTMLAttributes<HTMLElement>[\"style\"]>(\n () => ({\n gridRow: `span ${props.callout.displayRows ?? 1}`,\n gridColumn: `span ${props.callout.displayColumns ?? 1}`,\n }),\n [props.callout]\n );\n\n return (\n <div\n className=\"rs__result-card-callout\"\n ref={props.itemRef}\n style={styleProp}\n >\n <a\n className=\"rs__result-card-callout__link\"\n href={props.callout.link}\n onClick={props.handleClick}\n >\n {props.callout.desktopImage && (\n <img\n className=\"rs__result-card-callout__image\"\n src={props.callout.desktopImage}\n width=\"100%\"\n />\n )}\n <span className=\"rs__result-card-callout__title\">\n {props.callout.title}\n </span>\n </a>\n </div>\n );\n };\n"]}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ExampleResultCardProduct = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const ExampleResultCardProduct = (props) => {
9
- return (react_1.default.createElement("div", { ref: props.itemRef, className: "rs__result-card-product__wrapper" },
9
+ return (react_1.default.createElement("div", { ref: props.itemRef, className: "rs__result-card-product" },
10
10
  react_1.default.createElement("a", { className: "rs__result-card-product__link", onClick: props.handleClick, href: `/products/${props.product.handle}` },
11
11
  props.product.image && (react_1.default.createElement("img", { className: "rs__result-card-product__image", src: props.product.image, width: "100%" })),
12
12
  react_1.default.createElement("span", { className: "rs__result-card-product__title" }, props.product.title)),
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleResultCardProduct.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleResultCardProduct.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,wBAAwB,GACnC,CAAC,KAAK,EAAE,EAAE;IACR,OAAO,CACL,uCAAK,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAC,kCAAkC;QACnE,qCACE,SAAS,EAAC,+BAA+B,EACzC,OAAO,EAAE,KAAK,CAAC,WAAW,EAC1B,IAAI,EAAE,aAAa,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE;YAExC,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CACtB,uCACE,SAAS,EAAC,gCAAgC,EAC1C,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,EACxB,KAAK,EAAC,MAAM,GACZ,CACH;YACD,wCAAM,SAAS,EAAC,gCAAgC,IAC7C,KAAK,CAAC,OAAO,CAAC,KAAK,CACf,CACL;QACJ,wCAAM,SAAS,EAAC,gCAAgC,IAC7C,KAAK,CAAC,cAAc,CAChB;QACN,KAAK,CAAC,MAAM,IAAI,CACf,wCACE,SAAS,EAAC,qCAAqC,EAC/C,KAAK,EAAE;gBACL,cAAc,EAAE,cAAc;aAC/B,IAEA,KAAK,CAAC,uBAAuB,CACzB,CACR,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAnCS,QAAA,wBAAwB,4BAmCjC","sourcesContent":["import React from \"react\";\n\nimport { ResultCardProductProps } from \"../../components\";\n\nexport type ExampleResultCardProductProps = React.ComponentProps<\n NonNullable<ResultCardProductProps[\"render\"]>\n>;\n\nexport const ExampleResultCardProduct: React.FC<ExampleResultCardProductProps> =\n (props) => {\n return (\n <div ref={props.itemRef} className=\"rs__result-card-product__wrapper\">\n <a\n className=\"rs__result-card-product__link\"\n onClick={props.handleClick}\n href={`/products/${props.product.handle}`}\n >\n {props.product.image && (\n <img\n className=\"rs__result-card-product__image\"\n src={props.product.image}\n width=\"100%\"\n />\n )}\n <span className=\"rs__result-card-product__title\">\n {props.product.title}\n </span>\n </a>\n <span className=\"rs__result-card-product__price\">\n {props.formattedPrice}\n </span>\n {props.onSale && (\n <span\n className=\"rs__result-card-product__price-sale\"\n style={{\n textDecoration: \"line-through\",\n }}\n >\n {props.formattedCompareAtPrice}\n </span>\n )}\n </div>\n );\n };\n"]}
1
+ {"version":3,"file":"ExampleResultCardProduct.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleResultCardProduct.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,wBAAwB,GACnC,CAAC,KAAK,EAAE,EAAE;IACR,OAAO,CACL,uCAAK,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAC,yBAAyB;QAC1D,qCACE,SAAS,EAAC,+BAA+B,EACzC,OAAO,EAAE,KAAK,CAAC,WAAW,EAC1B,IAAI,EAAE,aAAa,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE;YAExC,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CACtB,uCACE,SAAS,EAAC,gCAAgC,EAC1C,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,EACxB,KAAK,EAAC,MAAM,GACZ,CACH;YACD,wCAAM,SAAS,EAAC,gCAAgC,IAC7C,KAAK,CAAC,OAAO,CAAC,KAAK,CACf,CACL;QACJ,wCAAM,SAAS,EAAC,gCAAgC,IAC7C,KAAK,CAAC,cAAc,CAChB;QACN,KAAK,CAAC,MAAM,IAAI,CACf,wCACE,SAAS,EAAC,qCAAqC,EAC/C,KAAK,EAAE;gBACL,cAAc,EAAE,cAAc;aAC/B,IAEA,KAAK,CAAC,uBAAuB,CACzB,CACR,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAnCS,QAAA,wBAAwB,4BAmCjC","sourcesContent":["import React from \"react\";\n\nimport { ResultCardProductProps } from \"../../components\";\n\nexport type ExampleResultCardProductProps = React.ComponentProps<\n NonNullable<ResultCardProductProps[\"render\"]>\n>;\n\nexport const ExampleResultCardProduct: React.FC<ExampleResultCardProductProps> =\n (props) => {\n return (\n <div ref={props.itemRef} className=\"rs__result-card-product\">\n <a\n className=\"rs__result-card-product__link\"\n onClick={props.handleClick}\n href={`/products/${props.product.handle}`}\n >\n {props.product.image && (\n <img\n className=\"rs__result-card-product__image\"\n src={props.product.image}\n width=\"100%\"\n />\n )}\n <span className=\"rs__result-card-product__title\">\n {props.product.title}\n </span>\n </a>\n <span className=\"rs__result-card-product__price\">\n {props.formattedPrice}\n </span>\n {props.onSale && (\n <span\n className=\"rs__result-card-product__price-sale\"\n style={{\n textDecoration: \"line-through\",\n }}\n >\n {props.formattedCompareAtPrice}\n </span>\n )}\n </div>\n );\n };\n"]}
@@ -22,16 +22,16 @@ const hooks_1 = require("../../hooks");
22
22
  const components_1 = require("../../components");
23
23
  const Filter = (props) => {
24
24
  if ("single" === props.filter.displayType) {
25
- return (react_1.default.createElement(FilterSingleList, Object.assign({}, props)));
25
+ return react_1.default.createElement(FilterSingleList, Object.assign({}, props));
26
26
  }
27
27
  if ("multi" === props.filter.displayType) {
28
- return (react_1.default.createElement(FilterMultiList, Object.assign({}, props)));
28
+ return react_1.default.createElement(FilterMultiList, Object.assign({}, props));
29
29
  }
30
30
  if ("range" === props.filter.displayType) {
31
- return (react_1.default.createElement(FilterRange, Object.assign({}, props)));
31
+ return react_1.default.createElement(FilterRange, Object.assign({}, props));
32
32
  }
33
33
  if ("slider" === props.filter.displayType) {
34
- return (react_1.default.createElement(FilterSlider, Object.assign({}, props)));
34
+ return react_1.default.createElement(FilterSlider, Object.assign({}, props));
35
35
  }
36
36
  console.log(`filter with display type "${props.filter.displayType}" not yet supported`);
37
37
  return null;
@@ -64,27 +64,15 @@ const FilterSlider = (props) => {
64
64
  // inner component exists only so we can use memos in reactivesearch render functions
65
65
  const FilterListInner = (props) => {
66
66
  const { filter, renderFilterList, reactivesearchFilterProps } = props, otherProps = __rest(props, ["filter", "renderFilterList", "reactivesearchFilterProps"]);
67
- const { track } = (0, hooks_1.useAnalytics)();
68
- const _a = (0, hooks_1.useFilterListProps)(filter, reactivesearchFilterProps), { handleChange } = _a, filterListProps = __rest(_a, ["handleChange"]);
69
- const handleFilterChange = react_1.default.useCallback((value) => {
70
- handleChange(value);
71
- track({
72
- eventName: "filterChange",
73
- payload: {
74
- name: filter.name,
75
- value: value,
76
- },
77
- });
78
- }, [filterListProps]);
79
- const updatedFilterListProps = Object.assign(Object.assign({}, filterListProps), { handleChange: handleFilterChange });
67
+ const filterListProps = (0, hooks_1.useFilterListProps)(filter, reactivesearchFilterProps);
80
68
  // hide entire filter when no options available
81
69
  if (0 === filterListProps.options.length) {
82
70
  return null;
83
71
  }
84
72
  if (renderFilterList) {
85
73
  const Component = renderFilterList;
86
- return (react_1.default.createElement(Component, Object.assign({ filterListProps: updatedFilterListProps, filter: filter }, otherProps)));
74
+ return (react_1.default.createElement(Component, Object.assign({ filterListProps: filterListProps, filter: filter }, otherProps)));
87
75
  }
88
- return (react_1.default.createElement(components_1.ExampleFilterList, Object.assign({ filterListProps: updatedFilterListProps, filter: filter }, otherProps)));
76
+ return (react_1.default.createElement(components_1.ExampleFilterList, Object.assign({ filterListProps: filterListProps, filter: filter }, otherProps)));
89
77
  };
90
78
  //# sourceMappingURL=Filter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,wGAAgF;AAChF,0GAAkF;AAGlF,uCAAsJ;AACtJ,iDAAqD;AAoB9C,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;IACrD,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACzC,OAAO,CACL,8BAAC,gBAAgB,oBAAK,KAAK,EAAI,CAChC,CAAA;KACF;IAED,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACxC,OAAO,CACL,8BAAC,eAAe,oBAAK,KAAK,EAAI,CAC/B,CAAA;KACF;IAED,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACxC,OAAO,CACL,8BAAC,WAAW,oBAAK,KAAK,EAAI,CAC3B,CAAA;KACF;IAED,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACzC,OAAO,CACL,8BAAC,YAAY,oBAAK,KAAK,EAAI,CAC5B,CAAA;KACF;IAED,OAAO,CAAC,GAAG,CACT,6BAA6B,KAAK,CAAC,MAAM,CAAC,WAAW,qBAAqB,CAC3E,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA9BW,QAAA,MAAM,UA8BjB;AAEF,MAAM,gBAAgB,GAA0B,CAAC,KAAK,EAAE,EAAE;IACxD,MAAM,uBAAuB,GAAG,I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\"@appbaseio/reactivesearch/lib/components/list/MultiList\";\nimport SingleList from \"@appbaseio/reactivesearch/lib/components/list/SingleList\";\n\nimport type { ConfigFilterOption, ReactivesearchFilterProps } from \"../../types\";\nimport { useAnalytics, useFilterListProps, useReactiveFilterListProps, useReactiveFilterRangeProps, useReactiveFilterSliderProps } from \"../../hooks\";\nimport { ExampleFilterList } from \"../../components\";\n\n\nexport type FilterProps = {\n /** The filter option being rendered */\n filter: ConfigFilterOption;\n /** Render method for List filters */\n renderFilterList?: React.FC<Omit<FilterProps, \"renderFilterList\"> & {\n filterListProps: ReturnType<typeof useFilterListProps>;\n }>;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<Omit<FilterProps, \"renderFilterRange\"> & {\n reactiveFilterRangeProps: ReturnType<typeof useReactiveFilterRangeProps>;\n }>;\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<Omit<FilterProps, \"renderFilterSlider\"> & {\n reactiveFilterSliderProps: ReturnType<typeof useReactiveFilterSliderProps>;\n }>;\n};\n\nexport const Filter: React.FC<FilterProps> = (props) => {\n if (\"single\" === props.filter.displayType) {\n return (\n <FilterSingleList {...props} />\n )\n }\n\n if (\"multi\" === props.filter.displayType) {\n return (\n <FilterMultiList {...props} />\n )\n }\n\n if (\"range\" === props.filter.displayType) {\n return (\n <FilterRange {...props} />\n )\n }\n\n if (\"slider\" === props.filter.displayType) {\n return (\n <FilterSlider {...props} />\n )\n }\n\n console.log(\n `filter with display type \"${props.filter.displayType}\" not yet supported`\n );\n\n return null;\n};\n\nconst FilterSingleList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <SingleList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n}\n\nconst FilterMultiList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <MultiList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n}\n\nconst FilterRange: React.FC<FilterProps> = (props) => {\n const reactiveFilterRangeProps = useReactiveFilterRangeProps(props.filter);\n\n if (props.renderFilterRange) {\n const Component = props.renderFilterRange;\n\n return (\n <Component\n {...props}\n reactiveFilterRangeProps={reactiveFilterRangeProps}\n />\n )\n }\n \n return null;\n}\n\nconst FilterSlider: React.FC<FilterProps> = (props) => {\n const reactiveFilterSliderProps = useReactiveFilterSliderProps(props.filter);\n\n if (props.renderFilterSlider) {\n const Component = props.renderFilterSlider;\n\n return (\n <Component\n {...props}\n reactiveFilterSliderProps={reactiveFilterSliderProps}\n />\n )\n }\n\n return null;\n}\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterListInner: React.FC<\n FilterProps & { reactivesearchFilterProps: ReactivesearchFilterProps }\n> = (props) => {\n const {\n filter,\n renderFilterList,\n reactivesearchFilterProps,\n ...otherProps\n } = props;\n\n const { track } = useAnalytics();\n\n const { handleChange, ...filterListProps } = useFilterListProps(\n filter,\n reactivesearchFilterProps\n );\n\n const handleFilterChange = React.useCallback(\n (value: string) => {\n handleChange(value);\n track({\n eventName: \"filterChange\",\n payload: {\n name: filter.name,\n value: value,\n },\n });\n },\n [filterListProps]\n );\n\n const updatedFilterListProps = {\n ...filterListProps,\n handleChange: handleFilterChange,\n };\n\n // hide entire filter when no options available\n if (0 === filterListProps.options.length) {\n return null;\n }\n\n if (renderFilterList) {\n const Component = renderFilterList;\n return (\n <Component\n filterListProps={updatedFilterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n }\n\n return (\n <ExampleFilterList\n filterListProps={updatedFilterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filter.tsx"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C,MAAM,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,IAAI,gBAAgB,EAAE;QACpB,MAAM,SAAS,GAAG,gBAAgB,CAAC;QACnC,OAAO,CACL,8BAAC,SAAS,kBACR,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;KACH;IAED,OAAO,CACL,8BAAC,8BAAiB,kBAChB,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport MultiList from \"@appbaseio/reactivesearch/lib/components/list/MultiList\";\nimport SingleList from \"@appbaseio/reactivesearch/lib/components/list/SingleList\";\n\nimport type {\n ConfigFilterOption,\n ReactivesearchFilterProps,\n} from \"../../types\";\nimport {\n useAnalytics,\n useFilterListProps,\n useReactiveFilterListProps,\n useReactiveFilterRangeProps,\n useReactiveFilterSliderProps,\n} from \"../../hooks\";\nimport { ExampleFilterList } from \"../../components\";\nimport { debug } from \"../../utility\";\n\nexport type FilterProps = {\n /** The filter option being rendered */\n filter: ConfigFilterOption;\n /** Render method for List filters */\n renderFilterList?: React.FC<\n Omit<FilterProps, \"renderFilterList\"> & {\n filterListProps: ReturnType<typeof useFilterListProps>;\n }\n >;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<\n Omit<FilterProps, \"renderFilterRange\"> & {\n reactiveFilterRangeProps: ReturnType<typeof useReactiveFilterRangeProps>;\n }\n >;\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<\n Omit<FilterProps, \"renderFilterSlider\"> & {\n reactiveFilterSliderProps: ReturnType<\n typeof useReactiveFilterSliderProps\n >;\n }\n >;\n};\n\nexport const Filter: React.FC<FilterProps> = (props) => {\n if (\"single\" === props.filter.displayType) {\n return <FilterSingleList {...props} />;\n }\n\n if (\"multi\" === props.filter.displayType) {\n return <FilterMultiList {...props} />;\n }\n\n if (\"range\" === props.filter.displayType) {\n return <FilterRange {...props} />;\n }\n\n if (\"slider\" === props.filter.displayType) {\n return <FilterSlider {...props} />;\n }\n\n console.log(\n `filter with display type \"${props.filter.displayType}\" not yet supported`\n );\n\n return null;\n};\n\nconst FilterSingleList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <SingleList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterMultiList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <MultiList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterRange: React.FC<FilterProps> = (props) => {\n const reactiveFilterRangeProps = useReactiveFilterRangeProps(props.filter);\n\n if (props.renderFilterRange) {\n const Component = props.renderFilterRange;\n\n return (\n <Component\n {...props}\n reactiveFilterRangeProps={reactiveFilterRangeProps}\n />\n );\n }\n\n return null;\n};\n\nconst FilterSlider: React.FC<FilterProps> = (props) => {\n const reactiveFilterSliderProps = useReactiveFilterSliderProps(props.filter);\n\n if (props.renderFilterSlider) {\n const Component = props.renderFilterSlider;\n\n return (\n <Component\n {...props}\n reactiveFilterSliderProps={reactiveFilterSliderProps}\n />\n );\n }\n\n return null;\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterListInner: React.FC<\n FilterProps & { reactivesearchFilterProps: ReactivesearchFilterProps }\n> = (props) => {\n const { filter, renderFilterList, reactivesearchFilterProps, ...otherProps } =\n props;\n\n const filterListProps = useFilterListProps(filter, reactivesearchFilterProps);\n\n // hide entire filter when no options available\n if (0 === filterListProps.options.length) {\n return null;\n }\n\n if (renderFilterList) {\n const Component = renderFilterList;\n return (\n <Component\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n }\n\n return (\n <ExampleFilterList\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n"]}
@@ -44,7 +44,7 @@ const ReactifySearchBase = (props) => {
44
44
  };
45
45
  exports.ReactifySearchBase = ReactifySearchBase;
46
46
  const ReactifySearchInner = (props) => {
47
- var _a, _b, _c;
47
+ var _a, _b;
48
48
  const { config } = (0, hooks_1.useConfig)(props.shopifyPermanentDomain, props.configId);
49
49
  const [searchQuery, setSearchQuery] = react_1.default.useState("");
50
50
  const [instantSearchVisible, setInstantSearchVisible] = react_1.default.useState(false);
@@ -62,18 +62,20 @@ const ReactifySearchInner = (props) => {
62
62
  };
63
63
  const searchQueryFromURL = react_1.default.useMemo(() => {
64
64
  var _a;
65
- if (typeof window === "undefined")
66
- return undefined;
65
+ if (typeof window === "undefined") {
66
+ return;
67
+ }
67
68
  const urlParams = new URLSearchParams(window.location.search);
68
69
  return (_a = urlParams.get("q")) !== null && _a !== void 0 ? _a : undefined;
69
- }, [window.location.search]);
70
+ }, [typeof window !== "undefined" && window.location.search]);
70
71
  const searchSortFromURL = react_1.default.useMemo(() => {
71
72
  var _a;
72
- if (typeof window === "undefined")
73
- return undefined;
73
+ if (typeof window === "undefined") {
74
+ return;
75
+ }
74
76
  const urlParams = new URLSearchParams(window.location.search);
75
77
  return (_a = urlParams.get("sort")) !== null && _a !== void 0 ? _a : undefined;
76
- }, [window.location.search]);
78
+ }, [typeof window !== "undefined" && window.location.search]);
77
79
  react_1.default.useEffect(() => {
78
80
  if (searchQueryFromURL && searchQuery !== searchQueryFromURL) {
79
81
  setSearchQuery(searchQueryFromURL);
@@ -85,12 +87,13 @@ const ReactifySearchInner = (props) => {
85
87
  }
86
88
  }, [searchSortFromURL]);
87
89
  react_1.default.useEffect(() => {
88
- if (typeof window === "undefined")
90
+ if (typeof window == "undefined") {
89
91
  return;
92
+ }
90
93
  if (window.location.search === "" && sortOption) {
91
94
  setSortOption(sortOption);
92
95
  }
93
- }, [(_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href]);
96
+ }, [typeof window !== "undefined" && window.location.search]);
94
97
  const contextValue = react_1.default.useMemo(() => {
95
98
  var _a;
96
99
  if (!config) {
@@ -1 +1 @@
1
- {"version":3,"file":"ReactifySearchBase.js","sourceRoot":"","sources":["../../../../src/components/ReactifySearchBase/ReactifySearchBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sDAAwC;AAExC,uCAA+D;AAC/D,iDAAoE;AACpE,2CAAsC;AA+C/B,MAAM,kBAAkB,GAAsC,CACnE,KAAK,EACL,EAAE;IACF,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,eAAK,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEhD,MAAM,CAAC,OAAO,CAAC;YACb,sBAAsB,EAAE,KAAK,CAAC,KAAK;YACnC,qBAAqB,EAAE,KAAK,CAAC,sBAAsB;YACnD,qBAAqB,EAAE,KAAK,CAAC,IAAI;YACjC,2BAA2B,EACzB,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;YACnE,uBAAuB,EAAE,KAAK,CAAC,iBAAiB;SACjD,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,8BAAC,MAAM,CAAC,aAAa,IAAC,QAAQ,EAAE,iEAA4B;QAC1D,8BAAC,mBAAmB,oBAAK,KAAK,EAAI,CACb,CACxB,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,kBAAkB,sBAqB7B;AAEF,MAAM,mBAAmB,GAAsC,CAAC,KAAK,EAAE,EAAE;;IACvE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,iBAAS,EAAC,KAAK,C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AAoB;gBAC1C,uBAAuB,EAAE,uBAAuB;aACjD;YACD,MAAM,EAAE;gBACN,UAAU,EAAE,UAAU;gBACtB,aAAa,EAAE,aAAa;aAC7B;SACF,CAAC;QAEF,eAAK,CAAC,GAAG,CAAC,oBAAoB,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QAEtD,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,UAAU,CAAC,CAAC,CAAC;IAEnE,IAAI,CAAC,YAAY,EAAE;QACjB,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,OAAO,KAAK,CAAC,aAAa,EAAE,CAAC;SAC9B;QACD,OAAO,IAAI,CAAC;KACb;IAED,IAAI,KAAK,CAAC,cAAc,EAAE;QACxB,OAAO,CACL,8BAAC,6BAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,IAChD,KAAK,CAAC,QAAQ,CACgB,CAClC,CAAC;KACH;IAED,OAAO,CACL,8BAAC,6BAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;QACjD,8BAAC,6CAAgC,QAC9B,KAAK,CAAC,QAAQ,CACkB,CACJ,CAClC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport * as Sentry from \"@sentry/react\";\n\nimport { ReactifySearchContext, useConfig } from \"../../hooks\";\nimport { UtilityAuthenticatedReactiveBase } from \"../../components\";\nimport { debug } from \"../../utility\";\n\nexport type ReactifySearchBaseProps = {\n /** The search area the provider will be used in */\n mode: \"search\" | \"collection\" | \"instant-search\";\n /** Shopify store domain used to resolve the site configuration */\n shopifyPermanentDomain: string;\n /** Specific filter group handle, used to override automated logic */\n filterStackHandle?: string;\n /** Callback function for redirects, suitable for headless sites to avoid full page refresh */\n onRedirect?: (type: \"redirect\" | \"search\", url: string) => void;\n /** Render method to display a component when the config is loading */\n renderBooting?: () => JSX.Element | null;\n /** Advanced usage: Allows you to wrap the ReactifySearchBase in your own ReactiveBase component */\n noReactiveBase?: boolean;\n /** Advanced usage: Array of additional component IDs managed outside of Reactify Search */\n additionalComponentHandles?: string[];\n /** Advanced usage: Override the default Elasticsearch index */\n index?: string;\n /** Advanced usage: Override the default Reactify Search config (for multi-instance stores) */\n configId?: string;\n /** Advanced usage: Override the default Elasticsearch credentials */\n credentials?: {\n username: string;\n password: string;\n endpoint: string;\n };\n /** Advanced usage: Override the default ReactiveBase theme */\n theme?: Record<string, unknown>;\n} & (\n | {\n mode: \"search\";\n }\n | {\n mode: \"collection\";\n /** Collection object that includes the handle, used to find curations */\n collection: {\n id: number;\n title: string;\n handle: string;\n };\n }\n | {\n mode: \"instant-search\";\n }\n);\n\nexport const ReactifySearchBase: React.FC<ReactifySearchBaseProps> = (\n props\n) => {\n React.useEffect(() => {\n debug.log(\"ReactifySearchBase\", \"props\", props);\n\n Sentry.setTags({\n \"reactifysearch.index\": props.index,\n \"reactifysearch.shop\": props.shopifyPermanentDomain,\n \"reactifysearch.mode\": props.mode,\n \"reactifysearch.collection\":\n props.mode === \"collection\" ? props.collection.handle : undefined,\n \"reactifysearch.filter\": props.filterStackHandle,\n });\n }, [props]);\n\n return (\n <Sentry.ErrorBoundary fallback={<p>An error has occurred</p>}>\n <ReactifySearchInner {...props} />\n </Sentry.ErrorBoundary>\n );\n};\n\nconst ReactifySearchInner: React.FC<ReactifySearchBaseProps> = (props) => {\n const { config } = useConfig(props.shopifyPermanentDomain, props.configId);\n\n const [searchQuery, setSearchQuery] = React.useState<string>(\"\");\n const [instantSearchVisible, setInstantSearchVisible] =\n React.useState<boolean>(false);\n const [sortOption, setSortOption] = React.useState<string>(\"\");\n\n const credentials = props.credentials ?? {\n username: \"guest\",\n password: \"password\",\n endpoint: \"https://api.search.reactify.app\",\n };\n\n const theme = props.theme ?? {\n typography: {\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n },\n };\n\n const searchQueryFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") return undefined;\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"q\") ?? undefined;\n }, [window.location.search]);\n\n const searchSortFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") return undefined;\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"sort\") ?? undefined;\n }, [window.location.search]);\n\n React.useEffect(() => {\n if (searchQueryFromURL && searchQuery !== searchQueryFromURL) {\n setSearchQuery(searchQueryFromURL);\n }\n }, [searchQueryFromURL]);\n\n React.useEffect(() => {\n if (searchSortFromURL && sortOption !== searchSortFromURL) {\n setSortOption(searchSortFromURL);\n }\n }, [searchSortFromURL]);\n\n React.useEffect(() => {\n if (typeof window === \"undefined\") return;\n if (window.location.search === \"\" && sortOption) {\n setSortOption(sortOption);\n }\n }, [window?.location?.href]);\n\n const contextValue = React.useMemo(() => {\n if (!config) {\n return;\n }\n\n const memoValue = {\n config: config,\n options: {\n ...props,\n index: props.index ?? config.index,\n filterStackHandle: props.filterStackHandle,\n credentials: credentials,\n theme: theme,\n },\n search: {\n searchQuery: searchQuery,\n setSearchQuery: setSearchQuery,\n instantSearchVisible: instantSearchVisible,\n setInstantSearchVisible: setInstantSearchVisible,\n },\n sortby: {\n sortOption: sortOption,\n setSortOption: setSortOption,\n },\n };\n\n debug.log(\"ReactifySearchBase\", \"context\", memoValue);\n\n return memoValue;\n }, [config, props, searchQuery, instantSearchVisible, sortOption]);\n\n if (!contextValue) {\n if (props.renderBooting) {\n return props.renderBooting();\n }\n return null;\n }\n\n if (props.noReactiveBase) {\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n {props.children}\n </ReactifySearchContext.Provider>\n );\n }\n\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n <UtilityAuthenticatedReactiveBase>\n {props.children}\n </UtilityAuthenticatedReactiveBase>\n </ReactifySearchContext.Provider>\n );\n};\n"]}
1
+ {"version":3,"file":"ReactifySearchBase.js","sourceRoot":"","sources":["../../../../src/components/ReactifySearchBase/ReactifySearchBase.tsx"],"names":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S,CAAC;IACnB,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,UAAU,CAAC,CAAC,CAAC;IAEnE,IAAI,CAAC,YAAY,EAAE;QACjB,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,OAAO,KAAK,CAAC,aAAa,EAAE,CAAC;SAC9B;QACD,OAAO,IAAI,CAAC;KACb;IAED,IAAI,KAAK,CAAC,cAAc,EAAE;QACxB,OAAO,CACL,8BAAC,6BAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,IAChD,KAAK,CAAC,QAAQ,CACgB,CAClC,CAAC;KACH;IAED,OAAO,CACL,8BAAC,6BAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;QACjD,8BAAC,6CAAgC,QAC9B,KAAK,CAAC,QAAQ,CACkB,CACJ,CAClC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport * as Sentry from \"@sentry/react\";\n\nimport { ReactifySearchContext, useConfig } from \"../../hooks\";\nimport { UtilityAuthenticatedReactiveBase } from \"../../components\";\nimport { debug } from \"../../utility\";\n\nexport type ReactifySearchBaseProps = {\n /** The search area the provider will be used in */\n mode: \"search\" | \"collection\" | \"instant-search\";\n /** Shopify store domain used to resolve the site configuration */\n shopifyPermanentDomain: string;\n /** Specific filter group handle, used to override automated logic */\n filterStackHandle?: string;\n /** Callback function for redirects, suitable for headless sites to avoid full page refresh */\n onRedirect?: (type: \"redirect\" | \"search\", url: string) => void;\n /** Render method to display a component when the config is loading */\n renderBooting?: () => JSX.Element | null;\n /** Advanced usage: Allows you to wrap the ReactifySearchBase in your own ReactiveBase component */\n noReactiveBase?: boolean;\n /** Advanced usage: Array of additional component IDs managed outside of Reactify Search */\n additionalComponentHandles?: string[];\n /** Advanced usage: Override the default Elasticsearch index */\n index?: string;\n /** Advanced usage: Override the default Reactify Search config (for multi-instance stores) */\n configId?: string;\n /** Advanced usage: Override the default Elasticsearch credentials */\n credentials?: {\n username: string;\n password: string;\n endpoint: string;\n };\n /** Advanced usage: Override the default ReactiveBase theme */\n theme?: Record<string, unknown>;\n} & (\n | {\n mode: \"search\";\n }\n | {\n mode: \"collection\";\n /** Collection object that includes the handle, used to find curations */\n collection: {\n id: number;\n title: string;\n handle: string;\n };\n }\n | {\n mode: \"instant-search\";\n }\n);\n\nexport const ReactifySearchBase: React.FC<ReactifySearchBaseProps> = (\n props\n) => {\n React.useEffect(() => {\n debug.log(\"ReactifySearchBase\", \"props\", props);\n\n Sentry.setTags({\n \"reactifysearch.index\": props.index,\n \"reactifysearch.shop\": props.shopifyPermanentDomain,\n \"reactifysearch.mode\": props.mode,\n \"reactifysearch.collection\":\n props.mode === \"collection\" ? props.collection.handle : undefined,\n \"reactifysearch.filter\": props.filterStackHandle,\n });\n }, [props]);\n\n return (\n <Sentry.ErrorBoundary fallback={<p>An error has occurred</p>}>\n <ReactifySearchInner {...props} />\n </Sentry.ErrorBoundary>\n );\n};\n\nconst ReactifySearchInner: React.FC<ReactifySearchBaseProps> = (props) => {\n const { config } = useConfig(props.shopifyPermanentDomain, props.configId);\n\n const [searchQuery, setSearchQuery] = React.useState<string>(\"\");\n const [instantSearchVisible, setInstantSearchVisible] =\n React.useState<boolean>(false);\n const [sortOption, setSortOption] = React.useState<string>(\"\");\n\n const credentials = props.credentials ?? {\n username: \"guest\",\n password: \"password\",\n endpoint: \"https://api.search.reactify.app\",\n };\n\n const theme = props.theme ?? {\n typography: {\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n },\n };\n\n const searchQueryFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"q\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const searchSortFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"sort\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n React.useEffect(() => {\n if (searchQueryFromURL && searchQuery !== searchQueryFromURL) {\n setSearchQuery(searchQueryFromURL);\n }\n }, [searchQueryFromURL]);\n\n React.useEffect(() => {\n if (searchSortFromURL && sortOption !== searchSortFromURL) {\n setSortOption(searchSortFromURL);\n }\n }, [searchSortFromURL]);\n\n React.useEffect(() => {\n if (typeof window == \"undefined\") {\n return;\n }\n\n if (window.location.search === \"\" && sortOption) {\n setSortOption(sortOption);\n }\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const contextValue = React.useMemo(() => {\n if (!config) {\n return;\n }\n\n const memoValue = {\n config: config,\n options: {\n ...props,\n index: props.index ?? config.index,\n filterStackHandle: props.filterStackHandle,\n credentials: credentials,\n theme: theme,\n },\n search: {\n searchQuery: searchQuery,\n setSearchQuery: setSearchQuery,\n instantSearchVisible: instantSearchVisible,\n setInstantSearchVisible: setInstantSearchVisible,\n },\n sortby: {\n sortOption: sortOption,\n setSortOption: setSortOption,\n },\n };\n\n debug.log(\"ReactifySearchBase\", \"context\", memoValue);\n\n return memoValue;\n }, [config, props, searchQuery, instantSearchVisible, sortOption]);\n\n if (!contextValue) {\n if (props.renderBooting) {\n return props.renderBooting();\n }\n return null;\n }\n\n if (props.noReactiveBase) {\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n {props.children}\n </ReactifySearchContext.Provider>\n );\n }\n\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n <UtilityAuthenticatedReactiveBase>\n {props.children}\n </UtilityAuthenticatedReactiveBase>\n </ReactifySearchContext.Provider>\n );\n};\n"]}
@@ -14,10 +14,10 @@ const ResultPaginationNextPrev_1 = require("./ResultPaginationNextPrev");
14
14
  const hooks_1 = require("../../hooks");
15
15
  const types_1 = require("../../types");
16
16
  const ResultStack = (props) => {
17
- const reactiveResultStackProps = (0, hooks_1.useReactiveResultStackProps)({
17
+ const reactiveReactiveListProps = (0, hooks_1.useReactiveReactiveListProps)({
18
18
  pageSize: props.pageSize,
19
19
  });
20
- return (react_1.default.createElement(ReactiveList_1.default, Object.assign({}, reactiveResultStackProps, { render: (reactivesearchResultProps) => (react_1.default.createElement(ResultStackInner, Object.assign({}, props, { reactivesearchResultProps: reactivesearchResultProps }))), renderPagination: (reactivesearchPaginationProps) => (react_1.default.createElement(ResultStackPaginationStack, Object.assign({}, props, reactivesearchPaginationProps))) })));
20
+ return (react_1.default.createElement(ReactiveList_1.default, Object.assign({}, reactiveReactiveListProps, { render: (reactivesearchResultProps) => (react_1.default.createElement(ResultStackInner, Object.assign({}, props, { reactivesearchResultProps: reactivesearchResultProps }))), renderPagination: (reactivesearchPaginationProps) => (react_1.default.createElement(ResultStackPaginationStack, Object.assign({}, props, reactivesearchPaginationProps))) })));
21
21
  };
22
22
  exports.ResultStack = ResultStack;
23
23
  const ResultStackRenderErrorComponent = (props) => {
@@ -1 +1 @@
1
- {"version":3,"file":"ResultStack.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultStack.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,gHAAwF;AAExF,2DAAwD;AACxD,2DAAwD;AACxD,yEAAsE;AACtE,yEAAsE;AACtE,yEAAsE;AAEtE,uCAMqB;AAErB,uCAOqB;AA8Cd,MAAM,WAAW,GAA+B,CAAC,KAAK,EAAE,EAAE;IAC/D,MAAM,wBAAwB,GAAG,IAAA,mCAA2B,EAAC;QAC3D,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC;IAEH,OAAO,CACL,8BAAC,sBAAY,oBACP,wBAAwB,IAC5B,MAAM,EAAE,CAAC,yBAAoD,EAAE,EAAE,CAAC,CAChE,8BAAC,gBAAgB,oBACX,KAAK,IACT,yBAAyB,EAAE,yBAAyB,IACpD,CACH,EACD,gBAAgB,EAAE,CAChB,6BAA4D,EAC5D,EAAE,CAAC,CACH,8BAAC,0BAA0B,oBACrB,KAAK,EACL,6BAA6B,EACjC,CACH,IACD,CACH,CAAC;AACJ,CAAC,CAAC;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M,EAAE,KAAK,CAAC,wBAAwB,IACtC,CACH,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport ReactiveList from \"@appbaseio/reactivesearch/lib/components/result/ReactiveList\";\n\nimport { ResultCardCallout } from \"./ResultCardCallout\";\nimport { ResultCardProduct } from \"./ResultCardProduct\";\nimport { ResultPaginationNumbered } from \"./ResultPaginationNumbered\";\nimport { ResultPaginationLoadMore } from \"./ResultPaginationLoadMore\";\nimport { ResultPaginationNextPrev } from \"./ResultPaginationNextPrev\";\n\nimport {\n useReactifySearchContext,\n useAnalytics,\n useSearch,\n useFilterStack,\n useReactiveResultStackProps,\n} from \"../../hooks\";\n\nimport {\n ElasticCallout,\n ElasticProduct,\n ElasticDocumentType,\n ReactivesearchError,\n ReactivesearchResultProps,\n ReactivesearchPaginationProps,\n} from \"../../types\";\n\nexport type ResultProps = ReactivesearchResultProps & {\n callouts: ElasticCallout[];\n products: ElasticProduct[];\n};\n\nexport type ResultStackProps = {\n /** Style prop for the list wrapper */\n listStyle?: React.HTMLAttributes<HTMLElement>[\"style\"];\n /** Classname prop for the list wrapper */\n listClassName?: string;\n /** Render method called when an error occurs */\n renderError?: React.FC<{ error: ReactivesearchError }>;\n /** Render method called while loading for the first time */\n renderLoading?: React.FC;\n /** Render method called when no results are found */\n renderNoResults?: React.FC;\n /** Render method called once for each product result */\n renderResultCardProduct?: React.ComponentProps<\n typeof ResultCardProduct\n >[\"render\"];\n /** Render method called once for each callout result */\n renderResultCardCallout?: React.ComponentProps<\n typeof ResultCardCallout\n >[\"render\"];\n /** Render method called for pagination type \"pagination\" */\n renderPaginationNumbered?: React.ComponentProps<\n typeof ResultPaginationNumbered\n >[\"render\"];\n /** Render method called for pagination type \"next_prev\" */\n renderPaginationNextPrev?: React.ComponentProps<\n typeof ResultPaginationNextPrev\n >[\"render\"];\n /** Render method called for pagination type \"load_more\" */\n renderPaginationLoadMore?: React.ComponentProps<\n typeof ResultPaginationLoadMore\n >[\"render\"];\n /** Render method called for pagination type \"infinite_scroll\" */\n renderPaginationInfiniteScroll?: React.ComponentProps<\n typeof ResultPaginationLoadMore\n >[\"render\"];\n /** Advanced Usage: Override the default amount of results per page */\n pageSize?: number;\n};\n\nexport const ResultStack: React.FC<ResultStackProps> = (props) => {\n const reactiveResultStackProps = useReactiveResultStackProps({\n pageSize: props.pageSize,\n });\n\n return (\n <ReactiveList\n {...reactiveResultStackProps}\n render={(reactivesearchResultProps: ReactivesearchResultProps) => (\n <ResultStackInner\n {...props}\n reactivesearchResultProps={reactivesearchResultProps}\n />\n )}\n renderPagination={(\n reactivesearchPaginationProps: ReactivesearchPaginationProps\n ) => (\n <ResultStackPaginationStack\n {...props}\n {...reactivesearchPaginationProps}\n />\n )}\n />\n );\n};\n\nconst ResultStackRenderErrorComponent: ResultStackProps[\"renderError\"] = (\n props\n) => {\n return (\n <div>\n {\"Error: \"}\n {props.error.statusText}\n </div>\n );\n};\n\nconst ResultStackRenderLoadingComponent: ResultStackProps[\"renderLoading\"] =\n () => {\n return <div>{\"Loading\"}</div>;\n };\n\nconst ResultStackRenderNoResultsComponent: ResultStackProps[\"renderNoResults\"] =\n () => {\n return <div>{\"No results\"}</div>;\n };\n\nconst ResultStackInner: React.FC<\n ResultStackProps & { reactivesearchResultProps: ReactivesearchResultProps }\n> = (props) => {\n const { track } = useAnalytics();\n const { searchQuery } = useSearch();\n\n const initialSearchHasRun = React.useMemo(\n () =>\n \"undefined\" !==\n typeof props.reactivesearchResultProps.resultStats.numberOfResults,\n [props.reactivesearchResultProps]\n );\n\n const listStyle = React.useMemo<React.HTMLAttributes<HTMLElement>[\"style\"]>(\n () =>\n props.listStyle ?? {\n display: \"grid\",\n gap: \"8px\",\n gridTemplateColumns: \"repeat(4, minmax(0, 1fr))\",\n },\n [props.listStyle]\n );\n\n if (props.reactivesearchResultProps.error) {\n const RenderErrorComponent =\n props.renderError ?? ResultStackRenderErrorComponent;\n\n return (\n <RenderErrorComponent error={props.reactivesearchResultProps.error} />\n );\n }\n\n if (!initialSearchHasRun) {\n const RenderLoadingComponent =\n props.renderLoading ?? ResultStackRenderLoadingComponent;\n return <RenderLoadingComponent />;\n }\n\n if (!props.reactivesearchResultProps.resultStats.numberOfResults) {\n if (searchQuery) {\n track({\n eventName: \"zeroResults\",\n payload: {\n searchTerm: searchQuery,\n },\n });\n }\n const RenderNoResultsComponent =\n props.renderNoResults ?? ResultStackRenderNoResultsComponent;\n return <RenderNoResultsComponent />;\n }\n\n return (\n <>\n <section style={listStyle} className={props.listClassName}>\n {props.reactivesearchResultProps.data.map((item, key) => {\n // @todo result.type is missing in v1 indexes, this check ensures that they are assumed to be products\n if (ElasticDocumentType.Product === item.type || !item.type) {\n return (\n <ResultCardProduct\n key={item._id}\n product={item}\n document={item}\n pagePosition={key + 1}\n render={props.renderResultCardProduct}\n />\n );\n }\n\n if (ElasticDocumentType.Callout === item.type) {\n return (\n <ResultCardCallout\n key={item._id}\n document={item}\n pagePosition={key + 1}\n callout={item.callout}\n render={props.renderResultCardCallout}\n />\n );\n }\n\n return null;\n })}\n </section>\n <ResultStackPaginationStackLoadMore\n {...props}\n {...props.reactivesearchResultProps}\n />\n </>\n );\n};\n\n/** Handles rendering pagination for types that use \"pagination props\" */\nconst ResultStackPaginationStack: React.FC<\n ResultStackProps & ReactivesearchPaginationProps\n> = (props) => {\n const { options } = useReactifySearchContext();\n const { filterStack } = useFilterStack();\n\n if (options.mode === \"instant-search\") {\n return null;\n }\n\n if (\"pagination\" === filterStack?.paginationType) {\n return (\n <ResultPaginationNumbered\n {...props}\n render={props.renderPaginationNumbered}\n />\n );\n }\n\n if (\"next_prev\" === filterStack?.paginationType) {\n return (\n <ResultPaginationNextPrev\n {...props}\n render={props.renderPaginationNextPrev}\n />\n );\n }\n\n return null;\n};\n\n/** Handles rendering pagination for types that use \"result props\" */\nconst ResultStackPaginationStackLoadMore: React.FC<\n ResultStackProps & { reactivesearchResultProps: ReactivesearchResultProps }\n> = (props) => {\n const { options } = useReactifySearchContext();\n const { filterStack } = useFilterStack();\n\n if (options.mode === \"instant-search\") {\n return null;\n }\n\n if (\"load_more\" === filterStack?.paginationType) {\n return (\n <ResultPaginationLoadMore\n {...props.reactivesearchResultProps}\n render={props.renderPaginationLoadMore}\n />\n );\n }\n\n return null;\n};\n"]}
1
+ {"version":3,"file":"ResultStack.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultStack.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,gHAAwF;AAExF,2DAAwD;AACxD,2DAAwD;AACxD,yEAAsE;AACtE,yEAAsE;AACtE,yEAAsE;AAEtE,uCAMqB;AAErB,uCAOqB;AA8Cd,MAAM,WAAW,GAA+B,CAAC,KAAK,EAAE,EAAE;IAC/D,MAAM,yBAAyB,GAAG,IAAA,oCAA4B,EAAC;QAC7D,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC,CAAC;IAEH,OAAO,CACL,8BAAC,sBAAY,oBACP,yBAAyB,IAC7B,MAAM,EAAE,CAAC,yBAAoD,EAAE,EAAE,CAAC,CAChE,8BAAC,gBAAgB,oBACX,KAAK,IACT,yBAAyB,EAAE,yBAAyB,IACpD,CACH,EACD,gBAAgB,EAAE,CAChB,6BAA4D,EAC5D,EAAE,CAAC,CACH,8BAAC,0BAA0B,oBACrB,KAAK,EACL,6BAA6B,EACjC,CACH,IACD,CACH,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,WAAW,eAwBtB;AAEF,MAAM,+BAA+B,GAAoC,CACvE,KAAK,EACL,EAAE;IACF,OAAO,CACL;QACG,SAAS;QACT,KAAK,CAAC,KAAK,CAAC,UAAU,CACnB,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,iCAAiC,GACrC,GAAG,EAAE;IACH,OAAO,2CAAM,SAAS,CAAO,CAAC;AAChC,CAAC,CAAC;AAEJ,MAAM,mCAAmC,GACvC,GAAG,EAAE;IACH,OAAO,2CAAM,YAAY,CA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AI,OAAO,CAAC,IAAI,KAAK,gBAAgB,EAAE;QACrC,OAAO,IAAI,CAAC;KACb;IAED,IAAI,YAAY,MAAK,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,CAAA,EAAE;QAChD,OAAO,CACL,8BAAC,mDAAwB,oBACnB,KAAK,IACT,MAAM,EAAE,KAAK,CAAC,wBAAwB,IACtC,CACH,CAAC;KACH;IAED,IAAI,WAAW,MAAK,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,CAAA,EAAE;QAC/C,OAAO,CACL,8BAAC,mDAAwB,oBACnB,KAAK,IACT,MAAM,EAAE,KAAK,CAAC,wBAAwB,IACtC,CACH,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,qEAAqE;AACrE,MAAM,kCAAkC,GAEpC,CAAC,KAAK,EAAE,EAAE;IACZ,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC/C,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,sBAAc,GAAE,CAAC;IAEzC,IAAI,OAAO,CAAC,IAAI,KAAK,gBAAgB,EAAE;QACrC,OAAO,IAAI,CAAC;KACb;IAED,IAAI,WAAW,MAAK,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,CAAA,EAAE;QAC/C,OAAO,CACL,8BAAC,mDAAwB,oBACnB,KAAK,CAAC,yBAAyB,IACnC,MAAM,EAAE,KAAK,CAAC,wBAAwB,IACtC,CACH,CAAC;KACH;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport ReactiveList from \"@appbaseio/reactivesearch/lib/components/result/ReactiveList\";\n\nimport { ResultCardCallout } from \"./ResultCardCallout\";\nimport { ResultCardProduct } from \"./ResultCardProduct\";\nimport { ResultPaginationNumbered } from \"./ResultPaginationNumbered\";\nimport { ResultPaginationLoadMore } from \"./ResultPaginationLoadMore\";\nimport { ResultPaginationNextPrev } from \"./ResultPaginationNextPrev\";\n\nimport {\n useReactifySearchContext,\n useAnalytics,\n useSearch,\n useFilterStack,\n useReactiveReactiveListProps,\n} from \"../../hooks\";\n\nimport {\n ElasticCallout,\n ElasticProduct,\n ElasticDocumentType,\n ReactivesearchError,\n ReactivesearchResultProps,\n ReactivesearchPaginationProps,\n} from \"../../types\";\n\nexport type ResultProps = ReactivesearchResultProps & {\n callouts: ElasticCallout[];\n products: ElasticProduct[];\n};\n\nexport type ResultStackProps = {\n /** Style prop for the list wrapper */\n listStyle?: React.HTMLAttributes<HTMLElement>[\"style\"];\n /** Classname prop for the list wrapper */\n listClassName?: string;\n /** Render method called when an error occurs */\n renderError?: React.FC<{ error: ReactivesearchError }>;\n /** Render method called while loading for the first time */\n renderLoading?: React.FC;\n /** Render method called when no results are found */\n renderNoResults?: React.FC;\n /** Render method called once for each product result */\n renderResultCardProduct?: React.ComponentProps<\n typeof ResultCardProduct\n >[\"render\"];\n /** Render method called once for each callout result */\n renderResultCardCallout?: React.ComponentProps<\n typeof ResultCardCallout\n >[\"render\"];\n /** Render method called for pagination type \"pagination\" */\n renderPaginationNumbered?: React.ComponentProps<\n typeof ResultPaginationNumbered\n >[\"render\"];\n /** Render method called for pagination type \"next_prev\" */\n renderPaginationNextPrev?: React.ComponentProps<\n typeof ResultPaginationNextPrev\n >[\"render\"];\n /** Render method called for pagination type \"load_more\" */\n renderPaginationLoadMore?: React.ComponentProps<\n typeof ResultPaginationLoadMore\n >[\"render\"];\n /** Render method called for pagination type \"infinite_scroll\" */\n renderPaginationInfiniteScroll?: React.ComponentProps<\n typeof ResultPaginationLoadMore\n >[\"render\"];\n /** Advanced Usage: Override the default amount of results per page */\n pageSize?: number;\n};\n\nexport const ResultStack: React.FC<ResultStackProps> = (props) => {\n const reactiveReactiveListProps = useReactiveReactiveListProps({\n pageSize: props.pageSize,\n });\n\n return (\n <ReactiveList\n {...reactiveReactiveListProps}\n render={(reactivesearchResultProps: ReactivesearchResultProps) => (\n <ResultStackInner\n {...props}\n reactivesearchResultProps={reactivesearchResultProps}\n />\n )}\n renderPagination={(\n reactivesearchPaginationProps: ReactivesearchPaginationProps\n ) => (\n <ResultStackPaginationStack\n {...props}\n {...reactivesearchPaginationProps}\n />\n )}\n />\n );\n};\n\nconst ResultStackRenderErrorComponent: ResultStackProps[\"renderError\"] = (\n props\n) => {\n return (\n <div>\n {\"Error: \"}\n {props.error.statusText}\n </div>\n );\n};\n\nconst ResultStackRenderLoadingComponent: ResultStackProps[\"renderLoading\"] =\n () => {\n return <div>{\"Loading\"}</div>;\n };\n\nconst ResultStackRenderNoResultsComponent: ResultStackProps[\"renderNoResults\"] =\n () => {\n return <div>{\"No results\"}</div>;\n };\n\nconst ResultStackInner: React.FC<\n ResultStackProps & { reactivesearchResultProps: ReactivesearchResultProps }\n> = (props) => {\n const { track } = useAnalytics();\n const { searchQuery } = useSearch();\n\n const initialSearchHasRun = React.useMemo(\n () =>\n \"undefined\" !==\n typeof props.reactivesearchResultProps.resultStats.numberOfResults,\n [props.reactivesearchResultProps]\n );\n\n const listStyle = React.useMemo<React.HTMLAttributes<HTMLElement>[\"style\"]>(\n () =>\n props.listStyle ?? {\n display: \"grid\",\n gap: \"8px\",\n gridTemplateColumns: \"repeat(4, minmax(0, 1fr))\",\n },\n [props.listStyle]\n );\n\n if (props.reactivesearchResultProps.error) {\n const RenderErrorComponent =\n props.renderError ?? ResultStackRenderErrorComponent;\n\n return (\n <RenderErrorComponent error={props.reactivesearchResultProps.error} />\n );\n }\n\n if (!initialSearchHasRun) {\n const RenderLoadingComponent =\n props.renderLoading ?? ResultStackRenderLoadingComponent;\n return <RenderLoadingComponent />;\n }\n\n if (!props.reactivesearchResultProps.resultStats.numberOfResults) {\n if (searchQuery) {\n track({\n eventName: \"zeroResults\",\n payload: {\n searchTerm: searchQuery,\n },\n });\n }\n const RenderNoResultsComponent =\n props.renderNoResults ?? ResultStackRenderNoResultsComponent;\n return <RenderNoResultsComponent />;\n }\n\n return (\n <>\n <section style={listStyle} className={props.listClassName}>\n {props.reactivesearchResultProps.data.map((item, key) => {\n // @todo result.type is missing in v1 indexes, this check ensures that they are assumed to be products\n if (ElasticDocumentType.Product === item.type || !item.type) {\n return (\n <ResultCardProduct\n key={item._id}\n product={item}\n document={item}\n pagePosition={key + 1}\n render={props.renderResultCardProduct}\n />\n );\n }\n\n if (ElasticDocumentType.Callout === item.type) {\n return (\n <ResultCardCallout\n key={item._id}\n document={item}\n pagePosition={key + 1}\n callout={item.callout}\n render={props.renderResultCardCallout}\n />\n );\n }\n\n return null;\n })}\n </section>\n <ResultStackPaginationStackLoadMore\n {...props}\n {...props.reactivesearchResultProps}\n />\n </>\n );\n};\n\n/** Handles rendering pagination for types that use \"pagination props\" */\nconst ResultStackPaginationStack: React.FC<\n ResultStackProps & ReactivesearchPaginationProps\n> = (props) => {\n const { options } = useReactifySearchContext();\n const { filterStack } = useFilterStack();\n\n if (options.mode === \"instant-search\") {\n return null;\n }\n\n if (\"pagination\" === filterStack?.paginationType) {\n return (\n <ResultPaginationNumbered\n {...props}\n render={props.renderPaginationNumbered}\n />\n );\n }\n\n if (\"next_prev\" === filterStack?.paginationType) {\n return (\n <ResultPaginationNextPrev\n {...props}\n render={props.renderPaginationNextPrev}\n />\n );\n }\n\n return null;\n};\n\n/** Handles rendering pagination for types that use \"result props\" */\nconst ResultStackPaginationStackLoadMore: React.FC<\n ResultStackProps & { reactivesearchResultProps: ReactivesearchResultProps }\n> = (props) => {\n const { options } = useReactifySearchContext();\n const { filterStack } = useFilterStack();\n\n if (options.mode === \"instant-search\") {\n return null;\n }\n\n if (\"load_more\" === filterStack?.paginationType) {\n return (\n <ResultPaginationLoadMore\n {...props.reactivesearchResultProps}\n render={props.renderPaginationLoadMore}\n />\n );\n }\n\n return null;\n};\n"]}
@@ -1,8 +1,8 @@
1
1
  export * from "./useReactiveBaseProps";
2
- export * from "./useReactiveReactProp";
2
+ export * from "./useReactiveDataSearchProps";
3
3
  export * from "./useReactiveFilterListProps";
4
4
  export * from "./useReactiveFilterRangeProps";
5
5
  export * from "./useReactiveFilterSliderProps";
6
6
  export * from "./useReactiveFilterSharedProps";
7
- export * from "./useReactiveResultStackProps";
8
- export * from "./useReactiveDataSearchProps";
7
+ export * from "./useReactiveReactProp";
8
+ export * from "./useReactiveReactiveListProps";
@@ -11,11 +11,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./useReactiveBaseProps"), exports);
14
- __exportStar(require("./useReactiveReactProp"), exports);
14
+ __exportStar(require("./useReactiveDataSearchProps"), exports);
15
15
  __exportStar(require("./useReactiveFilterListProps"), exports);
16
16
  __exportStar(require("./useReactiveFilterRangeProps"), exports);
17
17
  __exportStar(require("./useReactiveFilterSliderProps"), exports);
18
18
  __exportStar(require("./useReactiveFilterSharedProps"), exports);
19
- __exportStar(require("./useReactiveResultStackProps"), exports);
20
- __exportStar(require("./useReactiveDataSearchProps"), exports);
19
+ __exportStar(require("./useReactiveReactProp"), exports);
20
+ __exportStar(require("./useReactiveReactiveListProps"), exports);
21
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAuC;AACvC,yDAAuC;AACvC,+DAA6C;AAC7C,gEAA8C;AAC9C,iEAA+C;AAC/C,iEAA+C;AAC/C,gEAA8C;AAC9C,+DAA6C","sourcesContent":["export * from \"./useReactiveBaseProps\";\nexport * from \"./useReactiveReactProp\";\nexport * from \"./useReactiveFilterListProps\";\nexport * from \"./useReactiveFilterRangeProps\";\nexport * from \"./useReactiveFilterSliderProps\";\nexport * from \"./useReactiveFilterSharedProps\";\nexport * from \"./useReactiveResultStackProps\";\nexport * from \"./useReactiveDataSearchProps\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAuC;AACvC,+DAA6C;AAC7C,+DAA6C;AAC7C,gEAA8C;AAC9C,iEAA+C;AAC/C,iEAA+C;AAC/C,yDAAuC;AACvC,iEAA+C","sourcesContent":["export * from \"./useReactiveBaseProps\";\nexport * from \"./useReactiveDataSearchProps\";\nexport * from \"./useReactiveFilterListProps\";\nexport * from \"./useReactiveFilterRangeProps\";\nexport * from \"./useReactiveFilterSliderProps\";\nexport * from \"./useReactiveFilterSharedProps\";\nexport * from \"./useReactiveReactProp\";\nexport * from \"./useReactiveReactiveListProps\";\n"]}
@@ -17,7 +17,7 @@ const react_1 = __importDefault(require("react"));
17
17
  const hooks_1 = require("../../hooks");
18
18
  const useReactiveBaseProps = () => {
19
19
  const { options } = (0, hooks_1.useReactifySearchContext)();
20
- return react_1.default.useMemo(() => ({
20
+ const reactiveBaseProps = react_1.default.useMemo(() => ({
21
21
  app: options.index,
22
22
  url: options.credentials.endpoint,
23
23
  credentials: `${options.credentials.username}:${options.credentials.password}`,
@@ -39,6 +39,7 @@ const useReactiveBaseProps = () => {
39
39
  return response;
40
40
  }),
41
41
  }), [options.credentials, options.theme]);
42
+ return reactiveBaseProps;
42
43
  };
43
44
  exports.useReactiveBaseProps = useReactiveBaseProps;
44
45
  //# sourceMappingURL=useReactiveBaseProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveBaseProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveBaseProps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,uCAAuD;AAEhD,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAE/C,OAAO,eAAK,CAAC,OAAO,CAClB,GAAG,EAAE,CAAC,CAAC;QACL,GAAG,EAAE,OAAO,CAAC,KAAK;QAClB,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ;QACjC,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE;QAC9E,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,iBAAiB,EAAE,CAAO,QAAa,EAAE,EAAE;;YACzC,+EAA+E;YAC/E,uDAAuD;YACvD,EAAE;YACF,qFAAqF;YACrF,qFAAqF;YACrF,kEAAkE;YAClE,EAAE;YACF,0DAA0D;YAC1D,IACE,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,EACpE;gBACA,QAAQ,CAAC,YAAY,CAAC,qBAAqB;oBACzC,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,CAAC;aACxE;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAA;KACF,CAAC,EACF,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CACrC,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,oBAAoB,wBA8B/B","sourcesContent":["import React from \"react\";\nimport { useReactifySearchContext } from \"../../hooks\";\n\nexport const useReactiveBaseProps = () => {\n const { options } = useReactifySearchContext();\n\n return React.useMemo(\n () => ({\n app: options.index,\n url: options.credentials.endpoint,\n credentials: `${options.credentials.username}:${options.credentials.password}`,\n theme: options.theme,\n transformResponse: async (response: any) => {\n // support filtering inside nested aggregations by moving the inner aggregation\n // up one level such that reactivesearch understands it\n //\n // see useReactiveFilterListProps > defaultQuery to see how a filter is being applied\n // to variant aggregations to ensure that only in stock sizes are displayed as filter\n // options, this involves a nested filter, which requires this fix\n //\n // https://github.com/appbaseio/reactivesearch/issues/1530\n if (\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer\n ) {\n response.aggregations.reactivesearch_nested =\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer;\n }\n\n return response;\n },\n }),\n [options.credentials, options.theme]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveBaseProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveBaseProps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,uCAAuD;AAEhD,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAE/C,MAAM,iBAAiB,GAAG,eAAK,CAAC,OAAO,CACrC,GAAG,EAAE,CAAC,CAAC;QACL,GAAG,EAAE,OAAO,CAAC,KAAK;QAClB,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ;QACjC,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE;QAC9E,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,iBAAiB,EAAE,CAAO,QAAa,EAAE,EAAE;;YACzC,+EAA+E;YAC/E,uDAAuD;YACvD,EAAE;YACF,qFAAqF;YACrF,qFAAqF;YACrF,kEAAkE;YAClE,EAAE;YACF,0DAA0D;YAC1D,IACE,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,EACpE;gBACA,QAAQ,CAAC,YAAY,CAAC,qBAAqB;oBACzC,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,CAAC;aACxE;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAA;KACF,CAAC,EACF,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CACrC,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAhCW,QAAA,oBAAoB,wBAgC/B","sourcesContent":["import React from \"react\";\nimport { useReactifySearchContext } from \"../../hooks\";\n\nexport const useReactiveBaseProps = () => {\n const { options } = useReactifySearchContext();\n\n const reactiveBaseProps = React.useMemo(\n () => ({\n app: options.index,\n url: options.credentials.endpoint,\n credentials: `${options.credentials.username}:${options.credentials.password}`,\n theme: options.theme,\n transformResponse: async (response: any) => {\n // support filtering inside nested aggregations by moving the inner aggregation\n // up one level such that reactivesearch understands it\n //\n // see useReactiveFilterListProps > defaultQuery to see how a filter is being applied\n // to variant aggregations to ensure that only in stock sizes are displayed as filter\n // options, this involves a nested filter, which requires this fix\n //\n // https://github.com/appbaseio/reactivesearch/issues/1530\n if (\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer\n ) {\n response.aggregations.reactivesearch_nested =\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer;\n }\n\n return response;\n },\n }),\n [options.credentials, options.theme]\n );\n\n return reactiveBaseProps;\n};\n"]}
@@ -9,7 +9,7 @@ export declare const useReactiveDataSearchProps: (options: {
9
9
  inputClassName?: string | undefined;
10
10
  type: string;
11
11
  showIcon: boolean;
12
- fuzziness: 0 | 2 | 1 | "AUTO";
12
+ fuzziness: 0 | 1 | 2 | "AUTO";
13
13
  queryFormat: "and" | "or";
14
14
  autosuggest: boolean;
15
15
  value: string;
@@ -38,7 +38,7 @@ const useReactiveDataSearchProps = (options) => {
38
38
  }, {
39
39
  wait: (_a = options.debounce) !== null && _a !== void 0 ? _a : 300,
40
40
  });
41
- return react_1.default.useMemo(() => {
41
+ const reactiveDataSearchProps = react_1.default.useMemo(() => {
42
42
  var _a;
43
43
  return (Object.assign({ type: "search", showIcon: false, fuzziness: 1, queryFormat: "and", autosuggest: false, value: searchQuery !== null && searchQuery !== void 0 ? searchQuery : "", onKeyUp: handleKeyPress, componentId: "SearchInput", placeholder: (_a = options.placeholder) !== null && _a !== void 0 ? _a : "Search for a product...", dataField: searchFields.map((field) => field.field), fieldWeights: searchFields.map((field) => field.importance), onChange: (value, triggerQuery) => {
44
44
  setSearchQuery(value);
@@ -65,6 +65,7 @@ const useReactiveDataSearchProps = (options) => {
65
65
  runDebouncedTriggerQuery,
66
66
  cancelDebouncedTriggerQuery,
67
67
  ]);
68
+ return reactiveDataSearchProps;
68
69
  };
69
70
  exports.useReactiveDataSearchProps = useReactiveDataSearchProps;
70
71
  //# sourceMappingURL=useReactiveDataSearchProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveDataSearchProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveDataSearchProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,mCAAuC;AAIvC,uCAAgF;AAEhF,6EAA6E;AAC7E,MAAM,kBAAkB,GAAgB;IACtC,EAAE,EAAE,OAAO;IACX,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,gBAAgB;CAC7B,CAAC;AAEK,MAAM,0BAA0B,GAAG,CAAC,OAK1C,EAAE,EAAE;;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC9C,MAAM,EACJ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,2BAA2B,GAC5B,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEhB,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO,CAChC,GAAG,EAAE,CACH,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM;QACtB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7B,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAC/D;QACH,CAAC,CAAC,CAAC,kBAAkB,CAAC,EAC1B,EAAE,CACH,CAAC;IAEF,MAAM,cAAc,GAAG,eAAK,CAAC,WAAW,CACtC,CAAC,CAAC,EAAE,EAAE;QACJ,IAAI,OAAO,KAAK,CAAC,CAAC,GAAG;Y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AK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,EAC3D,QAAQ,EAAE,CAAC,KAAa,EAAE,YAAsB,EAAE,EAAE;gBAClD,cAAc,CAAC,KAAK,CAAC,CAAC;gBACtB,IAAI,CAAC,CAAC,KAAK,EAAE;oBACX,wBAAwB,CAAC,YAAY,CAAC,CAAC;iBACxC;qBAAM;oBACL,2BAA2B,EAAE,CAAC;iBAC/B;YACH,CAAC,EACD,MAAM,EAAE,GAAG,EAAE;gBACX,mEAAmE;gBACnE,UAAU,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;YAC5D,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;gBACZ,2BAA2B,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC,EACD,UAAU,EAAE;gBACV,KAAK,EAAE,OAAO,CAAC,cAAc;aAC9B,IACE,OAAO,EACV,CAAA;KAAA,EACF;QACE,WAAW;QACX,cAAc;QACd,OAAO,CAAC,WAAW;QACnB,YAAY;QACZ,cAAc;QACd,wBAAwB;QACxB,2BAA2B;KAC5B,CACF,CAAC;AACJ,CAAC,CAAC;AA7FW,QAAA,0BAA0B,8BA6FrC","sourcesContent":["import React from \"react\";\nimport { useDebounceFn } from \"ahooks\";\n\nimport type { ConfigField } from \"../../types/config\";\n\nimport { useReactifySearchContext, useSearch, useAnalytics } from \"../../hooks\";\n\n// default field for when zero search fields have been configured in Reactify\nconst defaultSearchField: ConfigField = {\n id: \"title\",\n field: \"title\",\n importance: 0,\n searchType: \"instant_search\",\n};\n\nexport const useReactiveDataSearchProps = (options: {\n [key: string]: any;\n debounce?: number;\n placeholder?: string;\n inputClassName?: string;\n}) => {\n const { config } = useReactifySearchContext();\n const {\n searchQuery,\n submitSearch,\n setSearchQuery,\n setShowInstantSearchResults,\n } = useSearch();\n\n const searchFields = React.useMemo(\n () =>\n 0 < config.fields.length\n ? config.fields.filter((field) =>\n [\"always_search\", \"instant_search\"].includes(field.searchType)\n )\n : [defaultSearchField],\n []\n );\n\n const handleKeyPress = React.useCallback(\n (e) => {\n if (\"Enter\" !== e.key) return;\n submitSearch();\n },\n [submitSearch]\n );\n\n const { track } = useAnalytics();\n\n const trackQuery = React.useCallback(() => {\n if (!searchQuery || (searchQuery && searchQuery.length < 3)) return;\n track({ eventName: \"search\", payload: { searchTerm: searchQuery } });\n }, [searchQuery, track]);\n\n const { run: runDebouncedTriggerQuery, cancel: cancelDebouncedTriggerQuery } =\n useDebounceFn(\n (triggerQuery: () => void) => {\n triggerQuery();\n trackQuery();\n },\n {\n wait: options.debounce ?? 300,\n }\n );\n\n return React.useMemo(\n () => ({\n type: \"search\",\n showIcon: false,\n fuzziness: 1 as 0 | 1 | 2 | \"AUTO\",\n queryFormat: \"and\" as \"and\" | \"or\",\n autosuggest: false,\n value: searchQuery ?? \"\",\n onKeyUp: handleKeyPress,\n componentId: \"SearchInput\",\n placeholder: options.placeholder ?? \"Search for a product...\",\n dataField: searchFields.map((field) => field.field),\n fieldWeights: searchFields.map((field) => field.importance),\n onChange: (value: string, triggerQuery: () => {}) => {\n setSearchQuery(value);\n if (!!value) {\n runDebouncedTriggerQuery(triggerQuery);\n } else {\n cancelDebouncedTriggerQuery();\n }\n },\n onBlur: () => {\n // setTimeout ensures that results are still clickable before close\n setTimeout(() => setShowInstantSearchResults(false), 300);\n },\n onFocus: () => {\n setShowInstantSearchResults(true);\n },\n innerClass: {\n input: options.inputClassName,\n },\n ...options,\n }),\n [\n searchQuery,\n handleKeyPress,\n options.placeholder,\n searchFields,\n setSearchQuery,\n runDebouncedTriggerQuery,\n cancelDebouncedTriggerQuery,\n ]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveDataSearchProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveDataSearchProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,mCAAuC;AAIvC,uCAAgF;AAEhF,6EAA6E;AAC7E,MAAM,kBAA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O,EAAE,GAAG,EAAE;gBACZ,2BAA2B,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC,EACD,UAAU,EAAE;gBACV,KAAK,EAAE,OAAO,CAAC,cAAc;aAC9B,IACE,OAAO,EACV,CAAA;KAAA,EACF;QACE,WAAW;QACX,cAAc;QACd,OAAO,CAAC,WAAW;QACnB,YAAY;QACZ,cAAc;QACd,wBAAwB;QACxB,2BAA2B;KAC5B,CACF,CAAC;IAEF,OAAO,uBAAuB,CAAC;AACjC,CAAC,CAAC;AA/FW,QAAA,0BAA0B,8BA+FrC","sourcesContent":["import React from \"react\";\nimport { useDebounceFn } from \"ahooks\";\n\nimport type { ConfigField } from \"../../types/config\";\n\nimport { useReactifySearchContext, useSearch, useAnalytics } from \"../../hooks\";\n\n// default field for when zero search fields have been configured in Reactify\nconst defaultSearchField: ConfigField = {\n id: \"title\",\n field: \"title\",\n importance: 0,\n searchType: \"instant_search\",\n};\n\nexport const useReactiveDataSearchProps = (options: {\n [key: string]: any;\n debounce?: number;\n placeholder?: string;\n inputClassName?: string;\n}) => {\n const { config } = useReactifySearchContext();\n const {\n searchQuery,\n submitSearch,\n setSearchQuery,\n setShowInstantSearchResults,\n } = useSearch();\n\n const searchFields = React.useMemo(\n () =>\n 0 < config.fields.length\n ? config.fields.filter((field) =>\n [\"always_search\", \"instant_search\"].includes(field.searchType)\n )\n : [defaultSearchField],\n []\n );\n\n const handleKeyPress = React.useCallback(\n (e) => {\n if (\"Enter\" !== e.key) return;\n submitSearch();\n },\n [submitSearch]\n );\n\n const { track } = useAnalytics();\n\n const trackQuery = React.useCallback(() => {\n if (!searchQuery || (searchQuery && searchQuery.length < 3)) return;\n track({ eventName: \"search\", payload: { searchTerm: searchQuery } });\n }, [searchQuery, track]);\n\n const { run: runDebouncedTriggerQuery, cancel: cancelDebouncedTriggerQuery } =\n useDebounceFn(\n (triggerQuery: () => void) => {\n triggerQuery();\n trackQuery();\n },\n {\n wait: options.debounce ?? 300,\n }\n );\n\n const reactiveDataSearchProps = React.useMemo(\n () => ({\n type: \"search\",\n showIcon: false,\n fuzziness: 1 as 0 | 1 | 2 | \"AUTO\",\n queryFormat: \"and\" as \"and\" | \"or\",\n autosuggest: false,\n value: searchQuery ?? \"\",\n onKeyUp: handleKeyPress,\n componentId: \"SearchInput\",\n placeholder: options.placeholder ?? \"Search for a product...\",\n dataField: searchFields.map((field) => field.field),\n fieldWeights: searchFields.map((field) => field.importance),\n onChange: (value: string, triggerQuery: () => {}) => {\n setSearchQuery(value);\n if (!!value) {\n runDebouncedTriggerQuery(triggerQuery);\n } else {\n cancelDebouncedTriggerQuery();\n }\n },\n onBlur: () => {\n // setTimeout ensures that results are still clickable before close\n setTimeout(() => setShowInstantSearchResults(false), 300);\n },\n onFocus: () => {\n setShowInstantSearchResults(true);\n },\n innerClass: {\n input: options.inputClassName,\n },\n ...options,\n }),\n [\n searchQuery,\n handleKeyPress,\n options.placeholder,\n searchFields,\n setSearchQuery,\n runDebouncedTriggerQuery,\n cancelDebouncedTriggerQuery,\n ]\n );\n\n return reactiveDataSearchProps;\n};\n"]}
@@ -13,10 +13,11 @@ const useReactiveReactProp_1 = require("./useReactiveReactProp");
13
13
  const useReactiveFilterListProps = (filter) => {
14
14
  const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle);
15
15
  const reactiveFilterSharedProps = (0, useReactiveFilterSharedProps_1.useReactiveFilterSharedProps)(filter);
16
- return react_1.default.useMemo(() => {
16
+ const reactiveFilterListProps = react_1.default.useMemo(() => {
17
17
  var _a, _b, _c;
18
18
  return (Object.assign(Object.assign({}, reactiveFilterSharedProps), { size: parseInt(filter.displaySize) || undefined, showFilter: (_a = filter.settingsShowFilter) !== null && _a !== void 0 ? _a : true, showLoadMore: (_b = filter.settingsShowMore) !== null && _b !== void 0 ? _b : false, showSearch: (_c = filter.settingsShowSearch) !== null && _c !== void 0 ? _c : false, showRadio: false, showCheckbox: false }));
19
19
  }, [filter, reactiveReactProp]);
20
+ return reactiveFilterListProps;
20
21
  };
21
22
  exports.useReactiveFilterListProps = useReactiveFilterListProps;
22
23
  //# sourceMappingURL=useReactiveFilterListProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveFilterListProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,0BAA0B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACvE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,OAAO,eAAK,CAAC,OAAO,CAClB,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,SAAS,EAC/C,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,EAC7C,YAAY,EAAE,MAAA,MAAM,CAAC,gBAAgB,mCAAI,KAAK,EAC9C,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,KAAK,EAC9C,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,KAAK,IACnB,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,0BAA0B,8BAgBrC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch SingleList and MultiList components\n */\nexport const useReactiveFilterListProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n return React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n size: parseInt(filter.displaySize) || undefined,\n showFilter: filter.settingsShowFilter ?? true,\n showLoadMore: filter.settingsShowMore ?? false,\n showSearch: filter.settingsShowSearch ?? false,\n showRadio: false,\n showCheckbox: false,\n }),\n [filter, reactiveReactProp]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveFilterListProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,0BAA0B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACvE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,MAAM,uBAAuB,GAAG,eAAK,CAAC,OAAO,CAC3C,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,SAAS,EAC/C,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,EAC7C,YAAY,EAAE,MAAA,MAAM,CAAC,gBAAgB,mCAAI,KAAK,EAC9C,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,KAAK,EAC9C,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,KAAK,IACnB,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;IAEF,OAAO,uBAAuB,CAAC;AACjC,CAAC,CAAC;AAlBW,QAAA,0BAA0B,8BAkBrC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch SingleList and MultiList components\n */\nexport const useReactiveFilterListProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n const reactiveFilterListProps = React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n size: parseInt(filter.displaySize) || undefined,\n showFilter: filter.settingsShowFilter ?? true,\n showLoadMore: filter.settingsShowMore ?? false,\n showSearch: filter.settingsShowSearch ?? false,\n showRadio: false,\n showCheckbox: false,\n }),\n [filter, reactiveReactProp]\n );\n\n return reactiveFilterListProps;\n};\n"]}
@@ -13,10 +13,11 @@ const useReactiveReactProp_1 = require("./useReactiveReactProp");
13
13
  const useReactiveFilterRangeProps = (filter) => {
14
14
  const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle);
15
15
  const reactiveFilterSharedProps = (0, useReactiveFilterSharedProps_1.useReactiveFilterSharedProps)(filter);
16
- return react_1.default.useMemo(() => {
16
+ const reactiveFilterRangeProps = react_1.default.useMemo(() => {
17
17
  var _a;
18
18
  return (Object.assign(Object.assign({}, reactiveFilterSharedProps), { showFilter: (_a = filter.settingsShowFilter) !== null && _a !== void 0 ? _a : true, showRadio: false, showCheckbox: false }));
19
19
  }, [filter, reactiveReactProp]);
20
+ return reactiveFilterRangeProps;
20
21
  };
21
22
  exports.useReactiveFilterRangeProps = useReactiveFilterRangeProps;
22
23
  //# sourceMappingURL=useReactiveFilterRangeProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveFilterRangeProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterRangeProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,2BAA2B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACxE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,OAAO,eAAK,CAAC,OAAO,CAClB,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,EAC7C,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,KAAK,IACnB,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,2BAA2B,+BAatC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch SingleRange and MultiRange components\n */\nexport const useReactiveFilterRangeProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n return React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n showFilter: filter.settingsShowFilter ?? true,\n showRadio: false,\n showCheckbox: false,\n }),\n [filter, reactiveReactProp]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveFilterRangeProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterRangeProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,2BAA2B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACxE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,MAAM,wBAAwB,GAAG,eAAK,CAAC,OAAO,CAC5C,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,EAC7C,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,KAAK,IACnB,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;IAEF,OAAO,wBAAwB,CAAC;AAClC,CAAC,CAAC;AAfW,QAAA,2BAA2B,+BAetC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch SingleRange and MultiRange components\n */\nexport const useReactiveFilterRangeProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n const reactiveFilterRangeProps = React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n showFilter: filter.settingsShowFilter ?? true,\n showRadio: false,\n showCheckbox: false,\n }),\n [filter, reactiveReactProp]\n );\n\n return reactiveFilterRangeProps;\n};\n"]}
@@ -91,7 +91,7 @@ const useReactiveFilterSharedProps = (filter) => {
91
91
  };
92
92
  };
93
93
  }, [filter]);
94
- return react_1.default.useMemo(() => ({
94
+ const reactiveFilterSharedProps = react_1.default.useMemo(() => ({
95
95
  nestedField,
96
96
  customQuery,
97
97
  defaultQuery,
@@ -101,6 +101,7 @@ const useReactiveFilterSharedProps = (filter) => {
101
101
  filterLabel: filter.name,
102
102
  react: reactiveReactProp,
103
103
  }), [filter, reactiveReactProp]);
104
+ return reactiveFilterSharedProps;
104
105
  };
105
106
  exports.useReactiveFilterSharedProps = useReactiveFilterSharedProps;
106
107
  //# sourceMappingURL=useReactiveFilterSharedProps.js.map
@@ -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M,CAAC,MAAM;QAC1B,SAAS,EAAE,MAAM,CAAC,KAAK;QACvB,WAAW,EAAE,MAAM,CAAC,IAAI;QACxB,KAAK,EAAE,iBAAiB;KACzB,CAAC,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;AACJ,CAAC,CAAC;AAzGW,QAAA,4BAA4B,gCAyGvC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with all @appbaseio/reactivesearch filter components\n */\nexport const useReactiveFilterSharedProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n\n const nestedField = React.useMemo(() => {\n const nestedFields = [\"variants\"];\n const topField = filter.field.split(\".\")[0];\n if (nestedFields.includes(topField)) return topField;\n return undefined;\n }, [filter]);\n\n // define a custom query for when settingsHideUnavailable is enabled and the target field is inside variants\n // customQuery defines how this filter affects *other* components like the results component\n const customQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\n\n return (value?: string | string[]) => {\n if (!value) return {};\n\n // reactivesearch sometimes returns string, sometimes string[]\n const valueArray = \"string\" === typeof value ? [value] : value;\n\n if (0 === valueArray.length) return {};\n\n return {\n query: {\n nested: {\n path: \"variants\",\n query: {\n bool: {\n must: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n terms: {\n [filter.field]: valueArray,\n },\n },\n ],\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n // define a default query for when settingsHideUnavailable is enabled and the target field is inside variants\n // defaultQuery defines how this filter affects itself i.e. the options displayed\n const defaultQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\n\n // override the aggregation query to filter the results by the variants.available attribute\n return () => {\n return {\n aggs: {\n reactivesearch_nested: {\n nested: { path: \"variants\" },\n aggs: {\n reactify_nested_outer: {\n filter: {\n match: {\n \"variants.available\": \"true\",\n },\n },\n aggs: {\n [filter.field]: {\n terms: {\n field: filter.field,\n size: 100,\n order: { _count: \"desc\" },\n },\n },\n },\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n return React.useMemo(\n () => ({\n nestedField,\n customQuery,\n defaultQuery,\n URLParams: true,\n componentId: filter.handle,\n dataField: filter.field,\n filterLabel: filter.name,\n react: reactiveReactProp,\n }),\n [filter, reactiveReactProp]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveFilterSharedProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSharedProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,iEAA8D;AAE9D;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE9D,MAAM,WAAW,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrC,MAAM,YAAY,GAAG,CAAC,UAAU,CAAC,CAAC;QAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5C,IAAI,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,OAAO,QAAQ,CAAC;QACrD,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,4GAA4G;IAC5G,4FAA4F;IAC5F,MAAM,WAAW,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrC,IACE,CAAC,MAAM,CAAC,uBAAuB;YAC/B,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;YAErC,OAAO,SAAS,CAAC;QAEnB,OAAO,CAAC,KAAyB,EAAE,EAAE;YACnC,IAAI,CAAC,KA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G;4CACT,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;yCAC1B;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,yBAAyB,GAAG,eAAK,CAAC,OAAO,CAC7C,GAAG,EAAE,CAAC,CAAC;QACL,WAAW;QACX,WAAW;QACX,YAAY;QACZ,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,MAAM,CAAC,MAAM;QAC1B,SAAS,EAAE,MAAM,CAAC,KAAK;QACvB,WAAW,EAAE,MAAM,CAAC,IAAI;QACxB,KAAK,EAAE,iBAAiB;KACzB,CAAC,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;IAEF,OAAO,yBAAyB,CAAC;AACnC,CAAC,CAAC;AA3GW,QAAA,4BAA4B,gCA2GvC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with all @appbaseio/reactivesearch filter components\n */\nexport const useReactiveFilterSharedProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n\n const nestedField = React.useMemo(() => {\n const nestedFields = [\"variants\"];\n const topField = filter.field.split(\".\")[0];\n if (nestedFields.includes(topField)) return topField;\n return undefined;\n }, [filter]);\n\n // define a custom query for when settingsHideUnavailable is enabled and the target field is inside variants\n // customQuery defines how this filter affects *other* components like the results component\n const customQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\n\n return (value?: string | string[]) => {\n if (!value) return {};\n\n // reactivesearch sometimes returns string, sometimes string[]\n const valueArray = \"string\" === typeof value ? [value] : value;\n\n if (0 === valueArray.length) return {};\n\n return {\n query: {\n nested: {\n path: \"variants\",\n query: {\n bool: {\n must: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n terms: {\n [filter.field]: valueArray,\n },\n },\n ],\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n // define a default query for when settingsHideUnavailable is enabled and the target field is inside variants\n // defaultQuery defines how this filter affects itself i.e. the options displayed\n const defaultQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\n\n // override the aggregation query to filter the results by the variants.available attribute\n return () => {\n return {\n aggs: {\n reactivesearch_nested: {\n nested: { path: \"variants\" },\n aggs: {\n reactify_nested_outer: {\n filter: {\n match: {\n \"variants.available\": \"true\",\n },\n },\n aggs: {\n [filter.field]: {\n terms: {\n field: filter.field,\n size: 100,\n order: { _count: \"desc\" },\n },\n },\n },\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n const reactiveFilterSharedProps = React.useMemo(\n () => ({\n nestedField,\n customQuery,\n defaultQuery,\n URLParams: true,\n componentId: filter.handle,\n dataField: filter.field,\n filterLabel: filter.name,\n react: reactiveReactProp,\n }),\n [filter, reactiveReactProp]\n );\n\n return reactiveFilterSharedProps;\n};\n"]}
@@ -13,10 +13,11 @@ const useReactiveReactProp_1 = require("./useReactiveReactProp");
13
13
  const useReactiveFilterSliderProps = (filter) => {
14
14
  const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle);
15
15
  const reactiveFilterSharedProps = (0, useReactiveFilterSharedProps_1.useReactiveFilterSharedProps)(filter);
16
- return react_1.default.useMemo(() => {
16
+ const reactiveFilterSliderProps = react_1.default.useMemo(() => {
17
17
  var _a;
18
18
  return (Object.assign(Object.assign({}, reactiveFilterSharedProps), { showFilter: (_a = filter.settingsShowFilter) !== null && _a !== void 0 ? _a : true }));
19
19
  }, [filter, reactiveReactProp]);
20
+ return reactiveFilterSliderProps;
20
21
  };
21
22
  exports.useReactiveFilterSliderProps = useReactiveFilterSliderProps;
22
23
  //# sourceMappingURL=useReactiveFilterSliderProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveFilterSliderProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSliderProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,OAAO,eAAK,CAAC,OAAO,CAClB,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,IAC7C,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,4BAA4B,gCAWvC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch RangeSlider component\n */\nexport const useReactiveFilterSliderProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n return React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n showFilter: filter.settingsShowFilter ?? true,\n }),\n [filter, reactiveReactProp]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveFilterSliderProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSliderProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,MAAM,yBAAyB,GAAG,eAAK,CAAC,OAAO,CAC7C,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,IAC7C,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;IAEF,OAAO,yBAAyB,CAAC;AACnC,CAAC,CAAC;AAbW,QAAA,4BAA4B,gCAavC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch RangeSlider component\n */\nexport const useReactiveFilterSliderProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n const reactiveFilterSliderProps = React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n showFilter: filter.settingsShowFilter ?? true,\n }),\n [filter, reactiveReactProp]\n );\n\n return reactiveFilterSliderProps;\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import ReactiveList from "@appbaseio/reactivesearch/lib/components/result/ReactiveList";
3
+ export declare const useReactiveReactiveListProps: (options: {
4
+ pageSize?: number;
5
+ }) => React.ComponentProps<typeof ReactiveList>;
@@ -3,18 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useReactiveResultStackProps = void 0;
6
+ exports.useReactiveReactiveListProps = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const hooks_1 = require("../../hooks");
9
9
  const useReactiveReactProp_1 = require("./useReactiveReactProp");
10
- const useReactiveResultStackProps = (options) => {
10
+ const useReactiveReactiveListProps = (options) => {
11
11
  const { filterStack } = (0, hooks_1.useFilterStack)();
12
12
  const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)();
13
13
  const size = react_1.default.useMemo(() => {
14
14
  var _a, _b;
15
15
  return (_b = (_a = options.pageSize) !== null && _a !== void 0 ? _a : filterStack === null || filterStack === void 0 ? void 0 : filterStack.pageSize) !== null && _b !== void 0 ? _b : 20;
16
16
  }, [options.pageSize, filterStack]);
17
- return react_1.default.useMemo(() => ({
17
+ const reactiveReactiveListProps = react_1.default.useMemo(() => ({
18
18
  size,
19
19
  URLParams: true,
20
20
  showLoader: false,
@@ -27,6 +27,7 @@ const useReactiveResultStackProps = (options) => {
27
27
  infiniteScroll: (filterStack === null || filterStack === void 0 ? void 0 : filterStack.paginationType) === "infinite_scroll",
28
28
  renderNoResults: () => null, // always use only render, otherwise both are shown
29
29
  }), [filterStack, reactiveReactProp, options.pageSize]);
30
+ return reactiveReactiveListProps;
30
31
  };
31
- exports.useReactiveResultStackProps = useReactiveResultStackProps;
32
- //# sourceMappingURL=useReactiveResultStackProps.js.map
32
+ exports.useReactiveReactiveListProps = useReactiveReactiveListProps;
33
+ //# sourceMappingURL=useReactiveReactiveListProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReactiveReactiveListProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveReactiveListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAA6C;AAC7C,iEAA8D;AAEvD,MAAM,4BAA4B,GAAG,CAAC,OAE5C,EAA6C,EAAE;IAC9C,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,sBAAc,GAAE,CAAC;IACzC,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,GAAE,CAAC;IAEjD,MAAM,IAAI,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QAC9B,OAAO,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,mCAAI,EAAE,CAAC;IACzD,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAEpC,MAAM,yBAAyB,GAAG,eAAK,CAAC,OAAO,CAC7C,GAAG,EAAE,CAAC,CAAC;QACL,IAAI;QACJ,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,OAAO;QAClB,eAAe,EAAE,KAAK;QACtB,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,MAAM;QACnB,cAAc,EAAE,KAAK;QACrB,UAAU,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,MAAK,iBAAiB;QAC7D,cAAc,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,MAAK,iBAAiB;QACjE,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,mDAAmD;KACjF,CAAC,EACF,CAAC,WAAW,EAAE,iBAAiB,EAAE,OAAO,CAAC,QAAQ,CAAC,CACnD,CAAC;IAEF,OAAO,yBAAyB,CAAC;AACnC,CAAC,CAAC;AA5BW,QAAA,4BAA4B,gCA4BvC","sourcesContent":["import React from \"react\";\nimport ReactiveList from \"@appbaseio/reactivesearch/lib/components/result/ReactiveList\";\n\nimport { useFilterStack } from \"../../hooks\";\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\nexport const useReactiveReactiveListProps = (options: {\n pageSize?: number;\n}): React.ComponentProps<typeof ReactiveList> => {\n const { filterStack } = useFilterStack();\n const reactiveReactProp = useReactiveReactProp();\n\n const size = React.useMemo(() => {\n return options.pageSize ?? filterStack?.pageSize ?? 20;\n }, [options.pageSize, filterStack]);\n\n const reactiveReactiveListProps = React.useMemo(\n () => ({\n size,\n URLParams: true,\n showLoader: false,\n dataField: \"title\",\n showResultStats: false,\n react: reactiveReactProp,\n componentId: \"page\", // this sets ?page= in the URL\n scrollOnChange: false, // @todo make this better, it's really janky when enabled\n pagination: filterStack?.paginationType !== \"infinite_scroll\",\n infiniteScroll: filterStack?.paginationType === \"infinite_scroll\",\n renderNoResults: () => null, // always use only render, otherwise both are shown\n }),\n [filterStack, reactiveReactProp, options.pageSize]\n );\n\n return reactiveReactiveListProps;\n};\n"]}
@@ -5,12 +5,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.useFilterListProps = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
+ const hooks_1 = require("../hooks");
9
+ const utility_1 = require("../utility");
8
10
  // converts reactivesearch props returned in filters to a cleaned up/filtered version
9
11
  const useFilterListProps = (filter, reactivesearchFilterProps) => {
10
- return react_1.default.useMemo(() => {
11
- const { data, value } = reactivesearchFilterProps;
12
+ const { track } = (0, hooks_1.useAnalytics)();
13
+ const handleChange = react_1.default.useCallback((value) => {
14
+ utility_1.debug.breadcrumb({
15
+ category: "filter",
16
+ message: "filter option changed",
17
+ data: {
18
+ filter: filter.name,
19
+ field: filter.field,
20
+ value: value,
21
+ },
22
+ });
23
+ utility_1.debug.log("useFilterListProps", "handleChange[value]", value);
24
+ reactivesearchFilterProps.handleChange(value);
25
+ track({
26
+ eventName: "filterChange",
27
+ payload: {
28
+ name: filter.name,
29
+ value: value,
30
+ },
31
+ });
32
+ }, [filter]);
33
+ const filterListProps = react_1.default.useMemo(() => {
12
34
  // remove excluded options, sort alphabeticaly, map checked boolean
13
- const options = data
35
+ const options = reactivesearchFilterProps.data
14
36
  .filter(({ key }) => {
15
37
  var _a, _b;
16
38
  if ((_a = filter.valuesExclude) === null || _a === void 0 ? void 0 : _a.includes(key))
@@ -20,17 +42,22 @@ const useFilterListProps = (filter, reactivesearchFilterProps) => {
20
42
  return true;
21
43
  })
22
44
  .sort((a, b) => a.key.localeCompare(b.key))
23
- .map((option) => (Object.assign(Object.assign({}, option), { checked: (typeof value === "object" && value[option.key]) ||
24
- value === option.key })));
45
+ .map((option) => (Object.assign(Object.assign({}, option), { checked: (typeof reactivesearchFilterProps.value === "object" &&
46
+ reactivesearchFilterProps.value[option.key]) ||
47
+ reactivesearchFilterProps.value === option.key })));
25
48
  // work out if at least one option selected
26
- const hasSelected = (typeof value === "object" && 0 < Object.keys(value).length) ||
27
- (typeof value !== "object" && !!value);
49
+ const hasSelected = (typeof reactivesearchFilterProps.value === "object" &&
50
+ 0 < Object.keys(reactivesearchFilterProps.value).length) ||
51
+ (typeof reactivesearchFilterProps.value !== "object" &&
52
+ !!reactivesearchFilterProps.value);
28
53
  const totalSelected = options.filter((option) => option.checked).length;
29
- return Object.assign(Object.assign({}, reactivesearchFilterProps), { filter,
54
+ return Object.assign(Object.assign({}, reactivesearchFilterProps), { handleChange,
55
+ filter,
30
56
  options,
31
57
  hasSelected,
32
58
  totalSelected });
33
- }, [filter, reactivesearchFilterProps]);
59
+ }, [filter, handleChange, reactivesearchFilterProps]);
60
+ return filterListProps;
34
61
  };
35
62
  exports.useFilterListProps = useFilterListProps;
36
63
  //# sourceMappingURL=useFilterListProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFilterListProps.js","sourceRoot":"","sources":["../../../src/hooks/useFilterListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAK1B,qFAAqF;AAC9E,MAAM,kBAAkB,GAAG,CAChC,MAA0B,EAC1B,yBAAoD,EAUpD,EAAE;IACF,OAAO,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,yBAAyB,CAAC;QAElD,mEAAmE;QACnE,MAAM,OAAO,GAAG,IAAI;aACjB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,E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from \"../types/reactivesearch\";\n\n// converts reactivesearch props returned in filters to a cleaned up/filtered version\nexport const useFilterListProps = (\n filter: ConfigFilterOption,\n reactivesearchFilterProps: ReactivesearchFilterProps\n): ReactivesearchFilterProps & {\n filter: ConfigFilterOption;\n options: Array<{\n doc_count: number;\n key: string;\n checked: boolean;\n }>;\n hasSelected: boolean;\n totalSelected: number;\n} => {\n return React.useMemo(() => {\n const { data, value } = reactivesearchFilterProps;\n\n // remove excluded options, sort alphabeticaly, map checked boolean\n const options = data\n .filter(({ key }) => {\n if (filter.valuesExclude?.includes(key)) return false;\n if (!!filter.valuesManual?.length && !filter.valuesManual.includes(key))\n return false;\n return true;\n })\n .sort((a, b) => a.key.localeCompare(b.key))\n .map((option) => ({\n ...option,\n checked:\n (typeof value === \"object\" && value[option.key]) ||\n value === option.key,\n }));\n\n // work out if at least one option selected\n const hasSelected =\n (typeof value === \"object\" && 0 < Object.keys(value).length) ||\n (typeof value !== \"object\" && !!value);\n\n const totalSelected = options.filter((option) => option.checked).length;\n\n return {\n ...reactivesearchFilterProps,\n filter,\n options,\n hasSelected,\n totalSelected,\n };\n }, [filter, reactivesearchFilterProps]);\n};\n"]}
1
+ {"version":3,"file":"useFilterListProps.js","sourceRoot":"","sources":["../../../src/hooks/useFilterListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,oCAAwC;AACxC,wCAAmC;AAEnC,qFAAqF;AAC9E,MAAM,kBAAkB,GAAG,CAChC,MAA0B,EAC1B,yBAAoD,EAUpD,EAAE;IACF,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,eAAK,CAAC,WAAW,CACpC,CAAC,KAAa,EAAE,EAAE;QAChB,eAAK,CAAC,UAAU,CAAC;YACf,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,uBAAuB;YAChC,IAAI,EAAE;gBACJ,MAAM,EAAE,MAAM,CAAC,IAAI;gBACnB,KAAK,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AC,CAAC;QAEN,2CAA2C;QAC3C,MAAM,WAAW,GACf,CAAC,OAAO,yBAAyB,CAAC,KAAK,KAAK,QAAQ;YAClD,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;YAC1D,CAAC,OAAO,yBAAyB,CAAC,KAAK,KAAK,QAAQ;gBAClD,CAAC,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;QAEvC,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;QAExE,uCACK,yBAAyB,KAC5B,YAAY;YACZ,MAAM;YACN,OAAO;YACP,WAAW;YACX,aAAa,IACb;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,yBAAyB,CAAC,CAAC,CAAC;IAEtD,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AA/EW,QAAA,kBAAkB,sBA+E7B","sourcesContent":["import React from \"react\";\n\nimport { ConfigFilterOption } from \"../types/config\";\nimport { ReactivesearchFilterProps } from \"../types/reactivesearch\";\nimport { useAnalytics } from \"../hooks\";\nimport { debug } from \"../utility\";\n\n// converts reactivesearch props returned in filters to a cleaned up/filtered version\nexport const useFilterListProps = (\n filter: ConfigFilterOption,\n reactivesearchFilterProps: ReactivesearchFilterProps\n): ReactivesearchFilterProps & {\n filter: ConfigFilterOption;\n options: Array<{\n doc_count: number;\n key: string;\n checked: boolean;\n }>;\n hasSelected: boolean;\n totalSelected: number;\n} => {\n const { track } = useAnalytics();\n\n const handleChange = React.useCallback(\n (value: string) => {\n debug.breadcrumb({\n category: \"filter\",\n message: \"filter option changed\",\n data: {\n filter: filter.name,\n field: filter.field,\n value: value,\n },\n });\n\n debug.log(\"useFilterListProps\", \"handleChange[value]\", value);\n\n reactivesearchFilterProps.handleChange(value);\n track({\n eventName: \"filterChange\",\n payload: {\n name: filter.name,\n value: value,\n },\n });\n },\n [filter]\n );\n\n const filterListProps = React.useMemo(() => {\n // remove excluded options, sort alphabeticaly, map checked boolean\n const options = reactivesearchFilterProps.data\n .filter(({ key }) => {\n if (filter.valuesExclude?.includes(key)) return false;\n if (!!filter.valuesManual?.length && !filter.valuesManual.includes(key))\n return false;\n return true;\n })\n .sort((a, b) => a.key.localeCompare(b.key))\n .map((option) => ({\n ...option,\n checked:\n (typeof reactivesearchFilterProps.value === \"object\" &&\n reactivesearchFilterProps.value[option.key]) ||\n reactivesearchFilterProps.value === option.key,\n }));\n\n // work out if at least one option selected\n const hasSelected =\n (typeof reactivesearchFilterProps.value === \"object\" &&\n 0 < Object.keys(reactivesearchFilterProps.value).length) ||\n (typeof reactivesearchFilterProps.value !== \"object\" &&\n !!reactivesearchFilterProps.value);\n\n const totalSelected = options.filter((option) => option.checked).length;\n\n return {\n ...reactivesearchFilterProps,\n handleChange,\n filter,\n options,\n hasSelected,\n totalSelected,\n };\n }, [filter, handleChange, reactivesearchFilterProps]);\n\n return filterListProps;\n};\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.0.0-beta.10",
4
+ "version": "5.0.0-beta.11",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -1,17 +0,0 @@
1
- export declare const useReactiveResultStackProps: (options: {
2
- pageSize?: number;
3
- }) => {
4
- size: number;
5
- URLParams: boolean;
6
- showLoader: boolean;
7
- dataField: string;
8
- showResultStats: boolean;
9
- react: {
10
- and: string[];
11
- };
12
- componentId: string;
13
- scrollOnChange: boolean;
14
- pagination: boolean;
15
- infiniteScroll: boolean;
16
- renderNoResults: () => null;
17
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"useReactiveResultStackProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveResultStackProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAA6C;AAC7C,iEAA8D;AAEvD,MAAM,2BAA2B,GAAG,CAAC,OAA8B,EAAE,EAAE;IAC5E,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,sBAAc,GAAE,CAAC;IACzC,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,GAAE,CAAC;IAEjD,MAAM,IAAI,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QAC9B,OAAO,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,mCAAI,EAAE,CAAC;IACzD,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAEpC,OAAO,eAAK,CAAC,OAAO,CAClB,GAAG,EAAE,CAAC,CAAC;QACL,IAAI;QACJ,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,OAAO;QAClB,eAAe,EAAE,KAAK;QACtB,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,MAAM;QACnB,cAAc,EAAE,KAAK;QACrB,UAAU,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,MAAK,iBAAiB;QAC7D,cAAc,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,MAAK,iBAAiB;QACjE,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,mDAAmD;KACjF,CAAC,EACF,CAAC,WAAW,EAAE,iBAAiB,EAAE,OAAO,CAAC,QAAQ,CAAC,CACnD,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,2BAA2B,+BAwBtC","sourcesContent":["import React from \"react\";\n\nimport { useFilterStack } from \"../../hooks\";\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\nexport const useReactiveResultStackProps = (options: { pageSize?: number }) => {\n const { filterStack } = useFilterStack();\n const reactiveReactProp = useReactiveReactProp();\n\n const size = React.useMemo(() => {\n return options.pageSize ?? filterStack?.pageSize ?? 20;\n }, [options.pageSize, filterStack]);\n\n return React.useMemo(\n () => ({\n size,\n URLParams: true,\n showLoader: false,\n dataField: \"title\",\n showResultStats: false,\n react: reactiveReactProp,\n componentId: \"page\", // this sets ?page= in the URL\n scrollOnChange: false, // @todo make this better, it's really janky when enabled\n pagination: filterStack?.paginationType !== \"infinite_scroll\",\n infiniteScroll: filterStack?.paginationType === \"infinite_scroll\",\n renderNoResults: () => null, // always use only render, otherwise both are shown\n }),\n [filterStack, reactiveReactProp, options.pageSize]\n );\n};\n"]}