@undp/data-viz 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/AreaChart.js +3 -3
  2. package/dist/BarGraph.cjs +1 -1
  3. package/dist/BarGraph.cjs.map +1 -1
  4. package/dist/BarGraph.js +1760 -1604
  5. package/dist/BarGraph.js.map +1 -1
  6. package/dist/BeeSwarmChart.js +2 -2
  7. package/dist/BiVariateChoroplethMap.cjs +1 -1
  8. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  9. package/dist/BiVariateChoroplethMap.js +222 -207
  10. package/dist/BiVariateChoroplethMap.js.map +1 -1
  11. package/dist/BulletChart.cjs +1 -1
  12. package/dist/BulletChart.cjs.map +1 -1
  13. package/dist/BulletChart.d.ts +11 -0
  14. package/dist/BulletChart.js +726 -640
  15. package/dist/BulletChart.js.map +1 -1
  16. package/dist/ButterflyChart.cjs +1 -1
  17. package/dist/ButterflyChart.cjs.map +1 -1
  18. package/dist/ButterflyChart.js +366 -348
  19. package/dist/ButterflyChart.js.map +1 -1
  20. package/dist/ChoroplethMap.cjs +1 -1
  21. package/dist/ChoroplethMap.cjs.map +1 -1
  22. package/dist/ChoroplethMap.js +311 -297
  23. package/dist/ChoroplethMap.js.map +1 -1
  24. package/dist/CirclePackingGraph.js +1 -1
  25. package/dist/DifferenceLineChart.js +3 -3
  26. package/dist/DotDensityMap.cjs +1 -1
  27. package/dist/DotDensityMap.cjs.map +1 -1
  28. package/dist/DotDensityMap.js +219 -203
  29. package/dist/DotDensityMap.js.map +1 -1
  30. package/dist/DualAxisLineChart.js +3 -3
  31. package/dist/DumbbellChart.cjs +1 -1
  32. package/dist/DumbbellChart.cjs.map +1 -1
  33. package/dist/DumbbellChart.js +606 -556
  34. package/dist/DumbbellChart.js.map +1 -1
  35. package/dist/GraphEl-YKUlz-37.cjs +2 -0
  36. package/dist/GraphEl-YKUlz-37.cjs.map +1 -0
  37. package/dist/{GraphEl-ebgfxefq.js → GraphEl-sVZvlyWe.js} +3 -2
  38. package/dist/GraphEl-sVZvlyWe.js.map +1 -0
  39. package/dist/GriddedGraphs.cjs +1 -1
  40. package/dist/GriddedGraphs.js +2 -2
  41. package/dist/HeatMap.js +4 -4
  42. package/dist/Histogram.js +3 -3
  43. package/dist/HybridMap.cjs +1 -1
  44. package/dist/HybridMap.cjs.map +1 -1
  45. package/dist/HybridMap.js +357 -342
  46. package/dist/HybridMap.js.map +1 -1
  47. package/dist/LineChartWithConfidenceInterval.js +3 -3
  48. package/dist/MultiLineAltChart.cjs +1 -1
  49. package/dist/MultiLineAltChart.cjs.map +1 -1
  50. package/dist/MultiLineAltChart.js +453 -425
  51. package/dist/MultiLineAltChart.js.map +1 -1
  52. package/dist/MultiLineChart.js +3 -3
  53. package/dist/ParetoChart.js +2 -2
  54. package/dist/RadarChart.js +1 -1
  55. package/dist/ScatterPlot.cjs +1 -1
  56. package/dist/ScatterPlot.cjs.map +1 -1
  57. package/dist/ScatterPlot.js +471 -452
  58. package/dist/ScatterPlot.js.map +1 -1
  59. package/dist/SimpleLineChart.js +3 -3
  60. package/dist/SingleGraphDashboard.cjs +1 -1
  61. package/dist/SingleGraphDashboard.js +2 -2
  62. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  63. package/dist/SingleGraphDashboardThreeDGraphs.js +1 -1
  64. package/dist/SlopeChart.js +1 -1
  65. package/dist/SparkLine.js +3 -3
  66. package/dist/StripChart.js +1 -1
  67. package/dist/ThreeDGlobe.js +2 -2
  68. package/dist/Types.d.ts +1 -0
  69. package/dist/{band-CyHaVft5.js → band-DHUZ2X7J.js} +3 -3
  70. package/dist/{band-CyHaVft5.js.map → band-DHUZ2X7J.js.map} +1 -1
  71. package/dist/ensureCompleteData-DS7gCvVd.js +122 -0
  72. package/dist/ensureCompleteData-DS7gCvVd.js.map +1 -0
  73. package/dist/ensureCompleteData-Oib-vGb0.cjs +2 -0
  74. package/dist/ensureCompleteData-Oib-vGb0.cjs.map +1 -0
  75. package/dist/getSchema.cjs +1 -1
  76. package/dist/getSchema.cjs.map +1 -1
  77. package/dist/getSchema.js +15 -15
  78. package/dist/getSchema.js.map +1 -1
  79. package/dist/{index-BBV4tAeA.js → index-DPGq3eIL.js} +2 -2
  80. package/dist/{index-BBV4tAeA.js.map → index-DPGq3eIL.js.map} +1 -1
  81. package/dist/index.cjs +1 -1
  82. package/dist/index.d.ts +3 -0
  83. package/dist/index.js +3 -3
  84. package/dist/{init-BJFW6EwE.js → init-BhZylTFx.js} +3 -3
  85. package/dist/{init-BJFW6EwE.js.map → init-BhZylTFx.js.map} +1 -1
  86. package/dist/{linear-BwnDd9KF.js → linear-BqltdMeF.js} +2 -2
  87. package/dist/{linear-BwnDd9KF.js.map → linear-BqltdMeF.js.map} +1 -1
  88. package/dist/{ordinal-P77xw8aL.js → ordinal-BJ6O_LC5.js} +2 -2
  89. package/dist/{ordinal-P77xw8aL.js.map → ordinal-BJ6O_LC5.js.map} +1 -1
  90. package/dist/{pow-DE4c7dbW.js → pow-CM2aze4M.js} +3 -3
  91. package/dist/{pow-DE4c7dbW.js.map → pow-CM2aze4M.js.map} +1 -1
  92. package/dist/{threshold-Bgr20hik.js → threshold-DFfqcDMa.js} +2 -2
  93. package/dist/{threshold-Bgr20hik.js.map → threshold-DFfqcDMa.js.map} +1 -1
  94. package/dist/{time-DCCfQk3V.js → time-BUL-dwnK.js} +3 -3
  95. package/dist/{time-DCCfQk3V.js.map → time-BUL-dwnK.js.map} +1 -1
  96. package/dist/transformData.cjs +1 -1
  97. package/dist/transformData.js +2 -2
  98. package/dist/transformDataForAggregation-CYoB5Xsk.cjs +2 -0
  99. package/dist/transformDataForAggregation-CYoB5Xsk.cjs.map +1 -0
  100. package/dist/{transformDataForAggregation-DEU__LUl.js → transformDataForAggregation-j34UL73s.js} +14 -10
  101. package/dist/transformDataForAggregation-j34UL73s.js.map +1 -0
  102. package/dist/{transformDataForGraphFromFile-CzepNVGZ.cjs → transformDataForGraphFromFile-CuXxR8uA.cjs} +2 -2
  103. package/dist/{transformDataForGraphFromFile-CzepNVGZ.cjs.map → transformDataForGraphFromFile-CuXxR8uA.cjs.map} +1 -1
  104. package/dist/{transformDataForGraphFromFile-CSG24iF6.js → transformDataForGraphFromFile-DyP-83Nh.js} +2 -2
  105. package/dist/{transformDataForGraphFromFile-CSG24iF6.js.map → transformDataForGraphFromFile-DyP-83Nh.js.map} +1 -1
  106. package/package.json +4 -4
  107. package/dist/GraphEl-B16EYkko.cjs +0 -2
  108. package/dist/GraphEl-B16EYkko.cjs.map +0 -1
  109. package/dist/GraphEl-ebgfxefq.js.map +0 -1
  110. package/dist/ensureCompleteData-DNKEGRiP.js +0 -102
  111. package/dist/ensureCompleteData-DNKEGRiP.js.map +0 -1
  112. package/dist/ensureCompleteData-I6nYmT8E.cjs +0 -2
  113. package/dist/ensureCompleteData-I6nYmT8E.cjs.map +0 -1
  114. package/dist/sort-BIvMlUH1.js +0 -34
  115. package/dist/sort-BIvMlUH1.js.map +0 -1
  116. package/dist/sort-O96oMZLb.cjs +0 -2
  117. package/dist/sort-O96oMZLb.cjs.map +0 -1
  118. package/dist/transformDataForAggregation-DEU__LUl.js.map +0 -1
  119. package/dist/transformDataForAggregation-XNg0OGYE.cjs +0 -2
  120. package/dist/transformDataForAggregation-XNg0OGYE.cjs.map +0 -1
