|
1 |
| -import PropTypes from 'prop-types' |
2 |
| -import { motionPropTypes } from '@nivo/core' |
3 |
| -import { inheritedColorPropType } from '@nivo/colors' |
4 |
| - |
5 |
| -const commonPropTypes = { |
6 |
| - nodes: PropTypes.arrayOf( |
7 |
| - PropTypes.shape({ |
8 |
| - id: PropTypes.string.isRequired, |
9 |
| - }) |
10 |
| - ).isRequired, |
11 |
| - links: PropTypes.arrayOf( |
12 |
| - PropTypes.shape({ |
13 |
| - source: PropTypes.string.isRequired, |
14 |
| - target: PropTypes.string.isRequired, |
15 |
| - }) |
16 |
| - ).isRequired, |
17 |
| - |
18 |
| - layers: PropTypes.arrayOf( |
19 |
| - PropTypes.oneOfType([PropTypes.oneOf(['links', 'nodes']), PropTypes.func]) |
20 |
| - ).isRequired, |
21 |
| - |
22 |
| - linkDistance: PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.number]) |
23 |
| - .isRequired, |
24 |
| - repulsivity: PropTypes.number.isRequired, |
25 |
| - distanceMin: PropTypes.number.isRequired, |
26 |
| - distanceMax: PropTypes.number.isRequired, |
27 |
| - iterations: PropTypes.number.isRequired, |
28 |
| - |
29 |
| - nodeColor: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired, |
30 |
| - nodeBorderWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.func]).isRequired, |
31 |
| - nodeBorderColor: inheritedColorPropType.isRequired, |
32 |
| - |
33 |
| - linkThickness: PropTypes.oneOfType([PropTypes.number, PropTypes.func]).isRequired, |
34 |
| - linkColor: inheritedColorPropType.isRequired, |
35 |
| - |
36 |
| - isInteractive: PropTypes.bool.isRequired, |
37 |
| - onClick: PropTypes.func, |
38 |
| -} |
39 |
| - |
40 |
| -export const NetworkPropTypes = { |
41 |
| - ...commonPropTypes, |
42 |
| - role: PropTypes.string.isRequired, |
43 |
| - ...motionPropTypes, |
44 |
| -} |
45 |
| - |
46 |
| -export const NetworkCanvasPropTypes = { |
47 |
| - pixelRatio: PropTypes.number.isRequired, |
48 |
| - ...commonPropTypes, |
49 |
| -} |
50 |
| - |
51 | 1 | const commonDefaultProps = {
|
52 | 2 | layers: ['links', 'nodes'],
|
53 | 3 |
|
|
0 commit comments