instantsearch.js 4.49.1 → 4.49.3

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 (396) hide show
  1. package/README.md +14 -8
  2. package/cjs/components/Answers/Answers.js +11 -18
  3. package/cjs/components/Breadcrumb/Breadcrumb.js +6 -13
  4. package/cjs/components/ClearRefinements/ClearRefinements.js +5 -12
  5. package/cjs/components/CurrentRefinements/CurrentRefinements.js +8 -16
  6. package/cjs/components/GeoSearchControls/GeoSearchButton.js +4 -7
  7. package/cjs/components/GeoSearchControls/GeoSearchControls.js +14 -23
  8. package/cjs/components/GeoSearchControls/GeoSearchToggle.js +4 -7
  9. package/cjs/components/Highlight/Highlight.js +5 -12
  10. package/cjs/components/Hits/Hits.js +13 -22
  11. package/cjs/components/InfiniteHits/InfiniteHits.js +18 -27
  12. package/cjs/components/InternalHighlight/InternalHighlight.js +0 -3
  13. package/cjs/components/MenuSelect/MenuSelect.js +12 -22
  14. package/cjs/components/Pagination/Pagination.js +12 -20
  15. package/cjs/components/Panel/Panel.js +9 -28
  16. package/cjs/components/PoweredBy/PoweredBy.js +4 -6
  17. package/cjs/components/QueryRuleCustomData/QueryRuleCustomData.js +3 -8
  18. package/cjs/components/RangeInput/RangeInput.js +21 -51
  19. package/cjs/components/RefinementList/RefinementList.js +30 -81
  20. package/cjs/components/RefinementList/RefinementListItem.js +9 -15
  21. package/cjs/components/RelevantSort/RelevantSort.js +5 -10
  22. package/cjs/components/ReverseHighlight/ReverseHighlight.js +5 -12
  23. package/cjs/components/ReverseSnippet/ReverseSnippet.js +5 -12
  24. package/cjs/components/SearchBox/SearchBox.js +35 -77
  25. package/cjs/components/Selector/Selector.js +3 -7
  26. package/cjs/components/Slider/Pit.js +7 -11
  27. package/cjs/components/Slider/Rheostat.js +69 -133
  28. package/cjs/components/Slider/Slider.js +39 -72
  29. package/cjs/components/Snippet/Snippet.js +5 -12
  30. package/cjs/components/Stats/Stats.js +13 -22
  31. package/cjs/components/Template/Template.js +17 -44
  32. package/cjs/components/ToggleRefinement/ToggleRefinement.js +5 -11
  33. package/cjs/components/VoiceSearch/VoiceSearch.js +9 -17
  34. package/cjs/connectors/answers/connectAnswers.js +36 -46
  35. package/cjs/connectors/autocomplete/connectAutocomplete.js +21 -35
  36. package/cjs/connectors/breadcrumb/connectBreadcrumb.js +27 -55
  37. package/cjs/connectors/clear-refinements/connectClearRefinements.js +41 -56
  38. package/cjs/connectors/configure/connectConfigure.js +17 -28
  39. package/cjs/connectors/configure-related-items/connectConfigureRelatedItems.js +21 -43
  40. package/cjs/connectors/current-refinements/connectCurrentRefinements.js +29 -65
  41. package/cjs/connectors/dynamic-widgets/connectDynamicWidgets.js +27 -45
  42. package/cjs/connectors/geo-search/connectGeoSearch.js +32 -59
  43. package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +50 -82
  44. package/cjs/connectors/hits/connectHits.js +25 -38
  45. package/cjs/connectors/hits/connectHitsWithInsights.js +3 -7
  46. package/cjs/connectors/hits-per-page/connectHitsPerPage.js +26 -46
  47. package/cjs/connectors/index.js +92 -126
  48. package/cjs/connectors/infinite-hits/connectInfiniteHits.js +43 -75
  49. package/cjs/connectors/infinite-hits/connectInfiniteHitsWithInsights.js +3 -7
  50. package/cjs/connectors/menu/connectMenu.js +39 -73
  51. package/cjs/connectors/numeric-menu/connectNumericMenu.js +37 -86
  52. package/cjs/connectors/pagination/Paginator.js +11 -25
  53. package/cjs/connectors/pagination/connectPagination.js +17 -31
  54. package/cjs/connectors/powered-by/connectPoweredBy.js +13 -19
  55. package/cjs/connectors/query-rules/connectQueryRules.js +44 -65
  56. package/cjs/connectors/range/connectRange.js +72 -129
  57. package/cjs/connectors/rating-menu/connectRatingMenu.js +34 -87
  58. package/cjs/connectors/refinement-list/connectRefinementList.js +51 -79
  59. package/cjs/connectors/relevant-sort/connectRelevantSort.js +11 -18
  60. package/cjs/connectors/search-box/connectSearchBox.js +15 -28
  61. package/cjs/connectors/sort-by/connectSortBy.js +21 -28
  62. package/cjs/connectors/stats/connectStats.js +12 -16
  63. package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +44 -75
  64. package/cjs/connectors/voice-search/connectVoiceSearch.js +22 -41
  65. package/cjs/helpers/components/Highlight.js +11 -18
  66. package/cjs/helpers/components/ReverseHighlight.js +19 -26
  67. package/cjs/helpers/components/ReverseSnippet.js +19 -26
  68. package/cjs/helpers/components/Snippet.js +11 -18
  69. package/cjs/helpers/components/index.js +4 -12
  70. package/cjs/helpers/get-insights-anonymous-user-token.js +6 -17
  71. package/cjs/helpers/highlight.js +15 -19
  72. package/cjs/helpers/index.js +23 -37
  73. package/cjs/helpers/insights.js +9 -21
  74. package/cjs/helpers/reverseHighlight.js +16 -20
  75. package/cjs/helpers/reverseSnippet.js +16 -20
  76. package/cjs/helpers/snippet.js +15 -19
  77. package/cjs/index.js +12 -27
  78. package/cjs/lib/InstantSearch.js +108 -207
  79. package/cjs/lib/createHelpers.js +15 -19
  80. package/cjs/lib/formatNumber.js +0 -1
  81. package/cjs/lib/infiniteHitsCache/index.js +1 -3
  82. package/cjs/lib/infiniteHitsCache/sessionStorage.js +14 -22
  83. package/cjs/lib/insights/client.js +17 -40
  84. package/cjs/lib/insights/index.js +9 -15
  85. package/cjs/lib/insights/listener.js +7 -24
  86. package/cjs/lib/routers/history.js +75 -117
  87. package/cjs/lib/routers/index.js +1 -3
  88. package/cjs/lib/stateMappings/index.js +2 -5
  89. package/cjs/lib/stateMappings/simple.js +11 -14
  90. package/cjs/lib/stateMappings/singleIndex.js +6 -8
  91. package/cjs/lib/suit.js +2 -5
  92. package/cjs/lib/templating/index.js +2 -6
  93. package/cjs/lib/templating/prepareTemplateProps.js +14 -22
  94. package/cjs/lib/templating/renderTemplate.js +17 -30
  95. package/cjs/lib/utils/capitalize.js +0 -1
  96. package/cjs/lib/utils/checkIndexUiState.js +19 -47
  97. package/cjs/lib/utils/checkRendering.js +1 -3
  98. package/cjs/lib/utils/clearRefinements.js +2 -9
  99. package/cjs/lib/utils/concatHighlightedParts.js +2 -4
  100. package/cjs/lib/utils/createConcurrentSafePromise.js +0 -3
  101. package/cjs/lib/utils/createSendEventForFacet.js +8 -15
  102. package/cjs/lib/utils/createSendEventForHits.js +10 -34
  103. package/cjs/lib/utils/debounce.js +0 -3
  104. package/cjs/lib/utils/defer.js +0 -11
  105. package/cjs/lib/utils/detect-insights-client.js +1 -3
  106. package/cjs/lib/utils/documentation.js +2 -5
  107. package/cjs/lib/utils/escape-highlight.js +13 -26
  108. package/cjs/lib/utils/escape-html.js +9 -7
  109. package/cjs/lib/utils/escapeFacetValue.js +1 -5
  110. package/cjs/lib/utils/find.js +2 -5
  111. package/cjs/lib/utils/findIndex.js +0 -3
  112. package/cjs/lib/utils/geo-search.js +21 -37
  113. package/cjs/lib/utils/getAppIdAndApiKey.js +2 -3
  114. package/cjs/lib/utils/getContainerNode.js +1 -7
  115. package/cjs/lib/utils/getHighlightFromSiblings.js +1 -7
  116. package/cjs/lib/utils/getHighlightedParts.js +2 -5
  117. package/cjs/lib/utils/getObjectType.js +0 -1
  118. package/cjs/lib/utils/getPropertyByPath.js +0 -1
  119. package/cjs/lib/utils/getRefinements.js +30 -45
  120. package/cjs/lib/utils/getWidgetAttribute.js +0 -6
  121. package/cjs/lib/utils/hits-absolute-position.js +6 -7
  122. package/cjs/lib/utils/hits-query-id.js +6 -8
  123. package/cjs/lib/utils/index.js +46 -138
  124. package/cjs/lib/utils/isDomElement.js +0 -1
  125. package/cjs/lib/utils/isEqual.js +2 -7
  126. package/cjs/lib/utils/isFacetRefined.js +0 -1
  127. package/cjs/lib/utils/isFiniteNumber.js +0 -1
  128. package/cjs/lib/utils/isIndexWidget.js +0 -1
  129. package/cjs/lib/utils/isPlainObject.js +3 -11
  130. package/cjs/lib/utils/isSpecialClick.js +0 -1
  131. package/cjs/lib/utils/logger.js +6 -16
  132. package/cjs/lib/utils/mergeSearchParameters.js +23 -43
  133. package/cjs/lib/utils/noop.js +0 -1
  134. package/cjs/lib/utils/range.js +9 -15
  135. package/cjs/lib/utils/render-args.js +0 -2
  136. package/cjs/lib/utils/resolveSearchParameters.js +0 -3
  137. package/cjs/lib/utils/reverseHighlightedParts.js +7 -10
  138. package/cjs/lib/utils/safelyRunOnBrowser.js +7 -9
  139. package/cjs/lib/utils/serializer.js +1 -3
  140. package/cjs/lib/utils/setIndexHelperState.js +2 -7
  141. package/cjs/lib/utils/toArray.js +0 -1
  142. package/cjs/lib/utils/typedObject.js +0 -1
  143. package/cjs/lib/utils/uniq.js +0 -1
  144. package/cjs/lib/version.js +1 -1
  145. package/cjs/lib/voiceSearchHelper/index.js +12 -37
  146. package/cjs/middlewares/createInsightsMiddleware.js +30 -54
  147. package/cjs/middlewares/createMetadataMiddleware.js +7 -15
  148. package/cjs/middlewares/createRouterMiddleware.js +16 -24
  149. package/cjs/middlewares/index.js +3 -9
  150. package/cjs/types/algoliasearch.js +0 -2
  151. package/cjs/types/index.js +14 -42
  152. package/cjs/widgets/analytics/analytics.js +22 -48
  153. package/cjs/widgets/answers/answers.js +32 -49
  154. package/cjs/widgets/breadcrumb/breadcrumb.js +31 -48
  155. package/cjs/widgets/clear-refinements/clear-refinements.js +28 -45
  156. package/cjs/widgets/configure/configure.js +9 -14
  157. package/cjs/widgets/configure-related-items/configure-related-items.js +9 -14
  158. package/cjs/widgets/current-refinements/current-refinements.js +22 -37
  159. package/cjs/widgets/dynamic-widgets/dynamic-widgets.js +17 -32
  160. package/cjs/widgets/geo-search/GeoSearchRenderer.js +50 -72
  161. package/cjs/widgets/geo-search/createHTMLMarker.js +34 -62
  162. package/cjs/widgets/geo-search/defaultTemplates.js +0 -3
  163. package/cjs/widgets/geo-search/geo-search.js +44 -70
  164. package/cjs/widgets/hierarchical-menu/defaultTemplates.js +5 -9
  165. package/cjs/widgets/hierarchical-menu/hierarchical-menu.js +41 -57
  166. package/cjs/widgets/hits/hits.js +32 -50
  167. package/cjs/widgets/hits-per-page/hits-per-page.js +24 -39
  168. package/cjs/widgets/index/index.js +71 -113
  169. package/cjs/widgets/index.js +47 -85
  170. package/cjs/widgets/infinite-hits/infinite-hits.js +39 -57
  171. package/cjs/widgets/menu/defaultTemplates.js +4 -8
  172. package/cjs/widgets/menu/menu.js +36 -53
  173. package/cjs/widgets/menu-select/defaultTemplates.js +2 -4
  174. package/cjs/widgets/menu-select/menu-select.js +31 -48
  175. package/cjs/widgets/numeric-menu/defaultTemplates.js +3 -5
  176. package/cjs/widgets/numeric-menu/numeric-menu.js +30 -47
  177. package/cjs/widgets/pagination/pagination.js +43 -61
  178. package/cjs/widgets/panel/panel.js +31 -56
  179. package/cjs/widgets/places/places.js +22 -34
  180. package/cjs/widgets/powered-by/powered-by.js +20 -34
  181. package/cjs/widgets/query-rule-context/query-rule-context.js +10 -18
  182. package/cjs/widgets/query-rule-custom-data/query-rule-custom-data.js +24 -39
  183. package/cjs/widgets/range-input/range-input.js +36 -60
  184. package/cjs/widgets/range-slider/range-slider.js +39 -61
  185. package/cjs/widgets/rating-menu/defaultTemplates.js +9 -16
  186. package/cjs/widgets/rating-menu/rating-menu.js +30 -48
  187. package/cjs/widgets/refinement-list/defaultTemplates.js +6 -10
  188. package/cjs/widgets/refinement-list/refinement-list.js +54 -72
  189. package/cjs/widgets/relevant-sort/relevant-sort.js +21 -37
  190. package/cjs/widgets/search-box/defaultTemplates.js +0 -5
  191. package/cjs/widgets/search-box/search-box.js +42 -57
  192. package/cjs/widgets/sort-by/sort-by.js +21 -36
  193. package/cjs/widgets/stats/defaultTemplates.js +1 -2
  194. package/cjs/widgets/stats/stats.js +40 -67
  195. package/cjs/widgets/toggle-refinement/toggle-refinement.js +29 -46
  196. package/cjs/widgets/voice-search/defaultTemplates.js +4 -14
  197. package/cjs/widgets/voice-search/voice-search.js +28 -44
  198. package/dist/instantsearch.development.d.ts +9 -6
  199. package/dist/instantsearch.development.js +1840 -3142
  200. package/dist/instantsearch.development.js.map +1 -1
  201. package/dist/instantsearch.production.d.ts +9 -6
  202. package/dist/instantsearch.production.min.d.ts +9 -6
  203. package/dist/instantsearch.production.min.js +2 -2
  204. package/dist/instantsearch.production.min.js.map +1 -1
  205. package/es/components/Answers/Answers.js +10 -13
  206. package/es/components/Breadcrumb/Breadcrumb.js +5 -8
  207. package/es/components/ClearRefinements/ClearRefinements.js +4 -7
  208. package/es/components/CurrentRefinements/CurrentRefinements.js +5 -10
  209. package/es/components/GeoSearchControls/GeoSearchButton.js +4 -6
  210. package/es/components/GeoSearchControls/GeoSearchControls.js +11 -14
  211. package/es/components/GeoSearchControls/GeoSearchToggle.js +4 -6
  212. package/es/components/Highlight/Highlight.js +4 -7
  213. package/es/components/Hits/Hits.js +12 -17
  214. package/es/components/InfiniteHits/InfiniteHits.js +17 -22
  215. package/es/components/MenuSelect/MenuSelect.js +9 -14
  216. package/es/components/Pagination/Pagination.js +10 -15
  217. package/es/components/Panel/Panel.js +8 -22
  218. package/es/components/PoweredBy/PoweredBy.js +4 -5
  219. package/es/components/QueryRuleCustomData/QueryRuleCustomData.js +2 -4
  220. package/es/components/RangeInput/RangeInput.js +20 -46
  221. package/es/components/RefinementList/RefinementList.js +24 -67
  222. package/es/components/RefinementList/RefinementListItem.js +8 -11
  223. package/es/components/RelevantSort/RelevantSort.js +4 -6
  224. package/es/components/ReverseHighlight/ReverseHighlight.js +4 -7
  225. package/es/components/ReverseSnippet/ReverseSnippet.js +4 -7
  226. package/es/components/SearchBox/SearchBox.js +29 -66
  227. package/es/components/Selector/Selector.js +3 -5
  228. package/es/components/Slider/Pit.js +7 -9
  229. package/es/components/Slider/Rheostat.js +70 -133
  230. package/es/components/Slider/Slider.js +34 -61
  231. package/es/components/Snippet/Snippet.js +4 -7
  232. package/es/components/Stats/Stats.js +12 -17
  233. package/es/components/Template/Template.js +12 -35
  234. package/es/components/ToggleRefinement/ToggleRefinement.js +4 -7
  235. package/es/components/VoiceSearch/VoiceSearch.js +8 -13
  236. package/es/connectors/answers/connectAnswers.js +27 -36
  237. package/es/connectors/autocomplete/connectAutocomplete.js +12 -24
  238. package/es/connectors/breadcrumb/connectBreadcrumb.js +22 -48
  239. package/es/connectors/clear-refinements/connectClearRefinements.js +32 -45
  240. package/es/connectors/configure/connectConfigure.js +11 -17
  241. package/es/connectors/configure-related-items/connectConfigureRelatedItems.js +16 -33
  242. package/es/connectors/current-refinements/connectCurrentRefinements.js +23 -57
  243. package/es/connectors/dynamic-widgets/connectDynamicWidgets.js +20 -36
  244. package/es/connectors/geo-search/connectGeoSearch.js +21 -46
  245. package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +44 -74
  246. package/es/connectors/hits/connectHits.js +14 -25
  247. package/es/connectors/hits-per-page/connectHitsPerPage.js +20 -38
  248. package/es/connectors/index.d.ts +2 -1
  249. package/es/connectors/index.js +6 -3
  250. package/es/connectors/infinite-hits/connectInfiniteHits.js +32 -62
  251. package/es/connectors/menu/connectMenu.js +34 -66
  252. package/es/connectors/numeric-menu/connectNumericMenu.js +31 -78
  253. package/es/connectors/pagination/Paginator.js +8 -21
  254. package/es/connectors/pagination/connectPagination.js +12 -22
  255. package/es/connectors/powered-by/connectPoweredBy.js +8 -12
  256. package/es/connectors/query-rules/connectQueryRules.js +37 -56
  257. package/es/connectors/range/connectRange.js +46 -101
  258. package/es/connectors/rating-menu/connectRatingMenu.js +28 -79
  259. package/es/connectors/refinement-list/connectRefinementList.js +43 -69
  260. package/es/connectors/relevant-sort/connectRelevantSort.js +8 -14
  261. package/es/connectors/search-box/connectSearchBox.js +11 -22
  262. package/es/connectors/sort-by/connectSortBy.js +15 -20
  263. package/es/connectors/stats/connectStats.js +8 -10
  264. package/es/connectors/toggle-refinement/connectToggleRefinement.js +33 -62
  265. package/es/connectors/toggle-refinement/types.js +1 -0
  266. package/es/connectors/voice-search/connectVoiceSearch.js +17 -32
  267. package/es/helpers/components/Highlight.js +5 -8
  268. package/es/helpers/components/ReverseHighlight.js +13 -16
  269. package/es/helpers/components/ReverseSnippet.js +13 -16
  270. package/es/helpers/components/Snippet.js +5 -8
  271. package/es/helpers/get-insights-anonymous-user-token.js +2 -10
  272. package/es/helpers/highlight.js +10 -10
  273. package/es/helpers/insights.js +3 -10
  274. package/es/helpers/reverseHighlight.js +10 -10
  275. package/es/helpers/reverseSnippet.js +10 -10
  276. package/es/helpers/snippet.js +10 -10
  277. package/es/index.js +0 -2
  278. package/es/lib/InstantSearch.js +83 -172
  279. package/es/lib/createHelpers.js +8 -9
  280. package/es/lib/infiniteHitsCache/sessionStorage.js +10 -16
  281. package/es/lib/insights/client.js +12 -33
  282. package/es/lib/insights/listener.js +4 -18
  283. package/es/lib/routers/history.js +69 -108
  284. package/es/lib/stateMappings/simple.js +11 -13
  285. package/es/lib/stateMappings/singleIndex.js +6 -7
  286. package/es/lib/suit.js +2 -3
  287. package/es/lib/templating/prepareTemplateProps.js +13 -20
  288. package/es/lib/templating/renderTemplate.js +12 -21
  289. package/es/lib/utils/checkIndexUiState.js +19 -41
  290. package/es/lib/utils/clearRefinements.js +2 -8
  291. package/es/lib/utils/concatHighlightedParts.js +1 -1
  292. package/es/lib/utils/createConcurrentSafePromise.js +0 -2
  293. package/es/lib/utils/createSendEventForFacet.js +7 -12
  294. package/es/lib/utils/createSendEventForHits.js +8 -30
  295. package/es/lib/utils/debounce.js +0 -2
  296. package/es/lib/utils/defer.js +0 -10
  297. package/es/lib/utils/documentation.js +2 -3
  298. package/es/lib/utils/escape-highlight.js +9 -18
  299. package/es/lib/utils/escape-html.js +9 -5
  300. package/es/lib/utils/escapeFacetValue.js +0 -2
  301. package/es/lib/utils/find.js +2 -4
  302. package/es/lib/utils/findIndex.js +0 -2
  303. package/es/lib/utils/geo-search.js +21 -35
  304. package/es/lib/utils/getAppIdAndApiKey.js +2 -2
  305. package/es/lib/utils/getContainerNode.js +1 -5
  306. package/es/lib/utils/getHighlightFromSiblings.js +0 -3
  307. package/es/lib/utils/getHighlightedParts.js +1 -2
  308. package/es/lib/utils/getRefinements.js +28 -41
  309. package/es/lib/utils/getWidgetAttribute.js +0 -5
  310. package/es/lib/utils/hits-absolute-position.js +6 -6
  311. package/es/lib/utils/hits-query-id.js +6 -7
  312. package/es/lib/utils/isEqual.js +2 -6
  313. package/es/lib/utils/isPlainObject.js +3 -10
  314. package/es/lib/utils/logger.js +4 -14
  315. package/es/lib/utils/mergeSearchParameters.js +21 -38
  316. package/es/lib/utils/range.js +9 -14
  317. package/es/lib/utils/resolveSearchParameters.js +0 -2
  318. package/es/lib/utils/reverseHighlightedParts.js +6 -7
  319. package/es/lib/utils/safelyRunOnBrowser.js +7 -8
  320. package/es/lib/utils/setIndexHelperState.js +0 -2
  321. package/es/lib/version.d.ts +1 -1
  322. package/es/lib/version.js +1 -1
  323. package/es/lib/voiceSearchHelper/index.js +12 -36
  324. package/es/lib/voiceSearchHelper/types.js +1 -0
  325. package/es/middlewares/createInsightsMiddleware.js +21 -42
  326. package/es/middlewares/createMetadataMiddleware.js +3 -9
  327. package/es/middlewares/createRouterMiddleware.js +12 -14
  328. package/es/types/algoliasearch.js +1 -0
  329. package/es/types/component.js +1 -0
  330. package/es/types/connector.js +1 -0
  331. package/es/types/index.js +9 -5
  332. package/es/types/insights.js +1 -0
  333. package/es/types/instantsearch.js +1 -0
  334. package/es/types/middleware.js +1 -0
  335. package/es/types/render-state.js +1 -0
  336. package/es/types/results.js +1 -0
  337. package/es/types/router.js +1 -0
  338. package/es/types/templates.js +1 -0
  339. package/es/types/ui-state.js +1 -0
  340. package/es/types/utils.js +1 -0
  341. package/es/types/widget-factory.js +1 -0
  342. package/es/types/widget.js +1 -0
  343. package/es/widgets/analytics/analytics.js +19 -43
  344. package/es/widgets/answers/answers.js +23 -30
  345. package/es/widgets/breadcrumb/breadcrumb.js +22 -29
  346. package/es/widgets/clear-refinements/clear-refinements.js +19 -26
  347. package/es/widgets/configure/configure.js +7 -7
  348. package/es/widgets/configure-related-items/configure-related-items.js +6 -8
  349. package/es/widgets/current-refinements/current-refinements.js +16 -23
  350. package/es/widgets/dynamic-widgets/dynamic-widgets.js +11 -21
  351. package/es/widgets/geo-search/GeoSearchRenderer.d.js +1 -0
  352. package/es/widgets/geo-search/GeoSearchRenderer.js +47 -65
  353. package/es/widgets/geo-search/createHTMLMarker.d.ts +1 -0
  354. package/es/widgets/geo-search/createHTMLMarker.js +34 -61
  355. package/es/widgets/geo-search/defaultTemplates.js +0 -2
  356. package/es/widgets/geo-search/geo-search.d.ts +1 -0
  357. package/es/widgets/geo-search/geo-search.js +34 -50
  358. package/es/widgets/hierarchical-menu/defaultTemplates.js +4 -4
  359. package/es/widgets/hierarchical-menu/hierarchical-menu.js +32 -38
  360. package/es/widgets/hits/hits.js +20 -27
  361. package/es/widgets/hits-per-page/hits-per-page.js +17 -24
  362. package/es/widgets/index/index.js +55 -93
  363. package/es/widgets/index.d.ts +2 -1
  364. package/es/widgets/index.js +4 -3
  365. package/es/widgets/infinite-hits/infinite-hits.js +27 -34
  366. package/es/widgets/menu/defaultTemplates.js +3 -3
  367. package/es/widgets/menu/menu.js +27 -34
  368. package/es/widgets/menu-select/defaultTemplates.js +1 -1
  369. package/es/widgets/menu-select/menu-select.js +22 -29
  370. package/es/widgets/numeric-menu/defaultTemplates.js +3 -3
  371. package/es/widgets/numeric-menu/numeric-menu.js +21 -28
  372. package/es/widgets/pagination/pagination.js +36 -46
  373. package/es/widgets/panel/panel.js +24 -42
  374. package/es/widgets/places/places.js +22 -33
  375. package/es/widgets/powered-by/powered-by.js +14 -20
  376. package/es/widgets/query-rule-context/query-rule-context.js +6 -10
  377. package/es/widgets/query-rule-custom-data/query-rule-custom-data.js +17 -24
  378. package/es/widgets/range-input/range-input.js +28 -43
  379. package/es/widgets/range-slider/range-slider.js +33 -47
  380. package/es/widgets/rating-menu/defaultTemplates.js +8 -12
  381. package/es/widgets/rating-menu/rating-menu.js +21 -29
  382. package/es/widgets/refinement-list/defaultTemplates.js +5 -5
  383. package/es/widgets/refinement-list/refinement-list.js +43 -50
  384. package/es/widgets/relevant-sort/relevant-sort.js +14 -21
  385. package/es/widgets/search-box/defaultTemplates.js +0 -4
  386. package/es/widgets/search-box/search-box.js +35 -41
  387. package/es/widgets/sort-by/sort-by.js +15 -22
  388. package/es/widgets/stats/stats.js +30 -47
  389. package/es/widgets/toggle-refinement/toggle-refinement.js +20 -27
  390. package/es/widgets/voice-search/defaultTemplates.js +4 -13
  391. package/es/widgets/voice-search/voice-search.js +21 -28
  392. package/package.json +20 -119
  393. package/scripts/transforms/__testfixtures__/addWidget-to-addWidgets/imported.input.js +0 -1
  394. package/scripts/transforms/__testfixtures__/addWidget-to-addWidgets/imported.output.js +0 -1
  395. package/scripts/transforms/__tests__/addWidget-to-addWidgets.test.js +1 -0
  396. package/CHANGELOG.md +0 -3693
