react-simple-maps 3.0.0-beta.1 → 3.0.0-beta.4

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
@@ -2,109 +2,224 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
5
  var React = require('react');
8
- var React__default = _interopDefault(React);
9
- var PropTypes = _interopDefault(require('prop-types'));
6
+ var PropTypes = require('prop-types');
10
7
  var d3Geo = require('d3-geo');
11
8
  var topojsonClient = require('topojson-client');
12
9
  var d3Zoom = require('d3-zoom');
13
10
  var d3Selection = require('d3-selection');
14
11
 
15
- var _extends = Object.assign || function (target) {
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ function _interopNamespace(e) {
15
+ if (e && e.__esModule) return e;
16
+ var n = Object.create(null);
17
+ if (e) {
18
+ Object.keys(e).forEach(function (k) {
19
+ if (k !== 'default') {
20
+ var d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: function () { return e[k]; }
24
+ });
25
+ }
26
+ });
27
+ }
28
+ n["default"] = e;
29
+ return Object.freeze(n);
30
+ }
31
+
32
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
33
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
34
+ var d3Geo__namespace = /*#__PURE__*/_interopNamespace(d3Geo);
35
+
36
+ function ownKeys(object, enumerableOnly) {
37
+ var keys = Object.keys(object);
38
+
39
+ if (Object.getOwnPropertySymbols) {
40
+ var symbols = Object.getOwnPropertySymbols(object);
41
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
42
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
43
+ })), keys.push.apply(keys, symbols);
44
+ }
45
+
46
+ return keys;
47
+ }
48
+
49
+ function _objectSpread2(target) {
16
50
  for (var i = 1; i < arguments.length; i++) {
17
- var source = arguments[i];
51
+ var source = null != arguments[i] ? arguments[i] : {};
52
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
53
+ _defineProperty(target, key, source[key]);
54
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
55
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
56
+ });
57
+ }
58
+
59
+ return target;
60
+ }
61
+
62
+ function _typeof(obj) {
63
+ "@babel/helpers - typeof";
18
64
 
19
- for (var key in source) {
20
- if (Object.prototype.hasOwnProperty.call(source, key)) {
21
- target[key] = source[key];
65
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
66
+ return typeof obj;
67
+ } : function (obj) {
68
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
69
+ }, _typeof(obj);
70
+ }
71
+
72
+ function _defineProperty(obj, key, value) {
73
+ if (key in obj) {
74
+ Object.defineProperty(obj, key, {
75
+ value: value,
76
+ enumerable: true,
77
+ configurable: true,
78
+ writable: true
79
+ });
80
+ } else {
81
+ obj[key] = value;
82
+ }
83
+
84
+ return obj;
85
+ }
86
+
87
+ function _extends() {
88
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
89
+ for (var i = 1; i < arguments.length; i++) {
90
+ var source = arguments[i];
91
+
92
+ for (var key in source) {
93
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
94
+ target[key] = source[key];
95
+ }
22
96
  }
23
97
  }
98
+
99
+ return target;
100
+ };
101
+ return _extends.apply(this, arguments);
102
+ }
103
+
104
+ function _objectWithoutPropertiesLoose(source, excluded) {
105
+ if (source == null) return {};
106
+ var target = {};
107
+ var sourceKeys = Object.keys(source);
108
+ var key, i;
109
+
110
+ for (i = 0; i < sourceKeys.length; i++) {
111
+ key = sourceKeys[i];
112
+ if (excluded.indexOf(key) >= 0) continue;
113
+ target[key] = source[key];
24
114
  }
25
115
 
26
116
  return target;
27
- };
117
+ }
28
118
 
29
- var objectWithoutProperties = function (obj, keys) {
30
- var target = {};
119
+ function _objectWithoutProperties(source, excluded) {
120
+ if (source == null) return {};
121
+
122
+ var target = _objectWithoutPropertiesLoose(source, excluded);
123
+
124
+ var key, i;
31
125
 
32
- for (var i in obj) {
33
- if (keys.indexOf(i) >= 0) continue;
34
- if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
35
- target[i] = obj[i];
126
+ if (Object.getOwnPropertySymbols) {
127
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
128
+
129
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
130
+ key = sourceSymbolKeys[i];
131
+ if (excluded.indexOf(key) >= 0) continue;
132
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
133
+ target[key] = source[key];
134
+ }
36
135
  }
37
136
 
38
137
  return target;
39
- };
138
+ }
40
139
 
41
- var slicedToArray = function () {
42
- function sliceIterator(arr, i) {
43
- var _arr = [];
44
- var _n = true;
45
- var _d = false;
46
- var _e = undefined;
140
+ function _slicedToArray(arr, i) {
141
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
142
+ }
47
143
 
48
- try {
49
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
50
- _arr.push(_s.value);
144
+ function _arrayWithHoles(arr) {
145
+ if (Array.isArray(arr)) return arr;
146
+ }
51
147
 
52
- if (i && _arr.length === i) break;
53
- }
54
- } catch (err) {
55
- _d = true;
56
- _e = err;
148
+ function _iterableToArrayLimit(arr, i) {
149
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
150
+
151
+ if (_i == null) return;
152
+ var _arr = [];
153
+ var _n = true;
154
+ var _d = false;
155
+
156
+ var _s, _e;
157
+
158
+ try {
159
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
160
+ _arr.push(_s.value);
161
+
162
+ if (i && _arr.length === i) break;
163
+ }
164
+ } catch (err) {
165
+ _d = true;
166
+ _e = err;
167
+ } finally {
168
+ try {
169
+ if (!_n && _i["return"] != null) _i["return"]();
57
170
  } finally {
58
- try {
59
- if (!_n && _i["return"]) _i["return"]();
60
- } finally {
61
- if (_d) throw _e;
62
- }
171
+ if (_d) throw _e;
63
172
  }
64
-
65
- return _arr;
66
173
  }
67
174
 
68
- return function (arr, i) {
69
- if (Array.isArray(arr)) {
70
- return arr;
71
- } else if (Symbol.iterator in Object(arr)) {
72
- return sliceIterator(arr, i);
73
- } else {
74
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
75
- }
76
- };
77
- }();
175
+ return _arr;
176
+ }
78
177
 
79
- var geoPath = d3Geo.geoPath,
80
- projections = objectWithoutProperties(d3Geo, ["geoPath"]);
178
+ function _unsupportedIterableToArray(o, minLen) {
179
+ if (!o) return;
180
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
181
+ var n = Object.prototype.toString.call(o).slice(8, -1);
182
+ if (n === "Object" && o.constructor) n = o.constructor.name;
183
+ if (n === "Map" || n === "Set") return Array.from(o);
184
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
185
+ }
186
+
187
+ function _arrayLikeToArray(arr, len) {
188
+ if (len == null || len > arr.length) len = arr.length;
81
189
 
190
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
191
+
192
+ return arr2;
193
+ }
194
+
195
+ function _nonIterableRest() {
196
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
197
+ }
198
+
199
+ var _excluded$9 = ["width", "height", "projection", "projectionConfig"];
200
+
201
+ var geoPath = d3Geo__namespace.geoPath,
202
+ projections = _objectWithoutProperties(d3Geo__namespace, ["geoPath"]);
82
203
 
