react-instantsearch
Version:
⚡ Lightning-fast search for React, by Algolia
50 lines (46 loc) • 2.09 kB
JavaScript
;
var _object_spread = require('@swc/helpers/_/_object_spread');
var _object_without_properties = require('@swc/helpers/_/_object_without_properties');
var instantsearchUiComponents = require('instantsearch-ui-components');
var React = require('react');
var reactInstantsearchCore = require('react-instantsearch-core');
var FilterSuggestionsUiComponent = instantsearchUiComponents.createFilterSuggestionsComponent({
createElement: React.createElement,
Fragment: React.Fragment
});
function FilterSuggestions(_0) {
var agentId = _0.agentId, attributes = _0.attributes, maxSuggestions = _0.maxSuggestions, debounceMs = _0.debounceMs, hitsToSample = _0.hitsToSample, transformItems = _0.transformItems, itemComponent = _0.itemComponent, headerComponent = _0.headerComponent, emptyComponent = _0.emptyComponent, transport = _0.transport, props = _object_without_properties._(_0, [
"agentId",
"attributes",
"maxSuggestions",
"debounceMs",
"hitsToSample",
"transformItems",
"itemComponent",
"headerComponent",
"emptyComponent",
"transport"
]);
var _useFilterSuggestions = reactInstantsearchCore.useFilterSuggestions({
agentId: agentId,
attributes: attributes,
maxSuggestions: maxSuggestions,
debounceMs: debounceMs,
hitsToSample: hitsToSample,
transformItems: transformItems,
transport: transport
}, {
$$widgetType: 'ais.filterSuggestions'
}), suggestions = _useFilterSuggestions.suggestions, isLoading = _useFilterSuggestions.isLoading, refine = _useFilterSuggestions.refine;
var uiProps = {
suggestions: suggestions,
isLoading: isLoading,
refine: refine,
skeletonCount: maxSuggestions,
itemComponent: itemComponent,
headerComponent: headerComponent,
emptyComponent: emptyComponent
};
return /*#__PURE__*/ React.createElement(FilterSuggestionsUiComponent, _object_spread._({}, props, uiProps));
}
exports.FilterSuggestions = FilterSuggestions;