/
props.js
97 lines (78 loc) · 2.86 KB
/
props.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
* This file is part of the nivo project.
*
* Copyright 2016-present, Raphaël Benitte.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import PropTypes from 'prop-types'
import { ordinalColorsPropType, inheritedColorPropType } from '@nivo/colors'
import { motionPropTypes } from '@nivo/core'
import { annotationSpecPropType } from '@nivo/annotations'
export const FunnelPropTypes = {
data: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
value: PropTypes.number.isRequired,
label: PropTypes.string,
})
).isRequired,
layers: PropTypes.arrayOf(
PropTypes.oneOfType([
PropTypes.oneOf(['separators', 'parts', 'labels', 'annotations']),
PropTypes.func,
])
).isRequired,
direction: PropTypes.oneOf(['horizontal', 'vertical']).isRequired,
interpolation: PropTypes.oneOf(['linear', 'smooth']).isRequired,
spacing: PropTypes.number.isRequired,
shapeBlending: PropTypes.number.isRequired,
colors: ordinalColorsPropType.isRequired,
fillOpacity: PropTypes.number.isRequired,
borderWidth: PropTypes.number.isRequired,
borderColor: inheritedColorPropType.isRequired,
borderOpacity: PropTypes.number.isRequired,
enableLabel: PropTypes.bool.isRequired,
labelColor: inheritedColorPropType.isRequired,
enableBeforeSeparators: PropTypes.bool.isRequired,
beforeSeparatorLength: PropTypes.number.isRequired,
beforeSeparatorOffset: PropTypes.number.isRequired,
enableAfterSeparators: PropTypes.bool.isRequired,
afterSeparatorLength: PropTypes.number.isRequired,
afterSeparatorOffset: PropTypes.number.isRequired,
annotations: PropTypes.arrayOf(annotationSpecPropType).isRequired,
isInteractive: PropTypes.bool.isRequired,
currentPartSizeExtension: PropTypes.number.isRequired,
currentBorderWidth: PropTypes.number,
onClick: PropTypes.func,
onMouseEnter: PropTypes.func,
onMouseLeave: PropTypes.func,
...motionPropTypes,
}
export const FunnelDefaultProps = {
layers: ['separators', 'parts', 'labels', 'annotations'],
direction: 'vertical',
interpolation: 'smooth',
spacing: 0,
shapeBlending: 0.66,
colors: { scheme: 'nivo' },
fillOpacity: 1,
borderWidth: 6,
borderColor: { from: 'color' },
borderOpacity: 0.66,
enableLabel: true,
labelColor: { from: 'color', modifiers: [['darker', 2]] },
enableBeforeSeparators: true,
beforeSeparatorLength: 0,
beforeSeparatorOffset: 0,
enableAfterSeparators: true,
afterSeparatorLength: 0,
afterSeparatorOffset: 0,
annotations: [],
isInteractive: true,
currentPartSizeExtension: 0,
animate: true,
motionDamping: 13,
motionStiffness: 90,
}