instantsearch.js 4.37.1 → 4.37.2
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/CHANGELOG.md +9 -0
- package/cjs/components/Hits/Hits.js +0 -6
- package/cjs/components/Pagination/Pagination.js +60 -41
- package/cjs/connectors/search-box/connectSearchBox.js +15 -25
- package/cjs/lib/version.js +1 -1
- package/dist/instantsearch.development.d.ts +36 -7
- package/dist/instantsearch.development.js +71 -114
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.development.min.d.ts +36 -7
- package/dist/instantsearch.production.d.ts +36 -7
- package/dist/instantsearch.production.min.d.ts +36 -7
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Hits/Hits.d.ts +1 -9
- package/es/components/Hits/Hits.js +0 -6
- package/es/components/Pagination/Pagination.d.ts +3 -10
- package/es/components/Pagination/Pagination.js +55 -34
- package/es/connectors/search-box/connectSearchBox.js +15 -25
- package/es/connectors/toggle-refinement/connectToggleRefinement.d.ts +36 -7
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/package.json +2 -2
- package/cjs/components/Pagination/PaginationLink.js +0 -60
- package/es/components/Pagination/PaginationLink.d.ts +0 -16
- package/es/components/Pagination/PaginationLink.js +0 -49
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [4.37.2](https://github.com/algolia/instantsearch.js/compare/v4.37.1...v4.37.2) (2022-01-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **searchbox:** make sure setting query to the initial doesn't cause a stale state ([#4990](https://github.com/algolia/instantsearch.js/issues/4990)) ([3faca01](https://github.com/algolia/instantsearch.js/commit/3faca014aad08145c3b4cc66a5e841da3a0f64b8))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
## [4.37.1](https://github.com/algolia/instantsearch.js/compare/v4.37.0...v4.37.1) (2022-01-05)
|
|
2
11
|
|
|
3
12
|
|
|
@@ -9,91 +9,110 @@ var _preact = require("preact");
|
|
|
9
9
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
|
|
12
|
-
var _PaginationLink = _interopRequireDefault(require("./PaginationLink.js"));
|
|
13
|
-
|
|
14
12
|
var _index = require("../../lib/utils/index.js");
|
|
15
13
|
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
15
|
|
|
18
16
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
17
|
|
|
20
|
-
var defaultProps = {
|
|
21
|
-
currentPage: 0,
|
|
22
|
-
nbPages: 0,
|
|
23
|
-
pages: []
|
|
24
|
-
};
|
|
25
|
-
|
|
26
18
|
function Pagination(props) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
function createClickHandler(pageNumber) {
|
|
20
|
+
return function (event) {
|
|
21
|
+
if ((0, _index.isSpecialClick)(event)) {
|
|
22
|
+
// do not alter the default browser behavior
|
|
23
|
+
// if one special key is down
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
props.setCurrentPage(pageNumber);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
37
31
|
|
|
38
32
|
return (0, _preact.h)("div", {
|
|
39
33
|
className: (0, _classnames.default)(props.cssClasses.root, _defineProperty({}, props.cssClasses.noRefinementRoot, props.nbPages <= 1))
|
|
40
34
|
}, (0, _preact.h)("ul", {
|
|
41
35
|
className: props.cssClasses.list
|
|
42
|
-
}, props.showFirst && (0, _preact.h)(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
additionalClassName: props.cssClasses.firstPageItem,
|
|
36
|
+
}, props.showFirst && (0, _preact.h)(PaginationLink, {
|
|
37
|
+
ariaLabel: "First",
|
|
38
|
+
className: props.cssClasses.firstPageItem,
|
|
46
39
|
isDisabled: props.isFirstPage,
|
|
47
40
|
label: props.templates.first,
|
|
48
41
|
pageNumber: 0,
|
|
49
42
|
createURL: props.createURL,
|
|
50
43
|
cssClasses: props.cssClasses,
|
|
51
|
-
|
|
52
|
-
}), props.showPrevious && (0, _preact.h)(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
additionalClassName: props.cssClasses.previousPageItem,
|
|
44
|
+
createClickHandler: createClickHandler
|
|
45
|
+
}), props.showPrevious && (0, _preact.h)(PaginationLink, {
|
|
46
|
+
ariaLabel: "Previous",
|
|
47
|
+
className: props.cssClasses.previousPageItem,
|
|
56
48
|
isDisabled: props.isFirstPage,
|
|
57
49
|
label: props.templates.previous,
|
|
58
50
|
pageNumber: props.currentPage - 1,
|
|
59
51
|
createURL: props.createURL,
|
|
60
52
|
cssClasses: props.cssClasses,
|
|
61
|
-
|
|
53
|
+
createClickHandler: createClickHandler
|
|
62
54
|
}), props.pages.map(function (pageNumber) {
|
|
63
|
-
return (0, _preact.h)(
|
|
55
|
+
return (0, _preact.h)(PaginationLink, {
|
|
64
56
|
key: pageNumber,
|
|
65
57
|
ariaLabel: "".concat(pageNumber + 1),
|
|
66
|
-
|
|
58
|
+
className: props.cssClasses.pageItem,
|
|
67
59
|
isSelected: pageNumber === props.currentPage,
|
|
68
60
|
label: "".concat(pageNumber + 1),
|
|
69
61
|
pageNumber: pageNumber,
|
|
70
62
|
createURL: props.createURL,
|
|
71
63
|
cssClasses: props.cssClasses,
|
|
72
|
-
|
|
64
|
+
createClickHandler: createClickHandler
|
|
73
65
|
});
|
|
74
|
-
}), props.showNext && (0, _preact.h)(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
additionalClassName: props.cssClasses.nextPageItem,
|
|
66
|
+
}), props.showNext && (0, _preact.h)(PaginationLink, {
|
|
67
|
+
ariaLabel: "Next",
|
|
68
|
+
className: props.cssClasses.nextPageItem,
|
|
78
69
|
isDisabled: props.isLastPage,
|
|
79
70
|
label: props.templates.next,
|
|
80
71
|
pageNumber: props.currentPage + 1,
|
|
81
72
|
createURL: props.createURL,
|
|
82
73
|
cssClasses: props.cssClasses,
|
|
83
|
-
|
|
84
|
-
}), props.showLast && (0, _preact.h)(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
additionalClassName: props.cssClasses.lastPageItem,
|
|
74
|
+
createClickHandler: createClickHandler
|
|
75
|
+
}), props.showLast && (0, _preact.h)(PaginationLink, {
|
|
76
|
+
ariaLabel: "Last",
|
|
77
|
+
className: props.cssClasses.lastPageItem,
|
|
88
78
|
isDisabled: props.isLastPage,
|
|
89
79
|
label: props.templates.last,
|
|
90
80
|
pageNumber: props.nbPages - 1,
|
|
91
81
|
createURL: props.createURL,
|
|
92
82
|
cssClasses: props.cssClasses,
|
|
93
|
-
|
|
83
|
+
createClickHandler: createClickHandler
|
|
94
84
|
})));
|
|
95
85
|
}
|
|
96
86
|
|
|
97
|
-
|
|
87
|
+
function PaginationLink(_ref) {
|
|
88
|
+
var label = _ref.label,
|
|
89
|
+
ariaLabel = _ref.ariaLabel,
|
|
90
|
+
pageNumber = _ref.pageNumber,
|
|
91
|
+
className = _ref.className,
|
|
92
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
93
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
94
|
+
_ref$isSelected = _ref.isSelected,
|
|
95
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
96
|
+
cssClasses = _ref.cssClasses,
|
|
97
|
+
createURL = _ref.createURL,
|
|
98
|
+
createClickHandler = _ref.createClickHandler;
|
|
99
|
+
return (0, _preact.h)("li", {
|
|
100
|
+
className: (0, _classnames.default)(cssClasses.item, className, isDisabled && cssClasses.disabledItem, isSelected && cssClasses.selectedItem)
|
|
101
|
+
}, isDisabled ? (0, _preact.h)("span", {
|
|
102
|
+
className: cssClasses.link,
|
|
103
|
+
dangerouslySetInnerHTML: {
|
|
104
|
+
__html: label
|
|
105
|
+
}
|
|
106
|
+
}) : (0, _preact.h)("a", {
|
|
107
|
+
className: cssClasses.link,
|
|
108
|
+
"aria-label": ariaLabel,
|
|
109
|
+
href: createURL(pageNumber),
|
|
110
|
+
onClick: createClickHandler(pageNumber),
|
|
111
|
+
dangerouslySetInnerHTML: {
|
|
112
|
+
__html: label
|
|
113
|
+
}
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
|
|
98
117
|
var _default = Pagination;
|
|
99
118
|
exports.default = _default;
|
|
@@ -18,32 +18,28 @@ var withUsage = (0, _index.createDocumentationMessageGenerator)({
|
|
|
18
18
|
connector: true
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
+
var defaultQueryHook = function defaultQueryHook(query, hook) {
|
|
22
|
+
return hook(query);
|
|
23
|
+
};
|
|
21
24
|
/**
|
|
22
25
|
* **SearchBox** connector provides the logic to build a widget that will let the user search for a query.
|
|
23
26
|
*
|
|
24
27
|
* The connector provides to the rendering: `refine()` to set the query. The behaviour of this function
|
|
25
28
|
* may be impacted by the `queryHook` widget parameter.
|
|
26
29
|
*/
|
|
30
|
+
|
|
31
|
+
|
|
27
32
|
var connectSearchBox = function connectSearchBox(renderFn) {
|
|
28
33
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _index.noop;
|
|
29
34
|
(0, _index.checkRendering)(renderFn, withUsage());
|
|
30
35
|
return function (widgetParams) {
|
|
31
36
|
var _ref = widgetParams || {},
|
|
32
|
-
queryHook = _ref.queryHook
|
|
33
|
-
|
|
34
|
-
function clear(helper) {
|
|
35
|
-
return function () {
|
|
36
|
-
helper.setQuery('').search();
|
|
37
|
-
};
|
|
38
|
-
}
|
|
37
|
+
_ref$queryHook = _ref.queryHook,
|
|
38
|
+
queryHook = _ref$queryHook === void 0 ? defaultQueryHook : _ref$queryHook;
|
|
39
39
|
|
|
40
40
|
var _refine;
|
|
41
41
|
|
|
42
|
-
var _clear
|
|
43
|
-
|
|
44
|
-
function _cachedClear() {
|
|
45
|
-
_clear();
|
|
46
|
-
}
|
|
42
|
+
var _clear;
|
|
47
43
|
|
|
48
44
|
return {
|
|
49
45
|
$$type: 'ais.searchBox',
|
|
@@ -75,27 +71,21 @@ var connectSearchBox = function connectSearchBox(renderFn) {
|
|
|
75
71
|
state = _ref3.state;
|
|
76
72
|
|
|
77
73
|
if (!_refine) {
|
|
78
|
-
var setQueryAndSearch = function setQueryAndSearch(query) {
|
|
79
|
-
if (query !== state.query) {
|
|
80
|
-
helper.setQuery(query).search();
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
74
|
_refine = function _refine(query) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
75
|
+
queryHook(query, function (q) {
|
|
76
|
+
return helper.setQuery(q).search();
|
|
77
|
+
});
|
|
78
|
+
};
|
|
89
79
|
|
|
90
|
-
|
|
80
|
+
_clear = function _clear() {
|
|
81
|
+
helper.setQuery('').search();
|
|
91
82
|
};
|
|
92
83
|
}
|
|
93
84
|
|
|
94
|
-
_clear = clear(helper);
|
|
95
85
|
return {
|
|
96
86
|
query: state.query || '',
|
|
97
87
|
refine: _refine,
|
|
98
|
-
clear:
|
|
88
|
+
clear: _clear,
|
|
99
89
|
widgetParams: widgetParams,
|
|
100
90
|
isSearchStalled: searchMetadata.isSearchStalled
|
|
101
91
|
};
|
package/cjs/lib/version.js
CHANGED
|
@@ -4915,7 +4915,9 @@ declare const toggleRefinement: ToggleRefinementWidget;
|
|
|
4915
4915
|
declare type ToggleRefinementConnector = Connector<ToggleRefinementWidgetDescription, ToggleRefinementConnectorParams>;
|
|
4916
4916
|
|
|
4917
4917
|
declare type ToggleRefinementConnectorParams = {
|
|
4918
|
-
/**
|
|
4918
|
+
/**
|
|
4919
|
+
* Name of the attribute for faceting (e.g., "free_shipping").
|
|
4920
|
+
*/
|
|
4919
4921
|
attribute: string;
|
|
4920
4922
|
/**
|
|
4921
4923
|
* Value to filter on when toggled.
|
|
@@ -4950,19 +4952,42 @@ declare type ToggleRefinementCSSClasses = Partial<{
|
|
|
4950
4952
|
declare type ToggleRefinementRenderState = {
|
|
4951
4953
|
/** The current toggle value */
|
|
4952
4954
|
value: {
|
|
4955
|
+
/**
|
|
4956
|
+
* The attribute name of this toggle.
|
|
4957
|
+
*/
|
|
4953
4958
|
name: string;
|
|
4959
|
+
/**
|
|
4960
|
+
* Whether the current option is "on" (true) or "off" (false)
|
|
4961
|
+
*/
|
|
4954
4962
|
isRefined: boolean;
|
|
4963
|
+
/**
|
|
4964
|
+
* Number of results if this option is toggled.
|
|
4965
|
+
*/
|
|
4955
4966
|
count: number | null;
|
|
4967
|
+
/**
|
|
4968
|
+
* Information about the "on" toggle.
|
|
4969
|
+
*/
|
|
4956
4970
|
onFacetValue: ToggleRefinementValue;
|
|
4971
|
+
/**
|
|
4972
|
+
* Information about the "off" toggle.
|
|
4973
|
+
*/
|
|
4957
4974
|
offFacetValue: ToggleRefinementValue;
|
|
4958
4975
|
};
|
|
4959
|
-
/**
|
|
4976
|
+
/**
|
|
4977
|
+
* Creates an URL for the next state.
|
|
4978
|
+
*/
|
|
4960
4979
|
createURL: CreateURL<string>;
|
|
4961
|
-
/**
|
|
4980
|
+
/**
|
|
4981
|
+
* Send a "Facet Clicked" Insights event.
|
|
4982
|
+
*/
|
|
4962
4983
|
sendEvent: SendEventForToggle;
|
|
4963
|
-
/**
|
|
4984
|
+
/**
|
|
4985
|
+
* Indicates if search state can be refined.
|
|
4986
|
+
*/
|
|
4964
4987
|
canRefine: boolean;
|
|
4965
|
-
/**
|
|
4988
|
+
/**
|
|
4989
|
+
* Updates to the next state by applying the toggle refinement.
|
|
4990
|
+
*/
|
|
4966
4991
|
refine: (value?: {
|
|
4967
4992
|
isRefined: boolean;
|
|
4968
4993
|
}) => void;
|
|
@@ -4976,9 +5001,13 @@ declare type ToggleRefinementTemplates = Partial<{
|
|
|
4976
5001
|
}>;
|
|
4977
5002
|
|
|
4978
5003
|
declare type ToggleRefinementValue = {
|
|
4979
|
-
/**
|
|
5004
|
+
/**
|
|
5005
|
+
* Whether this option is enabled.
|
|
5006
|
+
*/
|
|
4980
5007
|
isRefined: boolean;
|
|
4981
|
-
/**
|
|
5008
|
+
/**
|
|
5009
|
+
* Number of result if this option is toggled.
|
|
5010
|
+
*/
|
|
4982
5011
|
count: number | null;
|
|
4983
5012
|
};
|
|
4984
5013
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.37.
|
|
1
|
+
/*! InstantSearch.js 4.37.2 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -8483,7 +8483,7 @@
|
|
|
8483
8483
|
instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
|
|
8484
8484
|
}
|
|
8485
8485
|
|
|
8486
|
-
var version$1 = '4.37.
|
|
8486
|
+
var version$1 = '4.37.2';
|
|
8487
8487
|
|
|
8488
8488
|
var NAMESPACE = 'ais';
|
|
8489
8489
|
var component = function component(componentName) {
|
|
@@ -13019,32 +13019,28 @@
|
|
|
13019
13019
|
connector: true
|
|
13020
13020
|
});
|
|
13021
13021
|
|
|
13022
|
+
var defaultQueryHook = function defaultQueryHook(query, hook) {
|
|
13023
|
+
return hook(query);
|
|
13024
|
+
};
|
|
13022
13025
|
/**
|
|
13023
13026
|
* **SearchBox** connector provides the logic to build a widget that will let the user search for a query.
|
|
13024
13027
|
*
|
|
13025
13028
|
* The connector provides to the rendering: `refine()` to set the query. The behaviour of this function
|
|
13026
13029
|
* may be impacted by the `queryHook` widget parameter.
|
|
13027
13030
|
*/
|
|
13031
|
+
|
|
13032
|
+
|
|
13028
13033
|
var connectSearchBox = function connectSearchBox(renderFn) {
|
|
13029
13034
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
13030
13035
|
checkRendering(renderFn, withUsage$d());
|
|
13031
13036
|
return function (widgetParams) {
|
|
13032
13037
|
var _ref = widgetParams || {},
|
|
13033
|
-
queryHook = _ref.queryHook
|
|
13034
|
-
|
|
13035
|
-
function clear(helper) {
|
|
13036
|
-
return function () {
|
|
13037
|
-
helper.setQuery('').search();
|
|
13038
|
-
};
|
|
13039
|
-
}
|
|
13038
|
+
_ref$queryHook = _ref.queryHook,
|
|
13039
|
+
queryHook = _ref$queryHook === void 0 ? defaultQueryHook : _ref$queryHook;
|
|
13040
13040
|
|
|
13041
13041
|
var _refine;
|
|
13042
13042
|
|
|
13043
|
-
var _clear
|
|
13044
|
-
|
|
13045
|
-
function _cachedClear() {
|
|
13046
|
-
_clear();
|
|
13047
|
-
}
|
|
13043
|
+
var _clear;
|
|
13048
13044
|
|
|
13049
13045
|
return {
|
|
13050
13046
|
$$type: 'ais.searchBox',
|
|
@@ -13076,27 +13072,21 @@
|
|
|
13076
13072
|
state = _ref3.state;
|
|
13077
13073
|
|
|
13078
13074
|
if (!_refine) {
|
|
13079
|
-
var setQueryAndSearch = function setQueryAndSearch(query) {
|
|
13080
|
-
if (query !== state.query) {
|
|
13081
|
-
helper.setQuery(query).search();
|
|
13082
|
-
}
|
|
13083
|
-
};
|
|
13084
|
-
|
|
13085
13075
|
_refine = function _refine(query) {
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13076
|
+
queryHook(query, function (q) {
|
|
13077
|
+
return helper.setQuery(q).search();
|
|
13078
|
+
});
|
|
13079
|
+
};
|
|
13090
13080
|
|
|
13091
|
-
|
|
13081
|
+
_clear = function _clear() {
|
|
13082
|
+
helper.setQuery('').search();
|
|
13092
13083
|
};
|
|
13093
13084
|
}
|
|
13094
13085
|
|
|
13095
|
-
_clear = clear(helper);
|
|
13096
13086
|
return {
|
|
13097
13087
|
query: state.query || '',
|
|
13098
13088
|
refine: _refine,
|
|
13099
|
-
clear:
|
|
13089
|
+
clear: _clear,
|
|
13100
13090
|
widgetParams: widgetParams,
|
|
13101
13091
|
isSearchStalled: searchMetadata.isSearchStalled
|
|
13102
13092
|
};
|
|
@@ -17576,13 +17566,6 @@
|
|
|
17576
17566
|
})));
|
|
17577
17567
|
};
|
|
17578
17568
|
|
|
17579
|
-
Hits.defaultProps = {
|
|
17580
|
-
results: {
|
|
17581
|
-
hits: []
|
|
17582
|
-
},
|
|
17583
|
-
hits: []
|
|
17584
|
-
};
|
|
17585
|
-
|
|
17586
17569
|
var defaultTemplates$5 = {
|
|
17587
17570
|
empty: 'No results',
|
|
17588
17571
|
item: function item(data) {
|
|
@@ -18302,130 +18285,104 @@
|
|
|
18302
18285
|
});
|
|
18303
18286
|
};
|
|
18304
18287
|
|
|
18305
|
-
/** @jsx h */
|
|
18306
|
-
|
|
18307
|
-
function PaginationLink(_ref) {
|
|
18308
|
-
var label = _ref.label,
|
|
18309
|
-
ariaLabel = _ref.ariaLabel,
|
|
18310
|
-
pageNumber = _ref.pageNumber,
|
|
18311
|
-
_ref$additionalClassN = _ref.additionalClassName,
|
|
18312
|
-
additionalClassName = _ref$additionalClassN === void 0 ? null : _ref$additionalClassN,
|
|
18313
|
-
_ref$isDisabled = _ref.isDisabled,
|
|
18314
|
-
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
18315
|
-
_ref$isSelected = _ref.isSelected,
|
|
18316
|
-
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
18317
|
-
cssClasses = _ref.cssClasses,
|
|
18318
|
-
createURL = _ref.createURL,
|
|
18319
|
-
handleClick = _ref.handleClick;
|
|
18320
|
-
var classes = {
|
|
18321
|
-
item: classnames(cssClasses.item, additionalClassName, isDisabled && cssClasses.disabledItem, isSelected && cssClasses.selectedItem),
|
|
18322
|
-
link: cssClasses.link
|
|
18323
|
-
};
|
|
18324
|
-
|
|
18325
|
-
if (isDisabled) {
|
|
18326
|
-
return v("li", {
|
|
18327
|
-
className: classes.item
|
|
18328
|
-
}, v("span", {
|
|
18329
|
-
className: classes.link,
|
|
18330
|
-
dangerouslySetInnerHTML: {
|
|
18331
|
-
__html: label
|
|
18332
|
-
}
|
|
18333
|
-
}));
|
|
18334
|
-
}
|
|
18335
|
-
|
|
18336
|
-
return v("li", {
|
|
18337
|
-
className: classes.item
|
|
18338
|
-
}, v("a", {
|
|
18339
|
-
className: classes.link,
|
|
18340
|
-
"aria-label": ariaLabel,
|
|
18341
|
-
href: createURL(pageNumber),
|
|
18342
|
-
onClick: function onClick(event) {
|
|
18343
|
-
return handleClick(pageNumber, event);
|
|
18344
|
-
},
|
|
18345
|
-
dangerouslySetInnerHTML: {
|
|
18346
|
-
__html: label
|
|
18347
|
-
}
|
|
18348
|
-
}));
|
|
18349
|
-
}
|
|
18350
|
-
|
|
18351
|
-
var defaultProps$3 = {
|
|
18352
|
-
currentPage: 0,
|
|
18353
|
-
nbPages: 0,
|
|
18354
|
-
pages: []
|
|
18355
|
-
};
|
|
18356
|
-
|
|
18357
18288
|
function Pagination(props) {
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18289
|
+
function createClickHandler(pageNumber) {
|
|
18290
|
+
return function (event) {
|
|
18291
|
+
if (isSpecialClick(event)) {
|
|
18292
|
+
// do not alter the default browser behavior
|
|
18293
|
+
// if one special key is down
|
|
18294
|
+
return;
|
|
18295
|
+
}
|
|
18364
18296
|
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
|
|
18297
|
+
event.preventDefault();
|
|
18298
|
+
props.setCurrentPage(pageNumber);
|
|
18299
|
+
};
|
|
18300
|
+
}
|
|
18368
18301
|
|
|
18369
18302
|
return v("div", {
|
|
18370
18303
|
className: classnames(props.cssClasses.root, _defineProperty({}, props.cssClasses.noRefinementRoot, props.nbPages <= 1))
|
|
18371
18304
|
}, v("ul", {
|
|
18372
18305
|
className: props.cssClasses.list
|
|
18373
18306
|
}, props.showFirst && v(PaginationLink, {
|
|
18374
|
-
|
|
18375
|
-
|
|
18376
|
-
additionalClassName: props.cssClasses.firstPageItem,
|
|
18307
|
+
ariaLabel: "First",
|
|
18308
|
+
className: props.cssClasses.firstPageItem,
|
|
18377
18309
|
isDisabled: props.isFirstPage,
|
|
18378
18310
|
label: props.templates.first,
|
|
18379
18311
|
pageNumber: 0,
|
|
18380
18312
|
createURL: props.createURL,
|
|
18381
18313
|
cssClasses: props.cssClasses,
|
|
18382
|
-
|
|
18314
|
+
createClickHandler: createClickHandler
|
|
18383
18315
|
}), props.showPrevious && v(PaginationLink, {
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
additionalClassName: props.cssClasses.previousPageItem,
|
|
18316
|
+
ariaLabel: "Previous",
|
|
18317
|
+
className: props.cssClasses.previousPageItem,
|
|
18387
18318
|
isDisabled: props.isFirstPage,
|
|
18388
18319
|
label: props.templates.previous,
|
|
18389
18320
|
pageNumber: props.currentPage - 1,
|
|
18390
18321
|
createURL: props.createURL,
|
|
18391
18322
|
cssClasses: props.cssClasses,
|
|
18392
|
-
|
|
18323
|
+
createClickHandler: createClickHandler
|
|
18393
18324
|
}), props.pages.map(function (pageNumber) {
|
|
18394
18325
|
return v(PaginationLink, {
|
|
18395
18326
|
key: pageNumber,
|
|
18396
18327
|
ariaLabel: "".concat(pageNumber + 1),
|
|
18397
|
-
|
|
18328
|
+
className: props.cssClasses.pageItem,
|
|
18398
18329
|
isSelected: pageNumber === props.currentPage,
|
|
18399
18330
|
label: "".concat(pageNumber + 1),
|
|
18400
18331
|
pageNumber: pageNumber,
|
|
18401
18332
|
createURL: props.createURL,
|
|
18402
18333
|
cssClasses: props.cssClasses,
|
|
18403
|
-
|
|
18334
|
+
createClickHandler: createClickHandler
|
|
18404
18335
|
});
|
|
18405
18336
|
}), props.showNext && v(PaginationLink, {
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
additionalClassName: props.cssClasses.nextPageItem,
|
|
18337
|
+
ariaLabel: "Next",
|
|
18338
|
+
className: props.cssClasses.nextPageItem,
|
|
18409
18339
|
isDisabled: props.isLastPage,
|
|
18410
18340
|
label: props.templates.next,
|
|
18411
18341
|
pageNumber: props.currentPage + 1,
|
|
18412
18342
|
createURL: props.createURL,
|
|
18413
18343
|
cssClasses: props.cssClasses,
|
|
18414
|
-
|
|
18344
|
+
createClickHandler: createClickHandler
|
|
18415
18345
|
}), props.showLast && v(PaginationLink, {
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
additionalClassName: props.cssClasses.lastPageItem,
|
|
18346
|
+
ariaLabel: "Last",
|
|
18347
|
+
className: props.cssClasses.lastPageItem,
|
|
18419
18348
|
isDisabled: props.isLastPage,
|
|
18420
18349
|
label: props.templates.last,
|
|
18421
18350
|
pageNumber: props.nbPages - 1,
|
|
18422
18351
|
createURL: props.createURL,
|
|
18423
18352
|
cssClasses: props.cssClasses,
|
|
18424
|
-
|
|
18353
|
+
createClickHandler: createClickHandler
|
|
18425
18354
|
})));
|
|
18426
18355
|
}
|
|
18427
18356
|
|
|
18428
|
-
|
|
18357
|
+
function PaginationLink(_ref) {
|
|
18358
|
+
var label = _ref.label,
|
|
18359
|
+
ariaLabel = _ref.ariaLabel,
|
|
18360
|
+
pageNumber = _ref.pageNumber,
|
|
18361
|
+
className = _ref.className,
|
|
18362
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
18363
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
18364
|
+
_ref$isSelected = _ref.isSelected,
|
|
18365
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
18366
|
+
cssClasses = _ref.cssClasses,
|
|
18367
|
+
createURL = _ref.createURL,
|
|
18368
|
+
createClickHandler = _ref.createClickHandler;
|
|
18369
|
+
return v("li", {
|
|
18370
|
+
className: classnames(cssClasses.item, className, isDisabled && cssClasses.disabledItem, isSelected && cssClasses.selectedItem)
|
|
18371
|
+
}, isDisabled ? v("span", {
|
|
18372
|
+
className: cssClasses.link,
|
|
18373
|
+
dangerouslySetInnerHTML: {
|
|
18374
|
+
__html: label
|
|
18375
|
+
}
|
|
18376
|
+
}) : v("a", {
|
|
18377
|
+
className: cssClasses.link,
|
|
18378
|
+
"aria-label": ariaLabel,
|
|
18379
|
+
href: createURL(pageNumber),
|
|
18380
|
+
onClick: createClickHandler(pageNumber),
|
|
18381
|
+
dangerouslySetInnerHTML: {
|
|
18382
|
+
__html: label
|
|
18383
|
+
}
|
|
18384
|
+
}));
|
|
18385
|
+
}
|
|
18429
18386
|
|
|
18430
18387
|
var suit$h = component('Pagination');
|
|
18431
18388
|
var withUsage$G = createDocumentationMessageGenerator({
|