@undp/data-viz 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.cjs.map +1 -1
  3. package/dist/AreaChart.js +3 -2
  4. package/dist/AreaChart.js.map +1 -1
  5. package/dist/BarGraph.cjs +1 -1
  6. package/dist/BarGraph.cjs.map +1 -1
  7. package/dist/BarGraph.js +1196 -1224
  8. package/dist/BarGraph.js.map +1 -1
  9. package/dist/BeeSwarmChart.cjs +1 -1
  10. package/dist/BeeSwarmChart.cjs.map +1 -1
  11. package/dist/BeeSwarmChart.js +130 -142
  12. package/dist/BeeSwarmChart.js.map +1 -1
  13. package/dist/BiVariateChoroplethMap.cjs +1 -1
  14. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  15. package/dist/BiVariateChoroplethMap.js +41 -41
  16. package/dist/BiVariateChoroplethMap.js.map +1 -1
  17. package/dist/BulletChart.cjs +1 -1
  18. package/dist/BulletChart.cjs.map +1 -1
  19. package/dist/BulletChart.js +483 -487
  20. package/dist/BulletChart.js.map +1 -1
  21. package/dist/ButterflyChart.cjs +1 -1
  22. package/dist/ButterflyChart.cjs.map +1 -1
  23. package/dist/ButterflyChart.js +99 -99
  24. package/dist/ButterflyChart.js.map +1 -1
  25. package/dist/ChoroplethMap.cjs +1 -1
  26. package/dist/ChoroplethMap.cjs.map +1 -1
  27. package/dist/ChoroplethMap.js +125 -125
  28. package/dist/ChoroplethMap.js.map +1 -1
  29. package/dist/CirclePackingGraph.cjs +1 -1
  30. package/dist/CirclePackingGraph.js +2 -2
  31. package/dist/DataCards.cjs +2 -2
  32. package/dist/DataCards.cjs.map +1 -1
  33. package/dist/DataCards.js +6 -6
  34. package/dist/DataCards.js.map +1 -1
  35. package/dist/DataTable.cjs +1 -1
  36. package/dist/DataTable.cjs.map +1 -1
  37. package/dist/DataTable.js +66 -68
  38. package/dist/DataTable.js.map +1 -1
  39. package/dist/DifferenceLineChart.cjs +1 -1
  40. package/dist/DifferenceLineChart.cjs.map +1 -1
  41. package/dist/DifferenceLineChart.js +3 -2
  42. package/dist/DifferenceLineChart.js.map +1 -1
  43. package/dist/DonutChart.cjs +1 -1
  44. package/dist/DonutChart.cjs.map +1 -1
  45. package/dist/DonutChart.js +205 -205
  46. package/dist/DonutChart.js.map +1 -1
  47. package/dist/DotDensityMap.cjs +1 -1
  48. package/dist/DotDensityMap.cjs.map +1 -1
  49. package/dist/DotDensityMap.js +78 -81
  50. package/dist/DotDensityMap.js.map +1 -1
  51. package/dist/DualAxisLineChart.cjs +1 -1
  52. package/dist/DualAxisLineChart.cjs.map +1 -1
  53. package/dist/DualAxisLineChart.js +3 -2
  54. package/dist/DualAxisLineChart.js.map +1 -1
  55. package/dist/DumbbellChart.cjs +1 -1
  56. package/dist/DumbbellChart.cjs.map +1 -1
  57. package/dist/DumbbellChart.js +64 -65
  58. package/dist/DumbbellChart.js.map +1 -1
  59. package/dist/GeoHubMap.cjs +1 -1
  60. package/dist/GeoHubMap.js +1 -1
  61. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  62. package/dist/GeoHubMapWithLayerSelection.js +1 -1
  63. package/dist/{GraphEl-4RUlclvW.cjs → GraphEl-BcYgMnN2.cjs} +2 -2
  64. package/dist/{GraphEl-4RUlclvW.cjs.map → GraphEl-BcYgMnN2.cjs.map} +1 -1
  65. package/dist/{GraphEl-ClIxlWa3.js → GraphEl-CMWeARJ3.js} +2 -2
  66. package/dist/{GraphEl-ClIxlWa3.js.map → GraphEl-CMWeARJ3.js.map} +1 -1
  67. package/dist/GriddedGraphs.cjs +1 -1
  68. package/dist/GriddedGraphs.js +4 -4
  69. package/dist/GriddedGraphsFromConfig.cjs +1 -1
  70. package/dist/GriddedGraphsFromConfig.js +1 -1
  71. package/dist/HeatMap.cjs +1 -1
  72. package/dist/HeatMap.cjs.map +1 -1
  73. package/dist/HeatMap.js +83 -83
  74. package/dist/HeatMap.js.map +1 -1
  75. package/dist/Histogram.cjs +1 -1
  76. package/dist/Histogram.js +1 -1
  77. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  78. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  79. package/dist/LineChartWithConfidenceInterval.js +7 -6
  80. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  81. package/dist/MultiGraphDashboard.cjs +1 -1
  82. package/dist/MultiGraphDashboard.js +2 -2
  83. package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
  84. package/dist/MultiGraphDashboardFromConfig.js +1 -1
  85. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  86. package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
  87. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
  88. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
  89. package/dist/MultiLineAltChart.cjs +1 -1
  90. package/dist/MultiLineAltChart.cjs.map +1 -1
  91. package/dist/MultiLineAltChart.js +82 -91
  92. package/dist/MultiLineAltChart.js.map +1 -1
  93. package/dist/MultiLineChart.cjs +1 -1
  94. package/dist/MultiLineChart.cjs.map +1 -1
  95. package/dist/MultiLineChart.js +3 -2
  96. package/dist/MultiLineChart.js.map +1 -1
  97. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  98. package/dist/PerformanceIntensiveMultiGraphDashboard.js +2 -2
  99. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
  100. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
  101. package/dist/RadarChart.cjs +1 -1
  102. package/dist/RadarChart.cjs.map +1 -1
  103. package/dist/RadarChart.js +124 -130
  104. package/dist/RadarChart.js.map +1 -1
  105. package/dist/SankeyChart.cjs +1 -1
  106. package/dist/SankeyChart.cjs.map +1 -1
  107. package/dist/SankeyChart.js +200 -200
  108. package/dist/SankeyChart.js.map +1 -1
  109. package/dist/ScatterPlot.cjs +1 -1
  110. package/dist/ScatterPlot.cjs.map +1 -1
  111. package/dist/ScatterPlot.js +149 -155
  112. package/dist/ScatterPlot.js.map +1 -1
  113. package/dist/SimpleLineChart.cjs +1 -1
  114. package/dist/SimpleLineChart.cjs.map +1 -1
  115. package/dist/SimpleLineChart.js +44 -43
  116. package/dist/SimpleLineChart.js.map +1 -1
  117. package/dist/SingleGraphDashboard.cjs +1 -1
  118. package/dist/SingleGraphDashboard.js +4 -4
  119. package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
  120. package/dist/SingleGraphDashboardFromConfig.js +1 -1
  121. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
  122. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
  123. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  124. package/dist/SingleGraphDashboardThreeDGraphs.js +3 -3
  125. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
  126. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
  127. package/dist/SlopeChart.cjs +1 -1
  128. package/dist/SlopeChart.cjs.map +1 -1
  129. package/dist/SlopeChart.js +107 -113
  130. package/dist/SlopeChart.js.map +1 -1
  131. package/dist/SparkLine.cjs +1 -1
  132. package/dist/SparkLine.cjs.map +1 -1
  133. package/dist/SparkLine.js +3 -2
  134. package/dist/SparkLine.js.map +1 -1
  135. package/dist/StripChart.cjs +1 -1
  136. package/dist/StripChart.cjs.map +1 -1
  137. package/dist/StripChart.js +159 -159
  138. package/dist/StripChart.js.map +1 -1
  139. package/dist/ThreeDGlobe.cjs +1 -1
  140. package/dist/ThreeDGlobe.cjs.map +1 -1
  141. package/dist/ThreeDGlobe.js +3 -3
  142. package/dist/ThreeDGlobe.js.map +1 -1
  143. package/dist/TreeMapGraph.cjs +1 -1
  144. package/dist/TreeMapGraph.cjs.map +1 -1
  145. package/dist/TreeMapGraph.js +194 -200
  146. package/dist/TreeMapGraph.js.map +1 -1
  147. package/dist/ensureCompleteData-DkQYPeDa.cjs +2 -0
  148. package/dist/ensureCompleteData-DkQYPeDa.cjs.map +1 -0
  149. package/dist/{ensureCompleteData-BALdOrsS.js → ensureCompleteData-DlmibgaI.js} +28 -8
  150. package/dist/ensureCompleteData-DlmibgaI.js.map +1 -0
  151. package/dist/fetchAndParseData-Ba-_CgxS.cjs +16 -0
  152. package/dist/fetchAndParseData-Ba-_CgxS.cjs.map +1 -0
  153. package/dist/fetchAndParseData-sapWbnYk.js +583 -0
  154. package/dist/fetchAndParseData-sapWbnYk.js.map +1 -0
  155. package/dist/fetchAndParseData.cjs +1 -1
  156. package/dist/fetchAndParseData.js +1 -1
  157. package/dist/getJenks-BbngDoBQ.js +19 -0
  158. package/dist/getJenks-BbngDoBQ.js.map +1 -0
  159. package/dist/getJenks-GYmdwBqm.cjs +2 -0
  160. package/dist/getJenks-GYmdwBqm.cjs.map +1 -0
  161. package/dist/getSliderMarks-9cNoRkDx.js +1023 -0
  162. package/dist/getSliderMarks-9cNoRkDx.js.map +1 -0
  163. package/dist/getSliderMarks-CRIbTGYV.cjs +6 -0
  164. package/dist/getSliderMarks-CRIbTGYV.cjs.map +1 -0
  165. package/dist/getUniqValue-DiCh_MOD.js +13 -0
  166. package/dist/getUniqValue-DiCh_MOD.js.map +1 -0
  167. package/dist/getUniqValue-RViz8tTw.cjs +2 -0
  168. package/dist/getUniqValue-RViz8tTw.cjs.map +1 -0
  169. package/dist/{index-BMgDMxKJ.js → index-37q0ULNQ.js} +44 -50
  170. package/dist/index-37q0ULNQ.js.map +1 -0
  171. package/dist/index-CVlCtJbC.cjs +2 -0
  172. package/dist/index-CVlCtJbC.cjs.map +1 -0
  173. package/dist/index.cjs +1 -1
  174. package/dist/index.d.ts +1 -1
  175. package/dist/index.js +6 -6
  176. package/dist/sort-DfK1b0F5.js +34 -0
  177. package/dist/sort-DfK1b0F5.js.map +1 -0
  178. package/dist/sort-O96oMZLb.cjs +2 -0
  179. package/dist/sort-O96oMZLb.cjs.map +1 -0
  180. package/dist/transformData.cjs +1 -1
  181. package/dist/transformData.js +3 -3
  182. package/dist/transformDataForAggregation-KXGm6flX.cjs +2 -0
  183. package/dist/{transformDataForAggregation-BVxVu4yY.cjs.map → transformDataForAggregation-KXGm6flX.cjs.map} +1 -1
  184. package/dist/{transformDataForAggregation-1BYVFqvF.js → transformDataForAggregation-sBpdlX8n.js} +40 -44
  185. package/dist/{transformDataForAggregation-1BYVFqvF.js.map → transformDataForAggregation-sBpdlX8n.js.map} +1 -1
  186. package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js → transformDataForGraphFromFile-ComYvzuz.js} +3 -3
  187. package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js.map → transformDataForGraphFromFile-ComYvzuz.js.map} +1 -1
  188. package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs → transformDataForGraphFromFile-DVZodTHd.cjs} +2 -2
  189. package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs.map → transformDataForGraphFromFile-DVZodTHd.cjs.map} +1 -1
  190. package/dist/uniqBy-BHy4I8PK.js +8 -0
  191. package/dist/uniqBy-BHy4I8PK.js.map +1 -0
  192. package/dist/uniqBy-O05lp2S5.cjs +2 -0
  193. package/dist/uniqBy-O05lp2S5.cjs.map +1 -0
  194. package/dist/utils.cjs +1 -1
  195. package/dist/utils.d.ts +1 -1
  196. package/dist/utils.js +2 -2
  197. package/package.json +1 -7
  198. package/dist/ensureCompleteData-BALdOrsS.js.map +0 -1
  199. package/dist/ensureCompleteData-BU5Zlccy.cjs +0 -2
  200. package/dist/ensureCompleteData-BU5Zlccy.cjs.map +0 -1
  201. package/dist/fetchAndParseData-DBOl1Icl.js +0 -1196
  202. package/dist/fetchAndParseData-DBOl1Icl.js.map +0 -1
  203. package/dist/fetchAndParseData-Dcy7AS_0.cjs +0 -16
  204. package/dist/fetchAndParseData-Dcy7AS_0.cjs.map +0 -1
  205. package/dist/getJenks-DW96UYNE.js +0 -23
  206. package/dist/getJenks-DW96UYNE.js.map +0 -1
  207. package/dist/getJenks-vofIZmeb.cjs +0 -2
  208. package/dist/getJenks-vofIZmeb.cjs.map +0 -1
  209. package/dist/getSliderMarks-C0jptXeP.js +0 -1054
  210. package/dist/getSliderMarks-C0jptXeP.js.map +0 -1
  211. package/dist/getSliderMarks-CtsEXiLV.cjs +0 -6
  212. package/dist/getSliderMarks-CtsEXiLV.cjs.map +0 -1
  213. package/dist/getUniqValue-CfuE_l9c.cjs +0 -2
  214. package/dist/getUniqValue-CfuE_l9c.cjs.map +0 -1
  215. package/dist/getUniqValue-CttuU_wn.js +0 -20
  216. package/dist/getUniqValue-CttuU_wn.js.map +0 -1
  217. package/dist/index-AqnpA7_O.js +0 -631
  218. package/dist/index-AqnpA7_O.js.map +0 -1
  219. package/dist/index-BJOeaYTk.cjs +0 -2
  220. package/dist/index-BJOeaYTk.cjs.map +0 -1
  221. package/dist/index-BMgDMxKJ.js.map +0 -1
  222. package/dist/index-DYH8g9WA.cjs +0 -2
  223. package/dist/index-DYH8g9WA.cjs.map +0 -1
  224. package/dist/index-Da2GUKrr.cjs +0 -2
  225. package/dist/index-Da2GUKrr.cjs.map +0 -1
  226. package/dist/index-fwdktvAS.js +0 -707
  227. package/dist/index-fwdktvAS.js.map +0 -1
  228. package/dist/transformDataForAggregation-BVxVu4yY.cjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"BiVariateChoroplethMap.js","sources":["../src/Components/Graphs/Maps/BiVariateMap/Graph.tsx","../src/Components/Graphs/Maps/BiVariateMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\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 } from 'd3-scale';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\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 data: BivariateMapDataType[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n\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 showColorScale: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\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 xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\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 [showLegend, setShowLegend] = useState(!(width < 680));\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\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 zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\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\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\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\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\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 <motion.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 </motion.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 xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\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 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 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 >\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 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 d={masterPath}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\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 className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\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\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={{ backgroundColor: 'rgba(240,240,240, 0.7)', width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\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 border text-primary-gray-700 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 border text-primary-gray-700 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 {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 {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 </>\r\n );\r\n}\r\n","import { useEffect, useRef, useState } 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 BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\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: BivariateMapDataType[];\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. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\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 /** 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 /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\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 BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\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 xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\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 onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\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\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].contentRect.width || 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 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\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\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 bi-variate choropleth map where geographic areas are colored in proportion to two variables.${\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 xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\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={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\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 showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\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 dimmedOpacity={dimmedOpacity}\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","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","showLegend","setShowLegend","useState","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","mapG","zoomRef","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","xRange","_","i","yRange","xScale","scaleThreshold","yScale","handleZoom","direction","jsxs","Fragment","jsx","motion","d","el","j","masterPath","geo","path","c","k","point","AnimatePresence","index","xColorCoord","checkIfNullOrUndefined","yColorCoord","color","event","isEqual","X","numberFormattingFunction","P","Tooltip","Modal","string2HTML","BiVariateChoroplethMap","graphTitle","Colors","sources","graphDescription","footNote","padding","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","interval","markObj","getSliderMarks","cn","GraphHeader","Pause","Play","SliderUI","nextValue","format","getJenks","Spinner","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA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A;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"BiVariateChoroplethMap.js","sources":["../src/Components/Graphs/Maps/BiVariateMap/Graph.tsx","../src/Components/Graphs/Maps/BiVariateMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\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 } from 'd3-scale';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\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 data: BivariateMapDataType[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n\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 showColorScale: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\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 xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\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 [showLegend, setShowLegend] = useState(!(width < 680));\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\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 zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\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\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\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\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\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 <motion.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 </motion.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 xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\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 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 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 >\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 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 d={masterPath}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\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 className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\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\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={{ backgroundColor: 'rgba(240,240,240, 0.7)', width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\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 border text-primary-gray-700 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 border text-primary-gray-700 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 {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 {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 </>\r\n );\r\n}\r\n","import { useEffect, useRef, useState } 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\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects. */\r\n data: BivariateMapDataType[];\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. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\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 /** 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 /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\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 BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\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 xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\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 onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\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\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(data, 'date', true).map(d =>\r\n parse(`${d}`, timeline.dateFormat || 'yyyy', new Date()).getTime(),\r\n ),\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].contentRect.width || 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 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\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\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 bi-variate choropleth map where geographic areas are colored in proportion to two variables.${\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 xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\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={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\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 showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\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 dimmedOpacity={dimmedOpacity}\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","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","showLegend","setShowLegend","useState","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","mapG","zoomRef","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","xRange","_","i","yRange","xScale","scaleThreshold","yScale","handleZoom","direction","jsxs","Fragment","jsx","motion","d","el","j","masterPath","geo","path","c","k","point","AnimatePresence","index","xColorCoord","checkIfNullOrUndefined","yColorCoord","color","event","isEqual","X","numberFormattingFunction","P","Tooltip","Modal","string2HTML","BiVariateChoroplethMap","graphTitle","Colors","sources","graphDescription","footNote","padding","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","interval","markObj","getSliderMarks","cn","GraphHeader","Pause","Play","SliderUI","nextValue","format","getJenks","Spinner","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,m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AAA,EAAAA,IAAC4E,IAAA,EAAQ,cAAW,gBAAA,CAAgB;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACtC;AAAA,gBAAA;AAAA,gBAGHhD,KAAWE,IACV9B,gBAAAA,EAAAA;AAAAA,kBAAC6E;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAU7I,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAA2F;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAAhH;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"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),j=require("react"),Me=require("./index-DYH8g9WA.cjs"),ke=require("./index-DQA8q5sC.cjs"),Ce=require("./Modal-tXZlLE5s.cjs"),Re=require("./index-CSNtgibC.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),Ee=require("./Tooltip-De16GWhY.cjs"),o=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Oe=require("./string2HTML-z7CwHXcx.cjs"),Fe=require("./XTicksAndGridLines-CCzXIV8d.cjs"),He=require("./YAxesLabels-D8IydyZj.cjs"),Ie=require("./AxisTitle-CK9YeovX.cjs"),Ve=require("./Axis-DE7dSn1_.cjs"),ze=require("./ReferenceLine-CFVBBN__.cjs"),Te=require("./linear-BVckp9RD.cjs"),qe=require("./band-CAApY4Pd.cjs"),Ae=require("./use-in-view-sQJZ_xDO.cjs"),_=require("./proxy-BHRoeZgd.cjs"),Le=require("./index-BW8iNx7E.cjs"),$e=require("./GraphFooter.cjs"),Se=require("./GraphHeader.cjs"),ve=require("./Colors.cjs"),De=require("./EmptyState-d8_8SxeW.cjs"),Be=require("./ColorLegend.cjs"),Pe=require("./XAxesLabels-OjBNl_lS.cjs"),Ge=require("./YTicksAndGridLines-DBDuz6vb.cjs");function We(we){const{data:s,barColor:b,suffix:J,prefix:K,barPadding:Q,showValues:re,showTicks:Z,leftMargin:ye,truncateBy:de,width:ee,height:te,rightMargin:be,topMargin:C,bottomMargin:ie,showLabels:u,tooltip:D,onSeriesMouseOver:V,refValues:q,highlightedDataPoints:h,maxValue:B,minValue:w,onSeriesMouseClick:U,labelOrder:ae,rtl:F,maxBarThickness:A,minBarThickness:me,resetSelectionOnDoubleClick:L,detailsOnClick:z,barAxisTitle:ne,valueColor:le,noOfTicks:E,styles:g,classNames:M,targetStyle:se,targetColor:H,qualitativeRangeColors:P,measureBarWidthFactor:c,animate:l,dimmedOpacity:O,precision:G,customLayers:$,naLabel:T}=we,f=j.useRef(null),d=Ae.useInView(f,{once:l.once,amount:l.amount}),[oe,W]=j.useState(void 0),[N,X]=j.useState(void 0),[ue,k]=j.useState(void 0),[p,y]=j.useState(void 0),x={top:ne?C+25:C,bottom:ie,left:ye,right:be},S=ee-x.left-x.right,I=te-x.top-x.bottom,ce=Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size))<0?0:Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size)),Y=Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target))<0?0:Math.max(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target)),xe=Math.max(...s.map(e=>Re.sum((e.qualitativeRange||[]).filter(r=>!o.checkIfNullOrUndefined(r)))||0)),ge=o.checkIfNullOrUndefined(B)?Math.max(...[ce,Y,xe].filter(Number.isFinite))<0?0:Math.max(...[ce,Y,xe].filter(Number.isFinite)):B,he=Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size))>=0?0:Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.size)).map(e=>e.size)),R=Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target))>=0?0:Math.min(...s.filter(e=>!o.checkIfNullOrUndefined(e.target)).map(e=>e.target)),a=o.checkIfNullOrUndefined(w)?Math.min(...[he,R].filter(Number.isFinite))>=0?0:Math.min(...[he,R].filter(Number.isFinite)):w,fe=s.map((e,r)=>({...e,id:ae?`${e.label}`:`${r}`})),n=Te.linear().domain([a,ge]).range([0,S]).nice(),v=ae||fe.map(e=>`${e.id}`),m=qe.band().domain(v).range([0,me?Math.max(I,me*v.length):A?Math.min(I,A*v.length):I]).paddingInner(Q),t=n.ticks(E);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(_.motion.svg,{width:`${ee}px`,height:`${te}px`,viewBox:`0 0 ${ee} ${te}`,direction:"ltr",ref:f,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${x.left},${x.top})`,children:[Z?i.jsxRuntimeExports.jsx(Fe.XTicksAndGridLines,{values:t.filter(e=>e!==0),x:t.filter(e=>e!==0).map(e=>n(e)),y1:0-C,y2:I+x.bottom,styles:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},classNames:{gridLines:M?.xAxis?.gridLines,labels:M?.xAxis?.labels},suffix:J,prefix:K,labelType:"secondary",showGridLines:!0,precision:G}):null,i.jsxRuntimeExports.jsx(Ie.AxisTitle,{x:S/2,y:0-x.top+15,style:g?.xAxis?.title,className:M?.xAxis?.title,text:ne}),i.jsxRuntimeExports.jsx(Ve.Axis,{x1:n(a<0?0:a),x2:n(a<0?0:a),y1:-2.5,y2:I+x.bottom,classNames:{axis:M?.yAxis?.axis},styles:{axis:g?.yAxis?.axis}}),$.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(Le.AnimatePresence,{children:[fe.map(e=>o.checkIfNullOrUndefined(m(e.id))?null:i.jsxRuntimeExports.jsxs(_.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:r=>{W(e),y(r.clientY),k(r.clientX),V?.(e)},onClick:()=>{(U||z)&&(ke.isEqual(N,e)&&L?(X(void 0),U?.(void 0)):(X(e),U?.(e)))},onMouseMove:r=>{W(e),y(r.clientY),k(r.clientX)},onMouseLeave:()=>{W(void 0),k(void 0),y(void 0),V?.(void 0)},exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x:0,y:m(`${e.id}`),opacity:h.length!==0?h.indexOf(e.label)!==-1?.85:O:.85},whileInView:{x:0,y:m(`${e.id}`),opacity:h.length!==0?h.indexOf(e.label)!==-1?.85:O:.85,transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial",children:[e.qualitativeRange?e.qualitativeRange.map((r,pe)=>i.jsxRuntimeExports.jsx(_.motion.rect,{exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0,fill:P[pe]},whileInView:{x:n(pe===0?0:Re.sum(e.qualitativeRange.filter((je,Ue)=>Ue<pe&&je))),width:n(r),fill:P[pe],transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial",y:0,height:m.bandwidth()},pe)):null,e.target&&se==="background"?i.jsxRuntimeExports.jsx(_.motion.rect,{y:0,x:e.target>=0?n(0):n(e.target),height:m.bandwidth(),style:{fill:H},exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0},whileInView:{x:e.target>=0?n(0):n(e.target),width:e.target>=0?n(e.target)-n(0):n(0)-n(e.target),transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial"}):null,e.size?i.jsxRuntimeExports.jsx(_.motion.rect,{y:m.bandwidth()*((1-c)/2),style:{fill:b},height:m.bandwidth()*c,exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0},whileInView:{x:e.size>=0?n(0):n(e.size),width:e.size>=0?n(e.size)-n(0):n(0)-n(e.size),transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial"}):null,e.target&&se==="line"?i.jsxRuntimeExports.jsx(_.motion.rect,{y:0,height:m.bandwidth(),style:{fill:H},width:2,exit:{opacity:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),opacity:0},whileInView:{x:n(e.target)-1,opacity:1,transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial"}):null,u?i.jsxRuntimeExports.jsx(He.YAxesLabels,{value:`${e.label}`.length<de?`${e.label}`:`${`${e.label}`.substring(0,de)}...`,y:0,x:(e.size||0)<0?n(0):0-x.left,width:(e.size||0)<0?ee-n(0):n(0)+x.left,height:m.bandwidth(),alignment:e.size&&e.size<0?"left":"right",style:g?.yAxis?.labels,className:M?.yAxis?.labels,animate:l,isInView:d}):null,re?i.jsxRuntimeExports.jsx(_.motion.text,{y:m.bandwidth()/2,style:{...le?{fill:le}:{fill:b},textAnchor:e.size&&e.size<0?"end":"start",...g?.graphObjectValues||{}},className:i.mo("graph-value text-sm",!le&&b.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",M?.graphObjectValues),dx:e.size&&e.size<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x:n(0),opacity:0},whileInView:{x:e.size?n(e.size):n(0),opacity:1,transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial",children:Ne.numberFormattingFunction(e.size,T,G,K,J)}):null]},e.label)),q?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:q.map((e,r)=>i.jsxRuntimeExports.jsx(ze.RefLineX,{text:e.text,color:e.color,x:n(e.value),y1:0-x.top,y2:I+x.bottom,textSide:n(e.value)>S*.75||F?"left":"right",classNames:e.classNames,styles:e.styles,animate:l,isInView:d},r))}):null]}),$.filter(e=>e.position==="after").map(e=>e.layer)]})}),oe&&D&&ue&&p?i.jsxRuntimeExports.jsx(Ee.Tooltip,{data:oe,body:D,xPos:ue,yPos:p,backgroundStyle:g?.tooltip,className:M?.tooltip}):null,z&&N!==void 0?i.jsxRuntimeExports.jsx(Ce.X,{open:N!==void 0,onClose:()=>{X(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof z=="string"?{__html:Oe.string2HTML(z,N)}:void 0,children:typeof z=="function"?z(N):null})}):null]})}function Xe(we){const{data:s,graphTitle:b,barColor:J=ve.Colors.primaryColors["blue-600"],suffix:K="",sources:Q,prefix:re="",graphDescription:Z,barPadding:ye=.25,showValues:de=!0,showTicks:ee=!0,leftMargin:te=100,rightMargin:be=40,truncateBy:C=999,height:ie,width:u,footNote:D,colorDomain:V,colorLegendTitle:q,highlightedDataPoints:h=[],padding:B,backgroundColor:w=!1,topMargin:U=25,bottomMargin:ae=10,showLabels:F=!0,relativeHeight:A,tooltip:me,onSeriesMouseOver:L,refValues:z,showColorScale:ne=!0,graphID:le,maxValue:E,minValue:g,onSeriesMouseClick:M,graphDownload:se=!1,dataDownload:H=!1,sortData:P,labelOrder:c,language:l="en",minHeight:O=0,theme:G="light",maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:d,resetSelectionOnDoubleClick:oe=!0,detailsOnClick:W,barAxisTitle:N,noOfTicks:X=5,valueColor:ue,styles:k,classNames:p,filterNA:y=!0,targetStyle:x="line",targetColor:S=ve.Colors.light.grays["gray-700"],qualitativeRangeColors:I,measureBarWidthFactor:ce=.4,animate:Y=!1,dimmedOpacity:xe=.3,precision:ge=2,customLayers:he=[],naLabel:R="NA"}=we,[a,fe]=j.useState(0),[n,v]=j.useState(0),m=j.useRef(null),t=j.useRef(null);return j.useEffect(()=>{const e=new ResizeObserver(r=>{fe(u||r[0].target.clientWidth||620),v(ie||r[0].target.clientHeight||480)});return m.current&&(v(m.current.clientHeight||480),fe(m.current.clientWidth||620),u||e.observe(m.current)),()=>e.disconnect()},[u,ie]),i.jsxRuntimeExports.jsx("div",{className:`${G||"light"} flex ${u?"w-fit grow-0":"w-full grow"}`,dir:l==="he"||l==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${w?w===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${l||"en"}`,u?"w-fit":"w-full",p?.graphContainer),style:{...k?.graphContainer||{},...w&&w!==!0?{backgroundColor:w}:{}},id:le,ref:t,"aria-label":d||`${b?`The graph shows ${b}. `:""}This is a bar chart. ${Z?` ${Z}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:w?B||"1rem":B||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[b||Z||se||H?i.jsxRuntimeExports.jsx(Se.GraphHeader,{styles:{title:k?.title,description:k?.description},classNames:{title:p?.title,description:p?.description},graphTitle:b,graphDescription:Z,width:u,graphDownload:se?t.current:void 0,dataDownload:H?s.map(e=>e.data).filter(e=>e!==void 0).length>0?s.map(e=>e.data).filter(e=>e!==void 0):s.filter(e=>e!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(De.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[ne&&s.filter(e=>e.qualitativeRange).length!==0&&V?i.jsxRuntimeExports.jsx(Be.ColorLegend,{width:u,colorLegendTitle:q,colors:I||ve.Colors[G].sequentialColors.positiveColorsx10,colorDomain:V,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:m,"aria-label":"Graph area",children:(u||a)&&(ie||n)?i.jsxRuntimeExports.jsx(We,{data:P==="asc"?Me.sortBy(s.filter(e=>y?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).filter((e,r)=>T?r<T:!0):P==="desc"?Me.sortBy(s.filter(e=>y?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).reverse().filter((e,r)=>T?r<T:!0):s.filter(e=>y?!o.checkIfNullOrUndefined(e.size):e).filter((e,r)=>T?r<T:!0),barColor:J,targetColor:S,width:u||a,height:Math.max(O,ie||(A?O?(u||a)*A>O?(u||a)*A:O:(u||a)*A:n)),suffix:K,prefix:re,barPadding:ye,showValues:de,showTicks:ee,leftMargin:te,rightMargin:be,topMargin:U,bottomMargin:ae,truncateBy:C,showLabels:F,tooltip:me,onSeriesMouseOver:L,refValues:z,maxValue:E,minValue:g,highlightedDataPoints:h,onSeriesMouseClick:M,labelOrder:c,rtl:l==="he"||l==="ar",maxBarThickness:$,minBarThickness:f,resetSelectionOnDoubleClick:oe,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,classNames:p,styles:k,targetStyle:x,qualitativeRangeColors:I||ve.Colors[G].sequentialColors.positiveColorsx10,measureBarWidthFactor:ce,animate:Y===!0?{duration:.5,once:!0,amount:.5}:Y||{duration:0,once:!0,amount:0},dimmedOpacity:xe,precision:ge,customLayers:he,naLabel:R}):null})]})}),Q||D?i.jsxRuntimeExports.jsx($e.GraphFooter,{sources:Q,footNote:D,width:u,styles:{footnote:k?.footnote,source:k?.source},classNames:{footnote:p?.footnote,source:p?.source}}):null]})})})})}function Ye(we){const{data:s,width:b,height:J,barColor:K,suffix:Q,prefix:re,barPadding:Z,showLabels:ye,showValues:de,showTicks:ee,truncateBy:te,rightMargin:be,topMargin:C,bottomMargin:ie,leftMargin:u,tooltip:D,onSeriesMouseOver:V,refValues:q,maxValue:h,minValue:B,highlightedDataPoints:w,onSeriesMouseClick:U,labelOrder:ae,maxBarThickness:F,minBarThickness:A,resetSelectionOnDoubleClick:me,detailsOnClick:L,barAxisTitle:z,valueColor:ne,noOfTicks:le,styles:E,classNames:g,targetStyle:M,targetColor:se,qualitativeRangeColors:H,measureBarWidthFactor:P,animate:c,dimmedOpacity:l,precision:O,customLayers:G,naLabel:$}=we,T=j.useRef(null),f=Ae.useInView(T,{once:c.once,amount:c.amount}),d={top:C,bottom:ie,left:z?u+30:u,right:be},[oe,W]=j.useState(void 0),[N,X]=j.useState(void 0),[ue,k]=j.useState(void 0),[p,y]=j.useState(void 0),x=b-d.left-d.right,S=J-d.top-d.bottom,I=Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size))<0?0:Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size)),ce=Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.target)).map(t=>t.target))<0?0:Math.max(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.target)),Y=Math.max(...s.map(t=>Re.sum((t.qualitativeRange||[]).filter(e=>!o.checkIfNullOrUndefined(e)))||0)),xe=o.checkIfNullOrUndefined(h)?Math.max(...[I,ce,Y].filter(Number.isFinite))<0?0:Math.max(...[I,ce,Y].filter(Number.isFinite)):h,ge=Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size))>=0?0:Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.size)).map(t=>t.size)),he=Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.target)).map(t=>t.target))>=0?0:Math.min(...s.filter(t=>!o.checkIfNullOrUndefined(t.target)).map(t=>t.target)),R=o.checkIfNullOrUndefined(B)?Math.min(...[ge,he].filter(Number.isFinite))>=0?0:Math.min(...[ge,he].filter(Number.isFinite)):B,a=Te.linear().domain([R,xe]).range([S,0]).nice(),fe=s.map((t,e)=>({...t,id:ae?`${t.label}`:`${e}`})),n=ae||fe.map(t=>`${t.id}`),v=qe.band().domain(n).range([0,A?Math.max(x,A*n.length):F?Math.min(x,F*n.length):x]).paddingInner(Z),m=a.ticks(le);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(_.motion.svg,{width:`${b}px`,height:`${J}px`,viewBox:`0 0 ${b} ${J}`,direction:"ltr",ref:T,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[i.jsxRuntimeExports.jsx(Ve.Axis,{y1:a(R<0?0:R),y2:a(R<0?0:R),x1:0-u,x2:x+d.right,label:Ne.numberFormattingFunction(R<0?0:R,$,O,re,Q),labelPos:{x:0-u,dx:0,dy:xe<0?"1em":-5,y:a(R<0?0:R)},classNames:{axis:g?.xAxis?.axis,label:g?.yAxis?.labels},styles:{axis:E?.xAxis?.axis,label:E?.yAxis?.labels}}),ee?i.jsxRuntimeExports.jsx(Ge.YTicksAndGridLines,{values:m.filter(t=>t!==0),y:m.filter(t=>t!==0).map(t=>a(t)),x1:0-u,x2:x+d.right,styles:{gridLines:E?.yAxis?.gridLines,labels:E?.yAxis?.labels},classNames:{gridLines:g?.yAxis?.gridLines,labels:g?.yAxis?.labels},suffix:Q,prefix:re,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:O}):null,i.jsxRuntimeExports.jsx(Ie.AxisTitle,{x:0-u-15,y:S/2,style:E?.yAxis?.title,className:g?.yAxis?.title,text:z,rotate90:!0}),G.filter(t=>t.position==="before").map(t=>t.layer),i.jsxRuntimeExports.jsxs(Le.AnimatePresence,{children:[fe.map(t=>o.checkIfNullOrUndefined(v(t.id))?null:i.jsxRuntimeExports.jsxs(_.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:e=>{W(t),y(e.clientY),k(e.clientX),V?.(t)},onClick:()=>{(U||L)&&(ke.isEqual(N,t)&&me?(X(void 0),U?.(void 0)):(X(t),U?.(t)))},onMouseMove:e=>{W(t),y(e.clientY),k(e.clientX)},onMouseLeave:()=>{W(void 0),k(void 0),y(void 0),V?.(void 0)},exit:{opacity:0,transition:{duration:c.duration}},variants:{initial:{x:v(`${t.id}`),y:0,opacity:w.length!==0?w.indexOf(t.label)!==-1?.85:l:.85},whileInView:{x:v(`${t.id}`),y:0,opacity:w.length!==0?w.indexOf(t.label)!==-1?.85:l:.85,transition:{duration:c.duration}}},initial:"initial",animate:f?"whileInView":"initial",children:[t.qualitativeRange?t.qualitativeRange.map((e,r)=>i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,exit:{height:0,y:a(0),transition:{duration:c.duration}},variants:{initial:{height:0,y:a(0),fill:H[r]},whileInView:{height:Math.abs(a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<=r&&pe)))-a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<r&&pe)))),y:a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<=r&&pe))),fill:H[r],transition:{duration:c.duration}}},initial:"initial",animate:f?"whileInView":"initial",width:v.bandwidth()},r)):null,t.target&&M==="background"?i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,width:v.bandwidth(),style:{fill:se},exit:{height:0,y:a(0),transition:{duration:c.duration}},variants:{initial:{height:0,y:a(0)},whileInView:{height:Math.abs(a(t.target)-a(0)),y:t.target>0?a(t.target):a(0),transition:{duration:c.duration}}},initial:"initial",animate:f?"whileInView":"initial"}):null,t.size?i.jsxRuntimeExports.jsx(_.motion.rect,{x:v.bandwidth()*((1-P)/2),width:v.bandwidth()*P,style:{fill:K},exit:{height:0,y:a(0),transition:{duration:c.duration}},variants:{initial:{height:0,y:a(0)},whileInView:{height:Math.abs(a(t.size)-a(0)),y:t.size>0?a(t.size):a(0),transition:{duration:c.duration}}},initial:"initial",animate:f?"whileInView":"initial"}):null,t.target&&M==="line"?i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,width:v.bandwidth(),style:{fill:se},exit:{y:a(0),opacity:0,transition:{duration:c.duration}},variants:{initial:{y:a(0),opacity:0},whileInView:{y:a(t.target)-1,opacity:1,transition:{duration:c.duration}}},initial:"initial",animate:f?"whileInView":"initial",height:2}):null,ye?i.jsxRuntimeExports.jsx(Pe.XAxesLabels,{value:`${t.label}`.length<te?`${t.label}`:`${`${t.label}`.substring(0,te)}...`,y:(t.size||0)<0?0:a(0)+5,x:0,width:v.bandwidth(),height:(t.size||0)<0?a(0)-5:d.bottom,style:E?.xAxis?.labels,className:g?.xAxis?.labels,alignment:(t.size||0)<0?"bottom":"top",animate:c,isInView:f}):null,de?i.jsxRuntimeExports.jsx(_.motion.text,{x:v.bandwidth()/2,style:{...ne?{fill:ne}:{fill:K},textAnchor:"middle",...E?.graphObjectValues||{}},className:i.mo("graph-value text-sm",!ne&&K.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",g?.graphObjectValues),dy:t.size?t.size>=0?"-5px":"1em":"-5px",exit:{opacity:0,transition:{duration:c.duration}},variants:{initial:{y:a(0),opacity:0},whileInView:{y:a(t.size||0),opacity:1,transition:{duration:c.duration}}},initial:"initial",animate:f?"whileInView":"initial",children:Ne.numberFormattingFunction(t.size,$,O,re,Q)}):null]},t.label)),q?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:q.map((t,e)=>i.jsxRuntimeExports.jsx(ze.RefLineY,{text:t.text,color:t.color,y:a(t.value),x1:0-u,x2:x+d.right,classNames:t.classNames,styles:t.styles,animate:c,isInView:f},e))}):null]}),G.filter(t=>t.position==="after").map(t=>t.layer)]})}),oe&&D&&ue&&p?i.jsxRuntimeExports.jsx(Ee.Tooltip,{data:oe,body:D,xPos:ue,yPos:p,backgroundStyle:E?.tooltip,className:g?.tooltip}):null,L&&N!==void 0?i.jsxRuntimeExports.jsx(Ce.X,{open:N!==void 0,onClose:()=>{X(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof L=="string"?{__html:Oe.string2HTML(L,N)}:void 0,children:typeof L=="function"?L(N):null})}):null]})}function _e(we){const{data:s,graphTitle:b,barColor:J=ve.Colors.primaryColors["blue-600"],barPadding:K=.25,showTicks:Q=!0,leftMargin:re=20,rightMargin:Z=20,topMargin:ye=20,bottomMargin:de=25,truncateBy:ee=999,showLabels:te=!0,showValues:be=!0,backgroundColor:C=!1,suffix:ie="",prefix:u="",sources:D,graphDescription:V,height:q,width:h,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z=!0,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g=[],qualitativeRangeColors:M,onSeriesMouseClick:se,graphDownload:H=!1,dataDownload:P=!1,language:c="en",theme:l="light",sortData:O,labelOrder:G,minHeight:$=0,maxBarThickness:T,maxNumberOfBars:f,minBarThickness:d,ariaLabel:oe,resetSelectionOnDoubleClick:W=!0,detailsOnClick:N,barAxisTitle:X,noOfTicks:ue=5,valueColor:k,styles:p,classNames:y,targetColor:x=ve.Colors.light.grays["gray-700"],filterNA:S=!0,targetStyle:I="line",measureBarWidthFactor:ce=.4,animate:Y=!1,dimmedOpacity:xe=.3,precision:ge=2,customLayers:he=[],naLabel:R="NA"}=we,[a,fe]=j.useState(0),[n,v]=j.useState(0),m=j.useRef(null),t=j.useRef(null);return j.useEffect(()=>{const e=new ResizeObserver(r=>{fe(h||r[0].target.clientWidth||620),v(q||r[0].target.clientHeight||480)});return m.current&&(v(m.current.clientHeight||480),fe(m.current.clientWidth||620),h||e.observe(m.current)),()=>e.disconnect()},[h,q]),i.jsxRuntimeExports.jsx("div",{className:`${l||"light"} flex ${h?"w-fit grow-0":"w-full grow"}`,dir:c==="he"||c==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${c||"en"}`,h?"w-fit":"w-full",y?.graphContainer),style:{...p?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:ne,ref:t,"aria-label":oe||`${b?`The graph shows ${b}. `:""}This is a grouped bar chart. ${V?` ${V}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?ae||"1rem":ae||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[b||V||H||P?i.jsxRuntimeExports.jsx(Se.GraphHeader,{styles:{title:p?.title,description:p?.description},classNames:{title:y?.title,description:y?.description},graphTitle:b,graphDescription:V,width:h,graphDownload:H?t.current:void 0,dataDownload:P?s.map(e=>e.data).filter(e=>e!==void 0).length>0?s.map(e=>e.data).filter(e=>e!==void 0):s.filter(e=>e!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(De.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[z&&s.filter(e=>e.qualitativeRange).length!==0&&w?i.jsxRuntimeExports.jsx(Be.ColorLegend,{width:h,colorLegendTitle:U,colors:M||ve.Colors[l].sequentialColors.positiveColorsx10,colorDomain:w,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:m,"aria-label":"Graph area",children:(h||a)&&(q||n)?i.jsxRuntimeExports.jsx(Ye,{data:O==="asc"?Me.sortBy(s.filter(e=>S?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).filter((e,r)=>f?r<f:!0):O==="desc"?Me.sortBy(s.filter(e=>S?!o.checkIfNullOrUndefined(e.size):e),e=>e.size).reverse().filter((e,r)=>f?r<f:!0):s.filter(e=>S?!o.checkIfNullOrUndefined(e.size):e).filter((e,r)=>f?r<f:!0),barColor:J,targetColor:x,width:h||a,refValues:L,height:Math.max($,q||(F?$?(h||a)*F>$?(h||a)*F:$:(h||a)*F:n)),suffix:ie,prefix:u,barPadding:K,showLabels:te,showValues:be,showTicks:Q,truncateBy:ee,leftMargin:re,rightMargin:Z,qualitativeRangeColors:M||ve.Colors[l].sequentialColors.positiveColorsx10,topMargin:ye,bottomMargin:de,tooltip:A,onSeriesMouseOver:me,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:se,labelOrder:G,maxBarThickness:T,minBarThickness:d,resetSelectionOnDoubleClick:W,detailsOnClick:N,barAxisTitle:X,noOfTicks:ue,valueColor:k,styles:p,classNames:y,targetStyle:I,dimmedOpacity:xe,measureBarWidthFactor:ce,animate:Y===!0?{duration:.5,once:!0,amount:.5}:Y||{duration:0,once:!0,amount:0},precision:ge,customLayers:he,naLabel:R}):null})]})}),D||B?i.jsxRuntimeExports.jsx($e.GraphFooter,{styles:{footnote:p?.footnote,source:p?.source},classNames:{footnote:y?.footnote,source:y?.source},sources:D,footNote:B,width:h}):null]})})})})}function Je(we){const{data:s,graphTitle:b,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:C,suffix:ie,prefix:u,sources:D,graphDescription:V,height:q,width:h,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:H,language:P,theme:c,sortData:l,labelOrder:O,minHeight:G,maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:d,resetSelectionOnDoubleClick:oe,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,orientation:k="vertical",styles:p,classNames:y,filterNA:x,targetStyle:S,targetColor:I,qualitativeRangeColors:ce,measureBarWidthFactor:Y,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R}=we;return k==="vertical"?i.jsxRuntimeExports.jsx(_e,{data:s,graphTitle:b,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:C,suffix:ie,prefix:u,sources:D,graphDescription:V,height:q,width:h,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:H,language:P,theme:c,sortData:l,labelOrder:O,minHeight:G,maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:d,resetSelectionOnDoubleClick:oe,styles:p,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,classNames:y,filterNA:x,targetStyle:S,targetColor:I,measureBarWidthFactor:Y,qualitativeRangeColors:ce,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R}):i.jsxRuntimeExports.jsx(Xe,{data:s,graphTitle:b,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:C,suffix:ie,prefix:u,sources:D,graphDescription:V,height:q,width:h,footNote:B,colorDomain:w,colorLegendTitle:U,padding:ae,relativeHeight:F,tooltip:A,onSeriesMouseOver:me,refValues:L,showColorScale:z,graphID:ne,maxValue:le,minValue:E,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:H,language:P,theme:c,sortData:l,labelOrder:O,minHeight:G,maxBarThickness:$,maxNumberOfBars:T,minBarThickness:f,ariaLabel:d,resetSelectionOnDoubleClick:oe,styles:p,detailsOnClick:W,barAxisTitle:N,noOfTicks:X,valueColor:ue,classNames:y,filterNA:x,targetStyle:S,targetColor:I,measureBarWidthFactor:Y,qualitativeRangeColors:ce,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R})}exports.BulletChart=Je;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),j=require("react"),Ne=require("./index-CQ3e6Ewi.cjs"),ke=require("./index-DQA8q5sC.cjs"),Ce=require("./Modal-tXZlLE5s.cjs"),Re=require("./index-CSNtgibC.cjs"),Me=require("./numberFormattingFunction-02t-wJta.cjs"),Ee=require("./Tooltip-De16GWhY.cjs"),c=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Oe=require("./string2HTML-z7CwHXcx.cjs"),Ue=require("./XTicksAndGridLines-CCzXIV8d.cjs"),He=require("./YAxesLabels-D8IydyZj.cjs"),Ie=require("./AxisTitle-CK9YeovX.cjs"),Ve=require("./Axis-DE7dSn1_.cjs"),ze=require("./ReferenceLine-CFVBBN__.cjs"),Te=require("./linear-BVckp9RD.cjs"),qe=require("./band-CAApY4Pd.cjs"),Ae=require("./use-in-view-sQJZ_xDO.cjs"),_=require("./proxy-BHRoeZgd.cjs"),Le=require("./index-BW8iNx7E.cjs"),$e=require("./GraphFooter.cjs"),Se=require("./GraphHeader.cjs"),ve=require("./Colors.cjs"),De=require("./EmptyState-d8_8SxeW.cjs"),Be=require("./ColorLegend.cjs"),Pe=require("./XAxesLabels-OjBNl_lS.cjs"),Ge=require("./YTicksAndGridLines-DBDuz6vb.cjs");function We(we){const{data:s,barColor:y,suffix:J,prefix:K,barPadding:Q,showValues:re,showTicks:Z,leftMargin:ye,truncateBy:de,width:ee,height:te,rightMargin:be,topMargin:E,bottomMargin:ie,showLabels:o,tooltip:S,onSeriesMouseOver:V,refValues:T,highlightedDataPoints:h,maxValue:D,minValue:b,onSeriesMouseClick:B,labelOrder:ae,rtl:F,maxBarThickness:q,minBarThickness:me,resetSelectionOnDoubleClick:A,detailsOnClick:z,barAxisTitle:ne,valueColor:le,noOfTicks:O,styles:g,classNames:M,targetStyle:se,targetColor:U,qualitativeRangeColors:L,measureBarWidthFactor:u,animate:l,dimmedOpacity:N,precision:H,customLayers:$,naLabel:P}=we,p=j.useRef(null),d=Ae.useInView(p,{once:l.once,amount:l.amount}),[oe,G]=j.useState(void 0),[k,W]=j.useState(void 0),[ue,C]=j.useState(void 0),[f,w]=j.useState(void 0),x={top:ne?E+25:E,bottom:ie,left:ye,right:be},X=ee-x.left-x.right,I=te-x.top-x.bottom,ce=Math.max(...s.filter(e=>!c.checkIfNullOrUndefined(e.size)).map(e=>e.size))<0?0:Math.max(...s.filter(e=>!c.checkIfNullOrUndefined(e.size)).map(e=>e.size)),Y=Math.max(...s.filter(e=>!c.checkIfNullOrUndefined(e.target)).map(e=>e.target))<0?0:Math.max(...s.filter(e=>!c.checkIfNullOrUndefined(e.target)).map(e=>e.target)),xe=Math.max(...s.map(e=>Re.sum((e.qualitativeRange||[]).filter(r=>!c.checkIfNullOrUndefined(r)))||0)),ge=c.checkIfNullOrUndefined(D)?Math.max(...[ce,Y,xe].filter(Number.isFinite))<0?0:Math.max(...[ce,Y,xe].filter(Number.isFinite)):D,he=Math.min(...s.filter(e=>!c.checkIfNullOrUndefined(e.size)).map(e=>e.size))>=0?0:Math.min(...s.filter(e=>!c.checkIfNullOrUndefined(e.size)).map(e=>e.size)),R=Math.min(...s.filter(e=>!c.checkIfNullOrUndefined(e.target)).map(e=>e.target))>=0?0:Math.min(...s.filter(e=>!c.checkIfNullOrUndefined(e.target)).map(e=>e.target)),a=c.checkIfNullOrUndefined(b)?Math.min(...[he,R].filter(Number.isFinite))>=0?0:Math.min(...[he,R].filter(Number.isFinite)):b,fe=s.map((e,r)=>({...e,id:ae?`${e.label}`:`${r}`})),n=Te.linear().domain([a,ge]).range([0,X]).nice(),v=ae||fe.map(e=>`${e.id}`),m=qe.band().domain(v).range([0,me?Math.max(I,me*v.length):q?Math.min(I,q*v.length):I]).paddingInner(Q),t=n.ticks(O);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(_.motion.svg,{width:`${ee}px`,height:`${te}px`,viewBox:`0 0 ${ee} ${te}`,direction:"ltr",ref:p,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${x.left},${x.top})`,children:[Z?i.jsxRuntimeExports.jsx(Ue.XTicksAndGridLines,{values:t.filter(e=>e!==0),x:t.filter(e=>e!==0).map(e=>n(e)),y1:0-E,y2:I+x.bottom,styles:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},classNames:{gridLines:M?.xAxis?.gridLines,labels:M?.xAxis?.labels},suffix:J,prefix:K,labelType:"secondary",showGridLines:!0,precision:H}):null,i.jsxRuntimeExports.jsx(Ie.AxisTitle,{x:X/2,y:0-x.top+15,style:g?.xAxis?.title,className:M?.xAxis?.title,text:ne}),i.jsxRuntimeExports.jsx(Ve.Axis,{x1:n(a<0?0:a),x2:n(a<0?0:a),y1:-2.5,y2:I+x.bottom,classNames:{axis:M?.yAxis?.axis},styles:{axis:g?.yAxis?.axis}}),$.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(Le.AnimatePresence,{children:[fe.map(e=>c.checkIfNullOrUndefined(m(e.id))?null:i.jsxRuntimeExports.jsxs(_.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:r=>{G(e),w(r.clientY),C(r.clientX),V?.(e)},onClick:()=>{(B||z)&&(ke.isEqual(k,e)&&A?(W(void 0),B?.(void 0)):(W(e),B?.(e)))},onMouseMove:r=>{G(e),w(r.clientY),C(r.clientX)},onMouseLeave:()=>{G(void 0),C(void 0),w(void 0),V?.(void 0)},exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x:0,y:m(`${e.id}`),opacity:h.length!==0?h.indexOf(e.label)!==-1?.85:N:.85},whileInView:{x:0,y:m(`${e.id}`),opacity:h.length!==0?h.indexOf(e.label)!==-1?.85:N:.85,transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial",children:[e.qualitativeRange?e.qualitativeRange.map((r,pe)=>i.jsxRuntimeExports.jsx(_.motion.rect,{exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0,fill:L[pe]},whileInView:{x:n(pe===0?0:Re.sum(e.qualitativeRange.filter((je,Fe)=>Fe<pe&&je))),width:n(r),fill:L[pe],transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial",y:0,height:m.bandwidth()},pe)):null,e.target&&se==="background"?i.jsxRuntimeExports.jsx(_.motion.rect,{y:0,x:e.target>=0?n(0):n(e.target),height:m.bandwidth(),style:{fill:U},exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0},whileInView:{x:e.target>=0?n(0):n(e.target),width:e.target>=0?n(e.target)-n(0):n(0)-n(e.target),transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial"}):null,e.size?i.jsxRuntimeExports.jsx(_.motion.rect,{y:m.bandwidth()*((1-u)/2),style:{fill:y},height:m.bandwidth()*u,exit:{width:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),width:0},whileInView:{x:e.size>=0?n(0):n(e.size),width:e.size>=0?n(e.size)-n(0):n(0)-n(e.size),transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial"}):null,e.target&&se==="line"?i.jsxRuntimeExports.jsx(_.motion.rect,{y:0,height:m.bandwidth(),style:{fill:U},width:2,exit:{opacity:0,x:n(0),transition:{duration:l.duration}},variants:{initial:{x:n(0),opacity:0},whileInView:{x:n(e.target)-1,opacity:1,transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial"}):null,o?i.jsxRuntimeExports.jsx(He.YAxesLabels,{value:`${e.label}`.length<de?`${e.label}`:`${`${e.label}`.substring(0,de)}...`,y:0,x:(e.size||0)<0?n(0):0-x.left,width:(e.size||0)<0?ee-n(0):n(0)+x.left,height:m.bandwidth(),alignment:e.size&&e.size<0?"left":"right",style:g?.yAxis?.labels,className:M?.yAxis?.labels,animate:l,isInView:d}):null,re?i.jsxRuntimeExports.jsx(_.motion.text,{y:m.bandwidth()/2,style:{...le?{fill:le}:{fill:y},textAnchor:e.size&&e.size<0?"end":"start",...g?.graphObjectValues||{}},className:i.mo("graph-value text-sm",!le&&y.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",M?.graphObjectValues),dx:e.size&&e.size<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x:n(0),opacity:0},whileInView:{x:e.size?n(e.size):n(0),opacity:1,transition:{duration:l.duration}}},initial:"initial",animate:d?"whileInView":"initial",children:Me.numberFormattingFunction(e.size,P,H,K,J)}):null]},e.label)),T?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:T.map((e,r)=>i.jsxRuntimeExports.jsx(ze.RefLineX,{text:e.text,color:e.color,x:n(e.value),y1:0-x.top,y2:I+x.bottom,textSide:n(e.value)>X*.75||F?"left":"right",classNames:e.classNames,styles:e.styles,animate:l,isInView:d},r))}):null]}),$.filter(e=>e.position==="after").map(e=>e.layer)]})}),oe&&S&&ue&&f?i.jsxRuntimeExports.jsx(Ee.Tooltip,{data:oe,body:S,xPos:ue,yPos:f,backgroundStyle:g?.tooltip,className:M?.tooltip}):null,z&&k!==void 0?i.jsxRuntimeExports.jsx(Ce.X,{open:k!==void 0,onClose:()=>{W(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof z=="string"?{__html:Oe.string2HTML(z,k)}:void 0,children:typeof z=="function"?z(k):null})}):null]})}function Xe(we){const{data:s,graphTitle:y,barColor:J=ve.Colors.primaryColors["blue-600"],suffix:K="",sources:Q,prefix:re="",graphDescription:Z,barPadding:ye=.25,showValues:de=!0,showTicks:ee=!0,leftMargin:te=100,rightMargin:be=40,truncateBy:E=999,height:ie,width:o,footNote:S,colorDomain:V,colorLegendTitle:T,highlightedDataPoints:h=[],padding:D,backgroundColor:b=!1,topMargin:B=25,bottomMargin:ae=10,showLabels:F=!0,relativeHeight:q,tooltip:me,onSeriesMouseOver:A,refValues:z,showColorScale:ne=!0,graphID:le,maxValue:O,minValue:g,onSeriesMouseClick:M,graphDownload:se=!1,dataDownload:U=!1,sortData:L,labelOrder:u,language:l="en",minHeight:N=0,theme:H="light",maxBarThickness:$,maxNumberOfBars:P,minBarThickness:p,ariaLabel:d,resetSelectionOnDoubleClick:oe=!0,detailsOnClick:G,barAxisTitle:k,noOfTicks:W=5,valueColor:ue,styles:C,classNames:f,filterNA:w=!0,targetStyle:x="line",targetColor:X=ve.Colors.light.grays["gray-700"],qualitativeRangeColors:I,measureBarWidthFactor:ce=.4,animate:Y=!1,dimmedOpacity:xe=.3,precision:ge=2,customLayers:he=[],naLabel:R="NA"}=we,[a,fe]=j.useState(0),[n,v]=j.useState(0),m=j.useRef(null),t=j.useRef(null);return j.useEffect(()=>{const e=new ResizeObserver(r=>{fe(o||r[0].target.clientWidth||620),v(ie||r[0].target.clientHeight||480)});return m.current&&(v(m.current.clientHeight||480),fe(m.current.clientWidth||620),o||e.observe(m.current)),()=>e.disconnect()},[o,ie]),i.jsxRuntimeExports.jsx("div",{className:`${H||"light"} flex ${o?"w-fit grow-0":"w-full grow"}`,dir:l==="he"||l==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${b?b===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${l||"en"}`,o?"w-fit":"w-full",f?.graphContainer),style:{...C?.graphContainer||{},...b&&b!==!0?{backgroundColor:b}:{}},id:le,ref:t,"aria-label":d||`${y?`The graph shows ${y}. `:""}This is a bar chart. ${Z?` ${Z}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:b?D||"1rem":D||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[y||Z||se||U?i.jsxRuntimeExports.jsx(Se.GraphHeader,{styles:{title:C?.title,description:C?.description},classNames:{title:f?.title,description:f?.description},graphTitle:y,graphDescription:Z,width:o,graphDownload:se?t.current:void 0,dataDownload:U?s.map(e=>e.data).filter(e=>e!==void 0).length>0?s.map(e=>e.data).filter(e=>e!==void 0):s.filter(e=>e!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(De.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[ne&&s.filter(e=>e.qualitativeRange).length!==0&&V?i.jsxRuntimeExports.jsx(Be.ColorLegend,{width:o,colorLegendTitle:T,colors:I||ve.Colors[H].sequentialColors.positiveColorsx10,colorDomain:V,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:m,"aria-label":"Graph area",children:(o||a)&&(ie||n)?i.jsxRuntimeExports.jsx(We,{data:L?Ne.orderBy(s.filter(e=>w?!c.checkIfNullOrUndefined(e.size):e),[e=>e.size===void 0?L==="asc"?-1/0:1/0:e.size],[L]).filter((e,r)=>P?r<P:!0):s.filter(e=>w?!c.checkIfNullOrUndefined(e.size):e).filter((e,r)=>P?r<P:!0),barColor:J,targetColor:X,width:o||a,height:Math.max(N,ie||(q?N?(o||a)*q>N?(o||a)*q:N:(o||a)*q:n)),suffix:K,prefix:re,barPadding:ye,showValues:de,showTicks:ee,leftMargin:te,rightMargin:be,topMargin:B,bottomMargin:ae,truncateBy:E,showLabels:F,tooltip:me,onSeriesMouseOver:A,refValues:z,maxValue:O,minValue:g,highlightedDataPoints:h,onSeriesMouseClick:M,labelOrder:u,rtl:l==="he"||l==="ar",maxBarThickness:$,minBarThickness:p,resetSelectionOnDoubleClick:oe,detailsOnClick:G,barAxisTitle:k,noOfTicks:W,valueColor:ue,classNames:f,styles:C,targetStyle:x,qualitativeRangeColors:I||ve.Colors[H].sequentialColors.positiveColorsx10,measureBarWidthFactor:ce,animate:Y===!0?{duration:.5,once:!0,amount:.5}:Y||{duration:0,once:!0,amount:0},dimmedOpacity:xe,precision:ge,customLayers:he,naLabel:R}):null})]})}),Q||S?i.jsxRuntimeExports.jsx($e.GraphFooter,{sources:Q,footNote:S,width:o,styles:{footnote:C?.footnote,source:C?.source},classNames:{footnote:f?.footnote,source:f?.source}}):null]})})})})}function Ye(we){const{data:s,width:y,height:J,barColor:K,suffix:Q,prefix:re,barPadding:Z,showLabels:ye,showValues:de,showTicks:ee,truncateBy:te,rightMargin:be,topMargin:E,bottomMargin:ie,leftMargin:o,tooltip:S,onSeriesMouseOver:V,refValues:T,maxValue:h,minValue:D,highlightedDataPoints:b,onSeriesMouseClick:B,labelOrder:ae,maxBarThickness:F,minBarThickness:q,resetSelectionOnDoubleClick:me,detailsOnClick:A,barAxisTitle:z,valueColor:ne,noOfTicks:le,styles:O,classNames:g,targetStyle:M,targetColor:se,qualitativeRangeColors:U,measureBarWidthFactor:L,animate:u,dimmedOpacity:l,precision:N,customLayers:H,naLabel:$}=we,P=j.useRef(null),p=Ae.useInView(P,{once:u.once,amount:u.amount}),d={top:E,bottom:ie,left:z?o+30:o,right:be},[oe,G]=j.useState(void 0),[k,W]=j.useState(void 0),[ue,C]=j.useState(void 0),[f,w]=j.useState(void 0),x=y-d.left-d.right,X=J-d.top-d.bottom,I=Math.max(...s.filter(t=>!c.checkIfNullOrUndefined(t.size)).map(t=>t.size))<0?0:Math.max(...s.filter(t=>!c.checkIfNullOrUndefined(t.size)).map(t=>t.size)),ce=Math.max(...s.filter(t=>!c.checkIfNullOrUndefined(t.target)).map(t=>t.target))<0?0:Math.max(...s.filter(t=>!c.checkIfNullOrUndefined(t.size)).map(t=>t.target)),Y=Math.max(...s.map(t=>Re.sum((t.qualitativeRange||[]).filter(e=>!c.checkIfNullOrUndefined(e)))||0)),xe=c.checkIfNullOrUndefined(h)?Math.max(...[I,ce,Y].filter(Number.isFinite))<0?0:Math.max(...[I,ce,Y].filter(Number.isFinite)):h,ge=Math.min(...s.filter(t=>!c.checkIfNullOrUndefined(t.size)).map(t=>t.size))>=0?0:Math.min(...s.filter(t=>!c.checkIfNullOrUndefined(t.size)).map(t=>t.size)),he=Math.min(...s.filter(t=>!c.checkIfNullOrUndefined(t.target)).map(t=>t.target))>=0?0:Math.min(...s.filter(t=>!c.checkIfNullOrUndefined(t.target)).map(t=>t.target)),R=c.checkIfNullOrUndefined(D)?Math.min(...[ge,he].filter(Number.isFinite))>=0?0:Math.min(...[ge,he].filter(Number.isFinite)):D,a=Te.linear().domain([R,xe]).range([X,0]).nice(),fe=s.map((t,e)=>({...t,id:ae?`${t.label}`:`${e}`})),n=ae||fe.map(t=>`${t.id}`),v=qe.band().domain(n).range([0,q?Math.max(x,q*n.length):F?Math.min(x,F*n.length):x]).paddingInner(Z),m=a.ticks(le);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(_.motion.svg,{width:`${y}px`,height:`${J}px`,viewBox:`0 0 ${y} ${J}`,direction:"ltr",ref:P,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[i.jsxRuntimeExports.jsx(Ve.Axis,{y1:a(R<0?0:R),y2:a(R<0?0:R),x1:0-o,x2:x+d.right,label:Me.numberFormattingFunction(R<0?0:R,$,N,re,Q),labelPos:{x:0-o,dx:0,dy:xe<0?"1em":-5,y:a(R<0?0:R)},classNames:{axis:g?.xAxis?.axis,label:g?.yAxis?.labels},styles:{axis:O?.xAxis?.axis,label:O?.yAxis?.labels}}),ee?i.jsxRuntimeExports.jsx(Ge.YTicksAndGridLines,{values:m.filter(t=>t!==0),y:m.filter(t=>t!==0).map(t=>a(t)),x1:0-o,x2:x+d.right,styles:{gridLines:O?.yAxis?.gridLines,labels:O?.yAxis?.labels},classNames:{gridLines:g?.yAxis?.gridLines,labels:g?.yAxis?.labels},suffix:Q,prefix:re,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:N}):null,i.jsxRuntimeExports.jsx(Ie.AxisTitle,{x:0-o-15,y:X/2,style:O?.yAxis?.title,className:g?.yAxis?.title,text:z,rotate90:!0}),H.filter(t=>t.position==="before").map(t=>t.layer),i.jsxRuntimeExports.jsxs(Le.AnimatePresence,{children:[fe.map(t=>c.checkIfNullOrUndefined(v(t.id))?null:i.jsxRuntimeExports.jsxs(_.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:e=>{G(t),w(e.clientY),C(e.clientX),V?.(t)},onClick:()=>{(B||A)&&(ke.isEqual(k,t)&&me?(W(void 0),B?.(void 0)):(W(t),B?.(t)))},onMouseMove:e=>{G(t),w(e.clientY),C(e.clientX)},onMouseLeave:()=>{G(void 0),C(void 0),w(void 0),V?.(void 0)},exit:{opacity:0,transition:{duration:u.duration}},variants:{initial:{x:v(`${t.id}`),y:0,opacity:b.length!==0?b.indexOf(t.label)!==-1?.85:l:.85},whileInView:{x:v(`${t.id}`),y:0,opacity:b.length!==0?b.indexOf(t.label)!==-1?.85:l:.85,transition:{duration:u.duration}}},initial:"initial",animate:p?"whileInView":"initial",children:[t.qualitativeRange?t.qualitativeRange.map((e,r)=>i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,exit:{height:0,y:a(0),transition:{duration:u.duration}},variants:{initial:{height:0,y:a(0),fill:U[r]},whileInView:{height:Math.abs(a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<=r&&pe)))-a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<r&&pe)))),y:a(Re.sum(t.qualitativeRange.filter((pe,je)=>je<=r&&pe))),fill:U[r],transition:{duration:u.duration}}},initial:"initial",animate:p?"whileInView":"initial",width:v.bandwidth()},r)):null,t.target&&M==="background"?i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,width:v.bandwidth(),style:{fill:se},exit:{height:0,y:a(0),transition:{duration:u.duration}},variants:{initial:{height:0,y:a(0)},whileInView:{height:Math.abs(a(t.target)-a(0)),y:t.target>0?a(t.target):a(0),transition:{duration:u.duration}}},initial:"initial",animate:p?"whileInView":"initial"}):null,t.size?i.jsxRuntimeExports.jsx(_.motion.rect,{x:v.bandwidth()*((1-L)/2),width:v.bandwidth()*L,style:{fill:K},exit:{height:0,y:a(0),transition:{duration:u.duration}},variants:{initial:{height:0,y:a(0)},whileInView:{height:Math.abs(a(t.size)-a(0)),y:t.size>0?a(t.size):a(0),transition:{duration:u.duration}}},initial:"initial",animate:p?"whileInView":"initial"}):null,t.target&&M==="line"?i.jsxRuntimeExports.jsx(_.motion.rect,{x:0,width:v.bandwidth(),style:{fill:se},exit:{y:a(0),opacity:0,transition:{duration:u.duration}},variants:{initial:{y:a(0),opacity:0},whileInView:{y:a(t.target)-1,opacity:1,transition:{duration:u.duration}}},initial:"initial",animate:p?"whileInView":"initial",height:2}):null,ye?i.jsxRuntimeExports.jsx(Pe.XAxesLabels,{value:`${t.label}`.length<te?`${t.label}`:`${`${t.label}`.substring(0,te)}...`,y:(t.size||0)<0?0:a(0)+5,x:0,width:v.bandwidth(),height:(t.size||0)<0?a(0)-5:d.bottom,style:O?.xAxis?.labels,className:g?.xAxis?.labels,alignment:(t.size||0)<0?"bottom":"top",animate:u,isInView:p}):null,de?i.jsxRuntimeExports.jsx(_.motion.text,{x:v.bandwidth()/2,style:{...ne?{fill:ne}:{fill:K},textAnchor:"middle",...O?.graphObjectValues||{}},className:i.mo("graph-value text-sm",!ne&&K.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",g?.graphObjectValues),dy:t.size?t.size>=0?"-5px":"1em":"-5px",exit:{opacity:0,transition:{duration:u.duration}},variants:{initial:{y:a(0),opacity:0},whileInView:{y:a(t.size||0),opacity:1,transition:{duration:u.duration}}},initial:"initial",animate:p?"whileInView":"initial",children:Me.numberFormattingFunction(t.size,$,N,re,Q)}):null]},t.label)),T?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:T.map((t,e)=>i.jsxRuntimeExports.jsx(ze.RefLineY,{text:t.text,color:t.color,y:a(t.value),x1:0-o,x2:x+d.right,classNames:t.classNames,styles:t.styles,animate:u,isInView:p},e))}):null]}),H.filter(t=>t.position==="after").map(t=>t.layer)]})}),oe&&S&&ue&&f?i.jsxRuntimeExports.jsx(Ee.Tooltip,{data:oe,body:S,xPos:ue,yPos:f,backgroundStyle:O?.tooltip,className:g?.tooltip}):null,A&&k!==void 0?i.jsxRuntimeExports.jsx(Ce.X,{open:k!==void 0,onClose:()=>{W(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof A=="string"?{__html:Oe.string2HTML(A,k)}:void 0,children:typeof A=="function"?A(k):null})}):null]})}function _e(we){const{data:s,graphTitle:y,barColor:J=ve.Colors.primaryColors["blue-600"],barPadding:K=.25,showTicks:Q=!0,leftMargin:re=20,rightMargin:Z=20,topMargin:ye=20,bottomMargin:de=25,truncateBy:ee=999,showLabels:te=!0,showValues:be=!0,backgroundColor:E=!1,suffix:ie="",prefix:o="",sources:S,graphDescription:V,height:T,width:h,footNote:D,colorDomain:b,colorLegendTitle:B,padding:ae,relativeHeight:F,tooltip:q,onSeriesMouseOver:me,refValues:A,showColorScale:z=!0,graphID:ne,maxValue:le,minValue:O,highlightedDataPoints:g=[],qualitativeRangeColors:M,onSeriesMouseClick:se,graphDownload:U=!1,dataDownload:L=!1,language:u="en",theme:l="light",sortData:N,labelOrder:H,minHeight:$=0,maxBarThickness:P,maxNumberOfBars:p,minBarThickness:d,ariaLabel:oe,resetSelectionOnDoubleClick:G=!0,detailsOnClick:k,barAxisTitle:W,noOfTicks:ue=5,valueColor:C,styles:f,classNames:w,targetColor:x=ve.Colors.light.grays["gray-700"],filterNA:X=!0,targetStyle:I="line",measureBarWidthFactor:ce=.4,animate:Y=!1,dimmedOpacity:xe=.3,precision:ge=2,customLayers:he=[],naLabel:R="NA"}=we,[a,fe]=j.useState(0),[n,v]=j.useState(0),m=j.useRef(null),t=j.useRef(null);return j.useEffect(()=>{const e=new ResizeObserver(r=>{fe(h||r[0].target.clientWidth||620),v(T||r[0].target.clientHeight||480)});return m.current&&(v(m.current.clientHeight||480),fe(m.current.clientWidth||620),h||e.observe(m.current)),()=>e.disconnect()},[h,T]),i.jsxRuntimeExports.jsx("div",{className:`${l||"light"} flex ${h?"w-fit grow-0":"w-full grow"}`,dir:u==="he"||u==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${E?E===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${u||"en"}`,h?"w-fit":"w-full",w?.graphContainer),style:{...f?.graphContainer||{},...E&&E!==!0?{backgroundColor:E}:{}},id:ne,ref:t,"aria-label":oe||`${y?`The graph shows ${y}. `:""}This is a grouped bar chart. ${V?` ${V}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:E?ae||"1rem":ae||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[y||V||U||L?i.jsxRuntimeExports.jsx(Se.GraphHeader,{styles:{title:f?.title,description:f?.description},classNames:{title:w?.title,description:w?.description},graphTitle:y,graphDescription:V,width:h,graphDownload:U?t.current:void 0,dataDownload:L?s.map(e=>e.data).filter(e=>e!==void 0).length>0?s.map(e=>e.data).filter(e=>e!==void 0):s.filter(e=>e!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(De.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[z&&s.filter(e=>e.qualitativeRange).length!==0&&b?i.jsxRuntimeExports.jsx(Be.ColorLegend,{width:h,colorLegendTitle:B,colors:M||ve.Colors[l].sequentialColors.positiveColorsx10,colorDomain:b,showNAColor:!1}):null,i.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:m,"aria-label":"Graph area",children:(h||a)&&(T||n)?i.jsxRuntimeExports.jsx(Ye,{data:N?Ne.orderBy(s.filter(e=>X?!c.checkIfNullOrUndefined(e.size):e),[e=>e.size===void 0?N==="asc"?-1/0:1/0:e.size],[N]).filter((e,r)=>p?r<p:!0):s.filter(e=>X?!c.checkIfNullOrUndefined(e.size):e).filter((e,r)=>p?r<p:!0),barColor:J,targetColor:x,width:h||a,refValues:A,height:Math.max($,T||(F?$?(h||a)*F>$?(h||a)*F:$:(h||a)*F:n)),suffix:ie,prefix:o,barPadding:K,showLabels:te,showValues:be,showTicks:Q,truncateBy:ee,leftMargin:re,rightMargin:Z,qualitativeRangeColors:M||ve.Colors[l].sequentialColors.positiveColorsx10,topMargin:ye,bottomMargin:de,tooltip:q,onSeriesMouseOver:me,maxValue:le,minValue:O,highlightedDataPoints:g,onSeriesMouseClick:se,labelOrder:H,maxBarThickness:P,minBarThickness:d,resetSelectionOnDoubleClick:G,detailsOnClick:k,barAxisTitle:W,noOfTicks:ue,valueColor:C,styles:f,classNames:w,targetStyle:I,dimmedOpacity:xe,measureBarWidthFactor:ce,animate:Y===!0?{duration:.5,once:!0,amount:.5}:Y||{duration:0,once:!0,amount:0},precision:ge,customLayers:he,naLabel:R}):null})]})}),S||D?i.jsxRuntimeExports.jsx($e.GraphFooter,{styles:{footnote:f?.footnote,source:f?.source},classNames:{footnote:w?.footnote,source:w?.source},sources:S,footNote:D,width:h}):null]})})})})}function Je(we){const{data:s,graphTitle:y,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:E,suffix:ie,prefix:o,sources:S,graphDescription:V,height:T,width:h,footNote:D,colorDomain:b,colorLegendTitle:B,padding:ae,relativeHeight:F,tooltip:q,onSeriesMouseOver:me,refValues:A,showColorScale:z,graphID:ne,maxValue:le,minValue:O,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:U,language:L,theme:u,sortData:l,labelOrder:N,minHeight:H,maxBarThickness:$,maxNumberOfBars:P,minBarThickness:p,ariaLabel:d,resetSelectionOnDoubleClick:oe,detailsOnClick:G,barAxisTitle:k,noOfTicks:W,valueColor:ue,orientation:C="vertical",styles:f,classNames:w,filterNA:x,targetStyle:X,targetColor:I,qualitativeRangeColors:ce,measureBarWidthFactor:Y,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R}=we;return C==="vertical"?i.jsxRuntimeExports.jsx(_e,{data:s,graphTitle:y,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:E,suffix:ie,prefix:o,sources:S,graphDescription:V,height:T,width:h,footNote:D,colorDomain:b,colorLegendTitle:B,padding:ae,relativeHeight:F,tooltip:q,onSeriesMouseOver:me,refValues:A,showColorScale:z,graphID:ne,maxValue:le,minValue:O,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:U,language:L,theme:u,sortData:l,labelOrder:N,minHeight:H,maxBarThickness:$,maxNumberOfBars:P,minBarThickness:p,ariaLabel:d,resetSelectionOnDoubleClick:oe,styles:f,detailsOnClick:G,barAxisTitle:k,noOfTicks:W,valueColor:ue,classNames:w,filterNA:x,targetStyle:X,targetColor:I,measureBarWidthFactor:Y,qualitativeRangeColors:ce,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R}):i.jsxRuntimeExports.jsx(Xe,{data:s,graphTitle:y,barColor:J,barPadding:K,showTicks:Q,leftMargin:re,rightMargin:Z,topMargin:ye,bottomMargin:de,truncateBy:ee,showLabels:te,showValues:be,backgroundColor:E,suffix:ie,prefix:o,sources:S,graphDescription:V,height:T,width:h,footNote:D,colorDomain:b,colorLegendTitle:B,padding:ae,relativeHeight:F,tooltip:q,onSeriesMouseOver:me,refValues:A,showColorScale:z,graphID:ne,maxValue:le,minValue:O,highlightedDataPoints:g,onSeriesMouseClick:M,graphDownload:se,dataDownload:U,language:L,theme:u,sortData:l,labelOrder:N,minHeight:H,maxBarThickness:$,maxNumberOfBars:P,minBarThickness:p,ariaLabel:d,resetSelectionOnDoubleClick:oe,styles:f,detailsOnClick:G,barAxisTitle:k,noOfTicks:W,valueColor:ue,classNames:w,filterNA:x,targetStyle:X,targetColor:I,measureBarWidthFactor:Y,qualitativeRangeColors:ce,animate:xe,dimmedOpacity:ge,precision:he,naLabel:R})}exports.BulletChart=Je;
2
2
  //# sourceMappingURL=BulletChart.cjs.map