gf-components 0.1.177 → 0.1.178
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 +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +3 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -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;
|