@semcore/d3-chart 3.60.0 → 3.60.1
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 +6 -0
- package/lib/cjs/Area.js +14 -12
- package/lib/cjs/Area.js.map +1 -1
- package/lib/cjs/Axis.js +17 -15
- package/lib/cjs/Axis.js.map +1 -1
- package/lib/cjs/Bar.js +19 -17
- package/lib/cjs/Bar.js.map +1 -1
- package/lib/cjs/Bubble.js +15 -13
- package/lib/cjs/Bubble.js.map +1 -1
- package/lib/cjs/CompactHorizontalBar.js +19 -17
- package/lib/cjs/CompactHorizontalBar.js.map +1 -1
- package/lib/cjs/Donut.js +12 -10
- package/lib/cjs/Donut.js.map +1 -1
- package/lib/cjs/Dots.js +11 -9
- package/lib/cjs/Dots.js.map +1 -1
- package/lib/cjs/HorizontalBar.js +19 -17
- package/lib/cjs/HorizontalBar.js.map +1 -1
- package/lib/cjs/Hover.js +6 -4
- package/lib/cjs/Hover.js.map +1 -1
- package/lib/cjs/Line.js +12 -10
- package/lib/cjs/Line.js.map +1 -1
- package/lib/cjs/Plot.js +6 -4
- package/lib/cjs/Plot.js.map +1 -1
- package/lib/cjs/Radar.js +22 -20
- package/lib/cjs/Radar.js.map +1 -1
- package/lib/cjs/RadialTree.js +15 -13
- package/lib/cjs/RadialTree.js.map +1 -1
- package/lib/cjs/Reference.js +15 -13
- package/lib/cjs/Reference.js.map +1 -1
- package/lib/cjs/ScatterPlot.js +12 -10
- package/lib/cjs/ScatterPlot.js.map +1 -1
- package/lib/cjs/Tooltip.js +12 -10
- package/lib/cjs/Tooltip.js.map +1 -1
- package/lib/cjs/Venn.js +12 -10
- package/lib/cjs/Venn.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yModule.js +5 -3
- package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yView.js +5 -3
- package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +7 -5
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +20 -18
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +9 -7
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
- package/lib/es6/Area.js +14 -12
- package/lib/es6/Area.js.map +1 -1
- package/lib/es6/Axis.js +17 -15
- package/lib/es6/Axis.js.map +1 -1
- package/lib/es6/Bar.js +19 -17
- package/lib/es6/Bar.js.map +1 -1
- package/lib/es6/Bubble.js +15 -13
- package/lib/es6/Bubble.js.map +1 -1
- package/lib/es6/CompactHorizontalBar.js +19 -17
- package/lib/es6/CompactHorizontalBar.js.map +1 -1
- package/lib/es6/Donut.js +12 -10
- package/lib/es6/Donut.js.map +1 -1
- package/lib/es6/Dots.js +11 -9
- package/lib/es6/Dots.js.map +1 -1
- package/lib/es6/HorizontalBar.js +19 -17
- package/lib/es6/HorizontalBar.js.map +1 -1
- package/lib/es6/Hover.js +6 -4
- package/lib/es6/Hover.js.map +1 -1
- package/lib/es6/Line.js +12 -10
- package/lib/es6/Line.js.map +1 -1
- package/lib/es6/Plot.js +6 -4
- package/lib/es6/Plot.js.map +1 -1
- package/lib/es6/Radar.js +22 -20
- package/lib/es6/Radar.js.map +1 -1
- package/lib/es6/RadialTree.js +15 -13
- package/lib/es6/RadialTree.js.map +1 -1
- package/lib/es6/Reference.js +15 -13
- package/lib/es6/Reference.js.map +1 -1
- package/lib/es6/ScatterPlot.js +12 -10
- package/lib/es6/ScatterPlot.js.map +1 -1
- package/lib/es6/Tooltip.js +12 -10
- package/lib/es6/Tooltip.js.map +1 -1
- package/lib/es6/Venn.js +12 -10
- package/lib/es6/Venn.js.map +1 -1
- package/lib/es6/a11y/PlotA11yModule.js +5 -3
- package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
- package/lib/es6/a11y/PlotA11yView.js +5 -3
- package/lib/es6/a11y/PlotA11yView.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +7 -5
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +20 -18
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +9 -7
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
- package/lib/esm/AnimatedClipPath.mjs +54 -0
- package/lib/esm/Area.mjs +189 -0
- package/lib/esm/Axis.mjs +406 -0
- package/lib/esm/Bar.mjs +201 -0
- package/lib/esm/Bubble.mjs +216 -0
- package/lib/esm/CompactHorizontalBar.mjs +518 -0
- package/lib/esm/Donut.mjs +415 -0
- package/lib/esm/Dots.mjs +120 -0
- package/lib/esm/GroupBar.mjs +94 -0
- package/lib/esm/HorizontalBar.mjs +181 -0
- package/lib/esm/Hover.mjs +217 -0
- package/lib/esm/Line.mjs +199 -0
- package/lib/esm/Pattern.mjs +520 -0
- package/lib/esm/Plot.mjs +137 -0
- package/lib/esm/Radar.mjs +706 -0
- package/lib/esm/RadialTree.mjs +565 -0
- package/lib/esm/Reference.mjs +243 -0
- package/lib/esm/ResponsiveContainer.mjs +99 -0
- package/lib/esm/ScatterPlot.mjs +194 -0
- package/lib/esm/StackBar.mjs +177 -0
- package/lib/esm/StackedArea.mjs +84 -0
- package/lib/esm/Tooltip.mjs +255 -0
- package/lib/esm/Venn.mjs +234 -0
- package/lib/esm/a11y/DataAccessibilityTable.mjs +100 -0
- package/lib/esm/a11y/PlotA11yModule.mjs +117 -0
- package/lib/esm/a11y/PlotA11yView.mjs +146 -0
- package/lib/esm/a11y/bezier.mjs +32 -0
- package/lib/esm/a11y/focus.mjs +44 -0
- package/lib/esm/a11y/hints.mjs +122 -0
- package/lib/esm/a11y/insights.mjs +700 -0
- package/lib/esm/a11y/intl.mjs +17 -0
- package/lib/esm/a11y/locale.mjs +39 -0
- package/lib/esm/a11y/serialize.mjs +363 -0
- package/lib/esm/a11y/summarize.mjs +14 -0
- package/lib/esm/a11y/translations/module/__intergalactic-dynamic-locales.mjs +33 -0
- package/lib/esm/a11y/translations/module/de.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/en.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/es.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/fr.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/it.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/ja.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/ko.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/nl.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/pl.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/pt.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/sv.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/tr.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/vi.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/zh.json.mjs +14 -0
- package/lib/esm/a11y/translations/view/__intergalactic-dynamic-locales.mjs +33 -0
- package/lib/esm/a11y/translations/view/de.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/en.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/es.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/fr.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/it.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/ja.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/ko.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/nl.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/pl.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/pt.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/sv.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/tr.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/vi.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/zh.json.mjs +48 -0
- package/lib/esm/color.mjs +127 -0
- package/lib/esm/component/Chart/AbstractChart.mjs +408 -0
- package/lib/esm/component/Chart/AreaChart.mjs +145 -0
- package/lib/esm/component/Chart/BarChart.mjs +240 -0
- package/lib/esm/component/Chart/BubbleChart.mjs +135 -0
- package/lib/esm/component/Chart/CigaretteChart.mjs +294 -0
- package/lib/esm/component/Chart/CompactHorizontalBarChart.mjs +113 -0
- package/lib/esm/component/Chart/DonutChart.mjs +113 -0
- package/lib/esm/component/Chart/HistogramChart.mjs +166 -0
- package/lib/esm/component/Chart/LineChart.mjs +131 -0
- package/lib/esm/component/Chart/RadarChart.mjs +115 -0
- package/lib/esm/component/Chart/ScatterPlotChart.mjs +144 -0
- package/lib/esm/component/Chart/VennChart.mjs +141 -0
- package/lib/esm/component/Chart/index.mjs +27 -0
- package/lib/esm/component/ChartLegend/BaseLegend.mjs +91 -0
- package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +86 -0
- package/lib/esm/component/ChartLegend/LegendFlex/legend-flex.shadow.css +12 -0
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +240 -0
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.type.mjs +4 -0
- package/lib/esm/component/ChartLegend/LegendItem/legend-item.shadow.css +129 -0
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +90 -0
- package/lib/esm/component/ChartLegend/LegendTable/legend-table.shadow.css +19 -0
- package/lib/esm/component/ChartLegend/index.mjs +5 -0
- package/lib/esm/component/Cigarette/Cigarette.mjs +139 -0
- package/lib/esm/component/StackGroupBar/StackGroupBar.mjs +141 -0
- package/lib/esm/createElement.mjs +104 -0
- package/lib/esm/index.mjs +70 -0
- package/lib/esm/style/area.shadow.css +50 -0
- package/lib/esm/style/axis.shadow.css +88 -0
- package/lib/esm/style/bar.shadow.css +66 -0
- package/lib/esm/style/bubble.shadow.css +64 -0
- package/lib/esm/style/donut.shadow.css +36 -0
- package/lib/esm/style/dot.shadow.css +27 -0
- package/lib/esm/style/hover.shadow.css +9 -0
- package/lib/esm/style/line.shadow.css +43 -0
- package/lib/esm/style/plot.shadow.css +19 -0
- package/lib/esm/style/plotA11yModule.shadow.css +12 -0
- package/lib/esm/style/plotA11yView.shadow.css +39 -0
- package/lib/esm/style/radar.shadow.css +80 -0
- package/lib/esm/style/radial-tree.shadow.css +54 -0
- package/lib/esm/style/reference.shadow.css +43 -0
- package/lib/esm/style/scatterplot.shadow.css +41 -0
- package/lib/esm/style/tooltip.shadow.css +42 -0
- package/lib/esm/style/venn.shadow.css +48 -0
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +31 -0
- package/lib/esm/translations/en.json.mjs +12 -0
- package/lib/esm/translations/es.json.mjs +11 -0
- package/lib/esm/translations/fr.json.mjs +11 -0
- package/lib/esm/translations/it.json.mjs +11 -0
- package/lib/esm/translations/ja.json.mjs +11 -0
- package/lib/esm/translations/ko.json.mjs +11 -0
- package/lib/esm/translations/nl.json.mjs +11 -0
- package/lib/esm/translations/pl.json.mjs +11 -0
- package/lib/esm/translations/pt.json.mjs +11 -0
- package/lib/esm/translations/sv.json.mjs +11 -0
- package/lib/esm/translations/tr.json.mjs +11 -0
- package/lib/esm/translations/vi.json.mjs +11 -0
- package/lib/esm/translations/zh.json.mjs +11 -0
- package/lib/esm/utils.mjs +266 -0
- package/package.json +11 -11
- package/vite.config.ts +2 -0
package/lib/esm/Venn.mjs
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
7
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
9
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
10
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
11
|
+
import { Component, sstyled as sstyled$1, assignProps } from "@semcore/core";
|
|
12
|
+
import React from "react";
|
|
13
|
+
import { scaleSolution, normalizeSolution, venn, intersectionAreaPath } from "@upsetjs/venn.js";
|
|
14
|
+
import canUseDOM from "@semcore/utils/lib/canUseDOM";
|
|
15
|
+
import { FadeInOut } from "@semcore/animation";
|
|
16
|
+
import createElement from "./createElement.mjs";
|
|
17
|
+
import { getChartDefaultColorName } from "./utils.mjs";
|
|
18
|
+
import Tooltip from "./Tooltip.mjs";
|
|
19
|
+
import { PatternFill } from "./Pattern.mjs";
|
|
20
|
+
import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
|
|
21
|
+
/*!__reshadow-styles__:"./style/venn.shadow.css"*/
|
|
22
|
+
var style = (
|
|
23
|
+
/*__reshadow_css_start__*/
|
|
24
|
+
(sstyled.insert(
|
|
25
|
+
/*__inner_css_start__*/
|
|
26
|
+
".___SCircle_x7in0_gg_,.___SIntersection_x7in0_gg_{stroke:var(--intergalactic-chart-grid-border, #ffffff);stroke-width:2px}.___SCircle_x7in0_gg_{fill:var(--intergalactic-chart-palette-order-2, #59ddaa);fill-opacity:.5;transition-property:cx,cy;transition-duration:var(--duration_x7in0);transition-timing-function:ease-in-out}@media (hover:hover){.___SCircle_x7in0_gg_:hover{fill-opacity:.7}}.___SCircle_x7in0_gg_.__color_x7in0_gg_{fill:var(--color_x7in0)}.___SCircle_x7in0_gg_.__pattern_x7in0_gg_.__color_x7in0_gg_{fill:var(--pattern_x7in0);fill-opacity:.7;stroke:var(--color_x7in0);stroke-width:1px}@media (hover:hover){.___SCircle_x7in0_gg_.__pattern_x7in0_gg_.__color_x7in0_gg_:hover{fill-opacity:.85}}.___SCircle_x7in0_gg_.__transparent_x7in0_gg_{opacity:.3}.___SIntersection_x7in0_gg_{fill-opacity:0}@media (hover:hover){.___SIntersection_x7in0_gg_:hover{fill-opacity:.1}}.___SIntersection_x7in0_gg_.__transparent_x7in0_gg_{opacity:.3}",
|
|
27
|
+
/*__inner_css_end__*/
|
|
28
|
+
"x7in0_gg_"
|
|
29
|
+
), /*__reshadow_css_end__*/
|
|
30
|
+
{
|
|
31
|
+
"__SCircle": "___SCircle_x7in0_gg_",
|
|
32
|
+
"_color": "__color_x7in0_gg_",
|
|
33
|
+
"--color": "--color_x7in0",
|
|
34
|
+
"_transparent": "__transparent_x7in0_gg_",
|
|
35
|
+
"__SIntersection": "___SIntersection_x7in0_gg_",
|
|
36
|
+
"--duration": "--duration_x7in0",
|
|
37
|
+
"_pattern": "__pattern_x7in0_gg_",
|
|
38
|
+
"--pattern": "--pattern_x7in0"
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
var VennRoot = /* @__PURE__ */ function(_Component) {
|
|
42
|
+
_inherits(VennRoot2, _Component);
|
|
43
|
+
var _super = _createSuper(VennRoot2);
|
|
44
|
+
function VennRoot2() {
|
|
45
|
+
var _this;
|
|
46
|
+
_classCallCheck(this, VennRoot2);
|
|
47
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48
|
+
args[_key] = arguments[_key];
|
|
49
|
+
}
|
|
50
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "virtualElement", canUseDOM() ? document.createElement("div") : {});
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "bindHandlerTooltip", function(visible, props, tooltipProps) {
|
|
53
|
+
return function(_ref5) {
|
|
54
|
+
var clientX = _ref5.clientX, clientY = _ref5.clientY;
|
|
55
|
+
var eventEmitter = _this.asProps.eventEmitter;
|
|
56
|
+
eventEmitter.emit("setTooltipPosition", clientX, clientY);
|
|
57
|
+
eventEmitter.emit("setTooltipRenderingProps", props, tooltipProps);
|
|
58
|
+
eventEmitter.emit("setTooltipVisible", visible);
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "renderElement", /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
62
|
+
return /* @__PURE__ */ React.createElement(FadeInOut, _extends({
|
|
63
|
+
"aria-hidden": true,
|
|
64
|
+
ref,
|
|
65
|
+
tag: "g",
|
|
66
|
+
visible: true
|
|
67
|
+
}, props));
|
|
68
|
+
}));
|
|
69
|
+
return _this;
|
|
70
|
+
}
|
|
71
|
+
_createClass(VennRoot2, [{
|
|
72
|
+
key: "generateGetBoundingClientRect",
|
|
73
|
+
value: function generateGetBoundingClientRect() {
|
|
74
|
+
var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
75
|
+
var y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
76
|
+
return function() {
|
|
77
|
+
return {
|
|
78
|
+
width: 0,
|
|
79
|
+
height: 0,
|
|
80
|
+
top: y,
|
|
81
|
+
right: x,
|
|
82
|
+
bottom: y,
|
|
83
|
+
left: x
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "getVennData",
|
|
89
|
+
value: function getVennData() {
|
|
90
|
+
var _this$asProps = this.asProps, data = _this$asProps.data, orientation = _this$asProps.orientation, orientationOrder2 = _this$asProps.orientationOrder, size = _this$asProps.size;
|
|
91
|
+
var _size = _slicedToArray(size, 2), width = _size[0], height = _size[1];
|
|
92
|
+
var vennData = Object.entries(data).map(function(_ref6) {
|
|
93
|
+
var _ref7 = _slicedToArray(_ref6, 2), dataKey = _ref7[0], size2 = _ref7[1];
|
|
94
|
+
return {
|
|
95
|
+
sets: dataKey.split("/"),
|
|
96
|
+
size: size2
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
return scaleSolution(normalizeSolution(venn(vennData), orientation, orientationOrder2), width, height, 10);
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "getCircleProps",
|
|
103
|
+
value: function getCircleProps(props, index) {
|
|
104
|
+
var colorBackwardCapabilityOffset = 1;
|
|
105
|
+
var color = props.color || getChartDefaultColorName(index + colorBackwardCapabilityOffset);
|
|
106
|
+
var tooltipProps = {
|
|
107
|
+
dataKey: props.dataKey,
|
|
108
|
+
name: props.name,
|
|
109
|
+
color,
|
|
110
|
+
patterns: this.asProps.patterns
|
|
111
|
+
};
|
|
112
|
+
return {
|
|
113
|
+
duration: this.asProps.duration,
|
|
114
|
+
data: this.vennData[props.dataKey],
|
|
115
|
+
originalData: this.asProps.data[props.dataKey],
|
|
116
|
+
onMouseMove: this.bindHandlerTooltip(true, props, tooltipProps),
|
|
117
|
+
onMouseLeave: this.bindHandlerTooltip(false, props, tooltipProps),
|
|
118
|
+
transparent: this.asProps.transparent,
|
|
119
|
+
resolveColor: this.asProps.resolveColor,
|
|
120
|
+
color,
|
|
121
|
+
uid: "".concat(this.asProps.uid, "-").concat(index),
|
|
122
|
+
patterns: this.asProps.patterns,
|
|
123
|
+
minRadius: this.asProps.minRadius
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "getIntersectionProps",
|
|
128
|
+
value: function getIntersectionProps(props) {
|
|
129
|
+
var _this$asProps2 = this.asProps, duration = _this$asProps2.duration, transparent = _this$asProps2.transparent;
|
|
130
|
+
var dataKeys = props.dataKey.split("/");
|
|
131
|
+
var tooltipProps = {
|
|
132
|
+
dataKey: props.dataKey,
|
|
133
|
+
name: props.name,
|
|
134
|
+
color: props.color,
|
|
135
|
+
duration: props.duration,
|
|
136
|
+
transparent: props.transparent
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
duration,
|
|
140
|
+
delay: duration,
|
|
141
|
+
data: Object.values(this.vennData).filter(function(d) {
|
|
142
|
+
return dataKeys.includes(d.setid);
|
|
143
|
+
}),
|
|
144
|
+
originalData: this.asProps.data[props.dataKey],
|
|
145
|
+
onMouseMove: this.bindHandlerTooltip(true, props, tooltipProps),
|
|
146
|
+
onMouseLeave: this.bindHandlerTooltip(false, props, tooltipProps),
|
|
147
|
+
transparent,
|
|
148
|
+
resolveColor: this.asProps.resolveColor
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
key: "render",
|
|
153
|
+
value: function render() {
|
|
154
|
+
var Element = this.Element;
|
|
155
|
+
this.asProps.dataHintsHandler.establishDataType("values-set");
|
|
156
|
+
this.vennData = this.getVennData();
|
|
157
|
+
return /* @__PURE__ */ React.createElement(Element, {
|
|
158
|
+
"aria-hidden": true,
|
|
159
|
+
render: this.renderElement,
|
|
160
|
+
childrenPosition: "inside",
|
|
161
|
+
vennData: this.vennData
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}]);
|
|
165
|
+
return VennRoot2;
|
|
166
|
+
}(Component);
|
|
167
|
+
_defineProperty(VennRoot, "displayName", "Venn");
|
|
168
|
+
_defineProperty(VennRoot, "style", style);
|
|
169
|
+
_defineProperty(VennRoot, "defaultProps", {
|
|
170
|
+
orientation: Math.PI / 2,
|
|
171
|
+
orientationOrder: function orientationOrder(c1, c2) {
|
|
172
|
+
return c2.radius - c1.radius;
|
|
173
|
+
},
|
|
174
|
+
duration: 500,
|
|
175
|
+
minRadius: 6
|
|
176
|
+
});
|
|
177
|
+
_defineProperty(VennRoot, "enhance", [uniqueIDEnhancement()]);
|
|
178
|
+
function Circle(_ref8) {
|
|
179
|
+
var _ref2;
|
|
180
|
+
var SCircle = _ref8.Element, styles = _ref8.styles, color = _ref8.color, resolveColor = _ref8.resolveColor, data = _ref8.data, duration = _ref8.duration, name = _ref8.name, dataKey = _ref8.dataKey, dataHintsHandler = _ref8.dataHintsHandler, transparent = _ref8.transparent, uid = _ref8.uid, patterns = _ref8.patterns, minRadius = _ref8.minRadius;
|
|
181
|
+
dataHintsHandler.describeValueEntity(dataKey, name);
|
|
182
|
+
var radius = data.radius < minRadius ? minRadius : data.radius;
|
|
183
|
+
if (data.radius === 0) return null;
|
|
184
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (_ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SCircle, _ref2.cn("SCircle", {
|
|
185
|
+
"aria-hidden": true,
|
|
186
|
+
"render": "circle",
|
|
187
|
+
"color": resolveColor(color),
|
|
188
|
+
"pattern": patterns ? "url(#".concat(uid, "-pattern)") : void 0,
|
|
189
|
+
"cx": data.x,
|
|
190
|
+
"cy": data.y,
|
|
191
|
+
"r": radius,
|
|
192
|
+
"transparent": transparent,
|
|
193
|
+
"use:duration": "".concat(duration, "ms")
|
|
194
|
+
}))), patterns && /* @__PURE__ */ React.createElement(PatternFill, _ref2.cn("PatternFill", {
|
|
195
|
+
"id": "".concat(uid, "-pattern"),
|
|
196
|
+
"patternKey": color,
|
|
197
|
+
"color": resolveColor(color),
|
|
198
|
+
"patterns": patterns
|
|
199
|
+
})));
|
|
200
|
+
}
|
|
201
|
+
function Intersection(props) {
|
|
202
|
+
var _ref3;
|
|
203
|
+
var SIntersection = props.Element, styles = props.styles, data = props.data, name = props.name, dataKey = props.dataKey, dataHintsHandler = props.dataHintsHandler, transparent = props.transparent;
|
|
204
|
+
dataHintsHandler.describeValueEntity(dataKey, name);
|
|
205
|
+
var renderIntersection = React.useCallback(/* @__PURE__ */ React.forwardRef(function(props2, ref) {
|
|
206
|
+
return /* @__PURE__ */ React.createElement(FadeInOut, _extends({
|
|
207
|
+
"aria-hidden": true,
|
|
208
|
+
ref,
|
|
209
|
+
tag: "path",
|
|
210
|
+
visible: true
|
|
211
|
+
}, props2));
|
|
212
|
+
}), [props]);
|
|
213
|
+
return _ref3 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SIntersection, _ref3.cn("SIntersection", {
|
|
214
|
+
"aria-hidden": true,
|
|
215
|
+
"render": renderIntersection,
|
|
216
|
+
"d": intersectionAreaPath(data),
|
|
217
|
+
"transparent": transparent
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
var VennTooltip = function VennTooltip2(props) {
|
|
221
|
+
var _ref = arguments[0], _ref4;
|
|
222
|
+
var SVennTooltip = Tooltip;
|
|
223
|
+
return _ref4 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SVennTooltip, _ref4.cn("SVennTooltip", _objectSpread({}, assignProps({
|
|
224
|
+
"excludeAnchorProps": true
|
|
225
|
+
}, _ref))));
|
|
226
|
+
};
|
|
227
|
+
var Venn = createElement(VennRoot, {
|
|
228
|
+
Circle,
|
|
229
|
+
Intersection,
|
|
230
|
+
Tooltip: [VennTooltip, Tooltip._______childrenComponents]
|
|
231
|
+
});
|
|
232
|
+
export {
|
|
233
|
+
Venn as default
|
|
234
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { defaultValueFormatter } from "./serialize.mjs";
|
|
7
|
+
var DataAccessibilityTable = function DataAccessibilityTable2(_ref) {
|
|
8
|
+
var id = _ref.id, dataTableRef = _ref.dataTableRef, data = _ref.data, hints = _ref.hints, config = _ref.config, intl = _ref.intl;
|
|
9
|
+
var keys = React.useMemo(function() {
|
|
10
|
+
var _fromHints, _fromHints2, _fromHints3, _fromHints4, _fromHints5;
|
|
11
|
+
var fromHints = [];
|
|
12
|
+
(_fromHints = fromHints).push.apply(_fromHints, _toConsumableArray(hints.fields.verticalAxes));
|
|
13
|
+
(_fromHints2 = fromHints).push.apply(_fromHints2, _toConsumableArray(hints.fields.horizontalAxes));
|
|
14
|
+
(_fromHints3 = fromHints).push.apply(_fromHints3, _toConsumableArray(hints.fields.valueAxes));
|
|
15
|
+
(_fromHints4 = fromHints).push.apply(_fromHints4, _toConsumableArray(config.additionalFields));
|
|
16
|
+
(_fromHints5 = fromHints).push.apply(_fromHints5, _toConsumableArray(Object.keys(hints.fields.values)));
|
|
17
|
+
fromHints = _toConsumableArray(new Set(fromHints)).filter(function(key) {
|
|
18
|
+
return key in data[0];
|
|
19
|
+
});
|
|
20
|
+
if (fromHints.length === 0) {
|
|
21
|
+
data.forEach(function(row) {
|
|
22
|
+
var _fromHints6;
|
|
23
|
+
return (_fromHints6 = fromHints).push.apply(_fromHints6, _toConsumableArray(Object.keys(row)));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return _toConsumableArray(new Set(fromHints));
|
|
27
|
+
}, [data, hints]);
|
|
28
|
+
var duplicatedBaseKeys = React.useMemo(function() {
|
|
29
|
+
var baseKeys = keys.filter(function(key2) {
|
|
30
|
+
return !hints.titles.valuesAxes[key2];
|
|
31
|
+
}).map(function(key2) {
|
|
32
|
+
if (hints.fields.verticalAxes.has(key2) && hints.axesTitle.vertical) return [key2, hints.axesTitle.vertical];
|
|
33
|
+
if (hints.fields.horizontalAxes.has(key2) && hints.axesTitle.horizontal) return [key2, hints.axesTitle.horizontal];
|
|
34
|
+
}).filter(function(entry) {
|
|
35
|
+
return entry !== void 0;
|
|
36
|
+
}).map(function(entry) {
|
|
37
|
+
return entry;
|
|
38
|
+
});
|
|
39
|
+
var doublicated = {};
|
|
40
|
+
var handled = {};
|
|
41
|
+
var _iterator = _createForOfIteratorHelper(baseKeys), _step;
|
|
42
|
+
try {
|
|
43
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
44
|
+
var _step$value = _slicedToArray(_step.value, 2), key = _step$value[0], label = _step$value[1];
|
|
45
|
+
if (handled[label]) {
|
|
46
|
+
doublicated[key] = true;
|
|
47
|
+
doublicated[handled[label]] = true;
|
|
48
|
+
}
|
|
49
|
+
handled[label] = key;
|
|
50
|
+
}
|
|
51
|
+
} catch (err) {
|
|
52
|
+
_iterator.e(err);
|
|
53
|
+
} finally {
|
|
54
|
+
_iterator.f();
|
|
55
|
+
}
|
|
56
|
+
return doublicated;
|
|
57
|
+
}, [keys, hints]);
|
|
58
|
+
var renderTitle = React.useCallback(function(dataKey) {
|
|
59
|
+
var _config$titlesFormatt;
|
|
60
|
+
var formatted = (_config$titlesFormatt = config.titlesFormatter) === null || _config$titlesFormatt === void 0 ? void 0 : _config$titlesFormatt.call(config, dataKey);
|
|
61
|
+
if (formatted !== void 0) return formatted;
|
|
62
|
+
if (hints.titles.valuesAxes[dataKey]) return hints.titles.valuesAxes[dataKey];
|
|
63
|
+
if (!duplicatedBaseKeys[dataKey]) {
|
|
64
|
+
if (hints.fields.verticalAxes.has(dataKey) && hints.axesTitle.vertical) return hints.axesTitle.vertical;
|
|
65
|
+
if (hints.fields.horizontalAxes.has(dataKey) && hints.axesTitle.horizontal) return hints.axesTitle.horizontal;
|
|
66
|
+
}
|
|
67
|
+
return dataKey;
|
|
68
|
+
}, [data, hints, duplicatedBaseKeys, config]);
|
|
69
|
+
var formatValue = React.useCallback(function(value, row) {
|
|
70
|
+
var _config$valuesFormatt, _config$valuesFormatt2;
|
|
71
|
+
return (_config$valuesFormatt = (_config$valuesFormatt2 = config.valuesFormatter) === null || _config$valuesFormatt2 === void 0 ? void 0 : _config$valuesFormatt2.call(config, value, row)) !== null && _config$valuesFormatt !== void 0 ? _config$valuesFormatt : defaultValueFormatter(intl, value);
|
|
72
|
+
}, [intl, config]);
|
|
73
|
+
return /* @__PURE__ */ React.createElement("table", {
|
|
74
|
+
id: "".concat(id, "-data-table"),
|
|
75
|
+
tabIndex: 0,
|
|
76
|
+
ref: dataTableRef
|
|
77
|
+
}, /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement("tr", null, keys.map(function(key, index) {
|
|
78
|
+
return /* @__PURE__ */ React.createElement("th", {
|
|
79
|
+
key: "".concat(key, "-").concat(index)
|
|
80
|
+
}, renderTitle(key));
|
|
81
|
+
}))), /* @__PURE__ */ React.createElement("tbody", null, data.map(function(row, index) {
|
|
82
|
+
var key = "".concat(Object.values(row).filter(function(item) {
|
|
83
|
+
return _typeof(item) !== "symbol";
|
|
84
|
+
}).join("-"), "-").concat(index);
|
|
85
|
+
var cells = keys.map(function(key2) {
|
|
86
|
+
return _typeof(row[key2]) !== "symbol" ? [key2, row[key2]] : [key2, ""];
|
|
87
|
+
});
|
|
88
|
+
return /* @__PURE__ */ React.createElement("tr", {
|
|
89
|
+
key
|
|
90
|
+
}, cells.map(function(_ref2, index2) {
|
|
91
|
+
var _ref3 = _slicedToArray(_ref2, 2), key2 = _ref3[0], value = _ref3[1];
|
|
92
|
+
return /* @__PURE__ */ React.createElement("td", {
|
|
93
|
+
key: "".concat(key2, "-").concat(index2)
|
|
94
|
+
}, formatValue(value, keys[index2]));
|
|
95
|
+
}));
|
|
96
|
+
})));
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
DataAccessibilityTable
|
|
100
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
5
|
+
import { sstyled as sstyled$1, assignProps } from "@semcore/core";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { normalizeLocale } from "./locale.mjs";
|
|
8
|
+
import { localizedMessages } from "./translations/module/__intergalactic-dynamic-locales.mjs";
|
|
9
|
+
import { Context, useI18n } from "@semcore/utils/lib/enhances/WithI18n";
|
|
10
|
+
import { Box } from "@semcore/flex-box";
|
|
11
|
+
/*!__reshadow-styles__:"../style/plotA11yModule.shadow.css"*/
|
|
12
|
+
var styles = (
|
|
13
|
+
/*__reshadow_css_start__*/
|
|
14
|
+
(sstyled.insert(
|
|
15
|
+
/*__inner_css_start__*/
|
|
16
|
+
".___SPlotA11yModule_cp478_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;opacity:0}.___SPlotA11yModule_cp478_gg_:focus{-webkit-user-select:all;-moz-user-select:all;user-select:all;pointer-events:all;opacity:1}",
|
|
17
|
+
/*__inner_css_end__*/
|
|
18
|
+
"cp478_gg_"
|
|
19
|
+
), /*__reshadow_css_end__*/
|
|
20
|
+
{
|
|
21
|
+
"__SPlotA11yModule": "___SPlotA11yModule_cp478_gg_"
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
var globalWasFocused = false;
|
|
25
|
+
var globalNavWithKeyboard = false;
|
|
26
|
+
var PlotA11yModule = function PlotA11yModule2(props) {
|
|
27
|
+
var _ref = arguments[0], _ref5;
|
|
28
|
+
var SPlotA11yModule = Box;
|
|
29
|
+
var _React$useState = React.useState(globalWasFocused), _React$useState2 = _slicedToArray(_React$useState, 2), wasFocused = _React$useState2[0], setWasFocused = _React$useState2[1];
|
|
30
|
+
var _React$useState3 = React.useState(globalNavWithKeyboard), _React$useState4 = _slicedToArray(_React$useState3, 2), navWithKeyboard = _React$useState4[0], setNavWithKeyboard = _React$useState4[1];
|
|
31
|
+
var _React$useState5 = React.useState(null), _React$useState6 = _slicedToArray(_React$useState5, 2), plotA11yView = _React$useState6[0], setPlotA11yView = _React$useState6[1];
|
|
32
|
+
var hadnleHiddenElementsFocus = React.useCallback(function() {
|
|
33
|
+
setWasFocused(true);
|
|
34
|
+
setNavWithKeyboard(true);
|
|
35
|
+
}, []);
|
|
36
|
+
var _React$useState7 = React.useState(false), _React$useState8 = _slicedToArray(_React$useState7, 2), loading = _React$useState8[0], setLoading = _React$useState8[1];
|
|
37
|
+
var _React$useState9 = React.useState(null), _React$useState10 = _slicedToArray(_React$useState9, 2), error = _React$useState10[0], setError = _React$useState10[1];
|
|
38
|
+
var contextLocale = React.useContext(Context);
|
|
39
|
+
var locale = React.useMemo(function() {
|
|
40
|
+
var _props$locale;
|
|
41
|
+
return normalizeLocale((_props$locale = props.locale) !== null && _props$locale !== void 0 ? _props$locale : contextLocale, localizedMessages);
|
|
42
|
+
}, [props.locale]);
|
|
43
|
+
var t = useI18n(localizedMessages, locale);
|
|
44
|
+
React.useEffect(function() {
|
|
45
|
+
var _props$plotRef$curren;
|
|
46
|
+
if (wasFocused) return;
|
|
47
|
+
var focusListener = function focusListener2() {
|
|
48
|
+
globalWasFocused = true;
|
|
49
|
+
setWasFocused(true);
|
|
50
|
+
};
|
|
51
|
+
(_props$plotRef$curren = props.plotRef.current) === null || _props$plotRef$curren === void 0 ? void 0 : _props$plotRef$curren.addEventListener("focus", focusListener);
|
|
52
|
+
return function() {
|
|
53
|
+
var _props$plotRef$curren2;
|
|
54
|
+
return (_props$plotRef$curren2 = props.plotRef.current) === null || _props$plotRef$curren2 === void 0 ? void 0 : _props$plotRef$curren2.removeEventListener("focus", focusListener);
|
|
55
|
+
};
|
|
56
|
+
}, [wasFocused, props.plotRef]);
|
|
57
|
+
React.useEffect(function() {
|
|
58
|
+
var _document$body;
|
|
59
|
+
if (navWithKeyboard) return;
|
|
60
|
+
var keyboardListener = function keyboardListener2(event) {
|
|
61
|
+
var navigationKeys = ["Tab", "ArrowUp", "ArrowLeft", "ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft"];
|
|
62
|
+
if ("key" in event && navigationKeys.includes(event.key)) {
|
|
63
|
+
setNavWithKeyboard(true);
|
|
64
|
+
globalNavWithKeyboard = true;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
(_document$body = document.body) === null || _document$body === void 0 ? void 0 : _document$body.addEventListener("keydown", keyboardListener);
|
|
68
|
+
return function() {
|
|
69
|
+
var _document$body2;
|
|
70
|
+
return (_document$body2 = document.body) === null || _document$body2 === void 0 ? void 0 : _document$body2.removeEventListener("keydown", keyboardListener);
|
|
71
|
+
};
|
|
72
|
+
}, [navWithKeyboard]);
|
|
73
|
+
var shouldDisplayView = wasFocused && navWithKeyboard;
|
|
74
|
+
React.useEffect(function() {
|
|
75
|
+
if (!shouldDisplayView) return;
|
|
76
|
+
if (plotA11yView) return;
|
|
77
|
+
if (loading) return;
|
|
78
|
+
setLoading(true);
|
|
79
|
+
import("./PlotA11yView.mjs").then(function(_ref6) {
|
|
80
|
+
var PlotA11yView = _ref6.PlotA11yView;
|
|
81
|
+
setPlotA11yView({
|
|
82
|
+
Component: PlotA11yView
|
|
83
|
+
});
|
|
84
|
+
setLoading(false);
|
|
85
|
+
setError(null);
|
|
86
|
+
})["catch"](function(error2) {
|
|
87
|
+
console.error(error2);
|
|
88
|
+
setError(error2);
|
|
89
|
+
});
|
|
90
|
+
}, [plotA11yView, shouldDisplayView, loading, setLoading]);
|
|
91
|
+
if (plotA11yView) {
|
|
92
|
+
return sstyled$1(styles), /* @__PURE__ */ React.createElement(plotA11yView.Component, _extends({}, props, {
|
|
93
|
+
locale
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
if (error) {
|
|
97
|
+
var _ref3;
|
|
98
|
+
return _ref3 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPlotA11yModule, _ref3.cn("SPlotA11yModule", _objectSpread({}, assignProps({
|
|
99
|
+
"tabIndex": 0,
|
|
100
|
+
"aria-live": "assertive"
|
|
101
|
+
}, _ref))), t("failed"));
|
|
102
|
+
}
|
|
103
|
+
if (loading) {
|
|
104
|
+
var _ref4;
|
|
105
|
+
return _ref4 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPlotA11yModule, _ref4.cn("SPlotA11yModule", _objectSpread({}, assignProps({
|
|
106
|
+
"tabIndex": 0,
|
|
107
|
+
"aria-live": "polite"
|
|
108
|
+
}, _ref))), t("loading"));
|
|
109
|
+
}
|
|
110
|
+
return _ref5 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPlotA11yModule, _ref5.cn("SPlotA11yModule", _objectSpread({}, assignProps({
|
|
111
|
+
"tabIndex": 0,
|
|
112
|
+
"onFocus": hadnleHiddenElementsFocus
|
|
113
|
+
}, _ref))), t("disabled"));
|
|
114
|
+
};
|
|
115
|
+
export {
|
|
116
|
+
PlotA11yModule
|
|
117
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
4
|
+
import { sstyled as sstyled$1, assignProps } from "@semcore/core";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { heavyFindNextFocusableElement } from "./focus.mjs";
|
|
7
|
+
import { makeDataSummarizationConfig } from "./hints.mjs";
|
|
8
|
+
import { getIntl } from "./intl.mjs";
|
|
9
|
+
import { summarize } from "./summarize.mjs";
|
|
10
|
+
import { Box } from "@semcore/flex-box";
|
|
11
|
+
import { useAsyncI18nMessages } from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
12
|
+
import { localizedMessages } from "./translations/view/__intergalactic-dynamic-locales.mjs";
|
|
13
|
+
import { DataAccessibilityTable } from "./DataAccessibilityTable.mjs";
|
|
14
|
+
/*!__reshadow-styles__:"../style/plotA11yView.shadow.css"*/
|
|
15
|
+
var styles = (
|
|
16
|
+
/*__reshadow_css_start__*/
|
|
17
|
+
(sstyled.insert(
|
|
18
|
+
/*__inner_css_start__*/
|
|
19
|
+
".___SPlotA11yView_1n3h8_gg_{-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;opacity:0;background-color:var(--intergalactic-bg-primary-neutral, #ffffff);color:var(--intergalactic-text-primary, #191b23);border:3px solid var(--intergalactic-border-primary, #c4c7cf);font-size:var(--intergalactic-fs-50, 10px);padding:2px;width:200px;height:200px;max-width:80%;max-height:80%;overflow:auto}.___SPlotA11yView_1n3h8_gg_:focus,.___SPlotA11yView_1n3h8_gg_:focus-within{-webkit-user-select:all;-moz-user-select:all;user-select:all;pointer-events:all;opacity:1;z-index:var(--intergalactic-z-index-overlay, 500);position:relative;display:block}.___SPlotA11yView_1n3h8_gg_ a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline;margin-bottom:var(--intergalactic-spacing-2x, 8px);display:block}.___SPlotA11yView_1n3h8_gg_ table,.___SPlotA11yView_1n3h8_gg_ td,.___SPlotA11yView_1n3h8_gg_ th{border:1px solid var(--intergalactic-border-primary, #c4c7cf)}",
|
|
20
|
+
/*__inner_css_end__*/
|
|
21
|
+
"1n3h8_gg_"
|
|
22
|
+
), /*__reshadow_css_end__*/
|
|
23
|
+
{
|
|
24
|
+
"__SPlotA11yView": "___SPlotA11yView_1n3h8_gg_"
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
var PlotA11yView = function PlotA11yView2(_ref3) {
|
|
28
|
+
var _ref = arguments[0], _ref2;
|
|
29
|
+
var id = _ref3.id, providedData = _ref3.data, hints = _ref3.hints, plotLabel = _ref3.plotLabel, plotRef = _ref3.plotRef, providedConfig = _ref3.config, locale = _ref3.locale;
|
|
30
|
+
var SPlotA11yView = Box;
|
|
31
|
+
var translations = useAsyncI18nMessages(localizedMessages, locale);
|
|
32
|
+
var intl = React.useMemo(function() {
|
|
33
|
+
return getIntl(locale, translations, localizedMessages);
|
|
34
|
+
}, [locale, translations, localizedMessages]);
|
|
35
|
+
var config = React.useMemo(function() {
|
|
36
|
+
return makeDataSummarizationConfig(providedConfig);
|
|
37
|
+
}, [providedConfig]);
|
|
38
|
+
var data = React.useMemo(function() {
|
|
39
|
+
return Array.isArray(providedData) ? providedData : [providedData];
|
|
40
|
+
}, [providedData]);
|
|
41
|
+
var _React$useState = React.useState(null), _React$useState2 = _slicedToArray(_React$useState, 2), summary = _React$useState2[0], setSummary = _React$useState2[1];
|
|
42
|
+
var _React$useState3 = React.useState(true), _React$useState4 = _slicedToArray(_React$useState3, 2), generatingSummary = _React$useState4[0], setGeneratingSummary = _React$useState4[1];
|
|
43
|
+
React.useEffect(function() {
|
|
44
|
+
if (config.disable) {
|
|
45
|
+
setSummary("");
|
|
46
|
+
setGeneratingSummary(false);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (config.override) {
|
|
50
|
+
setSummary(config.override);
|
|
51
|
+
setGeneratingSummary(false);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
setTimeout(function() {
|
|
55
|
+
setSummary(summarize(providedData, hints, config, locale, translations, localizedMessages));
|
|
56
|
+
setGeneratingSummary(false);
|
|
57
|
+
}, 0);
|
|
58
|
+
}, [providedData, hints, config, locale, translations, localizedMessages]);
|
|
59
|
+
var handleClose = React.useCallback(function() {
|
|
60
|
+
var _plotRef$current;
|
|
61
|
+
(_plotRef$current = plotRef.current) === null || _plotRef$current === void 0 ? void 0 : _plotRef$current.focus();
|
|
62
|
+
}, []);
|
|
63
|
+
var handleSkip = React.useCallback(function(event) {
|
|
64
|
+
var _heavyFindNextFocusab;
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
if (!plotRef.current) return;
|
|
67
|
+
(_heavyFindNextFocusab = heavyFindNextFocusableElement(plotRef.current)) === null || _heavyFindNextFocusab === void 0 ? void 0 : _heavyFindNextFocusab.focus();
|
|
68
|
+
}, []);
|
|
69
|
+
var handleSkipKeyboard = React.useCallback(function(event) {
|
|
70
|
+
if (!(event.key === "Enter" || event.key === " ")) return;
|
|
71
|
+
handleSkip(event);
|
|
72
|
+
}, [handleSkip]);
|
|
73
|
+
var handleGoToTable = React.useCallback(function(event) {
|
|
74
|
+
var _dataTableRef$current;
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
(_dataTableRef$current = dataTableRef.current) === null || _dataTableRef$current === void 0 ? void 0 : _dataTableRef$current.focus();
|
|
77
|
+
}, []);
|
|
78
|
+
var handleGoToTableKeyboard = React.useCallback(function(event) {
|
|
79
|
+
if (!(event.key === "Enter" || event.key === " ")) return;
|
|
80
|
+
handleGoToTable(event);
|
|
81
|
+
}, [handleGoToTable]);
|
|
82
|
+
var texts = React.useMemo(function() {
|
|
83
|
+
return {
|
|
84
|
+
label: intl.formatMessage({
|
|
85
|
+
id: "view-label"
|
|
86
|
+
}, {
|
|
87
|
+
plotLabel: plotLabel !== null && plotLabel !== void 0 ? plotLabel : intl.formatMessage({
|
|
88
|
+
id: "view-default-plot-label"
|
|
89
|
+
})
|
|
90
|
+
}),
|
|
91
|
+
close: intl.formatMessage({
|
|
92
|
+
id: "view-close"
|
|
93
|
+
}),
|
|
94
|
+
skipPlot: intl.formatMessage({
|
|
95
|
+
id: "view-skip-plot"
|
|
96
|
+
}),
|
|
97
|
+
goToTable: intl.formatMessage({
|
|
98
|
+
id: "view-go-to-table"
|
|
99
|
+
}),
|
|
100
|
+
summary: intl.formatMessage({
|
|
101
|
+
id: "view-data-summary"
|
|
102
|
+
}),
|
|
103
|
+
summaryPlaceholder: intl.formatMessage({
|
|
104
|
+
id: "view-summary-placeholder"
|
|
105
|
+
}),
|
|
106
|
+
table: intl.formatMessage({
|
|
107
|
+
id: "view-table"
|
|
108
|
+
})
|
|
109
|
+
};
|
|
110
|
+
}, [intl, plotLabel]);
|
|
111
|
+
var dataTableRef = React.useRef(null);
|
|
112
|
+
return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPlotA11yView, _ref2.cn("SPlotA11yView", _objectSpread({}, assignProps({
|
|
113
|
+
"tabIndex": 0,
|
|
114
|
+
"aria-label": texts.label,
|
|
115
|
+
"role": "dialog",
|
|
116
|
+
"__excludeProps": ["data"]
|
|
117
|
+
}, _ref))), /* @__PURE__ */ React.createElement("button", _ref2.cn("button", {
|
|
118
|
+
"type": "button",
|
|
119
|
+
"onClick": handleClose
|
|
120
|
+
}), texts.close), /* @__PURE__ */ React.createElement("a", _ref2.cn("a", {
|
|
121
|
+
"href": "#",
|
|
122
|
+
"onKeyDown": handleSkipKeyboard,
|
|
123
|
+
"onClick": handleSkip
|
|
124
|
+
}), texts.skipPlot), /* @__PURE__ */ React.createElement("a", _ref2.cn("a", {
|
|
125
|
+
"href": "#".concat(id, "-data-table"),
|
|
126
|
+
"onKeyDown": handleGoToTableKeyboard,
|
|
127
|
+
"onClick": handleGoToTable
|
|
128
|
+
}), texts.goToTable), /* @__PURE__ */ React.createElement("strong", _ref2.cn("strong", {}), /* @__PURE__ */ React.createElement("label", _ref2.cn("label", {
|
|
129
|
+
"htmlFor": "".concat(id, "-data-summary")
|
|
130
|
+
}), texts.summary)), /* @__PURE__ */ React.createElement("div", _ref2.cn("div", {
|
|
131
|
+
"id": "".concat(id, "-data-summary"),
|
|
132
|
+
"aria-busy": generatingSummary
|
|
133
|
+
}), generatingSummary ? texts.summaryPlaceholder : summary), /* @__PURE__ */ React.createElement("strong", _ref2.cn("strong", {}), /* @__PURE__ */ React.createElement("label", _ref2.cn("label", {
|
|
134
|
+
"htmlFor": "".concat(id, "-data-table")
|
|
135
|
+
}), texts.table)), /* @__PURE__ */ React.createElement(DataAccessibilityTable, _ref2.cn("DataAccessibilityTable", {
|
|
136
|
+
"id": id,
|
|
137
|
+
"dataTableRef": dataTableRef,
|
|
138
|
+
"data": data,
|
|
139
|
+
"hints": hints,
|
|
140
|
+
"config": config,
|
|
141
|
+
"intl": intl
|
|
142
|
+
})));
|
|
143
|
+
};
|
|
144
|
+
export {
|
|
145
|
+
PlotA11yView
|
|
146
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var makeBezier = function makeBezier2(points, bounds) {
|
|
2
|
+
var yPoints = points.map(function(point) {
|
|
3
|
+
return point.y;
|
|
4
|
+
});
|
|
5
|
+
var noPoints = points.map(function() {
|
|
6
|
+
return 1;
|
|
7
|
+
});
|
|
8
|
+
var weightPoints = points.map(function(point) {
|
|
9
|
+
var _point$weight;
|
|
10
|
+
return (_point$weight = point.weight) !== null && _point$weight !== void 0 ? _point$weight : 1;
|
|
11
|
+
});
|
|
12
|
+
var process = function process2(t, points2) {
|
|
13
|
+
var result = 0;
|
|
14
|
+
for (var i = 0; i < points2.length; i++) {
|
|
15
|
+
var tPower = i;
|
|
16
|
+
var reversedTPower = points2.length - 1 - i;
|
|
17
|
+
var edge = i === 0 || i === points2.length - 1;
|
|
18
|
+
var factor = edge ? 1 : points2.length - 1;
|
|
19
|
+
var point = points2[i];
|
|
20
|
+
var weight = weightPoints[i];
|
|
21
|
+
result += factor * Math.pow(t, tPower) * Math.pow(1 - t, reversedTPower) * point * weight;
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
return function(x) {
|
|
26
|
+
var t = x / bounds.width;
|
|
27
|
+
return process(t, yPoints) / process(t, noPoints);
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
makeBezier
|
|
32
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { isFocusable } from "@semcore/utils/lib/focus-lock/isFocusable";
|
|
2
|
+
var findNextFocusableElementInChildren = function findNextFocusableElementInChildren2(element) {
|
|
3
|
+
if (element && isFocusable(element)) {
|
|
4
|
+
return element;
|
|
5
|
+
}
|
|
6
|
+
var children = element === null || element === void 0 ? void 0 : element.children;
|
|
7
|
+
if (children) {
|
|
8
|
+
for (var i = 0; i < children.length; i++) {
|
|
9
|
+
var childChild = children.item(i);
|
|
10
|
+
if (!childChild) continue;
|
|
11
|
+
var result = findNextFocusableElementInChildren2(childChild);
|
|
12
|
+
if (result) return result;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
};
|
|
17
|
+
var makeParentsChain = function makeParentsChain2(element) {
|
|
18
|
+
var parents = [];
|
|
19
|
+
var parent = element.parentElement;
|
|
20
|
+
while (parent) {
|
|
21
|
+
parents.push(parent);
|
|
22
|
+
parent = parent.parentElement;
|
|
23
|
+
}
|
|
24
|
+
return parents;
|
|
25
|
+
};
|
|
26
|
+
var heavyFindNextFocusableElement = function heavyFindNextFocusableElement2(base) {
|
|
27
|
+
var parents = makeParentsChain(base);
|
|
28
|
+
for (var i = 0; i < parents.length; i++) {
|
|
29
|
+
var _parent$children;
|
|
30
|
+
var parent = parents[i];
|
|
31
|
+
var siblings = Array.from((_parent$children = parent === null || parent === void 0 ? void 0 : parent.children) !== null && _parent$children !== void 0 ? _parent$children : []);
|
|
32
|
+
if (siblings.indexOf(parents[i - 1] || base) !== -1) {
|
|
33
|
+
siblings = siblings.slice(siblings.indexOf(parents[i - 1] || base) + 1);
|
|
34
|
+
}
|
|
35
|
+
for (var _i = 0; _i < siblings.length; _i++) {
|
|
36
|
+
var focusable = findNextFocusableElementInChildren(siblings[_i]);
|
|
37
|
+
if (focusable) return focusable;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
heavyFindNextFocusableElement
|
|
44
|
+
};
|