instantsearch.js 4.64.3 → 4.66.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 (132) hide show
  1. package/cjs/components/Answers/Answers.js +2 -2
  2. package/cjs/components/Breadcrumb/Breadcrumb.js +4 -4
  3. package/cjs/components/ClearRefinements/ClearRefinements.js +2 -2
  4. package/cjs/components/CurrentRefinements/CurrentRefinements.js +2 -2
  5. package/cjs/components/GeoSearchControls/GeoSearchControls.js +3 -3
  6. package/cjs/components/Highlight/Highlight.js +5 -5
  7. package/cjs/components/InfiniteHits/InfiniteHits.js +4 -4
  8. package/cjs/components/InternalHighlight/InternalHighlight.js +2 -2
  9. package/cjs/components/MenuSelect/MenuSelect.js +2 -2
  10. package/cjs/components/Pagination/Pagination.js +3 -3
  11. package/cjs/components/Panel/Panel.js +2 -2
  12. package/cjs/components/RangeInput/RangeInput.js +4 -4
  13. package/cjs/components/RefinementList/RefinementList.js +4 -4
  14. package/cjs/components/ReverseHighlight/ReverseHighlight.js +5 -5
  15. package/cjs/components/ReverseSnippet/ReverseSnippet.js +5 -5
  16. package/cjs/components/Selector/Selector.js +3 -3
  17. package/cjs/components/Slider/Pit.js +2 -2
  18. package/cjs/components/Slider/Slider.js +3 -3
  19. package/cjs/components/Snippet/Snippet.js +5 -5
  20. package/cjs/components/Stats/Stats.js +2 -2
  21. package/cjs/components/Template/Template.js +64 -7
  22. package/cjs/connectors/answers/connectAnswers.js +3 -0
  23. package/cjs/lib/version.js +1 -1
  24. package/cjs/widgets/answers/answers.js +11 -8
  25. package/cjs/widgets/breadcrumb/breadcrumb.js +8 -8
  26. package/cjs/widgets/clear-refinements/clear-refinements.js +4 -4
  27. package/cjs/widgets/current-refinements/current-refinements.js +9 -9
  28. package/cjs/widgets/geo-search/geo-search.js +11 -11
  29. package/cjs/widgets/hierarchical-menu/defaultTemplates.js +4 -4
  30. package/cjs/widgets/hierarchical-menu/hierarchical-menu.js +14 -14
  31. package/cjs/widgets/hits/hits.js +67 -31
  32. package/cjs/widgets/hits-per-page/hits-per-page.js +4 -4
  33. package/cjs/widgets/infinite-hits/infinite-hits.js +9 -9
  34. package/cjs/widgets/menu/defaultTemplates.js +4 -4
  35. package/cjs/widgets/menu/menu.js +11 -11
  36. package/cjs/widgets/menu-select/menu-select.js +5 -5
  37. package/cjs/widgets/numeric-menu/numeric-menu.js +9 -9
  38. package/cjs/widgets/pagination/pagination.js +13 -13
  39. package/cjs/widgets/panel/panel.js +10 -10
  40. package/cjs/widgets/places/places.js +3 -1
  41. package/cjs/widgets/powered-by/powered-by.js +4 -4
  42. package/cjs/widgets/query-rule-custom-data/query-rule-custom-data.js +2 -2
  43. package/cjs/widgets/range-input/range-input.js +10 -10
  44. package/cjs/widgets/range-slider/range-slider.js +3 -3
  45. package/cjs/widgets/rating-menu/defaultTemplates.js +6 -6
  46. package/cjs/widgets/rating-menu/rating-menu.js +13 -13
  47. package/cjs/widgets/refinement-list/defaultTemplates.js +5 -5
  48. package/cjs/widgets/refinement-list/refinement-list.js +23 -23
  49. package/cjs/widgets/relevant-sort/relevant-sort.js +4 -4
  50. package/cjs/widgets/search-box/search-box.js +10 -10
  51. package/cjs/widgets/sort-by/sort-by.js +4 -4
  52. package/cjs/widgets/stats/stats.js +3 -3
  53. package/cjs/widgets/toggle-refinement/toggle-refinement.js +5 -5
  54. package/cjs/widgets/voice-search/voice-search.js +4 -4
  55. package/dist/instantsearch.development.d.ts +11 -27
  56. package/dist/instantsearch.development.js +463 -390
  57. package/dist/instantsearch.development.js.map +1 -1
  58. package/dist/instantsearch.production.d.ts +11 -27
  59. package/dist/instantsearch.production.min.d.ts +11 -27
  60. package/dist/instantsearch.production.min.js +2 -2
  61. package/dist/instantsearch.production.min.js.map +1 -1
  62. package/es/components/Answers/Answers.js +1 -1
  63. package/es/components/Breadcrumb/Breadcrumb.js +1 -1
  64. package/es/components/ClearRefinements/ClearRefinements.js +1 -1
  65. package/es/components/CurrentRefinements/CurrentRefinements.js +1 -1
  66. package/es/components/GeoSearchControls/GeoSearchControls.js +1 -1
  67. package/es/components/Highlight/Highlight.d.ts +1 -1
  68. package/es/components/Highlight/Highlight.js +1 -1
  69. package/es/components/InfiniteHits/InfiniteHits.js +1 -1
  70. package/es/components/InternalHighlight/InternalHighlight.d.ts +1 -1
  71. package/es/components/InternalHighlight/InternalHighlight.js +1 -1
  72. package/es/components/MenuSelect/MenuSelect.js +1 -1
  73. package/es/components/Pagination/Pagination.js +1 -1
  74. package/es/components/Panel/Panel.js +1 -1
  75. package/es/components/RangeInput/RangeInput.js +1 -1
  76. package/es/components/RefinementList/RefinementList.js +1 -1
  77. package/es/components/ReverseHighlight/ReverseHighlight.d.ts +1 -1
  78. package/es/components/ReverseHighlight/ReverseHighlight.js +1 -1
  79. package/es/components/ReverseSnippet/ReverseSnippet.d.ts +1 -1
  80. package/es/components/ReverseSnippet/ReverseSnippet.js +1 -1
  81. package/es/components/Selector/Selector.js +1 -1
  82. package/es/components/Slider/Pit.js +1 -1
  83. package/es/components/Slider/Slider.js +1 -1
  84. package/es/components/Snippet/Snippet.d.ts +1 -1
  85. package/es/components/Snippet/Snippet.js +1 -1
  86. package/es/components/Stats/Stats.js +1 -1
  87. package/es/components/Template/Template.d.ts +1 -1
  88. package/es/components/Template/Template.js +65 -8
  89. package/es/connectors/answers/connectAnswers.d.ts +3 -0
  90. package/es/connectors/answers/connectAnswers.js +3 -0
  91. package/es/connectors/autocomplete/connectAutocomplete.d.ts +4 -0
  92. package/es/lib/version.d.ts +1 -1
  93. package/es/lib/version.js +1 -1
  94. package/es/widgets/answers/answers.d.ts +2 -2
  95. package/es/widgets/answers/answers.js +6 -3
  96. package/es/widgets/breadcrumb/breadcrumb.js +1 -1
  97. package/es/widgets/clear-refinements/clear-refinements.js +1 -1
  98. package/es/widgets/current-refinements/current-refinements.js +1 -1
  99. package/es/widgets/geo-search/geo-search.js +1 -1
  100. package/es/widgets/hierarchical-menu/defaultTemplates.js +1 -1
  101. package/es/widgets/hierarchical-menu/hierarchical-menu.js +1 -1
  102. package/es/widgets/hits/defaultTemplates.d.ts +2 -2
  103. package/es/widgets/hits/hits.d.ts +2 -18
  104. package/es/widgets/hits/hits.js +67 -31
  105. package/es/widgets/hits-per-page/hits-per-page.js +1 -1
  106. package/es/widgets/infinite-hits/infinite-hits.js +1 -1
  107. package/es/widgets/menu/defaultTemplates.js +1 -1
  108. package/es/widgets/menu/menu.js +1 -1
  109. package/es/widgets/menu-select/menu-select.js +1 -1
  110. package/es/widgets/numeric-menu/numeric-menu.js +1 -1
  111. package/es/widgets/pagination/pagination.js +1 -1
  112. package/es/widgets/panel/panel.js +1 -1
  113. package/es/widgets/places/places.d.ts +2 -6
  114. package/es/widgets/places/places.js +4 -1
  115. package/es/widgets/powered-by/powered-by.js +1 -1
  116. package/es/widgets/query-rule-custom-data/query-rule-custom-data.js +1 -1
  117. package/es/widgets/range-input/range-input.js +1 -1
  118. package/es/widgets/range-slider/range-slider.js +1 -1
  119. package/es/widgets/rating-menu/defaultTemplates.js +1 -1
  120. package/es/widgets/rating-menu/rating-menu.js +1 -1
  121. package/es/widgets/refinement-list/defaultTemplates.js +1 -1
  122. package/es/widgets/refinement-list/refinement-list.js +1 -1
  123. package/es/widgets/relevant-sort/relevant-sort.js +1 -1
  124. package/es/widgets/search-box/search-box.js +1 -1
  125. package/es/widgets/sort-by/sort-by.js +1 -1
  126. package/es/widgets/stats/stats.js +1 -1
  127. package/es/widgets/toggle-refinement/toggle-refinement.js +1 -1
  128. package/es/widgets/voice-search/voice-search.js +1 -1
  129. package/package.json +12 -11
  130. package/cjs/components/Hits/Hits.js +0 -72
  131. package/es/components/Hits/Hits.d.ts +0 -19
  132. package/es/components/Hits/Hits.js +0 -65
