@pie-element/explicit-constructed-response 3.12.4 → 3.12.5

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.12.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@3.12.4...@pie-element/explicit-constructed-response@3.12.5) (2022-03-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * test ([61f9577](https://github.com/pie-framework/pie-elements/commit/61f95775a3086c6a4fce64c46b31b15b081f4243))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.12.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@3.12.3...@pie-element/explicit-constructed-response@3.12.4) (2022-03-08)
7
18
 
8
19
  **Note:** Version bump only for package @pie-element/explicit-constructed-response
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.7.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.7.4...@pie-element/explicit-constructed-response-configure@3.7.5) (2022-03-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * test ([61f9577](https://github.com/pie-framework/pie-elements/commit/61f95775a3086c6a4fce64c46b31b15b081f4243))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.7.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.7.3...@pie-element/explicit-constructed-response-configure@3.7.4) (2022-03-08)
7
18
 
8
19
  **Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
@@ -177,9 +177,11 @@ var AlternateResponses = /*#__PURE__*/function (_React$Component) {
177
177
  var _this2 = this;
178
178
 
179
179
  var choices = this.state.choices;
180
- var _this$props$model = this.props.model,
181
- maxLengthPerChoice = _this$props$model.maxLengthPerChoice,
182
- maxLengthPerChoiceEnabled = _this$props$model.maxLengthPerChoiceEnabled;
180
+ var _this$props2 = this.props,
181
+ _this$props2$model = _this$props2.model,
182
+ maxLengthPerChoice = _this$props2$model.maxLengthPerChoice,
183
+ maxLengthPerChoiceEnabled = _this$props2$model.maxLengthPerChoiceEnabled,
184
+ spellCheck = _this$props2.spellCheck;
183
185
  return /*#__PURE__*/_react["default"].createElement("div", null, (0, _map["default"])(choices, function (c, key) {
184
186
  // if maxLengthPerChoiceEnabled is true, we display all the choices
185
187
  if (c && (maxLengthPerChoiceEnabled || c.length > 1)) {
@@ -202,7 +204,8 @@ var AlternateResponses = /*#__PURE__*/function (_React$Component) {
202
204
  selectChoices: [selected],
203
205
  choices: c,
204
206
  maxLength: maxLengthPerChoice[key],
205
- showMaxLength: maxLengthPerChoiceEnabled
207
+ showMaxLength: maxLengthPerChoiceEnabled,
208
+ spellCheck: spellCheck
206
209
  });
207
210
  }
208
211
  }), choices && Object.keys(this.state.values).length !== Object.keys(choices).length && /*#__PURE__*/_react["default"].createElement(_alternateSection["default"], {
@@ -216,7 +219,8 @@ var AlternateResponses = /*#__PURE__*/function (_React$Component) {
216
219
  choiceRemoved: function choiceRemoved(value) {
217
220
  return _this2.onChoiceRemoved(value);
218
221
  },
219
- selectChoices: this.getRemainingChoices()
222
+ selectChoices: this.getRemainingChoices(),
223
+ spellCheck: spellCheck
220
224
  }));
221
225
  }
222
226
  }]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/alternateResponses.jsx"],"names":["AlternateResponses","maxLengthPerChoice","props","model","state","choices","values","Object","keys","length","maxLengthPerChoiceEnabled","selectedValues","obj","c","key","setState","valueKey","arr","push","label","value","choice","onChange","sectionChoices","isNew","find","newChoices","reduce","newVal","section","onLengthChange","nextProps","updateChoicesIfNeeded","selected","onSectionSelect","onChoiceChanged","onChoiceRemoved","onLengthChanged","getRemainingChoices","React","Component","PropTypes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ArB,CAAJ;AAAA,SAJtB;AAKE,QAAA,aAAa,EAAE,KAAKkB,mBAAL;AALjB,QAzBJ,CADF;AAoCD;;;EAxLqCC,kBAAMC,S;;;iCAAjCxC,kB,eACQ;AACjBG,EAAAA,KAAK,EAAEsC,sBAAUC,MAAV,CAAiBC,UADP;AAEjBrB,EAAAA,QAAQ,EAAEmB,sBAAUG,IAAV,CAAeD,UAFR;AAGjBb,EAAAA,cAAc,EAAEW,sBAAUG,IAAV,CAAeD,UAHd;AAIjBjC,EAAAA,yBAAyB,EAAE+B,sBAAUI,IAAV,CAAeF;AAJzB,C;eA0LN3C,kB","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport isEqual from 'lodash/isEqual';\nimport map from 'lodash/map';\nimport reduce from 'lodash/reduce';\nimport cloneDeep from 'lodash/cloneDeep';\n\nimport AlternateSection from './alternateSection';\n\nexport class AlternateResponses extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n onLengthChange: PropTypes.func.isRequired,\n maxLengthPerChoiceEnabled: PropTypes.bool.isRequired\n };\n\n state = { maxLengthPerChoice: cloneDeep(this.props.model.maxLengthPerChoice) };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.updateChoicesIfNeeded(nextProps);\n }\n\n componentDidMount() {\n this.updateChoicesIfNeeded(this.props);\n }\n\n updateChoicesIfNeeded = props => {\n if (!this.state.choices\n || !isEqual(this.state.choices, props.model.choices)\n || !isEqual(props.model.choices, this.props.model.choices)\n || (this.state.values && Object.keys(this.state.values).length !== Object.keys(this.props.model.choices).length)\n || props.maxLengthPerChoiceEnabled !== this.props.maxLengthPerChoiceEnabled\n ) {\n const { choices, maxLengthPerChoice } = props.model;\n\n const selectedValues = reduce(choices, (obj, c, key) => {\n // if maxLengthPerChoiceEnabled is true, we display all the choices\n if (c && (props.maxLengthPerChoiceEnabled || c.length > 1)) {\n obj[key] = c[0];\n }\n\n return obj;\n }, {});\n\n this.setState({\n choices: props.model.choices,\n values: selectedValues,\n maxLengthPerChoice: cloneDeep(maxLengthPerChoice)\n });\n }\n };\n\n getRemainingChoices = valueKey => {\n const { choices } = this.state;\n\n return reduce(choices, (arr, c, key) => {\n if (c && c.length === 1 && !valueKey) {\n arr.push({\n label: c[0].label,\n value: key\n });\n }\n\n return arr;\n }, []);\n };\n\n onChoiceChanged = (choice, key) => {\n const { onChange } = this.props;\n const { choices } = this.state;\n const sectionChoices = (choices[key] || []);\n\n const isNew = !sectionChoices.find(c => c.value === choice.value);\n\n const newChoices = sectionChoices.reduce((arr, c) => {\n const newVal = c.value === choice.value ? choice : c;\n\n arr.push(newVal);\n\n return arr;\n }, []);\n\n if (isNew) {\n newChoices.push(choice);\n }\n\n onChange({\n ...choices,\n [key]: newChoices\n });\n };\n\n onChoiceRemoved = (value, section) => {\n const { onChange } = this.props;\n const { choices } = this.state;\n const sectionChoices = (choices[section] || []);\n\n const newChoices = sectionChoices.reduce((arr, c) => {\n if (c.value === value) {\n return arr;\n }\n\n arr.push(c);\n\n return arr;\n }, []);\n\n onChange({\n ...choices,\n [section]: newChoices\n });\n };\n\n onSectionSelect = (choice, key) => {\n const { onChange } = this.props;\n const { choices, values } = this.state;\n\n if (choices[key] && choices[key].length > 1) {\n if (!choice) {\n onChange({\n ...choices,\n [key]: [choices[key][0]]\n });\n }\n } else {\n this.setState({\n choices: {\n ...choices,\n [key]: [\n ...choices[key],\n {\n label: '',\n value: '1'\n }\n ]\n },\n values: {\n ...values,\n [key]: choices[key][0]\n }\n });\n }\n };\n\n onLengthChanged = (value, key) => {\n const { model, onLengthChange } = this.props;\n const { maxLengthPerChoice } = model;\n\n maxLengthPerChoice[key] = value;\n onLengthChange(maxLengthPerChoice);\n }\n\n render() {\n const { choices } = this.state;\n const { model: { maxLengthPerChoice, maxLengthPerChoiceEnabled }} = this.props\n\n return (\n <div>\n {map(choices, (c, key) => {\n // if maxLengthPerChoiceEnabled is true, we display all the choices\n if (c && (maxLengthPerChoiceEnabled || c.length > 1)) {\n const selected = this.state.values[key];\n\n return (\n <AlternateSection\n key={key}\n value={selected && selected.value}\n onSelect={choice => this.onSectionSelect(choice, key)}\n choiceChanged={choice => this.onChoiceChanged(choice, key)}\n choiceRemoved={value => this.onChoiceRemoved(value, key)}\n lengthChanged={value => this.onLengthChanged(value, key)}\n selectChoices={[selected]}\n choices={c}\n maxLength={maxLengthPerChoice[key]}\n showMaxLength={maxLengthPerChoiceEnabled}\n />\n );\n }\n })}\n {\n choices &&\n Object.keys(this.state.values).length !== Object.keys(choices).length &&\n <AlternateSection\n value=\"\"\n onSelect={choice => this.onSectionSelect(choice, choice.value)}\n choiceChanged={choice => this.onChoiceChanged(choice)}\n choiceRemoved={value => this.onChoiceRemoved(value)}\n selectChoices={this.getRemainingChoices()}\n />\n }\n </div>\n );\n }\n}\n\nexport default AlternateResponses;\n"],"file":"alternateResponses.js"}
1
+ {"version":3,"sources":["../src/alternateResponses.jsx"],"names":["AlternateResponses","maxLengthPerChoice","props","model","state","choices","values","Object","keys","length","maxLengthPerChoiceEnabled","selectedValues","obj","c","key","setState","valueKey","arr","push","label","value","choice","onChange","sectionChoices","isNew","find","newChoices","reduce","newVal","section","onLengthChange","nextProps","updateChoicesIfNeeded","spellCheck","selected","onSectionSelect","onChoiceChanged","onChoiceRemoved","onLengthChanged","getRemainingChoices","React","Component","PropTypes","object","isRequired","func","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;IAEaA,kB;;;;;;;;;;;;;;;8FAQH;AAAEC,MAAAA,kBAAkB,EAAE,2BAAU,MAAKC,KAAL,CAAWC,KAAX,CAAiBF,kBAA3B;AAAtB,K;8GAUgB,UAAAC,KAAK,EAAI;AAC/B,UAAI,CAAC,MAAKE,KAAL,CAAWC,OAAZ,IACC,CAAC,yBAAQ,MAAKD,KAAL,CAAWC,OAAnB,EAA4BH,KAAK,CAACC,KAAN,CAAYE,OAA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EY,sBAAUG,IAAV,CAAeD,UAHd;AAIjBlC,EAAAA,yBAAyB,EAAEgC,sBAAUI,IAAV,CAAeF;AAJzB,C;eA4LN5C,kB","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport isEqual from 'lodash/isEqual';\nimport map from 'lodash/map';\nimport reduce from 'lodash/reduce';\nimport cloneDeep from 'lodash/cloneDeep';\n\nimport AlternateSection from './alternateSection';\n\nexport class AlternateResponses extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n onLengthChange: PropTypes.func.isRequired,\n maxLengthPerChoiceEnabled: PropTypes.bool.isRequired\n };\n\n state = { maxLengthPerChoice: cloneDeep(this.props.model.maxLengthPerChoice) };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.updateChoicesIfNeeded(nextProps);\n }\n\n componentDidMount() {\n this.updateChoicesIfNeeded(this.props);\n }\n\n updateChoicesIfNeeded = props => {\n if (!this.state.choices\n || !isEqual(this.state.choices, props.model.choices)\n || !isEqual(props.model.choices, this.props.model.choices)\n || (this.state.values && Object.keys(this.state.values).length !== Object.keys(this.props.model.choices).length)\n || props.maxLengthPerChoiceEnabled !== this.props.maxLengthPerChoiceEnabled\n ) {\n const { choices, maxLengthPerChoice } = props.model;\n\n const selectedValues = reduce(choices, (obj, c, key) => {\n // if maxLengthPerChoiceEnabled is true, we display all the choices\n if (c && (props.maxLengthPerChoiceEnabled || c.length > 1)) {\n obj[key] = c[0];\n }\n\n return obj;\n }, {});\n\n this.setState({\n choices: props.model.choices,\n values: selectedValues,\n maxLengthPerChoice: cloneDeep(maxLengthPerChoice)\n });\n }\n };\n\n getRemainingChoices = valueKey => {\n const { choices } = this.state;\n\n return reduce(choices, (arr, c, key) => {\n if (c && c.length === 1 && !valueKey) {\n arr.push({\n label: c[0].label,\n value: key\n });\n }\n\n return arr;\n }, []);\n };\n\n onChoiceChanged = (choice, key) => {\n const { onChange } = this.props;\n const { choices } = this.state;\n const sectionChoices = (choices[key] || []);\n\n const isNew = !sectionChoices.find(c => c.value === choice.value);\n\n const newChoices = sectionChoices.reduce((arr, c) => {\n const newVal = c.value === choice.value ? choice : c;\n\n arr.push(newVal);\n\n return arr;\n }, []);\n\n if (isNew) {\n newChoices.push(choice);\n }\n\n onChange({\n ...choices,\n [key]: newChoices\n });\n };\n\n onChoiceRemoved = (value, section) => {\n const { onChange } = this.props;\n const { choices } = this.state;\n const sectionChoices = (choices[section] || []);\n\n const newChoices = sectionChoices.reduce((arr, c) => {\n if (c.value === value) {\n return arr;\n }\n\n arr.push(c);\n\n return arr;\n }, []);\n\n onChange({\n ...choices,\n [section]: newChoices\n });\n };\n\n onSectionSelect = (choice, key) => {\n const { onChange } = this.props;\n const { choices, values } = this.state;\n\n if (choices[key] && choices[key].length > 1) {\n if (!choice) {\n onChange({\n ...choices,\n [key]: [choices[key][0]]\n });\n }\n } else {\n this.setState({\n choices: {\n ...choices,\n [key]: [\n ...choices[key],\n {\n label: '',\n value: '1'\n }\n ]\n },\n values: {\n ...values,\n [key]: choices[key][0]\n }\n });\n }\n };\n\n onLengthChanged = (value, key) => {\n const { model, onLengthChange } = this.props;\n const { maxLengthPerChoice } = model;\n\n maxLengthPerChoice[key] = value;\n onLengthChange(maxLengthPerChoice);\n }\n\n render() {\n const { choices } = this.state;\n const { model: { maxLengthPerChoice, maxLengthPerChoiceEnabled }, spellCheck} = this.props\n\n return (\n <div>\n {map(choices, (c, key) => {\n // if maxLengthPerChoiceEnabled is true, we display all the choices\n if (c && (maxLengthPerChoiceEnabled || c.length > 1)) {\n const selected = this.state.values[key];\n\n return (\n <AlternateSection\n key={key}\n value={selected && selected.value}\n onSelect={choice => this.onSectionSelect(choice, key)}\n choiceChanged={choice => this.onChoiceChanged(choice, key)}\n choiceRemoved={value => this.onChoiceRemoved(value, key)}\n lengthChanged={value => this.onLengthChanged(value, key)}\n selectChoices={[selected]}\n choices={c}\n maxLength={maxLengthPerChoice[key]}\n showMaxLength={maxLengthPerChoiceEnabled}\n spellCheck = {spellCheck}\n />\n );\n }\n })}\n {\n choices &&\n Object.keys(this.state.values).length !== Object.keys(choices).length &&\n <AlternateSection\n value=\"\"\n onSelect={choice => this.onSectionSelect(choice, choice.value)}\n choiceChanged={choice => this.onChoiceChanged(choice)}\n choiceRemoved={value => this.onChoiceRemoved(value)}\n selectChoices={this.getRemainingChoices()}\n spellCheck = {spellCheck}\n />\n }\n </div>\n );\n }\n}\n\nexport default AlternateResponses;\n"],"file":"alternateResponses.js"}
@@ -49,6 +49,8 @@ var _styles = require("@material-ui/core/styles");
49
49
 
50
50
  var _max = _interopRequireDefault(require("lodash/max"));
51
51
 
52
+ var _markupUtils = require("./markupUtils");
53
+
52
54
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
53
55
 
54
56
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -139,7 +141,8 @@ var Choice = /*#__PURE__*/function (_React$Component) {
139
141
  var value = this.state.value;
140
142
  var _this$props = this.props,
141
143
  classes = _this$props.classes,
142
- onDelete = _this$props.onDelete;
144
+ onDelete = _this$props.onDelete,
145
+ spellCheck = _this$props.spellCheck;
143
146
  return /*#__PURE__*/_react["default"].createElement("div", {
144
147
  style: {
145
148
  alignItems: 'center',
@@ -150,7 +153,9 @@ var Choice = /*#__PURE__*/function (_React$Component) {
150
153
  className: classes.choice,
151
154
  value: value,
152
155
  onChange: this.onChange,
153
- labelWidth: 0
156
+ labelWidth: 0,
157
+ disableUnderline: true,
158
+ spellCheck: spellCheck
154
159
  }), /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
155
160
  "aria-label": "delete",
156
161
  className: classes.deleteBtn,
@@ -236,7 +241,7 @@ var AlternateSection = /*#__PURE__*/function (_React$Component2) {
236
241
  }));
237
242
 
238
243
  if (newLength > maxLength || newLength + 10 <= maxLength) {
239
- lengthChanged(newLength);
244
+ lengthChanged((0, _markupUtils.getAdjustedLength)(newLength));
240
245
  }
241
246
  });
242
247
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onRemoveChoice", function (choice) {
@@ -288,7 +293,8 @@ var AlternateSection = /*#__PURE__*/function (_React$Component2) {
288
293
  selectChoices = _this$props2.selectChoices,
289
294
  maxLength = _this$props2.maxLength,
290
295
  showMaxLength = _this$props2.showMaxLength,
291
- value = _this$props2.value;
296
+ value = _this$props2.value,
297
+ spellCheck = _this$props2.spellCheck;
292
298
  var choices = this.state.choices;
293
299
  var minLength = this.getChoicesMaxLength();
294
300
  return /*#__PURE__*/_react["default"].createElement("div", {
@@ -337,7 +343,8 @@ var AlternateSection = /*#__PURE__*/function (_React$Component2) {
337
343
  },
338
344
  onDelete: function onDelete() {
339
345
  return _this3.onRemoveChoice(c);
340
- }
346
+ },
347
+ spellCheck: spellCheck
341
348
  });
342
349
  })));