@@ -4,27 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _preact = require("preact");
9
-
10
8
  var _uiComponentsShared = require("@algolia/ui-components-shared");
11
-
12
- var _index = require("../../lib/utils/index.js");
13
-
9
+ var _utils = require("../../lib/utils");
14
10
  function Pagination(props) {
15
11
  function createClickHandler(pageNumber) {
16
12
  return function (event) {
17
- if ((0, _index.isSpecialClick)(event)) {
13
+ if ((0, _utils.isSpecialClick)(event)) {
18
14
  // do not alter the default browser behavior
19
15
  // if one special key is down
20
16
  return;
21
17
  }
22
-
23
18
  event.preventDefault();
24
19
  props.setCurrentPage(pageNumber);
25
20
  };
26
21
  }
27
-
28
22
  return (0, _preact.h)("div", {
29
23
  className: (0, _uiComponentsShared.cx)(props.cssClasses.root, props.nbPages <= 1 && props.cssClasses.noRefinementRoot)
30
24
  }, (0, _preact.h)("ul", {
@@ -79,19 +73,18 @@ function Pagination(props) {
79
73
  createClickHandler: createClickHandler
80
74
  })));
81
75
  }
82
-
83
76
  function PaginationLink(_ref) {
84
77
  var label = _ref.label,
85
- ariaLabel = _ref.ariaLabel,
86
- pageNumber = _ref.pageNumber,
87
- className = _ref.className,
88
- _ref$isDisabled = _ref.isDisabled,
89
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
90
- _ref$isSelected = _ref.isSelected,
91
- isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
92
- cssClasses = _ref.cssClasses,
93
- createURL = _ref.createURL,
94
- createClickHandler = _ref.createClickHandler;
78
+ ariaLabel = _ref.ariaLabel,
79
+ pageNumber = _ref.pageNumber,
80
+ className = _ref.className,
81
+ _ref$isDisabled = _ref.isDisabled,
82
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
83
+ _ref$isSelected = _ref.isSelected,
84
+ isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
85
+ cssClasses = _ref.cssClasses,
86
+ createURL = _ref.createURL,
87
+ createClickHandler = _ref.createClickHandler;
95
88
  return (0, _preact.h)("li", {
96
89
  className: (0, _uiComponentsShared.cx)(cssClasses.item, className, isDisabled && cssClasses.disabledItem, isSelected && cssClasses.selectedItem)
97
90
  }, isDisabled ? (0, _preact.h)("span", {
@@ -109,6 +102,5 @@ function PaginationLink(_ref) {
109
102
  }
110
103
  }));
111
104
  }
112
-
113
105
  var _default = Pagination;
114
106
  exports.default = _default;
@@ -4,58 +4,40 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _preact = require("preact");
9
-
10
8
  var _hooks = require("preact/hooks");
11
-
12
9
  var _uiComponentsShared = require("@algolia/ui-components-shared");
13
-
14
- var _Template = _interopRequireDefault(require("../Template/Template.js"));
15
-
10
+ var _Template = _interopRequireDefault(require("../Template/Template"));
16
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
12
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
19
-
20
13
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
-
22
14
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
-
24
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
25
-
26
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
27
-
15
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
16
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
28
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
-
30
18
  function Panel(props) {
31
19
  var _useState = (0, _hooks.useState)(props.isCollapsed),
32
- _useState2 = _slicedToArray(_useState, 2),
33
- isCollapsed = _useState2[0],
34
- setIsCollapsed = _useState2[1];
35
-
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ isCollapsed = _useState2[0],
22
+ setIsCollapsed = _useState2[1];
36
23
  var _useState3 = (0, _hooks.useState)(false),
37
- _useState4 = _slicedToArray(_useState3, 2),
38
- isControlled = _useState4[0],
39
- setIsControlled = _useState4[1];
40
-
24
+ _useState4 = _slicedToArray(_useState3, 2),
25
+ isControlled = _useState4[0],
26
+ setIsControlled = _useState4[1];
41
27
  var bodyRef = (0, _hooks.useRef)(null);
42
28
  (0, _hooks.useEffect)(function () {
43
29
  var node = bodyRef.current;
44
-
45
30
  if (!node) {
46
31
  return undefined;
47
32
  }
48
-
49
33
  node.appendChild(props.bodyElement);
50
34
  return function () {
51
35
  node.removeChild(props.bodyElement);
52
36
  };
53
37
  }, [bodyRef, props.bodyElement]);
54
-
55
38
  if (!isControlled && props.isCollapsed !== isCollapsed) {
56
39
  setIsCollapsed(props.isCollapsed);
57
40
  }
58
-
59
41
  return (0, _preact.h)("div", {
60
42
  className: (0, _uiComponentsShared.cx)(props.cssClasses.root, props.hidden && props.cssClasses.noRefinementRoot, props.collapsible && props.cssClasses.collapsibleRoot, isCollapsed && props.cssClasses.collapsedRoot),
61
43
  hidden: props.hidden
@@ -95,6 +77,5 @@ function Panel(props) {
95
77
  data: props.data
96
78
  }));
97
79
  }
98
-
99
80
  var _default = Panel;
100
81
  exports.default = _default;
@@ -4,13 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _preact = require("preact");
9
-
10
8
  var PoweredBy = function PoweredBy(_ref) {
11
9
  var url = _ref.url,
12
- theme = _ref.theme,
13
- cssClasses = _ref.cssClasses;
10
+ theme = _ref.theme,
11
+ cssClasses = _ref.cssClasses;
14
12
  return (0, _preact.h)("div", {
15
13
  className: cssClasses.root
16
14
  }, (0, _preact.h)("a", {
@@ -22,7 +20,8 @@ var PoweredBy = function PoweredBy(_ref) {
22
20
  }, (0, _preact.h)("svg", {
23
21
  height: "1.2em",
24
22
  className: cssClasses.logo,
25
- viewBox: "0 0 572 64" // This style is necessary as long as it's not included in InstantSearch.css.
23
+ viewBox: "0 0 572 64"
24
+ // This style is necessary as long as it's not included in InstantSearch.css.
26
25
  // For now, InstantSearch.css sets a maximum width of 70px.
27
26
  ,
28
27
  style: {
@@ -36,6 +35,5 @@ var PoweredBy = function PoweredBy(_ref) {
36
35
  d: "M534.4 9.1H528a.8.8 0 0 1-.7-.7V1.8c0-.4.2-.7.6-.8l6.5-1c.4 0 .8.2.9.6v7.8c0 .4-.4.7-.8.7zM428 35.2V.8c0-.5-.3-.8-.7-.8h-.2l-6.4 1c-.4 0-.7.4-.7.8v35c0 1.6 0 11.8 12.3 12.2.5 0 .8-.4.8-.8V43c0-.4-.3-.7-.6-.8-4.5-.5-4.5-6-4.5-7zm106.5-21.8H528c-.4 0-.7.4-.7.8v34c0 .4.3.8.7.8h6.5c.4 0 .8-.4.8-.8v-34c0-.5-.4-.8-.8-.8zm-17.7 21.8V.8c0-.5-.3-.8-.8-.8l-6.5 1c-.4 0-.7.4-.7.8v35c0 1.6 0 11.8 12.3 12.2.4 0 .8-.4.8-.8V43c0-.4-.3-.7-.7-.8-4.4-.5-4.4-6-4.4-7zm-22.2-20.6a16.5 16.5 0 0 1 8.6 9.3c.8 2.2 1.3 4.8 1.3 7.5a19.4 19.4 0 0 1-4.6 12.6 14.8 14.8 0 0 1-5.2 3.6c-2 .9-5.2 1.4-6.8 1.4a21 21 0 0 1-6.7-1.4 15.4 15.4 0 0 1-8.6-9.3 21.3 21.3 0 0 1 0-14.4 15.2 15.2 0 0 1 8.6-9.3c2-.8 4.3-1.2 6.7-1.2s4.6.4 6.7 1.2zm-6.7 27.6c2.7 0 4.7-1 6.2-3s2.2-4.3 2.2-7.8-.7-6.3-2.2-8.3-3.5-3-6.2-3-4.7 1-6.1 3c-1.5 2-2.2 4.8-2.2 8.3s.7 5.8 2.2 7.8 3.5 3 6.2 3zm-88.8-28.8c-6.2 0-11.7 3.3-14.8 8.2a18.6 18.6 0 0 0 4.8 25.2c1.8 1.2 4 1.8 6.2 1.7s.1 0 .1 0h.9c4.2-.7 8-4 9.1-8.1v7.4c0 .4.3.7.8.7h6.4a.7.7 0 0 0 .7-.7V14.2c0-.5-.3-.8-.7-.8h-13.5zm6.3 26.5a9.8 9.8 0 0 1-5.7 2h-.5a10 10 0 0 1-9.2-14c1.4-3.7 5-6.3 9-6.3h6.4v18.3zm152.3-26.5h13.5c.5 0 .8.3.8.7v33.7c0 .4-.3.7-.8.7h-6.4a.7.7 0 0 1-.8-.7v-7.4c-1.2 4-4.8 7.4-9 8h-.1a4.2 4.2 0 0 1-.5.1h-.9a10.3 10.3 0 0 1-7-2.6c-4-3.3-6.5-8.4-6.5-14.2 0-3.7 1-7.2 3-10 3-5 8.5-8.3 14.7-8.3zm.6 28.4c2.2-.1 4.2-.6 5.7-2V21.7h-6.3a9.8 9.8 0 0 0-9 6.4 10.2 10.2 0 0 0 9.1 13.9h.5zM452.8 13.4c-6.2 0-11.7 3.3-14.8 8.2a18.5 18.5 0 0 0 3.6 24.3 10.4 10.4 0 0 0 13 .6c2.2-1.5 3.8-3.7 4.5-6.1v7.8c0 2.8-.8 5-2.2 6.3-1.5 1.5-4 2.2-7.5 2.2l-6-.3c-.3 0-.7.2-.8.5l-1.6 5.5c-.1.4.1.8.5 1h.1c2.8.4 5.5.6 7 .6 6.3 0 11-1.4 14-4.1 2.7-2.5 4.2-6.3 4.5-11.4V14.2c0-.5-.4-.8-.8-.8h-13.5zm6.3 8.2v18.3a9.6 9.6 0 0 1-5.6 2h-1a10.3 10.3 0 0 1-8.8-14c1.4-3.7 5-6.3 9-6.3h6.4zM291 31.5A32 32 0 0 1 322.8 0h30.8c.6 0 1.2.5 1.2 1.2v61.5c0 1.1-1.3 1.7-2.2 1l-19.2-17a18 18 0 0 1-11 3.4 18.1 18.1 0 1 1 18.2-14.8c-.1.4-.5.7-.9.6-.1 0-.3 0-.4-.2l-3.8-3.4c-.4-.3-.6-.8-.7-1.4a12 12 0 1 0-2.4 8.3c.4-.4 1-.5 1.6-.2l14.7 13.1v-46H323a26 26 0 1 0 10 49.7c.8-.4 1.6-.2 2.3.3l3 2.7c.3.2.3.7 0 1l-.2.2a32 32 0 0 1-47.2-28.6z"
37
36
  }))));
38
37
  };
39
-
40
38
  var _default = PoweredBy;
41
39
  exports.default = _default;
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _preact = require("preact");
9
-
10
- var _Template = _interopRequireDefault(require("../Template/Template.js"));
11
-
8
+ var _Template = _interopRequireDefault(require("../Template/Template"));
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  var QueryRuleCustomData = function QueryRuleCustomData(_ref) {
15
11
  var cssClasses = _ref.cssClasses,
16
- templates = _ref.templates,
17
- items = _ref.items;
12
+ templates = _ref.templates,
13
+ items = _ref.items;
18
14
  return (0, _preact.h)(_Template.default, {
19
15
  templateKey: "default",
20
16
  templates: templates,
@@ -26,6 +22,5 @@ var QueryRuleCustomData = function QueryRuleCustomData(_ref) {
26
22
  }
27
23
  });
28
24
  };
29
-
30
25
  var _default = QueryRuleCustomData;
31
26
  exports.default = _default;
@@ -1,83 +1,55 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
7
  var _preact = require("preact");
11
-
12
8
  var _uiComponentsShared = require("@algolia/ui-components-shared");
13
-
14
- var _Template = _interopRequireDefault(require("../Template/Template.js"));
15
-
9
+ var _Template = _interopRequireDefault(require("../Template/Template"));
16
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
-
11
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
12
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
20
13
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
-
22
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
-
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
-
26
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
-
28
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
-
14
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
17
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
30
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
-
32
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
33
-
19
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
34
20
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
-
36
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
37
-
38
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
-
40
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
-
21
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
22
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
23
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
25
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
42
26
  var RangeInput = /*#__PURE__*/function (_Component) {
43
27
  _inherits(RangeInput, _Component);
44
-
45
28
  var _super = _createSuper(RangeInput);
46
-
47
29
  function RangeInput() {
48
30
  var _this;
49
-
50
31
  _classCallCheck(this, RangeInput);
51
-
52
32
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
53
33
  args[_key] = arguments[_key];
54
34
  }
55
-
56
35
  _this = _super.call.apply(_super, [this].concat(args));
57
-
58
36
  _defineProperty(_assertThisInitialized(_this), "state", {
59
37
  min: _this.props.values.min,
60
38
  max: _this.props.values.max
61
39
  });
62
-
63
40
  _defineProperty(_assertThisInitialized(_this), "onInput", function (key) {
64
41
  return function (event) {
65
42
  var _ref = event.currentTarget,
66
- value = _ref.value;
67
-
43
+ value = _ref.value;
68
44
  _this.setState(_defineProperty({}, key, Number(value)));
69
45
  };
70
46
  });
71
-
72
47
  _defineProperty(_assertThisInitialized(_this), "onSubmit", function (event) {
73
48
  event.preventDefault();
74
-
75
49
  _this.props.refine([_this.state.min, _this.state.max]);
76
50
  });
77
-
78
51
  return _this;
79
52
  }
80
-
81
53
  _createClass(RangeInput, [{
82
54
  key: "componentWillReceiveProps",
83
55
  value: function componentWillReceiveProps(nextProps) {
@@ -90,14 +62,14 @@ var RangeInput = /*#__PURE__*/function (_Component) {
90
62
  key: "render",
91
63
  value: function render() {
92
64
  var _this$state = this.state,
93
- minValue = _this$state.min,
94
- maxValue = _this$state.max;
65
+ minValue = _this$state.min,
66
+ maxValue = _this$state.max;
95
67
  var _this$props = this.props,
96
- min = _this$props.min,
97
- max = _this$props.max,
98
- step = _this$props.step,
99
- cssClasses = _this$props.cssClasses,
100
- templateProps = _this$props.templateProps;
68
+ min = _this$props.min,
69
+ max = _this$props.max,
70
+ step = _this$props.step,
71
+ cssClasses = _this$props.cssClasses,
72
+ templateProps = _this$props.templateProps;
101
73
  var isDisabled = min && max ? min >= max : false;
102
74
  var hasRefinements = Boolean(minValue || maxValue);
103
75
  var rootClassNames = (0, _uiComponentsShared.cx)(cssClasses.root, !hasRefinements && cssClasses.noRefinement);
@@ -147,9 +119,7 @@ var RangeInput = /*#__PURE__*/function (_Component) {
147
119
  }))));
148
120
  }
149
121
  }]);
150
-
151
122
  return RangeInput;
152
123
  }(_preact.Component);
