@gravity-ui/charts 1.51.7 → 1.52.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 (199) hide show
  1. package/dist/cjs/components/ChartInner/useChartInnerHandlers.d.ts +3 -2
  2. package/dist/cjs/components/ChartInner/useChartInnerHandlers.js +1 -3
  3. package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +3 -2
  4. package/dist/cjs/components/ChartInner/useDefaultState.d.ts +3 -2
  5. package/dist/cjs/components/index.d.ts +1 -0
  6. package/dist/cjs/components/index.js +1 -0
  7. package/dist/cjs/core/series/plugin.d.ts +47 -2
  8. package/dist/cjs/core/series/types.d.ts +4 -0
  9. package/dist/cjs/core/shapes/area/prepare-data.js +29 -19
  10. package/dist/cjs/core/shapes/area/renderer.d.ts +0 -5
  11. package/dist/cjs/core/shapes/area/renderer.js +0 -75
  12. package/dist/cjs/core/shapes/area/types.d.ts +2 -8
  13. package/dist/cjs/core/shapes/bar-x/prepare-data.js +18 -7
  14. package/dist/cjs/core/shapes/bar-x/renderer.d.ts +0 -1
  15. package/dist/cjs/core/shapes/bar-x/renderer.js +0 -18
  16. package/dist/cjs/core/shapes/bar-x/types.d.ts +2 -1
  17. package/dist/cjs/core/shapes/bar-y/get-tooltip-data.js +4 -2
  18. package/dist/cjs/core/shapes/bar-y/prepare-data.js +8 -2
  19. package/dist/cjs/core/shapes/funnel/prepare-data.js +121 -68
  20. package/dist/cjs/core/shapes/heatmap/prepare-data.js +11 -2
  21. package/dist/cjs/core/shapes/line/prepare-data.js +27 -17
  22. package/dist/cjs/core/shapes/line/renderer.d.ts +0 -5
  23. package/dist/cjs/core/shapes/line/renderer.js +0 -75
  24. package/dist/cjs/core/shapes/line/types.d.ts +2 -8
  25. package/dist/cjs/core/shapes/marker.d.ts +30 -0
  26. package/dist/cjs/core/shapes/marker.js +68 -0
  27. package/dist/cjs/core/shapes/pie/prepare-data.js +24 -9
  28. package/dist/cjs/core/shapes/radar/prepare-data.js +3 -0
  29. package/dist/cjs/core/shapes/sankey/prepare-data.js +10 -1
  30. package/dist/cjs/core/shapes/scatter/prepare-data.js +8 -1
  31. package/dist/cjs/core/shapes/scatter/renderer.js +3 -2
  32. package/dist/cjs/core/shapes/scatter/types.d.ts +1 -1
  33. package/dist/cjs/core/shapes/treemap/prepare-data.js +9 -1
  34. package/dist/cjs/core/shapes/types.d.ts +35 -0
  35. package/dist/cjs/core/shapes/waterfall/prepare-data.js +5 -2
  36. package/dist/cjs/core/shapes/x-range/prepare-data.js +7 -2
  37. package/dist/cjs/core/types/chart/base.d.ts +22 -2
  38. package/dist/cjs/core/types/chart/funnel.d.ts +25 -1
  39. package/dist/cjs/core/types/chart/tooltip.d.ts +6 -1
  40. package/dist/cjs/core/utils/data-labels.d.ts +34 -0
  41. package/dist/cjs/core/utils/data-labels.js +26 -0
  42. package/dist/cjs/core/utils/get-closest-data.d.ts +2 -2
  43. package/dist/cjs/core/utils/get-closest-data.js +14 -34
  44. package/dist/cjs/core/utils/tooltip-helpers.d.ts +16 -0
  45. package/dist/cjs/core/utils/tooltip-helpers.js +12 -0
  46. package/dist/cjs/hooks/useShapes/AnnotationLayer.d.ts +9 -0
  47. package/dist/cjs/hooks/useShapes/AnnotationLayer.js +17 -0
  48. package/dist/cjs/hooks/useShapes/HoverMarkerLayer.d.ts +10 -0
  49. package/dist/cjs/hooks/useShapes/HoverMarkerLayer.js +22 -0
  50. package/dist/cjs/hooks/useShapes/MarkerLayer.d.ts +7 -0
  51. package/dist/cjs/hooks/useShapes/MarkerLayer.js +12 -0
  52. package/dist/cjs/hooks/useShapes/SeriesShapes.d.ts +18 -0
  53. package/dist/cjs/hooks/useShapes/SeriesShapes.js +32 -0
  54. package/dist/cjs/hooks/useShapes/index.d.ts +5 -18
  55. package/dist/cjs/hooks/useShapes/index.js +39 -229
  56. package/dist/cjs/index.d.ts +0 -1
  57. package/dist/cjs/index.js +0 -1
  58. package/dist/cjs/plugins/area/index.js +42 -0
  59. package/dist/cjs/plugins/bar-x/index.js +42 -0
  60. package/dist/cjs/plugins/bar-y/index.js +26 -0
  61. package/dist/cjs/plugins/funnel/index.js +18 -0
  62. package/dist/cjs/plugins/funnel/prepare.js +17 -12
  63. package/dist/cjs/plugins/heatmap/index.js +23 -0
  64. package/dist/cjs/plugins/line/index.js +28 -0
  65. package/dist/cjs/plugins/pie/index.js +18 -0
  66. package/dist/cjs/plugins/radar/index.js +18 -0
  67. package/dist/cjs/plugins/sankey/index.js +18 -0
  68. package/dist/cjs/plugins/scatter/index.js +26 -0
  69. package/dist/cjs/plugins/treemap/index.js +18 -0
  70. package/dist/cjs/plugins/waterfall/index.js +39 -0
  71. package/dist/cjs/plugins/x-range/index.js +25 -0
  72. package/dist/cjs/setup-jsdom.d.ts +0 -1
  73. package/dist/cjs/setup-jsdom.js +1 -1
  74. package/dist/esm/components/ChartInner/useChartInnerHandlers.d.ts +3 -2
  75. package/dist/esm/components/ChartInner/useChartInnerHandlers.js +1 -3
  76. package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +3 -2
  77. package/dist/esm/components/ChartInner/useDefaultState.d.ts +3 -2
  78. package/dist/esm/components/index.d.ts +1 -0
  79. package/dist/esm/components/index.js +1 -0
  80. package/dist/esm/core/series/plugin.d.ts +47 -2
  81. package/dist/esm/core/series/types.d.ts +4 -0
  82. package/dist/esm/core/shapes/area/prepare-data.js +29 -19
  83. package/dist/esm/core/shapes/area/renderer.d.ts +0 -5
  84. package/dist/esm/core/shapes/area/renderer.js +0 -75
  85. package/dist/esm/core/shapes/area/types.d.ts +2 -8
  86. package/dist/esm/core/shapes/bar-x/prepare-data.js +18 -7
  87. package/dist/esm/core/shapes/bar-x/renderer.d.ts +0 -1
  88. package/dist/esm/core/shapes/bar-x/renderer.js +0 -18
  89. package/dist/esm/core/shapes/bar-x/types.d.ts +2 -1
  90. package/dist/esm/core/shapes/bar-y/get-tooltip-data.js +4 -2
  91. package/dist/esm/core/shapes/bar-y/prepare-data.js +8 -2
  92. package/dist/esm/core/shapes/funnel/prepare-data.js +121 -68
  93. package/dist/esm/core/shapes/heatmap/prepare-data.js +11 -2
  94. package/dist/esm/core/shapes/line/prepare-data.js +27 -17
  95. package/dist/esm/core/shapes/line/renderer.d.ts +0 -5
  96. package/dist/esm/core/shapes/line/renderer.js +0 -75
  97. package/dist/esm/core/shapes/line/types.d.ts +2 -8
  98. package/dist/esm/core/shapes/marker.d.ts +30 -0
  99. package/dist/esm/core/shapes/marker.js +68 -0
  100. package/dist/esm/core/shapes/pie/prepare-data.js +24 -9
  101. package/dist/esm/core/shapes/radar/prepare-data.js +3 -0
  102. package/dist/esm/core/shapes/sankey/prepare-data.js +10 -1
  103. package/dist/esm/core/shapes/scatter/prepare-data.js +8 -1
  104. package/dist/esm/core/shapes/scatter/renderer.js +3 -2
  105. package/dist/esm/core/shapes/scatter/types.d.ts +1 -1
  106. package/dist/esm/core/shapes/treemap/prepare-data.js +9 -1
  107. package/dist/esm/core/shapes/types.d.ts +35 -0
  108. package/dist/esm/core/shapes/waterfall/prepare-data.js +5 -2
  109. package/dist/esm/core/shapes/x-range/prepare-data.js +7 -2
  110. package/dist/esm/core/types/chart/base.d.ts +22 -2
  111. package/dist/esm/core/types/chart/funnel.d.ts +25 -1
  112. package/dist/esm/core/types/chart/tooltip.d.ts +6 -1
  113. package/dist/esm/core/utils/data-labels.d.ts +34 -0
  114. package/dist/esm/core/utils/data-labels.js +26 -0
  115. package/dist/esm/core/utils/get-closest-data.d.ts +2 -2
  116. package/dist/esm/core/utils/get-closest-data.js +14 -34
  117. package/dist/esm/core/utils/tooltip-helpers.d.ts +16 -0
  118. package/dist/esm/core/utils/tooltip-helpers.js +12 -0
  119. package/dist/esm/hooks/useShapes/AnnotationLayer.d.ts +9 -0
  120. package/dist/esm/hooks/useShapes/AnnotationLayer.js +17 -0
  121. package/dist/esm/hooks/useShapes/HoverMarkerLayer.d.ts +10 -0
  122. package/dist/esm/hooks/useShapes/HoverMarkerLayer.js +22 -0
  123. package/dist/esm/hooks/useShapes/MarkerLayer.d.ts +7 -0
  124. package/dist/esm/hooks/useShapes/MarkerLayer.js +12 -0
  125. package/dist/esm/hooks/useShapes/SeriesShapes.d.ts +18 -0
  126. package/dist/esm/hooks/useShapes/SeriesShapes.js +32 -0
  127. package/dist/esm/hooks/useShapes/index.d.ts +5 -18
  128. package/dist/esm/hooks/useShapes/index.js +39 -229
  129. package/dist/esm/index.d.ts +0 -1
  130. package/dist/esm/index.js +0 -1
  131. package/dist/esm/plugins/area/index.js +42 -0
  132. package/dist/esm/plugins/bar-x/index.js +42 -0
  133. package/dist/esm/plugins/bar-y/index.js +26 -0
  134. package/dist/esm/plugins/funnel/index.js +18 -0
  135. package/dist/esm/plugins/funnel/prepare.js +17 -12
  136. package/dist/esm/plugins/heatmap/index.js +23 -0
  137. package/dist/esm/plugins/line/index.js +28 -0
  138. package/dist/esm/plugins/pie/index.js +18 -0
  139. package/dist/esm/plugins/radar/index.js +18 -0
  140. package/dist/esm/plugins/sankey/index.js +18 -0
  141. package/dist/esm/plugins/scatter/index.js +26 -0
  142. package/dist/esm/plugins/treemap/index.js +18 -0
  143. package/dist/esm/plugins/waterfall/index.js +39 -0
  144. package/dist/esm/plugins/x-range/index.js +25 -0
  145. package/dist/esm/setup-jsdom.d.ts +0 -1
  146. package/dist/esm/setup-jsdom.js +1 -1
  147. package/package.json +2 -3
  148. package/dist/cjs/hooks/useShapes/area/index.d.ts +0 -15
  149. package/dist/cjs/hooks/useShapes/area/index.js +0 -52
  150. package/dist/cjs/hooks/useShapes/bar-x/index.d.ts +0 -16
  151. package/dist/cjs/hooks/useShapes/bar-x/index.js +0 -45
  152. package/dist/cjs/hooks/useShapes/bar-y/index.d.ts +0 -13
  153. package/dist/cjs/hooks/useShapes/bar-y/index.js +0 -19
  154. package/dist/cjs/hooks/useShapes/funnel/index.d.ts +0 -13
  155. package/dist/cjs/hooks/useShapes/funnel/index.js +0 -21
  156. package/dist/cjs/hooks/useShapes/heatmap/index.d.ts +0 -13
  157. package/dist/cjs/hooks/useShapes/heatmap/index.js +0 -20
  158. package/dist/cjs/hooks/useShapes/line/index.d.ts +0 -15
  159. package/dist/cjs/hooks/useShapes/line/index.js +0 -38
  160. package/dist/cjs/hooks/useShapes/pie/index.d.ts +0 -12
  161. package/dist/cjs/hooks/useShapes/pie/index.js +0 -20
  162. package/dist/cjs/hooks/useShapes/radar/index.d.ts +0 -12
  163. package/dist/cjs/hooks/useShapes/radar/index.js +0 -19
  164. package/dist/cjs/hooks/useShapes/sankey/index.d.ts +0 -12
  165. package/dist/cjs/hooks/useShapes/sankey/index.js +0 -18
  166. package/dist/cjs/hooks/useShapes/scatter/index.d.ts +0 -13
  167. package/dist/cjs/hooks/useShapes/scatter/index.js +0 -22
  168. package/dist/cjs/hooks/useShapes/treemap/index.d.ts +0 -12
  169. package/dist/cjs/hooks/useShapes/treemap/index.js +0 -18
  170. package/dist/cjs/hooks/useShapes/waterfall/index.d.ts +0 -14
  171. package/dist/cjs/hooks/useShapes/waterfall/index.js +0 -31
  172. package/dist/cjs/hooks/useShapes/x-range/index.d.ts +0 -14
  173. package/dist/cjs/hooks/useShapes/x-range/index.js +0 -20
  174. package/dist/esm/hooks/useShapes/area/index.d.ts +0 -15
  175. package/dist/esm/hooks/useShapes/area/index.js +0 -52
  176. package/dist/esm/hooks/useShapes/bar-x/index.d.ts +0 -16
  177. package/dist/esm/hooks/useShapes/bar-x/index.js +0 -45
  178. package/dist/esm/hooks/useShapes/bar-y/index.d.ts +0 -13
  179. package/dist/esm/hooks/useShapes/bar-y/index.js +0 -19
  180. package/dist/esm/hooks/useShapes/funnel/index.d.ts +0 -13
  181. package/dist/esm/hooks/useShapes/funnel/index.js +0 -21
  182. package/dist/esm/hooks/useShapes/heatmap/index.d.ts +0 -13
  183. package/dist/esm/hooks/useShapes/heatmap/index.js +0 -20
  184. package/dist/esm/hooks/useShapes/line/index.d.ts +0 -15
  185. package/dist/esm/hooks/useShapes/line/index.js +0 -38
  186. package/dist/esm/hooks/useShapes/pie/index.d.ts +0 -12
  187. package/dist/esm/hooks/useShapes/pie/index.js +0 -20
  188. package/dist/esm/hooks/useShapes/radar/index.d.ts +0 -12
  189. package/dist/esm/hooks/useShapes/radar/index.js +0 -19
  190. package/dist/esm/hooks/useShapes/sankey/index.d.ts +0 -12
  191. package/dist/esm/hooks/useShapes/sankey/index.js +0 -18
  192. package/dist/esm/hooks/useShapes/scatter/index.d.ts +0 -13
  193. package/dist/esm/hooks/useShapes/scatter/index.js +0 -22
  194. package/dist/esm/hooks/useShapes/treemap/index.d.ts +0 -12
  195. package/dist/esm/hooks/useShapes/treemap/index.js +0 -18
  196. package/dist/esm/hooks/useShapes/waterfall/index.d.ts +0 -14
  197. package/dist/esm/hooks/useShapes/waterfall/index.js +0 -31
  198. package/dist/esm/hooks/useShapes/x-range/index.d.ts +0 -14
  199. package/dist/esm/hooks/useShapes/x-range/index.js +0 -20