343
350
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/alternateSection.jsx"],"names":["styles","altChoices","alignItems","flexDirection","display","padding","marginBottom","width","choice","flex","marginRight","deleteBtn","fill","selectContainer","justifyContent","rightContainer","lengthField","Choice","value","props","markup","onChange","e","target","setState","updateText","nextProps","state","classes","onDelete","React","Component","PropTypes","object","string","func","isRequired","AlternateSection","choices","onSelect","selectChoices","find","c","length","label","map","parseInt","filter","id","isNaN","index","choiceChanged","lengthChanged","maxLength","labelLengthsArr","newLength","Math","max","choiceRemoved","event","numberValue","minLength","getChoicesMaxLength","updateChoicesIfNeeded","showMaxLength","design","select","handleSelect","min","changeLength","addButton","onAddChoice","val","onChoiceChanged","onRemoveChoice","array","number","bool","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO;AACpBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,UAAU,EAAE,YADF;AAEVC,MAAAA,aAAa,EAAE,QAFL;AAGVC,MAAAA,OAAO,EAAE,MAHC;AAIVC,MAAAA,OAAO,EAAE,YAJC;AAKV,eAAS;AACPC,QAAAA,YAAY,EAAE,MADP;AAEPC,QAAAA,KAAK,EAAE;AAFA;AALC,KADQ;AAWpBC,IAAAA,MAAM,EAAE;AACNC,MAAAA,IAAI,EAAE,GADA;AAENC,MAAAA,WAAW,EAAE;AAFP,KAXY;AAepBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,IAAI,EAAE;AADG,KAfS;AAkBpBC,IAAAA,eAAe,EAAE;AACfX,MAAAA,UAAU,EAAE,UADG;AAEfE,MAAAA,OAAO,EAAE,MAFM;AAGfU,MAAAA,cAAc,EAAE,eAHD;AAIfP,MAAAA,KAAK,EAAE;AAJQ,KAlBG;AAwBpBQ,IAAAA,cAAc,EAAE;AACdb,MAAAA,UAAU,EAAE,QADE;AAEdE,MAAAA,OAAO,EAAE;AAFK,KAxBI;AA4BpBY,IAAAA,WAAW,EAAE;AACXT,MAAAA,KAAK,EAAE,OADI;AAEXG,MAAAA,WAAW,EAAE;AAFF;AA5BO,GAAP;AAAA,CAAf;;IAkCaO,M;;;;;;;;;;;;;;;8FASH;AACNC,MAAAA,KAAK,EAAE,MAAKC,KAAL,CAAWC;AADZ,K;mGAIK,0BAAS,MAAKD,KAAL,CAAWE,QAApB,EAA8B,GAA9B,C;iGAQF,UAAC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G,EAAEA,KADP;AAEE,UAAA,OAAO,EAAEtB,OAFX;AAGE,UAAA,MAAM,EAAEc,CAAC,CAACE,KAHZ;AAIE,UAAA,QAAQ,EAAE,kBAAA4B,GAAG;AAAA,mBAAI,MAAI,CAACC,eAAL,CAAqB/B,CAArB,EAAwB8B,GAAxB,EAA6BtB,KAA7B,CAAJ;AAAA,WAJf;AAKE,UAAA,QAAQ,EAAE;AAAA,mBAAM,MAAI,CAACwB,cAAL,CAAoBhC,CAApB,CAAN;AAAA;AALZ,UADU;AAAA,OAAZ,CALJ,CA7CF,CADF;AAgED;;;EArLmCZ,kBAAMC,S;;;iCAA/BM,gB,eACQ;AACjBC,EAAAA,OAAO,EAAEN,sBAAU2C,KADF;AAEjBnC,EAAAA,aAAa,EAAER,sBAAU2C,KAAV,CAAgBvC,UAFd;AAGjBR,EAAAA,OAAO,EAAEI,sBAAUC,MAAV,CAAiBG,UAHT;AAIjBG,EAAAA,QAAQ,EAAEP,sBAAUG,IAAV,CAAeC,UAJR;AAKjBe,EAAAA,aAAa,EAAEnB,sBAAUG,IAAV,CAAeC,UALb;AAMjBgB,EAAAA,aAAa,EAAEpB,sBAAUG,IANR;AAOjBuB,EAAAA,aAAa,EAAE1B,sBAAUG,IAAV,CAAeC,UAPb;AAQjBlB,EAAAA,KAAK,EAAEc,sBAAUE,MARA;AASjBmB,EAAAA,SAAS,EAAErB,sBAAU4C,MATJ;AAUjBZ,EAAAA,aAAa,EAAEhC,sBAAU6C;AAVR,C;AAuLrB,IAAMC,MAAM,GAAG,wBAAW9E,MAAX,EAAmBqC,gBAAnB,CAAf;eAEeyC,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash/debounce';\nimport isEqual from 'lodash/isEqual';\nimport OutlinedInput from '@material-ui/core/OutlinedInput';\nimport Button from '@material-ui/core/Button';\nimport Delete from '@material-ui/icons/Delete';\nimport IconButton from '@material-ui/core/IconButton';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport TextField from '@material-ui/core/TextField';\nimport { withStyles } from '@material-ui/core/styles';\nimport max from 'lodash/max';\n\nconst styles = () => ({\n altChoices: {\n alignItems: 'flex-start',\n flexDirection: 'column',\n display: 'flex',\n padding: '20px 0 0 0',\n '& > *': {\n marginBottom: '20px',\n width: '100%'\n }\n },\n choice: {\n flex: '1',\n marginRight: '20px'\n },\n deleteBtn: {\n fill: 'gray'\n },\n selectContainer: {\n alignItems: 'flex-end',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%'\n },\n rightContainer: {\n alignItems: 'center',\n display: 'flex',\n },\n lengthField: {\n width: '230px',\n marginRight: '20px'\n }\n});\n\nexport class Choice extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n markup: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n value: PropTypes.string\n };\n\n state = {\n value: this.props.markup\n };\n\n updateText = debounce(this.props.onChange, 300);\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (nextProps.markup) {\n this.setState({ value: nextProps.markup });\n }\n }\n\n onChange = (e) => {\n const { value } = e.target;\n\n this.setState({ value });\n this.updateText(value);\n };\n\n render() {\n const { value } = this.state;\n const { classes, onDelete } = this.props;\n\n return (\n <div\n style={{\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'space-between'\n }}\n >\n <OutlinedInput\n className={classes.choice}\n value={value}\n onChange={this.onChange}\n labelWidth={0}\n />\n <IconButton\n aria-label=\"delete\"\n className={classes.deleteBtn}\n onClick={onDelete}\n >\n <Delete />\n </IconButton>\n </div>\n );\n }\n}\n\nexport class AlternateSection extends React.Component {\n static propTypes = {\n choices: PropTypes.array,\n selectChoices: PropTypes.array.isRequired,\n classes: PropTypes.object.isRequired,\n onSelect: PropTypes.func.isRequired,\n choiceChanged: PropTypes.func.isRequired,\n lengthChanged: PropTypes.func,\n choiceRemoved: PropTypes.func.isRequired,\n value: PropTypes.string,\n maxLength: PropTypes.number,\n showMaxLength: PropTypes.bool\n };\n\n state = {};\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.updateChoicesIfNeeded(nextProps);\n }\n\n componentDidMount() {\n this.updateChoicesIfNeeded(this.props);\n }\n\n updateChoicesIfNeeded = props => {\n if (!this.state.choices\n || !isEqual(props.choices, this.state.choices)\n || !isEqual(props.choices, this.props.choices)\n ) {\n this.setState({\n choices: props.choices\n });\n }\n };\n\n handleSelect = e => {\n const { onSelect, selectChoices } = this.props;\n const { value } = e.target;\n\n onSelect(selectChoices.find(c => c.value === value));\n };\n\n onAddChoice = () => {\n const { choices } = this.state;\n\n if (choices.length && choices[choices.length - 1].label !== '') {\n const value = max(choices.map(c => parseInt(c.value)).filter(id => !isNaN(id))) || 0;\n\n this.setState({\n choices: [\n ...choices,\n {\n value: `${value + 1}`,\n label: ''\n }\n ]\n });\n }\n };\n\n onChoiceChanged = (choice, value, index) => {\n const { choiceChanged, lengthChanged, maxLength, choices } = this.props;\n\n const labelLengthsArr = choices.map(choice => (choice.label || '').length);\n labelLengthsArr[index] = value.length;\n\n const newLength = Math.max(...labelLengthsArr);\n\n choiceChanged({\n ...choice,\n label: value\n });\n\n if (newLength > maxLength || newLength + 10 <= maxLength) {\n lengthChanged(newLength);\n }\n };\n\n onRemoveChoice = choice => {\n const { choiceRemoved } = this.props;\n\n choiceRemoved(choice.value);\n };\n\n getChoicesMaxLength = () => {\n const { choices } = this.state;\n\n if (!choices) {\n return 1;\n }\n\n const labelLengthsArr = choices.map(choice => (choice.label || '').length);\n\n return Math.max(...labelLengthsArr);\n };\n\n changeLength = event => {\n const { lengthChanged } = this.props;\n const numberValue = parseInt(event.target.value, 10);\n const minLength = this.getChoicesMaxLength();\n\n if (numberValue && numberValue >= minLength && numberValue <= minLength + 10) {\n lengthChanged(numberValue);\n }\n };\n\n render() {\n const {\n classes,\n selectChoices,\n maxLength,\n showMaxLength,\n value\n } = this.props;\n const { choices } = this.state;\n const minLength = this.getChoicesMaxLength();\n\n return (\n <div className={classes.design}>\n <div\n className={classes.selectContainer}\n >\n <Select\n className={classes.select}\n displayEmpty\n onChange={this.handleSelect}\n value={value || ''}\n readOnly={showMaxLength}\n >\n <MenuItem value=\"\">\n <em>\n {value ? 'Remove selection' : 'Select a response'}\n </em>\n </MenuItem>\n {selectChoices.map((c, index) => <MenuItem key={index} value={c.value}>{c.label}</MenuItem>)}\n </Select>\n {\n choices && choices.length > 0 &&\n <div className={classes.rightContainer}>\n {maxLength && showMaxLength && (\n <TextField\n className={classes.lengthField}\n label=\"Maximum length (characters)\"\n type=\"number\"\n inputProps={{\n min: minLength,\n max: minLength + 10\n }}\n value={maxLength}\n onChange={this.changeLength}\n />\n )}\n <Button\n className={classes.addButton}\n variant=\"contained\"\n color=\"primary\"\n onClick={this.onAddChoice}\n >\n Add\n </Button>\n </div>\n }\n </div>\n <div\n className={classes.altChoices}\n >\n {\n choices &&\n choices.map((c, index) => index > 0 && (\n <Choice\n key={index}\n classes={classes}\n markup={c.label}\n onChange={val => this.onChoiceChanged(c, val, index)}\n onDelete={() => this.onRemoveChoice(c)}\n />\n ))\n }\n </div>\n </div>\n );\n }\n}\n\nconst Styled = withStyles(styles)(AlternateSection);\n\nexport default Styled;\n"],"file":"alternateSection.js"}
1
+ {"version":3,"sources":["../src/alternateSection.jsx"],"names":["styles","altChoices","alignItems","flexDirection","display","padding","marginBottom","width","choice","flex","marginRight","deleteBtn","fill","selectContainer","justifyContent","rightContainer","lengthField","Choice","value","props","markup","onChange","e","target","setState","updateText","nextProps","state","classes","onDelete","spellCheck","React","Component","PropTypes","object","string","func","isRequired","AlternateSection","choices","onSelect","selectChoices","find","c","length","label","map","parseInt","filter","id","isNaN","index","choiceChanged","lengthChanged","maxLength","labelLengthsArr","newLength","Math","max","choiceRemoved","event","numberValue","minLength","getChoicesMaxLength","updateChoicesIfNeeded","showMaxLength","design","select","handleSelect","min","changeLength","addButton","onAddChoice","val","onChoiceChanged","onRemoveChoice","array","number","bool","Styled"],"mappings":";;;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CAAC,MAAD;AACE,UAAA,GAAG,EAAEA,KADP;AAEE,UAAA,OAAO,EAAEvB,OAFX;AAGE,UAAA,MAAM,EAAEe,CAAC,CAACE,KAHZ;AAIE,UAAA,QAAQ,EAAE,kBAAA4B,GAAG;AAAA,mBAAI,MAAI,CAACC,eAAL,CAAqB/B,CAArB,EAAwB8B,GAAxB,EAA6BtB,KAA7B,CAAJ;AAAA,WAJf;AAKE,UAAA,QAAQ,EAAE;AAAA,mBAAM,MAAI,CAACwB,cAAL,CAAoBhC,CAApB,CAAN;AAAA,WALZ;AAME,UAAA,UAAU,EAAIb;AANhB,UADU;AAAA,OAAZ,CALJ,CA7CF,CADF;AAiED;;;EAvLmCC,kBAAMC,S;;;iCAA/BM,gB,eACQ;AACjBC,EAAAA,OAAO,EAAEN,sBAAU2C,KADF;AAEjBnC,EAAAA,aAAa,EAAER,sBAAU2C,KAAV,CAAgBvC,UAFd;AAGjBT,EAAAA,OAAO,EAAEK,sBAAUC,MAAV,CAAiBG,UAHT;AAIjBG,EAAAA,QAAQ,EAAEP,sBAAUG,IAAV,CAAeC,UAJR;AAKjBe,EAAAA,aAAa,EAAEnB,sBAAUG,IAAV,CAAeC,UALb;AAMjBgB,EAAAA,aAAa,EAAEpB,sBAAUG,IANR;AAOjBuB,EAAAA,aAAa,EAAE1B,sBAAUG,IAAV,CAAeC,UAPb;AAQjBnB,EAAAA,KAAK,EAAEe,sBAAUE,MARA;AASjBmB,EAAAA,SAAS,EAAErB,sBAAU4C,MATJ;AAUjBZ,EAAAA,aAAa,EAAEhC,sBAAU6C;AAVR,C;AAyLrB,IAAMC,MAAM,GAAG,wBAAW/E,MAAX,EAAmBsC,gBAAnB,CAAf;eAEeyC,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash/debounce';\nimport isEqual from 'lodash/isEqual';\nimport OutlinedInput from '@material-ui/core/OutlinedInput';\nimport Button from '@material-ui/core/Button';\nimport Delete from '@material-ui/icons/Delete';\nimport IconButton from '@material-ui/core/IconButton';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport TextField from '@material-ui/core/TextField';\nimport { withStyles } from '@material-ui/core/styles';\nimport max from 'lodash/max';\nimport { getAdjustedLength } from './markupUtils';\n\nconst styles = () => ({\n altChoices: {\n alignItems: 'flex-start',\n flexDirection: 'column',\n display: 'flex',\n padding: '20px 0 0 0',\n '& > *': {\n marginBottom: '20px',\n width: '100%'\n }\n },\n choice: {\n flex: '1',\n marginRight: '20px'\n },\n deleteBtn: {\n fill: 'gray'\n },\n selectContainer: {\n alignItems: 'flex-end',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%'\n },\n rightContainer: {\n alignItems: 'center',\n display: 'flex',\n },\n lengthField: {\n width: '230px',\n marginRight: '20px'\n }\n});\n\nexport class Choice extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n markup: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n value: PropTypes.string\n };\n\n state = {\n value: this.props.markup\n };\n\n updateText = debounce(this.props.onChange, 300);\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (nextProps.markup) {\n this.setState({ value: nextProps.markup });\n }\n }\n\n onChange = (e) => {\n const { value } = e.target;\n\n this.setState({ value });\n this.updateText(value);\n };\n\n render() {\n const { value } = this.state;\n const { classes, onDelete, spellCheck } = this.props;\n\n return (\n <div\n style={{\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'space-between'\n }}\n >\n <OutlinedInput\n className={classes.choice}\n value={value}\n onChange={this.onChange}\n labelWidth={0}\n disableUnderline\n spellCheck = {spellCheck}\n />\n <IconButton\n aria-label=\"delete\"\n className={classes.deleteBtn}\n onClick={onDelete}\n >\n <Delete />\n </IconButton>\n </div>\n );\n }\n}\n\nexport class AlternateSection extends React.Component {\n static propTypes = {\n choices: PropTypes.array,\n selectChoices: PropTypes.array.isRequired,\n classes: PropTypes.object.isRequired,\n onSelect: PropTypes.func.isRequired,\n choiceChanged: PropTypes.func.isRequired,\n lengthChanged: PropTypes.func,\n choiceRemoved: PropTypes.func.isRequired,\n value: PropTypes.string,\n maxLength: PropTypes.number,\n showMaxLength: PropTypes.bool\n };\n\n state = {};\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.updateChoicesIfNeeded(nextProps);\n }\n\n componentDidMount() {\n this.updateChoicesIfNeeded(this.props);\n }\n\n updateChoicesIfNeeded = props => {\n if (!this.state.choices\n || !isEqual(props.choices, this.state.choices)\n || !isEqual(props.choices, this.props.choices)\n ) {\n this.setState({\n choices: props.choices\n });\n }\n };\n\n handleSelect = e => {\n const { onSelect, selectChoices } = this.props;\n const { value } = e.target;\n\n onSelect(selectChoices.find(c => c.value === value));\n };\n\n onAddChoice = () => {\n const { choices } = this.state;\n\n if (choices.length && choices[choices.length - 1].label !== '') {\n const value = max(choices.map(c => parseInt(c.value)).filter(id => !isNaN(id))) || 0;\n\n this.setState({\n choices: [\n ...choices,\n {\n value: `${value + 1}`,\n label: ''\n }\n ]\n });\n }\n };\n\n onChoiceChanged = (choice, value, index) => {\n const { choiceChanged, lengthChanged, maxLength, choices } = this.props;\n\n const labelLengthsArr = choices.map(choice => (choice.label || '').length);\n labelLengthsArr[index] = value.length;\n\n const newLength = Math.max(...labelLengthsArr);\n\n choiceChanged({\n ...choice,\n label: value\n });\n\n if (newLength > maxLength || newLength + 10 <= maxLength) {\n lengthChanged(getAdjustedLength(newLength));\n }\n };\n\n onRemoveChoice = choice => {\n const { choiceRemoved } = this.props;\n\n choiceRemoved(choice.value);\n };\n\n getChoicesMaxLength = () => {\n const { choices } = this.state;\n\n if (!choices) {\n return 1;\n }\n\n const labelLengthsArr = choices.map(choice => (choice.label || '').length);\n\n return Math.max(...labelLengthsArr);\n };\n\n changeLength = event => {\n const { lengthChanged } = this.props;\n const numberValue = parseInt(event.target.value, 10);\n const minLength = this.getChoicesMaxLength();\n\n if (numberValue && numberValue >= minLength && numberValue <= minLength + 10) {\n lengthChanged(numberValue);\n }\n };\n\n render() {\n const {\n classes,\n selectChoices,\n maxLength,\n showMaxLength,\n value,\n spellCheck\n } = this.props;\n const { choices } = this.state;\n const minLength = this.getChoicesMaxLength();\n\n return (\n <div className={classes.design}>\n <div\n className={classes.selectContainer}\n >\n <Select\n className={classes.select}\n displayEmpty\n onChange={this.handleSelect}\n value={value || ''}\n readOnly={showMaxLength}\n >\n <MenuItem value=\"\">\n <em>\n {value ? 'Remove selection' : 'Select a response'}\n </em>\n </MenuItem>\n {selectChoices.map((c, index) => <MenuItem key={index} value={c.value}>{c.label}</MenuItem>)}\n </Select>\n {\n choices && choices.length > 0 &&\n <div className={classes.rightContainer}>\n {maxLength && showMaxLength && (\n <TextField\n className={classes.lengthField}\n label=\"Maximum length (characters)\"\n type=\"number\"\n inputProps={{\n min: minLength,\n max: minLength + 10\n }}\n value={maxLength}\n onChange={this.changeLength}\n />\n )}\n <Button\n className={classes.addButton}\n variant=\"contained\"\n color=\"primary\"\n onClick={this.onAddChoice}\n >\n Add\n </Button>\n </div>\n }\n </div>\n <div\n className={classes.altChoices}\n >\n {\n choices &&\n choices.map((c, index) => index > 0 && (\n <Choice\n key={index}\n classes={classes}\n markup={c.label}\n onChange={val => this.onChoiceChanged(c, val, index)}\n onDelete={() => this.onRemoveChoice(c)}\n spellCheck = {spellCheck}\n />\n ))\n }\n </div>\n </div>\n );\n }\n}\n\nconst Styled = withStyles(styles)(AlternateSection);\n\nexport default Styled;\n"],"file":"alternateSection.js"}
@@ -13,6 +13,7 @@ var _default = {
13
13
  markup: '<p>The {{0}} jumped {{1}} the {{2}}</p>',
14
14
  toolbarEditorPosition: 'bottom',
15
15
  displayType: 'block',
16
+ spellCheckEnabled: false,
16
17
  choices: {
17
18
  0: [{
18
19
  label: 'cow',
@@ -65,6 +66,11 @@ var _default = {
65
66
  settings: true,
66
67
  label: 'Rationale'
67
68
  },
69
+ spellCheck: {
70
+ label: "Spellcheck",
71
+ settings: true,
72
+ enabled: true
73
+ },
68
74
  teacherInstructions: {
69
75
  settings: true,
70
76
  label: 'Teacher Instructions'
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/defaults.js"],"names":["model","disabled","mode","prompt","shuffle","markup","toolbarEditorPosition","displayType","choices","label","value","correct","maxLengthPerChoiceEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","configuration","settings","partialScoring","rationale","teacherInstructions","maxLengthPerChoice"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE,KADL;AAELC,IAAAA,IAAI,EAAE,QAFD;AAGLC,IAAAA,MAAM,EAAE,yCAHH;AAILC,IAAAA,OAAO,EAAE,IAJJ;AAKLC,IAAAA,MAAM,EAAE,yCALH;AAMLC,IAAAA,qBAAqB,EAAE,QANlB;AAOLC,IAAAA,WAAW,EAAE,OAPR;AAQLC,IAAAA,OAAO,EAAE;AACP,SAAG,CACD;AACEC,QAAAA,KAAK,EAAE,KADT;AAEEC,QAAAA,KAAK,EAAE;AAFT,OADC,EAKD;AACED,QAAAA,KAAK,EAAE,QADT;AAEEC,QAAAA,KAAK,EAAE;AAFT,OALC,EASD;AACED,QAAAA,KAAK,EAAE,MADT;AAEEC,QAAAA,KAAK,EAAE,GAFT;AAGEC,QAAAA,OAAO,EAAE;AAHX,OATC,CADI;AAgBP,SAAG,CACD;AACEF,QAAAA,KAAK,EAAE,MADT;AAEEC,QAAAA,KAAK,EAAE;AAFT,OADC,EAKD;AACED,QAAAA,KAAK,EAAE,MADT;AAEEC,QAAAA,KAAK,EAAE;AAFT,OALC,EASD;AACED,QAAAA,KAAK,EAAE,QADT;AAEEC,QAAAA,KAAK,EAAE;AAFT,OATC,CAhBI;AA8BP,SAAG,CACD;AACED,QAAAA,KAAK,EAAE,MADT;AAEEC,QAAAA,KAAK,EAAE;AAFT,OADC,EAKD;AACED,QAAAA,KAAK,EAAE,WADT;AAEEC,QAAAA,KAAK,EAAE;AAFT,OALC,EASD;AACED,QAAAA,KAAK,EAAE,QADT;AAEEC,QAAAA,KAAK,EAAE;AAFT,OATC;AA9BI,KARJ;AAqDLE,IAAAA,yBAAyB,EAAE,IArDtB;AAsDLC,IAAAA,gBAAgB,EAAE,IAtDb;AAuDLC,IAAAA,aAAa,EAAE,IAvDV;AAwDLC,IAAAA,0BAA0B,EAAE,IAxDvB;AAyDLC,IAAAA,0BAA0B,EAAE;AAzDvB,GADM;AA4DbC,EAAAA,aAAa,EAAE;AACbd,IAAAA,MAAM,EAAE;AACNe,MAAAA,QAAQ,EAAE,IADJ;AAENT,MAAAA,KAAK,EAAE;AAFD,KADK;AAKbU,IAAAA,cAAc,EAAE;AACdD,MAAAA,QAAQ,EAAE,KADI;AAEdT,MAAAA,KAAK,EAAE;AAFO,KALH;AASbW,IAAAA,SAAS,EAAE;AACTF,MAAAA,QAAQ,EAAE,IADD;AAETT,MAAAA,KAAK,EAAE;AAFE,KATE;AAabY,IAAAA,mBAAmB,EAAE;AACnBH,MAAAA,QAAQ,EAAE,IADS;AAEnBT,MAAAA,KAAK,EAAE;AAFY,KAbR;AAiBba,IAAAA,kBAAkB,EAAE;AAClBJ,MAAAA,QAAQ,EAAE,IADQ;AAElBT,MAAAA,KAAK,EAAE;AAFW;AAjBP;AA5DF,C","sourcesContent":["export default {\n model: {\n disabled: false,\n mode: 'gather',\n prompt: 'Use the inputs to complete the sentence',\n shuffle: true,\n markup: '<p>The {{0}} jumped {{1}} the {{2}}</p>',\n toolbarEditorPosition: 'bottom',\n displayType: 'block',\n choices: {\n 0: [\n {\n label: 'cow',\n value: '0'\n },\n {\n label: 'cattle',\n value: '1'\n },\n {\n label: 'calf',\n value: '2',\n correct: false\n }\n ],\n 1: [\n {\n label: 'over',\n value: '0'\n },\n {\n label: 'past',\n value: '1'\n },\n {\n label: 'beyond',\n value: '2'\n }\n ],\n 2: [\n {\n label: 'moon',\n value: '0'\n },\n {\n label: 'satellite',\n value: '2'\n },\n {\n label: 'house ',\n value: '3'\n }\n ]\n },\n maxLengthPerChoiceEnabled: true,\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true\n },\n configuration: {\n prompt: {\n settings: true,\n label: 'Prompt'\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring'\n },\n rationale: {\n settings: true,\n label: 'Rationale'\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions'\n },\n maxLengthPerChoice: {\n settings: true,\n label: 'Maximum Length Per Choice'\n }\n }\n};\n"],"file":"defaults.js"}
1
+ {"version":3,"sources":["../src/defaults.js"],"names":["model","disabled","mode","prompt","shuffle","markup","toolbarEditorPosition","displayType","spellCheckEnabled","choices","label","value","correct","maxLengthPerChoiceEnabled","rationaleEnabled","promptEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","configuration","settings","partialScoring","rationale","spellCheck","enabled","teacherInstructions","maxLengthPerChoice"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE,KADL;AAELC,IAAAA,IAAI,EAAE,QAFD;AAGLC,IAAAA,MAAM,EAAE,yCAHH;AAILC,IAAAA,OAAO,EAAE,IAJJ;AAKLC,IAAAA,MAAM,EAAE,yCALH;AAMLC,IAAAA,qBAAqB,EAAE,QANlB;AAOLC,IAAAA,WAAW,EAAE,OAPR;AAQLC,IAAAA,iBAAiB,EAAC,KARb;AASLC,IAAAA,OAAO,EAAE;AACP,SAAG,CACD;AACEC,QAAAA,KAAK,EAAE,KADT;AAEEC,QAAAA,KAAK,EAAE;AAFT,OADC,EAKD;AACED,QAAAA,KAAK,EAAE,QADT;AAEEC,QAAAA,KAAK,EAAE;AAFT,OALC,EASD;AACED,QAAAA,KAAK,EAAE,MADT;AAEEC,QAAAA,KAAK,EAAE,GAFT;AAGEC,QAAAA,OAAO,EAAE;AAHX,OATC,CADI;AAgBP,SAAG,CACD;AACEF,QAAAA,KAAK,EAAE,MADT;AAEEC,QAAAA,KA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AAE;AAFW;AAtBP;AA7DF,C","sourcesContent":["export default {\n model: {\n disabled: false,\n mode: 'gather',\n prompt: 'Use the inputs to complete the sentence',\n shuffle: true,\n markup: '<p>The {{0}} jumped {{1}} the {{2}}</p>',\n toolbarEditorPosition: 'bottom',\n displayType: 'block',\n spellCheckEnabled:false,\n choices: {\n 0: [\n {\n label: 'cow',\n value: '0'\n },\n {\n label: 'cattle',\n value: '1'\n },\n {\n label: 'calf',\n value: '2',\n correct: false\n }\n ],\n 1: [\n {\n label: 'over',\n value: '0'\n },\n {\n label: 'past',\n value: '1'\n },\n {\n label: 'beyond',\n value: '2'\n }\n ],\n 2: [\n {\n label: 'moon',\n value: '0'\n },\n {\n label: 'satellite',\n value: '2'\n },\n {\n label: 'house ',\n value: '3'\n }\n ]\n },\n maxLengthPerChoiceEnabled: true,\n rationaleEnabled: true,\n promptEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true\n },\n configuration: {\n prompt: {\n settings: true,\n label: 'Prompt'\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring'\n },\n rationale: {\n settings: true,\n label: 'Rationale'\n },\n spellCheck: {\n label: \"Spellcheck\",\n settings:true,\n enabled:true\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions'\n },\n maxLengthPerChoice: {\n settings: true,\n label: 'Maximum Length Per Choice'\n }\n }\n};\n"],"file":"defaults.js"}
@@ -174,22 +174,25 @@ var Main = /*#__PURE__*/function (_React$Component) {
174
174
  var _this$props3 = _this.props,
175
175
  model = _this$props3.model,
176
176
  onModelChanged = _this$props3.onModelChanged;
177
- var choices = model.choices,
178
- maxLengthPerChoice = model.maxLengthPerChoice;
177
+ var choices = model.choices;
178
+ var maxLengthPerChoice = model.maxLengthPerChoice;
179
179
  var newValLength = (newVal || '').length;
180
180
 
181
181
  if (!choices[index]) {
182
182
  choices[index] = [{
183
- label: '',
183
+ label: newVal || '',
184
184
  value: '0'
185
- }];
186
- maxLengthPerChoice.splice(index, 0, newValLength);
187
- }
185
+ }]; // add default values for missing choices up to the new index position
188
186
 
189
- choices[index][0].label = newVal || '';
187
+ var nbOfMissingChoices = index > maxLengthPerChoice.length ? index - maxLengthPerChoice.length : 0;
188
+ maxLengthPerChoice = [].concat((0, _toConsumableArray2["default"])(maxLengthPerChoice), (0, _toConsumableArray2["default"])(Array(nbOfMissingChoices).fill(1)));
189
+ maxLengthPerChoice.splice(index, 0, (0, _markupUtils.getAdjustedLength)(newValLength));
190
+ } else {
191
+ choices[index][0].label = newVal || '';
190
192
 
191
- if (maxLengthPerChoice && newVal && maxLengthPerChoice[index] < newValLength) {
192
- maxLengthPerChoice[index] = newValLength;
193
+ if (maxLengthPerChoice && (maxLengthPerChoice[index] < newValLength || maxLengthPerChoice[index] > newValLength + 10)) {
194
+ maxLengthPerChoice[index] = (0, _markupUtils.getAdjustedLength)(newValLength);
195
+ }
193
196
  }
194
197
 
195
198
  onModelChanged(_objectSpread(_objectSpread({}, model), {}, {
@@ -331,13 +334,16 @@ var Main = /*#__PURE__*/function (_React$Component) {
331
334
  _ref$teacherInstructi = _ref.teacherInstructions,
332
335
  teacherInstructions = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi,
333
336
  _ref$maxLengthPerChoi = _ref.maxLengthPerChoice,
334
- maxLengthPerChoice = _ref$maxLengthPerChoi === void 0 ? {} : _ref$maxLengthPerChoi;
337
+ maxLengthPerChoice = _ref$maxLengthPerChoi === void 0 ? {} : _ref$maxLengthPerChoi,
338
+ _ref$spellCheck = _ref.spellCheck,
339
+ spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck;
335
340
 
336
341
  var _ref2 = model || {},
337
342
  teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled,
338
343
  promptEnabled = _ref2.promptEnabled,
339
344
  rationaleEnabled = _ref2.rationaleEnabled,
340
- maxLengthPerChoiceEnabled = _ref2.maxLengthPerChoiceEnabled;
345
+ maxLengthPerChoiceEnabled = _ref2.maxLengthPerChoiceEnabled,
346
+ spellCheckEnabled = _ref2.spellCheckEnabled;
341
347
 
342
348
  var toolbarOpts = {};
343
349
 
@@ -371,7 +377,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
371
377
  Properties: {
372
378
  teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
373
379
  rationaleEnabled: rationale.settings && toggle(rationale.label),
374
- promptEnabled: prompt.settings && toggle(prompt.label)
380
+ promptEnabled: prompt.settings && toggle(prompt.label),
381
+ spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label)
375
382
  }
376
383
  }
377
384
  })
@@ -384,7 +391,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
384
391
  onChange: this.onTeacherInstructionsChanged,
385
392
  imageSupport: imageSupport,
386
393
  nonEmpty: false,
387
- toolbarOpts: toolbarOpts
394
+ toolbarOpts: toolbarOpts,
395
+ spellCheck: spellCheckEnabled
388
396
  })), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
389
397
  label: prompt.label,
390
398
  className: classes.promptHolder
@@ -395,7 +403,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
395
403
  imageSupport: imageSupport,
396
404
  nonEmpty: false,
397
405
  disableUnderline: true,
398
- toolbarOpts: toolbarOpts
406
+ toolbarOpts: toolbarOpts,
407
+ spellCheck: spellCheckEnabled
399
408
  })), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
