@d3plus/docs 3.0.0-alpha.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/.storybook/main.js +51 -0
- package/.storybook/manager-head.html +46 -0
- package/.storybook/manager.js +10 -0
- package/.storybook/preview-head.html +69 -0
- package/.storybook/preview.jsx +134 -0
- package/.storybook/theme.js +16 -0
- package/README.md +1 -0
- package/args/color/colorAdd.args.jsx +71 -0
- package/args/color/colorAssign.args.jsx +40 -0
- package/args/color/colorContrast.args.jsx +40 -0
- package/args/color/colorDefaults.args.jsx +8 -0
- package/args/color/colorLegible.args.jsx +24 -0
- package/args/color/colorLighter.args.jsx +40 -0
- package/args/color/colorSubtract.args.jsx +71 -0
- package/args/core/charts/AreaPlot.args.jsx +72 -0
- package/args/core/charts/BarChart.args.jsx +88 -0
- package/args/core/charts/BoxWhisker.args.jsx +73 -0
- package/args/core/charts/BumpChart.args.jsx +133 -0
- package/args/core/charts/Donut.args.jsx +58 -0
- package/args/core/charts/Geomap.args.jsx +363 -0
- package/args/core/charts/LinePlot.args.jsx +57 -0
- package/args/core/charts/Matrix.args.jsx +194 -0
- package/args/core/charts/Network.args.jsx +310 -0
- package/args/core/charts/Pack.args.jsx +171 -0
- package/args/core/charts/Pie.args.jsx +148 -0
- package/args/core/charts/Plot.args.jsx +685 -0
- package/args/core/charts/Priestley.args.jsx +118 -0
- package/args/core/charts/Radar.args.jsx +120 -0
- package/args/core/charts/RadialMatrix.args.jsx +197 -0
- package/args/core/charts/Rings.args.jsx +228 -0
- package/args/core/charts/Sankey.args.jsx +248 -0
- package/args/core/charts/StackedArea.args.jsx +26 -0
- package/args/core/charts/Tree.args.jsx +88 -0
- package/args/core/charts/Treemap.args.jsx +181 -0
- package/args/core/charts/Viz.args.jsx +1383 -0
- package/args/core/components/Axis.args.jsx +600 -0
- package/args/core/components/AxisBottom.args.jsx +42 -0
- package/args/core/components/AxisLeft.args.jsx +42 -0
- package/args/core/components/AxisRight.args.jsx +42 -0
- package/args/core/components/AxisTop.args.jsx +42 -0
- package/args/core/components/ColorScale.args.jsx +456 -0
- package/args/core/components/Legend.args.jsx +289 -0
- package/args/core/components/TextBox.args.jsx +554 -0
- package/args/core/components/Timeline.args.jsx +401 -0
- package/args/core/components/Tooltip.args.jsx +453 -0
- package/args/core/shapes/Area.args.jsx +190 -0
- package/args/core/shapes/Bar.args.jsx +176 -0
- package/args/core/shapes/Box.args.jsx +248 -0
- package/args/core/shapes/Circle.args.jsx +84 -0
- package/args/core/shapes/Image.args.jsx +177 -0
- package/args/core/shapes/Line.args.jsx +127 -0
- package/args/core/shapes/Path.args.jsx +84 -0
- package/args/core/shapes/Rect.args.jsx +85 -0
- package/args/core/shapes/Shape.args.jsx +633 -0
- package/args/core/shapes/Whisker.args.jsx +204 -0
- package/args/core/utils/BaseClass.args.jsx +65 -0
- package/args/core/utils/RESET.args.jsx +8 -0
- package/args/core/utils/accessor.args.jsx +39 -0
- package/args/core/utils/configPrep.args.jsx +56 -0
- package/args/core/utils/constant.args.jsx +24 -0
- package/args/core/utils/uuid.args.jsx +8 -0
- package/args/data/dataConcat.args.jsx +40 -0
- package/args/data/dataFold.args.jsx +56 -0
- package/args/data/dataLoad.args.jsx +65 -0
- package/args/data/isData.args.jsx +24 -0
- package/args/data/merge.args.jsx +39 -0
- package/args/data/unique.args.jsx +37 -0
- package/args/dom/assign.args.jsx +23 -0
- package/args/dom/attrize.args.jsx +39 -0
- package/args/dom/date.args.jsx +23 -0
- package/args/dom/elem.args.jsx +135 -0
- package/args/dom/fontExists.args.jsx +24 -0
- package/args/dom/htmlDecode.args.jsx +23 -0
- package/args/dom/isObject.args.jsx +23 -0
- package/args/dom/parseSides.args.jsx +24 -0
- package/args/dom/prefix.args.jsx +8 -0
- package/args/dom/rtl.args.jsx +8 -0
- package/args/dom/stylize.args.jsx +39 -0
- package/args/dom/textWidth.args.jsx +39 -0
- package/args/export/saveElement.args.jsx +99 -0
- package/args/format/format.args.jsx +24 -0
- package/args/format/formatAbbreviate.args.jsx +39 -0
- package/args/format/formatDate.args.jsx +53 -0
- package/args/format/formatDefaultLocale.args.jsx +24 -0
- package/args/locales/dictionaries/formatLocale.args.jsx +8 -0
- package/args/math/closest.args.jsx +39 -0
- package/args/math/largestRect.args.jsx +56 -0
- package/args/math/lineIntersection.args.jsx +69 -0
- package/args/math/path2polygon.args.jsx +40 -0
- package/args/math/pointDistance.args.jsx +39 -0
- package/args/math/pointDistanceSquared.args.jsx +39 -0
- package/args/math/pointRotate.args.jsx +55 -0
- package/args/math/polygonInside.args.jsx +39 -0
- package/args/math/polygonRayCast.args.jsx +55 -0
- package/args/math/polygonRotate.args.jsx +55 -0
- package/args/math/segmentBoxContains.args.jsx +54 -0
- package/args/math/segmentsIntersect.args.jsx +69 -0
- package/args/math/shapeEdgePoint.args.jsx +39 -0
- package/args/react/D3plusContext.args.jsx +8 -0
- package/args/react/Renderer.args.jsx +53 -0
- package/args/text/fontFamily.args.jsx +8 -0
- package/args/text/fontFamilyStringify.args.jsx +23 -0
- package/args/text/stringify.args.jsx +23 -0
- package/args/text/strip.args.jsx +38 -0
- package/args/text/textSplit.args.jsx +23 -0
- package/args/text/textWrap.args.jsx +8 -0
- package/args/text/titleCase.args.jsx +24 -0
- package/args/text/trim.args.jsx +23 -0
- package/args/text/trimLeft.args.jsx +23 -0
- package/args/text/trimRight.args.jsx +23 -0
- package/docs/Accessibility.mdx +70 -0
- package/docs/HomeChart.jsx +38 -0
- package/docs/Introduction.mdx +130 -0
- package/docs/Logo-Frames.js +352 -0
- package/docs/Logo.jsx +30 -0
- package/helpers/configify.js +18 -0
- package/helpers/funcify.js +14 -0
- package/helpers/stringify.js +30 -0
- package/package.json +44 -0
- package/packages/color/colorAdd.stories.jsx +23 -0
- package/packages/color/colorAssign.stories.jsx +23 -0
- package/packages/color/colorContrast.stories.jsx +23 -0
- package/packages/color/colorDefaults.stories.jsx +23 -0
- package/packages/color/colorLegible.stories.jsx +23 -0
- package/packages/color/colorLighter.stories.jsx +23 -0
- package/packages/color/colorSubtract.stories.jsx +23 -0
- package/packages/core/charts/AreaPlot.stories.jsx +74 -0
- package/packages/core/charts/BarChart.stories.jsx +307 -0
- package/packages/core/charts/BoxWhisker.stories.jsx +204 -0
- package/packages/core/charts/BumpChart.stories.jsx +52 -0
- package/packages/core/charts/Donut.stories.jsx +41 -0
- package/packages/core/charts/Geomap.stories.jsx +186 -0
- package/packages/core/charts/LinePlot.stories.jsx +564 -0
- package/packages/core/charts/Matrix.stories.jsx +36 -0
- package/packages/core/charts/Network.stories.jsx +99 -0
- package/packages/core/charts/Pack.stories.jsx +40 -0
- package/packages/core/charts/Pie.stories.jsx +40 -0
- package/packages/core/charts/Plot.stories.jsx +180 -0
- package/packages/core/charts/Priestley.stories.jsx +60 -0
- package/packages/core/charts/Radar.stories.jsx +60 -0
- package/packages/core/charts/RadialMatrix.stories.jsx +36 -0
- package/packages/core/charts/Rings.stories.jsx +41 -0
- package/packages/core/charts/Sankey.stories.jsx +41 -0
- package/packages/core/charts/StackedArea.stories.jsx +107 -0
- package/packages/core/charts/Tree.stories.jsx +27 -0
- package/packages/core/charts/Treemap.stories.jsx +81 -0
- package/packages/core/charts/Viz.stories.jsx +27 -0
- package/packages/core/components/Axis.stories.jsx +27 -0
- package/packages/core/components/AxisBottom.stories.jsx +27 -0
- package/packages/core/components/AxisLeft.stories.jsx +27 -0
- package/packages/core/components/AxisRight.stories.jsx +27 -0
- package/packages/core/components/AxisTop.stories.jsx +27 -0
- package/packages/core/components/ColorScale.stories.jsx +44 -0
- package/packages/core/components/Legend.stories.jsx +49 -0
- package/packages/core/components/TextBox.stories.jsx +222 -0
- package/packages/core/components/Timeline.stories.jsx +37 -0
- package/packages/core/components/Tooltip.stories.jsx +40 -0
- package/packages/core/shapes/Area.stories.jsx +27 -0
- package/packages/core/shapes/Bar.stories.jsx +27 -0
- package/packages/core/shapes/Box.stories.jsx +27 -0
- package/packages/core/shapes/Circle.stories.jsx +27 -0
- package/packages/core/shapes/Image.stories.jsx +27 -0
- package/packages/core/shapes/Line.stories.jsx +27 -0
- package/packages/core/shapes/Path.stories.jsx +27 -0
- package/packages/core/shapes/Rect.stories.jsx +27 -0
- package/packages/core/shapes/Shape.stories.jsx +27 -0
- package/packages/core/shapes/Whisker.stories.jsx +27 -0
- package/packages/core/utils/BaseClass.stories.jsx +27 -0
- package/packages/core/utils/RESET.stories.jsx +23 -0
- package/packages/core/utils/accessor.stories.jsx +23 -0
- package/packages/core/utils/configPrep.stories.jsx +23 -0
- package/packages/core/utils/constant.stories.jsx +23 -0
- package/packages/core/utils/uuid.stories.jsx +23 -0
- package/packages/data/dataConcat.stories.jsx +23 -0
- package/packages/data/dataFold.stories.jsx +23 -0
- package/packages/data/dataLoad.stories.jsx +23 -0
- package/packages/data/isData.stories.jsx +23 -0
- package/packages/data/merge.stories.jsx +23 -0
- package/packages/data/unique.stories.jsx +23 -0
- package/packages/dom/assign.stories.jsx +23 -0
- package/packages/dom/attrize.stories.jsx +23 -0
- package/packages/dom/date.stories.jsx +23 -0
- package/packages/dom/elem.stories.jsx +23 -0
- package/packages/dom/fontExists.stories.jsx +23 -0
- package/packages/dom/htmlDecode.stories.jsx +23 -0
- package/packages/dom/isObject.stories.jsx +23 -0
- package/packages/dom/parseSides.stories.jsx +23 -0
- package/packages/dom/prefix.stories.jsx +23 -0
- package/packages/dom/rtl.stories.jsx +23 -0
- package/packages/dom/stylize.stories.jsx +23 -0
- package/packages/dom/textWidth.stories.jsx +23 -0
- package/packages/export/saveElement.stories.jsx +23 -0
- package/packages/format/format.stories.jsx +23 -0
- package/packages/format/formatAbbreviate.stories.jsx +23 -0
- package/packages/format/formatDate.stories.jsx +23 -0
- package/packages/format/formatDefaultLocale.stories.jsx +23 -0
- package/packages/locales/dictionaries/formatLocale.stories.jsx +23 -0
- package/packages/math/closest.stories.jsx +23 -0
- package/packages/math/largestRect.stories.jsx +23 -0
- package/packages/math/lineIntersection.stories.jsx +23 -0
- package/packages/math/path2polygon.stories.jsx +23 -0
- package/packages/math/pointDistance.stories.jsx +23 -0
- package/packages/math/pointDistanceSquared.stories.jsx +23 -0
- package/packages/math/pointRotate.stories.jsx +23 -0
- package/packages/math/polygonInside.stories.jsx +23 -0
- package/packages/math/polygonRayCast.stories.jsx +23 -0
- package/packages/math/polygonRotate.stories.jsx +23 -0
- package/packages/math/segmentBoxContains.stories.jsx +23 -0
- package/packages/math/segmentsIntersect.stories.jsx +23 -0
- package/packages/math/shapeEdgePoint.stories.jsx +23 -0
- package/packages/react/D3plusContext.stories.jsx +23 -0
- package/packages/react/Renderer.stories.jsx +23 -0
- package/packages/text/fontFamily.stories.jsx +23 -0
- package/packages/text/fontFamilyStringify.stories.jsx +23 -0
- package/packages/text/stringify.stories.jsx +23 -0
- package/packages/text/strip.stories.jsx +23 -0
- package/packages/text/textSplit.stories.jsx +23 -0
- package/packages/text/textWrap.stories.jsx +23 -0
- package/packages/text/titleCase.stories.jsx +23 -0
- package/packages/text/trim.stories.jsx +23 -0
- package/packages/text/trimLeft.stories.jsx +23 -0
- package/packages/text/trimRight.stories.jsx +23 -0
- package/static/data/city_coords.json +224 -0
- package/static/images/favicon.ico +0 -0
- package/static/images/touchicon.png +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import remarkGfm from "remark-gfm";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
// monorepo fix
|
|
5
|
+
// https://storybook.js.org/docs/faq#how-do-i-fix-module-resolution-in-special-environments
|
|
6
|
+
const getAbsolutePath = packageName =>
|
|
7
|
+
path.dirname(require.resolve(path.join(packageName, 'package.json')));
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
stories: [
|
|
11
|
+
"../docs/**/*.mdx",
|
|
12
|
+
"../packages/**/*.stories.@(mdx|js|jsx|ts|tsx)"
|
|
13
|
+
],
|
|
14
|
+
|
|
15
|
+
addons: [
|
|
16
|
+
getAbsolutePath("@storybook/addon-controls"),
|
|
17
|
+
{
|
|
18
|
+
name: getAbsolutePath("@storybook/addon-docs"),
|
|
19
|
+
options: {
|
|
20
|
+
mdxPluginOptions: {
|
|
21
|
+
mdxCompileOptions: {
|
|
22
|
+
remarkPlugins: [remarkGfm],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
|
|
29
|
+
framework: {
|
|
30
|
+
name: getAbsolutePath("@storybook/nextjs"),
|
|
31
|
+
options: {
|
|
32
|
+
builder: {useSWC: true}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
docs: {
|
|
37
|
+
defaultName: "D3plus"
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
staticDirs: ["../static"],
|
|
41
|
+
|
|
42
|
+
typescript: {
|
|
43
|
+
reactDocgen: "react-docgen-typescript"
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
core: {
|
|
47
|
+
disableTelemetry: true, // 👈 Disables telemetry
|
|
48
|
+
disableWhatsNewNotifications: true,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<title>D3plus Documentation</title>
|
|
2
|
+
<meta name="description" content="Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations."/>
|
|
3
|
+
|
|
4
|
+
<link rel="shortcut icon" type="image/png" href="/images/favicon.ico?v=3">
|
|
5
|
+
<link rel="apple-touch-icon" sizes="256x256" href="/images/touchicon.png?v=3">
|
|
6
|
+
|
|
7
|
+
<!-- Inter -->
|
|
8
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet">
|
|
11
|
+
|
|
12
|
+
<style>
|
|
13
|
+
|
|
14
|
+
/* styles logo text */
|
|
15
|
+
.sidebar-header a {
|
|
16
|
+
font-size: 24px;
|
|
17
|
+
font-weight: 400;
|
|
18
|
+
letter-spacing: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.sb-bar {
|
|
22
|
+
display: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
</style>
|
|
26
|
+
|
|
27
|
+
<script id="storybook-mod-expand-all-folders" type="text/javascript">
|
|
28
|
+
var clickCollapsedItemsUntilNoneLeft = () => {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
try {
|
|
31
|
+
var itemsLeftToClick = Array.from(
|
|
32
|
+
document.querySelectorAll('#storybook-explorer-tree button#core-charts[aria-expanded="false"]')
|
|
33
|
+
);
|
|
34
|
+
if (itemsLeftToClick.length > 0) {
|
|
35
|
+
itemsLeftToClick.forEach(item => item.click());
|
|
36
|
+
clickCollapsedItemsUntilNoneLeft();
|
|
37
|
+
}
|
|
38
|
+
} catch (e) {
|
|
39
|
+
console.error(e);
|
|
40
|
+
}
|
|
41
|
+
}, 200);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
window.removeEventListener('load', clickCollapsedItemsUntilNoneLeft);
|
|
45
|
+
window.addEventListener('load', clickCollapsedItemsUntilNoneLeft);
|
|
46
|
+
</script>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<title>D3plus</title>
|
|
2
|
+
|
|
3
|
+
<!-- Inter -->
|
|
4
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
5
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
6
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet">
|
|
7
|
+
|
|
8
|
+
<style>
|
|
9
|
+
|
|
10
|
+
pre {
|
|
11
|
+
font-family: ui-monospace, monospace !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.sbdocs-wrapper {
|
|
15
|
+
padding: 2rem !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.sbdocs-content {
|
|
19
|
+
max-width: calc(100% - 15rem) !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* kill margins */
|
|
23
|
+
.docblock-argstable, /* control block */
|
|
24
|
+
.sbdocs-preview { /* chart/code block */
|
|
25
|
+
margin: 0 !important;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* kill paddings */
|
|
29
|
+
.docs-story > div:first-child { /* viz container */
|
|
30
|
+
padding: 10px !important;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* move hide/show code button */
|
|
34
|
+
.docs-story > div:last-child {
|
|
35
|
+
background: none !important;
|
|
36
|
+
left: 0px !important;
|
|
37
|
+
right: auto !important;
|
|
38
|
+
}
|
|
39
|
+
.docblock-code-toggle {
|
|
40
|
+
border-left-color: initial !important;
|
|
41
|
+
border-right-color: rgba(38, 85, 115, 0.15) !important;
|
|
42
|
+
border-radius: 0px 4px 0px !important;
|
|
43
|
+
border-style: solid solid none none !important;
|
|
44
|
+
border-width: 1px 1px 0px 0px !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* removes inner viz padding */
|
|
48
|
+
.innerZoomElementWrapper > div:first-child {
|
|
49
|
+
border: none !important;
|
|
50
|
+
}
|
|
51
|
+
.viz > svg {
|
|
52
|
+
display: block;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.d3plus-logo .d3plus-plot-x-axis .bar,
|
|
56
|
+
.d3plus-logo .d3plus-plot-y-axis .bar {
|
|
57
|
+
transition: opacity 0.2s;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
</style>
|
|
61
|
+
<!-- Google tag (gtag.js) -->
|
|
62
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-46067436-1"></script>
|
|
63
|
+
<script>
|
|
64
|
+
window.dataLayer = window.dataLayer || [];
|
|
65
|
+
function gtag(){dataLayer.push(arguments);}
|
|
66
|
+
gtag('js', new Date());
|
|
67
|
+
|
|
68
|
+
gtag('config', 'UA-46067436-1');
|
|
69
|
+
</script>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React, {useContext, useMemo} from "react";
|
|
2
|
+
import { Anchor, Canvas, Controls, Description, DocsContext, Subheading, Subtitle, Title } from '@storybook/blocks';
|
|
3
|
+
import theme from "./theme.js";
|
|
4
|
+
import stringify from "../helpers/stringify.js";
|
|
5
|
+
import {D3plusContext} from "@d3plus/react";
|
|
6
|
+
const darkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
7
|
+
const tickColor = darkMode ? "#dee2e6" : "#495057";
|
|
8
|
+
const gridColor = darkMode ? "#495057" : "#dee2e6";
|
|
9
|
+
|
|
10
|
+
const axisConfig = {
|
|
11
|
+
barConfig: {
|
|
12
|
+
stroke: tickColor
|
|
13
|
+
},
|
|
14
|
+
gridConfig: {
|
|
15
|
+
stroke: gridColor
|
|
16
|
+
},
|
|
17
|
+
shapeConfig: {
|
|
18
|
+
fill: tickColor,
|
|
19
|
+
labelConfig: {
|
|
20
|
+
fontColor: tickColor
|
|
21
|
+
},
|
|
22
|
+
stroke: tickColor
|
|
23
|
+
},
|
|
24
|
+
titleConfig: {
|
|
25
|
+
fontColor: tickColor
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const globalConfig = {
|
|
29
|
+
axisConfig,
|
|
30
|
+
colorScaleConfig: {
|
|
31
|
+
axisConfig: {
|
|
32
|
+
barConfig: {
|
|
33
|
+
stroke: tickColor
|
|
34
|
+
},
|
|
35
|
+
gridConfig: {
|
|
36
|
+
stroke: gridColor
|
|
37
|
+
},
|
|
38
|
+
shapeConfig: {
|
|
39
|
+
labelConfig: {
|
|
40
|
+
fontColor: tickColor
|
|
41
|
+
},
|
|
42
|
+
stroke: tickColor
|
|
43
|
+
},
|
|
44
|
+
titleConfig: {
|
|
45
|
+
fontColor: tickColor
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
columnConfig: axisConfig,
|
|
50
|
+
fontColor: tickColor,
|
|
51
|
+
legendConfig: {
|
|
52
|
+
shapeConfig: {
|
|
53
|
+
labelConfig: {
|
|
54
|
+
fontColor: tickColor
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
rowConfig: axisConfig,
|
|
59
|
+
xConfig: axisConfig,
|
|
60
|
+
x2Config: axisConfig,
|
|
61
|
+
yConfig: axisConfig,
|
|
62
|
+
y2Config: axisConfig
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const preview = {
|
|
66
|
+
decorators: [
|
|
67
|
+
(Story) => (
|
|
68
|
+
<D3plusContext.Provider value={globalConfig}>
|
|
69
|
+
<Story />
|
|
70
|
+
</D3plusContext.Provider>
|
|
71
|
+
)
|
|
72
|
+
],
|
|
73
|
+
parameters: {
|
|
74
|
+
docs: {
|
|
75
|
+
page: () => {
|
|
76
|
+
const {componentStories} = useContext(DocsContext);
|
|
77
|
+
const stories = componentStories();
|
|
78
|
+
return (
|
|
79
|
+
<>
|
|
80
|
+
<Title />
|
|
81
|
+
<Subtitle />
|
|
82
|
+
<Description />
|
|
83
|
+
{stories.map(story => {
|
|
84
|
+
const {component, moduleExport} = story;
|
|
85
|
+
const stringifiedArgs = stringify(moduleExport.args);
|
|
86
|
+
const compName = component.__docgenInfo.displayName.replace(/_args_[A-z]+/g, "");
|
|
87
|
+
const code = useMemo(() => {
|
|
88
|
+
return `import {${compName}} from "@d3plus/react";
|
|
89
|
+
${stringifiedArgs.includes("formatAbbreviate") ? `import {formatAbbreviate} from "@d3plus/format";\n` : ""}
|
|
90
|
+
<${component.name} config={${stringifiedArgs}} />`;
|
|
91
|
+
}, [stringifiedArgs]);
|
|
92
|
+
return (
|
|
93
|
+
<Anchor storyId={story.id}>
|
|
94
|
+
<Subheading>{story.name}</Subheading>
|
|
95
|
+
<Canvas
|
|
96
|
+
of={moduleExport}
|
|
97
|
+
withToolbar={false}
|
|
98
|
+
story={{height: `${moduleExport.args.height || 350}px`}}
|
|
99
|
+
source={{
|
|
100
|
+
code,
|
|
101
|
+
language: "jsx"
|
|
102
|
+
}}
|
|
103
|
+
sourceState="shown"
|
|
104
|
+
/>
|
|
105
|
+
{story.parameters.controls ? <Controls of={moduleExport} /> : null}
|
|
106
|
+
<p>Full documentation for all available <strong>{compName}</strong> methods can be found <a href={`https://github.com/d3plus/d3plus/tree/main/packages/core#${compName}`} target="_blank">here</a>.</p>
|
|
107
|
+
<br />
|
|
108
|
+
<br />
|
|
109
|
+
</Anchor>
|
|
110
|
+
);
|
|
111
|
+
})}
|
|
112
|
+
</>
|
|
113
|
+
);
|
|
114
|
+
},
|
|
115
|
+
theme: theme,
|
|
116
|
+
toc: true
|
|
117
|
+
},
|
|
118
|
+
options: {
|
|
119
|
+
storySort: {
|
|
120
|
+
method: "alphabetical",
|
|
121
|
+
order: [
|
|
122
|
+
"Introduction",
|
|
123
|
+
"Installation",
|
|
124
|
+
"*",
|
|
125
|
+
"Core",
|
|
126
|
+
"Advanced"
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
tags: ["autodocs"]
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export default preview;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {create} from "@storybook/theming";
|
|
2
|
+
|
|
3
|
+
export default create({
|
|
4
|
+
|
|
5
|
+
colorPrimary: "rgb(36, 114, 200)",
|
|
6
|
+
colorSecondary: "rgb(36, 114, 200)",
|
|
7
|
+
|
|
8
|
+
// Typography
|
|
9
|
+
fontBase: "'Inter', 'Helvetica Neue', 'HelveticaNeue', 'Helvetica', 'Arial', sans-serif",
|
|
10
|
+
fontCode: "ui-monospace, monospace",
|
|
11
|
+
|
|
12
|
+
brandTitle: "<span class=\"logo-d3\">D3</span>plus",
|
|
13
|
+
brandUrl: "https://d3plus.org",
|
|
14
|
+
brandTarget: '_self'
|
|
15
|
+
|
|
16
|
+
});
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# d3plus-storybook
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// WARNING: do not edit this file directly, it is generated dynamically from
|
|
2
|
+
// the source JSDOC comments using the npm run docs script.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const argTypes = {
|
|
9
|
+
c1: {
|
|
10
|
+
control: {
|
|
11
|
+
type: "text"
|
|
12
|
+
},
|
|
13
|
+
description: "The first color, a valid CSS color string.",
|
|
14
|
+
table: {
|
|
15
|
+
defaultValue: {
|
|
16
|
+
summary: "undefined"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
type: {
|
|
20
|
+
required: true,
|
|
21
|
+
summary: "string"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
c2: {
|
|
25
|
+
control: {
|
|
26
|
+
type: "text"
|
|
27
|
+
},
|
|
28
|
+
description: "The second color, also a valid CSS color string.",
|
|
29
|
+
table: {
|
|
30
|
+
defaultValue: {
|
|
31
|
+
summary: "undefined"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
type: {
|
|
35
|
+
required: true,
|
|
36
|
+
summary: "string"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
o1: {
|
|
40
|
+
control: {
|
|
41
|
+
type: "text"
|
|
42
|
+
},
|
|
43
|
+
defaultValue: 1,
|
|
44
|
+
description: "Value from 0 to 1 of the first color's opacity.",
|
|
45
|
+
table: {
|
|
46
|
+
defaultValue: {
|
|
47
|
+
summary: 1
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
type: {
|
|
51
|
+
required: false,
|
|
52
|
+
summary: "string"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
o2: {
|
|
56
|
+
control: {
|
|
57
|
+
type: "text"
|
|
58
|
+
},
|
|
59
|
+
defaultValue: 1,
|
|
60
|
+
description: "Value from 0 to 1 of the first color's opacity.",
|
|
61
|
+
table: {
|
|
62
|
+
defaultValue: {
|
|
63
|
+
summary: 1
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
required: false,
|
|
68
|
+
summary: "string"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// WARNING: do not edit this file directly, it is generated dynamically from
|
|
2
|
+
// the source JSDOC comments using the npm run docs script.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const argTypes = {
|
|
9
|
+
c: {
|
|
10
|
+
control: {
|
|
11
|
+
type: "text"
|
|
12
|
+
},
|
|
13
|
+
description: "A valid CSS color string.",
|
|
14
|
+
table: {
|
|
15
|
+
defaultValue: {
|
|
16
|
+
summary: "undefined"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
type: {
|
|
20
|
+
required: true,
|
|
21
|
+
summary: "string"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
u: {
|
|
25
|
+
control: {
|
|
26
|
+
type: "object"
|
|
27
|
+
},
|
|
28
|
+
defaultValue: "defaults",
|
|
29
|
+
description: "An object containing overrides of the default colors.",
|
|
30
|
+
table: {
|
|
31
|
+
defaultValue: {
|
|
32
|
+
summary: "defaults"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
required: false,
|
|
37
|
+
summary: "object"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// WARNING: do not edit this file directly, it is generated dynamically from
|
|
2
|
+
// the source JSDOC comments using the npm run docs script.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const argTypes = {
|
|
9
|
+
c: {
|
|
10
|
+
control: {
|
|
11
|
+
type: "text"
|
|
12
|
+
},
|
|
13
|
+
description: "A valid CSS color string.",
|
|
14
|
+
table: {
|
|
15
|
+
defaultValue: {
|
|
16
|
+
summary: "undefined"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
type: {
|
|
20
|
+
required: true,
|
|
21
|
+
summary: "string"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
u: {
|
|
25
|
+
control: {
|
|
26
|
+
type: "object"
|
|
27
|
+
},
|
|
28
|
+
defaultValue: "defaults",
|
|
29
|
+
description: "An object containing overrides of the default colors.",
|
|
30
|
+
table: {
|
|
31
|
+
defaultValue: {
|
|
32
|
+
summary: "defaults"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
required: false,
|
|
37
|
+
summary: "object"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// WARNING: do not edit this file directly, it is generated dynamically from
|
|
2
|
+
// the source JSDOC comments using the npm run docs script.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const argTypes = {
|
|
9
|
+
c: {
|
|
10
|
+
control: {
|
|
11
|
+
type: "text"
|
|
12
|
+
},
|
|
13
|
+
description: "A valid CSS color string.",
|
|
14
|
+
table: {
|
|
15
|
+
defaultValue: {
|
|
16
|
+
summary: "undefined"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
type: {
|
|
20
|
+
required: true,
|
|
21
|
+
summary: "string"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// WARNING: do not edit this file directly, it is generated dynamically from
|
|
2
|
+
// the source JSDOC comments using the npm run docs script.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const argTypes = {
|
|
9
|
+
c: {
|
|
10
|
+
control: {
|
|
11
|
+
type: "text"
|
|
12
|
+
},
|
|
13
|
+
description: "A valid CSS color string.",
|
|
14
|
+
table: {
|
|
15
|
+
defaultValue: {
|
|
16
|
+
summary: "undefined"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
type: {
|
|
20
|
+
required: true,
|
|
21
|
+
summary: "string"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
i: {
|
|
25
|
+
control: {
|
|
26
|
+
type: "text"
|
|
27
|
+
},
|
|
28
|
+
defaultValue: 0.5,
|
|
29
|
+
description: "A value from 0 to 1 dictating the strength of the function.",
|
|
30
|
+
table: {
|
|
31
|
+
defaultValue: {
|
|
32
|
+
summary: 0.5
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
required: false,
|
|
37
|
+
summary: "string"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// WARNING: do not edit this file directly, it is generated dynamically from
|
|
2
|
+
// the source JSDOC comments using the npm run docs script.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export const argTypes = {
|
|
9
|
+
c1: {
|
|
10
|
+
control: {
|
|
11
|
+
type: "text"
|
|
12
|
+
},
|
|
13
|
+
description: "The base color, a valid CSS color string.",
|
|
14
|
+
table: {
|
|
15
|
+
defaultValue: {
|
|
16
|
+
summary: "undefined"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
type: {
|
|
20
|
+
required: true,
|
|
21
|
+
summary: "string"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
c2: {
|
|
25
|
+
control: {
|
|
26
|
+
type: "text"
|
|
27
|
+
},
|
|
28
|
+
description: "The color to remove from the base color, also a valid CSS color string.",
|
|
29
|
+
table: {
|
|
30
|
+
defaultValue: {
|
|
31
|
+
summary: "undefined"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
type: {
|
|
35
|
+
required: true,
|
|
36
|
+
summary: "string"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
o1: {
|
|
40
|
+
control: {
|
|
41
|
+
type: "text"
|
|
42
|
+
},
|
|
43
|
+
defaultValue: 1,
|
|
44
|
+
description: "Value from 0 to 1 of the first color's opacity.",
|
|
45
|
+
table: {
|
|
46
|
+
defaultValue: {
|
|
47
|
+
summary: 1
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
type: {
|
|
51
|
+
required: false,
|
|
52
|
+
summary: "string"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
o2: {
|
|
56
|
+
control: {
|
|
57
|
+
type: "text"
|
|
58
|
+
},
|
|
59
|
+
defaultValue: 1,
|
|
60
|
+
description: "Value from 0 to 1 of the first color's opacity.",
|
|
61
|
+
table: {
|
|
62
|
+
defaultValue: {
|
|
63
|
+
summary: 1
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
required: false,
|
|
68
|
+
summary: "string"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// WARNING: do not edit this file directly, it is generated dynamically from
|
|
2
|
+
// the source JSDOC comments using the npm run docs script.
|
|
3
|
+
|
|
4
|
+
import React from "react";
|
|
5
|
+
import {argTypes as plotArgTypes} from "./Plot.args.jsx";
|
|
6
|
+
import {assign} from "@d3plus/dom";
|
|
7
|
+
|
|
8
|
+
import {AreaPlot as D3plusAreaPlot} from "@d3plus/react";
|
|
9
|
+
export const AreaPlot = ({ config }) => <D3plusAreaPlot config={config} />;
|
|
10
|
+
|
|
11
|
+
export const argTypes = assign(
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Filters out unused argTypes from the Plot primitive and
|
|
15
|
+
* overrides any defaults that have been changed in AreaPlot
|
|
16
|
+
*/
|
|
17
|
+
Object.keys(plotArgTypes)
|
|
18
|
+
.filter(k => !k.match(/^(shape|zoom.*)$/))
|
|
19
|
+
.reduce((obj, k) => (obj[k] = plotArgTypes[k], obj), {}),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* AreaPlot-specific methods
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
baseline: {
|
|
27
|
+
control: {
|
|
28
|
+
type: "number"
|
|
29
|
+
},
|
|
30
|
+
defaultValue: 0,
|
|
31
|
+
table: {
|
|
32
|
+
defaultValue: {
|
|
33
|
+
summary: 0
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
type: {
|
|
37
|
+
required: true,
|
|
38
|
+
summary: "number"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
discrete: {
|
|
42
|
+
control: {
|
|
43
|
+
type: "text"
|
|
44
|
+
},
|
|
45
|
+
defaultValue: "x",
|
|
46
|
+
table: {
|
|
47
|
+
defaultValue: {
|
|
48
|
+
summary: "x"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
type: {
|
|
52
|
+
required: false,
|
|
53
|
+
summary: "string"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
shape: {
|
|
57
|
+
control: {
|
|
58
|
+
type: "text"
|
|
59
|
+
},
|
|
60
|
+
defaultValue: "Area",
|
|
61
|
+
table: {
|
|
62
|
+
defaultValue: {
|
|
63
|
+
summary: "Area"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
type: {
|
|
67
|
+
required: false,
|
|
68
|
+
summary: "function | string"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
);
|