@undp/data-viz 2.4.0 → 2.4.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.js +245 -248
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +281 -284
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/HybridMap.cjs +1 -1
- package/dist/HybridMap.cjs.map +1 -1
- package/dist/HybridMap.js +198 -201
- package/dist/HybridMap.js.map +1 -1
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.cjs.map +1 -1
- package/dist/ThreeDGlobe.js +116 -119
- package/dist/ThreeDGlobe.js.map +1 -1
- package/package.json +1 -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, 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 { ExpandIcon, 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 overlayMapData?: FeatureCollection;\r\n overlayMapBorderColor?: string;\r\n overlayMapBorderWidth?: number;\r\n locale: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n 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 overlayMapData,\r\n overlayMapBorderColor,\r\n overlayMapBorderWidth,\r\n locale,\r\n } = props;\r\n const formattedMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData) return mapData;\r\n\r\n return rewind(mapData, { reverse: true }) as FeatureCollection;\r\n }, [mapData, rewindCoordinatesInMapData]);\r\n const formattedOverlayMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData || !overlayMapData) return overlayMapData;\r\n\r\n return rewind(overlayMapData, { reverse: true }) as FeatureCollection;\r\n }, [overlayMapData, rewindCoordinatesInMapData]);\r\n const [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]) * 1.15;\r\n const latDiff = (bounds[3] - bounds[1]) * 1.15;\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\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\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n <path\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = formattedMapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n if (index === -1) return null;\r\n const path = pathGenerator(formattedMapData.features[index]);\r\n if (!path) return null;\r\n const 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 className='undp-map-shapes'\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n 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 vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? formattedMapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n .map((d, i) => (\r\n <path\r\n key={i}\r\n d={pathGenerator(d) || ''}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n ))\r\n : null}\r\n {formattedOverlayMapData?.features.map((d, i: number) => {\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <g key={i}>\r\n <path\r\n d={path}\r\n style={{\r\n stroke: overlayMapBorderColor || mapBorderColor,\r\n strokeWidth: overlayMapBorderWidth || mapBorderWidth + 1,\r\n fill: 'none',\r\n pointerEvents: 'none',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </g>\r\n );\r\n })}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{ 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(\r\n el,\r\n undefined,\r\n undefined,\r\n undefined,\r\n undefined,\r\n locale,\r\n )}\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(\r\n el,\r\n undefined,\r\n undefined,\r\n undefined,\r\n undefined,\r\n locale,\r\n )}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </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='p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <ExpandIcon />\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 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\nimport { FeatureCollection } from 'geojson';\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 MapOverlayDataType,\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 mapData?: FeatureCollection | string;\r\n /** Detail if any other map needs to be overlayed over the main map */\r\n mapOverlay?: MapOverlayDataType;\r\n /** Defines if the coordinates in the map data should be rewinded or not. Try to change this is the visualization shows countries as holes instead of shapes. */\r\n rewindCoordinatesInMapData?: boolean;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** 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 /** Locale for number formatting. Must matches what `Intl.NumberFormat` expects. */\r\n locale?: string;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function 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 mapOverlay,\r\n locale = 'en',\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 const [mapShape, setMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n const [overlayMapShape, setOverlayMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const onUpdateShape = useEffectEvent((shape: FeatureCollection) => {\r\n setMapShape(shape);\r\n });\r\n\r\n const onUpdateOverlayMapShape = useEffectEvent((shape: FeatureCollection | undefined) => {\r\n setOverlayMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n useEffect(() => {\r\n if (!mapOverlay?.mapData) onUpdateOverlayMapShape(undefined);\r\n if (typeof mapOverlay?.mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapOverlay?.mapData);\r\n fetchData.then(d => {\r\n onUpdateOverlayMapShape(d as FeatureCollection);\r\n });\r\n } else {\r\n onUpdateOverlayMapShape(mapOverlay?.mapData);\r\n }\r\n }, [mapOverlay?.mapData]);\r\n\r\n 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}` ===\r\n format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(el => el.properties?.NAME !== 'Antarctica'),\r\n }\r\n }\r\n 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 overlayMapData={overlayMapShape}\r\n overlayMapBorderColor={mapOverlay?.mapBorderColor}\r\n overlayMapBorderWidth={mapOverlay?.mapBorderWidth}\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 locale={locale}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","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","overlayMapData","overlayMapBorderColor","overlayMapBorderWidth","locale","formattedMapData","useMemo","rewind","reverse","formattedOverlayMapData","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","vectorEffect","AnimatePresence","index","findIndex","el","id","xColorCoord","checkIfNullOrUndefined","x","yColorCoord","y","color","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","pointerEvents","cn","colorLegend","X","j","cursor","numberFormattingFunction","max","P","display","WebkitLineClamp","WebkitBoxOrient","overflow","writingMode","ExpandIcon","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","mapOverlay","t31","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t32","t33","t34","t35","enabled","autoplay","showOnlyActiveDate","t36","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t37","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","overlayMapShape","setOverlayMapShape","graphDiv","graphParentDiv","t38","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t39","shape","onUpdateShape","useEffectEvent","t40","shape_0","onUpdateOverlayMapShape","t41","fetchAndParseJSON","then","d_1","t42","t43","d_2","t44","t45","t46","t47","speed","interval","setInterval","clearInterval","t48","t49","getSliderMarks","markObj","console","error","t50","graphContainer","t51","t52","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t53","Pause","Play","SliderUI","nextValue","nextValue_0","t54","GraphArea","d_8","format","_temp8","getJenks","_temp9","_temp0","Spinner","t55","footnote","source","GraphFooter","t56","GraphContainer","d_10","d_9","NAME","d_5","d_4","d_3","d_7","d_6","a","b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqFO,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;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AnL,GAAAmL,SAAAkK,MAAAA,KAAAlK,EAAA,GAAA,GA5KjBkK;AA4KiB;AA3Td,SAAAN,GAAAQ,GAAA;AAAA,SA6OuBhQ,EAAC6D;AAA+B;AA7OvD,SAAA0L,GAAAU,GAAA;AAAA,SAsOuBjQ,EAAC2D;AAA+B;AAtOvD,SAAA0L,GAAA9L,GAAA;AAAA,SAgOsDA,EAAEpD,YAAiB+P,SAAK;AAAY;AAhO1F,SAAAxB,GAAAyB,GAAA;AAAA,SAgL4BnQ,MAAM9C;AAAS;AAhL3C,SAAAuR,GAAA2B,GAAA;AAAA,SA+K6CpQ,MAAM9C;AAAS;AA/K5D,SAAAsR,GAAA6B,GAAA;AAAA,SA+KyBrQ,EAAC7F;AAAK;AA/K/B,SAAAoU,GAAA+B,GAAA;AAAA,SA8K2CtQ,MAAM9C;AAAS;AA9K1D,SAAAoR,GAAAiC,GAAA;AAAA,SA8KuBvQ,EAAC7F;AAAK;AA9K7B,SAAA4Q,GAAAyF,GAAAC,GAAA;AAAA,SAqEkBD,IAAIC;AAAC;AArEvB,SAAA5F,GAAA7K,GAAA;AAAA,SAiEgBA,EAACyK;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 { ExpandIcon, 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 overlayMapData?: FeatureCollection;\r\n overlayMapBorderColor?: string;\r\n overlayMapBorderWidth?: number;\r\n locale: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n 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 overlayMapData,\r\n overlayMapBorderColor,\r\n overlayMapBorderWidth,\r\n locale,\r\n } = props;\r\n const formattedMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData) return mapData;\r\n\r\n return rewind(mapData, { reverse: true }) as FeatureCollection;\r\n }, [mapData, rewindCoordinatesInMapData]);\r\n const formattedOverlayMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData || !overlayMapData) return overlayMapData;\r\n\r\n return rewind(overlayMapData, { reverse: true }) as FeatureCollection;\r\n }, [overlayMapData, rewindCoordinatesInMapData]);\r\n const [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]) * 1.15;\r\n const latDiff = (bounds[3] - bounds[1]) * 1.15;\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\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\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n <path\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = formattedMapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n if (index === -1) return null;\r\n const path = pathGenerator(formattedMapData.features[index]);\r\n if (!path) return null;\r\n const 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 className='undp-map-shapes'\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n 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 vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? formattedMapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n .map((d, i) => (\r\n <path\r\n key={i}\r\n d={pathGenerator(d) || ''}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n ))\r\n : null}\r\n {formattedOverlayMapData?.features.map((d, i: number) => {\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <g key={i}>\r\n <path\r\n d={path}\r\n style={{\r\n stroke: overlayMapBorderColor || mapBorderColor,\r\n strokeWidth: overlayMapBorderWidth || mapBorderWidth + 1,\r\n fill: 'none',\r\n pointerEvents: 'none',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </g>\r\n );\r\n })}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{ 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(\r\n el,\r\n undefined,\r\n undefined,\r\n undefined,\r\n undefined,\r\n locale,\r\n )}\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(\r\n el,\r\n undefined,\r\n undefined,\r\n undefined,\r\n undefined,\r\n locale,\r\n )}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </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='p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <ExpandIcon />\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 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\nimport { FeatureCollection } from 'geojson';\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 MapOverlayDataType,\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 mapData?: FeatureCollection | string;\r\n /** Detail if any other map needs to be overlayed over the main map */\r\n mapOverlay?: MapOverlayDataType;\r\n /** Defines if the coordinates in the map data should be rewinded or not. Try to change this is the visualization shows countries as holes instead of shapes. */\r\n rewindCoordinatesInMapData?: boolean;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** 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 /** Locale for number formatting. Must matches what `Intl.NumberFormat` expects. */\r\n locale?: string;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function 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 mapOverlay,\r\n locale = 'en',\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 const [mapShape, setMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n const [overlayMapShape, setOverlayMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const onUpdateShape = useEffectEvent((shape: FeatureCollection) => {\r\n setMapShape(shape);\r\n });\r\n\r\n const onUpdateOverlayMapShape = useEffectEvent((shape: FeatureCollection | undefined) => {\r\n setOverlayMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n useEffect(() => {\r\n if (!mapOverlay?.mapData) onUpdateOverlayMapShape(undefined);\r\n if (typeof mapOverlay?.mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapOverlay?.mapData);\r\n fetchData.then(d => {\r\n onUpdateOverlayMapShape(d as FeatureCollection);\r\n });\r\n } else {\r\n onUpdateOverlayMapShape(mapOverlay?.mapData);\r\n }\r\n }, [mapOverlay?.mapData]);\r\n\r\n 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}` ===\r\n format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(el => el.properties?.NAME !== 'Antarctica'),\r\n }\r\n }\r\n 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 overlayMapData={overlayMapShape}\r\n overlayMapBorderColor={mapOverlay?.mapBorderColor}\r\n overlayMapBorderWidth={mapOverlay?.mapBorderWidth}\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 locale={locale}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","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","overlayMapData","overlayMapBorderColor","overlayMapBorderWidth","locale","formattedMapData","useMemo","rewind","reverse","formattedOverlayMapData","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","vectorEffect","AnimatePresence","index","findIndex","el","id","xColorCoord","checkIfNullOrUndefined","x","yColorCoord","y","color","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","pointerEvents","cn","colorLegend","X","j","cursor","numberFormattingFunction","max","P","display","WebkitLineClamp","WebkitBoxOrient","overflow","writingMode","ExpandIcon","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","graphDownload","t14","dataDownload","t15","showAntarctica","t16","language","t17","minHeight","t18","theme","t19","ariaLabel","t20","t21","t22","t23","t24","t25","timeline","t26","t27","t28","t29","mapOverlay","t30","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t31","t32","t33","enabled","autoplay","showOnlyActiveDate","t34","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t35","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","overlayMapShape","setOverlayMapShape","graphDiv","graphParentDiv","t36","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t37","shape","onUpdateShape","useEffectEvent","t38","shape_0","onUpdateOverlayMapShape","t39","fetchAndParseJSON","then","d_1","t40","t41","d_2","t42","t43","t44","t45","speed","interval","setInterval","clearInterval","t46","t47","getSliderMarks","markObj","console","error","t48","graphContainer","t49","t50","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t51","Pause","Play","SliderUI","nextValue","nextValue_0","t52","GraphArea","d_8","format","_temp8","getJenks","_temp9","_temp0","Spinner","t53","footnote","source","GraphFooter","t54","GraphContainer","d_10","d_9","NAME","d_5","d_4","d_3","d_7","d_6","a","b"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqFO,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,I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AAN,GAAAQ,GAAA;AAAA,SA6OuB9P,EAAC6D;AAA+B;AA7OvD,SAAAwL,GAAAU,GAAA;AAAA,SAsOuB/P,EAAC2D;AAA+B;AAtOvD,SAAAwL,GAAA5L,GAAA;AAAA,SAgOsDA,EAAEpD,YAAiB6P,SAAK;AAAY;AAhO1F,SAAAxB,GAAAyB,GAAA;AAAA,SAgL4BjQ,MAAM9C;AAAS;AAhL3C,SAAAqR,GAAA2B,GAAA;AAAA,SA+K6ClQ,MAAM9C;AAAS;AA/K5D,SAAAoR,GAAA6B,GAAA;AAAA,SA+KyBnQ,EAAC7F;AAAK;AA/K/B,SAAAkU,GAAA+B,GAAA;AAAA,SA8K2CpQ,MAAM9C;AAAS;AA9K1D,SAAAkR,GAAAiC,GAAA;AAAA,SA8KuBrQ,EAAC7F;AAAK;AA9K7B,SAAA0Q,GAAAyF,GAAAC,GAAA;AAAA,SAqEkBD,IAAIC;AAAC;AArEvB,SAAA5F,GAAA3K,GAAA;AAAA,SAiEgBA,EAACuK;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-D4pAp7u0.cjs"),n=require("react"),wt=require("./getSliderMarks-BzrpHrHS.cjs"),_t=require("./Spinner-WHzzloYQ.cjs"),St=require("./parse-xYI9yrvL.cjs"),Wt=require("./index-DQA8q5sC.cjs"),S=require("./index-DLFt97gy.cjs"),Mt=require("./Typography-BqmyF1gP.cjs"),At=require("./index-C5K--w8d.cjs"),Ft=require("./numberFormattingFunction-Cn9R7CM9.cjs"),$t=require("./Tooltip-Hr46paWP.cjs"),Lt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),lt=require("./index-BhI7mBJx.cjs"),Tt=require("./DetailsModal-jmmKRMRM.cjs"),Gt=require("./ordinal-CrsysVE-.cjs"),Ht=require("./threshold-DNsSUf8Q.cjs"),Ct=require("./select-Bnfk0lJx.cjs"),st=require("./proxy-CqH8m8IQ.cjs"),Vt=require("./use-in-view-dnRv_qqF.cjs"),Ut=require("./index-FXfr51ZM.cjs"),Xt=require("./GraphFooter.cjs"),Yt=require("./GraphHeader.cjs"),it=require("./Colors.cjs"),Nt=require("./fetchAndParseData-QTF6tjij.cjs"),Jt=require("./getUniqValue-NX8DgwND.cjs"),Kt=require("./getJenks-BzJvhy_H.cjs"),Ot=require("./GraphContainer-Cul9b74X.cjs");function Zt(m){const{data:e,colorDomain:a,colors:s,mapData:A,colorLegendTitle:R,categorical:F,height:y,width:h,scale:g,centerPoint:$,tooltip:oe,mapBorderWidth:U,mapBorderColor:re,mapNoDataColor:ye,onSeriesMouseOver:ae,showColorScale:ve,zoomScaleExtend:Be,zoomTranslateExtend:Pe,highlightedIds:E,onSeriesMouseClick:ne,mapProperty:f,resetSelectionOnDoubleClick:je,detailsOnClick:X,styles:ze,classNames:se,mapProjection:M,zoomInteraction:N,animate:w,dimmedOpacity:O,customLayers:ie,collapseColorScaleByDefault:Ee,zoomAndCenterByHighlightedIds:be,projectionRotate:L,rewindCoordinatesInMapData:Y,overlayMapData:J,overlayMapBorderColor:_e,overlayMapBorderWidth:We,locale:ke}=m,j=n.useMemo(()=>Y?S.index_default(A,{reverse:!0}):A,[A,Y]),De=n.useMemo(()=>!Y||!J?J:S.index_default(J,{reverse:!0}),[J,Y]),[i,c]=n.useState(void 0),le=n.useRef(null),[Ae,Ce]=n.useState(Ee===void 0?!(h<680):!Ee),[ce,T]=n.useState(void 0),[q,K]=n.useState(void 0),[Z,de]=n.useState(void 0),[Re,x]=n.useState(void 0),G=n.useRef(null),b=Vt.useInView(G,{once:w.once,amount:w.amount}),Q=n.useRef(null),I=F?Gt.ordinal().domain(a).range(s):Ht.threshold().domain(a).range(s);n.useEffect(()=>{const o=Ct.select(Q.current),r=Ct.select(G.current),v=u=>{if(N==="noZoom")return!1;if(N==="button")return!u.type.includes("wheel");const Ne=u.type==="wheel",D=u.type.startsWith("touch"),z=u.type==="mousedown"||u.type==="mousemove";return D?!0:Ne?N==="scroll"?!0:u.ctrlKey:z&&!u.button&&!u.ctrlKey},k=S.zoom().scaleExtent(Be).translateExtent(Pe||[[-20,-20],[h+20,y+20]]).filter(v).on("zoom",({transform:u})=>{o.attr("transform",u)});r.call(k),le.current=k},[y,h,N]);const H=S.index_default$1({...j,features:be?j.features.filter(o=>(E||[]).length===0||E?.indexOf(o.properties[f])!==-1):j.features}),B=At.index_default({...j,features:be?j.features.filter(o=>(E||[]).length===0||E?.indexOf(o.properties[f])!==-1):j.features}),we=(H[2]-H[0])*1.15,Se=(H[3]-H[1])*1.15,Me=h*190/960*360/we,ue=y*190/678*180/Se,P=g*Math.min(Me,ue),pe=M==="mercator"?S.geoMercator().rotate(L).center($||B.geometry.coordinates).translate([h/2,y/2]).scale(P):M==="equalEarth"?S.geoEqualEarth().rotate(L).center($||B.geometry.coordinates).translate([h/2,y/2]).scale(P):M==="naturalEarth"?S.geoNaturalEarth1().rotate(L).center($||B.geometry.coordinates).translate([h/2,y/2]).scale(P):M==="orthographic"?S.geoOrthographic().rotate(L).center($||B.geometry.coordinates).translate([h/2,y/2]).scale(P):S.geoAlbersUsa().rotate(L).center($||B.geometry.coordinates).translate([h/2,y/2]).scale(P),V=S.geoPath().projection(pe),ee=o=>{if(!G.current||!le.current)return;Ct.select(G.current).call(le.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(st.motion.svg,{width:`${h}px`,height:`${y}px`,viewBox:`0 0 ${h} ${y}`,ref:G,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:Q,children:[ie.filter(o=>o.position==="before").map(o=>o.layer),j.features.map((o,r)=>{if(!o.properties?.[f])return null;const v=V(o);return v?t.jsxRuntimeExports.jsx(st.motion.g,{opacity:i?O:E?E.indexOf(o.properties[f])!==-1?1:O:1,children:t.jsxRuntimeExports.jsx("path",{d:v,style:{stroke:re,strokeWidth:U,fill:ye,vectorEffect:"non-scaling-stroke"}})},r):null}),t.jsxRuntimeExports.jsx(Ut.AnimatePresence,{children:e.map(o=>{const r=j.features.findIndex(u=>o.id===u.properties[f]);if(r===-1)return null;const v=V(j.features[r]);if(!v)return null;const k=Lt.checkIfNullOrUndefined(o.x)?ye:I(o.x);return t.jsxRuntimeExports.jsx(st.motion.g,{className:"undp-map-shapes",variants:{initial:{opacity:0},whileInView:{opacity:i?i===k?1:O:E?E.indexOf(o.id)!==-1?1:O:1,transition:{duration:w.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:w.duration}},onMouseEnter:u=>{K(o),x(u.clientY),de(u.clientX),ae?.(o)},onMouseMove:u=>{K(o),x(u.clientY),de(u.clientX)},onMouseLeave:()=>{K(void 0),de(void 0),x(void 0),ae?.(void 0)},onClick:()=>{(ne||X)&&(Wt.isEqual(ce,o)&&je?(T(void 0),ne?.(void 0)):(T(o),ne?.(o)))},children:t.jsxRuntimeExports.jsx(st.motion.path,{d:v,variants:{initial:{fill:k,opacity:0},whileInView:{fill:k,opacity:1,transition:{duration:w.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:w.duration}},style:{stroke:re,strokeWidth:U,vectorEffect:"non-scaling-stroke"}},`${o.id}`)},o.id)})}),q?j.features.filter(o=>o.properties[f]===q.id).map((o,r)=>t.jsxRuntimeExports.jsx("path",{d:V(o)||"",className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5",vectorEffect:"non-scaling-stroke"}},r)):null,De?.features.map((o,r)=>{const v=V(o);return v?t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("path",{d:v,style:{stroke:_e||re,strokeWidth:We||U+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},r):null}),ie.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",se?.colorLegend),children:Ae?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:()=>{Ce(!1)},children:t.jsxRuntimeExports.jsx(lt.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:F?void 0:"340px"},children:[R&&R!==""?t.jsxRuntimeExports.jsx(Mt._,{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:R}):null,F?t.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:a.map((o,r)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{c(s[r%s.length])},onMouseLeave:()=>{c(void 0)},children:[t.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:s[r%s.length]}}),t.jsxRuntimeExports.jsx(Mt._,{size:"sm",marginBottom:"none",leading:"none",children:o})]},r))}):t.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{children:[a.map((o,r)=>t.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{c(s[r])},onMouseLeave:()=>{c(void 0)},className:"cursor-pointer",children:[t.jsxRuntimeExports.jsx("rect",{x:r*320/s.length+1,y:1,width:320/s.length-2,height:8,className:i===s[r]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":"",style:{fill:s[r],...i===s[r]?{}:{stroke:s[r]}}}),t.jsxRuntimeExports.jsx("text",{x:(r+1)*320/s.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:Ft.numberFormattingFunction(o,"NA",void 0,void 0,void 0,ke)})]},r)),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("rect",{onMouseOver:()=>{c(s[a.length])},onMouseLeave:()=>{c(void 0)},x:a.length*320/s.length+1,y:1,width:320/s.length-2,height:8,className:`cursor-pointer ${i===s[a.length]?"stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:s[a.length],...i===s[a.length]?{}:{stroke:s[a.length]}}})})]})})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{Ce(!0)},children:t.jsxRuntimeExports.jsx(lt.ExpandIcon,{})})}),N==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>ee("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:()=>ee("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:"–"})]})]}),X&&ce!==void 0?t.jsxRuntimeExports.jsx(Tt.DetailsModal,{body:X,data:ce,setData:T,className:se?.modal}):null,q&&oe&&Z&&Re?t.jsxRuntimeExports.jsx($t.Tooltip,{data:q,body:oe,xPos:Z,yPos:Re,backgroundStyle:ze?.tooltip,className:se?.tooltip}):null]})}function Qt(m){const e=t.compilerRuntimeExports.c(136),{data:a,mapData:s,graphTitle:A,colors:R,sources:F,graphDescription:y,height:h,width:g,footNote:$,colorDomain:oe,colorLegendTitle:U,scaleType:re,scale:ye,centerPoint:ae,padding:ve,mapBorderWidth:Be,mapNoDataColor:Pe,backgroundColor:E,mapBorderColor:ne,relativeHeight:f,tooltip:je,onSeriesMouseOver:X,isWorldMap:ze,showColorScale:se,zoomScaleExtend:M,zoomTranslateExtend:N,graphID:w,highlightedIds:O,onSeriesMouseClick:ie,mapProperty:Ee,graphDownload:be,dataDownload:L,showAntarctica:Y,language:J,minHeight:_e,theme:We,ariaLabel:ke,resetSelectionOnDoubleClick:j,detailsOnClick:De,styles:i,classNames:c,mapProjection:le,zoomInteraction:Ae,animate:Ce,dimmedOpacity:ce,customLayers:T,timeline:q,collapseColorScaleByDefault:K,projectionRotate:Z,zoomAndCenterByHighlightedIds:de,rewindCoordinatesInMapData:Re,mapOverlay:x,locale:G}=m,b=s===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":s,Q=$===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.":$,I=re===void 0?"threshold":re,H=ye===void 0?.95:ye,B=Be===void 0?.5:Be,we=Pe===void 0?it.Colors.light.graphNoData:Pe,Se=E===void 0?!1:E,Me=ne===void 0?it.Colors.light.grays["gray-500"]:ne,ue=ze===void 0?!0:ze,P=se===void 0?!0:se;let pe;e[0]!==M?(pe=M===void 0?[.8,6]:M,e[0]=M,e[1]=pe):pe=e[1];const V=pe;let ee;e[2]!==O?(ee=O===void 0?[]:O,e[2]=O,e[3]=ee):ee=e[3];const o=ee,r=Ee===void 0?"ISO3":Ee,v=be===void 0?!1:be,k=L===void 0?!1:L,u=Y===void 0?!1:Y,Ne=J===void 0?"en":J,D=_e===void 0?0:_e,z=We===void 0?"light":We,ct=j===void 0?!0:j,dt=le===void 0?"naturalEarth":le,ut=Ae===void 0?"button":Ae,Fe=Ce===void 0?!1:Ce,pt=ce===void 0?.3:ce;let $e;e[4]!==T?($e=T===void 0?[]:T,e[4]=T,e[5]=$e):$e=e[5];const mt=$e;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 l=Le;let Te;e[8]!==Z?(Te=Z===void 0?[0,0]:Z,e[8]=Z,e[9]=Te):Te=e[9];const ht=Te,xt=de===void 0?!1:de,gt=Re===void 0?!0:Re,ft=G===void 0?"en":G,[te,qt]=n.useState(0),[Oe,It]=n.useState(0),[_,Bt]=n.useState(l.autoplay);let qe;if(e[10]!==a||e[11]!==l.dateFormat){let d;e[13]!==l.dateFormat?(d=C=>St.parse(`${C.date}`,l.dateFormat||"yyyy",new Date).getTime(),e[13]=l.dateFormat,e[14]=d):d=e[14],qe=[...new Set(a.filter(lo).map(d))],qe.sort(io),e[10]=a,e[11]=l.dateFormat,e[12]=qe}else qe=e[12];const p=qe,[W,yt]=n.useState(l.autoplay?0:p.length-1),[me,Pt]=n.useState(void 0),[vt,zt]=n.useState(void 0),jt=n.useRef(null),Rt=n.useRef(null);let Ge,He;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ge=()=>{const d=new ResizeObserver(C=>{qt(C[0].target.clientWidth||620),It(C[0].target.clientHeight||480)});return jt.current&&d.observe(jt.current),()=>d.disconnect()},He=[],e[15]=Ge,e[16]=He):(Ge=e[15],He=e[16]),n.useEffect(Ge,He);let Ve;e[17]===Symbol.for("react.memo_cache_sentinel")?(Ve=d=>{Pt(d)},e[17]=Ve):Ve=e[17];const Ue=n.useEffectEvent(Ve);let Xe;e[18]===Symbol.for("react.memo_cache_sentinel")?(Xe=d=>{zt(d)},e[18]=Xe):Xe=e[18];const Ie=n.useEffectEvent(Xe);let Ye;e[19]!==b||e[20]!==Ue?(Ye=()=>{typeof b=="string"?Nt.fetchAndParseJSON(b).then(C=>{Ue(C)}):Ue(b)},e[19]=b,e[20]=Ue,e[21]=Ye):Ye=e[21];let Je;e[22]!==b?(Je=[b],e[22]=b,e[23]=Je):Je=e[23],n.useEffect(Ye,Je);let Ke;e[24]!==x?.mapData||e[25]!==Ie?(Ke=()=>{x?.mapData||Ie(void 0),typeof x?.mapData=="string"?Nt.fetchAndParseJSON(x?.mapData).then(C=>{Ie(C)}):Ie(x?.mapData)},e[24]=x?.mapData,e[25]=Ie,e[26]=Ke):Ke=e[26];const Et=x?.mapData;let Ze;e[27]!==Et?(Ze=[Et],e[27]=Et,e[28]=Ze):Ze=e[28],n.useEffect(Ke,Ze);let Qe;e[29]!==oe||e[30]!==R?.length||e[31]!==a||e[32]!==I?(Qe=oe||(I==="categorical"?Jt.getUniqValue(a,"x"):Kt.getJenks(a.map(so),R?.length||4)),e[29]=oe,e[30]=R?.length,e[31]=a,e[32]=I,e[33]=Qe):Qe=e[33];const et=Qe;let tt,ot;e[34]!==_||e[35]!==l.speed||e[36]!==p?(tt=()=>{const d=setInterval(()=>{yt(C=>C<p.length-1?C+1:0)},(l.speed||2)*1e3);return _||clearInterval(d),()=>clearInterval(d)},ot=[p,_,l.speed],e[34]=_,e[35]=l.speed,e[36]=p,e[37]=tt,e[38]=ot):(tt=e[37],ot=e[38]),n.useEffect(tt,ot);const bt=l.dateFormat||"yyyy";let rt;e[39]!==W||e[40]!==bt||e[41]!==l.showOnlyActiveDate||e[42]!==p?(rt=wt.getSliderMarks(p,W,l.showOnlyActiveDate,bt),e[39]=W,e[40]=bt,e[41]=l.showOnlyActiveDate,e[42]=p,e[43]=rt):rt=e[43];const at=rt,kt=c?.graphContainer,Dt=i?.graphContainer;let he;e[44]!==c?.description||e[45]!==c?.title||e[46]!==a||e[47]!==k||e[48]!==y||e[49]!==v||e[50]!==A||e[51]!==i?.description||e[52]!==i?.title||e[53]!==g?(he=A||y||v||k?t.jsxRuntimeExports.jsx(Yt.GraphHeader,{styles:{title:i?.title,description:i?.description},classNames:{title:c?.title,description:c?.description},graphTitle:A,graphDescription:y,width:g,graphDownload:v?Rt:void 0,dataDownload:k?a.map(no).filter(ao).length>0?a.map(ro).filter(oo):a.filter(to):null}):null,e[44]=c?.description,e[45]=c?.title,e[46]=a,e[47]=k,e[48]=y,e[49]=v,e[50]=A,e[51]=i?.description,e[52]=i?.title,e[53]=g,e[54]=he):he=e[54];let xe;e[55]!==W||e[56]!==at||e[57]!==_||e[58]!==l.enabled||e[59]!==p?(xe=l.enabled&&p.length>0&&at?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Bt(!_)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":_?"Click to pause animation":"Click to play animation",children:_?t.jsxRuntimeExports.jsx(lt.Pause,{}):t.jsxRuntimeExports.jsx(lt.Play,{})}),t.jsxRuntimeExports.jsx(wt.Nr,{min:p[0],max:p[p.length-1],marks:at,step:null,defaultValue:p[p.length-1],value:p[W],onChangeComplete:d=>{yt(p.indexOf(d))},onChange:d=>{yt(p.indexOf(d))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[55]=W,e[56]=at,e[57]=_,e[58]=l.enabled,e[59]=p,e[60]=xe):xe=e[60];let ge;e[61]!==Fe||e[62]!==ae||e[63]!==c||e[64]!==K||e[65]!==U||e[66]!==R||e[67]!==mt||e[68]!==a||e[69]!==De||e[70]!==pt||e[71]!==et||e[72]!==h||e[73]!==o||e[74]!==W||e[75]!==ue||e[76]!==ft||e[77]!==Me||e[78]!==B||e[79]!==we||e[80]!==x?.mapBorderColor||e[81]!==x?.mapBorderWidth||e[82]!==dt||e[83]!==r||e[84]!==me||e[85]!==D||e[86]!==ie||e[87]!==X||e[88]!==vt||e[89]!==ht||e[90]!==f||e[91]!==ct||e[92]!==gt||e[93]!==H||e[94]!==I||e[95]!==u||e[96]!==P||e[97]!==i||e[98]!==Oe||e[99]!==te||e[100]!==z||e[101]!==l.dateFormat||e[102]!==l.enabled||e[103]!==je||e[104]!==p||e[105]!==g||e[106]!==xt||e[107]!==ut||e[108]!==V||e[109]!==N?(ge=t.jsxRuntimeExports.jsx(Ot.GraphArea,{ref:jt,children:te&&Oe&&me?t.jsxRuntimeExports.jsx(Zt,{data:a.filter(d=>l.enabled?`${d.date}`===St.format(new Date(p[W]),l.dateFormat||"yyyy"):d),mapData:u?me:{...me,features:me.features.filter(eo)},colorDomain:et,width:te,height:Oe,scale:H,centerPoint:ae,colors:R||(I==="categorical"?it.Colors[z].categoricalColors.colors:it.Colors[z].sequentialColors[`neutralColorsx0${et.length+1}`]),colorLegendTitle:U,mapBorderWidth:B,mapNoDataColor:we,categorical:I==="categorical",mapBorderColor:Me,tooltip:je,onSeriesMouseOver:X,isWorldMap:ue,showColorScale:P,zoomScaleExtend:V,zoomTranslateExtend:N,onSeriesMouseClick:ie,mapProperty:r,highlightedIds:o,resetSelectionOnDoubleClick:ct,styles:i,overlayMapData:vt,overlayMapBorderColor:x?.mapBorderColor,overlayMapBorderWidth:x?.mapBorderWidth,classNames:c,detailsOnClick:De,mapProjection:dt||(ue?"naturalEarth":"mercator"),zoomInteraction:ut,dimmedOpacity:pt,animate:Fe===!0?{duration:.5,once:!0,amount:.5}:Fe||{duration:0,once:!0,amount:0},customLayers:mt,zoomAndCenterByHighlightedIds:xt,collapseColorScaleByDefault:K,projectionRotate:ht,rewindCoordinatesInMapData:gt,locale:ft}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(D,h||(f?D?(g||te)*f>D?(g||te)*f:D:(g||te)*f:Oe))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(_t.w,{"aria-label":"Loading graph"})})}),e[61]=Fe,e[62]=ae,e[63]=c,e[64]=K,e[65]=U,e[66]=R,e[67]=mt,e[68]=a,e[69]=De,e[70]=pt,e[71]=et,e[72]=h,e[73]=o,e[74]=W,e[75]=ue,e[76]=ft,e[77]=Me,e[78]=B,e[79]=we,e[80]=x?.mapBorderColor,e[81]=x?.mapBorderWidth,e[82]=dt,e[83]=r,e[84]=me,e[85]=D,e[86]=ie,e[87]=X,e[88]=vt,e[89]=ht,e[90]=f,e[91]=ct,e[92]=gt,e[93]=H,e[94]=I,e[95]=u,e[96]=P,e[97]=i,e[98]=Oe,e[99]=te,e[100]=z,e[101]=l.dateFormat,e[102]=l.enabled,e[103]=je,e[104]=p,e[105]=g,e[106]=xt,e[107]=ut,e[108]=V,e[109]=N,e[110]=ge):ge=e[110];let fe;e[111]!==c?.footnote||e[112]!==c?.source||e[113]!==Q||e[114]!==F||e[115]!==i?.footnote||e[116]!==i?.source||e[117]!==g?(fe=F||Q?t.jsxRuntimeExports.jsx(Xt.GraphFooter,{styles:{footnote:i?.footnote,source:i?.source},classNames:{footnote:c?.footnote,source:c?.source},sources:F,footNote:Q,width:g}):null,e[111]=c?.footnote,e[112]=c?.source,e[113]=Q,e[114]=F,e[115]=i?.footnote,e[116]=i?.source,e[117]=g,e[118]=fe):fe=e[118];let nt;return e[119]!==ke||e[120]!==Se||e[121]!==w||e[122]!==h||e[123]!==Ne||e[124]!==D||e[125]!==ve||e[126]!==f||e[127]!==kt||e[128]!==Dt||e[129]!==he||e[130]!==xe||e[131]!==ge||e[132]!==fe||e[133]!==z||e[134]!==g?(nt=t.jsxRuntimeExports.jsxs(Ot.GraphContainer,{className:kt,style:Dt,id:w,ref:Rt,"aria-label":ke,backgroundColor:Se,theme:z,language:Ne,minHeight:D,width:g,height:h,relativeHeight:f,padding:ve,children:[he,xe,ge,fe]}),e[119]=ke,e[120]=Se,e[121]=w,e[122]=h,e[123]=Ne,e[124]=D,e[125]=ve,e[126]=f,e[127]=kt,e[128]=Dt,e[129]=he,e[130]=xe,e[131]=ge,e[132]=fe,e[133]=z,e[134]=g,e[135]=nt):nt=e[135],nt}function eo(m){return m.properties?.NAME!=="Antarctica"}function to(m){return m!==void 0}function oo(m){return m!==void 0}function ro(m){return m.data}function ao(m){return m!==void 0}function no(m){return m.data}function so(m){return m.x}function io(m,e){return m-e}function lo(m){return m.date}exports.ChoroplethMap=Qt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-D4pAp7u0.cjs"),s=require("react"),Ct=require("./getSliderMarks-BzrpHrHS.cjs"),Pt=require("./Spinner-WHzzloYQ.cjs"),Rt=require("./parse-xYI9yrvL.cjs"),zt=require("./index-DQA8q5sC.cjs"),w=require("./index-DLFt97gy.cjs"),wt=require("./Typography-BqmyF1gP.cjs"),_t=require("./index-C5K--w8d.cjs"),Wt=require("./numberFormattingFunction-Cn9R7CM9.cjs"),At=require("./Tooltip-Hr46paWP.cjs"),Ft=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),lt=require("./index-BhI7mBJx.cjs"),$t=require("./DetailsModal-jmmKRMRM.cjs"),Lt=require("./ordinal-CrsysVE-.cjs"),Tt=require("./threshold-DNsSUf8Q.cjs"),kt=require("./select-Bnfk0lJx.cjs"),st=require("./proxy-CqH8m8IQ.cjs"),Gt=require("./use-in-view-dnRv_qqF.cjs"),Ht=require("./index-FXfr51ZM.cjs"),Vt=require("./GraphFooter.cjs"),Ut=require("./GraphHeader.cjs"),it=require("./Colors.cjs"),St=require("./fetchAndParseData-QTF6tjij.cjs"),Xt=require("./getUniqValue-NX8DgwND.cjs"),Yt=require("./getJenks-BzJvhy_H.cjs"),Mt=require("./GraphContainer-Cul9b74X.cjs");function Jt(m){const{data:e,colorDomain:n,colors:i,mapData:_,colorLegendTitle:D,categorical:W,height:y,width:h,scale:g,centerPoint:A,tooltip:ee,mapBorderWidth:V,mapBorderColor:te,mapNoDataColor:fe,onSeriesMouseOver:oe,showColorScale:ye,zoomScaleExtend:Ie,zoomTranslateExtend:Pe,highlightedIds:E,onSeriesMouseClick:re,mapProperty:f,resetSelectionOnDoubleClick:ve,detailsOnClick:U,styles:ze,classNames:ae,mapProjection:S,zoomInteraction:M,animate:C,dimmedOpacity:F,customLayers:ne,collapseColorScaleByDefault:je,zoomAndCenterByHighlightedIds:Ee,projectionRotate:$,rewindCoordinatesInMapData:X,overlayMapData:Y,overlayMapBorderColor:_e,overlayMapBorderWidth:We,locale:be}=m,j=s.useMemo(()=>X?w.index_default(_,{reverse:!0}):_,[_,X]),ke=s.useMemo(()=>!X||!Y?Y:w.index_default(Y,{reverse:!0}),[Y,X]),[l,d]=s.useState(void 0),se=s.useRef(null),[Ae,De]=s.useState(je===void 0?!(h<680):!je),[ie,L]=s.useState(void 0),[N,J]=s.useState(void 0),[K,le]=s.useState(void 0),[Ce,x]=s.useState(void 0),T=s.useRef(null),b=Gt.useInView(T,{once:C.once,amount:C.amount}),Z=s.useRef(null),O=W?Lt.ordinal().domain(n).range(i):Tt.threshold().domain(n).range(i);s.useEffect(()=>{const o=kt.select(Z.current),r=kt.select(T.current),v=a=>{if(M==="noZoom")return!1;if(M==="button")return!a.type.includes("wheel");const I=a.type==="wheel",Me=a.type.startsWith("touch"),Ne=a.type==="mousedown"||a.type==="mousemove";return Me?!0:I?M==="scroll"?!0:a.ctrlKey:Ne&&!a.button&&!a.ctrlKey},R=w.zoom().scaleExtent(Ie).translateExtent(Pe||[[-20,-20],[h+20,y+20]]).filter(v).on("zoom",({transform:a})=>{o.attr("transform",a)});r.call(R),se.current=R},[y,h,M]);const G=w.index_default$1({...j,features:Ee?j.features.filter(o=>(E||[]).length===0||E?.indexOf(o.properties[f])!==-1):j.features}),q=_t.index_default({...j,features:Ee?j.features.filter(o=>(E||[]).length===0||E?.indexOf(o.properties[f])!==-1):j.features}),Re=(G[2]-G[0])*1.15,we=(G[3]-G[1])*1.15,Se=h*190/960*360/Re,ce=y*190/678*180/we,B=g*Math.min(Se,ce),de=S==="mercator"?w.geoMercator().rotate($).center(A||q.geometry.coordinates).translate([h/2,y/2]).scale(B):S==="equalEarth"?w.geoEqualEarth().rotate($).center(A||q.geometry.coordinates).translate([h/2,y/2]).scale(B):S==="naturalEarth"?w.geoNaturalEarth1().rotate($).center(A||q.geometry.coordinates).translate([h/2,y/2]).scale(B):S==="orthographic"?w.geoOrthographic().rotate($).center(A||q.geometry.coordinates).translate([h/2,y/2]).scale(B):w.geoAlbersUsa().rotate($).center(A||q.geometry.coordinates).translate([h/2,y/2]).scale(B),H=w.geoPath().projection(de),ue=o=>{if(!T.current||!se.current)return;kt.select(T.current).call(se.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(st.motion.svg,{width:`${h}px`,height:`${y}px`,viewBox:`0 0 ${h} ${y}`,ref:T,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:Z,children:[ne.filter(o=>o.position==="before").map(o=>o.layer),j.features.map((o,r)=>{if(!o.properties?.[f])return null;const v=H(o);return v?t.jsxRuntimeExports.jsx(st.motion.g,{opacity:l?F:E?E.indexOf(o.properties[f])!==-1?1:F:1,children:t.jsxRuntimeExports.jsx("path",{d:v,style:{stroke:te,strokeWidth:V,fill:fe,vectorEffect:"non-scaling-stroke"}})},r):null}),t.jsxRuntimeExports.jsx(Ht.AnimatePresence,{children:e.map(o=>{const r=j.features.findIndex(a=>o.id===a.properties[f]);if(r===-1)return null;const v=H(j.features[r]);if(!v)return null;const R=Ft.checkIfNullOrUndefined(o.x)?fe:O(o.x);return t.jsxRuntimeExports.jsx(st.motion.g,{className:"undp-map-shapes",variants:{initial:{opacity:0},whileInView:{opacity:l?l===R?1:F:E?E.indexOf(o.id)!==-1?1:F:1,transition:{duration:C.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:C.duration}},onMouseEnter:a=>{J(o),x(a.clientY),le(a.clientX),oe?.(o)},onMouseMove:a=>{J(o),x(a.clientY),le(a.clientX)},onMouseLeave:()=>{J(void 0),le(void 0),x(void 0),oe?.(void 0)},onClick:()=>{(re||U)&&(zt.isEqual(ie,o)&&ve?(L(void 0),re?.(void 0)):(L(o),re?.(o)))},children:t.jsxRuntimeExports.jsx(st.motion.path,{d:v,variants:{initial:{fill:R,opacity:0},whileInView:{fill:R,opacity:1,transition:{duration:C.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:C.duration}},style:{stroke:te,strokeWidth:V,vectorEffect:"non-scaling-stroke"}},`${o.id}`)},o.id)})}),N?j.features.filter(o=>o.properties[f]===N.id).map((o,r)=>t.jsxRuntimeExports.jsx("path",{d:H(o)||"",className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5",vectorEffect:"non-scaling-stroke"}},r)):null,ke?.features.map((o,r)=>{const v=H(o);return v?t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("path",{d:v,style:{stroke:_e||te,strokeWidth:We||V+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},r):null}),ne.filter(o=>o.position==="after").map(o=>o.layer)]})}),ye===!1?null:t.jsxRuntimeExports.jsx("div",{className:t.mo("absolute left-4 bottom-4 map-color-legend",ae?.colorLegend),children:Ae?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:()=>{De(!1)},children:t.jsxRuntimeExports.jsx(lt.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:W?void 0:"340px"},children:[D&&D!==""?t.jsxRuntimeExports.jsx(wt._,{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:D}):null,W?t.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:n.map((o,r)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{d(i[r%i.length])},onMouseLeave:()=>{d(void 0)},children:[t.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i[r%i.length]}}),t.jsxRuntimeExports.jsx(wt._,{size:"sm",marginBottom:"none",leading:"none",children:o})]},r))}):t.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{children:[n.map((o,r)=>t.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{d(i[r])},onMouseLeave:()=>{d(void 0)},className:"cursor-pointer",children:[t.jsxRuntimeExports.jsx("rect",{x:r*320/i.length+1,y:1,width:320/i.length-2,height:8,className:l===i[r]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":"",style:{fill:i[r],...l===i[r]?{}:{stroke:i[r]}}}),t.jsxRuntimeExports.jsx("text",{x:(r+1)*320/i.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:Wt.numberFormattingFunction(o,"NA",void 0,void 0,void 0,be)})]},r)),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("rect",{onMouseOver:()=>{d(i[n.length])},onMouseLeave:()=>{d(void 0)},x:n.length*320/i.length+1,y:1,width:320/i.length-2,height:8,className:`cursor-pointer ${l===i[n.length]?"stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:i[n.length],...l===i[n.length]?{}:{stroke:i[n.length]}}})})]})})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{De(!0)},children:t.jsxRuntimeExports.jsx(lt.ExpandIcon,{})})}),M==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>ue("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:()=>ue("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:"–"})]})]}),U&&ie!==void 0?t.jsxRuntimeExports.jsx($t.DetailsModal,{body:U,data:ie,setData:L,className:ae?.modal}):null,N&&ee&&K&&Ce?t.jsxRuntimeExports.jsx(At.Tooltip,{data:N,body:ee,xPos:K,yPos:Ce,backgroundStyle:ze?.tooltip,className:ae?.tooltip}):null]})}function Kt(m){const e=t.compilerRuntimeExports.c(134),{data:n,mapData:i,graphTitle:_,colors:D,sources:W,graphDescription:y,height:h,width:g,footNote:A,colorDomain:ee,colorLegendTitle:V,scaleType:te,scale:fe,centerPoint:oe,padding:ye,mapBorderWidth:Ie,mapNoDataColor:Pe,backgroundColor:E,mapBorderColor:re,relativeHeight:f,tooltip:ve,onSeriesMouseOver:U,isWorldMap:ze,showColorScale:ae,zoomScaleExtend:S,zoomTranslateExtend:M,graphID:C,highlightedIds:F,onSeriesMouseClick:ne,mapProperty:je,graphDownload:Ee,dataDownload:$,showAntarctica:X,language:Y,minHeight:_e,theme:We,ariaLabel:be,resetSelectionOnDoubleClick:j,detailsOnClick:ke,styles:l,classNames:d,mapProjection:se,zoomInteraction:Ae,animate:De,dimmedOpacity:ie,customLayers:L,timeline:N,collapseColorScaleByDefault:J,projectionRotate:K,zoomAndCenterByHighlightedIds:le,rewindCoordinatesInMapData:Ce,mapOverlay:x,locale:T}=m,b=i===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":i,Z=A===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.":A,O=te===void 0?"threshold":te,G=fe===void 0?.95:fe,q=Ie===void 0?.5:Ie,Re=Pe===void 0?it.Colors.light.graphNoData:Pe,we=E===void 0?!1:E,Se=re===void 0?it.Colors.light.grays["gray-500"]:re,ce=ze===void 0?!0:ze,B=ae===void 0?!0:ae;let de;e[0]!==S?(de=S===void 0?[.8,6]:S,e[0]=S,e[1]=de):de=e[1];const H=de,ue=je===void 0?"ISO3":je,o=Ee===void 0?!1:Ee,r=$===void 0?!1:$,v=X===void 0?!1:X,R=Y===void 0?"en":Y,a=_e===void 0?0:_e,I=We===void 0?"light":We,Me=j===void 0?!0:j,Ne=se===void 0?"naturalEarth":se,ct=Ae===void 0?"button":Ae,Fe=De===void 0?!1:De,dt=ie===void 0?.3:ie;let $e;e[2]!==L?($e=L===void 0?[]:L,e[2]=L,e[3]=$e):$e=e[3];const ut=$e;let Le;e[4]!==N?(Le=N===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:N,e[4]=N,e[5]=Le):Le=e[5];const c=Le;let Te;e[6]!==K?(Te=K===void 0?[0,0]:K,e[6]=K,e[7]=Te):Te=e[7];const pt=Te,mt=le===void 0?!1:le,ht=Ce===void 0?!0:Ce,xt=T===void 0?"en":T,[Q,Nt]=s.useState(0),[Oe,Ot]=s.useState(0),[P,qt]=s.useState(c.autoplay);let qe;if(e[8]!==n||e[9]!==c.dateFormat){let u;e[11]!==c.dateFormat?(u=k=>Rt.parse(`${k.date}`,c.dateFormat||"yyyy",new Date).getTime(),e[11]=c.dateFormat,e[12]=u):u=e[12],qe=[...new Set(n.filter(so).map(u))],qe.sort(no),e[8]=n,e[9]=c.dateFormat,e[10]=qe}else qe=e[10];const p=qe,[z,gt]=s.useState(c.autoplay?0:p.length-1),[pe,Bt]=s.useState(void 0),[ft,It]=s.useState(void 0),yt=s.useRef(null),Dt=s.useRef(null);let Ge,He;e[13]===Symbol.for("react.memo_cache_sentinel")?(Ge=()=>{const u=new ResizeObserver(k=>{Nt(k[0].target.clientWidth||620),Ot(k[0].target.clientHeight||480)});return yt.current&&u.observe(yt.current),()=>u.disconnect()},He=[],e[13]=Ge,e[14]=He):(Ge=e[13],He=e[14]),s.useEffect(Ge,He);let Ve;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ve=u=>{Bt(u)},e[15]=Ve):Ve=e[15];const Ue=s.useEffectEvent(Ve);let Xe;e[16]===Symbol.for("react.memo_cache_sentinel")?(Xe=u=>{It(u)},e[16]=Xe):Xe=e[16];const Be=s.useEffectEvent(Xe);let Ye;e[17]!==b||e[18]!==Ue?(Ye=()=>{typeof b=="string"?St.fetchAndParseJSON(b).then(k=>{Ue(k)}):Ue(b)},e[17]=b,e[18]=Ue,e[19]=Ye):Ye=e[19];let Je;e[20]!==b?(Je=[b],e[20]=b,e[21]=Je):Je=e[21],s.useEffect(Ye,Je);let Ke;e[22]!==x?.mapData||e[23]!==Be?(Ke=()=>{x?.mapData||Be(void 0),typeof x?.mapData=="string"?St.fetchAndParseJSON(x?.mapData).then(k=>{Be(k)}):Be(x?.mapData)},e[22]=x?.mapData,e[23]=Be,e[24]=Ke):Ke=e[24];const vt=x?.mapData;let Ze;e[25]!==vt?(Ze=[vt],e[25]=vt,e[26]=Ze):Ze=e[26],s.useEffect(Ke,Ze);let Qe;e[27]!==ee||e[28]!==D?.length||e[29]!==n||e[30]!==O?(Qe=ee||(O==="categorical"?Xt.getUniqValue(n,"x"):Yt.getJenks(n.map(ao),D?.length||4)),e[27]=ee,e[28]=D?.length,e[29]=n,e[30]=O,e[31]=Qe):Qe=e[31];const et=Qe;let tt,ot;e[32]!==P||e[33]!==c.speed||e[34]!==p?(tt=()=>{const u=setInterval(()=>{gt(k=>k<p.length-1?k+1:0)},(c.speed||2)*1e3);return P||clearInterval(u),()=>clearInterval(u)},ot=[p,P,c.speed],e[32]=P,e[33]=c.speed,e[34]=p,e[35]=tt,e[36]=ot):(tt=e[35],ot=e[36]),s.useEffect(tt,ot);const jt=c.dateFormat||"yyyy";let rt;e[37]!==z||e[38]!==jt||e[39]!==c.showOnlyActiveDate||e[40]!==p?(rt=Ct.getSliderMarks(p,z,c.showOnlyActiveDate,jt),e[37]=z,e[38]=jt,e[39]=c.showOnlyActiveDate,e[40]=p,e[41]=rt):rt=e[41];const at=rt,Et=d?.graphContainer,bt=l?.graphContainer;let me;e[42]!==d?.description||e[43]!==d?.title||e[44]!==n||e[45]!==r||e[46]!==y||e[47]!==o||e[48]!==_||e[49]!==l?.description||e[50]!==l?.title||e[51]!==g?(me=_||y||o||r?t.jsxRuntimeExports.jsx(Ut.GraphHeader,{styles:{title:l?.title,description:l?.description},classNames:{title:d?.title,description:d?.description},graphTitle:_,graphDescription:y,width:g,graphDownload:o?Dt:void 0,dataDownload:r?n.map(ro).filter(oo).length>0?n.map(to).filter(eo):n.filter(Qt):null}):null,e[42]=d?.description,e[43]=d?.title,e[44]=n,e[45]=r,e[46]=y,e[47]=o,e[48]=_,e[49]=l?.description,e[50]=l?.title,e[51]=g,e[52]=me):me=e[52];let he;e[53]!==z||e[54]!==at||e[55]!==P||e[56]!==c.enabled||e[57]!==p?(he=c.enabled&&p.length>0&&at?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{qt(!P)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":P?"Click to pause animation":"Click to play animation",children:P?t.jsxRuntimeExports.jsx(lt.Pause,{}):t.jsxRuntimeExports.jsx(lt.Play,{})}),t.jsxRuntimeExports.jsx(Ct.Nr,{min:p[0],max:p[p.length-1],marks:at,step:null,defaultValue:p[p.length-1],value:p[z],onChangeComplete:u=>{gt(p.indexOf(u))},onChange:u=>{gt(p.indexOf(u))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[53]=z,e[54]=at,e[55]=P,e[56]=c.enabled,e[57]=p,e[58]=he):he=e[58];let xe;e[59]!==Fe||e[60]!==oe||e[61]!==d||e[62]!==J||e[63]!==V||e[64]!==D||e[65]!==ut||e[66]!==n||e[67]!==ke||e[68]!==dt||e[69]!==et||e[70]!==h||e[71]!==F||e[72]!==z||e[73]!==ce||e[74]!==xt||e[75]!==Se||e[76]!==q||e[77]!==Re||e[78]!==x?.mapBorderColor||e[79]!==x?.mapBorderWidth||e[80]!==Ne||e[81]!==ue||e[82]!==pe||e[83]!==a||e[84]!==ne||e[85]!==U||e[86]!==ft||e[87]!==pt||e[88]!==f||e[89]!==Me||e[90]!==ht||e[91]!==G||e[92]!==O||e[93]!==v||e[94]!==B||e[95]!==l||e[96]!==Oe||e[97]!==Q||e[98]!==I||e[99]!==c.dateFormat||e[100]!==c.enabled||e[101]!==ve||e[102]!==p||e[103]!==g||e[104]!==mt||e[105]!==ct||e[106]!==H||e[107]!==M?(xe=t.jsxRuntimeExports.jsx(Mt.GraphArea,{ref:yt,children:Q&&Oe&&pe?t.jsxRuntimeExports.jsx(Jt,{data:n.filter(u=>c.enabled?`${u.date}`===Rt.format(new Date(p[z]),c.dateFormat||"yyyy"):u),mapData:v?pe:{...pe,features:pe.features.filter(Zt)},colorDomain:et,width:Q,height:Oe,scale:G,centerPoint:oe,colors:D||(O==="categorical"?it.Colors[I].categoricalColors.colors:it.Colors[I].sequentialColors[`neutralColorsx0${et.length+1}`]),colorLegendTitle:V,mapBorderWidth:q,mapNoDataColor:Re,categorical:O==="categorical",mapBorderColor:Se,tooltip:ve,onSeriesMouseOver:U,isWorldMap:ce,showColorScale:B,zoomScaleExtend:H,zoomTranslateExtend:M,onSeriesMouseClick:ne,mapProperty:ue,highlightedIds:F,resetSelectionOnDoubleClick:Me,styles:l,overlayMapData:ft,overlayMapBorderColor:x?.mapBorderColor,overlayMapBorderWidth:x?.mapBorderWidth,classNames:d,detailsOnClick:ke,mapProjection:Ne||(ce?"naturalEarth":"mercator"),zoomInteraction:ct,dimmedOpacity:dt,animate:Fe===!0?{duration:.5,once:!0,amount:.5}:Fe||{duration:0,once:!0,amount:0},customLayers:ut,zoomAndCenterByHighlightedIds:mt,collapseColorScaleByDefault:J,projectionRotate:pt,rewindCoordinatesInMapData:ht,locale:xt}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(a,h||(f?a?(g||Q)*f>a?(g||Q)*f:a:(g||Q)*f:Oe))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(Pt.w,{"aria-label":"Loading graph"})})}),e[59]=Fe,e[60]=oe,e[61]=d,e[62]=J,e[63]=V,e[64]=D,e[65]=ut,e[66]=n,e[67]=ke,e[68]=dt,e[69]=et,e[70]=h,e[71]=F,e[72]=z,e[73]=ce,e[74]=xt,e[75]=Se,e[76]=q,e[77]=Re,e[78]=x?.mapBorderColor,e[79]=x?.mapBorderWidth,e[80]=Ne,e[81]=ue,e[82]=pe,e[83]=a,e[84]=ne,e[85]=U,e[86]=ft,e[87]=pt,e[88]=f,e[89]=Me,e[90]=ht,e[91]=G,e[92]=O,e[93]=v,e[94]=B,e[95]=l,e[96]=Oe,e[97]=Q,e[98]=I,e[99]=c.dateFormat,e[100]=c.enabled,e[101]=ve,e[102]=p,e[103]=g,e[104]=mt,e[105]=ct,e[106]=H,e[107]=M,e[108]=xe):xe=e[108];let ge;e[109]!==d?.footnote||e[110]!==d?.source||e[111]!==Z||e[112]!==W||e[113]!==l?.footnote||e[114]!==l?.source||e[115]!==g?(ge=W||Z?t.jsxRuntimeExports.jsx(Vt.GraphFooter,{styles:{footnote:l?.footnote,source:l?.source},classNames:{footnote:d?.footnote,source:d?.source},sources:W,footNote:Z,width:g}):null,e[109]=d?.footnote,e[110]=d?.source,e[111]=Z,e[112]=W,e[113]=l?.footnote,e[114]=l?.source,e[115]=g,e[116]=ge):ge=e[116];let nt;return e[117]!==be||e[118]!==we||e[119]!==C||e[120]!==h||e[121]!==R||e[122]!==a||e[123]!==ye||e[124]!==f||e[125]!==Et||e[126]!==bt||e[127]!==me||e[128]!==he||e[129]!==xe||e[130]!==ge||e[131]!==I||e[132]!==g?(nt=t.jsxRuntimeExports.jsxs(Mt.GraphContainer,{className:Et,style:bt,id:C,ref:Dt,"aria-label":be,backgroundColor:we,theme:I,language:R,minHeight:a,width:g,height:h,relativeHeight:f,padding:ye,children:[me,he,xe,ge]}),e[117]=be,e[118]=we,e[119]=C,e[120]=h,e[121]=R,e[122]=a,e[123]=ye,e[124]=f,e[125]=Et,e[126]=bt,e[127]=me,e[128]=he,e[129]=xe,e[130]=ge,e[131]=I,e[132]=g,e[133]=nt):nt=e[133],nt}function Zt(m){return m.properties?.NAME!=="Antarctica"}function Qt(m){return m!==void 0}function eo(m){return m!==void 0}function to(m){return m.data}function oo(m){return m!==void 0}function ro(m){return m.data}function ao(m){return m.x}function no(m,e){return m-e}function so(m){return m.date}exports.ChoroplethMap=Kt;
|
|
2
2
|
//# sourceMappingURL=ChoroplethMap.cjs.map
|