instantsearch.js 4.75.1 → 4.75.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/cjs/components/RefinementList/RefinementList.js +17 -0
- package/cjs/lib/version.js +1 -1
- package/dist/instantsearch.development.js +19 -2
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/RefinementList/RefinementList.d.ts +8 -0
- package/es/components/RefinementList/RefinementList.js +17 -0
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/package.json +5 -5
|
@@ -53,12 +53,20 @@ declare class RefinementList<TTemplates extends Templates> extends Component<Ref
|
|
|
53
53
|
cssClasses: {};
|
|
54
54
|
depth: number;
|
|
55
55
|
};
|
|
56
|
+
private listRef;
|
|
56
57
|
private searchBox;
|
|
58
|
+
private lastRefinedValue;
|
|
57
59
|
shouldComponentUpdate(nextProps: RefinementListPropsWithDefaultProps<TTemplates>): boolean;
|
|
58
60
|
private refine;
|
|
59
61
|
private _generateFacetItem;
|
|
60
62
|
private handleItemClick;
|
|
61
63
|
componentWillReceiveProps(nextProps: RefinementListPropsWithDefaultProps<TTemplates>): void;
|
|
64
|
+
/**
|
|
65
|
+
* This sets focus on the last refined input element after a render
|
|
66
|
+
* because Preact does not perform it automatically.
|
|
67
|
+
* @see https://github.com/preactjs/preact/issues/3242
|
|
68
|
+
*/
|
|
69
|
+
componentDidUpdate(): void;
|
|
62
70
|
private refineFirstValue;
|
|
63
71
|
render(): h.JSX.Element;
|
|
64
72
|
}
|
|
@@ -44,7 +44,9 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
44
44
|
args[_key] = arguments[_key];
|
|
45
45
|
}
|
|
46
46
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
47
|
+
_defineProperty(_assertThisInitialized(_this), "listRef", createRef());
|
|
47
48
|
_defineProperty(_assertThisInitialized(_this), "searchBox", createRef());
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "lastRefinedValue", undefined);
|
|
48
50
|
_defineProperty(_assertThisInitialized(_this), "_generateFacetItem", function (facetValue) {
|
|
49
51
|
var subItems;
|
|
50
52
|
if (isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) {
|
|
@@ -147,6 +149,7 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
147
149
|
}, {
|
|
148
150
|
key: "refine",
|
|
149
151
|
value: function refine(facetValueToRefine) {
|
|
152
|
+
this.lastRefinedValue = facetValueToRefine;
|
|
150
153
|
this.props.toggleRefinement(facetValueToRefine);
|
|
151
154
|
}
|
|
152
155
|
}, {
|
|
@@ -156,6 +159,19 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
156
159
|
this.searchBox.current.resetInput();
|
|
157
160
|
}
|
|
158
161
|
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* This sets focus on the last refined input element after a render
|
|
165
|
+
* because Preact does not perform it automatically.
|
|
166
|
+
* @see https://github.com/preactjs/preact/issues/3242
|
|
167
|
+
*/
|
|
168
|
+
}, {
|
|
169
|
+
key: "componentDidUpdate",
|
|
170
|
+
value: function componentDidUpdate() {
|
|
171
|
+
var _this$listRef$current, _this$listRef$current2;
|
|
172
|
+
(_this$listRef$current = this.listRef.current) === null || _this$listRef$current === void 0 ? void 0 : (_this$listRef$current2 = _this$listRef$current.querySelector("input[value=\"".concat(this.lastRefinedValue, "\"]"))) === null || _this$listRef$current2 === void 0 ? void 0 : _this$listRef$current2.focus();
|
|
173
|
+
this.lastRefinedValue = undefined;
|
|
174
|
+
}
|
|
159
175
|
}, {
|
|
160
176
|
key: "refineFirstValue",
|
|
161
177
|
value: function refineFirstValue() {
|
|
@@ -207,6 +223,7 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
207
223
|
ariaLabel: "Search for filters"
|
|
208
224
|
}));
|
|
209
225
|
var facetValues = this.props.facetValues && this.props.facetValues.length > 0 && h("ul", {
|
|
226
|
+
ref: this.listRef,
|
|
210
227
|
className: this.props.cssClasses.list
|
|
211
228
|
}, this.props.facetValues.map(this._generateFacetItem, this));
|
|
212
229
|
var noResults = this.props.searchFacetValues && this.props.isFromSearch && (!this.props.facetValues || this.props.facetValues.length === 0) && h(Template, _extends({}, this.props.templateProps, {
|
package/es/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.75.
|
|
1
|
+
declare const _default: "4.75.2";
|
|
2
2
|
export default _default;
|
package/es/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.75.
|
|
1
|
+
export default '4.75.2';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantsearch.js",
|
|
3
|
-
"version": "4.75.
|
|
3
|
+
"version": "4.75.2",
|
|
4
4
|
"description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
|
|
5
5
|
"homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"watch:es": "yarn --silent build:es:base --watch"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@instantsearch/mocks": "1.
|
|
60
|
-
"@instantsearch/tests": "1.
|
|
61
|
-
"@instantsearch/testutils": "1.
|
|
59
|
+
"@instantsearch/mocks": "1.60.0",
|
|
60
|
+
"@instantsearch/tests": "1.60.0",
|
|
61
|
+
"@instantsearch/testutils": "1.49.0",
|
|
62
62
|
"@storybook/html": "5.3.9",
|
|
63
63
|
"@types/scriptjs": "0.0.2",
|
|
64
64
|
"algoliasearch": "5.1.1",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"scriptjs": "2.5.9",
|
|
67
67
|
"webpack": "4.47.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "c5f9a44d3f97363b1a0486a18696edbeafc193d5"
|
|
70
70
|
}
|