gf-components 0.1.177 → 0.1.179
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/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +15 -2
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -586,7 +586,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
586
586
|
color: var(--gf-color-text-secondary);
|
|
587
587
|
font-size: 10px;
|
|
588
588
|
line-height: ${gv}px;
|
|
589
|
-
`,x_=(e,t=12)=>{const r=document.createElement("canvas").getContext("2d");return r.font=`${t}px Roboto, sans-serif`,r.measureText(e)},W6e=(e,t,n=12)=>{const r=e.split(" "),i=[];let o=r[0];for(let a=1;a<r.length;a++){const s=`${o} ${r[a]}`;x_(s,n).width>t?(i.push(o),o=r[a]):o=s}return i.push(o),i},Z6e=({data:e=[],height:t=600,margin:n={},padding:r=.5,keys:i=null,indexBy:o=null,tooltip:a=null,enableLabel:s=!1,label:l=null,keyLabelWidth:c=120,keyLabelPadding:u=20,axisBottom:d={},axisTop:f={},layers:h=["grid","axes"],zeroMarker:p=!1,defs:v=[],fill:g=[],enableGridY:b=!1,enableGridX:C=!1})=>{const x=({bar:R})=>{var j;const A=M.useRef(null),[L,O]=M.useState(0),k=((j=R==null?void 0:R.data)==null?void 0:j.indexValue)||"label",P=W6e(k,c,b5);M.useEffect(()=>{if(A.current){const N=A.current.getBoundingClientRect();O(N.height)}},[]);const T=c+u,I=R.y+R.height/2-L/2;return m.jsx("g",{ref:A,transform:`translate(-${T}, ${I})`,children:m.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:P.map((N,z)=>m.jsx(fb,{x:0,dy:z>0?gv:b5,children:N},z))})})};let S=null;const w=({bars:R})=>R.map((A,L)=>{var O;if(name=(O=A==null?void 0:A.data)==null?void 0:O.id,!(name!==S&&S!==null))return S=name,m.jsx(x,{bar:A},`bar-label-${L}`)}),$=({bar:R})=>{const L=l==null?void 0:l(R.data),O=x_(L,10),k=O.actualBoundingBoxRight+O.actualBoundingBoxLeft,P=O.actualBoundingBoxAscent+O.actualBoundingBoxDescent;if(k>=R.width)return m.jsx(m.Fragment,{});const T=R.x+R.width/2-k/2,I=R.y+R.height/2+P/2;return m.jsx("g",{transform:`translate(${T}, ${I})`,children:m.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:m.jsx(fb,{style:{fontSize:10},children:L||"label"})})})},H=({bars:R})=>R.map((A,L)=>m.jsx($,{bar:A},`bar-inner-label-${L}`)),_=({data:R,keys:A})=>{v.reduce((O,k)=>(O[k.id]={...k},delete O[k.id].id,O),{}),g.reduce((O,k)=>(k.match&&k.match.id&&(O[k.match.id]=k.id),O),{});const L=A==null?void 0:A.map(O=>{var k;return{name:O,color:(k=R[0])==null?void 0:k[`${O}Color`],defs:v}});return m.jsx(wt,{gap:16,className:"gf-full",justify:"center",wrap:!0,children:L.map((O,k)=>m.jsxs(wt,{gap:8,align:"center",children:[m.jsx("div",{style:{minWidth:16,minHeight:16,backgroundColor:O.color}}),m.jsx(B6e,{children:O.name})]},`legend-${k}`))})},E=R=>{var O;let A=null,L=0;return(O=R==null?void 0:R.bars)==null||O.forEach(k=>{var P,T;((P=k==null?void 0:k.data)==null?void 0:P.id)!==A&&A!==null||(A=(T=k==null?void 0:k.data)==null?void 0:T.id,k.x>L&&(L=k.x))}),m.jsx("g",{children:m.jsx("line",{x1:L,y1:0,x2:L,y2:(R==null?void 0:R.height)-40+5,stroke:"black",strokeWidth:3})})},V=e.slice().reverse();return h.push("bars"),s&&h.push(H),p&&h.push(E),m.jsxs(m.Fragment,{children:[m.jsx(vn,{}),m.jsxs(wt,{vertical:!0,gap:8,style:{width:"100%"},children:[m.jsx("div",{style:{height:t},children:m.jsx(kl,{data:V,colors:({id:R,data:A})=>String(A[`${R}Color`]),defs:v,fill:g,keys:i,indexBy:o,margin:{top:-10,right:0,bottom:50,left:140,...n},layout:"horizontal",enableGridY:b,enableGridX:C,padding:r,enableLabel:!1,axisBottom:{tickSize:5,legendPosition:"middle",legendOffset:40,...d},axisTop:f,axisLeft:null,layers:[...h,w],tooltip:R=>m.jsx(Yn,{body:(a==null?void 0:a(R))||m.jsx("span",{children:"Tooltip"})})})}),m.jsx(_,{data:e,keys:i})]})]})};function Na(){return Na=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Na.apply(this,arguments)}var K6e={pointerEvents:"none",position:"absolute",zIndex:10,top:0,left:0},hb=function(e,t){return"translate("+e+"px, "+t+"px)"},w_=M.memo(function(e){var t,n=e.position,r=e.anchor,i=e.children,o=Un(),a=gi(),s=a.animate,l=a.config,c=__(),u=c[0],d=c[1],f=M.useRef(!1),h=void 0,p=!1,v=d.width>0&&d.height>0,g=Math.round(n[0]),b=Math.round(n[1]);v&&(r==="top"?(g-=d.width/2,b-=d.height+14):r==="right"?(g+=14,b-=d.height/2):r==="bottom"?(g-=d.width/2,b+=14):r==="left"?(g-=d.width+14,b-=d.height/2):r==="center"&&(g-=d.width/2,b-=d.height/2),h={transform:hb(g,b)},f.current||(p=!0),f.current=[g,b]);var C=nn({to:h,config:l,immediate:!s||p}),x=Na({},K6e,o.tooltip.wrapper,{transform:(t=C.transform)!=null?t:hb(g,b),opacity:C.transform?1:0});return m.jsx(dt.div,{ref:u,style:x,children:i})});w_.displayName="TooltipWrapper";var U6e=M.memo(function(e){var t=e.size,n=t===void 0?12:t,r=e.color,i=e.style;return m.jsx("span",{style:Na({display:"block",width:n,height:n,background:r},i===void 0?{}:i)})}),q6e=M.memo(function(e){var t,n=e.id,r=e.value,i=e.format,o=e.enableChip,a=o!==void 0&&o,s=e.color,l=e.renderContent,c=Un(),u=V_(i);if(typeof l=="function")t=l();else{var d=r;u!==void 0&&d!==void 0&&(d=u(d)),t=m.jsxs("div",{style:c.tooltip.basic,children:[a&&m.jsx(U6e,{color:s,style:c.tooltip.chip}),d!==void 0?m.jsxs("span",{children:[n,": ",m.jsx("strong",{children:""+d})]}):n]})}return m.jsx("div",{style:c.tooltip.container,children:t})}),G6e={width:"100%",borderCollapse:"collapse"},Y6e=M.memo(function(e){var t,n=e.title,r=e.rows,i=r===void 0?[]:r,o=e.renderContent,a=Un();return i.length?(t=typeof o=="function"?o():m.jsxs("div",{children:[n&&n,m.jsx("table",{style:Na({},G6e,a.tooltip.table),children:m.jsx("tbody",{children:i.map(function(s,l){return m.jsx("tr",{children:s.map(function(c,u){return m.jsx("td",{style:a.tooltip.tableCell,children:c},u)})},l)})})})]}),m.jsx("div",{style:a.tooltip.container,children:t})):null});Y6e.displayName="TableTooltip";var y5=M.memo(function(e){var t=e.x0,n=e.x1,r=e.y0,i=e.y1,o=Un(),a=gi(),s=a.animate,l=a.config,c=M.useMemo(function(){return Na({},o.crosshair.line,{pointerEvents:"none"})},[o.crosshair.line]),u=nn({x1:t,x2:n,y1:r,y2:i,config:l,immediate:!s});return m.jsx(dt.line,Na({},u,{fill:"none",style:c}))});y5.displayName="CrosshairLine";var X6e=M.memo(function(e){var t,n,r=e.width,i=e.height,o=e.type,a=e.x,s=e.y;return o==="cross"?(t={x0:a,x1:a,y0:0,y1:i},n={x0:0,x1:r,y0:s,y1:s}):o==="top-left"?(t={x0:a,x1:a,y0:0,y1:s},n={x0:0,x1:a,y0:s,y1:s}):o==="top"?t={x0:a,x1:a,y0:0,y1:s}:o==="top-right"?(t={x0:a,x1:a,y0:0,y1:s},n={x0:a,x1:r,y0:s,y1:s}):o==="right"?n={x0:a,x1:r,y0:s,y1:s}:o==="bottom-right"?(t={x0:a,x1:a,y0:s,y1:i},n={x0:a,x1:r,y0:s,y1:s}):o==="bottom"?t={x0:a,x1:a,y0:s,y1:i}:o==="bottom-left"?(t={x0:a,x1:a,y0:s,y1:i},n={x0:0,x1:a,y0:s,y1:s}):o==="left"?n={x0:0,x1:a,y0:s,y1:s}:o==="x"?t={x0:a,x1:a,y0:0,y1:i}:o==="y"&&(n={x0:0,x1:r,y0:s,y1:s}),m.jsxs(m.Fragment,{children:[t&&m.jsx(y5,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1}),n&&m.jsx(y5,{x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1})]})});X6e.displayName="Crosshair";var S_=M.createContext({showTooltipAt:function(){},showTooltipFromEvent:function(){},hideTooltip:function(){}}),C5={isVisible:!1,position:[null,null],content:null,anchor:null},$_=M.createContext(C5),Q6e=function(e){var t=M.useState(C5),n=t[0],r=t[1],i=M.useCallback(function(s,l,c){var u=l[0],d=l[1];c===void 0&&(c="top"),r({isVisible:!0,position:[u,d],anchor:c,content:s})},[r]),o=M.useCallback(function(s,l,c){c===void 0&&(c="top");var u=e.current.getBoundingClientRect(),d=e.current.offsetWidth,f=d===u.width?1:d/u.width,h="touches"in l?l.touches[0]:l,p=h.clientX,v=h.clientY,g=(p-u.left)*f,b=(v-u.top)*f;c!=="left"&&c!=="right"||(c=g<u.width/2?"right":"left"),r({isVisible:!0,position:[g,b],anchor:c,content:s})},[e,r]),a=M.useCallback(function(){r(C5)},[r]);return{actions:M.useMemo(function(){return{showTooltipAt:i,showTooltipFromEvent:o,hideTooltip:a}},[i,o,a]),state:n}},J6e=function(){var e=M.useContext(S_);if(e===void 0)throw new Error("useTooltip must be used within a TooltipProvider");return e},ege=function(){var e=M.useContext($_);if(e===void 0)throw new Error("useTooltipState must be used within a TooltipProvider");return e},tge=function(e){return e.isVisible},nge=function(){var e=ege();return tge(e)?m.jsx(w_,{position:e.position,anchor:e.anchor,children:e.content}):null},rge=function(e){var t=e.container,n=e.children,r=Q6e(t),i=r.actions,o=r.state;return m.jsx(S_.Provider,{value:i,children:m.jsx($_.Provider,{value:o,children:n})})},ige={background:"transparent",text:{fontFamily:"sans-serif",fontSize:11,fill:"#333333",outlineWidth:0,outlineColor:"transparent",outlineOpacity:1},axis:{domain:{line:{stroke:"transparent",strokeWidth:1}},ticks:{line:{stroke:"#777777",strokeWidth:1},text:{}},legend:{text:{fontSize:12}}},grid:{line:{stroke:"#dddddd",strokeWidth:1}},legends:{hidden:{symbol:{fill:"#333333",opacity:.6},text:{fill:"#333333",opacity:.6}},text:{},ticks:{line:{stroke:"#777777",strokeWidth:1},text:{fontSize:10}},title:{text:{}}},labels:{text:{}},markers:{lineColor:"#000000",lineStrokeWidth:1,text:{}},dots:{text:{}},tooltip:{container:{background:"white",color:"inherit",fontSize:"inherit",borderRadius:"2px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.25)",padding:"5px 9px"},basic:{whiteSpace:"pre",display:"flex",alignItems:"center"},chip:{marginRight:7},table:{},tableCell:{padding:"3px 5px"},tableCellValue:{fontWeight:"bold"}},crosshair:{line:{stroke:"#000000",strokeWidth:1,strokeOpacity:.75,strokeDasharray:"6 6"}},annotations:{text:{fontSize:13,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},link:{stroke:"#000000",strokeWidth:1,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},outline:{fill:"none",stroke:"#000000",strokeWidth:2,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},symbol:{fill:"#000000",outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1}}};function Ko(){return Ko=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ko.apply(this,arguments)}function vv(e,t){if(e==null)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}var oge=["axis.ticks.text","axis.legend.text","legends.title.text","legends.text","legends.ticks.text","legends.title.text","labels.text","dots.text","markers.text","annotations.text"],age=function(e,t){return Ko({},t,e)},sge=function(e,t){var n=l6({},e,t);return oge.forEach(function(r){ii(n,r,age(xn(n,r),n.text))}),n},M_=M.createContext(),E_=function(e){var t=e.children,n=e.animate,r=n===void 0||n,i=e.config,o=i===void 0?"default":i,a=M.useMemo(function(){var s=jf(o)?Za[o]:o;return{animate:r,config:s}},[r,o]);return m.jsx(M_.Provider,{value:a,children:t})},Dd={animate:F.bool,motionConfig:F.oneOfType([F.oneOf(Object.keys(Za)),F.shape({mass:F.number,tension:F.number,friction:F.number,clamp:F.bool,precision:F.number,velocity:F.number,duration:F.number,easing:F.func})])};E_.propTypes={children:F.node.isRequired,animate:Dd.animate,config:Dd.motionConfig};var gi=function(){return M.useContext(M_)},lge=function(e){var t=gi(),n=t.animate,r=t.config,i=function(s){var l=M.useRef();return M.useEffect(function(){l.current=s},[s]),l.current}(e),o=M.useMemo(function(){return Pf(i,e)},[i,e]),a=nn({from:{value:0},to:{value:1},reset:!0,config:r,immediate:!n}).value;return Rn(a,o)},cge={nivo:["#d76445","#f47560","#e8c1a0","#97e3d5","#61cdbb","#00b0a7"],BrBG:pe(Ti),PRGn:pe(Ri),PiYG:pe(ki),PuOr:pe(Li),RdBu:pe(Pi),RdGy:pe(ji),RdYlBu:pe(Ii),RdYlGn:pe(Ai),spectral:pe(Ni),blues:pe(Qi),greens:pe(Ji),greys:pe(eo),oranges:pe(ro),purples:pe(to),reds:pe(no),BuGn:pe(Di),BuPu:pe(Fi),GnBu:pe(zi),OrRd:pe(Bi),PuBuGn:pe(Wi),PuBu:pe(Zi),PuRd:pe(Ki),RdPu:pe(Ui),YlGnBu:pe(qi),YlGn:pe(Gi),YlOrBr:pe(Yi),YlOrRd:pe(Xi)},uge=Object.keys(cge);pe(Ti),pe(Ri),pe(ki),pe(Li),pe(Pi),pe(ji),pe(Ii),pe(Ai),pe(Ni),pe(Qi),pe(Ji),pe(eo),pe(ro),pe(to),pe(no),pe(Di),pe(Fi),pe(zi),pe(Bi),pe(Wi),pe(Zi),pe(Ki),pe(Ui),pe(qi),pe(Gi),pe(Yi),pe(Xi);F.oneOfType([F.oneOf(uge),F.func,F.arrayOf(F.string)]);var dge={basis:pg,basisClosed:mg,basisOpen:bg,bundle:yg,cardinal:xg,cardinalClosed:Sg,cardinalOpen:Mg,catmullRom:_g,catmullRomClosed:Hg,catmullRomOpen:Vg,linear:Pu,linearClosed:Og,monotoneX:ju,monotoneY:Wf,natural:Tg,step:Rg,stepAfter:Lg,stepBefore:kg},pv=Object.keys(dge);pv.filter(function(e){return e.endsWith("Closed")});Vl(pv,"bundle","basisClosed","basisOpen","cardinalClosed","cardinalOpen","catmullRomClosed","catmullRomOpen","linearClosed");Vl(pv,"bundle","basisClosed","basisOpen","cardinalClosed","cardinalOpen","catmullRomClosed","catmullRomOpen","linearClosed");F.shape({top:F.number,right:F.number,bottom:F.number,left:F.number}).isRequired;var fge=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];F.oneOf(fge);Tr(Mo);var hge={top:0,right:0,bottom:0,left:0},gge=function(e,t,n){return n===void 0&&(n={}),M.useMemo(function(){var r=Ko({},hge,n);return{margin:r,innerWidth:e-r.left-r.right,innerHeight:t-r.top-r.bottom,outerWidth:e,outerHeight:t}},[e,t,n.top,n.right,n.bottom,n.left])},__=function(){var e=M.useRef(null),t=M.useState({left:0,top:0,width:0,height:0}),n=t[0],r=t[1],i=M.useState(function(){return typeof ResizeObserver>"u"?null:new ResizeObserver(function(o){var a=o[0];return r(a.contentRect)})})[0];return M.useEffect(function(){return e.current&&i!==null&&i.observe(e.current),function(){i!==null&&i.disconnect()}},[]),[e,n]},vge=function(e){return M.useMemo(function(){return sge(ige,e)},[e])},H_=function(e){return typeof e=="function"?e:typeof e=="string"?e.indexOf("time:")===0?Xa(e.slice("5")):qa(e):function(t){return""+t}},V_=function(e){return M.useMemo(function(){return H_(e)},[e])},O_=M.createContext(),pge={},T_=function(e){var t=e.theme,n=t===void 0?pge:t,r=e.children,i=vge(n);return m.jsx(O_.Provider,{value:i,children:r})};T_.propTypes={children:F.node.isRequired,theme:F.object};var Un=function(){return M.useContext(O_)},mge=["outlineWidth","outlineColor","outlineOpacity"],R_=function(e){return e.outlineWidth,e.outlineColor,e.outlineOpacity,vv(e,mge)},k_=function(e){var t=e.children,n=e.condition,r=e.wrapper;return n?M.cloneElement(r,{},t):t};k_.propTypes={children:F.node.isRequired,condition:F.bool.isRequired,wrapper:F.element.isRequired};var bge={position:"relative"},L_=function(e){var t=e.children,n=e.theme,r=e.renderWrapper,i=r===void 0||r,o=e.isInteractive,a=o===void 0||o,s=e.animate,l=e.motionConfig,c=M.useRef(null);return m.jsx(T_,{theme:n,children:m.jsx(E_,{animate:s,config:l,children:m.jsx(rge,{container:c,children:m.jsxs(k_,{condition:i,wrapper:m.jsx("div",{style:bge,ref:c}),children:[t,a&&m.jsx(nge,{})]})})})})};L_.propTypes={children:F.element.isRequired,isInteractive:F.bool,renderWrapper:F.bool,theme:F.object,animate:F.bool,motionConfig:F.oneOfType([F.string,Dd.motionConfig])};F.func.isRequired,F.bool,F.bool,F.object.isRequired,F.bool.isRequired,F.oneOfType([F.string,Dd.motionConfig]);var P_=function(e){var t=e.children,n=__(),r=n[0],i=n[1],o=i.width>0&&i.height>0;return m.jsx("div",{ref:r,style:{width:"100%",height:"100%"},children:o&&t({width:i.width,height:i.height})})};P_.propTypes={children:F.func.isRequired};var yge=["id","colors"],j_=function(e){var t=e.id,n=e.colors,r=vv(e,yge);return m.jsx("linearGradient",Ko({id:t,x1:0,x2:0,y1:0,y2:1},r,{children:n.map(function(i){var o=i.offset,a=i.color,s=i.opacity;return m.jsx("stop",{offset:o+"%",stopColor:a,stopOpacity:s!==void 0?s:1},o)})}))};j_.propTypes={id:F.string.isRequired,colors:F.arrayOf(F.shape({offset:F.number.isRequired,color:F.string.isRequired,opacity:F.number})).isRequired,gradientTransform:F.string};var Cge={linearGradient:j_},lc={color:"#000000",background:"#ffffff",size:4,padding:4,stagger:!1},x5=M.memo(function(e){var t=e.id,n=e.background,r=n===void 0?lc.background:n,i=e.color,o=i===void 0?lc.color:i,a=e.size,s=a===void 0?lc.size:a,l=e.padding,c=l===void 0?lc.padding:l,u=e.stagger,d=u===void 0?lc.stagger:u,f=s+c,h=s/2,p=c/2;return d===!0&&(f=2*s+2*c),m.jsxs("pattern",{id:t,width:f,height:f,patternUnits:"userSpaceOnUse",children:[m.jsx("rect",{width:f,height:f,fill:r}),m.jsx("circle",{cx:p+h,cy:p+h,r:h,fill:o}),d&&m.jsx("circle",{cx:1.5*c+s+h,cy:1.5*c+s+h,r:h,fill:o})]})});x5.displayName="PatternDots",x5.propTypes={id:F.string.isRequired,color:F.string.isRequired,background:F.string.isRequired,size:F.number.isRequired,padding:F.number.isRequired,stagger:F.bool.isRequired};var w5=function(e){return e*Math.PI/180},xge=function(e){return 180*e/Math.PI},wge=function(e,t){return{x:Math.cos(e)*t,y:Math.sin(e)*t}},Sge=function(e){var t=e%360;return t<0&&(t+=360),t},$ge={svg:{align:{left:"start",center:"middle",right:"end",start:"start",middle:"middle",end:"end"},baseline:{top:"text-before-edge",center:"central",bottom:"alphabetic"}},canvas:{align:{left:"left",center:"center",right:"right",start:"left",middle:"center",end:"right"},baseline:{top:"top",center:"middle",bottom:"bottom"}}},cc={spacing:5,rotation:0,background:"#000000",color:"#ffffff",lineWidth:2},S5=M.memo(function(e){var t=e.id,n=e.spacing,r=n===void 0?cc.spacing:n,i=e.rotation,o=i===void 0?cc.rotation:i,a=e.background,s=a===void 0?cc.background:a,l=e.color,c=l===void 0?cc.color:l,u=e.lineWidth,d=u===void 0?cc.lineWidth:u,f=Math.round(o)%360,h=Math.abs(r);f>180?f-=360:f>90?f-=180:f<-180?f+=360:f<-90&&(f+=180);var p,v=h,g=h;return f===0?p=`
|
|
589
|
+
`,x_=(e,t=12)=>{const r=document.createElement("canvas").getContext("2d");return r.font=`${t}px Roboto, sans-serif`,r.measureText(e)},W6e=(e,t,n=12)=>{const r=e.split(" "),i=[];let o=r[0];for(let a=1;a<r.length;a++){const s=`${o} ${r[a]}`;x_(s,n).width>t?(i.push(o),o=r[a]):o=s}return i.push(o),i},Z6e=({data:e=[],height:t=600,margin:n={},padding:r=.5,keys:i=null,indexBy:o=null,tooltip:a=null,enableLabel:s=!1,label:l=null,keyLabelWidth:c=120,keyLabelPadding:u=20,axisBottom:d={},axisTop:f={},layers:h=["grid","axes"],zeroMarker:p=!1,defs:v=[],fill:g=[],enableGridY:b=!1,enableGridX:C=!1})=>{const x=({bar:R})=>{var j;const A=M.useRef(null),[L,O]=M.useState(0),k=((j=R==null?void 0:R.data)==null?void 0:j.indexValue)||"label",P=W6e(k,c,b5);M.useEffect(()=>{if(A.current){const N=A.current.getBoundingClientRect();O(N.height)}},[]);const T=c+u,I=R.y+R.height/2-L/2;return m.jsx("g",{ref:A,transform:`translate(-${T}, ${I})`,children:m.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:P.map((N,z)=>m.jsx(fb,{x:0,dy:z>0?gv:b5,children:N},z))})})};let S=null;const w=({bars:R})=>R.map((A,L)=>{var O;if(name=(O=A==null?void 0:A.data)==null?void 0:O.id,!(name!==S&&S!==null))return S=name,m.jsx(x,{bar:A},`bar-label-${L}`)}),$=({bar:R})=>{const L=l==null?void 0:l(R.data),O=x_(L,10),k=O.actualBoundingBoxRight+O.actualBoundingBoxLeft,P=O.actualBoundingBoxAscent+O.actualBoundingBoxDescent;if(k>=R.width)return m.jsx(m.Fragment,{});const T=R.x+R.width/2-k/2,I=R.y+R.height/2+P/2;return m.jsx("g",{transform:`translate(${T}, ${I})`,children:m.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:m.jsx(fb,{style:{fontSize:10},children:L||"label"})})})},H=({bars:R})=>R.map((A,L)=>m.jsx($,{bar:A},`bar-inner-label-${L}`)),_=({data:R,keys:A})=>{v.reduce((O,k)=>(O[k.id]={...k},delete O[k.id].id,O),{}),g.reduce((O,k)=>(k.match&&k.match.id&&(O[k.match.id]=k.id),O),{});const L=A==null?void 0:A.map(O=>{var k;return{name:O,color:(k=R[0])==null?void 0:k[`${O}Color`],defs:v}});return m.jsx(wt,{gap:16,className:"gf-full",justify:"center",wrap:!0,children:L.map((O,k)=>m.jsxs(wt,{gap:8,align:"center",children:[m.jsx("div",{style:{minWidth:16,minHeight:16,backgroundColor:O.color}}),m.jsx(B6e,{children:O.name})]},`legend-${k}`))})},E=R=>{var O;let A=null,L=0;return(O=R==null?void 0:R.bars)==null||O.forEach(k=>{var P,T;((P=k==null?void 0:k.data)==null?void 0:P.id)!==A&&A!==null||(A=(T=k==null?void 0:k.data)==null?void 0:T.id,k.x>L&&(L=k.x))}),m.jsx("g",{children:m.jsx("line",{x1:L,y1:0,x2:L,y2:(R==null?void 0:R.height)-40+5,stroke:"black",strokeWidth:3})})},V=e.slice().reverse();return h.push("bars"),s&&h.push(H),p&&h.push(E),m.jsxs(m.Fragment,{children:[m.jsx(vn,{}),m.jsxs(wt,{vertical:!0,gap:8,style:{width:"100%"},children:[m.jsx("div",{style:{height:t},children:m.jsx(kl,{data:V,colors:({id:R,data:A})=>String(A[`${R}Color`]),defs:v,fill:g,keys:i,indexBy:o,margin:{top:-10,right:0,bottom:50,left:140,...n},layout:"horizontal",enableGridY:b,enableGridX:C,padding:r,enableLabel:!1,axisBottom:{tickSize:5,tickValues:5,legendPosition:"middle",legendOffset:40,...d},axisTop:f,axisLeft:null,layers:[...h,w],tooltip:R=>m.jsx(Yn,{body:(a==null?void 0:a(R))||m.jsx("span",{children:"Tooltip"})}),theme:{axis:{domain:{line:{stroke:"#000",strokeWidth:1}}}}})}),m.jsx(_,{data:e,keys:i})]})]})};function Na(){return Na=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Na.apply(this,arguments)}var K6e={pointerEvents:"none",position:"absolute",zIndex:10,top:0,left:0},hb=function(e,t){return"translate("+e+"px, "+t+"px)"},w_=M.memo(function(e){var t,n=e.position,r=e.anchor,i=e.children,o=Un(),a=gi(),s=a.animate,l=a.config,c=__(),u=c[0],d=c[1],f=M.useRef(!1),h=void 0,p=!1,v=d.width>0&&d.height>0,g=Math.round(n[0]),b=Math.round(n[1]);v&&(r==="top"?(g-=d.width/2,b-=d.height+14):r==="right"?(g+=14,b-=d.height/2):r==="bottom"?(g-=d.width/2,b+=14):r==="left"?(g-=d.width+14,b-=d.height/2):r==="center"&&(g-=d.width/2,b-=d.height/2),h={transform:hb(g,b)},f.current||(p=!0),f.current=[g,b]);var C=nn({to:h,config:l,immediate:!s||p}),x=Na({},K6e,o.tooltip.wrapper,{transform:(t=C.transform)!=null?t:hb(g,b),opacity:C.transform?1:0});return m.jsx(dt.div,{ref:u,style:x,children:i})});w_.displayName="TooltipWrapper";var U6e=M.memo(function(e){var t=e.size,n=t===void 0?12:t,r=e.color,i=e.style;return m.jsx("span",{style:Na({display:"block",width:n,height:n,background:r},i===void 0?{}:i)})}),q6e=M.memo(function(e){var t,n=e.id,r=e.value,i=e.format,o=e.enableChip,a=o!==void 0&&o,s=e.color,l=e.renderContent,c=Un(),u=V_(i);if(typeof l=="function")t=l();else{var d=r;u!==void 0&&d!==void 0&&(d=u(d)),t=m.jsxs("div",{style:c.tooltip.basic,children:[a&&m.jsx(U6e,{color:s,style:c.tooltip.chip}),d!==void 0?m.jsxs("span",{children:[n,": ",m.jsx("strong",{children:""+d})]}):n]})}return m.jsx("div",{style:c.tooltip.container,children:t})}),G6e={width:"100%",borderCollapse:"collapse"},Y6e=M.memo(function(e){var t,n=e.title,r=e.rows,i=r===void 0?[]:r,o=e.renderContent,a=Un();return i.length?(t=typeof o=="function"?o():m.jsxs("div",{children:[n&&n,m.jsx("table",{style:Na({},G6e,a.tooltip.table),children:m.jsx("tbody",{children:i.map(function(s,l){return m.jsx("tr",{children:s.map(function(c,u){return m.jsx("td",{style:a.tooltip.tableCell,children:c},u)})},l)})})})]}),m.jsx("div",{style:a.tooltip.container,children:t})):null});Y6e.displayName="TableTooltip";var y5=M.memo(function(e){var t=e.x0,n=e.x1,r=e.y0,i=e.y1,o=Un(),a=gi(),s=a.animate,l=a.config,c=M.useMemo(function(){return Na({},o.crosshair.line,{pointerEvents:"none"})},[o.crosshair.line]),u=nn({x1:t,x2:n,y1:r,y2:i,config:l,immediate:!s});return m.jsx(dt.line,Na({},u,{fill:"none",style:c}))});y5.displayName="CrosshairLine";var X6e=M.memo(function(e){var t,n,r=e.width,i=e.height,o=e.type,a=e.x,s=e.y;return o==="cross"?(t={x0:a,x1:a,y0:0,y1:i},n={x0:0,x1:r,y0:s,y1:s}):o==="top-left"?(t={x0:a,x1:a,y0:0,y1:s},n={x0:0,x1:a,y0:s,y1:s}):o==="top"?t={x0:a,x1:a,y0:0,y1:s}:o==="top-right"?(t={x0:a,x1:a,y0:0,y1:s},n={x0:a,x1:r,y0:s,y1:s}):o==="right"?n={x0:a,x1:r,y0:s,y1:s}:o==="bottom-right"?(t={x0:a,x1:a,y0:s,y1:i},n={x0:a,x1:r,y0:s,y1:s}):o==="bottom"?t={x0:a,x1:a,y0:s,y1:i}:o==="bottom-left"?(t={x0:a,x1:a,y0:s,y1:i},n={x0:0,x1:a,y0:s,y1:s}):o==="left"?n={x0:0,x1:a,y0:s,y1:s}:o==="x"?t={x0:a,x1:a,y0:0,y1:i}:o==="y"&&(n={x0:0,x1:r,y0:s,y1:s}),m.jsxs(m.Fragment,{children:[t&&m.jsx(y5,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1}),n&&m.jsx(y5,{x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1})]})});X6e.displayName="Crosshair";var S_=M.createContext({showTooltipAt:function(){},showTooltipFromEvent:function(){},hideTooltip:function(){}}),C5={isVisible:!1,position:[null,null],content:null,anchor:null},$_=M.createContext(C5),Q6e=function(e){var t=M.useState(C5),n=t[0],r=t[1],i=M.useCallback(function(s,l,c){var u=l[0],d=l[1];c===void 0&&(c="top"),r({isVisible:!0,position:[u,d],anchor:c,content:s})},[r]),o=M.useCallback(function(s,l,c){c===void 0&&(c="top");var u=e.current.getBoundingClientRect(),d=e.current.offsetWidth,f=d===u.width?1:d/u.width,h="touches"in l?l.touches[0]:l,p=h.clientX,v=h.clientY,g=(p-u.left)*f,b=(v-u.top)*f;c!=="left"&&c!=="right"||(c=g<u.width/2?"right":"left"),r({isVisible:!0,position:[g,b],anchor:c,content:s})},[e,r]),a=M.useCallback(function(){r(C5)},[r]);return{actions:M.useMemo(function(){return{showTooltipAt:i,showTooltipFromEvent:o,hideTooltip:a}},[i,o,a]),state:n}},J6e=function(){var e=M.useContext(S_);if(e===void 0)throw new Error("useTooltip must be used within a TooltipProvider");return e},ege=function(){var e=M.useContext($_);if(e===void 0)throw new Error("useTooltipState must be used within a TooltipProvider");return e},tge=function(e){return e.isVisible},nge=function(){var e=ege();return tge(e)?m.jsx(w_,{position:e.position,anchor:e.anchor,children:e.content}):null},rge=function(e){var t=e.container,n=e.children,r=Q6e(t),i=r.actions,o=r.state;return m.jsx(S_.Provider,{value:i,children:m.jsx($_.Provider,{value:o,children:n})})},ige={background:"transparent",text:{fontFamily:"sans-serif",fontSize:11,fill:"#333333",outlineWidth:0,outlineColor:"transparent",outlineOpacity:1},axis:{domain:{line:{stroke:"transparent",strokeWidth:1}},ticks:{line:{stroke:"#777777",strokeWidth:1},text:{}},legend:{text:{fontSize:12}}},grid:{line:{stroke:"#dddddd",strokeWidth:1}},legends:{hidden:{symbol:{fill:"#333333",opacity:.6},text:{fill:"#333333",opacity:.6}},text:{},ticks:{line:{stroke:"#777777",strokeWidth:1},text:{fontSize:10}},title:{text:{}}},labels:{text:{}},markers:{lineColor:"#000000",lineStrokeWidth:1,text:{}},dots:{text:{}},tooltip:{container:{background:"white",color:"inherit",fontSize:"inherit",borderRadius:"2px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.25)",padding:"5px 9px"},basic:{whiteSpace:"pre",display:"flex",alignItems:"center"},chip:{marginRight:7},table:{},tableCell:{padding:"3px 5px"},tableCellValue:{fontWeight:"bold"}},crosshair:{line:{stroke:"#000000",strokeWidth:1,strokeOpacity:.75,strokeDasharray:"6 6"}},annotations:{text:{fontSize:13,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},link:{stroke:"#000000",strokeWidth:1,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},outline:{fill:"none",stroke:"#000000",strokeWidth:2,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},symbol:{fill:"#000000",outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1}}};function Ko(){return Ko=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ko.apply(this,arguments)}function vv(e,t){if(e==null)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}var oge=["axis.ticks.text","axis.legend.text","legends.title.text","legends.text","legends.ticks.text","legends.title.text","labels.text","dots.text","markers.text","annotations.text"],age=function(e,t){return Ko({},t,e)},sge=function(e,t){var n=l6({},e,t);return oge.forEach(function(r){ii(n,r,age(xn(n,r),n.text))}),n},M_=M.createContext(),E_=function(e){var t=e.children,n=e.animate,r=n===void 0||n,i=e.config,o=i===void 0?"default":i,a=M.useMemo(function(){var s=jf(o)?Za[o]:o;return{animate:r,config:s}},[r,o]);return m.jsx(M_.Provider,{value:a,children:t})},Dd={animate:F.bool,motionConfig:F.oneOfType([F.oneOf(Object.keys(Za)),F.shape({mass:F.number,tension:F.number,friction:F.number,clamp:F.bool,precision:F.number,velocity:F.number,duration:F.number,easing:F.func})])};E_.propTypes={children:F.node.isRequired,animate:Dd.animate,config:Dd.motionConfig};var gi=function(){return M.useContext(M_)},lge=function(e){var t=gi(),n=t.animate,r=t.config,i=function(s){var l=M.useRef();return M.useEffect(function(){l.current=s},[s]),l.current}(e),o=M.useMemo(function(){return Pf(i,e)},[i,e]),a=nn({from:{value:0},to:{value:1},reset:!0,config:r,immediate:!n}).value;return Rn(a,o)},cge={nivo:["#d76445","#f47560","#e8c1a0","#97e3d5","#61cdbb","#00b0a7"],BrBG:pe(Ti),PRGn:pe(Ri),PiYG:pe(ki),PuOr:pe(Li),RdBu:pe(Pi),RdGy:pe(ji),RdYlBu:pe(Ii),RdYlGn:pe(Ai),spectral:pe(Ni),blues:pe(Qi),greens:pe(Ji),greys:pe(eo),oranges:pe(ro),purples:pe(to),reds:pe(no),BuGn:pe(Di),BuPu:pe(Fi),GnBu:pe(zi),OrRd:pe(Bi),PuBuGn:pe(Wi),PuBu:pe(Zi),PuRd:pe(Ki),RdPu:pe(Ui),YlGnBu:pe(qi),YlGn:pe(Gi),YlOrBr:pe(Yi),YlOrRd:pe(Xi)},uge=Object.keys(cge);pe(Ti),pe(Ri),pe(ki),pe(Li),pe(Pi),pe(ji),pe(Ii),pe(Ai),pe(Ni),pe(Qi),pe(Ji),pe(eo),pe(ro),pe(to),pe(no),pe(Di),pe(Fi),pe(zi),pe(Bi),pe(Wi),pe(Zi),pe(Ki),pe(Ui),pe(qi),pe(Gi),pe(Yi),pe(Xi);F.oneOfType([F.oneOf(uge),F.func,F.arrayOf(F.string)]);var dge={basis:pg,basisClosed:mg,basisOpen:bg,bundle:yg,cardinal:xg,cardinalClosed:Sg,cardinalOpen:Mg,catmullRom:_g,catmullRomClosed:Hg,catmullRomOpen:Vg,linear:Pu,linearClosed:Og,monotoneX:ju,monotoneY:Wf,natural:Tg,step:Rg,stepAfter:Lg,stepBefore:kg},pv=Object.keys(dge);pv.filter(function(e){return e.endsWith("Closed")});Vl(pv,"bundle","basisClosed","basisOpen","cardinalClosed","cardinalOpen","catmullRomClosed","catmullRomOpen","linearClosed");Vl(pv,"bundle","basisClosed","basisOpen","cardinalClosed","cardinalOpen","catmullRomClosed","catmullRomOpen","linearClosed");F.shape({top:F.number,right:F.number,bottom:F.number,left:F.number}).isRequired;var fge=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"];F.oneOf(fge);Tr(Mo);var hge={top:0,right:0,bottom:0,left:0},gge=function(e,t,n){return n===void 0&&(n={}),M.useMemo(function(){var r=Ko({},hge,n);return{margin:r,innerWidth:e-r.left-r.right,innerHeight:t-r.top-r.bottom,outerWidth:e,outerHeight:t}},[e,t,n.top,n.right,n.bottom,n.left])},__=function(){var e=M.useRef(null),t=M.useState({left:0,top:0,width:0,height:0}),n=t[0],r=t[1],i=M.useState(function(){return typeof ResizeObserver>"u"?null:new ResizeObserver(function(o){var a=o[0];return r(a.contentRect)})})[0];return M.useEffect(function(){return e.current&&i!==null&&i.observe(e.current),function(){i!==null&&i.disconnect()}},[]),[e,n]},vge=function(e){return M.useMemo(function(){return sge(ige,e)},[e])},H_=function(e){return typeof e=="function"?e:typeof e=="string"?e.indexOf("time:")===0?Xa(e.slice("5")):qa(e):function(t){return""+t}},V_=function(e){return M.useMemo(function(){return H_(e)},[e])},O_=M.createContext(),pge={},T_=function(e){var t=e.theme,n=t===void 0?pge:t,r=e.children,i=vge(n);return m.jsx(O_.Provider,{value:i,children:r})};T_.propTypes={children:F.node.isRequired,theme:F.object};var Un=function(){return M.useContext(O_)},mge=["outlineWidth","outlineColor","outlineOpacity"],R_=function(e){return e.outlineWidth,e.outlineColor,e.outlineOpacity,vv(e,mge)},k_=function(e){var t=e.children,n=e.condition,r=e.wrapper;return n?M.cloneElement(r,{},t):t};k_.propTypes={children:F.node.isRequired,condition:F.bool.isRequired,wrapper:F.element.isRequired};var bge={position:"relative"},L_=function(e){var t=e.children,n=e.theme,r=e.renderWrapper,i=r===void 0||r,o=e.isInteractive,a=o===void 0||o,s=e.animate,l=e.motionConfig,c=M.useRef(null);return m.jsx(T_,{theme:n,children:m.jsx(E_,{animate:s,config:l,children:m.jsx(rge,{container:c,children:m.jsxs(k_,{condition:i,wrapper:m.jsx("div",{style:bge,ref:c}),children:[t,a&&m.jsx(nge,{})]})})})})};L_.propTypes={children:F.element.isRequired,isInteractive:F.bool,renderWrapper:F.bool,theme:F.object,animate:F.bool,motionConfig:F.oneOfType([F.string,Dd.motionConfig])};F.func.isRequired,F.bool,F.bool,F.object.isRequired,F.bool.isRequired,F.oneOfType([F.string,Dd.motionConfig]);var P_=function(e){var t=e.children,n=__(),r=n[0],i=n[1],o=i.width>0&&i.height>0;return m.jsx("div",{ref:r,style:{width:"100%",height:"100%"},children:o&&t({width:i.width,height:i.height})})};P_.propTypes={children:F.func.isRequired};var yge=["id","colors"],j_=function(e){var t=e.id,n=e.colors,r=vv(e,yge);return m.jsx("linearGradient",Ko({id:t,x1:0,x2:0,y1:0,y2:1},r,{children:n.map(function(i){var o=i.offset,a=i.color,s=i.opacity;return m.jsx("stop",{offset:o+"%",stopColor:a,stopOpacity:s!==void 0?s:1},o)})}))};j_.propTypes={id:F.string.isRequired,colors:F.arrayOf(F.shape({offset:F.number.isRequired,color:F.string.isRequired,opacity:F.number})).isRequired,gradientTransform:F.string};var Cge={linearGradient:j_},lc={color:"#000000",background:"#ffffff",size:4,padding:4,stagger:!1},x5=M.memo(function(e){var t=e.id,n=e.background,r=n===void 0?lc.background:n,i=e.color,o=i===void 0?lc.color:i,a=e.size,s=a===void 0?lc.size:a,l=e.padding,c=l===void 0?lc.padding:l,u=e.stagger,d=u===void 0?lc.stagger:u,f=s+c,h=s/2,p=c/2;return d===!0&&(f=2*s+2*c),m.jsxs("pattern",{id:t,width:f,height:f,patternUnits:"userSpaceOnUse",children:[m.jsx("rect",{width:f,height:f,fill:r}),m.jsx("circle",{cx:p+h,cy:p+h,r:h,fill:o}),d&&m.jsx("circle",{cx:1.5*c+s+h,cy:1.5*c+s+h,r:h,fill:o})]})});x5.displayName="PatternDots",x5.propTypes={id:F.string.isRequired,color:F.string.isRequired,background:F.string.isRequired,size:F.number.isRequired,padding:F.number.isRequired,stagger:F.bool.isRequired};var w5=function(e){return e*Math.PI/180},xge=function(e){return 180*e/Math.PI},wge=function(e,t){return{x:Math.cos(e)*t,y:Math.sin(e)*t}},Sge=function(e){var t=e%360;return t<0&&(t+=360),t},$ge={svg:{align:{left:"start",center:"middle",right:"end",start:"start",middle:"middle",end:"end"},baseline:{top:"text-before-edge",center:"central",bottom:"alphabetic"}},canvas:{align:{left:"left",center:"center",right:"right",start:"left",middle:"center",end:"right"},baseline:{top:"top",center:"middle",bottom:"bottom"}}},cc={spacing:5,rotation:0,background:"#000000",color:"#ffffff",lineWidth:2},S5=M.memo(function(e){var t=e.id,n=e.spacing,r=n===void 0?cc.spacing:n,i=e.rotation,o=i===void 0?cc.rotation:i,a=e.background,s=a===void 0?cc.background:a,l=e.color,c=l===void 0?cc.color:l,u=e.lineWidth,d=u===void 0?cc.lineWidth:u,f=Math.round(o)%360,h=Math.abs(r);f>180?f-=360:f>90?f-=180:f<-180?f+=360:f<-90&&(f+=180);var p,v=h,g=h;return f===0?p=`
|
|
590
590
|
M 0 0 L `+v+` 0
|
|
591
591
|
M 0 `+g+" L "+v+" "+g+`
|
|
592
592
|
`:f===90?p=`
|
|
@@ -635,7 +635,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
635
635
|
color: var(--gf-color-text-secondary);
|
|
636
636
|
font-size: 10px;
|
|
637
637
|
line-height: ${U_}px;
|
|
638
|
-
`,n7e=(e,t=12)=>{const r=document.createElement("canvas").getContext("2d");return r.font=`${t}px Roboto, sans-serif`,r.measureText(e)},r7e=({data:e,height:t=500,padding:n=.2,keys:r=[],indexBy:i="year",margin:o={},axisBottom:a={},axisLeft:s={},color:l={},tooltip:c=null,label:u=null})=>{const d=e==null?void 0:e.line,f=d==null?void 0:d.x1,h=d==null?void 0:d.y1,p=d==null?void 0:d.x2,v=d==null?void 0:d.y2,g=Math.max(h,v),b=({bar:S})=>{const $=(u==null?void 0:u(S.data))||m.jsx(m.Fragment,{}),H=n7e($,10),_=H.width,E=H.fontBoundingBoxAscent+H.fontBoundingBoxDescent;if(E>=S.height)return m.jsx(m.Fragment,{});const V=S.x+S.width/2-_/2,R=S.y+S.height/2+E/2;return m.jsx("g",{transform:`translate(${V}, ${R})`,children:m.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:m.jsx(e7e,{style:{fontSize:10},children:$})})})},C=({bars:S})=>S.map((w,$)=>m.jsx(b,{bar:w},`bar-inner-label-${$}`)),x=({data:S,keys:w})=>{const $=w==null?void 0:w.map(H=>({name:H,color:l[H]}));return m.jsx(wt,{gap:16,className:"gf-full",justify:"center",wrap:!0,children:$.map((H,_)=>m.jsxs(wt,{gap:8,align:"center",children:[m.jsx("div",{style:{minWidth:16,minHeight:16,backgroundColor:H.color}}),m.jsx(t7e,{children:H.name})]},`legend-${_}`))})};return m.jsxs(m.Fragment,{children:[m.jsx(vn,{}),m.jsxs(wt,{vertical:!0,gap:8,style:{width:"100%"},children:[m.jsx("div",{style:{height:t},children:m.jsx(kl,{data:e==null?void 0:e.data,keys:r,indexBy:i,colors:({id:S,data:w})=>l[S]||"orange",enableLabel:!1,yScale:{type:"linear",min:0,max:g,reverse:!1},margin:{left:50,bottom:50,top:10,right:50,...o},padding:n,axisBottom:{tickSize:5,legendPosition:"middle",legendOffset:40,...a},axisLeft:{tickSize:5,legendPosition:"middle",legendOffset:-40,...s},layers:["grid","axes","bars",C,S=>m.jsx(Qve,{x1:S.xScale(f),y1:S.yScale(h),x2:S.xScale(p)+S.xScale.bandwidth(),y2:S.yScale(v)})],tooltip:S=>m.jsx(Yn,{body:(c==null?void 0:c(S))||m.jsx("span",{children:"Tooltip"})})})}),m.jsx(x,{data:e,keys:r})]})]})},Sb={goodsRenewable:"#36CFC9",goodsNotRenewable:"#BDE7E3",goodsMixed:"#00474F",wasteRenewable:"#FFA940",wasteNotRenewable:"#EEDBBB",wasteMixed:"#873800"},t3={goodsRenewable:"Goederen - Hernieuwbare materialen",goodsNotRenewable:"Goederen - Niet-hernieuwbare materialen",goodsMixed:"Goederen - Gemengde materialen",wasteRenewable:"Afval - Hernieuwbare materialen",wasteNotRenewable:"Afval - Niet-hernieuwbare materialen",wasteMixed:"Afval - Gemengde materialen"},i7e=({data:e,height:t=400,colorMap:n=Sb,margin:r={},padding:i=.3,innerPadding:o=4,tooltip:a=null,axisBottom:s={},axisLeft:l={}})=>{const c=d=>d.bars.map((f,h)=>{const p=f.data.id,v=f.data.data,g=p==null?void 0:p.replace("Total",""),b=v==null?void 0:v[`${g}Total`],C=(v==null?void 0:v[`${g}Renewable`])||0,x=(v==null?void 0:v[`${g}NotRenewable`])||0,S=(v==null?void 0:v[`${g}Mixed`])||0,w=b?f.height*C/b:0,$=b?f.height*x/b:0,H=b?f.height*S/b:0;return m.jsxs("g",{children:[m.jsx("rect",{x:f.x,y:f.y+$+H,width:f.width,height:w,fill:n[`${g}Renewable`]}),m.jsx("rect",{x:f.x,y:f.y+H,width:f.width,height:$,fill:n[`${g}NotRenewable`]}),m.jsx("rect",{x:f.x,y:f.y,width:f.width,height:H,fill:n[`${g}Mixed`]})]},h)}),u=()=>m.jsx(wt,{justify:"center",gap:16,wrap:!0,children:Object.entries(Sb).map(([d,f],h)=>m.jsxs(wt,{align:"center",gap:8,children:[m.jsx("div",{style:{width:16,height:16,background:f}}),m.jsx("span",{style:{fontSize:12},children:t3==null?void 0:t3[d]})]},h))});return console.log(e),m.jsxs(wt,{vertical:!0,gap:8,children:[m.jsx("div",{style:{position:"relative",height:t,width:"100%",overflow:"visible"},children:m.jsx(kl,{data:e,keys:["goodsTotal","wasteTotal"],indexBy:"year",groupMode:"grouped",padding:i,innerPadding:o,enableLabel:!1,colors:d=>"rgba(0, 0, 0, 0)",margin:{top:50,right:0,bottom:50,left:60,...r},axisLeft:{legend:"Gewicht (Mt)",legendPosition:"middle",legendOffset:-40,...l},axisBottom:{legend:"Jaar",legendPosition:"middle",legendOffset:40,...s},layers:["axes","grid",c,"bars"],tooltip:d=>m.jsx(Yn,{body:(a==null?void 0:a(d))||m.jsx("span",{children:"Tooltip"})})})}),m.jsx(u,{})]})},o7e=St.span`
|
|
638
|
+
`,n7e=(e,t=12)=>{const r=document.createElement("canvas").getContext("2d");return r.font=`${t}px Roboto, sans-serif`,r.measureText(e)},r7e=({data:e,height:t=500,padding:n=.2,keys:r=[],indexBy:i="year",margin:o={},axisBottom:a={},axisLeft:s={},color:l={},tooltip:c=null,label:u=null})=>{const d=e==null?void 0:e.line,f=d==null?void 0:d.x1,h=d==null?void 0:d.y1,p=d==null?void 0:d.x2,v=d==null?void 0:d.y2,g=Math.max(h,v),b=({bar:S})=>{const $=(u==null?void 0:u(S.data))||m.jsx(m.Fragment,{}),H=n7e($,10),_=H.width,E=H.fontBoundingBoxAscent+H.fontBoundingBoxDescent;if(E>=S.height)return m.jsx(m.Fragment,{});const V=S.x+S.width/2-_/2,R=S.y+S.height/2+E/2;return m.jsx("g",{transform:`translate(${V}, ${R})`,children:m.jsx("text",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignmentBaseline:"middle"},children:m.jsx(e7e,{style:{fontSize:10},children:$})})})},C=({bars:S})=>S.map((w,$)=>m.jsx(b,{bar:w},`bar-inner-label-${$}`)),x=({data:S,keys:w})=>{const $=w==null?void 0:w.map(H=>({name:H,color:l[H]}));return m.jsx(wt,{gap:16,className:"gf-full",justify:"center",wrap:!0,children:$.map((H,_)=>m.jsxs(wt,{gap:8,align:"center",children:[m.jsx("div",{style:{minWidth:16,minHeight:16,backgroundColor:H.color}}),m.jsx(t7e,{children:H.name})]},`legend-${_}`))})};return m.jsxs(m.Fragment,{children:[m.jsx(vn,{}),m.jsxs(wt,{vertical:!0,gap:8,style:{width:"100%"},children:[m.jsx("div",{style:{height:t},children:m.jsx(kl,{data:e==null?void 0:e.data,keys:r,indexBy:i,colors:({id:S,data:w})=>l[S]||"orange",enableLabel:!1,yScale:{type:"linear",min:0,max:g,reverse:!1},margin:{left:50,bottom:50,top:10,right:50,...o},padding:n,axisBottom:{tickSize:5,legendPosition:"middle",legendOffset:40,...a},axisLeft:{tickSize:0,tickValues:5,legendPosition:"middle",legendOffset:-40,...s},gridYValues:5,layers:["grid","axes","bars",C,S=>m.jsx(Qve,{x1:S.xScale(f),y1:S.yScale(h),x2:S.xScale(p)+S.xScale.bandwidth(),y2:S.yScale(v)})],tooltip:S=>m.jsx(Yn,{body:(c==null?void 0:c(S))||m.jsx("span",{children:"Tooltip"})})})}),m.jsx(x,{data:e,keys:r})]})]})},Sb={goodsRenewable:"#36CFC9",goodsNotRenewable:"#BDE7E3",goodsMixed:"#00474F",wasteRenewable:"#FFA940",wasteNotRenewable:"#EEDBBB",wasteMixed:"#873800"},t3={goodsRenewable:"Goederen - Hernieuwbare materialen",goodsNotRenewable:"Goederen - Niet-hernieuwbare materialen",goodsMixed:"Goederen - Gemengde materialen",wasteRenewable:"Afval - Hernieuwbare materialen",wasteNotRenewable:"Afval - Niet-hernieuwbare materialen",wasteMixed:"Afval - Gemengde materialen"},i7e=({data:e,height:t=400,colorMap:n=Sb,margin:r={},padding:i=.3,innerPadding:o=4,tooltip:a=null,axisBottom:s={},axisLeft:l={}})=>{const c=d=>d.bars.map((f,h)=>{const p=f.data.id,v=f.data.data,g=p==null?void 0:p.replace("Total",""),b=v==null?void 0:v[`${g}Total`],C=(v==null?void 0:v[`${g}Renewable`])||0,x=(v==null?void 0:v[`${g}NotRenewable`])||0,S=(v==null?void 0:v[`${g}Mixed`])||0,w=b?f.height*C/b:0,$=b?f.height*x/b:0,H=b?f.height*S/b:0;return m.jsxs("g",{children:[m.jsx("rect",{x:f.x,y:f.y+$+H,width:f.width,height:w,fill:n[`${g}Renewable`]}),m.jsx("rect",{x:f.x,y:f.y+H,width:f.width,height:$,fill:n[`${g}NotRenewable`]}),m.jsx("rect",{x:f.x,y:f.y,width:f.width,height:H,fill:n[`${g}Mixed`]})]},h)}),u=()=>m.jsx(wt,{justify:"center",gap:16,wrap:!0,children:Object.entries(Sb).map(([d,f],h)=>m.jsxs(wt,{align:"center",gap:8,children:[m.jsx("div",{style:{width:16,height:16,background:f}}),m.jsx("span",{style:{fontSize:12},children:t3==null?void 0:t3[d]})]},h))});return console.log(e),m.jsxs(wt,{vertical:!0,gap:8,children:[m.jsx("div",{style:{position:"relative",height:t,width:"100%",overflow:"visible"},children:m.jsx(kl,{data:e,keys:["goodsTotal","wasteTotal"],indexBy:"year",groupMode:"grouped",padding:i,innerPadding:o,enableLabel:!1,colors:d=>"rgba(0, 0, 0, 0)",margin:{top:50,right:0,bottom:50,left:60,...r},axisLeft:{legend:"Gewicht (Mt)",legendPosition:"middle",legendOffset:-40,...l},axisBottom:{legend:"Jaar",legendPosition:"middle",legendOffset:40,...s},layers:["axes","grid",c,"bars"],tooltip:d=>m.jsx(Yn,{body:(a==null?void 0:a(d))||m.jsx("span",{children:"Tooltip"})})})}),m.jsx(u,{})]})},o7e=St.span`
|
|
639
639
|
font: var(--gf-label-md-default);
|
|
640
640
|
font-size: 14px;
|
|
641
641
|
line-height: 22px;
|