@undp/data-viz 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.js +2 -2
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.js +2 -2
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.js +1 -1
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.cjs.map +1 -1
- package/dist/DonutChart.js +32 -24
- package/dist/DonutChart.js.map +1 -1
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.js +2 -2
- package/dist/HeatMap.cjs +1 -1
- package/dist/HeatMap.js +2 -2
- package/dist/ParetoChart.cjs +1 -1
- package/dist/ParetoChart.js +1 -1
- package/dist/{XAxesLabels-D5X8jngD.cjs → XAxesLabels-C1XSXoWG.cjs} +2 -2
- package/dist/XAxesLabels-C1XSXoWG.cjs.map +1 -0
- package/dist/{XAxesLabels-DNO0KmjL.js → XAxesLabels-Dmbk50u4.js} +18 -16
- package/dist/XAxesLabels-Dmbk50u4.js.map +1 -0
- package/dist/YAxesLabels-1XTb-D0_.js +72 -0
- package/dist/YAxesLabels-1XTb-D0_.js.map +1 -0
- package/dist/YAxesLabels-pjdsVwIM.cjs +2 -0
- package/dist/YAxesLabels-pjdsVwIM.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/XAxesLabels-D5X8jngD.cjs.map +0 -1
- package/dist/XAxesLabels-DNO0KmjL.js.map +0 -1
- package/dist/YAxesLabels-DcS85Beo.cjs +0 -2
- package/dist/YAxesLabels-DcS85Beo.cjs.map +0 -1
- package/dist/YAxesLabels-Dnnng49-.js +0 -70
- package/dist/YAxesLabels-Dnnng49-.js.map +0 -1
package/dist/BulletChart.js
CHANGED
|
@@ -10,11 +10,11 @@ import { c as p } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
|
10
10
|
import { s as Oi } from "./string2HTML-DhG75NqA.js";
|
|
11
11
|
import { A as ki } from "./Axis-CRyfcLjc.js";
|
|
12
12
|
import { A as Li } from "./AxisTitle-jeI7am8o.js";
|
|
13
|
-
import { X as Si } from "./XAxesLabels-
|
|
13
|
+
import { X as Si } from "./XAxesLabels-Dmbk50u4.js";
|
|
14
14
|
import { R as qi, a as Fi } from "./ReferenceLine-2XCwHXQ4.js";
|
|
15
15
|
import { Y as Bi } from "./YTicksAndGridLines-Blepl7XF.js";
|
|
16
16
|
import { X as Pi } from "./XTicksAndGridLines-CObVFSm4.js";
|
|
17
|
-
import { Y as Hi } from "./YAxesLabels-
|
|
17
|
+
import { Y as Hi } from "./YAxesLabels-1XTb-D0_.js";
|
|
18
18
|
import { a as Ni } from "./linear-BwnDd9KF.js";
|
|
19
19
|
import { b as $i } from "./band-CyHaVft5.js";
|
|
20
20
|
import { u as Ii } from "./use-in-view-Cxa7y1TH.js";
|
package/dist/ButterflyChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-CTPQjnHt.cjs"),C=require("react"),oe=require("./getSliderMarks-BmADcPQt.cjs"),re=require("./parse-hMnG_lRV.cjs"),ae=require("./index-DQA8q5sC.cjs"),fe=require("./Modal-JW_IExO3.cjs"),le=require("./numberFormattingFunction-02t-wJta.cjs"),ge=require("./Tooltip-4dJo4_AF.cjs"),ye=require("./string2HTML-CPGr_I5E.cjs"),ce=require("./XTicksAndGridLines-B6CELS7q.cjs"),ue=require("./Axis-DxRV2yMi.cjs"),je=require("./YAxesLabels-DcS85Beo.cjs"),xe=require("./ReferenceLine-BH0qdf4R.cjs"),ve=require("./band-VYfcZeJ2.cjs"),me=require("./linear-BwPAspcq.cjs"),be=require("./use-in-view-QcfiW0w3.cjs"),Lt=require("./proxy-BxvUI_9l.cjs"),se=require("./index-DG2bgAva.cjs"),we=require("./GraphFooter.cjs"),Re=require("./GraphHeader.cjs"),Ee=require("./ColorLegend.cjs"),de=require("./Colors.cjs"),Ae=require("./EmptyState-sAEZ_5rU.cjs"),pe=require("./index-DRXx7m-C.cjs"),ne=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Be=require("./ensureCompleteData-I6nYmT8E.cjs"),Le=require("./uniqBy-O05lp2S5.cjs"),he=require("./GraphContainer-d8A46BK2.cjs"),Ce=require("./sort-O96oMZLb.cjs"),Me=require("./init-DU0ybBc_.cjs");function ke(s){const t=i.compilerRuntimeExports.c(139),{data:c,width:A,height:j,barColors:a,centerGap:v,refValues:x,maxValue:X,minValue:nt,showValues:Y,axisTitles:U,rightMargin:Dt,leftMargin:It,topMargin:I,bottomMargin:Ft,tooltip:Ct,onSeriesMouseOver:W,barPadding:Jt,truncateBy:ot,onSeriesMouseClick:F,showTicks:rt,suffix:z,prefix:J,resetSelectionOnDoubleClick:Gt,detailsOnClick:w,styles:o,classNames:n,noOfTicks:M,animate:r,precision:K,customLayers:k,minValueLeftBar:q,minValueRightBar:V,naLabel:Mt}=s,Kt=C.useRef(null);let kt;t[0]!==r.amount||t[1]!==r.once?(kt={once:r.once,amount:r.amount},t[0]=r.amount,t[1]=r.once,t[2]=kt):kt=t[2];const $=be.useInView(Kt,kt),[qt,Q]=C.useState(void 0),[R,at]=C.useState(void 0),[Pt,u]=C.useState(void 0),[m,Z]=C.useState(void 0);let Vt;t[3]!==Ft||t[4]!==It||t[5]!==Dt||t[6]!==I?(Vt={top:I,bottom:Ft,left:It,right:Dt},t[3]=Ft,t[4]=It,t[5]=Dt,t[6]=I,t[7]=Vt):Vt=t[7];const l=Vt,B=A-l.left-l.right,L=j-l.top-l.bottom;let _,N,tt,G,lt,ct,ut,xt,et,T,mt,dt,pt,ht;if(t[8]!==r||t[9]!==a[0]||t[10]!==a[1]||t[11]!==Jt||t[12]!==v||t[13]!==n?.graphObjectValues||t[14]!==n?.xAxis?.gridLines||t[15]!==n?.xAxis?.labels||t[16]!==n?.yAxis?.axis||t[17]!==n?.yAxis?.labels||t[18]!==k||t[19]!==c||t[20]!==w||t[21]!==L||t[22]!==B||t[23]!==j||t[24]!==$||t[25]!==l.bottom||t[26]!==l.left||t[27]!==l.top||t[28]!==X||t[29]!==nt||t[30]!==q||t[31]!==V||t[32]!==R||t[33]!==Mt||t[34]!==M||t[35]!==F||t[36]!==W||t[37]!==K||t[38]!==J||t[39]!==x||t[40]!==Gt||t[41]!==rt||t[42]!==Y||t[43]!==o?.graphObjectValues||t[44]!==o?.xAxis?.gridLines||t[45]!==o?.xAxis?.labels||t[46]!==o?.yAxis?.axis||t[47]!==o?.yAxis?.labels||t[48]!==z||t[49]!==I||t[50]!==ot||t[51]!==A){const Xt=c.map(Fe),g=ve.band().domain(Xt.map(Ie)).range([L,0]).paddingInner(Jt),h=me.linear().domain([nt,X]).range([0,(B-v)/2]).nice(),f=h.ticks(M),d=me.linear().domain([nt,X]).range([(B-v)/2,0]).nice(),Yt=d.ticks(M);tt=Lt.motion.svg,pt=`${A}px`,ht=`${j}px`,G=`0 0 ${A} ${j}`,lt="ltr",ct=Kt,et=`translate(${l.left},${l.top})`,t[66]!==k?(T=k.filter(De).map(Se),t[66]=k,t[67]=T):T=t[67];const Tt=n?.yAxis?.axis;let Ot;t[68]!==Tt?(Ot={axis:Tt},t[68]=Tt,t[69]=Ot):Ot=t[69];const Et=o?.yAxis?.axis;let st;t[70]!==Et?(st={axis:Et},t[70]=Et,t[71]=st):st=t[71],mt=i.jsxRuntimeExports.jsxs("g",{transform:"translate(0,0)",children:[rt?i.jsxRuntimeExports.jsx(ce.XTicksAndGridLines,{values:Yt.filter(Oe),x:Yt.filter(Te).map(e=>d(e)),y1:0-I,y2:L+l.bottom,styles:{gridLines:o?.xAxis?.gridLines,labels:o?.xAxis?.labels},classNames:{gridLines:n?.xAxis?.gridLines,labels:n?.xAxis?.labels},suffix:z,prefix:J,labelType:"secondary",showGridLines:!0,leftLabel:!0,precision:K}):null,i.jsxRuntimeExports.jsxs(se.AnimatePresence,{children:[Xt.map((e,y)=>i.jsxRuntimeExports.jsxs(Lt.motion.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:b=>{Q(e),Z(b.clientY),u(b.clientX),W?.(e)},onClick:()=>{(F||w)&&(ae.isEqual(R,e)&&Gt?(at(void 0),F?.(void 0)):(at(e),F?.(e)))},onMouseMove:b=>{Q(e),Z(b.clientY),u(b.clientX)},onMouseLeave:()=>{Q(void 0),u(void 0),Z(void 0),W?.(void 0)},children:[e.leftBar?i.jsxRuntimeExports.jsx(Lt.motion.rect,{y:g(`${y}`),style:{fill:a[0]},height:g.bandwidth(),variants:{initial:{x:d(0),width:0},whileInView:{x:e.leftBar<0?d(0):d(e.leftBar),width:e.leftBar<0?d(e.leftBar)-d(0):d(0)-d(e.leftBar),transition:{duration:r.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{x:d(0),width:0,transition:{duration:r.duration}}}):null,Y?i.jsxRuntimeExports.jsx(Lt.motion.text,{y:g(`${y}`)+g.bandwidth()/2,style:{textAnchor:e.rightBar&&e.rightBar>0?"end":"start",...o?.graphObjectValues||{}},dx:e.rightBar&&e.rightBar>0?-5:5,dy:"0.33em",className:i.mo("graph-value text-sm",n?.graphObjectValues),exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{x:d(0),opacity:0,fill:a[0]},whileInView:{x:e.leftBar?d(e.leftBar):d(q<0?0:q),opacity:1,fill:a[0],transition:{duration:r.duration}}},initial:"initial",animate:$?"whileInView":"initial",children:le.numberFormattingFunction(e.rightBar,Mt,K,J,z)}):null]},e.label)),i.jsxRuntimeExports.jsx(ue.Axis,{y1:-2.5,y2:L+l.bottom,x1:d(q<0?0:q),x2:d(q<0?0:q),classNames:Ot,styles:st}),x?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:x.map((e,y)=>i.jsxRuntimeExports.jsx(xe.RefLineX,{text:e.text,color:e.color,x:d(e.value),y1:0-l.top,y2:L+l.bottom,textSide:"left",classNames:e.classNames,styles:e.styles,animate:r,isInView:$},y))}):null]})]});const Ut=n?.yAxis?.axis;let At;t[72]!==Ut?(At={axis:Ut},t[72]=Ut,t[73]=At):At=t[73];const St=o?.yAxis?.axis;let Bt;t[74]!==St?(Bt={axis:St},t[74]=St,t[75]=Bt):Bt=t[75],dt=i.jsxRuntimeExports.jsxs("g",{transform:`translate(${(B+v)/2},0)`,children:[rt?i.jsxRuntimeExports.jsx(ce.XTicksAndGridLines,{values:f.filter(Ne),x:f.filter($e).map(e=>h(e)),y1:0-I,y2:L+l.bottom,styles:{gridLines:o?.xAxis?.gridLines,labels:o?.xAxis?.labels},classNames:{gridLines:n?.xAxis?.gridLines,labels:n?.xAxis?.labels},suffix:z,prefix:J,labelType:"secondary",showGridLines:!0,precision:K}):null,i.jsxRuntimeExports.jsxs(se.AnimatePresence,{children:[Xt.map((e,y)=>i.jsxRuntimeExports.jsxs(Lt.motion.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:b=>{Q(e),Z(b.clientY),u(b.clientX),W?.(e)},onClick:()=>{(F||w)&&(ae.isEqual(R,e)&&Gt?(at(void 0),F?.(void 0)):(at(e),F?.(e)))},onMouseMove:b=>{Q(e),Z(b.clientY),u(b.clientX)},onMouseLeave:()=>{Q(void 0),u(void 0),Z(void 0),W?.(void 0)},children:[e.rightBar?i.jsxRuntimeExports.jsx(Lt.motion.rect,{y:g(`${y}`),style:{fill:a[1]},height:g.bandwidth(),exit:{x:h(0),width:0,transition:{duration:r.duration}},variants:{initial:{x:h(0),width:0},whileInView:{x:e.rightBar>=0?h(0):h(e.rightBar),width:e.rightBar>=0?h(e.rightBar)-h(0):h(0)-h(e.rightBar),transition:{duration:r.duration}}},initial:"initial",animate:$?"whileInView":"initial"}):null,Y?i.jsxRuntimeExports.jsx(Lt.motion.text,{y:g(`${y}`)+g.bandwidth()/2,style:{textAnchor:e.rightBar&&e.rightBar<0?"end":"start",...o?.graphObjectValues||{}},className:i.mo("graph-value text-sm",n?.graphObjectValues),dx:e.rightBar&&e.rightBar<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{x:h(0),opacity:0,fill:a[1]},whileInView:{x:e.rightBar?h(e.rightBar):h(V<0?0:V),opacity:1,fill:a[1],transition:{duration:r.duration}}},initial:"initial",animate:$?"whileInView":"initial",children:le.numberFormattingFunction(e.rightBar,Mt,K,J,z)}):null]},y)),i.jsxRuntimeExports.jsx(ue.Axis,{y1:-2.5,y2:L+l.bottom,x1:h(V<0?0:V),x2:h(V<0?0:V),classNames:At,styles:Bt}),x?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:x.map((e,y)=>i.jsxRuntimeExports.jsx(xe.RefLineX,{text:e.text,color:e.color,x:h(e.value),y1:0-l.top,y2:L+l.bottom,textSide:"right",classNames:e.classNames,styles:e.styles,animate:r,isInView:$},y))}):null]})]}),N=se.AnimatePresence,_=Lt.motion.g,ut=`translate(${B/2},0)`,xt=Xt.map((e,y)=>i.jsxRuntimeExports.jsx(je.YAxesLabels,{value:`${e.label}`.length<ot?`${e.label}`:`${`${e.label}`.substring(0,ot)}...`,y:g(`${e.id}`),x:0-v/2,width:v,height:g.bandwidth(),alignment:"center",style:o?.yAxis?.labels,className:n?.yAxis?.labels,animate:r,isInView:$},y)),t[8]=r,t[9]=a[0],t[10]=a[1],t[11]=Jt,t[12]=v,t[13]=n?.graphObjectValues,t[14]=n?.xAxis?.gridLines,t[15]=n?.xAxis?.labels,t[16]=n?.yAxis?.axis,t[17]=n?.yAxis?.labels,t[18]=k,t[19]=c,t[20]=w,t[21]=L,t[22]=B,t[23]=j,t[24]=$,t[25]=l.bottom,t[26]=l.left,t[27]=l.top,t[28]=X,t[29]=nt,t[30]=q,t[31]=V,t[32]=R,t[33]=Mt,t[34]=M,t[35]=F,t[36]=W,t[37]=K,t[38]=J,t[39]=x,t[40]=Gt,t[41]=rt,t[42]=Y,t[43]=o?.graphObjectValues,t[44]=o?.xAxis?.gridLines,t[45]=o?.xAxis?.labels,t[46]=o?.yAxis?.axis,t[47]=o?.yAxis?.labels,t[48]=z,t[49]=I,t[50]=ot,t[51]=A,t[52]=_,t[53]=N,t[54]=tt,t[55]=G,t[56]=lt,t[57]=ct,t[58]=ut,t[59]=xt,t[60]=et,t[61]=T,t[62]=mt,t[63]=dt,t[64]=pt,t[65]=ht}else _=t[52],N=t[53],tt=t[54],G=t[55],lt=t[56],ct=t[57],ut=t[58],xt=t[59],et=t[60],T=t[61],mt=t[62],dt=t[63],pt=t[64],ht=t[65];let O;t[76]!==_||t[77]!==ut||t[78]!==xt?(O=i.jsxRuntimeExports.jsx(_,{transform:ut,children:xt}),t[76]=_,t[77]=ut,t[78]=xt,t[79]=O):O=t[79];let ft;t[80]!==N||t[81]!==O?(ft=i.jsxRuntimeExports.jsx(N,{children:O}),t[80]=N,t[81]=O,t[82]=ft):ft=t[82];const Qt=`translate(0,${L})`,Zt=o?.yAxis?.title;let gt;t[83]!==a[0]||t[84]!==Zt?(gt={fill:a[0],textAnchor:"end",...Zt},t[83]=a[0],t[84]=Zt,t[85]=gt):gt=t[85];const _t=n?.yAxis?.title;let S;t[86]!==_t?(S=i.mo("text-base",_t),t[86]=_t,t[87]=S):S=t[87];const yt=B/2-v/2;let P;t[88]!==U[0]||t[89]!==gt||t[90]!==S||t[91]!==yt?(P=i.jsxRuntimeExports.jsx("text",{style:gt,className:S,x:yt,y:0,dx:-5,dy:20,children:U[0]}),t[88]=U[0],t[89]=gt,t[90]=S,t[91]=yt,t[92]=P):P=t[92];const $t=o?.yAxis?.title;let H;t[93]!==a[1]||t[94]!==$t?(H={fill:a[1],textAnchor:"start",...$t},t[93]=a[1],t[94]=$t,t[95]=H):H=t[95];const te=n?.yAxis?.title;let jt;t[96]!==te?(jt=i.mo("text-base",te),t[96]=te,t[97]=jt):jt=t[97];const Ht=B/2+v/2;let vt;t[98]!==U[1]||t[99]!==H||t[100]!==jt||t[101]!==Ht?(vt=i.jsxRuntimeExports.jsx("text",{style:H,className:jt,x:Ht,y:0,dx:5,dy:20,children:U[1]}),t[98]=U[1],t[99]=H,t[100]=jt,t[101]=Ht,t[102]=vt):vt=t[102];let D;t[103]!==Qt||t[104]!==P||t[105]!==vt?(D=i.jsxRuntimeExports.jsxs("g",{transform:Qt,children:[P,vt]}),t[103]=Qt,t[104]=P,t[105]=vt,t[106]=D):D=t[106];let bt;t[107]!==k?(bt=k.filter(Ve).map(qe),t[107]=k,t[108]=bt):bt=t[108];let p;t[109]!==ft||t[110]!==D||t[111]!==bt||t[112]!==et||t[113]!==T||t[114]!==mt||t[115]!==dt?(p=i.jsxRuntimeExports.jsxs("g",{transform:et,children:[T,mt,dt,ft,D,bt]}),t[109]=ft,t[110]=D,t[111]=bt,t[112]=et,t[113]=T,t[114]=mt,t[115]=dt,t[116]=p):p=t[116];let wt;t[117]!==tt||t[118]!==G||t[119]!==lt||t[120]!==ct||t[121]!==p||t[122]!==pt||t[123]!==ht?(wt=i.jsxRuntimeExports.jsx(tt,{width:pt,height:ht,viewBox:G,direction:lt,ref:ct,children:p}),t[117]=tt,t[118]=G,t[119]=lt,t[120]=ct,t[121]=p,t[122]=pt,t[123]=ht,t[124]=wt):wt=t[124];let it;t[125]!==n?.tooltip||t[126]!==Pt||t[127]!==m||t[128]!==qt||t[129]!==o?.tooltip||t[130]!==Ct?(it=qt&&Ct&&Pt&&m?i.jsxRuntimeExports.jsx(ge.Tooltip,{data:qt,body:Ct,xPos:Pt,yPos:m,backgroundStyle:o?.tooltip,className:n?.tooltip}):null,t[125]=n?.tooltip,t[126]=Pt,t[127]=m,t[128]=qt,t[129]=o?.tooltip,t[130]=Ct,t[131]=it):it=t[131];let Rt;t[132]!==w||t[133]!==R?(Rt=w&&R!==void 0?i.jsxRuntimeExports.jsx(fe.le,{open:R!==void 0,onClose:()=>{at(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:ye.string2HTML(w,R)}:void 0,children:typeof w=="function"?w(R):null})}):null,t[132]=w,t[133]=R,t[134]=Rt):Rt=t[134];let Nt;return t[135]!==wt||t[136]!==it||t[137]!==Rt?(Nt=i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[wt,it,Rt]}),t[135]=wt,t[136]=it,t[137]=Rt,t[138]=Nt):Nt=t[138],Nt}function qe(s){return s.layer}function Ve(s){return s.position==="after"}function $e(s){return s!==0}function Ne(s){return s!==0}function Te(s){return s!==0}function Oe(s){return s!==0}function Se(s){return s.layer}function De(s){return s.position==="before"}function Ie(s){return`${s.id}`}function Fe(s,t){return{...s,id:`${t}`}}function zt(s,t,c,A){const j=s.map(x=>x[t]).filter(x=>!ne.checkIfNullOrUndefined(x)),a=ne.checkIfNullOrUndefined(c)?Math.min(...j)>=0?0:Math.min(...j):c,v=ne.checkIfNullOrUndefined(A)?Math.max(...j)<0?0:Math.max(...j):A;return{min:a,max:v}}function Ge(s){const t=i.compilerRuntimeExports.c(45),{data:c,graphTitle:A,sources:j,graphDescription:a,height:v,width:x,footNote:X,padding:nt,barColors:Y,backgroundColor:U,leftMargin:Dt,rightMargin:It,topMargin:I,bottomMargin:Ft,rightBarTitle:Ct,leftBarTitle:W,tooltip:Jt,relativeHeight:ot,onSeriesMouseOver:F,graphID:rt,barPadding:z,truncateBy:J,onSeriesMouseClick:Gt,centerGap:w,showValues:o,maxValue:n,minValue:M,refValues:r,suffix:K,prefix:k,showTicks:q,showColorScale:V,graphDownload:Mt,dataDownload:Kt,language:kt,colorLegendTitle:$,minHeight:qt,theme:Q,ariaLabel:R,resetSelectionOnDoubleClick:at,detailsOnClick:Pt,styles:u,classNames:m,noOfTicks:Z,animate:Vt,precision:l,customLayers:B,timeline:L,naLabel:_}=s;let N;t[0]!==Y?(N=Y===void 0?[de.Colors.light.categoricalColors.colors[0],de.Colors.light.categoricalColors.colors[1]]:Y,t[0]=Y,t[1]=N):N=t[1];const tt=N,G=U===void 0?!1:U,lt=Dt===void 0?20:Dt,ct=It===void 0?20:It,ut=I===void 0?25:I,xt=Ft===void 0?30:Ft,et=Ct===void 0?"Right bar graph":Ct,T=W===void 0?"Left bar graph":W,mt=z===void 0?.25:z,dt=J===void 0?999:J,pt=w===void 0?100:w,ht=o===void 0?!0:o;let O;t[2]!==r?(O=r===void 0?[]:r,t[2]=r,t[3]=O):O=t[3];const ft=O,Qt=K===void 0?"":K,Zt=k===void 0?"":k,gt=q===void 0?!0:q,_t=V===void 0?!1:V,S=Mt===void 0?!1:Mt,yt=Kt===void 0?!1:Kt,P=kt===void 0?"en":kt,$t=qt===void 0?0:qt,H=Q===void 0?"light":Q,te=at===void 0?!0:at,jt=Z===void 0?5:Z,Ht=Vt===void 0?!1:Vt,vt=l===void 0?2:l;let D;t[4]!==B?(D=B===void 0?[]:B,t[4]=B,t[5]=D):D=t[5];const bt=D,p=L===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:L,wt=_===void 0?"NA":_,[it,Rt]=C.useState(0),[Nt,Xt]=C.useState(0),[g,h]=C.useState(p.autoplay),f=Ce.sort(Le.uniqBy(c,"date",!0).map(E=>re.parse(`${E}`,p.dateFormat||"yyyy",new Date).getTime()),We),[d,Yt]=C.useState(p.autoplay?0:f.length-1),Tt=C.useRef(null),Ot=C.useRef(null);let Et,st;t[6]===Symbol.for("react.memo_cache_sentinel")?(Et=()=>{const E=new ResizeObserver(ee=>{Rt(ee[0].target.clientWidth||620),Xt(ee[0].target.clientHeight||480)});return Tt.current&&E.observe(Tt.current),()=>E.disconnect()},st=[],t[6]=Et,t[7]=st):(Et=t[6],st=t[7]),C.useEffect(Et,st),C.useEffect(()=>{const E=setInterval(()=>{Yt(ee=>ee<f.length-1?ee+1:0)},(p.speed||2)*1e3);return g||clearInterval(E),()=>clearInterval(E)},[f,g,p.speed]);const Ut=oe.getSliderMarks(f,d,p.showOnlyActiveDate,p.dateFormat||"yyyy"),At=he.GraphContainer,St=m?.graphContainer,Bt=u?.graphContainer;let e;t[8]!==m?.description||t[9]!==m?.title||t[10]!==c||t[11]!==yt||t[12]!==a||t[13]!==S||t[14]!==A||t[15]!==u?.description||t[16]!==u?.title||t[17]!==x?(e=A||a||S||yt?i.jsxRuntimeExports.jsx(Re.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:m?.title,description:m?.description},graphTitle:A,graphDescription:a,width:x,graphDownload:S?Ot:void 0,dataDownload:yt?c.map(Ue).filter(Ye).length>0?c.map(Xe).filter(He):c.filter(Pe):null}):null,t[8]=m?.description,t[9]=m?.title,t[10]=c,t[11]=yt,t[12]=a,t[13]=S,t[14]=A,t[15]=u?.description,t[16]=u?.title,t[17]=x,t[18]=e):e=t[18];const y=p.enabled&&f.length>0&&Ut?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{h(!g)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":g?"Click to pause animation":"Click to play animation",children:g?i.jsxRuntimeExports.jsx(pe.Pause,{}):i.jsxRuntimeExports.jsx(pe.Play,{})}),i.jsxRuntimeExports.jsx(oe.Nr,{min:f[0],max:f[f.length-1],marks:Ut,step:null,defaultValue:f[f.length-1],value:f[d],onChangeComplete:E=>{Yt(f.indexOf(E))},onChange:E=>{Yt(f.indexOf(E))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,b=c.length===0?i.jsxRuntimeExports.jsx(Ae.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[_t?i.jsxRuntimeExports.jsx(Ee.ColorLegend,{colorLegendTitle:$,colorDomain:[T,et],colors:tt,showNAColor:!1,className:m?.colorLegend}):null,i.jsxRuntimeExports.jsx(he.GraphArea,{ref:Tt,children:it&&Nt?i.jsxRuntimeExports.jsx(ke,{data:Be.ensureCompleteDataForButterFlyChart(c,p.dateFormat||"yyyy").filter(E=>p.enabled?E.date===re.format(new Date(f[d]),p.dateFormat||"yyyy"):E),barColors:tt,width:it,centerGap:pt,height:Nt,truncateBy:dt,leftMargin:lt,rightMargin:ct,topMargin:ut,bottomMargin:xt,axisTitles:[T,et],tooltip:Jt,onSeriesMouseOver:F,barPadding:mt,refValues:ft,maxValue:Math.max(zt(c,"leftBar",M,n).max,zt(c,"rightBar",M,n).max),minValue:Math.min(zt(c,"leftBar",M,n).min,zt(c,"rightBar",M,n).min),minValueLeftBar:zt(c,"leftBar",M,n).min,minValueRightBar:zt(c,"rightBar",M,n).min,showValues:ht,onSeriesMouseClick:Gt,showTicks:gt,suffix:Qt,prefix:Zt,resetSelectionOnDoubleClick:te,detailsOnClick:Pt,styles:u,classNames:m,noOfTicks:jt,animate:Ht===!0?{duration:.5,once:!0,amount:.5}:Ht||{duration:0,once:!0,amount:0},precision:vt,customLayers:bt,naLabel:wt}):null})]});let Wt;t[19]!==m?.footnote||t[20]!==m?.source||t[21]!==X||t[22]!==j||t[23]!==u?.footnote||t[24]!==u?.source||t[25]!==x?(Wt=j||X?i.jsxRuntimeExports.jsx(we.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:m?.footnote,source:m?.source},sources:j,footNote:X,width:x}):null,t[19]=m?.footnote,t[20]=m?.source,t[21]=X,t[22]=j,t[23]=u?.footnote,t[24]=u?.source,t[25]=x,t[26]=Wt):Wt=t[26];let ie;return t[27]!==At||t[28]!==R||t[29]!==G||t[30]!==rt||t[31]!==v||t[32]!==P||t[33]!==$t||t[34]!==nt||t[35]!==ot||t[36]!==St||t[37]!==Bt||t[38]!==e||t[39]!==y||t[40]!==b||t[41]!==Wt||t[42]!==H||t[43]!==x?(ie=i.jsxRuntimeExports.jsxs(At,{className:St,style:Bt,id:rt,ref:Ot,"aria-label":R,backgroundColor:G,theme:H,language:P,minHeight:$t,width:x,height:v,relativeHeight:ot,padding:nt,children:[e,y,b,Wt]}),t[27]=At,t[28]=R,t[29]=G,t[30]=rt,t[31]=v,t[32]=P,t[33]=$t,t[34]=nt,t[35]=ot,t[36]=St,t[37]=Bt,t[38]=e,t[39]=y,t[40]=b,t[41]=Wt,t[42]=H,t[43]=x,t[44]=ie):ie=t[44],ie}function Pe(s){return s!==void 0}function He(s){return s!==void 0}function Xe(s){return s.data}function Ye(s){return s!==void 0}function Ue(s){return s.data}function We(s,t){return Me.ascending(s,t)}exports.ButterflyChart=Ge;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-CTPQjnHt.cjs"),C=require("react"),oe=require("./getSliderMarks-BmADcPQt.cjs"),re=require("./parse-hMnG_lRV.cjs"),ae=require("./index-DQA8q5sC.cjs"),fe=require("./Modal-JW_IExO3.cjs"),le=require("./numberFormattingFunction-02t-wJta.cjs"),ge=require("./Tooltip-4dJo4_AF.cjs"),ye=require("./string2HTML-CPGr_I5E.cjs"),ce=require("./XTicksAndGridLines-B6CELS7q.cjs"),ue=require("./Axis-DxRV2yMi.cjs"),je=require("./YAxesLabels-pjdsVwIM.cjs"),xe=require("./ReferenceLine-BH0qdf4R.cjs"),ve=require("./band-VYfcZeJ2.cjs"),me=require("./linear-BwPAspcq.cjs"),be=require("./use-in-view-QcfiW0w3.cjs"),Lt=require("./proxy-BxvUI_9l.cjs"),se=require("./index-DG2bgAva.cjs"),we=require("./GraphFooter.cjs"),Re=require("./GraphHeader.cjs"),Ee=require("./ColorLegend.cjs"),de=require("./Colors.cjs"),Ae=require("./EmptyState-sAEZ_5rU.cjs"),pe=require("./index-DRXx7m-C.cjs"),ne=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Be=require("./ensureCompleteData-I6nYmT8E.cjs"),Le=require("./uniqBy-O05lp2S5.cjs"),he=require("./GraphContainer-d8A46BK2.cjs"),Ce=require("./sort-O96oMZLb.cjs"),Me=require("./init-DU0ybBc_.cjs");function ke(s){const t=i.compilerRuntimeExports.c(139),{data:c,width:A,height:j,barColors:a,centerGap:v,refValues:x,maxValue:X,minValue:nt,showValues:Y,axisTitles:U,rightMargin:Dt,leftMargin:It,topMargin:I,bottomMargin:Ft,tooltip:Ct,onSeriesMouseOver:W,barPadding:Jt,truncateBy:ot,onSeriesMouseClick:F,showTicks:rt,suffix:z,prefix:J,resetSelectionOnDoubleClick:Gt,detailsOnClick:w,styles:o,classNames:n,noOfTicks:M,animate:r,precision:K,customLayers:k,minValueLeftBar:q,minValueRightBar:V,naLabel:Mt}=s,Kt=C.useRef(null);let kt;t[0]!==r.amount||t[1]!==r.once?(kt={once:r.once,amount:r.amount},t[0]=r.amount,t[1]=r.once,t[2]=kt):kt=t[2];const $=be.useInView(Kt,kt),[qt,Q]=C.useState(void 0),[R,at]=C.useState(void 0),[Pt,u]=C.useState(void 0),[m,Z]=C.useState(void 0);let Vt;t[3]!==Ft||t[4]!==It||t[5]!==Dt||t[6]!==I?(Vt={top:I,bottom:Ft,left:It,right:Dt},t[3]=Ft,t[4]=It,t[5]=Dt,t[6]=I,t[7]=Vt):Vt=t[7];const l=Vt,B=A-l.left-l.right,L=j-l.top-l.bottom;let _,N,tt,G,lt,ct,ut,xt,et,T,mt,dt,pt,ht;if(t[8]!==r||t[9]!==a[0]||t[10]!==a[1]||t[11]!==Jt||t[12]!==v||t[13]!==n?.graphObjectValues||t[14]!==n?.xAxis?.gridLines||t[15]!==n?.xAxis?.labels||t[16]!==n?.yAxis?.axis||t[17]!==n?.yAxis?.labels||t[18]!==k||t[19]!==c||t[20]!==w||t[21]!==L||t[22]!==B||t[23]!==j||t[24]!==$||t[25]!==l.bottom||t[26]!==l.left||t[27]!==l.top||t[28]!==X||t[29]!==nt||t[30]!==q||t[31]!==V||t[32]!==R||t[33]!==Mt||t[34]!==M||t[35]!==F||t[36]!==W||t[37]!==K||t[38]!==J||t[39]!==x||t[40]!==Gt||t[41]!==rt||t[42]!==Y||t[43]!==o?.graphObjectValues||t[44]!==o?.xAxis?.gridLines||t[45]!==o?.xAxis?.labels||t[46]!==o?.yAxis?.axis||t[47]!==o?.yAxis?.labels||t[48]!==z||t[49]!==I||t[50]!==ot||t[51]!==A){const Xt=c.map(Fe),g=ve.band().domain(Xt.map(Ie)).range([L,0]).paddingInner(Jt),h=me.linear().domain([nt,X]).range([0,(B-v)/2]).nice(),f=h.ticks(M),d=me.linear().domain([nt,X]).range([(B-v)/2,0]).nice(),Yt=d.ticks(M);tt=Lt.motion.svg,pt=`${A}px`,ht=`${j}px`,G=`0 0 ${A} ${j}`,lt="ltr",ct=Kt,et=`translate(${l.left},${l.top})`,t[66]!==k?(T=k.filter(De).map(Se),t[66]=k,t[67]=T):T=t[67];const Tt=n?.yAxis?.axis;let Ot;t[68]!==Tt?(Ot={axis:Tt},t[68]=Tt,t[69]=Ot):Ot=t[69];const Et=o?.yAxis?.axis;let st;t[70]!==Et?(st={axis:Et},t[70]=Et,t[71]=st):st=t[71],mt=i.jsxRuntimeExports.jsxs("g",{transform:"translate(0,0)",children:[rt?i.jsxRuntimeExports.jsx(ce.XTicksAndGridLines,{values:Yt.filter(Oe),x:Yt.filter(Te).map(e=>d(e)),y1:0-I,y2:L+l.bottom,styles:{gridLines:o?.xAxis?.gridLines,labels:o?.xAxis?.labels},classNames:{gridLines:n?.xAxis?.gridLines,labels:n?.xAxis?.labels},suffix:z,prefix:J,labelType:"secondary",showGridLines:!0,leftLabel:!0,precision:K}):null,i.jsxRuntimeExports.jsxs(se.AnimatePresence,{children:[Xt.map((e,y)=>i.jsxRuntimeExports.jsxs(Lt.motion.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:b=>{Q(e),Z(b.clientY),u(b.clientX),W?.(e)},onClick:()=>{(F||w)&&(ae.isEqual(R,e)&&Gt?(at(void 0),F?.(void 0)):(at(e),F?.(e)))},onMouseMove:b=>{Q(e),Z(b.clientY),u(b.clientX)},onMouseLeave:()=>{Q(void 0),u(void 0),Z(void 0),W?.(void 0)},children:[e.leftBar?i.jsxRuntimeExports.jsx(Lt.motion.rect,{y:g(`${y}`),style:{fill:a[0]},height:g.bandwidth(),variants:{initial:{x:d(0),width:0},whileInView:{x:e.leftBar<0?d(0):d(e.leftBar),width:e.leftBar<0?d(e.leftBar)-d(0):d(0)-d(e.leftBar),transition:{duration:r.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{x:d(0),width:0,transition:{duration:r.duration}}}):null,Y?i.jsxRuntimeExports.jsx(Lt.motion.text,{y:g(`${y}`)+g.bandwidth()/2,style:{textAnchor:e.rightBar&&e.rightBar>0?"end":"start",...o?.graphObjectValues||{}},dx:e.rightBar&&e.rightBar>0?-5:5,dy:"0.33em",className:i.mo("graph-value text-sm",n?.graphObjectValues),exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{x:d(0),opacity:0,fill:a[0]},whileInView:{x:e.leftBar?d(e.leftBar):d(q<0?0:q),opacity:1,fill:a[0],transition:{duration:r.duration}}},initial:"initial",animate:$?"whileInView":"initial",children:le.numberFormattingFunction(e.rightBar,Mt,K,J,z)}):null]},e.label)),i.jsxRuntimeExports.jsx(ue.Axis,{y1:-2.5,y2:L+l.bottom,x1:d(q<0?0:q),x2:d(q<0?0:q),classNames:Ot,styles:st}),x?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:x.map((e,y)=>i.jsxRuntimeExports.jsx(xe.RefLineX,{text:e.text,color:e.color,x:d(e.value),y1:0-l.top,y2:L+l.bottom,textSide:"left",classNames:e.classNames,styles:e.styles,animate:r,isInView:$},y))}):null]})]});const Ut=n?.yAxis?.axis;let At;t[72]!==Ut?(At={axis:Ut},t[72]=Ut,t[73]=At):At=t[73];const St=o?.yAxis?.axis;let Bt;t[74]!==St?(Bt={axis:St},t[74]=St,t[75]=Bt):Bt=t[75],dt=i.jsxRuntimeExports.jsxs("g",{transform:`translate(${(B+v)/2},0)`,children:[rt?i.jsxRuntimeExports.jsx(ce.XTicksAndGridLines,{values:f.filter(Ne),x:f.filter($e).map(e=>h(e)),y1:0-I,y2:L+l.bottom,styles:{gridLines:o?.xAxis?.gridLines,labels:o?.xAxis?.labels},classNames:{gridLines:n?.xAxis?.gridLines,labels:n?.xAxis?.labels},suffix:z,prefix:J,labelType:"secondary",showGridLines:!0,precision:K}):null,i.jsxRuntimeExports.jsxs(se.AnimatePresence,{children:[Xt.map((e,y)=>i.jsxRuntimeExports.jsxs(Lt.motion.g,{className:"undp-viz-g-with-hover",opacity:.85,onMouseEnter:b=>{Q(e),Z(b.clientY),u(b.clientX),W?.(e)},onClick:()=>{(F||w)&&(ae.isEqual(R,e)&&Gt?(at(void 0),F?.(void 0)):(at(e),F?.(e)))},onMouseMove:b=>{Q(e),Z(b.clientY),u(b.clientX)},onMouseLeave:()=>{Q(void 0),u(void 0),Z(void 0),W?.(void 0)},children:[e.rightBar?i.jsxRuntimeExports.jsx(Lt.motion.rect,{y:g(`${y}`),style:{fill:a[1]},height:g.bandwidth(),exit:{x:h(0),width:0,transition:{duration:r.duration}},variants:{initial:{x:h(0),width:0},whileInView:{x:e.rightBar>=0?h(0):h(e.rightBar),width:e.rightBar>=0?h(e.rightBar)-h(0):h(0)-h(e.rightBar),transition:{duration:r.duration}}},initial:"initial",animate:$?"whileInView":"initial"}):null,Y?i.jsxRuntimeExports.jsx(Lt.motion.text,{y:g(`${y}`)+g.bandwidth()/2,style:{textAnchor:e.rightBar&&e.rightBar<0?"end":"start",...o?.graphObjectValues||{}},className:i.mo("graph-value text-sm",n?.graphObjectValues),dx:e.rightBar&&e.rightBar<0?-5:5,dy:"0.33em",exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{x:h(0),opacity:0,fill:a[1]},whileInView:{x:e.rightBar?h(e.rightBar):h(V<0?0:V),opacity:1,fill:a[1],transition:{duration:r.duration}}},initial:"initial",animate:$?"whileInView":"initial",children:le.numberFormattingFunction(e.rightBar,Mt,K,J,z)}):null]},y)),i.jsxRuntimeExports.jsx(ue.Axis,{y1:-2.5,y2:L+l.bottom,x1:h(V<0?0:V),x2:h(V<0?0:V),classNames:At,styles:Bt}),x?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:x.map((e,y)=>i.jsxRuntimeExports.jsx(xe.RefLineX,{text:e.text,color:e.color,x:h(e.value),y1:0-l.top,y2:L+l.bottom,textSide:"right",classNames:e.classNames,styles:e.styles,animate:r,isInView:$},y))}):null]})]}),N=se.AnimatePresence,_=Lt.motion.g,ut=`translate(${B/2},0)`,xt=Xt.map((e,y)=>i.jsxRuntimeExports.jsx(je.YAxesLabels,{value:`${e.label}`.length<ot?`${e.label}`:`${`${e.label}`.substring(0,ot)}...`,y:g(`${e.id}`),x:0-v/2,width:v,height:g.bandwidth(),alignment:"center",style:o?.yAxis?.labels,className:n?.yAxis?.labels,animate:r,isInView:$},y)),t[8]=r,t[9]=a[0],t[10]=a[1],t[11]=Jt,t[12]=v,t[13]=n?.graphObjectValues,t[14]=n?.xAxis?.gridLines,t[15]=n?.xAxis?.labels,t[16]=n?.yAxis?.axis,t[17]=n?.yAxis?.labels,t[18]=k,t[19]=c,t[20]=w,t[21]=L,t[22]=B,t[23]=j,t[24]=$,t[25]=l.bottom,t[26]=l.left,t[27]=l.top,t[28]=X,t[29]=nt,t[30]=q,t[31]=V,t[32]=R,t[33]=Mt,t[34]=M,t[35]=F,t[36]=W,t[37]=K,t[38]=J,t[39]=x,t[40]=Gt,t[41]=rt,t[42]=Y,t[43]=o?.graphObjectValues,t[44]=o?.xAxis?.gridLines,t[45]=o?.xAxis?.labels,t[46]=o?.yAxis?.axis,t[47]=o?.yAxis?.labels,t[48]=z,t[49]=I,t[50]=ot,t[51]=A,t[52]=_,t[53]=N,t[54]=tt,t[55]=G,t[56]=lt,t[57]=ct,t[58]=ut,t[59]=xt,t[60]=et,t[61]=T,t[62]=mt,t[63]=dt,t[64]=pt,t[65]=ht}else _=t[52],N=t[53],tt=t[54],G=t[55],lt=t[56],ct=t[57],ut=t[58],xt=t[59],et=t[60],T=t[61],mt=t[62],dt=t[63],pt=t[64],ht=t[65];let O;t[76]!==_||t[77]!==ut||t[78]!==xt?(O=i.jsxRuntimeExports.jsx(_,{transform:ut,children:xt}),t[76]=_,t[77]=ut,t[78]=xt,t[79]=O):O=t[79];let ft;t[80]!==N||t[81]!==O?(ft=i.jsxRuntimeExports.jsx(N,{children:O}),t[80]=N,t[81]=O,t[82]=ft):ft=t[82];const Qt=`translate(0,${L})`,Zt=o?.yAxis?.title;let gt;t[83]!==a[0]||t[84]!==Zt?(gt={fill:a[0],textAnchor:"end",...Zt},t[83]=a[0],t[84]=Zt,t[85]=gt):gt=t[85];const _t=n?.yAxis?.title;let S;t[86]!==_t?(S=i.mo("text-base",_t),t[86]=_t,t[87]=S):S=t[87];const yt=B/2-v/2;let P;t[88]!==U[0]||t[89]!==gt||t[90]!==S||t[91]!==yt?(P=i.jsxRuntimeExports.jsx("text",{style:gt,className:S,x:yt,y:0,dx:-5,dy:20,children:U[0]}),t[88]=U[0],t[89]=gt,t[90]=S,t[91]=yt,t[92]=P):P=t[92];const $t=o?.yAxis?.title;let H;t[93]!==a[1]||t[94]!==$t?(H={fill:a[1],textAnchor:"start",...$t},t[93]=a[1],t[94]=$t,t[95]=H):H=t[95];const te=n?.yAxis?.title;let jt;t[96]!==te?(jt=i.mo("text-base",te),t[96]=te,t[97]=jt):jt=t[97];const Ht=B/2+v/2;let vt;t[98]!==U[1]||t[99]!==H||t[100]!==jt||t[101]!==Ht?(vt=i.jsxRuntimeExports.jsx("text",{style:H,className:jt,x:Ht,y:0,dx:5,dy:20,children:U[1]}),t[98]=U[1],t[99]=H,t[100]=jt,t[101]=Ht,t[102]=vt):vt=t[102];let D;t[103]!==Qt||t[104]!==P||t[105]!==vt?(D=i.jsxRuntimeExports.jsxs("g",{transform:Qt,children:[P,vt]}),t[103]=Qt,t[104]=P,t[105]=vt,t[106]=D):D=t[106];let bt;t[107]!==k?(bt=k.filter(Ve).map(qe),t[107]=k,t[108]=bt):bt=t[108];let p;t[109]!==ft||t[110]!==D||t[111]!==bt||t[112]!==et||t[113]!==T||t[114]!==mt||t[115]!==dt?(p=i.jsxRuntimeExports.jsxs("g",{transform:et,children:[T,mt,dt,ft,D,bt]}),t[109]=ft,t[110]=D,t[111]=bt,t[112]=et,t[113]=T,t[114]=mt,t[115]=dt,t[116]=p):p=t[116];let wt;t[117]!==tt||t[118]!==G||t[119]!==lt||t[120]!==ct||t[121]!==p||t[122]!==pt||t[123]!==ht?(wt=i.jsxRuntimeExports.jsx(tt,{width:pt,height:ht,viewBox:G,direction:lt,ref:ct,children:p}),t[117]=tt,t[118]=G,t[119]=lt,t[120]=ct,t[121]=p,t[122]=pt,t[123]=ht,t[124]=wt):wt=t[124];let it;t[125]!==n?.tooltip||t[126]!==Pt||t[127]!==m||t[128]!==qt||t[129]!==o?.tooltip||t[130]!==Ct?(it=qt&&Ct&&Pt&&m?i.jsxRuntimeExports.jsx(ge.Tooltip,{data:qt,body:Ct,xPos:Pt,yPos:m,backgroundStyle:o?.tooltip,className:n?.tooltip}):null,t[125]=n?.tooltip,t[126]=Pt,t[127]=m,t[128]=qt,t[129]=o?.tooltip,t[130]=Ct,t[131]=it):it=t[131];let Rt;t[132]!==w||t[133]!==R?(Rt=w&&R!==void 0?i.jsxRuntimeExports.jsx(fe.le,{open:R!==void 0,onClose:()=>{at(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof w=="string"?{__html:ye.string2HTML(w,R)}:void 0,children:typeof w=="function"?w(R):null})}):null,t[132]=w,t[133]=R,t[134]=Rt):Rt=t[134];let Nt;return t[135]!==wt||t[136]!==it||t[137]!==Rt?(Nt=i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[wt,it,Rt]}),t[135]=wt,t[136]=it,t[137]=Rt,t[138]=Nt):Nt=t[138],Nt}function qe(s){return s.layer}function Ve(s){return s.position==="after"}function $e(s){return s!==0}function Ne(s){return s!==0}function Te(s){return s!==0}function Oe(s){return s!==0}function Se(s){return s.layer}function De(s){return s.position==="before"}function Ie(s){return`${s.id}`}function Fe(s,t){return{...s,id:`${t}`}}function zt(s,t,c,A){const j=s.map(x=>x[t]).filter(x=>!ne.checkIfNullOrUndefined(x)),a=ne.checkIfNullOrUndefined(c)?Math.min(...j)>=0?0:Math.min(...j):c,v=ne.checkIfNullOrUndefined(A)?Math.max(...j)<0?0:Math.max(...j):A;return{min:a,max:v}}function Ge(s){const t=i.compilerRuntimeExports.c(45),{data:c,graphTitle:A,sources:j,graphDescription:a,height:v,width:x,footNote:X,padding:nt,barColors:Y,backgroundColor:U,leftMargin:Dt,rightMargin:It,topMargin:I,bottomMargin:Ft,rightBarTitle:Ct,leftBarTitle:W,tooltip:Jt,relativeHeight:ot,onSeriesMouseOver:F,graphID:rt,barPadding:z,truncateBy:J,onSeriesMouseClick:Gt,centerGap:w,showValues:o,maxValue:n,minValue:M,refValues:r,suffix:K,prefix:k,showTicks:q,showColorScale:V,graphDownload:Mt,dataDownload:Kt,language:kt,colorLegendTitle:$,minHeight:qt,theme:Q,ariaLabel:R,resetSelectionOnDoubleClick:at,detailsOnClick:Pt,styles:u,classNames:m,noOfTicks:Z,animate:Vt,precision:l,customLayers:B,timeline:L,naLabel:_}=s;let N;t[0]!==Y?(N=Y===void 0?[de.Colors.light.categoricalColors.colors[0],de.Colors.light.categoricalColors.colors[1]]:Y,t[0]=Y,t[1]=N):N=t[1];const tt=N,G=U===void 0?!1:U,lt=Dt===void 0?20:Dt,ct=It===void 0?20:It,ut=I===void 0?25:I,xt=Ft===void 0?30:Ft,et=Ct===void 0?"Right bar graph":Ct,T=W===void 0?"Left bar graph":W,mt=z===void 0?.25:z,dt=J===void 0?999:J,pt=w===void 0?100:w,ht=o===void 0?!0:o;let O;t[2]!==r?(O=r===void 0?[]:r,t[2]=r,t[3]=O):O=t[3];const ft=O,Qt=K===void 0?"":K,Zt=k===void 0?"":k,gt=q===void 0?!0:q,_t=V===void 0?!1:V,S=Mt===void 0?!1:Mt,yt=Kt===void 0?!1:Kt,P=kt===void 0?"en":kt,$t=qt===void 0?0:qt,H=Q===void 0?"light":Q,te=at===void 0?!0:at,jt=Z===void 0?5:Z,Ht=Vt===void 0?!1:Vt,vt=l===void 0?2:l;let D;t[4]!==B?(D=B===void 0?[]:B,t[4]=B,t[5]=D):D=t[5];const bt=D,p=L===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:L,wt=_===void 0?"NA":_,[it,Rt]=C.useState(0),[Nt,Xt]=C.useState(0),[g,h]=C.useState(p.autoplay),f=Ce.sort(Le.uniqBy(c,"date",!0).map(E=>re.parse(`${E}`,p.dateFormat||"yyyy",new Date).getTime()),We),[d,Yt]=C.useState(p.autoplay?0:f.length-1),Tt=C.useRef(null),Ot=C.useRef(null);let Et,st;t[6]===Symbol.for("react.memo_cache_sentinel")?(Et=()=>{const E=new ResizeObserver(ee=>{Rt(ee[0].target.clientWidth||620),Xt(ee[0].target.clientHeight||480)});return Tt.current&&E.observe(Tt.current),()=>E.disconnect()},st=[],t[6]=Et,t[7]=st):(Et=t[6],st=t[7]),C.useEffect(Et,st),C.useEffect(()=>{const E=setInterval(()=>{Yt(ee=>ee<f.length-1?ee+1:0)},(p.speed||2)*1e3);return g||clearInterval(E),()=>clearInterval(E)},[f,g,p.speed]);const Ut=oe.getSliderMarks(f,d,p.showOnlyActiveDate,p.dateFormat||"yyyy"),At=he.GraphContainer,St=m?.graphContainer,Bt=u?.graphContainer;let e;t[8]!==m?.description||t[9]!==m?.title||t[10]!==c||t[11]!==yt||t[12]!==a||t[13]!==S||t[14]!==A||t[15]!==u?.description||t[16]!==u?.title||t[17]!==x?(e=A||a||S||yt?i.jsxRuntimeExports.jsx(Re.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:m?.title,description:m?.description},graphTitle:A,graphDescription:a,width:x,graphDownload:S?Ot:void 0,dataDownload:yt?c.map(Ue).filter(Ye).length>0?c.map(Xe).filter(He):c.filter(Pe):null}):null,t[8]=m?.description,t[9]=m?.title,t[10]=c,t[11]=yt,t[12]=a,t[13]=S,t[14]=A,t[15]=u?.description,t[16]=u?.title,t[17]=x,t[18]=e):e=t[18];const y=p.enabled&&f.length>0&&Ut?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{h(!g)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":g?"Click to pause animation":"Click to play animation",children:g?i.jsxRuntimeExports.jsx(pe.Pause,{}):i.jsxRuntimeExports.jsx(pe.Play,{})}),i.jsxRuntimeExports.jsx(oe.Nr,{min:f[0],max:f[f.length-1],marks:Ut,step:null,defaultValue:f[f.length-1],value:f[d],onChangeComplete:E=>{Yt(f.indexOf(E))},onChange:E=>{Yt(f.indexOf(E))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,b=c.length===0?i.jsxRuntimeExports.jsx(Ae.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[_t?i.jsxRuntimeExports.jsx(Ee.ColorLegend,{colorLegendTitle:$,colorDomain:[T,et],colors:tt,showNAColor:!1,className:m?.colorLegend}):null,i.jsxRuntimeExports.jsx(he.GraphArea,{ref:Tt,children:it&&Nt?i.jsxRuntimeExports.jsx(ke,{data:Be.ensureCompleteDataForButterFlyChart(c,p.dateFormat||"yyyy").filter(E=>p.enabled?E.date===re.format(new Date(f[d]),p.dateFormat||"yyyy"):E),barColors:tt,width:it,centerGap:pt,height:Nt,truncateBy:dt,leftMargin:lt,rightMargin:ct,topMargin:ut,bottomMargin:xt,axisTitles:[T,et],tooltip:Jt,onSeriesMouseOver:F,barPadding:mt,refValues:ft,maxValue:Math.max(zt(c,"leftBar",M,n).max,zt(c,"rightBar",M,n).max),minValue:Math.min(zt(c,"leftBar",M,n).min,zt(c,"rightBar",M,n).min),minValueLeftBar:zt(c,"leftBar",M,n).min,minValueRightBar:zt(c,"rightBar",M,n).min,showValues:ht,onSeriesMouseClick:Gt,showTicks:gt,suffix:Qt,prefix:Zt,resetSelectionOnDoubleClick:te,detailsOnClick:Pt,styles:u,classNames:m,noOfTicks:jt,animate:Ht===!0?{duration:.5,once:!0,amount:.5}:Ht||{duration:0,once:!0,amount:0},precision:vt,customLayers:bt,naLabel:wt}):null})]});let Wt;t[19]!==m?.footnote||t[20]!==m?.source||t[21]!==X||t[22]!==j||t[23]!==u?.footnote||t[24]!==u?.source||t[25]!==x?(Wt=j||X?i.jsxRuntimeExports.jsx(we.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:m?.footnote,source:m?.source},sources:j,footNote:X,width:x}):null,t[19]=m?.footnote,t[20]=m?.source,t[21]=X,t[22]=j,t[23]=u?.footnote,t[24]=u?.source,t[25]=x,t[26]=Wt):Wt=t[26];let ie;return t[27]!==At||t[28]!==R||t[29]!==G||t[30]!==rt||t[31]!==v||t[32]!==P||t[33]!==$t||t[34]!==nt||t[35]!==ot||t[36]!==St||t[37]!==Bt||t[38]!==e||t[39]!==y||t[40]!==b||t[41]!==Wt||t[42]!==H||t[43]!==x?(ie=i.jsxRuntimeExports.jsxs(At,{className:St,style:Bt,id:rt,ref:Ot,"aria-label":R,backgroundColor:G,theme:H,language:P,minHeight:$t,width:x,height:v,relativeHeight:ot,padding:nt,children:[e,y,b,Wt]}),t[27]=At,t[28]=R,t[29]=G,t[30]=rt,t[31]=v,t[32]=P,t[33]=$t,t[34]=nt,t[35]=ot,t[36]=St,t[37]=Bt,t[38]=e,t[39]=y,t[40]=b,t[41]=Wt,t[42]=H,t[43]=x,t[44]=ie):ie=t[44],ie}function Pe(s){return s!==void 0}function He(s){return s!==void 0}function Xe(s){return s.data}function Ye(s){return s!==void 0}function Ue(s){return s.data}function We(s,t){return Me.ascending(s,t)}exports.ButterflyChart=Ge;
|
|
2
2
|
//# sourceMappingURL=ButterflyChart.cjs.map
|
package/dist/ButterflyChart.js
CHANGED
|
@@ -9,7 +9,7 @@ import { T as we } from "./Tooltip-CwWUegPB.js";
|
|
|
9
9
|
import { s as je } from "./string2HTML-DhG75NqA.js";
|
|
10
10
|
import { X as me } from "./XTicksAndGridLines-CObVFSm4.js";
|
|
11
11
|
import { A as ue } from "./Axis-CRyfcLjc.js";
|
|
12
|
-
import { Y as Ae } from "./YAxesLabels-
|
|
12
|
+
import { Y as Ae } from "./YAxesLabels-1XTb-D0_.js";
|
|
13
13
|
import { R as de } from "./ReferenceLine-2XCwHXQ4.js";
|
|
14
14
|
import { b as Be } from "./band-CyHaVft5.js";
|
|
15
15
|
import { a as fe } from "./linear-BwnDd9KF.js";
|
package/dist/DonutChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./index-CHPV5EwG-CTPQjnHt.cjs"),K=require("react"),ne=require("./Typography-DX7PlgQU.cjs"),xe=require("./index-Cno4Q0YE.cjs"),fe=require("./Source-DYMJRrsq.cjs"),ge=require("./index-DQA8q5sC.cjs"),me=require("./Modal-JW_IExO3.cjs"),he=require("./Tooltip-4dJo4_AF.cjs"),_=require("./Colors.cjs"),de=require("./numberFormattingFunction-02t-wJta.cjs"),ye=require("./string2HTML-CPGr_I5E.cjs"),O=require("./array-DKbXV8lR.cjs"),ve=require("./GraphFooter.cjs"),je=require("./GraphHeader.cjs"),Re=require("./EmptyState-sAEZ_5rU.cjs"),ue=require("./GraphContainer-d8A46BK2.cjs"),ce=Math.abs,F=Math.atan2,U=Math.cos,be=Math.max,ie=Math.min,V=Math.sin,Z=Math.sqrt,I=1e-12,ee=Math.PI,se=ee/2,re=2*ee;function Ee(s){return s>1?0:s<-1?ee:Math.acos(s)}function pe(s){return s>=1?se:s<=-1?-se:Math.asin(s)}function Ae(s){return s.innerRadius}function Me(s){return s.outerRadius}function Ce(s){return s.startAngle}function Ne(s){return s.endAngle}function De(s){return s&&s.padAngle}function Se(s,e,c,R,l,b,d,t){var x=c-s,a=R-e,n=d-l,E=t-b,r=E*x-n*a;if(!(r*r<I))return r=(n*(e-b)-E*(s-l))/r,[s+r*x,e+r*a]}function te(s,e,c,R,l,b,d){var t=s-c,x=e-R,a=(d?b:-b)/Z(t*t+x*x),n=a*x,E=-a*t,r=s+n,i=e+E,h=c+n,v=R+E,T=(r+h)/2,f=(i+v)/2,y=h-r,M=v-i,p=y*y+M*M,j=l-b,A=r*v-h*i,G=(M<0?-1:1)*Z(be(0,j*j*p-A*A)),P=(A*M-y*G)/p,z=(-A*y-M*G)/p,N=(A*M+y*G)/p,D=(-A*y+M*G)/p,S=P-T,o=z-f,u=N-T,B=D-f;return S*S+o*o>u*u+B*B&&(P=N,z=D),{cx:P,cy:z,x01:-n,y01:-E,x11:P*(l/j-1),y11:z*(l/j-1)}}function qe(){var s=Ae,e=Me,c=O.constant(0),R=null,l=Ce,b=Ne,d=De,t=null,x=O.withPath(a);function a(){var n,E,r=+s.apply(this,arguments),i=+e.apply(this,arguments),h=l.apply(this,arguments)-se,v=b.apply(this,arguments)-se,T=ce(v-h),f=v>h;if(t||(t=n=x()),i<r&&(E=i,i=r,r=E),!(i>I))t.moveTo(0,0);else if(T>re-I)t.moveTo(i*U(h),i*V(h)),t.arc(0,0,i,h,v,!f),r>I&&(t.moveTo(r*U(v),r*V(v)),t.arc(0,0,r,v,h,f));else{var y=h,M=v,p=h,j=v,A=T,G=T,P=d.apply(this,arguments)/2,z=P>I&&(R?+R.apply(this,arguments):Z(r*r+i*i)),N=ie(ce(i-r)/2,+c.apply(this,arguments)),D=N,S=N,o,u;if(z>I){var B=pe(z/r*V(P)),L=pe(z/i*V(P));(A-=B*2)>I?(B*=f?1:-1,p+=B,j-=B):(A=0,p=j=(h+v)/2),(G-=L*2)>I?(L*=f?1:-1,y+=L,M-=L):(G=0,y=M=(h+v)/2)}var W=i*U(y),k=i*V(y),q=r*U(j),H=r*V(j);if(N>I){var $=i*U(M),X=i*V(M),Y=r*U(p),C=r*V(p),w;if(T<ee)if(w=Se(W,k,Y,C,$,X,q,H)){var g=W-w[0],J=k-w[1],Q=$-w[0],oe=X-w[1],ae=1/V(Ee((g*Q+J*oe)/(Z(g*g+J*J)*Z(Q*Q+oe*oe)))/2),le=Z(w[0]*w[0]+w[1]*w[1]);D=ie(N,(r-le)/(ae-1)),S=ie(N,(i-le)/(ae+1))}else D=S=0}G>I?S>I?(o=te(Y,C,W,k,i,S,f),u=te($,X,q,H,i,S,f),t.moveTo(o.cx+o.x01,o.cy+o.y01),S<N?t.arc(o.cx,o.cy,S,F(o.y01,o.x01),F(u.y01,u.x01),!f):(t.arc(o.cx,o.cy,S,F(o.y01,o.x01),F(o.y11,o.x11),!f),t.arc(0,0,i,F(o.cy+o.y11,o.cx+o.x11),F(u.cy+u.y11,u.cx+u.x11),!f),t.arc(u.cx,u.cy,S,F(u.y11,u.x11),F(u.y01,u.x01),!f))):(t.moveTo(W,k),t.arc(0,0,i,y,M,!f)):t.moveTo(W,k),!(r>I)||!(A>I)?t.lineTo(q,H):D>I?(o=te(q,H,$,X,r,-D,f),u=te(W,k,Y,C,r,-D,f),t.lineTo(o.cx+o.x01,o.cy+o.y01),D<N?t.arc(o.cx,o.cy,D,F(o.y01,o.x01),F(u.y01,u.x01),!f):(t.arc(o.cx,o.cy,D,F(o.y01,o.x01),F(o.y11,o.x11),!f),t.arc(0,0,r,F(o.cy+o.y11,o.cx+o.x11),F(u.cy+u.y11,u.cx+u.x11),f),t.arc(u.cx,u.cy,D,F(u.y11,u.x11),F(u.y01,u.x01),!f))):t.arc(0,0,r,j,p,f)}if(t.closePath(),n)return t=null,n+""||null}return a.centroid=function(){var n=(+s.apply(this,arguments)+ +e.apply(this,arguments))/2,E=(+l.apply(this,arguments)+ +b.apply(this,arguments))/2-ee/2;return[U(E)*n,V(E)*n]},a.innerRadius=function(n){return arguments.length?(s=typeof n=="function"?n:O.constant(+n),a):s},a.outerRadius=function(n){return arguments.length?(e=typeof n=="function"?n:O.constant(+n),a):e},a.cornerRadius=function(n){return arguments.length?(c=typeof n=="function"?n:O.constant(+n),a):c},a.padRadius=function(n){return arguments.length?(R=n==null?null:typeof n=="function"?n:O.constant(+n),a):R},a.startAngle=function(n){return arguments.length?(l=typeof n=="function"?n:O.constant(+n),a):l},a.endAngle=function(n){return arguments.length?(b=typeof n=="function"?n:O.constant(+n),a):b},a.padAngle=function(n){return arguments.length?(d=typeof n=="function"?n:O.constant(+n),a):d},a.context=function(n){return arguments.length?(t=n??null,a):t},a}function Te(s,e){return e<s?-1:e>s?1:e>=s?0:NaN}function ke(s){return s}function we(){var s=ke,e=Te,c=null,R=O.constant(0),l=O.constant(re),b=O.constant(0);function d(t){var x,a=(t=O.array(t)).length,n,E,r=0,i=new Array(a),h=new Array(a),v=+R.apply(this,arguments),T=Math.min(re,Math.max(-re,l.apply(this,arguments)-v)),f,y=Math.min(Math.abs(T)/a,b.apply(this,arguments)),M=y*(T<0?-1:1),p;for(x=0;x<a;++x)(p=h[i[x]=x]=+s(t[x],x,t))>0&&(r+=p);for(e!=null?i.sort(function(j,A){return e(h[j],h[A])}):c!=null&&i.sort(function(j,A){return c(t[j],t[A])}),x=0,E=r?(T-a*M)/r:0;x<a;++x,v=f)n=i[x],p=h[n],f=v+(p>0?p*E:0)+M,h[n]={data:t[n],index:x,value:p,startAngle:v,endAngle:f,padAngle:y};return h}return d.value=function(t){return arguments.length?(s=typeof t=="function"?t:O.constant(+t),d):s},d.sortValues=function(t){return arguments.length?(e=t,c=null,d):e},d.sort=function(t){return arguments.length?(c=t,e=null,d):c},d.startAngle=function(t){return arguments.length?(R=typeof t=="function"?t:O.constant(+t),d):R},d.endAngle=function(t){return arguments.length?(l=typeof t=="function"?t:O.constant(+t),d):l},d.padAngle=function(t){return arguments.length?(b=typeof t=="function"?t:O.constant(+t),d):b},d}function Oe(s){const e=m.compilerRuntimeExports.c(43),{mainText:c,data:R,radius:l,colors:b,subNote:d,strokeWidth:t,tooltip:x,onSeriesMouseOver:a,onSeriesMouseClick:n,colorDomain:E,resetSelectionOnDoubleClick:r,detailsOnClick:i,styles:h,classNames:v,precision:T}=s,f=we().sort(null).startAngle(0).value(ze),[y,M]=K.useState(void 0),[p,j]=K.useState(void 0),[A,G]=K.useState(void 0),[P,z]=K.useState(void 0),N=`${l*2}px`,D=`${l*2}px`,S=`0 0 ${l*2} ${l*2}`,o="ltr",u="mx-auto",B=`translate(${l} ${l})`;let L;e[0]!==R||e[1]!==c||e[2]!==T||e[3]!==l||e[4]!==t||e[5]!==d?(L=c||d?m.jsxRuntimeExports.jsx("foreignObject",{y:0-(l-t),x:0-(l-t),width:2*(l-t),height:2*(l-t),children:m.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4",children:[c?m.jsxRuntimeExports.jsx(ne.v,{marginBottom:"none",className:"donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center",children:typeof c=="string"?c:R.findIndex(C=>C.label===c.label)!==-1?de.numberFormattingFunction(R[R.findIndex(C=>C.label===c.label)].size,"NA",T,c.prefix,c.suffix):"NA"}):null,d?m.jsxRuntimeExports.jsx(ne.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:d}):typeof c=="string"||!c?null:m.jsxRuntimeExports.jsx(ne.j,{size:"base",marginBottom:"none",leading:"none",className:"donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold",children:c.label})]})}):null,e[0]=R,e[1]=c,e[2]=T,e[3]=l,e[4]=t,e[5]=d,e[6]=L):L=e[6];let W;e[7]!==E||e[8]!==b||e[9]!==i||e[10]!==p||e[11]!==y||e[12]!==n||e[13]!==a||e[14]!==l||e[15]!==r||e[16]!==j||e[17]!==t?(W=(C,w)=>m.jsxRuntimeExports.jsx("path",{d:qe()({innerRadius:l-t,outerRadius:l,startAngle:C.startAngle,endAngle:C.endAngle}),style:{fill:E.indexOf(C.data.label)!==-1?b[E.indexOf(C.data.label)%b.length]:_.Colors.gray,opacity:y?y.label===C.data.label?1:.3:1},onMouseEnter:g=>{M(C.data),z(g.clientY),G(g.clientX),a?.(C)},onClick:()=>{(n||i)&&(ge.isEqual(p,C.data)&&r?(j(void 0),n?.(void 0)):(j(C.data),n&&n(C.data)))},onMouseMove:g=>{M(C.data),z(g.clientY),G(g.clientX)},onMouseLeave:()=>{M(void 0),G(void 0),z(void 0),a?.(void 0)}},w),e[7]=E,e[8]=b,e[9]=i,e[10]=p,e[11]=y,e[12]=n,e[13]=a,e[14]=l,e[15]=r,e[16]=j,e[17]=t,e[18]=W):W=e[18];const k=f(R).map(W);let q;e[19]!==B||e[20]!==L||e[21]!==k?(q=m.jsxRuntimeExports.jsxs("g",{transform:B,children:[L,k]}),e[19]=B,e[20]=L,e[21]=k,e[22]=q):q=e[22];let H;e[23]!==N||e[24]!==D||e[25]!==S||e[26]!==q?(H=m.jsxRuntimeExports.jsx("svg",{width:N,height:D,viewBox:S,direction:o,className:u,children:q}),e[23]=N,e[24]=D,e[25]=S,e[26]=q,e[27]=H):H=e[27];let $;e[28]!==v?.tooltip||e[29]!==A||e[30]!==P||e[31]!==y||e[32]!==h?.tooltip||e[33]!==x?($=y&&x&&A&&P?m.jsxRuntimeExports.jsx(he.Tooltip,{data:y,body:x,xPos:A,yPos:P,backgroundStyle:h?.tooltip,className:v?.tooltip}):null,e[28]=v?.tooltip,e[29]=A,e[30]=P,e[31]=y,e[32]=h?.tooltip,e[33]=x,e[34]=$):$=e[34];let X;e[35]!==i||e[36]!==p||e[37]!==j?(X=i&&p!==void 0?m.jsxRuntimeExports.jsx(me.le,{open:p!==void 0,onClose:()=>{j(void 0)},children:m.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof i=="string"?{__html:ye.string2HTML(i,p)}:void 0,children:typeof i=="function"?i(p):null})}):null,e[35]=i,e[36]=p,e[37]=j,e[38]=X):X=e[38];let Y;return e[39]!==H||e[40]!==$||e[41]!==X?(Y=m.jsxRuntimeExports.jsxs(m.jsxRuntimeExports.Fragment,{children:[H,$,X]}),e[39]=H,e[40]=$,e[41]=X,e[42]=Y):Y=e[42],Y}function ze(s){return s.size}function Fe(s){const{mainText:e,graphTitle:c,colors:R=_.Colors.light.categoricalColors.colors,suffix:l="",sources:b,prefix:d="",strokeWidth:t=50,graphDescription:x,subNote:a,footNote:n,radius:E,data:r,showColorScale:i=!0,padding:h,backgroundColor:v=!1,tooltip:T,onSeriesMouseOver:f,graphID:y,onSeriesMouseClick:M,graphDownload:p=!1,dataDownload:j=!1,colorDomain:A,sortData:G,language:P="en",theme:z="light",width:N,height:D,minHeight:S=0,relativeHeight:o,ariaLabel:u,resetSelectionOnDoubleClick:B=!0,colorScaleMaxWidth:L,detailsOnClick:W,styles:k,classNames:q,precision:H=2}=s,[$,X]=K.useState(0),Y=K.useRef(null),C=K.useRef(null);K.useEffect(()=>{const g=new ResizeObserver(J=>{X((Math.min(J[0].target.clientWidth||620,J[0].target.clientHeight||480,E||1/0)||420)/2)});return Y.current&&g.observe(Y.current),()=>g.disconnect()},[E]);const w=G?xe.orderBy(r,["size"],[G]):r;return m.jsxRuntimeExports.jsxs(ue.GraphContainer,{className:q?.graphContainer,style:k?.graphContainer,id:y,ref:C,"aria-label":u,backgroundColor:v,theme:z,language:P,minHeight:S,width:N,height:D,relativeHeight:o,padding:h,children:[c||x||p||j?m.jsxRuntimeExports.jsx(je.GraphHeader,{styles:{title:k?.title,description:k?.description},classNames:{title:q?.title,description:q?.description},graphTitle:c,graphDescription:x,width:N,graphDownload:p?C:void 0,dataDownload:j?r.map(g=>g.data).filter(g=>g!==void 0).length>0?r.map(g=>g.data).filter(g=>g!==void 0):r.filter(g=>g!==void 0):null}):null,r.length===0?m.jsxRuntimeExports.jsx(Re.EmptyState,{}):m.jsxRuntimeExports.jsxs(m.jsxRuntimeExports.Fragment,{children:[i?m.jsxRuntimeExports.jsx("div",{className:m.mo("leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap",q?.colorLegend),style:{maxWidth:L},"aria-label":"Color legend",children:w.map((g,J)=>m.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center pb-3",children:[m.jsxRuntimeExports.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:(A||w.map(Q=>Q.label)).indexOf(g.label)!==-1?(R||_.Colors[z].categoricalColors.colors)[(A||w.map(Q=>Q.label)).indexOf(g.label)%(R||_.Colors[z].categoricalColors.colors).length]:_.Colors.gray}}),m.jsxRuntimeExports.jsxs(ne.j,{marginBottom:"none",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:[g.label,":"," ",m.jsxRuntimeExports.jsx("span",{className:"font-bold",style:{fontSize:"inherit"},children:de.numberFormattingFunction(g.size,"NA",H,d,l)})]})]},J))}):null,m.jsxRuntimeExports.jsx(fe.n,{size:"lg"}),m.jsxRuntimeExports.jsx(ue.GraphArea,{ref:Y,children:$?m.jsxRuntimeExports.jsx(Oe,{mainText:e,data:w,colors:R,radius:$,subNote:a,strokeWidth:t,tooltip:T,colorDomain:A||w.map(g=>g.label),onSeriesMouseOver:f,onSeriesMouseClick:M,resetSelectionOnDoubleClick:B,styles:k,detailsOnClick:W,precision:H}):null})]}),b||n?m.jsxRuntimeExports.jsx(ve.GraphFooter,{styles:{footnote:k?.footnote,source:k?.source},classNames:{footnote:q?.footnote,source:q?.source},sources:b,footNote:n,width:N}):null]})}exports.DonutChart=Fe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./index-CHPV5EwG-CTPQjnHt.cjs"),K=require("react"),ne=require("./Typography-DX7PlgQU.cjs"),ge=require("./index-Cno4Q0YE.cjs"),me=require("./Source-DYMJRrsq.cjs"),fe=require("./index-DQA8q5sC.cjs"),xe=require("./Modal-JW_IExO3.cjs"),he=require("./Tooltip-4dJo4_AF.cjs"),_=require("./Colors.cjs"),de=require("./numberFormattingFunction-02t-wJta.cjs"),ye=require("./string2HTML-CPGr_I5E.cjs"),O=require("./array-DKbXV8lR.cjs"),ve=require("./GraphFooter.cjs"),je=require("./GraphHeader.cjs"),Re=require("./EmptyState-sAEZ_5rU.cjs"),ue=require("./GraphContainer-d8A46BK2.cjs"),ce=Math.abs,F=Math.atan2,U=Math.cos,be=Math.max,ie=Math.min,V=Math.sin,Z=Math.sqrt,$=1e-12,ee=Math.PI,se=ee/2,re=2*ee;function Ee(s){return s>1?0:s<-1?ee:Math.acos(s)}function pe(s){return s>=1?se:s<=-1?-se:Math.asin(s)}function Ae(s){return s.innerRadius}function Ce(s){return s.outerRadius}function Me(s){return s.startAngle}function Ne(s){return s.endAngle}function De(s){return s&&s.padAngle}function Se(s,e,c,R,l,b,d,t){var g=c-s,a=R-e,n=d-l,E=t-b,r=E*g-n*a;if(!(r*r<$))return r=(n*(e-b)-E*(s-l))/r,[s+r*g,e+r*a]}function te(s,e,c,R,l,b,d){var t=s-c,g=e-R,a=(d?b:-b)/Z(t*t+g*g),n=a*g,E=-a*t,r=s+n,i=e+E,h=c+n,v=R+E,T=(r+h)/2,m=(i+v)/2,y=h-r,C=v-i,p=y*y+C*C,j=l-b,A=r*v-h*i,G=(C<0?-1:1)*Z(be(0,j*j*p-A*A)),P=(A*C-y*G)/p,z=(-A*y-C*G)/p,N=(A*C+y*G)/p,D=(-A*y+C*G)/p,S=P-T,o=z-m,u=N-T,B=D-m;return S*S+o*o>u*u+B*B&&(P=N,z=D),{cx:P,cy:z,x01:-n,y01:-E,x11:P*(l/j-1),y11:z*(l/j-1)}}function qe(){var s=Ae,e=Ce,c=O.constant(0),R=null,l=Me,b=Ne,d=De,t=null,g=O.withPath(a);function a(){var n,E,r=+s.apply(this,arguments),i=+e.apply(this,arguments),h=l.apply(this,arguments)-se,v=b.apply(this,arguments)-se,T=ce(v-h),m=v>h;if(t||(t=n=g()),i<r&&(E=i,i=r,r=E),!(i>$))t.moveTo(0,0);else if(T>re-$)t.moveTo(i*U(h),i*V(h)),t.arc(0,0,i,h,v,!m),r>$&&(t.moveTo(r*U(v),r*V(v)),t.arc(0,0,r,v,h,m));else{var y=h,C=v,p=h,j=v,A=T,G=T,P=d.apply(this,arguments)/2,z=P>$&&(R?+R.apply(this,arguments):Z(r*r+i*i)),N=ie(ce(i-r)/2,+c.apply(this,arguments)),D=N,S=N,o,u;if(z>$){var B=pe(z/r*V(P)),L=pe(z/i*V(P));(A-=B*2)>$?(B*=m?1:-1,p+=B,j-=B):(A=0,p=j=(h+v)/2),(G-=L*2)>$?(L*=m?1:-1,y+=L,C-=L):(G=0,y=C=(h+v)/2)}var W=i*U(y),k=i*V(y),q=r*U(j),H=r*V(j);if(N>$){var I=i*U(C),X=i*V(C),Y=r*U(p),M=r*V(p),w;if(T<ee)if(w=Se(W,k,Y,M,I,X,q,H)){var f=W-w[0],J=k-w[1],Q=I-w[0],oe=X-w[1],ae=1/V(Ee((f*Q+J*oe)/(Z(f*f+J*J)*Z(Q*Q+oe*oe)))/2),le=Z(w[0]*w[0]+w[1]*w[1]);D=ie(N,(r-le)/(ae-1)),S=ie(N,(i-le)/(ae+1))}else D=S=0}G>$?S>$?(o=te(Y,M,W,k,i,S,m),u=te(I,X,q,H,i,S,m),t.moveTo(o.cx+o.x01,o.cy+o.y01),S<N?t.arc(o.cx,o.cy,S,F(o.y01,o.x01),F(u.y01,u.x01),!m):(t.arc(o.cx,o.cy,S,F(o.y01,o.x01),F(o.y11,o.x11),!m),t.arc(0,0,i,F(o.cy+o.y11,o.cx+o.x11),F(u.cy+u.y11,u.cx+u.x11),!m),t.arc(u.cx,u.cy,S,F(u.y11,u.x11),F(u.y01,u.x01),!m))):(t.moveTo(W,k),t.arc(0,0,i,y,C,!m)):t.moveTo(W,k),!(r>$)||!(A>$)?t.lineTo(q,H):D>$?(o=te(q,H,I,X,r,-D,m),u=te(W,k,Y,M,r,-D,m),t.lineTo(o.cx+o.x01,o.cy+o.y01),D<N?t.arc(o.cx,o.cy,D,F(o.y01,o.x01),F(u.y01,u.x01),!m):(t.arc(o.cx,o.cy,D,F(o.y01,o.x01),F(o.y11,o.x11),!m),t.arc(0,0,r,F(o.cy+o.y11,o.cx+o.x11),F(u.cy+u.y11,u.cx+u.x11),m),t.arc(u.cx,u.cy,D,F(u.y11,u.x11),F(u.y01,u.x01),!m))):t.arc(0,0,r,j,p,m)}if(t.closePath(),n)return t=null,n+""||null}return a.centroid=function(){var n=(+s.apply(this,arguments)+ +e.apply(this,arguments))/2,E=(+l.apply(this,arguments)+ +b.apply(this,arguments))/2-ee/2;return[U(E)*n,V(E)*n]},a.innerRadius=function(n){return arguments.length?(s=typeof n=="function"?n:O.constant(+n),a):s},a.outerRadius=function(n){return arguments.length?(e=typeof n=="function"?n:O.constant(+n),a):e},a.cornerRadius=function(n){return arguments.length?(c=typeof n=="function"?n:O.constant(+n),a):c},a.padRadius=function(n){return arguments.length?(R=n==null?null:typeof n=="function"?n:O.constant(+n),a):R},a.startAngle=function(n){return arguments.length?(l=typeof n=="function"?n:O.constant(+n),a):l},a.endAngle=function(n){return arguments.length?(b=typeof n=="function"?n:O.constant(+n),a):b},a.padAngle=function(n){return arguments.length?(d=typeof n=="function"?n:O.constant(+n),a):d},a.context=function(n){return arguments.length?(t=n??null,a):t},a}function Te(s,e){return e<s?-1:e>s?1:e>=s?0:NaN}function ke(s){return s}function we(){var s=ke,e=Te,c=null,R=O.constant(0),l=O.constant(re),b=O.constant(0);function d(t){var g,a=(t=O.array(t)).length,n,E,r=0,i=new Array(a),h=new Array(a),v=+R.apply(this,arguments),T=Math.min(re,Math.max(-re,l.apply(this,arguments)-v)),m,y=Math.min(Math.abs(T)/a,b.apply(this,arguments)),C=y*(T<0?-1:1),p;for(g=0;g<a;++g)(p=h[i[g]=g]=+s(t[g],g,t))>0&&(r+=p);for(e!=null?i.sort(function(j,A){return e(h[j],h[A])}):c!=null&&i.sort(function(j,A){return c(t[j],t[A])}),g=0,E=r?(T-a*C)/r:0;g<a;++g,v=m)n=i[g],p=h[n],m=v+(p>0?p*E:0)+C,h[n]={data:t[n],index:g,value:p,startAngle:v,endAngle:m,padAngle:y};return h}return d.value=function(t){return arguments.length?(s=typeof t=="function"?t:O.constant(+t),d):s},d.sortValues=function(t){return arguments.length?(e=t,c=null,d):e},d.sort=function(t){return arguments.length?(c=t,e=null,d):c},d.startAngle=function(t){return arguments.length?(R=typeof t=="function"?t:O.constant(+t),d):R},d.endAngle=function(t){return arguments.length?(l=typeof t=="function"?t:O.constant(+t),d):l},d.padAngle=function(t){return arguments.length?(b=typeof t=="function"?t:O.constant(+t),d):b},d}function Oe(s){const e=x.compilerRuntimeExports.c(43),{mainText:c,data:R,radius:l,colors:b,subNote:d,strokeWidth:t,tooltip:g,onSeriesMouseOver:a,onSeriesMouseClick:n,colorDomain:E,resetSelectionOnDoubleClick:r,detailsOnClick:i,styles:h,classNames:v,precision:T}=s,m=we().sort(null).startAngle(0).value(ze),[y,C]=K.useState(void 0),[p,j]=K.useState(void 0),[A,G]=K.useState(void 0),[P,z]=K.useState(void 0),N=`${l*2}px`,D=`${l*2}px`,S=`0 0 ${l*2} ${l*2}`,o="ltr",u="mx-auto",B=`translate(${l} ${l})`;let L;e[0]!==R||e[1]!==c||e[2]!==T||e[3]!==l||e[4]!==t||e[5]!==d?(L=c||d?x.jsxRuntimeExports.jsx("foreignObject",{y:0-(l-t),x:0-(l-t),width:2*(l-t),height:2*(l-t),children:x.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4",style:{display:"flex",flexDirection:"column",gap:"0.125rem",justifyContent:"center",alignItems:"center",height:"inherit",padding:"0 1rem"},children:[c?x.jsxRuntimeExports.jsx(ne.v,{marginBottom:"none",className:"donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center",children:typeof c=="string"?c:R.findIndex(M=>M.label===c.label)!==-1?de.numberFormattingFunction(R[R.findIndex(M=>M.label===c.label)].size,"NA",T,c.prefix,c.suffix):"NA"}):null,d?x.jsxRuntimeExports.jsx(ne.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:d}):typeof c=="string"||!c?null:x.jsxRuntimeExports.jsx(ne.j,{size:"base",marginBottom:"none",leading:"none",className:"donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold",children:c.label})]})}):null,e[0]=R,e[1]=c,e[2]=T,e[3]=l,e[4]=t,e[5]=d,e[6]=L):L=e[6];let W;e[7]!==E||e[8]!==b||e[9]!==i||e[10]!==p||e[11]!==y||e[12]!==n||e[13]!==a||e[14]!==l||e[15]!==r||e[16]!==j||e[17]!==t?(W=(M,w)=>x.jsxRuntimeExports.jsx("path",{d:qe()({innerRadius:l-t,outerRadius:l,startAngle:M.startAngle,endAngle:M.endAngle}),style:{fill:E.indexOf(M.data.label)!==-1?b[E.indexOf(M.data.label)%b.length]:_.Colors.gray,opacity:y?y.label===M.data.label?1:.3:1},onMouseEnter:f=>{C(M.data),z(f.clientY),G(f.clientX),a?.(M)},onClick:()=>{(n||i)&&(fe.isEqual(p,M.data)&&r?(j(void 0),n?.(void 0)):(j(M.data),n&&n(M.data)))},onMouseMove:f=>{C(M.data),z(f.clientY),G(f.clientX)},onMouseLeave:()=>{C(void 0),G(void 0),z(void 0),a?.(void 0)}},w),e[7]=E,e[8]=b,e[9]=i,e[10]=p,e[11]=y,e[12]=n,e[13]=a,e[14]=l,e[15]=r,e[16]=j,e[17]=t,e[18]=W):W=e[18];const k=m(R).map(W);let q;e[19]!==B||e[20]!==L||e[21]!==k?(q=x.jsxRuntimeExports.jsxs("g",{transform:B,children:[L,k]}),e[19]=B,e[20]=L,e[21]=k,e[22]=q):q=e[22];let H;e[23]!==N||e[24]!==D||e[25]!==S||e[26]!==q?(H=x.jsxRuntimeExports.jsx("svg",{width:N,height:D,viewBox:S,direction:o,className:u,children:q}),e[23]=N,e[24]=D,e[25]=S,e[26]=q,e[27]=H):H=e[27];let I;e[28]!==v?.tooltip||e[29]!==A||e[30]!==P||e[31]!==y||e[32]!==h?.tooltip||e[33]!==g?(I=y&&g&&A&&P?x.jsxRuntimeExports.jsx(he.Tooltip,{data:y,body:g,xPos:A,yPos:P,backgroundStyle:h?.tooltip,className:v?.tooltip}):null,e[28]=v?.tooltip,e[29]=A,e[30]=P,e[31]=y,e[32]=h?.tooltip,e[33]=g,e[34]=I):I=e[34];let X;e[35]!==i||e[36]!==p||e[37]!==j?(X=i&&p!==void 0?x.jsxRuntimeExports.jsx(xe.le,{open:p!==void 0,onClose:()=>{j(void 0)},children:x.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof i=="string"?{__html:ye.string2HTML(i,p)}:void 0,children:typeof i=="function"?i(p):null})}):null,e[35]=i,e[36]=p,e[37]=j,e[38]=X):X=e[38];let Y;return e[39]!==H||e[40]!==I||e[41]!==X?(Y=x.jsxRuntimeExports.jsxs(x.jsxRuntimeExports.Fragment,{children:[H,I,X]}),e[39]=H,e[40]=I,e[41]=X,e[42]=Y):Y=e[42],Y}function ze(s){return s.size}function Fe(s){const{mainText:e,graphTitle:c,colors:R=_.Colors.light.categoricalColors.colors,suffix:l="",sources:b,prefix:d="",strokeWidth:t=50,graphDescription:g,subNote:a,footNote:n,radius:E,data:r,showColorScale:i=!0,padding:h,backgroundColor:v=!1,tooltip:T,onSeriesMouseOver:m,graphID:y,onSeriesMouseClick:C,graphDownload:p=!1,dataDownload:j=!1,colorDomain:A,sortData:G,language:P="en",theme:z="light",width:N,height:D,minHeight:S=0,relativeHeight:o,ariaLabel:u,resetSelectionOnDoubleClick:B=!0,colorScaleMaxWidth:L,detailsOnClick:W,styles:k,classNames:q,precision:H=2}=s,[I,X]=K.useState(0),Y=K.useRef(null),M=K.useRef(null);K.useEffect(()=>{const f=new ResizeObserver(J=>{X((Math.min(J[0].target.clientWidth||620,J[0].target.clientHeight||480,E||1/0)||420)/2)});return Y.current&&f.observe(Y.current),()=>f.disconnect()},[E]);const w=G?ge.orderBy(r,["size"],[G]):r;return x.jsxRuntimeExports.jsxs(ue.GraphContainer,{className:q?.graphContainer,style:k?.graphContainer,id:y,ref:M,"aria-label":u,backgroundColor:v,theme:z,language:P,minHeight:S,width:N,height:D,relativeHeight:o,padding:h,children:[c||g||p||j?x.jsxRuntimeExports.jsx(je.GraphHeader,{styles:{title:k?.title,description:k?.description},classNames:{title:q?.title,description:q?.description},graphTitle:c,graphDescription:g,width:N,graphDownload:p?M:void 0,dataDownload:j?r.map(f=>f.data).filter(f=>f!==void 0).length>0?r.map(f=>f.data).filter(f=>f!==void 0):r.filter(f=>f!==void 0):null}):null,r.length===0?x.jsxRuntimeExports.jsx(Re.EmptyState,{}):x.jsxRuntimeExports.jsxs(x.jsxRuntimeExports.Fragment,{children:[i?x.jsxRuntimeExports.jsx("div",{className:x.mo("leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap",q?.colorLegend),style:{maxWidth:L},"aria-label":"Color legend",children:w.map((f,J)=>x.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center pb-3",children:[x.jsxRuntimeExports.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:(A||w.map(Q=>Q.label)).indexOf(f.label)!==-1?(R||_.Colors[z].categoricalColors.colors)[(A||w.map(Q=>Q.label)).indexOf(f.label)%(R||_.Colors[z].categoricalColors.colors).length]:_.Colors.gray}}),x.jsxRuntimeExports.jsxs(ne.j,{marginBottom:"none",size:"sm",className:"text-primary-gray-700 dark:text-primary-gray-100",children:[f.label,":"," ",x.jsxRuntimeExports.jsx("span",{className:"font-bold",style:{fontSize:"inherit"},children:de.numberFormattingFunction(f.size,"NA",H,d,l)})]})]},J))}):null,x.jsxRuntimeExports.jsx(me.n,{size:"lg"}),x.jsxRuntimeExports.jsx(ue.GraphArea,{ref:Y,children:I?x.jsxRuntimeExports.jsx(Oe,{mainText:e,data:w,colors:R,radius:I,subNote:a,strokeWidth:t,tooltip:T,colorDomain:A||w.map(f=>f.label),onSeriesMouseOver:m,onSeriesMouseClick:C,resetSelectionOnDoubleClick:B,styles:k,detailsOnClick:W,precision:H}):null})]}),b||n?x.jsxRuntimeExports.jsx(ve.GraphFooter,{styles:{footnote:k?.footnote,source:k?.source},classNames:{footnote:q?.footnote,source:q?.source},sources:b,footNote:n,width:N}):null]})}exports.DonutChart=Fe;
|
|
2
2
|
//# sourceMappingURL=DonutChart.cjs.map
|
package/dist/DonutChart.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DonutChart.cjs","sources":["../node_modules/d3-shape/src/math.js","../node_modules/d3-shape/src/arc.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../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","import constant from \"./constant.js\";\nimport {abs, acos, asin, atan2, cos, epsilon, halfPi, max, min, pi, sin, sqrt, tau} from \"./math.js\";\nimport {withPath} from \"./path.js\";\n\nfunction arcInnerRadius(d) {\n return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0, y10 = y1 - y0,\n x32 = x3 - x2, y32 = y3 - y2,\n t = y32 * x10 - x32 * y10;\n if (t * t < epsilon) return;\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n var x01 = x0 - x1,\n y01 = y0 - y1,\n lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),\n ox = lo * y01,\n oy = -lo * x01,\n x11 = x0 + ox,\n y11 = y0 + oy,\n x10 = x1 + ox,\n y10 = y1 + oy,\n x00 = (x11 + x10) / 2,\n y00 = (y11 + y10) / 2,\n dx = x10 - x11,\n dy = y10 - y11,\n d2 = dx * dx + dy * dy,\n r = r1 - rc,\n D = x11 * y10 - x10 * y11,\n d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),\n cx0 = (D * dy - dx * d) / d2,\n cy0 = (-D * dx - dy * d) / d2,\n cx1 = (D * dy + dx * d) / d2,\n cy1 = (-D * dx + dy * d) / d2,\n dx0 = cx0 - x00,\n dy0 = cy0 - y00,\n dx1 = cx1 - x00,\n dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points.\n // TODO Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1)\n };\n}\n\nexport default function() {\n var innerRadius = arcInnerRadius,\n outerRadius = arcOuterRadius,\n cornerRadius = constant(0),\n padRadius = null,\n startAngle = arcStartAngle,\n endAngle = arcEndAngle,\n padAngle = arcPadAngle,\n context = null,\n path = withPath(arc);\n\n function arc() {\n var buffer,\n r,\n r0 = +innerRadius.apply(this, arguments),\n r1 = +outerRadius.apply(this, arguments),\n a0 = startAngle.apply(this, arguments) - halfPi,\n a1 = endAngle.apply(this, arguments) - halfPi,\n da = abs(a1 - a0),\n cw = a1 > a0;\n\n if (!context) context = buffer = path();\n\n // Ensure that the outer radius is always larger than the inner radius.\n if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n // Is it a point?\n if (!(r1 > epsilon)) context.moveTo(0, 0);\n\n // Or is it a circle or annulus?\n else if (da > tau - epsilon) {\n context.moveTo(r1 * cos(a0), r1 * sin(a0));\n context.arc(0, 0, r1, a0, a1, !cw);\n if (r0 > epsilon) {\n context.moveTo(r0 * cos(a1), r0 * sin(a1));\n context.arc(0, 0, r0, a1, a0, cw);\n }\n }\n\n // Or is it a circular or annular sector?\n else {\n var a01 = a0,\n a11 = a1,\n a00 = a0,\n a10 = a1,\n da0 = da,\n da1 = da,\n ap = padAngle.apply(this, arguments) / 2,\n rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),\n rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n rc0 = rc,\n rc1 = rc,\n t0,\n t1;\n\n // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.\n if (rp > epsilon) {\n var p0 = asin(rp / r0 * sin(ap)),\n p1 = asin(rp / r1 * sin(ap));\n if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n }\n\n var x01 = r1 * cos(a01),\n y01 = r1 * sin(a01),\n x10 = r0 * cos(a10),\n y10 = r0 * sin(a10);\n\n // Apply rounded corners?\n if (rc > epsilon) {\n var x11 = r1 * cos(a11),\n y11 = r1 * sin(a11),\n x00 = r0 * cos(a00),\n y00 = r0 * sin(a00),\n oc;\n\n // Restrict the corner radius according to the sector angle. If this\n // intersection fails, it’s probably because the arc is too small, so\n // disable the corner radius entirely.\n if (da < pi) {\n if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {\n var ax = x01 - oc[0],\n ay = y01 - oc[1],\n bx = x11 - oc[0],\n by = y11 - oc[1],\n kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),\n lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = min(rc, (r0 - lc) / (kc - 1));\n rc1 = min(rc, (r1 - lc) / (kc + 1));\n } else {\n rc0 = rc1 = 0;\n }\n }\n }\n\n // Is the sector collapsed to a line?\n if (!(da1 > epsilon)) context.moveTo(x01, y01);\n\n // Does the sector’s outer ring have rounded corners?\n else if (rc1 > epsilon) {\n t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the outer ring just a circular arc?\n else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n // Is there no inner ring, and it’s a circular sector?\n // Or perhaps it’s an annular sector collapsed due to padding?\n if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);\n\n // Does the sector’s inner ring (or point) have rounded corners?\n else if (rc0 > epsilon) {\n t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the inner ring just a circular arc?\n else context.arc(0, 0, r0, a10, a00, cw);\n }\n\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;\n return [cos(a) * r, sin(a) * r];\n };\n\n arc.innerRadius = function(_) {\n return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : innerRadius;\n };\n\n arc.outerRadius = function(_) {\n return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : outerRadius;\n };\n\n arc.cornerRadius = function(_) {\n return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : cornerRadius;\n };\n\n arc.padRadius = function(_) {\n return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), arc) : padRadius;\n };\n\n arc.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : startAngle;\n };\n\n arc.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : endAngle;\n };\n\n arc.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : padAngle;\n };\n\n arc.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n };\n\n return arc;\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","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie, arc } from 'd3-shape';\r\nimport { useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\n\r\nimport { 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 { string2HTML } from '@/Utils/string2HTML';\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\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\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 } = props;\r\n const pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n\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 <svg\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 <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 {pieData(data as any).map((d, i) => (\r\n <path\r\n key={i}\r\n d={\r\n arc()({\r\n innerRadius: radius - strokeWidth,\r\n outerRadius: radius,\r\n startAngle: d.startAngle,\r\n endAngle: d.endAngle,\r\n }) as string\r\n }\r\n style={{\r\n fill:\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 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 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 </g>\r\n </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 <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\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} 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 /** 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 /** 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 } = 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 ...[\r\n entries[0].target.clientWidth || 620,\r\n entries[0].target.clientHeight || 480,\r\n radius || Infinity,\r\n ],\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 }, [radius]);\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 {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\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 ) : null}\r\n <Spacer size='lg' />\r\n <GraphArea ref={graphDiv}>\r\n {graphRadius ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n 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 />\r\n ) : null}\r\n </GraphArea>\r\n </>\r\n )}\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":["abs","atan2","cos","max","min","sin","sqrt","epsilon","pi","halfPi","tau","acos","x","asin","arcInnerRadius","d","arcOuterRadius","arcStartAngle","arcEndAngle","arcPadAngle","intersect","x0","y0","x1","y1","x2","y2","x3","y3","x10","y10","x32","y32","t","cornerTangents","r1","rc","cw","x01","y01","lo","ox","oy","x11","y11","x00","y00","dx","dy","d2","r","D","cx0","cy0","cx1","cy1","dx0","dy0","dx1","dy1","arc","innerRadius","outerRadius","cornerRadius","constant","padRadius","startAngle","endAngle","padAngle","context","path","withPath","buffer","r0","a0","a1","da","a01","a11","a00","a10","da0","da1","ap","rp","rc0","rc1","t0","t1","p0","p1","oc","ax","ay","bx","by","kc","lc","a","_","descending","b","identity","pie","value","sortValues","sort","data","i","n","array","j","k","sum","index","arcs","p","pa","v","Graph","props","$","_c","mainText","radius","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","precision","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t2","t3","t4","t5","t6","jsx","jsxs","H2","findIndex","d_1","label","numberFormattingFunction","d_0","size","prefix","suffix","P","t7","d_2","fill","indexOf","length","Colors","gray","opacity","event","clientY","clientX","isEqual","event_0","t8","map","t9","t10","t11","Tooltip","t12","Modal","__html","string2HTML","t13","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","graphRadius","setGraphRadius","graphDiv","useRef","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","Math","target","clientWidth","clientHeight","Infinity","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","EmptyState","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","GraphFooter","footnote","source"],"mappings":"6pBAAaA,GAAM,KAAK,IACXC,EAAQ,KAAK,MACbC,EAAM,KAAK,IACXC,GAAM,KAAK,IACXC,GAAM,KAAK,IACXC,EAAM,KAAK,IACXC,EAAO,KAAK,KAEZC,EAAU,MACVC,GAAK,KAAK,GACVC,GAASD,GAAK,EACdE,GAAM,EAAIF,GAEhB,SAASG,GAAKC,EAAG,CACtB,OAAOA,EAAI,EAAI,EAAIA,EAAI,GAAKJ,GAAK,KAAK,KAAKI,CAAC,CAC9C,CAEO,SAASC,GAAKD,EAAG,CACtB,OAAOA,GAAK,EAAIH,GAASG,GAAK,GAAK,CAACH,GAAS,KAAK,KAAKG,CAAC,CAC1D,CCfA,SAASE,GAAeC,EAAG,CACzB,OAAOA,EAAE,WACX,CAEA,SAASC,GAAeD,EAAG,CACzB,OAAOA,EAAE,WACX,CAEA,SAASE,GAAcF,EAAG,CACxB,OAAOA,EAAE,UACX,CAEA,SAASG,GAAYH,EAAG,CACtB,OAAOA,EAAE,QACX,CAEA,SAASI,GAAYJ,EAAG,CACtB,OAAOA,GAAKA,EAAE,QAChB,CAEA,SAASK,GAAUC,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,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_modules/d3-shape/src/arc.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../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","import constant from \"./constant.js\";\nimport {abs, acos, asin, atan2, cos, epsilon, halfPi, max, min, pi, sin, sqrt, tau} from \"./math.js\";\nimport {withPath} from \"./path.js\";\n\nfunction arcInnerRadius(d) {\n return d.innerRadius;\n}\n\nfunction arcOuterRadius(d) {\n return d.outerRadius;\n}\n\nfunction arcStartAngle(d) {\n return d.startAngle;\n}\n\nfunction arcEndAngle(d) {\n return d.endAngle;\n}\n\nfunction arcPadAngle(d) {\n return d && d.padAngle; // Note: optional!\n}\n\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0, y10 = y1 - y0,\n x32 = x3 - x2, y32 = y3 - y2,\n t = y32 * x10 - x32 * y10;\n if (t * t < epsilon) return;\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n return [x0 + t * x10, y0 + t * y10];\n}\n\n// Compute perpendicular offset line of length rc.\n// http://mathworld.wolfram.com/Circle-LineIntersection.html\nfunction cornerTangents(x0, y0, x1, y1, r1, rc, cw) {\n var x01 = x0 - x1,\n y01 = y0 - y1,\n lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),\n ox = lo * y01,\n oy = -lo * x01,\n x11 = x0 + ox,\n y11 = y0 + oy,\n x10 = x1 + ox,\n y10 = y1 + oy,\n x00 = (x11 + x10) / 2,\n y00 = (y11 + y10) / 2,\n dx = x10 - x11,\n dy = y10 - y11,\n d2 = dx * dx + dy * dy,\n r = r1 - rc,\n D = x11 * y10 - x10 * y11,\n d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),\n cx0 = (D * dy - dx * d) / d2,\n cy0 = (-D * dx - dy * d) / d2,\n cx1 = (D * dy + dx * d) / d2,\n cy1 = (-D * dx + dy * d) / d2,\n dx0 = cx0 - x00,\n dy0 = cy0 - y00,\n dx1 = cx1 - x00,\n dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points.\n // TODO Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;\n\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1)\n };\n}\n\nexport default function() {\n var innerRadius = arcInnerRadius,\n outerRadius = arcOuterRadius,\n cornerRadius = constant(0),\n padRadius = null,\n startAngle = arcStartAngle,\n endAngle = arcEndAngle,\n padAngle = arcPadAngle,\n context = null,\n path = withPath(arc);\n\n function arc() {\n var buffer,\n r,\n r0 = +innerRadius.apply(this, arguments),\n r1 = +outerRadius.apply(this, arguments),\n a0 = startAngle.apply(this, arguments) - halfPi,\n a1 = endAngle.apply(this, arguments) - halfPi,\n da = abs(a1 - a0),\n cw = a1 > a0;\n\n if (!context) context = buffer = path();\n\n // Ensure that the outer radius is always larger than the inner radius.\n if (r1 < r0) r = r1, r1 = r0, r0 = r;\n\n // Is it a point?\n if (!(r1 > epsilon)) context.moveTo(0, 0);\n\n // Or is it a circle or annulus?\n else if (da > tau - epsilon) {\n context.moveTo(r1 * cos(a0), r1 * sin(a0));\n context.arc(0, 0, r1, a0, a1, !cw);\n if (r0 > epsilon) {\n context.moveTo(r0 * cos(a1), r0 * sin(a1));\n context.arc(0, 0, r0, a1, a0, cw);\n }\n }\n\n // Or is it a circular or annular sector?\n else {\n var a01 = a0,\n a11 = a1,\n a00 = a0,\n a10 = a1,\n da0 = da,\n da1 = da,\n ap = padAngle.apply(this, arguments) / 2,\n rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),\n rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),\n rc0 = rc,\n rc1 = rc,\n t0,\n t1;\n\n // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.\n if (rp > epsilon) {\n var p0 = asin(rp / r0 * sin(ap)),\n p1 = asin(rp / r1 * sin(ap));\n if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;\n else da0 = 0, a00 = a10 = (a0 + a1) / 2;\n if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;\n else da1 = 0, a01 = a11 = (a0 + a1) / 2;\n }\n\n var x01 = r1 * cos(a01),\n y01 = r1 * sin(a01),\n x10 = r0 * cos(a10),\n y10 = r0 * sin(a10);\n\n // Apply rounded corners?\n if (rc > epsilon) {\n var x11 = r1 * cos(a11),\n y11 = r1 * sin(a11),\n x00 = r0 * cos(a00),\n y00 = r0 * sin(a00),\n oc;\n\n // Restrict the corner radius according to the sector angle. If this\n // intersection fails, it’s probably because the arc is too small, so\n // disable the corner radius entirely.\n if (da < pi) {\n if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {\n var ax = x01 - oc[0],\n ay = y01 - oc[1],\n bx = x11 - oc[0],\n by = y11 - oc[1],\n kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),\n lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);\n rc0 = min(rc, (r0 - lc) / (kc - 1));\n rc1 = min(rc, (r1 - lc) / (kc + 1));\n } else {\n rc0 = rc1 = 0;\n }\n }\n }\n\n // Is the sector collapsed to a line?\n if (!(da1 > epsilon)) context.moveTo(x01, y01);\n\n // Does the sector’s outer ring have rounded corners?\n else if (rc1 > epsilon) {\n t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);\n t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);\n\n context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);\n context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the outer ring just a circular arc?\n else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);\n\n // Is there no inner ring, and it’s a circular sector?\n // Or perhaps it’s an annular sector collapsed due to padding?\n if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);\n\n // Does the sector’s inner ring (or point) have rounded corners?\n else if (rc0 > epsilon) {\n t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);\n t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);\n\n context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);\n\n // Have the corners merged?\n if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);\n\n // Otherwise, draw the two corners and the ring.\n else {\n context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);\n context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);\n context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);\n }\n }\n\n // Or is the inner ring just a circular arc?\n else context.arc(0, 0, r0, a10, a00, cw);\n }\n\n context.closePath();\n\n if (buffer) return context = null, buffer + \"\" || null;\n }\n\n arc.centroid = function() {\n var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,\n a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;\n return [cos(a) * r, sin(a) * r];\n };\n\n arc.innerRadius = function(_) {\n return arguments.length ? (innerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : innerRadius;\n };\n\n arc.outerRadius = function(_) {\n return arguments.length ? (outerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : outerRadius;\n };\n\n arc.cornerRadius = function(_) {\n return arguments.length ? (cornerRadius = typeof _ === \"function\" ? _ : constant(+_), arc) : cornerRadius;\n };\n\n arc.padRadius = function(_) {\n return arguments.length ? (padRadius = _ == null ? null : typeof _ === \"function\" ? _ : constant(+_), arc) : padRadius;\n };\n\n arc.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : startAngle;\n };\n\n arc.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : endAngle;\n };\n\n arc.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), arc) : padAngle;\n };\n\n arc.context = function(_) {\n return arguments.length ? ((context = _ == null ? null : _), arc) : context;\n };\n\n return arc;\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","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie, arc } from 'd3-shape';\r\nimport { useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\n\r\nimport { 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 { string2HTML } from '@/Utils/string2HTML';\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\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\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 } = props;\r\n const pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n\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 <svg\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 <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\r\n className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4'\r\n style={{\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: '0.125rem',\r\n justifyContent: 'center',\r\n alignItems: 'center',\r\n height: 'inherit',\r\n padding: '0 1rem',\r\n }}\r\n >\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 {pieData(data as any).map((d, i) => (\r\n <path\r\n key={i}\r\n d={\r\n arc()({\r\n innerRadius: radius - strokeWidth,\r\n outerRadius: radius,\r\n startAngle: d.startAngle,\r\n endAngle: d.endAngle,\r\n }) as string\r\n }\r\n style={{\r\n fill:\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 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 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 </g>\r\n </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 <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\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} 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 /** 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 /** 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 } = 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 ...[\r\n entries[0].target.clientWidth || 620,\r\n entries[0].target.clientHeight || 480,\r\n radius || Infinity,\r\n ],\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 }, [radius]);\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 {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\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 ) : null}\r\n <Spacer size='lg' />\r\n <GraphArea ref={graphDiv}>\r\n {graphRadius ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n 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 />\r\n ) : null}\r\n </GraphArea>\r\n </>\r\n )}\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":["abs","atan2","cos","max","min","sin","sqrt","epsilon","pi","halfPi","tau","acos","x","asin","arcInnerRadius","d","arcOuterRadius","arcStartAngle","arcEndAngle","arcPadAngle","intersect","x0","y0","x1","y1","x2","y2","x3","y3","x10","y10","x32","y32","t","cornerTangents","r1","rc","cw","x01","y01","lo","ox","oy","x11","y11","x00","y00","dx","dy","d2","r","D","cx0","cy0","cx1","cy1","dx0","dy0","dx1","dy1","arc","innerRadius","outerRadius","cornerRadius","constant","padRadius","startAngle","endAngle","padAngle","context","path","withPath","buffer","r0","a0","a1","da","a01","a11","a00","a10","da0","da1","ap","rp","rc0","rc1","t0","t1","p0","p1","oc","ax","ay","bx","by","kc","lc","a","_","descending","b","identity","pie","value","sortValues","sort","data","i","n","array","j","k","sum","index","arcs","p","pa","v","Graph","props","$","_c","mainText","radius","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","precision","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t2","t3","t4","t5","t6","jsx","jsxs","display","flexDirection","gap","justifyContent","alignItems","height","padding","H2","findIndex","d_1","label","numberFormattingFunction","d_0","size","prefix","suffix","P","t7","d_2","fill","indexOf","length","Colors","gray","opacity","event","clientY","clientX","isEqual","event_0","t8","map","t9","t10","t11","Tooltip","t12","Modal","__html","string2HTML","t13","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","graphRadius","setGraphRadius","graphDiv","useRef","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","Math","target","clientWidth","clientHeight","Infinity","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","EmptyState","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","GraphFooter","footnote","source"],"mappings":"6pBAAaA,GAAM,KAAK,IACXC,EAAQ,KAAK,MACbC,EAAM,KAAK,IACXC,GAAM,KAAK,IACXC,GAAM,KAAK,IACXC,EAAM,KAAK,IACXC,EAAO,KAAK,KAEZC,EAAU,MACVC,GAAK,KAAK,GACVC,GAASD,GAAK,EACdE,GAAM,EAAIF,GAEhB,SAASG,GAAKC,EAAG,CACtB,OAAOA,EAAI,EAAI,EAAIA,EAAI,GAAKJ,GAAK,KAAK,KAAKI,CAAC,CAC9C,CAEO,SAASC,GAAKD,EAAG,CACtB,OAAOA,GAAK,EAAIH,GAASG,GAAK,GAAK,CAACH,GAAS,KAAK,KAAKG,CAAC,CAC1D,CCfA,SAASE,GAAeC,EAAG,CACzB,OAAOA,EAAE,WACX,CAEA,SAASC,GAAeD,EAAG,CACzB,OAAOA,EAAE,WACX,CAEA,SAASE,GAAcF,EAAG,CACxB,OAAOA,EAAE,UACX,CAEA,SAASG,GAAYH,EAAG,CACtB,OAAOA,EAAE,QACX,CAEA,SAASI,GAAYJ,EAAG,CACtB,OAAOA,GAAKA,EAAE,QAChB,CAEA,SAASK,GAAUC,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,EAAIC,EAAI,CACjD,IAAIC,EAAMN,EAAKF,EAAIS,EAAMN,EAAKF,EAC1BS,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raphFooter as Ce } from "./GraphFooter.js";
|
|
|
14
14
|
import { GraphHeader as De } from "./GraphHeader.js";
|
|
15
15
|
import { E as Re } from "./EmptyState-BZo1BbAn.js";
|
|
16
16
|
import { G as ke, a as we } from "./GraphContainer-CRqzdKu2.js";
|
|
17
|
-
const ce = Math.abs,
|
|
17
|
+
const ce = Math.abs, I = Math.atan2, Q = Math.cos, Oe = Math.max, oe = Math.min, V = Math.sin, U = Math.sqrt, F = 1e-12, ee = Math.PI, re = ee / 2, te = 2 * ee;
|
|
18
18
|
function Te(a) {
|
|
19
19
|
return a > 1 ? 0 : a < -1 ? ee : Math.acos(a);
|
|
20
20
|
}
|
|
@@ -30,52 +30,52 @@ function ze(a) {
|
|
|
30
30
|
function Ee(a) {
|
|
31
31
|
return a.startAngle;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function Ie(a) {
|
|
34
34
|
return a.endAngle;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function Pe(a) {
|
|
37
37
|
return a && a.padAngle;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function Ge(a, e, c, j, l, A, m, n) {
|
|
40
40
|
var d = c - a, s = j - e, t = m - l, M = n - A, r = M * d - t * s;
|
|
41
41
|
if (!(r * r < F))
|
|
42
42
|
return r = (t * (e - A) - M * (a - l)) / r, [a + r * d, e + r * s];
|
|
43
43
|
}
|
|
44
44
|
function ne(a, e, c, j, l, A, m) {
|
|
45
|
-
var n = a - c, d = e - j, s = (m ? A : -A) / U(n * n + d * d), t = s * d, M = -s * n, r = a + t, i = e + M, h = c + t, v = j + M, T = (r + h) / 2, g = (i + v) / 2, x = h - r, C = v - i, f = x * x + C * C, b = l - A, N = r * v - h * i,
|
|
46
|
-
return w * w + o * o > u * u + L * L && (
|
|
47
|
-
cx:
|
|
45
|
+
var n = a - c, d = e - j, s = (m ? A : -A) / U(n * n + d * d), t = s * d, M = -s * n, r = a + t, i = e + M, h = c + t, v = j + M, T = (r + h) / 2, g = (i + v) / 2, x = h - r, C = v - i, f = x * x + C * C, b = l - A, N = r * v - h * i, P = (C < 0 ? -1 : 1) * U(Oe(0, b * b * f - N * N)), G = (N * C - x * P) / f, E = (-N * x - C * P) / f, R = (N * C + x * P) / f, k = (-N * x + C * P) / f, w = G - T, o = E - g, u = R - T, L = k - g;
|
|
46
|
+
return w * w + o * o > u * u + L * L && (G = R, E = k), {
|
|
47
|
+
cx: G,
|
|
48
48
|
cy: E,
|
|
49
49
|
x01: -t,
|
|
50
50
|
y01: -M,
|
|
51
|
-
x11:
|
|
51
|
+
x11: G * (l / b - 1),
|
|
52
52
|
y11: E * (l / b - 1)
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
function $e() {
|
|
56
|
-
var a = Se, e = ze, c = $(0), j = null, l = Ee, A =
|
|
56
|
+
var a = Se, e = ze, c = $(0), j = null, l = Ee, A = Ie, m = Pe, n = null, d = Me(s);
|
|
57
57
|
function s() {
|
|
58
58
|
var t, M, r = +a.apply(this, arguments), i = +e.apply(this, arguments), h = l.apply(this, arguments) - re, v = A.apply(this, arguments) - re, T = ce(v - h), g = v > h;
|
|
59
59
|
if (n || (n = t = d()), i < r && (M = i, i = r, r = M), !(i > F)) n.moveTo(0, 0);
|
|
60
60
|
else if (T > te - F)
|
|
61
61
|
n.moveTo(i * Q(h), i * V(h)), n.arc(0, 0, i, h, v, !g), r > F && (n.moveTo(r * Q(v), r * V(v)), n.arc(0, 0, r, v, h, g));
|
|
62
62
|
else {
|
|
63
|
-
var x = h, C = v, f = h, b = v, N = T,
|
|
63
|
+
var x = h, C = v, f = h, b = v, N = T, P = T, G = m.apply(this, arguments) / 2, E = G > F && (j ? +j.apply(this, arguments) : U(r * r + i * i)), R = oe(ce(i - r) / 2, +c.apply(this, arguments)), k = R, w = R, o, u;
|
|
64
64
|
if (E > F) {
|
|
65
|
-
var L = fe(E / r * V(
|
|
66
|
-
(N -= L * 2) > F ? (L *= g ? 1 : -1, f += L, b -= L) : (N = 0, f = b = (h + v) / 2), (
|
|
65
|
+
var L = fe(E / r * V(G)), W = fe(E / i * V(G));
|
|
66
|
+
(N -= L * 2) > F ? (L *= g ? 1 : -1, f += L, b -= L) : (N = 0, f = b = (h + v) / 2), (P -= W * 2) > F ? (W *= g ? 1 : -1, x += W, C -= W) : (P = 0, x = C = (h + v) / 2);
|
|
67
67
|
}
|
|
68
68
|
var X = i * Q(x), S = i * V(x), O = r * Q(b), B = r * V(b);
|
|
69
69
|
if (R > F) {
|
|
70
70
|
var H = i * Q(C), Y = i * V(C), q = r * Q(f), D = r * V(f), z;
|
|
71
71
|
if (T < ee)
|
|
72
|
-
if (z =
|
|
72
|
+
if (z = Ge(X, S, q, D, H, Y, O, B)) {
|
|
73
73
|
var p = X - z[0], J = S - z[1], K = H - z[0], ae = Y - z[1], se = 1 / V(Te((p * K + J * ae) / (U(p * p + J * J) * U(K * K + ae * ae))) / 2), le = U(z[0] * z[0] + z[1] * z[1]);
|
|
74
74
|
k = oe(R, (r - le) / (se - 1)), w = oe(R, (i - le) / (se + 1));
|
|
75
75
|
} else
|
|
76
76
|
k = w = 0;
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
P > F ? w > F ? (o = ne(q, D, X, S, i, w, g), u = ne(H, Y, O, B, i, w, g), n.moveTo(o.cx + o.x01, o.cy + o.y01), w < R ? n.arc(o.cx, o.cy, w, I(o.y01, o.x01), I(u.y01, u.x01), !g) : (n.arc(o.cx, o.cy, w, I(o.y01, o.x01), I(o.y11, o.x11), !g), n.arc(0, 0, i, I(o.cy + o.y11, o.cx + o.x11), I(u.cy + u.y11, u.cx + u.x11), !g), n.arc(u.cx, u.cy, w, I(u.y11, u.x11), I(u.y01, u.x01), !g))) : (n.moveTo(X, S), n.arc(0, 0, i, x, C, !g)) : n.moveTo(X, S), !(r > F) || !(N > F) ? n.lineTo(O, B) : k > F ? (o = ne(O, B, H, Y, r, -k, g), u = ne(X, S, q, D, r, -k, g), n.lineTo(o.cx + o.x01, o.cy + o.y01), k < R ? n.arc(o.cx, o.cy, k, I(o.y01, o.x01), I(u.y01, u.x01), !g) : (n.arc(o.cx, o.cy, k, I(o.y01, o.x01), I(o.y11, o.x11), !g), n.arc(0, 0, r, I(o.cy + o.y11, o.cx + o.x11), I(u.cy + u.y11, u.cx + u.x11), g), n.arc(u.cx, u.cy, k, I(u.y11, u.x11), I(u.y01, u.x01), !g))) : n.arc(0, 0, r, b, f, g);
|
|
79
79
|
}
|
|
80
80
|
if (n.closePath(), t) return n = null, t + "" || null;
|
|
81
81
|
}
|
|
@@ -158,9 +158,17 @@ function Le(a) {
|
|
|
158
158
|
styles: h,
|
|
159
159
|
classNames: v,
|
|
160
160
|
precision: T
|
|
161
|
-
} = a, g = Fe().sort(null).startAngle(0).value(We), [x, C] = Z(void 0), [f, b] = Z(void 0), [N,
|
|
161
|
+
} = a, g = Fe().sort(null).startAngle(0).value(We), [x, C] = Z(void 0), [f, b] = Z(void 0), [N, P] = Z(void 0), [G, E] = Z(void 0), R = `${l * 2}px`, k = `${l * 2}px`, w = `0 0 ${l * 2} ${l * 2}`, o = "ltr", u = "mx-auto", L = `translate(${l} ${l})`;
|
|
162
162
|
let W;
|
|
163
|
-
e[0] !== j || e[1] !== c || e[2] !== T || e[3] !== l || e[4] !== n || e[5] !== m ? (W = c || m ? /* @__PURE__ */ y.jsx("foreignObject", { y: 0 - (l - n), x: 0 - (l - n), width: 2 * (l - n), height: 2 * (l - n), children: /* @__PURE__ */ y.jsxs("div", { className: "flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4",
|
|
163
|
+
e[0] !== j || e[1] !== c || e[2] !== T || e[3] !== l || e[4] !== n || e[5] !== m ? (W = c || m ? /* @__PURE__ */ y.jsx("foreignObject", { y: 0 - (l - n), x: 0 - (l - n), width: 2 * (l - n), height: 2 * (l - n), children: /* @__PURE__ */ y.jsxs("div", { className: "flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4", style: {
|
|
164
|
+
display: "flex",
|
|
165
|
+
flexDirection: "column",
|
|
166
|
+
gap: "0.125rem",
|
|
167
|
+
justifyContent: "center",
|
|
168
|
+
alignItems: "center",
|
|
169
|
+
height: "inherit",
|
|
170
|
+
padding: "0 1rem"
|
|
171
|
+
}, children: [
|
|
164
172
|
c ? /* @__PURE__ */ y.jsx(he, { marginBottom: "none", className: "donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center", children: typeof c == "string" ? c : j.findIndex((D) => D.label === c.label) !== -1 ? me(j[j.findIndex((D) => D.label === c.label)].size, "NA", T, c.prefix, c.suffix) : "NA" }) : null,
|
|
165
173
|
m ? /* @__PURE__ */ y.jsx(ie, { marginBottom: "none", size: "base", leading: "none", className: "donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold", children: m }) : typeof c == "string" || !c ? null : /* @__PURE__ */ y.jsx(ie, { size: "base", marginBottom: "none", leading: "none", className: "donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold", children: c.label })
|
|
166
174
|
] }) }) : null, e[0] = j, e[1] = c, e[2] = T, e[3] = l, e[4] = n, e[5] = m, e[6] = W) : W = e[6];
|
|
@@ -174,13 +182,13 @@ function Le(a) {
|
|
|
174
182
|
fill: M.indexOf(D.data.label) !== -1 ? A[M.indexOf(D.data.label) % A.length] : _.gray,
|
|
175
183
|
opacity: x ? x.label === D.data.label ? 1 : 0.3 : 1
|
|
176
184
|
}, onMouseEnter: (p) => {
|
|
177
|
-
C(D.data), E(p.clientY),
|
|
185
|
+
C(D.data), E(p.clientY), P(p.clientX), s?.(D);
|
|
178
186
|
}, onClick: () => {
|
|
179
187
|
(t || i) && (ve(f, D.data) && r ? (b(void 0), t?.(void 0)) : (b(D.data), t && t(D.data)));
|
|
180
188
|
}, onMouseMove: (p) => {
|
|
181
|
-
C(D.data), E(p.clientY),
|
|
189
|
+
C(D.data), E(p.clientY), P(p.clientX);
|
|
182
190
|
}, onMouseLeave: () => {
|
|
183
|
-
C(void 0),
|
|
191
|
+
C(void 0), P(void 0), E(void 0), s?.(void 0);
|
|
184
192
|
} }, z), e[7] = M, e[8] = A, e[9] = i, e[10] = f, e[11] = x, e[12] = t, e[13] = s, e[14] = l, e[15] = r, e[16] = b, e[17] = n, e[18] = X) : X = e[18];
|
|
185
193
|
const S = g(j).map(X);
|
|
186
194
|
let O;
|
|
@@ -191,7 +199,7 @@ function Le(a) {
|
|
|
191
199
|
let B;
|
|
192
200
|
e[23] !== R || e[24] !== k || e[25] !== w || e[26] !== O ? (B = /* @__PURE__ */ y.jsx("svg", { width: R, height: k, viewBox: w, direction: o, className: u, children: O }), e[23] = R, e[24] = k, e[25] = w, e[26] = O, e[27] = B) : B = e[27];
|
|
193
201
|
let H;
|
|
194
|
-
e[28] !== v?.tooltip || e[29] !== N || e[30] !==
|
|
202
|
+
e[28] !== v?.tooltip || e[29] !== N || e[30] !== G || e[31] !== x || e[32] !== h?.tooltip || e[33] !== d ? (H = x && d && N && G ? /* @__PURE__ */ y.jsx(je, { data: x, body: d, xPos: N, yPos: G, backgroundStyle: h?.tooltip, className: v?.tooltip }) : null, e[28] = v?.tooltip, e[29] = N, e[30] = G, e[31] = x, e[32] = h?.tooltip, e[33] = d, e[34] = H) : H = e[34];
|
|
195
203
|
let Y;
|
|
196
204
|
e[35] !== i || e[36] !== f || e[37] !== b ? (Y = i && f !== void 0 ? /* @__PURE__ */ y.jsx(be, { open: f !== void 0, onClose: () => {
|
|
197
205
|
b(void 0);
|
|
@@ -232,8 +240,8 @@ function sn(a) {
|
|
|
232
240
|
graphDownload: f = !1,
|
|
233
241
|
dataDownload: b = !1,
|
|
234
242
|
colorDomain: N,
|
|
235
|
-
sortData:
|
|
236
|
-
language:
|
|
243
|
+
sortData: P,
|
|
244
|
+
language: G = "en",
|
|
237
245
|
theme: E = "light",
|
|
238
246
|
width: R,
|
|
239
247
|
height: k,
|
|
@@ -253,8 +261,8 @@ function sn(a) {
|
|
|
253
261
|
});
|
|
254
262
|
return q.current && p.observe(q.current), () => p.disconnect();
|
|
255
263
|
}, [M]);
|
|
256
|
-
const z =
|
|
257
|
-
return /* @__PURE__ */ y.jsxs(ke, { className: O?.graphContainer, style: S?.graphContainer, id: x, ref: D, "aria-label": u, backgroundColor: v, theme: E, language:
|
|
264
|
+
const z = P ? ye(r, ["size"], [P]) : r;
|
|
265
|
+
return /* @__PURE__ */ y.jsxs(ke, { className: O?.graphContainer, style: S?.graphContainer, id: x, ref: D, "aria-label": u, backgroundColor: v, theme: E, language: G, minHeight: w, width: R, height: k, relativeHeight: o, padding: h, children: [
|
|
258
266
|
c || d || f || b ? /* @__PURE__ */ y.jsx(De, { styles: {
|
|
259
267
|
title: S?.title,
|
|
260
268
|
description: S?.description
|