@undp/data-viz 2.1.6 → 2.1.8

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),O=require("react"),ot=require("./Typography-DX7PlgQU.cjs"),xt=require("./index-Cno4Q0YE.cjs"),mt=require("./Source-DYMJRrsq.cjs"),pt=require("./index-DQA8q5sC.cjs"),dt=require("./Tooltip-uUdw6wJL.cjs"),W=require("./Colors.cjs"),ct=require("./numberFormattingFunction-02t-wJta.cjs"),gt=require("./DetailsModal-BN0HDFlV.cjs"),z=require("./array-DMyR1sql.cjs"),ht=require("./use-in-view-QcfiW0w3.cjs"),ft=require("./index-DG2bgAva.cjs"),rt=require("./proxy-BxvUI_9l.cjs"),yt=require("./GraphFooter.cjs"),jt=require("./GraphHeader.cjs"),vt=require("./EmptyState-gLDRXBHm.cjs"),it=require("./GraphContainer-d8A46BK2.cjs"),bt=Math.PI,st=2*bt;function Et(l,t){return t<l?-1:t>l?1:t>=l?0:NaN}function Ct(l){return l}function Rt(){var l=Ct,t=Et,n=null,c=z.constant(0),r=z.constant(st),p=z.constant(0);function s(e){var a,f=(e=z.array(e)).length,d,w,x=0,g=new Array(f),v=new Array(f),y=+c.apply(this,arguments),A=Math.min(st,Math.max(-st,r.apply(this,arguments)-y)),m,P=Math.min(Math.abs(A)/f,p.apply(this,arguments)),F=P*(A<0?-1:1),h;for(a=0;a<f;++a)(h=v[g[a]=a]=+l(e[a],a,e))>0&&(x+=h);for(t!=null?g.sort(function(R,S){return t(v[R],v[S])}):n!=null&&g.sort(function(R,S){return n(e[R],e[S])}),a=0,w=x?(A-f*F)/x:0;a<f;++a,y=m)d=g[a],h=v[d],m=y+(h>0?h*w:0)+F,v[d]={data:e[d],index:a,value:h,startAngle:y,endAngle:m,padAngle:P};return v}return s.value=function(e){return arguments.length?(l=typeof e=="function"?e:z.constant(+e),s):l},s.sortValues=function(e){return arguments.length?(t=e,n=null,s):t},s.sort=function(e){return arguments.length?(n=e,t=null,s):n},s.startAngle=function(e){return arguments.length?(c=typeof e=="function"?e:z.constant(+e),s):c},s.endAngle=function(e){return arguments.length?(r=typeof e=="function"?e:z.constant(+e),s):r},s.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:z.constant(+e),s):p},s}const at=(l,t,n,c)=>({x:l+n*Math.cos(c),y:t+n*Math.sin(c)});function lt(l,t,n,c,r){const p=at(l,t,n,c),s=at(l,t,n,r===2*Math.PI?1.9999999999*Math.PI:r),e=r-c<=Math.PI?"0":"1";return["M",p.x,p.y,"A",n,n,0,e,1,s.x,s.y].join(" ")}function Mt(l){const t=o.compilerRuntimeExports.c(59),{mainText:n,data:c,radius:r,colors:p,subNote:s,strokeWidth:e,tooltip:a,onSeriesMouseOver:f,onSeriesMouseClick:d,colorDomain:w,resetSelectionOnDoubleClick:x,detailsOnClick:g,styles:v,classNames:y,precision:A,animate:m,trackColor:P}=l,F=O.useRef(null);let h;t[0]!==m.amount||t[1]!==m.once?(h={once:m.once,amount:m.amount},t[0]=m.amount,t[1]=m.once,t[2]=h):h=t[2];const R=ht.useInView(F,h),S=Rt().sort(null).startAngle(0).value(Dt),[j,X]=O.useState(void 0),[b,E]=O.useState(void 0),[G,Y]=O.useState(void 0),[T,J]=O.useState(void 0),K=rt.motion,Q=`${r*2}px`,U=`${r*2}px`,M=`0 0 ${r*2} ${r*2}`,I="ltr",et="mx-auto",$=rt.motion,Z=`translate(${r} ${r})`;let q;t[3]!==c||t[4]!==n||t[5]!==A||t[6]!==r||t[7]!==e||t[8]!==s?(q=n||s?o.jsxRuntimeExports.jsx("foreignObject",{y:0-(r-e),x:0-(r-e),width:2*(r-e),height:2*(r-e),children:o.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4",children:[n?o.jsxRuntimeExports.jsx(ot.v,{marginBottom:"none",className:"donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center",children:typeof n=="string"?n:c.findIndex(u=>u.label===n.label)!==-1?ct.numberFormattingFunction(c[c.findIndex(u=>u.label===n.label)].size,"NA",A,n.prefix,n.suffix):"NA"}):null,s?o.jsxRuntimeExports.jsx(ot.j,{marginBottom:"none",size:"base",leading:"none",className:"donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold",children:s}):typeof n=="string"||!n?null:o.jsxRuntimeExports.jsx(ot.j,{size:"base",marginBottom:"none",leading:"none",className:"donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold",children:n.label})]})}):null,t[3]=c,t[4]=n,t[5]=A,t[6]=r,t[7]=e,t[8]=s,t[9]=q):q=t[9];const _=r-e/2;let D;t[10]!==e||t[11]!==_||t[12]!==P?(D=o.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,r:_,fill:"none",stroke:P,strokeWidth:e}),t[10]=e,t[11]=_,t[12]=P,t[13]=D):D=t[13];const V=ft.AnimatePresence;let N;t[14]!==m.duration||t[15]!==w||t[16]!==p||t[17]!==g||t[18]!==R||t[19]!==b||t[20]!==j||t[21]!==d||t[22]!==f||t[23]!==r||t[24]!==x||t[25]!==E||t[26]!==e?(N=(u,ut)=>o.jsxRuntimeExports.jsx(rt.motion.path,{variants:{initial:{pathLength:0,d:lt(0,0,r-e/2,u.startAngle-Math.PI/2,u.endAngle-Math.PI/2),opacity:j?j.label===u.data.label?1:.3:1},whileInView:{pathLength:1,d:lt(0,0,r-e/2,u.startAngle-Math.PI/2,u.endAngle-Math.PI/2),opacity:j?j.label===u.data.label?1:.3:1,transition:{duration:m.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:m.duration}},style:{stroke:w.indexOf(u.data.label)!==-1?p[w.indexOf(u.data.label)%p.length]:W.Colors.gray,strokeWidth:e,fill:"none"},onMouseEnter:tt=>{X(u.data),J(tt.clientY),Y(tt.clientX),f?.(u)},onClick:()=>{(d||g)&&(pt.isEqual(b,u.data)&&x?(E(void 0),d?.(void 0)):(E(u.data),d&&d(u.data)))},onMouseMove:tt=>{X(u.data),J(tt.clientY),Y(tt.clientX)},onMouseLeave:()=>{X(void 0),Y(void 0),J(void 0),f?.(void 0)}},ut),t[14]=m.duration,t[15]=w,t[16]=p,t[17]=g,t[18]=R,t[19]=b,t[20]=j,t[21]=d,t[22]=f,t[23]=r,t[24]=x,t[25]=E,t[26]=e,t[27]=N):N=t[27];const i=S(c).map(N);let C;t[28]!==V||t[29]!==i?(C=o.jsxRuntimeExports.jsx(V,{children:i}),t[28]=V,t[29]=i,t[30]=C):C=t[30];let k;t[31]!==D||t[32]!==C||t[33]!==$.g||t[34]!==Z||t[35]!==q?(k=o.jsxRuntimeExports.jsxs($.g,{transform:Z,children:[q,D,C]}),t[31]=D,t[32]=C,t[33]=$.g,t[34]=Z,t[35]=q,t[36]=k):k=t[36];let B;t[37]!==K.svg||t[38]!==k||t[39]!==Q||t[40]!==U||t[41]!==M?(B=o.jsxRuntimeExports.jsx(K.svg,{ref:F,width:Q,height:U,viewBox:M,direction:I,className:et,children:k}),t[37]=K.svg,t[38]=k,t[39]=Q,t[40]=U,t[41]=M,t[42]=B):B=t[42];let H;t[43]!==y?.tooltip||t[44]!==G||t[45]!==T||t[46]!==j||t[47]!==v?.tooltip||t[48]!==a?(H=j&&a&&G&&T?o.jsxRuntimeExports.jsx(dt.Tooltip,{data:j,body:a,xPos:G,yPos:T,backgroundStyle:v?.tooltip,className:y?.tooltip}):null,t[43]=y?.tooltip,t[44]=G,t[45]=T,t[46]=j,t[47]=v?.tooltip,t[48]=a,t[49]=H):H=t[49];let L;t[50]!==y?.modal||t[51]!==g||t[52]!==b||t[53]!==E?(L=g&&b!==void 0?o.jsxRuntimeExports.jsx(gt.DetailsModal,{body:g,data:b,setData:E,className:y?.modal}):null,t[50]=y?.modal,t[51]=g,t[52]=b,t[53]=E,t[54]=L):L=t[54];let nt;return t[55]!==B||t[56]!==H||t[57]!==L?(nt=o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[B,H,L]}),t[55]=B,t[56]=H,t[57]=L,t[58]=nt):nt=t[58],nt}function Dt(l){return l.size}function Nt(l){const{mainText:t,graphTitle:n,colors:c=W.Colors.light.categoricalColors.colors,suffix:r="",sources:p,prefix:s="",strokeWidth:e=50,graphDescription:a,subNote:f,footNote:d,radius:w,data:x,showColorScale:g=!0,padding:v,backgroundColor:y=!1,tooltip:A,onSeriesMouseOver:m,graphID:P,onSeriesMouseClick:F,graphDownload:h=!1,dataDownload:R=!1,colorDomain:S,sortData:j,language:X="en",theme:b="light",width:E,height:G,minHeight:Y=0,relativeHeight:T,ariaLabel:J,resetSelectionOnDoubleClick:K=!0,colorScaleMaxWidth:Q,detailsOnClick:U,styles:M,classNames:I,precision:et=2,animate:$=!1,trackColor:Z=W.Colors.light.grays["gray-200"]}=l,[q,_]=O.useState(0),D=O.useRef(null),V=O.useRef(null);O.useEffect(()=>{const i=new ResizeObserver(C=>{_((Math.min(C[0].target.clientWidth||620,C[0].target.clientHeight||480)||420)/2)});return D.current&&i.observe(D.current),()=>i.disconnect()},[]);const N=j?xt.orderBy(x,["size"],[j]):x;return o.jsxRuntimeExports.jsxs(it.GraphContainer,{className:I?.graphContainer,style:M?.graphContainer,id:P,ref:V,"aria-label":J,backgroundColor:y,theme:b,language:X,minHeight:Y,width:E,height:G,relativeHeight:T,padding:v,children:[n||a||h||R?o.jsxRuntimeExports.jsx(jt.GraphHeader,{styles:{title:M?.title,description:M?.description},classNames:{title:I?.title,description:I?.description},graphTitle:n,graphDescription:a,width:E,graphDownload:h?V:void 0,dataDownload:R?x.map(i=>i.data).filter(i=>i!==void 0).length>0?x.map(i=>i.data).filter(i=>i!==void 0):x.filter(i=>i!==void 0):null}):null,g&&x.length>0?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:o.mo("leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap",I?.colorLegend),style:{maxWidth:Q},"aria-label":"Color legend",children:N.map((i,C)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center pb-3",children:[o.jsxRuntimeExports.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:(S||N.map(k=>k.label)).indexOf(i.label)!==-1?(c||W.Colors[b].categoricalColors.colors)[(S||N.map(k=>k.label)).indexOf(i.label)%(c||W.Colors[b].categoricalColors.colors).length]:W.Colors.gray}}),o.jsxRuntimeExports.jsxs(ot.j,{marginBottom:"none",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:[i.label,":"," ",o.jsxRuntimeExports.jsx("span",{className:"font-bold",style:{fontSize:"inherit"},children:ct.numberFormattingFunction(i.size,"NA",et,s,r)})]})]},C))}),o.jsxRuntimeExports.jsx(mt.n,{size:"lg"})]}):null,o.jsxRuntimeExports.jsxs(it.GraphArea,{ref:D,children:[x.length===0&&o.jsxRuntimeExports.jsx(vt.EmptyState,{}),q&&x.length>0?o.jsxRuntimeExports.jsx(Mt,{mainText:t,data:N,colors:c,radius:w||q,subNote:f,strokeWidth:e,tooltip:A,colorDomain:S||N.map(i=>i.label),onSeriesMouseOver:m,onSeriesMouseClick:F,resetSelectionOnDoubleClick:K,styles:M,detailsOnClick:U,precision:et,animate:$===!0?{duration:.5,once:!0,amount:.5}:$||{duration:0,once:!0,amount:0},trackColor:Z}):null]}),p||d?o.jsxRuntimeExports.jsx(yt.GraphFooter,{styles:{footnote:M?.footnote,source:M?.source},classNames:{footnote:I?.footnote,source:I?.source},sources:p,footNote:d,width:E}):null]})}exports.DonutChart=Nt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-CTPQjnHt.cjs"),M=require("react"),ot=require("./Typography-DX7PlgQU.cjs"),mt=require("./index-Cno4Q0YE.cjs"),xt=require("./Source-DYMJRrsq.cjs"),pt=require("./index-DQA8q5sC.cjs"),dt=require("./Tooltip-uUdw6wJL.cjs"),W=require("./Colors.cjs"),ct=require("./numberFormattingFunction-02t-wJta.cjs"),gt=require("./DetailsModal-BN0HDFlV.cjs"),F=require("./array-DMyR1sql.cjs"),ht=require("./use-in-view-QcfiW0w3.cjs"),ft=require("./index-DG2bgAva.cjs"),rt=require("./proxy-BxvUI_9l.cjs"),yt=require("./GraphFooter.cjs"),jt=require("./GraphHeader.cjs"),vt=require("./EmptyState-gLDRXBHm.cjs"),it=require("./GraphContainer-d8A46BK2.cjs"),bt=Math.PI,st=2*bt;function Et(c,t){return t<c?-1:t>c?1:t>=c?0:NaN}function Ct(c){return c}function Mt(){var c=Ct,t=Et,n=null,a=F.constant(0),r=F.constant(st),p=F.constant(0);function s(e){var l,f=(e=F.array(e)).length,d,S,m=0,g=new Array(f),v=new Array(f),y=+a.apply(this,arguments),q=Math.min(st,Math.max(-st,r.apply(this,arguments)-y)),x,P=Math.min(Math.abs(q)/f,p.apply(this,arguments)),G=P*(q<0?-1:1),h;for(l=0;l<f;++l)(h=v[g[l]=l]=+c(e[l],l,e))>0&&(m+=h);for(t!=null?g.sort(function(R,A){return t(v[R],v[A])}):n!=null&&g.sort(function(R,A){return n(e[R],e[A])}),l=0,S=m?(q-f*G)/m:0;l<f;++l,y=x)d=g[l],h=v[d],x=y+(h>0?h*S:0)+G,v[d]={data:e[d],index:l,value:h,startAngle:y,endAngle:x,padAngle:P};return v}return s.value=function(e){return arguments.length?(c=typeof e=="function"?e:F.constant(+e),s):c},s.sortValues=function(e){return arguments.length?(t=e,n=null,s):t},s.sort=function(e){return arguments.length?(n=e,t=null,s):n},s.startAngle=function(e){return arguments.length?(a=typeof e=="function"?e:F.constant(+e),s):a},s.endAngle=function(e){return arguments.length?(r=typeof e=="function"?e:F.constant(+e),s):r},s.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:F.constant(+e),s):p},s}const at=(c,t,n,a)=>({x:c+n*Math.cos(a),y:t+n*Math.sin(a)});function lt(c,t,n,a,r){const p=at(c,t,n,a),s=at(c,t,n,Math.abs(r-a)===2*Math.PI?.999999*r:r),e=r-a<=Math.PI?"0":"1";return["M",p.x,p.y,"A",n,n,0,e,1,s.x,s.y].join(" ")}function Rt(c){const t=o.compilerRuntimeExports.c(59),{mainText:n,data:a,radius:r,colors:p,subNote:s,strokeWidth:e,tooltip:l,onSeriesMouseOver:f,onSeriesMouseClick:d,colorDomain:S,resetSelectionOnDoubleClick:m,detailsOnClick:g,styles:v,classNames:y,precision:q,animate:x,trackColor:P}=c,G=M.useRef(null);let h;t[0]!==x.amount||t[1]!==x.once?(h={once:x.once,amount:x.amount},t[0]=x.amount,t[1]=x.once,t[2]=h):h=t[2];const R=ht.useInView(G,h),A=Mt().sort(null).startAngle(0).value(Dt),[j,X]=M.useState(void 0),[b,E]=M.useState(void 0),[V,Y]=M.useState(void 0),[I,J]=M.useState(void 0),K=rt.motion,Q=`${r*2}px`,U=`${r*2}px`,D=`0 0 ${r*2} ${r*2}`,z="ltr",et="mx-auto",T=rt.motion,Z=`translate(${r} ${r})`;let O;t[3]!==a||t[4]!==n||t[5]!==q||t[6]!==r||t[7]!==e||t[8]!==s?(O=n||s?o.jsxRuntimeExports.jsx("foreignObject",{y:0-(r-e),x:0-(r-e),width:2*(r-e),height:2*(r-e),children:o.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4",children:[n?M.isValidElement(n)?n:o.jsxRuntimeExports.jsx(ot.v,{marginBottom:"none",className:"donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center",children:typeof n=="string"?n:a.findIndex(u=>u.label===n.label)!==-1?ct.numberFormattingFunction(a[a.findIndex(u=>u.label===n.label)].size,"NA",q,n.prefix,n.suffix):"NA"}):null,s?o.jsxRuntimeExports.jsx(ot.j,{marginBottom:"none",size:"base",leading:"none",className:"donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold",children:s}):typeof n=="string"||!n||M.isValidElement(n)?null:o.jsxRuntimeExports.jsx(ot.j,{size:"base",marginBottom:"none",leading:"none",className:"donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold",children:n.label})]})}):null,t[3]=a,t[4]=n,t[5]=q,t[6]=r,t[7]=e,t[8]=s,t[9]=O):O=t[9];const _=r-e/2;let N;t[10]!==e||t[11]!==_||t[12]!==P?(N=o.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,r:_,fill:"none",stroke:P,strokeWidth:e}),t[10]=e,t[11]=_,t[12]=P,t[13]=N):N=t[13];const $=ft.AnimatePresence;let k;t[14]!==x.duration||t[15]!==S||t[16]!==p||t[17]!==g||t[18]!==R||t[19]!==b||t[20]!==j||t[21]!==d||t[22]!==f||t[23]!==r||t[24]!==m||t[25]!==E||t[26]!==e?(k=(u,ut)=>o.jsxRuntimeExports.jsx(rt.motion.path,{variants:{initial:{pathLength:0,d:lt(0,0,r-e/2,u.startAngle-Math.PI/2,u.endAngle-Math.PI/2),opacity:j?j.label===u.data.label?1:.3:1},whileInView:{pathLength:1,d:lt(0,0,r-e/2,u.startAngle-Math.PI/2,u.endAngle-Math.PI/2),opacity:j?j.label===u.data.label?1:.3:1,transition:{duration:x.duration}}},initial:"initial",animate:R?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},style:{stroke:S.indexOf(u.data.label)!==-1?p[S.indexOf(u.data.label)%p.length]:W.Colors.gray,strokeWidth:e,fill:"none"},onMouseEnter:tt=>{X(u.data),J(tt.clientY),Y(tt.clientX),f?.(u)},onClick:()=>{(d||g)&&(pt.isEqual(b,u.data)&&m?(E(void 0),d?.(void 0)):(E(u.data),d&&d(u.data)))},onMouseMove:tt=>{X(u.data),J(tt.clientY),Y(tt.clientX)},onMouseLeave:()=>{X(void 0),Y(void 0),J(void 0),f?.(void 0)}},ut),t[14]=x.duration,t[15]=S,t[16]=p,t[17]=g,t[18]=R,t[19]=b,t[20]=j,t[21]=d,t[22]=f,t[23]=r,t[24]=m,t[25]=E,t[26]=e,t[27]=k):k=t[27];const i=A(a).map(k);let C;t[28]!==$||t[29]!==i?(C=o.jsxRuntimeExports.jsx($,{children:i}),t[28]=$,t[29]=i,t[30]=C):C=t[30];let w;t[31]!==N||t[32]!==C||t[33]!==T.g||t[34]!==Z||t[35]!==O?(w=o.jsxRuntimeExports.jsxs(T.g,{transform:Z,children:[O,N,C]}),t[31]=N,t[32]=C,t[33]=T.g,t[34]=Z,t[35]=O,t[36]=w):w=t[36];let B;t[37]!==K.svg||t[38]!==w||t[39]!==Q||t[40]!==U||t[41]!==D?(B=o.jsxRuntimeExports.jsx(K.svg,{ref:G,width:Q,height:U,viewBox:D,direction:z,className:et,children:w}),t[37]=K.svg,t[38]=w,t[39]=Q,t[40]=U,t[41]=D,t[42]=B):B=t[42];let H;t[43]!==y?.tooltip||t[44]!==V||t[45]!==I||t[46]!==j||t[47]!==v?.tooltip||t[48]!==l?(H=j&&l&&V&&I?o.jsxRuntimeExports.jsx(dt.Tooltip,{data:j,body:l,xPos:V,yPos:I,backgroundStyle:v?.tooltip,className:y?.tooltip}):null,t[43]=y?.tooltip,t[44]=V,t[45]=I,t[46]=j,t[47]=v?.tooltip,t[48]=l,t[49]=H):H=t[49];let L;t[50]!==y?.modal||t[51]!==g||t[52]!==b||t[53]!==E?(L=g&&b!==void 0?o.jsxRuntimeExports.jsx(gt.DetailsModal,{body:g,data:b,setData:E,className:y?.modal}):null,t[50]=y?.modal,t[51]=g,t[52]=b,t[53]=E,t[54]=L):L=t[54];let nt;return t[55]!==B||t[56]!==H||t[57]!==L?(nt=o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[B,H,L]}),t[55]=B,t[56]=H,t[57]=L,t[58]=nt):nt=t[58],nt}function Dt(c){return c.size}function Nt(c){const{mainText:t,graphTitle:n,colors:a=W.Colors.light.categoricalColors.colors,suffix:r="",sources:p,prefix:s="",strokeWidth:e=50,graphDescription:l,subNote:f,footNote:d,radius:S,data:m,showColorScale:g=!0,padding:v,backgroundColor:y=!1,tooltip:q,onSeriesMouseOver:x,graphID:P,onSeriesMouseClick:G,graphDownload:h=!1,dataDownload:R=!1,colorDomain:A,sortData:j,language:X="en",theme:b="light",width:E,height:V,minHeight:Y=0,relativeHeight:I,ariaLabel:J,resetSelectionOnDoubleClick:K=!0,colorScaleMaxWidth:Q,detailsOnClick:U,styles:D,classNames:z,precision:et=2,animate:T=!1,trackColor:Z=W.Colors.light.grays["gray-200"]}=c,[O,_]=M.useState(0),N=M.useRef(null),$=M.useRef(null);M.useEffect(()=>{const i=new ResizeObserver(C=>{_((Math.min(C[0].target.clientWidth||620,C[0].target.clientHeight||480)||420)/2)});return N.current&&i.observe(N.current),()=>i.disconnect()},[]);const k=j?mt.orderBy(m,["size"],[j]):m;return o.jsxRuntimeExports.jsxs(it.GraphContainer,{className:z?.graphContainer,style:D?.graphContainer,id:P,ref:$,"aria-label":J,backgroundColor:y,theme:b,language:X,minHeight:Y,width:E,height:V,relativeHeight:I,padding:v,children:[n||l||h||R?o.jsxRuntimeExports.jsx(jt.GraphHeader,{styles:{title:D?.title,description:D?.description},classNames:{title:z?.title,description:z?.description},graphTitle:n,graphDescription:l,width:E,graphDownload:h?$:void 0,dataDownload:R?m.map(i=>i.data).filter(i=>i!==void 0).length>0?m.map(i=>i.data).filter(i=>i!==void 0):m.filter(i=>i!==void 0):null}):null,g&&m.length>0?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:o.mo("leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap",z?.colorLegend),style:{maxWidth:Q},"aria-label":"Color legend",children:k.map((i,C)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center pb-3",children:[o.jsxRuntimeExports.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:(A||k.map(w=>w.label)).indexOf(i.label)!==-1?(a||W.Colors[b].categoricalColors.colors)[(A||k.map(w=>w.label)).indexOf(i.label)%(a||W.Colors[b].categoricalColors.colors).length]:W.Colors.gray}}),o.jsxRuntimeExports.jsxs(ot.j,{marginBottom:"none",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:[i.label,":"," ",o.jsxRuntimeExports.jsx("span",{className:"font-bold",style:{fontSize:"inherit"},children:ct.numberFormattingFunction(i.size,"NA",et,s,r)})]})]},C))}),o.jsxRuntimeExports.jsx(xt.n,{size:"lg"})]}):null,o.jsxRuntimeExports.jsxs(it.GraphArea,{ref:N,children:[m.length===0&&o.jsxRuntimeExports.jsx(vt.EmptyState,{}),O&&m.length>0?o.jsxRuntimeExports.jsx(Rt,{mainText:t,data:k,colors:a,radius:S||O,subNote:f,strokeWidth:e,tooltip:q,colorDomain:A||k.map(i=>i.label),onSeriesMouseOver:x,onSeriesMouseClick:G,resetSelectionOnDoubleClick:K,styles:D,detailsOnClick:U,precision:et,animate:T===!0?{duration:.5,once:!0,amount:.5}:T||{duration:0,once:!0,amount:0},trackColor:Z}):null]}),p||d?o.jsxRuntimeExports.jsx(yt.GraphFooter,{styles:{footnote:D?.footnote,source:D?.source},classNames:{footnote:z?.footnote,source:z?.source},sources:p,footNote:d,width:E}):null]})}exports.DonutChart=Nt;
2
2
  //# sourceMappingURL=DonutChart.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DonutChart.cjs","sources":["../node_modules/d3-shape/src/math.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../src/Utils/getArc.ts","../src/Components/Graphs/DonutChart/Graph.tsx","../src/Components/Graphs/DonutChart/index.tsx"],"sourcesContent":["export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","const polarToCartesian = (\r\n centerX: number,\r\n centerY: number,\r\n radius: number,\r\n angleInRadians: number,\r\n) => {\r\n return {\r\n x: centerX + radius * Math.cos(angleInRadians),\r\n y: centerY + radius * Math.sin(angleInRadians),\r\n };\r\n};\r\n\r\nexport function getArc(\r\n x: number,\r\n y: number,\r\n radius: number,\r\n startAngleInRadians: number,\r\n endAngleInRadians: number,\r\n) {\r\n const start = polarToCartesian(x, y, radius, startAngleInRadians);\r\n const end = polarToCartesian(\r\n x,\r\n y,\r\n radius,\r\n endAngleInRadians === 2 * Math.PI ? 1.9999999999 * Math.PI : endAngleInRadians,\r\n );\r\n const largeArcFlag = endAngleInRadians - startAngleInRadians <= Math.PI ? '0' : '1';\r\n const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 1, end.x, end.y].join(\r\n ' ',\r\n );\r\n return d;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie } from 'd3-shape';\r\nimport { useRef, useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport { AnimateDataType, ClassNameObject, DonutChartDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { getArc } from '@/Utils/getArc';\r\n\r\ninterface Props {\r\n mainText?: string | { label: string; suffix?: string; prefix?: string };\r\n radius: number;\r\n colors: string[];\r\n subNote?: string;\r\n strokeWidth: number;\r\n data: DonutChartDataType[];\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n animate: AnimateDataType;\r\n trackColor: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n mainText,\r\n data,\r\n radius,\r\n colors,\r\n subNote,\r\n strokeWidth,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision,\r\n animate,\r\n trackColor,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n .value((d: any) => d.size);\r\n\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n return (\r\n <>\r\n <motion.svg\r\n ref={svgRef}\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n className='mx-auto'\r\n >\r\n <motion.g transform={`translate(${radius} ${radius})`}>\r\n {mainText || subNote ? (\r\n <foreignObject\r\n y={0 - (radius - strokeWidth)}\r\n x={0 - (radius - strokeWidth)}\r\n width={2 * (radius - strokeWidth)}\r\n height={2 * (radius - strokeWidth)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4'>\r\n {mainText ? (\r\n <H2\r\n marginBottom='none'\r\n className='donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center'\r\n >\r\n {typeof mainText === 'string'\r\n ? mainText\r\n : data.findIndex(d => d.label === mainText.label) !== -1\r\n ? numberFormattingFunction(\r\n data[data.findIndex(d => d.label === mainText.label)].size,\r\n 'NA',\r\n precision,\r\n mainText.prefix,\r\n mainText.suffix,\r\n )\r\n : 'NA'}\r\n </H2>\r\n ) : null}\r\n {subNote ? (\r\n <P\r\n marginBottom='none'\r\n size='base'\r\n leading='none'\r\n className='donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {subNote}\r\n </P>\r\n ) : typeof mainText === 'string' || !mainText ? null : (\r\n <P\r\n size='base'\r\n marginBottom='none'\r\n leading='none'\r\n className='donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {mainText.label}\r\n </P>\r\n )}\r\n </div>\r\n </foreignObject>\r\n ) : null}\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radius - strokeWidth / 2}\r\n fill='none'\r\n stroke={trackColor}\r\n strokeWidth={strokeWidth}\r\n />\r\n <AnimatePresence>\r\n {pieData(data as any).map((d, i) => (\r\n <motion.path\r\n key={i}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\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 style={{\r\n stroke:\r\n colorDomain.indexOf((d.data as any).label) !== -1\r\n ? colors[colorDomain.indexOf((d.data as any).label) % colors.length]\r\n : Colors.gray,\r\n strokeWidth,\r\n fill: 'none',\r\n }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d.data);\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.data) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d.data);\r\n if (onSeriesMouseClick) onSeriesMouseClick(d.data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d.data);\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 ))}\r\n </AnimatePresence>\r\n </motion.g>\r\n </motion.svg>\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, useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Spacer } from '@undp/design-system-react/Spacer';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DonutChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\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: DonutChartDataType[];\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 /** Array of colors for each segment */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: 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 /** Radius of the donut chart */\r\n radius?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Max width of the color scale as a css property */\r\n colorScaleMaxWidth?: string;\r\n /** Stroke width of the arcs and circle of the donut */\r\n strokeWidth?: number;\r\n /** Sorting order for data. This is overwritten by labelOrder prop */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Large text at the center of the donut chart. If the type is an object then the text is the value in the data for the label mentioned in the object */\r\n mainText?: string | { label: string; suffix?: string; prefix?: string };\r\n /** Small text at the center of the donut chart */\r\n subNote?: string;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Track color (i.e. the color of the donut chart's background) of the donut chart */\r\n trackColor?: string;\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 DonutChart(props: Props) {\r\n const {\r\n mainText,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n strokeWidth = 50,\r\n graphDescription,\r\n subNote,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n sortData,\r\n language = 'en',\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n colorScaleMaxWidth,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision = 2,\r\n animate = false,\r\n trackColor = Colors.light.grays['gray-200'],\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setGraphRadius(\r\n (Math.min(\r\n ...[entries[0].target.clientWidth || 620, entries[0].target.clientHeight || 480],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const sortedData = sortData ? orderBy(data, ['size'], [sortData]) : data;\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 {showColorScale && data.length > 0 ? (\r\n <>\r\n <div\r\n className={cn(\r\n 'leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap',\r\n classNames?.colorLegend,\r\n )}\r\n style={{ maxWidth: colorScaleMaxWidth }}\r\n aria-label='Color legend'\r\n >\r\n {sortedData.map((d, i) => (\r\n <div className='flex gap-2 items-center pb-3' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{\r\n backgroundColor:\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) !== -1\r\n ? (colors || Colors[theme].categoricalColors.colors)[\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) %\r\n (colors || Colors[theme].categoricalColors.colors).length\r\n ]\r\n : Colors.gray,\r\n }}\r\n />\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n className='text-primary-gray-700 dark:text-primary-gray-100'\r\n >\r\n {d.label}:{' '}\r\n <span className='font-bold' style={{ fontSize: 'inherit' }}>\r\n {numberFormattingFunction(d.size, 'NA', precision, prefix, suffix)}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n <Spacer size='lg' />\r\n </>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {data.length === 0 && <EmptyState />}\r\n {graphRadius && data.length > 0 ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n radius={radius || graphRadius}\r\n subNote={subNote}\r\n strokeWidth={strokeWidth}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || sortedData.map(d => d.label)}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n precision={precision}\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 trackColor={trackColor}\r\n />\r\n ) : null}\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":["pi","tau","descending","a","b","identity","d","pie","value","sortValues","sort","startAngle","constant","endAngle","padAngle","data","i","n","array","j","k","sum","index","arcs","a0","da","a1","p","pa","v","_","polarToCartesian","centerX","centerY","radius","angleInRadians","x","Math","cos","y","sin","getArc","startAngleInRadians","endAngleInRadians","start","end","PI","largeArcFlag","join","Graph","props","$","_c","mainText","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","precision","animate","trackColor","svgRef","useRef","t0","amount","once","isInView","useInView","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t1","motion","t2","t3","t4","t5","t6","t7","t8","t9","jsx","jsxs","H2","findIndex","d_1","label","numberFormattingFunction","d_0","size","prefix","suffix","P","t10","t11","T0","AnimatePresence","t12","duration","d_2","initial","pathLength","opacity","whileInView","transition","stroke","indexOf","length","Colors","gray","fill","event","clientY","clientX","isEqual","event_0","t13","map","t14","t15","g","t16","svg","t17","Tooltip","t18","modal","DetailsModal","t19","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","grays","graphRadius","setGraphRadius","graphDiv","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","min","target","clientWidth","clientHeight","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","EmptyState","GraphFooter","footnote","source"],"mappings":"0uBASaA,GAAK,KAAK,GAEVC,GAAM,EAAID,GCXR,SAAAE,GAASC,EAAGC,EAAG,CAC5B,OAAOA,EAAID,EAAI,GAAKC,EAAID,EAAI,EAAIC,GAAKD,EAAI,EAAI,GAC/C,CCFe,SAAAE,GAASC,EAAG,CACzB,OAAOA,CACT,CCIe,SAAAC,IAAW,CACxB,IAAIC,EAAQH,GACRI,EAAaP,GACbQ,EAAO,KACPC,EAAaC,EAAAA,SAAS,CAAC,EACvBC,EAAWD,EAAAA,SAASX,EAAG,EACvBa,EAAWF,EAAAA,SAAS,CAAC,EAEzB,SAASL,EAAIQ,EAAM,CACjB,IAAIC,EACAC,GAAKF,EAAOG,QAAMH,CAAI,GAAG,OACzBI,EACAC,EACAC,EAAM,EACNC,EAAQ,IAAI,MAAML,CAAC,EACnBM,EAAO,IAAI,MAAMN,CAAC,EAClBO,EAAK,CAACb,EAAW,MAAM,KAAM,SAAS,EACtCc,EAAK,KAAK,IAAIxB,GAAK,KAAK,IAAI,CAACA,GAAKY,EAAS,MAAM,KAAM,SAAS,EAAIW,CAAE,CAAC,EACvEE,EACAC,EAAI,KAAK,IAAI,KAAK,IAAIF,CAAE,EAAIR,EAAGH,EAAS,MAAM,KAAM,SAAS,CAAC,EAC9Dc,EAAKD,GAAK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,CAAA,CAAA,CACF,CAAA,GAtBiD3F,CAuBnD,CACD,EACH,EACAiF,EAAAA,kBAAAA,IAACoG,GAAAA,EAAA,CAAO,KAAK,IAAA,CAAI,CAAA,CAAA,CACnB,EACE,KACJnG,EAAAA,kBAAAA,KAACoG,GAAAA,UAAA,CAAU,IAAK3B,EACb5J,SAAAA,CAAAA,EAAK4G,SAAW,GAAK1B,EAAAA,kBAAAA,IAACsG,GAAAA,WAAA,CAAA,CAAU,EAChC9B,GAAe1J,EAAK4G,OAAS,0BAC3B1E,GAAA,CACC,SAAAI,EACA,KAAMmI,EACN,OAAAlI,EACA,OAAQpB,GAAUuI,EAClB,QAAAlH,EACA,YAAAC,EACA,QAAAC,EACA,YAAaG,GAAe4H,EAAWnD,IAAI/H,GAAKA,EAAEgG,KAAK,EACvD,kBAAA5C,EACA,mBAAAC,EACA,4BAAAE,EACA,OAAAE,EACA,eAAAD,EACA,UAAAG,GACA,QACEC,IAAY,GACR,CAAEgD,SAAU,GAAK1C,KAAM,GAAMD,OAAQ,EAAA,EACrCL,GAAW,CAAEgD,SAAU,EAAG1C,KAAM,GAAMD,OAAQ,CAAA,EAEpD,WAAAJ,EAAuB,EAEvB,IAAA,EACN,EACCmF,GAAWE,EACVvD,EAAAA,kBAAAA,IAACuG,GAAAA,YAAA,CACC,OAAQ,CAAEC,SAAU1I,GAAQ0I,SAAUC,OAAQ3I,GAAQ2I,MAAAA,EACtD,WAAY,CACVD,SAAUzI,GAAYyI,SACtBC,OAAQ1I,GAAY0I,MAAAA,EAEtB,QAAApD,EACA,SAAAE,EACA,MAAAU,CAAA,CAAa,EAEb,IAAA,EACN,CAEJ","x_google_ignoreList":[0,1,2,3]}
1
+ {"version":3,"file":"DonutChart.cjs","sources":["../node_modules/d3-shape/src/math.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../src/Utils/getArc.ts","../src/Components/Graphs/DonutChart/Graph.tsx","../src/Components/Graphs/DonutChart/index.tsx"],"sourcesContent":["export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","const polarToCartesian = (\r\n centerX: number,\r\n centerY: number,\r\n radius: number,\r\n angleInRadians: number,\r\n) => {\r\n return {\r\n x: centerX + radius * Math.cos(angleInRadians),\r\n y: centerY + radius * Math.sin(angleInRadians),\r\n };\r\n};\r\n\r\nexport function getArc(\r\n x: number,\r\n y: number,\r\n radius: number,\r\n startAngleInRadians: number,\r\n endAngleInRadians: number,\r\n) {\r\n const start = polarToCartesian(x, y, radius, startAngleInRadians);\r\n const end = polarToCartesian(\r\n x,\r\n y,\r\n radius,\r\n Math.abs(endAngleInRadians - startAngleInRadians) === 2 * Math.PI\r\n ? 0.999999 * endAngleInRadians\r\n : endAngleInRadians,\r\n );\r\n const largeArcFlag = endAngleInRadians - startAngleInRadians <= Math.PI ? '0' : '1';\r\n const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 1, end.x, end.y].join(\r\n ' ',\r\n );\r\n return d;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie } from 'd3-shape';\r\nimport { isValidElement, ReactElement, useRef, useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport { AnimateDataType, ClassNameObject, DonutChartDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { getArc } from '@/Utils/getArc';\r\n\r\ninterface Props {\r\n mainText?: string | { label: string; suffix?: string; prefix?: string } | ReactElement;\r\n radius: number;\r\n colors: string[];\r\n subNote?: string;\r\n strokeWidth: number;\r\n data: DonutChartDataType[];\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n animate: AnimateDataType;\r\n trackColor: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n mainText,\r\n data,\r\n radius,\r\n colors,\r\n subNote,\r\n strokeWidth,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision,\r\n animate,\r\n trackColor,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n .value((d: any) => d.size);\r\n\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n return (\r\n <>\r\n <motion.svg\r\n ref={svgRef}\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n className='mx-auto'\r\n >\r\n <motion.g transform={`translate(${radius} ${radius})`}>\r\n {mainText || subNote ? (\r\n <foreignObject\r\n y={0 - (radius - strokeWidth)}\r\n x={0 - (radius - strokeWidth)}\r\n width={2 * (radius - strokeWidth)}\r\n height={2 * (radius - strokeWidth)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4'>\r\n {mainText ? (\r\n isValidElement(mainText) ? (\r\n mainText\r\n ) : (\r\n <H2\r\n marginBottom='none'\r\n className='donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center'\r\n >\r\n {typeof mainText === 'string'\r\n ? mainText\r\n : data.findIndex(d => d.label === mainText.label) !== -1\r\n ? numberFormattingFunction(\r\n data[data.findIndex(d => d.label === mainText.label)].size,\r\n 'NA',\r\n precision,\r\n mainText.prefix,\r\n mainText.suffix,\r\n )\r\n : 'NA'}\r\n </H2>\r\n )\r\n ) : null}\r\n {subNote ? (\r\n <P\r\n marginBottom='none'\r\n size='base'\r\n leading='none'\r\n className='donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {subNote}\r\n </P>\r\n ) : typeof mainText === 'string' || !mainText || isValidElement(mainText) ? null : (\r\n <P\r\n size='base'\r\n marginBottom='none'\r\n leading='none'\r\n className='donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {mainText.label}\r\n </P>\r\n )}\r\n </div>\r\n </foreignObject>\r\n ) : null}\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radius - strokeWidth / 2}\r\n fill='none'\r\n stroke={trackColor}\r\n strokeWidth={strokeWidth}\r\n />\r\n <AnimatePresence>\r\n {pieData(data as any).map((d, i) => (\r\n <motion.path\r\n key={i}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\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 style={{\r\n stroke:\r\n colorDomain.indexOf((d.data as any).label) !== -1\r\n ? colors[colorDomain.indexOf((d.data as any).label) % colors.length]\r\n : Colors.gray,\r\n strokeWidth,\r\n fill: 'none',\r\n }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d.data);\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.data) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d.data);\r\n if (onSeriesMouseClick) onSeriesMouseClick(d.data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d.data);\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 ))}\r\n </AnimatePresence>\r\n </motion.g>\r\n </motion.svg>\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 { ReactElement, useEffect, useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Spacer } from '@undp/design-system-react/Spacer';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DonutChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\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: DonutChartDataType[];\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 /** Array of colors for each segment */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: 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 /** Radius of the donut chart */\r\n radius?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Max width of the color scale as a css property */\r\n colorScaleMaxWidth?: string;\r\n /** Stroke width of the arcs and circle of the donut */\r\n strokeWidth?: number;\r\n /** Sorting order for data. This is overwritten by labelOrder prop */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Large text at the center of the donut chart. If the type is an object then the text is the value in the data for the label mentioned in the object */\r\n mainText?: string | { label: string; suffix?: string; prefix?: string } | ReactElement;\r\n /** Small text at the center of the donut chart */\r\n subNote?: string;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Track color (i.e. the color of the donut chart's background) of the donut chart */\r\n trackColor?: string;\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 DonutChart(props: Props) {\r\n const {\r\n mainText,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n strokeWidth = 50,\r\n graphDescription,\r\n subNote,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n sortData,\r\n language = 'en',\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n colorScaleMaxWidth,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision = 2,\r\n animate = false,\r\n trackColor = Colors.light.grays['gray-200'],\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setGraphRadius(\r\n (Math.min(\r\n ...[entries[0].target.clientWidth || 620, entries[0].target.clientHeight || 480],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const sortedData = sortData ? orderBy(data, ['size'], [sortData]) : data;\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 {showColorScale && data.length > 0 ? (\r\n <>\r\n <div\r\n className={cn(\r\n 'leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap',\r\n classNames?.colorLegend,\r\n )}\r\n style={{ maxWidth: colorScaleMaxWidth }}\r\n aria-label='Color legend'\r\n >\r\n {sortedData.map((d, i) => (\r\n <div className='flex gap-2 items-center pb-3' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{\r\n backgroundColor:\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) !== -1\r\n ? (colors || Colors[theme].categoricalColors.colors)[\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) %\r\n (colors || Colors[theme].categoricalColors.colors).length\r\n ]\r\n : Colors.gray,\r\n }}\r\n />\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n className='text-primary-gray-700 dark:text-primary-gray-100'\r\n >\r\n {d.label}:{' '}\r\n <span className='font-bold' style={{ fontSize: 'inherit' }}>\r\n {numberFormattingFunction(d.size, 'NA', precision, prefix, suffix)}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n <Spacer size='lg' />\r\n </>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {data.length === 0 && <EmptyState />}\r\n {graphRadius && data.length > 0 ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n radius={radius || graphRadius}\r\n subNote={subNote}\r\n strokeWidth={strokeWidth}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || sortedData.map(d => d.label)}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n precision={precision}\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 trackColor={trackColor}\r\n />\r\n ) : null}\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":["pi","tau","descending","a","b","identity","d","pie","value","sortValues","sort","startAngle","constant","endAngle","padAngle","data","i","n","array","j","k","sum","index","arcs","a0","da","a1","p","pa","v","_","polarToCartesian","centerX","centerY","radius","angleInRadians","x","Math","cos","y","sin","getArc","startAngleInRadians","endAngleInRadians","start","end","abs","PI","largeArcFlag","join","Graph","props","$","_c","mainText","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","precision","animate","trackColor","svgRef","useRef","t0","amount","once","isInView","useInView","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t1","motion","t2","t3","t4","t5","t6","t7","t8","t9","jsx","jsxs","isValidElement","H2","findIndex","d_1","label","numberFormattingFunction","size","prefix","suffix","P","t10","t11","T0","AnimatePresence","t12","duration","d_2","initial","pathLength","opacity","whileInView","transition","stroke","indexOf","length","Colors","gray","fill","event","clientY","clientX","isEqual","event_0","t13","map","t14","t15","g","t16","svg","t17","Tooltip","t18","modal","DetailsModal","t19","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","grays","graphRadius","setGraphRadius","graphDiv","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","min","target","clientWidth","clientHeight","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","EmptyState","GraphFooter","footnote","source"],"mappings":"0uBASaA,GAAK,KAAK,GAEVC,GAAM,EAAID,GCXR,SAAAE,GAASC,EAAGC,EAAG,CAC5B,OAAOA,EAAID,EAAI,GAAKC,EAAID,EAAI,EAAIC,GAAKD,EAAI,EAAI,GAC/C,CCFe,SAAAE,GAASC,EAAG,CACzB,OAAOA,CACT,CCIe,SAAAC,IAAW,CACxB,IAAIC,EAAQH,GACRI,EAAaP,GACbQ,EAAO,KACPC,EAAaC,EAAAA,SAAS,CAAC,EACvBC,EAAWD,EAAAA,SAASX,EAAG,EACvBa,EAAWF,EAAAA,SAAS,CAAC,EAEzB,SAASL,EAAIQ,EAAM,CACjB,IAAIC,EACAC,GAAKF,EAAOG,QAAMH,CAAI,GAAG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CAAEC,SAAU1I,GAAQ0I,SAAUC,OAAQ3I,GAAQ2I,MAAAA,EACtD,WAAY,CACVD,SAAUzI,GAAYyI,SACtBC,OAAQ1I,GAAY0I,MAAAA,EAEtB,QAAApD,EACA,SAAAE,EACA,MAAAU,CAAA,CAAa,EAEb,IAAA,EACN,CAEJ","x_google_ignoreList":[0,1,2,3]}
@@ -1,4 +1,5 @@
1
1
  import { JSX } from 'react/jsx-runtime';
2
+ import { ReactElement } from 'react';
2
3
 
3
4
  declare interface AnimateDataType {
4
5
  duration: number;
@@ -103,7 +104,7 @@ declare interface Props {
103
104
  label: string;
104
105
  suffix?: string;
105
106
  prefix?: string;
106
- };
107
+ } | ReactElement;
107
108
  /** Small text at the center of the donut chart */
108
109
  subNote?: string;
109
110
  /** Specifies the number of decimal places to display in the value. */