@instructure/quiz-core 20.11.1 → 20.11.2-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/common/components/resources/WarningWrapper/index.js +21 -31
- package/es/common/components/resources/WarningWrapper/styles.js +28 -0
- package/es/common/components/resources/WarningWrapper/theme.js +4 -2
- package/es/common/components/resources/stimulus/StimulusEditInfo/presenter.js +38 -43
- package/es/common/components/resources/stimulus/StimulusEditInfo/styles.js +14 -0
- package/es/common/components/resources/stimulus/StimulusEditInfo/theme.js +4 -2
- package/es/moderating/components/events/ResponseEvent.js +21 -24
- package/es/moderating/components/events/styles.js +25 -0
- package/es/moderating/components/events/theme.js +4 -2
- package/lib/common/components/resources/WarningWrapper/index.js +20 -32
- package/lib/common/components/resources/WarningWrapper/styles.js +36 -0
- package/lib/common/components/resources/WarningWrapper/theme.js +6 -3
- package/lib/common/components/resources/stimulus/StimulusEditInfo/presenter.js +36 -44
- package/lib/common/components/resources/stimulus/StimulusEditInfo/styles.js +22 -0
- package/lib/common/components/resources/stimulus/StimulusEditInfo/theme.js +6 -3
- package/lib/moderating/components/events/ResponseEvent.js +21 -25
- package/lib/moderating/components/events/styles.js +33 -0
- package/lib/moderating/components/events/theme.js +6 -3
- package/package.json +10 -10
|
@@ -5,25 +5,17 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
|
|
6
6
|
var _dec, _class, _class2, _temp;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** @jsx jsx */
|
|
9
|
+
import { Component } from 'react';
|
|
9
10
|
import PropTypes from 'prop-types';
|
|
10
11
|
import { Alert } from '@instructure/ui-alerts';
|
|
11
12
|
import { Button } from '@instructure/ui-buttons';
|
|
12
13
|
import { Text } from '@instructure/ui-text';
|
|
13
|
-
import {
|
|
14
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
14
15
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return "\n\n.epout_bgqc{padding-bottom:".concat(theme.alertPadding || 'inherit', ";position:inherit;z-index:").concat(theme.alertZIndex || 'inherit', "}\n\n.epout_etBv{display:block}\n\n.epout_crZr{padding:").concat(theme.containerPadding || 'inherit', ";position:relative}\n\n.epout_oqJC{background-color:").concat(theme.disabledChildrenBackgroundColor || 'inherit', ";bottom:0;left:0;opacity:").concat(theme.disabledChildrenOpacity || 'inherit', ";position:absolute;right:0;top:0;z-index:").concat(theme.disabledChildrenZIndex || 'inherit', "}");
|
|
19
|
-
},
|
|
20
|
-
'alert': 'epout_bgqc',
|
|
21
|
-
'alertContent': 'epout_etBv',
|
|
22
|
-
'container': 'epout_crZr',
|
|
23
|
-
'disabledChildren': 'epout_oqJC'
|
|
24
|
-
};
|
|
25
|
-
import theme from "./theme.js";
|
|
26
|
-
export var WarningWrapper = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
16
|
+
import generateStyle from "./styles.js";
|
|
17
|
+
import generateComponentTheme from "./theme.js";
|
|
18
|
+
export var WarningWrapper = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
27
19
|
_inherits(WarningWrapper, _Component);
|
|
28
20
|
|
|
29
21
|
var _super = _createSuper(WarningWrapper);
|
|
@@ -62,13 +54,11 @@ export var WarningWrapper = (_dec = themeable(theme, styles), _dec(_class = (_te
|
|
|
62
54
|
key: "renderActionButtons",
|
|
63
55
|
value: function renderActionButtons() {
|
|
64
56
|
if (this.props.hideActions) return;
|
|
65
|
-
return
|
|
66
|
-
className: styles.alertContentRow
|
|
67
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
57
|
+
return jsx("div", null, jsx(Button, {
|
|
68
58
|
size: "small",
|
|
69
59
|
onClick: this.props.cancelActionCallback,
|
|
70
60
|
ref: this.setFocusRef
|
|
71
|
-
}, this.props.cancelActionText),
|
|
61
|
+
}, this.props.cancelActionText), jsx(Button, {
|
|
72
62
|
size: "small",
|
|
73
63
|
margin: "x-small",
|
|
74
64
|
color: "primary",
|
|
@@ -78,25 +68,23 @@ export var WarningWrapper = (_dec = themeable(theme, styles), _dec(_class = (_te
|
|
|
78
68
|
}, {
|
|
79
69
|
key: "renderDescription",
|
|
80
70
|
value: function renderDescription() {
|
|
81
|
-
return
|
|
82
|
-
className: styles.alertContentRow
|
|
83
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
71
|
+
return jsx("div", null, jsx(Text, {
|
|
84
72
|
color: "primary"
|
|
85
73
|
}, this.props.description));
|
|
86
74
|
}
|
|
87
75
|
}, {
|
|
88
76
|
key: "renderAlertContent",
|
|
89
77
|
value: function renderAlertContent() {
|
|
90
|
-
return
|
|
91
|
-
|
|
78
|
+
return jsx("div", {
|
|
79
|
+
css: this.props.styles.alertContent
|
|
92
80
|
}, this.renderDescription(), this.renderActionButtons());
|
|
93
81
|
}
|
|
94
82
|
}, {
|
|
95
83
|
key: "renderAlert",
|
|
96
84
|
value: function renderAlert() {
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
},
|
|
85
|
+
return jsx("div", {
|
|
86
|
+
css: this.props.styles.alert
|
|
87
|
+
}, jsx(Alert, {
|
|
100
88
|
variant: this.props.alertType
|
|
101
89
|
}, this.renderAlertContent()));
|
|
102
90
|
}
|
|
@@ -104,15 +92,16 @@ export var WarningWrapper = (_dec = themeable(theme, styles), _dec(_class = (_te
|
|
|
104
92
|
key: "renderDisableOverlay",
|
|
105
93
|
value: function renderDisableOverlay() {
|
|
106
94
|
if (!this.props.disableChildren) return;
|
|
107
|
-
return
|
|
108
|
-
|
|
95
|
+
return jsx("div", {
|
|
96
|
+
css: this.props.styles.disabledChildren,
|
|
97
|
+
"data-testid": "disabled-children"
|
|
109
98
|
});
|
|
110
99
|
}
|
|
111
100
|
}, {
|
|
112
101
|
key: "render",
|
|
113
102
|
value: function render() {
|
|
114
|
-
return
|
|
115
|
-
|
|
103
|
+
return jsx("div", {
|
|
104
|
+
css: this.props.styles.container
|
|
116
105
|
}, this.renderMessage(), this.renderDisableOverlay(), this.props.children);
|
|
117
106
|
}
|
|
118
107
|
}]);
|
|
@@ -129,7 +118,8 @@ export var WarningWrapper = (_dec = themeable(theme, styles), _dec(_class = (_te
|
|
|
129
118
|
description: PropTypes.node,
|
|
130
119
|
disableChildren: PropTypes.bool,
|
|
131
120
|
hideActions: PropTypes.bool,
|
|
132
|
-
showAlert: PropTypes.bool
|
|
121
|
+
showAlert: PropTypes.bool,
|
|
122
|
+
styles: PropTypes.object
|
|
133
123
|
}, _class2.defaultProps = {
|
|
134
124
|
alertType: 'info',
|
|
135
125
|
cancelActionCallback: void 0,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
2
|
+
return {
|
|
3
|
+
alert: {
|
|
4
|
+
paddingBottom: componentTheme.alertPadding,
|
|
5
|
+
zIndex: componentTheme.alertZIndex,
|
|
6
|
+
position: 'inherit'
|
|
7
|
+
},
|
|
8
|
+
alertContent: {
|
|
9
|
+
display: 'block'
|
|
10
|
+
},
|
|
11
|
+
container: {
|
|
12
|
+
position: 'relative',
|
|
13
|
+
padding: componentTheme.containerPadding
|
|
14
|
+
},
|
|
15
|
+
disabledChildren: {
|
|
16
|
+
backgroundColor: componentTheme.disabledChildrenBackgroundColor,
|
|
17
|
+
opacity: componentTheme.disabledChildrenOpacity,
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
zIndex: componentTheme.disabledChildrenZIndex,
|
|
20
|
+
top: '0',
|
|
21
|
+
bottom: '0',
|
|
22
|
+
left: '0',
|
|
23
|
+
right: '0'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default generateStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var spacing = _ref.spacing,
|
|
3
3
|
typography = _ref.typography,
|
|
4
4
|
colors = _ref.colors;
|
|
@@ -10,4 +10,6 @@ export default function generator(_ref) {
|
|
|
10
10
|
disabledChildrenOpacity: '0.6',
|
|
11
11
|
disabledChildrenZIndex: '7777'
|
|
12
12
|
};
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default generateComponentTheme;
|
|
@@ -5,13 +5,14 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
|
|
6
6
|
var _dec, _class, _class2, _temp;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** @jsx jsx */
|
|
9
|
+
import { Component } from 'react';
|
|
9
10
|
import PropTypes from 'prop-types';
|
|
10
11
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
11
12
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
12
13
|
import { TextInput } from '@instructure/ui-text-input';
|
|
13
14
|
import { FormField, FormFieldGroup } from '@instructure/ui-form-field';
|
|
14
|
-
import {
|
|
15
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
15
16
|
import { Heading } from '@instructure/ui-heading';
|
|
16
17
|
import { RichContentInput, RCE_SINGLE_LINE_HEIGHT } from '@instructure/quiz-rce';
|
|
17
18
|
import { toErrors } from "../../../../util/instUIMessages.js";
|
|
@@ -20,23 +21,16 @@ import { IconUpdownLine } from '@instructure/ui-icons';
|
|
|
20
21
|
import { ToggleDetails } from '@instructure/ui-toggle-details';
|
|
21
22
|
import { TOP } from '@instructure/quiz-common';
|
|
22
23
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
'section': 'doNBF_daCg',
|
|
29
|
-
'optionalLabel': 'doNBF_fvFs'
|
|
30
|
-
};
|
|
31
|
-
import theme from "./theme.js";
|
|
32
|
-
|
|
33
|
-
var _ref3 = /*#__PURE__*/React.createElement(IconUpdownLine, {
|
|
24
|
+
import generateStyle from "./styles.js";
|
|
25
|
+
import generateComponentTheme from "./theme.js";
|
|
26
|
+
|
|
27
|
+
var _ref3 = jsx(IconUpdownLine, {
|
|
34
28
|
rotate: "90"
|
|
35
29
|
});
|
|
36
30
|
|
|
37
|
-
var _ref4 =
|
|
31
|
+
var _ref4 = jsx(IconUpdownLine, null);
|
|
38
32
|
|
|
39
|
-
export var StimulusEditInfo = (_dec =
|
|
33
|
+
export var StimulusEditInfo = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
40
34
|
_inherits(StimulusEditInfo, _Component);
|
|
41
35
|
|
|
42
36
|
var _super = _createSuper(StimulusEditInfo);
|
|
@@ -95,28 +89,28 @@ export var StimulusEditInfo = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
95
89
|
key: "renderOptionalLabel",
|
|
96
90
|
value: function renderOptionalLabel(labelName) {
|
|
97
91
|
var optionalText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t('(optional)');
|
|
98
|
-
return
|
|
99
|
-
|
|
92
|
+
return jsx("div", null, jsx("span", null, labelName), jsx("span", {
|
|
93
|
+
css: this.props.styles.optionalLabel
|
|
100
94
|
}, optionalText));
|
|
101
95
|
}
|
|
102
96
|
}, {
|
|
103
97
|
key: "renderStimulusOrientationSelect",
|
|
104
98
|
value: function renderStimulusOrientationSelect() {
|
|
105
99
|
var stimulusOrientation = this.props.workingStimulus.get('orientation');
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
},
|
|
100
|
+
return jsx("div", {
|
|
101
|
+
css: this.props.styles.section
|
|
102
|
+
}, jsx(SimpleSelect, {
|
|
109
103
|
renderLabel: t('Orientation'),
|
|
110
104
|
onChange: this.onOrientationChange,
|
|
111
105
|
value: stimulusOrientation,
|
|
112
|
-
renderBeforeInput:
|
|
106
|
+
renderBeforeInput: jsx(IconUpdownLine, {
|
|
113
107
|
rotate: stimulusOrientation === TOP ? '0' : '90'
|
|
114
108
|
})
|
|
115
|
-
},
|
|
109
|
+
}, jsx(SimpleSelect.Option, {
|
|
116
110
|
renderBeforeLabel: _ref3,
|
|
117
111
|
id: "stimulus-orientation-select-option-left",
|
|
118
112
|
value: "left"
|
|
119
|
-
}, t('Questions to the right')),
|
|
113
|
+
}, t('Questions to the right')), jsx(SimpleSelect.Option, {
|
|
120
114
|
renderBeforeLabel: _ref4,
|
|
121
115
|
id: "stimulus-orientation-select-option-top",
|
|
122
116
|
value: "top"
|
|
@@ -128,35 +122,35 @@ export var StimulusEditInfo = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
128
122
|
var stimulus = this.props.workingStimulus;
|
|
129
123
|
var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
|
|
130
124
|
var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
|
|
131
|
-
return
|
|
125
|
+
return jsx(FormFieldGroup, {
|
|
132
126
|
messages: this.inputErrors('onSelf'),
|
|
133
|
-
description:
|
|
134
|
-
},
|
|
127
|
+
description: jsx(ScreenReaderContent, null, t('Edit Stimulus'))
|
|
128
|
+
}, jsx(Heading, {
|
|
135
129
|
level: "h3",
|
|
136
130
|
as: "h2"
|
|
137
|
-
}, this.headerText()),
|
|
138
|
-
|
|
139
|
-
},
|
|
131
|
+
}, this.headerText()), jsx("div", {
|
|
132
|
+
css: this.props.styles.section
|
|
133
|
+
}, jsx(TextInput, {
|
|
140
134
|
messages: this.inputErrors('title'),
|
|
141
135
|
renderLabel: t('Title'),
|
|
142
136
|
type: "text",
|
|
143
137
|
ref: this.props.setTitleRef,
|
|
144
138
|
onChange: this.onTextInputChange('title'),
|
|
145
139
|
value: stimulus.get('title')
|
|
146
|
-
})),
|
|
147
|
-
|
|
148
|
-
},
|
|
140
|
+
})), jsx("div", {
|
|
141
|
+
css: this.props.styles.section
|
|
142
|
+
}, jsx(TextInput, {
|
|
149
143
|
renderLabel: this.renderOptionalLabel(t('Instructions')),
|
|
150
144
|
type: "text",
|
|
151
145
|
onChange: this.onTextInputChange('instructions'),
|
|
152
146
|
value: stimulus.get('instructions')
|
|
153
|
-
})),
|
|
154
|
-
|
|
155
|
-
},
|
|
147
|
+
})), jsx("div", {
|
|
148
|
+
css: this.props.styles.section
|
|
149
|
+
}, jsx(FormField, {
|
|
156
150
|
id: stimulusBodyId,
|
|
157
151
|
label: t('Content'),
|
|
158
152
|
messages: this.inputErrors('body')
|
|
159
|
-
},
|
|
153
|
+
}, jsx(RichContentInput, {
|
|
160
154
|
actsAsInput: true,
|
|
161
155
|
label: "",
|
|
162
156
|
placeholder: t('Add Stimulus Content...'),
|
|
@@ -166,16 +160,16 @@ export var StimulusEditInfo = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
166
160
|
onBlur: this.onBodyChange,
|
|
167
161
|
onChange: this.onBodyChange,
|
|
168
162
|
height: RCE_SINGLE_LINE_HEIGHT
|
|
169
|
-
}))),
|
|
170
|
-
|
|
171
|
-
},
|
|
163
|
+
}))), jsx("div", {
|
|
164
|
+
css: this.props.styles.section
|
|
165
|
+
}, jsx(ToggleDetails, {
|
|
172
166
|
defaultExpanded: true,
|
|
173
167
|
variant: "filled",
|
|
174
168
|
key: "options",
|
|
175
169
|
summary: t('Options')
|
|
176
|
-
}, this.props.stimulusOrientationEnabled ? this.renderStimulusOrientationSelect() : null,
|
|
177
|
-
|
|
178
|
-
},
|
|
170
|
+
}, this.props.stimulusOrientationEnabled ? this.renderStimulusOrientationSelect() : null, jsx("div", {
|
|
171
|
+
css: this.props.styles.section
|
|
172
|
+
}, jsx(TextInput, {
|
|
179
173
|
renderLabel: this.renderOptionalLabel(t('Source URL'), t('(optional - not visible to students)')),
|
|
180
174
|
type: "text",
|
|
181
175
|
onChange: this.onTextInputChange('sourceUrl'),
|
|
@@ -193,7 +187,8 @@ export var StimulusEditInfo = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
193
187
|
errorsShowing: PropTypes.bool.isRequired,
|
|
194
188
|
modifyStimulus: PropTypes.func.isRequired,
|
|
195
189
|
setTitleRef: PropTypes.func,
|
|
196
|
-
stimulusOrientationEnabled: PropTypes.bool.isRequired
|
|
190
|
+
stimulusOrientationEnabled: PropTypes.bool.isRequired,
|
|
191
|
+
styles: PropTypes.object
|
|
197
192
|
}, _class2.defaultProps = {
|
|
198
193
|
isBankedContent: false,
|
|
199
194
|
setTitleRef: function setTitleRef() {}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
2
|
+
return {
|
|
3
|
+
section: {
|
|
4
|
+
paddingBottom: componentTheme.sectionPadding
|
|
5
|
+
},
|
|
6
|
+
optionalLabel: {
|
|
7
|
+
color: componentTheme.optionalLabelColor,
|
|
8
|
+
fontSize: componentTheme.optionalLabelFontSize,
|
|
9
|
+
marginLeft: componentTheme.urlLabelMargin
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default generateStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var spacing = _ref.spacing,
|
|
3
3
|
typography = _ref.typography,
|
|
4
4
|
colors = _ref.colors;
|
|
@@ -8,4 +8,6 @@ export default function generator(_ref) {
|
|
|
8
8
|
optionalLabelFontSize: typography.fontSizeXSmall,
|
|
9
9
|
urlLabelMargin: spacing.xSmall
|
|
10
10
|
};
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default generateComponentTheme;
|
|
@@ -5,27 +5,21 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
|
|
6
6
|
var _dec, _class, _class2, _temp;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** @jsx jsx */
|
|
9
|
+
import { Component } from 'react';
|
|
9
10
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
11
|
+
import PropTypes from 'prop-types';
|
|
10
12
|
import { IconImageSolid } from '@instructure/ui-icons';
|
|
11
13
|
import { Text } from '@instructure/ui-text';
|
|
12
14
|
import { Img } from '@instructure/ui-img';
|
|
13
15
|
import { ToggleDetails } from '@instructure/ui-toggle-details';
|
|
14
|
-
import {
|
|
16
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
15
17
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
16
18
|
import { extractTextFromHtml } from '@instructure/quiz-interactions';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
template: function template(theme) {
|
|
20
|
-
return "\n\n.dlXUv_bEcb{margin-right:".concat(theme.answerMediaIconMargin || 'inherit', "}\n\n.dlXUv_cPVv>img{margin:").concat(theme.embeddedImageMargin || 'inherit', ";max-height:400px;max-width:400px;padding-right:").concat(theme.embeddedImagePadding || 'inherit', "}\n\n.dlXUv_cYzF{border-bottom:1px solid ").concat(theme.mediaToggleColor || 'inherit', ";border-left:1px solid ").concat(theme.mediaToggleColor || 'inherit', ";border-radius:5px;border-right:1px solid ").concat(theme.mediaToggleColor || 'inherit', ";margin:").concat(theme.mediaToggleMargin || 'inherit', ";text-align:left}\n\n[dir=ltr] .dlXUv_cYzF,[dir=rtl] .dlXUv_cYzF{text-align:left}");
|
|
21
|
-
},
|
|
22
|
-
'answerMediaIcon': 'dlXUv_bEcb',
|
|
23
|
-
'embeddedImage': 'dlXUv_cPVv',
|
|
24
|
-
'mediaToggle': 'dlXUv_cYzF'
|
|
25
|
-
};
|
|
26
|
-
import theme from "./theme.js";
|
|
19
|
+
import generateStyle from "./styles.js";
|
|
20
|
+
import generateComponentTheme from "./theme.js";
|
|
27
21
|
var imgRegex = /<img.*?src=['"](.+)['"]/g;
|
|
28
|
-
export var ResponseEvent = (_dec =
|
|
22
|
+
export var ResponseEvent = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
29
23
|
_inherits(ResponseEvent, _Component);
|
|
30
24
|
|
|
31
25
|
var _super = _createSuper(ResponseEvent);
|
|
@@ -58,8 +52,8 @@ export var ResponseEvent = (_dec = themeable(theme, styles), _dec(_class = (_tem
|
|
|
58
52
|
key: "renderTextSummary",
|
|
59
53
|
value: function renderTextSummary() {
|
|
60
54
|
var strippedItemBody = extractTextFromHtml(this.itemBody);
|
|
61
|
-
return
|
|
62
|
-
|
|
55
|
+
return jsx("span", null, this.hasMedia() && jsx(IconImageSolid, {
|
|
56
|
+
css: this.props.styles.answerMediaIcon
|
|
63
57
|
}), t('Answered question {position}: {question}', {
|
|
64
58
|
position: this.props.event.getIn(['eventData', 'position']),
|
|
65
59
|
question: strippedItemBody
|
|
@@ -68,6 +62,8 @@ export var ResponseEvent = (_dec = themeable(theme, styles), _dec(_class = (_tem
|
|
|
68
62
|
}, {
|
|
69
63
|
key: "renderMedia",
|
|
70
64
|
value: function renderMedia() {
|
|
65
|
+
var _this = this;
|
|
66
|
+
|
|
71
67
|
if (!this.hasMedia()) {
|
|
72
68
|
return;
|
|
73
69
|
}
|
|
@@ -75,15 +71,15 @@ export var ResponseEvent = (_dec = themeable(theme, styles), _dec(_class = (_tem
|
|
|
75
71
|
var mediaUrls = this.itemBody.match(imgRegex);
|
|
76
72
|
return mediaUrls.map(function (mediaUrl) {
|
|
77
73
|
var s3Url = mediaUrl.match(/src=['"](.+)['"]/)[1];
|
|
78
|
-
return
|
|
79
|
-
|
|
74
|
+
return jsx("div", {
|
|
75
|
+
css: _this.props.styles.mediaToggle,
|
|
80
76
|
key: s3Url
|
|
81
|
-
},
|
|
77
|
+
}, jsx(ToggleDetails, {
|
|
82
78
|
summary: t('Included Media'),
|
|
83
79
|
variant: "filled"
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
},
|
|
80
|
+
}, jsx("div", {
|
|
81
|
+
css: _this.props.styles.embeddedImage
|
|
82
|
+
}, jsx(Img, {
|
|
87
83
|
src: s3Url
|
|
88
84
|
}))));
|
|
89
85
|
});
|
|
@@ -95,11 +91,11 @@ export var ResponseEvent = (_dec = themeable(theme, styles), _dec(_class = (_tem
|
|
|
95
91
|
|
|
96
92
|
if (responseText) {
|
|
97
93
|
// If this returns falsey, then we know to just display the stem
|
|
98
|
-
return
|
|
94
|
+
return jsx(ToggleDetails, {
|
|
99
95
|
summary: this.renderTextSummary()
|
|
100
96
|
}, this.renderMedia(), responseText);
|
|
101
97
|
} else {
|
|
102
|
-
return
|
|
98
|
+
return jsx(Text, {
|
|
103
99
|
size: "small"
|
|
104
100
|
}, this.renderTextSummary(), this.renderMedia());
|
|
105
101
|
}
|
|
@@ -115,6 +111,7 @@ export var ResponseEvent = (_dec = themeable(theme, styles), _dec(_class = (_tem
|
|
|
115
111
|
return ResponseEvent;
|
|
116
112
|
}(Component), _class2.propTypes = {
|
|
117
113
|
event: ImmutablePropTypes.record.isRequired,
|
|
118
|
-
item: ImmutablePropTypes.record.isRequired
|
|
114
|
+
item: ImmutablePropTypes.record.isRequired,
|
|
115
|
+
styles: PropTypes.object
|
|
119
116
|
}, _temp)) || _class);
|
|
120
117
|
export default ResponseEvent;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
2
|
+
return {
|
|
3
|
+
answerMediaIcon: {
|
|
4
|
+
marginRight: componentTheme.answerMediaIconMargin
|
|
5
|
+
},
|
|
6
|
+
embeddedImage: {
|
|
7
|
+
'>img': {
|
|
8
|
+
maxHeight: '400px',
|
|
9
|
+
maxWidth: '400px',
|
|
10
|
+
margin: componentTheme.embeddedImageMargin,
|
|
11
|
+
paddingRight: componentTheme.embeddedImagePadding
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
mediaToggle: {
|
|
15
|
+
margin: componentTheme.mediaToggleMargin,
|
|
16
|
+
textAlign: 'left',
|
|
17
|
+
borderBottom: "1px solid ".concat(componentTheme.mediaToggleColor),
|
|
18
|
+
borderLeft: "1px solid ".concat(componentTheme.mediaToggleColor),
|
|
19
|
+
borderRight: "1px solid ".concat(componentTheme.mediaToggleColor),
|
|
20
|
+
borderRadius: '5px'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default generateStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var spacing = _ref.spacing,
|
|
3
3
|
colors = _ref.colors;
|
|
4
4
|
return {
|
|
@@ -8,4 +8,6 @@ export default function generator(_ref) {
|
|
|
8
8
|
mediaToggleMargin: spacing.xSmall,
|
|
9
9
|
mediaToggleColor: colors.tiara
|
|
10
10
|
};
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
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,7 +15,7 @@ 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
|
|
|
@@ -27,25 +25,17 @@ var _uiButtons = require("@instructure/ui-buttons");
|
|
|
27
25
|
|
|
28
26
|
var _uiText = require("@instructure/ui-text");
|
|
29
27
|
|
|
30
|
-
var
|
|
28
|
+
var _emotion = require("@instructure/emotion");
|
|
31
29
|
|
|
32
30
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
33
31
|
|
|
32
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
33
|
+
|
|
34
34
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
35
35
|
|
|
36
36
|
var _dec, _class, _class2, _temp;
|
|
37
37
|
|
|
38
|
-
var
|
|
39
|
-
componentId: 'epout',
|
|
40
|
-
template: function template(theme) {
|
|
41
|
-
return "\n\n.epout_bgqc{padding-bottom:".concat(theme.alertPadding || 'inherit', ";position:inherit;z-index:").concat(theme.alertZIndex || 'inherit', "}\n\n.epout_etBv{display:block}\n\n.epout_crZr{padding:").concat(theme.containerPadding || 'inherit', ";position:relative}\n\n.epout_oqJC{background-color:").concat(theme.disabledChildrenBackgroundColor || 'inherit', ";bottom:0;left:0;opacity:").concat(theme.disabledChildrenOpacity || 'inherit', ";position:absolute;right:0;top:0;z-index:").concat(theme.disabledChildrenZIndex || 'inherit', "}");
|
|
42
|
-
},
|
|
43
|
-
'alert': 'epout_bgqc',
|
|
44
|
-
'alertContent': 'epout_etBv',
|
|
45
|
-
'container': 'epout_crZr',
|
|
46
|
-
'disabledChildren': 'epout_oqJC'
|
|
47
|
-
};
|
|
48
|
-
var WarningWrapper = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
38
|
+
var WarningWrapper = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
49
39
|
(0, _inherits2.default)(WarningWrapper, _Component);
|
|
50
40
|
|
|
51
41
|
var _super = (0, _createSuper2.default)(WarningWrapper);
|
|
@@ -84,13 +74,11 @@ var WarningWrapper = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles)
|
|
|
84
74
|
key: "renderActionButtons",
|
|
85
75
|
value: function renderActionButtons() {
|
|
86
76
|
if (this.props.hideActions) return;
|
|
87
|
-
return
|
|
88
|
-
className: styles.alertContentRow
|
|
89
|
-
}, /*#__PURE__*/_react.default.createElement(_uiButtons.Button, {
|
|
77
|
+
return (0, _emotion.jsx)("div", null, (0, _emotion.jsx)(_uiButtons.Button, {
|
|
90
78
|
size: "small",
|
|
91
79
|
onClick: this.props.cancelActionCallback,
|
|
92
80
|
ref: this.setFocusRef
|
|
93
|
-
}, this.props.cancelActionText),
|
|
81
|
+
}, this.props.cancelActionText), (0, _emotion.jsx)(_uiButtons.Button, {
|
|
94
82
|
size: "small",
|
|
95
83
|
margin: "x-small",
|
|
96
84
|
color: "primary",
|
|
@@ -100,25 +88,23 @@ var WarningWrapper = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles)
|
|
|
100
88
|
}, {
|
|
101
89
|
key: "renderDescription",
|
|
102
90
|
value: function renderDescription() {
|
|
103
|
-
return
|
|
104
|
-
className: styles.alertContentRow
|
|
105
|
-
}, /*#__PURE__*/_react.default.createElement(_uiText.Text, {
|
|
91
|
+
return (0, _emotion.jsx)("div", null, (0, _emotion.jsx)(_uiText.Text, {
|
|
106
92
|
color: "primary"
|
|
107
93
|
}, this.props.description));
|
|
108
94
|
}
|
|
109
95
|
}, {
|
|
110
96
|
key: "renderAlertContent",
|
|
111
97
|
value: function renderAlertContent() {
|
|
112
|
-
return
|
|
113
|
-
|
|
98
|
+
return (0, _emotion.jsx)("div", {
|
|
99
|
+
css: this.props.styles.alertContent
|
|
114
100
|
}, this.renderDescription(), this.renderActionButtons());
|
|
115
101
|
}
|
|
116
102
|
}, {
|
|
117
103
|
key: "renderAlert",
|
|
118
104
|
value: function renderAlert() {
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
},
|
|
105
|
+
return (0, _emotion.jsx)("div", {
|
|
106
|
+
css: this.props.styles.alert
|
|
107
|
+
}, (0, _emotion.jsx)(_uiAlerts.Alert, {
|
|
122
108
|
variant: this.props.alertType
|
|
123
109
|
}, this.renderAlertContent()));
|
|
124
110
|
}
|
|
@@ -126,15 +112,16 @@ var WarningWrapper = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles)
|
|
|
126
112
|
key: "renderDisableOverlay",
|
|
127
113
|
value: function renderDisableOverlay() {
|
|
128
114
|
if (!this.props.disableChildren) return;
|
|
129
|
-
return
|
|
130
|
-
|
|
115
|
+
return (0, _emotion.jsx)("div", {
|
|
116
|
+
css: this.props.styles.disabledChildren,
|
|
117
|
+
"data-testid": "disabled-children"
|
|
131
118
|
});
|
|
132
119
|
}
|
|
133
120
|
}, {
|
|
134
121
|
key: "render",
|
|
135
122
|
value: function render() {
|
|
136
|
-
return
|
|
137
|
-
|
|
123
|
+
return (0, _emotion.jsx)("div", {
|
|
124
|
+
css: this.props.styles.container
|
|
138
125
|
}, this.renderMessage(), this.renderDisableOverlay(), this.props.children);
|
|
139
126
|
}
|
|
140
127
|
}]);
|
|
@@ -150,7 +137,8 @@ var WarningWrapper = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles)
|
|
|
150
137
|
description: _propTypes.default.node,
|
|
151
138
|
disableChildren: _propTypes.default.bool,
|
|
152
139
|
hideActions: _propTypes.default.bool,
|
|
153
|
-
showAlert: _propTypes.default.bool
|
|
140
|
+
showAlert: _propTypes.default.bool,
|
|
141
|
+
styles: _propTypes.default.object
|
|
154
142
|
}, _class2.defaultProps = {
|
|
155
143
|
alertType: 'info',
|
|
156
144
|
cancelActionCallback: void 0,
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
alert: {
|
|
11
|
+
paddingBottom: componentTheme.alertPadding,
|
|
12
|
+
zIndex: componentTheme.alertZIndex,
|
|
13
|
+
position: 'inherit'
|
|
14
|
+
},
|
|
15
|
+
alertContent: {
|
|
16
|
+
display: 'block'
|
|
17
|
+
},
|
|
18
|
+
container: {
|
|
19
|
+
position: 'relative',
|
|
20
|
+
padding: componentTheme.containerPadding
|
|
21
|
+
},
|
|
22
|
+
disabledChildren: {
|
|
23
|
+
backgroundColor: componentTheme.disabledChildrenBackgroundColor,
|
|
24
|
+
opacity: componentTheme.disabledChildrenOpacity,
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
zIndex: componentTheme.disabledChildrenZIndex,
|
|
27
|
+
top: '0',
|
|
28
|
+
bottom: '0',
|
|
29
|
+
left: '0',
|
|
30
|
+
right: '0'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var _default = generateStyle;
|
|
36
|
+
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
|
typography = _ref.typography,
|
|
11
11
|
colors = _ref.colors;
|
|
@@ -17,4 +17,7 @@ function generator(_ref) {
|
|
|
17
17
|
disabledChildrenOpacity: '0.6',
|
|
18
18
|
disabledChildrenZIndex: '7777'
|
|
19
19
|
};
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var _default = generateComponentTheme;
|
|
23
|
+
exports.default = _default;
|
|
@@ -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,7 +15,7 @@ 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
|
|
|
@@ -29,7 +27,7 @@ var _uiTextInput = require("@instructure/ui-text-input");
|
|
|
29
27
|
|
|
30
28
|
var _uiFormField = require("@instructure/ui-form-field");
|
|
31
29
|
|
|
32
|
-
var
|
|
30
|
+
var _emotion = require("@instructure/emotion");
|
|
33
31
|
|
|
34
32
|
var _uiHeading = require("@instructure/ui-heading");
|
|
35
33
|
|
|
@@ -47,26 +45,19 @@ var _quizCommon = require("@instructure/quiz-common");
|
|
|
47
45
|
|
|
48
46
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
49
47
|
|
|
48
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
49
|
+
|
|
50
50
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
51
51
|
|
|
52
52
|
var _dec, _class, _class2, _temp;
|
|
53
53
|
|
|
54
|
-
var
|
|
55
|
-
componentId: 'doNBF',
|
|
56
|
-
template: function template(theme) {
|
|
57
|
-
return "\n\n.doNBF_daCg{padding-bottom:".concat(theme.sectionPadding || 'inherit', "}\n\n.doNBF_fvFs{color:").concat(theme.optionalLabelColor || 'inherit', ";font-size:").concat(theme.optionalLabelFontSize || 'inherit', ";margin-left:").concat(theme.urlLabelMargin || 'inherit', "}");
|
|
58
|
-
},
|
|
59
|
-
'section': 'doNBF_daCg',
|
|
60
|
-
'optionalLabel': 'doNBF_fvFs'
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
var _ref3 = /*#__PURE__*/_react.default.createElement(_uiIcons.IconUpdownLine, {
|
|
54
|
+
var _ref3 = (0, _emotion.jsx)(_uiIcons.IconUpdownLine, {
|
|
64
55
|
rotate: "90"
|
|
65
56
|
});
|
|
66
57
|
|
|
67
|
-
var _ref4 =
|
|
58
|
+
var _ref4 = (0, _emotion.jsx)(_uiIcons.IconUpdownLine, null);
|
|
68
59
|
|
|
69
|
-
var StimulusEditInfo = (_dec = (0,
|
|
60
|
+
var StimulusEditInfo = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
70
61
|
(0, _inherits2.default)(StimulusEditInfo, _Component);
|
|
71
62
|
|
|
72
63
|
var _super = (0, _createSuper2.default)(StimulusEditInfo);
|
|
@@ -125,28 +116,28 @@ var StimulusEditInfo = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
|
|
|
125
116
|
key: "renderOptionalLabel",
|
|
126
117
|
value: function renderOptionalLabel(labelName) {
|
|
127
118
|
var optionalText = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (0, _formatMessage.default)('(optional)');
|
|
128
|
-
return
|
|
129
|
-
|
|
119
|
+
return (0, _emotion.jsx)("div", null, (0, _emotion.jsx)("span", null, labelName), (0, _emotion.jsx)("span", {
|
|
120
|
+
css: this.props.styles.optionalLabel
|
|
130
121
|
}, optionalText));
|
|
131
122
|
}
|
|
132
123
|
}, {
|
|
133
124
|
key: "renderStimulusOrientationSelect",
|
|
134
125
|
value: function renderStimulusOrientationSelect() {
|
|
135
126
|
var stimulusOrientation = this.props.workingStimulus.get('orientation');
|
|
136
|
-
return
|
|
137
|
-
|
|
138
|
-
},
|
|
127
|
+
return (0, _emotion.jsx)("div", {
|
|
128
|
+
css: this.props.styles.section
|
|
129
|
+
}, (0, _emotion.jsx)(_uiSimpleSelect.SimpleSelect, {
|
|
139
130
|
renderLabel: (0, _formatMessage.default)('Orientation'),
|
|
140
131
|
onChange: this.onOrientationChange,
|
|
141
132
|
value: stimulusOrientation,
|
|
142
|
-
renderBeforeInput:
|
|
133
|
+
renderBeforeInput: (0, _emotion.jsx)(_uiIcons.IconUpdownLine, {
|
|
143
134
|
rotate: stimulusOrientation === _quizCommon.TOP ? '0' : '90'
|
|
144
135
|
})
|
|
145
|
-
},
|
|
136
|
+
}, (0, _emotion.jsx)(_uiSimpleSelect.SimpleSelect.Option, {
|
|
146
137
|
renderBeforeLabel: _ref3,
|
|
147
138
|
id: "stimulus-orientation-select-option-left",
|
|
148
139
|
value: "left"
|
|
149
|
-
}, (0, _formatMessage.default)('Questions to the right')),
|
|
140
|
+
}, (0, _formatMessage.default)('Questions to the right')), (0, _emotion.jsx)(_uiSimpleSelect.SimpleSelect.Option, {
|
|
150
141
|
renderBeforeLabel: _ref4,
|
|
151
142
|
id: "stimulus-orientation-select-option-top",
|
|
152
143
|
value: "top"
|
|
@@ -158,35 +149,35 @@ var StimulusEditInfo = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
|
|
|
158
149
|
var stimulus = this.props.workingStimulus;
|
|
159
150
|
var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
|
|
160
151
|
var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
|
|
161
|
-
return
|
|
152
|
+
return (0, _emotion.jsx)(_uiFormField.FormFieldGroup, {
|
|
162
153
|
messages: this.inputErrors('onSelf'),
|
|
163
|
-
description:
|
|
164
|
-
},
|
|
154
|
+
description: (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage.default)('Edit Stimulus'))
|
|
155
|
+
}, (0, _emotion.jsx)(_uiHeading.Heading, {
|
|
165
156
|
level: "h3",
|
|
166
157
|
as: "h2"
|
|
167
|
-
}, this.headerText()),
|
|
168
|
-
|
|
169
|
-
},
|
|
158
|
+
}, this.headerText()), (0, _emotion.jsx)("div", {
|
|
159
|
+
css: this.props.styles.section
|
|
160
|
+
}, (0, _emotion.jsx)(_uiTextInput.TextInput, {
|
|
170
161
|
messages: this.inputErrors('title'),
|
|
171
162
|
renderLabel: (0, _formatMessage.default)('Title'),
|
|
172
163
|
type: "text",
|
|
173
164
|
ref: this.props.setTitleRef,
|
|
174
165
|
onChange: this.onTextInputChange('title'),
|
|
175
166
|
value: stimulus.get('title')
|
|
176
|
-
})),
|
|
177
|
-
|
|
178
|
-
},
|
|
167
|
+
})), (0, _emotion.jsx)("div", {
|
|
168
|
+
css: this.props.styles.section
|
|
169
|
+
}, (0, _emotion.jsx)(_uiTextInput.TextInput, {
|
|
179
170
|
renderLabel: this.renderOptionalLabel((0, _formatMessage.default)('Instructions')),
|
|
180
171
|
type: "text",
|
|
181
172
|
onChange: this.onTextInputChange('instructions'),
|
|
182
173
|
value: stimulus.get('instructions')
|
|
183
|
-
})),
|
|
184
|
-
|
|
185
|
-
},
|
|
174
|
+
})), (0, _emotion.jsx)("div", {
|
|
175
|
+
css: this.props.styles.section
|
|
176
|
+
}, (0, _emotion.jsx)(_uiFormField.FormField, {
|
|
186
177
|
id: stimulusBodyId,
|
|
187
178
|
label: (0, _formatMessage.default)('Content'),
|
|
188
179
|
messages: this.inputErrors('body')
|
|
189
|
-
},
|
|
180
|
+
}, (0, _emotion.jsx)(_quizRce.RichContentInput, {
|
|
190
181
|
actsAsInput: true,
|
|
191
182
|
label: "",
|
|
192
183
|
placeholder: (0, _formatMessage.default)('Add Stimulus Content...'),
|
|
@@ -196,16 +187,16 @@ var StimulusEditInfo = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
|
|
|
196
187
|
onBlur: this.onBodyChange,
|
|
197
188
|
onChange: this.onBodyChange,
|
|
198
189
|
height: _quizRce.RCE_SINGLE_LINE_HEIGHT
|
|
199
|
-
}))),
|
|
200
|
-
|
|
201
|
-
},
|
|
190
|
+
}))), (0, _emotion.jsx)("div", {
|
|
191
|
+
css: this.props.styles.section
|
|
192
|
+
}, (0, _emotion.jsx)(_uiToggleDetails.ToggleDetails, {
|
|
202
193
|
defaultExpanded: true,
|
|
203
194
|
variant: "filled",
|
|
204
195
|
key: "options",
|
|
205
196
|
summary: (0, _formatMessage.default)('Options')
|
|
206
|
-
}, this.props.stimulusOrientationEnabled ? this.renderStimulusOrientationSelect() : null,
|
|
207
|
-
|
|
208
|
-
},
|
|
197
|
+
}, this.props.stimulusOrientationEnabled ? this.renderStimulusOrientationSelect() : null, (0, _emotion.jsx)("div", {
|
|
198
|
+
css: this.props.styles.section
|
|
199
|
+
}, (0, _emotion.jsx)(_uiTextInput.TextInput, {
|
|
209
200
|
renderLabel: this.renderOptionalLabel((0, _formatMessage.default)('Source URL'), (0, _formatMessage.default)('(optional - not visible to students)')),
|
|
210
201
|
type: "text",
|
|
211
202
|
onChange: this.onTextInputChange('sourceUrl'),
|
|
@@ -222,7 +213,8 @@ var StimulusEditInfo = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
|
|
|
222
213
|
errorsShowing: _propTypes.default.bool.isRequired,
|
|
223
214
|
modifyStimulus: _propTypes.default.func.isRequired,
|
|
224
215
|
setTitleRef: _propTypes.default.func,
|
|
225
|
-
stimulusOrientationEnabled: _propTypes.default.bool.isRequired
|
|
216
|
+
stimulusOrientationEnabled: _propTypes.default.bool.isRequired,
|
|
217
|
+
styles: _propTypes.default.object
|
|
226
218
|
}, _class2.defaultProps = {
|
|
227
219
|
isBankedContent: false,
|
|
228
220
|
setTitleRef: function setTitleRef() {}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
section: {
|
|
11
|
+
paddingBottom: componentTheme.sectionPadding
|
|
12
|
+
},
|
|
13
|
+
optionalLabel: {
|
|
14
|
+
color: componentTheme.optionalLabelColor,
|
|
15
|
+
fontSize: componentTheme.optionalLabelFontSize,
|
|
16
|
+
marginLeft: componentTheme.urlLabelMargin
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var _default = generateStyle;
|
|
22
|
+
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
|
typography = _ref.typography,
|
|
11
11
|
colors = _ref.colors;
|
|
@@ -15,4 +15,7 @@ function generator(_ref) {
|
|
|
15
15
|
optionalLabelFontSize: typography.fontSizeXSmall,
|
|
16
16
|
urlLabelMargin: spacing.xSmall
|
|
17
17
|
};
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
var _default = generateComponentTheme;
|
|
21
|
+
exports.default = _default;
|
|
@@ -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,10 +15,12 @@ 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 _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));
|
|
23
21
|
|
|
22
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
+
|
|
24
24
|
var _uiIcons = require("@instructure/ui-icons");
|
|
25
25
|
|
|
26
26
|
var _uiText = require("@instructure/ui-text");
|
|
@@ -29,27 +29,20 @@ var _uiImg = require("@instructure/ui-img");
|
|
|
29
29
|
|
|
30
30
|
var _uiToggleDetails = require("@instructure/ui-toggle-details");
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _emotion = require("@instructure/emotion");
|
|
33
33
|
|
|
34
34
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
35
35
|
|
|
36
36
|
var _quizInteractions = require("@instructure/quiz-interactions");
|
|
37
37
|
|
|
38
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
39
|
+
|
|
38
40
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
39
41
|
|
|
40
42
|
var _dec, _class, _class2, _temp;
|
|
41
43
|
|
|
42
|
-
var styles = {
|
|
43
|
-
componentId: 'dlXUv',
|
|
44
|
-
template: function template(theme) {
|
|
45
|
-
return "\n\n.dlXUv_bEcb{margin-right:".concat(theme.answerMediaIconMargin || 'inherit', "}\n\n.dlXUv_cPVv>img{margin:").concat(theme.embeddedImageMargin || 'inherit', ";max-height:400px;max-width:400px;padding-right:").concat(theme.embeddedImagePadding || 'inherit', "}\n\n.dlXUv_cYzF{border-bottom:1px solid ").concat(theme.mediaToggleColor || 'inherit', ";border-left:1px solid ").concat(theme.mediaToggleColor || 'inherit', ";border-radius:5px;border-right:1px solid ").concat(theme.mediaToggleColor || 'inherit', ";margin:").concat(theme.mediaToggleMargin || 'inherit', ";text-align:left}\n\n[dir=ltr] .dlXUv_cYzF,[dir=rtl] .dlXUv_cYzF{text-align:left}");
|
|
46
|
-
},
|
|
47
|
-
'answerMediaIcon': 'dlXUv_bEcb',
|
|
48
|
-
'embeddedImage': 'dlXUv_cPVv',
|
|
49
|
-
'mediaToggle': 'dlXUv_cYzF'
|
|
50
|
-
};
|
|
51
44
|
var imgRegex = /<img.*?src=['"](.+)['"]/g;
|
|
52
|
-
var ResponseEvent = (_dec = (0,
|
|
45
|
+
var ResponseEvent = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
53
46
|
(0, _inherits2.default)(ResponseEvent, _Component);
|
|
54
47
|
|
|
55
48
|
var _super = (0, _createSuper2.default)(ResponseEvent);
|
|
@@ -81,8 +74,8 @@ var ResponseEvent = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
81
74
|
key: "renderTextSummary",
|
|
82
75
|
value: function renderTextSummary() {
|
|
83
76
|
var strippedItemBody = (0, _quizInteractions.extractTextFromHtml)(this.itemBody);
|
|
84
|
-
return
|
|
85
|
-
|
|
77
|
+
return (0, _emotion.jsx)("span", null, this.hasMedia() && (0, _emotion.jsx)(_uiIcons.IconImageSolid, {
|
|
78
|
+
css: this.props.styles.answerMediaIcon
|
|
86
79
|
}), (0, _formatMessage.default)('Answered question {position}: {question}', {
|
|
87
80
|
position: this.props.event.getIn(['eventData', 'position']),
|
|
88
81
|
question: strippedItemBody
|
|
@@ -91,6 +84,8 @@ var ResponseEvent = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
91
84
|
}, {
|
|
92
85
|
key: "renderMedia",
|
|
93
86
|
value: function renderMedia() {
|
|
87
|
+
var _this = this;
|
|
88
|
+
|
|
94
89
|
if (!this.hasMedia()) {
|
|
95
90
|
return;
|
|
96
91
|
}
|
|
@@ -98,15 +93,15 @@ var ResponseEvent = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
98
93
|
var mediaUrls = this.itemBody.match(imgRegex);
|
|
99
94
|
return mediaUrls.map(function (mediaUrl) {
|
|
100
95
|
var s3Url = mediaUrl.match(/src=['"](.+)['"]/)[1];
|
|
101
|
-
return
|
|
102
|
-
|
|
96
|
+
return (0, _emotion.jsx)("div", {
|
|
97
|
+
css: _this.props.styles.mediaToggle,
|
|
103
98
|
key: s3Url
|
|
104
|
-
},
|
|
99
|
+
}, (0, _emotion.jsx)(_uiToggleDetails.ToggleDetails, {
|
|
105
100
|
summary: (0, _formatMessage.default)('Included Media'),
|
|
106
101
|
variant: "filled"
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
},
|
|
102
|
+
}, (0, _emotion.jsx)("div", {
|
|
103
|
+
css: _this.props.styles.embeddedImage
|
|
104
|
+
}, (0, _emotion.jsx)(_uiImg.Img, {
|
|
110
105
|
src: s3Url
|
|
111
106
|
}))));
|
|
112
107
|
});
|
|
@@ -118,11 +113,11 @@ var ResponseEvent = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
118
113
|
|
|
119
114
|
if (responseText) {
|
|
120
115
|
// If this returns falsey, then we know to just display the stem
|
|
121
|
-
return
|
|
116
|
+
return (0, _emotion.jsx)(_uiToggleDetails.ToggleDetails, {
|
|
122
117
|
summary: this.renderTextSummary()
|
|
123
118
|
}, this.renderMedia(), responseText);
|
|
124
119
|
} else {
|
|
125
|
-
return
|
|
120
|
+
return (0, _emotion.jsx)(_uiText.Text, {
|
|
126
121
|
size: "small"
|
|
127
122
|
}, this.renderTextSummary(), this.renderMedia());
|
|
128
123
|
}
|
|
@@ -137,7 +132,8 @@ var ResponseEvent = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
137
132
|
return ResponseEvent;
|
|
138
133
|
}(_react.Component), _class2.propTypes = {
|
|
139
134
|
event: _reactImmutableProptypes.default.record.isRequired,
|
|
140
|
-
item: _reactImmutableProptypes.default.record.isRequired
|
|
135
|
+
item: _reactImmutableProptypes.default.record.isRequired,
|
|
136
|
+
styles: _propTypes.default.object
|
|
141
137
|
}, _temp)) || _class);
|
|
142
138
|
exports.ResponseEvent = ResponseEvent;
|
|
143
139
|
var _default = ResponseEvent;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
answerMediaIcon: {
|
|
11
|
+
marginRight: componentTheme.answerMediaIconMargin
|
|
12
|
+
},
|
|
13
|
+
embeddedImage: {
|
|
14
|
+
'>img': {
|
|
15
|
+
maxHeight: '400px',
|
|
16
|
+
maxWidth: '400px',
|
|
17
|
+
margin: componentTheme.embeddedImageMargin,
|
|
18
|
+
paddingRight: componentTheme.embeddedImagePadding
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
mediaToggle: {
|
|
22
|
+
margin: componentTheme.mediaToggleMargin,
|
|
23
|
+
textAlign: 'left',
|
|
24
|
+
borderBottom: "1px solid ".concat(componentTheme.mediaToggleColor),
|
|
25
|
+
borderLeft: "1px solid ".concat(componentTheme.mediaToggleColor),
|
|
26
|
+
borderRight: "1px solid ".concat(componentTheme.mediaToggleColor),
|
|
27
|
+
borderRadius: '5px'
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var _default = generateStyle;
|
|
33
|
+
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
|
colors = _ref.colors;
|
|
11
11
|
return {
|
|
@@ -15,4 +15,7 @@ function generator(_ref) {
|
|
|
15
15
|
mediaToggleMargin: spacing.xSmall,
|
|
16
16
|
mediaToggleColor: colors.tiara
|
|
17
17
|
};
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
var _default = generateComponentTheme;
|
|
21
|
+
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "20.11.
|
|
3
|
+
"version": "20.11.2-rc.0+51ecaccdf",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@instructure/emotion": "^8.51.0",
|
|
45
45
|
"@instructure/grading-utils": "^1.0.0",
|
|
46
46
|
"@instructure/outcomes-ui": "^3.2.0",
|
|
47
|
-
"@instructure/quiz-common": "
|
|
48
|
-
"@instructure/quiz-i18n": "
|
|
49
|
-
"@instructure/quiz-interactions": "
|
|
50
|
-
"@instructure/quiz-number-input": "
|
|
51
|
-
"@instructure/quiz-rce": "
|
|
47
|
+
"@instructure/quiz-common": "20.11.2-rc.0+51ecaccdf",
|
|
48
|
+
"@instructure/quiz-i18n": "20.11.2-rc.0+51ecaccdf",
|
|
49
|
+
"@instructure/quiz-interactions": "20.11.2-rc.0+51ecaccdf",
|
|
50
|
+
"@instructure/quiz-number-input": "20.11.2-rc.0+51ecaccdf",
|
|
51
|
+
"@instructure/quiz-rce": "20.11.2-rc.0+51ecaccdf",
|
|
52
52
|
"@instructure/ui-a11y-content": "^8.51.0",
|
|
53
53
|
"@instructure/ui-alerts": "^8.51.0",
|
|
54
54
|
"@instructure/ui-avatar": "^8.51.0",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"file-saver": "~2.0.5",
|
|
113
113
|
"humps": "^2.0.0",
|
|
114
114
|
"immutable": "^3.8.1",
|
|
115
|
-
"instructure-validations": "
|
|
115
|
+
"instructure-validations": "20.11.2-rc.0+51ecaccdf",
|
|
116
116
|
"ipaddr.js": "^1.5.4",
|
|
117
117
|
"isomorphic-fetch": "^2.2.0",
|
|
118
118
|
"isuuid": "^0.1.0",
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"uuid": "^3.2.1"
|
|
144
144
|
},
|
|
145
145
|
"devDependencies": {
|
|
146
|
-
"@instructure/quiz-scripts": "
|
|
146
|
+
"@instructure/quiz-scripts": "20.11.1",
|
|
147
147
|
"@instructure/ui-axe-check": "^8.51.0",
|
|
148
148
|
"@instructure/ui-babel-preset": "^7.22.1",
|
|
149
149
|
"@instructure/ui-karma-config": "^7.22.1",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"intl": "^1.2.4",
|
|
164
164
|
"jquery": "^2.2.3",
|
|
165
165
|
"most-subject": "^5.3.0",
|
|
166
|
-
"quiz-presets": "
|
|
166
|
+
"quiz-presets": "20.11.2-rc.0+51ecaccdf",
|
|
167
167
|
"react": "^16.8.6",
|
|
168
168
|
"react-addons-test-utils": "^15.6.2",
|
|
169
169
|
"react-dom": "^16.8.6",
|
|
@@ -179,5 +179,5 @@
|
|
|
179
179
|
"publishConfig": {
|
|
180
180
|
"access": "public"
|
|
181
181
|
},
|
|
182
|
-
"gitHead": "
|
|
182
|
+
"gitHead": "51ecaccdfac271d22bb45c11518dc958a61cca1e"
|
|
183
183
|
}
|