@pie-element/explicit-constructed-response 7.5.7-next.2 → 7.5.7-next.23

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.
@@ -8,7 +8,7 @@
8
8
  "@material-ui/core": "^3.9.2",
9
9
  "@material-ui/icons": "^3.0.1",
10
10
  "@pie-framework/pie-configure-events": "^1.3.0",
11
- "@pie-lib/pie-toolbox": "2.16.0",
11
+ "@pie-lib/pie-toolbox": "2.17.5",
12
12
  "classnames": "^2.2.6",
13
13
  "debug": "^3.1.0",
14
14
  "lodash": "^4.17.15",
@@ -8,7 +8,7 @@
8
8
  "author": "",
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
- "@pie-lib/pie-toolbox": "2.16.0",
11
+ "@pie-lib/pie-toolbox": "2.17.5",
12
12
  "debug": "^3.1.0",
13
13
  "he": "^1.2.0",
14
14
  "lodash": "^4.17.15",
package/lib/main.js CHANGED
@@ -162,6 +162,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
162
162
  prompt: rationale
163
163
  });
164
164
 
165
+ var showRationale = rationale && ((0, _renderUi.hasText)(rationale) || (0, _renderUi.hasMedia)(rationale));
166
+ var showTeacherInstructions = teacherInstructions && ((0, _renderUi.hasText)(teacherInstructions) || (0, _renderUi.hasMedia)(teacherInstructions));
165
167
  return /*#__PURE__*/_react["default"].createElement(_renderUi.UiLayout, {
166
168
  extraCSSRules: extraCSSRules,
167
169
  className: mainClasses,
@@ -170,7 +172,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
170
172
  }
171
173
  }, mode === 'gather' && /*#__PURE__*/_react["default"].createElement("h2", {
172
174
  className: classes.srOnly
173
- }, "Fill in the Blank Question"), teacherInstructions && (0, _renderUi.hasText)(teacherInstructions) && /*#__PURE__*/_react["default"].createElement("div", {
175
+ }, "Fill in the Blank Question"), showTeacherInstructions && /*#__PURE__*/_react["default"].createElement("div", {
174
176
  className: classes.collapsible
175
177
  }, !animationsDisabled ? /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
176
178
  labels: {
@@ -197,7 +199,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
197
199
  dangerouslySetInnerHTML: {
198
200
  __html: note
199
201
  }
200
- }), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement("div", {
202
+ }), showRationale && /*#__PURE__*/_react["default"].createElement("div", {
201
203
  className: classes.collapsible
202
204
  }, !animationsDisabled ? /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
203
205
  labels: {
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.js"],"names":["translator","Translator","Main","showCorrectAnswer","props","alwaysShowCorrect","maxLengthPerChoice","every","val","i","arr","onChange","maxWait","setState","state","getChangeSession","value","changeSession","nextProps","language","note","feedback","t","lng","animationsDisabled","classes","mode","displayType","role","maxLengthPerChoiceEnabled","playerSpellCheckEnabled","prompt","rationale","showNote","teacherInstructions","responseAreaInputConfiguration","model","extraCSSRules","displayNote","mainClasses","mainContainer","noBorderColor","teacherInstructionsDiv","rationaleDiv","display","srOnly","collapsible","hidden","visible","toggleShowCorrect","__html","React","Component","PropTypes","bool","object","isRequired","disabled","string","markup","array","func","styles","theme","color","text","backgroundColor","background","inlineDisplay","blockDisplay","marginBottom","spacing","unit","borderColor","position","left","top","width","height","overflow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAQA,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;;IAEaE,I;;;;;;;;;;;;;;;8FA8BH;AACNC,MAAAA,iBAAiB,EAAE,MAAKC,KAAL,CAAWC,iBAAX,IAAgC;AAD7C,K;yGAKW,UAACC,kBAAD;AAAA,aACjBA,kBAAkB,IAAIA,kBAAkB,CAACC,KAAnB,CAAyB,UAACC,GAAD,EAAMC,CAAN,EAASC,GAAT;AAAA,e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,MAAAA,KAAK,EAAE,KAJD;AAKNC,MAAAA,MAAM,EAAE,KALF;AAMNC,MAAAA,QAAQ,EAAE;AANJ;AAtBiB,GAAZ;AAAA,CAAf;;eAgCe,wBAAWjB,MAAX,EAAmB5D,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/pie-toolbox/correct-answer-toggle';\nimport { ConstructedResponse } from '@pie-lib/pie-toolbox/mask-markup';\nimport { color, Collapsible, hasText, PreviewPrompt, UiLayout } from '@pie-lib/pie-toolbox/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport Translator from '@pie-lib/pie-toolbox/translator';\n\nconst { translator } = Translator;\n\nexport class Main extends React.Component {\n static propTypes = {\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n disabled: PropTypes.bool,\n displayType: PropTypes.string,\n feedback: PropTypes.object,\n language: PropTypes.string,\n markup: PropTypes.string,\n maxLengthPerChoice: PropTypes.array,\n maxLengthPerChoiceEnabled: PropTypes.bool,\n mode: PropTypes.string,\n note: PropTypes.string,\n onChange: PropTypes.func,\n playerSpellCheckEnabled: PropTypes.bool,\n prompt: PropTypes.string,\n rationale: PropTypes.string,\n role: PropTypes.string,\n showNote: PropTypes.bool,\n teacherInstructions: PropTypes.string,\n value: PropTypes.object,\n responseAreaInputConfiguration: PropTypes.object,\n model: PropTypes.object.isRequired,\n };\n\n static defaultProps = {\n value: {},\n };\n\n state = {\n showCorrectAnswer: this.props.alwaysShowCorrect || false,\n };\n\n // if for all responses max length is 1, call onChange for each keystroke\n getChangeSession = (maxLengthPerChoice) =>\n maxLengthPerChoice && maxLengthPerChoice.every((val, i, arr) => val === arr[0] && val === 1)\n ? this.props.onChange\n : debounce(this.props.onChange, 200, { maxWait: 200 });\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { maxLengthPerChoice, language } = this.props;\n let { note } = this.props;\n\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n\n if (nextProps.alwaysShowCorrect) {\n this.setState({ showCorrectAnswer: true });\n }\n\n if (maxLengthPerChoice && !isEqual(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {\n this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);\n }\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (\n note &&\n language &&\n language !== nextProps.language &&\n note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: language })\n ) {\n note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextProps.language });\n }\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n changeSession = this.getChangeSession(this.props.maxLengthPerChoice);\n\n onChange = (value) => {\n this.changeSession(value);\n };\n\n render() {\n const { showCorrectAnswer } = this.state;\n const {\n alwaysShowCorrect,\n animationsDisabled,\n classes,\n mode,\n displayType,\n role,\n language,\n maxLengthPerChoice,\n maxLengthPerChoiceEnabled,\n note,\n playerSpellCheckEnabled,\n prompt,\n rationale,\n showNote,\n teacherInstructions,\n responseAreaInputConfiguration,\n model,\n value,\n } = this.props;\n\n const { extraCSSRules } = model || {};\n const displayNote = (showCorrectAnswer || (mode === 'view' && role === 'instructor')) && showNote && note;\n const mainClasses = classNames([\n classes.mainContainer,\n {\n [classes.noBorderColor]: alwaysShowCorrect,\n },\n ]);\n\n const teacherInstructionsDiv = (\n <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />\n );\n\n const rationaleDiv = <PreviewPrompt prompt={rationale} />;\n\n return (\n <UiLayout extraCSSRules={extraCSSRules} className={mainClasses} style={{ display: `${displayType}` }}>\n {mode === 'gather' && <h2 className={classes.srOnly}>Fill in the Blank Question</h2>}\n\n {teacherInstructions && hasText(teacherInstructions) && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}>\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </div>\n )}\n\n {prompt && <PreviewPrompt prompt={prompt} />}\n\n {!alwaysShowCorrect && (\n <CorrectAnswerToggle\n show={mode === 'evaluate'}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n )}\n\n <ConstructedResponse\n {...this.props}\n onChange={this.onChange}\n showCorrectAnswer={showCorrectAnswer}\n value={value}\n maxLength={maxLengthPerChoice}\n adjustedLimit={maxLengthPerChoiceEnabled}\n spellCheck={playerSpellCheckEnabled}\n pluginProps={responseAreaInputConfiguration}\n />\n\n {displayNote && <div className={classNames(classes.note, 'note')} dangerouslySetInnerHTML={{ __html: note }} />}\n\n {rationale && hasText(rationale) && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>{rationaleDiv}</Collapsible>\n ) : (\n rationaleDiv\n )}\n </div>\n )}\n </UiLayout>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n },\n inlineDisplay: {\n display: 'inline-block',\n },\n blockDisplay: {\n display: 'block',\n },\n note: {\n marginBottom: theme.spacing.unit * 2,\n },\n collapsible: {\n marginBottom: theme.spacing.unit * 2,\n },\n noBorderColor: {\n '& *': {\n borderColor: `${color.text()} !important`,\n },\n },\n srOnly: {\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n },\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
1
+ {"version":3,"sources":["../src/main.js"],"names":["translator","Translator","Main","showCorrectAnswer","props","alwaysShowCorrect","maxLengthPerChoice","every","val","i","arr","onChange","maxWait","setState","state","getChangeSession","value","changeSession","nextProps","language","note","feedback","t","lng","animationsDisabled","classes","mode","displayType","role","maxLengthPerChoiceEnabled","playerSpellCheckEnabled","prompt","rationale","showNote","teacherInstructions","responseAreaInputConfiguration","model","extraCSSRules","displayNote","mainClasses","mainContainer","noBorderColor","teacherInstructionsDiv","rationaleDiv","showRationale","showTeacherInstructions","display","srOnly","collapsible","hidden","visible","toggleShowCorrect","__html","React","Component","PropTypes","bool","object","isRequired","disabled","string","markup","array","func","styles","theme","color","text","backgroundColor","background","inlineDisplay","blockDisplay","marginBottom","spacing","unit","borderColor","position","left","top","width","height","overflow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAQA,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;;IAEaE,I;;;;;;;;;;;;;;;8FA8BH;AACNC,MAAAA,iBAAiB,EAAE,MAAKC,KAAL,CAAWC,iBAAX,IAAgC;AAD7C,K;yGAKW,UAACC,kBAAD;AAAA,aACjBA,kBAAkB,IAAIA,kBAAkB,CAACC,KAAnB,CAAyB,UAACC,GAAD,EAAMC,CAAN,EAASC,GAAT;AAAA,eAAiBF,GAAG,KAAKE,GAAG,CAAC,CAAD,CAAX,IAAkBF,GAAG,KAAK,CAA3C;AAAA,OAAzB,CAAtB,GACI,MAAKJ,KAAL,CAAWO,QADf,GAEI,0BAAS,MAAKP,KAAL,CAAWO,QAApB,EAA8B,GAA9B,EAAmC;AAAEC,QAAAA,OAAO,EAAE;AAAX,OAAnC,CAHa;AAAA,K;0GAkCC,YAAM;AACxB,YAAKC,QAAL,CAAc;AAAEV,QAAAA,iBAAiB,EAAE,CAAC,MAAKW,KAAL,CAAWX;AAAjC,OAAd;AACD,K;sGAEe,MAAKY,gBAAL,CAAsB,MAAKX,KAAL,CAAWE,kBAAjC,C;iGAEL,UAACU,KAAD,EAA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AA8B,EAAEoB,sBAAUE,MArBzB;AAsBjBrB,EAAAA,KAAK,EAAEmB,sBAAUE,MAAV,CAAiBC;AAtBP,C;iCADRxD,I,kBA0BW;AACpBc,EAAAA,KAAK,EAAE;AADa,C;;AAoJxB,IAAMgD,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBzB,IAAAA,aAAa,EAAE;AACb0B,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADM;AAEbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN;AAFJ,KADU;AAKzBC,IAAAA,aAAa,EAAE;AACbxB,MAAAA,OAAO,EAAE;AADI,KALU;AAQzByB,IAAAA,YAAY,EAAE;AACZzB,MAAAA,OAAO,EAAE;AADG,KARW;AAWzB1B,IAAAA,IAAI,EAAE;AACJoD,MAAAA,YAAY,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AAD/B,KAXmB;AAczB1B,IAAAA,WAAW,EAAE;AACXwB,MAAAA,YAAY,EAAEP,KAAK,CAACQ,OAAN,CAAcC,IAAd,GAAqB;AADxB,KAdY;AAiBzBjC,IAAAA,aAAa,EAAE;AACb,aAAO;AACLkC,QAAAA,WAAW,YAAKT,gBAAMC,IAAN,EAAL;AADN;AADM,KAjBU;AAsBzBpB,IAAAA,MAAM,EAAE;AACN6B,MAAAA,QAAQ,EAAE,UADJ;AAENC,MAAAA,IAAI,EAAE,UAFA;AAGNC,MAAAA,GAAG,EAAE,MAHC;AAINC,MAAAA,KAAK,EAAE,KAJD;AAKNC,MAAAA,MAAM,EAAE,KALF;AAMNC,MAAAA,QAAQ,EAAE;AANJ;AAtBiB,GAAZ;AAAA,CAAf;;eAgCe,wBAAWjB,MAAX,EAAmB9D,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport debounce from 'lodash/debounce';\nimport isEmpty from 'lodash/isEmpty';\nimport isEqual from 'lodash/isEqual';\nimport { CorrectAnswerToggle } from '@pie-lib/pie-toolbox/correct-answer-toggle';\nimport { ConstructedResponse } from '@pie-lib/pie-toolbox/mask-markup';\nimport { color, Collapsible, hasText, hasMedia, PreviewPrompt, UiLayout } from '@pie-lib/pie-toolbox/render-ui';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport Translator from '@pie-lib/pie-toolbox/translator';\n\nconst { translator } = Translator;\n\nexport class Main extends React.Component {\n static propTypes = {\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n disabled: PropTypes.bool,\n displayType: PropTypes.string,\n feedback: PropTypes.object,\n language: PropTypes.string,\n markup: PropTypes.string,\n maxLengthPerChoice: PropTypes.array,\n maxLengthPerChoiceEnabled: PropTypes.bool,\n mode: PropTypes.string,\n note: PropTypes.string,\n onChange: PropTypes.func,\n playerSpellCheckEnabled: PropTypes.bool,\n prompt: PropTypes.string,\n rationale: PropTypes.string,\n role: PropTypes.string,\n showNote: PropTypes.bool,\n teacherInstructions: PropTypes.string,\n value: PropTypes.object,\n responseAreaInputConfiguration: PropTypes.object,\n model: PropTypes.object.isRequired,\n };\n\n static defaultProps = {\n value: {},\n };\n\n state = {\n showCorrectAnswer: this.props.alwaysShowCorrect || false,\n };\n\n // if for all responses max length is 1, call onChange for each keystroke\n getChangeSession = (maxLengthPerChoice) =>\n maxLengthPerChoice && maxLengthPerChoice.every((val, i, arr) => val === arr[0] && val === 1)\n ? this.props.onChange\n : debounce(this.props.onChange, 200, { maxWait: 200 });\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { maxLengthPerChoice, language } = this.props;\n let { note } = this.props;\n\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n\n if (nextProps.alwaysShowCorrect) {\n this.setState({ showCorrectAnswer: true });\n }\n\n if (maxLengthPerChoice && !isEqual(maxLengthPerChoice, nextProps.maxLengthPerChoice)) {\n this.changeSession = this.getChangeSession(nextProps.maxLengthPerChoice);\n }\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (\n note &&\n language &&\n language !== nextProps.language &&\n note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: language })\n ) {\n note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextProps.language });\n }\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n changeSession = this.getChangeSession(this.props.maxLengthPerChoice);\n\n onChange = (value) => {\n this.changeSession(value);\n };\n\n render() {\n const { showCorrectAnswer } = this.state;\n const {\n alwaysShowCorrect,\n animationsDisabled,\n classes,\n mode,\n displayType,\n role,\n language,\n maxLengthPerChoice,\n maxLengthPerChoiceEnabled,\n note,\n playerSpellCheckEnabled,\n prompt,\n rationale,\n showNote,\n teacherInstructions,\n responseAreaInputConfiguration,\n model,\n value,\n } = this.props;\n\n const { extraCSSRules } = model || {};\n const displayNote = (showCorrectAnswer || (mode === 'view' && role === 'instructor')) && showNote && note;\n const mainClasses = classNames([\n classes.mainContainer,\n {\n [classes.noBorderColor]: alwaysShowCorrect,\n },\n ]);\n\n const teacherInstructionsDiv = (\n <PreviewPrompt defaultClassName=\"teacher-instructions\" prompt={teacherInstructions} />\n );\n\n const rationaleDiv = <PreviewPrompt prompt={rationale} />;\n\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions = teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n return (\n <UiLayout extraCSSRules={extraCSSRules} className={mainClasses} style={{ display: `${displayType}` }}>\n {mode === 'gather' && <h2 className={classes.srOnly}>Fill in the Blank Question</h2>}\n\n {showTeacherInstructions && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}>\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </div>\n )}\n\n {prompt && <PreviewPrompt prompt={prompt} />}\n\n {!alwaysShowCorrect && (\n <CorrectAnswerToggle\n show={mode === 'evaluate'}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n )}\n\n <ConstructedResponse\n {...this.props}\n onChange={this.onChange}\n showCorrectAnswer={showCorrectAnswer}\n value={value}\n maxLength={maxLengthPerChoice}\n adjustedLimit={maxLengthPerChoiceEnabled}\n spellCheck={playerSpellCheckEnabled}\n pluginProps={responseAreaInputConfiguration}\n />\n\n {displayNote && <div className={classNames(classes.note, 'note')} dangerouslySetInnerHTML={{ __html: note }} />}\n\n {showRationale && (\n <div className={classes.collapsible}>\n {!animationsDisabled ? (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>{rationaleDiv}</Collapsible>\n ) : (\n rationaleDiv\n )}\n </div>\n )}\n </UiLayout>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n },\n inlineDisplay: {\n display: 'inline-block',\n },\n blockDisplay: {\n display: 'block',\n },\n note: {\n marginBottom: theme.spacing.unit * 2,\n },\n collapsible: {\n marginBottom: theme.spacing.unit * 2,\n },\n noBorderColor: {\n '& *': {\n borderColor: `${color.text()} !important`,\n },\n },\n srOnly: {\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n },\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.9.0/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@6.2.0/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@4.1.5/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@7.0.3/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.9.0/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@6.2.0/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@4.1.5/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@7.0.3/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
5
5
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -140856,9 +140856,9 @@ Object.defineProperty(hasText$2, "__esModule", {
140856
140856
  value: true
140857
140857
  });
140858
140858
  hasText$2.hasText = void 0;
140859
- var dp = new DOMParser();
140859
+ var dp$1 = new DOMParser();
140860
140860
  var markupToText = function markupToText(s) {
140861
- var root = dp.parseFromString(s, 'text/html');
140861
+ var root = dp$1.parseFromString(s, 'text/html');
140862
140862
  return root.body.textContent;
140863
140863
  };
140864
140864
  var hasText$1 = function hasText(s) {
@@ -140869,6 +140869,20 @@ var hasText$1 = function hasText(s) {
140869
140869
  return !!(tc && tc.trim());
140870
140870
  };
140871
140871
  hasText$2.hasText = hasText$1;
140872
+ var hasMedia$2 = {};
140873
+ Object.defineProperty(hasMedia$2, "__esModule", {
140874
+ value: true
140875
+ });
140876
+ hasMedia$2.hasMedia = void 0;
140877
+ var dp = new DOMParser();
140878
+ var hasMedia$1 = function hasMedia(s) {
140879
+ if (!s) {
140880
+ return false;
140881
+ }
140882
+ var root = dp.parseFromString(s, 'text/html');
140883
+ return !!root.body.querySelector('img') || !!root.body.querySelector('video') || !!root.body.querySelector('audio');
140884
+ };
140885
+ hasMedia$2.hasMedia = hasMedia$1;
140872
140886
  var enableAudioAutoplayImage = {};
140873
140887
  (function (exports) {
140874
140888
  Object.defineProperty(exports, "__esModule", {
@@ -140946,6 +140960,12 @@ getDefaultExportFromCjs(enableAudioAutoplayImage);
140946
140960
  }
140947
140961
  });
140948
140962
  exports.color = void 0;
140963
+ Object.defineProperty(exports, "hasMedia", {
140964
+ enumerable: true,
140965
+ get: function get() {
140966
+ return _hasMedia.hasMedia;
140967
+ }
140968
+ });
140949
140969
  Object.defineProperty(exports, "hasText", {
140950
140970
  enumerable: true,
140951
140971
  get: function get() {
@@ -140974,6 +140994,7 @@ getDefaultExportFromCjs(enableAudioAutoplayImage);
140974
140994
  var color = _interopRequireWildcard(color$1);
140975
140995
  exports.color = color;
140976
140996
  var _hasText = hasText$2;
140997
+ var _hasMedia = hasMedia$2;
140977
140998
  var _enableAudioAutoplayImage = _interopRequireDefault(enableAudioAutoplayImage);
140978
140999
  function _getRequireWildcardCache(nodeInterop) {
140979
141000
  if (typeof WeakMap !== "function") return null;
@@ -145561,6 +145582,12 @@ var renderUi = {};
145561
145582
  return _renderUi.color;
145562
145583
  }
145563
145584
  });
145585
+ Object.defineProperty(exports, "hasMedia", {
145586
+ enumerable: true,
145587
+ get: function get() {
145588
+ return _renderUi.hasMedia;
145589
+ }
145590
+ });
145564
145591
  Object.defineProperty(exports, "hasText", {
145565
145592
  enumerable: true,
145566
145593
  get: function get() {
@@ -184730,6 +184757,7 @@ const {CorrectAnswerToggle: CorrectAnswerToggle} = _dll_pie_lib__pie_toolbox_cor
184730
184757
  const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
184731
184758
  const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
184732
184759
  const {hasText: hasText} = _dll_pie_lib__pie_toolbox_render_ui;
184760
+ const {hasMedia: hasMedia} = _dll_pie_lib__pie_toolbox_render_ui;
184733
184761
  const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
184734
184762
  const {UiLayout: UiLayout} = _dll_pie_lib__pie_toolbox_render_ui;
184735
184763
  const _jsxFileName = "/home/circleci/repo/packages/explicit-constructed-response/src/main.js";
@@ -184848,6 +184876,8 @@ class Main extends React$1.Component {
184848
184876
  lineNumber: 130
184849
184877
  }
184850
184878
  });
184879
+ const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));
184880
+ const showTeacherInstructions = teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));
184851
184881
  return React$1.createElement(UiLayout, {
184852
184882
  extraCSSRules: extraCSSRules,
184853
184883
  className: mainClasses,
@@ -184857,21 +184887,21 @@ class Main extends React$1.Component {
184857
184887
  __self: this,
184858
184888
  __source: {
184859
184889
  fileName: _jsxFileName,
184860
- lineNumber: 133
184890
+ lineNumber: 136
184861
184891
  }
184862
184892
  }, mode === 'gather' && React$1.createElement('h2', {
184863
184893
  className: classes.srOnly,
184864
184894
  __self: this,
184865
184895
  __source: {
184866
184896
  fileName: _jsxFileName,
184867
- lineNumber: 134
184897
+ lineNumber: 137
184868
184898
  }
184869
- }, "Fill in the Blank Question"), teacherInstructions && hasText(teacherInstructions) && React$1.createElement('div', {
184899
+ }, "Fill in the Blank Question"), showTeacherInstructions && React$1.createElement('div', {
184870
184900
  className: classes.collapsible,
184871
184901
  __self: this,
184872
184902
  __source: {
184873
184903
  fileName: _jsxFileName,
184874
- lineNumber: 137
184904
+ lineNumber: 140
184875
184905
  }
184876
184906
  }, !animationsDisabled ? React$1.createElement(Collapsible, {
184877
184907
  labels: {
@@ -184881,14 +184911,14 @@ class Main extends React$1.Component {
184881
184911
  __self: this,
184882
184912
  __source: {
184883
184913
  fileName: _jsxFileName,
184884
- lineNumber: 139
184914
+ lineNumber: 142
184885
184915
  }
184886
184916
  }, teacherInstructionsDiv) : teacherInstructionsDiv), prompt && React$1.createElement(PreviewPrompt, {
184887
184917
  prompt: prompt,
184888
184918
  __self: this,
184889
184919
  __source: {
184890
184920
  fileName: _jsxFileName,
184891
- lineNumber: 148
184921
+ lineNumber: 151
184892
184922
  }
184893
184923
  }), !alwaysShowCorrect && React$1.createElement(CorrectAnswerToggle, {
184894
184924
  show: mode === 'evaluate',
@@ -184898,7 +184928,7 @@ class Main extends React$1.Component {
184898
184928
  __self: this,
184899
184929
  __source: {
184900
184930
  fileName: _jsxFileName,
184901
- lineNumber: 151
184931
+ lineNumber: 154
184902
184932
  }
184903
184933
  }), React$1.createElement(maskMarkup$1.ConstructedResponse, {
184904
184934
  ...this.props,
@@ -184912,7 +184942,7 @@ class Main extends React$1.Component {
184912
184942
  __self: this,
184913
184943
  __source: {
184914
184944
  fileName: _jsxFileName,
184915
- lineNumber: 159
184945
+ lineNumber: 162
184916
184946
  }
184917
184947
  }), displayNote && React$1.createElement('div', {
184918
184948
  className: classNames(classes.note, 'note'),
@@ -184922,14 +184952,14 @@ class Main extends React$1.Component {
184922
184952
  __self: this,
184923
184953
  __source: {
184924
184954
  fileName: _jsxFileName,
184925
- lineNumber: 170
184955
+ lineNumber: 173
184926
184956
  }
184927
- }), rationale && hasText(rationale) && React$1.createElement('div', {
184957
+ }), showRationale && React$1.createElement('div', {
184928
184958
  className: classes.collapsible,
184929
184959
  __self: this,
184930
184960
  __source: {
184931
184961
  fileName: _jsxFileName,
184932
- lineNumber: 173
184962
+ lineNumber: 176
184933
184963
  }
184934
184964
  }, !animationsDisabled ? React$1.createElement(Collapsible, {
184935
184965
  labels: {
@@ -184939,7 +184969,7 @@ class Main extends React$1.Component {
184939
184969
  __self: this,
184940
184970
  __source: {
184941
184971
  fileName: _jsxFileName,
184942
- lineNumber: 175
184972
+ lineNumber: 178
184943
184973
  }
184944
184974
  }, rationaleDiv) : rationaleDiv));
184945
184975
  }
@@ -4,11 +4,11 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "3.9.0"
7
+ "version": "4.1.5"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "6.2.0"
11
+ "version": "7.0.3"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.9.0/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@6.2.0/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_classnames, _dll_react_dom, _dll_pie_framework__mathquill, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@4.1.5/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_correct_answer_toggle, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@7.0.3/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
5
5
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -140819,9 +140819,9 @@ Object.defineProperty(hasText$2, "__esModule", {
140819
140819
  value: true
140820
140820
  });
140821
140821
  hasText$2.hasText = void 0;
140822
- var dp = new DOMParser();
140822
+ var dp$1 = new DOMParser();
140823
140823
  var markupToText = function markupToText(s) {
140824
- var root = dp.parseFromString(s, 'text/html');
140824
+ var root = dp$1.parseFromString(s, 'text/html');
140825
140825
  return root.body.textContent;
140826
140826
  };
140827
140827
  var hasText$1 = function hasText(s) {
@@ -140832,6 +140832,20 @@ var hasText$1 = function hasText(s) {
140832
140832
  return !!(tc && tc.trim());
140833
140833
  };
140834
140834
  hasText$2.hasText = hasText$1;
140835
+ var hasMedia$2 = {};
140836
+ Object.defineProperty(hasMedia$2, "__esModule", {
140837
+ value: true
140838
+ });
140839
+ hasMedia$2.hasMedia = void 0;
140840
+ var dp = new DOMParser();
140841
+ var hasMedia$1 = function hasMedia(s) {
140842
+ if (!s) {
140843
+ return false;
140844
+ }
140845
+ var root = dp.parseFromString(s, 'text/html');
140846
+ return !!root.body.querySelector('img') || !!root.body.querySelector('video') || !!root.body.querySelector('audio');
140847
+ };
140848
+ hasMedia$2.hasMedia = hasMedia$1;
140835
140849
  var enableAudioAutoplayImage = {};
140836
140850
  (function (exports) {
140837
140851
  Object.defineProperty(exports, "__esModule", {
@@ -140909,6 +140923,12 @@ getDefaultExportFromCjs(enableAudioAutoplayImage);
140909
140923
  }
140910
140924
  });
140911
140925
  exports.color = void 0;
140926
+ Object.defineProperty(exports, "hasMedia", {
140927
+ enumerable: true,
140928
+ get: function get() {
140929
+ return _hasMedia.hasMedia;
140930
+ }
140931
+ });
140912
140932
  Object.defineProperty(exports, "hasText", {
140913
140933
  enumerable: true,
140914
140934
  get: function get() {
@@ -140937,6 +140957,7 @@ getDefaultExportFromCjs(enableAudioAutoplayImage);
140937
140957
  var color = _interopRequireWildcard(color$1);
140938
140958
  exports.color = color;
140939
140959
  var _hasText = hasText$2;
140960
+ var _hasMedia = hasMedia$2;
140940
140961
  var _enableAudioAutoplayImage = _interopRequireDefault(enableAudioAutoplayImage);
140941
140962
  function _getRequireWildcardCache(nodeInterop) {
140942
140963
  if (typeof WeakMap !== "function") return null;
@@ -145524,6 +145545,12 @@ var renderUi = {};
145524
145545
  return _renderUi.color;
145525
145546
  }
145526
145547
  });
145548
+ Object.defineProperty(exports, "hasMedia", {
145549
+ enumerable: true,
145550
+ get: function get() {
145551
+ return _renderUi.hasMedia;
145552
+ }
145553
+ });
145527
145554
  Object.defineProperty(exports, "hasText", {
145528
145555
  enumerable: true,
145529
145556
  get: function get() {
@@ -184693,6 +184720,7 @@ const {CorrectAnswerToggle: CorrectAnswerToggle} = _dll_pie_lib__pie_toolbox_cor
184693
184720
  const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
184694
184721
  const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
184695
184722
  const {hasText: hasText} = _dll_pie_lib__pie_toolbox_render_ui;
184723
+ const {hasMedia: hasMedia} = _dll_pie_lib__pie_toolbox_render_ui;
184696
184724
  const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
184697
184725
  const {UiLayout: UiLayout} = _dll_pie_lib__pie_toolbox_render_ui;
184698
184726
  const _jsxFileName = "/home/circleci/repo/packages/explicit-constructed-response/src/main.js";
@@ -184811,6 +184839,8 @@ class Main extends React$1.Component {
184811
184839
  lineNumber: 130
184812
184840
  }
184813
184841
  });
184842
+ const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));
184843
+ const showTeacherInstructions = teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));
184814
184844
  return React$1.createElement(UiLayout, {
184815
184845
  extraCSSRules: extraCSSRules,
184816
184846
  className: mainClasses,
@@ -184820,21 +184850,21 @@ class Main extends React$1.Component {
184820
184850
  __self: this,
184821
184851
  __source: {
184822
184852
  fileName: _jsxFileName,
184823
- lineNumber: 133
184853
+ lineNumber: 136
184824
184854
  }
184825
184855
  }, mode === 'gather' && React$1.createElement('h2', {
184826
184856
  className: classes.srOnly,
184827
184857
  __self: this,
184828
184858
  __source: {
184829
184859
  fileName: _jsxFileName,
184830
- lineNumber: 134
184860
+ lineNumber: 137
184831
184861
  }
184832
- }, "Fill in the Blank Question"), teacherInstructions && hasText(teacherInstructions) && React$1.createElement('div', {
184862
+ }, "Fill in the Blank Question"), showTeacherInstructions && React$1.createElement('div', {
184833
184863
  className: classes.collapsible,
184834
184864
  __self: this,
184835
184865
  __source: {
184836
184866
  fileName: _jsxFileName,
184837
- lineNumber: 137
184867
+ lineNumber: 140
184838
184868
  }
184839
184869
  }, !animationsDisabled ? React$1.createElement(Collapsible, {
184840
184870
  labels: {
@@ -184844,14 +184874,14 @@ class Main extends React$1.Component {
184844
184874
  __self: this,
184845
184875
  __source: {
184846
184876
  fileName: _jsxFileName,
184847
- lineNumber: 139
184877
+ lineNumber: 142
184848
184878
  }
184849
184879
  }, teacherInstructionsDiv) : teacherInstructionsDiv), prompt && React$1.createElement(PreviewPrompt, {
184850
184880
  prompt: prompt,
184851
184881
  __self: this,
184852
184882
  __source: {
184853
184883
  fileName: _jsxFileName,
184854
- lineNumber: 148
184884
+ lineNumber: 151
184855
184885
  }
184856
184886
  }), !alwaysShowCorrect && React$1.createElement(CorrectAnswerToggle, {
184857
184887
  show: mode === 'evaluate',
@@ -184861,7 +184891,7 @@ class Main extends React$1.Component {
184861
184891
  __self: this,
184862
184892
  __source: {
184863
184893
  fileName: _jsxFileName,
184864
- lineNumber: 151
184894
+ lineNumber: 154
184865
184895
  }
184866
184896
  }), React$1.createElement(maskMarkup$1.ConstructedResponse, {
184867
184897
  ...this.props,
@@ -184875,7 +184905,7 @@ class Main extends React$1.Component {
184875
184905
  __self: this,
184876
184906
  __source: {
184877
184907
  fileName: _jsxFileName,
184878
- lineNumber: 159
184908
+ lineNumber: 162
184879
184909
  }
184880
184910
  }), displayNote && React$1.createElement('div', {
184881
184911
  className: classNames(classes.note, 'note'),
@@ -184885,14 +184915,14 @@ class Main extends React$1.Component {
184885
184915
  __self: this,
184886
184916
  __source: {
184887
184917
  fileName: _jsxFileName,
184888
- lineNumber: 170
184918
+ lineNumber: 173
184889
184919
  }
184890
- }), rationale && hasText(rationale) && React$1.createElement('div', {
184920
+ }), showRationale && React$1.createElement('div', {
184891
184921
  className: classes.collapsible,
184892
184922
  __self: this,
184893
184923
  __source: {
184894
184924
  fileName: _jsxFileName,
184895
- lineNumber: 173
184925
+ lineNumber: 176
184896
184926
  }
184897
184927
  }, !animationsDisabled ? React$1.createElement(Collapsible, {
184898
184928
  labels: {
@@ -184902,7 +184932,7 @@ class Main extends React$1.Component {
184902
184932
  __self: this,
184903
184933
  __source: {
184904
184934
  fileName: _jsxFileName,
184905
- lineNumber: 175
184935
+ lineNumber: 178
184906
184936
  }
184907
184937
  }, rationaleDiv) : rationaleDiv));
184908
184938
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "7.5.7-next.2+21ecb8bdd",
7
+ "version": "7.5.7-next.23+a4f149acd",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "postpublish": "../../scripts/postpublish"
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@material-ui/core": "^3.9.2",
14
14
  "@pie-framework/pie-player-events": "^0.1.0",
15
- "@pie-lib/pie-toolbox": "2.16.0",
15
+ "@pie-lib/pie-toolbox": "2.17.5",
16
16
  "classnames": "^2.2.5",
17
17
  "he": "^1.2.0",
18
18
  "lodash": "^4.17.10",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "author": "",
24
24
  "license": "ISC",
25
- "gitHead": "21ecb8bdd2ac0d202c57aeed447dda1541723cda",
25
+ "gitHead": "a4f149acd5cd9b387b8b2bd51e348be1ea7c1201",
26
26
  "main": "lib/index.js",
27
27
  "module": "src/index.js",
28
28
  "exports": {