@pie-element/multiple-choice 9.15.2 → 9.15.3-hotfix.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,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
+ ## [9.15.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@9.15.2...@pie-element/multiple-choice@9.15.3) (2025-04-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update pie-lib/pie-toolbox PD-4967 ([cf4c095](https://github.com/pie-framework/pie-elements/commit/cf4c095f21a2e9bdf74ce5a419ad5fc8d0d7f6ca))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [9.15.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@9.15.1...@pie-element/multiple-choice@9.15.2) (2025-04-17)
7
18
 
8
19
 
@@ -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
+ ## [7.6.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@7.6.2...@pie-element/multiple-choice-configure@7.6.3) (2025-04-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update pie-lib/pie-toolbox PD-4967 ([cf4c095](https://github.com/pie-framework/pie-elements/commit/cf4c095f21a2e9bdf74ce5a419ad5fc8d0d7f6ca))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [7.6.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@7.6.1...@pie-element/multiple-choice-configure@7.6.2) (2025-04-17)
7
18
 
8
19
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice-configure",
3
- "version": "7.6.2",
3
+ "version": "7.6.3",
4
4
  "private": true,
5
5
  "main": "lib/index.js",
6
6
  "module": "src/index.js",
@@ -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.14.1",
11
+ "@pie-lib/pie-toolbox": "2.14.3",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15",
14
14
  "prop-types": "^15.6.2",
@@ -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
+ ## [5.9.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@5.9.2...@pie-element/multiple-choice-controller@5.9.3) (2025-04-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * update pie-lib/pie-toolbox PD-4967 ([cf4c095](https://github.com/pie-framework/pie-elements/commit/cf4c095f21a2e9bdf74ce5a419ad5fc8d0d7f6ca))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [5.9.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@5.9.1...@pie-element/multiple-choice-controller@5.9.2) (2025-04-17)
7
18
 
8
19
 
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice-controller",
3
3
  "private": true,
4
- "version": "5.9.2",
4
+ "version": "5.9.3",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
8
8
  "author": "",
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
- "@pie-lib/pie-toolbox": "2.14.1",
11
+ "@pie-lib/pie-toolbox": "2.14.3",
12
12
  "debug": "^3.1.0",
13
13
  "lodash": "^4.17.15"
14
14
  }
@@ -226,9 +226,20 @@ var MultipleChoice = /*#__PURE__*/function (_React$Component) {
226
226
  }, {
227
227
  key: "getChecked",
228
228
  value: function getChecked(choice) {
229
- if (this.state.showCorrect) {
229
+ // check for print context: options prop is passed from print.js and alwaysShowCorrect is true
230
+ var isPrintMode = this.props.options && this.props.alwaysShowCorrect;
231
+
232
+ if (isPrintMode) {
230
233
  return choice.correct || false;
231
- }
234
+ } // evaluate mode with show correct toggled
235
+
236
+
237
+ var isEvaluateMode = this.state.showCorrect && this.props.mode === 'evaluate';
238
+
239
+ if (isEvaluateMode) {
240
+ return choice.correct || false;
241
+ } // default behavior: show what the user has selected
242
+
232
243
 
233
244
  return this.isSelected(choice.value);
234
245
  } // renderHeading function was added for accessibility.
@@ -410,7 +421,8 @@ exports.MultipleChoice = MultipleChoice;
410
421
  customAudioButton: {
411
422
  playImage: _propTypes["default"].string,
412
423
  pauseImage: _propTypes["default"].string
413
- }
424
+ },
425
+ options: _propTypes["default"].object
414
426
  });