400
409
  className: classes.text
401
410
  }, "Define Template, Choices, and Correct Responses"), /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
@@ -403,6 +412,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
403
412
  toolbarOpts: {
404
413
  position: 'top'
405
414
  },
415
+ spellCheck: spellCheckEnabled,
406
416
  responseAreaProps: {
407
417
  type: 'explicit-constructed-response',
408
418
  options: {
@@ -438,7 +448,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
438
448
  model: model,
439
449
  onChange: this.onResponsesChanged,
440
450
  onLengthChange: this.onLengthChanged,
441
- maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled
451
+ maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled,
452
+ spellCheck: spellCheckEnabled
442
453
  }), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
443
454
  label: rationale.label,
444
455
  className: classes.promptHolder
@@ -447,7 +458,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
447
458
  markup: model.rationale || '',
448
459
  onChange: this.onRationaleChanged,
449
460
  imageSupport: imageSupport,
450
- toolbarOpts: toolbarOpts
461
+ toolbarOpts: toolbarOpts,
462
+ spellCheck: spellCheckEnabled
451
463
  })))));
452
464
  }
453
465
  }]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.jsx"],"names":["toggle","settings","Panel","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","markup","minHeight","design","choiceConfiguration","switchElement","justifyContent","margin","addButton","text","color","fontFamily","fontSize","lineHeight","marginTop","createElementFromHTML","htmlString","div","document","createElement","innerHTML","trim","Main","newVal","props","onModelChanged","model","rationale","teacherInstructions","slateMarkup","choices","maxLengthPerChoice","index","newValLength","length","label","value","splice","domMarkup","allRespAreas","querySelectorAll","allChoices","updatedMaxLengthPerChoice","forEach","el","newChoices","dataset","callback","setState","cachedChoices","undefined","nodes","state","newCachedChoices","node","keyForNode","data","get","Object","assign","hasOwnProperty","trailing","leading","undefinedLengths","values","choice","labelLengthsArr","map","Math","max","classes","configuration","onConfigurationChanged","imageSupport","partialScoring","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","maxLengthPerChoiceEnabled","toolbarOpts","toolbarEditorPosition","position","onModelChange","Settings","Properties","onTeacherInstructionsChanged","onPromptChanged","ALL_PLUGINS","type","options","duplicates","respAreaToolbar","onToolbarDone","correctChoice","onChangeResponse","onHandleAreaChange","onChange","onBlur","onResponsesChanged","onLengthChanged","onRationaleChanged","React","Component","PropTypes","object","isRequired","disableSidePanel","bool","func","sh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Y,EAAE3B,YAJhB;AAKE,QAAA,WAAW,EAAEM;AALf,QAJF,CAnFJ,CA5BF,CADF,CADF;AAkID;;;EAzWuBsB,kBAAMC,S;;;iCAAnBhF,I,eACQ;AACjBiD,EAAAA,aAAa,EAAEgC,sBAAUC,MAAV,CAAiBC,UADf;AAEjB/E,EAAAA,KAAK,EAAE6E,sBAAUC,MAAV,CAAiBC,UAFP;AAGjBC,EAAAA,gBAAgB,EAAEH,sBAAUI,IAHX;AAIjBlF,EAAAA,cAAc,EAAE8E,sBAAUK,IAAV,CAAeH,UAJd;AAKjBjC,EAAAA,sBAAsB,EAAE+B,sBAAUK,IAAV,CAAeH,UALtB;AAMjBnC,EAAAA,OAAO,EAAEiC,sBAAUC,MAAV,CAAiBC,UANT;AAOjBhC,EAAAA,YAAY,EAAE8B,sBAAUM,KAAV,CAAgB;AAC5BC,IAAAA,GAAG,EAAEP,sBAAUK,IAAV,CAAeH,UADQ;AAE5B,cAAQF,sBAAUK,IAAV,CAAeH;AAFK,GAAhB;AAPG,C;AA2WrB,IAAMM,MAAM,GAAG,wBAAWxH,MAAX,EAAmB+B,IAAnB,CAAf;eAEeyF,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport cloneDeep from 'lodash/cloneDeep';\nimport isEmpty from 'lodash/isEmpty';\nimport pick from 'lodash/pick';\nimport throttle from 'lodash/throttle';\nimport EditableHtml, {ALL_PLUGINS} from '@pie-lib/editable-html';\nimport {InputContainer, layout, settings} from '@pie-lib/config-ui';\nimport {withStyles} from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport ECRToolbar from './ecr-toolbar';\nimport AlternateResponses from './alternateResponses';\nimport { getAdjustedLength } from './markupUtils';\n\nconst { toggle, Panel } = settings;\n\nconst styles = theme => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%'\n },\n markup: {\n minHeight: '100px',\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n '& [data-slate-editor=\"true\"]': {\n minHeight: '100px'\n }\n },\n design: {\n paddingTop: theme.spacing.unit * 3\n },\n choiceConfiguration: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0\n },\n addButton: {\n float: 'right'\n },\n text: {\n color: '#495B8F',\n fontFamily: 'Cerebri Sans',\n fontSize: '16px',\n lineHeight: '19px',\n marginTop: theme.spacing.unit * 4\n }\n});\n\nconst createElementFromHTML = htmlString => {\n const div = document.createElement('div');\n\n div.innerHTML = htmlString.trim();\n\n return div;\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n configuration: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n })\n };\n\n state = {};\n\n componentDidMount() {\n const {\n model: { slateMarkup, choices, maxLengthPerChoice = []},\n onModelChanged\n } = this.props;\n const undefinedLengths = !maxLengthPerChoice.length;\n\n this.setState({ markup: slateMarkup });\n\n // calculate maxLengthPerChoice array if it is not defined or defined incorrectly\n Object.values(choices).forEach((choice, index) => {\n const labelLengthsArr = (choice || []).map(choice => (choice.label || '').length);\n const length = Math.max(...labelLengthsArr);\n\n if (\n undefinedLengths\n || !maxLengthPerChoice[index]\n || maxLengthPerChoice[index] < length\n || maxLengthPerChoice[index] > length + 10\n ) {\n maxLengthPerChoice[index] = getAdjustedLength(length);\n }\n });\n\n onModelChanged({\n ...this.props.model,\n maxLengthPerChoice\n });\n }\n\n onModelChange = newVal => {\n this.props.onModelChanged({\n ...this.props.model,\n ...newVal\n });\n };\n\n onPromptChanged = prompt => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt\n });\n };\n\n onRationaleChanged = rationale => {\n this.props.onModelChanged({\n ...this.props.model,\n rationale\n });\n };\n\n onTeacherInstructionsChanged = teacherInstructions => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n teacherInstructions\n });\n };\n\n onMarkupChanged = slateMarkup => {\n this.props.onModelChanged({\n ...this.props.model,\n slateMarkup\n });\n };\n\n onResponsesChanged = choices => {\n this.props.onModelChanged({\n ...this.props.model,\n choices\n });\n };\n\n onLengthChanged = maxLengthPerChoice => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n maxLengthPerChoice\n });\n };\n\n onChangeResponse = (index, newVal) => {\n const { model, onModelChanged} = this.props;\n const { choices, maxLengthPerChoice } = model;\n const newValLength = (newVal || '').length;\n\n if (!choices[index]) {\n choices[index] = [{ label: '', value: '0' }];\n maxLengthPerChoice.splice(index, 0, newValLength);\n }\n\n choices[index][0].label = newVal || '';\n\n if (maxLengthPerChoice && newVal && maxLengthPerChoice[index] < newValLength) {\n maxLengthPerChoice[index] = newValLength;\n }\n\n onModelChanged({\n ...model,\n choices,\n maxLengthPerChoice\n });\n };\n\n onChange = markup => {\n const {\n model: { choices, maxLengthPerChoice },\n onModelChanged\n } = this.props;\n const domMarkup = createElementFromHTML(markup);\n const allRespAreas = domMarkup.querySelectorAll(\n '[data-type=\"explicit_constructed_response\"]'\n );\n\n const allChoices = {};\n const updatedMaxLengthPerChoice = [];\n\n allRespAreas.forEach((el, index) => {\n const newChoices = cloneDeep(choices[el.dataset.index]);\n\n if (newChoices) {\n newChoices[0] = {\n label: el.dataset.value || '',\n value: '0'\n };\n\n updatedMaxLengthPerChoice[index] = maxLengthPerChoice[el.dataset.index];\n }\n\n allChoices[index] = newChoices;\n el.dataset.index = index;\n });\n\n const callback = () => onModelChanged({\n ...this.props.model,\n choices: allChoices,\n slateMarkup: domMarkup.innerHTML,\n maxLengthPerChoice: updatedMaxLengthPerChoice\n });\n\n this.setState({\n cachedChoices: undefined\n }, callback);\n };\n\n onHandleAreaChange = throttle((nodes) => {\n const {\n model: { choices },\n onModelChanged\n } = this.props;\n const { cachedChoices } = this.state;\n\n if (!nodes) {\n return;\n }\n\n const newChoices = choices ? cloneDeep(choices) : {};\n const newCachedChoices = cachedChoices ? cloneDeep(cachedChoices) : {};\n\n nodes.forEach((node) => {\n const keyForNode = node.data.get('index');\n\n if (!newChoices[keyForNode] && newCachedChoices[keyForNode]) {\n Object.assign(newChoices, pick(newCachedChoices, keyForNode));\n\n if (newCachedChoices.hasOwnProperty(keyForNode)) {\n delete newCachedChoices[keyForNode];\n }\n } else {\n Object.assign(newCachedChoices, pick(newChoices, keyForNode));\n\n if (newChoices.hasOwnProperty(keyForNode)) {\n delete newChoices[keyForNode];\n }\n }\n });\n\n const callback = () => onModelChanged({\n ...this.props.model,\n choices: newChoices\n });\n\n this.setState({\n cachedChoices: newCachedChoices\n }, callback);\n }, 500, { trailing: false, leading: true });\n\n render() {\n const {\n classes,\n model,\n configuration,\n onConfigurationChanged,\n imageSupport\n } = this.props;\n const {\n prompt = {},\n partialScoring = {},\n rationale = {},\n teacherInstructions = {},\n maxLengthPerChoice = {}\n } = configuration || {};\n const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, maxLengthPerChoiceEnabled } = model || {};\n const toolbarOpts = {};\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n return (\n <div className={classes.design}>\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={model => this.onModelChange(model)}\n onChangeConfiguration={configuration =>\n onConfigurationChanged(configuration, true)\n }\n groups={{\n Settings: {\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n maxLengthPerChoiceEnabled:\n maxLengthPerChoice.settings && toggle(maxLengthPerChoice.label),\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n promptEnabled: prompt.settings && toggle(prompt.label)\n }\n }}\n />\n }\n >\n <div>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n {promptEnabled && (\n <InputContainer\n label={prompt.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n <Typography className={classes.text}>\n Define Template, Choices, and Correct Responses\n </Typography>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n toolbarOpts={{ position: 'top' }}\n responseAreaProps={{\n type: 'explicit-constructed-response',\n options: {\n duplicates: true\n },\n respAreaToolbar: (node, value, onToolbarDone) => {\n const { model } = this.props;\n const correctChoice = (model.choices[\n node.data.get('index')\n ] || [])[0];\n\n return () => (\n <ECRToolbar\n onChangeResponse={newVal =>\n this.onChangeResponse(node.data.get('index'), newVal)\n }\n node={node}\n value={value}\n onToolbarDone={onToolbarDone}\n correctChoice={correctChoice}\n />\n );\n },\n onHandleAreaChange: this.onHandleAreaChange\n }}\n className={classes.markup}\n markup={model.slateMarkup}\n onChange={this.onChange}\n imageSupport={imageSupport}\n onBlur={this.onBlur}\n disabled={false}\n highlightShape={false}\n />\n {!isEmpty(model.choices) && (\n <Typography className={classes.text}>\n {`Define Alternates ${maxLengthPerChoiceEnabled ? 'and Character Limits' : ''}`}\n </Typography>\n )}\n <AlternateResponses\n model={model}\n onChange={this.onResponsesChanged}\n onLengthChange={this.onLengthChanged}\n maxLengthPerChoiceEnabled={maxLengthPerChoiceEnabled}\n />\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChanged}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n />\n </InputContainer>\n )}\n </div>\n </layout.ConfigLayout>\n </div>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
1
+ {"version":3,"sources":["../src/main.jsx"],"names":["toggle","settings","Panel","styles","theme","promptHolder","width","paddingBottom","spacing","unit","marginBottom","prompt","paddingTop","markup","minHeight","design","choiceConfiguration","switchElement","justifyContent","margin","addButton","text","color","fontFamily","fontSize","lineHeight","marginTop","createElementFromHTML","htmlString","div","document","createElement","innerHTML","trim","Main","newVal","props","onModelChanged","model","rationale","teacherInstructions","slateMarkup","choices","maxLengthPerChoice","index","newValLength","length","label","value","nbOfMissingChoices","Array","fill","splice","domMarkup","allRespAreas","querySelectorAll","allChoices","updatedMaxLengthPerChoice","forEach","el","newChoices","dataset","callback","setState","cachedChoices","undefined","nodes","state","newCachedChoices","node","keyForNode","data","get","Object","assign","hasOwnProperty","trailing","leading","undefinedLengths","values","choice","labelLengthsArr","map","Math","max","classes","configuration","onConfigurationChanged","imageSupport","partialScoring","spellCheck","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","maxLengthPerChoiceEnabled","spellCheckEnabled","toolbarOpts","toolbarEditorPosition","position","onModelChange","Settings","Properties","onTeacherInstructionsChanged","onPromptChanged","ALL_PLUGINS","type","options","duplicates","respAreaToolbar","onToolbarDone","correctChoice","onChangeResponse","onHandleAreaChange","onChange","onBlur","onResponsesChanged","onLengthChanged","onRationaleChanged","React","Component","PropTypes","object","isRequired","disableSidePanel","bool","func","shape","add","Styled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,IAAQA,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,wBAAW7H,MAAX,EAAmB+B,IAAnB,CAAf;eAEe8F,M","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport cloneDeep from 'lodash/cloneDeep';\nimport isEmpty from 'lodash/isEmpty';\nimport pick from 'lodash/pick';\nimport throttle from 'lodash/throttle';\nimport EditableHtml, {ALL_PLUGINS} from '@pie-lib/editable-html';\nimport {InputContainer, layout, settings} from '@pie-lib/config-ui';\nimport {withStyles} from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport ECRToolbar from './ecr-toolbar';\nimport AlternateResponses from './alternateResponses';\nimport { getAdjustedLength } from './markupUtils';\n\nconst { toggle, Panel } = settings;\n\nconst styles = theme => ({\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%'\n },\n markup: {\n minHeight: '100px',\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n '& [data-slate-editor=\"true\"]': {\n minHeight: '100px'\n }\n },\n design: {\n paddingTop: theme.spacing.unit * 3\n },\n choiceConfiguration: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2\n },\n switchElement: {\n justifyContent: 'space-between',\n margin: 0\n },\n addButton: {\n float: 'right'\n },\n text: {\n color: '#495B8F',\n fontFamily: 'Cerebri Sans',\n fontSize: '16px',\n lineHeight: '19px',\n marginTop: theme.spacing.unit * 4\n }\n});\n\nconst createElementFromHTML = htmlString => {\n const div = document.createElement('div');\n\n div.innerHTML = htmlString.trim();\n\n return div;\n};\n\nexport class Main extends React.Component {\n static propTypes = {\n configuration: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n disableSidePanel: PropTypes.bool,\n onModelChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n classes: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func.isRequired,\n delete: PropTypes.func.isRequired\n })\n };\n\n state = {};\n\n componentDidMount() {\n const {\n model: { slateMarkup, choices, maxLengthPerChoice = []},\n onModelChanged\n } = this.props;\n const undefinedLengths = !maxLengthPerChoice.length;\n\n this.setState({ markup: slateMarkup });\n\n // calculate maxLengthPerChoice array if it is not defined or defined incorrectly\n Object.values(choices).forEach((choice, index) => {\n const labelLengthsArr = (choice || []).map(choice => (choice.label || '').length);\n const length = Math.max(...labelLengthsArr);\n\n if (\n undefinedLengths\n || !maxLengthPerChoice[index]\n || maxLengthPerChoice[index] < length\n || maxLengthPerChoice[index] > length + 10\n ) {\n maxLengthPerChoice[index] = getAdjustedLength(length);\n }\n });\n\n onModelChanged({\n ...this.props.model,\n maxLengthPerChoice\n });\n }\n\n onModelChange = newVal => {\n this.props.onModelChanged({\n ...this.props.model,\n ...newVal\n });\n };\n\n onPromptChanged = prompt => {\n this.props.onModelChanged({\n ...this.props.model,\n prompt\n });\n };\n\n onRationaleChanged = rationale => {\n this.props.onModelChanged({\n ...this.props.model,\n rationale\n });\n };\n\n onTeacherInstructionsChanged = teacherInstructions => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n teacherInstructions\n });\n };\n\n onMarkupChanged = slateMarkup => {\n this.props.onModelChanged({\n ...this.props.model,\n slateMarkup\n });\n };\n\n onResponsesChanged = choices => {\n this.props.onModelChanged({\n ...this.props.model,\n choices\n });\n };\n\n onLengthChanged = maxLengthPerChoice => {\n const { model, onModelChanged } = this.props;\n\n onModelChanged({\n ...model,\n maxLengthPerChoice\n });\n };\n\n onChangeResponse = (index, newVal) => {\n const { model, onModelChanged} = this.props;\n const { choices } = model;\n let { maxLengthPerChoice } = model;\n const newValLength = (newVal || '').length;\n\n if (!choices[index]) {\n choices[index] = [{ label: newVal || '', value: '0' }];\n\n // add default values for missing choices up to the new index position\n const nbOfMissingChoices = index > maxLengthPerChoice.length ? index - maxLengthPerChoice.length : 0;\n\n maxLengthPerChoice = [ ...maxLengthPerChoice, ...Array(nbOfMissingChoices).fill(1) ];\n\n maxLengthPerChoice.splice(index, 0, getAdjustedLength(newValLength));\n } else {\n choices[index][0].label = newVal || '';\n\n if (\n maxLengthPerChoice\n && (maxLengthPerChoice[index] < newValLength || maxLengthPerChoice[index] > newValLength + 10)\n ) {\n maxLengthPerChoice[index] = getAdjustedLength(newValLength);\n }\n }\n\n onModelChanged({\n ...model,\n choices,\n maxLengthPerChoice\n });\n };\n\n onChange = markup => {\n const {\n model: { choices, maxLengthPerChoice },\n onModelChanged\n } = this.props;\n const domMarkup = createElementFromHTML(markup);\n const allRespAreas = domMarkup.querySelectorAll(\n '[data-type=\"explicit_constructed_response\"]'\n );\n\n const allChoices = {};\n const updatedMaxLengthPerChoice = [];\n\n allRespAreas.forEach((el, index) => {\n const newChoices = cloneDeep(choices[el.dataset.index]);\n\n if (newChoices) {\n newChoices[0] = {\n label: el.dataset.value || '',\n value: '0'\n };\n\n updatedMaxLengthPerChoice[index] = maxLengthPerChoice[el.dataset.index];\n }\n\n allChoices[index] = newChoices;\n el.dataset.index = index;\n });\n\n const callback = () => onModelChanged({\n ...this.props.model,\n choices: allChoices,\n slateMarkup: domMarkup.innerHTML,\n maxLengthPerChoice: updatedMaxLengthPerChoice\n });\n\n this.setState({\n cachedChoices: undefined\n }, callback);\n };\n\n onHandleAreaChange = throttle((nodes) => {\n const {\n model: { choices },\n onModelChanged\n } = this.props;\n const { cachedChoices } = this.state;\n\n if (!nodes) {\n return;\n }\n\n const newChoices = choices ? cloneDeep(choices) : {};\n const newCachedChoices = cachedChoices ? cloneDeep(cachedChoices) : {};\n\n nodes.forEach((node) => {\n const keyForNode = node.data.get('index');\n\n if (!newChoices[keyForNode] && newCachedChoices[keyForNode]) {\n Object.assign(newChoices, pick(newCachedChoices, keyForNode));\n\n if (newCachedChoices.hasOwnProperty(keyForNode)) {\n delete newCachedChoices[keyForNode];\n }\n } else {\n Object.assign(newCachedChoices, pick(newChoices, keyForNode));\n\n if (newChoices.hasOwnProperty(keyForNode)) {\n delete newChoices[keyForNode];\n }\n }\n });\n\n const callback = () => onModelChanged({\n ...this.props.model,\n choices: newChoices\n });\n\n this.setState({\n cachedChoices: newCachedChoices\n }, callback);\n }, 500, { trailing: false, leading: true });\n\n render() {\n const {\n classes,\n model,\n configuration,\n onConfigurationChanged,\n imageSupport\n } = this.props;\n const {\n prompt = {},\n partialScoring = {},\n rationale = {},\n teacherInstructions = {},\n maxLengthPerChoice = {},\n spellCheck = {}\n } = configuration || {};\n const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, maxLengthPerChoiceEnabled, spellCheckEnabled } = model || {};\n const toolbarOpts = {};\n\n switch (model.toolbarEditorPosition) {\n case 'top':\n toolbarOpts.position = 'top';\n break;\n default:\n toolbarOpts.position = 'bottom';\n break;\n }\n return (\n <div className={classes.design}>\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={model => this.onModelChange(model)}\n onChangeConfiguration={configuration =>\n onConfigurationChanged(configuration, true)\n }\n groups={{\n Settings: {\n partialScoring:\n partialScoring.settings && toggle(partialScoring.label),\n maxLengthPerChoiceEnabled:\n maxLengthPerChoice.settings && toggle(maxLengthPerChoice.label),\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n rationaleEnabled:\n rationale.settings && toggle(rationale.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n }\n }}\n />\n }\n >\n <div>\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n {promptEnabled && (\n <InputContainer\n label={prompt.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n disableUnderline\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n <Typography className={classes.text}>\n Define Template, Choices, and Correct Responses\n </Typography>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n toolbarOpts={{ position: 'top' }}\n spellCheck={spellCheckEnabled}\n responseAreaProps={{\n type: 'explicit-constructed-response',\n options: {\n duplicates: true\n },\n respAreaToolbar: (node, value, onToolbarDone) => {\n const { model } = this.props;\n const correctChoice = (model.choices[\n node.data.get('index')\n ] || [])[0];\n\n return () => (\n <ECRToolbar\n onChangeResponse={newVal =>\n this.onChangeResponse(node.data.get('index'), newVal)\n }\n node={node}\n value={value}\n onToolbarDone={onToolbarDone}\n correctChoice={correctChoice}\n />\n );\n },\n onHandleAreaChange: this.onHandleAreaChange\n }}\n className={classes.markup}\n markup={model.slateMarkup}\n onChange={this.onChange}\n imageSupport={imageSupport}\n onBlur={this.onBlur}\n disabled={false}\n highlightShape={false}\n />\n {!isEmpty(model.choices) && (\n <Typography className={classes.text}>\n {`Define Alternates ${maxLengthPerChoiceEnabled ? 'and Character Limits' : ''}`}\n </Typography>\n )}\n <AlternateResponses\n model={model}\n onChange={this.onResponsesChanged}\n onLengthChange={this.onLengthChanged}\n maxLengthPerChoiceEnabled={maxLengthPerChoiceEnabled}\n spellCheck={spellCheckEnabled}\n />\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChanged}\n imageSupport={imageSupport}\n toolbarOpts={toolbarOpts}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n </div>\n </layout.ConfigLayout>\n </div>\n );\n }\n}\n\nconst Styled = withStyles(styles)(Main);\n\nexport default Styled;\n"],"file":"main.js"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/explicit-constructed-response-configure",
3
- "version": "3.7.4",
3
+ "version": "3.7.5",
4
4
  "private": true,
5
5
  "main": "lib/index.js",
6
6
  "modue": "src/index.js",
@@ -8,8 +8,8 @@
8
8
  "@material-ui/core": "^3.9.2",
9
9
  "@material-ui/icons": "^3.0.1",
10
10
  "@pie-framework/pie-configure-events": "^1.2.0",
11
- "@pie-lib/config-ui": "^10.10.23",
12
- "@pie-lib/editable-html": "^7.19.2",
11
+ "@pie-lib/config-ui": "^10.10.24",
12
+ "@pie-lib/editable-html": "^7.19.3",
13
13
  "classnames": "^2.2.6",
14
14
  "debug": "^3.1.0",
15
15
  "lodash": "^4.17.15",
@@ -51,6 +51,22 @@
51
51
  }
52
52
  }