@@ -1,5 +1,23 @@
1
+ import { getTooltipData } from '../../core/shapes/sankey/get-tooltip-data';
2
+ import { prepareSankeyData } from '../../core/shapes/sankey/prepare-data';
3
+ import { renderSankey } from '../../core/shapes/sankey/renderer';
1
4
  import { prepareSankeySeries } from './prepare';
5
+ function prepareShapeData({ series, boundsWidth, boundsHeight, }) {
6
+ const data = prepareSankeyData({
7
+ series: series[0],
8
+ width: boundsWidth,
9
+ height: boundsHeight,
10
+ });
11
+ return { renderData: [data], tooltipItems: [data] };
12
+ }
13
+ function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
14
+ return renderSankey({ plot }, preparedData[0], seriesOptions, dispatcher);
15
+ }
2
16
  export const sankeyPlugin = {
3
17
  type: 'sankey',
18
+ useClipPath: false,
4
19
  prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareSankeySeries({ series: series, seriesOptions, legend, colorScale }),
20
+ prepareShapeData,
21
+ renderShapes,
22
+ getTooltipData: getTooltipData,
5
23
  };
@@ -1,4 +1,27 @@
1
+ import { getTooltipData } from '../../core/shapes/scatter/get-tooltip-data';
2
+ import { prepareScatterData } from '../../core/shapes/scatter/prepare-data';
3
+ import { renderScatter } from '../../core/shapes/scatter/renderer';
1
4
  import { prepareScatterSeries } from './prepare';