@@ -1,22 +1,30 @@
1
1
  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); }
2
+ var _excluded = ["hit", "index"];
2
3
  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; }
3
4
  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; }
4
5
  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; }
5
6
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
7
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
8
- import { h, render } from 'preact';
9
- import Hits from "../../components/Hits/Hits.js";
8
+ 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; }
9
+ 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; }
10
+ function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
11
+ 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); }
12
+ import { createHitsComponent } from 'instantsearch-ui-components';
13
+ import { Fragment, h, render } from 'preact';
14
+ import TemplateComponent from "../../components/Template/Template.js";
10
15
  import connectHits from "../../connectors/hits/connectHits.js";
11
16
  import { withInsights } from "../../lib/insights/index.js";
12
- import { component } from "../../lib/suit.js";
17
+ import { createInsightsEventHandler } from "../../lib/insights/listener.js";
13
18
  import { prepareTemplateProps } from "../../lib/templating/index.js";
14
- import { getContainerNode, createDocumentationMessageGenerator } from "../../lib/utils/index.js";
19
+ import { getContainerNode, createDocumentationMessageGenerator, warning } from "../../lib/utils/index.js";
15
20
  import defaultTemplates from "./defaultTemplates.js";
16
21
  var withUsage = createDocumentationMessageGenerator({
17
22
  name: 'hits'
18
23
  });
