@automattic/charts 0.57.0 → 0.58.0
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 +16 -2
- package/dist/charts/bar-chart/index.cjs +7 -5
- package/dist/charts/bar-chart/index.cjs.map +1 -1
- package/dist/charts/bar-chart/index.css +12 -24
- package/dist/charts/bar-chart/index.css.map +1 -1
- package/dist/charts/bar-chart/index.d.cts +3 -4
- package/dist/charts/bar-chart/index.d.ts +3 -4
- package/dist/charts/bar-chart/index.js +6 -4
- package/dist/charts/bar-list-chart/index.cjs +8 -6
- package/dist/charts/bar-list-chart/index.cjs.map +1 -1
- package/dist/charts/bar-list-chart/index.css +12 -24
- package/dist/charts/bar-list-chart/index.css.map +1 -1
- package/dist/charts/bar-list-chart/index.d.cts +3 -3
- package/dist/charts/bar-list-chart/index.d.ts +3 -3
- package/dist/charts/bar-list-chart/index.js +7 -5
- package/dist/charts/conversion-funnel-chart/index.cjs +5 -5
- package/dist/charts/conversion-funnel-chart/index.css +0 -94
- package/dist/charts/conversion-funnel-chart/index.css.map +1 -1
- package/dist/charts/conversion-funnel-chart/index.d.cts +1 -1
- package/dist/charts/conversion-funnel-chart/index.d.ts +1 -1
- package/dist/charts/conversion-funnel-chart/index.js +4 -4
- package/dist/charts/geo-chart/index.cjs +4 -4
- package/dist/charts/geo-chart/index.css +0 -94
- package/dist/charts/geo-chart/index.css.map +1 -1
- package/dist/charts/geo-chart/index.d.cts +1 -1
- package/dist/charts/geo-chart/index.d.ts +1 -1
- package/dist/charts/geo-chart/index.js +3 -3
- package/dist/charts/leaderboard-chart/index.cjs +7 -6
- package/dist/charts/leaderboard-chart/index.cjs.map +1 -1
- package/dist/charts/leaderboard-chart/index.css +12 -24
- package/dist/charts/leaderboard-chart/index.css.map +1 -1
- package/dist/charts/leaderboard-chart/index.d.cts +3 -3
- package/dist/charts/leaderboard-chart/index.d.ts +3 -3
- package/dist/charts/leaderboard-chart/index.js +6 -5
- package/dist/charts/line-chart/index.cjs +7 -5
- package/dist/charts/line-chart/index.cjs.map +1 -1
- package/dist/charts/line-chart/index.css +12 -24
- package/dist/charts/line-chart/index.css.map +1 -1
- package/dist/charts/line-chart/index.d.cts +3 -4
- package/dist/charts/line-chart/index.d.ts +3 -4
- package/dist/charts/line-chart/index.js +6 -4
- package/dist/charts/pie-chart/index.cjs +7 -6
- package/dist/charts/pie-chart/index.cjs.map +1 -1
- package/dist/charts/pie-chart/index.css +12 -24
- package/dist/charts/pie-chart/index.css.map +1 -1
- package/dist/charts/pie-chart/index.d.cts +7 -13
- package/dist/charts/pie-chart/index.d.ts +7 -13
- package/dist/charts/pie-chart/index.js +6 -5
- package/dist/charts/pie-semi-circle-chart/index.cjs +7 -6
- package/dist/charts/pie-semi-circle-chart/index.cjs.map +1 -1
- package/dist/charts/pie-semi-circle-chart/index.css +12 -24
- package/dist/charts/pie-semi-circle-chart/index.css.map +1 -1
- package/dist/charts/pie-semi-circle-chart/index.d.cts +7 -13
- package/dist/charts/pie-semi-circle-chart/index.d.ts +7 -13
- package/dist/charts/pie-semi-circle-chart/index.js +6 -5
- package/dist/charts/sparkline/index.cjs +8 -6
- package/dist/charts/sparkline/index.cjs.map +1 -1
- package/dist/charts/sparkline/index.css +12 -24
- package/dist/charts/sparkline/index.css.map +1 -1
- package/dist/charts/sparkline/index.js +7 -5
- package/dist/{chunk-32DH6JDF.js → chunk-2I67QUIV.js} +52 -420
- package/dist/chunk-2I67QUIV.js.map +1 -0
- package/dist/{chunk-WLODYNLB.js → chunk-2ICEEQOC.js} +31 -27
- package/dist/chunk-2ICEEQOC.js.map +1 -0
- package/dist/{chunk-IU4DYUAV.js → chunk-4B7BL2DD.js} +3 -3
- package/dist/{chunk-BCX5THDQ.js → chunk-4OXMTKAL.js} +24 -26
- package/dist/chunk-4OXMTKAL.js.map +1 -0
- package/dist/{chunk-4OPFE4RM.js → chunk-B6NLZFRW.js} +30 -27
- package/dist/chunk-B6NLZFRW.js.map +1 -0
- package/dist/{chunk-D2UH4CFE.cjs → chunk-BBAUQOW6.cjs} +9 -9
- package/dist/{chunk-D2UH4CFE.cjs.map → chunk-BBAUQOW6.cjs.map} +1 -1
- package/dist/{chunk-XKRJL2QT.cjs → chunk-CMMHCTBX.cjs} +45 -47
- package/dist/chunk-CMMHCTBX.cjs.map +1 -0
- package/dist/{chunk-YE2T52VZ.cjs → chunk-CPPXJATQ.cjs} +51 -47
- package/dist/chunk-CPPXJATQ.cjs.map +1 -0
- package/dist/{chunk-H2V4JMSA.js → chunk-DKU775VC.js} +3 -3
- package/dist/{chunk-ZH4F5RMG.cjs → chunk-GRA7Y2ZG.cjs} +46 -48
- package/dist/chunk-GRA7Y2ZG.cjs.map +1 -0
- package/dist/{chunk-DAU3HNEG.js → chunk-JJIMABHT.js} +9 -2
- package/dist/chunk-JJIMABHT.js.map +1 -0
- package/dist/{chunk-CZGYJKG6.js → chunk-KJHWXOCZ.js} +4 -4
- package/dist/{chunk-6CCZL2JJ.js → chunk-KRWGSOJ2.js} +30 -2
- package/dist/chunk-KRWGSOJ2.js.map +1 -0
- package/dist/{chunk-V36ERY7Y.js → chunk-LTFH7SEG.js} +24 -26
- package/dist/chunk-LTFH7SEG.js.map +1 -0
- package/dist/{chunk-PXLEMUGJ.js → chunk-MUNOKLLE.js} +3 -3
- package/dist/{chunk-VTS3PNMS.cjs → chunk-MXGLYWVP.cjs} +9 -2
- package/dist/chunk-MXGLYWVP.cjs.map +1 -0
- package/dist/{chunk-Z45KX47P.cjs → chunk-OYC34VTO.cjs} +154 -94
- package/dist/chunk-OYC34VTO.cjs.map +1 -0
- package/dist/{chunk-77OKCVQN.cjs → chunk-PQL5I3F6.cjs} +17 -17
- package/dist/{chunk-77OKCVQN.cjs.map → chunk-PQL5I3F6.cjs.map} +1 -1
- package/dist/{chunk-I35UYJJR.cjs → chunk-REZTQ4PH.cjs} +41 -21
- package/dist/chunk-REZTQ4PH.cjs.map +1 -0
- package/dist/{chunk-RCY6XLGU.cjs → chunk-TZRUHQOH.cjs} +36 -8
- package/dist/chunk-TZRUHQOH.cjs.map +1 -0
- package/dist/{chunk-2NCY7R4G.js → chunk-UTYVIOWZ.js} +111 -51
- package/dist/chunk-UTYVIOWZ.js.map +1 -0
- package/dist/{chunk-TO3OQBXG.cjs → chunk-W2LDIX26.cjs} +5 -5
- package/dist/{chunk-TO3OQBXG.cjs.map → chunk-W2LDIX26.cjs.map} +1 -1
- package/dist/{chunk-7FQX4ALL.cjs → chunk-WSG64BVN.cjs} +6 -6
- package/dist/{chunk-7FQX4ALL.cjs.map → chunk-WSG64BVN.cjs.map} +1 -1
- package/dist/chunk-WTQYGUNF.js +400 -0
- package/dist/chunk-WTQYGUNF.js.map +1 -0
- package/dist/{chunk-RHHVEJHJ.cjs → chunk-WYK7EL5R.cjs} +68 -436
- package/dist/chunk-WYK7EL5R.cjs.map +1 -0
- package/dist/{chunk-VJM5XCB4.cjs → chunk-XC4KHJYX.cjs} +49 -46
- package/dist/chunk-XC4KHJYX.cjs.map +1 -0
- package/dist/chunk-XVBH5XHE.cjs +400 -0
- package/dist/chunk-XVBH5XHE.cjs.map +1 -0
- package/dist/{chunk-Z26M4V2M.js → chunk-YAFQVVDI.js} +41 -21
- package/dist/chunk-YAFQVVDI.js.map +1 -0
- package/dist/components/legend/index.cjs +4 -3
- package/dist/components/legend/index.cjs.map +1 -1
- package/dist/components/legend/index.css +12 -24
- package/dist/components/legend/index.css.map +1 -1
- package/dist/components/legend/index.d.cts +4 -4
- package/dist/components/legend/index.d.ts +4 -4
- package/dist/components/legend/index.js +3 -2
- package/dist/components/tooltip/index.d.cts +1 -1
- package/dist/components/tooltip/index.d.ts +1 -1
- package/dist/hooks/index.cjs +3 -5
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.css +0 -94
- package/dist/hooks/index.css.map +1 -1
- package/dist/hooks/index.d.cts +3 -11
- package/dist/hooks/index.d.ts +3 -11
- package/dist/hooks/index.js +2 -4
- package/dist/index.cjs +18 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +12 -24
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +17 -15
- package/dist/{leaderboard-chart-DR7CGb0L.d.cts → leaderboard-chart-BSbg0ufV.d.cts} +3 -7
- package/dist/{leaderboard-chart-BKYYXcg2.d.ts → leaderboard-chart-odEYxxEC.d.ts} +3 -7
- package/dist/{legend-C2grwnWk.d.cts → legend-DFkosEvC.d.cts} +1 -1
- package/dist/{legend-Cj0xM5dU.d.ts → legend-DLswHhOk.d.ts} +1 -1
- package/dist/providers/index.cjs +3 -3
- package/dist/providers/index.css +0 -94
- package/dist/providers/index.css.map +1 -1
- package/dist/providers/index.d.cts +3 -3
- package/dist/providers/index.d.ts +3 -3
- package/dist/providers/index.js +2 -2
- package/dist/{themes-CyjKm-P_.d.cts → themes-D0qc5JaW.d.cts} +2 -2
- package/dist/{themes-BmVGrYnF.d.ts → themes-itO4Ht5g.d.ts} +2 -2
- package/dist/{types-KtOPPzPX.d.cts → types-B5f6XQ7Q.d.cts} +1 -1
- package/dist/{types-CuUEszrM.d.ts → types-BsHooDbM.d.ts} +1 -1
- package/dist/{types-I67mddpr.d.cts → types-BuSrRM4p.d.ts} +3 -32
- package/dist/{types-DZordNiO.d.cts → types-ChOUI9-N.d.cts} +80 -40
- package/dist/{types-DZordNiO.d.ts → types-ChOUI9-N.d.ts} +80 -40
- package/dist/{types-I67mddpr.d.ts → types-Dfw9VOKI.d.cts} +3 -32
- package/dist/utils/index.cjs +2 -2
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +6 -6
- package/src/charts/bar-chart/bar-chart.tsx +17 -18
- package/src/charts/bar-chart/test/bar-chart.test.tsx +48 -31
- package/src/charts/leaderboard-chart/leaderboard-chart.tsx +38 -41
- package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +4 -5
- package/src/charts/leaderboard-chart/types.ts +1 -11
- package/src/charts/line-chart/line-chart.tsx +18 -16
- package/src/charts/line-chart/test/line-chart.test.tsx +49 -27
- package/src/charts/line-chart/types.ts +0 -1
- package/src/charts/pie-chart/pie-chart.tsx +23 -22
- package/src/charts/pie-chart/test/composition-api.test.tsx +41 -0
- package/src/charts/pie-chart/test/pie-chart.test.tsx +9 -9
- package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +21 -23
- package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +33 -5
- package/src/charts/private/chart-composition/index.ts +2 -0
- package/src/charts/private/chart-composition/render-legend-slot.ts +22 -0
- package/src/charts/private/chart-composition/test/render-legend-slot.test.tsx +60 -0
- package/src/charts/private/chart-composition/test/use-chart-children.test.tsx +91 -0
- package/src/charts/private/chart-composition/use-chart-children.ts +34 -2
- package/src/components/legend/index.ts +1 -8
- package/src/components/legend/private/base-legend.module.scss +19 -37
- package/src/components/legend/private/base-legend.tsx +0 -2
- package/src/components/legend/types.ts +7 -34
- package/src/hooks/index.ts +0 -1
- package/src/index.ts +1 -7
- package/src/types.ts +83 -38
- package/src/utils/date-parsing.ts +10 -1
- package/src/utils/test/date-parsing.test.ts +12 -0
- package/src/utils/test/resolve-css-var.test.ts +2 -2
- package/tsup.config.ts +1 -1
- package/dist/chunk-2NCY7R4G.js.map +0 -1
- package/dist/chunk-32DH6JDF.js.map +0 -1
- package/dist/chunk-4OPFE4RM.js.map +0 -1
- package/dist/chunk-6CCZL2JJ.js.map +0 -1
- package/dist/chunk-BCX5THDQ.js.map +0 -1
- package/dist/chunk-DAU3HNEG.js.map +0 -1
- package/dist/chunk-I35UYJJR.cjs.map +0 -1
- package/dist/chunk-RCY6XLGU.cjs.map +0 -1
- package/dist/chunk-RHHVEJHJ.cjs.map +0 -1
- package/dist/chunk-V36ERY7Y.js.map +0 -1
- package/dist/chunk-VJM5XCB4.cjs.map +0 -1
- package/dist/chunk-VTS3PNMS.cjs.map +0 -1
- package/dist/chunk-WLODYNLB.js.map +0 -1
- package/dist/chunk-XKRJL2QT.cjs.map +0 -1
- package/dist/chunk-YE2T52VZ.cjs.map +0 -1
- package/dist/chunk-Z26M4V2M.js.map +0 -1
- package/dist/chunk-Z45KX47P.cjs.map +0 -1
- package/dist/chunk-ZH4F5RMG.cjs.map +0 -1
- package/src/hooks/use-has-legend-child.ts +0 -22
- /package/dist/{chunk-IU4DYUAV.js.map → chunk-4B7BL2DD.js.map} +0 -0
- /package/dist/{chunk-H2V4JMSA.js.map → chunk-DKU775VC.js.map} +0 -0
- /package/dist/{chunk-CZGYJKG6.js.map → chunk-KJHWXOCZ.js.map} +0 -0
- /package/dist/{chunk-PXLEMUGJ.js.map → chunk-MUNOKLLE.js.map} +0 -0
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkXVBH5XHEcjs = require('./chunk-XVBH5XHE.cjs');
|
|
4
|
+
|
|
5
|
+
// src/charts/private/chart-composition/chart-svg.tsx
|
|
2
6
|
var _jsxruntime = require('react/jsx-runtime');
|
|
3
7
|
var ChartSVG = ({
|
|
4
8
|
children
|
|
@@ -20,26 +24,42 @@ var ChartHTML = ({
|
|
|
20
24
|
};
|
|
21
25
|
ChartHTML.displayName = "Chart.HTML";
|
|
22
26
|
|
|
27
|
+
// src/charts/private/chart-composition/render-legend-slot.ts
|
|
28
|
+
var _react = require('react');
|
|
29
|
+
function renderLegendSlot(legendChildren, position) {
|
|
30
|
+
return legendChildren.filter((l) => l.position === position).map(
|
|
31
|
+
(l, i) => _react.createElement.call(void 0, _react.Fragment, { key: `legend-${position}-${i}` }, l.element)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
23
35
|
// src/charts/private/chart-composition/use-chart-children.ts
|
|
24
36
|
var _group = require('@visx/group');
|
|
25
|
-
|
|
37
|
+
|
|
26
38
|
function useChartChildren(children, chartType) {
|
|
27
39
|
return _react.useMemo.call(void 0, () => {
|
|
28
40
|
const svg = [];
|
|
29
41
|
const html = [];
|
|
42
|
+
const legend = [];
|
|
30
43
|
const other = [];
|
|
44
|
+
const nonLegend = [];
|
|
31
45
|
_react.Children.forEach(children, (child) => {
|
|
32
46
|
if (_react.isValidElement.call(void 0, child)) {
|
|
47
|
+
if (child.type === _chunkXVBH5XHEcjs.Legend) {
|
|
48
|
+
const rawPosition = _optionalChain([child, 'access', _ => _.props, 'optionalAccess', _2 => _2.position]);
|
|
49
|
+
const position = rawPosition === "top" || rawPosition === "bottom" ? rawPosition : "bottom";
|
|
50
|
+
legend.push({ element: child, position });
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
33
53
|
const childType = child.type;
|
|
34
|
-
const displayName = _optionalChain([childType, 'optionalAccess',
|
|
54
|
+
const displayName = _optionalChain([childType, 'optionalAccess', _3 => _3.displayName]);
|
|
35
55
|
if (displayName === `${chartType}.SVG` || displayName === "Chart.SVG") {
|
|
36
|
-
if (_optionalChain([child, 'access',
|
|
56
|
+
if (_optionalChain([child, 'access', _4 => _4.props, 'optionalAccess', _5 => _5.children])) {
|
|
37
57
|
_react.Children.forEach(child.props.children, (svgChild) => {
|
|
38
58
|
svg.push(svgChild);
|
|
39
59
|
});
|
|
40
60
|
}
|
|
41
61
|
} else if (displayName === `${chartType}.HTML` || displayName === "Chart.HTML") {
|
|
42
|
-
if (_optionalChain([child, 'access',
|
|
62
|
+
if (_optionalChain([child, 'access', _6 => _6.props, 'optionalAccess', _7 => _7.children])) {
|
|
43
63
|
_react.Children.forEach(child.props.children, (htmlChild) => {
|
|
44
64
|
html.push(htmlChild);
|
|
45
65
|
});
|
|
@@ -50,8 +70,15 @@ function useChartChildren(children, chartType) {
|
|
|
50
70
|
other.push(child);
|
|
51
71
|
}
|
|
52
72
|
}
|
|
73
|
+
nonLegend.push(child);
|
|
53
74
|
});
|
|
54
|
-
return {
|
|
75
|
+
return {
|
|
76
|
+
svgChildren: svg,
|
|
77
|
+
htmlChildren: html,
|
|
78
|
+
legendChildren: legend,
|
|
79
|
+
otherChildren: other,
|
|
80
|
+
nonLegendChildren: nonLegend
|
|
81
|
+
};
|
|
55
82
|
}, [children, chartType]);
|
|
56
83
|
}
|
|
57
84
|
|
|
@@ -59,5 +86,6 @@ function useChartChildren(children, chartType) {
|
|
|
59
86
|
|
|
60
87
|
|
|
61
88
|
|
|
62
|
-
|
|
63
|
-
|
|
89
|
+
|
|
90
|
+
exports.ChartSVG = ChartSVG; exports.ChartHTML = ChartHTML; exports.renderLegendSlot = renderLegendSlot; exports.useChartChildren = useChartChildren;
|
|
91
|
+
//# sourceMappingURL=chunk-TZRUHQOH.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-TZRUHQOH.cjs","../src/charts/private/chart-composition/chart-svg.tsx","../src/charts/private/chart-composition/chart-html.tsx","../src/charts/private/chart-composition/render-legend-slot.ts","../src/charts/private/chart-composition/use-chart-children.ts"],"names":["_jsx","_Fragment"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,+CAAmD;AAU5C,IAAM,SAAA,EAAW,CAAC;AAAA,EACvB;AACF,CAAA,EAAA,GAAM;AAGJ,EAAA,uBAAoB,6BAAA,oBAAK,EAAW;AAAA,IAClC;AAAA,EACF,CAAC,CAAA;AACH,CAAA;AAGA,QAAA,CAAS,YAAA,EAAc,WAAA;ADPvB;AACA;AEfA;AAUO,IAAM,UAAA,EAAY,CAAC;AAAA,EACxB;AACF,CAAA,EAAA,GAAM;AAGJ,EAAA,uBAAoBA,6BAAAA,oBAAKC,EAAW;AAAA,IAClC;AAAA,EACF,CAAC,CAAA;AACH,CAAA;AAGA,SAAA,CAAU,YAAA,EAAc,YAAA;AFIxB;AACA;AG1BA,8BAAwC;AAYjC,SAAS,gBAAA,CACf,cAAA,EACA,QAAA,EACc;AACd,EAAA,OAAO,cAAA,CACL,MAAA,CAAQ,CAAA,CAAA,EAAA,GAAK,CAAA,CAAE,SAAA,IAAa,QAAS,CAAA,CACrC,GAAA;AAAA,IAAK,CAAE,CAAA,EAAG,CAAA,EAAA,GACV,kCAAA,eAAe,EAAU,EAAE,GAAA,EAAK,CAAA,OAAA,EAAW,QAAS,CAAA,CAAA,EAAK,CAAE,CAAA,EAAA;AAC5D,EAAA;AACF;AHYqE;AACA;AIlC/C;AAC4B;AA4BwC;AACnE,EAAA;AACK,IAAA;AACC,IAAA;AACI,IAAA;AACH,IAAA;AACI,IAAA;AAEK,IAAA;AACL,MAAA;AAED,QAAA;AACK,UAAA;AAES,UAAA;AAEgB,UAAA;AAE1D,UAAA;AACD,QAAA;AAGwB,QAAA;AACO,QAAA;AAG8B,QAAA;AAE/B,UAAA;AACwB,YAAA;AAChC,cAAA;AAClB,YAAA;AACH,UAAA;AACoD,QAAA;AAEvB,UAAA;AACyB,YAAA;AAC/B,cAAA;AACpB,YAAA;AACH,UAAA;AACkC,QAAA;AAElB,UAAA;AACV,QAAA;AACY,UAAA;AACnB,QAAA;AACD,MAAA;AAGsB,MAAA;AACrB,IAAA;AAEK,IAAA;AACO,MAAA;AACC,MAAA;AACE,MAAA;AACD,MAAA;AACI,MAAA;AACpB,IAAA;AAC0B,EAAA;AAC5B;AJNqE;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/jetpack/jetpack/projects/js-packages/charts/dist/chunk-TZRUHQOH.cjs","sourcesContent":[null,"import { Fragment as _Fragment, jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Compound component for SVG children in charts.\n * This component serves as a marker for SVG content that should be rendered\n * inside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render inside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartSVG = ({\n children\n}) => {\n // This component doesn't render directly - its children are extracted by the parent chart\n // We just return the children as-is\n return /*#__PURE__*/_jsx(_Fragment, {\n children: children\n });\n};\n\n// Set displayName for better debugging and type checking\nChartSVG.displayName = 'Chart.SVG';","import { Fragment as _Fragment, jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Compound component for HTML children in charts.\n * This component serves as a marker for HTML content that should be rendered\n * outside the chart's SVG element. The actual rendering is handled by the parent chart.\n *\n * @param {PropsWithChildren} props - Component props\n * @param {ReactNode} props.children - Child elements to render outside the SVG\n * @return {JSX.Element} The children wrapped in a fragment\n */\nexport const ChartHTML = ({\n children\n}) => {\n // This component doesn't render directly - its children are extracted by the parent chart\n // We just return the children as-is\n return /*#__PURE__*/_jsx(_Fragment, {\n children: children\n });\n};\n\n// Set displayName for better debugging and type checking\nChartHTML.displayName = 'Chart.HTML';","import { createElement, Fragment } from 'react';\nimport type { LegendChild } from './use-chart-children';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactNode } from 'react';\n\n/**\n * Renders legend children filtered by position slot.\n *\n * @param {LegendChild[]} legendChildren - The legend children to filter and render\n * @param {LegendPosition} position - The position slot to render\n * @return {ReactNode[]} Array of legend elements for the given position\n */\nexport function renderLegendSlot(\n\tlegendChildren: LegendChild[],\n\tposition: LegendPosition\n): ReactNode[] {\n\treturn legendChildren\n\t\t.filter( l => l.position === position )\n\t\t.map( ( l, i ) =>\n\t\t\tcreateElement( Fragment, { key: `legend-${ position }-${ i }` }, l.element )\n\t\t);\n}\n","import { Group } from '@visx/group';\nimport { useMemo, Children, isValidElement } from 'react';\nimport { Legend } from '../../../components/legend';\nimport type { LegendPosition } from '../../../types';\nimport type { ReactElement, ReactNode } from 'react';\n\nexport type LegendChild = {\n\telement: ReactElement;\n\tposition: LegendPosition;\n};\n\ninterface ChartChildren {\n\tsvgChildren: ReactNode[];\n\thtmlChildren: ReactNode[];\n\tlegendChildren: LegendChild[];\n\totherChildren: ReactNode[];\n\t/** All children except Legend, in original order. */\n\tnonLegendChildren: ReactNode[];\n}\n\n/**\n * Custom hook to process and categorize chart children for composition API.\n * Extracts children from compound components (Chart.SVG, Chart.HTML) and\n * maintains backward compatibility with legacy Group components.\n *\n * @param {ReactNode} children - The children prop from the chart component\n * @param {string} chartType - The type of chart (e.g., 'PieChart', 'BarChart')\n * @return {ChartChildren} Categorized children for rendering\n */\nexport function useChartChildren( children: ReactNode, chartType: string ): ChartChildren {\n\treturn useMemo( () => {\n\t\tconst svg: ReactNode[] = [];\n\t\tconst html: ReactNode[] = [];\n\t\tconst legend: LegendChild[] = [];\n\t\tconst other: ReactNode[] = [];\n\t\tconst nonLegend: ReactNode[] = [];\n\n\t\tChildren.forEach( children, child => {\n\t\t\tif ( isValidElement( child ) ) {\n\t\t\t\t// Extract Legend children for position-based slot rendering\n\t\t\t\tif ( child.type === Legend ) {\n\t\t\t\t\tconst rawPosition = child.props?.position;\n\t\t\t\t\tconst position =\n\t\t\t\t\t\trawPosition === 'top' || rawPosition === 'bottom' ? rawPosition : 'bottom';\n\n\t\t\t\t\tlegend.push( { element: child as ReactElement, position } );\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check displayName for compound components\n\t\t\t\tconst childType = child.type as { displayName?: string };\n\t\t\t\tconst displayName = childType?.displayName;\n\n\t\t\t\t// Handle chart-specific compound components (e.g., PieChart.SVG)\n\t\t\t\tif ( displayName === `${ chartType }.SVG` || displayName === 'Chart.SVG' ) {\n\t\t\t\t\t// Extract children from Chart.SVG with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, svgChild => {\n\t\t\t\t\t\t\tsvg.push( svgChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( displayName === `${ chartType }.HTML` || displayName === 'Chart.HTML' ) {\n\t\t\t\t\t// Extract children from Chart.HTML with safety checks\n\t\t\t\t\tif ( child.props?.children ) {\n\t\t\t\t\t\tChildren.forEach( child.props.children, htmlChild => {\n\t\t\t\t\t\t\thtml.push( htmlChild );\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t} else if ( child.type === Group ) {\n\t\t\t\t\t// Legacy support: still check for Group type for backward compatibility\n\t\t\t\t\tsvg.push( child );\n\t\t\t\t} else {\n\t\t\t\t\tother.push( child );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Preserve original order of all non-Legend children\n\t\t\tnonLegend.push( child );\n\t\t} );\n\n\t\treturn {\n\t\t\tsvgChildren: svg,\n\t\t\thtmlChildren: html,\n\t\t\tlegendChildren: legend,\n\t\t\totherChildren: other,\n\t\t\tnonLegendChildren: nonLegend,\n\t\t};\n\t}, [ children, chartType ] );\n}\n"]}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
renderLegendSlot,
|
|
2
3
|
useChartChildren
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KRWGSOJ2.js";
|
|
5
|
+
import {
|
|
6
|
+
Legend,
|
|
7
|
+
SingleChartContext
|
|
8
|
+
} from "./chunk-WTQYGUNF.js";
|
|
4
9
|
import {
|
|
5
10
|
Children,
|
|
6
11
|
Fragment,
|
|
@@ -16,25 +21,23 @@ import {
|
|
|
16
21
|
useMemo,
|
|
17
22
|
useRef,
|
|
18
23
|
useState
|
|
19
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-YAFQVVDI.js";
|
|
20
25
|
import {
|
|
21
26
|
withResponsive
|
|
22
27
|
} from "./chunk-OP6PHB2U.js";
|
|
23
28
|
import {
|
|
24
29
|
GlobalChartsContext,
|
|
25
30
|
GlobalChartsProvider,
|
|
26
|
-
Legend,
|
|
27
|
-
SingleChartContext,
|
|
28
31
|
useChartId,
|
|
29
32
|
useChartRegistration,
|
|
30
33
|
useGlobalChartsContext,
|
|
31
34
|
useGlobalChartsTheme,
|
|
32
35
|
usePrefersReducedMotion
|
|
33
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-2I67QUIV.js";
|
|
34
37
|
import {
|
|
35
38
|
attachSubComponents,
|
|
36
39
|
formatMetricValue
|
|
37
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-JJIMABHT.js";
|
|
38
41
|
import {
|
|
39
42
|
__commonJS,
|
|
40
43
|
__export,
|
|
@@ -409,6 +412,62 @@ var require_hoist_non_react_statics_cjs = __commonJS({
|
|
|
409
412
|
}
|
|
410
413
|
});
|
|
411
414
|
|
|
415
|
+
// ../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js
|
|
416
|
+
var require_es6 = __commonJS({
|
|
417
|
+
"../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/es6/index.js"(exports, module) {
|
|
418
|
+
"use strict";
|
|
419
|
+
module.exports = function equal(a2, b2) {
|
|
420
|
+
if (a2 === b2) return true;
|
|
421
|
+
if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
|
|
422
|
+
if (a2.constructor !== b2.constructor) return false;
|
|
423
|
+
var length2, i2, keys;
|
|
424
|
+
if (Array.isArray(a2)) {
|
|
425
|
+
length2 = a2.length;
|
|
426
|
+
if (length2 != b2.length) return false;
|
|
427
|
+
for (i2 = length2; i2-- !== 0; )
|
|
428
|
+
if (!equal(a2[i2], b2[i2])) return false;
|
|
429
|
+
return true;
|
|
430
|
+
}
|
|
431
|
+
if (a2 instanceof Map && b2 instanceof Map) {
|
|
432
|
+
if (a2.size !== b2.size) return false;
|
|
433
|
+
for (i2 of a2.entries())
|
|
434
|
+
if (!b2.has(i2[0])) return false;
|
|
435
|
+
for (i2 of a2.entries())
|
|
436
|
+
if (!equal(i2[1], b2.get(i2[0]))) return false;
|
|
437
|
+
return true;
|
|
438
|
+
}
|
|
439
|
+
if (a2 instanceof Set && b2 instanceof Set) {
|
|
440
|
+
if (a2.size !== b2.size) return false;
|
|
441
|
+
for (i2 of a2.entries())
|
|
442
|
+
if (!b2.has(i2[0])) return false;
|
|
443
|
+
return true;
|
|
444
|
+
}
|
|
445
|
+
if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) {
|
|
446
|
+
length2 = a2.length;
|
|
447
|
+
if (length2 != b2.length) return false;
|
|
448
|
+
for (i2 = length2; i2-- !== 0; )
|
|
449
|
+
if (a2[i2] !== b2[i2]) return false;
|
|
450
|
+
return true;
|
|
451
|
+
}
|
|
452
|
+
if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
|
|
453
|
+
if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
|
|
454
|
+
if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
|
|
455
|
+
keys = Object.keys(a2);
|
|
456
|
+
length2 = keys.length;
|
|
457
|
+
if (length2 !== Object.keys(b2).length) return false;
|
|
458
|
+
for (i2 = length2; i2-- !== 0; )
|
|
459
|
+
if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false;
|
|
460
|
+
for (i2 = length2; i2-- !== 0; ) {
|
|
461
|
+
var key = keys[i2];
|
|
462
|
+
if (!equal(a2[key], b2[key])) return false;
|
|
463
|
+
}
|
|
464
|
+
return true;
|
|
465
|
+
}
|
|
466
|
+
return a2 !== a2 && b2 !== b2;
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
|
|
412
471
|
// ../../../node_modules/.pnpm/highlight-words-core@1.2.3/node_modules/highlight-words-core/dist/index.js
|
|
413
472
|
var require_dist = __commonJS({
|
|
414
473
|
"../../../node_modules/.pnpm/highlight-words-core@1.2.3/node_modules/highlight-words-core/dist/index.js"(exports, module) {
|
|
@@ -644,12 +703,12 @@ function paramCase(input, options) {
|
|
|
644
703
|
return dotCase(input, __assign2({ delimiter: "-" }, options));
|
|
645
704
|
}
|
|
646
705
|
|
|
647
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
706
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/values.mjs
|
|
648
707
|
function isValueDefined(value) {
|
|
649
708
|
return value !== void 0 && value !== null;
|
|
650
709
|
}
|
|
651
710
|
|
|
652
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
711
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.mjs
|
|
653
712
|
function useUpdateEffect(effect, deps) {
|
|
654
713
|
const mountedRef = useRef(false);
|
|
655
714
|
useEffect(() => {
|
|
@@ -2103,7 +2162,7 @@ var css2 = _createEmotion.css;
|
|
|
2103
2162
|
var sheet = _createEmotion.sheet;
|
|
2104
2163
|
var cache = _createEmotion.cache;
|
|
2105
2164
|
|
|
2106
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2165
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/hooks/use-cx.mjs
|
|
2107
2166
|
var isSerializedStyles = (o2) => typeof o2 !== "undefined" && o2 !== null && ["name", "styles"].every((p2) => typeof o2[p2] !== "undefined");
|
|
2108
2167
|
var useCx = () => {
|
|
2109
2168
|
const cache2 = __unsafe_useEmotionCache();
|
|
@@ -2379,7 +2438,7 @@ function names_default(e2, f2) {
|
|
|
2379
2438
|
}, "name"]);
|
|
2380
2439
|
}
|
|
2381
2440
|
|
|
2382
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2441
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/colors.mjs
|
|
2383
2442
|
var colorComputationNode;
|
|
2384
2443
|
k([names_default]);
|
|
2385
2444
|
function getColorComputationNode() {
|
|
@@ -2433,7 +2492,7 @@ function getOptimalTextShade(backgroundColor) {
|
|
|
2433
2492
|
return result === "#000000" ? "dark" : "light";
|
|
2434
2493
|
}
|
|
2435
2494
|
|
|
2436
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2495
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/colors-values.mjs
|
|
2437
2496
|
var white = "#fff";
|
|
2438
2497
|
var GRAY = {
|
|
2439
2498
|
900: "#1e1e1e",
|
|
@@ -2514,7 +2573,7 @@ var COLORS = Object.freeze({
|
|
|
2514
2573
|
ui: UI
|
|
2515
2574
|
});
|
|
2516
2575
|
|
|
2517
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2576
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/config-values.mjs
|
|
2518
2577
|
var CONTROL_HEIGHT = "36px";
|
|
2519
2578
|
var CONTROL_PROPS = {
|
|
2520
2579
|
// These values should be shared with TextControl.
|
|
@@ -2582,9 +2641,9 @@ var config_values_default = Object.assign({}, CONTROL_PROPS, {
|
|
|
2582
2641
|
transitionTimingFunctionControl: "cubic-bezier(0.12, 0.8, 0.32, 1)"
|
|
2583
2642
|
});
|
|
2584
2643
|
|
|
2585
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2644
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs
|
|
2645
|
+
var import_es6 = __toESM(require_es6(), 1);
|
|
2586
2646
|
import deepmerge from "deepmerge";
|
|
2587
|
-
import fastDeepEqual from "fast-deep-equal/es6/index.js";
|
|
2588
2647
|
|
|
2589
2648
|
// ../../../node_modules/.pnpm/@wordpress+warning@3.41.0/node_modules/@wordpress/warning/build-module/utils.mjs
|
|
2590
2649
|
var logged = /* @__PURE__ */ new Set();
|
|
@@ -2608,7 +2667,7 @@ function warning(message) {
|
|
|
2608
2667
|
logged.add(message);
|
|
2609
2668
|
}
|
|
2610
2669
|
|
|
2611
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2670
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-system-provider.mjs
|
|
2612
2671
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2613
2672
|
var ComponentsContext = createContext(
|
|
2614
2673
|
/** @type {Record<string, any>} */
|
|
@@ -2624,7 +2683,7 @@ function useContextSystemBridge({
|
|
|
2624
2683
|
use_update_effect_default(() => {
|
|
2625
2684
|
if (
|
|
2626
2685
|
// Objects are equivalent.
|
|
2627
|
-
|
|
2686
|
+
(0, import_es6.default)(valueRef.current, value) && // But not the same reference.
|
|
2628
2687
|
valueRef.current !== value
|
|
2629
2688
|
) {
|
|
2630
2689
|
globalThis.SCRIPT_DEBUG === true ? warning(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;
|
|
@@ -2651,19 +2710,19 @@ var BaseContextSystemProvider = ({
|
|
|
2651
2710
|
};
|
|
2652
2711
|
var ContextSystemProvider = memo(BaseContextSystemProvider);
|
|
2653
2712
|
|
|
2654
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2713
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/constants.mjs
|
|
2655
2714
|
var COMPONENT_NAMESPACE = "data-wp-component";
|
|
2656
2715
|
var CONNECTED_NAMESPACE = "data-wp-c16t";
|
|
2657
2716
|
var CONNECT_STATIC_NAMESPACE = "__contextSystemKey__";
|
|
2658
2717
|
|
|
2659
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2718
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/get-styled-class-name-from-key.mjs
|
|
2660
2719
|
function getStyledClassName(namespace) {
|
|
2661
2720
|
const kebab = paramCase(namespace);
|
|
2662
2721
|
return `components-${kebab}`;
|
|
2663
2722
|
}
|
|
2664
2723
|
var getStyledClassNameFromKey = memize(getStyledClassName);
|
|
2665
2724
|
|
|
2666
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2725
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/context-connect.mjs
|
|
2667
2726
|
function contextConnect(Component, namespace) {
|
|
2668
2727
|
return _contextConnect(Component, namespace, {
|
|
2669
2728
|
forwardsRef: true
|
|
@@ -2713,7 +2772,7 @@ function hasConnectNamespace(Component, match2) {
|
|
|
2713
2772
|
return false;
|
|
2714
2773
|
}
|
|
2715
2774
|
|
|
2716
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2775
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/utils.mjs
|
|
2717
2776
|
function getNamespace(componentName) {
|
|
2718
2777
|
return {
|
|
2719
2778
|
[COMPONENT_NAMESPACE]: componentName
|
|
@@ -2725,7 +2784,7 @@ function getConnectedNamespace() {
|
|
|
2725
2784
|
};
|
|
2726
2785
|
}
|
|
2727
2786
|
|
|
2728
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2787
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/context/use-context-system.mjs
|
|
2729
2788
|
function useContextSystem(props, namespace) {
|
|
2730
2789
|
const contextSystemProps = useComponentsContext();
|
|
2731
2790
|
if (typeof namespace === "undefined") {
|
|
@@ -2909,7 +2968,7 @@ var createStyled = function createStyled2(tag, options) {
|
|
|
2909
2968
|
};
|
|
2910
2969
|
};
|
|
2911
2970
|
|
|
2912
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2971
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/view/component.mjs
|
|
2913
2972
|
import { jsx as _jsx2 } from "react/jsx-runtime";
|
|
2914
2973
|
var PolymorphicDiv = /* @__PURE__ */ createStyled("div", process.env.NODE_ENV === "production" ? {
|
|
2915
2974
|
target: "e19lxcc00"
|
|
@@ -2932,7 +2991,7 @@ var View = Object.assign(forwardRef(UnforwardedView), {
|
|
|
2932
2991
|
});
|
|
2933
2992
|
var component_default = View;
|
|
2934
2993
|
|
|
2935
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
2994
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/use-responsive-value.mjs
|
|
2936
2995
|
var breakpoints = ["40em", "52em", "64em"];
|
|
2937
2996
|
var useBreakpointIndex = (options = {}) => {
|
|
2938
2997
|
const {
|
|
@@ -2975,7 +3034,7 @@ function useResponsiveValue(values, options = {}) {
|
|
|
2975
3034
|
return array[index >= array.length ? array.length - 1 : index];
|
|
2976
3035
|
}
|
|
2977
3036
|
|
|
2978
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3037
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/space.mjs
|
|
2979
3038
|
var GRID_BASE = "4px";
|
|
2980
3039
|
function space(value) {
|
|
2981
3040
|
if (typeof value === "undefined") {
|
|
@@ -2991,7 +3050,7 @@ function space(value) {
|
|
|
2991
3050
|
return `calc(${GRID_BASE} * ${value})`;
|
|
2992
3051
|
}
|
|
2993
3052
|
|
|
2994
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3053
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/truncate/styles.mjs
|
|
2995
3054
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() {
|
|
2996
3055
|
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
|
|
2997
3056
|
}
|
|
@@ -3004,7 +3063,7 @@ var Truncate = process.env.NODE_ENV === "production" ? {
|
|
|
3004
3063
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
3005
3064
|
};
|
|
3006
3065
|
|
|
3007
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3066
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/truncate/utils.mjs
|
|
3008
3067
|
var TRUNCATE_ELLIPSIS = "\u2026";
|
|
3009
3068
|
var TRUNCATE_TYPE = {
|
|
3010
3069
|
auto: "auto",
|
|
@@ -3066,7 +3125,7 @@ function truncateContent(words = "", props) {
|
|
|
3066
3125
|
return truncatedContent;
|
|
3067
3126
|
}
|
|
3068
3127
|
|
|
3069
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3128
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/truncate/hook.mjs
|
|
3070
3129
|
function useTruncate(props) {
|
|
3071
3130
|
const {
|
|
3072
3131
|
className,
|
|
@@ -3102,7 +3161,7 @@ function useTruncate(props) {
|
|
|
3102
3161
|
};
|
|
3103
3162
|
}
|
|
3104
3163
|
|
|
3105
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3164
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/text/styles.mjs
|
|
3106
3165
|
var styles_exports2 = {};
|
|
3107
3166
|
__export(styles_exports2, {
|
|
3108
3167
|
Text: () => Text,
|
|
@@ -3138,7 +3197,7 @@ var upperCase = process.env.NODE_ENV === "production" ? {
|
|
|
3138
3197
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__2
|
|
3139
3198
|
};
|
|
3140
3199
|
|
|
3141
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3200
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/text/utils.mjs
|
|
3142
3201
|
var import_highlight_words_core = __toESM(require_dist(), 1);
|
|
3143
3202
|
var lowercaseProps = (object) => {
|
|
3144
3203
|
const mapped = {};
|
|
@@ -3222,7 +3281,7 @@ function createHighlighterText({
|
|
|
3222
3281
|
return textContent;
|
|
3223
3282
|
}
|
|
3224
3283
|
|
|
3225
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3284
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/utils/font-size.mjs
|
|
3226
3285
|
var BASE_FONT_SIZE = 13;
|
|
3227
3286
|
var PRESET_FONT_SIZES = {
|
|
3228
3287
|
body: BASE_FONT_SIZE,
|
|
@@ -3248,7 +3307,7 @@ function getFontSize(size = BASE_FONT_SIZE) {
|
|
|
3248
3307
|
return `calc(${ratio} * ${config_values_default.fontSize})`;
|
|
3249
3308
|
}
|
|
3250
3309
|
|
|
3251
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3310
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/text/get-line-height.mjs
|
|
3252
3311
|
function getLineHeight(adjustLineHeightForInnerControls, lineHeight) {
|
|
3253
3312
|
if (lineHeight) {
|
|
3254
3313
|
return lineHeight;
|
|
@@ -3273,7 +3332,7 @@ function getLineHeight(adjustLineHeightForInnerControls, lineHeight) {
|
|
|
3273
3332
|
return value;
|
|
3274
3333
|
}
|
|
3275
3334
|
|
|
3276
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3335
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/text/hook.mjs
|
|
3277
3336
|
function _EMOTION_STRINGIFIED_CSS_ERROR__3() {
|
|
3278
3337
|
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
|
|
3279
3338
|
}
|
|
@@ -3384,7 +3443,7 @@ function useText(props) {
|
|
|
3384
3443
|
};
|
|
3385
3444
|
}
|
|
3386
3445
|
|
|
3387
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3446
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/text/component.mjs
|
|
3388
3447
|
import { jsx as _jsx3 } from "react/jsx-runtime";
|
|
3389
3448
|
function UnconnectedText(props, forwardedRef) {
|
|
3390
3449
|
const textProps = useText(props);
|
|
@@ -3397,7 +3456,7 @@ function UnconnectedText(props, forwardedRef) {
|
|
|
3397
3456
|
var Text2 = contextConnect(UnconnectedText, "Text");
|
|
3398
3457
|
var component_default2 = Text2;
|
|
3399
3458
|
|
|
3400
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3459
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/utils.mjs
|
|
3401
3460
|
var ALIGNMENTS = {
|
|
3402
3461
|
bottom: {
|
|
3403
3462
|
alignItems: "flex-end",
|
|
@@ -3448,7 +3507,7 @@ function getAlignmentProps(alignment) {
|
|
|
3448
3507
|
return alignmentProps;
|
|
3449
3508
|
}
|
|
3450
3509
|
|
|
3451
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3510
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/hook.mjs
|
|
3452
3511
|
function useGrid(props) {
|
|
3453
3512
|
const {
|
|
3454
3513
|
align,
|
|
@@ -3494,7 +3553,7 @@ function useGrid(props) {
|
|
|
3494
3553
|
};
|
|
3495
3554
|
}
|
|
3496
3555
|
|
|
3497
|
-
// ../../../node_modules/.pnpm/@wordpress+components@32.
|
|
3556
|
+
// ../../../node_modules/.pnpm/@wordpress+components@32.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wordpress/components/build-module/grid/component.mjs
|
|
3498
3557
|
import { jsx as _jsx4 } from "react/jsx-runtime";
|
|
3499
3558
|
function UnconnectedGrid(props, forwardedRef) {
|
|
3500
3559
|
const gridProps = useGrid(props);
|
|
@@ -3646,18 +3705,15 @@ var LeaderboardChartInternal = ({
|
|
|
3646
3705
|
animation,
|
|
3647
3706
|
loading = false,
|
|
3648
3707
|
showLegend = false,
|
|
3649
|
-
|
|
3650
|
-
legendPosition = "bottom",
|
|
3651
|
-
legendAlignment = "center",
|
|
3652
|
-
legendShape = "circle",
|
|
3653
|
-
legendShapeStyles: legendShapeStylesProp,
|
|
3708
|
+
legend = {},
|
|
3654
3709
|
legendLabels,
|
|
3655
|
-
legendInteractive = false,
|
|
3656
3710
|
gap = "md",
|
|
3657
3711
|
className,
|
|
3658
3712
|
style,
|
|
3659
3713
|
children
|
|
3660
3714
|
}) => {
|
|
3715
|
+
const legendInteractive = legend.interactive ?? false;
|
|
3716
|
+
const legendPosition = legend.position ?? "bottom";
|
|
3661
3717
|
const chartId = useChartId(providedChartId);
|
|
3662
3718
|
const {
|
|
3663
3719
|
leaderboardChart: leaderboardChartSettings
|
|
@@ -3665,10 +3721,11 @@ var LeaderboardChartInternal = ({
|
|
|
3665
3721
|
const legendShapeStyles = {
|
|
3666
3722
|
width: 8,
|
|
3667
3723
|
height: 8,
|
|
3668
|
-
...
|
|
3724
|
+
...legend.shapeStyles
|
|
3669
3725
|
};
|
|
3670
3726
|
const {
|
|
3671
|
-
|
|
3727
|
+
legendChildren,
|
|
3728
|
+
nonLegendChildren
|
|
3672
3729
|
} = useChartChildren(children, "LeaderboardChart");
|
|
3673
3730
|
const {
|
|
3674
3731
|
labelSpacing,
|
|
@@ -3758,15 +3815,18 @@ var LeaderboardChartInternal = ({
|
|
|
3758
3815
|
children: [/* @__PURE__ */ _jsx5("div", {
|
|
3759
3816
|
className: leaderboard_chart_module_default.emptyState,
|
|
3760
3817
|
children: loading ? __2("Loading\u2026", "jetpack-charts") : __2("No data available", "jetpack-charts")
|
|
3761
|
-
}),
|
|
3818
|
+
}), nonLegendChildren]
|
|
3762
3819
|
})
|
|
3763
3820
|
});
|
|
3764
3821
|
}
|
|
3765
3822
|
const legendElement = showLegend && /* @__PURE__ */ _jsx5(Legend, {
|
|
3766
|
-
orientation:
|
|
3823
|
+
orientation: legend.orientation ?? "horizontal",
|
|
3767
3824
|
position: legendPosition,
|
|
3768
|
-
alignment:
|
|
3769
|
-
|
|
3825
|
+
alignment: legend.alignment ?? "center",
|
|
3826
|
+
labelStyles: legend.labelStyles,
|
|
3827
|
+
itemClassName: legend.itemClassName,
|
|
3828
|
+
itemStyles: legend.itemStyles,
|
|
3829
|
+
shape: legend.shape ?? "circle",
|
|
3770
3830
|
shapeStyles: legendShapeStyles,
|
|
3771
3831
|
chartId,
|
|
3772
3832
|
interactive: legendInteractive
|
|
@@ -3790,7 +3850,7 @@ var LeaderboardChartInternal = ({
|
|
|
3790
3850
|
width: propWidth || void 0,
|
|
3791
3851
|
height: propHeight || void 0
|
|
3792
3852
|
},
|
|
3793
|
-
children: [legendPosition === "top" && legendElement, /* @__PURE__ */ _jsx5("div", {
|
|
3853
|
+
children: [legendPosition === "top" && legendElement, renderLegendSlot(legendChildren, "top"), /* @__PURE__ */ _jsx5("div", {
|
|
3794
3854
|
className: leaderboard_chart_module_default.leaderboardChart__content,
|
|
3795
3855
|
children: allSeriesHidden ? /* @__PURE__ */ _jsx5("div", {
|
|
3796
3856
|
className: leaderboard_chart_module_default.emptyState,
|
|
@@ -3834,7 +3894,7 @@ var LeaderboardChartInternal = ({
|
|
|
3834
3894
|
}, entry.id);
|
|
3835
3895
|
})
|
|
3836
3896
|
})
|
|
3837
|
-
}), legendPosition === "bottom" && legendElement,
|
|
3897
|
+
}), legendPosition === "bottom" && legendElement, renderLegendSlot(legendChildren, "bottom"), nonLegendChildren]
|
|
3838
3898
|
})
|
|
3839
3899
|
});
|
|
3840
3900
|
};
|
|
@@ -3894,4 +3954,4 @@ is-plain-object/dist/is-plain-object.mjs:
|
|
|
3894
3954
|
* Released under the MIT License.
|
|
3895
3955
|
*)
|
|
3896
3956
|
*/
|
|
3897
|
-
//# sourceMappingURL=chunk-
|
|
3957
|
+
//# sourceMappingURL=chunk-UTYVIOWZ.js.map
|