@undp/data-viz 2.2.1 → 2.2.2
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 +2 -0
- package/dist/BiVariateChoroplethMap.js +264 -250
- 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 +2 -0
- package/dist/ChoroplethMap.js +272 -258
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/GraphEl-CAjJLOGk.cjs +2 -0
- package/dist/GraphEl-CAjJLOGk.cjs.map +1 -0
- package/dist/{GraphEl-DKrjuQNB.js → GraphEl-DcNr5JzH.js} +9 -7
- package/dist/GraphEl-DcNr5JzH.js.map +1 -0
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.d.ts +1 -0
- package/dist/GriddedGraphs.js +1 -1
- package/dist/GriddedGraphsFromConfig.d.ts +1 -0
- package/dist/MultiGraphDashboard.d.ts +1 -0
- package/dist/MultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +1 -0
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/PerformanceIntensiveScrollStory.d.ts +1 -0
- package/dist/ScrollStory.d.ts +1 -0
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.d.ts +1 -0
- package/dist/SingleGraphDashboard.js +1 -1
- package/dist/SingleGraphDashboardFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardGeoHubMaps.d.ts +1 -0
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphs.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +1 -0
- package/dist/Types.d.ts +1 -0
- package/dist/index.d.ts +5 -0
- package/package.json +1 -1
- package/dist/GraphEl-CBZdcvb7.cjs +0 -2
- package/dist/GraphEl-CBZdcvb7.cjs.map +0 -1
- package/dist/GraphEl-DKrjuQNB.js.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"),mt=require("./getSliderMarks-CIuSoedo.cjs"),kt=require("./Spinner-jTMOLuw_.cjs"),ut=require("./parse-xYI9yrvL.cjs"),wt=require("./index-DQA8q5sC.cjs"),Q=require("./zoom-ChcvXFIz.cjs"),Ct=require("./index-C5K--w8d.cjs"),pt=require("./Typography-sa1UE0oF.cjs"),ht=require("./numberFormattingFunction-02t-wJta.cjs"),Rt=require("./Tooltip-BLa2EfMs.cjs"),xt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ct=require("./index-C6er0ety.cjs"),St=require("./DetailsModal-DHttOA80.cjs"),st=require("./select-Bnfk0lJx.cjs"),gt=require("./threshold-DNsSUf8Q.cjs"),qe=require("./proxy-C4-uo6nS.cjs"),$t=require("./use-in-view-C3o_ntMv.cjs"),Dt=require("./index-CoobIWNj.cjs"),Nt=require("./GraphHeader.cjs"),Mt=require("./GraphFooter.cjs"),lt=require("./Colors.cjs"),Ot=require("./fetchAndParseData-QTF6tjij.cjs"),yt=require("./getJenks-BzJvhy_H.cjs"),ft=require("./GraphContainer-B1EDxJ0S.cjs");function qt(d){const{data:e,xDomain:f,mapData:w,xColorLegendTitle:Pe,yDomain:ee,yColorLegendTitle:te,width:k,height:b,colors:E,scale:Ie,centerPoint:R,mapBorderWidth:$,mapNoDataColor:A,mapBorderColor:ge,tooltip:oe,onSeriesMouseOver:ye,zoomScaleExtend:fe,zoomTranslateExtend:ve,highlightedIds:U,onSeriesMouseClick:re,mapProperty:X,resetSelectionOnDoubleClick:Le,detailsOnClick:C,showColorScale:je,styles:ze,classNames:B,mapProjection:T,zoomInteraction:M,animate:S,dimmedOpacity:O,customLayers:ne,collapseColorScaleByDefault:be}=d,[We,Ee]=p.useState(be===void 0?!(k<680):!be),[Y,ke]=p.useState(void 0),[ie,ae]=p.useState(void 0),[_,se]=p.useState(void 0),[le,h]=p.useState(void 0),[g,J]=p.useState(void 0),V=p.useRef(null),ce=$t.useInView(V,{once:S.once,amount:S.amount}),we=p.useRef(null),G=p.useRef(null);p.useEffect(()=>{const t=st.select(we.current),a=st.select(V.current),v=r=>{if(M==="noZoom")return!1;if(M==="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?M==="scroll"?!0:r.ctrlKey:i&&!r.button&&!r.ctrlKey},s=Q.zoom().scaleExtent(fe).translateExtent(ve||[[-20,-20],[k+20,b+20]]).filter(v).on("zoom",({transform:r})=>{t.attr("transform",r)});a.call(s),G.current=s},[b,k,M]);const q=Q.index_default(w),P=Ct.index_default(w),D=q[2]-q[0],I=q[3]-q[1],de=k*190/960*360/D,Ce=b*190/678*180/I,L=Ie*Math.min(de,Ce),N=T==="mercator"?Q.geoMercator().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):T==="equalEarth"?Q.geoEqualEarth().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):T==="naturalEarth"?Q.geoNaturalEarth1().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):T==="orthographic"?Q.geoOrthographic().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):Q.geoAlbersUsa().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L),Re=Array.from({length:f.length},(t,a)=>a),Se=Array.from({length:ee.length},(t,a)=>a),$e=gt.threshold().domain(f).range(Re),De=gt.threshold().domain(ee).range(Se),K=t=>{if(!V.current||!G.current)return;st.select(V.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(qe.motion.svg,{viewBox:`0 0 ${k} ${b}`,width:`${k}px`,height:`${b}px`,ref:V,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:we,children:[ne.filter(t=>t.position==="before").map(t=>t.layer),w.features.map((t,a)=>e.findIndex(s=>s.id===t.properties[X])!==-1?null:o.jsxRuntimeExports.jsx(qe.motion.g,{opacity:Y?O:U.length!==0?U.indexOf(t.properties[X])!==-1?1:O: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=N([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:ge,strokeWidth:$,fill:A}},r)}):t.geometry.coordinates.map((s,r)=>{let n="M";return s.forEach((l,i)=>{const y=N([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:ge,strokeWidth:$,fill:A}},r)})},a)),o.jsxRuntimeExports.jsx(Dt.AnimatePresence,{children:e.map(t=>{const a=w.features.findIndex(n=>t.id===n.properties[X]),v=xt.checkIfNullOrUndefined(t.x)?void 0:$e(t.x),s=xt.checkIfNullOrUndefined(t.y)?void 0:De(t.y),r=v!==void 0&&s!==void 0?E[s][v]:A;return o.jsxRuntimeExports.jsx(qe.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:Y?Y===r?1:O:U.length!==0?U.indexOf(t.id)!==-1?1:O:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},onMouseEnter:n=>{se(t),J(n.clientY),h(n.clientX),ye?.(t)},onClick:()=>{(re||C)&&(wt.isEqual(ie,t)&&Le?(ae(void 0),re?.(void 0)):(ae(t),re?.(t)))},onMouseMove:n=>{se(t),J(n.clientY),h(n.clientX)},onMouseLeave:()=>{se(void 0),h(void 0),J(void 0),ye?.(void 0)},children:a===-1?null:w.features[a].geometry.type==="MultiPolygon"?w.features[a].geometry.coordinates.map((n,l)=>{let i="";return n.forEach(y=>{let j=" M";y.forEach((m,Ne)=>{const H=N([m[0],m[1]]);Ne!==y.length-1?j=`${j}${H[0]} ${H[1]}L`:j=`${j}${H[0]} ${H[1]}`}),i+=j}),o.jsxRuntimeExports.jsx(qe.motion.path,{variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},d:i,className:`${r===A?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:$}},`${t.id}-${l}`)}):w.features[a].geometry.coordinates.map((n,l)=>{let i="M";return n.forEach((y,j)=>{const m=N([y[0],y[1]]);j!==n.length-1?i=`${i}${m[0]} ${m[1]}L`:i=`${i}${m[0]} ${m[1]}`}),o.jsxRuntimeExports.jsx(qe.motion.path,{d:i,variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},className:`${r===A?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:$}},`${t.id}-${l}`)})},t.id)})}),_?w.features.filter(t=>t.properties[X]===_.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=N([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=N([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,ne.filter(t=>t.position==="after").map(t=>t.layer)]})}),je===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",B?.colorLegend),children:We?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:()=>{Ee(!1)},children:o.jsxRuntimeExports.jsx(ct.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:[E.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:Y===v?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{ke(v)},onMouseLeave:()=>{ke(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:ht.numberFormattingFunction(t,"NA")},a))}),ee.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:ht.numberFormattingFunction(t,"NA")})},a))]})}),o.jsxRuntimeExports.jsx(pt.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:te})]}),o.jsxRuntimeExports.jsx(pt.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:()=>{Ee(!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"})})}),M==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>K("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:()=>K("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:"–"})]})]}),_&&oe&&le&&g?o.jsxRuntimeExports.jsx(Rt.Tooltip,{data:_,body:oe,xPos:le,yPos:g,backgroundStyle:ze?.tooltip,className:B?.tooltip}):null,C&&ie!==void 0?o.jsxRuntimeExports.jsx(St.DetailsModal,{body:C,data:ie,setData:ae,className:B?.modal}):null]})}function Pt(d){const e=o.compilerRuntimeExports.c(116),{data:f,graphTitle:w,mapData:Pe,colors:ee,sources:te,graphDescription:k,height:b,width:E,footNote:Ie,xDomain:R,yDomain:$,xColorLegendTitle:A,yColorLegendTitle:ge,tooltip:oe,scale:ye,centerPoint:fe,padding:ve,mapBorderWidth:U,mapNoDataColor:re,backgroundColor:X,mapBorderColor:Le,relativeHeight:C,onSeriesMouseOver:je,isWorldMap:ze,zoomScaleExtend:B,zoomTranslateExtend:T,graphID:M,showColorScale:S,highlightedIds:O,onSeriesMouseClick:ne,mapProperty:be,graphDownload:We,dataDownload:Ee,showAntarctica:Y,language:ke,minHeight:ie,theme:ae,ariaLabel:_,resetSelectionOnDoubleClick:se,detailsOnClick:le,styles:h,classNames:g,mapProjection:J,zoomInteraction:V,animate:ce,dimmedOpacity:we,customLayers:G,timeline:q,collapseColorScaleByDefault:P}=d,D=Pe===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":Pe,I=ee===void 0?lt.Colors.light.bivariateColors.colors05x05:ee,de=Ie===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.":Ie,Ce=A===void 0?"X Color key":A,L=ge===void 0?"Y Color key":ge,N=ye===void 0?.95:ye,Re=U===void 0?.5:U,Se=re===void 0?lt.Colors.light.graphNoData:re,$e=X===void 0?!1:X,De=Le===void 0?lt.Colors.light.grays["gray-500"]:Le,K=ze===void 0?!0:ze;let t;e[0]!==B?(t=B===void 0?[.8,6]:B,e[0]=B,e[1]=t):t=e[1];const a=t,v=S===void 0?!0:S;let s;e[2]!==O?(s=O===void 0?[]:O,e[2]=O,e[3]=s):s=e[3];const r=s,n=be===void 0?"ISO3":be,l=We===void 0?!1:We,i=Ee===void 0?!1:Ee,y=Y===void 0?!1:Y,j=ke===void 0?"en":ke,m=ie===void 0?0:ie,Ne=ae===void 0?"light":ae,H=se===void 0?!0:se,Qe=V===void 0?"button":V,Fe=ce===void 0?!1:ce,et=we===void 0?.3:we;let Ae;e[4]!==G?(Ae=G===void 0?[]:G,e[4]=G,e[5]=Ae):Ae=e[5];const tt=Ae;let Be;e[6]!==q?(Be=q===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:q,e[6]=q,e[7]=Be):Be=e[7];const c=Be,[Z,vt]=p.useState(0),[Me,jt]=p.useState(0),[z,bt]=p.useState(c.autoplay);let Oe;if(e[8]!==f||e[9]!==c.dateFormat){let x;e[11]!==c.dateFormat?(x=F=>ut.parse(`${F.date}`,c.dateFormat||"yyyy",new Date).getTime(),e[11]=c.dateFormat,e[12]=x):x=e[12],Oe=[...new Set(f.filter(Vt).map(x))],Oe.sort(_t),e[8]=f,e[9]=c.dateFormat,e[10]=Oe}else Oe=e[10];const u=Oe,[W,ot]=p.useState(c.autoplay?0:u.length-1),[me,Et]=p.useState(void 0),rt=p.useRef(null),dt=p.useRef(null);let Te,_e;e[13]===Symbol.for("react.memo_cache_sentinel")?(Te=()=>{const x=new ResizeObserver(F=>{vt(F[0].target.clientWidth||620),jt(F[0].target.clientHeight||480)});return rt.current&&x.observe(rt.current),()=>x.disconnect()},_e=[],e[13]=Te,e[14]=_e):(Te=e[13],_e=e[14]),p.useEffect(Te,_e);let Ve;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ve=x=>{Et(x)},e[15]=Ve):Ve=e[15];const Ge=p.useEffectEvent(Ve);let He;e[16]!==D||e[17]!==Ge?(He=()=>{typeof D=="string"?Ot.fetchAndParseJSON(D).then(F=>{Ge(F)}):Ge(D)},e[16]=D,e[17]=Ge,e[18]=He):He=e[18];let Ue;e[19]!==D?(Ue=[D],e[19]=D,e[20]=Ue):Ue=e[20],p.useEffect(He,Ue);let Xe,Ye;e[21]!==z||e[22]!==c.speed||e[23]!==u?(Xe=()=>{const x=setInterval(()=>{ot(F=>F<u.length-1?F+1:0)},(c.speed||2)*1e3);return z||clearInterval(x),()=>clearInterval(x)},Ye=[u,z,c.speed],e[21]=z,e[22]=c.speed,e[23]=u,e[24]=Xe,e[25]=Ye):(Xe=e[24],Ye=e[25]),p.useEffect(Xe,Ye);const nt=c.dateFormat||"yyyy";let Je;e[26]!==W||e[27]!==nt||e[28]!==c.showOnlyActiveDate||e[29]!==u?(Je=mt.getSliderMarks(u,W,c.showOnlyActiveDate,nt),e[26]=W,e[27]=nt,e[28]=c.showOnlyActiveDate,e[29]=u,e[30]=Je):Je=e[30];const Ke=Je;if(R&&$&&(R.length!==I[0].length-1||$.length!==I.length-1))return console.error("the xDomain and yDomain array length don't match to the color array length"),null;const it=g?.graphContainer,at=h?.graphContainer;let ue;e[31]!==g?.description||e[32]!==g?.title||e[33]!==f||e[34]!==i||e[35]!==k||e[36]!==l||e[37]!==w||e[38]!==h?.description||e[39]!==h?.title||e[40]!==E?(ue=w||k||l||i?o.jsxRuntimeExports.jsx(Nt.GraphHeader,{styles:{title:h?.title,description:h?.description},classNames:{title:g?.title,description:g?.description},graphTitle:w,graphDescription:k,width:E,graphDownload:l?dt:void 0,dataDownload:i?f.map(Tt).filter(Bt).length>0?f.map(At).filter(Ft):f.filter(Wt):null}):null,e[31]=g?.description,e[32]=g?.title,e[33]=f,e[34]=i,e[35]=k,e[36]=l,e[37]=w,e[38]=h?.description,e[39]=h?.title,e[40]=E,e[41]=ue):ue=e[41];let pe;e[42]!==W||e[43]!==Ke||e[44]!==z||e[45]!==c.enabled||e[46]!==u?(pe=c.enabled&&u.length>0&&Ke?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{bt(!z)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":z?"Click to pause animation":"Click to play animation",children:z?o.jsxRuntimeExports.jsx(ct.Pause,{}):o.jsxRuntimeExports.jsx(ct.Play,{})}),o.jsxRuntimeExports.jsx(mt.Nr,{min:u[0],max:u[u.length-1],marks:Ke,step:null,defaultValue:u[u.length-1],value:u[W],onChangeComplete:x=>{ot(u.indexOf(x))},onChange:x=>{ot(u.indexOf(x))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[42]=W,e[43]=Ke,e[44]=z,e[45]=c.enabled,e[46]=u,e[47]=pe):pe=e[47];let he;e[48]!==Fe||e[49]!==fe||e[50]!==g||e[51]!==P||e[52]!==I||e[53]!==tt||e[54]!==f||e[55]!==le||e[56]!==et||e[57]!==b||e[58]!==r||e[59]!==W||e[60]!==K||e[61]!==De||e[62]!==Re||e[63]!==Se||e[64]!==J||e[65]!==n||e[66]!==me||e[67]!==m||e[68]!==ne||e[69]!==je||e[70]!==C||e[71]!==H||e[72]!==N||e[73]!==y||e[74]!==v||e[75]!==h||e[76]!==Me||e[77]!==Z||e[78]!==c.dateFormat||e[79]!==c.enabled||e[80]!==oe||e[81]!==u||e[82]!==E||e[83]!==Ce||e[84]!==R||e[85]!==L||e[86]!==$||e[87]!==Qe||e[88]!==a||e[89]!==T?(he=o.jsxRuntimeExports.jsx(ft.GraphArea,{ref:rt,children:Z&&Me&&me?o.jsxRuntimeExports.jsx(qt,{data:f.filter(x=>c.enabled?x.date===ut.format(new Date(u[W]),c.dateFormat||"yyyy"):x),mapData:y?me:{...me,features:me.features.filter(zt)},xDomain:R||yt.getJenks(f.map(Lt),I[0].length),yDomain:$||yt.getJenks(f.map(It),I.length),width:Z,height:Me,scale:N,centerPoint:fe,colors:I,xColorLegendTitle:Ce,yColorLegendTitle:L,mapBorderWidth:Re,mapNoDataColor:Se,mapBorderColor:De,tooltip:oe,onSeriesMouseOver:je,isWorldMap:K,zoomScaleExtend:a,zoomTranslateExtend:T,onSeriesMouseClick:ne,mapProperty:n,highlightedIds:r,resetSelectionOnDoubleClick:H,styles:h,showColorScale:v,classNames:g,mapProjection:J||(K?"naturalEarth":"mercator"),detailsOnClick:le,zoomInteraction:Qe,animate:Fe===!0?{duration:.5,once:!0,amount:.5}:Fe||{duration:0,once:!0,amount:0},dimmedOpacity:et,customLayers:tt,collapseColorScaleByDefault:P}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(m,b||(C?m?(E||Z)*C>m?(E||Z)*C:m:(E||Z)*C:Me))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(kt.w,{"aria-label":"Loading graph"})})}),e[48]=Fe,e[49]=fe,e[50]=g,e[51]=P,e[52]=I,e[53]=tt,e[54]=f,e[55]=le,e[56]=et,e[57]=b,e[58]=r,e[59]=W,e[60]=K,e[61]=De,e[62]=Re,e[63]=Se,e[64]=J,e[65]=n,e[66]=me,e[67]=m,e[68]=ne,e[69]=je,e[70]=C,e[71]=H,e[72]=N,e[73]=y,e[74]=v,e[75]=h,e[76]=Me,e[77]=Z,e[78]=c.dateFormat,e[79]=c.enabled,e[80]=oe,e[81]=u,e[82]=E,e[83]=Ce,e[84]=R,e[85]=L,e[86]=$,e[87]=Qe,e[88]=a,e[89]=T,e[90]=he):he=e[90];let xe;e[91]!==g?.footnote||e[92]!==g?.source||e[93]!==de||e[94]!==te||e[95]!==h?.footnote||e[96]!==h?.source||e[97]!==E?(xe=te||de?o.jsxRuntimeExports.jsx(Mt.GraphFooter,{styles:{footnote:h?.footnote,source:h?.source},classNames:{footnote:g?.footnote,source:g?.source},sources:te,footNote:de,width:E}):null,e[91]=g?.footnote,e[92]=g?.source,e[93]=de,e[94]=te,e[95]=h?.footnote,e[96]=h?.source,e[97]=E,e[98]=xe):xe=e[98];let Ze;return e[99]!==_||e[100]!==$e||e[101]!==M||e[102]!==b||e[103]!==j||e[104]!==m||e[105]!==ve||e[106]!==C||e[107]!==it||e[108]!==at||e[109]!==ue||e[110]!==pe||e[111]!==he||e[112]!==xe||e[113]!==Ne||e[114]!==E?(Ze=o.jsxRuntimeExports.jsxs(ft.GraphContainer,{className:it,style:at,id:M,ref:dt,"aria-label":_,backgroundColor:$e,theme:Ne,language:j,minHeight:m,width:E,height:b,relativeHeight:C,padding:ve,children:[ue,pe,he,xe]}),e[99]=_,e[100]=$e,e[101]=M,e[102]=b,e[103]=j,e[104]=m,e[105]=ve,e[106]=C,e[107]=it,e[108]=at,e[109]=ue,e[110]=pe,e[111]=he,e[112]=xe,e[113]=Ne,e[114]=E,e[115]=Ze):Ze=e[115],Ze}function It(d){return d.y}function Lt(d){return d.x}function zt(d){return d.properties.NAME!=="Antarctica"}function Wt(d){return d!==void 0}function Ft(d){return d!==void 0}function At(d){return d.data}function Bt(d){return d!==void 0}function Tt(d){return d.data}function _t(d,e){return d-e}function Vt(d){return d.date}exports.BiVariateChoroplethMap=Pt;
|
|
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;
|
|
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}\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 } = 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centerOfMass(mapData as any);\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 /** 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 } = 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 />\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","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","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","xRange","Array","from","length","_","i","yRange","xScale","scaleThreshold","domain","range","yScale","handleZoom","direction","scaleBy","jsxs","Fragment","jsx","motion","d","position","map","layer","features","findIndex","el","id","properties","indexOf","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","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t27","t28","t29","t30","enabled","autoplay","showOnlyActiveDate","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t31","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","t32","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t33","shape","onUpdateShape","useEffectEvent","t34","fetchAndParseJSON","then","d_1","t35","t36","t37","speed","interval","setInterval","clearInterval","t38","t39","getSliderMarks","markObj","console","error","t40","graphContainer","t41","t42","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t43","Pause","Play","SliderUI","nextValue","nextValue_0","t44","GraphArea","d_7","format","_temp8","getJenks","_temp9","_temp0","Spinner","t45","footnote","source","GraphFooter","t46","GraphContainer","d_9","d_8","NAME","d_4","d_3","d_2","d_6","d_5","a","b"],"mappings":"ygCA6EO,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,EAAAA,EACEhC,EACE,CAACiC,GAAYC,EAAa,EAAIC,WAClCH,KAAgCI,OAAY,EAAE7B,EAAQ,KAAO,CAACyB,EAChE,EACM,CAACK,EAAeC,EAAgB,EAAIH,EAAAA,SAA6BC,MAAS,EAE1E,CAACG,GAAgBC,EAAiB,EAAIL,EAAAA,SAAcC,MAAS,EAE7D,CAACK,EAAeC,EAAgB,EAAIP,EAAAA,SAAcC,MAAS,EAC3D,CAACO,GAAQC,CAAS,EAAIT,EAAAA,SAA6BC,MAAS,EAC5D,CAACS,EAAQC,CAAS,EAAIX,EAAAA,SAA6BC,MAAS,EAC5DW,EAASC,EAAAA,OAAsB,IAAI,EACnCC,GAAWC,GAAAA,UAAUH,EAAQ,CACjCI,KAAMtB,EAAQsB,KACdC,OAAQvB,EAAQuB,MAAAA,CACjB,EACKC,GAAOL,EAAAA,OAAoB,IAAI,EAC/B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AAiC,EAAA,CAAA,OA0JuBlN,EAACtH,IAAK,CA1J7B,SAAAyP,GAAAgF,EAAAC,EAAA,CAAA,OAgEkBD,EAAIC,CAAC,CAhEvB,SAAAnF,GAAAjI,EAAA,CAAA,OA4DgBA,EAAC6H,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, 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,EAAIL,EAAAA,SAAcC,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,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"}
|
|
@@ -115,6 +115,8 @@ declare interface Props {
|
|
|
115
115
|
isWorldMap?: boolean;
|
|
116
116
|
/** Map projection type */
|
|
117
117
|
mapProjection?: MapProjectionTypes;
|
|
118
|
+
/** Toggle if the map is centered and zoomed to the highlighted ids. */
|
|
119
|
+
zoomAndCenterByHighlightedIds?: boolean;
|
|
118
120
|
/** Extend of the allowed zoom in the map */
|
|
119
121
|
zoomScaleExtend?: [number, number];
|
|
120
122
|
/** Extend of the allowed panning in the map */
|