react-instantsearch 7.6.0 → 7.7.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/widgets/Hits.js +41 -10
- package/dist/es/widgets/Hits.d.ts +11 -4
- package/dist/es/widgets/Hits.js +37 -8
- package/dist/umd/ReactInstantSearch.js +95 -65
- 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 +9 -8
- package/dist/cjs/ui/Hits.js +0 -49
- package/dist/es/ui/Hits.d.ts +0 -31
- package/dist/es/ui/Hits.js +0 -42
package/dist/cjs/widgets/Hits.js
CHANGED
|
@@ -1,21 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.Hits = Hits;
|
|
7
|
-
var
|
|
8
|
+
var _instantsearchUiComponents = require("instantsearch-ui-components");
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
10
|
var _reactInstantsearchCore = require("react-instantsearch-core");
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
function
|
|
11
|
+
var _excluded = ["escapeHTML", "transformItems", "hitComponent"],
|
|
12
|
+
_excluded2 = ["hit", "index"];
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
15
|
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); }
|
|
13
16
|
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; }
|
|
14
17
|
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; }
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
// @MAJOR: Move default hit component back to the UI library
|
|
19
|
+
// once flavour specificities are erased
|
|
20
|
+
function DefaultHitComponent(_ref) {
|
|
21
|
+
var hit = _ref.hit;
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
23
|
+
style: {
|
|
24
|
+
wordBreak: 'break-all'
|
|
25
|
+
}
|
|
26
|
+
}, JSON.stringify(hit).slice(0, 100), "\u2026");
|
|
27
|
+
}
|
|
28
|
+
var HitsUiComponent = (0, _instantsearchUiComponents.createHitsComponent)({
|
|
29
|
+
createElement: _react.createElement,
|
|
30
|
+
Fragment: _react.Fragment
|
|
31
|
+
});
|
|
32
|
+
function Hits(_ref2) {
|
|
33
|
+
var escapeHTML = _ref2.escapeHTML,
|
|
34
|
+
transformItems = _ref2.transformItems,
|
|
35
|
+
_ref2$hitComponent = _ref2.hitComponent,
|
|
36
|
+
HitComponent = _ref2$hitComponent === void 0 ? DefaultHitComponent : _ref2$hitComponent,
|
|
37
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
19
38
|
var _useHits = (0, _reactInstantsearchCore.useHits)({
|
|
20
39
|
escapeHTML: escapeHTML,
|
|
21
40
|
transformItems: transformItems
|
|
@@ -24,9 +43,21 @@ function Hits(_ref) {
|
|
|
24
43
|
}),
|
|
25
44
|
hits = _useHits.hits,
|
|
26
45
|
sendEvent = _useHits.sendEvent;
|
|
46
|
+
var itemComponent = function itemComponent(_ref3) {
|
|
47
|
+
var hit = _ref3.hit,
|
|
48
|
+
index = _ref3.index,
|
|
49
|
+
itemProps = _objectWithoutProperties(_ref3, _excluded2);
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement("li", _extends({
|
|
51
|
+
key: hit.objectID
|
|
52
|
+
}, itemProps), /*#__PURE__*/_react.default.createElement(HitComponent, {
|
|
53
|
+
hit: hit,
|
|
54
|
+
sendEvent: sendEvent
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
27
57
|
var uiProps = {
|
|
28
58
|
hits: hits,
|
|
29
|
-
sendEvent: sendEvent
|
|
59
|
+
sendEvent: sendEvent,
|
|
60
|
+
itemComponent: itemComponent
|
|
30
61
|
};
|
|
31
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(HitsUiComponent, _extends({}, props, uiProps));
|
|
32
63
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { HitsProps as HitsUiComponentProps } from 'instantsearch-ui-components';
|
|
2
3
|
import type { Hit, BaseHit } from 'instantsearch.js';
|
|
4
|
+
import type { SendEventForHits } from 'instantsearch.js/es/lib/utils';
|
|
3
5
|
import type { UseHitsProps } from 'react-instantsearch-core';
|
|
4
|
-
type UiProps<THit extends BaseHit> = Pick<HitsUiComponentProps<Hit<THit>>, 'hits' | 'sendEvent'>;
|
|
5
|
-
export type HitsProps<THit extends BaseHit> = Omit<HitsUiComponentProps<Hit<THit>>, keyof UiProps<THit>> &
|
|
6
|
-
|
|
6
|
+
type UiProps<THit extends BaseHit> = Pick<HitsUiComponentProps<Hit<THit>>, 'hits' | 'sendEvent' | 'itemComponent' | 'emptyComponent'>;
|
|
7
|
+
export type HitsProps<THit extends BaseHit> = Omit<HitsUiComponentProps<Hit<THit>>, keyof UiProps<THit>> & {
|
|
8
|
+
hitComponent?: React.JSXElementConstructor<{
|
|
9
|
+
hit: Hit<THit>;
|
|
10
|
+
sendEvent: SendEventForHits;
|
|
11
|
+
}>;
|
|
12
|
+
} & UseHitsProps<THit>;
|
|
13
|
+
export declare function Hits<THit extends BaseHit = BaseHit>({ escapeHTML, transformItems, hitComponent: HitComponent, ...props }: HitsProps<THit>): JSX.Element;
|
|
7
14
|
export {};
|
package/dist/es/widgets/Hits.js
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
|
-
var _excluded = ["escapeHTML", "transformItems"]
|
|
1
|
+
var _excluded = ["escapeHTML", "transformItems", "hitComponent"],
|
|
2
|
+
_excluded2 = ["hit", "index"];
|
|
2
3
|
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); }
|
|
3
4
|
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
5
|
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
|
-
import
|
|
6
|
+
import { createHitsComponent } from 'instantsearch-ui-components';
|
|
7
|
+
import React, { createElement, Fragment } from 'react';
|
|
6
8
|
import { useHits } from 'react-instantsearch-core';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
// @MAJOR: Move default hit component back to the UI library
|
|
10
|
+
// once flavour specificities are erased
|
|
11
|
+
function DefaultHitComponent(_ref) {
|
|
12
|
+
var hit = _ref.hit;
|
|
13
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
style: {
|
|
15
|
+
wordBreak: 'break-all'
|
|
16
|
+
}
|
|
17
|
+
}, JSON.stringify(hit).slice(0, 100), "\u2026");
|
|
18
|
+
}
|
|
19
|
+
var HitsUiComponent = createHitsComponent({
|
|
20
|
+
createElement: createElement,
|
|
21
|
+
Fragment: Fragment
|
|
22
|
+
});
|
|
23
|
+
export function Hits(_ref2) {
|
|
24
|
+
var escapeHTML = _ref2.escapeHTML,
|
|
25
|
+
transformItems = _ref2.transformItems,
|
|
26
|
+
_ref2$hitComponent = _ref2.hitComponent,
|
|
27
|
+
HitComponent = _ref2$hitComponent === void 0 ? DefaultHitComponent : _ref2$hitComponent,
|
|
28
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
12
29
|
var _useHits = useHits({
|
|
13
30
|
escapeHTML: escapeHTML,
|
|
14
31
|
transformItems: transformItems
|
|
@@ -17,9 +34,21 @@ export function Hits(_ref) {
|
|
|
17
34
|
}),
|
|
18
35
|
hits = _useHits.hits,
|
|
19
36
|
sendEvent = _useHits.sendEvent;
|
|
37
|
+
var itemComponent = function itemComponent(_ref3) {
|
|
38
|
+
var hit = _ref3.hit,
|
|
39
|
+
index = _ref3.index,
|
|
40
|
+
itemProps = _objectWithoutProperties(_ref3, _excluded2);
|
|
41
|
+
return /*#__PURE__*/React.createElement("li", _extends({
|
|
42
|
+
key: hit.objectID
|
|
43
|
+
}, itemProps), /*#__PURE__*/React.createElement(HitComponent, {
|
|
44
|
+
hit: hit,
|
|
45
|
+
sendEvent: sendEvent
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
20
48
|
var uiProps = {
|
|
21
49
|
hits: hits,
|
|
22
|
-
sendEvent: sendEvent
|
|
50
|
+
sendEvent: sendEvent,
|
|
51
|
+
itemComponent: itemComponent
|
|
23
52
|
};
|
|
24
53
|
return /*#__PURE__*/React.createElement(HitsUiComponent, _extends({}, props, uiProps));
|
|
25
54
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
var React__default = 'default' in React ? React['default'] : React;
|
|
9
9
|
|
|
10
|
-
var version = '7.
|
|
10
|
+
var version = '7.7.0';
|
|
11
11
|
|
|
12
12
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
13
13
|
//
|
|
@@ -3942,7 +3942,8 @@
|
|
|
3942
3942
|
* @return {undefined} function mutates the item
|
|
3943
3943
|
*/
|
|
3944
3944
|
function setIsRefined(item, currentRefinement, depth) {
|
|
3945
|
-
item.isRefined =
|
|
3945
|
+
item.isRefined =
|
|
3946
|
+
item.name === (currentRefinement[depth] && currentRefinement[depth].trim());
|
|
3946
3947
|
if (item.data) {
|
|
3947
3948
|
item.data.forEach(function (child) {
|
|
3948
3949
|
setIsRefined(child, currentRefinement, depth + 1);
|
|
@@ -4343,7 +4344,7 @@
|
|
|
4343
4344
|
|
|
4344
4345
|
var SearchResults_1 = SearchResults;
|
|
4345
4346
|
|
|
4346
|
-
var version$1 = '3.16.
|
|
4347
|
+
var version$1 = '3.16.3';
|
|
4347
4348
|
|
|
4348
4349
|
var escapeFacetValue$3 = escapeFacetValue_1.escapeFacetValue;
|
|
4349
4350
|
|
|
@@ -12204,7 +12205,7 @@
|
|
|
12204
12205
|
};
|
|
12205
12206
|
}
|
|
12206
12207
|
|
|
12207
|
-
var version$3 = '4.
|
|
12208
|
+
var version$3 = '4.66.0';
|
|
12208
12209
|
|
|
12209
12210
|
function _typeof$o(obj) {
|
|
12210
12211
|
"@babel/helpers - typeof";
|
|
@@ -19098,8 +19099,6 @@
|
|
|
19098
19099
|
Fragment: Fragment
|
|
19099
19100
|
});
|
|
19100
19101
|
return function Highlight(userProps) {
|
|
19101
|
-
// Not destructured in function signature, to make sure it's not exposed in
|
|
19102
|
-
// the type definition.
|
|
19103
19102
|
var parts = userProps.parts,
|
|
19104
19103
|
_userProps$highlighte = userProps.highlightedTagName,
|
|
19105
19104
|
highlightedTagName = _userProps$highlighte === void 0 ? 'mark' : _userProps$highlighte,
|
|
@@ -19132,12 +19131,52 @@
|
|
|
19132
19131
|
};
|
|
19133
19132
|
}
|
|
19134
19133
|
|
|
19134
|
+
var _excluded$d = ["classNames", "hits", "itemComponent", "sendEvent", "emptyComponent"];
|
|
19135
|
+
|
|
19136
|
+
// Should be imported from a shared package in the future
|
|
19137
|
+
|
|
19138
|
+
function createHitsComponent(_ref) {
|
|
19139
|
+
var createElement = _ref.createElement;
|
|
19140
|
+
return function Hits(userProps) {
|
|
19141
|
+
var _userProps$classNames = userProps.classNames,
|
|
19142
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
19143
|
+
hits = userProps.hits,
|
|
19144
|
+
ItemComponent = userProps.itemComponent,
|
|
19145
|
+
sendEvent = userProps.sendEvent,
|
|
19146
|
+
EmptyComponent = userProps.emptyComponent,
|
|
19147
|
+
props = _objectWithoutProperties$d(userProps, _excluded$d);
|
|
19148
|
+
if (hits.length === 0 && EmptyComponent) {
|
|
19149
|
+
return createElement(EmptyComponent, {
|
|
19150
|
+
className: cx('ais-Hits', classNames.root, cx('ais-Hits--empty', classNames.emptyRoot), props.className)
|
|
19151
|
+
});
|
|
19152
|
+
}
|
|
19153
|
+
return createElement("div", _extends$2({}, props, {
|
|
19154
|
+
className: cx('ais-Hits', classNames.root, hits.length === 0 && cx('ais-Hits--empty', classNames.emptyRoot), props.className)
|
|
19155
|
+
}), createElement("ol", {
|
|
19156
|
+
className: cx('ais-Hits-list', classNames.list)
|
|
19157
|
+
}, hits.map(function (hit, index) {
|
|
19158
|
+
return createElement(ItemComponent, {
|
|
19159
|
+
key: hit.objectID,
|
|
19160
|
+
hit: hit,
|
|
19161
|
+
index: index,
|
|
19162
|
+
className: cx('ais-Hits-item', classNames.item),
|
|
19163
|
+
onClick: function onClick() {
|
|
19164
|
+
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
19165
|
+
},
|
|
19166
|
+
onAuxClick: function onAuxClick() {
|
|
19167
|
+
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
19168
|
+
}
|
|
19169
|
+
});
|
|
19170
|
+
})));
|
|
19171
|
+
};
|
|
19172
|
+
}
|
|
19173
|
+
|
|
19135
19174
|
function isModifierClick(event) {
|
|
19136
19175
|
var isMiddleClick = event.button === 1;
|
|
19137
19176
|
return Boolean(isMiddleClick || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey);
|
|
19138
19177
|
}
|
|
19139
19178
|
|
|
19140
|
-
var _excluded$
|
|
19179
|
+
var _excluded$e = ["classNames", "items", "hasItems", "createURL", "onNavigate", "separator", "translations"];
|
|
19141
19180
|
function Breadcrumb(_ref) {
|
|
19142
19181
|
var _ref$classNames = _ref.classNames,
|
|
19143
19182
|
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
@@ -19149,7 +19188,7 @@
|
|
|
19149
19188
|
_ref$separator = _ref.separator,
|
|
19150
19189
|
separator = _ref$separator === void 0 ? '>' : _ref$separator,
|
|
19151
19190
|
translations = _ref.translations,
|
|
19152
|
-
props = _objectWithoutProperties$c(_ref, _excluded$
|
|
19191
|
+
props = _objectWithoutProperties$c(_ref, _excluded$e);
|
|
19153
19192
|
var handleClick = function handleClick(value) {
|
|
19154
19193
|
return function (event) {
|
|
19155
19194
|
if (!isModifierClick(event)) {
|
|
@@ -19184,14 +19223,14 @@
|
|
|
19184
19223
|
})));
|
|
19185
19224
|
}
|
|
19186
19225
|
|
|
19187
|
-
var _excluded$
|
|
19226
|
+
var _excluded$f = ["attributes", "rootPath", "separator", "transformItems", "translations"];
|
|
19188
19227
|
function Breadcrumb$1(_ref) {
|
|
19189
19228
|
var attributes = _ref.attributes,
|
|
19190
19229
|
rootPath = _ref.rootPath,
|
|
19191
19230
|
separator = _ref.separator,
|
|
19192
19231
|
transformItems = _ref.transformItems,
|
|
19193
19232
|
translations = _ref.translations,
|
|
19194
|
-
props = _objectWithoutProperties$c(_ref, _excluded$
|
|
19233
|
+
props = _objectWithoutProperties$c(_ref, _excluded$f);
|
|
19195
19234
|
var _useBreadcrumb = useBreadcrumb({
|
|
19196
19235
|
attributes: attributes,
|
|
19197
19236
|
rootPath: rootPath,
|
|
@@ -19215,7 +19254,7 @@
|
|
|
19215
19254
|
return /*#__PURE__*/React__default.createElement(Breadcrumb, _extends$1({}, props, uiProps));
|
|
19216
19255
|
}
|
|
19217
19256
|
|
|
19218
|
-
var _excluded$
|
|
19257
|
+
var _excluded$g = ["classNames", "disabled", "onClick", "translations"];
|
|
19219
19258
|
function ClearRefinements(_ref) {
|
|
19220
19259
|
var _ref$classNames = _ref.classNames,
|
|
19221
19260
|
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
@@ -19224,7 +19263,7 @@
|
|
|
19224
19263
|
_ref$onClick = _ref.onClick,
|
|
19225
19264
|
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
19226
19265
|
translations = _ref.translations,
|
|
19227
|
-
props = _objectWithoutProperties$c(_ref, _excluded$
|
|
19266
|
+
props = _objectWithoutProperties$c(_ref, _excluded$g);
|
|
19228
19267
|
return /*#__PURE__*/React__default.createElement("div", _extends$1({}, props, {
|
|
19229
19268
|
className: cx('ais-ClearRefinements', classNames.root, props.className)
|
|
19230
19269
|
}), /*#__PURE__*/React__default.createElement("button", {
|
|
@@ -19234,13 +19273,13 @@
|
|
|
19234
19273
|
}, translations.resetButtonText));
|
|
19235
19274
|
}
|
|
19236
19275
|
|
|
19237
|
-
var _excluded$
|
|
19276
|
+
var _excluded$h = ["includedAttributes", "excludedAttributes", "transformItems", "translations"];
|
|
19238
19277
|
function ClearRefinements$1(_ref) {
|
|
19239
19278
|
var includedAttributes = _ref.includedAttributes,
|
|
19240
19279
|
excludedAttributes = _ref.excludedAttributes,
|
|
19241
19280
|
transformItems = _ref.transformItems,
|
|
19242
19281
|
translations = _ref.translations,
|
|
19243
|
-
props = _objectWithoutProperties$c(_ref, _excluded$
|
|
19282
|
+
props = _objectWithoutProperties$c(_ref, _excluded$h);
|
|
19244
19283
|
var _useClearRefinements = useClearRefinements({
|
|
19245
19284
|
includedAttributes: includedAttributes,
|
|
19246
19285
|
excludedAttributes: excludedAttributes,
|
|
@@ -19264,7 +19303,7 @@
|
|
|
19264
19303
|
return text.toString().charAt(0).toUpperCase() + text.toString().slice(1);
|
|
19265
19304
|
}
|
|
19266
19305
|
|
|
19267
|
-
var _excluded$
|
|
19306
|
+
var _excluded$i = ["classNames", "items", "hasRefinements"];
|
|
19268
19307
|
function CurrentRefinements(_ref) {
|
|
19269
19308
|
var _ref$classNames = _ref.classNames,
|
|
19270
19309
|
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
@@ -19272,7 +19311,7 @@
|
|
|
19272
19311
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
19273
19312
|
_ref$hasRefinements = _ref.hasRefinements,
|
|
19274
19313
|
hasRefinements = _ref$hasRefinements === void 0 ? false : _ref$hasRefinements,
|
|
19275
|
-
props = _objectWithoutProperties$c(_ref, _excluded$
|
|
19314
|
+
props = _objectWithoutProperties$c(_ref, _excluded$i);
|
|
19276
19315
|
return /*#__PURE__*/React__default.createElement("div", _extends$1({}, props, {
|
|
19277
19316
|
className: cx('ais-CurrentRefinements', classNames.root, !hasRefinements && cx('ais-CurrentRefinements--noRefinement', classNames.noRefinementRoot), props.className)
|
|
19278
19317
|
}), /*#__PURE__*/React__default.createElement("ul", {
|
|
@@ -19304,12 +19343,12 @@
|
|
|
19304
19343
|
})));
|
|
19305
19344
|
}
|
|
19306
19345
|
|
|
19307
|
-
var _excluded$
|
|
19346
|
+
var _excluded$j = ["includedAttributes", "excludedAttributes", "transformItems"];
|
|
19308
19347
|
function CurrentRefinements$1(_ref) {
|
|
19309
19348
|
var includedAttributes = _ref.includedAttributes,
|
|
19310
19349
|
excludedAttributes = _ref.excludedAttributes,
|
|
19311
19350
|
transformItems = _ref.transformItems,
|
|
19312
|
-
props = _objectWithoutProperties$c(_ref, _excluded$
|
|
19351
|
+
props = _objectWithoutProperties$c(_ref, _excluded$j);
|
|
19313
19352
|
var _useCurrentRefinement = useCurrentRefinements({
|
|
19314
19353
|
includedAttributes: includedAttributes,
|
|
19315
19354
|
excludedAttributes: excludedAttributes,
|
|
@@ -19326,17 +19365,17 @@
|
|
|
19326
19365
|
return /*#__PURE__*/React__default.createElement(CurrentRefinements, _extends$1({}, props, uiProps));
|
|
19327
19366
|
}
|
|
19328
19367
|
|
|
19329
|
-
var _excluded$
|
|
19368
|
+
var _excluded$k = ["isShowingMore", "translations"];
|
|
19330
19369
|
function ShowMoreButton(_ref) {
|
|
19331
19370
|
var isShowingMore = _ref.isShowingMore,
|
|
19332
19371
|
translations = _ref.translations,
|
|
19333
|
-
props = _objectWithoutProperties$c(_ref, _excluded$
|
|
19372
|
+
props = _objectWithoutProperties$c(_ref, _excluded$k);
|
|
19334
19373
|
return /*#__PURE__*/React__default.createElement("button", props, translations.showMoreButtonText({
|
|
19335
19374
|
isShowingMore: isShowingMore
|
|
19336
19375
|
}));
|
|
19337
19376
|
}
|
|
19338
19377
|
|
|
19339
|
-
var _excluded$
|
|
19378
|
+
var _excluded$l = ["classNames", "items", "hasItems", "onNavigate", "createURL", "showMore", "canToggleShowMore", "onToggleShowMore", "isShowingMore", "translations"];
|
|
19340
19379
|
function HierarchicalList(_ref) {
|
|
19341
19380
|
var className = _ref.className,
|
|
19342
19381
|
_ref$classNames = _ref.classNames,
|
|
@@ -19388,7 +19427,7 @@
|
|
|
19388
19427
|
onToggleShowMore = _ref2.onToggleShowMore,
|
|
19389
19428
|
isShowingMore = _ref2.isShowingMore,
|
|
19390
19429
|
translations = _ref2.translations,
|
|
19391
|
-
props = _objectWithoutProperties$c(_ref2, _excluded$
|
|
19430
|
+
props = _objectWithoutProperties$c(_ref2, _excluded$l);
|
|
19392
19431
|
return /*#__PURE__*/React__default.createElement("div", _extends$1({}, props, {
|
|
19393
19432
|
className: cx('ais-HierarchicalMenu', classNames.root, !hasItems && cx('ais-HierarchicalMenu--noRefinement', classNames.noRefinementRoot), props.className)
|
|
19394
19433
|
}), /*#__PURE__*/React__default.createElement(HierarchicalList, {
|
|
@@ -19405,7 +19444,7 @@
|
|
|
19405
19444
|
}));
|
|
19406
19445
|
}
|
|
19407
19446
|
|
|
19408
|
-
var _excluded$
|
|
19447
|
+
var _excluded$m = ["attributes", "limit", "rootPath", "separator", "showMore", "showMoreLimit", "showParentLevel", "sortBy", "transformItems", "translations"];
|
|
19409
19448
|
function HierarchicalMenu$1(_ref) {
|
|
19410
19449
|
var attributes = _ref.attributes,
|
|
19411
19450
|
limit = _ref.limit,
|
|
@@ -19417,7 +19456,7 @@
|
|
|
19417
19456
|
sortBy = _ref.sortBy,
|
|
19418
19457
|
transformItems = _ref.transformItems,
|
|
19419
19458
|
translations = _ref.translations,
|
|
19420
|
-
props = _objectWithoutProperties$c(_ref, _excluded$
|
|
19459
|
+
props = _objectWithoutProperties$c(_ref, _excluded$m);
|
|
19421
19460
|
var _useHierarchicalMenu = useHierarchicalMenu({
|
|
19422
19461
|
attributes: attributes,
|
|
19423
19462
|
limit: limit,
|
|
@@ -19462,11 +19501,11 @@
|
|
|
19462
19501
|
Fragment: React.Fragment
|
|
19463
19502
|
});
|
|
19464
19503
|
|
|
19465
|
-
var _excluded$
|
|
19504
|
+
var _excluded$n = ["classNames"];
|
|
19466
19505
|
function Highlight(_ref) {
|
|
19467
19506
|
var _ref$classNames = _ref.classNames,
|
|
19468
19507
|
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
19469
|
-
props = _objectWithoutProperties$c(_ref, _excluded$
|
|
19508
|
+
props = _objectWithoutProperties$c(_ref, _excluded$n);
|
|
19470
19509
|
return /*#__PURE__*/React__default.createElement(InternalHighlight, _extends$1({
|
|
19471
19510
|
classNames: {
|
|
19472
19511
|
root: cx('ais-Highlight', classNames.root),
|
|
@@ -19477,14 +19516,14 @@
|
|
|
19477
19516
|
}, props));
|
|
19478
19517
|
}
|
|
19479
19518
|
|
|
19480
|
-
var _excluded$
|
|
19519
|
+
var _excluded$o = ["hit", "attribute", "highlightedTagName", "nonHighlightedTagName", "separator"];
|
|
19481
19520
|
function Highlight$1(_ref) {
|
|
19482
19521
|
var hit = _ref.hit,
|
|
19483
19522
|
attribute = _ref.attribute,
|
|
19484
19523
|
highlightedTagName = _ref.highlightedTagName,
|
|
19485
19524
|
nonHighlightedTagName = _ref.nonHighlightedTagName,
|
|
19486
19525
|
separator = _ref.separator,
|
|
19487
|
-
props = _objectWithoutProperties$c(_ref, _excluded$
|
|
19526
|
+
props = _objectWithoutProperties$c(_ref, _excluded$o);
|
|
19488
19527
|
var property = getPropertyByPath(hit._highlightResult, attribute) || [];
|
|
19489
19528
|
var properties = Array.isArray(property) ? property : [property];
|
|
19490
19529
|
var parts = properties.map(function (singleValue) {
|
|
@@ -19498,7 +19537,10 @@
|
|
|
19498
19537
|
}));
|
|
19499
19538
|
}
|
|
19500
19539
|
|
|
19501
|
-
var _excluded$
|
|
19540
|
+
var _excluded$p = ["escapeHTML", "transformItems", "hitComponent"],
|
|
19541
|
+
_excluded2$3 = ["hit", "index"];
|
|
19542
|
+
// @MAJOR: Move default hit component back to the UI library
|
|
19543
|
+
// once flavour specificities are erased
|
|
19502
19544
|
function DefaultHitComponent(_ref) {
|
|
19503
19545
|
var hit = _ref.hit;
|
|
19504
19546
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -19507,40 +19549,16 @@
|
|
|
19507
19549
|
}
|
|
19508
19550
|
}, JSON.stringify(hit).slice(0, 100), "\u2026");
|
|
19509
19551
|
}
|
|
19552
|
+
var HitsUiComponent = createHitsComponent({
|
|
19553
|
+
createElement: React.createElement,
|
|
19554
|
+
Fragment: React.Fragment
|
|
19555
|
+
});
|
|
19510
19556
|
function Hits(_ref2) {
|
|
19511
|
-
var
|
|
19512
|
-
|
|
19557
|
+
var escapeHTML = _ref2.escapeHTML,
|
|
19558
|
+
transformItems = _ref2.transformItems,
|
|
19513
19559
|
_ref2$hitComponent = _ref2.hitComponent,
|
|
19514
19560
|
HitComponent = _ref2$hitComponent === void 0 ? DefaultHitComponent : _ref2$hitComponent,
|
|
19515
|
-
|
|
19516
|
-
classNames = _ref2$classNames === void 0 ? {} : _ref2$classNames,
|
|
19517
|
-
props = _objectWithoutProperties$c(_ref2, _excluded$o);
|
|
19518
|
-
return /*#__PURE__*/React__default.createElement("div", _extends$1({}, props, {
|
|
19519
|
-
className: cx('ais-Hits', classNames.root, hits.length === 0 && cx('ais-Hits--empty', classNames.emptyRoot), props.className)
|
|
19520
|
-
}), /*#__PURE__*/React__default.createElement("ol", {
|
|
19521
|
-
className: cx('ais-Hits-list', classNames.list)
|
|
19522
|
-
}, hits.map(function (hit) {
|
|
19523
|
-
return /*#__PURE__*/React__default.createElement("li", {
|
|
19524
|
-
key: hit.objectID,
|
|
19525
|
-
className: cx('ais-Hits-item', classNames.item),
|
|
19526
|
-
onClick: function onClick() {
|
|
19527
|
-
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
19528
|
-
},
|
|
19529
|
-
onAuxClick: function onAuxClick() {
|
|
19530
|
-
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
19531
|
-
}
|
|
19532
|
-
}, /*#__PURE__*/React__default.createElement(HitComponent, {
|
|
19533
|
-
hit: hit,
|
|
19534
|
-
sendEvent: sendEvent
|
|
19535
|
-
}));
|
|
19536
|
-
})));
|
|
19537
|
-
}
|
|
19538
|
-
|
|
19539
|
-
var _excluded$p = ["escapeHTML", "transformItems"];
|
|
19540
|
-
function Hits$1(_ref) {
|
|
19541
|
-
var escapeHTML = _ref.escapeHTML,
|
|
19542
|
-
transformItems = _ref.transformItems,
|
|
19543
|
-
props = _objectWithoutProperties$c(_ref, _excluded$p);
|
|
19561
|
+
props = _objectWithoutProperties$c(_ref2, _excluded$p);
|
|
19544
19562
|
var _useHits = useHits({
|
|
19545
19563
|
escapeHTML: escapeHTML,
|
|
19546
19564
|
transformItems: transformItems
|
|
@@ -19549,11 +19567,23 @@
|
|
|
19549
19567
|
}),
|
|
19550
19568
|
hits = _useHits.hits,
|
|
19551
19569
|
sendEvent = _useHits.sendEvent;
|
|
19570
|
+
var itemComponent = function itemComponent(_ref3) {
|
|
19571
|
+
var hit = _ref3.hit,
|
|
19572
|
+
index = _ref3.index,
|
|
19573
|
+
itemProps = _objectWithoutProperties$c(_ref3, _excluded2$3);
|
|
19574
|
+
return /*#__PURE__*/React__default.createElement("li", _extends$1({
|
|
19575
|
+
key: hit.objectID
|
|
19576
|
+
}, itemProps), /*#__PURE__*/React__default.createElement(HitComponent, {
|
|
19577
|
+
hit: hit,
|
|
19578
|
+
sendEvent: sendEvent
|
|
19579
|
+
}));
|
|
19580
|
+
};
|
|
19552
19581
|
var uiProps = {
|
|
19553
19582
|
hits: hits,
|
|
19554
|
-
sendEvent: sendEvent
|
|
19583
|
+
sendEvent: sendEvent,
|
|
19584
|
+
itemComponent: itemComponent
|
|
19555
19585
|
};
|
|
19556
|
-
return /*#__PURE__*/React__default.createElement(
|
|
19586
|
+
return /*#__PURE__*/React__default.createElement(HitsUiComponent, _extends$1({}, props, uiProps));
|
|
19557
19587
|
}
|
|
19558
19588
|
|
|
19559
19589
|
var _excluded$q = ["items", "onChange", "currentValue", "classNames"];
|
|
@@ -19788,7 +19818,7 @@
|
|
|
19788
19818
|
}
|
|
19789
19819
|
|
|
19790
19820
|
var _excluded$w = ["pages", "currentPage", "nbPages", "isFirstPage", "isLastPage", "showFirst", "showPrevious", "showNext", "showLast", "createURL", "onNavigate", "translations", "classNames"],
|
|
19791
|
-
_excluded2$
|
|
19821
|
+
_excluded2$4 = ["isDisabled", "className", "classNames", "href", "onClick"];
|
|
19792
19822
|
function Pagination(_ref) {
|
|
19793
19823
|
var pages = _ref.pages,
|
|
19794
19824
|
currentPage = _ref.currentPage,
|
|
@@ -19879,7 +19909,7 @@
|
|
|
19879
19909
|
classNames = _ref2.classNames,
|
|
19880
19910
|
href = _ref2.href,
|
|
19881
19911
|
_onClick = _ref2.onClick,
|
|
19882
|
-
props = _objectWithoutProperties$c(_ref2, _excluded2$
|
|
19912
|
+
props = _objectWithoutProperties$c(_ref2, _excluded2$4);
|
|
19883
19913
|
if (isDisabled) {
|
|
19884
19914
|
return /*#__PURE__*/React__default.createElement("li", {
|
|
19885
19915
|
className: cx('ais-Pagination-item', classNames.item, 'ais-Pagination-item--disabled', classNames.disabledItem, className)
|
|
@@ -20728,7 +20758,7 @@
|
|
|
20728
20758
|
exports.DynamicWidgets = DynamicWidgets;
|
|
20729
20759
|
exports.HierarchicalMenu = HierarchicalMenu$1;
|
|
20730
20760
|
exports.Highlight = Highlight$1;
|
|
20731
|
-
exports.Hits = Hits
|
|
20761
|
+
exports.Hits = Hits;
|
|
20732
20762
|
exports.HitsPerPage = HitsPerPage$1;
|
|
20733
20763
|
exports.Index = Index;
|
|
20734
20764
|
exports.InfiniteHits = InfiniteHits$1;
|