@instructure/quiz-core 20.4.1 → 20.4.2-rc.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/es/reporting/components/Caption/index.js +13 -18
- package/es/reporting/components/Caption/styles.js +12 -0
- package/es/reporting/components/Caption/theme.js +4 -2
- package/es/reporting/components/charts/Legend/index.js +45 -33
- package/es/reporting/components/charts/Legend/styles.js +44 -0
- package/es/reporting/components/charts/Legend/theme.js +4 -2
- package/es/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +61 -79
- package/es/reporting/components/itemAnalysis/ItemAnalysisRow/styles.js +100 -0
- package/es/reporting/components/itemAnalysis/ItemAnalysisRow/theme.js +4 -2
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +34 -44
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/styles.js +40 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/theme.js +4 -2
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/presenter.js +27 -26
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/styles.js +20 -0
- package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/theme.js +4 -2
- package/lib/reporting/components/Caption/index.js +12 -19
- package/lib/reporting/components/Caption/styles.js +20 -0
- package/lib/reporting/components/Caption/theme.js +6 -3
- package/lib/reporting/components/charts/Legend/index.js +44 -34
- package/lib/reporting/components/charts/Legend/styles.js +54 -0
- package/lib/reporting/components/charts/Legend/theme.js +6 -3
- package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +61 -80
- package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/styles.js +110 -0
- package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/theme.js +6 -3
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +33 -45
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/styles.js +48 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/theme.js +6 -3
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/presenter.js +27 -26
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/styles.js +28 -0
- package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/theme.js +6 -3
- package/package.json +10 -11
package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js
CHANGED
|
@@ -6,24 +6,13 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
6
6
|
|
|
7
7
|
var _dec, _class, _class2, _temp;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
template: function template(theme) {
|
|
13
|
-
return "\n\n.eHqQt_eDnN{display:flex;justify-content:space-between;padding-bottom:".concat(theme.headingPadding || 'inherit', "}\n\n.eHqQt_eKXQ{margin:").concat(theme.cardTopMargin || 'inherit', " auto ").concat(theme.cardBottomMargin || 'inherit', " auto;padding:").concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.eHqQt_dYbQ{align-items:center;display:flex;height:502px;justify-content:center;padding:").concat(theme.cardWrapperPadding || 'inherit', "}\n\n.eHqQt_crZr{padding-top:").concat(theme.metricGroupPaddingTop || 'inherit', "}\n\n.eHqQt_bTHH{position:absolute;right:calc(").concat(theme.viewPaddingRight || 'inherit', " + ").concat(theme.viewPaddingRightAdjust || 'inherit', ");top:").concat(theme.viewPaddingTop || 'inherit', "}\n\n.eHqQt_dPzc,.eHqQt_cpZE{column-gap:").concat(theme.metricsColumnGap || 'inherit', ";display:flex;flex-wrap:wrap;justify-content:flex-start;row-gap:1.5rem}");
|
|
14
|
-
},
|
|
15
|
-
'heading': 'eHqQt_eDnN',
|
|
16
|
-
'cardWrapper': 'eHqQt_eKXQ',
|
|
17
|
-
'skeletonCardWrapper': 'eHqQt_dYbQ',
|
|
18
|
-
'container': 'eHqQt_crZr',
|
|
19
|
-
'expandButtonContainer': 'eHqQt_bTHH',
|
|
20
|
-
'metricGroup': 'eHqQt_dPzc',
|
|
21
|
-
'metricsWrapper': 'eHqQt_cpZE'
|
|
22
|
-
};
|
|
9
|
+
/** @jsx jsx */
|
|
10
|
+
import { Component } from 'react';
|
|
11
|
+
import generateStyle from "./styles.js";
|
|
23
12
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
24
13
|
import ExpandButton from "../../../../../common/components/shared/ExpandButton/index.js";
|
|
25
|
-
import {
|
|
26
|
-
import
|
|
14
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
15
|
+
import generateComponentTheme from "./theme.js";
|
|
27
16
|
import { formatTimeToFullNumeric } from "../../../../../common/util/formatTimespan.js";
|
|
28
17
|
import Card from "../../../../../common/components/shared/Card/index.js";
|
|
29
18
|
import AnalysisPopoverMetric from "../AnalysisPopoverMetric/index.js";
|
|
@@ -33,7 +22,7 @@ import { quizAnalysisPropType } from "../propTypes.js";
|
|
|
33
22
|
import PropTypes from 'prop-types';
|
|
34
23
|
import { Spinner } from '@instructure/ui-spinner';
|
|
35
24
|
import { cronbachsAlpha, standardDeviation } from "./popoverContent.js";
|
|
36
|
-
export var NewQuizAnalysis = (_dec =
|
|
25
|
+
export var NewQuizAnalysis = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
37
26
|
_inherits(NewQuizAnalysis, _Component);
|
|
38
27
|
|
|
39
28
|
var _super = _createSuper(NewQuizAnalysis);
|
|
@@ -60,16 +49,16 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
60
49
|
|
|
61
50
|
_this.renderExpanded = function () {
|
|
62
51
|
var scores = _this.props.quizAnalysis.scores;
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
},
|
|
52
|
+
return jsx("div", {
|
|
53
|
+
css: _this.props.styles.container
|
|
54
|
+
}, jsx("div", {
|
|
55
|
+
css: _this.props.styles.metricGroup
|
|
56
|
+
}, jsx(AnalysisPopoverMetric, {
|
|
68
57
|
metricKey: "stddev",
|
|
69
58
|
value: scores === null || scores === void 0 ? void 0 : scores.stddev,
|
|
70
59
|
label: t('Standard Deviation'),
|
|
71
60
|
popoverDescription: standardDeviation
|
|
72
|
-
}),
|
|
61
|
+
}), jsx(AnalysisPopoverMetric, {
|
|
73
62
|
metricKey: "cronbachs_alpha",
|
|
74
63
|
value: scores === null || scores === void 0 ? void 0 : scores.cronbachs_alpha,
|
|
75
64
|
label: t('Cronbach\'s Alpha'),
|
|
@@ -82,45 +71,45 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
82
71
|
var scores = quizAnalysis.scores,
|
|
83
72
|
attempts = quizAnalysis.attempts;
|
|
84
73
|
var expanded = _this.state.expanded;
|
|
85
|
-
return
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
},
|
|
74
|
+
return jsx(Card, {
|
|
75
|
+
css: _this.props.styles.cardWrapper
|
|
76
|
+
}, jsx("div", {
|
|
77
|
+
css: _this.props.styles.metricGroup
|
|
78
|
+
}, jsx("div", {
|
|
79
|
+
css: _this.props.styles.metricsWrapper
|
|
80
|
+
}, jsx(AnalysisMetric, {
|
|
92
81
|
metricKey: "highscore",
|
|
93
82
|
label: t('High Score'),
|
|
94
83
|
value: scores === null || scores === void 0 ? void 0 : scores.max_percentage,
|
|
95
84
|
suffix: "%"
|
|
96
|
-
}),
|
|
85
|
+
}), jsx(AnalysisMetric, {
|
|
97
86
|
metricKey: "lowscore",
|
|
98
87
|
label: t('Low Score'),
|
|
99
88
|
value: scores === null || scores === void 0 ? void 0 : scores.min_percentage,
|
|
100
89
|
suffix: "%"
|
|
101
|
-
}),
|
|
90
|
+
}), jsx(AnalysisMetric, {
|
|
102
91
|
metricKey: "meanscore",
|
|
103
92
|
label: t('Mean Score'),
|
|
104
93
|
value: scores === null || scores === void 0 ? void 0 : scores.mean_percentage,
|
|
105
94
|
suffix: "%"
|
|
106
|
-
})),
|
|
107
|
-
|
|
108
|
-
},
|
|
95
|
+
})), jsx("div", {
|
|
96
|
+
css: _this.props.styles.metricsWrapper
|
|
97
|
+
}, jsx(AnalysisMetric, {
|
|
109
98
|
metricKey: "median_percentage",
|
|
110
99
|
label: t('Median Score'),
|
|
111
100
|
value: scores === null || scores === void 0 ? void 0 : scores.median_percentage,
|
|
112
101
|
suffix: "%"
|
|
113
|
-
}),
|
|
102
|
+
}), jsx(AnalysisMetric, {
|
|
114
103
|
metricKey: "mean_elapsed_sec",
|
|
115
104
|
label: t('Mean Elapsed Time'),
|
|
116
105
|
value: formatTimeToFullNumeric(attempts === null || attempts === void 0 ? void 0 : attempts.mean_elapsed_sec)
|
|
117
|
-
})),
|
|
118
|
-
|
|
119
|
-
},
|
|
106
|
+
})), jsx("div", {
|
|
107
|
+
css: _this.props.styles.expandButtonContainer
|
|
108
|
+
}, jsx(ExpandButton, {
|
|
120
109
|
onClick: _this.handleToggle,
|
|
121
110
|
title: expanded ? t('collapse quiz analysis') : t('expand quiz analysis'),
|
|
122
111
|
isExpanded: expanded
|
|
123
|
-
}))), expanded && _this.renderExpanded(),
|
|
112
|
+
}))), expanded && _this.renderExpanded(), jsx(ScoreDistribution, {
|
|
124
113
|
decileDistribution: _this.getPreparedDecileDistribution()
|
|
125
114
|
}));
|
|
126
115
|
};
|
|
@@ -152,9 +141,9 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
152
141
|
var fetchInProgress = this.props.fetchInProgress;
|
|
153
142
|
|
|
154
143
|
if (fetchInProgress) {
|
|
155
|
-
return
|
|
156
|
-
|
|
157
|
-
},
|
|
144
|
+
return jsx(Card, {
|
|
145
|
+
css: this.props.styles.skeletonCardWrapper
|
|
146
|
+
}, jsx(Spinner, {
|
|
158
147
|
renderTitle: t('Loading quiz analysis data')
|
|
159
148
|
}));
|
|
160
149
|
} else {
|
|
@@ -167,7 +156,8 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
167
156
|
return NewQuizAnalysis;
|
|
168
157
|
}(Component), _class2.propTypes = {
|
|
169
158
|
quizAnalysis: quizAnalysisPropType,
|
|
170
|
-
fetchInProgress: PropTypes.bool
|
|
159
|
+
fetchInProgress: PropTypes.bool,
|
|
160
|
+
styles: PropTypes.object
|
|
171
161
|
}.isRequired, _class2.defaultProps = {
|
|
172
162
|
quizAnalysis: {}
|
|
173
163
|
}, _temp)) || _class);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
2
|
+
var metric = {
|
|
3
|
+
flexWrap: 'wrap',
|
|
4
|
+
display: 'flex',
|
|
5
|
+
justifyContent: 'flex-start',
|
|
6
|
+
columnGap: componentTheme.metricsColumnGap,
|
|
7
|
+
rowGap: '1.5rem'
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
heading: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
justifyContent: 'space-between',
|
|
13
|
+
paddingBottom: componentTheme.headingPadding
|
|
14
|
+
},
|
|
15
|
+
cardWrapper: {
|
|
16
|
+
padding: componentTheme.cardWrapperPadding,
|
|
17
|
+
position: 'relative',
|
|
18
|
+
margin: "".concat(componentTheme.cardTopMargin, " auto ").concat(componentTheme.cardBottomMargin, " auto")
|
|
19
|
+
},
|
|
20
|
+
skeletonCardWrapper: {
|
|
21
|
+
padding: componentTheme.cardWrapperPadding,
|
|
22
|
+
height: '502px',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center'
|
|
26
|
+
},
|
|
27
|
+
container: {
|
|
28
|
+
paddingTop: componentTheme.metricGroupPaddingTop
|
|
29
|
+
},
|
|
30
|
+
expandButtonContainer: {
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
right: "calc(".concat(componentTheme.viewPaddingRight, " + ").concat(componentTheme.viewPaddingRightAdjust, ")"),
|
|
33
|
+
top: componentTheme.viewPaddingTop
|
|
34
|
+
},
|
|
35
|
+
metricsWrapper: metric,
|
|
36
|
+
metricGroup: metric
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default generateStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var spacing = _ref.spacing;
|
|
3
3
|
return {
|
|
4
4
|
metricGroupPaddingTop: spacing.medium,
|
|
@@ -11,4 +11,6 @@ export default function generator(_ref) {
|
|
|
11
11
|
cardWrapperPadding: spacing.medium,
|
|
12
12
|
metricsColumnGap: '82px'
|
|
13
13
|
};
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default generateComponentTheme;
|
|
@@ -3,27 +3,23 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
|
|
6
|
-
var _dec, _class, _temp;
|
|
6
|
+
var _dec, _class, _class2, _temp;
|
|
7
7
|
|
|
8
|
+
/* eslint-disable no-unused-vars */
|
|
9
|
+
|
|
10
|
+
/** @jsx jsx */
|
|
8
11
|
import React, { Component } from 'react';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
9
13
|
import QuintileDistribution from "../../../../charts/QuintileDistribution/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
componentId: 'eRgoL',
|
|
14
|
-
template: function template(theme) {
|
|
15
|
-
return "\n\n.eRgoL_YBfL{background-color:".concat(theme.legendRectFillColor || 'inherit', "}\n\n.eRgoL_eDZF{column-gap:10px;display:inline-flex;padding:").concat(theme.legendPadding || 'inherit', " 0}\n\n.eRgoL_dVXF{margin:").concat(theme.legendMargin || 'inherit', " 0}\n\n.eRgoL_dxZa,[dir=ltr] .eRgoL_dxZa,[dir=rtl] .eRgoL_dxZa{text-align:center}");
|
|
16
|
-
},
|
|
17
|
-
'legendRect': 'eRgoL_YBfL',
|
|
18
|
-
'legendContainer': 'eRgoL_eDZF',
|
|
19
|
-
'headingContainer': 'eRgoL_dVXF',
|
|
20
|
-
'chartLabel': 'eRgoL_dxZa'
|
|
21
|
-
};
|
|
14
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
15
|
+
import generateComponentTheme from "./theme.js";
|
|
16
|
+
import generateStyle from "./styles.js";
|
|
22
17
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
23
18
|
import { Text } from '@instructure/ui-text';
|
|
24
19
|
import { Heading } from '@instructure/ui-heading';
|
|
25
20
|
import Legend from "../../../../charts/Legend/index.js";
|
|
26
|
-
|
|
21
|
+
import { number } from 'sinon/lib/sinon/match';
|
|
22
|
+
export var ScoreDistribution = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
27
23
|
_inherits(ScoreDistribution, _Component);
|
|
28
24
|
|
|
29
25
|
var _super = _createSuper(ScoreDistribution);
|
|
@@ -65,28 +61,28 @@ export var ScoreDistribution = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
65
61
|
key: "render",
|
|
66
62
|
value: function render() {
|
|
67
63
|
var decileDistribution = this.props.decileDistribution;
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
},
|
|
64
|
+
return jsx(React.Fragment, null, jsx("div", {
|
|
65
|
+
css: this.props.styles.headingContainer
|
|
66
|
+
}, jsx(Heading, {
|
|
71
67
|
level: "h3",
|
|
72
68
|
themeOverride: {
|
|
73
69
|
h3FontWeight: 700
|
|
74
70
|
}
|
|
75
|
-
}, t('Score Distribution'))),
|
|
71
|
+
}, t('Score Distribution'))), jsx(QuintileDistribution, {
|
|
76
72
|
animateDelay: 1000,
|
|
77
73
|
animateDuration: 1000,
|
|
78
74
|
visualDistribution: decileDistribution || [],
|
|
79
75
|
calculateLabelForColumn: decileDistribution.length > 10 ? this.calculateLabelForColumnsWithExtremeValues : this.calculateLabelForColumns
|
|
80
|
-
}),
|
|
76
|
+
}), jsx("div", {
|
|
81
77
|
"aria-hidden": "true",
|
|
82
|
-
|
|
83
|
-
},
|
|
78
|
+
css: this.props.styles.chartLabel
|
|
79
|
+
}, jsx(Text, {
|
|
84
80
|
size: "small"
|
|
85
|
-
}, t('Score'))),
|
|
86
|
-
|
|
87
|
-
},
|
|
81
|
+
}, t('Score'))), jsx("div", {
|
|
82
|
+
css: this.props.styles.legendContainer
|
|
83
|
+
}, jsx(Legend, {
|
|
88
84
|
series: [{
|
|
89
|
-
|
|
85
|
+
customStyles: this.props.styles.legendRect,
|
|
90
86
|
label: t('Number of Students')
|
|
91
87
|
}]
|
|
92
88
|
})));
|
|
@@ -95,4 +91,9 @@ export var ScoreDistribution = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
95
91
|
|
|
96
92
|
ScoreDistribution.displayName = "ScoreDistribution";
|
|
97
93
|
return ScoreDistribution;
|
|
98
|
-
}(Component),
|
|
94
|
+
}(Component), _class2.propTypes = {
|
|
95
|
+
decileDistribution: PropTypes.arrayOf(PropTypes.number),
|
|
96
|
+
styles: PropTypes.object
|
|
97
|
+
}, _class2.defaultProps = {
|
|
98
|
+
decileDistribution: []
|
|
99
|
+
}, _temp)) || _class);
|
package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/styles.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
2
|
+
return {
|
|
3
|
+
legendRect: {
|
|
4
|
+
backgroundColor: componentTheme.legendRectFillColor
|
|
5
|
+
},
|
|
6
|
+
legendContainer: {
|
|
7
|
+
display: 'inline-flex',
|
|
8
|
+
columnGap: '10px',
|
|
9
|
+
padding: "".concat(componentTheme.legendPadding, " 0")
|
|
10
|
+
},
|
|
11
|
+
headingContainer: {
|
|
12
|
+
margin: "".concat(componentTheme.legendMargin, " 0")
|
|
13
|
+
},
|
|
14
|
+
chartLabel: {
|
|
15
|
+
textAlign: 'center'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default generateStyle;
|
package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/theme.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var colors = _ref.colors,
|
|
3
3
|
spacing = _ref.spacing,
|
|
4
4
|
typography = _ref.typography;
|
|
@@ -9,4 +9,6 @@ export default function generator(_ref) {
|
|
|
9
9
|
legendFontSize: typography.fontSizeXSmall,
|
|
10
10
|
legendMargin: spacing.medium
|
|
11
11
|
};
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default generateComponentTheme;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -17,27 +15,21 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
17
15
|
|
|
18
16
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
17
|
|
|
20
|
-
var _react =
|
|
18
|
+
var _react = require("react");
|
|
21
19
|
|
|
22
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
21
|
|
|
24
22
|
var _uiHeading = require("@instructure/ui-heading");
|
|
25
23
|
|
|
26
|
-
var
|
|
24
|
+
var _emotion = require("@instructure/emotion");
|
|
25
|
+
|
|
26
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
27
27
|
|
|
28
28
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
29
29
|
|
|
30
30
|
var _dec, _class, _class2, _temp;
|
|
31
31
|
|
|
32
|
-
var
|
|
33
|
-
componentId: 'bEEaV',
|
|
34
|
-
template: function template(theme) {
|
|
35
|
-
return "\n\n.bEEaV_caGd{margin:".concat(theme.contentMargin || 'inherit', "}\n\n.bEEaV_biBD{padding-top:").concat(theme.childrenPadding || 'inherit', "}");
|
|
36
|
-
},
|
|
37
|
-
'content': 'bEEaV_caGd',
|
|
38
|
-
'children': 'bEEaV_biBD'
|
|
39
|
-
};
|
|
40
|
-
var Caption = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
32
|
+
var Caption = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
41
33
|
(0, _inherits2.default)(Caption, _Component);
|
|
42
34
|
|
|
43
35
|
var _super = (0, _createSuper2.default)(Caption);
|
|
@@ -50,15 +42,15 @@ var Caption = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(
|
|
|
50
42
|
(0, _createClass2.default)(Caption, [{
|
|
51
43
|
key: "render",
|
|
52
44
|
value: function render() {
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
},
|
|
45
|
+
return (0, _emotion.jsx)("div", {
|
|
46
|
+
css: this.props.styles.content
|
|
47
|
+
}, (0, _emotion.jsx)(_uiHeading.Heading, {
|
|
56
48
|
level: "reset",
|
|
57
49
|
as: "h2",
|
|
58
50
|
border: "bottom",
|
|
59
51
|
color: "primary"
|
|
60
|
-
}, this.props.text),
|
|
61
|
-
|
|
52
|
+
}, this.props.text), (0, _emotion.jsx)("div", {
|
|
53
|
+
css: this.props.styles.children
|
|
62
54
|
}, this.props.children));
|
|
63
55
|
}
|
|
64
56
|
}]);
|
|
@@ -66,7 +58,8 @@ var Caption = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(
|
|
|
66
58
|
return Caption;
|
|
67
59
|
}(_react.Component), _class2.propTypes = {
|
|
68
60
|
text: _propTypes.default.string,
|
|
69
|
-
children: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.arrayOf(_propTypes.default.object)])
|
|
61
|
+
children: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.arrayOf(_propTypes.default.object)]),
|
|
62
|
+
styles: _propTypes.default.object
|
|
70
63
|
}, _class2.defaultProps = {
|
|
71
64
|
text: void 0,
|
|
72
65
|
children: void 0
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
9
|
+
return {
|
|
10
|
+
content: {
|
|
11
|
+
margin: componentTheme.contentMargin
|
|
12
|
+
},
|
|
13
|
+
children: {
|
|
14
|
+
paddingTop: componentTheme.childrenPadding
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
var _default = generateStyle;
|
|
20
|
+
exports.default = _default;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
9
9
|
var spacing = _ref.spacing,
|
|
10
10
|
borders = _ref.borders,
|
|
11
11
|
colors = _ref.colors;
|
|
@@ -13,4 +13,7 @@ function generator(_ref) {
|
|
|
13
13
|
contentMargin: spacing.small,
|
|
14
14
|
childrenPadding: spacing.xSmall
|
|
15
15
|
};
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
var _default = generateComponentTheme;
|
|
19
|
+
exports.default = _default;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.Legend = void 0;
|
|
11
9
|
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
13
|
|
|
14
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -17,33 +17,21 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
17
17
|
|
|
18
18
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
19
|
|
|
20
|
-
var _react =
|
|
20
|
+
var _react = require("react");
|
|
21
21
|
|
|
22
22
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
23
|
|
|
24
24
|
var _uiA11yContent = require("@instructure/ui-a11y-content");
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _emotion = require("@instructure/emotion");
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
29
29
|
|
|
30
30
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
31
31
|
|
|
32
32
|
var _dec, _class, _class2, _temp;
|
|
33
33
|
|
|
34
|
-
var
|
|
35
|
-
componentId: 'gafaO',
|
|
36
|
-
template: function template(theme) {
|
|
37
|
-
return "\n\n.gafaO_fEOG{border:".concat(theme.containerBorderWidth || 'inherit', " solid ").concat(theme.containerBorderColor || 'inherit', "}\n\n.gafaO_dWcO{margin:0 calc(-1*").concat(theme.seriesContainerRowMargin || 'inherit', ")}\n\n.gafaO_czwp{align-items:center;flex-direction:row;margin:").concat(theme.seriesContainerMargin || 'inherit', "}\n\n.gafaO_fEOG .gafaO_czwp{display:flex}\n\n.gafaO_dWcO .gafaO_czwp{display:inline-flex;padding:0 ").concat(theme.seriesContainerRowMargin || 'inherit', "}\n\n.gafaO_crhW{display:flex;height:1.2rem;margin-right:").concat(theme.seriesSwatchMargin || 'inherit', ";width:1.2rem}\n\n.gafaO_fAPS{flex:1}\n\n.gafaO_eVVT{color:").concat(theme.seriesLabelColor || 'inherit', ";font-family:").concat(theme.seriesLabelFontFamily || 'inherit', ";font-size:").concat(theme.seriesLabelFontSize || 'inherit', ";white-space:nowrap}");
|
|
38
|
-
},
|
|
39
|
-
'containerColumn': 'gafaO_fEOG',
|
|
40
|
-
'containerRow': 'gafaO_dWcO',
|
|
41
|
-
'seriesContainer': 'gafaO_czwp',
|
|
42
|
-
'seriesSwatchContainer': 'gafaO_crhW',
|
|
43
|
-
'seriesSwatch': 'gafaO_fAPS',
|
|
44
|
-
'seriesLabel': 'gafaO_eVVT'
|
|
45
|
-
};
|
|
46
|
-
var Legend = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
34
|
+
var Legend = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
47
35
|
(0, _inherits2.default)(Legend, _Component);
|
|
48
36
|
|
|
49
37
|
var _super = (0, _createSuper2.default)(Legend);
|
|
@@ -54,27 +42,47 @@ var Legend = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_
|
|
|
54
42
|
}
|
|
55
43
|
|
|
56
44
|
(0, _createClass2.default)(Legend, [{
|
|
45
|
+
key: "componentDidMount",
|
|
46
|
+
value: function componentDidMount() {
|
|
47
|
+
this.props.makeStyles();
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "componentDidUpdate",
|
|
51
|
+
value: function componentDidUpdate() {
|
|
52
|
+
this.props.makeStyles();
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
57
55
|
key: "renderSeries",
|
|
58
|
-
value: function renderSeries(series, index) {
|
|
59
|
-
|
|
56
|
+
value: function renderSeries(series, index, styles) {
|
|
57
|
+
var customStyles = series.customStyles ? series.customStyles : {};
|
|
58
|
+
return (0, _emotion.jsx)("div", {
|
|
60
59
|
key: index,
|
|
61
|
-
className:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
className: "seriesContainer",
|
|
61
|
+
css: styles.seriesContainer
|
|
62
|
+
}, (0, _emotion.jsx)("div", {
|
|
63
|
+
css: styles.seriesSwatchContainer
|
|
64
|
+
}, (0, _emotion.jsx)("div", {
|
|
65
|
+
css: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, styles.seriesSwatch), customStyles)
|
|
66
|
+
})), (0, _emotion.jsx)("div", {
|
|
67
|
+
css: styles.seriesLabel
|
|
68
68
|
}, series.label));
|
|
69
69
|
}
|
|
70
70
|
}, {
|
|
71
71
|
key: "render",
|
|
72
72
|
value: function render() {
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
var _this = this;
|
|
74
|
+
|
|
75
|
+
var _this$props = this.props,
|
|
76
|
+
variant = _this$props.variant,
|
|
77
|
+
series = _this$props.series,
|
|
78
|
+
styles = _this$props.styles;
|
|
79
|
+
var containerClass = variant === 'row' ? 'containerRow' : 'containerColumn';
|
|
80
|
+
return (0, _emotion.jsx)(_uiA11yContent.PresentationContent, null, (0, _emotion.jsx)("div", {
|
|
81
|
+
className: containerClass,
|
|
82
|
+
css: styles.containerStyle
|
|
83
|
+
}, series.map(function (s, i) {
|
|
84
|
+
return _this.renderSeries(s, i, styles);
|
|
85
|
+
})));
|
|
78
86
|
}
|
|
79
87
|
}]);
|
|
80
88
|
Legend.displayName = "Legend";
|
|
@@ -82,9 +90,11 @@ var Legend = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_
|
|
|
82
90
|
}(_react.Component), _class2.propTypes = {
|
|
83
91
|
series: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
84
92
|
label: _propTypes.default.string.isRequired,
|
|
85
|
-
|
|
93
|
+
customStyles: _propTypes.default.object.isRequired
|
|
86
94
|
})),
|
|
87
|
-
variant: _propTypes.default.oneOf(['column', 'row'])
|
|
95
|
+
variant: _propTypes.default.oneOf(['column', 'row']),
|
|
96
|
+
makeStyles: _propTypes.default.func,
|
|
97
|
+
styles: _propTypes.default.object
|
|
88
98
|
}, _class2.defaultProps = {
|
|
89
99
|
series: [],
|
|
90
100
|
variant: 'column'
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var generateStyle = function generateStyle(componentTheme, props) {
|
|
13
|
+
var containerVariant = {
|
|
14
|
+
row: {
|
|
15
|
+
margin: "0 calc(-1 * ".concat(componentTheme.seriesContainerRowMargin, ")"),
|
|
16
|
+
'.seriesContainer': {
|
|
17
|
+
display: 'inline-flex',
|
|
18
|
+
padding: "0 ".concat(componentTheme.seriesContainerRowMargin)
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
column: {
|
|
22
|
+
border: "".concat(componentTheme.containerBorderWidth, " solid ").concat(componentTheme.containerBorderColor),
|
|
23
|
+
'.seriesContainer': {
|
|
24
|
+
display: 'flex'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
seriesContainer: {
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
margin: componentTheme.seriesContainerMargin
|
|
33
|
+
},
|
|
34
|
+
containerStyle: (0, _objectSpread2.default)({}, containerVariant[props.variant]),
|
|
35
|
+
seriesSwatchContainer: {
|
|
36
|
+
width: '1.2rem',
|
|
37
|
+
height: '1.2rem',
|
|
38
|
+
marginRight: componentTheme.seriesSwatchMargin,
|
|
39
|
+
display: 'flex'
|
|
40
|
+
},
|
|
41
|
+
seriesSwatch: {
|
|
42
|
+
flex: 1
|
|
43
|
+
},
|
|
44
|
+
seriesLabel: {
|
|
45
|
+
fontFamily: componentTheme.seriesLabelFontFamily,
|
|
46
|
+
fontSize: componentTheme.seriesLabelFontSize,
|
|
47
|
+
whiteSpace: 'nowrap',
|
|
48
|
+
color: componentTheme.seriesLabelColor
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var _default = generateStyle;
|
|
54
|
+
exports.default = _default;
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
9
9
|
var borders = _ref.borders,
|
|
10
10
|
spacing = _ref.spacing,
|
|
11
11
|
colors = _ref.colors,
|
|
@@ -21,4 +21,7 @@ function generator(_ref) {
|
|
|
21
21
|
seriesLabelFontSize: typography.fontSizeXSmall,
|
|
22
22
|
seriesLabelColor: colors.textDarkest
|
|
23
23
|
};
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var _default = generateComponentTheme;
|
|
27
|
+
exports.default = _default;
|