@undp/data-viz 2.3.19 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/BarGraph.cjs +1 -1
  2. package/dist/BarGraph.cjs.map +1 -1
  3. package/dist/BarGraph.js +1360 -1363
  4. package/dist/BarGraph.js.map +1 -1
  5. package/dist/BeeSwarmChart.cjs +1 -1
  6. package/dist/BeeSwarmChart.cjs.map +1 -1
  7. package/dist/BeeSwarmChart.js +302 -305
  8. package/dist/BeeSwarmChart.js.map +1 -1
  9. package/dist/BiVariateChoroplethMap.cjs +1 -1
  10. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  11. package/dist/BiVariateChoroplethMap.js +4 -4
  12. package/dist/BiVariateChoroplethMap.js.map +1 -1
  13. package/dist/BulletChart.cjs +1 -1
  14. package/dist/BulletChart.cjs.map +1 -1
  15. package/dist/BulletChart.js +591 -594
  16. package/dist/BulletChart.js.map +1 -1
  17. package/dist/ChoroplethMap.cjs +1 -1
  18. package/dist/ChoroplethMap.cjs.map +1 -1
  19. package/dist/ChoroplethMap.js +4 -4
  20. package/dist/ChoroplethMap.js.map +1 -1
  21. package/dist/CirclePackingGraph.cjs +1 -1
  22. package/dist/CirclePackingGraph.js +1 -1
  23. package/dist/DotDensityMap.cjs +1 -1
  24. package/dist/DotDensityMap.cjs.map +1 -1
  25. package/dist/DotDensityMap.js +255 -258
  26. package/dist/DotDensityMap.js.map +1 -1
  27. package/dist/DumbbellChart.cjs +1 -1
  28. package/dist/DumbbellChart.cjs.map +1 -1
  29. package/dist/DumbbellChart.js +553 -556
  30. package/dist/DumbbellChart.js.map +1 -1
  31. package/dist/{GraphEl-Dorm_qQE.js → GraphEl-B73N4RIA.js} +2 -2
  32. package/dist/{GraphEl-Dorm_qQE.js.map → GraphEl-B73N4RIA.js.map} +1 -1
  33. package/dist/{GraphEl-D8WRC8-j.cjs → GraphEl-Lt1og0C-.cjs} +2 -2
  34. package/dist/{GraphEl-D8WRC8-j.cjs.map → GraphEl-Lt1og0C-.cjs.map} +1 -1
  35. package/dist/GriddedGraphs.cjs +1 -1
  36. package/dist/GriddedGraphs.js +1 -1
  37. package/dist/Histogram.cjs +1 -1
  38. package/dist/Histogram.js +1 -1
  39. package/dist/HybridMap.cjs +1 -1
  40. package/dist/HybridMap.cjs.map +1 -1
  41. package/dist/HybridMap.js +310 -313
  42. package/dist/HybridMap.js.map +1 -1
  43. package/dist/MultiLineAltChart.cjs +1 -1
  44. package/dist/MultiLineAltChart.cjs.map +1 -1
  45. package/dist/MultiLineAltChart.js +269 -272
  46. package/dist/MultiLineAltChart.js.map +1 -1
  47. package/dist/MultiLineChart.cjs +1 -1
  48. package/dist/MultiLineChart.cjs.map +1 -1
  49. package/dist/MultiLineChart.js +319 -322
  50. package/dist/MultiLineChart.js.map +1 -1
  51. package/dist/RadarChart.cjs +1 -1
  52. package/dist/RadarChart.cjs.map +1 -1
  53. package/dist/RadarChart.js +3 -3
  54. package/dist/RadarChart.js.map +1 -1
  55. package/dist/SankeyChart.cjs +1 -1
  56. package/dist/SankeyChart.cjs.map +1 -1
  57. package/dist/SankeyChart.js +274 -280
  58. package/dist/SankeyChart.js.map +1 -1
  59. package/dist/ScatterPlot.cjs +1 -1
  60. package/dist/ScatterPlot.cjs.map +1 -1
  61. package/dist/ScatterPlot.js +341 -344
  62. package/dist/ScatterPlot.js.map +1 -1
  63. package/dist/SingleGraphDashboard.cjs +1 -1
  64. package/dist/SingleGraphDashboard.js +1 -1
  65. package/dist/SlopeChart.cjs +1 -1
  66. package/dist/SlopeChart.cjs.map +1 -1
  67. package/dist/SlopeChart.js +251 -254
  68. package/dist/SlopeChart.js.map +1 -1
  69. package/dist/StripChart.cjs +1 -1
  70. package/dist/StripChart.cjs.map +1 -1
  71. package/dist/StripChart.js +292 -295
  72. package/dist/StripChart.js.map +1 -1
  73. package/dist/ThreeDGlobe.cjs +1 -1
  74. package/dist/ThreeDGlobe.cjs.map +1 -1
  75. package/dist/ThreeDGlobe.js +3 -3
  76. package/dist/ThreeDGlobe.js.map +1 -1
  77. package/dist/TreeMapGraph.cjs +1 -1
  78. package/dist/TreeMapGraph.cjs.map +1 -1
  79. package/dist/TreeMapGraph.js +196 -199
  80. package/dist/TreeMapGraph.js.map +1 -1
  81. package/dist/WaterfallChart.cjs +1 -1
  82. package/dist/WaterfallChart.cjs.map +1 -1
  83. package/dist/WaterfallChart.js +274 -277
  84. package/dist/WaterfallChart.js.map +1 -1
  85. package/dist/index-B0Awa_de.js +377 -0
  86. package/dist/index-B0Awa_de.js.map +1 -0
  87. package/dist/index-CP8cmNzt.cjs +2 -0
  88. package/dist/index-CP8cmNzt.cjs.map +1 -0
  89. package/dist/index.cjs +1 -1
  90. package/dist/index.js +1 -1
  91. package/package.json +1 -1
  92. package/dist/index-Bdo_HXb_.cjs +0 -2
  93. package/dist/index-Bdo_HXb_.cjs.map +0 -1
  94. package/dist/index-CGrBpeUa.js +0 -380
  95. package/dist/index-CGrBpeUa.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ChoroplethMap.js","sources":["../src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx","../src/Components/Graphs/Maps/ChoroplethMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useEffect, useMemo, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n geoPath,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold, scaleOrdinal } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport rewind from '@turf/rewind';\r\nimport { FeatureCollection } from 'geojson';\r\n\r\nimport {\r\n AnimateDataType,\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { ExpandIcon, X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\n\r\ninterface Props {\r\n colorDomain: (number | string)[];\r\n mapData: FeatureCollection;\r\n width: number;\r\n height: number;\r\n colors: string[];\r\n colorLegendTitle?: string;\r\n categorical: boolean;\r\n data: ChoroplethMapDataType[];\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n mapBorderColor: string;\r\n isWorldMap: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n showColorScale: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n collapseColorScaleByDefault?: boolean;\r\n zoomAndCenterByHighlightedIds: boolean;\r\n projectionRotate: [number, number] | [number, number, number];\r\n rewindCoordinatesInMapData: boolean;\r\n overlayMapData?: FeatureCollection;\r\n overlayMapBorderColor?: string;\r\n overlayMapBorderWidth?: number;\r\n locale: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colorDomain,\r\n colors,\r\n mapData,\r\n colorLegendTitle,\r\n categorical,\r\n height,\r\n width,\r\n scale,\r\n centerPoint,\r\n tooltip,\r\n mapBorderWidth,\r\n mapBorderColor,\r\n mapNoDataColor,\r\n onSeriesMouseOver,\r\n showColorScale,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds,\r\n projectionRotate,\r\n rewindCoordinatesInMapData,\r\n overlayMapData,\r\n overlayMapBorderColor,\r\n overlayMapBorderWidth,\r\n locale,\r\n } = props;\r\n const formattedMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData) return mapData;\r\n\r\n return rewind(mapData, { reverse: true }) as FeatureCollection;\r\n }, [mapData, rewindCoordinatesInMapData]);\r\n const formattedOverlayMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData || !overlayMapData) return overlayMapData;\r\n\r\n return rewind(overlayMapData, { reverse: true }) as FeatureCollection;\r\n }, [overlayMapData, rewindCoordinatesInMapData]);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const colorScale = categorical\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n const bounds = bbox({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n\r\n const center = centerOfMass({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n const lonDiff = (bounds[2] - bounds[0]) * 1.15;\r\n const latDiff = (bounds[3] - bounds[1]) * 1.15;\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n const pathGenerator = geoPath().projection(projection);\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {formattedMapData.features.map((d, i: number) => {\r\n if (!d.properties?.[mapProperty]) return null;\r\n const path = pathGenerator(d);\r\n if (!path) 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 <path\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = formattedMapData.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 if (index === -1) return null;\r\n const path = pathGenerator(formattedMapData.features[index]);\r\n if (!path) return null;\r\n const color = !checkIfNullOrUndefined(d.x)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.x as any)\r\n : mapNoDataColor;\r\n return (\r\n <motion.g\r\n className='undp-map-shapes'\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n <motion.path\r\n key={`${d.id}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? formattedMapData.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 .map((d, i) => (\r\n <path\r\n key={i}\r\n d={pathGenerator(d) || ''}\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 vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n ))\r\n : null}\r\n {formattedOverlayMapData?.features.map((d, i: number) => {\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <g key={i}>\r\n <path\r\n d={path}\r\n style={{\r\n stroke: overlayMapBorderColor || mapBorderColor,\r\n strokeWidth: overlayMapBorderWidth || mapBorderWidth + 1,\r\n fill: 'none',\r\n pointerEvents: 'none',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </g>\r\n );\r\n })}\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={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{\r\n width: categorical ? undefined : '340px',\r\n }}\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P\r\n size='xs'\r\n marginBottom='xs'\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n {!categorical ? (\r\n <svg width='100%' viewBox='0 0 320 30' direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g\r\n key={i}\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={(i * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={\r\n selectedColor === colors[i]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }\r\n style={{\r\n fill: colors[i],\r\n ...(selectedColor === colors[i] ? {} : { stroke: colors[i] }),\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * 320) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-xs'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(\r\n d as number,\r\n 'NA',\r\n undefined,\r\n undefined,\r\n undefined,\r\n locale,\r\n )}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n onMouseOver={() => {\r\n setSelectedColor(colors[colorDomain.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n x={(colorDomain.length * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={`cursor-pointer ${\r\n selectedColor === colors[colorDomain.length]\r\n ? 'stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n ...(selectedColor === colors[colorDomain.length]\r\n ? {}\r\n : { stroke: colors[colorDomain.length] }),\r\n }}\r\n />\r\n </g>\r\n </g>\r\n </svg>\r\n ) : (\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div\r\n key={i}\r\n className='flex gap-2 items-center'\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i % colors.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n >\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <ExpandIcon />\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 zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect, useEffectEvent, useMemo } from 'react';\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 { FeatureCollection } from 'geojson';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n ChoroplethMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ScaleDataType,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n MapOverlayDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: ChoroplethMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: number[] | string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n mapData?: FeatureCollection | string;\r\n /** Detail if any other map needs to be overlayed over the main map */\r\n mapOverlay?: MapOverlayDataType;\r\n /** Defines if the coordinates in the map data should be rewinded or not. Try to change this is the visualization shows countries as holes instead of shapes. */\r\n rewindCoordinatesInMapData?: boolean;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Toggle if the map is centered and zoomed to the highlighted ids. */\r\n zoomAndCenterByHighlightedIds?: boolean;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Controls the rotation of the map projection, in degrees, applied before rendering. Useful for shifting the antimeridian to focus the map on different regions */\r\n projectionRotate?: [number, number] | [number, number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Locale for number formatting. Must matches what `Intl.NumberFormat` expects. */\r\n locale?: string;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function ChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json',\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n colorDomain,\r\n colorLegendTitle,\r\n scaleType = 'threshold',\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n showColorScale = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection = 'naturalEarth',\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 collapseColorScaleByDefault,\r\n projectionRotate = [0, 0],\r\n zoomAndCenterByHighlightedIds = false,\r\n rewindCoordinatesInMapData = true,\r\n mapOverlay,\r\n locale = 'en',\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = useMemo(() => {\r\n const dates = [\r\n ...new Set(\r\n data\r\n .filter(d => d.date)\r\n .map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n ),\r\n ];\r\n dates.sort((a, b) => a - b);\r\n return dates;\r\n }, [data, timeline.dateFormat]);\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n const [mapShape, setMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n const [overlayMapShape, setOverlayMapShape] = useState<FeatureCollection | undefined>(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(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const onUpdateShape = useEffectEvent((shape: FeatureCollection) => {\r\n setMapShape(shape);\r\n });\r\n\r\n const onUpdateOverlayMapShape = useEffectEvent((shape: FeatureCollection | undefined) => {\r\n setOverlayMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n useEffect(() => {\r\n if (!mapOverlay?.mapData) onUpdateOverlayMapShape(undefined);\r\n if (typeof mapOverlay?.mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapOverlay?.mapData);\r\n fetchData.then(d => {\r\n onUpdateOverlayMapShape(d as FeatureCollection);\r\n });\r\n } else {\r\n onUpdateOverlayMapShape(mapOverlay?.mapData);\r\n }\r\n }, [mapOverlay?.mapData]);\r\n\r\n const domain =\r\n colorDomain ||\r\n (scaleType === 'categorical'\r\n ? getUniqValue(data, 'x')\r\n : getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors?.length || 4,\r\n ));\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\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 : 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 <GraphArea ref={graphDiv}>\r\n {svgWidth && 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(el => el.properties?.NAME !== 'Antarctica'),\r\n }\r\n }\r\n colorDomain={domain}\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={\r\n colors ||\r\n (scaleType === 'categorical'\r\n ? Colors[theme].categoricalColors.colors\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${(domain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ])\r\n }\r\n colorLegendTitle={colorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n showColorScale={showColorScale}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n overlayMapData={overlayMapShape}\r\n overlayMapBorderColor={mapOverlay?.mapBorderColor}\r\n overlayMapBorderWidth={mapOverlay?.mapBorderWidth}\r\n classNames={classNames}\r\n detailsOnClick={detailsOnClick}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n zoomInteraction={zoomInteraction}\r\n dimmedOpacity={dimmedOpacity}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n customLayers={customLayers}\r\n zoomAndCenterByHighlightedIds={zoomAndCenterByHighlightedIds}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n projectionRotate={projectionRotate}\r\n rewindCoordinatesInMapData={rewindCoordinatesInMapData}\r\n locale={locale}\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 </GraphArea>\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 </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","colorDomain","colors","mapData","colorLegendTitle","categorical","height","width","scale","centerPoint","tooltip","mapBorderWidth","mapBorderColor","mapNoDataColor","onSeriesMouseOver","showColorScale","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","zoomAndCenterByHighlightedIds","projectionRotate","rewindCoordinatesInMapData","overlayMapData","overlayMapBorderColor","overlayMapBorderWidth","locale","formattedMapData","useMemo","rewind","reverse","formattedOverlayMapData","selectedColor","setSelectedColor","useState","undefined","zoomRef","useRef","showLegend","setShowLegend","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","isInView","useInView","once","amount","mapG","colorScale","scaleOrdinal","domain","range","scaleThreshold","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","features","d","length","indexOf","properties","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","pathGenerator","geoPath","handleZoom","direction","svg","scaleBy","jsxs","Fragment","jsx","motion","position","map","layer","i","path","stroke","strokeWidth","fill","vectorEffect","AnimatePresence","index","findIndex","el","id","color","checkIfNullOrUndefined","x","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","pointerEvents","cn","colorLegend","X","P","display","WebkitLineClamp","WebkitBoxOrient","backgroundColor","textAnchor","numberFormattingFunction","ExpandIcon","DetailsModal","modal","Tooltip","ChoroplethMap","$","_c","t0","graphTitle","sources","graphDescription","footNote","t1","scaleType","t2","t3","padding","t4","t5","t6","t7","relativeHeight","isWorldMap","t8","t9","t10","graphID","t11","t12","graphDownload","t13","dataDownload","t14","showAntarctica","t15","language","t16","minHeight","t17","theme","t18","ariaLabel","t19","t20","t21","t22","t23","t24","timeline","t25","t26","t27","t28","mapOverlay","t29","Colors","light","graphNoData","grays","t30","t31","t32","t33","enabled","autoplay","showOnlyActiveDate","t34","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t35","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","overlayMapShape","setOverlayMapShape","graphDiv","graphParentDiv","t36","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t37","shape","onUpdateShape","useEffectEvent","t38","shape_0","onUpdateOverlayMapShape","t39","fetchAndParseJSON","then","d_1","t40","t41","d_2","t42","t43","t44","getUniqValue","getJenks","_temp3","t45","t46","speed","interval","setInterval","clearInterval","t47","t48","getSliderMarks","markObj","t49","graphContainer","t50","t51","description","title","GraphHeader","_temp4","_temp5","_temp6","_temp7","_temp8","t52","Pause","Play","SliderUI","nextValue","nextValue_0","t53","GraphArea","d_9","format","_temp9","categoricalColors","sequentialColors","max","Spinner","t54","footnote","source","GraphFooter","t55","GraphContainer","NAME","d_6","d_5","d_4","d_8","d_7","d_3","a","b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFO,SAASA,GAAMC,GAAc;AAClC,QAAM;AAAA,IACJC,MAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,kBAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,mBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,iBAAAA;AAAAA,IACAC,qBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,oBAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,6BAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,YAAAA;AAAAA,IACAC,eAAAA;AAAAA,IACAC,iBAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,eAAAA;AAAAA,IACAC,cAAAA;AAAAA,IACAC,6BAAAA;AAAAA,IACAC,+BAAAA;AAAAA,IACAC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GAAiB5J,SAAAoC,IAAApC,SAAAR,IAAAQ,SAAAqB,GAAArB,SAAAvK,GAAAuK,SAAA8B,IAAA9B,SAAAgC,GAAAhC,SAAAW,IAAAX,SAAAgB,GAAAhB,SAAAiI,IAAAjI,SAAAmI,IAAAnI,SAAAoI,IAAApI,SAAA6I,IAAA7I,SAAAmJ,IAAAnJ,SAAA4J,IAAA5J,SAAAkC,GAAAlC,SAAAtK,GAAAsK,SAAAgK,MAAAA,KAAAhK,EAAA,GAAA,GAtKjBgK;AAsKiB;AAtTd,SAAAT,GAAAtL,GAAA;AAAA,SAiOsDA,EAAE1C,YAAiB2O,SAAK;AAAY;AAjO1F,SAAAtB,GAAAuB,GAAA;AAAA,SAiL4B/O,MAAMnD;AAAS;AAjL3C,SAAA0Q,GAAAyB,GAAA;AAAA,SAgL6ChP,MAAMnD;AAAS;AAhL5D,SAAAyQ,GAAA2B,GAAA;AAAA,SAgLyBjP,EAACjG;AAAK;AAhL/B,SAAAsT,GAAA6B,GAAA;AAAA,SA+K2ClP,MAAMnD;AAAS;AA/K1D,SAAAuQ,GAAA+B,GAAA;AAAA,SA+KuBnP,EAACjG;AAAK;AA/K7B,SAAAmS,GAAAkD,GAAA;AAAA,SA0HiBpP,EAACiD;AAA+B;AA1HjD,SAAA0G,GAAA0F,GAAAC,GAAA;AAAA,SAmEkBD,IAAIC;AAAC;AAnEvB,SAAA7F,GAAAzJ,GAAA;AAAA,SA+DgBA,EAACqJ;AAAK;"}
1
+ {"version":3,"file":"ChoroplethMap.js","sources":["../src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx","../src/Components/Graphs/Maps/ChoroplethMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useEffect, useMemo, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n geoPath,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold, scaleOrdinal } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport rewind from '@turf/rewind';\r\nimport { FeatureCollection } from 'geojson';\r\n\r\nimport {\r\n AnimateDataType,\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { ExpandIcon, X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\n\r\ninterface Props {\r\n colorDomain: (number | string)[];\r\n mapData: FeatureCollection;\r\n width: number;\r\n height: number;\r\n colors: string[];\r\n colorLegendTitle?: string;\r\n categorical: boolean;\r\n data: ChoroplethMapDataType[];\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n mapBorderColor: string;\r\n isWorldMap: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n showColorScale: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds?: string[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n collapseColorScaleByDefault?: boolean;\r\n zoomAndCenterByHighlightedIds: boolean;\r\n projectionRotate: [number, number] | [number, number, number];\r\n rewindCoordinatesInMapData: boolean;\r\n overlayMapData?: FeatureCollection;\r\n overlayMapBorderColor?: string;\r\n overlayMapBorderWidth?: number;\r\n locale: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colorDomain,\r\n colors,\r\n mapData,\r\n colorLegendTitle,\r\n categorical,\r\n height,\r\n width,\r\n scale,\r\n centerPoint,\r\n tooltip,\r\n mapBorderWidth,\r\n mapBorderColor,\r\n mapNoDataColor,\r\n onSeriesMouseOver,\r\n showColorScale,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds,\r\n projectionRotate,\r\n rewindCoordinatesInMapData,\r\n overlayMapData,\r\n overlayMapBorderColor,\r\n overlayMapBorderWidth,\r\n locale,\r\n } = props;\r\n const formattedMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData) return mapData;\r\n\r\n return rewind(mapData, { reverse: true }) as FeatureCollection;\r\n }, [mapData, rewindCoordinatesInMapData]);\r\n const formattedOverlayMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData || !overlayMapData) return overlayMapData;\r\n\r\n return rewind(overlayMapData, { reverse: true }) as FeatureCollection;\r\n }, [overlayMapData, rewindCoordinatesInMapData]);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const colorScale = categorical\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n const bounds = bbox({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds?.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n\r\n const center = centerOfMass({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds?.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n const lonDiff = (bounds[2] - bounds[0]) * 1.15;\r\n const latDiff = (bounds[3] - bounds[1]) * 1.15;\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\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(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n const pathGenerator = geoPath().projection(projection);\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {formattedMapData.features.map((d, i: number) => {\r\n if (!d.properties?.[mapProperty]) return null;\r\n const path = pathGenerator(d);\r\n if (!path) 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\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n <path\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = formattedMapData.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 if (index === -1) return null;\r\n const path = pathGenerator(formattedMapData.features[index]);\r\n if (!path) return null;\r\n const color = !checkIfNullOrUndefined(d.x)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.x as any)\r\n : mapNoDataColor;\r\n return (\r\n <motion.g\r\n className='undp-map-shapes'\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\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n <motion.path\r\n key={`${d.id}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? formattedMapData.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 .map((d, i) => (\r\n <path\r\n key={i}\r\n d={pathGenerator(d) || ''}\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 vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n ))\r\n : null}\r\n {formattedOverlayMapData?.features.map((d, i: number) => {\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <g key={i}>\r\n <path\r\n d={path}\r\n style={{\r\n stroke: overlayMapBorderColor || mapBorderColor,\r\n strokeWidth: overlayMapBorderWidth || mapBorderWidth + 1,\r\n fill: 'none',\r\n pointerEvents: 'none',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </g>\r\n );\r\n })}\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={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{\r\n width: categorical ? undefined : '340px',\r\n }}\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P\r\n size='xs'\r\n marginBottom='xs'\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n {!categorical ? (\r\n <svg width='100%' viewBox='0 0 320 30' direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g\r\n key={i}\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={(i * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={\r\n selectedColor === colors[i]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }\r\n style={{\r\n fill: colors[i],\r\n ...(selectedColor === colors[i] ? {} : { stroke: colors[i] }),\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * 320) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-xs'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(\r\n d as number,\r\n 'NA',\r\n undefined,\r\n undefined,\r\n undefined,\r\n locale,\r\n )}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n onMouseOver={() => {\r\n setSelectedColor(colors[colorDomain.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n x={(colorDomain.length * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={`cursor-pointer ${\r\n selectedColor === colors[colorDomain.length]\r\n ? 'stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n ...(selectedColor === colors[colorDomain.length]\r\n ? {}\r\n : { stroke: colors[colorDomain.length] }),\r\n }}\r\n />\r\n </g>\r\n </g>\r\n </svg>\r\n ) : (\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div\r\n key={i}\r\n className='flex gap-2 items-center'\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i % colors.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n >\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <ExpandIcon />\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 zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect, useEffectEvent, useMemo } from 'react';\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 { FeatureCollection } from 'geojson';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n ChoroplethMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ScaleDataType,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n MapOverlayDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: ChoroplethMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: number[] | string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n mapData?: FeatureCollection | string;\r\n /** Detail if any other map needs to be overlayed over the main map */\r\n mapOverlay?: MapOverlayDataType;\r\n /** Defines if the coordinates in the map data should be rewinded or not. Try to change this is the visualization shows countries as holes instead of shapes. */\r\n rewindCoordinatesInMapData?: boolean;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Toggle if the map is centered and zoomed to the highlighted ids. */\r\n zoomAndCenterByHighlightedIds?: boolean;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Controls the rotation of the map projection, in degrees, applied before rendering. Useful for shifting the antimeridian to focus the map on different regions */\r\n projectionRotate?: [number, number] | [number, number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Locale for number formatting. Must matches what `Intl.NumberFormat` expects. */\r\n locale?: string;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function ChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json',\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n colorDomain,\r\n colorLegendTitle,\r\n scaleType = 'threshold',\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n showColorScale = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection = 'naturalEarth',\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 collapseColorScaleByDefault,\r\n projectionRotate = [0, 0],\r\n zoomAndCenterByHighlightedIds = false,\r\n rewindCoordinatesInMapData = true,\r\n mapOverlay,\r\n locale = 'en',\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = useMemo(() => {\r\n const dates = [\r\n ...new Set(\r\n data\r\n .filter(d => d.date)\r\n .map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n ),\r\n ];\r\n dates.sort((a, b) => a - b);\r\n return dates;\r\n }, [data, timeline.dateFormat]);\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n const [mapShape, setMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n const [overlayMapShape, setOverlayMapShape] = useState<FeatureCollection | undefined>(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(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const onUpdateShape = useEffectEvent((shape: FeatureCollection) => {\r\n setMapShape(shape);\r\n });\r\n\r\n const onUpdateOverlayMapShape = useEffectEvent((shape: FeatureCollection | undefined) => {\r\n setOverlayMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n useEffect(() => {\r\n if (!mapOverlay?.mapData) onUpdateOverlayMapShape(undefined);\r\n if (typeof mapOverlay?.mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapOverlay?.mapData);\r\n fetchData.then(d => {\r\n onUpdateOverlayMapShape(d as FeatureCollection);\r\n });\r\n } else {\r\n onUpdateOverlayMapShape(mapOverlay?.mapData);\r\n }\r\n }, [mapOverlay?.mapData]);\r\n\r\n const domain =\r\n colorDomain ||\r\n (scaleType === 'categorical'\r\n ? getUniqValue(data, 'x')\r\n : getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors?.length || 4,\r\n ));\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\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 : 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 <GraphArea ref={graphDiv}>\r\n {svgWidth && 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(el => el.properties?.NAME !== 'Antarctica'),\r\n }\r\n }\r\n colorDomain={domain}\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={\r\n colors ||\r\n (scaleType === 'categorical'\r\n ? Colors[theme].categoricalColors.colors\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${(domain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ])\r\n }\r\n colorLegendTitle={colorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n showColorScale={showColorScale}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n overlayMapData={overlayMapShape}\r\n overlayMapBorderColor={mapOverlay?.mapBorderColor}\r\n overlayMapBorderWidth={mapOverlay?.mapBorderWidth}\r\n classNames={classNames}\r\n detailsOnClick={detailsOnClick}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n zoomInteraction={zoomInteraction}\r\n dimmedOpacity={dimmedOpacity}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n customLayers={customLayers}\r\n zoomAndCenterByHighlightedIds={zoomAndCenterByHighlightedIds}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n projectionRotate={projectionRotate}\r\n rewindCoordinatesInMapData={rewindCoordinatesInMapData}\r\n locale={locale}\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 </GraphArea>\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 </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","colorDomain","colors","mapData","colorLegendTitle","categorical","height","width","scale","centerPoint","tooltip","mapBorderWidth","mapBorderColor","mapNoDataColor","onSeriesMouseOver","showColorScale","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","zoomAndCenterByHighlightedIds","projectionRotate","rewindCoordinatesInMapData","overlayMapData","overlayMapBorderColor","overlayMapBorderWidth","locale","formattedMapData","useMemo","rewind","reverse","formattedOverlayMapData","selectedColor","setSelectedColor","useState","undefined","zoomRef","useRef","showLegend","setShowLegend","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","isInView","useInView","once","amount","mapG","colorScale","scaleOrdinal","domain","range","scaleThreshold","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","features","d","length","indexOf","properties","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","pathGenerator","geoPath","handleZoom","direction","svg","scaleBy","jsxs","Fragment","jsx","motion","position","map","layer","i","path","stroke","strokeWidth","fill","vectorEffect","AnimatePresence","index","findIndex","el","id","color","checkIfNullOrUndefined","x","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","pointerEvents","cn","colorLegend","X","P","display","WebkitLineClamp","WebkitBoxOrient","backgroundColor","textAnchor","numberFormattingFunction","ExpandIcon","DetailsModal","modal","Tooltip","ChoroplethMap","$","_c","t0","graphTitle","sources","graphDescription","footNote","t1","scaleType","t2","t3","padding","t4","t5","t6","t7","relativeHeight","isWorldMap","t8","t9","t10","graphID","t11","t12","graphDownload","t13","dataDownload","t14","showAntarctica","t15","language","t16","minHeight","t17","theme","t18","ariaLabel","t19","t20","t21","t22","t23","t24","timeline","t25","t26","t27","t28","mapOverlay","t29","Colors","light","graphNoData","grays","t30","t31","t32","t33","enabled","autoplay","showOnlyActiveDate","t34","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t35","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","overlayMapShape","setOverlayMapShape","graphDiv","graphParentDiv","t36","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t37","shape","onUpdateShape","useEffectEvent","t38","shape_0","onUpdateOverlayMapShape","t39","fetchAndParseJSON","then","d_1","t40","t41","d_2","t42","t43","t44","getUniqValue","getJenks","_temp3","t45","t46","speed","interval","setInterval","clearInterval","t47","t48","getSliderMarks","markObj","t49","graphContainer","t50","t51","description","title","GraphHeader","_temp4","_temp5","_temp6","_temp7","_temp8","t52","Pause","Play","SliderUI","nextValue","nextValue_0","t53","GraphArea","d_9","format","_temp9","categoricalColors","sequentialColors","max","Spinner","t54","footnote","source","GraphFooter","t55","GraphContainer","NAME","d_6","d_5","d_4","d_8","d_7","d_3","a","b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFO,SAASA,GAAMC,GAAc;AAClC,QAAM;AAAA,IACJC,MAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,kBAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,mBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,iBAAAA;AAAAA,IACAC,qBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,oBAAAA;AAAAA,IACAC,aAAAA;A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-Bdo_HXb_.cjs");require("./GraphFooter.cjs");require("./GraphHeader.cjs");require("./ColorLegendWithMouseOver.cjs");require("./Colors.cjs");require("./EmptyState-CFmiFPHz.cjs");require("./uniqBy-O05lp2S5.cjs");require("./GraphContainer-Cul9b74X.cjs");exports.CirclePackingGraph=e.CirclePackingGraph;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CHPV5EwG-D4pAp7u0.cjs");require("react");const e=require("./index-CP8cmNzt.cjs");require("./GraphFooter.cjs");require("./GraphHeader.cjs");require("./ColorLegendWithMouseOver.cjs");require("./Colors.cjs");require("./EmptyState-CFmiFPHz.cjs");require("./uniqBy-O05lp2S5.cjs");require("./GraphContainer-Cul9b74X.cjs");exports.CirclePackingGraph=e.CirclePackingGraph;
2
2
  //# sourceMappingURL=CirclePackingGraph.cjs.map
@@ -1,6 +1,6 @@
1
1
  import "./index-CHPV5EwG-BzibaIRc.js";
2
2
  import "react";
3
- import { C as g } from "./index-CGrBpeUa.js";
3
+ import { C as g } from "./index-B0Awa_de.js";
4
4
  import "./GraphFooter.js";
5
5
  import "./GraphHeader.js";
6
6
  import "./ColorLegendWithMouseOver.js";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-D4pAp7u0.cjs"),i=require("react"),Et=require("./parse-xYI9yrvL.cjs"),Dt=require("./getSliderMarks-BzrpHrHS.cjs"),Nt=require("./Spinner-WHzzloYQ.cjs"),qt=require("./index-DQA8q5sC.cjs"),k=require("./index-DLFt97gy.cjs"),Bt=require("./Typography-BqmyF1gP.cjs"),Pt=require("./index-C5K--w8d.cjs"),$t=require("./Tooltip-Hr46paWP.cjs"),C=require("./Colors.cjs"),nt=require("./index-BhI7mBJx.cjs"),It=require("./DetailsModal-jmmKRMRM.cjs"),_t=require("./pow-BnyPO-NX.cjs"),jt=require("./select-Bnfk0lJx.cjs"),at=require("./proxy-CqH8m8IQ.cjs"),Wt=require("./use-in-view-dnRv_qqF.cjs"),zt=require("./index-FXfr51ZM.cjs"),Vt=require("./GraphFooter.cjs"),Lt=require("./GraphHeader.cjs"),Ct=require("./fetchAndParseData-QTF6tjij.cjs"),At=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Ft=require("./uniqBy-O05lp2S5.cjs"),wt=require("./GraphContainer-Cul9b74X.cjs");function Tt(n){const{data:e,colors:r,mapData:ee,colorLegendTitle:B,colorDomain:g,radius:M,height:x,width:p,scale:h,centerPoint:P,tooltip:te,showLabels:ge,mapBorderWidth:ye,mapBorderColor:ve,mapNoDataColor:je,onSeriesMouseOver:oe,showColorScale:Pe,zoomScaleExtend:$e,zoomTranslateExtend:Ie,highlightedDataPoints:be,onSeriesMouseClick:re,resetSelectionOnDoubleClick:Ee,detailsOnClick:v,styles:ae,classNames:z,mapProjection:V,zoomInteraction:w,animate:j,dimmedOpacity:ne,customLayers:L,maxRadiusValue:De,collapseColorScaleByDefault:Ce,projectionRotate:$,rewindCoordinatesInMapData:A,overlayMapData:F,overlayMapBorderColor:_e,overlayMapBorderWidth:We}=n,T=i.useMemo(()=>A?k.index_default(ee,{reverse:!0}):ee,[ee,A]),ze=i.useMemo(()=>!A||!F?F:k.index_default(F,{reverse:!0}),[F,A]),[ie,u]=i.useState(void 0),[m,we]=i.useState(Ce===void 0?!(p<680):!Ce),se=i.useRef(null),[le,ce]=i.useState(void 0),[G,I]=i.useState(void 0),[H,U]=i.useState(void 0),[X,ue]=i.useState(void 0),d=i.useRef(null),b=Wt.useInView(d,{once:j.once,amount:j.amount}),Y=i.useRef(null),R=e.filter(t=>t.radius===void 0||t.radius===null).length!==e.length?_t.sqrt().domain([0,De]).range([.25,M]).nice():void 0;i.useEffect(()=>{const t=jt.select(Y.current),f=jt.select(d.current),a=y=>{if(w==="noZoom")return!1;if(w==="button")return!y.type.includes("wheel");const Oe=y.type==="wheel",E=y.type.startsWith("touch"),W=y.type==="mousedown"||y.type==="mousemove";return E?!0:Oe?w==="scroll"?!0:y.ctrlKey:W&&!y.button&&!y.ctrlKey},Z=k.zoom().scaleExtent($e).translateExtent(Ie||[[-20,-20],[p+20,x+20]]).filter(a).on("zoom",({transform:y})=>{t.attr("transform",y)});f.call(Z),se.current=Z},[x,p,w]);const _=k.index_default$1(T),O=Pt.index_default(T),Re=(_[2]-_[0])*1.15,Se=(_[3]-_[1])*1.15,ke=p*190/960*360/Re,Me=x*190/678*180/Se,S=h*Math.min(ke,Me),J=V==="mercator"?k.geoMercator().rotate($).center(P||O.geometry.coordinates).translate([p/2,x/2]).scale(S):V==="equalEarth"?k.geoEqualEarth().rotate($).center(P||O.geometry.coordinates).translate([p/2,x/2]).scale(S):V==="naturalEarth"?k.geoNaturalEarth1().rotate($).center(P||O.geometry.coordinates).translate([p/2,x/2]).scale(S):V==="orthographic"?k.geoOrthographic().rotate($).center(P||O.geometry.coordinates).translate([p/2,x/2]).scale(S):k.geoAlbersUsa().rotate($).center(P||O.geometry.coordinates).translate([p/2,x/2]).scale(S),K=k.geoPath().projection(J),de=t=>{if(!d.current||!se.current)return;jt.select(d.current).call(se.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(at.motion.svg,{width:`${p}px`,height:`${x}px`,viewBox:`0 0 ${p} ${x}`,ref:d,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:Y,children:[L.filter(t=>t.position==="before").map(t=>t.layer),T.features.map((t,f)=>{const a=K(t);return a?o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ve,strokeWidth:ye,fill:je,vectorEffect:"non-scaling-stroke"}},f):null}),ze?.features.map((t,f)=>{const a=K(t);return a?o.jsxRuntimeExports.jsx("g",{children:o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:_e||ve,strokeWidth:We||ye+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},f):null}),o.jsxRuntimeExports.jsx(zt.AnimatePresence,{children:e.map(t=>{const f=e.filter(a=>a.color).length===0?r[0]:t.color?r[g.indexOf(`${t.color}`)]:C.Colors.gray;return o.jsxRuntimeExports.jsxs(at.motion.g,{className:"undp-map-dots",variants:{initial:{opacity:0},whileInView:{opacity:ie?ie===f?1:ne:be.length!==0?be.indexOf(t.label||"")!==-1?1:ne:1,transition:{duration:j.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:j.duration}},onMouseEnter:a=>{I(t),ue(a.clientY),U(a.clientX),oe?.(t)},onMouseMove:a=>{I(t),ue(a.clientY),U(a.clientX)},onMouseLeave:()=>{I(void 0),U(void 0),ue(void 0),oe?.(void 0)},onClick:()=>{(re||v)&&(qt.isEqual(le,t)&&Ee?(ce(void 0),re?.(void 0)):(ce(t),re?.(t)))},transform:`translate(${J([t.long,t.lat])[0]},${J([t.long,t.lat])[1]})`,children:[o.jsxRuntimeExports.jsx(at.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[g.indexOf(`${t.color}`)]:C.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[g.indexOf(`${t.color}`)]:C.Colors.gray},whileInView:{r:R?R(t.radius||0):M,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[g.indexOf(`${t.color}`)]:C.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[g.indexOf(`${t.color}`)]:C.Colors.gray,transition:{duration:j.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{r:0,transition:{duration:j.duration}},style:{fillOpacity:.8,vectorEffect:"non-scaling-stroke"}}),ge&&t.label?o.jsxRuntimeExports.jsx(at.motion.text,{variants:{initial:{opacity:0,x:R?R(t.radius||0):M,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[g.indexOf(`${t.color}`)]:C.Colors.gray},whileInView:{opacity:1,x:R?R(t.radius||0):M,transition:{duration:j.duration},fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[g.indexOf(`${t.color}`)]:C.Colors.gray}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:j.duration}},y:0,className:o.mo("graph-value text-sm",z?.graphObjectValues),style:{textAnchor:"start",vectorEffect:"non-scaling-stroke",...ae?.graphObjectValues||{}},dx:4,dy:5,children:t.label}):null]},t.label||`${t.lat}-${t.long}`)})}),L.filter(t=>t.position==="after").map(t=>t.layer)]})}),e.filter(t=>t.color).length===0||Pe===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",z?.colorLegend),children:m?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{we(!1)},children:o.jsxRuntimeExports.jsx(nt.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[B&&B!==""?o.jsxRuntimeExports.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:B}):null,o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:g.map((t,f)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{u(r[f%r.length])},onMouseLeave:()=>{u(void 0)},children:[o.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:r[f%r.length]}}),o.jsxRuntimeExports.jsx(Bt._,{size:"sm",marginBottom:"none",leading:"none",children:t})]},f))})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{we(!0)},children:o.jsxRuntimeExports.jsx(nt.ExpandIcon,{})})}),w==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>de("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>de("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),v&&le!==void 0?o.jsxRuntimeExports.jsx(It.DetailsModal,{body:v,data:le,setData:ce,className:z?.modal}):null,G&&te&&H&&X?o.jsxRuntimeExports.jsx($t.Tooltip,{data:G,body:te,xPos:H,yPos:X,backgroundStyle:ae?.tooltip,className:z?.tooltip}):null]})}function Gt(n){const e=o.compilerRuntimeExports.c(130),{data:r,mapData:ee,graphTitle:B,colors:g,sources:M,graphDescription:x,height:p,width:h,footNote:P,colorLegendTitle:te,colorDomain:ge,radius:ye,scale:ve,centerPoint:je,padding:oe,mapBorderWidth:Pe,mapNoDataColor:$e,backgroundColor:Ie,showLabels:be,mapBorderColor:re,tooltip:Ee,relativeHeight:v,onSeriesMouseOver:ae,isWorldMap:z,showColorScale:V,zoomScaleExtend:w,zoomTranslateExtend:j,graphID:ne,highlightedDataPoints:L,onSeriesMouseClick:De,graphDownload:Ce,dataDownload:$,showAntarctica:A,language:F,minHeight:_e,theme:We,ariaLabel:T,resetSelectionOnDoubleClick:ze,detailsOnClick:ie,styles:u,classNames:m,mapProjection:we,zoomInteraction:se,animate:le,dimmedOpacity:ce,customLayers:G,maxRadiusValue:I,timeline:H,collapseColorScaleByDefault:U,projectionRotate:X,rewindCoordinatesInMapData:ue,mapOverlay:d}=n,b=ee===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":ee,Y=P===void 0?"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.":P,R=ye===void 0?5:ye,_=ve===void 0?.95:ve,O=Pe===void 0?.5:Pe,Re=$e===void 0?C.Colors.light.graphNoData:$e,Se=Ie===void 0?!1:Ie,ke=be===void 0?!1:be,Me=re===void 0?C.Colors.light.grays["gray-500"]:re,S=z===void 0?!0:z,J=V===void 0?!0:V;let K;e[0]!==w?(K=w===void 0?[.8,6]:w,e[0]=w,e[1]=K):K=e[1];const de=K;let t;e[2]!==L?(t=L===void 0?[]:L,e[2]=L,e[3]=t):t=e[3];const f=t,a=Ce===void 0?!1:Ce,Z=$===void 0?!1:$,y=A===void 0?!1:A,Oe=F===void 0?"en":F,E=_e===void 0?0:_e,W=We===void 0?"light":We,it=ze===void 0?!0:ze,st=we===void 0?"naturalEarth":we,lt=se===void 0?"button":se,Ve=le===void 0?!1:le,ct=ce===void 0?.3:ce;let Le;e[4]!==G?(Le=G===void 0?[]:G,e[4]=G,e[5]=Le):Le=e[5];const ut=Le;let Ae;e[6]!==H?(Ae=H===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:H,e[6]=H,e[7]=Ae):Ae=e[7];const s=Ae;let Fe;e[8]!==X?(Fe=X===void 0?[0,0]:X,e[8]=X,e[9]=Fe):Fe=e[9];const dt=Fe,pt=ue===void 0?!0:ue,[Q,Rt]=i.useState(0),[Ne,St]=i.useState(0),[N,kt]=i.useState(s.autoplay);let qe;if(e[10]!==r||e[11]!==s.dateFormat){let l;e[13]!==s.dateFormat?(l=D=>Et.parse(`${D.date}`,s.dateFormat||"yyyy",new Date).getTime(),e[13]=s.dateFormat,e[14]=l):l=e[14],qe=[...new Set(r.filter(ro).map(l))],qe.sort(oo),e[10]=r,e[11]=s.dateFormat,e[12]=qe}else qe=e[12];const c=qe,[q,mt]=i.useState(s.autoplay?0:c.length-1),[pe,Mt]=i.useState(void 0),[ht,Ot]=i.useState(void 0),ft=i.useRef(null),bt=i.useRef(null);let Te,Ge;e[15]===Symbol.for("react.memo_cache_sentinel")?(Te=()=>{const l=new ResizeObserver(D=>{Rt(D[0].target.clientWidth||620),St(D[0].target.clientHeight||480)});return ft.current&&l.observe(ft.current),()=>l.disconnect()},Ge=[],e[15]=Te,e[16]=Ge):(Te=e[15],Ge=e[16]),i.useEffect(Te,Ge);let He;e[17]===Symbol.for("react.memo_cache_sentinel")?(He=l=>{Mt(l)},e[17]=He):He=e[17];const Ue=i.useEffectEvent(He);let Xe;e[18]===Symbol.for("react.memo_cache_sentinel")?(Xe=l=>{Ot(l)},e[18]=Xe):Xe=e[18];const Be=i.useEffectEvent(Xe);let Ye;e[19]!==b||e[20]!==Ue?(Ye=()=>{typeof b=="string"?Ct.fetchAndParseJSON(b).then(D=>{Ue(D)}):Ue(b)},e[19]=b,e[20]=Ue,e[21]=Ye):Ye=e[21];let Je;e[22]!==b?(Je=[b],e[22]=b,e[23]=Je):Je=e[23],i.useEffect(Ye,Je);let Ke;e[24]!==d?.mapData||e[25]!==Be?(Ke=()=>{d?.mapData||Be(void 0),typeof d?.mapData=="string"?Ct.fetchAndParseJSON(d?.mapData).then(D=>{Be(D)}):Be(d?.mapData)},e[24]=d?.mapData,e[25]=Be,e[26]=Ke):Ke=e[26];const xt=d?.mapData;let Ze;e[27]!==xt?(Ze=[xt],e[27]=xt,e[28]=Ze):Ze=e[28],i.useEffect(Ke,Ze);let Qe,et;e[29]!==N||e[30]!==s.speed||e[31]!==c?(Qe=()=>{const l=setInterval(()=>{mt(D=>D<c.length-1?D+1:0)},(s.speed||2)*1e3);return N||clearInterval(l),()=>clearInterval(l)},et=[c,N,s.speed],e[29]=N,e[30]=s.speed,e[31]=c,e[32]=Qe,e[33]=et):(Qe=e[32],et=e[33]),i.useEffect(Qe,et);const gt=s.dateFormat||"yyyy";let tt;e[34]!==q||e[35]!==gt||e[36]!==s.showOnlyActiveDate||e[37]!==c?(tt=Dt.getSliderMarks(c,q,s.showOnlyActiveDate,gt),e[34]=q,e[35]=gt,e[36]=s.showOnlyActiveDate,e[37]=c,e[38]=tt):tt=e[38];const ot=tt,yt=m?.graphContainer,vt=u?.graphContainer;let me;e[39]!==m?.description||e[40]!==m?.title||e[41]!==r||e[42]!==Z||e[43]!==x||e[44]!==a||e[45]!==B||e[46]!==u?.description||e[47]!==u?.title||e[48]!==h?(me=B||x||a||Z?o.jsxRuntimeExports.jsx(Lt.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:m?.title,description:m?.description},graphTitle:B,graphDescription:x,width:h,graphDownload:a?bt:void 0,dataDownload:Z?r.map(to).filter(eo).length>0?r.map(Qt).filter(Zt):r.filter(Kt):null}):null,e[39]=m?.description,e[40]=m?.title,e[41]=r,e[42]=Z,e[43]=x,e[44]=a,e[45]=B,e[46]=u?.description,e[47]=u?.title,e[48]=h,e[49]=me):me=e[49];let he;e[50]!==q||e[51]!==ot||e[52]!==N||e[53]!==s.enabled||e[54]!==c?(he=s.enabled&&c.length>0&&ot?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{kt(!N)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":N?"Click to pause animation":"Click to play animation",children:N?o.jsxRuntimeExports.jsx(nt.Pause,{}):o.jsxRuntimeExports.jsx(nt.Play,{})}),o.jsxRuntimeExports.jsx(Dt.Nr,{min:c[0],max:c[c.length-1],marks:ot,step:null,defaultValue:c[c.length-1],value:c[q],onChangeComplete:l=>{mt(c.indexOf(l))},onChange:l=>{mt(c.indexOf(l))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[50]=q,e[51]=ot,e[52]=N,e[53]=s.enabled,e[54]=c,e[55]=he):he=e[55];let fe;e[56]!==Ve||e[57]!==je||e[58]!==m||e[59]!==U||e[60]!==ge||e[61]!==te||e[62]!==g||e[63]!==ut||e[64]!==r||e[65]!==ie||e[66]!==ct||e[67]!==p||e[68]!==f||e[69]!==q||e[70]!==S||e[71]!==Me||e[72]!==O||e[73]!==Re||e[74]!==d?.mapBorderColor||e[75]!==d?.mapBorderWidth||e[76]!==st||e[77]!==pe||e[78]!==I||e[79]!==E||e[80]!==De||e[81]!==ae||e[82]!==ht||e[83]!==dt||e[84]!==R||e[85]!==v||e[86]!==it||e[87]!==pt||e[88]!==_||e[89]!==y||e[90]!==J||e[91]!==ke||e[92]!==u||e[93]!==Ne||e[94]!==Q||e[95]!==W||e[96]!==s.dateFormat||e[97]!==s.enabled||e[98]!==Ee||e[99]!==c||e[100]!==h||e[101]!==lt||e[102]!==de||e[103]!==j?(fe=o.jsxRuntimeExports.jsx(wt.GraphArea,{ref:ft,children:Q&&Ne&&pe?o.jsxRuntimeExports.jsx(Tt,{data:r.filter(l=>s.enabled?`${l.date}`===Et.format(new Date(c[q]),s.dateFormat||"yyyy"):l),mapData:y?pe:{...pe,features:pe.features.filter(Jt)},colorDomain:r.filter(Yt).length===0?[]:ge||Ft.uniqBy(r,"color",!0),width:Q,height:Ne,scale:_,centerPoint:je,colors:r.filter(Xt).length===0?g?[g]:[C.Colors.primaryColors["blue-600"]]:g||C.Colors[W].categoricalColors.colors,colorLegendTitle:te,radius:R,overlayMapData:ht,overlayMapBorderColor:d?.mapBorderColor,overlayMapBorderWidth:d?.mapBorderWidth,mapBorderWidth:O,mapNoDataColor:Re,mapBorderColor:Me,tooltip:Ee,onSeriesMouseOver:ae,showLabels:ke,isWorldMap:S,showColorScale:J,zoomScaleExtend:de,zoomTranslateExtend:j,onSeriesMouseClick:De,highlightedDataPoints:f,resetSelectionOnDoubleClick:it,styles:u,classNames:m,zoomInteraction:lt,detailsOnClick:ie,mapProjection:st||(S?"naturalEarth":"mercator"),animate:Ve===!0?{duration:.5,once:!0,amount:.5}:Ve||{duration:0,once:!0,amount:0},dimmedOpacity:ct,customLayers:ut,maxRadiusValue:At.checkIfNullOrUndefined(I)?Math.max(...r.map(Ut).filter(Ht)):I,collapseColorScaleByDefault:U,projectionRotate:dt,rewindCoordinatesInMapData:pt}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(E,p||(v?E?(h||Q)*v>E?(h||Q)*v:E:(h||Q)*v:Ne))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Nt.w,{"aria-label":"Loading graph"})})}),e[56]=Ve,e[57]=je,e[58]=m,e[59]=U,e[60]=ge,e[61]=te,e[62]=g,e[63]=ut,e[64]=r,e[65]=ie,e[66]=ct,e[67]=p,e[68]=f,e[69]=q,e[70]=S,e[71]=Me,e[72]=O,e[73]=Re,e[74]=d?.mapBorderColor,e[75]=d?.mapBorderWidth,e[76]=st,e[77]=pe,e[78]=I,e[79]=E,e[80]=De,e[81]=ae,e[82]=ht,e[83]=dt,e[84]=R,e[85]=v,e[86]=it,e[87]=pt,e[88]=_,e[89]=y,e[90]=J,e[91]=ke,e[92]=u,e[93]=Ne,e[94]=Q,e[95]=W,e[96]=s.dateFormat,e[97]=s.enabled,e[98]=Ee,e[99]=c,e[100]=h,e[101]=lt,e[102]=de,e[103]=j,e[104]=fe):fe=e[104];let xe;e[105]!==m?.footnote||e[106]!==m?.source||e[107]!==Y||e[108]!==M||e[109]!==u?.footnote||e[110]!==u?.source||e[111]!==h?(xe=M||Y?o.jsxRuntimeExports.jsx(Vt.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:m?.footnote,source:m?.source},sources:M,footNote:Y,width:h}):null,e[105]=m?.footnote,e[106]=m?.source,e[107]=Y,e[108]=M,e[109]=u?.footnote,e[110]=u?.source,e[111]=h,e[112]=xe):xe=e[112];let rt;return e[113]!==T||e[114]!==Se||e[115]!==ne||e[116]!==p||e[117]!==Oe||e[118]!==E||e[119]!==oe||e[120]!==v||e[121]!==yt||e[122]!==vt||e[123]!==me||e[124]!==he||e[125]!==fe||e[126]!==xe||e[127]!==W||e[128]!==h?(rt=o.jsxRuntimeExports.jsxs(wt.GraphContainer,{className:yt,style:vt,id:ne,ref:bt,"aria-label":T,backgroundColor:Se,theme:W,language:Oe,minHeight:E,width:h,height:p,relativeHeight:v,padding:oe,children:[me,he,fe,xe]}),e[113]=T,e[114]=Se,e[115]=ne,e[116]=p,e[117]=Oe,e[118]=E,e[119]=oe,e[120]=v,e[121]=yt,e[122]=vt,e[123]=me,e[124]=he,e[125]=fe,e[126]=xe,e[127]=W,e[128]=h,e[129]=rt):rt=e[129],rt}function Ht(n){return n!=null}function Ut(n){return n.radius}function Xt(n){return n.color}function Yt(n){return n.color}function Jt(n){return n.properties?.NAME!=="Antarctica"}function Kt(n){return n!==void 0}function Zt(n){return n!==void 0}function Qt(n){return n.data}function eo(n){return n!==void 0}function to(n){return n.data}function oo(n,e){return n-e}function ro(n){return n.date}exports.DotDensityMap=Gt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-D4pAp7u0.cjs"),i=require("react"),jt=require("./parse-xYI9yrvL.cjs"),bt=require("./getSliderMarks-BzrpHrHS.cjs"),Mt=require("./Spinner-WHzzloYQ.cjs"),Ot=require("./index-DQA8q5sC.cjs"),S=require("./index-DLFt97gy.cjs"),Nt=require("./Typography-BqmyF1gP.cjs"),qt=require("./index-C5K--w8d.cjs"),Bt=require("./Tooltip-Hr46paWP.cjs"),D=require("./Colors.cjs"),nt=require("./index-BhI7mBJx.cjs"),$t=require("./DetailsModal-jmmKRMRM.cjs"),It=require("./pow-BnyPO-NX.cjs"),yt=require("./select-Bnfk0lJx.cjs"),at=require("./proxy-CqH8m8IQ.cjs"),Pt=require("./use-in-view-dnRv_qqF.cjs"),_t=require("./index-FXfr51ZM.cjs"),Wt=require("./GraphFooter.cjs"),zt=require("./GraphHeader.cjs"),Et=require("./fetchAndParseData-QTF6tjij.cjs"),Vt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Lt=require("./uniqBy-O05lp2S5.cjs"),Dt=require("./GraphContainer-Cul9b74X.cjs");function At(n){const{data:e,colors:r,mapData:K,colorLegendTitle:q,colorDomain:y,radius:k,height:g,width:m,scale:x,centerPoint:B,tooltip:Z,showLabels:xe,mapBorderWidth:ge,mapBorderColor:ye,mapNoDataColor:ve,onSeriesMouseOver:Q,showColorScale:$e,zoomScaleExtend:Ie,zoomTranslateExtend:Pe,highlightedDataPoints:je,onSeriesMouseClick:ee,resetSelectionOnDoubleClick:be,detailsOnClick:v,styles:te,classNames:W,mapProjection:z,zoomInteraction:C,animate:j,dimmedOpacity:oe,customLayers:re,maxRadiusValue:Ee,collapseColorScaleByDefault:De,projectionRotate:$,rewindCoordinatesInMapData:V,overlayMapData:L,overlayMapBorderColor:_e,overlayMapBorderWidth:We}=n,A=i.useMemo(()=>V?S.index_default(K,{reverse:!0}):K,[K,V]),ze=i.useMemo(()=>!V||!L?L:S.index_default(L,{reverse:!0}),[L,V]),[ae,d]=i.useState(void 0),[f,Ce]=i.useState(De===void 0?!(m<680):!De),ne=i.useRef(null),[ie,se]=i.useState(void 0),[F,I]=i.useState(void 0),[T,G]=i.useState(void 0),[H,le]=i.useState(void 0),p=i.useRef(null),b=Pt.useInView(p,{once:j.once,amount:j.amount}),U=i.useRef(null),w=e.filter(t=>t.radius===void 0||t.radius===null).length!==e.length?It.sqrt().domain([0,Ee]).range([.25,k]).nice():void 0;i.useEffect(()=>{const t=yt.select(U.current),h=yt.select(p.current),a=u=>{if(C==="noZoom")return!1;if(C==="button")return!u.type.includes("wheel");const _=u.type==="wheel",Me=u.type.startsWith("touch"),Oe=u.type==="mousedown"||u.type==="mousemove";return Me?!0:_?C==="scroll"?!0:u.ctrlKey:Oe&&!u.button&&!u.ctrlKey},ue=S.zoom().scaleExtent(Ie).translateExtent(Pe||[[-20,-20],[m+20,g+20]]).filter(a).on("zoom",({transform:u})=>{t.attr("transform",u)});h.call(ue),ne.current=ue},[g,m,C]);const P=S.index_default$1(A),M=qt.index_default(A),we=(P[2]-P[0])*1.15,Re=(P[3]-P[1])*1.15,Se=m*190/960*360/we,ke=g*190/678*180/Re,R=x*Math.min(Se,ke),X=z==="mercator"?S.geoMercator().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):z==="equalEarth"?S.geoEqualEarth().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):z==="naturalEarth"?S.geoNaturalEarth1().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):z==="orthographic"?S.geoOrthographic().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):S.geoAlbersUsa().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R),Y=S.geoPath().projection(X),ce=t=>{if(!p.current||!ne.current)return;yt.select(p.current).call(ne.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(at.motion.svg,{width:`${m}px`,height:`${g}px`,viewBox:`0 0 ${m} ${g}`,ref:p,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:U,children:[re.filter(t=>t.position==="before").map(t=>t.layer),A.features.map((t,h)=>{const a=Y(t);return a?o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ye,strokeWidth:ge,fill:ve,vectorEffect:"non-scaling-stroke"}},h):null}),ze?.features.map((t,h)=>{const a=Y(t);return a?o.jsxRuntimeExports.jsx("g",{children:o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:_e||ye,strokeWidth:We||ge+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},h):null}),o.jsxRuntimeExports.jsx(_t.AnimatePresence,{children:e.map(t=>{const h=e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray;return o.jsxRuntimeExports.jsxs(at.motion.g,{className:"undp-map-dots",variants:{initial:{opacity:0},whileInView:{opacity:ae?ae===h?1:oe:je?je.indexOf(t.label||"")!==-1?1:oe:1,transition:{duration:j.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:j.duration}},onMouseEnter:a=>{I(t),le(a.clientY),G(a.clientX),Q?.(t)},onMouseMove:a=>{I(t),le(a.clientY),G(a.clientX)},onMouseLeave:()=>{I(void 0),G(void 0),le(void 0),Q?.(void 0)},onClick:()=>{(ee||v)&&(Ot.isEqual(ie,t)&&be?(se(void 0),ee?.(void 0)):(se(t),ee?.(t)))},transform:`translate(${X([t.long,t.lat])[0]},${X([t.long,t.lat])[1]})`,children:[o.jsxRuntimeExports.jsx(at.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray},whileInView:{r:w?w(t.radius||0):k,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray,transition:{duration:j.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{r:0,transition:{duration:j.duration}},style:{fillOpacity:.8,vectorEffect:"non-scaling-stroke"}}),xe&&t.label?o.jsxRuntimeExports.jsx(at.motion.text,{variants:{initial:{opacity:0,x:w?w(t.radius||0):k,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray},whileInView:{opacity:1,x:w?w(t.radius||0):k,transition:{duration:j.duration},fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:j.duration}},y:0,className:o.mo("graph-value text-sm",W?.graphObjectValues),style:{textAnchor:"start",vectorEffect:"non-scaling-stroke",...te?.graphObjectValues||{}},dx:4,dy:5,children:t.label}):null]},t.label||`${t.lat}-${t.long}`)})}),re.filter(t=>t.position==="after").map(t=>t.layer)]})}),e.filter(t=>t.color).length===0||$e===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",W?.colorLegend),children:f?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{Ce(!1)},children:o.jsxRuntimeExports.jsx(nt.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[q&&q!==""?o.jsxRuntimeExports.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:q}):null,o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:y.map((t,h)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{d(r[h%r.length])},onMouseLeave:()=>{d(void 0)},children:[o.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:r[h%r.length]}}),o.jsxRuntimeExports.jsx(Nt._,{size:"sm",marginBottom:"none",leading:"none",children:t})]},h))})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{Ce(!0)},children:o.jsxRuntimeExports.jsx(nt.ExpandIcon,{})})}),C==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>ce("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>ce("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),v&&ie!==void 0?o.jsxRuntimeExports.jsx($t.DetailsModal,{body:v,data:ie,setData:se,className:W?.modal}):null,F&&Z&&T&&H?o.jsxRuntimeExports.jsx(Bt.Tooltip,{data:F,body:Z,xPos:T,yPos:H,backgroundStyle:te?.tooltip,className:W?.tooltip}):null]})}function Ft(n){const e=o.compilerRuntimeExports.c(128),{data:r,mapData:K,graphTitle:q,colors:y,sources:k,graphDescription:g,height:m,width:x,footNote:B,colorLegendTitle:Z,colorDomain:xe,radius:ge,scale:ye,centerPoint:ve,padding:Q,mapBorderWidth:$e,mapNoDataColor:Ie,backgroundColor:Pe,showLabels:je,mapBorderColor:ee,tooltip:be,relativeHeight:v,onSeriesMouseOver:te,isWorldMap:W,showColorScale:z,zoomScaleExtend:C,zoomTranslateExtend:j,graphID:oe,highlightedDataPoints:re,onSeriesMouseClick:Ee,graphDownload:De,dataDownload:$,showAntarctica:V,language:L,minHeight:_e,theme:We,ariaLabel:A,resetSelectionOnDoubleClick:ze,detailsOnClick:ae,styles:d,classNames:f,mapProjection:Ce,zoomInteraction:ne,animate:ie,dimmedOpacity:se,customLayers:F,maxRadiusValue:I,timeline:T,collapseColorScaleByDefault:G,projectionRotate:H,rewindCoordinatesInMapData:le,mapOverlay:p}=n,b=K===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":K,U=B===void 0?"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.":B,w=ge===void 0?5:ge,P=ye===void 0?.95:ye,M=$e===void 0?.5:$e,we=Ie===void 0?D.Colors.light.graphNoData:Ie,Re=Pe===void 0?!1:Pe,Se=je===void 0?!1:je,ke=ee===void 0?D.Colors.light.grays["gray-500"]:ee,R=W===void 0?!0:W,X=z===void 0?!0:z;let Y;e[0]!==C?(Y=C===void 0?[.8,6]:C,e[0]=C,e[1]=Y):Y=e[1];const ce=Y,t=De===void 0?!1:De,h=$===void 0?!1:$,a=V===void 0?!1:V,ue=L===void 0?"en":L,u=_e===void 0?0:_e,_=We===void 0?"light":We,Me=ze===void 0?!0:ze,Oe=Ce===void 0?"naturalEarth":Ce,it=ne===void 0?"button":ne,Ve=ie===void 0?!1:ie,st=se===void 0?.3:se;let Le;e[2]!==F?(Le=F===void 0?[]:F,e[2]=F,e[3]=Le):Le=e[3];const lt=Le;let Ae;e[4]!==T?(Ae=T===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:T,e[4]=T,e[5]=Ae):Ae=e[5];const s=Ae;let Fe;e[6]!==H?(Fe=H===void 0?[0,0]:H,e[6]=H,e[7]=Fe):Fe=e[7];const ct=Fe,ut=le===void 0?!0:le,[J,Ct]=i.useState(0),[Ne,wt]=i.useState(0),[O,Rt]=i.useState(s.autoplay);let qe;if(e[8]!==r||e[9]!==s.dateFormat){let l;e[11]!==s.dateFormat?(l=E=>jt.parse(`${E.date}`,s.dateFormat||"yyyy",new Date).getTime(),e[11]=s.dateFormat,e[12]=l):l=e[12],qe=[...new Set(r.filter(to).map(l))],qe.sort(eo),e[8]=r,e[9]=s.dateFormat,e[10]=qe}else qe=e[10];const c=qe,[N,dt]=i.useState(s.autoplay?0:c.length-1),[de,St]=i.useState(void 0),[pt,kt]=i.useState(void 0),mt=i.useRef(null),vt=i.useRef(null);let Te,Ge;e[13]===Symbol.for("react.memo_cache_sentinel")?(Te=()=>{const l=new ResizeObserver(E=>{Ct(E[0].target.clientWidth||620),wt(E[0].target.clientHeight||480)});return mt.current&&l.observe(mt.current),()=>l.disconnect()},Ge=[],e[13]=Te,e[14]=Ge):(Te=e[13],Ge=e[14]),i.useEffect(Te,Ge);let He;e[15]===Symbol.for("react.memo_cache_sentinel")?(He=l=>{St(l)},e[15]=He):He=e[15];const Ue=i.useEffectEvent(He);let Xe;e[16]===Symbol.for("react.memo_cache_sentinel")?(Xe=l=>{kt(l)},e[16]=Xe):Xe=e[16];const Be=i.useEffectEvent(Xe);let Ye;e[17]!==b||e[18]!==Ue?(Ye=()=>{typeof b=="string"?Et.fetchAndParseJSON(b).then(E=>{Ue(E)}):Ue(b)},e[17]=b,e[18]=Ue,e[19]=Ye):Ye=e[19];let Je;e[20]!==b?(Je=[b],e[20]=b,e[21]=Je):Je=e[21],i.useEffect(Ye,Je);let Ke;e[22]!==p?.mapData||e[23]!==Be?(Ke=()=>{p?.mapData||Be(void 0),typeof p?.mapData=="string"?Et.fetchAndParseJSON(p?.mapData).then(E=>{Be(E)}):Be(p?.mapData)},e[22]=p?.mapData,e[23]=Be,e[24]=Ke):Ke=e[24];const ft=p?.mapData;let Ze;e[25]!==ft?(Ze=[ft],e[25]=ft,e[26]=Ze):Ze=e[26],i.useEffect(Ke,Ze);let Qe,et;e[27]!==O||e[28]!==s.speed||e[29]!==c?(Qe=()=>{const l=setInterval(()=>{dt(E=>E<c.length-1?E+1:0)},(s.speed||2)*1e3);return O||clearInterval(l),()=>clearInterval(l)},et=[c,O,s.speed],e[27]=O,e[28]=s.speed,e[29]=c,e[30]=Qe,e[31]=et):(Qe=e[30],et=e[31]),i.useEffect(Qe,et);const ht=s.dateFormat||"yyyy";let tt;e[32]!==N||e[33]!==ht||e[34]!==s.showOnlyActiveDate||e[35]!==c?(tt=bt.getSliderMarks(c,N,s.showOnlyActiveDate,ht),e[32]=N,e[33]=ht,e[34]=s.showOnlyActiveDate,e[35]=c,e[36]=tt):tt=e[36];const ot=tt,xt=f?.graphContainer,gt=d?.graphContainer;let pe;e[37]!==f?.description||e[38]!==f?.title||e[39]!==r||e[40]!==h||e[41]!==g||e[42]!==t||e[43]!==q||e[44]!==d?.description||e[45]!==d?.title||e[46]!==x?(pe=q||g||t||h?o.jsxRuntimeExports.jsx(zt.GraphHeader,{styles:{title:d?.title,description:d?.description},classNames:{title:f?.title,description:f?.description},graphTitle:q,graphDescription:g,width:x,graphDownload:t?vt:void 0,dataDownload:h?r.map(Qt).filter(Zt).length>0?r.map(Kt).filter(Jt):r.filter(Yt):null}):null,e[37]=f?.description,e[38]=f?.title,e[39]=r,e[40]=h,e[41]=g,e[42]=t,e[43]=q,e[44]=d?.description,e[45]=d?.title,e[46]=x,e[47]=pe):pe=e[47];let me;e[48]!==N||e[49]!==ot||e[50]!==O||e[51]!==s.enabled||e[52]!==c?(me=s.enabled&&c.length>0&&ot?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Rt(!O)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":O?"Click to pause animation":"Click to play animation",children:O?o.jsxRuntimeExports.jsx(nt.Pause,{}):o.jsxRuntimeExports.jsx(nt.Play,{})}),o.jsxRuntimeExports.jsx(bt.Nr,{min:c[0],max:c[c.length-1],marks:ot,step:null,defaultValue:c[c.length-1],value:c[N],onChangeComplete:l=>{dt(c.indexOf(l))},onChange:l=>{dt(c.indexOf(l))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[48]=N,e[49]=ot,e[50]=O,e[51]=s.enabled,e[52]=c,e[53]=me):me=e[53];let fe;e[54]!==Ve||e[55]!==ve||e[56]!==f||e[57]!==G||e[58]!==xe||e[59]!==Z||e[60]!==y||e[61]!==lt||e[62]!==r||e[63]!==ae||e[64]!==st||e[65]!==m||e[66]!==re||e[67]!==N||e[68]!==R||e[69]!==ke||e[70]!==M||e[71]!==we||e[72]!==p?.mapBorderColor||e[73]!==p?.mapBorderWidth||e[74]!==Oe||e[75]!==de||e[76]!==I||e[77]!==u||e[78]!==Ee||e[79]!==te||e[80]!==pt||e[81]!==ct||e[82]!==w||e[83]!==v||e[84]!==Me||e[85]!==ut||e[86]!==P||e[87]!==a||e[88]!==X||e[89]!==Se||e[90]!==d||e[91]!==Ne||e[92]!==J||e[93]!==_||e[94]!==s.dateFormat||e[95]!==s.enabled||e[96]!==be||e[97]!==c||e[98]!==x||e[99]!==it||e[100]!==ce||e[101]!==j?(fe=o.jsxRuntimeExports.jsx(Dt.GraphArea,{ref:mt,children:J&&Ne&&de?o.jsxRuntimeExports.jsx(At,{data:r.filter(l=>s.enabled?`${l.date}`===jt.format(new Date(c[N]),s.dateFormat||"yyyy"):l),mapData:a?de:{...de,features:de.features.filter(Xt)},colorDomain:r.filter(Ut).length===0?[]:xe||Lt.uniqBy(r,"color",!0),width:J,height:Ne,scale:P,centerPoint:ve,colors:r.filter(Ht).length===0?y?[y]:[D.Colors.primaryColors["blue-600"]]:y||D.Colors[_].categoricalColors.colors,colorLegendTitle:Z,radius:w,overlayMapData:pt,overlayMapBorderColor:p?.mapBorderColor,overlayMapBorderWidth:p?.mapBorderWidth,mapBorderWidth:M,mapNoDataColor:we,mapBorderColor:ke,tooltip:be,onSeriesMouseOver:te,showLabels:Se,isWorldMap:R,showColorScale:X,zoomScaleExtend:ce,zoomTranslateExtend:j,onSeriesMouseClick:Ee,highlightedDataPoints:re,resetSelectionOnDoubleClick:Me,styles:d,classNames:f,zoomInteraction:it,detailsOnClick:ae,mapProjection:Oe||(R?"naturalEarth":"mercator"),animate:Ve===!0?{duration:.5,once:!0,amount:.5}:Ve||{duration:0,once:!0,amount:0},dimmedOpacity:st,customLayers:lt,maxRadiusValue:Vt.checkIfNullOrUndefined(I)?Math.max(...r.map(Gt).filter(Tt)):I,collapseColorScaleByDefault:G,projectionRotate:ct,rewindCoordinatesInMapData:ut}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(u,m||(v?u?(x||J)*v>u?(x||J)*v:u:(x||J)*v:Ne))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Mt.w,{"aria-label":"Loading graph"})})}),e[54]=Ve,e[55]=ve,e[56]=f,e[57]=G,e[58]=xe,e[59]=Z,e[60]=y,e[61]=lt,e[62]=r,e[63]=ae,e[64]=st,e[65]=m,e[66]=re,e[67]=N,e[68]=R,e[69]=ke,e[70]=M,e[71]=we,e[72]=p?.mapBorderColor,e[73]=p?.mapBorderWidth,e[74]=Oe,e[75]=de,e[76]=I,e[77]=u,e[78]=Ee,e[79]=te,e[80]=pt,e[81]=ct,e[82]=w,e[83]=v,e[84]=Me,e[85]=ut,e[86]=P,e[87]=a,e[88]=X,e[89]=Se,e[90]=d,e[91]=Ne,e[92]=J,e[93]=_,e[94]=s.dateFormat,e[95]=s.enabled,e[96]=be,e[97]=c,e[98]=x,e[99]=it,e[100]=ce,e[101]=j,e[102]=fe):fe=e[102];let he;e[103]!==f?.footnote||e[104]!==f?.source||e[105]!==U||e[106]!==k||e[107]!==d?.footnote||e[108]!==d?.source||e[109]!==x?(he=k||U?o.jsxRuntimeExports.jsx(Wt.GraphFooter,{styles:{footnote:d?.footnote,source:d?.source},classNames:{footnote:f?.footnote,source:f?.source},sources:k,footNote:U,width:x}):null,e[103]=f?.footnote,e[104]=f?.source,e[105]=U,e[106]=k,e[107]=d?.footnote,e[108]=d?.source,e[109]=x,e[110]=he):he=e[110];let rt;return e[111]!==A||e[112]!==Re||e[113]!==oe||e[114]!==m||e[115]!==ue||e[116]!==u||e[117]!==Q||e[118]!==v||e[119]!==xt||e[120]!==gt||e[121]!==pe||e[122]!==me||e[123]!==fe||e[124]!==he||e[125]!==_||e[126]!==x?(rt=o.jsxRuntimeExports.jsxs(Dt.GraphContainer,{className:xt,style:gt,id:oe,ref:vt,"aria-label":A,backgroundColor:Re,theme:_,language:ue,minHeight:u,width:x,height:m,relativeHeight:v,padding:Q,children:[pe,me,fe,he]}),e[111]=A,e[112]=Re,e[113]=oe,e[114]=m,e[115]=ue,e[116]=u,e[117]=Q,e[118]=v,e[119]=xt,e[120]=gt,e[121]=pe,e[122]=me,e[123]=fe,e[124]=he,e[125]=_,e[126]=x,e[127]=rt):rt=e[127],rt}function Tt(n){return n!=null}function Gt(n){return n.radius}function Ht(n){return n.color}function Ut(n){return n.color}function Xt(n){return n.properties?.NAME!=="Antarctica"}function Yt(n){return n!==void 0}function Jt(n){return n!==void 0}function Kt(n){return n.data}function Zt(n){return n!==void 0}function Qt(n){return n.data}function eo(n,e){return n-e}function to(n){return n.date}exports.DotDensityMap=Ft;
2
2
  //# sourceMappingURL=DotDensityMap.cjs.map