@undp/data-viz 2.0.6 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +68 -68
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/GraphEl-BcKU0bG1.cjs +2 -0
- package/dist/GraphEl-BcKU0bG1.cjs.map +1 -0
- package/dist/{GraphEl-VtiYqELy.js → GraphEl-CGq1EWRn.js} +70 -8
- package/dist/GraphEl-CGq1EWRn.js.map +1 -0
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.d.ts +6 -1
- package/dist/GriddedGraphs.js +2 -2
- package/dist/GriddedGraphsFromConfig.d.ts +6 -1
- package/dist/HybridMap.cjs +2 -0
- package/dist/HybridMap.cjs.map +1 -0
- package/dist/HybridMap.d.ts +211 -0
- package/dist/HybridMap.js +599 -0
- package/dist/HybridMap.js.map +1 -0
- package/dist/MultiGraphDashboard.d.ts +6 -1
- package/dist/MultiGraphDashboardFromConfig.d.ts +6 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +6 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +6 -1
- package/dist/PerformanceIntensiveScrollStory.d.ts +6 -1
- package/dist/ScrollStory.d.ts +6 -1
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.d.ts +6 -1
- package/dist/SingleGraphDashboard.js +2 -2
- package/dist/SingleGraphDashboardFromConfig.d.ts +6 -1
- package/dist/SingleGraphDashboardGeoHubMaps.d.ts +5 -0
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +5 -0
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.d.ts +5 -0
- package/dist/SingleGraphDashboardThreeDGraphs.js +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +5 -0
- package/dist/Types.d.ts +17 -1
- package/dist/getSchema.cjs +1 -1
- package/dist/getSchema.cjs.map +1 -1
- package/dist/getSchema.d.ts +3 -3
- package/dist/getSchema.js +4 -0
- package/dist/getSchema.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +353 -220
- package/dist/index.js +163 -161
- package/dist/index.js.map +1 -1
- package/dist/transformData.cjs +1 -1
- package/dist/transformData.d.ts +1 -1
- package/dist/transformData.js +2 -2
- package/dist/{transformDataForAggregation-CE3bAlHU.js → transformDataForAggregation-CjwEAUOR.js} +62 -31
- package/dist/transformDataForAggregation-CjwEAUOR.js.map +1 -0
- package/dist/transformDataForAggregation-DAGK2BZy.cjs +2 -0
- package/dist/transformDataForAggregation-DAGK2BZy.cjs.map +1 -0
- package/dist/{transformDataForGraphFromFile-DaJHQCsL.cjs → transformDataForGraphFromFile-B1zJSPRP.cjs} +2 -2
- package/dist/{transformDataForGraphFromFile-DaJHQCsL.cjs.map → transformDataForGraphFromFile-B1zJSPRP.cjs.map} +1 -1
- package/dist/{transformDataForGraphFromFile-BExxcITV.js → transformDataForGraphFromFile-D5TMQYYd.js} +2 -2
- package/dist/{transformDataForGraphFromFile-BExxcITV.js.map → transformDataForGraphFromFile-D5TMQYYd.js.map} +1 -1
- package/dist/validateSchema.d.ts +1 -1
- package/package.json +6 -1
- package/dist/GraphEl-D5RBCD7p.cjs +0 -2
- package/dist/GraphEl-D5RBCD7p.cjs.map +0 -1
- package/dist/GraphEl-VtiYqELy.js.map +0 -1
- package/dist/transformDataForAggregation-CE3bAlHU.js.map +0 -1
- package/dist/transformDataForAggregation-KXGm6flX.cjs +0 -2
- package/dist/transformDataForAggregation-KXGm6flX.cjs.map +0 -1
package/dist/ChoroplethMap.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-CTPQjnHt.cjs"),p=require("react"),st=require("./getSliderMarks-BmADcPQt.cjs"),pt=require("./Spinner-DRMBUsX7.cjs"),it=require("./parse-hMnG_lRV.cjs"),mt=require("./index-DQA8q5sC.cjs"),re=require("./zoom-DPw8bba-.cjs"),ht=require("./Modal-JW_IExO3.cjs"),at=require("./Typography-DX7PlgQU.cjs"),xt=require("./index-DxXnJ8Ti.cjs"),gt=require("./numberFormattingFunction-02t-wJta.cjs"),yt=require("./Tooltip-4dJo4_AF.cjs"),ft=require("./string2HTML-CPGr_I5E.cjs"),jt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),rt=require("./index-DRXx7m-C.cjs"),vt=require("./ordinal-CrsysVE-.cjs"),bt=require("./threshold-DNsSUf8Q.cjs"),ot=require("./select-Bnfk0lJx.cjs"),Et=require("./use-in-view-QcfiW0w3.cjs"),Ge=require("./proxy-BxvUI_9l.cjs"),kt=require("./index-DG2bgAva.cjs"),Rt=require("./GraphFooter.cjs"),wt=require("./GraphHeader.cjs"),Ue=require("./Colors.cjs"),Ct=require("./fetchAndParseData-l5HGMAEs.cjs"),$t=require("./getUniqValue-RViz8tTw.cjs"),St=require("./getJenks-GYmdwBqm.cjs"),Nt=require("./uniqBy-O05lp2S5.cjs"),lt=require("./GraphContainer-d8A46BK2.cjs"),Dt=require("./sort-O96oMZLb.cjs"),Mt=require("./init-DU0ybBc_.cjs");function qt(h){const{data:e,colorDomain:c,colors:d,mapData:w,colorLegendTitle:N,categorical:W,height:E,width:g,scale:v,centerPoint:B,tooltip:ne,mapBorderWidth:F,mapBorderColor:G,mapNoDataColor:se,onSeriesMouseOver:ie,showColorScale:ve,zoomScaleExtend:De,zoomTranslateExtend:Me,highlightedIds:U,onSeriesMouseClick:ae,mapProperty:k,resetSelectionOnDoubleClick:be,detailsOnClick:D,styles:qe,classNames:Ee,mapProjection:O,zoomInteraction:P,animate:$,dimmedOpacity:I,customLayers:le,collapseColorScaleByDefault:ke}=h,[M,L]=p.useState(void 0),ce=p.useRef(null),[Oe,Re]=p.useState(ke===void 0?!(g<680):!ke),[V,X]=p.useState(void 0),[Y,J]=p.useState(void 0),[x,m]=p.useState(void 0),[de,ue]=p.useState(void 0),A=p.useRef(null),pe=Et.useInView(A,{once:$.once,amount:$.amount}),K=p.useRef(null),Pe=W?vt.ordinal().domain(c).range(d):bt.threshold().domain(c).range(d);p.useEffect(()=>{const o=ot.select(K.current),a=ot.select(A.current),y=r=>{if(P==="noZoom")return!1;if(P==="button")return!r.type.includes("wheel");const i=r.type==="wheel",l=r.type.startsWith("touch"),s=r.type==="mousedown"||r.type==="mousemove";return l?!0:i?P==="scroll"?!0:r.ctrlKey:s&&!r.button&&!r.ctrlKey},n=re.zoom().scaleExtent(De).translateExtent(Me||[[-20,-20],[g+20,E+20]]).filter(y).on("zoom",({transform:r})=>{o.attr("transform",r)});a.call(n),ce.current=n},[E,g,P]);const H=re.turf_bbox_default(w),R=xt.turf_center_of_mass_default(w),me=H[2]-H[0],z=H[3]-H[1],we=g*190/960*360/me,Ce=E*190/678*180/z,_=v*Math.min(we,Ce),q=O==="mercator"?re.geoMercator().rotate([0,0]).center(B||R.geometry.coordinates).translate([g/2,E/2]).scale(_):O==="equalEarth"?re.geoEqualEarth().rotate([0,0]).center(B||R.geometry.coordinates).translate([g/2,E/2]).scale(_):O==="naturalEarth"?re.geoNaturalEarth1().rotate([0,0]).center(B||R.geometry.coordinates).translate([g/2,E/2]).scale(_):O==="orthographic"?re.geoOrthographic().rotate([0,0]).center(B||R.geometry.coordinates).translate([g/2,E/2]).scale(_):re.geoAlbersUsa().rotate([0,0]).center(B||R.geometry.coordinates).translate([g/2,E/2]).scale(_),he=o=>{if(!A.current||!ce.current)return;ot.select(A.current).call(ce.current.scaleBy,o==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(Ge.motion.svg,{width:`${g}px`,height:`${E}px`,viewBox:`0 0 ${g} ${E}`,ref:A,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:K,children:[le.filter(o=>o.position==="before").map(o=>o.layer),w.features.map((o,a)=>e.findIndex(n=>n.id===o.properties[k])!==-1?null:t.jsxRuntimeExports.jsx("g",{opacity:M?I:U.length!==0?U.indexOf(o.properties[k])!==-1?1:I:1,children:o.geometry.type==="MultiPolygon"?o.geometry.coordinates.map((n,r)=>{let i="";return n.forEach(l=>{let s=" M";l.forEach((u,S)=>{const C=q([u[0],u[1]]);S!==l.length-1?s=`${s}${C[0]} ${C[1]}L`:s=`${s}${C[0]} ${C[1]}`}),i+=s}),t.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:G,strokeWidth:F,fill:se}},r)}):o.geometry.coordinates.map((n,r)=>{let i="M";return n.forEach((l,s)=>{const u=q([l[0],l[1]]);s!==n.length-1?i=`${i}${u[0]} ${u[1]}L`:i=`${i}${u[0]} ${u[1]}`}),t.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:G,strokeWidth:F,fill:se}},r)})},a)),t.jsxRuntimeExports.jsx(kt.AnimatePresence,{children:e.map(o=>{const a=w.features.findIndex(n=>o.id===n.properties[k]),y=jt.checkIfNullOrUndefined(o.x)?se:Pe(o.x);return t.jsxRuntimeExports.jsx(Ge.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:M?M===y?1:I:U.length!==0?U.indexOf(o.id)!==-1?1:I:1,transition:{duration:$.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:$.duration}},onMouseEnter:n=>{J(o),ue(n.clientY),m(n.clientX),ie?.(o)},onMouseMove:n=>{J(o),ue(n.clientY),m(n.clientX)},onMouseLeave:()=>{J(void 0),m(void 0),ue(void 0),ie?.(void 0)},onClick:()=>{(ae||D)&&(mt.isEqual(V,o)&&be?(X(void 0),ae?.(void 0)):(X(o),ae?.(o)))},children:a===-1?null:w.features[a].geometry.type==="MultiPolygon"?w.features[a].geometry.coordinates.map((n,r)=>{let i="";return n.forEach(l=>{let s=" M";l.forEach((u,S)=>{const C=q([u[0],u[1]]);S!==l.length-1?s=`${s}${C[0]} ${C[1]}L`:s=`${s}${C[0]} ${C[1]}`}),i+=s}),t.jsxRuntimeExports.jsx(Ge.motion.path,{d:i,variants:{initial:{fill:y,opacity:0},whileInView:{fill:y,opacity:1,transition:{duration:$.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:$.duration}},style:{stroke:G,strokeWidth:F}},`${o.id}-${r}`)}):w.features[a].geometry.coordinates.map((n,r)=>{let i="M";return n.forEach((l,s)=>{const u=q([l[0],l[1]]);s!==n.length-1?i=`${i}${u[0]} ${u[1]}L`:i=`${i}${u[0]} ${u[1]}`}),t.jsxRuntimeExports.jsx(Ge.motion.path,{d:i,variants:{initial:{fill:y,opacity:0},whileInView:{fill:y,opacity:1,transition:{duration:$.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:$.duration}},style:{stroke:G,strokeWidth:F}},`${o.id}-${r}`)})},o.id)})}),Y?w.features.filter(o=>o.properties[k]===Y.id).map((o,a)=>t.jsxRuntimeExports.jsx("g",{children:o.geometry.type==="MultiPolygon"?o.geometry.coordinates.map((y,n)=>{let r="";return y.forEach(i=>{let l=" M";i.forEach((s,u)=>{const S=q([s[0],s[1]]);u!==i.length-1?l=`${l}${S[0]} ${S[1]}L`:l=`${l}${S[0]} ${S[1]}`}),r+=l}),t.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},n)}):o.geometry.coordinates.map((y,n)=>{let r="M";return y.forEach((i,l)=>{const s=q([i[0],i[1]]);l!==y.length-1?r=`${r}${s[0]} ${s[1]}L`:r=`${r}${s[0]} ${s[1]}`}),t.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},n)})},a)):null,le.filter(o=>o.position==="after").map(o=>o.layer)]})}),ve===!1?null:t.jsxRuntimeExports.jsx("div",{className:t.mo("absolute left-4 bottom-4 map-color-legend",Ee?.colorLegend),children:Oe?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{Re(!1)},children:t.jsxRuntimeExports.jsx(rt.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]",style:{width:W?void 0:"340px"},children:[N&&N!==""?t.jsxRuntimeExports.jsx(at.j,{size:"xs",marginBottom:"xs",className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:N}):null,W?t.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:c.map((o,a)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{L(d[a%d.length])},onMouseLeave:()=>{L(void 0)},children:[t.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:d[a%d.length]}}),t.jsxRuntimeExports.jsx(at.j,{size:"sm",marginBottom:"none",leading:"none",children:o})]},a))}):t.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{children:[c.map((o,a)=>t.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{L(d[a])},onMouseLeave:()=>{L(void 0)},className:"cursor-pointer",children:[t.jsxRuntimeExports.jsx("rect",{x:a*320/d.length+1,y:1,width:320/d.length-2,height:8,className:M===d[a]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":"",style:{fill:d[a],...M===d[a]?{}:{stroke:d[a]}}}),t.jsxRuntimeExports.jsx("text",{x:(a+1)*320/d.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:gt.numberFormattingFunction(o,"NA")})]},a)),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("rect",{onMouseOver:()=>{L(d[c.length])},onMouseLeave:()=>{L(void 0)},x:c.length*320/d.length+1,y:1,width:320/d.length-2,height:8,className:`cursor-pointer ${M===d[c.length]?"stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:d[c.length],...M===d[c.length]?{}:{stroke:d[c.length]}}})})]})})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start map-legend-button",onClick:()=>{Re(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),P==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>he("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>he("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),D&&V!==void 0?t.jsxRuntimeExports.jsx(ht.le,{open:V!==void 0,onClose:()=>{X(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof D=="string"?{__html:ft.string2HTML(D,V)}:void 0,children:typeof D=="function"?D(V):null})}):null,Y&&ne&&x&&de?t.jsxRuntimeExports.jsx(yt.Tooltip,{data:Y,body:ne,xPos:x,yPos:de,backgroundStyle:qe?.tooltip,className:Ee?.tooltip}):null]})}function Ot(h){const e=t.compilerRuntimeExports.c(106),{data:c,mapData:d,graphTitle:w,colors:N,sources:W,graphDescription:E,height:g,width:v,footNote:B,colorDomain:ne,colorLegendTitle:F,scaleType:G,scale:se,centerPoint:ie,padding:ve,mapBorderWidth:De,mapNoDataColor:Me,backgroundColor:U,mapBorderColor:ae,relativeHeight:k,tooltip:be,onSeriesMouseOver:D,isWorldMap:qe,showColorScale:Ee,zoomScaleExtend:O,zoomTranslateExtend:P,graphID:$,highlightedIds:I,onSeriesMouseClick:le,mapProperty:ke,graphDownload:M,dataDownload:L,showAntarctica:ce,language:Oe,minHeight:Re,theme:V,ariaLabel:X,resetSelectionOnDoubleClick:Y,detailsOnClick:J,styles:x,classNames:m,mapProjection:de,zoomInteraction:ue,animate:A,dimmedOpacity:pe,customLayers:K,timeline:Pe,collapseColorScaleByDefault:H}=h,R=d===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":d,me=B===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.":B,z=G===void 0?"threshold":G,we=se===void 0?.95:se,Ce=De===void 0?.5:De,_=Me===void 0?Ue.Colors.light.graphNoData:Me,q=U===void 0?!1:U,he=ae===void 0?Ue.Colors.light.grays["gray-500"]:ae,o=qe===void 0?!0:qe,a=Ee===void 0?!0:Ee;let y;e[0]!==O?(y=O===void 0?[.8,6]:O,e[0]=O,e[1]=y):y=e[1];const n=y;let r;e[2]!==I?(r=I===void 0?[]:I,e[2]=I,e[3]=r):r=e[3];const i=r,l=ke===void 0?"ISO3":ke,s=M===void 0?!1:M,u=L===void 0?!1:L,S=ce===void 0?!1:ce,C=Oe===void 0?"en":Oe,T=Re===void 0?0:Re,Z=V===void 0?"light":V,Xe=Y===void 0?!0:Y,Ye=ue===void 0?"button":ue,Ie=A===void 0?!1:A,Je=pe===void 0?.3:pe;let Le;e[4]!==K?(Le=K===void 0?[]:K,e[4]=K,e[5]=Le):Le=e[5];const Ke=Le,b=Pe===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:Pe,[Q,ct]=p.useState(0),[$e,dt]=p.useState(0),[ee,Ze]=p.useState(b.autoplay),f=Dt.sort(Nt.uniqBy(c,"date",!0).map(j=>it.parse(`${j}`,b.dateFormat||"yyyy",new Date).getTime()),Bt),[te,Se]=p.useState(b.autoplay?0:f.length-1),[xe,ut]=p.useState(void 0),Qe=p.useRef(null),nt=p.useRef(null);let ze,_e;e[6]===Symbol.for("react.memo_cache_sentinel")?(ze=()=>{const j=new ResizeObserver(oe=>{ct(oe[0].target.clientWidth||620),dt(oe[0].target.clientHeight||480)});return Qe.current&&j.observe(Qe.current),()=>j.disconnect()},_e=[],e[6]=ze,e[7]=_e):(ze=e[6],_e=e[7]),p.useEffect(ze,_e);let Te;e[8]===Symbol.for("react.memo_cache_sentinel")?(Te=j=>{ut(j)},e[8]=Te):Te=e[8];const We=p.useEffectEvent(Te);let Be;e[9]!==R||e[10]!==We?(Be=()=>{typeof R=="string"?Ct.fetchAndParseJSON(R).then(oe=>{We(oe)}):We(R)},e[9]=R,e[10]=We,e[11]=Be):Be=e[11];let Fe;e[12]!==R?(Fe=[R],e[12]=R,e[13]=Fe):Fe=e[13],p.useEffect(Be,Fe);let Ve;e[14]!==ne||e[15]!==N?.length||e[16]!==c||e[17]!==z?(Ve=ne||(z==="categorical"?$t.getUniqValue(c,"x"):St.getJenks(c.map(Wt),N?.length||4)),e[14]=ne,e[15]=N?.length,e[16]=c,e[17]=z,e[18]=Ve):Ve=e[18];const Ne=Ve;p.useEffect(()=>{const j=setInterval(()=>{Se(oe=>oe<f.length-1?oe+1:0)},(b.speed||2)*1e3);return ee||clearInterval(j),()=>clearInterval(j)},[f,ee,b.speed]);const Ae=st.getSliderMarks(f,te,b.showOnlyActiveDate,b.dateFormat||"yyyy"),et=m?.graphContainer,tt=x?.graphContainer;let ge;e[19]!==m?.description||e[20]!==m?.title||e[21]!==c||e[22]!==u||e[23]!==E||e[24]!==s||e[25]!==w||e[26]!==x?.description||e[27]!==x?.title||e[28]!==v?(ge=w||E||s||u?t.jsxRuntimeExports.jsx(wt.GraphHeader,{styles:{title:x?.title,description:x?.description},classNames:{title:m?.title,description:m?.description},graphTitle:w,graphDescription:E,width:v,graphDownload:s?nt:void 0,dataDownload:u?c.map(Tt).filter(_t).length>0?c.map(zt).filter(Lt):c.filter(It):null}):null,e[19]=m?.description,e[20]=m?.title,e[21]=c,e[22]=u,e[23]=E,e[24]=s,e[25]=w,e[26]=x?.description,e[27]=x?.title,e[28]=v,e[29]=ge):ge=e[29];let ye;e[30]!==te||e[31]!==Ae||e[32]!==ee||e[33]!==Se||e[34]!==Ze||e[35]!==b.enabled||e[36]!==f?(ye=b.enabled&&f.length>0&&Ae?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Ze(!ee)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":ee?"Click to pause animation":"Click to play animation",children:ee?t.jsxRuntimeExports.jsx(rt.Pause,{}):t.jsxRuntimeExports.jsx(rt.Play,{})}),t.jsxRuntimeExports.jsx(st.Nr,{min:f[0],max:f[f.length-1],marks:Ae,step:null,defaultValue:f[f.length-1],value:f[te],onChangeComplete:j=>{Se(f.indexOf(j))},onChange:j=>{Se(f.indexOf(j))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[30]=te,e[31]=Ae,e[32]=ee,e[33]=Se,e[34]=Ze,e[35]=b.enabled,e[36]=f,e[37]=ye):ye=e[37];let fe;e[38]!==Ie||e[39]!==ie||e[40]!==m||e[41]!==H||e[42]!==F||e[43]!==N||e[44]!==Ke||e[45]!==c||e[46]!==J||e[47]!==Je||e[48]!==Ne||e[49]!==g||e[50]!==i||e[51]!==te||e[52]!==o||e[53]!==he||e[54]!==Ce||e[55]!==_||e[56]!==de||e[57]!==l||e[58]!==xe||e[59]!==T||e[60]!==le||e[61]!==D||e[62]!==k||e[63]!==Xe||e[64]!==we||e[65]!==z||e[66]!==S||e[67]!==a||e[68]!==x||e[69]!==$e||e[70]!==Q||e[71]!==Z||e[72]!==b.dateFormat||e[73]!==b.enabled||e[74]!==be||e[75]!==f||e[76]!==v||e[77]!==Ye||e[78]!==n||e[79]!==P?(fe=t.jsxRuntimeExports.jsx(lt.GraphArea,{ref:Qe,children:Q&&$e&&xe?t.jsxRuntimeExports.jsx(qt,{data:c.filter(j=>b.enabled?j.date===it.format(new Date(f[te]),b.dateFormat||"yyyy"):j),mapData:S?xe:{...xe,features:xe.features.filter(Pt)},colorDomain:Ne,width:Q,height:$e,scale:we,centerPoint:ie,colors:N||(z==="categorical"?Ue.Colors[Z].sequentialColors[`neutralColorsx0${Ne.length}`]:Ue.Colors[Z].sequentialColors[`neutralColorsx0${Ne.length+1}`]),colorLegendTitle:F,mapBorderWidth:Ce,mapNoDataColor:_,categorical:z==="categorical",mapBorderColor:he,tooltip:be,onSeriesMouseOver:D,isWorldMap:o,showColorScale:a,zoomScaleExtend:n,zoomTranslateExtend:P,onSeriesMouseClick:le,mapProperty:l,highlightedIds:i,resetSelectionOnDoubleClick:Xe,styles:x,classNames:m,detailsOnClick:J,mapProjection:de||(o?"naturalEarth":"mercator"),zoomInteraction:Ye,dimmedOpacity:Je,animate:Ie===!0?{duration:.5,once:!0,amount:.5}:Ie||{duration:0,once:!0,amount:0},customLayers:Ke,collapseColorScaleByDefault:H}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(T,g||(k?T?(v||Q)*k>T?(v||Q)*k:T:(v||Q)*k:$e))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(pt.w,{"aria-label":"Loading graph"})})}),e[38]=Ie,e[39]=ie,e[40]=m,e[41]=H,e[42]=F,e[43]=N,e[44]=Ke,e[45]=c,e[46]=J,e[47]=Je,e[48]=Ne,e[49]=g,e[50]=i,e[51]=te,e[52]=o,e[53]=he,e[54]=Ce,e[55]=_,e[56]=de,e[57]=l,e[58]=xe,e[59]=T,e[60]=le,e[61]=D,e[62]=k,e[63]=Xe,e[64]=we,e[65]=z,e[66]=S,e[67]=a,e[68]=x,e[69]=$e,e[70]=Q,e[71]=Z,e[72]=b.dateFormat,e[73]=b.enabled,e[74]=be,e[75]=f,e[76]=v,e[77]=Ye,e[78]=n,e[79]=P,e[80]=fe):fe=e[80];let je;e[81]!==m?.footnote||e[82]!==m?.source||e[83]!==me||e[84]!==W||e[85]!==x?.footnote||e[86]!==x?.source||e[87]!==v?(je=W||me?t.jsxRuntimeExports.jsx(Rt.GraphFooter,{styles:{footnote:x?.footnote,source:x?.source},classNames:{footnote:m?.footnote,source:m?.source},sources:W,footNote:me,width:v}):null,e[81]=m?.footnote,e[82]=m?.source,e[83]=me,e[84]=W,e[85]=x?.footnote,e[86]=x?.source,e[87]=v,e[88]=je):je=e[88];let He;return e[89]!==X||e[90]!==q||e[91]!==$||e[92]!==g||e[93]!==C||e[94]!==T||e[95]!==ve||e[96]!==k||e[97]!==et||e[98]!==tt||e[99]!==ge||e[100]!==ye||e[101]!==fe||e[102]!==je||e[103]!==Z||e[104]!==v?(He=t.jsxRuntimeExports.jsxs(lt.GraphContainer,{className:et,style:tt,id:$,ref:nt,"aria-label":X,backgroundColor:q,theme:Z,language:C,minHeight:T,width:v,height:g,relativeHeight:k,padding:ve,children:[ge,ye,fe,je]}),e[89]=X,e[90]=q,e[91]=$,e[92]=g,e[93]=C,e[94]=T,e[95]=ve,e[96]=k,e[97]=et,e[98]=tt,e[99]=ge,e[100]=ye,e[101]=fe,e[102]=je,e[103]=Z,e[104]=v,e[105]=He):He=e[105],He}function Pt(h){return h.properties.NAME!=="Antarctica"}function It(h){return h!==void 0}function Lt(h){return h!==void 0}function zt(h){return h.data}function _t(h){return h!==void 0}function Tt(h){return h.data}function Wt(h){return h.x}function Bt(h,e){return Mt.ascending(h,e)}exports.ChoroplethMap=Ot;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-CTPQjnHt.cjs"),p=require("react"),st=require("./getSliderMarks-BmADcPQt.cjs"),pt=require("./Spinner-DRMBUsX7.cjs"),it=require("./parse-hMnG_lRV.cjs"),mt=require("./index-DQA8q5sC.cjs"),re=require("./zoom-DPw8bba-.cjs"),ht=require("./Modal-JW_IExO3.cjs"),at=require("./Typography-DX7PlgQU.cjs"),xt=require("./index-DxXnJ8Ti.cjs"),gt=require("./numberFormattingFunction-02t-wJta.cjs"),yt=require("./Tooltip-4dJo4_AF.cjs"),ft=require("./string2HTML-CPGr_I5E.cjs"),jt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),rt=require("./index-DRXx7m-C.cjs"),vt=require("./ordinal-CrsysVE-.cjs"),bt=require("./threshold-DNsSUf8Q.cjs"),ot=require("./select-Bnfk0lJx.cjs"),Et=require("./use-in-view-QcfiW0w3.cjs"),Ge=require("./proxy-BxvUI_9l.cjs"),kt=require("./index-DG2bgAva.cjs"),Rt=require("./GraphFooter.cjs"),wt=require("./GraphHeader.cjs"),Ue=require("./Colors.cjs"),Ct=require("./fetchAndParseData-l5HGMAEs.cjs"),St=require("./getUniqValue-RViz8tTw.cjs"),$t=require("./getJenks-GYmdwBqm.cjs"),Nt=require("./uniqBy-O05lp2S5.cjs"),lt=require("./GraphContainer-d8A46BK2.cjs"),Dt=require("./sort-O96oMZLb.cjs"),Mt=require("./init-DU0ybBc_.cjs");function qt(h){const{data:e,colorDomain:c,colors:d,mapData:w,colorLegendTitle:N,categorical:W,height:E,width:g,scale:v,centerPoint:B,tooltip:ne,mapBorderWidth:F,mapBorderColor:G,mapNoDataColor:se,onSeriesMouseOver:ie,showColorScale:ve,zoomScaleExtend:Ne,zoomTranslateExtend:De,highlightedIds:U,onSeriesMouseClick:ae,mapProperty:k,resetSelectionOnDoubleClick:be,detailsOnClick:D,styles:Me,classNames:Ee,mapProjection:O,zoomInteraction:P,animate:S,dimmedOpacity:I,customLayers:le,collapseColorScaleByDefault:ke}=h,[M,L]=p.useState(void 0),ce=p.useRef(null),[qe,Re]=p.useState(ke===void 0?!(g<680):!ke),[V,X]=p.useState(void 0),[Y,J]=p.useState(void 0),[x,m]=p.useState(void 0),[de,ue]=p.useState(void 0),A=p.useRef(null),pe=Et.useInView(A,{once:S.once,amount:S.amount}),K=p.useRef(null),Oe=W?vt.ordinal().domain(c).range(d):bt.threshold().domain(c).range(d);p.useEffect(()=>{const o=ot.select(K.current),a=ot.select(A.current),y=r=>{if(P==="noZoom")return!1;if(P==="button")return!r.type.includes("wheel");const i=r.type==="wheel",l=r.type.startsWith("touch"),s=r.type==="mousedown"||r.type==="mousemove";return l?!0:i?P==="scroll"?!0:r.ctrlKey:s&&!r.button&&!r.ctrlKey},n=re.zoom().scaleExtent(Ne).translateExtent(De||[[-20,-20],[g+20,E+20]]).filter(y).on("zoom",({transform:r})=>{o.attr("transform",r)});a.call(n),ce.current=n},[E,g,P]);const H=re.turf_bbox_default(w),R=xt.turf_center_of_mass_default(w),me=H[2]-H[0],z=H[3]-H[1],we=g*190/960*360/me,Ce=E*190/678*180/z,_=v*Math.min(we,Ce),q=O==="mercator"?re.geoMercator().rotate([0,0]).center(B||R.geometry.coordinates).translate([g/2,E/2]).scale(_):O==="equalEarth"?re.geoEqualEarth().rotate([0,0]).center(B||R.geometry.coordinates).translate([g/2,E/2]).scale(_):O==="naturalEarth"?re.geoNaturalEarth1().rotate([0,0]).center(B||R.geometry.coordinates).translate([g/2,E/2]).scale(_):O==="orthographic"?re.geoOrthographic().rotate([0,0]).center(B||R.geometry.coordinates).translate([g/2,E/2]).scale(_):re.geoAlbersUsa().rotate([0,0]).center(B||R.geometry.coordinates).translate([g/2,E/2]).scale(_),he=o=>{if(!A.current||!ce.current)return;ot.select(A.current).call(ce.current.scaleBy,o==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(Ge.motion.svg,{width:`${g}px`,height:`${E}px`,viewBox:`0 0 ${g} ${E}`,ref:A,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:K,children:[le.filter(o=>o.position==="before").map(o=>o.layer),w.features.map((o,a)=>e.findIndex(n=>n.id===o.properties[k])!==-1?null:t.jsxRuntimeExports.jsx("g",{opacity:M?I:U.length!==0?U.indexOf(o.properties[k])!==-1?1:I:1,children:o.geometry.type==="MultiPolygon"?o.geometry.coordinates.map((n,r)=>{let i="";return n.forEach(l=>{let s=" M";l.forEach((u,$)=>{const C=q([u[0],u[1]]);$!==l.length-1?s=`${s}${C[0]} ${C[1]}L`:s=`${s}${C[0]} ${C[1]}`}),i+=s}),t.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:G,strokeWidth:F,fill:se}},r)}):o.geometry.coordinates.map((n,r)=>{let i="M";return n.forEach((l,s)=>{const u=q([l[0],l[1]]);s!==n.length-1?i=`${i}${u[0]} ${u[1]}L`:i=`${i}${u[0]} ${u[1]}`}),t.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:G,strokeWidth:F,fill:se}},r)})},a)),t.jsxRuntimeExports.jsx(kt.AnimatePresence,{children:e.map(o=>{const a=w.features.findIndex(n=>o.id===n.properties[k]),y=jt.checkIfNullOrUndefined(o.x)?se:Oe(o.x);return t.jsxRuntimeExports.jsx(Ge.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:M?M===y?1:I:U.length!==0?U.indexOf(o.id)!==-1?1:I:1,transition:{duration:S.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},onMouseEnter:n=>{J(o),ue(n.clientY),m(n.clientX),ie?.(o)},onMouseMove:n=>{J(o),ue(n.clientY),m(n.clientX)},onMouseLeave:()=>{J(void 0),m(void 0),ue(void 0),ie?.(void 0)},onClick:()=>{(ae||D)&&(mt.isEqual(V,o)&&be?(X(void 0),ae?.(void 0)):(X(o),ae?.(o)))},children:a===-1?null:w.features[a].geometry.type==="MultiPolygon"?w.features[a].geometry.coordinates.map((n,r)=>{let i="";return n.forEach(l=>{let s=" M";l.forEach((u,$)=>{const C=q([u[0],u[1]]);$!==l.length-1?s=`${s}${C[0]} ${C[1]}L`:s=`${s}${C[0]} ${C[1]}`}),i+=s}),t.jsxRuntimeExports.jsx(Ge.motion.path,{d:i,variants:{initial:{fill:y,opacity:0},whileInView:{fill:y,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},style:{stroke:G,strokeWidth:F}},`${o.id}-${r}`)}):w.features[a].geometry.coordinates.map((n,r)=>{let i="M";return n.forEach((l,s)=>{const u=q([l[0],l[1]]);s!==n.length-1?i=`${i}${u[0]} ${u[1]}L`:i=`${i}${u[0]} ${u[1]}`}),t.jsxRuntimeExports.jsx(Ge.motion.path,{d:i,variants:{initial:{fill:y,opacity:0},whileInView:{fill:y,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:pe?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},style:{stroke:G,strokeWidth:F}},`${o.id}-${r}`)})},o.id)})}),Y?w.features.filter(o=>o.properties[k]===Y.id).map((o,a)=>t.jsxRuntimeExports.jsx("g",{children:o.geometry.type==="MultiPolygon"?o.geometry.coordinates.map((y,n)=>{let r="";return y.forEach(i=>{let l=" M";i.forEach((s,u)=>{const $=q([s[0],s[1]]);u!==i.length-1?l=`${l}${$[0]} ${$[1]}L`:l=`${l}${$[0]} ${$[1]}`}),r+=l}),t.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},n)}):o.geometry.coordinates.map((y,n)=>{let r="M";return y.forEach((i,l)=>{const s=q([i[0],i[1]]);l!==y.length-1?r=`${r}${s[0]} ${s[1]}L`:r=`${r}${s[0]} ${s[1]}`}),t.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},n)})},a)):null,le.filter(o=>o.position==="after").map(o=>o.layer)]})}),ve===!1?null:t.jsxRuntimeExports.jsx("div",{className:t.mo("absolute left-4 bottom-4 map-color-legend",Ee?.colorLegend),children:qe?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{Re(!1)},children:t.jsxRuntimeExports.jsx(rt.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]",style:{width:W?void 0:"340px"},children:[N&&N!==""?t.jsxRuntimeExports.jsx(at.j,{size:"xs",marginBottom:"xs",className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:N}):null,W?t.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:c.map((o,a)=>t.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{L(d[a%d.length])},onMouseLeave:()=>{L(void 0)},children:[t.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:d[a%d.length]}}),t.jsxRuntimeExports.jsx(at.j,{size:"sm",marginBottom:"none",leading:"none",children:o})]},a))}):t.jsxRuntimeExports.jsx("svg",{width:"100%",viewBox:"0 0 320 30",direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{children:[c.map((o,a)=>t.jsxRuntimeExports.jsxs("g",{onMouseOver:()=>{L(d[a])},onMouseLeave:()=>{L(void 0)},className:"cursor-pointer",children:[t.jsxRuntimeExports.jsx("rect",{x:a*320/d.length+1,y:1,width:320/d.length-2,height:8,className:M===d[a]?"stroke-primary-gray-700 dark:stroke-primary-gray-300":"",style:{fill:d[a],...M===d[a]?{}:{stroke:d[a]}}}),t.jsxRuntimeExports.jsx("text",{x:(a+1)*320/d.length,y:25,className:"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",style:{textAnchor:"middle"},children:gt.numberFormattingFunction(o,"NA")})]},a)),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx("rect",{onMouseOver:()=>{L(d[c.length])},onMouseLeave:()=>{L(void 0)},x:c.length*320/d.length+1,y:1,width:320/d.length-2,height:8,className:`cursor-pointer ${M===d[c.length]?"stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300":""}`,style:{fill:d[c.length],...M===d[c.length]?{}:{stroke:d[c.length]}}})})]})})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start map-legend-button",onClick:()=>{Re(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),P==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>he("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>he("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),D&&V!==void 0?t.jsxRuntimeExports.jsx(ht.le,{open:V!==void 0,onClose:()=>{X(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof D=="string"?{__html:ft.string2HTML(D,V)}:void 0,children:typeof D=="function"?D(V):null})}):null,Y&&ne&&x&&de?t.jsxRuntimeExports.jsx(yt.Tooltip,{data:Y,body:ne,xPos:x,yPos:de,backgroundStyle:Me?.tooltip,className:Ee?.tooltip}):null]})}function Ot(h){const e=t.compilerRuntimeExports.c(106),{data:c,mapData:d,graphTitle:w,colors:N,sources:W,graphDescription:E,height:g,width:v,footNote:B,colorDomain:ne,colorLegendTitle:F,scaleType:G,scale:se,centerPoint:ie,padding:ve,mapBorderWidth:Ne,mapNoDataColor:De,backgroundColor:U,mapBorderColor:ae,relativeHeight:k,tooltip:be,onSeriesMouseOver:D,isWorldMap:Me,showColorScale:Ee,zoomScaleExtend:O,zoomTranslateExtend:P,graphID:S,highlightedIds:I,onSeriesMouseClick:le,mapProperty:ke,graphDownload:M,dataDownload:L,showAntarctica:ce,language:qe,minHeight:Re,theme:V,ariaLabel:X,resetSelectionOnDoubleClick:Y,detailsOnClick:J,styles:x,classNames:m,mapProjection:de,zoomInteraction:ue,animate:A,dimmedOpacity:pe,customLayers:K,timeline:Oe,collapseColorScaleByDefault:H}=h,R=d===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":d,me=B===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.":B,z=G===void 0?"threshold":G,we=se===void 0?.95:se,Ce=Ne===void 0?.5:Ne,_=De===void 0?Ue.Colors.light.graphNoData:De,q=U===void 0?!1:U,he=ae===void 0?Ue.Colors.light.grays["gray-500"]:ae,o=Me===void 0?!0:Me,a=Ee===void 0?!0:Ee;let y;e[0]!==O?(y=O===void 0?[.8,6]:O,e[0]=O,e[1]=y):y=e[1];const n=y;let r;e[2]!==I?(r=I===void 0?[]:I,e[2]=I,e[3]=r):r=e[3];const i=r,l=ke===void 0?"ISO3":ke,s=M===void 0?!1:M,u=L===void 0?!1:L,$=ce===void 0?!1:ce,C=qe===void 0?"en":qe,T=Re===void 0?0:Re,Z=V===void 0?"light":V,Xe=Y===void 0?!0:Y,Ye=ue===void 0?"button":ue,Pe=A===void 0?!1:A,Je=pe===void 0?.3:pe;let Ie;e[4]!==K?(Ie=K===void 0?[]:K,e[4]=K,e[5]=Ie):Ie=e[5];const Ke=Ie,b=Oe===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:Oe,[Q,ct]=p.useState(0),[Se,dt]=p.useState(0),[ee,Ze]=p.useState(b.autoplay),f=Dt.sort(Nt.uniqBy(c,"date",!0).map(j=>it.parse(`${j}`,b.dateFormat||"yyyy",new Date).getTime()),Bt),[te,$e]=p.useState(b.autoplay?0:f.length-1),[xe,ut]=p.useState(void 0),Qe=p.useRef(null),nt=p.useRef(null);let Le,ze;e[6]===Symbol.for("react.memo_cache_sentinel")?(Le=()=>{const j=new ResizeObserver(oe=>{ct(oe[0].target.clientWidth||620),dt(oe[0].target.clientHeight||480)});return Qe.current&&j.observe(Qe.current),()=>j.disconnect()},ze=[],e[6]=Le,e[7]=ze):(Le=e[6],ze=e[7]),p.useEffect(Le,ze);let _e;e[8]===Symbol.for("react.memo_cache_sentinel")?(_e=j=>{ut(j)},e[8]=_e):_e=e[8];const Te=p.useEffectEvent(_e);let We;e[9]!==R||e[10]!==Te?(We=()=>{typeof R=="string"?Ct.fetchAndParseJSON(R).then(oe=>{Te(oe)}):Te(R)},e[9]=R,e[10]=Te,e[11]=We):We=e[11];let Be;e[12]!==R?(Be=[R],e[12]=R,e[13]=Be):Be=e[13],p.useEffect(We,Be);let Fe;e[14]!==ne||e[15]!==N?.length||e[16]!==c||e[17]!==z?(Fe=ne||(z==="categorical"?St.getUniqValue(c,"x"):$t.getJenks(c.map(Wt),N?.length||4)),e[14]=ne,e[15]=N?.length,e[16]=c,e[17]=z,e[18]=Fe):Fe=e[18];const Ve=Fe;p.useEffect(()=>{const j=setInterval(()=>{$e(oe=>oe<f.length-1?oe+1:0)},(b.speed||2)*1e3);return ee||clearInterval(j),()=>clearInterval(j)},[f,ee,b.speed]);const Ae=st.getSliderMarks(f,te,b.showOnlyActiveDate,b.dateFormat||"yyyy"),et=m?.graphContainer,tt=x?.graphContainer;let ge;e[19]!==m?.description||e[20]!==m?.title||e[21]!==c||e[22]!==u||e[23]!==E||e[24]!==s||e[25]!==w||e[26]!==x?.description||e[27]!==x?.title||e[28]!==v?(ge=w||E||s||u?t.jsxRuntimeExports.jsx(wt.GraphHeader,{styles:{title:x?.title,description:x?.description},classNames:{title:m?.title,description:m?.description},graphTitle:w,graphDescription:E,width:v,graphDownload:s?nt:void 0,dataDownload:u?c.map(Tt).filter(_t).length>0?c.map(zt).filter(Lt):c.filter(It):null}):null,e[19]=m?.description,e[20]=m?.title,e[21]=c,e[22]=u,e[23]=E,e[24]=s,e[25]=w,e[26]=x?.description,e[27]=x?.title,e[28]=v,e[29]=ge):ge=e[29];let ye;e[30]!==te||e[31]!==Ae||e[32]!==ee||e[33]!==$e||e[34]!==Ze||e[35]!==b.enabled||e[36]!==f?(ye=b.enabled&&f.length>0&&Ae?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Ze(!ee)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":ee?"Click to pause animation":"Click to play animation",children:ee?t.jsxRuntimeExports.jsx(rt.Pause,{}):t.jsxRuntimeExports.jsx(rt.Play,{})}),t.jsxRuntimeExports.jsx(st.Nr,{min:f[0],max:f[f.length-1],marks:Ae,step:null,defaultValue:f[f.length-1],value:f[te],onChangeComplete:j=>{$e(f.indexOf(j))},onChange:j=>{$e(f.indexOf(j))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[30]=te,e[31]=Ae,e[32]=ee,e[33]=$e,e[34]=Ze,e[35]=b.enabled,e[36]=f,e[37]=ye):ye=e[37];let fe;e[38]!==Pe||e[39]!==ie||e[40]!==m||e[41]!==H||e[42]!==F||e[43]!==N||e[44]!==Ke||e[45]!==c||e[46]!==J||e[47]!==Je||e[48]!==Ve||e[49]!==g||e[50]!==i||e[51]!==te||e[52]!==o||e[53]!==he||e[54]!==Ce||e[55]!==_||e[56]!==de||e[57]!==l||e[58]!==xe||e[59]!==T||e[60]!==le||e[61]!==D||e[62]!==k||e[63]!==Xe||e[64]!==we||e[65]!==z||e[66]!==$||e[67]!==a||e[68]!==x||e[69]!==Se||e[70]!==Q||e[71]!==Z||e[72]!==b.dateFormat||e[73]!==b.enabled||e[74]!==be||e[75]!==f||e[76]!==v||e[77]!==Ye||e[78]!==n||e[79]!==P?(fe=t.jsxRuntimeExports.jsx(lt.GraphArea,{ref:Qe,children:Q&&Se&&xe?t.jsxRuntimeExports.jsx(qt,{data:c.filter(j=>b.enabled?j.date===it.format(new Date(f[te]),b.dateFormat||"yyyy"):j),mapData:$?xe:{...xe,features:xe.features.filter(Pt)},colorDomain:Ve,width:Q,height:Se,scale:we,centerPoint:ie,colors:N||(z==="categorical"?Ue.Colors[Z].categoricalColors.colors:Ue.Colors[Z].sequentialColors[`neutralColorsx0${Ve.length+1}`]),colorLegendTitle:F,mapBorderWidth:Ce,mapNoDataColor:_,categorical:z==="categorical",mapBorderColor:he,tooltip:be,onSeriesMouseOver:D,isWorldMap:o,showColorScale:a,zoomScaleExtend:n,zoomTranslateExtend:P,onSeriesMouseClick:le,mapProperty:l,highlightedIds:i,resetSelectionOnDoubleClick:Xe,styles:x,classNames:m,detailsOnClick:J,mapProjection:de||(o?"naturalEarth":"mercator"),zoomInteraction:Ye,dimmedOpacity:Je,animate:Pe===!0?{duration:.5,once:!0,amount:.5}:Pe||{duration:0,once:!0,amount:0},customLayers:Ke,collapseColorScaleByDefault:H}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(T,g||(k?T?(v||Q)*k>T?(v||Q)*k:T:(v||Q)*k:Se))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(pt.w,{"aria-label":"Loading graph"})})}),e[38]=Pe,e[39]=ie,e[40]=m,e[41]=H,e[42]=F,e[43]=N,e[44]=Ke,e[45]=c,e[46]=J,e[47]=Je,e[48]=Ve,e[49]=g,e[50]=i,e[51]=te,e[52]=o,e[53]=he,e[54]=Ce,e[55]=_,e[56]=de,e[57]=l,e[58]=xe,e[59]=T,e[60]=le,e[61]=D,e[62]=k,e[63]=Xe,e[64]=we,e[65]=z,e[66]=$,e[67]=a,e[68]=x,e[69]=Se,e[70]=Q,e[71]=Z,e[72]=b.dateFormat,e[73]=b.enabled,e[74]=be,e[75]=f,e[76]=v,e[77]=Ye,e[78]=n,e[79]=P,e[80]=fe):fe=e[80];let je;e[81]!==m?.footnote||e[82]!==m?.source||e[83]!==me||e[84]!==W||e[85]!==x?.footnote||e[86]!==x?.source||e[87]!==v?(je=W||me?t.jsxRuntimeExports.jsx(Rt.GraphFooter,{styles:{footnote:x?.footnote,source:x?.source},classNames:{footnote:m?.footnote,source:m?.source},sources:W,footNote:me,width:v}):null,e[81]=m?.footnote,e[82]=m?.source,e[83]=me,e[84]=W,e[85]=x?.footnote,e[86]=x?.source,e[87]=v,e[88]=je):je=e[88];let He;return e[89]!==X||e[90]!==q||e[91]!==S||e[92]!==g||e[93]!==C||e[94]!==T||e[95]!==ve||e[96]!==k||e[97]!==et||e[98]!==tt||e[99]!==ge||e[100]!==ye||e[101]!==fe||e[102]!==je||e[103]!==Z||e[104]!==v?(He=t.jsxRuntimeExports.jsxs(lt.GraphContainer,{className:et,style:tt,id:S,ref:nt,"aria-label":X,backgroundColor:q,theme:Z,language:C,minHeight:T,width:v,height:g,relativeHeight:k,padding:ve,children:[ge,ye,fe,je]}),e[89]=X,e[90]=q,e[91]=S,e[92]=g,e[93]=C,e[94]=T,e[95]=ve,e[96]=k,e[97]=et,e[98]=tt,e[99]=ge,e[100]=ye,e[101]=fe,e[102]=je,e[103]=Z,e[104]=v,e[105]=He):He=e[105],He}function Pt(h){return h.properties.NAME!=="Antarctica"}function It(h){return h!==void 0}function Lt(h){return h!==void 0}function zt(h){return h.data}function _t(h){return h!==void 0}function Tt(h){return h.data}function Wt(h){return h.x}function Bt(h,e){return Mt.ascending(h,e)}exports.ChoroplethMap=Ot;
|
|
2
2
|
//# sourceMappingURL=ChoroplethMap.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChoroplethMap.cjs","sources":["../src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx","../src/Components/Graphs/Maps/ChoroplethMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold, scaleOrdinal } from 'd3-scale';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport {\r\n AnimateDataType,\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\n\r\ninterface Props {\r\n colorDomain: (number | string)[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n width: number;\r\n height: number;\r\n colors: string[];\r\n colorLegendTitle?: string;\r\n categorical: boolean;\r\n data: ChoroplethMapDataType[];\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n mapBorderColor: string;\r\n isWorldMap: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n showColorScale: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\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 styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n collapseColorScaleByDefault?: boolean;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colorDomain,\r\n colors,\r\n mapData,\r\n colorLegendTitle,\r\n categorical,\r\n height,\r\n width,\r\n scale,\r\n centerPoint,\r\n tooltip,\r\n mapBorderWidth,\r\n mapBorderColor,\r\n mapNoDataColor,\r\n onSeriesMouseOver,\r\n showColorScale,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n } = props;\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\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 colorScale = categorical\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centerOfMass(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n 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 return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const color = !checkIfNullOrUndefined(d.x)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.x as any)\r\n : mapNoDataColor;\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n 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 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 >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={masterPath}\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 style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{\r\n width: categorical ? undefined : '340px',\r\n }}\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P\r\n size='xs'\r\n marginBottom='xs'\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n {!categorical ? (\r\n <svg width='100%' viewBox='0 0 320 30' direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g\r\n key={i}\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={(i * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={\r\n selectedColor === colors[i]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }\r\n style={{\r\n fill: colors[i],\r\n ...(selectedColor === colors[i] ? {} : { stroke: colors[i] }),\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * 320) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-xs'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n onMouseOver={() => {\r\n setSelectedColor(colors[colorDomain.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n x={(colorDomain.length * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={`cursor-pointer ${\r\n selectedColor === colors[colorDomain.length]\r\n ? 'stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n ...(selectedColor === colors[colorDomain.length]\r\n ? {}\r\n : { stroke: colors[colorDomain.length] }),\r\n }}\r\n />\r\n </g>\r\n </g>\r\n </svg>\r\n ) : (\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div\r\n key={i}\r\n className='flex gap-2 items-center'\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i % colors.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n >\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\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 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\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 </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect, useEffectEvent } 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 { ascending, sort } from 'd3-array';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n ChoroplethMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ScaleDataType,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { uniqBy } from '@/Utils/uniqBy';\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: ChoroplethMapDataType[];\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 */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: number[] | string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\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 /** 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 /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function ChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n graphTitle,\r\n colors,\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 colorDomain,\r\n colorLegendTitle,\r\n scaleType = 'threshold',\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 tooltip,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n showColorScale = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n collapseColorScaleByDefault,\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = sort(\r\n uniqBy(data, 'date', true).map(d =>\r\n parse(`${d}`, timeline.dateFormat || 'yyyy', new Date()).getTime(),\r\n ),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const onUpdateShape = useEffectEvent((shape: any) => {\r\n setMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n\r\n const domain =\r\n colorDomain ||\r\n (scaleType === 'categorical'\r\n ? getUniqValue(data, 'x')\r\n : getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors?.length || 4,\r\n ));\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 return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {svgWidth && svgHeight && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date === format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n colorDomain={domain}\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={\r\n colors ||\r\n (scaleType === 'categorical'\r\n ? Colors[theme].sequentialColors[\r\n `neutralColorsx0${domain.length as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ]\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${(domain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ])\r\n }\r\n colorLegendTitle={colorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n showColorScale={showColorScale}\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 classNames={classNames}\r\n detailsOnClick={detailsOnClick}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n zoomInteraction={zoomInteraction}\r\n dimmedOpacity={dimmedOpacity}\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 customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","colorDomain","colors","mapData","colorLegendTitle","categorical","height","width","scale","centerPoint","tooltip","mapBorderWidth","mapBorderColor","mapNoDataColor","onSeriesMouseOver","showColorScale","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","selectedColor","setSelectedColor","useState","undefined","zoomRef","useRef","showLegend","setShowLegend","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","isInView","useInView","once","amount","mapG","colorScale","scaleOrdinal","domain","range","scaleThreshold","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","handleZoom","direction","scaleBy","jsxs","Fragment","jsx","motion","d","position","map","layer","features","i","findIndex","el","id","properties","length","indexOf","j","masterPath","forEach","geo","path","c","k","point","stroke","strokeWidth","fill","AnimatePresence","index","color","checkIfNullOrUndefined","x","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","cn","colorLegend","X","P","display","WebkitLineClamp","WebkitBoxOrient","backgroundColor","textAnchor","numberFormattingFunction","Modal","__html","string2HTML","Tooltip","ChoroplethMap","$","_c","t0","graphTitle","sources","graphDescription","footNote","t1","scaleType","t2","t3","padding","t4","t5","t6","t7","relativeHeight","isWorldMap","t8","t9","t10","graphID","t11","t12","graphDownload","t13","dataDownload","t14","showAntarctica","t15","language","t16","minHeight","t17","theme","t18","ariaLabel","t19","t20","t21","t22","t23","timeline","t24","Colors","light","graphNoData","grays","t25","t26","t27","enabled","autoplay","showOnlyActiveDate","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","dateFormat","Date","getTime","_temp","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","t28","t29","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t30","shape","onUpdateShape","useEffectEvent","t31","fetchAndParseJSON","then","d_0","t32","t33","getUniqValue","getJenks","_temp2","interval","setInterval","speed","clearInterval","markObj","getSliderMarks","t34","graphContainer","t35","t36","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t37","Pause","Play","SliderUI","nextValue","nextValue_0","t38","GraphArea","d_7","date","format","_temp8","sequentialColors","max","Spinner","t39","footnote","source","GraphFooter","t40","GraphContainer","NAME","d_4","d_3","d_2","d_6","d_5","d_1","a","b","ascending"],"mappings":"muCA0EO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJC,KAAAA,EACAC,YAAAA,EACAC,OAAAA,EACAC,QAAAA,EACAC,iBAAAA,EACAC,YAAAA,EACAC,OAAAA,EACAC,MAAAA,EACAC,MAAAA,EACAC,YAAAA,EACAC,QAAAA,GACAC,eAAAA,EACAC,eAAAA,EACAC,eAAAA,GACAC,kBAAAA,GACAC,eAAAA,GACAC,gBAAAA,GACAC,oBAAAA,GACAC,eAAAA,EACAC,mBAAAA,GACAC,YAAAA,EACAC,4BAAAA,GACAC,eAAAA,EACAC,OAAAA,GACAC,WAAAA,GACAC,cAAAA,EACAC,gBAAAA,EACAC,QAAAA,EACAC,cAAAA,EACAC,aAAAA,GACAC,4BAAAA,EAAAA,EACE/B,EACE,CAACgC,EAAeC,CAAgB,EAAIC,EAAAA,SAA6BC,MAAS,EAC1EC,GAAUC,EAAAA,OAAoD,IAAI,EAClE,CAACC,GAAYC,EAAa,EAAIL,WAClCH,KAAgCI,OAAY,EAAE3B,EAAQ,KAAO,CAACuB,EAChE,EAEM,CAACS,EAAgBC,CAAiB,EAAIP,EAAAA,SAAcC,MAAS,EAE7D,CAACO,EAAeC,CAAgB,EAAIT,EAAAA,SAAcC,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,EAAArB,MAAA7J,EAAA6J,MAAA8B,EAAA9B,MAAAgC,EAAAhC,MAAAW,GAAAX,MAAAgB,EAAAhB,MAAAwG,GAAAxG,MAAA0G,GAAA1G,MAAA2G,GAAA3G,OAAAoH,GAAApH,OAAA0H,GAAA1H,OAAAmI,GAAAnI,OAAAkC,EAAAlC,OAAA5J,EAAA4J,OAAAuI,IAAAA,GAAAvI,EAAA,GAAA,EAnKjBuI,EAmKiB,CA1Rd,SAAAR,GAAA7K,EAAA,CAAA,OAyM4BA,EAAEE,WAAWqL,OAAU,YAAY,CAzM/D,SAAAtB,GAAAuB,EAAA,CAAA,OAwJ4B/L,IAAM5E,MAAS,CAxJ3C,SAAAmP,GAAAyB,EAAA,CAAA,OAuJ6ChM,IAAM5E,MAAS,CAvJ5D,SAAAkP,GAAA2B,EAAA,CAAA,OAuJyBjM,EAAC9G,IAAK,CAvJ/B,SAAAmR,GAAA6B,EAAA,CAAA,OAsJ2ClM,IAAM5E,MAAS,CAtJ1D,SAAAgP,GAAA+B,EAAA,CAAA,OAsJuBnM,EAAC9G,IAAK,CAtJ7B,SAAAoQ,GAAA8C,EAAA,CAAA,OAiGiBpM,EAAC2B,CAA+B,CAjGjD,SAAA6F,GAAA6E,EAAAC,EAAA,CAAA,OA0DOC,GAAAA,UAAUF,EAAGC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"ChoroplethMap.cjs","sources":["../src/Components/Graphs/Maps/ChoroplethMap/Graph.tsx","../src/Components/Graphs/Maps/ChoroplethMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold, scaleOrdinal } from 'd3-scale';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport {\r\n AnimateDataType,\r\n ChoroplethMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\n\r\ninterface Props {\r\n colorDomain: (number | string)[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n width: number;\r\n height: number;\r\n colors: string[];\r\n colorLegendTitle?: string;\r\n categorical: boolean;\r\n data: ChoroplethMapDataType[];\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n mapBorderColor: string;\r\n isWorldMap: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n showColorScale: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\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 styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n collapseColorScaleByDefault?: boolean;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colorDomain,\r\n colors,\r\n mapData,\r\n colorLegendTitle,\r\n categorical,\r\n height,\r\n width,\r\n scale,\r\n centerPoint,\r\n tooltip,\r\n mapBorderWidth,\r\n mapBorderColor,\r\n mapNoDataColor,\r\n onSeriesMouseOver,\r\n showColorScale,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n } = props;\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\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 colorScale = categorical\r\n ? scaleOrdinal<number | string, string>().domain(colorDomain).range(colors)\r\n : scaleThreshold<number, string>()\r\n .domain(colorDomain as number[])\r\n .range(colors);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centerOfMass(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n 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 return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const color = !checkIfNullOrUndefined(d.x)\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n colorScale(d.x as any)\r\n : mapNoDataColor;\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n 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 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 >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={masterPath}\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 style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{\r\n width: categorical ? undefined : '340px',\r\n }}\r\n >\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <P\r\n size='xs'\r\n marginBottom='xs'\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </P>\r\n ) : null}\r\n {!categorical ? (\r\n <svg width='100%' viewBox='0 0 320 30' direction='ltr'>\r\n <g>\r\n {colorDomain.map((d, i) => (\r\n <g\r\n key={i}\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n className='cursor-pointer'\r\n >\r\n <rect\r\n x={(i * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={\r\n selectedColor === colors[i]\r\n ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }\r\n style={{\r\n fill: colors[i],\r\n ...(selectedColor === colors[i] ? {} : { stroke: colors[i] }),\r\n }}\r\n />\r\n <text\r\n x={((i + 1) * 320) / colors.length}\r\n y={25}\r\n className='fill-primary-gray-700 dark:fill-primary-gray-300 text-xs'\r\n style={{ textAnchor: 'middle' }}\r\n >\r\n {numberFormattingFunction(d as number, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n <g>\r\n <rect\r\n onMouseOver={() => {\r\n setSelectedColor(colors[colorDomain.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n x={(colorDomain.length * 320) / colors.length + 1}\r\n y={1}\r\n width={320 / colors.length - 2}\r\n height={8}\r\n className={`cursor-pointer ${\r\n selectedColor === colors[colorDomain.length]\r\n ? 'stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n : ''\r\n }`}\r\n style={{\r\n fill: colors[colorDomain.length],\r\n ...(selectedColor === colors[colorDomain.length]\r\n ? {}\r\n : { stroke: colors[colorDomain.length] }),\r\n }}\r\n />\r\n </g>\r\n </g>\r\n </svg>\r\n ) : (\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div\r\n key={i}\r\n className='flex gap-2 items-center'\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i % colors.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n >\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start map-legend-button'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\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 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\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 </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect, useEffectEvent } 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 { ascending, sort } from 'd3-array';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n ChoroplethMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ScaleDataType,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getUniqValue } from '@/Utils/getUniqValue';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { uniqBy } from '@/Utils/uniqBy';\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: ChoroplethMapDataType[];\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 */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: number[] | string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Scale for the colors */\r\n scaleType?: Exclude<ScaleDataType, 'linear'>;\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 /** 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 /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function ChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n graphTitle,\r\n colors,\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 colorDomain,\r\n colorLegendTitle,\r\n scaleType = 'threshold',\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 tooltip,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n showColorScale = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n collapseColorScaleByDefault,\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = sort(\r\n uniqBy(data, 'date', true).map(d =>\r\n parse(`${d}`, timeline.dateFormat || 'yyyy', new Date()).getTime(),\r\n ),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const onUpdateShape = useEffectEvent((shape: any) => {\r\n setMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n\r\n const domain =\r\n colorDomain ||\r\n (scaleType === 'categorical'\r\n ? getUniqValue(data, 'x')\r\n : getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors?.length || 4,\r\n ));\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 return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {svgWidth && svgHeight && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date === format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n colorDomain={domain}\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={\r\n colors ||\r\n (scaleType === 'categorical'\r\n ? Colors[theme].categoricalColors.colors\r\n : Colors[theme].sequentialColors[\r\n `neutralColorsx0${(domain.length + 1) as 4 | 5 | 6 | 7 | 8 | 9}`\r\n ])\r\n }\r\n colorLegendTitle={colorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n categorical={scaleType === 'categorical'}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n showColorScale={showColorScale}\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 classNames={classNames}\r\n detailsOnClick={detailsOnClick}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n zoomInteraction={zoomInteraction}\r\n dimmedOpacity={dimmedOpacity}\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 customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","colorDomain","colors","mapData","colorLegendTitle","categorical","height","width","scale","centerPoint","tooltip","mapBorderWidth","mapBorderColor","mapNoDataColor","onSeriesMouseOver","showColorScale","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","selectedColor","setSelectedColor","useState","undefined","zoomRef","useRef","showLegend","setShowLegend","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","isInView","useInView","once","amount","mapG","colorScale","scaleOrdinal","domain","range","scaleThreshold","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","handleZoom","direction","scaleBy","jsxs","Fragment","jsx","motion","d","position","map","layer","features","i","findIndex","el","id","properties","length","indexOf","j","masterPath","forEach","geo","path","c","k","point","stroke","strokeWidth","fill","AnimatePresence","index","color","checkIfNullOrUndefined","x","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","cn","colorLegend","X","P","display","WebkitLineClamp","WebkitBoxOrient","backgroundColor","textAnchor","numberFormattingFunction","Modal","__html","string2HTML","Tooltip","ChoroplethMap","$","_c","t0","graphTitle","sources","graphDescription","footNote","t1","scaleType","t2","t3","padding","t4","t5","t6","t7","relativeHeight","isWorldMap","t8","t9","t10","graphID","t11","t12","graphDownload","t13","dataDownload","t14","showAntarctica","t15","language","t16","minHeight","t17","theme","t18","ariaLabel","t19","t20","t21","t22","t23","timeline","t24","Colors","light","graphNoData","grays","t25","t26","t27","enabled","autoplay","showOnlyActiveDate","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","dateFormat","Date","getTime","_temp","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","t28","t29","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t30","shape","onUpdateShape","useEffectEvent","t31","fetchAndParseJSON","then","d_0","t32","t33","getUniqValue","getJenks","_temp2","interval","setInterval","speed","clearInterval","markObj","getSliderMarks","t34","graphContainer","t35","t36","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t37","Pause","Play","SliderUI","nextValue","nextValue_0","t38","GraphArea","d_7","date","format","_temp8","categoricalColors","sequentialColors","max","Spinner","t39","footnote","source","GraphFooter","t40","GraphContainer","NAME","d_4","d_3","d_2","d_6","d_5","d_1","a","b","ascending"],"mappings":"muCA0EO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJC,KAAAA,EACAC,YAAAA,EACAC,OAAAA,EACAC,QAAAA,EACAC,iBAAAA,EACAC,YAAAA,EACAC,OAAAA,EACAC,MAAAA,EACAC,MAAAA,EACAC,YAAAA,EACAC,QAAAA,GACAC,eAAAA,EACAC,eAAAA,EACAC,eAAAA,GACAC,kBAAAA,GACAC,eAAAA,GACAC,gBAAAA,GACAC,oBAAAA,GACAC,eAAAA,EACAC,mBAAAA,GACAC,YAAAA,EACAC,4BAAAA,GACAC,eAAAA,EACAC,OAAAA,GACAC,WAAAA,GACAC,cAAAA,EACAC,gBAAAA,EACAC,QAAAA,EACAC,cAAAA,EACAC,aAAAA,GACAC,4BAAAA,EAAAA,EACE/B,EACE,CAACgC,EAAeC,CAAgB,EAAIC,EAAAA,SAA6BC,MAAS,EAC1EC,GAAUC,EAAAA,OAAoD,IAAI,EAClE,CAACC,GAAYC,EAAa,EAA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