@redsift/charts 11.6.0-muiv5-alpha.4 → 11.6.0-muiv5-alpha.6

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 (290) hide show
  1. package/_internal/Arc.d.ts +10 -0
  2. package/_internal/Arc.js +2 -0
  3. package/_internal/Arc.js.map +1 -0
  4. package/{components/Arc/Arc.js → _internal/Arc2.js} +52 -9
  5. package/_internal/Arc2.js.map +1 -0
  6. package/_internal/Arcs.d.ts +10 -0
  7. package/_internal/Arcs.js +2 -0
  8. package/_internal/Arcs.js.map +1 -0
  9. package/{components/Arcs/Arcs.js → _internal/Arcs2.js} +12 -8
  10. package/_internal/Arcs2.js.map +1 -0
  11. package/_internal/Axis.d.ts +8 -0
  12. package/_internal/Axis.js +2 -0
  13. package/_internal/Axis.js.map +1 -0
  14. package/{components/Axis/Axis.js → _internal/Axis2.js} +187 -10
  15. package/_internal/Axis2.js.map +1 -0
  16. package/_internal/Bar.d.ts +10 -0
  17. package/_internal/Bar.js +2 -0
  18. package/_internal/Bar.js.map +1 -0
  19. package/{components/Bar/Bar.js → _internal/Bar2.js} +85 -10
  20. package/_internal/Bar2.js.map +1 -0
  21. package/_internal/BarChart.d.ts +17 -0
  22. package/_internal/BarChart.js +2 -0
  23. package/_internal/BarChart.js.map +1 -0
  24. package/_internal/BarChart2.js +1419 -0
  25. package/_internal/BarChart2.js.map +1 -0
  26. package/_internal/ChartContainer.d.ts +5 -0
  27. package/_internal/ChartContainer.js +2 -0
  28. package/_internal/ChartContainer.js.map +1 -0
  29. package/{components/ChartContainer/ChartContainer.js → _internal/ChartContainer2.js} +105 -6
  30. package/_internal/ChartContainer2.js.map +1 -0
  31. package/_internal/DataPoint.d.ts +7 -0
  32. package/_internal/DataPoint.js +2 -0
  33. package/_internal/DataPoint.js.map +1 -0
  34. package/{components/DataPoint/DataPoint.js → _internal/DataPoint2.js} +11 -5
  35. package/_internal/DataPoint2.js.map +1 -0
  36. package/_internal/Dot.d.ts +10 -0
  37. package/_internal/Dot.js +2 -0
  38. package/_internal/Dot.js.map +1 -0
  39. package/{components/Dot/Dot.js → _internal/Dot2.js} +61 -6
  40. package/_internal/Dot2.js.map +1 -0
  41. package/_internal/Legend.d.ts +10 -0
  42. package/_internal/Legend.js +2 -0
  43. package/_internal/Legend.js.map +1 -0
  44. package/{components/Legend/Legend.js → _internal/Legend3.js} +17 -6
  45. package/_internal/Legend3.js.map +1 -0
  46. package/_internal/LegendItem.d.ts +21 -0
  47. package/_internal/LegendItem.js +2 -0
  48. package/_internal/LegendItem.js.map +1 -0
  49. package/{components/LegendItem/LegendItem.js → _internal/LegendItem2.js} +64 -7
  50. package/_internal/LegendItem2.js.map +1 -0
  51. package/_internal/Line.d.ts +10 -0
  52. package/_internal/Line.js +2 -0
  53. package/_internal/Line.js.map +1 -0
  54. package/{components/Line/Line.js → _internal/Line2.js} +12 -8
  55. package/_internal/Line2.js.map +1 -0
  56. package/_internal/LineChart.d.ts +17 -0
  57. package/_internal/LineChart.js +2 -0
  58. package/_internal/LineChart.js.map +1 -0
  59. package/{components/LineChart/RenderedLineChart.js → _internal/LineChart2.js} +317 -20
  60. package/_internal/LineChart2.js.map +1 -0
  61. package/_internal/PieChart.d.ts +14 -0
  62. package/_internal/PieChart.js +2 -0
  63. package/_internal/PieChart.js.map +1 -0
  64. package/_internal/PieChart2.js +605 -0
  65. package/_internal/PieChart2.js.map +1 -0
  66. package/_internal/ScatterPlot.d.ts +17 -0
  67. package/_internal/ScatterPlot.js +2 -0
  68. package/_internal/ScatterPlot.js.map +1 -0
  69. package/_internal/ScatterPlot2.js +743 -0
  70. package/_internal/ScatterPlot2.js.map +1 -0
  71. package/{_virtual → _internal}/_rollupPluginBabelHelpers.js +1 -1
  72. package/{types/axis.d.ts → _internal/axis.d2.ts} +2 -2
  73. package/_internal/config.js +13 -0
  74. package/_internal/config.js.map +1 -0
  75. package/{types → _internal}/data.d.ts +1 -1
  76. package/{types/legend.js → _internal/legend2.js} +2 -2
  77. package/_internal/legend2.js.map +1 -0
  78. package/{components/Axis/types.d.ts → _internal/scale.d.ts} +47 -2
  79. package/{scheme.js → _internal/scheme.js} +1 -1
  80. package/_internal/scheme.js.map +1 -0
  81. package/{components/Arc → _internal}/styles.d.ts +7 -5
  82. package/{components/Line/types.d.ts → _internal/styles.d10.ts} +14 -5
  83. package/{components/LineChart/types.d.ts → _internal/styles.d11.ts} +23 -12
  84. package/{components/PieChart/types.d.ts → _internal/styles.d12.ts} +29 -11
  85. package/{components/ScatterPlot/types.d.ts → _internal/styles.d13.ts} +23 -12
  86. package/{components/Arcs/types.d.ts → _internal/styles.d2.ts} +11 -2
  87. package/{components/Axis/styles.d.ts → _internal/styles.d3.ts} +6 -3
  88. package/{components/Bar/styles.d.ts → _internal/styles.d4.ts} +7 -5
  89. package/{components/BarChart/types.d.ts → _internal/styles.d5.ts} +49 -14
  90. package/{components/ChartContainer/styles.d.ts → _internal/styles.d6.ts} +8 -3
  91. package/{components/DataPoint/styles.d.ts → _internal/styles.d7.ts} +5 -2
  92. package/{components/Dot/styles.d.ts → _internal/styles.d8.ts} +7 -4
  93. package/{components/Legend/styles.d.ts → _internal/styles.d9.ts} +5 -2
  94. package/{utils/index.js → _internal/theme.js} +37 -2
  95. package/_internal/theme.js.map +1 -0
  96. package/{components/Arc → _internal}/types.d.ts +3 -3
  97. package/{components/Bar/types.d.ts → _internal/types.d2.ts} +3 -3
  98. package/{components/ChartContainer/types.d.ts → _internal/types.d3.ts} +1 -1
  99. package/{components/DataPoint/types.d.ts → _internal/types.d4.ts} +29 -3
  100. package/{components/Dot/types.d.ts → _internal/types.d5.ts} +3 -3
  101. package/{components/Legend/types.d.ts → _internal/types.d6.ts} +4 -4
  102. package/{components/LegendItem/types.d.ts → _internal/types.d7.ts} +8 -4
  103. package/{hooks → _internal}/useFormatCategoricalData.js +3 -4
  104. package/{hooks → _internal}/useFormatCategoricalData.js.map +1 -1
  105. package/index.d.ts +129 -51
  106. package/index.d2.ts +49 -0
  107. package/index.js +17 -42
  108. package/index.js.map +1 -1
  109. package/index2.js +16 -0
  110. package/index2.js.map +1 -0
  111. package/package.json +2 -2
  112. package/components/Arc/Arc.d.ts +0 -6
  113. package/components/Arc/Arc.js.map +0 -1
  114. package/components/Arc/styles.js +0 -49
  115. package/components/Arc/styles.js.map +0 -1
  116. package/components/Arcs/Arcs.d.ts +0 -6
  117. package/components/Arcs/Arcs.js.map +0 -1
  118. package/components/Arcs/styles.d.ts +0 -9
  119. package/components/Arcs/styles.js +0 -9
  120. package/components/Arcs/styles.js.map +0 -1
  121. package/components/Axis/Axis.d.ts +0 -7
  122. package/components/Axis/Axis.js.map +0 -1
  123. package/components/Axis/computeTicks.js +0 -117
  124. package/components/Axis/computeTicks.js.map +0 -1
  125. package/components/Axis/styles.js +0 -51
  126. package/components/Axis/styles.js.map +0 -1
  127. package/components/Axis/types.js +0 -24
  128. package/components/Axis/types.js.map +0 -1
  129. package/components/Bar/Bar.d.ts +0 -6
  130. package/components/Bar/Bar.js.map +0 -1
  131. package/components/Bar/styles.js +0 -66
  132. package/components/Bar/styles.js.map +0 -1
  133. package/components/Bar/types.js +0 -18
  134. package/components/Bar/types.js.map +0 -1
  135. package/components/BarChart/BarChart.d.ts +0 -29
  136. package/components/BarChart/BarChart.js +0 -141
  137. package/components/BarChart/BarChart.js.map +0 -1
  138. package/components/BarChart/BarChartBars.js +0 -168
  139. package/components/BarChart/BarChartBars.js.map +0 -1
  140. package/components/BarChart/BarChartSection.js +0 -139
  141. package/components/BarChart/BarChartSection.js.map +0 -1
  142. package/components/BarChart/EmptyBarChart.js +0 -57
  143. package/components/BarChart/EmptyBarChart.js.map +0 -1
  144. package/components/BarChart/LoadingBarChart.js +0 -18
  145. package/components/BarChart/LoadingBarChart.js.map +0 -1
  146. package/components/BarChart/RenderedLinearBarChart.js +0 -549
  147. package/components/BarChart/RenderedLinearBarChart.js.map +0 -1
  148. package/components/BarChart/RenderedOrdinalBarChart.js +0 -236
  149. package/components/BarChart/RenderedOrdinalBarChart.js.map +0 -1
  150. package/components/BarChart/context.js +0 -13
  151. package/components/BarChart/context.js.map +0 -1
  152. package/components/BarChart/intl/en-US.json.js +0 -17
  153. package/components/BarChart/intl/en-US.json.js.map +0 -1
  154. package/components/BarChart/intl/fr-FR.json.js +0 -17
  155. package/components/BarChart/intl/fr-FR.json.js.map +0 -1
  156. package/components/BarChart/intl/index.js +0 -10
  157. package/components/BarChart/intl/index.js.map +0 -1
  158. package/components/BarChart/styles.d.ts +0 -19
  159. package/components/BarChart/styles.js +0 -71
  160. package/components/BarChart/styles.js.map +0 -1
  161. package/components/BarChart/types.js +0 -17
  162. package/components/BarChart/types.js.map +0 -1
  163. package/components/BarChart/utils.js +0 -69
  164. package/components/BarChart/utils.js.map +0 -1
  165. package/components/ChartContainer/ChartContainer.d.ts +0 -9
  166. package/components/ChartContainer/ChartContainer.js.map +0 -1
  167. package/components/ChartContainer/context.js +0 -6
  168. package/components/ChartContainer/context.js.map +0 -1
  169. package/components/ChartContainer/intl/en-US.json.js +0 -14
  170. package/components/ChartContainer/intl/en-US.json.js.map +0 -1
  171. package/components/ChartContainer/intl/fr-FR.json.js +0 -14
  172. package/components/ChartContainer/intl/fr-FR.json.js.map +0 -1
  173. package/components/ChartContainer/intl/index.js +0 -10
  174. package/components/ChartContainer/intl/index.js.map +0 -1
  175. package/components/ChartContainer/styles.js +0 -76
  176. package/components/ChartContainer/styles.js.map +0 -1
  177. package/components/DataPoint/DataPoint.d.ts +0 -6
  178. package/components/DataPoint/DataPoint.js.map +0 -1
  179. package/components/DataPoint/styles.js +0 -10
  180. package/components/DataPoint/styles.js.map +0 -1
  181. package/components/Dot/Dot.d.ts +0 -6
  182. package/components/Dot/Dot.js.map +0 -1
  183. package/components/Dot/styles.js +0 -49
  184. package/components/Dot/styles.js.map +0 -1
  185. package/components/Dot/types.js +0 -14
  186. package/components/Dot/types.js.map +0 -1
  187. package/components/Legend/Legend.d.ts +0 -6
  188. package/components/Legend/Legend.js.map +0 -1
  189. package/components/Legend/styles.js +0 -15
  190. package/components/Legend/styles.js.map +0 -1
  191. package/components/LegendItem/LegendItem.js.map +0 -1
  192. package/components/LegendItem/styles.js +0 -63
  193. package/components/LegendItem/styles.js.map +0 -1
  194. package/components/Line/Line.d.ts +0 -6
  195. package/components/Line/Line.js.map +0 -1
  196. package/components/Line/styles.d.ts +0 -9
  197. package/components/Line/styles.js +0 -9
  198. package/components/Line/styles.js.map +0 -1
  199. package/components/LineChart/EmptyLineChart.js +0 -58
  200. package/components/LineChart/EmptyLineChart.js.map +0 -1
  201. package/components/LineChart/LineChart.d.ts +0 -6
  202. package/components/LineChart/LineChart.js +0 -96
  203. package/components/LineChart/LineChart.js.map +0 -1
  204. package/components/LineChart/LoadingLineChart.js +0 -18
  205. package/components/LineChart/LoadingLineChart.js.map +0 -1
  206. package/components/LineChart/RenderedLineChart.js.map +0 -1
  207. package/components/LineChart/intl/en-US.json.js +0 -17
  208. package/components/LineChart/intl/en-US.json.js.map +0 -1
  209. package/components/LineChart/intl/fr-FR.json.js +0 -17
  210. package/components/LineChart/intl/fr-FR.json.js.map +0 -1
  211. package/components/LineChart/intl/index.js +0 -10
  212. package/components/LineChart/intl/index.js.map +0 -1
  213. package/components/LineChart/styles.d.ts +0 -17
  214. package/components/LineChart/styles.js +0 -53
  215. package/components/LineChart/styles.js.map +0 -1
  216. package/components/LineChart/types.js +0 -17
  217. package/components/LineChart/types.js.map +0 -1
  218. package/components/LineChart/utils.js +0 -67
  219. package/components/LineChart/utils.js.map +0 -1
  220. package/components/PieChart/EmptyPieChart.js +0 -85
  221. package/components/PieChart/EmptyPieChart.js.map +0 -1
  222. package/components/PieChart/LoadingPieChart.js +0 -18
  223. package/components/PieChart/LoadingPieChart.js.map +0 -1
  224. package/components/PieChart/PieChart.d.ts +0 -6
  225. package/components/PieChart/PieChart.js +0 -98
  226. package/components/PieChart/PieChart.js.map +0 -1
  227. package/components/PieChart/RenderedPieChart.js +0 -198
  228. package/components/PieChart/RenderedPieChart.js.map +0 -1
  229. package/components/PieChart/intl/en-US.json.js +0 -9
  230. package/components/PieChart/intl/en-US.json.js.map +0 -1
  231. package/components/PieChart/intl/fr-FR.json.js +0 -9
  232. package/components/PieChart/intl/fr-FR.json.js.map +0 -1
  233. package/components/PieChart/intl/index.js +0 -10
  234. package/components/PieChart/intl/index.js.map +0 -1
  235. package/components/PieChart/styles.d.ts +0 -24
  236. package/components/PieChart/styles.js +0 -168
  237. package/components/PieChart/styles.js.map +0 -1
  238. package/components/PieChart/types.js +0 -27
  239. package/components/PieChart/types.js.map +0 -1
  240. package/components/PieChart/utils.js +0 -37
  241. package/components/PieChart/utils.js.map +0 -1
  242. package/components/ScatterPlot/EmptyScatterPlot.js +0 -58
  243. package/components/ScatterPlot/EmptyScatterPlot.js.map +0 -1
  244. package/components/ScatterPlot/LoadingScatterPlot.js +0 -18
  245. package/components/ScatterPlot/LoadingScatterPlot.js.map +0 -1
  246. package/components/ScatterPlot/RenderedScatterPlot.js +0 -352
  247. package/components/ScatterPlot/RenderedScatterPlot.js.map +0 -1
  248. package/components/ScatterPlot/ScatterPlot.d.ts +0 -6
  249. package/components/ScatterPlot/ScatterPlot.js +0 -105
  250. package/components/ScatterPlot/ScatterPlot.js.map +0 -1
  251. package/components/ScatterPlot/intl/en-US.json.js +0 -12
  252. package/components/ScatterPlot/intl/en-US.json.js.map +0 -1
  253. package/components/ScatterPlot/intl/fr-FR.json.js +0 -17
  254. package/components/ScatterPlot/intl/fr-FR.json.js.map +0 -1
  255. package/components/ScatterPlot/intl/index.js +0 -10
  256. package/components/ScatterPlot/intl/index.js.map +0 -1
  257. package/components/ScatterPlot/styles.d.ts +0 -17
  258. package/components/ScatterPlot/styles.js +0 -53
  259. package/components/ScatterPlot/styles.js.map +0 -1
  260. package/components/ScatterPlot/types.js +0 -24
  261. package/components/ScatterPlot/types.js.map +0 -1
  262. package/components/ScatterPlot/utils.js +0 -70
  263. package/components/ScatterPlot/utils.js.map +0 -1
  264. package/config.js +0 -15
  265. package/config.js.map +0 -1
  266. package/design-system/src/react-aria/react-aria/i18n/useMessageFormatter.d.ts +0 -5
  267. package/hooks/useBrush.d.ts +0 -17
  268. package/hooks/useBrush.js +0 -48
  269. package/hooks/useBrush.js.map +0 -1
  270. package/hooks/useColor.d.ts +0 -18
  271. package/hooks/useColor.js +0 -20
  272. package/hooks/useColor.js.map +0 -1
  273. package/hooks/useFormatCategoricalData.d.ts +0 -26
  274. package/hooks/useZoom.d.ts +0 -26
  275. package/hooks/useZoom.js +0 -39
  276. package/hooks/useZoom.js.map +0 -1
  277. package/scheme.d.ts +0 -32
  278. package/scheme.js.map +0 -1
  279. package/types/legend.d.ts +0 -30
  280. package/types/legend.js.map +0 -1
  281. package/types/scale.d.ts +0 -48
  282. package/types/size.d.ts +0 -20
  283. package/types/size.js +0 -8
  284. package/types/size.js.map +0 -1
  285. package/types/theme.d.ts +0 -23
  286. package/types/theme.js +0 -13
  287. package/types/theme.js.map +0 -1
  288. package/utils/index.d.ts +0 -11
  289. package/utils/index.js.map +0 -1
  290. /package/{_virtual → _internal}/_rollupPluginBabelHelpers.js.map +0 -0
