national-metadata 0.1.4 → 0.1.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.
Files changed (129) hide show
  1. package/dist/mapping/index.d.ts +26 -0
  2. package/dist/mapping/index.d.ts.map +1 -0
  3. package/dist/mapping/index.js +16 -0
  4. package/dist/mapping/index.js.map +1 -0
  5. package/dist/mapping/src/components/Annotation.d.ts +13 -0
  6. package/dist/mapping/src/components/Annotation.d.ts.map +1 -0
  7. package/dist/mapping/src/components/Annotation.js +15 -0
  8. package/dist/mapping/src/components/Annotation.js.map +1 -0
  9. package/dist/mapping/src/components/ComposableMap.d.ts +13 -0
  10. package/dist/mapping/src/components/ComposableMap.d.ts.map +1 -0
  11. package/dist/mapping/src/components/ComposableMap.js +9 -0
  12. package/dist/mapping/src/components/ComposableMap.js.map +1 -0
  13. package/dist/mapping/src/components/Geographies.d.ts +20 -0
  14. package/dist/mapping/src/components/Geographies.d.ts.map +1 -0
  15. package/dist/mapping/src/components/Geographies.js +16 -0
  16. package/dist/mapping/src/components/Geographies.js.map +1 -0
  17. package/dist/mapping/src/components/Geography.d.ts +21 -0
  18. package/dist/mapping/src/components/Geography.d.ts.map +1 -0
  19. package/dist/mapping/src/components/Geography.js +44 -0
  20. package/dist/mapping/src/components/Geography.js.map +1 -0
  21. package/dist/mapping/src/components/Graticule.d.ts +10 -0
  22. package/dist/mapping/src/components/Graticule.d.ts.map +1 -0
  23. package/dist/mapping/src/components/Graticule.js +10 -0
  24. package/dist/mapping/src/components/Graticule.js.map +1 -0
  25. package/dist/mapping/src/components/Line.d.ts +13 -0
  26. package/dist/mapping/src/components/Line.d.ts.map +1 -0
  27. package/dist/mapping/src/components/Line.js +13 -0
  28. package/dist/mapping/src/components/Line.js.map +1 -0
  29. package/dist/mapping/src/components/MapProvider.d.ts +26 -0
  30. package/dist/mapping/src/components/MapProvider.d.ts.map +1 -0
  31. package/dist/mapping/src/components/MapProvider.js +62 -0
  32. package/dist/mapping/src/components/MapProvider.js.map +1 -0
  33. package/dist/mapping/src/components/Marker.d.ts +21 -0
  34. package/dist/mapping/src/components/Marker.d.ts.map +1 -0
  35. package/dist/mapping/src/components/Marker.js +48 -0
  36. package/dist/mapping/src/components/Marker.js.map +1 -0
  37. package/dist/mapping/src/components/Sphere.d.ts +11 -0
  38. package/dist/mapping/src/components/Sphere.d.ts.map +1 -0
  39. package/dist/mapping/src/components/Sphere.js +14 -0
  40. package/dist/mapping/src/components/Sphere.js.map +1 -0
  41. package/dist/mapping/src/components/ZoomPanProvider.d.ts +14 -0
  42. package/dist/mapping/src/components/ZoomPanProvider.d.ts.map +1 -0
  43. package/dist/mapping/src/components/ZoomPanProvider.js +16 -0
  44. package/dist/mapping/src/components/ZoomPanProvider.js.map +1 -0
  45. package/dist/mapping/src/components/ZoomableGroup.d.ts +30 -0
  46. package/dist/mapping/src/components/ZoomableGroup.d.ts.map +1 -0
  47. package/dist/mapping/src/components/ZoomableGroup.js +24 -0
  48. package/dist/mapping/src/components/ZoomableGroup.js.map +1 -0
  49. package/dist/mapping/src/components/useGeographies.d.ts +13 -0
  50. package/dist/mapping/src/components/useGeographies.d.ts.map +1 -0
  51. package/dist/mapping/src/components/useGeographies.js +41 -0
  52. package/dist/mapping/src/components/useGeographies.js.map +1 -0
  53. package/dist/mapping/src/components/useZoomPan.d.ts +36 -0
  54. package/dist/mapping/src/components/useZoomPan.d.ts.map +1 -0
  55. package/dist/mapping/src/components/useZoomPan.js +129 -0
  56. package/dist/mapping/src/components/useZoomPan.js.map +1 -0
  57. package/dist/mapping/src/index.d.ts +14 -0
  58. package/dist/mapping/src/index.d.ts.map +1 -0
  59. package/dist/mapping/src/index.js +14 -0
  60. package/dist/mapping/src/index.js.map +1 -0
  61. package/dist/mapping/src/utils.d.ts +29 -0
  62. package/dist/mapping/src/utils.d.ts.map +1 -0
  63. package/dist/mapping/src/utils.js +71 -0
  64. package/dist/mapping/src/utils.js.map +1 -0
  65. package/dist/react-simple-maps/index.d.ts +14 -0
  66. package/dist/react-simple-maps/index.d.ts.map +1 -0
  67. package/dist/react-simple-maps/index.js +16 -0
  68. package/dist/react-simple-maps/index.js.map +1 -0
  69. package/dist/react-simple-maps/src/components/Annotation.d.ts +3 -0
  70. package/dist/react-simple-maps/src/components/Annotation.d.ts.map +1 -0
  71. package/dist/react-simple-maps/src/components/Annotation.js +27 -0
  72. package/dist/react-simple-maps/src/components/Annotation.js.map +1 -0
  73. package/dist/react-simple-maps/src/components/ComposableMap.d.ts +3 -0
  74. package/dist/react-simple-maps/src/components/ComposableMap.d.ts.map +1 -0
  75. package/dist/react-simple-maps/src/components/ComposableMap.js +17 -0
  76. package/dist/react-simple-maps/src/components/ComposableMap.js.map +1 -0
  77. package/dist/react-simple-maps/src/components/Geographies.d.ts +3 -0
  78. package/dist/react-simple-maps/src/components/Geographies.d.ts.map +1 -0
  79. package/dist/react-simple-maps/src/components/Geographies.js +27 -0
  80. package/dist/react-simple-maps/src/components/Geographies.js.map +1 -0
  81. package/dist/react-simple-maps/src/components/Geography.d.ts +3 -0
  82. package/dist/react-simple-maps/src/components/Geography.d.ts.map +1 -0
  83. package/dist/react-simple-maps/src/components/Geography.js +59 -0
  84. package/dist/react-simple-maps/src/components/Geography.js.map +1 -0
  85. package/dist/react-simple-maps/src/components/Graticule.d.ts +3 -0
  86. package/dist/react-simple-maps/src/components/Graticule.d.ts.map +1 -0
  87. package/dist/react-simple-maps/src/components/Graticule.js +17 -0
  88. package/dist/react-simple-maps/src/components/Graticule.js.map +1 -0
  89. package/dist/react-simple-maps/src/components/Line.d.ts +3 -0
  90. package/dist/react-simple-maps/src/components/Line.d.ts.map +1 -0
  91. package/dist/react-simple-maps/src/components/Line.js +23 -0
  92. package/dist/react-simple-maps/src/components/Line.js.map +1 -0
  93. package/dist/react-simple-maps/src/components/MapProvider.d.ts +18 -0
  94. package/dist/react-simple-maps/src/components/MapProvider.d.ts.map +1 -0
  95. package/dist/react-simple-maps/src/components/MapProvider.js +63 -0
  96. package/dist/react-simple-maps/src/components/MapProvider.js.map +1 -0
  97. package/dist/react-simple-maps/src/components/Marker.d.ts +3 -0
  98. package/dist/react-simple-maps/src/components/Marker.d.ts.map +1 -0
  99. package/dist/react-simple-maps/src/components/Marker.js +66 -0
  100. package/dist/react-simple-maps/src/components/Marker.js.map +1 -0
  101. package/dist/react-simple-maps/src/components/Sphere.d.ts +3 -0
  102. package/dist/react-simple-maps/src/components/Sphere.d.ts.map +1 -0
  103. package/dist/react-simple-maps/src/components/Sphere.js +22 -0
  104. package/dist/react-simple-maps/src/components/Sphere.js.map +1 -0
  105. package/dist/react-simple-maps/src/components/ZoomPanProvider.d.ts +20 -0
  106. package/dist/react-simple-maps/src/components/ZoomPanProvider.d.ts.map +1 -0
  107. package/dist/react-simple-maps/src/components/ZoomPanProvider.js +23 -0
  108. package/dist/react-simple-maps/src/components/ZoomPanProvider.js.map +1 -0
  109. package/dist/react-simple-maps/src/components/ZoomableGroup.d.ts +3 -0
  110. package/dist/react-simple-maps/src/components/ZoomableGroup.d.ts.map +1 -0
  111. package/dist/react-simple-maps/src/components/ZoomableGroup.js +36 -0
  112. package/dist/react-simple-maps/src/components/ZoomableGroup.js.map +1 -0
  113. package/dist/react-simple-maps/src/components/useGeographies.d.ts +9 -0
  114. package/dist/react-simple-maps/src/components/useGeographies.d.ts.map +1 -0
  115. package/dist/react-simple-maps/src/components/useGeographies.js +40 -0
  116. package/dist/react-simple-maps/src/components/useGeographies.js.map +1 -0
  117. package/dist/react-simple-maps/src/components/useZoomPan.d.ts +15 -0
  118. package/dist/react-simple-maps/src/components/useZoomPan.d.ts.map +1 -0
  119. package/dist/react-simple-maps/src/components/useZoomPan.js +114 -0
  120. package/dist/react-simple-maps/src/components/useZoomPan.js.map +1 -0
  121. package/dist/react-simple-maps/src/index.d.ts +14 -0
  122. package/dist/react-simple-maps/src/index.d.ts.map +1 -0
  123. package/dist/react-simple-maps/src/index.js +14 -0
  124. package/dist/react-simple-maps/src/index.js.map +1 -0
  125. package/dist/react-simple-maps/src/utils.d.ts +18 -0
  126. package/dist/react-simple-maps/src/utils.d.ts.map +1 -0
  127. package/dist/react-simple-maps/src/utils.js +65 -0
  128. package/dist/react-simple-maps/src/utils.js.map +1 -0
  129. package/package.json +36 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Geographies.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Geographies.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAE7C,MAAM,WAAW,GAAG,UAAU,CAC5B,CACE,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,SAAS,EAAE,EACvE,GAAG,EACH,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA;IACnD,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC;QACvD,SAAS;QACT,gBAAgB;KACjB,CAAC,CAAA;IAEF,OAAO,CACL,2BAAG,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,mBAAmB,SAAS,EAAE,KAAM,SAAS,IAClE,WAAW;QACV,WAAW,CAAC,MAAM,GAAG,CAAC;QACtB,QAAQ,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAC7D,CACL,CAAA;AACH,CAAC,CACF,CAAA;AAED,WAAW,CAAC,WAAW,GAAG,aAAa,CAAA;AAEvC,WAAW,CAAC,SAAS,GAAG;IACtB,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC;QAC7B,SAAS,CAAC,MAAM;QAChB,SAAS,CAAC,MAAM;QAChB,SAAS,CAAC,KAAK;KAChB,CAAC;IACF,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,gBAAgB,EAAE,SAAS,CAAC,IAAI;IAChC,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -0,0 +1,3 @@
