@automattic/charts 0.11.4 → 0.12.1
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 +39 -0
- package/dist/cjs/components/bar-chart/bar-chart.js +1 -1
- package/dist/cjs/components/bar-chart/bar-chart.js.map +1 -1
- package/dist/cjs/components/bar-chart/use-bar-chart-options.js +2 -0
- package/dist/cjs/components/bar-chart/use-bar-chart-options.js.map +1 -0
- package/dist/cjs/components/bar-list-chart/bar-list-chart.js +2 -0
- package/dist/cjs/components/bar-list-chart/bar-list-chart.js.map +1 -0
- package/dist/cjs/components/legend/base-legend.js +1 -1
- package/dist/cjs/components/legend/base-legend.js.map +1 -1
- package/dist/cjs/components/legend/legend.module.scss.js +1 -1
- package/dist/cjs/components/legend/utils.js +2 -0
- package/dist/cjs/components/legend/utils.js.map +1 -0
- package/dist/cjs/components/line-chart/line-chart.js +1 -1
- package/dist/cjs/components/line-chart/line-chart.js.map +1 -1
- package/dist/cjs/components/pie-chart/pie-chart.js +1 -1
- package/dist/cjs/components/pie-chart/pie-chart.js.map +1 -1
- package/dist/cjs/components/pie-semi-circle-chart/pie-semi-circle-chart.js +1 -1
- package/dist/cjs/components/pie-semi-circle-chart/pie-semi-circle-chart.js.map +1 -1
- package/dist/cjs/components/shared/use-chart-margin.js +2 -0
- package/dist/cjs/components/shared/use-chart-margin.js.map +1 -0
- package/dist/cjs/components/shared/utils.js +2 -0
- package/dist/cjs/components/shared/utils.js.map +1 -0
- package/dist/cjs/components/shared/with-responsive.js +1 -1
- package/dist/cjs/components/shared/with-responsive.js.map +1 -1
- package/dist/cjs/index.css +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/providers/theme/theme-provider.js +1 -1
- package/dist/cjs/providers/theme/theme-provider.js.map +1 -1
- package/dist/index.d.ts +160 -32
- package/dist/mjs/components/bar-chart/bar-chart.js +1 -1
- package/dist/mjs/components/bar-chart/bar-chart.js.map +1 -1
- package/dist/mjs/components/bar-chart/use-bar-chart-options.js +2 -0
- package/dist/mjs/components/bar-chart/use-bar-chart-options.js.map +1 -0
- package/dist/mjs/components/bar-list-chart/bar-list-chart.js +2 -0
- package/dist/mjs/components/bar-list-chart/bar-list-chart.js.map +1 -0
- package/dist/mjs/components/legend/base-legend.js +1 -1
- package/dist/mjs/components/legend/base-legend.js.map +1 -1
- package/dist/mjs/components/legend/legend.module.scss.js +1 -1
- package/dist/mjs/components/legend/utils.js +2 -0
- package/dist/mjs/components/legend/utils.js.map +1 -0
- package/dist/mjs/components/line-chart/line-chart.js +1 -1
- package/dist/mjs/components/line-chart/line-chart.js.map +1 -1
- package/dist/mjs/components/pie-chart/pie-chart.js +1 -1
- package/dist/mjs/components/pie-chart/pie-chart.js.map +1 -1
- package/dist/mjs/components/pie-semi-circle-chart/pie-semi-circle-chart.js +1 -1
- package/dist/mjs/components/pie-semi-circle-chart/pie-semi-circle-chart.js.map +1 -1
- package/dist/mjs/components/shared/use-chart-margin.js +2 -0
- package/dist/mjs/components/shared/use-chart-margin.js.map +1 -0
- package/dist/mjs/components/shared/utils.js +2 -0
- package/dist/mjs/components/shared/utils.js.map +1 -0
- package/dist/mjs/components/shared/with-responsive.js +1 -1
- package/dist/mjs/components/shared/with-responsive.js.map +1 -1
- package/dist/mjs/index.css +1 -1
- package/dist/mjs/index.js +1 -1
- package/dist/mjs/providers/theme/theme-provider.js +1 -1
- package/dist/mjs/providers/theme/theme-provider.js.map +1 -1
- package/package.json +20 -20
- package/rollup.config.mjs +1 -0
- package/src/components/bar-chart/bar-chart.tsx +93 -146
- package/src/components/bar-chart/use-bar-chart-options.ts +130 -0
- package/src/components/bar-list-chart/bar-list-chart.tsx +295 -0
- package/src/components/bar-list-chart/index.tsx +1 -0
- package/src/components/legend/base-legend.tsx +83 -54
- package/src/components/legend/legend.module.scss +0 -5
- package/src/components/legend/legend.test.tsx +10 -1
- package/src/components/legend/types.ts +7 -4
- package/src/components/legend/utils.ts +46 -0
- package/src/components/line-chart/line-chart.module.scss +8 -0
- package/src/components/line-chart/line-chart.tsx +57 -53
- package/src/components/pie-chart/pie-chart.tsx +3 -3
- package/src/components/pie-semi-circle-chart/pie-semi-circle-chart.module.scss +2 -2
- package/src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx +4 -1
- package/src/components/shared/use-chart-margin.tsx +64 -0
- package/src/components/shared/utils.ts +25 -0
- package/src/components/shared/with-responsive.tsx +2 -2
- package/src/declarations.d.ts +5 -0
- package/src/index.ts +14 -1
- package/src/providers/theme/index.ts +1 -1
- package/src/providers/theme/theme-provider.tsx +20 -3
- package/src/types.ts +49 -15
- package/webpack.config.cjs +6 -1
- package/dist/cjs/components/grid-control/grid-control.js +0 -2
- package/dist/cjs/components/grid-control/grid-control.js.map +0 -1
- package/dist/cjs/components/grid-control/grid-control.module.scss.js +0 -2
- package/dist/cjs/components/grid-control/grid-control.module.scss.js.map +0 -1
- package/dist/mjs/components/grid-control/grid-control.js +0 -2
- package/dist/mjs/components/grid-control/grid-control.js.map +0 -1
- package/dist/mjs/components/grid-control/grid-control.module.scss.js +0 -2
- package/dist/mjs/components/grid-control/grid-control.module.scss.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,43 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.12.1] - 2025-06-06
|
|
9
|
+
### Fixed
|
|
10
|
+
- Fix @automattic/number-formatters dependency issue [#43813]
|
|
11
|
+
|
|
12
|
+
## [0.12.0] - 2025-06-06
|
|
13
|
+
### Added
|
|
14
|
+
- Add bar list chart component [#43763]
|
|
15
|
+
- Added support for customizable legend shapes/styles [#43792]
|
|
16
|
+
- Charts: Expose types from the charts library and visx package [#43723]
|
|
17
|
+
- Enhance BarChart component to support horizontal orientation [#43741]
|
|
18
|
+
- Support tick dasharray overridden by series data [#43761]
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Add dynamic chart margin calculation and improve Y-axis tick formatting [#43679]
|
|
22
|
+
- Refactor BarChart to use @visx/xychart [#43677]
|
|
23
|
+
- Update dependencies. [#43068]
|
|
24
|
+
- Update package dependencies. [#43326]
|
|
25
|
+
- Update package dependencies. [#43354]
|
|
26
|
+
- Update package dependencies. [#43398]
|
|
27
|
+
- Update package dependencies. [#43399]
|
|
28
|
+
- Update package dependencies. [#43400]
|
|
29
|
+
- Update package dependencies. [#43516]
|
|
30
|
+
- Update package dependencies. [#43578]
|
|
31
|
+
- Update package dependencies. [#43718]
|
|
32
|
+
- Update package dependencies. [#43734]
|
|
33
|
+
- Update package dependencies. [#43766]
|
|
34
|
+
|
|
35
|
+
### Removed
|
|
36
|
+
- Removed animation for line and bar charts [#43809]
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- Charts: use color set from the data for the stroke as legend if available and fallback to theme color if it was not available [#43772]
|
|
40
|
+
- Fix @rollup/plugin-typescript warnings [#43742]
|
|
41
|
+
- Fixed smoothing is not working when specified [#43810]
|
|
42
|
+
- Fix tooltip causing horizontal scrollbars to appear [#43613]
|
|
43
|
+
- Linting: Fix more Stylelint violations. [#43213]
|
|
44
|
+
|
|
8
45
|
## [0.11.4] - 2025-04-10
|
|
9
46
|
### Changed
|
|
10
47
|
- Internal updates.
|
|
@@ -179,6 +216,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
179
216
|
- Fixed lints following ESLint rule changes for TS [#40584]
|
|
180
217
|
- Fixing a bug in Chart storybook data. [#40640]
|
|
181
218
|
|
|
219
|
+
[0.12.1]: https://github.com/Automattic/charts/compare/v0.12.0...v0.12.1
|
|
220
|
+
[0.12.0]: https://github.com/Automattic/charts/compare/v0.11.4...v0.12.0
|
|
182
221
|
[0.11.4]: https://github.com/Automattic/charts/compare/v0.11.3...v0.11.4
|
|
183
222
|
[0.11.3]: https://github.com/Automattic/charts/compare/v0.11.2...v0.11.3
|
|
184
223
|
[0.11.2]: https://github.com/Automattic/charts/compare/v0.11.1...v0.11.2
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),a=require("@visx/
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),a=require("@visx/xychart"),r=require("clsx"),s=require("react"),t=require("../../providers/theme/theme-provider.js"),i=require("../legend/base-legend.js"),l=require("../shared/use-chart-margin.js"),o=require("../shared/with-responsive.js"),c=require("./bar-chart.module.scss.js"),n=require("./use-bar-chart-options.js");var d=o.withResponsive((({data:o,width:d,height:h=400,className:u,margin:p,withTooltips:m=!1,showLegend:x=!1,legendOrientation:b="horizontal",legendShape:g="rect",gridVisibility:v,renderTooltip:j,options:y={},orientation:N="vertical"})=>{const T="horizontal"===N,_=t.useChartTheme(),S=t.useXYChartTheme(o),q=n.useBarChartOptions(o,T,y),w=l.useChartMargin(h,q,o,S,T),A=s.useCallback((({tooltipData:a})=>{const r=a?.nearestDatum?.datum;return r?e.jsxs("div",{className:c["bar-chart__tooltip"],children:[e.jsx("div",{className:c["bar-chart__tooltip-header"],children:a?.nearestDatum?.key}),e.jsxs("div",{className:c["bar-chart__tooltip-row"],children:[e.jsxs("span",{className:c["bar-chart__tooltip-label"],children:[q.tooltip.labelFormatter(r.label||r.date.getTime(),0,[]),":"]}),e.jsx("span",{className:c["bar-chart__tooltip-value"],children:r.value})]})]}):null}),[q.tooltip]),C=(e=>e?.length?e.some((e=>e.data.some((e=>null===e.value||void 0===e.value||isNaN(e.value)||!e.label&&(!e.date||isNaN(e.date.getTime()))))))?"Invalid data":null:"No data available")(o);if(C)return e.jsx("div",{className:r("bar-chart",c["bar-chart"]),children:C});const D=o.map(((e,a)=>({label:e.label,value:"",color:e.options?.stroke||S.colors[a%S.colors.length],shapeStyle:e?.options?.legendShapeStyle??_.legendShapeStyles?.[a]??{}}))),B=v??q.gridVisibility;return e.jsxs("div",{className:r("bar-chart",c["bar-chart"],u),"data-testid":"bar-chart",role:"img","aria-label":"bar chart",children:[e.jsxs(a.XYChart,{theme:S,width:d,height:h,margin:{...w,...p},xScale:q.xScale,yScale:q.yScale,horizontal:T,pointerEventsDataKey:"nearest",children:[e.jsx(a.Grid,{columns:B.includes("y"),rows:B.includes("x"),numTicks:4}),e.jsx(a.BarGroup,{padding:q.barGroup.padding,children:o.map((r=>e.jsx(a.BarSeries,{dataKey:r?.label,data:r.data,yAccessor:q.accessors.yAccessor,xAccessor:q.accessors.xAccessor},r?.label)))}),e.jsx(a.Axis,{...q.axis.x}),e.jsx(a.Axis,{...q.axis.y}),m&&e.jsx(a.Tooltip,{detectBounds:!0,snapTooltipToDatumX:!0,snapTooltipToDatumY:!0,renderTooltip:j||A})]}),x&&e.jsx(i.BaseLegend,{items:D,orientation:b,className:c["bar-chart__legend"],shape:g})]})}));module.exports=d;
|
|
2
2
|
//# sourceMappingURL=bar-chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-chart.js","sources":["/@automattic/charts/../../../../src/components/bar-chart/bar-chart.tsx"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"bar-chart.js","sources":["/@automattic/charts/../../../../src/components/bar-chart/bar-chart.tsx"],"sourcesContent":[null],"names":["withResponsive","data","width","height","className","margin","withTooltips","showLegend","legendOrientation","legendShape","gridVisibility","gridVisibilityProp","renderTooltip","options","orientation","horizontal","providerTheme","useChartTheme","theme","useXYChartTheme","chartOptions","useBarChartOptions","defaultMargin","useChartMargin","renderDefaultTooltip","useCallback","tooltipData","nearestDatum","datum","_jsxs","jsxs","styles","children","_jsx","key","tooltip","labelFormatter","label","date","getTime","value","error","length","some","series","d","undefined","isNaN","validateData","clsx","legendItems","map","group","index","color","stroke","colors","shapeStyle","legendShapeStyle","legendShapeStyles","role","XYChart","xScale","yScale","pointerEventsDataKey","Grid","columns","includes","rows","numTicks","BarGroup","padding","barGroup","seriesData","jsx","BarSeries","dataKey","yAccessor","accessors","xAccessor","Axis","axis","x","y","Tooltip","detectBounds","snapTooltipToDatumX","snapTooltipToDatumY","Legend","items","shape"],"mappings":"gXAmKA,IAAeA,EAAAA,EAAAA,gBA/HuB,EACrCC,OACAC,QACAC,SAAS,IACTC,YACAC,SACAC,gBAAe,EACfC,cAAa,EACbC,oBAAoB,aACpBC,cAAc,OACdC,eAAgBC,EAChBC,gBACAC,UAAU,CAAA,EACVC,cAAc,eAEd,MAAMC,EAA6B,eAAhBD,EACbE,EAAgBC,EAAAA,gBAChBC,EAAQC,kBAAiBlB,GACzBmB,EAAeC,EAAkBA,mBAAEpB,EAAMc,EAAYF,GACrDS,EAAgBC,EAAAA,eAAgBpB,EAAQiB,EAAcnB,EAAMiB,EAAOH,GAEnES,EAAuBC,EAAAA,aAC5B,EAAIC,kBACH,MAAMC,EAAeD,GAAaC,cAAcC,MAChD,OAAOD,EAGNE,EAAKC,KAAA,MAAA,CAAA1B,UAAY2B,EAAQ,sBACxBC,SAAA,CAAAC,EAAAA,IAAA,MAAA,CAAK7B,UAAY2B,EAAQ,6BACtBC,SAAAN,GAAaC,cAAcO,MAE9BL,EAAAC,KAAA,MAAA,CAAK1B,UAAY2B,EAAQ,0BACxBC,SAAA,CAAAH,EAAAA,KAAA,OAAA,CAAMzB,UAAY2B,EAAQ,4BACvBC,SAAA,CAAAZ,EAAae,QAAQC,eACtBT,EAAaU,OAASV,EAAaW,KAAKC,UACxC,EACA,WAIFN,EAAAA,IAAA,OAAA,CAAM7B,UAAY2B,EAAQ,4BAA4BC,SAAKL,EAAaa,cAhB9C,IAmB3B,GAEH,CAAEpB,EAAae,UAIVM,EAlEc,CAAExC,GACfA,GAAMyC,OAEUzC,EAAK0C,MAAMC,GACjCA,EAAO3C,KAAK0C,MACXE,GACa,OAAZA,EAAEL,YACUM,IAAZD,EAAEL,OACFO,MAAOF,EAAEL,SACLK,EAAER,SAAaQ,EAAEP,MAAQS,MAAOF,EAAEP,K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KE,IAE3B7E,GACD2B,MAACmD,EAAAA,SACAC,cAAY,EACZC,qBAAmB,EACnBC,qBACA,EAAA3E,cAAgBA,GAAiBY,OAKlCjB,GACD0B,MAACuD,EAAAA,WAAM,CACNC,MAAQvC,EACRpC,YAAcN,EACdJ,UAAY2B,EAAQ,qBACpB2D,MAAQjF,MAIV"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("@automattic/number-formatters"),r=require("react");const e=t=>new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"});exports.useBarChartOptions=function(a,i,o={}){const c=r.useMemo((()=>{const r={type:"band",padding:.2,paddingInner:.1},i={type:"linear",nice:!0,zero:!1},o=a?.[0]?.data?.[0]?.label?t=>t:e,c=t.formatNumberCompact,s=t=>t?.label||t?.date,n=t=>t?.value;return{vertical:{xTickFormat:o,yTickFormat:c,tooltipLabelFormatter:o,xAccessor:s,yAccessor:n,gridVisibility:"y",xScale:r,yScale:i},horizontal:{xTickFormat:c,yTickFormat:o,tooltipLabelFormatter:o,xAccessor:n,yAccessor:s,gridVisibility:"x",xScale:i,yScale:r}}}),[a]);return r.useMemo((()=>{const t=i?"horizontal":"vertical",{xTickFormat:r,yTickFormat:e,tooltipLabelFormatter:a,xAccessor:s,yAccessor:n,gridVisibility:l,xScale:m,yScale:y}=c[t],x={...m,...o.xScale||{}},d={...y,...o.yScale||{}},u=i?o.axis?.y?.tickFormat:o.axis?.x?.tickFormat;return{gridVisibility:l,xScale:x,yScale:d,accessors:{xAccessor:s,yAccessor:n},axis:{x:{orientation:"bottom",numTicks:4,tickFormat:r,...o.axis?.x||{}},y:{orientation:"left",numTicks:4,tickFormat:e,...o.axis?.y||{}}},barGroup:{padding:(b=i?d:x,"number"==typeof b.paddingInner?b.paddingInner:0)},tooltip:{labelFormatter:u||a}};var b}),[c,o,i])};
|
|
2
|
+
//# sourceMappingURL=use-bar-chart-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-bar-chart-options.js","sources":["/@automattic/charts/../../../../src/components/bar-chart/use-bar-chart-options.ts"],"sourcesContent":[null],"names":["formatDateTick","timestamp","Date","toLocaleDateString","undefined","month","day","data","horizontal","options","defaultOptions","useMemo","bandScale","type","padding","paddingInner","linearScale","nice","zero","labelFormatter","label","valueFormatter","formatNumberCompact","labelAccessor","d","date","valueAccessor","value","vertical","xTickFormat","yTickFormat","tooltipLabelFormatter","xAccessor","yAccessor","gridVisibility","xScale","yScale","orientationKey","defaultTooltipLabelFormatter","baseXScale","baseYScale","providedToolTipLabelFormatter","axis","y","tickFormat","x","accessors","orientation","numTicks","barGroup","scale","tooltip"],"mappings":"+EAKA,MAAMA,EAAmBC,GACX,IAAIC,KAAMD,GACXE,wBAAoBC,EAAW,CAC1CC,MAAO,QACPC,IAAK,uCAsBD,SACLC,EACAC,EACAC,EAAuC,CAAA,GAEvC,MAAMC,EAAiBC,EAAAA,SAAS,KAC/B,MAAMC,EAAY,CACjBC,KAAM,OACNC,QAAS,GACTC,aAAc,IAETC,EAAc,CACnBH,KAAM,SACNI,MAAM,EACNC,MAAM,GAGDC,EAAiBZ,IAAQ,IAAKA,OAAQ,IAAKa,MAC5CA,GAAmBA,EACrBpB,EACGqB,EAAiBC,EAAAA,oBAEjBC,EAAkBC,GAAsBA,GAAGJ,OAASI,GAAGC,KACvDC,EAAkBF,GAAsBA,GAAGG,MAEjD,MAAO,CACNC,SAAU,CACTC,YAAaV,EACbW,YAAaT,EACbU,sBAAuBZ,EACvBa,UAAWT,EACXU,UAAWP,EACXQ,eAAgB,IAChBC,OAAQvB,EACRwB,OAAQpB,GAETR,WAAY,CACXqB,YAAaR,EACbS,YAAaX,EACbY,sBAAuBZ,EACvBa,UAAWN,EACXO,UAAWV,EACXW,eAAgB,IAChBC,OAAQnB,EACRoB,OAAQxB,GAET,GACC,CAAEL,IAEL,OAAOI,EAAOA,SAAE,KACf,MAAM0B,EAAiB7B,EAAa,aAAe,YAC7CqB,YACLA,EAAWC,YACXA,EACAC,sBAAuBO,EAA4BN,UACnDA,EAASC,UACTA,EAASC,eACTA,EACAC,OAAQI,EACRH,OAAQI,GACL9B,EAAgB2B,GAEdF,EAAS,IAAKI,KAAiB9B,EAAQ0B,QAAU,CAAE,GACnDC,EAAS,IAAKI,KAAiB/B,EAAQ2B,QAAU,CAAE,GACnDK,EAAgCjC,EACnCC,EAAQiC,MAAMC,GAAGC,WACjBnC,EAAQiC,MAAMG,GAAGD,WAEpB,MAAO,CACNV,iBACAC,SACAC,SACAU,UAAW,CACVd,YACAC,aAEDS,KAAM,CACLG,EAAG,CACFE,YAAa,SACbC,SAAU,EACVJ,WAAYf,KACPpB,EAAQiC,MAAMG,GAAK,IAEzBF,EAAG,CACFI,YAAa,OACbC,SAAU,EACVJ,WAAYd,KACPrB,EAAQiC,MAAMC,GAAK,KAG1BM,SAAU,CACTnC,SAvGsBoC,EAuGI1C,EAAa4B,EAASD,EAtGd,iBAAvBe,EAAMnC,aAA8BmC,EAAMnC,aAA2B,IAwGjFoC,QAAS,CACRhC,eAAgBsB,GAAiCH,IA1G7B,IAAEY,CA4GvB,GACC,CAAExC,EAAgBD,EAASD,GAC/B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("@automattic/number-formatters"),r=require("@visx/group"),a=require("@visx/scale"),o=require("@visx/text"),n=require("react"),i=require("../bar-chart/bar-chart.js"),l=require("../shared/with-responsive.js");const s=e=>{const t=e;return t&&"bandwidth"in t?t?.bandwidth()??0:0},u=({textProps:t,x:r,y:a,label:n,formatter:i})=>e.jsx(o.Text,{...t,textAnchor:"start",x:r,y:a,children:i(n)}),d=({textProps:t,x:r,y:a,value:n,formatter:i})=>e.jsx(o.Text,{...t,textAnchor:"end",x:r,y:a,fontWeight:500,children:i(n)}),c=({ticks:t,tickLabelProps:a,yOffset:o,labelPosition:n,valuePosition:i,data:l,labelFormatter:s,valueFormatter:c,LabelComponent:m=u,ValueComponent:x=d})=>{if(0===t.length)return null;const p=t.map((({value:e,index:r})=>"function"==typeof a?a(e,r,t):{}));return t.map((({from:t,formattedValue:a},u)=>{const d=p[u]??{};delete d.textAnchor,delete d.dx;const b=l.reduce(((e,{data:t})=>e+(t[u]?.value??0)),0),h=t.y+o;return e.jsxs(r.Group,{children:[e.jsx(m,{textProps:d,x:n,y:h,label:a,formatter:s}),e.jsx(x,{textProps:d,x:i,y:h,value:b,formatter:c,data:l,index:u})]},u)}))},m=(e,t,r,o)=>{if(!o)return 0;const n=e.map((({label:e})=>e)),i=a.createScale({type:"band",range:[0,r],domain:n,...t}),l=a.scaleBand({domain:n,range:[0,s(i)],padding:t.paddingInner});return-(s(l)+6)};var x=l.withResponsive((({data:r,width:a,height:o,options:l={},margin:s={left:0,right:20,bottom:0,top:0},...u})=>{const d=n.useMemo((()=>{const e=r.length>1,n={...{paddingInner:e?.3:.1,padding:e?.3:.1},...l.yScale??{}};return{yScale:n,xScale:{zero:!0,...l.xScale??{}},labelPosition:l.labelPosition??(e?0:10),valueFormatter:l.valueFormatter??(e=>t.formatNumberCompact(e)),labelFormatter:l.labelFormatter??(e=>String(e)),valuePosition:l.valuePosition??a,yOffset:l.yOffset??m(r,n,o,e)}}),[l,a,r,o]);return e.jsx(i,{orientation:"horizontal",gridVisibility:"none",data:r,width:a,height:o,margin:s,options:{axis:{y:{children:t=>e.jsx(c,{...t,data:r,yOffset:d.yOffset,labelPosition:d.labelPosition,valuePosition:d.valuePosition,labelFormatter:d.labelFormatter,valueFormatter:d.valueFormatter,LabelComponent:l.labelComponent,ValueComponent:l.valueComponent})},x:{children:()=>null}},xScale:d.xScale,yScale:d.yScale},...u})}));module.exports=x;
|
|
2
|
+
//# sourceMappingURL=bar-list-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bar-list-chart.js","sources":["/@automattic/charts/../../../../src/components/bar-list-chart/bar-list-chart.tsx"],"sourcesContent":[null],"names":["getScaleBandwidth","scale","s","bandwidth","DefaultLabelComponent","textProps","x","y","label","formatter","_jsx","Text","textAnchor","children","DefaultValueComponent","value","fontWeight","AxisRenderer","ticks","tickLabelProps","yOffset","labelPosition","valuePosition","data","labelFormatter","valueFormatter","LabelComponent","ValueComponent","length","allTickLabelProps","map","index","from","formattedValue","dx","sum","reduce","acc","seriesData","_jsxs","Group","getDefaultYOffset","yScaleConfig","height","isMultiSeries","dataKeys","yScale","createScale","type","range","domain","groupScale","scaleBand","padding","paddingInner","withResponsive","width","options","margin","left","right","bottom","top","rest","chartOptions","useMemo","xScale","zero","formatNumberCompact","String","BarChart","orientation","gridVisibility","axis","renderProps","labelComponent","valueComponent"],"mappings":"yQAqFA,MAAMA,EAAiDC,IAEtD,MAAMC,EAAID,EACV,OAAOC,GAAK,cAAeA,EAAIA,GAAGC,aAAe,EAAI,CAAC,EAGjDC,EAAwB,EAAIC,YAAWC,IAAGC,IAAGC,QAAOC,eAExDC,EAAAA,IAACC,EAAAA,KAAU,IAAAN,EAAYO,WAAW,QAAQN,EAAIA,EAAIC,EAAIA,EACnDM,SAAAJ,EAAWD,KAKVM,EAAwB,EAAIT,YAAWC,IAAGC,IAAGQ,QAAON,eAExDC,EAAAA,IAACC,EAAAA,KAAI,IAAMN,EAAYO,WAAW,MAAMN,EAAIA,EAAIC,EAAIA,EAAIS,WAAa,IAAGH,SACrEJ,EAAWM,KAKVE,EAAe,EACpBC,QACAC,iBACAC,UACAC,gBACAC,gBACAC,OACAC,iBACAC,iBACAC,iBAAiBtB,EACjBuB,iBAAiBb,MAWjB,GAAsB,IAAjBI,EAAMU,OACV,OAAO,KAIR,MAAMC,EAAoBX,EAAMY,KAAK,EAAIf,QAAOgB,WACrB,mBAAnBZ,EAAgCA,EAAgBJ,EAAOgB,EAAOb,GAAU,CAAA,IAGhF,OAAOA,EAAMY,KAAK,EAAIE,OAAMC,kBAAkBF,KAC7C,MAAM1B,EAAYwB,EAAmBE,IAAW,CAAA,SAEzC1B,EAAUO,kBACVP,EAAU6B,GAEj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CAAMV,GAASqD,EAAmBA,oBAAErD,IAC1ES,eAAgBiC,EAAQjC,gBAAc,CAAMT,GAASsD,OAAQtD,IAC7DO,cAAemC,EAAQnC,eAAiBkC,EACxCpC,QAASqC,EAAQrC,SAAWqB,EAAmBlB,EAAMuB,EAAQH,EAAQC,GACrE,GACC,CAAEa,EAASD,EAAOjC,EAAMoB,IAE3B,OACCjC,EAAAA,IAAC4D,EAAQ,CACRC,YAAY,aACZC,eAAiB,OACjBjD,KAAOA,EACPiC,MAAQA,EACRb,OAASA,EACTe,OAASA,EACTD,QAAU,CACTgB,KAAM,CACLlE,EAAG,CACFM,SAAY6D,GACXhE,EAAAA,IAACO,EACK,IAAAyD,EACLnD,KAAOA,EACPH,QAAU4C,EAAa5C,QACvBC,cAAgB2C,EAAa3C,cAC7BC,cAAgB0C,EAAa1C,cAC7BE,eAAiBwC,EAAaxC,eAC9BC,eAAiBuC,EAAavC,eAC9BC,eAAiB+B,EAAQkB,eACzBhD,eAAiB8B,EAAQmB,kBAI5BtE,EAAG,CACFO,SAAU,IAAM,OAGlBqD,OAAQF,EAAaE,OACrBpB,OAAQkB,EAAalB,WAEjBiB,GAEL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),l=require("@visx/legend"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),l=require("@visx/legend"),a=require("@visx/scale"),i=require("clsx"),t=require("react"),r=require("./legend.module.scss.js"),n=require("./utils.js");const s={horizontal:"row",vertical:"column"};exports.BaseLegend=({items:d,className:m,orientation:c="horizontal",shape:g="rect",fill:o=n.valueOrIdentityString,size:x=n.valueOrIdentityString,labelFormat:h=n.valueOrIdentity,labelTransform:u=n.labelTransformFactory,shapeWidth:p=16,shapeHeight:b=16,shapeMargin:f="2px 4px 2px 0",labelAlign:v="left",labelFlex:j="1",labelMargin:q="0 4px",itemMargin:y="0",itemDirection:L="row",legendLabelProps:I,...N})=>{const O=a.scaleOrdinal({domain:d.map((e=>e.label)),range:d.map((e=>e.color))}),S=O.domain(),z=t.useCallback((({index:e})=>d[e]?.shapeStyle??{}),[d]);return e.jsx(l.LegendOrdinal,{scale:O,labelFormat:h,labelTransform:u,children:a=>e.jsx("div",{role:"list","data-testid":`legend-${c}`,className:i(r.legend,r[`legend--${c}`],m),style:{flexDirection:s[c]},children:a.map(((a,i)=>e.jsxs(l.LegendItem,{className:r["legend-item"],"data-testid":"legend-item",margin:y,flexDirection:L,...N,children:[e.jsx(l.LegendShape,{shape:g,height:b,width:p,margin:f,item:S[i],itemIndex:i,label:a,fill:o,size:x,shapeStyle:z}),e.jsxs(l.LegendLabel,{label:a.text,flex:j,margin:q,align:v,className:r["legend-item-label"],...I,children:[a.text,d.find((e=>e.label===a.text))?.value&&e.jsx("span",{className:r["legend-item-value"],children:d.find((e=>e.label===a.text))?.value})]})]},`legend-${a.text}-${i}`)))})})};
|
|
2
2
|
//# sourceMappingURL=base-legend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-legend.js","sources":["/@automattic/charts/../../../../src/components/legend/base-legend.tsx"],"sourcesContent":[null],"names":["orientationToFlexDirection","horizontal","vertical","items","className","orientation","legendScale","scaleOrdinal","domain","map","item","label","range","color","
|
|
1
|
+
{"version":3,"file":"base-legend.js","sources":["/@automattic/charts/../../../../src/components/legend/base-legend.tsx"],"sourcesContent":[null],"names":["orientationToFlexDirection","horizontal","vertical","items","className","orientation","shape","fill","valueOrIdentityString","size","labelFormat","valueOrIdentity","labelTransform","labelTransformFactory","shapeWidth","shapeHeight","shapeMargin","labelAlign","labelFlex","labelMargin","itemMargin","itemDirection","legendLabelProps","legendItemProps","legendScale","scaleOrdinal","domain","map","item","label","range","color","getShapeStyle","useCallback","index","shapeStyle","_jsx","LegendOrdinal","scale","children","labels","jsx","role","clsx","styles","legend","style","flexDirection","i","_jsxs","jsxs","LegendItem","margin","LegendShape","height","width","itemIndex","LegendLabel","text","flex","align","find","value"],"mappings":"qMAQA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HiB,SAAA,CAAAV,EAAM6B,KACNvD,EAAM0D,MAAMjC,GAAQA,EAAKC,QAAUA,EAAM6B,QAAQI,OAClD1B,EAAAA,IAAM,OAAA,CAAAhC,UAAYwC,EAAQ,qBAAqBL,SAC5CpC,EAAM0D,MAAMjC,GAAQA,EAAKC,QAAUA,EAAM6B,QAAQI,aA5BhD,UAAWjC,EAAM6B,QAAUV,UAqCrC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";module.exports={"legend--horizontal":"legend-module_legend--horizontal__IUN13","legend--vertical":"legend-module_legend--vertical__Scfzo","legend-item":"legend-module_legend-item__feemn","legend-item-
|
|
1
|
+
"use strict";module.exports={"legend--horizontal":"legend-module_legend--horizontal__IUN13","legend--vertical":"legend-module_legend--vertical__Scfzo","legend-item":"legend-module_legend-item__feemn","legend-item-label":"legend-module_legend-item-label__ksx6I","legend-item-value":"legend-module_legend-item-value__d9x1j"};
|
|
2
2
|
//# sourceMappingURL=legend.module.scss.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"value"in e&&void 0!==e.value?e.value:e}require("@visx/scale"),exports.labelTransformFactory=function({scale:e,labelFormat:t}){return(r,n)=>({datum:r,index:n,text:`${t(r,n)}`,value:e(r)})},exports.valueOrIdentity=e,exports.valueOrIdentityString=function(t){return String(e(t))};
|
|
2
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["/@automattic/charts/../../../../src/components/legend/utils.ts"],"sourcesContent":[null],"names":["valueOrIdentity","_","value","scale","labelFormat","d","i","datum","index","text","String"],"mappings":"aAUM,SAAUA,EAAsBC,GACrC,OAAKA,GAAkB,iBAANA,GAAkB,UAAWA,QAAwB,IAAZA,EAAEC,MACpDD,EAAEC,MACHD,CACR,gEAkBmEE,MAClEA,EAAKC,YACLA,IAKA,MAAO,CAAEC,EAAGC,KAAS,CACpBC,MAAOF,EACPG,MAAOF,EACPG,KAAM,GAAIL,EAAaC,EAAGC,KAC1BJ,MAAOC,EAAOE,IAEhB,0DAxBM,SAAsCJ,GAC3C,OAAOS,OAAQV,EAAiBC,GACjC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("@
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("@automattic/number-formatters"),a=require("@visx/curve"),r=require("@visx/gradient"),i=require("@visx/xychart"),s=require("clsx"),n=require("react"),o=require("../../providers/theme/theme-provider.js"),l=require("../legend/base-legend.js"),c=require("../shared/use-chart-margin.js"),u=require("../shared/with-responsive.js"),d=require("./line-chart.module.scss.js");const h=(e,t)=>{if(!e)return t?a.curveCatmullRom:a.curveLinear;switch(e){case"smooth":return a.curveCatmullRom;case"monotone":return a.curveMonotoneX;default:return a.curveLinear}},m=({tooltipData:t})=>{const a=t?.nearestDatum?.datum;if(!a)return null;const r=Object.entries(t?.datumByKey||{}).map((([e,{datum:t}])=>({key:e,value:t.value}))).sort(((e,t)=>t.value-e.value));return e.jsxs("div",{className:d["line-chart__tooltip"],children:[e.jsx("div",{className:d["line-chart__tooltip-date"],children:a.date?.toLocaleDateString()}),r.map((t=>e.jsxs("div",{className:d["line-chart__tooltip-row"],children:[e.jsxs("span",{className:d["line-chart__tooltip-label"],children:[t.key,":"]}),e.jsx("span",{className:d["line-chart__tooltip-value"],children:t.value})]},t.key)))]})},p=e=>new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"});var v=u.withResponsive((({data:a,width:u,height:v,className:x,margin:g,withTooltips:y=!0,showLegend:j=!1,legendOrientation:S="horizontal",legendShape:T="line",withGradientFill:N=!1,smoothing:b=!0,curveType:w,renderTooltip:q=m,options:k={},onPointerDown:L,onPointerUp:f,onPointerMove:D,onPointerOut:_})=>{const P=o.useChartTheme(),C=o.useXYChartTheme(a),M=n.useId(),O=n.useMemo((()=>a.map((e=>({...e,data:e.data.sort(((e,t)=>e.date.getTime()-t.date.getTime()))})))),[a]),A=n.useMemo((()=>({axis:{x:{orientation:"bottom",numTicks:Math.min(O[0]?.data.length,Math.ceil(u/100)),tickFormat:p,...k?.axis?.x},y:{orientation:"left",numTicks:4,tickFormat:t.formatNumberCompact,...k?.axis?.y}},xScale:{type:"time",...k?.xScale},yScale:{type:"linear",nice:!0,zero:!1,...k?.yScale}})),[k,O,u]),G=c.useChartMargin(v,A,O,C),X=(e=>e?.length?e.some((e=>e.data.some((e=>isNaN(e.value)||null===e.value||void 0===e.value||isNaN(e.date.getTime())))))?"Invalid data":null:"No data available")(O);if(X)return e.jsx("div",{className:s("line-chart",d["line-chart"]),children:X});const $=O.map(((e,t)=>({label:e.label,value:"",color:e?.options?.stroke??P.colors[t%P.colors.length],shapeStyle:e?.options?.legendShapeStyle??P.legendShapeStyles?.[t]??{}}))),B={xAccessor:e=>e?.date,yAccessor:e=>e?.value};return e.jsxs("div",{className:s("line-chart",d["line-chart"],x),"data-testid":"line-chart",role:"img","aria-label":"line chart",children:[e.jsxs(i.XYChart,{theme:C,width:u,height:v,margin:{...G,...g},xScale:A.xScale,yScale:A.yScale,onPointerDown:L,onPointerUp:f,onPointerMove:D,onPointerOut:_,pointerEventsDataKey:"nearest",children:[e.jsx(i.Grid,{columns:!1,numTicks:4}),e.jsx(i.Axis,{...A.axis.x}),e.jsx(i.Axis,{...A.axis.y}),O.map(((t,a)=>{const s=t.options?.stroke??C.colors[a%C.colors.length],n=t.options?.seriesLineStyle??P?.seriesLineStyles?.[a%P.seriesLineStyles.length]??{};return e.jsxs("g",{children:[N&&e.jsx(r.LinearGradient,{id:`area-gradient-${M}-${a+1}`,from:s,fromOpacity:.4,toOpacity:.1,to:C.backgroundColor,...t.options?.gradient,"data-testid":"line-gradient"}),e.jsx(i.AreaSeries,{dataKey:t?.label,data:t.data,...B,fill:N?`url(#area-gradient-${M}-${a+1})`:"transparent",renderLine:!0,curve:h(w,b),lineProps:n},t?.label)]},t?.label||a)})),y&&e.jsx(i.Tooltip,{detectBounds:!0,snapTooltipToDatumX:!0,snapTooltipToDatumY:!0,showSeriesGlyphs:!0,renderTooltip:q})]}),j&&e.jsx(l.BaseLegend,{items:$,orientation:S,className:d["line-chart-legend"],shape:T})]})}));module.exports=v;
|
|
2
2
|
//# sourceMappingURL=line-chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-chart.js","sources":["/@automattic/charts/../../../../src/components/line-chart/line-chart.tsx"],"sourcesContent":[null],"names":["getCurveType","type","smoothing","curveCatmullRom","curveLinear","curveMonotoneX","renderDefaultTooltip","tooltipData","nearestDatum","datum","tooltipPoints","Object","entries","datumByKey","map","key","value","sort","a","b","_jsxs","jsxs","className","styles","children","_jsx","date","toLocaleDateString","point","formatDateTick","timestamp","Date","undefined","month","day","withResponsive","data","width","height","margin","withTooltips","showLegend","legendOrientation","withGradientFill","curveType","renderTooltip","options","onPointerDown","onPointerUp","onPointerMove","onPointerOut","providerTheme","useChartTheme","chartId","useId","dataSorted","useMemo","series","getTime","
|
|
1
|
+
{"version":3,"file":"line-chart.js","sources":["/@automattic/charts/../../../../src/components/line-chart/line-chart.tsx"],"sourcesContent":[null],"names":["getCurveType","type","smoothing","curveCatmullRom","curveLinear","curveMonotoneX","renderDefaultTooltip","tooltipData","nearestDatum","datum","tooltipPoints","Object","entries","datumByKey","map","key","value","sort","a","b","_jsxs","jsxs","className","styles","children","_jsx","date","toLocaleDateString","point","formatDateTick","timestamp","Date","undefined","month","day","withResponsive","data","width","height","margin","withTooltips","showLegend","legendOrientation","legendShape","withGradientFill","curveType","renderTooltip","options","onPointerDown","onPointerUp","onPointerMove","onPointerOut","providerTheme","useChartTheme","theme","useXYChartTheme","chartId","useId","dataSorted","useMemo","series","getTime","chartOptions","axis","x","orientation","numTicks","Math","min","length","ceil","tickFormat","y","formatNumberCompact","xScale","yScale","nice","zero","defaultMargin","useChartMargin","error","some","isNaN","validateData","clsx","legendItems","group","index","label","color","stroke","colors","shapeStyle","legendShapeStyle","legendShapeStyles","accessors","xAccessor","d","yAccessor","role","XYChart","pointerEventsDataKey","jsx","Grid","columns","Axis","seriesData","lineProps","seriesLineStyle","seriesLineStyles","LinearGradient","id","from","fromOpacity","toOpacity","to","backgroundColor","gradient","AreaSeries","dataKey","fill","renderLine","curve","Tooltip","detectBounds","snapTooltipToDatumX","snapTooltipToDatumY","showSeriesGlyphs","Legend","BaseLegend","items","shape"],"mappings":"yaAkBA,MASMA,EAAe,CAAEC,EAAkBC,KAExC,IAAOD,EACN,OAAOC,EAAYC,EAAeA,gBAAGC,cAItC,OAASH,GACR,IAAK,SACJ,OAAOE,kBACR,IAAK,WACJ,OAAOE,iBAGR,QACC,OAAOD,cACR,EAeIE,EAAuB,EAC5BC,kBAUA,MAAMC,EAAeD,GAAaC,cAAcC,MAChD,IAAOD,EAAe,OAAO,KAE7B,MAAME,EAAgCC,OAAOC,QAASL,GAAaM,YAAc,CAAA,GAC/EC,KAAK,EAAIC,GAAON,aAAiB,CACjCM,MACAC,MAAOP,EAAMO,UAEbC,MAAM,CAAEC,EAAGC,IAAOA,EAAEH,MAAQE,EAAEF,QAEhC,OACCI,EAAKC,KAAA,MAAA,CAAAC,UAAYC,EAAQ,uBACxBC,SAAA,CAAAC,EAAAA,IAAA,MAAA,CAAKH,UAAYC,EAAQ,4BACtBC,SAAAhB,EAAakB,MAAMC,uBAEpBjB,EAAcI,KAAKc,GACpBR,EAAAC,KAAA,MAAA,CAAuBC,UAAYC,EAAQ,2BAC1CC,SAAA,CAAAJ,EAAAC,KAAA,OAAA,CAAMC,UAAYC,EAAQ,6BAA6BC,SAAA,CAAKI,EAAMb,IAAa,OAC/EU,EAAAA,YAAMH,UAAYC,EAAQ,6BAA6BC,SAAKI,EAAMZ,UAFxDY,EAAMb,SAMlB,EAGGc,EAAmBC,GACX,IAAIC,KAAMD,GACXH,wBAAoBK,EAAW,CAC1CC,MAAO,QACPC,IAAK,YA8LP,IAAeC,EAAAA,EAAAA,gBA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uB,YAAc,GACdC,UAAY,GACZC,GAAK7D,EAAM8D,mBACNV,EAAW3D,SAASsE,SAAQ,cACrB,kBAGd5F,EAAAA,IAAC6F,EAAAA,WAAU,CAEVC,QAAUb,GAAYlB,MACtBpD,KAAOsE,EAAWtE,QACb2D,EACLyB,KACC5E,EACG,sBAAuBY,KAAa+B,EAAQ,KAC5C,cAEJkC,YAAa,EACbC,MAAQ1H,EAAc6C,EAAW3C,GACjCyG,UAAYA,GAXND,GAAYlB,SAbXkB,GAAYlB,OAASD,EA2B7B,IAGD/C,GACDf,EAAC6E,IAAAqB,EAAOA,QACP,CAAAC,cACA,EAAAC,uBACAC,qBAAmB,EACnBC,kBAAgB,EAChBjF,cAAgBA,OAKjBL,GACDhB,EAAC6E,IAAA0B,EAAMC,WACN,CAAAC,MAAQ7C,EACRpB,YAAcvB,EACdpB,UAAYC,EAAQ,qBACpB4G,MAAQxF,MAIV"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),a=require("@visx/group"),s=require("@visx/shape"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),a=require("@visx/group"),s=require("@visx/shape"),t=require("clsx"),r=require("../../hooks/use-chart-mouse-handler.js"),i=require("../../providers/theme/theme-provider.js"),l=require("../../providers/theme/themes.js"),o=require("../legend/base-legend.js"),n=require("../shared/with-responsive.js"),d=require("../tooltip/base-tooltip.js"),c=require("./pie-chart.module.scss.js");const h=({data:n,withTooltips:h=!1,className:u,showLegend:p,legendOrientation:m,legendShape:g="circle",size:v,thickness:x=1,padding:j=20,gapScale:f=0,cornerScale:M=0,children:q=null})=>{const b=i.useChartTheme(),{onMouseMove:w,onMouseLeave:N,tooltipOpen:T,tooltipData:V,tooltipLeft:A,tooltipTop:B}=r({withTooltips:h}),{isValid:L,message:R}=(e=>{if(!e.length)return{isValid:!1,message:"No data available"};if(e.some((e=>e.percentage<0||e.value<0)))return{isValid:!1,message:"Invalid data: Negative values are not allowed"};const a=e.reduce(((e,a)=>e+a.percentage),0);return Math.abs(a-100)>.01?{isValid:!1,message:"Invalid percentage total: Must equal 100"}:{isValid:!0,message:""}})(n);if(!L)return e.jsx("div",{className:t("pie-chart",c["pie-chart"],u),children:e.jsx("div",{className:c["error-message"],children:R})});const S=v,k=v,y=Math.min(S,k)/2,C=S/2,I=k/2,P=f*(2*Math.PI/n.length),$=y-j,z=$*(1-x),O=($-z)/2,D=M?Math.min(M*$,O):0,E=n.map(((e,a)=>({...e,index:a}))),G={value:e=>e.value,fill:e=>e?.color||b.colors[e.index]},Y=n.map(((e,a)=>({label:e.label,value:e.value.toString(),color:b.colors[a%b.colors.length]})));return e.jsxs("div",{className:t("pie-chart",c["pie-chart"],u),children:[e.jsx("svg",{viewBox:`0 0 ${v} ${v}`,preserveAspectRatio:"xMidYMid meet",width:v,height:v,children:e.jsxs(a.Group,{top:I,left:C,children:[e.jsx(s.Pie,{data:E,pieValue:G.value,outerRadius:$,innerRadius:z,padAngle:P,cornerRadius:D,children:a=>a.arcs.map(((s,t)=>{const[r,i]=a.path.centroid(s),o=s.endAngle-s.startAngle>=.25,n=e=>w(e,s.data),d={d:a.path(s)||"",fill:G.fill(s.data)};return h&&(d.onMouseMove=n,d.onMouseLeave=N),e.jsxs("g",{children:[e.jsx("path",{...d}),o&&e.jsx("text",{x:r,y:i,dy:".33em",fill:b.labelBackgroundColor||l.defaultTheme.labelBackgroundColor,fontSize:12,textAnchor:"middle",pointerEvents:"none",children:s.data.label})]},`arc-${t}`)}))}),q]})}),p&&e.jsx(o.BaseLegend,{items:Y,orientation:m,className:c["pie-chart-legend"],shape:g}),h&&T&&V&&e.jsx(d.BaseTooltip,{data:V,top:B||0,left:A||0,style:{transform:"translate(-50%, -100%)"}})]})};h.displayName="PieChart";var u=n.withResponsive(h);module.exports=u;
|
|
2
2
|
//# sourceMappingURL=pie-chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie-chart.js","sources":["/@automattic/charts/../../../../src/components/pie-chart/pie-chart.tsx"],"sourcesContent":[null],"names":["PieChart","data","withTooltips","className","showLegend","legendOrientation","size","thickness","padding","gapScale","cornerScale","children","providerTheme","useChartTheme","onMouseMove","onMouseLeave","tooltipOpen","tooltipData","tooltipLeft","tooltipTop","useChartMouseHandler","isValid","message","length","some","item","percentage","value","totalPercentage","reduce","sum","Math","abs","validateData","_jsx","jsx","clsx","styles","width","height","radius","min","centerX","centerY","padAngle","PI","outerRadius","innerRadius","maxCornerRadius","cornerRadius","dataWithIndex","map","d","index","accessors","fill","color","colors","legendItems","label","toString","_jsxs","viewBox","preserveAspectRatio","Group","top","left","Pie","pieValue","pie","arcs","arc","centroidX","centroidY","path","centroid","hasSpaceForLabel","endAngle","startAngle","handleMouseMove","event","pathProps","jsxs","x","y","dy","labelBackgroundColor","defaultTheme","fontSize","textAnchor","pointerEvents","Legend","
|
|
1
|
+
{"version":3,"file":"pie-chart.js","sources":["/@automattic/charts/../../../../src/components/pie-chart/pie-chart.tsx"],"sourcesContent":[null],"names":["PieChart","data","withTooltips","className","showLegend","legendOrientation","legendShape","size","thickness","padding","gapScale","cornerScale","children","providerTheme","useChartTheme","onMouseMove","onMouseLeave","tooltipOpen","tooltipData","tooltipLeft","tooltipTop","useChartMouseHandler","isValid","message","length","some","item","percentage","value","totalPercentage","reduce","sum","Math","abs","validateData","_jsx","jsx","clsx","styles","width","height","radius","min","centerX","centerY","padAngle","PI","outerRadius","innerRadius","maxCornerRadius","cornerRadius","dataWithIndex","map","d","index","accessors","fill","color","colors","legendItems","label","toString","_jsxs","viewBox","preserveAspectRatio","Group","top","left","Pie","pieValue","pie","arcs","arc","centroidX","centroidY","path","centroid","hasSpaceForLabel","endAngle","startAngle","handleMouseMove","event","pathProps","jsxs","x","y","dy","labelBackgroundColor","defaultTheme","fontSize","textAnchor","pointerEvents","Legend","items","orientation","shape","BaseTooltip","style","transform","displayName","withResponsive"],"mappings":"0aAuDA,MA2BMA,EAAW,EAChBC,OACAC,gBA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XC,WAAW,SACXC,cAAc,OAEZ/E,SAAA4D,EAAIvE,KAAK2D,UAdL,OAAQN,IAkBhB,MAKH1C,OAIFR,GACD+B,MAACyD,EAAAA,WAAM,CACNC,MAAQlC,EACRmC,YAAczF,EACdF,UAAYmC,EAAQ,oBACpByD,MAAQzF,IAIRJ,GAAgBe,GAAeC,GAChCiB,EAAAA,IAAC6D,EAAAA,YACA,CAAA/F,KAAOiB,EACPgD,IAAM9C,GAAc,EACpB+C,KAAOhD,GAAe,EACtB8E,MAAQ,CACPC,UAAW,8BAKd,EAGHlG,EAASmG,YAAc,WACvB,IAAeC,EAAAA,EAAAA,eAAiCpG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),a=require("@visx/event"),t=require("@visx/group"),i=require("@visx/shape"),l=require("@visx/text"),s=require("@visx/tooltip"),r=require("clsx"),o=require("react"),c=require("../../providers/theme/theme-provider.js"),d=require("../legend/base-legend.js"),n=require("../shared/with-responsive.js"),h=require("../tooltip/base-tooltip.js"),p=require("./pie-semi-circle-chart.module.scss.js");const u=({data:n,width:u=400,thickness:v=.4,clockwise:m=!0,withTooltips:x=!1,showLegend:g=!1,legendOrientation:j="horizontal",
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),a=require("@visx/event"),t=require("@visx/group"),i=require("@visx/shape"),l=require("@visx/text"),s=require("@visx/tooltip"),r=require("clsx"),o=require("react"),c=require("../../providers/theme/theme-provider.js"),d=require("../legend/base-legend.js"),n=require("../shared/with-responsive.js"),h=require("../tooltip/base-tooltip.js"),p=require("./pie-semi-circle-chart.module.scss.js");const u=({data:n,width:u=400,thickness:v=.4,clockwise:m=!0,withTooltips:x=!1,showLegend:g=!1,legendOrientation:j="horizontal",legendShape:b="circle",label:q,note:w,className:N})=>{const T=c.useChartTheme(),{tooltipOpen:f,tooltipLeft:M,tooltipTop:y,tooltipData:A,hideTooltip:P,showTooltip:C}=s.useTooltip(),I=o.useCallback(((e,t)=>{const i=a.localPoint(e);i&&C({tooltipData:t.data,tooltipLeft:i.x,tooltipTop:i.y-10})}),[C]),V=o.useCallback((()=>{P()}),[P]),k=o.useCallback((e=>a=>{I(a,e)}),[I]),{isValid:D,message:L}=(e=>e.length?e.some((e=>e.percentage<0||e.value<0))?{isValid:!1,message:"Invalid data: Negative values are not allowed"}:e.reduce(((e,a)=>e+a.percentage),0)<=0?{isValid:!1,message:"Invalid percentage total: Must be greater than 0"}:{isValid:!0,message:""}:{isValid:!1,message:"No data available"})(n);if(!D)return e.jsx("div",{className:p["pie-semi-circle-chart"],children:e.jsx("svg",{width:u,height:u/2,"data-testid":"pie-chart-svg",children:e.jsx("text",{x:"50%",y:"50%",textAnchor:"middle",className:p.error,children:L})})});const R=u/2,S=.03,B=u-.06,G=R-S,O=Math.min(B,2*G)/2,$=O*(1-v+S),z=n.map(((e,a)=>({...e,index:a}))),E=m?-Math.PI/2:Math.PI/2,F=m?Math.PI/2:-Math.PI/2,H={value:e=>e.value,sort:(e,a)=>a.value-e.value,fill:e=>e.color||T.colors[e.index%T.colors.length]},J=n.map(((e,a)=>({label:e.label,value:e.valueDisplay||e.value.toString(),color:H.fill({...e,index:a})})));return e.jsxs("div",{className:r("pie-semi-circle-chart",p["pie-semi-circle-chart"],N),"data-testid":"pie-chart-container",children:[e.jsx("svg",{width:u,height:R,viewBox:`0 0 ${u} ${R}`,"data-testid":"pie-chart-svg",children:e.jsxs(t.Group,{top:O,left:O,children:[e.jsx(i.Pie,{data:z,pieValue:H.value,outerRadius:O,innerRadius:$,cornerRadius:3,padAngle:S,startAngle:E,endAngle:F,pieSort:H.sort,children:a=>a.arcs.map((t=>e.jsx("g",{onMouseMove:k(t),onMouseLeave:V,children:e.jsx("path",{d:a.path(t)||"",fill:H.fill(t.data),"data-testid":"pie-segment"})},t.data.label)))}),e.jsxs(t.Group,{children:[e.jsx(l.Text,{textAnchor:"middle",verticalAnchor:"start",y:-40,className:p.label,children:q}),e.jsx(l.Text,{textAnchor:"middle",verticalAnchor:"start",y:-20,className:p.note,children:w})]})]})}),x&&f&&A&&e.jsx(h.BaseTooltip,{data:{label:A.label,value:A.value,valueDisplay:A.valueDisplay},top:y||0,left:M||0}),g&&e.jsx(d.BaseLegend,{items:J,orientation:j,className:p["pie-semi-circle-chart-legend"],shape:b})]})};u.displayName="PieSemiCircleChart";var v=n.withResponsive(u);module.exports=v;
|
|
2
2
|
//# sourceMappingURL=pie-semi-circle-chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie-semi-circle-chart.js","sources":["/@automattic/charts/../../../../src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx"],"sourcesContent":[null],"names":["PieSemiCircleChart","data","width","thickness","clockwise","withTooltips","showLegend","legendOrientation","label","note","className","providerTheme","useChartTheme","tooltipOpen","tooltipLeft","tooltipTop","tooltipData","hideTooltip","showTooltip","useTooltip","handleMouseMove","useCallback","event","arc","coords","localPoint","x","y","handleMouseLeave","handleArcMouseMove","isValid","message","length","some","item","percentage","value","reduce","sum","validateData","_jsx","styles","children","height","jsx","textAnchor","error","pad","chartWidth","chartHeight","radius","Math","min","innerRadius","dataWithIndex","map","d","index","startAngle","PI","endAngle","accessors","sort","a","b","fill","color","colors","legendItems","valueDisplay","toString","_jsxs","clsx","viewBox","Group","top","left","Pie","pieValue","outerRadius","cornerRadius","padAngle","pieSort","pie","arcs","onMouseMove","onMouseLeave","path","Text","verticalAnchor","BaseTooltip","Legend","items","orientation","displayName","withResponsive"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pie-semi-circle-chart.js","sources":["/@automattic/charts/../../../../src/components/pie-semi-circle-chart/pie-semi-circle-chart.tsx"],"sourcesContent":[null],"names":["PieSemiCircleChart","data","width","thickness","clockwise","withTooltips","showLegend","legendOrientation","legendShape","label","note","className","providerTheme","useChartTheme","tooltipOpen","tooltipLeft","tooltipTop","tooltipData","hideTooltip","showTooltip","useTooltip","handleMouseMove","useCallback","event","arc","coords","localPoint","x","y","handleMouseLeave","handleArcMouseMove","isValid","message","length","some","item","percentage","value","reduce","sum","validateData","_jsx","styles","children","height","jsx","textAnchor","error","pad","chartWidth","chartHeight","radius","Math","min","innerRadius","dataWithIndex","map","d","index","startAngle","PI","endAngle","accessors","sort","a","b","fill","color","colors","legendItems","valueDisplay","toString","_jsxs","clsx","viewBox","Group","top","left","Pie","pieValue","outerRadius","cornerRadius","padAngle","pieSort","pie","arcs","onMouseMove","onMouseLeave","path","Text","verticalAnchor","BaseTooltip","Legend","items","orientation","shape","displayName","withResponsive"],"mappings":"obAmDA,MAoBMA,EAAoD,EACzDC,OACAC,QAAQ,IACRC,YAAY,GACZC,aAAY,EACZC,gBAAe,EACfC,cAAa,EACbC,oBAAoB,aACpBC,cAAc,SACdC,QACAC,OACAC,gBAEA,MAAMC,EAAgBC,EAAAA,iBAChBC,YAAEA,EAAWC,YAAEA,EAAWC,WAAEA,EAAUC,YAAEA,EAAWC,YAAEA,EAAWC,YAAEA,GACvEC,EAAAA,aAEKC,EAAkBC,EAAAA,aACvB,CAAEC,EAAyBC,KAC1B,MAAMC,EAASC,aAAYH,GACpBE,GAEPN,EAAa,CACZF,YAAaO,EAAIvB,KACjBc,YAAaU,EAAOE,EACpBX,WAAYS,EAAOG,EAAI,IACrB,GAEJ,CAAET,IAGGU,EAAmBP,EAAAA,aAAa,KACrCJ,GAAa,GACX,CAAEA,IAECY,EAAqBR,EAAWA,aACnCE,GAAoBD,IACrBF,EAAiBE,EAAOC,EAAK,GAE9B,CAAEH,KAIGU,QAAEA,EAAOC,QAAEA,GA/DG,CAAE/B,GACfA,EAAKgC,OAKchC,EAAKiC,MAAMC,GAAQA,EAAKC,WAAa,GAAKD,EAAKE,MAAQ,IAEzE,CAAEN,SAAS,EAAOC,QAAS,iDAIX/B,EAAKqC,QAAQ,CAAEC,EAAKJ,IAAUI,EAAMJ,EAAKC,YAAY,IACrD,EAChB,CAAEL,SAAS,EAAOC,QAAS,oDAG5B,CAAED,SAAS,EAAMC,QA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utils.js");exports.useChartMargin=(i,r,s,o,n=!1)=>{const c=e.useMemo((()=>{const e=s.flatMap((t=>t.data));if(n)return e.map((t=>t.label||r.axis?.y?.tickFormat(t.date.getTime(),0,[])));const a=Math.min(...e.map((t=>t.value))),o=Math.max(...e.map((t=>t.value))),c=t.createScale({...r.yScale,domain:[a,o],range:[i,0]});return t.getTicks(c,r.axis?.y?.numTicks)}),[r,s,i,n]);return e.useMemo((()=>{const t={top:10,right:20,bottom:20,left:20},e=r.axis?.y?.orientation,i="right"===e?o.axisStyles.y.right:o.axisStyles.y.left,s=(a.getLongestTickWidth(c,r.axis?.y?.tickFormat,i.axisLabel)??40)+(i?.tickLength??0);return"right"===e?t.right=s:t.left=s,"top"===r.axis?.x?.orientation&&(t.top=20,t.bottom=10),t}),[r,o,c])};
|
|
2
|
+
//# sourceMappingURL=use-chart-margin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-chart-margin.js","sources":["/@automattic/charts/../../../../src/components/shared/use-chart-margin.tsx"],"sourcesContent":[null],"names":["height","options","data","theme","horizontal","yTicks","useMemo","allDataPoints","flatMap","series","map","d","label","axis","y","tickFormat","date","getTime","minY","Math","min","value","maxY","max","yScale","createScale","domain","range","getTicks","numTicks","defaultMargin","top","right","bottom","left","yAxisOrientation","orientation","yAxisStyles","axisStyles","yMarginValue","getLongestTickWidth","axisLabel","tickLength","x"],"mappings":"4GAM8B,CAC7BA,EACAC,EACAC,EACAC,EACAC,GAAsB,KAEtB,MAAMC,EAASC,EAAAA,SAAS,KACvB,MAAMC,EAAgBL,EAAKM,SAASC,GAAUA,EAAOP,OAErD,GAAKE,EAEJ,OAAOG,EAAcG,KACpBC,GAAKA,EAAEC,OAASX,EAAQY,MAAMC,GAAGC,WAAYJ,EAAEK,KAAKC,UAAW,EAAG,MAIpE,MAAMC,EAAOC,KAAKC,OAAQb,EAAcG,KAAKC,GAAKA,EAAEU,SAC9CC,EAAOH,KAAKI,OAAQhB,EAAcG,KAAKC,GAAKA,EAAEU,SAC9CG,EAASC,EAAAA,YAAa,IACxBxB,EAAQuB,OACXE,OAAQ,CAAER,EAAMI,GAChBK,MAAO,CAAE3B,EAAQ,KAGlB,OAAO4B,EAAAA,SAAUJ,EAAQvB,EAAQY,MAAMC,GAAGe,SAAU,GAClD,CAAE5B,EAASC,EAAMF,EAAQI,IAE5B,OAAOE,EAAOA,SAAE,KAEf,MAAMwB,EAAgB,CAAEC,IAAK,GAAIC,MAAO,GAAIC,OAAQ,GAAIC,KAAM,IAIxDC,EAAmBlC,EAAQY,MAAMC,GAAGsB,YACpCC,EACgB,UAArBF,EAA+BhC,EAAMmC,WAAWxB,EAAEkB,MAAQ7B,EAAMmC,WAAWxB,EAAEoB,KAMxEK,GALaC,sBAClBnC,EACAJ,EAAQY,MAAMC,GAAGC,WACjBsB,EAAYI,YATY,KAWmCJ,GAAaK,YAAc,GAavF,MAX0B,UAArBP,EACJL,EAAcE,MAAQO,EAEtBT,EAAcI,KAAOK,EAGgB,QAAjCtC,EAAQY,MAAM8B,GAAGP,cACrBN,EAAcC,IAAM,GACpBD,EAAcG,OAAS,IAGjBH,CAAa,GAClB,CAAE7B,EAASE,EAAOE,GAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["/@automattic/charts/../../../../src/components/shared/utils.ts"],"sourcesContent":[null],"names":["ticks","formatTick","labelStyle","formattedTicks","map","tick","longestTick","reduce","longest","current","length","getStringWidth"],"mappings":"qEAYmC,CAClCA,EACAC,EACAC,KAEA,MAAMC,EAAiBH,EAAMI,KAAKC,GAAQJ,EAAYI,EAAM,EAAG,MACzDC,EAAcH,EAAeI,QAClC,CAAEC,EAASC,IAAeD,EAAQE,QAAUD,EAAQC,OAASF,EAAUC,GACvEN,EAAgB,IAGjB,OAAOQ,EAAcA,eAAEL,EAAaJ,EAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),i=require("@visx/responsive");
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),i=require("@visx/responsive");exports.withResponsive=function(t,n){const{maxWidth:r=1200,aspectRatio:s=.5,debounceTime:h=50}=n||{};return function(n){const{parentRef:a,width:u}=i.useParentSize({debounceTime:h,enableDebounceLeadingCall:!0,initialSize:{width:600,height:400}}),c=u?Math.min(u,r):600,o=n.height??c*s;return e.jsx("div",{ref:a,style:{width:"100%"},children:e.jsx(t,{width:c,height:o,size:c,...n})})}};
|
|
2
2
|
//# sourceMappingURL=with-responsive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-responsive.js","sources":["/@automattic/charts/../../../../src/components/shared/with-responsive.tsx"],"sourcesContent":[null],"names":["WrappedComponent","config","maxWidth","aspectRatio","debounceTime","props","parentRef","width","parentWidth","useParentSize","enableDebounceLeadingCall","initialSize","height","containerWidth","Math","min","containerHeight","_jsx","jsx","ref","style","children","size"],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-responsive.js","sources":["/@automattic/charts/../../../../src/components/shared/with-responsive.tsx"],"sourcesContent":[null],"names":["WrappedComponent","config","maxWidth","aspectRatio","debounceTime","props","parentRef","width","parentWidth","useParentSize","enableDebounceLeadingCall","initialSize","height","containerWidth","Math","min","containerHeight","_jsx","jsx","ref","style","children","size"],"mappings":"qGAmBM,SACLA,EACAC,GAEA,MAAMC,SAAEA,EAAW,KAAIC,YAAEA,EAAc,GAAGC,aAAEA,EAAe,IAAOH,GAAU,GAE5E,OAAO,SAA0BI,GAChC,MAAMC,UAAEA,EAAWC,MAAOC,GAAgBC,EAAAA,cAAe,CACxDL,eACAM,2BAA2B,EAC3BC,YAAa,CAAEJ,MAAO,IAAKK,OAAQ,OAI9BC,EAAiBL,EAAcM,KAAKC,IAAKP,EAAaN,GAAa,IACnEc,EAAkBX,EAAMO,QAAUC,EAAiBV,EAEzD,OACCc,EACCC,IAAA,MAAA,CAAAC,IAAMb,EACNc,MAAQ,CACPb,MAAO,QACPc,SAEDJ,MAACjB,EAAgB,CAChBO,MAAQM,EACRD,OAASI,EACTM,KAAOT,KACAR,KAIX,CACD"}
|
package/dist/cjs/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.legend-module_legend--horizontal__IUN13{display:flex;flex-direction:row;flex-wrap:wrap;gap:16px}.legend-module_legend--vertical__Scfzo{display:flex;flex-direction:column;gap:8px}.legend-module_legend-item__feemn{align-items:center;display:flex;font-size:.875rem}.legend-module_legend-item-label__ksx6I{align-items:center;color:var(--jp-gray-80,#2c3338);display:flex;gap:.5rem}.legend-module_legend-item-value__d9x1j{font-weight:500}.bar-chart-module_bar-chart__lmYNi{position:relative}.bar-chart-module_bar-chart-legend__vgKKq{margin-top:1rem}.line-chart-module_line-chart__ITM3d{position:relative}.line-chart-module_line-chart__tooltip__aqcme{background:#fff;padding:.5rem}.line-chart-module_line-chart__tooltip-date__4Dzab{font-weight:700;padding-bottom:10px}.line-chart-module_line-chart__tooltip-row__6A37G{align-items:center;display:flex;justify-content:space-between;padding:4px 0}.line-chart-module_line-chart__tooltip-label__IvnFF{font-weight:500;padding-right:1rem}.visx-tooltip-glyph svg{height:10px;width:10px}.base-tooltip-module_tooltip__OfX6n{background-color:rgba(0,0,0,.85);border-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.1);color:#fff;font-size:14px;padding:.5rem;pointer-events:none;position:absolute;transform:translate(-50%,-100%)}.pie-chart-module_pie-chart__R12Vh{position:relative}.pie-semi-circle-chart-module_pie-semi-circle-chart__r5jk9{position:relative;text-align:center}.pie-semi-circle-chart-module_pie-semi-circle-chart-legend__c8W1Y{margin-top:1rem}.pie-semi-circle-chart-module_pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module_label__nPqOg{font-size:16px;font-weight:600;margin-bottom:0}.pie-semi-circle-chart-module_pie-semi-circle-chart__r5jk9 .pie-semi-circle-chart-module_note__LpBZQ{font-size:14px;margin-top:0}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("./components/bar-chart/bar-chart.js"),r=require("./components/line-chart/line-chart.js"),t=require("./components/pie-chart/pie-chart.js"),
|
|
1
|
+
"use strict";var e=require("./components/bar-chart/bar-chart.js"),r=require("./components/line-chart/line-chart.js"),t=require("./components/pie-chart/pie-chart.js"),s=require("./components/pie-semi-circle-chart/pie-semi-circle-chart.js"),o=require("./components/bar-list-chart/bar-list-chart.js"),i=require("./components/tooltip/base-tooltip.js"),a=require("./components/legend/base-legend.js"),p=require("./providers/theme/theme-provider.js"),h=require("./providers/theme/themes.js"),c=require("./hooks/use-chart-mouse-handler.js");exports.BarChart=e,exports.LineChart=r,exports.PieChart=t,exports.PieSemiCircleChart=s,exports.BarListChart=o,exports.BaseTooltip=i.BaseTooltip,exports.Legend=a.BaseLegend,exports.ThemeProvider=p.ThemeProvider,exports.defaultTheme=h.defaultTheme,exports.jetpackTheme=h.jetpackTheme,exports.wooTheme=h.wooTheme,exports.useChartMouseHandler=c;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("@visx/xychart"),t=require("react"),s=require("./themes.js");const o=t.createContext(s.defaultTheme),u=()=>t.useContext(o);exports.ThemeProvider=({theme:r={},children:t})=>{const u={...s.defaultTheme,...r};return e.jsx(o.Provider,{value:u,children:t})},exports.useChartTheme=u,exports.useXYChartTheme=e=>{const s=u();return t.useMemo((()=>{const t=(e??[]).map((e=>e.options?.stroke)).filter((e=>Boolean(e)));return r.buildChartTheme({...s,colors:[...t,...s.colors??[]]})}),[s,e])};
|
|
2
2
|
//# sourceMappingURL=theme-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.js","sources":["/@automattic/charts/../../../../src/providers/theme/theme-provider.tsx"],"sourcesContent":[null],"names":["ThemeContext","createContext","defaultTheme","theme","children","mergedTheme","_jsx","jsx","Provider","value","
|
|
1
|
+
{"version":3,"file":"theme-provider.js","sources":["/@automattic/charts/../../../../src/providers/theme/theme-provider.tsx"],"sourcesContent":[null],"names":["ThemeContext","createContext","defaultTheme","useChartTheme","useContext","theme","children","mergedTheme","_jsx","jsx","Provider","value","data","providerTheme","useMemo","seriesColors","map","series","options","stroke","filter","color","Boolean","buildChartTheme","colors"],"mappings":"uHASA,MAAMA,EAAeC,EAAAA,cAA6BC,EAAAA,cAM5CC,EAAgB,IACPC,aAAYJ,yBA+BqB,EAAIK,QAAQ,CAAE,EAAEC,eAC/D,MAAMC,EAAc,IAAKL,kBAAiBG,GAC1C,OAAOG,EAAAC,IAACT,EAAaU,SAAQ,CAACC,MAAQJ,EAAWD,SAAKA,GAAkC,kDA7B/DM,IACzB,MAAMC,EAAgBV,IAEtB,OAAOW,EAAOA,SAAE,KACf,MAAMC,GAAiBH,GAAQ,IAC7BI,KAAKC,GAAUA,EAAOC,SAASC,SAC/BC,QAAUC,GAA4BC,QAASD,KAEjD,OAAOE,kBAAiB,IACpBV,EACHW,OAAQ,IAAKT,KAAmBF,EAAcW,QAAU,KACtD,GACD,CAAEX,EAAeD,GAAQ"}
|