@automattic/charts 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/components/bar-chart/index.cjs.js +2 -0
- package/dist/components/bar-chart/index.cjs.js.map +1 -0
- package/dist/components/bar-chart/index.js +2 -0
- package/dist/components/bar-chart/index.js.map +1 -0
- package/dist/components/bar-chart/style.css +95 -0
- package/dist/components/grid-control/index.cjs.js +2 -0
- package/dist/components/grid-control/index.cjs.js.map +1 -0
- package/dist/components/grid-control/index.js +2 -0
- package/dist/components/grid-control/index.js.map +1 -0
- package/dist/components/grid-control/style.css +95 -0
- package/dist/components/legend/index.cjs.js +2 -0
- package/dist/components/legend/index.cjs.js.map +1 -0
- package/dist/components/legend/index.js +2 -0
- package/dist/components/legend/index.js.map +1 -0
- package/dist/components/legend/style.css +95 -0
- package/dist/components/line-chart/index.cjs.js +2 -0
- package/dist/components/line-chart/index.cjs.js.map +1 -0
- package/dist/components/line-chart/index.js +2 -0
- package/dist/components/line-chart/index.js.map +1 -0
- package/dist/components/line-chart/style.css +95 -0
- package/dist/components/pie-chart/index.cjs.js +2 -0
- package/dist/components/pie-chart/index.cjs.js.map +1 -0
- package/dist/components/pie-chart/index.js +2 -0
- package/dist/components/pie-chart/index.js.map +1 -0
- package/dist/components/pie-chart/style.css +95 -0
- package/dist/components/pie-semi-circle-chart/index.cjs.js +2 -0
- package/dist/components/pie-semi-circle-chart/index.cjs.js.map +1 -0
- package/dist/components/pie-semi-circle-chart/index.js +2 -0
- package/dist/components/pie-semi-circle-chart/index.js.map +1 -0
- package/dist/components/pie-semi-circle-chart/style.css +95 -0
- package/dist/components/tooltip/index.cjs.js +2 -0
- package/dist/components/tooltip/index.cjs.js.map +1 -0
- package/dist/components/tooltip/index.js +2 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/components/tooltip/style.css +95 -0
- package/dist/index.d.ts +16386 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/providers/theme/index.cjs.js +2 -0
- package/dist/providers/theme/index.cjs.js.map +1 -0
- package/dist/providers/theme/index.js +2 -0
- package/dist/providers/theme/index.js.map +1 -0
- package/dist/providers/theme/style.css +95 -0
- package/dist/style.css +95 -0
- package/package.json +35 -13
- package/rollup.config.mjs +142 -0
- package/src/components/bar-chart/bar-chart.tsx +7 -7
- package/src/components/pie-chart/pie-chart.tsx +12 -10
- package/src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx +4 -4
- package/src/components/tooltip/base-tooltip.tsx +1 -1
- package/src/hooks/use-chart-mouse-handler.ts +1 -1
- package/src/providers/theme/theme-provider.tsx +1 -1
- package/tsup.config.js +0 -26
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),l=require("@visx/axis"),t=require("@visx/event"),a=require("@visx/group"),i=require("@visx/scale"),o=require("@visx/shape"),r=require("@visx/tooltip"),s=require("clsx"),n=require("react"),d=require("@visx/grid"),c=require("@visx/legend"),h=require("@visx/xychart"),p=require("@visx/shape/lib/shapes/Pie"),u=require("@visx/text");const m={backgroundColor:"#FFFFFF",labelBackgroundColor:"#FFFFFF",colors:["#98C8DF","#006DAB","#A6DC80","#1F9828","#FF8C8F"],gridStyles:{stroke:"#787C82",strokeWidth:1},tickLength:0,gridColor:"",gridColorDark:""},v=n.createContext(m),x=()=>n.useContext(v);var g="grid-control-module__grid-control__KOnZN";const _=({width:l,height:t,xScale:a,yScale:i,gridVisibility:o="x",top:r=0})=>e.jsxs("g",{transform:`translate(0, ${r})`,className:g,children:[o.includes("x")&&e.jsx(d.GridRows,{scale:a,width:l}),o.includes("y")&&e.jsx(d.GridColumns,{scale:i,height:t})]});var b={"legend--horizontal":"legend-module__legend--horizontal__IUN13","legend--vertical":"legend-module__legend--vertical__Scfzo","legend-item":"legend-module__legend-item__feemn","legend-item-swatch":"legend-module__legend-item-swatch__nRyXf","legend-item-label":"legend-module__legend-item-label__ksx6I","legend-item-value":"legend-module__legend-item-value__d9x1j"};const j={horizontal:"row",vertical:"column"},f=({items:l,className:t,orientation:a="horizontal"})=>{const o=i.scaleOrdinal({domain:l.map((e=>e.label)),range:l.map((e=>e.color))});return e.jsx("div",{className:s(b.legend,b[`legend--${a}`],t),role:"list",children:e.jsx(c.LegendOrdinal,{scale:o,direction:j[a],shape:"rect",shapeWidth:16,shapeHeight:16,className:b["legend-items"],children:t=>e.jsx("div",{className:b[`legend--${a}`],children:t.map((t=>{var a,i;return e.jsxs("div",{className:b["legend-item"],children:[e.jsx("svg",{width:16,height:16,children:e.jsx("rect",{width:16,height:16,fill:t.value,className:b["legend-item-swatch"]})}),e.jsxs("span",{className:b["legend-item-label"],children:[t.text,(null===(a=l.find((e=>e.label===t.text)))||void 0===a?void 0:a.value)&&e.jsx("span",{className:b["legend-item-value"],children:null===(i=l.find((e=>e.label===t.text)))||void 0===i?void 0:i.value})]})]},t.text)}))})})})};var y="base-tooltip-module__tooltip__OfX6n";const w=({data:l})=>e.jsxs(e.Fragment,{children:[null==l?void 0:l.label,": ",(null==l?void 0:l.valueDisplay)||(null==l?void 0:l.value)]}),T=({data:l,top:t,left:a,component:i=w,children:o,className:r})=>e.jsx("div",{className:y,style:{top:t,left:a},role:"tooltip",children:o||l&&e.jsx(i,{data:l,className:r})});var N={"bar-chart":"bar-chart-module__bar-chart__lmYNi","bar-chart-legend":"bar-chart-module__bar-chart-legend__vgKKq"};const C=({data:d,width:c=500,height:h=500,margin:p={top:20,right:20,bottom:40,left:40},withTooltips:u=!1,showLegend:m=!1,legendOrientation:v="horizontal",className:g,gridVisibility:b="x"})=>{var j;const y=x(),{tooltipOpen:w,tooltipLeft:C,tooltipTop:k,tooltipData:L,hideTooltip:D,showTooltip:M}=r.useTooltip(),A=n.useCallback(((e,l,a,i,o)=>{const r=t.localPoint(e);r&&M({tooltipData:{value:l,xLabel:a,yLabel:i,seriesIndex:o},tooltipLeft:r.x,tooltipTop:r.y-10})}),[M]),F=n.useCallback((()=>{D()}),[D]);if(!(null==d?void 0:d.length))return e.jsx("div",{className:s("bar-chart-empty",N["bat-chart-empty"]),children:"Empty..."});const S=p,q=c-S.left-S.right,O=h-S.top-S.bottom,P=null===(j=d[0].data)||void 0===j?void 0:j.map((e=>(null==e?void 0:e.label)||"")),B=i.scaleBand({range:[0,q],domain:P,padding:.2}),G=i.scaleBand({range:[0,B.bandwidth()],domain:d.map(((e,l)=>l.toString())),padding:.1}),z=i.scaleLinear({range:[O,0],domain:[0,Math.max(...d.map((e=>Math.max(...e.data.map((e=>(null==e?void 0:e.value)||0))))))]}),I=d.map(((e,l)=>({label:e.label,value:"",color:y.colors[l%y.colors.length]})));return e.jsxs("div",{className:s("bar-chart",g,N["bar-chart"]),children:[e.jsx("svg",{width:c,height:h,children:e.jsxs(a.Group,{left:S.left,top:S.top,children:[e.jsx(_,{width:q,height:O,xScale:B,yScale:z,gridVisibility:b}),d.map(((l,t)=>e.jsx(a.Group,{children:l.data.map((a=>{var i,r;const s=B((null==a?void 0:a.label)||"");if(void 0===s)return null;const n=G.bandwidth(),d=s+(null!==(i=G(t.toString()))&&void 0!==i?i:0);return e.jsx(o.Bar,{x:d,y:z(a.value),width:n,height:O-(null!==(r=z(a.value))&&void 0!==r?r:0),fill:y.colors[t%y.colors.length],onMouseMove:u?e=>A(e,a.value,(null==a?void 0:a.label)||"",l.label,t):void 0,onMouseLeave:u?F:void 0},`bar-${t}-${a.label}`)}))},t))),e.jsx(l.AxisLeft,{scale:z}),e.jsx(l.AxisBottom,{scale:B,top:O})]})}),u&&w&&L&&e.jsx(T,{top:k||0,left:C||0,children:e.jsxs("div",{children:[e.jsx("div",{children:L.yLabel}),e.jsxs("div",{children:[L.xLabel,": ",L.value]})]})}),m&&e.jsx(f,{items:I,orientation:v,className:N["bar-chart-legend"]})]})};C.displayName="BarChart";var k={"line-chart":"line-chart-module__line-chart__ITM3d","line-chart__tooltip":"line-chart-module__line-chart__tooltip__aqcme","line-chart__tooltip-date":"line-chart-module__line-chart__tooltip-date__4Dzab","line-chart__tooltip-row":"line-chart-module__line-chart__tooltip-row__6A37G","line-chart__tooltip-label":"line-chart-module__line-chart__tooltip-label__IvnFF"};const L=({tooltipData:l})=>{var t;const a=null===(t=null==l?void 0:l.nearestDatum)||void 0===t?void 0:t.datum;if(!a)return null;const i=Object.entries((null==l?void 0:l.datumByKey)||{}).map((([e,{datum:l}])=>({key:e,value:l.value}))).sort(((e,l)=>l.value-e.value));return e.jsxs("div",{className:k["line-chart__tooltip"],children:[e.jsx("div",{className:k["line-chart__tooltip-date"],children:a.date.toLocaleDateString()}),i.map((l=>e.jsxs("div",{className:k["line-chart__tooltip-row"],children:[e.jsxs("span",{className:k["line-chart__tooltip-label"],children:[l.key,":"]}),e.jsx("span",{className:k["line-chart__tooltip-value"],children:l.value})]},l.key)))]})},D=e=>new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"}),M=({withTooltips:e})=>{const{tooltipOpen:l,tooltipLeft:a,tooltipTop:i,tooltipData:o,hideTooltip:s,showTooltip:d}=r.useTooltip();return{onMouseMove:n.useCallback(((l,a)=>{if(!e)return;const i=t.localPoint(l);i&&d({tooltipData:a,tooltipLeft:i.x,tooltipTop:i.y-10})}),[e,d]),onMouseLeave:n.useCallback((()=>{e&&s()}),[e,s]),tooltipOpen:l,tooltipData:o||null,tooltipLeft:a,tooltipTop:i}};var A={"pie-chart":"pie-chart-module__pie-chart__R12Vh"};var F="pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9",S="pie-semi-circle-chart-module__pie-semi-circle-chart-legend__c8W1Y",q="pie-semi-circle-chart-module__label__nPqOg",O="pie-semi-circle-chart-module__note__LpBZQ";exports.BarChart=C,exports.BaseTooltip=T,exports.Legend=f,exports.LineChart=({data:l,width:t,height:a,margin:i={top:20,right:20,bottom:40,left:40},className:o,withTooltips:r=!0,showLegend:n=!1,legendOrientation:d="horizontal"})=>{const c=x();if(!(null==l?void 0:l.length))return e.jsx("div",{className:s("line-chart-empty",k["line-chart-empty"]),children:"Empty..."});const p=l.map(((e,l)=>({label:e.label,value:"",color:c.colors[l%c.colors.length]}))),u={xAccessor:e=>e.date,yAccessor:e=>e.value},m=h.buildChartTheme({backgroundColor:c.backgroundColor,colors:c.colors,gridStyles:c.gridStyles,tickLength:(null==c?void 0:c.tickLength)||0,gridColor:(null==c?void 0:c.gridColor)||"",gridColorDark:(null==c?void 0:c.gridColorDark)||""});return e.jsxs("div",{className:s("line-chart",k["line-chart"],o),children:[e.jsxs(h.XYChart,{theme:m,width:t,height:a,margin:i,xScale:{type:"time"},yScale:{type:"linear",nice:!0},children:[e.jsx(h.AnimatedGrid,{columns:!1,numTicks:4}),e.jsx(h.AnimatedAxis,{orientation:"bottom",numTicks:5,tickFormat:D}),e.jsx(h.AnimatedAxis,{orientation:"left",numTicks:4}),l.map(((l,t)=>e.jsx(h.AnimatedLineSeries,{dataKey:null==l?void 0:l.label,data:l.data,...u,stroke:m.colors[t%m.colors.length],strokeWidth:2},null==l?void 0:l.label))),r&&e.jsx(h.Tooltip,{snapTooltipToDatumX:!0,snapTooltipToDatumY:!0,showSeriesGlyphs:!0,renderTooltip:L})]}),n&&e.jsx(f,{items:p,orientation:d,className:k["line-chart-legend"]})]})},exports.PieChart=({data:l,width:t=500,height:i=500,withTooltips:r=!1,innerRadius:n=0,className:d,showLegend:c,legendOrientation:h})=>{const p=x(),{onMouseMove:u,onMouseLeave:v,tooltipOpen:g,tooltipData:_,tooltipLeft:b,tooltipTop:j}=M({withTooltips:r}),y=Math.min(t,i)/2,w=t/2,N=i/2,C={value:e=>e.value,fill:e=>(null==e?void 0:e.color)||p.colors[e.index]},k=l.map(((e,l)=>({label:e.label,value:e.value.toString(),color:p.colors[l%p.colors.length]})));return e.jsxs("div",{className:s("pie-chart",A["pie-chart"],d),children:[e.jsx("svg",{width:t,height:i,children:e.jsx(a.Group,{top:N,left:w,children:e.jsx(o.Pie,{data:l,pieValue:C.value,outerRadius:y-20,innerRadius:n,children:l=>l.arcs.map(((t,a)=>{const[i,o]=l.path.centroid(t),s=t.endAngle-t.startAngle>=.25,n=e=>u(e,t.data),d={d:l.path(t)||"",fill:C.fill(t)};return r&&(d.onMouseMove=n,d.onMouseLeave=v),e.jsxs("g",{children:[e.jsx("path",{...d}),s&&e.jsx("text",{x:i,y:o,dy:".33em",fill:p.labelBackgroundColor||m.labelBackgroundColor,fontSize:12,textAnchor:"middle",pointerEvents:"none",children:t.data.label})]},`arc-${a}`)}))})})}),c&&e.jsx(f,{items:k,orientation:h,className:A["pie-chart-legend"]}),r&&g&&_&&e.jsx(T,{data:_,top:j||0,left:b||0,style:{transform:"translate(-50%, -100%)"}})]})},exports.PieSemiCircleChart=({data:l,width:i=500,label:o,note:d,className:c,withTooltips:h=!1,clockwise:m=!0,thickness:v=.4,showLegend:g,legendOrientation:_})=>{const b=x(),{tooltipOpen:j,tooltipLeft:y,tooltipTop:w,tooltipData:N,hideTooltip:C,showTooltip:k}=r.useTooltip(),L=i/2,D=i/2,M=i/2,A=M*(1-v+.03),P=l.map(((e,l)=>({...e,index:l}))),B=m?-Math.PI/2:Math.PI/2,G=m?Math.PI/2:-Math.PI/2,z={value:e=>e.value,sort:(e,l)=>l.value-e.value,fill:e=>e.color||b.colors[e.index%b.colors.length]},I=n.useCallback(((e,l)=>{const a=t.localPoint(e);a&&k({tooltipData:l.data,tooltipLeft:a.x,tooltipTop:a.y-10})}),[k]),R=n.useCallback((()=>{C()}),[C]),V=n.useCallback((e=>l=>{I(l,e)}),[I]),$=l.map(((e,l)=>({label:e.label,value:e.valueDisplay||e.value.toString(),color:z.fill({...e,index:l})})));return e.jsxs("div",{className:s("pie-semi-circle-chart",F,c),children:[e.jsx("svg",{width:i,height:D,children:e.jsxs(a.Group,{top:L,left:L,children:[e.jsx(p,{data:P,pieValue:z.value,outerRadius:M,innerRadius:A,cornerRadius:3,padAngle:.03,startAngle:B,endAngle:G,pieSort:z.sort,children:l=>l.arcs.map((t=>e.jsx("g",{onMouseMove:V(t),onMouseLeave:R,children:e.jsx("path",{d:l.path(t)||"",fill:z.fill(t.data)})},t.data.label)))}),e.jsxs(a.Group,{children:[e.jsx(u.Text,{textAnchor:"middle",verticalAnchor:"start",y:-40,className:q,children:o}),e.jsx(u.Text,{textAnchor:"middle",verticalAnchor:"start",y:-20,className:O,children:d})]})]})}),h&&j&&N&&e.jsx(T,{data:{label:N.label,value:N.value,valueDisplay:N.valueDisplay},top:w||0,left:y||0}),g&&e.jsx(f,{items:$,orientation:_,className:S})]})},exports.ThemeProvider=({theme:l={},children:t})=>{const a={...m,...l};return e.jsx(v.Provider,{value:a,children:t})},exports.useChartMouseHandler=M;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["/@automattic/charts/../src/providers/theme/themes.ts","/@automattic/charts/../src/providers/theme/theme-provider.tsx","/@automattic/charts/../src/components/grid-control/grid-control.tsx","/@automattic/charts/../src/components/legend/base-legend.tsx","/@automattic/charts/../src/components/tooltip/base-tooltip.tsx","/@automattic/charts/../src/components/bar-chart/bar-chart.tsx","/@automattic/charts/../src/components/line-chart/line-chart.tsx","/@automattic/charts/../src/hooks/use-chart-mouse-handler.ts","/@automattic/charts/../src/components/pie-chart/pie-chart.tsx","/@automattic/charts/../src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":["defaultTheme","backgroundColor","labelBackgroundColor","colors","gridStyles","stroke","strokeWidth","tickLength","gridColor","gridColorDark","ThemeContext","createContext","useChartTheme","useContext","GridControl","width","height","xScale","yScale","gridVisibility","top","_jsxs","transform","className","styles","children","includes","_jsx","GridRows","scale","GridColumns","orientationToFlexDirection","horizontal","vertical","BaseLegend","items","orientation","legendScale","scaleOrdinal","domain","map","item","label","range","color","clsx","legend","role","jsx","LegendOrdinal","direction","shape","shapeWidth","shapeHeight","labels","jsxs","fill","value","text","_a","find","_b","DefaultTooltipContent","data","valueDisplay","BaseTooltip","left","component","Component","style","BarChart","margin","right","bottom","withTooltips","showLegend","legendOrientation","theme","tooltipOpen","tooltipLeft","tooltipTop","tooltipData","hideTooltip","showTooltip","useTooltip","handleMouseMove","useCallback","event","xLabel","yLabel","seriesIndex","coords","localPoint","x","y","handleMouseLeave","length","margins","xMax","yMax","d","scaleBand","padding","innerScale","bandwidth","_","i","toString","scaleLinear","Math","max","series","legendItems","group","index","Group","xPos","undefined","barWidth","barX","Bar","onMouseMove","onMouseLeave","AxisLeft","AxisBottom","Legend","displayName","renderTooltip","nearestDatum","datum","tooltipPoints","Object","entries","datumByKey","key","sort","a","b","date","toLocaleDateString","point","formatDateTick","Date","month","day","useChartMouseHandler","providerTheme","accessors","xAccessor","yAccessor","buildChartTheme","XYChart","type","nice","AnimatedGrid","columns","numTicks","AnimatedAxis","tickFormat","seriesData","AnimatedLineSeries","dataKey","Tooltip","snapTooltipToDatumX","snapTooltipToDatumY","showSeriesGlyphs","innerRadius","radius","min","centerX","centerY","Pie","pieValue","outerRadius","pie","arcs","arc","centroidX","centroidY","path","centroid","hasSpaceForLabel","endAngle","startAngle","pathProps","dy","fontSize","textAnchor","pointerEvents","note","clockwise","thickness","dataWithIndex","PI","handleArcMouseMove","cornerRadius","padAngle","pieSort","Text","verticalAnchor","mergedTheme","Provider"],"mappings":"yXAKA,MAAMA,EAA2B,CAChCC,gBAAiB,UACjBC,qBAAsB,UACtBC,OAAQ,CAAE,UAAW,UAAW,UAAW,UAAW,WACtDC,WAAY,CACXC,OAAQ,UACRC,YAAa,GAEdC,WAAY,EACZC,UAAW,GACXC,cAAe,ICRVC,EAAeC,EAAAA,cAA6BX,GAM5CY,EAAgB,IACPC,aAAYH,oDCT3B,MAAMI,EAAqC,EAC1CC,QACAC,SACAC,SACAC,SACAC,iBAAiB,IACjBC,MAAM,KAGLC,EAAAA,KAAG,IAA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is";import{localPoint as i}from"@visx/event";import{Group as r}from"@visx/group";import{scaleOrdinal as n,scaleBand as d,scaleLinear as c}from"@visx/scale";import{Bar as s,Pie as h}from"@visx/shape";import{useTooltip as p}from"@visx/tooltip";import m from"clsx";import{createContext as u,useContext as v,useCallback as g}from"react";import{GridRows as _,GridColumns as b}from"@visx/grid";import{LegendOrdinal as f}from"@visx/legend";import{buildChartTheme as x,XYChart as y,AnimatedGrid as w,AnimatedAxis as N,AnimatedLineSeries as T,Tooltip as L}from"@visx/xychart";import k from"@visx/shape/lib/shapes/Pie";import{Text as D}from"@visx/text";const M={backgroundColor:"#FFFFFF",labelBackgroundColor:"#FFFFFF",colors:["#98C8DF","#006DAB","#A6DC80","#1F9828","#FF8C8F"],gridStyles:{stroke:"#787C82",strokeWidth:1},tickLength:0,gridColor:"",gridColorDark:""},F=u(M),S=()=>v(F),C=({theme:l={},children:t})=>{const o={...M,...l};return e(F.Provider,{value:o,children:t})};var A="grid-control-module__grid-control__KOnZN";const O=({width:t,height:o,xScale:a,yScale:i,gridVisibility:r="x",top:n=0})=>l("g",{transform:`translate(0, ${n})`,className:A,children:[r.includes("x")&&e(_,{scale:a,width:t}),r.includes("y")&&e(b,{scale:i,height:o})]});var z={"legend--horizontal":"legend-module__legend--horizontal__IUN13","legend--vertical":"legend-module__legend--vertical__Scfzo","legend-item":"legend-module__legend-item__feemn","legend-item-swatch":"legend-module__legend-item-swatch__nRyXf","legend-item-label":"legend-module__legend-item-label__ksx6I","legend-item-value":"legend-module__legend-item-value__d9x1j"};const I={horizontal:"row",vertical:"column"},R=({items:t,className:o,orientation:a="horizontal"})=>{const i=n({domain:t.map((e=>e.label)),range:t.map((e=>e.color))});return e("div",{className:m(z.legend,z[`legend--${a}`],o),role:"list",children:e(f,{scale:i,direction:I[a],shape:"rect",shapeWidth:16,shapeHeight:16,className:z["legend-items"],children:o=>e("div",{className:z[`legend--${a}`],children:o.map((o=>{var a,i;return l("div",{className:z["legend-item"],children:[e("svg",{width:16,height:16,children:e("rect",{width:16,height:16,fill:o.value,className:z["legend-item-swatch"]})}),l("span",{className:z["legend-item-label"],children:[o.text,(null===(a=t.find((e=>e.label===o.text)))||void 0===a?void 0:a.value)&&e("span",{className:z["legend-item-value"],children:null===(i=t.find((e=>e.label===o.text)))||void 0===i?void 0:i.value})]})]},o.text)}))})})})};var B="base-tooltip-module__tooltip__OfX6n";const P=({data:e})=>l(t,{children:[null==e?void 0:e.label,": ",(null==e?void 0:e.valueDisplay)||(null==e?void 0:e.value)]}),V=({data:l,top:t,left:o,component:a=P,children:i,className:r})=>e("div",{className:B,style:{top:t,left:o},role:"tooltip",children:i||l&&e(a,{data:l,className:r})});var $={"bar-chart":"bar-chart-module__bar-chart__lmYNi","bar-chart-legend":"bar-chart-module__bar-chart-legend__vgKKq"};const K=({data:t,width:n=500,height:h=500,margin:u={top:20,right:20,bottom:40,left:40},withTooltips:v=!1,showLegend:_=!1,legendOrientation:b="horizontal",className:f,gridVisibility:x="x"})=>{var y;const w=S(),{tooltipOpen:N,tooltipLeft:T,tooltipTop:L,tooltipData:k,hideTooltip:D,showTooltip:M}=p(),F=g(((e,l,t,o,a)=>{const r=i(e);r&&M({tooltipData:{value:l,xLabel:t,yLabel:o,seriesIndex:a},tooltipLeft:r.x,tooltipTop:r.y-10})}),[M]),C=g((()=>{D()}),[D]);if(!(null==t?void 0:t.length))return e("div",{className:m("bar-chart-empty",$["bat-chart-empty"]),children:"Empty..."});const A=u,z=n-A.left-A.right,I=h-A.top-A.bottom,B=null===(y=t[0].data)||void 0===y?void 0:y.map((e=>(null==e?void 0:e.label)||"")),P=d({range:[0,z],domain:B,padding:.2}),K=d({range:[0,P.bandwidth()],domain:t.map(((e,l)=>l.toString())),padding:.1}),j=c({range:[I,0],domain:[0,Math.max(...t.map((e=>Math.max(...e.data.map((e=>(null==e?void 0:e.value)||0))))))]}),W=t.map(((e,l)=>({label:e.label,value:"",color:w.colors[l%w.colors.length]})));return l("div",{className:m("bar-chart",f,$["bar-chart"]),children:[e("svg",{width:n,height:h,children:l(r,{left:A.left,top:A.top,children:[e(O,{width:z,height:I,xScale:P,yScale:j,gridVisibility:x}),t.map(((l,t)=>e(r,{children:l.data.map((o=>{var a,i;const r=P((null==o?void 0:o.label)||"");if(void 0===r)return null;const n=K.bandwidth(),d=r+(null!==(a=K(t.toString()))&&void 0!==a?a:0);return e(s,{x:d,y:j(o.value),width:n,height:I-(null!==(i=j(o.value))&&void 0!==i?i:0),fill:w.colors[t%w.colors.length],onMouseMove:v?e=>F(e,o.value,(null==o?void 0:o.label)||"",l.label,t):void 0,onMouseLeave:v?C:void 0},`bar-${t}-${o.label}`)}))},t))),e(o,{scale:j}),e(a,{scale:P,top:I})]})}),v&&N&&k&&e(V,{top:L||0,left:T||0,children:l("div",{children:[e("div",{children:k.yLabel}),l("div",{children:[k.xLabel,": ",k.value]})]})}),_&&e(R,{items:W,orientation:b,className:$["bar-chart-legend"]})]})};K.displayName="BarChart";var j={"line-chart":"line-chart-module__line-chart__ITM3d","line-chart__tooltip":"line-chart-module__line-chart__tooltip__aqcme","line-chart__tooltip-date":"line-chart-module__line-chart__tooltip-date__4Dzab","line-chart__tooltip-row":"line-chart-module__line-chart__tooltip-row__6A37G","line-chart__tooltip-label":"line-chart-module__line-chart__tooltip-label__IvnFF"};const W=({tooltipData:t})=>{var o;const a=null===(o=null==t?void 0:t.nearestDatum)||void 0===o?void 0:o.datum;if(!a)return null;const i=Object.entries((null==t?void 0:t.datumByKey)||{}).map((([e,{datum:l}])=>({key:e,value:l.value}))).sort(((e,l)=>l.value-e.value));return l("div",{className:j["line-chart__tooltip"],children:[e("div",{className:j["line-chart__tooltip-date"],children:a.date.toLocaleDateString()}),i.map((t=>l("div",{className:j["line-chart__tooltip-row"],children:[l("span",{className:j["line-chart__tooltip-label"],children:[t.key,":"]}),e("span",{className:j["line-chart__tooltip-value"],children:t.value})]},t.key)))]})},q=e=>new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"}),E=({data:t,width:o,height:a,margin:i={top:20,right:20,bottom:40,left:40},className:r,withTooltips:n=!0,showLegend:d=!1,legendOrientation:c="horizontal"})=>{const s=S();if(!(null==t?void 0:t.length))return e("div",{className:m("line-chart-empty",j["line-chart-empty"]),children:"Empty..."});const h=t.map(((e,l)=>({label:e.label,value:"",color:s.colors[l%s.colors.length]}))),p={xAccessor:e=>e.date,yAccessor:e=>e.value},u=x({backgroundColor:s.backgroundColor,colors:s.colors,gridStyles:s.gridStyles,tickLength:(null==s?void 0:s.tickLength)||0,gridColor:(null==s?void 0:s.gridColor)||"",gridColorDark:(null==s?void 0:s.gridColorDark)||""});return l("div",{className:m("line-chart",j["line-chart"],r),children:[l(y,{theme:u,width:o,height:a,margin:i,xScale:{type:"time"},yScale:{type:"linear",nice:!0},children:[e(w,{columns:!1,numTicks:4}),e(N,{orientation:"bottom",numTicks:5,tickFormat:q}),e(N,{orientation:"left",numTicks:4}),t.map(((l,t)=>e(T,{dataKey:null==l?void 0:l.label,data:l.data,...p,stroke:u.colors[t%u.colors.length],strokeWidth:2},null==l?void 0:l.label))),n&&e(L,{snapTooltipToDatumX:!0,snapTooltipToDatumY:!0,showSeriesGlyphs:!0,renderTooltip:W})]}),d&&e(R,{items:h,orientation:c,className:j["line-chart-legend"]})]})},X=({withTooltips:e})=>{const{tooltipOpen:l,tooltipLeft:t,tooltipTop:o,tooltipData:a,hideTooltip:r,showTooltip:n}=p();return{onMouseMove:g(((l,t)=>{if(!e)return;const o=i(l);o&&n({tooltipData:t,tooltipLeft:o.x,tooltipTop:o.y-10})}),[e,n]),onMouseLeave:g((()=>{e&&r()}),[e,r]),tooltipOpen:l,tooltipData:a||null,tooltipLeft:t,tooltipTop:o}};var Y={"pie-chart":"pie-chart-module__pie-chart__R12Vh"};const G=({data:t,width:o=500,height:a=500,withTooltips:i=!1,innerRadius:n=0,className:d,showLegend:c,legendOrientation:s})=>{const p=S(),{onMouseMove:u,onMouseLeave:v,tooltipOpen:g,tooltipData:_,tooltipLeft:b,tooltipTop:f}=X({withTooltips:i}),x=Math.min(o,a)/2,y=o/2,w=a/2,N={value:e=>e.value,fill:e=>(null==e?void 0:e.color)||p.colors[e.index]},T=t.map(((e,l)=>({label:e.label,value:e.value.toString(),color:p.colors[l%p.colors.length]})));return l("div",{className:m("pie-chart",Y["pie-chart"],d),children:[e("svg",{width:o,height:a,children:e(r,{top:w,left:y,children:e(h,{data:t,pieValue:N.value,outerRadius:x-20,innerRadius:n,children:t=>t.arcs.map(((o,a)=>{const[r,n]=t.path.centroid(o),d=o.endAngle-o.startAngle>=.25,c=e=>u(e,o.data),s={d:t.path(o)||"",fill:N.fill(o)};return i&&(s.onMouseMove=c,s.onMouseLeave=v),l("g",{children:[e("path",{...s}),d&&e("text",{x:r,y:n,dy:".33em",fill:p.labelBackgroundColor||M.labelBackgroundColor,fontSize:12,textAnchor:"middle",pointerEvents:"none",children:o.data.label})]},`arc-${a}`)}))})})}),c&&e(R,{items:T,orientation:s,className:Y["pie-chart-legend"]}),i&&g&&_&&e(V,{data:_,top:f||0,left:b||0,style:{transform:"translate(-50%, -100%)"}})]})};var Z="pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9",H="pie-semi-circle-chart-module__pie-semi-circle-chart-legend__c8W1Y",Q="pie-semi-circle-chart-module__label__nPqOg",U="pie-semi-circle-chart-module__note__LpBZQ";const J=({data:t,width:o=500,label:a,note:n,className:d,withTooltips:c=!1,clockwise:s=!0,thickness:h=.4,showLegend:u,legendOrientation:v})=>{const _=S(),{tooltipOpen:b,tooltipLeft:f,tooltipTop:x,tooltipData:y,hideTooltip:w,showTooltip:N}=p(),T=o/2,L=o/2,M=o/2,F=M*(1-h+.03),C=t.map(((e,l)=>({...e,index:l}))),A=s?-Math.PI/2:Math.PI/2,O=s?Math.PI/2:-Math.PI/2,z={value:e=>e.value,sort:(e,l)=>l.value-e.value,fill:e=>e.color||_.colors[e.index%_.colors.length]},I=g(((e,l)=>{const t=i(e);t&&N({tooltipData:l.data,tooltipLeft:t.x,tooltipTop:t.y-10})}),[N]),B=g((()=>{w()}),[w]),P=g((e=>l=>{I(l,e)}),[I]),$=t.map(((e,l)=>({label:e.label,value:e.valueDisplay||e.value.toString(),color:z.fill({...e,index:l})})));return l("div",{className:m("pie-semi-circle-chart",Z,d),children:[e("svg",{width:o,height:L,children:l(r,{top:T,left:T,children:[e(k,{data:C,pieValue:z.value,outerRadius:M,innerRadius:F,cornerRadius:3,padAngle:.03,startAngle:A,endAngle:O,pieSort:z.sort,children:l=>l.arcs.map((t=>e("g",{onMouseMove:P(t),onMouseLeave:B,children:e("path",{d:l.path(t)||"",fill:z.fill(t.data)})},t.data.label)))}),l(r,{children:[e(D,{textAnchor:"middle",verticalAnchor:"start",y:-40,className:Q,children:a}),e(D,{textAnchor:"middle",verticalAnchor:"start",y:-20,className:U,children:n})]})]})}),c&&b&&y&&e(V,{data:{label:y.label,value:y.value,valueDisplay:y.valueDisplay},top:x||0,left:f||0}),u&&e(R,{items:$,orientation:v,className:H})]})};export{K as BarChart,V as BaseTooltip,R as Legend,E as LineChart,G as PieChart,J as PieSemiCircleChart,C as ThemeProvider,X as useChartMouseHandler};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/providers/theme/themes.ts","../src/providers/theme/theme-provider.tsx","../src/components/grid-control/grid-control.tsx","../src/components/legend/base-legend.tsx","../src/components/tooltip/base-tooltip.tsx","../src/components/bar-chart/bar-chart.tsx","../src/components/line-chart/line-chart.tsx","../src/hooks/use-chart-mouse-handler.ts","../src/components/pie-chart/pie-chart.tsx","../src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null],"names":["defaultTheme","backgroundColor","labelBackgroundColor","colors","gridStyles","stroke","strokeWidth","tickLength","gridColor","gridColorDark","ThemeContext","createContext","useChartTheme","useContext","ThemeProvider","theme","children","mergedTheme","_jsx","Provider","value","GridControl","width","height","xScale","yScale","gridVisibility","top","_jsxs","transform","className","styles","includes","GridRows","scale","GridColumns","orientationToFlexDirection","horizontal","vertical","BaseLegend","items","orientation","legendScale","scaleOrdinal","domain","map","item","label","range","color","clsx","legend","role","LegendOrdinal","direction","shape","shapeWidth","shapeHeight","labels","fill","text","_a","find","_b","DefaultTooltipContent","data","valueDisplay","BaseTooltip","left","component","Component","style","BarChart","margin","right","bottom","withTooltips","showLegend","legendOrientation","tooltipOpen","tooltipLeft","tooltipTop","tooltipData","hideTooltip","showTooltip","useTooltip","handleMouseMove","useCallback","event","xLabel","yLabel","seriesIndex","coords","localPoint","x","y","handleMouseLeave","length","margins","xMax","yMax","d","scaleBand","padding","innerScale","bandwidth","_","i","toString","scaleLinear","Math","max","series","legendItems","group","index","Group","xPos","undefined","barWidth","barX","Bar","onMouseMove","onMouseLeave","AxisLeft","AxisBottom","Legend","displayName","renderTooltip","nearestDatum","datum","tooltipPoints","Object","entries","datumByKey","key","sort","a","b","date","toLocaleDateString","point","formatDateTick","Date","month","day","LineChart","providerTheme","accessors","xAccessor","yAccessor","buildChartTheme","XYChart","type","nice","AnimatedGrid","columns","numTicks","AnimatedAxis","tickFormat","seriesData","AnimatedLineSeries","dataKey","Tooltip","snapTooltipToDatumX","snapTooltipToDatumY","showSeriesGlyphs","useChartMouseHandler","PieChart","innerRadius","radius","min","centerX","centerY","Pie","pieValue","outerRadius","pie","arcs","arc","centroidX","centroidY","path","centroid","hasSpaceForLabel","endAngle","startAngle","pathProps","dy","fontSize","textAnchor","pointerEvents","PieSemiCircleChart","note","clockwise","thickness","dataWithIndex","PI","handleArcMouseMove","cornerRadius","padAngle","pieSort","Text","verticalAnchor"],"mappings":"qvBAKA,MAAMA,EAA2B,CAChCC,gBAAiB,UACjBC,qBAAsB,UACtBC,OAAQ,CAAE,UAAW,UAAW,UAAW,UAAW,WACtDC,WAAY,CACXC,OAAQ,UACRC,YAAa,GAEdC,WAAY,EACZC,UAAW,GACXC,cAAe,ICRV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AKrI,KAAKsI,GACpBjK,EAAA,IAAA,CAECwG,YAAc4E,EAAoBnB,GAClCxD,aAAe3B,EAAgBhF,SAE/BE,EAAM,OAAA,CAAAmF,EAAI4E,EAAIK,KAAMH,IAAS,GAAKxH,KAAOyF,EAAUzF,KAAMwH,EAAIlH,SAJvDkH,EAAIlH,KAAKlB,WAUnBnB,EAACwF,aACAlG,EAACwL,EACA,CAAAZ,WAAW,SACXa,eAAe,QACf5G,GAAK,GACLjE,UAAYC,EAAYf,SAEtB+B,IAEH7B,EAACwL,EACA,CAAAZ,WAAW,SACXa,eAAe,QACf5G,GAAK,GACLjE,UAAYC,EAAWf,SAErBiL,YAMJrH,GAAgBG,GAAeG,GAChChE,EAACiD,EAAW,CACXF,KAAO,CACNlB,MAAOmC,EAAYnC,MACnB3B,MAAO8D,EAAY9D,MACnB8C,aAAcgB,EAAYhB,cAE3BvC,IAAMsD,GAAc,EACpBb,KAAOY,GAAe,IAItBH,GACD3D,EAAC4G,EACA,CAAAtF,MAAQyE,EACRxE,YAAcqC,EACdhD,UAAYC,MAId"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var r=require("react/jsx-runtime"),o=require("react");const e={backgroundColor:"#FFFFFF",labelBackgroundColor:"#FFFFFF",colors:["#98C8DF","#006DAB","#A6DC80","#1F9828","#FF8C8F"],gridStyles:{stroke:"#787C82",strokeWidth:1},tickLength:0,gridColor:"",gridColorDark:""},F=o.createContext(e);exports.ThemeProvider=({theme:o={},children:t})=>{const l={...e,...o};return r.jsx(F.Provider,{value:l,children:t})},exports.defaultTheme=e,exports.jetpackTheme={backgroundColor:"#FFFFFF",labelBackgroundColor:"#FFFFFF",colors:["#98C8DF","#006DAB","#A6DC80","#1F9828","#FF8C8F"],gridStyles:{stroke:"#787C82",strokeWidth:1},tickLength:0,gridColor:"",gridColorDark:""},exports.useChartTheme=()=>o.useContext(F),exports.wooTheme={backgroundColor:"#FFFFFF",labelBackgroundColor:"#FFFFFF",colors:["#80C8FF","#B999FF","#3858E9"],gridStyles:{stroke:"#787C82",strokeWidth:1},tickLength:0,gridColor:"",gridColorDark:""};
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../src/providers/theme/themes.ts","../../../src/providers/theme/theme-provider.tsx"],"sourcesContent":[null,null],"names":["defaultTheme","backgroundColor","labelBackgroundColor","colors","gridStyles","stroke","strokeWidth","tickLength","gridColor","gridColorDark","ThemeContext","createContext","theme","children","mergedTheme","_jsx","jsx","Provider","value","useContext"],"mappings":"mEAKA,MAAMA,EAA2B,CAChCC,gBAAiB,UACjBC,qBAAsB,UACtBC,OAAQ,CAAE,UAAW,UAAW,UAAW,UAAW,WACtDC,WAAY,CACXC,OAAQ,UACRC,YAAa,GAEdC,WAAY,EACZC,UAAW,GACXC,cAAe,ICRVC,EAAeC,EAAAA,cAA6BX,yBAuBF,EAAIY,QAAQ,CAAE,EAAEC,eAC/D,MAAMC,EAAc,IAAKd,KAAiBY,GAC1C,OAAOG,EAAAC,IAACN,EAAaO,SAAQ,CAACC,MAAQJ,EAAWD,SAAKA,GAAkC,8CDXxD,CAChCZ,gBAAiB,UACjBC,qBAAsB,UACtBC,OAAQ,CAAE,UAAW,UAAW,UAAW,UAAW,WACtDC,WAAY,CACXC,OAAQ,UACRC,YAAa,GAEdC,WAAY,EACZC,UAAW,GACXC,cAAe,0BClBM,IACPU,aAAYT,oBDuBE,CAC5BT,gBAAiB,UACjBC,qBAAsB,UACtBC,OAAQ,CAAE,UAAW,UAAW,WAChCC,WAAY,CACXC,OAAQ,UACRC,YAAa,GAEdC,WAAY,EACZC,UAAW,GACXC,cAAe"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{createContext as o,useContext as F}from"react";const t={backgroundColor:"#FFFFFF",labelBackgroundColor:"#FFFFFF",colors:["#98C8DF","#006DAB","#A6DC80","#1F9828","#FF8C8F"],gridStyles:{stroke:"#787C82",strokeWidth:1},tickLength:0,gridColor:"",gridColorDark:""},l={backgroundColor:"#FFFFFF",labelBackgroundColor:"#FFFFFF",colors:["#98C8DF","#006DAB","#A6DC80","#1F9828","#FF8C8F"],gridStyles:{stroke:"#787C82",strokeWidth:1},tickLength:0,gridColor:"",gridColorDark:""},e={backgroundColor:"#FFFFFF",labelBackgroundColor:"#FFFFFF",colors:["#80C8FF","#B999FF","#3858E9"],gridStyles:{stroke:"#787C82",strokeWidth:1},tickLength:0,gridColor:"",gridColorDark:""},C=o(t),d=()=>F(C),i=({theme:o={},children:F})=>{const l={...t,...o};return r(C.Provider,{value:l,children:F})};export{i as ThemeProvider,t as defaultTheme,l as jetpackTheme,d as useChartTheme,e as wooTheme};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/providers/theme/themes.ts","../../../src/providers/theme/theme-provider.tsx"],"sourcesContent":[null,null],"names":["defaultTheme","backgroundColor","labelBackgroundColor","colors","gridStyles","stroke","strokeWidth","tickLength","gridColor","gridColorDark","jetpackTheme","wooTheme","ThemeContext","createContext","useChartTheme","useContext","ThemeProvider","theme","children","mergedTheme","_jsx","Provider","value"],"mappings":"8FAKA,MAAMA,EAA2B,CAChCC,gBAAiB,UACjBC,qBAAsB,UACtBC,OAAQ,CAAE,UAAW,UAAW,UAAW,UAAW,WACtDC,WAAY,CACXC,OAAQ,UACRC,YAAa,GAEdC,WAAY,EACZC,UAAW,GACXC,cAAe,IAMVC,EAA2B,CAChCT,gBAAiB,UACjBC,qBAAsB,UACtBC,OAAQ,CAAE,UAAW,UAAW,UAAW,UAAW,WACtDC,WAAY,CACXC,OAAQ,UACRC,YAAa,GAEdC,WAAY,EACZC,UAAW,GACXC,cAAe,IAMVE,EAAuB,CAC5BV,gBAAiB,UACjBC,qBAAsB,UACtBC,OAAQ,CAAE,UAAW,UAAW,WAChCC,WAAY,CACXC,OAAQ,UACRC,YAAa,GAEdC,WAAY,EACZC,UAAW,GACXC,cAAe,ICxCVG,EAAeC,EAA6Bb,GAM5Cc,EAAgB,IACPC,EAAYH,GAgBrBI,EAA0C,EAAIC,QAAQ,CAAE,EAAEC,eAC/D,MAAMC,EAAc,IAAKnB,KAAiBiB,GAC1C,OAAOG,EAACR,EAAaS,SAAQ,CAACC,MAAQH,EAAWD,SAAKA,GAAkC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
.bar-chart-module__bar-chart__lmYNi {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
.bar-chart-module__bar-chart-legend__vgKKq {
|
|
5
|
+
margin-top: 1rem;
|
|
6
|
+
}
|
|
7
|
+
.pie-chart-module__pie-chart__R12Vh {
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 {
|
|
11
|
+
position: relative;
|
|
12
|
+
text-align: center;
|
|
13
|
+
}
|
|
14
|
+
.pie-semi-circle-chart-module__pie-semi-circle-chart-legend__c8W1Y {
|
|
15
|
+
margin-top: 1rem;
|
|
16
|
+
}
|
|
17
|
+
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module__label__nPqOg {
|
|
18
|
+
margin-bottom: 0px;
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
font-size: 16px;
|
|
21
|
+
}
|
|
22
|
+
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module__note__LpBZQ {
|
|
23
|
+
margin-top: 0px;
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
}
|
|
26
|
+
.line-chart-module__line-chart__ITM3d {
|
|
27
|
+
position: relative;
|
|
28
|
+
}
|
|
29
|
+
.line-chart-module__line-chart__tooltip__aqcme {
|
|
30
|
+
background: #fff;
|
|
31
|
+
padding: 0.5rem;
|
|
32
|
+
}
|
|
33
|
+
.line-chart-module__line-chart__tooltip-date__4Dzab {
|
|
34
|
+
font-weight: bold;
|
|
35
|
+
padding-bottom: 10px;
|
|
36
|
+
}
|
|
37
|
+
.line-chart-module__line-chart__tooltip-row__6A37G {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
padding: 4px 0;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
}
|
|
43
|
+
.line-chart-module__line-chart__tooltip-label__IvnFF {
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
padding-right: 1rem;
|
|
46
|
+
}
|
|
47
|
+
.grid-control-module__grid-control__KOnZN .visx-line {
|
|
48
|
+
stroke: #d7d6d6;
|
|
49
|
+
stroke-width: 1px;
|
|
50
|
+
shape-rendering: crispEdges;
|
|
51
|
+
}
|
|
52
|
+
.base-tooltip-module__tooltip__OfX6n {
|
|
53
|
+
padding: 0.5rem;
|
|
54
|
+
background-color: rgba(0, 0, 0, 0.85);
|
|
55
|
+
color: white;
|
|
56
|
+
border-radius: 4px;
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
59
|
+
position: absolute;
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
transform: translate(-50%, -100%);
|
|
62
|
+
}
|
|
63
|
+
.legend-module__legend--horizontal__IUN13 {
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: row;
|
|
66
|
+
flex-wrap: wrap;
|
|
67
|
+
gap: 16px;
|
|
68
|
+
}
|
|
69
|
+
.legend-module__legend--vertical__Scfzo {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
gap: 8px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.legend-module__legend-item__feemn {
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: 8px;
|
|
79
|
+
font-size: 0.875rem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.legend-module__legend-item-swatch__nRyXf {
|
|
83
|
+
border-radius: 2px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.legend-module__legend-item-label__ksx6I {
|
|
87
|
+
color: var(--jp-gray-80, #2c3338);
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
gap: 0.5rem;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.legend-module__legend-item-value__d9x1j {
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
}
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
.grid-control-module__grid-control__KOnZN .visx-line {
|
|
2
|
+
stroke: #d7d6d6;
|
|
3
|
+
stroke-width: 1px;
|
|
4
|
+
shape-rendering: crispEdges;
|
|
5
|
+
}
|
|
6
|
+
.legend-module__legend--horizontal__IUN13 {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
gap: 16px;
|
|
11
|
+
}
|
|
12
|
+
.legend-module__legend--vertical__Scfzo {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: 8px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.legend-module__legend-item__feemn {
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 8px;
|
|
22
|
+
font-size: 0.875rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.legend-module__legend-item-swatch__nRyXf {
|
|
26
|
+
border-radius: 2px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.legend-module__legend-item-label__ksx6I {
|
|
30
|
+
color: var(--jp-gray-80, #2c3338);
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: 0.5rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.legend-module__legend-item-value__d9x1j {
|
|
37
|
+
font-weight: 500;
|
|
38
|
+
}
|
|
39
|
+
.base-tooltip-module__tooltip__OfX6n {
|
|
40
|
+
padding: 0.5rem;
|
|
41
|
+
background-color: rgba(0, 0, 0, 0.85);
|
|
42
|
+
color: white;
|
|
43
|
+
border-radius: 4px;
|
|
44
|
+
font-size: 14px;
|
|
45
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
46
|
+
position: absolute;
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
transform: translate(-50%, -100%);
|
|
49
|
+
}
|
|
50
|
+
.bar-chart-module__bar-chart__lmYNi {
|
|
51
|
+
position: relative;
|
|
52
|
+
}
|
|
53
|
+
.bar-chart-module__bar-chart-legend__vgKKq {
|
|
54
|
+
margin-top: 1rem;
|
|
55
|
+
}
|
|
56
|
+
.line-chart-module__line-chart__ITM3d {
|
|
57
|
+
position: relative;
|
|
58
|
+
}
|
|
59
|
+
.line-chart-module__line-chart__tooltip__aqcme {
|
|
60
|
+
background: #fff;
|
|
61
|
+
padding: 0.5rem;
|
|
62
|
+
}
|
|
63
|
+
.line-chart-module__line-chart__tooltip-date__4Dzab {
|
|
64
|
+
font-weight: bold;
|
|
65
|
+
padding-bottom: 10px;
|
|
66
|
+
}
|
|
67
|
+
.line-chart-module__line-chart__tooltip-row__6A37G {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
padding: 4px 0;
|
|
71
|
+
justify-content: space-between;
|
|
72
|
+
}
|
|
73
|
+
.line-chart-module__line-chart__tooltip-label__IvnFF {
|
|
74
|
+
font-weight: 500;
|
|
75
|
+
padding-right: 1rem;
|
|
76
|
+
}
|
|
77
|
+
.pie-chart-module__pie-chart__R12Vh {
|
|
78
|
+
position: relative;
|
|
79
|
+
}
|
|
80
|
+
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 {
|
|
81
|
+
position: relative;
|
|
82
|
+
text-align: center;
|
|
83
|
+
}
|
|
84
|
+
.pie-semi-circle-chart-module__pie-semi-circle-chart-legend__c8W1Y {
|
|
85
|
+
margin-top: 1rem;
|
|
86
|
+
}
|
|
87
|
+
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module__label__nPqOg {
|
|
88
|
+
margin-bottom: 0px;
|
|
89
|
+
font-weight: 600;
|
|
90
|
+
font-size: 16px;
|
|
91
|
+
}
|
|
92
|
+
.pie-semi-circle-chart-module__pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module__note__LpBZQ {
|
|
93
|
+
margin-top: 0px;
|
|
94
|
+
font-size: 14px;
|
|
95
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/charts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Display charts within Automattic products.",
|
|
5
5
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/charts/#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
"test-coverage": "pnpm run test --coverage",
|
|
20
20
|
"storybook": "cd ../storybook && pnpm run storybook:dev",
|
|
21
21
|
"compile-ts": "tsc --pretty",
|
|
22
|
-
"build": "
|
|
23
|
-
"build:prod": "
|
|
22
|
+
"build": "rollup -c",
|
|
23
|
+
"build:prod": "rollup -c --environment NODE_ENV:production",
|
|
24
|
+
"build:dev": "rollup -c --environment NODE_ENV:development",
|
|
25
|
+
"build:watch": "rollup -c -w",
|
|
24
26
|
"clean-build": "rm -rf dist/"
|
|
25
27
|
},
|
|
26
28
|
"dependencies": {
|
|
@@ -36,15 +38,19 @@
|
|
|
36
38
|
"@visx/text": "3.12.0",
|
|
37
39
|
"@visx/tooltip": "^3.8.0",
|
|
38
40
|
"@visx/xychart": "3.12.0",
|
|
39
|
-
"clsx": "2.1.1"
|
|
41
|
+
"clsx": "2.1.1",
|
|
42
|
+
"tslib": "2.5.0"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
45
|
+
"@rollup/plugin-commonjs": "26.0.1",
|
|
46
|
+
"@rollup/plugin-json": "6.1.0",
|
|
47
|
+
"@rollup/plugin-node-resolve": "15.3.0",
|
|
48
|
+
"@rollup/plugin-terser": "0.4.3",
|
|
49
|
+
"@rollup/plugin-typescript": "12.1.0",
|
|
42
50
|
"@storybook/blocks": "8.4.6",
|
|
43
51
|
"@storybook/react": "8.4.6",
|
|
44
|
-
"@types/react": "18.3.
|
|
45
|
-
"@types/react-dom": "18.3.
|
|
46
|
-
"esbuild": "0.24.2",
|
|
47
|
-
"esbuild-sass-plugin": "3.3.1",
|
|
52
|
+
"@types/react": "18.3.18",
|
|
53
|
+
"@types/react-dom": "18.3.5",
|
|
48
54
|
"jest": "29.7.0",
|
|
49
55
|
"jest-environment-jsdom": "29.7.0",
|
|
50
56
|
"jest-extended": "4.0.2",
|
|
@@ -52,9 +58,13 @@
|
|
|
52
58
|
"postcss-modules": "6.0.1",
|
|
53
59
|
"react": "18.3.1",
|
|
54
60
|
"react-dom": "18.3.1",
|
|
61
|
+
"rollup": "3.29.5",
|
|
62
|
+
"rollup-plugin-dts": "6.1.1",
|
|
63
|
+
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
64
|
+
"rollup-plugin-postcss": "4.0.2",
|
|
65
|
+
"sass": "1.64.1",
|
|
55
66
|
"sass-embedded": "1.83.0",
|
|
56
67
|
"storybook": "8.4.6",
|
|
57
|
-
"tsup": "8.3.5",
|
|
58
68
|
"typescript": "5.7.2"
|
|
59
69
|
},
|
|
60
70
|
"peerDependencies": {
|
|
@@ -63,10 +73,22 @@
|
|
|
63
73
|
},
|
|
64
74
|
"exports": {
|
|
65
75
|
".": {
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
76
|
+
"import": "./dist/index.mjs",
|
|
77
|
+
"require": "./dist/index.js",
|
|
78
|
+
"types": "./dist/index.d.ts"
|
|
79
|
+
},
|
|
80
|
+
"./components/*": {
|
|
81
|
+
"import": "./dist/components/*/index.js",
|
|
82
|
+
"require": "./dist/components/*/index.cjs.js",
|
|
83
|
+
"types": "./dist/components/*/index.d.ts"
|
|
84
|
+
},
|
|
85
|
+
"./style.css": "./dist/style.css"
|
|
69
86
|
},
|
|
70
87
|
"main": "./dist/index.js",
|
|
71
|
-
"
|
|
88
|
+
"module": "./dist/index.mjs",
|
|
89
|
+
"types": "./dist/index.d.ts",
|
|
90
|
+
"sideEffects": [
|
|
91
|
+
"*.css",
|
|
92
|
+
"*.scss"
|
|
93
|
+
]
|
|
72
94
|
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// Import necessary plugins for building the library
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
+
import json from '@rollup/plugin-json';
|
|
4
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
5
|
+
import terser from '@rollup/plugin-terser';
|
|
6
|
+
import typescript from '@rollup/plugin-typescript';
|
|
7
|
+
import { defineConfig } from 'rollup';
|
|
8
|
+
import dts from 'rollup-plugin-dts';
|
|
9
|
+
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|
10
|
+
import postcss from 'rollup-plugin-postcss';
|
|
11
|
+
|
|
12
|
+
// Common plugins used across all build configurations
|
|
13
|
+
const commonPlugins = [
|
|
14
|
+
// Automatically externalize peer dependencies
|
|
15
|
+
peerDepsExternal( {
|
|
16
|
+
includeDependencies: true,
|
|
17
|
+
} ),
|
|
18
|
+
// Locate and bundle third-party dependencies from node_modules
|
|
19
|
+
resolve( {
|
|
20
|
+
preferBuiltins: true,
|
|
21
|
+
extensions: [ '.tsx', '.ts', '.js', '.jsx' ],
|
|
22
|
+
} ),
|
|
23
|
+
// Convert CommonJS modules to ES6
|
|
24
|
+
commonjs(),
|
|
25
|
+
// Allow importing JSON files
|
|
26
|
+
json(),
|
|
27
|
+
// Process SCSS/CSS modules
|
|
28
|
+
postcss( {
|
|
29
|
+
// Configure CSS modules with scoped names
|
|
30
|
+
modules: {
|
|
31
|
+
generateScopedName: '[name]__[local]__[hash:base64:5]',
|
|
32
|
+
},
|
|
33
|
+
extract: 'style.css',
|
|
34
|
+
autoModules: false,
|
|
35
|
+
use: [ 'sass' ],
|
|
36
|
+
} ),
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
// Main bundle configuration for the entire library
|
|
40
|
+
const mainConfig = {
|
|
41
|
+
// Entry point for the bundle
|
|
42
|
+
input: 'src/index.ts',
|
|
43
|
+
// Output configuration for different module formats
|
|
44
|
+
output: [
|
|
45
|
+
{
|
|
46
|
+
file: './dist/index.js',
|
|
47
|
+
format: 'cjs', // CommonJS format for Node.js
|
|
48
|
+
sourcemap: true,
|
|
49
|
+
sourcemapPathTransform: relativeSourcePath => {
|
|
50
|
+
return `/@automattic/charts/${ relativeSourcePath }`;
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
file: './dist/index.mjs',
|
|
55
|
+
format: 'esm', // ES modules for modern bundlers
|
|
56
|
+
sourcemap: true,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
// Mark all dependencies as external to avoid bundling them
|
|
60
|
+
external: [ 'react', 'react-dom', /^@visx\/.*/, '@react-spring/web', 'clsx', 'tslib' ],
|
|
61
|
+
plugins: [
|
|
62
|
+
...commonPlugins,
|
|
63
|
+
// TypeScript compilation
|
|
64
|
+
typescript( {
|
|
65
|
+
tsconfig: './tsconfig.json',
|
|
66
|
+
declaration: false, // Declarations handled by dts plugin
|
|
67
|
+
sourceMap: true,
|
|
68
|
+
compilerOptions: {
|
|
69
|
+
verbatimModuleSyntax: true,
|
|
70
|
+
},
|
|
71
|
+
} ),
|
|
72
|
+
terser(),
|
|
73
|
+
],
|
|
74
|
+
// Handle circular dependencies warning
|
|
75
|
+
onwarn( warning, warn ) {
|
|
76
|
+
if ( warning.code === 'CIRCULAR_DEPENDENCY' ) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
warn( warning );
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// List of components to build individually
|
|
84
|
+
const components = [
|
|
85
|
+
'components/bar-chart',
|
|
86
|
+
'components/line-chart',
|
|
87
|
+
'components/pie-chart',
|
|
88
|
+
'components/pie-semi-circle-chart',
|
|
89
|
+
'components/tooltip',
|
|
90
|
+
'components/legend',
|
|
91
|
+
'components/grid-control',
|
|
92
|
+
'providers/theme',
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
// Generate individual bundles for each component
|
|
96
|
+
const componentConfigs = components.map( component => ( {
|
|
97
|
+
// Component entry point - try both .tsx and .ts extensions
|
|
98
|
+
input: `src/${ component }/index`,
|
|
99
|
+
// Output both ESM and CJS formats
|
|
100
|
+
output: [
|
|
101
|
+
{
|
|
102
|
+
file: `dist/${ component }/index.js`,
|
|
103
|
+
format: 'esm',
|
|
104
|
+
sourcemap: true,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
file: `dist/${ component }/index.cjs.js`,
|
|
108
|
+
format: 'cjs',
|
|
109
|
+
sourcemap: true,
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
// Same external config as main bundle
|
|
113
|
+
external: [ 'react', 'react-dom', /^@visx\/.*/, '@react-spring/web', 'clsx', 'tslib' ],
|
|
114
|
+
plugins: [
|
|
115
|
+
...commonPlugins,
|
|
116
|
+
typescript( {
|
|
117
|
+
tsconfig: './tsconfig.json',
|
|
118
|
+
declaration: false,
|
|
119
|
+
sourceMap: true,
|
|
120
|
+
compilerOptions: {
|
|
121
|
+
verbatimModuleSyntax: true,
|
|
122
|
+
},
|
|
123
|
+
} ),
|
|
124
|
+
terser(),
|
|
125
|
+
],
|
|
126
|
+
} ) );
|
|
127
|
+
|
|
128
|
+
// Configuration for generating TypeScript declaration files
|
|
129
|
+
const typesConfig = {
|
|
130
|
+
input: 'src/index.ts',
|
|
131
|
+
output: [ { file: 'dist/index.d.ts', format: 'es' } ],
|
|
132
|
+
plugins: [
|
|
133
|
+
dts( {
|
|
134
|
+
respectExternal: true,
|
|
135
|
+
} ),
|
|
136
|
+
],
|
|
137
|
+
// Don't include style imports in type definitions
|
|
138
|
+
external: [ /\.scss$/, /\.css$/, 'react', '@types/react' ],
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// Export all configurations to be built in parallel
|
|
142
|
+
export default defineConfig( [ mainConfig, ...componentConfigs, typesConfig ] );
|
|
@@ -19,8 +19,8 @@ type BarChartTooltipData = { value: number; xLabel: string; yLabel: string; seri
|
|
|
19
19
|
|
|
20
20
|
const BarChart: FC< BarChartProps > = ( {
|
|
21
21
|
data,
|
|
22
|
-
width,
|
|
23
|
-
height,
|
|
22
|
+
width = 500, //TODO: replace when making the components responsive
|
|
23
|
+
height = 500, //TODO: replace when making the components responsive
|
|
24
24
|
margin = { top: 20, right: 20, bottom: 40, left: 40 },
|
|
25
25
|
withTooltips = false,
|
|
26
26
|
showLegend = false,
|
|
@@ -65,7 +65,7 @@ const BarChart: FC< BarChartProps > = ( {
|
|
|
65
65
|
const yMax = height - margins.top - margins.bottom;
|
|
66
66
|
|
|
67
67
|
// Get labels for x-axis from the first series (assuming all series have same labels)
|
|
68
|
-
const labels = data[ 0 ].data?.map( d => d?.label );
|
|
68
|
+
const labels = data[ 0 ].data?.map( d => d?.label || '' );
|
|
69
69
|
|
|
70
70
|
// Create scales
|
|
71
71
|
const xScale = scaleBand< string >( {
|
|
@@ -109,14 +109,14 @@ const BarChart: FC< BarChartProps > = ( {
|
|
|
109
109
|
{ data.map( ( series, seriesIndex ) => (
|
|
110
110
|
<Group key={ seriesIndex }>
|
|
111
111
|
{ series.data.map( d => {
|
|
112
|
-
const xPos = xScale( d
|
|
112
|
+
const xPos = xScale( d?.label || '' );
|
|
113
113
|
if ( xPos === undefined ) return null;
|
|
114
114
|
|
|
115
115
|
const barWidth = innerScale.bandwidth();
|
|
116
116
|
const barX = xPos + ( innerScale( seriesIndex.toString() ) ?? 0 );
|
|
117
117
|
|
|
118
|
-
const handleBarMouseMove = event =>
|
|
119
|
-
handleMouseMove( event, d.value, d
|
|
118
|
+
const handleBarMouseMove = ( event: MouseEvent< SVGRectElement > ) =>
|
|
119
|
+
handleMouseMove( event, d.value, d?.label || '', series.label, seriesIndex );
|
|
120
120
|
|
|
121
121
|
return (
|
|
122
122
|
<Bar
|
|
@@ -139,7 +139,7 @@ const BarChart: FC< BarChartProps > = ( {
|
|
|
139
139
|
</svg>
|
|
140
140
|
|
|
141
141
|
{ withTooltips && tooltipOpen && tooltipData && (
|
|
142
|
-
<BaseTooltip top={ tooltipTop } left={ tooltipLeft }>
|
|
142
|
+
<BaseTooltip top={ tooltipTop || 0 } left={ tooltipLeft || 0 }>
|
|
143
143
|
<div>
|
|
144
144
|
<div>{ tooltipData.yLabel }</div>
|
|
145
145
|
<div>
|