@usereactify/search 5.59.0 → 5.59.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/package.json +7 -5
  3. package/dist/src/components/ClearAll/ClearAll.d.ts +1 -1
  4. package/dist/src/components/ClearAll/ClearAll.js +4 -9
  5. package/dist/src/components/ClearAll/ClearAll.js.map +1 -1
  6. package/dist/src/components/CustomComponent/CustomComponent.d.ts +1 -1
  7. package/dist/src/components/CustomComponent/CustomComponent.js +2 -2
  8. package/dist/src/components/CustomComponent/CustomComponent.js.map +1 -1
  9. package/dist/src/components/Example/ExampleClearAll.d.ts +2 -2
  10. package/dist/src/components/Example/ExampleClearAll.js +2 -5
  11. package/dist/src/components/Example/ExampleClearAll.js.map +1 -1
  12. package/dist/src/components/Example/ExampleCustomComponent.d.ts +1 -1
  13. package/dist/src/components/Example/ExampleCustomComponent.js +3 -7
  14. package/dist/src/components/Example/ExampleCustomComponent.js.map +1 -1
  15. package/dist/src/components/Example/ExampleFilterList.d.ts +2 -2
  16. package/dist/src/components/Example/ExampleFilterList.js +31 -66
  17. package/dist/src/components/Example/ExampleFilterList.js.map +1 -1
  18. package/dist/src/components/Example/ExampleFilterRange.d.ts +2 -2
  19. package/dist/src/components/Example/ExampleFilterRange.js +2 -12
  20. package/dist/src/components/Example/ExampleFilterRange.js.map +1 -1
  21. package/dist/src/components/Example/ExampleFilterSlider.d.ts +2 -2
  22. package/dist/src/components/Example/ExampleFilterSlider.js +11 -18
  23. package/dist/src/components/Example/ExampleFilterSlider.js.map +1 -1
  24. package/dist/src/components/Example/ExampleFilters.d.ts +1 -1
  25. package/dist/src/components/Example/ExampleFilters.js +3 -8
  26. package/dist/src/components/Example/ExampleFilters.js.map +1 -1
  27. package/dist/src/components/Example/ExampleFiltersSelected.d.ts +2 -2
  28. package/dist/src/components/Example/ExampleFiltersSelected.js +3 -24
  29. package/dist/src/components/Example/ExampleFiltersSelected.js.map +1 -1
  30. package/dist/src/components/Example/ExampleHookUseFilters.d.ts +1 -1
  31. package/dist/src/components/Example/ExampleHookUseFilters.js +3 -10
  32. package/dist/src/components/Example/ExampleHookUseFilters.js.map +1 -1
  33. package/dist/src/components/Example/ExampleHookUseResults.d.ts +1 -1
  34. package/dist/src/components/Example/ExampleHookUseResults.js +3 -8
  35. package/dist/src/components/Example/ExampleHookUseResults.js.map +1 -1
  36. package/dist/src/components/Example/ExampleHookUseSearch.js +2 -2
  37. package/dist/src/components/Example/ExampleHookUseSearch.js.map +1 -1
  38. package/dist/src/components/Example/ExampleHookUseSortBy.js +2 -1
  39. package/dist/src/components/Example/ExampleHookUseSortBy.js.map +1 -1
  40. package/dist/src/components/Example/ExampleProductCardWeight.d.ts +1 -1
  41. package/dist/src/components/Example/ExampleProductCardWeight.js +14 -47
  42. package/dist/src/components/Example/ExampleProductCardWeight.js.map +1 -1
  43. package/dist/src/components/Example/ExampleReactiveSearchProviderCollection.d.ts +1 -1
  44. package/dist/src/components/Example/ExampleReactiveSearchProviderCollection.js +2 -6
  45. package/dist/src/components/Example/ExampleReactiveSearchProviderCollection.js.map +1 -1
  46. package/dist/src/components/Example/ExampleReactiveSearchProviderInstantSearch.d.ts +1 -1
  47. package/dist/src/components/Example/ExampleReactiveSearchProviderInstantSearch.js +2 -6
  48. package/dist/src/components/Example/ExampleReactiveSearchProviderInstantSearch.js.map +1 -1
  49. package/dist/src/components/Example/ExampleReactiveSearchProviderSearch.d.ts +1 -1
  50. package/dist/src/components/Example/ExampleReactiveSearchProviderSearch.js +2 -6
  51. package/dist/src/components/Example/ExampleReactiveSearchProviderSearch.js.map +1 -1
  52. package/dist/src/components/Example/ExampleResultCardCallout.d.ts +1 -1
  53. package/dist/src/components/Example/ExampleResultCardCallout.js +2 -4
  54. package/dist/src/components/Example/ExampleResultCardCallout.js.map +1 -1
  55. package/dist/src/components/Example/ExampleResultCardProduct.d.ts +2 -2
  56. package/dist/src/components/Example/ExampleResultCardProduct.js +2 -12
  57. package/dist/src/components/Example/ExampleResultCardProduct.js.map +1 -1
  58. package/dist/src/components/Example/ExampleResultPaginationInfiniteScroll.d.ts +2 -2
  59. package/dist/src/components/Example/ExampleResultPaginationInfiniteScroll.js +2 -5
  60. package/dist/src/components/Example/ExampleResultPaginationInfiniteScroll.js.map +1 -1
  61. package/dist/src/components/Example/ExampleResultPaginationLoadMore.d.ts +2 -2
  62. package/dist/src/components/Example/ExampleResultPaginationLoadMore.js +2 -5
  63. package/dist/src/components/Example/ExampleResultPaginationLoadMore.js.map +1 -1
  64. package/dist/src/components/Example/ExampleResultPaginationNextPrev.d.ts +2 -2
  65. package/dist/src/components/Example/ExampleResultPaginationNextPrev.js +2 -7
  66. package/dist/src/components/Example/ExampleResultPaginationNextPrev.js.map +1 -1
  67. package/dist/src/components/Example/ExampleResultPaginationNumbered.d.ts +2 -2
  68. package/dist/src/components/Example/ExampleResultPaginationNumbered.js +6 -20
  69. package/dist/src/components/Example/ExampleResultPaginationNumbered.js.map +1 -1
  70. package/dist/src/components/Example/ExampleResults.d.ts +1 -1
  71. package/dist/src/components/Example/ExampleResults.js +7 -10
  72. package/dist/src/components/Example/ExampleResults.js.map +1 -1
  73. package/dist/src/components/Example/ExampleSearch.d.ts +1 -1
  74. package/dist/src/components/Example/ExampleSearch.js +2 -2
  75. package/dist/src/components/Example/ExampleSearch.js.map +1 -1
  76. package/dist/src/components/Example/ExampleSortBy.d.ts +2 -2
  77. package/dist/src/components/Example/ExampleSortBy.js +2 -5
  78. package/dist/src/components/Example/ExampleSortBy.js.map +1 -1
  79. package/dist/src/components/Example/ExampleStats.d.ts +2 -2
  80. package/dist/src/components/Example/ExampleStats.js +2 -8
  81. package/dist/src/components/Example/ExampleStats.js.map +1 -1
  82. package/dist/src/components/Example/ExampleSuggestions.d.ts +2 -2
  83. package/dist/src/components/Example/ExampleSuggestions.js +2 -7
  84. package/dist/src/components/Example/ExampleSuggestions.js.map +1 -1
  85. package/dist/src/components/Example/index.d.ts +6 -6
  86. package/dist/src/components/Example/index.js +6 -6
  87. package/dist/src/components/Example/index.js.map +1 -1
  88. package/dist/src/components/Filter/Filter.d.ts +1 -1
  89. package/dist/src/components/Filter/Filter.js +30 -35
  90. package/dist/src/components/Filter/Filter.js.map +1 -1
  91. package/dist/src/components/Filter/Filters.d.ts +4 -4
  92. package/dist/src/components/Filter/Filters.js +3 -6
  93. package/dist/src/components/Filter/Filters.js.map +1 -1
  94. package/dist/src/components/Filter/FiltersSelected.d.ts +1 -1
  95. package/dist/src/components/Filter/FiltersSelected.js +4 -9
  96. package/dist/src/components/Filter/FiltersSelected.js.map +1 -1
  97. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.d.ts +2 -2
  98. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js +20 -8
  99. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js.map +1 -1
  100. package/dist/src/components/Result/ResultCardCallout.d.ts +2 -2
  101. package/dist/src/components/Result/ResultCardCallout.js +3 -2
  102. package/dist/src/components/Result/ResultCardCallout.js.map +1 -1
  103. package/dist/src/components/Result/ResultCardProduct.d.ts +1 -1
  104. package/dist/src/components/Result/ResultCardProduct.js +4 -3
  105. package/dist/src/components/Result/ResultCardProduct.js.map +1 -1
  106. package/dist/src/components/Result/ResultPaginationInfiniteScroll.d.ts +3 -3
  107. package/dist/src/components/Result/ResultPaginationInfiniteScroll.js +3 -6
  108. package/dist/src/components/Result/ResultPaginationInfiniteScroll.js.map +1 -1
  109. package/dist/src/components/Result/ResultPaginationLoadMore.d.ts +3 -3
  110. package/dist/src/components/Result/ResultPaginationLoadMore.js +3 -6
  111. package/dist/src/components/Result/ResultPaginationLoadMore.js.map +1 -1
  112. package/dist/src/components/Result/ResultPaginationNextPrev.d.ts +3 -3
  113. package/dist/src/components/Result/ResultPaginationNextPrev.js +3 -6
  114. package/dist/src/components/Result/ResultPaginationNextPrev.js.map +1 -1
  115. package/dist/src/components/Result/ResultPaginationNumbered.d.ts +3 -3
  116. package/dist/src/components/Result/ResultPaginationNumbered.js +3 -6
  117. package/dist/src/components/Result/ResultPaginationNumbered.js.map +1 -1
  118. package/dist/src/components/Result/ResultStateProvider.d.ts +2 -2
  119. package/dist/src/components/Result/ResultStateProvider.js +3 -3
  120. package/dist/src/components/Result/ResultStateProvider.js.map +1 -1
  121. package/dist/src/components/Result/Results.d.ts +2 -2
  122. package/dist/src/components/Result/Results.js +50 -52
  123. package/dist/src/components/Result/Results.js.map +1 -1
  124. package/dist/src/components/Result/index.d.ts +4 -4
  125. package/dist/src/components/Result/index.js +4 -4
  126. package/dist/src/components/Result/index.js.map +1 -1
  127. package/dist/src/components/Search/Search.d.ts +1 -1
  128. package/dist/src/components/Search/Search.js +3 -6
  129. package/dist/src/components/Search/Search.js.map +1 -1
  130. package/dist/src/components/Sensor/SensorCollection.d.ts +1 -1
  131. package/dist/src/components/Sensor/SensorCollection.js +2 -2
  132. package/dist/src/components/Sensor/SensorCollection.js.map +1 -1
  133. package/dist/src/components/Sensor/SensorCustom.d.ts +1 -2
  134. package/dist/src/components/Sensor/SensorCustom.js +5 -6
  135. package/dist/src/components/Sensor/SensorCustom.js.map +1 -1
  136. package/dist/src/components/Sensor/SensorExplain.js +2 -2
  137. package/dist/src/components/Sensor/SensorExplain.js.map +1 -1
  138. package/dist/src/components/Sensor/SensorInventoryAvailable.d.ts +1 -1
  139. package/dist/src/components/Sensor/SensorInventoryAvailable.js +2 -2
  140. package/dist/src/components/Sensor/SensorInventoryAvailable.js.map +1 -1
  141. package/dist/src/components/Sensor/SensorPublished.d.ts +1 -1
  142. package/dist/src/components/Sensor/SensorPublished.js +2 -2
  143. package/dist/src/components/Sensor/SensorPublished.js.map +1 -1
  144. package/dist/src/components/Sensor/SensorSearchTerm.d.ts +1 -2
  145. package/dist/src/components/Sensor/SensorSearchTerm.js +19 -124
  146. package/dist/src/components/Sensor/SensorSearchTerm.js.map +1 -1
  147. package/dist/src/components/Sensor/SensorSort.d.ts +1 -1
  148. package/dist/src/components/Sensor/SensorSort.js +2 -2
  149. package/dist/src/components/Sensor/SensorSort.js.map +1 -1
  150. package/dist/src/components/Sensor/Sensors.d.ts +1 -3
  151. package/dist/src/components/Sensor/Sensors.js +13 -46
  152. package/dist/src/components/Sensor/Sensors.js.map +1 -1
  153. package/dist/src/components/Sensor/index.d.ts +7 -9
  154. package/dist/src/components/Sensor/index.js +6 -10
  155. package/dist/src/components/Sensor/index.js.map +1 -1
  156. package/dist/src/components/SortBy/SortBy.d.ts +1 -1
  157. package/dist/src/components/SortBy/SortBy.js +3 -6
  158. package/dist/src/components/SortBy/SortBy.js.map +1 -1
  159. package/dist/src/components/Stats/Stats.d.ts +2 -2
  160. package/dist/src/components/Stats/Stats.js +2 -5
  161. package/dist/src/components/Stats/Stats.js.map +1 -1
  162. package/dist/src/components/Suggestions/Suggestions.d.ts +1 -1
  163. package/dist/src/components/Suggestions/Suggestions.js +7 -8
  164. package/dist/src/components/Suggestions/Suggestions.js.map +1 -1
  165. package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.d.ts +1 -1
  166. package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.js +3 -3
  167. package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.js.map +1 -1
  168. package/dist/src/components/Utility/index.js.map +1 -1
  169. package/dist/src/components/index.d.ts +2 -2
  170. package/dist/src/components/index.js +2 -2
  171. package/dist/src/components/index.js.map +1 -1
  172. package/dist/src/hooks/index.d.ts +11 -11
  173. package/dist/src/hooks/index.js +11 -11
  174. package/dist/src/hooks/index.js.map +1 -1
  175. package/dist/src/hooks/react-slider/useReactSliderProps.d.ts +2 -2
  176. package/dist/src/hooks/react-slider/useReactSliderProps.js +6 -6
  177. package/dist/src/hooks/react-slider/useReactSliderProps.js.map +1 -1
  178. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.d.ts +1 -1
  179. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js +2 -2
  180. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js.map +1 -1
  181. package/dist/src/hooks/useAnalytics.js.map +1 -1
  182. package/dist/src/hooks/useConfig.d.ts +1 -1
  183. package/dist/src/hooks/useConfig.js +1 -1
  184. package/dist/src/hooks/useConfig.js.map +1 -1
  185. package/dist/src/hooks/useCuration.d.ts +1 -1
  186. package/dist/src/hooks/useCuration.js +9 -25
  187. package/dist/src/hooks/useCuration.js.map +1 -1
  188. package/dist/src/hooks/useDebugger.js +3 -3
  189. package/dist/src/hooks/useDebugger.js.map +1 -1
  190. package/dist/src/hooks/useFilterCollapsedState.d.ts +1 -1
  191. package/dist/src/hooks/useFilterCollapsedState.js.map +1 -1
  192. package/dist/src/hooks/useFilterListProps.d.ts +2 -2
  193. package/dist/src/hooks/useFilterListProps.js +7 -11
  194. package/dist/src/hooks/useFilterListProps.js.map +1 -1
  195. package/dist/src/hooks/useFilterRangeProps.d.ts +1 -1
  196. package/dist/src/hooks/useFilterRangeProps.js +11 -14
  197. package/dist/src/hooks/useFilterRangeProps.js.map +1 -1
  198. package/dist/src/hooks/useFilterSliderProps.d.ts +1 -1
  199. package/dist/src/hooks/useFilterSliderProps.js +10 -9
  200. package/dist/src/hooks/useFilterSliderProps.js.map +1 -1
  201. package/dist/src/hooks/useFilters.d.ts +1 -1
  202. package/dist/src/hooks/useFilters.js +4 -7
  203. package/dist/src/hooks/useFilters.js.map +1 -1
  204. package/dist/src/hooks/useIndices.js +2 -2
  205. package/dist/src/hooks/useIndices.js.map +1 -1
  206. package/dist/src/hooks/usePagination.d.ts +1 -1
  207. package/dist/src/hooks/usePagination.js +6 -14
  208. package/dist/src/hooks/usePagination.js.map +1 -1
  209. package/dist/src/hooks/usePaginationLoadable.d.ts +1 -1
  210. package/dist/src/hooks/usePaginationLoadable.js +3 -5
  211. package/dist/src/hooks/usePaginationLoadable.js.map +1 -1
  212. package/dist/src/hooks/useProductPrice.d.ts +1 -1
  213. package/dist/src/hooks/useProductPrice.js +3 -1
  214. package/dist/src/hooks/useProductPrice.js.map +1 -1
  215. package/dist/src/hooks/useReactifySearchContext.d.ts +1 -1
  216. package/dist/src/hooks/useReactifySearchContext.js.map +1 -1
  217. package/dist/src/hooks/useResults.d.ts +1 -1
  218. package/dist/src/hooks/useResults.js +4 -4
  219. package/dist/src/hooks/useResults.js.map +1 -1
  220. package/dist/src/hooks/useSearch.d.ts +1 -1
  221. package/dist/src/hooks/useSearch.js +8 -9
  222. package/dist/src/hooks/useSearch.js.map +1 -1
  223. package/dist/src/hooks/useSortBy.d.ts +1 -1
  224. package/dist/src/hooks/useSortBy.js +1 -1
  225. package/dist/src/hooks/useSortBy.js.map +1 -1
  226. package/dist/src/index.js.map +1 -1
  227. package/dist/src/search-request-builder/base-builders.d.ts +18 -0
  228. package/dist/src/search-request-builder/base-builders.js +184 -0
  229. package/dist/src/search-request-builder/base-builders.js.map +1 -0
  230. package/dist/src/search-request-builder/curation-builders.d.ts +2 -0
  231. package/dist/src/search-request-builder/curation-builders.js +44 -0
  232. package/dist/src/search-request-builder/curation-builders.js.map +1 -0
  233. package/dist/src/search-request-builder/index.d.ts +3 -0
  234. package/dist/src/search-request-builder/index.js +12 -0
  235. package/dist/src/search-request-builder/index.js.map +1 -0
  236. package/dist/src/search-request-builder/search-request-builder.d.ts +3 -0
  237. package/dist/src/search-request-builder/search-request-builder.js +54 -0
  238. package/dist/src/search-request-builder/search-request-builder.js.map +1 -0
  239. package/dist/src/search-request-builder/types.d.ts +105 -0
  240. package/dist/src/search-request-builder/types.js +30 -0
  241. package/dist/src/search-request-builder/types.js.map +1 -0
  242. package/dist/src/search-request-builder/utils.d.ts +27 -0
  243. package/dist/src/search-request-builder/utils.js +144 -0
  244. package/dist/src/search-request-builder/utils.js.map +1 -0
  245. package/dist/src/types/config.d.ts +1 -1
  246. package/dist/src/types/config.js.map +1 -1
  247. package/dist/src/types/elastic.d.ts +8 -11
  248. package/dist/src/types/elastic.js.map +1 -1
  249. package/dist/src/types/firestore.d.ts +5 -5
  250. package/dist/src/types/firestore.js.map +1 -1
  251. package/dist/src/types/index.js.map +1 -1
  252. package/dist/src/types/reactivesearch.d.ts +1 -1
  253. package/dist/src/types/reactivesearch.js.map +1 -1
  254. package/dist/src/types/shopify.d.ts +1 -1
  255. package/dist/src/types/shopify.js.map +1 -1
  256. package/dist/src/utility/config.d.ts +1 -1
  257. package/dist/src/utility/config.js +1 -1
  258. package/dist/src/utility/config.js.map +1 -1
  259. package/dist/src/utility/curation.d.ts +2 -2
  260. package/dist/src/utility/curation.js +1 -1
  261. package/dist/src/utility/curation.js.map +1 -1
  262. package/dist/src/utility/debug.js +1 -1
  263. package/dist/src/utility/debug.js.map +1 -1
  264. package/dist/src/utility/filters.d.ts +2 -2
  265. package/dist/src/utility/filters.js.map +1 -1
  266. package/dist/src/utility/liquid.d.ts +2 -2
  267. package/dist/src/utility/liquid.js +2 -5
  268. package/dist/src/utility/liquid.js.map +1 -1
  269. package/dist/src/utility/props.d.ts +7 -226
  270. package/dist/src/utility/props.js +61 -108
  271. package/dist/src/utility/props.js.map +1 -1
  272. package/dist/src/utility/server.d.ts +1 -1
  273. package/dist/src/utility/server.js +3 -3
  274. package/dist/src/utility/server.js.map +1 -1
  275. package/dist/src/utility/sortOption.d.ts +2 -2
  276. package/dist/src/utility/sortOption.js.map +1 -1
  277. package/package.json +7 -5
  278. package/dist/src/components/Sensor/SensorCollectionWeighted.d.ts +0 -1
  279. package/dist/src/components/Sensor/SensorCollectionWeighted.js +0 -21
  280. package/dist/src/components/Sensor/SensorCollectionWeighted.js.map +0 -1
  281. package/dist/src/components/Sensor/SensorSearchWeighted.d.ts +0 -1
  282. package/dist/src/components/Sensor/SensorSearchWeighted.js +0 -22
  283. package/dist/src/components/Sensor/SensorSearchWeighted.js.map +0 -1
  284. package/dist/src/utility/queries.d.ts +0 -393
  285. package/dist/src/utility/queries.js +0 -197
  286. package/dist/src/utility/queries.js.map +0 -1
