react-instantsearch 7.0.2 → 7.1.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
2
2
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3
- **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
3
+
4
4
 
5
5
  - [react-instantsearch](#react-instantsearch)
6
6
  - [Why](#why)
@@ -17,15 +17,15 @@
17
17
 
18
18
  React InstantSearch is an open-source React library that lets you create an instant search result experience using [Algolia][algolia-website]’s search API. It is part of the InstantSearch family:
19
19
 
20
- **React InstantSearch** | [InstantSearch.js][instantsearch.js-github] | [Angular InstantSearch][instantsearch-angular-github] | [Vue InstantSearch][instantsearch-vue-github] | [InstantSearch Android][instantsearch-android-github] | [InstantSearch iOS][instantsearch-ios-github]
20
+ **React InstantSearch** | [InstantSearch.js][instantsearch-github] | [Angular InstantSearch][instantsearch-angular-github] | [Vue InstantSearch][instantsearch-github] | [InstantSearch Android][instantsearch-android-github] | [InstantSearch iOS][instantsearch-ios-github]
21
21
 
22
22
  ## Why
23
23
 
24
24
  You should be using React InstantSearch if you want to:
25
25
 
26
- * Design search experiences with best practices
27
- * Customize your components at will
28
- * Follow React principles
26
+ - Design search experiences with best practices
27
+ - Customize your components at will
28
+ - Follow React principles
29
29
 
30
30
  Note: If you are working with React Native, or otherwise do not use the DOM, check out `react-instantsearch-core` instead.
31
31
 
@@ -55,10 +55,7 @@ const searchClient = algoliasearch(
55
55
  );
56
56
 
57
57
  const App = () => (
58
- <InstantSearch
59
- indexName="bestbuy"
60
- searchClient={searchClient}
61
- >
58
+ <InstantSearch indexName="bestbuy" searchClient={searchClient}>
62
59
  <SearchBox />
63
60
  <Hits />
64
61
  </InstantSearch>
@@ -66,7 +63,7 @@ const App = () => (
66
63
  ```
67
64
 
68
65
  <p align="center">
69
- <a href="https://codesandbox.io/s/github/algolia/instantsearch.js/tree/master/examples/react/default-theme" title="Edit on CodeSandbox">
66
+ <a href="https://codesandbox.io/s/github/algolia/instantsearch/tree/master/examples/react/default-theme" title="Edit on CodeSandbox">
70
67
  <img alt="Edit on CodeSandbox" src="https://codesandbox.io/static/img/play-codesandbox.svg">
71
68
  </a>
72
69
  </p>
@@ -98,7 +95,7 @@ To start contributing to code, you need to:
98
95
  1. [Clone the repository](https://help.github.com/articles/cloning-a-repository/)
99
96
  1. Install the dependencies: `yarn`
100
97
 
101
- Please read [our contribution process](https://github.com/algolia/instantsearch.js/blob/master/CONTRIBUTING.md) to learn more.
98
+ Please read [our contribution process](https://github.com/algolia/instantsearch/blob/master/CONTRIBUTING.md) to learn more.
102
99
 
103
100
  ## License
104
101
 
@@ -111,14 +108,13 @@ React InstantSearch is [MIT licensed](../../LICENSE).
111
108
  [doc-guides]: https://www.algolia.com/doc/guides/building-search-ui/going-further/server-side-rendering/react/
112
109
  [doc-playground]: https://codesandbox.io/s/github/algolia/instantsearch/tree/master/examples/react/default-theme
113
110
  [algolia-website]: https://www.algolia.com/
114
- [instantsearch.js-github]: https://github.com/algolia/instantsearch.js
111
+ [instantsearch-github]: https://github.com/algolia/instantsearch
115
112
  [instantsearch-android-github]: https://github.com/algolia/instantsearch-android
116
113
  [instantsearch-ios-github]: https://github.com/algolia/instantsearch-ios
117
- [instantsearch-vue-github]: https://github.com/algolia/vue-instantsearch
118
114
  [instantsearch-angular-github]: https://github.com/algolia/angular-instantsearch
119
- [contributing-bugreport]: https://github.com/algolia/instantsearch.js/issues/new?template=BUG_REPORT.yml&labels=triage,Library%3A%20React+InstantSearch
120
- [contributing-featurerequest]: https://github.com/algolia/instantsearch.js/discussions/new?category=ideas&labels=triage,Library%3A%20React+InstantSearch&title=Feature%20request%3A%20
121
- [contributing-newissue]: https://github.com/algolia/instantsearch.js/issues/new?labels=triage,Library%3A%20React+InstantSearch
122
- [contributing-label-easy]: https://github.com/algolia/instantsearch.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22Difficulty%3A+Easy%22+label%3A%22Library%3A%20React+InstantSearch%22
123
- [contributing-label-bug]: https://github.com/algolia/instantsearch.js/issues?q=is%3Aissue+is%3Aopen+label%3A%22Type%3A+Bug%22+label%3A%22Library%3A%20React+InstantSearch%22
124
- [contributing-label-chore]: https://github.com/algolia/instantsearch.js/issues?q=is%3Aissue+is%3Aopen+label%3A%22Type%3A+Chore%22+label%3A%22Library%3A%20React+InstantSearch%22
115
+ [contributing-bugreport]: https://github.com/algolia/instantsearch/issues/new?template=BUG_REPORT.yml&labels=triage,Library%3A%20React+InstantSearch
116
+ [contributing-featurerequest]: https://github.com/algolia/instantsearch/discussions/new?category=ideas&labels=triage,Library%3A%20React+InstantSearch&title=Feature%20request%3A%20
117
+ [contributing-newissue]: https://github.com/algolia/instantsearch/issues/new?labels=triage,Library%3A%20React+InstantSearch
118
+ [contributing-label-easy]: https://github.com/algolia/instantsearch/issues?q=is%3Aopen+is%3Aissue+label%3A%22Difficulty%3A+Easy%22+label%3A%22Library%3A%20React+InstantSearch%22
119
+ [contributing-label-bug]: https://github.com/algolia/instantsearch/issues?q=is%3Aissue+is%3Aopen+label%3A%22Type%3A+Bug%22+label%3A%22Library%3A%20React+InstantSearch%22
120
+ [contributing-label-chore]: https://github.com/algolia/instantsearch/issues?q=is%3Aissue+is%3Aopen+label%3A%22Type%3A+Chore%22+label%3A%22Library%3A%20React+InstantSearch%22
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.CurrentRefinements = CurrentRefinements;
7
7
  var _react = _interopRequireDefault(require("react"));
8
- var _cx = require("./lib/cx");
9
- var _isModifierClick = require("./lib/isModifierClick");
8
+ var _lib = require("./lib");
10
9
  var _excluded = ["classNames", "items", "onRemove", "hasRefinements"];
11
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
11
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -23,30 +22,31 @@ function CurrentRefinements(_ref) {
23
22
  hasRefinements = _ref$hasRefinements === void 0 ? false : _ref$hasRefinements,
24
23
  props = _objectWithoutProperties(_ref, _excluded);
25
24
  return /*#__PURE__*/_react.default.createElement("div", _extends({}, props, {
26
- className: (0, _cx.cx)('ais-CurrentRefinements', classNames.root, !hasRefinements && (0, _cx.cx)('ais-CurrentRefinements--noRefinement', classNames.noRefinementRoot), props.className)
25
+ className: (0, _lib.cx)('ais-CurrentRefinements', classNames.root, !hasRefinements && (0, _lib.cx)('ais-CurrentRefinements--noRefinement', classNames.noRefinementRoot), props.className)
27
26
  }), /*#__PURE__*/_react.default.createElement("ul", {
28
- className: (0, _cx.cx)('ais-CurrentRefinements-list', classNames.list, !hasRefinements && (0, _cx.cx)('ais-CurrentRefinements-list--noRefinement', classNames.noRefinementList))
27
+ className: (0, _lib.cx)('ais-CurrentRefinements-list', classNames.list, /* @MAJOR remove to ensure conformity with InstantSearch.css specs */
28
+ !hasRefinements && (0, _lib.cx)('ais-CurrentRefinements-list--noRefinement', classNames.noRefinementList))
29
29
  }, items.map(function (item) {
30
30
  return /*#__PURE__*/_react.default.createElement("li", {
31
31
  key: [item.indexName, item.label].join('/'),
32
- className: (0, _cx.cx)('ais-CurrentRefinements-item', classNames.item)
32
+ className: (0, _lib.cx)('ais-CurrentRefinements-item', classNames.item)
33
33
  }, /*#__PURE__*/_react.default.createElement("span", {
34
- className: (0, _cx.cx)('ais-CurrentRefinements-label', classNames.label)
35
- }, item.label, ":"), item.refinements.map(function (refinement) {
34
+ className: (0, _lib.cx)('ais-CurrentRefinements-label', classNames.label)
35
+ }, (0, _lib.capitalize)(item.label), ":", ' '), item.refinements.map(function (refinement) {
36
36
  return /*#__PURE__*/_react.default.createElement("span", {
37
37
  key: refinement.label,
38
- className: (0, _cx.cx)('ais-CurrentRefinements-category', classNames.category)
38
+ className: (0, _lib.cx)('ais-CurrentRefinements-category', classNames.category)
39
39
  }, /*#__PURE__*/_react.default.createElement("span", {
40
- className: (0, _cx.cx)('ais-CurrentRefinements-categoryLabel', classNames.categoryLabel)
40
+ className: (0, _lib.cx)('ais-CurrentRefinements-categoryLabel', classNames.categoryLabel)
41
41
  }, refinement.label), /*#__PURE__*/_react.default.createElement("button", {
42
42
  type: "button",
43
43
  onClick: function onClick(event) {
44
- if ((0, _isModifierClick.isModifierClick)(event)) {
44
+ if ((0, _lib.isModifierClick)(event)) {
45
45
  return;
46
46
  }
47
47
  onRemove(refinement);
48
48
  },
49
- className: (0, _cx.cx)('ais-CurrentRefinements-delete', classNames.delete)
49
+ className: (0, _lib.cx)('ais-CurrentRefinements-delete', classNames.delete)
50
50
  }, "\u2715"));
51
51
  }));
52
52
  })));
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.capitalize = capitalize;
7
+ function capitalize(text) {
8
+ return text.toString().charAt(0).toUpperCase() + text.toString().slice(1);
9
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _capitalize = require("./capitalize");
7
+ Object.keys(_capitalize).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _capitalize[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _capitalize[key];
14
+ }
15
+ });
16
+ });
17
+ var _cx = require("./cx");
18
+ Object.keys(_cx).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _cx[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _cx[key];
25
+ }
26
+ });
27
+ });
28
+ var _isModifierClick = require("./isModifierClick");
29
+ Object.keys(_isModifierClick).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _isModifierClick[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _isModifierClick[key];
36
+ }
37
+ });
38
+ });
@@ -3,8 +3,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import React from 'react';
6
- import { cx } from "./lib/cx.js";
7
- import { isModifierClick } from "./lib/isModifierClick.js";
6
+ import { capitalize, cx, isModifierClick } from "./lib/index.js";
8
7
  export function CurrentRefinements(_ref) {
9
8
  var _ref$classNames = _ref.classNames,
10
9
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
@@ -18,14 +17,15 @@ export function CurrentRefinements(_ref) {
18
17
  return /*#__PURE__*/React.createElement("div", _extends({}, props, {
19
18
  className: cx('ais-CurrentRefinements', classNames.root, !hasRefinements && cx('ais-CurrentRefinements--noRefinement', classNames.noRefinementRoot), props.className)
20
19
  }), /*#__PURE__*/React.createElement("ul", {
21
- className: cx('ais-CurrentRefinements-list', classNames.list, !hasRefinements && cx('ais-CurrentRefinements-list--noRefinement', classNames.noRefinementList))
20
+ className: cx('ais-CurrentRefinements-list', classNames.list, /* @MAJOR remove to ensure conformity with InstantSearch.css specs */
21
+ !hasRefinements && cx('ais-CurrentRefinements-list--noRefinement', classNames.noRefinementList))
22
22
  }, items.map(function (item) {
23
23
  return /*#__PURE__*/React.createElement("li", {
24
24
  key: [item.indexName, item.label].join('/'),
25
25
  className: cx('ais-CurrentRefinements-item', classNames.item)
26
26
  }, /*#__PURE__*/React.createElement("span", {
27
27
  className: cx('ais-CurrentRefinements-label', classNames.label)
28
- }, item.label, ":"), item.refinements.map(function (refinement) {
28
+ }, capitalize(item.label), ":", ' '), item.refinements.map(function (refinement) {
29
29
  return /*#__PURE__*/React.createElement("span", {
30
30
  key: refinement.label,
31
31
  className: cx('ais-CurrentRefinements-category', classNames.category)
@@ -0,0 +1 @@
1
+ export declare function capitalize(text: string): string;
@@ -0,0 +1,3 @@
1
+ export function capitalize(text) {
2
+ return text.toString().charAt(0).toUpperCase() + text.toString().slice(1);
3
+ }
@@ -0,0 +1,3 @@
1
+ export * from './capitalize';
2
+ export * from './cx';
3
+ export * from './isModifierClick';
@@ -0,0 +1,3 @@
1
+ export * from "./capitalize.js";
2
+ export * from "./cx.js";
3
+ export * from "./isModifierClick.js";
@@ -1,4 +1,4 @@
1
- /*! React InstantSearch UNRELEASED | © Algolia, inc. | https://github.com/algolia/instantsearch.js */
1
+ /*! React InstantSearch UNRELEASED | © Algolia, inc. | https://github.com/algolia/instantsearch */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
@@ -7,7 +7,7 @@
7
7
 
8
8
  var React__default = 'default' in React ? React['default'] : React;
9
9
 
10
- var version = '7.0.2';
10
+ var version = '7.1.0';
11
11
 
12
12
  // Copyright Joyent, Inc. and other Node contributors.
13
13
  //
@@ -4327,7 +4327,7 @@
4327
4327
 
4328
4328
  var SearchResults_1 = SearchResults;
4329
4329
 
4330
- var version$1 = '3.14.0';
4330
+ var version$1 = '3.14.2';
4331
4331
 
4332
4332
  var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
4333
4333
 
@@ -8238,6 +8238,11 @@
8238
8238
  return stableValue;
8239
8239
  }
8240
8240
 
8241
+ var useKey = 'use';
8242
+
8243
+ // @TODO: Remove this file and import directly from React when available.
8244
+ var use = React[useKey];
8245
+
8241
8246
  /**
8242
8247
  * `useLayoutEffect` that doesn't show a warning when server-side rendering.
8243
8248
  *
@@ -8245,11 +8250,19 @@
8245
8250
  */
8246
8251
  var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
8247
8252
 
8253
+ var InstantSearchRSCContext = /*#__PURE__*/React.createContext(null);
8254
+
8255
+ function useRSCContext() {
8256
+ return React.useContext(InstantSearchRSCContext);
8257
+ }
8258
+
8248
8259
  function useWidget(_ref) {
8260
+ var _waitingForResultsRef;
8249
8261
  var widget = _ref.widget,
8250
8262
  parentIndex = _ref.parentIndex,
8251
8263
  props = _ref.props,
8252
8264
  shouldSsr = _ref.shouldSsr;
8265
+ var waitingForResultsRef = useRSCContext();
8253
8266
  var prevPropsRef = React.useRef(props);
8254
8267
  React.useEffect(function () {
8255
8268
  prevPropsRef.current = props;
@@ -8309,9 +8322,20 @@
8309
8322
  });
8310
8323
  };
8311
8324
  }, [parentIndex, widget, shouldAddWidgetEarly, search, props]);
8312
- if (shouldAddWidgetEarly) {
8325
+ if (shouldAddWidgetEarly || (waitingForResultsRef === null || waitingForResultsRef === void 0 ? void 0 : (_waitingForResultsRef = waitingForResultsRef.current) === null || _waitingForResultsRef === void 0 ? void 0 : _waitingForResultsRef.status) === 'pending') {
8313
8326
  parentIndex.addWidgets([widget]);
8314
8327
  }
8328
+ if (typeof window === 'undefined' && waitingForResultsRef !== null && waitingForResultsRef !== void 0 && waitingForResultsRef.current &&
8329
+ // We need the widgets contained in the index to be added before we trigger the search request.
8330
+ widget.$$type !== 'ais.index') {
8331
+ var _search$helper;
8332
+ use(waitingForResultsRef.current);
8333
+ // If we made a second request because of DynamicWidgets, we need to wait for the second result,
8334
+ // except for DynamicWidgets itself which needs to render its children after the first result.
8335
+ if (widget.$$type !== 'ais.dynamicWidgets' && (_search$helper = search.helper) !== null && _search$helper !== void 0 && _search$helper.lastResults) {
8336
+ use(waitingForResultsRef.current);
8337
+ }
8338
+ }
8315
8339
  }
8316
8340
 
8317
8341
  function _typeof$b(obj) {
@@ -8522,7 +8546,7 @@
8522
8546
 
8523
8547
  // We get the widget render state by providing the same parameters as
8524
8548
  // InstantSearch provides to the widget's `render` method.
8525
- // See https://github.com/algolia/instantsearch.js/blob/019cd18d0de6dd320284aa4890541b7fe2198c65/src/widgets/index/index.ts#L604-L617
8549
+ // See https://github.com/algolia/instantsearch/blob/019cd18d0de6dd320284aa4890541b7fe2198c65/src/widgets/index/index.ts#L604-L617
8526
8550
  var _widget$getWidgetRend = widget.getWidgetRenderState({
8527
8551
  helper: helper,
8528
8552
  parent: parentIndex,
@@ -9369,7 +9393,7 @@
9369
9393
  // configuration step. This is mainly for backward compatibility with custom
9370
9394
  // widgets. When the subscription happens before the `init` step, the (static)
9371
9395
  // configuration of the widget is pushed in the URL. That's what we want to avoid.
9372
- // https://github.com/algolia/instantsearch.js/pull/994/commits/4a672ae3fd78809e213de0368549ef12e9dc9454
9396
+ // https://github.com/algolia/instantsearch/pull/994/commits/4a672ae3fd78809e213de0368549ef12e9dc9454
9373
9397
  helper.on('change', function (event) {
9374
9398
  var state = event.state;
9375
9399
  var _uiState = event._uiState;
@@ -11271,7 +11295,7 @@
11271
11295
  *
11272
11296
  * It always generates the full URL, not a relative one.
11273
11297
  * This allows to handle cases like using a <base href>.
11274
- * See: https://github.com/algolia/instantsearch.js/issues/790
11298
+ * See: https://github.com/algolia/instantsearch/issues/790
11275
11299
  */
11276
11300
  }, {
11277
11301
  key: "createURL",
@@ -11760,7 +11784,7 @@
11760
11784
  };
11761
11785
  }
11762
11786
 
11763
- var version$3 = '4.56.10';
11787
+ var version$3 = '4.57.0';
11764
11788
 
11765
11789
  function _typeof$n(obj) {
11766
11790
  "@babel/helpers - typeof";
@@ -12350,7 +12374,7 @@
12350
12374
  /**
12351
12375
  * Removes all widgets without triggering a search afterwards. This is an **EXPERIMENTAL** feature,
12352
12376
  * if you find an issue with it, please
12353
- * [open an issue](https://github.com/algolia/instantsearch.js/issues/new?title=Problem%20with%20dispose).
12377
+ * [open an issue](https://github.com/algolia/instantsearch/issues/new?title=Problem%20with%20dispose).
12354
12378
  * @return {undefined} This method does not return anything
12355
12379
  */
12356
12380
  }, {
@@ -12486,8 +12510,10 @@
12486
12510
  var forceUpdate = useForceUpdate();
12487
12511
  var serverContext = useInstantSearchServerContext();
12488
12512
  var serverState = useInstantSearchSSRContext();
12513
+ var waitingForResultsRef = useRSCContext();
12489
12514
  var initialResults = serverState === null || serverState === void 0 ? void 0 : serverState.initialResults;
12490
12515
  var prevPropsRef = React.useRef(props);
12516
+ var shouldRenderAtOnce = serverContext || initialResults || waitingForResultsRef;
12491
12517
  var searchRef = React.useRef(null);
12492
12518
  // As we need to render on mount with SSR, using the local ref above in `StrictMode` will
12493
12519
  // create and start two instances of InstantSearch. To avoid this, we instead discard it and use
@@ -12498,7 +12524,7 @@
12498
12524
  if (searchRef.current === null) {
12499
12525
  // We don't use the `instantsearch()` function because it comes with other
12500
12526
  // top-level APIs that we don't need.
12501
- // See https://github.com/algolia/instantsearch.js/blob/5b529f43d8acc680f85837eaaa41f7fd03a3f833/src/index.es.ts#L63-L86
12527
+ // See https://github.com/algolia/instantsearch/blob/5b529f43d8acc680f85837eaaa41f7fd03a3f833/src/index.es.ts#L63-L86
12502
12528
  var search = new InstantSearch(props);
12503
12529
  search._schedule = function _schedule(cb) {
12504
12530
  search._schedule.queue.push(cb);
@@ -12511,7 +12537,7 @@
12511
12537
  }, 0);
12512
12538
  };
12513
12539
  search._schedule.queue = [];
12514
- if (serverContext || initialResults) {
12540
+ if (shouldRenderAtOnce) {
12515
12541
  // InstantSearch.js has a private Initial Results API that lets us inject
12516
12542
  // results on the search instance.
12517
12543
  // On the server, we default the initial results to an empty object so that
@@ -12525,7 +12551,7 @@
12525
12551
  // On the server, we start the search early to compute the search parameters.
12526
12552
  // On SSR, we start the search early to directly catch up with the lifecycle
12527
12553
  // and render.
12528
- if (serverContext || initialResults) {
12554
+ if (shouldRenderAtOnce) {
12529
12555
  search.start();
12530
12556
  }
12531
12557
  if (serverContext) {
@@ -12639,8 +12665,8 @@
12639
12665
  * which is either `nodejs` or `edge`.
12640
12666
  */
12641
12667
  function getNextVersion() {
12642
- var _next, _process$env;
12643
- return typeof window !== 'undefined' && ((_next = window.next) === null || _next === void 0 ? void 0 : _next.version) || (typeof process !== 'undefined' ? (_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.NEXT_RUNTIME : undefined);
12668
+ var _next2, _process$env;
12669
+ return typeof window !== 'undefined' && ((_next2 = window.next) === null || _next2 === void 0 ? void 0 : _next2.version) || (typeof process !== 'undefined' ? (_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.NEXT_RUNTIME : undefined);
12644
12670
  }
12645
12671
 
12646
12672
  var _excluded$6 = ["children"];
@@ -17865,7 +17891,7 @@
17865
17891
 
17866
17892
  // Results can be `null` when the first search is stalled.
17867
17893
  // In this case, we skip the update.
17868
- // See: https://github.com/algolia/instantsearch.js/blob/20996c7a159988c58e00ff24d2d2dc98af8b980f/src/widgets/index/index.ts#L652-L657
17894
+ // See: https://github.com/algolia/instantsearch/blob/20996c7a159988c58e00ff24d2d2dc98af8b980f/src/widgets/index/index.ts#L652-L657
17869
17895
  if (results !== null) {
17870
17896
  setSearchResults({
17871
17897
  results: results,
@@ -18012,6 +18038,33 @@
18012
18038
  };
18013
18039
  }
18014
18040
 
18041
+ // This is needed in order to work with RSC Suspense, perhaps they will later provide a wrapper.
18042
+
18043
+ function isStatefulPromise(promise) {
18044
+ return 'status' in promise;
18045
+ }
18046
+ function wrapPromiseWithState(promise) {
18047
+ if (isStatefulPromise(promise)) {
18048
+ return promise;
18049
+ }
18050
+ var pendingPromise = promise;
18051
+ pendingPromise.status = 'pending';
18052
+ pendingPromise.then(function (value) {
18053
+ if (pendingPromise.status === 'pending') {
18054
+ var fulfilledPromise = pendingPromise;
18055
+ fulfilledPromise.status = 'fulfilled';
18056
+ fulfilledPromise.value = value;
18057
+ }
18058
+ }, function (reason) {
18059
+ if (pendingPromise.status === 'pending') {
18060
+ var rejectedPromise = pendingPromise;
18061
+ rejectedPromise.status = 'rejected';
18062
+ rejectedPromise.reason = reason;
18063
+ }
18064
+ });
18065
+ return promise;
18066
+ }
18067
+
18015
18068
  function _typeof$I(obj) {
18016
18069
  "@babel/helpers - typeof";
18017
18070
 
@@ -18480,6 +18533,10 @@
18480
18533
  return /*#__PURE__*/React__default.createElement(ClearRefinements, _extends$1({}, props, uiProps));
18481
18534
  }
18482
18535
 
18536
+ function capitalize(text) {
18537
+ return text.toString().charAt(0).toUpperCase() + text.toString().slice(1);
18538
+ }
18539
+
18483
18540
  var _excluded$g = ["classNames", "items", "onRemove", "hasRefinements"];
18484
18541
  function CurrentRefinements(_ref) {
18485
18542
  var _ref$classNames = _ref.classNames,
@@ -18494,14 +18551,15 @@
18494
18551
  return /*#__PURE__*/React__default.createElement("div", _extends$1({}, props, {
18495
18552
  className: cx('ais-CurrentRefinements', classNames.root, !hasRefinements && cx('ais-CurrentRefinements--noRefinement', classNames.noRefinementRoot), props.className)
18496
18553
  }), /*#__PURE__*/React__default.createElement("ul", {
18497
- className: cx('ais-CurrentRefinements-list', classNames.list, !hasRefinements && cx('ais-CurrentRefinements-list--noRefinement', classNames.noRefinementList))
18554
+ className: cx('ais-CurrentRefinements-list', classNames.list, /* @MAJOR remove to ensure conformity with InstantSearch.css specs */
18555
+ !hasRefinements && cx('ais-CurrentRefinements-list--noRefinement', classNames.noRefinementList))
18498
18556
  }, items.map(function (item) {
18499
18557
  return /*#__PURE__*/React__default.createElement("li", {
18500
18558
  key: [item.indexName, item.label].join('/'),
18501
18559
  className: cx('ais-CurrentRefinements-item', classNames.item)
18502
18560
  }, /*#__PURE__*/React__default.createElement("span", {
18503
18561
  className: cx('ais-CurrentRefinements-label', classNames.label)
18504
- }, item.label, ":"), item.refinements.map(function (refinement) {
18562
+ }, capitalize(item.label), ":", ' '), item.refinements.map(function (refinement) {
18505
18563
  return /*#__PURE__*/React__default.createElement("span", {
18506
18564
  key: refinement.label,
18507
18565
  className: cx('ais-CurrentRefinements-category', classNames.category)
@@ -19951,6 +20009,7 @@
19951
20009
  exports.Index = Index;
19952
20010
  exports.InfiniteHits = InfiniteHits$1;
19953
20011
  exports.InstantSearch = InstantSearch$1;
20012
+ exports.InstantSearchRSCContext = InstantSearchRSCContext;
19954
20013
  exports.InstantSearchSSRProvider = InstantSearchSSRProvider;
19955
20014
  exports.InstantSearchServerContext = InstantSearchServerContext;
19956
20015
  exports.Menu = Menu$1;
@@ -19976,11 +20035,13 @@
19976
20035
  exports.useHitsPerPage = useHitsPerPage;
19977
20036
  exports.useInfiniteHits = useInfiniteHits;
19978
20037
  exports.useInstantSearch = useInstantSearch;
20038
+ exports.useInstantSearchContext = useInstantSearchContext;
19979
20039
  exports.useMenu = useMenu;
19980
20040
  exports.useNumericMenu = useNumericMenu;
19981
20041
  exports.usePagination = usePagination;
19982
20042
  exports.usePoweredBy = usePoweredBy;
19983
20043
  exports.useQueryRules = useQueryRules;
20044
+ exports.useRSCContext = useRSCContext;
19984
20045
  exports.useRange = useRange;
19985
20046
  exports.useRefinementList = useRefinementList;
19986
20047
  exports.useSearchBox = useSearchBox;
@@ -19988,6 +20049,7 @@
19988
20049
  exports.useStats = useStats;
19989
20050
  exports.useToggleRefinement = useToggleRefinement;
19990
20051
  exports.version = version;
20052
+ exports.wrapPromiseWithState = wrapPromiseWithState;
19991
20053
 
19992
20054
  Object.defineProperty(exports, '__esModule', { value: true });
19993
20055