@pie-element/explicit-constructed-response 9.3.4-next.3 → 10.0.0-beta.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.
Files changed (47) hide show
  1. package/configure/lib/alternateResponses.js +139 -184
  2. package/configure/lib/alternateResponses.js.map +1 -1
  3. package/configure/lib/alternateSection.js +272 -369
  4. package/configure/lib/alternateSection.js.map +1 -1
  5. package/configure/lib/defaults.js +2 -3
  6. package/configure/lib/defaults.js.map +1 -1
  7. package/configure/lib/ecr-toolbar.js +124 -186
  8. package/configure/lib/ecr-toolbar.js.map +1 -1
  9. package/configure/lib/index.js +126 -203
  10. package/configure/lib/index.js.map +1 -1
  11. package/configure/lib/main.js +434 -550
  12. package/configure/lib/main.js.map +1 -1
  13. package/configure/lib/markupUtils.js +26 -49
  14. package/configure/lib/markupUtils.js.map +1 -1
  15. package/configure/lib/utils.js +5 -5
  16. package/configure/lib/utils.js.map +1 -1
  17. package/configure/package.json +9 -7
  18. package/controller/lib/defaults.js +2 -3
  19. package/controller/lib/defaults.js.map +1 -1
  20. package/controller/lib/index.js +169 -260
  21. package/controller/lib/index.js.map +1 -1
  22. package/controller/package.json +3 -3
  23. package/lib/index.js +71 -115
  24. package/lib/index.js.map +1 -1
  25. package/lib/main.js +174 -248
  26. package/lib/main.js.map +1 -1
  27. package/lib/print.js +39 -83
  28. package/lib/print.js.map +1 -1
  29. package/package.json +14 -19
  30. package/esm/configure.js +0 -33096
  31. package/esm/configure.js.map +0 -1
  32. package/esm/controller.js +0 -5144
  33. package/esm/controller.js.map +0 -1
  34. package/esm/element.js +0 -11518
  35. package/esm/element.js.map +0 -1
  36. package/esm/package.json +0 -3
  37. package/esm/print.js +0 -12202
  38. package/esm/print.js.map +0 -1
  39. package/module/configure.js +0 -1
  40. package/module/controller.js +0 -7460
  41. package/module/demo.js +0 -45
  42. package/module/element.js +0 -1
  43. package/module/index.html +0 -21
  44. package/module/manifest.json +0 -22
  45. package/module/print-demo.js +0 -83
  46. package/module/print.html +0 -18
  47. package/module/print.js +0 -1
package/lib/main.js CHANGED
@@ -1,281 +1,207 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports["default"] = exports.Main = void 0;
9
-
7
+ exports.default = exports.Main = void 0;
10
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
10
  var _react = _interopRequireDefault(require("react"));
27
-
28
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
29
-
30
12
  var _debounce = _interopRequireDefault(require("lodash/debounce"));
31
-
32
13
  var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
33
-
34
14
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
35
-
36
15
  var _correctAnswerToggle = _interopRequireDefault(require("@pie-lib/correct-answer-toggle"));
37
-
38
16
  var _maskMarkup = require("@pie-lib/mask-markup");
39
-
40
17
  var _renderUi = require("@pie-lib/render-ui");
41
-
42
- var _styles = require("@material-ui/core/styles");
43
-
44
- var _classnames = _interopRequireDefault(require("classnames"));
45
-
18
+ var _styles = require("@mui/material/styles");
46
19
  var _translator = _interopRequireDefault(require("@pie-lib/translator"));