@@ -15,35 +15,36 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.Filter = void 0;
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
18
19
  const react_1 = __importDefault(require("react"));
19
20
  const ReactiveComponent_1 = __importDefault(require("@usereactify/search-internals/lib/components/basic/ReactiveComponent"));
20
21
  const MultiList_1 = __importDefault(require("@usereactify/search-internals/lib/components/list/MultiList"));
21
22
  const SingleList_1 = __importDefault(require("@usereactify/search-internals/lib/components/list/SingleList"));
22
- const SingleRange_1 = __importDefault(require("@usereactify/search-internals/lib/components/range/SingleRange"));
23
23
  const MultiRange_1 = __importDefault(require("@usereactify/search-internals/lib/components/range/MultiRange"));
24
- const hooks_1 = require("../../hooks");
24
+ const SingleRange_1 = __importDefault(require("@usereactify/search-internals/lib/components/range/SingleRange"));
25
25
  const components_1 = require("../../components");
26
- const props_1 = require("../../utility/props");
26
+ const hooks_1 = require("../../hooks");
27
27
  const useReactSliderProps_1 = require("../../hooks/react-slider/useReactSliderProps");
28
+ const props_1 = require("../../utility/props");
28
29
  const Filter = (props) => {
29
30
  if ("single" === props.filter.displayType) {
30
31
  if ("range" === props.filter.displayView) {
31
- return react_1.default.createElement(FilterRangeSingle, Object.assign({}, props));
32
+ return (0, jsx_runtime_1.jsx)(FilterRangeSingle, Object.assign({}, props));
32
33
  }
33
- return react_1.default.createElement(FilterSingleList, Object.assign({}, props));
34
+ return (0, jsx_runtime_1.jsx)(FilterSingleList, Object.assign({}, props));
34
35
  }
35
36
  if ("multi" === props.filter.displayType) {
36
37
  if ("range" === props.filter.displayView) {
37
- return react_1.default.createElement(FilterRangeMulti, Object.assign({}, props));
38
+ return (0, jsx_runtime_1.jsx)(FilterRangeMulti, Object.assign({}, props));
38
39
  }
39
- return react_1.default.createElement(FilterMultiList, Object.assign({}, props));
40
+ return (0, jsx_runtime_1.jsx)(FilterMultiList, Object.assign({}, props));
40
41
  }
41
42
  if ("slider" === props.filter.displayType) {
42
- return react_1.default.createElement(FilterSlider, Object.assign({}, props));
43
+ return (0, jsx_runtime_1.jsx)(FilterSlider, Object.assign({}, props));
43
44
  }
44
45
  // TODO: Legacy range filter, migrate to new single and multi ranges
45
46
  if ("range" === props.filter.displayType) {
46
- return react_1.default.createElement(FilterRangeSingle, Object.assign({}, props));
47
+ return (0, jsx_runtime_1.jsx)(FilterRangeSingle, Object.assign({}, props));
47
48
  }
48
49
  console.warn(`filter with display type "${props.filter.displayType}" not yet supported`);
49
50
  return null;
@@ -58,7 +59,7 @@ const FilterSingleList = (props) => {
58
59
  filterGroup: filtersHook.filterStack,
59
60
  }, props.filter);
