dce-reactkit 1.0.20 → 2.0.2
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 +6 -0
- package/lib/components/LoadingSpinner.js +41 -0
- package/lib/components/LoadingSpinner.js.map +1 -0
- package/lib/components/Modal.d.ts +69 -0
- package/lib/components/Modal.js +315 -0
- package/lib/components/Modal.js.map +1 -0
- package/lib/errors/ErrorWithCode.d.ts +9 -0
- package/lib/errors/ErrorWithCode.js +33 -0
- package/lib/errors/ErrorWithCode.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/visitServerEndpoint.d.ts +17 -0
- package/lib/helpers/visitServerEndpoint.js +84 -0
- package/lib/helpers/visitServerEndpoint.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/ReactKitErrorCode.d.ts +9 -0
- package/lib/types/ReactKitErrorCode.js +14 -0
- package/lib/types/ReactKitErrorCode.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 -40
- package/src/components/LoadingSpinner.tsx +105 -0
- package/src/components/Modal.tsx +447 -0
- package/src/errors/ErrorWithCode.tsx +15 -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/visitServerEndpoint.tsx +59 -0
- package/src/helpers/waitMs.tsx +12 -0
- package/src/types/ReactKitErrorCode.tsx +12 -0
- package/src/types/Variant.tsx +16 -0
- package/tsconfig.json +24 -0
- package/index.js +0 -1
- package/lib/Bar.js +0 -169
- package/lib/Donut.js +0 -145
- package/lib/DownloadButton.js +0 -81
- package/lib/Histogram.js +0 -193
- package/lib/Scatter.js +0 -162
- package/lib/StackedBar.js +0 -243
- package/lib/common/chart/Holder/index.js +0 -182
- package/lib/common/chart/Holder/style.css +0 -41
- package/lib/common/chart/colors.js +0 -12
- package/lib/common/csvToString.js +0 -23
- package/lib/common/isFloat.js +0 -14
- package/lib/common/isInteger.js +0 -24
- package/lib/common/math.js +0 -21
- package/lib/common/validators.js +0 -18
- package/lib/glyph/Adjust.js +0 -13
- package/lib/glyph/Angle.js +0 -44
- package/lib/glyph/Archive.js +0 -13
- package/lib/glyph/Arrow.js +0 -49
- package/lib/glyph/ArrowsHorizontal.js +0 -13
- package/lib/glyph/ArrowsVertical.js +0 -13
- package/lib/glyph/Award.js +0 -13
- package/lib/glyph/Ban.js +0 -13
- package/lib/glyph/Barcode.js +0 -13
- package/lib/glyph/Bed.js +0 -13
- package/lib/glyph/Bell.js +0 -35
- package/lib/glyph/Bolt.js +0 -13
- package/lib/glyph/Bookmark.js +0 -37
- package/lib/glyph/Bug.js +0 -13
- package/lib/glyph/Calendar.js +0 -13
- package/lib/glyph/Check.js +0 -36
- package/lib/glyph/Checkbox.js +0 -40
- package/lib/glyph/Chevron.js +0 -63
- package/lib/glyph/Circle.js +0 -15
- package/lib/glyph/Cog.js +0 -13
- package/lib/glyph/DoubleAngle.js +0 -45
- package/lib/glyph/Download.js +0 -13
- package/lib/glyph/Ellipsis.js +0 -36
- package/lib/glyph/Envelope.js +0 -13
- package/lib/glyph/File.js +0 -37
- package/lib/glyph/IdCard.js +0 -13
- package/lib/glyph/Menu.js +0 -13
- package/lib/glyph/Minus.js +0 -13
- package/lib/glyph/Move.js +0 -13
- package/lib/glyph/Plus.js +0 -13
- package/lib/glyph/Square.js +0 -47
- package/lib/glyph/Teacher.js +0 -13
- package/lib/glyph/TextAlign.js +0 -53
- package/lib/glyph/Times.js +0 -36
- package/lib/glyph/WarningTriangle.js +0 -13
- package/lib/index.js +0 -1
- package/src-old/common/csvToString.js +0 -5
- package/src-old/common/isFloat.js +0 -3
- package/src-old/common/isInteger.js +0 -14
- package/src-old/common/math.js +0 -16
- package/src-old/common/validators.js +0 -14
- package/src-old/components/Alert.js +0 -79
- package/src-old/components/Button.js +0 -64
- package/src-old/components/CSV/autoMatch.js +0 -174
- package/src-old/components/CSV/getNumCols.js +0 -15
- package/src-old/components/CSV/index.js +0 -743
- package/src-old/components/Card.js +0 -64
- package/src-old/components/Chart/Bar.js +0 -169
- package/src-old/components/Chart/Donut.js +0 -160
- package/src-old/components/Chart/Histogram.js +0 -189
- package/src-old/components/Chart/Scatter.js +0 -162
- package/src-old/components/Chart/colors.js +0 -20
- package/src-old/components/Checkbox/index.js +0 -106
- package/src-old/components/Checkbox/style.css +0 -11
- package/src-old/components/DatePicker.js +0 -59
- package/src-old/components/DownloadButton.js +0 -72
- package/src-old/components/Dropdown.js +0 -120
- package/src-old/components/Layout/LeftAddon.js +0 -63
- package/src-old/components/Layout/RightAddon.js +0 -64
- package/src-old/components/Layout/TwoCol.js +0 -67
- package/src-old/components/Modal.js +0 -161
- package/src-old/components/PhotoRoster.js +0 -152
- package/src-old/components/Pills.js +0 -117
- package/src-old/components/Radio.js +0 -94
- package/src-old/components/Splash/Error.js +0 -62
- package/src-old/components/Splash/Load/index.js +0 -32
- package/src-old/components/Splash/Load/style.css +0 -51
- package/src-old/components/Stat/General.js +0 -252
- package/src-old/components/Stat/helpers/calcAverage.js +0 -20
- package/src-old/components/Stat/helpers/calcExtremes.js +0 -27
- package/src-old/components/Stat/helpers/calcMedian.js +0 -32
- package/src-old/components/Stat/helpers/calcStdDev.js +0 -30
- package/src-old/components/Stat/helpers/calcSum.js +0 -8
- package/src-old/components/UserProfile/index.js +0 -151
- package/src-old/components/UserProfile/style.css +0 -33
- package/src-old/components/Well.js +0 -28
- package/src-old/components/Wizard/Question/CSV.js +0 -307
- package/src-old/components/Wizard/Question/Chooser/Assignment.js +0 -108
- package/src-old/components/Wizard/Question/Chooser/Course.js +0 -214
- package/src-old/components/Wizard/Question/Chooser/helpers/divideIntoSections.js +0 -16
- package/src-old/components/Wizard/Question/Chooser/helpers/genGetItemsPromise.js +0 -20
- package/src-old/components/Wizard/Question/Chooser/helpers/preprocessSections.js +0 -36
- package/src-old/components/Wizard/Question/Chooser/index.js +0 -306
- package/src-old/components/Wizard/Question/Form/Field/CheckableItem.js +0 -155
- package/src-old/components/Wizard/Question/Form/Field/Input.js +0 -149
- package/src-old/components/Wizard/Question/Form/Field/NumberItem.js +0 -374
- package/src-old/components/Wizard/Question/Form/Field/index.js +0 -34
- package/src-old/components/Wizard/Question/Form/Field/readme.md +0 -7
- package/src-old/components/Wizard/Question/Form/index.js +0 -175
- package/src-old/components/Wizard/Question/Form/style.css +0 -3
- package/src-old/components/Wizard/Question/OneButton.js +0 -80
- package/src-old/components/Wizard/Question/index.js +0 -46
- package/src-old/components/Wizard/Question/readme.md +0 -10
- package/src-old/components/Wizard/QuestionGroup/AnswerAll.js +0 -126
- package/src-old/components/Wizard/QuestionGroup/AnswerAny.js +0 -60
- package/src-old/components/Wizard/index.js +0 -233
- package/src-old/components/Wizard/style.css +0 -21
- package/src-old/glyphs/Adjust.js +0 -13
- package/src-old/glyphs/Angle.js +0 -57
- package/src-old/glyphs/Archive.js +0 -13
- package/src-old/glyphs/Arrow.js +0 -85
- package/src-old/glyphs/ArrowsHorizontal.js +0 -13
- package/src-old/glyphs/ArrowsVertical.js +0 -13
- package/src-old/glyphs/Award.js +0 -13
- package/src-old/glyphs/Ban.js +0 -13
- package/src-old/glyphs/Barcode.js +0 -13
- package/src-old/glyphs/Bed.js +0 -13
- package/src-old/glyphs/Bell.js +0 -34
- package/src-old/glyphs/Bolt.js +0 -13
- package/src-old/glyphs/Bookmark.js +0 -36
- package/src-old/glyphs/Bug.js +0 -13
- package/src-old/glyphs/Calendar.js +0 -13
- package/src-old/glyphs/Check.js +0 -34
- package/src-old/glyphs/Checkbox.js +0 -42
- package/src-old/glyphs/Chevron.js +0 -88
- package/src-old/glyphs/Circle.js +0 -16
- package/src-old/glyphs/Cog.js +0 -13
- package/src-old/glyphs/DoubleAngle.js +0 -58
- package/src-old/glyphs/Download.js +0 -13
- package/src-old/glyphs/Ellipsis.js +0 -35
- package/src-old/glyphs/Envelope.js +0 -13
- package/src-old/glyphs/File.js +0 -40
- package/src-old/glyphs/IdCard.js +0 -13
- package/src-old/glyphs/Menu.js +0 -13
- package/src-old/glyphs/Minus.js +0 -13
- package/src-old/glyphs/Move.js +0 -13
- package/src-old/glyphs/Plus.js +0 -13
- package/src-old/glyphs/Square.js +0 -48
- package/src-old/glyphs/Teacher.js +0 -13
- package/src-old/glyphs/TextAlign.js +0 -58
- package/src-old/glyphs/Times.js +0 -34
- package/src-old/glyphs/WarningTriangle.js +0 -13
- package/src-old/index.js +0 -1
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import rechart components
|
|
5
|
-
import {
|
|
6
|
-
ResponsiveContainer,
|
|
7
|
-
ScatterChart as ScatterChartLib,
|
|
8
|
-
Scatter,
|
|
9
|
-
XAxis,
|
|
10
|
-
YAxis,
|
|
11
|
-
CartesianGrid,
|
|
12
|
-
Tooltip,
|
|
13
|
-
Legend,
|
|
14
|
-
} from 'recharts';
|
|
15
|
-
|
|
16
|
-
// Import helpers
|
|
17
|
-
import csvToString from '../../common/csvToString';
|
|
18
|
-
|
|
19
|
-
// Import other components
|
|
20
|
-
import Holder from './Holder';
|
|
21
|
-
|
|
22
|
-
// Import default colors
|
|
23
|
-
import colors from './colors';
|
|
24
|
-
|
|
25
|
-
class ScatterChart extends Component {
|
|
26
|
-
render() {
|
|
27
|
-
// Deconstruct props
|
|
28
|
-
const {
|
|
29
|
-
title,
|
|
30
|
-
color,
|
|
31
|
-
width,
|
|
32
|
-
height,
|
|
33
|
-
xLabel,
|
|
34
|
-
xUnit,
|
|
35
|
-
yLabel,
|
|
36
|
-
yUnit,
|
|
37
|
-
data,
|
|
38
|
-
noTooltipOnHover,
|
|
39
|
-
noDownload,
|
|
40
|
-
showLegend,
|
|
41
|
-
seriesName,
|
|
42
|
-
} = this.props;
|
|
43
|
-
|
|
44
|
-
// Create download content
|
|
45
|
-
let csvContents;
|
|
46
|
-
if (!noDownload) {
|
|
47
|
-
const xField = `${xLabel}${xUnit ? ' (' + xUnit + ')' : ''}`;
|
|
48
|
-
const yField = `${yLabel}${yUnit ? ' (' + yUnit + ')' : ''}`;
|
|
49
|
-
const csv = {
|
|
50
|
-
fields: [xField, yField],
|
|
51
|
-
data: data.map((datum) => {
|
|
52
|
-
return [datum.x, datum.y];
|
|
53
|
-
}),
|
|
54
|
-
};
|
|
55
|
-
csvContents = csvToString(csv);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<Holder
|
|
60
|
-
title={title}
|
|
61
|
-
xLabel={xLabel}
|
|
62
|
-
xUnit={xUnit}
|
|
63
|
-
yLabel={yLabel}
|
|
64
|
-
yUnit={yUnit}
|
|
65
|
-
width={width}
|
|
66
|
-
height={height}
|
|
67
|
-
csvContents={csvContents}
|
|
68
|
-
>
|
|
69
|
-
<ResponsiveContainer
|
|
70
|
-
width="100%"
|
|
71
|
-
height="100%"
|
|
72
|
-
>
|
|
73
|
-
<ScatterChartLib>
|
|
74
|
-
<CartesianGrid />
|
|
75
|
-
<YAxis
|
|
76
|
-
dataKey="y"
|
|
77
|
-
type="number"
|
|
78
|
-
name={yLabel}
|
|
79
|
-
/>
|
|
80
|
-
<XAxis
|
|
81
|
-
dataKey="x"
|
|
82
|
-
type="number"
|
|
83
|
-
name={xLabel}
|
|
84
|
-
/>
|
|
85
|
-
{!noTooltipOnHover && (
|
|
86
|
-
<Tooltip
|
|
87
|
-
cursor={{
|
|
88
|
-
strokeDasharray: '3 3',
|
|
89
|
-
}}
|
|
90
|
-
/>
|
|
91
|
-
)}
|
|
92
|
-
{showLegend && (
|
|
93
|
-
<Legend />
|
|
94
|
-
)}
|
|
95
|
-
<Scatter
|
|
96
|
-
name={seriesName}
|
|
97
|
-
data={data}
|
|
98
|
-
fill={color}
|
|
99
|
-
/>
|
|
100
|
-
</ScatterChartLib>
|
|
101
|
-
</ResponsiveContainer>
|
|
102
|
-
</Holder>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
ScatterChart.propTypes = {
|
|
108
|
-
// Title of the chart
|
|
109
|
-
title: PropTypes.string,
|
|
110
|
-
// CSS color (#123456 or 'white') for the points
|
|
111
|
-
color: PropTypes.string,
|
|
112
|
-
// Width ('100%' or 50)
|
|
113
|
-
width: PropTypes.oneOfType([
|
|
114
|
-
PropTypes.string,
|
|
115
|
-
PropTypes.number,
|
|
116
|
-
]),
|
|
117
|
-
// Height ('100%' or 50)
|
|
118
|
-
height: PropTypes.oneOfType([
|
|
119
|
-
PropTypes.string,
|
|
120
|
-
PropTypes.number,
|
|
121
|
-
]),
|
|
122
|
-
// Label for the x axis
|
|
123
|
-
xLabel: PropTypes.string,
|
|
124
|
-
// Unit for the x axis
|
|
125
|
-
xUnit: PropTypes.string,
|
|
126
|
-
// Label for the y axis
|
|
127
|
-
yLabel: PropTypes.string,
|
|
128
|
-
// Unit for the y axis
|
|
129
|
-
yUnit: PropTypes.string,
|
|
130
|
-
// Array of data objects
|
|
131
|
-
data: PropTypes.arrayOf(
|
|
132
|
-
PropTypes.shape({
|
|
133
|
-
x: PropTypes.number,
|
|
134
|
-
y: PropTypes.number,
|
|
135
|
-
})
|
|
136
|
-
).isRequired,
|
|
137
|
-
// If true, no tooltip is shown when hovering over a point
|
|
138
|
-
noTooltipOnHover: PropTypes.bool,
|
|
139
|
-
// If true, no download button is shown
|
|
140
|
-
noDownload: PropTypes.bool,
|
|
141
|
-
// Name of the series (included and required for legend)
|
|
142
|
-
seriesName: PropTypes.string,
|
|
143
|
-
// If true, legend is included
|
|
144
|
-
showLegend: PropTypes.bool,
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
ScatterChart.defaultProps = {
|
|
148
|
-
title: null,
|
|
149
|
-
color: colors.defaultBlue,
|
|
150
|
-
width: '100%',
|
|
151
|
-
height: '500px',
|
|
152
|
-
xLabel: 'x-axis',
|
|
153
|
-
xUnit: null,
|
|
154
|
-
yLabel: 'y-axis',
|
|
155
|
-
yUnit: null,
|
|
156
|
-
seriesName: 'Chart',
|
|
157
|
-
noTooltipOnHover: false,
|
|
158
|
-
noDownload: false,
|
|
159
|
-
showLegend: false,
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
export default ScatterChart;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
defaultBlue: '#419bf7',
|
|
3
|
-
assortment: [
|
|
4
|
-
'#ec4f6a',
|
|
5
|
-
'#f19542',
|
|
6
|
-
'#f6c353',
|
|
7
|
-
'#61cbcc',
|
|
8
|
-
'#419bf7',
|
|
9
|
-
'#005392',
|
|
10
|
-
'#7d5297',
|
|
11
|
-
'#d261ab',
|
|
12
|
-
'#7edfcf',
|
|
13
|
-
'#5eac88',
|
|
14
|
-
|
|
15
|
-
'#f4ce63',
|
|
16
|
-
'#929000',
|
|
17
|
-
'#5e5e5e',
|
|
18
|
-
'#008e00',
|
|
19
|
-
],
|
|
20
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import bootstrap components
|
|
5
|
-
import { Button } from 'reactstrap';
|
|
6
|
-
// Import bootstrap stylesheet
|
|
7
|
-
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
8
|
-
|
|
9
|
-
// Import custom styles
|
|
10
|
-
import './style.css';
|
|
11
|
-
|
|
12
|
-
// Import glyphs
|
|
13
|
-
import Check from '../../glyphs/Check';
|
|
14
|
-
|
|
15
|
-
/* Same properties as button component, plus:
|
|
16
|
-
* - onChange: (index, optionText) function
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
class Checkbox extends Component {
|
|
20
|
-
constructor(props) {
|
|
21
|
-
super(props);
|
|
22
|
-
|
|
23
|
-
// Deconstruct props
|
|
24
|
-
const { startChecked } = this.props;
|
|
25
|
-
const checked = !!startChecked;
|
|
26
|
-
|
|
27
|
-
// Initialize state
|
|
28
|
-
this.state = {
|
|
29
|
-
checked,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// Bind functions
|
|
33
|
-
this.onClick = this.onClick.bind(this);
|
|
34
|
-
|
|
35
|
-
// Update parent
|
|
36
|
-
const { onChange } = this.props;
|
|
37
|
-
if (onChange) {
|
|
38
|
-
onChange(checked);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
onClick() {
|
|
43
|
-
// Toggle checkbox
|
|
44
|
-
let { checked } = this.state;
|
|
45
|
-
checked = !checked;
|
|
46
|
-
this.setState({
|
|
47
|
-
checked,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// Call onChange handler
|
|
51
|
-
const { onChange } = this.props;
|
|
52
|
-
if (onChange) {
|
|
53
|
-
onChange(checked);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
render() {
|
|
58
|
-
// Extract properties
|
|
59
|
-
const { light } = this.props;
|
|
60
|
-
|
|
61
|
-
// Deconstruct state
|
|
62
|
-
const { checked } = this.state;
|
|
63
|
-
|
|
64
|
-
// Create the checkbox
|
|
65
|
-
return (
|
|
66
|
-
<Button
|
|
67
|
-
title={checked ? 'Click to uncheck' : 'Click to check'}
|
|
68
|
-
onClick={this.onClick}
|
|
69
|
-
color={(
|
|
70
|
-
light
|
|
71
|
-
? 'light'
|
|
72
|
-
: 'dark'
|
|
73
|
-
)}
|
|
74
|
-
style={{
|
|
75
|
-
border: (light ? '2px solid black' : null),
|
|
76
|
-
}}
|
|
77
|
-
>
|
|
78
|
-
{checked
|
|
79
|
-
? (<Check grow="10" />)
|
|
80
|
-
: (<Check grow="3" opacity="0.2" />)
|
|
81
|
-
}
|
|
82
|
-
</Button>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
Checkbox.propTypes = {
|
|
88
|
-
// If true, the checkbox starts checked (when initialized)
|
|
89
|
-
startChecked: PropTypes.bool,
|
|
90
|
-
/**
|
|
91
|
-
* If included, this function is called when the checkbox is toggled with a
|
|
92
|
-
* boolean (is checked) as an argument
|
|
93
|
-
* @param {boolean} isChecked true if the checkbox was just checked
|
|
94
|
-
*/
|
|
95
|
-
onChange: PropTypes.func,
|
|
96
|
-
// If true, the light theme is applied to the checkbox
|
|
97
|
-
light: PropTypes.bool,
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
Checkbox.defaultProps = {
|
|
101
|
-
startChecked: false,
|
|
102
|
-
onChange: null,
|
|
103
|
-
light: false,
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export default Checkbox;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* Class that disables text selection (so that drags on the checkbox don't look
|
|
2
|
-
strange) */
|
|
3
|
-
.no-select {
|
|
4
|
-
-webkit-touch-callout: none; /* iOS Safari */
|
|
5
|
-
-webkit-user-select: none; /* Safari */
|
|
6
|
-
-khtml-user-select: none; /* Konqueror HTML */
|
|
7
|
-
-moz-user-select: none; /* Firefox */
|
|
8
|
-
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
9
|
-
user-select: none; /* Non-prefixed version, currently
|
|
10
|
-
supported by Chrome and Opera */
|
|
11
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import date picker
|
|
5
|
-
import ReactDatePicker from 'react-datepicker';
|
|
6
|
-
import 'react-datepicker/dist/react-datepicker.css';
|
|
7
|
-
|
|
8
|
-
class DatePicker extends Component {
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props);
|
|
11
|
-
|
|
12
|
-
// Initialize date
|
|
13
|
-
const { defaultDate } = this.props;
|
|
14
|
-
this.defaultDate = (defaultDate || new Date());
|
|
15
|
-
this.state = {
|
|
16
|
-
date: this.defaultDate,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// Bind functions
|
|
20
|
-
this.onDateChanged = this.onDateChanged.bind(this);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
onDateChanged(date) {
|
|
24
|
-
// Update state
|
|
25
|
-
this.setState({
|
|
26
|
-
date,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// Update parent via handler
|
|
30
|
-
const { onChange } = this.props;
|
|
31
|
-
onChange(date);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
render() {
|
|
35
|
-
// Deconstruct state
|
|
36
|
-
const { date } = this.state;
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<ReactDatePicker
|
|
40
|
-
selected={date}
|
|
41
|
-
onChange={this.onDateChanged}
|
|
42
|
-
className="form-control"
|
|
43
|
-
/>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
DatePicker.propTypes = {
|
|
49
|
-
/* The default date to display in the chooser */
|
|
50
|
-
defaultDate: PropTypes.instanceOf(Date),
|
|
51
|
-
/* Handler to call when date is changed */
|
|
52
|
-
onChange: PropTypes.func.isRequired,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
DatePicker.defaultProps = {
|
|
56
|
-
defaultDate: null,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default DatePicker;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import file download button
|
|
5
|
-
import DownloadLink from 'react-download-link';
|
|
6
|
-
|
|
7
|
-
// Import glyphs
|
|
8
|
-
import Download from '../glyphs/Download';
|
|
9
|
-
|
|
10
|
-
// Import bootstrap stylesheet
|
|
11
|
-
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
12
|
-
|
|
13
|
-
class DownloadButton extends Component {
|
|
14
|
-
render() {
|
|
15
|
-
const {
|
|
16
|
-
text,
|
|
17
|
-
filename,
|
|
18
|
-
contents,
|
|
19
|
-
large,
|
|
20
|
-
marginLeft,
|
|
21
|
-
marginRight,
|
|
22
|
-
marginTop,
|
|
23
|
-
marginBottom,
|
|
24
|
-
} = this.props;
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<DownloadLink
|
|
28
|
-
filename={filename}
|
|
29
|
-
exportFile={() => { return contents; }}
|
|
30
|
-
label={
|
|
31
|
-
(
|
|
32
|
-
<span>
|
|
33
|
-
<Download className="mr-2" />
|
|
34
|
-
{text}
|
|
35
|
-
</span>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
tagName="div"
|
|
39
|
-
className={`btn btn-dark text-white${large ? ' btn-lg' : ''}`}
|
|
40
|
-
style={{
|
|
41
|
-
textDecoration: 'none !important',
|
|
42
|
-
marginLeft,
|
|
43
|
-
marginRight,
|
|
44
|
-
marginTop,
|
|
45
|
-
marginBottom,
|
|
46
|
-
}}
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
DownloadButton.propTypes = {
|
|
53
|
-
text: PropTypes.string,
|
|
54
|
-
filename: PropTypes.string.isRequired,
|
|
55
|
-
contents: PropTypes.string.isRequired,
|
|
56
|
-
large: PropTypes.bool,
|
|
57
|
-
marginLeft: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
58
|
-
marginRight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
59
|
-
marginTop: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
60
|
-
marginBottom: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
DownloadButton.defaultProps = {
|
|
64
|
-
text: 'Download',
|
|
65
|
-
large: false,
|
|
66
|
-
marginLeft: null,
|
|
67
|
-
marginRight: null,
|
|
68
|
-
marginTop: null,
|
|
69
|
-
marginBottom: null,
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default DownloadButton;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import genUUID from 'uuid/v1';
|
|
4
|
-
|
|
5
|
-
// Import bootstrap components
|
|
6
|
-
import {
|
|
7
|
-
Dropdown as BootstrapDropdown,
|
|
8
|
-
DropdownToggle,
|
|
9
|
-
DropdownMenu,
|
|
10
|
-
DropdownItem,
|
|
11
|
-
} from 'reactstrap';
|
|
12
|
-
// Import bootstrap stylesheet
|
|
13
|
-
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
14
|
-
|
|
15
|
-
class Dropdown extends Component {
|
|
16
|
-
constructor(props) {
|
|
17
|
-
super(props);
|
|
18
|
-
|
|
19
|
-
// Initialize state
|
|
20
|
-
this.state = {
|
|
21
|
-
dropdownOpen: false,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// Bind functions
|
|
25
|
-
this.toggle = this.toggle.bind(this);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
toggle() {
|
|
29
|
-
const { dropdownOpen } = this.state;
|
|
30
|
-
|
|
31
|
-
this.setState({
|
|
32
|
-
dropdownOpen: !dropdownOpen,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
render() {
|
|
37
|
-
// Deconstruct props
|
|
38
|
-
const {
|
|
39
|
-
title,
|
|
40
|
-
color,
|
|
41
|
-
rightAligned,
|
|
42
|
-
inline,
|
|
43
|
-
items,
|
|
44
|
-
...props
|
|
45
|
-
} = this.props;
|
|
46
|
-
|
|
47
|
-
// Deconstruct state
|
|
48
|
-
const { dropdownOpen } = this.state;
|
|
49
|
-
|
|
50
|
-
const itemElements = items.map((item) => {
|
|
51
|
-
return (
|
|
52
|
-
<DropdownItem
|
|
53
|
-
header={item.header}
|
|
54
|
-
divider={item.divider}
|
|
55
|
-
disabled={item.disabled}
|
|
56
|
-
onClick={item.onClick}
|
|
57
|
-
key={genUUID()}
|
|
58
|
-
>
|
|
59
|
-
{item.text}
|
|
60
|
-
</DropdownItem>
|
|
61
|
-
);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<BootstrapDropdown
|
|
66
|
-
isOpen={dropdownOpen}
|
|
67
|
-
toggle={this.toggle}
|
|
68
|
-
className={inline ? 'd-inline-block' : null}
|
|
69
|
-
>
|
|
70
|
-
<DropdownToggle
|
|
71
|
-
color={color}
|
|
72
|
-
caret
|
|
73
|
-
{...props}
|
|
74
|
-
>
|
|
75
|
-
{title}
|
|
76
|
-
</DropdownToggle>
|
|
77
|
-
<DropdownMenu
|
|
78
|
-
right={rightAligned}
|
|
79
|
-
>
|
|
80
|
-
{itemElements}
|
|
81
|
-
</DropdownMenu>
|
|
82
|
-
</BootstrapDropdown>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
Dropdown.propTypes = {
|
|
88
|
-
/* Title/label of the dropdown */
|
|
89
|
-
title: PropTypes.string.isRequired,
|
|
90
|
-
/* The bootstrap color of the dropdown button */
|
|
91
|
-
color: PropTypes.string,
|
|
92
|
-
/* If true, the dropdown menu is right-aligned (left-aligned otherwise) */
|
|
93
|
-
rightAligned: PropTypes.bool,
|
|
94
|
-
/* If true, the dropdown menu is inserted in-line (instead of block) */
|
|
95
|
-
inline: PropTypes.bool,
|
|
96
|
-
/* The dropdown items */
|
|
97
|
-
items: PropTypes.arrayOf(
|
|
98
|
-
PropTypes.shape({
|
|
99
|
-
/* The title of the item */
|
|
100
|
-
text: PropTypes.string,
|
|
101
|
-
/* If true, this item is a divider (text is ignored) */
|
|
102
|
-
divider: PropTypes.bool,
|
|
103
|
-
/* If true, this item is a header item (not clickable) */
|
|
104
|
-
header: PropTypes.bool,
|
|
105
|
-
/* If true, this item is disabled (not clickable) */
|
|
106
|
-
disabled: PropTypes.bool,
|
|
107
|
-
/* Handler to call when item is clicked */
|
|
108
|
-
onClick: PropTypes.func,
|
|
109
|
-
})
|
|
110
|
-
),
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
Dropdown.defaultProps = {
|
|
114
|
-
color: 'secondary',
|
|
115
|
-
rightAligned: false,
|
|
116
|
-
inline: false,
|
|
117
|
-
items: [],
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export default Dropdown;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import bootstrap stylesheet
|
|
5
|
-
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
Looks like:
|
|
9
|
-
...............................................................................
|
|
10
|
-
| .............. ............................................................ |
|
|
11
|
-
| | Left Addon | | Right area fills the rest of the space (second child) | |
|
|
12
|
-
| '''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
|
|
13
|
-
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
class LeftAddon extends Component {
|
|
17
|
-
render() {
|
|
18
|
-
const {
|
|
19
|
-
children,
|
|
20
|
-
centerVertically,
|
|
21
|
-
} = this.props;
|
|
22
|
-
const leftChild = (children.length > 0 ? children[0] : {});
|
|
23
|
-
const rightChild = (children.length > 1 ? children[1] : {});
|
|
24
|
-
|
|
25
|
-
// Create classnames
|
|
26
|
-
const leftClassName = (
|
|
27
|
-
'flex-column' + (centerVertically ? ' align-self-center' : '')
|
|
28
|
-
);
|
|
29
|
-
const rightClassName = (
|
|
30
|
-
'flex-column flex-fill' + (centerVertically ? ' align-self-center' : '')
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div className="d-flex flex-row">
|
|
35
|
-
<div className={leftClassName}>
|
|
36
|
-
{leftChild}
|
|
37
|
-
</div>
|
|
38
|
-
<div
|
|
39
|
-
className={rightClassName}
|
|
40
|
-
>
|
|
41
|
-
<div className="d-inline-block">
|
|
42
|
-
{rightChild}
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
LeftAddon.propTypes = {
|
|
51
|
-
/* Must have two children: first child is the item that's added on the left,
|
|
52
|
-
* the second child is the item that spans the rest of the row
|
|
53
|
-
*/
|
|
54
|
-
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
55
|
-
// If true, the items are vertically centered
|
|
56
|
-
centerVertically: PropTypes.bool,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
LeftAddon.defaultProps = {
|
|
60
|
-
centerVertically: false,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export default LeftAddon;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import bootstrap stylesheet
|
|
5
|
-
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
Looks like:
|
|
9
|
-
................................................................................
|
|
10
|
-
| ............................................................ ............... |
|
|
11
|
-
| | Left area fills the rest of the space (first child) | | Right Addon | |
|
|
12
|
-
| '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''' |
|
|
13
|
-
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
class RightAddon extends Component {
|
|
17
|
-
render() {
|
|
18
|
-
const {
|
|
19
|
-
children,
|
|
20
|
-
centerVertically,
|
|
21
|
-
} = this.props;
|
|
22
|
-
const leftChild = (children.length > 0 ? children[0] : {});
|
|
23
|
-
const rightChild = (children.length > 1 ? children[1] : {});
|
|
24
|
-
|
|
25
|
-
// Create classnames
|
|
26
|
-
const leftClassName = (
|
|
27
|
-
'flex-column flex-fill' + (centerVertically ? ' align-self-center' : '')
|
|
28
|
-
);
|
|
29
|
-
const rightClassName = (
|
|
30
|
-
'flex-column' + (centerVertically ? ' align-self-center' : '')
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div className="d-flex flex-row">
|
|
35
|
-
<div className={leftClassName}>
|
|
36
|
-
{leftChild}
|
|
37
|
-
</div>
|
|
38
|
-
<div
|
|
39
|
-
className={rightClassName}
|
|
40
|
-
>
|
|
41
|
-
<div className="d-inline-block">
|
|
42
|
-
{rightChild}
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
RightAddon.propTypes = {
|
|
51
|
-
/* Must have two children: first child is the item on the left that fills up
|
|
52
|
-
* the ret of the space, the second child is the item that's added on the
|
|
53
|
-
* right
|
|
54
|
-
*/
|
|
55
|
-
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
|
56
|
-
// If true, the items are vertically centered
|
|
57
|
-
centerVertically: PropTypes.bool,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
RightAddon.defaultProps = {
|
|
61
|
-
centerVertically: false,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export default RightAddon;
|