@211la/search-react 0.13.0 → 0.13.6

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 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 "\"" + value + "\""; };
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) {
@@ -142,7 +142,7 @@ var connectGeolocation = createConnector({
142
142
  var aroundLatLng = nextRefinement.aroundLatLng, aroundRadius = nextRefinement.aroundRadius;
143
143
  var stringifyLatLng = function (_a) {
144
144
  var lat = _a.lat, lng = _a.lng;
145
- return (typeof lat !== 'number' ? '' : lat + ", " + lng);
145
+ return (typeof lat !== 'number' ? '' : "".concat(lat, ", ").concat(lng));
146
146
  };
147
147
  return __assign(__assign({}, searchState), { aroundLatLng: aroundLatLng
148
148
  ? stringifyLatLng(aroundLatLng)
@@ -191,7 +191,7 @@ var connectSearchBoxFields = createConnector({
191
191
  var searchBoxFields = searchState.searchFields || [];
192
192
  return __assign(__assign({}, searchState), { searchFields: searchBoxFields.includes(nextRefinement)
193
193
  ? searchBoxFields.filter(function (field) { return field !== nextRefinement; })
194
- : __spreadArray(__spreadArray([], searchBoxFields), [nextRefinement]) });
194
+ : __spreadArray(__spreadArray([], searchBoxFields, true), [nextRefinement], false) });
195
195
  },
196
196
  getSearchParameters: function (searchParameters, props, searchState) {
197
197
  if (!searchState.searchFields || !searchState.searchFields.length) {
@@ -426,7 +426,7 @@ var connectTaxonomyRefinementList = createConnector({
426
426
  var _a;
427
427
  var _b;
428
428
  var items = ((_b = searchState.taxonomyRefinementList) === null || _b === void 0 ? void 0 : _b[props.attribute]) || [];
429
- var newItems = __spreadArray([], items);
429
+ var newItems = __spreadArray([], items, true);
430
430
  nextRefinement.split('|').forEach(function (item) {
431
431
  var index = newItems.findIndex(function (x) { return x === item; });
432
432
  if (index >= 0) {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { IndexedResource } from '@211la/search-client';
3
3
  import type { Hit, HitsProvided } from 'react-instantsearch-core';
4
- export declare type MarkerData = {
4
+ export type MarkerData = {
5
5
  lat: number;
6
6
  lng: number;
7
7
  } & {
@@ -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
- declare type FieldSearchProps = {
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?: "string" | "number" | undefined) => (Component: React.FunctionComponent<FieldSearchProps>) => React.ComponentClass<import("react-instantsearch-core").RefinementListExposed, any>;
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
  */
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare type TaxonomyRefinementListProps = {
2
+ type TaxonomyRefinementListProps = {
3
3
  attribute: string;
4
4
  items: {
5
5
  label: string;
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "@211la/search-react",
3
- "version": "0.13.0",
3
+ "version": "0.13.6",
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
- "build": "rm -rf ./dist && rollup -c && tsc --emitDeclarationOnly"
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",
@@ -28,12 +35,13 @@
28
35
  "rollup-plugin-peer-deps-external": "^2.2.4",
29
36
  "rollup-plugin-terser": "^7.0.2",
30
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.0.5"
41
+ "typescript": "^4.9.5"
34
42
  },
35
43
  "peerDependencies": {
36
- "@211la/search-client": "^0.13.0",
44
+ "@211la/search-client": "^0.13.6",
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
+ }