react-instantsearch 7.17.0 → 7.18.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/dist/cjs/components/AutocompleteSearch.js +38 -0
- package/dist/cjs/components/Carousel.js +6 -7
- package/dist/cjs/ui/Breadcrumb.js +4 -4
- package/dist/cjs/ui/ClearRefinements.js +4 -4
- package/dist/cjs/ui/CurrentRefinements.js +4 -4
- package/dist/cjs/ui/HierarchicalMenu.js +4 -4
- package/dist/cjs/ui/Highlight.js +4 -4
- package/dist/cjs/ui/HitsPerPage.js +4 -4
- package/dist/cjs/ui/InfiniteHits.js +4 -4
- package/dist/cjs/ui/Menu.js +4 -4
- package/dist/cjs/ui/Pagination.js +4 -4
- package/dist/cjs/ui/PoweredBy.js +4 -4
- package/dist/cjs/ui/RangeInput.js +8 -9
- package/dist/cjs/ui/RefinementList.js +4 -4
- package/dist/cjs/ui/SearchBox.js +4 -4
- package/dist/cjs/ui/ShowMoreButton.js +3 -3
- package/dist/cjs/ui/Snippet.js +4 -4
- package/dist/cjs/ui/SortBy.js +4 -4
- package/dist/cjs/ui/Stats.js +4 -4
- package/dist/cjs/ui/ToggleRefinement.js +4 -4
- package/dist/cjs/widgets/Autocomplete.js +169 -0
- package/dist/cjs/widgets/Breadcrumb.js +6 -6
- package/dist/cjs/widgets/Chat.js +27 -82
- package/dist/cjs/widgets/ClearRefinements.js +6 -6
- package/dist/cjs/widgets/CurrentRefinements.js +4 -4
- package/dist/cjs/widgets/FrequentlyBoughtTogether.js +9 -8
- package/dist/cjs/widgets/HierarchicalMenu.js +6 -6
- package/dist/cjs/widgets/Highlight.js +4 -4
- package/dist/cjs/widgets/Hits.js +4 -5
- package/dist/cjs/widgets/HitsPerPage.js +4 -4
- package/dist/cjs/widgets/InfiniteHits.js +6 -6
- package/dist/cjs/widgets/LookingSimilar.js +6 -7
- package/dist/cjs/widgets/Menu.js +6 -6
- package/dist/cjs/widgets/Pagination.js +6 -6
- package/dist/cjs/widgets/PoweredBy.js +2 -2
- package/dist/cjs/widgets/RangeInput.js +6 -6
- package/dist/cjs/widgets/RefinementList.js +10 -11
- package/dist/cjs/widgets/RelatedProducts.js +6 -7
- package/dist/cjs/widgets/SearchBox.js +10 -11
- package/dist/cjs/widgets/Snippet.js +4 -4
- package/dist/cjs/widgets/SortBy.js +4 -4
- package/dist/cjs/widgets/Stats.js +6 -6
- package/dist/cjs/widgets/ToggleRefinement.js +4 -4
- package/dist/cjs/widgets/TrendingItems.js +6 -7
- package/dist/cjs/widgets/chat/tools/SearchIndexTool.js +4 -5
- package/dist/cjs/widgets/index.js +11 -0
- package/dist/cjs/widgets/index.umd.js +12 -0
- package/dist/es/components/AutocompleteSearch.d.ts +6 -0
- package/dist/es/components/AutocompleteSearch.js +31 -0
- package/dist/es/components/Carousel.js +5 -5
- package/dist/es/ui/Breadcrumb.js +3 -3
- package/dist/es/ui/ClearRefinements.js +3 -3
- package/dist/es/ui/CurrentRefinements.js +3 -3
- package/dist/es/ui/HierarchicalMenu.js +3 -3
- package/dist/es/ui/Highlight.js +3 -3
- package/dist/es/ui/HitsPerPage.js +3 -3
- package/dist/es/ui/InfiniteHits.js +3 -3
- package/dist/es/ui/Menu.js +3 -3
- package/dist/es/ui/Pagination.js +3 -3
- package/dist/es/ui/PoweredBy.js +3 -3
- package/dist/es/ui/RangeInput.js +7 -7
- package/dist/es/ui/RefinementList.js +3 -3
- package/dist/es/ui/SearchBox.js +3 -3
- package/dist/es/ui/ShowMoreButton.js +2 -2
- package/dist/es/ui/Snippet.js +3 -3
- package/dist/es/ui/SortBy.js +3 -3
- package/dist/es/ui/Stats.js +3 -3
- package/dist/es/ui/ToggleRefinement.js +3 -3
- package/dist/es/widgets/Autocomplete.d.ts +20 -0
- package/dist/es/widgets/Autocomplete.js +162 -0
- package/dist/es/widgets/Breadcrumb.js +5 -5
- package/dist/es/widgets/Chat.js +26 -80
- package/dist/es/widgets/ClearRefinements.js +5 -5
- package/dist/es/widgets/CurrentRefinements.js +3 -3
- package/dist/es/widgets/FrequentlyBoughtTogether.d.ts +1 -1
- package/dist/es/widgets/FrequentlyBoughtTogether.js +8 -6
- package/dist/es/widgets/HierarchicalMenu.js +5 -5
- package/dist/es/widgets/Highlight.js +3 -3
- package/dist/es/widgets/Hits.js +3 -3
- package/dist/es/widgets/HitsPerPage.js +3 -3
- package/dist/es/widgets/InfiniteHits.js +5 -5
- package/dist/es/widgets/LookingSimilar.js +5 -5
- package/dist/es/widgets/Menu.js +5 -5
- package/dist/es/widgets/Pagination.js +5 -5
- package/dist/es/widgets/PoweredBy.js +1 -1
- package/dist/es/widgets/RangeInput.js +5 -5
- package/dist/es/widgets/RefinementList.js +9 -9
- package/dist/es/widgets/RelatedProducts.js +5 -5
- package/dist/es/widgets/SearchBox.js +9 -9
- package/dist/es/widgets/Snippet.js +3 -3
- package/dist/es/widgets/SortBy.js +3 -3
- package/dist/es/widgets/Stats.js +5 -5
- package/dist/es/widgets/ToggleRefinement.js +3 -3
- package/dist/es/widgets/TrendingItems.js +5 -5
- package/dist/es/widgets/chat/tools/SearchIndexTool.js +3 -3
- package/dist/es/widgets/index.d.ts +1 -0
- package/dist/es/widgets/index.js +1 -0
- package/dist/es/widgets/index.umd.d.ts +1 -0
- package/dist/es/widgets/index.umd.js +1 -0
- package/dist/umd/ReactInstantSearch.js +2653 -2262
- package/dist/umd/ReactInstantSearch.js.map +1 -1
- package/dist/umd/ReactInstantSearch.min.js +1 -1
- package/dist/umd/ReactInstantSearch.min.js.map +1 -1
- package/package.json +5 -5
- package/dist/cjs/components/Autocomplete.js +0 -114
- package/dist/cjs/components/useAutocomplete.js +0 -237
- package/dist/es/components/Autocomplete.d.ts +0 -20
- package/dist/es/components/Autocomplete.js +0 -106
- package/dist/es/components/useAutocomplete.d.ts +0 -35
- package/dist/es/components/useAutocomplete.js +0 -231
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
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); }
|
|
7
|
+
import { createAutocompleteSearchComponent } from 'instantsearch-ui-components';
|
|
8
|
+
import React, { createElement, Fragment } from 'react';
|
|
9
|
+
import { useSearchBox } from 'react-instantsearch-core';
|
|
10
|
+
var AutocompleteSearchComponent = createAutocompleteSearchComponent({
|
|
11
|
+
createElement: createElement,
|
|
12
|
+
Fragment: Fragment
|
|
13
|
+
});
|
|
14
|
+
export function AutocompleteSearch(_ref) {
|
|
15
|
+
var inputProps = _ref.inputProps,
|
|
16
|
+
clearQuery = _ref.clearQuery;
|
|
17
|
+
var _useSearchBox = useSearchBox(),
|
|
18
|
+
query = _useSearchBox.query,
|
|
19
|
+
refine = _useSearchBox.refine,
|
|
20
|
+
isSearchStalled = _useSearchBox.isSearchStalled;
|
|
21
|
+
return /*#__PURE__*/React.createElement(AutocompleteSearchComponent, {
|
|
22
|
+
inputProps: _objectSpread(_objectSpread({}, inputProps), {}, {
|
|
23
|
+
onChange: function onChange(event) {
|
|
24
|
+
return refine(event.currentTarget.value);
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
onClear: clearQuery,
|
|
28
|
+
query: query,
|
|
29
|
+
isSearchStalled: isSearchStalled
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
2
|
-
function _slicedToArray(
|
|
1
|
+
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); }
|
|
2
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
3
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
function _unsupportedIterableToArray(
|
|
5
|
-
function _arrayLikeToArray(
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
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; }
|
|
6
6
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
-
function _arrayWithHoles(
|
|
7
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
8
|
import { createCarouselComponent, generateCarouselId } from 'instantsearch-ui-components';
|
|
9
9
|
import React, { createElement, Fragment, useRef, useState } from 'react';
|
|
10
10
|
var CarouselUiComponent = createCarouselComponent({
|
package/dist/es/ui/Breadcrumb.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["classNames", "items", "hasItems", "createURL", "onNavigate", "separator", "translations"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { isModifierClick } from "./lib/isModifierClick.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["classNames", "disabled", "onClick", "translations"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
export function ClearRefinements(_ref) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["classNames", "items", "hasRefinements"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { capitalize, isModifierClick } from "./lib/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["classNames", "items", "hasItems", "onNavigate", "createURL", "showMore", "canToggleShowMore", "onToggleShowMore", "isShowingMore", "translations"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { isModifierClick } from "./lib/isModifierClick.js";
|
package/dist/es/ui/Highlight.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["classNames"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { InternalHighlight } from "./InternalHighlight.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["items", "onChange", "currentValue", "classNames"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
export function HitsPerPage(_ref) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["hitComponent", "hits", "bannerComponent", "banner", "sendEvent", "isFirstPage", "isLastPage", "onShowPrevious", "onShowMore", "classNames", "translations"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
function DefaultHitComponent(_ref) {
|
package/dist/es/ui/Menu.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["items", "classNames", "showMore", "canToggleShowMore", "onToggleShowMore", "isShowingMore", "createURL", "onRefine", "translations"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { isModifierClick } from "./lib/isModifierClick.js";
|
package/dist/es/ui/Pagination.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _excluded = ["pages", "currentPage", "nbPages", "isFirstPage", "isLastPage", "showFirst", "showPrevious", "showNext", "showLast", "createURL", "onNavigate", "translations", "classNames"],
|
|
2
2
|
_excluded2 = ["isDisabled", "className", "classNames", "href", "onClick"];
|
|
3
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
4
|
-
function _objectWithoutProperties(
|
|
5
|
-
function _objectWithoutPropertiesLoose(
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
6
|
import { cx } from 'instantsearch-ui-components';
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { isModifierClick } from "./lib/isModifierClick.js";
|
package/dist/es/ui/PoweredBy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["classNames", "url", "theme"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
export function PoweredBy(_ref) {
|
package/dist/es/ui/RangeInput.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var _excluded = ["classNames", "range", "start", "step", "disabled", "onSubmit", "translations"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
5
|
-
function _slicedToArray(
|
|
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
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
6
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
-
function _unsupportedIterableToArray(
|
|
8
|
-
function _arrayLikeToArray(
|
|
7
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
8
|
+
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; }
|
|
9
9
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
-
function _arrayWithHoles(
|
|
10
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
11
11
|
import { cx } from 'instantsearch-ui-components';
|
|
12
12
|
import React, { useState } from 'react';
|
|
13
13
|
// if the default value is undefined, React considers the component uncontrolled initially, which we don't want 0 or NaN as the default value
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["canRefine", "items", "onRefine", "query", "searchBox", "noResults", "showMore", "canToggleShowMore", "onToggleShowMore", "isShowingMore", "className", "classNames", "translations"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import { getHighlightedParts, unescape } from "instantsearch.js/es/lib/utils/index.js";
|
|
7
7
|
import React from 'react';
|
package/dist/es/ui/SearchBox.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["formRef", "inputRef", "inputProps", "isSearchStalled", "onChange", "onReset", "onSubmit", "placeholder", "value", "autoFocus", "resetIconComponent", "submitIconComponent", "loadingIconComponent", "classNames", "translations"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
var _ref2 = /*#__PURE__*/React.createElement("path", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["isShowingMore", "translations"];
|
|
2
|
-
function _objectWithoutProperties(
|
|
3
|
-
function _objectWithoutPropertiesLoose(
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
4
|
import React from 'react';
|
|
5
5
|
export function ShowMoreButton(_ref) {
|
|
6
6
|
var isShowingMore = _ref.isShowingMore,
|
package/dist/es/ui/Snippet.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["classNames"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { InternalHighlight } from "./InternalHighlight.js";
|
package/dist/es/ui/SortBy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["items", "value", "onChange", "classNames"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
export function SortBy(_ref) {
|
package/dist/es/ui/Stats.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["classNames", "nbHits", "processingTimeMS", "nbSortedHits", "areHitsSorted", "translations"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
export function Stats(_ref) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["classNames", "checked", "onChange", "label"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
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
5
|
import { cx } from 'instantsearch-ui-components';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
export function ToggleRefinement(_ref) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AutocompleteIndexClassNames, AutocompleteIndexConfig, AutocompleteClassNames, AutocompleteIndexProps } from 'instantsearch-ui-components';
|
|
3
|
+
import type { BaseHit, IndexUiState } from 'instantsearch.js';
|
|
4
|
+
import type { ComponentProps } from 'react';
|
|
5
|
+
type IndexConfig<TItem extends BaseHit> = AutocompleteIndexConfig<TItem> & {
|
|
6
|
+
headerComponent?: AutocompleteIndexProps<TItem>['HeaderComponent'];
|
|
7
|
+
itemComponent: AutocompleteIndexProps<TItem>['ItemComponent'];
|
|
8
|
+
classNames?: Partial<AutocompleteIndexClassNames>;
|
|
9
|
+
};
|
|
10
|
+
export type AutocompleteProps<TItem extends BaseHit> = ComponentProps<'div'> & {
|
|
11
|
+
indices?: Array<IndexConfig<TItem>>;
|
|
12
|
+
showSuggestions?: Partial<Pick<IndexConfig<{
|
|
13
|
+
query: string;
|
|
14
|
+
}>, 'indexName' | 'getURL' | 'headerComponent' | 'itemComponent' | 'classNames'>>;
|
|
15
|
+
getSearchPageURL?: (nextUiState: IndexUiState) => string;
|
|
16
|
+
onSelect?: AutocompleteIndexConfig<TItem>['onSelect'];
|
|
17
|
+
classNames?: Partial<AutocompleteClassNames>;
|
|
18
|
+
};
|
|
19
|
+
export declare function EXPERIMENTAL_Autocomplete<TItem extends BaseHit = BaseHit>({ indices, showSuggestions, ...props }: AutocompleteProps<TItem>): React.JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
var _excluded = ["indices", "showSuggestions"],
|
|
3
|
+
_excluded2 = ["indicesConfig", "refineSearchBox", "getSearchPageURL", "onSelect", "indexUiState", "isSearchPage"];
|
|
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
|
+
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
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
11
|
+
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."); }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
14
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
15
|
+
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; }
|
|
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
|
+
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
|
+
import { createAutocompleteComponent, createAutocompleteIndexComponent, createAutocompletePanelComponent, createAutocompletePropGetters, createAutocompleteSuggestionComponent, cx } from 'instantsearch-ui-components';
|
|
19
|
+
import React, { createElement, Fragment, useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
20
|
+
import { Configure, Index, useAutocomplete, useInstantSearch, useSearchBox } from 'react-instantsearch-core';
|
|
21
|
+
import { AutocompleteSearch } from "../components/AutocompleteSearch.js";
|
|
22
|
+
var Autocomplete = createAutocompleteComponent({
|
|
23
|
+
createElement: createElement,
|
|
24
|
+
Fragment: Fragment
|
|
25
|
+
});
|
|
26
|
+
var AutocompletePanel = createAutocompletePanelComponent({
|
|
27
|
+
createElement: createElement,
|
|
28
|
+
Fragment: Fragment
|
|
29
|
+
});
|
|
30
|
+
var AutocompleteIndex = createAutocompleteIndexComponent({
|
|
31
|
+
createElement: createElement,
|
|
32
|
+
Fragment: Fragment
|
|
33
|
+
});
|
|
34
|
+
var AutocompleteSuggestion = createAutocompleteSuggestionComponent({
|
|
35
|
+
createElement: createElement,
|
|
36
|
+
Fragment: Fragment
|
|
37
|
+
});
|
|
38
|
+
var usePropGetters = createAutocompletePropGetters({
|
|
39
|
+
useEffect: useEffect,
|
|
40
|
+
useId: useId,
|
|
41
|
+
useMemo: useMemo,
|
|
42
|
+
useRef: useRef,
|
|
43
|
+
useState: useState
|
|
44
|
+
});
|
|
45
|
+
var _ref2 = /*#__PURE__*/React.createElement(Configure, {
|
|
46
|
+
hitsPerPage: 5
|
|
47
|
+
});
|
|
48
|
+
export function EXPERIMENTAL_Autocomplete(_ref) {
|
|
49
|
+
var _ref$indices = _ref.indices,
|
|
50
|
+
indices = _ref$indices === void 0 ? [] : _ref$indices,
|
|
51
|
+
showSuggestions = _ref.showSuggestions,
|
|
52
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
53
|
+
var _useInstantSearch = useInstantSearch(),
|
|
54
|
+
indexUiState = _useInstantSearch.indexUiState,
|
|
55
|
+
indexRenderState = _useInstantSearch.indexRenderState;
|
|
56
|
+
var _useSearchBox = useSearchBox({}, {
|
|
57
|
+
$$type: 'ais.autocomplete',
|
|
58
|
+
$$widgetType: 'ais.autocomplete'
|
|
59
|
+
}),
|
|
60
|
+
refine = _useSearchBox.refine;
|
|
61
|
+
var indicesConfig = _toConsumableArray(indices);
|
|
62
|
+
if (showSuggestions !== null && showSuggestions !== void 0 && showSuggestions.indexName) {
|
|
63
|
+
var _showSuggestions$clas, _showSuggestions$clas2, _showSuggestions$clas3, _showSuggestions$clas4;
|
|
64
|
+
indicesConfig.unshift({
|
|
65
|
+
indexName: showSuggestions.indexName,
|
|
66
|
+
headerComponent: showSuggestions.headerComponent,
|
|
67
|
+
itemComponent: showSuggestions.itemComponent || AutocompleteSuggestion,
|
|
68
|
+
classNames: {
|
|
69
|
+
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),
|
|
70
|
+
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),
|
|
71
|
+
header: cx('ais-AutocompleteSuggestionsHeader', showSuggestions === null || showSuggestions === void 0 ? void 0 : (_showSuggestions$clas3 = showSuggestions.classNames) === null || _showSuggestions$clas3 === void 0 ? void 0 : _showSuggestions$clas3.header),
|
|
72
|
+
item: cx('ais-AutocompleteSuggestionsItem', showSuggestions === null || showSuggestions === void 0 ? void 0 : (_showSuggestions$clas4 = showSuggestions.classNames) === null || _showSuggestions$clas4 === void 0 ? void 0 : _showSuggestions$clas4.item)
|
|
73
|
+
},
|
|
74
|
+
getQuery: function getQuery(item) {
|
|
75
|
+
return item.query;
|
|
76
|
+
},
|
|
77
|
+
getURL: showSuggestions.getURL
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
var isSearchPage = useMemo(function () {
|
|
81
|
+
return typeof indexRenderState.hits !== 'undefined' || typeof indexRenderState.infiniteHits !== 'undefined';
|
|
82
|
+
}, [indexRenderState]);
|
|
83
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Index, {
|
|
84
|
+
EXPERIMENTAL_isolated: true
|
|
85
|
+
}, _ref2, indicesConfig.map(function (index) {
|
|
86
|
+
return /*#__PURE__*/React.createElement(Index, {
|
|
87
|
+
key: index.indexName,
|
|
88
|
+
indexName: index.indexName
|
|
89
|
+
});
|
|
90
|
+
}), /*#__PURE__*/React.createElement(InnerAutocomplete, _extends({}, props, {
|
|
91
|
+
indicesConfig: indicesConfig,
|
|
92
|
+
refineSearchBox: refine,
|
|
93
|
+
indexUiState: indexUiState,
|
|
94
|
+
isSearchPage: isSearchPage
|
|
95
|
+
}))));
|
|
96
|
+
}
|
|
97
|
+
function InnerAutocomplete(_ref3) {
|
|
98
|
+
var indicesConfig = _ref3.indicesConfig,
|
|
99
|
+
refineSearchBox = _ref3.refineSearchBox,
|
|
100
|
+
getSearchPageURL = _ref3.getSearchPageURL,
|
|
101
|
+
userOnSelect = _ref3.onSelect,
|
|
102
|
+
indexUiState = _ref3.indexUiState,
|
|
103
|
+
isSearchPage = _ref3.isSearchPage,
|
|
104
|
+
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
105
|
+
var _useAutocomplete = useAutocomplete(),
|
|
106
|
+
indices = _useAutocomplete.indices,
|
|
107
|
+
refineAutocomplete = _useAutocomplete.refine;
|
|
108
|
+
var _usePropGetters = usePropGetters({
|
|
109
|
+
indices: indices,
|
|
110
|
+
indicesConfig: indicesConfig,
|
|
111
|
+
onRefine: function onRefine(query) {
|
|
112
|
+
refineAutocomplete(query);
|
|
113
|
+
refineSearchBox(query);
|
|
114
|
+
},
|
|
115
|
+
onSelect: userOnSelect !== null && userOnSelect !== void 0 ? userOnSelect : function (_ref4) {
|
|
116
|
+
var query = _ref4.query,
|
|
117
|
+
setQuery = _ref4.setQuery,
|
|
118
|
+
url = _ref4.url;
|
|
119
|
+
if (url) {
|
|
120
|
+
window.location.href = url;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (!isSearchPage && typeof getSearchPageURL !== 'undefined') {
|
|
124
|
+
window.location.href = getSearchPageURL(_objectSpread(_objectSpread({}, indexUiState), {}, {
|
|
125
|
+
query: query
|
|
126
|
+
}));
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
setQuery(query);
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
132
|
+
getInputProps = _usePropGetters.getInputProps,
|
|
133
|
+
getItemProps = _usePropGetters.getItemProps,
|
|
134
|
+
getPanelProps = _usePropGetters.getPanelProps,
|
|
135
|
+
getRootProps = _usePropGetters.getRootProps;
|
|
136
|
+
return /*#__PURE__*/React.createElement(Autocomplete, _extends({}, props, getRootProps()), /*#__PURE__*/React.createElement(AutocompleteSearch, {
|
|
137
|
+
inputProps: getInputProps(),
|
|
138
|
+
clearQuery: function clearQuery() {
|
|
139
|
+
refineSearchBox('');
|
|
140
|
+
refineAutocomplete('');
|
|
141
|
+
}
|
|
142
|
+
}), /*#__PURE__*/React.createElement(AutocompletePanel, getPanelProps(), indices.map(function (_ref5, index) {
|
|
143
|
+
var indexId = _ref5.indexId,
|
|
144
|
+
hits = _ref5.hits;
|
|
145
|
+
return /*#__PURE__*/React.createElement(AutocompleteIndex, {
|
|
146
|
+
key: indexId
|
|
147
|
+
// @ts-expect-error - there seems to be problems with React.ComponentType and this, but it's actually correct
|
|
148
|
+
,
|
|
149
|
+
HeaderComponent: indicesConfig[index].headerComponent
|
|
150
|
+
// @ts-expect-error - there seems to be problems with React.ComponentType and this, but it's actually correct
|
|
151
|
+
,
|
|
152
|
+
ItemComponent: indicesConfig[index].itemComponent,
|
|
153
|
+
items: hits.map(function (item) {
|
|
154
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
155
|
+
__indexName: indexId
|
|
156
|
+
});
|
|
157
|
+
}),
|
|
158
|
+
getItemProps: getItemProps,
|
|
159
|
+
classNames: indicesConfig[index].classNames
|
|
160
|
+
});
|
|
161
|
+
})));
|
|
162
|
+
}
|