@neo4j-ndl/react-charts 2.1.22 → 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.
Files changed (209) hide show
  1. package/lib/LICENSES.txt +0 -295
  2. package/lib/NOTICE.txt +1383 -1392
  3. package/lib/{esm/charts/index.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/defineProperty.js} +13 -5
  4. package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js +46 -0
  5. package/lib/{esm/charts/tests/ChartWrapperWithTooltipFormatter.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.js} +12 -13
  6. package/lib/{esm/index.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutPropertiesLoose.js} +13 -2
  7. package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPrimitive.js +35 -0
  8. package/lib/{esm/charts/utils/chart-types.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPropertyKey.js} +10 -2
  9. package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/typeof.js +37 -0
  10. package/lib/cjs/_virtual/_rolldown/runtime.js +44 -0
  11. package/lib/cjs/charts/Chart.js +121 -111
  12. package/lib/cjs/charts/Chart.js.map +1 -1
  13. package/lib/cjs/charts/ChartContainer.js +67 -62
  14. package/lib/cjs/charts/ChartContainer.js.map +1 -1
  15. package/lib/cjs/charts/ChartEmpty.js +45 -30
  16. package/lib/cjs/charts/ChartEmpty.js.map +1 -1
  17. package/lib/cjs/charts/ChartRender.js +112 -87
  18. package/lib/cjs/charts/ChartRender.js.map +1 -1
  19. package/lib/cjs/charts/ChartTooltip.js +111 -65
  20. package/lib/cjs/charts/ChartTooltip.js.map +1 -1
  21. package/lib/cjs/charts/Legend.js +81 -69
  22. package/lib/cjs/charts/Legend.js.map +1 -1
  23. package/lib/cjs/charts/LegendItem.js +83 -62
  24. package/lib/cjs/charts/LegendItem.js.map +1 -1
  25. package/lib/cjs/charts/LegendLayout.js +330 -348
  26. package/lib/cjs/charts/LegendLayout.js.map +1 -1
  27. package/lib/cjs/charts/hooks/use-chart-instance.js +115 -122
  28. package/lib/cjs/charts/hooks/use-chart-instance.js.map +1 -1
  29. package/lib/cjs/charts/hooks/use-chart-option.js +79 -80
  30. package/lib/cjs/charts/hooks/use-chart-option.js.map +1 -1
  31. package/lib/cjs/charts/hooks/use-chart-refs.js +47 -44
  32. package/lib/cjs/charts/hooks/use-chart-refs.js.map +1 -1
  33. package/lib/cjs/charts/hooks/use-chart-zoom.js +102 -127
  34. package/lib/cjs/charts/hooks/use-chart-zoom.js.map +1 -1
  35. package/lib/cjs/charts/hooks/use-legend-interactions.js +127 -132
  36. package/lib/cjs/charts/hooks/use-legend-interactions.js.map +1 -1
  37. package/lib/cjs/charts/hooks/use-legend-series.js +143 -174
  38. package/lib/cjs/charts/hooks/use-legend-series.js.map +1 -1
  39. package/lib/cjs/charts/hooks/use-legend-visibility.js +66 -85
  40. package/lib/cjs/charts/hooks/use-legend-visibility.js.map +1 -1
  41. package/lib/cjs/charts/index.js +31 -40
  42. package/lib/cjs/charts/index.js.map +1 -1
  43. package/lib/cjs/charts/themes/ndl-echarts-theme.js +136 -168
  44. package/lib/cjs/charts/themes/ndl-echarts-theme.js.map +1 -1
  45. package/lib/cjs/charts/utils/aria-description.js +150 -214
  46. package/lib/cjs/charts/utils/aria-description.js.map +1 -1
  47. package/lib/cjs/charts/utils/build-chart-option.js +166 -174
  48. package/lib/cjs/charts/utils/build-chart-option.js.map +1 -1
  49. package/lib/cjs/charts/utils/chart-tooltip-formatter.js +156 -172
  50. package/lib/cjs/charts/utils/chart-tooltip-formatter.js.map +1 -1
  51. package/lib/cjs/charts/utils/chart-types.js +25 -20
  52. package/lib/cjs/charts/utils/chart-types.js.map +1 -1
  53. package/lib/cjs/charts/utils/defaults.js +69 -67
  54. package/lib/cjs/charts/utils/defaults.js.map +1 -1
  55. package/lib/cjs/charts/utils/format-utils.js +55 -66
  56. package/lib/cjs/charts/utils/format-utils.js.map +1 -1
  57. package/lib/cjs/charts/utils/legend-layout.js +54 -53
  58. package/lib/cjs/charts/utils/legend-layout.js.map +1 -1
  59. package/lib/cjs/charts/utils/legend-utils.js +82 -121
  60. package/lib/cjs/charts/utils/legend-utils.js.map +1 -1
  61. package/lib/cjs/charts/utils/scatter-tooltip-points.js +191 -266
  62. package/lib/cjs/charts/utils/scatter-tooltip-points.js.map +1 -1
  63. package/lib/cjs/charts/utils/threshold.js +89 -102
  64. package/lib/cjs/charts/utils/threshold.js.map +1 -1
  65. package/lib/cjs/charts/utils/user-option-utils.js +419 -347
  66. package/lib/cjs/charts/utils/user-option-utils.js.map +1 -1
  67. package/lib/cjs/index.js +31 -35
  68. package/lib/cjs/index.js.map +1 -1
  69. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/defineProperty.mjs +11 -0
  70. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.mjs +24 -0
  71. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.mjs +12 -0
  72. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutPropertiesLoose.mjs +11 -0
  73. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPrimitive.mjs +13 -0
  74. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPropertyKey.mjs +8 -0
  75. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/typeof.mjs +10 -0
  76. package/lib/esm/charts/Chart.mjs +123 -0
  77. package/lib/esm/charts/Chart.mjs.map +1 -0
  78. package/lib/esm/charts/ChartContainer.mjs +71 -0
  79. package/lib/esm/charts/ChartContainer.mjs.map +1 -0
  80. package/lib/esm/charts/ChartEmpty.mjs +46 -0
  81. package/lib/esm/charts/ChartEmpty.mjs.map +1 -0
  82. package/lib/esm/charts/ChartRender.mjs +113 -0
  83. package/lib/esm/charts/ChartRender.mjs.map +1 -0
  84. package/lib/esm/charts/ChartTooltip.mjs +109 -0
  85. package/lib/esm/charts/ChartTooltip.mjs.map +1 -0
  86. package/lib/esm/charts/Legend.mjs +82 -0
  87. package/lib/esm/charts/Legend.mjs.map +1 -0
  88. package/lib/esm/charts/LegendItem.mjs +82 -0
  89. package/lib/esm/charts/LegendItem.mjs.map +1 -0
  90. package/lib/esm/charts/LegendLayout.mjs +337 -0
  91. package/lib/esm/charts/LegendLayout.mjs.map +1 -0
  92. package/lib/esm/charts/hooks/use-chart-instance.mjs +119 -0
  93. package/lib/esm/charts/hooks/use-chart-instance.mjs.map +1 -0
  94. package/lib/esm/charts/hooks/use-chart-option.mjs +79 -0
  95. package/lib/esm/charts/hooks/use-chart-option.mjs.map +1 -0
  96. package/lib/esm/charts/hooks/use-chart-refs.mjs +49 -0
  97. package/lib/esm/charts/hooks/use-chart-refs.mjs.map +1 -0
  98. package/lib/esm/charts/hooks/use-chart-zoom.mjs +102 -0
  99. package/lib/esm/charts/hooks/use-chart-zoom.mjs.map +1 -0
  100. package/lib/esm/charts/hooks/use-legend-interactions.mjs +138 -0
  101. package/lib/esm/charts/hooks/use-legend-interactions.mjs.map +1 -0
  102. package/lib/esm/charts/hooks/use-legend-series.mjs +151 -0
  103. package/lib/esm/charts/hooks/use-legend-series.mjs.map +1 -0
  104. package/lib/esm/charts/hooks/use-legend-visibility.mjs +67 -0
  105. package/lib/esm/charts/hooks/use-legend-visibility.mjs.map +1 -0
  106. package/lib/esm/charts/index.mjs +27 -0
  107. package/lib/esm/charts/index.mjs.map +1 -0
  108. package/lib/esm/charts/themes/ndl-echarts-theme.mjs +139 -0
  109. package/lib/esm/charts/themes/ndl-echarts-theme.mjs.map +1 -0
  110. package/lib/esm/charts/utils/aria-description.mjs +162 -0
  111. package/lib/esm/charts/utils/aria-description.mjs.map +1 -0
  112. package/lib/esm/charts/utils/build-chart-option.mjs +184 -0
  113. package/lib/esm/charts/utils/build-chart-option.mjs.map +1 -0
  114. package/lib/esm/charts/utils/chart-tooltip-formatter.mjs +159 -0
  115. package/lib/esm/charts/utils/chart-tooltip-formatter.mjs.map +1 -0
  116. package/lib/esm/charts/utils/chart-types.mjs +24 -0
  117. package/lib/esm/charts/utils/chart-types.mjs.map +1 -0
  118. package/lib/esm/charts/utils/defaults.mjs +73 -0
  119. package/lib/esm/charts/utils/defaults.mjs.map +1 -0
  120. package/lib/esm/charts/utils/format-utils.mjs +61 -0
  121. package/lib/esm/charts/utils/format-utils.mjs.map +1 -0
  122. package/lib/esm/charts/utils/legend-layout.mjs +57 -0
  123. package/lib/esm/charts/utils/legend-layout.mjs.map +1 -0
  124. package/lib/esm/charts/utils/legend-utils.mjs +90 -0
  125. package/lib/esm/charts/utils/legend-utils.mjs.map +1 -0
  126. package/lib/esm/charts/utils/scatter-tooltip-points.mjs +215 -0
  127. package/lib/esm/charts/utils/scatter-tooltip-points.mjs.map +1 -0
  128. package/lib/esm/charts/utils/threshold.mjs +92 -0
  129. package/lib/esm/charts/utils/threshold.mjs.map +1 -0
  130. package/lib/esm/charts/utils/user-option-utils.mjs +445 -0
  131. package/lib/esm/charts/utils/user-option-utils.mjs.map +1 -0
  132. package/lib/esm/index.mjs +27 -0
  133. package/lib/esm/index.mjs.map +1 -0
  134. package/package.json +12 -16
  135. package/skills/ndl-react-charts/SKILL.md +2 -2
  136. package/lib/cjs/charts/tests/ChartWrapperWithTooltipFormatter.js +0 -38
  137. package/lib/cjs/charts/tests/ChartWrapperWithTooltipFormatter.js.map +0 -1
  138. package/lib/cjs/charts/tests/ChartZoomHarness.js +0 -113
  139. package/lib/cjs/charts/tests/ChartZoomHarness.js.map +0 -1
  140. package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js +0 -78
  141. package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js.map +0 -1
  142. package/lib/cjs/charts/tests/PieChartWithRerender.js +0 -46
  143. package/lib/cjs/charts/tests/PieChartWithRerender.js.map +0 -1
  144. package/lib/cjs/charts/tests/chart-test-utils.js +0 -527
  145. package/lib/cjs/charts/tests/chart-test-utils.js.map +0 -1
  146. package/lib/esm/charts/Chart.js +0 -114
  147. package/lib/esm/charts/Chart.js.map +0 -1
  148. package/lib/esm/charts/ChartContainer.js +0 -67
  149. package/lib/esm/charts/ChartContainer.js.map +0 -1
  150. package/lib/esm/charts/ChartEmpty.js +0 -33
  151. package/lib/esm/charts/ChartEmpty.js.map +0 -1
  152. package/lib/esm/charts/ChartRender.js +0 -89
  153. package/lib/esm/charts/ChartRender.js.map +0 -1
  154. package/lib/esm/charts/ChartTooltip.js +0 -64
  155. package/lib/esm/charts/ChartTooltip.js.map +0 -1
  156. package/lib/esm/charts/Legend.js +0 -71
  157. package/lib/esm/charts/Legend.js.map +0 -1
  158. package/lib/esm/charts/LegendItem.js +0 -61
  159. package/lib/esm/charts/LegendItem.js.map +0 -1
  160. package/lib/esm/charts/LegendLayout.js +0 -323
  161. package/lib/esm/charts/LegendLayout.js.map +0 -1
  162. package/lib/esm/charts/hooks/use-chart-instance.js +0 -128
  163. package/lib/esm/charts/hooks/use-chart-instance.js.map +0 -1
  164. package/lib/esm/charts/hooks/use-chart-option.js +0 -82
  165. package/lib/esm/charts/hooks/use-chart-option.js.map +0 -1
  166. package/lib/esm/charts/hooks/use-chart-refs.js +0 -48
  167. package/lib/esm/charts/hooks/use-chart-refs.js.map +0 -1
  168. package/lib/esm/charts/hooks/use-chart-zoom.js +0 -129
  169. package/lib/esm/charts/hooks/use-chart-zoom.js.map +0 -1
  170. package/lib/esm/charts/hooks/use-legend-interactions.js +0 -145
  171. package/lib/esm/charts/hooks/use-legend-interactions.js.map +0 -1
  172. package/lib/esm/charts/hooks/use-legend-series.js +0 -184
  173. package/lib/esm/charts/hooks/use-legend-series.js.map +0 -1
  174. package/lib/esm/charts/hooks/use-legend-visibility.js +0 -87
  175. package/lib/esm/charts/hooks/use-legend-visibility.js.map +0 -1
  176. package/lib/esm/charts/index.js.map +0 -1
  177. package/lib/esm/charts/tests/ChartWrapperWithTooltipFormatter.js.map +0 -1
  178. package/lib/esm/charts/tests/ChartZoomHarness.js +0 -109
  179. package/lib/esm/charts/tests/ChartZoomHarness.js.map +0 -1
  180. package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js +0 -74
  181. package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js.map +0 -1
  182. package/lib/esm/charts/tests/PieChartWithRerender.js +0 -43
  183. package/lib/esm/charts/tests/PieChartWithRerender.js.map +0 -1
  184. package/lib/esm/charts/tests/chart-test-utils.js +0 -500
  185. package/lib/esm/charts/tests/chart-test-utils.js.map +0 -1
  186. package/lib/esm/charts/themes/ndl-echarts-theme.js +0 -172
  187. package/lib/esm/charts/themes/ndl-echarts-theme.js.map +0 -1
  188. package/lib/esm/charts/utils/aria-description.js +0 -228
  189. package/lib/esm/charts/utils/aria-description.js.map +0 -1
  190. package/lib/esm/charts/utils/build-chart-option.js +0 -193
  191. package/lib/esm/charts/utils/build-chart-option.js.map +0 -1
  192. package/lib/esm/charts/utils/chart-tooltip-formatter.js +0 -177
  193. package/lib/esm/charts/utils/chart-tooltip-formatter.js.map +0 -1
  194. package/lib/esm/charts/utils/chart-types.js.map +0 -1
  195. package/lib/esm/charts/utils/defaults.js +0 -73
  196. package/lib/esm/charts/utils/defaults.js.map +0 -1
  197. package/lib/esm/charts/utils/format-utils.js +0 -74
  198. package/lib/esm/charts/utils/format-utils.js.map +0 -1
  199. package/lib/esm/charts/utils/legend-layout.js +0 -59
  200. package/lib/esm/charts/utils/legend-layout.js.map +0 -1
  201. package/lib/esm/charts/utils/legend-utils.js +0 -131
  202. package/lib/esm/charts/utils/legend-utils.js.map +0 -1
  203. package/lib/esm/charts/utils/scatter-tooltip-points.js +0 -291
  204. package/lib/esm/charts/utils/scatter-tooltip-points.js.map +0 -1
  205. package/lib/esm/charts/utils/threshold.js +0 -106
  206. package/lib/esm/charts/utils/threshold.js.map +0 -1
  207. package/lib/esm/charts/utils/user-option-utils.js +0 -374
  208. package/lib/esm/charts/utils/user-option-utils.js.map +0 -1
  209. package/lib/esm/index.js.map +0 -1