83
204
  var MapContext = React.createContext();
84
205
 
85
206
  var makeProjection = function makeProjection(_ref) {
86
207
  var _ref$projectionConfig = _ref.projectionConfig,
87
- projectionConfig = _ref$projectionConfig === undefined ? {} : _ref$projectionConfig,
208
+ projectionConfig = _ref$projectionConfig === void 0 ? {} : _ref$projectionConfig,
88
209
  _ref$projection = _ref.projection,
89
- projection = _ref$projection === undefined ? "geoEqualEarth" : _ref$projection,
210
+ projection = _ref$projection === void 0 ? "geoEqualEarth" : _ref$projection,
90
211
  _ref$width = _ref.width,
91
- width = _ref$width === undefined ? 800 : _ref$width,
212
+ width = _ref$width === void 0 ? 800 : _ref$width,
92
213
  _ref$height = _ref.height,
93
- height = _ref$height === undefined ? 600 : _ref$height;
94
-
214
+ height = _ref$height === void 0 ? 600 : _ref$height;
95
215
  var isFunc = typeof projection === "function";
96
-
97
216
  if (isFunc) return projection;
98
-
99
217
  var proj = projections[projection]().translate([width / 2, height / 2]);
100
-
101
218
  var supported = [proj.center ? "center" : null, proj.rotate ? "rotate" : null, proj.scale ? "scale" : null, proj.parallels ? "parallels" : null];
102
-
103
219
  supported.forEach(function (d) {
104
220
  if (!d) return;
105
221
  proj = proj[d](projectionConfig[d] || proj[d]());
106
222
  });
107
-
108
223
  return proj;
109
224
  };
110
225
 
@@ -113,26 +228,25 @@ var MapProvider = function MapProvider(_ref2) {
113
228
  height = _ref2.height,
114
229
  projection = _ref2.projection,
115
230
  projectionConfig = _ref2.projectionConfig,
116
- restProps = objectWithoutProperties(_ref2, ["width", "height", "projection", "projectionConfig"]);
231
+ restProps = _objectWithoutProperties(_ref2, _excluded$9);
117
232
 
118
233
  var _ref3 = projectionConfig.center || [],
119
- _ref4 = slicedToArray(_ref3, 2),
234
+ _ref4 = _slicedToArray(_ref3, 2),
120
235
  cx = _ref4[0],
121
236
  cy = _ref4[1];
122
237
 
123
238
  var _ref5 = projectionConfig.rotate || [],
124
- _ref6 = slicedToArray(_ref5, 3),
239
+ _ref6 = _slicedToArray(_ref5, 3),
125
240
  rx = _ref6[0],
126
241
  ry = _ref6[1],
127
242
  rz = _ref6[2];
128
243
 
129
244
  var _ref7 = projectionConfig.parallels || [],
130
- _ref8 = slicedToArray(_ref7, 2),
245
+ _ref8 = _slicedToArray(_ref7, 2),
131
246
  p1 = _ref8[0],
132
247
  p2 = _ref8[1];
133
248
 
134
249
  var s = projectionConfig.scale || null;
135
-
136
250
  var projMemo = React.useMemo(function () {
137
251
  return makeProjection({
138
252
  projectionConfig: {
@@ -146,9 +260,7 @@ var MapProvider = function MapProvider(_ref2) {
146
260
  height: height
147
261
  });
148
262
  }, [width, height, projection, cx, cy, rx, ry, rz, p1, p2, s]);
149
-
150
263
  var proj = React.useCallback(projMemo, [projMemo]);
151
-
152
264
  var value = React.useMemo(function () {
153
265
  return {
154
266
  width: width,
@@ -157,51 +269,50 @@ var MapProvider = function MapProvider(_ref2) {
157
269
  path: geoPath().projection(proj)
158
270
  };
159
271
  }, [width, height, proj]);
160
-
161
- return React__default.createElement(MapContext.Provider, _extends({ value: value }, restProps));
272
+ return /*#__PURE__*/React__default["default"].createElement(MapContext.Provider, _extends({
273
+ value: value
274
+ }, restProps));
162
275
  };
163
276
 
164
277
  MapProvider.propTypes = {
165
- width: PropTypes.number,
166
- height: PropTypes.number,
167
- projection: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
168
- projectionConfig: PropTypes.object
278
+ width: PropTypes__default["default"].number,
279
+ height: PropTypes__default["default"].number,
280
+ projection: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].func]),
281
+ projectionConfig: PropTypes__default["default"].object
169
282
  };
170
283
 
284
+ var _excluded$8 = ["width", "height", "projection", "projectionConfig", "className"];
285
+
171
286
  var ComposableMap = function ComposableMap(_ref) {
172
287
  var _ref$width = _ref.width,
173
- width = _ref$width === undefined ? 800 : _ref$width,
288
+ width = _ref$width === void 0 ? 800 : _ref$width,
174
289
  _ref$height = _ref.height,
175
- height = _ref$height === undefined ? 600 : _ref$height,
290
+ height = _ref$height === void 0 ? 600 : _ref$height,
176
291
  _ref$projection = _ref.projection,
177
- projection = _ref$projection === undefined ? "geoEqualEarth" : _ref$projection,
292
+ projection = _ref$projection === void 0 ? "geoEqualEarth" : _ref$projection,
178
293
  _ref$projectionConfig = _ref.projectionConfig,
179
- projectionConfig = _ref$projectionConfig === undefined ? {} : _ref$projectionConfig,
294
+ projectionConfig = _ref$projectionConfig === void 0 ? {} : _ref$projectionConfig,
180
295
  _ref$className = _ref.className,
181
- className = _ref$className === undefined ? "" : _ref$className,
182
- restProps = objectWithoutProperties(_ref, ["width", "height", "projection", "projectionConfig", "className"]);
183
-
184
- return React__default.createElement(
185
- MapProvider,
186
- {
187
- width: width,
188
- height: height,
189
- projection: projection,
190
- projectionConfig: projectionConfig
191
- },
192
- React__default.createElement("svg", _extends({
193
- viewBox: "0 0 " + width + " " + height,
194
- className: "rsm-svg " + className
195
- }, restProps))
196
- );
296
+ className = _ref$className === void 0 ? "" : _ref$className,
297
+ restProps = _objectWithoutProperties(_ref, _excluded$8);
298
+
299
+ return /*#__PURE__*/React__default["default"].createElement(MapProvider, {
300
+ width: width,
301
+ height: height,
302
+ projection: projection,
303
+ projectionConfig: projectionConfig
304
+ }, /*#__PURE__*/React__default["default"].createElement("svg", _extends({
305
+ viewBox: "0 0 ".concat(width, " ").concat(height),
306
+ className: "rsm-svg ".concat(className)
307
+ }, restProps)));
197
308
  };