53
53
  },
54
+ "spellCheck": {
55
+ "title": "ConfigureProp",
56
+ "type": "object",
57
+ "properties": {
58
+ "settings": {
59
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
60
+ "type": "boolean",
61
+ "title": "settings"
62
+ },
63
+ "label": {
64
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
65
+ "type": "string",
66
+ "title": "label"
67
+ }
68
+ }
69
+ },
54
70
  "autoScoring": {
55
71
  "title": "ConfigureProp",
56
72
  "type": "object",
@@ -38,6 +38,18 @@ Indicates if the item has to be displayed in the Settings Panel
38
38
 
39
39
  Indicates the label for the item that has to be displayed in the Settings Panel
40
40
 
41
+ # `spellCheck` (object)
42
+
43
+ Properties of the `spellCheck` object:
44
+
45
+ ## `settings` (boolean)
46
+
47
+ Indicates if the item has to be displayed in the Settings Panel
48
+
49
+ ## `label` (string)
50
+
51
+ Indicates the label for the item that has to be displayed in the Settings Panel
52
+
41
53
  # `autoScoring` (object)
42
54
 
43
55
  Properties of the `autoScoring` object:
@@ -54,6 +54,11 @@
54
54
  "type": "boolean",
55
55
  "title": "promptEnabled"
56
56
  },