19
- var suit = component('Hits');
24
+ var Hits = createHitsComponent({
25
+ createElement: h,
26
+ Fragment: Fragment
27
+ });
20
28
  var renderer = function renderer(_ref) {
21
29
  var renderState = _ref.renderState,
22
30
  cssClasses = _ref.cssClasses,
@@ -37,42 +45,70 @@ var renderer = function renderer(_ref) {
37
45
  });
38
46
  return;
39
47
  }
48
+ var handleInsightsClick = createInsightsEventHandler({
49
+ insights: insights,
50
+ sendEvent: sendEvent
51
+ });
52
+ var emptyComponent = function emptyComponent(_ref3) {
53
+ var rootProps = _extends({}, (_objectDestructuringEmpty(_ref3), _ref3));
54
+ return h(TemplateComponent, _extends({}, renderState.templateProps, {
55
+ rootProps: rootProps,
56
+ templateKey: "empty",
57
+ data: results
58
+ }));
59
+ };
60
+
61
+ // @MAJOR: Move default hit component back to the UI library
62
+ // once flavour specificities are erased
63
+ var itemComponent = function itemComponent(_ref4) {
64
+ var hit = _ref4.hit,
65
+ index = _ref4.index,
66
+ rootProps = _objectWithoutProperties(_ref4, _excluded);
67
+ return h(TemplateComponent, _extends({}, renderState.templateProps, {
68
+ templateKey: "item",
69
+ rootTagName: "li",
70
+ rootProps: _objectSpread(_objectSpread({}, rootProps), {}, {
71
+ onClick: function onClick(event) {
72
+ handleInsightsClick(event);
73
+ rootProps.onClick();
74
+ },
75
+ onAuxClick: function onAuxClick(event) {
76
+ handleInsightsClick(event);
77
+ rootProps.onAuxClick();
78
+ }
79
+ }),
80
+ data: _objectSpread(_objectSpread({}, hit), {}, {
81
+ get __hitIndex() {
82
+ process.env.NODE_ENV === 'development' ? warning(false, 'The `__hitIndex` property is deprecated. Use the absolute `__position` instead.') : void 0;
83
+ return index;
84
+ }
85
+ }),
86
+ bindEvent: bindEvent,
87
+ sendEvent: sendEvent
88
+ }));
89
+ };
40
90
  render(h(Hits, {
41
- cssClasses: cssClasses,
42
91
  hits: receivedHits,
43
- results: results,
44
- templateProps: renderState.templateProps,
45
- insights: insights,
92
+ itemComponent: itemComponent,
46
93
  sendEvent: sendEvent,
47
- bindEvent: bindEvent
94
+ classNames: cssClasses,
95
+ emptyComponent: emptyComponent
48
96
  }), containerNode);