@@ -0,0 +1,743 @@
1
+ import { _ as _objectWithoutProperties, a as _extends, b as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
2
+ import React__default, { useRef, useEffect, useState, forwardRef } from 'react';
3
+ import classNames from 'classnames';
4
+ import { useTheme, useMessageFormatter, Flexbox, Button, Text, useId } from '@redsift/design-system';
5
+ import styled from 'styled-components';
6
+ import { C as ChartContainer } from './ChartContainer2.js';
7
+ import { brush, select, zoom, interpolateRound, scaleLinear, min, extent, descending, scaleSqrt, max } from 'd3';
8
+ import { C as ChartSize, g as getSortingMethod, u as useColor, m as mergeLegends, a as ColorTheme } from './theme.js';
9
+ import { A as Axis, a as AxisVariant } from './Axis2.js';
10
+ import { Popover } from '@redsift/popovers';
11
+ import { D as Dot } from './Dot2.js';
12
+ import { L as Legend } from './Legend3.js';
13
+ import { L as LegendVariant, T as TooltipVariant } from './legend2.js';
14
+
15
+ const getRoundedIntermediaryPoint = (selection, scaleX, scaleY) => {
16
+ if (!selection) {
17
+ return null;
18
+ }
19
+ const xTicks = scaleX.ticks(20);
20
+ const xDelta = xTicks[1] - xTicks[0];
21
+ const yTicks = scaleY.ticks(20);
22
+ const yDelta = yTicks[1] - yTicks[0];
23
+ return [[scaleX(Math.round(scaleX.invert(selection[0][0]) / xDelta) * xDelta - xDelta / 2), scaleY(Math.round(scaleY.invert(selection[0][1]) / yDelta) * yDelta - yDelta / 2)], [scaleX(Math.round(scaleX.invert(selection[1][0]) / xDelta) * xDelta - xDelta / 2), scaleY(Math.round(scaleY.invert(selection[1][1]) / yDelta) * yDelta - yDelta / 2)]];
24
+ };
25
+ const useBrush = _ref => {
26
+ let {
27
+ brushRef: propsBrushRef,
28
+ svgRef,
29
+ extent,
30
+ scaleX,
31
+ scaleY,
32
+ isBrushable,
33
+ isGridded,
34
+ onBrush,
35
+ onBrushEnd
36
+ } = _ref;
37
+ const brushRef = propsBrushRef || useRef();
38
+ useEffect(() => {
39
+ if (svgRef.current && isBrushable) {
40
+ brushRef.current = brush().extent(extent).keyModifiers(false).filter(event => event.shiftKey).on('brush', event => {
41
+ if (!event.sourceEvent || !brushRef.current || !svgRef.current) return;
42
+ if (isGridded) {
43
+ const selection = getRoundedIntermediaryPoint(event.selection, scaleX, scaleY);
44
+ select(svgRef.current).call(brushRef.current.move, selection);
45
+ onBrush === null || onBrush === void 0 ? void 0 : onBrush(selection, scaleX, scaleY);
46
+ } else {
47
+ onBrush === null || onBrush === void 0 ? void 0 : onBrush(event.selection, scaleX, scaleY);
48
+ }
49
+ }).on('end', event => {
50
+ if (!event.sourceEvent || !brushRef.current || !svgRef.current) return;
51
+ onBrushEnd === null || onBrushEnd === void 0 ? void 0 : onBrushEnd(event.selection, scaleX, scaleY);
52
+ });
53
+ select(svgRef.current).call(brushRef.current);
54
+ }
55
+ });
56
+ };
57
+
58
+ const useZoom = _ref => {
59
+ let {
60
+ svgRef,
61
+ scaleX,
62
+ scaleY,
63
+ defaultTransform = {
64
+ k: 1,
65
+ x: 0,
66
+ y: 0
67
+ },
68
+ size,
69
+ onZoom
70
+ } = _ref;
71
+ const zx = useRef(scaleX);
72
+ const zy = useRef(scaleY);
73
+ const [transform, setTransform] = useState(defaultTransform);
74
+ useEffect(() => {
75
+ if (svgRef.current) {
76
+ const zoom$1 = zoom().filter(event => !event.shiftKey).scaleExtent([1 / 2 ** 3, 2 ** 3]).on('zoom', event => {
77
+ onZoom === null || onZoom === void 0 ? void 0 : onZoom();
78
+ zx.current = event.transform.rescaleX(scaleX).interpolate(interpolateRound);
79
+ zy.current = event.transform.rescaleY(scaleY).interpolate(interpolateRound);
80
+ setTransform(event.transform);
81
+ });
82
+ select(svgRef.current).call(zoom$1);
83
+ }
84
+ }, [svgRef.current, size]);
85
+ return {
86
+ transform,
87
+ scaleX: zx.current,
88
+ scaleY: zy.current
89
+ };
90
+ };
91
+
92
+ /**
93
+ * Component variant.
94
+ */
95
+ const ScatterPlotVariant = {
96
+ default: 'default',
97
+ gridded: 'gridded'
98
+ };
99
+ /**
100
+ * Component's labels variant.
101
+ */
102
+ const ScatterPlotLegendVariant = {
103
+ none: 'none',
104
+ externalLabel: 'externalLabel',
105
+ externalLabelValue: 'externalLabelValue',
106
+ externalLabelPercent: 'externalLabelPercent',
107
+ custom: 'custom'
108
+ };
109
+
110
+ /**
111
+ * Component props.
112
+ */
113
+
114
+ /**
115
+ * Component style.
116
+ */
117
+ const StyledScatterPlot = styled(ChartContainer)``;
118
+ const StyledScatterPlotEmptyText = styled.div`
119
+ position: absolute;
120
+ top: 0;
121
+ left: 0;
122
+ height: 100%;
123
+ width: 100%;
124
+ display: flex;
125
+ flex-direction: column;
126
+ justify-content: center;
127
+ align-items: center;
128
+ pointer-events: none;
129
+
130
+ > * {
131
+ max-width: ${_ref => {
132
+ let {
133
+ $maxWidth
134
+ } = _ref;
135
+ return $maxWidth;
136
+ }}px;
137
+ }
138
+
139
+ > span {
140
+ font-family: var(--redsift-typography-font-family-poppins);
141
+ color: ${_ref2 => {
142
+ let {
143
+ $theme
144
+ } = _ref2;
145
+ return `var(--redsift-color-${$theme}-components-text-primary)`;
146
+ }};
147
+ font-size: ${_ref3 => {
148
+ let {
149
+ $textSize
150
+ } = _ref3;
151
+ return $textSize;
152
+ }}px;
153
+ line-height: ${_ref4 => {
154
+ let {
155
+ $textSize
156
+ } = _ref4;
157
+ return $textSize;
158
+ }}px;
159
+ }
160
+ `;
161
+
162
+ const _excluded$3 = ["className"];
163
+ const LoadingScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
164
+ const {
165
+ className
166
+ } = props,
167
+ forwardedProps = _objectWithoutProperties(props, _excluded$3);
168
+ return /*#__PURE__*/React__default.createElement(StyledScatterPlot, _extends({}, forwardedProps, {
169
+ className: className,
170
+ ref: ref
171
+ }), "Loading...");
172
+ });
173
+
174
+ const sizeToDimension = size => {
175
+ if (typeof size !== 'string') {
176
+ return size;
177
+ }
178
+ switch (size) {
179
+ case ChartSize.small:
180
+ return {
181
+ width: 600,
182
+ height: 300,
183
+ fontSize: 30
184
+ };
185
+ case ChartSize.medium:
186
+ default:
187
+ return {
188
+ width: 750,
189
+ height: 375,
190
+ fontSize: 34
191
+ };
192
+ case ChartSize.large:
193
+ return {
194
+ width: 900,
195
+ height: 450,
196
+ fontSize: 38
197
+ };
198
+ }
199
+ };
200
+ const BASE_NUMBER_OF_TICKS = 20;
201
+ const getClosestLineIndex = (value, scale) => {
202
+ const ticks = scale.ticks(BASE_NUMBER_OF_TICKS);
203
+ const delta = ticks[1] - ticks[0];
204
+ const index = Math.round(value / delta);
205
+ const roundValue = index * delta;
206
+ return [index, roundValue];
207
+ };
208
+ const group = (data, x, y) => {
209
+ const groupDict = {};
210
+ data.forEach(d => {
211
+ const [i, rx] = getClosestLineIndex(d.key[0], x);
212
+ const [j, ry] = getClosestLineIndex(d.key[1], y);
213
+ const key = `${i}_${j}_${d.key[2]}`;
214
+ if (!(key in groupDict)) {
215
+ groupDict[key] = {
216
+ category: d.key[2],
217
+ x: rx,
218
+ y: ry,
219
+ data: {
220
+ key: d.key,
221
+ value: 0
222
+ },
223
+ points: []
224
+ };
225
+ }
226
+ groupDict[key].points.push(d);
227
+ groupDict[key].data.value += 1;
228
+ });
229
+ return Object.values(groupDict);
230
+ };
231
+ const countBy = (arr, sortingMethod) => {
232
+ const counts = arr.reduce((prev, curr) => (prev[curr.key[2]] = ++prev[curr.key[2]] || 1, prev), {});
233
+ return Object.keys(counts).map(key => ({
234
+ key: key,
235
+ value: counts[key]
236
+ })).sort(getSortingMethod(sortingMethod));
237
+ };
238
+
239
+ const _excluded$2 = ["className", "data", "emptyComponent", "localeText", "size"];
240
+ const EmptyScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
241
+ const {
242
+ className,
243
+ data: propsData,
244
+ emptyComponent,
245
+ localeText,
246
+ size
247
+ } = props,
248
+ forwardedProps = _objectWithoutProperties(props, _excluded$2);
249
+ const theme = useTheme();
250
+ const cache = useRef();
251
+ const data = propsData;
252
+ useEffect(() => {
253
+ cache.current = data;
254
+ });
255
+ const chartDimensions = sizeToDimension(size);
256
+ const width = chartDimensions.width;
257
+ const height = chartDimensions.height;
258
+ const margins = {
259
+ top: 16,
260
+ left: 48,
261
+ right: 16,
262
+ bottom: 48
263
+ };
264
+ const chartWidth = width - margins.left - margins.right;
265
+ return /*#__PURE__*/React__default.createElement(StyledScatterPlot, _extends({}, forwardedProps, {
266
+ className: className,
267
+ ref: ref
268
+ }), emptyComponent !== null && emptyComponent !== void 0 ? emptyComponent : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StyledScatterPlotEmptyText, {
269
+ $maxWidth: width,
270
+ $textSize: chartDimensions.fontSize / 2,
271
+ $theme: theme
272
+ }, /*#__PURE__*/React__default.createElement("span", null, localeText === null || localeText === void 0 ? void 0 : localeText.emptyChartText)), /*#__PURE__*/React__default.createElement("svg", {
273
+ width: width,
274
+ height: height
275
+ }, /*#__PURE__*/React__default.createElement("g", {
276
+ transform: `translate(${margins.left},${margins.top})`
277
+ }, /*#__PURE__*/React__default.createElement(Axis, {
278
+ position: "bottom",
279
+ length: width - 32,
280
+ scale: scaleLinear().domain([]).range([0, chartWidth]),
281
+ x: 0,
282
+ y: height,
283
+ tickValues: 4
284
+ })))));
285
+ });
286
+
287
+ var definition = "Linear Scatter Plot with {circleLength} circles.";
288
+ var enUS = {
289
+ "interactive-chart": "Interactive Scatter Plot",
290
+ "static-chart": "Static Scatter Plot",
291
+ definition: definition,
292
+ "definition-with-categories": "Linear Scatter Plot with {categoryLength} categories and {circleLength} circles.",
293
+ "x-axis-definition": "The chart has {numAxis, plural, =0 {0 X axis} =1 {1 X axis} other {# X axes}} displaying numbers from {start, number} to {end, number}.",
294
+ "y-axis-definition": "The chart has {numAxis, plural, =0 {0 Y axis} =1 {1 Y axis} other {# Y axes}} displaying numbers from {start, number} to {end, number}."
295
+ };
296
+
297
+ var frFR = {
298
+ "interactive-chart": "Graphique en courbe interactif",
299
+ "static-chart": "Graphique en courbe statique",
300
+ "definition-linear": "Graphique en courbe contenant {circleLength} points répartis sur un axe linéraire.",
301
+ "definition-linear-with-categories": "Graphique en courbe contenant {categoryLength} courbes et {circleLength} points répartis sur un axe linéraire.",
302
+ "definition-ordinal": "Graphique en courbe contenant {circleLength} points.",
303
+ "x-axis-numbers-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des nombres allant de {start, number} à {end, number}.",
304
+ "y-axis-numbers-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des nombres allant de {start, number} à {end, number}.",
305
+ "x-axis-dates-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des dates allant de {start, date, ::yyyyMMdd} à {end, date, ::yyyyMMdd}.",
306
+ "y-axis-dates-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des dates allant de {start, date, ::yyyyMMdd} à {end, date, ::yyyyMMdd}.",
307
+ "x-axis-categories-definition": "Le graphique a {numAxis, plural, =0 {0 axe X} =1 {1 axe X} other {# axes X}} affichant des categories.",
308
+ "y-axis-categories-definition": "Le graphique a {numAxis, plural, =0 {0 axe Y} =1 {1 axe Y} other {# axes Y}} affichant des categories.",
309
+ "series-legend": "{category}, courbe {categoryIndex} sur {categoryLength} contenant {circleLength} points"
310
+ };
311
+
312
+ var intlMessages = {
313
+ 'en-US': enUS,
314
+ 'fr-FR': frFR
315
+ };
316
+
317
+ // Material Design Icons v7.2.96
318
+ var mdiChevronDown = "M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z";
319
+ var mdiChevronRight = "M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z";
320
+ var mdiMouse = "M11,1.07C7.05,1.56 4,4.92 4,9H11M4,15A8,8 0 0,0 12,23A8,8 0 0,0 20,15V11H4M13,1.07V9H20C20,4.92 16.94,1.56 13,1.07Z";
321
+
322
+ const _excluded$1 = ["isBrushable", "className", "data", "dotRole", "disableAnimations", "getDotAnchorProps", "hideControlKeyPanel", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onBrush", "onBrushEnd", "onDotClick", "size", "sortingMethod", "colorTheme", "tooltipDecorator", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "variant"],
323
+ _excluded2 = ["extraLegendItems"];
324
+ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
325
+ const {
326
+ isBrushable,
327
+ className,
328
+ data: propsData,
329
+ dotRole,
330
+ disableAnimations,
331
+ getDotAnchorProps,
332
+ hideControlKeyPanel,
333
+ id,
334
+ isDotSelected,
335
+ labelDecorator,
336
+ legendDecorator,
337
+ legendVariant,
338
+ legendProps,
339
+ margins: propsMargins,
340
+ onBrush,
341
+ onBrushEnd,
342
+ onDotClick,
343
+ size,
344
+ sortingMethod,
345
+ colorTheme,
346
+ tooltipDecorator,
347
+ tooltipVariant,
348
+ xAxisVariant,
349
+ xAxisPlacement,
350
+ xAxisTickFormat,
351
+ xAxisTickPadding,
352
+ xAxisTickRotation,
353
+ xAxisTickSize,
354
+ xAxisTickValues,
355
+ yAxisVariant,
356
+ yAxisPlacement,
357
+ yAxisTickFormat,
358
+ yAxisTickPadding,
359
+ yAxisTickRotation,
360
+ yAxisTickSize,
361
+ yAxisTickValues,
362
+ variant
363
+ } = props,
364
+ forwardedProps = _objectWithoutProperties(props, _excluded$1);
365
+ const cache = useRef();
366
+ const theme = useTheme();
367
+ const format = useMessageFormatter(intlMessages);
368
+ const data = propsData.filter(datum => datum.value && typeof datum.key[0] === 'number' && !Number.isNaN(datum.key[0]) && typeof datum.key[1] === 'number' && !Number.isNaN(datum.key[1]));
369
+ useEffect(() => {
370
+ cache.current = data;
371
+ });
372
+ const chartDimensions = sizeToDimension(size);
373
+ const width = chartDimensions.width;
374
+ const height = chartDimensions.height;
375
+ const margins = _objectSpread2({
376
+ top: xAxisVariant === AxisVariant.default || xAxisVariant === AxisVariant.tickValue ? 24 : 8,
377
+ left: yAxisVariant === AxisVariant.default || yAxisVariant === AxisVariant.tickValue ? 48 : 8,
378
+ right: yAxisVariant === AxisVariant.default || yAxisVariant === AxisVariant.tickValue ? 48 : 8,
379
+ bottom: xAxisVariant === AxisVariant.default || xAxisVariant === AxisVariant.tickValue ? 24 : 8
380
+ }, propsMargins);
381
+ const chartHeight = height - margins.top - margins.bottom;
382
+ const chartWidth = width - margins.left - margins.right;
383
+ const minSize = min([chartWidth, chartHeight]);
384
+ const extendedScaleX = (() => {
385
+ const domain = extent(data, d => d.key[0]);
386
+ const gap = domain[1] - domain[0];
387
+ domain[0] -= gap * 0.1;
388
+ domain[1] += gap * 0.1;
389
+ return scaleLinear().domain(domain).range([0, chartWidth]).nice();
390
+ })();
391
+ const extendedScaleY = (() => {
392
+ const domain = extent(data, d => d.key[1]);
393
+ const gap = domain[1] - domain[0];
394
+ domain[0] -= gap * 0.1;
395
+ domain[1] += gap * 0.1;
396
+ return scaleLinear().domain(domain).range([chartHeight, 0]).nice();
397
+ })();
398
+ const hasCategory = data[0] && data[0].key.length >= 3 && data[0].key[2] !== null && data[0].key[2] !== undefined;
399
+ const countsByCategory = hasCategory ? countBy(data, sortingMethod) : undefined;
400
+ const colorScale = useColor({
401
+ data: countsByCategory || data,
402
+ colorTheme: colorTheme,
403
+ category: 'key',
404
+ theme
405
+ });
406
+ const svgRef = useRef();
407
+ const brushRef = useRef();
408
+ const svgBrushRef = useRef();
409
+ const {
410
+ scaleX,
411
+ scaleY,
412
+ transform
413
+ } = useZoom({
414
+ svgRef,
415
+ scaleX: extendedScaleX,
416
+ scaleY: extendedScaleY,
417
+ size,
418
+ onZoom: () => {
419
+ if (brushRef.current && svgBrushRef.current) {
420
+ brushRef.current.clear(select(svgBrushRef.current));
421
+ onBrushEnd === null || onBrushEnd === void 0 ? void 0 : onBrushEnd(null);
422
+ }
423
+ }
424
+ });
425
+ useBrush({
426
+ brushRef,
427
+ svgRef: svgBrushRef,
428
+ extent: [[0, 0], [chartWidth, chartHeight]],
429
+ scaleX,
430
+ scaleY,
431
+ isBrushable,
432
+ isGridded: variant === ScatterPlotVariant.gridded,
433
+ onBrush,
434
+ onBrushEnd
435
+ });
436
+ const circles = variant === ScatterPlotVariant.gridded ? group(data, scaleX, scaleY).sort((a, b) => {
437
+ if (a.y !== b.y) {
438
+ return b.y - a.y;
439
+ }
440
+ if (a.x !== b.x) {
441
+ return a.x - b.x;
442
+ }
443
+ return descending(a.points.length, b.points.length);
444
+ }) : data.map(d => {
445
+ var _d$key$;
446
+ return {
447
+ category: (_d$key$ = d.key[2]) !== null && _d$key$ !== void 0 ? _d$key$ : 'default',
448
+ x: d.key[0],
449
+ y: d.key[1],
450
+ data: {
451
+ key: d.key,
452
+ value: 1
453
+ },
454
+ points: [d]
455
+ };
456
+ });
457
+ const globalSize = variant === ScatterPlotVariant.gridded ? scaleSqrt().domain([1, Math.max(max(circles, d => d.points.length), 1)]).range([3, minSize / BASE_NUMBER_OF_TICKS / 2]) : undefined;
458
+ const legendWidth = useRef();
459
+ if (countsByCategory && !legendWidth.current) {
460
+ legendWidth.current = `${Math.max(...countsByCategory.map(d => d.key.length + String(d.value).length)) * 8 + 32}px`;
461
+ }
462
+ const [isKeyPanelOpen, setIsKeyPanelOpen] = useState(false);
463
+ const categories = [];
464
+ // const pivotedTable = circles.reduce((acc, item) => {
465
+ // const { x, category, y } = item;
466
+ // if (!categories.includes(category)) {
467
+ // categories.push(category);
468
+ // }
469
+ // const formattedKey = xAxisTickFormat ? xAxisTickFormat(x as any) : x.toString();
470
+
471
+ // let entry = acc.find((e) => e.key === formattedKey);
472
+ // if (!entry) {
473
+ // entry = { key: formattedKey };
474
+ // acc.push(entry);
475
+ // }
476
+
477
+ // entry[category] = y;
478
+
479
+ // return acc;
480
+ // }, [] as Array<Record<string, string | number | null | undefined> & { key: string }>);
481
+
482
+ const _ref = legendProps || {},
483
+ {
484
+ extraLegendItems
485
+ } = _ref,
486
+ forwardedLegendProps = _objectWithoutProperties(_ref, _excluded2);
487
+ return /*#__PURE__*/React__default.createElement(StyledScatterPlot, _extends({
488
+ mode: typeof onDotClick === 'function' || typeof getDotAnchorProps === 'function' ? 'interactive' : 'static',
489
+ definition: hasCategory ? format('definition-with-categories', {
490
+ categoryLength: categories.length,
491
+ circleLength: circles.length
492
+ }) : format('definition', {
493
+ circleLength: circles.length
494
+ }),
495
+ xAxisDefinition: format('x-axis-definition', {
496
+ numAxis: xAxisPlacement === 'both' ? 2 : 1,
497
+ start: scaleX.domain()[0],
498
+ end: scaleX.domain()[1]
499
+ }),
500
+ yAxisDefinition: format('y-axis-definition', {
501
+ numAxis: yAxisPlacement === 'both' ? 2 : 1,
502
+ start: scaleY.domain()[0],
503
+ end: scaleY.domain()[1]
504
+ })
505
+ }, forwardedProps, {
506
+ id: id,
507
+ className: className,
508
+ ref: ref
509
+ }), /*#__PURE__*/React__default.createElement(Flexbox, {
510
+ flexDirection: "column",
511
+ alignItems: "center",
512
+ gap: "8"
513
+ }, !hideControlKeyPanel ? /*#__PURE__*/React__default.createElement(Flexbox, {
514
+ width: width,
515
+ position: "absolute"
516
+ }, /*#__PURE__*/React__default.createElement(Flexbox, {
517
+ flexDirection: "column",
518
+ alignItems: "flex-end",
519
+ position: "absolute",
520
+ top: `${margins.top + 16}px`,
521
+ right: `${margins.right + 16}px`
522
+ }, /*#__PURE__*/React__default.createElement(Popover, {
523
+ placement: "bottom-end",
524
+ isOpen: isKeyPanelOpen,
525
+ onOpen: setIsKeyPanelOpen
526
+ }, /*#__PURE__*/React__default.createElement(Popover.Trigger, null, /*#__PURE__*/React__default.createElement(Button, {
527
+ variant: "secondary",
528
+ leftIcon: mdiMouse,
529
+ rightIcon: isKeyPanelOpen ? mdiChevronDown : mdiChevronRight,
530
+ color: "grey",
531
+ style: {
532
+ border: '1px solid var(--redsift-color-neutral-mid-grey)',
533
+ gap: '4px'
534
+ }
535
+ })), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement(Flexbox, {
536
+ flexDirection: "column",
537
+ alignItems: "flex-start"
538
+ }, /*#__PURE__*/React__default.createElement(Text, {
539
+ margin: "8px 16px 0",
540
+ fontSize: "13px"
541
+ }, "Zoom - Mouse wheel"), /*#__PURE__*/React__default.createElement(Text, {
542
+ margin: "0 16px",
543
+ fontSize: "13px"
544
+ }, "Pan - Left click and drag"), /*#__PURE__*/React__default.createElement(Text, {
545
+ margin: "0 16px 8px",
546
+ fontSize: "13px"
547
+ }, "Select - Hold shift, left click and drag")))))) : null, /*#__PURE__*/React__default.createElement("svg", {
548
+ ref: svgRef,
549
+ width: width,
550
+ height: height
551
+ }, /*#__PURE__*/React__default.createElement("g", {
552
+ ref: svgBrushRef,
553
+ transform: `translate(${margins.left},${margins.top})`
554
+ }), /*#__PURE__*/React__default.createElement("g", {
555
+ transform: `translate(${margins.left},${margins.top})`
556
+ }, /*#__PURE__*/React__default.createElement("g", null, circles.map((circle, index) => {
557
+ var _countsByCategory$fin;
558
+ const scaleXDomain = scaleX.domain();
559
+ const scaleYDomain = scaleY.domain();
560
+ if (circle.x < scaleXDomain[0] || circle.x > scaleXDomain[1] || circle.y < scaleYDomain[0] || circle.y > scaleYDomain[1]) {
561
+ return null;
562
+ }
563
+ const to = _objectSpread2(_objectSpread2({}, circle), {}, {
564
+ data: _objectSpread2(_objectSpread2({}, circle.data), {}, {
565
+ percent: circle.category ? circle.data.value / (countsByCategory === null || countsByCategory === void 0 ? void 0 : (_countsByCategory$fin = countsByCategory.find(_ref2 => {
566
+ let {
567
+ key
568
+ } = _ref2;
569
+ return key === circle.category;
570
+ })) === null || _countsByCategory$fin === void 0 ? void 0 : _countsByCategory$fin.value) : undefined
571
+ }),
572
+ r: variant === ScatterPlotVariant.gridded ? globalSize(circle.points.length) / (transform.k < 1 ? transform.k : 1) : 4
573
+ });
574
+ return /*#__PURE__*/React__default.createElement(Dot, {
575
+ color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(circle.category),
576
+ data: to,
577
+ dataset: circles,
578
+ isSelected: Boolean(isDotSelected === null || isDotSelected === void 0 ? void 0 : isDotSelected(to)),
579
+ key: `circle _${index}`,
580
+ labelDecorator: labelDecorator,
581
+ onClick: onDotClick,
582
+ role: dotRole,
583
+ scaleX: scaleX,
584
+ scaleY: scaleY,
585
+ tooltipDecorator: tooltipDecorator,
586
+ tooltipVariant: tooltipVariant
587
+ });
588
+ }))), /*#__PURE__*/React__default.createElement("g", {
589
+ transform: `translate(${margins.left},${margins.top})`
590
+ }, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
591
+ disableAnimations: disableAnimations,
592
+ position: "bottom",
593
+ length: chartWidth,
594
+ scale: scaleX,
595
+ x: 0,
596
+ y: chartHeight,
597
+ tickValues: xAxisTickValues !== null && xAxisTickValues !== void 0 ? xAxisTickValues : 8,
598
+ tickPadding: xAxisTickPadding,
599
+ tickRotation: xAxisTickRotation,
600
+ tickSize: xAxisTickSize,
601
+ tickFormat: xAxisTickFormat,
602
+ variant: xAxisVariant
603
+ }) : null, ['top', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
604
+ disableAnimations: disableAnimations,
605
+ position: "top",
606
+ length: chartWidth,
607
+ scale: scaleX,
608
+ x: 0,
609
+ y: 0,
610
+ tickValues: xAxisTickValues !== null && xAxisTickValues !== void 0 ? xAxisTickValues : 8,
611
+ tickPadding: xAxisTickPadding,
612
+ tickRotation: xAxisTickRotation,
613
+ tickSize: xAxisTickSize,
614
+ tickFormat: xAxisTickFormat,
615
+ variant: xAxisVariant
616
+ }) : null, ['left', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
617
+ disableAnimations: disableAnimations,
618
+ position: "left",
619
+ length: chartHeight,
620
+ scale: scaleY,
621
+ x: 0,
622
+ y: chartHeight,
623
+ tickValues: yAxisTickValues !== null && yAxisTickValues !== void 0 ? yAxisTickValues : 8,
624
+ tickPadding: yAxisTickPadding,
625
+ tickRotation: yAxisTickRotation,
626
+ tickSize: yAxisTickSize,
627
+ tickFormat: yAxisTickFormat,
628
+ variant: yAxisVariant
629
+ }) : null, ['right', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
630
+ disableAnimations: disableAnimations,
631
+ position: "right",
632
+ length: chartHeight,
633
+ scale: scaleY,
634
+ x: chartWidth,
635
+ y: chartHeight,
636
+ tickValues: yAxisTickValues !== null && yAxisTickValues !== void 0 ? yAxisTickValues : 8,
637
+ tickPadding: yAxisTickPadding,
638
+ tickRotation: yAxisTickRotation,
639
+ tickSize: yAxisTickSize,
640
+ tickFormat: yAxisTickFormat,
641
+ variant: yAxisVariant
642
+ }) : null))), hasCategory && legendVariant !== ScatterPlotLegendVariant.none ? /*#__PURE__*/React__default.createElement(Legend, _extends({
643
+ data: (extraLegendItems ? mergeLegends(extraLegendItems, countsByCategory).sort(getSortingMethod(sortingMethod)) : countsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
644
+ color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
645
+ })),
646
+ variant: legendVariant === ScatterPlotLegendVariant.externalLabelValue ? LegendVariant.value : legendVariant === ScatterPlotLegendVariant.externalLabelPercent ? LegendVariant.percent : legendVariant === ScatterPlotLegendVariant.externalLabel ? LegendVariant.label : LegendVariant.custom,
647
+ width: legendWidth.current,
648
+ legendDecorator: legendDecorator ? (datum, props) => legendDecorator(datum, props) : undefined
649
+ }, forwardedLegendProps)) : null);
650
+ });
651
+
652
+ const _excluded = ["className", "colorTheme", "data", "dotRole", "emptyComponent", "hideControlKeyPanel", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onBrush", "onBrushEnd", "onDotClick", "size", "sortingMethod", "tooltipDecorator", "tooltipVariant", "variant", "xAxisPlacement", "xAxisVariant", "yAxisPlacement", "yAxisVariant"];
653
+ const COMPONENT_NAME = 'ScatterPlot';
654
+ const CLASSNAME = 'redsift-scatterplot';
655
+ const ScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
656
+ const {
657
+ className,
658
+ colorTheme = ColorTheme.default,
659
+ data: propsData,
660
+ dotRole,
661
+ emptyComponent,
662
+ hideControlKeyPanel = false,
663
+ id: propsId,
664
+ isDotSelected,
665
+ labelDecorator,
666
+ legendDecorator,
667
+ legendVariant: propsLegendVariant,
668
+ localeText = {
669
+ emptyChartText: 'No Data'
670
+ },
671
+ onBrush,
672
+ onBrushEnd,
673
+ onDotClick,
674
+ size = ChartSize.medium,
675
+ sortingMethod = 'desc-value',
676
+ tooltipDecorator,
677
+ tooltipVariant = TooltipVariant.none,
678
+ variant = ScatterPlotVariant.default,
679
+ xAxisPlacement = 'bottom',
680
+ xAxisVariant = AxisVariant.default,
681
+ yAxisPlacement = 'left',
682
+ yAxisVariant = AxisVariant.default
683
+ } = props,
684
+ forwardedProps = _objectWithoutProperties(props, _excluded);
685
+ const [_id] = useId();
686
+ const id = propsId !== null && propsId !== void 0 ? propsId : _id;
687
+ const legendVariant = propsLegendVariant !== null && propsLegendVariant !== void 0 ? propsLegendVariant : ScatterPlotLegendVariant.externalLabel;
688
+ if (propsData === undefined || propsData === null) {
689
+ return /*#__PURE__*/React__default.createElement(LoadingScatterPlot, _extends({
690
+ id: id
691
+ }, forwardedProps, {
692
+ ref: ref
693
+ }));
694
+ }
695
+ if (propsData.length === 0) {
696
+ return /*#__PURE__*/React__default.createElement(EmptyScatterPlot, _extends({
697
+ data: propsData,
698
+ emptyComponent: emptyComponent,
699
+ hideControlKeyPanel: hideControlKeyPanel,
700
+ localeText: localeText,
701
+ size: size,
702
+ sortingMethod: sortingMethod,
703
+ xAxisPlacement: xAxisPlacement,
704
+ xAxisVariant: xAxisVariant,
705
+ yAxisPlacement: yAxisPlacement,
706
+ yAxisVariant: yAxisVariant
707
+ }, forwardedProps, {
708
+ ref: ref
709
+ }));
710
+ }
711
+ return /*#__PURE__*/React__default.createElement(RenderedScatterPlot, _extends({
712
+ className: classNames(ScatterPlot.className, className),
713
+ colorTheme: colorTheme,
714
+ data: propsData,
715
+ dotRole: dotRole,
716
+ hideControlKeyPanel: hideControlKeyPanel,
717
+ id: id,
718
+ isDotSelected: isDotSelected,
719
+ labelDecorator: labelDecorator,
720
+ legendDecorator: legendDecorator,
721
+ legendVariant: legendVariant,
722
+ localeText: localeText,
723
+ onBrush: onBrush,
724
+ onBrushEnd: onBrushEnd,
725
+ onDotClick: onDotClick,
726
+ size: size,
727
+ sortingMethod: sortingMethod,
728
+ tooltipDecorator: tooltipDecorator,
729
+ tooltipVariant: tooltipVariant,
730
+ variant: variant,
731
+ xAxisPlacement: xAxisPlacement,
732
+ xAxisVariant: xAxisVariant,
733
+ yAxisPlacement: yAxisPlacement,
734
+ yAxisVariant: yAxisVariant
735
+ }, forwardedProps, {
736
+ ref: ref
737
+ }));
738
+ });
739
+ ScatterPlot.className = CLASSNAME;
740
+ ScatterPlot.displayName = COMPONENT_NAME;
741
+
742
+ export { ScatterPlot as S, useZoom as a, ScatterPlotVariant as b, ScatterPlotLegendVariant as c, StyledScatterPlot as d, StyledScatterPlotEmptyText as e, useBrush as u };
743
+ //# sourceMappingURL=ScatterPlot2.js.map