react-instantsearch 6.40.4 → 7.0.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/README.md +113 -2
- package/dist/cjs/index.js +27 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/types/PartialKeys.js +1 -0
- package/dist/cjs/types/Translatable.js +1 -0
- package/dist/cjs/types/index.js +27 -0
- package/dist/cjs/ui/Breadcrumb.js +59 -0
- package/dist/cjs/ui/ClearRefinements.js +30 -0
- package/dist/cjs/ui/CurrentRefinements.js +53 -0
- package/dist/cjs/ui/HierarchicalMenu.js +82 -0
- package/dist/cjs/ui/Highlight.js +27 -0
- package/dist/cjs/ui/Hits.js +49 -0
- package/dist/cjs/ui/HitsPerPage.js +36 -0
- package/dist/cjs/ui/InfiniteHits.js +62 -0
- package/dist/cjs/ui/InternalHighlight.js +56 -0
- package/dist/cjs/ui/Menu.js +54 -0
- package/dist/cjs/ui/Pagination.js +127 -0
- package/dist/cjs/ui/PoweredBy.js +39 -0
- package/dist/cjs/ui/RangeInput.js +124 -0
- package/dist/cjs/ui/RefinementList.js +69 -0
- package/dist/cjs/ui/SearchBox.js +153 -0
- package/dist/cjs/ui/ShowMoreButton.js +19 -0
- package/dist/cjs/ui/Snippet.js +27 -0
- package/dist/cjs/ui/SortBy.js +37 -0
- package/dist/cjs/ui/Stats.js +34 -0
- package/dist/cjs/ui/ToggleRefinement.js +35 -0
- package/dist/cjs/ui/lib/cx.js +12 -0
- package/dist/cjs/ui/lib/isModifierClick.js +10 -0
- package/dist/cjs/widgets/Breadcrumb.js +49 -0
- package/dist/cjs/widgets/ClearRefinements.js +44 -0
- package/dist/cjs/widgets/CurrentRefinements.js +36 -0
- package/dist/cjs/widgets/HierarchicalMenu.js +70 -0
- package/dist/cjs/widgets/Highlight.js +33 -0
- package/dist/cjs/widgets/Hits.js +32 -0
- package/dist/cjs/widgets/HitsPerPage.js +40 -0
- package/dist/cjs/widgets/InfiniteHits.js +57 -0
- package/dist/cjs/widgets/Menu.js +64 -0
- package/dist/cjs/widgets/Pagination.js +76 -0
- package/dist/cjs/widgets/PoweredBy.js +19 -0
- package/dist/cjs/widgets/RangeInput.js +53 -0
- package/dist/cjs/widgets/RefinementList.js +124 -0
- package/dist/cjs/widgets/SearchBox.js +91 -0
- package/dist/cjs/widgets/Snippet.js +33 -0
- package/dist/cjs/widgets/SortBy.js +34 -0
- package/dist/cjs/widgets/Stats.js +43 -0
- package/dist/cjs/widgets/ToggleRefinement.js +40 -0
- package/dist/cjs/widgets/index.js +203 -0
- package/dist/es/index.d.ts +2 -0
- package/dist/es/index.js +2 -1
- package/dist/es/types/PartialKeys.d.ts +4 -0
- package/dist/es/types/PartialKeys.js +1 -0
- package/dist/es/types/Translatable.d.ts +5 -0
- package/dist/es/types/Translatable.js +1 -0
- package/dist/es/types/index.d.ts +2 -0
- package/dist/es/types/index.js +2 -0
- package/dist/es/ui/Breadcrumb.d.ts +48 -0
- package/dist/es/ui/Breadcrumb.js +52 -0
- package/dist/es/ui/ClearRefinements.d.ts +26 -0
- package/dist/es/ui/ClearRefinements.js +23 -0
- package/dist/es/ui/CurrentRefinements.d.ts +47 -0
- package/dist/es/ui/CurrentRefinements.js +46 -0
- package/dist/es/ui/HierarchicalMenu.d.ts +73 -0
- package/dist/es/ui/HierarchicalMenu.js +75 -0
- package/dist/es/ui/Highlight.d.ts +6 -0
- package/dist/es/ui/Highlight.js +20 -0
- package/dist/es/ui/Hits.d.ts +31 -0
- package/dist/es/ui/Hits.js +42 -0
- package/dist/es/ui/HitsPerPage.d.ts +23 -0
- package/dist/es/ui/HitsPerPage.js +29 -0
- package/dist/es/ui/InfiniteHits.d.ts +56 -0
- package/dist/es/ui/InfiniteHits.js +55 -0
- package/dist/es/ui/InternalHighlight.d.ts +32 -0
- package/dist/es/ui/InternalHighlight.js +47 -0
- package/dist/es/ui/Menu.d.ts +59 -0
- package/dist/es/ui/Menu.js +47 -0
- package/dist/es/ui/Pagination.d.ts +121 -0
- package/dist/es/ui/Pagination.js +120 -0
- package/dist/es/ui/PoweredBy.d.ts +29 -0
- package/dist/es/ui/PoweredBy.js +32 -0
- package/dist/es/ui/RangeInput.d.ts +60 -0
- package/dist/es/ui/RangeInput.js +115 -0
- package/dist/es/ui/RefinementList.d.ts +73 -0
- package/dist/es/ui/RefinementList.js +62 -0
- package/dist/es/ui/SearchBox.d.ts +64 -0
- package/dist/es/ui/SearchBox.js +146 -0
- package/dist/es/ui/ShowMoreButton.d.ts +19 -0
- package/dist/es/ui/ShowMoreButton.js +12 -0
- package/dist/es/ui/Snippet.d.ts +6 -0
- package/dist/es/ui/Snippet.js +20 -0
- package/dist/es/ui/SortBy.d.ts +21 -0
- package/dist/es/ui/SortBy.js +30 -0
- package/dist/es/ui/Stats.d.ts +20 -0
- package/dist/es/ui/Stats.js +27 -0
- package/dist/es/ui/ToggleRefinement.d.ts +25 -0
- package/dist/es/ui/ToggleRefinement.js +28 -0
- package/dist/es/ui/lib/cx.d.ts +1 -0
- package/dist/es/ui/lib/cx.js +6 -0
- package/dist/es/ui/lib/isModifierClick.d.ts +2 -0
- package/dist/es/ui/lib/isModifierClick.js +4 -0
- package/dist/es/widgets/Breadcrumb.d.ts +8 -0
- package/dist/es/widgets/Breadcrumb.js +42 -0
- package/dist/es/widgets/ClearRefinements.d.ts +8 -0
- package/dist/es/widgets/ClearRefinements.js +37 -0
- package/dist/es/widgets/CurrentRefinements.d.ts +6 -0
- package/dist/es/widgets/CurrentRefinements.js +29 -0
- package/dist/es/widgets/HierarchicalMenu.d.ts +8 -0
- package/dist/es/widgets/HierarchicalMenu.js +63 -0
- package/dist/es/widgets/Highlight.d.ts +8 -0
- package/dist/es/widgets/Highlight.js +26 -0
- package/dist/es/widgets/Hits.d.ts +7 -0
- package/dist/es/widgets/Hits.js +25 -0
- package/dist/es/widgets/HitsPerPage.d.ts +6 -0
- package/dist/es/widgets/HitsPerPage.js +33 -0
- package/dist/es/widgets/InfiniteHits.d.ts +15 -0
- package/dist/es/widgets/InfiniteHits.js +50 -0
- package/dist/es/widgets/Menu.d.ts +8 -0
- package/dist/es/widgets/Menu.js +57 -0
- package/dist/es/widgets/Pagination.d.ts +8 -0
- package/dist/es/widgets/Pagination.js +69 -0
- package/dist/es/widgets/PoweredBy.d.ts +5 -0
- package/dist/es/widgets/PoweredBy.js +12 -0
- package/dist/es/widgets/RangeInput.d.ts +8 -0
- package/dist/es/widgets/RangeInput.js +46 -0
- package/dist/es/widgets/RefinementList.d.ts +15 -0
- package/dist/es/widgets/RefinementList.js +116 -0
- package/dist/es/widgets/SearchBox.d.ts +13 -0
- package/dist/es/widgets/SearchBox.js +83 -0
- package/dist/es/widgets/Snippet.d.ts +8 -0
- package/dist/es/widgets/Snippet.js +26 -0
- package/dist/es/widgets/SortBy.d.ts +6 -0
- package/dist/es/widgets/SortBy.js +27 -0
- package/dist/es/widgets/Stats.d.ts +8 -0
- package/dist/es/widgets/Stats.js +36 -0
- package/dist/es/widgets/ToggleRefinement.d.ts +7 -0
- package/dist/es/widgets/ToggleRefinement.js +33 -0
- package/dist/es/widgets/index.d.ts +18 -0
- package/dist/es/widgets/index.js +18 -0
- package/dist/umd/ReactInstantSearch.js +19990 -0
- package/dist/umd/ReactInstantSearch.js.map +1 -0
- package/dist/umd/ReactInstantSearch.min.js +3 -0
- package/dist/umd/ReactInstantSearch.min.js.map +1 -0
- package/package.json +28 -24
- package/connectors.js +0 -29
- package/dist/README.md +0 -101
- package/dist/connectors.js +0 -168
- package/dist/dom.js +0 -198
- package/dist/es/connectors.js +0 -26
- package/dist/es/dom.js +0 -31
- package/dist/es/native.js +0 -5
- package/dist/es/server.js +0 -1
- package/dist/index.js +0 -12
- package/dist/native.js +0 -42
- package/dist/package.json +0 -56
- package/dist/server.js +0 -12
- package/dist/umd/Connectors.js +0 -11215
- package/dist/umd/Connectors.js.map +0 -1
- package/dist/umd/Connectors.min.js +0 -3
- package/dist/umd/Connectors.min.js.map +0 -1
- package/dist/umd/Core.js +0 -650
- package/dist/umd/Core.js.map +0 -1
- package/dist/umd/Core.min.js +0 -3
- package/dist/umd/Core.min.js.map +0 -1
- package/dist/umd/Dom.js +0 -18935
- package/dist/umd/Dom.js.map +0 -1
- package/dist/umd/Dom.min.js +0 -3
- package/dist/umd/Dom.min.js.map +0 -1
- package/dom.js +0 -34
- package/index.js +0 -1
- package/native.js +0 -8
- package/server.js +0 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
var _excluded = ["formRef", "inputRef", "isSearchStalled", "onChange", "onReset", "onSubmit", "placeholder", "value", "autoFocus", "resetIconComponent", "submitIconComponent", "loadingIconComponent", "classNames", "translations"];
|
|
2
|
+
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
|
+
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
|
+
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 React from 'react';
|
|
6
|
+
import { cx } from "./lib/cx.js";
|
|
7
|
+
var _ref2 = /*#__PURE__*/React.createElement("path", {
|
|
8
|
+
d: "M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z"
|
|
9
|
+
});
|
|
10
|
+
function DefaultSubmitIcon(_ref) {
|
|
11
|
+
var classNames = _ref.classNames;
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
13
|
+
className: cx('ais-SearchBox-submitIcon', classNames.submitIcon),
|
|
14
|
+
width: "10",
|
|
15
|
+
height: "10",
|
|
16
|
+
viewBox: "0 0 40 40",
|
|
17
|
+
"aria-hidden": "true"
|
|
18
|
+
}, _ref2);
|
|
19
|
+
}
|
|
20
|
+
var _ref4 = /*#__PURE__*/React.createElement("path", {
|
|
21
|
+
d: "M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z"
|
|
22
|
+
});
|
|
23
|
+
function DefaultResetIcon(_ref3) {
|
|
24
|
+
var classNames = _ref3.classNames;
|
|
25
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
26
|
+
className: cx('ais-SearchBox-resetIcon', classNames.resetIcon),
|
|
27
|
+
viewBox: "0 0 20 20",
|
|
28
|
+
width: "10",
|
|
29
|
+
height: "10",
|
|
30
|
+
"aria-hidden": "true"
|
|
31
|
+
}, _ref4);
|
|
32
|
+
}
|
|
33
|
+
var _ref6 = /*#__PURE__*/React.createElement("g", {
|
|
34
|
+
fill: "none",
|
|
35
|
+
fillRule: "evenodd"
|
|
36
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
37
|
+
transform: "translate(1 1)",
|
|
38
|
+
strokeWidth: "2"
|
|
39
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
40
|
+
strokeOpacity: ".5",
|
|
41
|
+
cx: "18",
|
|
42
|
+
cy: "18",
|
|
43
|
+
r: "18"
|
|
44
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
45
|
+
d: "M36 18c0-9.94-8.06-18-18-18"
|
|
46
|
+
}, /*#__PURE__*/React.createElement("animateTransform", {
|
|
47
|
+
attributeName: "transform",
|
|
48
|
+
type: "rotate",
|
|
49
|
+
from: "0 18 18",
|
|
50
|
+
to: "360 18 18",
|
|
51
|
+
dur: "1s",
|
|
52
|
+
repeatCount: "indefinite"
|
|
53
|
+
}))));
|
|
54
|
+
function DefaultLoadingIcon(_ref5) {
|
|
55
|
+
var classNames = _ref5.classNames;
|
|
56
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
57
|
+
width: "16",
|
|
58
|
+
height: "16",
|
|
59
|
+
viewBox: "0 0 38 38",
|
|
60
|
+
stroke: "#444",
|
|
61
|
+
className: cx('ais-SearchBox-loadingIcon', classNames.loadingIcon),
|
|
62
|
+
"aria-hidden": "true"
|
|
63
|
+
}, _ref6);
|
|
64
|
+
}
|
|
65
|
+
export function SearchBox(_ref7) {
|
|
66
|
+
var formRef = _ref7.formRef,
|
|
67
|
+
inputRef = _ref7.inputRef,
|
|
68
|
+
isSearchStalled = _ref7.isSearchStalled,
|
|
69
|
+
onChange = _ref7.onChange,
|
|
70
|
+
onReset = _ref7.onReset,
|
|
71
|
+
onSubmit = _ref7.onSubmit,
|
|
72
|
+
placeholder = _ref7.placeholder,
|
|
73
|
+
value = _ref7.value,
|
|
74
|
+
autoFocus = _ref7.autoFocus,
|
|
75
|
+
_ref7$resetIconCompon = _ref7.resetIconComponent,
|
|
76
|
+
ResetIcon = _ref7$resetIconCompon === void 0 ? DefaultResetIcon : _ref7$resetIconCompon,
|
|
77
|
+
_ref7$submitIconCompo = _ref7.submitIconComponent,
|
|
78
|
+
SubmitIcon = _ref7$submitIconCompo === void 0 ? DefaultSubmitIcon : _ref7$submitIconCompo,
|
|
79
|
+
_ref7$loadingIconComp = _ref7.loadingIconComponent,
|
|
80
|
+
LoadingIcon = _ref7$loadingIconComp === void 0 ? DefaultLoadingIcon : _ref7$loadingIconComp,
|
|
81
|
+
_ref7$classNames = _ref7.classNames,
|
|
82
|
+
classNames = _ref7$classNames === void 0 ? {} : _ref7$classNames,
|
|
83
|
+
translations = _ref7.translations,
|
|
84
|
+
props = _objectWithoutProperties(_ref7, _excluded);
|
|
85
|
+
function handleSubmit(event) {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
event.stopPropagation();
|
|
88
|
+
if (onSubmit) {
|
|
89
|
+
onSubmit(event);
|
|
90
|
+
}
|
|
91
|
+
if (inputRef.current) {
|
|
92
|
+
inputRef.current.blur();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function handleReset(event) {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
event.stopPropagation();
|
|
98
|
+
onReset(event);
|
|
99
|
+
if (inputRef.current) {
|
|
100
|
+
inputRef.current.focus();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
104
|
+
className: cx('ais-SearchBox', classNames.root, props.className)
|
|
105
|
+
}), /*#__PURE__*/React.createElement("form", {
|
|
106
|
+
ref: formRef,
|
|
107
|
+
action: "",
|
|
108
|
+
className: cx('ais-SearchBox-form', classNames.form),
|
|
109
|
+
noValidate: true,
|
|
110
|
+
onSubmit: handleSubmit,
|
|
111
|
+
onReset: handleReset
|
|
112
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
113
|
+
ref: inputRef,
|
|
114
|
+
className: cx('ais-SearchBox-input', classNames.input),
|
|
115
|
+
autoComplete: "off",
|
|
116
|
+
autoCorrect: "off",
|
|
117
|
+
autoCapitalize: "off",
|
|
118
|
+
placeholder: placeholder,
|
|
119
|
+
spellCheck: false,
|
|
120
|
+
maxLength: 512,
|
|
121
|
+
type: "search",
|
|
122
|
+
value: value,
|
|
123
|
+
onChange: onChange,
|
|
124
|
+
autoFocus: autoFocus
|
|
125
|
+
}), /*#__PURE__*/React.createElement("button", {
|
|
126
|
+
className: cx('ais-SearchBox-submit', classNames.submit),
|
|
127
|
+
type: "submit",
|
|
128
|
+
title: translations.submitButtonTitle
|
|
129
|
+
}, /*#__PURE__*/React.createElement(SubmitIcon, {
|
|
130
|
+
classNames: classNames
|
|
131
|
+
})), /*#__PURE__*/React.createElement("button", {
|
|
132
|
+
className: cx('ais-SearchBox-reset', classNames.reset),
|
|
133
|
+
type: "reset",
|
|
134
|
+
title: translations.resetButtonTitle,
|
|
135
|
+
hidden: value.length === 0 || isSearchStalled
|
|
136
|
+
}, /*#__PURE__*/React.createElement(ResetIcon, {
|
|
137
|
+
classNames: classNames
|
|
138
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
139
|
+
className: cx('ais-SearchBox-loadingIndicator', classNames.loadingIndicator)
|
|
140
|
+
// @ts-ignore (this error is due to conflict with @algolia/ui-components-highlight-vdom, which declares "too global" type for span in case there's no @types/react or preact)
|
|
141
|
+
,
|
|
142
|
+
hidden: !isSearchStalled
|
|
143
|
+
}, /*#__PURE__*/React.createElement(LoadingIcon, {
|
|
144
|
+
classNames: classNames
|
|
145
|
+
}))));
|
|
146
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ShowMoreButtonProps = React.ComponentProps<'button'> & {
|
|
3
|
+
isShowingMore: boolean;
|
|
4
|
+
translations: ShowMoreButtonTranslations;
|
|
5
|
+
};
|
|
6
|
+
export type ShowMoreButtonTextOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the widget is showing more items or not.
|
|
9
|
+
*/
|
|
10
|
+
isShowingMore: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type ShowMoreButtonTranslations = {
|
|
13
|
+
/**
|
|
14
|
+
* Alternative text for the "Show more" button.
|
|
15
|
+
*/
|
|
16
|
+
showMoreButtonText: (options: ShowMoreButtonTextOptions) => string;
|
|
17
|
+
};
|
|
18
|
+
export declare function ShowMoreButton({ isShowingMore, translations, ...props }: ShowMoreButtonProps): JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var _excluded = ["isShowingMore", "translations"];
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
export function ShowMoreButton(_ref) {
|
|
6
|
+
var isShowingMore = _ref.isShowingMore,
|
|
7
|
+
translations = _ref.translations,
|
|
8
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
9
|
+
return /*#__PURE__*/React.createElement("button", props, translations.showMoreButtonText({
|
|
10
|
+
isShowingMore: isShowingMore
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { InternalHighlightProps, InternalHighlightClassNames } from './InternalHighlight';
|
|
2
|
+
export type SnippetClassNames = InternalHighlightClassNames;
|
|
3
|
+
export type SnippetProps = Omit<InternalHighlightProps, 'classNames'> & {
|
|
4
|
+
classNames?: Partial<SnippetClassNames>;
|
|
5
|
+
};
|
|
6
|
+
export declare function Snippet({ classNames, ...props }: SnippetProps): JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var _excluded = ["classNames"];
|
|
2
|
+
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
|
+
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
|
+
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 React from 'react';
|
|
6
|
+
import { InternalHighlight } from "./InternalHighlight.js";
|
|
7
|
+
import { cx } from "./lib/cx.js";
|
|
8
|
+
export function Snippet(_ref) {
|
|
9
|
+
var _ref$classNames = _ref.classNames,
|
|
10
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
11
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
return /*#__PURE__*/React.createElement(InternalHighlight, _extends({
|
|
13
|
+
classNames: {
|
|
14
|
+
root: cx('ais-Snippet', classNames.root),
|
|
15
|
+
highlighted: cx('ais-Snippet-highlighted', classNames.highlighted),
|
|
16
|
+
nonHighlighted: cx('ais-Snippet-nonHighlighted', classNames.nonHighlighted),
|
|
17
|
+
separator: cx('ais-Snippet-separator', classNames.separator)
|
|
18
|
+
}
|
|
19
|
+
}, props));
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { UseSortByProps } from 'react-instantsearch-core';
|
|
3
|
+
export type SortByProps = Omit<React.ComponentProps<'div'>, 'onChange'> & Pick<UseSortByProps, 'items'> & Pick<React.ComponentProps<'select'>, 'value'> & {
|
|
4
|
+
onChange?: (value: string) => void;
|
|
5
|
+
classNames?: Partial<SortByClassNames>;
|
|
6
|
+
};
|
|
7
|
+
export type SortByClassNames = {
|
|
8
|
+
/**
|
|
9
|
+
* Class names to apply to the root element
|
|
10
|
+
*/
|
|
11
|
+
root: string;
|
|
12
|
+
/**
|
|
13
|
+
* Class names to apply to the select element
|
|
14
|
+
*/
|
|
15
|
+
select: string;
|
|
16
|
+
/**
|
|
17
|
+
* Class names to apply to the option element
|
|
18
|
+
*/
|
|
19
|
+
option: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function SortBy({ items, value, onChange, classNames, ...props }: SortByProps): JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var _excluded = ["items", "value", "onChange", "classNames"];
|
|
2
|
+
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
|
+
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
|
+
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 React from 'react';
|
|
6
|
+
import { cx } from "./lib/cx.js";
|
|
7
|
+
export function SortBy(_ref) {
|
|
8
|
+
var items = _ref.items,
|
|
9
|
+
value = _ref.value,
|
|
10
|
+
_ref$onChange = _ref.onChange,
|
|
11
|
+
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
12
|
+
_ref$classNames = _ref.classNames,
|
|
13
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
14
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
16
|
+
className: cx('ais-SortBy', classNames.root, props.className)
|
|
17
|
+
}), /*#__PURE__*/React.createElement("select", {
|
|
18
|
+
className: cx('ais-SortBy-select', classNames.select),
|
|
19
|
+
onChange: function onChange(event) {
|
|
20
|
+
return _onChange(event.target.value);
|
|
21
|
+
},
|
|
22
|
+
value: value
|
|
23
|
+
}, items.map(function (item) {
|
|
24
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
25
|
+
className: cx('ais-SortBy-option', classNames.option),
|
|
26
|
+
key: item.value,
|
|
27
|
+
value: item.value
|
|
28
|
+
}, item.label);
|
|
29
|
+
})));
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type StatsProps = React.ComponentProps<'div'> & {
|
|
3
|
+
nbHits: number;
|
|
4
|
+
processingTimeMS: number;
|
|
5
|
+
nbSortedHits?: number;
|
|
6
|
+
areHitsSorted?: boolean;
|
|
7
|
+
classNames?: Partial<StatsClassNames>;
|
|
8
|
+
translations: {
|
|
9
|
+
rootElementText: StatsTranslations;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type StatsTranslationOptions = Pick<StatsProps, 'nbHits' | 'processingTimeMS' | 'nbSortedHits' | 'areHitsSorted'>;
|
|
13
|
+
export type StatsTranslations = (options: StatsTranslationOptions) => string;
|
|
14
|
+
export type StatsClassNames = {
|
|
15
|
+
/**
|
|
16
|
+
* Class names to apply to the root element
|
|
17
|
+
*/
|
|
18
|
+
root: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function Stats({ classNames, nbHits, processingTimeMS, nbSortedHits, areHitsSorted, translations, ...props }: StatsProps): JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var _excluded = ["classNames", "nbHits", "processingTimeMS", "nbSortedHits", "areHitsSorted", "translations"];
|
|
2
|
+
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
|
+
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
|
+
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 React from 'react';
|
|
6
|
+
import { cx } from "./lib/cx.js";
|
|
7
|
+
export function Stats(_ref) {
|
|
8
|
+
var _ref$classNames = _ref.classNames,
|
|
9
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
10
|
+
nbHits = _ref.nbHits,
|
|
11
|
+
processingTimeMS = _ref.processingTimeMS,
|
|
12
|
+
nbSortedHits = _ref.nbSortedHits,
|
|
13
|
+
areHitsSorted = _ref.areHitsSorted,
|
|
14
|
+
translations = _ref.translations,
|
|
15
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
var translationOptions = {
|
|
17
|
+
nbHits: nbHits,
|
|
18
|
+
processingTimeMS: processingTimeMS,
|
|
19
|
+
nbSortedHits: nbSortedHits,
|
|
20
|
+
areHitsSorted: areHitsSorted
|
|
21
|
+
};
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
23
|
+
className: cx('ais-Stats', classNames.root, props.className)
|
|
24
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
25
|
+
className: "ais-Stats-text"
|
|
26
|
+
}, translations.rootElementText(translationOptions)));
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ToggleRefinementClassNames = {
|
|
3
|
+
/**
|
|
4
|
+
* Class names to apply to the root element
|
|
5
|
+
*/
|
|
6
|
+
root: string;
|
|
7
|
+
/**
|
|
8
|
+
* Class names to apply to the label element
|
|
9
|
+
*/
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* Class names to apply to the checkbox element
|
|
13
|
+
*/
|
|
14
|
+
checkbox: string;
|
|
15
|
+
/**
|
|
16
|
+
* Class names to apply to the label text
|
|
17
|
+
*/
|
|
18
|
+
labelText: string;
|
|
19
|
+
};
|
|
20
|
+
export type ToggleRefinementProps = Omit<React.ComponentProps<'div'>, 'onChange'> & Pick<React.ComponentProps<'input'>, 'checked'> & {
|
|
21
|
+
classNames?: Partial<ToggleRefinementClassNames>;
|
|
22
|
+
onChange: (isChecked: boolean) => void;
|
|
23
|
+
label: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function ToggleRefinement({ classNames, checked, onChange, label, ...props }: ToggleRefinementProps): JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var _excluded = ["classNames", "checked", "onChange", "label"];
|
|
2
|
+
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
|
+
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
|
+
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 React from 'react';
|
|
6
|
+
import { cx } from "./lib/cx.js";
|
|
7
|
+
export function ToggleRefinement(_ref) {
|
|
8
|
+
var _ref$classNames = _ref.classNames,
|
|
9
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
10
|
+
checked = _ref.checked,
|
|
11
|
+
_onChange = _ref.onChange,
|
|
12
|
+
label = _ref.label,
|
|
13
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
15
|
+
className: cx('ais-ToggleRefinement', classNames.root, props.className)
|
|
16
|
+
}), /*#__PURE__*/React.createElement("label", {
|
|
17
|
+
className: cx('ais-ToggleRefinement-label', classNames.label)
|
|
18
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
19
|
+
className: cx('ais-ToggleRefinement-checkbox', classNames.checkbox),
|
|
20
|
+
type: "checkbox",
|
|
21
|
+
checked: checked,
|
|
22
|
+
onChange: function onChange(event) {
|
|
23
|
+
_onChange(event.target.checked);
|
|
24
|
+
}
|
|
25
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
26
|
+
className: cx('ais-ToggleRefinement-labelText', classNames.labelText)
|
|
27
|
+
}, label)));
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cx(...classNames: Array<string | number | boolean | undefined | null>): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BreadcrumbProps as BreadcrumbUiProps } from '../ui/Breadcrumb';
|
|
2
|
+
import type { UseBreadcrumbProps } from 'react-instantsearch-core';
|
|
3
|
+
type UiProps = Pick<BreadcrumbUiProps, 'items' | 'hasItems' | 'createURL' | 'onNavigate' | 'translations'>;
|
|
4
|
+
export type BreadcrumbProps = Omit<BreadcrumbUiProps, keyof UiProps> & Omit<UseBreadcrumbProps, 'separator'> & {
|
|
5
|
+
translations?: Partial<UiProps['translations']>;
|
|
6
|
+
};
|
|
7
|
+
export declare function Breadcrumb({ attributes, rootPath, separator, transformItems, translations, ...props }: BreadcrumbProps): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
var _excluded = ["attributes", "rootPath", "separator", "transformItems", "translations"];
|
|
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); }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { useBreadcrumb } from 'react-instantsearch-core';
|
|
13
|
+
import { Breadcrumb as BreadcrumbUiComponent } from "../ui/Breadcrumb.js";
|
|
14
|
+
export function Breadcrumb(_ref) {
|
|
15
|
+
var attributes = _ref.attributes,
|
|
16
|
+
rootPath = _ref.rootPath,
|
|
17
|
+
separator = _ref.separator,
|
|
18
|
+
transformItems = _ref.transformItems,
|
|
19
|
+
translations = _ref.translations,
|
|
20
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
var _useBreadcrumb = useBreadcrumb({
|
|
22
|
+
attributes: attributes,
|
|
23
|
+
rootPath: rootPath,
|
|
24
|
+
transformItems: transformItems
|
|
25
|
+
}, {
|
|
26
|
+
$$widgetType: 'ais.breadcrumb'
|
|
27
|
+
}),
|
|
28
|
+
canRefine = _useBreadcrumb.canRefine,
|
|
29
|
+
createURL = _useBreadcrumb.createURL,
|
|
30
|
+
items = _useBreadcrumb.items,
|
|
31
|
+
refine = _useBreadcrumb.refine;
|
|
32
|
+
var uiProps = {
|
|
33
|
+
items: items,
|
|
34
|
+
hasItems: canRefine,
|
|
35
|
+
createURL: createURL,
|
|
36
|
+
onNavigate: refine,
|
|
37
|
+
translations: _objectSpread({
|
|
38
|
+
rootElementText: 'Home'
|
|
39
|
+
}, translations)
|
|
40
|
+
};
|
|
41
|
+
return /*#__PURE__*/React.createElement(BreadcrumbUiComponent, _extends({}, props, uiProps));
|
|
42
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ClearRefinementsProps as ClearRefinementsUiComponentProps } from '../ui/ClearRefinements';
|
|
2
|
+
import type { UseClearRefinementsProps } from 'react-instantsearch-core';
|
|
3
|
+
type UiProps = Pick<ClearRefinementsUiComponentProps, 'disabled' | 'onClick' | 'translations'>;
|
|
4
|
+
export type ClearRefinementsProps = Omit<ClearRefinementsUiComponentProps, keyof UiProps> & UseClearRefinementsProps & {
|
|
5
|
+
translations?: Partial<UiProps['translations']>;
|
|
6
|
+
};
|
|
7
|
+
export declare function ClearRefinements({ includedAttributes, excludedAttributes, transformItems, translations, ...props }: ClearRefinementsProps): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
var _excluded = ["includedAttributes", "excludedAttributes", "transformItems", "translations"];
|
|
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); }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { useClearRefinements } from 'react-instantsearch-core';
|
|
13
|
+
import { ClearRefinements as ClearRefinementsUiComponent } from "../ui/ClearRefinements.js";
|
|
14
|
+
export function ClearRefinements(_ref) {
|
|
15
|
+
var includedAttributes = _ref.includedAttributes,
|
|
16
|
+
excludedAttributes = _ref.excludedAttributes,
|
|
17
|
+
transformItems = _ref.transformItems,
|
|
18
|
+
translations = _ref.translations,
|
|
19
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
var _useClearRefinements = useClearRefinements({
|
|
21
|
+
includedAttributes: includedAttributes,
|
|
22
|
+
excludedAttributes: excludedAttributes,
|
|
23
|
+
transformItems: transformItems
|
|
24
|
+
}, {
|
|
25
|
+
$$widgetType: 'ais.clearRefinements'
|
|
26
|
+
}),
|
|
27
|
+
canRefine = _useClearRefinements.canRefine,
|
|
28
|
+
refine = _useClearRefinements.refine;
|
|
29
|
+
var uiProps = {
|
|
30
|
+
onClick: refine,
|
|
31
|
+
disabled: !canRefine,
|
|
32
|
+
translations: _objectSpread({
|
|
33
|
+
resetButtonText: 'Clear refinements'
|
|
34
|
+
}, translations)
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/React.createElement(ClearRefinementsUiComponent, _extends({}, props, uiProps));
|
|
37
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CurrentRefinementsProps as CurrentRefinementsUiComponentProps } from '../ui/CurrentRefinements';
|
|
2
|
+
import type { UseCurrentRefinementsProps } from 'react-instantsearch-core';
|
|
3
|
+
type UiProps = Pick<CurrentRefinementsUiComponentProps, 'items' | 'onRemove' | 'hasRefinements'>;
|
|
4
|
+
export type CurrentRefinementsProps = Omit<CurrentRefinementsUiComponentProps, keyof UiProps> & UseCurrentRefinementsProps;
|
|
5
|
+
export declare function CurrentRefinements({ includedAttributes, excludedAttributes, transformItems, ...props }: CurrentRefinementsProps): JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var _excluded = ["includedAttributes", "excludedAttributes", "transformItems"];
|
|
2
|
+
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
|
+
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
|
+
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 React from 'react';
|
|
6
|
+
import { useCurrentRefinements } from 'react-instantsearch-core';
|
|
7
|
+
import { CurrentRefinements as CurrentRefinementsUiComponent } from "../ui/CurrentRefinements.js";
|
|
8
|
+
export function CurrentRefinements(_ref) {
|
|
9
|
+
var includedAttributes = _ref.includedAttributes,
|
|
10
|
+
excludedAttributes = _ref.excludedAttributes,
|
|
11
|
+
transformItems = _ref.transformItems,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
var _useCurrentRefinement = useCurrentRefinements({
|
|
14
|
+
includedAttributes: includedAttributes,
|
|
15
|
+
excludedAttributes: excludedAttributes,
|
|
16
|
+
transformItems: transformItems
|
|
17
|
+
}, {
|
|
18
|
+
$$widgetType: 'ais.currentRefinements'
|
|
19
|
+
}),
|
|
20
|
+
items = _useCurrentRefinement.items,
|
|
21
|
+
refine = _useCurrentRefinement.refine,
|
|
22
|
+
canRefine = _useCurrentRefinement.canRefine;
|
|
23
|
+
var uiProps = {
|
|
24
|
+
items: items,
|
|
25
|
+
onRemove: refine,
|
|
26
|
+
hasRefinements: canRefine
|
|
27
|
+
};
|
|
28
|
+
return /*#__PURE__*/React.createElement(CurrentRefinementsUiComponent, _extends({}, props, uiProps));
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HierarchicalMenuProps as HierarchicalMenuUiComponentProps } from '../ui/HierarchicalMenu';
|
|
2
|
+
import type { UseHierarchicalMenuProps } from 'react-instantsearch-core';
|
|
3
|
+
type UiProps = Pick<HierarchicalMenuUiComponentProps, 'items' | 'createURL' | 'hasItems' | 'onNavigate' | 'canToggleShowMore' | 'onToggleShowMore' | 'isShowingMore' | 'translations'>;
|
|
4
|
+
export type HierarchicalMenuProps = Omit<HierarchicalMenuUiComponentProps, keyof UiProps> & UseHierarchicalMenuProps & {
|
|
5
|
+
translations?: Partial<UiProps['translations']>;
|
|
6
|
+
};
|
|
7
|
+
export declare function HierarchicalMenu({ attributes, limit, rootPath, separator, showMore, showMoreLimit, showParentLevel, sortBy, transformItems, translations, ...props }: HierarchicalMenuProps): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
var _excluded = ["attributes", "limit", "rootPath", "separator", "showMore", "showMoreLimit", "showParentLevel", "sortBy", "transformItems", "translations"];
|
|
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); }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { useHierarchicalMenu } from 'react-instantsearch-core';
|
|
13
|
+
import { HierarchicalMenu as HierarchicalMenuUiComponent } from "../ui/HierarchicalMenu.js";
|
|
14
|
+
export function HierarchicalMenu(_ref) {
|
|
15
|
+
var attributes = _ref.attributes,
|
|
16
|
+
limit = _ref.limit,
|
|
17
|
+
rootPath = _ref.rootPath,
|
|
18
|
+
separator = _ref.separator,
|
|
19
|
+
showMore = _ref.showMore,
|
|
20
|
+
showMoreLimit = _ref.showMoreLimit,
|
|
21
|
+
showParentLevel = _ref.showParentLevel,
|
|
22
|
+
sortBy = _ref.sortBy,
|
|
23
|
+
transformItems = _ref.transformItems,
|
|
24
|
+
translations = _ref.translations,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
var _useHierarchicalMenu = useHierarchicalMenu({
|
|
27
|
+
attributes: attributes,
|
|
28
|
+
limit: limit,
|
|
29
|
+
rootPath: rootPath,
|
|
30
|
+
separator: separator,
|
|
31
|
+
showMore: showMore,
|
|
32
|
+
showMoreLimit: showMoreLimit,
|
|
33
|
+
showParentLevel: showParentLevel,
|
|
34
|
+
sortBy: sortBy,
|
|
35
|
+
transformItems: transformItems
|
|
36
|
+
}, {
|
|
37
|
+
$$widgetType: 'ais.hierarchicalMenu'
|
|
38
|
+
}),
|
|
39
|
+
items = _useHierarchicalMenu.items,
|
|
40
|
+
canRefine = _useHierarchicalMenu.canRefine,
|
|
41
|
+
canToggleShowMore = _useHierarchicalMenu.canToggleShowMore,
|
|
42
|
+
createURL = _useHierarchicalMenu.createURL,
|
|
43
|
+
isShowingMore = _useHierarchicalMenu.isShowingMore,
|
|
44
|
+
refine = _useHierarchicalMenu.refine,
|
|
45
|
+
toggleShowMore = _useHierarchicalMenu.toggleShowMore;
|
|
46
|
+
var uiProps = {
|
|
47
|
+
items: items,
|
|
48
|
+
hasItems: canRefine,
|
|
49
|
+
createURL: createURL,
|
|
50
|
+
onNavigate: refine,
|
|
51
|
+
canToggleShowMore: canToggleShowMore,
|
|
52
|
+
onToggleShowMore: toggleShowMore,
|
|
53
|
+
isShowingMore: isShowingMore,
|
|
54
|
+
translations: _objectSpread({
|
|
55
|
+
showMoreButtonText: function showMoreButtonText(options) {
|
|
56
|
+
return options.isShowingMore ? 'Show less' : 'Show more';
|
|
57
|
+
}
|
|
58
|
+
}, translations)
|
|
59
|
+
};
|
|
60
|
+
return /*#__PURE__*/React.createElement(HierarchicalMenuUiComponent, _extends({}, props, uiProps, {
|
|
61
|
+
showMore: showMore
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PartialKeys } from '../types';
|
|
2
|
+
import type { HighlightProps as HighlightUiComponentProps } from '../ui/Highlight';
|
|
3
|
+
import type { BaseHit, Hit } from 'instantsearch.js';
|
|
4
|
+
export type HighlightProps<THit extends Hit<BaseHit>> = {
|
|
5
|
+
hit: THit;
|
|
6
|
+
attribute: keyof THit | string[];
|
|
7
|
+
} & PartialKeys<Omit<HighlightUiComponentProps, 'parts'>, 'highlightedTagName' | 'nonHighlightedTagName' | 'separator'>;
|
|
8
|
+
export declare function Highlight<THit extends Hit<BaseHit>>({ hit, attribute, highlightedTagName, nonHighlightedTagName, separator, ...props }: HighlightProps<THit>): JSX.Element;
|