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