60
61
  const reactiveProps = (0, props_1.getPropsFilterList)(props.filter);
61
- return (react_1.default.createElement(SingleList_1.default, Object.assign({}, sharedProps, reactiveProps, { render: (reactivesearchFilterProps) => (react_1.default.createElement(FilterListInner, Object.assign({}, props, { reactivesearchFilterProps: reactivesearchFilterProps }))) })));
62
+ return ((0, jsx_runtime_1.jsx)(SingleList_1.default, Object.assign({}, sharedProps, reactiveProps, { render: (reactivesearchFilterProps) => ((0, jsx_runtime_1.jsx)(FilterListInner, Object.assign({}, props, { reactivesearchFilterProps: reactivesearchFilterProps }))) })));
62
63
  };
63
64
  const FilterMultiList = (props) => {
64
65
  const reactifySearchContext = (0, hooks_1.useReactifySearchContext)();
@@ -69,7 +70,7 @@ const FilterMultiList = (props) => {
69
70
  filterGroup: filtersHook.filterStack,
70
71
  }, props.filter);
71
72
  const reactiveProps = (0, props_1.getPropsFilterList)(props.filter);
72
- return (react_1.default.createElement(MultiList_1.default, Object.assign({}, sharedProps, reactiveProps, { render: (reactivesearchFilterProps) => (react_1.default.createElement(FilterListInner, Object.assign({}, props, { reactivesearchFilterProps: reactivesearchFilterProps }))) })));
73
+ return ((0, jsx_runtime_1.jsx)(MultiList_1.default, Object.assign({}, sharedProps, reactiveProps, { render: (reactivesearchFilterProps) => ((0, jsx_runtime_1.jsx)(FilterListInner, Object.assign({}, props, { reactivesearchFilterProps: reactivesearchFilterProps }))) })));
73
74
  };
74
75
  const FilterRangeSingle = (props) => {
75
76
  var _a;
@@ -83,12 +84,9 @@ const FilterRangeSingle = (props) => {
83
84
  const reactiveProps = (0, props_1.getPropsFilterRange)(props.filter);
84
85
  const filterRangeProps = (0, hooks_1.useFilterRangeProps)(props.filter);
85
86
  const RenderRangeComponent = (_a = props.renderFilterRange) !== null && _a !== void 0 ? _a : components_1.ExampleFilterRange;
86
- return (react_1.default.createElement(react_1.default.Fragment, null,
87
- react_1.default.createElement("div", { style: {
88
- display: "none",
89
- } },
90
- react_1.default.createElement(SingleRange_1.default, Object.assign({}, sharedProps, reactiveProps, { value: filterRangeProps.values[0], onChange: filterRangeProps.handleChange }))),
91
- react_1.default.createElement(RenderRangeComponent, { filterRangeProps: filterRangeProps, filter: props.filter })));
87
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
88
+ display: "none",
89
+ }, children: (0, jsx_runtime_1.jsx)(SingleRange_1.default, Object.assign({}, sharedProps, reactiveProps, { onChange: filterRangeProps.handleChange, value: filterRangeProps.values[0] })) }), (0, jsx_runtime_1.jsx)(RenderRangeComponent, { filter: props.filter, filterRangeProps: filterRangeProps })] }));
92
90
  };
93
91
  const FilterRangeMulti = (props) => {
94
92
  var _a;
@@ -102,18 +100,15 @@ const FilterRangeMulti = (props) => {
102
100
  const reactiveProps = (0, props_1.getPropsFilterRange)(props.filter);
103
101
  const filterRangeProps = (0, hooks_1.useFilterRangeProps)(props.filter);
104
102
  const RenderRangeComponent = (_a = props.renderFilterRange) !== null && _a !== void 0 ? _a : components_1.ExampleFilterRange;
105
- return (react_1.default.createElement(react_1.default.Fragment, null,
106
- react_1.default.createElement("div", { style: {
107
- display: "none",
108
- } },
109
- react_1.default.createElement(MultiRange_1.default, Object.assign({}, sharedProps, reactiveProps, { value: filterRangeProps.values,
110
- // @note: onChange handler must be defined for controlled component to work correctly
111
- onChange: () => { }, onValueChange: (values) => {
112
- if (values.length === 0) {
113
- filterRangeProps.handleClear();
114
- }
115
- } }))),
116
- react_1.default.createElement(RenderRangeComponent, { filterRangeProps: filterRangeProps, filter: props.filter })));
103
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
104
+ display: "none",
105
+ }, children: (0, jsx_runtime_1.jsx)(MultiRange_1.default, Object.assign({}, sharedProps, reactiveProps, { onChange: () => { },
106
+ // @note: onChange handler must be defined for controlled component to work correctly
107
+ onValueChange: (values) => {
108
+ if (values.length === 0) {
109
+ filterRangeProps.handleClear();
110
+ }
111
+ }, value: filterRangeProps.values })) }), (0, jsx_runtime_1.jsx)(RenderRangeComponent, { filter: props.filter, filterRangeProps: filterRangeProps })] }));
117
112
  };
118
113
  const FilterSlider = (props) => {
119
114
  const reactifySearchContext = (0, hooks_1.useReactifySearchContext)();
@@ -125,9 +120,9 @@ const FilterSlider = (props) => {
125
120
  }, props.filter);
126
121
  const filterSliderProps = (0, hooks_1.useFilterSliderProps)(props.filter);
127
122
  const reactiveProps = (0, props_1.getPropsFilterSlider)(props.filter, "", filterSliderProps.value);
128
- return (react_1.default.createElement(ReactiveComponent_1.default, Object.assign({}, sharedProps, { defaultQuery: () => reactiveProps.defaultQuery, value: filterSliderProps.value, render: (reactivesearchFilterProps) => {
129
- return (react_1.default.createElement(FilterSliderInner, Object.assign({}, props, { filterSliderProps: filterSliderProps, customQuery: reactiveProps.customQuery, reactivesearchFilterProps: reactivesearchFilterProps })));
130
- } })));
123
+ return ((0, jsx_runtime_1.jsx)(ReactiveComponent_1.default, Object.assign({}, sharedProps, { defaultQuery: () => reactiveProps.defaultQuery, render: (reactivesearchFilterProps) => {
124
+ return ((0, jsx_runtime_1.jsx)(FilterSliderInner, Object.assign({}, props, { customQuery: reactiveProps.customQuery, filterSliderProps: filterSliderProps, reactivesearchFilterProps: reactivesearchFilterProps })));
125
+ }, value: filterSliderProps.value })));
131
126
  };
132
127
  // inner component exists only so we can use memos in reactivesearch render functions
133
128
  const FilterSliderInner = (props) => {
@@ -146,9 +141,9 @@ const FilterSliderInner = (props) => {
146
141
  query: props.customQuery,
147
142
  value: filterSliderProps.value,
148
143
  });
149
- }, [filterSliderProps.value]);
144
+ }, [filterSliderProps.value, props.customQuery, props.reactivesearchFilterProps.setQuery]);
150
145
  const RenderSliderComponent = (_g = props.renderFilterSlider) !== null && _g !== void 0 ? _g : components_1.ExampleFilterSlider;
151
- return (react_1.default.createElement(RenderSliderComponent, Object.assign({ filterSliderProps: filterSliderProps, reactSliderProps: reactSliderProps, filter: filter }, otherProps)));
146
+ return ((0, jsx_runtime_1.jsx)(RenderSliderComponent, Object.assign({ filter: filter, filterSliderProps: filterSliderProps, reactSliderProps: reactSliderProps }, otherProps)));
152
147
  };
153
148
  // inner component exists only so we can use memos in reactivesearch render functions
154
149
  const FilterListInner = (props) => {
@@ -160,6 +155,6 @@ const FilterListInner = (props) => {
160
155
  return null;
161
156
  }
162
157
  const RenderListComponent = (_a = props.renderFilterList) !== null && _a !== void 0 ? _a : components_1.ExampleFilterList;
163
- return (react_1.default.createElement(RenderListComponent, Object.assign({ filterListProps: filterListProps, filter: filter }, otherProps)));
158
+ return (0, jsx_runtime_1.jsx)(RenderListComponent, Object.assign({ filter: filter, filterListProps: filterListProps }, otherProps));
164
159
  };