49
97
  };
50
98
  };
51
99
  var hits = function hits(widgetParams) {
52
- var _ref3 = widgetParams || {},
53
- container = _ref3.container,
54
- escapeHTML = _ref3.escapeHTML,
55
- transformItems = _ref3.transformItems,
56
- _ref3$templates = _ref3.templates,
57
- templates = _ref3$templates === void 0 ? {} : _ref3$templates,
58
- _ref3$cssClasses = _ref3.cssClasses,
59
- userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses;
100
+ var _ref5 = widgetParams || {},
101
+ container = _ref5.container,
102
+ escapeHTML = _ref5.escapeHTML,
103
+ transformItems = _ref5.transformItems,
104
+ _ref5$templates = _ref5.templates,
105
+ templates = _ref5$templates === void 0 ? {} : _ref5$templates,
106
+ _ref5$cssClasses = _ref5.cssClasses,
107
+ cssClasses = _ref5$cssClasses === void 0 ? {} : _ref5$cssClasses;
60
108
  if (!container) {
61
109
  throw new Error(withUsage('The `container` option is required.'));
62
110
  }
63
111
  var containerNode = getContainerNode(container);
64
- var cssClasses = {
65
- root: cx(suit(), userCssClasses.root),
66
- emptyRoot: cx(suit({
67
- modifierName: 'empty'
68
- }), userCssClasses.emptyRoot),
69
- list: cx(suit({
70
- descendantName: 'list'
71
- }), userCssClasses.list),
72
- item: cx(suit({
73
- descendantName: 'item'
74
- }), userCssClasses.item)
75
- };
76
112
  var specializedRenderer = renderer({
77
113
  containerNode: containerNode,
78
114
  cssClasses: cssClasses,
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import Selector from "../../components/Selector/Selector.js";
10
10
  import connectHitsPerPage from "../../connectors/hits-per-page/connectHitsPerPage.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import InfiniteHits from "../../components/InfiniteHits/InfiniteHits.js";
10
10
  import connectInfiniteHits from "../../connectors/infinite-hits/connectInfiniteHits.js";
@@ -1,4 +1,4 @@
1
- import { cx } from '@algolia/ui-components-shared';
1
+ import { cx } from 'instantsearch-ui-components';
2
2
  import { h } from 'preact';
3
3
  import { formatNumber } from "../../lib/formatNumber.js";
4
4
  var defaultTemplates = {
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import RefinementList from "../../components/RefinementList/RefinementList.js";
10
10
  import connectMenu from "../../connectors/menu/connectMenu.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import MenuSelect from "../../components/MenuSelect/MenuSelect.js";
10
10
  import connectMenu from "../../connectors/menu/connectMenu.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import RefinementList from "../../components/RefinementList/RefinementList.js";
10
10
  import connectNumericMenu from "../../connectors/numeric-menu/connectNumericMenu.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import Pagination from "../../components/Pagination/Pagination.js";
10
10
  import connectPagination from "../../connectors/pagination/connectPagination.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import Panel from "../../components/Panel/Panel.js";
10
10
  import { component } from "../../lib/suit.js";
@@ -31,9 +31,5 @@ export type PlacesWidgetDescription = {
31
31
  };
32
32
  };
33
33
  export type PlacesWidget = WidgetFactory<PlacesWidgetDescription, PlacesWidgetParams, PlacesWidgetParams>;
34
- /**
35
- * This widget sets the geolocation value for the search based on the selected
36
- * result in the Algolia Places autocomplete.
37
- */
38
- declare const placesWidget: PlacesWidget;
39
- export default placesWidget;
34
+ declare const _default: PlacesWidget;
35
+ export default _default;
@@ -8,12 +8,15 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
8
8
  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); }
9
9
  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; }
