dce-reactkit 1.0.19 → 2.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/.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/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 +21 -39
- package/src/components/LoadingSpinner.tsx +105 -0
- package/src/components/Modal.tsx +447 -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/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,126 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import glyphs
|
|
5
|
-
import Check from '../../../glyphs/Check';
|
|
6
|
-
|
|
7
|
-
// Import other components
|
|
8
|
-
import Question from '../Question';
|
|
9
|
-
import Button from '../../Button';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* onAnswered is called with the following:
|
|
13
|
-
* {
|
|
14
|
-
* questionKey: answer from question,
|
|
15
|
-
* ...
|
|
16
|
-
* }
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
class AnswerAll extends Component {
|
|
20
|
-
constructor(props) {
|
|
21
|
-
super(props);
|
|
22
|
-
|
|
23
|
-
// Initialize state
|
|
24
|
-
this.state = {
|
|
25
|
-
answerMap: {},
|
|
26
|
-
answeredMap: {}, // questionKey => true if answered
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
render() {
|
|
31
|
-
// Deconstruct state
|
|
32
|
-
const { answeredMap } = this.state;
|
|
33
|
-
|
|
34
|
-
// Deconstruct props
|
|
35
|
-
const {
|
|
36
|
-
onAnswered,
|
|
37
|
-
} = this.props;
|
|
38
|
-
|
|
39
|
-
// Turn children into an array if it isn't already
|
|
40
|
-
let { children } = this.props;
|
|
41
|
-
if (!Array.isArray(children)) {
|
|
42
|
-
children = [children];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Wrap children so that if any child answers a question, our onAnswered is
|
|
46
|
-
// called
|
|
47
|
-
const wrappedChildren = children.map((child) => {
|
|
48
|
-
const childOnAnswered = child.props.onAnswered;
|
|
49
|
-
if (answeredMap[child.props.questionKey]) {
|
|
50
|
-
// This is an answered question. Make it smaller
|
|
51
|
-
return (
|
|
52
|
-
<Question
|
|
53
|
-
title={child.props.title}
|
|
54
|
-
subtitle={child.props.subtitle}
|
|
55
|
-
>
|
|
56
|
-
<div className="text-center text-success">
|
|
57
|
-
<h2>
|
|
58
|
-
<Check className="mr-2" />
|
|
59
|
-
Done
|
|
60
|
-
</h2>
|
|
61
|
-
<Button
|
|
62
|
-
text="Change Response"
|
|
63
|
-
onClick={() => {
|
|
64
|
-
answeredMap[child.props.questionKey] = false;
|
|
65
|
-
this.setState({
|
|
66
|
-
answeredMap,
|
|
67
|
-
});
|
|
68
|
-
}}
|
|
69
|
-
/>
|
|
70
|
-
</div>
|
|
71
|
-
</Question>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
const wrappedChild = React.cloneElement(child, {
|
|
75
|
-
onAnswered: (childAnswer) => {
|
|
76
|
-
// Call child's onAnswered handler
|
|
77
|
-
if (childOnAnswered) {
|
|
78
|
-
childOnAnswered(childAnswer);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Update state
|
|
82
|
-
const {
|
|
83
|
-
answerMap,
|
|
84
|
-
} = this.state;
|
|
85
|
-
answerMap[child.props.questionKey] = childAnswer;
|
|
86
|
-
answeredMap[child.props.questionKey] = true;
|
|
87
|
-
this.setState({
|
|
88
|
-
answerMap,
|
|
89
|
-
answeredMap,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// Call AnswerAll's onAnswered handler if all answers are in
|
|
93
|
-
const numAnswered = (
|
|
94
|
-
Object.values(answeredMap)
|
|
95
|
-
.map((x) => { return (x ? 1 : 0); })
|
|
96
|
-
.reduce((total, x) => { return total + x; })
|
|
97
|
-
);
|
|
98
|
-
const allAnswered = (numAnswered === children.length);
|
|
99
|
-
if (allAnswered) {
|
|
100
|
-
onAnswered(answerMap);
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
key: child.props.questionKey,
|
|
104
|
-
});
|
|
105
|
-
return wrappedChild;
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<div>
|
|
110
|
-
{wrappedChildren}
|
|
111
|
-
</div>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
AnswerAll.propTypes = {
|
|
117
|
-
/* A function to call when the one of the questions is answered */
|
|
118
|
-
onAnswered: PropTypes.func.isRequired,
|
|
119
|
-
/* The children of this component (must be questions) */
|
|
120
|
-
children: PropTypes.oneOfType([
|
|
121
|
-
PropTypes.arrayOf(PropTypes.node),
|
|
122
|
-
PropTypes.node,
|
|
123
|
-
]).isRequired,
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
export default AnswerAll;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* onAnswered is called with the following:
|
|
6
|
-
* {
|
|
7
|
-
* questionKey: answer from the question that was answered
|
|
8
|
-
* }
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
class AnswerAny extends Component {
|
|
12
|
-
render() {
|
|
13
|
-
// Deconstruct state
|
|
14
|
-
const {
|
|
15
|
-
onAnswered,
|
|
16
|
-
children,
|
|
17
|
-
} = this.props;
|
|
18
|
-
|
|
19
|
-
// Wrap children so that if any child answers a question, our onAnswered is
|
|
20
|
-
// called
|
|
21
|
-
const wrappedChildren = children.map((child) => {
|
|
22
|
-
const childOnAnswered = child.props.onAnswered;
|
|
23
|
-
const wrappedChild = React.cloneElement(child, {
|
|
24
|
-
onAnswered: (childAnswer) => {
|
|
25
|
-
// Call child's onAnswered handler
|
|
26
|
-
if (childOnAnswered) {
|
|
27
|
-
childOnAnswered(childAnswer);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Call AnswerAny's onAnswered handler
|
|
31
|
-
if (onAnswered) {
|
|
32
|
-
const answer = {};
|
|
33
|
-
answer[child.props.questionKey] = childAnswer;
|
|
34
|
-
onAnswered(answer);
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
key: child.props.questionKey,
|
|
38
|
-
});
|
|
39
|
-
return wrappedChild;
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div>
|
|
44
|
-
{wrappedChildren}
|
|
45
|
-
</div>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
AnswerAny.propTypes = {
|
|
51
|
-
/* A function to call when the one of the questions is answered */
|
|
52
|
-
onAnswered: PropTypes.func.isRequired,
|
|
53
|
-
/* The children of this component (must be questions) */
|
|
54
|
-
children: PropTypes.oneOfType([
|
|
55
|
-
PropTypes.arrayOf(PropTypes.node),
|
|
56
|
-
PropTypes.node,
|
|
57
|
-
]).isRequired,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export default AnswerAny;
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import bootstrap components
|
|
5
|
-
import {
|
|
6
|
-
Pagination,
|
|
7
|
-
PaginationItem,
|
|
8
|
-
PaginationLink,
|
|
9
|
-
} from 'reactstrap';
|
|
10
|
-
// Import bootstrap stylesheet
|
|
11
|
-
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
12
|
-
|
|
13
|
-
// Import custom styles
|
|
14
|
-
import './style.css';
|
|
15
|
-
|
|
16
|
-
// Import other components
|
|
17
|
-
import Alert from '../Alert';
|
|
18
|
-
|
|
19
|
-
// Import glyphs
|
|
20
|
-
import Ellipsis from '../../glyphs/Ellipsis';
|
|
21
|
-
|
|
22
|
-
class Wizard extends Component {
|
|
23
|
-
constructor(props) {
|
|
24
|
-
super(props);
|
|
25
|
-
|
|
26
|
-
// Initialize state
|
|
27
|
-
this.state = {
|
|
28
|
-
currentStep: 0,
|
|
29
|
-
results: {},
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
render() {
|
|
34
|
-
// Deconstruct state
|
|
35
|
-
const {
|
|
36
|
-
currentStep,
|
|
37
|
-
results,
|
|
38
|
-
} = this.state;
|
|
39
|
-
|
|
40
|
-
// Deconstruct props
|
|
41
|
-
const {
|
|
42
|
-
title,
|
|
43
|
-
subtitle,
|
|
44
|
-
color,
|
|
45
|
-
onFinish,
|
|
46
|
-
} = this.props;
|
|
47
|
-
|
|
48
|
-
// Turn children into an array if it isn't already
|
|
49
|
-
let { children } = this.props;
|
|
50
|
-
if (!Array.isArray(children)) {
|
|
51
|
-
children = [children];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Pre-process and wrap child
|
|
55
|
-
const currQuestion = children[currentStep];
|
|
56
|
-
const originalOnAnswered = currQuestion.props.onAnswered;
|
|
57
|
-
const wrappedChild = React.cloneElement(currQuestion, {
|
|
58
|
-
onAnswered: (answer) => {
|
|
59
|
-
// Call original onChoose listener
|
|
60
|
-
if (originalOnAnswered) {
|
|
61
|
-
originalOnAnswered(answer);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Record answer
|
|
65
|
-
results[currQuestion.props.questionKey] = answer;
|
|
66
|
-
|
|
67
|
-
// Finish (if done)
|
|
68
|
-
if (currentStep === children.length - 1) {
|
|
69
|
-
// Done!
|
|
70
|
-
if (onFinish) {
|
|
71
|
-
onFinish(results);
|
|
72
|
-
}
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Advance to the next step
|
|
77
|
-
this.setState({
|
|
78
|
-
currentStep: currentStep + 1,
|
|
79
|
-
results,
|
|
80
|
-
});
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// Create breadcrumbs (pages)
|
|
85
|
-
const breadcrumbs = [];
|
|
86
|
-
// Show 4 steps at maximum
|
|
87
|
-
// > Create a function that turns a child into a page item
|
|
88
|
-
const childToPage = (child, index) => {
|
|
89
|
-
let buttonTitle = 'Complete this step to advance';
|
|
90
|
-
if (index < currentStep) {
|
|
91
|
-
buttonTitle = 'Back to this step';
|
|
92
|
-
} else if (index > currentStep) {
|
|
93
|
-
buttonTitle = 'Complete previous steps to advance';
|
|
94
|
-
} else if (
|
|
95
|
-
(index === currentStep)
|
|
96
|
-
&& (index === children.length - 1)
|
|
97
|
-
) {
|
|
98
|
-
buttonTitle = 'Complete this step to finish';
|
|
99
|
-
}
|
|
100
|
-
return (
|
|
101
|
-
<PaginationItem
|
|
102
|
-
disabled={index > currentStep}
|
|
103
|
-
className={(index > currentStep ? 'faded-item' : null)}
|
|
104
|
-
title={buttonTitle}
|
|
105
|
-
>
|
|
106
|
-
<PaginationLink
|
|
107
|
-
href="#"
|
|
108
|
-
className={(index === currentStep ? 'active-link' : 'inactive-link')}
|
|
109
|
-
onClick={() => {
|
|
110
|
-
if (index !== currentStep) {
|
|
111
|
-
// Update current step (jump back in the chain)
|
|
112
|
-
this.setState({
|
|
113
|
-
currentStep: index,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}}
|
|
117
|
-
>
|
|
118
|
-
{child.props.stepTitle || `Step ${index + 1}`}
|
|
119
|
-
</PaginationLink>
|
|
120
|
-
</PaginationItem>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
const leavingOutSteps = (children.length > 4);
|
|
124
|
-
let firstStepInBlock = 0;
|
|
125
|
-
let lastStepInBlock = children.length - 1;
|
|
126
|
-
if (leavingOutSteps) {
|
|
127
|
-
if (currentStep === children.length - 1) {
|
|
128
|
-
// On the last step
|
|
129
|
-
firstStepInBlock = Math.max(currentStep - 3, 0);
|
|
130
|
-
lastStepInBlock = currentStep;
|
|
131
|
-
} else if (currentStep === 0) {
|
|
132
|
-
// On the first step
|
|
133
|
-
firstStepInBlock = 0;
|
|
134
|
-
lastStepInBlock = 2;
|
|
135
|
-
} else {
|
|
136
|
-
// On a middle step
|
|
137
|
-
firstStepInBlock = currentStep - 1;
|
|
138
|
-
lastStepInBlock = currentStep + 1;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// Add start ellipses
|
|
142
|
-
if (firstStepInBlock > 0) {
|
|
143
|
-
// Skipping at least one child
|
|
144
|
-
// > Add initial child (for start over)
|
|
145
|
-
breadcrumbs.push(childToPage(children[0], 0));
|
|
146
|
-
// > Add '...'
|
|
147
|
-
breadcrumbs.push((
|
|
148
|
-
<PaginationItem
|
|
149
|
-
style={{ opacity: 0.7 }}
|
|
150
|
-
disabled
|
|
151
|
-
>
|
|
152
|
-
<PaginationLink>
|
|
153
|
-
<Ellipsis
|
|
154
|
-
style={{ color: '#aaa' }}
|
|
155
|
-
/>
|
|
156
|
-
</PaginationLink>
|
|
157
|
-
</PaginationItem>
|
|
158
|
-
));
|
|
159
|
-
}
|
|
160
|
-
// Add block of steps
|
|
161
|
-
for (let i = firstStepInBlock; i <= lastStepInBlock; i++) {
|
|
162
|
-
breadcrumbs.push(childToPage(children[i], i));
|
|
163
|
-
}
|
|
164
|
-
// Add end ellipses
|
|
165
|
-
if (lastStepInBlock < children.length - 1) {
|
|
166
|
-
// > Add '...'
|
|
167
|
-
breadcrumbs.push((
|
|
168
|
-
<PaginationItem
|
|
169
|
-
style={{ opacity: 0.7 }}
|
|
170
|
-
disabled
|
|
171
|
-
>
|
|
172
|
-
<PaginationLink>
|
|
173
|
-
<Ellipsis
|
|
174
|
-
style={{ color: '#aaa' }}
|
|
175
|
-
/>
|
|
176
|
-
</PaginationLink>
|
|
177
|
-
</PaginationItem>
|
|
178
|
-
));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Render wizard
|
|
182
|
-
return (
|
|
183
|
-
<Alert
|
|
184
|
-
color={color}
|
|
185
|
-
className="mb-2 pb-0 text-center"
|
|
186
|
-
>
|
|
187
|
-
<h4>
|
|
188
|
-
{title}
|
|
189
|
-
</h4>
|
|
190
|
-
{subtitle && (
|
|
191
|
-
<div>
|
|
192
|
-
{subtitle}
|
|
193
|
-
</div>
|
|
194
|
-
)}
|
|
195
|
-
<Pagination
|
|
196
|
-
style={{
|
|
197
|
-
justifyContent: 'center',
|
|
198
|
-
whiteSpace: 'nowrap',
|
|
199
|
-
}}
|
|
200
|
-
className="mb-0"
|
|
201
|
-
aria-label="Steps navigator"
|
|
202
|
-
>
|
|
203
|
-
{breadcrumbs}
|
|
204
|
-
</Pagination>
|
|
205
|
-
{wrappedChild}
|
|
206
|
-
</Alert>
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
Wizard.propTypes = {
|
|
212
|
-
/* Title of the wizard */
|
|
213
|
-
title: PropTypes.string,
|
|
214
|
-
/* Subtitle of the wizard */
|
|
215
|
-
subtitle: PropTypes.string,
|
|
216
|
-
/* Bootstrap color of the wizard (background) */
|
|
217
|
-
color: PropTypes.string,
|
|
218
|
-
/* Handler to call when wizard is complete */
|
|
219
|
-
onFinish: PropTypes.func.isRequired,
|
|
220
|
-
/* The child questions of the wizard (shown one-by-one) */
|
|
221
|
-
children: PropTypes.oneOfType([
|
|
222
|
-
PropTypes.arrayOf(PropTypes.node),
|
|
223
|
-
PropTypes.node,
|
|
224
|
-
]).isRequired,
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
Wizard.defaultProps = {
|
|
228
|
-
title: 'Complete these steps to continue:',
|
|
229
|
-
subtitle: null,
|
|
230
|
-
color: 'info',
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
export default Wizard;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
.active-link {
|
|
2
|
-
color: white;
|
|
3
|
-
background-color: #333;
|
|
4
|
-
}
|
|
5
|
-
.active-link:hover {
|
|
6
|
-
color: white;
|
|
7
|
-
background-color: #000;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.inactive-link {
|
|
11
|
-
color: black;
|
|
12
|
-
background-color: #f8f8f8;
|
|
13
|
-
}
|
|
14
|
-
.inactive-link:hover {
|
|
15
|
-
color: black;
|
|
16
|
-
background-color: #fff;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.faded-item {
|
|
20
|
-
opacity: 0.7;
|
|
21
|
-
}
|
package/src-old/glyphs/Adjust.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import { faAdjust } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
-
|
|
5
|
-
class Adjust extends Component {
|
|
6
|
-
render() {
|
|
7
|
-
return (
|
|
8
|
-
<FontAwesomeIcon icon={faAdjust} {...this.props} />
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default Adjust;
|
package/src-old/glyphs/Angle.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
-
import {
|
|
5
|
-
faAngleUp,
|
|
6
|
-
faAngleDown,
|
|
7
|
-
faAngleRight,
|
|
8
|
-
faAngleLeft,
|
|
9
|
-
} from '@fortawesome/free-solid-svg-icons';
|
|
10
|
-
|
|
11
|
-
/* use direction="up|down|left|right" (default is "right")
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
class Angle extends Component {
|
|
15
|
-
render() {
|
|
16
|
-
// Extract props
|
|
17
|
-
const {
|
|
18
|
-
direction,
|
|
19
|
-
...props
|
|
20
|
-
} = this.props;
|
|
21
|
-
|
|
22
|
-
switch (direction) {
|
|
23
|
-
case 'up':
|
|
24
|
-
return (
|
|
25
|
-
<FontAwesomeIcon icon={faAngleUp} {...props} />
|
|
26
|
-
);
|
|
27
|
-
case 'down':
|
|
28
|
-
return (
|
|
29
|
-
<FontAwesomeIcon icon={faAngleDown} {...props} />
|
|
30
|
-
);
|
|
31
|
-
case 'left':
|
|
32
|
-
return (
|
|
33
|
-
<FontAwesomeIcon icon={faAngleLeft} {...props} />
|
|
34
|
-
);
|
|
35
|
-
default:
|
|
36
|
-
return (
|
|
37
|
-
<FontAwesomeIcon icon={faAngleRight} {...props} />
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
Angle.propTypes = {
|
|
44
|
-
/* Direction of the angle */
|
|
45
|
-
direction: PropTypes.oneOf([
|
|
46
|
-
'up',
|
|
47
|
-
'down',
|
|
48
|
-
'left',
|
|
49
|
-
'right',
|
|
50
|
-
]),
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
Angle.defaultProps = {
|
|
54
|
-
direction: 'right',
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default Angle;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import { faArchive } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
-
|
|
5
|
-
class Archive extends Component {
|
|
6
|
-
render() {
|
|
7
|
-
return (
|
|
8
|
-
<FontAwesomeIcon icon={faArchive} {...this.props} />
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default Archive;
|
package/src-old/glyphs/Arrow.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
-
import {
|
|
5
|
-
faArrowUp,
|
|
6
|
-
faArrowDown,
|
|
7
|
-
faArrowRight,
|
|
8
|
-
faArrowLeft,
|
|
9
|
-
faArrowCircleUp,
|
|
10
|
-
faArrowCircleDown,
|
|
11
|
-
faArrowCircleRight,
|
|
12
|
-
faArrowCircleLeft,
|
|
13
|
-
} from '@fortawesome/free-solid-svg-icons';
|
|
14
|
-
|
|
15
|
-
/* use direction="up|down|left|right" (default is "right")
|
|
16
|
-
* add circled prop to put the chevron in a circle bubble
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
class Arrow extends Component {
|
|
20
|
-
render() {
|
|
21
|
-
// Extract props
|
|
22
|
-
const {
|
|
23
|
-
circled,
|
|
24
|
-
direction,
|
|
25
|
-
...props
|
|
26
|
-
} = this.props;
|
|
27
|
-
|
|
28
|
-
if (circled) {
|
|
29
|
-
switch (direction) {
|
|
30
|
-
case 'up':
|
|
31
|
-
return (
|
|
32
|
-
<FontAwesomeIcon icon={faArrowCircleUp} {...props} />
|
|
33
|
-
);
|
|
34
|
-
case 'down':
|
|
35
|
-
return (
|
|
36
|
-
<FontAwesomeIcon icon={faArrowCircleDown} {...props} />
|
|
37
|
-
);
|
|
38
|
-
case 'left':
|
|
39
|
-
return (
|
|
40
|
-
<FontAwesomeIcon icon={faArrowCircleLeft} {...props} />
|
|
41
|
-
);
|
|
42
|
-
default:
|
|
43
|
-
return (
|
|
44
|
-
<FontAwesomeIcon icon={faArrowCircleRight} {...props} />
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
switch (direction) {
|
|
49
|
-
case 'up':
|
|
50
|
-
return (
|
|
51
|
-
<FontAwesomeIcon icon={faArrowUp} {...props} />
|
|
52
|
-
);
|
|
53
|
-
case 'down':
|
|
54
|
-
return (
|
|
55
|
-
<FontAwesomeIcon icon={faArrowDown} {...props} />
|
|
56
|
-
);
|
|
57
|
-
case 'left':
|
|
58
|
-
return (
|
|
59
|
-
<FontAwesomeIcon icon={faArrowLeft} {...props} />
|
|
60
|
-
);
|
|
61
|
-
default:
|
|
62
|
-
return (
|
|
63
|
-
<FontAwesomeIcon icon={faArrowRight} {...props} />
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
Arrow.propTypes = {
|
|
71
|
-
circled: PropTypes.bool,
|
|
72
|
-
direction: PropTypes.oneOf([
|
|
73
|
-
'up',
|
|
74
|
-
'down',
|
|
75
|
-
'left',
|
|
76
|
-
'right',
|
|
77
|
-
]),
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
Arrow.defaultProps = {
|
|
81
|
-
circled: false,
|
|
82
|
-
direction: 'right',
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default Arrow;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import { faArrowsAltH } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
-
|
|
5
|
-
class ArrowsHorizontal extends Component {
|
|
6
|
-
render() {
|
|
7
|
-
return (
|
|
8
|
-
<FontAwesomeIcon icon={faArrowsAltH} {...this.props} />
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default ArrowsHorizontal;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import { faArrowsAltV } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
-
|
|
5
|
-
class ArrowsVertical extends Component {
|
|
6
|
-
render() {
|
|
7
|
-
return (
|
|
8
|
-
<FontAwesomeIcon icon={faArrowsAltV} {...this.props} />
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default ArrowsVertical;
|
package/src-old/glyphs/Award.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import { faAward } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
-
|
|
5
|
-
class Award extends Component {
|
|
6
|
-
render() {
|
|
7
|
-
return (
|
|
8
|
-
<FontAwesomeIcon icon={faAward} {...this.props} />
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default Award;
|
package/src-old/glyphs/Ban.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import { faBan } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
-
|
|
5
|
-
class Ban extends Component {
|
|
6
|
-
render() {
|
|
7
|
-
return (
|
|
8
|
-
<FontAwesomeIcon icon={faBan} {...this.props} />
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default Ban;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import { faBarcode } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
-
|
|
5
|
-
class Barcode extends Component {
|
|
6
|
-
render() {
|
|
7
|
-
return (
|
|
8
|
-
<FontAwesomeIcon icon={faBarcode} {...this.props} />
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default Barcode;
|