react-instantsearch 7.25.0 → 7.26.1
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 +25 -36
- package/dist/cjs/components/Carousel.js +25 -39
- package/dist/cjs/components/index.js +6 -15
- package/dist/cjs/index.js +85 -44
- package/dist/cjs/lib/useStickToBottom.js +11 -17
- package/dist/cjs/package.json +4 -1
- package/dist/cjs/types/PartialKeys.js +2 -1
- package/dist/cjs/types/Translatable.js +2 -1
- package/dist/cjs/types/index.js +1 -26
- package/dist/cjs/ui/Breadcrumb.js +52 -57
- package/dist/cjs/ui/ClearRefinements.js +23 -28
- package/dist/cjs/ui/CurrentRefinements.js +48 -50
- package/dist/cjs/ui/HierarchicalMenu.js +71 -79
- package/dist/cjs/ui/Highlight.js +21 -25
- package/dist/cjs/ui/HitsPerPage.js +31 -34
- package/dist/cjs/ui/InfiniteHits.js +83 -88
- package/dist/cjs/ui/InternalHighlight.js +9 -10
- package/dist/cjs/ui/Menu.js +53 -56
- package/dist/cjs/ui/Pagination.js +117 -124
- package/dist/cjs/ui/PoweredBy.js +33 -37
- package/dist/cjs/ui/RangeInput.js +96 -116
- package/dist/cjs/ui/RefinementList.js +66 -67
- package/dist/cjs/ui/ReverseHighlight.js +21 -25
- package/dist/cjs/ui/SearchBox.js +141 -151
- package/dist/cjs/ui/ShowMoreButton.js +14 -17
- package/dist/cjs/ui/Snippet.js +21 -25
- package/dist/cjs/ui/SortBy.js +32 -36
- package/dist/cjs/ui/Stats.js +29 -32
- package/dist/cjs/ui/ToggleRefinement.js +30 -33
- package/dist/cjs/ui/lib/capitalize.js +5 -7
- package/dist/cjs/ui/lib/index.js +8 -26
- package/dist/cjs/ui/lib/isModifierClick.js +6 -8
- package/dist/cjs/widgets/Autocomplete.js +450 -491
- package/dist/cjs/widgets/Breadcrumb.js +34 -47
- package/dist/cjs/widgets/Chat.js +174 -221
- package/dist/cjs/widgets/ClearRefinements.js +31 -42
- package/dist/cjs/widgets/CurrentRefinements.js +27 -32
- package/dist/cjs/widgets/FilterSuggestions.js +46 -53
- package/dist/cjs/widgets/FrequentlyBoughtTogether.js +66 -74
- package/dist/cjs/widgets/HierarchicalMenu.js +53 -68
- package/dist/cjs/widgets/Highlight.js +31 -31
- package/dist/cjs/widgets/Hits.js +59 -64
- package/dist/cjs/widgets/HitsPerPage.js +32 -38
- package/dist/cjs/widgets/InfiniteHits.js +44 -61
- package/dist/cjs/widgets/LookingSimilar.js +66 -74
- package/dist/cjs/widgets/Menu.js +48 -62
- package/dist/cjs/widgets/Pagination.js +59 -74
- package/dist/cjs/widgets/PoweredBy.js +14 -17
- package/dist/cjs/widgets/RangeInput.js +38 -51
- package/dist/cjs/widgets/RefinementList.js +100 -125
- package/dist/cjs/widgets/RelatedProducts.js +66 -74
- package/dist/cjs/widgets/ReverseHighlight.js +38 -44
- package/dist/cjs/widgets/SearchBox.js +63 -86
- package/dist/cjs/widgets/Snippet.js +31 -31
- package/dist/cjs/widgets/SortBy.js +26 -32
- package/dist/cjs/widgets/Stats.js +54 -68
- package/dist/cjs/widgets/ToggleRefinement.js +33 -38
- package/dist/cjs/widgets/TrendingItems.js +70 -78
- package/dist/cjs/widgets/chat/tools/SearchIndexTool.js +92 -99
- package/dist/cjs/widgets/index.js +77 -289
- package/dist/cjs/widgets/index.umd.js +68 -322
- package/dist/es/components/AutocompleteSearch.js +22 -28
- package/dist/es/components/Carousel.js +23 -31
- package/dist/es/components/index.js +1 -1
- package/dist/es/index.js +29 -4
- package/dist/es/lib/useStickToBottom.js +10 -12
- package/dist/es/package.json +4 -0
- package/dist/es/types/PartialKeys.js +1 -1
- package/dist/es/types/Translatable.js +1 -1
- package/dist/es/types/index.js +1 -2
- package/dist/es/ui/Breadcrumb.js +49 -49
- package/dist/es/ui/ClearRefinements.js +21 -21
- package/dist/es/ui/CurrentRefinements.js +46 -43
- package/dist/es/ui/HierarchicalMenu.js +68 -71
- package/dist/es/ui/Highlight.js +19 -18
- package/dist/es/ui/HitsPerPage.js +29 -27
- package/dist/es/ui/InfiniteHits.js +80 -80
- package/dist/es/ui/InternalHighlight.js +7 -4
- package/dist/es/ui/Menu.js +51 -49
- package/dist/es/ui/Pagination.js +114 -116
- package/dist/es/ui/PoweredBy.js +31 -30
- package/dist/es/ui/RangeInput.js +93 -107
- package/dist/es/ui/RefinementList.js +64 -60
- package/dist/es/ui/ReverseHighlight.js +19 -18
- package/dist/es/ui/SearchBox.js +138 -143
- package/dist/es/ui/ShowMoreButton.js +13 -11
- package/dist/es/ui/Snippet.js +19 -18
- package/dist/es/ui/SortBy.js +30 -29
- package/dist/es/ui/Stats.js +27 -25
- package/dist/es/ui/ToggleRefinement.js +28 -26
- package/dist/es/ui/lib/capitalize.js +5 -3
- package/dist/es/ui/lib/index.js +2 -2
- package/dist/es/ui/lib/isModifierClick.js +6 -4
- package/dist/es/widgets/Autocomplete.js +438 -474
- package/dist/es/widgets/Breadcrumb.js +31 -39
- package/dist/es/widgets/Chat.js +164 -196
- package/dist/es/widgets/ClearRefinements.js +28 -34
- package/dist/es/widgets/CurrentRefinements.js +24 -24
- package/dist/es/widgets/FilterSuggestions.js +41 -42
- package/dist/es/widgets/FrequentlyBoughtTogether.js +62 -65
- package/dist/es/widgets/HierarchicalMenu.js +50 -60
- package/dist/es/widgets/Highlight.js +30 -25
- package/dist/es/widgets/Hits.js +54 -53
- package/dist/es/widgets/HitsPerPage.js +29 -30
- package/dist/es/widgets/InfiniteHits.js +41 -53
- package/dist/es/widgets/LookingSimilar.js +62 -65
- package/dist/es/widgets/Menu.js +45 -54
- package/dist/es/widgets/Pagination.js +56 -66
- package/dist/es/widgets/PoweredBy.js +12 -10
- package/dist/es/widgets/RangeInput.js +35 -43
- package/dist/es/widgets/RefinementList.js +98 -118
- package/dist/es/widgets/RelatedProducts.js +61 -64
- package/dist/es/widgets/ReverseHighlight.js +36 -37
- package/dist/es/widgets/SearchBox.js +61 -79
- package/dist/es/widgets/Snippet.js +30 -25
- package/dist/es/widgets/SortBy.js +23 -24
- package/dist/es/widgets/Stats.js +51 -60
- package/dist/es/widgets/ToggleRefinement.js +30 -30
- package/dist/es/widgets/TrendingItems.js +65 -68
- package/dist/es/widgets/chat/tools/SearchIndexTool.js +89 -91
- package/dist/es/widgets/index.js +27 -26
- package/dist/es/widgets/index.umd.js +36 -33
- package/dist/umd/ReactInstantSearch.js +23411 -30098
- package/dist/umd/ReactInstantSearch.min.js +3 -3
- package/package.json +8 -12
- package/dist/umd/ReactInstantSearch.js.map +0 -1
- package/dist/umd/ReactInstantSearch.min.js.map +0 -1
|
@@ -1,125 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
10
|
-
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."); }
|
|
11
|
-
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; } }
|
|
12
|
-
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; }
|
|
13
|
-
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; } }
|
|
14
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
|
-
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; }
|
|
16
|
-
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; }
|
|
17
|
-
import React, { useRef, useState } from 'react';
|
|
1
|
+
import { _ as _$2 } from '@swc/helpers/cjs/_object_spread.cjs';
|
|
2
|
+
import { _ as _$3 } from '@swc/helpers/cjs/_object_spread_props.cjs';
|
|
3
|
+
import { _ } from '@swc/helpers/cjs/_object_without_properties.cjs';
|
|
4
|
+
import { _ as _$1 } from '@swc/helpers/cjs/_sliced_to_array.cjs';
|
|
5
|
+
import React, { useState, useRef } from 'react';
|
|
18
6
|
import { useRefinementList } from 'react-instantsearch-core';
|
|
19
|
-
import { RefinementList as
|
|
20
|
-
import { SearchBox
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
searchablePlaceholder =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
7
|
+
import { RefinementList as RefinementList$1 } from '../ui/RefinementList.js';
|
|
8
|
+
import { SearchBox } from '../ui/SearchBox.js';
|
|
9
|
+
|
|
10
|
+
function RefinementList(_0) {
|
|
11
|
+
var searchable = _0.searchable, searchablePlaceholder = _0.searchablePlaceholder, _0_searchableSelectOnSubmit = _0.searchableSelectOnSubmit, searchableSelectOnSubmit = _0_searchableSelectOnSubmit === void 0 ? true : _0_searchableSelectOnSubmit, attribute = _0.attribute, operator = _0.operator, limit = _0.limit, showMore = _0.showMore, showMoreLimit = _0.showMoreLimit, sortBy = _0.sortBy, escapeFacetValues = _0.escapeFacetValues, transformItems = _0.transformItems, translations = _0.translations, props = _(_0, [
|
|
12
|
+
"searchable",
|
|
13
|
+
"searchablePlaceholder",
|
|
14
|
+
"searchableSelectOnSubmit",
|
|
15
|
+
"attribute",
|
|
16
|
+
"operator",
|
|
17
|
+
"limit",
|
|
18
|
+
"showMore",
|
|
19
|
+
"showMoreLimit",
|
|
20
|
+
"sortBy",
|
|
21
|
+
"escapeFacetValues",
|
|
22
|
+
"transformItems",
|
|
23
|
+
"translations"
|
|
24
|
+
]);
|
|
25
|
+
var _useRefinementList = useRefinementList({
|
|
26
|
+
attribute: attribute,
|
|
27
|
+
operator: operator,
|
|
28
|
+
limit: limit,
|
|
29
|
+
showMore: showMore,
|
|
30
|
+
showMoreLimit: showMoreLimit,
|
|
31
|
+
sortBy: sortBy,
|
|
32
|
+
escapeFacetValues: escapeFacetValues,
|
|
33
|
+
transformItems: transformItems
|
|
45
34
|
}, {
|
|
46
|
-
|
|
47
|
-
}),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var _useState = useState(''),
|
|
57
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
-
inputValue = _useState2[0],
|
|
59
|
-
setInputValue = _useState2[1];
|
|
60
|
-
var inputRef = useRef(null);
|
|
61
|
-
function setQuery(newQuery) {
|
|
62
|
-
var compositionComplete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
63
|
-
setInputValue(newQuery);
|
|
64
|
-
if (compositionComplete) {
|
|
65
|
-
searchForItems(newQuery);
|
|
35
|
+
$$widgetType: 'ais.refinementList'
|
|
36
|
+
}), canRefine = _useRefinementList.canRefine, canToggleShowMore = _useRefinementList.canToggleShowMore, isFromSearch = _useRefinementList.isFromSearch, isShowingMore = _useRefinementList.isShowingMore, items = _useRefinementList.items, refine = _useRefinementList.refine, searchForItems = _useRefinementList.searchForItems, toggleShowMore = _useRefinementList.toggleShowMore;
|
|
37
|
+
var _useState = _$1(useState(''), 2), inputValue = _useState[0], setInputValue = _useState[1];
|
|
38
|
+
var inputRef = useRef(null);
|
|
39
|
+
function setQuery(newQuery) {
|
|
40
|
+
var compositionComplete = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
41
|
+
setInputValue(newQuery);
|
|
42
|
+
if (compositionComplete) {
|
|
43
|
+
searchForItems(newQuery);
|
|
44
|
+
}
|
|
66
45
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
setQuery('');
|
|
71
|
-
}
|
|
72
|
-
function onChange(event) {
|
|
73
|
-
var compositionComplete = event.type === 'compositionend' || !event.nativeEvent.isComposing;
|
|
74
|
-
setQuery(event.currentTarget.value, compositionComplete);
|
|
75
|
-
}
|
|
76
|
-
function onReset() {
|
|
77
|
-
setQuery('');
|
|
78
|
-
}
|
|
79
|
-
function onSubmit() {
|
|
80
|
-
if (searchableSelectOnSubmit === false) {
|
|
81
|
-
return;
|
|
46
|
+
function onRefine(item) {
|
|
47
|
+
refine(item.value);
|
|
48
|
+
setQuery('');
|
|
82
49
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
50
|
+
function onChange(event) {
|
|
51
|
+
var compositionComplete = event.type === 'compositionend' || !event.nativeEvent.isComposing;
|
|
52
|
+
setQuery(event.currentTarget.value, compositionComplete);
|
|
86
53
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
resetButtonTitle: 'Clear the search query',
|
|
90
|
-
submitButtonTitle: 'Submit the search query',
|
|
91
|
-
noResultsText: 'No results.',
|
|
92
|
-
showMoreButtonText: function showMoreButtonText(options) {
|
|
93
|
-
return options.isShowingMore ? 'Show less' : 'Show more';
|
|
54
|
+
function onReset() {
|
|
55
|
+
setQuery('');
|
|
94
56
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
placeholder: searchablePlaceholder,
|
|
104
|
-
isSearchStalled: false,
|
|
105
|
-
value: inputValue,
|
|
106
|
-
onChange: onChange,
|
|
107
|
-
onReset: onReset,
|
|
108
|
-
onSubmit: onSubmit,
|
|
109
|
-
translations: {
|
|
110
|
-
submitButtonTitle: mergedTranslations.submitButtonTitle,
|
|
111
|
-
resetButtonTitle: mergedTranslations.resetButtonTitle
|
|
112
|
-
}
|
|
113
|
-
}),
|
|
114
|
-
noResults: searchable && isFromSearch && items.length === 0 && mergedTranslations.noResultsText,
|
|
115
|
-
canToggleShowMore: canToggleShowMore,
|
|
116
|
-
onToggleShowMore: toggleShowMore,
|
|
117
|
-
isShowingMore: isShowingMore,
|
|
118
|
-
translations: {
|
|
119
|
-
showMoreButtonText: mergedTranslations.showMoreButtonText
|
|
57
|
+
function onSubmit() {
|
|
58
|
+
if (searchableSelectOnSubmit === false) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (items.length > 0) {
|
|
62
|
+
refine(items[0].value);
|
|
63
|
+
setQuery('');
|
|
64
|
+
}
|
|
120
65
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
66
|
+
var mergedTranslations = _$2({
|
|
67
|
+
resetButtonTitle: 'Clear the search query',
|
|
68
|
+
submitButtonTitle: 'Submit the search query',
|
|
69
|
+
noResultsText: 'No results.',
|
|
70
|
+
showMoreButtonText: function showMoreButtonText(options) {
|
|
71
|
+
return options.isShowingMore ? 'Show less' : 'Show more';
|
|
72
|
+
}
|
|
73
|
+
}, translations);
|
|
74
|
+
var uiProps = {
|
|
75
|
+
items: items,
|
|
76
|
+
canRefine: canRefine,
|
|
77
|
+
onRefine: onRefine,
|
|
78
|
+
query: inputValue,
|
|
79
|
+
searchBox: searchable && /*#__PURE__*/ React.createElement(SearchBox, {
|
|
80
|
+
inputRef: inputRef,
|
|
81
|
+
placeholder: searchablePlaceholder,
|
|
82
|
+
isSearchStalled: false,
|
|
83
|
+
value: inputValue,
|
|
84
|
+
onChange: onChange,
|
|
85
|
+
onReset: onReset,
|
|
86
|
+
onSubmit: onSubmit,
|
|
87
|
+
translations: {
|
|
88
|
+
submitButtonTitle: mergedTranslations.submitButtonTitle,
|
|
89
|
+
resetButtonTitle: mergedTranslations.resetButtonTitle
|
|
90
|
+
}
|
|
91
|
+
}),
|
|
92
|
+
noResults: searchable && isFromSearch && items.length === 0 && mergedTranslations.noResultsText,
|
|
93
|
+
canToggleShowMore: canToggleShowMore,
|
|
94
|
+
onToggleShowMore: toggleShowMore,
|
|
95
|
+
isShowingMore: isShowingMore,
|
|
96
|
+
translations: {
|
|
97
|
+
showMoreButtonText: mergedTranslations.showMoreButtonText
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return /*#__PURE__*/ React.createElement(RefinementList$1, _$3(_$2({}, props, uiProps), {
|
|
101
|
+
showMore: showMore
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { RefinementList };
|
|
@@ -1,71 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 _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; }
|
|
10
|
-
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; }
|
|
1
|
+
import { _ as _$2 } from '@swc/helpers/cjs/_object_spread.cjs';
|
|
2
|
+
import { _ as _$1 } from '@swc/helpers/cjs/_object_spread_props.cjs';
|
|
3
|
+
import { _ } from '@swc/helpers/cjs/_object_without_properties.cjs';
|
|
11
4
|
import { createRelatedProductsComponent } from 'instantsearch-ui-components';
|
|
12
5
|
import React, { createElement, Fragment, useMemo } from 'react';
|
|
13
6
|
import { useInstantSearch, useRelatedProducts } from 'react-instantsearch-core';
|
|
7
|
+
|
|
14
8
|
var RelatedProductsUiComponent = createRelatedProductsComponent({
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
createElement: createElement,
|
|
10
|
+
Fragment: Fragment
|
|
17
11
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
status =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
12
|
+
function RelatedProducts(_0) {
|
|
13
|
+
var objectIDs = _0.objectIDs, limit = _0.limit, threshold = _0.threshold, fallbackParameters = _0.fallbackParameters, queryParameters = _0.queryParameters, escapeHTML = _0.escapeHTML, transformItems = _0.transformItems, itemComponent = _0.itemComponent, headerComponent = _0.headerComponent, emptyComponent = _0.emptyComponent, layoutComponent = _0.layoutComponent, props = _(_0, [
|
|
14
|
+
"objectIDs",
|
|
15
|
+
"limit",
|
|
16
|
+
"threshold",
|
|
17
|
+
"fallbackParameters",
|
|
18
|
+
"queryParameters",
|
|
19
|
+
"escapeHTML",
|
|
20
|
+
"transformItems",
|
|
21
|
+
"itemComponent",
|
|
22
|
+
"headerComponent",
|
|
23
|
+
"emptyComponent",
|
|
24
|
+
"layoutComponent"
|
|
25
|
+
]);
|
|
26
|
+
var status = useInstantSearch().status;
|
|
27
|
+
var _useRelatedProducts = useRelatedProducts({
|
|
28
|
+
objectIDs: objectIDs,
|
|
29
|
+
limit: limit,
|
|
30
|
+
threshold: threshold,
|
|
31
|
+
fallbackParameters: fallbackParameters,
|
|
32
|
+
queryParameters: queryParameters,
|
|
33
|
+
escapeHTML: escapeHTML,
|
|
34
|
+
transformItems: transformItems
|
|
41
35
|
}, {
|
|
42
|
-
|
|
43
|
-
}),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}));
|
|
53
|
-
} : undefined;
|
|
54
|
-
var _itemComponent = useMemo(function () {
|
|
55
|
-
return itemComponent ? function (itemProps) {
|
|
56
|
-
return itemComponent(_objectSpread(_objectSpread({}, itemProps), {}, {
|
|
57
|
-
sendEvent: sendEvent
|
|
58
|
-
}));
|
|
36
|
+
$$widgetType: 'ais.relatedProducts'
|
|
37
|
+
}), items = _useRelatedProducts.items, sendEvent = _useRelatedProducts.sendEvent;
|
|
38
|
+
var layout = layoutComponent ? function(layoutProps) {
|
|
39
|
+
return layoutComponent(_$1(_$2({}, layoutProps), {
|
|
40
|
+
classNames: {
|
|
41
|
+
list: layoutProps.classNames.list,
|
|
42
|
+
item: layoutProps.classNames.item
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
59
45
|
} : undefined;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
46
|
+
var _itemComponent = useMemo(function() {
|
|
47
|
+
return itemComponent ? function(itemProps) {
|
|
48
|
+
return itemComponent(_$1(_$2({}, itemProps), {
|
|
49
|
+
sendEvent: sendEvent
|
|
50
|
+
}));
|
|
51
|
+
} : undefined;
|
|
52
|
+
}, [
|
|
53
|
+
itemComponent,
|
|
54
|
+
sendEvent
|
|
55
|
+
]);
|
|
56
|
+
var uiProps = {
|
|
57
|
+
items: items,
|
|
58
|
+
itemComponent: _itemComponent,
|
|
59
|
+
headerComponent: headerComponent,
|
|
60
|
+
emptyComponent: emptyComponent,
|
|
61
|
+
layout: layout,
|
|
62
|
+
status: status,
|
|
63
|
+
sendEvent: sendEvent
|
|
64
|
+
};
|
|
65
|
+
return /*#__PURE__*/ React.createElement(RelatedProductsUiComponent, _$2({}, props, uiProps));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { RelatedProducts };
|
|
@@ -1,39 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
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; }
|
|
6
|
-
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; }
|
|
7
|
-
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; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
-
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); }
|
|
10
|
-
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; }
|
|
11
|
-
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; }
|
|
12
|
-
import { getHighlightedParts, getPropertyByPath, unescape } from "instantsearch.js/es/lib/utils/index.js";
|
|
1
|
+
import { _ as _$2 } from '@swc/helpers/cjs/_object_spread.cjs';
|
|
2
|
+
import { _ as _$1 } from '@swc/helpers/cjs/_object_spread_props.cjs';
|
|
3
|
+
import { _ } from '@swc/helpers/cjs/_object_without_properties.cjs';
|
|
4
|
+
import { getPropertyByPath, getHighlightedParts, unescape } from 'instantsearch.js/es/lib/utils/index.js';
|
|
13
5
|
import React from 'react';
|
|
14
|
-
import { ReverseHighlight as
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
attribute =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
6
|
+
import { ReverseHighlight as ReverseHighlight$1 } from '../ui/ReverseHighlight.js';
|
|
7
|
+
|
|
8
|
+
function ReverseHighlight(_0) {
|
|
9
|
+
var hit = _0.hit, attribute = _0.attribute, highlightedTagName = _0.highlightedTagName, nonHighlightedTagName = _0.nonHighlightedTagName, separator = _0.separator, props = _(_0, [
|
|
10
|
+
"hit",
|
|
11
|
+
"attribute",
|
|
12
|
+
"highlightedTagName",
|
|
13
|
+
"nonHighlightedTagName",
|
|
14
|
+
"separator"
|
|
15
|
+
]);
|
|
16
|
+
var property = getPropertyByPath(hit._highlightResult, attribute) || [];
|
|
17
|
+
var properties = Array.isArray(property) ? property : [
|
|
18
|
+
property
|
|
19
|
+
];
|
|
20
|
+
var parts = properties.map(function(singleValue) {
|
|
21
|
+
return getHighlightedParts(unescape(singleValue.value || '')).map(function(_0) {
|
|
22
|
+
var isHighlighted = _0.isHighlighted, rest = _(_0, [
|
|
23
|
+
"isHighlighted"
|
|
24
|
+
]);
|
|
25
|
+
return _$1(_$2({}, rest), {
|
|
26
|
+
isHighlighted: !isHighlighted
|
|
27
|
+
});
|
|
28
|
+
});
|
|
31
29
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
return /*#__PURE__*/ React.createElement(ReverseHighlight$1, _$1(_$2({}, props), {
|
|
31
|
+
parts: parts,
|
|
32
|
+
highlightedTagName: highlightedTagName,
|
|
33
|
+
nonHighlightedTagName: nonHighlightedTagName,
|
|
34
|
+
separator: separator
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { ReverseHighlight };
|
|
@@ -1,86 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
10
|
-
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."); }
|
|
11
|
-
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; } }
|
|
12
|
-
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; }
|
|
13
|
-
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; } }
|
|
14
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
|
-
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; }
|
|
16
|
-
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; }
|
|
17
|
-
import React, { useRef, useState } from 'react';
|
|
1
|
+
import { _ as _$2 } from '@swc/helpers/cjs/_object_spread.cjs';
|
|
2
|
+
import { _ } from '@swc/helpers/cjs/_object_without_properties.cjs';
|
|
3
|
+
import { _ as _$1 } from '@swc/helpers/cjs/_sliced_to_array.cjs';
|
|
4
|
+
import React, { useState, useRef } from 'react';
|
|
18
5
|
import { useSearchBox } from 'react-instantsearch-core';
|
|
19
|
-
import { SearchBox as
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
6
|
+
import { SearchBox as SearchBox$1 } from '../ui/SearchBox.js';
|
|
7
|
+
|
|
8
|
+
function SearchBox(_0) {
|
|
9
|
+
var queryHook = _0.queryHook, _0_searchAsYouType = _0.searchAsYouType, searchAsYouType = _0_searchAsYouType === void 0 ? true : _0_searchAsYouType, _0_ignoreCompositionEvents = _0.ignoreCompositionEvents, ignoreCompositionEvents = _0_ignoreCompositionEvents === void 0 ? false : _0_ignoreCompositionEvents, translations = _0.translations, props = _(_0, [
|
|
10
|
+
"queryHook",
|
|
11
|
+
"searchAsYouType",
|
|
12
|
+
"ignoreCompositionEvents",
|
|
13
|
+
"translations"
|
|
14
|
+
]);
|
|
15
|
+
var _useSearchBox = useSearchBox({
|
|
16
|
+
queryHook: queryHook
|
|
30
17
|
}, {
|
|
31
|
-
|
|
32
|
-
}),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
18
|
+
$$widgetType: 'ais.searchBox'
|
|
19
|
+
}), query = _useSearchBox.query, refine = _useSearchBox.refine, isSearchStalled = _useSearchBox.isSearchStalled;
|
|
20
|
+
var _useState = _$1(useState(query), 2), inputValue = _useState[0], setInputValue = _useState[1];
|
|
21
|
+
var inputRef = useRef(null);
|
|
22
|
+
function setQuery(newQuery) {
|
|
23
|
+
var isComposing = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
24
|
+
setInputValue(newQuery);
|
|
25
|
+
if (searchAsYouType && !(ignoreCompositionEvents && isComposing)) {
|
|
26
|
+
refine(newQuery);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function onReset() {
|
|
30
|
+
setQuery('');
|
|
31
|
+
if (!searchAsYouType) {
|
|
32
|
+
refine('');
|
|
33
|
+
}
|
|
46
34
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
setQuery('');
|
|
50
|
-
if (!searchAsYouType) {
|
|
51
|
-
refine('');
|
|
35
|
+
function onChange(event) {
|
|
36
|
+
setQuery(event.currentTarget.value, event.nativeEvent.isComposing);
|
|
52
37
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
38
|
+
function onSubmit(event) {
|
|
39
|
+
if (!searchAsYouType) {
|
|
40
|
+
refine(inputValue);
|
|
41
|
+
}
|
|
42
|
+
if (props.onSubmit) {
|
|
43
|
+
props.onSubmit(event);
|
|
44
|
+
}
|
|
60
45
|
}
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
// Track when the InstantSearch query changes to synchronize it with
|
|
47
|
+
// the React state.
|
|
48
|
+
// We bypass the state update if the input is focused to avoid concurrent
|
|
49
|
+
// updates when typing.
|
|
50
|
+
if (query !== inputValue && document.activeElement !== inputRef.current) {
|
|
51
|
+
setInputValue(query);
|
|
63
52
|
}
|
|
64
|
-
|
|
53
|
+
var uiProps = {
|
|
54
|
+
inputRef: inputRef,
|
|
55
|
+
isSearchStalled: isSearchStalled,
|
|
56
|
+
onChange: onChange,
|
|
57
|
+
onReset: onReset,
|
|
58
|
+
onSubmit: onSubmit,
|
|
59
|
+
value: inputValue,
|
|
60
|
+
translations: _$2({
|
|
61
|
+
submitButtonTitle: 'Submit the search query',
|
|
62
|
+
resetButtonTitle: 'Clear the search query'
|
|
63
|
+
}, translations)
|
|
64
|
+
};
|
|
65
|
+
return /*#__PURE__*/ React.createElement(SearchBox$1, _$2({}, props, uiProps));
|
|
66
|
+
}
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
// the React state.
|
|
68
|
-
// We bypass the state update if the input is focused to avoid concurrent
|
|
69
|
-
// updates when typing.
|
|
70
|
-
if (query !== inputValue && document.activeElement !== inputRef.current) {
|
|
71
|
-
setInputValue(query);
|
|
72
|
-
}
|
|
73
|
-
var uiProps = {
|
|
74
|
-
inputRef: inputRef,
|
|
75
|
-
isSearchStalled: isSearchStalled,
|
|
76
|
-
onChange: onChange,
|
|
77
|
-
onReset: onReset,
|
|
78
|
-
onSubmit: onSubmit,
|
|
79
|
-
value: inputValue,
|
|
80
|
-
translations: _objectSpread({
|
|
81
|
-
submitButtonTitle: 'Submit the search query',
|
|
82
|
-
resetButtonTitle: 'Clear the search query'
|
|
83
|
-
}, translations)
|
|
84
|
-
};
|
|
85
|
-
return /*#__PURE__*/React.createElement(SearchBoxUiComponent, _extends({}, props, uiProps));
|
|
86
|
-
}
|
|
68
|
+
export { SearchBox };
|