5
+ async function prepareShapeData(args) {
6
+ const { series, xAxis, xScale, yAxis, yScale, split, isOutsideBounds, isRangeSlider } = args;
7
+ if (!xAxis || !xScale || !(yScale === null || yScale === void 0 ? void 0 : yScale.length) || !split) {
8
+ return { renderData: [], tooltipItems: [] };
9
+ }
10
+ const data = await prepareScatterData({
11
+ series: series,
12
+ xAxis,
13
+ xScale,
14
+ yAxis: yAxis !== null && yAxis !== void 0 ? yAxis : [],
15
+ yScale,
16
+ split,
17
+ isOutsideBounds: isOutsideBounds !== null && isOutsideBounds !== void 0 ? isOutsideBounds : (() => false),
18
+ isRangeSlider,
19
+ });
20
+ return { renderData: [data], tooltipItems: data.scatterData };
21
+ }
22
+ function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
23
+ return renderScatter({ plot }, preparedData[0], seriesOptions, dispatcher);
24
+ }
2
25
  export const scatterPlugin = {
3
26
  type: 'scatter',
4
27
  prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareScatterSeries({
@@ -7,4 +30,7 @@ export const scatterPlugin = {
7
30
  legend,
8
31
  colorScale,
9
32
  }),
33
+ prepareShapeData,
34
+ renderShapes,
35
+ getTooltipData: getTooltipData,
10
36
  };
@@ -1,5 +1,23 @@
1
+ import { getTooltipData } from '../../core/shapes/treemap/get-tooltip-data';
2
+ import { prepareTreemapData } from '../../core/shapes/treemap/prepare-data';
3
+ import { renderTreemap } from '../../core/shapes/treemap/renderer';
1
4
  import { prepareTreemap } from './prepare';
5
+ async function prepareShapeData({ series, boundsWidth, boundsHeight, }) {
6
+ const data = await prepareTreemapData({
7
+ series: series[0],
8
+ width: boundsWidth,
9
+ height: boundsHeight,
10
+ });
11
+ return { renderData: [data], tooltipItems: [data] };
12
+ }
13
+ function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
14
+ return renderTreemap({ plot }, preparedData[0], seriesOptions, dispatcher);
15
+ }
2
16
  export const treemapPlugin = {
3
17
  type: 'treemap',
18
+ useClipPath: false,
4
19
  prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareTreemap({ series: series, seriesOptions, legend, colorScale }),
20
+ prepareShapeData,
21
+ renderShapes,
22
+ getTooltipData: getTooltipData,
5
23
  };