415
427
  MultipleChoice.defaultProps = {
416
428
  session: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/multiple-choice.jsx"],"names":["translator","Translator","styles","theme","main","color","text","backgroundColor","background","position","partLabel","display","fontSize","margin","fontWeight","paddingBottom","spacing","unit","teacherInstructions","marginBottom","horizontalLayout","flexDirection","flexWrap","gridLayout","fieldset","border","padding","minWidth","srOnly","left","top","width","height","overflow","errorText","typography","palette","error","paddingTop","MultipleChoice","props","event","target","value","checked","maxSelections","onChoiceChanged","session","length","setState","maxSelectionsErrorState","selected","selector","mode","showCorrect","state","onShowCorrectToggle","choice","isCorrect","correct","isChecked","isSelected","undefined","alwaysShowCorrect","onToggle","bind","sessionValue","indexOf","nextProps","correctResponse","index","keyMode","String","fromCharCode","toUpperCase","choiceMode","classes","disabled","className","choices","gridColumns","prompt","responseCorrect","animationsDisabled","language","isSelectionButtonBelow","minSelections","autoplayAudioEnabled","customAudioButton","isEvaluateMode","showCorrectAnswerToggle","columnsStyle","gridTemplateColumns","selections","teacherInstructionsDiv","getMultipleChoiceMinSelectionErrorMessage","t","lng","renderHeading","hidden","visible","choicesLayout","map","selectedAnswerBackgroundColor","handleChange","hideTick","getChecked","getCorrectness","indexToSymbol","React","Component","PropTypes","string","oneOf","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EyB,sBAAUQ,MAvBR;AAwBjB1E,EAAAA,aAAa,EAAEkE,sBAAUQ,MAxBR;AAyBjBhC,EAAAA,oBAAoB,EAAEwB,sBAAUK,IAzBf;AA0BjB5B,EAAAA,iBAAiB,EAAE;AACjBgC,IAAAA,SAAS,EAAET,sBAAUC,MADJ;AAEjBS,IAAAA,UAAU,EAAEV,sBAAUC;AAFL;AA1BF,C;AA4SrBzE,cAAc,CAACmF,YAAf,GAA8B;AAC5B3E,EAAAA,OAAO,EAAE;AACPJ,IAAAA,KAAK,EAAE;AADA;AADmB,CAA9B;;eAMe,wBAAWzC,MAAX,EAAmBqC,cAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { CorrectAnswerToggle } from '@pie-lib/pie-toolbox/correct-answer-toggle';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color, Collapsible, PreviewPrompt } from '@pie-lib/pie-toolbox/render-ui';\nimport Translator from '@pie-lib/pie-toolbox/translator';\n\nimport StyledChoice from './choice';\n\n// MultipleChoice\n\nconst { translator } = Translator;\n\nconst styles = (theme) => ({\n main: {\n color: color.text(),\n backgroundColor: color.background(),\n '& *': {\n '-webkit-font-smoothing': 'antialiased',\n },\n position: 'relative'\n },\n partLabel: {\n display: 'block',\n fontSize: 'inherit',\n margin: '0',\n fontWeight: 'normal',\n paddingBottom: theme.spacing.unit * 2,\n },\n teacherInstructions: {\n marginBottom: theme.spacing.unit * 2,\n },\n horizontalLayout: {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n },\n gridLayout: {\n display: 'grid',\n },\n fieldset: {\n border: '0px',\n padding: '0.01em 0 0 0',\n margin: '0px',\n minWidth: '0px',\n },\n srOnly: {\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit,\n },\n});\n\nexport class MultipleChoice extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n mode: PropTypes.oneOf(['gather', 'view', 'evaluate']),\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n keyMode: PropTypes.oneOf(['numbers', 'letters', 'none']),\n choices: PropTypes.array,\n partLabel: PropTypes.string,\n prompt: PropTypes.string,\n teacherInstructions: PropTypes.string,\n session: PropTypes.object,\n disabled: PropTypes.bool,\n onChoiceChanged: PropTypes.func,\n responseCorrect: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n correctResponse: PropTypes.array,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n gridColumns: PropTypes.string,\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n language: PropTypes.string,\n selectedAnswerBackgroundColor: PropTypes.string,\n onShowCorrectToggle: PropTypes.func,\n isSelectionButtonBelow: PropTypes.bool,\n minSelections: PropTypes.number,\n maxSelections: PropTypes.number,\n autoplayAudioEnabled: PropTypes.bool,\n customAudioButton: {\n playImage: PropTypes.string,\n pauseImage: PropTypes.string,\n }\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n showCorrect: this.props.alwaysShowCorrect || false,\n maxSelectionsErrorState: false,\n };\n\n this.onToggle = this.onToggle.bind(this);\n }\n\n isSelected(value) {\n const sessionValue = this.props.session && this.props.session.value;\n\n return sessionValue && sessionValue.indexOf && sessionValue.indexOf(value) >= 0;\n }\n\n // handleChange was added for accessibility. Please see comments and videos from PD-2441.\n handleChange = (event) => {\n const { value, checked } = event.target;\n const { maxSelections, onChoiceChanged, session } = this.props;\n\n if (session.value && session.value.length >= maxSelections) {\n // show/hide max selections error when user select/deselect an answer\n this.setState({ maxSelectionsErrorState: checked });\n\n if (checked) {\n // prevent selecting more answers\n return;\n }\n }\n\n onChoiceChanged({ value, selected: checked, selector: 'Mouse' });\n };\n\n onToggle = () => {\n if (this.props.mode === 'evaluate') {\n this.setState({ showCorrect: !this.state.showCorrect }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (!nextProps.correctResponse && this.state.showCorrect !== false) {\n this.setState({ showCorrect: false }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n\n if (nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {\n this.setState({ showCorrect: true }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n }\n\n indexToSymbol(index) {\n if (this.props.keyMode === 'numbers') {\n return `${index + 1}`;\n }\n\n if (this.props.keyMode === 'letters') {\n return String.fromCharCode(97 + index).toUpperCase();\n }\n\n return '';\n }\n\n getCorrectness = (choice = {}) => {\n const isCorrect = choice.correct;\n const isChecked = this.isSelected(choice.value);\n\n if (this.state.showCorrect) {\n return isCorrect ? 'correct' : undefined;\n }\n\n if (isCorrect) {\n if (isChecked) {\n // A correct answer is selected: marked with a green checkmark\n return 'correct';\n } else {\n // A correct answer is NOT selected: marked with an orange X\n return 'incorrect';\n }\n } else {\n if (isChecked) {\n // An incorrect answer is selected: marked with an orange X\n return 'incorrect';\n } else {\n // An incorrect answer is NOT selected: not marked\n return undefined;\n }\n }\n };\n\n getChecked(choice) {\n if (this.state.showCorrect) {\n return choice.correct || false;\n }\n\n return this.isSelected(choice.value);\n }\n\n // renderHeading function was added for accessibility.\n renderHeading() {\n const { mode, choiceMode, classes } = this.props;\n\n if (mode !== 'gather') {\n return null;\n }\n\n return choiceMode === 'radio' ? (\n <h2 className={classes.srOnly}>Multiple Choice Question</h2>\n ) : (\n <h2 className={classes.srOnly}>Multiple Select Question</h2>\n );\n }\n\n render() {\n const {\n mode,\n disabled,\n className,\n choices = [],\n choiceMode,\n gridColumns,\n partLabel,\n prompt,\n responseCorrect,\n teacherInstructions,\n classes,\n alwaysShowCorrect,\n animationsDisabled,\n language,\n isSelectionButtonBelow,\n minSelections,\n maxSelections,\n autoplayAudioEnabled,\n session,\n customAudioButton\n } = this.props;\n const { showCorrect, maxSelectionsErrorState } = this.state;\n const isEvaluateMode = mode === 'evaluate';\n const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;\n const columnsStyle = gridColumns > 1 ? { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` } : undefined;\n const selections = (session.value && session.value.length) || 0;\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n const getMultipleChoiceMinSelectionErrorMessage = () => {\n if (minSelections && maxSelections) {\n return minSelections === maxSelections\n ? translator.t('translation:multipleChoice:minmaxSelections_equal', { lng: language, minSelections })\n : translator.t('translation:multipleChoice:minmaxSelections_range', { lng: language, minSelections, maxSelections });\n }\n\n if (minSelections) {\n return translator.t('translation:multipleChoice:minSelections', { lng: language, minSelections });\n }\n\n return '';\n };\n\n return (\n <div id={'main-container'} className={classNames(classes.main, className, 'multiple-choice')}>\n {partLabel && <h3 className={classes.partLabel}>{partLabel}</h3>}\n\n {this.renderHeading()}\n\n {teacherInstructions && (\n <div className={classes.teacherInstructions}>\n {!animationsDisabled ? (\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </div>\n )}\n\n <fieldset className={classes.fieldset}>\n <PreviewPrompt\n className=\"prompt\"\n defaultClassName=\"prompt\"\n prompt={prompt}\n tagName={'legend'}\n autoplayAudioEnabled={autoplayAudioEnabled}\n customAudioButton={customAudioButton}\n />\n\n {!alwaysShowCorrect && (\n <CorrectAnswerToggle\n show={showCorrectAnswerToggle}\n toggled={showCorrect}\n onToggle={this.onToggle.bind(this)}\n language={language}\n />\n )}\n\n <div\n className={classNames({\n [classes.gridLayout]: this.props.choicesLayout === 'grid',\n [classes.horizontalLayout]: this.props.choicesLayout === 'horizontal',\n })}\n style={columnsStyle}\n >\n {choices.map((choice, index) => (\n <StyledChoice\n choicesLayout={this.props.choicesLayout}\n selectedAnswerBackgroundColor={this.props.selectedAnswerBackgroundColor}\n gridColumns={gridColumns}\n key={`choice-${index}`}\n choice={choice}\n index={index}\n choicesLength={choices.length}\n showCorrect={showCorrect}\n isEvaluateMode={isEvaluateMode}\n choiceMode={choiceMode}\n disabled={disabled}\n onChoiceChanged={this.handleChange}\n hideTick={choice.hideTick}\n checked={this.getChecked(choice)}\n correctness={isEvaluateMode ? this.getCorrectness(choice) : undefined}\n displayKey={this.indexToSymbol(index)}\n isSelectionButtonBelow={isSelectionButtonBelow}\n />\n ))}\n </div>\n </fieldset>\n\n {choiceMode === 'checkbox' && (selections < minSelections) && (\n <div className={classes.errorText}>\n {getMultipleChoiceMinSelectionErrorMessage()}\n </div>\n )}\n {choiceMode === 'checkbox' && maxSelectionsErrorState && (\n <div className={classes.errorText}>\n {translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {\n lng: language,\n maxSelections,\n })}\n </div>\n )}\n </div>\n );\n }\n}\n\nMultipleChoice.defaultProps = {\n session: {\n value: [],\n },\n};\n\nexport default withStyles(styles)(MultipleChoice);\n"],"file":"multiple-choice.js"}
