@tmf_ciclica/ciclicastorybook 1.2.129 → 1.2.130

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 CHANGED
@@ -84,4 +84,4 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
84
84
  <strong>${E(ne.key)}</strong><br/>
85
85
  ${ne.xKey}<br/>
86
86
  ${b(xe)}
87
- `),ce.select(this).style("opacity",.8),f&&f(z,{key:ne.key,value:xe,data:ne.data})}).on("mousemove",function(z){C&&se&&se.style("top",z.pageY-10+"px").style("left",z.pageX+10+"px")}).on("mouseout",function(){C&&se&&se.style("visibility","hidden"),ce.select(this).style("opacity",1)}),x&&Ye.on("click",function(z,ne){const xe=ne.value;x(z,{key:ne.key,value:xe,data:ne.data})}),ee&&ee.length>1){const z=ce.line().x(ne=>ne.x).y(ne=>ne.y).curve(ce.curveMonotoneX);le.append("path").datum(ee).attr("class","line").attr("d",z).attr("fill","none").attr("stroke","#ff6b6b").attr("stroke-width",2).attr("stroke-linecap","round").attr("stroke-linejoin","round"),le.selectAll(".line-point").data(ee).enter().append("circle").attr("class","line-point").attr("cx",ne=>ne.x).attr("cy",ne=>ne.y).attr("r",4).attr("fill","#ff6b6b").attr("stroke","white").attr("stroke-width",1)}return()=>{se&&se.remove()}},[e,t,n,r,F,a,p,u,d,h,g,b,v,f,x,S,k,j,y,C,_,M]),c.jsx("div",{ref:q,className:`${ys.svgContainer} ${l}`,style:{width:o,height:i+a.top+a.bottom,overflowX:"auto"},children:c.jsx("svg",{ref:N,className:ys.svg})})};Vi.propTypes={data:s.arrayOf(s.object).isRequired,keys:s.arrayOf(s.string).isRequired,colors:s.oneOfType([s.arrayOf(s.string),s.object]),lineData:s.arrayOf(s.number),width:s.oneOfType([s.string,s.number]),height:s.number,margin:s.shape({top:s.number,right:s.number,bottom:s.number,left:s.number}),className:s.string,showXAxisLabels:s.bool,showYAxisLabels:s.bool,showGrid:s.bool,xAxisTickRotation:s.number,yAxisTickFormat:s.func,barPadding:s.number,animationDuration:s.number,onBarHover:s.func,onBarClick:s.func,title:s.string,xAxisLabel:s.string,yAxisLabel:s.string,stackOrder:s.oneOf(["reverse","ascending","descending","insideOut","none"]),showTooltip:s.bool,reverseKeys:s.bool,minBarSlotWidth:s.number,wrapXAxisLabels:s.bool};const jf="_externalContainer_1er0i_2",$f="_externalSintetic_1er0i_9",Ef="_titles_1er0i_13",Nf="_titleContainer_1er0i_22",Of="_yearTitles_1er0i_36",Af="_yearTitle_1er0i_36",Lf="_yearDatas_1er0i_50",Mf="_yearDataContainer_1er0i_58",Rf="_yearDataContent_1er0i_66",Df="_bigNumber_1er0i_79",If="_circle_1er0i_82",Pf="_totalContainer_1er0i_99",Bf="_total_1er0i_99",De={externalContainer:jf,externalSintetic:$f,titles:Ef,titleContainer:Nf,yearTitles:Of,yearTitle:Af,yearDatas:Lf,yearDataContainer:Mf,yearDataContent:Rf,bigNumber:Df,circle:If,totalContainer:Pf,total:Bf},Vf=e=>{if(e>=1e3||e<=-1e3)return parseInt(e.toFixed());if(e>=100||e<=-100)return parseFloat(e.toFixed(1));if(e>=10||e<=-10)return parseFloat(e.toFixed(2));if(e>0||e<0)return parseFloat(e.toFixed(3));if(e===0)return e},Ff=(e,t)=>{let n=0;return t.forEach(r=>{r[e]&&(n+=r[e])}),n},Fi=({data:e,keys:t,colors:n,locales:r,total:o=!1,years:i=!1,activeGraphics:a="ind",units:l={},translate:u,getTotal:d=Ff,columnWidth:h=50})=>{const g=u||(p=>p),b=p=>p==="demanda_red"||p==="reduccio_demanda_red"?(l.demanda||"").replace("(","").replace(")",""):l[p]||"";return c.jsxs("div",{className:`${De.externalContainer} ${a==="sin"?De.externalSintetic:""}`,children:[i===!0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{}),c.jsx("div",{className:De.yearTitles,children:e.map((p,v)=>c.jsx("div",{className:De.yearTitle,style:{width:h},children:p.anyo},v))})]}),c.jsx("div",{className:De.titles,children:t.map((p,v)=>c.jsxs("div",{className:De.titleContainer,children:[g(r[p]),a!=="sin"&&c.jsx("span",{className:De.circle,style:{background:n[p]}})]},v))}),o===!0&&c.jsx("div",{className:De.totalContainer,children:t.map((p,v)=>{var f;return c.jsxs("div",{className:`${De.total} ${d(p,e)>9999||d(p,e)<-9999?De.bigNumber:""}`,children:[(f=d(p,e))==null?void 0:f.toLocaleString("es-ES")," ",b(p)]},v)})}),c.jsx("div",{className:De.yearDatas,children:e.map((p,v)=>c.jsx("div",{className:De.yearDataContainer,style:{width:h},children:t.map((f,x)=>{var S,k;return isNaN(p[f])?null:c.jsx("div",{className:`${De.yearDataContent} ${p[f]>9999||p[f]<-9999?De.bigNumber:""}`,children:p[f]<1e4||p[f]>-1e4?(S=Vf(p[f]))==null?void 0:S.toLocaleString("es-ES"):(k=p[f])==null?void 0:k.toLocaleString("es-ES")},x)})},v))})]})};Fi.propTypes={data:s.arrayOf(s.shape({anyo:s.oneOfType([s.string,s.number]).isRequired})).isRequired,keys:s.arrayOf(s.string).isRequired,colors:s.objectOf(s.string).isRequired,locales:s.objectOf(s.string).isRequired,total:s.bool,years:s.bool,activeGraphics:s.oneOf(["ind","sin"]),units:s.objectOf(s.string),translate:s.func,getTotal:s.func,columnWidth:s.number};const zf="_speedGraphic_d1k72_2",xr={speedGraphic:zf},zi=({minValue:e=0,maxValue:t=100,value:n=50,title:r=!1,percent:o=!1,unit:i=!1,greenColor:a="#00CF1E",orangeColor:l="#FFAC00",redColor:u="#FF1E37"})=>{n<e&&(n=e),n>t&&(n=t);const d=(n-e)/(t-e),h=270+d*180,g=o?Math.round(d*100):n;return c.jsxs("div",{className:xr.speedGraphic,children:[c.jsxs("svg",{width:"244",height:"130",viewBox:"0 0 244 130",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M0 122C0 111.944 1.2433 101.927 3.70162 92.1756L26.2619 97.8633C24.2724 105.755 23.2662 113.862 23.2662 122H0Z",fill:a}),c.jsx("path",{d:"M16.3442 61.0012C21.3714 52.2936 27.4557 44.2409 34.4588 37.0263L51.1534 53.2313C45.4859 59.0701 40.5619 65.5871 36.4934 72.6341L16.3442 61.0012Z",fill:a}),c.jsx("path",{d:"M60.9088 16.3976C69.6119 11.3628 78.9041 7.42322 88.5739 4.66843L94.9485 27.0443C87.1228 29.2737 79.6027 32.462 72.5592 36.5367L60.9088 16.3976Z",fill:l}),c.jsx("path",{d:"M121.797 0.000169508C131.851 -0.0165912 141.869 1.20965 151.623 3.65101L145.974 26.2209C138.08 24.2451 129.972 23.2527 121.835 23.2663L121.797 0.000169508Z",fill:l}),c.jsx("path",{d:"M182.623 16.1279C191.348 21.124 199.422 27.1797 206.662 34.157L190.516 50.9092C184.657 45.2625 178.123 40.3617 171.061 36.3183L182.623 16.1279Z",fill:u}),c.jsx("path",{d:"M227.238 60.2836C232.325 68.9568 236.319 78.2255 239.131 87.8788L216.794 94.3859C214.518 86.5735 211.285 79.0725 207.169 72.0533L227.238 60.2836Z",fill:u}),c.jsx("path",{d:"M4.15505 90.4316C6.75674 80.7194 10.5491 71.3662 15.4458 62.5846L35.7663 73.9155C31.8035 81.0224 28.7343 88.5919 26.6288 96.4519L4.15505 90.4316Z",fill:a}),c.jsx("path",{d:"M35.733 35.733C42.8426 28.6233 50.8039 22.4198 59.4357 17.2636L71.3671 37.2375C64.3814 41.4104 57.9384 46.4308 52.1846 52.1846L35.733 35.733Z",fill:a}),c.jsx("path",{d:"M90.3004 4.19027C100.01 1.57776 110.005 0.175523 120.058 0.0154601L120.428 23.2787C112.292 23.4082 104.203 24.543 96.3457 26.6573L90.3004 4.19027Z",fill:l}),c.jsx("path",{d:"M153.423 4.11614C163.138 6.70584 172.496 10.4866 181.284 15.3725L169.978 35.707C162.866 31.7529 155.293 28.6932 147.43 26.5973L153.423 4.11614Z",fill:l}),c.jsx("path",{d:"M239.602 89.538C242.532 100.152 244.011 111.114 244 122.125L220.734 122.101C220.743 113.19 219.546 104.319 217.175 95.7287L239.602 89.538Z",fill:u}),c.jsx("path",{d:"M207.769 35.2376C214.919 42.3062 221.168 50.2316 226.374 58.8336L206.469 70.8798C202.256 63.9183 197.199 57.5043 191.412 51.7837L207.769 35.2376Z",fill:u}),c.jsx("g",{transform:`rotate(${h} 122 122)`,children:c.jsx("path",{id:"aguja",d:"M121 119.5V33",stroke:"#605B56","stroke-width":"2"})})]}),c.jsxs("div",{className:xr.value,children:[g,o&&"%",i&&i]}),r&&c.jsx("div",{className:xr.title,children:r})]})};zi.propTypes={minValue:s.number.isRequired,maxValue:s.number.isRequired,value:s.number.isRequired,percent:s.bool,title:s.string,unit:s.string,greenColor:s.string,orangeColor:s.string,redColor:s.string};const _r="#ffffff";function st(e,t,n,r){const o=(r-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}}function bs(e,t,n,r,o,i){const a=st(e,t,r,o),l=st(e,t,r,i),u=i-o>180?1:0;if(n===0)return`M ${e} ${t} L ${a.x} ${a.y} A ${r} ${r} 0 ${u} 1 ${l.x} ${l.y} Z`;const d=st(e,t,n,i),h=st(e,t,n,o);return[`M ${a.x} ${a.y}`,`A ${r} ${r} 0 ${u} 1 ${l.x} ${l.y}`,`L ${d.x} ${d.y}`,`A ${n} ${n} 0 ${u} 0 ${h.x} ${h.y}`,"Z"].join(" ")}function qf(e){const t=e.reduce((r,o)=>r+(o.value||0),0);let n=0;return e.map(r=>{const o=r.value/t*360,i=n;return n+=o,{...r,sa:i,ea:n}})}function vs(e,t,n,r,o){const i=n+(r-n)/2,a=st(e,t,o,i);return{tx:a.x-e,ty:a.y-t}}const eo=({type:e="cheese",data:t=[],title:n,size:r=260,donutThickness:o=56,gapWidth:i=3,backgroundColor:a="transparent",fontColor:l="black",fontColorInside:u="white",containerStyles:d={},alignLeft:h=!1})=>{const[g,b]=w.useState(null),p=r/2,v=r/2,f=r/2-14,x=e==="donut"?f-o:0,S=e==="donut"?f-o/2:f*.62,k=w.useMemo(()=>qf(t),[t]),j=g!==null?k[g]:null;return c.jsxs("div",{style:{display:"inline-flex",flexDirection:"column",gap:"4px",padding:"0",background:a,borderRadius:"16px",fontFamily:"'Segoe UI', sans-serif",...d},children:[c.jsxs("div",{style:{minHeight:"40px",display:"flex",flexDirection:"column",gap:"2px"},children:[n&&c.jsx("h2",{style:{margin:0,color:l,fontSize:"22px",fontWeight:"700",letterSpacing:"-0.5px"},children:n}),c.jsx("div",{style:{height:"22px",display:"flex",alignItems:"center",gap:"8px",transition:"opacity 0.15s",opacity:j?1:0},children:j&&c.jsxs(c.Fragment,{children:[c.jsx("span",{style:{display:"inline-block",width:"10px",height:"10px",borderRadius:"50%",background:j.color||_r,flexShrink:0}}),c.jsxs("span",{style:{color:l,fontSize:"14px",fontWeight:"600"},children:[j.title," — ",j.value,"%"]})]})})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:h?"flex-start":"center",gap:"16px"},children:[c.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,style:{overflow:"visible"},children:[k.map((y,C)=>{const _=g===C,{tx:O,ty:M}=_?vs(p,v,y.sa,y.ea,10):{tx:0,ty:0};return c.jsx("g",{transform:`translate(${O}, ${M})`,style:{transition:"transform 0.18s ease",pointerEvents:"none"},children:c.jsx("path",{d:bs(p,v,x,f,y.sa,y.ea),fill:y.color||_r,style:{filter:_?"brightness(1.25)":"brightness(1)",transition:"filter 0.18s ease"}})},C)}),k.map((y,C)=>{const _=st(p,v,f,y.sa),O=e==="cheese"?p:st(p,v,x,y.sa).x,M=e==="cheese"?v:st(p,v,x,y.sa).y;return c.jsx("line",{x1:O,y1:M,x2:_.x,y2:_.y,stroke:a,strokeWidth:i,strokeLinecap:"butt",style:{pointerEvents:"none"}},`gap-${C}`)}),k.map((y,C)=>{if(y.ea-y.sa<20)return null;const _=g===C,{tx:O,ty:M}=_?vs(p,v,y.sa,y.ea,10):{tx:0,ty:0},N=y.sa+(y.ea-y.sa)/2,q=st(p,v,S,N);return c.jsxs("text",{x:q.x+O,y:q.y+M,textAnchor:"middle",dominantBaseline:"middle",fill:u,fontSize:"14",fontWeight:"700",fontFamily:"'Segoe UI', sans-serif",pointerEvents:"none",style:{transition:"x 0.18s ease, y 0.18s ease"},children:[y.value,"%"]},`lbl-${C}`)}),k.map((y,C)=>c.jsx("path",{d:bs(p,v,x,f,y.sa,y.ea),fill:"transparent",style:{cursor:"pointer"},onMouseEnter:()=>b(C),onMouseLeave:()=>b(null)},`hit-${C}`))]}),c.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px 24px",justifyContent:h?"flex-start":"center"},children:t.map((y,C)=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",opacity:g===null||g===C?1:.4,transition:"opacity 0.15s"},onMouseEnter:()=>b(C),onMouseLeave:()=>b(null),children:[c.jsx("span",{style:{width:"32px",height:"14px",borderRadius:"3px",background:y.color||_r,flexShrink:0}}),c.jsx("span",{style:{color:l,fontSize:"13px",fontWeight:"400"},children:y.title})]},C))})]})]})};eo.propTypes={type:s.oneOf(["cheese","donut"]),data:s.arrayOf(s.shape({value:s.number.isRequired,title:s.string.isRequired,color:s.string})).isRequired,title:s.string,size:s.number,donutThickness:s.number,gapWidth:s.number,backgroundColor:s.string,fontColor:s.string,fontColorInside:s.string,containerStyles:s.object,alignLeft:s.bool};eo.defaultProps={type:"cheese",data:[],size:260,donutThickness:56,gapWidth:3,backgroundColor:"transparent",fontColor:"black",fontColorInside:"white",containerStyles:{},alignLeft:!1};const Cs=["#a8d8cf","#3bbfa0","#5dd4b8","#7ed4c2","#2aa88a"],qi=({data:e=[],title:t,backgroundColor:n="#0d3d4a",fontColor:r="#ffffff",barHeight:o=52,animated:i=!0,borderRadius:a,containerStyles:l={},fontColorInside:u="white"})=>{const[d,h]=w.useState(i?0:1);w.useEffect(()=>{if(!i)return;const b=requestAnimationFrame(()=>h(1));return()=>cancelAnimationFrame(b)},[i]);const g=Math.max(...e.map(b=>b.value),1);return c.jsxs("div",{style:{display:"inline-flex",flexDirection:"column",gap:"0px",background:n,borderRadius:"16px",fontFamily:"'Segoe UI', sans-serif",minWidth:"420px",...l},children:[t&&c.jsx("h2",{style:{margin:"0 0 20px 0",color:r,fontSize:"22px",fontWeight:"700",letterSpacing:"-0.4px"},children:t}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"18px"},children:e.map((b,p)=>{const v=b.color||Cs[p%Cs.length],f=b.value/g*100*d;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[c.jsx("span",{style:{color:r,fontSize:"14px",fontWeight:"400",opacity:.9},children:b.title}),c.jsxs("div",{style:{position:"relative",height:`${o}px`,background:"transparent",borderRadius:a??"6px",overflow:"hidden"},children:[c.jsx("div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${f}%`,background:v,borderRadius:a??"6px",transition:i?"width 0.8s cubic-bezier(0.16, 1, 0.3, 1)":"none"}}),c.jsx("span",{style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:u||n,fontSize:"18px",fontWeight:"700",pointerEvents:"none",letterSpacing:"-0.3px"},children:b.value})]})]},p)})})]})};qi.propTypes={data:s.arrayOf(s.shape({title:s.string.isRequired,value:s.number.isRequired,color:s.string})),title:s.string,backgroundColor:s.string,fontColor:s.string,fontColorInside:s.string,barHeight:s.number,animated:s.bool,borderRadius:s.oneOfType([s.string,s.number]),containerStyles:s.object};const Wf="_header_13kbt_2",Uf="_leftComponents_13kbt_13",Zf="_centerComponents_13kbt_14",Hf="_rightComponents_13kbt_15",Kf="_componentsContainer_13kbt_32",xt={header:Wf,leftComponents:Uf,centerComponents:Zf,rightComponents:Hf,componentsContainer:Kf},Wi=({cssProps:e,leftComponents:t=[],centerComponents:n=[],rightComponents:r=[],zIndex:o=10,height:i=60,backgroundColor:a="#605B56",isFooter:l=!1})=>c.jsxs("div",{className:xt.header,style:{...e,zIndex:o,height:i,backgroundColor:a,top:l?"auto":0,bottom:l?0:"auto"},children:[c.jsx("div",{className:xt.leftComponents,children:t.map((u,d)=>c.jsx("div",{className:xt.componentsContainer,children:u},d))}),c.jsx("div",{className:xt.centerComponents,children:n.map((u,d)=>c.jsx("div",{className:xt.componentsContainer,children:u},d))}),c.jsx("div",{className:xt.rightComponents,children:r.map((u,d)=>c.jsx("div",{className:xt.componentsContainer,children:u},d))})]});Wi.propTypes={leftComponents:s.arrayOf(s.node),centerComponents:s.arrayOf(s.node),rightComponents:s.arrayOf(s.node),cssProps:s.object,zIndex:s.number,height:s.number,backgroundColor:s.string,isFooter:s.bool};const Gf="_sidebar_1kaqu_2",Yf="_open_1kaqu_16",Xf="_content_1kaqu_20",Qf="_closeButton_1kaqu_25",Nn={sidebar:Gf,open:Yf,content:Xf,closeButton:Qf},Jf="data:image/svg+xml,%3csvg%20width='19'%20height='19'%20viewBox='0%200%2019%2019'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%203699'%3e%3cpath%20id='Vector%20223'%20d='M1%201L18.1566%2018.1566'%20stroke='%23605B56'%20stroke-width='1.5'%20stroke-linecap='round'/%3e%3cpath%20id='Vector%20224'%20d='M18.1575%201L1.00083%2018.1566'%20stroke='%23605B56'%20stroke-width='1.5'%20stroke-linecap='round'/%3e%3c/g%3e%3c/svg%3e",Ui=({width:e="300px",children:t,showRightBar:n,onCloseBar:r})=>{const o=()=>{r()};return c.jsx("div",{className:`${Nn.sidebar} ${n?Nn.open:""}`,style:{width:n?e:0},children:n&&c.jsxs("div",{className:Nn.content,children:[c.jsx("button",{className:Nn.closeButton,onClick:o,children:c.jsx("img",{src:Jf,alt:"Close Sidebar"})}),t]})})};Ui.propTypes={width:s.string,children:s.node,showRightBar:s.bool,onCloseBar:s.func};exports.AmbitSelector=$s;exports.BarChart=Br;exports.BurgerMenu=Jr;exports.ButtonsBar=Di;exports.ButtonsList=Es;exports.CategorySelector=Rr;exports.DropdownList=mt;exports.EditAmbit=Qa;exports.ErrorMessage=Ut;exports.FiltersAmbit=Ds;exports.Form=Dd;exports.GeneralButton=an;exports.Graphic=Is;exports.GraphicLegend=Fi;exports.Groupedbarchart=Bi;exports.HeaderSection=Wi;exports.HorizontalBarChart=qi;exports.IndicatorsList=Vs;exports.LangSelector=Fs;exports.Legend=zs;exports.ListSelector=ki;exports.Loader=Pi;exports.LogInButton=Si;exports.LogoApp=qs;exports.MapboxMap=Gs;exports.MaplibreMap=Ys;exports.ModalAlert=Ri;exports.PieChart=eo;exports.RadioButtonInput=Mi;exports.RankingSlider=Yr;exports.RightSidebar=Ui;exports.SectionBar=Xs;exports.SelectInput=Li;exports.SpeedGraphic=zi;exports.Stackedbarchart=Vi;exports.StatusText=Qr;exports.Steps=Xr;exports.Switch=Ii;exports.TextInput=Mr;exports.TimeSlider=_i;exports.Tooltip=Je;exports.TopNavMenu=wi;
87
+ `),ce.select(this).style("opacity",.8),f&&f(z,{key:ne.key,value:xe,data:ne.data})}).on("mousemove",function(z){C&&se&&se.style("top",z.pageY-10+"px").style("left",z.pageX+10+"px")}).on("mouseout",function(){C&&se&&se.style("visibility","hidden"),ce.select(this).style("opacity",1)}),x&&Ye.on("click",function(z,ne){const xe=ne.value;x(z,{key:ne.key,value:xe,data:ne.data})}),ee&&ee.length>1){const z=ce.line().x(ne=>ne.x).y(ne=>ne.y).curve(ce.curveMonotoneX);le.append("path").datum(ee).attr("class","line").attr("d",z).attr("fill","none").attr("stroke","#ff6b6b").attr("stroke-width",2).attr("stroke-linecap","round").attr("stroke-linejoin","round"),le.selectAll(".line-point").data(ee).enter().append("circle").attr("class","line-point").attr("cx",ne=>ne.x).attr("cy",ne=>ne.y).attr("r",4).attr("fill","#ff6b6b").attr("stroke","white").attr("stroke-width",1)}return()=>{se&&se.remove()}},[e,t,n,r,F,a,p,u,d,h,g,b,v,f,x,S,k,j,y,C,_,M]),c.jsx("div",{ref:q,className:`${ys.svgContainer} ${l}`,style:{width:o,height:i+a.top+a.bottom,overflowX:"auto"},children:c.jsx("svg",{ref:N,className:ys.svg})})};Vi.propTypes={data:s.arrayOf(s.object).isRequired,keys:s.arrayOf(s.string).isRequired,colors:s.oneOfType([s.arrayOf(s.string),s.object]),lineData:s.arrayOf(s.number),width:s.oneOfType([s.string,s.number]),height:s.number,margin:s.shape({top:s.number,right:s.number,bottom:s.number,left:s.number}),className:s.string,showXAxisLabels:s.bool,showYAxisLabels:s.bool,showGrid:s.bool,xAxisTickRotation:s.number,yAxisTickFormat:s.func,barPadding:s.number,animationDuration:s.number,onBarHover:s.func,onBarClick:s.func,title:s.string,xAxisLabel:s.string,yAxisLabel:s.string,stackOrder:s.oneOf(["reverse","ascending","descending","insideOut","none"]),showTooltip:s.bool,reverseKeys:s.bool,minBarSlotWidth:s.number,wrapXAxisLabels:s.bool};const jf="_externalContainer_1er0i_2",$f="_externalSintetic_1er0i_9",Ef="_titles_1er0i_13",Nf="_titleContainer_1er0i_22",Of="_yearTitles_1er0i_36",Af="_yearTitle_1er0i_36",Lf="_yearDatas_1er0i_50",Mf="_yearDataContainer_1er0i_58",Rf="_yearDataContent_1er0i_66",Df="_bigNumber_1er0i_79",If="_circle_1er0i_82",Pf="_totalContainer_1er0i_99",Bf="_total_1er0i_99",De={externalContainer:jf,externalSintetic:$f,titles:Ef,titleContainer:Nf,yearTitles:Of,yearTitle:Af,yearDatas:Lf,yearDataContainer:Mf,yearDataContent:Rf,bigNumber:Df,circle:If,totalContainer:Pf,total:Bf},Vf=e=>{if(e>=1e3||e<=-1e3)return parseInt(e.toFixed());if(e>=100||e<=-100)return parseFloat(e.toFixed(1));if(e>=10||e<=-10)return parseFloat(e.toFixed(2));if(e>0||e<0)return parseFloat(e.toFixed(3));if(e===0)return e},Ff=(e,t)=>{let n=0;return t.forEach(r=>{r[e]&&(n+=r[e])}),n},Fi=({data:e,keys:t,colors:n,locales:r,total:o=!1,years:i=!1,activeGraphics:a="ind",units:l={},translate:u,getTotal:d=Ff,columnWidth:h=50})=>{const g=u||(p=>p),b=p=>p==="demanda_red"||p==="reduccio_demanda_red"?(l.demanda||"").replace("(","").replace(")",""):l[p]||"";return c.jsxs("div",{className:`${De.externalContainer} ${a==="sin"?De.externalSintetic:""}`,children:[i===!0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{}),c.jsx("div",{className:De.yearTitles,children:e.map((p,v)=>c.jsx("div",{className:De.yearTitle,style:{width:h},children:p.anyo},v))})]}),c.jsx("div",{className:De.titles,children:t.map((p,v)=>c.jsxs("div",{className:De.titleContainer,children:[g(r[p]),a!=="sin"&&c.jsx("span",{className:De.circle,style:{background:n[p]}})]},v))}),o===!0&&c.jsx("div",{className:De.totalContainer,children:t.map((p,v)=>{var f;return c.jsxs("div",{className:`${De.total} ${d(p,e)>9999||d(p,e)<-9999?De.bigNumber:""}`,children:[(f=d(p,e))==null?void 0:f.toLocaleString("es-ES")," ",b(p)]},v)})}),c.jsx("div",{className:De.yearDatas,children:e.map((p,v)=>c.jsx("div",{className:De.yearDataContainer,style:{width:h},children:t.map((f,x)=>{var S,k;return isNaN(p[f])?null:c.jsx("div",{className:`${De.yearDataContent} ${p[f]>9999||p[f]<-9999?De.bigNumber:""}`,children:p[f]<1e4||p[f]>-1e4?(S=Vf(p[f]))==null?void 0:S.toLocaleString("es-ES"):(k=p[f])==null?void 0:k.toLocaleString("es-ES")},x)})},v))})]})};Fi.propTypes={data:s.arrayOf(s.shape({anyo:s.oneOfType([s.string,s.number]).isRequired})).isRequired,keys:s.arrayOf(s.string).isRequired,colors:s.objectOf(s.string).isRequired,locales:s.objectOf(s.string).isRequired,total:s.bool,years:s.bool,activeGraphics:s.oneOf(["ind","sin"]),units:s.objectOf(s.string),translate:s.func,getTotal:s.func,columnWidth:s.number};const zf="_speedGraphic_d1k72_2",xr={speedGraphic:zf},zi=({minValue:e=0,maxValue:t=100,value:n=50,title:r=!1,percent:o=!1,unit:i=!1,greenColor:a="#00CF1E",orangeColor:l="#FFAC00",redColor:u="#FF1E37"})=>{n<e&&(n=e),n>t&&(n=t);const d=(n-e)/(t-e),h=270+d*180,g=o?Math.round(d*100):n;return c.jsxs("div",{className:xr.speedGraphic,children:[c.jsxs("svg",{width:"244",height:"130",viewBox:"0 0 244 130",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M0 122C0 111.944 1.2433 101.927 3.70162 92.1756L26.2619 97.8633C24.2724 105.755 23.2662 113.862 23.2662 122H0Z",fill:a}),c.jsx("path",{d:"M16.3442 61.0012C21.3714 52.2936 27.4557 44.2409 34.4588 37.0263L51.1534 53.2313C45.4859 59.0701 40.5619 65.5871 36.4934 72.6341L16.3442 61.0012Z",fill:a}),c.jsx("path",{d:"M60.9088 16.3976C69.6119 11.3628 78.9041 7.42322 88.5739 4.66843L94.9485 27.0443C87.1228 29.2737 79.6027 32.462 72.5592 36.5367L60.9088 16.3976Z",fill:l}),c.jsx("path",{d:"M121.797 0.000169508C131.851 -0.0165912 141.869 1.20965 151.623 3.65101L145.974 26.2209C138.08 24.2451 129.972 23.2527 121.835 23.2663L121.797 0.000169508Z",fill:l}),c.jsx("path",{d:"M182.623 16.1279C191.348 21.124 199.422 27.1797 206.662 34.157L190.516 50.9092C184.657 45.2625 178.123 40.3617 171.061 36.3183L182.623 16.1279Z",fill:u}),c.jsx("path",{d:"M227.238 60.2836C232.325 68.9568 236.319 78.2255 239.131 87.8788L216.794 94.3859C214.518 86.5735 211.285 79.0725 207.169 72.0533L227.238 60.2836Z",fill:u}),c.jsx("path",{d:"M4.15505 90.4316C6.75674 80.7194 10.5491 71.3662 15.4458 62.5846L35.7663 73.9155C31.8035 81.0224 28.7343 88.5919 26.6288 96.4519L4.15505 90.4316Z",fill:a}),c.jsx("path",{d:"M35.733 35.733C42.8426 28.6233 50.8039 22.4198 59.4357 17.2636L71.3671 37.2375C64.3814 41.4104 57.9384 46.4308 52.1846 52.1846L35.733 35.733Z",fill:a}),c.jsx("path",{d:"M90.3004 4.19027C100.01 1.57776 110.005 0.175523 120.058 0.0154601L120.428 23.2787C112.292 23.4082 104.203 24.543 96.3457 26.6573L90.3004 4.19027Z",fill:l}),c.jsx("path",{d:"M153.423 4.11614C163.138 6.70584 172.496 10.4866 181.284 15.3725L169.978 35.707C162.866 31.7529 155.293 28.6932 147.43 26.5973L153.423 4.11614Z",fill:l}),c.jsx("path",{d:"M239.602 89.538C242.532 100.152 244.011 111.114 244 122.125L220.734 122.101C220.743 113.19 219.546 104.319 217.175 95.7287L239.602 89.538Z",fill:u}),c.jsx("path",{d:"M207.769 35.2376C214.919 42.3062 221.168 50.2316 226.374 58.8336L206.469 70.8798C202.256 63.9183 197.199 57.5043 191.412 51.7837L207.769 35.2376Z",fill:u}),c.jsx("g",{transform:`rotate(${h} 122 122)`,children:c.jsx("path",{id:"aguja",d:"M121 119.5V33",stroke:"#605B56","stroke-width":"2"})})]}),c.jsxs("div",{className:xr.value,children:[g,o&&"%",i&&i]}),r&&c.jsx("div",{className:xr.title,children:r})]})};zi.propTypes={minValue:s.number.isRequired,maxValue:s.number.isRequired,value:s.number.isRequired,percent:s.bool,title:s.string,unit:s.string,greenColor:s.string,orangeColor:s.string,redColor:s.string};const _r="#ffffff";function st(e,t,n,r){const o=(r-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}}function bs(e,t,n,r,o,i){if(Math.abs(i-o)>=359.99)return n===0?`M ${e-r} ${t} A ${r} ${r} 0 1 1 ${e+r} ${t} A ${r} ${r} 0 1 1 ${e-r} ${t} Z`:[`M ${e-r} ${t} A ${r} ${r} 0 1 1 ${e+r} ${t} A ${r} ${r} 0 1 1 ${e-r} ${t} Z`,`M ${e-n} ${t} A ${n} ${n} 0 1 0 ${e+n} ${t} A ${n} ${n} 0 1 0 ${e-n} ${t} Z`].join(" ");const a=st(e,t,r,o),l=st(e,t,r,i),u=i-o>180?1:0;if(n===0)return`M ${e} ${t} L ${a.x} ${a.y} A ${r} ${r} 0 ${u} 1 ${l.x} ${l.y} Z`;const d=st(e,t,n,i),h=st(e,t,n,o);return[`M ${a.x} ${a.y}`,`A ${r} ${r} 0 ${u} 1 ${l.x} ${l.y}`,`L ${d.x} ${d.y}`,`A ${n} ${n} 0 ${u} 0 ${h.x} ${h.y}`,"Z"].join(" ")}function qf(e){const t=e.reduce((r,o)=>r+(o.value||0),0);let n=0;return e.map(r=>{const o=r.value/t*360,i=n;return n+=o,{...r,sa:i,ea:n}})}function vs(e,t,n,r,o){const i=n+(r-n)/2,a=st(e,t,o,i);return{tx:a.x-e,ty:a.y-t}}const eo=({type:e="cheese",data:t=[],title:n,size:r=260,donutThickness:o=56,gapWidth:i=3,backgroundColor:a="transparent",fontColor:l="black",fontColorInside:u="white",containerStyles:d={},alignLeft:h=!1})=>{const[g,b]=w.useState(null),p=r/2,v=r/2,f=r/2-14,x=e==="donut"?f-o:0,S=e==="donut"?f-o/2:f*.62,k=w.useMemo(()=>qf(t),[t]),j=g!==null?k[g]:null;return c.jsxs("div",{style:{display:"inline-flex",flexDirection:"column",gap:"4px",padding:"28px 32px",background:a,borderRadius:"16px",fontFamily:"'Segoe UI', sans-serif",...d},children:[c.jsxs("div",{style:{minHeight:"40px",display:"flex",flexDirection:"column",gap:"2px"},children:[n&&c.jsx("h2",{style:{margin:0,color:l,fontSize:"22px",fontWeight:"700",letterSpacing:"-0.5px"},children:n}),c.jsx("div",{style:{height:"22px",display:"flex",alignItems:"center",gap:"8px",transition:"opacity 0.15s",opacity:j?1:0},children:j&&c.jsxs(c.Fragment,{children:[c.jsx("span",{style:{display:"inline-block",width:"10px",height:"10px",borderRadius:"50%",background:j.color||_r,flexShrink:0}}),c.jsxs("span",{style:{color:l,fontSize:"14px",fontWeight:"600"},children:[j.title," — ",j.value,"%"]})]})})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:h?"flex-start":"center",gap:"16px"},children:[c.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,style:{overflow:"visible"},children:[k.map((y,C)=>{const _=g===C,{tx:O,ty:M}=_?vs(p,v,y.sa,y.ea,10):{tx:0,ty:0};return c.jsx("g",{transform:`translate(${O}, ${M})`,style:{transition:"transform 0.18s ease",pointerEvents:"none"},children:c.jsx("path",{d:bs(p,v,x,f,y.sa,y.ea),fill:y.color||_r,style:{filter:_?"brightness(1.25)":"brightness(1)",transition:"filter 0.18s ease"}})},C)}),k.map((y,C)=>{const _=st(p,v,f,y.sa),O=e==="cheese"?p:st(p,v,x,y.sa).x,M=e==="cheese"?v:st(p,v,x,y.sa).y;return c.jsx("line",{x1:O,y1:M,x2:_.x,y2:_.y,stroke:a,strokeWidth:i,strokeLinecap:"butt",style:{pointerEvents:"none"}},`gap-${C}`)}),k.map((y,C)=>{if(y.ea-y.sa<20)return null;const _=g===C,{tx:O,ty:M}=_?vs(p,v,y.sa,y.ea,10):{tx:0,ty:0},N=y.sa+(y.ea-y.sa)/2,q=st(p,v,S,N);return c.jsxs("text",{x:q.x+O,y:q.y+M,textAnchor:"middle",dominantBaseline:"middle",fill:u,fontSize:"14",fontWeight:"700",fontFamily:"'Segoe UI', sans-serif",pointerEvents:"none",style:{transition:"x 0.18s ease, y 0.18s ease"},children:[y.value,"%"]},`lbl-${C}`)}),k.map((y,C)=>c.jsx("path",{d:bs(p,v,x,f,y.sa,y.ea),fill:"transparent",style:{cursor:"pointer"},onMouseEnter:()=>b(C),onMouseLeave:()=>b(null)},`hit-${C}`))]}),c.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px 24px",justifyContent:h?"flex-start":"center"},children:t.map((y,C)=>c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",opacity:g===null||g===C?1:.4,transition:"opacity 0.15s"},onMouseEnter:()=>b(C),onMouseLeave:()=>b(null),children:[c.jsx("span",{style:{width:"32px",height:"14px",borderRadius:"3px",background:y.color||_r,flexShrink:0}}),c.jsx("span",{style:{color:l,fontSize:"13px",fontWeight:"400"},children:y.title})]},C))})]})]})};eo.propTypes={type:s.oneOf(["cheese","donut"]),data:s.arrayOf(s.shape({value:s.number.isRequired,title:s.string.isRequired,color:s.string})).isRequired,title:s.string,size:s.number,donutThickness:s.number,gapWidth:s.number,backgroundColor:s.string,fontColor:s.string,fontColorInside:s.string,containerStyles:s.object,alignLeft:s.bool};eo.defaultProps={type:"cheese",data:[],size:260,donutThickness:56,gapWidth:3,backgroundColor:"transparent",fontColor:"black",fontColorInside:"white",containerStyles:{},alignLeft:!1};const Cs=["#a8d8cf","#3bbfa0","#5dd4b8","#7ed4c2","#2aa88a"],qi=({data:e=[],title:t,backgroundColor:n="#0d3d4a",fontColor:r="#ffffff",barHeight:o=52,animated:i=!0,borderRadius:a,containerStyles:l={},fontColorInside:u="white"})=>{const[d,h]=w.useState(i?0:1);w.useEffect(()=>{if(!i)return;const b=requestAnimationFrame(()=>h(1));return()=>cancelAnimationFrame(b)},[i]);const g=Math.max(...e.map(b=>b.value),1);return c.jsxs("div",{style:{display:"inline-flex",flexDirection:"column",gap:"0px",background:n,borderRadius:"16px",fontFamily:"'Segoe UI', sans-serif",minWidth:"420px",...l},children:[t&&c.jsx("h2",{style:{margin:"0 0 20px 0",color:r,fontSize:"22px",fontWeight:"700",letterSpacing:"-0.4px"},children:t}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"18px"},children:e.map((b,p)=>{const v=b.color||Cs[p%Cs.length],f=b.value/g*100*d;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:[c.jsx("span",{style:{color:r,fontSize:"14px",fontWeight:"400",opacity:.9},children:b.title}),c.jsxs("div",{style:{position:"relative",height:`${o}px`,background:"transparent",borderRadius:a??"6px",overflow:"hidden"},children:[c.jsx("div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${f}%`,background:v,borderRadius:a??"6px",transition:i?"width 0.8s cubic-bezier(0.16, 1, 0.3, 1)":"none"}}),c.jsx("span",{style:{position:"absolute",left:"14px",top:"50%",transform:"translateY(-50%)",color:u||n,fontSize:"18px",fontWeight:"700",pointerEvents:"none",letterSpacing:"-0.3px"},children:b.value})]})]},p)})})]})};qi.propTypes={data:s.arrayOf(s.shape({title:s.string.isRequired,value:s.number.isRequired,color:s.string})),title:s.string,backgroundColor:s.string,fontColor:s.string,fontColorInside:s.string,barHeight:s.number,animated:s.bool,borderRadius:s.oneOfType([s.string,s.number]),containerStyles:s.object};const Wf="_header_13kbt_2",Uf="_leftComponents_13kbt_13",Zf="_centerComponents_13kbt_14",Hf="_rightComponents_13kbt_15",Kf="_componentsContainer_13kbt_32",xt={header:Wf,leftComponents:Uf,centerComponents:Zf,rightComponents:Hf,componentsContainer:Kf},Wi=({cssProps:e,leftComponents:t=[],centerComponents:n=[],rightComponents:r=[],zIndex:o=10,height:i=60,backgroundColor:a="#605B56",isFooter:l=!1})=>c.jsxs("div",{className:xt.header,style:{...e,zIndex:o,height:i,backgroundColor:a,top:l?"auto":0,bottom:l?0:"auto"},children:[c.jsx("div",{className:xt.leftComponents,children:t.map((u,d)=>c.jsx("div",{className:xt.componentsContainer,children:u},d))}),c.jsx("div",{className:xt.centerComponents,children:n.map((u,d)=>c.jsx("div",{className:xt.componentsContainer,children:u},d))}),c.jsx("div",{className:xt.rightComponents,children:r.map((u,d)=>c.jsx("div",{className:xt.componentsContainer,children:u},d))})]});Wi.propTypes={leftComponents:s.arrayOf(s.node),centerComponents:s.arrayOf(s.node),rightComponents:s.arrayOf(s.node),cssProps:s.object,zIndex:s.number,height:s.number,backgroundColor:s.string,isFooter:s.bool};const Gf="_sidebar_1kaqu_2",Yf="_open_1kaqu_16",Xf="_content_1kaqu_20",Qf="_closeButton_1kaqu_25",Nn={sidebar:Gf,open:Yf,content:Xf,closeButton:Qf},Jf="data:image/svg+xml,%3csvg%20width='19'%20height='19'%20viewBox='0%200%2019%2019'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%203699'%3e%3cpath%20id='Vector%20223'%20d='M1%201L18.1566%2018.1566'%20stroke='%23605B56'%20stroke-width='1.5'%20stroke-linecap='round'/%3e%3cpath%20id='Vector%20224'%20d='M18.1575%201L1.00083%2018.1566'%20stroke='%23605B56'%20stroke-width='1.5'%20stroke-linecap='round'/%3e%3c/g%3e%3c/svg%3e",Ui=({width:e="300px",children:t,showRightBar:n,onCloseBar:r})=>{const o=()=>{r()};return c.jsx("div",{className:`${Nn.sidebar} ${n?Nn.open:""}`,style:{width:n?e:0},children:n&&c.jsxs("div",{className:Nn.content,children:[c.jsx("button",{className:Nn.closeButton,onClick:o,children:c.jsx("img",{src:Jf,alt:"Close Sidebar"})}),t]})})};Ui.propTypes={width:s.string,children:s.node,showRightBar:s.bool,onCloseBar:s.func};exports.AmbitSelector=$s;exports.BarChart=Br;exports.BurgerMenu=Jr;exports.ButtonsBar=Di;exports.ButtonsList=Es;exports.CategorySelector=Rr;exports.DropdownList=mt;exports.EditAmbit=Qa;exports.ErrorMessage=Ut;exports.FiltersAmbit=Ds;exports.Form=Dd;exports.GeneralButton=an;exports.Graphic=Is;exports.GraphicLegend=Fi;exports.Groupedbarchart=Bi;exports.HeaderSection=Wi;exports.HorizontalBarChart=qi;exports.IndicatorsList=Vs;exports.LangSelector=Fs;exports.Legend=zs;exports.ListSelector=ki;exports.Loader=Pi;exports.LogInButton=Si;exports.LogoApp=qs;exports.MapboxMap=Gs;exports.MaplibreMap=Ys;exports.ModalAlert=Ri;exports.PieChart=eo;exports.RadioButtonInput=Mi;exports.RankingSlider=Yr;exports.RightSidebar=Ui;exports.SectionBar=Xs;exports.SelectInput=Li;exports.SpeedGraphic=zi;exports.Stackedbarchart=Vi;exports.StatusText=Qr;exports.Steps=Xr;exports.Switch=Ii;exports.TextInput=Mr;exports.TimeSlider=_i;exports.Tooltip=Je;exports.TopNavMenu=wi;
package/dist/index.es.js CHANGED
@@ -11429,6 +11429,11 @@ function ct(e, t, n, r) {
11429
11429
  return { x: e + n * Math.cos(o), y: t + n * Math.sin(o) };
11430
11430
  }
