react-instantsearch 7.19.0 → 7.20.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.
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ReverseHighlight = ReverseHighlight;
7
+ var _instantsearchUiComponents = require("instantsearch-ui-components");
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _InternalHighlight = require("./InternalHighlight");
10
+ var _excluded = ["classNames"];
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
13
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
14
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
15
+ function ReverseHighlight(_ref) {
16
+ var _ref$classNames = _ref.classNames,
17
+ classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
18
+ props = _objectWithoutProperties(_ref, _excluded);
19
+ return /*#__PURE__*/_react.default.createElement(_InternalHighlight.InternalHighlight, _extends({
20
+ classNames: {
21
+ root: (0, _instantsearchUiComponents.cx)('ais-ReverseHighlight', classNames.root),
22
+ highlighted: (0, _instantsearchUiComponents.cx)('ais-ReverseHighlight-highlighted', classNames.highlighted),
23
+ nonHighlighted: (0, _instantsearchUiComponents.cx)('ais-ReverseHighlight-nonHighlighted', classNames.nonHighlighted),
24
+ separator: (0, _instantsearchUiComponents.cx)('ais-ReverseHighlight-separator', classNames.separator)
25
+ }
26
+ }, props));
27
+ }
@@ -8,15 +8,11 @@ var _instantsearchUiComponents = require("instantsearch-ui-components");
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _reactInstantsearchCore = require("react-instantsearch-core");
10
10
  var _AutocompleteSearch = require("../components/AutocompleteSearch");
