tekivex-ui 2.5.3 → 2.5.5

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/charts.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("recharts"),b=require("./index-BINBzXuY.cjs");function C(r){return[r.primary,r.secondary,r.info,r.success,r.warning,r.danger,"#a855f7","#f97316","#14b8a6","#e879f9"]}const v={top:10,right:30,bottom:10,left:0};function T(r){return{contentStyle:{backgroundColor:r.surface,border:`1px solid ${r.border}`,borderRadius:8,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",color:r.text,fontSize:13},labelStyle:{color:r.textMuted,fontWeight:600,marginBottom:4},itemStyle:{color:r.text},cursor:{fill:`${r.primary}15`}}}function A({data:r,series:S,xKey:h,height:m=300,margin:d=v,showGrid:x=!0,showLegend:u=!0,showTooltip:j=!0,smooth:a=!0,xTickFormatter:y,yTickFormatter:i,yDomain:o,ariaLabel:c="Area chart"}){const l=b.useTheme(),f=C(l),n=T(l),g={fill:l.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":c,style:{width:"100%",height:m},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.AreaChart,{data:r,margin:d,children:[x&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:l.border,vertical:!1}),e.jsx(t.XAxis,{dataKey:h,tick:g,axisLine:{stroke:l.border},tickLine:!1,tickFormatter:y}),e.jsx(t.YAxis,{tick:g,axisLine:!1,tickLine:!1,tickFormatter:i,domain:o}),j&&e.jsx(t.Tooltip,{contentStyle:n.contentStyle,labelStyle:n.labelStyle,itemStyle:n.itemStyle,cursor:n.cursor}),u&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:l.textMuted,paddingTop:8}}),S.map((k,p)=>{const s=k.color??f[p%f.length];return e.jsx(t.Area,{type:a?"monotone":"linear",dataKey:k.key,name:k.label??k.key,stroke:s,strokeWidth:2,fill:s,fillOpacity:k.fillOpacity??.2,stackId:k.stacked?"stack":void 0,dot:!1,activeDot:{r:5,strokeWidth:0}},k.key)})]})})})}function z({data:r,series:S,xKey:h,height:m=300,margin:d=v,showGrid:x=!0,showLegend:u=!0,showTooltip:j=!0,layout:a="horizontal",barSize:y,xTickFormatter:i,yTickFormatter:o,ariaLabel:c="Bar chart"}){const l=b.useTheme(),f=C(l),n=T(l),g={fill:l.textMuted,fontSize:12},k=a==="vertical";return e.jsx("div",{role:"img","aria-label":c,style:{width:"100%",height:m},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.BarChart,{data:r,margin:d,layout:a,children:[x&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:l.border,vertical:k,horizontal:!k}),k?e.jsxs(e.Fragment,{children:[e.jsx(t.YAxis,{dataKey:h,type:"category",tick:g,axisLine:!1,tickLine:!1,tickFormatter:i,width:100}),e.jsx(t.XAxis,{type:"number",tick:g,axisLine:{stroke:l.border},tickLine:!1,tickFormatter:o})]}):e.jsxs(e.Fragment,{children:[e.jsx(t.XAxis,{dataKey:h,tick:g,axisLine:{stroke:l.border},tickLine:!1,tickFormatter:i}),e.jsx(t.YAxis,{tick:g,axisLine:!1,tickLine:!1,tickFormatter:o})]}),j&&e.jsx(t.Tooltip,{contentStyle:n.contentStyle,labelStyle:n.labelStyle,itemStyle:n.itemStyle,cursor:{fill:`${l.surfaceAlt}`}}),u&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:l.textMuted,paddingTop:8}}),S.map((p,s)=>{const L=p.color??f[s%f.length];return e.jsx(t.Bar,{dataKey:p.key,name:p.label??p.key,fill:L,stackId:p.stackId,maxBarSize:y??40,radius:p.radius??[4,4,0,0]},p.key)})]})})})}function M({data:r,series:S,xKey:h,height:m=300,margin:d=v,showGrid:x=!0,showLegend:u=!0,showTooltip:j=!0,smooth:a=!0,referenceLines:y=[],xTickFormatter:i,yTickFormatter:o,yDomain:c,connectNulls:l=!1,ariaLabel:f="Line chart"}){const n=b.useTheme(),g=C(n),k=T(n),p={fill:n.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":f,style:{width:"100%",height:m},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.LineChart,{data:r,margin:d,children:[x&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:n.border,vertical:!1}),e.jsx(t.XAxis,{dataKey:h,tick:p,axisLine:{stroke:n.border},tickLine:!1,tickFormatter:i}),e.jsx(t.YAxis,{tick:p,axisLine:!1,tickLine:!1,tickFormatter:o,domain:c}),j&&e.jsx(t.Tooltip,{contentStyle:k.contentStyle,labelStyle:k.labelStyle,itemStyle:k.itemStyle,cursor:{stroke:n.border,strokeWidth:1}}),u&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:n.textMuted,paddingTop:8}}),y.map((s,L)=>e.jsx(t.ReferenceLine,{y:s.y,x:s.x,label:s.label?{value:s.label,fill:n.textMuted,fontSize:11}:void 0,stroke:s.color??n.border,strokeDasharray:s.dashed?"4 4":void 0},L)),S.map((s,L)=>{const w=s.color??g[L%g.length];return e.jsx(t.Line,{type:a?"monotone":"linear",dataKey:s.key,name:s.label??s.key,stroke:w,strokeWidth:s.strokeWidth??2,strokeDasharray:s.dashed?"6 3":void 0,dot:s.dot??!1,activeDot:{r:5,strokeWidth:0,fill:w},connectNulls:l},s.key)})]})})})}function R({data:r,height:S=300,showLegend:h=!0,showTooltip:m=!0,showLabels:d=!1,outerRadius:x="70%",startAngle:u=90,ariaLabel:j="Pie chart"}){const a=b.useTheme(),y=C(a),i=T(a);return e.jsx("div",{role:"img","aria-label":j,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.PieChart,{children:[m&&e.jsx(t.Tooltip,{contentStyle:i.contentStyle,labelStyle:i.labelStyle,itemStyle:i.itemStyle}),h&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:a.textMuted}}),e.jsx(t.Pie,{data:r,dataKey:"value",nameKey:"name",outerRadius:x,startAngle:u,endAngle:u-360,label:d?({name:o,percent:c})=>`${o} (${(c*100).toFixed(0)}%)`:void 0,labelLine:d,strokeWidth:2,stroke:a.bg,children:r.map((o,c)=>e.jsx(t.Cell,{fill:o.color??y[c%y.length]},o.name))})]})})})}function D({data:r,height:S=300,showLegend:h=!0,showTooltip:m=!0,centerLabel:d,centerSublabel:x,innerRadius:u="55%",outerRadius:j="75%",startAngle:a=90,ariaLabel:y="Donut chart"}){const i=b.useTheme(),o=C(i),c=T(i);return e.jsxs("div",{role:"img","aria-label":y,style:{width:"100%",height:S},children:[e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.PieChart,{children:[m&&e.jsx(t.Tooltip,{contentStyle:c.contentStyle,labelStyle:c.labelStyle,itemStyle:c.itemStyle}),h&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:i.textMuted}}),e.jsx(t.Pie,{data:r,dataKey:"value",nameKey:"name",innerRadius:u,outerRadius:j,startAngle:a,endAngle:a-360,strokeWidth:3,stroke:i.bg,label:!1,labelLine:!1,children:r.map((l,f)=>e.jsx(t.Cell,{fill:l.color??o[f%o.length]},l.name))}),(d||x)&&e.jsx("text",{})]})}),(d||x)&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",pointerEvents:"none",marginTop:h?-24:0},children:[d&&e.jsx("span",{style:{fontSize:22,fontWeight:700,color:i.text,lineHeight:1},children:d}),x&&e.jsx("span",{style:{fontSize:13,color:i.textMuted,marginTop:4},children:x})]})]})}function K({series:r,height:S=300,margin:h=v,showGrid:m=!0,showLegend:d=!0,showTooltip:x=!0,xTickFormatter:u,yTickFormatter:j,zRange:a=[20,400],ariaLabel:y="Scatter chart"}){const i=b.useTheme(),o=C(i),c=T(i),l={fill:i.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":y,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.ScatterChart,{margin:h,children:[m&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:i.border}),e.jsx(t.XAxis,{type:"number",dataKey:"x",tick:l,axisLine:{stroke:i.border},tickLine:!1,tickFormatter:u}),e.jsx(t.YAxis,{type:"number",dataKey:"y",tick:l,axisLine:!1,tickLine:!1,tickFormatter:j}),e.jsx(t.ZAxis,{type:"number",dataKey:"z",range:a}),x&&e.jsx(t.Tooltip,{contentStyle:c.contentStyle,labelStyle:c.labelStyle,itemStyle:c.itemStyle,cursor:{strokeDasharray:"3 3"}}),d&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:i.textMuted,paddingTop:8}}),r.map((f,n)=>e.jsx(t.Scatter,{name:f.name,data:f.data,fill:f.color??o[n%o.length],fillOpacity:.8},f.name??n))]})})})}function F({data:r,series:S,angleKey:h,height:m=300,showLegend:d=!0,showTooltip:x=!0,outerRadius:u="70%",ariaLabel:j="Radar chart"}){const a=b.useTheme(),y=C(a),i=T(a);return e.jsx("div",{role:"img","aria-label":j,style:{width:"100%",height:m},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.RadarChart,{data:r,outerRadius:u,children:[e.jsx(t.PolarGrid,{stroke:a.border}),e.jsx(t.PolarAngleAxis,{dataKey:h,tick:{fill:a.textMuted,fontSize:12}}),e.jsx(t.PolarRadiusAxis,{tick:{fill:a.textMuted,fontSize:10},axisLine:!1,tickLine:!1}),x&&e.jsx(t.Tooltip,{contentStyle:i.contentStyle,labelStyle:i.labelStyle,itemStyle:i.itemStyle}),d&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:a.textMuted}}),S.map((o,c)=>{const l=o.color??y[c%y.length];return e.jsx(t.Radar,{name:o.label??o.key,dataKey:o.key,stroke:l,fill:l,fillOpacity:o.fillOpacity??.2,strokeWidth:2},o.key)})]})})})}exports.TkxAreaChart=A;exports.TkxBarChart=z;exports.TkxDonutChart=D;exports.TkxLineChart=M;exports.TkxPieChart=R;exports.TkxRadarChart=F;exports.TkxScatterChart=K;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("recharts"),g=require("./index-BINBzXuY.cjs"),L=require("react");function C(i){return[i.primary,i.secondary,i.info,i.success,i.warning,i.danger,"#a855f7","#f97316","#14b8a6","#e879f9"]}const A={top:10,right:30,bottom:10,left:0};function T(i){return{contentStyle:{backgroundColor:i.surface,border:`1px solid ${i.border}`,borderRadius:8,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",color:i.text,fontSize:13},labelStyle:{color:i.textMuted,fontWeight:600,marginBottom:4},itemStyle:{color:i.text},cursor:{fill:`${i.primary}15`}}}function z({data:i,series:m,xKey:y,height:S=300,margin:d=A,showGrid:h=!0,showLegend:f=!0,showTooltip:p=!0,smooth:l=!0,xTickFormatter:u,yTickFormatter:o,yDomain:n,ariaLabel:x="Area chart"}){const r=g.useTheme(),c=C(r),a=T(r),j={fill:r.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":x,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.AreaChart,{data:i,margin:d,children:[h&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:r.border,vertical:!1}),e.jsx(t.XAxis,{dataKey:y,tick:j,axisLine:{stroke:r.border},tickLine:!1,tickFormatter:u}),e.jsx(t.YAxis,{tick:j,axisLine:!1,tickLine:!1,tickFormatter:o,domain:n}),p&&e.jsx(t.Tooltip,{contentStyle:a.contentStyle,labelStyle:a.labelStyle,itemStyle:a.itemStyle,cursor:a.cursor}),f&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:r.textMuted,paddingTop:8}}),m.map((k,b)=>{const s=k.color??c[b%c.length];return e.jsx(t.Area,{type:l?"monotone":"linear",dataKey:k.key,name:k.label??k.key,stroke:s,strokeWidth:2,fill:s,fillOpacity:k.fillOpacity??.2,stackId:k.stacked?"stack":void 0,dot:!1,activeDot:{r:5,strokeWidth:0}},k.key)})]})})})}function M({data:i,series:m,xKey:y,height:S=300,margin:d=A,showGrid:h=!0,showLegend:f=!0,showTooltip:p=!0,layout:l="horizontal",barSize:u,xTickFormatter:o,yTickFormatter:n,ariaLabel:x="Bar chart"}){const r=g.useTheme(),c=C(r),a=T(r),j={fill:r.textMuted,fontSize:12},k=l==="vertical";return e.jsx("div",{role:"img","aria-label":x,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.BarChart,{data:i,margin:d,layout:l,children:[h&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:r.border,vertical:k,horizontal:!k}),k?e.jsxs(e.Fragment,{children:[e.jsx(t.YAxis,{dataKey:y,type:"category",tick:j,axisLine:!1,tickLine:!1,tickFormatter:o,width:100}),e.jsx(t.XAxis,{type:"number",tick:j,axisLine:{stroke:r.border},tickLine:!1,tickFormatter:n})]}):e.jsxs(e.Fragment,{children:[e.jsx(t.XAxis,{dataKey:y,tick:j,axisLine:{stroke:r.border},tickLine:!1,tickFormatter:o}),e.jsx(t.YAxis,{tick:j,axisLine:!1,tickLine:!1,tickFormatter:n})]}),p&&e.jsx(t.Tooltip,{contentStyle:a.contentStyle,labelStyle:a.labelStyle,itemStyle:a.itemStyle,cursor:{fill:`${r.surfaceAlt}`}}),f&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:r.textMuted,paddingTop:8}}),m.map((b,s)=>{const v=b.color??c[s%c.length];return e.jsx(t.Bar,{dataKey:b.key,name:b.label??b.key,fill:v,stackId:b.stackId,maxBarSize:u??40,radius:b.radius??[4,4,0,0]},b.key)})]})})})}function R({data:i,series:m,xKey:y,height:S=300,margin:d=A,showGrid:h=!0,showLegend:f=!0,showTooltip:p=!0,smooth:l=!0,referenceLines:u=[],xTickFormatter:o,yTickFormatter:n,yDomain:x,connectNulls:r=!1,ariaLabel:c="Line chart"}){const a=g.useTheme(),j=C(a),k=T(a),b={fill:a.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":c,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.LineChart,{data:i,margin:d,children:[h&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:a.border,vertical:!1}),e.jsx(t.XAxis,{dataKey:y,tick:b,axisLine:{stroke:a.border},tickLine:!1,tickFormatter:o}),e.jsx(t.YAxis,{tick:b,axisLine:!1,tickLine:!1,tickFormatter:n,domain:x}),p&&e.jsx(t.Tooltip,{contentStyle:k.contentStyle,labelStyle:k.labelStyle,itemStyle:k.itemStyle,cursor:{stroke:a.border,strokeWidth:1}}),f&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:a.textMuted,paddingTop:8}}),u.map((s,v)=>e.jsx(t.ReferenceLine,{y:s.y,x:s.x,label:s.label?{value:s.label,fill:a.textMuted,fontSize:11}:void 0,stroke:s.color??a.border,strokeDasharray:s.dashed?"4 4":void 0},v)),m.map((s,v)=>{const w=s.color??j[v%j.length];return e.jsx(t.Line,{type:l?"monotone":"linear",dataKey:s.key,name:s.label??s.key,stroke:w,strokeWidth:s.strokeWidth??2,strokeDasharray:s.dashed?"6 3":void 0,dot:s.dot??!1,activeDot:{r:5,strokeWidth:0,fill:w},connectNulls:r},s.key)})]})})})}function F({data:i,height:m=300,showLegend:y=!0,showTooltip:S=!0,showLabels:d=!1,outerRadius:h="70%",startAngle:f=90,ariaLabel:p="Pie chart"}){const l=g.useTheme(),u=C(l),o=T(l),[n,x]=L.useState(!1);return L.useEffect(()=>{const r=requestAnimationFrame(()=>x(!0));return()=>cancelAnimationFrame(r)},[]),e.jsx("div",{role:"img","aria-label":p,style:{width:"100%",minWidth:240,height:m,position:"relative"},children:n&&e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",debounce:50,children:e.jsxs(t.PieChart,{children:[S&&e.jsx(t.Tooltip,{contentStyle:o.contentStyle,labelStyle:o.labelStyle,itemStyle:o.itemStyle}),y&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:l.textMuted}}),e.jsx(t.Pie,{data:i,dataKey:"value",nameKey:"name",outerRadius:h,startAngle:f,endAngle:f-360,label:d?({name:r,percent:c})=>`${r} (${(c*100).toFixed(0)}%)`:void 0,labelLine:d,strokeWidth:2,stroke:l.bg,children:i.map((r,c)=>e.jsx(t.Cell,{fill:r.color??u[c%u.length]},r.name))})]})})})}function D({data:i,height:m=300,showLegend:y=!0,showTooltip:S=!0,centerLabel:d,centerSublabel:h,innerRadius:f="55%",outerRadius:p="75%",startAngle:l=90,ariaLabel:u="Donut chart"}){const o=g.useTheme(),n=C(o),x=T(o),[r,c]=L.useState(!1);return L.useEffect(()=>{const a=requestAnimationFrame(()=>c(!0));return()=>cancelAnimationFrame(a)},[]),e.jsxs("div",{role:"img","aria-label":u,style:{width:"100%",minWidth:240,height:m,position:"relative"},children:[r&&e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",debounce:50,children:e.jsxs(t.PieChart,{children:[S&&e.jsx(t.Tooltip,{contentStyle:x.contentStyle,labelStyle:x.labelStyle,itemStyle:x.itemStyle}),y&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:o.textMuted}}),e.jsx(t.Pie,{data:i,dataKey:"value",nameKey:"name",innerRadius:f,outerRadius:p,startAngle:l,endAngle:l-360,strokeWidth:3,stroke:o.bg,label:!1,labelLine:!1,children:i.map((a,j)=>e.jsx(t.Cell,{fill:a.color??n[j%n.length]},a.name))}),(d||h)&&e.jsx("text",{})]})}),(d||h)&&e.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",pointerEvents:"none",marginTop:y?-24:0},children:[d&&e.jsx("span",{style:{fontSize:22,fontWeight:700,color:o.text,lineHeight:1},children:d}),h&&e.jsx("span",{style:{fontSize:13,color:o.textMuted,marginTop:4},children:h})]})]})}function K({series:i,height:m=300,margin:y=A,showGrid:S=!0,showLegend:d=!0,showTooltip:h=!0,xTickFormatter:f,yTickFormatter:p,zRange:l=[20,400],ariaLabel:u="Scatter chart"}){const o=g.useTheme(),n=C(o),x=T(o),r={fill:o.textMuted,fontSize:12};return e.jsx("div",{role:"img","aria-label":u,style:{width:"100%",height:m},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.ScatterChart,{margin:y,children:[S&&e.jsx(t.CartesianGrid,{strokeDasharray:"3 3",stroke:o.border}),e.jsx(t.XAxis,{type:"number",dataKey:"x",tick:r,axisLine:{stroke:o.border},tickLine:!1,tickFormatter:f}),e.jsx(t.YAxis,{type:"number",dataKey:"y",tick:r,axisLine:!1,tickLine:!1,tickFormatter:p}),e.jsx(t.ZAxis,{type:"number",dataKey:"z",range:l}),h&&e.jsx(t.Tooltip,{contentStyle:x.contentStyle,labelStyle:x.labelStyle,itemStyle:x.itemStyle,cursor:{strokeDasharray:"3 3"}}),d&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:o.textMuted,paddingTop:8}}),i.map((c,a)=>e.jsx(t.Scatter,{name:c.name,data:c.data,fill:c.color??n[a%n.length],fillOpacity:.8},c.name??a))]})})})}function W({data:i,series:m,angleKey:y,height:S=300,showLegend:d=!0,showTooltip:h=!0,outerRadius:f="70%",ariaLabel:p="Radar chart"}){const l=g.useTheme(),u=C(l),o=T(l);return e.jsx("div",{role:"img","aria-label":p,style:{width:"100%",height:S},children:e.jsx(t.ResponsiveContainer,{width:"100%",height:"100%",children:e.jsxs(t.RadarChart,{data:i,outerRadius:f,children:[e.jsx(t.PolarGrid,{stroke:l.border}),e.jsx(t.PolarAngleAxis,{dataKey:y,tick:{fill:l.textMuted,fontSize:12}}),e.jsx(t.PolarRadiusAxis,{tick:{fill:l.textMuted,fontSize:10},axisLine:!1,tickLine:!1}),h&&e.jsx(t.Tooltip,{contentStyle:o.contentStyle,labelStyle:o.labelStyle,itemStyle:o.itemStyle}),d&&e.jsx(t.Legend,{wrapperStyle:{fontSize:13,color:l.textMuted}}),m.map((n,x)=>{const r=n.color??u[x%u.length];return e.jsx(t.Radar,{name:n.label??n.key,dataKey:n.key,stroke:r,fill:r,fillOpacity:n.fillOpacity??.2,strokeWidth:2},n.key)})]})})})}exports.TkxAreaChart=z;exports.TkxBarChart=M;exports.TkxDonutChart=D;exports.TkxLineChart=R;exports.TkxPieChart=F;exports.TkxRadarChart=W;exports.TkxScatterChart=K;
package/dist/charts.js CHANGED
@@ -1,235 +1,236 @@
1
- import { jsx as t, jsxs as b, Fragment as R } from "react/jsx-runtime";
2
- import { ResponsiveContainer as L, AreaChart as O, CartesianGrid as A, XAxis as D, YAxis as T, Tooltip as v, Legend as w, Area as $, BarChart as j, Bar as G, LineChart as E, ReferenceLine as H, Line as N, PieChart as P, Pie as B, Cell as I, ScatterChart as U, ZAxis as V, Scatter as X, RadarChart as Y, PolarGrid as Z, PolarAngleAxis as _, PolarRadiusAxis as q, Radar as J } from "recharts";
1
+ import { jsx as t, jsxs as g, Fragment as R } from "react/jsx-runtime";
2
+ import { ResponsiveContainer as v, AreaChart as j, CartesianGrid as D, XAxis as F, YAxis as K, Tooltip as L, Legend as w, Area as E, BarChart as G, Bar as q, LineChart as H, ReferenceLine as N, Line as U, PieChart as P, Pie as B, Cell as I, ScatterChart as V, ZAxis as X, Scatter as Y, RadarChart as Z, PolarGrid as _, PolarAngleAxis as J, PolarRadiusAxis as Q, Radar as tt } from "recharts";
3
3
  import { u as z } from "./index-eT_U4qB2.js";
4
- function C(e) {
4
+ import { useState as O, useEffect as $ } from "react";
5
+ function C(r) {
5
6
  return [
6
- e.primary,
7
- e.secondary,
8
- e.info,
9
- e.success,
10
- e.warning,
11
- e.danger,
7
+ r.primary,
8
+ r.secondary,
9
+ r.info,
10
+ r.success,
11
+ r.warning,
12
+ r.danger,
12
13
  "#a855f7",
13
14
  "#f97316",
14
15
  "#14b8a6",
15
16
  "#e879f9"
16
17
  ];
17
18
  }
18
- const F = { top: 10, right: 30, bottom: 10, left: 0 };
19
- function M(e) {
19
+ const T = { top: 10, right: 30, bottom: 10, left: 0 };
20
+ function M(r) {
20
21
  return {
21
22
  contentStyle: {
22
- backgroundColor: e.surface,
23
- border: `1px solid ${e.border}`,
23
+ backgroundColor: r.surface,
24
+ border: `1px solid ${r.border}`,
24
25
  borderRadius: 8,
25
26
  boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
26
- color: e.text,
27
+ color: r.text,
27
28
  fontSize: 13
28
29
  },
29
- labelStyle: { color: e.textMuted, fontWeight: 600, marginBottom: 4 },
30
- itemStyle: { color: e.text },
31
- cursor: { fill: `${e.primary}15` }
30
+ labelStyle: { color: r.textMuted, fontWeight: 600, marginBottom: 4 },
31
+ itemStyle: { color: r.text },
32
+ cursor: { fill: `${r.primary}15` }
32
33
  };
33
34
  }
34
- function rt({
35
- data: e,
36
- series: S,
37
- xKey: y,
38
- height: m = 300,
39
- margin: d = F,
40
- showGrid: s = !0,
41
- showLegend: f = !0,
35
+ function ot({
36
+ data: r,
37
+ series: m,
38
+ xKey: h,
39
+ height: S = 300,
40
+ margin: d = T,
41
+ showGrid: y = !0,
42
+ showLegend: k = !0,
42
43
  showTooltip: p = !0,
43
44
  smooth: o = !0,
44
- xTickFormatter: h,
45
- yTickFormatter: r,
46
- yDomain: l,
47
- ariaLabel: c = "Area chart"
45
+ xTickFormatter: u,
46
+ yTickFormatter: i,
47
+ yDomain: a,
48
+ ariaLabel: s = "Area chart"
48
49
  }) {
49
- const i = z(), u = C(i), a = M(i), g = { fill: i.textMuted, fontSize: 12 };
50
- return /* @__PURE__ */ t("div", { role: "img", "aria-label": c, style: { width: "100%", height: m }, children: /* @__PURE__ */ t(L, { width: "100%", height: "100%", children: /* @__PURE__ */ b(O, { data: e, margin: d, children: [
51
- s && /* @__PURE__ */ t(A, { strokeDasharray: "3 3", stroke: i.border, vertical: !1 }),
50
+ const e = z(), c = C(e), l = M(e), x = { fill: e.textMuted, fontSize: 12 };
51
+ return /* @__PURE__ */ t("div", { role: "img", "aria-label": s, style: { width: "100%", height: S }, children: /* @__PURE__ */ t(v, { width: "100%", height: "100%", children: /* @__PURE__ */ g(j, { data: r, margin: d, children: [
52
+ y && /* @__PURE__ */ t(D, { strokeDasharray: "3 3", stroke: e.border, vertical: !1 }),
52
53
  /* @__PURE__ */ t(
53
- D,
54
+ F,
54
55
  {
55
- dataKey: y,
56
- tick: g,
57
- axisLine: { stroke: i.border },
56
+ dataKey: h,
57
+ tick: x,
58
+ axisLine: { stroke: e.border },
58
59
  tickLine: !1,
59
- tickFormatter: h
60
+ tickFormatter: u
60
61
  }
61
62
  ),
62
63
  /* @__PURE__ */ t(
63
- T,
64
+ K,
64
65
  {
65
- tick: g,
66
+ tick: x,
66
67
  axisLine: !1,
67
68
  tickLine: !1,
68
- tickFormatter: r,
69
- domain: l
69
+ tickFormatter: i,
70
+ domain: a
70
71
  }
71
72
  ),
72
73
  p && /* @__PURE__ */ t(
73
- v,
74
+ L,
74
75
  {
75
- contentStyle: a.contentStyle,
76
- labelStyle: a.labelStyle,
77
- itemStyle: a.itemStyle,
78
- cursor: a.cursor
76
+ contentStyle: l.contentStyle,
77
+ labelStyle: l.labelStyle,
78
+ itemStyle: l.itemStyle,
79
+ cursor: l.cursor
79
80
  }
80
81
  ),
81
- f && /* @__PURE__ */ t(
82
+ k && /* @__PURE__ */ t(
82
83
  w,
83
84
  {
84
- wrapperStyle: { fontSize: 13, color: i.textMuted, paddingTop: 8 }
85
+ wrapperStyle: { fontSize: 13, color: e.textMuted, paddingTop: 8 }
85
86
  }
86
87
  ),
87
- S.map((k, x) => {
88
- const n = k.color ?? u[x % u.length];
88
+ m.map((f, b) => {
89
+ const n = f.color ?? c[b % c.length];
89
90
  return /* @__PURE__ */ t(
90
- $,
91
+ E,
91
92
  {
92
93
  type: o ? "monotone" : "linear",
93
- dataKey: k.key,
94
- name: k.label ?? k.key,
94
+ dataKey: f.key,
95
+ name: f.label ?? f.key,
95
96
  stroke: n,
96
97
  strokeWidth: 2,
97
98
  fill: n,
98
- fillOpacity: k.fillOpacity ?? 0.2,
99
- stackId: k.stacked ? "stack" : void 0,
99
+ fillOpacity: f.fillOpacity ?? 0.2,
100
+ stackId: f.stacked ? "stack" : void 0,
100
101
  dot: !1,
101
102
  activeDot: { r: 5, strokeWidth: 0 }
102
103
  },
103
- k.key
104
+ f.key
104
105
  );
105
106
  })
106
107
  ] }) }) });
107
108
  }
108
- function it({
109
- data: e,
110
- series: S,
111
- xKey: y,
112
- height: m = 300,
113
- margin: d = F,
114
- showGrid: s = !0,
115
- showLegend: f = !0,
109
+ function at({
110
+ data: r,
111
+ series: m,
112
+ xKey: h,
113
+ height: S = 300,
114
+ margin: d = T,
115
+ showGrid: y = !0,
116
+ showLegend: k = !0,
116
117
  showTooltip: p = !0,
117
118
  layout: o = "horizontal",
118
- barSize: h,
119
- xTickFormatter: r,
120
- yTickFormatter: l,
121
- ariaLabel: c = "Bar chart"
119
+ barSize: u,
120
+ xTickFormatter: i,
121
+ yTickFormatter: a,
122
+ ariaLabel: s = "Bar chart"
122
123
  }) {
123
- const i = z(), u = C(i), a = M(i), g = { fill: i.textMuted, fontSize: 12 }, k = o === "vertical";
124
- return /* @__PURE__ */ t("div", { role: "img", "aria-label": c, style: { width: "100%", height: m }, children: /* @__PURE__ */ t(L, { width: "100%", height: "100%", children: /* @__PURE__ */ b(j, { data: e, margin: d, layout: o, children: [
125
- s && /* @__PURE__ */ t(
126
- A,
124
+ const e = z(), c = C(e), l = M(e), x = { fill: e.textMuted, fontSize: 12 }, f = o === "vertical";
125
+ return /* @__PURE__ */ t("div", { role: "img", "aria-label": s, style: { width: "100%", height: S }, children: /* @__PURE__ */ t(v, { width: "100%", height: "100%", children: /* @__PURE__ */ g(G, { data: r, margin: d, layout: o, children: [
126
+ y && /* @__PURE__ */ t(
127
+ D,
127
128
  {
128
129
  strokeDasharray: "3 3",
129
- stroke: i.border,
130
- vertical: k,
131
- horizontal: !k
130
+ stroke: e.border,
131
+ vertical: f,
132
+ horizontal: !f
132
133
  }
133
134
  ),
134
- k ? /* @__PURE__ */ b(R, { children: [
135
- /* @__PURE__ */ t(T, { dataKey: y, type: "category", tick: g, axisLine: !1, tickLine: !1, tickFormatter: r, width: 100 }),
136
- /* @__PURE__ */ t(D, { type: "number", tick: g, axisLine: { stroke: i.border }, tickLine: !1, tickFormatter: l })
137
- ] }) : /* @__PURE__ */ b(R, { children: [
138
- /* @__PURE__ */ t(D, { dataKey: y, tick: g, axisLine: { stroke: i.border }, tickLine: !1, tickFormatter: r }),
139
- /* @__PURE__ */ t(T, { tick: g, axisLine: !1, tickLine: !1, tickFormatter: l })
135
+ f ? /* @__PURE__ */ g(R, { children: [
136
+ /* @__PURE__ */ t(K, { dataKey: h, type: "category", tick: x, axisLine: !1, tickLine: !1, tickFormatter: i, width: 100 }),
137
+ /* @__PURE__ */ t(F, { type: "number", tick: x, axisLine: { stroke: e.border }, tickLine: !1, tickFormatter: a })
138
+ ] }) : /* @__PURE__ */ g(R, { children: [
139
+ /* @__PURE__ */ t(F, { dataKey: h, tick: x, axisLine: { stroke: e.border }, tickLine: !1, tickFormatter: i }),
140
+ /* @__PURE__ */ t(K, { tick: x, axisLine: !1, tickLine: !1, tickFormatter: a })
140
141
  ] }),
141
142
  p && /* @__PURE__ */ t(
142
- v,
143
+ L,
143
144
  {
144
- contentStyle: a.contentStyle,
145
- labelStyle: a.labelStyle,
146
- itemStyle: a.itemStyle,
147
- cursor: { fill: `${i.surfaceAlt}` }
145
+ contentStyle: l.contentStyle,
146
+ labelStyle: l.labelStyle,
147
+ itemStyle: l.itemStyle,
148
+ cursor: { fill: `${e.surfaceAlt}` }
148
149
  }
149
150
  ),
150
- f && /* @__PURE__ */ t(w, { wrapperStyle: { fontSize: 13, color: i.textMuted, paddingTop: 8 } }),
151
- S.map((x, n) => {
152
- const K = x.color ?? u[n % u.length];
151
+ k && /* @__PURE__ */ t(w, { wrapperStyle: { fontSize: 13, color: e.textMuted, paddingTop: 8 } }),
152
+ m.map((b, n) => {
153
+ const A = b.color ?? c[n % c.length];
153
154
  return /* @__PURE__ */ t(
154
- G,
155
+ q,
155
156
  {
156
- dataKey: x.key,
157
- name: x.label ?? x.key,
158
- fill: K,
159
- stackId: x.stackId,
160
- maxBarSize: h ?? 40,
161
- radius: x.radius ?? [4, 4, 0, 0]
157
+ dataKey: b.key,
158
+ name: b.label ?? b.key,
159
+ fill: A,
160
+ stackId: b.stackId,
161
+ maxBarSize: u ?? 40,
162
+ radius: b.radius ?? [4, 4, 0, 0]
162
163
  },
163
- x.key
164
+ b.key
164
165
  );
165
166
  })
166
167
  ] }) }) });
167
168
  }
168
- function lt({
169
- data: e,
170
- series: S,
171
- xKey: y,
172
- height: m = 300,
173
- margin: d = F,
174
- showGrid: s = !0,
175
- showLegend: f = !0,
169
+ function nt({
170
+ data: r,
171
+ series: m,
172
+ xKey: h,
173
+ height: S = 300,
174
+ margin: d = T,
175
+ showGrid: y = !0,
176
+ showLegend: k = !0,
176
177
  showTooltip: p = !0,
177
178
  smooth: o = !0,
178
- referenceLines: h = [],
179
- xTickFormatter: r,
180
- yTickFormatter: l,
181
- yDomain: c,
182
- connectNulls: i = !1,
183
- ariaLabel: u = "Line chart"
179
+ referenceLines: u = [],
180
+ xTickFormatter: i,
181
+ yTickFormatter: a,
182
+ yDomain: s,
183
+ connectNulls: e = !1,
184
+ ariaLabel: c = "Line chart"
184
185
  }) {
185
- const a = z(), g = C(a), k = M(a), x = { fill: a.textMuted, fontSize: 12 };
186
- return /* @__PURE__ */ t("div", { role: "img", "aria-label": u, style: { width: "100%", height: m }, children: /* @__PURE__ */ t(L, { width: "100%", height: "100%", children: /* @__PURE__ */ b(E, { data: e, margin: d, children: [
187
- s && /* @__PURE__ */ t(A, { strokeDasharray: "3 3", stroke: a.border, vertical: !1 }),
186
+ const l = z(), x = C(l), f = M(l), b = { fill: l.textMuted, fontSize: 12 };
187
+ return /* @__PURE__ */ t("div", { role: "img", "aria-label": c, style: { width: "100%", height: S }, children: /* @__PURE__ */ t(v, { width: "100%", height: "100%", children: /* @__PURE__ */ g(H, { data: r, margin: d, children: [
188
+ y && /* @__PURE__ */ t(D, { strokeDasharray: "3 3", stroke: l.border, vertical: !1 }),
188
189
  /* @__PURE__ */ t(
189
- D,
190
+ F,
190
191
  {
191
- dataKey: y,
192
- tick: x,
193
- axisLine: { stroke: a.border },
192
+ dataKey: h,
193
+ tick: b,
194
+ axisLine: { stroke: l.border },
194
195
  tickLine: !1,
195
- tickFormatter: r
196
+ tickFormatter: i
196
197
  }
197
198
  ),
198
199
  /* @__PURE__ */ t(
199
- T,
200
+ K,
200
201
  {
201
- tick: x,
202
+ tick: b,
202
203
  axisLine: !1,
203
204
  tickLine: !1,
204
- tickFormatter: l,
205
- domain: c
205
+ tickFormatter: a,
206
+ domain: s
206
207
  }
207
208
  ),
208
209
  p && /* @__PURE__ */ t(
209
- v,
210
+ L,
210
211
  {
211
- contentStyle: k.contentStyle,
212
- labelStyle: k.labelStyle,
213
- itemStyle: k.itemStyle,
214
- cursor: { stroke: a.border, strokeWidth: 1 }
212
+ contentStyle: f.contentStyle,
213
+ labelStyle: f.labelStyle,
214
+ itemStyle: f.itemStyle,
215
+ cursor: { stroke: l.border, strokeWidth: 1 }
215
216
  }
216
217
  ),
217
- f && /* @__PURE__ */ t(w, { wrapperStyle: { fontSize: 13, color: a.textMuted, paddingTop: 8 } }),
218
- h.map((n, K) => /* @__PURE__ */ t(
219
- H,
218
+ k && /* @__PURE__ */ t(w, { wrapperStyle: { fontSize: 13, color: l.textMuted, paddingTop: 8 } }),
219
+ u.map((n, A) => /* @__PURE__ */ t(
220
+ N,
220
221
  {
221
222
  y: n.y,
222
223
  x: n.x,
223
- label: n.label ? { value: n.label, fill: a.textMuted, fontSize: 11 } : void 0,
224
- stroke: n.color ?? a.border,
224
+ label: n.label ? { value: n.label, fill: l.textMuted, fontSize: 11 } : void 0,
225
+ stroke: n.color ?? l.border,
225
226
  strokeDasharray: n.dashed ? "4 4" : void 0
226
227
  },
227
- K
228
+ A
228
229
  )),
229
- S.map((n, K) => {
230
- const W = n.color ?? g[K % g.length];
230
+ m.map((n, A) => {
231
+ const W = n.color ?? x[A % x.length];
231
232
  return /* @__PURE__ */ t(
232
- N,
233
+ U,
233
234
  {
234
235
  type: o ? "monotone" : "linear",
235
236
  dataKey: n.key,
@@ -239,242 +240,264 @@ function lt({
239
240
  strokeDasharray: n.dashed ? "6 3" : void 0,
240
241
  dot: n.dot ?? !1,
241
242
  activeDot: { r: 5, strokeWidth: 0, fill: W },
242
- connectNulls: i
243
+ connectNulls: e
243
244
  },
244
245
  n.key
245
246
  );
246
247
  })
247
248
  ] }) }) });
248
249
  }
249
- function ot({
250
- data: e,
251
- height: S = 300,
252
- showLegend: y = !0,
253
- showTooltip: m = !0,
250
+ function ct({
251
+ data: r,
252
+ height: m = 300,
253
+ showLegend: h = !0,
254
+ showTooltip: S = !0,
254
255
  showLabels: d = !1,
255
- outerRadius: s = "70%",
256
- startAngle: f = 90,
256
+ outerRadius: y = "70%",
257
+ startAngle: k = 90,
257
258
  ariaLabel: p = "Pie chart"
258
259
  }) {
259
- const o = z(), h = C(o), r = M(o);
260
- return /* @__PURE__ */ t("div", { role: "img", "aria-label": p, style: { width: "100%", height: S }, children: /* @__PURE__ */ t(L, { width: "100%", height: "100%", children: /* @__PURE__ */ b(P, { children: [
261
- m && /* @__PURE__ */ t(
262
- v,
263
- {
264
- contentStyle: r.contentStyle,
265
- labelStyle: r.labelStyle,
266
- itemStyle: r.itemStyle
267
- }
268
- ),
269
- y && /* @__PURE__ */ t(w, { wrapperStyle: { fontSize: 13, color: o.textMuted } }),
270
- /* @__PURE__ */ t(
271
- B,
272
- {
273
- data: e,
274
- dataKey: "value",
275
- nameKey: "name",
276
- outerRadius: s,
277
- startAngle: f,
278
- endAngle: f - 360,
279
- label: d ? ({ name: l, percent: c }) => `${l} (${(c * 100).toFixed(0)}%)` : void 0,
280
- labelLine: d,
281
- strokeWidth: 2,
282
- stroke: o.bg,
283
- children: e.map((l, c) => /* @__PURE__ */ t(
284
- I,
260
+ const o = z(), u = C(o), i = M(o), [a, s] = O(!1);
261
+ return $(() => {
262
+ const e = requestAnimationFrame(() => s(!0));
263
+ return () => cancelAnimationFrame(e);
264
+ }, []), /* @__PURE__ */ t(
265
+ "div",
266
+ {
267
+ role: "img",
268
+ "aria-label": p,
269
+ style: { width: "100%", minWidth: 240, height: m, position: "relative" },
270
+ children: a && /* @__PURE__ */ t(v, { width: "100%", height: "100%", debounce: 50, children: /* @__PURE__ */ g(P, { children: [
271
+ S && /* @__PURE__ */ t(
272
+ L,
285
273
  {
286
- fill: l.color ?? h[c % h.length]
287
- },
288
- l.name
289
- ))
290
- }
291
- )
292
- ] }) }) });
274
+ contentStyle: i.contentStyle,
275
+ labelStyle: i.labelStyle,
276
+ itemStyle: i.itemStyle
277
+ }
278
+ ),
279
+ h && /* @__PURE__ */ t(w, { wrapperStyle: { fontSize: 13, color: o.textMuted } }),
280
+ /* @__PURE__ */ t(
281
+ B,
282
+ {
283
+ data: r,
284
+ dataKey: "value",
285
+ nameKey: "name",
286
+ outerRadius: y,
287
+ startAngle: k,
288
+ endAngle: k - 360,
289
+ label: d ? ({ name: e, percent: c }) => `${e} (${(c * 100).toFixed(0)}%)` : void 0,
290
+ labelLine: d,
291
+ strokeWidth: 2,
292
+ stroke: o.bg,
293
+ children: r.map((e, c) => /* @__PURE__ */ t(
294
+ I,
295
+ {
296
+ fill: e.color ?? u[c % u.length]
297
+ },
298
+ e.name
299
+ ))
300
+ }
301
+ )
302
+ ] }) })
303
+ }
304
+ );
293
305
  }
294
- function at({
295
- data: e,
296
- height: S = 300,
297
- showLegend: y = !0,
298
- showTooltip: m = !0,
306
+ function dt({
307
+ data: r,
308
+ height: m = 300,
309
+ showLegend: h = !0,
310
+ showTooltip: S = !0,
299
311
  centerLabel: d,
300
- centerSublabel: s,
301
- innerRadius: f = "55%",
312
+ centerSublabel: y,
313
+ innerRadius: k = "55%",
302
314
  outerRadius: p = "75%",
303
315
  startAngle: o = 90,
304
- ariaLabel: h = "Donut chart"
316
+ ariaLabel: u = "Donut chart"
305
317
  }) {
306
- const r = z(), l = C(r), c = M(r);
307
- return /* @__PURE__ */ b("div", { role: "img", "aria-label": h, style: { width: "100%", height: S }, children: [
308
- /* @__PURE__ */ t(L, { width: "100%", height: "100%", children: /* @__PURE__ */ b(P, { children: [
309
- m && /* @__PURE__ */ t(
310
- v,
311
- {
312
- contentStyle: c.contentStyle,
313
- labelStyle: c.labelStyle,
314
- itemStyle: c.itemStyle
315
- }
316
- ),
317
- y && /* @__PURE__ */ t(w, { wrapperStyle: { fontSize: 13, color: r.textMuted } }),
318
- /* @__PURE__ */ t(
319
- B,
320
- {
321
- data: e,
322
- dataKey: "value",
323
- nameKey: "name",
324
- innerRadius: f,
325
- outerRadius: p,
326
- startAngle: o,
327
- endAngle: o - 360,
328
- strokeWidth: 3,
329
- stroke: r.bg,
330
- label: !1,
331
- labelLine: !1,
332
- children: e.map((i, u) => /* @__PURE__ */ t(I, { fill: i.color ?? l[u % l.length] }, i.name))
333
- }
334
- ),
335
- (d || s) && /* @__PURE__ */ t("text", {})
336
- ] }) }),
337
- (d || s) && /* @__PURE__ */ b(
338
- "div",
339
- {
340
- style: {
341
- position: "absolute",
342
- inset: 0,
343
- display: "flex",
344
- flexDirection: "column",
345
- alignItems: "center",
346
- justifyContent: "center",
347
- pointerEvents: "none",
348
- marginTop: y ? -24 : 0
349
- },
350
- children: [
351
- d && /* @__PURE__ */ t("span", { style: { fontSize: 22, fontWeight: 700, color: r.text, lineHeight: 1 }, children: d }),
352
- s && /* @__PURE__ */ t("span", { style: { fontSize: 13, color: r.textMuted, marginTop: 4 }, children: s })
353
- ]
354
- }
355
- )
356
- ] });
318
+ const i = z(), a = C(i), s = M(i), [e, c] = O(!1);
319
+ return $(() => {
320
+ const l = requestAnimationFrame(() => c(!0));
321
+ return () => cancelAnimationFrame(l);
322
+ }, []), /* @__PURE__ */ g(
323
+ "div",
324
+ {
325
+ role: "img",
326
+ "aria-label": u,
327
+ style: { width: "100%", minWidth: 240, height: m, position: "relative" },
328
+ children: [
329
+ e && /* @__PURE__ */ t(v, { width: "100%", height: "100%", debounce: 50, children: /* @__PURE__ */ g(P, { children: [
330
+ S && /* @__PURE__ */ t(
331
+ L,
332
+ {
333
+ contentStyle: s.contentStyle,
334
+ labelStyle: s.labelStyle,
335
+ itemStyle: s.itemStyle
336
+ }
337
+ ),
338
+ h && /* @__PURE__ */ t(w, { wrapperStyle: { fontSize: 13, color: i.textMuted } }),
339
+ /* @__PURE__ */ t(
340
+ B,
341
+ {
342
+ data: r,
343
+ dataKey: "value",
344
+ nameKey: "name",
345
+ innerRadius: k,
346
+ outerRadius: p,
347
+ startAngle: o,
348
+ endAngle: o - 360,
349
+ strokeWidth: 3,
350
+ stroke: i.bg,
351
+ label: !1,
352
+ labelLine: !1,
353
+ children: r.map((l, x) => /* @__PURE__ */ t(I, { fill: l.color ?? a[x % a.length] }, l.name))
354
+ }
355
+ ),
356
+ (d || y) && /* @__PURE__ */ t("text", {})
357
+ ] }) }),
358
+ (d || y) && /* @__PURE__ */ g(
359
+ "div",
360
+ {
361
+ style: {
362
+ position: "absolute",
363
+ inset: 0,
364
+ display: "flex",
365
+ flexDirection: "column",
366
+ alignItems: "center",
367
+ justifyContent: "center",
368
+ pointerEvents: "none",
369
+ marginTop: h ? -24 : 0
370
+ },
371
+ children: [
372
+ d && /* @__PURE__ */ t("span", { style: { fontSize: 22, fontWeight: 700, color: i.text, lineHeight: 1 }, children: d }),
373
+ y && /* @__PURE__ */ t("span", { style: { fontSize: 13, color: i.textMuted, marginTop: 4 }, children: y })
374
+ ]
375
+ }
376
+ )
377
+ ]
378
+ }
379
+ );
357
380
  }
358
- function nt({
359
- series: e,
360
- height: S = 300,
361
- margin: y = F,
362
- showGrid: m = !0,
381
+ function st({
382
+ series: r,
383
+ height: m = 300,
384
+ margin: h = T,
385
+ showGrid: S = !0,
363
386
  showLegend: d = !0,
364
- showTooltip: s = !0,
365
- xTickFormatter: f,
387
+ showTooltip: y = !0,
388
+ xTickFormatter: k,
366
389
  yTickFormatter: p,
367
390
  zRange: o = [20, 400],
368
- ariaLabel: h = "Scatter chart"
391
+ ariaLabel: u = "Scatter chart"
369
392
  }) {
370
- const r = z(), l = C(r), c = M(r), i = { fill: r.textMuted, fontSize: 12 };
371
- return /* @__PURE__ */ t("div", { role: "img", "aria-label": h, style: { width: "100%", height: S }, children: /* @__PURE__ */ t(L, { width: "100%", height: "100%", children: /* @__PURE__ */ b(U, { margin: y, children: [
372
- m && /* @__PURE__ */ t(A, { strokeDasharray: "3 3", stroke: r.border }),
393
+ const i = z(), a = C(i), s = M(i), e = { fill: i.textMuted, fontSize: 12 };
394
+ return /* @__PURE__ */ t("div", { role: "img", "aria-label": u, style: { width: "100%", height: m }, children: /* @__PURE__ */ t(v, { width: "100%", height: "100%", children: /* @__PURE__ */ g(V, { margin: h, children: [
395
+ S && /* @__PURE__ */ t(D, { strokeDasharray: "3 3", stroke: i.border }),
373
396
  /* @__PURE__ */ t(
374
- D,
397
+ F,
375
398
  {
376
399
  type: "number",
377
400
  dataKey: "x",
378
- tick: i,
379
- axisLine: { stroke: r.border },
401
+ tick: e,
402
+ axisLine: { stroke: i.border },
380
403
  tickLine: !1,
381
- tickFormatter: f
404
+ tickFormatter: k
382
405
  }
383
406
  ),
384
407
  /* @__PURE__ */ t(
385
- T,
408
+ K,
386
409
  {
387
410
  type: "number",
388
411
  dataKey: "y",
389
- tick: i,
412
+ tick: e,
390
413
  axisLine: !1,
391
414
  tickLine: !1,
392
415
  tickFormatter: p
393
416
  }
394
417
  ),
395
- /* @__PURE__ */ t(V, { type: "number", dataKey: "z", range: o }),
396
- s && /* @__PURE__ */ t(
397
- v,
418
+ /* @__PURE__ */ t(X, { type: "number", dataKey: "z", range: o }),
419
+ y && /* @__PURE__ */ t(
420
+ L,
398
421
  {
399
- contentStyle: c.contentStyle,
400
- labelStyle: c.labelStyle,
401
- itemStyle: c.itemStyle,
422
+ contentStyle: s.contentStyle,
423
+ labelStyle: s.labelStyle,
424
+ itemStyle: s.itemStyle,
402
425
  cursor: { strokeDasharray: "3 3" }
403
426
  }
404
427
  ),
405
- d && /* @__PURE__ */ t(w, { wrapperStyle: { fontSize: 13, color: r.textMuted, paddingTop: 8 } }),
406
- e.map((u, a) => /* @__PURE__ */ t(
407
- X,
428
+ d && /* @__PURE__ */ t(w, { wrapperStyle: { fontSize: 13, color: i.textMuted, paddingTop: 8 } }),
429
+ r.map((c, l) => /* @__PURE__ */ t(
430
+ Y,
408
431
  {
409
- name: u.name,
410
- data: u.data,
411
- fill: u.color ?? l[a % l.length],
432
+ name: c.name,
433
+ data: c.data,
434
+ fill: c.color ?? a[l % a.length],
412
435
  fillOpacity: 0.8
413
436
  },
414
- u.name ?? a
437
+ c.name ?? l
415
438
  ))
416
439
  ] }) }) });
417
440
  }
418
- function ct({
419
- data: e,
420
- series: S,
421
- angleKey: y,
422
- height: m = 300,
441
+ function yt({
442
+ data: r,
443
+ series: m,
444
+ angleKey: h,
445
+ height: S = 300,
423
446
  showLegend: d = !0,
424
- showTooltip: s = !0,
425
- outerRadius: f = "70%",
447
+ showTooltip: y = !0,
448
+ outerRadius: k = "70%",
426
449
  ariaLabel: p = "Radar chart"
427
450
  }) {
428
- const o = z(), h = C(o), r = M(o);
429
- return /* @__PURE__ */ t("div", { role: "img", "aria-label": p, style: { width: "100%", height: m }, children: /* @__PURE__ */ t(L, { width: "100%", height: "100%", children: /* @__PURE__ */ b(Y, { data: e, outerRadius: f, children: [
430
- /* @__PURE__ */ t(Z, { stroke: o.border }),
451
+ const o = z(), u = C(o), i = M(o);
452
+ return /* @__PURE__ */ t("div", { role: "img", "aria-label": p, style: { width: "100%", height: S }, children: /* @__PURE__ */ t(v, { width: "100%", height: "100%", children: /* @__PURE__ */ g(Z, { data: r, outerRadius: k, children: [
453
+ /* @__PURE__ */ t(_, { stroke: o.border }),
431
454
  /* @__PURE__ */ t(
432
- _,
455
+ J,
433
456
  {
434
- dataKey: y,
457
+ dataKey: h,
435
458
  tick: { fill: o.textMuted, fontSize: 12 }
436
459
  }
437
460
  ),
438
461
  /* @__PURE__ */ t(
439
- q,
462
+ Q,
440
463
  {
441
464
  tick: { fill: o.textMuted, fontSize: 10 },
442
465
  axisLine: !1,
443
466
  tickLine: !1
444
467
  }
445
468
  ),
446
- s && /* @__PURE__ */ t(
447
- v,
469
+ y && /* @__PURE__ */ t(
470
+ L,
448
471
  {
449
- contentStyle: r.contentStyle,
450
- labelStyle: r.labelStyle,
451
- itemStyle: r.itemStyle
472
+ contentStyle: i.contentStyle,
473
+ labelStyle: i.labelStyle,
474
+ itemStyle: i.itemStyle
452
475
  }
453
476
  ),
454
477
  d && /* @__PURE__ */ t(w, { wrapperStyle: { fontSize: 13, color: o.textMuted } }),
455
- S.map((l, c) => {
456
- const i = l.color ?? h[c % h.length];
478
+ m.map((a, s) => {
479
+ const e = a.color ?? u[s % u.length];
457
480
  return /* @__PURE__ */ t(
458
- J,
481
+ tt,
459
482
  {
460
- name: l.label ?? l.key,
461
- dataKey: l.key,
462
- stroke: i,
463
- fill: i,
464
- fillOpacity: l.fillOpacity ?? 0.2,
483
+ name: a.label ?? a.key,
484
+ dataKey: a.key,
485
+ stroke: e,
486
+ fill: e,
487
+ fillOpacity: a.fillOpacity ?? 0.2,
465
488
  strokeWidth: 2
466
489
  },
467
- l.key
490
+ a.key
468
491
  );
469
492
  })
470
493
  ] }) }) });
471
494
  }
472
495
  export {
473
- rt as TkxAreaChart,
474
- it as TkxBarChart,
475
- at as TkxDonutChart,
476
- lt as TkxLineChart,
477
- ot as TkxPieChart,
478
- ct as TkxRadarChart,
479
- nt as TkxScatterChart
496
+ ot as TkxAreaChart,
497
+ at as TkxBarChart,
498
+ dt as TkxDonutChart,
499
+ nt as TkxLineChart,
500
+ ct as TkxPieChart,
501
+ yt as TkxRadarChart,
502
+ st as TkxScatterChart
480
503
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TkxDonutChart.d.ts","sourceRoot":"","sources":["../../../src/charts/TkxDonutChart.tsx"],"names":[],"mappings":"AAWA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4BD,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,MAAY,EACZ,UAAiB,EACjB,WAAkB,EAClB,WAAW,EACX,cAAc,EACd,WAAmB,EACnB,WAAmB,EACnB,UAAe,EACf,SAAyB,GAC1B,EAAE,kBAAkB,2CAyEpB"}
1
+ {"version":3,"file":"TkxDonutChart.d.ts","sourceRoot":"","sources":["../../../src/charts/TkxDonutChart.tsx"],"names":[],"mappings":"AAYA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4BD,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,MAAY,EACZ,UAAiB,EACjB,WAAkB,EAClB,WAAW,EACX,cAAc,EACd,WAAmB,EACnB,WAAmB,EACnB,UAAe,EACf,SAAyB,GAC1B,EAAE,kBAAkB,2CAqFpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"TkxPieChart.d.ts","sourceRoot":"","sources":["../../../src/charts/TkxPieChart.tsx"],"names":[],"mappings":"AAWA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,MAAY,EACZ,UAAiB,EACjB,WAAkB,EAClB,UAAkB,EAClB,WAAmB,EACnB,UAAe,EACf,SAAuB,GACxB,EAAE,gBAAgB,2CA0ClB"}
1
+ {"version":3,"file":"TkxPieChart.d.ts","sourceRoot":"","sources":["../../../src/charts/TkxPieChart.tsx"],"names":[],"mappings":"AAYA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,MAAY,EACZ,UAAiB,EACjB,WAAkB,EAClB,UAAkB,EAClB,WAAmB,EACnB,UAAe,EACf,SAAuB,GACxB,EAAE,gBAAgB,2CAwDlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tekivex-ui",
3
- "version": "2.5.3",
3
+ "version": "2.5.5",
4
4
  "description": "Production-grade React component library — 70+ components, WCAG 2.1 AAA, WAI-ARIA 1.2, built-in charts, headless primitives, zero-runtime CSS engine, TypeScript-first.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1,3 +1,4 @@
1
+ import { useEffect, useState } from 'react';
1
2
  import {
2
3
  ResponsiveContainer,
3
4
  PieChart,
@@ -73,10 +74,21 @@ export function TkxDonutChart({
73
74
  const theme = useTheme();
74
75
  const colors = getDefaultColors(theme);
75
76
  const tt = tooltipStyle(theme);
77
+ // Force ResponsiveContainer to re-measure after the parent layout settles.
78
+ const [mounted, setMounted] = useState(false);
79
+ useEffect(() => {
80
+ const id = requestAnimationFrame(() => setMounted(true));
81
+ return () => cancelAnimationFrame(id);
82
+ }, []);
76
83
 
77
84
  return (
78
- <div role="img" aria-label={ariaLabel} style={{ width: '100%', height }}>
79
- <ResponsiveContainer width="100%" height="100%">
85
+ <div
86
+ role="img"
87
+ aria-label={ariaLabel}
88
+ style={{ width: '100%', minWidth: 240, height, position: 'relative' }}
89
+ >
90
+ {mounted && (
91
+ <ResponsiveContainer width="100%" height="100%" debounce={50}>
80
92
  <PieChart>
81
93
  {showTooltip && (
82
94
  <Tooltip
@@ -114,6 +126,7 @@ export function TkxDonutChart({
114
126
  )}
115
127
  </PieChart>
116
128
  </ResponsiveContainer>
129
+ )}
117
130
  {/* Overlay center label using absolute positioning */}
118
131
  {(centerLabel || centerSublabel) && (
119
132
  <div
@@ -1,3 +1,4 @@
1
+ import { useEffect, useState } from 'react';
1
2
  import {
2
3
  ResponsiveContainer,
3
4
  PieChart,
@@ -41,10 +42,23 @@ export function TkxPieChart({
41
42
  const theme = useTheme();
42
43
  const colors = getDefaultColors(theme);
43
44
  const tt = tooltipStyle(theme);
45
+ // Force ResponsiveContainer to re-measure after the parent layout settles.
46
+ // Without this, recharts can compute 0×0 on first paint inside CSS grids/flex
47
+ // and the chart silently disappears.
48
+ const [mounted, setMounted] = useState(false);
49
+ useEffect(() => {
50
+ const id = requestAnimationFrame(() => setMounted(true));
51
+ return () => cancelAnimationFrame(id);
52
+ }, []);
44
53
 
45
54
  return (
46
- <div role="img" aria-label={ariaLabel} style={{ width: '100%', height }}>
47
- <ResponsiveContainer width="100%" height="100%">
55
+ <div
56
+ role="img"
57
+ aria-label={ariaLabel}
58
+ style={{ width: '100%', minWidth: 240, height, position: 'relative' }}
59
+ >
60
+ {mounted && (
61
+ <ResponsiveContainer width="100%" height="100%" debounce={50}>
48
62
  <PieChart>
49
63
  {showTooltip && (
50
64
  <Tooltip
@@ -77,6 +91,7 @@ export function TkxPieChart({
77
91
  </Pie>
78
92
  </PieChart>
79
93
  </ResponsiveContainer>
94
+ )}
80
95
  </div>
81
96
  );
82
97
  }