@elliemae/ds-dataviz 3.6.0-next.3
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 +61 -0
- package/dist/cjs/graphs/Chart/Chart.js.map +7 -0
- package/dist/cjs/graphs/Chart/ChartContext.js +67 -0
- package/dist/cjs/graphs/Chart/ChartContext.js.map +7 -0
- package/dist/cjs/graphs/Chart/Pie.js +49 -0
- package/dist/cjs/graphs/Chart/Pie.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useChart.js +109 -0
- package/dist/cjs/graphs/Chart/config/useChart.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js +119 -0
- package/dist/cjs/graphs/Chart/config/useKeyboardNavigation.js.map +7 -0
- package/dist/cjs/graphs/Chart/config/useScales.js +107 -0
- package/dist/cjs/graphs/Chart/config/useScales.js.map +7 -0
- package/dist/cjs/graphs/Chart/helpers/index.js +83 -0
- package/dist/cjs/graphs/Chart/helpers/index.js.map +7 -0
- package/dist/cjs/graphs/Chart/index.js +26 -0
- package/dist/cjs/graphs/Chart/index.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/ActivePoint.js +83 -0
- package/dist/cjs/graphs/Chart/parts/ActivePoint.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/AxisBottom.js +86 -0
- package/dist/cjs/graphs/Chart/parts/AxisBottom.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/AxisLeft.js +79 -0
- package/dist/cjs/graphs/Chart/parts/AxisLeft.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/AxisRight.js +63 -0
- package/dist/cjs/graphs/Chart/parts/AxisRight.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js +78 -0
- package/dist/cjs/graphs/Chart/parts/ChartContainer.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/ColorLegend.js +70 -0
- package/dist/cjs/graphs/Chart/parts/ColorLegend.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js +116 -0
- package/dist/cjs/graphs/Chart/parts/FocusableRegion.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/Scrapper.js +130 -0
- package/dist/cjs/graphs/Chart/parts/Scrapper.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js +82 -0
- package/dist/cjs/graphs/Chart/parts/SeriesFactory.js.map +7 -0
- package/dist/cjs/graphs/Chart/parts/VerticalScrapper.js +138 -0
- package/dist/cjs/graphs/Chart/parts/VerticalScrapper.js.map +7 -0
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js +57 -0
- package/dist/cjs/graphs/Chart/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Area.js +73 -0
- package/dist/cjs/graphs/Chart/series/Area.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Bars.js +68 -0
- package/dist/cjs/graphs/Chart/series/Bars.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Line.js +70 -0
- package/dist/cjs/graphs/Chart/series/Line.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Pie.js +46 -0
- package/dist/cjs/graphs/Chart/series/Pie.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Point.js +67 -0
- package/dist/cjs/graphs/Chart/series/Point.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Points.js +84 -0
- package/dist/cjs/graphs/Chart/series/Points.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/Rect.js +78 -0
- package/dist/cjs/graphs/Chart/series/Rect.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/StackedBar.js +66 -0
- package/dist/cjs/graphs/Chart/series/StackedBar.js.map +7 -0
- package/dist/cjs/graphs/Chart/series/index.js +32 -0
- package/dist/cjs/graphs/Chart/series/index.js.map +7 -0
- package/dist/cjs/graphs/Chart/styles.js +123 -0
- package/dist/cjs/graphs/Chart/styles.js.map +7 -0
- package/dist/cjs/graphs/constants.js +37 -0
- package/dist/cjs/graphs/constants.js.map +7 -0
- package/dist/cjs/graphs/index.js +27 -0
- package/dist/cjs/graphs/index.js.map +7 -0
- package/dist/cjs/index.js +33 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/esm/graphs/Chart/Chart.js +35 -0
- package/dist/esm/graphs/Chart/Chart.js.map +7 -0
- package/dist/esm/graphs/Chart/ChartContext.js +41 -0
- package/dist/esm/graphs/Chart/ChartContext.js.map +7 -0
- package/dist/esm/graphs/Chart/Pie.js +23 -0
- package/dist/esm/graphs/Chart/Pie.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useChart.js +83 -0
- package/dist/esm/graphs/Chart/config/useChart.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js +93 -0
- package/dist/esm/graphs/Chart/config/useKeyboardNavigation.js.map +7 -0
- package/dist/esm/graphs/Chart/config/useScales.js +81 -0
- package/dist/esm/graphs/Chart/config/useScales.js.map +7 -0
- package/dist/esm/graphs/Chart/helpers/index.js +57 -0
- package/dist/esm/graphs/Chart/helpers/index.js.map +7 -0
- package/dist/esm/graphs/Chart/index.js +3 -0
- package/dist/esm/graphs/Chart/index.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/ActivePoint.js +57 -0
- package/dist/esm/graphs/Chart/parts/ActivePoint.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/AxisBottom.js +60 -0
- package/dist/esm/graphs/Chart/parts/AxisBottom.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/AxisLeft.js +53 -0
- package/dist/esm/graphs/Chart/parts/AxisLeft.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/AxisRight.js +37 -0
- package/dist/esm/graphs/Chart/parts/AxisRight.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/ChartContainer.js +52 -0
- package/dist/esm/graphs/Chart/parts/ChartContainer.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/ColorLegend.js +44 -0
- package/dist/esm/graphs/Chart/parts/ColorLegend.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js +90 -0
- package/dist/esm/graphs/Chart/parts/FocusableRegion.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/Scrapper.js +104 -0
- package/dist/esm/graphs/Chart/parts/Scrapper.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js +56 -0
- package/dist/esm/graphs/Chart/parts/SeriesFactory.js.map +7 -0
- package/dist/esm/graphs/Chart/parts/VerticalScrapper.js +112 -0
- package/dist/esm/graphs/Chart/parts/VerticalScrapper.js.map +7 -0
- package/dist/esm/graphs/Chart/react-desc-prop-types.js +31 -0
- package/dist/esm/graphs/Chart/react-desc-prop-types.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Area.js +47 -0
- package/dist/esm/graphs/Chart/series/Area.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Bars.js +42 -0
- package/dist/esm/graphs/Chart/series/Bars.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Line.js +44 -0
- package/dist/esm/graphs/Chart/series/Line.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Pie.js +20 -0
- package/dist/esm/graphs/Chart/series/Pie.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Point.js +41 -0
- package/dist/esm/graphs/Chart/series/Point.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Points.js +58 -0
- package/dist/esm/graphs/Chart/series/Points.js.map +7 -0
- package/dist/esm/graphs/Chart/series/Rect.js +52 -0
- package/dist/esm/graphs/Chart/series/Rect.js.map +7 -0
- package/dist/esm/graphs/Chart/series/StackedBar.js +40 -0
- package/dist/esm/graphs/Chart/series/StackedBar.js.map +7 -0
- package/dist/esm/graphs/Chart/series/index.js +9 -0
- package/dist/esm/graphs/Chart/series/index.js.map +7 -0
- package/dist/esm/graphs/Chart/styles.js +97 -0
- package/dist/esm/graphs/Chart/styles.js.map +7 -0
- package/dist/esm/graphs/constants.js +11 -0
- package/dist/esm/graphs/constants.js.map +7 -0
- package/dist/esm/graphs/index.js +4 -0
- package/dist/esm/graphs/index.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/package.json +76 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useMemo } from "react";
|
|
4
|
+
import { line, curveNatural, curveLinear } from "d3";
|
|
5
|
+
import { StyledLine } from "../styles";
|
|
6
|
+
import { Points } from "./Points";
|
|
7
|
+
import { ChartContext } from "../ChartContext";
|
|
8
|
+
const Line = ({ serie }) => {
|
|
9
|
+
const {
|
|
10
|
+
props: { xAxis },
|
|
11
|
+
xScale,
|
|
12
|
+
yScale,
|
|
13
|
+
y2Scale,
|
|
14
|
+
colorScale,
|
|
15
|
+
activeSerie,
|
|
16
|
+
setActiveSerie
|
|
17
|
+
} = useContext(ChartContext);
|
|
18
|
+
const finalYScale = serie.scale === "y2" ? y2Scale : yScale;
|
|
19
|
+
const lineTypeMap = {
|
|
20
|
+
line: curveLinear,
|
|
21
|
+
spline: curveNatural
|
|
22
|
+
};
|
|
23
|
+
const lineD3 = useMemo(
|
|
24
|
+
() => line().x((d) => xScale(d.value.x ?? xAxis?.cols?.[d.position] ?? d.position)).y((d) => finalYScale(d.value.y ?? d.value)).curve(lineTypeMap[serie.type] ?? curveLinear)(serie.data),
|
|
25
|
+
[lineTypeMap, serie.type, serie.data, xScale, xAxis?.cols, finalYScale]
|
|
26
|
+
);
|
|
27
|
+
const xTranslate = (xScale?.bandwidth?.() ?? 0) / 2;
|
|
28
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
29
|
+
transform: `translate(${xTranslate}, 0)`,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx(StyledLine, {
|
|
32
|
+
d: lineD3,
|
|
33
|
+
stroke: colorScale(serie.name)
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ jsx(Points, {
|
|
36
|
+
serie
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
Line
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=Line.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/Line.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useState } from 'react';\nimport { line, curveNatural, curveLinear } from 'd3';\nimport { StyledLine } from '../styles';\nimport { Points } from './Points';\nimport { ChartContext } from '../ChartContext';\n\nexport const Line = ({ serie }) => {\n const {\n props: { xAxis },\n xScale,\n yScale,\n y2Scale,\n colorScale,\n activeSerie,\n setActiveSerie,\n } = useContext(ChartContext);\n\n const finalYScale = serie.scale === 'y2' ? y2Scale : yScale;\n const lineTypeMap = {\n line: curveLinear,\n spline: curveNatural,\n };\n\n const lineD3 = useMemo(\n () =>\n line()\n .x((d) => xScale(d.value.x ?? xAxis?.cols?.[d.position] ?? d.position))\n .y((d) => finalYScale(d.value.y ?? d.value))\n .curve(lineTypeMap[serie.type] ?? curveLinear)(serie.data),\n [lineTypeMap, serie.type, serie.data, xScale, xAxis?.cols, finalYScale],\n );\n\n // we need to center the points and lines when\n // using them in a band axis context\n const xTranslate = (xScale?.bandwidth?.() ?? 0) / 2;\n\n return (\n <g\n transform={`translate(${xTranslate}, 0)`}\n // onMouseEnter={() => setActiveSerie(serie.key)}\n // onMouseLeave={() => setActiveSerie('')}\n >\n <StyledLine d={lineD3} stroke={colorScale(serie.name)} />\n <Points serie={serie} />\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,eAAyB;AACrD,SAAS,MAAM,cAAc,mBAAmB;AAChD,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAEtB,MAAM,OAAO,CAAC,EAAE,MAAM,MAAM;AACjC,QAAM;AAAA,IACJ,OAAO,EAAE,MAAM;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,YAAY;AAE3B,QAAM,cAAc,MAAM,UAAU,OAAO,UAAU;AACrD,QAAM,cAAc;AAAA,IAClB,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AAEA,QAAM,SAAS;AAAA,IACb,MACE,KAAK,EACF,EAAE,CAAC,MAAM,OAAO,EAAE,MAAM,KAAK,OAAO,OAAO,EAAE,aAAa,EAAE,QAAQ,CAAC,EACrE,EAAE,CAAC,MAAM,YAAY,EAAE,MAAM,KAAK,EAAE,KAAK,CAAC,EAC1C,MAAM,YAAY,MAAM,SAAS,WAAW,EAAE,MAAM,IAAI;AAAA,IAC7D,CAAC,aAAa,MAAM,MAAM,MAAM,MAAM,QAAQ,OAAO,MAAM,WAAW;AAAA,EACxE;AAIA,QAAM,cAAc,QAAQ,YAAY,KAAK,KAAK;AAElD,SACE,qBAAC;AAAA,IACC,WAAW,aAAa;AAAA,IAIxB;AAAA,0BAAC;AAAA,QAAW,GAAG;AAAA,QAAQ,QAAQ,WAAW,MAAM,IAAI;AAAA,OAAG;AAAA,MACvD,oBAAC;AAAA,QAAO;AAAA,OAAc;AAAA;AAAA,GACxB;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { PieChartContext } from "../ChartContext";
|
|
5
|
+
const Pie = () => {
|
|
6
|
+
const {
|
|
7
|
+
innerHeight,
|
|
8
|
+
innerWidth,
|
|
9
|
+
colorScale,
|
|
10
|
+
props: { data }
|
|
11
|
+
} = useContext(PieChartContext);
|
|
12
|
+
const pieData = data.reduce((acc, curr) => acc[curr.name] = curr.value, {});
|
|
13
|
+
return /* @__PURE__ */ jsx("g", {
|
|
14
|
+
transform: `translate(${innerWidth / 2},${innerHeight / 2}`
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
Pie
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=Pie.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/Pie.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { pie } from 'd3';\nimport { PieChartContext } from '../ChartContext';\n\nexport const Pie = () => {\n const {\n innerHeight,\n innerWidth,\n colorScale,\n props: { data },\n } = useContext(PieChartContext);\n\n const pieData = data.reduce((acc, curr) => (acc[curr.name] = curr.value), {});\n\n return <g transform={`translate(${innerWidth / 2},${innerHeight / 2}`}></g>;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAElC,SAAS,uBAAuB;AAEzB,MAAM,MAAM,MAAM;AACvB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,KAAK;AAAA,EAChB,IAAI,WAAW,eAAe;AAE9B,QAAM,UAAU,KAAK,OAAO,CAAC,KAAK,SAAU,IAAI,KAAK,QAAQ,KAAK,OAAQ,CAAC,CAAC;AAE5E,SAAO,oBAAC;AAAA,IAAE,WAAW,aAAa,aAAa,KAAK,cAAc;AAAA,GAAK;AACzE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useMemo } from "react";
|
|
4
|
+
import { StyledPoint } from "../styles";
|
|
5
|
+
import { ChartContext } from "../ChartContext";
|
|
6
|
+
const Point = ({ x, y, pointRadius, id, opacity }) => {
|
|
7
|
+
const {
|
|
8
|
+
activePoint,
|
|
9
|
+
setActivePoint,
|
|
10
|
+
scrapperPosY,
|
|
11
|
+
scrapperPosX,
|
|
12
|
+
props: { xAxis, withScrapper }
|
|
13
|
+
} = useContext(ChartContext);
|
|
14
|
+
const isFocused = useMemo(() => {
|
|
15
|
+
if (activePoint === id) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
if (withScrapper === "horizontal") {
|
|
19
|
+
return y === scrapperPosY;
|
|
20
|
+
}
|
|
21
|
+
if (withScrapper === "vertical") {
|
|
22
|
+
return x === scrapperPosX;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}, [activePoint, id, withScrapper, y, scrapperPosY, x, scrapperPosX]);
|
|
26
|
+
return useMemo(
|
|
27
|
+
() => /* @__PURE__ */ jsx("g", {
|
|
28
|
+
children: /* @__PURE__ */ jsx(StyledPoint, {
|
|
29
|
+
id: `${id}-mark`,
|
|
30
|
+
isFocused,
|
|
31
|
+
r: pointRadius,
|
|
32
|
+
opacity
|
|
33
|
+
})
|
|
34
|
+
}),
|
|
35
|
+
[id, isFocused, opacity, pointRadius]
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
Point
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=Point.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/Point.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { StyledPoint } from '../styles';\nimport { ChartContext } from '../ChartContext';\n\nexport const Point = ({ x, y, pointRadius, id, opacity }) => {\n const {\n activePoint,\n setActivePoint,\n scrapperPosY,\n scrapperPosX,\n props: { xAxis, withScrapper },\n } = useContext(ChartContext);\n const isFocused = useMemo(() => {\n if (activePoint === id) {\n return true;\n }\n if (withScrapper === 'horizontal') {\n return y === scrapperPosY;\n }\n if (withScrapper === 'vertical') {\n return x === scrapperPosX;\n }\n return false;\n }, [activePoint, id, withScrapper, y, scrapperPosY, x, scrapperPosX]);\n\n return useMemo(\n () => (\n <g>\n <StyledPoint id={`${id}-mark`} isFocused={isFocused} r={pointRadius} opacity={opacity}></StyledPoint>\n </g>\n ),\n [id, isFocused, opacity, pointRadius],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,eAAe;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAEtB,MAAM,QAAQ,CAAC,EAAE,GAAG,GAAG,aAAa,IAAI,QAAQ,MAAM;AAC3D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,OAAO,aAAa;AAAA,EAC/B,IAAI,WAAW,YAAY;AAC3B,QAAM,YAAY,QAAQ,MAAM;AAC9B,QAAI,gBAAgB,IAAI;AACtB,aAAO;AAAA,IACT;AACA,QAAI,iBAAiB,cAAc;AACjC,aAAO,MAAM;AAAA,IACf;AACA,QAAI,iBAAiB,YAAY;AAC/B,aAAO,MAAM;AAAA,IACf;AACA,WAAO;AAAA,EACT,GAAG,CAAC,aAAa,IAAI,cAAc,GAAG,cAAc,GAAG,YAAY,CAAC;AAEpE,SAAO;AAAA,IACL,MACE,oBAAC;AAAA,MACC,8BAAC;AAAA,QAAY,IAAI,GAAG;AAAA,QAAW;AAAA,QAAsB,GAAG;AAAA,QAAa;AAAA,OAAkB;AAAA,KACzF;AAAA,IAEF,CAAC,IAAI,WAAW,SAAS,WAAW;AAAA,EACtC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo, useContext } from "react";
|
|
4
|
+
import { Point } from "./Point";
|
|
5
|
+
import { ChartContext } from "../ChartContext";
|
|
6
|
+
import { getStackedData } from "../helpers";
|
|
7
|
+
import { FocusableRegion } from "../parts/FocusableRegion";
|
|
8
|
+
const Points = ({ serie }) => {
|
|
9
|
+
const {
|
|
10
|
+
colorScale,
|
|
11
|
+
xScale,
|
|
12
|
+
y2Scale,
|
|
13
|
+
yScale,
|
|
14
|
+
stackedData,
|
|
15
|
+
props: { xAxis, data, TooltipRenderer, types }
|
|
16
|
+
} = useContext(ChartContext);
|
|
17
|
+
const finalYScale = serie.scale === "y2" ? y2Scale : yScale;
|
|
18
|
+
const opacity = useMemo(() => types === "scatter" ? 0.8 : 1, [serie.type]);
|
|
19
|
+
return /* @__PURE__ */ jsx("g", {
|
|
20
|
+
fill: colorScale(serie.name),
|
|
21
|
+
children: serie.data.map((point, i) => {
|
|
22
|
+
const { pointRadius } = serie;
|
|
23
|
+
const serieWithStackedValues = getStackedData(stackedData, serie);
|
|
24
|
+
const deltaY = serieWithStackedValues ? serieWithStackedValues[i][0] : 0;
|
|
25
|
+
const x = point.value.x ?? xAxis?.cols?.[point.position];
|
|
26
|
+
const y = point.value.y ?? point.value;
|
|
27
|
+
const xPosition = xScale(x);
|
|
28
|
+
const yPosition = finalYScale(y + deltaY);
|
|
29
|
+
return /* @__PURE__ */ jsx("g", {
|
|
30
|
+
children: /* @__PURE__ */ jsxs("g", {
|
|
31
|
+
transform: `translate(${xPosition},${yPosition})`,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Point, {
|
|
34
|
+
pointRadius,
|
|
35
|
+
id: point.key,
|
|
36
|
+
opacity,
|
|
37
|
+
y: yPosition
|
|
38
|
+
}),
|
|
39
|
+
TooltipRenderer && /* @__PURE__ */ jsx(FocusableRegion, {
|
|
40
|
+
id: point.key,
|
|
41
|
+
width: pointRadius * 2,
|
|
42
|
+
height: pointRadius * 2,
|
|
43
|
+
pointRadius,
|
|
44
|
+
style: { transform: `translate(-${pointRadius}px, -${pointRadius}px)` },
|
|
45
|
+
content: /* @__PURE__ */ jsx(TooltipRenderer, {
|
|
46
|
+
data: [{ name: serie.name, yValue: y, xValue: x }]
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
}, point.key);
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
Points
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=Points.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/Points.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useMemo, useContext } from 'react';\nimport { Point } from './Point';\nimport { ChartContext } from '../ChartContext';\nimport { getStackedData } from '../helpers';\nimport { FocusableRegion } from '../parts/FocusableRegion';\nimport { Scrapper } from '../parts/Scrapper';\nimport { getSeriesValuesAt } from '../helpers';\nexport const Points = ({ serie }) => {\n const {\n colorScale,\n xScale,\n y2Scale,\n yScale,\n stackedData,\n props: { xAxis, data, TooltipRenderer, types },\n } = useContext(ChartContext);\n const finalYScale = serie.scale === 'y2' ? y2Scale : yScale;\n\n const opacity = useMemo(() => (types === 'scatter' ? 0.8 : 1), [serie.type]);\n return (\n <g fill={colorScale(serie.name)}>\n {serie.data.map((point, i) => {\n const { pointRadius } = serie;\n const serieWithStackedValues = getStackedData(stackedData, serie);\n const deltaY = serieWithStackedValues ? serieWithStackedValues[i][0] : 0;\n const x = point.value.x ?? xAxis?.cols?.[point.position];\n const y = point.value.y ?? point.value;\n const xPosition = xScale(x);\n const yPosition = finalYScale(y + deltaY);\n return (\n <g key={point.key}>\n <g\n transform={`translate(${xPosition},${yPosition})`}\n // onMouseEnter={() => setActiveSerie(serie.key)}\n // onMouseLeave={() => setActiveSerie('')}\n >\n <Point pointRadius={pointRadius} id={point.key} opacity={opacity} y={yPosition} />\n {TooltipRenderer && (\n <FocusableRegion\n id={point.key}\n width={pointRadius * 2}\n height={pointRadius * 2}\n pointRadius={pointRadius}\n style={{ transform: `translate(-${pointRadius}px, -${pointRadius}px)` }}\n content={<TooltipRenderer data={[{ name: serie.name, yValue: y, xValue: x }]} />}\n />\n )}\n </g>\n </g>\n );\n })}\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,SAAS,kBAAkB;AAC3C,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAGzB,MAAM,SAAS,CAAC,EAAE,MAAM,MAAM;AACnC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,OAAO,MAAM,iBAAiB,MAAM;AAAA,EAC/C,IAAI,WAAW,YAAY;AAC3B,QAAM,cAAc,MAAM,UAAU,OAAO,UAAU;AAErD,QAAM,UAAU,QAAQ,MAAO,UAAU,YAAY,MAAM,GAAI,CAAC,MAAM,IAAI,CAAC;AAC3E,SACE,oBAAC;AAAA,IAAE,MAAM,WAAW,MAAM,IAAI;AAAA,IAC3B,gBAAM,KAAK,IAAI,CAAC,OAAO,MAAM;AAC5B,YAAM,EAAE,YAAY,IAAI;AACxB,YAAM,yBAAyB,eAAe,aAAa,KAAK;AAChE,YAAM,SAAS,yBAAyB,uBAAuB,GAAG,KAAK;AACvE,YAAM,IAAI,MAAM,MAAM,KAAK,OAAO,OAAO,MAAM;AAC/C,YAAM,IAAI,MAAM,MAAM,KAAK,MAAM;AACjC,YAAM,YAAY,OAAO,CAAC;AAC1B,YAAM,YAAY,YAAY,IAAI,MAAM;AACxC,aACE,oBAAC;AAAA,QACC,+BAAC;AAAA,UACC,WAAW,aAAa,aAAa;AAAA,UAIrC;AAAA,gCAAC;AAAA,cAAM;AAAA,cAA0B,IAAI,MAAM;AAAA,cAAK;AAAA,cAAkB,GAAG;AAAA,aAAW;AAAA,YAC/E,mBACC,oBAAC;AAAA,cACC,IAAI,MAAM;AAAA,cACV,OAAO,cAAc;AAAA,cACrB,QAAQ,cAAc;AAAA,cACtB;AAAA,cACA,OAAO,EAAE,WAAW,cAAc,mBAAmB,iBAAiB;AAAA,cACtE,SAAS,oBAAC;AAAA,gBAAgB,MAAM,CAAC,EAAE,MAAM,MAAM,MAAM,QAAQ,GAAG,QAAQ,EAAE,CAAC;AAAA,eAAG;AAAA,aAChF;AAAA;AAAA,SAEJ;AAAA,SAjBM,MAAM,GAkBd;AAAA,IAEJ,CAAC;AAAA,GACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo, useCallback, useContext, useRef } from "react";
|
|
4
|
+
import { StyledMark, StyleFocusableRegion } from "../styles";
|
|
5
|
+
import { ChartContext } from "../ChartContext";
|
|
6
|
+
const Rect = ({ x, y, width, height, label, id }) => {
|
|
7
|
+
const {
|
|
8
|
+
props: { xAxis },
|
|
9
|
+
activePoint
|
|
10
|
+
} = useContext(ChartContext);
|
|
11
|
+
const isFocused = activePoint === id;
|
|
12
|
+
const focusableElement = useRef();
|
|
13
|
+
const handleRef = useCallback(
|
|
14
|
+
(newRef) => {
|
|
15
|
+
if (focusableElement.current)
|
|
16
|
+
focusableElement.current = newRef;
|
|
17
|
+
if (isFocused)
|
|
18
|
+
newRef?.focus();
|
|
19
|
+
},
|
|
20
|
+
[isFocused]
|
|
21
|
+
);
|
|
22
|
+
return useMemo(
|
|
23
|
+
() => /* @__PURE__ */ jsxs(Fragment, {
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx(StyledMark, {
|
|
26
|
+
width,
|
|
27
|
+
height,
|
|
28
|
+
isFocused
|
|
29
|
+
}),
|
|
30
|
+
/* @__PURE__ */ jsx("foreignObject", {
|
|
31
|
+
width,
|
|
32
|
+
height,
|
|
33
|
+
children: /* @__PURE__ */ jsx(StyleFocusableRegion, {
|
|
34
|
+
role: "contentinfo",
|
|
35
|
+
style: {
|
|
36
|
+
width,
|
|
37
|
+
height
|
|
38
|
+
},
|
|
39
|
+
"aria-label": `serie: ${label} x Axis:${x} y Axis: ${y}`,
|
|
40
|
+
tabIndex: -1,
|
|
41
|
+
ref: handleRef
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
}),
|
|
46
|
+
[handleRef, height, isFocused, label, width, x, y]
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
Rect
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=Rect.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/Rect.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useCallback, useContext, useRef } from 'react';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\nimport { StyledMark, StyleFocusableRegion } from '../styles';\nimport { ChartContext } from '../ChartContext';\nexport const Rect = ({ x, y, width, height, label, id }) => {\n const {\n props: { xAxis },\n activePoint,\n } = useContext(ChartContext);\n\n const isFocused = activePoint === id;\n\n const focusableElement = useRef<HTMLDivElement>();\n const handleRef = useCallback(\n (newRef: HTMLDivElement) => {\n if (focusableElement.current) focusableElement.current = newRef;\n if (isFocused) newRef?.focus();\n },\n [isFocused],\n );\n return useMemo(\n () => (\n <>\n <StyledMark width={width} height={height} isFocused={isFocused}></StyledMark>\n <foreignObject width={width} height={height}>\n {/* <DSTooltipV3 withoutAnimation text={`x: ${x} y: ${y} label: ${label}`}> */}\n <StyleFocusableRegion\n role=\"contentinfo\"\n style={{\n width,\n height,\n }}\n aria-label={`serie: ${label} x Axis:${x} y Axis: ${y}`}\n tabIndex={-1}\n ref={handleRef}\n ></StyleFocusableRegion>\n {/* </DSTooltipV3> */}\n </foreignObject>\n </>\n ),\n [handleRef, height, isFocused, label, width, x, y],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,SAAS,aAAa,YAAY,cAAc;AAEhE,SAAS,YAAY,4BAA4B;AACjD,SAAS,oBAAoB;AACtB,MAAM,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,QAAQ,OAAO,GAAG,MAAM;AAC1D,QAAM;AAAA,IACJ,OAAO,EAAE,MAAM;AAAA,IACf;AAAA,EACF,IAAI,WAAW,YAAY;AAE3B,QAAM,YAAY,gBAAgB;AAElC,QAAM,mBAAmB,OAAuB;AAChD,QAAM,YAAY;AAAA,IAChB,CAAC,WAA2B;AAC1B,UAAI,iBAAiB;AAAS,yBAAiB,UAAU;AACzD,UAAI;AAAW,gBAAQ,MAAM;AAAA,IAC/B;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AACA,SAAO;AAAA,IACL,MACE;AAAA,MACE;AAAA,4BAAC;AAAA,UAAW;AAAA,UAAc;AAAA,UAAgB;AAAA,SAAsB;AAAA,QAChE,oBAAC;AAAA,UAAc;AAAA,UAAc;AAAA,UAE3B,8BAAC;AAAA,YACC,MAAK;AAAA,YACL,OAAO;AAAA,cACL;AAAA,cACA;AAAA,YACF;AAAA,YACA,cAAY,UAAU,gBAAgB,cAAc;AAAA,YACpD,UAAU;AAAA,YACV,KAAK;AAAA,WACN;AAAA,SAEH;AAAA;AAAA,KACF;AAAA,IAEF,CAAC,WAAW,QAAQ,WAAW,OAAO,OAAO,GAAG,CAAC;AAAA,EACnD;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { Rect } from "./Rect";
|
|
5
|
+
import { ChartContext } from "../ChartContext";
|
|
6
|
+
import { getStackedData, getStackedIndex } from "../helpers";
|
|
7
|
+
const StackedBar = ({ serie }) => {
|
|
8
|
+
const {
|
|
9
|
+
props: { xAxis, groups },
|
|
10
|
+
xScale,
|
|
11
|
+
yScale,
|
|
12
|
+
stackedData,
|
|
13
|
+
subGroupScale,
|
|
14
|
+
colorScale
|
|
15
|
+
} = useContext(ChartContext);
|
|
16
|
+
const serieWithStackedValues = getStackedData(stackedData, serie);
|
|
17
|
+
const stackIndex = getStackedIndex(groups, serie.name);
|
|
18
|
+
return /* @__PURE__ */ jsx("g", {
|
|
19
|
+
children: serieWithStackedValues.map((sequence, i) => {
|
|
20
|
+
const width = subGroupScale.bandwidth();
|
|
21
|
+
const height = yScale(sequence[0]) - yScale(sequence[1]);
|
|
22
|
+
return /* @__PURE__ */ jsx("g", {
|
|
23
|
+
fill: colorScale(serie.name),
|
|
24
|
+
transform: `translate(${xScale(xAxis?.cols?.[i] ?? i) + subGroupScale(`stacked-data-${stackIndex}`)},${yScale(sequence[1])})`,
|
|
25
|
+
children: /* @__PURE__ */ jsx(Rect, {
|
|
26
|
+
width,
|
|
27
|
+
height,
|
|
28
|
+
x: serie.data[i].position,
|
|
29
|
+
y: sequence[1],
|
|
30
|
+
id: serie.data[i].key,
|
|
31
|
+
label: serie.name
|
|
32
|
+
})
|
|
33
|
+
}, serie.data[i].key);
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
StackedBar
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=StackedBar.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/StackedBar.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\n\nimport { Rect } from './Rect';\nimport { ChartContext } from '../ChartContext';\nimport { getStackedData, getStackedIndex } from '../helpers';\nexport const StackedBar = ({ serie }) => {\n const {\n props: { xAxis, groups },\n xScale,\n yScale,\n stackedData,\n subGroupScale,\n colorScale,\n } = useContext(ChartContext);\n\n const serieWithStackedValues = getStackedData(stackedData, serie);\n const stackIndex = getStackedIndex(groups, serie.name);\n return (\n <g>\n {serieWithStackedValues.map((sequence, i) => {\n const width = subGroupScale.bandwidth();\n const height = yScale(sequence[0]) - yScale(sequence[1]);\n return (\n <g\n key={serie.data[i].key}\n fill={colorScale(serie.name)}\n transform={`translate(${\n xScale(xAxis?.cols?.[i] ?? i) + subGroupScale(`stacked-data-${stackIndex}`)\n },${yScale(sequence[1])})`}\n >\n <Rect\n width={width}\n height={height}\n x={serie.data[i].position}\n y={sequence[1]}\n id={serie.data[i].key}\n label={serie.name}\n />\n </g>\n );\n })}\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAElC,SAAS,YAAY;AACrB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB,uBAAuB;AACzC,MAAM,aAAa,CAAC,EAAE,MAAM,MAAM;AACvC,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO,OAAO;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,YAAY;AAE3B,QAAM,yBAAyB,eAAe,aAAa,KAAK;AAChE,QAAM,aAAa,gBAAgB,QAAQ,MAAM,IAAI;AACrD,SACE,oBAAC;AAAA,IACE,iCAAuB,IAAI,CAAC,UAAU,MAAM;AAC3C,YAAM,QAAQ,cAAc,UAAU;AACtC,YAAM,SAAS,OAAO,SAAS,EAAE,IAAI,OAAO,SAAS,EAAE;AACvD,aACE,oBAAC;AAAA,QAEC,MAAM,WAAW,MAAM,IAAI;AAAA,QAC3B,WAAW,aACT,OAAO,OAAO,OAAO,MAAM,CAAC,IAAI,cAAc,gBAAgB,YAAY,KACxE,OAAO,SAAS,EAAE;AAAA,QAEtB,8BAAC;AAAA,UACC;AAAA,UACA;AAAA,UACA,GAAG,MAAM,KAAK,GAAG;AAAA,UACjB,GAAG,SAAS;AAAA,UACZ,IAAI,MAAM,KAAK,GAAG;AAAA,UAClB,OAAO,MAAM;AAAA,SACf;AAAA,SAbK,MAAM,KAAK,GAAG,GAcrB;AAAA,IAEJ,CAAC;AAAA,GACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/graphs/Chart/series/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './Rect';\nexport * from './Bars';\nexport * from './StackedBar';\nexport * from './Points';\nexport * from './Line';\nexport * from './Area';\nexport * from './Pie';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { styled, css } from "@elliemae/ds-system";
|
|
3
|
+
const StyledSVGWrapper = styled.div`
|
|
4
|
+
:focus {
|
|
5
|
+
outline: none;
|
|
6
|
+
}
|
|
7
|
+
:focus-within {
|
|
8
|
+
outline: none;
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
const StyledAxis = styled("g")`
|
|
12
|
+
text {
|
|
13
|
+
fill: #635f5d;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
text.axis-label {
|
|
17
|
+
font-size: 2.5em;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.tick text {
|
|
21
|
+
${({ color }) => color ? `fill: ${color}` : ""}
|
|
22
|
+
}
|
|
23
|
+
.tick line {
|
|
24
|
+
${({ color }) => color ? `stroke: ${color}` : ""}
|
|
25
|
+
}
|
|
26
|
+
line {
|
|
27
|
+
stroke: #c0c0bb;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
const StyledGrid = styled("g")`
|
|
31
|
+
line {
|
|
32
|
+
stroke: #c0c0bb;
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
const borderCircle = css`
|
|
36
|
+
stroke: red;
|
|
37
|
+
stroke-width: 2;
|
|
38
|
+
`;
|
|
39
|
+
const StyledMark = styled("rect")`
|
|
40
|
+
${({ isFocused }) => isFocused ? borderCircle : ""};
|
|
41
|
+
`;
|
|
42
|
+
const StyleFocusableRegion = styled("div")`
|
|
43
|
+
width: ${({ s }) => s * 2}px;
|
|
44
|
+
height: ${({ s }) => s * 2}px;
|
|
45
|
+
:focus {
|
|
46
|
+
outline: none;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
const StyledLine = styled("path")`
|
|
50
|
+
fill: none;
|
|
51
|
+
stroke-width: ${({ isActiveLine }) => isActiveLine ? 5 : 3};
|
|
52
|
+
stroke-linejoin: round;
|
|
53
|
+
`;
|
|
54
|
+
const StyledArea = styled("path")`
|
|
55
|
+
stroke-width: ${({ isActiveLine }) => isActiveLine ? 5 : 3};
|
|
56
|
+
stroke-linejoin: round;
|
|
57
|
+
opacity: 0.8;
|
|
58
|
+
`;
|
|
59
|
+
const StyledPoint = styled("circle")`
|
|
60
|
+
//opacity: ${({ isFocused }) => isFocused ? 1 : 0};
|
|
61
|
+
${({ isFocused }) => isFocused ? borderCircle : ""};
|
|
62
|
+
`;
|
|
63
|
+
const StyledTooltipContainer = styled.div`
|
|
64
|
+
text-align: center;
|
|
65
|
+
min-width: ${({ theme }) => theme.space.l};
|
|
66
|
+
max-width: 250px;
|
|
67
|
+
min-height: 30px;
|
|
68
|
+
display: grid;
|
|
69
|
+
align-items: center;
|
|
70
|
+
padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xs}`};
|
|
71
|
+
position: relative;
|
|
72
|
+
background-color: white;
|
|
73
|
+
border-radius: 2px;
|
|
74
|
+
font-size: 13px;
|
|
75
|
+
color: ${({ theme }) => theme.colors.neutral[600]};
|
|
76
|
+
`;
|
|
77
|
+
const StyledMouseOverDetectionBox = styled.div`
|
|
78
|
+
position: absolute;
|
|
79
|
+
top: -15px;
|
|
80
|
+
right: -15px;
|
|
81
|
+
width: calc(100% + 30px);
|
|
82
|
+
height: calc(100% + 30px);
|
|
83
|
+
z-index: -1;
|
|
84
|
+
`;
|
|
85
|
+
export {
|
|
86
|
+
StyleFocusableRegion,
|
|
87
|
+
StyledArea,
|
|
88
|
+
StyledAxis,
|
|
89
|
+
StyledGrid,
|
|
90
|
+
StyledLine,
|
|
91
|
+
StyledMark,
|
|
92
|
+
StyledMouseOverDetectionBox,
|
|
93
|
+
StyledPoint,
|
|
94
|
+
StyledSVGWrapper,
|
|
95
|
+
StyledTooltipContainer
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/graphs/Chart/styles.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css } from '@elliemae/ds-system';\n\nexport const StyledSVGWrapper = styled.div`\n :focus {\n outline: none;\n }\n :focus-within {\n outline: none;\n }\n`;\n\nexport const StyledAxis = styled('g')`\n text {\n fill: #635f5d;\n }\n\n text.axis-label {\n font-size: 2.5em;\n }\n\n .tick text {\n ${({ color }) => (color ? `fill: ${color}` : '')}\n }\n .tick line {\n ${({ color }) => (color ? `stroke: ${color}` : '')}\n }\n line {\n stroke: #c0c0bb;\n }\n`;\n\nexport const StyledGrid = styled('g')`\n line {\n stroke: #c0c0bb;\n }\n`;\n\nconst borderCircle = css`\n stroke: red;\n stroke-width: 2;\n`;\nexport const StyledMark = styled('rect')<{ isFocused: boolean }>`\n ${({ isFocused }) => (isFocused ? borderCircle : '')};\n`;\n\nexport const StyleFocusableRegion = styled('div')<{ s: number }>`\n width: ${({ s }) => s * 2 ?? '1'}px;\n height: ${({ s }) => s * 2 ?? '1'}px;\n :focus {\n outline: none;\n }\n`;\n\nexport const StyledLine = styled('path')`\n fill: none;\n stroke-width: ${({ isActiveLine }) => (isActiveLine ? 5 : 3)};\n stroke-linejoin: round;\n`;\nexport const StyledArea = styled('path')`\n stroke-width: ${({ isActiveLine }) => (isActiveLine ? 5 : 3)};\n stroke-linejoin: round;\n opacity: 0.8;\n`;\n\nexport const StyledPoint = styled('circle')<{ isFocused: boolean }>`\n //opacity: ${({ isFocused }) => (isFocused ? 1 : 0)};\n ${({ isFocused }) => (isFocused ? borderCircle : '')};\n`;\n\nexport const StyledTooltipContainer = styled.div`\n text-align: center;\n min-width: ${({ theme }) => theme.space.l};\n max-width: 250px;\n min-height: 30px;\n display: grid;\n align-items: center;\n padding: ${({ theme }) => `${theme.space.xxxs} ${theme.space.xs}`};\n position: relative;\n background-color: white;\n border-radius: 2px;\n font-size: 13px;\n color: ${({ theme }) => theme.colors.neutral[600]};\n`;\n\nexport const StyledMouseOverDetectionBox = styled.div`\n position: absolute;\n top: -15px;\n right: -15px;\n width: calc(100% + 30px);\n height: calc(100% + 30px);\n z-index: -1;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,WAAW;AAErB,MAAM,mBAAmB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAShC,MAAM,aAAa,OAAO,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAU9B,CAAC,EAAE,MAAM,MAAO,QAAQ,SAAS,UAAU;AAAA;AAAA;AAAA,MAG3C,CAAC,EAAE,MAAM,MAAO,QAAQ,WAAW,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAO5C,MAAM,aAAa,OAAO,GAAG;AAAA;AAAA;AAAA;AAAA;AAMpC,MAAM,eAAe;AAAA;AAAA;AAAA;AAId,MAAM,aAAa,OAAO,MAAM;AAAA,IACnC,CAAC,EAAE,UAAU,MAAO,YAAY,eAAe;AAAA;AAG5C,MAAM,uBAAuB,OAAO,KAAK;AAAA,WACrC,CAAC,EAAE,EAAE,MAAM,IAAI;AAAA,YACd,CAAC,EAAE,EAAE,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAMpB,MAAM,aAAa,OAAO,MAAM;AAAA;AAAA,kBAErB,CAAC,EAAE,aAAa,MAAO,eAAe,IAAI;AAAA;AAAA;AAGrD,MAAM,aAAa,OAAO,MAAM;AAAA,kBACrB,CAAC,EAAE,aAAa,MAAO,eAAe,IAAI;AAAA;AAAA;AAAA;AAKrD,MAAM,cAAc,OAAO,QAAQ;AAAA,eAC3B,CAAC,EAAE,UAAU,MAAO,YAAY,IAAI;AAAA,IAC/C,CAAC,EAAE,UAAU,MAAO,YAAY,eAAe;AAAA;AAG5C,MAAM,yBAAyB,OAAO;AAAA;AAAA,eAE9B,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,aAK7B,CAAC,EAAE,MAAM,MAAM,GAAG,MAAM,MAAM,QAAQ,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,WAKpD,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ;AAAA;AAGxC,MAAM,8BAA8B,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { format, timeFormat } from "d3";
|
|
3
|
+
const TICK_FORMATS = {
|
|
4
|
+
MILLIONS: (v) => format(".2s")(v).replace("G", "B"),
|
|
5
|
+
KSEPARATOR: (v) => format(",")(v),
|
|
6
|
+
TIME: (userFormat) => (v) => timeFormat(userFormat)(v)
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
TICK_FORMATS
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/graphs/constants.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { format, timeFormat } from 'd3';\n\nexport const TICK_FORMATS = {\n MILLIONS: (v) => format('.2s')(v).replace('G', 'B'),\n KSEPARATOR: (v) => format(',')(v),\n TIME: (userFormat: string) => (v) => timeFormat(userFormat)(v),\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,kBAAkB;AAE5B,MAAM,eAAe;AAAA,EAC1B,UAAU,CAAC,MAAM,OAAO,KAAK,EAAE,CAAC,EAAE,QAAQ,KAAK,GAAG;AAAA,EAClD,YAAY,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC;AAAA,EAChC,MAAM,CAAC,eAAuB,CAAC,MAAM,WAAW,UAAU,EAAE,CAAC;AAC/D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/graphs/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './Chart';\nexport * from './constants';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,cAAc;AACd,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { Chart, TICK_FORMATS } from './graphs';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,OAAO,oBAAoB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elliemae/ds-dataviz",
|
|
3
|
+
"version": "3.6.0-next.3",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "ICE MT - Dimsum - DataViz",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"*.css",
|
|
20
|
+
"*.scss"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"pnpm": ">=6",
|
|
28
|
+
"node": ">=16"
|
|
29
|
+
},
|
|
30
|
+
"author": "ICE MT",
|
|
31
|
+
"jestSonar": {
|
|
32
|
+
"sonar56x": true,
|
|
33
|
+
"reportPath": "reports",
|
|
34
|
+
"reportFile": "tests.xml",
|
|
35
|
+
"indent": 4
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@elliemae/ds-grid": "3.6.0-next.3",
|
|
39
|
+
"@elliemae/ds-icon": "3.6.0-next.3",
|
|
40
|
+
"@elliemae/ds-icons": "3.6.0-next.3",
|
|
41
|
+
"@elliemae/ds-popperjs": "3.6.0-next.3",
|
|
42
|
+
"@elliemae/ds-system": "3.6.0-next.3",
|
|
43
|
+
"@elliemae/ds-tooltip": "3.6.0-next.3",
|
|
44
|
+
"@elliemae/ds-utilities": "3.6.0-next.3",
|
|
45
|
+
"d3": "~7.4.4"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@elliemae/pui-theme": "~2.6.0",
|
|
49
|
+
"@testing-library/dom": "~8.13.0",
|
|
50
|
+
"@testing-library/jest-dom": "~5.16.4",
|
|
51
|
+
"@testing-library/react": "~12.1.3",
|
|
52
|
+
"@testing-library/user-event": "~13.5.0",
|
|
53
|
+
"@types/d3": "~7.4.0",
|
|
54
|
+
"styled-components": "~5.3.5",
|
|
55
|
+
"styled-system": "~5.1.5"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"@elliemae/pui-theme": "~2.6.0",
|
|
59
|
+
"react": "^17.0.2",
|
|
60
|
+
"react-dom": "^17.0.2",
|
|
61
|
+
"styled-components": "^5.3.5",
|
|
62
|
+
"styled-system": "^5.1.5"
|
|
63
|
+
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public",
|
|
66
|
+
"typeSafety": false
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
70
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
71
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
72
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
73
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs",
|
|
74
|
+
"checkDeps": "npx -yes ../ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
75
|
+
}
|
|
76
|
+
}
|