153
-
154
124
  var _default = RangeInput;
155
125
  exports.default = _default;
@@ -1,89 +1,58 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.default = void 0;
9
-
10
7
  var _preact = require("preact");
11
-
12
8
  var _uiComponentsShared = require("@algolia/ui-components-shared");
13
-
14
- var _index = require("../../lib/utils/index.js");
15
-
16
- var _Template = _interopRequireDefault(require("../Template/Template.js"));
17
-
18
- var _RefinementListItem = _interopRequireDefault(require("./RefinementListItem.js"));
19
-
20
- var _SearchBox = _interopRequireDefault(require("../SearchBox/SearchBox.js"));
21
-
9
+ var _utils = require("../../lib/utils");
10
+ var _Template = _interopRequireDefault(require("../Template/Template"));
11
+ var _RefinementListItem = _interopRequireDefault(require("./RefinementListItem"));
12
+ var _SearchBox = _interopRequireDefault(require("../SearchBox/SearchBox"));
13
+ var _excluded = ["root"];
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
25
-
26
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
-
28
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
29
-
15
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
16
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
30
19
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
31
-
32
20
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
33
-
34
21
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
35
-
36
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
37
-
38
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
39
-
40
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
41
-
42
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
43
-
22
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
23
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
24
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
25
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
44
26
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
45
-
46
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
47
-
27
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
48
28
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
49
-
50
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
51
-
52
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
53
-
54
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
55
-
29
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
30
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
31
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
32
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
33
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
56
34
  var defaultProps = {
57
35
  cssClasses: {},
58
36
  depth: 0
59
37
  };
