@elliemae/ds-dataviz 3.8.1 → 3.9.0-next.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/dist/cjs/graphs/Chart/Chart.js.map +2 -2
- package/dist/cjs/graphs/Chart/ChartContext.js +3 -1
- package/dist/cjs/graphs/Chart/ChartContext.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useChart.js +86 -33
- package/dist/cjs/graphs/Chart/config/useChart.js.map +3 -3
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js +103 -0
- package/dist/cjs/graphs/Chart/config/useInternalMargins.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +25 -15
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/cjs/graphs/Chart/config/useScales.js +43 -17
- package/dist/cjs/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/cjs/graphs/Chart/helpers/index.js +9 -13
- package/dist/cjs/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/ActivePoint.js +1 -1
- package/dist/cjs/graphs/Chart/parts/ActivePoint.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js +17 -25
- package/dist/cjs/graphs/Chart/parts/Axis/AxisBottom.js.map +3 -3
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js +33 -38
- package/dist/cjs/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js +6 -11
- package/dist/cjs/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js +65 -16
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js +17 -68
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js.map +2 -2
- package/dist/cjs/graphs/Chart/{series/Pie.js → parts/Labels/BottomLabel.js} +20 -12
- package/dist/cjs/graphs/Chart/parts/Labels/BottomLabel.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Labels/Label.js +52 -0
- package/dist/cjs/graphs/Chart/parts/Labels/Label.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Labels/LeftLabel.js +61 -0
- package/dist/cjs/graphs/Chart/parts/Labels/LeftLabel.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Labels/RightLabel.js +65 -0
- package/dist/cjs/graphs/Chart/parts/Labels/RightLabel.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js +28 -30
- package/dist/cjs/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js +14 -19
- package/dist/cjs/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js +100 -0
- package/dist/cjs/graphs/Chart/parts/Legend/LegendItem.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js +31 -25
- package/dist/cjs/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js +3 -13
- package/dist/cjs/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js +50 -16
- package/dist/cjs/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js +3 -1
- package/dist/cjs/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js +39 -17
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +29 -28
- package/dist/cjs/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js +2 -2
- package/dist/cjs/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js +57 -41
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js +1 -12
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Bars.js +29 -27
- package/dist/cjs/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js +85 -0
- package/dist/cjs/graphs/Chart/series/HorizontalBars.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js +77 -0
- package/dist/cjs/graphs/Chart/series/HorizontalStackedBars.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Line.js +23 -19
- package/dist/cjs/graphs/Chart/series/Line.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Point.js +88 -18
- package/dist/cjs/graphs/Chart/series/Point.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Points.js +23 -27
- package/dist/cjs/graphs/Chart/series/Points.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/Rect.js +105 -8
- package/dist/cjs/graphs/Chart/series/Rect.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/StackedBar.js +23 -30
- package/dist/cjs/graphs/Chart/series/StackedBar.js.map +2 -2
- package/dist/cjs/graphs/Chart/series/index.js +0 -1
- package/dist/cjs/graphs/Chart/series/index.js.map +2 -2
- package/dist/cjs/graphs/Chart/styles.js +5 -20
- package/dist/cjs/graphs/Chart/styles.js.map +2 -2
- package/dist/cjs/graphs/constants.js +20 -0
- package/dist/cjs/graphs/constants.js.map +2 -2
- package/dist/esm/graphs/Chart/Chart.js.map +2 -2
- package/dist/esm/graphs/Chart/ChartContext.js +3 -1
- package/dist/esm/graphs/Chart/ChartContext.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useChart.js +87 -34
- package/dist/esm/graphs/Chart/config/useChart.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useInternalMargins.js +77 -0
- package/dist/esm/graphs/Chart/config/useInternalMargins.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +26 -16
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +2 -2
- package/dist/esm/graphs/Chart/config/useScales.js +44 -18
- package/dist/esm/graphs/Chart/config/useScales.js.map +2 -2
- package/dist/esm/graphs/Chart/helpers/index.js +10 -14
- package/dist/esm/graphs/Chart/helpers/index.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ActivePoint.js +1 -1
- package/dist/esm/graphs/Chart/parts/ActivePoint.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js +18 -26
- package/dist/esm/graphs/Chart/parts/Axis/AxisBottom.js.map +3 -3
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js +34 -39
- package/dist/esm/graphs/Chart/parts/Axis/AxisLeft.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js +6 -11
- package/dist/esm/graphs/Chart/parts/Axis/AxisRight.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/ChartContainer.js +66 -17
- package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js +18 -69
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Labels/BottomLabel.js +28 -0
- package/dist/esm/graphs/Chart/parts/Labels/BottomLabel.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Labels/Label.js +26 -0
- package/dist/esm/graphs/Chart/parts/Labels/Label.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Labels/LeftLabel.js +35 -0
- package/dist/esm/graphs/Chart/parts/Labels/LeftLabel.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Labels/RightLabel.js +39 -0
- package/dist/esm/graphs/Chart/parts/Labels/RightLabel.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js +28 -30
- package/dist/esm/graphs/Chart/parts/Legend/BottomLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js +16 -21
- package/dist/esm/graphs/Chart/parts/Legend/LeftLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js +74 -0
- package/dist/esm/graphs/Chart/parts/Legend/LegendItem.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js +32 -26
- package/dist/esm/graphs/Chart/parts/Legend/RightLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js +3 -13
- package/dist/esm/graphs/Chart/parts/Legend/TopLegend.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js +51 -17
- package/dist/esm/graphs/Chart/parts/Scrapper/Scrapper.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js +3 -1
- package/dist/esm/graphs/Chart/parts/Scrapper/ScrapperLine.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js +39 -17
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapper.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js +29 -28
- package/dist/esm/graphs/Chart/parts/Scrapper/VerticalScrapperLine.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollBarX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js +2 -2
- package/dist/esm/graphs/Chart/parts/Scroller/ScrollableContainerX.js.map +2 -2
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js +58 -42
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js.map +2 -2
- package/dist/esm/graphs/Chart/react-desc-prop-types.js +1 -12
- package/dist/esm/graphs/Chart/react-desc-prop-types.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Bars.js +30 -28
- package/dist/esm/graphs/Chart/series/Bars.js.map +2 -2
- package/dist/esm/graphs/Chart/series/HorizontalBars.js +59 -0
- package/dist/esm/graphs/Chart/series/HorizontalBars.js.map +7 -0
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js +51 -0
- package/dist/esm/graphs/Chart/series/HorizontalStackedBars.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Line.js +25 -21
- package/dist/esm/graphs/Chart/series/Line.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Point.js +89 -19
- package/dist/esm/graphs/Chart/series/Point.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Points.js +24 -28
- package/dist/esm/graphs/Chart/series/Points.js.map +2 -2
- package/dist/esm/graphs/Chart/series/Rect.js +106 -9
- package/dist/esm/graphs/Chart/series/Rect.js.map +2 -2
- package/dist/esm/graphs/Chart/series/StackedBar.js +24 -31
- package/dist/esm/graphs/Chart/series/StackedBar.js.map +2 -2
- package/dist/esm/graphs/Chart/series/index.js +0 -1
- package/dist/esm/graphs/Chart/series/index.js.map +2 -2
- package/dist/esm/graphs/Chart/styles.js +5 -20
- package/dist/esm/graphs/Chart/styles.js.map +2 -2
- package/dist/esm/graphs/constants.js +20 -0
- package/dist/esm/graphs/constants.js.map +2 -2
- package/package.json +8 -8
- package/dist/cjs/graphs/Chart/series/Pie.js.map +0 -7
- package/dist/esm/graphs/Chart/series/Pie.js +0 -20
- package/dist/esm/graphs/Chart/series/Pie.js.map +0 -7
|
@@ -34,6 +34,7 @@ var import_styles = require("../styles");
|
|
|
34
34
|
var import_ChartContext = require("../ChartContext");
|
|
35
35
|
var import_useKeyboardNavigation = require("../config/useKeyboardNavigation");
|
|
36
36
|
var import_Legend = require("./Legend/Legend");
|
|
37
|
+
var import_Label = require("./Labels/Label");
|
|
37
38
|
const ChartContainer = ({ children }) => {
|
|
38
39
|
const {
|
|
39
40
|
props: { width, height },
|
|
@@ -47,12 +48,15 @@ const ChartContainer = ({ children }) => {
|
|
|
47
48
|
setIsGrabbed,
|
|
48
49
|
startPosition,
|
|
49
50
|
innerWidth,
|
|
51
|
+
innerHeight,
|
|
50
52
|
setActivePoint,
|
|
51
53
|
setXScrollbarPosition,
|
|
52
54
|
xScrollbarPosition,
|
|
53
55
|
containerRatio,
|
|
54
56
|
oldLastPosition,
|
|
55
|
-
setIsScrollbarVisible
|
|
57
|
+
setIsScrollbarVisible,
|
|
58
|
+
chartId,
|
|
59
|
+
yScale
|
|
56
60
|
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
57
61
|
const { onInputKeyDown, handleOnBlur, handleOnFocus } = (0, import_useKeyboardNavigation.useKeyboardNavigation)();
|
|
58
62
|
const onMouseEnterHandler = (0, import_react.useCallback)(() => {
|
|
@@ -68,7 +72,7 @@ const ChartContainer = ({ children }) => {
|
|
|
68
72
|
(e) => {
|
|
69
73
|
if (!isGrabbed)
|
|
70
74
|
return;
|
|
71
|
-
setActivePoint(
|
|
75
|
+
setActivePoint(null);
|
|
72
76
|
const newPosition = oldLastPosition?.current + e.clientX - startPosition;
|
|
73
77
|
if (newPosition < 0)
|
|
74
78
|
setXScrollbarPosition(0);
|
|
@@ -83,7 +87,16 @@ const ChartContainer = ({ children }) => {
|
|
|
83
87
|
oldLastPosition.current = xScrollbarPosition;
|
|
84
88
|
setIsGrabbed(false);
|
|
85
89
|
}, [oldLastPosition, setIsGrabbed, xScrollbarPosition]);
|
|
86
|
-
const key =
|
|
90
|
+
const key = (0, import_react.useMemo)(
|
|
91
|
+
() => `translate(${internalMargin.left},${internalMargin.top},${internalMargin.right})`,
|
|
92
|
+
[internalMargin]
|
|
93
|
+
);
|
|
94
|
+
(0, import_react.useEffect)(() => {
|
|
95
|
+
containerRef?.current?.addEventListener("mousemove", handleMouseMove);
|
|
96
|
+
return () => {
|
|
97
|
+
containerRef?.current?.removeEventListener("mousemove", handleMouseMove);
|
|
98
|
+
};
|
|
99
|
+
}, [containerRef, handleMouseMove]);
|
|
87
100
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledSVGWrapper, {
|
|
88
101
|
ref: containerRef,
|
|
89
102
|
onKeyDown: onInputKeyDown,
|
|
@@ -93,26 +106,62 @@ const ChartContainer = ({ children }) => {
|
|
|
93
106
|
onFocus: handleOnFocus,
|
|
94
107
|
onMouseEnter: onMouseEnterHandler,
|
|
95
108
|
onMouseLeave: onMouseLeaveHandler,
|
|
96
|
-
onMouseMove: handleMouseMove,
|
|
97
109
|
onMouseUp: handleMouseUp,
|
|
98
110
|
onMouseDown: (e) => e.preventDefault(),
|
|
99
111
|
isGrabbed,
|
|
100
112
|
style: { width },
|
|
101
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
113
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
|
|
102
114
|
ref: svgRef,
|
|
103
115
|
width,
|
|
104
116
|
height,
|
|
105
|
-
children:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
117
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Legend.Legend, {}),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Label.Label, {})
|
|
123
|
+
]
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
126
|
+
className: "container",
|
|
127
|
+
transform: `translate(${internalMargin.left},${internalMargin.top})`,
|
|
128
|
+
children
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", {
|
|
131
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("clipPath", {
|
|
132
|
+
id: `rect-focus-ring-${chartId}`,
|
|
133
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
|
|
134
|
+
width: innerWidth * containerRatio,
|
|
135
|
+
height: innerHeight + 4,
|
|
136
|
+
y: -4
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", {
|
|
141
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("clipPath", {
|
|
142
|
+
id: `rects-positive-${chartId}`,
|
|
143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
|
|
144
|
+
width: innerWidth * containerRatio,
|
|
145
|
+
height: yScale(0) + 8,
|
|
146
|
+
y: -8,
|
|
147
|
+
x: -10
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
}),
|
|
151
|
+
innerHeight - yScale(0) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("defs", {
|
|
152
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("clipPath", {
|
|
153
|
+
id: `rects-negative-${chartId}`,
|
|
154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
|
|
155
|
+
width: innerWidth * containerRatio,
|
|
156
|
+
height: innerHeight - yScale(0),
|
|
157
|
+
x: -10,
|
|
158
|
+
y: yScale(0)
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
}) : null
|
|
162
|
+
]
|
|
163
|
+
}, key)
|
|
115
164
|
})
|
|
116
|
-
}
|
|
165
|
+
});
|
|
117
166
|
};
|
|
118
167
|
//# sourceMappingURL=ChartContainer.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/parts/ChartContainer.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useCallback,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo, useCallback, useEffect } from 'react';\nimport { StyledSVGWrapper } from '../styles';\n\nimport { ChartContext } from '../ChartContext';\nimport { useKeyboardNavigation } from '../config/useKeyboardNavigation';\nimport { Legend } from './Legend/Legend';\nimport { Label } from './Labels/Label';\ninterface ChartContainerT {\n children: JSX.Element | JSX.Element[] | string | string[];\n}\nexport const ChartContainer: React.ComponentType<ChartContainerT> = ({ children }) => {\n const {\n props: { width, height },\n containerRef,\n activePoint,\n internalMargin,\n setScrapperPosY,\n setScrapperPosX,\n svgRef,\n isGrabbed,\n setIsGrabbed,\n startPosition,\n innerWidth,\n innerHeight,\n setActivePoint,\n setXScrollbarPosition,\n xScrollbarPosition,\n containerRatio,\n oldLastPosition,\n setIsScrollbarVisible,\n chartId,\n yScale,\n } = useContext(ChartContext);\n\n const { onInputKeyDown, handleOnBlur, handleOnFocus } = useKeyboardNavigation();\n\n const onMouseEnterHandler = useCallback(() => {\n setIsScrollbarVisible(true);\n }, [setIsScrollbarVisible]);\n const onMouseLeaveHandler = useCallback(() => {\n setScrapperPosY('');\n setScrapperPosX('');\n setIsScrollbarVisible(false);\n setIsGrabbed(false);\n }, [setIsGrabbed, setIsScrollbarVisible, setScrapperPosX, setScrapperPosY]);\n\n const handleMouseMove = useCallback(\n (e: React.MouseEvent) => {\n if (!isGrabbed) return;\n setActivePoint(null);\n const newPosition = oldLastPosition?.current + e.clientX - startPosition;\n if (newPosition < 0) setXScrollbarPosition(0);\n else if (newPosition > innerWidth - innerWidth / containerRatio)\n setXScrollbarPosition(innerWidth - innerWidth / containerRatio);\n else setXScrollbarPosition(newPosition);\n },\n [isGrabbed, setActivePoint, oldLastPosition, startPosition, setXScrollbarPosition, innerWidth, containerRatio],\n );\n const handleMouseUp = useCallback(() => {\n oldLastPosition.current = xScrollbarPosition;\n setIsGrabbed(false);\n }, [oldLastPosition, setIsGrabbed, xScrollbarPosition]);\n const key = useMemo(\n () => `translate(${internalMargin.left},${internalMargin.top},${internalMargin.right})`,\n [internalMargin],\n );\n\n useEffect(() => {\n containerRef?.current?.addEventListener('mousemove', handleMouseMove);\n // containerRef?.current?.addEventListener('wheel', handleScroll);\n\n return () => {\n containerRef?.current?.removeEventListener('mousemove', handleMouseMove);\n // containerRef?.current?.removeEventListener('wheel', handleScroll);\n };\n }, [containerRef, handleMouseMove]);\n\n return (\n <StyledSVGWrapper\n ref={containerRef}\n onKeyDown={onInputKeyDown}\n aria-hidden=\"true\"\n tabIndex={activePoint ? -1 : 0}\n onBlur={handleOnBlur}\n onFocus={handleOnFocus}\n onMouseEnter={onMouseEnterHandler}\n onMouseLeave={onMouseLeaveHandler}\n // // onMouseMove={handleMouseMove}\n onMouseUp={handleMouseUp}\n onMouseDown={(e) => e.preventDefault()}\n isGrabbed={isGrabbed}\n style={{ width }}\n >\n <svg ref={svgRef} width={width} height={height}>\n <g key={key}>\n <g>\n <Legend />\n <Label />\n </g>\n <g className=\"container\" transform={`translate(${internalMargin.left},${internalMargin.top})`}>\n {children}\n </g>\n {/* @todo we need to put this somewhere. this will clip the focus ring bottom line */}\n <defs>\n <clipPath id={`rect-focus-ring-${chartId}`}>\n <rect width={innerWidth * containerRatio} height={innerHeight + 4} y={-4} />\n </clipPath>\n </defs>\n <defs>\n <clipPath id={`rects-positive-${chartId}`}>\n <rect width={innerWidth * containerRatio} height={yScale(0) + 8} y={-8} x={-10} />\n </clipPath>\n </defs>\n {innerHeight - yScale(0) > 0 ? (\n <defs>\n <clipPath id={`rects-negative-${chartId}`}>\n <rect width={innerWidth * containerRatio} height={innerHeight - yScale(0)} x={-10} y={yScale(0)} />\n </clipPath>\n </defs>\n ) : null}\n </g>\n </svg>\n </StyledSVGWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -32,85 +32,34 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
32
32
|
var import_react = require("react");
|
|
33
33
|
var import_ds_popperjs = require("@elliemae/ds-popperjs");
|
|
34
34
|
var import_ds_system = require("@elliemae/ds-system");
|
|
35
|
-
var import_ChartContext = require("../ChartContext");
|
|
36
35
|
var import_styles = require("../styles");
|
|
37
|
-
const StyledTooltipContainer = import_ds_system.styled.div`
|
|
38
|
-
text-align: center;
|
|
39
|
-
min-width: ${({ theme }) => theme.space.l};
|
|
40
|
-
max-width: 250px;
|
|
41
|
-
min-height: 30px;
|
|
42
|
-
display: grid;
|
|
43
|
-
align-items: center;
|
|
44
|
-
padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xs}`};
|
|
45
|
-
position: relative;
|
|
46
|
-
background-color: white;
|
|
47
|
-
border-radius: 2px;
|
|
48
|
-
font-size: 13px;
|
|
49
|
-
color: ${({ theme }) => theme.colors.neutral[600]};
|
|
50
|
-
`;
|
|
51
|
-
const StyledMouseOverDetectionBox = import_ds_system.styled.div`
|
|
52
|
-
position: absolute;
|
|
53
|
-
top: -15px;
|
|
54
|
-
right: -15px;
|
|
55
|
-
width: calc(100% + 30px);
|
|
56
|
-
height: calc(100% + 30px);
|
|
57
|
-
z-index: -1;
|
|
58
|
-
`;
|
|
59
36
|
const FocusableRegion = (props) => {
|
|
60
|
-
const { activePoint } = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
61
37
|
const [referenceElement, setReferenceElement] = (0, import_react.useState)();
|
|
62
38
|
const theme = (0, import_react.useContext)(import_ds_system.ThemeContext);
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
focusableElement.current = newRef;
|
|
71
|
-
if (isFocused)
|
|
72
|
-
newRef?.focus();
|
|
73
|
-
},
|
|
74
|
-
[isFocused]
|
|
75
|
-
);
|
|
76
|
-
const onMouseEnter = () => {
|
|
77
|
-
setShowPopover(true);
|
|
78
|
-
};
|
|
79
|
-
const onMouseLeave = () => {
|
|
80
|
-
setShowPopover(false);
|
|
81
|
-
};
|
|
82
|
-
const onFocus = () => {
|
|
83
|
-
setShowPopover(true);
|
|
84
|
-
};
|
|
85
|
-
const onBlur = () => {
|
|
86
|
-
setShowPopover(false);
|
|
87
|
-
};
|
|
88
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("foreignObject", {
|
|
89
|
-
...rest,
|
|
90
|
-
onFocus,
|
|
91
|
-
onBlur,
|
|
92
|
-
ref: setReferenceElement,
|
|
93
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
94
|
-
children: [
|
|
95
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyleFocusableRegion, {
|
|
96
|
-
s: pointRadius,
|
|
97
|
-
tabIndex: -1,
|
|
98
|
-
ref: handleRef
|
|
99
|
-
}),
|
|
100
|
-
showPopover && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_popperjs.DSPopperJS, {
|
|
39
|
+
const { content, ...rest } = props;
|
|
40
|
+
return (0, import_react.useMemo)(
|
|
41
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("foreignObject", {
|
|
42
|
+
...rest,
|
|
43
|
+
ref: setReferenceElement,
|
|
44
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
45
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_popperjs.DSPopperJS, {
|
|
101
46
|
withoutAnimation: true,
|
|
102
47
|
referenceElement,
|
|
103
|
-
showPopover,
|
|
48
|
+
showPopover: true,
|
|
104
49
|
zIndex: theme.zIndex.tooltip,
|
|
105
50
|
children: [
|
|
106
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledMouseOverDetectionBox, {}),
|
|
107
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledTooltipContainer, {
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledMouseOverDetectionBox, {}),
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTooltipContainer, {
|
|
53
|
+
"aria-live": "polite",
|
|
54
|
+
"aria-atomic": "false",
|
|
55
|
+
"aria-relevant": "additions text",
|
|
108
56
|
children: content
|
|
109
57
|
})
|
|
110
58
|
]
|
|
111
59
|
})
|
|
112
|
-
|
|
113
|
-
})
|
|
114
|
-
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
[content, referenceElement, rest, theme.zIndex.tooltip]
|
|
63
|
+
);
|
|
115
64
|
};
|
|
116
65
|
//# sourceMappingURL=FocusableRegion.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/graphs/Chart/parts/FocusableRegion.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useState,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AACA,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useState, useContext, useMemo } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ThemeContext } from '@elliemae/ds-system';\n\nimport { StyledTooltipContainer, StyledMouseOverDetectionBox } from '../styles';\n\nexport const FocusableRegion: React.ComponentType<any> = (props) => {\n const [referenceElement, setReferenceElement] = useState<HTMLSpanElement | null>();\n const theme = useContext(ThemeContext);\n\n const { content, ...rest } = props;\n\n return useMemo(\n () => (\n <foreignObject {...rest} ref={setReferenceElement}>\n <div>\n <DSPopperJS withoutAnimation referenceElement={referenceElement} showPopover zIndex={theme.zIndex.tooltip}>\n <StyledMouseOverDetectionBox />\n <StyledTooltipContainer aria-live=\"polite\" aria-atomic=\"false\" aria-relevant=\"additions text\">\n {content}\n </StyledTooltipContainer>\n </DSPopperJS>\n </div>\n </foreignObject>\n ),\n [content, referenceElement, rest, theme.zIndex.tooltip],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AACA,mBAAqD;AACrD,yBAA2B;AAC3B,uBAA6B;AAE7B,oBAAoE;AAE7D,MAAM,kBAA4C,CAAC,UAAU;AAClE,QAAM,CAAC,kBAAkB,mBAAmB,QAAI,uBAAiC;AACjF,QAAM,YAAQ,yBAAW,6BAAY;AAErC,QAAM,EAAE,YAAY,KAAK,IAAI;AAE7B,aAAO;AAAA,IACL,MACE,4CAAC;AAAA,MAAe,GAAG;AAAA,MAAM,KAAK;AAAA,MAC5B,sDAAC;AAAA,QACC,uDAAC;AAAA,UAAW,kBAAgB;AAAA,UAAC;AAAA,UAAoC,aAAW;AAAA,UAAC,QAAQ,MAAM,OAAO;AAAA,UAChG;AAAA,wDAAC,6CAA4B;AAAA,YAC7B,4CAAC;AAAA,cAAuB,aAAU;AAAA,cAAS,eAAY;AAAA,cAAQ,iBAAc;AAAA,cAC1E;AAAA,aACH;AAAA;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IAEF,CAAC,SAAS,kBAAkB,MAAM,MAAM,OAAO,OAAO;AAAA,EACxD;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,25 +22,33 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var
|
|
26
|
-
__export(
|
|
27
|
-
|
|
25
|
+
var BottomLabel_exports = {};
|
|
26
|
+
__export(BottomLabel_exports, {
|
|
27
|
+
BottomLabel: () => BottomLabel
|
|
28
28
|
});
|
|
29
|
-
module.exports = __toCommonJS(
|
|
29
|
+
module.exports = __toCommonJS(BottomLabel_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
32
|
var import_react = require("react");
|
|
33
|
-
var import_ChartContext = require("
|
|
34
|
-
|
|
33
|
+
var import_ChartContext = require("../../ChartContext");
|
|
34
|
+
var import_styles = require("../../styles");
|
|
35
|
+
const BottomLabel = () => {
|
|
35
36
|
const {
|
|
37
|
+
internalMargin,
|
|
38
|
+
setBottomLabel,
|
|
36
39
|
innerHeight,
|
|
37
40
|
innerWidth,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} = (0, import_react.useContext)(import_ChartContext.PieChartContext);
|
|
41
|
-
const pieData = data.reduce((acc, curr) => acc[curr.name] = curr.value, {});
|
|
41
|
+
props: { xAxis }
|
|
42
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
42
43
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
43
|
-
|
|
44
|
+
ref: setBottomLabel,
|
|
45
|
+
transform: `translate(${innerWidth / 2 + internalMargin.left},${innerHeight + internalMargin.top})`,
|
|
46
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxisLabel, {
|
|
47
|
+
className: "axis-label",
|
|
48
|
+
textAnchor: "middle",
|
|
49
|
+
dy: 35,
|
|
50
|
+
children: xAxis?.label
|
|
51
|
+
})
|
|
44
52
|
});
|
|
45
53
|
};
|
|
46
|
-
//# sourceMappingURL=
|
|
54
|
+
//# sourceMappingURL=BottomLabel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/graphs/Chart/parts/Labels/BottomLabel.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledAxisLabel } from '../../styles';\n\nexport const BottomLabel = () => {\n const {\n internalMargin,\n setBottomLabel,\n innerHeight,\n innerWidth,\n props: { xAxis },\n } = useContext(ChartContext);\n\n return (\n <g\n ref={setBottomLabel}\n transform={`translate(${innerWidth / 2 + internalMargin.left},${innerHeight + internalMargin.top})`}\n >\n <StyledAxisLabel className=\"axis-label\" textAnchor=\"middle\" dy={35}>\n {xAxis?.label}\n </StyledAxisLabel>\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAA2C;AAC3C,0BAA6B;AAC7B,oBAAgC;AAEzB,MAAM,cAAc,MAAM;AAC/B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,MAAM;AAAA,EACjB,QAAI,yBAAW,gCAAY;AAE3B,SACE,4CAAC;AAAA,IACC,KAAK;AAAA,IACL,WAAW,aAAa,aAAa,IAAI,eAAe,QAAQ,cAAc,eAAe;AAAA,IAE7F,sDAAC;AAAA,MAAgB,WAAU;AAAA,MAAa,YAAW;AAAA,MAAS,IAAI;AAAA,MAC7D,iBAAO;AAAA,KACV;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var Label_exports = {};
|
|
26
|
+
__export(Label_exports, {
|
|
27
|
+
Label: () => Label
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(Label_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
var import_ChartContext = require("../../ChartContext");
|
|
34
|
+
var import_RightLabel = require("./RightLabel");
|
|
35
|
+
var import_LeftLabel = require("./LeftLabel");
|
|
36
|
+
var import_BottomLabel = require("./BottomLabel");
|
|
37
|
+
const Label = () => {
|
|
38
|
+
const {
|
|
39
|
+
props: { xAxis, yAxis, y2Axis }
|
|
40
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
41
|
+
return (0, import_react.useMemo)(
|
|
42
|
+
() => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
43
|
+
children: [
|
|
44
|
+
y2Axis?.label ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_RightLabel.RightLabel, {}) : "",
|
|
45
|
+
yAxis?.label ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LeftLabel.LeftLabel, {}) : "",
|
|
46
|
+
xAxis?.label ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_BottomLabel.BottomLabel, {}) : ""
|
|
47
|
+
]
|
|
48
|
+
}),
|
|
49
|
+
[xAxis?.label, y2Axis?.label, yAxis?.label]
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/graphs/Chart/parts/Labels/Label.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\n\nimport { ChartContext } from '../../ChartContext';\nimport { RightLabel } from './RightLabel';\nimport { LeftLabel } from './LeftLabel';\nimport { BottomLabel } from './BottomLabel';\n\nexport const Label = () => {\n const {\n props: { xAxis, yAxis, y2Axis },\n } = useContext(ChartContext);\n\n return useMemo(\n () => (\n <g>\n {y2Axis?.label ? <RightLabel /> : ''}\n {yAxis?.label ? <LeftLabel /> : ''}\n {xAxis?.label ? <BottomLabel /> : ''}\n </g>\n ),\n [xAxis?.label, y2Axis?.label, yAxis?.label],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAA2C;AAE3C,0BAA6B;AAC7B,wBAA2B;AAC3B,uBAA0B;AAC1B,yBAA4B;AAErB,MAAM,QAAQ,MAAM;AACzB,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO,OAAO,OAAO;AAAA,EAChC,QAAI,yBAAW,gCAAY;AAE3B,aAAO;AAAA,IACL,MACE,6CAAC;AAAA,MACE;AAAA,gBAAQ,QAAQ,4CAAC,gCAAW,IAAK;AAAA,QACjC,OAAO,QAAQ,4CAAC,8BAAU,IAAK;AAAA,QAC/B,OAAO,QAAQ,4CAAC,kCAAY,IAAK;AAAA;AAAA,KACpC;AAAA,IAEF,CAAC,OAAO,OAAO,QAAQ,OAAO,OAAO,KAAK;AAAA,EAC5C;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var LeftLabel_exports = {};
|
|
26
|
+
__export(LeftLabel_exports, {
|
|
27
|
+
LeftLabel: () => LeftLabel
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(LeftLabel_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
var import_ChartContext = require("../../ChartContext");
|
|
34
|
+
var import_styles = require("../../styles");
|
|
35
|
+
const LeftLabel = () => {
|
|
36
|
+
const {
|
|
37
|
+
innerHeight,
|
|
38
|
+
internalMargin,
|
|
39
|
+
setLeftLabel,
|
|
40
|
+
leftLegendWidth,
|
|
41
|
+
props: { yAxis }
|
|
42
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
44
|
+
ref: setLeftLabel,
|
|
45
|
+
transform: `translate(${leftLegendWidth > 0 ? leftLegendWidth + 8 : 0},${innerHeight / 2 + internalMargin.top}) rotate(-90)`,
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
|
|
48
|
+
height: "30",
|
|
49
|
+
width: "1",
|
|
50
|
+
fill: "transparent"
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxisLabel, {
|
|
53
|
+
className: "axis-label",
|
|
54
|
+
textAnchor: "middle",
|
|
55
|
+
dy: 15,
|
|
56
|
+
children: yAxis?.label
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=LeftLabel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/graphs/Chart/parts/Labels/LeftLabel.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledAxisLabel } from '../../styles';\n\nexport const LeftLabel = () => {\n const {\n innerHeight,\n internalMargin,\n setLeftLabel,\n leftLegendWidth,\n props: { yAxis },\n } = useContext(ChartContext);\n\n return (\n <g\n ref={setLeftLabel}\n transform={`translate(${leftLegendWidth > 0 ? leftLegendWidth + 8 : 0},${\n innerHeight / 2 + internalMargin.top\n }) rotate(-90)`}\n >\n <rect height=\"30\" width=\"1\" fill=\"transparent\" />\n <StyledAxisLabel className=\"axis-label\" textAnchor=\"middle\" dy={15}>\n {yAxis?.label}\n </StyledAxisLabel>\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAA2C;AAC3C,0BAA6B;AAC7B,oBAAgC;AAEzB,MAAM,YAAY,MAAM;AAC7B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,MAAM;AAAA,EACjB,QAAI,yBAAW,gCAAY;AAE3B,SACE,6CAAC;AAAA,IACC,KAAK;AAAA,IACL,WAAW,aAAa,kBAAkB,IAAI,kBAAkB,IAAI,KAClE,cAAc,IAAI,eAAe;AAAA,IAGnC;AAAA,kDAAC;AAAA,QAAK,QAAO;AAAA,QAAK,OAAM;AAAA,QAAI,MAAK;AAAA,OAAc;AAAA,MAC/C,4CAAC;AAAA,QAAgB,WAAU;AAAA,QAAa,YAAW;AAAA,QAAS,IAAI;AAAA,QAC7D,iBAAO;AAAA,OACV;AAAA;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var RightLabel_exports = {};
|
|
26
|
+
__export(RightLabel_exports, {
|
|
27
|
+
RightLabel: () => RightLabel
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(RightLabel_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
var import_ChartContext = require("../../ChartContext");
|
|
34
|
+
var import_styles = require("../../styles");
|
|
35
|
+
const RightLabel = () => {
|
|
36
|
+
const {
|
|
37
|
+
innerWidth,
|
|
38
|
+
innerHeight,
|
|
39
|
+
internalMargin,
|
|
40
|
+
axisRightWidth,
|
|
41
|
+
setRightLabel,
|
|
42
|
+
props: { y2Axis }
|
|
43
|
+
} = (0, import_react.useContext)(import_ChartContext.ChartContext);
|
|
44
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", {
|
|
45
|
+
ref: setRightLabel,
|
|
46
|
+
transform: `translate(${innerWidth + internalMargin.left + axisRightWidth},${innerHeight / 2 + internalMargin.top}) `,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", {
|
|
49
|
+
width: "20",
|
|
50
|
+
height: 1,
|
|
51
|
+
fill: "transparent"
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", {
|
|
54
|
+
transform: " rotate(90)",
|
|
55
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledAxisLabel, {
|
|
56
|
+
className: "axis-label",
|
|
57
|
+
textAnchor: "middle",
|
|
58
|
+
dy: "-15",
|
|
59
|
+
children: y2Axis?.label
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=RightLabel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/graphs/Chart/parts/Labels/RightLabel.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useEffect, useRef, useState } from 'react';\nimport { ChartContext } from '../../ChartContext';\nimport { StyledAxisLabel } from '../../styles';\n\nexport const RightLabel = () => {\n const {\n innerWidth,\n innerHeight,\n internalMargin,\n axisRightWidth,\n setRightLabel,\n props: { y2Axis },\n } = useContext(ChartContext);\n\n return (\n <g\n ref={setRightLabel}\n transform={`translate(${innerWidth + internalMargin.left + axisRightWidth},${\n innerHeight / 2 + internalMargin.top\n }) `}\n >\n <rect width=\"20\" height={1} fill=\"transparent\" />\n <g transform=\" rotate(90)\">\n <StyledAxisLabel className=\"axis-label\" textAnchor=\"middle\" dy=\"-15\">\n {y2Axis?.label}\n </StyledAxisLabel>\n </g>\n </g>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAA+D;AAC/D,0BAA6B;AAC7B,oBAAgC;AAEzB,MAAM,aAAa,MAAM;AAC9B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,OAAO;AAAA,EAClB,QAAI,yBAAW,gCAAY;AAE3B,SACE,6CAAC;AAAA,IACC,KAAK;AAAA,IACL,WAAW,aAAa,aAAa,eAAe,OAAO,kBACzD,cAAc,IAAI,eAAe;AAAA,IAGnC;AAAA,kDAAC;AAAA,QAAK,OAAM;AAAA,QAAK,QAAQ;AAAA,QAAG,MAAK;AAAA,OAAc;AAAA,MAC/C,4CAAC;AAAA,QAAE,WAAU;AAAA,QACX,sDAAC;AAAA,UAAgB,WAAU;AAAA,UAAa,YAAW;AAAA,UAAS,IAAG;AAAA,UAC5D,kBAAQ;AAAA,SACX;AAAA,OACF;AAAA;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|