@undp/data-viz 1.3.0 → 1.3.1

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 (572) hide show
  1. package/dist/AreaChart.cjs +2 -0
  2. package/dist/AreaChart.cjs.map +1 -0
  3. package/dist/AreaChart.js +530 -1
  4. package/dist/AreaChart.js.map +1 -1
  5. package/dist/Axis-DE7dSn1_.cjs +2 -0
  6. package/dist/{Axis-BlyBRMNw.cjs.map → Axis-DE7dSn1_.cjs.map} +1 -1
  7. package/dist/{Axis-CvK-w3E2.js → Axis-Ddg-seDi.js} +10 -11
  8. package/dist/{Axis-CvK-w3E2.js.map → Axis-Ddg-seDi.js.map} +1 -1
  9. package/dist/AxisTitle-BmHLMRJZ.js +20 -0
  10. package/dist/{AxisTitle-BeMxcw5I.js.map → AxisTitle-BmHLMRJZ.js.map} +1 -1
  11. package/dist/AxisTitle-CK9YeovX.cjs +2 -0
  12. package/dist/{AxisTitle-BY8MI9jC.cjs.map → AxisTitle-CK9YeovX.cjs.map} +1 -1
  13. package/dist/BarGraph.cjs +2 -0
  14. package/dist/BarGraph.cjs.map +1 -0
  15. package/dist/BarGraph.js +4043 -1
  16. package/dist/BarGraph.js.map +1 -1
  17. package/dist/BasicStatCard.cjs +2 -0
  18. package/dist/BasicStatCard.cjs.map +1 -0
  19. package/dist/BasicStatCard.js +190 -1
  20. package/dist/BasicStatCard.js.map +1 -1
  21. package/dist/BeeSwarmChart.cjs +2 -0
  22. package/dist/BeeSwarmChart.cjs.map +1 -0
  23. package/dist/BeeSwarmChart.d.ts +0 -8
  24. package/dist/BeeSwarmChart.js +1042 -1
  25. package/dist/BeeSwarmChart.js.map +1 -1
  26. package/dist/BiVariateChoroplethMap.cjs +2 -0
  27. package/dist/BiVariateChoroplethMap.cjs.map +1 -0
  28. package/dist/BiVariateChoroplethMap.js +720 -1
  29. package/dist/BiVariateChoroplethMap.js.map +1 -1
  30. package/dist/BulletChart.cjs +2 -0
  31. package/dist/BulletChart.cjs.map +1 -0
  32. package/dist/BulletChart.js +1431 -1
  33. package/dist/BulletChart.js.map +1 -1
  34. package/dist/ButterflyChart.cjs +2 -0
  35. package/dist/ButterflyChart.cjs.map +1 -0
  36. package/dist/ButterflyChart.js +692 -1
  37. package/dist/ButterflyChart.js.map +1 -1
  38. package/dist/ChoroplethMap.cjs +2 -0
  39. package/dist/ChoroplethMap.cjs.map +1 -0
  40. package/dist/ChoroplethMap.js +745 -1
  41. package/dist/ChoroplethMap.js.map +1 -1
  42. package/dist/CirclePackingGraph.cjs +2 -0
  43. package/dist/CirclePackingGraph.cjs.map +1 -0
  44. package/dist/CirclePackingGraph.d.ts +0 -8
  45. package/dist/CirclePackingGraph.js +14 -1
  46. package/dist/CirclePackingGraph.js.map +1 -1
  47. package/dist/ColorLegend.cjs +2 -0
  48. package/dist/ColorLegend.cjs.map +1 -0
  49. package/dist/ColorLegend.js +47 -1
  50. package/dist/ColorLegend.js.map +1 -1
  51. package/dist/ColorLegendWithMouseOver.cjs +2 -0
  52. package/dist/ColorLegendWithMouseOver.cjs.map +1 -0
  53. package/dist/ColorLegendWithMouseOver.js +70 -1
  54. package/dist/ColorLegendWithMouseOver.js.map +1 -1
  55. package/dist/Colors.cjs +2 -0
  56. package/dist/Colors.cjs.map +1 -0
  57. package/dist/Colors.js +561 -1
  58. package/dist/Colors.js.map +1 -1
  59. package/dist/CopyTextButton.cjs +17 -0
  60. package/dist/CopyTextButton.cjs.map +1 -0
  61. package/dist/CopyTextButton.js +698 -16
  62. package/dist/CopyTextButton.js.map +1 -1
  63. package/dist/CsvDownloadButton.cjs +23 -0
  64. package/dist/CsvDownloadButton.cjs.map +1 -0
  65. package/dist/CsvDownloadButton.js +852 -7
  66. package/dist/CsvDownloadButton.js.map +1 -1
  67. package/dist/DataCards.cjs +2 -0
  68. package/dist/DataCards.cjs.map +1 -0
  69. package/dist/DataCards.js +14 -1
  70. package/dist/DataCards.js.map +1 -1
  71. package/dist/DataTable.cjs +2 -0
  72. package/dist/DataTable.cjs.map +1 -0
  73. package/dist/DataTable.js +331 -1
  74. package/dist/DataTable.js.map +1 -1
  75. package/dist/DifferenceLineChart.cjs +2 -0
  76. package/dist/DifferenceLineChart.cjs.map +1 -0
  77. package/dist/DifferenceLineChart.js +805 -1
  78. package/dist/DifferenceLineChart.js.map +1 -1
  79. package/dist/DonutChart.cjs +2 -0
  80. package/dist/DonutChart.cjs.map +1 -0
  81. package/dist/DonutChart.js +478 -1
  82. package/dist/DonutChart.js.map +1 -1
  83. package/dist/DotDensityMap.cjs +2 -0
  84. package/dist/DotDensityMap.cjs.map +1 -0
  85. package/dist/DotDensityMap.js +600 -1
  86. package/dist/DotDensityMap.js.map +1 -1
  87. package/dist/DropdownSelect-0I2QxaVy.cjs +29 -0
  88. package/dist/DropdownSelect-0I2QxaVy.cjs.map +1 -0
  89. package/dist/DropdownSelect-CDC9lEqU.js +4193 -0
  90. package/dist/DropdownSelect-CDC9lEqU.js.map +1 -0
  91. package/dist/DualAxisLineChart.cjs +2 -0
  92. package/dist/DualAxisLineChart.cjs.map +1 -0
  93. package/dist/DualAxisLineChart.js +699 -1
  94. package/dist/DualAxisLineChart.js.map +1 -1
  95. package/dist/DumbbellChart.cjs +2 -0
  96. package/dist/DumbbellChart.cjs.map +1 -0
  97. package/dist/DumbbellChart.js +1510 -1
  98. package/dist/DumbbellChart.js.map +1 -1
  99. package/dist/{EmptyState-b2Ln487i.js → EmptyState-DdTp-Mdn.js} +8 -8
  100. package/dist/{EmptyState-b2Ln487i.js.map → EmptyState-DdTp-Mdn.js.map} +1 -1
  101. package/dist/EmptyState-d8_8SxeW.cjs +2 -0
  102. package/dist/{EmptyState-BQguKAp5.cjs.map → EmptyState-d8_8SxeW.cjs.map} +1 -1
  103. package/dist/ExcelDownloadButton.cjs +2 -0
  104. package/dist/ExcelDownloadButton.cjs.map +1 -0
  105. package/dist/ExcelDownloadButton.js +29 -1
  106. package/dist/ExcelDownloadButton.js.map +1 -1
  107. package/dist/FootNote.cjs +2 -0
  108. package/dist/FootNote.cjs.map +1 -0
  109. package/dist/FootNote.js +20 -1
  110. package/dist/FootNote.js.map +1 -1
  111. package/dist/GeoHubCompareMaps.cjs +2 -0
  112. package/dist/GeoHubCompareMaps.cjs.map +1 -0
  113. package/dist/GeoHubCompareMaps.js +370 -1
  114. package/dist/GeoHubCompareMaps.js.map +1 -1
  115. package/dist/GeoHubMap.cjs +2 -0
  116. package/dist/GeoHubMap.cjs.map +1 -0
  117. package/dist/GeoHubMap.js +429 -1
  118. package/dist/GeoHubMap.js.map +1 -1
  119. package/dist/GeoHubMapWithLayerSelection.cjs +2 -0
  120. package/dist/GeoHubMapWithLayerSelection.cjs.map +1 -0
  121. package/dist/GeoHubMapWithLayerSelection.js +307 -1
  122. package/dist/GeoHubMapWithLayerSelection.js.map +1 -1
  123. package/dist/GraphDescription.cjs +2 -0
  124. package/dist/GraphDescription.cjs.map +1 -0
  125. package/dist/GraphDescription.js +20 -1
  126. package/dist/GraphDescription.js.map +1 -1
  127. package/dist/GraphFooter.cjs +2 -0
  128. package/dist/GraphFooter.cjs.map +1 -0
  129. package/dist/GraphFooter.js +21 -1
  130. package/dist/GraphFooter.js.map +1 -1
  131. package/dist/GraphHeader.cjs +2 -0
  132. package/dist/GraphHeader.cjs.map +1 -0
  133. package/dist/GraphHeader.js +63 -1
  134. package/dist/GraphHeader.js.map +1 -1
  135. package/dist/GraphTitle.cjs +2 -0
  136. package/dist/GraphTitle.cjs.map +1 -0
  137. package/dist/GraphTitle.js +28 -1
  138. package/dist/GraphTitle.js.map +1 -1
  139. package/dist/GriddedGraphs.cjs +2 -0
  140. package/dist/GriddedGraphs.cjs.map +1 -0
  141. package/dist/GriddedGraphs.js +482 -1
  142. package/dist/GriddedGraphs.js.map +1 -1
  143. package/dist/GriddedGraphsFromConfig.cjs +2 -0
  144. package/dist/GriddedGraphsFromConfig.cjs.map +1 -0
  145. package/dist/GriddedGraphsFromConfig.js +42 -1
  146. package/dist/GriddedGraphsFromConfig.js.map +1 -1
  147. package/dist/HeatMap.cjs +2 -0
  148. package/dist/HeatMap.cjs.map +1 -0
  149. package/dist/HeatMap.js +451 -1
  150. package/dist/HeatMap.js.map +1 -1
  151. package/dist/Histogram.cjs +2 -0
  152. package/dist/Histogram.cjs.map +1 -0
  153. package/dist/Histogram.js +287 -1
  154. package/dist/Histogram.js.map +1 -1
  155. package/dist/ImageDownloadButton.cjs +2 -0
  156. package/dist/ImageDownloadButton.cjs.map +1 -0
  157. package/dist/ImageDownloadButton.js +28 -1
  158. package/dist/ImageDownloadButton.js.map +1 -1
  159. package/dist/LineChartWithConfidenceInterval.cjs +2 -0
  160. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -0
  161. package/dist/LineChartWithConfidenceInterval.js +818 -1
  162. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  163. package/dist/LinearColorLegend.cjs +2 -0
  164. package/dist/LinearColorLegend.cjs.map +1 -0
  165. package/dist/LinearColorLegend.js +33 -1
  166. package/dist/LinearColorLegend.js.map +1 -1
  167. package/dist/Modal-CUU6ZK3U.js +1019 -0
  168. package/dist/Modal-CUU6ZK3U.js.map +1 -0
  169. package/dist/Modal-C_dl0EtQ.cjs +46 -0
  170. package/dist/Modal-C_dl0EtQ.cjs.map +1 -0
  171. package/dist/MultiGraphDashboard.cjs +2 -0
  172. package/dist/MultiGraphDashboard.cjs.map +1 -0
  173. package/dist/MultiGraphDashboard.js +303 -1
  174. package/dist/MultiGraphDashboard.js.map +1 -1
  175. package/dist/MultiGraphDashboardFromConfig.cjs +2 -0
  176. package/dist/MultiGraphDashboardFromConfig.cjs.map +1 -0
  177. package/dist/MultiGraphDashboardFromConfig.js +37 -1
  178. package/dist/MultiGraphDashboardFromConfig.js.map +1 -1
  179. package/dist/MultiGraphDashboardWideToLongFormat.cjs +2 -0
  180. package/dist/MultiGraphDashboardWideToLongFormat.cjs.map +1 -0
  181. package/dist/MultiGraphDashboardWideToLongFormat.js +243 -1
  182. package/dist/MultiGraphDashboardWideToLongFormat.js.map +1 -1
  183. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +2 -0
  184. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs.map +1 -0
  185. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +30 -1
  186. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js.map +1 -1
  187. package/dist/MultiLineAltChart.cjs +2 -0
  188. package/dist/MultiLineAltChart.cjs.map +1 -0
  189. package/dist/MultiLineAltChart.js +689 -1
  190. package/dist/MultiLineAltChart.js.map +1 -1
  191. package/dist/MultiLineChart.cjs +2 -0
  192. package/dist/MultiLineChart.cjs.map +1 -0
  193. package/dist/MultiLineChart.js +722 -1
  194. package/dist/MultiLineChart.js.map +1 -1
  195. package/dist/ParetoChart.cjs +2 -0
  196. package/dist/ParetoChart.cjs.map +1 -0
  197. package/dist/ParetoChart.js +636 -1
  198. package/dist/ParetoChart.js.map +1 -1
  199. package/dist/RadarChart.cjs +2 -0
  200. package/dist/RadarChart.cjs.map +1 -0
  201. package/dist/RadarChart.js +677 -1
  202. package/dist/RadarChart.js.map +1 -1
  203. package/dist/{ReferenceLine-BgDdQbDI.js → ReferenceLine-C1GpoG9d.js} +33 -34
  204. package/dist/ReferenceLine-C1GpoG9d.js.map +1 -0
  205. package/dist/ReferenceLine-CuFMk0cI.cjs +2 -0
  206. package/dist/ReferenceLine-CuFMk0cI.cjs.map +1 -0
  207. package/dist/RegressionLine-7_rKTHN_.cjs +2 -0
  208. package/dist/{RegressionLine-BfpCuD7B.cjs.map → RegressionLine-7_rKTHN_.cjs.map} +1 -1
  209. package/dist/{RegressionLine-cSljpHaE.js → RegressionLine-BFwDCTUU.js} +17 -18
  210. package/dist/{RegressionLine-cSljpHaE.js.map → RegressionLine-BFwDCTUU.js.map} +1 -1
  211. package/dist/SVGDownloadButton.cjs +2 -0
  212. package/dist/SVGDownloadButton.cjs.map +1 -0
  213. package/dist/SVGDownloadButton.js +28 -1
  214. package/dist/SVGDownloadButton.js.map +1 -1
  215. package/dist/SankeyChart.cjs +2 -0
  216. package/dist/SankeyChart.cjs.map +1 -0
  217. package/dist/SankeyChart.js +989 -1
  218. package/dist/SankeyChart.js.map +1 -1
  219. package/dist/ScatterPlot.cjs +2 -0
  220. package/dist/ScatterPlot.cjs.map +1 -0
  221. package/dist/ScatterPlot.js +828 -1
  222. package/dist/ScatterPlot.js.map +1 -1
  223. package/dist/ScrollStory.cjs +2 -0
  224. package/dist/ScrollStory.cjs.map +1 -0
  225. package/dist/ScrollStory.js +105 -1
  226. package/dist/ScrollStory.js.map +1 -1
  227. package/dist/SimpleLineChart.cjs +2 -0
  228. package/dist/SimpleLineChart.cjs.map +1 -0
  229. package/dist/SimpleLineChart.js +619 -1
  230. package/dist/SimpleLineChart.js.map +1 -1
  231. package/dist/SingleGraphDashboard.cjs +2 -0
  232. package/dist/SingleGraphDashboard.cjs.map +1 -0
  233. package/dist/SingleGraphDashboard.js +522 -1
  234. package/dist/SingleGraphDashboard.js.map +1 -1
  235. package/dist/SingleGraphDashboardFromConfig.cjs +2 -0
  236. package/dist/SingleGraphDashboardFromConfig.cjs.map +1 -0
  237. package/dist/SingleGraphDashboardFromConfig.js +34 -1
  238. package/dist/SingleGraphDashboardFromConfig.js.map +1 -1
  239. package/dist/SlopeChart.cjs +2 -0
  240. package/dist/SlopeChart.cjs.map +1 -0
  241. package/dist/SlopeChart.js +582 -1
  242. package/dist/SlopeChart.js.map +1 -1
  243. package/dist/Source.cjs +2 -0
  244. package/dist/Source.cjs.map +1 -0
  245. package/dist/Source.js +40 -1
  246. package/dist/Source.js.map +1 -1
  247. package/dist/SparkLine.cjs +2 -0
  248. package/dist/SparkLine.cjs.map +1 -0
  249. package/dist/SparkLine.js +320 -1
  250. package/dist/SparkLine.js.map +1 -1
  251. package/dist/Spinner-C85UF28E.js +30 -0
  252. package/dist/Spinner-C85UF28E.js.map +1 -0
  253. package/dist/Spinner-DA6Z5E4n.cjs +2 -0
  254. package/dist/Spinner-DA6Z5E4n.cjs.map +1 -0
  255. package/dist/StatCardFromData.cjs +2 -0
  256. package/dist/StatCardFromData.cjs.map +1 -0
  257. package/dist/StatCardFromData.js +249 -1
  258. package/dist/StatCardFromData.js.map +1 -1
  259. package/dist/StripChart.cjs +2 -0
  260. package/dist/StripChart.cjs.map +1 -0
  261. package/dist/StripChart.js +988 -1
  262. package/dist/StripChart.js.map +1 -1
  263. package/dist/ThreeDGlobe.cjs +2 -0
  264. package/dist/ThreeDGlobe.cjs.map +1 -0
  265. package/dist/ThreeDGlobe.js +451 -1
  266. package/dist/ThreeDGlobe.js.map +1 -1
  267. package/dist/ThresholdColorLegendWithMouseOver.cjs +2 -0
  268. package/dist/ThresholdColorLegendWithMouseOver.cjs.map +1 -0
  269. package/dist/ThresholdColorLegendWithMouseOver.js +130 -1
  270. package/dist/ThresholdColorLegendWithMouseOver.js.map +1 -1
  271. package/dist/{Tooltip-CzZ1wFyF.js → Tooltip-DyM5snqx.js} +15 -16
  272. package/dist/{Tooltip-CzZ1wFyF.js.map → Tooltip-DyM5snqx.js.map} +1 -1
  273. package/dist/Tooltip-n8z5bfav.cjs +2 -0
  274. package/dist/{Tooltip-BM18N_3l.cjs.map → Tooltip-n8z5bfav.cjs.map} +1 -1
  275. package/dist/TreeMapGraph.cjs +2 -0
  276. package/dist/TreeMapGraph.cjs.map +1 -0
  277. package/dist/TreeMapGraph.js +760 -1
  278. package/dist/TreeMapGraph.js.map +1 -1
  279. package/dist/Types.cjs +2 -0
  280. package/dist/Types.cjs.map +1 -0
  281. package/dist/Types.js +1 -1
  282. package/dist/Typography-Ctgfl1J5.js +140 -0
  283. package/dist/Typography-Ctgfl1J5.js.map +1 -0
  284. package/dist/Typography-k-kOjICQ.cjs +2 -0
  285. package/dist/Typography-k-kOjICQ.cjs.map +1 -0
  286. package/dist/UnitChart.cjs +2 -0
  287. package/dist/UnitChart.cjs.map +1 -0
  288. package/dist/UnitChart.js +216 -1
  289. package/dist/UnitChart.js.map +1 -1
  290. package/dist/XAxesLabels-CJMQbfVy.cjs +2 -0
  291. package/dist/{XAxesLabels-C9REbQQs.cjs.map → XAxesLabels-CJMQbfVy.cjs.map} +1 -1
  292. package/dist/{XAxesLabels-DVw7Lvuz.js → XAxesLabels-DQFo_z2R.js} +21 -22
  293. package/dist/{XAxesLabels-DVw7Lvuz.js.map → XAxesLabels-DQFo_z2R.js.map} +1 -1
  294. package/dist/{XTicksAndGridLines-CUefTINd.js → XTicksAndGridLines-Bn9u5gOM.js} +19 -20
  295. package/dist/{XTicksAndGridLines-CUefTINd.js.map → XTicksAndGridLines-Bn9u5gOM.js.map} +1 -1
  296. package/dist/XTicksAndGridLines-CCzXIV8d.cjs +2 -0
  297. package/dist/{XTicksAndGridLines-DuK35ROS.cjs.map → XTicksAndGridLines-CCzXIV8d.cjs.map} +1 -1
  298. package/dist/YAxesLabels-BXLTX7AI.cjs +2 -0
  299. package/dist/{YAxesLabels-DhBdLk3Z.cjs.map → YAxesLabels-BXLTX7AI.cjs.map} +1 -1
  300. package/dist/{YAxesLabels-CYVY053X.js → YAxesLabels-H5-002X5.js} +11 -12
  301. package/dist/{YAxesLabels-CYVY053X.js.map → YAxesLabels-H5-002X5.js.map} +1 -1
  302. package/dist/{YTicksAndGridLines-BJRXuBdC.js → YTicksAndGridLines-B6ah7CRf.js} +14 -15
  303. package/dist/{YTicksAndGridLines-BJRXuBdC.js.map → YTicksAndGridLines-B6ah7CRf.js.map} +1 -1
  304. package/dist/YTicksAndGridLines-DBDuz6vb.cjs +2 -0
  305. package/dist/{YTicksAndGridLines-CtLvzExe.cjs.map → YTicksAndGridLines-DBDuz6vb.cjs.map} +1 -1
  306. package/dist/{checkIfMultiple-CaefP4X2.js → checkIfMultiple-BB7PlCNh.js} +1013 -518
  307. package/dist/checkIfMultiple-BB7PlCNh.js.map +1 -0
  308. package/dist/checkIfMultiple-D5ysrI7G.cjs +12 -0
  309. package/dist/checkIfMultiple-D5ysrI7G.cjs.map +1 -0
  310. package/dist/checkIfNullOrUndefined-BCW3Y1ML.cjs +2 -0
  311. package/dist/checkIfNullOrUndefined-BCW3Y1ML.cjs.map +1 -0
  312. package/dist/checkIfNullOrUndefined-DmfiKkNw.js +7 -0
  313. package/dist/checkIfNullOrUndefined-DmfiKkNw.js.map +1 -0
  314. package/dist/customArea-BYNyxAkm.cjs +2 -0
  315. package/dist/{customArea-B47Ew5cT.cjs.map → customArea-BYNyxAkm.cjs.map} +1 -1
  316. package/dist/{customArea-I3MsoqIl.js → customArea-CaxScFmW.js} +29 -30
  317. package/dist/{customArea-I3MsoqIl.js.map → customArea-CaxScFmW.js.map} +1 -1
  318. package/dist/excelDownload-BOA-lskf.js +19 -0
  319. package/dist/excelDownload-BOA-lskf.js.map +1 -0
  320. package/dist/excelDownload-BQpsCa62.cjs +2 -0
  321. package/dist/excelDownload-BQpsCa62.cjs.map +1 -0
  322. package/dist/fetchAndParseData-Bcmr659B.js +1196 -0
  323. package/dist/fetchAndParseData-Bcmr659B.js.map +1 -0
  324. package/dist/fetchAndParseData-DmgQtB9n.cjs +16 -0
  325. package/dist/fetchAndParseData-DmgQtB9n.cjs.map +1 -0
  326. package/dist/fetchAndParseData.cjs +2 -0
  327. package/dist/fetchAndParseData.cjs.map +1 -0
  328. package/dist/fetchAndParseData.js +9 -15
  329. package/dist/fetchAndParseData.js.map +1 -1
  330. package/dist/getGraphList-DuColTJM.js +265 -0
  331. package/dist/getGraphList-DuColTJM.js.map +1 -0
  332. package/dist/getGraphList-gf02xgT2.cjs +2 -0
  333. package/dist/getGraphList-gf02xgT2.cjs.map +1 -0
  334. package/dist/getJenks-TWQvbuOz.cjs +2 -0
  335. package/dist/getJenks-TWQvbuOz.cjs.map +1 -0
  336. package/dist/getJenks-VhM3GIoC.js +23 -0
  337. package/dist/getJenks-VhM3GIoC.js.map +1 -0
  338. package/dist/getSchema.cjs +2 -0
  339. package/dist/getSchema.cjs.map +1 -0
  340. package/dist/getSchema.js +910 -1
  341. package/dist/getSchema.js.map +1 -1
  342. package/dist/getSliderMarks-C0jptXeP.js +1054 -0
  343. package/dist/getSliderMarks-C0jptXeP.js.map +1 -0
  344. package/dist/getSliderMarks-CtsEXiLV.cjs +6 -0
  345. package/dist/getSliderMarks-CtsEXiLV.cjs.map +1 -0
  346. package/dist/getTextColorBasedOnBgColor-B6Nk2WBf.js +28 -0
  347. package/dist/getTextColorBasedOnBgColor-B6Nk2WBf.js.map +1 -0
  348. package/dist/getTextColorBasedOnBgColor-nqY-bsM_.cjs +2 -0
  349. package/dist/getTextColorBasedOnBgColor-nqY-bsM_.cjs.map +1 -0
  350. package/dist/getUniqValue-BtUENB2H.js +20 -0
  351. package/dist/getUniqValue-BtUENB2H.js.map +1 -0
  352. package/dist/getUniqValue-CHqgSss5.cjs +2 -0
  353. package/dist/getUniqValue-CHqgSss5.cjs.map +1 -0
  354. package/dist/imageDownload-CgDcm1Sj.cjs +3 -0
  355. package/dist/imageDownload-CgDcm1Sj.cjs.map +1 -0
  356. package/dist/imageDownload-Dcci2LEy.js +495 -0
  357. package/dist/imageDownload-Dcci2LEy.js.map +1 -0
  358. package/dist/index-BVnYktl4.js +435 -0
  359. package/dist/index-BVnYktl4.js.map +1 -0
  360. package/dist/index-BW_-wD2k.cjs +2 -0
  361. package/dist/index-BW_-wD2k.cjs.map +1 -0
  362. package/dist/{index-DXmF_0ez.js → index-BmCqpO1B.js} +74 -40
  363. package/dist/index-BmCqpO1B.js.map +1 -0
  364. package/dist/{index-Db-Yg_Ud.js → index-BxAUvrua.js} +19 -19
  365. package/dist/{index-Db-Yg_Ud.js.map → index-BxAUvrua.js.map} +1 -1
  366. package/dist/index-CHPV5EwG-BPSP-7Jg.js +3341 -0
  367. package/dist/index-CHPV5EwG-BPSP-7Jg.js.map +1 -0
  368. package/dist/index-CHPV5EwG-DDoeWRVt.cjs +44 -0
  369. package/dist/index-CHPV5EwG-DDoeWRVt.cjs.map +1 -0
  370. package/dist/index-CylX-pWB.cjs +2 -0
  371. package/dist/{index-BYroABPm.cjs.map → index-CylX-pWB.cjs.map} +1 -1
  372. package/dist/index-D9h2WYDS.cjs +22 -0
  373. package/dist/index-D9h2WYDS.cjs.map +1 -0
  374. package/dist/index-DG3YrCr5-D3FrrXj8.js +459 -0
  375. package/dist/index-DG3YrCr5-D3FrrXj8.js.map +1 -0
  376. package/dist/index-DG3YrCr5-v7rayV3N.cjs +2 -0
  377. package/dist/index-DG3YrCr5-v7rayV3N.cjs.map +1 -0
  378. package/dist/index-DVOJ7vxH.cjs +10 -0
  379. package/dist/{index-a2C2Bqn2.cjs.map → index-DVOJ7vxH.cjs.map} +1 -1
  380. package/dist/index-D_n8aamX.cjs +2 -0
  381. package/dist/index-D_n8aamX.cjs.map +1 -0
  382. package/dist/index-OCoyy1wG.js +635 -0
  383. package/dist/index-OCoyy1wG.js.map +1 -0
  384. package/dist/{index-DzdwZ2OA.js → index-n_RI8T0n.js} +3 -3
  385. package/dist/{index-DzdwZ2OA.js.map → index-n_RI8T0n.js.map} +1 -1
  386. package/dist/index-tvAyXPPW-DBlMKnNB.js +47 -0
  387. package/dist/index-tvAyXPPW-DBlMKnNB.js.map +1 -0
  388. package/dist/index-tvAyXPPW-DPOG-C2i.cjs +2 -0
  389. package/dist/index-tvAyXPPW-DPOG-C2i.cjs.map +1 -0
  390. package/dist/index.cjs +2 -0
  391. package/dist/index.cjs.map +1 -0
  392. package/dist/index.d.ts +1 -5
  393. package/dist/index.js +180 -1
  394. package/dist/index.js.map +1 -1
  395. package/dist/numberFormattingFunction-02t-wJta.cjs +2 -0
  396. package/dist/numberFormattingFunction-02t-wJta.cjs.map +1 -0
  397. package/dist/numberFormattingFunction-14YCbkN2.js +13 -0
  398. package/dist/numberFormattingFunction-14YCbkN2.js.map +1 -0
  399. package/dist/{use-in-view-CZPXmTZM.js → proxy-DJxJg1kD.js} +699 -732
  400. package/dist/proxy-DJxJg1kD.js.map +1 -0
  401. package/dist/{use-in-view-Dl1CsAIo.cjs → proxy-PQd2AItT.cjs} +2 -2
  402. package/dist/proxy-PQd2AItT.cjs.map +1 -0
  403. package/dist/removeOutliers-DR48e-18.js +57 -0
  404. package/dist/removeOutliers-DR48e-18.js.map +1 -0
  405. package/dist/removeOutliers-WELHHqiI.cjs +2 -0
  406. package/dist/removeOutliers-WELHHqiI.cjs.map +1 -0
  407. package/dist/{string2HTML-BX0oNw83.js → string2HTML-CWHGfz_d.js} +2 -2
  408. package/dist/{string2HTML-BX0oNw83.js.map → string2HTML-CWHGfz_d.js.map} +1 -1
  409. package/dist/{string2HTML-X4ZYX5jI.cjs → string2HTML-D2Avudmb.cjs} +2 -2
  410. package/dist/{string2HTML-X4ZYX5jI.cjs.map → string2HTML-D2Avudmb.cjs.map} +1 -1
  411. package/dist/svgDownload-C2-E3yf2.js +9 -0
  412. package/dist/svgDownload-C2-E3yf2.js.map +1 -0
  413. package/dist/svgDownload-D9zEGjTF.cjs +2 -0
  414. package/dist/svgDownload-D9zEGjTF.cjs.map +1 -0
  415. package/dist/toConsumableArray-DiWOvh_d-DcLaZvDq.cjs +4 -0
  416. package/dist/toConsumableArray-DiWOvh_d-DcLaZvDq.cjs.map +1 -0
  417. package/dist/toConsumableArray-DiWOvh_d-DlpOlgap.js +145 -0
  418. package/dist/toConsumableArray-DiWOvh_d-DlpOlgap.js.map +1 -0
  419. package/dist/transformData.cjs +2 -0
  420. package/dist/transformData.cjs.map +1 -0
  421. package/dist/transformData.d.ts +170 -0
  422. package/dist/transformData.js +10 -0
  423. package/dist/transformData.js.map +1 -0
  424. package/dist/transformDataForAggregation-BUGJnson.cjs +2 -0
  425. package/dist/transformDataForAggregation-BUGJnson.cjs.map +1 -0
  426. package/dist/transformDataForAggregation-DAQJWGNL.js +759 -0
  427. package/dist/transformDataForAggregation-DAQJWGNL.js.map +1 -0
  428. package/dist/transformDataForGraphFromFile-CrntpaMU.cjs +2 -0
  429. package/dist/transformDataForGraphFromFile-CrntpaMU.cjs.map +1 -0
  430. package/dist/transformDataForGraphFromFile-DdNiOWeC.js +24 -0
  431. package/dist/transformDataForGraphFromFile-DdNiOWeC.js.map +1 -0
  432. package/dist/use-in-view-BAHrBy6b.js +40 -0
  433. package/dist/use-in-view-BAHrBy6b.js.map +1 -0
  434. package/dist/use-in-view-BCmzDU2O.cjs +2 -0
  435. package/dist/use-in-view-BCmzDU2O.cjs.map +1 -0
  436. package/dist/utils.cjs +2 -0
  437. package/dist/utils.cjs.map +1 -0
  438. package/dist/utils.d.ts +217 -0
  439. package/dist/utils.js +27 -0
  440. package/dist/utils.js.map +1 -0
  441. package/dist/validateSchema.cjs +2 -0
  442. package/dist/validateSchema.cjs.map +1 -0
  443. package/dist/validateSchema.js +104 -1
  444. package/dist/validateSchema.js.map +1 -1
  445. package/dist/x-CnsEH4Ox-CGGXQl4M.cjs +27 -0
  446. package/dist/x-CnsEH4Ox-CGGXQl4M.cjs.map +1 -0
  447. package/dist/x-CnsEH4Ox-DDvAJndW.js +101 -0
  448. package/dist/x-CnsEH4Ox-DDvAJndW.js.map +1 -0
  449. package/package.json +15 -90
  450. package/dist/Axis-BlyBRMNw.cjs +0 -2
  451. package/dist/AxisTitle-BY8MI9jC.cjs +0 -2
  452. package/dist/AxisTitle-BeMxcw5I.js +0 -21
  453. package/dist/DropdownSelect-CuzV7gdj.cjs +0 -29
  454. package/dist/DropdownSelect-CuzV7gdj.cjs.map +0 -1
  455. package/dist/DropdownSelect-DmZsXrhY.js +0 -2698
  456. package/dist/DropdownSelect-DmZsXrhY.js.map +0 -1
  457. package/dist/EmptyState-BQguKAp5.cjs +0 -2
  458. package/dist/Modal-C9txyGOk.js +0 -723
  459. package/dist/Modal-C9txyGOk.js.map +0 -1
  460. package/dist/Modal-cQF2UQIa.cjs +0 -46
  461. package/dist/Modal-cQF2UQIa.cjs.map +0 -1
  462. package/dist/ReferenceLine-BgDdQbDI.js.map +0 -1
  463. package/dist/ReferenceLine-Bsb5jeE4.cjs +0 -2
  464. package/dist/ReferenceLine-Bsb5jeE4.cjs.map +0 -1
  465. package/dist/RegressionLine-BfpCuD7B.cjs +0 -2
  466. package/dist/Spinner-DN3s4S0H.js +0 -17
  467. package/dist/Spinner-DN3s4S0H.js.map +0 -1
  468. package/dist/Spinner-UmN-KPe9.cjs +0 -2
  469. package/dist/Spinner-UmN-KPe9.cjs.map +0 -1
  470. package/dist/Tooltip-BM18N_3l.cjs +0 -2
  471. package/dist/Typography-CDR-DAHH.cjs +0 -2
  472. package/dist/Typography-CDR-DAHH.cjs.map +0 -1
  473. package/dist/Typography-XJoSE-By.js +0 -58
  474. package/dist/Typography-XJoSE-By.js.map +0 -1
  475. package/dist/XAxesLabels-C9REbQQs.cjs +0 -2
  476. package/dist/XTicksAndGridLines-DuK35ROS.cjs +0 -2
  477. package/dist/YAxesLabels-DhBdLk3Z.cjs +0 -2
  478. package/dist/YTicksAndGridLines-CtLvzExe.cjs +0 -2
  479. package/dist/checkIfMultiple-CaefP4X2.js.map +0 -1
  480. package/dist/checkIfMultiple-D3h8to1T.cjs +0 -12
  481. package/dist/checkIfMultiple-D3h8to1T.cjs.map +0 -1
  482. package/dist/checkIfNullOrUndefined.d.ts +0 -15
  483. package/dist/checkIfNullOrUndefined.js +0 -2
  484. package/dist/checkIfNullOrUndefined.js.map +0 -1
  485. package/dist/customArea-B47Ew5cT.cjs +0 -2
  486. package/dist/excelDownload.d.ts +0 -31
  487. package/dist/excelDownload.js +0 -2
  488. package/dist/excelDownload.js.map +0 -1
  489. package/dist/generateCodes.d.ts +0 -25
  490. package/dist/generateCodes.js +0 -2
  491. package/dist/generateCodes.js.map +0 -1
  492. package/dist/getJenks.d.ts +0 -17
  493. package/dist/getJenks.js +0 -2
  494. package/dist/getJenks.js.map +0 -1
  495. package/dist/getPercentileValue.d.ts +0 -13
  496. package/dist/getPercentileValue.js +0 -2
  497. package/dist/getPercentileValue.js.map +0 -1
  498. package/dist/getQueryParamsFromLink.d.ts +0 -18
  499. package/dist/getQueryParamsFromLink.js +0 -2
  500. package/dist/getQueryParamsFromLink.js.map +0 -1
  501. package/dist/getSliderMarks-CWajGCGq.js +0 -719
  502. package/dist/getSliderMarks-CWajGCGq.js.map +0 -1
  503. package/dist/getSliderMarks-DDJ1CdhL.cjs +0 -6
  504. package/dist/getSliderMarks-DDJ1CdhL.cjs.map +0 -1
  505. package/dist/getTextColorBasedOnBgColor.d.ts +0 -13
  506. package/dist/getTextColorBasedOnBgColor.js +0 -2
  507. package/dist/getTextColorBasedOnBgColor.js.map +0 -1
  508. package/dist/getUniqValue.d.ts +0 -18
  509. package/dist/getUniqValue.js +0 -2
  510. package/dist/getUniqValue.js.map +0 -1
  511. package/dist/graphList.d.ts +0 -9
  512. package/dist/graphList.js +0 -2
  513. package/dist/graphList.js.map +0 -1
  514. package/dist/imageDownload.d.ts +0 -16
  515. package/dist/imageDownload.js +0 -3
  516. package/dist/imageDownload.js.map +0 -1
  517. package/dist/index-01r5X3Gr-9jE0ObrK.cjs +0 -2
  518. package/dist/index-01r5X3Gr-9jE0ObrK.cjs.map +0 -1
  519. package/dist/index-01r5X3Gr-kH7FxQ7P.js +0 -451
  520. package/dist/index-01r5X3Gr-kH7FxQ7P.js.map +0 -1
  521. package/dist/index-BGMGC-HN.cjs +0 -22
  522. package/dist/index-BGMGC-HN.cjs.map +0 -1
  523. package/dist/index-BHm2KTjD-2e-Fu8L-.js +0 -702
  524. package/dist/index-BHm2KTjD-2e-Fu8L-.js.map +0 -1
  525. package/dist/index-BHm2KTjD-D8FylaKc.cjs +0 -44
  526. package/dist/index-BHm2KTjD-D8FylaKc.cjs.map +0 -1
  527. package/dist/index-BIPNFFja.js +0 -506
  528. package/dist/index-BIPNFFja.js.map +0 -1
  529. package/dist/index-BYroABPm.cjs +0 -2
  530. package/dist/index-CEc_9zWy.cjs +0 -2
  531. package/dist/index-CEc_9zWy.cjs.map +0 -1
  532. package/dist/index-CbVeVrla.cjs +0 -2
  533. package/dist/index-CbVeVrla.cjs.map +0 -1
  534. package/dist/index-CqzhBPuO-CfQywbdq.js +0 -41
  535. package/dist/index-CqzhBPuO-CfQywbdq.js.map +0 -1
  536. package/dist/index-CqzhBPuO-raKZqS7l.cjs +0 -2
  537. package/dist/index-CqzhBPuO-raKZqS7l.cjs.map +0 -1
  538. package/dist/index-DSnvdkHZ.js +0 -495
  539. package/dist/index-DSnvdkHZ.js.map +0 -1
  540. package/dist/index-DXmF_0ez.js.map +0 -1
  541. package/dist/index-a2C2Bqn2.cjs +0 -10
  542. package/dist/numberFormattingFunction.d.ts +0 -22
  543. package/dist/numberFormattingFunction.js +0 -2
  544. package/dist/numberFormattingFunction.js.map +0 -1
  545. package/dist/removeOutliers.d.ts +0 -16
  546. package/dist/removeOutliers.js +0 -2
  547. package/dist/removeOutliers.js.map +0 -1
  548. package/dist/svgDownload.d.ts +0 -16
  549. package/dist/svgDownload.js +0 -2
  550. package/dist/svgDownload.js.map +0 -1
  551. package/dist/toConsumableArray-BSMMWi3w-Cu4vcE-m.js +0 -139
  552. package/dist/toConsumableArray-BSMMWi3w-Cu4vcE-m.js.map +0 -1
  553. package/dist/toConsumableArray-BSMMWi3w-DJL7-zAp.cjs +0 -4
  554. package/dist/toConsumableArray-BSMMWi3w-DJL7-zAp.cjs.map +0 -1
  555. package/dist/transformColumnsToArray.d.ts +0 -38
  556. package/dist/transformColumnsToArray.js +0 -2
  557. package/dist/transformColumnsToArray.js.map +0 -1
  558. package/dist/transformDataForAggregation.d.ts +0 -38
  559. package/dist/transformDataForAggregation.js +0 -2
  560. package/dist/transformDataForAggregation.js.map +0 -1
  561. package/dist/transformDataForGraph.d.ts +0 -47
  562. package/dist/transformDataForGraph.js +0 -2
  563. package/dist/transformDataForGraph.js.map +0 -1
  564. package/dist/transformDataForGraphFromFile.d.ts +0 -66
  565. package/dist/transformDataForGraphFromFile.js +0 -2
  566. package/dist/transformDataForGraphFromFile.js.map +0 -1
  567. package/dist/use-in-view-CZPXmTZM.js.map +0 -1
  568. package/dist/use-in-view-Dl1CsAIo.cjs.map +0 -1
  569. package/dist/x-Dft9NVe_-DcB7wtv5.js +0 -61
  570. package/dist/x-Dft9NVe_-DcB7wtv5.js.map +0 -1
  571. package/dist/x-Dft9NVe_-LeyJu02C.cjs +0 -27
  572. package/dist/x-Dft9NVe_-LeyJu02C.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ThreeDGlobe.js","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":"uhCAiDA,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,EACA,UAAAC,EACA,UAAAC,CAAA,EACE/B,EACEgC,EAAUC,EAAAA,OAAiC,MAAS,EACpD,CAACC,EAAgBC,CAAiB,EAAIC,EAAAA,SAAc,MAAS,EAC7D,CAACC,EAAYC,CAAa,EAAIF,EAAAA,SAAS,EAAEnC,EAAQ,IAAI,EACrD,CAACsC,EAAUC,CAAW,EAAIJ,EAAAA,SAAS,CAAE,EAAG,EAAG,EAAG,EAAG,EACjD,CAACK,EAAeC,EAAgB,EAAIN,EAAAA,SAA4C,MAAS,EACzFO,EAAatC,EACfuC,GAAAA,QAAA,EAAwC,OAAOtC,CAAW,EAAE,MAAMC,CAAM,EACxEsC,GAAAA,YACG,OAAOvC,CAAuB,EAC9B,MAAMC,CAAM,EACnBuC,EAAAA,UAAU,IAAM,CACVd,GAAS,UACXA,EAAQ,QAAQ,SAAA,EAAW,WAAa9B,IAAe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4BAAAD,EACA,eAAAH,EACA,kBAAAE,EACA,mBAAAD,EACA,MAAAI,EACA,gBAAAE,EACA,UAAWX,EAAY,CAAC,EACxB,UAAWA,EAAY,CAAC,CAAA,CAAA,EAG1BmC,EAAAA,kBAAAA,IAAC,MAAA,CACC,MAAO,CACL,OAAQ,GAAG,KAAK,IACdiC,EACA7E,IACGyE,EACGI,GACGrF,GAAS0F,GAAYT,EAAiBI,GACpCrF,GAAS0F,GAAYT,EACtBI,GACDrF,GAAS0F,GAAYT,EACxBW,EAAA,CACP,IAAA,EAEH,UAAU,mCAEV,SAAAxC,EAAAA,kBAAAA,IAACwD,GAAAA,eAAAA,QAAA,CAAQ,aAAW,eAAA,CAAgB,CAAA,CAAA,CACtC,CAAA,EAGHlC,GAAWE,EACVxB,EAAAA,kBAAAA,IAACyD,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAU/F,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAA2D,EACA,SAAAE,EACA,MAAA5E,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
