@undp/data-viz 2.2.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.d.ts +4 -0
- package/dist/BiVariateChoroplethMap.js +328 -401
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.d.ts +4 -0
- package/dist/ChoroplethMap.js +341 -416
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/Data/01.json +4042 -0
- package/dist/Data/mapData.json +4543 -0
- package/dist/Data/testMap.json +361 -0
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.d.ts +4 -0
- package/dist/DotDensityMap.js +297 -311
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/{GraphEl-C1Rz1V__.js → GraphEl-L5hNe7wJ.js} +25 -17
- package/dist/GraphEl-L5hNe7wJ.js.map +1 -0
- package/dist/GraphEl-ic8C5Ksc.cjs +2 -0
- package/dist/GraphEl-ic8C5Ksc.cjs.map +1 -0
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.d.ts +2 -0
- package/dist/GriddedGraphs.js +1 -1
- package/dist/GriddedGraphsFromConfig.d.ts +2 -0
- package/dist/HybridMap.cjs +1 -1
- package/dist/HybridMap.cjs.map +1 -1
- package/dist/HybridMap.d.ts +4 -0
- package/dist/HybridMap.js +368 -418
- package/dist/HybridMap.js.map +1 -1
- package/dist/MultiGraphDashboard.d.ts +2 -0
- package/dist/MultiGraphDashboardFromConfig.d.ts +2 -0
- package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +2 -0
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +2 -0
- package/dist/PerformanceIntensiveScrollStory.d.ts +2 -0
- package/dist/ScrollStory.d.ts +2 -0
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.d.ts +2 -0
- package/dist/SingleGraphDashboard.js +1 -1
- package/dist/SingleGraphDashboardFromConfig.d.ts +2 -0
- package/dist/SingleGraphDashboardGeoHubMaps.d.ts +2 -0
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +2 -0
- package/dist/SingleGraphDashboardThreeDGraphs.d.ts +2 -0
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +2 -0
- package/dist/Types.d.ts +2 -0
- package/dist/index-DLFt97gy.cjs +2 -0
- package/dist/index-DLFt97gy.cjs.map +1 -0
- package/dist/index-Dp_SfsUA.js +2344 -0
- package/dist/index-Dp_SfsUA.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/package.json +2 -1
- package/readme.md +0 -7
- package/dist/GraphEl-BZbunD1_.cjs +0 -2
- package/dist/GraphEl-BZbunD1_.cjs.map +0 -1
- package/dist/GraphEl-C1Rz1V__.js.map +0 -1
- package/dist/zoom-5AkJSuWO.js +0 -1864
- package/dist/zoom-5AkJSuWO.js.map +0 -1
- package/dist/zoom-ChcvXFIz.cjs +0 -2
- package/dist/zoom-ChcvXFIz.cjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-6v2a2njQ.cjs"),p=require("react"),pt=require("./getSliderMarks-CIuSoedo.cjs"),Ct=require("./Spinner-jTMOLuw_.cjs"),ht=require("./parse-xYI9yrvL.cjs"),Rt=require("./index-DQA8q5sC.cjs"),te=require("./zoom-ChcvXFIz.cjs"),St=require("./index-C5K--w8d.cjs"),xt=require("./Typography-sa1UE0oF.cjs"),gt=require("./numberFormattingFunction-02t-wJta.cjs"),$t=require("./Tooltip-BLa2EfMs.cjs"),yt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),mt=require("./index-C6er0ety.cjs"),Dt=require("./DetailsModal-DHttOA80.cjs"),ct=require("./select-Bnfk0lJx.cjs"),ft=require("./threshold-DNsSUf8Q.cjs"),Ie=require("./proxy-C4-uo6nS.cjs"),Nt=require("./use-in-view-C3o_ntMv.cjs"),Mt=require("./index-CoobIWNj.cjs"),Ot=require("./GraphHeader.cjs"),qt=require("./GraphFooter.cjs"),dt=require("./Colors.cjs"),It=require("./fetchAndParseData-QTF6tjij.cjs"),vt=require("./getJenks-BzJvhy_H.cjs"),jt=require("./GraphContainer-B1EDxJ0S.cjs");function Pt(d){const{data:e,xDomain:f,mapData:b,xColorLegendTitle:Pe,yDomain:oe,yColorLegendTitle:re,width:w,height:E,colors:k,scale:ze,centerPoint:R,mapBorderWidth:D,mapNoDataColor:W,mapBorderColor:ye,tooltip:ne,onSeriesMouseOver:fe,zoomScaleExtend:ve,zoomTranslateExtend:je,highlightedIds:S,onSeriesMouseClick:ie,mapProperty:O,resetSelectionOnDoubleClick:Le,detailsOnClick:C,showColorScale:be,styles:Ae,classNames:F,mapProjection:T,zoomInteraction:q,animate:$,dimmedOpacity:I,customLayers:ae,collapseColorScaleByDefault:Ee,zoomAndCenterByHighlightedIds:ke}=d,[Be,we]=p.useState(Ee===void 0?!(w<680):!Ee),[X,Ce]=p.useState(void 0),[se,Y]=p.useState(void 0),[J,K]=p.useState(void 0),[g,h]=p.useState(void 0),[le,ce]=p.useState(void 0),_=p.useRef(null),de=Nt.useInView(_,{once:$.once,amount:$.amount}),Z=p.useRef(null),V=p.useRef(null);p.useEffect(()=>{const t=ct.select(Z.current),a=ct.select(_.current),v=r=>{if(q==="noZoom")return!1;if(q==="button")return!r.type.includes("wheel");const n=r.type==="wheel",l=r.type.startsWith("touch"),i=r.type==="mousedown"||r.type==="mousemove";return l?!0:n?q==="scroll"?!0:r.ctrlKey:i&&!r.button&&!r.ctrlKey},s=te.zoom().scaleExtent(ve).translateExtent(je||[[-20,-20],[w+20,E+20]]).filter(v).on("zoom",({transform:r})=>{t.attr("transform",r)});a.call(s),V.current=s},[E,w,q]);const H=te.index_default({...b,features:ke?b.features.filter(t=>(S||[]).length===0||S.indexOf(t.properties[O])!==-1):b.features}),G=St.index_default({...b,features:ke?b.features.filter(t=>(S||[]).length===0||S.indexOf(t.properties[O])!==-1):b.features}),N=H[2]-H[0],P=H[3]-H[1],me=w*190/960*360/N,Re=E*190/678*180/P,z=ze*Math.min(me,Re),M=T==="mercator"?te.geoMercator().rotate([0,0]).center(R||G.geometry.coordinates).translate([w/2,E/2]).scale(z):T==="equalEarth"?te.geoEqualEarth().rotate([0,0]).center(R||G.geometry.coordinates).translate([w/2,E/2]).scale(z):T==="naturalEarth"?te.geoNaturalEarth1().rotate([0,0]).center(R||G.geometry.coordinates).translate([w/2,E/2]).scale(z):T==="orthographic"?te.geoOrthographic().rotate([0,0]).center(R||G.geometry.coordinates).translate([w/2,E/2]).scale(z):te.geoAlbersUsa().rotate([0,0]).center(R||G.geometry.coordinates).translate([w/2,E/2]).scale(z),Se=Array.from({length:f.length},(t,a)=>a),$e=Array.from({length:oe.length},(t,a)=>a),De=ft.threshold().domain(f).range(Se),Ne=ft.threshold().domain(oe).range($e),Q=t=>{if(!_.current||!V.current)return;ct.select(_.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(Ie.motion.svg,{viewBox:`0 0 ${w} ${E}`,width:`${w}px`,height:`${E}px`,ref:_,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:Z,children:[ae.filter(t=>t.position==="before").map(t=>t.layer),b.features.map((t,a)=>e.findIndex(s=>s.id===t.properties[O])!==-1?null:o.jsxRuntimeExports.jsx(Ie.motion.g,{opacity:X?I:S.length!==0?S.indexOf(t.properties[O])!==-1?1:I:1,children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((s,r)=>{let n="";return s.forEach(l=>{let i=" M";l.forEach((y,j)=>{const m=M([y[0],y[1]]);j!==l.length-1?i=`${i}${m[0]} ${m[1]}L`:i=`${i}${m[0]} ${m[1]}`}),n+=i}),o.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:ye,strokeWidth:D,fill:W}},r)}):t.geometry.coordinates.map((s,r)=>{let n="M";return s.forEach((l,i)=>{const y=M([l[0],l[1]]);i!==s.length-1?n=`${n}${y[0]} ${y[1]}L`:n=`${n}${y[0]} ${y[1]}`}),o.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:ye,strokeWidth:D,fill:W}},r)})},a)),o.jsxRuntimeExports.jsx(Mt.AnimatePresence,{children:e.map(t=>{const a=b.features.findIndex(n=>t.id===n.properties[O]),v=yt.checkIfNullOrUndefined(t.x)?void 0:De(t.x),s=yt.checkIfNullOrUndefined(t.y)?void 0:Ne(t.y),r=v!==void 0&&s!==void 0?k[s][v]:W;return o.jsxRuntimeExports.jsx(Ie.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:X?X===r?1:I:S.length!==0?S.indexOf(t.id)!==-1?1:I:1,transition:{duration:$.duration}}},initial:"initial",animate:de?"whileInView":"initial",exit:{opacity:0,transition:{duration:$.duration}},onMouseEnter:n=>{K(t),ce(n.clientY),h(n.clientX),fe?.(t)},onClick:()=>{(ie||C)&&(Rt.isEqual(se,t)&&Le?(Y(void 0),ie?.(void 0)):(Y(t),ie?.(t)))},onMouseMove:n=>{K(t),ce(n.clientY),h(n.clientX)},onMouseLeave:()=>{K(void 0),h(void 0),ce(void 0),fe?.(void 0)},children:a===-1?null:b.features[a].geometry.type==="MultiPolygon"?b.features[a].geometry.coordinates.map((n,l)=>{let i="";return n.forEach(y=>{let j=" M";y.forEach((m,Me)=>{const U=M([m[0],m[1]]);Me!==y.length-1?j=`${j}${U[0]} ${U[1]}L`:j=`${j}${U[0]} ${U[1]}`}),i+=j}),o.jsxRuntimeExports.jsx(Ie.motion.path,{variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:$.duration}}},initial:"initial",animate:de?"whileInView":"initial",exit:{opacity:0,transition:{duration:$.duration}},d:i,className:`${r===W?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:D}},`${t.id}-${l}`)}):b.features[a].geometry.coordinates.map((n,l)=>{let i="M";return n.forEach((y,j)=>{const m=M([y[0],y[1]]);j!==n.length-1?i=`${i}${m[0]} ${m[1]}L`:i=`${i}${m[0]} ${m[1]}`}),o.jsxRuntimeExports.jsx(Ie.motion.path,{d:i,variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:$.duration}}},initial:"initial",animate:de?"whileInView":"initial",exit:{opacity:0,transition:{duration:$.duration}},className:`${r===W?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:D}},`${t.id}-${l}`)})},t.id)})}),J?b.features.filter(t=>t.properties[O]===J.id).map((t,a)=>o.jsxRuntimeExports.jsx("g",{children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((v,s)=>{let r="";return v.forEach(n=>{let l=" M";n.forEach((i,y)=>{const j=M([i[0],i[1]]);y!==n.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),r+=l}),o.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},s)}):t.geometry.coordinates.map((v,s)=>{let r="M";return v.forEach((n,l)=>{const i=M([n[0],n[1]]);l!==v.length-1?r=`${r}${i[0]} ${i[1]}L`:r=`${r}${i[0]} ${i[1]}`}),o.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},s)})},a)):null,ae.filter(t=>t.position==="after").map(t=>t.layer)]})}),be===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",F?.colorLegend),children:Be?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(mt.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:[k.map((t,a)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-a*25})`,children:t.map((v,s)=>o.jsxRuntimeExports.jsx("rect",{y:1,x:s*25+1,fill:v,width:23,height:23,strokeWidth:X===v?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{Ce(v)},onMouseLeave:()=>{Ce(void 0)}},s))},a)),o.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:f.map((t,a)=>o.jsxRuntimeExports.jsx("text",{y:10,x:(a+1)*25,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:gt.numberFormattingFunction(t,"NA")},a))}),oe.map((t,a)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(f.length+1,5),4)*25+10},${100-a*25})`,children:o.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:gt.numberFormattingFunction(t,"NA")})},a))]})}),o.jsxRuntimeExports.jsx(xt.j,{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(xt.j,{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:Pe})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{we(!0)},children:o.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),q==="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:"–"})]})]}),J&&ne&&g&&le?o.jsxRuntimeExports.jsx($t.Tooltip,{data:J,body:ne,xPos:g,yPos:le,backgroundStyle:Ae?.tooltip,className:F?.tooltip}):null,C&&se!==void 0?o.jsxRuntimeExports.jsx(Dt.DetailsModal,{body:C,data:se,setData:Y,className:F?.modal}):null]})}function zt(d){const e=o.compilerRuntimeExports.c(117),{data:f,graphTitle:b,mapData:Pe,colors:oe,sources:re,graphDescription:w,height:E,width:k,footNote:ze,xDomain:R,yDomain:D,xColorLegendTitle:W,yColorLegendTitle:ye,tooltip:ne,scale:fe,centerPoint:ve,padding:je,mapBorderWidth:S,mapNoDataColor:ie,backgroundColor:O,mapBorderColor:Le,relativeHeight:C,onSeriesMouseOver:be,isWorldMap:Ae,zoomScaleExtend:F,zoomTranslateExtend:T,graphID:q,showColorScale:$,highlightedIds:I,onSeriesMouseClick:ae,mapProperty:Ee,graphDownload:ke,dataDownload:Be,showAntarctica:we,language:X,minHeight:Ce,theme:se,ariaLabel:Y,resetSelectionOnDoubleClick:J,detailsOnClick:K,styles:g,classNames:h,mapProjection:le,zoomInteraction:ce,animate:_,dimmedOpacity:de,customLayers:Z,timeline:V,collapseColorScaleByDefault:H,zoomAndCenterByHighlightedIds:G}=d,N=Pe===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":Pe,P=oe===void 0?dt.Colors.light.bivariateColors.colors05x05:oe,me=ze===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.":ze,Re=W===void 0?"X Color key":W,z=ye===void 0?"Y Color key":ye,M=fe===void 0?.95:fe,Se=S===void 0?.5:S,$e=ie===void 0?dt.Colors.light.graphNoData:ie,De=O===void 0?!1:O,Ne=Le===void 0?dt.Colors.light.grays["gray-500"]:Le,Q=Ae===void 0?!0:Ae;let t;e[0]!==F?(t=F===void 0?[.8,6]:F,e[0]=F,e[1]=t):t=e[1];const a=t,v=$===void 0?!0:$;let s;e[2]!==I?(s=I===void 0?[]:I,e[2]=I,e[3]=s):s=e[3];const r=s,n=Ee===void 0?"ISO3":Ee,l=ke===void 0?!1:ke,i=Be===void 0?!1:Be,y=we===void 0?!1:we,j=X===void 0?"en":X,m=Ce===void 0?0:Ce,Me=se===void 0?"light":se,U=J===void 0?!0:J,et=ce===void 0?"button":ce,We=_===void 0?!1:_,tt=de===void 0?.3:de;let Fe;e[4]!==Z?(Fe=Z===void 0?[]:Z,e[4]=Z,e[5]=Fe):Fe=e[5];const ot=Fe;let Te;e[6]!==V?(Te=V===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:V,e[6]=V,e[7]=Te):Te=e[7];const c=Te,rt=G===void 0?!1:G,[ee,bt]=p.useState(0),[Oe,Et]=p.useState(0),[L,kt]=p.useState(c.autoplay);let qe;if(e[8]!==f||e[9]!==c.dateFormat){let x;e[11]!==c.dateFormat?(x=B=>ht.parse(`${B.date}`,c.dateFormat||"yyyy",new Date).getTime(),e[11]=c.dateFormat,e[12]=x):x=e[12],qe=[...new Set(f.filter(Gt).map(x))],qe.sort(Ht),e[8]=f,e[9]=c.dateFormat,e[10]=qe}else qe=e[10];const u=qe,[A,nt]=p.useState(c.autoplay?0:u.length-1),[ue,wt]=p.useState(void 0),it=p.useRef(null),ut=p.useRef(null);let _e,Ve;e[13]===Symbol.for("react.memo_cache_sentinel")?(_e=()=>{const x=new ResizeObserver(B=>{bt(B[0].target.clientWidth||620),Et(B[0].target.clientHeight||480)});return it.current&&x.observe(it.current),()=>x.disconnect()},Ve=[],e[13]=_e,e[14]=Ve):(_e=e[13],Ve=e[14]),p.useEffect(_e,Ve);let He;e[15]===Symbol.for("react.memo_cache_sentinel")?(He=x=>{wt(x)},e[15]=He):He=e[15];const Ge=p.useEffectEvent(He);let Ue;e[16]!==N||e[17]!==Ge?(Ue=()=>{typeof N=="string"?It.fetchAndParseJSON(N).then(B=>{Ge(B)}):Ge(N)},e[16]=N,e[17]=Ge,e[18]=Ue):Ue=e[18];let Xe;e[19]!==N?(Xe=[N],e[19]=N,e[20]=Xe):Xe=e[20],p.useEffect(Ue,Xe);let Ye,Je;e[21]!==L||e[22]!==c.speed||e[23]!==u?(Ye=()=>{const x=setInterval(()=>{nt(B=>B<u.length-1?B+1:0)},(c.speed||2)*1e3);return L||clearInterval(x),()=>clearInterval(x)},Je=[u,L,c.speed],e[21]=L,e[22]=c.speed,e[23]=u,e[24]=Ye,e[25]=Je):(Ye=e[24],Je=e[25]),p.useEffect(Ye,Je);const at=c.dateFormat||"yyyy";let Ke;e[26]!==A||e[27]!==at||e[28]!==c.showOnlyActiveDate||e[29]!==u?(Ke=pt.getSliderMarks(u,A,c.showOnlyActiveDate,at),e[26]=A,e[27]=at,e[28]=c.showOnlyActiveDate,e[29]=u,e[30]=Ke):Ke=e[30];const Ze=Ke;if(R&&D&&(R.length!==P[0].length-1||D.length!==P.length-1))return console.error("the xDomain and yDomain array length don't match to the color array length"),null;const st=h?.graphContainer,lt=g?.graphContainer;let pe;e[31]!==h?.description||e[32]!==h?.title||e[33]!==f||e[34]!==i||e[35]!==w||e[36]!==l||e[37]!==b||e[38]!==g?.description||e[39]!==g?.title||e[40]!==k?(pe=b||w||l||i?o.jsxRuntimeExports.jsx(Ot.GraphHeader,{styles:{title:g?.title,description:g?.description},classNames:{title:h?.title,description:h?.description},graphTitle:b,graphDescription:w,width:k,graphDownload:l?ut:void 0,dataDownload:i?f.map(Vt).filter(_t).length>0?f.map(Tt).filter(Ft):f.filter(Wt):null}):null,e[31]=h?.description,e[32]=h?.title,e[33]=f,e[34]=i,e[35]=w,e[36]=l,e[37]=b,e[38]=g?.description,e[39]=g?.title,e[40]=k,e[41]=pe):pe=e[41];let he;e[42]!==A||e[43]!==Ze||e[44]!==L||e[45]!==c.enabled||e[46]!==u?(he=c.enabled&&u.length>0&&Ze?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{kt(!L)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":L?"Click to pause animation":"Click to play animation",children:L?o.jsxRuntimeExports.jsx(mt.Pause,{}):o.jsxRuntimeExports.jsx(mt.Play,{})}),o.jsxRuntimeExports.jsx(pt.Nr,{min:u[0],max:u[u.length-1],marks:Ze,step:null,defaultValue:u[u.length-1],value:u[A],onChangeComplete:x=>{nt(u.indexOf(x))},onChange:x=>{nt(u.indexOf(x))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[42]=A,e[43]=Ze,e[44]=L,e[45]=c.enabled,e[46]=u,e[47]=he):he=e[47];let xe;e[48]!==We||e[49]!==ve||e[50]!==h||e[51]!==H||e[52]!==P||e[53]!==ot||e[54]!==f||e[55]!==K||e[56]!==tt||e[57]!==E||e[58]!==r||e[59]!==A||e[60]!==Q||e[61]!==Ne||e[62]!==Se||e[63]!==$e||e[64]!==le||e[65]!==n||e[66]!==ue||e[67]!==m||e[68]!==ae||e[69]!==be||e[70]!==C||e[71]!==U||e[72]!==M||e[73]!==y||e[74]!==v||e[75]!==g||e[76]!==Oe||e[77]!==ee||e[78]!==c.dateFormat||e[79]!==c.enabled||e[80]!==ne||e[81]!==u||e[82]!==k||e[83]!==Re||e[84]!==R||e[85]!==z||e[86]!==D||e[87]!==rt||e[88]!==et||e[89]!==a||e[90]!==T?(xe=o.jsxRuntimeExports.jsx(jt.GraphArea,{ref:it,children:ee&&Oe&&ue?o.jsxRuntimeExports.jsx(Pt,{data:f.filter(x=>c.enabled?x.date===ht.format(new Date(u[A]),c.dateFormat||"yyyy"):x),mapData:y?ue:{...ue,features:ue.features.filter(Bt)},xDomain:R||vt.getJenks(f.map(At),P[0].length),yDomain:D||vt.getJenks(f.map(Lt),P.length),width:ee,height:Oe,scale:M,centerPoint:ve,colors:P,xColorLegendTitle:Re,yColorLegendTitle:z,mapBorderWidth:Se,mapNoDataColor:$e,mapBorderColor:Ne,tooltip:ne,onSeriesMouseOver:be,isWorldMap:Q,zoomScaleExtend:a,zoomTranslateExtend:T,onSeriesMouseClick:ae,mapProperty:n,highlightedIds:r,resetSelectionOnDoubleClick:U,styles:g,showColorScale:v,classNames:h,mapProjection:le||(Q?"naturalEarth":"mercator"),detailsOnClick:K,zoomInteraction:et,animate:We===!0?{duration:.5,once:!0,amount:.5}:We||{duration:0,once:!0,amount:0},dimmedOpacity:tt,customLayers:ot,collapseColorScaleByDefault:H,zoomAndCenterByHighlightedIds:rt}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(m,E||(C?m?(k||ee)*C>m?(k||ee)*C:m:(k||ee)*C:Oe))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Ct.w,{"aria-label":"Loading graph"})})}),e[48]=We,e[49]=ve,e[50]=h,e[51]=H,e[52]=P,e[53]=ot,e[54]=f,e[55]=K,e[56]=tt,e[57]=E,e[58]=r,e[59]=A,e[60]=Q,e[61]=Ne,e[62]=Se,e[63]=$e,e[64]=le,e[65]=n,e[66]=ue,e[67]=m,e[68]=ae,e[69]=be,e[70]=C,e[71]=U,e[72]=M,e[73]=y,e[74]=v,e[75]=g,e[76]=Oe,e[77]=ee,e[78]=c.dateFormat,e[79]=c.enabled,e[80]=ne,e[81]=u,e[82]=k,e[83]=Re,e[84]=R,e[85]=z,e[86]=D,e[87]=rt,e[88]=et,e[89]=a,e[90]=T,e[91]=xe):xe=e[91];let ge;e[92]!==h?.footnote||e[93]!==h?.source||e[94]!==me||e[95]!==re||e[96]!==g?.footnote||e[97]!==g?.source||e[98]!==k?(ge=re||me?o.jsxRuntimeExports.jsx(qt.GraphFooter,{styles:{footnote:g?.footnote,source:g?.source},classNames:{footnote:h?.footnote,source:h?.source},sources:re,footNote:me,width:k}):null,e[92]=h?.footnote,e[93]=h?.source,e[94]=me,e[95]=re,e[96]=g?.footnote,e[97]=g?.source,e[98]=k,e[99]=ge):ge=e[99];let Qe;return e[100]!==Y||e[101]!==De||e[102]!==q||e[103]!==E||e[104]!==j||e[105]!==m||e[106]!==je||e[107]!==C||e[108]!==st||e[109]!==lt||e[110]!==pe||e[111]!==he||e[112]!==xe||e[113]!==ge||e[114]!==Me||e[115]!==k?(Qe=o.jsxRuntimeExports.jsxs(jt.GraphContainer,{className:st,style:lt,id:q,ref:ut,"aria-label":Y,backgroundColor:De,theme:Me,language:j,minHeight:m,width:k,height:E,relativeHeight:C,padding:je,children:[pe,he,xe,ge]}),e[100]=Y,e[101]=De,e[102]=q,e[103]=E,e[104]=j,e[105]=m,e[106]=je,e[107]=C,e[108]=st,e[109]=lt,e[110]=pe,e[111]=he,e[112]=xe,e[113]=ge,e[114]=Me,e[115]=k,e[116]=Qe):Qe=e[116],Qe}function Lt(d){return d.y}function At(d){return d.x}function Bt(d){return d.properties.NAME!=="Antarctica"}function Wt(d){return d!==void 0}function Ft(d){return d!==void 0}function Tt(d){return d.data}function _t(d){return d!==void 0}function Vt(d){return d.data}function Ht(d,e){return d-e}function Gt(d){return d.date}exports.BiVariateChoroplethMap=zt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-6v2a2njQ.cjs"),s=require("react"),vt=require("./getSliderMarks-CIuSoedo.cjs"),Mt=require("./Spinner-jTMOLuw_.cjs"),jt=require("./parse-xYI9yrvL.cjs"),qt=require("./index-DQA8q5sC.cjs"),A=require("./index-DLFt97gy.cjs"),It=require("./index-C5K--w8d.cjs"),bt=require("./Typography-sa1UE0oF.cjs"),Et=require("./numberFormattingFunction-02t-wJta.cjs"),zt=require("./Tooltip-BLa2EfMs.cjs"),kt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ft=require("./index-C6er0ety.cjs"),Pt=require("./DetailsModal-DHttOA80.cjs"),xt=require("./select-Bnfk0lJx.cjs"),Ct=require("./threshold-DNsSUf8Q.cjs"),et=require("./proxy-C4-uo6nS.cjs"),At=require("./use-in-view-C3o_ntMv.cjs"),Bt=require("./index-CoobIWNj.cjs"),Ft=require("./GraphHeader.cjs"),Lt=require("./GraphFooter.cjs"),gt=require("./Colors.cjs"),Wt=require("./fetchAndParseData-QTF6tjij.cjs"),wt=require("./getJenks-BzJvhy_H.cjs"),Rt=require("./GraphContainer-B1EDxJ0S.cjs");function _t(a){const{data:e,xDomain:u,mapData:B,xColorLegendTitle:ze,yDomain:Y,yColorLegendTitle:J,width:x,height:p,colors:h,scale:Pe,centerPoint:E,mapBorderWidth:F,mapNoDataColor:K,mapBorderColor:pe,tooltip:Z,onSeriesMouseOver:he,zoomScaleExtend:xe,zoomTranslateExtend:ge,highlightedIds:k,onSeriesMouseClick:Q,mapProperty:R,resetSelectionOnDoubleClick:Ae,detailsOnClick:y,showColorScale:fe,styles:Be,classNames:L,mapProjection:W,zoomInteraction:D,animate:S,dimmedOpacity:N,customLayers:ee,collapseColorScaleByDefault:ye,zoomAndCenterByHighlightedIds:ve,projectionRotate:_,rewindCoordinatesInMapData:je}=a,v=s.useMemo(()=>je?A.index_default(B,{reverse:!0}):B,[B,je]),[Fe,be]=s.useState(ye===void 0?!(x<680):!ye),[T,Ee]=s.useState(void 0),[H,c]=s.useState(void 0),[l,te]=s.useState(void 0),[ke,oe]=s.useState(void 0),[Ce,$]=s.useState(void 0),w=s.useRef(null),re=At.useInView(w,{once:S.once,amount:S.amount}),we=s.useRef(null),G=s.useRef(null);s.useEffect(()=>{const t=xt.select(we.current),r=xt.select(w.current),g=m=>{if(D==="noZoom")return!1;if(D==="button")return!m.type.includes("wheel");const C=m.type==="wheel",j=m.type.startsWith("touch"),Me=m.type==="mousedown"||m.type==="mousemove";return j?!0:C?D==="scroll"?!0:m.ctrlKey:Me&&!m.button&&!m.ctrlKey},b=A.zoom().scaleExtent(xe).translateExtent(ge||[[-20,-20],[x+20,p+20]]).filter(g).on("zoom",({transform:m})=>{t.attr("transform",m)});r.call(b),G.current=b},[p,x,D]);const V=A.index_default$1({...v,features:ve?v.features.filter(t=>(k||[]).length===0||k.indexOf(t.properties[R])!==-1):v.features}),f=It.index_default({...v,features:ve?v.features.filter(t=>(k||[]).length===0||k.indexOf(t.properties[R])!==-1):v.features}),O=V[2]-V[0],ne=V[3]-V[1],Re=x*190/960*360/O,De=p*190/678*180/ne,M=Pe*Math.min(Re,De),Se=W==="mercator"?A.geoMercator().rotate(_).center(E||f.geometry.coordinates).translate([x/2,p/2]).scale(M):W==="equalEarth"?A.geoEqualEarth().rotate(_).center(E||f.geometry.coordinates).translate([x/2,p/2]).scale(M):W==="naturalEarth"?A.geoNaturalEarth1().rotate(_).center(E||f.geometry.coordinates).translate([x/2,p/2]).scale(M):W==="orthographic"?A.geoOrthographic().rotate(_).center(E||f.geometry.coordinates).translate([x/2,p/2]).scale(M):A.geoAlbersUsa().rotate(_).center(E||f.geometry.coordinates).translate([x/2,p/2]).scale(M),U=A.geoPath().projection(Se),Ne=Array.from({length:u.length},(t,r)=>r),Oe=Array.from({length:Y.length},(t,r)=>r),ae=Ct.threshold().domain(u).range(Ne),ie=Ct.threshold().domain(Y).range(Oe),se=t=>{if(!w.current||!G.current)return;xt.select(w.current).call(G.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(et.motion.svg,{viewBox:`0 0 ${x} ${p}`,width:`${x}px`,height:`${p}px`,ref:w,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:we,children:[ee.filter(t=>t.position==="before").map(t=>t.layer),v.features.map((t,r)=>{if(!t.properties?.[R])return null;const g=U(t);return g?o.jsxRuntimeExports.jsx(et.motion.g,{opacity:T?N:k.length!==0?k.indexOf(t.properties[R])!==-1?1:N:1,children:o.jsxRuntimeExports.jsx("path",{d:g,style:{stroke:pe,strokeWidth:F,fill:K}})},r):null}),o.jsxRuntimeExports.jsx(Bt.AnimatePresence,{children:e.map(t=>{const r=v.features.findIndex(j=>t.id===j.properties[R]);if(r===-1)return null;const g=U(v.features[r]);if(!g)return null;const b=kt.checkIfNullOrUndefined(t.x)?void 0:ae(t.x),m=kt.checkIfNullOrUndefined(t.y)?void 0:ie(t.y),C=b!==void 0&&m!==void 0?h[m][b]:K;return o.jsxRuntimeExports.jsx(et.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:T?T===C?1:N:k.length!==0?k.indexOf(t.id)!==-1?1:N:1,transition:{duration:S.duration}}},initial:"initial",animate:re?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},onMouseEnter:j=>{te(t),$(j.clientY),oe(j.clientX),he?.(t)},onClick:()=>{(Q||y)&&(qt.isEqual(H,t)&&Ae?(c(void 0),Q?.(void 0)):(c(t),Q?.(t)))},onMouseMove:j=>{te(t),$(j.clientY),oe(j.clientX)},onMouseLeave:()=>{te(void 0),oe(void 0),$(void 0),he?.(void 0)},children:o.jsxRuntimeExports.jsx(et.motion.path,{d:g,variants:{initial:{fill:C,opacity:0},whileInView:{fill:C,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:re?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},className:`${C===K?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{stroke:pe,strokeWidth:F}},`${t.id}`)},t.id)})}),l?v.features.filter(t=>t.properties[R]===l.id).map((t,r)=>o.jsxRuntimeExports.jsx("path",{d:U(t)||"",className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},r)):null,ee.filter(t=>t.position==="after").map(t=>t.layer)]})}),fe===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",L?.colorLegend),children:Fe?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:()=>{be(!1)},children:o.jsxRuntimeExports.jsx(ft.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((g,b)=>o.jsxRuntimeExports.jsx("rect",{y:1,x:b*25+1,fill:g,width:23,height:23,strokeWidth:T===g?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{Ee(g)},onMouseLeave:()=>{Ee(void 0)}},b))},r)),o.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:u.map((t,r)=>o.jsxRuntimeExports.jsx("text",{y:10,x:(r+1)*25,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:Et.numberFormattingFunction(t,"NA")},r))}),Y.map((t,r)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(u.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:Et.numberFormattingFunction(t,"NA")})},r))]})}),o.jsxRuntimeExports.jsx(bt.j,{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:J})]}),o.jsxRuntimeExports.jsx(bt.j,{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:ze})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{be(!0)},children:o.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),D==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>se("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:()=>se("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:"–"})]})]}),l&&Z&&ke&&Ce?o.jsxRuntimeExports.jsx(zt.Tooltip,{data:l,body:Z,xPos:ke,yPos:Ce,backgroundStyle:Be?.tooltip,className:L?.tooltip}):null,y&&H!==void 0?o.jsxRuntimeExports.jsx(Pt.DetailsModal,{body:y,data:H,setData:c,className:L?.modal}):null]})}function Tt(a){const e=o.compilerRuntimeExports.c(121),{data:u,graphTitle:B,mapData:ze,colors:Y,sources:J,graphDescription:x,height:p,width:h,footNote:Pe,xDomain:E,yDomain:F,xColorLegendTitle:K,yColorLegendTitle:pe,tooltip:Z,scale:he,centerPoint:xe,padding:ge,mapBorderWidth:k,mapNoDataColor:Q,backgroundColor:R,mapBorderColor:Ae,relativeHeight:y,onSeriesMouseOver:fe,isWorldMap:Be,zoomScaleExtend:L,zoomTranslateExtend:W,graphID:D,showColorScale:S,highlightedIds:N,onSeriesMouseClick:ee,mapProperty:ye,graphDownload:ve,dataDownload:_,showAntarctica:je,language:v,minHeight:Fe,theme:be,ariaLabel:T,resetSelectionOnDoubleClick:Ee,detailsOnClick:H,styles:c,classNames:l,mapProjection:te,zoomInteraction:ke,animate:oe,dimmedOpacity:Ce,customLayers:$,timeline:w,collapseColorScaleByDefault:re,zoomAndCenterByHighlightedIds:we,projectionRotate:G,rewindCoordinatesInMapData:V}=a,f=ze===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":ze,O=Y===void 0?gt.Colors.light.bivariateColors.colors05x05:Y,ne=Pe===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":Pe,Re=K===void 0?"X Color key":K,De=pe===void 0?"Y Color key":pe,M=he===void 0?.95:he,Se=k===void 0?.5:k,U=Q===void 0?gt.Colors.light.graphNoData:Q,Ne=R===void 0?!1:R,Oe=Ae===void 0?gt.Colors.light.grays["gray-500"]:Ae,ae=Be===void 0?!0:Be;let ie;e[0]!==L?(ie=L===void 0?[.8,6]:L,e[0]=L,e[1]=ie):ie=e[1];const se=ie,t=S===void 0?!0:S;let r;e[2]!==N?(r=N===void 0?[]:N,e[2]=N,e[3]=r):r=e[3];const g=r,b=ye===void 0?"ISO3":ye,m=ve===void 0?!1:ve,C=_===void 0?!1:_,j=je===void 0?!1:je,Me=v===void 0?"en":v,q=Fe===void 0?0:Fe,tt=be===void 0?"light":be,ot=Ee===void 0?!0:Ee,rt=te===void 0?"naturalEarth":te,nt=ke===void 0?"button":ke,Le=oe===void 0?!1:oe,at=Ce===void 0?.3:Ce;let We;e[4]!==$?(We=$===void 0?[]:$,e[4]=$,e[5]=We):We=e[5];const it=We;let _e;e[6]!==w?(_e=w===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:w,e[6]=w,e[7]=_e):_e=e[7];const n=_e,st=we===void 0?!1:we;let Te;e[8]!==G?(Te=G===void 0?[0,0]:G,e[8]=G,e[9]=Te):Te=e[9];const lt=Te,ct=V===void 0?!0:V,[X,Dt]=s.useState(0),[qe,St]=s.useState(0),[I,Nt]=s.useState(n.autoplay);let Ie;if(e[10]!==u||e[11]!==n.dateFormat){let d;e[13]!==n.dateFormat?(d=P=>jt.parse(`${P.date}`,n.dateFormat||"yyyy",new Date).getTime(),e[13]=n.dateFormat,e[14]=d):d=e[14],Ie=[...new Set(u.filter(Zt).map(d))],Ie.sort(Kt),e[10]=u,e[11]=n.dateFormat,e[12]=Ie}else Ie=e[12];const i=Ie,[z,dt]=s.useState(n.autoplay?0:i.length-1),[le,Ot]=s.useState(void 0),ut=s.useRef(null),yt=s.useRef(null);let $e,Ge;e[15]===Symbol.for("react.memo_cache_sentinel")?($e=()=>{const d=new ResizeObserver(P=>{Dt(P[0].target.clientWidth||620),St(P[0].target.clientHeight||480)});return ut.current&&d.observe(ut.current),()=>d.disconnect()},Ge=[],e[15]=$e,e[16]=Ge):($e=e[15],Ge=e[16]),s.useEffect($e,Ge);let He;e[17]===Symbol.for("react.memo_cache_sentinel")?(He=d=>{Ot(d)},e[17]=He):He=e[17];const Ve=s.useEffectEvent(He);let Ue;e[18]!==f||e[19]!==Ve?(Ue=()=>{typeof f=="string"?Wt.fetchAndParseJSON(f).then(P=>{Ve(P)}):Ve(f)},e[18]=f,e[19]=Ve,e[20]=Ue):Ue=e[20];let Xe;e[21]!==f?(Xe=[f],e[21]=f,e[22]=Xe):Xe=e[22],s.useEffect(Ue,Xe);let Ye,Je;e[23]!==I||e[24]!==n.speed||e[25]!==i?(Ye=()=>{const d=setInterval(()=>{dt(P=>P<i.length-1?P+1:0)},(n.speed||2)*1e3);return I||clearInterval(d),()=>clearInterval(d)},Je=[i,I,n.speed],e[23]=I,e[24]=n.speed,e[25]=i,e[26]=Ye,e[27]=Je):(Ye=e[26],Je=e[27]),s.useEffect(Ye,Je);const mt=n.dateFormat||"yyyy";let Ke;e[28]!==z||e[29]!==mt||e[30]!==n.showOnlyActiveDate||e[31]!==i?(Ke=vt.getSliderMarks(i,z,n.showOnlyActiveDate,mt),e[28]=z,e[29]=mt,e[30]=n.showOnlyActiveDate,e[31]=i,e[32]=Ke):Ke=e[32];const Ze=Ke;if(E&&F&&(E.length!==O[0].length-1||F.length!==O.length-1))return console.error("the xDomain and yDomain array length don't match to the color array length"),null;const pt=l?.graphContainer,ht=c?.graphContainer;let ce;e[33]!==l?.description||e[34]!==l?.title||e[35]!==u||e[36]!==C||e[37]!==x||e[38]!==m||e[39]!==B||e[40]!==c?.description||e[41]!==c?.title||e[42]!==h?(ce=B||x||m||C?o.jsxRuntimeExports.jsx(Ft.GraphHeader,{styles:{title:c?.title,description:c?.description},classNames:{title:l?.title,description:l?.description},graphTitle:B,graphDescription:x,width:h,graphDownload:m?yt:void 0,dataDownload:C?u.map(Jt).filter(Yt).length>0?u.map(Xt).filter(Ut):u.filter(Vt):null}):null,e[33]=l?.description,e[34]=l?.title,e[35]=u,e[36]=C,e[37]=x,e[38]=m,e[39]=B,e[40]=c?.description,e[41]=c?.title,e[42]=h,e[43]=ce):ce=e[43];let de;e[44]!==z||e[45]!==Ze||e[46]!==I||e[47]!==n.enabled||e[48]!==i?(de=n.enabled&&i.length>0&&Ze?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Nt(!I)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":I?"Click to pause animation":"Click to play animation",children:I?o.jsxRuntimeExports.jsx(ft.Pause,{}):o.jsxRuntimeExports.jsx(ft.Play,{})}),o.jsxRuntimeExports.jsx(vt.Nr,{min:i[0],max:i[i.length-1],marks:Ze,step:null,defaultValue:i[i.length-1],value:i[z],onChangeComplete:d=>{dt(i.indexOf(d))},onChange:d=>{dt(i.indexOf(d))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[44]=z,e[45]=Ze,e[46]=I,e[47]=n.enabled,e[48]=i,e[49]=de):de=e[49];let ue;e[50]!==Le||e[51]!==xe||e[52]!==l||e[53]!==re||e[54]!==O||e[55]!==it||e[56]!==u||e[57]!==H||e[58]!==at||e[59]!==p||e[60]!==g||e[61]!==z||e[62]!==ae||e[63]!==Oe||e[64]!==Se||e[65]!==U||e[66]!==rt||e[67]!==b||e[68]!==le||e[69]!==q||e[70]!==ee||e[71]!==fe||e[72]!==lt||e[73]!==y||e[74]!==ot||e[75]!==ct||e[76]!==M||e[77]!==j||e[78]!==t||e[79]!==c||e[80]!==qe||e[81]!==X||e[82]!==n.dateFormat||e[83]!==n.enabled||e[84]!==Z||e[85]!==i||e[86]!==h||e[87]!==Re||e[88]!==E||e[89]!==De||e[90]!==F||e[91]!==st||e[92]!==nt||e[93]!==se||e[94]!==W?(ue=o.jsxRuntimeExports.jsx(Rt.GraphArea,{ref:ut,children:X&&qe&&le?o.jsxRuntimeExports.jsx(_t,{data:u.filter(d=>n.enabled?d.date===jt.format(new Date(i[z]),n.dateFormat||"yyyy"):d),mapData:j?le:{...le,features:le.features.filter(Ht)},xDomain:E||wt.getJenks(u.map(Gt),O[0].length),yDomain:F||wt.getJenks(u.map($t),O.length),width:X,height:qe,scale:M,centerPoint:xe,colors:O,xColorLegendTitle:Re,yColorLegendTitle:De,mapBorderWidth:Se,mapNoDataColor:U,mapBorderColor:Oe,tooltip:Z,onSeriesMouseOver:fe,isWorldMap:ae,zoomScaleExtend:se,zoomTranslateExtend:W,onSeriesMouseClick:ee,mapProperty:b,highlightedIds:g,resetSelectionOnDoubleClick:ot,styles:c,showColorScale:t,classNames:l,mapProjection:rt||(ae?"naturalEarth":"mercator"),detailsOnClick:H,zoomInteraction:nt,animate:Le===!0?{duration:.5,once:!0,amount:.5}:Le||{duration:0,once:!0,amount:0},dimmedOpacity:at,customLayers:it,collapseColorScaleByDefault:re,zoomAndCenterByHighlightedIds:st,projectionRotate:lt,rewindCoordinatesInMapData:ct}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(q,p||(y?q?(h||X)*y>q?(h||X)*y:q:(h||X)*y:qe))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Mt.w,{"aria-label":"Loading graph"})})}),e[50]=Le,e[51]=xe,e[52]=l,e[53]=re,e[54]=O,e[55]=it,e[56]=u,e[57]=H,e[58]=at,e[59]=p,e[60]=g,e[61]=z,e[62]=ae,e[63]=Oe,e[64]=Se,e[65]=U,e[66]=rt,e[67]=b,e[68]=le,e[69]=q,e[70]=ee,e[71]=fe,e[72]=lt,e[73]=y,e[74]=ot,e[75]=ct,e[76]=M,e[77]=j,e[78]=t,e[79]=c,e[80]=qe,e[81]=X,e[82]=n.dateFormat,e[83]=n.enabled,e[84]=Z,e[85]=i,e[86]=h,e[87]=Re,e[88]=E,e[89]=De,e[90]=F,e[91]=st,e[92]=nt,e[93]=se,e[94]=W,e[95]=ue):ue=e[95];let me;e[96]!==l?.footnote||e[97]!==l?.source||e[98]!==ne||e[99]!==J||e[100]!==c?.footnote||e[101]!==c?.source||e[102]!==h?(me=J||ne?o.jsxRuntimeExports.jsx(Lt.GraphFooter,{styles:{footnote:c?.footnote,source:c?.source},classNames:{footnote:l?.footnote,source:l?.source},sources:J,footNote:ne,width:h}):null,e[96]=l?.footnote,e[97]=l?.source,e[98]=ne,e[99]=J,e[100]=c?.footnote,e[101]=c?.source,e[102]=h,e[103]=me):me=e[103];let Qe;return e[104]!==T||e[105]!==Ne||e[106]!==D||e[107]!==p||e[108]!==Me||e[109]!==q||e[110]!==ge||e[111]!==y||e[112]!==pt||e[113]!==ht||e[114]!==ce||e[115]!==de||e[116]!==ue||e[117]!==me||e[118]!==tt||e[119]!==h?(Qe=o.jsxRuntimeExports.jsxs(Rt.GraphContainer,{className:pt,style:ht,id:D,ref:yt,"aria-label":T,backgroundColor:Ne,theme:tt,language:Me,minHeight:q,width:h,height:p,relativeHeight:y,padding:ge,children:[ce,de,ue,me]}),e[104]=T,e[105]=Ne,e[106]=D,e[107]=p,e[108]=Me,e[109]=q,e[110]=ge,e[111]=y,e[112]=pt,e[113]=ht,e[114]=ce,e[115]=de,e[116]=ue,e[117]=me,e[118]=tt,e[119]=h,e[120]=Qe):Qe=e[120],Qe}function $t(a){return a.y}function Gt(a){return a.x}function Ht(a){return a.properties.NAME!=="Antarctica"}function Vt(a){return a!==void 0}function Ut(a){return a!==void 0}function Xt(a){return a.data}function Yt(a){return a!==void 0}function Jt(a){return a.data}function Kt(a,e){return a-e}function Zt(a){return a.date}exports.BiVariateChoroplethMap=Tt;
|
|
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, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\n\r\ninterface Props {\r\n data: BivariateMapDataType[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n showColorScale: boolean;\r\n collapseColorScaleByDefault?: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n zoomAndCenterByHighlightedIds: boolean;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds,\r\n } = props;\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n const bounds = bbox({\r\n ...mapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? mapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : mapData.features,\r\n });\r\n\r\n const center = centerOfMass({\r\n ...mapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? mapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : mapData.features,\r\n });\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <motion.g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </motion.g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n d={masterPath}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{ width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useEffectEvent, useMemo, useRef, useState } from 'react';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects. */\r\n data: BivariateMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Toggle if the map is centered and zoomed to the highlighted ids. */\r\n zoomAndCenterByHighlightedIds?: boolean;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds = false,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = useMemo(() => {\r\n const dates = [\r\n ...new Set(\r\n data\r\n .filter(d => d.date)\r\n .map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n ),\r\n ];\r\n dates.sort((a, b) => a - b);\r\n return dates;\r\n }, [data, timeline.dateFormat]);\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const onUpdateShape = useEffectEvent((shape: any) => {\r\n setMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\r\n }\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {svgWidth && svgHeight && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date === format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n zoomAndCenterByHighlightedIds={zoomAndCenterByHighlightedIds}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","zoomAndCenterByHighlightedIds","showLegend","setShowLegend","useState","undefined","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","once","amount","mapG","zoomRef","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","features","d","length","indexOf","properties","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","xRange","Array","from","_","i","yRange","xScale","scaleThreshold","domain","range","yScale","handleZoom","direction","scaleBy","jsxs","Fragment","jsx","motion","position","map","layer","findIndex","el","id","j","masterPath","forEach","geo","path","c","k","point","stroke","strokeWidth","fill","AnimatePresence","index","xColorCoord","checkIfNullOrUndefined","x","yColorCoord","y","color","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","cn","colorLegend","X","cursor","numberFormattingFunction","max","P","display","WebkitLineClamp","WebkitBoxOrient","overflow","writingMode","Tooltip","DetailsModal","modal","BiVariateChoroplethMap","$","_c","graphTitle","t0","t1","sources","graphDescription","footNote","t2","t3","t4","t5","padding","t6","t7","backgroundColor","t8","t9","relativeHeight","isWorldMap","t10","t11","graphID","t12","t13","t14","graphDownload","t15","dataDownload","t16","showAntarctica","t17","language","t18","minHeight","t19","theme","t20","ariaLabel","t21","t22","t23","t24","t25","timeline","t26","t27","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t28","t29","t30","t31","enabled","autoplay","showOnlyActiveDate","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t32","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","t33","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t34","shape","onUpdateShape","useEffectEvent","t35","fetchAndParseJSON","then","d_1","t36","t37","t38","speed","interval","setInterval","clearInterval","t39","t40","getSliderMarks","markObj","console","error","t41","graphContainer","t42","t43","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t44","Pause","Play","SliderUI","nextValue","nextValue_0","t45","GraphArea","d_7","format","_temp8","getJenks","_temp9","_temp0","Spinner","t46","footnote","source","GraphFooter","t47","GraphContainer","d_9","d_8","NAME","d_4","d_3","d_2","d_6","d_5","a","b"],"mappings":"0gCA8EO,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,EACAC,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,GACAC,4BAAAA,GACAC,8BAAAA,EAAAA,EACEjC,EACE,CAACkC,GAAYC,EAAa,EAAIC,WAClCJ,KAAgCK,OAAY,EAAE9B,EAAQ,KAAO,CAACyB,EAChE,EACM,CAACM,EAAeC,EAAgB,EAAIH,EAAAA,SAA6BC,MAAS,EAE1E,CAACG,GAAgBC,CAAiB,EAA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AAA,GAER2G,SAAAA,CAAAA,GAuBAS,GA6BDM,GAyFCS,EAAAA,EAYH,EAAiB/I,OAAAsC,EAAAtC,OAAAe,GAAAf,OAAAsB,EAAAtB,OAAAvK,EAAAuK,OAAAgC,EAAAhC,OAAAkC,EAAAlC,OAAAY,GAAAZ,OAAAkB,EAAAlB,OAAAoH,GAAApH,OAAAsH,GAAAtH,OAAAuH,GAAAvH,OAAAgI,GAAAhI,OAAAsI,GAAAtI,OAAA+I,GAAA/I,OAAAoC,GAAApC,OAAAxK,EAAAwK,OAAAmJ,IAAAA,GAAAnJ,EAAA,GAAA,EAxKjBmJ,EAwKiB,CApSd,SAAAN,GAAAQ,EAAA,CAAA,OA4NuBjP,EAACgE,CAA+B,CA5NvD,SAAAwK,GAAAU,EAAA,CAAA,OAqNuBlP,EAAC8D,CAA+B,CArNvD,SAAAwK,GAAAzL,EAAA,CAAA,OA8M4BA,EAAE1C,WAAWgP,OAAU,YAAY,CA9M/D,SAAAxB,GAAAyB,EAAA,CAAA,OA6J4BpP,IAAM9C,MAAS,CA7J3C,SAAAwQ,GAAA2B,EAAA,CAAA,OA4J6CrP,IAAM9C,MAAS,CA5J5D,SAAAuQ,GAAA6B,EAAA,CAAA,OA4JyBtP,EAAClF,IAAK,CA5J/B,SAAA0S,GAAA+B,EAAA,CAAA,OA2J2CvP,IAAM9C,MAAS,CA3J1D,SAAAqQ,GAAAiC,EAAA,CAAA,OA2JuBxP,EAAClF,IAAK,CA3J7B,SAAA2P,GAAAgF,EAAAC,EAAA,CAAA,OAiEkBD,EAAIC,CAAC,CAjEvB,SAAAnF,GAAAvK,EAAA,CAAA,OA6DgBA,EAACmK,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 { useEffect, useMemo, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n geoPath,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { FeatureCollection } from 'geojson';\r\nimport rewind from '@turf/rewind';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\n\r\ninterface Props {\r\n data: BivariateMapDataType[];\r\n mapData: FeatureCollection;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n showColorScale: boolean;\r\n collapseColorScaleByDefault?: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n zoomAndCenterByHighlightedIds: boolean;\r\n projectionRotate: [number, number] | [number, number, number];\r\n rewindCoordinatesInMapData: boolean;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds,\r\n projectionRotate,\r\n rewindCoordinatesInMapData,\r\n } = props;\r\n const formattedMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData) return mapData;\r\n\r\n return rewind(mapData, { reverse: true }) as FeatureCollection;\r\n }, [mapData, rewindCoordinatesInMapData]);\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n const bounds = bbox({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n\r\n const center = centerOfMass({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\r\n const pathGenerator = geoPath().projection(projection);\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {formattedMapData.features.map((d, i: number) => {\r\n if (!d.properties?.[mapProperty]) return null;\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <motion.g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n <path\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = formattedMapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n if (index === -1) return null;\r\n const path = pathGenerator(formattedMapData.features[index]);\r\n if (!path) return null;\r\n const xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n <motion.path\r\n key={`${d.id}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? formattedMapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n .map((d, i) => (\r\n <path\r\n key={i}\r\n d={pathGenerator(d) || ''}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n ))\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{ width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useEffectEvent, useMemo, useRef, useState } from 'react';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects. */\r\n data: BivariateMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Defines if the coordinates in the map data should be rewinded or not. Try to change this is the visualization shows countries as holes instead of shapes. */\r\n rewindCoordinatesInMapData?: boolean;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Controls the rotation of the map projection, in degrees, applied before rendering. Useful for shifting the antimeridian to focus the map on different regions */\r\n projectionRotate?: [number, number] | [number, number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Toggle if the map is centered and zoomed to the highlighted ids. */\r\n zoomAndCenterByHighlightedIds?: boolean;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection = 'naturalEarth',\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds = false,\r\n projectionRotate = [0, 0],\r\n rewindCoordinatesInMapData = true,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = useMemo(() => {\r\n const dates = [\r\n ...new Set(\r\n data\r\n .filter(d => d.date)\r\n .map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n ),\r\n ];\r\n dates.sort((a, b) => a - b);\r\n return dates;\r\n }, [data, timeline.dateFormat]);\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const onUpdateShape = useEffectEvent((shape: any) => {\r\n setMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\r\n }\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {svgWidth && svgHeight && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date === format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n zoomAndCenterByHighlightedIds={zoomAndCenterByHighlightedIds}\r\n projectionRotate={projectionRotate}\r\n rewindCoordinatesInMapData={rewindCoordinatesInMapData}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","zoomAndCenterByHighlightedIds","projectionRotate","rewindCoordinatesInMapData","formattedMapData","useMemo","rewind","reverse","showLegend","setShowLegend","useState","undefined","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","once","amount","mapG","zoomRef","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","features","d","length","indexOf","properties","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","pathGenerator","geoPath","xRange","Array","from","_","i","yRange","xScale","scaleThreshold","domain","range","yScale","handleZoom","direction","scaleBy","jsxs","Fragment","jsx","motion","position","map","layer","path","stroke","strokeWidth","fill","AnimatePresence","index","findIndex","el","id","xColorCoord","checkIfNullOrUndefined","x","yColorCoord","y","color","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","cn","colorLegend","X","j","cursor","numberFormattingFunction","max","P","display","WebkitLineClamp","WebkitBoxOrient","overflow","writingMode","Tooltip","DetailsModal","modal","BiVariateChoroplethMap","$","_c","graphTitle","t0","t1","sources","graphDescription","footNote","t2","t3","t4","t5","padding","t6","t7","backgroundColor","t8","t9","relativeHeight","isWorldMap","t10","t11","graphID","t12","t13","t14","graphDownload","t15","dataDownload","t16","showAntarctica","t17","language","t18","minHeight","t19","theme","t20","ariaLabel","t21","t22","t23","t24","t25","t26","timeline","t27","t28","t29","t30","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t31","t32","t33","t34","enabled","autoplay","showOnlyActiveDate","t35","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t36","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","t37","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t38","shape","onUpdateShape","useEffectEvent","t39","fetchAndParseJSON","then","d_1","t40","t41","t42","speed","interval","setInterval","clearInterval","t43","t44","getSliderMarks","markObj","console","error","t45","graphContainer","t46","t47","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t48","Pause","Play","SliderUI","nextValue","nextValue_0","t49","GraphArea","d_7","format","_temp8","getJenks","_temp9","_temp0","Spinner","t50","footnote","source","GraphFooter","t51","GraphContainer","d_9","d_8","NAME","d_4","d_3","d_2","d_6","d_5","a","b"],"mappings":"0gCAiFO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJC,KAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,kBAAAA,GACAC,QAAAA,EACAC,kBAAAA,EACAC,MAAAA,EACAC,OAAAA,EACAC,OAAAA,EACAC,MAAAA,GACAC,YAAAA,EACAC,eAAAA,EACAC,eAAAA,EACAC,eAAAA,GACAC,QAAAA,EACAC,kBAAAA,GACAC,gBAAAA,GACAC,oBAAAA,GACAC,eAAAA,EACAC,mBAAAA,EACAC,YAAAA,EACAC,4BAAAA,GACAC,eAAAA,EACAC,eAAAA,GACAC,OAAAA,GACAC,WAAAA,EACAC,cAAAA,EACAC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e,GAAAf,OAAAsB,EAAAtB,OAAAzK,EAAAyK,OAAAgC,GAAAhC,OAAAkC,EAAAlC,OAAAY,GAAAZ,OAAAkB,EAAAlB,OAAAwH,GAAAxH,OAAA0H,GAAA1H,OAAA2H,GAAA3H,OAAAoI,GAAApI,OAAA0I,GAAA1I,OAAAmJ,GAAAnJ,OAAAoC,GAAApC,OAAA1K,EAAA0K,OAAAuJ,IAAAA,GAAAvJ,EAAA,GAAA,EA1KjBuJ,EA0KiB,CAxSd,SAAAN,GAAAQ,EAAA,CAAA,OA8NuBjP,EAAC2D,CAA+B,CA9NvD,SAAA6K,GAAAU,EAAA,CAAA,OAuNuBlP,EAACyD,CAA+B,CAvNvD,SAAA6K,GAAAjL,EAAA,CAAA,OAgN4BA,EAAElD,WAAWgP,OAAU,YAAY,CAhN/D,SAAAxB,GAAAyB,EAAA,CAAA,OA+J4BpP,IAAM9C,MAAS,CA/J3C,SAAAwQ,GAAA2B,EAAA,CAAA,OA8J6CrP,IAAM9C,MAAS,CA9J5D,SAAAuQ,GAAA6B,EAAA,CAAA,OA8JyBtP,EAACxF,IAAK,CA9J/B,SAAAgT,GAAA+B,EAAA,CAAA,OA6J2CvP,IAAM9C,MAAS,CA7J1D,SAAAqQ,GAAAiC,EAAA,CAAA,OA6JuBxP,EAACxF,IAAK,CA7J7B,SAAAiQ,GAAAgF,EAAAC,EAAA,CAAA,OAmEkBD,EAAIC,CAAC,CAnEvB,SAAAnF,GAAAvK,EAAA,CAAA,OA+DgBA,EAACmK,IAAK"}
|
|
@@ -101,10 +101,14 @@ declare interface Props {
|
|
|
101
101
|
padding?: string;
|
|
102
102
|
/** Map data as an object in geoJson format or a url for geoJson */
|
|
103
103
|
mapData?: any;
|
|
104
|
+
/** 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. */
|
|
105
|
+
rewindCoordinatesInMapData?: boolean;
|
|
104
106
|
/** Scaling factor for the map. Multiplies the scale number to scale. */
|
|
105
107
|
scale?: number;
|
|
106
108
|
/** Center point of the map */
|
|
107
109
|
centerPoint?: [number, number];
|
|
110
|
+
/** Controls the rotation of the map projection, in degrees, applied before rendering. Useful for shifting the antimeridian to focus the map on different regions */
|
|
111
|
+
projectionRotate?: [number, number] | [number, number, number];
|
|
108
112
|
/** Defines the zoom mode for the map */
|
|
109
113
|
zoomInteraction?: ZoomInteractionTypes;
|
|
110
114
|
/** Stroke width of the regions in the map */
|