198
309
 
199
310
  ComposableMap.propTypes = {
200
- width: PropTypes.number,
201
- height: PropTypes.number,
202
- projection: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
203
- projectionConfig: PropTypes.object,
204
- className: PropTypes.string
311
+ width: PropTypes__default["default"].number,
312
+ height: PropTypes__default["default"].number,
313
+ projection: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].func]),
314
+ projectionConfig: PropTypes__default["default"].object,
315
+ className: PropTypes__default["default"].string
205
316
  };
206
317
 
207
318
  function getCoords(w, h, t) {
@@ -209,27 +320,27 @@ function getCoords(w, h, t) {
209
320
  var yOffset = (h * t.k - h) / 2;
210
321
  return [w / 2 - (xOffset + t.x) / t.k, h / 2 - (yOffset + t.y) / t.k];
211
322
  }
212
-
213
323
  function fetchGeographies(url) {
214
324
  return fetch(url).then(function (res) {
215
325
  if (!res.ok) {
216
326
  throw Error(res.statusText);
217
327
  }
328
+
218
329
  return res.json();
219
- }).catch(function (error) {
330
+ })["catch"](function (error) {
220
331
  console.log("There was a problem when fetching the data: ", error);
221
332
  });
222
333
  }
223
-
224
334
  function getFeatures(geographies, parseGeographies) {
225
335
  var isTopojson = geographies.type === "Topology";
336
+
226
337
  if (!isTopojson) {
227
338
  return parseGeographies ? parseGeographies(geographies.features || geographies) : geographies.features || geographies;
228
339
  }
340
+
229
341
  var feats = topojsonClient.feature(geographies, geographies.objects[Object.keys(geographies.objects)[0]]).features;
230
342
  return parseGeographies ? parseGeographies(feats) : feats;
231
343
  }
232
-
233
344
  function getMesh(geographies) {
234
345
  var isTopojson = geographies.type === "Topology";
235
346
  if (!isTopojson) return null;
@@ -239,36 +350,40 @@ function getMesh(geographies) {
239
350
  var borders = topojsonClient.mesh(geographies, geographies.objects[Object.keys(geographies.objects)[0]], function (a, b) {
240
351
  return a !== b;
241
352
  });
242
- return { outline: outline, borders: borders };
353
+ return {
354
+ outline: outline,
355
+ borders: borders
356
+ };
243
357
  }
244
-
245
358
  function prepareMesh(outline, borders, path) {
246
359
  return outline && borders ? {
247
- outline: _extends({}, outline, { rsmKey: "outline", svgPath: path(outline) }),
248
- borders: _extends({}, borders, { rsmKey: "borders", svgPath: path(borders) })
360
+ outline: _objectSpread2(_objectSpread2({}, outline), {}, {
361
+ rsmKey: "outline",
362
+ svgPath: path(outline)
363
+ }),
364
+ borders: _objectSpread2(_objectSpread2({}, borders), {}, {
365
+ rsmKey: "borders",
366
+ svgPath: path(borders)
367
+ })
249
368
  } : {};
250
369
  }
251
-
252
370
  function prepareFeatures(geographies, path) {
253
371
  return geographies ? geographies.map(function (d, i) {
254
- return _extends({}, d, {
255
- rsmKey: "geo-" + i,
372
+ return _objectSpread2(_objectSpread2({}, d), {}, {
373
+ rsmKey: "geo-".concat(i),
256
374
  svgPath: path(d)
257
375
  });
258
376
  }) : [];
259
377
  }
260
-
261
378
  function createConnectorPath() {
262
379
  var dx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 30;
263
380
  var dy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 30;
264
381
  var curve = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.5;
265
-
266
382
  var curvature = Array.isArray(curve) ? curve : [curve, curve];
267
383
  var curveX = dx / 2 * curvature[0];
268
384
  var curveY = dy / 2 * curvature[1];
269
- return "M" + 0 + "," + 0 + " Q" + (-dx / 2 - curveX) + "," + (-dy / 2 + curveY) + " " + -dx + "," + -dy;
385
+ return "M".concat(0, ",", 0, " Q", -dx / 2 - curveX, ",").concat(-dy / 2 + curveY, " ").concat(-dx, ",").concat(-dy);
270
386
  }
271
-
272
387
  function isString(geo) {
273
388
  return typeof geo === "string";
274
389
  }
@@ -281,13 +396,12 @@ function useGeographies(_ref) {
281
396
  path = _useContext.path;
282
397
 
283
398
  var _useState = React.useState({}),
284
- _useState2 = slicedToArray(_useState, 2),
399
+ _useState2 = _slicedToArray(_useState, 2),
285
400
  output = _useState2[0],
286
401
  setOutput = _useState2[1];
287
402
 
288
403
  React.useEffect(function () {
289
- if (typeof window === "undefined") return;
290
-
404
+ if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "undefined") return;
291
405
  if (!geography) return;
292
406
 
293
407
  if (isString(geography)) {
@@ -320,40 +434,55 @@ function useGeographies(_ref) {
320
434
  outline = _useMemo.outline,
321
435
  borders = _useMemo.borders;
322
436
 
323
- return { geographies: geographies, outline: outline, borders: borders };
437
+ return {
438
+ geographies: geographies,
439
+ outline: outline,
440
+ borders: borders
441
+ };
324
442
  }
325
443
 
444
+ var _excluded$7 = ["geography", "children", "parseGeographies", "className"];
445
+
326
446
  var Geographies = function Geographies(_ref) {
327
447
  var geography = _ref.geography,
328
448
  children = _ref.children,
329
449
  parseGeographies = _ref.parseGeographies,
330
450
  _ref$className = _ref.className,
331
- className = _ref$className === undefined ? "" : _ref$className,
332
- restProps = objectWithoutProperties(_ref, ["geography", "children", "parseGeographies", "className"]);
451
+ className = _ref$className === void 0 ? "" : _ref$className,
452
+ restProps = _objectWithoutProperties(_ref, _excluded$7);
333
453
 
334
454
  var _useContext = React.useContext(MapContext),
335
455
  path = _useContext.path,
336
456
  projection = _useContext.projection;
337
457
 
338
- var _useGeographies = useGeographies({ geography: geography, parseGeographies: parseGeographies }),
458
+ var _useGeographies = useGeographies({
459
+ geography: geography,
460
+ parseGeographies: parseGeographies
461
+ }),
339
462
  geographies = _useGeographies.geographies,
340
463
  outline = _useGeographies.outline,
341
464
  borders = _useGeographies.borders;
342
465
 
343
- return React__default.createElement(
344
- "g",
345
- _extends({ className: "rsm-geographies " + className }, restProps),
346
- geographies && geographies.length > 0 && children({ geographies: geographies, outline: outline, borders: borders, path: path, projection: projection })
347
- );
466
+ return /*#__PURE__*/React__default["default"].createElement("g", _extends({
467
+ className: "rsm-geographies ".concat(className)
468
+ }, restProps), geographies && geographies.length > 0 && children({
469
+ geographies: geographies,
470
+ outline: outline,
471
+ borders: borders,
472
+ path: path,
473
+ projection: projection
474
+ }));
348
475
  };
349
476
 
350
477
  Geographies.propTypes = {
351
- geography: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array]),
352
- children: PropTypes.func,
353
- parseGeographies: PropTypes.func,
354
- className: PropTypes.string
478
+ geography: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].object, PropTypes__default["default"].array]),
479
+ children: PropTypes__default["default"].func,
480
+ parseGeographies: PropTypes__default["default"].func,
481
+ className: PropTypes__default["default"].string
355
482
  };
356
483
 
484
+ var _excluded$6 = ["geography", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "style", "className"];
485
+
357
486
  var Geography = function Geography(_ref) {
358
487
  var geography = _ref.geography,
359
488
  onMouseEnter = _ref.onMouseEnter,
@@ -363,18 +492,18 @@ var Geography = function Geography(_ref) {
363
492
  onFocus = _ref.onFocus,
364
493
  onBlur = _ref.onBlur,
365
494
  _ref$style = _ref.style,
366
- style = _ref$style === undefined ? {} : _ref$style,
495
+ style = _ref$style === void 0 ? {} : _ref$style,
367
496
  _ref$className = _ref.className,
368
- className = _ref$className === undefined ? "" : _ref$className,
369
- restProps = objectWithoutProperties(_ref, ["geography", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "style", "className"]);
497
+ className = _ref$className === void 0 ? "" : _ref$className,
498
+ restProps = _objectWithoutProperties(_ref, _excluded$6);
370
499
 
371
500
  var _useState = React.useState(false),
372
- _useState2 = slicedToArray(_useState, 2),
501
+ _useState2 = _slicedToArray(_useState, 2),
373
502
  isPressed = _useState2[0],
374
503
  setPressed = _useState2[1];
375
504
 
376
505
  var _useState3 = React.useState(false),
377
- _useState4 = slicedToArray(_useState3, 2),
506
+ _useState4 = _slicedToArray(_useState3, 2),
378
507
  isFocused = _useState4[0],
379
508
  setFocus = _useState4[1];
380
509
 
@@ -410,9 +539,9 @@ var Geography = function Geography(_ref) {
410
539
  if (onMouseUp) onMouseUp(evt);
411
540
  }
412
541
 
413
- return React__default.createElement("path", _extends({
542
+ return /*#__PURE__*/React__default["default"].createElement("path", _extends({
414
543
  tabIndex: "0",
415
- className: "rsm-geography " + className,
544
+ className: "rsm-geography ".concat(className),
416
545
  d: geography.svgPath,
417
546
  onMouseEnter: handleMouseEnter,
418
547
  onMouseLeave: handleMouseLeave,
@@ -425,48 +554,48 @@ var Geography = function Geography(_ref) {
425
554
  };
426
555
 
427
556
  Geography.propTypes = {
428
- geography: PropTypes.object,
429
- onMouseEnter: PropTypes.func,
430
- onMouseLeave: PropTypes.func,
431
- onMouseDown: PropTypes.func,
432
- onMouseUp: PropTypes.func,
433
- onFocus: PropTypes.func,
434
- onBlur: PropTypes.func,
435
- style: PropTypes.object,
436
- className: PropTypes.string
557
+ geography: PropTypes__default["default"].object,
558
+ onMouseEnter: PropTypes__default["default"].func,
559
+ onMouseLeave: PropTypes__default["default"].func,
560
+ onMouseDown: PropTypes__default["default"].func,
561
+ onMouseUp: PropTypes__default["default"].func,
562
+ onFocus: PropTypes__default["default"].func,
563
+ onBlur: PropTypes__default["default"].func,
564
+ style: PropTypes__default["default"].object,
565
+ className: PropTypes__default["default"].string
437
566
  };
438
-
439
567
  var Geography$1 = React.memo(Geography);
440
568
 
569
+ var _excluded$5 = ["fill", "stroke", "step", "className"];
570
+
441
571
  var Graticule = function Graticule(_ref) {
442
572
  var _ref$fill = _ref.fill,
443
- fill = _ref$fill === undefined ? "transparent" : _ref$fill,
573
+ fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
444
574
  _ref$stroke = _ref.stroke,
445
- stroke = _ref$stroke === undefined ? "currentcolor" : _ref$stroke,
575
+ stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
446
576
  _ref$step = _ref.step,
447
- step = _ref$step === undefined ? [10, 10] : _ref$step,
577
+ step = _ref$step === void 0 ? [10, 10] : _ref$step,
448
578
  _ref$className = _ref.className,
449
- className = _ref$className === undefined ? "" : _ref$className,
450
- restProps = objectWithoutProperties(_ref, ["fill", "stroke", "step", "className"]);
579
+ className = _ref$className === void 0 ? "" : _ref$className,
580
+ restProps = _objectWithoutProperties(_ref, _excluded$5);
451
581
 
452
582
  var _useContext = React.useContext(MapContext),
453
583
  path = _useContext.path;
454
584
 
455
- return React__default.createElement("path", _extends({
585
+ return /*#__PURE__*/React__default["default"].createElement("path", _extends({
456
586
  d: path(d3Geo.geoGraticule().step(step)()),
457
587
  fill: fill,
458
588
  stroke: stroke,
459
- className: "rsm-graticule " + className
589
+ className: "rsm-graticule ".concat(className)
460
590
  }, restProps));
461
591
  };
462
592
 
463
593
  Graticule.propTypes = {
464
- fill: PropTypes.string,
465
- stroke: PropTypes.string,
466
- step: PropTypes.array,
467
- className: PropTypes.string
594
+ fill: PropTypes__default["default"].string,
595
+ stroke: PropTypes__default["default"].string,
596
+ step: PropTypes__default["default"].array,
597
+ className: PropTypes__default["default"].string
468
598
  };
469
-
470
599
  var Graticule$1 = React.memo(Graticule);
471
600
 
472
601
  function useZoomPan(_ref) {
@@ -476,44 +605,52 @@ function useZoomPan(_ref) {
476
605
  onMoveEnd = _ref.onMoveEnd,
477
606
  onMove = _ref.onMove,
478
607
  _ref$translateExtent = _ref.translateExtent,
479
- translateExtent = _ref$translateExtent === undefined ? [[-Infinity, -Infinity], [Infinity, Infinity]] : _ref$translateExtent,
608
+ translateExtent = _ref$translateExtent === void 0 ? [[-Infinity, -Infinity], [Infinity, Infinity]] : _ref$translateExtent,
480
609
  _ref$scaleExtent = _ref.scaleExtent,
481
- scaleExtent = _ref$scaleExtent === undefined ? [1, 8] : _ref$scaleExtent,
610
+ scaleExtent = _ref$scaleExtent === void 0 ? [1, 8] : _ref$scaleExtent,
482
611
  _ref$zoom = _ref.zoom,
483
- zoom = _ref$zoom === undefined ? 1 : _ref$zoom;
612
+ zoom = _ref$zoom === void 0 ? 1 : _ref$zoom;
484
613
 
485
614
  var _useContext = React.useContext(MapContext),
486
615
  width = _useContext.width,
487
616
  height = _useContext.height,
488
617
  projection = _useContext.projection;
489
618
 
490
- var _center = slicedToArray(center, 2),
619
+ var _center = _slicedToArray(center, 2),
491
620
  lon = _center[0],
492
621
  lat = _center[1];
493
622
 
494
- var _useState = React.useState({ x: 0, y: 0, k: 1 }),
495
- _useState2 = slicedToArray(_useState, 2),
623
+ var _useState = React.useState({
624
+ x: 0,
625
+ y: 0,
626
+ k: 1
627
+ }),
628
+ _useState2 = _slicedToArray(_useState, 2),
496
629
  position = _useState2[0],
497
630
  setPosition = _useState2[1];
498
631
 
499
- var lastPosition = React.useRef({ x: 0, y: 0, k: 1 });
632
+ var lastPosition = React.useRef({
633
+ x: 0,
634
+ y: 0,
635
+ k: 1
636
+ });
500
637
  var mapRef = React.useRef();
501
638
  var zoomRef = React.useRef();
502
639
  var bypassEvents = React.useRef(false);
503
640
 
504
- var _translateExtent = slicedToArray(translateExtent, 2),
641
+ var _translateExtent = _slicedToArray(translateExtent, 2),
505
642
  a = _translateExtent[0],
506
643
  b = _translateExtent[1];
507
644
 
508
- var _a = slicedToArray(a, 2),
645
+ var _a = _slicedToArray(a, 2),
509
646
  a1 = _a[0],
510
647
  a2 = _a[1];
511
648
 
512
- var _b = slicedToArray(b, 2),
649
+ var _b = _slicedToArray(b, 2),
513
650
  b1 = _b[0],
514
651
  b2 = _b[1];
515
652
 
516
- var _scaleExtent = slicedToArray(scaleExtent, 2),
653
+ var _scaleExtent = _slicedToArray(scaleExtent, 2),
517
654
  minZoom = _scaleExtent[0],
518
655
  maxZoom = _scaleExtent[1];
519
656
 
@@ -522,17 +659,29 @@ function useZoomPan(_ref) {
522
659
 
523
660
  function handleZoomStart(d3Event) {
524
661
  if (!onMoveStart || bypassEvents.current) return;
525
- onMoveStart({ coordinates: projection.invert(getCoords(width, height, d3Event.transform)), zoom: d3Event.transform.k }, d3Event);
662
+ onMoveStart({
663
+ coordinates: projection.invert(getCoords(width, height, d3Event.transform)),
664
+ zoom: d3Event.transform.k
665
+ }, d3Event);
526
666
  }
527
667
 
528
668
  function handleZoom(d3Event) {
529
669
  if (bypassEvents.current) return;
530
670
  var transform = d3Event.transform,
531
671
  sourceEvent = d3Event.sourceEvent;
532
-
533
- setPosition({ x: transform.x, y: transform.y, k: transform.k, dragging: sourceEvent });
672
+ setPosition({
673
+ x: transform.x,
674
+ y: transform.y,
675
+ k: transform.k,
676
+ dragging: sourceEvent
677
+ });
534
678
  if (!onMove) return;
535
- onMove({ x: transform.x, y: transform.y, zoom: transform.k, dragging: sourceEvent }, d3Event);
679
+ onMove({
680
+ x: transform.x,
681
+ y: transform.y,
682
+ zoom: transform.k,
683
+ dragging: sourceEvent
684
+ }, d3Event);
536
685
  }
537
686
 
538
687
  function handleZoomEnd(d3Event) {
@@ -542,67 +691,78 @@ function useZoomPan(_ref) {
542
691
  }
543
692
 
544
693
  var _projection$invert = projection.invert(getCoords(width, height, d3Event.transform)),
545
- _projection$invert2 = slicedToArray(_projection$invert, 2),
694
+ _projection$invert2 = _slicedToArray(_projection$invert, 2),
546
695
  x = _projection$invert2[0],
547
696
  y = _projection$invert2[1];
548
697
 
549
- lastPosition.current = { x: x, y: y, k: d3Event.transform.k };
698
+ lastPosition.current = {
699
+ x: x,
700
+ y: y,
701
+ k: d3Event.transform.k
702
+ };
550
703
  if (!onMoveEnd) return;
551
- onMoveEnd({ coordinates: [x, y], zoom: d3Event.transform.k }, d3Event);
704
+ onMoveEnd({
705
+ coordinates: [x, y],
706
+ zoom: d3Event.transform.k
707
+ }, d3Event);
552
708
  }
553
709
 
554
710
  function filterFunc(d3Event) {
555
711
  if (filterZoomEvent) {
556
712
  return filterZoomEvent(d3Event);
557
713
  }
714
+
558
715
  return d3Event ? !d3Event.ctrlKey && !d3Event.button : false;
559
716
  }
560
717
 
561
718
  var zoom = d3Zoom.zoom().filter(filterFunc).scaleExtent([minZoom, maxZoom]).translateExtent([[a1, a2], [b1, b2]]).on("start", handleZoomStart).on("zoom", handleZoom).on("end", handleZoomEnd);
562
-
563
719
  zoomRef.current = zoom;
564
720
  svg.call(zoom);
565
721
  }, [width, height, a1, a2, b1, b2, minZoom, maxZoom, projection, onMoveStart, onMove, onMoveEnd, filterZoomEvent]);
566
-
567
722
  React.useEffect(function () {
568
723
  if (lon === lastPosition.current.x && lat === lastPosition.current.y && zoom === lastPosition.current.k) return;
569
-
570
724
  var coords = projection([lon, lat]);
571
725
  var x = coords[0] * zoom;
572
726
  var y = coords[1] * zoom;
573
727
  var svg = d3Selection.select(mapRef.current);
574
-
575
728
  bypassEvents.current = true;
576
-
577
729
  svg.call(zoomRef.current.transform, d3Zoom.zoomIdentity.translate(width / 2 - x, height / 2 - y).scale(zoom));
578
- setPosition({ x: width / 2 - x, y: height / 2 - y, k: zoom });
579
-
580
- lastPosition.current = { x: lon, y: lat, k: zoom };
730
+ setPosition({
731
+ x: width / 2 - x,
732
+ y: height / 2 - y,
733
+ k: zoom
734
+ });
735
+ lastPosition.current = {
736
+ x: lon,
737
+ y: lat,
738
+ k: zoom
739
+ };
581
740
  }, [lon, lat, zoom, width, height, projection]);
582
-
583
741
  return {
584
742
  mapRef: mapRef,
585
743
  position: position,
586
- transformString: "translate(" + position.x + " " + position.y + ") scale(" + position.k + ")"
744
+ transformString: "translate(".concat(position.x, " ").concat(position.y, ") scale(").concat(position.k, ")")
587
745
  };
588
746
  }
589
747
 
748
+ var _excluded$4 = ["center", "zoom", "minZoom", "maxZoom", "translateExtent", "filterZoomEvent", "onMoveStart", "onMove", "onMoveEnd", "className"];
749
+
590
750
  var ZoomableGroup = function ZoomableGroup(_ref) {
591
751
  var _ref$center = _ref.center,
592
- center = _ref$center === undefined ? [0, 0] : _ref$center,
752
+ center = _ref$center === void 0 ? [0, 0] : _ref$center,
593
753
  _ref$zoom = _ref.zoom,
594
- zoom = _ref$zoom === undefined ? 1 : _ref$zoom,
754
+ zoom = _ref$zoom === void 0 ? 1 : _ref$zoom,
595
755
  _ref$minZoom = _ref.minZoom,
596
- minZoom = _ref$minZoom === undefined ? 1 : _ref$minZoom,
756
+ minZoom = _ref$minZoom === void 0 ? 1 : _ref$minZoom,
597
757
  _ref$maxZoom = _ref.maxZoom,
598
- maxZoom = _ref$maxZoom === undefined ? 8 : _ref$maxZoom,
758
+ maxZoom = _ref$maxZoom === void 0 ? 8 : _ref$maxZoom,
599
759
  translateExtent = _ref.translateExtent,
600
760
  filterZoomEvent = _ref.filterZoomEvent,
601
761
  onMoveStart = _ref.onMoveStart,
602
762
  onMove = _ref.onMove,
603
763
  onMoveEnd = _ref.onMoveEnd,
604
764
  className = _ref.className,
605
- restProps = objectWithoutProperties(_ref, ["center", "zoom", "minZoom", "maxZoom", "translateExtent", "filterZoomEvent", "onMoveStart", "onMove", "onMoveEnd", "className"]);
765
+ restProps = _objectWithoutProperties(_ref, _excluded$4);
606
766
 
607
767
  var _useContext = React.useContext(MapContext),
608
768
  width = _useContext.width,
@@ -621,78 +781,80 @@ var ZoomableGroup = function ZoomableGroup(_ref) {
621
781
  mapRef = _useZoomPan.mapRef,
622
782
  transformString = _useZoomPan.transformString;
623
783
 
624
- return React__default.createElement(
625
- "g",
626
- { ref: mapRef },
627
- React__default.createElement("rect", { width: width, height: height, fill: "transparent" }),
628
- React__default.createElement("g", _extends({ transform: transformString, className: "rsm-zoomable-group " + className }, restProps))
629
- );
784
+ return /*#__PURE__*/React__default["default"].createElement("g", {
785
+ ref: mapRef
786
+ }, /*#__PURE__*/React__default["default"].createElement("rect", {
787
+ width: width,
788
+ height: height,
789
+ fill: "transparent"
790
+ }), /*#__PURE__*/React__default["default"].createElement("g", _extends({
791
+ transform: transformString,
792
+ className: "rsm-zoomable-group ".concat(className)
793
+ }, restProps)));
630
794
  };
631
795
 
632
796
  ZoomableGroup.propTypes = {
633
- center: PropTypes.array,
634
- zoom: PropTypes.number,
635
- minZoom: PropTypes.number,
636
- maxZoom: PropTypes.number,
637
- translateExtent: PropTypes.arrayOf(PropTypes.array),
638
- onMoveStart: PropTypes.func,
639
- onMove: PropTypes.func,
640
- onMoveEnd: PropTypes.func,
641
- className: PropTypes.string
797
+ center: PropTypes__default["default"].array,
798
+ zoom: PropTypes__default["default"].number,
799
+ minZoom: PropTypes__default["default"].number,
800
+ maxZoom: PropTypes__default["default"].number,
801
+ translateExtent: PropTypes__default["default"].arrayOf(PropTypes__default["default"].array),
802
+ onMoveStart: PropTypes__default["default"].func,
803
+ onMove: PropTypes__default["default"].func,
804
+ onMoveEnd: PropTypes__default["default"].func,
805
+ className: PropTypes__default["default"].string
642
806
  };
643
807
 
808
+ var _excluded$3 = ["id", "fill", "stroke", "strokeWidth", "className"];
809
+
644
810
  var Sphere = function Sphere(_ref) {
645
811
  var _ref$id = _ref.id,
646
- id = _ref$id === undefined ? "rsm-sphere" : _ref$id,
812
+ id = _ref$id === void 0 ? "rsm-sphere" : _ref$id,
647
813
  _ref$fill = _ref.fill,
648
- fill = _ref$fill === undefined ? "transparent" : _ref$fill,
814
+ fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
649
815
  _ref$stroke = _ref.stroke,
650
- stroke = _ref$stroke === undefined ? "currentcolor" : _ref$stroke,
816
+ stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
651
817
  _ref$strokeWidth = _ref.strokeWidth,
652
- strokeWidth = _ref$strokeWidth === undefined ? 0.5 : _ref$strokeWidth,
818
+ strokeWidth = _ref$strokeWidth === void 0 ? 0.5 : _ref$strokeWidth,
653
819
  _ref$className = _ref.className,
654
- className = _ref$className === undefined ? "" : _ref$className,
655
- restProps = objectWithoutProperties(_ref, ["id", "fill", "stroke", "strokeWidth", "className"]);
820
+ className = _ref$className === void 0 ? "" : _ref$className,
821
+ restProps = _objectWithoutProperties(_ref, _excluded$3);
656
822
 
657
823
  var _useContext = React.useContext(MapContext),
658
824
  path = _useContext.path;
659
825
 
660
826
  var spherePath = React.useMemo(function () {
661
- return path({ type: "Sphere" });
827
+ return path({
828
+ type: "Sphere"
829
+ });
662
830
  }, [path]);
663
- return React__default.createElement(
664
- React.Fragment,
665
- null,
666
- React__default.createElement(
667
- "defs",
668
- null,
669
- React__default.createElement(
670
- "clipPath",
671
- { id: id },
672
- React__default.createElement("path", { d: spherePath })
673
- )
674
- ),
675
- React__default.createElement("path", _extends({
676
- d: spherePath,
677
- fill: fill,
678
- stroke: stroke,
679
- strokeWidth: strokeWidth,
680
- style: { pointerEvents: "none" },
681
- className: "rsm-sphere " + className
682
- }, restProps))
683
- );
831
+ return /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement("defs", null, /*#__PURE__*/React__default["default"].createElement("clipPath", {
832
+ id: id
833
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
834
+ d: spherePath
835
+ }))), /*#__PURE__*/React__default["default"].createElement("path", _extends({
836
+ d: spherePath,
837
+ fill: fill,
838
+ stroke: stroke,
839
+ strokeWidth: strokeWidth,
840
+ style: {
841
+ pointerEvents: "none"
842
+ },
843
+ className: "rsm-sphere ".concat(className)
844
+ }, restProps)));
684
845
  };
685
846
 
686
847
  Sphere.propTypes = {
687
- id: PropTypes.string,
688
- fill: PropTypes.string,
689
- stroke: PropTypes.string,
690
- strokeWidth: PropTypes.number,
691
- className: PropTypes.string
848
+ id: PropTypes__default["default"].string,
849
+ fill: PropTypes__default["default"].string,
850
+ stroke: PropTypes__default["default"].string,
851
+ strokeWidth: PropTypes__default["default"].number,
852
+ className: PropTypes__default["default"].string
692
853
  };
693
-
694
854
  var Sphere$1 = React.memo(Sphere);
695
855
 
856
+ var _excluded$2 = ["coordinates", "children", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "style", "className"];
857
+
696
858
  var Marker = function Marker(_ref) {
697
859
  var coordinates = _ref.coordinates,
698
860
  children = _ref.children,
@@ -703,26 +865,26 @@ var Marker = function Marker(_ref) {
703
865
  onFocus = _ref.onFocus,
704
866
  onBlur = _ref.onBlur,
705
867
  _ref$style = _ref.style,
706
- style = _ref$style === undefined ? {} : _ref$style,
868
+ style = _ref$style === void 0 ? {} : _ref$style,
707
869
  _ref$className = _ref.className,
708
- className = _ref$className === undefined ? "" : _ref$className,
709
- restProps = objectWithoutProperties(_ref, ["coordinates", "children", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "style", "className"]);
870
+ className = _ref$className === void 0 ? "" : _ref$className,
871
+ restProps = _objectWithoutProperties(_ref, _excluded$2);
710
872
 
711
873
  var _useContext = React.useContext(MapContext),
712
874
  projection = _useContext.projection;
713
875
 
714
876
  var _useState = React.useState(false),
715
- _useState2 = slicedToArray(_useState, 2),
877
+ _useState2 = _slicedToArray(_useState, 2),
716
878
  isPressed = _useState2[0],
717
879
  setPressed = _useState2[1];
718
880
 
719
881
  var _useState3 = React.useState(false),
720
- _useState4 = slicedToArray(_useState3, 2),
882
+ _useState4 = _slicedToArray(_useState3, 2),
721
883
  isFocused = _useState4[0],
722
884
  setFocus = _useState4[1];
723
885
 
724
886
  var _projection = projection(coordinates),
725
- _projection2 = slicedToArray(_projection, 2),
887
+ _projection2 = _slicedToArray(_projection, 2),
726
888
  x = _projection2[0],
727
889
  y = _projection2[1];
728
890
 
@@ -758,51 +920,49 @@ var Marker = function Marker(_ref) {
758
920
  if (onMouseUp) onMouseUp(evt);
759
921
  }
760
922
 
761
- return React__default.createElement(
762
- "g",
763
- _extends({
764
- transform: "translate(" + x + ", " + y + ")",
765
- className: "rsm-marker " + className,
766
- onMouseEnter: handleMouseEnter,
767
- onMouseLeave: handleMouseLeave,
768
- onFocus: handleFocus,
769
- onBlur: handleBlur,
770
- onMouseDown: handleMouseDown,
771
- onMouseUp: handleMouseUp,
772
- style: style[isPressed || isFocused ? isPressed ? "pressed" : "hover" : "default"]
773
- }, restProps),
774
- children
775
- );
923
+ return /*#__PURE__*/React__default["default"].createElement("g", _extends({
924
+ transform: "translate(".concat(x, ", ").concat(y, ")"),
925
+ className: "rsm-marker ".concat(className),
926
+ onMouseEnter: handleMouseEnter,
927
+ onMouseLeave: handleMouseLeave,
928
+ onFocus: handleFocus,
929
+ onBlur: handleBlur,
930
+ onMouseDown: handleMouseDown,
931
+ onMouseUp: handleMouseUp,
932
+ style: style[isPressed || isFocused ? isPressed ? "pressed" : "hover" : "default"]
933
+ }, restProps), children);
776
934
  };
777
935
 
778
936
  Marker.propTypes = {
779
- coordinates: PropTypes.array,
780
- children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
781
- onMouseEnter: PropTypes.func,
782
- onMouseLeave: PropTypes.func,
783
- onMouseDown: PropTypes.func,
784
- onMouseUp: PropTypes.func,
785
- onFocus: PropTypes.func,
786
- onBlur: PropTypes.func,
787
- style: PropTypes.object,
788
- className: PropTypes.string
937
+ coordinates: PropTypes__default["default"].array,
938
+ children: PropTypes__default["default"].oneOfType([PropTypes__default["default"].node, PropTypes__default["default"].arrayOf(PropTypes__default["default"].node)]),
939
+ onMouseEnter: PropTypes__default["default"].func,
940
+ onMouseLeave: PropTypes__default["default"].func,
941
+ onMouseDown: PropTypes__default["default"].func,
942
+ onMouseUp: PropTypes__default["default"].func,
943
+ onFocus: PropTypes__default["default"].func,
944
+ onBlur: PropTypes__default["default"].func,
945
+ style: PropTypes__default["default"].object,
946
+ className: PropTypes__default["default"].string
789
947
  };
790
948
 
949
+ var _excluded$1 = ["from", "to", "coordinates", "stroke", "strokeWidth", "fill", "className"];
950
+
791
951
  var Line = function Line(_ref) {
792
952
  var _ref$from = _ref.from,
793
- from = _ref$from === undefined ? [0, 0] : _ref$from,
953
+ from = _ref$from === void 0 ? [0, 0] : _ref$from,
794
954
  _ref$to = _ref.to,
795
- to = _ref$to === undefined ? [0, 0] : _ref$to,
955
+ to = _ref$to === void 0 ? [0, 0] : _ref$to,
796
956
  coordinates = _ref.coordinates,
797
957
  _ref$stroke = _ref.stroke,
798
- stroke = _ref$stroke === undefined ? "currentcolor" : _ref$stroke,
958
+ stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
799
959
  _ref$strokeWidth = _ref.strokeWidth,
800
- strokeWidth = _ref$strokeWidth === undefined ? 3 : _ref$strokeWidth,
960
+ strokeWidth = _ref$strokeWidth === void 0 ? 3 : _ref$strokeWidth,
801
961
  _ref$fill = _ref.fill,
802
- fill = _ref$fill === undefined ? "transparent" : _ref$fill,
962
+ fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
803
963
  _ref$className = _ref.className,
804
- className = _ref$className === undefined ? "" : _ref$className,
805
- restProps = objectWithoutProperties(_ref, ["from", "to", "coordinates", "stroke", "strokeWidth", "fill", "className"]);
964
+ className = _ref$className === void 0 ? "" : _ref$className,
965
+ restProps = _objectWithoutProperties(_ref, _excluded$1);
806
966
 
807
967
  var _useContext = React.useContext(MapContext),
808
968
  path = _useContext.path;
@@ -811,10 +971,9 @@ var Line = function Line(_ref) {
811
971
  type: "LineString",
812
972
  coordinates: coordinates || [from, to]
813
973
  };
814
-
815
- return React__default.createElement("path", _extends({
974
+ return /*#__PURE__*/React__default["default"].createElement("path", _extends({
816
975
  d: path(lineData),
817
- className: "rsm-line " + className,
976
+ className: "rsm-line ".concat(className),
818
977
  stroke: stroke,
819
978
  strokeWidth: strokeWidth,
820
979
  fill: fill
@@ -822,58 +981,58 @@ var Line = function Line(_ref) {
822
981
  };
823
982
 
824
983
  Line.propTypes = {
825
- from: PropTypes.array,
826
- to: PropTypes.array,
827
- coordinates: PropTypes.array,
828
- stroke: PropTypes.string,
829
- strokeWidth: PropTypes.number,
830
- fill: PropTypes.string,
831
- className: PropTypes.string
984
+ from: PropTypes__default["default"].array,
985
+ to: PropTypes__default["default"].array,
986
+ coordinates: PropTypes__default["default"].array,
987
+ stroke: PropTypes__default["default"].string,
988
+ strokeWidth: PropTypes__default["default"].number,
989
+ fill: PropTypes__default["default"].string,
990
+ className: PropTypes__default["default"].string
832
991
  };
833
992
 
993
+ var _excluded = ["subject", "children", "connectorProps", "dx", "dy", "curve", "className"];
994
+
834
995
  var Annotation = function Annotation(_ref) {
835
996
  var subject = _ref.subject,
836
997
  children = _ref.children,
837
998
  connectorProps = _ref.connectorProps,
838
999
  _ref$dx = _ref.dx,
839
- dx = _ref$dx === undefined ? 30 : _ref$dx,
1000
+ dx = _ref$dx === void 0 ? 30 : _ref$dx,
840
1001
  _ref$dy = _ref.dy,
841
- dy = _ref$dy === undefined ? 30 : _ref$dy,
1002
+ dy = _ref$dy === void 0 ? 30 : _ref$dy,
842
1003
  _ref$curve = _ref.curve,
843
- curve = _ref$curve === undefined ? 0 : _ref$curve,
1004
+ curve = _ref$curve === void 0 ? 0 : _ref$curve,
844
1005
  _ref$className = _ref.className,
845
- className = _ref$className === undefined ? "" : _ref$className,
846
- restProps = objectWithoutProperties(_ref, ["subject", "children", "connectorProps", "dx", "dy", "curve", "className"]);
1006
+ className = _ref$className === void 0 ? "" : _ref$className,
1007
+ restProps = _objectWithoutProperties(_ref, _excluded);
847
1008
 
848
1009
  var _useContext = React.useContext(MapContext),
849
1010
  projection = _useContext.projection;
850
1011
 
851
1012
  var _projection = projection(subject),
852
- _projection2 = slicedToArray(_projection, 2),
1013
+ _projection2 = _slicedToArray(_projection, 2),
853
1014
  x = _projection2[0],
854
1015
  y = _projection2[1];
855
1016
 
856
1017
  var connectorPath = createConnectorPath(dx, dy, curve);
857
-
858
- return React__default.createElement(
859
- "g",
860
- _extends({
861
- transform: "translate(" + (x + dx) + ", " + (y + dy) + ")",
862
- className: "rsm-annotation " + className
863
- }, restProps),
864
- React__default.createElement("path", _extends({ d: connectorPath, fill: "transparent", stroke: "#000" }, connectorProps)),
865
- children
866
- );
1018
+ return /*#__PURE__*/React__default["default"].createElement("g", _extends({
1019
+ transform: "translate(".concat(x + dx, ", ").concat(y + dy, ")"),
1020
+ className: "rsm-annotation ".concat(className)
1021
+ }, restProps), /*#__PURE__*/React__default["default"].createElement("path", _extends({
1022
+ d: connectorPath,
1023
+ fill: "transparent",
1024
+ stroke: "#000"
1025
+ }, connectorProps)), children);
867
1026
  };
868
1027
 
869
1028
  Annotation.propTypes = {
870
- subject: PropTypes.array,
871
- children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
872
- dx: PropTypes.number,
873
- dy: PropTypes.number,
874
- curve: PropTypes.number,
875
- connectorProps: PropTypes.object,
876
- className: PropTypes.string
1029
+ subject: PropTypes__default["default"].array,
1030
+ children: PropTypes__default["default"].oneOfType([PropTypes__default["default"].node, PropTypes__default["default"].arrayOf(PropTypes__default["default"].node)]),
1031
+ dx: PropTypes__default["default"].number,
1032
+ dy: PropTypes__default["default"].number,
1033
+ curve: PropTypes__default["default"].number,
1034
+ connectorProps: PropTypes__default["default"].object,
1035
+ className: PropTypes__default["default"].string
877
1036
  };
878
1037
 
879
1038
  exports.Annotation = Annotation;