57
+ "spellCheckEnabled": {
58
+ "description": "Indicates if spellcheck is enabled",
59
+ "type": "boolean",
60
+ "title": "spellCheckEnabled"
61
+ },
57
62
  "rationale": {
58
63
  "description": "Indicates correct answer rationale",
59
64
  "type": "string",
@@ -142,6 +147,7 @@
142
147
  "rationale",
143
148
  "rationaleEnabled",
144
149
  "rubric",
150
+ "spellCheckEnabled",
145
151
  "studentInstructionsEnabled",
146
152
  "teacherInstructionsEnabled"
147
153
  ],
@@ -23,6 +23,10 @@ The item stem for the question
23
23
 
24
24
  Indicates if the prompt is enabled
25
25
 
26
+ # `spellCheckEnabled` (boolean, required)
27
+
28
+ Indicates if spellcheck is enabled
29
+
26
30
  # `rationale` (string, required)
27
31
 
28
32
  Indicates correct answer rationale
@@ -1,6 +1,6 @@
1
- import {_dll_react, _dll_prop_types, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_lodash, _dll_material_ui__icons, _dll_react_dom, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.2/module/index.js";
2
- import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.2.1/module/index.js";
3
- import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.25/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_lodash, _dll_material_ui__icons, _dll_react_dom, _dll_debug} from "../../../@pie-lib/shared-module@^1.4.8/module/index.js";
2
+ import {_dll_pie_lib__editable_html} from "../../../@pie-lib/editable-html-module@^1.2.7/module/index.js";
3
+ import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.31/module/index.js";
4
4
  function getDefaultExportFromCjs(x) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