10
10
  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; }
11
+ import { deprecate } from "../../lib/utils/index.js";
12
+
11
13
  /* Places.js is an optional dependency, no error should be reported if the package is missing */
12
14
  /** @ts-ignore */
13
15
  // using the type like this requires only one ts-ignore
14
16
  /**
15
17
  * This widget sets the geolocation value for the search based on the selected
16
18
  * result in the Algolia Places autocomplete.
19
+ * @deprecated the places service is no longer offered, and this widget will be removed in InstantSearch.js v5
17
20
  */
18
21
  var placesWidget = function placesWidget(widgetParams) {
19
22
  var _ref = widgetParams || {},
@@ -99,4 +102,4 @@ var placesWidget = function placesWidget(widgetParams) {
99
102
  }
100
103
  };
101
104
  };
102
- export default placesWidget;
105
+ export default deprecate(placesWidget, 'The places widget is deprecated and will be removed in InstantSearch.js 5.0.');
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import PoweredBy from "../../components/PoweredBy/PoweredBy.js";
10
10
  import connectPoweredBy from "../../connectors/powered-by/connectPoweredBy.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import CustomData from "../../components/QueryRuleCustomData/QueryRuleCustomData.js";
10
10
  import connectQueryRules from "../../connectors/query-rules/connectQueryRules.js";
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
10
  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; }
11
11
  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; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import { cx } from '@algolia/ui-components-shared';
13
+ import { cx } from 'instantsearch-ui-components';
14
14
  import { h, render } from 'preact';
15
15
  import RangeInput from "../../components/RangeInput/RangeInput.js";
16
16
  import connectRange from "../../connectors/range/connectRange.js";
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
10
  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; }
11
11
  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; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import { cx } from '@algolia/ui-components-shared';
13
+ import { cx } from 'instantsearch-ui-components';
14
14
  import { h, render } from 'preact';
15
15
  import Slider from "../../components/Slider/Slider.js";
16
16
  import connectRange from "../../connectors/range/connectRange.js";
@@ -1,4 +1,4 @@
1
- import { cx } from '@algolia/ui-components-shared';
1
+ import { cx } from 'instantsearch-ui-components';
2
2
  import { h } from 'preact';
3
3
  import { formatNumber } from "../../lib/formatNumber.js";
