@carbon/charts-react 0.59.0-beta.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -282
- package/LICENSE.md +201 -0
- package/README.md +5 -1
- package/{dist/alluvial-chart.d.ts → alluvial-chart.d.ts} +0 -0
- package/{dist/alluvial-chart.js → alluvial-chart.js} +0 -0
- package/{dist/area-chart-stacked.d.ts → area-chart-stacked.d.ts} +0 -0
- package/{dist/area-chart-stacked.js → area-chart-stacked.js} +0 -0
- package/{dist/area-chart.d.ts → area-chart.d.ts} +0 -0
- package/{dist/area-chart.js → area-chart.js} +0 -0
- package/{dist/bar-chart-grouped.d.ts → bar-chart-grouped.d.ts} +0 -0
- package/{dist/bar-chart-grouped.js → bar-chart-grouped.js} +0 -0
- package/{dist/bar-chart-simple.d.ts → bar-chart-simple.d.ts} +0 -0
- package/{dist/bar-chart-simple.js → bar-chart-simple.js} +0 -0
- package/{dist/bar-chart-stacked.d.ts → bar-chart-stacked.d.ts} +0 -0
- package/{dist/bar-chart-stacked.js → bar-chart-stacked.js} +0 -0
- package/{dist/base-chart.d.ts → base-chart.d.ts} +0 -0
- package/{dist/base-chart.js → base-chart.js} +0 -0
- package/{dist/boxplot-chart.d.ts → boxplot-chart.d.ts} +0 -0
- package/{dist/boxplot-chart.js → boxplot-chart.js} +0 -0
- package/{dist/bubble-chart.d.ts → bubble-chart.d.ts} +0 -0
- package/{dist/bubble-chart.js → bubble-chart.js} +0 -0
- package/{dist/bullet-chart.d.ts → bullet-chart.d.ts} +0 -0
- package/{dist/bullet-chart.js → bullet-chart.js} +0 -0
- package/{dist/bundle.js → bundle.js} +0 -0
- package/{dist/circle-pack-chart.d.ts → circle-pack-chart.d.ts} +0 -0
- package/{dist/circle-pack-chart.js → circle-pack-chart.js} +0 -0
- package/{dist/combo-chart.d.ts → combo-chart.d.ts} +0 -0
- package/{dist/combo-chart.js → combo-chart.js} +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNode.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNode.js +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeColumn.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeColumn.js +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeLabel.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeLabel.js +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeSubtitle.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeSubtitle.js +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeTitle.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/CardNodeTitle.js +0 -0
- package/{dist/diagrams → diagrams}/CardNode/index.d.ts +0 -0
- package/{dist/diagrams → diagrams}/CardNode/index.js +0 -0
- package/{dist/diagrams → diagrams}/Edge/Edge.d.ts +0 -0
- package/{dist/diagrams → diagrams}/Edge/Edge.js +0 -0
- package/{dist/diagrams → diagrams}/Edge/index.d.ts +0 -0
- package/{dist/diagrams → diagrams}/Edge/index.js +0 -0
- package/{dist/diagrams → diagrams}/Marker/Marker.d.ts +0 -0
- package/{dist/diagrams → diagrams}/Marker/Marker.js +0 -0
- package/{dist/diagrams → diagrams}/Marker/index.d.ts +0 -0
- package/{dist/diagrams → diagrams}/Marker/index.js +0 -0
- package/{dist/diagrams → diagrams}/ShapeNode/ShapeNode.d.ts +0 -0
- package/{dist/diagrams → diagrams}/ShapeNode/ShapeNode.js +0 -0
- package/{dist/diagrams → diagrams}/ShapeNode/index.d.ts +0 -0
- package/{dist/diagrams → diagrams}/ShapeNode/index.js +0 -0
- package/{dist/diagrams → diagrams}/configs.d.ts +0 -0
- package/{dist/diagrams → diagrams}/configs.js +0 -0
- package/{dist/donut-chart.d.ts → donut-chart.d.ts} +0 -0
- package/{dist/donut-chart.js → donut-chart.js} +0 -0
- package/{dist/gauge-chart.d.ts → gauge-chart.d.ts} +0 -0
- package/{dist/gauge-chart.js → gauge-chart.js} +0 -0
- package/{dist/heatmap-chart.d.ts → heatmap-chart.d.ts} +0 -0
- package/{dist/heatmap-chart.js → heatmap-chart.js} +0 -0
- package/{dist/histogram-chart.d.ts → histogram-chart.d.ts} +0 -0
- package/{dist/histogram-chart.js → histogram-chart.js} +0 -0
- package/{dist/index.d.ts → index.d.ts} +0 -0
- package/{dist/index.js → index.js} +0 -0
- package/{dist/line-chart.d.ts → line-chart.d.ts} +0 -0
- package/{dist/line-chart.js → line-chart.js} +0 -0
- package/{dist/lollipop-chart.d.ts → lollipop-chart.d.ts} +0 -0
- package/{dist/lollipop-chart.js → lollipop-chart.js} +0 -0
- package/{dist/meter-chart.d.ts → meter-chart.d.ts} +0 -0
- package/{dist/meter-chart.js → meter-chart.js} +0 -0
- package/package.json +106 -106
- package/{dist/pie-chart.d.ts → pie-chart.d.ts} +0 -0
- package/{dist/pie-chart.js → pie-chart.js} +0 -0
- package/{dist/radar-chart.d.ts → radar-chart.d.ts} +0 -0
- package/{dist/radar-chart.js → radar-chart.js} +0 -0
- package/{dist/scatter-chart.d.ts → scatter-chart.d.ts} +0 -0
- package/{dist/scatter-chart.js → scatter-chart.js} +0 -0
- package/{dist/tree-chart.d.ts → tree-chart.d.ts} +0 -0
- package/{dist/tree-chart.js → tree-chart.js} +0 -0
- package/{dist/treemap-chart.d.ts → treemap-chart.d.ts} +0 -0
- package/{dist/treemap-chart.js → treemap-chart.js} +0 -0
- package/{dist/utils.d.ts → utils.d.ts} +0 -0
- package/{dist/utils.js → utils.js} +0 -0
- package/{dist/wordcloud-chart.d.ts → wordcloud-chart.d.ts} +0 -0
- package/{dist/wordcloud-chart.js → wordcloud-chart.js} +0 -0
- package/.babelrc +0 -4
- package/.prettierignore +0 -1
- package/.storybook/addons.js +0 -2
- package/.storybook/assets/logo.svg +0 -1
- package/.storybook/assets/share.png +0 -0
- package/.storybook/assets/welcome.png +0 -0
- package/.storybook/config.js +0 -22
- package/.storybook/main.js +0 -24
- package/.storybook/manager-head.html +0 -42
- package/.storybook/preview-head.html +0 -10
- package/build.sh +0 -20
- package/carbon.yml +0 -275
- package/carbon__charts-react-tests.tsx +0 -83
- package/demo/bundle/favicon.ico +0 -0
- package/demo/bundle/index.html +0 -22
- package/demo/bundle/logo.svg +0 -1
- package/demo/bundle/main.4a87b5852cddf04c8e9a.bundle.js +0 -1
- package/demo/bundle/runtime~main.6b70b35614cf83eab770.bundle.js +0 -1
- package/demo/bundle/sb_dll/storybook_ui-manifest.json +0 -1
- package/demo/bundle/sb_dll/storybook_ui_dll.LICENCE +0 -113
- package/demo/bundle/sb_dll/storybook_ui_dll.js +0 -2
- package/demo/bundle/share.png +0 -0
- package/demo/bundle/vendors~main.9ceec0efe2f3ef413ade.bundle.js +0 -111
- package/demo/bundle/welcome.png +0 -0
- package/dist/CHANGELOG.md +0 -2150
- package/dist/README.md +0 -56
- package/dist/package.json +0 -107
- package/helpers/commons.js +0 -30
- package/rollup.config.js +0 -18
- package/src/alluvial-chart.tsx +0 -30
- package/src/area-chart-stacked.tsx +0 -33
- package/src/area-chart.tsx +0 -30
- package/src/bar-chart-grouped.tsx +0 -30
- package/src/bar-chart-simple.tsx +0 -30
- package/src/bar-chart-stacked.tsx +0 -30
- package/src/base-chart.tsx +0 -45
- package/src/boxplot-chart.tsx +0 -30
- package/src/bubble-chart.tsx +0 -30
- package/src/bullet-chart.tsx +0 -30
- package/src/circle-pack-chart.tsx +0 -30
- package/src/combo-chart.tsx +0 -30
- package/src/diagrams/CardNode/CardNode.tsx +0 -121
- package/src/diagrams/CardNode/CardNodeColumn.tsx +0 -38
- package/src/diagrams/CardNode/CardNodeLabel.tsx +0 -32
- package/src/diagrams/CardNode/CardNodeSubtitle.tsx +0 -32
- package/src/diagrams/CardNode/CardNodeTitle.tsx +0 -32
- package/src/diagrams/CardNode/index.tsx +0 -13
- package/src/diagrams/Edge/Edge.tsx +0 -137
- package/src/diagrams/Edge/index.tsx +0 -2
- package/src/diagrams/Marker/Marker.tsx +0 -121
- package/src/diagrams/Marker/index.tsx +0 -9
- package/src/diagrams/ShapeNode/ShapeNode.tsx +0 -153
- package/src/diagrams/ShapeNode/index.tsx +0 -2
- package/src/diagrams/configs.ts +0 -1
- package/src/donut-chart.tsx +0 -30
- package/src/gauge-chart.tsx +0 -30
- package/src/heatmap-chart.tsx +0 -30
- package/src/histogram-chart.tsx +0 -30
- package/src/index.ts +0 -51
- package/src/line-chart.tsx +0 -30
- package/src/lollipop-chart.tsx +0 -30
- package/src/meter-chart.tsx +0 -30
- package/src/pie-chart.tsx +0 -30
- package/src/radar-chart.tsx +0 -30
- package/src/scatter-chart.tsx +0 -30
- package/src/tree-chart.tsx +0 -30
- package/src/treemap-chart.tsx +0 -30
- package/src/utils.ts +0 -7
- package/src/wordcloud-chart.tsx +0 -30
- package/stories/0_intro.stories.js +0 -60
- package/stories/1_gettingStarted.stories.js +0 -74
- package/stories/1_gettingStarted_content.js +0 -121
- package/stories/all.stories.js +0 -110
- package/stories/diagrams/0_Diagrams.stories.js +0 -259
- package/stories/diagrams/CardNode.stories.js +0 -106
- package/stories/diagrams/Edge.stories.js +0 -94
- package/stories/diagrams/Marker.stories.js +0 -95
- package/stories/diagrams/ShapeNode.stories.js +0 -42
- package/tsconfig.json +0 -20
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
|
|
7
|
-
// Carbon Prefix
|
|
8
|
-
import { carbonPrefix } from '../configs';
|
|
9
|
-
|
|
10
|
-
const namespace = `${carbonPrefix}--cc--card-node`;
|
|
11
|
-
|
|
12
|
-
const CardNode = ({
|
|
13
|
-
as = 'div',
|
|
14
|
-
children,
|
|
15
|
-
className,
|
|
16
|
-
color,
|
|
17
|
-
href = null,
|
|
18
|
-
onMouseEnter = null,
|
|
19
|
-
onMouseOver = null,
|
|
20
|
-
onMouseOut = null,
|
|
21
|
-
onMouseLeave = null,
|
|
22
|
-
onMouseMove = null,
|
|
23
|
-
onClick = null,
|
|
24
|
-
position = 'static',
|
|
25
|
-
stacked,
|
|
26
|
-
}: any) => {
|
|
27
|
-
let Component = 'div';
|
|
28
|
-
|
|
29
|
-
if (as !== 'div') {
|
|
30
|
-
Component = as;
|
|
31
|
-
} else if (href) {
|
|
32
|
-
Component = 'a';
|
|
33
|
-
} else if (onClick) {
|
|
34
|
-
Component = 'button';
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const cardClasses = classnames(namespace, {
|
|
38
|
-
[`${namespace}--stacked`]: stacked,
|
|
39
|
-
[`${namespace}--${Component}`]: Component,
|
|
40
|
-
[className]: className,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
<Component
|
|
46
|
-
className={cardClasses}
|
|
47
|
-
onClick={onClick}
|
|
48
|
-
onMouseEnter={onMouseEnter}
|
|
49
|
-
onMouseOver={onMouseOver}
|
|
50
|
-
onMouseOut={onMouseOut}
|
|
51
|
-
onMouseLeave={onMouseLeave}
|
|
52
|
-
onMouseMove={onMouseMove}
|
|
53
|
-
style={{ borderColor: color, position }}
|
|
54
|
-
tabIndex={0}>
|
|
55
|
-
{children}
|
|
56
|
-
</Component>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export default CardNode;
|
|
61
|
-
|
|
62
|
-
CardNode.propTypes = {
|
|
63
|
-
/** Provide a custom element to be rendered instead of the default */
|
|
64
|
-
as: PropTypes.elementType,
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Pass in the children that will be rendered within the CardNode
|
|
68
|
-
*/
|
|
69
|
-
children: PropTypes.node,
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Provide an optional class to be applied on the outer element
|
|
73
|
-
*/
|
|
74
|
-
className: PropTypes.string,
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Specify the node's border color
|
|
78
|
-
*/
|
|
79
|
-
color: PropTypes.string,
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Optionally specify an href for the CardNode to become an `<a>` element
|
|
83
|
-
*/
|
|
84
|
-
href: PropTypes.string,
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Provide an optional function to be called when the CardNode
|
|
88
|
-
* is clicked, turning the CardNode into a `<button>` element
|
|
89
|
-
*/
|
|
90
|
-
onClick: PropTypes.func,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Provide an optional function to be called for the onMouseEnter event
|
|
94
|
-
*/
|
|
95
|
-
onMouseEnter: PropTypes.func,
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Provide an optional function to be called for the onMouseOver event
|
|
99
|
-
*/
|
|
100
|
-
onMouseOver: PropTypes.func,
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Provide an optional function to be called for the onMouseOut event
|
|
104
|
-
*/
|
|
105
|
-
onMouseOut: PropTypes.func,
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Provide an optional function to be called for the onMouseLeave event
|
|
109
|
-
*/
|
|
110
|
-
onMouseLeave: PropTypes.func,
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Provide an optional function to be called for the onMouseMove event
|
|
114
|
-
*/
|
|
115
|
-
onMouseMove: PropTypes.func,
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Specify whether the node displays a stacked effect
|
|
119
|
-
*/
|
|
120
|
-
stacked: PropTypes.bool,
|
|
121
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
|
|
7
|
-
// Carbon Prefix
|
|
8
|
-
import { carbonPrefix } from '../configs';
|
|
9
|
-
|
|
10
|
-
const namespace = `${carbonPrefix}--cc--card-node`;
|
|
11
|
-
|
|
12
|
-
const CardNodeColumn = ({ children, className, farsideColumn }: any) => {
|
|
13
|
-
const classes = classnames(`${namespace}__column`, {
|
|
14
|
-
[`${namespace}__column--farside`]: farsideColumn,
|
|
15
|
-
[className]: className,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
return <div className={classes}>{children}</div>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { CardNodeColumn };
|
|
22
|
-
|
|
23
|
-
CardNodeColumn.propTypes = {
|
|
24
|
-
/**
|
|
25
|
-
* Pass in the children that will be rendered within the CardNodeColumn
|
|
26
|
-
*/
|
|
27
|
-
children: PropTypes.node,
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Provide an optional class to be applied on the outer element
|
|
31
|
-
*/
|
|
32
|
-
className: PropTypes.string,
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Specify whether this is the last column
|
|
36
|
-
*/
|
|
37
|
-
farsideColumn: PropTypes.bool,
|
|
38
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
|
|
7
|
-
// Carbon Prefix
|
|
8
|
-
import { carbonPrefix } from '../configs';
|
|
9
|
-
|
|
10
|
-
const namespace = `${carbonPrefix}--cc--card-node`;
|
|
11
|
-
|
|
12
|
-
const CardNodeLabel = ({ children, className }: any) => {
|
|
13
|
-
const classes = classnames(`${namespace}__label`, {
|
|
14
|
-
[className]: className,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return <label className={classes}>{children}</label>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { CardNodeLabel };
|
|
21
|
-
|
|
22
|
-
CardNodeLabel.propTypes = {
|
|
23
|
-
/**
|
|
24
|
-
* Pass in the children that will be rendered within the CardNodeLabel
|
|
25
|
-
*/
|
|
26
|
-
children: PropTypes.node,
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Provide an optional class to be applied on the outer element
|
|
30
|
-
*/
|
|
31
|
-
className: PropTypes.string,
|
|
32
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
|
|
7
|
-
// Carbon Prefix
|
|
8
|
-
import { carbonPrefix } from '../configs';
|
|
9
|
-
|
|
10
|
-
const namespace = `${carbonPrefix}--cc--card-node`;
|
|
11
|
-
|
|
12
|
-
const CardNodeSubtitle = ({ children, className }: any) => {
|
|
13
|
-
const classes = classnames(`${namespace}__subtitle`, {
|
|
14
|
-
[className]: className,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return <div className={classes}>{children}</div>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { CardNodeSubtitle };
|
|
21
|
-
|
|
22
|
-
CardNodeSubtitle.propTypes = {
|
|
23
|
-
/**
|
|
24
|
-
* Pass in the children that will be rendered within the CardNodeSubtitle
|
|
25
|
-
*/
|
|
26
|
-
children: PropTypes.node,
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Provide an optional class to be applied on the outer element
|
|
30
|
-
*/
|
|
31
|
-
className: PropTypes.string,
|
|
32
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
|
|
7
|
-
// Carbon Prefix
|
|
8
|
-
import { carbonPrefix } from '../configs';
|
|
9
|
-
|
|
10
|
-
const namespace = `${carbonPrefix}--cc--card-node`;
|
|
11
|
-
|
|
12
|
-
const CardNodeTitle = ({ children, className }: any) => {
|
|
13
|
-
const classes = classnames(`${namespace}__title`, {
|
|
14
|
-
[className]: className,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return <div className={classes}>{children}</div>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { CardNodeTitle };
|
|
21
|
-
|
|
22
|
-
CardNodeTitle.propTypes = {
|
|
23
|
-
/**
|
|
24
|
-
* Pass in the children that will be rendered within the CardNodeTitle
|
|
25
|
-
*/
|
|
26
|
-
children: PropTypes.node,
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Provide an optional class to be applied on the outer element
|
|
30
|
-
*/
|
|
31
|
-
className: PropTypes.string,
|
|
32
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import CardNode from './CardNode';
|
|
2
|
-
import { CardNodeColumn } from './CardNodeColumn';
|
|
3
|
-
import { CardNodeLabel } from './CardNodeLabel';
|
|
4
|
-
import { CardNodeSubtitle } from './CardNodeSubtitle';
|
|
5
|
-
import { CardNodeTitle } from './CardNodeTitle';
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
CardNode as default,
|
|
9
|
-
CardNodeColumn,
|
|
10
|
-
CardNodeSubtitle,
|
|
11
|
-
CardNodeTitle,
|
|
12
|
-
CardNodeLabel,
|
|
13
|
-
};
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Carbon Prefix
|
|
5
|
-
import { carbonPrefix } from '../configs';
|
|
6
|
-
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
import classnames from 'classnames';
|
|
9
|
-
|
|
10
|
-
import { buildStraightPathString } from '@carbon/charts/components/diagrams/buildPaths';
|
|
11
|
-
|
|
12
|
-
const Edge = ({
|
|
13
|
-
className,
|
|
14
|
-
color,
|
|
15
|
-
markerEnd,
|
|
16
|
-
markerStart,
|
|
17
|
-
onMouseEnter = null,
|
|
18
|
-
onMouseOver = null,
|
|
19
|
-
onMouseOut = null,
|
|
20
|
-
onMouseLeave = null,
|
|
21
|
-
onMouseMove = null,
|
|
22
|
-
path,
|
|
23
|
-
source,
|
|
24
|
-
target,
|
|
25
|
-
variant = null,
|
|
26
|
-
}: any) => {
|
|
27
|
-
const namespace = `${carbonPrefix}--cc--edge`;
|
|
28
|
-
|
|
29
|
-
const pathClasses = classnames(namespace, {
|
|
30
|
-
[`${namespace}--${variant}`]: variant,
|
|
31
|
-
[className]: className,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const d = path || buildStraightPathString(source, target);
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<g
|
|
38
|
-
className={pathClasses}
|
|
39
|
-
onMouseEnter={onMouseEnter}
|
|
40
|
-
onMouseOver={onMouseOver}
|
|
41
|
-
onMouseOut={onMouseOut}
|
|
42
|
-
onMouseLeave={onMouseLeave}
|
|
43
|
-
onMouseMove={onMouseMove}>
|
|
44
|
-
<path d={d} className={`${namespace}__container`} />
|
|
45
|
-
<path d={d} className={`${namespace}__outer`} />
|
|
46
|
-
<path
|
|
47
|
-
d={d}
|
|
48
|
-
className={`${namespace}__inner`}
|
|
49
|
-
markerEnd={`url(#${markerEnd})`}
|
|
50
|
-
markerStart={`url(#${markerStart})`}
|
|
51
|
-
style={{ stroke: color }}
|
|
52
|
-
/>
|
|
53
|
-
</g>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default Edge;
|
|
58
|
-
|
|
59
|
-
Edge.propTypes = {
|
|
60
|
-
/**
|
|
61
|
-
* Provide an optional class to be applied on the outer element
|
|
62
|
-
*/
|
|
63
|
-
className: PropTypes.string,
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Specify the edge's color
|
|
67
|
-
*/
|
|
68
|
-
color: PropTypes.string,
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Specify an ID for a corresponding end marker
|
|
72
|
-
*/
|
|
73
|
-
markerEnd: PropTypes.string,
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Specify an ID for a corresponding start marker
|
|
77
|
-
*/
|
|
78
|
-
markerStart: PropTypes.string,
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Provide an optional function to be called for the onMouseEnter event
|
|
82
|
-
*/
|
|
83
|
-
onMouseEnter: PropTypes.func,
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Provide an optional function to be called for the onMouseOver event
|
|
87
|
-
*/
|
|
88
|
-
onMouseOver: PropTypes.func,
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Provide an optional function to be called for the onMouseOut event
|
|
92
|
-
*/
|
|
93
|
-
onMouseOut: PropTypes.func,
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Provide an optional function to be called for the onMouseLeave event
|
|
97
|
-
*/
|
|
98
|
-
onMouseLeave: PropTypes.func,
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Provide an optional function to be called for the onMouseMove event
|
|
102
|
-
*/
|
|
103
|
-
onMouseMove: PropTypes.func,
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Specify a path string
|
|
107
|
-
*/
|
|
108
|
-
path: PropTypes.string,
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Coordinates for the source element
|
|
112
|
-
*/
|
|
113
|
-
source: PropTypes.shape({
|
|
114
|
-
x: PropTypes.number,
|
|
115
|
-
y: PropTypes.number,
|
|
116
|
-
}),
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Coordinates for the target element
|
|
120
|
-
*/
|
|
121
|
-
target: PropTypes.shape({
|
|
122
|
-
x: PropTypes.number,
|
|
123
|
-
y: PropTypes.number,
|
|
124
|
-
}),
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Specify the variant of the edge
|
|
128
|
-
*/
|
|
129
|
-
variant: PropTypes.oneOf([
|
|
130
|
-
'dash-sm',
|
|
131
|
-
'dash-md',
|
|
132
|
-
'dash-lg',
|
|
133
|
-
'dash-xl',
|
|
134
|
-
'double',
|
|
135
|
-
'tunnel',
|
|
136
|
-
]),
|
|
137
|
-
};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
|
|
7
|
-
// Carbon Prefix
|
|
8
|
-
import { carbonPrefix } from '../configs';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
arrowLeft,
|
|
12
|
-
arrowRight,
|
|
13
|
-
circle,
|
|
14
|
-
diamond,
|
|
15
|
-
square,
|
|
16
|
-
tee,
|
|
17
|
-
} from '@carbon/charts/components/diagrams/markerDefinitions';
|
|
18
|
-
|
|
19
|
-
const Marker = ({
|
|
20
|
-
className,
|
|
21
|
-
color,
|
|
22
|
-
d,
|
|
23
|
-
id,
|
|
24
|
-
orient = 'auto',
|
|
25
|
-
height,
|
|
26
|
-
width,
|
|
27
|
-
position = 'end',
|
|
28
|
-
refX,
|
|
29
|
-
refY,
|
|
30
|
-
}: any) => {
|
|
31
|
-
const namespace = `${carbonPrefix}--cc--marker`;
|
|
32
|
-
const classes = classnames(namespace, {
|
|
33
|
-
[className]: className,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const xPos = position === 'end' ? width / 2 + 0.5 : 0.5;
|
|
37
|
-
const yPos = height / 2;
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<marker
|
|
41
|
-
className={classes}
|
|
42
|
-
markerHeight={height}
|
|
43
|
-
markerWidth={width}
|
|
44
|
-
orient={orient}
|
|
45
|
-
id={id}
|
|
46
|
-
refX={refX || xPos}
|
|
47
|
-
refY={refY || yPos}
|
|
48
|
-
markerUnits="userSpaceOnUse">
|
|
49
|
-
<path d={d} style={{ fill: color }} />
|
|
50
|
-
</marker>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const ArrowLeftMarker = ({ ...rest }) => <Marker {...arrowLeft} {...rest} />;
|
|
55
|
-
const ArrowRightMarker = ({ ...rest }) => <Marker {...arrowRight} {...rest} />;
|
|
56
|
-
const CircleMarker = ({ ...rest }) => <Marker {...circle} {...rest} />;
|
|
57
|
-
const DiamondMarker = ({ ...rest }) => <Marker {...diamond} {...rest} />;
|
|
58
|
-
const SquareMarker = ({ ...rest }) => <Marker {...square} {...rest} />;
|
|
59
|
-
const TeeMarker = ({ ...rest }) => <Marker {...tee} {...rest} />;
|
|
60
|
-
|
|
61
|
-
export {
|
|
62
|
-
Marker as default,
|
|
63
|
-
ArrowLeftMarker,
|
|
64
|
-
ArrowRightMarker,
|
|
65
|
-
CircleMarker,
|
|
66
|
-
DiamondMarker,
|
|
67
|
-
SquareMarker,
|
|
68
|
-
TeeMarker,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
Marker.propTypes = {
|
|
72
|
-
/**
|
|
73
|
-
* Provide an optional class to be applied on the outer element
|
|
74
|
-
*/
|
|
75
|
-
className: PropTypes.string,
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Specify the marker's color
|
|
79
|
-
*/
|
|
80
|
-
color: PropTypes.string,
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Specify a path string
|
|
84
|
-
*/
|
|
85
|
-
d: PropTypes.string,
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Specify an ID for the marker
|
|
89
|
-
*/
|
|
90
|
-
id: PropTypes.string,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Specify the orient attribute for the marker
|
|
94
|
-
*/
|
|
95
|
-
orient: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Specify the height attribute for the marker
|
|
99
|
-
*/
|
|
100
|
-
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Specify the width attribute for the marker
|
|
104
|
-
*/
|
|
105
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Specify whether this marker appears at the start or end of a line
|
|
109
|
-
*/
|
|
110
|
-
position: PropTypes.oneOf(['end', 'start']),
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Specify the refX attribute for the marker
|
|
114
|
-
*/
|
|
115
|
-
refX: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Specify the refY attribute for the marker
|
|
119
|
-
*/
|
|
120
|
-
refY: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
121
|
-
};
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Carbon Prefix
|
|
5
|
-
import { carbonPrefix } from '../configs';
|
|
6
|
-
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
import classnames from 'classnames';
|
|
9
|
-
|
|
10
|
-
const ShapeNode = ({
|
|
11
|
-
as = 'div',
|
|
12
|
-
className,
|
|
13
|
-
href = null,
|
|
14
|
-
onClick = null,
|
|
15
|
-
onMouseEnter = null,
|
|
16
|
-
onMouseOver = null,
|
|
17
|
-
onMouseOut = null,
|
|
18
|
-
onMouseLeave = null,
|
|
19
|
-
onMouseMove = null,
|
|
20
|
-
position = 'fixed',
|
|
21
|
-
bodyPosition = 'absolute',
|
|
22
|
-
renderIcon,
|
|
23
|
-
size = 48,
|
|
24
|
-
stacked,
|
|
25
|
-
shape = 'circle',
|
|
26
|
-
subtitle,
|
|
27
|
-
title,
|
|
28
|
-
}: any) => {
|
|
29
|
-
const namespace = `${carbonPrefix}--cc--shape-node`;
|
|
30
|
-
|
|
31
|
-
let Component = 'div';
|
|
32
|
-
|
|
33
|
-
if (href) {
|
|
34
|
-
Component = 'a';
|
|
35
|
-
} else if (onClick) {
|
|
36
|
-
Component = 'button';
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const circleClasses = classnames(namespace, {
|
|
40
|
-
[`${namespace}--stacked`]: stacked,
|
|
41
|
-
[`${namespace}--${shape}`]: shape,
|
|
42
|
-
[`${namespace}--${Component}`]: Component,
|
|
43
|
-
[className]: className,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const titleElement = title ? (
|
|
47
|
-
<div className={`${namespace}__title`}>{title}</div>
|
|
48
|
-
) : null;
|
|
49
|
-
const subtitleElement = subtitle ? (
|
|
50
|
-
<div className={`${namespace}__subtitle`}>{subtitle}</div>
|
|
51
|
-
) : null;
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
<Component
|
|
56
|
-
className={circleClasses}
|
|
57
|
-
onClick={onClick}
|
|
58
|
-
onMouseEnter={onMouseEnter}
|
|
59
|
-
onMouseOver={onMouseOver}
|
|
60
|
-
onMouseOut={onMouseOut}
|
|
61
|
-
onMouseLeave={onMouseLeave}
|
|
62
|
-
onMouseMove={onMouseMove}
|
|
63
|
-
style={{ height: size, width: size, position }}
|
|
64
|
-
tabIndex={0}>
|
|
65
|
-
<div className={`${namespace}__icon`}>{renderIcon}</div>
|
|
66
|
-
<div
|
|
67
|
-
className={`${namespace}__body`}
|
|
68
|
-
style={{ position: bodyPosition }}>
|
|
69
|
-
{titleElement}
|
|
70
|
-
{subtitleElement}
|
|
71
|
-
</div>
|
|
72
|
-
</Component>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
ShapeNode.propTypes = {
|
|
77
|
-
/** Provide a custom element to be rendered instead of the default */
|
|
78
|
-
as: PropTypes.oneOf(['div', 'a', 'button']),
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Provide an optional class to be applied on the outer element
|
|
82
|
-
*/
|
|
83
|
-
className: PropTypes.string,
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Optionally specify an href for the CardNode to become an `<a>` element
|
|
87
|
-
*/
|
|
88
|
-
href: PropTypes.string,
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Provide an optional function to be called when the CardNode
|
|
92
|
-
* is clicked, turning the CardNode into a `<button>` element
|
|
93
|
-
*/
|
|
94
|
-
onClick: PropTypes.func,
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Provide an optional function to be called for the onMouseEnter event
|
|
98
|
-
*/
|
|
99
|
-
onMouseEnter: PropTypes.func,
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Provide an optional function to be called for the onMouseOver event
|
|
103
|
-
*/
|
|
104
|
-
onMouseOver: PropTypes.func,
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Provide an optional function to be called for the onMouseOut event
|
|
108
|
-
*/
|
|
109
|
-
onMouseOut: PropTypes.func,
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Provide an optional function to be called for the onMouseLeave event
|
|
113
|
-
*/
|
|
114
|
-
onMouseLeave: PropTypes.func,
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Provide an optional function to be called for the onMouseMove event
|
|
118
|
-
*/
|
|
119
|
-
onMouseMove: PropTypes.func,
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Function to render your own icon in the underlying button
|
|
123
|
-
*/
|
|
124
|
-
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Specify the height and width of the shape
|
|
128
|
-
* Can be defined using any CSS length unit (px, %, rem)
|
|
129
|
-
*/
|
|
130
|
-
size: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Specify whether the node displays a stacked effect
|
|
134
|
-
*/
|
|
135
|
-
stacked: PropTypes.bool,
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Specify the shape of the node
|
|
139
|
-
*/
|
|
140
|
-
shape: PropTypes.oneOf(['circle', 'square', 'rounded-square']),
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Specify the node's subtitle
|
|
144
|
-
*/
|
|
145
|
-
subtitle: PropTypes.string,
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Specify the node's title
|
|
149
|
-
*/
|
|
150
|
-
title: PropTypes.string,
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export default ShapeNode;
|
package/src/diagrams/configs.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const carbonPrefix = 'cds';
|