react-instantsearch 6.40.4 → 7.0.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/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
package/README.md
CHANGED
|
@@ -3,11 +3,122 @@
|
|
|
3
3
|
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
|
4
4
|
|
|
5
5
|
- [react-instantsearch](#react-instantsearch)
|
|
6
|
+
- [Why](#why)
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Getting started](#getting-started)
|
|
9
|
+
- [Documentation](#documentation)
|
|
10
|
+
- [Playground](#playground)
|
|
11
|
+
- [Contributing](#contributing)
|
|
12
|
+
- [License](#license)
|
|
6
13
|
|
|
7
14
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
8
15
|
|
|
9
16
|
# react-instantsearch
|
|
10
17
|
|
|
11
|
-
|
|
18
|
+
React InstantSearch is an open-source React library that lets you create an instant search result experience using [Algolia][algolia-website]’s search API. It is part of the InstantSearch family:
|
|
12
19
|
|
|
13
|
-
|
|
20
|
+
**React InstantSearch** | [InstantSearch.js][instantsearch.js-github] | [Angular InstantSearch][instantsearch-angular-github] | [Vue InstantSearch][instantsearch-vue-github] | [InstantSearch Android][instantsearch-android-github] | [InstantSearch iOS][instantsearch-ios-github]
|
|
21
|
+
|
|
22
|
+
## Why
|
|
23
|
+
|
|
24
|
+
You should be using React InstantSearch if you want to:
|
|
25
|
+
|
|
26
|
+
* Design search experiences with best practices
|
|
27
|
+
* Customize your components at will
|
|
28
|
+
* Follow React principles
|
|
29
|
+
|
|
30
|
+
Note: If you are working with React Native, or otherwise do not use the DOM, check out `react-instantsearch-core` instead.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
React InstantSearch is available on the npm registry. It relies on [`algoliasearch`](https://github.com/algolia/algoliasearch-client-javascript) to communicate with Algolia APIs.
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
yarn add algoliasearch react-instantsearch
|
|
38
|
+
# or
|
|
39
|
+
npm install algoliasearch react-instantsearch
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Getting started
|
|
43
|
+
|
|
44
|
+
Using React InstantSearch is as simple as adding these components to your app:
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
import React from 'react';
|
|
48
|
+
import ReactDOM from 'react-dom';
|
|
49
|
+
import algoliasearch from 'algoliasearch/lite';
|
|
50
|
+
import { InstantSearch, SearchBox, Hits } from 'react-instantsearch';
|
|
51
|
+
|
|
52
|
+
const searchClient = algoliasearch(
|
|
53
|
+
'latency',
|
|
54
|
+
'6be0576ff61c053d5f9a3225e2a90f76'
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const App = () => (
|
|
58
|
+
<InstantSearch
|
|
59
|
+
indexName="bestbuy"
|
|
60
|
+
searchClient={searchClient}
|
|
61
|
+
>
|
|
62
|
+
<SearchBox />
|
|
63
|
+
<Hits />
|
|
64
|
+
</InstantSearch>
|
|
65
|
+
);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
<p align="center">
|
|
69
|
+
<a href="https://codesandbox.io/s/github/algolia/instantsearch.js/tree/master/examples/react/default-theme" title="Edit on CodeSandbox">
|
|
70
|
+
<img alt="Edit on CodeSandbox" src="https://codesandbox.io/static/img/play-codesandbox.svg">
|
|
71
|
+
</a>
|
|
72
|
+
</p>
|
|
73
|
+
|
|
74
|
+
To learn more about the library, follow the [getting started guide][doc-getting-started].
|
|
75
|
+
|
|
76
|
+
## Documentation
|
|
77
|
+
|
|
78
|
+
The documentation is available on [algolia.com/doc][doc].
|
|
79
|
+
|
|
80
|
+
## Playground
|
|
81
|
+
|
|
82
|
+
You can get to know React InstantSearch on [this playground][doc-playground].
|
|
83
|
+
|
|
84
|
+
Start by [adding components][doc-getting-started] and tweaking the display. Once you get more familiar with the library, you can learn more advanced concepts in [our guides][doc-guides].
|
|
85
|
+
|
|
86
|
+
## Contributing
|
|
87
|
+
|
|
88
|
+
We welcome all contributors, from casual to regular 💙
|
|
89
|
+
|
|
90
|
+
- **Bug report**. Is something not working as expected? [Send a bug report][contributing-bugreport].
|
|
91
|
+
- **Feature request**. Would you like to add something to the library? [Send a feature request][contributing-featurerequest].
|
|
92
|
+
- **Documentation**. Did you find a typo in the doc? [Open an issue][contributing-newissue] and we'll take care of it.
|
|
93
|
+
- **Development**. If you don't know where to start, you can check the open issues that are [tagged easy][contributing-label-easy], the [bugs][contributing-label-bug] or [chores][contributing-label-chore].
|
|
94
|
+
|
|
95
|
+
To start contributing to code, you need to:
|
|
96
|
+
|
|
97
|
+
1. [Fork the project](https://help.github.com/articles/fork-a-repo/)
|
|
98
|
+
1. [Clone the repository](https://help.github.com/articles/cloning-a-repository/)
|
|
99
|
+
1. Install the dependencies: `yarn`
|
|
100
|
+
|
|
101
|
+
Please read [our contribution process](https://github.com/algolia/instantsearch.js/blob/master/CONTRIBUTING.md) to learn more.
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
React InstantSearch is [MIT licensed](../../LICENSE).
|
|
106
|
+
|
|
107
|
+
<!-- Links -->
|
|
108
|
+
|
|
109
|
+
[doc]: https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/react/
|
|
110
|
+
[doc-getting-started]: https://www.algolia.com/doc/guides/building-search-ui/getting-started/react/
|
|
111
|
+
[doc-guides]: https://www.algolia.com/doc/guides/building-search-ui/going-further/server-side-rendering/react/
|
|
112
|
+
[doc-playground]: https://codesandbox.io/s/github/algolia/instantsearch/tree/master/examples/react/default-theme
|
|
113
|
+
[algolia-website]: https://www.algolia.com/
|
|
114
|
+
[instantsearch.js-github]: https://github.com/algolia/instantsearch.js
|
|
115
|
+
[instantsearch-android-github]: https://github.com/algolia/instantsearch-android
|
|
116
|
+
[instantsearch-ios-github]: https://github.com/algolia/instantsearch-ios
|
|
117
|
+
[instantsearch-vue-github]: https://github.com/algolia/vue-instantsearch
|
|
118
|
+
[instantsearch-angular-github]: https://github.com/algolia/angular-instantsearch
|
|
119
|
+
[contributing-bugreport]: https://github.com/algolia/instantsearch.js/issues/new?template=BUG_REPORT.yml&labels=triage,Library%3A%20React+InstantSearch
|
|
120
|
+
[contributing-featurerequest]: https://github.com/algolia/instantsearch.js/discussions/new?category=ideas&labels=triage,Library%3A%20React+InstantSearch&title=Feature%20request%3A%20
|
|
121
|
+
[contributing-newissue]: https://github.com/algolia/instantsearch.js/issues/new?labels=triage,Library%3A%20React+InstantSearch
|
|
122
|
+
[contributing-label-easy]: https://github.com/algolia/instantsearch.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22Difficulty%3A+Easy%22+label%3A%22Library%3A%20React+InstantSearch%22
|
|
123
|
+
[contributing-label-bug]: https://github.com/algolia/instantsearch.js/issues?q=is%3Aissue+is%3Aopen+label%3A%22Type%3A+Bug%22+label%3A%22Library%3A%20React+InstantSearch%22
|
|
124
|
+
[contributing-label-chore]: https://github.com/algolia/instantsearch.js/issues?q=is%3Aissue+is%3Aopen+label%3A%22Type%3A+Chore%22+label%3A%22Library%3A%20React+InstantSearch%22
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _reactInstantsearchCore = require("react-instantsearch-core");
|
|
7
|
+
Object.keys(_reactInstantsearchCore).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _reactInstantsearchCore[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _reactInstantsearchCore[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _widgets = require("./widgets");
|
|
18
|
+
Object.keys(_widgets).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _widgets[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _widgets[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "type": "commonjs", "sideEffects": false }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _PartialKeys = require("./PartialKeys");
|
|
7
|
+
Object.keys(_PartialKeys).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _PartialKeys[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _PartialKeys[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _Translatable = require("./Translatable");
|
|
18
|
+
Object.keys(_Translatable).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _Translatable[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _Translatable[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Breadcrumb = Breadcrumb;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _cx = require("./lib/cx");
|
|
9
|
+
var _isModifierClick = require("./lib/isModifierClick");
|
|
10
|
+
var _excluded = ["classNames", "items", "hasItems", "createURL", "onNavigate", "separator", "translations"];
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
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
|
+
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
|
+
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
|
+
function Breadcrumb(_ref) {
|
|
16
|
+
var _ref$classNames = _ref.classNames,
|
|
17
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
18
|
+
_ref$items = _ref.items,
|
|
19
|
+
items = _ref$items === void 0 ? [] : _ref$items,
|
|
20
|
+
hasItems = _ref.hasItems,
|
|
21
|
+
createURL = _ref.createURL,
|
|
22
|
+
onNavigate = _ref.onNavigate,
|
|
23
|
+
_ref$separator = _ref.separator,
|
|
24
|
+
separator = _ref$separator === void 0 ? '>' : _ref$separator,
|
|
25
|
+
translations = _ref.translations,
|
|
26
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
var handleClick = function handleClick(value) {
|
|
28
|
+
return function (event) {
|
|
29
|
+
if (!(0, _isModifierClick.isModifierClick)(event)) {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
onNavigate(value);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({}, props, {
|
|
36
|
+
className: (0, _cx.cx)('ais-Breadcrumb', classNames.root, !hasItems && (0, _cx.cx)('ais-Breadcrumb--noRefinement', classNames.noRefinementRoot), props.className)
|
|
37
|
+
}), /*#__PURE__*/_react.default.createElement("ul", {
|
|
38
|
+
className: (0, _cx.cx)('ais-Breadcrumb-list', classNames.list)
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement("li", {
|
|
40
|
+
className: (0, _cx.cx)('ais-Breadcrumb-item', classNames.item, !hasItems && (0, _cx.cx)('ais-Breadcrumb-item--selected', classNames.selectedItem))
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
42
|
+
href: createURL(null),
|
|
43
|
+
onClick: handleClick(null),
|
|
44
|
+
className: (0, _cx.cx)('ais-Breadcrumb-link', classNames.link)
|
|
45
|
+
}, translations.rootElementText)), items.map(function (item, index) {
|
|
46
|
+
var isLast = index === items.length - 1;
|
|
47
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
48
|
+
key: index,
|
|
49
|
+
className: (0, _cx.cx)('ais-Breadcrumb-item', classNames.item, isLast && (0, _cx.cx)('ais-Breadcrumb-item--selected', classNames.selectedItem))
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
className: (0, _cx.cx)('ais-Breadcrumb-separator', classNames.separator)
|
|
53
|
+
}, separator), isLast ? item.label : /*#__PURE__*/_react.default.createElement("a", {
|
|
54
|
+
className: (0, _cx.cx)('ais-Breadcrumb-link', classNames.link),
|
|
55
|
+
href: createURL(item.value),
|
|
56
|
+
onClick: handleClick(item.value)
|
|
57
|
+
}, item.label));
|
|
58
|
+
})));
|
|
59
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ClearRefinements = ClearRefinements;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _cx = require("./lib/cx");
|
|
9
|
+
var _excluded = ["classNames", "disabled", "onClick", "translations"];
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function ClearRefinements(_ref) {
|
|
15
|
+
var _ref$classNames = _ref.classNames,
|
|
16
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
17
|
+
_ref$disabled = _ref.disabled,
|
|
18
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
19
|
+
_ref$onClick = _ref.onClick,
|
|
20
|
+
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
21
|
+
translations = _ref.translations,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({}, props, {
|
|
24
|
+
className: (0, _cx.cx)('ais-ClearRefinements', classNames.root, props.className)
|
|
25
|
+
}), /*#__PURE__*/_react.default.createElement("button", {
|
|
26
|
+
disabled: disabled,
|
|
27
|
+
onClick: onClick,
|
|
28
|
+
className: (0, _cx.cx)('ais-ClearRefinements-button', classNames.button, disabled && (0, _cx.cx)('ais-ClearRefinements-button--disabled', classNames.disabledButton))
|
|
29
|
+
}, translations.resetButtonText));
|
|
30
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CurrentRefinements = CurrentRefinements;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _cx = require("./lib/cx");
|
|
9
|
+
var _isModifierClick = require("./lib/isModifierClick");
|
|
10
|
+
var _excluded = ["classNames", "items", "onRemove", "hasRefinements"];
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
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
|
+
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
|
+
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
|
+
function CurrentRefinements(_ref) {
|
|
16
|
+
var _ref$classNames = _ref.classNames,
|
|
17
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
18
|
+
_ref$items = _ref.items,
|
|
19
|
+
items = _ref$items === void 0 ? [] : _ref$items,
|
|
20
|
+
_ref$onRemove = _ref.onRemove,
|
|
21
|
+
onRemove = _ref$onRemove === void 0 ? function () {} : _ref$onRemove,
|
|
22
|
+
_ref$hasRefinements = _ref.hasRefinements,
|
|
23
|
+
hasRefinements = _ref$hasRefinements === void 0 ? false : _ref$hasRefinements,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({}, props, {
|
|
26
|
+
className: (0, _cx.cx)('ais-CurrentRefinements', classNames.root, !hasRefinements && (0, _cx.cx)('ais-CurrentRefinements--noRefinement', classNames.noRefinementRoot), props.className)
|
|
27
|
+
}), /*#__PURE__*/_react.default.createElement("ul", {
|
|
28
|
+
className: (0, _cx.cx)('ais-CurrentRefinements-list', classNames.list, !hasRefinements && (0, _cx.cx)('ais-CurrentRefinements-list--noRefinement', classNames.noRefinementList))
|
|
29
|
+
}, items.map(function (item) {
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
31
|
+
key: [item.indexName, item.label].join('/'),
|
|
32
|
+
className: (0, _cx.cx)('ais-CurrentRefinements-item', classNames.item)
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
34
|
+
className: (0, _cx.cx)('ais-CurrentRefinements-label', classNames.label)
|
|
35
|
+
}, item.label, ":"), item.refinements.map(function (refinement) {
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
37
|
+
key: refinement.label,
|
|
38
|
+
className: (0, _cx.cx)('ais-CurrentRefinements-category', classNames.category)
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
40
|
+
className: (0, _cx.cx)('ais-CurrentRefinements-categoryLabel', classNames.categoryLabel)
|
|
41
|
+
}, refinement.label), /*#__PURE__*/_react.default.createElement("button", {
|
|
42
|
+
type: "button",
|
|
43
|
+
onClick: function onClick(event) {
|
|
44
|
+
if ((0, _isModifierClick.isModifierClick)(event)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
onRemove(refinement);
|
|
48
|
+
},
|
|
49
|
+
className: (0, _cx.cx)('ais-CurrentRefinements-delete', classNames.delete)
|
|
50
|
+
}, "\u2715"));
|
|
51
|
+
}));
|
|
52
|
+
})));
|
|
53
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HierarchicalMenu = HierarchicalMenu;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _cx = require("./lib/cx");
|
|
9
|
+
var _isModifierClick = require("./lib/isModifierClick");
|
|
10
|
+
var _ShowMoreButton = require("./ShowMoreButton");
|
|
11
|
+
var _excluded = ["classNames", "items", "hasItems", "onNavigate", "createURL", "showMore", "canToggleShowMore", "onToggleShowMore", "isShowingMore", "translations"];
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
function HierarchicalList(_ref) {
|
|
17
|
+
var className = _ref.className,
|
|
18
|
+
_ref$classNames = _ref.classNames,
|
|
19
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
20
|
+
items = _ref.items,
|
|
21
|
+
createURL = _ref.createURL,
|
|
22
|
+
onNavigate = _ref.onNavigate;
|
|
23
|
+
if (items.length === 0) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement("ul", {
|
|
27
|
+
className: (0, _cx.cx)('ais-HierarchicalMenu-list', classNames.list, className)
|
|
28
|
+
}, items.map(function (item) {
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
30
|
+
key: item.value,
|
|
31
|
+
className: (0, _cx.cx)('ais-HierarchicalMenu-item', classNames.item, item.data && item.data.length > 0 && (0, _cx.cx)('ais-HierarchicalMenu-item--parent', classNames.parentItem), item.isRefined && (0, _cx.cx)('ais-HierarchicalMenu-item--selected', classNames.selectedItem))
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
33
|
+
className: (0, _cx.cx)('ais-HierarchicalMenu-link', classNames.link, item.isRefined && (0, _cx.cx)('ais-HierarchicalMenu-link--selected', classNames.selectedItemLink)),
|
|
34
|
+
href: createURL(item.value),
|
|
35
|
+
onClick: function onClick(event) {
|
|
36
|
+
if ((0, _isModifierClick.isModifierClick)(event)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
onNavigate(item.value);
|
|
41
|
+
}
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
43
|
+
className: (0, _cx.cx)('ais-HierarchicalMenu-label', classNames.label)
|
|
44
|
+
}, item.label), /*#__PURE__*/_react.default.createElement("span", {
|
|
45
|
+
className: (0, _cx.cx)('ais-HierarchicalMenu-count', classNames.count)
|
|
46
|
+
}, item.count)), item.data && /*#__PURE__*/_react.default.createElement(HierarchicalList, {
|
|
47
|
+
className: (0, _cx.cx)('ais-HierarchicalMenu-list--child', classNames.childList),
|
|
48
|
+
classNames: classNames,
|
|
49
|
+
items: item.data,
|
|
50
|
+
onNavigate: onNavigate,
|
|
51
|
+
createURL: createURL
|
|
52
|
+
}));
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
function HierarchicalMenu(_ref2) {
|
|
56
|
+
var _ref2$classNames = _ref2.classNames,
|
|
57
|
+
classNames = _ref2$classNames === void 0 ? {} : _ref2$classNames,
|
|
58
|
+
items = _ref2.items,
|
|
59
|
+
hasItems = _ref2.hasItems,
|
|
60
|
+
onNavigate = _ref2.onNavigate,
|
|
61
|
+
createURL = _ref2.createURL,
|
|
62
|
+
showMore = _ref2.showMore,
|
|
63
|
+
canToggleShowMore = _ref2.canToggleShowMore,
|
|
64
|
+
onToggleShowMore = _ref2.onToggleShowMore,
|
|
65
|
+
isShowingMore = _ref2.isShowingMore,
|
|
66
|
+
translations = _ref2.translations,
|
|
67
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({}, props, {
|
|
69
|
+
className: (0, _cx.cx)('ais-HierarchicalMenu', classNames.root, !hasItems && (0, _cx.cx)('ais-HierarchicalMenu--noRefinement', classNames.noRefinementRoot), props.className)
|
|
70
|
+
}), /*#__PURE__*/_react.default.createElement(HierarchicalList, {
|
|
71
|
+
classNames: classNames,
|
|
72
|
+
items: items,
|
|
73
|
+
onNavigate: onNavigate,
|
|
74
|
+
createURL: createURL
|
|
75
|
+
}), showMore && /*#__PURE__*/_react.default.createElement(_ShowMoreButton.ShowMoreButton, {
|
|
76
|
+
className: (0, _cx.cx)('ais-HierarchicalMenu-showMore', classNames.showMore, !canToggleShowMore && (0, _cx.cx)('ais-HierarchicalMenu-showMore--disabled', classNames.disabledShowMore)),
|
|
77
|
+
disabled: !canToggleShowMore,
|
|
78
|
+
onClick: onToggleShowMore,
|
|
79
|
+
isShowingMore: isShowingMore,
|
|
80
|
+
translations: translations
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Highlight = Highlight;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _InternalHighlight = require("./InternalHighlight");
|
|
9
|
+
var _cx = require("./lib/cx");
|
|
10
|
+
var _excluded = ["classNames"];
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
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
|
+
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
|
+
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
|
+
function Highlight(_ref) {
|
|
16
|
+
var _ref$classNames = _ref.classNames,
|
|
17
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
18
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_InternalHighlight.InternalHighlight, _extends({
|
|
20
|
+
classNames: {
|
|
21
|
+
root: (0, _cx.cx)('ais-Highlight', classNames.root),
|
|
22
|
+
highlighted: (0, _cx.cx)('ais-Highlight-highlighted', classNames.highlighted),
|
|
23
|
+
nonHighlighted: (0, _cx.cx)('ais-Highlight-nonHighlighted', classNames.nonHighlighted),
|
|
24
|
+
separator: (0, _cx.cx)('ais-Highlight-separator', classNames.separator)
|
|
25
|
+
}
|
|
26
|
+
}, props));
|
|
27
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Hits = Hits;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _cx = require("./lib/cx");
|
|
9
|
+
var _excluded = ["hits", "sendEvent", "hitComponent", "classNames"];
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function DefaultHitComponent(_ref) {
|
|
15
|
+
var hit = _ref.hit;
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
17
|
+
style: {
|
|
18
|
+
wordBreak: 'break-all'
|
|
19
|
+
}
|
|
20
|
+
}, JSON.stringify(hit).slice(0, 100), "\u2026");
|
|
21
|
+
}
|
|
22
|
+
function Hits(_ref2) {
|
|
23
|
+
var hits = _ref2.hits,
|
|
24
|
+
sendEvent = _ref2.sendEvent,
|
|
25
|
+
_ref2$hitComponent = _ref2.hitComponent,
|
|
26
|
+
HitComponent = _ref2$hitComponent === void 0 ? DefaultHitComponent : _ref2$hitComponent,
|
|
27
|
+
_ref2$classNames = _ref2.classNames,
|
|
28
|
+
classNames = _ref2$classNames === void 0 ? {} : _ref2$classNames,
|
|
29
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({}, props, {
|
|
31
|
+
className: (0, _cx.cx)('ais-Hits', classNames.root, hits.length === 0 && (0, _cx.cx)('ais-Hits--empty', classNames.emptyRoot), props.className)
|
|
32
|
+
}), /*#__PURE__*/_react.default.createElement("ol", {
|
|
33
|
+
className: (0, _cx.cx)('ais-Hits-list', classNames.list)
|
|
34
|
+
}, hits.map(function (hit) {
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
36
|
+
key: hit.objectID,
|
|
37
|
+
className: (0, _cx.cx)('ais-Hits-item', classNames.item),
|
|
38
|
+
onClick: function onClick() {
|
|
39
|
+
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
40
|
+
},
|
|
41
|
+
onAuxClick: function onAuxClick() {
|
|
42
|
+
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
43
|
+
}
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement(HitComponent, {
|
|
45
|
+
hit: hit,
|
|
46
|
+
sendEvent: sendEvent
|
|
47
|
+
}));
|
|
48
|
+
})));
|
|
49
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HitsPerPage = HitsPerPage;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _cx = require("./lib/cx");
|
|
9
|
+
var _excluded = ["items", "onChange", "currentValue", "classNames"];
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function HitsPerPage(_ref) {
|
|
15
|
+
var items = _ref.items,
|
|
16
|
+
_onChange = _ref.onChange,
|
|
17
|
+
currentValue = _ref.currentValue,
|
|
18
|
+
_ref$classNames = _ref.classNames,
|
|
19
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
20
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({}, props, {
|
|
22
|
+
className: (0, _cx.cx)('ais-HitsPerPage', classNames.root, props.className)
|
|
23
|
+
}), /*#__PURE__*/_react.default.createElement("select", {
|
|
24
|
+
className: (0, _cx.cx)('ais-HitsPerPage-select', classNames.select),
|
|
25
|
+
onChange: function onChange(event) {
|
|
26
|
+
_onChange(Number(event.target.value));
|
|
27
|
+
},
|
|
28
|
+
value: String(currentValue)
|
|
29
|
+
}, items.map(function (item) {
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement("option", {
|
|
31
|
+
key: item.value,
|
|
32
|
+
className: (0, _cx.cx)('ais-HitsPerPage-option', classNames.option),
|
|
33
|
+
value: item.value
|
|
34
|
+
}, item.label);
|
|
35
|
+
})));
|
|
36
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InfiniteHits = InfiniteHits;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _cx = require("./lib/cx");
|
|
9
|
+
var _excluded = ["hitComponent", "hits", "sendEvent", "isFirstPage", "isLastPage", "onShowPrevious", "onShowMore", "classNames", "translations"];
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function DefaultHitComponent(_ref) {
|
|
15
|
+
var hit = _ref.hit;
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
17
|
+
style: {
|
|
18
|
+
wordBreak: 'break-all'
|
|
19
|
+
}
|
|
20
|
+
}, JSON.stringify(hit).slice(0, 100), "\u2026");
|
|
21
|
+
}
|
|
22
|
+
function InfiniteHits(_ref2) {
|
|
23
|
+
var _ref2$hitComponent = _ref2.hitComponent,
|
|
24
|
+
HitComponent = _ref2$hitComponent === void 0 ? DefaultHitComponent : _ref2$hitComponent,
|
|
25
|
+
hits = _ref2.hits,
|
|
26
|
+
sendEvent = _ref2.sendEvent,
|
|
27
|
+
isFirstPage = _ref2.isFirstPage,
|
|
28
|
+
isLastPage = _ref2.isLastPage,
|
|
29
|
+
onShowPrevious = _ref2.onShowPrevious,
|
|
30
|
+
onShowMore = _ref2.onShowMore,
|
|
31
|
+
_ref2$classNames = _ref2.classNames,
|
|
32
|
+
classNames = _ref2$classNames === void 0 ? {} : _ref2$classNames,
|
|
33
|
+
translations = _ref2.translations,
|
|
34
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({}, props, {
|
|
36
|
+
className: (0, _cx.cx)('ais-InfiniteHits', classNames.root, hits.length === 0 && (0, _cx.cx)('ais-InfiniteHits--empty', classNames.emptyRoot), props.className)
|
|
37
|
+
}), onShowPrevious && /*#__PURE__*/_react.default.createElement("button", {
|
|
38
|
+
className: (0, _cx.cx)('ais-InfiniteHits-loadPrevious', classNames.loadPrevious, isFirstPage && (0, _cx.cx)('ais-InfiniteHits-loadPrevious--disabled', classNames.disabledLoadPrevious)),
|
|
39
|
+
onClick: onShowPrevious,
|
|
40
|
+
disabled: isFirstPage
|
|
41
|
+
}, translations.showPreviousButtonText), /*#__PURE__*/_react.default.createElement("ol", {
|
|
42
|
+
className: (0, _cx.cx)('ais-InfiniteHits-list', classNames.list)
|
|
43
|
+
}, hits.map(function (hit) {
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
45
|
+
key: hit.objectID,
|
|
46
|
+
className: (0, _cx.cx)('ais-InfiniteHits-item', classNames.item),
|
|
47
|
+
onClick: function onClick() {
|
|
48
|
+
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
49
|
+
},
|
|
50
|
+
onAuxClick: function onAuxClick() {
|
|
51
|
+
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(HitComponent, {
|
|
54
|
+
hit: hit,
|
|
55
|
+
sendEvent: sendEvent
|
|
56
|
+
}));
|
|
57
|
+
})), /*#__PURE__*/_react.default.createElement("button", {
|
|
58
|
+
className: (0, _cx.cx)('ais-InfiniteHits-loadMore', classNames.loadMore, isLastPage && (0, _cx.cx)('ais-InfiniteHits-loadMore--disabled', classNames.disabledLoadMore)),
|
|
59
|
+
onClick: onShowMore,
|
|
60
|
+
disabled: isLastPage
|
|
61
|
+
}, translations.showMoreButtonText));
|
|
62
|
+
}
|