165
160
  //# sourceMappingURL=Filter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,6HAAqG;AACrG,4GAAoF;AACpF,8GAAsF;AACtF,iHAAyF;AACzF,+GAAuF;AAMvF,uCAMqB;AACrB,iDAI0B;AAC1B,+CAAoH;AACpH,sFAAmF;AA0B5E,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;IACrD,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;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d,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,qFAAqF;AACrF,MAAM,eAAe,GAEjB,CAAC,KAAK,EAAE,EAAE;;IACZ,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,yBAAyB,KACzD,KAAK,EADyD,UAAU,UACxE,KAAK,EADD,2DAAsE,CACrE,CAAC;IAER,MAAM,eAAe,GAAG,IAAA,0BAAkB,EAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IAE9E,+CAA+C;IAC/C,IAAI,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,KAAK,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,mBAAmB,GAAG,MAAA,KAAK,CAAC,gBAAgB,mCAAI,8BAAiB,CAAC;IAExE,OAAO,CACL,8BAAC,mBAAmB,kBAClB,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport ReactiveComponent from \"@usereactify/search-internals/lib/components/basic/ReactiveComponent\";\nimport MultiList from \"@usereactify/search-internals/lib/components/list/MultiList\";\nimport SingleList from \"@usereactify/search-internals/lib/components/list/SingleList\";\nimport SingleRange from \"@usereactify/search-internals/lib/components/range/SingleRange\";\nimport MultiRange from \"@usereactify/search-internals/lib/components/range/MultiRange\";\n\nimport type {\n ConfigFilterFacet,\n ReactivesearchFilterListProps,\n} from \"../../types\";\nimport {\n useFilterListProps,\n useFilterRangeProps,\n useFilterSliderProps,\n useFilters,\n useReactifySearchContext,\n} from \"../../hooks\";\nimport {\n ExampleFilterList,\n ExampleFilterRange,\n ExampleFilterSlider,\n} from \"../../components\";\nimport { getPropsFilterList, getPropsFilterRange, getPropsFilterSlider, getPropsShared } from \"../../utility/props\";\nimport { useReactSliderProps } from \"../../hooks/react-slider/useReactSliderProps\";\n\nexport type FilterProps = {\n /** The filter option being rendered */\n filter: ConfigFilterFacet;\n /** Render method for List filters */\n renderFilterList?: React.FC<{\n filter: ConfigFilterFacet;\n filterListProps: ReturnType<typeof useFilterListProps>;\n }>;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<{\n filter: ConfigFilterFacet;\n filterRangeProps: ReturnType<typeof useFilterRangeProps>;\n }>;\n\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<{\n filter: ConfigFilterFacet;\n filterSliderProps: ReturnType<typeof useFilterSliderProps>;\n reactSliderProps: ReturnType<typeof useReactSliderProps>;\n }>;\n /** Show filters even when no options are available */\n showEmptyFilters?: boolean;\n};\n\nexport const Filter: React.FC<FilterProps> = (props) => {\n if (\"single\" === props.filter.displayType) {\n if (\"range\" === props.filter.displayView) {\n return <FilterRangeSingle {...props} />;\n }\n return <FilterSingleList {...props} />;\n }\n\n if (\"multi\" === props.filter.displayType) {\n if (\"range\" === props.filter.displayView) {\n return <FilterRangeMulti {...props} />;\n }\n return <FilterMultiList {...props} />;\n }\n\n if (\"slider\" === props.filter.displayType) {\n return <FilterSlider {...props} />;\n }\n\n // TODO: Legacy range filter, migrate to new single and multi ranges\n if (\"range\" === props.filter.displayType) {\n return <FilterRangeSingle {...props} />;\n }\n\n console.warn(\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 reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterList(props.filter);\n\n return (\n <SingleList\n {...sharedProps}\n {...reactiveProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterMultiList: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterList(props.filter);\n\n return (\n <MultiList\n {...sharedProps}\n {...reactiveProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterRangeSingle: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterRange(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <SingleRange\n {...sharedProps}\n {...reactiveProps}\n value={filterRangeProps.values[0]}\n onChange={filterRangeProps.handleChange}\n />\n </div>\n <RenderRangeComponent\n filterRangeProps={filterRangeProps}\n filter={props.filter}\n />\n </>\n );\n};\n\nconst FilterRangeMulti: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterRange(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <MultiRange\n {...sharedProps}\n {...reactiveProps}\n value={filterRangeProps.values}\n // @note: onChange handler must be defined for controlled component to work correctly\n onChange={() => {}}\n onValueChange={(values) => {\n if (values.length === 0) {\n filterRangeProps.handleClear();\n }\n }}\n />\n </div>\n <RenderRangeComponent\n filterRangeProps={filterRangeProps}\n filter={props.filter}\n />\n </>\n );\n};\n\nconst FilterSlider: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const filterSliderProps = useFilterSliderProps(props.filter);\n const reactiveProps = getPropsFilterSlider(props.filter, \"\", filterSliderProps.value);\n\n return (\n <ReactiveComponent\n {...sharedProps}\n defaultQuery={() => reactiveProps.defaultQuery}\n value={filterSliderProps.value}\n render={(reactivesearchFilterProps) => {\n return (\n <FilterSliderInner\n {...props}\n filterSliderProps={filterSliderProps}\n customQuery={reactiveProps.customQuery}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n );\n }}\n />\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterSliderInner: React.FC<\n FilterProps & { reactivesearchFilterProps: any; filterSliderProps: ReturnType<typeof useFilterSliderProps>; customQuery: any; }\n> = (props) => {\n const {\n filter,\n renderFilterSlider,\n filterSliderProps,\n reactivesearchFilterProps,\n ...otherProps\n } = props;\n\n const filterRange: [number, number] = [\n reactivesearchFilterProps.aggregations?.min?.value ?? 0,\n reactivesearchFilterProps.aggregations?.max?.value ?? 0,\n ];\n\n const reactSliderProps = useReactSliderProps(\n filter,\n filterSliderProps.value,\n filterRange,\n filterSliderProps.handleChange,\n );\n\n React.useEffect(() => {\n if (!props.customQuery) {\n return;\n }\n\n props.reactivesearchFilterProps.setQuery({\n query: props.customQuery,\n value: filterSliderProps.value,\n });\n }, [filterSliderProps.value]);\n\n const RenderSliderComponent = props.renderFilterSlider ?? ExampleFilterSlider;\n\n return (\n <RenderSliderComponent\n filterSliderProps={filterSliderProps}\n reactSliderProps={reactSliderProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterListInner: React.FC<\n FilterProps & { reactivesearchFilterProps: ReactivesearchFilterListProps }\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 (!props.showEmptyFilters && 0 === filterListProps.options.length) {\n return null;\n }\n\n const RenderListComponent = props.renderFilterList ?? ExampleFilterList;\n\n return (\n <RenderListComponent\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,6HAAqG;AACrG,4GAAoF;AACpF,8GAAsF;AACtF,+GAAuF;AACvF,iHAAyF;AACzF,iDAA8F;AAC9F,uCAMqB;AACrB,sFAAmF;AAEnF,+CAAoH;AA0B7G,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;IACrD,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAC1C,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YACzC,OAAO,uBAAC,iBAAiB,oBAAK,KAAK,EAAI,CAAC;QAC1C,CAAC;QACD,OAAO,uBAAC,gBAAgB,oBAAK,KAAK,EAAI,CAAC;IACzC,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACzC,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YACzC,OAAO,uBAAC,gBAAgB,oBAAK,KAAK,EAAI,CAAC;QACzC,CAAC;QACD,OAAO,uBAAC,eAAe,oBAAK,KAAK,EAAI,CAAC;IACxC,CAAC;IAED,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAC1C,OAAO,uB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,KAAK,CAAC,gBAAgB,mCAAI,8BAAiB,CAAC;IAExE,OAAO,uBAAC,mBAAmB,kBAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,IAAM,UAAU,EAAI,CAAC;AACnG,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport ReactiveComponent from \"@usereactify/search-internals/lib/components/basic/ReactiveComponent\";\nimport MultiList from \"@usereactify/search-internals/lib/components/list/MultiList\";\nimport SingleList from \"@usereactify/search-internals/lib/components/list/SingleList\";\nimport MultiRange from \"@usereactify/search-internals/lib/components/range/MultiRange\";\nimport SingleRange from \"@usereactify/search-internals/lib/components/range/SingleRange\";\nimport { ExampleFilterList, ExampleFilterRange, ExampleFilterSlider } from \"../../components\";\nimport {\n useFilterListProps,\n useFilterRangeProps,\n useFilterSliderProps,\n useFilters,\n useReactifySearchContext,\n} from \"../../hooks\";\nimport { useReactSliderProps } from \"../../hooks/react-slider/useReactSliderProps\";\nimport type { ConfigFilterFacet, ReactivesearchFilterListProps } from \"../../types\";\nimport { getPropsFilterList, getPropsFilterRange, getPropsFilterSlider, getPropsShared } from \"../../utility/props\";\n\nexport type FilterProps = {\n /** The filter option being rendered */\n filter: ConfigFilterFacet;\n /** Render method for List filters */\n renderFilterList?: React.FC<{\n filter: ConfigFilterFacet;\n filterListProps: ReturnType<typeof useFilterListProps>;\n }>;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<{\n filter: ConfigFilterFacet;\n filterRangeProps: ReturnType<typeof useFilterRangeProps>;\n }>;\n\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<{\n filter: ConfigFilterFacet;\n filterSliderProps: ReturnType<typeof useFilterSliderProps>;\n reactSliderProps: ReturnType<typeof useReactSliderProps>;\n }>;\n /** Show filters even when no options are available */\n showEmptyFilters?: boolean;\n};\n\nexport const Filter: React.FC<FilterProps> = (props) => {\n if (\"single\" === props.filter.displayType) {\n if (\"range\" === props.filter.displayView) {\n return <FilterRangeSingle {...props} />;\n }\n return <FilterSingleList {...props} />;\n }\n\n if (\"multi\" === props.filter.displayType) {\n if (\"range\" === props.filter.displayView) {\n return <FilterRangeMulti {...props} />;\n }\n return <FilterMultiList {...props} />;\n }\n\n if (\"slider\" === props.filter.displayType) {\n return <FilterSlider {...props} />;\n }\n\n // TODO: Legacy range filter, migrate to new single and multi ranges\n if (\"range\" === props.filter.displayType) {\n return <FilterRangeSingle {...props} />;\n }\n\n console.warn(`filter with display type \"${props.filter.displayType}\" not yet supported`);\n\n return null;\n};\n\nconst FilterSingleList: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared(\n {\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n },\n props.filter\n );\n const reactiveProps = getPropsFilterList(props.filter);\n\n return (\n <SingleList\n {...sharedProps}\n {...reactiveProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner {...props} reactivesearchFilterProps={reactivesearchFilterProps} />\n )}\n />\n );\n};\n\nconst FilterMultiList: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared(\n {\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n },\n props.filter\n );\n const reactiveProps = getPropsFilterList(props.filter);\n\n return (\n <MultiList\n {...sharedProps}\n {...reactiveProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner {...props} reactivesearchFilterProps={reactivesearchFilterProps} />\n )}\n />\n );\n};\n\nconst FilterRangeSingle: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared(\n {\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n },\n props.filter\n );\n const reactiveProps = getPropsFilterRange(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <SingleRange\n {...sharedProps}\n {...reactiveProps}\n onChange={filterRangeProps.handleChange}\n value={filterRangeProps.values[0]}\n />\n </div>\n <RenderRangeComponent filter={props.filter} filterRangeProps={filterRangeProps} />\n </>\n );\n};\n\nconst FilterRangeMulti: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared(\n {\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n },\n props.filter\n );\n const reactiveProps = getPropsFilterRange(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <MultiRange\n {...sharedProps}\n {...reactiveProps}\n onChange={() => {}}\n // @note: onChange handler must be defined for controlled component to work correctly\n onValueChange={(values) => {\n if (values.length === 0) {\n filterRangeProps.handleClear();\n }\n }}\n value={filterRangeProps.values}\n />\n </div>\n <RenderRangeComponent filter={props.filter} filterRangeProps={filterRangeProps} />\n </>\n );\n};\n\nconst FilterSlider: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared(\n {\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n },\n props.filter\n );\n const filterSliderProps = useFilterSliderProps(props.filter);\n const reactiveProps = getPropsFilterSlider(props.filter, \"\", filterSliderProps.value);\n\n return (\n <ReactiveComponent\n {...sharedProps}\n defaultQuery={() => reactiveProps.defaultQuery}\n render={(reactivesearchFilterProps) => {\n return (\n <FilterSliderInner\n {...props}\n customQuery={reactiveProps.customQuery}\n filterSliderProps={filterSliderProps}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n );\n }}\n value={filterSliderProps.value}\n />\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterSliderInner: React.FC<\n FilterProps & {\n reactivesearchFilterProps: any;\n filterSliderProps: ReturnType<typeof useFilterSliderProps>;\n customQuery: any;\n }\n> = (props) => {\n const { filter, renderFilterSlider, filterSliderProps, reactivesearchFilterProps, ...otherProps } = props;\n\n const filterRange: [number, number] = [\n reactivesearchFilterProps.aggregations?.min?.value ?? 0,\n reactivesearchFilterProps.aggregations?.max?.value ?? 0,\n ];\n\n const reactSliderProps = useReactSliderProps(\n filter,\n filterSliderProps.value,\n filterRange,\n filterSliderProps.handleChange\n );\n\n React.useEffect(() => {\n if (!props.customQuery) {\n return;\n }\n\n props.reactivesearchFilterProps.setQuery({\n query: props.customQuery,\n value: filterSliderProps.value,\n });\n }, [filterSliderProps.value, props.customQuery, props.reactivesearchFilterProps.setQuery]);\n\n const RenderSliderComponent = props.renderFilterSlider ?? ExampleFilterSlider;\n\n return (\n <RenderSliderComponent\n filter={filter}\n filterSliderProps={filterSliderProps}\n reactSliderProps={reactSliderProps}\n {...otherProps}\n />\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterListInner: React.FC<FilterProps & { reactivesearchFilterProps: ReactivesearchFilterListProps }> = (\n props\n) => {\n const { filter, renderFilterList, reactivesearchFilterProps, ...otherProps } = props;\n\n const filterListProps = useFilterListProps(filter, reactivesearchFilterProps);\n\n // hide entire filter when no options available\n if (!props.showEmptyFilters && 0 === filterListProps.options.length) {\n return null;\n }\n\n const RenderListComponent = props.renderFilterList ?? ExampleFilterList;\n\n return <RenderListComponent filter={filter} filterListProps={filterListProps} {...otherProps} />;\n};\n"]}
