@elliemae/ds-dataviz-pie 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/Pie.js +49 -0
- package/dist/cjs/Pie.js.map +7 -0
- package/dist/cjs/PieContext.js +44 -0
- package/dist/cjs/PieContext.js.map +7 -0
- package/dist/cjs/config/useKeyboardNavigation.js +121 -0
- package/dist/cjs/config/useKeyboardNavigation.js.map +7 -0
- package/dist/cjs/config/usePie.js +61 -0
- package/dist/cjs/config/usePie.js.map +7 -0
- package/dist/cjs/index.js +32 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/parts/ChartContainer.js +64 -0
- package/dist/cjs/parts/ChartContainer.js.map +7 -0
- package/dist/cjs/parts/ColorLegend.js +70 -0
- package/dist/cjs/parts/ColorLegend.js.map +7 -0
- package/dist/cjs/parts/Pie.js +67 -0
- package/dist/cjs/parts/Pie.js.map +7 -0
- package/dist/cjs/parts/Point.js +81 -0
- package/dist/cjs/parts/Point.js.map +7 -0
- package/dist/cjs/parts/Slice.js +103 -0
- package/dist/cjs/parts/Slice.js.map +7 -0
- package/dist/cjs/parts/Tooltip.js +55 -0
- package/dist/cjs/parts/Tooltip.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +44 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/styles.js +99 -0
- package/dist/cjs/styles.js.map +7 -0
- package/dist/esm/Pie.js +23 -0
- package/dist/esm/Pie.js.map +7 -0
- package/dist/esm/PieContext.js +18 -0
- package/dist/esm/PieContext.js.map +7 -0
- package/dist/esm/config/useKeyboardNavigation.js +95 -0
- package/dist/esm/config/useKeyboardNavigation.js.map +7 -0
- package/dist/esm/config/usePie.js +35 -0
- package/dist/esm/config/usePie.js.map +7 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/parts/ChartContainer.js +38 -0
- package/dist/esm/parts/ChartContainer.js.map +7 -0
- package/dist/esm/parts/ColorLegend.js +44 -0
- package/dist/esm/parts/ColorLegend.js.map +7 -0
- package/dist/esm/parts/Pie.js +41 -0
- package/dist/esm/parts/Pie.js.map +7 -0
- package/dist/esm/parts/Point.js +55 -0
- package/dist/esm/parts/Point.js.map +7 -0
- package/dist/esm/parts/Slice.js +77 -0
- package/dist/esm/parts/Slice.js.map +7 -0
- package/dist/esm/parts/Tooltip.js +29 -0
- package/dist/esm/parts/Tooltip.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +18 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/styles.js +73 -0
- package/dist/esm/styles.js.map +7 -0
- package/package.json +76 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useMemo, useState, useRef } from "react";
|
|
3
|
+
import { pie } from "d3";
|
|
4
|
+
const usePie = (props) => {
|
|
5
|
+
const { series, width, height, margin } = props;
|
|
6
|
+
const containerRef = useRef(null);
|
|
7
|
+
const svgRef = useRef(null);
|
|
8
|
+
const [activeSerie, setActiveSerie] = useState("");
|
|
9
|
+
const innerHeight = height - margin.top - margin.bottom;
|
|
10
|
+
const innerWidth = width - margin.left - margin.right;
|
|
11
|
+
const groups = series.map((serie) => serie.name);
|
|
12
|
+
const data = series.reduce((acc, curr) => ({ ...acc, [curr.name]: curr.data }), {});
|
|
13
|
+
const pieGenerator = pie().value(function(d) {
|
|
14
|
+
return d[1];
|
|
15
|
+
}).sort(null).padAngle(0.02);
|
|
16
|
+
const pieData = pieGenerator(Object.entries(data));
|
|
17
|
+
return useMemo(
|
|
18
|
+
() => ({
|
|
19
|
+
props,
|
|
20
|
+
innerHeight,
|
|
21
|
+
innerWidth,
|
|
22
|
+
groups,
|
|
23
|
+
svgRef,
|
|
24
|
+
containerRef,
|
|
25
|
+
activeSerie,
|
|
26
|
+
pieData,
|
|
27
|
+
setActiveSerie
|
|
28
|
+
}),
|
|
29
|
+
[props, pieData, innerHeight, innerWidth, groups, activeSerie]
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
usePie
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=usePie.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/usePie.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo, useState, useRef } from 'react';\nimport { pie } from 'd3';\n// import { useValidateTypescriptPropTypes } from '@elliemae/ds-utilities';\nimport type { DSPieT } from '../react-desc-prop-types';\n\nexport const usePie = (props: DSPieT.Props) => {\n // useValidateTypescriptPropTypes(props, propTypes);\n\n const { series, width, height, margin } = props;\n\n const containerRef = useRef(null);\n const svgRef = useRef(null);\n\n const [activeSerie, setActiveSerie] = useState('');\n\n const innerHeight = height - margin.top - margin.bottom;\n const innerWidth = width - margin.left - margin.right;\n\n const groups = series.map((serie) => serie.name);\n\n const data = series.reduce((acc, curr) => ({ ...acc, [curr.name]: curr.data }), {});\n const pieGenerator = pie()\n .value(function (d) {\n return d[1];\n })\n .sort(null)\n .padAngle(0.02);\n const pieData = pieGenerator(Object.entries(data));\n\n return useMemo(\n () => ({\n props,\n innerHeight,\n innerWidth,\n groups,\n svgRef,\n containerRef,\n activeSerie,\n pieData,\n setActiveSerie,\n }),\n [props, pieData, innerHeight, innerWidth, groups, activeSerie],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,SAAS,UAAU,cAAc;AAC1C,SAAS,WAAW;AAIb,MAAM,SAAS,CAAC,UAAwB;AAG7C,QAAM,EAAE,QAAQ,OAAO,QAAQ,OAAO,IAAI;AAE1C,QAAM,eAAe,OAAO,IAAI;AAChC,QAAM,SAAS,OAAO,IAAI;AAE1B,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,EAAE;AAEjD,QAAM,cAAc,SAAS,OAAO,MAAM,OAAO;AACjD,QAAM,aAAa,QAAQ,OAAO,OAAO,OAAO;AAEhD,QAAM,SAAS,OAAO,IAAI,CAAC,UAAU,MAAM,IAAI;AAE/C,QAAM,OAAO,OAAO,OAAO,CAAC,KAAK,UAAU,EAAE,GAAG,KAAK,CAAC,KAAK,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC;AAClF,QAAM,eAAe,IAAI,EACtB,MAAM,SAAU,GAAG;AAClB,WAAO,EAAE;AAAA,EACX,CAAC,EACA,KAAK,IAAI,EACT,SAAS,IAAI;AAChB,QAAM,UAAU,aAAa,OAAO,QAAQ,IAAI,CAAC;AAEjD,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,OAAO,SAAS,aAAa,YAAY,QAAQ,WAAW;AAAA,EAC/D;AACF;",
|
|
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 { PieChart } from './Pie';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,gBAAgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useMemo } from "react";
|
|
4
|
+
import { StyledSVGWrapper } from "../styles";
|
|
5
|
+
import { PieContext } from "../PieContext";
|
|
6
|
+
const ChartContainer = ({ children }) => {
|
|
7
|
+
const {
|
|
8
|
+
props: { width, height, margin, responsive },
|
|
9
|
+
containerRef,
|
|
10
|
+
activeSerie,
|
|
11
|
+
svgRef
|
|
12
|
+
} = useContext(PieContext);
|
|
13
|
+
const dimensions = useMemo(
|
|
14
|
+
() => responsive ? {
|
|
15
|
+
viewBox: `0 0 ${width} ${height}`
|
|
16
|
+
} : {
|
|
17
|
+
width,
|
|
18
|
+
height
|
|
19
|
+
},
|
|
20
|
+
[height, responsive, width]
|
|
21
|
+
);
|
|
22
|
+
return /* @__PURE__ */ jsx(StyledSVGWrapper, {
|
|
23
|
+
ref: containerRef,
|
|
24
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
25
|
+
ref: svgRef,
|
|
26
|
+
...dimensions,
|
|
27
|
+
children: /* @__PURE__ */ jsx("g", {
|
|
28
|
+
className: "container",
|
|
29
|
+
transform: `translate(${margin.left},${margin.top})`,
|
|
30
|
+
children
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
ChartContainer
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=ChartContainer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/ChartContainer.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { StyledSVGWrapper } from '../styles';\n\nimport { PieContext } from '../PieContext';\n// import { useKeyboardNavigation } from '../config/useKeyboardNavigation';\ninterface ChartContainerT {\n children: JSX.Element | JSX.Element[] | string | string[];\n}\nexport const ChartContainer: React.ComponentType<ChartContainerT> = ({ children }) => {\n const {\n props: { width, height, margin, responsive },\n containerRef,\n activeSerie,\n svgRef,\n } = useContext(PieContext);\n\n const dimensions = useMemo(\n () =>\n responsive\n ? {\n viewBox: `0 0 ${width} ${height}`,\n }\n : {\n width,\n height,\n },\n [height, responsive, width],\n );\n // const { onInputKeyDown, handleOnBlur, handleOnFocus } = useKeyboardNavigation();\n return (\n <StyledSVGWrapper\n ref={containerRef}\n // onKeyDown={onInputKeyDown}\n // aria-hidden=\"true\"\n // tabIndex={activeSerie ? -1 : 0}\n // onBlur={handleOnBlur}\n // onFocus={handleOnFocus}\n // onMouseDown={(e) => e.preventDefault()}\n >\n <svg ref={svgRef} {...dimensions}>\n <g className=\"container\" transform={`translate(${margin.left},${margin.top})`}>\n {children}\n </g>\n </svg>\n </StyledSVGWrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,eAAe;AAC3C,SAAS,wBAAwB;AAEjC,SAAS,kBAAkB;AAKpB,MAAM,iBAAuD,CAAC,EAAE,SAAS,MAAM;AACpF,QAAM;AAAA,IACJ,OAAO,EAAE,OAAO,QAAQ,QAAQ,WAAW;AAAA,IAC3C;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,UAAU;AAEzB,QAAM,aAAa;AAAA,IACjB,MACE,aACI;AAAA,MACE,SAAS,OAAO,SAAS;AAAA,IAC3B,IACA;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAAA,IACN,CAAC,QAAQ,YAAY,KAAK;AAAA,EAC5B;AAEA,SACE,oBAAC;AAAA,IACC,KAAK;AAAA,IAQL,8BAAC;AAAA,MAAI,KAAK;AAAA,MAAS,GAAG;AAAA,MACpB,8BAAC;AAAA,QAAE,WAAU;AAAA,QAAY,WAAW,aAAa,OAAO,QAAQ,OAAO;AAAA,QACpE;AAAA,OACH;AAAA,KACF;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { PieContext } from "../PieContext";
|
|
5
|
+
const ColorLegend = ({ tickSpacing = 20, tickSize = 10, tickTextOffset = 20 }) => {
|
|
6
|
+
const {
|
|
7
|
+
colorScale,
|
|
8
|
+
innerWidth,
|
|
9
|
+
props: { colorLegend, circleRadius }
|
|
10
|
+
} = useContext(PieContext);
|
|
11
|
+
if (!colorLegend)
|
|
12
|
+
return null;
|
|
13
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
14
|
+
transform: `translate(${innerWidth + 30},30)`,
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsx("text", {
|
|
17
|
+
x: 35,
|
|
18
|
+
y: -25,
|
|
19
|
+
className: "axis-label",
|
|
20
|
+
textAnchor: "middle",
|
|
21
|
+
children: colorLegend.label
|
|
22
|
+
}),
|
|
23
|
+
colorScale.domain().map((domainValue, i) => /* @__PURE__ */ jsxs("g", {
|
|
24
|
+
className: "tick",
|
|
25
|
+
transform: `translate(0,${i * tickSpacing})`,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx("circle", {
|
|
28
|
+
fill: colorScale(domainValue),
|
|
29
|
+
r: circleRadius ?? tickSize
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ jsx("text", {
|
|
32
|
+
x: tickTextOffset,
|
|
33
|
+
dy: ".32em",
|
|
34
|
+
children: domainValue
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
}))
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
ColorLegend
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=ColorLegend.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/ColorLegend.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { PieContext } from '../PieContext';\n\nexport const ColorLegend = ({ tickSpacing = 20, tickSize = 10, tickTextOffset = 20 }) => {\n const {\n colorScale,\n innerWidth,\n props: { colorLegend, circleRadius },\n } = useContext(PieContext);\n\n if (!colorLegend) return null;\n return (\n <g transform={`translate(${innerWidth + 30},30)`}>\n <text x={35} y={-25} className=\"axis-label\" textAnchor=\"middle\">\n {colorLegend.label}\n </text>\n {colorScale.domain().map((domainValue, i) => (\n <g className=\"tick\" transform={`translate(0,${i * tickSpacing})`}>\n <circle fill={colorScale(domainValue)} r={circleRadius ?? tickSize} />\n <text x={tickTextOffset} dy=\".32em\">\n {domainValue}\n </text>\n </g>\n ))}\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAClC,SAAS,kBAAkB;AAEpB,MAAM,cAAc,CAAC,EAAE,cAAc,IAAI,WAAW,IAAI,iBAAiB,GAAG,MAAM;AACvF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO,EAAE,aAAa,aAAa;AAAA,EACrC,IAAI,WAAW,UAAU;AAEzB,MAAI,CAAC;AAAa,WAAO;AACzB,SACE,qBAAC;AAAA,IAAE,WAAW,aAAa,aAAa;AAAA,IACtC;AAAA,0BAAC;AAAA,QAAK,GAAG;AAAA,QAAI,GAAG;AAAA,QAAK,WAAU;AAAA,QAAa,YAAW;AAAA,QACpD,sBAAY;AAAA,OACf;AAAA,MACC,WAAW,OAAO,EAAE,IAAI,CAAC,aAAa,MACrC,qBAAC;AAAA,QAAE,WAAU;AAAA,QAAO,WAAW,eAAe,IAAI;AAAA,QAChD;AAAA,8BAAC;AAAA,YAAO,MAAM,WAAW,WAAW;AAAA,YAAG,GAAG,gBAAgB;AAAA,WAAU;AAAA,UACpE,oBAAC;AAAA,YAAK,GAAG;AAAA,YAAgB,IAAG;AAAA,YACzB;AAAA,WACH;AAAA;AAAA,OACF,CACD;AAAA;AAAA,GACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
import { Slice } from "./Slice";
|
|
5
|
+
import { PieContext } from "../PieContext";
|
|
6
|
+
const Pie = () => {
|
|
7
|
+
const {
|
|
8
|
+
innerHeight,
|
|
9
|
+
innerWidth,
|
|
10
|
+
pieData,
|
|
11
|
+
props: { isHalfPie, label, innerRadius }
|
|
12
|
+
} = useContext(PieContext);
|
|
13
|
+
const radius = Math.min(innerWidth, innerHeight) / 2;
|
|
14
|
+
const currentInnerHeight = isHalfPie ? innerHeight : innerHeight / 2;
|
|
15
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
16
|
+
transform: `translate(${innerWidth / 2},${currentInnerHeight})`,
|
|
17
|
+
children: [
|
|
18
|
+
pieData.map((slice) => /* @__PURE__ */ jsx(Slice, {
|
|
19
|
+
data: slice
|
|
20
|
+
}, slice.index)),
|
|
21
|
+
!isHalfPie && label ? /* @__PURE__ */ jsx("text", {
|
|
22
|
+
x: 0,
|
|
23
|
+
y: 0,
|
|
24
|
+
textAnchor: "middle",
|
|
25
|
+
alignmentBaseline: "middle",
|
|
26
|
+
children: label
|
|
27
|
+
}) : null,
|
|
28
|
+
isHalfPie && label ? /* @__PURE__ */ jsx("text", {
|
|
29
|
+
x: 0,
|
|
30
|
+
y: -innerRadius / 4,
|
|
31
|
+
textAnchor: "middle",
|
|
32
|
+
alignmentBaseline: "middle",
|
|
33
|
+
children: label
|
|
34
|
+
}) : null
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
Pie
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=Pie.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Pie.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { Slice } from './Slice';\nimport { PieContext } from '../PieContext';\n\nexport const Pie = () => {\n const {\n innerHeight,\n innerWidth,\n pieData,\n\n props: { isHalfPie, label, innerRadius },\n } = useContext(PieContext);\n\n const radius = Math.min(innerWidth, innerHeight) / 2;\n\n const currentInnerHeight = isHalfPie ? innerHeight : innerHeight / 2;\n return (\n <g transform={`translate(${innerWidth / 2},${currentInnerHeight})`}>\n {pieData.map((slice) => (\n <Slice key={slice.index} data={slice} />\n ))}\n {!isHalfPie && label ? (\n <text x={0} y={0} textAnchor=\"middle\" alignmentBaseline=\"middle\">\n {label}\n </text>\n ) : null}\n {isHalfPie && label ? (\n <text x={0} y={-innerRadius / 4} textAnchor=\"middle\" alignmentBaseline=\"middle\">\n {label}\n </text>\n ) : null}\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAClC,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAEpB,MAAM,MAAM,MAAM;AACvB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IAEA,OAAO,EAAE,WAAW,OAAO,YAAY;AAAA,EACzC,IAAI,WAAW,UAAU;AAEzB,QAAM,SAAS,KAAK,IAAI,YAAY,WAAW,IAAI;AAEnD,QAAM,qBAAqB,YAAY,cAAc,cAAc;AACnE,SACE,qBAAC;AAAA,IAAE,WAAW,aAAa,aAAa,KAAK;AAAA,IAC1C;AAAA,cAAQ,IAAI,CAAC,UACZ,oBAAC;AAAA,QAAwB,MAAM;AAAA,SAAnB,MAAM,KAAoB,CACvC;AAAA,MACA,CAAC,aAAa,QACb,oBAAC;AAAA,QAAK,GAAG;AAAA,QAAG,GAAG;AAAA,QAAG,YAAW;AAAA,QAAS,mBAAkB;AAAA,QACrD;AAAA,OACH,IACE;AAAA,MACH,aAAa,QACZ,oBAAC;AAAA,QAAK,GAAG;AAAA,QAAG,GAAG,CAAC,cAAc;AAAA,QAAG,YAAW;AAAA,QAAS,mBAAkB;AAAA,QACpE;AAAA,OACH,IACE;AAAA;AAAA,GACN;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useMemo, useRef, useCallback } from "react";
|
|
4
|
+
import { DSTooltipV3 } from "@elliemae/ds-tooltip";
|
|
5
|
+
import { StyledPoint, StyleFocusableRegion } from "../styles";
|
|
6
|
+
import { PieContext } from "../PieContext";
|
|
7
|
+
const Point = ({ x, y, id, label, opacity }) => {
|
|
8
|
+
const {
|
|
9
|
+
activePoint,
|
|
10
|
+
props: { circleRadius, xAxis }
|
|
11
|
+
} = useContext(PieContext);
|
|
12
|
+
const isFocused = activePoint === id;
|
|
13
|
+
const focusableElement = useRef();
|
|
14
|
+
const handleRef = useCallback(
|
|
15
|
+
(newRef) => {
|
|
16
|
+
if (focusableElement.current)
|
|
17
|
+
focusableElement.current = newRef;
|
|
18
|
+
if (isFocused)
|
|
19
|
+
newRef?.focus();
|
|
20
|
+
},
|
|
21
|
+
[isFocused]
|
|
22
|
+
);
|
|
23
|
+
return useMemo(
|
|
24
|
+
() => /* @__PURE__ */ jsxs("g", {
|
|
25
|
+
transform: `translate(${x},${y})`,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx(StyledPoint, {
|
|
28
|
+
id: `${id}-mark`,
|
|
29
|
+
isFocused,
|
|
30
|
+
r: circleRadius,
|
|
31
|
+
opacity
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ jsx("foreignObject", {
|
|
34
|
+
width: circleRadius * 2,
|
|
35
|
+
height: circleRadius * 2,
|
|
36
|
+
style: { transform: `translate(-${circleRadius}px, -${circleRadius}px)` },
|
|
37
|
+
children: /* @__PURE__ */ jsx(DSTooltipV3, {
|
|
38
|
+
withoutAnimation: true,
|
|
39
|
+
text: label,
|
|
40
|
+
children: /* @__PURE__ */ jsx(StyleFocusableRegion, {
|
|
41
|
+
s: circleRadius,
|
|
42
|
+
tabIndex: -1,
|
|
43
|
+
ref: handleRef
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
}),
|
|
49
|
+
[circleRadius, handleRef, id, isFocused, label, opacity, x, y]
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
Point
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=Point.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Point.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo, useRef, useCallback } from 'react';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\nimport { StyledPoint, StyleFocusableRegion } from '../styles';\nimport { PieContext } from '../PieContext';\n\nexport const Point = ({ x, y, id, label, opacity }) => {\n const {\n activePoint,\n\n props: { circleRadius, xAxis },\n } = useContext(PieContext);\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\n return useMemo(\n () => (\n <g transform={`translate(${x},${y})`}>\n <StyledPoint id={`${id}-mark`} isFocused={isFocused} r={circleRadius} opacity={opacity}></StyledPoint>\n <foreignObject\n width={circleRadius * 2}\n height={circleRadius * 2}\n style={{ transform: `translate(-${circleRadius}px, -${circleRadius}px)` }}\n >\n <DSTooltipV3 withoutAnimation text={label}>\n <StyleFocusableRegion\n s={circleRadius}\n // aria-label={`${xValue} ${d[yValue]}`}\n tabIndex={-1}\n ref={handleRef}\n ></StyleFocusableRegion>\n </DSTooltipV3>\n </foreignObject>\n </g>\n ),\n [circleRadius, handleRef, id, isFocused, label, opacity, x, y],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,YAAY,SAAS,QAAQ,mBAAmB;AAChE,SAAS,mBAAmB;AAC5B,SAAS,aAAa,4BAA4B;AAClD,SAAS,kBAAkB;AAEpB,MAAM,QAAQ,CAAC,EAAE,GAAG,GAAG,IAAI,OAAO,QAAQ,MAAM;AACrD,QAAM;AAAA,IACJ;AAAA,IAEA,OAAO,EAAE,cAAc,MAAM;AAAA,EAC/B,IAAI,WAAW,UAAU;AAEzB,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;AAEA,SAAO;AAAA,IACL,MACE,qBAAC;AAAA,MAAE,WAAW,aAAa,KAAK;AAAA,MAC9B;AAAA,4BAAC;AAAA,UAAY,IAAI,GAAG;AAAA,UAAW;AAAA,UAAsB,GAAG;AAAA,UAAc;AAAA,SAAkB;AAAA,QACxF,oBAAC;AAAA,UACC,OAAO,eAAe;AAAA,UACtB,QAAQ,eAAe;AAAA,UACvB,OAAO,EAAE,WAAW,cAAc,oBAAoB,kBAAkB;AAAA,UAExE,8BAAC;AAAA,YAAY,kBAAgB;AAAA,YAAC,MAAM;AAAA,YAClC,8BAAC;AAAA,cACC,GAAG;AAAA,cAEH,UAAU;AAAA,cACV,KAAK;AAAA,aACN;AAAA,WACH;AAAA,SACF;AAAA;AAAA,KACF;AAAA,IAEF,CAAC,cAAc,WAAW,IAAI,WAAW,OAAO,SAAS,GAAG,CAAC;AAAA,EAC/D;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect, useMemo, useRef, useContext } from "react";
|
|
4
|
+
import { arc, select } from "d3";
|
|
5
|
+
import { PieContext } from "../PieContext";
|
|
6
|
+
import { Tooltip } from "./Tooltip";
|
|
7
|
+
const Slice = ({ data }) => {
|
|
8
|
+
const {
|
|
9
|
+
innerHeight,
|
|
10
|
+
innerWidth,
|
|
11
|
+
activeSerie,
|
|
12
|
+
setActiveSerie,
|
|
13
|
+
props: { series, innerRadius: innerRadiusProp, isHalfPie, TooltipRenderer }
|
|
14
|
+
} = useContext(PieContext);
|
|
15
|
+
const [isTooltipShown, setIsTooltipShown] = useState(false);
|
|
16
|
+
const innerRadius = innerRadiusProp ?? 0;
|
|
17
|
+
const tooltipRef = useRef(null);
|
|
18
|
+
const arcRef = useRef(null);
|
|
19
|
+
const radius = isHalfPie ? Math.min(innerWidth, innerHeight) : Math.min(innerWidth, innerHeight) / 2;
|
|
20
|
+
const { startAngle, endAngle, index, value } = data;
|
|
21
|
+
const currentStartAngle = isHalfPie ? startAngle / 2 : startAngle;
|
|
22
|
+
const currentEndAngle = isHalfPie ? endAngle / 2 : endAngle;
|
|
23
|
+
const serieData = series?.find((serie) => serie.name === data.data[0]);
|
|
24
|
+
const { color, name } = serieData;
|
|
25
|
+
const sliceData = arc().innerRadius(innerRadius).outerRadius(radius).startAngle(currentStartAngle).endAngle(currentEndAngle);
|
|
26
|
+
const deltaAngle = currentStartAngle + (currentEndAngle - currentStartAngle) / 2;
|
|
27
|
+
const x = radius * Math.sin(deltaAngle);
|
|
28
|
+
const y = -radius * Math.cos(deltaAngle);
|
|
29
|
+
const isOpen = useMemo(
|
|
30
|
+
() => activeSerie === "" && isTooltipShown || activeSerie === `${name}-${index}` && !isTooltipShown,
|
|
31
|
+
[activeSerie, index, isTooltipShown, name]
|
|
32
|
+
);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (arcRef.current) {
|
|
35
|
+
select(arcRef.current).attr("d", sliceData());
|
|
36
|
+
}
|
|
37
|
+
}, [sliceData]);
|
|
38
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
39
|
+
onMouseEnter: () => {
|
|
40
|
+
setActiveSerie("");
|
|
41
|
+
setIsTooltipShown(true);
|
|
42
|
+
},
|
|
43
|
+
onMouseLeave: (e) => {
|
|
44
|
+
setIsTooltipShown(false);
|
|
45
|
+
},
|
|
46
|
+
transform: isHalfPie ? "rotate(-90)" : "",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx("path", {
|
|
49
|
+
ref: arcRef,
|
|
50
|
+
fill: color,
|
|
51
|
+
stroke: "white"
|
|
52
|
+
}),
|
|
53
|
+
name !== "no-data" && TooltipRenderer && /* @__PURE__ */ jsx("foreignObject", {
|
|
54
|
+
x,
|
|
55
|
+
y,
|
|
56
|
+
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
57
|
+
isTooltipShown: isOpen,
|
|
58
|
+
withoutAnimation: true,
|
|
59
|
+
onFocus: () => {
|
|
60
|
+
setActiveSerie(`${name}-${index}`);
|
|
61
|
+
},
|
|
62
|
+
onBlur: () => {
|
|
63
|
+
setActiveSerie("");
|
|
64
|
+
},
|
|
65
|
+
startPlacementPreference: "bottom",
|
|
66
|
+
children: /* @__PURE__ */ jsx(TooltipRenderer, {
|
|
67
|
+
data: serieData
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
Slice
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=Slice.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Slice.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useEffect, useMemo, useRef, useContext } from 'react';\nimport { arc, select } from 'd3';\nimport { PieContext } from '../PieContext';\nimport { Tooltip } from './Tooltip';\nexport const Slice = ({ data }) => {\n const {\n innerHeight,\n innerWidth,\n activeSerie,\n setActiveSerie,\n props: { series, innerRadius: innerRadiusProp, isHalfPie, TooltipRenderer },\n } = useContext(PieContext);\n\n const [isTooltipShown, setIsTooltipShown] = useState(false);\n\n const innerRadius = innerRadiusProp ?? 0;\n const tooltipRef = useRef(null);\n const arcRef = useRef(null);\n\n const radius = isHalfPie ? Math.min(innerWidth, innerHeight) : Math.min(innerWidth, innerHeight) / 2;\n const { startAngle, endAngle, index, value } = data;\n const currentStartAngle = isHalfPie ? startAngle / 2 : startAngle;\n const currentEndAngle = isHalfPie ? endAngle / 2 : endAngle;\n\n const serieData = series?.find((serie) => serie.name === data.data[0]);\n const { color, name } = serieData;\n\n const sliceData = arc()\n .innerRadius(innerRadius)\n .outerRadius(radius)\n .startAngle(currentStartAngle)\n .endAngle(currentEndAngle);\n const deltaAngle = currentStartAngle + (currentEndAngle - currentStartAngle) / 2;\n const x = radius * Math.sin(deltaAngle);\n const y = -radius * Math.cos(deltaAngle);\n\n const isOpen = useMemo(\n () => (activeSerie === '' && isTooltipShown) || (activeSerie === `${name}-${index}` && !isTooltipShown),\n [activeSerie, index, isTooltipShown, name],\n );\n\n useEffect(() => {\n if (arcRef.current) {\n select(arcRef.current).attr('d', sliceData());\n }\n }, [sliceData]);\n\n return (\n <g\n onMouseEnter={() => {\n setActiveSerie('');\n setIsTooltipShown(true);\n }}\n onMouseLeave={(e) => {\n setIsTooltipShown(false);\n }}\n transform={isHalfPie ? 'rotate(-90)' : ''}\n >\n <path ref={arcRef} fill={color} stroke=\"white\"></path>\n {name !== 'no-data' && TooltipRenderer && (\n <foreignObject x={x} y={y}>\n <Tooltip\n isTooltipShown={isOpen}\n withoutAnimation\n onFocus={() => {\n setActiveSerie(`${name}-${index}`);\n }}\n onBlur={() => {\n setActiveSerie('');\n }}\n startPlacementPreference=\"bottom\"\n >\n <TooltipRenderer data={serieData} />\n </Tooltip>\n </foreignObject>\n )}\n\n {/* {isOpen && (\n <g>\n <circle r=\"5\" fill={color} cx={x} cy={y} stroke=\"black\" />\n </g>\n )} */}\n </g>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,UAAU,WAAW,SAAS,QAAQ,kBAAkB;AACxE,SAAS,KAAK,cAAc;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACjB,MAAM,QAAQ,CAAC,EAAE,KAAK,MAAM;AACjC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,QAAQ,aAAa,iBAAiB,WAAW,gBAAgB;AAAA,EAC5E,IAAI,WAAW,UAAU;AAEzB,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAAK;AAE1D,QAAM,cAAc,mBAAmB;AACvC,QAAM,aAAa,OAAO,IAAI;AAC9B,QAAM,SAAS,OAAO,IAAI;AAE1B,QAAM,SAAS,YAAY,KAAK,IAAI,YAAY,WAAW,IAAI,KAAK,IAAI,YAAY,WAAW,IAAI;AACnG,QAAM,EAAE,YAAY,UAAU,OAAO,MAAM,IAAI;AAC/C,QAAM,oBAAoB,YAAY,aAAa,IAAI;AACvD,QAAM,kBAAkB,YAAY,WAAW,IAAI;AAEnD,QAAM,YAAY,QAAQ,KAAK,CAAC,UAAU,MAAM,SAAS,KAAK,KAAK,EAAE;AACrE,QAAM,EAAE,OAAO,KAAK,IAAI;AAExB,QAAM,YAAY,IAAI,EACnB,YAAY,WAAW,EACvB,YAAY,MAAM,EAClB,WAAW,iBAAiB,EAC5B,SAAS,eAAe;AAC3B,QAAM,aAAa,qBAAqB,kBAAkB,qBAAqB;AAC/E,QAAM,IAAI,SAAS,KAAK,IAAI,UAAU;AACtC,QAAM,IAAI,CAAC,SAAS,KAAK,IAAI,UAAU;AAEvC,QAAM,SAAS;AAAA,IACb,MAAO,gBAAgB,MAAM,kBAAoB,gBAAgB,GAAG,QAAQ,WAAW,CAAC;AAAA,IACxF,CAAC,aAAa,OAAO,gBAAgB,IAAI;AAAA,EAC3C;AAEA,YAAU,MAAM;AACd,QAAI,OAAO,SAAS;AAClB,aAAO,OAAO,OAAO,EAAE,KAAK,KAAK,UAAU,CAAC;AAAA,IAC9C;AAAA,EACF,GAAG,CAAC,SAAS,CAAC;AAEd,SACE,qBAAC;AAAA,IACC,cAAc,MAAM;AAClB,qBAAe,EAAE;AACjB,wBAAkB,IAAI;AAAA,IACxB;AAAA,IACA,cAAc,CAAC,MAAM;AACnB,wBAAkB,KAAK;AAAA,IACzB;AAAA,IACA,WAAW,YAAY,gBAAgB;AAAA,IAEvC;AAAA,0BAAC;AAAA,QAAK,KAAK;AAAA,QAAQ,MAAM;AAAA,QAAO,QAAO;AAAA,OAAQ;AAAA,MAC9C,SAAS,aAAa,mBACrB,oBAAC;AAAA,QAAc;AAAA,QAAM;AAAA,QACnB,8BAAC;AAAA,UACC,gBAAgB;AAAA,UAChB,kBAAgB;AAAA,UAChB,SAAS,MAAM;AACb,2BAAe,GAAG,QAAQ,OAAO;AAAA,UACnC;AAAA,UACA,QAAQ,MAAM;AACZ,2BAAe,EAAE;AAAA,UACnB;AAAA,UACA,0BAAyB;AAAA,UAEzB,8BAAC;AAAA,YAAgB,MAAM;AAAA,WAAW;AAAA,SACpC;AAAA,OACF;AAAA;AAAA,GAQJ;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { DSPopperJS } from "@elliemae/ds-popperjs";
|
|
5
|
+
const Tooltip = (props) => {
|
|
6
|
+
const { children, innerRef, isTooltipShown, onFocus, onBlur, ...extraPopperJsProps } = props;
|
|
7
|
+
const [referenceElement, setReferenceElement] = useState();
|
|
8
|
+
return /* @__PURE__ */ jsx("div", {
|
|
9
|
+
onFocus,
|
|
10
|
+
onBlur,
|
|
11
|
+
tabIndex: 0,
|
|
12
|
+
ref: setReferenceElement,
|
|
13
|
+
className: "myclass",
|
|
14
|
+
children: /* @__PURE__ */ jsx(DSPopperJS, {
|
|
15
|
+
referenceElement,
|
|
16
|
+
showPopover: isTooltipShown,
|
|
17
|
+
zIndex: 3e3,
|
|
18
|
+
...extraPopperJsProps,
|
|
19
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
20
|
+
style: { backgroundColor: "white" },
|
|
21
|
+
children
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
Tooltip
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Tooltip.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useState } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\n\nexport const Tooltip: React.ComponentType<any> = (props) => {\n const { children, innerRef, isTooltipShown, onFocus, onBlur, ...extraPopperJsProps } = props;\n\n const [referenceElement, setReferenceElement] = useState<HTMLSpanElement | null>();\n\n return (\n <div onFocus={onFocus} onBlur={onBlur} tabIndex={0} ref={setReferenceElement} className=\"myclass\">\n <DSPopperJS\n referenceElement={referenceElement}\n showPopover={isTooltipShown}\n zIndex={3000}\n {...extraPopperJsProps}\n >\n <div style={{ backgroundColor: 'white' }}>{children}</div>\n </DSPopperJS>\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,gBAAgB;AAChC,SAAS,kBAAkB;AAEpB,MAAM,UAAoC,CAAC,UAAU;AAC1D,QAAM,EAAE,UAAU,UAAU,gBAAgB,SAAS,WAAW,mBAAmB,IAAI;AAEvF,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAiC;AAEjF,SACE,oBAAC;AAAA,IAAI;AAAA,IAAkB;AAAA,IAAgB,UAAU;AAAA,IAAG,KAAK;AAAA,IAAqB,WAAU;AAAA,IACtF,8BAAC;AAAA,MACC;AAAA,MACA,aAAa;AAAA,MACb,QAAQ;AAAA,MACP,GAAG;AAAA,MAEJ,8BAAC;AAAA,QAAI,OAAO,EAAE,iBAAiB,QAAQ;AAAA,QAAI;AAAA,OAAS;AAAA,KACtD;AAAA,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { globalAttributesPropTypes, PropTypes } from "@elliemae/ds-utilities";
|
|
3
|
+
const propTypes = {
|
|
4
|
+
...globalAttributesPropTypes,
|
|
5
|
+
height: PropTypes.number.isRequired.description("height").defaultValue(""),
|
|
6
|
+
width: PropTypes.number.isRequired.description("height").defaultValue(""),
|
|
7
|
+
margin: PropTypes.shape({
|
|
8
|
+
top: PropTypes.number,
|
|
9
|
+
bottom: PropTypes.number,
|
|
10
|
+
left: PropTypes.number,
|
|
11
|
+
right: PropTypes.number
|
|
12
|
+
}).isRequired.description("margin").defaultValue(""),
|
|
13
|
+
series: PropTypes.arrayOf(PropTypes.object).description("yValue").defaultValue("")
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
propTypes
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { globalAttributesPropTypes, PropTypes } from '@elliemae/ds-utilities';\n\ntype MarginT = {\n top: number;\n left: number;\n right: number;\n bottom: number;\n};\n\nexport declare namespace DSPieT {\n export interface SeriesT {\n name: string;\n data: number;\n color: string;\n }\n export interface Props {\n series: SeriesT[];\n height: number;\n width: number;\n margin: MarginT;\n }\n}\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n height: PropTypes.number.isRequired.description('height').defaultValue(''),\n width: PropTypes.number.isRequired.description('height').defaultValue(''),\n margin: PropTypes.shape({\n top: PropTypes.number,\n bottom: PropTypes.number,\n left: PropTypes.number,\n right: PropTypes.number,\n })\n .isRequired.description('margin')\n .defaultValue(''),\n series: PropTypes.arrayOf(PropTypes.object).description('yValue').defaultValue(''),\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,2BAA2B,iBAAiB;AAuB9C,MAAM,YAAY;AAAA,EACvB,GAAG;AAAA,EACH,QAAQ,UAAU,OAAO,WAAW,YAAY,QAAQ,EAAE,aAAa,EAAE;AAAA,EACzE,OAAO,UAAU,OAAO,WAAW,YAAY,QAAQ,EAAE,aAAa,EAAE;AAAA,EACxE,QAAQ,UAAU,MAAM;AAAA,IACtB,KAAK,UAAU;AAAA,IACf,QAAQ,UAAU;AAAA,IAClB,MAAM,UAAU;AAAA,IAChB,OAAO,UAAU;AAAA,EACnB,CAAC,EACE,WAAW,YAAY,QAAQ,EAC/B,aAAa,EAAE;AAAA,EAClB,QAAQ,UAAU,QAAQ,UAAU,MAAM,EAAE,YAAY,QAAQ,EAAE,aAAa,EAAE;AACnF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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: ${({ opacity }) => opacity};
|
|
61
|
+
${({ isFocused }) => isFocused ? borderCircle : ""};
|
|
62
|
+
`;
|
|
63
|
+
export {
|
|
64
|
+
StyleFocusableRegion,
|
|
65
|
+
StyledArea,
|
|
66
|
+
StyledAxis,
|
|
67
|
+
StyledGrid,
|
|
68
|
+
StyledLine,
|
|
69
|
+
StyledMark,
|
|
70
|
+
StyledPoint,
|
|
71
|
+
StyledSVGWrapper
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/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: ${({ opacity }) => opacity};\n ${({ isFocused }) => (isFocused ? borderCircle : '')};\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,aAC7B,CAAC,EAAE,QAAQ,MAAM;AAAA,IAC1B,CAAC,EAAE,UAAU,MAAO,YAAY,eAAe;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elliemae/ds-dataviz-pie",
|
|
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
|
+
}
|