@@ -1,5 +1,44 @@
1
+ import { getTooltipData } from '../../core/shapes/waterfall/get-tooltip-data';
2
+ import { prepareWaterfallData } from '../../core/shapes/waterfall/prepare-data';
3
+ import { renderWaterfall } from '../../core/shapes/waterfall/renderer';
4
+ import { filterOverlappingLabels } from '../../core/utils';
1
5
  import { prepareWaterfallSeries } from './prepare';
6
+ async function prepareShapeData(args) {
7
+ const { series, seriesOptions, xAxis, xScale, yAxis, yScale } = args;
8
+ if (!xAxis || !xScale || !(yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
9
+ return { renderData: [], tooltipItems: [] };
10
+ }
11
+ const data = await prepareWaterfallData({
12
+ series: series,
13
+ seriesOptions,
14
+ xAxis,
15
+ xScale,
16
+ yAxis: yAxis !== null && yAxis !== void 0 ? yAxis : [],
17
+ yScale,
18
+ });
19
+ const allowOverlap = data.some((d) => d.series.dataLabels.allowOverlap);
20
+ if (!allowOverlap) {
21
+ const filtered = filterOverlappingLabels(data.flatMap((d) => d.htmlLabels));
22
+ const [first, ...rest] = data;
23
+ if (first) {
24
+ const filteredData = [
25
+ Object.assign(Object.assign({}, first), { htmlLabels: filtered }),
26
+ ...rest.map((d) => (Object.assign(Object.assign({}, d), { htmlLabels: [] }))),
27
+ ];
28
+ return { renderData: filteredData, tooltipItems: filteredData };
29
+ }
30
+ }
31
+ return { renderData: data, tooltipItems: data };
32
+ }
33
+ function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
34
+ const data = preparedData;
35
+ const allowOverlap = data.some((d) => d.series.dataLabels.allowOverlap);
36
+ return renderWaterfall({ plot }, data, seriesOptions, allowOverlap, dispatcher);
37
+ }
2
38
  export const waterfallPlugin = {
3
39
  type: 'waterfall',
4
40
  prepareSeries: ({ series, legend, colorScale, colors }) => prepareWaterfallSeries({ series: series, legend, colorScale, colors }),
41
+ prepareShapeData,
42
+ renderShapes,
43
+ getTooltipData: getTooltipData,
5
44
  };
