@automattic/charts 0.58.0 → 1.0.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 +25 -0
- package/README.md +7 -54
- package/dist/index.cjs +9606 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +20 -25
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +1612 -33
- package/dist/index.d.ts +1612 -33
- package/dist/index.js +9640 -56
- package/dist/index.js.map +1 -1
- package/package.json +8 -125
- package/src/charts/bar-chart/bar-chart.module.scss +0 -5
- package/src/charts/bar-chart/bar-chart.tsx +131 -137
- package/src/charts/leaderboard-chart/leaderboard-chart.tsx +23 -40
- package/src/charts/line-chart/line-chart.module.scss +0 -5
- package/src/charts/line-chart/line-chart.tsx +190 -183
- package/src/charts/line-chart/private/line-chart-annotations-overlay.tsx +1 -2
- package/src/charts/pie-chart/pie-chart.module.scss +2 -10
- package/src/charts/pie-chart/pie-chart.tsx +198 -199
- package/src/charts/pie-chart/test/composition-api.test.tsx +3 -3
- package/src/charts/pie-chart/test/pie-chart.test.tsx +42 -35
- package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.module.scss +2 -8
- package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +155 -155
- package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +25 -25
- package/src/charts/private/chart-layout/chart-layout.module.scss +7 -0
- package/src/charts/private/chart-layout/chart-layout.tsx +106 -0
- package/src/charts/private/chart-layout/index.ts +2 -0
- package/src/charts/private/chart-layout/test/chart-layout.test.tsx +167 -0
- package/src/charts/private/single-chart-context/single-chart-context.tsx +2 -2
- package/src/charts/private/svg-empty-state/index.ts +1 -0
- package/src/charts/private/svg-empty-state/svg-empty-state.module.scss +7 -0
- package/src/charts/private/svg-empty-state/svg-empty-state.tsx +40 -0
- package/src/components/legend/hooks/test/use-chart-legend-items.test.tsx +12 -8
- package/src/components/legend/hooks/use-chart-legend-items.ts +12 -13
- package/src/components/legend/legend.tsx +33 -8
- package/src/components/legend/test/legend.test.tsx +93 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-data-with-percentages.ts +24 -0
- package/src/hooks/use-interactive-legend-data.ts +18 -15
- package/src/index.ts +65 -2
- package/src/providers/chart-context/global-charts-provider.tsx +7 -1
- package/src/providers/chart-context/hooks/use-chart-registration.ts +2 -1
- package/src/providers/chart-context/types.ts +2 -2
- package/src/types.ts +27 -7
- package/src/utils/test/resolve-css-var.test.ts +2 -0
- package/dist/base-tooltip-DOq93wjU.d.cts +0 -38
- package/dist/base-tooltip-DOq93wjU.d.ts +0 -38
- package/dist/charts/bar-chart/index.cjs +0 -17
- package/dist/charts/bar-chart/index.cjs.map +0 -1
- package/dist/charts/bar-chart/index.css +0 -141
- package/dist/charts/bar-chart/index.css.map +0 -1
- package/dist/charts/bar-chart/index.d.cts +0 -36
- package/dist/charts/bar-chart/index.d.ts +0 -36
- package/dist/charts/bar-chart/index.js +0 -17
- package/dist/charts/bar-chart/index.js.map +0 -1
- package/dist/charts/bar-list-chart/index.cjs +0 -18
- package/dist/charts/bar-list-chart/index.cjs.map +0 -1
- package/dist/charts/bar-list-chart/index.css +0 -141
- package/dist/charts/bar-list-chart/index.css.map +0 -1
- package/dist/charts/bar-list-chart/index.d.cts +0 -92
- package/dist/charts/bar-list-chart/index.d.ts +0 -92
- package/dist/charts/bar-list-chart/index.js +0 -18
- package/dist/charts/bar-list-chart/index.js.map +0 -1
- package/dist/charts/conversion-funnel-chart/index.cjs +0 -11
- package/dist/charts/conversion-funnel-chart/index.cjs.map +0 -1
- package/dist/charts/conversion-funnel-chart/index.css +0 -157
- package/dist/charts/conversion-funnel-chart/index.css.map +0 -1
- package/dist/charts/conversion-funnel-chart/index.d.cts +0 -97
- package/dist/charts/conversion-funnel-chart/index.d.ts +0 -97
- package/dist/charts/conversion-funnel-chart/index.js +0 -11
- package/dist/charts/conversion-funnel-chart/index.js.map +0 -1
- package/dist/charts/geo-chart/index.cjs +0 -13
- package/dist/charts/geo-chart/index.cjs.map +0 -1
- package/dist/charts/geo-chart/index.css +0 -23
- package/dist/charts/geo-chart/index.css.map +0 -1
- package/dist/charts/geo-chart/index.d.cts +0 -67
- package/dist/charts/geo-chart/index.d.ts +0 -67
- package/dist/charts/geo-chart/index.js +0 -13
- package/dist/charts/geo-chart/index.js.map +0 -1
- package/dist/charts/leaderboard-chart/index.cjs +0 -21
- package/dist/charts/leaderboard-chart/index.cjs.map +0 -1
- package/dist/charts/leaderboard-chart/index.css +0 -160
- package/dist/charts/leaderboard-chart/index.css.map +0 -1
- package/dist/charts/leaderboard-chart/index.d.cts +0 -46
- package/dist/charts/leaderboard-chart/index.d.ts +0 -46
- package/dist/charts/leaderboard-chart/index.js +0 -21
- package/dist/charts/leaderboard-chart/index.js.map +0 -1
- package/dist/charts/line-chart/index.cjs +0 -17
- package/dist/charts/line-chart/index.cjs.map +0 -1
- package/dist/charts/line-chart/index.css +0 -213
- package/dist/charts/line-chart/index.css.map +0 -1
- package/dist/charts/line-chart/index.d.cts +0 -98
- package/dist/charts/line-chart/index.d.ts +0 -98
- package/dist/charts/line-chart/index.js +0 -17
- package/dist/charts/line-chart/index.js.map +0 -1
- package/dist/charts/pie-chart/index.cjs +0 -19
- package/dist/charts/pie-chart/index.cjs.map +0 -1
- package/dist/charts/pie-chart/index.css +0 -131
- package/dist/charts/pie-chart/index.css.map +0 -1
- package/dist/charts/pie-chart/index.d.cts +0 -91
- package/dist/charts/pie-chart/index.d.ts +0 -91
- package/dist/charts/pie-chart/index.js +0 -19
- package/dist/charts/pie-chart/index.js.map +0 -1
- package/dist/charts/pie-semi-circle-chart/index.cjs +0 -18
- package/dist/charts/pie-semi-circle-chart/index.cjs.map +0 -1
- package/dist/charts/pie-semi-circle-chart/index.css +0 -132
- package/dist/charts/pie-semi-circle-chart/index.css.map +0 -1
- package/dist/charts/pie-semi-circle-chart/index.d.cts +0 -88
- package/dist/charts/pie-semi-circle-chart/index.d.ts +0 -88
- package/dist/charts/pie-semi-circle-chart/index.js +0 -18
- package/dist/charts/pie-semi-circle-chart/index.js.map +0 -1
- package/dist/charts/sparkline/index.cjs +0 -18
- package/dist/charts/sparkline/index.cjs.map +0 -1
- package/dist/charts/sparkline/index.css +0 -230
- package/dist/charts/sparkline/index.css.map +0 -1
- package/dist/charts/sparkline/index.d.cts +0 -113
- package/dist/charts/sparkline/index.d.ts +0 -113
- package/dist/charts/sparkline/index.js +0 -18
- package/dist/charts/sparkline/index.js.map +0 -1
- package/dist/chunk-2A34OA5O.cjs +0 -51
- package/dist/chunk-2A34OA5O.cjs.map +0 -1
- package/dist/chunk-2I67QUIV.js +0 -895
- package/dist/chunk-2I67QUIV.js.map +0 -1
- package/dist/chunk-2ICEEQOC.js +0 -1071
- package/dist/chunk-2ICEEQOC.js.map +0 -1
- package/dist/chunk-4B7BL2DD.js +0 -120
- package/dist/chunk-4B7BL2DD.js.map +0 -1
- package/dist/chunk-4OXMTKAL.js +0 -401
- package/dist/chunk-4OXMTKAL.js.map +0 -1
- package/dist/chunk-ASLARV7L.cjs +0 -81
- package/dist/chunk-ASLARV7L.cjs.map +0 -1
- package/dist/chunk-B6NLZFRW.js +0 -617
- package/dist/chunk-B6NLZFRW.js.map +0 -1
- package/dist/chunk-BBAUQOW6.cjs +0 -120
- package/dist/chunk-BBAUQOW6.cjs.map +0 -1
- package/dist/chunk-BPYKWMI7.js +0 -194
- package/dist/chunk-BPYKWMI7.js.map +0 -1
- package/dist/chunk-CMMHCTBX.cjs +0 -373
- package/dist/chunk-CMMHCTBX.cjs.map +0 -1
- package/dist/chunk-CPPXJATQ.cjs +0 -1071
- package/dist/chunk-CPPXJATQ.cjs.map +0 -1
- package/dist/chunk-DKU775VC.js +0 -219
- package/dist/chunk-DKU775VC.js.map +0 -1
- package/dist/chunk-GRA7Y2ZG.cjs +0 -401
- package/dist/chunk-GRA7Y2ZG.cjs.map +0 -1
- package/dist/chunk-I2276W3I.cjs +0 -66
- package/dist/chunk-I2276W3I.cjs.map +0 -1
- package/dist/chunk-JJIMABHT.js +0 -351
- package/dist/chunk-JJIMABHT.js.map +0 -1
- package/dist/chunk-KJHWXOCZ.js +0 -421
- package/dist/chunk-KJHWXOCZ.js.map +0 -1
- package/dist/chunk-KRWGSOJ2.js +0 -91
- package/dist/chunk-KRWGSOJ2.js.map +0 -1
- package/dist/chunk-KXRWNFQJ.js +0 -51
- package/dist/chunk-KXRWNFQJ.js.map +0 -1
- package/dist/chunk-LTFH7SEG.js +0 -373
- package/dist/chunk-LTFH7SEG.js.map +0 -1
- package/dist/chunk-MUNOKLLE.js +0 -165
- package/dist/chunk-MUNOKLLE.js.map +0 -1
- package/dist/chunk-MXGLYWVP.cjs +0 -351
- package/dist/chunk-MXGLYWVP.cjs.map +0 -1
- package/dist/chunk-OP6PHB2U.js +0 -81
- package/dist/chunk-OP6PHB2U.js.map +0 -1
- package/dist/chunk-OYC34VTO.cjs +0 -3957
- package/dist/chunk-OYC34VTO.cjs.map +0 -1
- package/dist/chunk-PQL5I3F6.cjs +0 -421
- package/dist/chunk-PQL5I3F6.cjs.map +0 -1
- package/dist/chunk-REZTQ4PH.cjs +0 -488
- package/dist/chunk-REZTQ4PH.cjs.map +0 -1
- package/dist/chunk-TZRUHQOH.cjs +0 -91
- package/dist/chunk-TZRUHQOH.cjs.map +0 -1
- package/dist/chunk-UTYVIOWZ.js +0 -3957
- package/dist/chunk-UTYVIOWZ.js.map +0 -1
- package/dist/chunk-W2LDIX26.cjs +0 -165
- package/dist/chunk-W2LDIX26.cjs.map +0 -1
- package/dist/chunk-WSG64BVN.cjs +0 -219
- package/dist/chunk-WSG64BVN.cjs.map +0 -1
- package/dist/chunk-WTQYGUNF.js +0 -400
- package/dist/chunk-WTQYGUNF.js.map +0 -1
- package/dist/chunk-WYK7EL5R.cjs +0 -895
- package/dist/chunk-WYK7EL5R.cjs.map +0 -1
- package/dist/chunk-XC4KHJYX.cjs +0 -617
- package/dist/chunk-XC4KHJYX.cjs.map +0 -1
- package/dist/chunk-XVBH5XHE.cjs +0 -400
- package/dist/chunk-XVBH5XHE.cjs.map +0 -1
- package/dist/chunk-XWYZIFZW.js +0 -66
- package/dist/chunk-XWYZIFZW.js.map +0 -1
- package/dist/chunk-Y3NNQMAX.cjs +0 -194
- package/dist/chunk-Y3NNQMAX.cjs.map +0 -1
- package/dist/chunk-YAFQVVDI.js +0 -488
- package/dist/chunk-YAFQVVDI.js.map +0 -1
- package/dist/components/legend/index.cjs +0 -12
- package/dist/components/legend/index.cjs.map +0 -1
- package/dist/components/legend/index.css +0 -91
- package/dist/components/legend/index.css.map +0 -1
- package/dist/components/legend/index.d.cts +0 -37
- package/dist/components/legend/index.d.ts +0 -37
- package/dist/components/legend/index.js +0 -12
- package/dist/components/legend/index.js.map +0 -1
- package/dist/components/tooltip/index.cjs +0 -12
- package/dist/components/tooltip/index.cjs.map +0 -1
- package/dist/components/tooltip/index.css +0 -13
- package/dist/components/tooltip/index.css.map +0 -1
- package/dist/components/tooltip/index.d.cts +0 -71
- package/dist/components/tooltip/index.d.ts +0 -71
- package/dist/components/tooltip/index.js +0 -12
- package/dist/components/tooltip/index.js.map +0 -1
- package/dist/components/trend-indicator/index.cjs +0 -8
- package/dist/components/trend-indicator/index.cjs.map +0 -1
- package/dist/components/trend-indicator/index.css +0 -27
- package/dist/components/trend-indicator/index.css.map +0 -1
- package/dist/components/trend-indicator/index.d.cts +0 -44
- package/dist/components/trend-indicator/index.d.ts +0 -44
- package/dist/components/trend-indicator/index.js +0 -8
- package/dist/components/trend-indicator/index.js.map +0 -1
- package/dist/format-metric-value-MXm5DtQ_.d.cts +0 -24
- package/dist/format-metric-value-MXm5DtQ_.d.ts +0 -24
- package/dist/hooks/index.cjs +0 -29
- package/dist/hooks/index.cjs.map +0 -1
- package/dist/hooks/index.css +0 -9
- package/dist/hooks/index.css.map +0 -1
- package/dist/hooks/index.d.cts +0 -264
- package/dist/hooks/index.d.ts +0 -264
- package/dist/hooks/index.js +0 -29
- package/dist/hooks/index.js.map +0 -1
- package/dist/leaderboard-chart-BSbg0ufV.d.cts +0 -79
- package/dist/leaderboard-chart-odEYxxEC.d.ts +0 -79
- package/dist/legend-DFkosEvC.d.cts +0 -9
- package/dist/legend-DLswHhOk.d.ts +0 -9
- package/dist/providers/index.cjs +0 -21
- package/dist/providers/index.cjs.map +0 -1
- package/dist/providers/index.css +0 -9
- package/dist/providers/index.css.map +0 -1
- package/dist/providers/index.d.cts +0 -28
- package/dist/providers/index.d.ts +0 -28
- package/dist/providers/index.js +0 -21
- package/dist/providers/index.js.map +0 -1
- package/dist/themes-D0qc5JaW.d.cts +0 -67
- package/dist/themes-itO4Ht5g.d.ts +0 -67
- package/dist/types-B5f6XQ7Q.d.cts +0 -19
- package/dist/types-BsHooDbM.d.ts +0 -19
- package/dist/types-BuSrRM4p.d.ts +0 -49
- package/dist/types-ChOUI9-N.d.cts +0 -545
- package/dist/types-ChOUI9-N.d.ts +0 -545
- package/dist/types-Dfw9VOKI.d.cts +0 -49
- package/dist/utils/index.cjs +0 -44
- package/dist/utils/index.cjs.map +0 -1
- package/dist/utils/index.d.cts +0 -226
- package/dist/utils/index.d.ts +0 -226
- package/dist/utils/index.js +0 -44
- package/dist/utils/index.js.map +0 -1
- package/dist/with-responsive-CNfhzAUu.d.cts +0 -18
- package/dist/with-responsive-CNfhzAUu.d.ts +0 -18
package/dist/chunk-WTQYGUNF.js
DELETED
|
@@ -1,400 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GlobalChartsContext,
|
|
3
|
-
useGlobalChartsContext,
|
|
4
|
-
useGlobalChartsTheme,
|
|
5
|
-
useTextTruncation
|
|
6
|
-
} from "./chunk-2I67QUIV.js";
|
|
7
|
-
import {
|
|
8
|
-
formatPercentage
|
|
9
|
-
} from "./chunk-JJIMABHT.js";
|
|
10
|
-
|
|
11
|
-
// src/components/legend/legend.tsx
|
|
12
|
-
import { useContext as useContext3, useMemo, forwardRef as forwardRef2 } from "react";
|
|
13
|
-
|
|
14
|
-
// src/charts/private/single-chart-context/single-chart-context.tsx
|
|
15
|
-
import { createContext } from "react";
|
|
16
|
-
var ChartInstanceContext = /* @__PURE__ */ createContext(null);
|
|
17
|
-
var SingleChartContext = ChartInstanceContext;
|
|
18
|
-
|
|
19
|
-
// src/charts/private/single-chart-context/use-single-chart-context.ts
|
|
20
|
-
import { useContext } from "react";
|
|
21
|
-
var useChartInstanceContext = () => {
|
|
22
|
-
const context = useContext(ChartInstanceContext);
|
|
23
|
-
if (!context) {
|
|
24
|
-
throw new Error("useChartInstanceContext must be used within a Chart component");
|
|
25
|
-
}
|
|
26
|
-
return context;
|
|
27
|
-
};
|
|
28
|
-
var useSingleChartContext = useChartInstanceContext;
|
|
29
|
-
|
|
30
|
-
// src/components/legend/private/base-legend.tsx
|
|
31
|
-
import { Group } from "@visx/group";
|
|
32
|
-
import { LegendItem, LegendLabel, LegendOrdinal, LegendShape } from "@visx/legend";
|
|
33
|
-
import { scaleOrdinal } from "@visx/scale";
|
|
34
|
-
import clsx from "clsx";
|
|
35
|
-
import { forwardRef, useCallback, useContext as useContext2 } from "react";
|
|
36
|
-
|
|
37
|
-
// src/components/legend/utils/value-or-identity.ts
|
|
38
|
-
function valueOrIdentity(_) {
|
|
39
|
-
if (_ && typeof _ === "object" && "value" in _ && typeof _.value !== "undefined")
|
|
40
|
-
return _.value;
|
|
41
|
-
return _;
|
|
42
|
-
}
|
|
43
|
-
function valueOrIdentityString(_) {
|
|
44
|
-
return String(valueOrIdentity(_));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// src/components/legend/utils/label-transform-factory.ts
|
|
48
|
-
function labelTransformFactory({
|
|
49
|
-
scale,
|
|
50
|
-
labelFormat
|
|
51
|
-
}) {
|
|
52
|
-
return (d, i) => ({
|
|
53
|
-
datum: d,
|
|
54
|
-
index: i,
|
|
55
|
-
text: `${labelFormat(d, i)}`,
|
|
56
|
-
value: scale(d)
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// src/components/legend/private/base-legend.module.scss
|
|
61
|
-
var base_legend_module_default = {
|
|
62
|
-
"legend": "a8ccharts-89ApsU",
|
|
63
|
-
"legend--horizontal": "a8ccharts-AELBvX",
|
|
64
|
-
"legend--vertical": "a8ccharts-fX8uQe",
|
|
65
|
-
"legend--alignment-start": "a8ccharts-DEe0wg",
|
|
66
|
-
"legend--alignment-center": "a8ccharts-WBKF9I",
|
|
67
|
-
"legend--alignment-end": "a8ccharts-JfwMng",
|
|
68
|
-
"legend-item": "a8ccharts-Vflwq8",
|
|
69
|
-
"legend-item--interactive": "a8ccharts-qGsavM",
|
|
70
|
-
"legend-item--inactive": "a8ccharts-ZtDY-Q",
|
|
71
|
-
"legend-item-label": "a8ccharts-2H65Kr",
|
|
72
|
-
"legend-item-text--wrap": "a8ccharts-faSDBI",
|
|
73
|
-
"legend-item-text--ellipsis": "a8ccharts-FISUIO",
|
|
74
|
-
"legend-item-value": "a8ccharts-DTZlT-"
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// src/components/legend/private/base-legend.tsx
|
|
78
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
79
|
-
var orientationToFlexDirection = {
|
|
80
|
-
horizontal: "row",
|
|
81
|
-
vertical: "column"
|
|
82
|
-
};
|
|
83
|
-
var LegendText = ({
|
|
84
|
-
text,
|
|
85
|
-
textOverflow,
|
|
86
|
-
maxWidth
|
|
87
|
-
}) => {
|
|
88
|
-
const isEllipsis = maxWidth != null && textOverflow === "ellipsis";
|
|
89
|
-
const [textRef, isTruncated] = useTextTruncation(Boolean(isEllipsis));
|
|
90
|
-
return /* @__PURE__ */ _jsx("span", {
|
|
91
|
-
ref: textRef,
|
|
92
|
-
className: clsx(base_legend_module_default["legend-item-text"], maxWidth != null && base_legend_module_default[`legend-item-text--${textOverflow}`]),
|
|
93
|
-
style: {
|
|
94
|
-
...maxWidth != null && {
|
|
95
|
-
maxWidth,
|
|
96
|
-
minWidth: 0
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
title: isEllipsis && isTruncated ? text : void 0,
|
|
100
|
-
children: text
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
var BaseLegend = /* @__PURE__ */ forwardRef(({
|
|
104
|
-
items,
|
|
105
|
-
className,
|
|
106
|
-
orientation = "horizontal",
|
|
107
|
-
alignment = "center",
|
|
108
|
-
shape = "rect",
|
|
109
|
-
fill = valueOrIdentityString,
|
|
110
|
-
size = valueOrIdentityString,
|
|
111
|
-
labelFormat = valueOrIdentity,
|
|
112
|
-
labelTransform = labelTransformFactory,
|
|
113
|
-
itemStyles,
|
|
114
|
-
itemClassName,
|
|
115
|
-
labelStyles,
|
|
116
|
-
labelClassName,
|
|
117
|
-
shapeStyles,
|
|
118
|
-
render,
|
|
119
|
-
interactive = false,
|
|
120
|
-
chartId
|
|
121
|
-
}, ref) => {
|
|
122
|
-
const {
|
|
123
|
-
margin: itemMargin = "0",
|
|
124
|
-
flexDirection: itemDirection = "row"
|
|
125
|
-
} = itemStyles ?? {};
|
|
126
|
-
const {
|
|
127
|
-
justifyContent: labelJustifyContent = "flex-start",
|
|
128
|
-
flex: labelFlex = "0 0 auto",
|
|
129
|
-
margin: labelMargin = "0 4px",
|
|
130
|
-
maxWidth,
|
|
131
|
-
textOverflow = "wrap"
|
|
132
|
-
} = labelStyles ?? {};
|
|
133
|
-
const {
|
|
134
|
-
width: shapeWidth = 16,
|
|
135
|
-
height: shapeHeight = 16,
|
|
136
|
-
margin: shapeMargin = "2px 4px 2px 0"
|
|
137
|
-
} = shapeStyles ?? {};
|
|
138
|
-
const theme = useGlobalChartsTheme();
|
|
139
|
-
const context = useContext2(GlobalChartsContext);
|
|
140
|
-
const legendScale = scaleOrdinal({
|
|
141
|
-
domain: items.map((item) => item.label),
|
|
142
|
-
range: items.map((item) => item.color)
|
|
143
|
-
});
|
|
144
|
-
const domain = legendScale.domain();
|
|
145
|
-
const getShapeStyle = useCallback(({
|
|
146
|
-
index
|
|
147
|
-
}) => items[index]?.shapeStyle, [items]);
|
|
148
|
-
const handleLegendClick = useCallback((seriesLabel) => {
|
|
149
|
-
if (interactive && chartId && context) {
|
|
150
|
-
context.toggleSeriesVisibility(chartId, seriesLabel);
|
|
151
|
-
}
|
|
152
|
-
}, [interactive, chartId, context]);
|
|
153
|
-
const isSeriesVisible = useCallback((seriesLabel) => {
|
|
154
|
-
if (!interactive || !chartId || !context) {
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
return context.isSeriesVisible(chartId, seriesLabel);
|
|
158
|
-
}, [interactive, chartId, context]);
|
|
159
|
-
const createClickHandler = useCallback((labelText) => {
|
|
160
|
-
if (!interactive) {
|
|
161
|
-
return void 0;
|
|
162
|
-
}
|
|
163
|
-
return () => handleLegendClick(labelText);
|
|
164
|
-
}, [interactive, handleLegendClick]);
|
|
165
|
-
const createKeyDownHandler = useCallback((labelText) => {
|
|
166
|
-
if (!interactive) {
|
|
167
|
-
return void 0;
|
|
168
|
-
}
|
|
169
|
-
return (event) => {
|
|
170
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
171
|
-
event.preventDefault();
|
|
172
|
-
handleLegendClick(labelText);
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
}, [interactive, handleLegendClick]);
|
|
176
|
-
return render ? render(items) : /* @__PURE__ */ _jsx(LegendOrdinal, {
|
|
177
|
-
scale: legendScale,
|
|
178
|
-
labelFormat,
|
|
179
|
-
labelTransform,
|
|
180
|
-
children: (labels) => /* @__PURE__ */ _jsx("div", {
|
|
181
|
-
ref,
|
|
182
|
-
role: "list",
|
|
183
|
-
className: clsx(base_legend_module_default.legend, base_legend_module_default[`legend--${orientation}`], base_legend_module_default[`legend--alignment-${alignment}`], className),
|
|
184
|
-
style: {
|
|
185
|
-
flexDirection: orientationToFlexDirection[orientation],
|
|
186
|
-
...theme.legend?.containerStyles
|
|
187
|
-
},
|
|
188
|
-
children: labels.map((label, i) => {
|
|
189
|
-
const visible = isSeriesVisible(label.text);
|
|
190
|
-
const handleClick = createClickHandler(label.text);
|
|
191
|
-
const handleKeyDown = createKeyDownHandler(label.text);
|
|
192
|
-
const matchedItem = items[i];
|
|
193
|
-
return /* @__PURE__ */ _jsxs(LegendItem, {
|
|
194
|
-
className: clsx("visx-legend-item", base_legend_module_default["legend-item"], interactive && base_legend_module_default["legend-item--interactive"], !visible && base_legend_module_default["legend-item--inactive"], itemClassName),
|
|
195
|
-
margin: itemMargin,
|
|
196
|
-
flexDirection: orientation === "vertical" && alignment === "end" ? "row-reverse" : itemDirection,
|
|
197
|
-
onClick: handleClick,
|
|
198
|
-
onKeyDown: handleKeyDown,
|
|
199
|
-
role: interactive ? "button" : void 0,
|
|
200
|
-
tabIndex: interactive ? 0 : void 0,
|
|
201
|
-
"aria-pressed": interactive ? visible : void 0,
|
|
202
|
-
"aria-label": interactive ? `${label.text}: ${visible ? "visible" : "hidden"}. Toggle visibility.` : void 0,
|
|
203
|
-
children: [items[i]?.renderGlyph ? /* @__PURE__ */ _jsx("svg", {
|
|
204
|
-
width: items[i]?.glyphSize * 2,
|
|
205
|
-
height: items[i]?.glyphSize * 2,
|
|
206
|
-
children: /* @__PURE__ */ _jsx(Group, {
|
|
207
|
-
children: items[i]?.renderGlyph({
|
|
208
|
-
key: `legend-glyph-${label.text}`,
|
|
209
|
-
datum: {},
|
|
210
|
-
index: i,
|
|
211
|
-
color: fill(label),
|
|
212
|
-
size: items[i]?.glyphSize,
|
|
213
|
-
x: items[i]?.glyphSize,
|
|
214
|
-
y: items[i]?.glyphSize
|
|
215
|
-
})
|
|
216
|
-
})
|
|
217
|
-
}) : /* @__PURE__ */ _jsx(LegendShape, {
|
|
218
|
-
shape,
|
|
219
|
-
height: shapeHeight,
|
|
220
|
-
width: shapeWidth,
|
|
221
|
-
margin: shapeMargin,
|
|
222
|
-
item: domain[i],
|
|
223
|
-
itemIndex: i,
|
|
224
|
-
label,
|
|
225
|
-
fill,
|
|
226
|
-
size,
|
|
227
|
-
shapeStyle: getShapeStyle
|
|
228
|
-
}), /* @__PURE__ */ _jsxs(LegendLabel, {
|
|
229
|
-
className: clsx("visx-legend-label", base_legend_module_default["legend-item-label"], labelClassName),
|
|
230
|
-
style: {
|
|
231
|
-
justifyContent: labelJustifyContent,
|
|
232
|
-
flex: labelFlex,
|
|
233
|
-
margin: labelMargin,
|
|
234
|
-
...theme.legend?.labelStyles
|
|
235
|
-
},
|
|
236
|
-
children: [/* @__PURE__ */ _jsx(LegendText, {
|
|
237
|
-
text: label.text,
|
|
238
|
-
textOverflow,
|
|
239
|
-
maxWidth
|
|
240
|
-
}), matchedItem?.value != null && matchedItem.value !== "" && /* @__PURE__ */ _jsxs("span", {
|
|
241
|
-
className: base_legend_module_default["legend-item-value"],
|
|
242
|
-
children: ["\xA0", matchedItem.value]
|
|
243
|
-
})]
|
|
244
|
-
})]
|
|
245
|
-
}, `legend-${label.text}-${i}`);
|
|
246
|
-
})
|
|
247
|
-
})
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
// src/components/legend/legend.tsx
|
|
252
|
-
import { jsx as _jsx2 } from "react/jsx-runtime";
|
|
253
|
-
var Legend = /* @__PURE__ */ forwardRef2(({
|
|
254
|
-
chartId,
|
|
255
|
-
items,
|
|
256
|
-
...props
|
|
257
|
-
}, ref) => {
|
|
258
|
-
const context = useContext3(GlobalChartsContext);
|
|
259
|
-
const singleChartContext = useContext3(SingleChartContext);
|
|
260
|
-
const contextChartId = chartId ?? singleChartContext?.chartId;
|
|
261
|
-
const contextItems = useMemo(() => {
|
|
262
|
-
return contextChartId && context ? context.getChartData(contextChartId)?.legendItems : void 0;
|
|
263
|
-
}, [contextChartId, context]);
|
|
264
|
-
const legendItems = items || contextItems;
|
|
265
|
-
if (!legendItems) {
|
|
266
|
-
return null;
|
|
267
|
-
}
|
|
268
|
-
return /* @__PURE__ */ _jsx2(BaseLegend, {
|
|
269
|
-
ref,
|
|
270
|
-
items: legendItems,
|
|
271
|
-
...props,
|
|
272
|
-
chartId: contextChartId
|
|
273
|
-
});
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
// src/components/legend/hooks/use-chart-legend-items.ts
|
|
277
|
-
import { formatNumber } from "@automattic/number-formatters";
|
|
278
|
-
import { useMemo as useMemo2 } from "react";
|
|
279
|
-
function formatPointValue(point, showValues, legendValueDisplay = "percentage") {
|
|
280
|
-
if (!showValues || legendValueDisplay === "none") {
|
|
281
|
-
return "";
|
|
282
|
-
}
|
|
283
|
-
if ("percentage" in point) {
|
|
284
|
-
const percentagePoint = point;
|
|
285
|
-
switch (legendValueDisplay) {
|
|
286
|
-
case "percentage":
|
|
287
|
-
return formatPercentage(percentagePoint.percentage);
|
|
288
|
-
case "value":
|
|
289
|
-
return formatNumber(percentagePoint.value);
|
|
290
|
-
case "valueDisplay":
|
|
291
|
-
return percentagePoint.valueDisplay || formatNumber(percentagePoint.value);
|
|
292
|
-
default:
|
|
293
|
-
return "";
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
if ("value" in point) {
|
|
297
|
-
return point.value !== null ? formatNumber(point.value) : "";
|
|
298
|
-
}
|
|
299
|
-
return "";
|
|
300
|
-
}
|
|
301
|
-
function applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize) {
|
|
302
|
-
if (withGlyph) {
|
|
303
|
-
const glyphToUse = glyph || renderGlyph;
|
|
304
|
-
if (glyphToUse) {
|
|
305
|
-
return {
|
|
306
|
-
...baseItem,
|
|
307
|
-
glyphSize,
|
|
308
|
-
renderGlyph: glyphToUse
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
return baseItem;
|
|
313
|
-
}
|
|
314
|
-
function processSeriesData(seriesData, getElementStyles, showValues, withGlyph, glyphSize, renderGlyph, legendShape) {
|
|
315
|
-
const mapper = (series, index) => {
|
|
316
|
-
const { color, glyph, shapeStyles } = getElementStyles({
|
|
317
|
-
data: series,
|
|
318
|
-
index,
|
|
319
|
-
legendShape
|
|
320
|
-
});
|
|
321
|
-
const baseItem = {
|
|
322
|
-
label: series.label,
|
|
323
|
-
value: showValues ? series.data?.length?.toString() || "0" : "",
|
|
324
|
-
color,
|
|
325
|
-
shapeStyle: shapeStyles
|
|
326
|
-
};
|
|
327
|
-
return applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize);
|
|
328
|
-
};
|
|
329
|
-
return seriesData.map(mapper);
|
|
330
|
-
}
|
|
331
|
-
function processPointData(pointData, getElementStyles, showValues, legendValueDisplay, withGlyph, glyphSize, renderGlyph, legendShape) {
|
|
332
|
-
const mapper = (point, index) => {
|
|
333
|
-
const { color, glyph, shapeStyles } = getElementStyles({
|
|
334
|
-
data: point,
|
|
335
|
-
index,
|
|
336
|
-
legendShape
|
|
337
|
-
});
|
|
338
|
-
const baseItem = {
|
|
339
|
-
label: point.label,
|
|
340
|
-
value: formatPointValue(point, showValues, legendValueDisplay),
|
|
341
|
-
color,
|
|
342
|
-
shapeStyle: shapeStyles
|
|
343
|
-
};
|
|
344
|
-
return applyGlyphToLegendItem(baseItem, withGlyph, glyph, renderGlyph, glyphSize);
|
|
345
|
-
};
|
|
346
|
-
return pointData.map(mapper);
|
|
347
|
-
}
|
|
348
|
-
function useChartLegendItems(data, options = {}, legendShape) {
|
|
349
|
-
const {
|
|
350
|
-
showValues = false,
|
|
351
|
-
legendValueDisplay = "percentage",
|
|
352
|
-
withGlyph = false,
|
|
353
|
-
glyphSize = 8,
|
|
354
|
-
renderGlyph
|
|
355
|
-
} = options;
|
|
356
|
-
const { getElementStyles } = useGlobalChartsContext();
|
|
357
|
-
return useMemo2(() => {
|
|
358
|
-
if (!data || !Array.isArray(data) || data.length === 0) {
|
|
359
|
-
return [];
|
|
360
|
-
}
|
|
361
|
-
if ("data" in data[0]) {
|
|
362
|
-
return processSeriesData(
|
|
363
|
-
data,
|
|
364
|
-
getElementStyles,
|
|
365
|
-
showValues,
|
|
366
|
-
withGlyph,
|
|
367
|
-
glyphSize,
|
|
368
|
-
renderGlyph,
|
|
369
|
-
legendShape
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
return processPointData(
|
|
373
|
-
data,
|
|
374
|
-
getElementStyles,
|
|
375
|
-
showValues,
|
|
376
|
-
legendValueDisplay,
|
|
377
|
-
withGlyph,
|
|
378
|
-
glyphSize,
|
|
379
|
-
renderGlyph,
|
|
380
|
-
legendShape
|
|
381
|
-
);
|
|
382
|
-
}, [
|
|
383
|
-
data,
|
|
384
|
-
getElementStyles,
|
|
385
|
-
showValues,
|
|
386
|
-
legendValueDisplay,
|
|
387
|
-
withGlyph,
|
|
388
|
-
glyphSize,
|
|
389
|
-
renderGlyph,
|
|
390
|
-
legendShape
|
|
391
|
-
]);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
export {
|
|
395
|
-
SingleChartContext,
|
|
396
|
-
useSingleChartContext,
|
|
397
|
-
Legend,
|
|
398
|
-
useChartLegendItems
|
|
399
|
-
};
|
|
400
|
-
//# sourceMappingURL=chunk-WTQYGUNF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/legend/legend.tsx","../src/charts/private/single-chart-context/single-chart-context.tsx","../src/charts/private/single-chart-context/use-single-chart-context.ts","../src/components/legend/private/base-legend.tsx","../src/components/legend/utils/value-or-identity.ts","../src/components/legend/utils/label-transform-factory.ts","../src/components/legend/private/base-legend.module.scss","../src/components/legend/hooks/use-chart-legend-items.ts"],"sourcesContent":["import { useContext, useMemo, forwardRef } from 'react';\nimport { SingleChartContext } from '../../charts/private/single-chart-context';\nimport { GlobalChartsContext } from '../../providers';\nimport { BaseLegend } from './private';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const Legend = /*#__PURE__*/forwardRef(({\n chartId,\n items,\n ...props\n}, ref) => {\n // Get context but don't throw if it doesn't exist\n const context = useContext(GlobalChartsContext);\n const singleChartContext = useContext(SingleChartContext);\n\n // When chartId is used, it is standalone mode\n // When chartId is not provided, we use the context's chartId, meaning it is in a single chart context\n const contextChartId = chartId ?? singleChartContext?.chartId;\n\n // Use useMemo to ensure re-rendering when context changes\n const contextItems = useMemo(() => {\n return contextChartId && context ? context.getChartData(contextChartId)?.legendItems : undefined;\n }, [contextChartId, context]);\n\n // Provided items take precedence over context items\n const legendItems = items || contextItems;\n if (!legendItems) {\n return null;\n }\n return /*#__PURE__*/_jsx(BaseLegend, {\n ref: ref,\n items: legendItems,\n ...props,\n chartId: contextChartId\n });\n});","import { createContext } from 'react';\n\n// Local context for chart implicit state sharing\n\nexport const ChartInstanceContext = /*#__PURE__*/createContext(null);\n\n// Backward compatibility exports\nexport const SingleChartContext = ChartInstanceContext;","import { useContext } from 'react';\nimport { ChartInstanceContext, type ChartInstanceContextValue } from './single-chart-context';\n\nexport const useChartInstanceContext = (): ChartInstanceContextValue => {\n\tconst context = useContext( ChartInstanceContext );\n\tif ( ! context ) {\n\t\tthrow new Error( 'useChartInstanceContext must be used within a Chart component' );\n\t}\n\treturn context;\n};\n\nexport const useSingleChartContext = useChartInstanceContext;\n","import { Group } from '@visx/group';\nimport { LegendItem, LegendLabel, LegendOrdinal, LegendShape } from '@visx/legend';\nimport { scaleOrdinal } from '@visx/scale';\nimport clsx from 'clsx';\nimport { forwardRef, useCallback, useContext } from 'react';\nimport { useTextTruncation } from '../../../hooks';\nimport { GlobalChartsContext, useGlobalChartsTheme } from '../../../providers';\nimport { valueOrIdentity, valueOrIdentityString, labelTransformFactory } from '../utils';\nimport styles from './base-legend.module.scss';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst orientationToFlexDirection = {\n horizontal: 'row',\n vertical: 'column'\n};\n\n// Component for legend text with truncation detection\n// Moved outside BaseLegend to prevent recreation on every render\nconst LegendText = ({\n text,\n textOverflow,\n maxWidth\n}) => {\n const isEllipsis = maxWidth != null && textOverflow === 'ellipsis';\n const [textRef, isTruncated] = useTextTruncation(Boolean(isEllipsis));\n return /*#__PURE__*/_jsx(\"span\", {\n ref: textRef,\n className: clsx(styles['legend-item-text'], maxWidth != null && styles[`legend-item-text--${textOverflow}`]),\n style: {\n ...(maxWidth != null && {\n maxWidth,\n minWidth: 0\n })\n },\n title: isEllipsis && isTruncated ? text : undefined,\n children: text\n });\n};\n\n/*\n * Base legend component that displays color-coded items with labels based on visx LegendOrdinal.\n * We avoid using LegendOrdinal directly to enable support for advanced features such as interactivity.\n */\nexport const BaseLegend = /*#__PURE__*/forwardRef(({\n items,\n className,\n orientation = 'horizontal',\n alignment = 'center',\n shape = 'rect',\n fill = valueOrIdentityString,\n size = valueOrIdentityString,\n labelFormat = valueOrIdentity,\n labelTransform = labelTransformFactory,\n itemStyles,\n itemClassName,\n labelStyles,\n labelClassName,\n shapeStyles,\n render,\n interactive = false,\n chartId\n}, ref) => {\n const {\n margin: itemMargin = '0',\n flexDirection: itemDirection = 'row'\n } = itemStyles ?? {};\n const {\n justifyContent: labelJustifyContent = 'flex-start',\n flex: labelFlex = '0 0 auto',\n margin: labelMargin = '0 4px',\n maxWidth,\n textOverflow = 'wrap'\n } = labelStyles ?? {};\n const {\n width: shapeWidth = 16,\n height: shapeHeight = 16,\n margin: shapeMargin = '2px 4px 2px 0'\n } = shapeStyles ?? {};\n const theme = useGlobalChartsTheme();\n const context = useContext(GlobalChartsContext);\n const legendScale = scaleOrdinal({\n domain: items.map(item => item.label),\n range: items.map(item => item.color)\n });\n const domain = legendScale.domain();\n const getShapeStyle = useCallback(({\n index\n }) => items[index]?.shapeStyle, [items]);\n\n // Handle legend item clicks for interactive mode\n const handleLegendClick = useCallback(seriesLabel => {\n if (interactive && chartId && context) {\n context.toggleSeriesVisibility(chartId, seriesLabel);\n }\n }, [interactive, chartId, context]);\n\n // Check if a series is visible\n const isSeriesVisible = useCallback(seriesLabel => {\n if (!interactive || !chartId || !context) {\n return true;\n }\n return context.isSeriesVisible(chartId, seriesLabel);\n }, [interactive, chartId, context]);\n\n // Create event handlers to avoid inline arrow functions\n const createClickHandler = useCallback(labelText => {\n if (!interactive) {\n return undefined;\n }\n return () => handleLegendClick(labelText);\n }, [interactive, handleLegendClick]);\n const createKeyDownHandler = useCallback(labelText => {\n if (!interactive) {\n return undefined;\n }\n return event => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleLegendClick(labelText);\n }\n };\n }, [interactive, handleLegendClick]);\n return render ? render(items) : /*#__PURE__*/_jsx(LegendOrdinal, {\n scale: legendScale,\n labelFormat: labelFormat,\n labelTransform: labelTransform,\n children: labels => /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n role: \"list\",\n className: clsx(styles.legend, styles[`legend--${orientation}`], styles[`legend--alignment-${alignment}`], className),\n style: {\n flexDirection: orientationToFlexDirection[orientation],\n ...theme.legend?.containerStyles\n },\n children: labels.map((label, i) => {\n const visible = isSeriesVisible(label.text);\n const handleClick = createClickHandler(label.text);\n const handleKeyDown = createKeyDownHandler(label.text);\n const matchedItem = items[i];\n return /*#__PURE__*/_jsxs(LegendItem, {\n className: clsx('visx-legend-item', styles['legend-item'], interactive && styles['legend-item--interactive'], !visible && styles['legend-item--inactive'], itemClassName),\n margin: itemMargin,\n flexDirection: orientation === 'vertical' && alignment === 'end' ? 'row-reverse' : itemDirection,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n role: interactive ? 'button' : undefined,\n tabIndex: interactive ? 0 : undefined,\n \"aria-pressed\": interactive ? visible : undefined,\n \"aria-label\": interactive ? `${label.text}: ${visible ? 'visible' : 'hidden'}. Toggle visibility.` : undefined,\n children: [items[i]?.renderGlyph ? /*#__PURE__*/_jsx(\"svg\", {\n width: items[i]?.glyphSize * 2,\n height: items[i]?.glyphSize * 2,\n children: /*#__PURE__*/_jsx(Group, {\n children: items[i]?.renderGlyph({\n key: `legend-glyph-${label.text}`,\n datum: {},\n index: i,\n color: fill(label),\n size: items[i]?.glyphSize,\n x: items[i]?.glyphSize,\n y: items[i]?.glyphSize\n })\n })\n }) : /*#__PURE__*/_jsx(LegendShape, {\n shape: shape,\n height: shapeHeight,\n width: shapeWidth,\n margin: shapeMargin,\n item: domain[i],\n itemIndex: i,\n label: label,\n fill: fill,\n size: size,\n shapeStyle: getShapeStyle\n }), /*#__PURE__*/_jsxs(LegendLabel, {\n className: clsx('visx-legend-label', styles['legend-item-label'], labelClassName),\n style: {\n justifyContent: labelJustifyContent,\n flex: labelFlex,\n margin: labelMargin,\n ...theme.legend?.labelStyles\n },\n children: [/*#__PURE__*/_jsx(LegendText, {\n text: label.text,\n textOverflow: textOverflow,\n maxWidth: maxWidth\n }), matchedItem?.value != null && matchedItem.value !== '' && /*#__PURE__*/_jsxs(\"span\", {\n className: styles['legend-item-value'],\n children: ['\\u00A0', matchedItem.value]\n })]\n })]\n }, `legend-${label.text}-${i}`);\n })\n })\n });\n});","export type ValueOrIdentity< T > = T | { value?: T };\n\n/**\n * Returns an object's value if defined, or the object.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentity< T >( _: ValueOrIdentity< T > ): T {\n\tif ( _ && typeof _ === 'object' && 'value' in _ && typeof _.value !== 'undefined' )\n\t\treturn _.value;\n\treturn _ as T;\n}\n\n/**\n * Returns an object's value if defined, or the object, coerced to a string.\n * @param _ - The object to return the value of.\n * @return The value of the object, or the object itself.\n */\nexport function valueOrIdentityString< T >( _: ValueOrIdentity< T > ): string {\n\treturn String( valueOrIdentity( _ ) );\n}\n","import type { ItemTransformer, LabelFormatter } from '@visx/legend/lib/types';\nimport type { AnyD3Scale, ScaleInput } from '@visx/scale';\n\n/**\n * Returns a function which takes a Datum and index as input, and returns a formatted label object.\n * @param {object} root0 - The object to return the value of.\n * @param {AnyD3Scale} root0.scale - The scale to use.\n * @param {LabelFormatter<ScaleInput<Scale>>} root0.labelFormat - The label format to use.\n * @return {ItemTransformer<ScaleInput<Scale>, ReturnType<Scale>>} The label transform factory.\n */\nexport function labelTransformFactory< Scale extends AnyD3Scale >( {\n\tscale,\n\tlabelFormat,\n}: {\n\tscale: Scale;\n\tlabelFormat: LabelFormatter< ScaleInput< Scale > >;\n} ): ItemTransformer< ScaleInput< Scale >, ReturnType< Scale > > {\n\treturn ( d, i ) => ( {\n\t\tdatum: d,\n\t\tindex: i,\n\t\ttext: `${ labelFormat( d, i ) }`,\n\t\tvalue: scale( d ),\n\t} );\n}\n","import 'css-chunk:src/components/legend/private/base-legend.module.scss';export default {\n \"legend\": \"a8ccharts-89ApsU\",\n \"legend--horizontal\": \"a8ccharts-AELBvX\",\n \"legend--vertical\": \"a8ccharts-fX8uQe\",\n \"legend--alignment-start\": \"a8ccharts-DEe0wg\",\n \"legend--alignment-center\": \"a8ccharts-WBKF9I\",\n \"legend--alignment-end\": \"a8ccharts-JfwMng\",\n \"legend-item\": \"a8ccharts-Vflwq8\",\n \"legend-item--interactive\": \"a8ccharts-qGsavM\",\n \"legend-item--inactive\": \"a8ccharts-ZtDY-Q\",\n \"legend-item-label\": \"a8ccharts-2H65Kr\",\n \"legend-item-text--wrap\": \"a8ccharts-faSDBI\",\n \"legend-item-text--ellipsis\": \"a8ccharts-FISUIO\",\n \"legend-item-value\": \"a8ccharts-DTZlT-\"\n};","import { formatNumber } from '@automattic/number-formatters';\nimport { useMemo } from 'react';\nimport {\n\tuseGlobalChartsContext,\n\ttype GetElementStylesParams,\n\ttype ElementStyles,\n} from '../../../providers';\nimport { formatPercentage } from '../../../utils';\nimport type { SeriesData, DataPointDate, DataPointPercentage } from '../../../types';\nimport type { BaseLegendItem } from '../types';\nimport type { LegendShape } from '@visx/legend/lib/types';\nimport type { GlyphProps } from '@visx/xychart';\nimport type { ReactNode } from 'react';\n\nexport type LegendValueDisplay = 'percentage' | 'value' | 'valueDisplay' | 'none';\n\nexport interface ChartLegendOptions {\n\twithGlyph?: boolean;\n\tglyphSize?: number;\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode;\n\tshowValues?: boolean;\n\tlegendValueDisplay?: LegendValueDisplay;\n\tlegendShape?: LegendShape< SeriesData[], number >;\n}\n\n/**\n * Formats the value for a data point based on its type and display preference\n * @param point - The data point to format\n * @param showValues - Whether to show values or return empty string\n * @param legendValueDisplay - What type of value to display\n * @return Formatted value string\n */\nfunction formatPointValue(\n\tpoint: DataPointDate | DataPointPercentage,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay = 'percentage'\n): string {\n\tif ( ! showValues || legendValueDisplay === 'none' ) {\n\t\treturn '';\n\t}\n\n\t// Handle DataPointPercentage (pie chart data)\n\tif ( 'percentage' in point ) {\n\t\tconst percentagePoint = point as DataPointPercentage;\n\t\tswitch ( legendValueDisplay ) {\n\t\t\tcase 'percentage':\n\t\t\t\treturn formatPercentage( percentagePoint.percentage );\n\t\t\tcase 'value':\n\t\t\t\treturn formatNumber( percentagePoint.value );\n\t\t\tcase 'valueDisplay':\n\t\t\t\treturn percentagePoint.valueDisplay || formatNumber( percentagePoint.value );\n\t\t\tdefault:\n\t\t\t\treturn '';\n\t\t}\n\t}\n\n\t// Handle DataPointDate (time series data)\n\tif ( 'value' in point ) {\n\t\treturn point.value !== null ? formatNumber( point.value ) : '';\n\t}\n\n\treturn '';\n}\n\n/**\n * Applies glyph configuration to a legend item if needed\n * @param baseItem - The base legend item\n * @param withGlyph - Whether to include glyph rendering\n * @param glyph - Glyph component from theme\n * @param renderGlyph - Custom glyph render function\n * @param glyphSize - Size of the glyph\n * @return The legend item with glyph configuration applied if applicable\n */\nfunction applyGlyphToLegendItem(\n\tbaseItem: BaseLegendItem,\n\twithGlyph: boolean,\n\tglyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tglyphSize?: number\n): BaseLegendItem {\n\tif ( withGlyph ) {\n\t\tconst glyphToUse = glyph || renderGlyph;\n\t\tif ( glyphToUse ) {\n\t\t\treturn {\n\t\t\t\t...baseItem,\n\t\t\t\tglyphSize,\n\t\t\t\trenderGlyph: glyphToUse,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn baseItem;\n}\n\n/**\n * Processes SeriesData into legend items\n * @param seriesData - The series data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processSeriesData(\n\tseriesData: SeriesData[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst mapper = ( series: SeriesData, index: number ) => {\n\t\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\t\tdata: series,\n\t\t\tindex,\n\t\t\tlegendShape,\n\t\t} );\n\n\t\tconst baseItem: BaseLegendItem = {\n\t\t\tlabel: series.label,\n\t\t\tvalue: showValues ? series.data?.length?.toString() || '0' : '',\n\t\t\tcolor,\n\t\t\tshapeStyle: shapeStyles,\n\t\t};\n\n\t\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n\t};\n\n\treturn seriesData.map( mapper );\n}\n\n/**\n * Processes point data into legend items\n * @param pointData - The point data to process\n * @param getElementStyles - Function to get element styles\n * @param showValues - Whether to show values in legend\n * @param legendValueDisplay - What type of value to display\n * @param withGlyph - Whether to include glyph rendering\n * @param glyphSize - Size of the glyph\n * @param renderGlyph - Component to render the glyph\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of processed legend items\n */\nfunction processPointData(\n\tpointData: ( DataPointDate | DataPointPercentage )[],\n\tgetElementStyles: ( params: GetElementStylesParams ) => ElementStyles,\n\tshowValues: boolean,\n\tlegendValueDisplay: LegendValueDisplay,\n\twithGlyph: boolean,\n\tglyphSize: number,\n\trenderGlyph?: < Datum extends object >( props: GlyphProps< Datum > ) => ReactNode,\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst mapper = ( point: DataPointDate | DataPointPercentage, index: number ) => {\n\t\tconst { color, glyph, shapeStyles } = getElementStyles( {\n\t\t\tdata: point as DataPointPercentage,\n\t\t\tindex,\n\t\t\tlegendShape,\n\t\t} );\n\n\t\tconst baseItem: BaseLegendItem = {\n\t\t\tlabel: point.label,\n\t\t\tvalue: formatPointValue( point, showValues, legendValueDisplay ),\n\t\t\tcolor,\n\t\t\tshapeStyle: shapeStyles,\n\t\t};\n\n\t\treturn applyGlyphToLegendItem( baseItem, withGlyph, glyph, renderGlyph, glyphSize );\n\t};\n\n\treturn pointData.map( mapper );\n}\n\n/**\n * Hook to transform chart data into legend items\n * @param data - The chart data to transform\n * @param options - Configuration options for legend generation\n * @param legendShape - The shape type for legend items (string literal or React component)\n * @return Array of legend items ready for display\n */\nexport function useChartLegendItems<\n\tT extends SeriesData[] | DataPointDate[] | DataPointPercentage[],\n>(\n\tdata: T,\n\toptions: ChartLegendOptions = {},\n\tlegendShape?: LegendShape< SeriesData[], number >\n): BaseLegendItem[] {\n\tconst {\n\t\tshowValues = false,\n\t\tlegendValueDisplay = 'percentage',\n\t\twithGlyph = false,\n\t\tglyphSize = 8,\n\t\trenderGlyph,\n\t} = options;\n\tconst { getElementStyles } = useGlobalChartsContext();\n\n\treturn useMemo( () => {\n\t\tif ( ! data || ! Array.isArray( data ) || data.length === 0 ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// Handle SeriesData (multiple series with data points)\n\t\tif ( 'data' in data[ 0 ] ) {\n\t\t\treturn processSeriesData(\n\t\t\t\tdata as SeriesData[],\n\t\t\t\tgetElementStyles,\n\t\t\t\tshowValues,\n\t\t\t\twithGlyph,\n\t\t\t\tglyphSize,\n\t\t\t\trenderGlyph,\n\t\t\t\tlegendShape\n\t\t\t);\n\t\t}\n\n\t\t// Handle DataPointDate or DataPointPercentage (single data points)\n\t\treturn processPointData(\n\t\t\tdata as ( DataPointDate | DataPointPercentage )[],\n\t\t\tgetElementStyles,\n\t\t\tshowValues,\n\t\t\tlegendValueDisplay,\n\t\t\twithGlyph,\n\t\t\tglyphSize,\n\t\t\trenderGlyph,\n\t\t\tlegendShape\n\t\t);\n\t}, [\n\t\tdata,\n\t\tgetElementStyles,\n\t\tshowValues,\n\t\tlegendValueDisplay,\n\t\twithGlyph,\n\t\tglyphSize,\n\t\trenderGlyph,\n\t\tlegendShape,\n\t] );\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,cAAAA,aAAY,SAAS,cAAAC,mBAAkB;;;ACAhD,SAAS,qBAAqB;AAIvB,IAAM,uBAAoC,8BAAc,IAAI;AAG5D,IAAM,qBAAqB;;;ACPlC,SAAS,kBAAkB;AAGpB,IAAM,0BAA0B,MAAiC;AACvE,QAAM,UAAU,WAAY,oBAAqB;AACjD,MAAK,CAAE,SAAU;AAChB,UAAM,IAAI,MAAO,+DAAgE;AAAA,EAClF;AACA,SAAO;AACR;AAEO,IAAM,wBAAwB;;;ACXrC,SAAS,aAAa;AACtB,SAAS,YAAY,aAAa,eAAe,mBAAmB;AACpE,SAAS,oBAAoB;AAC7B,OAAO,UAAU;AACjB,SAAS,YAAY,aAAa,cAAAC,mBAAkB;;;ACG7C,SAAS,gBAAsB,GAA6B;AAClE,MAAK,KAAK,OAAO,MAAM,YAAY,WAAW,KAAK,OAAO,EAAE,UAAU;AACrE,WAAO,EAAE;AACV,SAAO;AACR;AAOO,SAAS,sBAA4B,GAAkC;AAC7E,SAAO,OAAQ,gBAAiB,CAAE,CAAE;AACrC;;;ACVO,SAAS,sBAAmD;AAAA,EAClE;AAAA,EACA;AACD,GAGiE;AAChE,SAAO,CAAE,GAAG,OAAS;AAAA,IACpB,OAAO;AAAA,IACP,OAAO;AAAA,IACP,MAAM,GAAI,YAAa,GAAG,CAAE,CAAE;AAAA,IAC9B,OAAO,MAAO,CAAE;AAAA,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AAM,QAAS,IAAK,KAAK,KAAK,WAAW,GAAI;AAC7D,aAAO,CAAC;AAAA,IACT;AAGA,QAAK,UAAU,KAAM,CAAE,GAAI;AAC1B,aAAO;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAGA,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;","names":["useContext","forwardRef","useContext","useContext","_jsx","forwardRef","useContext","useMemo","useMemo"]}
|