@neo4j-ndl/react-charts 2.1.21 → 2.2.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/lib/LICENSES.txt +0 -295
- package/lib/NOTICE.txt +1383 -1392
- package/lib/{esm/charts/index.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/defineProperty.js} +13 -5
- package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js +46 -0
- package/lib/{esm/charts/tests/ChartWrapperWithTooltipFormatter.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.js} +12 -13
- package/lib/{esm/index.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutPropertiesLoose.js} +13 -2
- package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPrimitive.js +35 -0
- package/lib/{esm/charts/utils/chart-types.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPropertyKey.js} +10 -2
- package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/typeof.js +37 -0
- package/lib/cjs/_virtual/_rolldown/runtime.js +44 -0
- package/lib/cjs/charts/Chart.js +121 -111
- package/lib/cjs/charts/Chart.js.map +1 -1
- package/lib/cjs/charts/ChartContainer.js +67 -62
- package/lib/cjs/charts/ChartContainer.js.map +1 -1
- package/lib/cjs/charts/ChartEmpty.js +45 -30
- package/lib/cjs/charts/ChartEmpty.js.map +1 -1
- package/lib/cjs/charts/ChartRender.js +112 -87
- package/lib/cjs/charts/ChartRender.js.map +1 -1
- package/lib/cjs/charts/ChartTooltip.js +111 -65
- package/lib/cjs/charts/ChartTooltip.js.map +1 -1
- package/lib/cjs/charts/Legend.js +81 -69
- package/lib/cjs/charts/Legend.js.map +1 -1
- package/lib/cjs/charts/LegendItem.js +83 -62
- package/lib/cjs/charts/LegendItem.js.map +1 -1
- package/lib/cjs/charts/LegendLayout.js +330 -348
- package/lib/cjs/charts/LegendLayout.js.map +1 -1
- package/lib/cjs/charts/hooks/use-chart-instance.js +115 -122
- package/lib/cjs/charts/hooks/use-chart-instance.js.map +1 -1
- package/lib/cjs/charts/hooks/use-chart-option.js +79 -80
- package/lib/cjs/charts/hooks/use-chart-option.js.map +1 -1
- package/lib/cjs/charts/hooks/use-chart-refs.js +47 -44
- package/lib/cjs/charts/hooks/use-chart-refs.js.map +1 -1
- package/lib/cjs/charts/hooks/use-chart-zoom.js +102 -127
- package/lib/cjs/charts/hooks/use-chart-zoom.js.map +1 -1
- package/lib/cjs/charts/hooks/use-legend-interactions.js +127 -132
- package/lib/cjs/charts/hooks/use-legend-interactions.js.map +1 -1
- package/lib/cjs/charts/hooks/use-legend-series.js +143 -174
- package/lib/cjs/charts/hooks/use-legend-series.js.map +1 -1
- package/lib/cjs/charts/hooks/use-legend-visibility.js +66 -85
- package/lib/cjs/charts/hooks/use-legend-visibility.js.map +1 -1
- package/lib/cjs/charts/index.js +31 -40
- package/lib/cjs/charts/index.js.map +1 -1
- package/lib/cjs/charts/themes/ndl-echarts-theme.js +136 -168
- package/lib/cjs/charts/themes/ndl-echarts-theme.js.map +1 -1
- package/lib/cjs/charts/utils/aria-description.js +150 -214
- package/lib/cjs/charts/utils/aria-description.js.map +1 -1
- package/lib/cjs/charts/utils/build-chart-option.js +166 -174
- package/lib/cjs/charts/utils/build-chart-option.js.map +1 -1
- package/lib/cjs/charts/utils/chart-tooltip-formatter.js +156 -172
- package/lib/cjs/charts/utils/chart-tooltip-formatter.js.map +1 -1
- package/lib/cjs/charts/utils/chart-types.js +25 -20
- package/lib/cjs/charts/utils/chart-types.js.map +1 -1
- package/lib/cjs/charts/utils/defaults.js +69 -67
- package/lib/cjs/charts/utils/defaults.js.map +1 -1
- package/lib/cjs/charts/utils/format-utils.js +55 -66
- package/lib/cjs/charts/utils/format-utils.js.map +1 -1
- package/lib/cjs/charts/utils/legend-layout.js +54 -53
- package/lib/cjs/charts/utils/legend-layout.js.map +1 -1
- package/lib/cjs/charts/utils/legend-utils.js +82 -121
- package/lib/cjs/charts/utils/legend-utils.js.map +1 -1
- package/lib/cjs/charts/utils/scatter-tooltip-points.js +191 -266
- package/lib/cjs/charts/utils/scatter-tooltip-points.js.map +1 -1
- package/lib/cjs/charts/utils/threshold.js +89 -102
- package/lib/cjs/charts/utils/threshold.js.map +1 -1
- package/lib/cjs/charts/utils/user-option-utils.js +419 -347
- package/lib/cjs/charts/utils/user-option-utils.js.map +1 -1
- package/lib/cjs/index.js +31 -35
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/defineProperty.mjs +11 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.mjs +24 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.mjs +12 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutPropertiesLoose.mjs +11 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPrimitive.mjs +13 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPropertyKey.mjs +8 -0
- package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/typeof.mjs +10 -0
- package/lib/esm/charts/Chart.mjs +123 -0
- package/lib/esm/charts/Chart.mjs.map +1 -0
- package/lib/esm/charts/ChartContainer.mjs +71 -0
- package/lib/esm/charts/ChartContainer.mjs.map +1 -0
- package/lib/esm/charts/ChartEmpty.mjs +46 -0
- package/lib/esm/charts/ChartEmpty.mjs.map +1 -0
- package/lib/esm/charts/ChartRender.mjs +113 -0
- package/lib/esm/charts/ChartRender.mjs.map +1 -0
- package/lib/esm/charts/ChartTooltip.mjs +109 -0
- package/lib/esm/charts/ChartTooltip.mjs.map +1 -0
- package/lib/esm/charts/Legend.mjs +82 -0
- package/lib/esm/charts/Legend.mjs.map +1 -0
- package/lib/esm/charts/LegendItem.mjs +82 -0
- package/lib/esm/charts/LegendItem.mjs.map +1 -0
- package/lib/esm/charts/LegendLayout.mjs +337 -0
- package/lib/esm/charts/LegendLayout.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-chart-instance.mjs +119 -0
- package/lib/esm/charts/hooks/use-chart-instance.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-chart-option.mjs +79 -0
- package/lib/esm/charts/hooks/use-chart-option.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-chart-refs.mjs +49 -0
- package/lib/esm/charts/hooks/use-chart-refs.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-chart-zoom.mjs +102 -0
- package/lib/esm/charts/hooks/use-chart-zoom.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-legend-interactions.mjs +138 -0
- package/lib/esm/charts/hooks/use-legend-interactions.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-legend-series.mjs +151 -0
- package/lib/esm/charts/hooks/use-legend-series.mjs.map +1 -0
- package/lib/esm/charts/hooks/use-legend-visibility.mjs +67 -0
- package/lib/esm/charts/hooks/use-legend-visibility.mjs.map +1 -0
- package/lib/esm/charts/index.mjs +27 -0
- package/lib/esm/charts/index.mjs.map +1 -0
- package/lib/esm/charts/themes/ndl-echarts-theme.mjs +139 -0
- package/lib/esm/charts/themes/ndl-echarts-theme.mjs.map +1 -0
- package/lib/esm/charts/utils/aria-description.mjs +162 -0
- package/lib/esm/charts/utils/aria-description.mjs.map +1 -0
- package/lib/esm/charts/utils/build-chart-option.mjs +184 -0
- package/lib/esm/charts/utils/build-chart-option.mjs.map +1 -0
- package/lib/esm/charts/utils/chart-tooltip-formatter.mjs +159 -0
- package/lib/esm/charts/utils/chart-tooltip-formatter.mjs.map +1 -0
- package/lib/esm/charts/utils/chart-types.mjs +24 -0
- package/lib/esm/charts/utils/chart-types.mjs.map +1 -0
- package/lib/esm/charts/utils/defaults.mjs +73 -0
- package/lib/esm/charts/utils/defaults.mjs.map +1 -0
- package/lib/esm/charts/utils/format-utils.mjs +61 -0
- package/lib/esm/charts/utils/format-utils.mjs.map +1 -0
- package/lib/esm/charts/utils/legend-layout.mjs +57 -0
- package/lib/esm/charts/utils/legend-layout.mjs.map +1 -0
- package/lib/esm/charts/utils/legend-utils.mjs +90 -0
- package/lib/esm/charts/utils/legend-utils.mjs.map +1 -0
- package/lib/esm/charts/utils/scatter-tooltip-points.mjs +215 -0
- package/lib/esm/charts/utils/scatter-tooltip-points.mjs.map +1 -0
- package/lib/esm/charts/utils/threshold.mjs +92 -0
- package/lib/esm/charts/utils/threshold.mjs.map +1 -0
- package/lib/esm/charts/utils/user-option-utils.mjs +445 -0
- package/lib/esm/charts/utils/user-option-utils.mjs.map +1 -0
- package/lib/esm/index.mjs +27 -0
- package/lib/esm/index.mjs.map +1 -0
- package/package.json +12 -16
- package/skills/ndl-react-charts/SKILL.md +2 -2
- package/lib/cjs/charts/tests/ChartWrapperWithTooltipFormatter.js +0 -38
- package/lib/cjs/charts/tests/ChartWrapperWithTooltipFormatter.js.map +0 -1
- package/lib/cjs/charts/tests/ChartZoomHarness.js +0 -113
- package/lib/cjs/charts/tests/ChartZoomHarness.js.map +0 -1
- package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js +0 -78
- package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js.map +0 -1
- package/lib/cjs/charts/tests/PieChartWithRerender.js +0 -46
- package/lib/cjs/charts/tests/PieChartWithRerender.js.map +0 -1
- package/lib/cjs/charts/tests/chart-test-utils.js +0 -527
- package/lib/cjs/charts/tests/chart-test-utils.js.map +0 -1
- package/lib/esm/charts/Chart.js +0 -114
- package/lib/esm/charts/Chart.js.map +0 -1
- package/lib/esm/charts/ChartContainer.js +0 -67
- package/lib/esm/charts/ChartContainer.js.map +0 -1
- package/lib/esm/charts/ChartEmpty.js +0 -33
- package/lib/esm/charts/ChartEmpty.js.map +0 -1
- package/lib/esm/charts/ChartRender.js +0 -89
- package/lib/esm/charts/ChartRender.js.map +0 -1
- package/lib/esm/charts/ChartTooltip.js +0 -64
- package/lib/esm/charts/ChartTooltip.js.map +0 -1
- package/lib/esm/charts/Legend.js +0 -71
- package/lib/esm/charts/Legend.js.map +0 -1
- package/lib/esm/charts/LegendItem.js +0 -61
- package/lib/esm/charts/LegendItem.js.map +0 -1
- package/lib/esm/charts/LegendLayout.js +0 -323
- package/lib/esm/charts/LegendLayout.js.map +0 -1
- package/lib/esm/charts/hooks/use-chart-instance.js +0 -128
- package/lib/esm/charts/hooks/use-chart-instance.js.map +0 -1
- package/lib/esm/charts/hooks/use-chart-option.js +0 -82
- package/lib/esm/charts/hooks/use-chart-option.js.map +0 -1
- package/lib/esm/charts/hooks/use-chart-refs.js +0 -48
- package/lib/esm/charts/hooks/use-chart-refs.js.map +0 -1
- package/lib/esm/charts/hooks/use-chart-zoom.js +0 -129
- package/lib/esm/charts/hooks/use-chart-zoom.js.map +0 -1
- package/lib/esm/charts/hooks/use-legend-interactions.js +0 -145
- package/lib/esm/charts/hooks/use-legend-interactions.js.map +0 -1
- package/lib/esm/charts/hooks/use-legend-series.js +0 -184
- package/lib/esm/charts/hooks/use-legend-series.js.map +0 -1
- package/lib/esm/charts/hooks/use-legend-visibility.js +0 -87
- package/lib/esm/charts/hooks/use-legend-visibility.js.map +0 -1
- package/lib/esm/charts/index.js.map +0 -1
- package/lib/esm/charts/tests/ChartWrapperWithTooltipFormatter.js.map +0 -1
- package/lib/esm/charts/tests/ChartZoomHarness.js +0 -109
- package/lib/esm/charts/tests/ChartZoomHarness.js.map +0 -1
- package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js +0 -74
- package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js.map +0 -1
- package/lib/esm/charts/tests/PieChartWithRerender.js +0 -43
- package/lib/esm/charts/tests/PieChartWithRerender.js.map +0 -1
- package/lib/esm/charts/tests/chart-test-utils.js +0 -500
- package/lib/esm/charts/tests/chart-test-utils.js.map +0 -1
- package/lib/esm/charts/themes/ndl-echarts-theme.js +0 -172
- package/lib/esm/charts/themes/ndl-echarts-theme.js.map +0 -1
- package/lib/esm/charts/utils/aria-description.js +0 -228
- package/lib/esm/charts/utils/aria-description.js.map +0 -1
- package/lib/esm/charts/utils/build-chart-option.js +0 -193
- package/lib/esm/charts/utils/build-chart-option.js.map +0 -1
- package/lib/esm/charts/utils/chart-tooltip-formatter.js +0 -177
- package/lib/esm/charts/utils/chart-tooltip-formatter.js.map +0 -1
- package/lib/esm/charts/utils/chart-types.js.map +0 -1
- package/lib/esm/charts/utils/defaults.js +0 -73
- package/lib/esm/charts/utils/defaults.js.map +0 -1
- package/lib/esm/charts/utils/format-utils.js +0 -74
- package/lib/esm/charts/utils/format-utils.js.map +0 -1
- package/lib/esm/charts/utils/legend-layout.js +0 -59
- package/lib/esm/charts/utils/legend-layout.js.map +0 -1
- package/lib/esm/charts/utils/legend-utils.js +0 -131
- package/lib/esm/charts/utils/legend-utils.js.map +0 -1
- package/lib/esm/charts/utils/scatter-tooltip-points.js +0 -291
- package/lib/esm/charts/utils/scatter-tooltip-points.js.map +0 -1
- package/lib/esm/charts/utils/threshold.js +0 -106
- package/lib/esm/charts/utils/threshold.js.map +0 -1
- package/lib/esm/charts/utils/user-option-utils.js +0 -374
- package/lib/esm/charts/utils/user-option-utils.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
|
@@ -1,71 +1,117 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ChartTooltip = exports.ChartTooltipComponent = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
7
|
+
const require_objectWithoutProperties = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.js");
|
|
8
|
+
const require_objectSpread2 = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
let _neo4j_ndl_react = require("@neo4j-ndl/react");
|
|
11
|
+
let classnames = require("classnames");
|
|
12
|
+
classnames = require_runtime.__toESM(classnames);
|
|
13
|
+
// src/charts/ChartTooltip.tsx
|
|
19
14
|
/*!
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "ndl-charts-chart-tooltip-title-line", children: [(0, jsx_runtime_1.jsx)("div", { className: "ndl-charts-chart-tooltip-title-indent-square", style: { backgroundColor: indentSquareColor } }), title] }));
|
|
52
|
-
};
|
|
53
|
-
const ChartTooltipContent = function ChartTooltipContent({ leadingElement, trailingElement, indentSquareColor, notifications, ref, }) {
|
|
54
|
-
const classes = (0, classnames_1.default)(`ndl-charts-chart-tooltip-content`);
|
|
55
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: classes, children: [(0, jsx_runtime_1.jsxs)("div", { className: "ndl-charts-chart-tooltip-content-line", children: [indentSquareColor && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-charts-chart-tooltip-content-indent-square", style: { backgroundColor: indentSquareColor } })), leadingElement && ((0, jsx_runtime_1.jsx)(react_1.Typography, { variant: trailingElement ? 'body-medium' : 'label', className: "ndl-charts-chart-tooltip-content-left-element", children: leadingElement })), trailingElement && ((0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "label", className: "ndl-charts-chart-tooltip-content-trailing-element", children: trailingElement }))] }), notifications &&
|
|
56
|
-
notifications.map((notification) => {
|
|
57
|
-
const { id, notificationType, leadingElement, trailingElement } = notification;
|
|
58
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: `ndl-charts-chart-tooltip-content-notification ndl-notification-${notificationType}`, children: [(0, jsx_runtime_1.jsx)(react_1.StatusIndicator, { variant: notificationType }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-medium", className: "ndl-charts-chart-tooltip-content-notification-left-element", children: leadingElement }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "label", className: "ndl-charts-chart-tooltip-content-notification-trailing-element", children: trailingElement })] }, `notification-${id}`));
|
|
59
|
-
})] }));
|
|
15
|
+
*
|
|
16
|
+
* Copyright (c) "Neo4j"
|
|
17
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
18
|
+
*
|
|
19
|
+
* This file is part of Neo4j.
|
|
20
|
+
*
|
|
21
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
22
|
+
* it under the terms of the GNU General Public License as published by
|
|
23
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
24
|
+
* (at your option) any later version.
|
|
25
|
+
*
|
|
26
|
+
* This program is distributed in the hope that it will be useful,
|
|
27
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
28
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
29
|
+
* GNU General Public License for more details.
|
|
30
|
+
*
|
|
31
|
+
* You should have received a copy of the GNU General Public License
|
|
32
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
33
|
+
*/
|
|
34
|
+
const _excluded = ["ref"];
|
|
35
|
+
const ChartTooltipComponent = function ChartTooltipComponent({ children, isOpen, style, anchorPosition, ref }) {
|
|
36
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react.Popover, {
|
|
37
|
+
isOpen,
|
|
38
|
+
anchorPosition,
|
|
39
|
+
placement: "middle-end-middle-start",
|
|
40
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react.Popover.Content, {
|
|
41
|
+
ref,
|
|
42
|
+
style,
|
|
43
|
+
children
|
|
44
|
+
})
|
|
45
|
+
});
|
|
60
46
|
};
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
47
|
+
const ChartTooltip = Object.assign(ChartTooltipComponent, {
|
|
48
|
+
Content: function ChartTooltipContent({ leadingElement, trailingElement, indentSquareColor, notifications, ref }) {
|
|
49
|
+
const classes = (0, classnames.default)(`ndl-charts-chart-tooltip-content`);
|
|
50
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
51
|
+
ref,
|
|
52
|
+
className: classes,
|
|
53
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
54
|
+
className: "ndl-charts-chart-tooltip-content-line",
|
|
55
|
+
children: [
|
|
56
|
+
indentSquareColor && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
57
|
+
className: "ndl-charts-chart-tooltip-content-indent-square",
|
|
58
|
+
style: { backgroundColor: indentSquareColor }
|
|
59
|
+
}),
|
|
60
|
+
leadingElement && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react.Typography, {
|
|
61
|
+
variant: trailingElement ? "body-medium" : "label",
|
|
62
|
+
className: "ndl-charts-chart-tooltip-content-left-element",
|
|
63
|
+
children: leadingElement
|
|
64
|
+
}),
|
|
65
|
+
trailingElement && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react.Typography, {
|
|
66
|
+
variant: "label",
|
|
67
|
+
className: "ndl-charts-chart-tooltip-content-trailing-element",
|
|
68
|
+
children: trailingElement
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
}), notifications && notifications.map((notification) => {
|
|
72
|
+
const { id, notificationType, leadingElement, trailingElement } = notification;
|
|
73
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
74
|
+
className: `ndl-charts-chart-tooltip-content-notification ndl-notification-${notificationType}`,
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react.StatusIndicator, { variant: notificationType }),
|
|
77
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react.Typography, {
|
|
78
|
+
variant: "body-medium",
|
|
79
|
+
className: "ndl-charts-chart-tooltip-content-notification-left-element",
|
|
80
|
+
children: leadingElement
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react.Typography, {
|
|
83
|
+
variant: "label",
|
|
84
|
+
className: "ndl-charts-chart-tooltip-content-notification-trailing-element",
|
|
85
|
+
children: trailingElement
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
}, `notification-${id}`);
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
Link: function ChartTooltipAction(_ref) {
|
|
93
|
+
let { ref } = _ref, restProps = require_objectWithoutProperties.default(_ref, _excluded);
|
|
94
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react.TextLink, require_objectSpread2.default({ ref }, restProps));
|
|
95
|
+
},
|
|
96
|
+
Title: function ChartTooltipTitle({ children, indentSquareColor, ref }) {
|
|
97
|
+
const classes = (0, classnames.default)(`ndl-charts-chart-tooltip-title`);
|
|
98
|
+
const title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react.Typography, {
|
|
99
|
+
ref,
|
|
100
|
+
variant: "body-small",
|
|
101
|
+
className: classes,
|
|
102
|
+
children
|
|
103
|
+
});
|
|
104
|
+
if (indentSquareColor === void 0) return title;
|
|
105
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
106
|
+
className: "ndl-charts-chart-tooltip-title-line",
|
|
107
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
108
|
+
className: "ndl-charts-chart-tooltip-title-indent-square",
|
|
109
|
+
style: { backgroundColor: indentSquareColor }
|
|
110
|
+
}), title]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
69
113
|
});
|
|
70
114
|
exports.ChartTooltip = ChartTooltip;
|
|
115
|
+
exports.ChartTooltipComponent = ChartTooltipComponent;
|
|
116
|
+
|
|
71
117
|
//# sourceMappingURL=ChartTooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartTooltip.js","
|
|
1
|
+
{"version":3,"file":"ChartTooltip.js","names":["Popover","classNames","Typography","StatusIndicator","TextLink"],"sources":["../../../src/charts/ChartTooltip.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n Popover,\n StatusIndicator,\n TextLink,\n Typography,\n} from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport {\n type ChartTooltipContentProps,\n type ChartTooltipProps,\n} from './utils/chart-types';\n\nexport const ChartTooltipComponent = function ChartTooltipComponent({\n children,\n isOpen,\n style,\n anchorPosition,\n ref,\n}: ChartTooltipProps) {\n return (\n <Popover\n isOpen={isOpen}\n anchorPosition={anchorPosition}\n placement=\"middle-end-middle-start\"\n >\n <Popover.Content ref={ref} style={style}>\n {children}\n </Popover.Content>\n </Popover>\n );\n};\n\ntype ChartTooltipTitleProps = {\n children: React.ReactNode;\n /**\n * Color swatch shown before the title, for tooltips where every row below\n * the title belongs to the same series and the rows carry no swatch.\n */\n indentSquareColor?: string;\n ref?: React.Ref<HTMLSpanElement>;\n};\n\nconst ChartTooltipTitle = function ChartTooltipTitle({\n children,\n indentSquareColor,\n ref,\n}: ChartTooltipTitleProps) {\n const classes = classNames(`ndl-charts-chart-tooltip-title`);\n\n const title = (\n <Typography ref={ref} variant=\"body-small\" className={classes}>\n {children}\n </Typography>\n );\n\n if (indentSquareColor === undefined) {\n return title;\n }\n\n return (\n <div className=\"ndl-charts-chart-tooltip-title-line\">\n <div\n className=\"ndl-charts-chart-tooltip-title-indent-square\"\n style={{ backgroundColor: indentSquareColor }}\n />\n {title}\n </div>\n );\n};\n\nconst ChartTooltipContent = function ChartTooltipContent({\n leadingElement,\n trailingElement,\n indentSquareColor,\n notifications,\n ref,\n}: ChartTooltipContentProps) {\n const classes = classNames(`ndl-charts-chart-tooltip-content`);\n\n return (\n <div ref={ref} className={classes}>\n <div className=\"ndl-charts-chart-tooltip-content-line\">\n {indentSquareColor && (\n <div\n className=\"ndl-charts-chart-tooltip-content-indent-square\"\n style={{ backgroundColor: indentSquareColor }}\n />\n )}\n {leadingElement && (\n <Typography\n variant={trailingElement ? 'body-medium' : 'label'}\n className=\"ndl-charts-chart-tooltip-content-left-element\"\n >\n {leadingElement}\n </Typography>\n )}\n {trailingElement && (\n <Typography\n variant=\"label\"\n className=\"ndl-charts-chart-tooltip-content-trailing-element\"\n >\n {trailingElement}\n </Typography>\n )}\n </div>\n\n {notifications &&\n notifications.map((notification) => {\n const { id, notificationType, leadingElement, trailingElement } =\n notification;\n\n return (\n <div\n key={`notification-${id}`}\n className={`ndl-charts-chart-tooltip-content-notification ndl-notification-${notificationType}`}\n >\n <StatusIndicator variant={notificationType} />\n <Typography\n variant=\"body-medium\"\n className=\"ndl-charts-chart-tooltip-content-notification-left-element\"\n >\n {leadingElement}\n </Typography>\n <Typography\n variant=\"label\"\n className=\"ndl-charts-chart-tooltip-content-notification-trailing-element\"\n >\n {trailingElement}\n </Typography>\n </div>\n );\n })}\n </div>\n );\n};\n\nconst ChartTooltipLink = function ChartTooltipAction({\n ref,\n ...restProps\n}: React.ComponentProps<typeof TextLink>) {\n return <TextLink ref={ref} {...restProps} />;\n};\n\nconst ChartTooltip = Object.assign(ChartTooltipComponent, {\n Content: ChartTooltipContent,\n Link: ChartTooltipLink,\n Title: ChartTooltipTitle,\n});\n\nexport { ChartTooltip };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+JE,MAAA,YAAA,CAAA,KAAA;AA7HF,MAAa,wBAAwB,SAAS,sBAAsB,EAClE,UACA,QACA,OACA,gBACA,OACoB;CACpB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,iBAAAA,SAAD;EACU;EACQ;EAChB,WAAU;EAEV,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACA,iBAAAA,QAAQ,SAAT;GAAsB;GAAY;GAC/B;EACc,CAAA;CACV,CAAA;AAEb;AAiHA,MAAM,eAAe,OAAO,OAAO,uBAAuB;CACxD,SAAS,SA1E0B,oBAAoB,EACvD,gBACA,iBACA,mBACA,eACA,OAC2B;EAC3B,MAAM,WAAA,GAAUC,WAAAA,QAAAA,CAAW,kCAAkC;EAE7D,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAU;GAAK,WAAW;GAA1B,UAAA,CACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACG,qBACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;MACE,WAAU;MACV,OAAO,EAAE,iBAAiB,kBAAkB;KAC7C,CAAA;KAEF,kBACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,YAAD;MACE,SAAS,kBAAkB,gBAAgB;MAC3C,WAAU;MAET,UAAA;KACS,CAAA;KAEb,mBACC,iBAAA,GAAA,kBAAA,IAAA,CAACA,iBAAAA,YAAD;MACE,SAAQ;MACR,WAAU;MAET,UAAA;KACS,CAAA;IAEX;GAEJ,CAAA,GAAA,iBACC,cAAc,KAAK,iBAAiB;IAClC,MAAM,EAAE,IAAI,kBAAkB,gBAAgB,oBAC5C;IAEF,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;KAEE,WAAW,kEAAkE;KAF/E,UAAA;MAIE,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,iBAAD,EAAiB,SAAS,iBAAmB,CAAA;MAC7C,iBAAA,GAAA,kBAAA,IAAA,CAACD,iBAAAA,YAAD;OACE,SAAQ;OACR,WAAU;OAET,UAAA;MACS,CAAA;MACZ,iBAAA,GAAA,kBAAA,IAAA,CAACA,iBAAAA,YAAD;OACE,SAAQ;OACR,WAAU;OAET,UAAA;MACS,CAAA;KACT;IAhBE,GAAA,gBAAgB,IAgBlB;GAET,CAAC,CACA;;CAET;CAWE,MAAM,SAT0B,mBAAmB,MAGX;EAHW,IAAA,EACnD,QAAA,MACG,YAAA,gCAAA,QAAA,MAAA,SAAA;EAEH,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAACE,iBAAAA,UAAAA,sBAAAA,QAAAA,EAAc,IAAA,GAAS,SAAY,CAAA;CAC7C;CAKE,OAAO,SAxG0B,kBAAkB,EACnD,UACA,mBACA,OACyB;EACzB,MAAM,WAAA,GAAUH,WAAAA,QAAAA,CAAW,gCAAgC;EAE3D,MAAM,QACJ,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,YAAD;GAAiB;GAAK,SAAQ;GAAa,WAAW;GACnD;EACS,CAAA;EAGd,IAAI,sBAAsB,KAAA,GACxB,OAAO;EAGT,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IACE,WAAU;IACV,OAAO,EAAE,iBAAiB,kBAAkB;GAC7C,CAAA,GACA,KACE;;CAET;AA+EA,CAAC"}
|
package/lib/cjs/charts/Legend.js
CHANGED
|
@@ -1,75 +1,87 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
exports.Legend = void 0;
|
|
15
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
const require_charts_hooks_use_legend_interactions = require("./hooks/use-legend-interactions.js");
|
|
7
|
+
const require_charts_hooks_use_legend_visibility = require("./hooks/use-legend-visibility.js");
|
|
8
|
+
const require_charts_LegendItem = require("./LegendItem.js");
|
|
9
|
+
const require_charts_LegendLayout = require("./LegendLayout.js");
|
|
10
|
+
const require_objectWithoutProperties = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.js");
|
|
11
|
+
const require_objectSpread2 = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js");
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
|
+
// src/charts/Legend.tsx
|
|
16
14
|
/*!
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
15
|
+
*
|
|
16
|
+
* Copyright (c) "Neo4j"
|
|
17
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
18
|
+
*
|
|
19
|
+
* This file is part of Neo4j.
|
|
20
|
+
*
|
|
21
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
22
|
+
* it under the terms of the GNU General Public License as published by
|
|
23
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
24
|
+
* (at your option) any later version.
|
|
25
|
+
*
|
|
26
|
+
* This program is distributed in the hope that it will be useful,
|
|
27
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
28
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
29
|
+
* GNU General Public License for more details.
|
|
30
|
+
*
|
|
31
|
+
* You should have received a copy of the GNU General Public License
|
|
32
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
33
|
+
*/
|
|
34
|
+
const _excluded = [
|
|
35
|
+
"className",
|
|
36
|
+
"series",
|
|
37
|
+
"isLayoutReady",
|
|
38
|
+
"onLayoutReady",
|
|
39
|
+
"htmlAttributes"
|
|
40
|
+
];
|
|
40
41
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const Legend = (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
42
|
+
* Renders the interactive chart legend and keeps legend state synchronized with
|
|
43
|
+
* ECharts.
|
|
44
|
+
*
|
|
45
|
+
* The component owns the React-side selected-series state, mirrors it into the
|
|
46
|
+
* shared ref consumed when rebuilding chart options, and wires item hover/click
|
|
47
|
+
* interactions back to the ECharts instance.
|
|
48
|
+
*/
|
|
49
|
+
const Legend = (_ref) => {
|
|
50
|
+
let { className, series, isLayoutReady = true, onLayoutReady, htmlAttributes } = _ref, restProps = require_objectWithoutProperties.default(_ref, _excluded);
|
|
51
|
+
const { renderedSelectedSeries } = require_charts_hooks_use_legend_interactions.useLegendSelection({ series });
|
|
52
|
+
const { toggleHighlight } = require_charts_hooks_use_legend_interactions.useLegendHoverHighlight({
|
|
53
|
+
selectedSeries: renderedSelectedSeries,
|
|
54
|
+
series
|
|
55
|
+
});
|
|
56
|
+
const { toggleLegendVisibility } = require_charts_hooks_use_legend_visibility.useLegendVisibility(renderedSelectedSeries);
|
|
57
|
+
const selectedSeriesLength = Object.values(renderedSelectedSeries).filter(Boolean).length;
|
|
58
|
+
const isAllSeriesVisible = selectedSeriesLength === series.length;
|
|
59
|
+
const hasMoreThanOneItem = series.length > 1;
|
|
60
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_charts_LegendLayout.LegendLayout, require_objectSpread2.default(require_objectSpread2.default({
|
|
61
|
+
className,
|
|
62
|
+
isLayoutReady,
|
|
63
|
+
itemCount: series.length,
|
|
64
|
+
onLayoutReady,
|
|
65
|
+
htmlAttributes
|
|
66
|
+
}, restProps), {}, { children: series.map((currentSeries, index) => {
|
|
67
|
+
var _currentSeries$name, _currentSeries$name3, _currentSeries$name4;
|
|
68
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_charts_LegendItem.LegendItem, {
|
|
69
|
+
name: currentSeries.name,
|
|
70
|
+
color: currentSeries.color,
|
|
71
|
+
hasButtons: hasMoreThanOneItem && currentSeries.name !== void 0,
|
|
72
|
+
onLegendItemMouseEnter: () => toggleHighlight(currentSeries, true),
|
|
73
|
+
onLegendItemMouseLeave: () => toggleHighlight(currentSeries, false),
|
|
74
|
+
onLegendItemClick: () => {
|
|
75
|
+
var _currentSeries$name2;
|
|
76
|
+
const isOnlyVisible = renderedSelectedSeries[(_currentSeries$name2 = currentSeries.name) !== null && _currentSeries$name2 !== void 0 ? _currentSeries$name2 : ""] && selectedSeriesLength === 1;
|
|
77
|
+
toggleLegendVisibility(currentSeries.name, isAllSeriesVisible, isOnlyVisible);
|
|
78
|
+
},
|
|
79
|
+
isSelected: !isAllSeriesVisible && renderedSelectedSeries[(_currentSeries$name3 = currentSeries.name) !== null && _currentSeries$name3 !== void 0 ? _currentSeries$name3 : ""],
|
|
80
|
+
isDeselected: currentSeries.name === void 0 ? false : !renderedSelectedSeries[currentSeries.name],
|
|
81
|
+
children: (_currentSeries$name4 = currentSeries.name) !== null && _currentSeries$name4 !== void 0 ? _currentSeries$name4 : `Series ${index}`
|
|
82
|
+
}, (_currentSeries$name = currentSeries.name) !== null && _currentSeries$name !== void 0 ? _currentSeries$name : index);
|
|
83
|
+
}) }));
|
|
73
84
|
};
|
|
74
85
|
exports.Legend = Legend;
|
|
86
|
+
|
|
75
87
|
//# sourceMappingURL=Legend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Legend.js","
|
|
1
|
+
{"version":3,"file":"Legend.js","names":["useLegendSelection","useLegendHoverHighlight","useLegendVisibility","LegendLayout","LegendItem"],"sources":["../../../src/charts/Legend.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport {\n useLegendHoverHighlight,\n useLegendSelection,\n} from './hooks/use-legend-interactions';\nimport { useLegendVisibility } from './hooks/use-legend-visibility';\nimport { LegendItem } from './LegendItem';\nimport { LegendLayout } from './LegendLayout';\nimport { type CommonProps, type LegendProps } from './utils/chart-types';\n\ntype LegendComponentProps = LegendProps & {\n isLayoutReady?: boolean;\n onLayoutReady?: () => void;\n};\n\n/**\n * Renders the interactive chart legend and keeps legend state synchronized with\n * ECharts.\n *\n * The component owns the React-side selected-series state, mirrors it into the\n * shared ref consumed when rebuilding chart options, and wires item hover/click\n * interactions back to the ECharts instance.\n */\nexport const Legend = ({\n className,\n series,\n isLayoutReady = true,\n onLayoutReady,\n htmlAttributes,\n ...restProps\n}: Omit<CommonProps<'div', LegendComponentProps>, 'ref'>) => {\n const { renderedSelectedSeries } = useLegendSelection({\n series,\n });\n\n const { toggleHighlight } = useLegendHoverHighlight({\n selectedSeries: renderedSelectedSeries,\n series,\n });\n\n const { toggleLegendVisibility } = useLegendVisibility(\n renderedSelectedSeries,\n );\n\n const selectedSeriesLength = Object.values(renderedSelectedSeries).filter(\n Boolean,\n ).length;\n const isAllSeriesVisible = selectedSeriesLength === series.length;\n const hasMoreThanOneItem = series.length > 1;\n\n return (\n <LegendLayout\n className={className}\n isLayoutReady={isLayoutReady}\n itemCount={series.length}\n onLayoutReady={onLayoutReady}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {series.map((currentSeries, index) => (\n <LegendItem\n key={currentSeries.name ?? index}\n name={currentSeries.name}\n color={currentSeries.color}\n hasButtons={hasMoreThanOneItem && currentSeries.name !== undefined}\n onLegendItemMouseEnter={() => toggleHighlight(currentSeries, true)}\n onLegendItemMouseLeave={() => toggleHighlight(currentSeries, false)}\n onLegendItemClick={() => {\n const isOnlyVisible =\n renderedSelectedSeries[currentSeries.name ?? ''] &&\n selectedSeriesLength === 1;\n\n toggleLegendVisibility(\n currentSeries.name,\n isAllSeriesVisible,\n isOnlyVisible,\n );\n }}\n isSelected={\n !isAllSeriesVisible &&\n renderedSelectedSeries[currentSeries.name ?? '']\n }\n isDeselected={\n currentSeries.name === undefined\n ? false\n : !renderedSelectedSeries[currentSeries.name]\n }\n >\n {currentSeries.name ?? `Series ${index}`}\n </LegendItem>\n ))}\n </LegendLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CE;CACA;CACA;CACA;CACA;;;;;;;;;;AALF,MAAa,UAAU,SAOsC;CAPtC,IAAA,EACrB,WACA,QACA,gBAAgB,MAChB,eACA,mBAAA,MACG,YAAA,gCAAA,QAAA,MAAA,SAAA;CAEH,MAAM,EAAE,2BAA2BA,6CAAAA,mBAAmB,EACpD,OACF,CAAC;CAED,MAAM,EAAE,oBAAoBC,6CAAAA,wBAAwB;EAClD,gBAAgB;EAChB;CACF,CAAC;CAED,MAAM,EAAE,2BAA2BC,2CAAAA,oBACjC,sBACF;CAEA,MAAM,uBAAuB,OAAO,OAAO,sBAAsB,CAAC,CAAC,OACjE,OACF,CAAC,CAAC;CACF,MAAM,qBAAqB,yBAAyB,OAAO;CAC3D,MAAM,qBAAqB,OAAO,SAAS;CAE3C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,4BAAAA,cAAAA,sBAAAA,QAAAA,sBAAAA,QAAAA;EACY;EACI;EACf,WAAW,OAAO;EACH;EACC;CACZ,GAAA,SAAA,GAAA,CAAA,GAAA,EAAA,UAEH,OAAO,KAAK,eAAe,UAC1B;;EAACC,OAAAA,iBAAAA,GAAAA,kBAAAA,IAAAA,CAAAA,0BAAAA,YAAD;GAEE,MAAM,cAAc;GACpB,OAAO,cAAc;GACrB,YAAY,sBAAsB,cAAc,SAAS,KAAA;GACzD,8BAA8B,gBAAgB,eAAe,IAAI;GACjE,8BAA8B,gBAAgB,eAAe,KAAK;GAClE,yBAAyB;;IACvB,MAAM,gBACJ,wBAAA,uBAAuB,cAAc,UAAA,QAAA,yBAAA,KAAA,IAAA,uBAAQ,OAC7C,yBAAyB;IAE3B,uBACE,cAAc,MACd,oBACA,aACF;GACF;GACA,YACE,CAAC,sBACD,wBAAA,uBAAuB,cAAc,UAAA,QAAA,yBAAA,KAAA,IAAA,uBAAQ;GAE/C,cACE,cAAc,SAAS,KAAA,IACnB,QACA,CAAC,uBAAuB,cAAc;GAG3C,WAAA,uBAAA,cAAc,UAAA,QAAA,yBAAA,KAAA,IAAA,uBAAQ,UAAU;EACvB,IAAA,sBA5BL,cAAc,UAAA,QAAA,wBAAA,KAAA,IAAA,sBAAQ,KA4BjB;CACb,CAAA,EAAA,CACW,CAAA;AAElB"}
|
|
@@ -1,68 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.LegendItem = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
7
|
+
const require_charts_utils_threshold = require("./utils/threshold.js");
|
|
8
|
+
const require_objectWithoutProperties = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.js");
|
|
9
|
+
const require_objectSpread2 = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
let _neo4j_ndl_react = require("@neo4j-ndl/react");
|
|
12
|
+
let classnames = require("classnames");
|
|
13
|
+
classnames = require_runtime.__toESM(classnames);
|
|
14
|
+
let _neo4j_ndl_react_icons = require("@neo4j-ndl/react/icons");
|
|
15
|
+
// src/charts/LegendItem.tsx
|
|
19
16
|
/*!
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
17
|
+
*
|
|
18
|
+
* Copyright (c) "Neo4j"
|
|
19
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
20
|
+
*
|
|
21
|
+
* This file is part of Neo4j.
|
|
22
|
+
*
|
|
23
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
24
|
+
* it under the terms of the GNU General Public License as published by
|
|
25
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
26
|
+
* (at your option) any later version.
|
|
27
|
+
*
|
|
28
|
+
* This program is distributed in the hope that it will be useful,
|
|
29
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
30
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
31
|
+
* GNU General Public License for more details.
|
|
32
|
+
*
|
|
33
|
+
* You should have received a copy of the GNU General Public License
|
|
34
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
35
|
+
*/
|
|
36
|
+
const _excluded = [
|
|
37
|
+
"children",
|
|
38
|
+
"as",
|
|
39
|
+
"className",
|
|
40
|
+
"name",
|
|
41
|
+
"isSelected",
|
|
42
|
+
"isDeselected",
|
|
43
|
+
"onLegendItemClick",
|
|
44
|
+
"color",
|
|
45
|
+
"hasButtons",
|
|
46
|
+
"ref",
|
|
47
|
+
"onLegendItemMouseEnter",
|
|
48
|
+
"onLegendItemMouseLeave"
|
|
49
|
+
];
|
|
43
50
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const LegendItem = (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
* Renders a single legend entry with its series color, selection indicator, and
|
|
52
|
+
* optional button semantics.
|
|
53
|
+
*
|
|
54
|
+
* Threshold-line series are intentionally skipped because they are chart
|
|
55
|
+
* annotations rather than user-toggleable data series.
|
|
56
|
+
*/
|
|
57
|
+
const LegendItem = (_ref) => {
|
|
58
|
+
var _isThresholdLine;
|
|
59
|
+
let { children, as, className, name, isSelected, isDeselected, onLegendItemClick, color, hasButtons = true, ref, onLegendItemMouseEnter, onLegendItemMouseLeave } = _ref, restProps = require_objectWithoutProperties.default(_ref, _excluded);
|
|
60
|
+
const Component = as !== null && as !== void 0 ? as : hasButtons ? "button" : "div";
|
|
61
|
+
const classes = (0, classnames.default)("ndl-chart-legend-item", {
|
|
62
|
+
"ndl-chart-legend-item-deselected": isDeselected,
|
|
63
|
+
"ndl-chart-legend-item-selected": isSelected
|
|
64
|
+
}, className);
|
|
65
|
+
if ((_isThresholdLine = require_charts_utils_threshold.isThresholdLine(name)) !== null && _isThresholdLine !== void 0 ? _isThresholdLine : false) return null;
|
|
66
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Component, require_objectSpread2.default(require_objectSpread2.default({
|
|
67
|
+
className: classes,
|
|
68
|
+
ref,
|
|
69
|
+
"data-labelname": name,
|
|
70
|
+
title: name,
|
|
71
|
+
onClick: hasButtons ? onLegendItemClick : void 0,
|
|
72
|
+
onMouseEnter: onLegendItemMouseEnter,
|
|
73
|
+
onMouseLeave: onLegendItemMouseLeave
|
|
74
|
+
}, restProps), {}, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
75
|
+
className: "ndl-chart-legend-item-square",
|
|
76
|
+
style: {
|
|
77
|
+
"--ndl-chart-legend-item-color": color,
|
|
78
|
+
backgroundColor: isDeselected === true ? "transparent" : color
|
|
79
|
+
},
|
|
80
|
+
children: isSelected === true && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react_icons.CheckIconOutline, { className: "ndl-chart-legend-item-square-checkmark" })
|
|
81
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_neo4j_ndl_react.Typography, {
|
|
82
|
+
variant: "body-medium",
|
|
83
|
+
className: "ndl-chart-legend-item-text",
|
|
84
|
+
children
|
|
85
|
+
})] }));
|
|
66
86
|
};
|
|
67
87
|
exports.LegendItem = LegendItem;
|
|
88
|
+
|
|
68
89
|
//# sourceMappingURL=LegendItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendItem.js","
|
|
1
|
+
{"version":3,"file":"LegendItem.js","names":["classNames","isThresholdLine","CheckIconOutline","Typography"],"sources":["../../../src/charts/LegendItem.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Typography } from '@neo4j-ndl/react';\nimport { CheckIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport { type LegendItemProps } from './utils/chart-types';\nimport { isThresholdLine } from './utils/threshold';\n\n/**\n * Renders a single legend entry with its series color, selection indicator, and\n * optional button semantics.\n *\n * Threshold-line series are intentionally skipped because they are chart\n * annotations rather than user-toggleable data series.\n */\nexport const LegendItem = ({\n children,\n as,\n className,\n name,\n isSelected,\n isDeselected,\n onLegendItemClick,\n color,\n hasButtons = true,\n ref,\n onLegendItemMouseEnter,\n onLegendItemMouseLeave,\n ...restProps\n}: LegendItemProps) => {\n const Component = as ?? (hasButtons ? 'button' : 'div');\n\n const classes = classNames(\n 'ndl-chart-legend-item',\n {\n 'ndl-chart-legend-item-deselected': isDeselected,\n 'ndl-chart-legend-item-selected': isSelected,\n },\n className,\n );\n\n // We don't want to display threshold lines in the legend\n if (isThresholdLine(name) ?? false) {\n return null;\n }\n\n return (\n <Component\n className={classes}\n ref={ref}\n data-labelname={name}\n title={name}\n onClick={hasButtons ? onLegendItemClick : undefined}\n onMouseEnter={onLegendItemMouseEnter}\n onMouseLeave={onLegendItemMouseLeave}\n {...restProps}\n >\n <span\n className=\"ndl-chart-legend-item-square\"\n style={\n {\n '--ndl-chart-legend-item-color': color,\n backgroundColor: isDeselected === true ? 'transparent' : color,\n } as React.CSSProperties\n }\n >\n {isSelected === true && (\n <CheckIconOutline className=\"ndl-chart-legend-item-square-checkmark\" />\n )}\n </span>\n <Typography variant=\"body-medium\" className=\"ndl-chart-legend-item-text\">\n {children}\n </Typography>\n </Component>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;AAZF,MAAa,cAAc,SAcJ;;CAdI,IAAA,EACzB,UACA,IACA,WACA,MACA,YACA,cACA,mBACA,OACA,aAAa,MACb,KACA,wBACA,2BAAA,MACG,YAAA,gCAAA,QAAA,MAAA,SAAA;CAEH,MAAM,YAAY,OAAA,QAAA,OAAA,KAAA,IAAA,KAAO,aAAa,WAAW;CAEjD,MAAM,WAAA,GAAUA,WAAAA,QAAAA,CACd,yBACA;EACE,oCAAoC;EACpC,kCAAkC;CACpC,GACA,SACF;CAGA,KAAA,mBAAIC,+BAAAA,gBAAgB,IAAI,OAAA,QAAA,qBAAA,KAAA,IAAA,mBAAK,OAC3B,OAAO;CAGT,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,WAAA,sBAAA,QAAA,sBAAA,QAAA;EACC,WAAW;EACN;EACL,kBAAgB;EAChB,OAAO;EACP,SAAS,aAAa,oBAAoB,KAAA;EAC1C,cAAc;EACd,cAAc;CACV,GAAA,SAAA,GAAA,CAAA,GAAA,EAAA,UARN,CAUE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EACE,WAAU;EACV,OACE;GACE,iCAAiC;GACjC,iBAAiB,iBAAiB,OAAO,gBAAgB;EAC3D;EAGD,UAAA,eAAe,QACd,iBAAA,GAAA,kBAAA,IAAA,CAACC,uBAAAA,kBAAD,EAAkB,WAAU,yCAA0C,CAAA;CAEpE,CAAA,GACN,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,YAAD;EAAY,SAAQ;EAAc,WAAU;EACzC;CACS,CAAA,CACH,EAAA,CAAA,CAAA;AAEf"}
|