1
+ {"version":3,"sources":["../src/multiple-choice.jsx"],"names":["translator","Translator","styles","theme","main","color","text","backgroundColor","background","position","partLabel","display","fontSize","margin","fontWeight","paddingBottom","spacing","unit","teacherInstructions","marginBottom","horizontalLayout","flexDirection","flexWrap","gridLayout","fieldset","border","padding","minWidth","srOnly","left","top","width","height","overflow","errorText","typography","palette","error","paddingTop","MultipleChoice","props","event","target","value","checked","maxSelections","onChoiceChanged","session","length","setState","maxSelectionsErrorState","selected","selector","mode","showCorrect","state","onShowCorrectToggle","choice","isCorrect","correct","isChecked","isSelected","undefined","alwaysShowCorrect","onToggle","bind","sessionValue","indexOf","nextProps","correctResponse","index","keyMode","String","fromCharCode","toUpperCase","isPrintMode","options","isEvaluateMode","choiceMode","classes","disabled","className","choices","gridColumns","prompt","responseCorrect","animationsDisabled","language","isSelectionButtonBelow","minSelections","autoplayAudioEnabled","customAudioButton","showCorrectAnswerToggle","columnsStyle","gridTemplateColumns","selections","teacherInstructionsDiv","getMultipleChoiceMinSelectionErrorMessage","t","lng","renderHeading","hidden","visible","choicesLayout","map","selectedAnswerBackgroundColor","handleChange","hideTick","getChecked","getCorrectness","indexToSymbol","React","Component","PropTypes","string","oneOf","array","object","bool","func","isRequired","number","playImage","pauseImage","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEA;AAEA,IAAQA,UAAR,GAAuBC,sBAAvB,CAAQD,UAAR;;AAEA,IAAME,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADH;AAEJC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN,EAFb;AAGJ,aAAO;AACL,kCAA0B;AADrB,OAHH;AAMJC,MAAAA,QAAQ,EAAE;AANN,KADmB;AASzBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,OAAO,EAAE,OADA;AAETC,MAAAA,QAAQ,EAAE,SAFD;AAGTC,MAAAA,MAAM,EAAE,GAHC;AAITC,MAAAA,UAAU,EAAE,QAJH;AAKTC,MAAAA,aAAa,EAAEZ,KAAK,CAACa,OAAN,CAAcC,IAAd,GAAqB;AAL3B,KATc;AAgBzBC,IAAAA,mBAAmB,EAAE;AACnBC,MAAAA,YAAY,EAAEhB,KAAK,CAACa,OAAN,CAAcC,IAAd,GAAqB;AADhB,KAhBI;AAmBzBG,IAAAA,gBAAgB,EAAE;AAChBT,MAAAA,OAAO,EAAE,MADO;AAEhBU,MAAAA,aAAa,EAAE,KAFC;AAGhBC,MAAAA,QAAQ,EAAE;AAHM,KA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A,eAAe,EAAE4B,sBAAUK,IAZV;AAajBvC,EAAAA,OAAO,EAAEkC,sBAAUI,MAAV,CAAiBG,UAbT;AAcjBnD,EAAAA,eAAe,EAAE4C,sBAAUG,KAdV;AAejBb,EAAAA,aAAa,EAAEU,sBAAUE,KAAV,CAAgB,CAAC,UAAD,EAAa,MAAb,EAAqB,YAArB,CAAhB,CAfE;AAgBjBhC,EAAAA,WAAW,EAAE8B,sBAAUC,MAhBN;AAiBjBnD,EAAAA,iBAAiB,EAAEkD,sBAAUK,IAjBZ;AAkBjBhC,EAAAA,kBAAkB,EAAE2B,sBAAUK,IAlBb;AAmBjB/B,EAAAA,QAAQ,EAAE0B,sBAAUC,MAnBH;AAoBjBT,EAAAA,6BAA6B,EAAEQ,sBAAUC,MApBxB;AAqBjB1D,EAAAA,mBAAmB,EAAEyD,sBAAUM,IArBd;AAsBjB/B,EAAAA,sBAAsB,EAAEyB,sBAAUK,IAtBjB;AAuBjB7B,EAAAA,aAAa,EAAEwB,sBAAUQ,MAvBR;AAwBjB5E,EAAAA,aAAa,EAAEoE,sBAAUQ,MAxBR;AAyBjB/B,EAAAA,oBAAoB,EAAEuB,sBAAUK,IAzBf;AA0BjB3B,EAAAA,iBAAiB,EAAE;AACjB+B,IAAAA,SAAS,EAAET,sBAAUC,MADJ;AAEjBS,IAAAA,UAAU,EAAEV,sBAAUC;AAFL,GA1BF;AA8BjBtC,EAAAA,OAAO,EAAEqC,sBAAUI;AA9BF,C;AAwTrB9E,cAAc,CAACqF,YAAf,GAA8B;AAC5B7E,EAAAA,OAAO,EAAE;AACPJ,IAAAA,KAAK,EAAE;AADA;AADmB,CAA9B;;eAMe,wBAAWzC,MAAX,EAAmBqC,cAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { CorrectAnswerToggle } from '@pie-lib/pie-toolbox/correct-answer-toggle';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color, Collapsible, PreviewPrompt } from '@pie-lib/pie-toolbox/render-ui';\nimport Translator from '@pie-lib/pie-toolbox/translator';\n\nimport StyledChoice from './choice';\n\n// MultipleChoice\n\nconst { translator } = Translator;\n\nconst styles = (theme) => ({\n main: {\n color: color.text(),\n backgroundColor: color.background(),\n '& *': {\n '-webkit-font-smoothing': 'antialiased',\n },\n position: 'relative'\n },\n partLabel: {\n display: 'block',\n fontSize: 'inherit',\n margin: '0',\n fontWeight: 'normal',\n paddingBottom: theme.spacing.unit * 2,\n },\n teacherInstructions: {\n marginBottom: theme.spacing.unit * 2,\n },\n horizontalLayout: {\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n },\n gridLayout: {\n display: 'grid',\n },\n fieldset: {\n border: '0px',\n padding: '0.01em 0 0 0',\n margin: '0px',\n minWidth: '0px',\n },\n srOnly: {\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n },\n errorText: {\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing.unit,\n },\n});\n\nexport class MultipleChoice extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n mode: PropTypes.oneOf(['gather', 'view', 'evaluate']),\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n keyMode: PropTypes.oneOf(['numbers', 'letters', 'none']),\n choices: PropTypes.array,\n partLabel: PropTypes.string,\n prompt: PropTypes.string,\n teacherInstructions: PropTypes.string,\n session: PropTypes.object,\n disabled: PropTypes.bool,\n onChoiceChanged: PropTypes.func,\n responseCorrect: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n correctResponse: PropTypes.array,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n gridColumns: PropTypes.string,\n alwaysShowCorrect: PropTypes.bool,\n animationsDisabled: PropTypes.bool,\n language: PropTypes.string,\n selectedAnswerBackgroundColor: PropTypes.string,\n onShowCorrectToggle: PropTypes.func,\n isSelectionButtonBelow: PropTypes.bool,\n minSelections: PropTypes.number,\n maxSelections: PropTypes.number,\n autoplayAudioEnabled: PropTypes.bool,\n customAudioButton: {\n playImage: PropTypes.string,\n pauseImage: PropTypes.string,\n },\n options: PropTypes.object,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n showCorrect: this.props.alwaysShowCorrect || false,\n maxSelectionsErrorState: false,\n };\n\n this.onToggle = this.onToggle.bind(this);\n }\n\n isSelected(value) {\n const sessionValue = this.props.session && this.props.session.value;\n\n return sessionValue && sessionValue.indexOf && sessionValue.indexOf(value) >= 0;\n }\n\n // handleChange was added for accessibility. Please see comments and videos from PD-2441.\n handleChange = (event) => {\n const { value, checked } = event.target;\n const { maxSelections, onChoiceChanged, session } = this.props;\n\n if (session.value && session.value.length >= maxSelections) {\n // show/hide max selections error when user select/deselect an answer\n this.setState({ maxSelectionsErrorState: checked });\n\n if (checked) {\n // prevent selecting more answers\n return;\n }\n }\n\n onChoiceChanged({ value, selected: checked, selector: 'Mouse' });\n };\n\n onToggle = () => {\n if (this.props.mode === 'evaluate') {\n this.setState({ showCorrect: !this.state.showCorrect }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (!nextProps.correctResponse && this.state.showCorrect !== false) {\n this.setState({ showCorrect: false }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n\n if (nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {\n this.setState({ showCorrect: true }, () => {\n if (this.props.onShowCorrectToggle) {\n this.props.onShowCorrectToggle();\n }\n });\n }\n }\n\n indexToSymbol(index) {\n if (this.props.keyMode === 'numbers') {\n return `${index + 1}`;\n }\n\n if (this.props.keyMode === 'letters') {\n return String.fromCharCode(97 + index).toUpperCase();\n }\n\n return '';\n }\n\n getCorrectness = (choice = {}) => {\n const isCorrect = choice.correct;\n const isChecked = this.isSelected(choice.value);\n\n if (this.state.showCorrect) {\n return isCorrect ? 'correct' : undefined;\n }\n\n if (isCorrect) {\n if (isChecked) {\n // A correct answer is selected: marked with a green checkmark\n return 'correct';\n } else {\n // A correct answer is NOT selected: marked with an orange X\n return 'incorrect';\n }\n } else {\n if (isChecked) {\n // An incorrect answer is selected: marked with an orange X\n return 'incorrect';\n } else {\n // An incorrect answer is NOT selected: not marked\n return undefined;\n }\n }\n };\n\n getChecked(choice) {\n // check for print context: options prop is passed from print.js and alwaysShowCorrect is true\n const isPrintMode = this.props.options && this.props.alwaysShowCorrect;\n \n if (isPrintMode) {\n return choice.correct || false;\n }\n\n // evaluate mode with show correct toggled\n const isEvaluateMode = this.state.showCorrect && this.props.mode === 'evaluate';\n \n if (isEvaluateMode) {\n return choice.correct || false;\n }\n\n // default behavior: show what the user has selected\n return this.isSelected(choice.value);\n }\n\n // renderHeading function was added for accessibility.\n renderHeading() {\n const { mode, choiceMode, classes } = this.props;\n\n if (mode !== 'gather') {\n return null;\n }\n\n return choiceMode === 'radio' ? (\n <h2 className={classes.srOnly}>Multiple Choice Question</h2>\n ) : (\n <h2 className={classes.srOnly}>Multiple Select Question</h2>\n );\n }\n\n render() {\n const {\n mode,\n disabled,\n className,\n choices = [],\n choiceMode,\n gridColumns,\n partLabel,\n prompt,\n responseCorrect,\n teacherInstructions,\n classes,\n alwaysShowCorrect,\n animationsDisabled,\n language,\n isSelectionButtonBelow,\n minSelections,\n maxSelections,\n autoplayAudioEnabled,\n session,\n customAudioButton\n } = this.props;\n const { showCorrect, maxSelectionsErrorState } = this.state;\n const isEvaluateMode = mode === 'evaluate';\n const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;\n const columnsStyle = gridColumns > 1 ? { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` } : undefined;\n const selections = (session.value && session.value.length) || 0;\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n const getMultipleChoiceMinSelectionErrorMessage = () => {\n if (minSelections && maxSelections) {\n return minSelections === maxSelections\n ? translator.t('translation:multipleChoice:minmaxSelections_equal', { lng: language, minSelections })\n : translator.t('translation:multipleChoice:minmaxSelections_range', { lng: language, minSelections, maxSelections });\n }\n\n if (minSelections) {\n return translator.t('translation:multipleChoice:minSelections', { lng: language, minSelections });\n }\n\n return '';\n };\n\n return (\n <div id={'main-container'} className={classNames(classes.main, className, 'multiple-choice')}>\n {partLabel && <h3 className={classes.partLabel}>{partLabel}</h3>}\n\n {this.renderHeading()}\n\n {teacherInstructions && (\n <div className={classes.teacherInstructions}>\n {!animationsDisabled ? (\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n ) : (\n teacherInstructionsDiv\n )}\n </div>\n )}\n\n <fieldset className={classes.fieldset}>\n <PreviewPrompt\n className=\"prompt\"\n defaultClassName=\"prompt\"\n prompt={prompt}\n tagName={'legend'}\n autoplayAudioEnabled={autoplayAudioEnabled}\n customAudioButton={customAudioButton}\n />\n\n {!alwaysShowCorrect && (\n <CorrectAnswerToggle\n show={showCorrectAnswerToggle}\n toggled={showCorrect}\n onToggle={this.onToggle.bind(this)}\n language={language}\n />\n )}\n\n <div\n className={classNames({\n [classes.gridLayout]: this.props.choicesLayout === 'grid',\n [classes.horizontalLayout]: this.props.choicesLayout === 'horizontal',\n })}\n style={columnsStyle}\n >\n {choices.map((choice, index) => (\n <StyledChoice\n choicesLayout={this.props.choicesLayout}\n selectedAnswerBackgroundColor={this.props.selectedAnswerBackgroundColor}\n gridColumns={gridColumns}\n key={`choice-${index}`}\n choice={choice}\n index={index}\n choicesLength={choices.length}\n showCorrect={showCorrect}\n isEvaluateMode={isEvaluateMode}\n choiceMode={choiceMode}\n disabled={disabled}\n onChoiceChanged={this.handleChange}\n hideTick={choice.hideTick}\n checked={this.getChecked(choice)}\n correctness={isEvaluateMode ? this.getCorrectness(choice) : undefined}\n displayKey={this.indexToSymbol(index)}\n isSelectionButtonBelow={isSelectionButtonBelow}\n />\n ))}\n </div>\n </fieldset>\n\n {choiceMode === 'checkbox' && (selections < minSelections) && (\n <div className={classes.errorText}>\n {getMultipleChoiceMinSelectionErrorMessage()}\n </div>\n )}\n {choiceMode === 'checkbox' && maxSelectionsErrorState && (\n <div className={classes.errorText}>\n {translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {\n lng: language,\n maxSelections,\n })}\n </div>\n )}\n </div>\n );\n }\n}\n\nMultipleChoice.defaultProps = {\n session: {\n value: [],\n },\n};\n\nexport default withStyles(styles)(MultipleChoice);\n"],"file":"multiple-choice.js"}
package/lib/print.js CHANGED
@@ -89,7 +89,8 @@ var MultipleChoicePrint = /*#__PURE__*/function (_HTMLElement) {
89
89
 
90
90
  var element = _this._options && /*#__PURE__*/_react["default"].createElement(_main["default"], {
91
91
  model: printModel,
92
- session: {}
92
+ session: {},
93
+ options: _this._options
93
94
  });
94
95
 
95
96
  _reactDom["default"].render(element, (0, _assertThisInitialized2["default"])(_this), function () {
package/lib/print.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/print.js"],"names":["log","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","showTeacherInstructions","alwaysShowCorrect","mode","disabled","animationsDisabled","lockChoiceOrder","choicesLayout","choices","map","c","rationale","rationaleEnabled","hideTick","feedback","keyMode","choicePrefix","MultipleChoicePrint","_options","_model","_session","_rerender","printModel","element","React","createElement","Main","session","ReactDOM","render","leading","trailing","o","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,mCAAN,CAAZ;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,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,CA3BD;;IA6BqByB,mB;;;;;AACnB,iCAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,QAAL,GAAgB,IAAhB;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,EAAhB;AACA,UAAKC,SAAL,GAAiB,0BACf,YAAM;AACJ,UAAI,MAAKF,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAME,UAAU,GAAG/B,iBAAiB,CAAC,MAAK4B,MAAN,EAAc,MAAKD,QAAnB,CAApC;;AAEA,YAAMK,OAAO,GACX,MAAKL,QAAL,iBACAM,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACxBlC,UAAAA,KAAK,EAAE8B,UADiB;AAExBK,UAAAA,OAAO,EAAE;AAFe,SAA1B,CAFF;;AAOAC,6BAASC,MAAT,CAAgBN,OAAhB,kDAA+B,YAAM;AACnCjC,UAAAA,GAAG,CAAC,+BAAD,CAAH;AACA;AACD,SAHD;AAID,OAdD,MAcO;AACLA,QAAAA,GAAG,CAAC,MAAD,CAAH;AACD;AACF,KAnBc,EAoBf,EApBe,EAqBf;AAAEwC,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KArBe,CAAjB;AALY;AA4Bb;;;;SACD,aAAYC,CAAZ,EAAe;AACb,WAAKd,QAAL,GAAgBc,CAAhB;AACD;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKd,MAAL,GAAcc,CAAd;;AACA,WAAKZ,SAAL;AACD;;;WAED,6BAAoB,CAAE;;;kDAvCyBa,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport cloneDeep from 'lodash/cloneDeep';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering';\nimport debug from 'debug';\n\nconst log = debug('pie-element:multiple-choice:print');\n\n/**\n * Live in same package as main element - so we can access some of the shared comps!\n *\n * - update pslb to build print if src/print.js is there\n * - update demo el\n * - get configure/controller building\n */\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions =\n instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.showTeacherInstructions = instr;\n model.alwaysShowCorrect = instr;\n model.mode = instr ? 'evaluate' : model.mode;\n\n model.disabled = true;\n model.animationsDisabled = true;\n model.lockChoiceOrder = true;\n model.choicesLayout = model.choicesLayout || 'vertical';\n\n const choices = cloneDeep(model.choices);\n\n model.choices = choices.map((c) => {\n c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;\n c.hideTick = instr;\n c.feedback = undefined;\n return c;\n });\n\n model.keyMode = model.choicePrefix || 'letters';\n\n return model;\n};\n\nexport default class MultipleChoicePrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n model: printModel,\n session: {},\n });\n\n ReactDOM.render(element, this, () => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}
1
+ {"version":3,"sources":["../src/print.js"],"names":["log","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","showTeacherInstructions","alwaysShowCorrect","mode","disabled","animationsDisabled","lockChoiceOrder","choicesLayout","choices","map","c","rationale","rationaleEnabled","hideTick","feedback","keyMode","choicePrefix","MultipleChoicePrint","_options","_model","_session","_rerender","printModel","element","React","createElement","Main","session","options","ReactDOM","render","leading","trailing","o","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA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,QAAF,GAAahB,SAAb;AACA,WAAOY,CAAP;AACD,GALe,CAAhB;AAOAlB,EAAAA,KAAK,CAACuB,OAAN,GAAgBvB,KAAK,CAACwB,YAAN,IAAsB,SAAtC;AAEA,SAAOxB,KAAP;AACD,CA3BD;;IA6BqByB,mB;;;;;AACnB,iCAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,QAAL,GAAgB,IAAhB;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,EAAhB;AACA,UAAKC,SAAL,GAAiB,0BACf,YAAM;AACJ,UAAI,MAAKF,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAME,UAAU,GAAG/B,iBAAiB,CAAC,MAAK4B,MAAN,EAAc,MAAKD,QAAnB,CAApC;;AAEA,YAAMK,OAAO,GACX,MAAKL,QAAL,iBACAM,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACxBlC,UAAAA,KAAK,EAAE8B,UADiB;AAExBK,UAAAA,OAAO,EAAE,EAFe;AAGxBC,UAAAA,OAAO,EAAE,MAAKV;AAHU,SAA1B,CAFF;;AAQAW,6BAASC,MAAT,CAAgBP,OAAhB,kDAA+B,YAAM;AACnCjC,UAAAA,GAAG,CAAC,+BAAD,CAAH;AACA;AACD,SAHD;AAID,OAfD,MAeO;AACLA,QAAAA,GAAG,CAAC,MAAD,CAAH;AACD;AACF,KApBc,EAqBf,EArBe,EAsBf;AAAEyC,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KAtBe,CAAjB;AALY;AA6Bb;;;;SACD,aAAYC,CAAZ,EAAe;AACb,WAAKf,QAAL,GAAgBe,CAAhB;AACD;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKf,MAAL,GAAce,CAAd;;AACA,WAAKb,SAAL;AACD;;;WAED,6BAAoB,CAAE;;;kDAxCyBc,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport cloneDeep from 'lodash/cloneDeep';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering';\nimport debug from 'debug';\n\nconst log = debug('pie-element:multiple-choice:print');\n\n/**\n * Live in same package as main element - so we can access some of the shared comps!\n *\n * - update pslb to build print if src/print.js is there\n * - update demo el\n * - get configure/controller building\n */\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions =\n instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.showTeacherInstructions = instr;\n model.alwaysShowCorrect = instr;\n model.mode = instr ? 'evaluate' : model.mode;\n\n model.disabled = true;\n model.animationsDisabled = true;\n model.lockChoiceOrder = true;\n model.choicesLayout = model.choicesLayout || 'vertical';\n\n const choices = cloneDeep(model.choices);\n\n model.choices = choices.map((c) => {\n c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;\n c.hideTick = instr;\n c.feedback = undefined;\n return c;\n });\n\n model.keyMode = model.choicePrefix || 'letters';\n\n return model;\n};\n\nexport default class MultipleChoicePrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n model: printModel,\n session: {},\n options: this._options,\n });\n\n ReactDOM.render(element, this, () => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.8.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_config_ui, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@6.0.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _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, _dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@6.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;
@@ -10175,7 +10175,7 @@ const {settings: settings} = _dll_pie_lib__pie_toolbox_config_ui;
10175
10175
  const {layout: layout} = _dll_pie_lib__pie_toolbox_config_ui;
10176
10176
  const {choiceUtils: utils$1} = _dll_pie_lib__pie_toolbox_config_ui;
10177
10177
  const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
10178
- const _jsxFileName = "/home/circleci/repo/packages/multiple-choice/configure/src/main.jsx";
10178
+ const _jsxFileName = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/configure/src/main.jsx";
10179
10179
  function _optionalChain$1(ops) {
10180
10180
  let lastAccessLHS = undefined;
10181
10181
  let value = ops[0];
package/module/element.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.8.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@6.0.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _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_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@6.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;
@@ -11954,7 +11954,7 @@ var reactTransitionGroup = {
11954
11954
  const React$5 = _dll_react;
11955
11955
  const PropTypes$4 = _dll_prop_types;
11956
11956
  const {color: color$2} = _dll_pie_lib__pie_toolbox_render_ui;
11957
- const _jsxFileName$4 = "/home/circleci/repo/packages/multiple-choice/src/feedback-tick.jsx";
11957
+ const _jsxFileName$4 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/feedback-tick.jsx";
11958
11958
  const stylesheet = {
11959
11959
  incorrect: {
11960
11960
  fill: `var(--feedback-incorrect-bg-color, ${color$2.incorrect()})`
@@ -12125,7 +12125,7 @@ const classNames$2 = _dll_classnames;
12125
12125
  const {Feedback: Feedback} = _dll_pie_lib__pie_toolbox_render_ui;
12126
12126
  const {color: color$1} = _dll_pie_lib__pie_toolbox_render_ui;
12127
12127
  const {PreviewPrompt: PreviewPrompt$1} = _dll_pie_lib__pie_toolbox_render_ui;
12128
- const _jsxFileName$3 = "/home/circleci/repo/packages/multiple-choice/src/choice-input.jsx";
12128
+ const _jsxFileName$3 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/choice-input.jsx";
12129
12129
  const CLASS_NAME = 'multiple-choice-component';
12130
12130
  const styleSheet = theme => ({
12131
12131
  row: {
@@ -12479,7 +12479,7 @@ var ChoiceInput$1 = styles$b.withStyles(styleSheet)(ChoiceInput);
12479
12479
  const React$3 = _dll_react;
12480
12480
  const PropTypes$2 = _dll_prop_types;
12481
12481
  const classNames$1 = _dll_classnames;
12482
- const _jsxFileName$2 = "/home/circleci/repo/packages/multiple-choice/src/choice.jsx";
12482
+ const _jsxFileName$2 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/choice.jsx";
12483
12483
  class Choice extends React$3.Component {
12484
12484
  constructor(...args) {
12485
12485
  super(...args);
@@ -12586,7 +12586,7 @@ const {CorrectAnswerToggle: CorrectAnswerToggle} = _dll_pie_lib__pie_toolbox_cor
12586
12586
  const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
12587
12587
  const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
12588
12588
  const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
12589
- const _jsxFileName$1 = "/home/circleci/repo/packages/multiple-choice/src/multiple-choice.jsx";
12589
+ const _jsxFileName$1 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/multiple-choice.jsx";
12590
12590
  const {translator} = Translator;
12591
12591
  const styles$1 = theme => ({
12592
12592
  main: {
@@ -12666,7 +12666,8 @@ class MultipleChoice$1 extends React$2.Component {
12666
12666
  customAudioButton: {
12667
12667
  playImage: PropTypes$1.string,
12668
12668
  pauseImage: PropTypes$1.string
12669
- }
12669
+ },
12670
+ options: PropTypes$1.object
12670
12671
  };
12671
12672
  }
12672
12673
  constructor(props) {
@@ -12768,7 +12769,12 @@ class MultipleChoice$1 extends React$2.Component {
12768
12769
  };
12769
12770
  }
12770
12771
  getChecked(choice) {
12771
- if (this.state.showCorrect) {
12772
+ const isPrintMode = this.props.options && this.props.alwaysShowCorrect;
12773
+ if (isPrintMode) {
12774
+ return choice.correct || false;
12775
+ }
12776
+ const isEvaluateMode = this.state.showCorrect && this.props.mode === 'evaluate';
12777
+ if (isEvaluateMode) {
12772
12778
  return choice.correct || false;
12773
12779
  }
12774
12780
  return this.isSelected(choice.value);
@@ -12783,14 +12789,14 @@ class MultipleChoice$1 extends React$2.Component {
12783
12789
  __self: this,
12784
12790
  __source: {
12785
12791
  fileName: _jsxFileName$1,
12786
- lineNumber: 215
12792
+ lineNumber: 227
12787
12793
  }
12788
12794
  }, "Multiple Choice Question") : React$2.createElement('h2', {
12789
12795
  className: classes.srOnly,
12790
12796
  __self: this,
12791
12797
  __source: {
12792
12798
  fileName: _jsxFileName$1,
12793
- lineNumber: 217
12799
+ lineNumber: 229
12794
12800
  }
12795
12801
  }, "Multiple Select Question");
12796
12802
  }
@@ -12811,7 +12817,7 @@ class MultipleChoice$1 extends React$2.Component {
12811
12817
  __self: this,
12812
12818
  __source: {
12813
12819
  fileName: _jsxFileName$1,
12814
- lineNumber: 251
12820
+ lineNumber: 263
12815
12821
  }
12816
12822
  });
12817
12823
  const getMultipleChoiceMinSelectionErrorMessage = () => {
@@ -12839,21 +12845,21 @@ class MultipleChoice$1 extends React$2.Component {
12839
12845
  __self: this,
12840
12846
  __source: {
12841
12847
  fileName: _jsxFileName$1,
12842
- lineNumber: 274
12848
+ lineNumber: 286
12843
12849
  }
12844
12850
  }, partLabel && React$2.createElement('h3', {
12845
12851
  className: classes.partLabel,
12846
12852
  __self: this,
12847
12853
  __source: {
12848
12854
  fileName: _jsxFileName$1,
12849
- lineNumber: 275
12855
+ lineNumber: 287
12850
12856
  }
12851
12857
  }, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
12852
12858
  className: classes.teacherInstructions,
12853
12859
  __self: this,
12854
12860
  __source: {
12855
12861
  fileName: _jsxFileName$1,
12856
- lineNumber: 280
12862
+ lineNumber: 292
12857
12863
  }
12858
12864
  }, !animationsDisabled ? React$2.createElement(Collapsible, {
12859
12865
  labels: {
@@ -12863,14 +12869,14 @@ class MultipleChoice$1 extends React$2.Component {
12863
12869
  __self: this,
12864
12870
  __source: {
12865
12871
  fileName: _jsxFileName$1,
12866
- lineNumber: 282
12872
+ lineNumber: 294
12867
12873
  }
12868
12874
  }, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
12869
12875
  className: classes.fieldset,
12870
12876
  __self: this,
12871
12877
  __source: {
12872
12878
  fileName: _jsxFileName$1,
12873
- lineNumber: 296
12879
+ lineNumber: 308
12874
12880
  }
12875
12881
  }, React$2.createElement(PreviewPrompt, {
12876
12882
  className: "prompt",
@@ -12882,7 +12888,7 @@ class MultipleChoice$1 extends React$2.Component {
12882
12888
  __self: this,
12883
12889
  __source: {
12884
12890
  fileName: _jsxFileName$1,
12885
- lineNumber: 297
12891
+ lineNumber: 309
12886
12892
  }
12887
12893
  }), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
12888
12894
  show: showCorrectAnswerToggle,
@@ -12892,7 +12898,7 @@ class MultipleChoice$1 extends React$2.Component {
12892
12898
  __self: this,
12893
12899
  __source: {
12894
12900
  fileName: _jsxFileName$1,
12895
- lineNumber: 307
12901
+ lineNumber: 319
12896
12902
  }
12897
12903
  }), React$2.createElement('div', {
12898
12904
  className: classNames({
@@ -12903,7 +12909,7 @@ class MultipleChoice$1 extends React$2.Component {
12903
12909
  __self: this,
12904
12910
  __source: {
12905
12911
  fileName: _jsxFileName$1,
12906
- lineNumber: 315
12912
+ lineNumber: 327
12907
12913
  }
12908
12914
  }, choices.map((choice, index) => React$2.createElement(StyledChoice, {
12909
12915
  choicesLayout: this.props.choicesLayout,
@@ -12926,21 +12932,21 @@ class MultipleChoice$1 extends React$2.Component {
12926
12932
  __self: this,
12927
12933
  __source: {
12928
12934
  fileName: _jsxFileName$1,
12929
- lineNumber: 323
12935
+ lineNumber: 335
12930
12936
  }
12931
12937
  })))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
12932
12938
  className: classes.errorText,
12933
12939
  __self: this,
12934
12940
  __source: {
12935
12941
  fileName: _jsxFileName$1,
12936
- lineNumber: 347
12942
+ lineNumber: 359
12937
12943
  }
12938
12944
  }, getMultipleChoiceMinSelectionErrorMessage()), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
12939
12945
  className: classes.errorText,
12940
12946
  __self: this,
12941
12947
  __source: {
12942
12948
  fileName: _jsxFileName$1,
12943
- lineNumber: 352
12949
+ lineNumber: 364
12944
12950
  }
12945
12951
  }, translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
12946
12952
  lng: language,
@@ -12958,7 +12964,7 @@ var MultipleChoice$2 = styles$b.withStyles(styles$1)(MultipleChoice$1);
12958
12964
  const React$1 = _dll_react;
12959
12965
  const PropTypes = _dll_prop_types;
12960
12966
  const {PreviewLayout: PreviewLayout} = _dll_pie_lib__pie_toolbox_render_ui;
12961
- const _jsxFileName = "/home/circleci/repo/packages/multiple-choice/src/main.jsx";
12967
+ const _jsxFileName = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/main.jsx";
12962
12968
  const styles = () => ({});
12963
12969
  class Main extends React$1.Component {
12964
12970
  static __initStatic() {
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/multiple-choice@9.15.1</title>
5
+ <title>@pie-element/multiple-choice@9.15.3</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,14 +1,14 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice",
3
- "version": "9.15.1",
3
+ "version": "9.15.3",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "3.8.1"
7
+ "version": "3.9.0"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
11
- "version": "6.0.1"
11
+ "version": "6.0.3"
12
12
  }
13
13
  ]
14
14
  }
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/multiple-choice@9.15.1</title>
5
+ <title>@pie-element/multiple-choice@9.15.3</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,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_pie_lib__pie_toolbox_math_rendering, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.8.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@6.0.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_pie_lib__pie_toolbox_math_rendering, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.9.0/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@6.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;
@@ -11954,7 +11954,7 @@ var reactTransitionGroup = {
11954
11954
  const React$5 = _dll_react;
11955
11955
  const PropTypes$4 = _dll_prop_types;
11956
11956
  const {color: color$2} = _dll_pie_lib__pie_toolbox_render_ui;
11957
- const _jsxFileName$4 = "/home/circleci/repo/packages/multiple-choice/src/feedback-tick.jsx";
11957
+ const _jsxFileName$4 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/feedback-tick.jsx";
11958
11958
  const stylesheet = {
11959
11959
  incorrect: {
11960
11960
  fill: `var(--feedback-incorrect-bg-color, ${color$2.incorrect()})`
@@ -12125,7 +12125,7 @@ const classNames$2 = _dll_classnames;
12125
12125
  const {Feedback: Feedback} = _dll_pie_lib__pie_toolbox_render_ui;
12126
12126
  const {color: color$1} = _dll_pie_lib__pie_toolbox_render_ui;
12127
12127
  const {PreviewPrompt: PreviewPrompt$1} = _dll_pie_lib__pie_toolbox_render_ui;
12128
- const _jsxFileName$3 = "/home/circleci/repo/packages/multiple-choice/src/choice-input.jsx";
12128
+ const _jsxFileName$3 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/choice-input.jsx";
12129
12129
  const CLASS_NAME = 'multiple-choice-component';
12130
12130
  const styleSheet = theme => ({
12131
12131
  row: {
@@ -12479,7 +12479,7 @@ var ChoiceInput$1 = styles$b.withStyles(styleSheet)(ChoiceInput);
12479
12479
  const React$3 = _dll_react;
12480
12480
  const PropTypes$2 = _dll_prop_types;
12481
12481
  const classNames$1 = _dll_classnames;
12482
- const _jsxFileName$2 = "/home/circleci/repo/packages/multiple-choice/src/choice.jsx";
12482
+ const _jsxFileName$2 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/choice.jsx";
12483
12483
  class Choice extends React$3.Component {
12484
12484
  constructor(...args) {
12485
12485
  super(...args);
@@ -12586,7 +12586,7 @@ const {CorrectAnswerToggle: CorrectAnswerToggle} = _dll_pie_lib__pie_toolbox_cor
12586
12586
  const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
12587
12587
  const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
12588
12588
  const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
12589
- const _jsxFileName$1 = "/home/circleci/repo/packages/multiple-choice/src/multiple-choice.jsx";
12589
+ const _jsxFileName$1 = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/multiple-choice.jsx";
12590
12590
  const {translator} = Translator;
12591
12591
  const styles$1 = theme => ({
12592
12592
  main: {
@@ -12666,7 +12666,8 @@ class MultipleChoice extends React$2.Component {
12666
12666
  customAudioButton: {
12667
12667
  playImage: PropTypes$1.string,
12668
12668
  pauseImage: PropTypes$1.string
12669
- }
12669
+ },
12670
+ options: PropTypes$1.object
12670
12671
  };
12671
12672
  }
12672
12673
  constructor(props) {
@@ -12768,7 +12769,12 @@ class MultipleChoice extends React$2.Component {
12768
12769
  };
12769
12770
  }
12770
12771
  getChecked(choice) {
12771
- if (this.state.showCorrect) {
12772
+ const isPrintMode = this.props.options && this.props.alwaysShowCorrect;
12773
+ if (isPrintMode) {
12774
+ return choice.correct || false;
12775
+ }
12776
+ const isEvaluateMode = this.state.showCorrect && this.props.mode === 'evaluate';
12777
+ if (isEvaluateMode) {
12772
12778
  return choice.correct || false;
12773
12779
  }
12774
12780
  return this.isSelected(choice.value);
@@ -12783,14 +12789,14 @@ class MultipleChoice extends React$2.Component {
12783
12789
  __self: this,
12784
12790
  __source: {
12785
12791
  fileName: _jsxFileName$1,
12786
- lineNumber: 215
12792
+ lineNumber: 227
12787
12793
  }
12788
12794
  }, "Multiple Choice Question") : React$2.createElement('h2', {
12789
12795
  className: classes.srOnly,
12790
12796
  __self: this,
12791
12797
  __source: {
12792
12798
  fileName: _jsxFileName$1,
12793
- lineNumber: 217
12799
+ lineNumber: 229
12794
12800
  }
12795
12801
  }, "Multiple Select Question");
12796
12802
  }
@@ -12811,7 +12817,7 @@ class MultipleChoice extends React$2.Component {
12811
12817
  __self: this,
12812
12818
  __source: {
12813
12819
  fileName: _jsxFileName$1,
12814
- lineNumber: 251
12820
+ lineNumber: 263
12815
12821
  }
12816
12822
  });
12817
12823
  const getMultipleChoiceMinSelectionErrorMessage = () => {
@@ -12839,21 +12845,21 @@ class MultipleChoice extends React$2.Component {
12839
12845
  __self: this,
12840
12846
  __source: {
12841
12847
  fileName: _jsxFileName$1,
12842
- lineNumber: 274
12848
+ lineNumber: 286
12843
12849
  }
12844
12850
  }, partLabel && React$2.createElement('h3', {
12845
12851
  className: classes.partLabel,
12846
12852
  __self: this,
12847
12853
  __source: {
12848
12854
  fileName: _jsxFileName$1,
12849
- lineNumber: 275
12855
+ lineNumber: 287
12850
12856
  }
12851
12857
  }, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
12852
12858
  className: classes.teacherInstructions,
12853
12859
  __self: this,
12854
12860
  __source: {
12855
12861
  fileName: _jsxFileName$1,
12856
- lineNumber: 280
12862
+ lineNumber: 292
12857
12863
  }
12858
12864
  }, !animationsDisabled ? React$2.createElement(Collapsible, {
12859
12865
  labels: {
@@ -12863,14 +12869,14 @@ class MultipleChoice extends React$2.Component {
12863
12869
  __self: this,
12864
12870
  __source: {
12865
12871
  fileName: _jsxFileName$1,
12866
- lineNumber: 282
12872
+ lineNumber: 294
12867
12873
  }
12868
12874
  }, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
12869
12875
  className: classes.fieldset,
12870
12876
  __self: this,
12871
12877
  __source: {
12872
12878
  fileName: _jsxFileName$1,
12873
- lineNumber: 296
12879
+ lineNumber: 308
12874
12880
  }
12875
12881
  }, React$2.createElement(PreviewPrompt, {
12876
12882
  className: "prompt",
@@ -12882,7 +12888,7 @@ class MultipleChoice extends React$2.Component {
12882
12888
  __self: this,
12883
12889
  __source: {
12884
12890
  fileName: _jsxFileName$1,
12885
- lineNumber: 297
12891
+ lineNumber: 309
12886
12892
  }
12887
12893
  }), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
12888
12894
  show: showCorrectAnswerToggle,
@@ -12892,7 +12898,7 @@ class MultipleChoice extends React$2.Component {
12892
12898
  __self: this,
12893
12899
  __source: {
12894
12900
  fileName: _jsxFileName$1,
12895
- lineNumber: 307
12901
+ lineNumber: 319
12896
12902
  }
12897
12903
  }), React$2.createElement('div', {
12898
12904
  className: classNames({
@@ -12903,7 +12909,7 @@ class MultipleChoice extends React$2.Component {
12903
12909
  __self: this,
12904
12910
  __source: {
12905
12911
  fileName: _jsxFileName$1,
12906
- lineNumber: 315
12912
+ lineNumber: 327
12907
12913
  }
12908
12914
  }, choices.map((choice, index) => React$2.createElement(StyledChoice, {
12909
12915
  choicesLayout: this.props.choicesLayout,
@@ -12926,21 +12932,21 @@ class MultipleChoice extends React$2.Component {
12926
12932
  __self: this,
12927
12933
  __source: {
12928
12934
  fileName: _jsxFileName$1,
12929
- lineNumber: 323
12935
+ lineNumber: 335
12930
12936
  }
12931
12937
  })))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
12932
12938
  className: classes.errorText,
12933
12939
  __self: this,
12934
12940
  __source: {
12935
12941
  fileName: _jsxFileName$1,
12936
- lineNumber: 347
12942
+ lineNumber: 359
12937
12943
  }
12938
12944
  }, getMultipleChoiceMinSelectionErrorMessage()), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
12939
12945
  className: classes.errorText,
12940
12946
  __self: this,
12941
12947
  __source: {
12942
12948
  fileName: _jsxFileName$1,
12943
- lineNumber: 352
12949
+ lineNumber: 364
12944
12950
  }
12945
12951
  }, translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
12946
12952
  lng: language,
@@ -12958,7 +12964,7 @@ var MultipleChoice$1 = styles$b.withStyles(styles$1)(MultipleChoice);
12958
12964
  const React$1 = _dll_react;
12959
12965
  const PropTypes = _dll_prop_types;
12960
12966
  const {PreviewLayout: PreviewLayout} = _dll_pie_lib__pie_toolbox_render_ui;
12961
- const _jsxFileName = "/home/circleci/repo/packages/multiple-choice/src/main.jsx";
12967
+ const _jsxFileName = "/Users/carlacostea/Pie_Work/pie-framework/pie-elements/packages/multiple-choice/src/main.jsx";
12962
12968
  const styles = () => ({});
12963
12969
  class Main extends React$1.Component {
12964
12970
  static __initStatic() {
@@ -13071,7 +13077,8 @@ class MultipleChoicePrint extends HTMLElement {
13071
13077
  const printModel = preparePrintModel(this._model, this._options);
13072
13078
  const element = this._options && React.createElement(Root, {
13073
13079
  model: printModel,
13074
- session: {}
13080
+ session: {},
13081
+ options: this._options
13075
13082
  });
13076
13083
  ReactDOM.render(element, this, () => {
13077
13084
  log('render complete - render math');
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@pie-element/multiple-choice",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "9.15.2",
4
+ "version": "9.15.3-hotfix.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
10
  "@pie-framework/pie-player-events": "^0.1.0",
11
- "@pie-lib/pie-toolbox": "2.14.1",
11
+ "@pie-lib/pie-toolbox": "2.14.3",
12
12
  "classnames": "^2.2.5",
13
13
  "debug": "^4.1.1",
14
14
  "enzyme-to-json": "^3.3.3",
@@ -19,7 +19,7 @@
19
19
  "react-test-renderer": "^16.3.2",
20
20
  "react-transition-group": "^2.3.1"
21
21
  },
22
- "gitHead": "0b36d7c9fac17d590aefee1f591872366493343a",
22
+ "gitHead": "0e14ff981bcdc8a89a0e58484026496701bfdbc3",
23
23
  "scripts": {
24
24
  "postpublish": "../../scripts/postpublish"
25
25
  },
package/LICENSE.md DELETED
@@ -1,5 +0,0 @@
1
- Copyright 2019 CoreSpring Inc
2
-
3
- Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
4
-
5
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.