react-simple-maps 4.0.0-beta.2 → 4.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +13 -10
- package/dist/index.js +64 -100
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { createContext, useMemo, useCallback, useContext, forwardRef, useState, useEffect, memo, useRef, Fragment } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import * as
|
|
3
|
+
import * as d3 from 'd3-geo';
|
|
4
4
|
import { feature, mesh } from 'topojson-client';
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
5
|
+
import * as d3$1 from 'd3-selection';
|
|
6
|
+
import * as d3$2 from 'd3-zoom';
|
|
7
7
|
|
|
8
8
|
function _iterableToArrayLimit(arr, i) {
|
|
9
9
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
@@ -155,8 +155,8 @@ function _toPropertyKey(arg) {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
var _excluded$a = ["width", "height", "projection", "projectionConfig"];
|
|
158
|
-
var geoPath =
|
|
159
|
-
projections = _objectWithoutProperties(
|
|
158
|
+
var geoPath = d3.geoPath,
|
|
159
|
+
projections = _objectWithoutProperties(d3, ["geoPath"]);
|
|
160
160
|
var MapContext = createContext();
|
|
161
161
|
var makeProjection = function makeProjection(_ref) {
|
|
162
162
|
var _ref$projectionConfig = _ref.projectionConfig,
|
|
@@ -266,6 +266,9 @@ ComposableMap.propTypes = {
|
|
|
266
266
|
className: PropTypes.string
|
|
267
267
|
};
|
|
268
268
|
|
|
269
|
+
function select(ref) {
|
|
270
|
+
return d3$1.select(ref);
|
|
271
|
+
}
|
|
269
272
|
function getCoords(w, h, t) {
|
|
270
273
|
var xOffset = (w * t.k - w) / 2;
|
|
271
274
|
var yOffset = (h * t.k - h) / 2;
|
|
@@ -511,7 +514,7 @@ var Graticule = forwardRef(function (_ref, ref) {
|
|
|
511
514
|
path = _useContext.path;
|
|
512
515
|
return /*#__PURE__*/React.createElement("path", _extends({
|
|
513
516
|
ref: ref,
|
|
514
|
-
d: path(
|
|
517
|
+
d: path(d3.geoGraticule().step(step)()),
|
|
515
518
|
fill: fill,
|
|
516
519
|
stroke: stroke,
|
|
517
520
|
className: "rsm-graticule ".concat(className)
|
|
@@ -600,7 +603,7 @@ function useZoomPan(_ref) {
|
|
|
600
603
|
minZoom = _scaleExtent[0],
|
|
601
604
|
maxZoom = _scaleExtent[1];
|
|
602
605
|
useEffect(function () {
|
|
603
|
-
var svg =
|
|
606
|
+
var svg = select(mapRef.current);
|
|
604
607
|
function handleZoomStart(d3Event) {
|
|
605
608
|
if (!onMoveStart || bypassEvents.current) return;
|
|
606
609
|
onMoveStart({
|
|
@@ -652,7 +655,7 @@ function useZoomPan(_ref) {
|
|
|
652
655
|
}
|
|
653
656
|
return d3Event ? !d3Event.ctrlKey && !d3Event.button : false;
|
|
654
657
|
}
|
|
655
|
-
var zoom =
|
|
658
|
+
var zoom = d3$2.zoom().filter(filterFunc).scaleExtent([minZoom, maxZoom]).translateExtent([[a1, a2], [b1, b2]]).on("start", handleZoomStart).on("zoom", handleZoom).on("end", handleZoomEnd);
|
|
656
659
|
zoomRef.current = zoom;
|
|
657
660
|
svg.call(zoom);
|
|
658
661
|
}, [width, height, a1, a2, b1, b2, minZoom, maxZoom, projection, onMoveStart, onMove, onMoveEnd, filterZoomEvent]);
|
|
@@ -661,9 +664,9 @@ function useZoomPan(_ref) {
|
|
|
661
664
|
var coords = projection([lon, lat]);
|
|
662
665
|
var x = coords[0] * zoom;
|
|
663
666
|
var y = coords[1] * zoom;
|
|
664
|
-
var svg =
|
|
667
|
+
var svg = select(mapRef.current);
|
|
665
668
|
bypassEvents.current = true;
|
|
666
|
-
svg.call(zoomRef.current.transform,
|
|
669
|
+
svg.call(zoomRef.current.transform, d3$2.zoomIdentity.translate(width / 2 - x, height / 2 - y).scale(zoom));
|
|
667
670
|
setPosition({
|
|
668
671
|
x: width / 2 - x,
|
|
669
672
|
y: height / 2 - y,
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var d3Zoom = require('d3-zoom');
|
|
8
|
-
var d3Select = require('d3-selection');
|
|
9
|
-
|
|
10
|
-
function _interopNamespaceDefault(e) {
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
if (k !== 'default') {
|
|
15
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return e[k]; }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n.default = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var d3Geo__namespace = /*#__PURE__*/_interopNamespaceDefault(d3Geo);
|
|
28
|
-
var d3Zoom__namespace = /*#__PURE__*/_interopNamespaceDefault(d3Zoom);
|
|
29
|
-
var d3Select__namespace = /*#__PURE__*/_interopNamespaceDefault(d3Select);
|
|
1
|
+
import React, { createContext, useMemo, useCallback, useContext, forwardRef, useState, useEffect, memo, useRef, Fragment } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import * as d3 from 'd3-geo';
|
|
4
|
+
import { feature, mesh } from 'topojson-client';
|
|
5
|
+
import * as d3$1 from 'd3-selection';
|
|
6
|
+
import * as d3$2 from 'd3-zoom';
|
|
30
7
|
|
|
31
8
|
function _iterableToArrayLimit(arr, i) {
|
|
32
9
|
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
@@ -178,9 +155,9 @@ function _toPropertyKey(arg) {
|
|
|
178
155
|
}
|
|
179
156
|
|
|
180
157
|
var _excluded$a = ["width", "height", "projection", "projectionConfig"];
|
|
181
|
-
var geoPath =
|
|
182
|
-
projections = _objectWithoutProperties(
|
|
183
|
-
var MapContext =
|
|
158
|
+
var geoPath = d3.geoPath,
|
|
159
|
+
projections = _objectWithoutProperties(d3, ["geoPath"]);
|
|
160
|
+
var MapContext = createContext();
|
|
184
161
|
var makeProjection = function makeProjection(_ref) {
|
|
185
162
|
var _ref$projectionConfig = _ref.projectionConfig,
|
|
186
163
|
projectionConfig = _ref$projectionConfig === void 0 ? {} : _ref$projectionConfig,
|
|
@@ -220,7 +197,7 @@ var MapProvider = function MapProvider(_ref2) {
|
|
|
220
197
|
p1 = _ref8[0],
|
|
221
198
|
p2 = _ref8[1];
|
|
222
199
|
var s = projectionConfig.scale || null;
|
|
223
|
-
var projMemo =
|
|
200
|
+
var projMemo = useMemo(function () {
|
|
224
201
|
return makeProjection({
|
|
225
202
|
projectionConfig: {
|
|
226
203
|
center: cx || cx === 0 || cy || cy === 0 ? [cx, cy] : null,
|
|
@@ -233,8 +210,8 @@ var MapProvider = function MapProvider(_ref2) {
|
|
|
233
210
|
height: height
|
|
234
211
|
});
|
|
235
212
|
}, [width, height, projection, cx, cy, rx, ry, rz, p1, p2, s]);
|
|
236
|
-
var proj =
|
|
237
|
-
var value =
|
|
213
|
+
var proj = useCallback(projMemo, [projMemo]);
|
|
214
|
+
var value = useMemo(function () {
|
|
238
215
|
return {
|
|
239
216
|
width: width,
|
|
240
217
|
height: height,
|
|
@@ -253,11 +230,11 @@ MapProvider.propTypes = {
|
|
|
253
230
|
projectionConfig: PropTypes.object
|
|
254
231
|
};
|
|
255
232
|
var useMapContext = function useMapContext() {
|
|
256
|
-
return
|
|
233
|
+
return useContext(MapContext);
|
|
257
234
|
};
|
|
258
235
|
|
|
259
236
|
var _excluded$9 = ["width", "height", "projection", "projectionConfig", "className"];
|
|
260
|
-
var ComposableMap =
|
|
237
|
+
var ComposableMap = forwardRef(function (_ref, ref) {
|
|
261
238
|
var _ref$width = _ref.width,
|
|
262
239
|
width = _ref$width === void 0 ? 800 : _ref$width,
|
|
263
240
|
_ref$height = _ref.height,
|
|
@@ -289,6 +266,9 @@ ComposableMap.propTypes = {
|
|
|
289
266
|
className: PropTypes.string
|
|
290
267
|
};
|
|
291
268
|
|
|
269
|
+
function select(ref) {
|
|
270
|
+
return d3$1.select(ref);
|
|
271
|
+
}
|
|
292
272
|
function getCoords(w, h, t) {
|
|
293
273
|
var xOffset = (w * t.k - w) / 2;
|
|
294
274
|
var yOffset = (h * t.k - h) / 2;
|
|
@@ -309,16 +289,16 @@ function getFeatures(geographies, parseGeographies) {
|
|
|
309
289
|
if (!isTopojson) {
|
|
310
290
|
return parseGeographies ? parseGeographies(geographies.features || geographies) : geographies.features || geographies;
|
|
311
291
|
}
|
|
312
|
-
var feats =
|
|
292
|
+
var feats = feature(geographies, geographies.objects[Object.keys(geographies.objects)[0]]).features;
|
|
313
293
|
return parseGeographies ? parseGeographies(feats) : feats;
|
|
314
294
|
}
|
|
315
295
|
function getMesh(geographies) {
|
|
316
296
|
var isTopojson = geographies.type === "Topology";
|
|
317
297
|
if (!isTopojson) return null;
|
|
318
|
-
var outline =
|
|
298
|
+
var outline = mesh(geographies, geographies.objects[Object.keys(geographies.objects)[0]], function (a, b) {
|
|
319
299
|
return a === b;
|
|
320
300
|
});
|
|
321
|
-
var borders =
|
|
301
|
+
var borders = mesh(geographies, geographies.objects[Object.keys(geographies.objects)[0]], function (a, b) {
|
|
322
302
|
return a !== b;
|
|
323
303
|
});
|
|
324
304
|
return {
|
|
@@ -362,13 +342,13 @@ function isString(geo) {
|
|
|
362
342
|
function useGeographies(_ref) {
|
|
363
343
|
var geography = _ref.geography,
|
|
364
344
|
parseGeographies = _ref.parseGeographies;
|
|
365
|
-
var _useContext =
|
|
345
|
+
var _useContext = useContext(MapContext),
|
|
366
346
|
path = _useContext.path;
|
|
367
|
-
var _useState =
|
|
347
|
+
var _useState = useState({}),
|
|
368
348
|
_useState2 = _slicedToArray(_useState, 2),
|
|
369
349
|
output = _useState2[0],
|
|
370
350
|
setOutput = _useState2[1];
|
|
371
|
-
|
|
351
|
+
useEffect(function () {
|
|
372
352
|
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "undefined") return;
|
|
373
353
|
if (!geography) return;
|
|
374
354
|
if (isString(geography)) {
|
|
@@ -387,7 +367,7 @@ function useGeographies(_ref) {
|
|
|
387
367
|
});
|
|
388
368
|
}
|
|
389
369
|
}, [geography, parseGeographies]);
|
|
390
|
-
var _useMemo =
|
|
370
|
+
var _useMemo = useMemo(function () {
|
|
391
371
|
var mesh = output.mesh || {};
|
|
392
372
|
var preparedMesh = prepareMesh(mesh.outline, mesh.borders, path);
|
|
393
373
|
return {
|
|
@@ -407,14 +387,14 @@ function useGeographies(_ref) {
|
|
|
407
387
|
}
|
|
408
388
|
|
|
409
389
|
var _excluded$8 = ["geography", "children", "parseGeographies", "className"];
|
|
410
|
-
var Geographies =
|
|
390
|
+
var Geographies = forwardRef(function (_ref, ref) {
|
|
411
391
|
var geography = _ref.geography,
|
|
412
392
|
children = _ref.children,
|
|
413
393
|
parseGeographies = _ref.parseGeographies,
|
|
414
394
|
_ref$className = _ref.className,
|
|
415
395
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
416
396
|
restProps = _objectWithoutProperties(_ref, _excluded$8);
|
|
417
|
-
var _useContext =
|
|
397
|
+
var _useContext = useContext(MapContext),
|
|
418
398
|
path = _useContext.path,
|
|
419
399
|
projection = _useContext.projection;
|
|
420
400
|
var _useGeographies = useGeographies({
|
|
@@ -444,7 +424,7 @@ Geographies.propTypes = {
|
|
|
444
424
|
};
|
|
445
425
|
|
|
446
426
|
var _excluded$7 = ["geography", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "style", "className"];
|
|
447
|
-
var Geography =
|
|
427
|
+
var Geography = forwardRef(function (_ref, ref) {
|
|
448
428
|
var geography = _ref.geography,
|
|
449
429
|
onMouseEnter = _ref.onMouseEnter,
|
|
450
430
|
onMouseLeave = _ref.onMouseLeave,
|
|
@@ -457,11 +437,11 @@ var Geography = React.forwardRef(function (_ref, ref) {
|
|
|
457
437
|
_ref$className = _ref.className,
|
|
458
438
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
459
439
|
restProps = _objectWithoutProperties(_ref, _excluded$7);
|
|
460
|
-
var _useState =
|
|
440
|
+
var _useState = useState(false),
|
|
461
441
|
_useState2 = _slicedToArray(_useState, 2),
|
|
462
442
|
isPressed = _useState2[0],
|
|
463
443
|
setPressed = _useState2[1];
|
|
464
|
-
var _useState3 =
|
|
444
|
+
var _useState3 = useState(false),
|
|
465
445
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
466
446
|
isFocused = _useState4[0],
|
|
467
447
|
setFocus = _useState4[1];
|
|
@@ -517,10 +497,10 @@ Geography.propTypes = {
|
|
|
517
497
|
style: PropTypes.object,
|
|
518
498
|
className: PropTypes.string
|
|
519
499
|
};
|
|
520
|
-
var Geography$1 =
|
|
500
|
+
var Geography$1 = memo(Geography);
|
|
521
501
|
|
|
522
502
|
var _excluded$6 = ["fill", "stroke", "step", "className"];
|
|
523
|
-
var Graticule =
|
|
503
|
+
var Graticule = forwardRef(function (_ref, ref) {
|
|
524
504
|
var _ref$fill = _ref.fill,
|
|
525
505
|
fill = _ref$fill === void 0 ? "transparent" : _ref$fill,
|
|
526
506
|
_ref$stroke = _ref.stroke,
|
|
@@ -530,11 +510,11 @@ var Graticule = React.forwardRef(function (_ref, ref) {
|
|
|
530
510
|
_ref$className = _ref.className,
|
|
531
511
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
532
512
|
restProps = _objectWithoutProperties(_ref, _excluded$6);
|
|
533
|
-
var _useContext =
|
|
513
|
+
var _useContext = useContext(MapContext),
|
|
534
514
|
path = _useContext.path;
|
|
535
515
|
return /*#__PURE__*/React.createElement("path", _extends({
|
|
536
516
|
ref: ref,
|
|
537
|
-
d: path(
|
|
517
|
+
d: path(d3.geoGraticule().step(step)()),
|
|
538
518
|
fill: fill,
|
|
539
519
|
stroke: stroke,
|
|
540
520
|
className: "rsm-graticule ".concat(className)
|
|
@@ -547,10 +527,10 @@ Graticule.propTypes = {
|
|
|
547
527
|
step: PropTypes.array,
|
|
548
528
|
className: PropTypes.string
|
|
549
529
|
};
|
|
550
|
-
var Graticule$1 =
|
|
530
|
+
var Graticule$1 = memo(Graticule);
|
|
551
531
|
|
|
552
532
|
var _excluded$5 = ["value"];
|
|
553
|
-
var ZoomPanContext =
|
|
533
|
+
var ZoomPanContext = createContext();
|
|
554
534
|
var defaultValue = {
|
|
555
535
|
x: 0,
|
|
556
536
|
y: 0,
|
|
@@ -572,7 +552,7 @@ ZoomPanProvider.propTypes = {
|
|
|
572
552
|
transformString: PropTypes.string
|
|
573
553
|
};
|
|
574
554
|
var useZoomPanContext = function useZoomPanContext() {
|
|
575
|
-
return
|
|
555
|
+
return useContext(ZoomPanContext);
|
|
576
556
|
};
|
|
577
557
|
|
|
578
558
|
function useZoomPan(_ref) {
|
|
@@ -587,14 +567,14 @@ function useZoomPan(_ref) {
|
|
|
587
567
|
scaleExtent = _ref$scaleExtent === void 0 ? [1, 8] : _ref$scaleExtent,
|
|
588
568
|
_ref$zoom = _ref.zoom,
|
|
589
569
|
zoom = _ref$zoom === void 0 ? 1 : _ref$zoom;
|
|
590
|
-
var _useContext =
|
|
570
|
+
var _useContext = useContext(MapContext),
|
|
591
571
|
width = _useContext.width,
|
|
592
572
|
height = _useContext.height,
|
|
593
573
|
projection = _useContext.projection;
|
|
594
574
|
var _center = _slicedToArray(center, 2),
|
|
595
575
|
lon = _center[0],
|
|
596
576
|
lat = _center[1];
|
|
597
|
-
var _useState =
|
|
577
|
+
var _useState = useState({
|
|
598
578
|
x: 0,
|
|
599
579
|
y: 0,
|
|
600
580
|
k: 1
|
|
@@ -602,14 +582,14 @@ function useZoomPan(_ref) {
|
|
|
602
582
|
_useState2 = _slicedToArray(_useState, 2),
|
|
603
583
|
position = _useState2[0],
|
|
604
584
|
setPosition = _useState2[1];
|
|
605
|
-
var lastPosition =
|
|
585
|
+
var lastPosition = useRef({
|
|
606
586
|
x: 0,
|
|
607
587
|
y: 0,
|
|
608
588
|
k: 1
|
|
609
589
|
});
|
|
610
|
-
var mapRef =
|
|
611
|
-
var zoomRef =
|
|
612
|
-
var bypassEvents =
|
|
590
|
+
var mapRef = useRef();
|
|
591
|
+
var zoomRef = useRef();
|
|
592
|
+
var bypassEvents = useRef(false);
|
|
613
593
|
var _translateExtent = _slicedToArray(translateExtent, 2),
|
|
614
594
|
a = _translateExtent[0],
|
|
615
595
|
b = _translateExtent[1];
|
|
@@ -622,8 +602,8 @@ function useZoomPan(_ref) {
|
|
|
622
602
|
var _scaleExtent = _slicedToArray(scaleExtent, 2),
|
|
623
603
|
minZoom = _scaleExtent[0],
|
|
624
604
|
maxZoom = _scaleExtent[1];
|
|
625
|
-
|
|
626
|
-
var svg =
|
|
605
|
+
useEffect(function () {
|
|
606
|
+
var svg = select(mapRef.current);
|
|
627
607
|
function handleZoomStart(d3Event) {
|
|
628
608
|
if (!onMoveStart || bypassEvents.current) return;
|
|
629
609
|
onMoveStart({
|
|
@@ -675,18 +655,18 @@ function useZoomPan(_ref) {
|
|
|
675
655
|
}
|
|
676
656
|
return d3Event ? !d3Event.ctrlKey && !d3Event.button : false;
|
|
677
657
|
}
|
|
678
|
-
var zoom =
|
|
658
|
+
var zoom = d3$2.zoom().filter(filterFunc).scaleExtent([minZoom, maxZoom]).translateExtent([[a1, a2], [b1, b2]]).on("start", handleZoomStart).on("zoom", handleZoom).on("end", handleZoomEnd);
|
|
679
659
|
zoomRef.current = zoom;
|
|
680
660
|
svg.call(zoom);
|
|
681
661
|
}, [width, height, a1, a2, b1, b2, minZoom, maxZoom, projection, onMoveStart, onMove, onMoveEnd, filterZoomEvent]);
|
|
682
|
-
|
|
662
|
+
useEffect(function () {
|
|
683
663
|
if (lon === lastPosition.current.x && lat === lastPosition.current.y && zoom === lastPosition.current.k) return;
|
|
684
664
|
var coords = projection([lon, lat]);
|
|
685
665
|
var x = coords[0] * zoom;
|
|
686
666
|
var y = coords[1] * zoom;
|
|
687
|
-
var svg =
|
|
667
|
+
var svg = select(mapRef.current);
|
|
688
668
|
bypassEvents.current = true;
|
|
689
|
-
svg.call(zoomRef.current.transform,
|
|
669
|
+
svg.call(zoomRef.current.transform, d3$2.zoomIdentity.translate(width / 2 - x, height / 2 - y).scale(zoom));
|
|
690
670
|
setPosition({
|
|
691
671
|
x: width / 2 - x,
|
|
692
672
|
y: height / 2 - y,
|
|
@@ -706,7 +686,7 @@ function useZoomPan(_ref) {
|
|
|
706
686
|
}
|
|
707
687
|
|
|
708
688
|
var _excluded$4 = ["center", "zoom", "minZoom", "maxZoom", "translateExtent", "filterZoomEvent", "onMoveStart", "onMove", "onMoveEnd", "className"];
|
|
709
|
-
var ZoomableGroup =
|
|
689
|
+
var ZoomableGroup = forwardRef(function (_ref, ref) {
|
|
710
690
|
var _ref$center = _ref.center,
|
|
711
691
|
center = _ref$center === void 0 ? [0, 0] : _ref$center,
|
|
712
692
|
_ref$zoom = _ref.zoom,
|
|
@@ -722,7 +702,7 @@ var ZoomableGroup = React.forwardRef(function (_ref, ref) {
|
|
|
722
702
|
onMoveEnd = _ref.onMoveEnd,
|
|
723
703
|
className = _ref.className,
|
|
724
704
|
restProps = _objectWithoutProperties(_ref, _excluded$4);
|
|
725
|
-
var _useContext =
|
|
705
|
+
var _useContext = useContext(MapContext),
|
|
726
706
|
width = _useContext.width,
|
|
727
707
|
height = _useContext.height;
|
|
728
708
|
var _useZoomPan = useZoomPan({
|
|
@@ -771,7 +751,7 @@ ZoomableGroup.propTypes = {
|
|
|
771
751
|
};
|
|
772
752
|
|
|
773
753
|
var _excluded$3 = ["id", "fill", "stroke", "strokeWidth", "className"];
|
|
774
|
-
var Sphere =
|
|
754
|
+
var Sphere = forwardRef(function (_ref, ref) {
|
|
775
755
|
var _ref$id = _ref.id,
|
|
776
756
|
id = _ref$id === void 0 ? "rsm-sphere" : _ref$id,
|
|
777
757
|
_ref$fill = _ref.fill,
|
|
@@ -783,14 +763,14 @@ var Sphere = React.forwardRef(function (_ref, ref) {
|
|
|
783
763
|
_ref$className = _ref.className,
|
|
784
764
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
785
765
|
restProps = _objectWithoutProperties(_ref, _excluded$3);
|
|
786
|
-
var _useContext =
|
|
766
|
+
var _useContext = useContext(MapContext),
|
|
787
767
|
path = _useContext.path;
|
|
788
|
-
var spherePath =
|
|
768
|
+
var spherePath = useMemo(function () {
|
|
789
769
|
return path({
|
|
790
770
|
type: "Sphere"
|
|
791
771
|
});
|
|
792
772
|
}, [path]);
|
|
793
|
-
return /*#__PURE__*/React.createElement(
|
|
773
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
794
774
|
id: id
|
|
795
775
|
}, /*#__PURE__*/React.createElement("path", {
|
|
796
776
|
d: spherePath
|
|
@@ -814,10 +794,10 @@ Sphere.propTypes = {
|
|
|
814
794
|
strokeWidth: PropTypes.number,
|
|
815
795
|
className: PropTypes.string
|
|
816
796
|
};
|
|
817
|
-
var Sphere$1 =
|
|
797
|
+
var Sphere$1 = memo(Sphere);
|
|
818
798
|
|
|
819
799
|
var _excluded$2 = ["coordinates", "children", "onMouseEnter", "onMouseLeave", "onMouseDown", "onMouseUp", "onFocus", "onBlur", "style", "className"];
|
|
820
|
-
var Marker =
|
|
800
|
+
var Marker = forwardRef(function (_ref, ref) {
|
|
821
801
|
var coordinates = _ref.coordinates,
|
|
822
802
|
children = _ref.children,
|
|
823
803
|
onMouseEnter = _ref.onMouseEnter,
|
|
@@ -831,13 +811,13 @@ var Marker = React.forwardRef(function (_ref, ref) {
|
|
|
831
811
|
_ref$className = _ref.className,
|
|
832
812
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
833
813
|
restProps = _objectWithoutProperties(_ref, _excluded$2);
|
|
834
|
-
var _useContext =
|
|
814
|
+
var _useContext = useContext(MapContext),
|
|
835
815
|
projection = _useContext.projection;
|
|
836
|
-
var _useState =
|
|
816
|
+
var _useState = useState(false),
|
|
837
817
|
_useState2 = _slicedToArray(_useState, 2),
|
|
838
818
|
isPressed = _useState2[0],
|
|
839
819
|
setPressed = _useState2[1];
|
|
840
|
-
var _useState3 =
|
|
820
|
+
var _useState3 = useState(false),
|
|
841
821
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
842
822
|
isFocused = _useState4[0],
|
|
843
823
|
setFocus = _useState4[1];
|
|
@@ -899,7 +879,7 @@ Marker.propTypes = {
|
|
|
899
879
|
};
|
|
900
880
|
|
|
901
881
|
var _excluded$1 = ["from", "to", "coordinates", "stroke", "strokeWidth", "fill", "className"];
|
|
902
|
-
var Line =
|
|
882
|
+
var Line = forwardRef(function (_ref, ref) {
|
|
903
883
|
var _ref$from = _ref.from,
|
|
904
884
|
from = _ref$from === void 0 ? [0, 0] : _ref$from,
|
|
905
885
|
_ref$to = _ref.to,
|
|
@@ -914,7 +894,7 @@ var Line = React.forwardRef(function (_ref, ref) {
|
|
|
914
894
|
_ref$className = _ref.className,
|
|
915
895
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
916
896
|
restProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
917
|
-
var _useContext =
|
|
897
|
+
var _useContext = useContext(MapContext),
|
|
918
898
|
path = _useContext.path;
|
|
919
899
|
var lineData = {
|
|
920
900
|
type: "LineString",
|
|
@@ -941,7 +921,7 @@ Line.propTypes = {
|
|
|
941
921
|
};
|
|
942
922
|
|
|
943
923
|
var _excluded = ["subject", "children", "connectorProps", "dx", "dy", "curve", "className"];
|
|
944
|
-
var Annotation =
|
|
924
|
+
var Annotation = forwardRef(function (_ref, ref) {
|
|
945
925
|
var subject = _ref.subject,
|
|
946
926
|
children = _ref.children,
|
|
947
927
|
connectorProps = _ref.connectorProps,
|
|
@@ -954,7 +934,7 @@ var Annotation = React.forwardRef(function (_ref, ref) {
|
|
|
954
934
|
_ref$className = _ref.className,
|
|
955
935
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
956
936
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
957
|
-
var _useContext =
|
|
937
|
+
var _useContext = useContext(MapContext),
|
|
958
938
|
projection = _useContext.projection;
|
|
959
939
|
var _projection = projection(subject),
|
|
960
940
|
_projection2 = _slicedToArray(_projection, 2),
|
|
@@ -982,20 +962,4 @@ Annotation.propTypes = {
|
|
|
982
962
|
className: PropTypes.string
|
|
983
963
|
};
|
|
984
964
|
|
|
985
|
-
|
|
986
|
-
exports.ComposableMap = ComposableMap;
|
|
987
|
-
exports.Geographies = Geographies;
|
|
988
|
-
exports.Geography = Geography$1;
|
|
989
|
-
exports.Graticule = Graticule$1;
|
|
990
|
-
exports.Line = Line;
|
|
991
|
-
exports.MapContext = MapContext;
|
|
992
|
-
exports.MapProvider = MapProvider;
|
|
993
|
-
exports.Marker = Marker;
|
|
994
|
-
exports.Sphere = Sphere$1;
|
|
995
|
-
exports.ZoomPanContext = ZoomPanContext;
|
|
996
|
-
exports.ZoomPanProvider = ZoomPanProvider;
|
|
997
|
-
exports.ZoomableGroup = ZoomableGroup;
|
|
998
|
-
exports.useGeographies = useGeographies;
|
|
999
|
-
exports.useMapContext = useMapContext;
|
|
1000
|
-
exports.useZoomPan = useZoomPan;
|
|
1001
|
-
exports.useZoomPanContext = useZoomPanContext;
|
|
965
|
+
export { Annotation, ComposableMap, Geographies, Geography$1 as Geography, Graticule$1 as Graticule, Line, MapContext, MapProvider, Marker, Sphere$1 as Sphere, ZoomPanContext, ZoomPanProvider, ZoomableGroup, useGeographies, useMapContext, useZoomPan, useZoomPanContext };
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("d3-geo"),require("topojson-client"),require("d3-zoom"),require("d3-selection")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","d3-geo","topojson-client","d3-zoom","d3-selection"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).reactSimpleMaps=e.reactSimpleMaps||{},e.React,e.PropTypes,e.d3,e.topojson,e.d3,e.d3)}(this,(function(e,t,r,o,n,a,s){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=i(o),u=i(a),l=i(s);function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function d(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},y.apply(this,arguments)}function v(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,a,s,i=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(o=a.call(r)).done)&&(i.push(o.value),i.length!==t);c=!0);}catch(e){u=!0,n=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw n}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}var b=["width","height","projection","projectionConfig"],j=c.geoPath,E=v(c,["geoPath"]),M=t.createContext(),x=function(e){var r=e.width,o=e.height,n=e.projection,a=e.projectionConfig,s=v(e,b),i=g(a.center||[],2),c=i[0],u=i[1],l=g(a.rotate||[],3),f=l[0],p=l[1],m=l[2],d=g(a.parallels||[],2),h=d[0],x=d[1],w=a.scale||null,k=t.useMemo((function(){return function(e){var t=e.projectionConfig,r=void 0===t?{}:t,o=e.projection,n=void 0===o?"geoEqualEarth":o,a=e.width,s=void 0===a?800:a,i=e.height,c=void 0===i?600:i;if("function"==typeof n)return n;var u=E[n]().translate([s/2,c/2]);return[u.center?"center":null,u.rotate?"rotate":null,u.scale?"scale":null,u.parallels?"parallels":null].forEach((function(e){e&&(u=u[e](r[e]||u[e]()))})),u}({projectionConfig:{center:c||0===c||u||0===u?[c,u]:null,rotate:f||0===f||p||0===p?[f,p,m]:null,parallels:h||0===h||x||0===x?[h,x]:null,scale:w},projection:n,width:r,height:o})}),[r,o,n,c,u,f,p,m,h,x,w]),O=t.useCallback(k,[k]),N=t.useMemo((function(){return{width:r,height:o,projection:O,path:j().projection(O)}}),[r,o,O]);return t.createElement(M.Provider,y({value:N},s))};x.propTypes={width:r.number,height:r.number,projection:r.oneOfType([r.string,r.func]),projectionConfig:r.object};var w=["width","height","projection","projectionConfig","className"],k=t.forwardRef((function(e,r){var o=e.width,n=void 0===o?800:o,a=e.height,s=void 0===a?600:a,i=e.projection,c=void 0===i?"geoEqualEarth":i,u=e.projectionConfig,l=void 0===u?{}:u,f=e.className,p=void 0===f?"":f,m=v(e,w);return t.createElement(x,{width:n,height:s,projection:c,projectionConfig:l},t.createElement("svg",y({ref:r,viewBox:"0 0 ".concat(n," ").concat(s),className:"rsm-svg ".concat(p)},m)))}));function O(e,t,r){var o=(e*r.k-e)/2,n=(t*r.k-t)/2;return[e/2-(o+r.x)/r.k,t/2-(n+r.y)/r.k]}function N(e,t){if(!("Topology"===e.type))return t?t(e.features||e):e.features||e;var r=n.feature(e,e.objects[Object.keys(e.objects)[0]]).features;return t?t(r):r}function S(e){return"Topology"===e.type?{outline:n.mesh(e,e.objects[Object.keys(e.objects)[0]],(function(e,t){return e===t})),borders:n.mesh(e,e.objects[Object.keys(e.objects)[0]],(function(e,t){return e!==t}))}:null}function P(e,t){return e?e.map((function(e,r){return p(p({},e),{},{rsmKey:"geo-".concat(r),svgPath:t(e)})})):[]}function C(e){var r=e.geography,o=e.parseGeographies,n=t.useContext(M).path,a=g(t.useState({}),2),s=a[0],i=a[1];t.useEffect((function(){var e;"undefined"!==("undefined"==typeof window?"undefined":m(window))&&(r&&("string"==typeof r?(e=r,fetch(e).then((function(e){if(!e.ok)throw Error(e.statusText);return e.json()})).catch((function(e){console.log("There was a problem when fetching the data: ",e)}))).then((function(e){e&&i({geographies:N(e,o),mesh:S(e)})})):i({geographies:N(r,o),mesh:S(r)})))}),[r,o]);var c=t.useMemo((function(){var e=s.mesh||{},t=function(e,t,r){return e&&t?{outline:p(p({},e),{},{rsmKey:"outline",svgPath:r(e)}),borders:p(p({},t),{},{rsmKey:"borders",svgPath:r(t)})}:{}}(e.outline,e.borders,n);return{geographies:P(s.geographies,n),outline:t.outline,borders:t.borders}}),[s,n]);return{geographies:c.geographies,outline:c.outline,borders:c.borders}}k.displayName="ComposableMap",k.propTypes={width:r.number,height:r.number,projection:r.oneOfType([r.string,r.func]),projectionConfig:r.object,className:r.string};var T=["geography","children","parseGeographies","className"],R=t.forwardRef((function(e,r){var o=e.geography,n=e.children,a=e.parseGeographies,s=e.className,i=void 0===s?"":s,c=v(e,T),u=t.useContext(M),l=u.path,f=u.projection,p=C({geography:o,parseGeographies:a}),m=p.geographies,d=p.outline,g=p.borders;return t.createElement("g",y({ref:r,className:"rsm-geographies ".concat(i)},c),m&&m.length>0&&n({geographies:m,outline:d,borders:g,path:l,projection:f}))}));R.displayName="Geographies",R.propTypes={geography:r.oneOfType([r.string,r.object,r.array]),children:r.func,parseGeographies:r.func,className:r.string};var Z=["geography","onMouseEnter","onMouseLeave","onMouseDown","onMouseUp","onFocus","onBlur","style","className"],z=t.forwardRef((function(e,r){var o=e.geography,n=e.onMouseEnter,a=e.onMouseLeave,s=e.onMouseDown,i=e.onMouseUp,c=e.onFocus,u=e.onBlur,l=e.style,f=void 0===l?{}:l,p=e.className,m=void 0===p?"":p,d=v(e,Z),h=g(t.useState(!1),2),b=h[0],j=h[1],E=g(t.useState(!1),2),M=E[0],x=E[1];return t.createElement("path",y({ref:r,tabIndex:"0",className:"rsm-geography ".concat(m),d:o.svgPath,onMouseEnter:function(e){x(!0),n&&n(e)},onMouseLeave:function(e){x(!1),b&&j(!1),a&&a(e)},onFocus:function(e){x(!0),c&&c(e)},onBlur:function(e){x(!1),b&&j(!1),u&&u(e)},onMouseDown:function(e){j(!0),s&&s(e)},onMouseUp:function(e){j(!1),i&&i(e)},style:f[b||M?b?"pressed":"hover":"default"]},d))}));z.displayName="Geography",z.propTypes={geography:r.object,onMouseEnter:r.func,onMouseLeave:r.func,onMouseDown:r.func,onMouseUp:r.func,onFocus:r.func,onBlur:r.func,style:r.object,className:r.string};var G=t.memo(z),D=["fill","stroke","step","className"],L=t.forwardRef((function(e,r){var o=e.fill,n=void 0===o?"transparent":o,a=e.stroke,s=void 0===a?"currentcolor":a,i=e.step,u=void 0===i?[10,10]:i,l=e.className,f=void 0===l?"":l,p=v(e,D),m=t.useContext(M).path;return t.createElement("path",y({ref:r,d:m(c.geoGraticule().step(u)()),fill:n,stroke:s,className:"rsm-graticule ".concat(f)},p))}));L.displayName="Graticule",L.propTypes={fill:r.string,stroke:r.string,step:r.array,className:r.string};var A=t.memo(L),B=["value"],F=t.createContext(),U={x:0,y:0,k:1,transformString:"translate(0 0) scale(1)"},q=function(e){var r=e.value,o=void 0===r?U:r,n=v(e,B);return t.createElement(F.Provider,y({value:o},n))};q.propTypes={x:r.number,y:r.number,k:r.number,transformString:r.string};function W(e){var r=e.center,o=e.filterZoomEvent,n=e.onMoveStart,a=e.onMoveEnd,s=e.onMove,i=e.translateExtent,c=void 0===i?[[-1/0,-1/0],[1/0,1/0]]:i,f=e.scaleExtent,p=void 0===f?[1,8]:f,m=e.zoom,d=void 0===m?1:m,y=t.useContext(M),v=y.width,h=y.height,b=y.projection,j=g(r,2),E=j[0],x=j[1],w=g(t.useState({x:0,y:0,k:1}),2),k=w[0],N=w[1],S=t.useRef({x:0,y:0,k:1}),P=t.useRef(),C=t.useRef(),T=t.useRef(!1),R=g(c,2),Z=R[0],z=R[1],G=g(Z,2),D=G[0],L=G[1],A=g(z,2),B=A[0],F=A[1],U=g(p,2),q=U[0],W=U[1];return t.useEffect((function(){var e=l.select(P.current);var t=u.zoom().filter((function(e){return o?o(e):!!e&&(!e.ctrlKey&&!e.button)})).scaleExtent([q,W]).translateExtent([[D,L],[B,F]]).on("start",(function(e){n&&!T.current&&n({coordinates:b.invert(O(v,h,e.transform)),zoom:e.transform.k},e)})).on("zoom",(function(e){if(!T.current){var t=e.transform,r=e.sourceEvent;N({x:t.x,y:t.y,k:t.k,dragging:r}),s&&s({x:t.x,y:t.y,zoom:t.k,dragging:r},e)}})).on("end",(function(e){if(T.current)T.current=!1;else{var t=g(b.invert(O(v,h,e.transform)),2),r=t[0],o=t[1];S.current={x:r,y:o,k:e.transform.k},a&&a({coordinates:[r,o],zoom:e.transform.k},e)}}));C.current=t,e.call(t)}),[v,h,D,L,B,F,q,W,b,n,s,a,o]),t.useEffect((function(){if(E!==S.current.x||x!==S.current.y||d!==S.current.k){var e=b([E,x]),t=e[0]*d,r=e[1]*d,o=l.select(P.current);T.current=!0,o.call(C.current.transform,u.zoomIdentity.translate(v/2-t,h/2-r).scale(d)),N({x:v/2-t,y:h/2-r,k:d}),S.current={x:E,y:x,k:d}}}),[E,x,d,v,h,b]),{mapRef:P,position:k,transformString:"translate(".concat(k.x," ").concat(k.y,") scale(").concat(k.k,")")}}var I=["center","zoom","minZoom","maxZoom","translateExtent","filterZoomEvent","onMoveStart","onMove","onMoveEnd","className"],K=t.forwardRef((function(e,r){var o=e.center,n=void 0===o?[0,0]:o,a=e.zoom,s=void 0===a?1:a,i=e.minZoom,c=void 0===i?1:i,u=e.maxZoom,l=void 0===u?8:u,f=e.translateExtent,p=e.filterZoomEvent,m=e.onMoveStart,d=e.onMove,g=e.onMoveEnd,h=e.className,b=v(e,I),j=t.useContext(M),E=j.width,x=j.height,w=W({center:n,filterZoomEvent:p,onMoveStart:m,onMove:d,onMoveEnd:g,scaleExtent:[c,l],translateExtent:f,zoom:s}),k=w.mapRef,O=w.transformString,N=w.position;return t.createElement(q,{value:{x:N.x,y:N.y,k:N.k,transformString:O}},t.createElement("g",{ref:k},t.createElement("rect",{width:E,height:x,fill:"transparent"}),t.createElement("g",y({ref:r,transform:O,className:"rsm-zoomable-group ".concat(h)},b))))}));K.displayName="ZoomableGroup",K.propTypes={center:r.array,zoom:r.number,minZoom:r.number,maxZoom:r.number,translateExtent:r.arrayOf(r.array),onMoveStart:r.func,onMove:r.func,onMoveEnd:r.func,className:r.string};var Q=["id","fill","stroke","strokeWidth","className"],$=t.forwardRef((function(e,r){var o=e.id,n=void 0===o?"rsm-sphere":o,a=e.fill,s=void 0===a?"transparent":a,i=e.stroke,c=void 0===i?"currentcolor":i,u=e.strokeWidth,l=void 0===u?.5:u,f=e.className,p=void 0===f?"":f,m=v(e,Q),d=t.useContext(M).path,g=t.useMemo((function(){return d({type:"Sphere"})}),[d]);return t.createElement(t.Fragment,null,t.createElement("defs",null,t.createElement("clipPath",{id:n},t.createElement("path",{d:g}))),t.createElement("path",y({ref:r,d:g,fill:s,stroke:c,strokeWidth:l,style:{pointerEvents:"none"},className:"rsm-sphere ".concat(p)},m)))}));$.displayName="Sphere",$.propTypes={id:r.string,fill:r.string,stroke:r.string,strokeWidth:r.number,className:r.string};var H=t.memo($),J=["coordinates","children","onMouseEnter","onMouseLeave","onMouseDown","onMouseUp","onFocus","onBlur","style","className"],V=t.forwardRef((function(e,r){var o=e.coordinates,n=e.children,a=e.onMouseEnter,s=e.onMouseLeave,i=e.onMouseDown,c=e.onMouseUp,u=e.onFocus,l=e.onBlur,f=e.style,p=void 0===f?{}:f,m=e.className,d=void 0===m?"":m,h=v(e,J),b=t.useContext(M).projection,j=g(t.useState(!1),2),E=j[0],x=j[1],w=g(t.useState(!1),2),k=w[0],O=w[1],N=g(b(o),2),S=N[0],P=N[1];return t.createElement("g",y({ref:r,transform:"translate(".concat(S,", ").concat(P,")"),className:"rsm-marker ".concat(d),onMouseEnter:function(e){O(!0),a&&a(e)},onMouseLeave:function(e){O(!1),E&&x(!1),s&&s(e)},onFocus:function(e){O(!0),u&&u(e)},onBlur:function(e){O(!1),E&&x(!1),l&&l(e)},onMouseDown:function(e){x(!0),i&&i(e)},onMouseUp:function(e){x(!1),c&&c(e)},style:p[E||k?E?"pressed":"hover":"default"]},h),n)}));V.displayName="Marker",V.propTypes={coordinates:r.array,children:r.oneOfType([r.node,r.arrayOf(r.node)]),onMouseEnter:r.func,onMouseLeave:r.func,onMouseDown:r.func,onMouseUp:r.func,onFocus:r.func,onBlur:r.func,style:r.object,className:r.string};var X=["from","to","coordinates","stroke","strokeWidth","fill","className"],Y=t.forwardRef((function(e,r){var o=e.from,n=void 0===o?[0,0]:o,a=e.to,s=void 0===a?[0,0]:a,i=e.coordinates,c=e.stroke,u=void 0===c?"currentcolor":c,l=e.strokeWidth,f=void 0===l?3:l,p=e.fill,m=void 0===p?"transparent":p,d=e.className,g=void 0===d?"":d,h=v(e,X),b=t.useContext(M).path,j={type:"LineString",coordinates:i||[n,s]};return t.createElement("path",y({ref:r,d:b(j),className:"rsm-line ".concat(g),stroke:u,strokeWidth:f,fill:m},h))}));Y.displayName="Line",Y.propTypes={from:r.array,to:r.array,coordinates:r.array,stroke:r.string,strokeWidth:r.number,fill:r.string,className:r.string};var _=["subject","children","connectorProps","dx","dy","curve","className"],ee=t.forwardRef((function(e,r){var o=e.subject,n=e.children,a=e.connectorProps,s=e.dx,i=void 0===s?30:s,c=e.dy,u=void 0===c?30:c,l=e.curve,f=void 0===l?0:l,p=e.className,m=void 0===p?"":p,d=v(e,_),h=g((0,t.useContext(M).projection)(o),2),b=h[0],j=h[1],E=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5,o=Array.isArray(r)?r:[r,r],n=e/2*o[0],a=t/2*o[1];return"M".concat(0,",",0," Q",-e/2-n,",").concat(-t/2+a," ").concat(-e,",").concat(-t)}(i,u,f);return t.createElement("g",y({ref:r,transform:"translate(".concat(b+i,", ").concat(j+u,")"),className:"rsm-annotation ".concat(m)},d),t.createElement("path",y({d:E,fill:"transparent",stroke:"#000"},a)),n)}));ee.displayName="Annotation",ee.propTypes={subject:r.array,children:r.oneOfType([r.node,r.arrayOf(r.node)]),dx:r.number,dy:r.number,curve:r.number,connectorProps:r.object,className:r.string},e.Annotation=ee,e.ComposableMap=k,e.Geographies=R,e.Geography=G,e.Graticule=A,e.Line=Y,e.MapContext=M,e.MapProvider=x,e.Marker=V,e.Sphere=H,e.ZoomPanContext=F,e.ZoomPanProvider=q,e.ZoomableGroup=K,e.useGeographies=C,e.useMapContext=function(){return t.useContext(M)},e.useZoomPan=W,e.useZoomPanContext=function(){return t.useContext(F)}}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("d3-geo"),require("topojson-client"),require("d3-selection"),require("d3-zoom")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","d3-geo","topojson-client","d3-selection","d3-zoom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).reactSimpleMaps=e.reactSimpleMaps||{},e.React,e.PropTypes,e.d3,e.topojson,e.d3,e.d3)}(this,(function(e,t,r,o,n,a,s){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=i(o),u=i(a),l=i(s);function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function d(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},y.apply(this,arguments)}function v(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,a,s,i=[],c=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(o=a.call(r)).done)&&(i.push(o.value),i.length!==t);c=!0);}catch(e){u=!0,n=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw n}}return i}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}var b=["width","height","projection","projectionConfig"],j=c.geoPath,E=v(c,["geoPath"]),M=t.createContext(),x=function(e){var r=e.width,o=e.height,n=e.projection,a=e.projectionConfig,s=v(e,b),i=g(a.center||[],2),c=i[0],u=i[1],l=g(a.rotate||[],3),f=l[0],p=l[1],m=l[2],d=g(a.parallels||[],2),h=d[0],x=d[1],w=a.scale||null,k=t.useMemo((function(){return function(e){var t=e.projectionConfig,r=void 0===t?{}:t,o=e.projection,n=void 0===o?"geoEqualEarth":o,a=e.width,s=void 0===a?800:a,i=e.height,c=void 0===i?600:i;if("function"==typeof n)return n;var u=E[n]().translate([s/2,c/2]);return[u.center?"center":null,u.rotate?"rotate":null,u.scale?"scale":null,u.parallels?"parallels":null].forEach((function(e){e&&(u=u[e](r[e]||u[e]()))})),u}({projectionConfig:{center:c||0===c||u||0===u?[c,u]:null,rotate:f||0===f||p||0===p?[f,p,m]:null,parallels:h||0===h||x||0===x?[h,x]:null,scale:w},projection:n,width:r,height:o})}),[r,o,n,c,u,f,p,m,h,x,w]),O=t.useCallback(k,[k]),N=t.useMemo((function(){return{width:r,height:o,projection:O,path:j().projection(O)}}),[r,o,O]);return t.createElement(M.Provider,y({value:N},s))};x.propTypes={width:r.number,height:r.number,projection:r.oneOfType([r.string,r.func]),projectionConfig:r.object};var w=["width","height","projection","projectionConfig","className"],k=t.forwardRef((function(e,r){var o=e.width,n=void 0===o?800:o,a=e.height,s=void 0===a?600:a,i=e.projection,c=void 0===i?"geoEqualEarth":i,u=e.projectionConfig,l=void 0===u?{}:u,f=e.className,p=void 0===f?"":f,m=v(e,w);return t.createElement(x,{width:n,height:s,projection:c,projectionConfig:l},t.createElement("svg",y({ref:r,viewBox:"0 0 ".concat(n," ").concat(s),className:"rsm-svg ".concat(p)},m)))}));function O(e){return u.select(e)}function N(e,t,r){var o=(e*r.k-e)/2,n=(t*r.k-t)/2;return[e/2-(o+r.x)/r.k,t/2-(n+r.y)/r.k]}function S(e,t){if(!("Topology"===e.type))return t?t(e.features||e):e.features||e;var r=n.feature(e,e.objects[Object.keys(e.objects)[0]]).features;return t?t(r):r}function P(e){return"Topology"===e.type?{outline:n.mesh(e,e.objects[Object.keys(e.objects)[0]],(function(e,t){return e===t})),borders:n.mesh(e,e.objects[Object.keys(e.objects)[0]],(function(e,t){return e!==t}))}:null}function C(e,t){return e?e.map((function(e,r){return p(p({},e),{},{rsmKey:"geo-".concat(r),svgPath:t(e)})})):[]}function T(e){var r=e.geography,o=e.parseGeographies,n=t.useContext(M).path,a=g(t.useState({}),2),s=a[0],i=a[1];t.useEffect((function(){var e;"undefined"!==("undefined"==typeof window?"undefined":m(window))&&(r&&("string"==typeof r?(e=r,fetch(e).then((function(e){if(!e.ok)throw Error(e.statusText);return e.json()})).catch((function(e){console.log("There was a problem when fetching the data: ",e)}))).then((function(e){e&&i({geographies:S(e,o),mesh:P(e)})})):i({geographies:S(r,o),mesh:P(r)})))}),[r,o]);var c=t.useMemo((function(){var e=s.mesh||{},t=function(e,t,r){return e&&t?{outline:p(p({},e),{},{rsmKey:"outline",svgPath:r(e)}),borders:p(p({},t),{},{rsmKey:"borders",svgPath:r(t)})}:{}}(e.outline,e.borders,n);return{geographies:C(s.geographies,n),outline:t.outline,borders:t.borders}}),[s,n]);return{geographies:c.geographies,outline:c.outline,borders:c.borders}}k.displayName="ComposableMap",k.propTypes={width:r.number,height:r.number,projection:r.oneOfType([r.string,r.func]),projectionConfig:r.object,className:r.string};var R=["geography","children","parseGeographies","className"],Z=t.forwardRef((function(e,r){var o=e.geography,n=e.children,a=e.parseGeographies,s=e.className,i=void 0===s?"":s,c=v(e,R),u=t.useContext(M),l=u.path,f=u.projection,p=T({geography:o,parseGeographies:a}),m=p.geographies,d=p.outline,g=p.borders;return t.createElement("g",y({ref:r,className:"rsm-geographies ".concat(i)},c),m&&m.length>0&&n({geographies:m,outline:d,borders:g,path:l,projection:f}))}));Z.displayName="Geographies",Z.propTypes={geography:r.oneOfType([r.string,r.object,r.array]),children:r.func,parseGeographies:r.func,className:r.string};var z=["geography","onMouseEnter","onMouseLeave","onMouseDown","onMouseUp","onFocus","onBlur","style","className"],G=t.forwardRef((function(e,r){var o=e.geography,n=e.onMouseEnter,a=e.onMouseLeave,s=e.onMouseDown,i=e.onMouseUp,c=e.onFocus,u=e.onBlur,l=e.style,f=void 0===l?{}:l,p=e.className,m=void 0===p?"":p,d=v(e,z),h=g(t.useState(!1),2),b=h[0],j=h[1],E=g(t.useState(!1),2),M=E[0],x=E[1];return t.createElement("path",y({ref:r,tabIndex:"0",className:"rsm-geography ".concat(m),d:o.svgPath,onMouseEnter:function(e){x(!0),n&&n(e)},onMouseLeave:function(e){x(!1),b&&j(!1),a&&a(e)},onFocus:function(e){x(!0),c&&c(e)},onBlur:function(e){x(!1),b&&j(!1),u&&u(e)},onMouseDown:function(e){j(!0),s&&s(e)},onMouseUp:function(e){j(!1),i&&i(e)},style:f[b||M?b?"pressed":"hover":"default"]},d))}));G.displayName="Geography",G.propTypes={geography:r.object,onMouseEnter:r.func,onMouseLeave:r.func,onMouseDown:r.func,onMouseUp:r.func,onFocus:r.func,onBlur:r.func,style:r.object,className:r.string};var D=t.memo(G),L=["fill","stroke","step","className"],A=t.forwardRef((function(e,r){var o=e.fill,n=void 0===o?"transparent":o,a=e.stroke,s=void 0===a?"currentcolor":a,i=e.step,u=void 0===i?[10,10]:i,l=e.className,f=void 0===l?"":l,p=v(e,L),m=t.useContext(M).path;return t.createElement("path",y({ref:r,d:m(c.geoGraticule().step(u)()),fill:n,stroke:s,className:"rsm-graticule ".concat(f)},p))}));A.displayName="Graticule",A.propTypes={fill:r.string,stroke:r.string,step:r.array,className:r.string};var B=t.memo(A),F=["value"],U=t.createContext(),q={x:0,y:0,k:1,transformString:"translate(0 0) scale(1)"},W=function(e){var r=e.value,o=void 0===r?q:r,n=v(e,F);return t.createElement(U.Provider,y({value:o},n))};W.propTypes={x:r.number,y:r.number,k:r.number,transformString:r.string};function I(e){var r=e.center,o=e.filterZoomEvent,n=e.onMoveStart,a=e.onMoveEnd,s=e.onMove,i=e.translateExtent,c=void 0===i?[[-1/0,-1/0],[1/0,1/0]]:i,u=e.scaleExtent,f=void 0===u?[1,8]:u,p=e.zoom,m=void 0===p?1:p,d=t.useContext(M),y=d.width,v=d.height,h=d.projection,b=g(r,2),j=b[0],E=b[1],x=g(t.useState({x:0,y:0,k:1}),2),w=x[0],k=x[1],S=t.useRef({x:0,y:0,k:1}),P=t.useRef(),C=t.useRef(),T=t.useRef(!1),R=g(c,2),Z=R[0],z=R[1],G=g(Z,2),D=G[0],L=G[1],A=g(z,2),B=A[0],F=A[1],U=g(f,2),q=U[0],W=U[1];return t.useEffect((function(){var e=O(P.current);var t=l.zoom().filter((function(e){return o?o(e):!!e&&(!e.ctrlKey&&!e.button)})).scaleExtent([q,W]).translateExtent([[D,L],[B,F]]).on("start",(function(e){n&&!T.current&&n({coordinates:h.invert(N(y,v,e.transform)),zoom:e.transform.k},e)})).on("zoom",(function(e){if(!T.current){var t=e.transform,r=e.sourceEvent;k({x:t.x,y:t.y,k:t.k,dragging:r}),s&&s({x:t.x,y:t.y,zoom:t.k,dragging:r},e)}})).on("end",(function(e){if(T.current)T.current=!1;else{var t=g(h.invert(N(y,v,e.transform)),2),r=t[0],o=t[1];S.current={x:r,y:o,k:e.transform.k},a&&a({coordinates:[r,o],zoom:e.transform.k},e)}}));C.current=t,e.call(t)}),[y,v,D,L,B,F,q,W,h,n,s,a,o]),t.useEffect((function(){if(j!==S.current.x||E!==S.current.y||m!==S.current.k){var e=h([j,E]),t=e[0]*m,r=e[1]*m,o=O(P.current);T.current=!0,o.call(C.current.transform,l.zoomIdentity.translate(y/2-t,v/2-r).scale(m)),k({x:y/2-t,y:v/2-r,k:m}),S.current={x:j,y:E,k:m}}}),[j,E,m,y,v,h]),{mapRef:P,position:w,transformString:"translate(".concat(w.x," ").concat(w.y,") scale(").concat(w.k,")")}}var K=["center","zoom","minZoom","maxZoom","translateExtent","filterZoomEvent","onMoveStart","onMove","onMoveEnd","className"],Q=t.forwardRef((function(e,r){var o=e.center,n=void 0===o?[0,0]:o,a=e.zoom,s=void 0===a?1:a,i=e.minZoom,c=void 0===i?1:i,u=e.maxZoom,l=void 0===u?8:u,f=e.translateExtent,p=e.filterZoomEvent,m=e.onMoveStart,d=e.onMove,g=e.onMoveEnd,h=e.className,b=v(e,K),j=t.useContext(M),E=j.width,x=j.height,w=I({center:n,filterZoomEvent:p,onMoveStart:m,onMove:d,onMoveEnd:g,scaleExtent:[c,l],translateExtent:f,zoom:s}),k=w.mapRef,O=w.transformString,N=w.position;return t.createElement(W,{value:{x:N.x,y:N.y,k:N.k,transformString:O}},t.createElement("g",{ref:k},t.createElement("rect",{width:E,height:x,fill:"transparent"}),t.createElement("g",y({ref:r,transform:O,className:"rsm-zoomable-group ".concat(h)},b))))}));Q.displayName="ZoomableGroup",Q.propTypes={center:r.array,zoom:r.number,minZoom:r.number,maxZoom:r.number,translateExtent:r.arrayOf(r.array),onMoveStart:r.func,onMove:r.func,onMoveEnd:r.func,className:r.string};var $=["id","fill","stroke","strokeWidth","className"],H=t.forwardRef((function(e,r){var o=e.id,n=void 0===o?"rsm-sphere":o,a=e.fill,s=void 0===a?"transparent":a,i=e.stroke,c=void 0===i?"currentcolor":i,u=e.strokeWidth,l=void 0===u?.5:u,f=e.className,p=void 0===f?"":f,m=v(e,$),d=t.useContext(M).path,g=t.useMemo((function(){return d({type:"Sphere"})}),[d]);return t.createElement(t.Fragment,null,t.createElement("defs",null,t.createElement("clipPath",{id:n},t.createElement("path",{d:g}))),t.createElement("path",y({ref:r,d:g,fill:s,stroke:c,strokeWidth:l,style:{pointerEvents:"none"},className:"rsm-sphere ".concat(p)},m)))}));H.displayName="Sphere",H.propTypes={id:r.string,fill:r.string,stroke:r.string,strokeWidth:r.number,className:r.string};var J=t.memo(H),V=["coordinates","children","onMouseEnter","onMouseLeave","onMouseDown","onMouseUp","onFocus","onBlur","style","className"],X=t.forwardRef((function(e,r){var o=e.coordinates,n=e.children,a=e.onMouseEnter,s=e.onMouseLeave,i=e.onMouseDown,c=e.onMouseUp,u=e.onFocus,l=e.onBlur,f=e.style,p=void 0===f?{}:f,m=e.className,d=void 0===m?"":m,h=v(e,V),b=t.useContext(M).projection,j=g(t.useState(!1),2),E=j[0],x=j[1],w=g(t.useState(!1),2),k=w[0],O=w[1],N=g(b(o),2),S=N[0],P=N[1];return t.createElement("g",y({ref:r,transform:"translate(".concat(S,", ").concat(P,")"),className:"rsm-marker ".concat(d),onMouseEnter:function(e){O(!0),a&&a(e)},onMouseLeave:function(e){O(!1),E&&x(!1),s&&s(e)},onFocus:function(e){O(!0),u&&u(e)},onBlur:function(e){O(!1),E&&x(!1),l&&l(e)},onMouseDown:function(e){x(!0),i&&i(e)},onMouseUp:function(e){x(!1),c&&c(e)},style:p[E||k?E?"pressed":"hover":"default"]},h),n)}));X.displayName="Marker",X.propTypes={coordinates:r.array,children:r.oneOfType([r.node,r.arrayOf(r.node)]),onMouseEnter:r.func,onMouseLeave:r.func,onMouseDown:r.func,onMouseUp:r.func,onFocus:r.func,onBlur:r.func,style:r.object,className:r.string};var Y=["from","to","coordinates","stroke","strokeWidth","fill","className"],_=t.forwardRef((function(e,r){var o=e.from,n=void 0===o?[0,0]:o,a=e.to,s=void 0===a?[0,0]:a,i=e.coordinates,c=e.stroke,u=void 0===c?"currentcolor":c,l=e.strokeWidth,f=void 0===l?3:l,p=e.fill,m=void 0===p?"transparent":p,d=e.className,g=void 0===d?"":d,h=v(e,Y),b=t.useContext(M).path,j={type:"LineString",coordinates:i||[n,s]};return t.createElement("path",y({ref:r,d:b(j),className:"rsm-line ".concat(g),stroke:u,strokeWidth:f,fill:m},h))}));_.displayName="Line",_.propTypes={from:r.array,to:r.array,coordinates:r.array,stroke:r.string,strokeWidth:r.number,fill:r.string,className:r.string};var ee=["subject","children","connectorProps","dx","dy","curve","className"],te=t.forwardRef((function(e,r){var o=e.subject,n=e.children,a=e.connectorProps,s=e.dx,i=void 0===s?30:s,c=e.dy,u=void 0===c?30:c,l=e.curve,f=void 0===l?0:l,p=e.className,m=void 0===p?"":p,d=v(e,ee),h=g((0,t.useContext(M).projection)(o),2),b=h[0],j=h[1],E=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5,o=Array.isArray(r)?r:[r,r],n=e/2*o[0],a=t/2*o[1];return"M".concat(0,",",0," Q",-e/2-n,",").concat(-t/2+a," ").concat(-e,",").concat(-t)}(i,u,f);return t.createElement("g",y({ref:r,transform:"translate(".concat(b+i,", ").concat(j+u,")"),className:"rsm-annotation ".concat(m)},d),t.createElement("path",y({d:E,fill:"transparent",stroke:"#000"},a)),n)}));te.displayName="Annotation",te.propTypes={subject:r.array,children:r.oneOfType([r.node,r.arrayOf(r.node)]),dx:r.number,dy:r.number,curve:r.number,connectorProps:r.object,className:r.string},e.Annotation=te,e.ComposableMap=k,e.Geographies=Z,e.Geography=D,e.Graticule=B,e.Line=_,e.MapContext=M,e.MapProvider=x,e.Marker=X,e.Sphere=J,e.ZoomPanContext=U,e.ZoomPanProvider=W,e.ZoomableGroup=Q,e.useGeographies=T,e.useMapContext=function(){return t.useContext(M)},e.useZoomPan=I,e.useZoomPanContext=function(){return t.useContext(U)}}));
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-simple-maps",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.4",
|
|
4
4
|
"description": "An svg map chart component built with and for React",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.
|
|
6
|
+
"module": "dist/index.js",
|
|
7
7
|
"browser": "dist/index.umd.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|