1
+ declare const _default: any;
2
+ export default _default;
3
+ //# sourceMappingURL=Geography.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Geography.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Geography.js"],"names":[],"mappings":""}
@@ -0,0 +1,59 @@
1
+ import React, { useState, memo, forwardRef } from "react";
2
+ import PropTypes from "prop-types";
3
+ const Geography = forwardRef(({ geography, onMouseEnter, onMouseLeave, onMouseDown, onMouseUp, onFocus, onBlur, style = {}, className = "", ...restProps }, ref) => {
4
+ const [isPressed, setPressed] = useState(false);
5
+ const [isFocused, setFocus] = useState(false);
6
+ function handleMouseEnter(evt) {
7
+ setFocus(true);
8
+ if (onMouseEnter)
9
+ onMouseEnter(evt);
10
+ }
11
+ function handleMouseLeave(evt) {
12
+ setFocus(false);
13
+ if (isPressed)
14
+ setPressed(false);
15
+ if (onMouseLeave)
16
+ onMouseLeave(evt);
17
+ }
18
+ function handleFocus(evt) {
19
+ setFocus(true);
20
+ if (onFocus)
21
+ onFocus(evt);
22
+ }
23
+ function handleBlur(evt) {
24
+ setFocus(false);
25
+ if (isPressed)
26
+ setPressed(false);
27
+ if (onBlur)
28
+ onBlur(evt);
29
+ }
30
+ function handleMouseDown(evt) {
31
+ setPressed(true);
32
+ if (onMouseDown)
33
+ onMouseDown(evt);
34
+ }
35
+ function handleMouseUp(evt) {
36
+ setPressed(false);
37
+ if (onMouseUp)
38
+ onMouseUp(evt);
39
+ }
40
+ return (React.createElement("path", { ref: ref, tabIndex: "0", className: `rsm-geography ${className}`, d: geography.svgPath, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onFocus: handleFocus, onBlur: handleBlur, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, style: style[isPressed || isFocused
41
+ ? isPressed
42
+ ? "pressed"
43
+ : "hover"
44
+ : "default"], ...restProps }));
45
+ });
46
+ Geography.displayName = "Geography";
47
+ Geography.propTypes = {
48
+ geography: PropTypes.object,
49
+ onMouseEnter: PropTypes.func,
50
+ onMouseLeave: PropTypes.func,
51
+ onMouseDown: PropTypes.func,
52
+ onMouseUp: PropTypes.func,
53
+ onFocus: PropTypes.func,
54
+ onBlur: PropTypes.func,
55
+ style: PropTypes.object,
56
+ className: PropTypes.string,
57
+ };
58
+ export default memo(Geography);
59
+ //# sourceMappingURL=Geography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Geography.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Geography.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC,MAAM,SAAS,GAAG,UAAU,CAC1B,CACE,EACE,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,GAAG,EAAE,EACV,SAAS,GAAG,EAAE,EACd,GAAG,SAAS,EACb,EACD,GAAG,EACH,EAAE;IACF,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/C,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE7C,SAAS,gBAAgB,CAAC,GAAG;QAC3B,QAAQ,CAAC,IAAI,CAAC,CAAA;QACd,IAAI,YAAY;YAAE,YAAY,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC;IAED,SAAS,gBAAgB,CAAC,GAAG;QAC3B,QAAQ,CAAC,KAAK,CAAC,CA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AAEnC,SAAS,CAAC,SAAS,GAAG;IACpB,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,SAAS,EAAE,SAAS,CAAC,IAAI;IACzB,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAA;AAED,eAAe,IAAI,CAAC,SAAS,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ declare const _default: any;
2
+ export default _default;
3
+ //# sourceMappingURL=Graticule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Graticule.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Graticule.js"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import React, { memo, useContext, forwardRef } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { geoGraticule } from "d3-geo";
4
+ import { MapContext } from "./MapProvider";
5
+ const Graticule = forwardRef(({ fill = "transparent", stroke = "currentcolor", step = [10, 10], className = "", ...restProps }, ref) => {
6
+ const { path } = useContext(MapContext);
7
+ return (React.createElement("path", { ref: ref, d: path(geoGraticule().step(step)()), fill: fill, stroke: stroke, className: `rsm-graticule ${className}`, ...restProps }));
8
+ });
9
+ Graticule.displayName = "Graticule";
10
+ Graticule.propTypes = {
11
+ fill: PropTypes.string,
12
+ stroke: PropTypes.string,
13
+ step: PropTypes.array,
14
+ className: PropTypes.string,
15
+ };
16
+ export default memo(Graticule);
17
+ //# sourceMappingURL=Graticule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Graticule.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Graticule.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAC3D,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,MAAM,SAAS,GAAG,UAAU,CAC1B,CACE,EACE,IAAI,GAAG,aAAa,EACpB,MAAM,GAAG,cAAc,EACvB,IAAI,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EACf,SAAS,GAAG,EAAE,EACd,GAAG,SAAS,EACb,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA;IACvC,OAAO,CACL,8BACE,GAAG,EAAE,GAAG,EACR,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,iBAAiB,SAAS,EAAE,KACnC,SAAS,GACb,CACH,CAAA;AACH,CAAC,CACF,CAAA;AAED,SAAS,CAAC,WAAW,GAAG,WAAW,CAAA;AAEnC,SAAS,CAAC,SAAS,GAAG;IACpB,IAAI,EAAE,SAAS,CAAC,MAAM;IACtB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,IAAI,EAAE,SAAS,CAAC,KAAK;IACrB,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAA;AAED,eAAe,IAAI,CAAC,SAAS,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export default Line;
2
+ declare const Line: any;
3
+ //# sourceMappingURL=Line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Line.js"],"names":[],"mappings":";AAKA,wBAiCC"}
@@ -0,0 +1,23 @@
1
+ import React, { useContext, forwardRef } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { MapContext } from "./MapProvider";
4
+ const Line = forwardRef(({ from = [0, 0], to = [0, 0], coordinates, stroke = "currentcolor", strokeWidth = 3, fill = "transparent", className = "", ...restProps }, ref) => {
5
+ const { path } = useContext(MapContext);
6
+ const lineData = {
7
+ type: "LineString",
8
+ coordinates: coordinates || [from, to],
9
+ };
10
+ return (React.createElement("path", { ref: ref, d: path(lineData), className: `rsm-line ${className}`, stroke: stroke, strokeWidth: strokeWidth, fill: fill, ...restProps }));
11
+ });
12
+ Line.displayName = "Line";
13
+ Line.propTypes = {
14
+ from: PropTypes.array,
15
+ to: PropTypes.array,
16
+ coordinates: PropTypes.array,
17
+ stroke: PropTypes.string,
18
+ strokeWidth: PropTypes.number,
19
+ fill: PropTypes.string,
20
+ className: PropTypes.string,
21
+ };
22
+ export default Line;
23
+ //# sourceMappingURL=Line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Line.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Line.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,MAAM,IAAI,GAAG,UAAU,CACrB,CACE,EACE,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACb,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACX,WAAW,EACX,MAAM,GAAG,cAAc,EACvB,WAAW,GAAG,CAAC,EACf,IAAI,GAAG,aAAa,EACpB,SAAS,GAAG,EAAE,EACd,GAAG,SAAS,EACb,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA;IAEvC,MAAM,QAAQ,GAAG;QACf,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,WAAW,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;KACvC,CAAA;IAED,OAAO,CACL,8BACE,GAAG,EAAE,GAAG,EACR,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,EACjB,SAAS,EAAE,YAAY,SAAS,EAAE,EAClC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,IAAI,KACN,SAAS,GACb,CACH,CAAA;AACH,CAAC,CACF,CAAA;AAED,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA;AAEzB,IAAI,CAAC,SAAS,GAAG;IACf,IAAI,EAAE,SAAS,CAAC,KAAK;IACrB,EAAE,EAAE,SAAS,CAAC,KAAK;IACnB,WAAW,EAAE,SAAS,CAAC,KAAK;IAC5B,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,WAAW,EAAE,SAAS,CAAC,MAAM;IAC7B,IAAI,EAAE,SAAS,CAAC,MAAM;IACtB,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,18 @@
1
+ export function MapProvider({ width, height, projection, projectionConfig, ...restProps }: {
2
+ [x: string]: any;
3
+ width: any;
4
+ height: any;
5
+ projection: any;
6
+ projectionConfig: any;
7
+ }): any;
8
+ export namespace MapProvider {
9
+ namespace propTypes {
10
+ let width: any;
11
+ let height: any;
12
+ let projection: any;
13
+ let projectionConfig: any;
14
+ }
15
+ }
16
+ export const MapContext: any;
17
+ export function useMapContext(): any;
18
+ //# sourceMappingURL=MapProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapProvider.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/MapProvider.js"],"names":[],"mappings":"AAmCA;;;;;;QAsCC;;;;;;;;;AAnED,6BAAkC;AA4ElC,qCAEC"}
@@ -0,0 +1,63 @@
1
+ import React, { createContext, useMemo, useCallback, useContext } from "react";
2
+ import PropTypes from "prop-types";
3
+ import * as d3Geo from "d3-geo";
4
+ const { geoPath, ...projections } = d3Geo;
5
+ const MapContext = createContext();
6
+ const makeProjection = ({ projectionConfig = {}, projection = "geoEqualEarth", width = 800, height = 600, }) => {
7
+ const isFunc = typeof projection === "function";
8
+ if (isFunc)
9
+ return projection;
10
+ let proj = projections[projection]().translate([width / 2, height / 2]);
11
+ const supported = [
12
+ proj.center ? "center" : null,
13
+ proj.rotate ? "rotate" : null,
14
+ proj.scale ? "scale" : null,
15
+ proj.parallels ? "parallels" : null,
16
+ ];
17
+ supported.forEach((d) => {
18
+ if (!d)
19
+ return;
20
+ proj = proj[d](projectionConfig[d] || proj[d]());
21
+ });
22
+ return proj;
23
+ };
24
+ const MapProvider = ({ width, height, projection, projectionConfig, ...restProps }) => {
25
+ const [cx, cy] = projectionConfig.center || [];
26
+ const [rx, ry, rz] = projectionConfig.rotate || [];
27
+ const [p1, p2] = projectionConfig.parallels || [];
28
+ const s = projectionConfig.scale || null;
29
+ const projMemo = useMemo(() => {
30
+ return makeProjection({
31
+ projectionConfig: {
32
+ center: cx || cx === 0 || cy || cy === 0 ? [cx, cy] : null,
33
+ rotate: rx || rx === 0 || ry || ry === 0 ? [rx, ry, rz] : null,
34
+ parallels: p1 || p1 === 0 || p2 || p2 === 0 ? [p1, p2] : null,
35
+ scale: s,
36
+ },
37
+ projection,
38
+ width,
39
+ height,
40
+ });
41
+ }, [width, height, projection, cx, cy, rx, ry, rz, p1, p2, s]);
42
+ const proj = useCallback(projMemo, [projMemo]);
43
+ const value = useMemo(() => {
44
+ return {
45
+ width,
46
+ height,
47
+ projection: proj,
48
+ path: geoPath().projection(proj),
49
+ };
50
+ }, [width, height, proj]);
51
+ return React.createElement(MapContext.Provider, { value: value, ...restProps });
52
+ };
53
+ MapProvider.propTypes = {
54
+ width: PropTypes.number,
55
+ height: PropTypes.number,
56
+ projection: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
57
+ projectionConfig: PropTypes.object,
58
+ };
59
+ const useMapContext = () => {
60
+ return useContext(MapContext);
61
+ };
62
+ export { MapProvider, MapContext, useMapContext };
63
+ //# sourceMappingURL=MapProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapProvider.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/MapProvider.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAA;AAE/B,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK,CAAA;AAEzC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;AAElC,MAAM,cAAc,GAAG,CAAC,EACtB,gBAAgB,GAAG,EAAE,EACrB,UAAU,GAAG,eAAe,EAC5B,KAAK,GAAG,GAAG,EACX,MAAM,GAAG,GAAG,GACb,EAAE,EAAE;IACH,MAAM,MAAM,GAAG,OAAO,UAAU,KAAK,UAAU,CAAA;IAE/C,IAAI,MAAM;QAAE,OAAO,UAAU,CAAA;IAE7B,IAAI,IAAI,GAAG,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAA;IAEvE,MAAM,SAAS,GAAG;QAChB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;QAC7B,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;QAC7B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;QAC3B,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;KACpC,CAAA;IAED,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACtB,IA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","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Marker.js"],"names":[],"mappings":";AAKA,0BAiFC"}
@@ -0,0 +1,66 @@
1
+ import React, { useContext, useState, forwardRef } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { MapContext } from "./MapProvider";
4
+ const Marker = forwardRef(({ coordinates, children, onMouseEnter, onMouseLeave, onMouseDown, onMouseUp, onFocus, onBlur, style = {}, className = "", ...restProps }, ref) => {
5
+ const { projection } = useContext(MapContext);
6
+ const [isPressed, setPressed] = useState(false);
7
+ const [isFocused, setFocus] = useState(false);
8
+ const [x, y] = projection(coordinates);
9
+ function handleMouseEnter(evt) {
10
+ setFocus(true);
11
+ if (onMouseEnter)
12
+ onMouseEnter(evt);
13
+ }
14
+ function handleMouseLeave(evt) {
15
+ setFocus(false);
16
+ if (isPressed)
17
+ setPressed(false);
18
+ if (onMouseLeave)
19
+ onMouseLeave(evt);
20
+ }
21
+ function handleFocus(evt) {
22
+ setFocus(true);
23
+ if (onFocus)
24
+ onFocus(evt);
25
+ }
26
+ function handleBlur(evt) {
27
+ setFocus(false);
28
+ if (isPressed)
29
+ setPressed(false);
30
+ if (onBlur)
31
+ onBlur(evt);
32
+ }
33
+ function handleMouseDown(evt) {
34
+ setPressed(true);
35
+ if (onMouseDown)
36
+ onMouseDown(evt);
37
+ }
38
+ function handleMouseUp(evt) {
39
+ setPressed(false);
40
+ if (onMouseUp)
41
+ onMouseUp(evt);
42
+ }
43
+ return (React.createElement("g", { ref: ref, transform: `translate(${x}, ${y})`, className: `rsm-marker ${className}`, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onFocus: handleFocus, onBlur: handleBlur, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, style: style[isPressed || isFocused
44
+ ? isPressed
45
+ ? "pressed"
46
+ : "hover"
47
+ : "default"], ...restProps }, children));
48
+ });
49
+ Marker.displayName = "Marker";
50
+ Marker.propTypes = {
51
+ coordinates: PropTypes.array,
52
+ children: PropTypes.oneOfType([
53
+ PropTypes.node,
54
+ PropTypes.arrayOf(PropTypes.node),
55
+ ]),
56
+ onMouseEnter: PropTypes.func,
57
+ onMouseLeave: PropTypes.func,
58
+ onMouseDown: PropTypes.func,
59
+ onMouseUp: PropTypes.func,
60
+ onFocus: PropTypes.func,
61
+ onBlur: PropTypes.func,
62
+ style: PropTypes.object,
63
+ className: PropTypes.string,
64
+ };
65
+ export default Marker;
66
+ //# sourceMappingURL=Marker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Marker.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAC/D,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,MAAM,MAAM,GAAG,UAAU,CACvB,CACE,EACE,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,GAAG,EAAE,EACV,SAAS,GAAG,EAAE,EACd,GAAG,SAAS,EACb,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA;IAC7C,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/C,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE7C,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IAEtC,SAAS,gBAAgB,CAAC,GAAG;QAC3B,QAAQ,CAAC,IAAI,CAAC,CAAA;QACd,IAAI,YAAY;YAAE,YAAY,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC;IAED,SA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CAAC,CACF,CAAA;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA;AAE7B,MAAM,CAAC,SAAS,GAAG;IACjB,WAAW,EAAE,SAAS,CAAC,KAAK;IAC5B,QAAQ,EAAE,SAAS,CAAC,SAAS,CAAC;QAC5B,SAAS,CAAC,IAAI;QACd,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;KAClC,CAAC;IACF,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,SAAS,EAAE,SAAS,CAAC,IAAI;IACzB,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAA;AAED,eAAe,MAAM,CAAA"}
@@ -0,0 +1,3 @@
1
+ declare const _default: any;
2
+ export default _default;
3
+ //# sourceMappingURL=Sphere.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sphere.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Sphere.js"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import React, { Fragment, memo, useMemo, useContext, forwardRef } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { MapContext } from "./MapProvider";
4
+ const Sphere = forwardRef(({ id = "rsm-sphere", fill = "transparent", stroke = "currentcolor", strokeWidth = 0.5, className = "", ...restProps }, ref) => {
5
+ const { path } = useContext(MapContext);
6
+ const spherePath = useMemo(() => path({ type: "Sphere" }), [path]);
7
+ return (React.createElement(Fragment, null,
8
+ React.createElement("defs", null,
9
+ React.createElement("clipPath", { id: id },
10
+ React.createElement("path", { d: spherePath }))),
11
+ React.createElement("path", { ref: ref, d: spherePath, fill: fill, stroke: stroke, strokeWidth: strokeWidth, style: { pointerEvents: "none" }, className: `rsm-sphere ${className}`, ...restProps })));
12
+ });
13
+ Sphere.displayName = "Sphere";
14
+ Sphere.propTypes = {
15
+ id: PropTypes.string,
16
+ fill: PropTypes.string,
17
+ stroke: PropTypes.string,
18
+ strokeWidth: PropTypes.number,
19
+ className: PropTypes.string,
20
+ };
21
+ export default memo(Sphere);
22
+ //# sourceMappingURL=Sphere.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sphere.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/Sphere.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,MAAM,MAAM,GAAG,UAAU,CACvB,CACE,EACE,EAAE,GAAG,YAAY,EACjB,IAAI,GAAG,aAAa,EACpB,MAAM,GAAG,cAAc,EACvB,WAAW,GAAG,GAAG,EACjB,SAAS,GAAG,EAAE,EACd,GAAG,SAAS,EACb,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA;IACvC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAClE,OAAO,CACL,oBAAC,QAAQ;QACP;YACE,kCAAU,EAAE,EAAE,EAAE;gBACd,8BAAM,CAAC,EAAE,UAAU,GAAI,CACd,CACN;QACP,8BACE,GAAG,EAAE,GAAG,EACR,CAAC,EAAE,UAAU,EACb,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAChC,SAAS,EAAE,cAAc,SAAS,EAAE,KAChC,SAAS,GACb,CACO,CACZ,CAAA;AACH,CAAC,CACF,CAAA;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA;AAE7B,MAAM,CAAC,SAAS,GAAG;IACjB,EAAE,EAAE,SAAS,CAAC,MAAM;IACpB,IAAI,EAAE,SAAS,CAAC,MAAM;IACtB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,WAAW,EAAE,SAAS,CAAC,MAAM;IAC7B,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAA;AAED,eAAe,IAAI,CAAC,MAAM,CAAC,CAAA"}
@@ -0,0 +1,20 @@
1
+ export const ZoomPanContext: any;
2
+ export function ZoomPanProvider({ value, ...restProps }: {
3
+ [x: string]: any;
4
+ value?: {
5
+ x: number;
6
+ y: number;
7
+ k: number;
8
+ transformString: string;
9
+ } | undefined;
10
+ }): any;
11
+ export namespace ZoomPanProvider {
12
+ namespace propTypes {
13
+ let x: any;
14
+ let y: any;
15
+ let k: any;
16
+ let transformString: any;
17
+ }
18
+ }
19
+ export function useZoomPanContext(): any;
20
+ //# sourceMappingURL=ZoomPanProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZoomPanProvider.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/ZoomPanProvider.js"],"names":[],"mappings":"AAGA,iCAAsC;AAStC;;;;;;;;QAEC;;;;;;;;;AASD,yCAEC"}
@@ -0,0 +1,23 @@
1
+ import React, { createContext, useContext } from "react";
2
+ import PropTypes from "prop-types";
3
+ const ZoomPanContext = createContext();
4
+ const defaultValue = {
5
+ x: 0,
6
+ y: 0,
7
+ k: 1,
8
+ transformString: "translate(0 0) scale(1)",
9
+ };
10
+ const ZoomPanProvider = ({ value = defaultValue, ...restProps }) => {
11
+ return React.createElement(ZoomPanContext.Provider, { value: value, ...restProps });
12
+ };
13
+ ZoomPanProvider.propTypes = {
14
+ x: PropTypes.number,
15
+ y: PropTypes.number,
16
+ k: PropTypes.number,
17
+ transformString: PropTypes.string,
18
+ };
19
+ const useZoomPanContext = () => {
20
+ return useContext(ZoomPanContext);
21
+ };
22
+ export { ZoomPanContext, ZoomPanProvider, useZoomPanContext };
23
+ //# sourceMappingURL=ZoomPanProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZoomPanProvider.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/ZoomPanProvider.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,SAAS,MAAM,YAAY,CAAA;AAElC,MAAM,cAAc,GAAG,aAAa,EAAE,CAAA;AAEtC,MAAM,YAAY,GAAG;IACnB,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,eAAe,EAAE,yBAAyB;CAC3C,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,EAAE,KAAK,GAAG,YAAY,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE;IACjE,OAAO,oBAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,KAAM,SAAS,GAAI,CAAA;AACjE,CAAC,CAAA;AAED,eAAe,CAAC,SAAS,GAAG;IAC1B,CAAC,EAAE,SAAS,CAAC,MAAM;IACnB,CAAC,EAAE,SAAS,CAAC,MAAM;IACnB,CAAC,EAAE,SAAS,CAAC,MAAM;IACnB,eAAe,EAAE,SAAS,CAAC,MAAM;CAClC,CAAA;AAED,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC7B,OAAO,UAAU,CAAC,cAAc,CAAC,CAAA;AACnC,CAAC,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,3 @@
1
+ export default ZoomableGroup;
2
+ declare const ZoomableGroup: any;
3
+ //# sourceMappingURL=ZoomableGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZoomableGroup.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/ZoomableGroup.js"],"names":[],"mappings":";AAOA,iCA8CC"}
@@ -0,0 +1,36 @@
1
+ import React, { useContext, forwardRef } from "react";
2
+ import PropTypes from "prop-types";
3
+ import { MapContext } from "./MapProvider";
4
+ import { ZoomPanProvider } from "./ZoomPanProvider";
5
+ import useZoomPan from "./useZoomPan";
6
+ const ZoomableGroup = forwardRef(({ center = [0, 0], zoom = 1, minZoom = 1, maxZoom = 8, translateExtent, filterZoomEvent, onMoveStart, onMove, onMoveEnd, className, ...restProps }, ref) => {
7
+ const { width, height } = useContext(MapContext);
8
+ const { mapRef, transformString, position } = useZoomPan({
9
+ center,
10
+ filterZoomEvent,
11
+ onMoveStart,
12
+ onMove,
13
+ onMoveEnd,
14
+ scaleExtent: [minZoom, maxZoom],
15
+ translateExtent,
16
+ zoom,
17
+ });
18
+ return (React.createElement(ZoomPanProvider, { value: { x: position.x, y: position.y, k: position.k, transformString } },
19
+ React.createElement("g", { ref: mapRef },
20
+ React.createElement("rect", { width: width, height: height, fill: "transparent" }),
21
+ React.createElement("g", { ref: ref, transform: transformString, className: `rsm-zoomable-group ${className}`, ...restProps }))));
22
+ });
23
+ ZoomableGroup.displayName = "ZoomableGroup";
24
+ ZoomableGroup.propTypes = {
25
+ center: PropTypes.array,
26
+ zoom: PropTypes.number,
27
+ minZoom: PropTypes.number,
28
+ maxZoom: PropTypes.number,
29
+ translateExtent: PropTypes.arrayOf(PropTypes.array),
30
+ onMoveStart: PropTypes.func,
31
+ onMove: PropTypes.func,
32
+ onMoveEnd: PropTypes.func,
33
+ className: PropTypes.string,
34
+ };
35
+ export default ZoomableGroup;
36
+ //# sourceMappingURL=ZoomableGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZoomableGroup.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/ZoomableGroup.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,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A;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAA;AAE3C,aAAa,CAAC,SAAS,GAAG;IACxB,MAAM,EAAE,SAAS,CAAC,KAAK;IACvB,IAAI,EAAE,SAAS,CAAC,MAAM;IACtB,OAAO,EAAE,SAAS,CAAC,MAAM;IACzB,OAAO,EAAE,SAAS,CAAC,MAAM;IACzB,eAAe,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC;IACnD,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,SAAS,EAAE,SAAS,CAAC,IAAI;IACzB,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -0,0 +1,9 @@
1
+ export default function useGeographies({ geography, parseGeographies }: {
2
+ geography: any;
3
+ parseGeographies: any;
4
+ }): {
5
+ geographies: any;
6
+ outline: any;
7
+ borders: any;
8
+ };
9
+ //# sourceMappingURL=useGeographies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGeographies.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/useGeographies.js"],"names":[],"mappings":"AAYA;;;;;;;EAqCC"}
@@ -0,0 +1,40 @@
1
+ import { useMemo, useState, useEffect, useContext } from "react";
2
+ import { MapContext } from "./MapProvider";
3
+ import { fetchGeographies, getFeatures, getMesh, prepareFeatures, isString, prepareMesh, } from "../utils";
4
+ export default function useGeographies({ geography, parseGeographies }) {
5
+ const { path } = useContext(MapContext);
6
+ const [output, setOutput] = useState({});
7
+ useEffect(() => {
8
+ if (typeof window === `undefined`)
9
+ return;
10
+ if (!geography)
11
+ return;
12
+ if (isString(geography)) {
13
+ fetchGeographies(geography).then((geos) => {
14
+ if (geos) {
15
+ setOutput({
16
+ geographies: getFeatures(geos, parseGeographies),
17
+ mesh: getMesh(geos),
18
+ });
19
+ }
20
+ });
21
+ }
22
+ else {
23
+ setOutput({
24
+ geographies: getFeatures(geography, parseGeographies),
25
+ mesh: getMesh(geography),
26
+ });
27
+ }
28
+ }, [geography, parseGeographies]);
29
+ const { geographies, outline, borders } = useMemo(() => {
30
+ const mesh = output.mesh || {};
31
+ const preparedMesh = prepareMesh(mesh.outline, mesh.borders, path);
32
+ return {
33
+ geographies: prepareFeatures(output.geographies, path),
34
+ outline: preparedMesh.outline,
35
+ borders: preparedMesh.borders,
36
+ };
37
+ }, [output, path]);
38
+ return { geographies, outline, borders };
39
+ }
40
+ //# sourceMappingURL=useGeographies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGeographies.js","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/useGeographies.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,eAAe,EACf,QAAQ,EACR,WAAW,GACZ,MAAM,UAAU,CAAA;AAEjB,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;IACpE,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAA;IACvC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IAExC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAM;QAEzC,IAAI,CAAC,SAAS;YAAE,OAAM;QAEtB,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACxB,gBAAgB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBACxC,IAAI,IAAI,EAAE,CAAC;oBACT,SAAS,CAAC;wBACR,WAAW,EAAE,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC;wBAChD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;qBACpB,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,SAAS,CAAC;gBACR,WAAW,EAAE,WAAW,CAAC,SAAS,EAAE,gBAAgB,CAAC;gBACrD,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC;aACzB,CAAC,CAAA;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAA;IAEjC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;QACrD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAA;QAC9B,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QAClE,OAAO;YACL,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC;YACtD,OAAO,EAAE,YAAY,CAAC,OAAO;YAC7B,OAAO,EAAE,YAAY,CAAC,OAAO;SAC9B,CAAA;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;IAElB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AAC1C,CAAC"}
@@ -0,0 +1,15 @@
1
+ export default function useZoomPan({ center, filterZoomEvent, onMoveStart, onMoveEnd, onMove, translateExtent, scaleExtent, zoom, }: {
2
+ center: any;
3
+ filterZoomEvent: any;
4
+ onMoveStart: any;
5
+ onMoveEnd: any;
6
+ onMove: any;
7
+ translateExtent?: number[][] | undefined;
8
+ scaleExtent?: number[] | undefined;
9
+ zoom?: number | undefined;
10
+ }): {
11
+ mapRef: any;
12
+ position: any;
13
+ transformString: string;
14
+ };
15
+ //# sourceMappingURL=useZoomPan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useZoomPan.d.ts","sourceRoot":"","sources":["../../../../src/react-simple-maps/src/components/useZoomPan.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;EA8IC"}