@@ -1,7 +1,7 @@
1
- import React from "react";
2
- import { useFilterListProps, useFilterRangeProps, useFilterSliderProps } from "../../hooks";
3
- import { ConfigFilterFacet } from "../../types";
4
- import { useReactSliderProps } from "../../hooks/react-slider/useReactSliderProps";
1
+ import type React from "react";
2
+ import { type useFilterListProps, type useFilterRangeProps, type useFilterSliderProps } from "../../hooks";
3
+ import type { useReactSliderProps } from "../../hooks/react-slider/useReactSliderProps";
4
+ import type { ConfigFilterFacet } from "../../types";
5
5
  export type FiltersProps = {
6
6
  /** Render method for List filters */
7
7
  renderFilterList?: React.FC<{
@@ -1,16 +1,13 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Filters = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const hooks_1 = require("../../hooks");
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
5
  const components_1 = require("../../components");
6
+ const hooks_1 = require("../../hooks");
10
7
  const Filters = (props) => {
11
8
  var _a;
12
9
  const filterStackHook = (0, hooks_1.useFilters)();
13
- return (react_1.default.createElement(react_1.default.Fragment, null, (_a = filterStackHook.filters) === null || _a === void 0 ? void 0 : _a.map((filter) => (react_1.default.createElement(components_1.Filter, { key: filter.id, filter: filter, renderFilterList: props.renderFilterList, renderFilterSlider: props.renderFilterSlider, renderFilterRange: props.renderFilterRange, showEmptyFilters: props.showEmptyFilters })))));
10
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (_a = filterStackHook.filters) === null || _a === void 0 ? void 0 : _a.map((filter) => ((0, jsx_runtime_1.jsx)(components_1.Filter, { filter: filter, renderFilterList: props.renderFilterList, renderFilterRange: props.renderFilterRange, renderFilterSlider: props.renderFilterSlider, showEmptyFilters: props.showEmptyFilters }, filter.id))) }));
14
11
  };
15
12
  exports.Filters = Filters;
16
13
  //# sourceMappingURL=Filters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Filters.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filters.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAKqB;AACrB,iDAA0C;AAyBnC,MAAM,OAAO,GAA2B,CAAC,KAAK,EAAE,EAAE;;IACvD,MAAM,eAAe,GAAG,IAAA,kBAAU,GAAE,CAAC;IAErC,OAAO,CACL,8DACG,MAAA,eAAe,CAAC,OAAO,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACxC,8BAAC,mBAAM,IACL,GAAG,EAAE,MAAM,CAAC,EAAE,EACd,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EACxC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,GACxC,CACH,CAAC,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,OAAO,WAiBlB","sourcesContent":["import React from \"react\";\n\nimport {\n useFilterListProps,\n useFilterRangeProps,\n useFilters,\n useFilterSliderProps,\n} from \"../../hooks\";\nimport { Filter } from \"../../components\";\nimport { ConfigFilterFacet } from \"../../types\";\nimport { useReactSliderProps } from \"../../hooks/react-slider/useReactSliderProps\";\n\nexport type FiltersProps = {\n /** Render method for List filters */\n renderFilterList?: React.FC<{\n filter: ConfigFilterFacet;\n filterListProps: ReturnType<typeof useFilterListProps>;\n }>;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<{\n filter: ConfigFilterFacet;\n filterRangeProps: ReturnType<typeof useFilterRangeProps>;\n }>;\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<{\n filter: ConfigFilterFacet;\n filterSliderProps: ReturnType<typeof useFilterSliderProps>;\n reactSliderProps: ReturnType<typeof useReactSliderProps>;\n }>;\n /** Show filters even when no options are available */\n showEmptyFilters?: boolean;\n};\n\nexport const Filters: React.FC<FiltersProps> = (props) => {\n const filterStackHook = useFilters();\n\n return (\n <>\n {filterStackHook.filters?.map((filter) => (\n <Filter\n key={filter.id}\n filter={filter}\n renderFilterList={props.renderFilterList}\n renderFilterSlider={props.renderFilterSlider}\n renderFilterRange={props.renderFilterRange}\n showEmptyFilters={props.showEmptyFilters}\n />\n ))}\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"Filters.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filters.tsx"],"names":[],"mappings":";;;;AACA,iDAA0C;AAC1C,uCAAuH;AAyBhH,MAAM,OAAO,GAA2B,CAAC,KAAK,EAAE,EAAE;;IACvD,MAAM,eAAe,GAAG,IAAA,kBAAU,GAAE,CAAC;IAErC,OAAO,CACL,2DACG,MAAA,eAAe,CAAC,OAAO,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACxC,uBAAC,mBAAM,IACL,MAAM,EAAE,MAAM,EAEd,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EACxC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,IAJnC,MAAM,CAAC,EAAE,CAKd,CACH,CAAC,GACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,OAAO,WAiBlB","sourcesContent":["import type React from \"react\";\nimport { Filter } from \"../../components\";\nimport { type useFilterListProps, type useFilterRangeProps, type useFilterSliderProps, useFilters } from \"../../hooks\";\nimport type { useReactSliderProps } from \"../../hooks/react-slider/useReactSliderProps\";\nimport type { ConfigFilterFacet } from \"../../types\";\n\nexport type FiltersProps = {\n /** Render method for List filters */\n renderFilterList?: React.FC<{\n filter: ConfigFilterFacet;\n filterListProps: ReturnType<typeof useFilterListProps>;\n }>;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<{\n filter: ConfigFilterFacet;\n filterRangeProps: ReturnType<typeof useFilterRangeProps>;\n }>;\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<{\n filter: ConfigFilterFacet;\n filterSliderProps: ReturnType<typeof useFilterSliderProps>;\n reactSliderProps: ReturnType<typeof useReactSliderProps>;\n }>;\n /** Show filters even when no options are available */\n showEmptyFilters?: boolean;\n};\n\nexport const Filters: React.FC<FiltersProps> = (props) => {\n const filterStackHook = useFilters();\n\n return (\n <>\n {filterStackHook.filters?.map((filter) => (\n <Filter\n filter={filter}\n key={filter.id}\n renderFilterList={props.renderFilterList}\n renderFilterRange={props.renderFilterRange}\n renderFilterSlider={props.renderFilterSlider}\n showEmptyFilters={props.showEmptyFilters}\n />\n ))}\n </>\n );\n};\n"]}
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import type React from "react";
2
2
  export type FiltersSelectedProps = {
3
3
  /** Render method called once for all active filters */
4
4
  render?: React.FC<{
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FiltersSelected = void 0;
7
- const react_1 = __importDefault(require("react"));
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const SelectedFilters_1 = __importDefault(require("@usereactify/search-internals/lib/components/basic/SelectedFilters"));
9
9
  const components_1 = require("../../components");
10
10
  const hooks_1 = require("../../hooks");
@@ -13,14 +13,9 @@ const FiltersSelected = (props) => {
13
13
  const context = (0, hooks_1.useReactifySearchContext)();
14
14
  const filtersHook = (0, hooks_1.useFilters)();
15
15
  const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleFiltersSelected;
16
- return (react_1.default.createElement(SelectedFilters_1.default, { render: ({ selectedValues, setValue }) => {
16
+ return ((0, jsx_runtime_1.jsx)(SelectedFilters_1.default, { render: ({ selectedValues, setValue }) => {
17
17
  const selectedFilters = Object.entries(selectedValues)
18
- .filter(([key, item]) => {
19
- var _a, _b;
20
- return (item === null || item === void 0 ? void 0 : item.URLParams) &&
21
- (item === null || item === void 0 ? void 0 : item.showFilter) &&
22
- (!!((_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.length) || !!((_b = item === null || item === void 0 ? void 0 : item.value) === null || _b === void 0 ? void 0 : _b.label));
23
- })
18
+ .filter(([_key, item]) => { var _a, _b; return (item === null || item === void 0 ? void 0 : item.URLParams) && (item === null || item === void 0 ? void 0 : item.showFilter) && (!!((_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.length) || !!((_b = item === null || item === void 0 ? void 0 : item.value) === null || _b === void 0 ? void 0 : _b.label)); })
24
19
  .map(([key, item]) => ({
25
20
  key: key,
26
21
  label: item.label,
@@ -73,7 +68,7 @@ const FiltersSelected = (props) => {
73
68
  if (!selectedFilters.length) {
74
69
  return null;
75
70
  }
76
- return (react_1.default.createElement(RenderComponent, { selectedFilters: selectedFilters, handleRemove: handleRemove }));
71
+ return (0, jsx_runtime_1.jsx)(RenderComponent, { handleRemove: handleRemove, selectedFilters: selectedFilters });
77
72
  } }));
78
73
  };
79
74
  exports.FiltersSelected = FiltersSelected;
@@ -1 +1 @@
1
- {"version":3,"file":"FiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Filter/FiltersSelected.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAEjG,iDAA0D;AAC1D,uCAAmE;AAqB5D,MAAM,eAAe,GAAmC,CAAC,KAAK,EAAE,EAAE;;IACvE,MAAM,OAAO,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC3C,MAAM,WAAW,GAAG,IAAA,kBAAU,GAAE,CAAC;IAEjC,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,mCAAsB,CAAC;IAE/D,OAAO,CACL,8BAAC,yBAAe,IACd,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,EAAE;YACvC,MAAM,eAAe,GACnB,MAAM,CAAC,OAAO,CAAC,cAAc,CAC9B;iBACE,MAAM,CACL,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;;gBACd,OAAA,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,S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gBAC5B,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO,CACL,8BAAC,eAAe,IACd,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,GAC1B,CACH,CAAC;QACJ,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAvGW,QAAA,eAAe,mBAuG1B","sourcesContent":["import React from \"react\";\nimport SelectedFilters from \"@usereactify/search-internals/lib/components/basic/SelectedFilters\";\n\nimport { ExampleFiltersSelected } from \"../../components\";\nimport { useFilters, useReactifySearchContext } from \"../../hooks\";\n\nexport type FiltersSelectedProps = {\n /** Render method called once for all active filters */\n render?: React.FC<{\n selectedFilters: Array<{\n key: string;\n label: string;\n value:\n | Array<string>\n | string\n | { label: string; start: number; end: number }\n | Array<{ label: string; start: number; end: number }>;\n }>;\n handleRemove: (\n filterKey: string,\n filterValues?: Array<string | number>\n ) => void;\n }>;\n};\n\nexport const FiltersSelected: React.FC<FiltersSelectedProps> = (props) => {\n const context = useReactifySearchContext();\n const filtersHook = useFilters();\n\n const RenderComponent = props.render ?? ExampleFiltersSelected;\n\n return (\n <SelectedFilters\n render={({ selectedValues, setValue }) => {\n const selectedFilters = (\n Object.entries(selectedValues) as Array<[string, any]>\n )\n .filter(\n ([key, item]) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n )\n .map(([key, item]) => ({\n key: key,\n label: item.label,\n value: item.value,\n }));\n\n const handleRemove = (\n selectedFilterKey: string,\n selectedFilterValues: Array<string | number> = []\n ) => {\n const filter = filtersHook.filters?.find(\n (filter) => filter.handle === selectedFilterKey\n );\n if (!filter) {\n return;\n }\n\n if (filter.displayType === \"slider\") {\n const event = new CustomEvent<{\n handle: string;\n value: [];\n }>(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n\n return;\n }\n\n if (selectedFilterValues.length === 0) {\n setValue(selectedFilterKey, null);\n\n return;\n }\n\n if (selectedFilterValues.length > 0) {\n if (filter.displayType === \"single\") {\n setValue(selectedFilterKey, null);\n }\n if (filter.displayType === \"multi\") {\n if (filter.displayView === \"range\") {\n const values = selectedValues[selectedFilterKey].value\n .filter(\n (value: { label: string }) =>\n !selectedFilterValues.includes(value.label)\n )\n .map((value: { label: string }) => value.label);\n\n const event = new CustomEvent<{\n handle: string;\n value: Array<string>;\n }>(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: values,\n },\n });\n window.dispatchEvent(event);\n }\n if (filter.displayView !== \"range\") {\n const values = selectedValues[selectedFilterKey].value.filter(\n (value: string) => !selectedFilterValues.includes(value)\n );\n setValue(selectedFilterKey, values);\n }\n }\n }\n };\n\n if (!selectedFilters.length) {\n return null;\n }\n\n return (\n <RenderComponent\n selectedFilters={selectedFilters}\n handleRemove={handleRemove}\n />\n );\n }}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"FiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Filter/FiltersSelected.tsx"],"names":[],"mappings":";;;;;;;AACA,yHAAiG;AACjG,iDAA0D;AAC1D,uCAAmE;AAkB5D,MAAM,eAAe,GAAmC,CAAC,KAAK,EAAE,EAAE;;IACvE,MAAM,OAAO,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC3C,MAAM,WAAW,GAAG,IAAA,kBAAU,GAAE,CAAC;IAEjC,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,mCAAsB,CAAC;IAE/D,OAAO,CACL,uBAAC,yBAAe,IACd,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,EAAE;YACvC,MAAM,eAAe,GAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAA0B;iBAC7E,MAAM,CACL,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,eAAC,OAAA,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,C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E,CAAC;gBAC5B,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO,uBAAC,eAAe,IAAC,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,GAAI,CAAC;QAC3F,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AArFW,QAAA,eAAe,mBAqF1B","sourcesContent":["import type React from \"react\";\nimport SelectedFilters from \"@usereactify/search-internals/lib/components/basic/SelectedFilters\";\nimport { ExampleFiltersSelected } from \"../../components\";\nimport { useFilters, useReactifySearchContext } from \"../../hooks\";\n\nexport type FiltersSelectedProps = {\n /** Render method called once for all active filters */\n render?: React.FC<{\n selectedFilters: Array<{\n key: string;\n label: string;\n value:\n | Array<string>\n | string\n | { label: string; start: number; end: number }\n | Array<{ label: string; start: number; end: number }>;\n }>;\n handleRemove: (filterKey: string, filterValues?: Array<string | number>) => void;\n }>;\n};\n\nexport const FiltersSelected: React.FC<FiltersSelectedProps> = (props) => {\n const context = useReactifySearchContext();\n const filtersHook = useFilters();\n\n const RenderComponent = props.render ?? ExampleFiltersSelected;\n\n return (\n <SelectedFilters\n render={({ selectedValues, setValue }) => {\n const selectedFilters = (Object.entries(selectedValues) as Array<[string, any]>)\n .filter(\n ([_key, item]) => item?.URLParams && item?.showFilter && (!!item?.value?.length || !!item?.value?.label)\n )\n .map(([key, item]) => ({\n key: key,\n label: item.label,\n value: item.value,\n }));\n\n const handleRemove = (selectedFilterKey: string, selectedFilterValues: Array<string | number> = []) => {\n const filter = filtersHook.filters?.find((filter) => filter.handle === selectedFilterKey);\n if (!filter) {\n return;\n }\n\n if (filter.displayType === \"slider\") {\n const event = new CustomEvent<{\n handle: string;\n value: [];\n }>(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n\n return;\n }\n\n if (selectedFilterValues.length === 0) {\n setValue(selectedFilterKey, null);\n\n return;\n }\n\n if (selectedFilterValues.length > 0) {\n if (filter.displayType === \"single\") {\n setValue(selectedFilterKey, null);\n }\n if (filter.displayType === \"multi\") {\n if (filter.displayView === \"range\") {\n const values = selectedValues[selectedFilterKey].value\n .filter((value: { label: string }) => !selectedFilterValues.includes(value.label))\n .map((value: { label: string }) => value.label);\n\n const event = new CustomEvent<{\n handle: string;\n value: Array<string>;\n }>(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: values,\n },\n });\n window.dispatchEvent(event);\n }\n if (filter.displayView !== \"range\") {\n const values = selectedValues[selectedFilterKey].value.filter(\n (value: string) => !selectedFilterValues.includes(value)\n );\n setValue(selectedFilterKey, values);\n }\n }\n }\n };\n\n if (!selectedFilters.length) {\n return null;\n }\n\n return <RenderComponent handleRemove={handleRemove} selectedFilters={selectedFilters} />;\n }}\n />\n );\n};\n"]}
@@ -1,5 +1,5 @@
1
- import { PropsWithChildren, ReactNode } from "react";
2
- import { Config } from "../../types";
1
+ import { type PropsWithChildren, type ReactNode } from "react";
2
+ import type { Config } from "../../types";
3
3
  export type ReactifySearchProviderProps = {
4
4
  /** Standard react children */
5
5
  children?: ReactNode | undefined;
@@ -27,12 +27,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.ReactifySearchProvider = ReactifySearchProvider;
30
- const react_1 = __importStar(require("react"));
30
+ const jsx_runtime_1 = require("react/jsx-runtime");
31
+ const react_1 = require("react");
31
32
  // @ts-expect-error missing types
32
33
  const GaGtag = __importStar(require("ga-gtag"));
33
34
  const package_json_1 = __importDefault(require("../../../package.json"));
34
- const hooks_1 = require("../../hooks");
35
35
  const components_1 = require("../../components");
36
+ const hooks_1 = require("../../hooks");
36
37
  const utility_1 = require("../../utility");
37
38
  const curation_1 = require("../../utility/curation");
38
39
  function ReactifySearchProvider(props) {
@@ -46,7 +47,7 @@ function ReactifySearchProvider(props) {
46
47
  },
47
48
  });
48
49
  }, [props]);
49
- return react_1.default.createElement(ReactifySearchInner, Object.assign({}, props));
50
+ return (0, jsx_runtime_1.jsx)(ReactifySearchInner, Object.assign({}, props));
50
51
  }
51
52
  function ReactifySearchInner(props) {
52
53
  var _a, _b;
@@ -74,7 +75,7 @@ function ReactifySearchInner(props) {
74
75
  if (indexFromURLParam)
75
76
  setIndexFromURL(indexFromURLParam);
76
77
  }
77
- }, []);
78
+ }, [searchTerm, sortOption]);
78
79
  // results
79
80
  const [results, setResults] = (0, react_1.useState)([]);
80
81
  // curation
@@ -111,17 +112,28 @@ function ReactifySearchInner(props) {
111
112
  },
112
113
  curation: curation,
113
114
  };
114
- }, [config, props, searchTerm, showInstantSearchResults, searchRedirect, sortOption, results, resultStats, curation]);
115
+ }, [
116
+ config,
117
+ props,
118
+ searchTerm,
119
+ showInstantSearchResults,
120
+ searchRedirect,
121
+ sortOption,
122
+ results,
123
+ resultStats,
124
+ curation,
125
+ indexFromURL,
126
+ theme,
127
+ ]);
115
128
  (0, react_1.useEffect)(() => {
116
129
  utility_1.debug.log("curation", "content", curation);
117
- }, [curation === null || curation === void 0 ? void 0 : curation.id]);
130
+ }, [curation === null || curation === void 0 ? void 0 : curation.id, curation]);
118
131
  utility_1.debug.hook("ReactifySearchProvider", "context", contextValue);
