@undp/data-viz 2.5.1 → 2.5.3

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.
Files changed (43) hide show
  1. package/dist/BiVariateChoroplethMap.cjs +1 -1
  2. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  3. package/dist/BiVariateChoroplethMap.js +297 -289
  4. package/dist/BiVariateChoroplethMap.js.map +1 -1
  5. package/dist/ChoroplethMap.cjs +1 -1
  6. package/dist/ChoroplethMap.cjs.map +1 -1
  7. package/dist/ChoroplethMap.js +307 -299
  8. package/dist/ChoroplethMap.js.map +1 -1
  9. package/dist/CopyTextButton.cjs +1 -1
  10. package/dist/CopyTextButton.cjs.map +1 -1
  11. package/dist/CopyTextButton.js +281 -279
  12. package/dist/CopyTextButton.js.map +1 -1
  13. package/dist/CsvDownloadButton.cjs +4 -4
  14. package/dist/CsvDownloadButton.cjs.map +1 -1
  15. package/dist/CsvDownloadButton.js +268 -266
  16. package/dist/CsvDownloadButton.js.map +1 -1
  17. package/dist/DotDensityMap.cjs +1 -1
  18. package/dist/DotDensityMap.cjs.map +1 -1
  19. package/dist/DotDensityMap.js +277 -269
  20. package/dist/DotDensityMap.js.map +1 -1
  21. package/dist/ExcelDownloadButton.cjs +1 -1
  22. package/dist/ExcelDownloadButton.cjs.map +1 -1
  23. package/dist/ExcelDownloadButton.js +21 -19
  24. package/dist/ExcelDownloadButton.js.map +1 -1
  25. package/dist/HybridMap.cjs +1 -1
  26. package/dist/HybridMap.cjs.map +1 -1
  27. package/dist/HybridMap.js +299 -291
  28. package/dist/HybridMap.js.map +1 -1
  29. package/dist/ImageDownloadButton.cjs +1 -1
  30. package/dist/ImageDownloadButton.cjs.map +1 -1
  31. package/dist/ImageDownloadButton.js +19 -17
  32. package/dist/ImageDownloadButton.js.map +1 -1
  33. package/dist/SVGDownloadButton.cjs +1 -1
  34. package/dist/SVGDownloadButton.cjs.map +1 -1
  35. package/dist/SVGDownloadButton.js +20 -18
  36. package/dist/SVGDownloadButton.js.map +1 -1
  37. package/dist/ScatterPlot.cjs +1 -1
  38. package/dist/ScatterPlot.cjs.map +1 -1
  39. package/dist/ScatterPlot.d.ts +1 -1
  40. package/dist/ScatterPlot.js +107 -107
  41. package/dist/ScatterPlot.js.map +1 -1
  42. package/dist/index.d.ts +1 -1
  43. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-D4pAp7u0.cjs"),n=require("react"),wt=require("./getSliderMarks-BzrpHrHS.cjs"),Ft=require("./Spinner-WHzzloYQ.cjs"),Rt=require("./parse-xYI9yrvL.cjs"),Lt=require("./index-DQA8q5sC.cjs"),R=require("./index-DLFt97gy.cjs"),$t=require("./index-C5K--w8d.cjs"),St=require("./Typography-BqmyF1gP.cjs"),Nt=require("./numberFormattingFunction-u2iNHL_c.cjs"),Tt=require("./Tooltip-C9F3uYG0.cjs"),Mt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),dt=require("./index-BhI7mBJx.cjs"),Gt=require("./DetailsModal-Du8Fr1QD.cjs"),Ht=require("./ImageDownloadButton.cjs"),Dt=require("./select-Bnfk0lJx.cjs"),Ot=require("./threshold-DNsSUf8Q.cjs"),ct=require("./proxy-CqH8m8IQ.cjs"),Vt=require("./use-in-view-dnRv_qqF.cjs"),Ut=require("./index-FXfr51ZM.cjs"),Xt=require("./GraphHeader.cjs"),Yt=require("./GraphFooter.cjs"),Ct=require("./Colors.cjs"),Bt=require("./fetchAndParseData-QTF6tjij.cjs"),It=require("./getJenks-BzJvhy_H.cjs"),qt=require("./GraphContainer-Cul9b74X.cjs");function Jt(l){const{data:e,xDomain:p,mapData:A,xColorLegendTitle:Ae,yDomain:oe,yColorLegendTitle:re,width:f,height:m,colors:h,scale:Fe,centerPoint:E,mapBorderWidth:S,mapNoDataColor:ae,mapBorderColor:ne,tooltip:ie,onSeriesMouseOver:je,zoomScaleExtend:be,zoomTranslateExtend:Ee,highlightedIds:y,onSeriesMouseClick:se,mapProperty:N,resetSelectionOnDoubleClick:Le,detailsOnClick:v,showColorScale:De,styles:$e,classNames:F,mapProjection:L,zoomInteraction:M,animate:O,dimmedOpacity:B,customLayers:le,collapseColorScaleByDefault:Ce,zoomAndCenterByHighlightedIds:ke,projectionRotate:$,rewindCoordinatesInMapData:X,overlayMapData:Y,overlayMapBorderColor:Te,overlayMapBorderWidth:Ge,xNumberDisplayOptions:J,yNumberDisplayOptions:ce,graphDownload:de}=l,a=n.useMemo(()=>X?R.index_default(A,{reverse:!0}):A,[A,X]),u=n.useMemo(()=>!X||!Y?Y:R.index_default(Y,{reverse:!0}),[Y,X]),[He,we]=n.useState(Ce===void 0?!(f<680):!Ce),[Z,Re]=n.useState(void 0),[T,G]=n.useState(void 0),[H,pe]=n.useState(void 0),[K,ue]=n.useState(void 0),[g,Q]=n.useState(void 0),I=n.useRef(null),D=Vt.useInView(I,{once:O.once,amount:O.amount}),k=n.useRef(null),V=n.useRef(null);n.useEffect(()=>{const t=Dt.select(k.current),r=Dt.select(I.current),i=x=>{if(M==="noZoom")return!1;if(M==="button")return!x.type.includes("wheel");const w=x.type==="wheel",j=x.type.startsWith("touch"),he=x.type==="mousedown"||x.type==="mousemove";return j?!0:w?M==="scroll"?!0:x.ctrlKey:he&&!x.button&&!x.ctrlKey},b=R.zoom().scaleExtent(be).translateExtent(Ee||[[-20,-20],[f+20,m+20]]).filter(i).on("zoom",({transform:x})=>{t.attr("transform",x)});r.call(b),V.current=b},[m,f,M]);const U=R.index_default$1({...a,features:ke?a.features.filter(t=>(y||[]).length===0||y?.indexOf(t.properties[N])!==-1):a.features}),q=$t.index_default({...a,features:ke?a.features.filter(t=>(y||[]).length===0||y?.indexOf(t.properties[N])!==-1):a.features}),Se=(U[2]-U[0])*1.15,Ne=(U[3]-U[1])*1.15,Me=f*190/960*360/Se,Oe=m*190/678*180/Ne,z=Fe*Math.min(Me,Oe),me=L==="mercator"?R.geoMercator().rotate($).center(E||q.geometry.coordinates).translate([f/2,m/2]).scale(z):L==="equalEarth"?R.geoEqualEarth().rotate($).center(E||q.geometry.coordinates).translate([f/2,m/2]).scale(z):L==="naturalEarth"?R.geoNaturalEarth1().rotate($).center(E||q.geometry.coordinates).translate([f/2,m/2]).scale(z):L==="orthographic"?R.geoOrthographic().rotate($).center(E||q.geometry.coordinates).translate([f/2,m/2]).scale(z):R.geoAlbersUsa().rotate($).center(E||q.geometry.coordinates).translate([f/2,m/2]).scale(z),_=R.geoPath().projection(me),Be=Array.from({length:p.length},(t,r)=>r),Ie=Array.from({length:oe.length},(t,r)=>r),qe=Ot.threshold().domain(p).range(Be),ze=Ot.threshold().domain(oe).range(Ie),ee=t=>{if(!I.current||!V.current)return;Dt.select(I.current).call(V.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(ct.motion.svg,{viewBox:`0 0 ${f} ${m}`,width:`${f}px`,height:`${m}px`,ref:I,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:k,children:[le.filter(t=>t.position==="before").map(t=>t.layer),a.features.map((t,r)=>{if(!t.properties?.[N])return null;const i=_(t);return i?o.jsxRuntimeExports.jsx(ct.motion.g,{opacity:Z?B:y?y.indexOf(t.properties[N])!==-1?1:B:1,children:o.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:ne,strokeWidth:S,fill:ae,vectorEffect:"non-scaling-stroke"}})},r):null}),o.jsxRuntimeExports.jsx(Ut.AnimatePresence,{children:e.map(t=>{const r=a.features.findIndex(j=>t.id===j.properties[N]);if(r===-1)return null;const i=_(a.features[r]);if(!i)return null;const b=Mt.checkIfNullOrUndefined(t.x)?void 0:qe(t.x),x=Mt.checkIfNullOrUndefined(t.y)?void 0:ze(t.y),w=b!==void 0&&x!==void 0?h[x][b]:ae;return o.jsxRuntimeExports.jsx(ct.motion.g,{className:"undp-map-shapes",variants:{initial:{opacity:0},whileInView:{opacity:Z?Z===w&&(!y||y.indexOf(t.id)!==-1)?1:B:y?y.indexOf(t.id)!==-1?1:B:1,transition:{duration:O.duration}}},initial:"initial",animate:D?"whileInView":"initial",exit:{opacity:0,transition:{duration:O.duration}},onMouseEnter:j=>{pe(t),Q(j.clientY),ue(j.clientX),je?.(t)},onClick:()=>{(se||v)&&(Lt.isEqual(T,t)&&Le?(G(void 0),se?.(void 0)):(G(t),se?.(t)))},onMouseMove:j=>{pe(t),Q(j.clientY),ue(j.clientX)},onMouseLeave:()=>{pe(void 0),ue(void 0),Q(void 0),je?.(void 0)},children:o.jsxRuntimeExports.jsx(ct.motion.path,{d:i,variants:{initial:{fill:w,opacity:0},whileInView:{fill:w,opacity:1,transition:{duration:O.duration}}},initial:"initial",animate:D?"whileInView":"initial",exit:{opacity:0,transition:{duration:O.duration}},className:`${w===ae?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{stroke:ne,strokeWidth:S,vectorEffect:"non-scaling-stroke"}},`${t.id}`)},t.id)})}),H?a.features.filter(t=>t.properties[N]===H.id).map((t,r)=>o.jsxRuntimeExports.jsx("path",{d:_(t)||"",className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5",vectorEffect:"non-scaling-stroke"}},r)):null,u?.features.map((t,r)=>{const i=_(t);return i?o.jsxRuntimeExports.jsx("g",{children:o.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:Te||ne,strokeWidth:Ge||S+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},r):null}),le.filter(t=>t.position==="after").map(t=>t.layer)]})}),De===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",F?.colorLegend),children:He?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{we(!1)},children:o.jsxRuntimeExports.jsx(dt.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]",style:{width:"175px"},children:[o.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[o.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:o.jsxRuntimeExports.jsxs("g",{children:[h.map((t,r)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-r*25})`,children:t.map((i,b)=>o.jsxRuntimeExports.jsx("rect",{y:1,x:b*25+1,fill:i,width:23,height:23,strokeWidth:Z===i?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{Re(i)},onMouseLeave:()=>{Re(void 0)}},b))},r)),o.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:p.map((t,r)=>o.jsxRuntimeExports.jsx("text",{y:10,x:(r+1)*25,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:Nt.numberFormattingFunction(t,void 0,J?.precision??2,void 0,void 0,J?.locale||"en",J?.padZeros||!1)},r))}),oe.map((t,r)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(p.length+1,5),4)*25+10},${100-r*25})`,children:o.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:Nt.numberFormattingFunction(t,void 0,ce?.precision??2,void 0,void 0,ce?.locale||"en",ce?.padZeros||!1)})},r))]})}),o.jsxRuntimeExports.jsx(St._,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:re})]}),o.jsxRuntimeExports.jsx(St._,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:Ae})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{we(!0)},children:o.jsxRuntimeExports.jsx(dt.ExpandIcon,{})})}),M==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col undp-viz-zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>ee("in"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>ee("out"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]}),de&&o.jsxRuntimeExports.jsx("div",{className:"absolute right-4 top-4 flex flex-col image-download-button",children:o.jsxRuntimeExports.jsx(Ht.ImageDownloadButton,{nodeID:de,buttonSmall:!0})})]}),H&&ie&&K&&g?o.jsxRuntimeExports.jsx(Tt.Tooltip,{data:H,body:ie,xPos:K,yPos:g,backgroundStyle:$e?.tooltip,className:F?.tooltip}):null,v&&T!==void 0?o.jsxRuntimeExports.jsx(Gt.DetailsModal,{body:v,data:T,setData:G,className:F?.modal}):null]})}function Zt(l){const e=o.compilerRuntimeExports.c(130),{data:p,graphTitle:A,mapData:Ae,colors:oe,sources:re,graphDescription:f,height:m,width:h,footNote:Fe,xDomain:E,yDomain:S,xColorLegendTitle:ae,yColorLegendTitle:ne,tooltip:ie,scale:je,centerPoint:be,padding:Ee,mapBorderWidth:y,mapNoDataColor:se,backgroundColor:N,mapBorderColor:Le,relativeHeight:v,onSeriesMouseOver:De,isWorldMap:$e,zoomScaleExtend:F,zoomTranslateExtend:L,graphID:M,showColorScale:O,highlightedIds:B,onSeriesMouseClick:le,mapProperty:Ce,graphDownload:ke,dataDownload:$,showAntarctica:X,language:Y,minHeight:Te,theme:Ge,ariaLabel:J,resetSelectionOnDoubleClick:ce,detailsOnClick:de,styles:a,classNames:u,mapProjection:He,zoomInteraction:we,animate:Z,dimmedOpacity:Re,customLayers:T,timeline:G,collapseColorScaleByDefault:H,zoomAndCenterByHighlightedIds:pe,projectionRotate:K,rewindCoordinatesInMapData:ue,mapOverlay:g,xNumberDisplayOptions:Q,yNumberDisplayOptions:I}=l,D=Ae===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":Ae,k=oe===void 0?Ct.Colors.light.bivariateColors.colors05x05:oe,V=Fe===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":Fe,U=ae===void 0?"X Color key":ae,q=ne===void 0?"Y Color key":ne,Se=je===void 0?.95:je,Ne=y===void 0?.5:y,Me=se===void 0?Ct.Colors.light.graphNoData:se,Oe=N===void 0?!1:N,z=Le===void 0?Ct.Colors.light.grays["gray-500"]:Le,me=$e===void 0?!0:$e;let _;e[0]!==F?(_=F===void 0?[.8,6]:F,e[0]=F,e[1]=_):_=e[1];const Be=_,Ie=O===void 0?!0:O,qe=Ce===void 0?"ISO3":Ce,ze=ke===void 0?!1:ke,ee=$===void 0?!1:$,t=X===void 0?!1:X,r=Y===void 0?"en":Y,i=Te===void 0?0:Te,b=Ge===void 0?"light":Ge,x=ce===void 0?!0:ce,w=He===void 0?"naturalEarth":He,j=we===void 0?"button":we,he=Z===void 0?!1:Z,pt=Re===void 0?.3:Re;let Ve;e[2]!==T?(Ve=T===void 0?[]:T,e[2]=T,e[3]=Ve):Ve=e[3];const ut=Ve;let Ue;e[4]!==G?(Ue=G===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:G,e[4]=G,e[5]=Ue):Ue=e[5];const s=Ue,mt=pe===void 0?!1:pe;let Xe;e[6]!==K?(Xe=K===void 0?[0,0]:K,e[6]=K,e[7]=Xe):Xe=e[7];const ht=Xe,xt=ue===void 0?!0:ue,[te,zt]=n.useState(0),[_e,_t]=n.useState(0),[P,Pt]=n.useState(s.autoplay);let Pe;if(e[8]!==p||e[9]!==s.dateFormat){let c;e[11]!==s.dateFormat?(c=C=>Rt.parse(`${C.date}`,s.dateFormat||"yyyy",new Date).getTime(),e[11]=s.dateFormat,e[12]=c):c=e[12],Pe=[...new Set(p.filter(so).map(c))],Pe.sort(io),e[8]=p,e[9]=s.dateFormat,e[10]=Pe}else Pe=e[10];const d=Pe,[W,ft]=n.useState(s.autoplay?0:d.length-1),[xe,Wt]=n.useState(void 0),[gt,At]=n.useState(void 0),yt=n.useRef(null),kt=n.useRef(null);let Ye,Je;e[13]===Symbol.for("react.memo_cache_sentinel")?(Ye=()=>{const c=new ResizeObserver(C=>{zt(C[0].target.clientWidth||620),_t(C[0].target.clientHeight||480)});return yt.current&&c.observe(yt.current),()=>c.disconnect()},Je=[],e[13]=Ye,e[14]=Je):(Ye=e[13],Je=e[14]),n.useEffect(Ye,Je);let Ze;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ze=c=>{Wt(c)},e[15]=Ze):Ze=e[15];const Ke=n.useEffectEvent(Ze);let Qe;e[16]===Symbol.for("react.memo_cache_sentinel")?(Qe=c=>{At(c)},e[16]=Qe):Qe=e[16];const We=n.useEffectEvent(Qe);let et;e[17]!==D||e[18]!==Ke?(et=()=>{typeof D=="string"?Bt.fetchAndParseJSON(D).then(C=>{Ke(C)}):Ke(D)},e[17]=D,e[18]=Ke,e[19]=et):et=e[19];let tt;e[20]!==D?(tt=[D],e[20]=D,e[21]=tt):tt=e[21],n.useEffect(et,tt);let ot;e[22]!==g?.mapData||e[23]!==We?(ot=()=>{g?.mapData||We(void 0),typeof g?.mapData=="string"?Bt.fetchAndParseJSON(g?.mapData).then(C=>{We(C)}):We(g?.mapData)},e[22]=g?.mapData,e[23]=We,e[24]=ot):ot=e[24];const vt=g?.mapData;let rt;e[25]!==vt?(rt=[vt],e[25]=vt,e[26]=rt):rt=e[26],n.useEffect(ot,rt);let at,nt;e[27]!==P||e[28]!==s.speed||e[29]!==d?(at=()=>{const c=setInterval(()=>{ft(C=>C<d.length-1?C+1:0)},(s.speed||2)*1e3);return P||clearInterval(c),()=>clearInterval(c)},nt=[d,P,s.speed],e[27]=P,e[28]=s.speed,e[29]=d,e[30]=at,e[31]=nt):(at=e[30],nt=e[31]),n.useEffect(at,nt);const jt=s.dateFormat||"yyyy";let it;e[32]!==W||e[33]!==jt||e[34]!==s.showOnlyActiveDate||e[35]!==d?(it=wt.getSliderMarks(d,W,s.showOnlyActiveDate,jt),e[32]=W,e[33]=jt,e[34]=s.showOnlyActiveDate,e[35]=d,e[36]=it):it=e[36];const st=it;if(E&&S&&(E.length!==k[0].length-1||S.length!==k.length-1))return console.error("the xDomain and yDomain array length don't match to the color array length"),null;const bt=u?.graphContainer,Et=a?.graphContainer;let fe;e[37]!==u?.description||e[38]!==u?.title||e[39]!==p||e[40]!==ee||e[41]!==f||e[42]!==A||e[43]!==a?.description||e[44]!==a?.title||e[45]!==h?(fe=A||f||ee?o.jsxRuntimeExports.jsx(Xt.GraphHeader,{styles:{title:a?.title,description:a?.description},classNames:{title:u?.title,description:u?.description},graphTitle:A,graphDescription:f,width:h,dataDownload:ee?p.map(no).filter(ao).length>0?p.map(ro).filter(oo):p.filter(to):null}):null,e[37]=u?.description,e[38]=u?.title,e[39]=p,e[40]=ee,e[41]=f,e[42]=A,e[43]=a?.description,e[44]=a?.title,e[45]=h,e[46]=fe):fe=e[46];let ge;e[47]!==W||e[48]!==st||e[49]!==P||e[50]!==s.enabled||e[51]!==d?(ge=s.enabled&&d.length>0&&st?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Pt(!P)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":P?"Click to pause animation":"Click to play animation",children:P?o.jsxRuntimeExports.jsx(dt.Pause,{}):o.jsxRuntimeExports.jsx(dt.Play,{})}),o.jsxRuntimeExports.jsx(wt.Nr,{min:d[0],max:d[d.length-1],marks:st,step:null,defaultValue:d[d.length-1],value:d[W],onChangeComplete:c=>{ft(d.indexOf(c))},onChange:c=>{ft(d.indexOf(c))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[47]=W,e[48]=st,e[49]=P,e[50]=s.enabled,e[51]=d,e[52]=ge):ge=e[52];let ye;e[53]!==he||e[54]!==be||e[55]!==u||e[56]!==H||e[57]!==k||e[58]!==ut||e[59]!==p||e[60]!==de||e[61]!==pt||e[62]!==ze||e[63]!==m||e[64]!==B||e[65]!==W||e[66]!==me||e[67]!==z||e[68]!==Ne||e[69]!==Me||e[70]!==g?.mapBorderColor||e[71]!==g?.mapBorderWidth||e[72]!==w||e[73]!==qe||e[74]!==xe||e[75]!==i||e[76]!==le||e[77]!==De||e[78]!==gt||e[79]!==ht||e[80]!==v||e[81]!==x||e[82]!==xt||e[83]!==Se||e[84]!==t||e[85]!==Ie||e[86]!==a||e[87]!==_e||e[88]!==te||e[89]!==s.dateFormat||e[90]!==s.enabled||e[91]!==ie||e[92]!==d||e[93]!==h||e[94]!==U||e[95]!==E||e[96]!==Q||e[97]!==q||e[98]!==S||e[99]!==I||e[100]!==mt||e[101]!==j||e[102]!==Be||e[103]!==L?(ye=o.jsxRuntimeExports.jsx(qt.GraphArea,{ref:yt,children:te&&_e&&xe?o.jsxRuntimeExports.jsx(Jt,{data:p.filter(c=>s.enabled?`${c.date}`===Rt.format(new Date(d[W]),s.dateFormat||"yyyy"):c),mapData:t?xe:{...xe,features:xe.features.filter(eo)},xDomain:E||It.getJenks(p.map(Qt),k[0].length),yDomain:S||It.getJenks(p.map(Kt),k.length),width:te,height:_e,scale:Se,centerPoint:be,colors:k,xColorLegendTitle:U,yColorLegendTitle:q,mapBorderWidth:Ne,mapNoDataColor:Me,mapBorderColor:z,tooltip:ie,onSeriesMouseOver:De,isWorldMap:me,zoomScaleExtend:Be,zoomTranslateExtend:L,onSeriesMouseClick:le,mapProperty:qe,highlightedIds:B,resetSelectionOnDoubleClick:x,styles:a,showColorScale:Ie,classNames:u,mapProjection:w||(me?"naturalEarth":"mercator"),detailsOnClick:de,zoomInteraction:j,overlayMapData:gt,overlayMapBorderColor:g?.mapBorderColor,overlayMapBorderWidth:g?.mapBorderWidth,animate:he===!0?{duration:.5,once:!0,amount:.5}:he||{duration:0,once:!0,amount:0},dimmedOpacity:pt,customLayers:ut,collapseColorScaleByDefault:H,zoomAndCenterByHighlightedIds:mt,projectionRotate:ht,rewindCoordinatesInMapData:xt,xNumberDisplayOptions:Q,yNumberDisplayOptions:I,graphDownload:ze?kt:void 0}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(i,m||(v?i?(h||te)*v>i?(h||te)*v:i:(h||te)*v:_e))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Ft.w,{"aria-label":"Loading graph"})})}),e[53]=he,e[54]=be,e[55]=u,e[56]=H,e[57]=k,e[58]=ut,e[59]=p,e[60]=de,e[61]=pt,e[62]=ze,e[63]=m,e[64]=B,e[65]=W,e[66]=me,e[67]=z,e[68]=Ne,e[69]=Me,e[70]=g?.mapBorderColor,e[71]=g?.mapBorderWidth,e[72]=w,e[73]=qe,e[74]=xe,e[75]=i,e[76]=le,e[77]=De,e[78]=gt,e[79]=ht,e[80]=v,e[81]=x,e[82]=xt,e[83]=Se,e[84]=t,e[85]=Ie,e[86]=a,e[87]=_e,e[88]=te,e[89]=s.dateFormat,e[90]=s.enabled,e[91]=ie,e[92]=d,e[93]=h,e[94]=U,e[95]=E,e[96]=Q,e[97]=q,e[98]=S,e[99]=I,e[100]=mt,e[101]=j,e[102]=Be,e[103]=L,e[104]=ye):ye=e[104];let ve;e[105]!==u?.footnote||e[106]!==u?.source||e[107]!==V||e[108]!==re||e[109]!==a?.footnote||e[110]!==a?.source||e[111]!==h?(ve=re||V?o.jsxRuntimeExports.jsx(Yt.GraphFooter,{styles:{footnote:a?.footnote,source:a?.source},classNames:{footnote:u?.footnote,source:u?.source},sources:re,footNote:V,width:h}):null,e[105]=u?.footnote,e[106]=u?.source,e[107]=V,e[108]=re,e[109]=a?.footnote,e[110]=a?.source,e[111]=h,e[112]=ve):ve=e[112];let lt;return e[113]!==J||e[114]!==Oe||e[115]!==M||e[116]!==m||e[117]!==r||e[118]!==i||e[119]!==Ee||e[120]!==v||e[121]!==bt||e[122]!==Et||e[123]!==fe||e[124]!==ge||e[125]!==ye||e[126]!==ve||e[127]!==b||e[128]!==h?(lt=o.jsxRuntimeExports.jsxs(qt.GraphContainer,{className:bt,style:Et,id:M,ref:kt,"aria-label":J,backgroundColor:Oe,theme:b,language:r,minHeight:i,width:h,height:m,relativeHeight:v,padding:Ee,children:[fe,ge,ye,ve]}),e[113]=J,e[114]=Oe,e[115]=M,e[116]=m,e[117]=r,e[118]=i,e[119]=Ee,e[120]=v,e[121]=bt,e[122]=Et,e[123]=fe,e[124]=ge,e[125]=ye,e[126]=ve,e[127]=b,e[128]=h,e[129]=lt):lt=e[129],lt}function Kt(l){return l.y}function Qt(l){return l.x}function eo(l){return l.properties?.NAME!=="Antarctica"}function to(l){return l!==void 0}function oo(l){return l!==void 0}function ro(l){return l.data}function ao(l){return l!==void 0}function no(l){return l.data}function io(l,e){return l-e}function so(l){return l.date}exports.BiVariateChoroplethMap=Zt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-D4pAp7u0.cjs"),n=require("react"),wt=require("./getSliderMarks-BzrpHrHS.cjs"),Ft=require("./Spinner-WHzzloYQ.cjs"),Rt=require("./parse-xYI9yrvL.cjs"),Lt=require("./index-DQA8q5sC.cjs"),S=require("./index-DLFt97gy.cjs"),$t=require("./index-C5K--w8d.cjs"),St=require("./Typography-BqmyF1gP.cjs"),Nt=require("./numberFormattingFunction-u2iNHL_c.cjs"),Tt=require("./Tooltip-C9F3uYG0.cjs"),Ot=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),pt=require("./index-BhI7mBJx.cjs"),Gt=require("./DetailsModal-Du8Fr1QD.cjs"),Ht=require("./ImageDownloadButton.cjs"),Vt=require("./CsvDownloadButton.cjs"),Dt=require("./select-Bnfk0lJx.cjs"),Mt=require("./threshold-DNsSUf8Q.cjs"),dt=require("./proxy-CqH8m8IQ.cjs"),Ut=require("./use-in-view-dnRv_qqF.cjs"),Xt=require("./index-FXfr51ZM.cjs"),Yt=require("./GraphHeader.cjs"),Jt=require("./GraphFooter.cjs"),Ct=require("./Colors.cjs"),Bt=require("./fetchAndParseData-QTF6tjij.cjs"),It=require("./getJenks-BzJvhy_H.cjs"),qt=require("./GraphContainer-Cul9b74X.cjs");function Zt(i){const{data:e,xDomain:f,mapData:P,xColorLegendTitle:Ae,yDomain:re,yColorLegendTitle:ae,width:g,height:u,colors:m,scale:Fe,centerPoint:D,mapBorderWidth:N,mapNoDataColor:ne,mapBorderColor:se,tooltip:ie,onSeriesMouseOver:ve,zoomScaleExtend:je,zoomTranslateExtend:be,highlightedIds:j,onSeriesMouseClick:le,mapProperty:O,resetSelectionOnDoubleClick:Le,detailsOnClick:b,showColorScale:Ee,styles:$e,classNames:W,mapProjection:A,zoomInteraction:M,animate:B,dimmedOpacity:I,customLayers:ce,collapseColorScaleByDefault:De,zoomAndCenterByHighlightedIds:Ce,projectionRotate:F,rewindCoordinatesInMapData:H,overlayMapData:V,overlayMapBorderColor:Te,overlayMapBorderWidth:Ge,xNumberDisplayOptions:U,yNumberDisplayOptions:de,graphDownload:X,dataDownload:c}=i,a=n.useMemo(()=>H?S.index_default(P,{reverse:!0}):P,[P,H]),He=n.useMemo(()=>!H||!V?V:S.index_default(V,{reverse:!0}),[V,H]),[Ve,ke]=n.useState(De===void 0?!(g<680):!De),[Y,J]=n.useState(void 0),[L,Z]=n.useState(void 0),[K,$]=n.useState(void 0),[we,x]=n.useState(void 0),[pe,Q]=n.useState(void 0),y=n.useRef(null),k=Ut.useInView(y,{once:B.once,amount:B.amount}),ee=n.useRef(null),te=n.useRef(null);n.useEffect(()=>{const t=Dt.select(ee.current),r=Dt.select(y.current),p=h=>{if(M==="noZoom")return!1;if(M==="button")return!h.type.includes("wheel");const R=h.type==="wheel",v=h.type.startsWith("touch"),ze=h.type==="mousedown"||h.type==="mousemove";return v?!0:R?M==="scroll"?!0:h.ctrlKey:ze&&!h.button&&!h.ctrlKey},E=S.zoom().scaleExtent(je).translateExtent(be||[[-20,-20],[g+20,u+20]]).filter(p).on("zoom",({transform:h})=>{t.attr("transform",h)});r.call(E),te.current=E},[u,g,M]);const T=S.index_default$1({...a,features:Ce?a.features.filter(t=>(j||[]).length===0||j?.indexOf(t.properties[O])!==-1):a.features}),q=$t.index_default({...a,features:Ce?a.features.filter(t=>(j||[]).length===0||j?.indexOf(t.properties[O])!==-1):a.features}),Re=(T[2]-T[0])*1.15,Se=(T[3]-T[1])*1.15,Ne=g*190/960*360/Re,Oe=u*190/678*180/Se,w=Fe*Math.min(Ne,Oe),ue=A==="mercator"?S.geoMercator().rotate(F).center(D||q.geometry.coordinates).translate([g/2,u/2]).scale(w):A==="equalEarth"?S.geoEqualEarth().rotate(F).center(D||q.geometry.coordinates).translate([g/2,u/2]).scale(w):A==="naturalEarth"?S.geoNaturalEarth1().rotate(F).center(D||q.geometry.coordinates).translate([g/2,u/2]).scale(w):A==="orthographic"?S.geoOrthographic().rotate(F).center(D||q.geometry.coordinates).translate([g/2,u/2]).scale(w):S.geoAlbersUsa().rotate(F).center(D||q.geometry.coordinates).translate([g/2,u/2]).scale(w),G=S.geoPath().projection(ue),Me=Array.from({length:f.length},(t,r)=>r),Be=Array.from({length:re.length},(t,r)=>r),Ie=Mt.threshold().domain(f).range(Me),qe=Mt.threshold().domain(re).range(Be),me=t=>{if(!y.current||!te.current)return;Dt.select(y.current).call(te.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(dt.motion.svg,{viewBox:`0 0 ${g} ${u}`,width:`${g}px`,height:`${u}px`,ref:y,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:ee,children:[ce.filter(t=>t.position==="before").map(t=>t.layer),a.features.map((t,r)=>{if(!t.properties?.[O])return null;const p=G(t);return p?o.jsxRuntimeExports.jsx(dt.motion.g,{opacity:Y?I:j?j.indexOf(t.properties[O])!==-1?1:I:1,children:o.jsxRuntimeExports.jsx("path",{d:p,style:{stroke:se,strokeWidth:N,fill:ne,vectorEffect:"non-scaling-stroke"}})},r):null}),o.jsxRuntimeExports.jsx(Xt.AnimatePresence,{children:e.map(t=>{const r=a.features.findIndex(v=>t.id===v.properties[O]);if(r===-1)return null;const p=G(a.features[r]);if(!p)return null;const E=Ot.checkIfNullOrUndefined(t.x)?void 0:Ie(t.x),h=Ot.checkIfNullOrUndefined(t.y)?void 0:qe(t.y),R=E!==void 0&&h!==void 0?m[h][E]:ne;return o.jsxRuntimeExports.jsx(dt.motion.g,{className:"undp-map-shapes",variants:{initial:{opacity:0},whileInView:{opacity:Y?Y===R&&(!j||j.indexOf(t.id)!==-1)?1:I:j?j.indexOf(t.id)!==-1?1:I:1,transition:{duration:B.duration}}},initial:"initial",animate:k?"whileInView":"initial",exit:{opacity:0,transition:{duration:B.duration}},onMouseEnter:v=>{$(t),Q(v.clientY),x(v.clientX),ve?.(t)},onClick:()=>{(le||b)&&(Lt.isEqual(L,t)&&Le?(Z(void 0),le?.(void 0)):(Z(t),le?.(t)))},onMouseMove:v=>{$(t),Q(v.clientY),x(v.clientX)},onMouseLeave:()=>{$(void 0),x(void 0),Q(void 0),ve?.(void 0)},children:o.jsxRuntimeExports.jsx(dt.motion.path,{d:p,variants:{initial:{fill:R,opacity:0},whileInView:{fill:R,opacity:1,transition:{duration:B.duration}}},initial:"initial",animate:k?"whileInView":"initial",exit:{opacity:0,transition:{duration:B.duration}},className:`${R===ne?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{stroke:se,strokeWidth:N,vectorEffect:"non-scaling-stroke"}},`${t.id}`)},t.id)})}),K?a.features.filter(t=>t.properties[O]===K.id).map((t,r)=>o.jsxRuntimeExports.jsx("path",{d:G(t)||"",className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5",vectorEffect:"non-scaling-stroke"}},r)):null,He?.features.map((t,r)=>{const p=G(t);return p?o.jsxRuntimeExports.jsx("g",{children:o.jsxRuntimeExports.jsx("path",{d:p,style:{stroke:Te||se,strokeWidth:Ge||N+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},r):null}),ce.filter(t=>t.position==="after").map(t=>t.layer)]})}),Ee===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",W?.colorLegend),children:Ve?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:()=>{ke(!1)},children:o.jsxRuntimeExports.jsx(pt.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:[m.map((t,r)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-r*25})`,children:t.map((p,E)=>o.jsxRuntimeExports.jsx("rect",{y:1,x:E*25+1,fill:p,width:23,height:23,strokeWidth:Y===p?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{J(p)},onMouseLeave:()=>{J(void 0)}},E))},r)),o.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:f.map((t,r)=>o.jsxRuntimeExports.jsx("text",{y:10,x:(r+1)*25,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:Nt.numberFormattingFunction(t,void 0,U?.precision??2,void 0,void 0,U?.locale||"en",U?.padZeros||!1)},r))}),re.map((t,r)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(f.length+1,5),4)*25+10},${100-r*25})`,children:o.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:Nt.numberFormattingFunction(t,void 0,de?.precision??2,void 0,void 0,de?.locale||"en",de?.padZeros||!1)})},r))]})}),o.jsxRuntimeExports.jsx(St._,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:ae})]}),o.jsxRuntimeExports.jsx(St._,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:Ae})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{ke(!0)},children:o.jsxRuntimeExports.jsx(pt.ExpandIcon,{})})}),M==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col undp-viz-zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>me("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:()=>me("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:"–"})]}),(X||c)&&o.jsxRuntimeExports.jsxs("div",{className:"absolute right-4 top-4 flex flex-col image-download-button gap-2",children:[X&&o.jsxRuntimeExports.jsx(Ht.ImageDownloadButton,{nodeID:X,buttonSmall:!0,className:"p-1"}),c&&c.length>0&&o.jsxRuntimeExports.jsx(Vt.CsvDownloadButton,{csvData:c,buttonSmall:!0,headers:Object.keys(c[0]).map(t=>({label:t,key:t})),className:"p-1"})]})]}),K&&ie&&we&&pe?o.jsxRuntimeExports.jsx(Tt.Tooltip,{data:K,body:ie,xPos:we,yPos:pe,backgroundStyle:$e?.tooltip,className:W?.tooltip}):null,b&&L!==void 0?o.jsxRuntimeExports.jsx(Gt.DetailsModal,{body:b,data:L,setData:Z,className:W?.modal}):null]})}function Kt(i){const e=o.compilerRuntimeExports.c(129),{data:f,graphTitle:P,mapData:Ae,colors:re,sources:ae,graphDescription:g,height:u,width:m,footNote:Fe,xDomain:D,yDomain:N,xColorLegendTitle:ne,yColorLegendTitle:se,tooltip:ie,scale:ve,centerPoint:je,padding:be,mapBorderWidth:j,mapNoDataColor:le,backgroundColor:O,mapBorderColor:Le,relativeHeight:b,onSeriesMouseOver:Ee,isWorldMap:$e,zoomScaleExtend:W,zoomTranslateExtend:A,graphID:M,showColorScale:B,highlightedIds:I,onSeriesMouseClick:ce,mapProperty:De,graphDownload:Ce,dataDownload:F,showAntarctica:H,language:V,minHeight:Te,theme:Ge,ariaLabel:U,resetSelectionOnDoubleClick:de,detailsOnClick:X,styles:c,classNames:a,mapProjection:He,zoomInteraction:Ve,animate:ke,dimmedOpacity:Y,customLayers:J,timeline:L,collapseColorScaleByDefault:Z,zoomAndCenterByHighlightedIds:K,projectionRotate:$,rewindCoordinatesInMapData:we,mapOverlay:x,xNumberDisplayOptions:pe,yNumberDisplayOptions:Q}=i,y=Ae===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":Ae,k=re===void 0?Ct.Colors.light.bivariateColors.colors05x05:re,ee=Fe===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":Fe,te=ne===void 0?"X Color key":ne,T=se===void 0?"Y Color key":se,q=ve===void 0?.95:ve,Re=j===void 0?.5:j,Se=le===void 0?Ct.Colors.light.graphNoData:le,Ne=O===void 0?!1:O,Oe=Le===void 0?Ct.Colors.light.grays["gray-500"]:Le,w=$e===void 0?!0:$e;let ue;e[0]!==W?(ue=W===void 0?[.8,6]:W,e[0]=W,e[1]=ue):ue=e[1];const G=ue,Me=B===void 0?!0:B,Be=De===void 0?"ISO3":De,Ie=Ce===void 0?!1:Ce,qe=F===void 0?!1:F,me=H===void 0?!1:H,t=V===void 0?"en":V,r=Te===void 0?0:Te,p=Ge===void 0?"light":Ge,E=de===void 0?!0:de,h=He===void 0?"naturalEarth":He,R=Ve===void 0?"button":Ve,v=ke===void 0?!1:ke,ze=Y===void 0?.3:Y;let Ue;e[2]!==J?(Ue=J===void 0?[]:J,e[2]=J,e[3]=Ue):Ue=e[3];const ut=Ue;let Xe;e[4]!==L?(Xe=L===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:L,e[4]=L,e[5]=Xe):Xe=e[5];const s=Xe,mt=K===void 0?!1:K;let Ye;e[6]!==$?(Ye=$===void 0?[0,0]:$,e[6]=$,e[7]=Ye):Ye=e[7];const xt=Ye,ht=we===void 0?!0:we,[oe,zt]=n.useState(0),[_e,_t]=n.useState(0),[z,Pt]=n.useState(s.autoplay);let Pe;if(e[8]!==f||e[9]!==s.dateFormat){let l;e[11]!==s.dateFormat?(l=C=>Rt.parse(`${C.date}`,s.dateFormat||"yyyy",new Date).getTime(),e[11]=s.dateFormat,e[12]=l):l=e[12],Pe=[...new Set(f.filter(lo).map(l))],Pe.sort(io),e[8]=f,e[9]=s.dateFormat,e[10]=Pe}else Pe=e[10];const d=Pe,[_,ft]=n.useState(s.autoplay?0:d.length-1),[xe,Wt]=n.useState(void 0),[gt,At]=n.useState(void 0),yt=n.useRef(null),kt=n.useRef(null);let Je,Ze;e[13]===Symbol.for("react.memo_cache_sentinel")?(Je=()=>{const l=new ResizeObserver(C=>{zt(C[0].target.clientWidth||620),_t(C[0].target.clientHeight||480)});return yt.current&&l.observe(yt.current),()=>l.disconnect()},Ze=[],e[13]=Je,e[14]=Ze):(Je=e[13],Ze=e[14]),n.useEffect(Je,Ze);let Ke;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ke=l=>{Wt(l)},e[15]=Ke):Ke=e[15];const Qe=n.useEffectEvent(Ke);let et;e[16]===Symbol.for("react.memo_cache_sentinel")?(et=l=>{At(l)},e[16]=et):et=e[16];const We=n.useEffectEvent(et);let tt;e[17]!==y||e[18]!==Qe?(tt=()=>{typeof y=="string"?Bt.fetchAndParseJSON(y).then(C=>{Qe(C)}):Qe(y)},e[17]=y,e[18]=Qe,e[19]=tt):tt=e[19];let ot;e[20]!==y?(ot=[y],e[20]=y,e[21]=ot):ot=e[21],n.useEffect(tt,ot);let rt;e[22]!==x?.mapData||e[23]!==We?(rt=()=>{x?.mapData||We(void 0),typeof x?.mapData=="string"?Bt.fetchAndParseJSON(x?.mapData).then(C=>{We(C)}):We(x?.mapData)},e[22]=x?.mapData,e[23]=We,e[24]=rt):rt=e[24];const vt=x?.mapData;let at;e[25]!==vt?(at=[vt],e[25]=vt,e[26]=at):at=e[26],n.useEffect(rt,at);let nt,st;e[27]!==z||e[28]!==s.speed||e[29]!==d?(nt=()=>{const l=setInterval(()=>{ft(C=>C<d.length-1?C+1:0)},(s.speed||2)*1e3);return z||clearInterval(l),()=>clearInterval(l)},st=[d,z,s.speed],e[27]=z,e[28]=s.speed,e[29]=d,e[30]=nt,e[31]=st):(nt=e[30],st=e[31]),n.useEffect(nt,st);const jt=s.dateFormat||"yyyy";let it;e[32]!==_||e[33]!==jt||e[34]!==s.showOnlyActiveDate||e[35]!==d?(it=wt.getSliderMarks(d,_,s.showOnlyActiveDate,jt),e[32]=_,e[33]=jt,e[34]=s.showOnlyActiveDate,e[35]=d,e[36]=it):it=e[36];const lt=it;if(D&&N&&(D.length!==k[0].length-1||N.length!==k.length-1))return console.error("the xDomain and yDomain array length don't match to the color array length"),null;const bt=a?.graphContainer,Et=c?.graphContainer;let he;e[37]!==a?.description||e[38]!==a?.title||e[39]!==g||e[40]!==P||e[41]!==c?.description||e[42]!==c?.title||e[43]!==m?(he=P||g?o.jsxRuntimeExports.jsx(Yt.GraphHeader,{styles:{title:c?.title,description:c?.description},classNames:{title:a?.title,description:a?.description},graphTitle:P,graphDescription:g,width:m}):null,e[37]=a?.description,e[38]=a?.title,e[39]=g,e[40]=P,e[41]=c?.description,e[42]=c?.title,e[43]=m,e[44]=he):he=e[44];let fe;e[45]!==_||e[46]!==lt||e[47]!==z||e[48]!==s.enabled||e[49]!==d?(fe=s.enabled&&d.length>0&&lt?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Pt(!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(pt.Pause,{}):o.jsxRuntimeExports.jsx(pt.Play,{})}),o.jsxRuntimeExports.jsx(wt.Nr,{min:d[0],max:d[d.length-1],marks:lt,step:null,defaultValue:d[d.length-1],value:d[_],onChangeComplete:l=>{ft(d.indexOf(l))},onChange:l=>{ft(d.indexOf(l))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[45]=_,e[46]=lt,e[47]=z,e[48]=s.enabled,e[49]=d,e[50]=fe):fe=e[50];let ge;e[51]!==v||e[52]!==je||e[53]!==a||e[54]!==Z||e[55]!==k||e[56]!==ut||e[57]!==f||e[58]!==qe||e[59]!==X||e[60]!==ze||e[61]!==Ie||e[62]!==u||e[63]!==I||e[64]!==_||e[65]!==w||e[66]!==Oe||e[67]!==Re||e[68]!==Se||e[69]!==x?.mapBorderColor||e[70]!==x?.mapBorderWidth||e[71]!==h||e[72]!==Be||e[73]!==xe||e[74]!==r||e[75]!==ce||e[76]!==Ee||e[77]!==gt||e[78]!==xt||e[79]!==b||e[80]!==E||e[81]!==ht||e[82]!==q||e[83]!==me||e[84]!==Me||e[85]!==c||e[86]!==_e||e[87]!==oe||e[88]!==s.dateFormat||e[89]!==s.enabled||e[90]!==ie||e[91]!==d||e[92]!==m||e[93]!==te||e[94]!==D||e[95]!==pe||e[96]!==T||e[97]!==N||e[98]!==Q||e[99]!==mt||e[100]!==R||e[101]!==G||e[102]!==A?(ge=o.jsxRuntimeExports.jsx(qt.GraphArea,{ref:yt,children:oe&&_e&&xe?o.jsxRuntimeExports.jsx(Zt,{data:f.filter(l=>s.enabled?`${l.date}`===Rt.format(new Date(d[_]),s.dateFormat||"yyyy"):l),mapData:me?xe:{...xe,features:xe.features.filter(so)},xDomain:D||It.getJenks(f.map(no),k[0].length),yDomain:N||It.getJenks(f.map(ao),k.length),width:oe,height:_e,scale:q,centerPoint:je,colors:k,xColorLegendTitle:te,yColorLegendTitle:T,mapBorderWidth:Re,mapNoDataColor:Se,mapBorderColor:Oe,tooltip:ie,onSeriesMouseOver:Ee,isWorldMap:w,zoomScaleExtend:G,zoomTranslateExtend:A,onSeriesMouseClick:ce,mapProperty:Be,highlightedIds:I,resetSelectionOnDoubleClick:E,styles:c,showColorScale:Me,classNames:a,mapProjection:h||(w?"naturalEarth":"mercator"),detailsOnClick:X,zoomInteraction:R,overlayMapData:gt,overlayMapBorderColor:x?.mapBorderColor,overlayMapBorderWidth:x?.mapBorderWidth,animate:v===!0?{duration:.5,once:!0,amount:.5}:v||{duration:0,once:!0,amount:0},dimmedOpacity:ze,customLayers:ut,collapseColorScaleByDefault:Z,zoomAndCenterByHighlightedIds:mt,projectionRotate:xt,rewindCoordinatesInMapData:ht,xNumberDisplayOptions:pe,yNumberDisplayOptions:Q,graphDownload:Ie?kt:void 0,dataDownload:qe?f.map(ro).filter(oo).length>0?f.map(to).filter(eo):f.filter(Qt):null}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(r,u||(b?r?(m||oe)*b>r?(m||oe)*b:r:(m||oe)*b:_e))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Ft.w,{"aria-label":"Loading graph"})})}),e[51]=v,e[52]=je,e[53]=a,e[54]=Z,e[55]=k,e[56]=ut,e[57]=f,e[58]=qe,e[59]=X,e[60]=ze,e[61]=Ie,e[62]=u,e[63]=I,e[64]=_,e[65]=w,e[66]=Oe,e[67]=Re,e[68]=Se,e[69]=x?.mapBorderColor,e[70]=x?.mapBorderWidth,e[71]=h,e[72]=Be,e[73]=xe,e[74]=r,e[75]=ce,e[76]=Ee,e[77]=gt,e[78]=xt,e[79]=b,e[80]=E,e[81]=ht,e[82]=q,e[83]=me,e[84]=Me,e[85]=c,e[86]=_e,e[87]=oe,e[88]=s.dateFormat,e[89]=s.enabled,e[90]=ie,e[91]=d,e[92]=m,e[93]=te,e[94]=D,e[95]=pe,e[96]=T,e[97]=N,e[98]=Q,e[99]=mt,e[100]=R,e[101]=G,e[102]=A,e[103]=ge):ge=e[103];let ye;e[104]!==a?.footnote||e[105]!==a?.source||e[106]!==ee||e[107]!==ae||e[108]!==c?.footnote||e[109]!==c?.source||e[110]!==m?(ye=ae||ee?o.jsxRuntimeExports.jsx(Jt.GraphFooter,{styles:{footnote:c?.footnote,source:c?.source},classNames:{footnote:a?.footnote,source:a?.source},sources:ae,footNote:ee,width:m}):null,e[104]=a?.footnote,e[105]=a?.source,e[106]=ee,e[107]=ae,e[108]=c?.footnote,e[109]=c?.source,e[110]=m,e[111]=ye):ye=e[111];let ct;return e[112]!==U||e[113]!==Ne||e[114]!==M||e[115]!==u||e[116]!==t||e[117]!==r||e[118]!==be||e[119]!==b||e[120]!==bt||e[121]!==Et||e[122]!==he||e[123]!==fe||e[124]!==ge||e[125]!==ye||e[126]!==p||e[127]!==m?(ct=o.jsxRuntimeExports.jsxs(qt.GraphContainer,{className:bt,style:Et,id:M,ref:kt,"aria-label":U,backgroundColor:Ne,theme:p,language:t,minHeight:r,width:m,height:u,relativeHeight:b,padding:be,children:[he,fe,ge,ye]}),e[112]=U,e[113]=Ne,e[114]=M,e[115]=u,e[116]=t,e[117]=r,e[118]=be,e[119]=b,e[120]=bt,e[121]=Et,e[122]=he,e[123]=fe,e[124]=ge,e[125]=ye,e[126]=p,e[127]=m,e[128]=ct):ct=e[128],ct}function Qt(i){return i!==void 0}function eo(i){return i!==void 0}function to(i){return i.data}function oo(i){return i!==void 0}function ro(i){return i.data}function ao(i){return i.y}function no(i){return i.x}function so(i){return i.properties?.NAME!=="Antarctica"}function io(i,e){return i-e}function lo(i){return i.date}exports.BiVariateChoroplethMap=Kt;
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 { RefObject, useEffect, useMemo, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n geoPath,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { FeatureCollection } from 'geojson';\r\nimport rewind from '@turf/rewind';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n NumberFormatOptions,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { ExpandIcon, X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { ImageDownloadButton } from '@/Components/Actions/ImageDownloadButton';\r\n\r\ninterface Props {\r\n data: BivariateMapDataType[];\r\n mapData: FeatureCollection;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds?: string[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n showColorScale: boolean;\r\n collapseColorScaleByDefault?: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n zoomAndCenterByHighlightedIds: boolean;\r\n projectionRotate: [number, number] | [number, number, number];\r\n rewindCoordinatesInMapData: boolean;\r\n overlayMapData?: FeatureCollection;\r\n overlayMapBorderColor?: string;\r\n overlayMapBorderWidth?: number;\r\n xNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n yNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n graphDownload?: RefObject<HTMLDivElement | null>;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds,\r\n projectionRotate,\r\n rewindCoordinatesInMapData,\r\n overlayMapData,\r\n overlayMapBorderColor,\r\n overlayMapBorderWidth,\r\n xNumberDisplayOptions,\r\n yNumberDisplayOptions,\r\n graphDownload,\r\n } = props;\r\n const formattedMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData) return mapData;\r\n\r\n return rewind(mapData, { reverse: true }) as FeatureCollection;\r\n }, [mapData, rewindCoordinatesInMapData]);\r\n const formattedOverlayMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData || !overlayMapData) return overlayMapData;\r\n\r\n return rewind(overlayMapData, { reverse: true }) as FeatureCollection;\r\n }, [overlayMapData, rewindCoordinatesInMapData]);\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n const bounds = bbox({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds?.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n\r\n const center = centerOfMass({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds?.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n const lonDiff = (bounds[2] - bounds[0]) * 1.15;\r\n const latDiff = (bounds[3] - bounds[1]) * 1.15;\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\r\n const pathGenerator = geoPath().projection(projection);\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {formattedMapData.features.map((d, i: number) => {\r\n if (!d.properties?.[mapProperty]) return null;\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <motion.g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n <path\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = formattedMapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n if (index === -1) return null;\r\n const path = pathGenerator(formattedMapData.features[index]);\r\n if (!path) return null;\r\n const xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\r\n return (\r\n <motion.g\r\n className='undp-map-shapes'\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? !highlightedIds || highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedIds\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n <motion.path\r\n key={`${d.id}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? formattedMapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n .map((d, i) => (\r\n <path\r\n key={i}\r\n d={pathGenerator(d) || ''}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n ))\r\n : null}\r\n {formattedOverlayMapData?.features.map((d, i: number) => {\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <g key={i}>\r\n <path\r\n d={path}\r\n style={{\r\n stroke: overlayMapBorderColor || mapBorderColor,\r\n strokeWidth: overlayMapBorderWidth || mapBorderWidth + 1,\r\n fill: 'none',\r\n pointerEvents: 'none',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </g>\r\n );\r\n })}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{ width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(\r\n el,\r\n undefined,\r\n xNumberDisplayOptions?.precision ?? 2,\r\n undefined,\r\n undefined,\r\n xNumberDisplayOptions?.locale || 'en',\r\n xNumberDisplayOptions?.padZeros || false,\r\n )}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(\r\n el,\r\n undefined,\r\n yNumberDisplayOptions?.precision ?? 2,\r\n undefined,\r\n undefined,\r\n yNumberDisplayOptions?.locale || 'en',\r\n yNumberDisplayOptions?.padZeros || false,\r\n )}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <ExpandIcon />\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col undp-viz-zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n {graphDownload && (\r\n <div className='absolute right-4 top-4 flex flex-col image-download-button'>\r\n <ImageDownloadButton nodeID={graphDownload} buttonSmall />\r\n </div>\r\n )}\r\n </div>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useEffectEvent, useMemo, useRef, useState } from 'react';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { FeatureCollection } from 'geojson';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n MapOverlayDataType,\r\n NumberFormatOptions,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects. */\r\n data: BivariateMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n mapData?: FeatureCollection | string;\r\n /** Detail if any other map needs to be overlayed over the main map */\r\n mapOverlay?: MapOverlayDataType;\r\n /** Defines if the coordinates in the map data should be rewinded or not. Try to change this is the visualization shows countries as holes instead of shapes. */\r\n rewindCoordinatesInMapData?: boolean;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Controls the rotation of the map projection, in degrees, applied before rendering. Useful for shifting the antimeridian to focus the map on different regions */\r\n projectionRotate?: [number, number] | [number, number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Toggle if the map is centered and zoomed to the highlighted ids. */\r\n zoomAndCenterByHighlightedIds?: boolean;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Configuration options for controlling number formatting, localization, precision, and zero padding. */\r\n xNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n /** Configuration options for controlling number formatting, localization, precision, and zero padding. */\r\n yNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection = 'naturalEarth',\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds = false,\r\n projectionRotate = [0, 0],\r\n rewindCoordinatesInMapData = true,\r\n mapOverlay,\r\n xNumberDisplayOptions,\r\n yNumberDisplayOptions,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = useMemo(() => {\r\n const dates = [\r\n ...new Set(\r\n data\r\n .filter(d => d.date)\r\n .map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n ),\r\n ];\r\n dates.sort((a, b) => a - b);\r\n return dates;\r\n }, [data, timeline.dateFormat]);\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n const [mapShape, setMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n const [overlayMapShape, setOverlayMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const onUpdateShape = useEffectEvent((shape: FeatureCollection) => {\r\n setMapShape(shape);\r\n });\r\n\r\n const onUpdateOverlayMapShape = useEffectEvent((shape: FeatureCollection | undefined) => {\r\n setOverlayMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n useEffect(() => {\r\n if (!mapOverlay?.mapData) onUpdateOverlayMapShape(undefined);\r\n if (typeof mapOverlay?.mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapOverlay?.mapData);\r\n fetchData.then(d => {\r\n onUpdateOverlayMapShape(d as FeatureCollection);\r\n });\r\n } else {\r\n onUpdateOverlayMapShape(mapOverlay?.mapData);\r\n }\r\n }, [mapOverlay?.mapData]);\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\r\n }\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {svgWidth && svgHeight && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? `${d.date}` ===\r\n format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(el => el.properties?.NAME !== 'Antarctica'),\r\n }\r\n }\r\n xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\r\n overlayMapData={overlayMapShape}\r\n overlayMapBorderColor={mapOverlay?.mapBorderColor}\r\n overlayMapBorderWidth={mapOverlay?.mapBorderWidth}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n zoomAndCenterByHighlightedIds={zoomAndCenterByHighlightedIds}\r\n projectionRotate={projectionRotate}\r\n rewindCoordinatesInMapData={rewindCoordinatesInMapData}\r\n xNumberDisplayOptions={xNumberDisplayOptions}\r\n yNumberDisplayOptions={yNumberDisplayOptions}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","zoomAndCenterByHighlightedIds","projectionRotate","rewindCoordinatesInMapData","overlayMapData","overlayMapBorderColor","overlayMapBorderWidth","xNumberDisplayOptions","yNumberDisplayOptions","graphDownload","formattedMapData","useMemo","rewind","reverse","formattedOverlayMapData","showLegend","setShowLegend","useState","undefined","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","once","amount","mapG","zoomRef","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","features","d","length","indexOf","properties","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","pathGenerator","geoPath","xRange","Array","from","_","i","yRange","xScale","scaleThreshold","domain","range","yScale","handleZoom","direction","scaleBy","jsxs","Fragment","jsx","motion","position","map","layer","path","stroke","strokeWidth","fill","vectorEffect","AnimatePresence","index","findIndex","el","id","xColorCoord","checkIfNullOrUndefined","x","yColorCoord","y","color","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","pointerEvents","cn","colorLegend","X","j","cursor","numberFormattingFunction","precision","locale","padZeros","max","P","display","WebkitLineClamp","WebkitBoxOrient","overflow","writingMode","ExpandIcon","ImageDownloadButton","Tooltip","DetailsModal","modal","BiVariateChoroplethMap","$","_c","graphTitle","t0","t1","sources","graphDescription","footNote","t2","t3","t4","t5","padding","t6","t7","backgroundColor","t8","t9","relativeHeight","isWorldMap","t10","t11","graphID","t12","t13","t14","dataDownload","t15","showAntarctica","t16","language","t17","minHeight","t18","theme","t19","ariaLabel","t20","t21","t22","t23","t24","t25","timeline","t26","t27","t28","t29","mapOverlay","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t30","t31","t32","enabled","autoplay","showOnlyActiveDate","t33","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t34","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","overlayMapShape","setOverlayMapShape","graphDiv","graphParentDiv","t35","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t36","shape","onUpdateShape","useEffectEvent","t37","shape_0","onUpdateOverlayMapShape","t38","fetchAndParseJSON","then","d_1","t39","t40","d_2","t41","t42","t43","t44","speed","interval","setInterval","clearInterval","t45","t46","getSliderMarks","markObj","console","error","t47","graphContainer","t48","t49","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t50","Pause","Play","SliderUI","nextValue","nextValue_0","t51","GraphArea","d_8","format","_temp8","getJenks","_temp9","_temp0","Spinner","t52","footnote","source","GraphFooter","t53","GraphContainer","d_10","d_9","NAME","d_5","d_4","d_3","d_7","d_6","a","b"],"mappings":"kjCAyFO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJC,KAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,kBAAAA,GACAC,QAAAA,GACAC,kBAAAA,GACAC,MAAAA,EACAC,OAAAA,EACAC,OAAAA,EACAC,MAAAA,GACAC,YAAAA,EACAC,eAAAA,EACAC,eAAAA,GACAC,eAAAA,GACAC,QAAAA,GACAC,kBAAAA,GACAC,gBAAAA,GACAC,oBAAAA,GACAC,eAAAA,EACAC,mBAAAA,GACAC,YAAAA,EACAC,4BAAAA,GACAC,eAAAA,EACAC,eAAAA,GACAC,OAAAA,GACAC,WAAAA,EACAC,cAAAA,EACAC,gBAAAA,EACAC,QAAAA,EACAC,cAAAA,EACAC,aAAAA,GACAC,4BAAAA,GACAC,8BAAAA,GACAC,iBAAAA,EACAC,2BAAAA,EACAC,eAAAA,EACAC,sBAAAA,GACAC,sBAAAA,GACAC,sBAAAA,EACAC,sBAAAA,GACAC,cAAAA,EAA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A,OA+K6CnQ,IAAM9C,MAAS,CA/K5D,SAAAqR,GAAA6B,EAAA,CAAA,OA+KyBpQ,EAAC/F,IAAK,CA/K/B,SAAAqU,GAAA+B,EAAA,CAAA,OA8K2CrQ,IAAM9C,MAAS,CA9K1D,SAAAmR,GAAAiC,EAAA,CAAA,OA8KuBtQ,EAAC/F,IAAK,CA9K7B,SAAA6Q,GAAAyF,EAAAC,EAAA,CAAA,OAsEkBD,EAAIC,CAAC,CAtEvB,SAAA5F,GAAA5K,EAAA,CAAA,OAkEgBA,EAACwK,IAAK"}
1
+ {"version":3,"file":"BiVariateChoroplethMap.cjs","sources":["../src/Components/Graphs/Maps/BiVariateMap/Graph.tsx","../src/Components/Graphs/Maps/BiVariateMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { RefObject, useEffect, useMemo, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n geoPath,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { FeatureCollection } from 'geojson';\r\nimport rewind from '@turf/rewind';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n NumberFormatOptions,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { ExpandIcon, X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { ImageDownloadButton } from '@/Components/Actions/ImageDownloadButton';\r\nimport { CsvDownloadButton } from '@/Components/Actions/CsvDownloadButton';\r\n\r\ninterface Props {\r\n data: BivariateMapDataType[];\r\n mapData: FeatureCollection;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds?: string[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n showColorScale: boolean;\r\n collapseColorScaleByDefault?: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n zoomAndCenterByHighlightedIds: boolean;\r\n projectionRotate: [number, number] | [number, number, number];\r\n rewindCoordinatesInMapData: boolean;\r\n overlayMapData?: FeatureCollection;\r\n overlayMapBorderColor?: string;\r\n overlayMapBorderWidth?: number;\r\n xNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n yNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n graphDownload?: RefObject<HTMLDivElement | null>;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n dataDownload: any;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds,\r\n projectionRotate,\r\n rewindCoordinatesInMapData,\r\n overlayMapData,\r\n overlayMapBorderColor,\r\n overlayMapBorderWidth,\r\n xNumberDisplayOptions,\r\n yNumberDisplayOptions,\r\n graphDownload,\r\n dataDownload,\r\n } = props;\r\n const formattedMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData) return mapData;\r\n\r\n return rewind(mapData, { reverse: true }) as FeatureCollection;\r\n }, [mapData, rewindCoordinatesInMapData]);\r\n const formattedOverlayMapData = useMemo(() => {\r\n if (!rewindCoordinatesInMapData || !overlayMapData) return overlayMapData;\r\n\r\n return rewind(overlayMapData, { reverse: true }) as FeatureCollection;\r\n }, [overlayMapData, rewindCoordinatesInMapData]);\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n const bounds = bbox({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds?.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n\r\n const center = centerOfMass({\r\n ...formattedMapData,\r\n features: zoomAndCenterByHighlightedIds\r\n ? formattedMapData.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: any) =>\r\n (highlightedIds || []).length === 0 ||\r\n highlightedIds?.indexOf(d.properties[mapProperty]) !== -1,\r\n )\r\n : formattedMapData.features,\r\n });\r\n const lonDiff = (bounds[2] - bounds[0]) * 1.15;\r\n const latDiff = (bounds[3] - bounds[1]) * 1.15;\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate(projectionRotate)\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\r\n const pathGenerator = geoPath().projection(projection);\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {formattedMapData.features.map((d, i: number) => {\r\n if (!d.properties?.[mapProperty]) return null;\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <motion.g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n <path\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = formattedMapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n if (index === -1) return null;\r\n const path = pathGenerator(formattedMapData.features[index]);\r\n if (!path) return null;\r\n const xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\r\n return (\r\n <motion.g\r\n className='undp-map-shapes'\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? !highlightedIds || highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedIds\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n <motion.path\r\n key={`${d.id}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? formattedMapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n .map((d, i) => (\r\n <path\r\n key={i}\r\n d={pathGenerator(d) || ''}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n ))\r\n : null}\r\n {formattedOverlayMapData?.features.map((d, i: number) => {\r\n const path = pathGenerator(d);\r\n if (!path) return null;\r\n return (\r\n <g key={i}>\r\n <path\r\n d={path}\r\n style={{\r\n stroke: overlayMapBorderColor || mapBorderColor,\r\n strokeWidth: overlayMapBorderWidth || mapBorderWidth + 1,\r\n fill: 'none',\r\n pointerEvents: 'none',\r\n vectorEffect: 'non-scaling-stroke',\r\n }}\r\n />\r\n </g>\r\n );\r\n })}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{ width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(\r\n el,\r\n undefined,\r\n xNumberDisplayOptions?.precision ?? 2,\r\n undefined,\r\n undefined,\r\n xNumberDisplayOptions?.locale || 'en',\r\n xNumberDisplayOptions?.padZeros || false,\r\n )}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(\r\n el,\r\n undefined,\r\n yNumberDisplayOptions?.precision ?? 2,\r\n undefined,\r\n undefined,\r\n yNumberDisplayOptions?.locale || 'en',\r\n yNumberDisplayOptions?.padZeros || false,\r\n )}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <ExpandIcon />\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col undp-viz-zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n {(graphDownload || dataDownload) && (\r\n <div className='absolute right-4 top-4 flex flex-col image-download-button gap-2'>\r\n {graphDownload && (\r\n <ImageDownloadButton nodeID={graphDownload} buttonSmall className='p-1' />\r\n )}\r\n {dataDownload && dataDownload.length > 0 && (\r\n <CsvDownloadButton\r\n csvData={dataDownload}\r\n buttonSmall\r\n headers={Object.keys(dataDownload[0]).map(d => ({\r\n label: d,\r\n key: d,\r\n }))}\r\n className='p-1'\r\n />\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useEffectEvent, useMemo, useRef, useState } from 'react';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { FeatureCollection } from 'geojson';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n MapOverlayDataType,\r\n NumberFormatOptions,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects. */\r\n data: BivariateMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n mapData?: FeatureCollection | string;\r\n /** Detail if any other map needs to be overlayed over the main map */\r\n mapOverlay?: MapOverlayDataType;\r\n /** Defines if the coordinates in the map data should be rewinded or not. Try to change this is the visualization shows countries as holes instead of shapes. */\r\n rewindCoordinatesInMapData?: boolean;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Controls the rotation of the map projection, in degrees, applied before rendering. Useful for shifting the antimeridian to focus the map on different regions */\r\n projectionRotate?: [number, number] | [number, number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Toggle if the map is centered and zoomed to the highlighted ids. */\r\n zoomAndCenterByHighlightedIds?: boolean;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Configuration options for controlling number formatting, localization, precision, and zero padding. */\r\n xNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n /** Configuration options for controlling number formatting, localization, precision, and zero padding. */\r\n yNumberDisplayOptions?: Omit<NumberFormatOptions, 'suffix' | 'prefix'>;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection = 'naturalEarth',\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n collapseColorScaleByDefault,\r\n zoomAndCenterByHighlightedIds = false,\r\n projectionRotate = [0, 0],\r\n rewindCoordinatesInMapData = true,\r\n mapOverlay,\r\n xNumberDisplayOptions,\r\n yNumberDisplayOptions,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = useMemo(() => {\r\n const dates = [\r\n ...new Set(\r\n data\r\n .filter(d => d.date)\r\n .map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n ),\r\n ];\r\n dates.sort((a, b) => a - b);\r\n return dates;\r\n }, [data, timeline.dateFormat]);\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n const [mapShape, setMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n const [overlayMapShape, setOverlayMapShape] = useState<FeatureCollection | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const onUpdateShape = useEffectEvent((shape: FeatureCollection) => {\r\n setMapShape(shape);\r\n });\r\n\r\n const onUpdateOverlayMapShape = useEffectEvent((shape: FeatureCollection | undefined) => {\r\n setOverlayMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n useEffect(() => {\r\n if (!mapOverlay?.mapData) onUpdateOverlayMapShape(undefined);\r\n if (typeof mapOverlay?.mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapOverlay?.mapData);\r\n fetchData.then(d => {\r\n onUpdateOverlayMapShape(d as FeatureCollection);\r\n });\r\n } else {\r\n onUpdateOverlayMapShape(mapOverlay?.mapData);\r\n }\r\n }, [mapOverlay?.mapData]);\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\r\n }\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription ? (\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 />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {svgWidth && svgHeight && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? `${d.date}` ===\r\n format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(el => el.properties?.NAME !== 'Antarctica'),\r\n }\r\n }\r\n xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\r\n overlayMapData={overlayMapShape}\r\n overlayMapBorderColor={mapOverlay?.mapBorderColor}\r\n overlayMapBorderWidth={mapOverlay?.mapBorderWidth}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n zoomAndCenterByHighlightedIds={zoomAndCenterByHighlightedIds}\r\n projectionRotate={projectionRotate}\r\n rewindCoordinatesInMapData={rewindCoordinatesInMapData}\r\n xNumberDisplayOptions={xNumberDisplayOptions}\r\n yNumberDisplayOptions={yNumberDisplayOptions}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n 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 ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","zoomAndCenterByHighlightedIds","projectionRotate","rewindCoordinatesInMapData","overlayMapData","overlayMapBorderColor","overlayMapBorderWidth","xNumberDisplayOptions","yNumberDisplayOptions","graphDownload","dataDownload","formattedMapData","useMemo","rewind","reverse","formattedOverlayMapData","showLegend","setShowLegend","useState","undefined","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","once","amount","mapG","zoomRef","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","features","d","length","indexOf","properties","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","pathGenerator","geoPath","xRange","Array","from","_","i","yRange","xScale","scaleThreshold","domain","range","yScale","handleZoom","direction","scaleBy","jsxs","Fragment","jsx","motion","position","map","layer","path","stroke","strokeWidth","fill","vectorEffect","AnimatePresence","index","findIndex","el","id","xColorCoord","checkIfNullOrUndefined","x","yColorCoord","y","color","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","pointerEvents","cn","colorLegend","X","j","cursor","numberFormattingFunction","precision","locale","padZeros","max","P","display","WebkitLineClamp","WebkitBoxOrient","overflow","writingMode","ExpandIcon","ImageDownloadButton","CsvDownloadButton","Object","keys","label","key","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","t15","showAntarctica","t16","language","t17","minHeight","t18","theme","t19","ariaLabel","t20","t21","t22","t23","t24","t25","timeline","t26","t27","t28","t29","mapOverlay","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t30","t31","t32","enabled","autoplay","showOnlyActiveDate","t33","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t34","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","overlayMapShape","setOverlayMapShape","graphDiv","graphParentDiv","t35","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t36","shape","onUpdateShape","useEffectEvent","t37","shape_0","onUpdateOverlayMapShape","t38","fetchAndParseJSON","then","d_1","t39","t40","d_2","t41","t42","t43","t44","speed","interval","setInterval","clearInterval","t45","t46","getSliderMarks","markObj","console","error","t47","graphContainer","t48","t49","description","title","GraphHeader","t50","Pause","Play","SliderUI","nextValue","nextValue_0","t51","GraphArea","d_3","format","_temp3","getJenks","_temp4","_temp5","_temp6","_temp7","_temp8","_temp9","_temp0","Spinner","t52","footnote","source","GraphFooter","t53","GraphContainer","d_8","d_7","d_6","d_10","d_9","d_5","d_4","NAME","a","b"],"mappings":"wlCA4FO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJC,KAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,kBAAAA,GACAC,QAAAA,GACAC,kBAAAA,GACAC,MAAAA,EACAC,OAAAA,EACAC,OAAAA,EACAC,MAAAA,GACAC,YAAAA,EACAC,eAAAA,EACAC,eAAAA,GACAC,eAAAA,GACAC,QAAAA,GACAC,kBAAAA,GACAC,gBAAAA,GACAC,oBAAAA,GACAC,eAAAA,EACAC,mBAAAA,GACAC,YAAAA,EACAC,4BAAAA,GACAC,eAAAA,EACAC,eAAAA,GACAC,OAAAA,GACAC,WAAAA,EACAC,cAAAA,EACAC,gBAAAA,EACAC,QAAAA,EACAC,cAAAA,EACAC,aAAAA,GACAC,4BAAAA,GACAC,8BAAAA,GACAC,iBAAAA,EACAC,2BAAAA,EACAC,eAAAA,EACAC,sBAAAA,GACAC,sBAAAA,GACAC,sBAAAA,EACAC,sBAAAA,GACAC,cAAAA,EACAC,aAAAA,CAAAA,EACE1C,EACE2C,EAAmBC,EAAAA,QAAQ,IAC1BT,EAEEU,EAAAA,cAAO1C,EAAS,CAAE2C,QAAS,EAAA,CAAM,EAFA3C,EAGvC,CAACA,EAASgC,CAA0B,CAAC,EAClCY,GAA0BH,EAAAA,QAAQ,IAClC,CAACT,GAA8B,CAACC,EAAuBA,EAEpDS,EAAAA,cAAOT,EAAgB,CAAEU,QAAS,EAAA,CAAM,EAC9C,CAACV,EAAgBD,CAA0B,CAAC,EACzC,CAACa,GAAYC,EAAa,EAAIC,WAClClB,KAAgCmB,OAAY,EAAE5C,EAAQ,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