@neo4j-ndl/react-charts 0.0.2

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 (54) hide show
  1. package/LICENSE +674 -0
  2. package/lib/LICENSES.txt +229 -0
  3. package/lib/NOTICE.txt +26 -0
  4. package/lib/cjs/charts/Chart.js +162 -0
  5. package/lib/cjs/charts/Chart.js.map +1 -0
  6. package/lib/cjs/charts/ChartTooltip.js +52 -0
  7. package/lib/cjs/charts/ChartTooltip.js.map +1 -0
  8. package/lib/cjs/charts/Legend.js +238 -0
  9. package/lib/cjs/charts/Legend.js.map +1 -0
  10. package/lib/cjs/charts/index.js +38 -0
  11. package/lib/cjs/charts/index.js.map +1 -0
  12. package/lib/cjs/charts/themes/darkTheme.js +30 -0
  13. package/lib/cjs/charts/themes/darkTheme.js.map +1 -0
  14. package/lib/cjs/charts/themes/defaultTheme.js +57 -0
  15. package/lib/cjs/charts/themes/defaultTheme.js.map +1 -0
  16. package/lib/cjs/charts/themes/lightTheme.js +30 -0
  17. package/lib/cjs/charts/themes/lightTheme.js.map +1 -0
  18. package/lib/cjs/charts/utils.js +40 -0
  19. package/lib/cjs/charts/utils.js.map +1 -0
  20. package/lib/cjs/common/ConditionalWrap.js +30 -0
  21. package/lib/cjs/common/ConditionalWrap.js.map +1 -0
  22. package/lib/cjs/index.js +38 -0
  23. package/lib/cjs/index.js.map +1 -0
  24. package/lib/esm/charts/Chart.js +159 -0
  25. package/lib/esm/charts/Chart.js.map +1 -0
  26. package/lib/esm/charts/ChartTooltip.js +46 -0
  27. package/lib/esm/charts/ChartTooltip.js.map +1 -0
  28. package/lib/esm/charts/Legend.js +232 -0
  29. package/lib/esm/charts/Legend.js.map +1 -0
  30. package/lib/esm/charts/index.js +22 -0
  31. package/lib/esm/charts/index.js.map +1 -0
  32. package/lib/esm/charts/themes/darkTheme.js +27 -0
  33. package/lib/esm/charts/themes/darkTheme.js.map +1 -0
  34. package/lib/esm/charts/themes/defaultTheme.js +54 -0
  35. package/lib/esm/charts/themes/defaultTheme.js.map +1 -0
  36. package/lib/esm/charts/themes/lightTheme.js +27 -0
  37. package/lib/esm/charts/themes/lightTheme.js.map +1 -0
  38. package/lib/esm/charts/utils.js +37 -0
  39. package/lib/esm/charts/utils.js.map +1 -0
  40. package/lib/esm/common/ConditionalWrap.js +26 -0
  41. package/lib/esm/common/ConditionalWrap.js.map +1 -0
  42. package/lib/esm/index.js +22 -0
  43. package/lib/esm/index.js.map +1 -0
  44. package/lib/types/charts/Chart.d.ts +38 -0
  45. package/lib/types/charts/ChartTooltip.d.ts +59 -0
  46. package/lib/types/charts/Legend.d.ts +30 -0
  47. package/lib/types/charts/index.d.ts +21 -0
  48. package/lib/types/charts/themes/darkTheme.d.ts +55 -0
  49. package/lib/types/charts/themes/defaultTheme.d.ts +51 -0
  50. package/lib/types/charts/themes/lightTheme.d.ts +55 -0
  51. package/lib/types/charts/utils.d.ts +23 -0
  52. package/lib/types/common/ConditionalWrap.d.ts +27 -0
  53. package/lib/types/index.d.ts +21 -0
  54. package/package.json +76 -0