6
6
  }
@@ -597,6 +597,62 @@ const {OutlinedInput: require$$11$4} = _dll_material_ui__core;
597
597
  getDefaultExportFromCjs(ecrToolbar);
598
598
  var alternateResponses = {};
599
599
  var alternateSection = {};
600
+ var markupUtils = {};
601
+ const {escape: require$$1} = _dll_lodash;
602
+ var _interopRequireDefault = interopRequireDefault.exports;
603
+ Object.defineProperty(markupUtils, "__esModule", {
604
+ value: true
605
+ });
606
+ markupUtils.getAdjustedLength = markupUtils.createSlateMarkup = markupUtils.processMarkup = markupUtils.removeUnwantedCharacters = void 0;
607
+ var _escape = _interopRequireDefault(require$$1);
608
+ var tSymbols = 'imes|riangle|an|heta|herefore';
609
+ var nSymbols = 'throot|parallel|cong|approx|eq|e|sim';
610
+ var matchTabAndNewLine = new RegExp(("(\\t(?!").concat(tSymbols, "))|(\\n(?!").concat(nSymbols, "))|(\\\\t(?!").concat(tSymbols, "))|(\\\\n(?!").concat(nSymbols, "))"), 'g');
611
+ var removeUnwantedCharacters = function removeUnwantedCharacters(markup) {
612
+ return markup.replace(matchTabAndNewLine, '').replace(/\\"/g, '"').replace(/\\\//g, '/');
613
+ };
614
+ markupUtils.removeUnwantedCharacters = removeUnwantedCharacters;
615
+ var createElementFromHTML = function createElementFromHTML() {
616
+ var htmlString = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
617
+ var div = document.createElement('div');
618
+ div.innerHTML = htmlString.trim();
619
+ return div;
620
+ };
621
+ var processMarkup = function processMarkup(markup) {
622
+ var newMarkup = removeUnwantedCharacters(markup || '');
623
+ var slateMarkup = createElementFromHTML(newMarkup || '');
624
+ var index = 0;
625
+ slateMarkup.querySelectorAll('[data-type="explicit_constructed_response"]').forEach(function (s) {
626
+ s.replaceWith(("{{").concat(index++, "}}"));
627
+ });
628
+ return slateMarkup.innerHTML;
629
+ };
630
+ markupUtils.processMarkup = processMarkup;
631
+ var REGEX = /\{\{(\d+)\}\}/g;
632
+ var createSlateMarkup = function createSlateMarkup(markup, choices) {
633
+ if (!markup) {
634
+ return '';
635
+ }
636
+ var newMarkup = removeUnwantedCharacters(markup);
637
+ return newMarkup.replace(REGEX, function (match, g) {
638
+ var label = choices[g][0].label || '';
639
+ return ("<span data-type=\"explicit_constructed_response\" data-index=\"").concat(g, "\" data-value=\"").concat((0, _escape["default"])(label), "\"></span>");
640
+ });
641
+ };
642
+ markupUtils.createSlateMarkup = createSlateMarkup;
643
+ var getAdjustedLength = function getAdjustedLength(length) {
644
+ if (length <= 2) {
645
+ return length + 2;
646
+ }
647
+ if (length <= 4) {
648
+ return length + 3;
649
+ }
650
+ if (length <= 6) {
651
+ return length + 4;
652
+ }
653
+ return length + 5;
654
+ };
655
+ markupUtils.getAdjustedLength = getAdjustedLength;
600
656
  const require$$9$2 = _dll_react;
601
657
  const require$$10$3 = _dll_prop_types;
602
658
  const {debounce: require$$11$3} = _dll_lodash;
@@ -637,6 +693,7 @@ const require$$20 = _dll_material_ui__core_styles;
637
693
  var _TextField = _interopRequireDefault(require$$19$1);
638
694
  var _styles = require$$20;
639
695
  var _max = _interopRequireDefault(require$$21);
696
+ var _markupUtils = markupUtils;
640
697
  function ownKeys(object, enumerableOnly) {
641
698
  var keys = Object.keys(object);
642
699
  if (Object.getOwnPropertySymbols) {
@@ -762,7 +819,7 @@ const require$$20 = _dll_material_ui__core_styles;
762
819
  key: "render",
763
820
  value: function render() {
764
821
  var value = this.state.value;
765
- var _this$props = this.props, classes = _this$props.classes, onDelete = _this$props.onDelete;
822
+ var _this$props = this.props, classes = _this$props.classes, onDelete = _this$props.onDelete, spellCheck = _this$props.spellCheck;
766
823
  return _react["default"].createElement("div", {
767
824
  style: {
768
825
  alignItems: 'center',
@@ -773,7 +830,9 @@ const require$$20 = _dll_material_ui__core_styles;
773
830
  className: classes.choice,
774
831
  value: value,
775
832
  onChange: this.onChange,
776
- labelWidth: 0
833
+ labelWidth: 0,
834
+ disableUnderline: true,
835
+ spellCheck: spellCheck
777
836
  }), _react["default"].createElement(_IconButton["default"], {
778
837
  "aria-label": "delete",
779
838
  className: classes.deleteBtn,
@@ -843,7 +902,7 @@ const require$$20 = _dll_material_ui__core_styles;
843
902
  label: value
844
903
  }));
845
904
  if (newLength > maxLength || newLength + 10 <= maxLength) {
846
- lengthChanged(newLength);
905
+ lengthChanged((0, _markupUtils.getAdjustedLength)(newLength));
847
906
  }
848
907
  });
849
908
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onRemoveChoice", function (choice) {
@@ -884,7 +943,7 @@ const require$$20 = _dll_material_ui__core_styles;
884
943
  key: "render",
885
944
  value: function render() {
886
945
  var _this3 = this;
887
- var _this$props2 = this.props, classes = _this$props2.classes, selectChoices = _this$props2.selectChoices, maxLength = _this$props2.maxLength, showMaxLength = _this$props2.showMaxLength, value = _this$props2.value;
946
+ var _this$props2 = this.props, classes = _this$props2.classes, selectChoices = _this$props2.selectChoices, maxLength = _this$props2.maxLength, showMaxLength = _this$props2.showMaxLength, value = _this$props2.value, spellCheck = _this$props2.spellCheck;
888
947
  var choices = this.state.choices;
889
948
  var minLength = this.getChoicesMaxLength();
890
949
  return _react["default"].createElement("div", {
@@ -933,7 +992,8 @@ const require$$20 = _dll_material_ui__core_styles;
933
992
  },
934
993
  onDelete: function onDelete() {
935
994
  return _this3.onRemoveChoice(c);
936
- }
995
+ },
996
+ spellCheck: spellCheck
937
997
  });
938
998
  })));
