react-simple-maps 3.0.0-beta.2 → 3.0.0-beta.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 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
+ }
18
61
 
19
- for (var key in source) {
20
- if (Object.prototype.hasOwnProperty.call(source, key)) {
21
- target[key] = source[key];
62
+ function _typeof(obj) {
63
+ "@babel/helpers - typeof";
64
+
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;
125
+
126
+ if (Object.getOwnPropertySymbols) {
127
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
31
128
 
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];
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
+ }
177
+
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
+ }
78
186
 
79
- var geoPath = d3Geo.geoPath,
80
- projections = objectWithoutProperties(d3Geo, ["geoPath"]);
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,79 +269,80 @@ 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
 
171
- var ComposableMap = function ComposableMap(_ref) {
284
+ var _excluded$8 = ["width", "height", "projection", "projectionConfig", "className"];
285
+
286
+ var ComposableMap = function ComposableMap(_ref, 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
+ ref: ref,
306
+ viewBox: "0 0 ".concat(width, " ").concat(height),
307
+ className: "rsm-svg ".concat(className)
308
+ }, restProps)));
197
309
  };
198
310
 
199
311
  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
312
+ width: PropTypes__default["default"].number,
313
+ height: PropTypes__default["default"].number,
314
+ projection: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].func]),
315
+ projectionConfig: PropTypes__default["default"].object,
316
+ className: PropTypes__default["default"].string
205
317
  };
318
+ var ComposableMap$1 = React.forwardRef(ComposableMap);
206
319
 
207
320
  function getCoords(w, h, t) {
208
321
  var xOffset = (w * t.k - w) / 2;
209
322
  var yOffset = (h * t.k - h) / 2;
210
323
  return [w / 2 - (xOffset + t.x) / t.k, h / 2 - (yOffset + t.y) / t.k];
211
324
  }
212
-
213
325
  function fetchGeographies(url) {
214
326
  return fetch(url).then(function (res) {
215
327
  if (!res.ok) {
216
328
  throw Error(res.statusText);
217
329
  }
330
+
218
331
  return res.json();
219
- }).catch(function (error) {
332
+ })["catch"](function (error) {
220
333
  console.log("There was a problem when fetching the data: ", error);
221
334
  });
222
335
  }
223
-
224
336
  function getFeatures(geographies, parseGeographies) {
225
337
  var isTopojson = geographies.type === "Topology";
338
+
226
339
  if (!isTopojson) {
227
340
  return parseGeographies ? parseGeographies(geographies.features || geographies) : geographies.features || geographies;
228
341
  }
342
+
229
343
  var feats = topojsonClient.feature(geographies, geographies.objects[Object.keys(geographies.objects)[0]]).features;
230
344
  return parseGeographies ? parseGeographies(feats) : feats;
231
345
  }