11431
11431
  function ki(e, t, n, r, o, s) {
11432
+ if (Math.abs(s - o) >= 359.99)
11433
+ return n === 0 ? `M ${e - r} ${t} A ${r} ${r} 0 1 1 ${e + r} ${t} A ${r} ${r} 0 1 1 ${e - r} ${t} Z` : [
11434
+ `M ${e - r} ${t} A ${r} ${r} 0 1 1 ${e + r} ${t} A ${r} ${r} 0 1 1 ${e - r} ${t} Z`,
11435
+ `M ${e - n} ${t} A ${n} ${n} 0 1 0 ${e + n} ${t} A ${n} ${n} 0 1 0 ${e - n} ${t} Z`
11436
+ ].join(" ");
11432
11437
  const a = ct(e, t, r, o), l = ct(e, t, r, s), c = s - o > 180 ? 1 : 0;
11433
11438
  if (n === 0)
11434
11439
  return `M ${e} ${t} L ${a.x} ${a.y} A ${r} ${r} 0 ${c} 1 ${l.x} ${l.y} Z`;
@@ -11474,7 +11479,7 @@ const Ms = ({
11474
11479
  display: "inline-flex",
11475
11480
  flexDirection: "column",
11476
11481
  gap: "4px",
11477
- padding: "0",
11482
+ padding: "28px 32px",
11478
11483
  background: a,
11479
11484
  borderRadius: "16px",
11480
11485
  fontFamily: "'Segoe UI', sans-serif",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmf_ciclica/ciclicastorybook",
3
- "version": "1.2.129",
3
+ "version": "1.2.130",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",