939
999
  }
@@ -1150,7 +1210,7 @@ const {cloneDeep: require$$14$1} = _dll_lodash;
1150
1210
  value: function render() {
1151
1211
  var _this2 = this;
1152
1212
  var choices = this.state.choices;
1153
- var _this$props$model = this.props.model, maxLengthPerChoice = _this$props$model.maxLengthPerChoice, maxLengthPerChoiceEnabled = _this$props$model.maxLengthPerChoiceEnabled;
1213
+ var _this$props2 = this.props, _this$props2$model = _this$props2.model, maxLengthPerChoice = _this$props2$model.maxLengthPerChoice, maxLengthPerChoiceEnabled = _this$props2$model.maxLengthPerChoiceEnabled, spellCheck = _this$props2.spellCheck;
1154
1214
  return _react["default"].createElement("div", null, (0, _map["default"])(choices, function (c, key) {
1155
1215
  if (c && (maxLengthPerChoiceEnabled || c.length > 1)) {
1156
1216
  var selected = _this2.state.values[key];
@@ -1172,7 +1232,8 @@ const {cloneDeep: require$$14$1} = _dll_lodash;
1172
1232
  selectChoices: [selected],
1173
1233
  choices: c,
1174
1234
  maxLength: maxLengthPerChoice[key],
1175
- showMaxLength: maxLengthPerChoiceEnabled
1235
+ showMaxLength: maxLengthPerChoiceEnabled,
1236
+ spellCheck: spellCheck
1176
1237
  });
1177
1238
  }
1178
1239
  }), choices && Object.keys(this.state.values).length !== Object.keys(choices).length && _react["default"].createElement(_alternateSection["default"], {
@@ -1186,7 +1247,8 @@ const {cloneDeep: require$$14$1} = _dll_lodash;
1186
1247
  choiceRemoved: function choiceRemoved(value) {
1187
1248
  return _this2.onChoiceRemoved(value);
1188
1249
  },
1189
- selectChoices: this.getRemainingChoices()
1250
+ selectChoices: this.getRemainingChoices(),
1251
+ spellCheck: spellCheck
1190
1252
  }));
1191
1253
  }
1192
1254
  }]);
@@ -1203,62 +1265,6 @@ const {cloneDeep: require$$14$1} = _dll_lodash;
1203
1265
  exports["default"] = _default;
1204
1266
  })(alternateResponses);
1205
1267
  getDefaultExportFromCjs(alternateResponses);
1206
- var markupUtils = {};
1207
- const {escape: require$$1} = _dll_lodash;
1208
- var _interopRequireDefault = interopRequireDefault.exports;
1209
- Object.defineProperty(markupUtils, "__esModule", {
1210
- value: true
1211
- });
1212
- markupUtils.getAdjustedLength = markupUtils.createSlateMarkup = markupUtils.processMarkup = markupUtils.removeUnwantedCharacters = void 0;
1213
- var _escape = _interopRequireDefault(require$$1);
1214
- var tSymbols = 'imes|riangle|an|heta|herefore';
1215
- var nSymbols = 'throot|parallel|cong|approx|eq|e|sim';
1216
- var matchTabAndNewLine = new RegExp(("(\\t(?!").concat(tSymbols, "))|(\\n(?!").concat(nSymbols, "))|(\\\\t(?!").concat(tSymbols, "))|(\\\\n(?!").concat(nSymbols, "))"), 'g');
1217
- var removeUnwantedCharacters = function removeUnwantedCharacters(markup) {
1218
- return markup.replace(matchTabAndNewLine, '').replace(/\\"/g, '"').replace(/\\\//g, '/');
1219
- };
1220
- markupUtils.removeUnwantedCharacters = removeUnwantedCharacters;
1221
- var createElementFromHTML = function createElementFromHTML() {
1222
- var htmlString = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
1223
- var div = document.createElement('div');
1224
- div.innerHTML = htmlString.trim();
1225
- return div;
1226
- };
1227
- var processMarkup = function processMarkup(markup) {
1228
- var newMarkup = removeUnwantedCharacters(markup || '');
1229
- var slateMarkup = createElementFromHTML(newMarkup || '');
1230
- var index = 0;
1231
- slateMarkup.querySelectorAll('[data-type="explicit_constructed_response"]').forEach(function (s) {
1232
- s.replaceWith(("{{").concat(index++, "}}"));
1233
- });
1234
- return slateMarkup.innerHTML;
1235
- };
1236
- markupUtils.processMarkup = processMarkup;
1237
- var REGEX = /\{\{(\d+)\}\}/g;
1238
- var createSlateMarkup = function createSlateMarkup(markup, choices) {
1239
- if (!markup) {
1240
- return '';
1241
- }
1242
- var newMarkup = removeUnwantedCharacters(markup);
1243
- return newMarkup.replace(REGEX, function (match, g) {
1244
- var label = choices[g][0].label || '';
1245
- return ("<span data-type=\"explicit_constructed_response\" data-index=\"").concat(g, "\" data-value=\"").concat((0, _escape["default"])(label), "\"></span>");
1246
- });
1247
- };
1248
- markupUtils.createSlateMarkup = createSlateMarkup;
1249
- var getAdjustedLength = function getAdjustedLength(length) {
1250
- if (length <= 2) {
1251
- return length + 2;
1252
- }
1253
- if (length <= 4) {
1254
- return length + 3;
1255
- }
1256
- if (length <= 6) {
1257
- return length + 4;
1258
- }
1259
- return length + 5;
1260
- };
1261
- markupUtils.getAdjustedLength = getAdjustedLength;
1262
1268
  const require$$10$1 = _dll_react;
1263
1269
  const require$$11$1 = _dll_prop_types;
1264
1270
  const {cloneDeep: require$$12$1} = _dll_lodash;
@@ -1486,18 +1492,22 @@ const require$$17 = _dll_pie_lib__config_ui;
1486
1492
  });
1487
1493
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChangeResponse", function (index, newVal) {
1488
1494
  var _this$props3 = _this.props, model = _this$props3.model, onModelChanged = _this$props3.onModelChanged;
1489
- var choices = model.choices, maxLengthPerChoice = model.maxLengthPerChoice;
1495
+ var choices = model.choices;
1496
+ var maxLengthPerChoice = model.maxLengthPerChoice;
1490
1497
  var newValLength = (newVal || '').length;
1491
1498
  if (!choices[index]) {
1492
1499
  choices[index] = [{
1493
- label: '',
1500
+ label: newVal || '',
1494
1501
  value: '0'
1495
1502
  }];
1496
- maxLengthPerChoice.splice(index, 0, newValLength);
1497
- }
1498
- choices[index][0].label = newVal || '';
1499
- if (maxLengthPerChoice && newVal && maxLengthPerChoice[index] < newValLength) {
1500
- maxLengthPerChoice[index] = newValLength;
1503
+ var nbOfMissingChoices = index > maxLengthPerChoice.length ? index - maxLengthPerChoice.length : 0;
1504
+ maxLengthPerChoice = [].concat((0, _toConsumableArray2["default"])(maxLengthPerChoice), (0, _toConsumableArray2["default"])(Array(nbOfMissingChoices).fill(1)));
1505
+ maxLengthPerChoice.splice(index, 0, (0, _markupUtils.getAdjustedLength)(newValLength));
1506
+ } else {
1507
+ choices[index][0].label = newVal || '';
1508
+ if (maxLengthPerChoice && (maxLengthPerChoice[index] < newValLength || maxLengthPerChoice[index] > newValLength + 10)) {
1509
+ maxLengthPerChoice[index] = (0, _markupUtils.getAdjustedLength)(newValLength);
1510
+ }
1501
1511
  }
1502
1512
  onModelChanged(_objectSpread(_objectSpread({}, model), {}, {
1503
1513
  choices: choices,
@@ -1595,8 +1605,8 @@ const require$$17 = _dll_pie_lib__config_ui;
1595
1605
  value: function render() {
1596
1606
  var _this2 = this;
1597
1607
  var _this$props7 = this.props, classes = _this$props7.classes, model = _this$props7.model, configuration = _this$props7.configuration, onConfigurationChanged = _this$props7.onConfigurationChanged, imageSupport = _this$props7.imageSupport;
1598
- var _ref = configuration || ({}), _ref$prompt = _ref.prompt, prompt = _ref$prompt === void 0 ? {} : _ref$prompt, _ref$partialScoring = _ref.partialScoring, partialScoring = _ref$partialScoring === void 0 ? {} : _ref$partialScoring, _ref$rationale = _ref.rationale, rationale = _ref$rationale === void 0 ? {} : _ref$rationale, _ref$teacherInstructi = _ref.teacherInstructions, teacherInstructions = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi, _ref$maxLengthPerChoi = _ref.maxLengthPerChoice, maxLengthPerChoice = _ref$maxLengthPerChoi === void 0 ? {} : _ref$maxLengthPerChoi;
1599
- var _ref2 = model || ({}), teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled, promptEnabled = _ref2.promptEnabled, rationaleEnabled = _ref2.rationaleEnabled, maxLengthPerChoiceEnabled = _ref2.maxLengthPerChoiceEnabled;
1608
+ var _ref = configuration || ({}), _ref$prompt = _ref.prompt, prompt = _ref$prompt === void 0 ? {} : _ref$prompt, _ref$partialScoring = _ref.partialScoring, partialScoring = _ref$partialScoring === void 0 ? {} : _ref$partialScoring, _ref$rationale = _ref.rationale, rationale = _ref$rationale === void 0 ? {} : _ref$rationale, _ref$teacherInstructi = _ref.teacherInstructions, teacherInstructions = _ref$teacherInstructi === void 0 ? {} : _ref$teacherInstructi, _ref$maxLengthPerChoi = _ref.maxLengthPerChoice, maxLengthPerChoice = _ref$maxLengthPerChoi === void 0 ? {} : _ref$maxLengthPerChoi, _ref$spellCheck = _ref.spellCheck, spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck;
1609
+ var _ref2 = model || ({}), teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled, promptEnabled = _ref2.promptEnabled, rationaleEnabled = _ref2.rationaleEnabled, maxLengthPerChoiceEnabled = _ref2.maxLengthPerChoiceEnabled, spellCheckEnabled = _ref2.spellCheckEnabled;
1600
1610
  var toolbarOpts = {};
1601
1611
  switch (model.toolbarEditorPosition) {
1602
1612
  case 'top':
@@ -1626,7 +1636,8 @@ const require$$17 = _dll_pie_lib__config_ui;
1626
1636
  Properties: {
1627
1637
  teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
1628
1638
  rationaleEnabled: rationale.settings && toggle(rationale.label),
1629
- promptEnabled: prompt.settings && toggle(prompt.label)
1639
+ promptEnabled: prompt.settings && toggle(prompt.label),
1640
+ spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label)
1630
1641
  }
1631
1642
  }
1632
1643
  })
@@ -1639,7 +1650,8 @@ const require$$17 = _dll_pie_lib__config_ui;
1639
1650
  onChange: this.onTeacherInstructionsChanged,
1640
1651
  imageSupport: imageSupport,
1641
1652
  nonEmpty: false,
1642
- toolbarOpts: toolbarOpts
1653
+ toolbarOpts: toolbarOpts,
1654
+ spellCheck: spellCheckEnabled
1643
1655
  })), promptEnabled && _react["default"].createElement(_configUi.InputContainer, {
1644
1656
  label: prompt.label,
1645
1657
  className: classes.promptHolder
@@ -1650,7 +1662,8 @@ const require$$17 = _dll_pie_lib__config_ui;
1650
1662
  imageSupport: imageSupport,
1651
1663
  nonEmpty: false,
1652
1664
  disableUnderline: true,
1653
- toolbarOpts: toolbarOpts
1665
+ toolbarOpts: toolbarOpts,
1666
+ spellCheck: spellCheckEnabled
1654
1667
  })), _react["default"].createElement(_Typography["default"], {
1655
1668
  className: classes.text
1656
1669
  }, "Define Template, Choices, and Correct Responses"), _react["default"].createElement(_editableHtml["default"], {
@@ -1658,6 +1671,7 @@ const require$$17 = _dll_pie_lib__config_ui;
1658
1671
  toolbarOpts: {
1659
1672
  position: 'top'
1660
1673
  },
1674
+ spellCheck: spellCheckEnabled,
1661
1675
  responseAreaProps: {
1662
1676
  type: 'explicit-constructed-response',
1663
1677
  options: {
@@ -1693,7 +1707,8 @@ const require$$17 = _dll_pie_lib__config_ui;
1693
1707
  model: model,
1694
1708
  onChange: this.onResponsesChanged,
1695
1709
  onLengthChange: this.onLengthChanged,
1696
- maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled
1710
+ maxLengthPerChoiceEnabled: maxLengthPerChoiceEnabled,
1711
+ spellCheck: spellCheckEnabled
1697
1712
  }), rationaleEnabled && _react["default"].createElement(_configUi.InputContainer, {
1698
1713
  label: rationale.label,
1699
1714
  className: classes.promptHolder
@@ -1702,7 +1717,8 @@ const require$$17 = _dll_pie_lib__config_ui;
1702
1717
  markup: model.rationale || '',
1703
1718
  onChange: this.onRationaleChanged,
1704
1719
  imageSupport: imageSupport,
1705
- toolbarOpts: toolbarOpts
1720
+ toolbarOpts: toolbarOpts,
1721
+ spellCheck: spellCheckEnabled
1706
1722
  })))));