@@ -1,71 +1,117 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
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
- * Copyright (c) "Neo4j"
22
- * Neo4j Sweden AB [http://neo4j.com]
23
- *
24
- * This file is part of Neo4j.
25
- *
26
- * Neo4j is free software: you can redistribute it and/or modify
27
- * it under the terms of the GNU General Public License as published by
28
- * the Free Software Foundation, either version 3 of the License, or
29
- * (at your option) any later version.
30
- *
31
- * This program is distributed in the hope that it will be useful,
32
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
33
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34
- * GNU General Public License for more details.
35
- *
36
- * You should have received a copy of the GNU General Public License
37
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
38
- */
39
- const react_1 = require("@neo4j-ndl/react");
40
- const classnames_1 = __importDefault(require("classnames"));
41
- const ChartTooltipComponent = function ChartTooltipComponent({ children, isOpen, style, anchorPosition, ref, }) {
42
- return ((0, jsx_runtime_1.jsx)(react_1.Popover, { isOpen: isOpen, anchorPosition: anchorPosition, placement: "middle-end-middle-start", children: (0, jsx_runtime_1.jsx)(react_1.Popover.Content, { ref: ref, style: style, children: children }) }));
43
- };
44
- exports.ChartTooltipComponent = ChartTooltipComponent;
45
- const ChartTooltipTitle = function ChartTooltipTitle({ children, indentSquareColor, ref, }) {
46
- const classes = (0, classnames_1.default)(`ndl-charts-chart-tooltip-title`);
47
- const title = ((0, jsx_runtime_1.jsx)(react_1.Typography, { ref: ref, variant: "body-small", className: classes, children: children }));
48
- if (indentSquareColor === undefined) {
49
- return title;
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 ChartTooltipLink = function ChartTooltipAction(_a) {
62
- var { ref } = _a, restProps = __rest(_a, ["ref"]);
63
- return (0, jsx_runtime_1.jsx)(react_1.TextLink, Object.assign({ ref: ref }, restProps));
64
- };
65
- const ChartTooltip = Object.assign(exports.ChartTooltipComponent, {
66
- Content: ChartTooltipContent,
67
- Link: ChartTooltipLink,
68
- Title: ChartTooltipTitle,
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","sourceRoot":"","sources":["../../../src/charts/Ch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;AAEF,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,6BAAqB,EAAE;IACxD,OAAO,EAAE,mBAAmB;IAC5B,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,iBAAiB;CACzB,CAAC,CAAC;AAEM,oCAAY","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"]}
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;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AAA,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"}
@@ -1,75 +1,87 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
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
- * 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 use_legend_interactions_1 = require("./hooks/use-legend-interactions");
37
- const use_legend_visibility_1 = require("./hooks/use-legend-visibility");
38
- const LegendItem_1 = require("./LegendItem");
39
- const LegendLayout_1 = require("./LegendLayout");
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
- * Renders the interactive chart legend and keeps legend state synchronized with
42
- * ECharts.
43
- *
44
- * The component owns the React-side selected-series state, mirrors it into the
45
- * shared ref consumed when rebuilding chart options, and wires item hover/click
46
- * interactions back to the ECharts instance.
47
- */
48
- const Legend = (_a) => {
49
- var { className, series, isLayoutReady = true, onLayoutReady, htmlAttributes } = _a, restProps = __rest(_a, ["className", "series", "isLayoutReady", "onLayoutReady", "htmlAttributes"]);
50
- const { renderedSelectedSeries } = (0, use_legend_interactions_1.useLegendSelection)({
51
- series,
52
- });
53
- const { toggleHighlight } = (0, use_legend_interactions_1.useLegendHoverHighlight)({
54
- selectedSeries: renderedSelectedSeries,
55
- series,
56
- });
57
- const { toggleLegendVisibility } = (0, use_legend_visibility_1.useLegendVisibility)(renderedSelectedSeries);
58
- const selectedSeriesLength = Object.values(renderedSelectedSeries).filter(Boolean).length;
59
- const isAllSeriesVisible = selectedSeriesLength === series.length;
60
- const hasMoreThanOneItem = series.length > 1;
61
- return ((0, jsx_runtime_1.jsx)(LegendLayout_1.LegendLayout, Object.assign({ className: className, isLayoutReady: isLayoutReady, itemCount: series.length, onLayoutReady: onLayoutReady, htmlAttributes: htmlAttributes }, restProps, { children: series.map((currentSeries, index) => {
62
- var _a, _b, _c;
63
- return ((0, jsx_runtime_1.jsx)(LegendItem_1.LegendItem, { name: currentSeries.name, color: currentSeries.color, hasButtons: hasMoreThanOneItem && currentSeries.name !== undefined, onLegendItemMouseEnter: () => toggleHighlight(currentSeries, true), onLegendItemMouseLeave: () => toggleHighlight(currentSeries, false), onLegendItemClick: () => {
64
- var _a;
65
- const isOnlyVisible = renderedSelectedSeries[(_a = currentSeries.name) !== null && _a !== void 0 ? _a : ''] &&
66
- selectedSeriesLength === 1;
67
- toggleLegendVisibility(currentSeries.name, isAllSeriesVisible, isOnlyVisible);
68
- }, isSelected: !isAllSeriesVisible &&
69
- renderedSelectedSeries[(_a = currentSeries.name) !== null && _a !== void 0 ? _a : ''], isDeselected: currentSeries.name === undefined
70
- ? false
71
- : !renderedSelectedSeries[currentSeries.name], children: (_b = currentSeries.name) !== null && _b !== void 0 ? _b : `Series ${index}` }, (_c = currentSeries.name) !== null && _c !== void 0 ? _c : index));
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","sourceRoot":"","sources":["../../../src/charts/Legend.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6EAGyC;AACzC,yEAAoE;AACpE,6CAA0C;AAC1C,iDAA8C;AAQ9C;;;;;;;GAOG;AACI,MAAM,MAAM,GAAG,CAAC,EAOiC,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AG,EAAE;;oBACtB,MAAM,aAAa,GACjB,sBAAsB,CAAC,MAAA,aAAa,CAAC,IAAI,mCAAI,EAAE,CAAC;wBAChD,oBAAoB,KAAK,CAAC,CAAC;oBAE7B,sBAAsB,CACpB,aAAa,CAAC,IAAI,EAClB,kBAAkB,EAClB,aAAa,CACd,CAAC;gBACJ,CAAC,EACD,UAAU,EACR,CAAC,kBAAkB;oBACnB,sBAAsB,CAAC,MAAA,aAAa,CAAC,IAAI,mCAAI,EAAE,CAAC,EAElD,YAAY,EACV,aAAa,CAAC,IAAI,KAAK,SAAS;oBAC9B,CAAC,CAAC,KAAK;oBACP,CAAC,CAAC,CAAC,sBAAsB,CAAC,aAAa,CAAC,IAAI,CAAC,YAGhD,MAAA,aAAa,CAAC,IAAI,mCAAI,UAAU,KAAK,EAAE,IA3BnC,MAAA,aAAa,CAAC,IAAI,mCAAI,KAAK,CA4BrB,CACd,CAAA;SAAA,CAAC,IACW,CAChB,CAAC;AACJ,CAAC,CAAC;AAtEW,QAAA,MAAM,UAsEjB","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"]}
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
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
- * Copyright (c) "Neo4j"
22
- * Neo4j Sweden AB [http://neo4j.com]
23
- *
24
- * This file is part of Neo4j.
25
- *
26
- * Neo4j is free software: you can redistribute it and/or modify
27
- * it under the terms of the GNU General Public License as published by
28
- * the Free Software Foundation, either version 3 of the License, or
29
- * (at your option) any later version.
30
- *
31
- * This program is distributed in the hope that it will be useful,
32
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
33
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34
- * GNU General Public License for more details.
35
- *
36
- * You should have received a copy of the GNU General Public License
37
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
38
- */
39
- const react_1 = require("@neo4j-ndl/react");
40
- const icons_1 = require("@neo4j-ndl/react/icons");
41
- const classnames_1 = __importDefault(require("classnames"));
42
- const threshold_1 = require("./utils/threshold");
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
- * Renders a single legend entry with its series color, selection indicator, and
45
- * optional button semantics.
46
- *
47
- * Threshold-line series are intentionally skipped because they are chart
48
- * annotations rather than user-toggleable data series.
49
- */
50
- const LegendItem = (_a) => {
51
- var _b;
52
- var { children, as, className, name, isSelected, isDeselected, onLegendItemClick, color, hasButtons = true, ref, onLegendItemMouseEnter, onLegendItemMouseLeave } = _a, restProps = __rest(_a, ["children", "as", "className", "name", "isSelected", "isDeselected", "onLegendItemClick", "color", "hasButtons", "ref", "onLegendItemMouseEnter", "onLegendItemMouseLeave"]);
53
- const Component = as !== null && as !== void 0 ? as : (hasButtons ? 'button' : 'div');
54
- const classes = (0, classnames_1.default)('ndl-chart-legend-item', {
55
- 'ndl-chart-legend-item-deselected': isDeselected,
56
- 'ndl-chart-legend-item-selected': isSelected,
57
- }, className);
58
- // We don't want to display threshold lines in the legend
59
- if ((_b = (0, threshold_1.isThresholdLine)(name)) !== null && _b !== void 0 ? _b : false) {
60
- return null;
61
- }
62
- return ((0, jsx_runtime_1.jsxs)(Component, Object.assign({ className: classes, ref: ref, "data-labelname": name, title: name, onClick: hasButtons ? onLegendItemClick : undefined, onMouseEnter: onLegendItemMouseEnter, onMouseLeave: onLegendItemMouseLeave }, restProps, { children: [(0, jsx_runtime_1.jsx)("span", { className: "ndl-chart-legend-item-square", style: {
63
- '--ndl-chart-legend-item-color': color,
64
- backgroundColor: isDeselected === true ? 'transparent' : color,
65
- }, children: isSelected === true && ((0, jsx_runtime_1.jsx)(icons_1.CheckIconOutline, { className: "ndl-chart-legend-item-square-checkmark" })) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-medium", className: "ndl-chart-legend-item-text", children: children })] })));
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","sourceRoot":"","sources":["../../../src/charts/LegendItem.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAA8C;AAC9C,kDAA0D;AAC1D,4DAAoC;AAIpC,iDAAoD;AAEpD;;;;;;GAMG;AACI,MAAM,UAAU,GAAG,CAAC,EAcT,EAAE,EAAE;;QAdK,EACzB,QAAQ,EACR,EAAE,EACF,SAAS,EACT,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,KAAK,EACL,UAAU,GAAG,IAAI,EACjB,GAAG,EACH,sBAAsB,EACtB,sBAAsB,OAEN,EADb,SAAS,cAba,4KAc1B,CADa;IAEZ,MAAM,SAAS,GAAG,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAExD,MAAM,OAAO,GAAG,IAAA,oBAAU,EACxB,uBAAuB,EACvB;QACE,kCAAkC,EAAE,YAAY;QAChD,gCAAgC,EAAE,UAAU;KAC7C,EACD,SAAS,CACV,CAAC;IAEF,yDAAyD;IACzD,IAAI,MAAA,IAAA,2BAAe,EAAC,IAAI,CAAC,mCAAI,KAAK,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,wBAAC,SAAS,kBACR,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE,GAAG,oBACQ,IAAI,EACpB,KAAK,EAAE,IAAI,EACX,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,EACnD,YAAY,EAAE,sBAAsB,EACpC,YAAY,EAAE,sBAAsB,IAChC,SAAS,eAEb,iCACE,SAAS,EAAC,8BAA8B,EACxC,KAAK,EACH;oBACE,+BAA+B,EAAE,KAAK;oBACtC,eAAe,EAAE,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK;iBACxC,YAGzB,UAAU,KAAK,IAAI,IAAI,CACtB,uBAAC,wBAAgB,IAAC,SAAS,EAAC,wCAAwC,GAAG,CACxE,GACI,EACP,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,EAAC,SAAS,EAAC,4BAA4B,YACrE,QAAQ,GACE,KACH,CACb,CAAC;AACJ,CAAC,CAAC;AA5DW,QAAA,UAAU,cA4DrB","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"]}
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"}