@pie-element/explicit-constructed-response 3.10.5 → 3.11.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,46 +3,24 @@
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.10.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@3.10.4...@pie-element/explicit-constructed-response@3.10.5) (2021-11-01)
7
-
8
- **Note:** Version bump only for package @pie-element/explicit-constructed-response
9
-
10
-
11
-
12
-
13
-
14
- ## [3.10.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@3.10.3...@pie-element/explicit-constructed-response@3.10.4) (2021-10-18)
15
-
16
- **Note:** Version bump only for package @pie-element/explicit-constructed-response
17
-
18
-
19
-
20
-
21
-
22
- ## [3.10.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@3.10.2...@pie-element/explicit-constructed-response@3.10.3) (2021-10-04)
23
-
24
- **Note:** Version bump only for package @pie-element/explicit-constructed-response
25
-
26
-
27
-
28
-
29
-
30
- ## [3.10.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@3.10.1...@pie-element/explicit-constructed-response@3.10.2) (2021-09-20)
6
+ # [3.11.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@3.9.2...@pie-element/explicit-constructed-response@3.11.0) (2021-11-11)
31
7
 
32
8
 
33
9
  ### Bug Fixes
34
10
 
11
+ * **explicit-constructed-response:** call session change depending on input max length PD-1353 ([2664a10](https://github.com/pie-framework/pie-elements/commit/2664a108cce80a9e3a9d34141613836cf057e25e))
12
+ * **multiple-choice-print, ecr-print:** fix toggle issue, change options.mode to options.role ([0b3f534](https://github.com/pie-framework/pie-elements/commit/0b3f534bb4d2f969e21528e74516345e84f18d72))
35
13
  * pie-lib updates ([e521c2f](https://github.com/pie-framework/pie-elements/commit/e521c2f1a44aa7f3e14f82a1cee05ceb484ed0a6))
36
14
  * Updated pie-lib versions ([2fe4c5d](https://github.com/pie-framework/pie-elements/commit/2fe4c5d0be2d40f5fdb34815855695a7f1087f56))
37
15
  * Updated pie-lib versions ([1c23830](https://github.com/pie-framework/pie-elements/commit/1c23830fc75d1de5f7bb3bb16de3c665ae5fa350))
38
16
 
39
17
 
18
+ ### Features
40
19
 
41
-
42
-
43
- ## [3.10.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@3.10.0...@pie-element/explicit-constructed-response@3.10.1) (2021-09-01)
44
-
45
- **Note:** Version bump only for package @pie-element/explicit-constructed-response
20
+ * **explicit-constructed-response:** Added a max limit of characters and adjusted the width PD-794 ([135f176](https://github.com/pie-framework/pie-elements/commit/135f176402187e9a6120b88768ae7fb0152ac418))
21
+ * **explicit-constructed-response:** Calculate maxChoicesLength if it's undefined. Fixed delete response area and choices bug. BREAKING CHANGE: add maxChoicesLength prop ([97431b9](https://github.com/pie-framework/pie-elements/commit/97431b9c3fbdafd84e040653c54d5f04bae16a1d))
22
+ * **explicit-constructed-response:** implement print PD-1284 ([3a387ba](https://github.com/pie-framework/pie-elements/commit/3a387ba5e9aff0e94cbb6465550bd07185ba7eff))
23
+ * **explicit-constructed-response:** set toolbar editor position to bottom ([75cc827](https://github.com/pie-framework/pie-elements/commit/75cc827c14307f4cf96389112cbc4311eff3795a))
46
24
 
47
25
 
48
26
 
@@ -3,23 +3,7 @@
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.5.31](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.5.30...@pie-element/explicit-constructed-response-configure@3.5.31) (2021-10-18)
7
-
8
- **Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
9
-
10
-
11
-
12
-
13
-
14
- ## [3.5.30](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.5.29...@pie-element/explicit-constructed-response-configure@3.5.30) (2021-10-04)
15
-
16
- **Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
17
-
18
-
19
-
20
-
21
-
22
- ## [3.5.29](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.5.28...@pie-element/explicit-constructed-response-configure@3.5.29) (2021-09-20)
6
+ # [3.6.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.5.27...@pie-element/explicit-constructed-response-configure@3.6.0) (2021-11-11)
23
7
 
24
8
 
25
9
  ### Bug Fixes
@@ -29,6 +13,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
29
13
  * Updated pie-lib versions ([1c23830](https://github.com/pie-framework/pie-elements/commit/1c23830fc75d1de5f7bb3bb16de3c665ae5fa350))
30
14
 
31
15
 
16
+ ### Features
17
+
18
+ * **explicit-constructed-response:** Added a max limit of characters and adjusted the width PD-794 ([135f176](https://github.com/pie-framework/pie-elements/commit/135f176402187e9a6120b88768ae7fb0152ac418))
19
+ * **explicit-constructed-response:** Calculate maxChoicesLength if it's undefined. Fixed delete response area and choices bug. BREAKING CHANGE: add maxChoicesLength prop ([97431b9](https://github.com/pie-framework/pie-elements/commit/97431b9c3fbdafd84e040653c54d5f04bae16a1d))
20
+
21
+
32
22
 
33
23
 
34
24
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/explicit-constructed-response-configure",
3
- "version": "3.5.31",
3
+ "version": "3.6.0",
4
4
  "private": true,
5
5
  "main": "lib/index.js",
6
6
  "modue": "src/index.js",
@@ -3,9 +3,13 @@
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.3.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-controller@3.3.2...@pie-element/explicit-constructed-response-controller@3.3.3) (2021-10-18)
6
+ # [3.4.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-controller@3.3.2...@pie-element/explicit-constructed-response-controller@3.4.0) (2021-11-11)
7
7
 
8
- **Note:** Version bump only for package @pie-element/explicit-constructed-response-controller
8
+
9
+ ### Features
10
+
11
+ * **explicit-constructed-response:** Added a max limit of characters and adjusted the width PD-794 ([135f176](https://github.com/pie-framework/pie-elements/commit/135f176402187e9a6120b88768ae7fb0152ac418))
12
+ * **explicit-constructed-response:** Calculate maxChoicesLength if it's undefined. Fixed delete response area and choices bug. BREAKING CHANGE: add maxChoicesLength prop ([97431b9](https://github.com/pie-framework/pie-elements/commit/97431b9c3fbdafd84e040653c54d5f04bae16a1d))
9
13
 
10
14
 
11
15
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/explicit-constructed-response-controller",
3
3
  "private": true,
4
- "version": "3.3.3",
4
+ "version": "3.4.0",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
package/lib/main.js CHANGED
@@ -31,6 +31,8 @@ var _debounce = _interopRequireDefault(require("lodash/debounce"));
31
31
 
32
32
  var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
33
33
 
34
+ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
35
+
34
36
  var _correctAnswerToggle = _interopRequireDefault(require("@pie-lib/correct-answer-toggle"));
35
37
 
36
38
  var _maskMarkup = require("@pie-lib/mask-markup");
@@ -64,12 +66,19 @@ var Main = /*#__PURE__*/function (_React$Component) {
64
66
  showCorrectAnswer: _this.props.alwaysShowCorrect || false,
65
67
  value: _this.props.value
66
68
  });
69
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getChangeSession", function (maxLengthPerChoice) {
70
+ return maxLengthPerChoice && maxLengthPerChoice.every(function (val, i, arr) {
71
+ return val === arr[0] && val === 1;
72
+ }) ? _this.props.onChange : (0, _debounce["default"])(_this.props.onChange, 1500, {
73
+ maxWait: 1500
74
+ });
75
+ });
67
76
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toggleShowCorrect", function () {
68
77
  _this.setState({
69
78
  showCorrectAnswer: !_this.state.showCorrectAnswer
70
79
  });
71
80
  });
72
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeSession", (0, _debounce["default"])(_this.props.onChange, 1500));
81
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeSession", _this.getChangeSession(_this.props.maxLengthPerChoice));
73
82
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (value) {
74
83
  _this.setState({
75
84
  value: value
@@ -83,6 +92,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
83
92
  (0, _createClass2["default"])(Main, [{
84
93
  key: "UNSAFE_componentWillReceiveProps",
85
94
  value: function UNSAFE_componentWillReceiveProps(nextProps) {
95
+ var maxLengthPerChoice = this.props.maxLengthPerChoice;
96
+
86
97
  if ((0, _isEmpty["default"])(nextProps.feedback)) {
87
98
  this.setState({
88
99
  showCorrectAnswer: false
@@ -94,6 +105,10 @@ var Main = /*#__PURE__*/function (_React$Component) {
94
105
  showCorrectAnswer: true
95
106
  });
96
107
  }
108
+
109
+ if (maxLengthPerChoice && !(0, _isEqual["default"])(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {
110
+ this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);
111
+ }
97
112
  }
98
113
  }, {
99
114
  key: "render",
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.js"],"names":["Main","showCorrectAnswer","props","alwaysShowCorrect","value","setState","state","onChange","changeSession","nextProps","feedback","classes","mode","prompt","rationale","teacherInstructions","note","showNote","env","animationsDisabled","maxLengthPerChoice","role","displayNote","mainClasses","mainContainer","noBorderColor","teacherInstructionsDiv","__html","rationaleDiv","collapsible","hidden","visible","toggleShowCorrect","React","Component","PropTypes","object","isRequired","string","bool","disabled","markup","func","array","styles","theme","padding","spacing","unit","color","text","backgroundColor","background","margin","borderColor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAEaA,I;;;;;;;;;;;;;;;8FAwBH;AACNC,MAAAA,iBAAiB,EAAE,MAAKC,KAAL,CAAWC,iBAAX,IAAgC,KAD7C;AAENC,MAAAA,KAAK,EAAE,MAAKF,KAAL,CAAWE;AAFZ,K;0GAeY,YAAM;AACxB,YAAKC,QAAL,CAAc;AAAEJ,QAAAA,iBAAiB,EAAE,CAAC,MAAKK,KAAL,CAAWL;AAAjC,OAAd;AACD,K;sGAEe,0BAAS,MAAKC,KAAL,CAAWK,QAApB,EAA8B,IAA9B,C;iGAEL,UAAAH,KAAK,EAAI;AAClB,YAAKC,QAAL,CAAc;AAAED,QAAAA,KAAK,EAALA;AAAF,OAAd;;AAEA,YAAKI,aAAL,CAAmBJ,KAAnB;AACD,K;;;;;;WApBD,0CAAiCK,SAAjC,EAA4C;AAC1C,UAAI,yBAAQA,SAAS,CAACC,QAAlB,CAAJ,EAAiC;AAC/B,aAAKL,QAAL,CAAc;AAAEJ,UAAAA,iBAAiB,EAAE;AAArB,SAAd;AACD;;AAED,UAAIQ,SAAS,CAACN,iBAAd,EAAiC;AAC/B,aAAKE,QAAL,CAAc;AAAEJ,UAAAA,iBAAiB,EAAE;AAArB,SAAd;AACD;AACF;;;WAcD,kBAAS;AACP,wBAAqC,KAAKK,KAA1C;AAAA,UAAQL,iBAAR,eAAQA,iBAAR;AAAA,UAA2BG,KAA3B,eAA2BA,KAA3B;AACA,wBAYI,KAAKF,KAZT;AAAA,UACES,OADF,eACEA,OADF;AAAA,UAEEC,IAFF,eAEEA,IAFF;AAAA,UAGEC,MAHF,eAGEA,MAHF;AAAA,UAIEC,SAJF,eAIEA,SAJF;AAAA,UAKEC,mBALF,eAKEA,mBALF;AAAA,UAMEC,IANF,eAMEA,IANF;AAAA,U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,MATC;AAUjBvB,EAAAA,mBAAmB,EAAEoB,sBAAUG,MAVd;AAWjBlC,EAAAA,KAAK,EAAE+B,sBAAUC,MAXA;AAYjB1B,EAAAA,QAAQ,EAAEyB,sBAAUC,MAZH;AAajB7B,EAAAA,QAAQ,EAAE4B,sBAAUO,IAbH;AAcjBvC,EAAAA,iBAAiB,EAAEgC,sBAAUI,IAdZ;AAejBpB,EAAAA,kBAAkB,EAAEgB,sBAAUI,IAfb;AAgBjBnB,EAAAA,kBAAkB,EAAEe,sBAAUQ;AAhBb,C;iCADR3C,I,kBAoBW;AACpBI,EAAAA,KAAK,EAAE;AADa,C;;AAyGxB,IAAMwC,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBrB,IAAAA,aAAa,EAAE;AACbsB,MAAAA,OAAO,EAAED,KAAK,CAACE,OAAN,CAAcC,IADV;AAEbC,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EAFM;AAGbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN;AAHJ,KADQ;AAMvBpC,IAAAA,IAAI,EAAE;AACJ8B,MAAAA,OAAO,EAAE;AADL,KANiB;AASvBjB,IAAAA,WAAW,EAAE;AACXwB,MAAAA,MAAM,YAAKR,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,CAA1B;AADK,KATU;AAYvBvB,IAAAA,aAAa,EAAE;AACb,aAAO;AACL6B,QAAAA,WAAW,YAAKL,gBAAMC,IAAN,EAAL;AADN;AADM;AAZQ,GAAL;AAAA,CAApB;;eAmBe,wBAAWN,MAAX,EAAmB5C,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash/debounce';\nimport isEmpty from 'lodash/isEmpty';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { ConstructedResponse } from '@pie-lib/mask-markup';\nimport { color, Collapsible, hasText } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n prompt: PropTypes.string,\n note: PropTypes.string,\n showNote: PropTypes.bool,\n env: PropTypes.object,\n rationale: PropTypes.string,\n disabled: PropTypes.bool,\n markup: PropTypes.string,\n mode: PropTypes.string,\n teacherInstructions: PropTypes.string,\n value: PropTypes.object,\n feedback: PropTypes.object,\n onChange: PropTypes.func,\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n maxLengthPerChoice: PropTypes.array\n };\n\n static defaultProps = {\n value: {}\n };\n\n state = {\n showCorrectAnswer: this.props.alwaysShowCorrect || false,\n value: this.props.value\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n\n if (nextProps.alwaysShowCorrect) {\n this.setState({ showCorrectAnswer: true });\n }\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n changeSession = debounce(this.props.onChange, 1500);\n\n onChange = value => {\n this.setState({ value });\n\n this.changeSession(value);\n };\n\n render() {\n const { showCorrectAnswer, value } = this.state;\n const {\n classes,\n mode,\n prompt,\n rationale,\n teacherInstructions,\n note,\n showNote,\n env,\n animationsDisabled,\n alwaysShowCorrect,\n maxLengthPerChoice\n } = this.props;\n const { role } = env || {};\n const displayNote = (showCorrectAnswer || mode === 'view' && role === 'instructor') && showNote && note;\n const mainClasses = classNames([classes.mainContainer, alwaysShowCorrect ? classes.noBorderColor : {}]);\n\n const teacherInstructionsDiv = <div\n className=\"teacher-instructions\"\n dangerouslySetInnerHTML={{ __html: teacherInstructions }}\n />;\n\n const rationaleDiv = <div className=\"rationale\" dangerouslySetInnerHTML={{ __html: rationale }}/>;\n\n return (\n <div className={mainClasses}>\n {\n teacherInstructions && hasText(teacherInstructions) && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? <Collapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n : teacherInstructionsDiv}\n </div>\n )\n }\n {!alwaysShowCorrect && <CorrectAnswerToggle\n show={mode === 'evaluate'}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n />}\n {prompt && <div className=\"prompt\" dangerouslySetInnerHTML={{ __html: prompt }}/>}\n <ConstructedResponse\n {...this.props}\n onChange={this.onChange}\n showCorrectAnswer={showCorrectAnswer}\n value={value}\n maxLength={maxLengthPerChoice}\n />\n {displayNote && (\n <div\n className={classNames(classes.note, 'note')}\n dangerouslySetInnerHTML={{ __html: `<strong>Note:</strong> ${note}` }}\n />\n )}\n {rationale && hasText(rationale) && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? <Collapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n >\n {rationaleDiv}\n </Collapsible>\n : rationaleDiv}\n </div>\n )}\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n mainContainer: {\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.background()\n },\n note: {\n padding: '5px 0',\n },\n collapsible: {\n margin: `${theme.spacing.unit * 2}px 0`,\n },\n noBorderColor: {\n '& *': {\n borderColor: `${color.text()} !important`\n }\n }\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
1
+ {"version":3,"sources":["../src/main.js"],"names":["Main","showCorrectAnswer","props","alwaysShowCorrect","value","maxLengthPerChoice","every","val","i","arr","onChange","maxWait","setState","state","getChangeSession","changeSession","nextProps","feedback","classes","mode","prompt","rationale","teacherInstructions","note","showNote","env","animationsDisabled","role","displayNote","mainClasses","mainContainer","noBorderColor","teacherInstructionsDiv","__html","rationaleDiv","collapsible","hidden","visible","toggleShowCorrect","React","Component","PropTypes","object","isRequired","string","bool","disabled","markup","func","array","styles","theme","padding","spacing","unit","color","text","backgroundColor","background","margin","borderColor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;A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ADL,KANiB;AASvBjB,IAAAA,WAAW,EAAE;AACXwB,MAAAA,MAAM,YAAKR,KAAK,CAACE,OAAN,CAAcC,IAAd,GAAqB,CAA1B;AADK,KATU;AAYvBvB,IAAAA,aAAa,EAAE;AACb,aAAO;AACL6B,QAAAA,WAAW,YAAKL,gBAAMC,IAAN,EAAL;AADN;AADM;AAZQ,GAAL;AAAA,CAApB;;eAmBe,wBAAWN,MAAX,EAAmBlD,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash/debounce';\nimport isEmpty from 'lodash/isEmpty';\nimport isEqual from 'lodash/isEqual';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { ConstructedResponse } from '@pie-lib/mask-markup';\nimport { color, Collapsible, hasText } from '@pie-lib/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n prompt: PropTypes.string,\n note: PropTypes.string,\n showNote: PropTypes.bool,\n env: PropTypes.object,\n rationale: PropTypes.string,\n disabled: PropTypes.bool,\n markup: PropTypes.string,\n mode: PropTypes.string,\n teacherInstructions: PropTypes.string,\n value: PropTypes.object,\n feedback: PropTypes.object,\n onChange: PropTypes.func,\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n maxLengthPerChoice: PropTypes.array\n };\n\n static defaultProps = {\n value: {}\n };\n\n state = {\n showCorrectAnswer: this.props.alwaysShowCorrect || false,\n value: this.props.value\n };\n\n // if for all responses max length is 1, call onChange for each keystroke\n getChangeSession = maxLengthPerChoice =>\n maxLengthPerChoice && maxLengthPerChoice.every((val, i, arr) => val === arr[0] && val === 1) ? this.props.onChange\n : debounce(this.props.onChange, 1500, { maxWait: 1500 });\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { maxLengthPerChoice } = this.props;\n\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n\n if (nextProps.alwaysShowCorrect) {\n this.setState({ showCorrectAnswer: true });\n }\n\n if (maxLengthPerChoice && !isEqual(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {\n this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);\n }\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n changeSession = this.getChangeSession(this.props.maxLengthPerChoice);\n\n onChange = value => {\n this.setState({ value });\n\n this.changeSession(value);\n };\n\n render() {\n const { showCorrectAnswer, value } = this.state;\n const {\n classes,\n mode,\n prompt,\n rationale,\n teacherInstructions,\n note,\n showNote,\n env,\n animationsDisabled,\n alwaysShowCorrect,\n maxLengthPerChoice\n } = this.props;\n const { role } = env || {};\n const displayNote = (showCorrectAnswer || mode === 'view' && role === 'instructor') && showNote && note;\n const mainClasses = classNames([classes.mainContainer, alwaysShowCorrect ? classes.noBorderColor : {}]);\n\n const teacherInstructionsDiv = <div\n className=\"teacher-instructions\"\n dangerouslySetInnerHTML={{ __html: teacherInstructions }}\n />;\n\n const rationaleDiv = <div className=\"rationale\" dangerouslySetInnerHTML={{ __html: rationale }}/>;\n\n return (\n <div className={mainClasses}>\n {\n teacherInstructions && hasText(teacherInstructions) && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? <Collapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n : teacherInstructionsDiv}\n </div>\n )\n }\n {!alwaysShowCorrect && <CorrectAnswerToggle\n show={mode === 'evaluate'}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n />}\n {prompt && <div className=\"prompt\" dangerouslySetInnerHTML={{ __html: prompt }}/>}\n <ConstructedResponse\n {...this.props}\n onChange={this.onChange}\n showCorrectAnswer={showCorrectAnswer}\n value={value}\n maxLength={maxLengthPerChoice}\n />\n {displayNote && (\n <div\n className={classNames(classes.note, 'note')}\n dangerouslySetInnerHTML={{ __html: `<strong>Note:</strong> ${note}` }}\n />\n )}\n {rationale && hasText(rationale) && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? <Collapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n >\n {rationaleDiv}\n </Collapsible>\n : rationaleDiv}\n </div>\n )}\n </div>\n );\n }\n}\n\nconst styles = theme => ({\n mainContainer: {\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.background()\n },\n note: {\n padding: '5px 0',\n },\n collapsible: {\n margin: `${theme.spacing.unit * 2}px 0`,\n },\n noBorderColor: {\n '& *': {\n borderColor: `${color.text()} !important`\n }\n }\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "3.10.5",
7
+ "version": "3.11.1-next.0+d2dc19035",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -14,7 +14,7 @@
14
14
  "@material-ui/core": "^3.9.2",
15
15
  "@pie-framework/pie-player-events": "^0.1.0",
16
16
  "@pie-lib/correct-answer-toggle": "^2.3.31",
17
- "@pie-lib/mask-markup": "^1.11.1",
17
+ "@pie-lib/mask-markup": "^1.11.2",
18
18
  "@pie-lib/math-rendering": "^2.3.11",
19
19
  "@pie-lib/render-ui": "^4.12.2",
20
20
  "classnames": "^2.2.5",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "author": "",
27
27
  "license": "ISC",
28
- "gitHead": "39691eb79f1f5ece91c831add33b05871b20828b",
28
+ "gitHead": "d2dc19035d4961c1c47b2b41dca50c756915da76",
29
29
  "main": "lib/index.js",
30
30
  "module": "src/index.js",
31
31
  "exports": {