@semcore/d3-chart 17.0.0-prerelease.9 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1
- package/lib/cjs/Bubble.js +20 -15
- package/lib/cjs/Bubble.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yView.js +5 -5
- package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
- package/lib/cjs/component/Chart/AbstractChart.js +5 -17
- package/lib/cjs/component/Chart/AbstractChart.js.map +1 -1
- package/lib/cjs/component/Chart/CigaretteChart.js +197 -57
- package/lib/cjs/component/Chart/CigaretteChart.js.map +1 -1
- package/lib/cjs/component/Chart/CigaretteChart.type.js.map +1 -1
- package/lib/cjs/style/bubble.shadow.css +4 -0
- package/lib/cjs/utils.js +3 -2
- package/lib/cjs/utils.js.map +1 -1
- package/lib/es6/Bubble.js +20 -15
- package/lib/es6/Bubble.js.map +1 -1
- package/lib/es6/a11y/PlotA11yView.js +4 -3
- package/lib/es6/a11y/PlotA11yView.js.map +1 -1
- package/lib/es6/component/Chart/AbstractChart.js +5 -17
- package/lib/es6/component/Chart/AbstractChart.js.map +1 -1
- package/lib/es6/component/Chart/CigaretteChart.js +199 -59
- package/lib/es6/component/Chart/CigaretteChart.js.map +1 -1
- package/lib/es6/component/Chart/CigaretteChart.type.js.map +1 -1
- package/lib/es6/style/bubble.shadow.css +4 -0
- package/lib/es6/utils.js +3 -2
- package/lib/es6/utils.js.map +1 -1
- package/lib/esm/AnimatedClipPath.mjs +1 -1
- package/lib/esm/Area.mjs +2 -3
- package/lib/esm/Axis.mjs +4 -7
- package/lib/esm/Bar.mjs +1 -2
- package/lib/esm/Bubble.mjs +24 -21
- package/lib/esm/CompactHorizontalBar.mjs +4 -4
- package/lib/esm/Donut.mjs +5 -4
- package/lib/esm/Dots.mjs +1 -2
- package/lib/esm/HorizontalBar.mjs +1 -2
- package/lib/esm/Hover.mjs +2 -3
- package/lib/esm/Line.mjs +2 -3
- package/lib/esm/Pattern.mjs +6 -7
- package/lib/esm/Plot.mjs +3 -5
- package/lib/esm/Radar.mjs +7 -10
- package/lib/esm/RadialTree.mjs +17 -63
- package/lib/esm/Reference.mjs +0 -1
- package/lib/esm/ResponsiveContainer.mjs +3 -5
- package/lib/esm/ScatterPlot.mjs +2 -2
- package/lib/esm/StackBar.mjs +2 -2
- package/lib/esm/StackedArea.mjs +2 -2
- package/lib/esm/Tooltip.mjs +5 -8
- package/lib/esm/Venn.mjs +3 -3
- package/lib/esm/a11y/DataAccessibilityTable.mjs +2 -4
- package/lib/esm/a11y/PlotA11yModule.mjs +2 -2
- package/lib/esm/a11y/PlotA11yView.mjs +11 -19
- package/lib/esm/a11y/focus.mjs +2 -2
- package/lib/esm/a11y/hints.mjs +3 -3
- package/lib/esm/a11y/insights.mjs +15 -20
- package/lib/esm/a11y/intl.mjs +1 -1
- package/lib/esm/a11y/locale.mjs +1 -2
- package/lib/esm/a11y/serialize.mjs +17 -17
- package/lib/esm/component/Chart/AbstractChart.mjs +20 -34
- package/lib/esm/component/Chart/AreaChart.mjs +5 -4
- package/lib/esm/component/Chart/BarChart.mjs +4 -3
- package/lib/esm/component/Chart/BubbleChart.mjs +8 -8
- package/lib/esm/component/Chart/CigaretteChart.mjs +204 -64
- package/lib/esm/component/Chart/CompactHorizontalBarChart.mjs +2 -1
- package/lib/esm/component/Chart/DonutChart.mjs +3 -2
- package/lib/esm/component/Chart/HistogramChart.mjs +5 -4
- package/lib/esm/component/Chart/LineChart.mjs +5 -4
- package/lib/esm/component/Chart/RadarChart.mjs +4 -5
- package/lib/esm/component/Chart/ScatterPlotChart.mjs +3 -2
- package/lib/esm/component/Chart/VennChart.mjs +3 -3
- package/lib/esm/component/ChartLegend/BaseLegend.mjs +9 -14
- package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +1 -2
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +1 -2
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +2 -4
- package/lib/esm/component/ChartLegend/index.mjs +2 -0
- package/lib/esm/component/Cigarette/Cigarette.mjs +1 -2
- package/lib/esm/component/StackGroupBar/StackGroupBar.mjs +2 -3
- package/lib/esm/createElement.mjs +1 -1
- package/lib/esm/index.mjs +1 -0
- package/lib/esm/style/bubble.shadow.css +4 -0
- package/lib/esm/utils.mjs +3 -3
- package/lib/types/a11y/PlotA11yView.d.ts +1 -1
- package/lib/types/component/Chart/AbstractChart.d.ts +4 -7
- package/lib/types/component/Chart/CigaretteChart.type.d.ts +7 -4
- package/package.json +17 -17
package/lib/esm/RadialTree.mjs
CHANGED
|
@@ -9,7 +9,6 @@ import React from "react";
|
|
|
9
9
|
import createElement from "./createElement.mjs";
|
|
10
10
|
import { getPatternSymbolSize, PatternSymbol } from "./Pattern.mjs";
|
|
11
11
|
import { measureText, getChartDefaultColorName } from "./utils.mjs";
|
|
12
|
-
/*!__reshadow-styles__:"./style/radial-tree.shadow.css"*/
|
|
13
12
|
const style = (
|
|
14
13
|
/*__reshadow_css_start__*/
|
|
15
14
|
(sstyled.insert(
|
|
@@ -45,13 +44,12 @@ class RadialTreeBase extends Component {
|
|
|
45
44
|
};
|
|
46
45
|
}
|
|
47
46
|
runAppearAnimation() {
|
|
48
|
-
var _a;
|
|
49
47
|
const {
|
|
50
48
|
duration,
|
|
51
49
|
uid
|
|
52
50
|
} = this.asProps;
|
|
53
51
|
if (!canUseDOM()) return;
|
|
54
|
-
const preferReduceMotion =
|
|
52
|
+
const preferReduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)")?.matches;
|
|
55
53
|
if (!(duration > 0)) return;
|
|
56
54
|
if (preferReduceMotion) return;
|
|
57
55
|
const circlesAnimation = transition().selection().selectAll(`[data-radial-animation=${uid}-cap-circle]`).interrupt();
|
|
@@ -64,13 +62,12 @@ class RadialTreeBase extends Component {
|
|
|
64
62
|
const labelsNodes = linesAnimation.nodes();
|
|
65
63
|
if (circlesNodes.length > 0) {
|
|
66
64
|
const attrs = circlesNodes.map((node) => {
|
|
67
|
-
var _a2, _b, _c, _d;
|
|
68
65
|
const radianIndex = Number.parseInt(node.dataset.radianIndex, 10);
|
|
69
66
|
const lineNode = linesNodes[radianIndex];
|
|
70
67
|
return {
|
|
71
68
|
from: {
|
|
72
|
-
cx:
|
|
73
|
-
cy:
|
|
69
|
+
cx: lineNode.x1?.baseVal?.value,
|
|
70
|
+
cy: lineNode.y1?.baseVal?.value
|
|
74
71
|
},
|
|
75
72
|
to: {
|
|
76
73
|
cx: node.dataset["cx"],
|
|
@@ -78,31 +75,18 @@ class RadialTreeBase extends Component {
|
|
|
78
75
|
}
|
|
79
76
|
};
|
|
80
77
|
});
|
|
81
|
-
circlesAnimation.attr("opacity", 0).attr("cx", (_, index) =>
|
|
82
|
-
var _a2;
|
|
83
|
-
return (_a2 = attrs[index].from) == null ? void 0 : _a2.cx;
|
|
84
|
-
}).attr("cy", (_, index) => {
|
|
85
|
-
var _a2;
|
|
86
|
-
return (_a2 = attrs[index].from) == null ? void 0 : _a2.cy;
|
|
87
|
-
}).transition().duration(duration).attr("opacity", 1).attr("cx", (_, index) => {
|
|
88
|
-
var _a2;
|
|
89
|
-
return (_a2 = attrs[index].to) == null ? void 0 : _a2.cx;
|
|
90
|
-
}).attr("cy", (_, index) => {
|
|
91
|
-
var _a2;
|
|
92
|
-
return (_a2 = attrs[index].to) == null ? void 0 : _a2.cy;
|
|
93
|
-
});
|
|
78
|
+
circlesAnimation.attr("opacity", 0).attr("cx", (_, index) => attrs[index].from?.cx).attr("cy", (_, index) => attrs[index].from?.cy).transition().duration(duration).attr("opacity", 1).attr("cx", (_, index) => attrs[index].to?.cx).attr("cy", (_, index) => attrs[index].to?.cy);
|
|
94
79
|
}
|
|
95
80
|
if (iconsNodes.length > 0) {
|
|
96
81
|
const attrs = iconsNodes.map((node) => {
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
const height = (_d = (_c = node.height) == null ? void 0 : _c.baseVal) == null ? void 0 : _d.value;
|
|
82
|
+
const width = node.width?.baseVal?.value;
|
|
83
|
+
const height = node.height?.baseVal?.value;
|
|
100
84
|
const radianIndex = Number.parseInt(node.dataset.radianIndex, 10);
|
|
101
85
|
const lineNode = linesNodes[radianIndex];
|
|
102
86
|
return {
|
|
103
87
|
from: {
|
|
104
|
-
x:
|
|
105
|
-
y:
|
|
88
|
+
x: lineNode.x1?.baseVal?.value - width / 2,
|
|
89
|
+
y: lineNode.y1?.baseVal?.value - height / 2
|
|
106
90
|
},
|
|
107
91
|
to: {
|
|
108
92
|
x: node.dataset["x"],
|
|
@@ -110,27 +94,14 @@ class RadialTreeBase extends Component {
|
|
|
110
94
|
}
|
|
111
95
|
};
|
|
112
96
|
});
|
|
113
|
-
iconsAnimation.attr("opacity", 0).attr("x", (_, index) =>
|
|
114
|
-
var _a2;
|
|
115
|
-
return (_a2 = attrs[index].from) == null ? void 0 : _a2.x;
|
|
116
|
-
}).attr("y", (_, index) => {
|
|
117
|
-
var _a2;
|
|
118
|
-
return (_a2 = attrs[index].from) == null ? void 0 : _a2.y;
|
|
119
|
-
}).transition().duration(duration).attr("opacity", 1).attr("x", (_, index) => {
|
|
120
|
-
var _a2;
|
|
121
|
-
return (_a2 = attrs[index].to) == null ? void 0 : _a2.x;
|
|
122
|
-
}).attr("y", (_, index) => {
|
|
123
|
-
var _a2;
|
|
124
|
-
return (_a2 = attrs[index].to) == null ? void 0 : _a2.y;
|
|
125
|
-
});
|
|
97
|
+
iconsAnimation.attr("opacity", 0).attr("x", (_, index) => attrs[index].from?.x).attr("y", (_, index) => attrs[index].from?.y).transition().duration(duration).attr("opacity", 1).attr("x", (_, index) => attrs[index].to?.x).attr("y", (_, index) => attrs[index].to?.y);
|
|
126
98
|
}
|
|
127
99
|
if (linesNodes.length > 0) {
|
|
128
100
|
const attrs = linesNodes.map((node) => {
|
|
129
|
-
var _a2, _b, _c, _d;
|
|
130
101
|
return {
|
|
131
102
|
from: {
|
|
132
|
-
x2:
|
|
133
|
-
y2:
|
|
103
|
+
x2: node.x1?.baseVal?.value,
|
|
104
|
+
y2: node.y1?.baseVal?.value
|
|
134
105
|
},
|
|
135
106
|
to: {
|
|
136
107
|
x2: node.dataset["x2"],
|
|
@@ -138,19 +109,7 @@ class RadialTreeBase extends Component {
|
|
|
138
109
|
}
|
|
139
110
|
};
|
|
140
111
|
});
|
|
141
|
-
linesAnimation.attr("opacity", 0).attr("x2", (_, index) =>
|
|
142
|
-
var _a2;
|
|
143
|
-
return (_a2 = attrs[index].from) == null ? void 0 : _a2.x2;
|
|
144
|
-
}).attr("y2", (_, index) => {
|
|
145
|
-
var _a2;
|
|
146
|
-
return (_a2 = attrs[index].from) == null ? void 0 : _a2.y2;
|
|
147
|
-
}).transition().duration(duration).attr("opacity", 1).attr("x2", (_, index) => {
|
|
148
|
-
var _a2;
|
|
149
|
-
return (_a2 = attrs[index].to) == null ? void 0 : _a2.x2;
|
|
150
|
-
}).attr("y2", (_, index) => {
|
|
151
|
-
var _a2;
|
|
152
|
-
return (_a2 = attrs[index].to) == null ? void 0 : _a2.y2;
|
|
153
|
-
});
|
|
112
|
+
linesAnimation.attr("opacity", 0).attr("x2", (_, index) => attrs[index].from?.x2).attr("y2", (_, index) => attrs[index].from?.y2).transition().duration(duration).attr("opacity", 1).attr("x2", (_, index) => attrs[index].to?.x2).attr("y2", (_, index) => attrs[index].to?.y2);
|
|
154
113
|
}
|
|
155
114
|
if (labelsNodes.length > 0) {
|
|
156
115
|
labelsAnimation.attr("opacity", 0);
|
|
@@ -246,8 +205,7 @@ class RadialTreeRadian extends Component {
|
|
|
246
205
|
getInteractiveAreaProps({
|
|
247
206
|
$rootProps
|
|
248
207
|
}, index) {
|
|
249
|
-
|
|
250
|
-
const data = (_a = $rootProps.data) == null ? void 0 : _a[index];
|
|
208
|
+
const data = $rootProps.data?.[index];
|
|
251
209
|
const {
|
|
252
210
|
xStart,
|
|
253
211
|
yStart,
|
|
@@ -266,8 +224,7 @@ class RadialTreeRadian extends Component {
|
|
|
266
224
|
getLineProps({
|
|
267
225
|
$rootProps
|
|
268
226
|
}, index) {
|
|
269
|
-
|
|
270
|
-
const data = (_a = $rootProps.data) == null ? void 0 : _a[index];
|
|
227
|
+
const data = $rootProps.data?.[index];
|
|
271
228
|
const {
|
|
272
229
|
xStart,
|
|
273
230
|
yStart,
|
|
@@ -299,8 +256,7 @@ class RadialTreeRadian extends Component {
|
|
|
299
256
|
getCapProps({
|
|
300
257
|
$rootProps
|
|
301
258
|
}, index) {
|
|
302
|
-
|
|
303
|
-
const data = (_a = $rootProps.data) == null ? void 0 : _a[index];
|
|
259
|
+
const data = $rootProps.data?.[index];
|
|
304
260
|
const {
|
|
305
261
|
xEnd,
|
|
306
262
|
yEnd,
|
|
@@ -331,8 +287,7 @@ class RadialTreeRadian extends Component {
|
|
|
331
287
|
getIconProps({
|
|
332
288
|
$rootProps
|
|
333
289
|
}, index) {
|
|
334
|
-
|
|
335
|
-
const data = (_a = $rootProps.data) == null ? void 0 : _a[index];
|
|
290
|
+
const data = $rootProps.data?.[index];
|
|
336
291
|
const {
|
|
337
292
|
xEnd,
|
|
338
293
|
yEnd,
|
|
@@ -365,8 +320,7 @@ class RadialTreeRadian extends Component {
|
|
|
365
320
|
getLabelProps({
|
|
366
321
|
$rootProps
|
|
367
322
|
}, index) {
|
|
368
|
-
|
|
369
|
-
const data = (_a = $rootProps.data) == null ? void 0 : _a[index];
|
|
323
|
+
const data = $rootProps.data?.[index];
|
|
370
324
|
const {
|
|
371
325
|
xLabelCenter,
|
|
372
326
|
yLabelCenter,
|
package/lib/esm/Reference.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import createElement from "./createElement.mjs";
|
|
6
6
|
import { scaleOfBandwidth } from "./utils.mjs";
|
|
7
|
-
/*!__reshadow-styles__:"./style/reference.shadow.css"*/
|
|
8
7
|
const style = (
|
|
9
8
|
/*__reshadow_css_start__*/
|
|
10
9
|
(sstyled.insert(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import {
|
|
2
|
+
import { Component, sstyled, assignProps, createComponent } from "@semcore/core";
|
|
3
3
|
import { Box } from "@semcore/base-components";
|
|
4
4
|
import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
|
|
5
5
|
import fire from "@semcore/core/lib/utils/fire";
|
|
@@ -55,15 +55,13 @@ class ResponsiveContainerRoot extends Component {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
componentDidMount() {
|
|
58
|
-
var _a;
|
|
59
58
|
if (this.$container) {
|
|
60
|
-
|
|
59
|
+
this.observer?.observe(this.$container);
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
// TODO component did update ref?
|
|
64
63
|
componentWillUnmount() {
|
|
65
|
-
|
|
66
|
-
(_a = this.observer) == null ? void 0 : _a.disconnect();
|
|
64
|
+
this.observer?.disconnect();
|
|
67
65
|
}
|
|
68
66
|
render() {
|
|
69
67
|
var _ref = this.asProps, _ref2;
|
package/lib/esm/ScatterPlot.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { sstyled,
|
|
2
|
+
import { sstyled, Component, assignProps } from "@semcore/core";
|
|
3
3
|
import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
|
|
4
4
|
import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
5
5
|
import { transition } from "d3-transition";
|
|
@@ -8,7 +8,6 @@ import createElement from "./createElement.mjs";
|
|
|
8
8
|
import { PatternFill } from "./Pattern.mjs";
|
|
9
9
|
import Tooltip from "./Tooltip.mjs";
|
|
10
10
|
import { getScatterPlotRadius } from "./utils.mjs";
|
|
11
|
-
/*!__reshadow-styles__:"./style/scatterplot.shadow.css"*/
|
|
12
11
|
const style = (
|
|
13
12
|
/*__reshadow_css_start__*/
|
|
14
13
|
(sstyled.insert(
|
|
@@ -195,6 +194,7 @@ function ScatterPlotTooltip(props) {
|
|
|
195
194
|
}, _ref)
|
|
196
195
|
}));
|
|
197
196
|
}
|
|
197
|
+
;
|
|
198
198
|
const ScatterPlot = createElement(ScatterPlotRoot, {
|
|
199
199
|
Tooltip: [ScatterPlotTooltip, Tooltip._______childrenComponents]
|
|
200
200
|
});
|
package/lib/esm/StackBar.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import Bar, { MIN_HEIGHT } from "./Bar.mjs";
|
|
|
7
7
|
import createElement from "./createElement.mjs";
|
|
8
8
|
import HorizontalBar, { MIN_WIDTH } from "./HorizontalBar.mjs";
|
|
9
9
|
import { getChartDefaultColorName } from "./utils.mjs";
|
|
10
|
-
const DEFAULT_INSTANCE = Symbol("DEFAULT_INSTANCE");
|
|
11
|
-
const XY0 = Symbol("XY0");
|
|
10
|
+
const DEFAULT_INSTANCE = /* @__PURE__ */ Symbol("DEFAULT_INSTANCE");
|
|
11
|
+
const XY0 = /* @__PURE__ */ Symbol("XY0");
|
|
12
12
|
class StackBarRoot extends Component {
|
|
13
13
|
constructor(...args) {
|
|
14
14
|
super(...args);
|
package/lib/esm/StackedArea.mjs
CHANGED
|
@@ -6,8 +6,8 @@ import React from "react";
|
|
|
6
6
|
import Area from "./Area.mjs";
|
|
7
7
|
import createElement from "./createElement.mjs";
|
|
8
8
|
import { getChartDefaultColorName } from "./utils.mjs";
|
|
9
|
-
const DEFAULT_INSTANCE = Symbol("DEFAULT_INSTANCE");
|
|
10
|
-
const Y0 = Symbol("Y0");
|
|
9
|
+
const DEFAULT_INSTANCE = /* @__PURE__ */ Symbol("DEFAULT_INSTANCE");
|
|
10
|
+
const Y0 = /* @__PURE__ */ Symbol("Y0");
|
|
11
11
|
class StackedAreaRoot extends Component {
|
|
12
12
|
getSeries() {
|
|
13
13
|
const {
|
package/lib/esm/Tooltip.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { sstyled,
|
|
3
|
-
import {
|
|
2
|
+
import { sstyled, Component, assignProps } from "@semcore/core";
|
|
3
|
+
import { Popper, Box } from "@semcore/base-components";
|
|
4
4
|
import findComponent from "@semcore/core/lib/utils/findComponent";
|
|
5
5
|
import { useColorResolver } from "@semcore/core/lib/utils/use/useColorResolver";
|
|
6
6
|
import React from "react";
|
|
7
7
|
import createElement from "./createElement.mjs";
|
|
8
8
|
import { PatternSymbol } from "./Pattern.mjs";
|
|
9
9
|
import { getChartDefaultColorName } from "./utils.mjs";
|
|
10
|
-
/*!__reshadow-styles__:"./style/tooltip.shadow.css"*/
|
|
11
10
|
const style = (
|
|
12
11
|
/*__reshadow_css_start__*/
|
|
13
12
|
(sstyled.insert(
|
|
@@ -59,7 +58,7 @@ class TooltipRoot extends Component {
|
|
|
59
58
|
yIndex
|
|
60
59
|
} = this.state.tooltipProps;
|
|
61
60
|
const index = xIndex ?? yIndex;
|
|
62
|
-
onClick
|
|
61
|
+
onClick?.(index, e);
|
|
63
62
|
});
|
|
64
63
|
}
|
|
65
64
|
getTriggerProps() {
|
|
@@ -100,7 +99,6 @@ class TooltipRoot extends Component {
|
|
|
100
99
|
}), eventEmitter.subscribe(`setTooltipVisible_${plotId}`, (visible) => this.setState({
|
|
101
100
|
$visible: visible
|
|
102
101
|
})), eventEmitter.subscribe(`setTooltipPosition_${plotId}`, (x, y) => {
|
|
103
|
-
var _a;
|
|
104
102
|
this.virtualElementPosition.x = x;
|
|
105
103
|
this.virtualElementPosition.y = y;
|
|
106
104
|
if (this.virtualTriggerElement === null) {
|
|
@@ -123,7 +121,7 @@ class TooltipRoot extends Component {
|
|
|
123
121
|
left: x2
|
|
124
122
|
};
|
|
125
123
|
};
|
|
126
|
-
|
|
124
|
+
this.popper.current?.update();
|
|
127
125
|
}));
|
|
128
126
|
}
|
|
129
127
|
componentWillUnmount() {
|
|
@@ -159,10 +157,9 @@ class TooltipRoot extends Component {
|
|
|
159
157
|
popper,
|
|
160
158
|
setTrigger
|
|
161
159
|
}) => {
|
|
162
|
-
var _a;
|
|
163
160
|
this.setPopperTrigger = setTrigger;
|
|
164
161
|
this.popper = popper;
|
|
165
|
-
|
|
162
|
+
this.popper.current?.update();
|
|
166
163
|
return advancedMode ? /* @__PURE__ */ React.createElement(Children, null) : /* @__PURE__ */ React.createElement(React.Fragment, null, tag && /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
|
|
167
164
|
tag,
|
|
168
165
|
onClick: this.handleTriggerClick
|
package/lib/esm/Venn.mjs
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
import { sstyled,
|
|
3
|
+
import { sstyled, Component, assignProps } from "@semcore/core";
|
|
4
4
|
import { FadeInOut } from "@semcore/base-components";
|
|
5
5
|
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
6
6
|
import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
|
|
7
7
|
import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
8
|
-
import {
|
|
8
|
+
import { scaleSolution, normalizeSolution, venn, intersectionAreaPath } from "@upsetjs/venn.js";
|
|
9
9
|
import React from "react";
|
|
10
10
|
import createElement from "./createElement.mjs";
|
|
11
11
|
import { PatternFill } from "./Pattern.mjs";
|
|
12
12
|
import Tooltip from "./Tooltip.mjs";
|
|
13
13
|
import { getChartDefaultColorName } from "./utils.mjs";
|
|
14
|
-
/*!__reshadow-styles__:"./style/venn.shadow.css"*/
|
|
15
14
|
const style = (
|
|
16
15
|
/*__reshadow_css_start__*/
|
|
17
16
|
(sstyled.insert(
|
|
@@ -243,6 +242,7 @@ function VennTooltip(props) {
|
|
|
243
242
|
}, _ref)
|
|
244
243
|
}));
|
|
245
244
|
}
|
|
245
|
+
;
|
|
246
246
|
const Venn = createElement(VennRoot, {
|
|
247
247
|
Circle,
|
|
248
248
|
Intersection,
|
|
@@ -38,8 +38,7 @@ const DataAccessibilityTable = ({
|
|
|
38
38
|
return doublicated;
|
|
39
39
|
}, [keys, hints]);
|
|
40
40
|
const renderTitle = React.useCallback((dataKey) => {
|
|
41
|
-
|
|
42
|
-
const formatted = (_a = config.titlesFormatter) == null ? void 0 : _a.call(config, dataKey);
|
|
41
|
+
const formatted = config.titlesFormatter?.(dataKey);
|
|
43
42
|
if (formatted !== void 0) return formatted;
|
|
44
43
|
if (hints.titles.valuesAxes[dataKey]) return hints.titles.valuesAxes[dataKey];
|
|
45
44
|
if (!duplicatedBaseKeys[dataKey]) {
|
|
@@ -49,8 +48,7 @@ const DataAccessibilityTable = ({
|
|
|
49
48
|
return dataKey;
|
|
50
49
|
}, [data, hints, duplicatedBaseKeys, config]);
|
|
51
50
|
const formatValue = React.useCallback((value, row) => {
|
|
52
|
-
|
|
53
|
-
return ((_a = config.valuesFormatter) == null ? void 0 : _a.call(config, value, row)) ?? defaultValueFormatter(intl, value);
|
|
51
|
+
return config.valuesFormatter?.(value, row) ?? defaultValueFormatter(intl, value);
|
|
54
52
|
}, [intl, config]);
|
|
55
53
|
return /* @__PURE__ */ React.createElement("table", {
|
|
56
54
|
id: `${id}-data-table`,
|
|
@@ -5,7 +5,6 @@ import { Context, useI18n } from "@semcore/core/lib/utils/enhances/WithI18n";
|
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { normalizeLocale } from "./locale.mjs";
|
|
7
7
|
import { localizedMessages } from "./translations/module/__intergalactic-dynamic-locales.mjs";
|
|
8
|
-
/*!__reshadow-styles__:"../style/plotA11yModule.shadow.css"*/
|
|
9
8
|
const styles = (
|
|
10
9
|
/*__reshadow_css_start__*/
|
|
11
10
|
(sstyled.insert(
|
|
@@ -49,7 +48,8 @@ function PlotA11yModule(props) {
|
|
|
49
48
|
});
|
|
50
49
|
}, [plotA11yView, isOpened, loading, setLoading]);
|
|
51
50
|
if (plotA11yView) {
|
|
52
|
-
|
|
51
|
+
var _ref2;
|
|
52
|
+
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(plotA11yView.Component, _extends({}, props, {
|
|
53
53
|
onCloseHandler: () => {
|
|
54
54
|
setIsOpened(false);
|
|
55
55
|
setPlotA11yView(null);
|
|
@@ -8,7 +8,6 @@ import { makeDataSummarizationConfig } from "./hints.mjs";
|
|
|
8
8
|
import { getIntl } from "./intl.mjs";
|
|
9
9
|
import { summarize } from "./summarize.mjs";
|
|
10
10
|
import { localizedMessages } from "./translations/view/__intergalactic-dynamic-locales.mjs";
|
|
11
|
-
/*!__reshadow-styles__:"../style/plotA11yView.shadow.css"*/
|
|
12
11
|
const styles = (
|
|
13
12
|
/*__reshadow_css_start__*/
|
|
14
13
|
(sstyled.insert(
|
|
@@ -21,7 +20,7 @@ const styles = (
|
|
|
21
20
|
"__SPlotA11yView": "___SPlotA11yView_9ugu2_gg_"
|
|
22
21
|
})
|
|
23
22
|
);
|
|
24
|
-
|
|
23
|
+
function PlotA11yView({
|
|
25
24
|
id,
|
|
26
25
|
payload: providedData,
|
|
27
26
|
hints,
|
|
@@ -31,7 +30,7 @@ const PlotA11yView = ({
|
|
|
31
30
|
config: providedConfig,
|
|
32
31
|
locale,
|
|
33
32
|
onCloseHandler
|
|
34
|
-
})
|
|
33
|
+
}) {
|
|
35
34
|
var _ref = arguments[0], _ref2;
|
|
36
35
|
const SPlotA11yView = Box;
|
|
37
36
|
const translations = useAsyncI18nMessages(localizedMessages, locale);
|
|
@@ -42,22 +41,17 @@ const PlotA11yView = ({
|
|
|
42
41
|
const [summary, setSummary] = React.useState(null);
|
|
43
42
|
const [generatingSummary, setGeneratingSummary] = React.useState(true);
|
|
44
43
|
React.useEffect(() => {
|
|
45
|
-
|
|
46
|
-
(_a = rootRef.current) == null ? void 0 : _a.focus();
|
|
44
|
+
rootRef.current?.focus();
|
|
47
45
|
function focusOutHandler(event) {
|
|
48
|
-
var _a2;
|
|
49
46
|
if (event.relatedTarget === null) {
|
|
50
47
|
return requestIdleCallback(onCloseHandler);
|
|
51
48
|
}
|
|
52
49
|
if (!(event.relatedTarget instanceof HTMLElement)) return;
|
|
53
|
-
if (
|
|
50
|
+
if (rootRef.current?.contains(event.relatedTarget)) return;
|
|
54
51
|
requestIdleCallback(onCloseHandler);
|
|
55
52
|
}
|
|
56
|
-
|
|
57
|
-
return () =>
|
|
58
|
-
var _a2;
|
|
59
|
-
return (_a2 = rootRef.current) == null ? void 0 : _a2.removeEventListener("focusout", focusOutHandler);
|
|
60
|
-
};
|
|
53
|
+
rootRef.current?.addEventListener("focusout", focusOutHandler);
|
|
54
|
+
return () => rootRef.current?.removeEventListener("focusout", focusOutHandler);
|
|
61
55
|
}, []);
|
|
62
56
|
React.useEffect(() => {
|
|
63
57
|
if (config.disable) {
|
|
@@ -78,15 +72,13 @@ const PlotA11yView = ({
|
|
|
78
72
|
const handleClose = React.useCallback(() => {
|
|
79
73
|
onCloseHandler();
|
|
80
74
|
requestIdleCallback(() => {
|
|
81
|
-
|
|
82
|
-
(_a = triggerRef.current) == null ? void 0 : _a.focus();
|
|
75
|
+
triggerRef.current?.focus();
|
|
83
76
|
});
|
|
84
77
|
}, []);
|
|
85
78
|
const handleSkip = React.useCallback((event) => {
|
|
86
|
-
var _a;
|
|
87
79
|
event.preventDefault();
|
|
88
80
|
if (!plotRef.current) return;
|
|
89
|
-
|
|
81
|
+
heavyFindNextFocusableElement(plotRef.current)?.focus();
|
|
90
82
|
onCloseHandler();
|
|
91
83
|
}, []);
|
|
92
84
|
const handleSkipKeyboard = React.useCallback((event) => {
|
|
@@ -94,9 +86,8 @@ const PlotA11yView = ({
|
|
|
94
86
|
handleSkip(event);
|
|
95
87
|
}, [handleSkip]);
|
|
96
88
|
const handleGoToTable = React.useCallback((event) => {
|
|
97
|
-
var _a;
|
|
98
89
|
event.preventDefault();
|
|
99
|
-
|
|
90
|
+
dataTableRef.current?.focus();
|
|
100
91
|
}, []);
|
|
101
92
|
const handleGoToTableKeyboard = React.useCallback((event) => {
|
|
102
93
|
if (!(event.key === "Enter" || event.key === " ")) return;
|
|
@@ -164,7 +155,8 @@ const PlotA11yView = ({
|
|
|
164
155
|
"config": config,
|
|
165
156
|
"intl": intl
|
|
166
157
|
})));
|
|
167
|
-
}
|
|
158
|
+
}
|
|
159
|
+
;
|
|
168
160
|
export {
|
|
169
161
|
PlotA11yView
|
|
170
162
|
};
|
package/lib/esm/a11y/focus.mjs
CHANGED
|
@@ -3,7 +3,7 @@ const findNextFocusableElementInChildren = (element) => {
|
|
|
3
3
|
if (element && isFocusable(element)) {
|
|
4
4
|
return element;
|
|
5
5
|
}
|
|
6
|
-
const children = element
|
|
6
|
+
const children = element?.children;
|
|
7
7
|
if (children) {
|
|
8
8
|
for (let i = 0; i < children.length; i++) {
|
|
9
9
|
const childChild = children.item(i);
|
|
@@ -27,7 +27,7 @@ const heavyFindNextFocusableElement = (base) => {
|
|
|
27
27
|
const parents = makeParentsChain(base);
|
|
28
28
|
for (let i = 0; i < parents.length; i++) {
|
|
29
29
|
const parent = parents[i];
|
|
30
|
-
let siblings = Array.from(
|
|
30
|
+
let siblings = Array.from(parent?.children ?? []);
|
|
31
31
|
if (siblings.indexOf(parents[i - 1] || base) !== -1) {
|
|
32
32
|
siblings = siblings.slice(siblings.indexOf(parents[i - 1] || base) + 1);
|
|
33
33
|
}
|
package/lib/esm/a11y/hints.mjs
CHANGED
|
@@ -99,15 +99,15 @@ const makeDataSummarizationConfig = (config) => ({
|
|
|
99
99
|
weak: 1 / 10,
|
|
100
100
|
medium: 1 / 5,
|
|
101
101
|
strong: Number.POSITIVE_INFINITY,
|
|
102
|
-
...
|
|
102
|
+
...config?.trendTangens ?? {}
|
|
103
103
|
},
|
|
104
104
|
movingAverage: {
|
|
105
105
|
longSize: void 0,
|
|
106
106
|
shortSize: void 0,
|
|
107
107
|
notableDiff: void 0,
|
|
108
|
-
...
|
|
108
|
+
...config?.movingAverage ?? {}
|
|
109
109
|
},
|
|
110
|
-
additionalFields: [...
|
|
110
|
+
additionalFields: [...config?.additionalFields ?? []]
|
|
111
111
|
});
|
|
112
112
|
export {
|
|
113
113
|
makeDataHintsContainer,
|
|
@@ -24,7 +24,6 @@ const movingAverage = (data, frame) => {
|
|
|
24
24
|
return result;
|
|
25
25
|
};
|
|
26
26
|
const extractDataInsights = (data, hints, config) => {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
28
27
|
let insights = [];
|
|
29
28
|
let dataType = config.dataType ?? hints.dataType;
|
|
30
29
|
const dataRange = [];
|
|
@@ -66,8 +65,8 @@ const extractDataInsights = (data, hints, config) => {
|
|
|
66
65
|
entitiesCount = Object.keys(valuesKeys).length;
|
|
67
66
|
const fromKey = firstRow[labelsKey];
|
|
68
67
|
const toKey = lastRow[labelsKey];
|
|
69
|
-
const from =
|
|
70
|
-
const to =
|
|
68
|
+
const from = hints.titles.getHorizontalAxesTitle?.(fromKey) ?? hints.titles.horizontalAxes[fromKey] ?? fromKey;
|
|
69
|
+
const to = hints.titles.getHorizontalAxesTitle?.(toKey) ?? hints.titles.horizontalAxes[toKey] ?? toKey;
|
|
71
70
|
if (entitiesCount > 0) {
|
|
72
71
|
dataRange.push({
|
|
73
72
|
from,
|
|
@@ -115,10 +114,9 @@ const extractDataInsights = (data, hints, config) => {
|
|
|
115
114
|
label,
|
|
116
115
|
type
|
|
117
116
|
}) => {
|
|
118
|
-
var _a2, _b2;
|
|
119
117
|
for (let i = 0; i < trendStrengths.length; i++) {
|
|
120
|
-
const normalizedHeight = Math.abs(value.from - value.to) / (
|
|
121
|
-
const normalizedWidth = width / (
|
|
118
|
+
const normalizedHeight = Math.abs(value.from - value.to) / (hints.pointsDensity?.verticalAxes ?? 1);
|
|
119
|
+
const normalizedWidth = width / (hints.pointsDensity?.horizontalAxes ?? 1);
|
|
122
120
|
const tang = normalizedHeight / normalizedWidth;
|
|
123
121
|
const trendStrength = trendStrengths[i];
|
|
124
122
|
if (tang <= config.trendTangens[trendStrength] || i === trendStrengths.length - 1) {
|
|
@@ -169,8 +167,8 @@ const extractDataInsights = (data, hints, config) => {
|
|
|
169
167
|
i = Math.min(i, data.length - 1);
|
|
170
168
|
const fromKey2 = data[lastSwitch][labelsKey];
|
|
171
169
|
const toKey2 = data[i][labelsKey];
|
|
172
|
-
const from2 =
|
|
173
|
-
const to2 =
|
|
170
|
+
const from2 = hints.titles.getHorizontalAxesTitle?.(fromKey2) ?? hints.titles.horizontalAxes[fromKey2] ?? fromKey2;
|
|
171
|
+
const to2 = hints.titles.getHorizontalAxesTitle?.(toKey2) ?? hints.titles.horizontalAxes[toKey2] ?? toKey2;
|
|
174
172
|
localTrends.push(recordTrend({
|
|
175
173
|
type: "trend",
|
|
176
174
|
value: {
|
|
@@ -284,7 +282,7 @@ const extractDataInsights = (data, hints, config) => {
|
|
|
284
282
|
for (const yNeighbour of [y - 1, y, y + 1]) {
|
|
285
283
|
if (xNeighbour === void 0 || yNeighbour === void 0) continue;
|
|
286
284
|
if (xNeighbour === x && yNeighbour === y) continue;
|
|
287
|
-
if (!
|
|
285
|
+
if (!grid[xNeighbour]?.[yNeighbour]) continue;
|
|
288
286
|
pointHandled = true;
|
|
289
287
|
grid[x][y].clusterId = grid[xNeighbour][yNeighbour].clusterId;
|
|
290
288
|
break;
|
|
@@ -386,7 +384,8 @@ const extractDataInsights = (data, hints, config) => {
|
|
|
386
384
|
x: 1,
|
|
387
385
|
y: 1
|
|
388
386
|
}], {
|
|
389
|
-
width: 1
|
|
387
|
+
width: 1,
|
|
388
|
+
height: 1
|
|
390
389
|
});
|
|
391
390
|
for (const clustersInsight of clustersInsights) {
|
|
392
391
|
const {
|
|
@@ -430,7 +429,7 @@ const extractDataInsights = (data, hints, config) => {
|
|
|
430
429
|
const key = allRowsIds[i];
|
|
431
430
|
const groupKeyValue = getPropByPath(row, groupKeys[0]);
|
|
432
431
|
groupedValues[key] = groupedValues[key] ?? {
|
|
433
|
-
groupName:
|
|
432
|
+
groupName: hints.titles.getHorizontalAxesTitle?.(groupKeyValue) ?? groupKeyValue,
|
|
434
433
|
rows: []
|
|
435
434
|
};
|
|
436
435
|
groupedValues[key].rows.push(row);
|
|
@@ -442,12 +441,11 @@ const extractDataInsights = (data, hints, config) => {
|
|
|
442
441
|
}
|
|
443
442
|
fields = fields.filter((key) => !grouppingKeys[key]);
|
|
444
443
|
const groups = Object.entries(groupedValues).map(([groupKey, group]) => {
|
|
445
|
-
var _a2, _b2;
|
|
446
444
|
const values = [];
|
|
447
445
|
for (const row of group.rows) {
|
|
448
446
|
for (const field of fields) {
|
|
449
447
|
values.push({
|
|
450
|
-
label: hints.titles.valuesAxes[field] ??
|
|
448
|
+
label: hints.titles.valuesAxes[field] ?? hints.titles.getVerticalAxesTitle?.(field) ?? field,
|
|
451
449
|
value: getPropByPath(row, field)
|
|
452
450
|
});
|
|
453
451
|
}
|
|
@@ -483,13 +481,10 @@ const extractDataInsights = (data, hints, config) => {
|
|
|
483
481
|
if (fields.length === 0) {
|
|
484
482
|
fields.push(...Object.keys(keysMap));
|
|
485
483
|
}
|
|
486
|
-
const values = fields.map((field) => {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
value: getPropByPath(data, field)
|
|
491
|
-
};
|
|
492
|
-
});
|
|
484
|
+
const values = fields.map((field) => ({
|
|
485
|
+
label: hints.titles.valuesAxes[field] ?? hints.titles.getValueAxesTitle?.(field) ?? field,
|
|
486
|
+
value: getPropByPath(data, field)
|
|
487
|
+
}));
|
|
493
488
|
entitiesCount = values.length;
|
|
494
489
|
values.sort((a, b) => {
|
|
495
490
|
if (typeof a.value !== "number" || typeof b.value !== "number") return 0;
|
package/lib/esm/a11y/intl.mjs
CHANGED
package/lib/esm/a11y/locale.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
const normalizeLocale = (providedLocale, translations = {}) => {
|
|
2
|
-
var _a;
|
|
3
2
|
const translationNames = {};
|
|
4
3
|
for (const locale2 in translations) {
|
|
5
4
|
translationNames[locale2.toLowerCase()] = locale2;
|
|
6
5
|
}
|
|
7
|
-
providedLocale = providedLocale ?? isAvailableLocale(
|
|
6
|
+
providedLocale = providedLocale ?? isAvailableLocale(globalThis?.navigator?.language, translations) ?? "en";
|
|
8
7
|
let locale = providedLocale.toLowerCase();
|
|
9
8
|
if (locale.includes("-") && !translations[locale]) {
|
|
10
9
|
const [localeBase] = locale.split("-");
|