119
132
  if (!contextValue) {
120
133
  if (props.renderBooting)
121
134
  return props.renderBooting();
122
135
  return null;
123
136
  }
124
- return (react_1.default.createElement(hooks_1.ReactifySearchContext.Provider, { value: contextValue },
125
- react_1.default.createElement(components_1.UtilityAuthenticatedReactiveBase, null, props.children)));
137
+ return ((0, jsx_runtime_1.jsx)(hooks_1.ReactifySearchContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(components_1.UtilityAuthenticatedReactiveBase, { children: props.children }) }));
126
138
  }
127
139
  //# sourceMappingURL=ReactifySearchProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReactifySearchProvider.js","sourceRoot":"","sources":["../../../../src/components/ReactifySearchProvider/ReactifySearchProvider.t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;gBACxB,cAAc,EAAE,cAAc;aAC/B;YACD,QAAQ,EAAE,QAAQ;SACnB,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,wBAAwB,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEtH,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,eAAK,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC,EAAE,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,EAAE,CAAC,CAAC,CAAC;IAEnB,eAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IAE9D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,IAAI,KAAK,CAAC,aAAa;YAAE,OAAO,KAAK,CAAC,aAAa,EAAE,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,8BAAC,6BAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;QACjD,8BAAC,6CAAgC,QAAE,KAAK,CAAC,QAAQ,CAAoC,CACtD,CAClC,CAAC;AACJ,CAAC","sourcesContent":["import React, { PropsWithChildren, ReactNode, useEffect, useMemo, useState } from \"react\";\n// @ts-expect-error missing types\nimport * as GaGtag from \"ga-gtag\";\n\nimport pkg from \"../../../package.json\";\n\nimport { ReactifySearchContext, useConfig } from \"../../hooks\";\nimport { UtilityAuthenticatedReactiveBase } from \"../../components\";\nimport { debug } from \"../../utility\";\nimport { Config, ConfigCuration, ConfigRedirect, ReactivesearchResultProps } from \"../../types\";\nimport { getCuration } from \"../../utility/curation\";\n\nexport type ReactifySearchProviderProps = {\n /** Standard react children */\n children?: ReactNode | undefined;\n /** The search area the provider will be used in */\n mode: \"search\" | \"collection\" | \"instant-search\";\n /** The variation of the search area the provider will be used in */\n /** Shopify store domain used to resolve the site configuration */\n shopifyPermanentDomain: string;\n /** Market ID used to change merchandising based on market e.g. 7494533198 */\n market?: 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: Override the default Reactify Search id (for telemetry) */\n clientId?: string;\n /** Advanced usage: Override the default Filters selection logic */\n filtersHandle?: string;\n /** Advanced usage: Array of additional component IDs managed outside of Reactify Search */\n additionalComponentIds?: Array<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?: string;\n /** Advanced usage: Override the default ReactiveBase theme */\n theme?: Record<string, unknown>;\n /** Advanced usage: Fields to include in the Elasticsearch response e.g. [\"title\"] */\n includeFields?: Array<string>;\n /** Advanced usage: Fields to exclude from the Elasticsearch response e.g. [\"variant_skus\", \"*price*\"] */\n excludeFields?: Array<string>;\n /** Advanced usage: Server content for SSR */\n query?: Record<string, string>;\n /** Advanced usage: Override the default config base URL for local testing */\n configBaseUrl?: string;\n /** Development mode: enables score breakdown features (default: false) */\n devMode?: boolean;\n preload?: {\n config: Config;\n state: unknown;\n };\n} & (\n | {\n mode: \"search\";\n }\n | {\n mode: \"collection\";\n /** Collection object that includes the handle, used to find curations */\n collectionHandle: string;\n }\n | { mode: \"instant-search\" }\n);\n\nexport function ReactifySearchProvider(props: PropsWithChildren<ReactifySearchProviderProps>) {\n useEffect(() => {\n debug.log(\"ReactifySearchProvider\", \"props\", props);\n\n GaGtag.install(\"G-DV00Z0X5VP\", {\n cookie_prefix: \"_rs\",\n user_properties: {\n shop: props.shopifyPermanentDomain,\n version: pkg.version,\n },\n });\n }, [props]);\n\n return <ReactifySearchInner {...props} />;\n}\n\nfunction ReactifySearchInner(props: PropsWithChildren<ReactifySearchProviderProps>) {\n const { config } = useConfig(props.shopifyPermanentDomain, props.preload?.config, props.configBaseUrl);\n const theme = props.theme ?? { typography: { fontFamily: \"inherit\", fontSize: \"inherit\" } };\n\n // search term\n const [searchTerm, setSearchTerm] = useState<string>(\"\");\n const [showInstantSearchResults, setShowInstantSearchResults] = useState<boolean>(false);\n const [sortOption, setSortOption] = useState<string>(\"\");\n const [indexFromURL, setIndexFromURL] = useState<string | null>(null);\n const searchRedirect = useMemo<ConfigRedirect | undefined>(() => {\n return config?.redirects.find(\n (redirect) => redirect.query.trim().toLowerCase() === searchTerm.trim().toLowerCase()\n );\n }, [config?.redirects, searchTerm]);\n\n // hydration-safe URL param initialization\n useEffect(() => {\n if (typeof window !== \"undefined\") {\n const urlParams = new URLSearchParams(window.location.search);\n const searchTermFromURL = urlParams.get(\"q\");\n const searchSortFromURL = urlParams.get(\"sort\");\n const indexFromURLParam = urlParams.get(\"index\");\n if (searchTermFromURL && searchTermFromURL !== searchTerm) setSearchTerm(searchTermFromURL);\n if (searchSortFromURL && searchSortFromURL !== sortOption) setSortOption(searchSortFromURL);\n if (indexFromURLParam) setIndexFromURL(indexFromURLParam);\n }\n }, []);\n\n // results\n const [results, setResults] = useState<ReactivesearchResultProps[\"data\"]>([]);\n\n // curation\n const curation = useMemo<ConfigCuration | undefined>(() => {\n if (!config) return undefined;\n return getCuration({ provider: props, config: config, searchTerm: searchTerm });\n }, [props, config, searchTerm]);\n\n // result stats\n const [resultStats, setResultStats] = useState<ReactivesearchResultProps[\"resultStats\"]>();\n\n const contextValue = useMemo(() => {\n if (!config) return;\n\n return {\n config: config,\n options: {\n ...props,\n clientId: props.clientId ?? \"theme\",\n index: props.index ?? indexFromURL ?? config.index,\n filtersHandle: props.filtersHandle,\n credentials: props.credentials,\n theme: theme,\n configBaseUrl: props.configBaseUrl,\n devMode: props.devMode ?? false,\n },\n search: {\n searchTerm: searchTerm,\n setSearchTerm: setSearchTerm,\n showInstantSearchResults: showInstantSearchResults,\n setShowInstantSearchResults: setShowInstantSearchResults,\n searchRedirect: searchRedirect,\n },\n sortby: {\n sortOption: sortOption,\n setSortOption: setSortOption,\n },\n results: {\n results: results,\n setResults: setResults,\n resultStats: resultStats,\n setResultStats: setResultStats,\n },\n curation: curation,\n };\n }, [config, props, searchTerm, showInstantSearchResults, searchRedirect, sortOption, results, resultStats, curation]);\n\n useEffect(() => {\n debug.log(\"curation\", \"content\", curation);\n }, [curation?.id]);\n\n debug.hook(\"ReactifySearchProvider\", \"context\", contextValue);\n\n if (!contextValue) {\n if (props.renderBooting) return props.renderBooting();\n return null;\n }\n\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n <UtilityAuthenticatedReactiveBase>{props.children}</UtilityAuthenticatedReactiveBase>\n </ReactifySearchContext.Provider>\n );\n}\n"]}