4
4
  function ItemWrapper(_ref) {
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import RefinementList from "../../components/RefinementList/RefinementList.js";
10
10
  import connectRatingMenu from "../../connectors/rating-menu/connectRatingMenu.js";
@@ -1,4 +1,4 @@
1
- import { cx } from '@algolia/ui-components-shared';
1
+ import { cx } from 'instantsearch-ui-components';
2
2
  import { h } from 'preact';
3
3
  import { formatNumber } from "../../lib/formatNumber.js";
4
4
  var defaultTemplates = {
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import RefinementList from "../../components/RefinementList/RefinementList.js";
10
10
  import connectRefinementList from "../../connectors/refinement-list/connectRefinementList.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import RelevantSort from "../../components/RelevantSort/RelevantSort.js";
10
10
  import connectRelevantSort from "../../connectors/relevant-sort/connectRelevantSort.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import SearchBox from "../../components/SearchBox/SearchBox.js";
10
10
  import connectSearchBox from "../../connectors/search-box/connectSearchBox.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import Selector from "../../components/Selector/Selector.js";
10
10
  import connectSortBy from "../../connectors/sort-by/connectSortBy.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import Stats from "../../components/Stats/Stats.js";
10
10
  import connectStats from "../../connectors/stats/connectStats.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import ToggleRefinement from "../../components/ToggleRefinement/ToggleRefinement.js";
10
10
  import connectToggleRefinement from "../../connectors/toggle-refinement/connectToggleRefinement.js";
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
  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; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
- import { cx } from '@algolia/ui-components-shared';
7
+ import { cx } from 'instantsearch-ui-components';
8
8
  import { h, render } from 'preact';
9
9
  import VoiceSearchComponent from "../../components/VoiceSearch/VoiceSearch.js";
10
10
  import connectVoiceSearch from "../../connectors/voice-search/connectVoiceSearch.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instantsearch.js",
3
- "version": "4.64.3",
3
+ "version": "4.66.0",
4
4
  "description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
5
5
  "homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
6
6
  "types": "es/index.d.ts",
@@ -27,15 +27,14 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@algolia/events": "^4.0.1",
30
- "@algolia/ui-components-highlight-vdom": "^1.2.2",
31
- "@algolia/ui-components-shared": "^1.2.2",
32
30
  "@types/dom-speech-recognition": "^0.0.1",
33
31
  "@types/google.maps": "^3.45.3",
34
32
  "@types/hogan.js": "^3.0.0",
35
33
  "@types/qs": "^6.5.3",
36
- "algoliasearch-helper": "3.16.2",
34
+ "algoliasearch-helper": "3.16.3",
37
35
  "hogan.js": "^3.0.2",
38
36
  "htm": "^3.0.0",
37
+ "instantsearch-ui-components": "0.4.0",
39
38
  "preact": "^10.10.0",
40
39
  "qs": "^6.5.1 < 6.10",
41
40
  "search-insights": "^2.13.0"
@@ -47,23 +46,25 @@
47
46
  "build": "yarn run build:cjs && yarn run build:es && yarn run build:umd && yarn run build:types",
48
47
  "build:umd": "rm -rf dist && BABEL_ENV=umd rollup --config ./scripts/rollup/rollup.config.js",
49
48
  "build:cjs": "rm -rf cjs && BABEL_ENV=cjs babel --root-mode upward src --extensions '.js,.ts,.tsx' --out-dir cjs/ --ignore 'src/index.es.ts','**/__tests__','**/__mocks__' --quiet",
50
- "build:es": "rm -rf es && BABEL_ENV=es babel --root-mode upward src --extensions '.js,.ts,.tsx' --out-dir es/ --ignore 'src/index.es.ts','**/__tests__','**/__mocks__' --quiet && BABEL_ENV=es babel --root-mode upward src/index.es.ts --out-file es/index.js --quiet && echo '{\"type\":\"module\",\"sideEffects\":false}' > es/package.json",
49
+ "build:es:base": "BABEL_ENV=es babel --root-mode upward src --extensions '.js,.ts,.tsx' --out-dir es/ --ignore 'src/index.es.ts','**/__tests__','**/__mocks__'",
50
+ "build:es": "rm -rf es && yarn build:es:base --quiet && BABEL_ENV=es babel --root-mode upward src/index.es.ts --out-file es/index.js --quiet && echo '{\"type\":\"module\",\"sideEffects\":false}' > es/package.json",
51
51
  "build:types": "scripts/typescript/extract.js",
52
52
  "storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook --quiet --port 6006 --ci --static-dir .storybook/static",
53
53
  "storybook:build": "NODE_OPTIONS=--openssl-legacy-provider build-storybook --quiet --output-dir ../../website/stories/js --static-dir .storybook/static",
54
54
  "test:exports": "node test/module/is-es-module.mjs && node test/module/is-cjs-module.cjs",
55
- "version": "./scripts/version/update-version.js"
55
+ "version": "./scripts/version/update-version.js",
56
+ "watch:es": "yarn --silent build:es:base --watch"
56
57
  },
57
58
  "devDependencies": {
58
- "@instantsearch/mocks": "1.37.0",
59
- "@instantsearch/tests": "1.37.0",
60
- "@instantsearch/testutils": "1.26.0",
59
+ "@instantsearch/mocks": "1.39.0",
60
+ "@instantsearch/tests": "1.39.0",
61
+ "@instantsearch/testutils": "1.28.0",
61
62
  "@storybook/html": "5.3.9",
62
63
  "@types/scriptjs": "0.0.2",
63
- "algoliasearch": "4.14.3",
64
+ "algoliasearch": "4.22.1",
64
65
  "places.js": "1.17.1",
65
66
  "scriptjs": "2.5.9",
66
67
  "webpack": "4.47.0"
67
68
  },
68
- "gitHead": "9afbaecd8ae25e3b3746be05f858a83b03843102"
69
+ "gitHead": "358f849cba15cbbb415da05feb582b47358aa239"
69
70
  }
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- 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); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = Hits;
8
- var _uiComponentsShared = require("@algolia/ui-components-shared");
9
- var _preact = require("preact");
10
- var _listener = require("../../lib/insights/listener");
11
- var _utils = require("../../lib/utils");
12
- var _Template = _interopRequireDefault(require("../Template/Template"));
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
- 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; }
15
- 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; }
16
- 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; }
17
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
18
- 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); }
19
- 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
- function Hits(_ref) {
21
- var results = _ref.results,
22
- hits = _ref.hits,
23
- insights = _ref.insights,
24
- bindEvent = _ref.bindEvent,
25
- sendEvent = _ref.sendEvent,
26
- cssClasses = _ref.cssClasses,
27
- templateProps = _ref.templateProps;
28
- var handleInsightsClick = (0, _listener.createInsightsEventHandler)({
29
- insights: insights,
30
- sendEvent: sendEvent
31
- });
32
- if (results.hits.length === 0) {
33
- return (0, _preact.h)(_Template.default, _extends({}, templateProps, {
34
- templateKey: "empty",
35
- rootProps: {
36
- className: (0, _uiComponentsShared.cx)(cssClasses.root, cssClasses.emptyRoot),
37
- onClick: handleInsightsClick
38
- },
39
- data: results
40
- }));
41
- }
42
- return (0, _preact.h)("div", {
43
- className: cssClasses.root
44
- }, (0, _preact.h)("ol", {
45
- className: cssClasses.list
46
- }, hits.map(function (hit, index) {
47
- return (0, _preact.h)(_Template.default, _extends({}, templateProps, {
48
- templateKey: "item",
49
- rootTagName: "li",
50
- rootProps: {
51
- className: cssClasses.item,
52
- onClick: function onClick(event) {
53
- handleInsightsClick(event);
54
- sendEvent('click:internal', hit, 'Hit Clicked');
55
- },
56
- onAuxClick: function onAuxClick(event) {
57
- handleInsightsClick(event);
58
- sendEvent('click:internal', hit, 'Hit Clicked');
59
- }
60
- },
61
- key: hit.objectID,
62
- data: _objectSpread(_objectSpread({}, hit), {}, {
63
- get __hitIndex() {
64
- process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, 'The `__hitIndex` property is deprecated. Use the absolute `__position` instead.') : void 0;
65
- return index;
66
- }
67
- }),
68
- bindEvent: bindEvent,
69
- sendEvent: sendEvent
70
- }));
71
- })));
72
- }
@@ -1,19 +0,0 @@
1
-
2
- import { h } from 'preact';
3
- import type { PreparedTemplateProps } from '../../lib/templating';
4
- import type { BindEventForHits, SendEventForHits } from '../../lib/utils';
5
- import type { ComponentCSSClasses, Hit, InsightsClient } from '../../types';
6
- import type { HitsCSSClasses, HitsTemplates } from '../../widgets/hits/hits';
7
- import type { SearchResults } from 'algoliasearch-helper';
8
- export type HitsComponentCSSClasses = ComponentCSSClasses<HitsCSSClasses>;
9
- export type HitsComponentTemplates = Required<HitsTemplates>;
10
- export type HitsProps = {
11
- results: SearchResults;
12
- hits: Hit[];
13
- insights?: InsightsClient;
14
- sendEvent: SendEventForHits;
15
- bindEvent: BindEventForHits;
16
- cssClasses: HitsComponentCSSClasses;
17
- templateProps: PreparedTemplateProps<HitsComponentTemplates>;
18
- };
19
- export default function Hits({ results, hits, insights, bindEvent, sendEvent, cssClasses, templateProps, }: HitsProps): h.JSX.Element;