1707
1723
  }
1708
1724
  }]);
@@ -1741,6 +1757,7 @@ var defaults = {};
1741
1757
  markup: '<p>The {{0}} jumped {{1}} the {{2}}</p>',
1742
1758
  toolbarEditorPosition: 'bottom',
1743
1759
  displayType: 'block',
1760
+ spellCheckEnabled: false,
1744
1761
  choices: {
1745
1762
  0: [{
1746
1763
  label: 'cow',
@@ -1793,6 +1810,11 @@ var defaults = {};
1793
1810
  settings: true,
1794
1811
  label: 'Rationale'
1795
1812
  },
1813
+ spellCheck: {
1814
+ label: "Spellcheck",
1815
+ settings: true,
1816
+ enabled: true
1817
+ },
1796
1818
  teacherInstructions: {
1797
1819
  settings: true,
1798
1820
  label: 'Teacher Instructions'
package/module/element.js CHANGED
@@ -1,6 +1,6 @@
1
- import {_dll_debug, _dll_lodash, _dll_react, _dll_react_dom_server, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_classnames, _dll_react_dom, _dll_pie_lib__render_ui, _dll_pie_lib__correct_answer_toggle} from "../../../@pie-lib/shared-module@^1.4.2/module/index.js";
2
- import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.27/module/index.js";
3
- import {_dll_pie_lib__drag} from "../../../@pie-lib/drag-module@^1.0.25/module/index.js";
1
+ import {_dll_debug, _dll_lodash, _dll_react, _dll_react_dom_server, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_classnames, _dll_react_dom, _dll_pie_lib__render_ui, _dll_pie_lib__correct_answer_toggle} from "../../../@pie-lib/shared-module@^1.4.8/module/index.js";
2
+ import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.33/module/index.js";
3
+ import {_dll_pie_lib__drag} from "../../../@pie-lib/drag-module@^1.0.31/module/index.js";
4
4
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5
5
  var lib$1 = {};
6
6
  Object.defineProperty(lib$1, "__esModule", {
@@ -13132,7 +13132,7 @@ const renderChildren = (layout, value, onChange, rootRenderChildren, parentNode)
13132
13132
  };
13133
13133
  const MaskContainer = withStyles$5(() => ({
13134
13134
  main: {
13135
- display: 'inherit'
13135
+ display: 'initial'
13136
13136
  }
13137
13137
  }))(props => React$c.createElement('div', {
13138
13138
  className: props.classes.main,
@@ -13421,6 +13421,7 @@ const useStyles = withStyles$3(() => ({
13421
13421
  minWidth: '90px',
13422
13422
  fontSize: 'inherit',
13423
13423
  minHeight: '32px',
13424
+ height: 'auto',
13424
13425
  maxWidth: '374px',
13425
13426
  position: 'relative'
13426
13427
  },
@@ -13509,7 +13510,7 @@ class BlankContent extends React$8.Component {
13509
13510
  __self: this,
13510
13511
  __source: {
13511
13512
  fileName: _jsxFileName$7,
13512
- lineNumber: 115
13513
+ lineNumber: 116
13513
13514
  }
13514
13515
  }, React$8.createElement('span', {
13515
13516
  className: classnames$1(classes.chipLabel, isOver && classes.over, {
@@ -13525,7 +13526,7 @@ class BlankContent extends React$8.Component {
13525
13526
  __self: this,
13526
13527
  __source: {
13527
13528
  fileName: _jsxFileName$7,
13528
- lineNumber: 116
13529
+ lineNumber: 117
13529
13530
  }
13530
13531
  }, ' '), draggedLabel && React$8.createElement('span', {
13531
13532
  className: classnames$1(classes.chipLabel, isOver && classes.over, classes.dragged),
@@ -13539,7 +13540,7 @@ class BlankContent extends React$8.Component {
13539
13540
  __self: this,
13540
13541
  __source: {
13541
13542
  fileName: _jsxFileName$7,
13542
- lineNumber: 132
13543
+ lineNumber: 133
13543
13544
  }
13544
13545
  }, ' ')),
13545
13546
  className: classnames$1(classes.chip, isOver && classes.over, {
@@ -13558,7 +13559,7 @@ class BlankContent extends React$8.Component {
13558
13559
  __self: this,
13559
13560
  __source: {
13560
13561
  fileName: _jsxFileName$7,
13561
- lineNumber: 108
13562
+ lineNumber: 109
13562
13563
  }
13563
13564
  });
13564
13565
  }
@@ -13572,14 +13573,14 @@ const connectedBlankContent = useStyles(({connectDragSource, connectDropTarget,
13572
13573
  __self: undefined,
13573
13574
  __source: {
13574
13575
  fileName: _jsxFileName$7,
13575
- lineNumber: 171
13576
+ lineNumber: 172
13576
13577
  }
13577
13578
  }, React$8.createElement(StyledBlankContent, {
13578
13579
  ...props,
13579
13580
  __self: undefined,
13580
13581
  __source: {
13581
13582
  fileName: _jsxFileName$7,
13582
- lineNumber: 172
13583
+ lineNumber: 173
13583
13584
  }
13584
13585
  }))));
13585
13586
  });
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/explicit-constructed-response@3.12.3</title>
5
+ <title>@pie-element/explicit-constructed-response@3.12.4</title>
6
6
  <script
7
7
  type="module"
8
8
  src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@pie-element/explicit-constructed-response",
3
- "version": "3.12.3",
3
+ "version": "3.12.4",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/shared-module",
7
- "version": "^1.4.2"
7
+ "version": "^1.4.8"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/math-rendering-module",
11
- "version": "^1.0.27"
11
+ "version": "^1.0.33"
12
12
  },
13
13
  {
14
14
  "name": "@pie-lib/drag-module",
15
- "version": "^1.0.25"
15
+ "version": "^1.0.31"
16
16
  }
17
17
  ]
18
18
  }
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/explicit-constructed-response@3.12.3</title>
5
+ <title>@pie-element/explicit-constructed-response@3.12.4</title>
6
6
  <link
7
7
  href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
8
  rel="stylesheet"
package/module/print.js CHANGED
@@ -1,6 +1,6 @@
1
- import {_dll_debug, _dll_lodash, _dll_react, _dll_react_dom_server, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_classnames, _dll_react_dom, _dll_pie_lib__render_ui, _dll_pie_lib__correct_answer_toggle} from "../../../@pie-lib/shared-module@^1.4.2/module/index.js";
2
- import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.27/module/index.js";
3
- import {_dll_pie_lib__drag} from "../../../@pie-lib/drag-module@^1.0.25/module/index.js";
1
+ import {_dll_debug, _dll_lodash, _dll_react, _dll_react_dom_server, _dll_prop_types, _dll_material_ui__core_styles, _dll_material_ui__core, _dll_classnames, _dll_react_dom, _dll_pie_lib__render_ui, _dll_pie_lib__correct_answer_toggle} from "../../../@pie-lib/shared-module@^1.4.8/module/index.js";
2
+ import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.33/module/index.js";
3
+ import {_dll_pie_lib__drag} from "../../../@pie-lib/drag-module@^1.0.31/module/index.js";
4
4
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5
5
  var toString$1 = Object.prototype.toString;
6
6
  var typeOf = function (val) {
@@ -13095,7 +13095,7 @@ const renderChildren = (layout, value, onChange, rootRenderChildren, parentNode)
13095
13095
  };
13096
13096
  const MaskContainer = withStyles$5(() => ({
13097
13097
  main: {
13098
- display: 'inherit'
13098
+ display: 'initial'
13099
13099
  }
13100
13100
  }))(props => React$c.createElement('div', {
13101
13101
  className: props.classes.main,
@@ -13384,6 +13384,7 @@ const useStyles = withStyles$3(() => ({
13384
13384
  minWidth: '90px',
13385
13385
  fontSize: 'inherit',
13386
13386
  minHeight: '32px',
13387
+ height: 'auto',
13387
13388
  maxWidth: '374px',
13388
13389
  position: 'relative'
13389
13390
  },
@@ -13472,7 +13473,7 @@ class BlankContent extends React$8.Component {
13472
13473
  __self: this,
13473
13474
  __source: {
13474
13475
  fileName: _jsxFileName$7,
13475
- lineNumber: 115
13476
+ lineNumber: 116
13476
13477
  }
13477
13478
  }, React$8.createElement('span', {
13478
13479
  className: classnames$1(classes.chipLabel, isOver && classes.over, {
@@ -13488,7 +13489,7 @@ class BlankContent extends React$8.Component {
13488
13489
  __self: this,
13489
13490
  __source: {
13490
13491
  fileName: _jsxFileName$7,
13491
- lineNumber: 116
13492
+ lineNumber: 117
13492
13493
  }
13493
13494
  }, ' '), draggedLabel && React$8.createElement('span', {
13494
13495
  className: classnames$1(classes.chipLabel, isOver && classes.over, classes.dragged),
@@ -13502,7 +13503,7 @@ class BlankContent extends React$8.Component {
13502
13503
  __self: this,
13503
13504
  __source: {
13504
13505
  fileName: _jsxFileName$7,
13505
- lineNumber: 132
13506
+ lineNumber: 133
13506
13507
  }
13507
13508
  }, ' ')),
13508
13509
  className: classnames$1(classes.chip, isOver && classes.over, {
@@ -13521,7 +13522,7 @@ class BlankContent extends React$8.Component {
13521
13522
  __self: this,
13522
13523
  __source: {
13523
13524
  fileName: _jsxFileName$7,
13524
- lineNumber: 108
13525
+ lineNumber: 109
13525
13526
  }
13526
13527
  });
13527
13528
  }
@@ -13535,14 +13536,14 @@ const connectedBlankContent = useStyles(({connectDragSource, connectDropTarget,
13535
13536
  __self: undefined,
13536
13537
  __source: {
13537
13538
  fileName: _jsxFileName$7,
13538
- lineNumber: 171
13539
+ lineNumber: 172
13539
13540
  }
13540
13541
  }, React$8.createElement(StyledBlankContent, {
13541
13542
  ...props,
13542
13543
  __self: undefined,
13543
13544
  __source: {
13544
13545
  fileName: _jsxFileName$7,
13545
- lineNumber: 172
13546
+ lineNumber: 173
13546
13547
  }
13547
13548
  }))));
13548
13549
  });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "3.12.4",
7
+ "version": "3.12.5",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -13,10 +13,10 @@
13
13
  "dependencies": {
14
14
  "@material-ui/core": "^3.9.2",
15
15
  "@pie-framework/pie-player-events": "^0.1.0",
16
- "@pie-lib/correct-answer-toggle": "^2.3.34",
17
- "@pie-lib/mask-markup": "^1.12.0",
18
- "@pie-lib/math-rendering": "^2.3.12",
19
- "@pie-lib/render-ui": "^4.12.4",
16
+ "@pie-lib/correct-answer-toggle": "^2.3.35",
17
+ "@pie-lib/mask-markup": "^1.12.2",
18
+ "@pie-lib/math-rendering": "^2.3.13",
19
+ "@pie-lib/render-ui": "^4.12.5",
20
20
  "classnames": "^2.2.5",
21
21
  "lodash": "^4.17.10",
22
22
  "prop-types": "^15.6.1",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "author": "",
27
27
  "license": "ISC",
28
- "gitHead": "7b61c8a15ceae75e9e6db5d465abfb6d22c34f30",
28
+ "gitHead": "b32a90d35916de8f2b77d7b3428b02efbd145313",
29
29
  "main": "lib/index.js",
30
30
  "module": "src/index.js",
31
31
  "exports": {