@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":"ChoroplethMap.js","sources":["../src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx","../src/Components/Graphs/Maps/ChoroplethMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold, scaleOrdinal } from 'd3-scale';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport bbox from '@turf/bbox';\r\nimport centroid from '@turf/centroid';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\n\r\ninterface Props {\r\n colorDomain: number[] | string[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n width: number;\r\n height: number;\r\n colors: string[];\r\n colorLegendTitle?: string;\r\n categorical: boolean;\r\n data: ChoroplethMapDataType[];\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n mapBorderColor: string;\r\n isWorldMap: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n showColorScale: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colorDomain,\r\n colors,\r\n mapData,\r\n colorLegendTitle,\r\n categorical,\r\n height,\r\n width,\r\n scale,\r\n centerPoint,\r\n tooltip,\r\n mapBorderWidth,\r\n mapBorderColor,\r\n mapNoDataColor,\r\n onSeriesMouseOver,\r\n showColorScale,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n } = props;\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n const [showLegend, setShowLegend] = useState(!(width < 680));\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\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\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centroid(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const color = !checkIfNullOrUndefined(d.x)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.x as any)\r\n : mapNoDataColor;\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={masterPath}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\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\r\n key={i}\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\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 className={\r\n selectedColor === colors[i]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }\r\n style={{\r\n fill: colors[i],\r\n ...(selectedColor === colors[i] ? {} : { 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 onMouseOver={() => {\r\n setSelectedColor(colors[colorDomain.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\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 className={`cursor-pointer ${\r\n selectedColor === colors[colorDomain.length]\r\n ? 'stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n ...(selectedColor === colors[colorDomain.length]\r\n ? {}\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\r\n key={i}\r\n className='flex gap-2 items-center'\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i % colors.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n >\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 {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\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 {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { ascending, sort } from 'd3-array';\r\nimport uniqBy from 'lodash.uniqby';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n ChoroplethMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ScaleDataType,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\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 /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggles if the color scaling is categorical or not */\r\n categorical?: boolean;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\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\nexport function ChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.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 scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\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 onSeriesMouseOver,\r\n isWorldMap = true,\r\n showColorScale = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = sort(\r\n uniqBy(\r\n data.filter(d => d.date !== undefined && d.date !== null),\r\n d => d.date,\r\n ).map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\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 setMapShape(d);\r\n });\r\n } else {\r\n setMapShape(mapData);\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\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\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 ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a choropleth map where geographic areas are colored in proportion to a specific variable.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\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 || graphDownload || 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={graphDownload ? graphParentDiv.current : 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 {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\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.filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\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 scale={scale}\r\n centerPoint={centerPoint}\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 colorLegendTitle={colorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n showColorScale={showColorScale}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n classNames={classNames}\r\n detailsOnClick={detailsOnClick}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n zoomInteraction={zoomInteraction}\r\n dimmedOpacity={dimmedOpacity}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n customLayers={customLayers}\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","data","colorDomain","colors","mapData","colorLegendTitle","categorical","height","width","scale","centerPoint","tooltip","mapBorderWidth","mapBorderColor","mapNoDataColor","onSeriesMouseOver","showColorScale","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","selectedColor","setSelectedColor","useState","zoomRef","useRef","showLegend","setShowLegend","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","isInView","useInView","mapG","colorScale","scaleOrdinal","scaleThreshold","useEffect","mapGSelect","select","mapSvgSelect","zoomFilter","e","isWheel","isTouch","isDrag","zoomBehavior","zoom","transform","bounds","bbox","center","centroid","lonDiff","latDiff","scaleX","scaleY","scaleVar","projection","geoMercator","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","handleZoom","direction","jsxs","Fragment","jsx","motion","d","i","el","j","masterPath","geo","path","c","k","point","AnimatePresence","index","color","checkIfNullOrUndefined","event","isEqual","X","P","numberFormattingFunction","Modal","string2HTML","Tooltip","ChoroplethMap","graphTitle","sources","graphDescription","footNote","scaleType","padding","Colors","backgroundColor","relativeHeight","isWorldMap","graphID","graphDownload","dataDownload","showAntarctica","language","minHeight","theme","ariaLabel","timeline","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","a","b","ascending","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","resizeObserver","entries","fetchAndParseJSON","domain","getUniqValue","getJenks","interval","markObj","getSliderMarks","cn","GraphHeader","Pause","Play","SliderUI","nextValue","format","Spinner","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,aAAAC;AAAA,IACA,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,QAAAC;AAAA,IACA,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,SAAAC;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U,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAqF;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAAxG;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":"ChoroplethMap.js","sources":["../src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx","../src/Components/Graphs/Maps/ChoroplethMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold, scaleOrdinal } from 'd3-scale';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\n\r\ninterface Props {\r\n colorDomain: number[] | string[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n width: number;\r\n height: number;\r\n colors: string[];\r\n colorLegendTitle?: string;\r\n categorical: boolean;\r\n data: ChoroplethMapDataType[];\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n mapBorderColor: string;\r\n isWorldMap: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n showColorScale: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colorDomain,\r\n colors,\r\n mapData,\r\n colorLegendTitle,\r\n categorical,\r\n height,\r\n width,\r\n scale,\r\n centerPoint,\r\n tooltip,\r\n mapBorderWidth,\r\n mapBorderColor,\r\n mapNoDataColor,\r\n onSeriesMouseOver,\r\n showColorScale,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n } = props;\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n const [showLegend, setShowLegend] = useState(!(width < 680));\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\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\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centerOfMass(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const color = !checkIfNullOrUndefined(d.x)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.x as any)\r\n : mapNoDataColor;\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={masterPath}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\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\r\n key={i}\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\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 className={\r\n selectedColor === colors[i]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }\r\n style={{\r\n fill: colors[i],\r\n ...(selectedColor === colors[i] ? {} : { 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 onMouseOver={() => {\r\n setSelectedColor(colors[colorDomain.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\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 className={`cursor-pointer ${\r\n selectedColor === colors[colorDomain.length]\r\n ? 'stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n ...(selectedColor === colors[colorDomain.length]\r\n ? {}\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\r\n key={i}\r\n className='flex gap-2 items-center'\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i % colors.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n >\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 {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\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 {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { ascending, sort } from 'd3-array';\r\nimport uniqBy from 'lodash.uniqby';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n ChoroplethMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ScaleDataType,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\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 /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggles if the color scaling is categorical or not */\r\n categorical?: boolean;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\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\nexport function ChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.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 scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\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 onSeriesMouseOver,\r\n isWorldMap = true,\r\n showColorScale = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = sort(\r\n uniqBy(\r\n data.filter(d => d.date !== undefined && d.date !== null),\r\n d => d.date,\r\n ).map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\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 setMapShape(d);\r\n });\r\n } else {\r\n setMapShape(mapData);\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\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\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 ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a choropleth map where geographic areas are colored in proportion to a specific variable.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\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 || graphDownload || 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={graphDownload ? graphParentDiv.current : 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 {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\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.filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\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 scale={scale}\r\n centerPoint={centerPoint}\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 colorLegendTitle={colorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n showColorScale={showColorScale}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n classNames={classNames}\r\n detailsOnClick={detailsOnClick}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n zoomInteraction={zoomInteraction}\r\n dimmedOpacity={dimmedOpacity}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n customLayers={customLayers}\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","data","colorDomain","colors","mapData","colorLegendTitle","categorical","height","width","scale","centerPoint","tooltip","mapBorderWidth","mapBorderColor","mapNoDataColor","onSeriesMouseOver","showColorScale","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","selectedColor","setSelectedColor","useState","zoomRef","useRef","showLegend","setShowLegend","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","isInView","useInView","mapG","colorScale","scaleOrdinal","scaleThreshold","useEffect","mapGSelect","select","mapSvgSelect","zoomFilter","e","isWheel","isTouch","isDrag","zoomBehavior","zoom","transform","bounds","bbox","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","projection","geoMercator","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","handleZoom","direction","jsxs","Fragment","jsx","motion","d","i","el","j","masterPath","geo","path","c","k","point","AnimatePresence","index","color","checkIfNullOrUndefined","event","isEqual","X","P","numberFormattingFunction","Modal","string2HTML","Tooltip","ChoroplethMap","graphTitle","sources","graphDescription","footNote","scaleType","padding","Colors","backgroundColor","relativeHeight","isWorldMap","graphID","graphDownload","dataDownload","showAntarctica","language","minHeight","theme","ariaLabel","timeline","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","a","b","ascending","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","resizeObserver","entries","fetchAndParseJSON","domain","getUniqValue","getJenks","interval","markObj","getSliderMarks","cn","GraphHeader","Pause","Play","SliderUI","nextValue","format","Spinner","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAAA,sBAAA;AAAA,oBAAA,IAGFsD,gBAAAA,EAAAA;AAAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,OAAO;AAAA,0BACL,QAAQ,GAAG,KAAK;AAAA,4BACdwC;AAAA,4BACArH,MACG8G,IACGO,KACGpH,KAASwH,KAAYX,IAAiBO,KACpCpH,KAASwH,KAAYX,IACtBO,KACDpH,KAASwH,KAAYX,IACxBa;AAAA,0BAAA,CACP;AAAA,wBAAA;AAAA,wBAEH,WAAU;AAAA,wBAEV,UAAA9C,gBAAAA,EAAAA,IAAC8E,IAAA,EAAQ,cAAW,gBAAA,CAAgB;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACtC;AAAA,gBAAA;AAAA,gBAGHpD,KAAWE,KACV5B,gBAAAA,EAAAA;AAAAA,kBAAC+E;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAU3I,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAqF;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAAxG;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CHPV5EwG-DDoeWRVt.cjs");require("./index-CZbIGs8q.cjs");require("react");require("./index-C21TvELx.cjs");const e=require("./index-BbNoLJ_w.cjs");require("./GraphFooter.cjs");require("./GraphHeader.cjs");require("./ColorLegendWithMouseOver.cjs");require("./Colors.cjs");require("./checkIfNullOrUndefined-BCW3Y1ML.cjs");require("./EmptyState-d8_8SxeW.cjs");exports.CirclePackingGraph=e.CirclePackingGraph;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CHPV5EwG-DDoeWRVt.cjs");require("./index-BJOeaYTk.cjs");require("react");require("./index-CSNtgibC.cjs");const e=require("./index-Da2GUKrr.cjs");require("./GraphFooter.cjs");require("./GraphHeader.cjs");require("./ColorLegendWithMouseOver.cjs");require("./Colors.cjs");require("./checkIfNullOrUndefined-BCW3Y1ML.cjs");require("./EmptyState-d8_8SxeW.cjs");exports.CirclePackingGraph=e.CirclePackingGraph;
2
2
  //# sourceMappingURL=CirclePackingGraph.cjs.map
@@ -1,8 +1,8 @@
1
1
  import "./index-CHPV5EwG-BPSP-7Jg.js";
2
- import "./index-CaAIPGZo.js";
2
+ import "./index-AqnpA7_O.js";
3
3
  import "react";
4
- import "./index-D7ltPi18.js";
5
- import { C as h } from "./index-Bc5VF70V.js";
4
+ import "./index-CeVNqhMO.js";
5
+ import { C as h } from "./index-BMgDMxKJ.js";
6
6
  import "./GraphFooter.js";
7
7
  import "./GraphHeader.js";
8
8
  import "./ColorLegendWithMouseOver.js";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),n=require("react"),ue=require("./index-Ds0uHjK9.cjs"),B=require("./index-B0rbzOoC.cjs"),de=require("./index-BzeLQvXk.cjs"),E=require("./DropdownSelect-DBDM64B5.cjs"),A=require("./Typography-k-kOjICQ.cjs"),V=require("./x-BBpi7a_7-Dz2vKSfu.cjs"),Z=require("./index-BW_-wD2k.cjs"),pe=require("./Modal-tXZlLE5s.cjs"),me=require("./CsvDownloadButton.cjs"),U=require("./string2HTML-D2Avudmb.cjs"),xe=require("./GraphFooter.cjs"),ge=require("./GraphHeader.cjs"),ye=require("./getUniqValue-CHqgSss5.cjs"),K=require("./transformDataForSelect-YmStusCI.cjs");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),n=require("react"),ue=require("./index-D72cOtq7.cjs"),B=require("./index-BS2TADPj.cjs"),de=require("./index-DYH8g9WA.cjs"),E=require("./DropdownSelect-DBDM64B5.cjs"),A=require("./Typography-k-kOjICQ.cjs"),V=require("./x-BBpi7a_7-Dz2vKSfu.cjs"),Z=require("./index-BW_-wD2k.cjs"),pe=require("./Modal-tXZlLE5s.cjs"),me=require("./CsvDownloadButton.cjs"),U=require("./string2HTML-z7CwHXcx.cjs"),xe=require("./GraphFooter.cjs"),ge=require("./GraphHeader.cjs"),ye=require("./getUniqValue-CfuE_l9c.cjs"),K=require("./transformDataForSelect-YmStusCI.cjs");/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
package/dist/DataCards.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import { a as l, m, b as ye, j as i } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import $, { useState as w, useEffect as I, useMemo as Q } from "react";
3
- import { i as ge } from "./index-C1rRk_50.js";
4
- import { f as L } from "./index-UV9hjG_S.js";
5
- import { s as he } from "./index-DxagiOHo.js";
3
+ import { i as ge } from "./index-V_JXij1_.js";
4
+ import { f as L } from "./index-EArKRVKg.js";
5
+ import { s as he } from "./index-fwdktvAS.js";
6
6
  import { Z as W, H as Z } from "./DropdownSelect-CtOKZHD0.js";
7
7
  import { u as X } from "./Typography-Ctgfl1J5.js";
8
8
  import { k as P } from "./x-BBpi7a_7-WVdj1j6r.js";
9
9
  import { d as xe, e as be } from "./index-BmCqpO1B.js";
10
10
  import { X as ve } from "./Modal-DVVwpKhP.js";
11
11
  import { CsvDownloadButton as je } from "./CsvDownloadButton.js";
12
- import { s as J } from "./string2HTML-CWHGfz_d.js";
12
+ import { s as J } from "./string2HTML-oFCROsus.js";
13
13
  import { GraphFooter as Ne } from "./GraphFooter.js";
14
14
  import { GraphHeader as we } from "./GraphHeader.js";
15
- import { g as ke } from "./getUniqValue-BtUENB2H.js";
15
+ import { g as ke } from "./getUniqValue-CttuU_wn.js";
16
16
  import { t as Y } from "./transformDataForSelect-D8AuvYdf.js";
17
17
  /**
18
18
  * @license lucide-react v0.542.0 - ISC
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-DDoeWRVt.cjs"),H=require("./index-BXns0-ng.cjs"),l=require("react"),M=require("./index-BzeLQvXk.cjs"),Z=require("./index-Ds0uHjK9.cjs"),y=require("./Typography-k-kOjICQ.cjs"),R=require("./numberFormattingFunction-02t-wJta.cjs"),_=require("./GraphFooter.cjs"),tt=require("./GraphHeader.cjs"),j=require("./index-BW_-wD2k.cjs"),S=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),V=v=>v.map(c=>c||1).reduce((c,b)=>c+b,0);function rt(v){const{width:p,height:N,graphTitle:c,sources:b,graphDescription:C,footNote:B,graphID:X,data:d,columnData:n,onSeriesMouseClick:I,language:k="en",theme:L="light",ariaLabel:Y,backgroundColor:u=!1,padding:F,resetSelectionOnDoubleClick:J=!0,styles:x,classNames:g,minWidth:D,naLabel:w="NA",precision:E=2}=v,[m,T]=l.useState(void 0),[q,z]=l.useState(void 0),[h,W]=l.useState("asc"),[f,G]=l.useState(void 0),[K,Q]=l.useState({}),[a,P]=l.useState(n.filter(r=>r.filterOptions&&r.filterOptions.length>0).map(r=>({id:r.columnId,option:r.filterOptions}))),[U,A]=l.useState(d);return l.useEffect(()=>{const r=[];d.forEach(s=>{let t=!0;a.forEach(e=>{if(typeof s[e.id]!="object"&&typeof s[e.id]!="function"&&typeof s[e.id]!="symbol")if(n[n.findIndex(i=>i.columnId===e.id)].separator){const i=s[e.id].split(n[n.findIndex($=>$.columnId===e.id)].separator);Z.intersection(i,e.option).length===0&&(t=!1)}else e.option.indexOf(s[e.id])===-1&&(t=!1)}),t&&r.push(s)}),A(m&&d?h==="asc"?M.sortBy(r,[m]):M.sortBy(r,[m]).reverse():r)},[m,h,d,a,n]),o.jsxRuntimeExports.jsx("div",{className:`${L||"light"} flex ${p?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:o.jsxRuntimeExports.jsx("div",{className:o.mo(`${u?u===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"} w-full`,p?"w-fit":"w-full",g?.graphContainer),style:{...x?.graphContainer||{},...u&&u!==!0?{backgroundColor:u}:{}},id:X,"aria-label":Y||`${c?`The graph shows ${c}. `:""}This is an data table. ${C?` ${C}`:""}`,children:o.jsxRuntimeExports.jsxs("div",{className:"flex grow",style:{padding:u?F||"1rem":F||0},children:[o.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-3 w-full justify-between grow",children:[c||C?o.jsxRuntimeExports.jsx(tt.GraphHeader,{styles:{title:x?.title,description:x?.description},classNames:{title:g?.title,description:g?.description},graphTitle:c,graphDescription:C,width:p}):null,o.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center",children:o.jsxRuntimeExports.jsx("div",{className:"undp-scrollbar",style:{width:p?`${p}px`:"100%",height:N?`${N}px`:"auto"},children:o.jsxRuntimeExports.jsx("div",{style:D?{minWidth:D}:void 0,children:d?o.jsxRuntimeExports.jsxs("table",{className:"w-full",style:{borderCollapse:"collapse"},children:[o.jsxRuntimeExports.jsx("thead",{className:"text-left bg-primary-gray-300 dark:bg-primary-gray-550",children:o.jsxRuntimeExports.jsx("tr",{children:n?.map((r,s)=>o.jsxRuntimeExports.jsx("th",{className:"text-primary-gray-700 dark:text-primary-gray-100 text-sm",style:{width:`calc(${100*(r.columnWidth||1)/V(n.map(t=>t.columnWidth||1))}%`},children:o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 justify-between items-center p-4",children:[o.jsxRuntimeExports.jsx(y.u,{size:"sm",marginBottom:"none",className:`w-fit grow text-${r.align||"left"} font-bold`,children:r.columnTitle||r.columnId}),r.sortable?o.jsxRuntimeExports.jsx("button",{type:"button",className:"bg-transparent cursor-pointer p-0 m-0 border-0",onClick:()=>{m===r.columnId?(h==="asc"&&W("desc"),h==="desc"&&T(void 0)):(T(r.columnId),W("asc"))},children:m===r.columnId?h==="asc"?o.jsxRuntimeExports.jsx(j.SortingIconAscending,{}):o.jsxRuntimeExports.jsx(j.SortingIconDescending,{}):o.jsxRuntimeExports.jsx(j.SortingIcon,{})}):null,r.filterOptions&&r.filterOptions.length?o.jsxRuntimeExports.jsx("button",{type:"button",className:"bg-transparent cursor-pointer m-0 p-0 border-0",onClick:t=>{if(f===r.columnId)G(void 0);else if(t.currentTarget){G(r.columnId);const e=t.currentTarget.getBoundingClientRect();Q({top:e.bottom+window.scrollY,left:e.left+window.scrollX-160<0?e.left+window.scrollX:e.left+window.scrollX-160,width:"10rem"})}},children:a[a.findIndex(t=>t.id===r.columnId)].option.length===r.filterOptions?.length?o.jsxRuntimeExports.jsx(j.FilterIcon,{}):o.jsxRuntimeExports.jsx(j.FilterIconApplied,{})}):null]})},s))})}),o.jsxRuntimeExports.jsx("tbody",{children:U?.map((r,s)=>o.jsxRuntimeExports.jsx("tr",{className:`cursor-${I?"pointer":"auto"} border-b border-b-primary-gray-400 dark:border-b-primary-gray-500 ${H.isEqual(q,r)?"bg-primary-gray-200 dark:bg-primary-gray-600":"bg-transparent"}`,style:r.rowStyle,onClick:()=>{I&&(H.isEqual(q,r)&&J?(z(void 0),I(void 0)):(z(r),I(r)))},children:n.map((t,e)=>o.jsxRuntimeExports.jsx("td",{className:`text-primary-gray-700 dark:text-primary-gray-100 text-sm text-${t.align||"left"}`,style:{width:`calc(${100*(r.columnWidth||1)/V(n.map(i=>i.columnWidth||1))}%`},children:o.jsxRuntimeExports.jsx("div",{className:`text-primary-gray-700 dark:text-primary-gray-100 flex p-4 ${t.align==="right"?"justify-end":t.align==="center"?"justify-center":"justify-start"}`,children:typeof r[t.columnId]=="number"?o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color)}:{}},children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)}):typeof r[t.columnId]=="string"?t.separator?o.jsxRuntimeExports.jsx("div",{className:"text-primary-gray-700 dark:text-primary-gray-100 flex flex-wrap gap-2",children:r[t.columnId].split(t.separator).map((i,$)=>o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(O=>O.value===(t.chipColumnId?r[t.chipColumnId]:i))].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(O=>O.value===(t.chipColumnId?r[t.chipColumnId]:i))].color)}:{}},children:R.numberFormattingFunction(i,w,E,t.prefix,t.suffix)},$))}):o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color)}:{}},children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)}):o.jsxRuntimeExports.jsx("div",{children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)})})},e))},s))})]}):null})})}),b||B?o.jsxRuntimeExports.jsx(_.GraphFooter,{styles:{footnote:x?.footnote,source:x?.source},classNames:{footnote:g?.footnote,source:g?.source},sources:b,footNote:B,width:p}):null]}),f&&o.jsxRuntimeExports.jsx("div",{style:K,className:"absolute p-3 border z-[1000] rounded-sm bg-primary-white dark:bg-primary-gray-700 border-primary-gray-300 dark:border-primary-gray-550",children:o.jsxRuntimeExports.jsxs("div",{className:"max-w-60",children:[o.jsxRuntimeExports.jsx(y.u,{size:"sm",marginBottom:"2xs",className:"font-bold",children:"Filter data by"}),o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2",children:n[n.findIndex(r=>r.columnId===f)].filterOptions?.map((r,s)=>o.jsxRuntimeExports.jsx("div",{children:o.jsxRuntimeExports.jsxs("label",{className:"undp-viz-label",children:[o.jsxRuntimeExports.jsx("input",{type:"checkbox",className:"undp-viz-checkbox",checked:a[a.findIndex(t=>t.id===f)].option.indexOf(r)!==-1,onChange:()=>{const t=a.findIndex(i=>i.id===f),e=[...a[t].option];if(e.indexOf(r)!==-1){e.splice(e.indexOf(r),1);const i=[...a];i[t].option=e,P(i)}else{e.push(r);const i=[...a];i[t].option=e,P(i)}}}),r]},s)},s))})]})})]})})})}exports.DataTable=rt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-DDoeWRVt.cjs"),H=require("./index-DQA8q5sC.cjs"),l=require("react"),M=require("./index-DYH8g9WA.cjs"),Z=require("./index-D72cOtq7.cjs"),y=require("./Typography-k-kOjICQ.cjs"),R=require("./numberFormattingFunction-02t-wJta.cjs"),_=require("./GraphFooter.cjs"),tt=require("./GraphHeader.cjs"),j=require("./index-BW_-wD2k.cjs"),S=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),V=v=>v.map(c=>c||1).reduce((c,b)=>c+b,0);function rt(v){const{width:p,height:N,graphTitle:c,sources:b,graphDescription:C,footNote:B,graphID:X,data:d,columnData:n,onSeriesMouseClick:I,language:k="en",theme:L="light",ariaLabel:Y,backgroundColor:u=!1,padding:F,resetSelectionOnDoubleClick:J=!0,styles:x,classNames:g,minWidth:D,naLabel:w="NA",precision:E=2}=v,[m,T]=l.useState(void 0),[q,z]=l.useState(void 0),[h,W]=l.useState("asc"),[f,G]=l.useState(void 0),[K,Q]=l.useState({}),[a,P]=l.useState(n.filter(r=>r.filterOptions&&r.filterOptions.length>0).map(r=>({id:r.columnId,option:r.filterOptions}))),[U,A]=l.useState(d);return l.useEffect(()=>{const r=[];d.forEach(s=>{let t=!0;a.forEach(e=>{if(typeof s[e.id]!="object"&&typeof s[e.id]!="function"&&typeof s[e.id]!="symbol")if(n[n.findIndex(i=>i.columnId===e.id)].separator){const i=s[e.id].split(n[n.findIndex($=>$.columnId===e.id)].separator);Z.intersection(i,e.option).length===0&&(t=!1)}else e.option.indexOf(s[e.id])===-1&&(t=!1)}),t&&r.push(s)}),A(m&&d?h==="asc"?M.sortBy(r,[m]):M.sortBy(r,[m]).reverse():r)},[m,h,d,a,n]),o.jsxRuntimeExports.jsx("div",{className:`${L||"light"} flex ${p?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:o.jsxRuntimeExports.jsx("div",{className:o.mo(`${u?u===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"} w-full`,p?"w-fit":"w-full",g?.graphContainer),style:{...x?.graphContainer||{},...u&&u!==!0?{backgroundColor:u}:{}},id:X,"aria-label":Y||`${c?`The graph shows ${c}. `:""}This is an data table. ${C?` ${C}`:""}`,children:o.jsxRuntimeExports.jsxs("div",{className:"flex grow",style:{padding:u?F||"1rem":F||0},children:[o.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-3 w-full justify-between grow",children:[c||C?o.jsxRuntimeExports.jsx(tt.GraphHeader,{styles:{title:x?.title,description:x?.description},classNames:{title:g?.title,description:g?.description},graphTitle:c,graphDescription:C,width:p}):null,o.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center",children:o.jsxRuntimeExports.jsx("div",{className:"undp-scrollbar",style:{width:p?`${p}px`:"100%",height:N?`${N}px`:"auto"},children:o.jsxRuntimeExports.jsx("div",{style:D?{minWidth:D}:void 0,children:d?o.jsxRuntimeExports.jsxs("table",{className:"w-full",style:{borderCollapse:"collapse"},children:[o.jsxRuntimeExports.jsx("thead",{className:"text-left bg-primary-gray-300 dark:bg-primary-gray-550",children:o.jsxRuntimeExports.jsx("tr",{children:n?.map((r,s)=>o.jsxRuntimeExports.jsx("th",{className:"text-primary-gray-700 dark:text-primary-gray-100 text-sm",style:{width:`calc(${100*(r.columnWidth||1)/V(n.map(t=>t.columnWidth||1))}%`},children:o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 justify-between items-center p-4",children:[o.jsxRuntimeExports.jsx(y.u,{size:"sm",marginBottom:"none",className:`w-fit grow text-${r.align||"left"} font-bold`,children:r.columnTitle||r.columnId}),r.sortable?o.jsxRuntimeExports.jsx("button",{type:"button",className:"bg-transparent cursor-pointer p-0 m-0 border-0",onClick:()=>{m===r.columnId?(h==="asc"&&W("desc"),h==="desc"&&T(void 0)):(T(r.columnId),W("asc"))},children:m===r.columnId?h==="asc"?o.jsxRuntimeExports.jsx(j.SortingIconAscending,{}):o.jsxRuntimeExports.jsx(j.SortingIconDescending,{}):o.jsxRuntimeExports.jsx(j.SortingIcon,{})}):null,r.filterOptions&&r.filterOptions.length?o.jsxRuntimeExports.jsx("button",{type:"button",className:"bg-transparent cursor-pointer m-0 p-0 border-0",onClick:t=>{if(f===r.columnId)G(void 0);else if(t.currentTarget){G(r.columnId);const e=t.currentTarget.getBoundingClientRect();Q({top:e.bottom+window.scrollY,left:e.left+window.scrollX-160<0?e.left+window.scrollX:e.left+window.scrollX-160,width:"10rem"})}},children:a[a.findIndex(t=>t.id===r.columnId)].option.length===r.filterOptions?.length?o.jsxRuntimeExports.jsx(j.FilterIcon,{}):o.jsxRuntimeExports.jsx(j.FilterIconApplied,{})}):null]})},s))})}),o.jsxRuntimeExports.jsx("tbody",{children:U?.map((r,s)=>o.jsxRuntimeExports.jsx("tr",{className:`cursor-${I?"pointer":"auto"} border-b border-b-primary-gray-400 dark:border-b-primary-gray-500 ${H.isEqual(q,r)?"bg-primary-gray-200 dark:bg-primary-gray-600":"bg-transparent"}`,style:r.rowStyle,onClick:()=>{I&&(H.isEqual(q,r)&&J?(z(void 0),I(void 0)):(z(r),I(r)))},children:n.map((t,e)=>o.jsxRuntimeExports.jsx("td",{className:`text-primary-gray-700 dark:text-primary-gray-100 text-sm text-${t.align||"left"}`,style:{width:`calc(${100*(r.columnWidth||1)/V(n.map(i=>i.columnWidth||1))}%`},children:o.jsxRuntimeExports.jsx("div",{className:`text-primary-gray-700 dark:text-primary-gray-100 flex p-4 ${t.align==="right"?"justify-end":t.align==="center"?"justify-center":"justify-start"}`,children:typeof r[t.columnId]=="number"?o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color)}:{}},children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)}):typeof r[t.columnId]=="string"?t.separator?o.jsxRuntimeExports.jsx("div",{className:"text-primary-gray-700 dark:text-primary-gray-100 flex flex-wrap gap-2",children:r[t.columnId].split(t.separator).map((i,$)=>o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(O=>O.value===(t.chipColumnId?r[t.chipColumnId]:i))].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(O=>O.value===(t.chipColumnId?r[t.chipColumnId]:i))].color)}:{}},children:R.numberFormattingFunction(i,w,E,t.prefix,t.suffix)},$))}):o.jsxRuntimeExports.jsx(y.u,{marginBottom:"none",size:"sm",className:`text-primary-gray-700 dark:text-primary-gray-100 w-fit ${t.chip?"grow-0 rounded-sm p-2":"grow rounded-none p-0"} text-${t.align||"left"} ${t.chip?t.chipColors?"":"bg-primary-gray-300 dark:bg-primary-gray-500":"bg-transparent"}`,style:{...t.chip&&t.chipColors?{backgroundColor:t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color,color:S.getTextColorBasedOnBgColor(t.chipColors[t.chipColors.findIndex(i=>i.value===r[t.chipColumnId||t.columnId])].color)}:{}},children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)}):o.jsxRuntimeExports.jsx("div",{children:R.numberFormattingFunction(r[t.columnId],w,E,t.prefix,t.suffix)})})},e))},s))})]}):null})})}),b||B?o.jsxRuntimeExports.jsx(_.GraphFooter,{styles:{footnote:x?.footnote,source:x?.source},classNames:{footnote:g?.footnote,source:g?.source},sources:b,footNote:B,width:p}):null]}),f&&o.jsxRuntimeExports.jsx("div",{style:K,className:"absolute p-3 border z-[1000] rounded-sm bg-primary-white dark:bg-primary-gray-700 border-primary-gray-300 dark:border-primary-gray-550",children:o.jsxRuntimeExports.jsxs("div",{className:"max-w-60",children:[o.jsxRuntimeExports.jsx(y.u,{size:"sm",marginBottom:"2xs",className:"font-bold",children:"Filter data by"}),o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2",children:n[n.findIndex(r=>r.columnId===f)].filterOptions?.map((r,s)=>o.jsxRuntimeExports.jsx("div",{children:o.jsxRuntimeExports.jsxs("label",{className:"undp-viz-label",children:[o.jsxRuntimeExports.jsx("input",{type:"checkbox",className:"undp-viz-checkbox",checked:a[a.findIndex(t=>t.id===f)].option.indexOf(r)!==-1,onChange:()=>{const t=a.findIndex(i=>i.id===f),e=[...a[t].option];if(e.indexOf(r)!==-1){e.splice(e.indexOf(r),1);const i=[...a];i[t].option=e,P(i)}else{e.push(r);const i=[...a];i[t].option=e,P(i)}}}),r]},s)},s))})]})})]})})})}exports.DataTable=rt;
2
2
  //# sourceMappingURL=DataTable.cjs.map
package/dist/DataTable.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { j as i, m as U } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
- import { i as M } from "./index-27yTRcko.js";
2
+ import { i as M } from "./index-Bwrro8-q.js";
3
3
  import { useState as p, useEffect as Z } from "react";
4
- import { s as P } from "./index-DxagiOHo.js";
5
- import { i as _ } from "./index-C1rRk_50.js";
4
+ import { s as P } from "./index-fwdktvAS.js";
5
+ import { i as _ } from "./index-V_JXij1_.js";
6
6
  import { u as y } from "./Typography-Ctgfl1J5.js";
7
7
  import { n as v } from "./numberFormattingFunction-14YCbkN2.js";
8
8
  import { GraphFooter as rr } from "./GraphFooter.js";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react"),m=require("./parse-hMnG_lRV.cjs"),qt=require("./index-BzeLQvXk.cjs"),Et=require("./numberFormattingFunction-02t-wJta.cjs"),Tt=require("./Tooltip-n8z5bfav.cjs"),T=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),bt=require("./customArea-CK768gCn.cjs"),Mt=require("./AxisTitle-CK9YeovX.cjs"),Ft=require("./Axis-DE7dSn1_.cjs"),Pt=require("./XTicksAndGridLines-CCzXIV8d.cjs"),Gt=require("./ReferenceLine-CFVBBN__.cjs"),Ht=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Wt=require("./index-BYzIB5V6.cjs"),Yt=require("./time-Byw_jYQ7.cjs"),Xt=require("./linear-BVckp9RD.cjs"),At=require("./line-DHV4JwCR.cjs"),ht=require("./step-BZ3C8QFW.cjs"),Ct=require("./area-D3Qx7k7K.cjs"),Ut=require("./select-Bnfk0lJx.cjs"),Bt=require("./init-DU0ybBc_.cjs"),zt=require("./pointer-Dkq5NV1q.cjs"),Jt=require("./use-in-view-sQJZ_xDO.cjs"),f=require("./proxy-BHRoeZgd.cjs"),Kt=require("./GraphFooter.cjs"),Qt=require("./GraphHeader.cjs"),Zt=require("./ColorLegend.cjs"),pt=require("./Colors.cjs"),_t=require("./generateRandomString-B5zBiJzS.cjs"),te=require("./EmptyState-d8_8SxeW.cjs");function ee(dt){const{data:V,width:O,height:G,lineColors:j,suffix:D,prefix:w,dateFormat:o,showValues:l,noOfXTicks:z,rightMargin:yt,leftMargin:R,topMargin:gt,bottomMargin:J,tooltip:H,highlightAreaSettings:N,onSeriesMouseOver:W,animate:n,rtl:K,showColorLegendAtTop:ft,colorDomain:M,diffAreaColors:Q,idSuffix:E,strokeWidth:Z,showDots:_,refValues:Y,minValue:k,maxValue:X,annotations:L,customHighlightAreaSettings:F,yAxisTitle:U,noOfYTicks:tt,minDate:et,maxDate:it,curveType:P,styles:h,classNames:p,precision:S,customLayers:nt}=dt,at=d.useRef(null),r=Jt.useInView(at,{once:n.once,amount:n.amount}),[c,jt]=d.useState(!1);d.useEffect(()=>{if(r&&!c){const t=setTimeout(()=>{jt(!0)},(n.duration+.5)*1e3);return()=>clearTimeout(t)}},[r,c,n.duration]);const $=P==="linear"?At.curveLinear:P==="step"?ht.curveStep:P==="stepAfter"?ht.stepAfter:P==="stepBefore"?ht.stepBefore:ht.monotoneX,[q,st]=d.useState(void 0),[ot,rt]=d.useState(void 0),[b,A]=d.useState(void 0),y={top:gt,bottom:J,left:U?R+30:R,right:yt},lt=d.useRef(null),i=qt.sortBy(V.map(t=>({...t,date:m.parse(`${t.date}`,o,new Date)})),"date"),ct=N.map(t=>({...t,coordinates:[t.coordinates[0]===null?null:m.parse(`${t.coordinates[0]}`,o,new Date),t.coordinates[1]===null?null:m.parse(`${t.coordinates[1]}`,o,new Date)]})),xt=F.map(t=>({...t,coordinates:t.coordinates.map((v,I)=>I%2===0?m.parse(`${v}`,o,new Date):v)})),x=O-y.left-y.right,g=G-y.top-y.bottom,ut=et?m.parse(`${et}`,o,new Date):i[0].date,u=it?m.parse(`${it}`,o,new Date):i[i.length-1].date,B=Math.min(...i.map(t=>t.y1))!==1/0?Math.min(...i.map(t=>t.y1))>0?0:Math.min(...i.map(t=>t.y1)):0,Ot=Math.min(...i.map(t=>t.y2))!==1/0?Math.min(...i.map(t=>t.y2))>0?0:Math.min(...i.map(t=>t.y2)):0,Nt=Math.max(...i.map(t=>t.y1))!==1/0?Math.max(...i.map(t=>t.y1)):0,It=Math.max(...i.map(t=>t.y2))!==1/0?Math.max(...i.map(t=>t.y2)):0,C=T.checkIfNullOrUndefined(k)?B<Ot?B:Ot:k,wt=Nt>It?Nt:It,a=Yt.time().domain([ut,u]).range([0,x]),s=Xt.linear().domain([T.checkIfNullOrUndefined(k)?C:k,T.checkIfNullOrUndefined(X)?wt>0?wt:0:X]).range([g,0]).nice(),vt=At.line().x(t=>a(t.date)).y(t=>s(t.y1)).curve($),Vt=At.line().x(t=>a(t.date)).y(t=>s(t.y2)).curve($),Dt=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y1)).y0(t=>s(t.y2)).curve($),St=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y1)).y0(0).curve($),$t=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y2)).y0(0).curve($),kt=s.ticks(tt),Lt=a.ticks(z);return d.useEffect(()=>{const t=I=>{const mt=i[Bt.bisectCenter(i.map(Rt=>Rt.date),a.invert(zt.pointer(I)[0]),0)];st(mt||i[i.length-1]),W?.(mt||i[i.length-1]),A(I.clientY),rt(I.clientX)},v=()=>{st(void 0),rt(void 0),A(void 0),W?.(void 0)};Ut.select(lt.current).on("mousemove",t).on("mouseout",v)},[a,i,W]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(f.motion.svg,{width:`${O}px`,height:`${G}px`,viewBox:`0 0 ${O} ${G}`,direction:"ltr",ref:at,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${y.left},${y.top})`,children:[e.jsxRuntimeExports.jsx("clipPath",{id:`above${E}`,children:e.jsxRuntimeExports.jsx("path",{d:$t(i),style:{fill:"none"}})}),e.jsxRuntimeExports.jsx("clipPath",{id:`below${E}`,children:e.jsxRuntimeExports.jsx("path",{d:St(i),style:{fill:"none"}})}),e.jsxRuntimeExports.jsx(Wt.HighlightArea,{areaSettings:ct,width:x,height:g,scale:a,animate:n,isInView:r}),e.jsxRuntimeExports.jsx(bt.CustomArea,{areaSettings:xt,scaleX:a,scaleY:s,animate:n,isInView:r}),e.jsxRuntimeExports.jsx("g",{children:e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(Ht.YTicksAndGridLines,{values:kt.filter(t=>t!==0),y:kt.filter(t=>t!==0).map(t=>s(t)),x1:0-R,x2:x+y.right,styles:{gridLines:h?.yAxis?.gridLines,labels:h?.yAxis?.labels},classNames:{gridLines:p?.yAxis?.gridLines,labels:p?.yAxis?.labels},suffix:D,prefix:w,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:S}),e.jsxRuntimeExports.jsx(Ft.Axis,{y1:s(C<0?0:C),y2:s(C<0?0:C),x1:0-R,x2:x+y.right,label:Et.numberFormattingFunction(C<0?0:C,"NA",S,w,D),labelPos:{x:0-R,y:s(C<0?0:C),dx:0,dy:wt<0?"1rem":-5},classNames:{axis:p?.xAxis?.axis,label:p?.yAxis?.labels},styles:{axis:h?.xAxis?.axis,label:h?.yAxis?.labels}}),e.jsxRuntimeExports.jsx(Mt.AxisTitle,{x:0-R-15,y:g/2,style:h?.yAxis?.title,className:p?.yAxis?.title,text:U,rotate90:!0})]})}),e.jsxRuntimeExports.jsx(Pt.XTicksAndGridLines,{values:Lt.map(t=>m.format(t,o)),x:Lt.map(t=>a(t)),y1:0,y2:g,styles:{gridLines:h?.xAxis?.gridLines,labels:h?.xAxis?.labels},classNames:{gridLines:e.mo("opacity-0",p?.xAxis?.gridLines),labels:e.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",p?.xAxis?.labels)},suffix:D,prefix:w,labelType:"primary",showGridLines:!0,precision:S}),nt.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(f.motion.path,{clipPath:`url(#below${E})`,d:Dt(i)||"",style:{fill:Q[1]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:1},whileInView:{opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(f.motion.path,{clipPath:`url(#above${E})`,d:Dt(i)||"",style:{fill:Q[0]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"})]}),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(f.motion.path,{d:vt(i)||"",style:{fill:"none",stroke:j[0],strokeWidth:Z},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{pathLength:0,d:vt(i)||"",opacity:1},whileInView:{pathLength:1,d:vt(i)||"",opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(f.motion.path,{style:{fill:"none",stroke:j[1],strokeWidth:Z},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{pathLength:0,d:Vt(i)||"",opacity:1},whileInView:{pathLength:1,d:Vt(i)||"",opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),ft?null:e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(f.motion.text,{style:{fill:j[0]},className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(i[i.length-1].date),y:s(i[i.length-1].y1)},whileInView:{opacity:1,x:a(i[i.length-1].date),y:s(i[i.length-1].y1),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:M[0]},M[0]),e.jsxRuntimeExports.jsx(f.motion.text,{style:{fill:j[1]},className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(i[i.length-1].date),y:s(i[i.length-1].y2)},whileInView:{opacity:1,x:a(i[i.length-1].date),y:s(i[i.length-1].y2),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:M[1]},M[1])]}),q?e.jsxRuntimeExports.jsx("line",{y1:0,y2:g,x1:a(q.date),x2:a(q.date),className:e.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",p?.mouseOverLine),style:h?.mouseOverLine}):null,i.map((t,v)=>e.jsxRuntimeExports.jsxs(f.motion.g,{children:[T.checkIfNullOrUndefined(t.y1)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[_?e.jsxRuntimeExports.jsx(f.motion.circle,{r:x/i.length<5?0:x/i.length<20?2:4,style:{fill:j[0]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,cx:a(t.date),cy:s(t.y1)},whileInView:{opacity:1,transition:{duration:.5,delay:n.duration},cx:a(t.date),cy:s(t.y1)}},initial:"initial",animate:r?"whileInView":"initial"}):null,l?e.jsxRuntimeExports.jsx(f.motion.text,{dy:t.y2<t.y1?-8:"1em",style:{fill:j[0],textAnchor:"middle",...h?.graphObjectValues||{}},className:e.mo("graph-value graph-value-line-1 text-xs font-bold",p?.graphObjectValues),exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(t.date),y:s(t.y1)},whileInView:{opacity:1,x:a(t.date),y:s(t.y1),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:Et.numberFormattingFunction(t.y1,"NA",S,w,D)}):null]}),T.checkIfNullOrUndefined(t.y2)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[_?e.jsxRuntimeExports.jsx(f.motion.circle,{r:x/i.length<5?0:x/i.length<20?2:4,style:{fill:j[1]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,cx:a(t.date),cy:s(t.y2)},whileInView:{opacity:1,transition:{duration:c?n.duration:.5,delay:c?0:n.duration},cx:a(t.date),cy:s(t.y2)}},initial:"initial",animate:r?"whileInView":"initial"}):null,l?e.jsxRuntimeExports.jsx(f.motion.text,{dy:t.y2>t.y1?-8:"1em",style:{fill:j[1],textAnchor:"middle",...h?.graphObjectValues||{}},className:e.mo("graph-value graph-value-line-2 text-xs font-bold",p?.graphObjectValues),exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(t.date),y:s(t.y2)},whileInView:{opacity:1,x:a(t.date),y:s(t.y2),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:Et.numberFormattingFunction(t.y2,"NA",S,w,D)}):null]})]},v))]}),Y?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Y.map((t,v)=>e.jsxRuntimeExports.jsx(Gt.RefLineY,{text:t.text,color:t.color,y:s(t.value),x1:0-R,x2:x+y.right,classNames:t.classNames,styles:t.styles,animate:n,isInView:r},v))}):null,e.jsxRuntimeExports.jsx("g",{children:L.map((t,v)=>{const I=bt.getLineEndPoint({x:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8},{x:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date)):0,y:t.yCoordinate?s(t.yCoordinate):0},T.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius),mt=t.showConnector?{y1:I.y,x1:I.x,y2:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0):0+(t.yOffset||0),x2:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),cy:t.yCoordinate?s(t.yCoordinate):0,cx:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date)):0,circleRadius:T.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius,strokeWidth:t.showConnector===!0?2:Math.min(t.showConnector||0,1)}:void 0,Rt={y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8,x:K?0:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),width:K?t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0):x+y.right-(t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0)),maxWidth:t.maxWidth,fontWeight:t.fontWeight,align:t.align};return e.jsxRuntimeExports.jsx(bt.Annotation,{color:t.color,connectorsSettings:mt,labelSettings:Rt,text:t.text,classNames:t.classNames,styles:t.styles,animate:n,isInView:r},v)})}),nt.filter(t=>t.position==="after").map(t=>t.layer),e.jsxRuntimeExports.jsx("rect",{ref:lt,style:{fill:"none",pointerEvents:"all"},width:x,height:g})]})}),q&&H&&ot&&b?e.jsxRuntimeExports.jsx(Tt.Tooltip,{data:q,body:H,xPos:ot,yPos:b,backgroundStyle:h?.tooltip,className:p?.tooltip}):null]})}function ie(dt){const{data:V,graphTitle:O,suffix:G="",sources:j,prefix:D="",graphDescription:w,height:o,width:l,footNote:z,noOfXTicks:yt=10,dateFormat:R="yyyy",showValues:gt=!1,padding:J,lineColors:H=[pt.Colors.light.categoricalColors.colors[0],pt.Colors.light.categoricalColors.colors[1]],backgroundColor:N=!1,leftMargin:W=30,rightMargin:n=50,topMargin:K=20,bottomMargin:ft=25,tooltip:M,highlightAreaSettings:Q=[],relativeHeight:E,onSeriesMouseOver:Z,graphID:_,graphDownload:Y=!1,dataDownload:k=!1,animate:X=!1,language:L="en",minHeight:F=0,labels:U,showColorLegendAtTop:tt=!1,colorLegendTitle:et,diffAreaColors:it=[pt.Colors.alerts.red,pt.Colors.alerts.darkGreen],strokeWidth:P=2,showDots:h=!0,refValues:p=[],minValue:S,maxValue:nt,annotations:at=[],customHighlightAreaSettings:r=[],theme:c="light",ariaLabel:jt,yAxisTitle:$,noOfYTicks:q=5,minDate:st,maxDate:ot,curveType:rt="curve",styles:b,classNames:A,precision:y=2,customLayers:lt=[]}=dt,[i,ct]=d.useState(0),[xt,x]=d.useState(0),g=d.useRef(null),ut=d.useRef(null);return d.useEffect(()=>{const u=new ResizeObserver(B=>{ct(l||B[0].target.clientWidth||620),x(o||B[0].target.clientHeight||480)});return g.current&&(x(g.current.clientHeight||480),ct(g.current.clientWidth||620),l||u.observe(g.current)),()=>u.disconnect()},[l,o]),e.jsxRuntimeExports.jsx("div",{className:`${c||"light"} flex ${l?"w-fit grow-0":"w-full grow"}`,dir:L==="he"||L==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${N?N===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${L||"en"}`,l?"w-fit":"w-full",A?.graphContainer),style:{...b?.graphContainer||{},...N&&N!==!0?{backgroundColor:N}:{}},id:_,ref:ut,"aria-label":jt||`${O?`The graph shows ${O}. `:""}This is a line chart that highlights the difference between two datasets over time.${w?` ${w}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:N?J||"1rem":J||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[O||w||Y||k?e.jsxRuntimeExports.jsx(Qt.GraphHeader,{styles:{title:b?.title,description:b?.description},classNames:{title:A?.title,description:A?.description},graphTitle:O,graphDescription:w,width:l,graphDownload:Y?ut.current:void 0,dataDownload:k?V.map(u=>u.data).filter(u=>u!==void 0).length>0?V.map(u=>u.data).filter(u=>u!==void 0):V.filter(u=>u!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:V.length===0?e.jsxRuntimeExports.jsx(te.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[tt?e.jsxRuntimeExports.jsx(Zt.ColorLegend,{colorDomain:U,colorLegendTitle:et,colors:H,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:g,"aria-label":"Graph area",children:(l||i)&&(o||xt)?e.jsxRuntimeExports.jsx(ee,{data:V,lineColors:H,colorDomain:U,width:l||i,height:Math.max(F,o||(E?F?(l||i)*E>F?(l||i)*E:F:(l||i)*E:xt)),suffix:G,prefix:D,dateFormat:R,showValues:gt,noOfXTicks:yt,leftMargin:W,rightMargin:n,topMargin:K,bottomMargin:ft,highlightAreaSettings:Q,tooltip:M,onSeriesMouseOver:Z,showColorLegendAtTop:tt,animate:X===!0?{duration:.5,once:!0,amount:.5}:X||{duration:0,once:!0,amount:0},rtl:L==="he"||L==="ar",diffAreaColors:it,idSuffix:_t.generateRandomString(8),strokeWidth:P,showDots:h,refValues:p,minValue:S,maxValue:nt,annotations:at,customHighlightAreaSettings:r,yAxisTitle:$,noOfYTicks:q,minDate:st,maxDate:ot,curveType:rt,styles:b,classNames:A,precision:y,customLayers:lt}):null})]})}),j||z?e.jsxRuntimeExports.jsx(Kt.GraphFooter,{styles:{footnote:b?.footnote,source:b?.source},classNames:{footnote:A?.footnote,source:A?.source},sources:j,footNote:z,width:l}):null]})})})})}exports.DifferenceLineChart=ie;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react"),m=require("./parse-hMnG_lRV.cjs"),qt=require("./index-DYH8g9WA.cjs"),Et=require("./numberFormattingFunction-02t-wJta.cjs"),Tt=require("./Tooltip-De16GWhY.cjs"),T=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),bt=require("./customArea-CK768gCn.cjs"),Mt=require("./AxisTitle-CK9YeovX.cjs"),Ft=require("./Axis-DE7dSn1_.cjs"),Pt=require("./XTicksAndGridLines-CCzXIV8d.cjs"),Gt=require("./ReferenceLine-CFVBBN__.cjs"),Ht=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Wt=require("./index-BYzIB5V6.cjs"),Yt=require("./time-Byw_jYQ7.cjs"),Xt=require("./linear-BVckp9RD.cjs"),At=require("./line-DHV4JwCR.cjs"),ht=require("./step-BZ3C8QFW.cjs"),Ct=require("./area-D3Qx7k7K.cjs"),Ut=require("./select-Bnfk0lJx.cjs"),Bt=require("./init-DU0ybBc_.cjs"),zt=require("./pointer-Dkq5NV1q.cjs"),Jt=require("./use-in-view-sQJZ_xDO.cjs"),f=require("./proxy-BHRoeZgd.cjs"),Kt=require("./GraphFooter.cjs"),Qt=require("./GraphHeader.cjs"),Zt=require("./ColorLegend.cjs"),pt=require("./Colors.cjs"),_t=require("./generateRandomString-B5zBiJzS.cjs"),te=require("./EmptyState-d8_8SxeW.cjs");function ee(dt){const{data:V,width:O,height:G,lineColors:j,suffix:D,prefix:w,dateFormat:o,showValues:l,noOfXTicks:z,rightMargin:yt,leftMargin:R,topMargin:gt,bottomMargin:J,tooltip:H,highlightAreaSettings:N,onSeriesMouseOver:W,animate:n,rtl:K,showColorLegendAtTop:ft,colorDomain:M,diffAreaColors:Q,idSuffix:E,strokeWidth:Z,showDots:_,refValues:Y,minValue:k,maxValue:X,annotations:L,customHighlightAreaSettings:F,yAxisTitle:U,noOfYTicks:tt,minDate:et,maxDate:it,curveType:P,styles:h,classNames:p,precision:S,customLayers:nt}=dt,at=d.useRef(null),r=Jt.useInView(at,{once:n.once,amount:n.amount}),[c,jt]=d.useState(!1);d.useEffect(()=>{if(r&&!c){const t=setTimeout(()=>{jt(!0)},(n.duration+.5)*1e3);return()=>clearTimeout(t)}},[r,c,n.duration]);const $=P==="linear"?At.curveLinear:P==="step"?ht.curveStep:P==="stepAfter"?ht.stepAfter:P==="stepBefore"?ht.stepBefore:ht.monotoneX,[q,st]=d.useState(void 0),[ot,rt]=d.useState(void 0),[b,A]=d.useState(void 0),y={top:gt,bottom:J,left:U?R+30:R,right:yt},lt=d.useRef(null),i=qt.sortBy(V.map(t=>({...t,date:m.parse(`${t.date}`,o,new Date)})),"date"),ct=N.map(t=>({...t,coordinates:[t.coordinates[0]===null?null:m.parse(`${t.coordinates[0]}`,o,new Date),t.coordinates[1]===null?null:m.parse(`${t.coordinates[1]}`,o,new Date)]})),xt=F.map(t=>({...t,coordinates:t.coordinates.map((v,I)=>I%2===0?m.parse(`${v}`,o,new Date):v)})),x=O-y.left-y.right,g=G-y.top-y.bottom,ut=et?m.parse(`${et}`,o,new Date):i[0].date,u=it?m.parse(`${it}`,o,new Date):i[i.length-1].date,B=Math.min(...i.map(t=>t.y1))!==1/0?Math.min(...i.map(t=>t.y1))>0?0:Math.min(...i.map(t=>t.y1)):0,Ot=Math.min(...i.map(t=>t.y2))!==1/0?Math.min(...i.map(t=>t.y2))>0?0:Math.min(...i.map(t=>t.y2)):0,Nt=Math.max(...i.map(t=>t.y1))!==1/0?Math.max(...i.map(t=>t.y1)):0,It=Math.max(...i.map(t=>t.y2))!==1/0?Math.max(...i.map(t=>t.y2)):0,C=T.checkIfNullOrUndefined(k)?B<Ot?B:Ot:k,wt=Nt>It?Nt:It,a=Yt.time().domain([ut,u]).range([0,x]),s=Xt.linear().domain([T.checkIfNullOrUndefined(k)?C:k,T.checkIfNullOrUndefined(X)?wt>0?wt:0:X]).range([g,0]).nice(),vt=At.line().x(t=>a(t.date)).y(t=>s(t.y1)).curve($),Vt=At.line().x(t=>a(t.date)).y(t=>s(t.y2)).curve($),Dt=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y1)).y0(t=>s(t.y2)).curve($),St=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y1)).y0(0).curve($),$t=Ct.area().x(t=>a(t.date)).y1(t=>s(t.y2)).y0(0).curve($),kt=s.ticks(tt),Lt=a.ticks(z);return d.useEffect(()=>{const t=I=>{const mt=i[Bt.bisectCenter(i.map(Rt=>Rt.date),a.invert(zt.pointer(I)[0]),0)];st(mt||i[i.length-1]),W?.(mt||i[i.length-1]),A(I.clientY),rt(I.clientX)},v=()=>{st(void 0),rt(void 0),A(void 0),W?.(void 0)};Ut.select(lt.current).on("mousemove",t).on("mouseout",v)},[a,i,W]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(f.motion.svg,{width:`${O}px`,height:`${G}px`,viewBox:`0 0 ${O} ${G}`,direction:"ltr",ref:at,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${y.left},${y.top})`,children:[e.jsxRuntimeExports.jsx("clipPath",{id:`above${E}`,children:e.jsxRuntimeExports.jsx("path",{d:$t(i),style:{fill:"none"}})}),e.jsxRuntimeExports.jsx("clipPath",{id:`below${E}`,children:e.jsxRuntimeExports.jsx("path",{d:St(i),style:{fill:"none"}})}),e.jsxRuntimeExports.jsx(Wt.HighlightArea,{areaSettings:ct,width:x,height:g,scale:a,animate:n,isInView:r}),e.jsxRuntimeExports.jsx(bt.CustomArea,{areaSettings:xt,scaleX:a,scaleY:s,animate:n,isInView:r}),e.jsxRuntimeExports.jsx("g",{children:e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(Ht.YTicksAndGridLines,{values:kt.filter(t=>t!==0),y:kt.filter(t=>t!==0).map(t=>s(t)),x1:0-R,x2:x+y.right,styles:{gridLines:h?.yAxis?.gridLines,labels:h?.yAxis?.labels},classNames:{gridLines:p?.yAxis?.gridLines,labels:p?.yAxis?.labels},suffix:D,prefix:w,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:S}),e.jsxRuntimeExports.jsx(Ft.Axis,{y1:s(C<0?0:C),y2:s(C<0?0:C),x1:0-R,x2:x+y.right,label:Et.numberFormattingFunction(C<0?0:C,"NA",S,w,D),labelPos:{x:0-R,y:s(C<0?0:C),dx:0,dy:wt<0?"1rem":-5},classNames:{axis:p?.xAxis?.axis,label:p?.yAxis?.labels},styles:{axis:h?.xAxis?.axis,label:h?.yAxis?.labels}}),e.jsxRuntimeExports.jsx(Mt.AxisTitle,{x:0-R-15,y:g/2,style:h?.yAxis?.title,className:p?.yAxis?.title,text:U,rotate90:!0})]})}),e.jsxRuntimeExports.jsx(Pt.XTicksAndGridLines,{values:Lt.map(t=>m.format(t,o)),x:Lt.map(t=>a(t)),y1:0,y2:g,styles:{gridLines:h?.xAxis?.gridLines,labels:h?.xAxis?.labels},classNames:{gridLines:e.mo("opacity-0",p?.xAxis?.gridLines),labels:e.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",p?.xAxis?.labels)},suffix:D,prefix:w,labelType:"primary",showGridLines:!0,precision:S}),nt.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(f.motion.path,{clipPath:`url(#below${E})`,d:Dt(i)||"",style:{fill:Q[1]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:1},whileInView:{opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(f.motion.path,{clipPath:`url(#above${E})`,d:Dt(i)||"",style:{fill:Q[0]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"})]}),e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(f.motion.path,{d:vt(i)||"",style:{fill:"none",stroke:j[0],strokeWidth:Z},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{pathLength:0,d:vt(i)||"",opacity:1},whileInView:{pathLength:1,d:vt(i)||"",opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),e.jsxRuntimeExports.jsx(f.motion.path,{style:{fill:"none",stroke:j[1],strokeWidth:Z},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{pathLength:0,d:Vt(i)||"",opacity:1},whileInView:{pathLength:1,d:Vt(i)||"",opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:r?"whileInView":"initial"}),ft?null:e.jsxRuntimeExports.jsxs("g",{children:[e.jsxRuntimeExports.jsx(f.motion.text,{style:{fill:j[0]},className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(i[i.length-1].date),y:s(i[i.length-1].y1)},whileInView:{opacity:1,x:a(i[i.length-1].date),y:s(i[i.length-1].y1),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:M[0]},M[0]),e.jsxRuntimeExports.jsx(f.motion.text,{style:{fill:j[1]},className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(i[i.length-1].date),y:s(i[i.length-1].y2)},whileInView:{opacity:1,x:a(i[i.length-1].date),y:s(i[i.length-1].y2),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:M[1]},M[1])]}),q?e.jsxRuntimeExports.jsx("line",{y1:0,y2:g,x1:a(q.date),x2:a(q.date),className:e.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",p?.mouseOverLine),style:h?.mouseOverLine}):null,i.map((t,v)=>e.jsxRuntimeExports.jsxs(f.motion.g,{children:[T.checkIfNullOrUndefined(t.y1)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[_?e.jsxRuntimeExports.jsx(f.motion.circle,{r:x/i.length<5?0:x/i.length<20?2:4,style:{fill:j[0]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,cx:a(t.date),cy:s(t.y1)},whileInView:{opacity:1,transition:{duration:.5,delay:n.duration},cx:a(t.date),cy:s(t.y1)}},initial:"initial",animate:r?"whileInView":"initial"}):null,l?e.jsxRuntimeExports.jsx(f.motion.text,{dy:t.y2<t.y1?-8:"1em",style:{fill:j[0],textAnchor:"middle",...h?.graphObjectValues||{}},className:e.mo("graph-value graph-value-line-1 text-xs font-bold",p?.graphObjectValues),exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(t.date),y:s(t.y1)},whileInView:{opacity:1,x:a(t.date),y:s(t.y1),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:Et.numberFormattingFunction(t.y1,"NA",S,w,D)}):null]}),T.checkIfNullOrUndefined(t.y2)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[_?e.jsxRuntimeExports.jsx(f.motion.circle,{r:x/i.length<5?0:x/i.length<20?2:4,style:{fill:j[1]},exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,cx:a(t.date),cy:s(t.y2)},whileInView:{opacity:1,transition:{duration:c?n.duration:.5,delay:c?0:n.duration},cx:a(t.date),cy:s(t.y2)}},initial:"initial",animate:r?"whileInView":"initial"}):null,l?e.jsxRuntimeExports.jsx(f.motion.text,{dy:t.y2>t.y1?-8:"1em",style:{fill:j[1],textAnchor:"middle",...h?.graphObjectValues||{}},className:e.mo("graph-value graph-value-line-2 text-xs font-bold",p?.graphObjectValues),exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{opacity:0,x:a(t.date),y:s(t.y2)},whileInView:{opacity:1,x:a(t.date),y:s(t.y2),transition:{duration:c?n.duration:.5,delay:c?0:n.duration}}},initial:"initial",animate:r?"whileInView":"initial",children:Et.numberFormattingFunction(t.y2,"NA",S,w,D)}):null]})]},v))]}),Y?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Y.map((t,v)=>e.jsxRuntimeExports.jsx(Gt.RefLineY,{text:t.text,color:t.color,y:s(t.value),x1:0-R,x2:x+y.right,classNames:t.classNames,styles:t.styles,animate:n,isInView:r},v))}):null,e.jsxRuntimeExports.jsx("g",{children:L.map((t,v)=>{const I=bt.getLineEndPoint({x:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8},{x:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date)):0,y:t.yCoordinate?s(t.yCoordinate):0},T.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius),mt=t.showConnector?{y1:I.y,x1:I.x,y2:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0):0+(t.yOffset||0),x2:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),cy:t.yCoordinate?s(t.yCoordinate):0,cx:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date)):0,circleRadius:T.checkIfNullOrUndefined(t.connectorRadius)?3.5:t.connectorRadius,strokeWidth:t.showConnector===!0?2:Math.min(t.showConnector||0,1)}:void 0,Rt={y:t.yCoordinate?s(t.yCoordinate)+(t.yOffset||0)-8:0+(t.yOffset||0)-8,x:K?0:t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0),width:K?t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0):x+y.right-(t.xCoordinate?a(m.parse(`${t.xCoordinate}`,o,new Date))+(t.xOffset||0):0+(t.xOffset||0)),maxWidth:t.maxWidth,fontWeight:t.fontWeight,align:t.align};return e.jsxRuntimeExports.jsx(bt.Annotation,{color:t.color,connectorsSettings:mt,labelSettings:Rt,text:t.text,classNames:t.classNames,styles:t.styles,animate:n,isInView:r},v)})}),nt.filter(t=>t.position==="after").map(t=>t.layer),e.jsxRuntimeExports.jsx("rect",{ref:lt,style:{fill:"none",pointerEvents:"all"},width:x,height:g})]})}),q&&H&&ot&&b?e.jsxRuntimeExports.jsx(Tt.Tooltip,{data:q,body:H,xPos:ot,yPos:b,backgroundStyle:h?.tooltip,className:p?.tooltip}):null]})}function ie(dt){const{data:V,graphTitle:O,suffix:G="",sources:j,prefix:D="",graphDescription:w,height:o,width:l,footNote:z,noOfXTicks:yt=10,dateFormat:R="yyyy",showValues:gt=!1,padding:J,lineColors:H=[pt.Colors.light.categoricalColors.colors[0],pt.Colors.light.categoricalColors.colors[1]],backgroundColor:N=!1,leftMargin:W=30,rightMargin:n=50,topMargin:K=20,bottomMargin:ft=25,tooltip:M,highlightAreaSettings:Q=[],relativeHeight:E,onSeriesMouseOver:Z,graphID:_,graphDownload:Y=!1,dataDownload:k=!1,animate:X=!1,language:L="en",minHeight:F=0,labels:U,showColorLegendAtTop:tt=!1,colorLegendTitle:et,diffAreaColors:it=[pt.Colors.alerts.red,pt.Colors.alerts.darkGreen],strokeWidth:P=2,showDots:h=!0,refValues:p=[],minValue:S,maxValue:nt,annotations:at=[],customHighlightAreaSettings:r=[],theme:c="light",ariaLabel:jt,yAxisTitle:$,noOfYTicks:q=5,minDate:st,maxDate:ot,curveType:rt="curve",styles:b,classNames:A,precision:y=2,customLayers:lt=[]}=dt,[i,ct]=d.useState(0),[xt,x]=d.useState(0),g=d.useRef(null),ut=d.useRef(null);return d.useEffect(()=>{const u=new ResizeObserver(B=>{ct(l||B[0].target.clientWidth||620),x(o||B[0].target.clientHeight||480)});return g.current&&(x(g.current.clientHeight||480),ct(g.current.clientWidth||620),l||u.observe(g.current)),()=>u.disconnect()},[l,o]),e.jsxRuntimeExports.jsx("div",{className:`${c||"light"} flex ${l?"w-fit grow-0":"w-full grow"}`,dir:L==="he"||L==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${N?N===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${L||"en"}`,l?"w-fit":"w-full",A?.graphContainer),style:{...b?.graphContainer||{},...N&&N!==!0?{backgroundColor:N}:{}},id:_,ref:ut,"aria-label":jt||`${O?`The graph shows ${O}. `:""}This is a line chart that highlights the difference between two datasets over time.${w?` ${w}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:N?J||"1rem":J||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[O||w||Y||k?e.jsxRuntimeExports.jsx(Qt.GraphHeader,{styles:{title:b?.title,description:b?.description},classNames:{title:A?.title,description:A?.description},graphTitle:O,graphDescription:w,width:l,graphDownload:Y?ut.current:void 0,dataDownload:k?V.map(u=>u.data).filter(u=>u!==void 0).length>0?V.map(u=>u.data).filter(u=>u!==void 0):V.filter(u=>u!==void 0):null}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:V.length===0?e.jsxRuntimeExports.jsx(te.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[tt?e.jsxRuntimeExports.jsx(Zt.ColorLegend,{colorDomain:U,colorLegendTitle:et,colors:H,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:g,"aria-label":"Graph area",children:(l||i)&&(o||xt)?e.jsxRuntimeExports.jsx(ee,{data:V,lineColors:H,colorDomain:U,width:l||i,height:Math.max(F,o||(E?F?(l||i)*E>F?(l||i)*E:F:(l||i)*E:xt)),suffix:G,prefix:D,dateFormat:R,showValues:gt,noOfXTicks:yt,leftMargin:W,rightMargin:n,topMargin:K,bottomMargin:ft,highlightAreaSettings:Q,tooltip:M,onSeriesMouseOver:Z,showColorLegendAtTop:tt,animate:X===!0?{duration:.5,once:!0,amount:.5}:X||{duration:0,once:!0,amount:0},rtl:L==="he"||L==="ar",diffAreaColors:it,idSuffix:_t.generateRandomString(8),strokeWidth:P,showDots:h,refValues:p,minValue:S,maxValue:nt,annotations:at,customHighlightAreaSettings:r,yAxisTitle:$,noOfYTicks:q,minDate:st,maxDate:ot,curveType:rt,styles:b,classNames:A,precision:y,customLayers:lt}):null})]})}),j||z?e.jsxRuntimeExports.jsx(Kt.GraphFooter,{styles:{footnote:b?.footnote,source:b?.source},classNames:{footnote:A?.footnote,source:A?.source},sources:j,footNote:z,width:l}):null]})})})})}exports.DifferenceLineChart=ie;
2
2
  //# sourceMappingURL=DifferenceLineChart.cjs.map
@@ -1,9 +1,9 @@
1
1
  import { j as e, m as G } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useRef as ut, useState as W, useEffect as Dt } from "react";
3
3
  import { p as d, f as Ht } from "./parse-DlCRUFh_.js";
4
- import { s as Rt } from "./index-DxagiOHo.js";
4
+ import { s as Rt } from "./index-fwdktvAS.js";
5
5
  import { n as Ct } from "./numberFormattingFunction-14YCbkN2.js";
6
- import { T as Ft } from "./Tooltip-DyM5snqx.js";
6
+ import { T as Ft } from "./Tooltip-CVCGWyzw.js";
7
7
  import { c as P } from "./checkIfNullOrUndefined-DmfiKkNw.js";
8
8
  import { C as Gt, g as Wt, A as Yt } from "./customArea-B-dWU0zZ.js";
9
9
  import { A as Xt } from "./AxisTitle-BmHLMRJZ.js";