60
-
61
38
  function isHierarchicalMenuItem(facetValue) {
62
39
  return facetValue.data !== undefined;
63
40
  }
64
-
65
41
  var RefinementList = /*#__PURE__*/function (_Component) {
66
42
  _inherits(RefinementList, _Component);
67
-
68
43
  var _super = _createSuper(RefinementList);
69
-
70
44
  function RefinementList(props) {
71
45
  var _this;
72
-
73
46
  _classCallCheck(this, RefinementList);
74
-
75
47
  _this = _super.call(this, props);
76
-
77
48
  _defineProperty(_assertThisInitialized(_this), "searchBox", (0, _preact.createRef)());
78
-
79
49
  _this.handleItemClick = _this.handleItemClick.bind(_assertThisInitialized(_this));
80
50
  return _this;
81
51
  }
82
-
83
52
  _createClass(RefinementList, [{
84
53
  key: "shouldComponentUpdate",
85
54
  value: function shouldComponentUpdate(nextProps) {
86
- var areFacetValuesDifferent = !(0, _index.isEqual)(this.props.facetValues, nextProps.facetValues);
55
+ var areFacetValuesDifferent = !(0, _utils.isEqual)(this.props.facetValues, nextProps.facetValues);
87
56
  return areFacetValuesDifferent;
88
57
  }
89
58
  }, {
@@ -95,12 +64,10 @@ var RefinementList = /*#__PURE__*/function (_Component) {
95
64
  key: "_generateFacetItem",
96
65
  value: function _generateFacetItem(facetValue) {
97
66
  var subItems;
98
-
99
67
  if (isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) {
100
68
  var _this$props$cssClasse = this.props.cssClasses,
101
- root = _this$props$cssClasse.root,
102
- cssClasses = _objectWithoutProperties(_this$props$cssClasse, ["root"]);
103
-
69
+ root = _this$props$cssClasse.root,
70
+ cssClasses = _objectWithoutProperties(_this$props$cssClasse, _excluded);
104
71
  subItems = (0, _preact.h)(RefinementList, _extends({}, this.props, {
105
72
  // We want to keep `root` required for external usage but not for the
106
73
  // sub items.
@@ -111,26 +78,20 @@ var RefinementList = /*#__PURE__*/function (_Component) {
111
78
  className: this.props.cssClasses.childList
112
79
  }));
113
80
  }
114
-
115
81
  var url = this.props.createURL(facetValue.value);
116
-
117
82
  var templateData = _objectSpread(_objectSpread({}, facetValue), {}, {
118
83
  url: url,
119
84
  attribute: this.props.attribute,
120
85
  cssClasses: this.props.cssClasses,
121
86
  isFromSearch: this.props.isFromSearch
122
87
  });
123
-
124
88
  var key = facetValue.value;
125
-
126
89
  if (facetValue.isRefined !== undefined) {
127
90
  key += "/".concat(facetValue.isRefined);
128
91
  }
129
-
130
92
  if (facetValue.count !== undefined) {
131
93
  key += "/".concat(facetValue.count);
132
94
  }
133
-
134
95
  var refinementListItemClassName = (0, _uiComponentsShared.cx)(this.props.cssClasses.item, facetValue.isRefined && this.props.cssClasses.selectedItem, !facetValue.count && this.props.cssClasses.disabledItem, Boolean(isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) && this.props.cssClasses.parentItem);
135
96
  return (0, _preact.h)(_RefinementListItem.default, {
136
97
  templateKey: "item",
@@ -143,7 +104,9 @@ var RefinementList = /*#__PURE__*/function (_Component) {
143
104
  templateData: templateData,
144
105
  templateProps: this.props.templateProps
145
106
  });
146
- } // Click events on DOM tree like LABEL > INPUT will result in two click events
107
+ }
108
+
109
+ // Click events on DOM tree like LABEL > INPUT will result in two click events
147
110
  // instead of one.
148
111
  // No matter the framework, see https://www.google.com/search?q=click+label+twice
149
112
  //
@@ -158,48 +121,38 @@ var RefinementList = /*#__PURE__*/function (_Component) {
158
121
  //
159
122
  // Finally, we always stop propagation of the event to avoid multiple levels RefinementLists to fail: click
160
123
  // on child would click on parent also
161
-
162
124
  }, {
163
125
  key: "handleItemClick",
164
126
  value: function handleItemClick(_ref) {
165
127
  var facetValueToRefine = _ref.facetValueToRefine,
166
- isRefined = _ref.isRefined,
167
- originalEvent = _ref.originalEvent;
168
-
169
- if ((0, _index.isSpecialClick)(originalEvent)) {
128
+ isRefined = _ref.isRefined,
129
+ originalEvent = _ref.originalEvent;
130
+ if ((0, _utils.isSpecialClick)(originalEvent)) {
170
131
  // do not alter the default browser behavior
171
132
  // if one special key is down
172
133
  return;
173
134
  }
174
-
175
135
  if (!(originalEvent.target instanceof HTMLElement) || !(originalEvent.target.parentNode instanceof HTMLElement)) {
176
136
  return;
177
137
  }
178
-
179
138
  if (isRefined && originalEvent.target.parentNode.querySelector('input[type="radio"]:checked')) {
180
139
  // Prevent refinement for being reset if the user clicks on an already checked radio button
181
140
  return;
182
141
  }
183
-
184
142
  if (originalEvent.target.tagName === 'INPUT') {
185
143
  this.refine(facetValueToRefine);
186
144
  return;
187
145
  }
188
-
189
146
  var parent = originalEvent.target;
190
-
191
147
  while (parent !== originalEvent.currentTarget) {
192
148
  if (parent.tagName === 'LABEL' && (parent.querySelector('input[type="checkbox"]') || parent.querySelector('input[type="radio"]'))) {
193
149
  return;
194
150
  }
195
-
196
151
  if (parent.tagName === 'A' && parent.href) {
197
152
  originalEvent.preventDefault();
198
153
  }
199
-
200
154
  parent = parent.parentNode;
201
155
  }
202
-
203
156
  originalEvent.stopPropagation();
204
157
  this.refine(facetValueToRefine);
205
158
  }
@@ -214,7 +167,6 @@ var RefinementList = /*#__PURE__*/function (_Component) {
214
167
  key: "refineFirstValue",
215
168
  value: function refineFirstValue() {
216
169
  var firstValue = this.props.facetValues && this.props.facetValues[0];
217
-
218
170
  if (firstValue) {
219
171
  var actualValue = firstValue.value;
220
172
  this.props.toggleRefinement(actualValue);
@@ -224,7 +176,6 @@ var RefinementList = /*#__PURE__*/function (_Component) {
224
176
  key: "render",
225
177
  value: function render() {
226
178
  var _this2 = this;
227
-
228
179
  var showMoreButtonClassName = (0, _uiComponentsShared.cx)(this.props.cssClasses.showMore, !(this.props.showMore === true && this.props.canToggleShowMore) && this.props.cssClasses.disabledShowMore);
229
180
  var showMoreButton = this.props.showMore === true && (0, _preact.h)(_Template.default, _extends({}, this.props.templateProps, {
230
181
  templateKey: "showMoreText",
@@ -255,7 +206,8 @@ var RefinementList = /*#__PURE__*/function (_Component) {
255
206
  },
256
207
  onSubmit: function onSubmit() {
257
208
  return _this2.refineFirstValue();
258
- } // This sets the search box to a controlled state because
209
+ }
210
+ // This sets the search box to a controlled state because
259
211
  // we don't rely on the `refine` prop but on `onChange`.
260
212
  ,
261
213
  searchAsYouType: false
@@ -275,11 +227,8 @@ var RefinementList = /*#__PURE__*/function (_Component) {
275
227
  }, this.props.children, searchBox, facetValues, noResults, showMoreButton);
276
228
  }
277
229
  }]);
278
-
279
230
  return RefinementList;
280
231
  }(_preact.Component);
281
-
282
232
  _defineProperty(RefinementList, "defaultProps", defaultProps);
283
-
284
233
  var _default = RefinementList;
285
234
  exports.default = _default;