47
-
48
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
49
-
50
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
51
-
52
- var translator = _translator["default"].translator;
53
-
54
- var Main = /*#__PURE__*/function (_React$Component) {
55
- (0, _inherits2["default"])(Main, _React$Component);
56
-
57
- var _super = _createSuper(Main);
58
-
59
- function Main() {
60
- var _this;
61
-
62
- (0, _classCallCheck2["default"])(this, Main);
63
-
64
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
65
- args[_key] = arguments[_key];
20
+ const {
21
+ translator
22
+ } = _translator.default;
23
+ const MainContainer = (0, _styles.styled)(_renderUi.UiLayout)(({
24
+ alwaysShowCorrect
25
+ }) => ({
26
+ color: _renderUi.color.text(),
27
+ backgroundColor: _renderUi.color.background(),
28
+ ...(alwaysShowCorrect && {
29
+ '& *': {
30
+ borderColor: `${_renderUi.color.text()} !important`
66
31
  }
67
-
68
- _this = _super.call.apply(_super, [this].concat(args));
69
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
70
- showCorrectAnswer: _this.props.alwaysShowCorrect || false
71
- });
72
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getChangeSession", function (maxLengthPerChoice) {
73
- return maxLengthPerChoice && maxLengthPerChoice.every(function (val, i, arr) {
74
- return val === arr[0] && val === 1;
75
- }) ? _this.props.onChange : (0, _debounce["default"])(_this.props.onChange, 200, {
76
- maxWait: 200
77
- });
32
+ })
33
+ }));
34
+ const NoteContainer = (0, _styles.styled)('div')(({
35
+ theme
36
+ }) => ({
37
+ marginBottom: theme.spacing(2)
38
+ }));
39
+ const CollapsibleContainer = (0, _styles.styled)('div')(({
40
+ theme
41
+ }) => ({
42
+ marginBottom: theme.spacing(2)
43
+ }));
44
+ const SrOnly = (0, _styles.styled)('h2')({
45
+ position: 'absolute',
46
+ left: '-10000px',
47
+ top: 'auto',
48
+ width: '1px',
49
+ height: '1px',
50
+ overflow: 'hidden'
51
+ });
52
+ class Main extends _react.default.Component {
53
+ constructor(...args) {
54
+ super(...args);
55
+ (0, _defineProperty2.default)(this, "state", {
56
+ showCorrectAnswer: this.props.alwaysShowCorrect || false
78
57
  });
79
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toggleShowCorrect", function () {
80
- _this.setState({
81
- showCorrectAnswer: !_this.state.showCorrectAnswer
58
+ // if for all responses max length is 1, call onChange for each keystroke
59
+ (0, _defineProperty2.default)(this, "getChangeSession", maxLengthPerChoice => maxLengthPerChoice && maxLengthPerChoice.every((val, _i, arr) => val === arr[0] && val === 1) ? this.props.onChange : (0, _debounce.default)(this.props.onChange, 200, {
60
+ maxWait: 200
61
+ }));
62
+ (0, _defineProperty2.default)(this, "toggleShowCorrect", () => {
63
+ this.setState({
64
+ showCorrectAnswer: !this.state.showCorrectAnswer
82
65
  });
83
66
  });
84
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeSession", _this.getChangeSession(_this.props.maxLengthPerChoice));
85
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (value) {
86
- _this.changeSession(value);
67
+ (0, _defineProperty2.default)(this, "changeSession", this.getChangeSession(this.props.maxLengthPerChoice));
68
+ (0, _defineProperty2.default)(this, "onChange", value => {
69
+ this.changeSession(value);
87
70
  });
88
- return _this;
89
71
  }
90
-
91
- (0, _createClass2["default"])(Main, [{
92
- key: "UNSAFE_componentWillReceiveProps",
93
- value: function UNSAFE_componentWillReceiveProps(nextProps) {
94
- var _this$props = this.props,
95
- maxLengthPerChoice = _this$props.maxLengthPerChoice,
96
- language = _this$props.language;
97
- var note = this.props.note;
98
-
99
- if ((0, _isEmpty["default"])(nextProps.feedback)) {
100
- this.setState({
101
- showCorrectAnswer: false
102
- });
103
- }
104
-
105
- if (nextProps.alwaysShowCorrect) {
106
- this.setState({
107
- showCorrectAnswer: true
108
- });
109
- }
110
-
111
- if (maxLengthPerChoice && !(0, _isEqual["default"])(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {
112
- this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);
113
- } // check if the note is the default one for prev language and change to the default one for new language
114
- // this check is necessary in order to diferanciate between default and authour defined note
115
- // and only change between languages for default ones
116
-
117
-
118
- if (note && language && language !== nextProps.language && note === translator.t('common:commonCorrectAnswerWithAlternates', {
119
- lng: language
120
- })) {
121
- note = translator.t('common:commonCorrectAnswerWithAlternates', {
122
- lng: nextProps.language
123
- });
124
- }
72
+ UNSAFE_componentWillReceiveProps(nextProps) {
73
+ const {
74
+ maxLengthPerChoice,
75
+ language
76
+ } = this.props;
77
+ let {
78
+ note
79
+ } = this.props;
80
+ if ((0, _isEmpty.default)(nextProps.feedback)) {
81
+ this.setState({
82
+ showCorrectAnswer: false
83
+ });
125
84
  }
126
- }, {
127
- key: "render",
128
- value: function render() {
129
- var showCorrectAnswer = this.state.showCorrectAnswer;
130
- var _this$props2 = this.props,
131
- alwaysShowCorrect = _this$props2.alwaysShowCorrect,
132
- animationsDisabled = _this$props2.animationsDisabled,
133
- classes = _this$props2.classes,
134
- mode = _this$props2.mode,
135
- displayType = _this$props2.displayType,
136
- role = _this$props2.role,
137
- language = _this$props2.language,
138
- maxLengthPerChoice = _this$props2.maxLengthPerChoice,
139
- maxLengthPerChoiceEnabled = _this$props2.maxLengthPerChoiceEnabled,
140
- note = _this$props2.note,
141
- playerSpellCheckEnabled = _this$props2.playerSpellCheckEnabled,
142
- prompt = _this$props2.prompt,
143
- rationale = _this$props2.rationale,
144
- showNote = _this$props2.showNote,
145
- teacherInstructions = _this$props2.teacherInstructions,
146
- responseAreaInputConfiguration = _this$props2.responseAreaInputConfiguration,
147
- model = _this$props2.model,
148
- value = _this$props2.value;
149
-
150
- var _ref = model || {},
151
- extraCSSRules = _ref.extraCSSRules;
152
-
153
- var displayNote = (showCorrectAnswer || mode === 'view' && role === 'instructor') && showNote && note;
154
- var mainClasses = (0, _classnames["default"])([classes.mainContainer, (0, _defineProperty2["default"])({}, classes.noBorderColor, alwaysShowCorrect)]);
155
-
156
- var teacherInstructionsDiv = /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
157
- defaultClassName: "teacher-instructions",
158
- prompt: teacherInstructions
85
+ if (nextProps.alwaysShowCorrect) {
86
+ this.setState({
87
+ showCorrectAnswer: true
159
88
  });
89
+ }
90
+ if (maxLengthPerChoice && !(0, _isEqual.default)(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {
91
+ this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);
92
+ }
160
93
 
161
- var rationaleDiv = /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
162
- prompt: rationale
94
+ // check if the note is the default one for prev language and change to the default one for new language
95
+ // this check is necessary in order to diferanciate between default and authour defined note
96
+ // and only change between languages for default ones
97
+ if (note && language && language !== nextProps.language && note === translator.t('common:commonCorrectAnswerWithAlternates', {
98
+ lng: language
99
+ })) {
100
+ note = translator.t('common:commonCorrectAnswerWithAlternates', {
101
+ lng: nextProps.language
163
102
  });
164
-
165
- var showRationale = rationale && ((0, _renderUi.hasText)(rationale) || (0, _renderUi.hasMedia)(rationale));
166
- var showTeacherInstructions = teacherInstructions && ((0, _renderUi.hasText)(teacherInstructions) || (0, _renderUi.hasMedia)(teacherInstructions));
167
- return /*#__PURE__*/_react["default"].createElement(_renderUi.UiLayout, {
168
- extraCSSRules: extraCSSRules,
169
- className: mainClasses,
170
- style: {
171
- display: "".concat(displayType)
172
- }
173
- }, mode === 'gather' && /*#__PURE__*/_react["default"].createElement("h2", {
174
- className: classes.srOnly
175
- }, "Fill in the Blank Question"), showTeacherInstructions && /*#__PURE__*/_react["default"].createElement("div", {
176
- className: classes.collapsible
177
- }, !animationsDisabled ? /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
178
- labels: {
179
- hidden: 'Show Teacher Instructions',
180
- visible: 'Hide Teacher Instructions'
181
- }
182
- }, teacherInstructionsDiv) : teacherInstructionsDiv), prompt && /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
183
- prompt: prompt
184
- }), !alwaysShowCorrect && /*#__PURE__*/_react["default"].createElement(_correctAnswerToggle["default"], {
185
- show: mode === 'evaluate',
186
- toggled: showCorrectAnswer,
187
- onToggle: this.toggleShowCorrect,
188
- language: language
189
- }), /*#__PURE__*/_react["default"].createElement(_maskMarkup.ConstructedResponse, (0, _extends2["default"])({}, this.props, {
190
- onChange: this.onChange,
191
- showCorrectAnswer: showCorrectAnswer,
192
- value: value,
193
- maxLength: maxLengthPerChoice,
194
- adjustedLimit: maxLengthPerChoiceEnabled,
195
- spellCheck: playerSpellCheckEnabled,
196
- pluginProps: responseAreaInputConfiguration
197
- })), displayNote && /*#__PURE__*/_react["default"].createElement("div", {
198
- className: (0, _classnames["default"])(classes.note, 'note'),
199
- dangerouslySetInnerHTML: {
200
- __html: note
201
- }
202
- }), showRationale && /*#__PURE__*/_react["default"].createElement("div", {
203
- className: classes.collapsible
204
- }, !animationsDisabled ? /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
205
- labels: {
206
- hidden: 'Show Rationale',
207
- visible: 'Hide Rationale'
208
- }
209
- }, rationaleDiv) : rationaleDiv));
210
103
  }
211
- }]);
212
- return Main;
213
- }(_react["default"].Component);
214
-
104
+ }
105
+ render() {
106
+ const {
107
+ showCorrectAnswer
108
+ } = this.state;
109
+ const {
110
+ alwaysShowCorrect,
111
+ animationsDisabled,
112
+ mode,
113
+ displayType,
114
+ role,
115
+ language,
116
+ maxLengthPerChoice,
117
+ maxLengthPerChoiceEnabled,
118
+ note,
119
+ playerSpellCheckEnabled,
120
+ prompt,
121
+ rationale,
122
+ showNote,
123
+ teacherInstructions,
124
+ responseAreaInputConfiguration,
125
+ model,
126
+ value
127
+ } = this.props;
128
+ const {
129
+ extraCSSRules
130
+ } = model || {};
131
+ const displayNote = (showCorrectAnswer || mode === 'view' && role === 'instructor') && showNote && note;
132
+ const teacherInstructionsDiv = /*#__PURE__*/_react.default.createElement(_renderUi.PreviewPrompt, {
133
+ defaultClassName: "teacher-instructions",
134
+ prompt: teacherInstructions
135
+ });
136
+ const rationaleDiv = /*#__PURE__*/_react.default.createElement(_renderUi.PreviewPrompt, {
137
+ prompt: rationale
138
+ });
139
+ const showRationale = rationale && ((0, _renderUi.hasText)(rationale) || (0, _renderUi.hasMedia)(rationale));
140
+ const showTeacherInstructions = teacherInstructions && ((0, _renderUi.hasText)(teacherInstructions) || (0, _renderUi.hasMedia)(teacherInstructions));
141
+ return /*#__PURE__*/_react.default.createElement(MainContainer, {
142
+ extraCSSRules: extraCSSRules,
143
+ alwaysShowCorrect: alwaysShowCorrect,
144
+ style: {
145
+ display: `${displayType}`
146
+ }
147
+ }, mode === 'gather' && /*#__PURE__*/_react.default.createElement(SrOnly, null, "Fill in the Blank Question"), showTeacherInstructions && /*#__PURE__*/_react.default.createElement(CollapsibleContainer, null, !animationsDisabled ? /*#__PURE__*/_react.default.createElement(_renderUi.Collapsible, {
148
+ labels: {
149
+ hidden: 'Show Teacher Instructions',
150
+ visible: 'Hide Teacher Instructions'
151
+ }
152
+ }, teacherInstructionsDiv) : teacherInstructionsDiv), prompt && /*#__PURE__*/_react.default.createElement(_renderUi.PreviewPrompt, {
153
+ prompt: prompt
154
+ }), !alwaysShowCorrect && /*#__PURE__*/_react.default.createElement(_correctAnswerToggle.default, {
155
+ show: mode === 'evaluate',
156
+ toggled: showCorrectAnswer,
157
+ onToggle: this.toggleShowCorrect,
158
+ language: language
159
+ }), /*#__PURE__*/_react.default.createElement(_maskMarkup.ConstructedResponse, (0, _extends2.default)({}, this.props, {
160
+ onChange: this.onChange,
161
+ showCorrectAnswer: showCorrectAnswer,
162
+ value: value,
163
+ maxLength: maxLengthPerChoice,
164
+ adjustedLimit: maxLengthPerChoiceEnabled,
165
+ spellCheck: playerSpellCheckEnabled,
166
+ pluginProps: responseAreaInputConfiguration
167
+ })), displayNote && /*#__PURE__*/_react.default.createElement(NoteContainer, {
168
+ dangerouslySetInnerHTML: {
169
+ __html: note
170
+ }
171
+ }), showRationale && /*#__PURE__*/_react.default.createElement(CollapsibleContainer, null, !animationsDisabled ? /*#__PURE__*/_react.default.createElement(_renderUi.Collapsible, {
172
+ labels: {
173
+ hidden: 'Show Rationale',
174
+ visible: 'Hide Rationale'
175
+ }
176
+ }, rationaleDiv) : rationaleDiv));
177
+ }
178
+ }
215
179
  exports.Main = Main;