232
-
233
346
  function getMesh(geographies) {
234
347
  var isTopojson = geographies.type === "Topology";
235
348
  if (!isTopojson) return null;
@@ -239,36 +352,40 @@ function getMesh(geographies) {
239
352
  var borders = topojsonClient.mesh(geographies, geographies.objects[Object.keys(geographies.objects)[0]], function (a, b) {
240
353
  return a !== b;
241
354
  });
242
- return { outline: outline, borders: borders };
355
+ return {
356
+ outline: outline,
357
+ borders: borders
358
+ };
243
359
  }
244
-
245
360
  function prepareMesh(outline, borders, path) {
246
361
  return outline && borders ? {
247
- outline: _extends({}, outline, { rsmKey: "outline", svgPath: path(outline) }),
248
- borders: _extends({}, borders, { rsmKey: "borders", svgPath: path(borders) })
362
+ outline: _objectSpread2(_objectSpread2({}, outline), {}, {
363
+ rsmKey: "outline",
364
+ svgPath: path(outline)
365
+ }),
366
+ borders: _objectSpread2(_objectSpread2({}, borders), {}, {
367
+ rsmKey: "borders",
368
+ svgPath: path(borders)
369
+ })
249
370
  } : {};
250
371
  }
251
-
252
372
  function prepareFeatures(geographies, path) {
253
373
  return geographies ? geographies.map(function (d, i) {
254
- return _extends({}, d, {
255
- rsmKey: "geo-" + i,
374
+ return _objectSpread2(_objectSpread2({}, d), {}, {
375
+ rsmKey: "geo-".concat(i),
256
376
  svgPath: path(d)
257
377
  });
258
378
  }) : [];
259
379
  }
260
-
261
380
  function createConnectorPath() {
262
381
  var dx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 30;
263
382
  var dy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 30;
264
383
  var curve = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.5;
265
-
266
384
  var curvature = Array.isArray(curve) ? curve : [curve, curve];
267
385
  var curveX = dx / 2 * curvature[0];
268
386
  var curveY = dy / 2 * curvature[1];
269
- return "M" + 0 + "," + 0 + " Q" + (-dx / 2 - curveX) + "," + (-dy / 2 + curveY) + " " + -dx + "," + -dy;
387
+ return "M".concat(0, ",", 0, " Q", -dx / 2 - curveX, ",").concat(-dy / 2 + curveY, " ").concat(-dx, ",").concat(-dy);
270
388
  }
271
-
272
389
  function isString(geo) {
273
390
  return typeof geo === "string";
274
391
  }
@@ -281,13 +398,12 @@ function useGeographies(_ref) {
281
398
  path = _useContext.path;
282
399
 
283
400
  var _useState = React.useState({}),
284
- _useState2 = slicedToArray(_useState, 2),
401
+ _useState2 = _slicedToArray(_useState, 2),
285
402
  output = _useState2[0],
286
403
  setOutput = _useState2[1];
287
404
 
288
405
  React.useEffect(function () {
289
- if (typeof window === "undefined") return;
290
-
406
+ if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "undefined") return;
291
407
  if (!geography) return;
292
408
 
293
409
  if (isString(geography)) {
@@ -320,41 +436,58 @@ function useGeographies(_ref) {
320
436
  outline = _useMemo.outline,
321
437
  borders = _useMemo.borders;
322
438
 
323
- return { geographies: geographies, outline: outline, borders: borders };
439
+ return {
440
+ geographies: geographies,
441
+ outline: outline,
442
+ borders: borders
443
+ };
324
444
  }
325
445
 
326
- var Geographies = function Geographies(_ref) {
446
+ var _excluded$7 = ["geography", "children", "parseGeographies", "className"];
447
+
448
+ var Geographies = function Geographies(_ref, ref) {
327
449
  var geography = _ref.geography,
328
450
  children = _ref.children,
329
451
  parseGeographies = _ref.parseGeographies,
330
452
  _ref$className = _ref.className,
331
- className = _ref$className === undefined ? "" : _ref$className,
332
- restProps = objectWithoutProperties(_ref, ["geography", "children", "parseGeographies", "className"]);
453
+ className = _ref$className === void 0 ? "" : _ref$className,
454
+ restProps = _objectWithoutProperties(_ref, _excluded$7);
333
455
 
334
456
  var _useContext = React.useContext(MapContext),
335
457
  path = _useContext.path,
336
458
  projection = _useContext.projection;
337
459
 
338
- var _useGeographies = useGeographies({ geography: geography, parseGeographies: parseGeographies }),
460
+ var _useGeographies = useGeographies({
461
+ geography: geography,
462
+ parseGeographies: parseGeographies
463
+ }),
339
464
  geographies = _useGeographies.geographies,
340
465
  outline = _useGeographies.outline,
341
466
  borders = _useGeographies.borders;
342
467
 
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
- );
468
+ return /*#__PURE__*/React__default["default"].createElement("g", _extends({
469
+ ref: ref,
470
+ className: "rsm-geographies ".concat(className)
471
+ }, restProps), geographies && geographies.length > 0 && children({
472
+ geographies: geographies,
473
+ outline: outline,
474
+ borders: borders,
475
+ path: path,
476
+ projection: projection
477
+ }));
348
478
  };
349
479
 
350
480
  Geographies.propTypes = {
351
- geography: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array]),
352
- children: PropTypes.func,
353
- parseGeographies: PropTypes.func,
354
- className: PropTypes.string
481
+ geography: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].object, PropTypes__default["default"].array]),
482
+ children: PropTypes__default["default"].func,
483
+ parseGeographies: PropTypes__default["default"].func,
484
+ className: PropTypes__default["default"].string
355
485
  };
486
+ var Geographies$1 = React.forwardRef(Geographies);
487
+
488
+ var _excluded$6 = ["geography", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "style", "className"];
356
489
 
357
- var Geography = function Geography(_ref) {
490
+ var Geography = function Geography(_ref, ref) {
358
491
  var geography = _ref.geography,
359
492
  onMouseEnter = _ref.onMouseEnter,
360
493
  onMouseLeave = _ref.onMouseLeave,
@@ -363,18 +496,18 @@ var Geography = function Geography(_ref) {
363
496
  onFocus = _ref.onFocus,
364
497
  onBlur = _ref.onBlur,
365
498
  _ref$style = _ref.style,
366
- style = _ref$style === undefined ? {} : _ref$style,
499
+ style = _ref$style === void 0 ? {} : _ref$style,
367
500
  _ref$className = _ref.className,
368
- className = _ref$className === undefined ? "" : _ref$className,
369
- restProps = objectWithoutProperties(_ref, ["geography", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "style", "className"]);
501
+ className = _ref$className === void 0 ? "" : _ref$className,
502
+ restProps = _objectWithoutProperties(_ref, _excluded$6);
370
503
 
371
504
  var _useState = React.useState(false),
372
- _useState2 = slicedToArray(_useState, 2),
505
+ _useState2 = _slicedToArray(_useState, 2),
373
506
  isPressed = _useState2[0],
374
507
  setPressed = _useState2[1];
375
508
 
376
509
  var _useState3 = React.useState(false),
377
- _useState4 = slicedToArray(_useState3, 2),
510
+ _useState4 = _slicedToArray(_useState3, 2),
378
511
  isFocused = _useState4[0],
379
512
  setFocus = _useState4[1];
380
513
 
@@ -410,9 +543,10 @@ var Geography = function Geography(_ref) {
410
543
  if (onMouseUp) onMouseUp(evt);
411
544
  }
412
545
 
413
- return React__default.createElement("path", _extends({
546
+ return /*#__PURE__*/React__default["default"].createElement("path", _extends({
547
+ ref: ref,
414
548
  tabIndex: "0",
415
- className: "rsm-geography " + className,
549
+ className: "rsm-geography ".concat(className),
416
550
  d: geography.svgPath,
417
551
  onMouseEnter: handleMouseEnter,
418
552
  onMouseLeave: handleMouseLeave,
@@ -425,49 +559,50 @@ var Geography = function Geography(_ref) {
425
559
  };
426
560
 
427
561
  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
562
+ geography: PropTypes__default["default"].object,
563
+ onMouseEnter: PropTypes__default["default"].func,
564
+ onMouseLeave: PropTypes__default["default"].func,
565
+ onMouseDown: PropTypes__default["default"].func,
566
+ onMouseUp: PropTypes__default["default"].func,
567
+ onFocus: PropTypes__default["default"].func,
568
+ onBlur: PropTypes__default["default"].func,
569
+ style: PropTypes__default["default"].object,
570
+ className: PropTypes__default["default"].string
437
571
  };
572
+ var Geography$1 = React.memo(React.forwardRef(Geography));
438
573
 
439
- var Geography$1 = React.memo(Geography);
574
+ var _excluded$5 = ["fill", "stroke", "step", "className"];
440
575
 
441
- var Graticule = function Graticule(_ref) {
576
+ var Graticule = function Graticule(_ref, ref) {
442
577
  var _ref$fill = _ref.fill,
443
- fill = _ref$fill === undefined ? "transparent" : _ref$fill,
578
+ fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
444
579
  _ref$stroke = _ref.stroke,
445
- stroke = _ref$stroke === undefined ? "currentcolor" : _ref$stroke,
580
+ stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
446
581
  _ref$step = _ref.step,
447
- step = _ref$step === undefined ? [10, 10] : _ref$step,
582
+ step = _ref$step === void 0 ? [10, 10] : _ref$step,
448
583
  _ref$className = _ref.className,
449
- className = _ref$className === undefined ? "" : _ref$className,
450
- restProps = objectWithoutProperties(_ref, ["fill", "stroke", "step", "className"]);
584
+ className = _ref$className === void 0 ? "" : _ref$className,
585
+ restProps = _objectWithoutProperties(_ref, _excluded$5);
451
586
 
452
587
  var _useContext = React.useContext(MapContext),
453
588
  path = _useContext.path;
454
589
 
455
- return React__default.createElement("path", _extends({
590
+ return /*#__PURE__*/React__default["default"].createElement("path", _extends({
591
+ ref: ref,
456
592
  d: path(d3Geo.geoGraticule().step(step)()),
457
593
  fill: fill,
458
594
  stroke: stroke,
459
- className: "rsm-graticule " + className
595
+ className: "rsm-graticule ".concat(className)
460
596
  }, restProps));
461
597
  };
462
598
 
463
599
  Graticule.propTypes = {
464
- fill: PropTypes.string,
465
- stroke: PropTypes.string,
466
- step: PropTypes.array,
467
- className: PropTypes.string
600
+ fill: PropTypes__default["default"].string,
601
+ stroke: PropTypes__default["default"].string,
602
+ step: PropTypes__default["default"].array,
603
+ className: PropTypes__default["default"].string
468
604
  };
469
-
470
- var Graticule$1 = React.memo(Graticule);
605
+ var Graticule$1 = React.memo(React.forwardRef(Graticule));
471
606
 
472
607
  function useZoomPan(_ref) {
473
608
  var center = _ref.center,
@@ -476,44 +611,52 @@ function useZoomPan(_ref) {
476
611
  onMoveEnd = _ref.onMoveEnd,
477
612
  onMove = _ref.onMove,
478
613
  _ref$translateExtent = _ref.translateExtent,
479
- translateExtent = _ref$translateExtent === undefined ? [[-Infinity, -Infinity], [Infinity, Infinity]] : _ref$translateExtent,
614
+ translateExtent = _ref$translateExtent === void 0 ? [[-Infinity, -Infinity], [Infinity, Infinity]] : _ref$translateExtent,
480
615
  _ref$scaleExtent = _ref.scaleExtent,
481
- scaleExtent = _ref$scaleExtent === undefined ? [1, 8] : _ref$scaleExtent,
616
+ scaleExtent = _ref$scaleExtent === void 0 ? [1, 8] : _ref$scaleExtent,
482
617
  _ref$zoom = _ref.zoom,
483
- zoom = _ref$zoom === undefined ? 1 : _ref$zoom;
618
+ zoom = _ref$zoom === void 0 ? 1 : _ref$zoom;
484
619
 
485
620
  var _useContext = React.useContext(MapContext),
486
621
  width = _useContext.width,
487
622
  height = _useContext.height,
488
623
  projection = _useContext.projection;
489
624
 
490
- var _center = slicedToArray(center, 2),
625
+ var _center = _slicedToArray(center, 2),
491
626
  lon = _center[0],
492
627
  lat = _center[1];
493
628
 
494
- var _useState = React.useState({ x: 0, y: 0, k: 1 }),
495
- _useState2 = slicedToArray(_useState, 2),
629
+ var _useState = React.useState({
630
+ x: 0,
631
+ y: 0,
632
+ k: 1
633
+ }),
634
+ _useState2 = _slicedToArray(_useState, 2),
496
635
  position = _useState2[0],
497
636
  setPosition = _useState2[1];
498
637
 
499
- var lastPosition = React.useRef({ x: 0, y: 0, k: 1 });
638
+ var lastPosition = React.useRef({
639
+ x: 0,
640
+ y: 0,
641
+ k: 1
642
+ });
500
643
  var mapRef = React.useRef();
501
644
  var zoomRef = React.useRef();
502
645
  var bypassEvents = React.useRef(false);
503
646
 
504
- var _translateExtent = slicedToArray(translateExtent, 2),
647
+ var _translateExtent = _slicedToArray(translateExtent, 2),
505
648
  a = _translateExtent[0],
506
649
  b = _translateExtent[1];
507
650
 
508
- var _a = slicedToArray(a, 2),
651
+ var _a = _slicedToArray(a, 2),
509
652
  a1 = _a[0],
510
653
  a2 = _a[1];
511
654
 
512
- var _b = slicedToArray(b, 2),
655
+ var _b = _slicedToArray(b, 2),
513
656
  b1 = _b[0],
514
657
  b2 = _b[1];
515
658
 
516
- var _scaleExtent = slicedToArray(scaleExtent, 2),
659
+ var _scaleExtent = _slicedToArray(scaleExtent, 2),
517
660
  minZoom = _scaleExtent[0],
518
661
  maxZoom = _scaleExtent[1];
519
662
 
@@ -522,17 +665,29 @@ function useZoomPan(_ref) {
522
665
 
523
666
  function handleZoomStart(d3Event) {
524
667
  if (!onMoveStart || bypassEvents.current) return;
525
- onMoveStart({ coordinates: projection.invert(getCoords(width, height, d3Event.transform)), zoom: d3Event.transform.k }, d3Event);
668
+ onMoveStart({
669
+ coordinates: projection.invert(getCoords(width, height, d3Event.transform)),
670
+ zoom: d3Event.transform.k
671
+ }, d3Event);
526
672
  }
527
673
 
528
674
  function handleZoom(d3Event) {
529
675
  if (bypassEvents.current) return;
530
676
  var transform = d3Event.transform,
531
677
  sourceEvent = d3Event.sourceEvent;
532
-
533
- setPosition({ x: transform.x, y: transform.y, k: transform.k, dragging: sourceEvent });
678
+ setPosition({
679
+ x: transform.x,
680
+ y: transform.y,
681
+ k: transform.k,
682
+ dragging: sourceEvent
683
+ });
534
684
  if (!onMove) return;
535
- onMove({ x: transform.x, y: transform.y, zoom: transform.k, dragging: sourceEvent }, d3Event);
685
+ onMove({
686
+ x: transform.x,
687
+ y: transform.y,
688
+ zoom: transform.k,
689
+ dragging: sourceEvent
690
+ }, d3Event);
536
691
  }
537
692
 
538
693
  function handleZoomEnd(d3Event) {
@@ -542,67 +697,78 @@ function useZoomPan(_ref) {
542
697
  }
543
698
 
544
699
  var _projection$invert = projection.invert(getCoords(width, height, d3Event.transform)),
545
- _projection$invert2 = slicedToArray(_projection$invert, 2),
700
+ _projection$invert2 = _slicedToArray(_projection$invert, 2),
546
701
  x = _projection$invert2[0],
547
702
  y = _projection$invert2[1];
548
703
 
549
- lastPosition.current = { x: x, y: y, k: d3Event.transform.k };
704
+ lastPosition.current = {
705
+ x: x,
706
+ y: y,
707
+ k: d3Event.transform.k
708
+ };
550
709
  if (!onMoveEnd) return;
551
- onMoveEnd({ coordinates: [x, y], zoom: d3Event.transform.k }, d3Event);
710
+ onMoveEnd({
711
+ coordinates: [x, y],
712
+ zoom: d3Event.transform.k
713
+ }, d3Event);
552
714
  }
553
715
 
554
716
  function filterFunc(d3Event) {
555
717
  if (filterZoomEvent) {
556
718
  return filterZoomEvent(d3Event);
557
719
  }
720
+
558
721
  return d3Event ? !d3Event.ctrlKey && !d3Event.button : false;
559
722
  }
560
723
 
561
724
  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
725
  zoomRef.current = zoom;
564
726
  svg.call(zoom);
565
727
  }, [width, height, a1, a2, b1, b2, minZoom, maxZoom, projection, onMoveStart, onMove, onMoveEnd, filterZoomEvent]);
566
-
567
728
  React.useEffect(function () {
568
729
  if (lon === lastPosition.current.x && lat === lastPosition.current.y && zoom === lastPosition.current.k) return;
569
-
570
730
  var coords = projection([lon, lat]);
571
731
  var x = coords[0] * zoom;
572
732
  var y = coords[1] * zoom;
573
733
  var svg = d3Selection.select(mapRef.current);
574
-
575
734
  bypassEvents.current = true;
576
-
577
735
  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 };
736
+ setPosition({
737
+ x: width / 2 - x,
738
+ y: height / 2 - y,
739
+ k: zoom
740
+ });
741
+ lastPosition.current = {
742
+ x: lon,
743
+ y: lat,
744
+ k: zoom
745
+ };
581
746
  }, [lon, lat, zoom, width, height, projection]);
582
-
583
747
  return {
584
748
  mapRef: mapRef,
585
749
  position: position,
586
- transformString: "translate(" + position.x + " " + position.y + ") scale(" + position.k + ")"
750
+ transformString: "translate(".concat(position.x, " ").concat(position.y, ") scale(").concat(position.k, ")")
587
751
  };
588
752
  }
589
753
 
590
- var ZoomableGroup = function ZoomableGroup(_ref) {
754
+ var _excluded$4 = ["center", "zoom", "minZoom", "maxZoom", "translateExtent", "filterZoomEvent", "onMoveStart", "onMove", "onMoveEnd", "className"];
755
+
756
+ var ZoomableGroup = function ZoomableGroup(_ref, ref) {
591
757
  var _ref$center = _ref.center,
592
- center = _ref$center === undefined ? [0, 0] : _ref$center,
758
+ center = _ref$center === void 0 ? [0, 0] : _ref$center,
593
759
  _ref$zoom = _ref.zoom,
594
- zoom = _ref$zoom === undefined ? 1 : _ref$zoom,
760
+ zoom = _ref$zoom === void 0 ? 1 : _ref$zoom,
595
761
  _ref$minZoom = _ref.minZoom,
596
- minZoom = _ref$minZoom === undefined ? 1 : _ref$minZoom,
762
+ minZoom = _ref$minZoom === void 0 ? 1 : _ref$minZoom,
597
763
  _ref$maxZoom = _ref.maxZoom,
598
- maxZoom = _ref$maxZoom === undefined ? 8 : _ref$maxZoom,
764
+ maxZoom = _ref$maxZoom === void 0 ? 8 : _ref$maxZoom,
599
765
  translateExtent = _ref.translateExtent,
600
766
  filterZoomEvent = _ref.filterZoomEvent,
601
767
  onMoveStart = _ref.onMoveStart,
602
768
  onMove = _ref.onMove,
603
769
  onMoveEnd = _ref.onMoveEnd,
604
770
  className = _ref.className,
605
- restProps = objectWithoutProperties(_ref, ["center", "zoom", "minZoom", "maxZoom", "translateExtent", "filterZoomEvent", "onMoveStart", "onMove", "onMoveEnd", "className"]);
771
+ restProps = _objectWithoutProperties(_ref, _excluded$4);
606
772
 
607
773
  var _useContext = React.useContext(MapContext),
608
774
  width = _useContext.width,
@@ -621,79 +787,84 @@ var ZoomableGroup = function ZoomableGroup(_ref) {
621
787
  mapRef = _useZoomPan.mapRef,
622
788
  transformString = _useZoomPan.transformString;
623
789
 
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
- );
790
+ return /*#__PURE__*/React__default["default"].createElement("g", {
791
+ ref: mapRef
792
+ }, /*#__PURE__*/React__default["default"].createElement("rect", {
793
+ width: width,
794
+ height: height,
795
+ fill: "transparent"
796
+ }), /*#__PURE__*/React__default["default"].createElement("g", _extends({
797
+ ref: ref,
798
+ transform: transformString,
799
+ className: "rsm-zoomable-group ".concat(className)
800
+ }, restProps)));
630
801
  };
631
802
 
632
803
  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
804
+ center: PropTypes__default["default"].array,
805
+ zoom: PropTypes__default["default"].number,
806
+ minZoom: PropTypes__default["default"].number,
807
+ maxZoom: PropTypes__default["default"].number,
808
+ translateExtent: PropTypes__default["default"].arrayOf(PropTypes__default["default"].array),
809
+ onMoveStart: PropTypes__default["default"].func,
810
+ onMove: PropTypes__default["default"].func,
811
+ onMoveEnd: PropTypes__default["default"].func,
812
+ className: PropTypes__default["default"].string
642
813
  };
814
+ var ZoomableGroup$1 = React.forwardRef(ZoomableGroup);
815
+
816
+ var _excluded$3 = ["id", "fill", "stroke", "strokeWidth", "className"];
643
817
 
644
- var Sphere = function Sphere(_ref) {
818
+ var Sphere = function Sphere(_ref, ref) {
645
819
  var _ref$id = _ref.id,
646
- id = _ref$id === undefined ? "rsm-sphere" : _ref$id,
820
+ id = _ref$id === void 0 ? "rsm-sphere" : _ref$id,
647
821
  _ref$fill = _ref.fill,
648
- fill = _ref$fill === undefined ? "transparent" : _ref$fill,
822
+ fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
649
823
  _ref$stroke = _ref.stroke,
650
- stroke = _ref$stroke === undefined ? "currentcolor" : _ref$stroke,
824
+ stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
651
825
  _ref$strokeWidth = _ref.strokeWidth,
652
- strokeWidth = _ref$strokeWidth === undefined ? 0.5 : _ref$strokeWidth,
826
+ strokeWidth = _ref$strokeWidth === void 0 ? 0.5 : _ref$strokeWidth,
653
827
  _ref$className = _ref.className,
654
- className = _ref$className === undefined ? "" : _ref$className,
655
- restProps = objectWithoutProperties(_ref, ["id", "fill", "stroke", "strokeWidth", "className"]);
828
+ className = _ref$className === void 0 ? "" : _ref$className,
829
+ restProps = _objectWithoutProperties(_ref, _excluded$3);
656
830
 
657
831
  var _useContext = React.useContext(MapContext),
658
832
  path = _useContext.path;
659
833
 
660
834
  var spherePath = React.useMemo(function () {
661
- return path({ type: "Sphere" });
835
+ return path({
836
+ type: "Sphere"
837
+ });
662
838
  }, [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
- );
839
+ return /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement("defs", null, /*#__PURE__*/React__default["default"].createElement("clipPath", {
840
+ id: id
841
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
842
+ d: spherePath
843
+ }))), /*#__PURE__*/React__default["default"].createElement("path", _extends({
844
+ ref: ref,
845
+ d: spherePath,
846
+ fill: fill,
847
+ stroke: stroke,
848
+ strokeWidth: strokeWidth,
849
+ style: {
850
+ pointerEvents: "none"
851
+ },
852
+ className: "rsm-sphere ".concat(className)
853
+ }, restProps)));
684
854
  };
685
855
 
686
856
  Sphere.propTypes = {
687
- id: PropTypes.string,
688
- fill: PropTypes.string,
689
- stroke: PropTypes.string,
690
- strokeWidth: PropTypes.number,
691
- className: PropTypes.string
857
+ id: PropTypes__default["default"].string,
858
+ fill: PropTypes__default["default"].string,
859
+ stroke: PropTypes__default["default"].string,
860
+ strokeWidth: PropTypes__default["default"].number,
861
+ className: PropTypes__default["default"].string
692
862
  };
863
+ var Sphere$1 = React.memo(React.forwardRef(Sphere));
693
864
 
694
- var Sphere$1 = React.memo(Sphere);
865
+ var _excluded$2 = ["coordinates", "children", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "style", "className"];
695
866
 
696
- var Marker = function Marker(_ref) {
867
+ var Marker = function Marker(_ref, ref) {
697
868
  var coordinates = _ref.coordinates,
698
869
  children = _ref.children,
699
870
  onMouseEnter = _ref.onMouseEnter,
@@ -703,26 +874,26 @@ var Marker = function Marker(_ref) {
703
874
  onFocus = _ref.onFocus,
704
875
  onBlur = _ref.onBlur,
705
876
  _ref$style = _ref.style,
706
- style = _ref$style === undefined ? {} : _ref$style,
877
+ style = _ref$style === void 0 ? {} : _ref$style,
707
878
  _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"]);
879
+ className = _ref$className === void 0 ? "" : _ref$className,
880
+ restProps = _objectWithoutProperties(_ref, _excluded$2);
710
881
 
711
882
  var _useContext = React.useContext(MapContext),
712
883
  projection = _useContext.projection;
713
884
 
714
885
  var _useState = React.useState(false),
715
- _useState2 = slicedToArray(_useState, 2),
886
+ _useState2 = _slicedToArray(_useState, 2),
716
887
  isPressed = _useState2[0],
717
888
  setPressed = _useState2[1];
718
889
 
719
890
  var _useState3 = React.useState(false),
720
- _useState4 = slicedToArray(_useState3, 2),
891
+ _useState4 = _slicedToArray(_useState3, 2),
721
892
  isFocused = _useState4[0],
722
893
  setFocus = _useState4[1];
723
894
 
724
895
  var _projection = projection(coordinates),
725
- _projection2 = slicedToArray(_projection, 2),
896
+ _projection2 = _slicedToArray(_projection, 2),
726
897
  x = _projection2[0],
727
898
  y = _projection2[1];
728
899
 
@@ -758,51 +929,51 @@ var Marker = function Marker(_ref) {
758
929
  if (onMouseUp) onMouseUp(evt);
759
930
  }
760
931
 
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
- );
932
+ return /*#__PURE__*/React__default["default"].createElement("g", _extends({
933
+ ref: ref,
934
+ transform: "translate(".concat(x, ", ").concat(y, ")"),
935
+ className: "rsm-marker ".concat(className),
936
+ onMouseEnter: handleMouseEnter,
937
+ onMouseLeave: handleMouseLeave,
938
+ onFocus: handleFocus,
939
+ onBlur: handleBlur,
940
+ onMouseDown: handleMouseDown,
941
+ onMouseUp: handleMouseUp,
942
+ style: style[isPressed || isFocused ? isPressed ? "pressed" : "hover" : "default"]
943
+ }, restProps), children);
776
944
  };
777
945
 
778
946
  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
947
+ coordinates: PropTypes__default["default"].array,
948
+ children: PropTypes__default["default"].oneOfType([PropTypes__default["default"].node, PropTypes__default["default"].arrayOf(PropTypes__default["default"].node)]),
949
+ onMouseEnter: PropTypes__default["default"].func,
950
+ onMouseLeave: PropTypes__default["default"].func,
951
+ onMouseDown: PropTypes__default["default"].func,
952
+ onMouseUp: PropTypes__default["default"].func,
953
+ onFocus: PropTypes__default["default"].func,
954
+ onBlur: PropTypes__default["default"].func,
955
+ style: PropTypes__default["default"].object,
956
+ className: PropTypes__default["default"].string
789
957
  };
958
+ var Marker$1 = React.forwardRef(Marker);
790
959
 
791
- var Line = function Line(_ref) {
960
+ var _excluded$1 = ["from", "to", "coordinates", "stroke", "strokeWidth", "fill", "className"];
961
+
962
+ var Line = function Line(_ref, ref) {
792
963
  var _ref$from = _ref.from,
793
- from = _ref$from === undefined ? [0, 0] : _ref$from,
964
+ from = _ref$from === void 0 ? [0, 0] : _ref$from,
794
965
  _ref$to = _ref.to,
795
- to = _ref$to === undefined ? [0, 0] : _ref$to,
966
+ to = _ref$to === void 0 ? [0, 0] : _ref$to,
796
967
  coordinates = _ref.coordinates,
797
968
  _ref$stroke = _ref.stroke,
798
- stroke = _ref$stroke === undefined ? "currentcolor" : _ref$stroke,
969
+ stroke = _ref$stroke === void 0 ? "currentcolor" : _ref$stroke,
799
970
  _ref$strokeWidth = _ref.strokeWidth,
800
- strokeWidth = _ref$strokeWidth === undefined ? 3 : _ref$strokeWidth,
971
+ strokeWidth = _ref$strokeWidth === void 0 ? 3 : _ref$strokeWidth,
801
972
  _ref$fill = _ref.fill,
802
- fill = _ref$fill === undefined ? "transparent" : _ref$fill,
973
+ fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
803
974
  _ref$className = _ref.className,
804
- className = _ref$className === undefined ? "" : _ref$className,
805
- restProps = objectWithoutProperties(_ref, ["from", "to", "coordinates", "stroke", "strokeWidth", "fill", "className"]);
975
+ className = _ref$className === void 0 ? "" : _ref$className,
976
+ restProps = _objectWithoutProperties(_ref, _excluded$1);
806
977
 
807
978
  var _useContext = React.useContext(MapContext),
808
979
  path = _useContext.path;
@@ -811,10 +982,10 @@ var Line = function Line(_ref) {
811
982
  type: "LineString",
812
983
  coordinates: coordinates || [from, to]
813
984
  };
814
-
815
- return React__default.createElement("path", _extends({
985
+ return /*#__PURE__*/React__default["default"].createElement("path", _extends({
986
+ ref: ref,
816
987
  d: path(lineData),
817
- className: "rsm-line " + className,
988
+ className: "rsm-line ".concat(className),
818
989
  stroke: stroke,
819
990
  strokeWidth: strokeWidth,
820
991
  fill: fill
@@ -822,70 +993,73 @@ var Line = function Line(_ref) {
822
993
  };
823
994
 
824
995
  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
996
+ from: PropTypes__default["default"].array,
997
+ to: PropTypes__default["default"].array,
998
+ coordinates: PropTypes__default["default"].array,
999
+ stroke: PropTypes__default["default"].string,
1000
+ strokeWidth: PropTypes__default["default"].number,
1001
+ fill: PropTypes__default["default"].string,
1002
+ className: PropTypes__default["default"].string
832
1003
  };
1004
+ var Line$1 = React.forwardRef(Line);
833
1005
 
834
- var Annotation = function Annotation(_ref) {
1006
+ var _excluded = ["subject", "children", "connectorProps", "dx", "dy", "curve", "className"];
1007
+
1008
+ var Annotation = function Annotation(_ref, ref) {
835
1009
  var subject = _ref.subject,
836
1010
  children = _ref.children,
837
1011
  connectorProps = _ref.connectorProps,
838
1012
  _ref$dx = _ref.dx,
839
- dx = _ref$dx === undefined ? 30 : _ref$dx,
1013
+ dx = _ref$dx === void 0 ? 30 : _ref$dx,
840
1014
  _ref$dy = _ref.dy,
841
- dy = _ref$dy === undefined ? 30 : _ref$dy,
1015
+ dy = _ref$dy === void 0 ? 30 : _ref$dy,
842
1016
  _ref$curve = _ref.curve,
843
- curve = _ref$curve === undefined ? 0 : _ref$curve,
1017
+ curve = _ref$curve === void 0 ? 0 : _ref$curve,
844
1018
  _ref$className = _ref.className,
845
- className = _ref$className === undefined ? "" : _ref$className,
846
- restProps = objectWithoutProperties(_ref, ["subject", "children", "connectorProps", "dx", "dy", "curve", "className"]);
1019
+ className = _ref$className === void 0 ? "" : _ref$className,
1020
+ restProps = _objectWithoutProperties(_ref, _excluded);
847
1021
 
848
1022
  var _useContext = React.useContext(MapContext),
849
1023
  projection = _useContext.projection;
850
1024
 
851
1025
  var _projection = projection(subject),
852
- _projection2 = slicedToArray(_projection, 2),
1026
+ _projection2 = _slicedToArray(_projection, 2),
853
1027
  x = _projection2[0],
854
1028
  y = _projection2[1];
855
1029
 
856
1030
  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
- );
1031
+ return /*#__PURE__*/React__default["default"].createElement("g", _extends({
1032
+ ref: ref,
1033
+ transform: "translate(".concat(x + dx, ", ").concat(y + dy, ")"),
1034
+ className: "rsm-annotation ".concat(className)
1035
+ }, restProps), /*#__PURE__*/React__default["default"].createElement("path", _extends({
1036
+ d: connectorPath,
1037
+ fill: "transparent",
1038
+ stroke: "#000"
1039
+ }, connectorProps)), children);
867
1040
  };
868
1041
 
869
1042
  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
1043
+ subject: PropTypes__default["default"].array,
1044
+ children: PropTypes__default["default"].oneOfType([PropTypes__default["default"].node, PropTypes__default["default"].arrayOf(PropTypes__default["default"].node)]),
1045
+ dx: PropTypes__default["default"].number,
1046
+ dy: PropTypes__default["default"].number,
1047
+ curve: PropTypes__default["default"].number,
1048
+ connectorProps: PropTypes__default["default"].object,
1049
+ className: PropTypes__default["default"].string
877
1050
  };
1051
+ var Annotation$1 = React.forwardRef(Annotation);
878
1052
 
879
- exports.Annotation = Annotation;
880
- exports.ComposableMap = ComposableMap;
881
- exports.Geographies = Geographies;
1053
+ exports.Annotation = Annotation$1;
1054
+ exports.ComposableMap = ComposableMap$1;
1055
+ exports.Geographies = Geographies$1;
882
1056
  exports.Geography = Geography$1;
883
1057
  exports.Graticule = Graticule$1;
884
- exports.Line = Line;
1058
+ exports.Line = Line$1;
885
1059
  exports.MapContext = MapContext;
886
1060
  exports.MapProvider = MapProvider;
887
- exports.Marker = Marker;
1061
+ exports.Marker = Marker$1;
888
1062
  exports.Sphere = Sphere$1;
889
- exports.ZoomableGroup = ZoomableGroup;
1063
+ exports.ZoomableGroup = ZoomableGroup$1;
890
1064
  exports.useGeographies = useGeographies;
891
1065
  exports.useZoomPan = useZoomPan;