@semcore/d3-chart 18.1.0 → 18.2.0-prerelease.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 +37 -0
- package/lib/cjs/Area.js +12 -12
- package/lib/cjs/Axis.js +15 -15
- package/lib/cjs/Bar.js +206 -21
- package/lib/cjs/Bar.js.map +1 -1
- package/lib/cjs/Bubble.js +85 -38
- package/lib/cjs/Bubble.js.map +1 -1
- package/lib/cjs/CompactHorizontalBar.js +16 -16
- package/lib/cjs/Donut.js +65 -152
- package/lib/cjs/Donut.js.map +1 -1
- package/lib/cjs/Dots.js +13 -13
- package/lib/cjs/Dots.js.map +1 -1
- package/lib/cjs/HorizontalBar.js +32 -25
- package/lib/cjs/HorizontalBar.js.map +1 -1
- package/lib/cjs/Hover.js +64 -153
- package/lib/cjs/Hover.js.map +1 -1
- package/lib/cjs/Line.js +9 -9
- package/lib/cjs/Pattern.js +267 -273
- package/lib/cjs/Pattern.js.map +1 -1
- package/lib/cjs/Plot.js +4 -4
- package/lib/cjs/Plot.js.map +1 -1
- package/lib/cjs/Radar.js +19 -19
- package/lib/cjs/RadialTree.js +12 -12
- package/lib/cjs/Reference.js +31 -29
- package/lib/cjs/Reference.js.map +1 -1
- package/lib/cjs/ScatterPlot.js +9 -9
- package/lib/cjs/StackBar.js +7 -2
- package/lib/cjs/StackBar.js.map +1 -1
- package/lib/cjs/Tooltip.js +14 -13
- package/lib/cjs/Tooltip.js.map +1 -1
- package/lib/cjs/Venn.js +9 -9
- package/lib/cjs/a11y/DataAccessibilityTable.js +1 -1
- package/lib/cjs/a11y/DataAccessibilityTable.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yModule.js +2 -2
- package/lib/cjs/a11y/PlotA11yView.js +2 -2
- package/lib/cjs/component/Chart/AbstractChart.js +28 -21
- package/lib/cjs/component/Chart/AbstractChart.js.map +1 -1
- package/lib/cjs/component/Chart/AbstractChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/BarChart.js +51 -0
- package/lib/cjs/component/Chart/BarChart.js.map +1 -1
- package/lib/cjs/component/Chart/BarChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/BubbleChart.js +104 -20
- package/lib/cjs/component/Chart/BubbleChart.js.map +1 -1
- package/lib/cjs/component/Chart/DonutChart.js +27 -3
- package/lib/cjs/component/Chart/DonutChart.js.map +1 -1
- package/lib/cjs/component/Chart/DonutChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/LineChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/ScoreBar/ScoreBarChart.js +165 -0
- package/lib/cjs/component/Chart/ScoreBar/ScoreBarChart.js.map +1 -0
- package/lib/cjs/component/Chart/ScoreBar/ScoreBarChart.type.js +2 -0
- package/lib/cjs/component/Chart/ScoreBar/ScoreBarChart.type.js.map +1 -0
- package/lib/cjs/component/Chart/ScoreBar/ScoreBarItem.js +147 -0
- package/lib/cjs/component/Chart/ScoreBar/ScoreBarItem.js.map +1 -0
- package/lib/cjs/component/Chart/ScoreBar/ScoreBarItem.type.js +2 -0
- package/lib/cjs/component/Chart/ScoreBar/ScoreBarItem.type.js.map +1 -0
- package/lib/cjs/component/Chart/ScoreBar/scoreBarChart.shadow.css +130 -0
- package/lib/cjs/component/Chart/ScoreDonutChart.js +196 -0
- package/lib/cjs/component/Chart/ScoreDonutChart.js.map +1 -0
- package/lib/cjs/component/Chart/ScoreDonutChart.type.js +2 -0
- package/lib/cjs/component/Chart/ScoreDonutChart.type.js.map +1 -0
- package/lib/cjs/component/Chart/index.js +8 -1
- package/lib/cjs/component/Chart/index.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +7 -7
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +18 -21
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendItem/legend-item.shadow.css +7 -4
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +11 -11
- package/lib/cjs/component/Hover/HoverLine.js +144 -0
- package/lib/cjs/component/Hover/HoverLine.js.map +1 -0
- package/lib/cjs/component/Hover/HoverLine.type.js +2 -0
- package/lib/cjs/component/Hover/HoverLine.type.js.map +1 -0
- package/lib/cjs/component/Hover/HoveredTick.js +77 -0
- package/lib/cjs/component/Hover/HoveredTick.js.map +1 -0
- package/lib/cjs/component/Hover/hover.shadow.css +4 -0
- package/lib/cjs/component/Hover/hoveredTick.shadow.css +34 -0
- package/lib/cjs/style/area.shadow.css +5 -4
- package/lib/cjs/style/bar.shadow.css +1 -1
- package/lib/cjs/style/bubble.shadow.css +29 -24
- package/lib/cjs/style/donut.shadow.css +7 -9
- package/lib/cjs/style/dot.shadow.css +1 -1
- package/lib/cjs/style/hover.shadow.css +0 -40
- package/lib/cjs/style/line.shadow.css +1 -1
- package/lib/cjs/style/radar.shadow.css +2 -2
- package/lib/cjs/style/radial-tree.shadow.css +4 -4
- package/lib/cjs/style/scatterplot.shadow.css +2 -2
- package/lib/cjs/style/venn.shadow.css +3 -3
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +2 -0
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/types/Bar.d.js.map +1 -1
- package/lib/cjs/types/Bubble.d.js.map +1 -1
- package/lib/cjs/types/Donut.d.js.map +1 -1
- package/lib/cjs/types/HorizontalBar.d.js.map +1 -1
- package/lib/cjs/types/Plot.d.js.map +1 -1
- package/lib/cjs/types/index.d.js +24 -0
- package/lib/cjs/types/index.d.js.map +1 -1
- package/lib/cjs/utils.js +78 -30
- package/lib/cjs/utils.js.map +1 -1
- package/lib/es6/Area.js +12 -12
- package/lib/es6/Axis.js +15 -15
- package/lib/es6/Bar.js +207 -22
- package/lib/es6/Bar.js.map +1 -1
- package/lib/es6/Bubble.js +86 -39
- package/lib/es6/Bubble.js.map +1 -1
- package/lib/es6/CompactHorizontalBar.js +16 -16
- package/lib/es6/Donut.js +65 -152
- package/lib/es6/Donut.js.map +1 -1
- package/lib/es6/Dots.js +13 -13
- package/lib/es6/Dots.js.map +1 -1
- package/lib/es6/HorizontalBar.js +32 -25
- package/lib/es6/HorizontalBar.js.map +1 -1
- package/lib/es6/Hover.js +64 -153
- package/lib/es6/Hover.js.map +1 -1
- package/lib/es6/Line.js +9 -9
- package/lib/es6/Pattern.js +266 -272
- package/lib/es6/Pattern.js.map +1 -1
- package/lib/es6/Plot.js +4 -4
- package/lib/es6/Plot.js.map +1 -1
- package/lib/es6/Radar.js +19 -19
- package/lib/es6/RadialTree.js +12 -12
- package/lib/es6/Reference.js +31 -29
- package/lib/es6/Reference.js.map +1 -1
- package/lib/es6/ScatterPlot.js +9 -9
- package/lib/es6/StackBar.js +7 -2
- package/lib/es6/StackBar.js.map +1 -1
- package/lib/es6/Tooltip.js +14 -13
- package/lib/es6/Tooltip.js.map +1 -1
- package/lib/es6/Venn.js +9 -9
- package/lib/es6/a11y/DataAccessibilityTable.js +1 -1
- package/lib/es6/a11y/DataAccessibilityTable.js.map +1 -1
- package/lib/es6/a11y/PlotA11yModule.js +2 -2
- package/lib/es6/a11y/PlotA11yView.js +2 -2
- package/lib/es6/component/Chart/AbstractChart.js +29 -22
- package/lib/es6/component/Chart/AbstractChart.js.map +1 -1
- package/lib/es6/component/Chart/AbstractChart.type.js.map +1 -1
- package/lib/es6/component/Chart/BarChart.js +51 -1
- package/lib/es6/component/Chart/BarChart.js.map +1 -1
- package/lib/es6/component/Chart/BarChart.type.js.map +1 -1
- package/lib/es6/component/Chart/BubbleChart.js +105 -21
- package/lib/es6/component/Chart/BubbleChart.js.map +1 -1
- package/lib/es6/component/Chart/DonutChart.js +27 -3
- package/lib/es6/component/Chart/DonutChart.js.map +1 -1
- package/lib/es6/component/Chart/DonutChart.type.js.map +1 -1
- package/lib/es6/component/Chart/LineChart.type.js.map +1 -1
- package/lib/es6/component/Chart/ScoreBar/ScoreBarChart.js +161 -0
- package/lib/es6/component/Chart/ScoreBar/ScoreBarChart.js.map +1 -0
- package/lib/es6/component/Chart/ScoreBar/ScoreBarChart.type.js +2 -0
- package/lib/es6/component/Chart/ScoreBar/ScoreBarChart.type.js.map +1 -0
- package/lib/es6/component/Chart/ScoreBar/ScoreBarItem.js +141 -0
- package/lib/es6/component/Chart/ScoreBar/ScoreBarItem.js.map +1 -0
- package/lib/es6/component/Chart/ScoreBar/ScoreBarItem.type.js +2 -0
- package/lib/es6/component/Chart/ScoreBar/ScoreBarItem.type.js.map +1 -0
- package/lib/es6/component/Chart/ScoreBar/scoreBarChart.shadow.css +130 -0
- package/lib/es6/component/Chart/ScoreDonutChart.js +189 -0
- package/lib/es6/component/Chart/ScoreDonutChart.js.map +1 -0
- package/lib/es6/component/Chart/ScoreDonutChart.type.js +2 -0
- package/lib/es6/component/Chart/ScoreDonutChart.type.js.map +1 -0
- package/lib/es6/component/Chart/index.js +8 -1
- package/lib/es6/component/Chart/index.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +7 -7
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +24 -26
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendItem/legend-item.shadow.css +7 -4
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +11 -11
- package/lib/es6/component/Hover/HoverLine.js +138 -0
- package/lib/es6/component/Hover/HoverLine.js.map +1 -0
- package/lib/es6/component/Hover/HoverLine.type.js +2 -0
- package/lib/es6/component/Hover/HoverLine.type.js.map +1 -0
- package/lib/es6/component/Hover/HoveredTick.js +71 -0
- package/lib/es6/component/Hover/HoveredTick.js.map +1 -0
- package/lib/es6/component/Hover/hover.shadow.css +4 -0
- package/lib/es6/component/Hover/hoveredTick.shadow.css +34 -0
- package/lib/es6/style/area.shadow.css +5 -4
- package/lib/es6/style/bar.shadow.css +1 -1
- package/lib/es6/style/bubble.shadow.css +29 -24
- package/lib/es6/style/donut.shadow.css +7 -9
- package/lib/es6/style/dot.shadow.css +1 -1
- package/lib/es6/style/hover.shadow.css +0 -40
- package/lib/es6/style/line.shadow.css +1 -1
- package/lib/es6/style/radar.shadow.css +2 -2
- package/lib/es6/style/radial-tree.shadow.css +4 -4
- package/lib/es6/style/scatterplot.shadow.css +2 -2
- package/lib/es6/style/venn.shadow.css +3 -3
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -0
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/types/Bar.d.js.map +1 -1
- package/lib/es6/types/Bubble.d.js.map +1 -1
- package/lib/es6/types/Donut.d.js.map +1 -1
- package/lib/es6/types/HorizontalBar.d.js.map +1 -1
- package/lib/es6/types/Plot.d.js.map +1 -1
- package/lib/es6/types/index.d.js +2 -0
- package/lib/es6/types/index.d.js.map +1 -1
- package/lib/es6/utils.js +71 -28
- package/lib/es6/utils.js.map +1 -1
- package/lib/esm/Area.mjs +13 -13
- package/lib/esm/Axis.mjs +16 -16
- package/lib/esm/Bar.mjs +205 -22
- package/lib/esm/Bubble.mjs +87 -40
- package/lib/esm/CompactHorizontalBar.mjs +17 -17
- package/lib/esm/Donut.mjs +66 -151
- package/lib/esm/Dots.mjs +14 -14
- package/lib/esm/HorizontalBar.mjs +33 -26
- package/lib/esm/Hover.mjs +65 -154
- package/lib/esm/Line.mjs +10 -10
- package/lib/esm/Pattern.mjs +268 -273
- package/lib/esm/Plot.mjs +5 -5
- package/lib/esm/Radar.mjs +20 -20
- package/lib/esm/RadialTree.mjs +13 -13
- package/lib/esm/Reference.mjs +33 -30
- package/lib/esm/ScatterPlot.mjs +10 -10
- package/lib/esm/StackBar.mjs +7 -2
- package/lib/esm/Tooltip.mjs +15 -14
- package/lib/esm/Venn.mjs +10 -10
- package/lib/esm/a11y/DataAccessibilityTable.mjs +1 -1
- package/lib/esm/a11y/PlotA11yModule.mjs +3 -3
- package/lib/esm/a11y/PlotA11yView.mjs +3 -3
- package/lib/esm/component/Chart/AbstractChart.mjs +30 -23
- package/lib/esm/component/Chart/BarChart.mjs +49 -0
- package/lib/esm/component/Chart/BubbleChart.mjs +104 -20
- package/lib/esm/component/Chart/DonutChart.mjs +27 -3
- package/lib/esm/component/Chart/ScoreBar/ScoreBarChart.mjs +160 -0
- package/lib/esm/component/Chart/ScoreBar/ScoreBarItem.mjs +149 -0
- package/lib/esm/component/Chart/ScoreBar/scoreBarChart.shadow.css +130 -0
- package/lib/esm/component/Chart/ScoreDonutChart.mjs +186 -0
- package/lib/esm/component/Chart/index.mjs +8 -1
- package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +8 -8
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +19 -22
- package/lib/esm/component/ChartLegend/LegendItem/legend-item.shadow.css +7 -4
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +12 -12
- package/lib/esm/component/Hover/HoverLine.mjs +146 -0
- package/lib/esm/component/Hover/HoveredTick.mjs +79 -0
- package/lib/esm/component/Hover/hover.shadow.css +4 -0
- package/lib/esm/component/Hover/hoveredTick.shadow.css +34 -0
- package/lib/esm/style/area.shadow.css +5 -4
- package/lib/esm/style/bar.shadow.css +1 -1
- package/lib/esm/style/bubble.shadow.css +29 -24
- package/lib/esm/style/donut.shadow.css +7 -9
- package/lib/esm/style/dot.shadow.css +1 -1
- package/lib/esm/style/hover.shadow.css +0 -40
- package/lib/esm/style/line.shadow.css +1 -1
- package/lib/esm/style/radar.shadow.css +2 -2
- package/lib/esm/style/radial-tree.shadow.css +4 -4
- package/lib/esm/style/scatterplot.shadow.css +2 -2
- package/lib/esm/style/venn.shadow.css +3 -3
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -0
- package/lib/esm/translations/de.json.mjs +12 -0
- package/lib/esm/utils.mjs +75 -28
- package/lib/types/Bar.d.ts +3 -0
- package/lib/types/Bubble.d.ts +4 -1
- package/lib/types/Donut.d.ts +0 -4
- package/lib/types/HorizontalBar.d.ts +3 -0
- package/lib/types/Pattern.d.ts +10 -8
- package/lib/types/Pattern.d.ts.map +1 -1
- package/lib/types/Plot.d.ts +6 -1
- package/lib/types/component/Chart/AbstractChart.d.ts +15 -1
- package/lib/types/component/Chart/AbstractChart.d.ts.map +1 -1
- package/lib/types/component/Chart/AbstractChart.type.d.ts +28 -0
- package/lib/types/component/Chart/AbstractChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/BarChart.d.ts.map +1 -1
- package/lib/types/component/Chart/BarChart.type.d.ts +9 -1
- package/lib/types/component/Chart/BarChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/BubbleChart.d.ts.map +1 -1
- package/lib/types/component/Chart/DonutChart.d.ts.map +1 -1
- package/lib/types/component/Chart/DonutChart.type.d.ts +5 -2
- package/lib/types/component/Chart/DonutChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/LineChart.type.d.ts +2 -30
- package/lib/types/component/Chart/LineChart.type.d.ts.map +1 -1
- package/lib/types/component/Chart/ScoreBar/ScoreBarChart.d.ts +8 -0
- package/lib/types/component/Chart/ScoreBar/ScoreBarChart.d.ts.map +1 -0
- package/lib/types/component/Chart/ScoreBar/ScoreBarChart.type.d.ts +80 -0
- package/lib/types/component/Chart/ScoreBar/ScoreBarChart.type.d.ts.map +1 -0
- package/lib/types/component/Chart/ScoreBar/ScoreBarItem.d.ts +3 -0
- package/lib/types/component/Chart/ScoreBar/ScoreBarItem.d.ts.map +1 -0
- package/lib/types/component/Chart/ScoreBar/ScoreBarItem.type.d.ts +20 -0
- package/lib/types/component/Chart/ScoreBar/ScoreBarItem.type.d.ts.map +1 -0
- package/lib/types/component/Chart/ScoreDonutChart.d.ts +8 -0
- package/lib/types/component/Chart/ScoreDonutChart.d.ts.map +1 -0
- package/lib/types/component/Chart/ScoreDonutChart.type.d.ts +40 -0
- package/lib/types/component/Chart/ScoreDonutChart.type.d.ts.map +1 -0
- package/lib/types/component/Chart/index.d.ts +5 -0
- package/lib/types/component/Chart/index.d.ts.map +1 -1
- package/lib/types/component/Hover/HoverLine.d.ts +2 -0
- package/lib/types/component/Hover/HoverLine.d.ts.map +1 -0
- package/lib/types/component/Hover/HoverLine.type.d.ts +17 -0
- package/lib/types/component/Hover/HoverLine.type.d.ts.map +1 -0
- package/lib/types/component/Hover/HoveredTick.d.ts +21 -0
- package/lib/types/component/Hover/HoveredTick.d.ts.map +1 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +5 -0
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts.map +1 -1
- package/lib/types/utils.d.ts +11 -2
- package/lib/types/utils.d.ts.map +1 -1
- package/package.json +9 -10
package/lib/esm/Hover.mjs
CHANGED
|
@@ -1,44 +1,27 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { sstyled, Component, assignProps } from "@semcore/core";
|
|
3
3
|
import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
|
|
4
|
-
import { getFocusableIn } from "@semcore/core/lib/utils/focus-lock/getFocusableIn";
|
|
5
4
|
import { hasParent } from "@semcore/core/lib/utils/hasParent";
|
|
6
5
|
import trottle from "@semcore/core/lib/utils/rafTrottle";
|
|
7
|
-
import useEnhancedEffect from "@semcore/core/lib/utils/use/useEnhancedEffect";
|
|
8
6
|
import React from "react";
|
|
7
|
+
import { HoveredTick } from "./component/Hover/HoveredTick.mjs";
|
|
8
|
+
import { HoverLine as HoverLine$1 } from "./component/Hover/HoverLine.mjs";
|
|
9
9
|
import createElement from "./createElement.mjs";
|
|
10
10
|
import Tooltip from "./Tooltip.mjs";
|
|
11
|
-
import { eventToPoint, invert, getIndexFromData,
|
|
11
|
+
import { eventToPoint, invert, getIndexFromData, formatValue, scaleToBand, getVerticalPathFromRect, getHorizontalPathFromRect } from "./utils.mjs";
|
|
12
12
|
/*!__reshadow-styles__:"./style/hover.shadow.css"*/
|
|
13
13
|
const style = (
|
|
14
14
|
/*__reshadow_css_start__*/
|
|
15
15
|
(sstyled.insert(
|
|
16
16
|
/*__inner_css_start__*/
|
|
17
|
-
|
|
17
|
+
".___SHoverRect_ynpdg_gg_,.___SHoverRect_ynpdg_gg_:focus-visible{outline:none;fill:var(--intergalactic-chart-grid-bar-hover,oklch(.375 .09 242.7/.05))}",
|
|
18
18
|
/*__inner_css_end__*/
|
|
19
|
-
"
|
|
19
|
+
"ynpdg_gg_"
|
|
20
20
|
), /*__reshadow_css_end__*/
|
|
21
21
|
{
|
|
22
|
-
"
|
|
23
|
-
"__SHoverRect": "___SHoverRect_1tzev_gg_",
|
|
24
|
-
"__SHoveredTickWrapper": "___SHoveredTickWrapper_1tzev_gg_",
|
|
25
|
-
"_position_top": "_position_top_1tzev_gg_",
|
|
26
|
-
"__SHoveredTickContent": "___SHoveredTickContent_1tzev_gg_",
|
|
27
|
-
"__SHoveredTick": "___SHoveredTick_1tzev_gg_"
|
|
22
|
+
"__SHoverRect": "___SHoverRect_ynpdg_gg_"
|
|
28
23
|
})
|
|
29
24
|
);
|
|
30
|
-
const STROKE_WIDTH = 1;
|
|
31
|
-
const NOTCH_WIDTH = 9;
|
|
32
|
-
const NOTCH_DELTA = NOTCH_WIDTH / 2 - STROKE_WIDTH / 4;
|
|
33
|
-
function formatValue(locale, value) {
|
|
34
|
-
if (value instanceof Date) {
|
|
35
|
-
return new Intl.DateTimeFormat(locale ?? "en", {
|
|
36
|
-
day: "numeric",
|
|
37
|
-
month: "short"
|
|
38
|
-
}).format(value);
|
|
39
|
-
}
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
25
|
class Hover extends Component {
|
|
43
26
|
constructor(...args) {
|
|
44
27
|
super(...args);
|
|
@@ -133,7 +116,6 @@ class Hover extends Component {
|
|
|
133
116
|
_defineProperty(Hover, "style", style);
|
|
134
117
|
class HoverLineRoot extends Hover {
|
|
135
118
|
render() {
|
|
136
|
-
var _ref3;
|
|
137
119
|
const {
|
|
138
120
|
hideHoverLine,
|
|
139
121
|
meta,
|
|
@@ -147,9 +129,7 @@ class HoverLineRoot extends Hover {
|
|
|
147
129
|
if (isHide) {
|
|
148
130
|
return null;
|
|
149
131
|
}
|
|
150
|
-
const SHoverLine = this.Element;
|
|
151
132
|
const {
|
|
152
|
-
styles,
|
|
153
133
|
x,
|
|
154
134
|
y,
|
|
155
135
|
data,
|
|
@@ -157,68 +137,59 @@ class HoverLineRoot extends Hover {
|
|
|
157
137
|
dataHints,
|
|
158
138
|
hideTickHover
|
|
159
139
|
} = this.asProps;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"x2": x1 + NOTCH_DELTA,
|
|
173
|
-
"y1": yRange[0],
|
|
174
|
-
"y2": yRange[0]
|
|
175
|
-
})), /* @__PURE__ */ React.createElement("line", _ref3.cn("line", {
|
|
176
|
-
"x1": x1,
|
|
177
|
-
"y1": yRange[0],
|
|
178
|
-
"x2": x1,
|
|
179
|
-
"y2": yRange[1]
|
|
180
|
-
})), /* @__PURE__ */ React.createElement("line", _ref3.cn("line", {
|
|
181
|
-
"x1": x1 - NOTCH_DELTA,
|
|
182
|
-
"x2": x1 + NOTCH_DELTA,
|
|
183
|
-
"y1": yRange[1],
|
|
184
|
-
"y2": yRange[1]
|
|
185
|
-
}))), !hideTickHover && /* @__PURE__ */ React.createElement(HoveredTick, _ref3.cn("HoveredTick", {
|
|
186
|
-
"size": meta.getTicksSize("horizontal"),
|
|
187
|
-
"position": meta.getTicksPosition("horizontal"),
|
|
188
|
-
"tickFormatter": dataHints.titles.getHorizontalAxesTitle ?? formatValue.bind(null, locale),
|
|
189
|
-
"value": data[xIndex]?.[x],
|
|
190
|
-
"isFirstTick": xIndex === 0,
|
|
191
|
-
"isLastTick": xIndex === data.length - 1,
|
|
192
|
-
"styles": styles,
|
|
193
|
-
"x": x1,
|
|
194
|
-
"yRange": yRange
|
|
195
|
-
}))) : null, yIndex !== null ? /* @__PURE__ */ React.createElement(SHoverLine, _ref3.cn("SHoverLine", {
|
|
196
|
-
"render": "g",
|
|
197
|
-
"index": yIndex,
|
|
198
|
-
"stroke-width": STROKE_WIDTH,
|
|
199
|
-
"aria-hidden": true
|
|
200
|
-
}), /* @__PURE__ */ React.createElement("line", _ref3.cn("line", {
|
|
201
|
-
"x1": xRange[0],
|
|
202
|
-
"y1": y1 - NOTCH_DELTA,
|
|
203
|
-
"x2": xRange[0],
|
|
204
|
-
"y2": y1 + NOTCH_DELTA
|
|
205
|
-
})), /* @__PURE__ */ React.createElement("line", _ref3.cn("line", {
|
|
206
|
-
"x1": xRange[0],
|
|
207
|
-
"y1": y1,
|
|
208
|
-
"x2": xRange[1],
|
|
209
|
-
"y2": y1
|
|
210
|
-
})), /* @__PURE__ */ React.createElement("line", _ref3.cn("line", {
|
|
211
|
-
"x1": xRange[1],
|
|
212
|
-
"y1": y1 - NOTCH_DELTA,
|
|
213
|
-
"x2": xRange[1],
|
|
214
|
-
"y2": y1 + NOTCH_DELTA
|
|
215
|
-
}))) : null);
|
|
140
|
+
return /* @__PURE__ */ React.createElement(HoverLine$1, {
|
|
141
|
+
data,
|
|
142
|
+
x,
|
|
143
|
+
y,
|
|
144
|
+
dataHints,
|
|
145
|
+
hideTickHover,
|
|
146
|
+
meta,
|
|
147
|
+
scale,
|
|
148
|
+
xIndex,
|
|
149
|
+
yIndex,
|
|
150
|
+
formatValue: formatValue.bind(null, locale)
|
|
151
|
+
});
|
|
216
152
|
}
|
|
217
153
|
}
|
|
218
154
|
_defineProperty(HoverLineRoot, "displayName", "HoverLine");
|
|
219
155
|
class HoverRectRoot extends Hover {
|
|
156
|
+
getRectPath(orientation) {
|
|
157
|
+
const {
|
|
158
|
+
x,
|
|
159
|
+
y,
|
|
160
|
+
data,
|
|
161
|
+
scale
|
|
162
|
+
} = this.asProps;
|
|
163
|
+
const {
|
|
164
|
+
xIndex,
|
|
165
|
+
yIndex
|
|
166
|
+
} = this.state;
|
|
167
|
+
const [xScale, yScale] = scale;
|
|
168
|
+
const xRange = xScale.range();
|
|
169
|
+
const yRange = yScale.range();
|
|
170
|
+
const xBand = scaleToBand(xScale);
|
|
171
|
+
const yBand = scaleToBand(yScale);
|
|
172
|
+
const xStep = xBand.step();
|
|
173
|
+
const xPaddingInner = xBand.paddingInner();
|
|
174
|
+
const yStep = yBand.step();
|
|
175
|
+
const yPaddingInner = yBand.paddingInner();
|
|
176
|
+
if (orientation === "vertical") {
|
|
177
|
+
return getVerticalPathFromRect({
|
|
178
|
+
x: xScale(data[xIndex][x]) - xStep * xPaddingInner / 2,
|
|
179
|
+
y: yRange[1],
|
|
180
|
+
width: xStep - xPaddingInner / 2,
|
|
181
|
+
height: yRange[0] - yRange[1]
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
return getHorizontalPathFromRect({
|
|
185
|
+
x: xRange[0],
|
|
186
|
+
y: yScale(data[yIndex][y]) - yStep * yPaddingInner / 2,
|
|
187
|
+
width: xRange[1] - xRange[0],
|
|
188
|
+
height: yStep - yPaddingInner / 2
|
|
189
|
+
});
|
|
190
|
+
}
|
|
220
191
|
render() {
|
|
221
|
-
var
|
|
192
|
+
var _ref3;
|
|
222
193
|
const {
|
|
223
194
|
hideHoverLine,
|
|
224
195
|
meta
|
|
@@ -242,95 +213,35 @@ class HoverRectRoot extends Hover {
|
|
|
242
213
|
yIndex
|
|
243
214
|
} = this.state;
|
|
244
215
|
const [xScale, yScale] = scale;
|
|
245
|
-
const xRange = xScale.range();
|
|
246
216
|
const yRange = yScale.range();
|
|
247
217
|
const xBand = scaleToBand(xScale);
|
|
248
|
-
const yBand = scaleToBand(yScale);
|
|
249
218
|
const xStep = xBand.step();
|
|
250
219
|
const xPaddingInner = xBand.paddingInner();
|
|
251
|
-
|
|
252
|
-
const yPaddingInner = yBand.paddingInner();
|
|
253
|
-
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, xIndex !== null && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SHoverRect, _ref4.cn("SHoverRect", {
|
|
220
|
+
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, xIndex !== null && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SHoverRect, _ref3.cn("SHoverRect", {
|
|
254
221
|
"aria-hidden": true,
|
|
255
|
-
"render": "
|
|
222
|
+
"render": "path",
|
|
256
223
|
"index": xIndex,
|
|
257
|
-
"
|
|
258
|
-
|
|
259
|
-
"x": xScale(data[xIndex][x]) - xStep * xPaddingInner / 2,
|
|
260
|
-
"y": yRange[1]
|
|
261
|
-
})), !hideTickHover && /* @__PURE__ */ React.createElement(HoveredTick, _ref4.cn("HoveredTick", {
|
|
224
|
+
"d": this.getRectPath("vertical")
|
|
225
|
+
})), !hideTickHover && /* @__PURE__ */ React.createElement(HoveredTick, _ref3.cn("HoveredTick", {
|
|
262
226
|
"size": meta.getTicksSize("horizontal"),
|
|
263
227
|
"position": meta.getTicksPosition("horizontal"),
|
|
264
228
|
"tickFormatter": dataHints.titles.getHorizontalAxesTitle ?? formatValue.bind(null, locale),
|
|
265
229
|
"value": data[xIndex]?.[x],
|
|
266
|
-
"styles": styles,
|
|
267
230
|
"x": xScale(data[xIndex][x]) + xStep * (1 - xPaddingInner) / 2,
|
|
268
231
|
"yRange": yRange
|
|
269
|
-
}))), yIndex !== null && /* @__PURE__ */ React.createElement(SHoverRect,
|
|
232
|
+
}))), yIndex !== null && /* @__PURE__ */ React.createElement(SHoverRect, _ref3.cn("SHoverRect", {
|
|
270
233
|
"aria-hidden": true,
|
|
271
|
-
"render": "
|
|
234
|
+
"render": "path",
|
|
272
235
|
"index": yIndex,
|
|
273
|
-
"
|
|
274
|
-
"height": yStep - yPaddingInner / 2,
|
|
275
|
-
"x": xRange[0],
|
|
276
|
-
"y": yScale(data[yIndex][y]) - yStep * yPaddingInner / 2
|
|
236
|
+
"d": this.getRectPath("horizontal")
|
|
277
237
|
})));
|
|
278
238
|
}
|
|
279
239
|
}
|
|
280
240
|
_defineProperty(HoverRectRoot, "displayName", "HoverRect");
|
|
281
|
-
const HOVERED_TICK_MARGIN_Y = 8;
|
|
282
|
-
const HOVERED_TICK_PADDING_Y = 3;
|
|
283
|
-
const HOVERED_TICK_PADDING_X = 12;
|
|
284
|
-
function HoveredTick(props) {
|
|
285
|
-
var _ref5;
|
|
286
|
-
const {
|
|
287
|
-
tickFormatter,
|
|
288
|
-
value,
|
|
289
|
-
isFirstTick = false,
|
|
290
|
-
isLastTick = false,
|
|
291
|
-
styles,
|
|
292
|
-
x,
|
|
293
|
-
yRange,
|
|
294
|
-
size,
|
|
295
|
-
position
|
|
296
|
-
} = props;
|
|
297
|
-
const formattedValue = tickFormatter(value);
|
|
298
|
-
const contentRef = React.useRef(null);
|
|
299
|
-
const isRendered = size?.width !== void 0 && size?.height !== void 0 && position !== null;
|
|
300
|
-
const isMightBeInteractive = formattedValue !== null && typeof formattedValue === "object";
|
|
301
|
-
useEnhancedEffect(() => {
|
|
302
|
-
if (!isRendered || !isMightBeInteractive || !contentRef.current) return;
|
|
303
|
-
getFocusableIn(contentRef.current).forEach((node) => node.setAttribute("tabindex", "-1"));
|
|
304
|
-
}, [value, isRendered, isMightBeInteractive]);
|
|
305
|
-
if (!isRendered) return null;
|
|
306
|
-
const {
|
|
307
|
-
width,
|
|
308
|
-
height
|
|
309
|
-
} = size;
|
|
310
|
-
const SHoveredTickWrapper = "foreignObject";
|
|
311
|
-
const SHoveredTickContent = "div";
|
|
312
|
-
const SHoveredTick = "span";
|
|
313
|
-
const w = width + HOVERED_TICK_PADDING_X * 2;
|
|
314
|
-
const tickX = isFirstTick ? x : isLastTick ? x - w : x - w / 2;
|
|
315
|
-
const tickY = position === "top" ? yRange[1] - height - HOVERED_TICK_MARGIN_Y + HOVERED_TICK_PADDING_Y : yRange[0] + HOVERED_TICK_MARGIN_Y - HOVERED_TICK_PADDING_Y;
|
|
316
|
-
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SHoveredTickWrapper, _ref5.cn("SHoveredTickWrapper", {
|
|
317
|
-
"x": tickX,
|
|
318
|
-
"y": tickY,
|
|
319
|
-
"width": w,
|
|
320
|
-
"height": height,
|
|
321
|
-
"data-is-first": isFirstTick,
|
|
322
|
-
"data-is-last": isLastTick,
|
|
323
|
-
"position": position,
|
|
324
|
-
"data-hovered-tick": true,
|
|
325
|
-
"aria-hidden": "true"
|
|
326
|
-
}), /* @__PURE__ */ React.createElement(SHoveredTickContent, _ref5.cn("SHoveredTickContent", {
|
|
327
|
-
"ref": contentRef
|
|
328
|
-
}), /* @__PURE__ */ React.createElement(SHoveredTick, _ref5.cn("SHoveredTick", {}), formattedValue)));
|
|
329
|
-
}
|
|
330
241
|
function HoverLineTooltip(props) {
|
|
331
|
-
var _ref = arguments[0],
|
|
242
|
+
var _ref = arguments[0], _ref4;
|
|
332
243
|
const SHoverLineTooltip = Tooltip;
|
|
333
|
-
return
|
|
244
|
+
return _ref4 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SHoverLineTooltip, _ref4.cn("SHoverLineTooltip", {
|
|
334
245
|
...assignProps({
|
|
335
246
|
"tag": HoverLine,
|
|
336
247
|
"excludeAnchorProps": true
|
|
@@ -338,9 +249,9 @@ function HoverLineTooltip(props) {
|
|
|
338
249
|
}));
|
|
339
250
|
}
|
|
340
251
|
function HoverRectTooltip(props) {
|
|
341
|
-
var _ref2 = arguments[0],
|
|
252
|
+
var _ref2 = arguments[0], _ref5;
|
|
342
253
|
const SHoverRectTooltip = Tooltip;
|
|
343
|
-
return
|
|
254
|
+
return _ref5 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SHoverRectTooltip, _ref5.cn("SHoverRectTooltip", {
|
|
344
255
|
...assignProps({
|
|
345
256
|
"tag": HoverRect,
|
|
346
257
|
"excludeAnchorProps": true
|
package/lib/esm/Line.mjs
CHANGED
|
@@ -17,19 +17,19 @@ const style = (
|
|
|
17
17
|
/*__reshadow_css_start__*/
|
|
18
18
|
(sstyled.insert(
|
|
19
19
|
/*__inner_css_start__*/
|
|
20
|
-
".
|
|
20
|
+
".___SLine_1pfll_gg_{fill:#0000;stroke-width:2;stroke:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245));transition-property:d;transition-duration:var(--duration_1pfll);transition-timing-function:ease-in-out}.___SLine_1pfll_gg_.__color_1pfll_gg_{stroke:var(--color_1pfll)}.___SLine_1pfll_gg_.__hide_1pfll_gg_{display:none}.___SLine_1pfll_gg_.__transparent_1pfll_gg_{opacity:var(--intergalactic-chart-transparent-opacity,.3)}.___SNull_1pfll_gg_{fill:#0000;stroke:var(--intergalactic-chart-data-null,oklch(.9 .009 234));stroke-dasharray:4}.___SNull_1pfll_gg_.__hide_1pfll_gg_{display:none}.___SLineArea_1pfll_gg_{transition-property:d;transition-duration:var(--duration_1pfll);transition-timing-function:ease-in-out;opacity:.1;fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245))}.___SLineArea_1pfll_gg_.__color_1pfll_gg_{fill:var(--color_1pfll)}",
|
|
21
21
|
/*__inner_css_end__*/
|
|
22
|
-
"
|
|
22
|
+
"1pfll_gg_"
|
|
23
23
|
), /*__reshadow_css_end__*/
|
|
24
24
|
{
|
|
25
|
-
"__SLine": "
|
|
26
|
-
"--duration": "--
|
|
27
|
-
"_color": "
|
|
28
|
-
"--color": "--
|
|
29
|
-
"_hide": "
|
|
30
|
-
"_transparent": "
|
|
31
|
-
"__SNull": "
|
|
32
|
-
"__SLineArea": "
|
|
25
|
+
"__SLine": "___SLine_1pfll_gg_",
|
|
26
|
+
"--duration": "--duration_1pfll",
|
|
27
|
+
"_color": "__color_1pfll_gg_",
|
|
28
|
+
"--color": "--color_1pfll",
|
|
29
|
+
"_hide": "__hide_1pfll_gg_",
|
|
30
|
+
"_transparent": "__transparent_1pfll_gg_",
|
|
31
|
+
"__SNull": "___SNull_1pfll_gg_",
|
|
32
|
+
"__SLineArea": "___SLineArea_1pfll_gg_"
|
|
33
33
|
})
|
|
34
34
|
);
|
|
35
35
|
class LineRoot extends Component {
|