dce-reactkit 1.0.18 → 2.0.0
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/.eslintrc.js +95 -0
- package/lib/components/LoadingSpinner.d.ts +7 -0
- package/lib/components/LoadingSpinner.js +39 -0
- package/lib/components/LoadingSpinner.js.map +1 -0
- package/lib/components/Modal.d.ts +69 -0
- package/lib/components/Modal.js +311 -0
- package/lib/components/Modal.js.map +1 -0
- package/lib/helpers/abbreviate.d.ts +9 -0
- package/lib/helpers/abbreviate.js +21 -0
- package/lib/helpers/abbreviate.js.map +1 -0
- package/lib/helpers/avg.d.ts +8 -0
- package/lib/helpers/avg.js +24 -0
- package/lib/helpers/avg.js.map +1 -0
- package/lib/helpers/ceilToNumDecimals.d.ts +9 -0
- package/lib/helpers/ceilToNumDecimals.js +15 -0
- package/lib/helpers/ceilToNumDecimals.js.map +1 -0
- package/lib/helpers/floorToNumDecimals.d.ts +9 -0
- package/lib/helpers/floorToNumDecimals.js +15 -0
- package/lib/helpers/floorToNumDecimals.js.map +1 -0
- package/lib/helpers/forceNumIntoBounds.d.ts +10 -0
- package/lib/helpers/forceNumIntoBounds.js +15 -0
- package/lib/helpers/forceNumIntoBounds.js.map +1 -0
- package/lib/helpers/padDecimalZeros.d.ts +10 -0
- package/lib/helpers/padDecimalZeros.js +30 -0
- package/lib/helpers/padDecimalZeros.js.map +1 -0
- package/lib/helpers/padZerosLeft.d.ts +9 -0
- package/lib/helpers/padZerosLeft.js +21 -0
- package/lib/helpers/padZerosLeft.js.map +1 -0
- package/lib/helpers/roundToNumDecimals.d.ts +9 -0
- package/lib/helpers/roundToNumDecimals.js +15 -0
- package/lib/helpers/roundToNumDecimals.js.map +1 -0
- package/lib/helpers/sum.d.ts +8 -0
- package/lib/helpers/sum.js +15 -0
- package/lib/helpers/sum.js.map +1 -0
- package/lib/helpers/waitMs.d.ts +7 -0
- package/lib/helpers/waitMs.js +55 -0
- package/lib/helpers/waitMs.js.map +1 -0
- package/lib/types/Variant.d.ts +15 -0
- package/lib/types/Variant.js +19 -0
- package/lib/types/Variant.js.map +1 -0
- package/package.json +22 -39
- package/src/components/LoadingSpinner.scss +50 -0
- package/src/components/LoadingSpinner.tsx +50 -0
- package/src/components/Modal.scss +48 -0
- package/src/components/Modal.tsx +391 -0
- package/src/helpers/abbreviate.tsx +23 -0
- package/src/helpers/avg.tsx +22 -0
- package/src/helpers/ceilToNumDecimals.tsx +13 -0
- package/src/helpers/floorToNumDecimals.tsx +13 -0
- package/src/helpers/forceNumIntoBounds.tsx +19 -0
- package/src/helpers/padDecimalZeros.tsx +32 -0
- package/src/helpers/padZerosLeft.tsx +21 -0
- package/src/helpers/roundToNumDecimals.tsx +13 -0
- package/src/helpers/sum.tsx +16 -0
- package/src/helpers/waitMs.tsx +12 -0
- package/src/types/Variant.tsx +16 -0
- package/tsconfig.json +24 -0
- package/Bar.js +0 -169
- package/Donut.js +0 -145
- package/DownloadButton.js +0 -81
- package/Histogram.js +0 -193
- package/Scatter.js +0 -162
- package/common/chart/Holder/index.js +0 -182
- package/common/chart/Holder/style.css +0 -41
- package/common/chart/colors.js +0 -12
- package/common/csvToString.js +0 -23
- package/common/isFloat.js +0 -14
- package/common/isInteger.js +0 -24
- package/common/math.js +0 -21
- package/common/validators.js +0 -18
- package/glyph/Adjust.js +0 -13
- package/glyph/Angle.js +0 -44
- package/glyph/Archive.js +0 -13
- package/glyph/Arrow.js +0 -49
- package/glyph/ArrowsHorizontal.js +0 -13
- package/glyph/ArrowsVertical.js +0 -13
- package/glyph/Award.js +0 -13
- package/glyph/Ban.js +0 -13
- package/glyph/Barcode.js +0 -13
- package/glyph/Bed.js +0 -13
- package/glyph/Bell.js +0 -35
- package/glyph/Bolt.js +0 -13
- package/glyph/Bookmark.js +0 -37
- package/glyph/Bug.js +0 -13
- package/glyph/Calendar.js +0 -13
- package/glyph/Check.js +0 -36
- package/glyph/Checkbox.js +0 -40
- package/glyph/Chevron.js +0 -63
- package/glyph/Circle.js +0 -15
- package/glyph/Cog.js +0 -13
- package/glyph/DoubleAngle.js +0 -45
- package/glyph/Download.js +0 -13
- package/glyph/Ellipsis.js +0 -36
- package/glyph/Envelope.js +0 -13
- package/glyph/File.js +0 -37
- package/glyph/IdCard.js +0 -13
- package/glyph/Menu.js +0 -13
- package/glyph/Minus.js +0 -13
- package/glyph/Move.js +0 -13
- package/glyph/Plus.js +0 -13
- package/glyph/Square.js +0 -47
- package/glyph/Teacher.js +0 -13
- package/glyph/TextAlign.js +0 -53
- package/glyph/Times.js +0 -36
- package/glyph/WarningTriangle.js +0 -13
- package/index.js +0 -1
package/Scatter.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import rechart components
|
|
5
|
-
import { ResponsiveContainer, ScatterChart, Scatter as ScatterLib, XAxis, YAxis, CartesianGrid, Tooltip, Legend } from 'recharts';
|
|
6
|
-
|
|
7
|
-
// Import helpers
|
|
8
|
-
import csvToString from './common/csvToString';
|
|
9
|
-
|
|
10
|
-
// Import other components
|
|
11
|
-
import Holder from './common/chart/Holder';
|
|
12
|
-
|
|
13
|
-
// Import default colors
|
|
14
|
-
import colors from './common/chart/colors';
|
|
15
|
-
|
|
16
|
-
/* Scatter Chart Component */
|
|
17
|
-
class Scatter extends Component {
|
|
18
|
-
render() {
|
|
19
|
-
// Deconstruct props (see propTypes below for detailed information)
|
|
20
|
-
const {
|
|
21
|
-
title,
|
|
22
|
-
color,
|
|
23
|
-
width,
|
|
24
|
-
height,
|
|
25
|
-
xLabel,
|
|
26
|
-
xUnit,
|
|
27
|
-
yLabel,
|
|
28
|
-
yUnit,
|
|
29
|
-
data,
|
|
30
|
-
noTooltipOnHover,
|
|
31
|
-
noDownload,
|
|
32
|
-
showLegend,
|
|
33
|
-
seriesName
|
|
34
|
-
} = this.props;
|
|
35
|
-
|
|
36
|
-
// Generate csv contents if we have a download button
|
|
37
|
-
let csvContents;
|
|
38
|
-
if (!noDownload) {
|
|
39
|
-
// Create x and y column labels dynamically
|
|
40
|
-
const xField = `${xLabel}${xUnit ? ' (' + xUnit + ')' : ''}`;
|
|
41
|
-
const yField = `${yLabel}${yUnit ? ' (' + yUnit + ')' : ''}`;
|
|
42
|
-
// Create the csv content object
|
|
43
|
-
const csv = {
|
|
44
|
-
fields: [xField, yField],
|
|
45
|
-
data: data.map(datum => {
|
|
46
|
-
return [datum.x, datum.y];
|
|
47
|
-
})
|
|
48
|
-
};
|
|
49
|
-
// Create the csv string
|
|
50
|
-
csvContents = csvToString(csv);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Render the component
|
|
54
|
-
return React.createElement(
|
|
55
|
-
Holder,
|
|
56
|
-
{
|
|
57
|
-
title: title,
|
|
58
|
-
xLabel: xLabel,
|
|
59
|
-
xUnit: xUnit,
|
|
60
|
-
yLabel: yLabel,
|
|
61
|
-
yUnit: yUnit,
|
|
62
|
-
width: width,
|
|
63
|
-
height: height,
|
|
64
|
-
csvContents: csvContents
|
|
65
|
-
},
|
|
66
|
-
React.createElement(
|
|
67
|
-
ResponsiveContainer,
|
|
68
|
-
{
|
|
69
|
-
width: '100%',
|
|
70
|
-
height: '100%'
|
|
71
|
-
},
|
|
72
|
-
React.createElement(
|
|
73
|
-
ScatterChart,
|
|
74
|
-
null,
|
|
75
|
-
React.createElement(CartesianGrid, null),
|
|
76
|
-
React.createElement(YAxis, {
|
|
77
|
-
dataKey: 'y',
|
|
78
|
-
type: 'number',
|
|
79
|
-
name: yLabel
|
|
80
|
-
}),
|
|
81
|
-
React.createElement(XAxis, {
|
|
82
|
-
dataKey: 'x',
|
|
83
|
-
type: 'number',
|
|
84
|
-
name: xLabel
|
|
85
|
-
}),
|
|
86
|
-
!noTooltipOnHover && React.createElement(Tooltip, {
|
|
87
|
-
cursor: {
|
|
88
|
-
strokeDasharray: '3 3'
|
|
89
|
-
}
|
|
90
|
-
}),
|
|
91
|
-
showLegend && React.createElement(Legend, null),
|
|
92
|
-
React.createElement(ScatterLib, {
|
|
93
|
-
name: seriesName,
|
|
94
|
-
data: data,
|
|
95
|
-
fill: color
|
|
96
|
-
})
|
|
97
|
-
)
|
|
98
|
-
)
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
Scatter.propTypes = {
|
|
104
|
-
// Title of the chart
|
|
105
|
-
title: PropTypes.string,
|
|
106
|
-
// CSS color (#123456 or 'white') for the points
|
|
107
|
-
color: PropTypes.string,
|
|
108
|
-
// Width ('100%' or 50)
|
|
109
|
-
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
110
|
-
// Height ('100%' or 50)
|
|
111
|
-
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
112
|
-
// Label for the x axis
|
|
113
|
-
xLabel: PropTypes.string,
|
|
114
|
-
// Unit for the x axis
|
|
115
|
-
xUnit: PropTypes.string,
|
|
116
|
-
// Label for the y axis
|
|
117
|
-
yLabel: PropTypes.string,
|
|
118
|
-
// Unit for the y axis
|
|
119
|
-
yUnit: PropTypes.string,
|
|
120
|
-
// Array of data objects
|
|
121
|
-
data: PropTypes.arrayOf(PropTypes.shape({
|
|
122
|
-
x: PropTypes.number,
|
|
123
|
-
y: PropTypes.number
|
|
124
|
-
})).isRequired,
|
|
125
|
-
// If true, no tooltip is shown when hovering over a point
|
|
126
|
-
noTooltipOnHover: PropTypes.bool,
|
|
127
|
-
// If true, no download button is shown
|
|
128
|
-
noDownload: PropTypes.bool,
|
|
129
|
-
// Name of the series (included and required for legend)
|
|
130
|
-
seriesName: PropTypes.string,
|
|
131
|
-
// If true, legend is included
|
|
132
|
-
showLegend: PropTypes.bool
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
Scatter.defaultProps = {
|
|
136
|
-
// Chart has no title by default
|
|
137
|
-
title: null,
|
|
138
|
-
// Scatter dots are neutral blue by default
|
|
139
|
-
color: colors.defaultBlue,
|
|
140
|
-
// Chart takes up full width of parent by default
|
|
141
|
-
width: '100%',
|
|
142
|
-
// Chart's height is 500px by default
|
|
143
|
-
height: '500px',
|
|
144
|
-
// Label for x axis is 'x-axis' by default
|
|
145
|
-
xLabel: 'x-axis',
|
|
146
|
-
// X axis has no unit by default
|
|
147
|
-
xUnit: null,
|
|
148
|
-
// Label for y axis is 'y-axis' by default
|
|
149
|
-
yLabel: 'y-axis',
|
|
150
|
-
// Y axis has no unit by default
|
|
151
|
-
yUnit: null,
|
|
152
|
-
// Scatter series is 'Chart' by default (for the legend)
|
|
153
|
-
seriesName: 'Chart',
|
|
154
|
-
// Tooltips are displayed by default
|
|
155
|
-
noTooltipOnHover: false,
|
|
156
|
-
// Download button is added by default
|
|
157
|
-
noDownload: false,
|
|
158
|
-
// No legend is included by default
|
|
159
|
-
showLegend: false
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
export default Scatter;
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import other components
|
|
5
|
-
import DownloadButton from '../../../DownloadButton';
|
|
6
|
-
|
|
7
|
-
// Import custom styles
|
|
8
|
-
import './style.css';
|
|
9
|
-
|
|
10
|
-
/* Holder Component */
|
|
11
|
-
class Holder extends Component {
|
|
12
|
-
render() {
|
|
13
|
-
// Deconstruct props (see propTypes below for detailed information)
|
|
14
|
-
const {
|
|
15
|
-
title,
|
|
16
|
-
xLabel,
|
|
17
|
-
xUnit,
|
|
18
|
-
yLabel,
|
|
19
|
-
yUnit,
|
|
20
|
-
width,
|
|
21
|
-
height,
|
|
22
|
-
csvContents,
|
|
23
|
-
children
|
|
24
|
-
} = this.props;
|
|
25
|
-
|
|
26
|
-
// Calculate dimensions of the holder
|
|
27
|
-
// > Chart height depends on if the title is included
|
|
28
|
-
const chartHeight = `calc(${height}${title ? ' - 2.5em' : ''}${xLabel ? ' - 1.5em' : ''})`;
|
|
29
|
-
// > Chart width depends on if there is a y axis label
|
|
30
|
-
const chartWidth = `calc(${width}${yLabel ? ' - 1.5em' : ''})`;
|
|
31
|
-
|
|
32
|
-
// The many parts of this component look like this:
|
|
33
|
-
// |""""""""""""""""""""""""""""""""""""""""""|
|
|
34
|
-
// | Chart title [Download] | <- title content
|
|
35
|
-
// """"""""""""""""""""""""""""""""""""""""""""
|
|
36
|
-
// |"""""|""""""""""""""""""""""""""""""""""""|
|
|
37
|
-
// | Y | |
|
|
38
|
-
// | L | |
|
|
39
|
-
// | A | |
|
|
40
|
-
// | B | Chart Here | <- top content
|
|
41
|
-
// | E | |
|
|
42
|
-
// | L | |
|
|
43
|
-
// | | |
|
|
44
|
-
// """"""""""""""""""""""""""""""""""""""""""""
|
|
45
|
-
// |""""""""""""""""""""""""""""""""""""""""""|
|
|
46
|
-
// | X LABEL | <- bottom content
|
|
47
|
-
// """"""""""""""""""""""""""""""""""""""""""""
|
|
48
|
-
|
|
49
|
-
// Create the title content (if there's a tite)
|
|
50
|
-
const titleContent = title ? React.createElement(
|
|
51
|
-
'div',
|
|
52
|
-
{
|
|
53
|
-
style: {
|
|
54
|
-
height: '2.5em'
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
React.createElement(
|
|
58
|
-
'h4',
|
|
59
|
-
{ className: 'text-center' },
|
|
60
|
-
title,
|
|
61
|
-
csvContents && React.createElement(DownloadButton, {
|
|
62
|
-
text: 'CSV',
|
|
63
|
-
filename: `${title}.csv`,
|
|
64
|
-
contents: csvContents,
|
|
65
|
-
marginLeft: '5px'
|
|
66
|
-
})
|
|
67
|
-
)
|
|
68
|
-
) : null;
|
|
69
|
-
|
|
70
|
-
// Create the top content
|
|
71
|
-
// (includes the y-axis label and the chart, side by side)
|
|
72
|
-
const topContent = React.createElement(
|
|
73
|
-
'div',
|
|
74
|
-
null,
|
|
75
|
-
yLabel && React.createElement(
|
|
76
|
-
'div',
|
|
77
|
-
{
|
|
78
|
-
className: 'y-label-container',
|
|
79
|
-
style: {
|
|
80
|
-
height: chartHeight
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
React.createElement(
|
|
84
|
-
'div',
|
|
85
|
-
{
|
|
86
|
-
style: {
|
|
87
|
-
width: chartHeight
|
|
88
|
-
},
|
|
89
|
-
className: 'y-label-text label-text'
|
|
90
|
-
},
|
|
91
|
-
yLabel,
|
|
92
|
-
yUnit && React.createElement(
|
|
93
|
-
'span',
|
|
94
|
-
{ className: 'unit' },
|
|
95
|
-
'(',
|
|
96
|
-
yUnit,
|
|
97
|
-
')'
|
|
98
|
-
)
|
|
99
|
-
)
|
|
100
|
-
),
|
|
101
|
-
React.createElement(
|
|
102
|
-
'div',
|
|
103
|
-
{
|
|
104
|
-
className: 'd-inline-block',
|
|
105
|
-
style: {
|
|
106
|
-
width: chartWidth,
|
|
107
|
-
height: chartHeight
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
children
|
|
111
|
-
)
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
// Create the bottom if there's an x label
|
|
115
|
-
// (includes the x label below the chart)
|
|
116
|
-
const bottomContent = xLabel ? React.createElement(
|
|
117
|
-
'div',
|
|
118
|
-
{ className: 'x-label-text label-text' },
|
|
119
|
-
xLabel,
|
|
120
|
-
xUnit && React.createElement(
|
|
121
|
-
'span',
|
|
122
|
-
{ className: 'unit' },
|
|
123
|
-
'(',
|
|
124
|
-
xUnit,
|
|
125
|
-
')'
|
|
126
|
-
)
|
|
127
|
-
) : null;
|
|
128
|
-
|
|
129
|
-
// Put all the pieces together into one component
|
|
130
|
-
return React.createElement(
|
|
131
|
-
'div',
|
|
132
|
-
{ className: 'mb-4' },
|
|
133
|
-
React.createElement(
|
|
134
|
-
'div',
|
|
135
|
-
{
|
|
136
|
-
className: 'outer-container',
|
|
137
|
-
style: {
|
|
138
|
-
width,
|
|
139
|
-
height
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
titleContent,
|
|
143
|
-
topContent,
|
|
144
|
-
bottomContent
|
|
145
|
-
)
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
Holder.propTypes = {
|
|
151
|
-
// Title of the chart
|
|
152
|
-
title: PropTypes.string,
|
|
153
|
-
// Label of the x axis
|
|
154
|
-
xLabel: PropTypes.string,
|
|
155
|
-
// Units on the x axis
|
|
156
|
-
xUnit: PropTypes.string,
|
|
157
|
-
// Label of the y axis
|
|
158
|
-
yLabel: PropTypes.string,
|
|
159
|
-
// Units on the y axis
|
|
160
|
-
yUnit: PropTypes.string,
|
|
161
|
-
// Width of the chart (does not include the title)
|
|
162
|
-
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
163
|
-
// Height of the chart (does not include the title)
|
|
164
|
-
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
165
|
-
// The chart object (should be set to fill 100% width an height)
|
|
166
|
-
children: PropTypes.node.isRequired,
|
|
167
|
-
// File contents to download
|
|
168
|
-
csvContents: PropTypes.string
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
Holder.defaultProps = {
|
|
172
|
-
title: null,
|
|
173
|
-
xLabel: null,
|
|
174
|
-
xUnit: null,
|
|
175
|
-
yLabel: null,
|
|
176
|
-
yUnit: null,
|
|
177
|
-
width: '100%',
|
|
178
|
-
height: '500px',
|
|
179
|
-
csvContents: null
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
export default Holder;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/* the outermost container of the holder */
|
|
2
|
-
.outer-container {
|
|
3
|
-
display: inline-block;
|
|
4
|
-
vertical-align: middle;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/* container for the y label - automatically moves to the left of the chart */
|
|
8
|
-
.y-label-container {
|
|
9
|
-
display: inline-block;
|
|
10
|
-
width: 1.5em;
|
|
11
|
-
float: left;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/* text of the y label - text is centered, vertical, and rotated */
|
|
15
|
-
.y-label-text {
|
|
16
|
-
display: inline-block;
|
|
17
|
-
height: 1.5em;
|
|
18
|
-
float: left;
|
|
19
|
-
transform: rotate(90deg);
|
|
20
|
-
transform-origin: 0.75em;
|
|
21
|
-
text-align: center;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/* text of the x label - text is centered */
|
|
25
|
-
.x-label-text {
|
|
26
|
-
height: 1.5em;
|
|
27
|
-
text-align: center;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/* styles shared between both x and y labels - bold, slightly larger text*/
|
|
31
|
-
.label-text {
|
|
32
|
-
font-size: 1.1em;
|
|
33
|
-
font-weight: bold;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/* axis unit style */
|
|
37
|
-
.unit {
|
|
38
|
-
margin-left: 5px;
|
|
39
|
-
font-style: italic;
|
|
40
|
-
font-weight: normal;
|
|
41
|
-
}
|
package/common/chart/colors.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* Default colors for use in charts, etc */
|
|
2
|
-
export default {
|
|
3
|
-
// A pretty neutral blue to use as a default color
|
|
4
|
-
defaultBlue: '#419bf7',
|
|
5
|
-
|
|
6
|
-
// A simple assortment of 14 colors
|
|
7
|
-
assortment: [
|
|
8
|
-
// First 10:
|
|
9
|
-
'#ec4f6a', '#f19542', '#f6c353', '#61cbcc', '#419bf7', '#005392', '#7d5297', '#d261ab', '#7edfcf', '#5eac88',
|
|
10
|
-
// Last 4:
|
|
11
|
-
'#f4ce63', '#929000', '#5e5e5e', '#008e00']
|
|
12
|
-
};
|
package/common/csvToString.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import CSVParser from 'papaparse';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Function for turning a csv object into a csv string
|
|
5
|
-
* @param {string[]} [csv.fields] - an array of field names. These will be used
|
|
6
|
-
* generate the header row of the csv
|
|
7
|
-
* @param {string[][]} [csv.data] - an array of csv rows, where each row is an
|
|
8
|
-
* array of strings that correspond to the cells of the row
|
|
9
|
-
* @return {string} the csv file contents
|
|
10
|
-
*/
|
|
11
|
-
export default (csv => {
|
|
12
|
-
return CSVParser.unparse(csv);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
// Example:
|
|
16
|
-
// const fields = ['Name', 'Age'];
|
|
17
|
-
// const data = [['Divardo', '19'], ['Calicci', '22']];
|
|
18
|
-
// const csv = { fields, data}
|
|
19
|
-
//
|
|
20
|
-
// Calling csvToString(csv) results in the following csv file:
|
|
21
|
-
// Name, Age
|
|
22
|
-
// Divardo, 19
|
|
23
|
-
// Calicci, 22
|
package/common/isFloat.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns true if a string is a float (not an integer)
|
|
3
|
-
* @param {string} str - the string to check
|
|
4
|
-
* @return {boolean} whether or not the string represents a float
|
|
5
|
-
*/
|
|
6
|
-
export default (str => {
|
|
7
|
-
const match = String(str).match(/^-?\d*(\.\d+)?$/);
|
|
8
|
-
// If no matches at all, this is not a float
|
|
9
|
-
if (!match || match.length < 2) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
// We found a match. Make sure it's a float
|
|
13
|
-
return !!match[1];
|
|
14
|
-
});
|
package/common/isInteger.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import isFloat from './isFloat';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns true if the string is an integer
|
|
5
|
-
* @param {string} str - the string to check
|
|
6
|
-
* @return {boolean} whether or not the string represents an integer
|
|
7
|
-
*/
|
|
8
|
-
export default (str => {
|
|
9
|
-
// Attempt to match
|
|
10
|
-
const matchSucceeded = String(str).match(/^-{0,1}\d+$/);
|
|
11
|
-
if (matchSucceeded) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Allow integers of form '1.'
|
|
16
|
-
const newStr = str.endsWith('.') ? `${str}0` : str;
|
|
17
|
-
|
|
18
|
-
// If no match, check if string represents an integer with decimals but all
|
|
19
|
-
// of which are zeroes
|
|
20
|
-
if (isFloat(newStr)) {
|
|
21
|
-
return parseFloat(newStr) % 1 === 0;
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
});
|
package/common/math.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash-arithmetic';
|
|
2
|
-
|
|
3
|
-
/* Simple object with high-precision mathematical functions */
|
|
4
|
-
export default {
|
|
5
|
-
// Adds a + b
|
|
6
|
-
add: (a, b) => {
|
|
7
|
-
return _.add(a, b);
|
|
8
|
-
},
|
|
9
|
-
// Subtracts b from a
|
|
10
|
-
sub: (a, b) => {
|
|
11
|
-
return _.subtract(a, b);
|
|
12
|
-
},
|
|
13
|
-
// Multiplies a * b
|
|
14
|
-
mult: (a, b) => {
|
|
15
|
-
return _.multiply(a, b);
|
|
16
|
-
},
|
|
17
|
-
// Divides a / b
|
|
18
|
-
div: (a, b) => {
|
|
19
|
-
return _.divide(a, b);
|
|
20
|
-
}
|
|
21
|
-
};
|
package/common/validators.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import Validator from 'validator';
|
|
2
|
-
|
|
3
|
-
/* Simple object of built-in text validators */
|
|
4
|
-
export default {
|
|
5
|
-
// Validates emails
|
|
6
|
-
email: Validator.isEmail,
|
|
7
|
-
// Validates 8-digit numbers (HUIDs)
|
|
8
|
-
eightDigit: datum => {
|
|
9
|
-
if (!Number.isNaN(parseFloat(datum))) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
return String(datum).length === 8;
|
|
13
|
-
},
|
|
14
|
-
// Validates numbers
|
|
15
|
-
number: datum => {
|
|
16
|
-
return !Number.isNaN(parseFloat(datum));
|
|
17
|
-
}
|
|
18
|
-
};
|
package/glyph/Adjust.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2
|
-
|
|
3
|
-
import React, { Component } from 'react';
|
|
4
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
-
import { faAdjust } from '@fortawesome/free-solid-svg-icons';
|
|
6
|
-
|
|
7
|
-
class Adjust extends Component {
|
|
8
|
-
render() {
|
|
9
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faAdjust }, this.props));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default Adjust;
|
package/glyph/Angle.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2
|
-
|
|
3
|
-
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
4
|
-
|
|
5
|
-
import React, { Component } from 'react';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
8
|
-
import { faAngleUp, faAngleDown, faAngleRight, faAngleLeft } from '@fortawesome/free-solid-svg-icons';
|
|
9
|
-
|
|
10
|
-
/* use direction="up|down|left|right" (default is "right")
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
class Angle extends Component {
|
|
14
|
-
render() {
|
|
15
|
-
// Extract props
|
|
16
|
-
const _props = this.props,
|
|
17
|
-
{
|
|
18
|
-
direction
|
|
19
|
-
} = _props,
|
|
20
|
-
props = _objectWithoutProperties(_props, ['direction']);
|
|
21
|
-
|
|
22
|
-
switch (direction) {
|
|
23
|
-
case 'up':
|
|
24
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faAngleUp }, props));
|
|
25
|
-
case 'down':
|
|
26
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faAngleDown }, props));
|
|
27
|
-
case 'left':
|
|
28
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faAngleLeft }, props));
|
|
29
|
-
default:
|
|
30
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faAngleRight }, props));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
Angle.propTypes = {
|
|
36
|
-
/* Direction of the angle */
|
|
37
|
-
direction: PropTypes.oneOf(['up', 'down', 'left', 'right'])
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
Angle.defaultProps = {
|
|
41
|
-
direction: 'right'
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default Angle;
|
package/glyph/Archive.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2
|
-
|
|
3
|
-
import React, { Component } from 'react';
|
|
4
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
-
import { faArchive } from '@fortawesome/free-solid-svg-icons';
|
|
6
|
-
|
|
7
|
-
class Archive extends Component {
|
|
8
|
-
render() {
|
|
9
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faArchive }, this.props));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default Archive;
|
package/glyph/Arrow.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2
|
-
|
|
3
|
-
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
4
|
-
|
|
5
|
-
import React, { Component } from 'react';
|
|
6
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
7
|
-
import { faArrowUp, faArrowDown, faArrowRight, faArrowLeft, faArrowCircleUp, faArrowCircleDown, faArrowCircleRight, faArrowCircleLeft } from '@fortawesome/free-solid-svg-icons';
|
|
8
|
-
|
|
9
|
-
/* use direction="up|down|left|right" (default is "right")
|
|
10
|
-
* add circled prop to put the chevron in a circle bubble
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
class Arrow extends Component {
|
|
14
|
-
render() {
|
|
15
|
-
// Extract props
|
|
16
|
-
const _props = this.props,
|
|
17
|
-
{
|
|
18
|
-
circled,
|
|
19
|
-
direction
|
|
20
|
-
} = _props,
|
|
21
|
-
props = _objectWithoutProperties(_props, ['circled', 'direction']);
|
|
22
|
-
|
|
23
|
-
if (circled) {
|
|
24
|
-
switch (direction) {
|
|
25
|
-
case 'up':
|
|
26
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faArrowCircleUp }, props));
|
|
27
|
-
case 'down':
|
|
28
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faArrowCircleDown }, props));
|
|
29
|
-
case 'left':
|
|
30
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faArrowCircleLeft }, props));
|
|
31
|
-
default:
|
|
32
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faArrowCircleRight }, props));
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
switch (direction) {
|
|
36
|
-
case 'up':
|
|
37
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faArrowUp }, props));
|
|
38
|
-
case 'down':
|
|
39
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faArrowDown }, props));
|
|
40
|
-
case 'left':
|
|
41
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faArrowLeft }, props));
|
|
42
|
-
default:
|
|
43
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faArrowRight }, props));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default Arrow;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2
|
-
|
|
3
|
-
import React, { Component } from 'react';
|
|
4
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
-
import { faArrowsAltH } from '@fortawesome/free-solid-svg-icons';
|
|
6
|
-
|
|
7
|
-
class ArrowsHorizontal extends Component {
|
|
8
|
-
render() {
|
|
9
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faArrowsAltH }, this.props));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default ArrowsHorizontal;
|
package/glyph/ArrowsVertical.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2
|
-
|
|
3
|
-
import React, { Component } from 'react';
|
|
4
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
-
import { faArrowsAltV } from '@fortawesome/free-solid-svg-icons';
|
|
6
|
-
|
|
7
|
-
class ArrowsVertical extends Component {
|
|
8
|
-
render() {
|
|
9
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faArrowsAltV }, this.props));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default ArrowsVertical;
|
package/glyph/Award.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
2
|
-
|
|
3
|
-
import React, { Component } from 'react';
|
|
4
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
|
-
import { faAward } from '@fortawesome/free-solid-svg-icons';
|
|
6
|
-
|
|
7
|
-
class Award extends Component {
|
|
8
|
-
render() {
|
|
9
|
-
return React.createElement(FontAwesomeIcon, _extends({ icon: faAward }, this.props));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default Award;
|