216
- (0, _defineProperty2["default"])(Main, "propTypes", {
217
- alwaysShowCorrect: _propTypes["default"].bool,
218
- animationsDisabled: _propTypes["default"].bool,
219
- classes: _propTypes["default"].object.isRequired,
220
- disabled: _propTypes["default"].bool,
221
- displayType: _propTypes["default"].string,
222
- feedback: _propTypes["default"].object,
223
- language: _propTypes["default"].string,
224
- markup: _propTypes["default"].string,
225
- maxLengthPerChoice: _propTypes["default"].array,
226
- maxLengthPerChoiceEnabled: _propTypes["default"].bool,
227
- mode: _propTypes["default"].string,
228
- note: _propTypes["default"].string,
229
- onChange: _propTypes["default"].func,
230
- playerSpellCheckEnabled: _propTypes["default"].bool,
231
- prompt: _propTypes["default"].string,
232
- rationale: _propTypes["default"].string,
233
- role: _propTypes["default"].string,
234
- showNote: _propTypes["default"].bool,
235
- teacherInstructions: _propTypes["default"].string,
236
- value: _propTypes["default"].object,
237
- responseAreaInputConfiguration: _propTypes["default"].object,
238
- model: _propTypes["default"].object.isRequired
180
+ (0, _defineProperty2.default)(Main, "propTypes", {
181
+ alwaysShowCorrect: _propTypes.default.bool,
182
+ animationsDisabled: _propTypes.default.bool,
183
+ disabled: _propTypes.default.bool,
184
+ displayType: _propTypes.default.string,
185
+ feedback: _propTypes.default.object,
186
+ language: _propTypes.default.string,
187
+ markup: _propTypes.default.string,
188
+ maxLengthPerChoice: _propTypes.default.array,
189
+ maxLengthPerChoiceEnabled: _propTypes.default.bool,
190
+ mode: _propTypes.default.string,
191
+ note: _propTypes.default.string,
192
+ onChange: _propTypes.default.func,
193
+ playerSpellCheckEnabled: _propTypes.default.bool,
194
+ prompt: _propTypes.default.string,
195
+ rationale: _propTypes.default.string,
196
+ role: _propTypes.default.string,
197
+ showNote: _propTypes.default.bool,
198
+ teacherInstructions: _propTypes.default.string,
199
+ value: _propTypes.default.object,
200
+ responseAreaInputConfiguration: _propTypes.default.object,
201
+ model: _propTypes.default.object.isRequired
239
202
  });
240
- (0, _defineProperty2["default"])(Main, "defaultProps", {
203
+ (0, _defineProperty2.default)(Main, "defaultProps", {
241
204
  value: {}
242
205
  });
243
-
244
- var styles = function styles(theme) {
245
- return {
246
- mainContainer: {
247
- color: _renderUi.color.text(),
248
- backgroundColor: _renderUi.color.background()
249
- },
250
- inlineDisplay: {
251
- display: 'inline-block'
252
- },
253
- blockDisplay: {
254
- display: 'block'
255
- },
256
- note: {
257
- marginBottom: theme.spacing.unit * 2
258
- },
259
- collapsible: {
260
- marginBottom: theme.spacing.unit * 2
261
- },
262
- noBorderColor: {
263
- '& *': {
264
- borderColor: "".concat(_renderUi.color.text(), " !important")
265
- }
266
- },
267
- srOnly: {
268
- position: 'absolute',
269
- left: '-10000px',
270
- top: 'auto',
271
- width: '1px',
272
- height: '1px',
273
- overflow: 'hidden'
274
- }
275
- };
276
- };
277
-
278
- var _default = (0, _styles.withStyles)(styles)(Main);
279
-
280
- exports["default"] = _default;
206
+ var _default = exports.default = Main;
281
207
  //# sourceMappingURL=main.js.map
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.js"],"names":["translator","Translator","Main","showCorrectAnswer","props","alwaysShowCorrect","maxLengthPerChoice","every","val","i","arr","onChange","maxWait","setState","state","getChangeSession","value","changeSession","nextProps","language","note","feedback","t","lng","animationsDisabled","classes","mode","displayType","role","maxLengthPerChoiceEnabled","playerSpellCheckEnabled","prompt","rationale","showNote","teacherInstructions","responseAreaInputConfiguration","model","extraCSSRules","displayNote","mainClasses","mainContainer","noBorderColor","teacherInstructionsDiv","rationaleDiv","showRationale","showTeacherInstructions","display","srOnly","collapsible","hidden","visible","toggleShowCorrect","__html","React","Component","PropTypes","bool","object","isRequired","disabled","string","markup","array","func","styles","theme","color","text","backgroundColor","background","inlineDisplay","blockDisplay","marginBottom","spacing","unit","borderColor","position","left","top","width","height","overflow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAQA,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;;IAEaE,I;;;;;;;;;;;;;;;8FA8BH;AACNC,MAAAA,iBAAiB,EAAE,MAAKC,KAAL,CAAWC,iBAAX,IAAgC;AAD7C,K;yGAKW,UAACC,kBAAD;AAAA,aACjBA,kBAAkB,IAAIA,kBAAkB,CAACC,KAAnB,CAAyB,UAACC,GAAD,EAAMC,CAAN,EAASC,GAAT;AAAA,eAAiBF,GAAG,KAAKE,GAAG,CAAC,CAAD,CAAX,IAAkBF,GAAG,KAAK,CAA3C;AAAA,OAAzB,CAAtB,GACI,MAAKJ,KAAL,CAAWO,QADf,GAEI,0BAAS,MAAKP,KAAL,CAAWO,QAApB,EAA8B,GAA9B,EAAmC;AAAEC,QAAAA,OAAO,EAAE;AAAX,OAAnC,CAHa;AAAA,K;0GAkCC,YAAM;AACxB,YAAKC,QAAL,CAAc;AAAEV,QAAAA,iBAAiB,EAAE,CAAC,MAAKW,KAAL,CAAWX;AAAjC,OAAd;AACD,K;sGAEe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K,MAnBd;AAoBjB5C,EAAAA,KAAK,EAAEuC,sBAAUE,MApBA;AAqBjBtB,EAAAA,8BAA8B,EAAEoB,sBAAUE,MArBzB;AAsBjBrB,EAAAA,KAAK,EAAEmB,sBAAUE,MAAV,CAAiBC;AAtBP,C;iCADRxD,I,kBA0BW;AACpBc,EAAAA,KAAK,EAAE;AADa,C;;AAqJxB,IAAMgD,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBzB,IAAAA,aAAa,EAAE;AACb0B,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADM;AAEbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN;AAFJ,KADU;AAKzBC,IAAAA,aAAa,EAAE;AACbxB,MAAAA,OAAO,EAAE;AADI,KALU;AAQzByB,IAAAA,YAAY,EAAE;AACZzB,MAAAA,OAAO,EAAE;AADG,KARW;AAWzB1B,IAAAA,IAAI,EAAE;AACJoD,MAAAA,YAAY,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AAD/B,KAXmB;AAczB1B,IAAAA,WAAW,EAAE;AACXwB,MAAAA,YAAY,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AADxB,KAdY;AAiBzBjC,IAAAA,aAAa,EAAE;AACb,aAAO;AACLkC,QAAAA,WAAW,YAAKT,gBAAMC,IAAN,EAAL;AADN;AADM,KAjBU;AAsBzBpB,IAAAA,MAAM,EAAE;AACN6B,MAAAA,QAAQ,EAAE,UADJ;AAENC,MAAAA,IAAI,EAAE,UAFA;AAGNC,MAAAA,GAAG,EAAE,MAHC;AAINC,MAAAA,KAAK,EAAE,KAJD;AAKNC,MAAAA,MAAM,EAAE,KALF;AAMNC,MAAAA,QAAQ,EAAE;AANJ;AAtBiB,GAAZ;AAAA,CAAf;;eAgCe,wBAAWjB,MAAX,EAAmB9D,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash/debounce';\nimport isEmpty from 'lodash/isEmpty';\nimport isEqual from 'lodash/isEqual';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { ConstructedResponse } from '@pie-lib/mask-markup';\nimport { color, Collapsible, hasText, hasMedia, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nexport class Main extends React.Component {\n static propTypes = {\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n disabled: PropTypes.bool,\n displayType: PropTypes.string,\n feedback: PropTypes.object,\n language: PropTypes.string,\n markup: PropTypes.string,\n maxLengthPerChoice: PropTypes.array,\n maxLengthPerChoiceEnabled: PropTypes.bool,\n mode: PropTypes.string,\n note: PropTypes.string,\n onChange: PropTypes.func,\n playerSpellCheckEnabled: PropTypes.bool,\n prompt: PropTypes.string,\n rationale: PropTypes.string,\n role: PropTypes.string,\n showNote: PropTypes.bool,\n teacherInstructions: PropTypes.string,\n value: PropTypes.object,\n responseAreaInputConfiguration: PropTypes.object,\n model: PropTypes.object.isRequired,\n };\n\n static defaultProps = {\n value: {},\n };\n\n state = {\n showCorrectAnswer: this.props.alwaysShowCorrect || false,\n };\n\n // if for all responses max length is 1, call onChange for each keystroke\n getChangeSession = (maxLengthPerChoice) =>\n maxLengthPerChoice && maxLengthPerChoice.every((val, i, arr) => val === arr[0] && val === 1)\n ? this.props.onChange\n : debounce(this.props.onChange, 200, { maxWait: 200 });\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { maxLengthPerChoice, language } = this.props;\n let { note } = this.props;\n\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n\n if (nextProps.alwaysShowCorrect) {\n this.setState({ showCorrectAnswer: true });\n }\n\n if (maxLengthPerChoice && !isEqual(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {\n this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);\n }\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (\n note &&\n language &&\n language !== nextProps.language &&\n note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: language })\n ) {\n note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextProps.language });\n }\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n changeSession = this.getChangeSession(this.props.maxLengthPerChoice);\n\n onChange = (value) => {\n this.changeSession(value);\n };\n\n render() {\n const { showCorrectAnswer } = this.state;\n const {\n alwaysShowCorrect,\n animationsDisabled,\n classes,\n mode,\n displayType,\n role,\n language,\n maxLengthPerChoice,\n maxLengthPerChoiceEnabled,\n note,\n playerSpellCheckEnabled,\n prompt,\n rationale,\n showNote,\n teacherInstructions,\n responseAreaInputConfiguration,\n model,\n value,\n } = this.props;\n\n const { extraCSSRules } = model || {};\n const displayNote = (showCorrectAnswer || (mode === 'view' && role === 'instructor')) && showNote && note;\n const mainClasses = classNames([\n classes.mainContainer,\n {\n [classes.noBorderColor]: alwaysShowCorrect,\n },\n ]);\n\n const teacherInstructionsDiv = (\n <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />\n );\n\n const rationaleDiv = <PreviewPrompt prompt={rationale} />;\n\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n return (\n <UiLayout extraCSSRules={extraCSSRules} className={mainClasses} style={{ display: `${displayType}` }}>\n {mode === 'gather' && <h2 className={classes.srOnly}>Fill in the Blank Question</h2>}\n\n {showTeacherInstructions && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}>\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </div>\n )}\n\n {prompt && <PreviewPrompt prompt={prompt} />}\n\n {!alwaysShowCorrect && (\n <CorrectAnswerToggle\n show={mode === 'evaluate'}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n )}\n\n <ConstructedResponse\n {...this.props}\n onChange={this.onChange}\n showCorrectAnswer={showCorrectAnswer}\n value={value}\n maxLength={maxLengthPerChoice}\n adjustedLimit={maxLengthPerChoiceEnabled}\n spellCheck={playerSpellCheckEnabled}\n pluginProps={responseAreaInputConfiguration}\n />\n\n {displayNote && <div className={classNames(classes.note, 'note')} dangerouslySetInnerHTML={{ __html: note }} />}\n\n {showRationale && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>{rationaleDiv}</Collapsible>\n ) : (\n rationaleDiv\n )}\n </div>\n )}\n </UiLayout>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n },\n inlineDisplay: {\n display: 'inline-block',\n },\n blockDisplay: {\n display: 'block',\n },\n note: {\n marginBottom: theme.spacing.unit * 2,\n },\n collapsible: {\n marginBottom: theme.spacing.unit * 2,\n },\n noBorderColor: {\n '& *': {\n borderColor: `${color.text()} !important`,\n },\n },\n srOnly: {\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n },\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
1
+ {"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_propTypes","_debounce","_isEmpty","_isEqual","_correctAnswerToggle","_maskMarkup","_renderUi","_styles","_translator","translator","Translator","MainContainer","styled","UiLayout","alwaysShowCorrect","color","text","backgroundColor","background","borderColor","NoteContainer","theme","marginBottom","spacing","CollapsibleContainer","SrOnly","position","left","top","width","height","overflow","Main","React","Component","constructor","args","_defineProperty2","default","showCorrectAnswer","props","maxLengthPerChoice","every","val","_i","arr","onChange","debounce","maxWait","setState","state","getChangeSession","value","changeSession","UNSAFE_componentWillReceiveProps","nextProps","language","note","isEmpty","feedback","isEqual","t","lng","render","animationsDisabled","mode","displayType","role","maxLengthPerChoiceEnabled","playerSpellCheckEnabled","prompt","rationale","showNote","teacherInstructions","responseAreaInputConfiguration","model","extraCSSRules","displayNote","teacherInstructionsDiv","createElement","PreviewPrompt","defaultClassName","rationaleDiv","showRationale","hasText","hasMedia","showTeacherInstructions","style","display","Collapsible","labels","hidden","visible","show","toggled","onToggle","toggleShowCorrect","ConstructedResponse","_extends2","maxLength","adjustedLimit","spellCheck","pluginProps","dangerouslySetInnerHTML","__html","exports","PropTypes","bool","disabled","string","object","markup","array","func","isRequired","_default"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash/debounce';\nimport isEmpty from 'lodash/isEmpty';\nimport isEqual from 'lodash/isEqual';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { ConstructedResponse } from '@pie-lib/mask-markup';\nimport { color, Collapsible, hasText, hasMedia, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { styled } from '@mui/material/styles';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nconst MainContainer = styled(UiLayout)(({ alwaysShowCorrect }) => ({\n color: color.text(),\n backgroundColor: color.background(),\n ...(alwaysShowCorrect && {\n '& *': {\n borderColor: `${color.text()} !important`,\n },\n }),\n}));\n\nconst NoteContainer = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst CollapsibleContainer = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nconst SrOnly = styled('h2')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nexport class Main extends React.Component {\n static propTypes = {\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n disabled: PropTypes.bool,\n displayType: PropTypes.string,\n feedback: PropTypes.object,\n language: PropTypes.string,\n markup: PropTypes.string,\n maxLengthPerChoice: PropTypes.array,\n maxLengthPerChoiceEnabled: PropTypes.bool,\n mode: PropTypes.string,\n note: PropTypes.string,\n onChange: PropTypes.func,\n playerSpellCheckEnabled: PropTypes.bool,\n prompt: PropTypes.string,\n rationale: PropTypes.string,\n role: PropTypes.string,\n showNote: PropTypes.bool,\n teacherInstructions: PropTypes.string,\n value: PropTypes.object,\n responseAreaInputConfiguration: PropTypes.object,\n model: PropTypes.object.isRequired,\n };\n\n static defaultProps = {\n value: {},\n };\n\n state = {\n showCorrectAnswer: this.props.alwaysShowCorrect || false,\n };\n\n // if for all responses max length is 1, call onChange for each keystroke\n getChangeSession = (maxLengthPerChoice) =>\n maxLengthPerChoice && maxLengthPerChoice.every((val, _i, arr) => val === arr[0] && val === 1)\n ? this.props.onChange\n : debounce(this.props.onChange, 200, { maxWait: 200 });\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { maxLengthPerChoice, language } = this.props;\n let { note } = this.props;\n\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n\n if (nextProps.alwaysShowCorrect) {\n this.setState({ showCorrectAnswer: true });\n }\n\n if (maxLengthPerChoice && !isEqual(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {\n this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);\n }\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (\n note &&\n language &&\n language !== nextProps.language &&\n note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: language })\n ) {\n note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextProps.language });\n }\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n changeSession = this.getChangeSession(this.props.maxLengthPerChoice);\n\n onChange = (value) => {\n this.changeSession(value);\n };\n\n render() {\n const { showCorrectAnswer } = this.state;\n const {\n alwaysShowCorrect,\n animationsDisabled,\n mode,\n displayType,\n role,\n language,\n maxLengthPerChoice,\n maxLengthPerChoiceEnabled,\n note,\n playerSpellCheckEnabled,\n prompt,\n rationale,\n showNote,\n teacherInstructions,\n responseAreaInputConfiguration,\n model,\n value,\n } = this.props;\n\n const { extraCSSRules } = model || {};\n const displayNote = (showCorrectAnswer || (mode === 'view' && role === 'instructor')) && showNote && note;\n\n const teacherInstructionsDiv = (\n <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />\n );\n\n const rationaleDiv = <PreviewPrompt prompt={rationale} />;\n\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n return (\n <MainContainer\n extraCSSRules={extraCSSRules}\n alwaysShowCorrect={alwaysShowCorrect}\n style={{ display: `${displayType}` }}\n >\n {mode === 'gather' && <SrOnly>Fill in the Blank Question</SrOnly>}\n\n {showTeacherInstructions && (\n <CollapsibleContainer>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}>\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </CollapsibleContainer>\n )}\n\n {prompt && <PreviewPrompt prompt={prompt} />}\n\n {!alwaysShowCorrect && (\n <CorrectAnswerToggle\n show={mode === 'evaluate'}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n )}\n\n <ConstructedResponse\n {...this.props}\n onChange={this.onChange}\n showCorrectAnswer={showCorrectAnswer}\n value={value}\n maxLength={maxLengthPerChoice}\n adjustedLimit={maxLengthPerChoiceEnabled}\n spellCheck={playerSpellCheckEnabled}\n pluginProps={responseAreaInputConfiguration}\n />\n\n {displayNote && <NoteContainer dangerouslySetInnerHTML={{ __html: note }} />}\n\n {showRationale && (\n <CollapsibleContainer>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>{rationaleDiv}</Collapsible>\n ) : (\n rationaleDiv\n )}\n </CollapsibleContainer>\n )}\n </MainContainer>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,QAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,oBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAV,sBAAA,CAAAC,OAAA;AAEA,MAAM;EAAEU;AAAW,CAAC,GAAGC,mBAAU;AAEjC,MAAMC,aAAa,GAAG,IAAAC,cAAM,EAACC,kBAAQ,CAAC,CAAC,CAAC;EAAEC;AAAkB,CAAC,MAAM;EACjEC,KAAK,EAAEA,eAAK,CAACC,IAAI,CAAC,CAAC;EACnBC,eAAe,EAAEF,eAAK,CAACG,UAAU,CAAC,CAAC;EACnC,IAAIJ,iBAAiB,IAAI;IACvB,KAAK,EAAE;MACLK,WAAW,EAAE,GAAGJ,eAAK,CAACC,IAAI,CAAC,CAAC;IAC9B;EACF,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAMI,aAAa,GAAG,IAAAR,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAES;AAAM,CAAC,MAAM;EAClDC,YAAY,EAAED,KAAK,CAACE,OAAO,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAEH,MAAMC,oBAAoB,GAAG,IAAAZ,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