@undp/data-viz 1.4.1 → 1.4.3

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 (210) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.js +21 -21
  3. package/dist/BarGraph.cjs +1 -1
  4. package/dist/BarGraph.js +7 -7
  5. package/dist/BeeSwarmChart.cjs +1 -1
  6. package/dist/BeeSwarmChart.js +2 -2
  7. package/dist/BiVariateChoroplethMap.cjs +1 -1
  8. package/dist/BiVariateChoroplethMap.js +5 -5
  9. package/dist/BulletChart.cjs +1 -1
  10. package/dist/BulletChart.js +14 -14
  11. package/dist/ButterflyChart.cjs +1 -1
  12. package/dist/ButterflyChart.js +9 -9
  13. package/dist/ChoroplethMap.cjs +1 -1
  14. package/dist/ChoroplethMap.js +9 -9
  15. package/dist/CirclePackingGraph.cjs +1 -1
  16. package/dist/CirclePackingGraph.js +1 -1
  17. package/dist/CopyTextButton.cjs +7 -7
  18. package/dist/CopyTextButton.cjs.map +1 -1
  19. package/dist/CopyTextButton.js +4 -4
  20. package/dist/CopyTextButton.js.map +1 -1
  21. package/dist/DataCards.cjs +9 -9
  22. package/dist/DataCards.cjs.map +1 -1
  23. package/dist/DataCards.js +93 -93
  24. package/dist/DataCards.js.map +1 -1
  25. package/dist/DifferenceLineChart.cjs +1 -1
  26. package/dist/DifferenceLineChart.js +18 -18
  27. package/dist/DonutChart.cjs +1 -1
  28. package/dist/DonutChart.js +1 -1
  29. package/dist/DotDensityMap.cjs +1 -1
  30. package/dist/DotDensityMap.js +8 -8
  31. package/dist/{DropdownSelect-0I2QxaVy.cjs → DropdownSelect-BmE5JaeE.cjs} +6 -6
  32. package/dist/{DropdownSelect-0I2QxaVy.cjs.map → DropdownSelect-BmE5JaeE.cjs.map} +1 -1
  33. package/dist/{DropdownSelect-CDC9lEqU.js → DropdownSelect-CeHog_ih.js} +4 -4
  34. package/dist/{DropdownSelect-CDC9lEqU.js.map → DropdownSelect-CeHog_ih.js.map} +1 -1
  35. package/dist/DualAxisLineChart.cjs +1 -1
  36. package/dist/DualAxisLineChart.js +15 -15
  37. package/dist/DumbbellChart.cjs +1 -1
  38. package/dist/DumbbellChart.js +13 -13
  39. package/dist/GeoHubMap.cjs +1 -1
  40. package/dist/GeoHubMap.js +2 -2
  41. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  42. package/dist/GeoHubMapWithLayerSelection.js +2 -2
  43. package/dist/{GraphEl-B6SoGRFW.cjs → GraphEl-B5gAX1IQ.cjs} +2 -2
  44. package/dist/{GraphEl-B6SoGRFW.cjs.map → GraphEl-B5gAX1IQ.cjs.map} +1 -1
  45. package/dist/{GraphEl-Cw2tDUb3.js → GraphEl-BdIyscdt.js} +3 -3
  46. package/dist/{GraphEl-Cw2tDUb3.js.map → GraphEl-BdIyscdt.js.map} +1 -1
  47. package/dist/GriddedGraphs.cjs +1 -1
  48. package/dist/GriddedGraphs.d.ts +4 -7
  49. package/dist/GriddedGraphs.js +4 -4
  50. package/dist/GriddedGraphsFromConfig.cjs +1 -1
  51. package/dist/GriddedGraphsFromConfig.d.ts +4 -7
  52. package/dist/GriddedGraphsFromConfig.js +1 -1
  53. package/dist/HeatMap.cjs +1 -1
  54. package/dist/HeatMap.js +10 -10
  55. package/dist/Histogram.cjs +1 -1
  56. package/dist/Histogram.js +1 -1
  57. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  58. package/dist/LineChartWithConfidenceInterval.js +21 -21
  59. package/dist/{Modal-CUU6ZK3U.js → Modal-DVVwpKhP.js} +2 -2
  60. package/dist/{Modal-CUU6ZK3U.js.map → Modal-DVVwpKhP.js.map} +1 -1
  61. package/dist/{Modal-C_dl0EtQ.cjs → Modal-tXZlLE5s.cjs} +4 -4
  62. package/dist/{Modal-C_dl0EtQ.cjs.map → Modal-tXZlLE5s.cjs.map} +1 -1
  63. package/dist/MultiGraphDashboard.cjs +1 -1
  64. package/dist/MultiGraphDashboard.d.ts +4 -7
  65. package/dist/MultiGraphDashboard.js +3 -3
  66. package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
  67. package/dist/MultiGraphDashboardFromConfig.d.ts +4 -7
  68. package/dist/MultiGraphDashboardFromConfig.js +1 -1
  69. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  70. package/dist/MultiGraphDashboardWideToLongFormat.js +3 -3
  71. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
  72. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
  73. package/dist/MultiLineAltChart.cjs +1 -1
  74. package/dist/MultiLineAltChart.js +21 -21
  75. package/dist/MultiLineChart.cjs +1 -1
  76. package/dist/MultiLineChart.js +19 -19
  77. package/dist/ParetoChart.cjs +1 -1
  78. package/dist/ParetoChart.js +12 -12
  79. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  80. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +4 -7
  81. package/dist/PerformanceIntensiveMultiGraphDashboard.js +3 -3
  82. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
  83. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +4 -7
  84. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
  85. package/dist/PerformanceIntensiveScrollStory.cjs +1 -1
  86. package/dist/PerformanceIntensiveScrollStory.d.ts +4 -7
  87. package/dist/PerformanceIntensiveScrollStory.js +2 -2
  88. package/dist/RadarChart.cjs +1 -1
  89. package/dist/RadarChart.js +8 -8
  90. package/dist/{ReferenceLine-CuFMk0cI.cjs → ReferenceLine-CFVBBN__.cjs} +2 -2
  91. package/dist/{ReferenceLine-CuFMk0cI.cjs.map → ReferenceLine-CFVBBN__.cjs.map} +1 -1
  92. package/dist/{ReferenceLine-C1GpoG9d.js → ReferenceLine-CfAW3vKJ.js} +2 -2
  93. package/dist/{ReferenceLine-C1GpoG9d.js.map → ReferenceLine-CfAW3vKJ.js.map} +1 -1
  94. package/dist/{RegressionLine-BFwDCTUU.js → RegressionLine-mH7UKOPi.js} +3 -3
  95. package/dist/{RegressionLine-BFwDCTUU.js.map → RegressionLine-mH7UKOPi.js.map} +1 -1
  96. package/dist/{RegressionLine-7_rKTHN_.cjs → RegressionLine-xKdiJ8sw.cjs} +2 -2
  97. package/dist/{RegressionLine-7_rKTHN_.cjs.map → RegressionLine-xKdiJ8sw.cjs.map} +1 -1
  98. package/dist/SankeyChart.cjs +1 -1
  99. package/dist/SankeyChart.js +4 -4
  100. package/dist/ScatterPlot.cjs +1 -1
  101. package/dist/ScatterPlot.js +13 -13
  102. package/dist/ScrollStory.cjs +1 -1
  103. package/dist/ScrollStory.d.ts +4 -7
  104. package/dist/ScrollStory.js +2 -2
  105. package/dist/SimpleLineChart.cjs +1 -1
  106. package/dist/SimpleLineChart.js +20 -20
  107. package/dist/SingleGraphDashboard.cjs +1 -1
  108. package/dist/SingleGraphDashboard.d.ts +4 -7
  109. package/dist/SingleGraphDashboard.js +4 -4
  110. package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
  111. package/dist/SingleGraphDashboardFromConfig.d.ts +4 -7
  112. package/dist/SingleGraphDashboardFromConfig.js +1 -1
  113. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +4 -7
  114. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
  115. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +4 -7
  116. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
  117. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  118. package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
  119. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +4 -7
  120. package/dist/SingleGraphDashboardThreeDGraphs.js +30 -27
  121. package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
  122. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
  123. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +4 -7
  124. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
  125. package/dist/SlopeChart.cjs +1 -1
  126. package/dist/SlopeChart.js +7 -7
  127. package/dist/StripChart.cjs +1 -1
  128. package/dist/StripChart.js +9 -9
  129. package/dist/ThreeDGlobe.cjs +1 -1
  130. package/dist/ThreeDGlobe.cjs.map +1 -1
  131. package/dist/ThreeDGlobe.d.ts +11 -2
  132. package/dist/ThreeDGlobe.js +278 -253
  133. package/dist/ThreeDGlobe.js.map +1 -1
  134. package/dist/TreeMapGraph.cjs +1 -1
  135. package/dist/TreeMapGraph.js +4 -4
  136. package/dist/Types.d.ts +4 -7
  137. package/dist/UnitChart.cjs +1 -1
  138. package/dist/UnitChart.js +3 -3
  139. package/dist/{XAxesLabels-DQFo_z2R.js → XAxesLabels-CaV2q-6H.js} +2 -2
  140. package/dist/{XAxesLabels-DQFo_z2R.js.map → XAxesLabels-CaV2q-6H.js.map} +1 -1
  141. package/dist/{XAxesLabels-CJMQbfVy.cjs → XAxesLabels-OjBNl_lS.cjs} +2 -2
  142. package/dist/{XAxesLabels-CJMQbfVy.cjs.map → XAxesLabels-OjBNl_lS.cjs.map} +1 -1
  143. package/dist/{YAxesLabels-H5-002X5.js → YAxesLabels-CPGZjmZJ.js} +2 -2
  144. package/dist/{YAxesLabels-H5-002X5.js.map → YAxesLabels-CPGZjmZJ.js.map} +1 -1
  145. package/dist/{YAxesLabels-BXLTX7AI.cjs → YAxesLabels-D8IydyZj.cjs} +2 -2
  146. package/dist/{YAxesLabels-BXLTX7AI.cjs.map → YAxesLabels-D8IydyZj.cjs.map} +1 -1
  147. package/dist/{checkIfMultiple-Do4kADNr.cjs → checkIfMultiple-BXbHUCWM.cjs} +6 -6
  148. package/dist/{checkIfMultiple-Do4kADNr.cjs.map → checkIfMultiple-BXbHUCWM.cjs.map} +1 -1
  149. package/dist/{checkIfMultiple-CYp3vADF.js → checkIfMultiple-ChTJk2Tk.js} +5 -5
  150. package/dist/{checkIfMultiple-CYp3vADF.js.map → checkIfMultiple-ChTJk2Tk.js.map} +1 -1
  151. package/dist/{customArea-CaxScFmW.js → customArea-B-dWU0zZ.js} +2 -2
  152. package/dist/{customArea-CaxScFmW.js.map → customArea-B-dWU0zZ.js.map} +1 -1
  153. package/dist/{customArea-BYNyxAkm.cjs → customArea-CK768gCn.cjs} +2 -2
  154. package/dist/{customArea-BYNyxAkm.cjs.map → customArea-CK768gCn.cjs.map} +1 -1
  155. package/dist/{fetchAndParseData-Bcmr659B.js → fetchAndParseData-4gsYTy6_.js} +3 -3
  156. package/dist/fetchAndParseData-4gsYTy6_.js.map +1 -0
  157. package/dist/{fetchAndParseData-DmgQtB9n.cjs → fetchAndParseData-CQyVGCul.cjs} +6 -6
  158. package/dist/fetchAndParseData-CQyVGCul.cjs.map +1 -0
  159. package/dist/fetchAndParseData.cjs +1 -1
  160. package/dist/fetchAndParseData.js +1 -1
  161. package/dist/index-BW8iNx7E.cjs +10 -0
  162. package/dist/index-BW8iNx7E.cjs.map +1 -0
  163. package/dist/index-CNvov0eg.js +122 -0
  164. package/dist/index-CNvov0eg.js.map +1 -0
  165. package/dist/{index-D_n8aamX.cjs → index-CZLvTu6p.cjs} +2 -2
  166. package/dist/{index-D_n8aamX.cjs.map → index-CZLvTu6p.cjs.map} +1 -1
  167. package/dist/{index-n_RI8T0n.js → index-Cdcfp4nk.js} +2 -2
  168. package/dist/{index-n_RI8T0n.js.map → index-Cdcfp4nk.js.map} +1 -1
  169. package/dist/{index-BVnYktl4.js → index-DGAaLNu9.js} +2 -2
  170. package/dist/{index-BVnYktl4.js.map → index-DGAaLNu9.js.map} +1 -1
  171. package/dist/{index-CylX-pWB.cjs → index-DNj994Pv.cjs} +2 -2
  172. package/dist/{index-CylX-pWB.cjs.map → index-DNj994Pv.cjs.map} +1 -1
  173. package/dist/index.cjs +1 -1
  174. package/dist/index.d.ts +15 -9
  175. package/dist/index.js +3 -3
  176. package/dist/proxy-BHRoeZgd.cjs +2 -0
  177. package/dist/proxy-BHRoeZgd.cjs.map +1 -0
  178. package/dist/{proxy-DJxJg1kD.js → proxy-CkpFesk1.js} +4123 -4075
  179. package/dist/proxy-CkpFesk1.js.map +1 -0
  180. package/dist/style.css +1 -1
  181. package/dist/transformData.cjs +1 -1
  182. package/dist/transformData.js +2 -2
  183. package/dist/{transformDataForGraphFromFile-D9G3ToQf.cjs → transformDataForGraphFromFile-B1A0AS-Z.cjs} +2 -2
  184. package/dist/{transformDataForGraphFromFile-D9G3ToQf.cjs.map → transformDataForGraphFromFile-B1A0AS-Z.cjs.map} +1 -1
  185. package/dist/{transformDataForGraphFromFile-CA0rw80A.js → transformDataForGraphFromFile-BCjsizvb.js} +2 -2
  186. package/dist/{transformDataForGraphFromFile-CA0rw80A.js.map → transformDataForGraphFromFile-BCjsizvb.js.map} +1 -1
  187. package/dist/{use-in-view-BCmzDU2O.cjs → use-in-view-sQJZ_xDO.cjs} +2 -2
  188. package/dist/use-in-view-sQJZ_xDO.cjs.map +1 -0
  189. package/dist/{use-in-view-BAHrBy6b.js → use-in-view-yS6jzJAp.js} +2 -2
  190. package/dist/use-in-view-yS6jzJAp.js.map +1 -0
  191. package/dist/x-BBpi7a_7-Dz2vKSfu.cjs +27 -0
  192. package/dist/x-BBpi7a_7-Dz2vKSfu.cjs.map +1 -0
  193. package/dist/x-BBpi7a_7-WVdj1j6r.js +106 -0
  194. package/dist/x-BBpi7a_7-WVdj1j6r.js.map +1 -0
  195. package/package.json +50 -51
  196. package/dist/fetchAndParseData-Bcmr659B.js.map +0 -1
  197. package/dist/fetchAndParseData-DmgQtB9n.cjs.map +0 -1
  198. package/dist/index-BxAUvrua.js +0 -120
  199. package/dist/index-BxAUvrua.js.map +0 -1
  200. package/dist/index-DVOJ7vxH.cjs +0 -10
  201. package/dist/index-DVOJ7vxH.cjs.map +0 -1
  202. package/dist/proxy-DJxJg1kD.js.map +0 -1
  203. package/dist/proxy-PQd2AItT.cjs +0 -2
  204. package/dist/proxy-PQd2AItT.cjs.map +0 -1
  205. package/dist/use-in-view-BAHrBy6b.js.map +0 -1
  206. package/dist/use-in-view-BCmzDU2O.cjs.map +0 -1
  207. package/dist/x-CnsEH4Ox-CGGXQl4M.cjs +0 -27
  208. package/dist/x-CnsEH4Ox-CGGXQl4M.cjs.map +0 -1
  209. package/dist/x-CnsEH4Ox-DDvAJndW.js +0 -101
  210. package/dist/x-CnsEH4Ox-DDvAJndW.js.map +0 -1
