@211la/search-react 0.15.3 → 0.17.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/dist/index.js CHANGED
@@ -293,18 +293,23 @@ var connectMap = function (apiKey) {
293
293
  /**
294
294
  * LocationDistanceFilter allows to specify how close should the resource be located to be included in the search results.
295
295
  * The location must be specified in other PlaceAutocomplete or a custom component with similar functionality.
296
+ *
297
+ * @param miles - Array of distance options to display
298
+ * @param distanceUnit - Unit to display: 'mi' for miles (default) or 'km' for kilometers
296
299
  */
297
300
  var LocationDistanceFilter = connectGeolocation(function (_a) {
298
- var refine = _a.refine, currentRefinement = _a.currentRefinement, miles = _a.miles;
301
+ var refine = _a.refine, currentRefinement = _a.currentRefinement, miles = _a.miles, distanceUnit = _a.distanceUnit;
299
302
  var aroundRadius = currentRefinement.aroundRadius;
300
303
  var onChange = function (aroundRadius) { return refine({ aroundRadius: aroundRadius }); };
304
+ var unitLabel = distanceUnit === 'km' ? 'km' : 'miles';
301
305
  var distances = miles.map(function (distance) { return (React.createElement("li", { className: "ais-RefinementList-item", key: distance },
302
306
  React.createElement("label", { className: "ais-RefinementList-label", onClick: onChange.bind(null, distance) },
303
307
  React.createElement("input", { className: "ais-RefinementList-checkbox", type: "radio", checked: aroundRadius === distance }),
304
308
  React.createElement("span", { className: "ais-RefinementList-labelText" },
305
309
  ' ',
306
310
  distance,
307
- " miles",
311
+ " ",
312
+ unitLabel,
308
313
  ' ')))); });
309
314
  var mile = (React.createElement("li", { className: "ais-RefinementList-item" },
310
315
  React.createElement("label", { className: "ais-RefinementList-label", onClick: onChange.bind(null, 0) },
@@ -2,5 +2,8 @@ import * as React from 'react';
2
2
  /**
3
3
  * LocationDistanceFilter allows to specify how close should the resource be located to be included in the search results.
4
4
  * The location must be specified in other PlaceAutocomplete or a custom component with similar functionality.
5
+ *
6
+ * @param miles - Array of distance options to display
7
+ * @param distanceUnit - Unit to display: 'mi' for miles (default) or 'km' for kilometers
5
8
  */
6
9
  export declare const LocationDistanceFilter: React.ComponentClass<any, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@211la/search-react",
3
- "version": "0.15.3",
3
+ "version": "0.17.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/types/index.d.ts",
6
6
  "files": [
@@ -41,7 +41,7 @@
41
41
  "typescript": "^4.9.5"
42
42
  },
43
43
  "peerDependencies": {
44
- "@211la/search-client": "^0.15.3",
44
+ "@211la/search-client": "^0.17.0",
45
45
  "react": ">=16.8.0",
46
46
  "react-dom": ">=16.8.0",
47
47
  "react-instantsearch-core": ">=6.11.1",