1
+ {"version":3,"file":"ReactifySearchProvider.js","sourceRoot":"","sources":["../../../../src/components/ReactifySearchProvider/ReactifySearchProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,wDAcC;;AA9ED,iCAA6F;AAC7F,iCAAiC;AACjC,gDAAkC;AAClC,yEAAwC;AACxC,iDAAoE;AACpE,uCAA+D;AAE/D,2CAAsC;AACtC,qDAAqD;AAwDrD,SAAgB,sBAAsB,CAAC,KAAqD;IAC1F,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,eAAK,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEpD,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE;YAC7B,aAAa,EAAE,KAAK;YACpB,eAAe,EAAE;gBACf,IAAI,EAAE,KAAK,CAAC,sBAAsB;gBAClC,OAAO,EAAE,sBAAG,CAAC,OAAO;aACrB;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,uBAAC,mBAAmB,oBAAK,KAAK,EAAI,CAAC;AAC5C,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAqD;;I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I,CAAC;IACd,CAAC;IAED,OAAO,CACL,uBAAC,6BAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YACjD,uBAAC,6CAAgC,cAAE,KAAK,CAAC,QAAQ,GAAoC,GACtD,CAClC,CAAC;AACJ,CAAC","sourcesContent":["import { type PropsWithChildren, type ReactNode, useEffect, useMemo, useState } from \"react\";\n// @ts-expect-error missing types\nimport * as GaGtag from \"ga-gtag\";\nimport pkg from \"../../../package.json\";\nimport { UtilityAuthenticatedReactiveBase } from \"../../components\";\nimport { ReactifySearchContext, useConfig } from \"../../hooks\";\nimport type { Config, ConfigCuration, ConfigRedirect, ReactivesearchResultProps } from \"../../types\";\nimport { debug } from \"../../utility\";\nimport { getCuration } from \"../../utility/curation\";\n\nexport type ReactifySearchProviderProps = {\n /** Standard react children */\n children?: ReactNode | undefined;\n /** The search area the provider will be used in */\n mode: \"search\" | \"collection\" | \"instant-search\";\n /** The variation of the search area the provider will be used in */\n /** Shopify store domain used to resolve the site configuration */\n shopifyPermanentDomain: string;\n /** Market ID used to change merchandising based on market e.g. 7494533198 */\n market?: 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: Override the default Reactify Search id (for telemetry) */\n clientId?: string;\n /** Advanced usage: Override the default Filters selection logic */\n filtersHandle?: string;\n /** Advanced usage: Array of additional component IDs managed outside of Reactify Search */\n additionalComponentIds?: Array<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?: string;\n /** Advanced usage: Override the default ReactiveBase theme */\n theme?: Record<string, unknown>;\n /** Advanced usage: Fields to include in the Elasticsearch response e.g. [\"title\"] */\n includeFields?: Array<string>;\n /** Advanced usage: Fields to exclude from the Elasticsearch response e.g. [\"variant_skus\", \"*price*\"] */\n excludeFields?: Array<string>;\n /** Advanced usage: Server content for SSR */\n query?: Record<string, string>;\n /** Advanced usage: Override the default config base URL for local testing */\n configBaseUrl?: string;\n /** Development mode: enables score breakdown features (default: false) */\n devMode?: boolean;\n preload?: {\n config: Config;\n state: unknown;\n };\n} & (\n | {\n mode: \"search\";\n }\n | {\n mode: \"collection\";\n /** Collection object that includes the handle, used to find curations */\n collectionHandle: string;\n }\n | { mode: \"instant-search\" }\n);\n\nexport function ReactifySearchProvider(props: PropsWithChildren<ReactifySearchProviderProps>) {\n useEffect(() => {\n debug.log(\"ReactifySearchProvider\", \"props\", props);\n\n GaGtag.install(\"G-DV00Z0X5VP\", {\n cookie_prefix: \"_rs\",\n user_properties: {\n shop: props.shopifyPermanentDomain,\n version: pkg.version,\n },\n });\n }, [props]);\n\n return <ReactifySearchInner {...props} />;\n}\n\nfunction ReactifySearchInner(props: PropsWithChildren<ReactifySearchProviderProps>) {\n const { config } = useConfig(props.shopifyPermanentDomain, props.preload?.config, props.configBaseUrl);\n const theme = props.theme ?? { typography: { fontFamily: \"inherit\", fontSize: \"inherit\" } };\n\n // search term\n const [searchTerm, setSearchTerm] = useState<string>(\"\");\n const [showInstantSearchResults, setShowInstantSearchResults] = useState<boolean>(false);\n const [sortOption, setSortOption] = useState<string>(\"\");\n const [indexFromURL, setIndexFromURL] = useState<string | null>(null);\n const searchRedirect = useMemo<ConfigRedirect | undefined>(() => {\n return config?.redirects.find(\n (redirect) => redirect.query.trim().toLowerCase() === searchTerm.trim().toLowerCase()\n );\n }, [config?.redirects, searchTerm]);\n\n // hydration-safe URL param initialization\n useEffect(() => {\n if (typeof window !== \"undefined\") {\n const urlParams = new URLSearchParams(window.location.search);\n const searchTermFromURL = urlParams.get(\"q\");\n const searchSortFromURL = urlParams.get(\"sort\");\n const indexFromURLParam = urlParams.get(\"index\");\n if (searchTermFromURL && searchTermFromURL !== searchTerm) setSearchTerm(searchTermFromURL);\n if (searchSortFromURL && searchSortFromURL !== sortOption) setSortOption(searchSortFromURL);\n if (indexFromURLParam) setIndexFromURL(indexFromURLParam);\n }\n }, [searchTerm, sortOption]);\n\n // results\n const [results, setResults] = useState<ReactivesearchResultProps[\"data\"]>([]);\n\n // curation\n const curation = useMemo<ConfigCuration | undefined>(() => {\n if (!config) return undefined;\n return getCuration({ provider: props, config: config, searchTerm: searchTerm });\n }, [props, config, searchTerm]);\n\n // result stats\n const [resultStats, setResultStats] = useState<ReactivesearchResultProps[\"resultStats\"]>();\n\n const contextValue = useMemo(() => {\n if (!config) return;\n\n return {\n config: config,\n options: {\n ...props,\n clientId: props.clientId ?? \"theme\",\n index: props.index ?? indexFromURL ?? config.index,\n filtersHandle: props.filtersHandle,\n credentials: props.credentials,\n theme: theme,\n configBaseUrl: props.configBaseUrl,\n devMode: props.devMode ?? false,\n },\n search: {\n searchTerm: searchTerm,\n setSearchTerm: setSearchTerm,\n showInstantSearchResults: showInstantSearchResults,\n setShowInstantSearchResults: setShowInstantSearchResults,\n searchRedirect: searchRedirect,\n },\n sortby: {\n sortOption: sortOption,\n setSortOption: setSortOption,\n },\n results: {\n results: results,\n setResults: setResults,\n resultStats: resultStats,\n setResultStats: setResultStats,\n },\n curation: curation,\n };\n }, [\n config,\n props,\n searchTerm,\n showInstantSearchResults,\n searchRedirect,\n sortOption,\n results,\n resultStats,\n curation,\n indexFromURL,\n theme,\n ]);\n\n useEffect(() => {\n debug.log(\"curation\", \"content\", curation);\n }, [curation?.id, curation]);\n\n debug.hook(\"ReactifySearchProvider\", \"context\", contextValue);\n\n if (!contextValue) {\n if (props.renderBooting) return props.renderBooting();\n return null;\n }\n\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n <UtilityAuthenticatedReactiveBase>{props.children}</UtilityAuthenticatedReactiveBase>\n </ReactifySearchContext.Provider>\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { ElasticCallout } from "../../types";
3
- import { ResultsProps } from "..";
2
+ import type { ElasticCallout } from "../../types";
3
+ import { type ResultsProps } from "..";
4
4
  export type ResultCardCalloutProps = {
5
5
  pagePosition: number;
6
6
  document: ElasticCallout;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ResultCardCallout = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
8
  const react_1 = __importDefault(require("react"));
8
9
  const react_intersection_observer_1 = require("react-intersection-observer");
9
10
  const hooks_1 = require("../../hooks");
@@ -39,9 +40,9 @@ const ResultCardCallout = (props) => {
39
40
  (_a = props.onView) === null || _a === void 0 ? void 0 : _a.call(props);
40
41
  handleView();
41
42
  }
42
- }, [inView]);
43
+ }, [inView, handleView, props.onView]);
43
44
  const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : __1.ExampleResultCardCallout;
44
- return react_1.default.createElement(RenderComponent, Object.assign({}, props, { itemRef: ref, handleClick: handleClick }));
45
+ return (0, jsx_runtime_1.jsx)(RenderComponent, Object.assign({}, props, { handleClick: handleClick, itemRef: ref }));
45
46
  };
46
47
  exports.ResultCardCallout = ResultCardCallout;