@@ -14,8 +14,8 @@ import { R as le, a as ae } from "./ReferenceLine-2XCwHXQ4.js";
14
14
  import { Y as ce } from "./YTicksAndGridLines-Blepl7XF.js";
15
15
  import { X as ue } from "./XTicksAndGridLines-CObVFSm4.js";
16
16
  import { D as Ut } from "./DetailsModal-0Ry5nXiC.js";
17
- import { s as Jt } from "./pow-DE4c7dbW.js";
18
- import { a as Kt } from "./linear-BwnDd9KF.js";
17
+ import { s as Jt } from "./pow-CM2aze4M.js";
18
+ import { a as Kt } from "./linear-BqltdMeF.js";
19
19
  import { f as Qt, a as _t, b as te, c as ee, d as oe } from "./y-BqfogMAB.js";
20
20
  import { u as Yt } from "./uniqBy-BHy4I8PK.js";
21
21
  import { GraphHeader as me } from "./GraphHeader.js";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),m=require("react"),ae=require("./getSliderMarks-BmADcPQt.cjs"),ye=require("./Spinner-DRMBUsX7.cjs"),se=require("./parse-hMnG_lRV.cjs"),fe=require("./index-DQA8q5sC.cjs"),Q=require("./zoom-DPw8bba-.cjs"),ve=require("./index-DxXnJ8Ti.cjs"),le=require("./Typography-DX7PlgQU.cjs"),ce=require("./numberFormattingFunction-02t-wJta.cjs"),je=require("./Tooltip-uUdw6wJL.cjs"),de=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ne=require("./index-DRXx7m-C.cjs"),be=require("./DetailsModal-BN0HDFlV.cjs"),oe=require("./select-Bnfk0lJx.cjs"),me=require("./threshold-DNsSUf8Q.cjs"),Ee=require("./use-in-view-QcfiW0w3.cjs"),Ot=require("./proxy-BxvUI_9l.cjs"),ke=require("./index-DG2bgAva.cjs"),we=require("./GraphHeader.cjs"),Ce=require("./GraphFooter.cjs"),re=require("./Colors.cjs"),Re=require("./fetchAndParseData-l5HGMAEs.cjs"),ue=require("./getJenks-GYmdwBqm.cjs"),$e=require("./uniqBy-O05lp2S5.cjs"),pe=require("./GraphContainer-d8A46BK2.cjs"),Se=require("./sort-O96oMZLb.cjs"),De=require("./init-DU0ybBc_.cjs");function Ne(d){const{data:t,xDomain:b,mapData:w,xColorLegendTitle:Pt,yDomain:tt,yColorLegendTitle:et,width:E,height:f,colors:v,scale:It,centerPoint:R,mapBorderWidth:S,mapNoDataColor:L,mapBorderColor:gt,tooltip:ot,onSeriesMouseOver:yt,zoomScaleExtend:ft,zoomTranslateExtend:vt,highlightedIds:F,onSeriesMouseClick:rt,mapProperty:V,resetSelectionOnDoubleClick:Lt,detailsOnClick:C,showColorScale:jt,styles:zt,classNames:z,mapProjection:W,zoomInteraction:M,animate:$,dimmedOpacity:q,customLayers:nt,collapseColorScaleByDefault:bt}=d,[Wt,Et]=m.useState(bt===void 0?!(E<680):!bt),[G,kt]=m.useState(void 0),[it,at]=m.useState(void 0),[B,st]=m.useState(void 0),[lt,u]=m.useState(void 0),[p,H]=m.useState(void 0),_=m.useRef(null),ct=Ee.useInView(_,{once:$.once,amount:$.amount}),wt=m.useRef(null),A=m.useRef(null);m.useEffect(()=>{const e=oe.select(wt.current),a=oe.select(_.current),x=r=>{if(M==="noZoom")return!1;if(M==="button")return!r.type.includes("wheel");const n=r.type==="wheel",l=r.type.startsWith("touch"),i=r.type==="mousedown"||r.type==="mousemove";return l?!0:n?M==="scroll"?!0:r.ctrlKey:i&&!r.button&&!r.ctrlKey},s=Q.zoom().scaleExtent(ft).translateExtent(vt||[[-20,-20],[E+20,f+20]]).filter(x).on("zoom",({transform:r})=>{e.attr("transform",r)});a.call(s),A.current=s},[f,E,M]);const U=Q.turf_bbox_default(w),O=ve.turf_center_of_mass_default(w),D=U[2]-U[0],P=U[3]-U[1],dt=E*190/960*360/D,Ct=f*190/678*180/P,I=It*Math.min(dt,Ct),N=W==="mercator"?Q.geoMercator().rotate([0,0]).center(R||O.geometry.coordinates).translate([E/2,f/2]).scale(I):W==="equalEarth"?Q.geoEqualEarth().rotate([0,0]).center(R||O.geometry.coordinates).translate([E/2,f/2]).scale(I):W==="naturalEarth"?Q.geoNaturalEarth1().rotate([0,0]).center(R||O.geometry.coordinates).translate([E/2,f/2]).scale(I):W==="orthographic"?Q.geoOrthographic().rotate([0,0]).center(R||O.geometry.coordinates).translate([E/2,f/2]).scale(I):Q.geoAlbersUsa().rotate([0,0]).center(R||O.geometry.coordinates).translate([E/2,f/2]).scale(I),Rt=Array.from({length:b.length},(e,a)=>a),$t=Array.from({length:tt.length},(e,a)=>a),St=me.threshold().domain(b).range(Rt),Dt=me.threshold().domain(tt).range($t),X=e=>{if(!_.current||!A.current)return;oe.select(_.current).call(A.current.scaleBy,e==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(Ot.motion.svg,{viewBox:`0 0 ${E} ${f}`,width:`${E}px`,height:`${f}px`,ref:_,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:wt,children:[nt.filter(e=>e.position==="before").map(e=>e.layer),w.features.map((e,a)=>t.findIndex(s=>s.id===e.properties[V])!==-1?null:o.jsxRuntimeExports.jsx(Ot.motion.g,{opacity:G?q:F.length!==0?F.indexOf(e.properties[V])!==-1?1:q:1,children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((s,r)=>{let n="";return s.forEach(l=>{let i=" M";l.forEach((h,g)=>{const c=N([h[0],h[1]]);g!==l.length-1?i=`${i}${c[0]} ${c[1]}L`:i=`${i}${c[0]} ${c[1]}`}),n+=i}),o.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:gt,strokeWidth:S,fill:L}},r)}):e.geometry.coordinates.map((s,r)=>{let n="M";return s.forEach((l,i)=>{const h=N([l[0],l[1]]);i!==s.length-1?n=`${n}${h[0]} ${h[1]}L`:n=`${n}${h[0]} ${h[1]}`}),o.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:gt,strokeWidth:S,fill:L}},r)})},a)),o.jsxRuntimeExports.jsx(ke.AnimatePresence,{children:t.map(e=>{const a=w.features.findIndex(n=>e.id===n.properties[V]),x=de.checkIfNullOrUndefined(e.x)?void 0:St(e.x),s=de.checkIfNullOrUndefined(e.y)?void 0:Dt(e.y),r=x!==void 0&&s!==void 0?v[s][x]:L;return o.jsxRuntimeExports.jsx(Ot.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:G?G===r?1:q:F.length!==0?F.indexOf(e.id)!==-1?1:q:1,transition:{duration:$.duration}}},initial:"initial",animate:ct?"whileInView":"initial",exit:{opacity:0,transition:{duration:$.duration}},onMouseEnter:n=>{st(e),H(n.clientY),u(n.clientX),yt?.(e)},onClick:()=>{(rt||C)&&(fe.isEqual(it,e)&&Lt?(at(void 0),rt?.(void 0)):(at(e),rt?.(e)))},onMouseMove:n=>{st(e),H(n.clientY),u(n.clientX)},onMouseLeave:()=>{st(void 0),u(void 0),H(void 0),yt?.(void 0)},children:a===-1?null:w.features[a].geometry.type==="MultiPolygon"?w.features[a].geometry.coordinates.map((n,l)=>{let i="";return n.forEach(h=>{let g=" M";h.forEach((c,Nt)=>{const T=N([c[0],c[1]]);Nt!==h.length-1?g=`${g}${T[0]} ${T[1]}L`:g=`${g}${T[0]} ${T[1]}`}),i+=g}),o.jsxRuntimeExports.jsx(Ot.motion.path,{variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:$.duration}}},initial:"initial",animate:ct?"whileInView":"initial",exit:{opacity:0,transition:{duration:$.duration}},d:i,className:`${r===L?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:S}},`${e.id}-${l}`)}):w.features[a].geometry.coordinates.map((n,l)=>{let i="M";return n.forEach((h,g)=>{const c=N([h[0],h[1]]);g!==n.length-1?i=`${i}${c[0]} ${c[1]}L`:i=`${i}${c[0]} ${c[1]}`}),o.jsxRuntimeExports.jsx(Ot.motion.path,{d:i,variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:$.duration}}},initial:"initial",animate:ct?"whileInView":"initial",exit:{opacity:0,transition:{duration:$.duration}},className:`${r===L?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:S}},`${e.id}-${l}`)})},e.id)})}),B?w.features.filter(e=>e.properties[V]===B.id).map((e,a)=>o.jsxRuntimeExports.jsx("g",{children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((x,s)=>{let r="";return x.forEach(n=>{let l=" M";n.forEach((i,h)=>{const g=N([i[0],i[1]]);h!==n.length-1?l=`${l}${g[0]} ${g[1]}L`:l=`${l}${g[0]} ${g[1]}`}),r+=l}),o.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},s)}):e.geometry.coordinates.map((x,s)=>{let r="M";return x.forEach((n,l)=>{const i=N([n[0],n[1]]);l!==x.length-1?r=`${r}${i[0]} ${i[1]}L`:r=`${r}${i[0]} ${i[1]}`}),o.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},s)})},a)):null,nt.filter(e=>e.position==="after").map(e=>e.layer)]})}),jt===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",z?.colorLegend),children:Wt?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{Et(!1)},children:o.jsxRuntimeExports.jsx(ne.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]",style:{width:"175px"},children:[o.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[o.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:o.jsxRuntimeExports.jsxs("g",{children:[v.map((e,a)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-a*25})`,children:e.map((x,s)=>o.jsxRuntimeExports.jsx("rect",{y:1,x:s*25+1,fill:x,width:23,height:23,strokeWidth:G===x?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{kt(x)},onMouseLeave:()=>{kt(void 0)}},s))},a)),o.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:b.map((e,a)=>o.jsxRuntimeExports.jsx("text",{y:10,x:(a+1)*25,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:ce.numberFormattingFunction(e,"NA")},a))}),tt.map((e,a)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(b.length+1,5),4)*25+10},${100-a*25})`,children:o.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:ce.numberFormattingFunction(e,"NA")})},a))]})}),o.jsxRuntimeExports.jsx(le.j,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:et})]}),o.jsxRuntimeExports.jsx(le.j,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:Pt})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{Et(!0)},children:o.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),M==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>X("in"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>X("out"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),B&&ot&&lt&&p?o.jsxRuntimeExports.jsx(je.Tooltip,{data:B,body:ot,xPos:lt,yPos:p,backgroundStyle:zt?.tooltip,className:z?.tooltip}):null,C&&it!==void 0?o.jsxRuntimeExports.jsx(be.DetailsModal,{body:C,data:it,setData:at,className:z?.modal}):null]})}function Me(d){const t=o.compilerRuntimeExports.c(101),{data:b,graphTitle:w,mapData:Pt,colors:tt,sources:et,graphDescription:E,height:f,width:v,footNote:It,xDomain:R,yDomain:S,xColorLegendTitle:L,yColorLegendTitle:gt,tooltip:ot,scale:yt,centerPoint:ft,padding:vt,mapBorderWidth:F,mapNoDataColor:rt,backgroundColor:V,mapBorderColor:Lt,relativeHeight:C,onSeriesMouseOver:jt,isWorldMap:zt,zoomScaleExtend:z,zoomTranslateExtend:W,graphID:M,showColorScale:$,highlightedIds:q,onSeriesMouseClick:nt,mapProperty:bt,graphDownload:Wt,dataDownload:Et,showAntarctica:G,language:kt,minHeight:it,theme:at,ariaLabel:B,resetSelectionOnDoubleClick:st,detailsOnClick:lt,styles:u,classNames:p,mapProjection:H,zoomInteraction:_,animate:ct,dimmedOpacity:wt,customLayers:A,timeline:U,collapseColorScaleByDefault:O}=d,D=Pt===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":Pt,P=tt===void 0?re.Colors.light.bivariateColors.colors05x05:tt,dt=It===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.":It,Ct=L===void 0?"X Color key":L,I=gt===void 0?"Y Color key":gt,N=yt===void 0?.95:yt,Rt=F===void 0?.5:F,$t=rt===void 0?re.Colors.light.graphNoData:rt,St=V===void 0?!1:V,Dt=Lt===void 0?re.Colors.light.grays["gray-500"]:Lt,X=zt===void 0?!0:zt;let e;t[0]!==z?(e=z===void 0?[.8,6]:z,t[0]=z,t[1]=e):e=t[1];const a=e,x=$===void 0?!0:$;let s;t[2]!==q?(s=q===void 0?[]:q,t[2]=q,t[3]=s):s=t[3];const r=s,n=bt===void 0?"ISO3":bt,l=Wt===void 0?!1:Wt,i=Et===void 0?!1:Et,h=G===void 0?!1:G,g=kt===void 0?"en":kt,c=it===void 0?0:it,Nt=at===void 0?"light":at,T=st===void 0?!0:st,Yt=_===void 0?"button":_,Bt=ct===void 0?!1:ct,Jt=wt===void 0?.3:wt;let _t;t[4]!==A?(_t=A===void 0?[]:A,t[4]=A,t[5]=_t):_t=t[5];const Kt=_t,k=U===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:U,[Y,he]=m.useState(0),[Mt,xe]=m.useState(0),[J,Zt]=m.useState(k.autoplay),y=Se.sort($e.uniqBy(b,"date",!0).map(j=>se.parse(`${j}`,k.dateFormat||"yyyy",new Date).getTime()),_e),[K,qt]=m.useState(k.autoplay?0:y.length-1),[mt,ge]=m.useState(void 0),Qt=m.useRef(null),ie=m.useRef(null);let At,Tt;t[6]===Symbol.for("react.memo_cache_sentinel")?(At=()=>{const j=new ResizeObserver(Z=>{he(Z[0].target.clientWidth||620),xe(Z[0].target.clientHeight||480)});return Qt.current&&j.observe(Qt.current),()=>j.disconnect()},Tt=[],t[6]=At,t[7]=Tt):(At=t[6],Tt=t[7]),m.useEffect(At,Tt);let Ft;t[8]===Symbol.for("react.memo_cache_sentinel")?(Ft=j=>{ge(j)},t[8]=Ft):Ft=t[8];const Vt=m.useEffectEvent(Ft);let Gt;t[9]!==D||t[10]!==Vt?(Gt=()=>{typeof D=="string"?Re.fetchAndParseJSON(D).then(Z=>{Vt(Z)}):Vt(D)},t[9]=D,t[10]=Vt,t[11]=Gt):Gt=t[11];let Ht;t[12]!==D?(Ht=[D],t[12]=D,t[13]=Ht):Ht=t[13],m.useEffect(Gt,Ht),m.useEffect(()=>{const j=setInterval(()=>{qt(Z=>Z<y.length-1?Z+1:0)},(k.speed||2)*1e3);return J||clearInterval(j),()=>clearInterval(j)},[y,J,k.speed]);const Ut=ae.getSliderMarks(y,K,k.showOnlyActiveDate,k.dateFormat||"yyyy");if(R&&S&&(R.length!==P[0].length-1||S.length!==P.length-1))return console.error("the xDomain and yDomain array length don't match to the color array length"),null;const te=p?.graphContainer,ee=u?.graphContainer;let ut;t[14]!==p?.description||t[15]!==p?.title||t[16]!==b||t[17]!==i||t[18]!==E||t[19]!==l||t[20]!==w||t[21]!==u?.description||t[22]!==u?.title||t[23]!==v?(ut=w||E||l||i?o.jsxRuntimeExports.jsx(we.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:p?.title,description:p?.description},graphTitle:w,graphDescription:E,width:v,graphDownload:l?ie:void 0,dataDownload:i?b.map(Be).filter(We).length>0?b.map(ze).filter(Le):b.filter(Ie):null}):null,t[14]=p?.description,t[15]=p?.title,t[16]=b,t[17]=i,t[18]=E,t[19]=l,t[20]=w,t[21]=u?.description,t[22]=u?.title,t[23]=v,t[24]=ut):ut=t[24];let pt;t[25]!==K||t[26]!==Ut||t[27]!==J||t[28]!==qt||t[29]!==Zt||t[30]!==k.enabled||t[31]!==y?(pt=k.enabled&&y.length>0&&Ut?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Zt(!J)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":J?"Click to pause animation":"Click to play animation",children:J?o.jsxRuntimeExports.jsx(ne.Pause,{}):o.jsxRuntimeExports.jsx(ne.Play,{})}),o.jsxRuntimeExports.jsx(ae.Nr,{min:y[0],max:y[y.length-1],marks:Ut,step:null,defaultValue:y[y.length-1],value:y[K],onChangeComplete:j=>{qt(y.indexOf(j))},onChange:j=>{qt(y.indexOf(j))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,t[25]=K,t[26]=Ut,t[27]=J,t[28]=qt,t[29]=Zt,t[30]=k.enabled,t[31]=y,t[32]=pt):pt=t[32];let ht;t[33]!==Bt||t[34]!==ft||t[35]!==p||t[36]!==O||t[37]!==P||t[38]!==Kt||t[39]!==b||t[40]!==lt||t[41]!==Jt||t[42]!==f||t[43]!==r||t[44]!==K||t[45]!==X||t[46]!==Dt||t[47]!==Rt||t[48]!==$t||t[49]!==H||t[50]!==n||t[51]!==mt||t[52]!==c||t[53]!==nt||t[54]!==jt||t[55]!==C||t[56]!==T||t[57]!==N||t[58]!==h||t[59]!==x||t[60]!==u||t[61]!==Mt||t[62]!==Y||t[63]!==k.dateFormat||t[64]!==k.enabled||t[65]!==ot||t[66]!==y||t[67]!==v||t[68]!==Ct||t[69]!==R||t[70]!==I||t[71]!==S||t[72]!==Yt||t[73]!==a||t[74]!==W?(ht=o.jsxRuntimeExports.jsx(pe.GraphArea,{ref:Qt,children:Y&&Mt&&mt?o.jsxRuntimeExports.jsx(Ne,{data:b.filter(j=>k.enabled?j.date===se.format(new Date(y[K]),k.dateFormat||"yyyy"):j),mapData:h?mt:{...mt,features:mt.features.filter(Pe)},xDomain:R||ue.getJenks(b.map(Oe),P[0].length),yDomain:S||ue.getJenks(b.map(qe),P.length),width:Y,height:Mt,scale:N,centerPoint:ft,colors:P,xColorLegendTitle:Ct,yColorLegendTitle:I,mapBorderWidth:Rt,mapNoDataColor:$t,mapBorderColor:Dt,tooltip:ot,onSeriesMouseOver:jt,isWorldMap:X,zoomScaleExtend:a,zoomTranslateExtend:W,onSeriesMouseClick:nt,mapProperty:n,highlightedIds:r,resetSelectionOnDoubleClick:T,styles:u,showColorScale:x,classNames:p,mapProjection:H||(X?"naturalEarth":"mercator"),detailsOnClick:lt,zoomInteraction:Yt,animate:Bt===!0?{duration:.5,once:!0,amount:.5}:Bt||{duration:0,once:!0,amount:0},dimmedOpacity:Jt,customLayers:Kt,collapseColorScaleByDefault:O}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(c,f||(C?c?(v||Y)*C>c?(v||Y)*C:c:(v||Y)*C:Mt))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(ye.w,{"aria-label":"Loading graph"})})}),t[33]=Bt,t[34]=ft,t[35]=p,t[36]=O,t[37]=P,t[38]=Kt,t[39]=b,t[40]=lt,t[41]=Jt,t[42]=f,t[43]=r,t[44]=K,t[45]=X,t[46]=Dt,t[47]=Rt,t[48]=$t,t[49]=H,t[50]=n,t[51]=mt,t[52]=c,t[53]=nt,t[54]=jt,t[55]=C,t[56]=T,t[57]=N,t[58]=h,t[59]=x,t[60]=u,t[61]=Mt,t[62]=Y,t[63]=k.dateFormat,t[64]=k.enabled,t[65]=ot,t[66]=y,t[67]=v,t[68]=Ct,t[69]=R,t[70]=I,t[71]=S,t[72]=Yt,t[73]=a,t[74]=W,t[75]=ht):ht=t[75];let xt;t[76]!==p?.footnote||t[77]!==p?.source||t[78]!==dt||t[79]!==et||t[80]!==u?.footnote||t[81]!==u?.source||t[82]!==v?(xt=et||dt?o.jsxRuntimeExports.jsx(Ce.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:p?.footnote,source:p?.source},sources:et,footNote:dt,width:v}):null,t[76]=p?.footnote,t[77]=p?.source,t[78]=dt,t[79]=et,t[80]=u?.footnote,t[81]=u?.source,t[82]=v,t[83]=xt):xt=t[83];let Xt;return t[84]!==B||t[85]!==St||t[86]!==M||t[87]!==f||t[88]!==g||t[89]!==c||t[90]!==vt||t[91]!==C||t[92]!==te||t[93]!==ee||t[94]!==ut||t[95]!==pt||t[96]!==ht||t[97]!==xt||t[98]!==Nt||t[99]!==v?(Xt=o.jsxRuntimeExports.jsxs(pe.GraphContainer,{className:te,style:ee,id:M,ref:ie,"aria-label":B,backgroundColor:St,theme:Nt,language:g,minHeight:c,width:v,height:f,relativeHeight:C,padding:vt,children:[ut,pt,ht,xt]}),t[84]=B,t[85]=St,t[86]=M,t[87]=f,t[88]=g,t[89]=c,t[90]=vt,t[91]=C,t[92]=te,t[93]=ee,t[94]=ut,t[95]=pt,t[96]=ht,t[97]=xt,t[98]=Nt,t[99]=v,t[100]=Xt):Xt=t[100],Xt}function qe(d){return d.y}function Oe(d){return d.x}function Pe(d){return d.properties.NAME!=="Antarctica"}function Ie(d){return d!==void 0}function Le(d){return d!==void 0}function ze(d){return d.data}function We(d){return d!==void 0}function Be(d){return d.data}function _e(d,t){return De.ascending(d,t)}exports.BiVariateChoroplethMap=Me;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),p=require("react"),mt=require("./getSliderMarks-BmADcPQt.cjs"),kt=require("./Spinner-DRMBUsX7.cjs"),ut=require("./parse-hMnG_lRV.cjs"),wt=require("./index-DQA8q5sC.cjs"),Q=require("./zoom-DPw8bba-.cjs"),Ct=require("./index-DxXnJ8Ti.cjs"),pt=require("./Typography-DX7PlgQU.cjs"),ht=require("./numberFormattingFunction-02t-wJta.cjs"),Rt=require("./Tooltip-uUdw6wJL.cjs"),xt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),ct=require("./index-DRXx7m-C.cjs"),St=require("./DetailsModal-BN0HDFlV.cjs"),st=require("./select-Bnfk0lJx.cjs"),gt=require("./threshold-DNsSUf8Q.cjs"),$t=require("./use-in-view-QcfiW0w3.cjs"),qe=require("./proxy-BxvUI_9l.cjs"),Dt=require("./index-DG2bgAva.cjs"),Nt=require("./GraphHeader.cjs"),Mt=require("./GraphFooter.cjs"),lt=require("./Colors.cjs"),Ot=require("./fetchAndParseData-l5HGMAEs.cjs"),yt=require("./getJenks-GYmdwBqm.cjs"),ft=require("./GraphContainer-d8A46BK2.cjs");function qt(d){const{data:e,xDomain:f,mapData:w,xColorLegendTitle:Pe,yDomain:ee,yColorLegendTitle:te,width:k,height:b,colors:E,scale:Ie,centerPoint:R,mapBorderWidth:$,mapNoDataColor:F,mapBorderColor:ge,tooltip:oe,onSeriesMouseOver:ye,zoomScaleExtend:fe,zoomTranslateExtend:ve,highlightedIds:U,onSeriesMouseClick:re,mapProperty:X,resetSelectionOnDoubleClick:Le,detailsOnClick:C,showColorScale:je,styles:ze,classNames:A,mapProjection:B,zoomInteraction:M,animate:S,dimmedOpacity:O,customLayers:ne,collapseColorScaleByDefault:be}=d,[We,Ee]=p.useState(be===void 0?!(k<680):!be),[Y,ke]=p.useState(void 0),[ae,ie]=p.useState(void 0),[T,se]=p.useState(void 0),[le,h]=p.useState(void 0),[g,J]=p.useState(void 0),V=p.useRef(null),ce=$t.useInView(V,{once:S.once,amount:S.amount}),we=p.useRef(null),G=p.useRef(null);p.useEffect(()=>{const t=st.select(we.current),i=st.select(V.current),v=r=>{if(M==="noZoom")return!1;if(M==="button")return!r.type.includes("wheel");const n=r.type==="wheel",l=r.type.startsWith("touch"),a=r.type==="mousedown"||r.type==="mousemove";return l?!0:n?M==="scroll"?!0:r.ctrlKey:a&&!r.button&&!r.ctrlKey},s=Q.zoom().scaleExtent(fe).translateExtent(ve||[[-20,-20],[k+20,b+20]]).filter(v).on("zoom",({transform:r})=>{t.attr("transform",r)});i.call(s),G.current=s},[b,k,M]);const q=Q.turf_bbox_default(w),P=Ct.turf_center_of_mass_default(w),D=q[2]-q[0],I=q[3]-q[1],de=k*190/960*360/D,Ce=b*190/678*180/I,L=Ie*Math.min(de,Ce),N=B==="mercator"?Q.geoMercator().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):B==="equalEarth"?Q.geoEqualEarth().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):B==="naturalEarth"?Q.geoNaturalEarth1().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):B==="orthographic"?Q.geoOrthographic().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L):Q.geoAlbersUsa().rotate([0,0]).center(R||P.geometry.coordinates).translate([k/2,b/2]).scale(L),Re=Array.from({length:f.length},(t,i)=>i),Se=Array.from({length:ee.length},(t,i)=>i),$e=gt.threshold().domain(f).range(Re),De=gt.threshold().domain(ee).range(Se),K=t=>{if(!V.current||!G.current)return;st.select(V.current).call(G.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(qe.motion.svg,{viewBox:`0 0 ${k} ${b}`,width:`${k}px`,height:`${b}px`,ref:V,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:we,children:[ne.filter(t=>t.position==="before").map(t=>t.layer),w.features.map((t,i)=>e.findIndex(s=>s.id===t.properties[X])!==-1?null:o.jsxRuntimeExports.jsx(qe.motion.g,{opacity:Y?O:U.length!==0?U.indexOf(t.properties[X])!==-1?1:O:1,children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((s,r)=>{let n="";return s.forEach(l=>{let a=" M";l.forEach((y,j)=>{const m=N([y[0],y[1]]);j!==l.length-1?a=`${a}${m[0]} ${m[1]}L`:a=`${a}${m[0]} ${m[1]}`}),n+=a}),o.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:ge,strokeWidth:$,fill:F}},r)}):t.geometry.coordinates.map((s,r)=>{let n="M";return s.forEach((l,a)=>{const y=N([l[0],l[1]]);a!==s.length-1?n=`${n}${y[0]} ${y[1]}L`:n=`${n}${y[0]} ${y[1]}`}),o.jsxRuntimeExports.jsx("path",{d:n,style:{stroke:ge,strokeWidth:$,fill:F}},r)})},i)),o.jsxRuntimeExports.jsx(Dt.AnimatePresence,{children:e.map(t=>{const i=w.features.findIndex(n=>t.id===n.properties[X]),v=xt.checkIfNullOrUndefined(t.x)?void 0:$e(t.x),s=xt.checkIfNullOrUndefined(t.y)?void 0:De(t.y),r=v!==void 0&&s!==void 0?E[s][v]:F;return o.jsxRuntimeExports.jsx(qe.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:Y?Y===r?1:O:U.length!==0?U.indexOf(t.id)!==-1?1:O:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},onMouseEnter:n=>{se(t),J(n.clientY),h(n.clientX),ye?.(t)},onClick:()=>{(re||C)&&(wt.isEqual(ae,t)&&Le?(ie(void 0),re?.(void 0)):(ie(t),re?.(t)))},onMouseMove:n=>{se(t),J(n.clientY),h(n.clientX)},onMouseLeave:()=>{se(void 0),h(void 0),J(void 0),ye?.(void 0)},children:i===-1?null:w.features[i].geometry.type==="MultiPolygon"?w.features[i].geometry.coordinates.map((n,l)=>{let a="";return n.forEach(y=>{let j=" M";y.forEach((m,Ne)=>{const H=N([m[0],m[1]]);Ne!==y.length-1?j=`${j}${H[0]} ${H[1]}L`:j=`${j}${H[0]} ${H[1]}`}),a+=j}),o.jsxRuntimeExports.jsx(qe.motion.path,{variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},d:a,className:`${r===F?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:$}},`${t.id}-${l}`)}):w.features[i].geometry.coordinates.map((n,l)=>{let a="M";return n.forEach((y,j)=>{const m=N([y[0],y[1]]);j!==n.length-1?a=`${a}${m[0]} ${m[1]}L`:a=`${a}${m[0]} ${m[1]}`}),o.jsxRuntimeExports.jsx(qe.motion.path,{d:a,variants:{initial:{fill:r,opacity:0},whileInView:{fill:r,opacity:1,transition:{duration:S.duration}}},initial:"initial",animate:ce?"whileInView":"initial",exit:{opacity:0,transition:{duration:S.duration}},className:`${r===F?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:$}},`${t.id}-${l}`)})},t.id)})}),T?w.features.filter(t=>t.properties[X]===T.id).map((t,i)=>o.jsxRuntimeExports.jsx("g",{children:t.geometry.type==="MultiPolygon"?t.geometry.coordinates.map((v,s)=>{let r="";return v.forEach(n=>{let l=" M";n.forEach((a,y)=>{const j=N([a[0],a[1]]);y!==n.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),r+=l}),o.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},s)}):t.geometry.coordinates.map((v,s)=>{let r="M";return v.forEach((n,l)=>{const a=N([n[0],n[1]]);l!==v.length-1?r=`${r}${a[0]} ${a[1]}L`:r=`${r}${a[0]} ${a[1]}`}),o.jsxRuntimeExports.jsx("path",{d:r,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},s)})},i)):null,ne.filter(t=>t.position==="after").map(t=>t.layer)]})}),je===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",A?.colorLegend),children:We?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{Ee(!1)},children:o.jsxRuntimeExports.jsx(ct.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]",style:{width:"175px"},children:[o.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[o.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:o.jsxRuntimeExports.jsxs("g",{children:[E.map((t,i)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-i*25})`,children:t.map((v,s)=>o.jsxRuntimeExports.jsx("rect",{y:1,x:s*25+1,fill:v,width:23,height:23,strokeWidth:Y===v?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{ke(v)},onMouseLeave:()=>{ke(void 0)}},s))},i)),o.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:f.map((t,i)=>o.jsxRuntimeExports.jsx("text",{y:10,x:(i+1)*25,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:ht.numberFormattingFunction(t,"NA")},i))}),ee.map((t,i)=>o.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(f.length+1,5),4)*25+10},${100-i*25})`,children:o.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof t=="string"||t<1?t:ht.numberFormattingFunction(t,"NA")})},i))]})}),o.jsxRuntimeExports.jsx(pt.j,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:te})]}),o.jsxRuntimeExports.jsx(pt.j,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:Pe})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{Ee(!0)},children:o.jsxRuntimeExports.jsx("div",{className:"show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),M==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>K("in"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>K("out"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),T&&oe&&le&&g?o.jsxRuntimeExports.jsx(Rt.Tooltip,{data:T,body:oe,xPos:le,yPos:g,backgroundStyle:ze?.tooltip,className:A?.tooltip}):null,C&&ae!==void 0?o.jsxRuntimeExports.jsx(St.DetailsModal,{body:C,data:ae,setData:ie,className:A?.modal}):null]})}function Pt(d){const e=o.compilerRuntimeExports.c(116),{data:f,graphTitle:w,mapData:Pe,colors:ee,sources:te,graphDescription:k,height:b,width:E,footNote:Ie,xDomain:R,yDomain:$,xColorLegendTitle:F,yColorLegendTitle:ge,tooltip:oe,scale:ye,centerPoint:fe,padding:ve,mapBorderWidth:U,mapNoDataColor:re,backgroundColor:X,mapBorderColor:Le,relativeHeight:C,onSeriesMouseOver:je,isWorldMap:ze,zoomScaleExtend:A,zoomTranslateExtend:B,graphID:M,showColorScale:S,highlightedIds:O,onSeriesMouseClick:ne,mapProperty:be,graphDownload:We,dataDownload:Ee,showAntarctica:Y,language:ke,minHeight:ae,theme:ie,ariaLabel:T,resetSelectionOnDoubleClick:se,detailsOnClick:le,styles:h,classNames:g,mapProjection:J,zoomInteraction:V,animate:ce,dimmedOpacity:we,customLayers:G,timeline:q,collapseColorScaleByDefault:P}=d,D=Pe===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json":Pe,I=ee===void 0?lt.Colors.light.bivariateColors.colors05x05:ee,de=Ie===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":Ie,Ce=F===void 0?"X Color key":F,L=ge===void 0?"Y Color key":ge,N=ye===void 0?.95:ye,Re=U===void 0?.5:U,Se=re===void 0?lt.Colors.light.graphNoData:re,$e=X===void 0?!1:X,De=Le===void 0?lt.Colors.light.grays["gray-500"]:Le,K=ze===void 0?!0:ze;let t;e[0]!==A?(t=A===void 0?[.8,6]:A,e[0]=A,e[1]=t):t=e[1];const i=t,v=S===void 0?!0:S;let s;e[2]!==O?(s=O===void 0?[]:O,e[2]=O,e[3]=s):s=e[3];const r=s,n=be===void 0?"ISO3":be,l=We===void 0?!1:We,a=Ee===void 0?!1:Ee,y=Y===void 0?!1:Y,j=ke===void 0?"en":ke,m=ae===void 0?0:ae,Ne=ie===void 0?"light":ie,H=se===void 0?!0:se,Qe=V===void 0?"button":V,_e=ce===void 0?!1:ce,et=we===void 0?.3:we;let Fe;e[4]!==G?(Fe=G===void 0?[]:G,e[4]=G,e[5]=Fe):Fe=e[5];const tt=Fe;let Ae;e[6]!==q?(Ae=q===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:q,e[6]=q,e[7]=Ae):Ae=e[7];const c=Ae,[Z,vt]=p.useState(0),[Me,jt]=p.useState(0),[z,bt]=p.useState(c.autoplay);let Oe;if(e[8]!==f||e[9]!==c.dateFormat){let x;e[11]!==c.dateFormat?(x=_=>ut.parse(`${_.date}`,c.dateFormat||"yyyy",new Date).getTime(),e[11]=c.dateFormat,e[12]=x):x=e[12],Oe=[...new Set(f.filter(Vt).map(x))],Oe.sort(Tt),e[8]=f,e[9]=c.dateFormat,e[10]=Oe}else Oe=e[10];const u=Oe,[W,ot]=p.useState(c.autoplay?0:u.length-1),[me,Et]=p.useState(void 0),rt=p.useRef(null),dt=p.useRef(null);let Be,Te;e[13]===Symbol.for("react.memo_cache_sentinel")?(Be=()=>{const x=new ResizeObserver(_=>{vt(_[0].target.clientWidth||620),jt(_[0].target.clientHeight||480)});return rt.current&&x.observe(rt.current),()=>x.disconnect()},Te=[],e[13]=Be,e[14]=Te):(Be=e[13],Te=e[14]),p.useEffect(Be,Te);let Ve;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ve=x=>{Et(x)},e[15]=Ve):Ve=e[15];const Ge=p.useEffectEvent(Ve);let He;e[16]!==D||e[17]!==Ge?(He=()=>{typeof D=="string"?Ot.fetchAndParseJSON(D).then(_=>{Ge(_)}):Ge(D)},e[16]=D,e[17]=Ge,e[18]=He):He=e[18];let Ue;e[19]!==D?(Ue=[D],e[19]=D,e[20]=Ue):Ue=e[20],p.useEffect(He,Ue);let Xe,Ye;e[21]!==z||e[22]!==c.speed||e[23]!==u?(Xe=()=>{const x=setInterval(()=>{ot(_=>_<u.length-1?_+1:0)},(c.speed||2)*1e3);return z||clearInterval(x),()=>clearInterval(x)},Ye=[u,z,c.speed],e[21]=z,e[22]=c.speed,e[23]=u,e[24]=Xe,e[25]=Ye):(Xe=e[24],Ye=e[25]),p.useEffect(Xe,Ye);const nt=c.dateFormat||"yyyy";let Je;e[26]!==W||e[27]!==nt||e[28]!==c.showOnlyActiveDate||e[29]!==u?(Je=mt.getSliderMarks(u,W,c.showOnlyActiveDate,nt),e[26]=W,e[27]=nt,e[28]=c.showOnlyActiveDate,e[29]=u,e[30]=Je):Je=e[30];const Ke=Je;if(R&&$&&(R.length!==I[0].length-1||$.length!==I.length-1))return console.error("the xDomain and yDomain array length don't match to the color array length"),null;const at=g?.graphContainer,it=h?.graphContainer;let ue;e[31]!==g?.description||e[32]!==g?.title||e[33]!==f||e[34]!==a||e[35]!==k||e[36]!==l||e[37]!==w||e[38]!==h?.description||e[39]!==h?.title||e[40]!==E?(ue=w||k||l||a?o.jsxRuntimeExports.jsx(Nt.GraphHeader,{styles:{title:h?.title,description:h?.description},classNames:{title:g?.title,description:g?.description},graphTitle:w,graphDescription:k,width:E,graphDownload:l?dt:void 0,dataDownload:a?f.map(Bt).filter(At).length>0?f.map(Ft).filter(_t):f.filter(Wt):null}):null,e[31]=g?.description,e[32]=g?.title,e[33]=f,e[34]=a,e[35]=k,e[36]=l,e[37]=w,e[38]=h?.description,e[39]=h?.title,e[40]=E,e[41]=ue):ue=e[41];let pe;e[42]!==W||e[43]!==Ke||e[44]!==z||e[45]!==c.enabled||e[46]!==u?(pe=c.enabled&&u.length>0&&Ke?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{bt(!z)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":z?"Click to pause animation":"Click to play animation",children:z?o.jsxRuntimeExports.jsx(ct.Pause,{}):o.jsxRuntimeExports.jsx(ct.Play,{})}),o.jsxRuntimeExports.jsx(mt.Nr,{min:u[0],max:u[u.length-1],marks:Ke,step:null,defaultValue:u[u.length-1],value:u[W],onChangeComplete:x=>{ot(u.indexOf(x))},onChange:x=>{ot(u.indexOf(x))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[42]=W,e[43]=Ke,e[44]=z,e[45]=c.enabled,e[46]=u,e[47]=pe):pe=e[47];let he;e[48]!==_e||e[49]!==fe||e[50]!==g||e[51]!==P||e[52]!==I||e[53]!==tt||e[54]!==f||e[55]!==le||e[56]!==et||e[57]!==b||e[58]!==r||e[59]!==W||e[60]!==K||e[61]!==De||e[62]!==Re||e[63]!==Se||e[64]!==J||e[65]!==n||e[66]!==me||e[67]!==m||e[68]!==ne||e[69]!==je||e[70]!==C||e[71]!==H||e[72]!==N||e[73]!==y||e[74]!==v||e[75]!==h||e[76]!==Me||e[77]!==Z||e[78]!==c.dateFormat||e[79]!==c.enabled||e[80]!==oe||e[81]!==u||e[82]!==E||e[83]!==Ce||e[84]!==R||e[85]!==L||e[86]!==$||e[87]!==Qe||e[88]!==i||e[89]!==B?(he=o.jsxRuntimeExports.jsx(ft.GraphArea,{ref:rt,children:Z&&Me&&me?o.jsxRuntimeExports.jsx(qt,{data:f.filter(x=>c.enabled?x.date===ut.format(new Date(u[W]),c.dateFormat||"yyyy"):x),mapData:y?me:{...me,features:me.features.filter(zt)},xDomain:R||yt.getJenks(f.map(Lt),I[0].length),yDomain:$||yt.getJenks(f.map(It),I.length),width:Z,height:Me,scale:N,centerPoint:fe,colors:I,xColorLegendTitle:Ce,yColorLegendTitle:L,mapBorderWidth:Re,mapNoDataColor:Se,mapBorderColor:De,tooltip:oe,onSeriesMouseOver:je,isWorldMap:K,zoomScaleExtend:i,zoomTranslateExtend:B,onSeriesMouseClick:ne,mapProperty:n,highlightedIds:r,resetSelectionOnDoubleClick:H,styles:h,showColorScale:v,classNames:g,mapProjection:J||(K?"naturalEarth":"mercator"),detailsOnClick:le,zoomInteraction:Qe,animate:_e===!0?{duration:.5,once:!0,amount:.5}:_e||{duration:0,once:!0,amount:0},dimmedOpacity:et,customLayers:tt,collapseColorScaleByDefault:P}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(m,b||(C?m?(E||Z)*C>m?(E||Z)*C:m:(E||Z)*C:Me))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(kt.w,{"aria-label":"Loading graph"})})}),e[48]=_e,e[49]=fe,e[50]=g,e[51]=P,e[52]=I,e[53]=tt,e[54]=f,e[55]=le,e[56]=et,e[57]=b,e[58]=r,e[59]=W,e[60]=K,e[61]=De,e[62]=Re,e[63]=Se,e[64]=J,e[65]=n,e[66]=me,e[67]=m,e[68]=ne,e[69]=je,e[70]=C,e[71]=H,e[72]=N,e[73]=y,e[74]=v,e[75]=h,e[76]=Me,e[77]=Z,e[78]=c.dateFormat,e[79]=c.enabled,e[80]=oe,e[81]=u,e[82]=E,e[83]=Ce,e[84]=R,e[85]=L,e[86]=$,e[87]=Qe,e[88]=i,e[89]=B,e[90]=he):he=e[90];let xe;e[91]!==g?.footnote||e[92]!==g?.source||e[93]!==de||e[94]!==te||e[95]!==h?.footnote||e[96]!==h?.source||e[97]!==E?(xe=te||de?o.jsxRuntimeExports.jsx(Mt.GraphFooter,{styles:{footnote:h?.footnote,source:h?.source},classNames:{footnote:g?.footnote,source:g?.source},sources:te,footNote:de,width:E}):null,e[91]=g?.footnote,e[92]=g?.source,e[93]=de,e[94]=te,e[95]=h?.footnote,e[96]=h?.source,e[97]=E,e[98]=xe):xe=e[98];let Ze;return e[99]!==T||e[100]!==$e||e[101]!==M||e[102]!==b||e[103]!==j||e[104]!==m||e[105]!==ve||e[106]!==C||e[107]!==at||e[108]!==it||e[109]!==ue||e[110]!==pe||e[111]!==he||e[112]!==xe||e[113]!==Ne||e[114]!==E?(Ze=o.jsxRuntimeExports.jsxs(ft.GraphContainer,{className:at,style:it,id:M,ref:dt,"aria-label":T,backgroundColor:$e,theme:Ne,language:j,minHeight:m,width:E,height:b,relativeHeight:C,padding:ve,children:[ue,pe,he,xe]}),e[99]=T,e[100]=$e,e[101]=M,e[102]=b,e[103]=j,e[104]=m,e[105]=ve,e[106]=C,e[107]=at,e[108]=it,e[109]=ue,e[110]=pe,e[111]=he,e[112]=xe,e[113]=Ne,e[114]=E,e[115]=Ze):Ze=e[115],Ze}function It(d){return d.y}function Lt(d){return d.x}function zt(d){return d.properties.NAME!=="Antarctica"}function Wt(d){return d!==void 0}function _t(d){return d!==void 0}function Ft(d){return d.data}function At(d){return d!==void 0}function Bt(d){return d.data}function Tt(d,e){return d-e}function Vt(d){return d.date}exports.BiVariateChoroplethMap=Pt;
2
2
  //# sourceMappingURL=BiVariateChoroplethMap.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BiVariateChoroplethMap.cjs","sources":["../src/Components/Graphs/Maps/BiVariateMap/Graph.tsx","../src/Components/Graphs/Maps/BiVariateMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\n\r\ninterface Props {\r\n data: BivariateMapDataType[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n showColorScale: boolean;\r\n collapseColorScaleByDefault?: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n } = props;\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centerOfMass(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <motion.g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </motion.g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n d={masterPath}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{ width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useEffectEvent, useRef, useState } from 'react';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { ascending, sort } from 'd3-array';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { 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: BivariateMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n collapseColorScaleByDefault,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = 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 useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\r\n }\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {svgWidth && svgHeight && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date === format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","showLegend","setShowLegend","useState","undefined","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","once","amount","mapG","zoomRef","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","xRange","Array","from","length","_","i","yRange","xScale","scaleThreshold","domain","range","yScale","handleZoom","direction","scaleBy","jsxs","Fragment","jsx","motion","d","position","map","layer","features","findIndex","el","id","properties","indexOf","j","masterPath","forEach","geo","path","c","k","point","stroke","strokeWidth","fill","AnimatePresence","index","xColorCoord","checkIfNullOrUndefined","x","yColorCoord","y","color","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","cn","colorLegend","X","cursor","numberFormattingFunction","max","P","display","WebkitLineClamp","WebkitBoxOrient","overflow","writingMode","Tooltip","DetailsModal","modal","BiVariateChoroplethMap","$","_c","graphTitle","t0","t1","sources","graphDescription","footNote","t2","t3","t4","t5","padding","t6","t7","backgroundColor","t8","t9","relativeHeight","isWorldMap","t10","t11","graphID","t12","t13","t14","graphDownload","t15","dataDownload","t16","showAntarctica","t17","language","t18","minHeight","t19","theme","t20","ariaLabel","t21","t22","t23","t24","t25","timeline","t26","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t27","t28","t29","enabled","autoplay","showOnlyActiveDate","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","dateFormat","Date","getTime","_temp","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","t30","t31","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t32","shape","onUpdateShape","useEffectEvent","t33","fetchAndParseJSON","then","d_0","t34","interval","setInterval","speed","clearInterval","markObj","getSliderMarks","console","error","t35","graphContainer","t36","t37","description","title","GraphHeader","_temp2","_temp3","_temp4","_temp5","_temp6","t38","Pause","Play","SliderUI","nextValue","nextValue_0","t39","GraphArea","d_6","date","format","_temp7","getJenks","_temp8","_temp9","Spinner","t40","footnote","source","GraphFooter","t41","GraphContainer","d_8","d_7","NAME","d_3","d_2","d_1","d_5","d_4","a","b","ascending"],"mappings":"inCA6EO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJC,KAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,kBAAAA,GACAC,QAAAA,GACAC,kBAAAA,GACAC,MAAAA,EACAC,OAAAA,EACAC,OAAAA,EACAC,MAAAA,GACAC,YAAAA,EACAC,eAAAA,EACAC,eAAAA,EACAC,eAAAA,GACAC,QAAAA,GACAC,kBAAAA,GACAC,gBAAAA,GACAC,oBAAAA,GACAC,eAAAA,EACAC,mBAAAA,GACAC,YAAAA,EACAC,4BAAAA,GACAC,eAAAA,EACAC,eAAAA,GACAC,OAAAA,GACAC,WAAAA,EACAC,cAAAA,EACAC,gBAAAA,EACAC,QAAAA,EACAC,cAAAA,EACAC,aAAAA,GACAC,4BAA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f,MAAAsB,EAAAtB,MAAAtK,EAAAsK,MAAAgC,EAAAhC,MAAAkC,EAAAlC,MAAAY,GAAAZ,MAAAkB,EAAAlB,MAAA0G,GAAA1G,MAAA4G,GAAA5G,MAAA6G,GAAA7G,MAAAsH,GAAAtH,MAAA4H,GAAA5H,MAAAsI,GAAAtI,MAAAoC,GAAApC,MAAAvK,EAAAuK,OAAA0I,IAAAA,GAAA1I,EAAA,GAAA,EAvKjB0I,EAuKiB,CA7Rd,SAAAN,GAAAQ,EAAA,CAAA,OAsNuBnM,EAAC2B,CAA+B,CAtNvD,SAAA+J,GAAAU,EAAA,CAAA,OA+MuBpM,EAACyB,CAA+B,CA/MvD,SAAA+J,GAAAlL,EAAA,CAAA,OAwM4BA,EAAEE,WAAW6L,OAAU,YAAY,CAxM/D,SAAAzB,GAAA0B,EAAA,CAAA,OAuJ4BtM,IAAMnF,MAAS,CAvJ3C,SAAA8P,GAAA4B,EAAA,CAAA,OAsJ6CvM,IAAMnF,MAAS,CAtJ5D,SAAA6P,GAAA8B,EAAA,CAAA,OAsJyBxM,EAACtH,IAAK,CAtJ/B,SAAA+R,GAAAgC,EAAA,CAAA,OAqJ2CzM,IAAMnF,MAAS,CArJ1D,SAAA2P,GAAAkC,EAAA,CAAA,OAqJuB1M,EAACtH,IAAK,CArJ7B,SAAAoP,GAAA6E,EAAAC,EAAA,CAAA,OA4DOC,GAAAA,UAAUF,EAAGC,CAAC,CAAC"}
1
+ {"version":3,"file":"BiVariateChoroplethMap.cjs","sources":["../src/Components/Graphs/Maps/BiVariateMap/Graph.tsx","../src/Components/Graphs/Maps/BiVariateMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold } from 'd3-scale';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\n\r\ninterface Props {\r\n data: BivariateMapDataType[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n showColorScale: boolean;\r\n collapseColorScaleByDefault?: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n collapseColorScaleByDefault,\r\n } = props;\r\n const [showLegend, setShowLegend] = useState(\r\n collapseColorScaleByDefault === undefined ? !(width < 680) : !collapseColorScaleByDefault,\r\n );\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centerOfMass(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <motion.g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </motion.g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n d={masterPath}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className={cn('absolute left-4 bottom-4 map-color-legend', classNames?.colorLegend)}>\r\n {showLegend ? (\r\n <>\r\n <div\r\n className='color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]'\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='color-legend-box p-2 bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)]'\r\n style={{ width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='show-color-legend-button items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-600 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col zoom-buttons'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useEffectEvent, useMemo, useRef, useState } from 'react';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects. */\r\n data: BivariateMapDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Colors for the choropleth map. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggle if color scale is collapsed by default. */\r\n collapseColorScaleByDefault?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n collapseColorScaleByDefault,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = useMemo(() => {\r\n const dates = [\r\n ...new Set(\r\n data\r\n .filter(d => d.date)\r\n .map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n ),\r\n ];\r\n dates.sort((a, b) => a - b);\r\n return dates;\r\n }, [data, timeline.dateFormat]);\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(entries[0].target.clientWidth || 620);\r\n setSvgHeight(entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const onUpdateShape = useEffectEvent((shape: any) => {\r\n setMapShape(shape);\r\n });\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n onUpdateShape(d);\r\n });\r\n } else {\r\n onUpdateShape(mapData);\r\n }\r\n }, [mapData]);\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\r\n }\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {svgWidth && svgHeight && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date === format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\r\n width={svgWidth}\r\n height={svgHeight}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n collapseColorScaleByDefault={collapseColorScaleByDefault}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["Graph","props","data","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","collapseColorScaleByDefault","showLegend","setShowLegend","useState","undefined","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","once","amount","mapG","zoomRef","useEffect","mapGSelect","select","current","mapSvgSelect","zoomFilter","e","type","includes","isWheel","isTouch","startsWith","isDrag","ctrlKey","button","zoomBehavior","zoom","scaleExtent","translateExtent","filter","on","transform","attr","call","bounds","bbox","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","Math","min","projection","geoMercator","rotate","geometry","coordinates","translate","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","xRange","Array","from","length","_","i","yRange","xScale","scaleThreshold","domain","range","yScale","handleZoom","direction","scaleBy","jsxs","Fragment","jsx","motion","d","position","map","layer","features","findIndex","el","id","properties","indexOf","j","masterPath","forEach","geo","path","c","k","point","stroke","strokeWidth","fill","AnimatePresence","index","xColorCoord","checkIfNullOrUndefined","x","yColorCoord","y","color","initial","opacity","whileInView","transition","duration","event","clientY","clientX","isEqual","fillOpacity","cn","colorLegend","X","cursor","numberFormattingFunction","max","P","display","WebkitLineClamp","WebkitBoxOrient","overflow","writingMode","Tooltip","DetailsModal","modal","BiVariateChoroplethMap","$","_c","graphTitle","t0","t1","sources","graphDescription","footNote","t2","t3","t4","t5","padding","t6","t7","backgroundColor","t8","t9","relativeHeight","isWorldMap","t10","t11","graphID","t12","t13","t14","graphDownload","t15","dataDownload","t16","showAntarctica","t17","language","t18","minHeight","t19","theme","t20","ariaLabel","t21","t22","t23","t24","t25","timeline","t26","Colors","light","bivariateColors","colors05x05","graphNoData","grays","t27","t28","t29","t30","enabled","autoplay","showOnlyActiveDate","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","dates","dateFormat","t31","d_0","parse","date","Date","getTime","Set","_temp","sort","_temp2","uniqDatesSorted","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","t32","Symbol","for","resizeObserver","ResizeObserver","entries","target","clientWidth","clientHeight","observe","disconnect","t33","shape","onUpdateShape","useEffectEvent","t34","fetchAndParseJSON","then","d_1","t35","t36","t37","speed","interval","setInterval","clearInterval","t38","t39","getSliderMarks","markObj","console","error","t40","graphContainer","t41","t42","description","title","GraphHeader","_temp3","_temp4","_temp5","_temp6","_temp7","t43","Pause","Play","SliderUI","nextValue","nextValue_0","t44","GraphArea","d_7","format","_temp8","getJenks","_temp9","_temp0","Spinner","t45","footnote","source","GraphFooter","t46","GraphContainer","d_9","d_8","NAME","d_4","d_3","d_2","d_6","d_5","a","b"],"mappings":"ygCA6EO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJC,KAAAA,EACAC,QAAAA,EACAC,QAAAA,EACAC,kBAAAA,GACAC,QAAAA,GACAC,kBAAAA,GACAC,MAAAA,EACAC,OAAAA,EACAC,OAAAA,EACAC,MAAAA,GACAC,YAAAA,EACAC,eAAAA,EACAC,eAAAA,EACAC,eAAAA,GACAC,QAAAA,GACAC,kBAAAA,GACAC,gBAAAA,GACAC,oBAAAA,GACAC,eAAAA,EACAC,mBAAAA,GACAC,YAAAA,EACAC,4BAAAA,GACAC,eAAAA,EACAC,eAAAA,GACAC,OAAAA,GACAC,WAAAA,EACAC,cAAAA,EACAC,gBAAAA,EACAC,QAAAA,EACAC,cAAAA,EACAC,aAAAA,GACAC,4BAAAA,EAAAA,EACEhC,EACE,CAACiC,GAAYC,EAAa,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