react-instantsearch 7.16.2 → 7.17.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 (35) hide show
  1. package/dist/cjs/components/Autocomplete.js +114 -0
  2. package/dist/cjs/components/Carousel.js +19 -1
  3. package/dist/cjs/components/useAutocomplete.js +237 -0
  4. package/dist/cjs/index.umd.js +38 -0
  5. package/dist/cjs/lib/useStickToBottom.js +20 -0
  6. package/dist/cjs/ui/SearchBox.js +5 -4
  7. package/dist/cjs/widgets/Chat.js +258 -0
  8. package/dist/cjs/widgets/chat/tools/SearchIndexTool.js +120 -0
  9. package/dist/cjs/widgets/index.js +22 -11
  10. package/dist/cjs/widgets/index.umd.js +282 -0
  11. package/dist/es/components/Autocomplete.d.ts +20 -0
  12. package/dist/es/components/Autocomplete.js +106 -0
  13. package/dist/es/components/Carousel.d.ts +1 -1
  14. package/dist/es/components/Carousel.js +20 -2
  15. package/dist/es/components/useAutocomplete.d.ts +35 -0
  16. package/dist/es/components/useAutocomplete.js +231 -0
  17. package/dist/es/index.umd.d.ts +3 -0
  18. package/dist/es/index.umd.js +3 -0
  19. package/dist/es/lib/useStickToBottom.d.ts +1 -0
  20. package/dist/es/lib/useStickToBottom.js +14 -0
  21. package/dist/es/ui/SearchBox.d.ts +2 -1
  22. package/dist/es/ui/SearchBox.js +5 -4
  23. package/dist/es/widgets/Chat.d.ts +45 -0
  24. package/dist/es/widgets/Chat.js +238 -0
  25. package/dist/es/widgets/chat/tools/SearchIndexTool.d.ts +5 -0
  26. package/dist/es/widgets/chat/tools/SearchIndexTool.js +113 -0
  27. package/dist/es/widgets/index.d.ts +2 -1
  28. package/dist/es/widgets/index.js +3 -2
  29. package/dist/es/widgets/index.umd.d.ts +26 -0
  30. package/dist/es/widgets/index.umd.js +28 -0
  31. package/dist/umd/ReactInstantSearch.js +290 -195
  32. package/dist/umd/ReactInstantSearch.js.map +1 -1
  33. package/dist/umd/ReactInstantSearch.min.js +1 -1
  34. package/dist/umd/ReactInstantSearch.min.js.map +1 -1
  35. package/package.json +5 -5
@@ -1,13 +1,13 @@
1
1
  /*! React InstantSearch UNRELEASED | © Algolia, inc. | https://github.com/algolia/instantsearch */
2
2
  (function (global, factory) {
3
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
4
- typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
5
- (global = global || self, factory(global.ReactInstantSearch = {}, global.React));
6
- }(this, (function (exports, React) { 'use strict';
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('ai')) :
4
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'ai'], factory) :
5
+ (global = global || self, factory(global.ReactInstantSearch = {}, global.React, global.ai));
6
+ }(this, (function (exports, React, ai) { 'use strict';
7
7
 
8
8
  var React__default = 'default' in React ? React['default'] : React;
9
9
 
10
- var version = '7.16.2';
10
+ var version = '7.17.0';
11
11
 
12
12
  // Copyright Joyent, Inc. and other Node contributors.
13
13
  //
@@ -10546,12 +10546,18 @@
10546
10546
  }, []);
10547
10547
  }