47
48
  //# sourceMappingURL=ResultCardCallout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResultCardCallout.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultCardCallout.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6EAAwD;AAGxD,uCAA2C;AAC3C,0BAA4D;AAUrD,MAAM,iBAAiB,GAAqC,CAAC,KAAK,EAAE,EAAE;;IAC3E,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,uCAAS,EAAC;QAChC,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,eAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACzC,KAAK,CAAC;YACJ,SAAS,EAAE,gBAAgB;YAC3B,OAAO,EAAE;gBACP,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI;gBACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;aAC3B;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3B,MAAM,UAAU,GAAG,eAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,KAAK,CAAC;YACJ,SAAS,EAAE,eAAe;YAC1B,OAAO,EAAE;gBACP,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI;gBACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;aAC3B;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3B,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;;QACnB,IAAI,MAAM,EAAE,CAAC;YACX,MAAA,KAAK,CAAC,MAAM,qDAAI,CAAC;YACjB,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,4BAAwB,CAAC;IAEjE,OAAO,8BAAC,eAAe,oBAAK,KAAK,IAAE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,IAAI,CAAC;AAChF,CAAC,CAAC;AArCW,QAAA,iBAAiB,qBAqC5B","sourcesContent":["import React from \"react\";\nimport { useInView } from \"react-intersection-observer\";\n\nimport { ElasticCallout } from \"../../types\";\nimport { useAnalytics } from \"../../hooks\";\nimport { ResultsProps, ExampleResultCardCallout } from \"..\";\n\nexport type ResultCardCalloutProps = {\n pagePosition: number;\n document: ElasticCallout;\n callout: ElasticCallout[\"callout\"];\n render?: ResultsProps[\"renderResultCardCallout\"];\n onView?: () => void;\n};\n\nexport const ResultCardCallout: React.FC<ResultCardCalloutProps> = (props) => {\n const { track } = useAnalytics();\n const { ref, inView } = useInView({\n threshold: 0.5,\n triggerOnce: true,\n });\n\n const handleClick = React.useCallback(() => {\n track({\n eventName: \"clickPromotion\",\n payload: {\n link: props.callout.link,\n title: props.callout.title,\n },\n });\n }, [track, props.callout]);\n\n const handleView = React.useCallback(() => {\n track({\n eventName: \"viewPromotion\",\n payload: {\n link: props.callout.link,\n title: props.callout.title,\n },\n });\n }, [track, props.callout]);\n\n React.useEffect(() => {\n if (inView) {\n props.onView?.();\n handleView();\n }\n }, [inView]);\n\n const RenderComponent = props.render ?? ExampleResultCardCallout;\n\n return <RenderComponent {...props} itemRef={ref} handleClick={handleClick} />;\n};\n"]}
1
+ {"version":3,"file":"ResultCardCallout.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultCardCallout.tsx"],"names":[],"mappings":";;;;;;;AAAA,kDAA0B;AAC1B,6EAAwD;AACxD,uCAA2C;AAE3C,0BAAiE;AAU1D,MAAM,iBAAiB,GAAqC,CAAC,KAAK,EAAE,EAAE;;IAC3E,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,uCAAS,EAAC;QAChC,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,eAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACzC,KAAK,CAAC;YACJ,SAAS,EAAE,gBAAgB;YAC3B,OAAO,EAAE;gBACP,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI;gBACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;aAC3B;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3B,MAAM,UAAU,GAAG,eAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,KAAK,CAAC;YACJ,SAAS,EAAE,eAAe;YAC1B,OAAO,EAAE;gBACP,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI;gBACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;aAC3B;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3B,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;;QACnB,IAAI,MAAM,EAAE,CAAC;YACX,MAAA,KAAK,CAAC,MAAM,qDAAI,CAAC;YACjB,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvC,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,4BAAwB,CAAC;IAEjE,OAAO,uBAAC,eAAe,oBAAK,KAAK,IAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;AAChF,CAAC,CAAC;AArCW,QAAA,iBAAiB,qBAqC5B","sourcesContent":["import React from \"react\";\nimport { useInView } from \"react-intersection-observer\";\nimport { useAnalytics } from \"../../hooks\";\nimport type { ElasticCallout } from \"../../types\";\nimport { ExampleResultCardCallout, type ResultsProps } from \"..\";\n\nexport type ResultCardCalloutProps = {\n pagePosition: number;\n document: ElasticCallout;\n callout: ElasticCallout[\"callout\"];\n render?: ResultsProps[\"renderResultCardCallout\"];\n onView?: () => void;\n};\n\nexport const ResultCardCallout: React.FC<ResultCardCalloutProps> = (props) => {\n const { track } = useAnalytics();\n const { ref, inView } = useInView({\n threshold: 0.5,\n triggerOnce: true,\n });\n\n const handleClick = React.useCallback(() => {\n track({\n eventName: \"clickPromotion\",\n payload: {\n link: props.callout.link,\n title: props.callout.title,\n },\n });\n }, [track, props.callout]);\n\n const handleView = React.useCallback(() => {\n track({\n eventName: \"viewPromotion\",\n payload: {\n link: props.callout.link,\n title: props.callout.title,\n },\n });\n }, [track, props.callout]);\n\n React.useEffect(() => {\n if (inView) {\n props.onView?.();\n handleView();\n }\n }, [inView, handleView, props.onView]);\n\n const RenderComponent = props.render ?? ExampleResultCardCallout;\n\n return <RenderComponent {...props} handleClick={handleClick} itemRef={ref} />;\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
+ import { type ResultsProps } from "../../components";
2
3
  import type { ElasticProduct } from "../../types";
3
- import { ResultsProps } from "../../components";
4
4
  export type ResultCardProductProps = {
5
5
  pagePosition: number;
6
6
  product: ElasticProduct;
@@ -4,10 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ResultCardProduct = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
8
  const react_1 = __importDefault(require("react"));
8
9
  const react_intersection_observer_1 = require("react-intersection-observer");
9
- const hooks_1 = require("../../hooks");
10
10
  const components_1 = require("../../components");
11
+ const hooks_1 = require("../../hooks");
11
12
  const ResultCardProduct = (props) => {
12
13
  var _a;
13
14
  const productPrice = (0, hooks_1.useProductPrice)(props.product);
@@ -44,9 +45,9 @@ const ResultCardProduct = (props) => {
44
45
  (_a = props.onView) === null || _a === void 0 ? void 0 : _a.call(props);
45
46
  handleView();
46
47
  }
47
- }, [inView]);
48
+ }, [inView, handleView, props.onView]);
48
49
  const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleResultCardProduct;
49
- return (react_1.default.createElement(RenderComponent, Object.assign({}, productPrice, { pagePosition: props.pagePosition, product: props.product, document: props.document, itemRef: ref, handleClick: handleClick })));
50
+ return ((0, jsx_runtime_1.jsx)(RenderComponent, Object.assign({}, productPrice, { document: props.document, handleClick: handleClick, itemRef: ref, pagePosition: props.pagePosition, product: props.product })));
50
51
  };
51
52
  exports.ResultCardProduct = ResultCardProduct;
52
53
  //# sourceMappingURL=ResultCardProduct.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResultCardProduct.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultCardProduct.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6EAAwD;AAGxD,uCAA4D;AAC5D,iDAA0E;AAUnE,MAAM,iBAAiB,GAAqC,CAAC,KAAK,EAAE,EAAE;;IAC3E,MAAM,YAAY,GAAG,IAAA,uBAAe,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEpD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,uCAAS,EAAC;QAChC,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,eAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACzC,KAAK,CAAC;YACJ,SAAS,EAAE,cAAc;YACzB,OAAO,EAAE;gBACP,cAAc,EAAE;oBACd,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;oBACpB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;iBAC3B;aACF;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3B,MAAM,UAAU,GAAG,eAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,KAAK,CAAC;YACJ,SAAS,EAAE,aAAa;YACxB,OAAO,EAAE;gBACP,cAAc,EAAE;oBACd,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;oBACpB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;iBAC3B;aACF;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3B,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;;QACnB,IAAI,MAAM,EAAE,CAAC;YACX,MAAA,KAAK,CAAC,MAAM,qDAAI,CAAC;YACjB,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,qCAAwB,CAAC;IAEjE,OAAO,CACL,8BAAC,eAAe,oBACV,YAAY,IAChB,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,GAAG,EACZ,WAAW,EAAE,WAAW,IACxB,CACH,CAAC;AACJ,CAAC,CAAC;AApDW,QAAA,iBAAiB,qBAoD5B","sourcesContent":["import React from \"react\";\nimport { useInView } from \"react-intersection-observer\";\n\nimport type { ElasticProduct } from \"../../types\";\nimport { useProductPrice, useAnalytics } from \"../../hooks\";\nimport { ResultsProps, ExampleResultCardProduct } from \"../../components\";\n\nexport type ResultCardProductProps = {\n pagePosition: number;\n product: ElasticProduct;\n document: ElasticProduct;\n render?: ResultsProps[\"renderResultCardProduct\"];\n onView?: () => void;\n};\n\nexport const ResultCardProduct: React.FC<ResultCardProductProps> = (props) => {\n const productPrice = useProductPrice(props.product);\n\n const { track } = useAnalytics();\n const { ref, inView } = useInView({\n threshold: 0.5,\n triggerOnce: true,\n });\n\n const handleClick = React.useCallback(() => {\n track({\n eventName: \"clickProduct\",\n payload: {\n elasticProduct: {\n id: props.product.id,\n title: props.product.title,\n },\n },\n });\n }, [track, props.product]);\n\n const handleView = React.useCallback(() => {\n track({\n eventName: \"viewProduct\",\n payload: {\n elasticProduct: {\n id: props.product.id,\n title: props.product.title,\n },\n },\n });\n }, [track, props.product]);\n\n React.useEffect(() => {\n if (inView) {\n props.onView?.();\n handleView();\n }\n }, [inView]);\n\n const RenderComponent = props.render ?? ExampleResultCardProduct;\n\n return (\n <RenderComponent\n {...productPrice}\n pagePosition={props.pagePosition}\n product={props.product}\n document={props.document}\n itemRef={ref}\n handleClick={handleClick}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"ResultCardProduct.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultCardProduct.tsx"],"names":[],"mappings":";;;;;;;AAAA,kDAA0B;AAC1B,6EAAwD;AACxD,iDAA+E;AAC/E,uCAA4D;AAWrD,MAAM,iBAAiB,GAAqC,CAAC,KAAK,EAAE,EAAE;;IAC3E,MAAM,YAAY,GAAG,IAAA,uBAAe,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEpD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,uCAAS,EAAC;QAChC,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,eAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACzC,KAAK,CAAC;YACJ,SAAS,EAAE,cAAc;YACzB,OAAO,EAAE;gBACP,cAAc,EAAE;oBACd,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;oBACpB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;iBAC3B;aACF;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3B,MAAM,UAAU,GAAG,eAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,KAAK,CAAC;YACJ,SAAS,EAAE,aAAa;YACxB,OAAO,EAAE;gBACP,cAAc,EAAE;oBACd,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;oBACpB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;iBAC3B;aACF;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3B,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;;QACnB,IAAI,MAAM,EAAE,CAAC;YACX,MAAA,KAAK,CAAC,MAAM,qDAAI,CAAC;YACjB,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvC,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,qCAAwB,CAAC;IAEjE,OAAO,CACL,uBAAC,eAAe,oBACV,YAAY,IAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,GAAG,EACZ,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,OAAO,EAAE,KAAK,CAAC,OAAO,IACtB,CACH,CAAC;AACJ,CAAC,CAAC;AApDW,QAAA,iBAAiB,qBAoD5B","sourcesContent":["import React from \"react\";\nimport { useInView } from \"react-intersection-observer\";\nimport { ExampleResultCardProduct, type ResultsProps } from \"../../components\";\nimport { useAnalytics, useProductPrice } from \"../../hooks\";\nimport type { ElasticProduct } from \"../../types\";\n\nexport type ResultCardProductProps = {\n pagePosition: number;\n product: ElasticProduct;\n document: ElasticProduct;\n render?: ResultsProps[\"renderResultCardProduct\"];\n onView?: () => void;\n};\n\nexport const ResultCardProduct: React.FC<ResultCardProductProps> = (props) => {\n const productPrice = useProductPrice(props.product);\n\n const { track } = useAnalytics();\n const { ref, inView } = useInView({\n threshold: 0.5,\n triggerOnce: true,\n });\n\n const handleClick = React.useCallback(() => {\n track({\n eventName: \"clickProduct\",\n payload: {\n elasticProduct: {\n id: props.product.id,\n title: props.product.title,\n },\n },\n });\n }, [track, props.product]);\n\n const handleView = React.useCallback(() => {\n track({\n eventName: \"viewProduct\",\n payload: {\n elasticProduct: {\n id: props.product.id,\n title: props.product.title,\n },\n },\n });\n }, [track, props.product]);\n\n React.useEffect(() => {\n if (inView) {\n props.onView?.();\n handleView();\n }\n }, [inView, handleView, props.onView]);\n\n const RenderComponent = props.render ?? ExampleResultCardProduct;\n\n return (\n <RenderComponent\n {...productPrice}\n document={props.document}\n handleClick={handleClick}\n itemRef={ref}\n pagePosition={props.pagePosition}\n product={props.product}\n />\n );\n};\n"]}