@@ -0,0 +1,229 @@
1
+ This file contains the full license text of the included third party
2
+ libraries. For an overview of the licenses see the NOTICE.txt file.
3
+
4
+
5
+ -----
6
+
7
+ Apache License
8
+ Version 2.0, January 2004
9
+ http://www.apache.org/licenses/
10
+
11
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
12
+
13
+ 1. Definitions.
14
+
15
+ "License" shall mean the terms and conditions for use, reproduction,
16
+ and distribution as defined by Sections 1 through 9 of this document.
17
+
18
+ "Licensor" shall mean the copyright owner or entity authorized by
19
+ the copyright owner that is granting the License.
20
+
21
+ "Legal Entity" shall mean the union of the acting entity and all
22
+ other entities that control, are controlled by, or are under common
23
+ control with that entity. For the purposes of this definition,
24
+ "control" means (i) the power, direct or indirect, to cause the
25
+ direction or management of such entity, whether by contract or
26
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
27
+ outstanding shares, or (iii) beneficial ownership of such entity.
28
+
29
+ "You" (or "Your") shall mean an individual or Legal Entity
30
+ exercising permissions granted by this License.
31
+
32
+ "Source" form shall mean the preferred form for making modifications,
33
+ including but not limited to software source code, documentation
34
+ source, and configuration files.
35
+
36
+ "Object" form shall mean any form resulting from mechanical
37
+ transformation or translation of a Source form, including but
38
+ not limited to compiled object code, generated documentation,
39
+ and conversions to other media types.
40
+
41
+ "Work" shall mean the work of authorship, whether in Source or
42
+ Object form, made available under the License, as indicated by a
43
+ copyright notice that is included in or attached to the work
44
+ (an example is provided in the Appendix below).
45
+
46
+ "Derivative Works" shall mean any work, whether in Source or Object
47
+ form, that is based on (or derived from) the Work and for which the
48
+ editorial revisions, annotations, elaborations, or other modifications
49
+ represent, as a whole, an original work of authorship. For the purposes
50
+ of this License, Derivative Works shall not include works that remain
51
+ separable from, or merely link (or bind by name) to the interfaces of,
52
+ the Work and Derivative Works thereof.
53
+
54
+ "Contribution" shall mean any work of authorship, including
55
+ the original version of the Work and any modifications or additions
56
+ to that Work or Derivative Works thereof, that is intentionally
57
+ submitted to Licensor for inclusion in the Work by the copyright owner
58
+ or by an individual or Legal Entity authorized to submit on behalf of
59
+ the copyright owner. For the purposes of this definition, "submitted"
60
+ means any form of electronic, verbal, or written communication sent
61
+ to the Licensor or its representatives, including but not limited to
62
+ communication on electronic mailing lists, source code control systems,
63
+ and issue tracking systems that are managed by, or on behalf of, the
64
+ Licensor for the purpose of discussing and improving the Work, but
65
+ excluding communication that is conspicuously marked or otherwise
66
+ designated in writing by the copyright owner as "Not a Contribution."
67
+
68
+ "Contributor" shall mean Licensor and any individual or Legal Entity
69
+ on behalf of whom a Contribution has been received by Licensor and
70
+ subsequently incorporated within the Work.
71
+
72
+ 2. Grant of Copyright License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ copyright license to reproduce, prepare Derivative Works of,
76
+ publicly display, publicly perform, sublicense, and distribute the
77
+ Work and such Derivative Works in Source or Object form.
78
+
79
+ 3. Grant of Patent License. Subject to the terms and conditions of
80
+ this License, each Contributor hereby grants to You a perpetual,
81
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
82
+ (except as stated in this section) patent license to make, have made,
83
+ use, offer to sell, sell, import, and otherwise transfer the Work,
84
+ where such license applies only to those patent claims licensable
85
+ by such Contributor that are necessarily infringed by their
86
+ Contribution(s) alone or by combination of their Contribution(s)
87
+ with the Work to which such Contribution(s) was submitted. If You
88
+ institute patent litigation against any entity (including a
89
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
90
+ or a Contribution incorporated within the Work constitutes direct
91
+ or contributory patent infringement, then any patent licenses
92
+ granted to You under this License for that Work shall terminate
93
+ as of the date such litigation is filed.
94
+
95
+ 4. Redistribution. You may reproduce and distribute copies of the
96
+ Work or Derivative Works thereof in any medium, with or without
97
+ modifications, and in Source or Object form, provided that You
98
+ meet the following conditions:
99
+
100
+ (a) You must give any other recipients of the Work or
101
+ Derivative Works a copy of this License; and
102
+
103
+ (b) You must cause any modified files to carry prominent notices
104
+ stating that You changed the files; and
105
+
106
+ (c) You must retain, in the Source form of any Derivative Works
107
+ that You distribute, all copyright, patent, trademark, and
108
+ attribution notices from the Source form of the Work,
109
+ excluding those notices that do not pertain to any part of
110
+ the Derivative Works; and
111
+
112
+ (d) If the Work includes a "NOTICE" text file as part of its
113
+ distribution, then any Derivative Works that You distribute must
114
+ include a readable copy of the attribution notices contained
115
+ within such NOTICE file, excluding those notices that do not
116
+ pertain to any part of the Derivative Works, in at least one
117
+ of the following places: within a NOTICE text file distributed
118
+ as part of the Derivative Works; within the Source form or
119
+ documentation, if provided along with the Derivative Works; or,
120
+ within a display generated by the Derivative Works, if and
121
+ wherever such third-party notices normally appear. The contents
122
+ of the NOTICE file are for informational purposes only and
123
+ do not modify the License. You may add Your own attribution
124
+ notices within Derivative Works that You distribute, alongside
125
+ or as an addendum to the NOTICE text from the Work, provided
126
+ that such additional attribution notices cannot be construed
127
+ as modifying the License.
128
+
129
+ You may add Your own copyright statement to Your modifications and
130
+ may provide additional or different license terms and conditions
131
+ for use, reproduction, or distribution of Your modifications, or
132
+ for any such Derivative Works as a whole, provided Your use,
133
+ reproduction, and distribution of the Work otherwise complies with
134
+ the conditions stated in this License.
135
+
136
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
137
+ any Contribution intentionally submitted for inclusion in the Work
138
+ by You to the Licensor shall be under the terms and conditions of
139
+ this License, without any additional terms or conditions.
140
+ Notwithstanding the above, nothing herein shall supersede or modify
141
+ the terms of any separate license agreement you may have executed
142
+ with Licensor regarding such Contributions.
143
+
144
+ 6. Trademarks. This License does not grant permission to use the trade
145
+ names, trademarks, service marks, or product names of the Licensor,
146
+ except as required for reasonable and customary use in describing the
147
+ origin of the Work and reproducing the content of the NOTICE file.
148
+
149
+ 7. Disclaimer of Warranty. Unless required by applicable law or
150
+ agreed to in writing, Licensor provides the Work (and each
151
+ Contributor provides its Contributions) on an "AS IS" BASIS,
152
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
153
+ implied, including, without limitation, any warranties or conditions
154
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
155
+ PARTICULAR PURPOSE. You are solely responsible for determining the
156
+ appropriateness of using or redistributing the Work and assume any
157
+ risks associated with Your exercise of permissions under this License.
158
+
159
+ 8. Limitation of Liability. In no event and under no legal theory,
160
+ whether in tort (including negligence), contract, or otherwise,
161
+ unless required by applicable law (such as deliberate and grossly
162
+ negligent acts) or agreed to in writing, shall any Contributor be
163
+ liable to You for damages, including any direct, indirect, special,
164
+ incidental, or consequential damages of any character arising as a
165
+ result of this License or out of the use or inability to use the
166
+ Work (including but not limited to damages for loss of goodwill,
167
+ work stoppage, computer failure or malfunction, or any and all
168
+ other commercial damages or losses), even if such Contributor
169
+ has been advised of the possibility of such damages.
170
+
171
+ 9. Accepting Warranty or Additional Liability. While redistributing
172
+ the Work or Derivative Works thereof, You may choose to offer,
173
+ and charge a fee for, acceptance of support, warranty, indemnity,
174
+ or other liability obligations and/or rights consistent with this
175
+ License. However, in accepting such obligations, You may act only
176
+ on Your own behalf and on Your sole responsibility, not on behalf
177
+ of any other Contributor, and only if You agree to indemnify,
178
+ defend, and hold each Contributor harmless for any liability
179
+ incurred by, or claims asserted against, such Contributor by reason
180
+ of your accepting any such warranty or additional liability.
181
+
182
+ END OF TERMS AND CONDITIONS
183
+
184
+ APPENDIX: How to apply the Apache License to your work.
185
+
186
+ To apply the Apache License to your work, attach the following
187
+ boilerplate notice, with the fields enclosed by brackets "[]"
188
+ replaced with your own identifying information. (Don't include
189
+ the brackets!) The text should be enclosed in the appropriate
190
+ comment syntax for the file format. We also recommend that a
191
+ file or class name and description of purpose be included on the
192
+ same "printed page" as the copyright notice for easier
193
+ identification within third-party archives.
194
+
195
+ Copyright [yyyy] [name of copyright owner]
196
+
197
+ Licensed under the Apache License, Version 2.0 (the "License");
198
+ you may not use this file except in compliance with the License.
199
+ You may obtain a copy of the License at
200
+
201
+ http://www.apache.org/licenses/LICENSE-2.0
202
+
203
+ Unless required by applicable law or agreed to in writing, software
204
+ distributed under the License is distributed on an "AS IS" BASIS,
205
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
206
+ See the License for the specific language governing permissions and
207
+ limitations under the License.
208
+
209
+
210
+
211
+
212
+
213
+ ========================================================================
214
+ Apache ECharts Subcomponents:
215
+
216
+ The Apache ECharts project contains subcomponents with separate copyright
217
+ notices and license terms. Your use of the source code for these
218
+ subcomponents is also subject to the terms and conditions of the following
219
+ licenses.
220
+
221
+ BSD 3-Clause (d3.js):
222
+ The following files embed [d3.js](https://github.com/d3/d3) BSD 3-Clause:
223
+ `/src/chart/treemap/treemapLayout.ts`,
224
+ `/src/chart/tree/layoutHelper.ts`,
225
+ `/src/chart/graph/forceHelper.ts`,
226
+ `/src/util/number.ts`
227
+ See `/licenses/LICENSE-d3` for details of the license.
228
+ /home/runner/work/needle/needle/packages/react-charts:
229
+  ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with exit code 1: pnpm yarn licenses generate-disclaimer --production
package/lib/NOTICE.txt ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) "Neo4j,"
2
+ Neo4j Sweden AB [http://neo4j.com]
3
+
4
+ This product includes software ("Software") developed by Neo Technology.
5
+
6
+ The copyright in the bundled Neo4j graph database (including the
7
+ Software) is owned by Neo Technology. The Software developed and owned
8
+ by Neo Technology is licensed under the GNU GENERAL PUBLIC LICENSE
9
+ Version 3 (http://www.fsf.org/licensing/licenses/gpl-3.0.html) ("GPL")
10
+ to all third parties and that license, as required by the GPL, is
11
+ included in the LICENSE.txt file.
12
+
13
+ However, if you have executed an End User Software License and Services
14
+ Agreement or an OEM Software License and Support Services Agreement, or
15
+ another commercial license agreement with Neo Technology or one of its
16
+ affiliates (each, a "Commercial Agreement"), the terms of the license in
17
+ such Commercial Agreement will supersede the GPL and you may use the
18
+ software solely pursuant to the terms of the relevant Commercial
19
+ Agreement.
20
+
21
+ Full license texts are found in LICENSES.txt.
22
+
23
+ Third-party licenses
24
+ --------------------
25
+ /home/runner/work/needle/needle/packages/react-charts:
26
+  ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with exit code 1: pnpm yarn licenses list --production
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Chart = Chart;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /**
6
+ *
7
+ * Copyright (c) "Neo4j"
8
+ * Neo4j Sweden AB [http://neo4j.com]
9
+ *
10
+ * This file is part of Neo4j.
11
+ *
12
+ * Neo4j is free software: you can redistribute it and/or modify
13
+ * it under the terms of the GNU General Public License as published by
14
+ * the Free Software Foundation, either version 3 of the License, or
15
+ * (at your option) any later version.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
24
+ */
25
+ const react_1 = require("react");
26
+ const ChartTooltip_1 = require("./ChartTooltip");
27
+ const server_1 = require("react-dom/server");
28
+ const echarts_1 = require("echarts");
29
+ const Legend_1 = require("./Legend");
30
+ const lightTheme_1 = require("./themes/lightTheme");
31
+ const darkTheme_1 = require("./themes/darkTheme");
32
+ function Chart({ dataset, option: userOption, xAxis, yAxis, series, style, settings, loading, legend, }) {
33
+ const chartRef = (0, react_1.useRef)(null);
34
+ const [isWaitingForFirstResize, setIsWaitingForFirstResize] = (0, react_1.useState)(true);
35
+ const option = (0, react_1.useMemo)(() => {
36
+ return Object.assign(Object.assign({ grid: {
37
+ top: '2%',
38
+ right: '5%',
39
+ bottom: '10%',
40
+ }, dataset,
41
+ xAxis,
42
+ yAxis }, userOption), { legend: {
43
+ show: false,
44
+ }, series: Array.isArray(series)
45
+ ? series.map((currentSeries) => (Object.assign(Object.assign({ symbolSize: 9, symbol: 'none', symbolBorderWidth: 3 }, currentSeries), { lineStyle: Object.assign({ width: 3, type: 'solid' }, currentSeries.lineStyle) })))
46
+ : series, tooltip: {
47
+ trigger: 'axis',
48
+ className: 'ndl-charts-chart-tooltip',
49
+ axisPointer: {
50
+ type: 'line',
51
+ },
52
+ formatter: function (params) {
53
+ var _a;
54
+ const paramsArray = Array.isArray(params) ? params : [params];
55
+ const firstParam = paramsArray[0];
56
+ let valueFormatter = (value) => `${value}`;
57
+ if (typeof (userOption === null || userOption === void 0 ? void 0 : userOption.tooltip) === 'object' &&
58
+ userOption.tooltip !== null &&
59
+ 'valueFormatter' in userOption.tooltip) {
60
+ valueFormatter = userOption.tooltip.valueFormatter;
61
+ }
62
+ return `${(0, server_1.renderToString)((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ChartTooltip_1.ChartTooltip.Title, { children: (_a = firstParam === null || firstParam === void 0 ? void 0 : firstParam.axisValueLabel) !== null && _a !== void 0 ? _a : '' }), paramsArray.map((series) => {
63
+ return ((0, jsx_runtime_1.jsx)(ChartTooltip_1.ChartTooltip.Content, { leftElement: series.seriesName, rightElement: valueFormatter(Array.isArray(series.value)
64
+ ? series.value[1]
65
+ : series.value),
66
+ /* @ts-expect-error echarts types are not fully compatible with typescript */
67
+ indentSquareColor: series.color }, series.name));
68
+ })] }))}`;
69
+ },
70
+ } });
71
+ }, [dataset, series, userOption, xAxis, yAxis]);
72
+ (0, react_1.useEffect)(() => {
73
+ // Initialize chart
74
+ let chart;
75
+ if (chartRef.current !== null) {
76
+ (0, echarts_1.registerTheme)('ndl-light', lightTheme_1.lightTheme.theme);
77
+ (0, echarts_1.registerTheme)('ndl-dark', darkTheme_1.darkTheme.theme);
78
+ chart = (0, echarts_1.init)(chartRef.current, 'ndl-light', {
79
+ renderer: 'svg',
80
+ });
81
+ }
82
+ // Add chart resize listener
83
+ // ResizeObserver is leading to a bit janky UX
84
+ function resizeChart() {
85
+ const calculateGridLeft = () => {
86
+ var _a;
87
+ const textElements = (_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('text');
88
+ const filteredTextElements = Array.from(textElements || []).filter((element) => element.getAttribute('text-anchor') === 'end');
89
+ let maxWidth = 0;
90
+ filteredTextElements.forEach((element) => {
91
+ const bbox = element.getBBox();
92
+ maxWidth = Math.max(maxWidth, bbox.width);
93
+ });
94
+ const tickLength = 5;
95
+ const tickPadding = 3;
96
+ return maxWidth + tickLength + tickPadding;
97
+ };
98
+ // Example of dynamically setting the grid's left
99
+ const gridLeft = calculateGridLeft();
100
+ chart === null || chart === void 0 ? void 0 : chart.setOption({
101
+ grid: {
102
+ left: gridLeft,
103
+ },
104
+ });
105
+ chart === null || chart === void 0 ? void 0 : chart.resize();
106
+ }
107
+ window.addEventListener('resize', resizeChart);
108
+ requestAnimationFrame(() => {
109
+ resizeChart();
110
+ setIsWaitingForFirstResize(false);
111
+ });
112
+ // Return cleanup function
113
+ return () => {
114
+ chart === null || chart === void 0 ? void 0 : chart.dispose();
115
+ window.removeEventListener('resize', resizeChart);
116
+ };
117
+ }, []);
118
+ (0, react_1.useEffect)(() => {
119
+ // Update chart
120
+ if (chartRef.current !== null) {
121
+ const chart = (0, echarts_1.getInstanceByDom)(chartRef.current);
122
+ chart === null || chart === void 0 ? void 0 : chart.setOption(option, settings);
123
+ }
124
+ }, [option, settings]);
125
+ (0, react_1.useEffect)(() => {
126
+ if (chartRef.current === null) {
127
+ return;
128
+ }
129
+ const chart = (0, echarts_1.getInstanceByDom)(chartRef.current);
130
+ loading || isWaitingForFirstResize
131
+ ? chart === null || chart === void 0 ? void 0 : chart.showLoading()
132
+ : chart === null || chart === void 0 ? void 0 : chart.hideLoading();
133
+ }, [loading, isWaitingForFirstResize]);
134
+ const legendSeries = (0, react_1.useMemo)(() => {
135
+ var _a;
136
+ if (chartRef.current === null || isWaitingForFirstResize) {
137
+ return;
138
+ }
139
+ const chart = (0, echarts_1.getInstanceByDom)(chartRef.current);
140
+ const options = chart === null || chart === void 0 ? void 0 : chart.getOption();
141
+ const optionsSeries = (_a = options === null || options === void 0 ? void 0 : options.series) !== null && _a !== void 0 ? _a : [];
142
+ const legendSeries = Array.isArray(series)
143
+ ? series.map((s, index) => {
144
+ var _a;
145
+ const name = Array.isArray(optionsSeries)
146
+ ? (_a = optionsSeries[index]) === null || _a === void 0 ? void 0 : _a.name
147
+ : undefined;
148
+ if (name === undefined) {
149
+ return null;
150
+ }
151
+ const color = chart === null || chart === void 0 ? void 0 : chart.getVisual({ seriesIndex: index }, 'color');
152
+ return {
153
+ name: String(name),
154
+ color: typeof color === 'string' ? color : '#000000',
155
+ };
156
+ })
157
+ : [];
158
+ return legendSeries.filter((s) => s !== null);
159
+ }, [series, isWaitingForFirstResize]);
160
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { ref: chartRef, style: Object.assign({ width: '100%', height: '100%' }, style) }), (legend === null || legend === void 0 ? void 0 : legend.show) && chartRef.current !== null && ((0, jsx_runtime_1.jsx)(Legend_1.Legend, { wrappingType: legend.wrappingType, series: legendSeries !== null && legendSeries !== void 0 ? legendSeries : [], chartRef: chartRef }))] }));
161
+ }
162
+ //# sourceMappingURL=Chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../src/charts/Chart.tsx"],"names":[],"mappings":";;AA4DA,sBAyMC;;AArQD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iCAMe;AACf,iDAA8C;AAC9C,6CAAkD;AAClD,qCAOiB;AACjB,qCAA+C;AAC/C,oDAAiD;AACjD,kDAA+C;AAoB/C,SAAgB,KAAK,CAAC,EACpB,OAAO,EACP,MAAM,EAAE,UAAU,EAClB,KAAK,EACL,KAAK,EACL,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,GACK;IACX,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAC9C,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAE7E,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,GAAkB,EAAE;QACzC,qCACE,IAAI,EAAE;gBACJ,GAAG,EAAE,IAAI;gBACT,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,KAAK;aACd,EACD,OAAO;YACP,KAAK;YACL,KAAK,IACF,UAAU,KACb,MAAM,EAAE;gBACN,IAAI,EAAE,KAAK;aACZ,EACD,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAC3B,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,+BAC5B,UAAU,EAAE,CAAC,EACb,MAAM,EAA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,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;gBAChE,OAAO;oBACL,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;oBAClB,KAAK,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;iBACrD,CAAC;YACJ,CAAC,CAAC;YACJ,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAChD,CAAC,EAAE,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC;IACtC,OAAO,CACL,6DACE,gCAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,kBAAI,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAK,KAAK,IAAM,EACzE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,QAAQ,CAAC,OAAO,KAAK,IAAI,IAAI,CAC5C,uBAAC,eAAM,IACL,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,MAAM,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,EAC1B,QAAQ,EAAE,QAAQ,GAClB,CACH,IACA,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ChartTooltip = exports.ChartTooltipComponent = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ /**
9
+ *
10
+ * Copyright (c) "Neo4j"
11
+ * Neo4j Sweden AB [http://neo4j.com]
12
+ *
13
+ * This file is part of Neo4j.
14
+ *
15
+ * Neo4j is free software: you can redistribute it and/or modify
16
+ * it under the terms of the GNU General Public License as published by
17
+ * the Free Software Foundation, either version 3 of the License, or
18
+ * (at your option) any later version.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ * GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
27
+ */
28
+ const classnames_1 = __importDefault(require("classnames"));
29
+ const react_1 = require("react");
30
+ const react_2 = require("@neo4j-ndl/react");
31
+ exports.ChartTooltipComponent = (0, react_1.forwardRef)(function ChartTooltipComponent({ children, className, isOpen, style, anchorPosition }, ref) {
32
+ const classes = (0, classnames_1.default)(`ndl-charts-chart-tooltip`, className);
33
+ return ((0, jsx_runtime_1.jsx)(react_2.Popover, { isOpen: isOpen, anchorPosition: anchorPosition, placement: "middle-end-middle-start", children: (0, jsx_runtime_1.jsx)(react_2.Popover.Content, { className: classes, ref: ref, style: style, children: children }) }));
34
+ });
35
+ const ChartTooltipTitle = (0, react_1.forwardRef)(function ChartTooltipTitle({ children }, ref) {
36
+ const classes = (0, classnames_1.default)(`ndl-charts-chart-tooltip-title`);
37
+ return ((0, jsx_runtime_1.jsx)(react_2.Typography, { ref: ref, variant: "body-small", className: classes, children: children }));
38
+ });
39
+ const ChartTooltipContent = (0, react_1.forwardRef)(function ChartTooltipContent({ leftElement, rightElement, indentSquareColor, notification, }, ref) {
40
+ const classes = (0, classnames_1.default)(`ndl-charts-chart-tooltip-content`);
41
+ 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 } })), leftElement && ((0, jsx_runtime_1.jsx)(react_2.Typography, { variant: rightElement ? 'body-medium' : 'label', className: "ndl-charts-chart-tooltip-content-left-element", children: leftElement })), rightElement && ((0, jsx_runtime_1.jsx)(react_2.Typography, { variant: "label", className: "ndl-charts-chart-tooltip-content-right-element", children: rightElement }))] }), notification && ((0, jsx_runtime_1.jsxs)("div", { className: "ndl-charts-chart-tooltip-content-notification", children: [(0, jsx_runtime_1.jsx)(react_2.StatusIndicator, { type: notification.type }), (0, jsx_runtime_1.jsx)(react_2.Typography, { variant: "body-medium", className: "ndl-charts-chart-tooltip-content-notification-left-element", children: notification.leftElement }), (0, jsx_runtime_1.jsx)(react_2.Typography, { variant: "label", className: "ndl-charts-chart-tooltip-content-notification-right-element", children: notification.rightElement })] }))] }));
42
+ });
43
+ const ChartTooltipLink = (0, react_1.forwardRef)(function ChartTooltipAction(props, ref) {
44
+ return (0, jsx_runtime_1.jsx)(react_2.TextLink, Object.assign({ ref: ref }, props));
45
+ });
46
+ const ChartTooltip = Object.assign(exports.ChartTooltipComponent, {
47
+ Title: ChartTooltipTitle,
48
+ Content: ChartTooltipContent,
49
+ Link: ChartTooltipLink,
50
+ });
51
+ exports.ChartTooltip = ChartTooltip;
52
+ //# sourceMappingURL=ChartTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartTooltip.js","sourceRoot":"","sources":["../../../src/charts/ChartTooltip.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AACpC,iCAA0C;AAC1C,4CAK0B;AAab,QAAA,qBAAqB,GAAG,IAAA,kBAAU,EAAC,SAAS,qBAAqB,CAC5E,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAqB,EACzE,GAAuC;IAEvC,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,0BAA0B,EAAE,SAAS,CAAC,CAAC;IAElE,OAAO,CACL,uBAAC,eAAO,IACN,MAAM,EAAE,MAAM,EACd,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