@@ -1,5 +1,30 @@
1
+ import { getTooltipData } from '../../core/shapes/x-range/get-tooltip-data';
2
+ import { prepareXRangeData } from '../../core/shapes/x-range/prepare-data';
3
+ import { renderXRange } from '../../core/shapes/x-range/renderer';
1
4
  import { prepareXRangeSeries } from './prepare';
5
+ async function prepareShapeData(args) {
6
+ const { series, xAxis, xScale, yAxis, yScale, boundsWidth, isRangeSlider } = args;
7
+ if (!xAxis || !xScale || !(yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
8
+ return { renderData: [], tooltipItems: [] };
9
+ }
10
+ const data = await prepareXRangeData({
11
+ series: series,
12
+ xAxis,
13
+ xScale,
14
+ yAxis: yAxis !== null && yAxis !== void 0 ? yAxis : [],
15
+ yScale,
16
+ boundsWidth,
17
+ isRangeSlider,
18
+ });
19
+ return { renderData: data, tooltipItems: data };
20
+ }
21
+ function renderShapes({ plot, preparedData, seriesOptions, dispatcher }) {
22
+ return renderXRange({ plot }, preparedData, seriesOptions, dispatcher);
23
+ }
2
24
  export const xRangePlugin = {
3
25
  type: 'x-range',
4
26
  prepareSeries: ({ series, seriesOptions, legend, colorScale }) => prepareXRangeSeries({ series: series, seriesOptions, legend, colorScale }),
27
+ prepareShapeData,
28
+ renderShapes,
29
+ getTooltipData: getTooltipData,
5
30
  };
@@ -1 +0,0 @@
1
- import './plugins';
@@ -1,4 +1,4 @@
1
- import './plugins';
1
+ "use strict";
2
2
  // Global mocks for jsdom environment.
3
3
  // Guarded by typeof checks so this file is safe to run in the `node` environment too.
4
4
  if (typeof document !== 'undefined') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/charts",
3
- "version": "1.51.7",
3
+ "version": "1.52.0",
4
4
  "description": "A flexible JavaScript library for data visualization and chart rendering using React",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",
@@ -22,8 +22,7 @@
22
22
  "sideEffects": [
23
23
  "*.css",
24
24
  "*.scss",
25
- "**/plugins/index.*",
26
- "./dist/*/index.js"
25
+ "**/plugins/index.*"
27
26
  ],
28
27
  "files": [
29
28
  "dist",
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedAreaData } from '../../../core/shapes/area/types';
5
- type Args = {
6
- boundsHeight: number;
7
- boundsWidth: number;
8
- clipPathId: string;
9
- htmlLayout: HTMLElement | null;
10
- preparedData: PreparedAreaData[];
11
- seriesOptions: PreparedSeriesOptions;
12
- dispatcher?: Dispatch<object>;
13
- };
14
- export declare const AreaSeriesShapes: (args: Args) => React.JSX.Element;
15
- export {};
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import { renderArea } from '../../../core/shapes/area/renderer';
3
- import { filterOverlappingLabels } from '../../../core/utils';
4
- import { block } from '../../../utils';
5
- import { HtmlLayer } from '../HtmlLayer';
6
- const b = block('area');
7
- export const AreaSeriesShapes = (args) => {
8
- const { boundsHeight, boundsWidth, dispatcher, preparedData, seriesOptions, htmlLayout, clipPathId, } = args;
9
- const plotRef = React.useRef(null);
10
- const markersRef = React.useRef(null);
11
- const hoverMarkersRef = React.useRef(null);
12
- const annotationsRef = React.useRef(null);
13
- const allowOverlapDataLabels = React.useMemo(() => {
14
- return preparedData.some((d) => d === null || d === void 0 ? void 0 : d.series.dataLabels.allowOverlap);
15
- }, [preparedData]);
16
- React.useEffect(() => {
17
- if (!plotRef.current ||
18
- !markersRef.current ||
19
- !hoverMarkersRef.current ||
20
- !annotationsRef.current) {
21
- return () => { };
22
- }
23
- return renderArea({
24
- plot: plotRef.current,
25
- markers: markersRef.current,
26
- hoverMarkers: hoverMarkersRef.current,
27
- annotations: annotationsRef.current,
28
- boundsWidth,
29
- boundsHeight,
30
- }, preparedData, seriesOptions, allowOverlapDataLabels, dispatcher);
31
- }, [
32
- allowOverlapDataLabels,
33
- boundsHeight,
34
- boundsWidth,
35
- dispatcher,
36
- preparedData,
37
- seriesOptions,
38
- ]);
39
- const htmlLayerData = React.useMemo(() => {
40
- const items = preparedData.map((d) => d === null || d === void 0 ? void 0 : d.htmlLabels).flat();
41
- if (allowOverlapDataLabels) {
42
- return { htmlElements: items };
43
- }
44
- return { htmlElements: filterOverlappingLabels(items) };
45
- }, [allowOverlapDataLabels, preparedData]);
46
- return (React.createElement(React.Fragment, null,
47
- React.createElement("g", { ref: plotRef, className: b(), clipPath: `url(#${clipPathId})` }),
48
- React.createElement("g", { ref: markersRef }),
49
- React.createElement("g", { ref: hoverMarkersRef }),
50
- React.createElement("g", { ref: annotationsRef }),
51
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
52
- };
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedBarXData } from '../../../core/shapes/bar-x/types';
5
- export { prepareBarXData } from '../../../core/shapes/bar-x/prepare-data';
6
- export * from '../../../core/shapes/bar-x/types';
7
- type Args = {
8
- boundsHeight: number;
9
- boundsWidth: number;
10
- clipPathId: string;
11
- htmlLayout: HTMLElement | null;
12
- preparedData: PreparedBarXData[];
13
- seriesOptions: PreparedSeriesOptions;
14
- dispatcher?: Dispatch<object>;
15
- };
16
- export declare const BarXSeriesShapes: (args: Args) => React.JSX.Element;
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import { renderBarX } from '../../../core/shapes/bar-x/renderer';
3
- import { filterOverlappingLabels } from '../../../core/utils';
4
- import { block } from '../../../utils';
5
- import { HtmlLayer } from '../HtmlLayer';
6
- export { prepareBarXData } from '../../../core/shapes/bar-x/prepare-data';
7
- export * from '../../../core/shapes/bar-x/types';
8
- const b = block('bar-x');
9
- export const BarXSeriesShapes = (args) => {
10
- const { boundsHeight, boundsWidth, dispatcher, preparedData, seriesOptions, htmlLayout, clipPathId, } = args;
11
- const ref = React.useRef(null);
12
- const annotationsRef = React.useRef(null);
13
- const allowOverlapDataLabels = React.useMemo(() => {
14
- return preparedData.some((d) => d === null || d === void 0 ? void 0 : d.series.dataLabels.allowOverlap);
15
- }, [preparedData]);
16
- React.useEffect(() => {
17
- if (!ref.current || !annotationsRef.current) {
18
- return () => { };
19
- }
20
- return renderBarX({
21
- plot: ref.current,
22
- annotations: annotationsRef.current,
23
- boundsWidth,
24
- boundsHeight,
25
- }, preparedData, seriesOptions, allowOverlapDataLabels, dispatcher);
26
- }, [
27
- allowOverlapDataLabels,
28
- boundsHeight,
29
- boundsWidth,
30
- dispatcher,
31
- preparedData,
32
- seriesOptions,
33
- ]);
34
- const htmlLayerData = React.useMemo(() => {
35
- const items = preparedData.map((d) => d === null || d === void 0 ? void 0 : d.htmlLabels).flat();
36
- if (allowOverlapDataLabels) {
37
- return { htmlElements: items };
38
- }
39
- return { htmlElements: filterOverlappingLabels(items) };
40
- }, [allowOverlapDataLabels, preparedData]);
41
- return (React.createElement(React.Fragment, null,
42
- React.createElement("g", { ref: ref, className: b(), clipPath: `url(#${clipPathId})` }),
43
- React.createElement("g", { ref: annotationsRef }),
44
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
45
- };
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { BarYShapesArgs } from '../../../core/shapes/bar-y/types';
5
- export { prepareBarYData } from '../../../core/shapes/bar-y/prepare-data';
6
- type Args = {
7
- clipPathId: string;
8
- htmlLayout: HTMLElement | null;
9
- preparedData: BarYShapesArgs;
10
- seriesOptions: PreparedSeriesOptions;
11
- dispatcher?: Dispatch<object>;
12
- };
13
- export declare function BarYSeriesShapes(args: Args): React.JSX.Element;
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { renderBarY } from '../../../core/shapes/bar-y/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- export { prepareBarYData } from '../../../core/shapes/bar-y/prepare-data';
6
- const b = block('bar-y');
7
- export function BarYSeriesShapes(args) {
8
- const { dispatcher, preparedData: { htmlLabels: htmlElements }, seriesOptions, htmlLayout, clipPathId, } = args;
9
- const ref = React.useRef(null);
10
- React.useEffect(() => {
11
- if (!ref.current) {
12
- return () => { };
13
- }
14
- return renderBarY({ plot: ref.current }, args.preparedData, seriesOptions, dispatcher);
15
- }, [args.preparedData, dispatcher, seriesOptions]);
16
- return (React.createElement(React.Fragment, null,
17
- React.createElement("g", { ref: ref, className: b(), clipPath: `url(#${clipPathId})` }),
18
- React.createElement(HtmlLayer, { preparedData: { htmlElements }, htmlLayout: htmlLayout })));
19
- }
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedFunnelData } from '../../../core/shapes/funnel/types';
5
- export { prepareFunnelData } from '../../../core/shapes/funnel/prepare-data';
6
- export * from '../../../core/shapes/funnel/types';
7
- type Args = {
8
- dispatcher?: Dispatch<object>;
9
- preparedData: PreparedFunnelData;
10
- seriesOptions: PreparedSeriesOptions;
11
- htmlLayout: HTMLElement | null;
12
- };
13
- export declare const FunnelSeriesShapes: (args: Args) => React.JSX.Element;
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { renderFunnel } from '../../../core/shapes/funnel/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- export { prepareFunnelData } from '../../../core/shapes/funnel/prepare-data';
6
- export * from '../../../core/shapes/funnel/types';
7
- const b = block('funnel');
8
- export const FunnelSeriesShapes = (args) => {
9
- const { dispatcher, htmlLayout, preparedData, seriesOptions } = args;
10
- const ref = React.useRef(null);
11
- React.useEffect(() => {
12
- if (!ref.current) {
13
- return () => { };
14
- }
15
- return renderFunnel({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
16
- }, [dispatcher, preparedData, seriesOptions]);
17
- const htmlLayerData = React.useMemo(() => ({ htmlElements: preparedData.htmlLabels }), [preparedData.htmlLabels]);
18
- return (React.createElement(React.Fragment, null,
19
- React.createElement("g", { ref: ref, className: b() }),
20
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
21
- };
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedHeatmapData } from '../../../core/shapes/heatmap/types';
5
- export { prepareHeatmapData } from '../../../core/shapes/heatmap/prepare-data';
6
- export * from '../../../core/shapes/heatmap/types';
7
- type Args = {
8
- htmlLayout: HTMLElement | null;
9
- preparedData: PreparedHeatmapData;
10
- seriesOptions: PreparedSeriesOptions;
11
- dispatcher?: Dispatch<object>;
12
- };
13
- export declare const HeatmapSeriesShapes: (args: Args) => React.JSX.Element;
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { renderHeatmap } from '../../../core/shapes/heatmap/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- export { prepareHeatmapData } from '../../../core/shapes/heatmap/prepare-data';
6
- export * from '../../../core/shapes/heatmap/types';
7
- const b = block('heatmap');
8
- export const HeatmapSeriesShapes = (args) => {
9
- const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
10
- const ref = React.useRef(null);
11
- React.useEffect(() => {
12
- if (!ref.current) {
13
- return () => { };
14
- }
15
- return renderHeatmap({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
16
- }, [dispatcher, preparedData, seriesOptions]);
17
- return (React.createElement(React.Fragment, null,
18
- React.createElement("g", { ref: ref, className: b() }),
19
- React.createElement(HtmlLayer, { preparedData: { htmlElements: preparedData.htmlLabels }, htmlLayout: htmlLayout })));
20
- };
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedLineData } from '../../../core/shapes/line/types';
5
- type Args = {
6
- boundsHeight: number;
7
- boundsWidth: number;
8
- clipPathId: string;
9
- htmlLayout: HTMLElement | null;
10
- preparedData: PreparedLineData[];
11
- seriesOptions: PreparedSeriesOptions;
12
- dispatcher?: Dispatch<object>;
13
- };
14
- export declare const LineSeriesShapes: (args: Args) => React.JSX.Element;
15
- export {};
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import { renderLine } from '../../../core/shapes/line/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- const b = block('line');
6
- export const LineSeriesShapes = (args) => {
7
- const { boundsHeight, boundsWidth, dispatcher, preparedData, seriesOptions, htmlLayout, clipPathId, } = args;
8
- const plotRef = React.useRef(null);
9
- const markersRef = React.useRef(null);
10
- const hoverMarkersRef = React.useRef(null);
11
- const annotationsRef = React.useRef(null);
12
- React.useEffect(() => {
13
- if (!plotRef.current ||
14
- !markersRef.current ||
15
- !hoverMarkersRef.current ||
16
- !annotationsRef.current) {
17
- return () => { };
18
- }
19
- return renderLine({
20
- plot: plotRef.current,
21
- markers: markersRef.current,
22
- hoverMarkers: hoverMarkersRef.current,
23
- annotations: annotationsRef.current,
24
- boundsWidth,
25
- boundsHeight,
26
- }, preparedData, seriesOptions, dispatcher);
27
- }, [boundsHeight, boundsWidth, dispatcher, preparedData, seriesOptions]);
28
- const htmlLayerData = React.useMemo(() => {
29
- const items = preparedData.flatMap((d) => d.htmlLabels);
30
- return { htmlElements: items };
31
- }, [preparedData]);
32
- return (React.createElement(React.Fragment, null,
33
- React.createElement("g", { ref: plotRef, className: b(), clipPath: `url(#${clipPathId})` }),
34
- React.createElement("g", { ref: markersRef }),
35
- React.createElement("g", { ref: hoverMarkersRef }),
36
- React.createElement("g", { ref: annotationsRef }),
37
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
38
- };
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedPieData } from '../../../core/shapes/pie/types';
5
- export { getHaloVisibility } from '../../../core/shapes/pie/renderer';
6
- type PreparePieSeriesArgs = {
7
- htmlLayout: HTMLElement | null;
8
- preparedData: PreparedPieData[];
9
- seriesOptions: PreparedSeriesOptions;
10
- dispatcher?: Dispatch<object>;
11
- };
12
- export declare function PieSeriesShapes(args: PreparePieSeriesArgs): React.JSX.Element;
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import { renderPie } from '../../../core/shapes/pie/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- export { getHaloVisibility } from '../../../core/shapes/pie/renderer';
6
- const b = block('pie');
7
- export function PieSeriesShapes(args) {
8
- const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
9
- const ref = React.useRef(null);
10
- React.useEffect(() => {
11
- if (!ref.current) {
12
- return () => { };
13
- }
14
- return renderPie({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
15
- }, [dispatcher, preparedData, seriesOptions]);
16
- const htmlElements = preparedData.map((d) => d.htmlLabels).flat();
17
- return (React.createElement(React.Fragment, null,
18
- React.createElement("g", { ref: ref, className: b(), style: { zIndex: 9 } }),
19
- React.createElement(HtmlLayer, { preparedData: { htmlElements }, htmlLayout: htmlLayout })));
20
- }
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedRadarData } from '../../../core/shapes/radar/types';
5
- type PrepareRadarSeriesArgs = {
6
- htmlLayout: HTMLElement | null;
7
- series: PreparedRadarData[];
8
- seriesOptions: PreparedSeriesOptions;
9
- dispatcher?: Dispatch<object>;
10
- };
11
- export declare function RadarSeriesShapes(args: PrepareRadarSeriesArgs): React.JSX.Element;
12
- export {};
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import { renderRadar } from '../../../core/shapes/radar/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- const b = block('radar');
6
- export function RadarSeriesShapes(args) {
7
- const { dispatcher, series: preparedData, seriesOptions, htmlLayout } = args;
8
- const ref = React.useRef(null);
9
- React.useEffect(() => {
10
- if (!ref.current) {
11
- return () => { };
12
- }
13
- return renderRadar({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
14
- }, [dispatcher, preparedData, seriesOptions]);
15
- const htmlElements = preparedData.map((d) => d.htmlLabels).flat();
16
- return (React.createElement(React.Fragment, null,
17
- React.createElement("g", { ref: ref, className: b() }),
18
- React.createElement(HtmlLayer, { preparedData: { htmlElements }, htmlLayout: htmlLayout })));
19
- }
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedSankeyData } from '../../../core/shapes/sankey/types';
5
- type ShapeProps = {
6
- htmlLayout: HTMLElement | null;
7
- preparedData: PreparedSankeyData;
8
- seriesOptions: PreparedSeriesOptions;
9
- dispatcher?: Dispatch<object>;
10
- };
11
- export declare const SankeySeriesShape: (props: ShapeProps) => React.JSX.Element;
12
- export {};
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { renderSankey } from '../../../core/shapes/sankey/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- const b = block('sankey');
6
- export const SankeySeriesShape = (props) => {
7
- const { dispatcher, preparedData, seriesOptions, htmlLayout } = props;
8
- const ref = React.useRef(null);
9
- React.useEffect(() => {
10
- if (!ref.current) {
11
- return () => { };
12
- }
13
- return renderSankey({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
14
- }, [dispatcher, preparedData, seriesOptions]);
15
- return (React.createElement(React.Fragment, null,
16
- React.createElement("g", { ref: ref, className: b() }),
17
- React.createElement(HtmlLayer, { preparedData: { htmlElements: preparedData.htmlLabels }, htmlLayout: htmlLayout })));
18
- };
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedScatterShapeData } from '../../../core/shapes/scatter/types';
5
- export { prepareScatterData } from '../../../core/shapes/scatter/prepare-data';
6
- type ScatterSeriesShapeProps = {
7
- htmlLayout: HTMLElement | null;
8
- preparedData: PreparedScatterShapeData;
9
- seriesOptions: PreparedSeriesOptions;
10
- clipPathId?: string;
11
- dispatcher?: Dispatch<object>;
12
- };
13
- export declare function ScatterSeriesShape(props: ScatterSeriesShapeProps): React.JSX.Element;
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import { renderScatter } from '../../../core/shapes/scatter/renderer';
3
- import { block } from '../../../utils';
4
- import { HtmlLayer } from '../HtmlLayer';
5
- export { prepareScatterData } from '../../../core/shapes/scatter/prepare-data';
6
- const b = block('scatter');
7
- export function ScatterSeriesShape(props) {
8
- const { clipPathId, dispatcher, preparedData, seriesOptions, htmlLayout } = props;
9
- const ref = React.useRef(null);
10
- React.useEffect(() => {
11
- if (!ref.current) {
12
- return () => { };
13
- }
14
- return renderScatter({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
15
- }, [dispatcher, preparedData, seriesOptions]);
16
- const htmlLayerData = React.useMemo(() => {
17
- return { htmlElements: preparedData.htmlLabels };
18
- }, [preparedData]);
19
- return (React.createElement(React.Fragment, null,
20
- React.createElement("g", { ref: ref, className: b(), clipPath: clipPathId ? `url(#${clipPathId})` : undefined }),
21
- React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
22
- }
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedTreemapData } from '../../../core/shapes/treemap/types';
5
- type ShapeProps = {
6
- htmlLayout: HTMLElement | null;
7
- preparedData: PreparedTreemapData;
8
- seriesOptions: PreparedSeriesOptions;
9
- dispatcher?: Dispatch<object>;
10
- };
11
- export declare const TreemapSeriesShape: (props: ShapeProps) => React.JSX.Element;
12
- export {};