@211la/search-react 0.12.1 → 0.13.5
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/dist/index.js +20 -11
- package/dist/types/Map.d.ts +1 -1
- package/dist/types/__tests__/Util.test.d.ts +1 -0
- package/dist/types/__tests__/connectFieldSearch.test.d.ts +1 -0
- package/dist/types/__tests__/setup.d.ts +1 -0
- package/dist/types/connectFieldSearch.d.ts +2 -2
- package/dist/types/taxonomyRefinementList/connectTaxonomyRefinementList.d.ts +1 -1
- package/package.json +14 -6
package/dist/index.js
CHANGED
|
@@ -34,12 +34,12 @@ var makeConnectFieldSearch = function (exact, type) {
|
|
|
34
34
|
trimSurround = function (value) { return value; };
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
surround = function (value) { return "\""
|
|
37
|
+
surround = function (value) { return "\"".concat(value, "\""); };
|
|
38
38
|
trimSurround = function (value) { return trim("\"", "\"", value); };
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
surround = function (value) { return value
|
|
42
|
+
surround = function (value) { return "".concat(value, "*"); };
|
|
43
43
|
trimSurround = function (value) { return trim("", "*", value); };
|
|
44
44
|
}
|
|
45
45
|
return connectRefinementList(function (_a) {
|
|
@@ -70,7 +70,7 @@ var connectExactStringFieldSearch = makeConnectFieldSearch(true, 'string');
|
|
|
70
70
|
*/
|
|
71
71
|
var connectExactNumberFieldSearch = makeConnectFieldSearch(true, 'number');
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
/******************************************************************************
|
|
74
74
|
Copyright (c) Microsoft Corporation.
|
|
75
75
|
|
|
76
76
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -108,11 +108,20 @@ function __rest(s, e) {
|
|
|
108
108
|
return t;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
function __spreadArray(to, from) {
|
|
112
|
-
for (var i = 0,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
function __spreadArray(to, from, pack) {
|
|
112
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
113
|
+
if (ar || !(i in from)) {
|
|
114
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
115
|
+
ar[i] = from[i];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
122
|
+
var e = new Error(message);
|
|
123
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
124
|
+
};
|
|
116
125
|
|
|
117
126
|
/**
|
|
118
127
|
* connectGeolocation helps to make components that specify proximity to the given location.
|
|
@@ -133,7 +142,7 @@ var connectGeolocation = createConnector({
|
|
|
133
142
|
var aroundLatLng = nextRefinement.aroundLatLng, aroundRadius = nextRefinement.aroundRadius;
|
|
134
143
|
var stringifyLatLng = function (_a) {
|
|
135
144
|
var lat = _a.lat, lng = _a.lng;
|
|
136
|
-
return (typeof lat !== 'number' ? '' : lat
|
|
145
|
+
return (typeof lat !== 'number' ? '' : "".concat(lat, ", ").concat(lng));
|
|
137
146
|
};
|
|
138
147
|
return __assign(__assign({}, searchState), { aroundLatLng: aroundLatLng
|
|
139
148
|
? stringifyLatLng(aroundLatLng)
|
|
@@ -182,7 +191,7 @@ var connectSearchBoxFields = createConnector({
|
|
|
182
191
|
var searchBoxFields = searchState.searchFields || [];
|
|
183
192
|
return __assign(__assign({}, searchState), { searchFields: searchBoxFields.includes(nextRefinement)
|
|
184
193
|
? searchBoxFields.filter(function (field) { return field !== nextRefinement; })
|
|
185
|
-
: __spreadArray(__spreadArray([], searchBoxFields), [nextRefinement]) });
|
|
194
|
+
: __spreadArray(__spreadArray([], searchBoxFields, true), [nextRefinement], false) });
|
|
186
195
|
},
|
|
187
196
|
getSearchParameters: function (searchParameters, props, searchState) {
|
|
188
197
|
if (!searchState.searchFields || !searchState.searchFields.length) {
|
|
@@ -417,7 +426,7 @@ var connectTaxonomyRefinementList = createConnector({
|
|
|
417
426
|
var _a;
|
|
418
427
|
var _b;
|
|
419
428
|
var items = ((_b = searchState.taxonomyRefinementList) === null || _b === void 0 ? void 0 : _b[props.attribute]) || [];
|
|
420
|
-
var newItems = __spreadArray([], items);
|
|
429
|
+
var newItems = __spreadArray([], items, true);
|
|
421
430
|
nextRefinement.split('|').forEach(function (item) {
|
|
422
431
|
var index = newItems.findIndex(function (x) { return x === item; });
|
|
423
432
|
if (index >= 0) {
|
package/dist/types/Map.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
type FieldSearchProps = {
|
|
3
3
|
value: string;
|
|
4
4
|
onChange: (name: string) => any;
|
|
5
5
|
type: string;
|
|
@@ -11,7 +11,7 @@ declare type FieldSearchProps = {
|
|
|
11
11
|
* When filtering by prefix value, "homeless" matches "homeless migrants" too.
|
|
12
12
|
* @param type type of the field data. Can be a number (for example, year or zip code) or a string (agency name).
|
|
13
13
|
*/
|
|
14
|
-
export declare const makeConnectFieldSearch: (exact: boolean, type?:
|
|
14
|
+
export declare const makeConnectFieldSearch: (exact: boolean, type?: 'number' | 'string') => (Component: React.FunctionComponent<FieldSearchProps>) => React.ComponentClass<import("react-instantsearch-core").RefinementListExposed, any>;
|
|
15
15
|
/**
|
|
16
16
|
* connectStringFieldSearch makes components to search a string field for all values that start with the given one.
|
|
17
17
|
*/
|
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@211la/search-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/types/index.d.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
|
-
"
|
|
10
|
+
"tsc": "tsc --noEmit",
|
|
11
|
+
"build": "rm -rf ./dist && rollup -c && tsc --emitDeclarationOnly",
|
|
12
|
+
"test": "jest --config jest.config.js",
|
|
13
|
+
"test:watch": "jest --config jest.config.js --watch"
|
|
11
14
|
},
|
|
12
15
|
"dependencies": {
|
|
13
16
|
"google-maps-react": "^2.0.6"
|
|
@@ -16,10 +19,14 @@
|
|
|
16
19
|
"@211la/search-client": "file:../search-client",
|
|
17
20
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
18
21
|
"@rollup/plugin-typescript": "^8.2.1",
|
|
22
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
23
|
+
"@testing-library/react": "^12.1.5",
|
|
24
|
+
"@types/jest": "^26.0.23",
|
|
19
25
|
"@types/react": "^17.0.11",
|
|
20
26
|
"@types/react-instantsearch-core": "^6.10.2",
|
|
21
27
|
"@types/react-instantsearch-dom": "^6.10.0",
|
|
22
28
|
"@types/react-places-autocomplete": "^7.2.6",
|
|
29
|
+
"jest": "^26.6.3",
|
|
23
30
|
"react": ">=16.8.0",
|
|
24
31
|
"react-dom": ">=16.8.0",
|
|
25
32
|
"react-instantsearch-core": "^6.11.1",
|
|
@@ -27,13 +34,14 @@
|
|
|
27
34
|
"rollup": "^2.48.0",
|
|
28
35
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
29
36
|
"rollup-plugin-terser": "^7.0.2",
|
|
30
|
-
"rollup-plugin-typescript2": "^0.
|
|
37
|
+
"rollup-plugin-typescript2": "^0.32.1",
|
|
38
|
+
"ts-jest": "^26.4.4",
|
|
31
39
|
"ts-loader": "^8.0.12",
|
|
32
40
|
"tslib": "^2.3.0",
|
|
33
|
-
"typescript": "^4.
|
|
41
|
+
"typescript": "^4.9.5"
|
|
34
42
|
},
|
|
35
43
|
"peerDependencies": {
|
|
36
|
-
"@211la/search-client": "^0.
|
|
44
|
+
"@211la/search-client": "^0.13.5",
|
|
37
45
|
"react": ">=16.8.0",
|
|
38
46
|
"react-dom": ">=16.8.0",
|
|
39
47
|
"react-instantsearch-core": ">=6.11.1",
|
|
@@ -44,4 +52,4 @@
|
|
|
44
52
|
"url": "git+https://github.com/211la/cs-search-widget.git",
|
|
45
53
|
"directory": "react"
|
|
46
54
|
}
|
|
47
|
-
}
|
|
55
|
+
}
|