@@ -3,16 +3,16 @@ import { u as gi } from "./index-CaAIPGZo.js";
3
3
  import { useRef as si, useState as E, useEffect as ui } from "react";
4
4
  import { i as pi } from "./index-27yTRcko.js";
5
5
  import { s as mi } from "./index-DxagiOHo.js";
6
- import { X as xi } from "./Modal-CUU6ZK3U.js";
6
+ import { X as xi } from "./Modal-DVVwpKhP.js";
7
7
  import { T as yi } from "./Tooltip-DyM5snqx.js";
8
8
  import { c as J } from "./checkIfNullOrUndefined-DmfiKkNw.js";
9
9
  import { n as di } from "./numberFormattingFunction-14YCbkN2.js";
10
10
  import { Colors as c } from "./Colors.js";
11
11
  import { s as vi } from "./string2HTML-CWHGfz_d.js";
12
- import { u as wi } from "./use-in-view-BAHrBy6b.js";
13
- import { a as Oi } from "./linear-DUdu7l2G.js";
14
- import { m as ai } from "./proxy-DJxJg1kD.js";
15
- import { A as bi } from "./index-BxAUvrua.js";
12
+ import { a as wi } from "./linear-DUdu7l2G.js";
13
+ import { u as Oi } from "./use-in-view-yS6jzJAp.js";
14
+ import { m as ai } from "./proxy-CkpFesk1.js";
15
+ import { A as bi } from "./index-CNvov0eg.js";
16
16
  import { GraphFooter as Ci } from "./GraphFooter.js";
17
17
  import { GraphHeader as ji } from "./GraphHeader.js";
18
18
  import { ColorLegendWithMouseOver as Mi } from "./ColorLegendWithMouseOver.js";
@@ -56,7 +56,7 @@ function Vi(P) {
56
56
  dimmedOpacity: T,
57
57
  precision: B,
58
58
  customLayers: M
59
- } = P, q = si(null), D = wi(q, {
59
+ } = P, q = si(null), D = Oi(q, {
60
60
  once: m.once,
61
61
  amount: m.amount
62
62
  }), [H, x] = E(void 0), [f, A] = E(void 0), [U, L] = E(void 0), [u, g] = E(void 0), O = {
@@ -67,7 +67,7 @@ function Vi(P) {
67
67
  }, V = d - O.left - O.right, W = p - O.top - O.bottom, oi = o.map((i, t) => ({ ...i, id: `${t}` })), ei = mi(oi, (i) => {
68
68
  const t = (a || []).indexOf(i.label);
69
69
  return t === -1 ? 1 / 0 : t;
70
- }).reverse(), ri = J(_) ? Math.max(...o.filter((i) => !J(i.position)).map((i) => i.position)) < 0 ? 0 : Math.max(...o.filter((i) => !J(i.position)).map((i) => i.position)) : _, C = J(G) ? Math.min(...o.filter((i) => !J(i.position)).map((i) => i.position)) >= 0 ? 0 : Math.min(...o.filter((i) => !J(i.position)).map((i) => i.position)) : G, z = Oi().domain([C, ri]).range([0, V]).nice(), li = Ni(w, V);
70
+ }).reverse(), ri = J(_) ? Math.max(...o.filter((i) => !J(i.position)).map((i) => i.position)) < 0 ? 0 : Math.max(...o.filter((i) => !J(i.position)).map((i) => i.position)) : _, C = J(G) ? Math.min(...o.filter((i) => !J(i.position)).map((i) => i.position)) >= 0 ? 0 : Math.min(...o.filter((i) => !J(i.position)).map((i) => i.position)) : G, z = wi().domain([C, ri]).range([0, V]).nice(), li = Ni(w, V);
71
71
  return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