10548
10548
  var index = function index(widgetParams) {
10549
- if (widgetParams === undefined || widgetParams.indexName === undefined) {
10549
+ if (widgetParams === undefined || widgetParams.indexName === undefined && !widgetParams.EXPERIMENTAL_isolated) {
10550
10550
  throw new Error(withUsage$2('The `indexName` option is required.'));
10551
10551
  }
10552
- var indexName = widgetParams.indexName,
10552
+
10553
+ // When isolated=true, we use an empty string as the default indexName.
10554
+ // This is intentional: isolated indices do not require a real index name.
10555
+ var _widgetParams$indexNa = widgetParams.indexName,
10556
+ indexName = _widgetParams$indexNa === void 0 ? '' : _widgetParams$indexNa,
10553
10557
  _widgetParams$indexId = widgetParams.indexId,
10554
- indexId = _widgetParams$indexId === void 0 ? indexName : _widgetParams$indexId;
10558
+ indexId = _widgetParams$indexId === void 0 ? indexName : _widgetParams$indexId,
10559
+ _widgetParams$EXPERIM = widgetParams.EXPERIMENTAL_isolated,
10560
+ isolated = _widgetParams$EXPERIM === void 0 ? false : _widgetParams$EXPERIM;
10555
10561
  var localWidgets = [];
10556
10562
  var localUiState = {};
10557
10563
  var localInstantSearchInstance = null;
@@ -10564,6 +10570,7 @@
10564
10570
  return {
10565
10571
  $$type: 'ais.index',
10566
10572
  $$widgetType: 'ais.index',
10573
+ _isolated: isolated,
10567
10574
  getIndexName: function getIndexName() {
10568
10575
  return indexName;
10569
10576
  },
@@ -10615,7 +10622,7 @@
10615
10622
  return resolveScopedResultsFromWidgets(widgetSiblings);
10616
10623
  },
10617
10624
  getParent: function getParent() {
10618
- return localParent;
10625
+ return isolated ? null : localParent;
10619
10626
  },
10620
10627
  createURL: function createURL(nextState) {
10621
10628
  if (typeof nextState === 'function') {
@@ -10634,12 +10641,15 @@
10634
10641
  if (!Array.isArray(widgets)) {
10635
10642
  throw new Error(withUsage$2('The `addWidgets` method expects an array of widgets.'));
10636
10643
  }
10637
- if (widgets.some(function (widget) {
10644
+ var flatWidgets = widgets.reduce(function (acc, w) {
10645
+ return acc.concat(Array.isArray(w) ? w : [w]);
10646
+ }, []);
10647
+ if (flatWidgets.some(function (widget) {
10638
10648
  return typeof widget.init !== 'function' && typeof widget.render !== 'function';
10639
10649
  })) {
10640
10650
  throw new Error(withUsage$2('The widget definition expects a `render` and/or an `init` method.'));
10641
10651
  }
10642
- widgets.forEach(function (widget) {
10652
+ flatWidgets.forEach(function (widget) {
10643
10653
  if (isIndexWidget(widget)) {
10644
10654
  return;
10645
10655
  }
@@ -10654,8 +10664,8 @@
10654
10664
  }
10655
10665
  addWidgetId(widget);
10656
10666
  });
10657
- localWidgets = localWidgets.concat(widgets);
10658
- if (localInstantSearchInstance && Boolean(widgets.length)) {
10667
+ localWidgets = localWidgets.concat(flatWidgets);
10668
+ if (localInstantSearchInstance && Boolean(flatWidgets.length)) {
10659
10669
  privateHelperSetState(helper, {
10660
10670
  state: getLocalWidgetsSearchParameters(localWidgets, {
10661
10671
  uiState: localUiState,
@@ -10671,7 +10681,7 @@
10671
10681
  // We compute the render state before calling `init` in a separate loop
10672
10682
  // to construct the whole render state object that is then passed to
10673
10683
  // `init`.
10674
- widgets.forEach(function (widget) {
10684
+ flatWidgets.forEach(function (widget) {
10675
10685
  if (widget.getRenderState) {
10676
10686
  var renderState = widget.getRenderState(localInstantSearchInstance.renderState[_this.getIndexId()] || {}, createInitArgs(localInstantSearchInstance, _this, localInstantSearchInstance._initialUiState));
10677
10687
  storeRenderState({
@@ -10681,12 +10691,17 @@
10681
10691
  });
10682
10692
  }
10683
10693
  });
10684
- widgets.forEach(function (widget) {
10694
+ flatWidgets.forEach(function (widget) {
10685
10695
  if (widget.init) {
10686
10696
  widget.init(createInitArgs(localInstantSearchInstance, _this, localInstantSearchInstance._initialUiState));
10687
10697
  }
10688
10698
  });
10689
- localInstantSearchInstance.scheduleSearch();
10699
+ if (isolated) {
10700
+ var _helper2;
10701
+ (_helper2 = helper) === null || _helper2 === void 0 ? void 0 : _helper2.search();
10702
+ } else {
10703
+ localInstantSearchInstance.scheduleSearch();
10704
+ }
10690
10705
  }
10691
10706
  return this;
10692
10707
  },
@@ -10695,13 +10710,16 @@
10695
10710
  if (!Array.isArray(widgets)) {
10696
10711
  throw new Error(withUsage$2('The `removeWidgets` method expects an array of widgets.'));
10697
10712
  }
10698
- if (widgets.some(function (widget) {
10713
+ var flatWidgets = widgets.reduce(function (acc, w) {
10714
+ return acc.concat(Array.isArray(w) ? w : [w]);
10715
+ }, []);
10716
+ if (flatWidgets.some(function (widget) {
10699
10717
  return typeof widget.dispose !== 'function';
10700
10718
  })) {
10701
10719
  throw new Error(withUsage$2('The widget definition expects a `dispose` method.'));
10702
10720
  }
10703
10721
  localWidgets = localWidgets.filter(function (widget) {
10704
- return widgets.indexOf(widget) === -1;
10722
+ return flatWidgets.indexOf(widget) === -1;
10705
10723
  });
10706
10724
  localWidgets.forEach(function (widget) {
10707
10725
  if (isIndexWidget(widget)) {
@@ -10717,8 +10735,8 @@
10717
10735
  hasSearchWidget = true;
10718
10736
  }
10719
10737
  });
10720
- if (localInstantSearchInstance && Boolean(widgets.length)) {
10721
- var _widgets$reduce = widgets.reduce(function (states, widget) {
10738
+ if (localInstantSearchInstance && Boolean(flatWidgets.length)) {
10739
+ var _flatWidgets$reduce = flatWidgets.reduce(function (states, widget) {
10722
10740
  // the `dispose` method exists at this point we already assert it
10723
10741
  var next = widget.dispose({
10724
10742
  helper: helper,
@@ -10736,8 +10754,8 @@
10736
10754
  cleanedSearchState: helper.state,
10737
10755
  cleanedRecommendState: helper.recommendState
10738
10756
  }),
10739
- cleanedSearchState = _widgets$reduce.cleanedSearchState,
10740
- cleanedRecommendState = _widgets$reduce.cleanedRecommendState;
10757
+ cleanedSearchState = _flatWidgets$reduce.cleanedSearchState,
10758
+ cleanedRecommendState = _flatWidgets$reduce.cleanedRecommendState;
10741
10759
  var newState = localInstantSearchInstance.future.preserveSharedStateOnUnmount ? getLocalWidgetsSearchParameters(localWidgets, {
10742
10760
  uiState: localUiState,
10743
10761
  initialSearchParameters: new algoliasearchHelper_1.SearchParameters({
@@ -10757,7 +10775,12 @@
10757
10775
  helper.setState(newState);
10758
10776
  helper.recommendState = cleanedRecommendState;
10759
10777
  if (localWidgets.length) {
10760
- localInstantSearchInstance.scheduleSearch();
10778
+ if (isolated) {
10779
+ var _helper3;
10780
+ (_helper3 = helper) === null || _helper3 === void 0 ? void 0 : _helper3.search();
10781
+ } else {
10782
+ localInstantSearchInstance.scheduleSearch();
10783
+ }
10761
10784
  }
10762
10785
  }
10763
10786
  return this;
@@ -10795,13 +10818,20 @@
10795
10818
  // This Helper is only used for state management we do not care about the
10796
10819
  // `searchClient`. Only the "main" Helper created at the `InstantSearch`
10797
10820
  // level is aware of the client.
10798
- helper = algoliasearchHelper_1({}, parameters.index, parameters);
10821
+ helper = algoliasearchHelper_1(mainHelper.getClient(), parameters.index, parameters);
10799
10822
  helper.recommendState = recommendParameters;
10800
10823
 
10801
10824
  // We forward the call to `search` to the "main" instance of the Helper
10802
10825
  // which is responsible for managing the queries (it's the only one that is
10803
10826
  // aware of the `searchClient`).
10804
10827
  helper.search = function () {
10828
+ if (isolated) {
10829
+ instantSearchInstance.status = 'loading';
10830
+ _this3.render({
10831
+ instantSearchInstance: instantSearchInstance
10832
+ });
10833
+ return instantSearchInstance.compositionID ? helper.searchWithComposition() : helper.searchOnlyWithDerivedHelpers();
10834
+ }
10805
10835
  if (instantSearchInstance.onStateChange) {
10806
10836
  instantSearchInstance.onStateChange({
10807
10837
  uiState: instantSearchInstance.mainIndex.getWidgetUiState({}),
@@ -10825,7 +10855,9 @@
10825
10855
  var state = helper.state.setQueryParameters(userState);
10826
10856
  return mainHelper.searchForFacetValues(facetName, facetValue, maxFacetHits, state);
10827
10857
  };
10828
- derivedHelper = mainHelper.derive(function () {
10858
+ var isolatedHelper = indexName ? helper : algoliasearchHelper_1({}, '__empty_index__', {});
10859
+ var derivingHelper = isolated ? isolatedHelper : nearestIsolatedHelper(parent, mainHelper);
10860
+ derivedHelper = derivingHelper.derive(function () {
10829
10861
  return mergeSearchParameters.apply(void 0, [mainHelper.state].concat(_toConsumableArray$1(resolveSearchParameters(_this3))));
10830
10862
  }, function () {
10831
10863
  return _this3.getHelper().recommendState;
@@ -10957,7 +10989,11 @@
10957
10989
 
10958
10990
  // We only render index widgets if there are no results.
10959
10991
  // This makes sure `render` is never called with `results` being `null`.
10960
- var widgetsToRender = this.getResults() || (_derivedHelper2 = derivedHelper) !== null && _derivedHelper2 !== void 0 && _derivedHelper2.lastRecommendResults ? localWidgets : localWidgets.filter(isIndexWidget);
10992
+ // If it's an isolated index without an index name, we render all widgets,
10993
+ // as there are no results to display for the isolated index itself.
10994
+ var widgetsToRender = this.getResults() || (_derivedHelper2 = derivedHelper) !== null && _derivedHelper2 !== void 0 && _derivedHelper2.lastRecommendResults || isolated && !indexName ? localWidgets : localWidgets.filter(function (widget) {
10995
+ return widget.shouldRender;
10996
+ });
10961
10997
  widgetsToRender = widgetsToRender.filter(function (widget) {
10962
10998
  if (!widget.shouldRender) {
10963
10999
  return true;
@@ -10991,7 +11027,7 @@
10991
11027
  },
10992
11028
  dispose: function dispose() {
10993
11029
  var _this5 = this,
10994
- _helper2,
11030
+ _helper4,
10995
11031
  _derivedHelper3;
10996
11032
  localWidgets.forEach(function (widget) {
10997
11033
  if (widget.dispose && helper) {
@@ -11011,13 +11047,15 @@
11011
11047
  });
11012
11048
  localInstantSearchInstance = null;
11013
11049
  localParent = null;
11014
- (_helper2 = helper) === null || _helper2 === void 0 ? void 0 : _helper2.removeAllListeners();
11050
+ (_helper4 = helper) === null || _helper4 === void 0 ? void 0 : _helper4.removeAllListeners();
11015
11051
  helper = null;
11016
11052
  (_derivedHelper3 = derivedHelper) === null || _derivedHelper3 === void 0 ? void 0 : _derivedHelper3.detach();
11017
11053
  derivedHelper = null;
11018
11054
  },
11019
11055
  getWidgetUiState: function getWidgetUiState(uiState) {
11020
- return localWidgets.filter(isIndexWidget).reduce(function (previousUiState, innerIndex) {
11056
+ return localWidgets.filter(isIndexWidget).filter(function (w) {
11057
+ return !w._isolated;
11058
+ }).reduce(function (previousUiState, innerIndex) {
11021
11059
  return innerIndex.getWidgetUiState(previousUiState);
11022
11060
  }, _objectSpread$f(_objectSpread$f({}, uiState), {}, _defineProperty$f({}, indexId, _objectSpread$f(_objectSpread$f({}, uiState[indexId]), localUiState))));
11023
11061
  },
@@ -11031,6 +11069,9 @@
11031
11069
  initialSearchParameters: searchParameters
11032
11070
  });
11033
11071
  },
11072
+ shouldRender: function shouldRender() {
11073
+ return true;
11074
+ },
11034
11075
  refreshUiState: function refreshUiState() {
11035
11076
  localUiState = getLocalWidgetsUiState(localWidgets, {
11036
11077
  searchParameters: this.getHelper().state,
@@ -11053,6 +11094,19 @@
11053
11094
  instantSearchInstance.renderState = _objectSpread$f(_objectSpread$f({}, instantSearchInstance.renderState), {}, _defineProperty$f({}, parentIndexName, _objectSpread$f(_objectSpread$f({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
11054
11095
  }
11055
11096
 
11097
+ /**
11098
+ * Walk up the parent chain to find the closest isolated index, or fall back to mainHelper
11099
+ */
11100
+ function nearestIsolatedHelper(current, mainHelper) {
11101
+ while (current) {
11102
+ if (current._isolated) {
11103
+ return current.getHelper();
11104
+ }
11105
+ current = current.getParent();
11106
+ }
11107
+ return mainHelper;
11108
+ }
11109
+
11056
11110
  function _slicedToArray$6(arr, i) {
11057
11111
  return _arrayWithHoles$6(arr) || _iterableToArrayLimit$6(arr, i) || _unsupportedIterableToArray$8(arr, i) || _nonIterableRest$6();
11058
11112
  }
@@ -13468,7 +13522,7 @@
13468
13522
  };
13469
13523
  }
13470
13524
 
13471
- var version$3 = '4.79.2';
13525
+ var version$3 = '4.81.0';
13472
13526
 
13473
13527
  function _typeof$q(o) {
13474
13528
  "@babel/helpers - typeof";
@@ -13902,12 +13956,9 @@
13902
13956
  if (!Array.isArray(widgets)) {
13903
13957
  throw new Error(withUsage$3('The `addWidgets` method expects an array of widgets. Please use `addWidget`.'));
13904
13958
  }
13905
- if (widgets.some(function (widget) {
13906
- return typeof widget.init !== 'function' && typeof widget.render !== 'function';
13959
+ if (this.compositionID && widgets.some(function (w) {
13960
+ return !Array.isArray(w) && isIndexWidget(w) && !w._isolated;
13907
13961
  })) {
13908
- throw new Error(withUsage$3('The widget definition expects a `render` and/or an `init` method.'));
13909
- }
13910
- if (this.compositionID && widgets.some(isIndexWidget)) {
13911
13962
  throw new Error(withUsage$3('The `index` widget cannot be used with a composition-based InstantSearch implementation.'));
13912
13963
  }
13913
13964
  this.mainIndex.addWidgets(widgets);
@@ -13939,11 +13990,6 @@
13939
13990
  if (!Array.isArray(widgets)) {
13940
13991
  throw new Error(withUsage$3('The `removeWidgets` method expects an array of widgets. Please use `removeWidget`.'));
13941
13992
  }
13942
- if (widgets.some(function (widget) {
13943
- return typeof widget.dispose !== 'function';
13944
- })) {
13945
- throw new Error(withUsage$3('The widget definition expects a `dispose` method.'));
13946
- }
13947
13993
  this.mainIndex.removeWidgets(widgets);
13948
13994
  return this;
13949
13995
  }
@@ -20895,6 +20941,10 @@
20895
20941
  });
20896
20942
  }
20897
20943
 
20944
+ var useChat = function useChat() {
20945
+ throw new Error("\"useChat()\" is not available from the UMD build.\n\nPlease use React InstantSearch with a packaging system:\nhttps://www.algolia.com/doc/guides/building-search-ui/installation/react/#install-react-instantsearch-as-an-npm-package");
20946
+ };
20947
+
20898
20948
  function _iterableToArrayLimit$g(r, l) {
20899
20949
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
20900
20950
  if (null != t) {
@@ -21050,6 +21100,50 @@
21050
21100
 
21051
21101
  var _extends$2 = unwrapExports(_extends_1);
21052
21102
 
21103
+ var objectWithoutPropertiesLoose = createCommonjsModule(function (module) {
21104
+ function _objectWithoutPropertiesLoose(r, e) {
21105
+ if (null == r) return {};
21106
+ var t = {};
21107
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
21108
+ if (-1 !== e.indexOf(n)) continue;
21109
+ t[n] = r[n];
21110
+ }
21111
+ return t;
21112
+ }
21113
+ module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
21114
+ });
21115
+
21116
+ unwrapExports(objectWithoutPropertiesLoose);
21117
+
21118
+ var objectWithoutProperties = createCommonjsModule(function (module) {
21119
+ function _objectWithoutProperties(e, t) {
21120
+ if (null == e) return {};
21121
+ var o,
21122
+ r,
21123
+ i = objectWithoutPropertiesLoose(e, t);
21124
+ if (Object.getOwnPropertySymbols) {
21125
+ var n = Object.getOwnPropertySymbols(e);
21126
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
21127
+ }
21128
+ return i;
21129
+ }
21130
+ module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
21131
+ });
21132
+
21133
+ var _objectWithoutProperties$d = unwrapExports(objectWithoutProperties);
21134
+
21135
+ function cx() {
21136
+ for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {
21137
+ classNames[_key] = arguments[_key];
21138
+ }
21139
+ return classNames.reduce(function (acc, className) {
21140
+ if (Array.isArray(className)) {
21141
+ return acc.concat(className);
21142
+ }
21143
+ return acc.concat([className]);
21144
+ }, []).filter(Boolean).join(' ');
21145
+ }
21146
+
21053
21147
  var _typeof_1 = createCommonjsModule(function (module) {
21054
21148
  function _typeof(o) {
21055
21149
  "@babel/helpers - typeof";
@@ -21108,50 +21202,6 @@
21108
21202
 
21109
21203
  var _defineProperty$N = unwrapExports(defineProperty);
21110
21204
 
21111
- var objectWithoutPropertiesLoose = createCommonjsModule(function (module) {
21112
- function _objectWithoutPropertiesLoose(r, e) {
21113
- if (null == r) return {};
21114
- var t = {};
21115
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
21116
- if (-1 !== e.indexOf(n)) continue;
21117
- t[n] = r[n];
21118
- }
21119
- return t;
21120
- }
21121
- module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
21122
- });
21123
-
21124
- unwrapExports(objectWithoutPropertiesLoose);
21125
-
21126
- var objectWithoutProperties = createCommonjsModule(function (module) {
21127
- function _objectWithoutProperties(e, t) {
21128
- if (null == e) return {};
21129
- var o,
21130
- r,
21131
- i = objectWithoutPropertiesLoose(e, t);
21132
- if (Object.getOwnPropertySymbols) {
21133
- var n = Object.getOwnPropertySymbols(e);
21134
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
21135
- }
21136
- return i;
21137
- }
21138
- module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
21139
- });
21140
-
21141
- var _objectWithoutProperties$d = unwrapExports(objectWithoutProperties);
21142
-
21143
- function cx() {
21144
- for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {
21145
- classNames[_key] = arguments[_key];
21146
- }
21147
- return classNames.reduce(function (acc, className) {
21148
- if (Array.isArray(className)) {
21149
- return acc.concat(className);
21150
- }
21151
- return acc.concat([className]);
21152
- }, []).filter(Boolean).join(' ');
21153
- }
21154
-
21155
21205
  function createDefaultEmptyComponent(_ref) {
21156
21206
  var createElement = _ref.createElement,
21157
21207
  Fragment = _ref.Fragment;
@@ -21217,7 +21267,7 @@
21217
21267
  };
21218
21268
  }
21219
21269
 
21220
- var _excluded$c = ["listRef", "nextButtonRef", "previousButtonRef", "carouselIdRef", "classNames", "itemComponent", "previousIconComponent", "nextIconComponent", "items", "translations", "sendEvent"];
21270
+ var _excluded$c = ["listRef", "nextButtonRef", "previousButtonRef", "carouselIdRef", "canScrollLeft", "canScrollRight", "setCanScrollLeft", "setCanScrollRight", "classNames", "itemComponent", "previousIconComponent", "nextIconComponent", "headerComponent", "showNavigation", "items", "translations", "sendEvent"];
21221
21271
  function ownKeys$L(e, r) {
21222
21272
  var t = Object.keys(e);
21223
21273
  if (Object.getOwnPropertySymbols) {
@@ -21279,6 +21329,10 @@
21279
21329
  nextButtonRef = userProps.nextButtonRef,
21280
21330
  previousButtonRef = userProps.previousButtonRef,
21281
21331
  carouselIdRef = userProps.carouselIdRef,
21332
+ canScrollLeft = userProps.canScrollLeft,
21333
+ canScrollRight = userProps.canScrollRight,
21334
+ setCanScrollLeft = userProps.setCanScrollLeft,
21335
+ setCanScrollRight = userProps.setCanScrollRight,
21282
21336
  _userProps$classNames = userProps.classNames,
21283
21337
  classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
21284
21338
  _userProps$itemCompon = userProps.itemComponent,
@@ -21290,6 +21344,9 @@
21290
21344
  PreviousIconComponent = _userProps$previousIc === void 0 ? PreviousIconDefaultComponent : _userProps$previousIc,
21291
21345
  _userProps$nextIconCo = userProps.nextIconComponent,
21292
21346
  NextIconComponent = _userProps$nextIconCo === void 0 ? NextIconDefaultComponent : _userProps$nextIconCo,
21347
+ HeaderComponent = userProps.headerComponent,
21348
+ _userProps$showNaviga = userProps.showNavigation,
21349
+ showNavigation = _userProps$showNaviga === void 0 ? true : _userProps$showNaviga,
21293
21350
  items = userProps.items,
21294
21351
  userTranslations = userProps.translations,
21295
21352
  sendEvent = userProps.sendEvent,
@@ -21320,18 +21377,31 @@
21320
21377
  }
21321
21378
  }
21322
21379
  function updateNavigationButtonsProps() {
21323
- if (!listRef.current || !previousButtonRef.current || !nextButtonRef.current) {
21380
+ if (!listRef.current) {
21324
21381
  return;
21325
21382
  }
21326
- previousButtonRef.current.hidden = listRef.current.scrollLeft <= 0;
21327
- nextButtonRef.current.hidden = listRef.current.scrollLeft + listRef.current.clientWidth >= listRef.current.scrollWidth;
21383
+ var isLeftHidden = listRef.current.scrollLeft <= 0;
21384
+ var isRightHidden = listRef.current.scrollLeft + listRef.current.clientWidth >= listRef.current.scrollWidth;
21385
+ setCanScrollLeft(!isLeftHidden);
21386
+ setCanScrollRight(!isRightHidden);
21387
+ if (previousButtonRef.current) {
21388
+ previousButtonRef.current.hidden = isLeftHidden;
21389
+ }
21390
+ if (nextButtonRef.current) {
21391
+ nextButtonRef.current.hidden = isRightHidden;
21392
+ }
21328
21393
  }
21329
21394
  if (items.length === 0) {
21330
21395
  return null;
21331
21396
  }
21332
21397
  return createElement("div", _extends$2({}, props, {
21333
21398
  className: cx(cssClasses.root)
21334
- }), createElement("button", {
21399
+ }), HeaderComponent && createElement(HeaderComponent, {
21400
+ canScrollLeft: canScrollLeft,
21401
+ canScrollRight: canScrollRight,
21402
+ scrollLeft: scrollLeft,
21403
+ scrollRight: scrollRight
21404
+ }), showNavigation && createElement("button", {
21335
21405
  ref: previousButtonRef,
21336
21406
  title: translations.previousButtonTitle,
21337
21407
  "aria-label": translations.previousButtonLabel,
@@ -21378,7 +21448,7 @@
21378
21448
  item: item,
21379
21449
  sendEvent: sendEvent
21380
21450
  }));
21381
- })), createElement("button", {
21451
+ })), showNavigation && createElement("button", {
21382
21452
  ref: nextButtonRef,
21383
21453
  title: translations.nextButtonTitle,
21384
21454
  "aria-label": translations.nextButtonLabel,
@@ -22523,7 +22593,67 @@
22523
22593
  return /*#__PURE__*/React__default.createElement(InfiniteHits, _extends$1({}, props, uiProps));
22524
22594
  }
22525
22595
 
22526
- var _excluded$A = ["items", "classNames", "showMore", "canToggleShowMore", "onToggleShowMore", "isShowingMore", "createURL", "onRefine", "translations"];
22596
+ var _excluded$A = ["objectIDs", "limit", "threshold", "queryParameters", "fallbackParameters", "escapeHTML", "transformItems", "itemComponent", "headerComponent", "emptyComponent", "layoutComponent"];
22597
+ var LookingSimilarUiComponent = createLookingSimilarComponent({
22598
+ createElement: React.createElement,
22599
+ Fragment: React.Fragment
22600
+ });
22601
+ function LookingSimilar(_ref) {
22602
+ var objectIDs = _ref.objectIDs,
22603
+ limit = _ref.limit,
22604
+ threshold = _ref.threshold,
22605
+ queryParameters = _ref.queryParameters,
22606
+ fallbackParameters = _ref.fallbackParameters,
22607
+ escapeHTML = _ref.escapeHTML,
22608
+ transformItems = _ref.transformItems,
22609
+ itemComponent = _ref.itemComponent,
22610
+ headerComponent = _ref.headerComponent,
22611
+ emptyComponent = _ref.emptyComponent,
22612
+ layoutComponent = _ref.layoutComponent,
22613
+ props = _objectWithoutProperties$c(_ref, _excluded$A);
22614
+ var _useInstantSearch = useInstantSearch(),
22615
+ status = _useInstantSearch.status;
22616
+ var _useLookingSimilar = useLookingSimilar({
22617
+ objectIDs: objectIDs,
22618
+ limit: limit,
22619
+ threshold: threshold,
22620
+ queryParameters: queryParameters,
22621
+ fallbackParameters: fallbackParameters,
22622
+ escapeHTML: escapeHTML,
22623
+ transformItems: transformItems
22624
+ }, {
22625
+ $$widgetType: 'ais.lookingSimilar'
22626
+ }),
22627
+ items = _useLookingSimilar.items,
22628
+ sendEvent = _useLookingSimilar.sendEvent;
22629
+ var layout = layoutComponent ? function (layoutProps) {
22630
+ return layoutComponent(_objectSpread2(_objectSpread2({}, layoutProps), {}, {
22631
+ classNames: {
22632
+ list: layoutProps.classNames.list,
22633
+ item: layoutProps.classNames.item
22634
+ }
22635
+ }));
22636
+ } : undefined;
22637
+ var _itemComponent = React.useMemo(function () {
22638
+ return itemComponent ? function (itemProps) {
22639
+ return itemComponent(_objectSpread2(_objectSpread2({}, itemProps), {}, {
22640
+ sendEvent: sendEvent
22641
+ }));
22642
+ } : undefined;
22643
+ }, [itemComponent, sendEvent]);
22644
+ var uiProps = {
22645
+ items: items,
22646
+ itemComponent: _itemComponent,
22647
+ headerComponent: headerComponent,
22648
+ emptyComponent: emptyComponent,
22649
+ layout: layout,
22650
+ status: status,
22651
+ sendEvent: sendEvent
22652
+ };
22653
+ return /*#__PURE__*/React__default.createElement(LookingSimilarUiComponent, _extends$1({}, props, uiProps));
22654
+ }
22655
+
22656
+ var _excluded$B = ["items", "classNames", "showMore", "canToggleShowMore", "onToggleShowMore", "isShowingMore", "createURL", "onRefine", "translations"];
22527
22657
  function Menu(_ref) {
22528
22658
  var items = _ref.items,
22529
22659
  _ref$classNames = _ref.classNames,
@@ -22535,7 +22665,7 @@
22535
22665
  createURL = _ref.createURL,
22536
22666
  onRefine = _ref.onRefine,
22537
22667
  translations = _ref.translations,
22538
- props = _objectWithoutProperties$c(_ref, _excluded$A);
22668
+ props = _objectWithoutProperties$c(_ref, _excluded$B);
22539
22669
  return /*#__PURE__*/React__default.createElement("div", _extends$1({}, props, {
22540
22670
  className: cx('ais-Menu', classNames.root, items.length === 0 && cx('ais-Menu--noRefinement', classNames.noRefinementRoot), props.className)
22541
22671
  }), /*#__PURE__*/React__default.createElement("ul", {
@@ -22568,7 +22698,7 @@
22568
22698
  }));
22569
22699
  }
22570
22700
 
22571
- var _excluded$B = ["attribute", "limit", "showMore", "showMoreLimit", "sortBy", "transformItems", "translations"];
22701
+ var _excluded$C = ["attribute", "limit", "showMore", "showMoreLimit", "sortBy", "transformItems", "translations"];
22572
22702
  function Menu$1(_ref) {
22573
22703
  var attribute = _ref.attribute,
22574
22704
  limit = _ref.limit,
@@ -22577,7 +22707,7 @@
22577
22707
  sortBy = _ref.sortBy,
22578
22708
  transformItems = _ref.transformItems,
22579
22709
  translations = _ref.translations,
22580
- props = _objectWithoutProperties$c(_ref, _excluded$B);
22710
+ props = _objectWithoutProperties$c(_ref, _excluded$C);
22581
22711
  var _useMenu = useMenu({
22582
22712
  attribute: attribute,
22583
22713
  limit: limit,
@@ -22614,7 +22744,7 @@
22614
22744
  }));
22615
22745
  }
22616
22746
 
22617
- var _excluded$C = ["pages", "currentPage", "nbPages", "isFirstPage", "isLastPage", "showFirst", "showPrevious", "showNext", "showLast", "createURL", "onNavigate", "translations", "classNames"],
22747
+ var _excluded$D = ["pages", "currentPage", "nbPages", "isFirstPage", "isLastPage", "showFirst", "showPrevious", "showNext", "showLast", "createURL", "onNavigate", "translations", "classNames"],
22618
22748
  _excluded2$5 = ["isDisabled", "className", "classNames", "href", "onClick"];
22619
22749
  function Pagination(_ref) {
22620
22750
  var pages = _ref.pages,
@@ -22635,7 +22765,7 @@
22635
22765
  translations = _ref.translations,
22636
22766
  _ref$classNames = _ref.classNames,
22637
22767
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
22638
- props = _objectWithoutProperties$c(_ref, _excluded$C);
22768
+ props = _objectWithoutProperties$c(_ref, _excluded$D);
22639
22769
  var firstPageIndex = 0;
22640
22770
  var previousPageIndex = currentPage - 1;
22641
22771
  var nextPageIndex = currentPage + 1;
@@ -22729,7 +22859,7 @@
22729
22859
  }, props)));
22730
22860
  }
22731
22861
 
22732
- var _excluded$D = ["showFirst", "showPrevious", "showNext", "showLast", "padding", "totalPages", "translations"];
22862
+ var _excluded$E = ["showFirst", "showPrevious", "showNext", "showLast", "padding", "totalPages", "translations"];
22733
22863
  function Pagination$1(_ref) {
22734
22864
  var showFirst = _ref.showFirst,
22735
22865
  showPrevious = _ref.showPrevious,
@@ -22738,7 +22868,7 @@
22738
22868
  padding = _ref.padding,
22739
22869
  totalPages = _ref.totalPages,
22740
22870
  translations = _ref.translations,
22741
- props = _objectWithoutProperties$c(_ref, _excluded$D);
22871
+ props = _objectWithoutProperties$c(_ref, _excluded$E);
22742
22872
  var _usePagination = usePagination({
22743
22873
  padding: padding,
22744
22874
  totalPages: totalPages
@@ -22787,14 +22917,14 @@
22787
22917
  }));
22788
22918
  }
22789
22919
 
22790
- var _excluded$E = ["classNames", "url", "theme"];
22920
+ var _excluded$F = ["classNames", "url", "theme"];
22791
22921
  function PoweredBy(_ref) {
22792
22922
  var _ref$classNames = _ref.classNames,
22793
22923
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
22794
22924
  url = _ref.url,
22795
22925
  _ref$theme = _ref.theme,
22796
22926
  theme = _ref$theme === void 0 ? 'light' : _ref$theme,
22797
- props = _objectWithoutProperties$c(_ref, _excluded$E);
22927
+ props = _objectWithoutProperties$c(_ref, _excluded$F);
22798
22928
  return /*#__PURE__*/React__default.createElement("div", _extends$1({}, props, {
22799
22929
  className: cx('ais-PoweredBy', theme === 'dark' ? cx('ais-PoweredBy--dark', classNames.dark) : cx('ais-PoweredBy--light', classNames.light), classNames.root, props.className)
22800
22930
  }), /*#__PURE__*/React__default.createElement("a", {
@@ -22824,7 +22954,7 @@
22824
22954
  return /*#__PURE__*/React__default.createElement(PoweredBy, _extends$1({}, props, uiProps));
22825
22955
  }
22826
22956
 
22827
- var _excluded$F = ["classNames", "range", "start", "step", "disabled", "onSubmit", "translations"];
22957
+ var _excluded$G = ["classNames", "range", "start", "step", "disabled", "onSubmit", "translations"];
22828
22958
  // if the default value is undefined, React considers the component uncontrolled initially, which we don't want 0 or NaN as the default value
22829
22959
  var unsetNumberInputValue = '';
22830
22960
 
@@ -22849,7 +22979,7 @@
22849
22979
  disabled = _ref.disabled,
22850
22980
  _onSubmit = _ref.onSubmit,
22851
22981
  translations = _ref.translations,
22852
- props = _objectWithoutProperties$c(_ref, _excluded$F);
22982
+ props = _objectWithoutProperties$c(_ref, _excluded$G);
22853
22983
  var values = {
22854
22984
  min: minValue !== -Infinity && minValue !== min ? minValue : unsetNumberInputValue,
22855
22985
  max: maxValue !== Infinity && maxValue !== max ? maxValue : unsetNumberInputValue
@@ -22929,14 +23059,14 @@
22929
23059
  }, translations.submitButtonText)));
22930
23060
  }
22931
23061
 
22932
- var _excluded$G = ["attribute", "min", "max", "precision", "translations"];
23062
+ var _excluded$H = ["attribute", "min", "max", "precision", "translations"];
22933
23063
  function RangeInput$1(_ref) {
22934
23064
  var attribute = _ref.attribute,
22935
23065
  min = _ref.min,
22936
23066
  max = _ref.max,
22937
23067
  precision = _ref.precision,
22938
23068
  translations = _ref.translations,
22939
- props = _objectWithoutProperties$c(_ref, _excluded$G);
23069
+ props = _objectWithoutProperties$c(_ref, _excluded$H);
22940
23070
  var _useRange = useRange({
22941
23071
  attribute: attribute,
22942
23072
  min: min,
@@ -22964,7 +23094,7 @@
22964
23094
  return /*#__PURE__*/React__default.createElement(RangeInput, _extends$1({}, props, uiProps));
22965
23095
  }
22966
23096
 
22967
- var _excluded$H = ["canRefine", "items", "onRefine", "query", "searchBox", "noResults", "showMore", "canToggleShowMore", "onToggleShowMore", "isShowingMore", "className", "classNames", "translations"];
23097
+ var _excluded$I = ["canRefine", "items", "onRefine", "query", "searchBox", "noResults", "showMore", "canToggleShowMore", "onToggleShowMore", "isShowingMore", "className", "classNames", "translations"];
22968
23098
  function RefinementList$1(_ref) {
22969
23099
  var canRefine = _ref.canRefine,
22970
23100
  items = _ref.items,
@@ -22980,7 +23110,7 @@
22980
23110
  _ref$classNames = _ref.classNames,
22981
23111
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
22982
23112
  translations = _ref.translations,
22983
- props = _objectWithoutProperties$c(_ref, _excluded$H);
23113
+ props = _objectWithoutProperties$c(_ref, _excluded$I);
22984
23114
  return /*#__PURE__*/React__default.createElement("div", _extends$1({}, props, {
22985
23115
  className: cx('ais-RefinementList', classNames.root, items.length === 0 && cx('ais-RefinementList--noRefinement', classNames.noRefinementRoot), className)
22986
23116
  }), searchBox && /*#__PURE__*/React__default.createElement("div", {
@@ -23019,7 +23149,7 @@
23019
23149
  }));
23020
23150
  }
23021
23151
 
23022
- var _excluded$I = ["formRef", "inputRef", "isSearchStalled", "onChange", "onReset", "onSubmit", "placeholder", "value", "autoFocus", "resetIconComponent", "submitIconComponent", "loadingIconComponent", "classNames", "translations"];
23152
+ var _excluded$J = ["formRef", "inputRef", "inputProps", "isSearchStalled", "onChange", "onReset", "onSubmit", "placeholder", "value", "autoFocus", "resetIconComponent", "submitIconComponent", "loadingIconComponent", "classNames", "translations"];
23023
23153
  var _ref2 = /*#__PURE__*/React__default.createElement("path", {
23024
23154
  d: "M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z"
23025
23155
  });
@@ -23082,6 +23212,7 @@
23082
23212
  function SearchBox(_ref7) {
23083
23213
  var formRef = _ref7.formRef,
23084
23214
  inputRef = _ref7.inputRef,
23215
+ inputProps = _ref7.inputProps,
23085
23216
  isSearchStalled = _ref7.isSearchStalled,
23086
23217
  onChange = _ref7.onChange,
23087
23218
  onReset = _ref7.onReset,
@@ -23099,7 +23230,7 @@
23099
23230
  _ref7$classNames = _ref7.classNames,
23100
23231
  classNames = _ref7$classNames === void 0 ? {} : _ref7$classNames,
23101
23232
  translations = _ref7.translations,
23102
- props = _objectWithoutProperties$c(_ref7, _excluded$I);
23233
+ props = _objectWithoutProperties$c(_ref7, _excluded$J);
23103
23234
  function handleSubmit(event) {
23104
23235
  event.preventDefault();
23105
23236
  event.stopPropagation();
@@ -23128,9 +23259,9 @@
23128
23259
  onSubmit: handleSubmit,
23129
23260
  onReset: handleReset,
23130
23261
  role: "search"
23131
- }, /*#__PURE__*/React__default.createElement("input", {
23262
+ }, /*#__PURE__*/React__default.createElement("input", _extends$1({}, inputProps, {
23132
23263
  ref: inputRef,
23133
- className: cx('ais-SearchBox-input', classNames.input),
23264
+ className: cx('ais-SearchBox-input', classNames.input, inputProps === null || inputProps === void 0 ? void 0 : inputProps.className),
23134
23265
  "aria-label": "Search",
23135
23266
  autoComplete: "off",
23136
23267
  autoCorrect: "off",
@@ -23143,7 +23274,7 @@
23143
23274
  onChange: onChange,
23144
23275
  onCompositionEnd: onChange,
23145
23276
  autoFocus: autoFocus
23146
- }), /*#__PURE__*/React__default.createElement("button", {
23277
+ })), /*#__PURE__*/React__default.createElement("button", {
23147
23278
  className: cx('ais-SearchBox-submit', classNames.submit),
23148
23279
  type: "submit",
23149
23280
  title: translations.submitButtonTitle
@@ -23164,7 +23295,7 @@
23164
23295
  }))));
23165
23296
  }
23166
23297
 
23167
- var _excluded$J = ["searchable", "searchablePlaceholder", "searchableSelectOnSubmit", "attribute", "operator", "limit", "showMore", "showMoreLimit", "sortBy", "escapeFacetValues", "transformItems", "translations"];
23298
+ var _excluded$K = ["searchable", "searchablePlaceholder", "searchableSelectOnSubmit", "attribute", "operator", "limit", "showMore", "showMoreLimit", "sortBy", "escapeFacetValues", "transformItems", "translations"];
23168
23299
  function RefinementList$2(_ref) {
23169
23300
  var searchable = _ref.searchable,
23170
23301
  searchablePlaceholder = _ref.searchablePlaceholder,
@@ -23179,7 +23310,7 @@
23179
23310
  escapeFacetValues = _ref.escapeFacetValues,
23180
23311
  transformItems = _ref.transformItems,
23181
23312
  translations = _ref.translations,
23182
- props = _objectWithoutProperties$c(_ref, _excluded$J);
23313
+ props = _objectWithoutProperties$c(_ref, _excluded$K);
23183
23314
  var _useRefinementList = useRefinementList({
23184
23315
  attribute: attribute,
23185
23316
  operator: operator,
@@ -23271,7 +23402,7 @@
23271
23402
  }));
23272
23403
  }
23273
23404
 
23274
- var _excluded$K = ["objectIDs", "limit", "threshold", "fallbackParameters", "queryParameters", "escapeHTML", "transformItems", "itemComponent", "headerComponent", "emptyComponent", "layoutComponent"];
23405
+ var _excluded$L = ["objectIDs", "limit", "threshold", "fallbackParameters", "queryParameters", "escapeHTML", "transformItems", "itemComponent", "headerComponent", "emptyComponent", "layoutComponent"];
23275
23406
  var RelatedProductsUiComponent = createRelatedProductsComponent({
23276
23407
  createElement: React.createElement,
23277
23408
  Fragment: React.Fragment
@@ -23288,7 +23419,7 @@
23288
23419
  headerComponent = _ref.headerComponent,
23289
23420
  emptyComponent = _ref.emptyComponent,
23290
23421
  layoutComponent = _ref.layoutComponent,
23291
- props = _objectWithoutProperties$c(_ref, _excluded$K);
23422
+ props = _objectWithoutProperties$c(_ref, _excluded$L);
23292
23423
  var _useInstantSearch = useInstantSearch(),
23293
23424
  status = _useInstantSearch.status;
23294
23425
  var _useRelatedProducts = useRelatedProducts({
@@ -23331,7 +23462,7 @@
23331
23462
  return /*#__PURE__*/React__default.createElement(RelatedProductsUiComponent, _extends$1({}, props, uiProps));
23332
23463
  }
23333
23464
 
23334
- var _excluded$L = ["queryHook", "searchAsYouType", "ignoreCompositionEvents", "translations"];
23465
+ var _excluded$M = ["queryHook", "searchAsYouType", "ignoreCompositionEvents", "translations"];
23335
23466
  function SearchBox$1(_ref) {
23336
23467
  var queryHook = _ref.queryHook,
23337
23468
  _ref$searchAsYouType = _ref.searchAsYouType,
@@ -23339,7 +23470,7 @@
23339
23470
  _ref$ignoreCompositio = _ref.ignoreCompositionEvents,
23340
23471
  ignoreCompositionEvents = _ref$ignoreCompositio === void 0 ? false : _ref$ignoreCompositio,
23341
23472
  translations = _ref.translations,
23342
- props = _objectWithoutProperties$c(_ref, _excluded$L);
23473
+ props = _objectWithoutProperties$c(_ref, _excluded$M);
23343
23474
  var _useSearchBox = useSearchBox({
23344
23475
  queryHook: queryHook
23345
23476
  }, {
@@ -23400,11 +23531,11 @@
23400
23531
  return /*#__PURE__*/React__default.createElement(SearchBox, _extends$1({}, props, uiProps));
23401
23532
  }
23402
23533
 
23403
- var _excluded$M = ["classNames"];
23534
+ var _excluded$N = ["classNames"];
23404
23535
  function Snippet(_ref) {
23405
23536
  var _ref$classNames = _ref.classNames,
23406
23537
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
23407
- props = _objectWithoutProperties$c(_ref, _excluded$M);
23538
+ props = _objectWithoutProperties$c(_ref, _excluded$N);
23408
23539
  return /*#__PURE__*/React__default.createElement(InternalHighlight, _extends$1({
23409
23540
  classNames: {
23410
23541
  root: cx('ais-Snippet', classNames.root),
@@ -23415,14 +23546,14 @@
23415
23546
  }, props));
23416
23547
  }
23417
23548
 
23418
- var _excluded$N = ["hit", "attribute", "highlightedTagName", "nonHighlightedTagName", "separator"];
23549
+ var _excluded$O = ["hit", "attribute", "highlightedTagName", "nonHighlightedTagName", "separator"];
23419
23550
  function Snippet$1(_ref) {
23420
23551
  var hit = _ref.hit,
23421
23552
  attribute = _ref.attribute,
23422
23553
  highlightedTagName = _ref.highlightedTagName,
23423
23554
  nonHighlightedTagName = _ref.nonHighlightedTagName,
23424
23555
  separator = _ref.separator,
23425
- props = _objectWithoutProperties$c(_ref, _excluded$N);
23556
+ props = _objectWithoutProperties$c(_ref, _excluded$O);
23426
23557
  var property = getPropertyByPath(hit._snippetResult, attribute) || [];
23427
23558
  var properties = Array.isArray(property) ? property : [property];
23428
23559
  var parts = properties.map(function (singleValue) {
@@ -23436,7 +23567,7 @@
23436
23567
  }));
23437
23568
  }
23438
23569
 
23439
- var _excluded$O = ["items", "value", "onChange", "classNames"];
23570
+ var _excluded$P = ["items", "value", "onChange", "classNames"];
23440
23571
  function SortBy(_ref) {
23441
23572
  var items = _ref.items,
23442
23573
  value = _ref.value,
@@ -23444,7 +23575,7 @@
23444
23575
  _onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
23445
23576
  _ref$classNames = _ref.classNames,
23446
23577
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
23447
- props = _objectWithoutProperties$c(_ref, _excluded$O);
23578
+ props = _objectWithoutProperties$c(_ref, _excluded$P);
23448
23579
  return /*#__PURE__*/React__default.createElement("div", _extends$1({}, props, {
23449
23580
  className: cx('ais-SortBy', classNames.root, props.className)
23450
23581
  }), /*#__PURE__*/React__default.createElement("select", {
@@ -23463,11 +23594,11 @@
23463
23594
  })));
23464
23595
  }
23465
23596
 
23466
- var _excluded$P = ["items", "transformItems"];
23597
+ var _excluded$Q = ["items", "transformItems"];
23467
23598
  function SortBy$1(_ref) {
23468
23599
  var items = _ref.items,
23469
23600
  transformItems = _ref.transformItems,
23470
- props = _objectWithoutProperties$c(_ref, _excluded$P);
23601
+ props = _objectWithoutProperties$c(_ref, _excluded$Q);
23471
23602
  var _useSortBy = useSortBy({
23472
23603
  items: items,
23473
23604
  transformItems: transformItems
@@ -23485,7 +23616,7 @@
23485
23616
  return /*#__PURE__*/React__default.createElement(SortBy, _extends$1({}, props, uiProps));
23486
23617
  }
23487
23618
 
23488
- var _excluded$Q = ["classNames", "nbHits", "processingTimeMS", "nbSortedHits", "areHitsSorted", "translations"];
23619
+ var _excluded$R = ["classNames", "nbHits", "processingTimeMS", "nbSortedHits", "areHitsSorted", "translations"];
23489
23620
  function Stats(_ref) {
23490
23621
  var _ref$classNames = _ref.classNames,
23491
23622
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
@@ -23494,7 +23625,7 @@
23494
23625
  nbSortedHits = _ref.nbSortedHits,
23495
23626
  areHitsSorted = _ref.areHitsSorted,
23496
23627
  translations = _ref.translations,
23497
- props = _objectWithoutProperties$c(_ref, _excluded$Q);
23628
+ props = _objectWithoutProperties$c(_ref, _excluded$R);
23498
23629
  var translationOptions = {
23499
23630
  nbHits: nbHits,
23500
23631
  processingTimeMS: processingTimeMS,
@@ -23508,10 +23639,10 @@
23508
23639
  }, translations.rootElementText(translationOptions)));
23509
23640
  }
23510
23641
 
23511
- var _excluded$R = ["translations"];
23642
+ var _excluded$S = ["translations"];
23512
23643
  function Stats$1(_ref) {
23513
23644
  var translations = _ref.translations,
23514
- props = _objectWithoutProperties$c(_ref, _excluded$R);
23645
+ props = _objectWithoutProperties$c(_ref, _excluded$S);
23515
23646
  var _useStats = useStats(undefined, {
23516
23647
  $$widgetType: 'ais.stats'
23517
23648
  }),
@@ -23561,14 +23692,14 @@
23561
23692
  return '';
23562
23693
  }
23563
23694
 
23564
- var _excluded$S = ["classNames", "checked", "onChange", "label"];
23695
+ var _excluded$T = ["classNames", "checked", "onChange", "label"];
23565
23696
  function ToggleRefinement(_ref) {
23566
23697
  var _ref$classNames = _ref.classNames,
23567
23698
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
23568
23699
  checked = _ref.checked,
23569
23700
  _onChange = _ref.onChange,
23570
23701
  label = _ref.label,
23571
- props = _objectWithoutProperties$c(_ref, _excluded$S);
23702
+ props = _objectWithoutProperties$c(_ref, _excluded$T);
23572
23703
  return /*#__PURE__*/React__default.createElement("div", _extends$1({}, props, {
23573
23704
  className: cx('ais-ToggleRefinement', classNames.root, props.className)
23574
23705
  }), /*#__PURE__*/React__default.createElement("label", {
@@ -23585,12 +23716,12 @@
23585
23716
  }, label)));
23586
23717
  }
23587
23718
 
23588
- var _excluded$T = ["attribute", "on", "off"];
23719
+ var _excluded$U = ["attribute", "on", "off"];
23589
23720
  function ToggleRefinement$1(_ref) {
23590
23721
  var attribute = _ref.attribute,
23591
23722
  on = _ref.on,
23592
23723
  off = _ref.off,
23593
- props = _objectWithoutProperties$c(_ref, _excluded$T);
23724
+ props = _objectWithoutProperties$c(_ref, _excluded$U);
23594
23725
  var _useToggleRefinement = useToggleRefinement({
23595
23726
  attribute: attribute,
23596
23727
  on: on,
@@ -23613,7 +23744,7 @@
23613
23744
  }, props, uiProps));
23614
23745
  }
23615
23746
 
23616
- var _excluded$U = ["facetName", "facetValue", "limit", "threshold", "fallbackParameters", "queryParameters", "escapeHTML", "transformItems", "itemComponent", "headerComponent", "emptyComponent", "layoutComponent"];
23747
+ var _excluded$V = ["facetName", "facetValue", "limit", "threshold", "fallbackParameters", "queryParameters", "escapeHTML", "transformItems", "itemComponent", "headerComponent", "emptyComponent", "layoutComponent"];
23617
23748
  var TrendingItemsUiComponent = createTrendingItemsComponent({
23618
23749
  createElement: React.createElement,
23619
23750
  Fragment: React.Fragment
@@ -23631,7 +23762,7 @@
23631
23762
  headerComponent = _ref.headerComponent,
23632
23763
  emptyComponent = _ref.emptyComponent,
23633
23764
  layoutComponent = _ref.layoutComponent,
23634
- props = _objectWithoutProperties$c(_ref, _excluded$U);
23765
+ props = _objectWithoutProperties$c(_ref, _excluded$V);
23635
23766
  var facetParameters = facetName && facetValue ? {
23636
23767
  facetName: facetName,
23637
23768
  facetValue: facetValue
@@ -23677,82 +23808,42 @@
23677
23808
  return /*#__PURE__*/React__default.createElement(TrendingItemsUiComponent, _extends$1({}, props, uiProps));
23678
23809
  }
23679
23810
 
23680
- var _excluded$V = ["objectIDs", "limit", "threshold", "queryParameters", "fallbackParameters", "escapeHTML", "transformItems", "itemComponent", "headerComponent", "emptyComponent", "layoutComponent"];
23681
- var LookingSimilarUiComponent = createLookingSimilarComponent({
23682
- createElement: React.createElement,
23683
- Fragment: React.Fragment
23684
- });
23685
- function LookingSimilar(_ref) {
23686
- var objectIDs = _ref.objectIDs,
23687
- limit = _ref.limit,
23688
- threshold = _ref.threshold,
23689
- queryParameters = _ref.queryParameters,
23690
- fallbackParameters = _ref.fallbackParameters,
23691
- escapeHTML = _ref.escapeHTML,
23692
- transformItems = _ref.transformItems,
23693
- itemComponent = _ref.itemComponent,
23694
- headerComponent = _ref.headerComponent,
23695
- emptyComponent = _ref.emptyComponent,
23696
- layoutComponent = _ref.layoutComponent,
23697
- props = _objectWithoutProperties$c(_ref, _excluded$V);
23698
- var _useInstantSearch = useInstantSearch(),
23699
- status = _useInstantSearch.status;
23700
- var _useLookingSimilar = useLookingSimilar({
23701
- objectIDs: objectIDs,
23702
- limit: limit,
23703
- threshold: threshold,
23704
- queryParameters: queryParameters,
23705
- fallbackParameters: fallbackParameters,
23706
- escapeHTML: escapeHTML,
23707
- transformItems: transformItems
23708
- }, {
23709
- $$widgetType: 'ais.lookingSimilar'
23710
- }),
23711
- items = _useLookingSimilar.items,
23712
- sendEvent = _useLookingSimilar.sendEvent;
23713
- var layout = layoutComponent ? function (layoutProps) {
23714
- return layoutComponent(_objectSpread2(_objectSpread2({}, layoutProps), {}, {
23715
- classNames: {
23716
- list: layoutProps.classNames.list,
23717
- item: layoutProps.classNames.item
23718
- }
23719
- }));
23720
- } : undefined;
23721
- var _itemComponent = React.useMemo(function () {
23722
- return itemComponent ? function (itemProps) {
23723
- return itemComponent(_objectSpread2(_objectSpread2({}, itemProps), {}, {
23724
- sendEvent: sendEvent
23725
- }));
23726
- } : undefined;
23727
- }, [itemComponent, sendEvent]);
23728
- var uiProps = {
23729
- items: items,
23730
- itemComponent: _itemComponent,
23731
- headerComponent: headerComponent,
23732
- emptyComponent: emptyComponent,
23733
- layout: layout,
23734
- status: status,
23735
- sendEvent: sendEvent
23736
- };
23737
- return /*#__PURE__*/React__default.createElement(LookingSimilarUiComponent, _extends$1({}, props, uiProps));
23738
- }
23811
+ var Chat = function Chat() {
23812
+ throw new Error("\"<Chat>\" is not available from the UMD build.\n\nPlease use React InstantSearch with a packaging system:\nhttps://www.algolia.com/doc/guides/building-search-ui/installation/react/#install-react-instantsearch-as-an-npm-package");
23813
+ };
23814
+ var SearchIndexToolType = undefined;
23815
+ var RecommendToolType = undefined;
23816
+ var createDefaultTools = function createDefaultTools() {};
23739
23817
 
23740
23818
  var CarouselUiComponent = createCarouselComponent({
23741
23819
  createElement: React.createElement,
23742
23820
  Fragment: React.Fragment
23743
23821
  });
23744
23822
  function Carousel(props) {
23823
+ var _useState = React.useState(false),
23824
+ _useState2 = _slicedToArray$g(_useState, 2),
23825
+ canScrollLeft = _useState2[0],
23826
+ setCanScrollLeft = _useState2[1];
23827
+ var _useState3 = React.useState(true),
23828
+ _useState4 = _slicedToArray$g(_useState3, 2),
23829
+ canScrollRight = _useState4[0],
23830
+ setCanScrollRight = _useState4[1];
23745
23831
  var carouselRefs = {
23746
23832
  listRef: React.useRef(null),
23747
23833
  nextButtonRef: React.useRef(null),
23748
23834
  previousButtonRef: React.useRef(null),
23749
- carouselIdRef: React.useRef(generateCarouselId())
23835
+ carouselIdRef: React.useRef(generateCarouselId()),
23836
+ canScrollLeft: canScrollLeft,
23837
+ canScrollRight: canScrollRight,
23838
+ setCanScrollLeft: setCanScrollLeft,
23839
+ setCanScrollRight: setCanScrollRight
23750
23840
  };
23751
23841
  return /*#__PURE__*/React__default.createElement(CarouselUiComponent, _extends$1({}, carouselRefs, props));
23752
23842
  }
23753
23843
 
23754
23844
  exports.Breadcrumb = Breadcrumb$1;
23755
23845
  exports.Carousel = Carousel;
23846
+ exports.Chat = Chat;
23756
23847
  exports.ClearRefinements = ClearRefinements$1;
23757
23848
  exports.Configure = Configure;
23758
23849
  exports.CurrentRefinements = CurrentRefinements$1;
@@ -23774,16 +23865,20 @@
23774
23865
  exports.Pagination = Pagination$1;
23775
23866
  exports.PoweredBy = PoweredBy$1;
23776
23867
  exports.RangeInput = RangeInput$1;
23868
+ exports.RecommendToolType = RecommendToolType;
23777
23869
  exports.RefinementList = RefinementList$2;
23778
23870
  exports.RelatedProducts = RelatedProducts;
23779
23871
  exports.SearchBox = SearchBox$1;
23872
+ exports.SearchIndexToolType = SearchIndexToolType;
23780
23873
  exports.Snippet = Snippet$1;
23781
23874
  exports.SortBy = SortBy$1;
23782
23875
  exports.Stats = Stats$1;
23783
23876
  exports.ToggleRefinement = ToggleRefinement$1;
23784
23877
  exports.TrendingItems = TrendingItems;
23878
+ exports.createDefaultTools = createDefaultTools;
23785
23879
  exports.getServerState = getServerState;
23786
23880
  exports.useBreadcrumb = useBreadcrumb;
23881
+ exports.useChat = useChat;
23787
23882
  exports.useClearRefinements = useClearRefinements;
23788
23883
  exports.useConfigure = useConfigure;
23789
23884
  exports.useConnector = useConnector;