@undp/data-viz 2.5.0 → 2.5.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 +275 -272
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +321 -318
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.js +268 -265
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/{GraphEl-B7x5ku_y.cjs → GraphEl-BgkDbq50.cjs} +2 -2
- package/dist/GraphEl-BgkDbq50.cjs.map +1 -0
- package/dist/{GraphEl-B8tGXqWk.js → GraphEl-Ch0uAeZw.js} +2 -1
- package/dist/GraphEl-Ch0uAeZw.js.map +1 -0
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.d.ts +1 -0
- package/dist/GriddedGraphs.js +1 -1
- package/dist/GriddedGraphsFromConfig.d.ts +1 -0
- package/dist/HybridMap.cjs +1 -1
- package/dist/HybridMap.cjs.map +1 -1
- package/dist/HybridMap.js +304 -301
- package/dist/HybridMap.js.map +1 -1
- package/dist/ImageDownloadButton.cjs +1 -1
- package/dist/ImageDownloadButton.js +1 -1
- package/dist/MultiGraphDashboard.d.ts +1 -0
- package/dist/MultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +1 -0
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/PerformanceIntensiveScrollStory.d.ts +1 -0
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.cjs.map +1 -1
- package/dist/ScatterPlot.d.ts +2 -0
- package/dist/ScatterPlot.js +451 -449
- package/dist/ScatterPlot.js.map +1 -1
- package/dist/ScrollStory.d.ts +1 -0
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.d.ts +1 -0
- package/dist/SingleGraphDashboard.js +1 -1
- package/dist/SingleGraphDashboardFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardGeoHubMaps.d.ts +1 -0
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphs.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +1 -0
- package/dist/Types.d.ts +1 -0
- package/dist/{imageDownload-Diofs_vY.js → imageDownload-BYsNEtMS.js} +11 -11
- package/dist/{imageDownload-Diofs_vY.js.map → imageDownload-BYsNEtMS.js.map} +1 -1
- package/dist/{imageDownload-61q6jyJW.cjs → imageDownload-CkMwA7Cw.cjs} +4 -4
- package/dist/{imageDownload-61q6jyJW.cjs.map → imageDownload-CkMwA7Cw.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/GraphEl-B7x5ku_y.cjs.map +0 -1
- package/dist/GraphEl-B8tGXqWk.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-D4pAp7u0.cjs"),a=require("react"),Rt=require("./getSliderMarks-BzrpHrHS.cjs"),Ft=require("./Spinner-WHzzloYQ.cjs"),wt=require("./parse-xYI9yrvL.cjs"),Lt=require("./index-DQA8q5sC.cjs"),S=require("./index-DLFt97gy.cjs"),$t=require("./index-C5K--w8d.cjs"),St=require("./Typography-BqmyF1gP.cjs"),Mt=require("./numberFormattingFunction-u2iNHL_c.cjs"),Tt=require("./Tooltip-C9F3uYG0.cjs"),Nt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),dt=require("./index-BhI7mBJx.cjs"),Gt=require("./DetailsModal-Du8Fr1QD.cjs"),Dt=require("./select-Bnfk0lJx.cjs"),Ot=require("./threshold-DNsSUf8Q.cjs"),ct=require("./proxy-CqH8m8IQ.cjs"),Ht=require("./use-in-view-dnRv_qqF.cjs"),Vt=require("./index-FXfr51ZM.cjs"),Ut=require("./GraphHeader.cjs"),Xt=require("./GraphFooter.cjs"),Ct=require("./Colors.cjs"),Bt=require("./fetchAndParseData-QTF6tjij.cjs"),qt=require("./getJenks-BzJvhy_H.cjs"),It=require("./GraphContainer-Cul9b74X.cjs");function Yt(i){const{data:e,xDomain:c,mapData:$,xColorLegendTitle:Ae,yDomain:te,yColorLegendTitle:oe,width:y,height:h,colors:x,scale:Fe,centerPoint:D,mapBorderWidth:M,mapNoDataColor:re,mapBorderColor:ae,tooltip:ne,onSeriesMouseOver:ge,zoomScaleExtend:ye,zoomTranslateExtend:ve,highlightedIds:j,onSeriesMouseClick:ie,mapProperty:N,resetSelectionOnDoubleClick:Le,detailsOnClick:b,showColorScale:je,styles:$e,classNames:T,mapProjection:G,zoomInteraction:O,animate:B,dimmedOpacity:q,customLayers:se,collapseColorScaleByDefault:be,zoomAndCenterByHighlightedIds:Ee,projectionRotate:H,rewindCoordinatesInMapData:X,overlayMapData:Y,overlayMapBorderColor:Te,overlayMapBorderWidth:Ge,xNumberDisplayOptions:J,yNumberDisplayOptions:le}=i,v=a.useMemo(()=>X?S.index_default($,{reverse:!0}):$,[$,X]),d=a.useMemo(()=>!X||!Y?Y:S.index_default(Y,{reverse:!0}),[Y,X]),[p,De]=a.useState(be===void 0?!(y<680):!be),[Z,Ce]=a.useState(void 0),[ce,V]=a.useState(void 0),[I,K]=a.useState(void 0),[ke,U]=a.useState(void 0),[Re,f]=a.useState(void 0),_=a.useRef(null),de=Ht.useInView(_,{once:B.once,amount:B.amount}),C=a.useRef(null),k=a.useRef(null);a.useEffect(()=>{const t=Dt.select(C.current),r=Dt.select(_.current),u=g=>{if(O==="noZoom")return!1;if(O==="button")return!g.type.includes("wheel");const w=g.type==="wheel",E=g.type.startsWith("touch"),_e=g.type==="mousedown"||g.type==="mousemove";return E?!0:w?O==="scroll"?!0:g.ctrlKey:_e&&!g.button&&!g.ctrlKey},m=S.zoom().scaleExtent(ye).translateExtent(ve||[[-20,-20],[y+20,h+20]]).filter(u).on("zoom",({transform:g})=>{t.attr("transform",g)});r.call(m),k.current=m},[h,y,O]);const z=S.index_default$1({...v,features:Ee?v.features.filter(t=>(j||[]).length===0||j?.indexOf(t.properties[N])!==-1):v.features}),P=$t.index_default({...v,features:Ee?v.features.filter(t=>(j||[]).length===0||j?.indexOf(t.properties[N])!==-1):v.features}),we=(z[2]-z[0])*1.15,Se=(z[3]-z[1])*1.15,Me=y*190/960*360/we,Ne=h*190/678*180/Se,W=Fe*Math.min(Me,Ne),Oe=G==="mercator"?S.geoMercator().rotate(H).center(D||P.geometry.coordinates).translate([y/2,h/2]).scale(W):G==="equalEarth"?S.geoEqualEarth().rotate(H).center(D||P.geometry.coordinates).translate([y/2,h/2]).scale(W):G==="naturalEarth"?S.geoNaturalEarth1().rotate(H).center(D||P.geometry.coordinates).translate([y/2,h/2]).scale(W):G==="orthographic"?S.geoOrthographic().rotate(H).center(D||P.geometry.coordinates).translate([y/2,h/2]).scale(W):S.geoAlbersUsa().rotate(H).center(D||P.geometry.coordinates).translate([y/2,h/2]).scale(W),A=S.geoPath().projection(Oe),pe=Array.from({length:c.length},(t,r)=>r),Be=Array.from({length:te.length},(t,r)=>r),qe=Ot.threshold().domain(c).range(pe),Ie=Ot.threshold().domain(te).range(Be),Q=t=>{if(!_.current||!k.current)return;Dt.select(_.current).call(k.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(ct.motion.svg,{viewBox:`0 0 ${y} ${h}`,width:`${y}px`,height:`${h}px`,ref:_,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:C,children:[se.filter(t=>t.position==="before").map(t=>t.layer),v.features.map((t,r)=>{if(!t.properties?.[N])return null;const u=A(t);return u?o.jsxRuntimeExports.jsx(ct.motion.g,{opacity:Z?q:j?j.indexOf(t.properties[N])!==-1?1:q:1,children:o.jsxRuntimeExports.jsx("path",{d:u,style:{stroke:ae,strokeWidth:M,fill:re,vectorEffect:"non-scaling-stroke"}})},r):null}),o.jsxRuntimeExports.jsx(Vt.AnimatePresence,{children:e.map(t=>{const r=v.features.findIndex(E=>t.id===E.properties[N]);if(r===-1)return null;const u=A(v.features[r]);if(!u)return null;const m=Nt.checkIfNullOrUndefined(t.x)?void 0:qe(t.x),g=Nt.checkIfNullOrUndefined(t.y)?void 0:Ie(t.y),w=m!==void 0&&g!==void 0?x[g][m]:re;return o.jsxRuntimeExports.jsx(ct.motion.g,{className:"undp-map-shapes",variants:{initial:{opacity:0},whileInView:{opacity:Z?Z===w&&(!j||j.indexOf(t.id)!==-1)?1:q:j?j.indexOf(t.id)!==-1?1:q:1,transition:{duration:B.duration}}},initial:"initial",animate:de?"whileInView":"initial",exit:{opacity:0,transition:{duration:B.duration}},onMouseEnter:E=>{K(t),f(E.clientY),U(E.clientX),ge?.(t)},onClick:()=>{(ie||b)&&(Lt.isEqual(ce,t)&&Le?(V(void 0),ie?.(void 0)):(V(t),ie?.(t)))},onMouseMove:E=>{K(t),f(E.clientY),U(E.clientX)},onMouseLeave:()=>{K(void 0),U(void 0),f(void 0),ge?.(void 0)},children:o.jsxRuntimeExports.jsx(ct.motion.path,{d:u,variants:{initial:{fill:w,opacity:0},whileInView:{fill:w,opacity:1,transition:{duration:B.duration}}},initial:"initial",animate:de?"whileInView":"initial",exit:{opacity:0,transition:{duration:B.duration}},className:`${w===re?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{stroke:ae,strokeWidth:M,vectorEffect:"non-scaling-stroke"}},`${t.id}`)},t.id)})}),I?v.features.filter(t=>t.properties[N]===I.id).map((t,r)=>o.jsxRuntimeExports.jsx("path",{d:A(t)||"",className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5",vectorEffect:"non-scaling-stroke"}},r)):null,d?.features.map((t,r)=>{const u=A(t);return u?o.jsxRuntimeExports.jsx("g",{children:o.jsxRuntimeExports.jsx("path",{d:u,style:{stroke:Te||ae,strokeWidth:Ge||M+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},r):null}),se.filter(t=>t.position==="after").map(t=>t.layer)]})}),je===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",T?.colorLegend),children:p?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{De(!1)},children:o.jsxRuntimeExports.jsx(dt.X,{})}),o.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:"175px"},children:[o.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[o.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:o.jsxRuntimeExports.jsxs("g",{children:[x.map((t,r)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-r*25})`,children:t.map((u,m)=>o.jsxRuntimeExports.jsx("rect",{y:1,x:m*25+1,fill:u,width:23,height:23,strokeWidth:Z===u?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{Ce(u)},onMouseLeave:()=>{Ce(void 0)}},m))},r)),o.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:c.map((t,r)=>o.jsxRuntimeExports.jsx("text",{y:10,x:(r+1)*25,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:Mt.numberFormattingFunction(t,void 0,J?.precision??2,void 0,void 0,J?.locale||"en",J?.padZeros||!1)},r))}),te.map((t,r)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(c.length+1,5),4)*25+10},${100-r*25})`,children:o.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:Mt.numberFormattingFunction(t,void 0,le?.precision??2,void 0,void 0,le?.locale||"en",le?.padZeros||!1)})},r))]})}),o.jsxRuntimeExports.jsx(St._,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:oe})]}),o.jsxRuntimeExports.jsx(St._,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:Ae})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{De(!0)},children:o.jsxRuntimeExports.jsx(dt.ExpandIcon,{})})}),O==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>Q("in"),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",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>Q("out"),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",children:"–"})]})]}),I&&ne&&ke&&Re?o.jsxRuntimeExports.jsx(Tt.Tooltip,{data:I,body:ne,xPos:ke,yPos:Re,backgroundStyle:$e?.tooltip,className:T?.tooltip}):null,b&&ce!==void 0?o.jsxRuntimeExports.jsx(Gt.DetailsModal,{body:b,data:ce,setData:V,className:T?.modal}):null]})}function Jt(i){const e=o.compilerRuntimeExports.c(130),{data:c,graphTitle:$,mapData:Ae,colors:te,sources:oe,graphDescription:y,height:h,width:x,footNote:Fe,xDomain:D,yDomain:M,xColorLegendTitle:re,yColorLegendTitle:ae,tooltip:ne,scale:ge,centerPoint:ye,padding:ve,mapBorderWidth:j,mapNoDataColor:ie,backgroundColor:N,mapBorderColor:Le,relativeHeight:b,onSeriesMouseOver:je,isWorldMap:$e,zoomScaleExtend:T,zoomTranslateExtend:G,graphID:O,showColorScale:B,highlightedIds:q,onSeriesMouseClick:se,mapProperty:be,graphDownload:Ee,dataDownload:H,showAntarctica:X,language:Y,minHeight:Te,theme:Ge,ariaLabel:J,resetSelectionOnDoubleClick:le,detailsOnClick:v,styles:d,classNames:p,mapProjection:De,zoomInteraction:Z,animate:Ce,dimmedOpacity:ce,customLayers:V,timeline:I,collapseColorScaleByDefault:K,zoomAndCenterByHighlightedIds:ke,projectionRotate:U,rewindCoordinatesInMapData:Re,mapOverlay:f,xNumberDisplayOptions:_,yNumberDisplayOptions:de}=i,C=Ae===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":Ae,k=te===void 0?Ct.Colors.light.bivariateColors.colors05x05:te,z=Fe===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.":Fe,P=re===void 0?"X Color key":re,we=ae===void 0?"Y Color key":ae,Se=ge===void 0?.95:ge,Me=j===void 0?.5:j,Ne=ie===void 0?Ct.Colors.light.graphNoData:ie,W=N===void 0?!1:N,Oe=Le===void 0?Ct.Colors.light.grays["gray-500"]:Le,A=$e===void 0?!0:$e;let pe;e[0]!==T?(pe=T===void 0?[.8,6]:T,e[0]=T,e[1]=pe):pe=e[1];const Be=pe,qe=B===void 0?!0:B,Ie=be===void 0?"ISO3":be,Q=Ee===void 0?!1:Ee,t=H===void 0?!1:H,r=X===void 0?!1:X,u=Y===void 0?"en":Y,m=Te===void 0?0:Te,g=Ge===void 0?"light":Ge,w=le===void 0?!0:le,E=De===void 0?"naturalEarth":De,_e=Z===void 0?"button":Z,He=Ce===void 0?!1:Ce,pt=ce===void 0?.3:ce;let Ve;e[2]!==V?(Ve=V===void 0?[]:V,e[2]=V,e[3]=Ve):Ve=e[3];const ut=Ve;let Ue;e[4]!==I?(Ue=I===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:I,e[4]=I,e[5]=Ue):Ue=e[5];const n=Ue,mt=ke===void 0?!1:ke;let Xe;e[6]!==U?(Xe=U===void 0?[0,0]:U,e[6]=U,e[7]=Xe):Xe=e[7];const ht=Xe,xt=Re===void 0?!0:Re,[ee,_t]=a.useState(0),[ze,zt]=a.useState(0),[F,Pt]=a.useState(n.autoplay);let Pe;if(e[8]!==c||e[9]!==n.dateFormat){let s;e[11]!==n.dateFormat?(s=R=>wt.parse(`${R.date}`,n.dateFormat||"yyyy",new Date).getTime(),e[11]=n.dateFormat,e[12]=s):s=e[12],Pe=[...new Set(c.filter(io).map(s))],Pe.sort(no),e[8]=c,e[9]=n.dateFormat,e[10]=Pe}else Pe=e[10];const l=Pe,[L,ft]=a.useState(n.autoplay?0:l.length-1),[ue,Wt]=a.useState(void 0),[gt,At]=a.useState(void 0),yt=a.useRef(null),kt=a.useRef(null);let Ye,Je;e[13]===Symbol.for("react.memo_cache_sentinel")?(Ye=()=>{const s=new ResizeObserver(R=>{_t(R[0].target.clientWidth||620),zt(R[0].target.clientHeight||480)});return yt.current&&s.observe(yt.current),()=>s.disconnect()},Je=[],e[13]=Ye,e[14]=Je):(Ye=e[13],Je=e[14]),a.useEffect(Ye,Je);let Ze;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ze=s=>{Wt(s)},e[15]=Ze):Ze=e[15];const Ke=a.useEffectEvent(Ze);let Qe;e[16]===Symbol.for("react.memo_cache_sentinel")?(Qe=s=>{At(s)},e[16]=Qe):Qe=e[16];const We=a.useEffectEvent(Qe);let et;e[17]!==C||e[18]!==Ke?(et=()=>{typeof C=="string"?Bt.fetchAndParseJSON(C).then(R=>{Ke(R)}):Ke(C)},e[17]=C,e[18]=Ke,e[19]=et):et=e[19];let tt;e[20]!==C?(tt=[C],e[20]=C,e[21]=tt):tt=e[21],a.useEffect(et,tt);let ot;e[22]!==f?.mapData||e[23]!==We?(ot=()=>{f?.mapData||We(void 0),typeof f?.mapData=="string"?Bt.fetchAndParseJSON(f?.mapData).then(R=>{We(R)}):We(f?.mapData)},e[22]=f?.mapData,e[23]=We,e[24]=ot):ot=e[24];const vt=f?.mapData;let rt;e[25]!==vt?(rt=[vt],e[25]=vt,e[26]=rt):rt=e[26],a.useEffect(ot,rt);let at,nt;e[27]!==F||e[28]!==n.speed||e[29]!==l?(at=()=>{const s=setInterval(()=>{ft(R=>R<l.length-1?R+1:0)},(n.speed||2)*1e3);return F||clearInterval(s),()=>clearInterval(s)},nt=[l,F,n.speed],e[27]=F,e[28]=n.speed,e[29]=l,e[30]=at,e[31]=nt):(at=e[30],nt=e[31]),a.useEffect(at,nt);const jt=n.dateFormat||"yyyy";let it;e[32]!==L||e[33]!==jt||e[34]!==n.showOnlyActiveDate||e[35]!==l?(it=Rt.getSliderMarks(l,L,n.showOnlyActiveDate,jt),e[32]=L,e[33]=jt,e[34]=n.showOnlyActiveDate,e[35]=l,e[36]=it):it=e[36];const st=it;if(D&&M&&(D.length!==k[0].length-1||M.length!==k.length-1))return console.error("the xDomain and yDomain array length don't match to the color array length"),null;const bt=p?.graphContainer,Et=d?.graphContainer;let me;e[37]!==p?.description||e[38]!==p?.title||e[39]!==c||e[40]!==t||e[41]!==y||e[42]!==Q||e[43]!==$||e[44]!==d?.description||e[45]!==d?.title||e[46]!==x?(me=$||y||Q||t?o.jsxRuntimeExports.jsx(Ut.GraphHeader,{styles:{title:d?.title,description:d?.description},classNames:{title:p?.title,description:p?.description},graphTitle:$,graphDescription:y,width:x,graphDownload:Q?kt:void 0,dataDownload:t?c.map(ao).filter(ro).length>0?c.map(oo).filter(to):c.filter(eo):null}):null,e[37]=p?.description,e[38]=p?.title,e[39]=c,e[40]=t,e[41]=y,e[42]=Q,e[43]=$,e[44]=d?.description,e[45]=d?.title,e[46]=x,e[47]=me):me=e[47];let he;e[48]!==L||e[49]!==st||e[50]!==F||e[51]!==n.enabled||e[52]!==l?(he=n.enabled&&l.length>0&&st?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Pt(!F)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":F?"Click to pause animation":"Click to play animation",children:F?o.jsxRuntimeExports.jsx(dt.Pause,{}):o.jsxRuntimeExports.jsx(dt.Play,{})}),o.jsxRuntimeExports.jsx(Rt.Nr,{min:l[0],max:l[l.length-1],marks:st,step:null,defaultValue:l[l.length-1],value:l[L],onChangeComplete:s=>{ft(l.indexOf(s))},onChange:s=>{ft(l.indexOf(s))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[48]=L,e[49]=st,e[50]=F,e[51]=n.enabled,e[52]=l,e[53]=he):he=e[53];let xe;e[54]!==He||e[55]!==ye||e[56]!==p||e[57]!==K||e[58]!==k||e[59]!==ut||e[60]!==c||e[61]!==v||e[62]!==pt||e[63]!==h||e[64]!==q||e[65]!==L||e[66]!==A||e[67]!==Oe||e[68]!==Me||e[69]!==Ne||e[70]!==f?.mapBorderColor||e[71]!==f?.mapBorderWidth||e[72]!==E||e[73]!==Ie||e[74]!==ue||e[75]!==m||e[76]!==se||e[77]!==je||e[78]!==gt||e[79]!==ht||e[80]!==b||e[81]!==w||e[82]!==xt||e[83]!==Se||e[84]!==r||e[85]!==qe||e[86]!==d||e[87]!==ze||e[88]!==ee||e[89]!==n.dateFormat||e[90]!==n.enabled||e[91]!==ne||e[92]!==l||e[93]!==x||e[94]!==P||e[95]!==D||e[96]!==_||e[97]!==we||e[98]!==M||e[99]!==de||e[100]!==mt||e[101]!==_e||e[102]!==Be||e[103]!==G?(xe=o.jsxRuntimeExports.jsx(It.GraphArea,{ref:yt,children:ee&&ze&&ue?o.jsxRuntimeExports.jsx(Yt,{data:c.filter(s=>n.enabled?`${s.date}`===wt.format(new Date(l[L]),n.dateFormat||"yyyy"):s),mapData:r?ue:{...ue,features:ue.features.filter(Qt)},xDomain:D||qt.getJenks(c.map(Kt),k[0].length),yDomain:M||qt.getJenks(c.map(Zt),k.length),width:ee,height:ze,scale:Se,centerPoint:ye,colors:k,xColorLegendTitle:P,yColorLegendTitle:we,mapBorderWidth:Me,mapNoDataColor:Ne,mapBorderColor:Oe,tooltip:ne,onSeriesMouseOver:je,isWorldMap:A,zoomScaleExtend:Be,zoomTranslateExtend:G,onSeriesMouseClick:se,mapProperty:Ie,highlightedIds:q,resetSelectionOnDoubleClick:w,styles:d,showColorScale:qe,classNames:p,mapProjection:E||(A?"naturalEarth":"mercator"),detailsOnClick:v,zoomInteraction:_e,overlayMapData:gt,overlayMapBorderColor:f?.mapBorderColor,overlayMapBorderWidth:f?.mapBorderWidth,animate:He===!0?{duration:.5,once:!0,amount:.5}:He||{duration:0,once:!0,amount:0},dimmedOpacity:pt,customLayers:ut,collapseColorScaleByDefault:K,zoomAndCenterByHighlightedIds:mt,projectionRotate:ht,rewindCoordinatesInMapData:xt,xNumberDisplayOptions:_,yNumberDisplayOptions:de}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(m,h||(b?m?(x||ee)*b>m?(x||ee)*b:m:(x||ee)*b:ze))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Ft.w,{"aria-label":"Loading graph"})})}),e[54]=He,e[55]=ye,e[56]=p,e[57]=K,e[58]=k,e[59]=ut,e[60]=c,e[61]=v,e[62]=pt,e[63]=h,e[64]=q,e[65]=L,e[66]=A,e[67]=Oe,e[68]=Me,e[69]=Ne,e[70]=f?.mapBorderColor,e[71]=f?.mapBorderWidth,e[72]=E,e[73]=Ie,e[74]=ue,e[75]=m,e[76]=se,e[77]=je,e[78]=gt,e[79]=ht,e[80]=b,e[81]=w,e[82]=xt,e[83]=Se,e[84]=r,e[85]=qe,e[86]=d,e[87]=ze,e[88]=ee,e[89]=n.dateFormat,e[90]=n.enabled,e[91]=ne,e[92]=l,e[93]=x,e[94]=P,e[95]=D,e[96]=_,e[97]=we,e[98]=M,e[99]=de,e[100]=mt,e[101]=_e,e[102]=Be,e[103]=G,e[104]=xe):xe=e[104];let fe;e[105]!==p?.footnote||e[106]!==p?.source||e[107]!==z||e[108]!==oe||e[109]!==d?.footnote||e[110]!==d?.source||e[111]!==x?(fe=oe||z?o.jsxRuntimeExports.jsx(Xt.GraphFooter,{styles:{footnote:d?.footnote,source:d?.source},classNames:{footnote:p?.footnote,source:p?.source},sources:oe,footNote:z,width:x}):null,e[105]=p?.footnote,e[106]=p?.source,e[107]=z,e[108]=oe,e[109]=d?.footnote,e[110]=d?.source,e[111]=x,e[112]=fe):fe=e[112];let lt;return e[113]!==J||e[114]!==W||e[115]!==O||e[116]!==h||e[117]!==u||e[118]!==m||e[119]!==ve||e[120]!==b||e[121]!==bt||e[122]!==Et||e[123]!==me||e[124]!==he||e[125]!==xe||e[126]!==fe||e[127]!==g||e[128]!==x?(lt=o.jsxRuntimeExports.jsxs(It.GraphContainer,{className:bt,style:Et,id:O,ref:kt,"aria-label":J,backgroundColor:W,theme:g,language:u,minHeight:m,width:x,height:h,relativeHeight:b,padding:ve,children:[me,he,xe,fe]}),e[113]=J,e[114]=W,e[115]=O,e[116]=h,e[117]=u,e[118]=m,e[119]=ve,e[120]=b,e[121]=bt,e[122]=Et,e[123]=me,e[124]=he,e[125]=xe,e[126]=fe,e[127]=g,e[128]=x,e[129]=lt):lt=e[129],lt}function Zt(i){return i.y}function Kt(i){return i.x}function Qt(i){return i.properties?.NAME!=="Antarctica"}function eo(i){return i!==void 0}function to(i){return i!==void 0}function oo(i){return i.data}function ro(i){return i!==void 0}function ao(i){return i.data}function no(i,e){return i-e}function io(i){return i.date}exports.BiVariateChoroplethMap=Jt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-D4pAp7u0.cjs"),n=require("react"),wt=require("./getSliderMarks-BzrpHrHS.cjs"),Ft=require("./Spinner-WHzzloYQ.cjs"),Rt=require("./parse-xYI9yrvL.cjs"),Lt=require("./index-DQA8q5sC.cjs"),R=require("./index-DLFt97gy.cjs"),$t=require("./index-C5K--w8d.cjs"),St=require("./Typography-BqmyF1gP.cjs"),Nt=require("./numberFormattingFunction-u2iNHL_c.cjs"),Tt=require("./Tooltip-C9F3uYG0.cjs"),Mt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),dt=require("./index-BhI7mBJx.cjs"),Gt=require("./DetailsModal-Du8Fr1QD.cjs"),Ht=require("./ImageDownloadButton.cjs"),Dt=require("./select-Bnfk0lJx.cjs"),Ot=require("./threshold-DNsSUf8Q.cjs"),ct=require("./proxy-CqH8m8IQ.cjs"),Vt=require("./use-in-view-dnRv_qqF.cjs"),Ut=require("./index-FXfr51ZM.cjs"),Xt=require("./GraphHeader.cjs"),Yt=require("./GraphFooter.cjs"),Ct=require("./Colors.cjs"),Bt=require("./fetchAndParseData-QTF6tjij.cjs"),It=require("./getJenks-BzJvhy_H.cjs"),qt=require("./GraphContainer-Cul9b74X.cjs");function Jt(l){const{data:e,xDomain:p,mapData:A,xColorLegendTitle:Ae,yDomain:oe,yColorLegendTitle:re,width:f,height:m,colors:h,scale:Fe,centerPoint:E,mapBorderWidth:S,mapNoDataColor:ae,mapBorderColor:ne,tooltip:ie,onSeriesMouseOver:je,zoomScaleExtend:be,zoomTranslateExtend:Ee,highlightedIds:y,onSeriesMouseClick:se,mapProperty:N,resetSelectionOnDoubleClick:Le,detailsOnClick:v,showColorScale:De,styles:$e,classNames:F,mapProjection:L,zoomInteraction:M,animate:O,dimmedOpacity:B,customLayers:le,collapseColorScaleByDefault:Ce,zoomAndCenterByHighlightedIds:ke,projectionRotate:$,rewindCoordinatesInMapData:X,overlayMapData:Y,overlayMapBorderColor:Te,overlayMapBorderWidth:Ge,xNumberDisplayOptions:J,yNumberDisplayOptions:ce,graphDownload:de}=l,a=n.useMemo(()=>X?R.index_default(A,{reverse:!0}):A,[A,X]),u=n.useMemo(()=>!X||!Y?Y:R.index_default(Y,{reverse:!0}),[Y,X]),[He,we]=n.useState(Ce===void 0?!(f<680):!Ce),[Z,Re]=n.useState(void 0),[T,G]=n.useState(void 0),[H,pe]=n.useState(void 0),[K,ue]=n.useState(void 0),[g,Q]=n.useState(void 0),I=n.useRef(null),D=Vt.useInView(I,{once:O.once,amount:O.amount}),k=n.useRef(null),V=n.useRef(null);n.useEffect(()=>{const t=Dt.select(k.current),r=Dt.select(I.current),i=x=>{if(M==="noZoom")return!1;if(M==="button")return!x.type.includes("wheel");const w=x.type==="wheel",j=x.type.startsWith("touch"),he=x.type==="mousedown"||x.type==="mousemove";return j?!0:w?M==="scroll"?!0:x.ctrlKey:he&&!x.button&&!x.ctrlKey},b=R.zoom().scaleExtent(be).translateExtent(Ee||[[-20,-20],[f+20,m+20]]).filter(i).on("zoom",({transform:x})=>{t.attr("transform",x)});r.call(b),V.current=b},[m,f,M]);const U=R.index_default$1({...a,features:ke?a.features.filter(t=>(y||[]).length===0||y?.indexOf(t.properties[N])!==-1):a.features}),q=$t.index_default({...a,features:ke?a.features.filter(t=>(y||[]).length===0||y?.indexOf(t.properties[N])!==-1):a.features}),Se=(U[2]-U[0])*1.15,Ne=(U[3]-U[1])*1.15,Me=f*190/960*360/Se,Oe=m*190/678*180/Ne,z=Fe*Math.min(Me,Oe),me=L==="mercator"?R.geoMercator().rotate($).center(E||q.geometry.coordinates).translate([f/2,m/2]).scale(z):L==="equalEarth"?R.geoEqualEarth().rotate($).center(E||q.geometry.coordinates).translate([f/2,m/2]).scale(z):L==="naturalEarth"?R.geoNaturalEarth1().rotate($).center(E||q.geometry.coordinates).translate([f/2,m/2]).scale(z):L==="orthographic"?R.geoOrthographic().rotate($).center(E||q.geometry.coordinates).translate([f/2,m/2]).scale(z):R.geoAlbersUsa().rotate($).center(E||q.geometry.coordinates).translate([f/2,m/2]).scale(z),_=R.geoPath().projection(me),Be=Array.from({length:p.length},(t,r)=>r),Ie=Array.from({length:oe.length},(t,r)=>r),qe=Ot.threshold().domain(p).range(Be),ze=Ot.threshold().domain(oe).range(Ie),ee=t=>{if(!I.current||!V.current)return;Dt.select(I.current).call(V.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(ct.motion.svg,{viewBox:`0 0 ${f} ${m}`,width:`${f}px`,height:`${m}px`,ref:I,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:k,children:[le.filter(t=>t.position==="before").map(t=>t.layer),a.features.map((t,r)=>{if(!t.properties?.[N])return null;const i=_(t);return i?o.jsxRuntimeExports.jsx(ct.motion.g,{opacity:Z?B:y?y.indexOf(t.properties[N])!==-1?1:B:1,children:o.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:ne,strokeWidth:S,fill:ae,vectorEffect:"non-scaling-stroke"}})},r):null}),o.jsxRuntimeExports.jsx(Ut.AnimatePresence,{children:e.map(t=>{const r=a.features.findIndex(j=>t.id===j.properties[N]);if(r===-1)return null;const i=_(a.features[r]);if(!i)return null;const b=Mt.checkIfNullOrUndefined(t.x)?void 0:qe(t.x),x=Mt.checkIfNullOrUndefined(t.y)?void 0:ze(t.y),w=b!==void 0&&x!==void 0?h[x][b]:ae;return o.jsxRuntimeExports.jsx(ct.motion.g,{className:"undp-map-shapes",variants:{initial:{opacity:0},whileInView:{opacity:Z?Z===w&&(!y||y.indexOf(t.id)!==-1)?1:B:y?y.indexOf(t.id)!==-1?1:B:1,transition:{duration:O.duration}}},initial:"initial",animate:D?"whileInView":"initial",exit:{opacity:0,transition:{duration:O.duration}},onMouseEnter:j=>{pe(t),Q(j.clientY),ue(j.clientX),je?.(t)},onClick:()=>{(se||v)&&(Lt.isEqual(T,t)&&Le?(G(void 0),se?.(void 0)):(G(t),se?.(t)))},onMouseMove:j=>{pe(t),Q(j.clientY),ue(j.clientX)},onMouseLeave:()=>{pe(void 0),ue(void 0),Q(void 0),je?.(void 0)},children:o.jsxRuntimeExports.jsx(ct.motion.path,{d:i,variants:{initial:{fill:w,opacity:0},whileInView:{fill:w,opacity:1,transition:{duration:O.duration}}},initial:"initial",animate:D?"whileInView":"initial",exit:{opacity:0,transition:{duration:O.duration}},className:`${w===ae?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{stroke:ne,strokeWidth:S,vectorEffect:"non-scaling-stroke"}},`${t.id}`)},t.id)})}),H?a.features.filter(t=>t.properties[N]===H.id).map((t,r)=>o.jsxRuntimeExports.jsx("path",{d:_(t)||"",className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5",vectorEffect:"non-scaling-stroke"}},r)):null,u?.features.map((t,r)=>{const i=_(t);return i?o.jsxRuntimeExports.jsx("g",{children:o.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:Te||ne,strokeWidth:Ge||S+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},r):null}),le.filter(t=>t.position==="after").map(t=>t.layer)]})}),De===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",F?.colorLegend),children:He?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{we(!1)},children:o.jsxRuntimeExports.jsx(dt.X,{})}),o.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:"175px"},children:[o.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[o.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:o.jsxRuntimeExports.jsxs("g",{children:[h.map((t,r)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-r*25})`,children:t.map((i,b)=>o.jsxRuntimeExports.jsx("rect",{y:1,x:b*25+1,fill:i,width:23,height:23,strokeWidth:Z===i?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{Re(i)},onMouseLeave:()=>{Re(void 0)}},b))},r)),o.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:p.map((t,r)=>o.jsxRuntimeExports.jsx("text",{y:10,x:(r+1)*25,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:Nt.numberFormattingFunction(t,void 0,J?.precision??2,void 0,void 0,J?.locale||"en",J?.padZeros||!1)},r))}),oe.map((t,r)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(p.length+1,5),4)*25+10},${100-r*25})`,children:o.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:Nt.numberFormattingFunction(t,void 0,ce?.precision??2,void 0,void 0,ce?.locale||"en",ce?.padZeros||!1)})},r))]})}),o.jsxRuntimeExports.jsx(St._,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:re})]}),o.jsxRuntimeExports.jsx(St._,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:Ae})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{we(!0)},children:o.jsxRuntimeExports.jsx(dt.ExpandIcon,{})})}),M==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col undp-viz-zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>ee("in"),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",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>ee("out"),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",children:"–"})]}),de&&o.jsxRuntimeExports.jsx("div",{className:"absolute right-4 top-4 flex flex-col image-download-button",children:o.jsxRuntimeExports.jsx(Ht.ImageDownloadButton,{nodeID:de,buttonSmall:!0})})]}),H&&ie&&K&&g?o.jsxRuntimeExports.jsx(Tt.Tooltip,{data:H,body:ie,xPos:K,yPos:g,backgroundStyle:$e?.tooltip,className:F?.tooltip}):null,v&&T!==void 0?o.jsxRuntimeExports.jsx(Gt.DetailsModal,{body:v,data:T,setData:G,className:F?.modal}):null]})}function Zt(l){const e=o.compilerRuntimeExports.c(130),{data:p,graphTitle:A,mapData:Ae,colors:oe,sources:re,graphDescription:f,height:m,width:h,footNote:Fe,xDomain:E,yDomain:S,xColorLegendTitle:ae,yColorLegendTitle:ne,tooltip:ie,scale:je,centerPoint:be,padding:Ee,mapBorderWidth:y,mapNoDataColor:se,backgroundColor:N,mapBorderColor:Le,relativeHeight:v,onSeriesMouseOver:De,isWorldMap:$e,zoomScaleExtend:F,zoomTranslateExtend:L,graphID:M,showColorScale:O,highlightedIds:B,onSeriesMouseClick:le,mapProperty:Ce,graphDownload:ke,dataDownload:$,showAntarctica:X,language:Y,minHeight:Te,theme:Ge,ariaLabel:J,resetSelectionOnDoubleClick:ce,detailsOnClick:de,styles:a,classNames:u,mapProjection:He,zoomInteraction:we,animate:Z,dimmedOpacity:Re,customLayers:T,timeline:G,collapseColorScaleByDefault:H,zoomAndCenterByHighlightedIds:pe,projectionRotate:K,rewindCoordinatesInMapData:ue,mapOverlay:g,xNumberDisplayOptions:Q,yNumberDisplayOptions:I}=l,D=Ae===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":Ae,k=oe===void 0?Ct.Colors.light.bivariateColors.colors05x05:oe,V=Fe===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.":Fe,U=ae===void 0?"X Color key":ae,q=ne===void 0?"Y Color key":ne,Se=je===void 0?.95:je,Ne=y===void 0?.5:y,Me=se===void 0?Ct.Colors.light.graphNoData:se,Oe=N===void 0?!1:N,z=Le===void 0?Ct.Colors.light.grays["gray-500"]:Le,me=$e===void 0?!0:$e;let _;e[0]!==F?(_=F===void 0?[.8,6]:F,e[0]=F,e[1]=_):_=e[1];const Be=_,Ie=O===void 0?!0:O,qe=Ce===void 0?"ISO3":Ce,ze=ke===void 0?!1:ke,ee=$===void 0?!1:$,t=X===void 0?!1:X,r=Y===void 0?"en":Y,i=Te===void 0?0:Te,b=Ge===void 0?"light":Ge,x=ce===void 0?!0:ce,w=He===void 0?"naturalEarth":He,j=we===void 0?"button":we,he=Z===void 0?!1:Z,pt=Re===void 0?.3:Re;let Ve;e[2]!==T?(Ve=T===void 0?[]:T,e[2]=T,e[3]=Ve):Ve=e[3];const ut=Ve;let Ue;e[4]!==G?(Ue=G===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:G,e[4]=G,e[5]=Ue):Ue=e[5];const s=Ue,mt=pe===void 0?!1:pe;let Xe;e[6]!==K?(Xe=K===void 0?[0,0]:K,e[6]=K,e[7]=Xe):Xe=e[7];const ht=Xe,xt=ue===void 0?!0:ue,[te,zt]=n.useState(0),[_e,_t]=n.useState(0),[P,Pt]=n.useState(s.autoplay);let Pe;if(e[8]!==p||e[9]!==s.dateFormat){let c;e[11]!==s.dateFormat?(c=C=>Rt.parse(`${C.date}`,s.dateFormat||"yyyy",new Date).getTime(),e[11]=s.dateFormat,e[12]=c):c=e[12],Pe=[...new Set(p.filter(so).map(c))],Pe.sort(io),e[8]=p,e[9]=s.dateFormat,e[10]=Pe}else Pe=e[10];const d=Pe,[W,ft]=n.useState(s.autoplay?0:d.length-1),[xe,Wt]=n.useState(void 0),[gt,At]=n.useState(void 0),yt=n.useRef(null),kt=n.useRef(null);let Ye,Je;e[13]===Symbol.for("react.memo_cache_sentinel")?(Ye=()=>{const c=new ResizeObserver(C=>{zt(C[0].target.clientWidth||620),_t(C[0].target.clientHeight||480)});return yt.current&&c.observe(yt.current),()=>c.disconnect()},Je=[],e[13]=Ye,e[14]=Je):(Ye=e[13],Je=e[14]),n.useEffect(Ye,Je);let Ze;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ze=c=>{Wt(c)},e[15]=Ze):Ze=e[15];const Ke=n.useEffectEvent(Ze);let Qe;e[16]===Symbol.for("react.memo_cache_sentinel")?(Qe=c=>{At(c)},e[16]=Qe):Qe=e[16];const We=n.useEffectEvent(Qe);let et;e[17]!==D||e[18]!==Ke?(et=()=>{typeof D=="string"?Bt.fetchAndParseJSON(D).then(C=>{Ke(C)}):Ke(D)},e[17]=D,e[18]=Ke,e[19]=et):et=e[19];let tt;e[20]!==D?(tt=[D],e[20]=D,e[21]=tt):tt=e[21],n.useEffect(et,tt);let ot;e[22]!==g?.mapData||e[23]!==We?(ot=()=>{g?.mapData||We(void 0),typeof g?.mapData=="string"?Bt.fetchAndParseJSON(g?.mapData).then(C=>{We(C)}):We(g?.mapData)},e[22]=g?.mapData,e[23]=We,e[24]=ot):ot=e[24];const vt=g?.mapData;let rt;e[25]!==vt?(rt=[vt],e[25]=vt,e[26]=rt):rt=e[26],n.useEffect(ot,rt);let at,nt;e[27]!==P||e[28]!==s.speed||e[29]!==d?(at=()=>{const c=setInterval(()=>{ft(C=>C<d.length-1?C+1:0)},(s.speed||2)*1e3);return P||clearInterval(c),()=>clearInterval(c)},nt=[d,P,s.speed],e[27]=P,e[28]=s.speed,e[29]=d,e[30]=at,e[31]=nt):(at=e[30],nt=e[31]),n.useEffect(at,nt);const jt=s.dateFormat||"yyyy";let it;e[32]!==W||e[33]!==jt||e[34]!==s.showOnlyActiveDate||e[35]!==d?(it=wt.getSliderMarks(d,W,s.showOnlyActiveDate,jt),e[32]=W,e[33]=jt,e[34]=s.showOnlyActiveDate,e[35]=d,e[36]=it):it=e[36];const st=it;if(E&&S&&(E.length!==k[0].length-1||S.length!==k.length-1))return console.error("the xDomain and yDomain array length don't match to the color array length"),null;const bt=u?.graphContainer,Et=a?.graphContainer;let fe;e[37]!==u?.description||e[38]!==u?.title||e[39]!==p||e[40]!==ee||e[41]!==f||e[42]!==A||e[43]!==a?.description||e[44]!==a?.title||e[45]!==h?(fe=A||f||ee?o.jsxRuntimeExports.jsx(Xt.GraphHeader,{styles:{title:a?.title,description:a?.description},classNames:{title:u?.title,description:u?.description},graphTitle:A,graphDescription:f,width:h,dataDownload:ee?p.map(no).filter(ao).length>0?p.map(ro).filter(oo):p.filter(to):null}):null,e[37]=u?.description,e[38]=u?.title,e[39]=p,e[40]=ee,e[41]=f,e[42]=A,e[43]=a?.description,e[44]=a?.title,e[45]=h,e[46]=fe):fe=e[46];let ge;e[47]!==W||e[48]!==st||e[49]!==P||e[50]!==s.enabled||e[51]!==d?(ge=s.enabled&&d.length>0&&st?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Pt(!P)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":P?"Click to pause animation":"Click to play animation",children:P?o.jsxRuntimeExports.jsx(dt.Pause,{}):o.jsxRuntimeExports.jsx(dt.Play,{})}),o.jsxRuntimeExports.jsx(wt.Nr,{min:d[0],max:d[d.length-1],marks:st,step:null,defaultValue:d[d.length-1],value:d[W],onChangeComplete:c=>{ft(d.indexOf(c))},onChange:c=>{ft(d.indexOf(c))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[47]=W,e[48]=st,e[49]=P,e[50]=s.enabled,e[51]=d,e[52]=ge):ge=e[52];let ye;e[53]!==he||e[54]!==be||e[55]!==u||e[56]!==H||e[57]!==k||e[58]!==ut||e[59]!==p||e[60]!==de||e[61]!==pt||e[62]!==ze||e[63]!==m||e[64]!==B||e[65]!==W||e[66]!==me||e[67]!==z||e[68]!==Ne||e[69]!==Me||e[70]!==g?.mapBorderColor||e[71]!==g?.mapBorderWidth||e[72]!==w||e[73]!==qe||e[74]!==xe||e[75]!==i||e[76]!==le||e[77]!==De||e[78]!==gt||e[79]!==ht||e[80]!==v||e[81]!==x||e[82]!==xt||e[83]!==Se||e[84]!==t||e[85]!==Ie||e[86]!==a||e[87]!==_e||e[88]!==te||e[89]!==s.dateFormat||e[90]!==s.enabled||e[91]!==ie||e[92]!==d||e[93]!==h||e[94]!==U||e[95]!==E||e[96]!==Q||e[97]!==q||e[98]!==S||e[99]!==I||e[100]!==mt||e[101]!==j||e[102]!==Be||e[103]!==L?(ye=o.jsxRuntimeExports.jsx(qt.GraphArea,{ref:yt,children:te&&_e&&xe?o.jsxRuntimeExports.jsx(Jt,{data:p.filter(c=>s.enabled?`${c.date}`===Rt.format(new Date(d[W]),s.dateFormat||"yyyy"):c),mapData:t?xe:{...xe,features:xe.features.filter(eo)},xDomain:E||It.getJenks(p.map(Qt),k[0].length),yDomain:S||It.getJenks(p.map(Kt),k.length),width:te,height:_e,scale:Se,centerPoint:be,colors:k,xColorLegendTitle:U,yColorLegendTitle:q,mapBorderWidth:Ne,mapNoDataColor:Me,mapBorderColor:z,tooltip:ie,onSeriesMouseOver:De,isWorldMap:me,zoomScaleExtend:Be,zoomTranslateExtend:L,onSeriesMouseClick:le,mapProperty:qe,highlightedIds:B,resetSelectionOnDoubleClick:x,styles:a,showColorScale:Ie,classNames:u,mapProjection:w||(me?"naturalEarth":"mercator"),detailsOnClick:de,zoomInteraction:j,overlayMapData:gt,overlayMapBorderColor:g?.mapBorderColor,overlayMapBorderWidth:g?.mapBorderWidth,animate:he===!0?{duration:.5,once:!0,amount:.5}:he||{duration:0,once:!0,amount:0},dimmedOpacity:pt,customLayers:ut,collapseColorScaleByDefault:H,zoomAndCenterByHighlightedIds:mt,projectionRotate:ht,rewindCoordinatesInMapData:xt,xNumberDisplayOptions:Q,yNumberDisplayOptions:I,graphDownload:ze?kt:void 0}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(i,m||(v?i?(h||te)*v>i?(h||te)*v:i:(h||te)*v:_e))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Ft.w,{"aria-label":"Loading graph"})})}),e[53]=he,e[54]=be,e[55]=u,e[56]=H,e[57]=k,e[58]=ut,e[59]=p,e[60]=de,e[61]=pt,e[62]=ze,e[63]=m,e[64]=B,e[65]=W,e[66]=me,e[67]=z,e[68]=Ne,e[69]=Me,e[70]=g?.mapBorderColor,e[71]=g?.mapBorderWidth,e[72]=w,e[73]=qe,e[74]=xe,e[75]=i,e[76]=le,e[77]=De,e[78]=gt,e[79]=ht,e[80]=v,e[81]=x,e[82]=xt,e[83]=Se,e[84]=t,e[85]=Ie,e[86]=a,e[87]=_e,e[88]=te,e[89]=s.dateFormat,e[90]=s.enabled,e[91]=ie,e[92]=d,e[93]=h,e[94]=U,e[95]=E,e[96]=Q,e[97]=q,e[98]=S,e[99]=I,e[100]=mt,e[101]=j,e[102]=Be,e[103]=L,e[104]=ye):ye=e[104];let ve;e[105]!==u?.footnote||e[106]!==u?.source||e[107]!==V||e[108]!==re||e[109]!==a?.footnote||e[110]!==a?.source||e[111]!==h?(ve=re||V?o.jsxRuntimeExports.jsx(Yt.GraphFooter,{styles:{footnote:a?.footnote,source:a?.source},classNames:{footnote:u?.footnote,source:u?.source},sources:re,footNote:V,width:h}):null,e[105]=u?.footnote,e[106]=u?.source,e[107]=V,e[108]=re,e[109]=a?.footnote,e[110]=a?.source,e[111]=h,e[112]=ve):ve=e[112];let lt;return e[113]!==J||e[114]!==Oe||e[115]!==M||e[116]!==m||e[117]!==r||e[118]!==i||e[119]!==Ee||e[120]!==v||e[121]!==bt||e[122]!==Et||e[123]!==fe||e[124]!==ge||e[125]!==ye||e[126]!==ve||e[127]!==b||e[128]!==h?(lt=o.jsxRuntimeExports.jsxs(qt.GraphContainer,{className:bt,style:Et,id:M,ref:kt,"aria-label":J,backgroundColor:Oe,theme:b,language:r,minHeight:i,width:h,height:m,relativeHeight:v,padding:Ee,children:[fe,ge,ye,ve]}),e[113]=J,e[114]=Oe,e[115]=M,e[116]=m,e[117]=r,e[118]=i,e[119]=Ee,e[120]=v,e[121]=bt,e[122]=Et,e[123]=fe,e[124]=ge,e[125]=ye,e[126]=ve,e[127]=b,e[128]=h,e[129]=lt):lt=e[129],lt}function Kt(l){return l.y}function Qt(l){return l.x}function eo(l){return l.properties?.NAME!=="Antarctica"}function to(l){return l!==void 0}function oo(l){return l!==void 0}function ro(l){return l.data}function ao(l){return l!==void 0}function no(l){return l.data}function io(l,e){return l-e}function so(l){return l.date}exports.BiVariateChoroplethMap=Zt;
|
|
2
2
|
//# sourceMappingURL=BiVariateChoroplethMap.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BiVariateChoroplethMap.cjs","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 NumberFormatOptions,\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 xNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n yNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\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 xNumberDisplayOptions,\r\n yNumberDisplayOptions,\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 ? !highlightedIds || highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\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 xNumberDisplayOptions?.precision ?? 2,\r\n undefined,\r\n undefined,\r\n xNumberDisplayOptions?.locale || 'en',\r\n xNumberDisplayOptions?.padZeros || false,\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 yNumberDisplayOptions?.precision ?? 2,\r\n undefined,\r\n undefined,\r\n yNumberDisplayOptions?.locale || 'en',\r\n yNumberDisplayOptions?.padZeros || false,\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 NumberFormatOptions,\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 /** Configuration options for controlling number formatting, localization, precision, and zero padding. */\r\n xNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n /** Configuration options for controlling number formatting, localization, precision, and zero padding. */\r\n yNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\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 xNumberDisplayOptions,\r\n yNumberDisplayOptions,\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 xNumberDisplayOptions={xNumberDisplayOptions}\r\n yNumberDisplayOptions={yNumberDisplayOptions}\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","xNumberDisplayOptions","yNumberDisplayOptions","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","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","precision","locale","padZeros","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","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t30","t31","t32","enabled","autoplay","showOnlyActiveDate","t33","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t34","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","overlayMapShape","setOverlayMapShape","graphDiv","graphParentDiv","t35","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t36","shape","onUpdateShape","useEffectEvent","t37","shape_0","onUpdateOverlayMapShape","t38","fetchAndParseJSON","then","d_1","t39","t40","d_2","t41","t42","t43","t44","speed","interval","setInterval","clearInterval","t45","t46","getSliderMarks","markObj","console","error","t47","graphContainer","t48","t49","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t50","Pause","Play","SliderUI","nextValue","nextValue_0","t51","GraphArea","d_8","format","_temp8","getJenks","_temp9","_temp0","Spinner","t52","footnote","source","GraphFooter","t53","GraphContainer","d_10","d_9","NAME","d_5","d_4","d_3","d_7","d_6","a","b"],"mappings":"0gCAuFO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJC,KAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,kBAAAA,GACAC,QAAAA,GACAC,kBAAAA,GACAC,MAAAA,EACAC,OAAAA,EACAC,OAAAA,EACAC,MAAAA,GACAC,YAAAA,EACAC,eAAAA,EACAC,eAAAA,GACAC,eAAAA,GACAC,QAAAA,GACAC,kBAAAA,GACAC,gBAAAA,GACAC,oBAAAA,GACAC,eAAAA,EACAC,mBAAAA,GACAC,YAAAA,EACAC,4BAAAA,GACAC,eAAAA,EACAC,eAAAA,GACAC,OAAAA,GACAC,WAAAA,EACAC,cAAAA,EACAC,gBAAAA,EACAC,QAAAA,EACAC,cAAAA,EACAC,aAAAA,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AAqR,GAAA6B,EAAA,CAAA,OAgLyBpQ,EAAC9F,IAAK,CAhL/B,SAAAoU,GAAA+B,EAAA,CAAA,OA+K2CrQ,IAAM9C,MAAS,CA/K1D,SAAAmR,GAAAiC,EAAA,CAAA,OA+KuBtQ,EAAC9F,IAAK,CA/K7B,SAAA4Q,GAAAyF,EAAAC,EAAA,CAAA,OAsEkBD,EAAIC,CAAC,CAtEvB,SAAA5F,GAAA5K,EAAA,CAAA,OAkEgBA,EAACwK,IAAK"}
|
|
1
|
+
{"version":3,"file":"BiVariateChoroplethMap.cjs","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 { RefObject, 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 NumberFormatOptions,\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\nimport { ImageDownloadButton } from '@/Components/Actions/ImageDownloadButton';\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 xNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n yNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n graphDownload?: RefObject<HTMLDivElement | null>;\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 xNumberDisplayOptions,\r\n yNumberDisplayOptions,\r\n graphDownload,\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 ? !highlightedIds || highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\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 xNumberDisplayOptions?.precision ?? 2,\r\n undefined,\r\n undefined,\r\n xNumberDisplayOptions?.locale || 'en',\r\n xNumberDisplayOptions?.padZeros || false,\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 yNumberDisplayOptions?.precision ?? 2,\r\n undefined,\r\n undefined,\r\n yNumberDisplayOptions?.locale || 'en',\r\n yNumberDisplayOptions?.padZeros || false,\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 undp-viz-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 {graphDownload && (\r\n <div className='absolute right-4 top-4 flex flex-col image-download-button'>\r\n <ImageDownloadButton nodeID={graphDownload} buttonSmall />\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 NumberFormatOptions,\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 /** Configuration options for controlling number formatting, localization, precision, and zero padding. */\r\n xNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n /** Configuration options for controlling number formatting, localization, precision, and zero padding. */\r\n yNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\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 xNumberDisplayOptions,\r\n yNumberDisplayOptions,\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 || 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 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 xNumberDisplayOptions={xNumberDisplayOptions}\r\n yNumberDisplayOptions={yNumberDisplayOptions}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\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","xNumberDisplayOptions","yNumberDisplayOptions","graphDownload","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","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","precision","locale","padZeros","max","P","display","WebkitLineClamp","WebkitBoxOrient","overflow","writingMode","ExpandIcon","ImageDownloadButton","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","dataDownload","t15","showAntarctica","t16","language","t17","minHeight","t18","theme","t19","ariaLabel","t20","t21","t22","t23","t24","t25","timeline","t26","t27","t28","t29","mapOverlay","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t30","t31","t32","enabled","autoplay","showOnlyActiveDate","t33","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t34","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","overlayMapShape","setOverlayMapShape","graphDiv","graphParentDiv","t35","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t36","shape","onUpdateShape","useEffectEvent","t37","shape_0","onUpdateOverlayMapShape","t38","fetchAndParseJSON","then","d_1","t39","t40","d_2","t41","t42","t43","t44","speed","interval","setInterval","clearInterval","t45","t46","getSliderMarks","markObj","console","error","t47","graphContainer","t48","t49","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t50","Pause","Play","SliderUI","nextValue","nextValue_0","t51","GraphArea","d_8","format","_temp8","getJenks","_temp9","_temp0","Spinner","t52","footnote","source","GraphFooter","t53","GraphContainer","d_10","d_9","NAME","d_5","d_4","d_3","d_7","d_6","a","b"],"mappings":"kjCAyFO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJC,KAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,kBAAAA,GACAC,QAAAA,GACAC,kBAAAA,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