11
- var _excluded = ["indices", "showSuggestions", "showRecent"],
12
- _excluded2 = ["indicesConfig", "refineSearchBox", "getSearchPageURL", "onSelect", "indexUiState", "isSearchPage", "showRecent"];
11
+ var _ReverseHighlight = require("./ReverseHighlight");
12
+ var _excluded = ["indices", "showSuggestions", "showRecent", "searchParameters"],
13
+ _excluded2 = ["indicesConfig", "refineSearchBox", "getSearchPageURL", "onSelect", "indexUiState", "isSearchPage", "panelComponent", "showRecent", "showSuggestions"];
13
14
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
14
15
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
15
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
16
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
21
17
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
22
18
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -24,6 +20,11 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
24
20
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
25
21
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
26
22
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
23
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
24
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
25
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
26
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
27
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
27
28
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
28
29
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
29
30
  var Autocomplete = (0, _instantsearchUiComponents.createAutocompleteComponent)({
@@ -58,14 +59,12 @@ var useStorage = (0, _instantsearchUiComponents.createAutocompleteStorage)({
58
59
  useMemo: _react.useMemo,
59
60
  useState: _react.useState
60
61
  });
61
- var _ref2 = /*#__PURE__*/_react.default.createElement(_reactInstantsearchCore.Configure, {
62
- hitsPerPage: 5
63
- });
64
62
  function EXPERIMENTAL_Autocomplete(_ref) {
65
63
  var _ref$indices = _ref.indices,
66
64
  indices = _ref$indices === void 0 ? [] : _ref$indices,
67
65
  showSuggestions = _ref.showSuggestions,
68
66
  showRecent = _ref.showRecent,
67
+ userSearchParameters = _ref.searchParameters,
69
68
  props = _objectWithoutProperties(_ref, _excluded);
70
69
  var _useInstantSearch = (0, _reactInstantsearchCore.useInstantSearch)(),
71
70
  indexUiState = _useInstantSearch.indexUiState,
@@ -75,13 +74,25 @@ function EXPERIMENTAL_Autocomplete(_ref) {
75
74
  $$widgetType: 'ais.autocomplete'
76
75
  }),
77
76
  refine = _useSearchBox.refine;
77
+ var searchParameters = _objectSpread({
78
+ hitsPerPage: 5
79
+ }, userSearchParameters);
78
80
  var indicesConfig = _toConsumableArray(indices);
79
81
  if (showSuggestions !== null && showSuggestions !== void 0 && showSuggestions.indexName) {
80
82
  var _showSuggestions$clas, _showSuggestions$clas2, _showSuggestions$clas3, _showSuggestions$clas4;
81
83
  indicesConfig.unshift({
82
84
  indexName: showSuggestions.indexName,
83
85
  headerComponent: showSuggestions.headerComponent,
84
- itemComponent: showSuggestions.itemComponent || AutocompleteSuggestion,
86
+ itemComponent: showSuggestions.itemComponent || function (_ref2) {
87
+ var item = _ref2.item,
88
+ onSelect = _ref2.onSelect;
89
+ return /*#__PURE__*/_react.default.createElement(AutocompleteSuggestion, {
90
+ item: item,
91
+ onSelect: onSelect
92
+ }, /*#__PURE__*/_react.default.createElement(ConditionalReverseHighlight, {
93
+ item: item
94
+ }));
95
+ },
85
96
  classNames: {
86
97
  root: (0, _instantsearchUiComponents.cx)('ais-AutocompleteSuggestions', showSuggestions === null || showSuggestions === void 0 ? void 0 : (_showSuggestions$clas = showSuggestions.classNames) === null || _showSuggestions$clas === void 0 ? void 0 : _showSuggestions$clas.root),
87
98
  list: (0, _instantsearchUiComponents.cx)('ais-AutocompleteSuggestionsList', showSuggestions === null || showSuggestions === void 0 ? void 0 : (_showSuggestions$clas2 = showSuggestions.classNames) === null || _showSuggestions$clas2 === void 0 ? void 0 : _showSuggestions$clas2.list),
@@ -99,17 +110,18 @@ function EXPERIMENTAL_Autocomplete(_ref) {
99
110
  }, [indexRenderState]);
100
111
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactInstantsearchCore.Index, {
101
112
  EXPERIMENTAL_isolated: true
102
- }, _ref2, indicesConfig.map(function (index) {
113
+ }, /*#__PURE__*/_react.default.createElement(_reactInstantsearchCore.Configure, searchParameters), indicesConfig.map(function (index) {
103
114
  return /*#__PURE__*/_react.default.createElement(_reactInstantsearchCore.Index, {
104
115
  key: index.indexName,
105
116
  indexName: index.indexName
106
- });
117
+ }, /*#__PURE__*/_react.default.createElement(_reactInstantsearchCore.Configure, index.searchParameters));
107
118
  }), /*#__PURE__*/_react.default.createElement(InnerAutocomplete, _extends({}, props, {
108
119
  indicesConfig: indicesConfig,
109
120
  refineSearchBox: refine,
110
121
  indexUiState: indexUiState,
111
122
  isSearchPage: isSearchPage,
112
- showRecent: showRecent
123
+ showRecent: showRecent,
124
+ showSuggestions: showSuggestions
113
125
  }))));
114
126
  }
115
127
  function InnerAutocomplete(_ref3) {
@@ -119,7 +131,9 @@ function InnerAutocomplete(_ref3) {
119
131
  userOnSelect = _ref3.onSelect,
120
132
  indexUiState = _ref3.indexUiState,
121
133
  isSearchPage = _ref3.isSearchPage,
134
+ PanelComponent = _ref3.panelComponent,
122
135
  showRecent = _ref3.showRecent,
136
+ showSuggestions = _ref3.showSuggestions,
123
137
  props = _objectWithoutProperties(_ref3, _excluded2);
124
138
  var _useAutocomplete = (0, _reactInstantsearchCore.useAutocomplete)(),
125
139
  indices = _useAutocomplete.indices,
@@ -165,51 +179,78 @@ function InnerAutocomplete(_ref3) {
165
179
  getPanelProps = _usePropGetters.getPanelProps,
166
180
  getRootProps = _usePropGetters.getRootProps;
167
181
  var AutocompleteRecentSearchComponent = _typeof(showRecent) === 'object' && showRecent.itemComponent || AutocompleteRecentSearch;
168
- return /*#__PURE__*/_react.default.createElement(Autocomplete, _extends({}, props, getRootProps()), /*#__PURE__*/_react.default.createElement(_AutocompleteSearch.AutocompleteSearch, {
169
- inputProps: getInputProps(),
170
- clearQuery: function clearQuery() {
171
- refineSearchBox('');
172
- refineAutocomplete('');
173
- }
174
- }), /*#__PURE__*/_react.default.createElement(AutocompletePanel, getPanelProps(), showRecent && /*#__PURE__*/_react.default.createElement(AutocompleteIndex
175
- // @ts-ignore - there seems to be problems with React.ComponentType and this, but it's actually correct
176
- , {
177
- ItemComponent: function ItemComponent(_ref5) {
178
- var item = _ref5.item,
179
- onSelect = _ref5.onSelect;
180
- return /*#__PURE__*/_react.default.createElement(AutocompleteRecentSearchComponent, {
181
- item: item,
182
- onSelect: onSelect,
183
- onRemoveRecentSearch: function onRemoveRecentSearch() {
184
- return storage.onRemove(item.query);
185
- }
186
- });
187
- },
188
- classNames: {
189
- root: 'ais-AutocompleteRecentSearches',
190
- list: 'ais-AutocompleteRecentSearchesList',
191
- item: 'ais-AutocompleteRecentSearchesItem'
192
- },
193
- items: storageHits,
194
- getItemProps: getItemProps
195
- }), indices.map(function (_ref6, index) {
182
+ var elements = {};
183
+ if (showRecent) {
184
+ elements.recent = /*#__PURE__*/_react.default.createElement(AutocompleteIndex
185
+ // @ts-ignore - there seems to be problems with React.ComponentType and this, but it's actually correct
186
+ , {
187
+ ItemComponent: function ItemComponent(_ref5) {
188
+ var item = _ref5.item,
189
+ onSelect = _ref5.onSelect;
190
+ return /*#__PURE__*/_react.default.createElement(AutocompleteRecentSearchComponent, {
191
+ item: item,
192
+ onSelect: onSelect,
193
+ onRemoveRecentSearch: function onRemoveRecentSearch() {
194
+ return storage.onRemove(item.query);
195
+ }
196
+ }, /*#__PURE__*/_react.default.createElement(ConditionalReverseHighlight, {
197
+ item: item
198
+ }));
199
+ },
200
+ classNames: {
201
+ root: 'ais-AutocompleteRecentSearches',
202
+ list: 'ais-AutocompleteRecentSearchesList',
203
+ item: 'ais-AutocompleteRecentSearchesItem'
204
+ },
205
+ items: storageHits,
206
+ getItemProps: getItemProps
207
+ });
208
+ }
209
+ indices.forEach(function (_ref6, i) {
196
210
  var indexId = _ref6.indexId,
211
+ indexName = _ref6.indexName,
197
212
  hits = _ref6.hits;
198
- return /*#__PURE__*/_react.default.createElement(AutocompleteIndex, {
213
+ var elementId = indexName === (showSuggestions === null || showSuggestions === void 0 ? void 0 : showSuggestions.indexName) ? 'suggestions' : indexName;
214
+ elements[elementId] = /*#__PURE__*/_react.default.createElement(AutocompleteIndex, {
199
215
  key: indexId
200
216
  // @ts-expect-error - there seems to be problems with React.ComponentType and this, but it's actually correct
201
217
  ,
202
- HeaderComponent: indicesConfig[index].headerComponent
218
+ HeaderComponent: indicesConfig[i].headerComponent
203
219
  // @ts-expect-error - there seems to be problems with React.ComponentType and this, but it's actually correct
204
220
  ,
205
- ItemComponent: indicesConfig[index].itemComponent,
221
+ ItemComponent: indicesConfig[i].itemComponent,
206
222
  items: hits.map(function (item) {
207
223
  return _objectSpread(_objectSpread({}, item), {}, {
208
224
  __indexName: indexId
209
225
  });
210
226
  }),
211
227
  getItemProps: getItemProps,
212
- classNames: indicesConfig[index].classNames
228
+ classNames: indicesConfig[i].classNames
213
229
  });
230
+ });
231
+ return /*#__PURE__*/_react.default.createElement(Autocomplete, _extends({}, props, getRootProps()), /*#__PURE__*/_react.default.createElement(_AutocompleteSearch.AutocompleteSearch, {
232
+ inputProps: getInputProps(),
233
+ clearQuery: function clearQuery() {
234
+ refineSearchBox('');
235
+ refineAutocomplete('');
236
+ }
237
+ }), /*#__PURE__*/_react.default.createElement(AutocompletePanel, getPanelProps(), PanelComponent ? /*#__PURE__*/_react.default.createElement(PanelComponent, {
238
+ elements: elements,
239
+ indices: indices
240
+ }) : Object.keys(elements).map(function (elementId) {
241
+ return elements[elementId];
214
242
  })));
243
+ }
244
+ function ConditionalReverseHighlight(_ref7) {
245
+ var _item$_highlightResul;
246
+ var item = _ref7.item;
247
+ if (!((_item$_highlightResul = item._highlightResult) !== null && _item$_highlightResul !== void 0 && _item$_highlightResul.query) ||
248
+ // @ts-expect-error - we should not have matchLevel as arrays here
249
+ item._highlightResult.query.matchLevel === 'none') {
250
+ return item.query;
251
+ }
252
+ return /*#__PURE__*/_react.default.createElement(_ReverseHighlight.ReverseHighlight, {
253
+ attribute: "query",
254
+ hit: item
255
+ });
215
256
  }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ReverseHighlight = ReverseHighlight;
8
+ var _utils = require("instantsearch.js/cjs/lib/utils");
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _ReverseHighlight = require("../ui/ReverseHighlight");
11
+ var _excluded = ["hit", "attribute", "highlightedTagName", "nonHighlightedTagName", "separator"],
12
+ _excluded2 = ["isHighlighted"];
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
15
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
21
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
22
+ function ReverseHighlight(_ref) {
23
+ var hit = _ref.hit,
24
+ attribute = _ref.attribute,
25
+ highlightedTagName = _ref.highlightedTagName,
26
+ nonHighlightedTagName = _ref.nonHighlightedTagName,
27
+ separator = _ref.separator,
28
+ props = _objectWithoutProperties(_ref, _excluded);
29
+ var property = (0, _utils.getPropertyByPath)(hit._highlightResult, attribute) || [];
30
+ var properties = Array.isArray(property) ? property : [property];
31
+ var parts = properties.map(function (singleValue) {
32
+ return (0, _utils.getHighlightedParts)((0, _utils.unescape)(singleValue.value || '')).map(function (_ref2) {
33
+ var isHighlighted = _ref2.isHighlighted,
34
+ rest = _objectWithoutProperties(_ref2, _excluded2);
35
+ return _objectSpread(_objectSpread({}, rest), {}, {
36
+ isHighlighted: !isHighlighted
37
+ });
38
+ });
39
+ });
40
+ return /*#__PURE__*/_react.default.createElement(_ReverseHighlight.ReverseHighlight, _extends({}, props, {
41
+ parts: parts,
42
+ highlightedTagName: highlightedTagName,
43
+ nonHighlightedTagName: nonHighlightedTagName,
44
+ separator: separator
45
+ }));
46
+ }
@@ -201,6 +201,17 @@ Object.keys(_RelatedProducts).forEach(function (key) {
201
201
  }
202
202
  });
203
203
  });
204
+ var _ReverseHighlight = require("./ReverseHighlight");
205
+ Object.keys(_ReverseHighlight).forEach(function (key) {
206
+ if (key === "default" || key === "__esModule") return;
207
+ if (key in exports && exports[key] === _ReverseHighlight[key]) return;
208
+ Object.defineProperty(exports, key, {
209
+ enumerable: true,
210
+ get: function get() {
211
+ return _ReverseHighlight[key];
212
+ }
213
+ });
214
+ });
204
215
  var _SearchBox = require("./SearchBox");
205
216
  Object.keys(_SearchBox).forEach(function (key) {
206
217
  if (key === "default" || key === "__esModule") return;
@@ -214,6 +214,18 @@ Object.keys(_RelatedProducts).forEach(function (key) {
214
214
  }
215
215
  });
216
216
  });
217
+ var _ReverseHighlight = require("./ReverseHighlight");
218
+ Object.keys(_ReverseHighlight).forEach(function (key) {
219
+ if (key === "default" || key === "__esModule") return;
220
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
221
+ if (key in exports && exports[key] === _ReverseHighlight[key]) return;
222
+ Object.defineProperty(exports, key, {
223
+ enumerable: true,
224
+ get: function get() {
225
+ return _ReverseHighlight[key];
226
+ }
227
+ });
228
+ });
217
229
  var _SearchBox = require("./SearchBox");
218
230
  Object.keys(_SearchBox).forEach(function (key) {
219
231
  if (key === "default" || key === "__esModule") return;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { HighlightProps as InternalHighlightProps, HighlightClassNames as InternalHighlightClassNames } from 'instantsearch-ui-components';
3
+ export type ReverseHighlightClassNames = InternalHighlightClassNames;
4
+ export type ReverseHighlightProps = Omit<InternalHighlightProps, 'classNames'> & {
5
+ classNames?: Partial<ReverseHighlightClassNames>;
6
+ };
7
+ export declare function ReverseHighlight({ classNames, ...props }: ReverseHighlightProps): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ var _excluded = ["classNames"];
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
+ import { cx } from 'instantsearch-ui-components';
6
+ import React from 'react';
7
+ import { InternalHighlight } from "./InternalHighlight.js";
8
+ export function ReverseHighlight(_ref) {
9
+ var _ref$classNames = _ref.classNames,
10
+ classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
11
+ props = _objectWithoutProperties(_ref, _excluded);
12
+ return /*#__PURE__*/React.createElement(InternalHighlight, _extends({
13
+ classNames: {
14
+ root: cx('ais-ReverseHighlight', classNames.root),
15
+ highlighted: cx('ais-ReverseHighlight-highlighted', classNames.highlighted),
16
+ nonHighlighted: cx('ais-ReverseHighlight-nonHighlighted', classNames.nonHighlighted),
17
+ separator: cx('ais-ReverseHighlight-separator', classNames.separator)
18
+ }
19
+ }, props));
20
+ }
@@ -1,12 +1,17 @@
1
1
  import React from 'react';
2
+ import { useAutocomplete } from 'react-instantsearch-core';
3
+ import type { PlainSearchParameters } from 'algoliasearch-helper';
2
4
  import type { AutocompleteIndexClassNames, AutocompleteIndexConfig, AutocompleteClassNames, AutocompleteIndexProps } from 'instantsearch-ui-components';
3
5
  import type { BaseHit, IndexUiState } from 'instantsearch.js';
4
6
  import type { ComponentProps } from 'react';
7
+ type AutocompleteSearchParameters = Omit<PlainSearchParameters, 'index'>;
5
8
  type IndexConfig<TItem extends BaseHit> = AutocompleteIndexConfig<TItem> & {
6
9
  headerComponent?: AutocompleteIndexProps<TItem>['HeaderComponent'];
7
10
  itemComponent: AutocompleteIndexProps<TItem>['ItemComponent'];
11
+ searchParameters?: AutocompleteSearchParameters;
8
12
  classNames?: Partial<AutocompleteIndexClassNames>;
9
13
  };
14
+ type PanelElements = Partial<Record<'recent' | 'suggestions' | (string & {}), React.JSX.Element>>;
10
15
  export type AutocompleteProps<TItem extends BaseHit> = ComponentProps<'div'> & {
11
16
  indices?: Array<IndexConfig<TItem>>;
12
17
  showSuggestions?: Partial<Pick<IndexConfig<{
@@ -28,7 +33,12 @@ export type AutocompleteProps<TItem extends BaseHit> = ComponentProps<'div'> & {
28
33
  };
29
34
  getSearchPageURL?: (nextUiState: IndexUiState) => string;
30
35
  onSelect?: AutocompleteIndexConfig<TItem>['onSelect'];
36
+ panelComponent?: (props: {
37
+ elements: PanelElements;
38
+ indices: ReturnType<typeof useAutocomplete>['indices'];
39
+ }) => React.JSX.Element;
40
+ searchParameters?: AutocompleteSearchParameters;
31
41
  classNames?: Partial<AutocompleteClassNames>;
32
42
  };
33
- export declare function EXPERIMENTAL_Autocomplete<TItem extends BaseHit = BaseHit>({ indices, showSuggestions, showRecent, ...props }: AutocompleteProps<TItem>): React.JSX.Element;
43
+ export declare function EXPERIMENTAL_Autocomplete<TItem extends BaseHit = BaseHit>({ indices, showSuggestions, showRecent, searchParameters: userSearchParameters, ...props }: AutocompleteProps<TItem>): React.JSX.Element;
34
44
  export {};
@@ -1,11 +1,6 @@
1
- var _excluded = ["indices", "showSuggestions", "showRecent"],
2
- _excluded2 = ["indicesConfig", "refineSearchBox", "getSearchPageURL", "onSelect", "indexUiState", "isSearchPage", "showRecent"];
1
+ var _excluded = ["indices", "showSuggestions", "showRecent", "searchParameters"],
2
+ _excluded2 = ["indicesConfig", "refineSearchBox", "getSearchPageURL", "onSelect", "indexUiState", "isSearchPage", "panelComponent", "showRecent", "showSuggestions"];
3
3
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
8
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
4
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
10
5
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
11
6
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -13,12 +8,18 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
13
8
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
14
9
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
15
10
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
15
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
16
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
17
17
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
18
18
  import { createAutocompleteComponent, createAutocompleteIndexComponent, createAutocompletePanelComponent, createAutocompletePropGetters, createAutocompleteSuggestionComponent, createAutocompleteRecentSearchComponent, createAutocompleteStorage, cx } from 'instantsearch-ui-components';
19
19
  import React, { createElement, Fragment, useEffect, useId, useMemo, useRef, useState } from 'react';
20
20
  import { Configure, Index, useAutocomplete, useInstantSearch, useSearchBox } from 'react-instantsearch-core';
21
21
  import { AutocompleteSearch } from "../components/AutocompleteSearch.js";
22
+ import { ReverseHighlight } from "./ReverseHighlight.js";
22
23
  var Autocomplete = createAutocompleteComponent({
23
24
  createElement: createElement,
24
25
  Fragment: Fragment
@@ -51,14 +52,12 @@ var useStorage = createAutocompleteStorage({
51
52
  useMemo: useMemo,
52
53
  useState: useState
53
54
  });
54
- var _ref2 = /*#__PURE__*/React.createElement(Configure, {
55
- hitsPerPage: 5
56
- });
57
55
  export function EXPERIMENTAL_Autocomplete(_ref) {
58
56
  var _ref$indices = _ref.indices,
59
57
  indices = _ref$indices === void 0 ? [] : _ref$indices,
60
58
  showSuggestions = _ref.showSuggestions,
61
59
  showRecent = _ref.showRecent,
60
+ userSearchParameters = _ref.searchParameters,
62
61
  props = _objectWithoutProperties(_ref, _excluded);
63
62
  var _useInstantSearch = useInstantSearch(),
64
63
  indexUiState = _useInstantSearch.indexUiState,
@@ -68,13 +67,25 @@ export function EXPERIMENTAL_Autocomplete(_ref) {
68
67
  $$widgetType: 'ais.autocomplete'
69
68
  }),
70
69
  refine = _useSearchBox.refine;
70
+ var searchParameters = _objectSpread({
71
+ hitsPerPage: 5
72
+ }, userSearchParameters);
71
73
  var indicesConfig = _toConsumableArray(indices);
72
74
  if (showSuggestions !== null && showSuggestions !== void 0 && showSuggestions.indexName) {
73
75
  var _showSuggestions$clas, _showSuggestions$clas2, _showSuggestions$clas3, _showSuggestions$clas4;
74
76
  indicesConfig.unshift({
75
77
  indexName: showSuggestions.indexName,
76
78
  headerComponent: showSuggestions.headerComponent,
77
- itemComponent: showSuggestions.itemComponent || AutocompleteSuggestion,
79
+ itemComponent: showSuggestions.itemComponent || function (_ref2) {
80
+ var item = _ref2.item,
81
+ onSelect = _ref2.onSelect;
82
+ return /*#__PURE__*/React.createElement(AutocompleteSuggestion, {
83
+ item: item,
84
+ onSelect: onSelect
85
+ }, /*#__PURE__*/React.createElement(ConditionalReverseHighlight, {
86
+ item: item
87
+ }));
88
+ },
78
89
  classNames: {
79
90
  root: cx('ais-AutocompleteSuggestions', showSuggestions === null || showSuggestions === void 0 ? void 0 : (_showSuggestions$clas = showSuggestions.classNames) === null || _showSuggestions$clas === void 0 ? void 0 : _showSuggestions$clas.root),
80
91
  list: cx('ais-AutocompleteSuggestionsList', showSuggestions === null || showSuggestions === void 0 ? void 0 : (_showSuggestions$clas2 = showSuggestions.classNames) === null || _showSuggestions$clas2 === void 0 ? void 0 : _showSuggestions$clas2.list),
@@ -92,17 +103,18 @@ export function EXPERIMENTAL_Autocomplete(_ref) {
92
103
  }, [indexRenderState]);
93
104
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Index, {
94
105
  EXPERIMENTAL_isolated: true
95
- }, _ref2, indicesConfig.map(function (index) {
106
+ }, /*#__PURE__*/React.createElement(Configure, searchParameters), indicesConfig.map(function (index) {
96
107
  return /*#__PURE__*/React.createElement(Index, {
97
108
  key: index.indexName,
98
109
  indexName: index.indexName
99
- });
110
+ }, /*#__PURE__*/React.createElement(Configure, index.searchParameters));
100
111
  }), /*#__PURE__*/React.createElement(InnerAutocomplete, _extends({}, props, {
101
112
  indicesConfig: indicesConfig,
102
113
  refineSearchBox: refine,
103
114
  indexUiState: indexUiState,
104
115
  isSearchPage: isSearchPage,
105
- showRecent: showRecent
116
+ showRecent: showRecent,
117
+ showSuggestions: showSuggestions
106
118
  }))));
107
119
  }
108
120
  function InnerAutocomplete(_ref3) {
@@ -112,7 +124,9 @@ function InnerAutocomplete(_ref3) {
112
124
  userOnSelect = _ref3.onSelect,
113
125
  indexUiState = _ref3.indexUiState,
114
126
  isSearchPage = _ref3.isSearchPage,
127
+ PanelComponent = _ref3.panelComponent,
115
128
  showRecent = _ref3.showRecent,
129
+ showSuggestions = _ref3.showSuggestions,
116
130
  props = _objectWithoutProperties(_ref3, _excluded2);
117
131
  var _useAutocomplete = useAutocomplete(),
118
132
  indices = _useAutocomplete.indices,
@@ -158,51 +172,78 @@ function InnerAutocomplete(_ref3) {
158
172
  getPanelProps = _usePropGetters.getPanelProps,
159
173
  getRootProps = _usePropGetters.getRootProps;
160
174
  var AutocompleteRecentSearchComponent = _typeof(showRecent) === 'object' && showRecent.itemComponent || AutocompleteRecentSearch;
161
- return /*#__PURE__*/React.createElement(Autocomplete, _extends({}, props, getRootProps()), /*#__PURE__*/React.createElement(AutocompleteSearch, {
162
- inputProps: getInputProps(),
163
- clearQuery: function clearQuery() {
164
- refineSearchBox('');
165
- refineAutocomplete('');
166
- }
167
- }), /*#__PURE__*/React.createElement(AutocompletePanel, getPanelProps(), showRecent && /*#__PURE__*/React.createElement(AutocompleteIndex
168
- // @ts-ignore - there seems to be problems with React.ComponentType and this, but it's actually correct
169
- , {
170
- ItemComponent: function ItemComponent(_ref5) {
171
- var item = _ref5.item,
172
- onSelect = _ref5.onSelect;
173
- return /*#__PURE__*/React.createElement(AutocompleteRecentSearchComponent, {
174
- item: item,
175
- onSelect: onSelect,
176
- onRemoveRecentSearch: function onRemoveRecentSearch() {
177
- return storage.onRemove(item.query);
178
- }
179
- });
180
- },
181
- classNames: {
182
- root: 'ais-AutocompleteRecentSearches',
183
- list: 'ais-AutocompleteRecentSearchesList',
184
- item: 'ais-AutocompleteRecentSearchesItem'
185
- },
186
- items: storageHits,
187
- getItemProps: getItemProps
188
- }), indices.map(function (_ref6, index) {
175
+ var elements = {};
176
+ if (showRecent) {
177
+ elements.recent = /*#__PURE__*/React.createElement(AutocompleteIndex
178
+ // @ts-ignore - there seems to be problems with React.ComponentType and this, but it's actually correct
179
+ , {
180
+ ItemComponent: function ItemComponent(_ref5) {
181
+ var item = _ref5.item,
182
+ onSelect = _ref5.onSelect;
183
+ return /*#__PURE__*/React.createElement(AutocompleteRecentSearchComponent, {
184
+ item: item,
185
+ onSelect: onSelect,
186
+ onRemoveRecentSearch: function onRemoveRecentSearch() {
187
+ return storage.onRemove(item.query);
188
+ }
189
+ }, /*#__PURE__*/React.createElement(ConditionalReverseHighlight, {
190
+ item: item
191
+ }));
192
+ },
193
+ classNames: {
194
+ root: 'ais-AutocompleteRecentSearches',
195
+ list: 'ais-AutocompleteRecentSearchesList',
196
+ item: 'ais-AutocompleteRecentSearchesItem'
197
+ },
198
+ items: storageHits,
199
+ getItemProps: getItemProps
200
+ });
201
+ }
202
+ indices.forEach(function (_ref6, i) {
189
203
  var indexId = _ref6.indexId,
204
+ indexName = _ref6.indexName,
190
205
  hits = _ref6.hits;
191
- return /*#__PURE__*/React.createElement(AutocompleteIndex, {
206
+ var elementId = indexName === (showSuggestions === null || showSuggestions === void 0 ? void 0 : showSuggestions.indexName) ? 'suggestions' : indexName;
207
+ elements[elementId] = /*#__PURE__*/React.createElement(AutocompleteIndex, {
192
208
  key: indexId
193
209
  // @ts-expect-error - there seems to be problems with React.ComponentType and this, but it's actually correct
194
210
  ,
195
- HeaderComponent: indicesConfig[index].headerComponent
211
+ HeaderComponent: indicesConfig[i].headerComponent
196
212
  // @ts-expect-error - there seems to be problems with React.ComponentType and this, but it's actually correct
197
213
  ,
198
- ItemComponent: indicesConfig[index].itemComponent,
214
+ ItemComponent: indicesConfig[i].itemComponent,
199
215
  items: hits.map(function (item) {
200
216
  return _objectSpread(_objectSpread({}, item), {}, {
201
217
  __indexName: indexId
202
218
  });
203
219
  }),
204
220
  getItemProps: getItemProps,
205
- classNames: indicesConfig[index].classNames
221
+ classNames: indicesConfig[i].classNames
206
222
  });
223
+ });
224
+ return /*#__PURE__*/React.createElement(Autocomplete, _extends({}, props, getRootProps()), /*#__PURE__*/React.createElement(AutocompleteSearch, {
225
+ inputProps: getInputProps(),
226
+ clearQuery: function clearQuery() {
227
+ refineSearchBox('');
228
+ refineAutocomplete('');
229
+ }
230
+ }), /*#__PURE__*/React.createElement(AutocompletePanel, getPanelProps(), PanelComponent ? /*#__PURE__*/React.createElement(PanelComponent, {
231
+ elements: elements,
232
+ indices: indices
233
+ }) : Object.keys(elements).map(function (elementId) {
234
+ return elements[elementId];
207
235
  })));
236
+ }
237
+ function ConditionalReverseHighlight(_ref7) {
238
+ var _item$_highlightResul;
239
+ var item = _ref7.item;
240
+ if (!((_item$_highlightResul = item._highlightResult) !== null && _item$_highlightResul !== void 0 && _item$_highlightResul.query) ||
241
+ // @ts-expect-error - we should not have matchLevel as arrays here
242
+ item._highlightResult.query.matchLevel === 'none') {
243
+ return item.query;
244
+ }
245
+ return /*#__PURE__*/React.createElement(ReverseHighlight, {
246
+ attribute: "query",
247
+ hit: item
248
+ });
208
249
  }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { PartialKeys } from '../types';
3
+ import type { ReverseHighlightProps as ReverseHighlightUiComponentProps } from '../ui/ReverseHighlight';
4
+ import type { BaseHit, Hit } from 'instantsearch.js';
5
+ export type ReverseHighlightProps<THit extends Hit<BaseHit>> = {
6
+ hit: THit;
7
+ attribute: keyof THit | string[];
8
+ } & PartialKeys<Omit<ReverseHighlightUiComponentProps, 'parts'>, 'highlightedTagName' | 'nonHighlightedTagName' | 'separator'>;
9
+ export declare function ReverseHighlight<THit extends Hit<BaseHit>>({ hit, attribute, highlightedTagName, nonHighlightedTagName, separator, ...props }: ReverseHighlightProps<THit>): React.JSX.Element;