1
+ {"version":3,"file":"ThreeDGlobe.js","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":";;;;;;;;;;;;;;;;;;;;AAiDA,SAASA,GAAMC,GAAc;AAC3B,QAAM;AAAA,IACJ,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,MAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,QAAAC;AAAA,IACA,eAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,QAAAC;AAAA,IACA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AA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),g=require("react"),y=require("./Typography-k-kOjICQ.cjs"),p=require("./numberFormattingFunction-02t-wJta.cjs");function j(d){const{colorLegendTitle:x,colorDomain:s,colors:e,setSelectedColor:l,width:m,naColor:o,className:h,showNAColor:c}=d,[n,i]=g.useState(void 0),a=o?320:360;return r.jsxRuntimeExports.jsxs("div",{className:r.mo("flex flex-wrap gap-0 justify-center leading-0",h),style:{maxWidth:m?`${m}px`:"none"},"aria-label":"Color legend",children:[x&&x!==""?r.jsxRuntimeExports.jsx(y.u,{size:"sm",marginBottom:"2xs",className:"w-full text-center",children:x}):null,r.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 360 30",style:{maxWidth:"360px"},direction:"ltr",children:r.jsxRuntimeExports.jsxs("g",{children:[s.map((u,t)=>r.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{i(e[t]),l(e[t])},onMouseLeave:()=>{i(void 0),l(void 0)},className:"cursor-pointer",children:[r.jsxRuntimeExports.jsx("rect",{x:t*a/e.length+1,y:1,width:a/e.length-2,height:8,className:`stroke-1 ${n===e[t]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:e[t],...n!==e[t]?{stroke:e[t]}:{}}}),r.jsxRuntimeExports.jsx("text",{x:(t+1)*a/e.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"middle"},children:p.numberFormattingFunction(u,"NA",2,"","")})]},t)),r.jsxRuntimeExports.jsx("g",{children:r.jsxRuntimeExports.jsx("rect",{onMouseOver:()=>{i(e[s.length]),l(e[s.length])},onMouseLeave:()=>{i(void 0),l(void 0)},x:s.length*a/e.length+1,y:1,width:a/e.length-2,height:8,className:`cursor-pointer stroke-1 ${n===e[s.length]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:e[s.length],...n!==e[s.length]?{stroke:e[s.length]}:{}}})}),c?r.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{i(o||"#D4D6D8"),l(o||"#D4D6D8")},onMouseLeave:()=>{i(void 0),l(void 0)},className:"cursor-pointer",children:[r.jsxRuntimeExports.jsx("rect",{x:335,y:1,width:24,height:8,className:`stroke-1 ${n===o?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:o||"#D4D6D8",...n!==o?{stroke:o}:{},strokeWidth:1}}),r.jsxRuntimeExports.jsx("text",{x:337.5,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},children:"NA"})]}):null]})})]})}exports.ThresholdColorLegendWithMouseOver=j;
2
+ //# sourceMappingURL=ThresholdColorLegendWithMouseOver.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThresholdColorLegendWithMouseOver.cjs","sources":["../src/Components/Elements/ThresholdColorLegendWithMouseOver.tsx"],"sourcesContent":["import { useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { P } from '@undp/design-system-react/Typography';\r\n\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\n\r\ninterface Props {\r\n colors: string[];\r\n colorDomain: number[];\r\n colorLegendTitle?: string;\r\n setSelectedColor: (_d?: string) => void;\r\n width?: number;\r\n naColor?: string;\r\n className?: string;\r\n showNAColor: boolean;\r\n}\r\n\r\nexport function ThresholdColorLegendWithMouseOver(props: Props) {\r\n const {\r\n colorLegendTitle,\r\n colorDomain,\r\n colors,\r\n setSelectedColor,\r\n width,\r\n naColor,\r\n className,\r\n showNAColor,\r\n } = props;\r\n\r\n const [hoveredColor, setHoveredColor] = useState<string | undefined>(undefined);\r\n const mainColorWidth = naColor ? 320 : 360;\r\n return (\r\n <div\r\n className={cn('flex flex-wrap gap-0 justify-center leading-0', className)}\r\n style={{ maxWidth: width ? `${width}px` : 'none' }}\r\n aria-label='Color legend'\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P size='sm' marginBottom='2xs' className='w-full text-center'>\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n <svg width='100%' viewBox='0 0 360 30' style={{ maxWidth: '360px' }} direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g\r\n key={i}\r\n onMouseOver={() => {\r\n setHoveredColor(colors[i]);\r\n setSelectedColor(colors[i]);\r\n }}\r\n onMouseLeave={() => {\r\n setHoveredColor(undefined);\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={(i * mainColorWidth) / colors.length + 1}\r\n y={1}\r\n width={mainColorWidth / colors.length - 2}\r\n height={8}\r\n className={`stroke-1 ${\r\n hoveredColor === colors[i]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[i],\r\n ...(hoveredColor !== colors[i] ? { stroke: colors[i] } : {}),\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * mainColorWidth) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-sm'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA', 2, '', '')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n onMouseOver={() => {\r\n setHoveredColor(colors[colorDomain.length]);\r\n setSelectedColor(colors[colorDomain.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setHoveredColor(undefined);\r\n setSelectedColor(undefined);\r\n }}\r\n x={(colorDomain.length * mainColorWidth) / colors.length + 1}\r\n y={1}\r\n width={mainColorWidth / colors.length - 2}\r\n height={8}\r\n className={`cursor-pointer stroke-1 ${\r\n hoveredColor === colors[colorDomain.length]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n ...(hoveredColor !== colors[colorDomain.length]\r\n ? { stroke: colors[colorDomain.length] }\r\n : {}),\r\n }}\r\n />\r\n </g>\r\n {showNAColor ? (\r\n <g\r\n onMouseOver={() => {\r\n setHoveredColor(naColor || '#D4D6D8');\r\n setSelectedColor(naColor || '#D4D6D8');\r\n }}\r\n onMouseLeave={() => {\r\n setHoveredColor(undefined);\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={335}\r\n y={1}\r\n width={24}\r\n height={8}\r\n className={`stroke-1 ${\r\n hoveredColor === naColor\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: naColor || '#D4D6D8',\r\n ...(hoveredColor !== naColor ? { stroke: naColor } : {}),\r\n strokeWidth: 1,\r\n }}\r\n />\r\n <text\r\n x={337.5}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-sm'\r\n style={{ textAnchor: 'start' }}\r\n >\r\n NA\r\n </text>\r\n </g>\r\n ) : null}\r\n </g>\r\n </svg>\r\n </div>\r\n );\r\n}\r\n"],"names":["ThresholdColorLegendWithMouseOver","props","colorLegendTitle","colorDomain","colors","setSelectedColor","width","naColor","className","showNAColor","hoveredColor","setHoveredColor","useState","mainColorWidth","jsxs","cn","jsx","P","d","i","numberFormattingFunction"],"mappings":"gPAiBO,SAASA,EAAkCC,EAAc,CAC9D,KAAM,CACJ,iBAAAC,EACA,YAAAC,EACA,OAAAC,EACA,iBAAAC,EACA,MAAAC,EACA,QAAAC,EACA,UAAAC,EACA,YAAAC,CAAA,EACER,EAEE,CAACS,EAAcC,CAAe,EAAIC,EAAAA,SAA6B,MAAS,EACxEC,EAAiBN,EAAU,IAAM,IACvC,OACEO,EAAAA,kBAAAA,KAAC,MAAA,CACC,UAAWC,EAAAA,GAAG,gDAAiDP,CA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jBL,EAAgBP,EAAOD,EAAY,MAAM,CAAC,EAC1CE,EAAiBD,EAAOD,EAAY,MAAM,CAAC,CAC7C,EACA,aAAc,IAAM,CAClBQ,EAAgB,MAAS,EACzBN,EAAiB,MAAS,CAC5B,EACA,EAAIF,EAAY,OAASU,EAAkBT,EAAO,OAAS,EAC3D,EAAG,EACH,MAAOS,EAAiBT,EAAO,OAAS,EACxC,OAAQ,EACR,UAAW,2BACTM,IAAiBN,EAAOD,EAAY,MAAM,EACtC,uDACA,EACN,GACA,MAAO,CACL,KAAMC,EAAOD,EAAY,MAAM,EAC/B,GAAIO,IAAiBN,EAAOD,EAAY,MAAM,EAC1C,CAAE,OAAQC,EAAOD,EAAY,MAAM,GACnC,CAAA,CAAC,CACP,CAAA,EAEJ,EACCM,EACCK,EAAAA,kBAAAA,KAAC,IAAA,CACC,YAAa,IAAM,CACjBH,EAAgBJ,GAAW,SAAS,EACpCF,EAAiBE,GAAW,SAAS,CACvC,EACA,aAAc,IAAM,CAClBI,EAAgB,MAAS,EACzBN,EAAiB,MAAS,CAC5B,EACA,UAAU,iBAEV,SAAA,CAAAW,EAAAA,kBAAAA,IAAC,OAAA,CACC,EAAG,IACH,EAAG,EACH,MAAO,GACP,OAAQ,EACR,UAAW,YACTN,IAAiBH,EACb,uDACA,EACN,GACA,MAAO,CACL,KAAMA,GAAW,UACjB,GAAIG,IAAiBH,EAAU,CAAE,OAAQA,CAAA,EAAY,CAAA,EACrD,YAAa,CAAA,CACf,CAAA,EAEFS,EAAAA,kBAAAA,IAAC,OAAA,CACC,EAAG,MACH,EAAG,GACH,UAAU,2DACV,MAAO,CAAE,WAAY,OAAA,EACtB,SAAA,IAAA,CAAA,CAED,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CACF,CAAA,CAAA,CAAA,CAGN"}
@@ -1,2 +1,131 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-BHm2KTjD-D8FylaKc.cjs"),y=require("react"),c=require("./Typography-CDR-DAHH.cjs"),p=require("./numberFormattingFunction.js");function j(h){const{colorLegendTitle:x,colorDomain:s,colors:e,setSelectedColor:l,width:m,naColor:o,className:d,showNAColor:g}=h,[n,i]=y.useState(void 0),a=o?320:360;return r.jsxRuntimeExports.jsxs("div",{className:c.cnExports.cn("flex flex-wrap gap-0 justify-center leading-0",d),style:{maxWidth:m?`${m}px`:"none"},"aria-label":"Color legend",children:[x&&x!==""?r.jsxRuntimeExports.jsx(c.TypographyExports.P,{size:"sm",marginBottom:"2xs",className:"w-full text-center",children:x}):null,r.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 360 30",style:{maxWidth:"360px"},direction:"ltr",children:r.jsxRuntimeExports.jsxs("g",{children:[s.map((u,t)=>r.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{i(e[t]),l(e[t])},onMouseLeave:()=>{i(void 0),l(void 0)},className:"cursor-pointer",children:[r.jsxRuntimeExports.jsx("rect",{x:t*a/e.length+1,y:1,width:a/e.length-2,height:8,className:`stroke-1 ${n===e[t]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:e[t],...n!==e[t]?{stroke:e[t]}:{}}}),r.jsxRuntimeExports.jsx("text",{x:(t+1)*a/e.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"middle"},children:p.numberFormattingFunction(u,"NA",2,"","")})]},t)),r.jsxRuntimeExports.jsx("g",{children:r.jsxRuntimeExports.jsx("rect",{onMouseOver:()=>{i(e[s.length]),l(e[s.length])},onMouseLeave:()=>{i(void 0),l(void 0)},x:s.length*a/e.length+1,y:1,width:a/e.length-2,height:8,className:`cursor-pointer stroke-1 ${n===e[s.length]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:e[s.length],...n!==e[s.length]?{stroke:e[s.length]}:{}}})}),g?r.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{i(o||"#D4D6D8"),l(o||"#D4D6D8")},onMouseLeave:()=>{i(void 0),l(void 0)},className:"cursor-pointer",children:[r.jsxRuntimeExports.jsx("rect",{x:335,y:1,width:24,height:8,className:`stroke-1 ${n===o?"stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:o||"#D4D6D8",...n!==o?{stroke:o}:{},strokeWidth:1}}),r.jsxRuntimeExports.jsx("text",{x:337.5,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},children:"NA"})]}):null]})})]})}exports.ThresholdColorLegendWithMouseOver=j;
1
+ import { j as r, m as y } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
+ import { useState as p } from "react";
3
+ import { u } from "./Typography-Ctgfl1J5.js";
4
+ import { n as v } from "./numberFormattingFunction-14YCbkN2.js";
5
+ function D(d) {
6
+ const {
7
+ colorLegendTitle: m,
8
+ colorDomain: o,
9
+ colors: e,
10
+ setSelectedColor: l,
11
+ width: h,
12
+ naColor: s,
13
+ className: c,
14
+ showNAColor: g
15
+ } = d, [a, i] = p(void 0), n = s ? 320 : 360;
16
+ return /* @__PURE__ */ r.jsxs(
17
+ "div",
18
+ {
19
+ className: y("flex flex-wrap gap-0 justify-center leading-0", c),
20
+ style: { maxWidth: h ? `${h}px` : "none" },
21
+ "aria-label": "Color legend",
22
+ children: [
23
+ m && m !== "" ? /* @__PURE__ */ r.jsx(u, { size: "sm", marginBottom: "2xs", className: "w-full text-center", children: m }) : null,
24
+ /* @__PURE__ */ r.jsx("svg", { width: "100%", viewBox: "0 0 360 30", style: { maxWidth: "360px" }, direction: "ltr", children: /* @__PURE__ */ r.jsxs("g", { children: [
25
+ o.map((x, t) => /* @__PURE__ */ r.jsxs(
26
+ "g",
27
+ {
28
+ onMouseOver: () => {
29
+ i(e[t]), l(e[t]);
30
+ },
31
+ onMouseLeave: () => {
32
+ i(void 0), l(void 0);
33
+ },
34
+ className: "cursor-pointer",
35
+ children: [
36
+ /* @__PURE__ */ r.jsx(
37
+ "rect",
38
+ {
39
+ x: t * n / e.length + 1,
40
+ y: 1,
41
+ width: n / e.length - 2,
42
+ height: 8,
43
+ className: `stroke-1 ${a === e[t] ? "stroke-primary-gray-700 dark:stroke-primary-gray-300" : ""}`,
44
+ style: {
45
+ fill: e[t],
46
+ ...a !== e[t] ? { stroke: e[t] } : {}
47
+ }
48
+ }
49
+ ),
50
+ /* @__PURE__ */ r.jsx(
51
+ "text",
52
+ {
53
+ x: (t + 1) * n / e.length,
54
+ y: 25,
55
+ className: "fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",
56
+ style: { textAnchor: "middle" },
57
+ children: v(x, "NA", 2, "", "")
58
+ }
59
+ )
60
+ ]
61
+ },
62
+ t
63
+ )),
64
+ /* @__PURE__ */ r.jsx("g", { children: /* @__PURE__ */ r.jsx(
65
+ "rect",
66
+ {
67
+ onMouseOver: () => {
68
+ i(e[o.length]), l(e[o.length]);
69
+ },
70
+ onMouseLeave: () => {
71
+ i(void 0), l(void 0);
72
+ },
73
+ x: o.length * n / e.length + 1,
74
+ y: 1,
75
+ width: n / e.length - 2,
76
+ height: 8,
77
+ className: `cursor-pointer stroke-1 ${a === e[o.length] ? "stroke-primary-gray-700 dark:stroke-primary-gray-300" : ""}`,
78
+ style: {
79
+ fill: e[o.length],
80
+ ...a !== e[o.length] ? { stroke: e[o.length] } : {}
81
+ }
82
+ }
83
+ ) }),
84
+ g ? /* @__PURE__ */ r.jsxs(
85
+ "g",
86
+ {
87
+ onMouseOver: () => {
88
+ i(s || "#D4D6D8"), l(s || "#D4D6D8");
89
+ },
90
+ onMouseLeave: () => {
91
+ i(void 0), l(void 0);
92
+ },
93
+ className: "cursor-pointer",
94
+ children: [
95
+ /* @__PURE__ */ r.jsx(
96
+ "rect",
97
+ {
98
+ x: 335,
99
+ y: 1,
100
+ width: 24,
101
+ height: 8,
102
+ className: `stroke-1 ${a === s ? "stroke-primary-gray-700 dark:stroke-primary-gray-300" : ""}`,
103
+ style: {
104
+ fill: s || "#D4D6D8",
105
+ ...a !== s ? { stroke: s } : {},
106
+ strokeWidth: 1
107
+ }
108
+ }
109
+ ),
110
+ /* @__PURE__ */ r.jsx(
111
+ "text",
112
+ {
113
+ x: 337.5,
114
+ y: 25,
115
+ className: "fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",
116
+ style: { textAnchor: "start" },
117
+ children: "NA"
118
+ }
119
+ )
120
+ ]
121
+ }
122
+ ) : null
123
+ ] }) })
124
+ ]
125
+ }
126
+ );
127
+ }
128
+ export {
129
+ D as ThresholdColorLegendWithMouseOver
130
+ };
2
131
  //# sourceMappingURL=ThresholdColorLegendWithMouseOver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThresholdColorLegendWithMouseOver.js","sources":["../src/Components/Elements/ThresholdColorLegendWithMouseOver.tsx"],"sourcesContent":["import { useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { P } from '@undp/design-system-react/Typography';\r\n\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\n\r\ninterface Props {\r\n colors: string[];\r\n colorDomain: number[];\r\n colorLegendTitle?: string;\r\n setSelectedColor: (_d?: string) => void;\r\n width?: number;\r\n naColor?: string;\r\n className?: string;\r\n showNAColor: boolean;\r\n}\r\n\r\nexport function ThresholdColorLegendWithMouseOver(props: Props) {\r\n const {\r\n colorLegendTitle,\r\n colorDomain,\r\n colors,\r\n setSelectedColor,\r\n width,\r\n naColor,\r\n className,\r\n showNAColor,\r\n } = props;\r\n\r\n const [hoveredColor, setHoveredColor] = useState<string | undefined>(undefined);\r\n const mainColorWidth = naColor ? 320 : 360;\r\n return (\r\n <div\r\n className={cn('flex flex-wrap gap-0 justify-center leading-0', className)}\r\n style={{ maxWidth: width ? `${width}px` : 'none' }}\r\n aria-label='Color legend'\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P size='sm' marginBottom='2xs' className='w-full text-center'>\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n <svg width='100%' viewBox='0 0 360 30' style={{ maxWidth: '360px' }} direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g\r\n key={i}\r\n onMouseOver={() => {\r\n setHoveredColor(colors[i]);\r\n setSelectedColor(colors[i]);\r\n }}\r\n onMouseLeave={() => {\r\n setHoveredColor(undefined);\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={(i * mainColorWidth) / colors.length + 1}\r\n y={1}\r\n width={mainColorWidth / colors.length - 2}\r\n height={8}\r\n className={`stroke-1 ${\r\n hoveredColor === colors[i]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[i],\r\n ...(hoveredColor !== colors[i] ? { stroke: colors[i] } : {}),\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * mainColorWidth) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-sm'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA', 2, '', '')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n onMouseOver={() => {\r\n setHoveredColor(colors[colorDomain.length]);\r\n setSelectedColor(colors[colorDomain.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setHoveredColor(undefined);\r\n setSelectedColor(undefined);\r\n }}\r\n x={(colorDomain.length * mainColorWidth) / colors.length + 1}\r\n y={1}\r\n width={mainColorWidth / colors.length - 2}\r\n height={8}\r\n className={`cursor-pointer stroke-1 ${\r\n hoveredColor === colors[colorDomain.length]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n ...(hoveredColor !== colors[colorDomain.length]\r\n ? { stroke: colors[colorDomain.length] }\r\n : {}),\r\n }}\r\n />\r\n </g>\r\n {showNAColor ? (\r\n <g\r\n onMouseOver={() => {\r\n setHoveredColor(naColor || '#D4D6D8');\r\n setSelectedColor(naColor || '#D4D6D8');\r\n }}\r\n onMouseLeave={() => {\r\n setHoveredColor(undefined);\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={335}\r\n y={1}\r\n width={24}\r\n height={8}\r\n className={`stroke-1 ${\r\n hoveredColor === naColor\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: naColor || '#D4D6D8',\r\n ...(hoveredColor !== naColor ? { stroke: naColor } : {}),\r\n strokeWidth: 1,\r\n }}\r\n />\r\n <text\r\n x={337.5}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-sm'\r\n style={{ textAnchor: 'start' }}\r\n >\r\n NA\r\n </text>\r\n </g>\r\n ) : null}\r\n </g>\r\n </svg>\r\n </div>\r\n );\r\n}\r\n"],"names":["ThresholdColorLegendWithMouseOver","props","colorLegendTitle","colorDomain","colors","setSelectedColor","width","naColor","className","showNAColor","hoveredColor","setHoveredColor","useState","mainColorWidth","jsxs","cn","jsx","P","d","i","numberFormattingFunction"],"mappings":"sOAiBO,SAASA,EAAkCC,EAAc,CAC9D,KAAM,CACJ,iBAAAC,EACA,YAAAC,EACA,OAAAC,EACA,iBAAAC,EACA,MAAAC,EACA,QAAAC,EACA,UAAAC,EACA,YAAAC,CAAA,EACER,EAEE,CAACS,EAAcC,CAAe,EAAIC,EAAAA,SAA6B,MAAS,EACxEC,EAAiBN,EAAU,IAAM,IACvC,OACEO,EAAAA,kBAAAA,KAAC,MAAA,CACC,UAAWC,EAAAA,UAAAA,GAAG,gDAAiDP,CAAS,EACxE,MAAO,CAAE,SAAUF,EAAQ,GAAGA,CAAK,KAAO,MAAA,EAC1C,aAAW,eAEV,SAAA,CAAAJ,GAAoBA,IAAqB,GACxCc,EAAAA,kBAAAA,IAACC,EAAAA,kBAAAA,EAAA,CAAE,KAAK,KAAK,aAAa,MAAM,UAAU,qBACvC,SAAAf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3D,EAAG,EACH,MAAOS,EAAiBT,EAAO,OAAS,EACxC,OAAQ,EACR,UAAW,2BACTM,IAAiBN,EAAOD,EAAY,MAAM,EACtC,uDACA,EACN,GACA,MAAO,CACL,KAAMC,EAAOD,EAAY,MAAM,EAC/B,GAAIO,IAAiBN,EAAOD,EAAY,MAAM,EAC1C,CAAE,OAAQC,EAAOD,EAAY,MAAM,GACnC,CAAA,CAAC,CACP,CAAA,EAEJ,EACCM,EACCK,EAAAA,kBAAAA,KAAC,IAAA,CACC,YAAa,IAAM,CACjBH,EAAgBJ,GAAW,SAAS,EACpCF,EAAiBE,GAAW,SAAS,CACvC,EACA,aAAc,IAAM,CAClBI,EAAgB,MAAS,EACzBN,EAAiB,MAAS,CAC5B,EACA,UAAU,iBAEV,SAAA,CAAAW,EAAAA,kBAAAA,IAAC,OAAA,CACC,EAAG,IACH,EAAG,EACH,MAAO,GACP,OAAQ,EACR,UAAW,YACTN,IAAiBH,EACb,uDACA,EACN,GACA,MAAO,CACL,KAAMA,GAAW,UACjB,GAAIG,IAAiBH,EAAU,CAAE,OAAQA,CAAA,EAAY,CAAA,EACrD,YAAa,CAAA,CACf,CAAA,EAEFS,EAAAA,kBAAAA,IAAC,OAAA,CACC,EAAG,MACH,EAAG,GACH,UAAU,2DACV,MAAO,CAAE,WAAY,OAAA,EACtB,SAAA,IAAA,CAAA,CAED,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CACF,CAAA,CAAA,CAAA,CAGN"}
1
+ {"version":3,"file":"ThresholdColorLegendWithMouseOver.js","sources":["../src/Components/Elements/ThresholdColorLegendWithMouseOver.tsx"],"sourcesContent":["import { useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { P } from '@undp/design-system-react/Typography';\r\n\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\n\r\ninterface Props {\r\n colors: string[];\r\n colorDomain: number[];\r\n colorLegendTitle?: string;\r\n setSelectedColor: (_d?: string) => void;\r\n width?: number;\r\n naColor?: string;\r\n className?: string;\r\n showNAColor: boolean;\r\n}\r\n\r\nexport function ThresholdColorLegendWithMouseOver(props: Props) {\r\n const {\r\n colorLegendTitle,\r\n colorDomain,\r\n colors,\r\n setSelectedColor,\r\n width,\r\n naColor,\r\n className,\r\n showNAColor,\r\n } = props;\r\n\r\n const [hoveredColor, setHoveredColor] = useState<string | undefined>(undefined);\r\n const mainColorWidth = naColor ? 320 : 360;\r\n return (\r\n <div\r\n className={cn('flex flex-wrap gap-0 justify-center leading-0', className)}\r\n style={{ maxWidth: width ? `${width}px` : 'none' }}\r\n aria-label='Color legend'\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P size='sm' marginBottom='2xs' className='w-full text-center'>\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n <svg width='100%' viewBox='0 0 360 30' style={{ maxWidth: '360px' }} direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g\r\n key={i}\r\n onMouseOver={() => {\r\n setHoveredColor(colors[i]);\r\n setSelectedColor(colors[i]);\r\n }}\r\n onMouseLeave={() => {\r\n setHoveredColor(undefined);\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={(i * mainColorWidth) / colors.length + 1}\r\n y={1}\r\n width={mainColorWidth / colors.length - 2}\r\n height={8}\r\n className={`stroke-1 ${\r\n hoveredColor === colors[i]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[i],\r\n ...(hoveredColor !== colors[i] ? { stroke: colors[i] } : {}),\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * mainColorWidth) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-sm'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA', 2, '', '')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n onMouseOver={() => {\r\n setHoveredColor(colors[colorDomain.length]);\r\n setSelectedColor(colors[colorDomain.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setHoveredColor(undefined);\r\n setSelectedColor(undefined);\r\n }}\r\n x={(colorDomain.length * mainColorWidth) / colors.length + 1}\r\n y={1}\r\n width={mainColorWidth / colors.length - 2}\r\n height={8}\r\n className={`cursor-pointer stroke-1 ${\r\n hoveredColor === colors[colorDomain.length]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n ...(hoveredColor !== colors[colorDomain.length]\r\n ? { stroke: colors[colorDomain.length] }\r\n : {}),\r\n }}\r\n />\r\n </g>\r\n {showNAColor ? (\r\n <g\r\n onMouseOver={() => {\r\n setHoveredColor(naColor || '#D4D6D8');\r\n setSelectedColor(naColor || '#D4D6D8');\r\n }}\r\n onMouseLeave={() => {\r\n setHoveredColor(undefined);\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={335}\r\n y={1}\r\n width={24}\r\n height={8}\r\n className={`stroke-1 ${\r\n hoveredColor === naColor\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: naColor || '#D4D6D8',\r\n ...(hoveredColor !== naColor ? { stroke: naColor } : {}),\r\n strokeWidth: 1,\r\n }}\r\n />\r\n <text\r\n x={337.5}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-sm'\r\n style={{ textAnchor: 'start' }}\r\n >\r\n NA\r\n </text>\r\n </g>\r\n ) : null}\r\n </g>\r\n </svg>\r\n </div>\r\n );\r\n}\r\n"],"names":["ThresholdColorLegendWithMouseOver","props","colorLegendTitle","colorDomain","colors","setSelectedColor","width","naColor","className","showNAColor","hoveredColor","setHoveredColor","useState","mainColorWidth","jsxs","cn","jsx","P","d","i","numberFormattingFunction"],"mappings":";;;;A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ACP;AAAA,UAAA,GAEJ;AAAA,UACCM,IACCK,gBAAAA,EAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,aAAa,MAAM;AACjB,gBAAAH,EAAgBJ,KAAW,SAAS,GACpCF,EAAiBE,KAAW,SAAS;AAAA,cACvC;AAAA,cACA,cAAc,MAAM;AAClB,gBAAAI,EAAgB,MAAS,GACzBN,EAAiB,MAAS;AAAA,cAC5B;AAAA,cACA,WAAU;AAAA,cAEV,UAAA;AAAA,gBAAAW,gBAAAA,EAAAA;AAAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,GAAG;AAAA,oBACH,GAAG;AAAA,oBACH,OAAO;AAAA,oBACP,QAAQ;AAAA,oBACR,WAAW,YACTN,MAAiBH,IACb,yDACA,EACN;AAAA,oBACA,OAAO;AAAA,sBACL,MAAMA,KAAW;AAAA,sBACjB,GAAIG,MAAiBH,IAAU,EAAE,QAAQA,EAAA,IAAY,CAAA;AAAA,sBACrD,aAAa;AAAA,oBAAA;AAAA,kBACf;AAAA,gBAAA;AAAA,gBAEFS,gBAAAA,EAAAA;AAAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,GAAG;AAAA,oBACH,GAAG;AAAA,oBACH,WAAU;AAAA,oBACV,OAAO,EAAE,YAAY,QAAA;AAAA,oBACtB,UAAA;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAED;AAAA,YAAA;AAAA,UAAA,IAEA;AAAA,QAAA,EAAA,CACN,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1,39 +1,38 @@
1
- import { j as o } from "./index-BHm2KTjD-2e-Fu8L-.js";
2
- import { c as s } from "./Typography-XJoSE-By.js";
1
+ import { j as o, m as s } from "./index-CHPV5EwG-BPSP-7Jg.js";
3
2
  import { createPortal as m } from "react-dom";
4
- import { s as p } from "./string2HTML-BX0oNw83.js";
5
- function x(e) {
3
+ import { s as l } from "./string2HTML-CWHGfz_d.js";
4
+ function g(i) {
6
5
  const {
7
6
  body: r,
8
- xPos: t,
9
- yPos: a,
10
- data: i,
7
+ xPos: a,
8
+ yPos: t,
9
+ data: e,
11
10
  backgroundStyle: n = {
12
11
  maxWidth: "24rem",
13
12
  wordWrap: "break-word"
14
13
  },
15
14
  className: d
16
- } = e;
15
+ } = i;
17
16
  return m(
18
17
  /* @__PURE__ */ o.jsx("div", { className: "undp-container", children: /* @__PURE__ */ o.jsx(
19
18
  "div",
20
19
  {
21
- className: s.cn(
20
+ className: s(
22
21
  "graph-tooltip block p-2 fixed z-[1000] bg-primary-gray-200 dark:bg-primary-gray-600 border border-primary-gray-300 dark:border-primary-gray-500",
23
22
  d
24
23
  ),
25
24
  style: {
26
25
  ...n,
27
- top: `${a < window.innerHeight / 2 ? a - 10 : a + 10}px`,
28
- left: `${t > window.innerWidth / 2 ? t - 10 : t + 10}px`,
29
- transform: `translate(${t > window.innerWidth / 2 ? "-100%" : "0%"},${a > window.innerHeight / 2 ? "-100%" : "0%"})`
26
+ top: `${t < window.innerHeight / 2 ? t - 10 : t + 10}px`,
27
+ left: `${a > window.innerWidth / 2 ? a - 10 : a + 10}px`,
28
+ transform: `translate(${a > window.innerWidth / 2 ? "-100%" : "0%"},${t > window.innerHeight / 2 ? "-100%" : "0%"})`
30
29
  },
31
30
  children: /* @__PURE__ */ o.jsx(
32
31
  "div",
33
32
  {
34
33
  className: "text-sm leading-normal text-primary-black dark:text-primary-gray-100 m-0",
35
- dangerouslySetInnerHTML: typeof r == "string" ? { __html: p(r, i) } : void 0,
36
- children: typeof r == "function" ? r(i) : null
34
+ dangerouslySetInnerHTML: typeof r == "string" ? { __html: l(r, e) } : void 0,
35
+ children: typeof r == "function" ? r(e) : null
37
36
  }
38
37
  )
39
38
  }
@@ -42,6 +41,6 @@ function x(e) {
42
41
  );
43
42
  }
44
43
  export {
45
- x as T
44
+ g as T
46
45
  };
47
- //# sourceMappingURL=Tooltip-CzZ1wFyF.js.map
46
+ //# sourceMappingURL=Tooltip-DyM5snqx.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip-CzZ1wFyF.js","sources":["../src/Components/Elements/Tooltip.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { createPortal } from 'react-dom';\r\n\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n body: string | ((_d: any) => React.ReactNode);\r\n xPos: number;\r\n yPos: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data: any;\r\n backgroundStyle?: React.CSSProperties;\r\n className?: string;\r\n}\r\n\r\nexport function Tooltip(props: Props) {\r\n const {\r\n body,\r\n xPos,\r\n yPos,\r\n data,\r\n backgroundStyle = {\r\n maxWidth: '24rem',\r\n wordWrap: 'break-word',\r\n },\r\n className,\r\n } = props;\r\n return createPortal(\r\n <div className='undp-container'>\r\n <div\r\n className={cn(\r\n 'graph-tooltip block p-2 fixed z-[1000] bg-primary-gray-200 dark:bg-primary-gray-600 border border-primary-gray-300 dark:border-primary-gray-500',\r\n className,\r\n )}\r\n style={{\r\n ...backgroundStyle,\r\n top: `${yPos < window.innerHeight / 2 ? yPos - 10 : yPos + 10}px`,\r\n left: `${xPos > window.innerWidth / 2 ? xPos - 10 : xPos + 10}px`,\r\n transform: `translate(${\r\n xPos > window.innerWidth / 2 ? '-100%' : '0%'\r\n },${yPos > window.innerHeight / 2 ? '-100%' : '0%'})`,\r\n }}\r\n >\r\n <div\r\n className='text-sm leading-normal text-primary-black dark:text-primary-gray-100 m-0'\r\n dangerouslySetInnerHTML={\r\n typeof body === 'string' ? { __html: string2HTML(body, data) } : undefined\r\n }\r\n >\r\n {typeof body === 'function' ? body(data) : null}\r\n </div>\r\n </div>\r\n </div>,\r\n document.body,\r\n );\r\n}\r\n"],"names":["Tooltip","props","body","xPos","yPos","data","backgroundStyle","className","createPortal","jsx","cn","string2HTML"],"mappings":";;;;AAgBO,SAASA,EAAQC,GAAc;AACpC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,MAChB,UAAU;AAAA,MACV,UAAU;AAAA,IAAA;AAAA,IAEZ,WAAAC;AAAA,EAAA,IACEN;AACJ,SAAOO;AAAA,IACLC,gBAAAA,EAAAA,IAAC,OAAA,EAAI,WAAU,kBACb,UAAAA,gBAAAA,EAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWC,EAAAA;AAAAA,UACT;AAAA,UACAH;AAAA,QAAA;AAAA,QAEF,OAAO;AAAA,UACL,GAAGD;AAAA,UACH,KAAK,GAAGF,IAAO,OAAO,cAAc,IAAIA,IAAO,KAAKA,IAAO,EAAE;AAAA,UAC7D,MAAM,GAAGD,IAAO,OAAO,aAAa,IAAIA,IAAO,KAAKA,IAAO,EAAE;AAAA,UAC7D,WAAW,aACTA,IAAO,OAAO,aAAa,IAAI,UAAU,IAC3C,IAAIC,IAAO,OAAO,cAAc,IAAI,UAAU,IAAI;AAAA,QAAA;AAAA,QAGpD,UAAAK,gBAAAA,EAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,yBACE,OAAOP,KAAS,WAAW,EAAE,QAAQS,EAAYT,GAAMG,CAAI,EAAA,IAAM;AAAA,YAGlE,UAAA,OAAOH,KAAS,aAAaA,EAAKG,CAAI,IAAI;AAAA,UAAA;AAAA,QAAA;AAAA,MAC7C;AAAA,IAAA,GAEJ;AAAA,IACA,SAAS;AAAA,EAAA;AAEb;"}
1
+ {"version":3,"file":"Tooltip-DyM5snqx.js","sources":["../src/Components/Elements/Tooltip.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { createPortal } from 'react-dom';\r\n\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n body: string | ((_d: any) => React.ReactNode);\r\n xPos: number;\r\n yPos: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data: any;\r\n backgroundStyle?: React.CSSProperties;\r\n className?: string;\r\n}\r\n\r\nexport function Tooltip(props: Props) {\r\n const {\r\n body,\r\n xPos,\r\n yPos,\r\n data,\r\n backgroundStyle = {\r\n maxWidth: '24rem',\r\n wordWrap: 'break-word',\r\n },\r\n className,\r\n } = props;\r\n return createPortal(\r\n <div className='undp-container'>\r\n <div\r\n className={cn(\r\n 'graph-tooltip block p-2 fixed z-[1000] bg-primary-gray-200 dark:bg-primary-gray-600 border border-primary-gray-300 dark:border-primary-gray-500',\r\n className,\r\n )}\r\n style={{\r\n ...backgroundStyle,\r\n top: `${yPos < window.innerHeight / 2 ? yPos - 10 : yPos + 10}px`,\r\n left: `${xPos > window.innerWidth / 2 ? xPos - 10 : xPos + 10}px`,\r\n transform: `translate(${\r\n xPos > window.innerWidth / 2 ? '-100%' : '0%'\r\n },${yPos > window.innerHeight / 2 ? '-100%' : '0%'})`,\r\n }}\r\n >\r\n <div\r\n className='text-sm leading-normal text-primary-black dark:text-primary-gray-100 m-0'\r\n dangerouslySetInnerHTML={\r\n typeof body === 'string' ? { __html: string2HTML(body, data) } : undefined\r\n }\r\n >\r\n {typeof body === 'function' ? body(data) : null}\r\n </div>\r\n </div>\r\n </div>,\r\n document.body,\r\n );\r\n}\r\n"],"names":["Tooltip","props","body","xPos","yPos","data","backgroundStyle","className","createPortal","jsx","cn","string2HTML"],"mappings":";;;AAgBO,SAASA,EAAQC,GAAc;AACpC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,MAChB,UAAU;AAAA,MACV,UAAU;AAAA,IAAA;AAAA,IAEZ,WAAAC;AAAA,EAAA,IACEN;AACJ,SAAOO;AAAA,IACLC,gBAAAA,EAAAA,IAAC,OAAA,EAAI,WAAU,kBACb,UAAAA,gBAAAA,EAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWC;AAAAA,UACT;AAAA,UACAH;AAAA,QAAA;AAAA,QAEF,OAAO;AAAA,UACL,GAAGD;AAAA,UACH,KAAK,GAAGF,IAAO,OAAO,cAAc,IAAIA,IAAO,KAAKA,IAAO,EAAE;AAAA,UAC7D,MAAM,GAAGD,IAAO,OAAO,aAAa,IAAIA,IAAO,KAAKA,IAAO,EAAE;AAAA,UAC7D,WAAW,aACTA,IAAO,OAAO,aAAa,IAAI,UAAU,IAC3C,IAAIC,IAAO,OAAO,cAAc,IAAI,UAAU,IAAI;AAAA,QAAA;AAAA,QAGpD,UAAAK,gBAAAA,EAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,yBACE,OAAOP,KAAS,WAAW,EAAE,QAAQS,EAAYT,GAAMG,CAAI,EAAA,IAAM;AAAA,YAGlE,UAAA,OAAOH,KAAS,aAAaA,EAAKG,CAAI,IAAI;AAAA,UAAA;AAAA,QAAA;AAAA,MAC7C;AAAA,IAAA,GAEJ;AAAA,IACA,SAAS;AAAA,EAAA;AAEb;"}
@@ -0,0 +1,2 @@
1
+ "use strict";const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react-dom"),l=require("./string2HTML-D2Avudmb.cjs");function m(o){const{body:r,xPos:t,yPos:e,data:n,backgroundStyle:a={maxWidth:"24rem",wordWrap:"break-word"},className:s}=o;return d.createPortal(i.jsxRuntimeExports.jsx("div",{className:"undp-container",children:i.jsxRuntimeExports.jsx("div",{className:i.mo("graph-tooltip block p-2 fixed z-[1000] bg-primary-gray-200 dark:bg-primary-gray-600 border border-primary-gray-300 dark:border-primary-gray-500",s),style:{...a,top:`${e<window.innerHeight/2?e-10:e+10}px`,left:`${t>window.innerWidth/2?t-10:t+10}px`,transform:`translate(${t>window.innerWidth/2?"-100%":"0%"},${e>window.innerHeight/2?"-100%":"0%"})`},children:i.jsxRuntimeExports.jsx("div",{className:"text-sm leading-normal text-primary-black dark:text-primary-gray-100 m-0",dangerouslySetInnerHTML:typeof r=="string"?{__html:l.string2HTML(r,n)}:void 0,children:typeof r=="function"?r(n):null})})}),document.body)}exports.Tooltip=m;
2
+ //# sourceMappingURL=Tooltip-n8z5bfav.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip-BM18N_3l.cjs","sources":["../src/Components/Elements/Tooltip.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { createPortal } from 'react-dom';\r\n\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n body: string | ((_d: any) => React.ReactNode);\r\n xPos: number;\r\n yPos: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data: any;\r\n backgroundStyle?: React.CSSProperties;\r\n className?: string;\r\n}\r\n\r\nexport function Tooltip(props: Props) {\r\n const {\r\n body,\r\n xPos,\r\n yPos,\r\n data,\r\n backgroundStyle = {\r\n maxWidth: '24rem',\r\n wordWrap: 'break-word',\r\n },\r\n className,\r\n } = props;\r\n return createPortal(\r\n <div className='undp-container'>\r\n <div\r\n className={cn(\r\n 'graph-tooltip block p-2 fixed z-[1000] bg-primary-gray-200 dark:bg-primary-gray-600 border border-primary-gray-300 dark:border-primary-gray-500',\r\n className,\r\n )}\r\n style={{\r\n ...backgroundStyle,\r\n top: `${yPos < window.innerHeight / 2 ? yPos - 10 : yPos + 10}px`,\r\n left: `${xPos > window.innerWidth / 2 ? xPos - 10 : xPos + 10}px`,\r\n transform: `translate(${\r\n xPos > window.innerWidth / 2 ? '-100%' : '0%'\r\n },${yPos > window.innerHeight / 2 ? '-100%' : '0%'})`,\r\n }}\r\n >\r\n <div\r\n className='text-sm leading-normal text-primary-black dark:text-primary-gray-100 m-0'\r\n dangerouslySetInnerHTML={\r\n typeof body === 'string' ? { __html: string2HTML(body, data) } : undefined\r\n }\r\n >\r\n {typeof body === 'function' ? body(data) : null}\r\n </div>\r\n </div>\r\n </div>,\r\n document.body,\r\n );\r\n}\r\n"],"names":["Tooltip","props","body","xPos","yPos","data","backgroundStyle","className","createPortal","jsx","cn","string2HTML"],"mappings":"oKAgBO,SAASA,EAAQC,EAAc,CACpC,KAAM,CACJ,KAAAC,EACA,KAAAC,EACA,KAAAC,EACA,KAAAC,EACA,gBAAAC,EAAkB,CAChB,SAAU,QACV,SAAU,YAAA,EAEZ,UAAAC,CAAA,EACEN,EACJ,OAAOO,EAAAA,aACLC,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,iBACb,SAAAA,EAAAA,kBAAAA,IAAC,MAAA,CACC,UAAWC,EAAAA,UAAAA,GACT,kJACAH,CAAA,EAEF,MAAO,CACL,GAAGD,EACH,IAAK,GAAGF,EAAO,OAAO,YAAc,EAAIA,EAAO,GAAKA,EAAO,EAAE,KAC7D,KAAM,GAAGD,EAAO,OAAO,WAAa,EAAIA,EAAO,GAAKA,EAAO,EAAE,KAC7D,UAAW,aACTA,EAAO,OAAO,WAAa,EAAI,QAAU,IAC3C,IAAIC,EAAO,OAAO,YAAc,EAAI,QAAU,IAAI,GAAA,EAGpD,SAAAK,EAAAA,kBAAAA,IAAC,MAAA,CACC,UAAU,2EACV,wBACE,OAAOP,GAAS,SAAW,CAAE,OAAQS,EAAAA,YAAYT,EAAMG,CAAI,CAAA,EAAM,OAGlE,SAAA,OAAOH,GAAS,WAAaA,EAAKG,CAAI,EAAI,IAAA,CAAA,CAC7C,CAAA,EAEJ,EACA,SAAS,IAAA,CAEb"}
1
+ {"version":3,"file":"Tooltip-n8z5bfav.cjs","sources":["../src/Components/Elements/Tooltip.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { createPortal } from 'react-dom';\r\n\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n body: string | ((_d: any) => React.ReactNode);\r\n xPos: number;\r\n yPos: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data: any;\r\n backgroundStyle?: React.CSSProperties;\r\n className?: string;\r\n}\r\n\r\nexport function Tooltip(props: Props) {\r\n const {\r\n body,\r\n xPos,\r\n yPos,\r\n data,\r\n backgroundStyle = {\r\n maxWidth: '24rem',\r\n wordWrap: 'break-word',\r\n },\r\n className,\r\n } = props;\r\n return createPortal(\r\n <div className='undp-container'>\r\n <div\r\n className={cn(\r\n 'graph-tooltip block p-2 fixed z-[1000] bg-primary-gray-200 dark:bg-primary-gray-600 border border-primary-gray-300 dark:border-primary-gray-500',\r\n className,\r\n )}\r\n style={{\r\n ...backgroundStyle,\r\n top: `${yPos < window.innerHeight / 2 ? yPos - 10 : yPos + 10}px`,\r\n left: `${xPos > window.innerWidth / 2 ? xPos - 10 : xPos + 10}px`,\r\n transform: `translate(${\r\n xPos > window.innerWidth / 2 ? '-100%' : '0%'\r\n },${yPos > window.innerHeight / 2 ? '-100%' : '0%'})`,\r\n }}\r\n >\r\n <div\r\n className='text-sm leading-normal text-primary-black dark:text-primary-gray-100 m-0'\r\n dangerouslySetInnerHTML={\r\n typeof body === 'string' ? { __html: string2HTML(body, data) } : undefined\r\n }\r\n >\r\n {typeof body === 'function' ? body(data) : null}\r\n </div>\r\n </div>\r\n </div>,\r\n document.body,\r\n );\r\n}\r\n"],"names":["Tooltip","props","body","xPos","yPos","data","backgroundStyle","className","createPortal","jsx","cn","string2HTML"],"mappings":"6HAgBO,SAASA,EAAQC,EAAc,CACpC,KAAM,CACJ,KAAAC,EACA,KAAAC,EACA,KAAAC,EACA,KAAAC,EACA,gBAAAC,EAAkB,CAChB,SAAU,QACV,SAAU,YAAA,EAEZ,UAAAC,CAAA,EACEN,EACJ,OAAOO,EAAAA,aACLC,EAAAA,kBAAAA,IAAC,MAAA,CAAI,UAAU,iBACb,SAAAA,EAAAA,kBAAAA,IAAC,MAAA,CACC,UAAWC,EAAAA,GACT,kJACAH,CAAA,EAEF,MAAO,CACL,GAAGD,EACH,IAAK,GAAGF,EAAO,OAAO,YAAc,EAAIA,EAAO,GAAKA,EAAO,EAAE,KAC7D,KAAM,GAAGD,EAAO,OAAO,WAAa,EAAIA,EAAO,GAAKA,EAAO,EAAE,KAC7D,UAAW,aACTA,EAAO,OAAO,WAAa,EAAI,QAAU,IAC3C,IAAIC,EAAO,OAAO,YAAc,EAAI,QAAU,IAAI,GAAA,EAGpD,SAAAK,EAAAA,kBAAAA,IAAC,MAAA,CACC,UAAU,2EACV,wBACE,OAAOP,GAAS,SAAW,CAAE,OAAQS,EAAAA,YAAYT,EAAMG,CAAI,CAAA,EAAM,OAGlE,SAAA,OAAOH,GAAS,WAAaA,EAAKG,CAAI,EAAI,IAAA,CAAA,CAC7C,CAAA,EAEJ,EACA,SAAS,IAAA,CAEb"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-CHPV5EwG-DDoeWRVt.cjs"),le=require("./index-CZbIGs8q.cjs"),O=require("react"),se=require("./Typography-k-kOjICQ.cjs"),me=require("./Modal-C_dl0EtQ.cjs"),xe=require("./Tooltip-n8z5bfav.cjs"),ve=require("./numberFormattingFunction-02t-wJta.cjs"),ee=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),N=require("./Colors.cjs"),ye=require("./string2HTML-D2Avudmb.cjs"),we=require("./use-in-view-BCmzDU2O.cjs"),Z=require("./proxy-PQd2AItT.cjs"),je=require("./index-DVOJ7vxH.cjs"),Ce=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),be=require("./GraphFooter.cjs"),Ee=require("./GraphHeader.cjs"),Me=require("./ColorLegendWithMouseOver.cjs"),Re=require("./EmptyState-d8_8SxeW.cjs");function Oe(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function ke(){return this.eachAfter(Oe)}function Be(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this}function Se(e,t){for(var n=this,r=[n],a,s,l=-1;n=r.pop();)if(e.call(t,n,++l,this),a=n.children)for(s=a.length-1;s>=0;--s)r.push(a[s]);return this}function Ie(e,t){for(var n=this,r=[n],a=[],s,l,h,m=-1;n=r.pop();)if(a.push(n),s=n.children)for(l=0,h=s.length;l<h;++l)r.push(s[l]);for(;n=a.pop();)e.call(t,n,++m,this);return this}function qe(e,t){let n=-1;for(const r of this)if(e.call(t,r,++n,this))return r}function Ne(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,a=r&&r.length;--a>=0;)n+=r[a].value;t.value=n})}function De(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function Te(e){for(var t=this,n=Ve(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var a=r.length;e!==n;)r.splice(a,0,e),e=e.parent;return r}function Ve(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),a=null;for(e=n.pop(),t=r.pop();e===t;)a=e,e=n.pop(),t=r.pop();return a}function _e(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function $e(){return Array.from(this)}function He(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function Le(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*Ae(){var e=this,t,n=[e],r,a,s;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(a=0,s=r.length;a<s;++a)n.push(r[a]);while(n.length)}function he(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=Ge)):t===void 0&&(t=Pe);for(var n=new F(e),r,a=[n],s,l,h,m;r=a.pop();)if((l=t(r.data))&&(m=(l=Array.from(l)).length))for(r.children=l,h=m-1;h>=0;--h)a.push(s=l[h]=new F(l[h])),s.parent=r,s.depth=r.depth+1;return n.eachBefore(de)}function ze(){return he(this).eachBefore(We)}function Pe(e){return e.children}function Ge(e){return Array.isArray(e)?e[1]:null}function We(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function de(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function F(e){this.data=e,this.depth=this.height=0,this.parent=null}F.prototype=he.prototype={constructor:F,count:ke,each:Be,eachAfter:Ie,eachBefore:Se,find:qe,sum:Ne,sort:De,path:Te,ancestors:_e,descendants:$e,leaves:He,links:Le,copy:ze,[Symbol.iterator]:Ae};function te(e){return e==null?null:fe(e)}function fe(e){if(typeof e!="function")throw new Error;return e}function G(){return 0}function W(e){return function(){return e}}function Fe(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Xe(e,t,n,r,a){for(var s=e.children,l,h=-1,m=s.length,j=e.value&&(r-t)/e.value;++h<m;)l=s[h],l.y0=n,l.y1=a,l.x0=t,l.x1=t+=l.value*j}var Ye={depth:-1},ue={},ne={};function Ke(e){return e.id}function Ue(e){return e.parentId}function Ze(){var e=Ke,t=Ue,n;function r(a){var s=Array.from(a),l=e,h=t,m,j,c,v,i,u,f,y,p=new Map;if(n!=null){const d=s.map((w,E)=>Je(n(w,E,a))),C=d.map(ce),k=new Set(d).add("");for(const w of C)k.has(w)||(k.add(w),d.push(w),C.push(ce(w)),s.push(ne));l=(w,E)=>d[E],h=(w,E)=>C[E]}for(c=0,m=s.length;c<m;++c)j=s[c],u=s[c]=new F(j),(f=l(j,c,a))!=null&&(f+="")&&(y=u.id=f,p.set(y,p.has(y)?ue:u)),(f=h(j,c,a))!=null&&(f+="")&&(u.parent=f);for(c=0;c<m;++c)if(u=s[c],f=u.parent){if(i=p.get(f),!i)throw new Error("missing: "+f);if(i===ue)throw new Error("ambiguous: "+f);i.children?i.children.push(u):i.children=[u],u.parent=i}else{if(v)throw new Error("multiple roots");v=u}if(!v)throw new Error("no root");if(n!=null){for(;v.data===ne&&v.children.length===1;)v=v.children[0],--m;for(let d=s.length-1;d>=0&&(u=s[d],u.data===ne);--d)u.data=null}if(v.parent=Ye,v.eachBefore(function(d){d.depth=d.parent.depth+1,--m}).eachBefore(de),v.parent=null,m>0)throw new Error("cycle");return v}return r.id=function(a){return arguments.length?(e=te(a),r):e},r.parentId=function(a){return arguments.length?(t=te(a),r):t},r.path=function(a){return arguments.length?(n=te(a),r):n},r}function Je(e){e=`${e}`;let t=e.length;return ie(e,t-1)&&!ie(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function ce(e){let t=e.length;if(t<2)return"";for(;--t>1&&!ie(e,t););return e.slice(0,t)}function ie(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function Qe(e,t,n,r,a){for(var s=e.children,l,h=-1,m=s.length,j=e.value&&(a-n)/e.value;++h<m;)l=s[h],l.x0=t,l.x1=r,l.y0=n,l.y1=n+=l.value*j}var et=(1+Math.sqrt(5))/2;function tt(e,t,n,r,a,s){for(var l=[],h=t.children,m,j,c=0,v=0,i=h.length,u,f,y=t.value,p,d,C,k,w,E,R;c<i;){u=a-n,f=s-r;do p=h[v++].value;while(!p&&v<i);for(d=C=p,E=Math.max(f/u,u/f)/(y*e),R=p*p*E,w=Math.max(C/R,R/d);v<i;++v){if(p+=j=h[v].value,j<d&&(d=j),j>C&&(C=j),R=p*p*E,k=Math.max(C/R,R/d),k>w){p-=j;break}w=k}l.push(m={value:p,dice:u<f,children:h.slice(c,v)}),m.dice?Xe(m,n,r,a,y?r+=f*p/y:s):Qe(m,n,r,y?n+=u*p/y:a,s),y-=p,c=v}return l}const nt=function e(t){function n(r,a,s,l,h){tt(t,r,a,s,l,h)}return n.ratio=function(r){return e((r=+r)>1?r:1)},n}(et);function it(){var e=nt,t=!1,n=1,r=1,a=[0],s=G,l=G,h=G,m=G,j=G;function c(i){return i.x0=i.y0=0,i.x1=n,i.y1=r,i.eachBefore(v),a=[0],t&&i.eachBefore(Fe),i}function v(i){var u=a[i.depth],f=i.x0+u,y=i.y0+u,p=i.x1-u,d=i.y1-u;p<f&&(f=p=(f+p)/2),d<y&&(y=d=(y+d)/2),i.x0=f,i.y0=y,i.x1=p,i.y1=d,i.children&&(u=a[i.depth+1]=s(i)/2,f+=j(i)-u,y+=l(i)-u,p-=h(i)-u,d-=m(i)-u,p<f&&(f=p=(f+p)/2),d<y&&(y=d=(y+d)/2),e(i,f,y,p,d))}return c.round=function(i){return arguments.length?(t=!!i,c):t},c.size=function(i){return arguments.length?(n=+i[0],r=+i[1],c):[n,r]},c.tile=function(i){return arguments.length?(e=fe(i),c):e},c.padding=function(i){return arguments.length?c.paddingInner(i).paddingOuter(i):c.paddingInner()},c.paddingInner=function(i){return arguments.length?(s=typeof i=="function"?i:W(+i),c):s},c.paddingOuter=function(i){return arguments.length?c.paddingTop(i).paddingRight(i).paddingBottom(i).paddingLeft(i):c.paddingTop()},c.paddingTop=function(i){return arguments.length?(l=typeof i=="function"?i:W(+i),c):l},c.paddingRight=function(i){return arguments.length?(h=typeof i=="function"?i:W(+i),c):h},c.paddingBottom=function(i){return arguments.length?(m=typeof i=="function"?i:W(+i),c):m},c.paddingLeft=function(i){return arguments.length?(j=typeof i=="function"?i:W(+i),c):j},c}function rt(e){const{data:t,colors:n,leftMargin:r,width:a,height:s,colorDomain:l,rightMargin:h,topMargin:m,bottomMargin:j,showLabels:c,tooltip:v,onSeriesMouseOver:i,selectedColor:u,showValues:f,suffix:y,prefix:p,highlightedDataPoints:d,onSeriesMouseClick:C,resetSelectionOnDoubleClick:k,detailsOnClick:w,language:E,styles:R,classNames:$,animate:B,dimmedOpacity:H,precision:J}=e,X=O.useRef(null),V=we.useInView(X,{once:B.once,amount:B.amount}),[L,S]=O.useState(void 0),[D,I]=O.useState(void 0),[_,A]=O.useState(void 0),[Y,z]=O.useState(void 0),M={top:m,bottom:j,left:r,right:h},q=a-M.left-M.right,K=s-M.top-M.bottom,Q=[{id:"root",parent:void 0,value:void 0,data:void 0},...t.map(o=>({id:o.label,value:o.size,parent:"root",data:o}))],U=Ze().id(o=>o.id).parentId(o=>o.parent)(Q);U.sum(o=>o.value);const T=it().size([q,K]).padding(2)(U);return g.jsxRuntimeExports.jsxs(g.jsxRuntimeExports.Fragment,{children:[g.jsxRuntimeExports.jsx(Z.motion.svg,{width:`${a}px`,height:`${s}px`,viewBox:`0 0 ${a} ${s}`,direction:"ltr",ref:X,children:g.jsxRuntimeExports.jsx("g",{transform:`translate(${M.left},${M.top})`,children:g.jsxRuntimeExports.jsx(je.AnimatePresence,{children:T.children?.map(o=>g.jsxRuntimeExports.jsxs(Z.motion.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:0,x:o.x0,y:o.y0},whileInView:{opacity:u?o.data.data.color&&n[l.indexOf(o.data.data.color)]===u?1:H:d.length!==0?d.indexOf(o.data.id)!==-1?.85:H:.85,x:o.x0,y:o.y0,transition:{duration:B.duration}}},initial:"initial",animate:V?"whileInView":"initial",exit:{opacity:0,transition:{duration:B.duration}},onMouseEnter:b=>{S(o.data.data),z(b.clientY),A(b.clientX),i?.(o.data.data)},onClick:()=>{(C||w)&&(D===o.data.id&&k?(I(void 0),C?.(void 0)):(I(o.data.id),C?.(o.data.data)))},onMouseMove:b=>{S(o.data.data),z(b.clientY),A(b.clientX)},onMouseLeave:()=>{S(void 0),A(void 0),z(void 0),i?.(void 0)},children:[g.jsxRuntimeExports.jsx(Z.motion.rect,{x:0,y:0,exit:{width:0,height:0,opacity:0,transition:{duration:B.duration}},variants:{initial:{width:0,height:0,fill:t.filter(b=>b.color).length===0?n[0]:o.data.data.color?n[l.indexOf(o.data.data.color)]:N.Colors.gray},whileInView:{width:o.x1-o.x0,height:o.y1-o.y0,fill:t.filter(b=>b.color).length===0?n[0]:o.data.data.color?n[l.indexOf(o.data.data.color)]:N.Colors.gray,transition:{duration:B.duration}}},initial:"initial",animate:V?"whileInView":"initial"}),o.x1-o.x0>50&&o.y1-o.y0>25&&(c||f)?g.jsxRuntimeExports.jsx(Z.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:B.duration}}},initial:"initial",animate:V?"whileInView":"initial",exit:{opacity:0,transition:{duration:B.duration}},children:g.jsxRuntimeExports.jsx("foreignObject",{y:0,x:0,width:o.x1-o.x0,height:o.y1-o.y0,children:g.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 p-2 w-full",style:{color:ee.getTextColorBasedOnBgColor(t.filter(b=>b.color).length===0?n[0]:o.data.data.color?n[l.indexOf(o.data.data.color)]:N.Colors.gray)},children:[c?g.jsxRuntimeExports.jsx(se.u,{marginBottom:"none",size:"sm",leading:"none",className:g.mo("w-full treemap-label",E==="ar"||E==="he"?"text-right":"text-left",$?.graphObjectValues),style:{WebkitLineClamp:o.y1-o.y0>50?o.y1-o.y0>100?o.y1-o.y0>150?void 0:3:2:1,display:"-webkit-box",WebkitBoxOrient:"vertical",overflow:"hidden",color:ee.getTextColorBasedOnBgColor(t.filter(b=>b.color).length===0?n[0]:o.data.data.color?n[l.indexOf(o.data.data.color)]:N.Colors.gray),...R?.graphObjectValues||{}},children:o.data.id}):null,f?g.jsxRuntimeExports.jsx(se.u,{marginBottom:"none",size:"sm",leading:"none",className:g.mo("w-full font-bold treemap-value",E==="ar"||E==="he"?"text-right":"text-left",$?.graphObjectValues),style:{color:ee.getTextColorBasedOnBgColor(t.filter(b=>b.color).length===0?n[0]:o.data.data.color?n[l.indexOf(o.data.data.color)]:N.Colors.gray),...R?.graphObjectValues||{}},children:ve.numberFormattingFunction(o.data.value,"NA",J,p,y)}):null]})})}):null]},o.data.id))})})}),L&&v&&_&&Y?g.jsxRuntimeExports.jsx(xe.Tooltip,{data:L,body:v,xPos:_,yPos:Y,backgroundStyle:R?.tooltip,className:$?.tooltip}):null,w&&D!==void 0?g.jsxRuntimeExports.jsx(me.X,{open:D!==void 0,onClose:()=>{I(void 0)},children:g.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:ye.string2HTML(w,D)}:void 0,children:typeof w=="function"?w(D):null})}):null]})}function ot(e){const{data:t,graphTitle:n,colors:r,suffix:a="",sources:s,prefix:l="",graphDescription:h,leftMargin:m=0,rightMargin:j=0,topMargin:c=0,bottomMargin:v=0,height:i,width:u,footNote:f,colorDomain:y,colorLegendTitle:p,padding:d,backgroundColor:C=!1,showLabels:k=!0,relativeHeight:w,tooltip:E,onSeriesMouseOver:R,showColorScale:$=!0,showValues:B=!0,graphID:H,highlightedDataPoints:J=[],onSeriesMouseClick:X,graphDownload:V=!1,dataDownload:L=!1,language:S="en",showNAColor:D=!0,minHeight:I=0,theme:_="light",ariaLabel:A,resetSelectionOnDoubleClick:Y=!0,detailsOnClick:z,styles:M,classNames:q,animate:K=!1,dimmedOpacity:Q=.3,precision:U=2}=e,[T,o]=O.useState(0),[b,re]=O.useState(0),[pe,ge]=O.useState(void 0),P=O.useRef(null),oe=O.useRef(null);return O.useEffect(()=>{const x=new ResizeObserver(ae=>{o(u||ae[0].target.clientWidth||620),re(i||ae[0].target.clientHeight||480)});return P.current&&(re(P.current.clientHeight||480),o(P.current.clientWidth||620),u||x.observe(P.current)),()=>x.disconnect()},[u,i]),g.jsxRuntimeExports.jsx("div",{className:`${_||"light"} flex ${u?"w-fit grow-0":"w-full grow"}`,dir:S==="he"||S==="ar"?"rtl":void 0,children:g.jsxRuntimeExports.jsx("div",{className:g.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${S||"en"}`,q?.graphContainer),style:{...M?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:H,ref:oe,"aria-label":A||`${n?`The graph shows ${n}. `:""}This is a chart where data points are represented by squares, and their sizes reflect their values. ${h?` ${h}`:""}`,children:g.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?d||"1rem":d||0},children:g.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[n||h||V||L?g.jsxRuntimeExports.jsx(Ee.GraphHeader,{styles:{title:M?.title,description:M?.description},classNames:{title:q?.title,description:q?.description},graphTitle:n,graphDescription:h,width:u,graphDownload:V?oe.current:void 0,dataDownload:L?t.map(x=>x.data).filter(x=>x!==void 0).length>0?t.map(x=>x.data).filter(x=>x!==void 0):t.filter(x=>x!==void 0):null}):null,g.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:t.length===0?g.jsxRuntimeExports.jsx(Re.EmptyState,{}):g.jsxRuntimeExports.jsxs(g.jsxRuntimeExports.Fragment,{children:[$&&t.filter(x=>x.color).length!==0?g.jsxRuntimeExports.jsx(Me.ColorLegendWithMouseOver,{width:u,colorLegendTitle:p,colors:r||N.Colors[_].categoricalColors.colors,colorDomain:y||le.uniqBy(t.filter(x=>x.color),"color").map(x=>x.color),setSelectedColor:ge,showNAColor:D}):null,g.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:P,"aria-label":"Graph area",children:(u||T)&&(i||b)?g.jsxRuntimeExports.jsx(rt,{data:t.filter(x=>!Ce.checkIfNullOrUndefined(x.size)),colors:t.filter(x=>x.color).length===0?r?[r]:[N.Colors.primaryColors["blue-600"]]:r||N.Colors[_].categoricalColors.colors,colorDomain:t.filter(x=>x.color).length===0?[]:y||le.uniqBy(t.filter(x=>x.color),"color").map(x=>x.color),width:u||T,height:Math.max(I,i||(w?I?(u||T)*w>I?(u||T)*w:I:(u||T)*w:b)),leftMargin:m,rightMargin:j,topMargin:c,bottomMargin:v,showLabels:k,showValues:B,suffix:a,prefix:l,selectedColor:pe,tooltip:E,onSeriesMouseOver:R,onSeriesMouseClick:X,highlightedDataPoints:J,resetSelectionOnDoubleClick:Y,detailsOnClick:z,styles:M,classNames:q,language:S,animate:K===!0?{duration:.5,once:!0,amount:.5}:K||{duration:0,once:!0,amount:0},dimmedOpacity:Q,precision:U}):null})]})}),s||f?g.jsxRuntimeExports.jsx(be.GraphFooter,{styles:{footnote:M?.footnote,source:M?.source},classNames:{footnote:q?.footnote,source:q?.source},sources:s,footNote:f,width:u}):null]})})})})}exports.TreeMapGraph=ot;
2
+ //# sourceMappingURL=TreeMapGraph.cjs.map