72
72
  /* @__PURE__ */ r.jsx(
73
73
  ai.svg,
@@ -458,7 +458,7 @@ function Si(P) {
458
458
  dimmedOpacity: T,
459
459
  precision: B,
460
460
  customLayers: M
461
- } = P, q = si(null), D = wi(q, {
461
+ } = P, q = si(null), D = Oi(q, {
462
462
  once: w.once,
463
463
  amount: w.amount
464
464
  }), [H, x] = E(void 0), [f, A] = E(void 0), [U, L] = E(void 0), [u, g] = E(void 0), O = {
@@ -469,7 +469,7 @@ function Si(P) {
469
469
  }, V = d - O.left - O.right, W = p - O.top - O.bottom, oi = o.map((i, t) => ({ ...i, id: `${t}` })), ei = mi(oi, (i) => {
470
470
  const t = (a || []).indexOf(i.label);
471
471
  return t === -1 ? 1 / 0 : t;
472
- }).reverse(), ri = J(_) ? Math.max(...o.filter((i) => !J(i.position)).map((i) => i.position)) < 0 ? 0 : Math.max(...o.filter((i) => !J(i.position)).map((i) => i.position)) : _, C = J(G) ? Math.min(...o.filter((i) => !J(i.position)).map((i) => i.position)) >= 0 ? 0 : Math.min(...o.filter((i) => !J(i.position)).map((i) => i.position)) : G, z = Oi().domain([C, ri]).range([W, 0]).nice(), li = Ni(K, W);
472
+ }).reverse(), ri = J(_) ? Math.max(...o.filter((i) => !J(i.position)).map((i) => i.position)) < 0 ? 0 : Math.max(...o.filter((i) => !J(i.position)).map((i) => i.position)) : _, C = J(G) ? Math.min(...o.filter((i) => !J(i.position)).map((i) => i.position)) >= 0 ? 0 : Math.min(...o.filter((i) => !J(i.position)).map((i) => i.position)) : G, z = wi().domain([C, ri]).range([W, 0]).nice(), li = Ni(K, W);
473
473
  return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
474
474
  /* @__PURE__ */ r.jsx(
475
475
  ai.svg,
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),c=require("react"),le=require("./Spinner-DA6Z5E4n.cjs"),ce=require("react-globe.gl"),ue=require("./index-BXns0-ng.cjs"),de=require("three"),pe=require("./Modal-C_dl0EtQ.cjs"),ie=require("./Typography-k-kOjICQ.cjs"),ge=require("./Tooltip-n8z5bfav.cjs"),me=require("./numberFormattingFunction-02t-wJta.cjs"),he=require("./index-BW_-wD2k.cjs"),xe=require("./string2HTML-D2Avudmb.cjs"),fe=require("./ordinal-BOeNbyae.cjs"),ye=require("./threshold-DNsSUf8Q.cjs"),je=require("./GraphHeader.cjs"),ve=require("./GraphFooter.cjs"),be=require("./fetchAndParseData-DmgQtB9n.cjs"),N=require("./Colors.cjs"),Ee=require("./getUniqValue-CHqgSss5.cjs"),Re=require("./getJenks-TWQvbuOz.cjs");function Ce(f){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const i in f)if(i!=="default"){const p=Object.getOwnPropertyDescriptor(f,i);Object.defineProperty(u,i,p.get?p:{enumerable:!0,get:()=>f[i]})}}return u.default=f,Object.freeze(u)}const we=Ce(de);function De(f){const{width:u,autoRotate:i,data:p,enableZoom:M,categorical:w,colorDomain:g,colors:o,globeMaterial:n,height:H,polygonData:_,mapProperty:m,mapBorderColor:q,atmosphereColor:$,tooltip:G,styles:v,classNames:J,mapNoDataColor:h,centerPoint:A,colorLegendTitle:O,showColorScale:X,hoverStrokeColor:F,detailsOnClick:x,onSeriesMouseClick:d,onSeriesMouseOver:D,resetSelectionOnDoubleClick:Z,highlightedIds:y,scale:j,globeOffset:P,polygonAltitude:Y,centerLng:z,centerLat:S}=f,a=c.useRef(void 0),[E,k]=c.useState(void 0),[K,B]=c.useState(!(u<680)),[I,Q]=c.useState({x:0,y:0}),[b,ee]=c.useState(void 0),U=w?fe.ordinal().domain(g).range(o):ye.threshold().domain(g).range(o);c.useEffect(()=>{a?.current&&(a.current.controls().autoRotate=i!==0,a.current.controls().enableZoom=M,a.current.controls().autoRotateSpeed=i)},[i,M]),c.useEffect(()=>{a.current&&(b?a.current.controls().autoRotate=!1:a.current.controls().autoRotate=i!==0)},[b,i]),c.useEffect(()=>{const r=a.current?.renderer().domElement;if(!r)return;const t=s=>{Q({x:s.clientX,y:s.clientY})};return r.addEventListener("mousemove",t),()=>r.removeEventListener("mousemove",t)},[]),c.useEffect(()=>{a.current&&a.current.pointOfView({lat:S,lng:z,altitude:j},1e3)},[j,z,S]);const W=new we.MeshLambertMaterial({color:"#fff",opacity:1,transparent:!1,...n||{}});return e.jsxRuntimeExports.jsxs("div",{className:"relative",children:[e.jsxRuntimeExports.jsx(ce,{ref:a,width:u,height:H,globeOffset:P,lineHoverPrecision:0,polygonsData:_,polygonAltitude:r=>y.includes(r?.properties?.[m])?.1:r?.properties?.[m]===b?.id?.01:Y,polygonCapColor:r=>{const t=r?.properties?.[m],s=p.find(R=>R.id===t)?.x;return s!=null?U(s):h},polygonSideColor:r=>{const t=r?.properties?.[m],s=p.find(V=>V.id===t)?.x,R=s!=null?U(s):h;return y.includes(r?.properties?.[m])?R:"rgba(100,100,100,0)"},polygonStrokeColor:r=>r?.properties?.[m]===b?.id?F:q,onPolygonClick:r=>{const t=r?.properties?.[m]?p.find(s=>s.id===r?.properties?.[m]):void 0;(d||x)&&(ue.isEqual(E,t)&&Z&&t?(k(void 0),d?.(void 0)):(k(t),d?.(t))),k(t),d?.(t)},onPolygonHover:r=>{const t=r?.properties?.[m]?p.find(s=>s.id===r?.properties?.[m]):void 0;ee(t),D?.(t)},atmosphereColor:$,globeMaterial:W,backgroundColor:"rgba(0, 0, 0, 0)",polygonsTransitionDuration:100,onGlobeReady:()=>{a.current&&a.current.pointOfView({lat:A[0],lng:A[1]})}}),X===!1?null:e.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:K?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{B(!1)},children:e.jsxRuntimeExports.jsx(he.X,{})}),e.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:w?void 0:"340px"},children:[O&&O!==""?e.jsxRuntimeExports.jsx(ie.u,{size:"xs",marginBottom:"xs",className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:O}):null,w?e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:g.map((r,t)=>e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:o[t%o.length]}}),e.jsxRuntimeExports.jsx(ie.u,{size:"sm",marginBottom:"none",leading:"none",children:r})]},t))}):e.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:e.jsxRuntimeExports.jsxs("g",{children:[g.map((r,t)=>e.jsxRuntimeExports.jsxs("g",{className:"cursor-pointer",children:[e.jsxRuntimeExports.jsx("rect",{x:t*320/o.length+1,y:1,width:320/o.length-2,height:8,style:{fill:o[t],stroke:o[t]}}),e.jsxRuntimeExports.jsx("text",{x:(t+1)*320/o.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:me.numberFormattingFunction(r,"NA")})]},t)),e.jsxRuntimeExports.jsx("g",{children:e.jsxRuntimeExports.jsx("rect",{x:g.length*320/o.length+1,y:1,width:320/o.length-2,height:8,style:{fill:o[g.length],stroke:o[g.length]}})})]})})]})]}):e.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{B(!0)},children:e.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),b&&G?e.jsxRuntimeExports.jsx(ge.Tooltip,{data:b,body:G,xPos:I.x,yPos:I.y,backgroundStyle:v?.tooltip,className:J?.tooltip}):null,x&&E!==void 0?e.jsxRuntimeExports.jsx(pe.X,{open:E!==void 0,onClose:()=>{k(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof x=="string"?{__html:xe.string2HTML(x,E)}:void 0,children:typeof x=="function"?x(E):null})}):null]})}function Se(f){const{data:u,mapData:i="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json",graphTitle:p,colors:M,sources:w,graphDescription:g,height:o,width:n,footNote:H="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",colorDomain:_,colorLegendTitle:m,scaleType:q="threshold",padding:$,mapNoDataColor:G=N.Colors.light.graphNoData,backgroundColor:v=!1,mapBorderColor:J=N.Colors.light.grays["gray-500"],relativeHeight:h,tooltip:A,graphID:O,mapProperty:X="ISO3",dataDownload:F=!1,language:x="en",minHeight:d=0,theme:D="light",ariaLabel:Z,styles:y,classNames:j,autoRotate:P=!0,enableZoom:Y=!0,globeMaterial:z,centerPoint:S=[0,0],atmosphereColor:a="#999",showColorScale:E=!0,resetSelectionOnDoubleClick:k=!0,detailsOnClick:K,onSeriesMouseOver:B,onSeriesMouseClick:I,highlightedIds:Q=[],scale:b=1,globeOffset:ee=[0,0],polygonAltitude:U=.01}=f,[W,r]=c.useState(void 0),[t,s]=c.useState(0),[R,V]=c.useState(0),T=c.useRef(null);c.useEffect(()=>{const l=new ResizeObserver(L=>{s(n||L[0].target.clientWidth||760),V(o||L[0].target.clientHeight||480)});return T.current&&(V(T.current.clientHeight||480),s(T.current.clientWidth||760),n||l.observe(T.current)),()=>l.disconnect()},[n,o]),c.useEffect(()=>{typeof i=="string"?be.fetchAndParseJSON(i).then(L=>{if(i==="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json"){const ne=L.features.map(C=>{if(C.geometry.type==="Polygon"){const re=[...C.geometry.coordinates[0]].reverse(),oe={...C.geometry,coordinates:[re]};return{...C,geometry:oe}}const se=[];C.geometry.coordinates.forEach(re=>{const oe=[...re[0]].reverse();se.push([oe])});const ae={...C.geometry,coordinates:se};return{...C,geometry:ae}});r(ne)}else r(L.features)}):r(i.features)},[i]);const te=_||(q==="categorical"?Ee.getUniqValue(u,"x"):Re.getJenks(u.map(l=>l.x),M?.length||4));return e.jsxRuntimeExports.jsx("div",{className:`${D||"light"} flex ${n?"w-fit grow-0":"w-full grow"}`,dir:x==="he"||x==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${v?v===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${x||"en"}`,j?.graphContainer),style:{...y?.graphContainer||{},...v&&v!==!0?{backgroundColor:v}:{}},id:O,"aria-label":Z||`${p?`The graph shows ${p}. `:""}This is a map.${g?` ${g}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:v?$||"1rem":$||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[p||g||F?e.jsxRuntimeExports.jsx(je.GraphHeader,{styles:{title:y?.title,description:y?.description},classNames:{title:j?.title,description:j?.description},graphTitle:p,graphDescription:g,width:n,graphDownload:void 0,dataDownload:F?u.map(l=>l.data).filter(l=>l!==void 0).length>0?u.map(l=>l.data).filter(l=>l!==void 0):u.filter(l=>l!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:T,"aria-label":"Map area",children:(n||t)&&(o||R)&&W?e.jsxRuntimeExports.jsx(De,{data:u,globeOffset:ee,polygonData:W,colorDomain:te,width:n||t,height:Math.max(d,o||(h?d?(n||t)*h>d?(n||t)*h:d:(n||t)*h:R)),colors:M||(q==="categorical"?N.Colors[D].sequentialColors[`neutralColorsx0${te.length}`]:N.Colors[D].sequentialColors[`neutralColorsx0${te.length+1}`]),mapNoDataColor:G,categorical:q==="categorical",mapBorderColor:J,tooltip:A,mapProperty:X,styles:y,classNames:j,autoRotate:P===!0?1.5:P===!1?0:P,enableZoom:Y,globeMaterial:z,atmosphereColor:a,centerPoint:S,colorLegendTitle:m,showColorScale:E,hoverStrokeColor:D==="light"?N.Colors.light.grays["gray-700"]:N.Colors.light.grays["gray-300"],highlightedIds:Q,resetSelectionOnDoubleClick:k,detailsOnClick:K,onSeriesMouseOver:B,onSeriesMouseClick:I,scale:b,polygonAltitude:U,centerLat:S[0],centerLng:S[1]}):e.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(d,o||(h?d?(n||t)*h>d?(n||t)*h:d:(n||t)*h:R))}px`},className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(le.y,{"aria-label":"Loading graph"})})}),w||H?e.jsxRuntimeExports.jsx(ve.GraphFooter,{styles:{footnote:y?.footnote,source:y?.source},classNames:{footnote:j?.footnote,source:j?.source},sources:w,footNote:H,width:n}):null]})})})})}exports.ThreeDGlobe=Se;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),c=require("react"),ge=require("./Spinner-DA6Z5E4n.cjs"),pe=require("react-globe.gl"),he=require("./index-BXns0-ng.cjs"),me=require("three"),xe=require("./Modal-tXZlLE5s.cjs"),ce=require("./Typography-k-kOjICQ.cjs"),fe=require("./Tooltip-n8z5bfav.cjs"),ye=require("./numberFormattingFunction-02t-wJta.cjs"),je=require("./index-BW_-wD2k.cjs"),ve=require("./string2HTML-D2Avudmb.cjs"),be=require("./ordinal-BOeNbyae.cjs"),Ee=require("./threshold-DNsSUf8Q.cjs"),Re=require("./GraphHeader.cjs"),Ce=require("./GraphFooter.cjs"),we=require("./fetchAndParseData-CQyVGCul.cjs"),M=require("./Colors.cjs"),De=require("./getUniqValue-CHqgSss5.cjs"),Se=require("./getJenks-TWQvbuOz.cjs");function ke(y){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(y){for(const n in y)if(n!=="default"){const g=Object.getOwnPropertyDescriptor(y,n);Object.defineProperty(u,n,g.get?g:{enumerable:!0,get:()=>y[n]})}}return u.default=y,Object.freeze(u)}const X=ke(me);function Ne(y){const{width:u,autoRotate:n,data:g,enableZoom:q,categorical:D,colorDomain:p,colors:s,globeMaterial:a,height:F,polygonData:Z,mapProperty:h,mapBorderColor:O,atmosphereColor:A,tooltip:G,styles:E,classNames:Y,mapNoDataColor:m,centerPoint:z,colorLegendTitle:P,showColorScale:K,hoverStrokeColor:B,detailsOnClick:f,onSeriesMouseClick:d,onSeriesMouseOver:S,resetSelectionOnDoubleClick:Q,highlightedIds:j,scale:v,globeOffset:L,polygonAltitude:ee,centerLng:I,centerLat:k,atmosphereAltitude:te,globeCurvatureResolution:re,lightColor:U}=y,i=c.useRef(void 0),[C,N]=c.useState(void 0),[oe,W]=c.useState(!(u<680)),[V,se]=c.useState({x:0,y:0}),[R,ie]=c.useState(void 0),_=D?be.ordinal().domain(p).range(s):Ee.threshold().domain(p).range(s);c.useEffect(()=>{i?.current&&(i.current.controls().autoRotate=n!==0,i.current.controls().enableZoom=q,i.current.controls().autoRotateSpeed=n)},[n,q]),c.useEffect(()=>{i.current&&(R?i.current.controls().autoRotate=!1:i.current.controls().autoRotate=n!==0)},[R,n]),c.useEffect(()=>{const r=i.current?.renderer().domElement;if(!r)return;const e=o=>{se({x:o.clientX,y:o.clientY})};return r.addEventListener("mousemove",e),()=>r.removeEventListener("mousemove",e)},[]),c.useEffect(()=>{i.current&&i.current.pointOfView({lat:k,lng:I,altitude:v},1e3)},[v,I,k]);const J=a||new X.MeshPhysicalMaterial({color:"#FFF",roughness:.5,reflectivity:1.2});return t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(pe,{ref:i,width:u,height:F,globeOffset:L,lineHoverPrecision:0,polygonsData:Z,polygonAltitude:r=>j.includes(r?.properties?.[h])?.1:r?.properties?.[h]===R?.id?.01:ee,polygonCapColor:r=>{const e=r?.properties?.[h],o=g.find(b=>b.id===e)?.x;return o!=null?_(o):m},polygonSideColor:r=>{const e=r?.properties?.[h],o=g.find(T=>T.id===e)?.x,b=o!=null?_(o):m;return j.includes(r?.properties?.[h])?b:"rgba(100,100,100,0)"},polygonStrokeColor:r=>r?.properties?.[h]===R?.id?B:O,onPolygonClick:r=>{const e=r?.properties?.[h]?g.find(o=>o.id===r?.properties?.[h]):void 0;(d||f)&&(he.isEqual(C,e)&&Q&&e?(N(void 0),d?.(void 0)):(N(e),d?.(e))),N(e),d?.(e)},onPolygonHover:r=>{const e=r?.properties?.[h]?g.find(o=>o.id===r?.properties?.[h]):void 0;ie(e),S?.(e)},atmosphereColor:A,atmosphereAltitude:te,globeCurvatureResolution:re,globeMaterial:J,backgroundColor:"rgba(0, 0, 0, 0)",polygonsTransitionDuration:100,onGlobeReady:()=>{if(i.current){i.current.pointOfView({lat:z[0],lng:z[1]});const r=i.current.scene();setTimeout(()=>{r.children.filter(x=>x.type==="DirectionalLight").map(x=>{r.remove(x)});const b=new X.AmbientLight(U,.2);r.add(b),(r.children[3]?.children[0]?.children[4]?.children||[]).forEach(x=>{const H=x.children[1];H.renderOrder=2})},300);const e=new X.DirectionalLight(16777215,.1),o=i.current.camera();e.position.set(0,0,1),o.add(e),r.add(o),r.fog=new X.Fog(U,150,300)}}}),K===!1?null:t.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:oe?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{W(!1)},children:t.jsxRuntimeExports.jsx(je.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:D?void 0:"340px"},children:[P&&P!==""?t.jsxRuntimeExports.jsx(ce.u,{size:"xs",marginBottom:"xs",className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:P}):null,D?t.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:p.map((r,e)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:s[e%s.length]}}),t.jsxRuntimeExports.jsx(ce.u,{size:"sm",marginBottom:"none",leading:"none",children:r})]},e))}):t.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{children:[p.map((r,e)=>t.jsxRuntimeExports.jsxs("g",{className:"cursor-pointer",children:[t.jsxRuntimeExports.jsx("rect",{x:e*320/s.length+1,y:1,width:320/s.length-2,height:8,style:{fill:s[e],stroke:s[e]}}),t.jsxRuntimeExports.jsx("text",{x:(e+1)*320/s.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:ye.numberFormattingFunction(r,"NA")})]},e)),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("rect",{x:p.length*320/s.length+1,y:1,width:320/s.length-2,height:8,style:{fill:s[p.length],stroke:s[p.length]}})})]})})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{W(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),R&&G?t.jsxRuntimeExports.jsx(fe.Tooltip,{data:R,body:G,xPos:V.x,yPos:V.y,backgroundStyle:E?.tooltip,className:Y?.tooltip}):null,f&&C!==void 0?t.jsxRuntimeExports.jsx(xe.X,{open:C!==void 0,onClose:()=>{N(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof f=="string"?{__html:ve.string2HTML(f,C)}:void 0,children:typeof f=="function"?f(C):null})}):null]})}function Me(y){const{data:u,mapData:n="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json",graphTitle:g,colors:q,sources:D,graphDescription:p,height:s,width:a,footNote:F="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",colorDomain:Z,colorLegendTitle:h,scaleType:O="threshold",padding:A,mapNoDataColor:G=M.Colors.light.graphNoData,backgroundColor:E=!1,mapBorderColor:Y=M.Colors.light.grays["gray-500"],relativeHeight:m,tooltip:z,graphID:P,mapProperty:K="ISO3",dataDownload:B=!1,language:f="en",minHeight:d=0,theme:S="light",ariaLabel:Q,styles:j,classNames:v,autoRotate:L=!0,enableZoom:ee=!0,globeMaterial:I,centerPoint:k=[0,0],atmosphereColor:te="#999",showColorScale:re=!0,resetSelectionOnDoubleClick:U=!0,detailsOnClick:i,onSeriesMouseOver:C,onSeriesMouseClick:N,highlightedIds:oe=[],scale:W=1,globeOffset:V=[0,0],polygonAltitude:se=.01,globeCurvatureResolution:R=4,atmosphereAltitude:ie=.15,lightColor:_="#dce9fe"}=y,[J,r]=c.useState(void 0),[e,o]=c.useState(0),[b,T]=c.useState(0),x=c.useRef(null);c.useEffect(()=>{const l=new ResizeObserver($=>{o(a||$[0].target.clientWidth||760),T(s||$[0].target.clientHeight||480)});return x.current&&(T(x.current.clientHeight||480),o(x.current.clientWidth||760),a||l.observe(x.current)),()=>l.disconnect()},[a,s]),c.useEffect(()=>{typeof n=="string"?we.fetchAndParseJSON(n).then($=>{if(n==="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json"){const ue=$.features.map(w=>{if(w.geometry.type==="Polygon"){const ne=[...w.geometry.coordinates[0]].reverse(),ae={...w.geometry,coordinates:[ne]};return{...w,geometry:ae}}const le=[];w.geometry.coordinates.forEach(ne=>{const ae=[...ne[0]].reverse();le.push([ae])});const de={...w.geometry,coordinates:le};return{...w,geometry:de}});r(ue)}else r($.features)}):r(n.features)},[n]);const H=Z||(O==="categorical"?De.getUniqValue(u,"x"):Se.getJenks(u.map(l=>l.x),q?.length||4));return t.jsxRuntimeExports.jsx("div",{className:`${S||"light"} flex ${a?"w-fit grow-0":"w-full grow"}`,dir:f==="he"||f==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${E?E===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${f||"en"}`,v?.graphContainer),style:{...j?.graphContainer||{},...E&&E!==!0?{backgroundColor:E}:{}},id:P,"aria-label":Q||`${g?`The graph shows ${g}. `:""}This is a map.${p?` ${p}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:E?A||"1rem":A||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[g||p||B?t.jsxRuntimeExports.jsx(Re.GraphHeader,{styles:{title:j?.title,description:j?.description},classNames:{title:v?.title,description:v?.description},graphTitle:g,graphDescription:p,width:a,graphDownload:void 0,dataDownload:B?u.map(l=>l.data).filter(l=>l!==void 0).length>0?u.map(l=>l.data).filter(l=>l!==void 0):u.filter(l=>l!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:x,"aria-label":"Map area",children:(a||e)&&(s||b)&&J?t.jsxRuntimeExports.jsx(Ne,{data:u,globeOffset:V,polygonData:J,colorDomain:H,width:a||e,height:Math.max(d,s||(m?d?(a||e)*m>d?(a||e)*m:d:(a||e)*m:b)),colors:q||(O==="categorical"?M.Colors[S].sequentialColors[`neutralColorsx0${H.length}`]:M.Colors[S].sequentialColors[`neutralColorsx0${H.length+1}`]),mapNoDataColor:G,categorical:O==="categorical",mapBorderColor:Y,tooltip:z,mapProperty:K,styles:j,classNames:v,autoRotate:L===!0?1.5:L===!1?0:L,enableZoom:ee,globeMaterial:I,atmosphereColor:te,centerPoint:k,colorLegendTitle:h,showColorScale:re,hoverStrokeColor:S==="light"?M.Colors.light.grays["gray-700"]:M.Colors.light.grays["gray-300"],highlightedIds:oe,resetSelectionOnDoubleClick:U,detailsOnClick:i,onSeriesMouseOver:C,onSeriesMouseClick:N,scale:W,polygonAltitude:se,centerLat:k[0],centerLng:k[1],atmosphereAltitude:ie,globeCurvatureResolution:R,lightColor:_}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(d,s||(m?d?(a||e)*m>d?(a||e)*m:d:(a||e)*m:b))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(ge.y,{"aria-label":"Loading graph"})})}),D||F?t.jsxRuntimeExports.jsx(Ce.GraphFooter,{styles:{footnote:j?.footnote,source:j?.source},classNames:{footnote:v?.footnote,source:v?.source},sources:D,footNote:F,width:a}):null]})})})})}exports.ThreeDGlobe=Me;
2
2
  //# sourceMappingURL=ThreeDGlobe.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThreeDGlobe.cjs","sources":["../src/Components/Graphs/Maps/ThreeDGlobe/Graph.tsx","../src/Components/Graphs/Maps/ThreeDGlobe/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport Globe, { GlobeMethods } from 'react-globe.gl';\r\nimport isEqual from 'fast-deep-equal';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport { scaleOrdinal, scaleThreshold } from 'd3-scale';\r\nimport * as THREE from 'three';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\n\r\nimport { ChoroplethMapDataType, ClassNameObject, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { X } from '@/Components/Icons';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n width: number;\r\n data: ChoroplethMapDataType[];\r\n autoRotate: number;\r\n enableZoom: boolean;\r\n categorical: boolean;\r\n colorDomain: number[] | string[];\r\n colors: string[];\r\n height: number;\r\n globeMaterial?: THREE.MeshPhongMaterialProperties;\r\n polygonData: any;\r\n mapProperty: string;\r\n mapBorderColor: string;\r\n atmosphereColor: string;\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapNoDataColor: string;\r\n centerPoint: [number, number];\r\n colorLegendTitle?: string;\r\n showColorScale: boolean;\r\n hoverStrokeColor: string;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n resetSelectionOnDoubleClick: boolean;\r\n highlightedIds: string[];\r\n scale: number;\r\n globeOffset: [number, number];\r\n polygonAltitude: number;\r\n centerLng: number;\r\n centerLat: number;\r\n}\r\n\r\nfunction Graph(props: Props) {\r\n const {\r\n width,\r\n autoRotate,\r\n data,\r\n enableZoom,\r\n categorical,\r\n colorDomain,\r\n colors,\r\n globeMaterial,\r\n height,\r\n polygonData,\r\n mapProperty,\r\n mapBorderColor,\r\n atmosphereColor,\r\n tooltip,\r\n styles,\r\n classNames,\r\n mapNoDataColor,\r\n centerPoint,\r\n colorLegendTitle,\r\n showColorScale,\r\n hoverStrokeColor,\r\n detailsOnClick,\r\n onSeriesMouseClick,\r\n onSeriesMouseOver,\r\n resetSelectionOnDoubleClick,\r\n highlightedIds,\r\n scale,\r\n globeOffset,\r\n polygonAltitude,\r\n centerLng,\r\n centerLat,\r\n } = props;\r\n const globeEl = useRef<GlobeMethods | undefined>(undefined);\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [showLegend, setShowLegend] = useState(!(width < 680));\r\n const [mousePos, setMousePos] = useState({ x: 0, y: 0 });\r\n const [mouseOverData, setMouseOverData] = useState<ChoroplethMapDataType | undefined>(undefined);\r\n const colorScale = categorical\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n useEffect(() => {\r\n if (globeEl?.current) {\r\n globeEl.current.controls().autoRotate = autoRotate === 0 ? false : true;\r\n globeEl.current.controls().enableZoom = enableZoom;\r\n globeEl.current.controls().autoRotateSpeed = autoRotate;\r\n }\r\n }, [autoRotate, enableZoom]);\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n if (mouseOverData) {\r\n globeEl.current.controls().autoRotate = false;\r\n } else {\r\n globeEl.current.controls().autoRotate = autoRotate === 0 ? false : true;\r\n }\r\n }\r\n }, [mouseOverData, autoRotate]);\r\n\r\n useEffect(() => {\r\n const canvas = globeEl.current?.renderer().domElement;\r\n if (!canvas) return;\r\n\r\n const handleMouseMove = (e: MouseEvent) => {\r\n setMousePos({ x: e.clientX, y: e.clientY });\r\n };\r\n\r\n canvas.addEventListener('mousemove', handleMouseMove);\r\n return () => canvas.removeEventListener('mousemove', handleMouseMove);\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({ lat: centerLat, lng: centerLng, altitude: scale }, 1000);\r\n }\r\n }, [scale, centerLng, centerLat]);\r\n const materials = new THREE.MeshLambertMaterial({\r\n color: '#fff',\r\n opacity: 1,\r\n transparent: false,\r\n ...(globeMaterial || {}),\r\n });\r\n return (\r\n <div className='relative'>\r\n <Globe\r\n ref={globeEl}\r\n width={width}\r\n height={height}\r\n globeOffset={globeOffset}\r\n lineHoverPrecision={0}\r\n polygonsData={polygonData}\r\n polygonAltitude={(polygon: any) =>\r\n highlightedIds.includes(polygon?.properties?.[mapProperty])\r\n ? 0.1\r\n : polygon?.properties?.[mapProperty] === mouseOverData?.id\r\n ? 0.01\r\n : polygonAltitude\r\n }\r\n polygonCapColor={(polygon: any) => {\r\n const id = polygon?.properties?.[mapProperty];\r\n const val = data.find(el => el.id === id)?.x;\r\n if (val !== undefined && val !== null) {\r\n return colorScale(val as any);\r\n }\r\n return mapNoDataColor;\r\n }}\r\n polygonSideColor={(polygon: any) => {\r\n const id = polygon?.properties?.[mapProperty];\r\n const val = data.find(el => el.id === id)?.x;\r\n const color = val !== undefined && val !== null ? colorScale(val as any) : mapNoDataColor;\r\n return highlightedIds.includes(polygon?.properties?.[mapProperty])\r\n ? color\r\n : 'rgba(100,100,100,0)';\r\n }}\r\n polygonStrokeColor={(polygon: any) =>\r\n polygon?.properties?.[mapProperty] === mouseOverData?.id\r\n ? hoverStrokeColor\r\n : mapBorderColor\r\n }\r\n onPolygonClick={(polygon: any) => {\r\n const clickedData = polygon?.properties?.[mapProperty]\r\n ? data.find(el => el.id === polygon?.properties?.[mapProperty])\r\n : undefined;\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n isEqual(mouseClickData, clickedData) &&\r\n resetSelectionOnDoubleClick &&\r\n clickedData\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(clickedData);\r\n onSeriesMouseClick?.(clickedData);\r\n }\r\n }\r\n setMouseClickData(clickedData);\r\n onSeriesMouseClick?.(clickedData);\r\n }}\r\n onPolygonHover={(polygon: any) => {\r\n const hoverData = polygon?.properties?.[mapProperty]\r\n ? data.find(el => el.id === polygon?.properties?.[mapProperty])\r\n : undefined;\r\n setMouseOverData(hoverData);\r\n onSeriesMouseOver?.(hoverData);\r\n }}\r\n atmosphereColor={atmosphereColor}\r\n globeMaterial={materials}\r\n backgroundColor='rgba(0, 0, 0, 0)'\r\n polygonsTransitionDuration={100}\r\n onGlobeReady={() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({\r\n lat: centerPoint[0],\r\n lng: centerPoint[1],\r\n });\r\n }\r\n }}\r\n />\r\n {showColorScale === false ? null : (\r\n <div className='absolute left-4 bottom-4'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='p-2'\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n width: categorical ? undefined : '340px',\r\n }}\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P\r\n size='xs'\r\n marginBottom='xs'\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n {!categorical ? (\r\n <svg width='100%' viewBox='0 0 320 30' direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g key={i} className='cursor-pointer'>\r\n <rect\r\n x={(i * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n style={{\r\n fill: colors[i],\r\n stroke: colors[i],\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * 320) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-xs'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n x={(colorDomain.length * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n stroke: colors[colorDomain.length],\r\n }}\r\n />\r\n </g>\r\n </g>\r\n </svg>\r\n ) : (\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div key={i} className='flex gap-2 items-center'>\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {mouseOverData && tooltip ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={mousePos.x}\r\n yPos={mousePos.y}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </div>\r\n );\r\n}\r\n\r\nexport default Graph;\r\n","import React, { useEffect, useRef, useState } from 'react';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport * as THREE from 'three';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport Graph from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport {\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n Languages,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: ChoroplethMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: number[] | string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines if the globe rotates automatically */\r\n autoRotate?: number | boolean;\r\n /** Defines the material property applied to the sphere of the globe */\r\n globeMaterial?: THREE.MeshPhongMaterialProperties;\r\n /** Defines the colo of the glow around the globe */\r\n atmosphereColor?: string;\r\n /** Defines if the globe can be zoomed when scrolled */\r\n enableZoom?: boolean;\r\n /** Position offset of the globe relative to the canvas center */\r\n globeOffset?: [number, number];\r\n /** Defines the camera distance from Earth. This helps in defining the default size of the globe. Smaller = closer camera therefore the globe is bigger) */\r\n scale?: number;\r\n /** Defines the spacing between the country shape polygon with the sphere */\r\n polygonAltitude?: number;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggles if the color scaling is categorical or not */\r\n categorical?: boolean;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\n/** For using these maps you will have to install [`three`](https://threejs.org/manual/) and [react-globe.gl](https://www.npmjs.com/package/react-globe.gl) package to your project */\r\nexport function ThreeDGlobe(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json',\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n colorDomain,\r\n colorLegendTitle,\r\n scaleType = 'threshold',\r\n padding,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n tooltip,\r\n graphID,\r\n mapProperty = 'ISO3',\r\n dataDownload = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n styles,\r\n classNames,\r\n autoRotate = true,\r\n enableZoom = true,\r\n globeMaterial,\r\n centerPoint = [0, 0],\r\n atmosphereColor = '#999',\r\n showColorScale = true,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n highlightedIds = [],\r\n scale = 1,\r\n globeOffset = [0, 0],\r\n polygonAltitude = 0.01,\r\n } = props;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 760);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 760);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n if (\r\n mapData ===\r\n 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json'\r\n ) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const features = d.features.map((el: any) => {\r\n if (el.geometry.type === 'Polygon') {\r\n const reversed = [...el.geometry.coordinates[0]].reverse();\r\n const geometry = { ...el.geometry, coordinates: [reversed] };\r\n return { ...el, geometry };\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const coord: any = [];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n el.geometry.coordinates.forEach((c: any) => {\r\n const reversed = [...c[0]].reverse();\r\n coord.push([reversed]);\r\n });\r\n const geometry = { ...el.geometry, coordinates: coord };\r\n return { ...el, geometry };\r\n });\r\n setMapShape(features);\r\n } else setMapShape(d.features);\r\n });\r\n } else {\r\n setMapShape(mapData.features);\r\n }\r\n }, [mapData]);\r\n\r\n const domain =\r\n colorDomain ||\r\n (scaleType === 'categorical'\r\n ? getUniqValue(data, 'x')\r\n : getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors?.length || 4,\r\n ));\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a map.${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) && mapShape ? (\r\n <Graph\r\n data={data}\r\n globeOffset={globeOffset}\r\n polygonData={mapShape}\r\n colorDomain={domain}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n colors={\r\n colors ||\r\n (scaleType === 'categorical'\r\n ? Colors[theme].sequentialColors[\r\n `neutralColorsx0${domain.length as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${(domain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ])\r\n }\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n mapProperty={mapProperty}\r\n styles={styles}\r\n classNames={classNames}\r\n autoRotate={autoRotate === true ? 1.5 : autoRotate === false ? 0 : autoRotate}\r\n enableZoom={enableZoom}\r\n globeMaterial={globeMaterial}\r\n atmosphereColor={atmosphereColor}\r\n centerPoint={centerPoint}\r\n colorLegendTitle={colorLegendTitle}\r\n showColorScale={showColorScale}\r\n hoverStrokeColor={\r\n theme === 'light'\r\n ? Colors.light.grays['gray-700']\r\n : Colors.light.grays['gray-300']\r\n }\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n scale={scale}\r\n polygonAltitude={polygonAltitude}\r\n centerLat={centerPoint[0]}\r\n centerLng={centerPoint[1]}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","width","autoRotate","data","enableZoom","categorical","colorDomain","colors","globeMaterial","height","polygonData","mapProperty","mapBorderColor","atmosphereColor","tooltip","styles","classNames","mapNoDataColor","centerPoint","colorLegendTitle","showColorScale","hoverStrokeColor","detailsOnClick","onSeriesMouseClick","onSeriesMouseOver","resetSelectionOnDoubleClick","highlightedIds","scale","globeOffset","polygonAltitude","centerLng","centerLat","globeEl","useRef","mouseClickData","setMouseClickData","useState","showLegend","setShowLegend","mousePos","setMousePos","mouseOverData","setMouseOverData","colorScale","scaleOrdinal","scaleThreshold","useEffect","canvas","handleMouseMove","e","materials","THREE","jsxs","jsx","Globe","polygon","id","val","el","color","clickedData","isEqual","hoverData","Fragment","X","P","d","i","numberFormattingFunction","Tooltip","Modal","string2HTML","ThreeDGlobe","mapData","graphTitle","sources","graphDescription","footNote","scaleType","padding","Colors","backgroundColor","relativeHeight","graphID","dataDownload","language","minHeight","theme","ariaLabel","mapShape","setMapShape","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","resizeObserver","entries","fetchAndParseJSON","features","reversed","geometry","coord","c","domain","getUniqValue","getJenks","cn","GraphHeader","Spinner","GraphFooter"],"mappings":"kkCAiDA,SAASA,GAAMC,EAAc,CAC3B,KAAM,CACJ,MAAAC,EACA,WAAAC,EACA,KAAAC,EACA,WAAAC,EACA,YAAAC,EACA,YAAAC,EACA,OAAAC,EACA,cAAAC,EACA,OAAAC,EACA,YAAAC,EACA,YAAAC,EACA,eAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,OAAAC,EACA,WAAAC,EACA,eAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,MAAAC,EACA,YAAAC,EACA,gBAAAC,EAC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ACF,CAAA,CACF,CAAA,CAGN"}
1
+ {"version":3,"file":"ThreeDGlobe.cjs","sources":["../src/Components/Graphs/Maps/ThreeDGlobe/Graph.tsx","../src/Components/Graphs/Maps/ThreeDGlobe/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport Globe, { GlobeMethods } from 'react-globe.gl';\r\nimport isEqual from 'fast-deep-equal';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport { scaleOrdinal, scaleThreshold } from 'd3-scale';\r\nimport * as THREE from 'three';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\n\r\nimport { ChoroplethMapDataType, ClassNameObject, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { X } from '@/Components/Icons';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n width: number;\r\n data: ChoroplethMapDataType[];\r\n autoRotate: number;\r\n enableZoom: boolean;\r\n categorical: boolean;\r\n colorDomain: number[] | string[];\r\n colors: string[];\r\n height: number;\r\n globeMaterial?: THREE.Material;\r\n polygonData: any;\r\n mapProperty: string;\r\n mapBorderColor: string;\r\n atmosphereColor: string;\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapNoDataColor: string;\r\n centerPoint: [number, number];\r\n colorLegendTitle?: string;\r\n showColorScale: boolean;\r\n hoverStrokeColor: string;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n resetSelectionOnDoubleClick: boolean;\r\n highlightedIds: string[];\r\n scale: number;\r\n globeOffset: [number, number];\r\n polygonAltitude: number;\r\n centerLng: number;\r\n centerLat: number;\r\n atmosphereAltitude: number;\r\n globeCurvatureResolution: number;\r\n lightColor: string;\r\n}\r\n\r\nfunction Graph(props: Props) {\r\n const {\r\n width,\r\n autoRotate,\r\n data,\r\n enableZoom,\r\n categorical,\r\n colorDomain,\r\n colors,\r\n globeMaterial,\r\n height,\r\n polygonData,\r\n mapProperty,\r\n mapBorderColor,\r\n atmosphereColor,\r\n tooltip,\r\n styles,\r\n classNames,\r\n mapNoDataColor,\r\n centerPoint,\r\n colorLegendTitle,\r\n showColorScale,\r\n hoverStrokeColor,\r\n detailsOnClick,\r\n onSeriesMouseClick,\r\n onSeriesMouseOver,\r\n resetSelectionOnDoubleClick,\r\n highlightedIds,\r\n scale,\r\n globeOffset,\r\n polygonAltitude,\r\n centerLng,\r\n centerLat,\r\n atmosphereAltitude,\r\n globeCurvatureResolution,\r\n lightColor,\r\n } = props;\r\n const globeEl = useRef<GlobeMethods | undefined>(undefined);\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [showLegend, setShowLegend] = useState(!(width < 680));\r\n const [mousePos, setMousePos] = useState({ x: 0, y: 0 });\r\n const [mouseOverData, setMouseOverData] = useState<ChoroplethMapDataType | undefined>(undefined);\r\n const colorScale = categorical\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n useEffect(() => {\r\n if (globeEl?.current) {\r\n globeEl.current.controls().autoRotate = autoRotate === 0 ? false : true;\r\n globeEl.current.controls().enableZoom = enableZoom;\r\n globeEl.current.controls().autoRotateSpeed = autoRotate;\r\n }\r\n }, [autoRotate, enableZoom]);\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n if (mouseOverData) {\r\n globeEl.current.controls().autoRotate = false;\r\n } else {\r\n globeEl.current.controls().autoRotate = autoRotate === 0 ? false : true;\r\n }\r\n }\r\n }, [mouseOverData, autoRotate]);\r\n\r\n useEffect(() => {\r\n const canvas = globeEl.current?.renderer().domElement;\r\n if (!canvas) return;\r\n\r\n const handleMouseMove = (e: MouseEvent) => {\r\n setMousePos({ x: e.clientX, y: e.clientY });\r\n };\r\n\r\n canvas.addEventListener('mousemove', handleMouseMove);\r\n return () => canvas.removeEventListener('mousemove', handleMouseMove);\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({ lat: centerLat, lng: centerLng, altitude: scale }, 1000);\r\n }\r\n }, [scale, centerLng, centerLat]);\r\n const materials =\r\n globeMaterial ||\r\n new THREE.MeshPhysicalMaterial({\r\n color: '#FFF',\r\n roughness: 0.5,\r\n reflectivity: 1.2,\r\n });\r\n return (\r\n <div className='relative'>\r\n <Globe\r\n ref={globeEl}\r\n width={width}\r\n height={height}\r\n globeOffset={globeOffset}\r\n lineHoverPrecision={0}\r\n polygonsData={polygonData}\r\n polygonAltitude={(polygon: any) =>\r\n highlightedIds.includes(polygon?.properties?.[mapProperty])\r\n ? 0.1\r\n : polygon?.properties?.[mapProperty] === mouseOverData?.id\r\n ? 0.01\r\n : polygonAltitude\r\n }\r\n polygonCapColor={(polygon: any) => {\r\n const id = polygon?.properties?.[mapProperty];\r\n const val = data.find(el => el.id === id)?.x;\r\n if (val !== undefined && val !== null) {\r\n return colorScale(val as any);\r\n }\r\n return mapNoDataColor;\r\n }}\r\n polygonSideColor={(polygon: any) => {\r\n const id = polygon?.properties?.[mapProperty];\r\n const val = data.find(el => el.id === id)?.x;\r\n const color = val !== undefined && val !== null ? colorScale(val as any) : mapNoDataColor;\r\n return highlightedIds.includes(polygon?.properties?.[mapProperty])\r\n ? color\r\n : 'rgba(100,100,100,0)';\r\n }}\r\n polygonStrokeColor={(polygon: any) =>\r\n polygon?.properties?.[mapProperty] === mouseOverData?.id\r\n ? hoverStrokeColor\r\n : mapBorderColor\r\n }\r\n onPolygonClick={(polygon: any) => {\r\n const clickedData = polygon?.properties?.[mapProperty]\r\n ? data.find(el => el.id === polygon?.properties?.[mapProperty])\r\n : undefined;\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n isEqual(mouseClickData, clickedData) &&\r\n resetSelectionOnDoubleClick &&\r\n clickedData\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(clickedData);\r\n onSeriesMouseClick?.(clickedData);\r\n }\r\n }\r\n setMouseClickData(clickedData);\r\n onSeriesMouseClick?.(clickedData);\r\n }}\r\n onPolygonHover={(polygon: any) => {\r\n const hoverData = polygon?.properties?.[mapProperty]\r\n ? data.find(el => el.id === polygon?.properties?.[mapProperty])\r\n : undefined;\r\n setMouseOverData(hoverData);\r\n onSeriesMouseOver?.(hoverData);\r\n }}\r\n atmosphereColor={atmosphereColor}\r\n atmosphereAltitude={atmosphereAltitude}\r\n globeCurvatureResolution={globeCurvatureResolution}\r\n globeMaterial={materials}\r\n backgroundColor='rgba(0, 0, 0, 0)'\r\n polygonsTransitionDuration={100}\r\n onGlobeReady={() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({\r\n lat: centerPoint[0],\r\n lng: centerPoint[1],\r\n });\r\n const scene = globeEl.current.scene();\r\n setTimeout(() => {\r\n scene.children\r\n .filter(d => d.type === 'DirectionalLight')\r\n .map(d => {\r\n scene.remove(d);\r\n });\r\n const ambientLight = new THREE.AmbientLight(lightColor, 0.2);\r\n scene.add(ambientLight);\r\n\r\n const polygons = scene.children[3]?.children[0]?.children[4]?.children || [];\r\n polygons.forEach(d => {\r\n const line = d.children[1];\r\n line.renderOrder = 2;\r\n });\r\n }, 300);\r\n const light = new THREE.DirectionalLight(0xffffff, 0.1);\r\n const camera = globeEl.current.camera();\r\n light.position.set(0, 0, 1);\r\n camera.add(light);\r\n scene.add(camera);\r\n scene.fog = new THREE.Fog(lightColor, 150, 300);\r\n }\r\n }}\r\n />\r\n {showColorScale === false ? null : (\r\n <div className='absolute left-4 bottom-4'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='p-2'\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n width: categorical ? undefined : '340px',\r\n }}\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P\r\n size='xs'\r\n marginBottom='xs'\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n {!categorical ? (\r\n <svg width='100%' viewBox='0 0 320 30' direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g key={i} className='cursor-pointer'>\r\n <rect\r\n x={(i * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n style={{\r\n fill: colors[i],\r\n stroke: colors[i],\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * 320) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-xs'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n x={(colorDomain.length * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n stroke: colors[colorDomain.length],\r\n }}\r\n />\r\n </g>\r\n </g>\r\n </svg>\r\n ) : (\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div key={i} className='flex gap-2 items-center'>\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {mouseOverData && tooltip ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={mousePos.x}\r\n yPos={mousePos.y}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </div>\r\n );\r\n}\r\n\r\nexport default Graph;\r\n","import React, { useEffect, useRef, useState } from 'react';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport * as THREE from 'three';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport Globe from 'react-globe.gl';\r\n\r\nimport Graph from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport {\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n Languages,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\n\r\ntype GlobeProps = React.ComponentProps<typeof Globe>;\r\ninterface Props extends Partial<Omit<GlobeProps, 'backgroundColor'>> {\r\n // Data\r\n /** Array of data objects */\r\n data: ChoroplethMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: number[] | string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines if the globe rotates automatically */\r\n autoRotate?: number | boolean;\r\n /** Defines the material property applied to the sphere of the globe */\r\n globeMaterial?: THREE.Material;\r\n /** Defines the colo of the glow around the globe */\r\n atmosphereColor?: string;\r\n /** Defines if the globe can be zoomed when scrolled */\r\n enableZoom?: boolean;\r\n /** Position offset of the globe relative to the canvas center */\r\n globeOffset?: [number, number];\r\n /** Defines the camera distance from Earth. This helps in defining the default size of the globe. Smaller = closer camera therefore the globe is bigger) */\r\n scale?: number;\r\n /** Defines the spacing between the country shape polygon with the sphere */\r\n polygonAltitude?: number;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggles if the color scaling is categorical or not */\r\n categorical?: boolean;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** The max altitude of the atmosphere, in terms of globe radius units. */\r\n atmosphereAltitude?: number;\r\n /** Resolution in angular degrees of the sphere curvature. The finer the resolution, the more the globe is fragmented into smaller faces to approximate the spheric surface, at the cost of performance. */\r\n globeCurvatureResolution?: number;\r\n /** Defines the color of the light and atmosphere. */\r\n lightColor?: string;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\n/** For using these maps you will have to install [`three`](https://threejs.org/manual/) and [react-globe.gl](https://www.npmjs.com/package/react-globe.gl) package to your project */\r\nexport function ThreeDGlobe(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json',\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n colorDomain,\r\n colorLegendTitle,\r\n scaleType = 'threshold',\r\n padding,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n tooltip,\r\n graphID,\r\n mapProperty = 'ISO3',\r\n dataDownload = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n styles,\r\n classNames,\r\n autoRotate = true,\r\n enableZoom = true,\r\n globeMaterial,\r\n centerPoint = [0, 0],\r\n atmosphereColor = '#999',\r\n showColorScale = true,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n highlightedIds = [],\r\n scale = 1,\r\n globeOffset = [0, 0],\r\n polygonAltitude = 0.01,\r\n globeCurvatureResolution = 4,\r\n atmosphereAltitude = 0.15,\r\n lightColor = '#dce9fe',\r\n } = props;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 760);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 760);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n if (\r\n mapData ===\r\n 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json'\r\n ) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const features = d.features.map((el: any) => {\r\n if (el.geometry.type === 'Polygon') {\r\n const reversed = [...el.geometry.coordinates[0]].reverse();\r\n const geometry = { ...el.geometry, coordinates: [reversed] };\r\n return { ...el, geometry };\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const coord: any = [];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n el.geometry.coordinates.forEach((c: any) => {\r\n const reversed = [...c[0]].reverse();\r\n coord.push([reversed]);\r\n });\r\n const geometry = { ...el.geometry, coordinates: coord };\r\n return { ...el, geometry };\r\n });\r\n setMapShape(features);\r\n } else setMapShape(d.features);\r\n });\r\n } else {\r\n setMapShape(mapData.features);\r\n }\r\n }, [mapData]);\r\n\r\n const domain =\r\n colorDomain ||\r\n (scaleType === 'categorical'\r\n ? getUniqValue(data, 'x')\r\n : getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors?.length || 4,\r\n ));\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a map.${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) && mapShape ? (\r\n <Graph\r\n data={data}\r\n globeOffset={globeOffset}\r\n polygonData={mapShape}\r\n colorDomain={domain}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n colors={\r\n colors ||\r\n (scaleType === 'categorical'\r\n ? Colors[theme].sequentialColors[\r\n `neutralColorsx0${domain.length as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${(domain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ])\r\n }\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n mapProperty={mapProperty}\r\n styles={styles}\r\n classNames={classNames}\r\n autoRotate={autoRotate === true ? 1.5 : autoRotate === false ? 0 : autoRotate}\r\n enableZoom={enableZoom}\r\n globeMaterial={globeMaterial}\r\n atmosphereColor={atmosphereColor}\r\n centerPoint={centerPoint}\r\n colorLegendTitle={colorLegendTitle}\r\n showColorScale={showColorScale}\r\n hoverStrokeColor={\r\n theme === 'light'\r\n ? Colors.light.grays['gray-700']\r\n : Colors.light.grays['gray-300']\r\n }\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n scale={scale}\r\n polygonAltitude={polygonAltitude}\r\n centerLat={centerPoint[0]}\r\n centerLng={centerPoint[1]}\r\n atmosphereAltitude={atmosphereAltitude}\r\n globeCurvatureResolution={globeCurvatureResolution}\r\n lightColor={lightColor}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","width","autoRotate","data","enableZoom","categorical","colorDomain","colors","globeMaterial","height","polygonData","mapProperty","mapBorderColor","atmosphereColor","tooltip","styles","classNames","mapNoDataColor","centerPoint","colorLegendTitle","showColorScale","hoverStrokeColor","detailsOnClick","onSeriesMouseClick","onSeriesMouseOver","resetSelectionOnDoubleClick","highlightedIds","scale","globeOffset","polygonAltitude","centerLng","centerLat","atmosphereAltitude","globeCurvatureResolution","lightColor","globeEl","useRef","mouseClickData","setMouseClickData","useState","showLegend","setShowLegend","mousePos","setMousePos","mouseOverData","setMouseOverData","colorScale","scaleOrdinal","scaleThreshold","useEffect","canvas","handleMouseMove","e","materials","THREE","jsxs","jsx","Globe","polygon","id","val","el","color","clickedData","isEqual","hoverData","scene","d","ambientLight","line","light","camera","Fragment","X","P","i","numberFormattingFunction","Tooltip","Modal","string2HTML","ThreeDGlobe","mapData","graphTitle","sources","graphDescription","footNote","scaleType","padding","Colors","backgroundColor","relativeHeight","graphID","dataDownload","language","minHeight","theme","ariaLabel","mapShape","setMapShape","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","resizeObserver","entries","fetchAndParseJSON","features","reversed","geometry","coord","c","domain","getUniqValue","getJenks","cn","GraphHeader","Spinner","GraphFooter"],"mappings":"ikCAoDA,SAASA,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CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
@@ -1,4 +1,5 @@
1
1
  import { default as default_2 } from 'react';
2
+ import { default as default_3 } from 'react-globe.gl';
2
3
  import { JSX } from 'react/jsx-runtime';
3
4
  import * as THREE from 'three';
4
5
 
@@ -40,9 +41,11 @@ declare interface ClassNameObject {
40
41
  dataCards?: string;
41
42
  }
42
43
 
44
+ declare type GlobeProps = default_2.ComponentProps<typeof default_3>;
45
+
43
46
  declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
44
47
 
45
- declare interface Props {
48
+ declare interface Props extends Partial<Omit<GlobeProps, 'backgroundColor'>> {
46
49
  /** Array of data objects */
47
50
  data: ChoroplethMapDataType[];
48
51
  /** Title of the graph */
@@ -88,7 +91,7 @@ declare interface Props {
88
91
  /** Defines if the globe rotates automatically */
89
92
  autoRotate?: number | boolean;
90
93
  /** Defines the material property applied to the sphere of the globe */
91
- globeMaterial?: THREE.MeshPhongMaterialProperties;
94
+ globeMaterial?: THREE.Material;
92
95
  /** Defines the colo of the glow around the globe */
93
96
  atmosphereColor?: string;
94
97
  /** Defines if the globe can be zoomed when scrolled */
@@ -105,6 +108,12 @@ declare interface Props {
105
108
  categorical?: boolean;
106
109
  /** Toggle visibility of color scale. */
107
110
  showColorScale?: boolean;
111
+ /** The max altitude of the atmosphere, in terms of globe radius units. */
112
+ atmosphereAltitude?: number;
113
+ /** Resolution in angular degrees of the sphere curvature. The finer the resolution, the more the globe is fragmented into smaller faces to approximate the spheric surface, at the cost of performance. */
114
+ globeCurvatureResolution?: number;
115
+ /** Defines the color of the light and atmosphere. */
116
+ lightColor?: string;
108
117
  /** Property in the property object in mapData geoJson object is used to match to the id in the data object */
109
118
  mapProperty?: string;
110
119
  /** Countries or regions to be highlighted */