@undp/data-viz 1.4.16 → 1.5.0

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 (224) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.js +3 -3
  3. package/dist/BarGraph.cjs +1 -1
  4. package/dist/BarGraph.js +8 -8
  5. package/dist/BeeSwarmChart.cjs +1 -1
  6. package/dist/BeeSwarmChart.js +5 -5
  7. package/dist/BiVariateChoroplethMap.cjs +1 -1
  8. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  9. package/dist/BiVariateChoroplethMap.js +35 -34
  10. package/dist/BiVariateChoroplethMap.js.map +1 -1
  11. package/dist/BulletChart.cjs +1 -1
  12. package/dist/BulletChart.js +5 -5
  13. package/dist/ButterflyChart.cjs +1 -1
  14. package/dist/ButterflyChart.js +5 -5
  15. package/dist/ChoroplethMap.cjs +1 -1
  16. package/dist/ChoroplethMap.cjs.map +1 -1
  17. package/dist/ChoroplethMap.js +52 -51
  18. package/dist/ChoroplethMap.js.map +1 -1
  19. package/dist/CirclePackingGraph.cjs +1 -1
  20. package/dist/CirclePackingGraph.js +3 -3
  21. package/dist/DataCards.cjs +1 -1
  22. package/dist/DataCards.js +5 -5
  23. package/dist/DataTable.cjs +1 -1
  24. package/dist/DataTable.js +3 -3
  25. package/dist/DifferenceLineChart.cjs +1 -1
  26. package/dist/DifferenceLineChart.js +2 -2
  27. package/dist/DonutChart.cjs +1 -1
  28. package/dist/DonutChart.js +4 -4
  29. package/dist/DotDensityMap.cjs +1 -1
  30. package/dist/DotDensityMap.cjs.map +1 -1
  31. package/dist/DotDensityMap.js +39 -38
  32. package/dist/DotDensityMap.js.map +1 -1
  33. package/dist/DualAxisLineChart.cjs +1 -1
  34. package/dist/DualAxisLineChart.js +2 -2
  35. package/dist/DumbbellChart.cjs +1 -1
  36. package/dist/DumbbellChart.js +6 -6
  37. package/dist/GeoHubCompareMaps.cjs +1 -1
  38. package/dist/GeoHubCompareMaps.js +1 -1
  39. package/dist/GeoHubMap.cjs +1 -1
  40. package/dist/GeoHubMap.js +3 -3
  41. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  42. package/dist/GeoHubMapWithLayerSelection.js +4 -4
  43. package/dist/{GraphEl-Bz2jatkM.cjs → GraphEl-4RUlclvW.cjs} +2 -2
  44. package/dist/{GraphEl-Bz2jatkM.cjs.map → GraphEl-4RUlclvW.cjs.map} +1 -1
  45. package/dist/{GraphEl-zNOHBYrK.js → GraphEl-ClIxlWa3.js} +2 -2
  46. package/dist/{GraphEl-zNOHBYrK.js.map → GraphEl-ClIxlWa3.js.map} +1 -1
  47. package/dist/GriddedGraphs.cjs +1 -1
  48. package/dist/GriddedGraphs.d.ts +58 -1
  49. package/dist/GriddedGraphs.js +7 -7
  50. package/dist/GriddedGraphsFromConfig.cjs +1 -1
  51. package/dist/GriddedGraphsFromConfig.d.ts +58 -1
  52. package/dist/GriddedGraphsFromConfig.js +1 -1
  53. package/dist/HeatMap.cjs +1 -1
  54. package/dist/HeatMap.js +4 -4
  55. package/dist/Histogram.cjs +1 -1
  56. package/dist/Histogram.js +1 -1
  57. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  58. package/dist/LineChartWithConfidenceInterval.js +2 -2
  59. package/dist/MultiGraphDashboard.cjs +1 -1
  60. package/dist/MultiGraphDashboard.d.ts +58 -1
  61. package/dist/MultiGraphDashboard.js +5 -5
  62. package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
  63. package/dist/MultiGraphDashboardFromConfig.d.ts +58 -1
  64. package/dist/MultiGraphDashboardFromConfig.js +1 -1
  65. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  66. package/dist/MultiGraphDashboardWideToLongFormat.js +2 -2
  67. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
  68. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
  69. package/dist/MultiLineAltChart.cjs +1 -1
  70. package/dist/MultiLineAltChart.js +3 -3
  71. package/dist/MultiLineChart.cjs +1 -1
  72. package/dist/MultiLineChart.js +2 -2
  73. package/dist/ParetoChart.cjs +1 -1
  74. package/dist/ParetoChart.js +3 -3
  75. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  76. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +58 -1
  77. package/dist/PerformanceIntensiveMultiGraphDashboard.js +5 -5
  78. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
  79. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +58 -1
  80. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
  81. package/dist/PerformanceIntensiveScrollStory.d.ts +58 -1
  82. package/dist/RadarChart.cjs +1 -1
  83. package/dist/RadarChart.js +4 -4
  84. package/dist/SankeyChart.cjs +1 -1
  85. package/dist/SankeyChart.js +6 -6
  86. package/dist/ScatterPlot.cjs +1 -1
  87. package/dist/ScatterPlot.js +6 -6
  88. package/dist/ScrollStory.d.ts +58 -1
  89. package/dist/SimpleLineChart.cjs +1 -1
  90. package/dist/SimpleLineChart.js +2 -2
  91. package/dist/SingleGraphDashboard.cjs +1 -1
  92. package/dist/SingleGraphDashboard.d.ts +58 -1
  93. package/dist/SingleGraphDashboard.js +8 -8
  94. package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
  95. package/dist/SingleGraphDashboardFromConfig.d.ts +58 -1
  96. package/dist/SingleGraphDashboardFromConfig.js +1 -1
  97. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +58 -1
  98. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
  99. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +58 -1
  100. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
  101. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  102. package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
  103. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +58 -1
  104. package/dist/SingleGraphDashboardThreeDGraphs.js +20 -19
  105. package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
  106. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
  107. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +58 -1
  108. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
  109. package/dist/SlopeChart.cjs +1 -1
  110. package/dist/SlopeChart.js +4 -4
  111. package/dist/SparkLine.cjs +1 -1
  112. package/dist/SparkLine.js +2 -2
  113. package/dist/StatCardFromData.cjs +1 -1
  114. package/dist/StatCardFromData.js +1 -1
  115. package/dist/StripChart.cjs +1 -1
  116. package/dist/StripChart.js +5 -5
  117. package/dist/ThreeDGlobe.cjs +1 -1
  118. package/dist/ThreeDGlobe.cjs.map +1 -1
  119. package/dist/ThreeDGlobe.d.ts +61 -6
  120. package/dist/ThreeDGlobe.js +385 -314
  121. package/dist/ThreeDGlobe.js.map +1 -1
  122. package/dist/{Tooltip-DyM5snqx.js → Tooltip-CVCGWyzw.js} +2 -2
  123. package/dist/{Tooltip-DyM5snqx.js.map → Tooltip-CVCGWyzw.js.map} +1 -1
  124. package/dist/{Tooltip-n8z5bfav.cjs → Tooltip-De16GWhY.cjs} +2 -2
  125. package/dist/{Tooltip-n8z5bfav.cjs.map → Tooltip-De16GWhY.cjs.map} +1 -1
  126. package/dist/TreeMapGraph.cjs +1 -1
  127. package/dist/TreeMapGraph.js +3 -3
  128. package/dist/Types.d.ts +58 -1
  129. package/dist/UnitChart.cjs +1 -1
  130. package/dist/UnitChart.js +1 -1
  131. package/dist/_commonjsHelpers-BH3jXuIh.cjs +2 -0
  132. package/dist/_commonjsHelpers-BH3jXuIh.cjs.map +1 -0
  133. package/dist/_commonjsHelpers-ByX85dGu.js +34 -0
  134. package/dist/_commonjsHelpers-ByX85dGu.js.map +1 -0
  135. package/dist/{ensureCompleteData-BBDZbDCE.js → ensureCompleteData-BALdOrsS.js} +2 -2
  136. package/dist/{ensureCompleteData-BBDZbDCE.js.map → ensureCompleteData-BALdOrsS.js.map} +1 -1
  137. package/dist/{ensureCompleteData-DqWQ2Zbi.cjs → ensureCompleteData-BU5Zlccy.cjs} +2 -2
  138. package/dist/{ensureCompleteData-DqWQ2Zbi.cjs.map → ensureCompleteData-BU5Zlccy.cjs.map} +1 -1
  139. package/dist/{fetchAndParseData-4gsYTy6_.js → fetchAndParseData-DBOl1Icl.js} +2 -2
  140. package/dist/{fetchAndParseData-4gsYTy6_.js.map → fetchAndParseData-DBOl1Icl.js.map} +1 -1
  141. package/dist/{fetchAndParseData-CQyVGCul.cjs → fetchAndParseData-Dcy7AS_0.cjs} +2 -2
  142. package/dist/{fetchAndParseData-CQyVGCul.cjs.map → fetchAndParseData-Dcy7AS_0.cjs.map} +1 -1
  143. package/dist/fetchAndParseData.cjs +1 -1
  144. package/dist/fetchAndParseData.js +1 -1
  145. package/dist/{filterData-B8ocT57s.js → filterData-9nEcQ-Jp.js} +3 -3
  146. package/dist/{filterData-B8ocT57s.js.map → filterData-9nEcQ-Jp.js.map} +1 -1
  147. package/dist/{filterData-DN6py7y_.cjs → filterData-BoYadk0l.cjs} +2 -2
  148. package/dist/{filterData-DN6py7y_.cjs.map → filterData-BoYadk0l.cjs.map} +1 -1
  149. package/dist/{getJenks-VhM3GIoC.js → getJenks-DW96UYNE.js} +2 -2
  150. package/dist/{getJenks-VhM3GIoC.js.map → getJenks-DW96UYNE.js.map} +1 -1
  151. package/dist/{getJenks-TWQvbuOz.cjs → getJenks-vofIZmeb.cjs} +2 -2
  152. package/dist/{getJenks-TWQvbuOz.cjs.map → getJenks-vofIZmeb.cjs.map} +1 -1
  153. package/dist/{getUniqValue-CHqgSss5.cjs → getUniqValue-CfuE_l9c.cjs} +2 -2
  154. package/dist/{getUniqValue-CHqgSss5.cjs.map → getUniqValue-CfuE_l9c.cjs.map} +1 -1
  155. package/dist/{getUniqValue-BtUENB2H.js → getUniqValue-CttuU_wn.js} +4 -4
  156. package/dist/{getUniqValue-BtUENB2H.js.map → getUniqValue-CttuU_wn.js.map} +1 -1
  157. package/dist/{index-CaAIPGZo.js → index-AqnpA7_O.js} +2 -2
  158. package/dist/{index-CaAIPGZo.js.map → index-AqnpA7_O.js.map} +1 -1
  159. package/dist/{index-CZbIGs8q.cjs → index-BJOeaYTk.cjs} +2 -2
  160. package/dist/{index-CZbIGs8q.cjs.map → index-BJOeaYTk.cjs.map} +1 -1
  161. package/dist/{index-Bc5VF70V.js → index-BMgDMxKJ.js} +6 -6
  162. package/dist/{index-Bc5VF70V.js.map → index-BMgDMxKJ.js.map} +1 -1
  163. package/dist/{index-B0rbzOoC.cjs → index-BS2TADPj.cjs} +2 -2
  164. package/dist/{index-B0rbzOoC.cjs.map → index-BS2TADPj.cjs.map} +1 -1
  165. package/dist/{index-27yTRcko.js → index-Bwrro8-q.js} +2 -2
  166. package/dist/{index-27yTRcko.js.map → index-Bwrro8-q.js.map} +1 -1
  167. package/dist/{index-BczVvEBZ.cjs → index-CQ3e6Ewi.cjs} +2 -2
  168. package/dist/{index-BczVvEBZ.cjs.map → index-CQ3e6Ewi.cjs.map} +1 -1
  169. package/dist/{index-C21TvELx.cjs → index-CSNtgibC.cjs} +2 -2
  170. package/dist/{index-C21TvELx.cjs.map → index-CSNtgibC.cjs.map} +1 -1
  171. package/dist/{index-D7ltPi18.js → index-CeVNqhMO.js} +2 -2
  172. package/dist/{index-D7ltPi18.js.map → index-CeVNqhMO.js.map} +1 -1
  173. package/dist/index-D05lK1Te.cjs +2 -0
  174. package/dist/index-D05lK1Te.cjs.map +1 -0
  175. package/dist/{index-Ds0uHjK9.cjs → index-D72cOtq7.cjs} +2 -2
  176. package/dist/{index-Ds0uHjK9.cjs.map → index-D72cOtq7.cjs.map} +1 -1
  177. package/dist/{index-BXns0-ng.cjs → index-DQA8q5sC.cjs} +2 -2
  178. package/dist/{index-BXns0-ng.cjs.map → index-DQA8q5sC.cjs.map} +1 -1
  179. package/dist/{index-BzeLQvXk.cjs → index-DYH8g9WA.cjs} +2 -2
  180. package/dist/{index-BzeLQvXk.cjs.map → index-DYH8g9WA.cjs.map} +1 -1
  181. package/dist/{index-BbNoLJ_w.cjs → index-Da2GUKrr.cjs} +2 -2
  182. package/dist/{index-BbNoLJ_w.cjs.map → index-Da2GUKrr.cjs.map} +1 -1
  183. package/dist/{index-BLizQDlg.js → index-DvVprvy6.js} +2 -2
  184. package/dist/{index-BLizQDlg.js.map → index-DvVprvy6.js.map} +1 -1
  185. package/dist/{index-UV9hjG_S.js → index-EArKRVKg.js} +2 -2
  186. package/dist/{index-UV9hjG_S.js.map → index-EArKRVKg.js.map} +1 -1
  187. package/dist/{index-C1rRk_50.js → index-V_JXij1_.js} +2 -2
  188. package/dist/{index-C1rRk_50.js.map → index-V_JXij1_.js.map} +1 -1
  189. package/dist/{index-DxagiOHo.js → index-fwdktvAS.js} +2 -2
  190. package/dist/{index-DxagiOHo.js.map → index-fwdktvAS.js.map} +1 -1
  191. package/dist/index-qfWCwobm.js +682 -0
  192. package/dist/index-qfWCwobm.js.map +1 -0
  193. package/dist/index.cjs +1 -1
  194. package/dist/index.d.ts +63 -7
  195. package/dist/index.js +6 -6
  196. package/dist/{string2HTML-CWHGfz_d.js → string2HTML-oFCROsus.js} +2 -2
  197. package/dist/{string2HTML-CWHGfz_d.js.map → string2HTML-oFCROsus.js.map} +1 -1
  198. package/dist/{string2HTML-D2Avudmb.cjs → string2HTML-z7CwHXcx.cjs} +2 -2
  199. package/dist/{string2HTML-D2Avudmb.cjs.map → string2HTML-z7CwHXcx.cjs.map} +1 -1
  200. package/dist/transformData.cjs +1 -1
  201. package/dist/transformData.js +3 -3
  202. package/dist/{transformDataForAggregation-CdcwlnNe.js → transformDataForAggregation-1BYVFqvF.js} +4 -4
  203. package/dist/{transformDataForAggregation-CdcwlnNe.js.map → transformDataForAggregation-1BYVFqvF.js.map} +1 -1
  204. package/dist/{transformDataForAggregation-Du-Hei-W.cjs → transformDataForAggregation-BVxVu4yY.cjs} +2 -2
  205. package/dist/{transformDataForAggregation-Du-Hei-W.cjs.map → transformDataForAggregation-BVxVu4yY.cjs.map} +1 -1
  206. package/dist/{transformDataForGraphFromFile-BCjsizvb.js → transformDataForGraphFromFile-BC9Ha8hF.js} +3 -3
  207. package/dist/{transformDataForGraphFromFile-BCjsizvb.js.map → transformDataForGraphFromFile-BC9Ha8hF.js.map} +1 -1
  208. package/dist/{transformDataForGraphFromFile-B1A0AS-Z.cjs → transformDataForGraphFromFile-b41aNQYY.cjs} +2 -2
  209. package/dist/{transformDataForGraphFromFile-B1A0AS-Z.cjs.map → transformDataForGraphFromFile-b41aNQYY.cjs.map} +1 -1
  210. package/dist/utils.cjs +1 -1
  211. package/dist/utils.js +2 -2
  212. package/dist/zoom-Bsbhil-K.cjs +2 -0
  213. package/dist/zoom-Bsbhil-K.cjs.map +1 -0
  214. package/dist/zoom-DAu91HKr.js +1864 -0
  215. package/dist/zoom-DAu91HKr.js.map +1 -0
  216. package/package.json +2 -2
  217. package/dist/_commonjsHelpers-DKOUU3wS.cjs +0 -2
  218. package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +0 -1
  219. package/dist/_commonjsHelpers-DaMA6jEr.js +0 -9
  220. package/dist/_commonjsHelpers-DaMA6jEr.js.map +0 -1
  221. package/dist/zoom-Lo7IAUfC.cjs +0 -2
  222. package/dist/zoom-Lo7IAUfC.cjs.map +0 -1
  223. package/dist/zoom-_lqdiGoI.js +0 -1983
  224. package/dist/zoom-_lqdiGoI.js.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, FogDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { X } from '@/Components/Icons';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n width: number;\r\n data: ChoroplethMapDataType[];\r\n autoRotate: number;\r\n enableZoom: boolean;\r\n categorical: boolean;\r\n colorDomain: number[] | string[];\r\n colors: string[];\r\n height: number;\r\n globeMaterial?: THREE.Material;\r\n polygonData: any;\r\n mapProperty: string;\r\n mapBorderColor: string;\r\n atmosphereColor: string;\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapNoDataColor: string;\r\n colorLegendTitle?: string;\r\n showColorScale: boolean;\r\n hoverStrokeColor: string;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n resetSelectionOnDoubleClick: boolean;\r\n highlightedIds: string[];\r\n scale: number;\r\n globeOffset: [number, number];\r\n polygonAltitude: number;\r\n centerLng: number;\r\n centerLat: number;\r\n atmosphereAltitude: number;\r\n globeCurvatureResolution: number;\r\n lightColor: string;\r\n fogSettings?: FogDataType;\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 colorLegendTitle,\r\n showColorScale,\r\n hoverStrokeColor,\r\n detailsOnClick,\r\n onSeriesMouseClick,\r\n onSeriesMouseOver,\r\n resetSelectionOnDoubleClick,\r\n highlightedIds,\r\n scale,\r\n globeOffset,\r\n polygonAltitude,\r\n centerLng,\r\n centerLat,\r\n atmosphereAltitude,\r\n globeCurvatureResolution,\r\n lightColor,\r\n fogSettings,\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().enableZoom = enableZoom;\r\n }\r\n }, [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 globeEl.current.controls().autoRotateSpeed = autoRotate;\r\n }\r\n }\r\n }, [mouseOverData, autoRotate]);\r\n\r\n useEffect(() => {\r\n const canvas = globeEl.current?.renderer().domElement;\r\n if (!canvas) return;\r\n\r\n const handleMouseMove = (e: MouseEvent) => {\r\n setMousePos({ x: e.clientX, y: e.clientY });\r\n };\r\n\r\n canvas.addEventListener('mousemove', handleMouseMove);\r\n return () => canvas.removeEventListener('mousemove', handleMouseMove);\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({ lat: centerLat, lng: centerLng, altitude: scale }, 1000);\r\n }\r\n }, [scale, centerLng, centerLat]);\r\n const materials =\r\n globeMaterial ||\r\n new THREE.MeshBasicMaterial({\r\n color: '#FFF',\r\n });\r\n useEffect(() => {\r\n if (!globeEl.current) return;\r\n\r\n const scene = globeEl.current.scene();\r\n scene.children\r\n .filter(d => d.type === 'DirectionalLight' || d.type === 'AmbientLight')\r\n .forEach(d => scene.remove(d));\r\n const ambientLight = new THREE.AmbientLight(lightColor, 0.2);\r\n scene.add(ambientLight);\r\n setTimeout(() => {\r\n const polygons = scene.children[3]?.children[0]?.children[4]?.children || [];\r\n polygons.forEach(d => {\r\n const line = d.children[1];\r\n if (line) line.renderOrder = 2;\r\n });\r\n }, 300);\r\n if (fogSettings)\r\n scene.fog = new THREE.Fog(fogSettings.color, fogSettings.near, fogSettings.far);\r\n }, [lightColor, scale, fogSettings]);\r\n return (\r\n <div className='relative'>\r\n <Globe\r\n ref={globeEl}\r\n height={height}\r\n width={width}\r\n globeOffset={globeOffset}\r\n lineHoverPrecision={0}\r\n polygonsData={polygonData}\r\n polygonAltitude={(polygon: any) =>\r\n highlightedIds.includes(polygon?.properties?.[mapProperty])\r\n ? 0.1\r\n : polygon?.properties?.[mapProperty] === mouseOverData?.id\r\n ? 0.01\r\n : polygonAltitude\r\n }\r\n polygonCapColor={(polygon: any) => {\r\n const id = polygon?.properties?.[mapProperty];\r\n const val = data.find(el => el.id === id)?.x;\r\n if (val !== undefined && val !== null) {\r\n return colorScale(val as any);\r\n }\r\n return mapNoDataColor;\r\n }}\r\n polygonSideColor={(polygon: any) => {\r\n const id = polygon?.properties?.[mapProperty];\r\n const val = data.find(el => el.id === id)?.x;\r\n const color = val !== undefined && val !== null ? colorScale(val as any) : mapNoDataColor;\r\n return highlightedIds.includes(polygon?.properties?.[mapProperty])\r\n ? color\r\n : 'rgba(100,100,100,0)';\r\n }}\r\n polygonStrokeColor={(polygon: any) =>\r\n polygon?.properties?.[mapProperty] === mouseOverData?.id\r\n ? hoverStrokeColor\r\n : mapBorderColor\r\n }\r\n onPolygonClick={(polygon: any) => {\r\n const clickedData = polygon?.properties?.[mapProperty]\r\n ? data.find(el => el.id === polygon?.properties?.[mapProperty])\r\n : undefined;\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n isEqual(mouseClickData, clickedData) &&\r\n resetSelectionOnDoubleClick &&\r\n clickedData\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(clickedData);\r\n onSeriesMouseClick?.(clickedData);\r\n }\r\n }\r\n setMouseClickData(clickedData);\r\n onSeriesMouseClick?.(clickedData);\r\n }}\r\n onPolygonHover={(polygon: any) => {\r\n const hoverData = polygon?.properties?.[mapProperty]\r\n ? data.find(el => el.id === polygon?.properties?.[mapProperty])\r\n : undefined;\r\n setMouseOverData(hoverData);\r\n onSeriesMouseOver?.(hoverData);\r\n }}\r\n atmosphereColor={atmosphereColor}\r\n atmosphereAltitude={atmosphereAltitude}\r\n globeCurvatureResolution={globeCurvatureResolution}\r\n globeMaterial={materials}\r\n backgroundColor='rgba(0, 0, 0, 0)'\r\n polygonsTransitionDuration={100}\r\n onGlobeReady={() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({\r\n lat: centerLat,\r\n lng: centerLng,\r\n });\r\n const scene = globeEl.current.scene();\r\n setTimeout(() => {\r\n scene.children\r\n .filter(d => d.type === 'DirectionalLight')\r\n .map(d => {\r\n scene.remove(d);\r\n });\r\n const ambientLight = new THREE.AmbientLight(lightColor, 0.2);\r\n scene.add(ambientLight);\r\n\r\n const polygons = scene.children[3]?.children[0]?.children[4]?.children || [];\r\n polygons.forEach(d => {\r\n const line = d.children[1];\r\n line.renderOrder = 2;\r\n });\r\n }, 300);\r\n const light = new THREE.DirectionalLight(0xffffff, 0.1);\r\n const camera = globeEl.current.camera();\r\n light.position.set(0, 0, 1);\r\n camera.add(light);\r\n scene.add(camera);\r\n }\r\n }}\r\n />\r\n {showColorScale === false ? null : (\r\n <div className='absolute left-4 bottom-4'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='p-2'\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n width: categorical ? undefined : '340px',\r\n }}\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P\r\n size='xs'\r\n marginBottom='xs'\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n {!categorical ? (\r\n <svg width='100%' viewBox='0 0 320 30' direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g key={i} className='cursor-pointer'>\r\n <rect\r\n x={(i * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n style={{\r\n fill: colors[i],\r\n stroke: colors[i],\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * 320) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-xs'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n x={(colorDomain.length * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n stroke: colors[colorDomain.length],\r\n }}\r\n />\r\n </g>\r\n </g>\r\n </svg>\r\n ) : (\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div key={i} className='flex gap-2 items-center'>\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {mouseOverData && tooltip ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={mousePos.x}\r\n yPos={mousePos.y}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </div>\r\n );\r\n}\r\n\r\nexport default Graph;\r\n","import React, { useEffect, useRef, useState } from 'react';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport * as THREE from 'three';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport Globe from 'react-globe.gl';\r\n\r\nimport Graph from './Graph';\r\n\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport {\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n FogDataType,\r\n Languages,\r\n ScaleDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\n\r\ntype GlobeProps = React.ComponentProps<typeof Globe>;\r\ninterface Props extends Partial<Omit<GlobeProps, 'backgroundColor'>> {\r\n // Data\r\n /** Array of data objects */\r\n data: ChoroplethMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: number[] | string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines if the globe rotates automatically */\r\n autoRotate?: number | boolean;\r\n /** Defines the material property applied to the sphere of the globe */\r\n globeMaterial?: THREE.Material;\r\n /** Defines the colo of the glow around the globe */\r\n atmosphereColor?: string;\r\n /** Defines if the globe can be zoomed when scrolled */\r\n enableZoom?: boolean;\r\n /** Position offset of the globe relative to the canvas center */\r\n globeOffset?: [number, number];\r\n /** Defines the camera distance from Earth. This helps in defining the default size of the globe. Smaller = closer camera therefore the globe is bigger) */\r\n scale?: number;\r\n /** Defines the spacing between the country shape polygon with the sphere */\r\n polygonAltitude?: number;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggles if the color scaling is categorical or not */\r\n categorical?: boolean;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** The max altitude of the atmosphere, in terms of globe radius units. */\r\n atmosphereAltitude?: number;\r\n /** Resolution in angular degrees of the sphere curvature. The finer the resolution, the more the globe is fragmented into smaller faces to approximate the spheric surface, at the cost of performance. */\r\n globeCurvatureResolution?: number;\r\n /** Defines the color of the light and atmosphere. */\r\n lightColor?: string;\r\n /** Defines fog settings for the scene. */\r\n fogSettings?: FogDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\n/** For using these maps you will have to install [`three`](https://threejs.org/manual/) and [react-globe.gl](https://www.npmjs.com/package/react-globe.gl) package to your project */\r\nexport function ThreeDGlobe(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-simplified.json',\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n colorDomain,\r\n colorLegendTitle,\r\n scaleType = 'threshold',\r\n padding,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n tooltip,\r\n graphID,\r\n mapProperty = 'ISO3',\r\n dataDownload = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n styles,\r\n classNames,\r\n autoRotate = true,\r\n enableZoom = true,\r\n globeMaterial,\r\n centerPoint = [0, 0],\r\n atmosphereColor = '#999',\r\n showColorScale = true,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n highlightedIds = [],\r\n scale = 1,\r\n globeOffset = [0, 0],\r\n polygonAltitude = 0.01,\r\n globeCurvatureResolution = 4,\r\n atmosphereAltitude = 0.15,\r\n lightColor = '#dce9fe',\r\n fogSettings,\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 width ? 'w-fit' : 'w-full',\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 colorLegendTitle={colorLegendTitle}\r\n showColorScale={showColorScale}\r\n hoverStrokeColor={\r\n theme === 'light'\r\n ? Colors.light.grays['gray-700']\r\n : Colors.light.grays['gray-300']\r\n }\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n scale={scale}\r\n polygonAltitude={polygonAltitude}\r\n centerLat={centerPoint[0]}\r\n centerLng={centerPoint[1]}\r\n atmosphereAltitude={atmosphereAltitude}\r\n globeCurvatureResolution={globeCurvatureResolution}\r\n lightColor={lightColor}\r\n fogSettings={fogSettings}\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","colorLegendTitle","showColorScale","hoverStrokeColor","detailsOnClick","onSeriesMouseClick","onSeriesMouseOver","resetSelectionOnDoubleClick","highlightedIds","scale","globeOffset","polygonAltitude","centerLng","centerLat","atmosphereAltitude","globeCurvatureResolution","lightColor","fogSettings","globeEl","useRef","mouseClickData","setMouseClickData","useState","showLegend","setShowLegend","mousePos","setMousePos","mouseOverData","setMouseOverData","colorScale","scaleOrdinal","scaleThreshold","useEffect","canvas","handleMouseMove","e","materials","THREE","scene","d","ambientLight","line","jsxs","jsx","Globe","polygon","id","val","el","color","clickedData","isEqual","hoverData","light","camera","Fragment","X","P","i","numberFormattingFunction","Tooltip","Modal","string2HTML","ThreeDGlobe","mapData","graphTitle","sources","graphDescription","footNote","scaleType","padding","Colors","backgroundColor","relativeHeight","graphID","dataDownload","language","minHeight","theme","ariaLabel","centerPoint","mapShape","setMapShape","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","resizeObserver","entries","fetchAndParseJSON","features","reversed","geometry","coord","c","domain","getUniqValue","getJenks","cn","GraphHeader","Spinner","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoDA,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,YAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,EAAA,IACElC,GACEmC,IAAUC,GAAiC,MAAS,GACpD,CAACC,GAAgBC,CAAiB,IAAIC,EAAc,MAAS,GAC7D,CAACC,IAAYC,CAAa,IAAIF,EAAS,EAAEtC,IAAQ,IAAI,GACrD,CAACyC,GAAUC,EAAW,IAAIJ,EAAS,EAAE,GAAG,GAAG,GAAG,GAAG,GACjD,CAACK,GAAeC,EAAgB,IAAIN,EAA4C,MAAS,GACzFO,IAAazC,IACf0C,GAAA,EAAwC,OAAOzC,CAAW,EAAE,MAAMC,CAAM,IACxEyC,KACG,OAAO1C,CAAuB,EAC9B,MAAMC,CAAM;AACnB,EAAA0C,EAAU,MAAM;AACd,IAAId,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AAAC;AAAA,wBACA,aAAAC;AAAA,sBAAA;AAAA,oBAAA,IAGF0B,gBAAAA,EAAAA;AAAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,OAAO;AAAA,0BACL,QAAQ,GAAG,KAAK;AAAA,4BACdkC;AAAA,4BACArF,MACGiF,IACGI,KACG7F,KAASmG,KAAYV,IAAiBI,KACpC7F,KAASmG,KAAYV,IACtBI,KACD7F,KAASmG,KAAYV,IACxBY;AAAA,0BAAA,CACP;AAAA,wBAAA;AAAA,wBAEH,WAAU;AAAA,wBAEV,UAAA1C,gBAAAA,EAAAA,IAAC0D,IAAA,EAAQ,cAAW,gBAAA,CAAgB;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACtC;AAAA,gBAAA;AAAA,gBAGHnC,KAAWE,IACVzB,gBAAAA,EAAAA;AAAAA,kBAAC2D;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUxG,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAmE;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAApF;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
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 { useCallback, 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\nimport centerOfMass from '@turf/center-of-mass';\r\n\r\nimport {\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n FogDataType,\r\n LightConfig,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { X } from '@/Components/Icons';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\n\r\ninterface Props {\r\n width: number;\r\n data: ChoroplethMapDataType[];\r\n autoRotate: number;\r\n enableZoom: boolean;\r\n categorical: boolean;\r\n colorDomain: number[] | string[];\r\n colors: string[];\r\n height: number;\r\n globeMaterial?: THREE.Material;\r\n lights: LightConfig[];\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 colorLegendTitle?: string;\r\n showColorScale: boolean;\r\n hoverStrokeColor: string;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n resetSelectionOnDoubleClick: boolean;\r\n highlightedIds: string[];\r\n scale: number;\r\n globeOffset: [number, number];\r\n polygonAltitude: number;\r\n centerLng: number;\r\n centerLat: number;\r\n atmosphereAltitude: number;\r\n globeCurvatureResolution: number;\r\n fogSettings?: FogDataType;\r\n highlightedAltitude: number;\r\n}\r\n\r\nfunction createLightFromConfig(config: LightConfig): THREE.Light {\r\n let light: THREE.Light;\r\n\r\n switch (config.type) {\r\n case 'ambient':\r\n light = new THREE.AmbientLight(config.color, config.intensity);\r\n break;\r\n case 'directional':\r\n light = new THREE.DirectionalLight(config.color, config.intensity);\r\n if (config.position) {\r\n if (config.position === 'camera') light.position.set(0, 0, 0);\r\n else light.position.set(config.position.x, config.position.y, config.position.z);\r\n }\r\n if (config.target || config.position === 'camera') {\r\n (light as THREE.SpotLight).target.position.set(\r\n config.target?.x || 0,\r\n config.target?.y || 0,\r\n config.target?.z === undefined ? -1 : config.target.z,\r\n );\r\n }\r\n if (config.castShadow) {\r\n (light as THREE.DirectionalLight).castShadow = true;\r\n if (config.shadow) {\r\n (light as THREE.DirectionalLight).shadow.mapSize.width = config.shadow.mapSize.width;\r\n (light as THREE.DirectionalLight).shadow.mapSize.height = config.shadow.mapSize.height;\r\n (light as THREE.DirectionalLight).shadow.camera.near = config.shadow.camera.near;\r\n (light as THREE.DirectionalLight).shadow.camera.far = config.shadow.camera.far;\r\n }\r\n }\r\n break;\r\n case 'point':\r\n light = new THREE.PointLight(\r\n config.color,\r\n config.intensity,\r\n config.distance || 0,\r\n config.decay || 2,\r\n );\r\n if (config.position) {\r\n if (config.position === 'camera') light.position.set(0, 0, 0);\r\n else light.position.set(config.position.x, config.position.y, config.position.z);\r\n }\r\n break;\r\n case 'spot':\r\n light = new THREE.SpotLight(\r\n config.color,\r\n config.intensity,\r\n config.distance || 0,\r\n config.angle || Math.PI / 3,\r\n config.penumbra || 0,\r\n config.decay || 2,\r\n );\r\n if (config.position) {\r\n if (config.position === 'camera') light.position.set(0, 0, 0);\r\n else light.position.set(config.position.x, config.position.y, config.position.z);\r\n }\r\n if (config.target || config.position === 'camera') {\r\n (light as THREE.SpotLight).target.position.set(\r\n config.target?.x || 0,\r\n config.target?.y || 0,\r\n config.target?.z || 0,\r\n );\r\n }\r\n if (config.castShadow) {\r\n (light as THREE.SpotLight).castShadow = true;\r\n if (config.shadow) {\r\n (light as THREE.SpotLight).shadow.mapSize.width = config.shadow.mapSize.width;\r\n (light as THREE.SpotLight).shadow.mapSize.height = config.shadow.mapSize.height;\r\n (light as THREE.SpotLight).shadow.camera.near = config.shadow.camera.near;\r\n (light as THREE.SpotLight).shadow.camera.far = config.shadow.camera.far;\r\n }\r\n }\r\n break;\r\n default:\r\n throw new Error('Unknown light type');\r\n }\r\n\r\n return light;\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 colorLegendTitle,\r\n showColorScale,\r\n hoverStrokeColor,\r\n detailsOnClick,\r\n onSeriesMouseClick,\r\n onSeriesMouseOver,\r\n resetSelectionOnDoubleClick,\r\n highlightedIds,\r\n scale,\r\n globeOffset,\r\n polygonAltitude,\r\n centerLng,\r\n centerLat,\r\n atmosphereAltitude,\r\n globeCurvatureResolution,\r\n fogSettings,\r\n lights,\r\n highlightedAltitude,\r\n } = props;\r\n const [globeReady, setGlobeReady] = useState(false);\r\n const globeEl = useRef<GlobeMethods | undefined>(undefined);\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [mouseClickCentroid, setMouseClickCentroid] = useState<[number, number] | undefined>(\r\n undefined,\r\n );\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().enableZoom = enableZoom;\r\n }\r\n }, [enableZoom]);\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n if (mouseOverData || mouseClickData) {\r\n globeEl.current.controls().autoRotate = false;\r\n } else {\r\n globeEl.current.controls().autoRotate = autoRotate === 0 ? false : true;\r\n globeEl.current.controls().autoRotateSpeed = autoRotate;\r\n }\r\n }\r\n }, [mouseOverData, mouseClickData, autoRotate]);\r\n useEffect(() => {\r\n if (globeEl.current && mouseClickCentroid) {\r\n globeEl.current.pointOfView(\r\n { lat: mouseClickCentroid[1], lng: mouseClickCentroid[0], altitude: scale },\r\n 1000,\r\n );\r\n }\r\n }, [mouseClickCentroid, scale]);\r\n\r\n useEffect(() => {\r\n const canvas = globeEl.current?.renderer().domElement;\r\n if (!canvas) return;\r\n\r\n const handleMouseMove = (e: MouseEvent) => {\r\n setMousePos({ x: e.clientX, y: e.clientY });\r\n };\r\n\r\n canvas.addEventListener('mousemove', handleMouseMove);\r\n return () => canvas.removeEventListener('mousemove', handleMouseMove);\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({ lat: centerLat, lng: centerLng, altitude: scale }, 1000);\r\n }\r\n }, [scale, centerLng, centerLat]);\r\n const materials =\r\n globeMaterial ||\r\n new THREE.MeshBasicMaterial({\r\n color: '#FFF',\r\n });\r\n const setupCustomLighting = useCallback(() => {\r\n if (!globeEl.current) return;\r\n\r\n const scene = globeEl.current.scene();\r\n const camera = globeEl.current.camera();\r\n\r\n let lightsAndObjToRemove: THREE.Object3D[] = [];\r\n scene.traverse(obj => {\r\n if (obj instanceof THREE.Light) {\r\n lightsAndObjToRemove.push(obj);\r\n }\r\n });\r\n lightsAndObjToRemove = [...lightsAndObjToRemove, ...camera.children];\r\n lightsAndObjToRemove.forEach(light => light.parent?.remove(light));\r\n\r\n const lightConfig = lights.map(config => createLightFromConfig(config));\r\n lightConfig.forEach((light, i) => {\r\n if (lights[i].type !== 'ambient' && lights[i].position === 'camera') {\r\n camera.add(light);\r\n if (lights[i].type !== 'point') {\r\n camera.add((light as THREE.DirectionalLight | THREE.SpotLight).target);\r\n }\r\n } else {\r\n scene.add(light);\r\n }\r\n });\r\n\r\n if (fogSettings) {\r\n scene.fog = new THREE.Fog(fogSettings.color, fogSettings.near, fogSettings.far);\r\n }\r\n }, [lights, fogSettings]);\r\n\r\n const handleGlobeReady = useCallback(() => {\r\n setGlobeReady(true);\r\n setupCustomLighting();\r\n }, [setupCustomLighting]);\r\n useEffect(() => {\r\n if (globeReady) {\r\n setupCustomLighting();\r\n }\r\n }, [globeReady, setupCustomLighting]);\r\n return (\r\n <div className='relative'>\r\n <Globe\r\n ref={globeEl}\r\n height={height}\r\n width={width}\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 ? highlightedAltitude\r\n : polygon?.properties?.[mapProperty] === mouseOverData?.id ||\r\n polygon?.properties?.[mapProperty] === mouseClickData?.id\r\n ? highlightedAltitude\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 onGlobeClick={() => {\r\n setMouseClickData(undefined);\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 setMouseClickCentroid(undefined);\r\n } else {\r\n setMouseClickData(clickedData);\r\n onSeriesMouseClick?.(clickedData);\r\n const [lng, lat] = centerOfMass(polygon).geometry.coordinates;\r\n setMouseClickCentroid([lng, lat]);\r\n }\r\n }\r\n }}\r\n onPolygonHover={(polygon: any) => {\r\n const hoverData = polygon?.properties?.[mapProperty]\r\n ? data.find(el => el.id === polygon?.properties?.[mapProperty])\r\n : undefined;\r\n setMouseOverData(hoverData);\r\n onSeriesMouseOver?.(hoverData);\r\n }}\r\n atmosphereColor={atmosphereColor}\r\n atmosphereAltitude={atmosphereAltitude}\r\n globeCurvatureResolution={globeCurvatureResolution}\r\n globeMaterial={materials}\r\n backgroundColor='rgba(0, 0, 0, 0)'\r\n polygonsTransitionDuration={100}\r\n onGlobeReady={() => {\r\n if (globeEl.current) {\r\n globeEl.current.pointOfView({\r\n lat: centerLat,\r\n lng: centerLng,\r\n });\r\n const scene = globeEl.current.scene();\r\n setTimeout(() => {\r\n const polygons = scene.children[3]?.children[0]?.children[4]?.children || [];\r\n polygons.forEach(d => {\r\n const line = d.children[1];\r\n line.renderOrder = 2;\r\n });\r\n }, 300);\r\n const camera = globeEl.current.camera();\r\n scene.add(camera);\r\n handleGlobeReady();\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 FogDataType,\r\n Languages,\r\n LightConfig,\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.Material;\r\n /** Defines the lights for the 3D scene */\r\n lights?: LightConfig[];\r\n /** Defines the colo of the glow around the globe */\r\n atmosphereColor?: string;\r\n /** Defines if the globe can be zoomed when scrolled */\r\n enableZoom?: boolean;\r\n /** Position offset of the globe relative to the canvas center */\r\n globeOffset?: [number, number];\r\n /** Defines the camera distance from Earth. This helps in defining the default size of the globe. Smaller = closer camera therefore the globe is bigger) */\r\n scale?: number;\r\n /** Defines the spacing between the country shape polygon with the sphere */\r\n polygonAltitude?: number;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggles if the color scaling is categorical or not */\r\n categorical?: boolean;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** The max altitude of the atmosphere, in terms of globe radius units. */\r\n atmosphereAltitude?: number;\r\n /** Resolution in angular degrees of the sphere curvature. The finer the resolution, the more the globe is fragmented into smaller faces to approximate the spheric surface, at the cost of performance. */\r\n globeCurvatureResolution?: number;\r\n /** Defines fog settings for the scene. */\r\n fogSettings?: FogDataType;\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 /** Defines the altitude of the highlighted countries or the countries on mouseover. */\r\n highlightedAltitude?: number;\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 highlightedAltitude = 0.1,\r\n scale = 1,\r\n globeOffset = [0, 0],\r\n polygonAltitude = 0.01,\r\n globeCurvatureResolution = 4,\r\n atmosphereAltitude = 0.15,\r\n fogSettings,\r\n lights = [\r\n {\r\n type: 'ambient',\r\n color: 0x404040,\r\n intensity: 0.4,\r\n },\r\n {\r\n type: 'directional',\r\n color: 0xffffff,\r\n intensity: 1,\r\n position: { x: 5, y: 10, z: 5 },\r\n },\r\n ],\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 width ? 'w-fit' : 'w-full',\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 colorLegendTitle={colorLegendTitle}\r\n showColorScale={showColorScale}\r\n hoverStrokeColor={\r\n theme === 'light'\r\n ? Colors.light.grays['gray-700']\r\n : Colors.light.grays['gray-300']\r\n }\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n scale={scale}\r\n polygonAltitude={polygonAltitude}\r\n centerLat={centerPoint[0]}\r\n centerLng={centerPoint[1]}\r\n atmosphereAltitude={atmosphereAltitude}\r\n globeCurvatureResolution={globeCurvatureResolution}\r\n fogSettings={fogSettings}\r\n lights={lights}\r\n highlightedAltitude={highlightedAltitude}\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":["createLightFromConfig","config","light","THREE","Graph","props","width","autoRotate","data","enableZoom","categorical","colorDomain","colors","globeMaterial","height","polygonData","mapProperty","mapBorderColor","atmosphereColor","tooltip","styles","classNames","mapNoDataColor","colorLegendTitle","showColorScale","hoverStrokeColor","detailsOnClick","onSeriesMouseClick","onSeriesMouseOver","resetSelectionOnDoubleClick","highlightedIds","scale","globeOffset","polygonAltitude","centerLng","centerLat","atmosphereAltitude","globeCurvatureResolution","fogSettings","lights","highlightedAltitude","globeReady","setGlobeReady","useState","globeEl","useRef","mouseClickData","setMouseClickData","mouseClickCentroid","setMouseClickCentroid","showLegend","setShowLegend","mousePos","setMousePos","mouseOverData","setMouseOverData","colorScale","scaleOrdinal","scaleThreshold","useEffect","canvas","handleMouseMove","e","materials","setupCustomLighting","useCallback","scene","camera","lightsAndObjToRemove","obj","i","handleGlobeReady","jsxs","jsx","Globe","polygon","id","val","el","color","clickedData","isEqual","lng","lat","centerOfMass","hoverData","d","line","Fragment","X","P","numberFormattingFunction","Tooltip","Modal","string2HTML","ThreeDGlobe","mapData","graphTitle","sources","graphDescription","footNote","scaleType","padding","Colors","backgroundColor","relativeHeight","graphID","dataDownload","language","minHeight","theme","ariaLabel","centerPoint","mapShape","setMapShape","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","resizeObserver","entries","fetchAndParseJSON","features","reversed","geometry","coord","c","domain","getUniqValue","getJenks","cn","GraphHeader","Spinner","Graph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AA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
@@ -1,6 +1,6 @@
1
1
  import { j as o, m as s } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { createPortal as m } from "react-dom";
3
- import { s as l } from "./string2HTML-CWHGfz_d.js";
3
+ import { s as l } from "./string2HTML-oFCROsus.js";
4
4
  function g(i) {
5
5
  const {
6
6
  body: r,
@@ -43,4 +43,4 @@ function g(i) {
43
43
  export {
44
44
  g as T
45
45
  };
46
- //# sourceMappingURL=Tooltip-DyM5snqx.js.map
46
+ //# sourceMappingURL=Tooltip-CVCGWyzw.js.map
@@ -1 +1 @@
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;"}
1
+ {"version":3,"file":"Tooltip-CVCGWyzw.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;"}
@@ -1,2 +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
+ "use strict";const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react-dom"),l=require("./string2HTML-z7CwHXcx.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-De16GWhY.cjs.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"Tooltip-De16GWhY.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"}
@@ -1,2 +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-tXZlLE5s.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-sQJZ_xDO.cjs"),Z=require("./proxy-BHRoeZgd.cjs"),je=require("./index-BW8iNx7E.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"}`,u?"w-fit":"w-full",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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-CHPV5EwG-DDoeWRVt.cjs"),le=require("./index-BJOeaYTk.cjs"),O=require("react"),se=require("./Typography-k-kOjICQ.cjs"),me=require("./Modal-tXZlLE5s.cjs"),xe=require("./Tooltip-De16GWhY.cjs"),ve=require("./numberFormattingFunction-02t-wJta.cjs"),ee=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),N=require("./Colors.cjs"),ye=require("./string2HTML-z7CwHXcx.cjs"),we=require("./use-in-view-sQJZ_xDO.cjs"),Z=require("./proxy-BHRoeZgd.cjs"),je=require("./index-BW8iNx7E.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"}`,u?"w-fit":"w-full",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
2
  //# sourceMappingURL=TreeMapGraph.cjs.map
@@ -1,13 +1,13 @@
1
1
  import { j as v, m as ne } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
- import { u as ce } from "./index-CaAIPGZo.js";
2
+ import { u as ce } from "./index-AqnpA7_O.js";
3
3
  import { useRef as re, useState as A, useEffect as ye } from "react";
4
4
  import { u as ue } from "./Typography-Ctgfl1J5.js";
5
5
  import { X as we } from "./Modal-DVVwpKhP.js";
6
- import { T as xe } from "./Tooltip-DyM5snqx.js";
6
+ import { T as xe } from "./Tooltip-CVCGWyzw.js";
7
7
  import { n as be } from "./numberFormattingFunction-14YCbkN2.js";
8
8
  import { g as ee } from "./getTextColorBasedOnBgColor-B6Nk2WBf.js";
9
9
  import { Colors as V } from "./Colors.js";
10
- import { s as je } from "./string2HTML-CWHGfz_d.js";
10
+ import { s as je } from "./string2HTML-oFCROsus.js";
11
11
  import { u as Me } from "./use-in-view-yS6jzJAp.js";
12
12
  import { m as Z } from "./proxy-CkpFesk1.js";
13
13
  import { A as Oe } from "./index-CNvov0eg.js";
package/dist/Types.d.ts CHANGED
@@ -25,6 +25,10 @@ export declare interface AggregationSettingsDataType {
25
25
  aggregationMethod?: 'sum' | 'average' | 'min' | 'max';
26
26
  }
27
27
 
28
+ declare interface AmbientLightConfig extends BaseLightConfig {
29
+ type: 'ambient';
30
+ }
31
+
28
32
  export declare interface AnimateDataType {
29
33
  duration: number;
30
34
  once: boolean;
@@ -87,6 +91,12 @@ export declare interface BarGraphDataType {
87
91
  data?: object;
88
92
  }
89
93
 
94
+ declare interface BaseLightConfig {
95
+ type: string;
96
+ color: number;
97
+ intensity: number;
98
+ }
99
+
90
100
  export declare interface BeeSwarmChartDataType {
91
101
  label: string | number;
92
102
  position: number;
@@ -300,6 +310,14 @@ export declare interface DifferenceLineChartDataType {
300
310
  data?: object;
301
311
  }
302
312
 
313
+ declare interface DirectionalLightConfig extends BaseLightConfig {
314
+ type: 'directional';
315
+ target?: Position;
316
+ castShadow?: boolean;
317
+ shadow?: ShadowConfig;
318
+ position?: Position | 'camera';
319
+ }
320
+
303
321
  export declare interface DonutChartDataType {
304
322
  size: number;
305
323
  label: string;
@@ -635,9 +653,10 @@ export declare interface GraphSettingsDataType {
635
653
  polygonAltitude?: number;
636
654
  atmosphereAltitude?: number;
637
655
  globeCurvatureResolution?: number;
638
- lightColor?: string;
656
+ lights?: LightConfig[];
639
657
  fogSetting?: FogDataType;
640
658
  showAxisLabels?: boolean;
659
+ highlightedAltitude?: number;
641
660
  }
642
661
 
643
662
  export declare type GraphType = GraphTypeForGriddedGraph;
@@ -694,6 +713,8 @@ export declare interface InfoBoxDataType {
694
713
 
695
714
  export declare type Languages = 'en' | 'ar' | 'az' | 'bn' | 'cy' | 'he' | 'hi' | 'jp' | 'ka' | 'km' | 'ko' | 'my' | 'ne' | 'zh' | 'custom';
696
715
 
716
+ export declare type LightConfig = AmbientLightConfig | DirectionalLightConfig | PointLightConfig | SpotLightConfig;
717
+
697
718
  export declare interface LineChartDataType {
698
719
  date: number | string;
699
720
  y: number;
@@ -778,6 +799,19 @@ export declare interface PerformanceIntensiveDashboardLayoutDataType extends Das
778
799
  }[];
779
800
  }
780
801
 
802
+ declare interface PointLightConfig extends BaseLightConfig {
803
+ type: 'point';
804
+ distance?: number;
805
+ decay?: number;
806
+ position?: Position | 'camera';
807
+ }
808
+
809
+ declare interface Position {
810
+ x: number;
811
+ y: number;
812
+ z: number;
813
+ }
814
+
781
815
  export declare interface RadarChartDataType {
782
816
  values: number[];
783
817
  label?: string | number;
@@ -834,6 +868,17 @@ export declare interface SectionsDataType {
834
868
  infoBox: InfoBoxDataType;
835
869
  }
836
870
 
871
+ declare interface ShadowConfig {
872
+ mapSize: {
873
+ width: number;
874
+ height: number;
875
+ };
876
+ camera: {
877
+ near: number;
878
+ far: number;
879
+ };
880
+ }
881
+
837
882
  export declare interface SlopeChartDataType {
838
883
  y1: number;
839
884
  y2: number;
@@ -847,6 +892,18 @@ export declare interface SourcesDataType {
847
892
  link?: string;
848
893
  }
849
894
 
895
+ declare interface SpotLightConfig extends BaseLightConfig {
896
+ type: 'spot';
897
+ target?: Position;
898
+ distance?: number;
899
+ angle?: number;
900
+ penumbra?: number;
901
+ decay?: number;
902
+ castShadow?: boolean;
903
+ shadow?: ShadowConfig;
904
+ position?: Position | 'camera';
905
+ }
906
+
850
907
  export declare type StatCardsFromDataSheetDataType = {
851
908
  value: number | string;
852
909
  data?: object;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),F=require("react"),O=require("./index-C21TvELx.cjs"),M=require("./Typography-k-kOjICQ.cjs"),U=require("./GraphFooter.cjs"),J=require("./GraphHeader.cjs"),K=require("./Colors.cjs"),Q=require("./numberFormattingFunction-02t-wJta.cjs"),X=require("./use-in-view-sQJZ_xDO.cjs"),Y=require("./index-BW8iNx7E.cjs"),Z=require("./proxy-BHRoeZgd.cjs");function _(z){const{data:n,size:g=200,graphTitle:x,sources:R,colors:E=K.Colors.light.categoricalColors.colors,graphDescription:d,totalNoOfDots:f=100,unitPadding:G=3,gridSize:c=10,footNote:b,padding:N,backgroundColor:l=!1,graphID:H,graphDownload:k=!1,language:j="en",showColorScale:I=!0,showStrokeForWhiteDots:m=!0,note:C,dataDownload:S=!1,theme:P="light",width:r,height:h,minHeight:s=0,relativeHeight:a,ariaLabel:T,styles:u,classNames:w,animate:$=!1,precision:L=2}=z,q=F.useRef(null),y=$===!0?{duration:.5,once:!0,amount:.5}:$||{duration:0,once:!0,amount:0},W=X.useInView(q,{once:y.once,amount:y.amount}),B=O.sum(n.map(e=>e.value)),D=F.useRef(null),o=g/c,p=(o-G*2)/2;if(p<=0)return console.error("The size of single unit is less than or equal to zero. Check values for ((dimension / gridSize) - (padding * 2)) / 2 is not less than or equal to 0."),null;const v=[];return n.forEach((e,i)=>{const A=Math.round(e.value/B*f);for(let V=0;V<A;V+=1)v.push({color:E[i]})}),t.jsxRuntimeExports.jsx("div",{className:`${P||"light"} flex ${r?"w-fit grow-0":"w-full grow"}`,dir:j==="he"||j==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${l?l===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${j||"en"}`,r?"w-fit":"w-full",w?.graphContainer),style:{...u?.graphContainer||{},minHeight:"inherit",...l&&l!==!0?{backgroundColor:l}:{}},id:H,ref:D,"aria-label":T||`${x?`The graph shows ${x}. `:""}${d?` ${d}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:l?N||"1rem":N||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-3 w-full grow",children:[x||d||k?t.jsxRuntimeExports.jsx(J.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:w?.title,description:w?.description},graphTitle:x,graphDescription:d,width:r,graphDownload:k?D.current:void 0,dataDownload:S?n.map(e=>e.data).filter(e=>e!==void 0).length>0?n.map(e=>e.data).filter(e=>e!==void 0):n.filter(e=>e!==void 0):null}):null,C?t.jsxRuntimeExports.jsx(M.f,{marginBottom:"2xs",className:"text-primary-gray-700 dark:text-primary-gray-100 font-bold",style:{width:r?`${r}px`:"100%"},children:C}):null,t.jsxRuntimeExports.jsxs("div",{className:"flex grow flex-col gap-4 justify-between",children:[t.jsxRuntimeExports.jsxs("div",{children:[I?t.jsxRuntimeExports.jsx("div",{className:"mb-4 leading-0",style:{width:r?`${r}px`:"100%"},"aria-label":"Color legend",children:t.jsxRuntimeExports.jsx("div",{className:"flex mb-0 flex-wrap gap-x-4 gap-y-1",children:n.map((e,i)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsxRuntimeExports.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:E[i]}}),t.jsxRuntimeExports.jsxs(M.u,{marginBottom:"none",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:[e.label,":"," ",t.jsxRuntimeExports.jsx("span",{className:"font-bold",children:Q.numberFormattingFunction(e.value,"NA",L)})]})]},i))})}):null,t.jsxRuntimeExports.jsx("div",{"aria-label":"Graph area",children:t.jsxRuntimeExports.jsx("svg",{width:`${r||g}px`,height:`${Math.max(s,h?a&&r?s?r*a>s?r*a:s:r*a:h:Math.floor((f-1)/c)*o+o/2+p+5)}px`,ref:q,direction:"ltr",viewBox:`0 0 ${r||g} ${Math.max(s,h?a&&r?s?r*a>s?r*a:s:r*a:h:Math.floor((f-1)/c)*o+o/2+p+5)}`,children:t.jsxRuntimeExports.jsx(Y.AnimatePresence,{children:t.jsxRuntimeExports.jsx("g",{children:v.map((e,i)=>t.jsxRuntimeExports.jsx(Z.motion.circle,{cx:i%c*o+o/2,cy:Math.floor(i/c)*o+o/2,style:{...m?{}:{stroke:e.color},strokeWidth:1},variants:{initial:{fill:"#fff",opacity:0,...m?{}:{stroke:e.color},strokeWidth:1},whileInView:{fill:e.color,opacity:1,...m?{}:{stroke:e.color},strokeWidth:1,transition:{duration:0,delay:y.duration/v.length*i}}},initial:"initial",animate:W?"whileInView":"initial",className:(e.color.toLowerCase()==="#fff"||e.color.toLowerCase()==="#ffffff"||e.color.toLowerCase()==="white")&&m?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"",r:p},i))})})})})]}),R||b?t.jsxRuntimeExports.jsx(U.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},sources:R,footNote:b,width:r}):null]})]})})})})}exports.UnitChart=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),F=require("react"),O=require("./index-CSNtgibC.cjs"),M=require("./Typography-k-kOjICQ.cjs"),U=require("./GraphFooter.cjs"),J=require("./GraphHeader.cjs"),K=require("./Colors.cjs"),Q=require("./numberFormattingFunction-02t-wJta.cjs"),X=require("./use-in-view-sQJZ_xDO.cjs"),Y=require("./index-BW8iNx7E.cjs"),Z=require("./proxy-BHRoeZgd.cjs");function _(z){const{data:n,size:g=200,graphTitle:x,sources:R,colors:E=K.Colors.light.categoricalColors.colors,graphDescription:d,totalNoOfDots:f=100,unitPadding:G=3,gridSize:c=10,footNote:b,padding:N,backgroundColor:l=!1,graphID:H,graphDownload:k=!1,language:j="en",showColorScale:I=!0,showStrokeForWhiteDots:m=!0,note:C,dataDownload:S=!1,theme:P="light",width:r,height:h,minHeight:s=0,relativeHeight:a,ariaLabel:T,styles:u,classNames:w,animate:$=!1,precision:L=2}=z,q=F.useRef(null),y=$===!0?{duration:.5,once:!0,amount:.5}:$||{duration:0,once:!0,amount:0},W=X.useInView(q,{once:y.once,amount:y.amount}),B=O.sum(n.map(e=>e.value)),D=F.useRef(null),o=g/c,p=(o-G*2)/2;if(p<=0)return console.error("The size of single unit is less than or equal to zero. Check values for ((dimension / gridSize) - (padding * 2)) / 2 is not less than or equal to 0."),null;const v=[];return n.forEach((e,i)=>{const A=Math.round(e.value/B*f);for(let V=0;V<A;V+=1)v.push({color:E[i]})}),t.jsxRuntimeExports.jsx("div",{className:`${P||"light"} flex ${r?"w-fit grow-0":"w-full grow"}`,dir:j==="he"||j==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${l?l===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${j||"en"}`,r?"w-fit":"w-full",w?.graphContainer),style:{...u?.graphContainer||{},minHeight:"inherit",...l&&l!==!0?{backgroundColor:l}:{}},id:H,ref:D,"aria-label":T||`${x?`The graph shows ${x}. `:""}${d?` ${d}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:l?N||"1rem":N||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-3 w-full grow",children:[x||d||k?t.jsxRuntimeExports.jsx(J.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:w?.title,description:w?.description},graphTitle:x,graphDescription:d,width:r,graphDownload:k?D.current:void 0,dataDownload:S?n.map(e=>e.data).filter(e=>e!==void 0).length>0?n.map(e=>e.data).filter(e=>e!==void 0):n.filter(e=>e!==void 0):null}):null,C?t.jsxRuntimeExports.jsx(M.f,{marginBottom:"2xs",className:"text-primary-gray-700 dark:text-primary-gray-100 font-bold",style:{width:r?`${r}px`:"100%"},children:C}):null,t.jsxRuntimeExports.jsxs("div",{className:"flex grow flex-col gap-4 justify-between",children:[t.jsxRuntimeExports.jsxs("div",{children:[I?t.jsxRuntimeExports.jsx("div",{className:"mb-4 leading-0",style:{width:r?`${r}px`:"100%"},"aria-label":"Color legend",children:t.jsxRuntimeExports.jsx("div",{className:"flex mb-0 flex-wrap gap-x-4 gap-y-1",children:n.map((e,i)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsxRuntimeExports.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:E[i]}}),t.jsxRuntimeExports.jsxs(M.u,{marginBottom:"none",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:[e.label,":"," ",t.jsxRuntimeExports.jsx("span",{className:"font-bold",children:Q.numberFormattingFunction(e.value,"NA",L)})]})]},i))})}):null,t.jsxRuntimeExports.jsx("div",{"aria-label":"Graph area",children:t.jsxRuntimeExports.jsx("svg",{width:`${r||g}px`,height:`${Math.max(s,h?a&&r?s?r*a>s?r*a:s:r*a:h:Math.floor((f-1)/c)*o+o/2+p+5)}px`,ref:q,direction:"ltr",viewBox:`0 0 ${r||g} ${Math.max(s,h?a&&r?s?r*a>s?r*a:s:r*a:h:Math.floor((f-1)/c)*o+o/2+p+5)}`,children:t.jsxRuntimeExports.jsx(Y.AnimatePresence,{children:t.jsxRuntimeExports.jsx("g",{children:v.map((e,i)=>t.jsxRuntimeExports.jsx(Z.motion.circle,{cx:i%c*o+o/2,cy:Math.floor(i/c)*o+o/2,style:{...m?{}:{stroke:e.color},strokeWidth:1},variants:{initial:{fill:"#fff",opacity:0,...m?{}:{stroke:e.color},strokeWidth:1},whileInView:{fill:e.color,opacity:1,...m?{}:{stroke:e.color},strokeWidth:1,transition:{duration:0,delay:y.duration/v.length*i}}},initial:"initial",animate:W?"whileInView":"initial",className:(e.color.toLowerCase()==="#fff"||e.color.toLowerCase()==="#ffffff"||e.color.toLowerCase()==="white")&&m?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"",r:p},i))})})})})]}),R||b?t.jsxRuntimeExports.jsx(U.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},sources:R,footNote:b,width:r}):null]})]})})})})}exports.UnitChart=_;
2
2
  //# sourceMappingURL=UnitChart.cjs.map
package/dist/UnitChart.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { j as r, m as E } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useRef as F } from "react";
3
- import { s as O } from "./index-D7ltPi18.js";
3
+ import { s as O } from "./index-CeVNqhMO.js";
4
4
  import { f as U, u as J } from "./Typography-Ctgfl1J5.js";
5
5
  import { GraphFooter as K } from "./GraphFooter.js";
6
6
  import { GraphHeader as Q } from "./GraphHeader.js";
@@ -0,0 +1,2 @@
1
+ "use strict";var u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function l(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var n=e.default;if(typeof n=="function"){var t=function o(){var r=!1;try{r=this instanceof o}catch{}return r?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:function(){return e[o]}})}),t}exports.commonjsGlobal=u;exports.getAugmentedNamespace=l;exports.getDefaultExportFromCjs=f;
2
+ //# sourceMappingURL=_commonjsHelpers-BH3jXuIh.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_commonjsHelpers-BH3jXuIh.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}