@undp/data-viz 2.2.3 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.d.ts +4 -0
- package/dist/BiVariateChoroplethMap.js +328 -401
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.d.ts +4 -0
- package/dist/ChoroplethMap.js +341 -416
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/Data/01.json +4042 -0
- package/dist/Data/mapData.json +4543 -0
- package/dist/Data/testMap.json +361 -0
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.d.ts +4 -0
- package/dist/DotDensityMap.js +297 -311
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/{GraphEl-C1Rz1V__.js → GraphEl-L5hNe7wJ.js} +25 -17
- package/dist/GraphEl-L5hNe7wJ.js.map +1 -0
- package/dist/GraphEl-ic8C5Ksc.cjs +2 -0
- package/dist/GraphEl-ic8C5Ksc.cjs.map +1 -0
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.d.ts +2 -0
- package/dist/GriddedGraphs.js +1 -1
- package/dist/GriddedGraphsFromConfig.d.ts +2 -0
- package/dist/HybridMap.cjs +1 -1
- package/dist/HybridMap.cjs.map +1 -1
- package/dist/HybridMap.d.ts +4 -0
- package/dist/HybridMap.js +398 -445
- package/dist/HybridMap.js.map +1 -1
- package/dist/MultiGraphDashboard.d.ts +2 -0
- package/dist/MultiGraphDashboardFromConfig.d.ts +2 -0
- package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +2 -0
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +2 -0
- package/dist/PerformanceIntensiveScrollStory.d.ts +2 -0
- package/dist/ScrollStory.d.ts +2 -0
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.d.ts +2 -0
- package/dist/SingleGraphDashboard.js +1 -1
- package/dist/SingleGraphDashboardFromConfig.d.ts +2 -0
- package/dist/SingleGraphDashboardGeoHubMaps.d.ts +2 -0
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +2 -0
- package/dist/SingleGraphDashboardThreeDGraphs.d.ts +2 -0
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +2 -0
- package/dist/Types.d.ts +2 -0
- package/dist/index-DLFt97gy.cjs +2 -0
- package/dist/index-DLFt97gy.cjs.map +1 -0
- package/dist/index-Dp_SfsUA.js +2344 -0
- package/dist/index-Dp_SfsUA.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/package.json +2 -1
- package/readme.md +0 -7
- package/dist/GraphEl-BZbunD1_.cjs +0 -2
- package/dist/GraphEl-BZbunD1_.cjs.map +0 -1
- package/dist/GraphEl-C1Rz1V__.js.map +0 -1
- package/dist/zoom-5AkJSuWO.js +0 -1864
- package/dist/zoom-5AkJSuWO.js.map +0 -1
- package/dist/zoom-ChcvXFIz.cjs +0 -2
- package/dist/zoom-ChcvXFIz.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BiVariateChoroplethMap.js","sources":["../src/Components/Graphs/Maps/BiVariateMap/Graph.tsx","../src/Components/Graphs/Maps/BiVariateMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\n\r\ninterface Props {\r\n data: BivariateMapDataType[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n showColorScale: boolean;\r\n collapseColorScaleByDefault?: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n zoomAndCenterByHighlightedIds: boolean;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds,\r\n } = props;\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n const bounds = bbox({\r\n ...mapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? mapData.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 : mapData.features,\r\n });\r\n\r\n const center = centerOfMass({\r\n ...mapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? mapData.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 : mapData.features,\r\n });\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <motion.g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </motion.g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n d={masterPath}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={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={{ width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-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 border text-primary-gray-700 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 {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <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 </>\r\n );\r\n}\r\n","import { useEffect, useEffectEvent, useMemo, useRef, useState } 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\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects. */\r\n data: BivariateMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Toggle if the map is centered and zoomed to the highlighted ids. */\r\n zoomAndCenterByHighlightedIds?: boolean;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds = false,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const onUpdateShape = useEffectEvent((shape: any) => {\r\n setMapShape(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\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\r\n }\r\n return (\r\n <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 === format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n zoomAndCenterByHighlightedIds={zoomAndCenterByHighlightedIds}\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","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","zoomAndCenterByHighlightedIds","showLegend","setShowLegend","useState","undefined","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","once","amount","mapG","zoomRef","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","xRange","Array","from","_","i","yRange","xScale","scaleThreshold","domain","range","yScale","handleZoom","direction","svg","scaleBy","jsxs","Fragment","jsx","motion","position","map","layer","findIndex","el","id","j","masterPath","forEach","geo","path","c","k","point","stroke","strokeWidth","fill","AnimatePresence","index","xColorCoord","checkIfNullOrUndefined","x","yColorCoord","y","color","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","cn","colorLegend","X","cursor","numberFormattingFunction","max","P","display","WebkitLineClamp","WebkitBoxOrient","overflow","writingMode","Tooltip","DetailsModal","modal","BiVariateChoroplethMap","$","_c","graphTitle","t0","t1","sources","graphDescription","footNote","t2","t3","t4","t5","padding","t6","t7","backgroundColor","t8","t9","relativeHeight","isWorldMap","t10","t11","graphID","t12","t13","t14","graphDownload","t15","dataDownload","t16","showAntarctica","t17","language","t18","minHeight","t19","theme","t20","ariaLabel","t21","t22","t23","t24","t25","timeline","t26","t27","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t28","t29","t30","t31","enabled","autoplay","showOnlyActiveDate","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t32","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","t33","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t34","shape","onUpdateShape","useEffectEvent","t35","fetchAndParseJSON","then","d_1","t36","t37","t38","speed","interval","setInterval","clearInterval","t39","t40","getSliderMarks","markObj","console","error","t41","graphContainer","t42","t43","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t44","Pause","Play","SliderUI","nextValue","nextValue_0","t45","GraphArea","d_7","format","_temp8","getJenks","_temp9","_temp0","Spinner","t46","footnote","source","GraphFooter","t47","GraphContainer","d_9","d_8","NAME","d_4","d_3","d_2","d_6","d_5","a","b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8EO,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AAA,SA4J6CtP,MAAM9C;AAAS;AA5J5D,SAAAwQ,GAAA6B,GAAA;AAAA,SA4JyBvP,EAAClF;AAAK;AA5J/B,SAAA2S,GAAA+B,GAAA;AAAA,SA2J2CxP,MAAM9C;AAAS;AA3J1D,SAAAsQ,GAAAiC,GAAA;AAAA,SA2JuBzP,EAAClF;AAAK;AA3J7B,SAAA4P,GAAAgF,GAAAC,GAAA;AAAA,SAiEkBD,IAAIC;AAAC;AAjEvB,SAAAnF,GAAAxK,GAAA;AAAA,SA6DgBA,EAACoK;AAAK;"}
|
|
1
|
+
{"version":3,"file":"BiVariateChoroplethMap.js","sources":["../src/Components/Graphs/Maps/BiVariateMap/Graph.tsx","../src/Components/Graphs/Maps/BiVariateMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { useEffect, 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 } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { FeatureCollection } from 'geojson';\r\nimport rewind from '@turf/rewind';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\n\r\ninterface Props {\r\n data: BivariateMapDataType[];\r\n mapData: FeatureCollection;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n showColorScale: boolean;\r\n collapseColorScaleByDefault?: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n zoomAndCenterByHighlightedIds: boolean;\r\n projectionRotate: [number, number] | [number, number, number];\r\n rewindCoordinatesInMapData: boolean;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds,\r\n projectionRotate,\r\n rewindCoordinatesInMapData,\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 [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n 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];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate(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\r\n const pathGenerator = geoPath().projection(projection);\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {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 }}\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 xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n <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 className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\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 }}\r\n />\r\n ))\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={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={{ width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-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 border text-primary-gray-700 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 {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <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 </>\r\n );\r\n}\r\n","import { useEffect, useEffectEvent, useMemo, useRef, useState } 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\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects. */\r\n data: BivariateMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** 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 /** 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 /** Toggle if the map is centered and zoomed to the highlighted ids. */\r\n zoomAndCenterByHighlightedIds?: boolean;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection = '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 zoomAndCenterByHighlightedIds = false,\r\n projectionRotate = [0, 0],\r\n rewindCoordinatesInMapData = true,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const onUpdateShape = useEffectEvent((shape: any) => {\r\n setMapShape(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\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\r\n }\r\n return (\r\n <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 === format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n zoomAndCenterByHighlightedIds={zoomAndCenterByHighlightedIds}\r\n projectionRotate={projectionRotate}\r\n rewindCoordinatesInMapData={rewindCoordinatesInMapData}\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","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","zoomAndCenterByHighlightedIds","projectionRotate","rewindCoordinatesInMapData","formattedMapData","useMemo","rewind","reverse","showLegend","setShowLegend","useState","undefined","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","once","amount","mapG","zoomRef","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","xRange","Array","from","_","i","yRange","xScale","scaleThreshold","domain","range","yScale","handleZoom","direction","svg","scaleBy","jsxs","Fragment","jsx","motion","position","map","layer","path","stroke","strokeWidth","fill","AnimatePresence","index","findIndex","el","id","xColorCoord","checkIfNullOrUndefined","x","yColorCoord","y","color","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","cn","colorLegend","X","j","cursor","numberFormattingFunction","max","P","display","WebkitLineClamp","WebkitBoxOrient","overflow","writingMode","Tooltip","DetailsModal","modal","BiVariateChoroplethMap","$","_c","graphTitle","t0","t1","sources","graphDescription","footNote","t2","t3","t4","t5","padding","t6","t7","backgroundColor","t8","t9","relativeHeight","isWorldMap","t10","t11","graphID","t12","t13","t14","graphDownload","t15","dataDownload","t16","showAntarctica","t17","language","t18","minHeight","t19","theme","t20","ariaLabel","t21","t22","t23","t24","t25","t26","timeline","t27","t28","t29","t30","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t31","t32","t33","t34","enabled","autoplay","showOnlyActiveDate","t35","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t36","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","t37","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t38","shape","onUpdateShape","useEffectEvent","t39","fetchAndParseJSON","then","d_1","t40","t41","t42","speed","interval","setInterval","clearInterval","t43","t44","getSliderMarks","markObj","console","error","t45","graphContainer","t46","t47","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t48","Pause","Play","SliderUI","nextValue","nextValue_0","t49","GraphArea","d_7","format","_temp8","getJenks","_temp9","_temp0","Spinner","t50","footnote","source","GraphFooter","t51","GraphContainer","d_9","d_8","NAME","d_4","d_3","d_2","d_6","d_5","a","b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiFO,SAASA,GAAMC,GAAc;AAClC,QAAM;AAAA,IACJC,MAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,mBAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,mBAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,QAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,mBAAAA;AAAAA,IACAC,iBAAAA;AAAAA,IACAC,qBAAAA;AAAAA,IACAC,gBAAAA;AAAAA,IACAC,oBAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,6BAAAA;AAAAA,IACAC,gBAAAA;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,kBAAAA;AAAAA,IACAC,4BAAAA;AAAAA,EAAAA,IACEnC,GACEoC,IAAmBC,GAAQ,MAC1BF,KAEEG,GAAOnC,GAAS;AAAA,IAAEoC,SAAS;AAAA,EAAA,CAAM,IAFApC,GAGvC,CAACA,GAASgC,EAA0B,CAAC,GAClC,CAACK,IAAYC,EAAa,IAAIC,EAClCV,OAAgCW,SAAY,EAAEpC,IAAQ,OAAO,CAACyB,EAChE,GACM,CAACY,GAAeC,EAAgB,IAAIH,EAA6BC,MAAS,GAE1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,SAAAY,IAAAZ,SAAAkB,GAAAlB,SAAAwH,IAAAxH,SAAA0H,IAAA1H,SAAA2H,IAAA3H,SAAAoI,IAAApI,SAAA0I,IAAA1I,SAAAmJ,IAAAnJ,SAAAoC,IAAApC,SAAA3K,GAAA2K,SAAAuJ,MAAAA,KAAAvJ,EAAA,GAAA,GA1KjBuJ;AA0KiB;AAxSd,SAAAN,GAAAQ,GAAA;AAAA,SA8NuBlP,EAAC4D;AAA+B;AA9NvD,SAAA6K,GAAAU,GAAA;AAAA,SAuNuBnP,EAAC0D;AAA+B;AAvNvD,SAAA6K,GAAAjL,GAAA;AAAA,SAgN4BA,EAAEnD,WAAWiP,SAAU;AAAY;AAhN/D,SAAAxB,GAAAyB,GAAA;AAAA,SA+J4BrP,MAAM9C;AAAS;AA/J3C,SAAAyQ,GAAA2B,GAAA;AAAA,SA8J6CtP,MAAM9C;AAAS;AA9J5D,SAAAwQ,GAAA6B,GAAA;AAAA,SA8JyBvP,EAACxF;AAAK;AA9J/B,SAAAiT,GAAA+B,GAAA;AAAA,SA6J2CxP,MAAM9C;AAAS;AA7J1D,SAAAsQ,GAAAiC,GAAA;AAAA,SA6JuBzP,EAACxF;AAAK;AA7J7B,SAAAkQ,GAAAgF,GAAAC,GAAA;AAAA,SAmEkBD,IAAIC;AAAC;AAnEvB,SAAAnF,GAAAxK,GAAA;AAAA,SA+DgBA,EAACoK;AAAK;"}
|
package/dist/ChoroplethMap.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-6v2a2njQ.cjs"),x=require("react"),mt=require("./getSliderMarks-CIuSoedo.cjs"),vt=require("./Spinner-jTMOLuw_.cjs"),pt=require("./parse-xYI9yrvL.cjs"),bt=require("./index-DQA8q5sC.cjs"),re=require("./zoom-ChcvXFIz.cjs"),ht=require("./Typography-sa1UE0oF.cjs"),Et=require("./index-C5K--w8d.cjs"),kt=require("./numberFormattingFunction-02t-wJta.cjs"),wt=require("./Tooltip-BLa2EfMs.cjs"),Rt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),dt=require("./index-C6er0ety.cjs"),Ct=require("./DetailsModal-DHttOA80.cjs"),St=require("./ordinal-CrsysVE-.cjs"),$t=require("./threshold-DNsSUf8Q.cjs"),ct=require("./select-Bnfk0lJx.cjs"),Ke=require("./proxy-C4-uo6nS.cjs"),Dt=require("./use-in-view-C3o_ntMv.cjs"),Nt=require("./index-CoobIWNj.cjs"),Mt=require("./GraphFooter.cjs"),Ot=require("./GraphHeader.cjs"),Ze=require("./Colors.cjs"),qt=require("./fetchAndParseData-QTF6tjij.cjs"),It=require("./getUniqValue-NX8DgwND.cjs"),Pt=require("./getJenks-BzJvhy_H.cjs"),xt=require("./GraphContainer-B1EDxJ0S.cjs");function zt(h){const{data:e,colorDomain:l,colors:d,mapData:b,colorLegendTitle:N,categorical:V,height:w,width:j,scale:E,centerPoint:_,tooltip:ae,mapBorderWidth:H,mapBorderColor:Y,mapNoDataColor:se,onSeriesMouseOver:ne,showColorScale:ve,zoomScaleExtend:Me,zoomTranslateExtend:Oe,highlightedIds:D,onSeriesMouseClick:ie,mapProperty:k,resetSelectionOnDoubleClick:be,detailsOnClick:J,styles:qe,classNames:le,mapProjection:q,zoomInteraction:I,animate:S,dimmedOpacity:P,customLayers:ce,collapseColorScaleByDefault:Ee,zoomAndCenterByHighlightedIds:ke}=h,[M,z]=x.useState(void 0),de=x.useRef(null),[Ie,we]=x.useState(Ee===void 0?!(j<680):!Ee),[K,ue]=x.useState(void 0),[G,g]=x.useState(void 0),[y,Z]=x.useState(void 0),[Re,me]=x.useState(void 0),U=x.useRef(null),X=Dt.useInView(U,{once:S.once,amount:S.amount}),Q=x.useRef(null),Ce=V?St.ordinal().domain(l).range(d):$t.threshold().domain(l).range(d);x.useEffect(()=>{const o=ct.select(Q.current),i=ct.select(U.current),v=r=>{if(I==="noZoom")return!1;if(I==="button")return!r.type.includes("wheel");const n=r.type==="wheel",c=r.type.startsWith("touch"),s=r.type==="mousedown"||r.type==="mousemove";return c?!0:n?I==="scroll"?!0:r.ctrlKey:s&&!r.button&&!r.ctrlKey},a=re.zoom().scaleExtent(Me).translateExtent(Oe||[[-20,-20],[j+20,w+20]]).filter(v).on("zoom",({transform:r})=>{o.attr("transform",r)});i.call(a),de.current=a},[w,j,I]);const ee=re.index_default({...b,features:ke?b.features.filter(o=>(D||[]).length===0||D.indexOf(o.properties[k])!==-1):b.features}),R=Et.index_default({...b,features:ke?b.features.filter(o=>(D||[]).length===0||D.indexOf(o.properties[k])!==-1):b.features}),pe=ee[2]-ee[0],L=ee[3]-ee[1],Se=j*190/960*360/pe,$e=w*190/678*180/L,A=E*Math.min(Se,$e),O=q==="mercator"?re.geoMercator().rotate([0,0]).center(_||R.geometry.coordinates).translate([j/2,w/2]).scale(A):q==="equalEarth"?re.geoEqualEarth().rotate([0,0]).center(_||R.geometry.coordinates).translate([j/2,w/2]).scale(A):q==="naturalEarth"?re.geoNaturalEarth1().rotate([0,0]).center(_||R.geometry.coordinates).translate([j/2,w/2]).scale(A):q==="orthographic"?re.geoOrthographic().rotate([0,0]).center(_||R.geometry.coordinates).translate([j/2,w/2]).scale(A):re.geoAlbersUsa().rotate([0,0]).center(_||R.geometry.coordinates).translate([j/2,w/2]).scale(A),he=o=>{if(!U.current||!de.current)return;ct.select(U.current).call(de.current.scaleBy,o==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(Ke.motion.svg,{width:`${j}px`,height:`${w}px`,viewBox:`0 0 ${j} ${w}`,ref:U,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:Q,children:[ce.filter(o=>o.position==="before").map(o=>o.layer),b.features.map((o,i)=>e.findIndex(a=>a.id===o.properties[k])!==-1?null:t.jsxRuntimeExports.jsx("g",{opacity:M?P:D.length!==0?D.indexOf(o.properties[k])!==-1?1:P:1,children:o.geometry.type==="MultiPolygon"?o.geometry.coordinates.map((a,r)=>{let n="";return a.forEach(c=>{let s=" M";c.forEach((m,$)=>{const C=O([m[0],m[1]]);$!==c.length-1?s=`${s}${C[0]} ${C[1]}L`:s=`${s}${C[0]} ${C[1]}`}),n+=s}),t.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:Y,strokeWidth:H,fill:se}},r)}):o.geometry.coordinates.map((a,r)=>{let n="M";return a.forEach((c,s)=>{const m=O([c[0],c[1]]);s!==a.length-1?n=`${n}${m[0]} ${m[1]}L`:n=`${n}${m[0]} ${m[1]}`}),t.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:Y,strokeWidth:H,fill:se}},r)})},i)),t.jsxRuntimeExports.jsx(Nt.AnimatePresence,{children:e.map(o=>{const i=b.features.findIndex(a=>o.id===a.properties[k]),v=Rt.checkIfNullOrUndefined(o.x)?se:Ce(o.x);return t.jsxRuntimeExports.jsx(Ke.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:M?M===v?1:P:D.length!==0?D.indexOf(o.id)!==-1?1:P:1,transition:{duration:S.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},onMouseEnter:a=>{g(o),me(a.clientY),Z(a.clientX),ne?.(o)},onMouseMove:a=>{g(o),me(a.clientY),Z(a.clientX)},onMouseLeave:()=>{g(void 0),Z(void 0),me(void 0),ne?.(void 0)},onClick:()=>{(ie||J)&&(bt.isEqual(K,o)&&be?(ue(void 0),ie?.(void 0)):(ue(o),ie?.(o)))},children:i===-1?null:b.features[i].geometry.type==="MultiPolygon"?b.features[i].geometry.coordinates.map((a,r)=>{let n="";return a.forEach(c=>{let s=" M";c.forEach((m,$)=>{const C=O([m[0],m[1]]);$!==c.length-1?s=`${s}${C[0]} ${C[1]}L`:s=`${s}${C[0]} ${C[1]}`}),n+=s}),t.jsxRuntimeExports.jsx(Ke.motion.path,{d:n,variants:{initial:{fill:v,opacity:0},whileInView:{fill:v,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},style:{stroke:Y,strokeWidth:H}},`${o.id}-${r}`)}):b.features[i].geometry.coordinates.map((a,r)=>{let n="M";return a.forEach((c,s)=>{const m=O([c[0],c[1]]);s!==a.length-1?n=`${n}${m[0]} ${m[1]}L`:n=`${n}${m[0]} ${m[1]}`}),t.jsxRuntimeExports.jsx(Ke.motion.path,{d:n,variants:{initial:{fill:v,opacity:0},whileInView:{fill:v,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},style:{stroke:Y,strokeWidth:H}},`${o.id}-${r}`)})},o.id)})}),G?b.features.filter(o=>o.properties[k]===G.id).map((o,i)=>t.jsxRuntimeExports.jsx("g",{children:o.geometry.type==="MultiPolygon"?o.geometry.coordinates.map((v,a)=>{let r="";return v.forEach(n=>{let c=" M";n.forEach((s,m)=>{const $=O([s[0],s[1]]);m!==n.length-1?c=`${c}${$[0]} ${$[1]}L`:c=`${c}${$[0]} ${$[1]}`}),r+=c}),t.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)}):o.geometry.coordinates.map((v,a)=>{let r="M";return v.forEach((n,c)=>{const s=O([n[0],n[1]]);c!==v.length-1?r=`${r}${s[0]} ${s[1]}L`:r=`${r}${s[0]} ${s[1]}`}),t.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)})},i)):null,ce.filter(o=>o.position==="after").map(o=>o.layer)]})}),ve===!1?null:t.jsxRuntimeExports.jsx("div",{className:t.mo("absolute left-4 bottom-4 map-color-legend",le?.colorLegend),children:Ie?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.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:t.jsxRuntimeExports.jsx(dt.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]",style:{width:V?void 0:"340px"},children:[N&&N!==""?t.jsxRuntimeExports.jsx(ht.j,{size:"xs",marginBottom:"xs",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:N}):null,V?t.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:l.map((o,i)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{z(d[i%d.length])},onMouseLeave:()=>{z(void 0)},children:[t.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:d[i%d.length]}}),t.jsxRuntimeExports.jsx(ht.j,{size:"sm",marginBottom:"none",leading:"none",children:o})]},i))}):t.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{children:[l.map((o,i)=>t.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{z(d[i])},onMouseLeave:()=>{z(void 0)},className:"cursor-pointer",children:[t.jsxRuntimeExports.jsx("rect",{x:i*320/d.length+1,y:1,width:320/d.length-2,height:8,className:M===d[i]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":"",style:{fill:d[i],...M===d[i]?{}:{stroke:d[i]}}}),t.jsxRuntimeExports.jsx("text",{x:(i+1)*320/d.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:kt.numberFormattingFunction(o,"NA")})]},i)),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("rect",{onMouseOver:()=>{z(d[l.length])},onMouseLeave:()=>{z(void 0)},x:l.length*320/d.length+1,y:1,width:320/d.length-2,height:8,className:`cursor-pointer ${M===d[l.length]?"stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:d[l.length],...M===d[l.length]?{}:{stroke:d[l.length]}}})})]})})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start map-legend-button",onClick:()=>{we(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),I==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>he("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:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>he("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:"–"})]})]}),J&&K!==void 0?t.jsxRuntimeExports.jsx(Ct.DetailsModal,{body:J,data:K,setData:ue,className:le?.modal}):null,G&&ae&&y&&Re?t.jsxRuntimeExports.jsx(wt.Tooltip,{data:G,body:ae,xPos:y,yPos:Re,backgroundStyle:qe?.tooltip,className:le?.tooltip}):null]})}function Lt(h){const e=t.compilerRuntimeExports.c(122),{data:l,mapData:d,graphTitle:b,colors:N,sources:V,graphDescription:w,height:j,width:E,footNote:_,colorDomain:ae,colorLegendTitle:H,scaleType:Y,scale:se,centerPoint:ne,padding:ve,mapBorderWidth:Me,mapNoDataColor:Oe,backgroundColor:D,mapBorderColor:ie,relativeHeight:k,tooltip:be,onSeriesMouseOver:J,isWorldMap:qe,showColorScale:le,zoomScaleExtend:q,zoomTranslateExtend:I,graphID:S,highlightedIds:P,onSeriesMouseClick:ce,mapProperty:Ee,graphDownload:ke,dataDownload:M,showAntarctica:z,language:de,minHeight:Ie,theme:we,ariaLabel:K,resetSelectionOnDoubleClick:ue,detailsOnClick:G,styles:g,classNames:y,mapProjection:Z,zoomInteraction:Re,animate:me,dimmedOpacity:U,customLayers:X,timeline:Q,collapseColorScaleByDefault:Ce,zoomAndCenterByHighlightedIds:ee}=h,R=d===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":d,pe=_===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.":_,L=Y===void 0?"threshold":Y,Se=se===void 0?.95:se,$e=Me===void 0?.5:Me,A=Oe===void 0?Ze.Colors.light.graphNoData:Oe,O=D===void 0?!1:D,he=ie===void 0?Ze.Colors.light.grays["gray-500"]:ie,o=qe===void 0?!0:qe,i=le===void 0?!0:le;let v;e[0]!==q?(v=q===void 0?[.8,6]:q,e[0]=q,e[1]=v):v=e[1];const a=v;let r;e[2]!==P?(r=P===void 0?[]:P,e[2]=P,e[3]=r):r=e[3];const n=r,c=Ee===void 0?"ISO3":Ee,s=ke===void 0?!1:ke,m=M===void 0?!1:M,$=z===void 0?!1:z,C=de===void 0?"en":de,B=Ie===void 0?0:Ie,te=we===void 0?"light":we,Qe=ue===void 0?!0:ue,et=Re===void 0?"button":Re,Pe=me===void 0?!1:me,tt=U===void 0?.3:U;let ze;e[4]!==X?(ze=X===void 0?[]:X,e[4]=X,e[5]=ze):ze=e[5];const ot=ze;let Le;e[6]!==Q?(Le=Q===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:Q,e[6]=Q,e[7]=Le):Le=e[7];const u=Le,rt=ee===void 0?!1:ee,[oe,gt]=x.useState(0),[De,ft]=x.useState(0),[F,yt]=x.useState(u.autoplay);let Ne;if(e[8]!==l||e[9]!==u.dateFormat){let f;e[11]!==u.dateFormat?(f=T=>pt.parse(`${T.date}`,u.dateFormat||"yyyy",new Date).getTime(),e[11]=u.dateFormat,e[12]=f):f=e[12],Ne=[...new Set(l.filter(Gt).map(f))],Ne.sort(Ht),e[8]=l,e[9]=u.dateFormat,e[10]=Ne}else Ne=e[10];const p=Ne,[W,at]=x.useState(u.autoplay?0:p.length-1),[xe,jt]=x.useState(void 0),st=x.useRef(null),ut=x.useRef(null);let Ae,Be;e[13]===Symbol.for("react.memo_cache_sentinel")?(Ae=()=>{const f=new ResizeObserver(T=>{gt(T[0].target.clientWidth||620),ft(T[0].target.clientHeight||480)});return st.current&&f.observe(st.current),()=>f.disconnect()},Be=[],e[13]=Ae,e[14]=Be):(Ae=e[13],Be=e[14]),x.useEffect(Ae,Be);let Fe;e[15]===Symbol.for("react.memo_cache_sentinel")?(Fe=f=>{jt(f)},e[15]=Fe):Fe=e[15];const We=x.useEffectEvent(Fe);let Te;e[16]!==R||e[17]!==We?(Te=()=>{typeof R=="string"?qt.fetchAndParseJSON(R).then(T=>{We(T)}):We(R)},e[16]=R,e[17]=We,e[18]=Te):Te=e[18];let Ve;e[19]!==R?(Ve=[R],e[19]=R,e[20]=Ve):Ve=e[20],x.useEffect(Te,Ve);let _e;e[21]!==ae||e[22]!==N?.length||e[23]!==l||e[24]!==L?(_e=ae||(L==="categorical"?It.getUniqValue(l,"x"):Pt.getJenks(l.map(_t),N?.length||4)),e[21]=ae,e[22]=N?.length,e[23]=l,e[24]=L,e[25]=_e):_e=e[25];const He=_e;let Ge,Ue;e[26]!==F||e[27]!==u.speed||e[28]!==p?(Ge=()=>{const f=setInterval(()=>{at(T=>T<p.length-1?T+1:0)},(u.speed||2)*1e3);return F||clearInterval(f),()=>clearInterval(f)},Ue=[p,F,u.speed],e[26]=F,e[27]=u.speed,e[28]=p,e[29]=Ge,e[30]=Ue):(Ge=e[29],Ue=e[30]),x.useEffect(Ge,Ue);const nt=u.dateFormat||"yyyy";let Xe;e[31]!==W||e[32]!==nt||e[33]!==u.showOnlyActiveDate||e[34]!==p?(Xe=mt.getSliderMarks(p,W,u.showOnlyActiveDate,nt),e[31]=W,e[32]=nt,e[33]=u.showOnlyActiveDate,e[34]=p,e[35]=Xe):Xe=e[35];const Ye=Xe,it=y?.graphContainer,lt=g?.graphContainer;let ge;e[36]!==y?.description||e[37]!==y?.title||e[38]!==l||e[39]!==m||e[40]!==w||e[41]!==s||e[42]!==b||e[43]!==g?.description||e[44]!==g?.title||e[45]!==E?(ge=b||w||s||m?t.jsxRuntimeExports.jsx(Ot.GraphHeader,{styles:{title:g?.title,description:g?.description},classNames:{title:y?.title,description:y?.description},graphTitle:b,graphDescription:w,width:E,graphDownload:s?ut:void 0,dataDownload:m?l.map(Vt).filter(Tt).length>0?l.map(Wt).filter(Ft):l.filter(Bt):null}):null,e[36]=y?.description,e[37]=y?.title,e[38]=l,e[39]=m,e[40]=w,e[41]=s,e[42]=b,e[43]=g?.description,e[44]=g?.title,e[45]=E,e[46]=ge):ge=e[46];let fe;e[47]!==W||e[48]!==Ye||e[49]!==F||e[50]!==u.enabled||e[51]!==p?(fe=u.enabled&&p.length>0&&Ye?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{yt(!F)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":F?"Click to pause animation":"Click to play animation",children:F?t.jsxRuntimeExports.jsx(dt.Pause,{}):t.jsxRuntimeExports.jsx(dt.Play,{})}),t.jsxRuntimeExports.jsx(mt.Nr,{min:p[0],max:p[p.length-1],marks:Ye,step:null,defaultValue:p[p.length-1],value:p[W],onChangeComplete:f=>{at(p.indexOf(f))},onChange:f=>{at(p.indexOf(f))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[47]=W,e[48]=Ye,e[49]=F,e[50]=u.enabled,e[51]=p,e[52]=fe):fe=e[52];let ye;e[53]!==Pe||e[54]!==ne||e[55]!==y||e[56]!==Ce||e[57]!==H||e[58]!==N||e[59]!==ot||e[60]!==l||e[61]!==G||e[62]!==tt||e[63]!==He||e[64]!==j||e[65]!==n||e[66]!==W||e[67]!==o||e[68]!==he||e[69]!==$e||e[70]!==A||e[71]!==Z||e[72]!==c||e[73]!==xe||e[74]!==B||e[75]!==ce||e[76]!==J||e[77]!==k||e[78]!==Qe||e[79]!==Se||e[80]!==L||e[81]!==$||e[82]!==i||e[83]!==g||e[84]!==De||e[85]!==oe||e[86]!==te||e[87]!==u.dateFormat||e[88]!==u.enabled||e[89]!==be||e[90]!==p||e[91]!==E||e[92]!==rt||e[93]!==et||e[94]!==a||e[95]!==I?(ye=t.jsxRuntimeExports.jsx(xt.GraphArea,{ref:st,children:oe&&De&&xe?t.jsxRuntimeExports.jsx(zt,{data:l.filter(f=>u.enabled?f.date===pt.format(new Date(p[W]),u.dateFormat||"yyyy"):f),mapData:$?xe:{...xe,features:xe.features.filter(At)},colorDomain:He,width:oe,height:De,scale:Se,centerPoint:ne,colors:N||(L==="categorical"?Ze.Colors[te].categoricalColors.colors:Ze.Colors[te].sequentialColors[`neutralColorsx0${He.length+1}`]),colorLegendTitle:H,mapBorderWidth:$e,mapNoDataColor:A,categorical:L==="categorical",mapBorderColor:he,tooltip:be,onSeriesMouseOver:J,isWorldMap:o,showColorScale:i,zoomScaleExtend:a,zoomTranslateExtend:I,onSeriesMouseClick:ce,mapProperty:c,highlightedIds:n,resetSelectionOnDoubleClick:Qe,styles:g,classNames:y,detailsOnClick:G,mapProjection:Z||(o?"naturalEarth":"mercator"),zoomInteraction:et,dimmedOpacity:tt,animate:Pe===!0?{duration:.5,once:!0,amount:.5}:Pe||{duration:0,once:!0,amount:0},customLayers:ot,zoomAndCenterByHighlightedIds:rt,collapseColorScaleByDefault:Ce}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(B,j||(k?B?(E||oe)*k>B?(E||oe)*k:B:(E||oe)*k:De))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(vt.w,{"aria-label":"Loading graph"})})}),e[53]=Pe,e[54]=ne,e[55]=y,e[56]=Ce,e[57]=H,e[58]=N,e[59]=ot,e[60]=l,e[61]=G,e[62]=tt,e[63]=He,e[64]=j,e[65]=n,e[66]=W,e[67]=o,e[68]=he,e[69]=$e,e[70]=A,e[71]=Z,e[72]=c,e[73]=xe,e[74]=B,e[75]=ce,e[76]=J,e[77]=k,e[78]=Qe,e[79]=Se,e[80]=L,e[81]=$,e[82]=i,e[83]=g,e[84]=De,e[85]=oe,e[86]=te,e[87]=u.dateFormat,e[88]=u.enabled,e[89]=be,e[90]=p,e[91]=E,e[92]=rt,e[93]=et,e[94]=a,e[95]=I,e[96]=ye):ye=e[96];let je;e[97]!==y?.footnote||e[98]!==y?.source||e[99]!==pe||e[100]!==V||e[101]!==g?.footnote||e[102]!==g?.source||e[103]!==E?(je=V||pe?t.jsxRuntimeExports.jsx(Mt.GraphFooter,{styles:{footnote:g?.footnote,source:g?.source},classNames:{footnote:y?.footnote,source:y?.source},sources:V,footNote:pe,width:E}):null,e[97]=y?.footnote,e[98]=y?.source,e[99]=pe,e[100]=V,e[101]=g?.footnote,e[102]=g?.source,e[103]=E,e[104]=je):je=e[104];let Je;return e[105]!==K||e[106]!==O||e[107]!==S||e[108]!==j||e[109]!==C||e[110]!==B||e[111]!==ve||e[112]!==k||e[113]!==it||e[114]!==lt||e[115]!==ge||e[116]!==fe||e[117]!==ye||e[118]!==je||e[119]!==te||e[120]!==E?(Je=t.jsxRuntimeExports.jsxs(xt.GraphContainer,{className:it,style:lt,id:S,ref:ut,"aria-label":K,backgroundColor:O,theme:te,language:C,minHeight:B,width:E,height:j,relativeHeight:k,padding:ve,children:[ge,fe,ye,je]}),e[105]=K,e[106]=O,e[107]=S,e[108]=j,e[109]=C,e[110]=B,e[111]=ve,e[112]=k,e[113]=it,e[114]=lt,e[115]=ge,e[116]=fe,e[117]=ye,e[118]=je,e[119]=te,e[120]=E,e[121]=Je):Je=e[121],Je}function At(h){return h.properties.NAME!=="Antarctica"}function Bt(h){return h!==void 0}function Ft(h){return h!==void 0}function Wt(h){return h.data}function Tt(h){return h!==void 0}function Vt(h){return h.data}function _t(h){return h.x}function Ht(h,e){return h-e}function Gt(h){return h.date}exports.ChoroplethMap=Lt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-6v2a2njQ.cjs"),c=require("react"),yt=require("./getSliderMarks-CIuSoedo.cjs"),Ct=require("./Spinner-jTMOLuw_.cjs"),vt=require("./parse-xYI9yrvL.cjs"),Dt=require("./index-DQA8q5sC.cjs"),F=require("./index-DLFt97gy.cjs"),jt=require("./Typography-sa1UE0oF.cjs"),St=require("./index-C5K--w8d.cjs"),Nt=require("./numberFormattingFunction-02t-wJta.cjs"),Mt=require("./Tooltip-BLa2EfMs.cjs"),Ot=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),gt=require("./index-C6er0ety.cjs"),qt=require("./DetailsModal-DHttOA80.cjs"),It=require("./ordinal-CrsysVE-.cjs"),Pt=require("./threshold-DNsSUf8Q.cjs"),xt=require("./select-Bnfk0lJx.cjs"),Qe=require("./proxy-C4-uo6nS.cjs"),zt=require("./use-in-view-C3o_ntMv.cjs"),At=require("./index-CoobIWNj.cjs"),Bt=require("./GraphFooter.cjs"),Ft=require("./GraphHeader.cjs"),et=require("./Colors.cjs"),Lt=require("./fetchAndParseData-QTF6tjij.cjs"),Tt=require("./getUniqValue-NX8DgwND.cjs"),Wt=require("./getJenks-BzJvhy_H.cjs"),bt=require("./GraphContainer-B1EDxJ0S.cjs");function _t(d){const{data:e,colorDomain:r,colors:a,mapData:L,colorLegendTitle:E,categorical:T,height:f,width:h,scale:x,centerPoint:W,tooltip:Z,mapBorderWidth:Q,mapBorderColor:xe,mapNoDataColor:ge,onSeriesMouseOver:ee,showColorScale:fe,zoomScaleExtend:Oe,zoomTranslateExtend:qe,highlightedIds:b,onSeriesMouseClick:te,mapProperty:g,resetSelectionOnDoubleClick:ye,detailsOnClick:H,styles:Ie,classNames:oe,mapProjection:D,zoomInteraction:S,animate:k,dimmedOpacity:N,customLayers:re,collapseColorScaleByDefault:ve,zoomAndCenterByHighlightedIds:je,projectionRotate:_,rewindCoordinatesInMapData:be}=d,y=c.useMemo(()=>be?F.index_default(L,{reverse:!0}):L,[L,be]),[w,M]=c.useState(void 0),V=c.useRef(null),[Pe,ne]=c.useState(ve===void 0?!(h<680):!ve),[u,p]=c.useState(void 0),[U,ae]=c.useState(void 0),[Ee,se]=c.useState(void 0),[X,$]=c.useState(void 0),O=c.useRef(null),Y=zt.useInView(O,{once:k.once,amount:k.amount}),ke=c.useRef(null),ze=T?It.ordinal().domain(r).range(a):Pt.threshold().domain(r).range(a);c.useEffect(()=>{const o=xt.select(ke.current),n=xt.select(O.current),j=i=>{if(S==="noZoom")return!1;if(S==="button")return!i.type.includes("wheel");const le=i.type==="wheel",ce=i.type.startsWith("touch"),Se=i.type==="mousedown"||i.type==="mousemove";return ce?!0:le?S==="scroll"?!0:i.ctrlKey:Se&&!i.button&&!i.ctrlKey},C=F.zoom().scaleExtent(Oe).translateExtent(qe||[[-20,-20],[h+20,f+20]]).filter(j).on("zoom",({transform:i})=>{o.attr("transform",i)});n.call(C),V.current=C},[f,h,S]);const v=F.index_default$1({...y,features:je?y.features.filter(o=>(b||[]).length===0||b.indexOf(o.properties[g])!==-1):y.features}),R=St.index_default({...y,features:je?y.features.filter(o=>(b||[]).length===0||b.indexOf(o.properties[g])!==-1):y.features}),q=v[2]-v[0],we=v[3]-v[1],Re=h*190/960*360/q,Ce=f*190/678*180/we,I=x*Math.min(Re,Ce),De=D==="mercator"?F.geoMercator().rotate(_).center(W||R.geometry.coordinates).translate([h/2,f/2]).scale(I):D==="equalEarth"?F.geoEqualEarth().rotate(_).center(W||R.geometry.coordinates).translate([h/2,f/2]).scale(I):D==="naturalEarth"?F.geoNaturalEarth1().rotate(_).center(W||R.geometry.coordinates).translate([h/2,f/2]).scale(I):D==="orthographic"?F.geoOrthographic().rotate(_).center(W||R.geometry.coordinates).translate([h/2,f/2]).scale(I):F.geoAlbersUsa().rotate(_).center(W||R.geometry.coordinates).translate([h/2,f/2]).scale(I),G=F.geoPath().projection(De),ie=o=>{if(!O.current||!V.current)return;xt.select(O.current).call(V.current.scaleBy,o==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(Qe.motion.svg,{width:`${h}px`,height:`${f}px`,viewBox:`0 0 ${h} ${f}`,ref:O,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:ke,children:[re.filter(o=>o.position==="before").map(o=>o.layer),y.features.map((o,n)=>{if(!o.properties?.[g])return null;const j=G(o);return j?t.jsxRuntimeExports.jsx(Qe.motion.g,{opacity:w?N:b.length!==0?b.indexOf(o.properties[g])!==-1?1:N:1,children:t.jsxRuntimeExports.jsx("path",{d:j,style:{stroke:xe,strokeWidth:Q,fill:ge}})},n):null}),t.jsxRuntimeExports.jsx(At.AnimatePresence,{children:e.map(o=>{const n=y.features.findIndex(i=>o.id===i.properties[g]);if(n===-1)return null;const j=G(y.features[n]);if(!j)return null;const C=Ot.checkIfNullOrUndefined(o.x)?ge:ze(o.x);return t.jsxRuntimeExports.jsx(Qe.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:w?w===C?1:N:b.length!==0?b.indexOf(o.id)!==-1?1:N:1,transition:{duration:k.duration}}},initial:"initial",animate:Y?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},onMouseEnter:i=>{ae(o),$(i.clientY),se(i.clientX),ee?.(o)},onMouseMove:i=>{ae(o),$(i.clientY),se(i.clientX)},onMouseLeave:()=>{ae(void 0),se(void 0),$(void 0),ee?.(void 0)},onClick:()=>{(te||H)&&(Dt.isEqual(u,o)&&ye?(p(void 0),te?.(void 0)):(p(o),te?.(o)))},children:t.jsxRuntimeExports.jsx(Qe.motion.path,{d:j,variants:{initial:{fill:C,opacity:0},whileInView:{fill:C,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:Y?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},style:{stroke:xe,strokeWidth:Q}},`${o.id}`)},o.id)})}),U?y.features.filter(o=>o.properties[g]===U.id).map((o,n)=>t.jsxRuntimeExports.jsx("path",{d:G(o)||"",className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},n)):null,re.filter(o=>o.position==="after").map(o=>o.layer)]})}),fe===!1?null:t.jsxRuntimeExports.jsx("div",{className:t.mo("absolute left-4 bottom-4 map-color-legend",oe?.colorLegend),children:Pe?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.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:()=>{ne(!1)},children:t.jsxRuntimeExports.jsx(gt.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]",style:{width:T?void 0:"340px"},children:[E&&E!==""?t.jsxRuntimeExports.jsx(jt.j,{size:"xs",marginBottom:"xs",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:E}):null,T?t.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:r.map((o,n)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{M(a[n%a.length])},onMouseLeave:()=>{M(void 0)},children:[t.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:a[n%a.length]}}),t.jsxRuntimeExports.jsx(jt.j,{size:"sm",marginBottom:"none",leading:"none",children:o})]},n))}):t.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{children:[r.map((o,n)=>t.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{M(a[n])},onMouseLeave:()=>{M(void 0)},className:"cursor-pointer",children:[t.jsxRuntimeExports.jsx("rect",{x:n*320/a.length+1,y:1,width:320/a.length-2,height:8,className:w===a[n]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":"",style:{fill:a[n],...w===a[n]?{}:{stroke:a[n]}}}),t.jsxRuntimeExports.jsx("text",{x:(n+1)*320/a.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:Nt.numberFormattingFunction(o,"NA")})]},n)),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("rect",{onMouseOver:()=>{M(a[r.length])},onMouseLeave:()=>{M(void 0)},x:r.length*320/a.length+1,y:1,width:320/a.length-2,height:8,className:`cursor-pointer ${w===a[r.length]?"stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:a[r.length],...w===a[r.length]?{}:{stroke:a[r.length]}}})})]})})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start map-legend-button",onClick:()=>{ne(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),S==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>ie("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:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>ie("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:"–"})]})]}),H&&u!==void 0?t.jsxRuntimeExports.jsx(qt.DetailsModal,{body:H,data:u,setData:p,className:oe?.modal}):null,U&&Z&&Ee&&X?t.jsxRuntimeExports.jsx(Mt.Tooltip,{data:U,body:Z,xPos:Ee,yPos:X,backgroundStyle:Ie?.tooltip,className:oe?.tooltip}):null]})}function $t(d){const e=t.compilerRuntimeExports.c(126),{data:r,mapData:a,graphTitle:L,colors:E,sources:T,graphDescription:f,height:h,width:x,footNote:W,colorDomain:Z,colorLegendTitle:Q,scaleType:xe,scale:ge,centerPoint:ee,padding:fe,mapBorderWidth:Oe,mapNoDataColor:qe,backgroundColor:b,mapBorderColor:te,relativeHeight:g,tooltip:ye,onSeriesMouseOver:H,isWorldMap:Ie,showColorScale:oe,zoomScaleExtend:D,zoomTranslateExtend:S,graphID:k,highlightedIds:N,onSeriesMouseClick:re,mapProperty:ve,graphDownload:je,dataDownload:_,showAntarctica:be,language:y,minHeight:w,theme:M,ariaLabel:V,resetSelectionOnDoubleClick:Pe,detailsOnClick:ne,styles:u,classNames:p,mapProjection:U,zoomInteraction:ae,animate:Ee,dimmedOpacity:se,customLayers:X,timeline:$,collapseColorScaleByDefault:O,projectionRotate:Y,zoomAndCenterByHighlightedIds:ke,rewindCoordinatesInMapData:ze}=d,v=a===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":a,R=W===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.":W,q=xe===void 0?"threshold":xe,we=ge===void 0?.95:ge,Re=Oe===void 0?.5:Oe,Ce=qe===void 0?et.Colors.light.graphNoData:qe,I=b===void 0?!1:b,De=te===void 0?et.Colors.light.grays["gray-500"]:te,G=Ie===void 0?!0:Ie,ie=oe===void 0?!0:oe;let o;e[0]!==D?(o=D===void 0?[.8,6]:D,e[0]=D,e[1]=o):o=e[1];const n=o;let j;e[2]!==N?(j=N===void 0?[]:N,e[2]=N,e[3]=j):j=e[3];const C=j,i=ve===void 0?"ISO3":ve,le=je===void 0?!1:je,ce=_===void 0?!1:_,Se=be===void 0?!1:be,tt=y===void 0?"en":y,P=w===void 0?0:w,J=M===void 0?"light":M,ot=Pe===void 0?!0:Pe,rt=U===void 0?"naturalEarth":U,nt=ae===void 0?"button":ae,Ae=Ee===void 0?!1:Ee,at=se===void 0?.3:se;let Be;e[4]!==X?(Be=X===void 0?[]:X,e[4]=X,e[5]=Be):Be=e[5];const st=Be;let Fe;e[6]!==$?(Fe=$===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:$,e[6]=$,e[7]=Fe):Fe=e[7];const s=Fe;let Le;e[8]!==Y?(Le=Y===void 0?[0,0]:Y,e[8]=Y,e[9]=Le):Le=e[9];const it=Le,lt=ke===void 0?!1:ke,ct=ze===void 0?!0:ze,[K,Et]=c.useState(0),[Ne,kt]=c.useState(0),[z,wt]=c.useState(s.autoplay);let Me;if(e[10]!==r||e[11]!==s.dateFormat){let m;e[13]!==s.dateFormat?(m=B=>vt.parse(`${B.date}`,s.dateFormat||"yyyy",new Date).getTime(),e[13]=s.dateFormat,e[14]=m):m=e[14],Me=[...new Set(r.filter(Zt).map(m))],Me.sort(Kt),e[10]=r,e[11]=s.dateFormat,e[12]=Me}else Me=e[12];const l=Me,[A,dt]=c.useState(s.autoplay?0:l.length-1),[de,Rt]=c.useState(void 0),ut=c.useRef(null),ft=c.useRef(null);let Te,We;e[15]===Symbol.for("react.memo_cache_sentinel")?(Te=()=>{const m=new ResizeObserver(B=>{Et(B[0].target.clientWidth||620),kt(B[0].target.clientHeight||480)});return ut.current&&m.observe(ut.current),()=>m.disconnect()},We=[],e[15]=Te,e[16]=We):(Te=e[15],We=e[16]),c.useEffect(Te,We);let _e;e[17]===Symbol.for("react.memo_cache_sentinel")?(_e=m=>{Rt(m)},e[17]=_e):_e=e[17];const $e=c.useEffectEvent(_e);let Ge;e[18]!==v||e[19]!==$e?(Ge=()=>{typeof v=="string"?Lt.fetchAndParseJSON(v).then(B=>{$e(B)}):$e(v)},e[18]=v,e[19]=$e,e[20]=Ge):Ge=e[20];let He;e[21]!==v?(He=[v],e[21]=v,e[22]=He):He=e[22],c.useEffect(Ge,He);let Ve;e[23]!==Z||e[24]!==E?.length||e[25]!==r||e[26]!==q?(Ve=Z||(q==="categorical"?Tt.getUniqValue(r,"x"):Wt.getJenks(r.map(Jt),E?.length||4)),e[23]=Z,e[24]=E?.length,e[25]=r,e[26]=q,e[27]=Ve):Ve=e[27];const Ue=Ve;let Xe,Ye;e[28]!==z||e[29]!==s.speed||e[30]!==l?(Xe=()=>{const m=setInterval(()=>{dt(B=>B<l.length-1?B+1:0)},(s.speed||2)*1e3);return z||clearInterval(m),()=>clearInterval(m)},Ye=[l,z,s.speed],e[28]=z,e[29]=s.speed,e[30]=l,e[31]=Xe,e[32]=Ye):(Xe=e[31],Ye=e[32]),c.useEffect(Xe,Ye);const pt=s.dateFormat||"yyyy";let Je;e[33]!==A||e[34]!==pt||e[35]!==s.showOnlyActiveDate||e[36]!==l?(Je=yt.getSliderMarks(l,A,s.showOnlyActiveDate,pt),e[33]=A,e[34]=pt,e[35]=s.showOnlyActiveDate,e[36]=l,e[37]=Je):Je=e[37];const Ke=Je,mt=p?.graphContainer,ht=u?.graphContainer;let ue;e[38]!==p?.description||e[39]!==p?.title||e[40]!==r||e[41]!==ce||e[42]!==f||e[43]!==le||e[44]!==L||e[45]!==u?.description||e[46]!==u?.title||e[47]!==x?(ue=L||f||le||ce?t.jsxRuntimeExports.jsx(Ft.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:p?.title,description:p?.description},graphTitle:L,graphDescription:f,width:x,graphDownload:le?ft:void 0,dataDownload:ce?r.map(Yt).filter(Xt).length>0?r.map(Ut).filter(Vt):r.filter(Ht):null}):null,e[38]=p?.description,e[39]=p?.title,e[40]=r,e[41]=ce,e[42]=f,e[43]=le,e[44]=L,e[45]=u?.description,e[46]=u?.title,e[47]=x,e[48]=ue):ue=e[48];let pe;e[49]!==A||e[50]!==Ke||e[51]!==z||e[52]!==s.enabled||e[53]!==l?(pe=s.enabled&&l.length>0&&Ke?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{wt(!z)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":z?"Click to pause animation":"Click to play animation",children:z?t.jsxRuntimeExports.jsx(gt.Pause,{}):t.jsxRuntimeExports.jsx(gt.Play,{})}),t.jsxRuntimeExports.jsx(yt.Nr,{min:l[0],max:l[l.length-1],marks:Ke,step:null,defaultValue:l[l.length-1],value:l[A],onChangeComplete:m=>{dt(l.indexOf(m))},onChange:m=>{dt(l.indexOf(m))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[49]=A,e[50]=Ke,e[51]=z,e[52]=s.enabled,e[53]=l,e[54]=pe):pe=e[54];let me;e[55]!==Ae||e[56]!==ee||e[57]!==p||e[58]!==O||e[59]!==Q||e[60]!==E||e[61]!==st||e[62]!==r||e[63]!==ne||e[64]!==at||e[65]!==Ue||e[66]!==h||e[67]!==C||e[68]!==A||e[69]!==G||e[70]!==De||e[71]!==Re||e[72]!==Ce||e[73]!==rt||e[74]!==i||e[75]!==de||e[76]!==P||e[77]!==re||e[78]!==H||e[79]!==it||e[80]!==g||e[81]!==ot||e[82]!==ct||e[83]!==we||e[84]!==q||e[85]!==Se||e[86]!==ie||e[87]!==u||e[88]!==Ne||e[89]!==K||e[90]!==J||e[91]!==s.dateFormat||e[92]!==s.enabled||e[93]!==ye||e[94]!==l||e[95]!==x||e[96]!==lt||e[97]!==nt||e[98]!==n||e[99]!==S?(me=t.jsxRuntimeExports.jsx(bt.GraphArea,{ref:ut,children:K&&Ne&&de?t.jsxRuntimeExports.jsx(_t,{data:r.filter(m=>s.enabled?m.date===vt.format(new Date(l[A]),s.dateFormat||"yyyy"):m),mapData:Se?de:{...de,features:de.features.filter(Gt)},colorDomain:Ue,width:K,height:Ne,scale:we,centerPoint:ee,colors:E||(q==="categorical"?et.Colors[J].categoricalColors.colors:et.Colors[J].sequentialColors[`neutralColorsx0${Ue.length+1}`]),colorLegendTitle:Q,mapBorderWidth:Re,mapNoDataColor:Ce,categorical:q==="categorical",mapBorderColor:De,tooltip:ye,onSeriesMouseOver:H,isWorldMap:G,showColorScale:ie,zoomScaleExtend:n,zoomTranslateExtend:S,onSeriesMouseClick:re,mapProperty:i,highlightedIds:C,resetSelectionOnDoubleClick:ot,styles:u,classNames:p,detailsOnClick:ne,mapProjection:rt||(G?"naturalEarth":"mercator"),zoomInteraction:nt,dimmedOpacity:at,animate:Ae===!0?{duration:.5,once:!0,amount:.5}:Ae||{duration:0,once:!0,amount:0},customLayers:st,zoomAndCenterByHighlightedIds:lt,collapseColorScaleByDefault:O,projectionRotate:it,rewindCoordinatesInMapData:ct}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(P,h||(g?P?(x||K)*g>P?(x||K)*g:P:(x||K)*g:Ne))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(Ct.w,{"aria-label":"Loading graph"})})}),e[55]=Ae,e[56]=ee,e[57]=p,e[58]=O,e[59]=Q,e[60]=E,e[61]=st,e[62]=r,e[63]=ne,e[64]=at,e[65]=Ue,e[66]=h,e[67]=C,e[68]=A,e[69]=G,e[70]=De,e[71]=Re,e[72]=Ce,e[73]=rt,e[74]=i,e[75]=de,e[76]=P,e[77]=re,e[78]=H,e[79]=it,e[80]=g,e[81]=ot,e[82]=ct,e[83]=we,e[84]=q,e[85]=Se,e[86]=ie,e[87]=u,e[88]=Ne,e[89]=K,e[90]=J,e[91]=s.dateFormat,e[92]=s.enabled,e[93]=ye,e[94]=l,e[95]=x,e[96]=lt,e[97]=nt,e[98]=n,e[99]=S,e[100]=me):me=e[100];let he;e[101]!==p?.footnote||e[102]!==p?.source||e[103]!==R||e[104]!==T||e[105]!==u?.footnote||e[106]!==u?.source||e[107]!==x?(he=T||R?t.jsxRuntimeExports.jsx(Bt.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:p?.footnote,source:p?.source},sources:T,footNote:R,width:x}):null,e[101]=p?.footnote,e[102]=p?.source,e[103]=R,e[104]=T,e[105]=u?.footnote,e[106]=u?.source,e[107]=x,e[108]=he):he=e[108];let Ze;return e[109]!==V||e[110]!==I||e[111]!==k||e[112]!==h||e[113]!==tt||e[114]!==P||e[115]!==fe||e[116]!==g||e[117]!==mt||e[118]!==ht||e[119]!==ue||e[120]!==pe||e[121]!==me||e[122]!==he||e[123]!==J||e[124]!==x?(Ze=t.jsxRuntimeExports.jsxs(bt.GraphContainer,{className:mt,style:ht,id:k,ref:ft,"aria-label":V,backgroundColor:I,theme:J,language:tt,minHeight:P,width:x,height:h,relativeHeight:g,padding:fe,children:[ue,pe,me,he]}),e[109]=V,e[110]=I,e[111]=k,e[112]=h,e[113]=tt,e[114]=P,e[115]=fe,e[116]=g,e[117]=mt,e[118]=ht,e[119]=ue,e[120]=pe,e[121]=me,e[122]=he,e[123]=J,e[124]=x,e[125]=Ze):Ze=e[125],Ze}function Gt(d){return d.properties.NAME!=="Antarctica"}function Ht(d){return d!==void 0}function Vt(d){return d!==void 0}function Ut(d){return d.data}function Xt(d){return d!==void 0}function Yt(d){return d.data}function Jt(d){return d.x}function Kt(d,e){return d-e}function Zt(d){return d.date}exports.ChoroplethMap=$t;
|
|
2
2
|
//# sourceMappingURL=ChoroplethMap.cjs.map
|