@pie-element/ebsr 11.0.0 → 12.0.1-esmbeta.1
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 +22 -0
- package/configure/CHANGELOG.md +8 -0
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +1972 -0
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +4186 -0
- package/configure/node_modules/@pie-element/multiple-choice/LICENSE.md +5 -0
- package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +35 -0
- package/configure/node_modules/@pie-element/multiple-choice/README.md +56 -0
- package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +1387 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +3332 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +202 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +248 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +597 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +18 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +20 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +527 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +2297 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +34 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +346 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +28 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +15 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +2993 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +2217 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +8 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +61 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +7 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +1332 -0
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +1015 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/configure.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/configure.js +1218 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/configure.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/controller.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/controller.js +324 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/controller.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/element.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/element.js +3287 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/element.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/print.css +847 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/print.js +3017 -0
- package/configure/node_modules/@pie-element/multiple-choice/esm/print.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +427 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +252 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +174 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +388 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +108 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +469 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +129 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +48 -0
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/configure.js +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/controller.js +3472 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/demo.js +86 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/element.js +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/index.html +21 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/index.js +2 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/manifest.json +10 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/print-demo.js +124 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/print.html +18 -0
- package/configure/node_modules/@pie-element/multiple-choice/module/print.js +1 -0
- package/configure/node_modules/@pie-element/multiple-choice/package.json +53 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/CHANGELOG.md +898 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/esm/index.js +262 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/expander.js +88 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/expander.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/index.js +181 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/styles.js +66 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/lib/styles.js.map +1 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/package.json +44 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/__tests__/index.test.jsx +99 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/expander.jsx +61 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/index.jsx +98 -0
- package/configure/node_modules/@pie-lib/correct-answer-toggle/src/styles.js +61 -0
- package/configure/node_modules/@pie-lib/icons/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/icons/CHANGELOG.md +539 -0
- package/configure/node_modules/@pie-lib/icons/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/icons/esm/index.js +1153 -0
- package/configure/node_modules/@pie-lib/icons/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-icon.js +89 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-response-icon.js +153 -0
- package/configure/node_modules/@pie-lib/icons/lib/correct-response-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-base.js +206 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-base.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-root.js +130 -0
- package/configure/node_modules/@pie-lib/icons/lib/icon-root.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/incorrect-icon.js +92 -0
- package/configure/node_modules/@pie-lib/icons/lib/incorrect-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/index.js +72 -0
- package/configure/node_modules/@pie-lib/icons/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/instructions-icon.js +229 -0
- package/configure/node_modules/@pie-lib/icons/lib/instructions-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/learn-more-icon.js +145 -0
- package/configure/node_modules/@pie-lib/icons/lib/learn-more-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/nothing-submitted-icon.js +183 -0
- package/configure/node_modules/@pie-lib/icons/lib/nothing-submitted-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/partially-correct-icon.js +82 -0
- package/configure/node_modules/@pie-lib/icons/lib/partially-correct-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/show-rationale-icon.js +206 -0
- package/configure/node_modules/@pie-lib/icons/lib/show-rationale-icon.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/lib/sized.js +41 -0
- package/configure/node_modules/@pie-lib/icons/lib/sized.js.map +1 -0
- package/configure/node_modules/@pie-lib/icons/package.json +35 -0
- package/configure/node_modules/@pie-lib/icons/src/__tests__/index.test.js +3 -0
- package/configure/node_modules/@pie-lib/icons/src/correct-icon.jsx +64 -0
- package/configure/node_modules/@pie-lib/icons/src/correct-response-icon.jsx +121 -0
- package/configure/node_modules/@pie-lib/icons/src/icon-base.jsx +158 -0
- package/configure/node_modules/@pie-lib/icons/src/icon-root.jsx +76 -0
- package/configure/node_modules/@pie-lib/icons/src/incorrect-icon.jsx +61 -0
- package/configure/node_modules/@pie-lib/icons/src/index.js +19 -0
- package/configure/node_modules/@pie-lib/icons/src/instructions-icon.jsx +189 -0
- package/configure/node_modules/@pie-lib/icons/src/learn-more-icon.jsx +107 -0
- package/configure/node_modules/@pie-lib/icons/src/nothing-submitted-icon.jsx +130 -0
- package/configure/node_modules/@pie-lib/icons/src/partially-correct-icon.jsx +49 -0
- package/configure/node_modules/@pie-lib/icons/src/show-rationale-icon.jsx +152 -0
- package/configure/node_modules/@pie-lib/icons/src/sized.jsx +25 -0
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.md +775 -0
- package/configure/node_modules/@pie-lib/math-rendering/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/esm/index.js +690 -0
- package/configure/node_modules/@pie-lib/math-rendering/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js +38 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mml-to-latex.js +15 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mml-to-latex.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js +296 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js +23 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js +109 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js +95 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js +438 -0
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js.map +1 -0
- package/configure/node_modules/@pie-lib/math-rendering/package.json +28 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/mml-to-latex.test.js +14 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/normalization.test.js +50 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/__tests__/render-math.test.js +155 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/index.js +5 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mml-to-latex.js +2 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/__tests__/__snapshots__/chtml.test.js.snap +9 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/__tests__/chtml.test.js +104 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/chtml.js +220 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/index.js +13 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/mml.js +24 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/normalization.js +69 -0
- package/configure/node_modules/@pie-lib/math-rendering/src/render-math.js +387 -0
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.md +1026 -0
- package/configure/node_modules/@pie-lib/render-ui/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/render-ui/esm/index.js +1616 -0
- package/configure/node_modules/@pie-lib/render-ui/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/append-css-rules.js +88 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/append-css-rules.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/assets/enableAudioAutoplayImage.js +9 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/assets/enableAudioAutoplayImage.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js +135 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js +344 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js +150 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-media.js +27 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-media.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js +74 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js +136 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js +60 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js +145 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js +321 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js +28 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js +151 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/ui-layout.js +122 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/ui-layout.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js +181 -0
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js.map +1 -0
- package/configure/node_modules/@pie-lib/render-ui/package.json +40 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/html-and-math.test.js.snap +11 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/preview-prompt.test.jsx.snap +37 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/purpose.test.jsx.snap +42 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/readable.test.jsx.snap +64 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/__snapshots__/response-indicators.test.jsx.snap +27 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/color.test.js +12 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/has-media.test.js +20 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/has-text.test.js +21 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/html-and-math.test.js +24 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/preview-prompt.test.jsx +56 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/purpose.test.jsx +47 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/readable.test.jsx +64 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/response-indicators.test.jsx +16 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/ui-layout.test.jsx +34 -0
- package/configure/node_modules/@pie-lib/render-ui/src/__tests__/withUndoReset.test.jsx +254 -0
- package/configure/node_modules/@pie-lib/render-ui/src/append-css-rules.js +51 -0
- package/configure/node_modules/@pie-lib/render-ui/src/assets/enableAudioAutoplayImage.js +1 -0
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/__tests__/__snapshots__/index.test.jsx.snap +18 -0
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/__tests__/index.test.jsx +13 -0
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/index.jsx +64 -0
- package/configure/node_modules/@pie-lib/render-ui/src/color.js +121 -0
- package/configure/node_modules/@pie-lib/render-ui/src/feedback.jsx +99 -0
- package/configure/node_modules/@pie-lib/render-ui/src/has-media.js +16 -0
- package/configure/node_modules/@pie-lib/render-ui/src/has-text.js +18 -0
- package/configure/node_modules/@pie-lib/render-ui/src/html-and-math.js +21 -0
- package/configure/node_modules/@pie-lib/render-ui/src/index.js +35 -0
- package/configure/node_modules/@pie-lib/render-ui/src/input-container.jsx +41 -0
- package/configure/node_modules/@pie-lib/render-ui/src/preview-layout.jsx +95 -0
- package/configure/node_modules/@pie-lib/render-ui/src/preview-prompt.jsx +254 -0
- package/configure/node_modules/@pie-lib/render-ui/src/purpose.jsx +17 -0
- package/configure/node_modules/@pie-lib/render-ui/src/readable.jsx +19 -0
- package/configure/node_modules/@pie-lib/render-ui/src/response-indicators.jsx +89 -0
- package/configure/node_modules/@pie-lib/render-ui/src/ui-layout.jsx +66 -0
- package/configure/node_modules/@pie-lib/render-ui/src/withUndoReset.jsx +116 -0
- package/configure/node_modules/@pie-lib/test-utils/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/test-utils/CHANGELOG.md +410 -0
- package/configure/node_modules/@pie-lib/test-utils/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/test-utils/esm/index.js +39 -0
- package/configure/node_modules/@pie-lib/test-utils/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/test-utils/lib/index.js +40 -0
- package/configure/node_modules/@pie-lib/test-utils/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/test-utils/package.json +25 -0
- package/configure/node_modules/@pie-lib/test-utils/src/__tests__/index.test.js +45 -0
- package/configure/node_modules/@pie-lib/test-utils/src/index.js +18 -0
- package/configure/node_modules/@pie-lib/translator/CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/translator/CHANGELOG.md +282 -0
- package/configure/node_modules/@pie-lib/translator/NEXT.CHANGELOG.json +1 -0
- package/configure/node_modules/@pie-lib/translator/esm/index.js +257 -0
- package/configure/node_modules/@pie-lib/translator/esm/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/lib/en.js +102 -0
- package/configure/node_modules/@pie-lib/translator/lib/en.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/lib/es.js +102 -0
- package/configure/node_modules/@pie-lib/translator/lib/es.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/lib/index.js +69 -0
- package/configure/node_modules/@pie-lib/translator/lib/index.js.map +1 -0
- package/configure/node_modules/@pie-lib/translator/package.json +25 -0
- package/configure/node_modules/@pie-lib/translator/src/en.js +99 -0
- package/configure/node_modules/@pie-lib/translator/src/es.js +99 -0
- package/configure/node_modules/@pie-lib/translator/src/index.js +43 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +8 -0
- package/controller/package.json +3 -3
- package/esm/configure.js +40550 -0
- package/esm/configure.js.map +1 -0
- package/esm/controller.js +3358 -0
- package/esm/controller.js.map +1 -0
- package/esm/element.js +2203 -0
- package/esm/element.js.map +1 -0
- package/esm/package.json +4 -0
- package/esm/print.js +4090 -0
- package/esm/print.js.map +1 -0
- package/module/controller.js +4973 -2252
- package/module/element.js +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +1 -1
- package/module/print.html +1 -1
- package/module/print.js +1 -1
- package/package.json +24 -6
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.MultipleChoice = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
+
|
|
24
|
+
var _react = _interopRequireDefault(require("react"));
|
|
25
|
+
|
|
26
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
+
|
|
28
|
+
var _correctAnswerToggle = _interopRequireDefault(require("@pie-lib/correct-answer-toggle"));
|
|
29
|
+
|
|
30
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
31
|
+
|
|
32
|
+
var _styles = require("@material-ui/core/styles");
|
|
33
|
+
|
|
34
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
35
|
+
|
|
36
|
+
var _translator = _interopRequireDefault(require("@pie-lib/translator"));
|
|
37
|
+
|
|
38
|
+
var _choice = _interopRequireDefault(require("./choice"));
|
|
39
|
+
|
|
40
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
41
|
+
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
|
+
|
|
44
|
+
// MultipleChoice
|
|
45
|
+
var translator = _translator["default"].translator;
|
|
46
|
+
|
|
47
|
+
var styles = function styles(theme) {
|
|
48
|
+
return {
|
|
49
|
+
main: {
|
|
50
|
+
color: _renderUi.color.text(),
|
|
51
|
+
backgroundColor: _renderUi.color.background(),
|
|
52
|
+
'& *': {
|
|
53
|
+
'-webkit-font-smoothing': 'antialiased'
|
|
54
|
+
},
|
|
55
|
+
position: 'relative',
|
|
56
|
+
// remove border from legend tags inside main to override the OT default styles
|
|
57
|
+
'& legend': {
|
|
58
|
+
border: 'none !important'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
partLabel: {
|
|
62
|
+
display: 'block',
|
|
63
|
+
fontSize: 'inherit',
|
|
64
|
+
margin: '0',
|
|
65
|
+
fontWeight: 'normal',
|
|
66
|
+
paddingBottom: theme.spacing.unit * 2
|
|
67
|
+
},
|
|
68
|
+
teacherInstructions: {
|
|
69
|
+
marginBottom: theme.spacing.unit * 2
|
|
70
|
+
},
|
|
71
|
+
horizontalLayout: {
|
|
72
|
+
display: 'flex',
|
|
73
|
+
flexDirection: 'row',
|
|
74
|
+
flexWrap: 'wrap'
|
|
75
|
+
},
|
|
76
|
+
gridLayout: {
|
|
77
|
+
display: 'grid'
|
|
78
|
+
},
|
|
79
|
+
fieldset: {
|
|
80
|
+
border: '0px',
|
|
81
|
+
padding: '0.01em 0 0 0',
|
|
82
|
+
margin: '0px',
|
|
83
|
+
minWidth: '0px',
|
|
84
|
+
'&:focus': {
|
|
85
|
+
outline: 'none'
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
srOnly: {
|
|
89
|
+
position: 'absolute',
|
|
90
|
+
left: '-10000px',
|
|
91
|
+
top: 'auto',
|
|
92
|
+
width: '1px',
|
|
93
|
+
height: '1px',
|
|
94
|
+
overflow: 'hidden'
|
|
95
|
+
},
|
|
96
|
+
errorText: {
|
|
97
|
+
fontSize: theme.typography.fontSize - 2,
|
|
98
|
+
color: theme.palette.error.main,
|
|
99
|
+
paddingTop: theme.spacing.unit
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
var MultipleChoice = /*#__PURE__*/function (_React$Component) {
|
|
105
|
+
(0, _inherits2["default"])(MultipleChoice, _React$Component);
|
|
106
|
+
|
|
107
|
+
var _super = _createSuper(MultipleChoice);
|
|
108
|
+
|
|
109
|
+
function MultipleChoice(props) {
|
|
110
|
+
var _this;
|
|
111
|
+
|
|
112
|
+
(0, _classCallCheck2["default"])(this, MultipleChoice);
|
|
113
|
+
_this = _super.call(this, props);
|
|
114
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleChange", function (event) {
|
|
115
|
+
var _event$target = event.target,
|
|
116
|
+
value = _event$target.value,
|
|
117
|
+
checked = _event$target.checked;
|
|
118
|
+
var _this$props = _this.props,
|
|
119
|
+
maxSelections = _this$props.maxSelections,
|
|
120
|
+
onChoiceChanged = _this$props.onChoiceChanged,
|
|
121
|
+
session = _this$props.session;
|
|
122
|
+
|
|
123
|
+
if (session.value && session.value.length >= maxSelections) {
|
|
124
|
+
// show/hide max selections error when user select/deselect an answer
|
|
125
|
+
_this.setState({
|
|
126
|
+
maxSelectionsErrorState: checked
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
if (checked) {
|
|
130
|
+
// prevent selecting more answers
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
onChoiceChanged({
|
|
136
|
+
value: value,
|
|
137
|
+
selected: checked,
|
|
138
|
+
selector: 'Mouse'
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onToggle", function () {
|
|
142
|
+
if (_this.props.mode === 'evaluate') {
|
|
143
|
+
_this.setState({
|
|
144
|
+
showCorrect: !_this.state.showCorrect
|
|
145
|
+
}, function () {
|
|
146
|
+
if (_this.props.onShowCorrectToggle) {
|
|
147
|
+
_this.props.onShowCorrectToggle();
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCorrectness", function () {
|
|
153
|
+
var choice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
154
|
+
var isCorrect = choice.correct;
|
|
155
|
+
|
|
156
|
+
var isChecked = _this.isSelected(choice.value);
|
|
157
|
+
|
|
158
|
+
if (_this.state.showCorrect) {
|
|
159
|
+
return isCorrect ? 'correct' : undefined;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (isCorrect) {
|
|
163
|
+
if (isChecked) {
|
|
164
|
+
// A correct answer is selected: marked with a green checkmark
|
|
165
|
+
return 'correct';
|
|
166
|
+
} else {
|
|
167
|
+
// A correct answer is NOT selected: marked with an orange X
|
|
168
|
+
return 'incorrect';
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
if (isChecked) {
|
|
172
|
+
// An incorrect answer is selected: marked with an orange X
|
|
173
|
+
return 'incorrect';
|
|
174
|
+
} else {
|
|
175
|
+
// An incorrect answer is NOT selected: not marked
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleGroupFocus", function (e) {
|
|
181
|
+
var fieldset = e.currentTarget;
|
|
182
|
+
var activeEl = document.activeElement;
|
|
183
|
+
|
|
184
|
+
if (fieldset.contains(activeEl) && activeEl !== fieldset) {
|
|
185
|
+
return;
|
|
186
|
+
} // Only focus the first input if user is tabbing forward
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
if (!e.relatedTarget || fieldset.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_PRECEDING) {
|
|
190
|
+
var _this$firstInputRef;
|
|
191
|
+
|
|
192
|
+
if ((_this$firstInputRef = _this.firstInputRef) !== null && _this$firstInputRef !== void 0 && _this$firstInputRef.current) {
|
|
193
|
+
_this.firstInputRef.current.focus();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
_this.state = {
|
|
198
|
+
showCorrect: _this.props.alwaysShowCorrect || false,
|
|
199
|
+
maxSelectionsErrorState: false
|
|
200
|
+
};
|
|
201
|
+
_this.onToggle = _this.onToggle.bind((0, _assertThisInitialized2["default"])(_this));
|
|
202
|
+
_this.firstInputRef = /*#__PURE__*/_react["default"].createRef();
|
|
203
|
+
return _this;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
(0, _createClass2["default"])(MultipleChoice, [{
|
|
207
|
+
key: "isSelected",
|
|
208
|
+
value: function isSelected(value) {
|
|
209
|
+
var sessionValue = this.props.session && this.props.session.value;
|
|
210
|
+
return sessionValue && sessionValue.indexOf && sessionValue.indexOf(value) >= 0;
|
|
211
|
+
} // handleChange was added for accessibility. Please see comments and videos from PD-2441.
|
|
212
|
+
|
|
213
|
+
}, {
|
|
214
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
215
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
216
|
+
var _this2 = this;
|
|
217
|
+
|
|
218
|
+
if (!nextProps.correctResponse && this.state.showCorrect !== false) {
|
|
219
|
+
this.setState({
|
|
220
|
+
showCorrect: false
|
|
221
|
+
}, function () {
|
|
222
|
+
if (_this2.props.onShowCorrectToggle) {
|
|
223
|
+
_this2.props.onShowCorrectToggle();
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (nextProps.alwaysShowCorrect && this.state.showCorrect !== true) {
|
|
229
|
+
this.setState({
|
|
230
|
+
showCorrect: true
|
|
231
|
+
}, function () {
|
|
232
|
+
if (_this2.props.onShowCorrectToggle) {
|
|
233
|
+
_this2.props.onShowCorrectToggle();
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}, {
|
|
239
|
+
key: "indexToSymbol",
|
|
240
|
+
value: function indexToSymbol(index) {
|
|
241
|
+
if (this.props.keyMode === 'numbers') {
|
|
242
|
+
return "".concat(index + 1);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (this.props.keyMode === 'letters') {
|
|
246
|
+
return String.fromCharCode(97 + index).toUpperCase();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return '';
|
|
250
|
+
}
|
|
251
|
+
}, {
|
|
252
|
+
key: "getChecked",
|
|
253
|
+
value: function getChecked(choice) {
|
|
254
|
+
// to determine if we are in evaluate mode or print mode
|
|
255
|
+
// since both modes have showCorrect but it interferes with "browse mode" in IBX if the print props are set
|
|
256
|
+
var isEvaluateMode = this.state.showCorrect && this.props.mode === 'evaluate';
|
|
257
|
+
var isPrintMode = this.props.alwaysShowCorrect && (!this.props.session || !this.props.session.value || this.props.session.value.length === 0);
|
|
258
|
+
|
|
259
|
+
if (isEvaluateMode || isPrintMode) {
|
|
260
|
+
return choice.correct || false;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return this.isSelected(choice.value);
|
|
264
|
+
} // renderHeading function was added for accessibility.
|
|
265
|
+
|
|
266
|
+
}, {
|
|
267
|
+
key: "renderHeading",
|
|
268
|
+
value: function renderHeading() {
|
|
269
|
+
var _this$props2 = this.props,
|
|
270
|
+
mode = _this$props2.mode,
|
|
271
|
+
choiceMode = _this$props2.choiceMode,
|
|
272
|
+
classes = _this$props2.classes;
|
|
273
|
+
|
|
274
|
+
if (mode !== 'gather') {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return choiceMode === 'radio' ? /*#__PURE__*/_react["default"].createElement("h3", {
|
|
279
|
+
className: classes.srOnly
|
|
280
|
+
}, "Multiple Choice Question") : /*#__PURE__*/_react["default"].createElement("h3", {
|
|
281
|
+
className: classes.srOnly
|
|
282
|
+
}, "Multiple Select Question");
|
|
283
|
+
}
|
|
284
|
+
}, {
|
|
285
|
+
key: "render",
|
|
286
|
+
value: function render() {
|
|
287
|
+
var _classNames,
|
|
288
|
+
_this3 = this;
|
|
289
|
+
|
|
290
|
+
var _this$props3 = this.props,
|
|
291
|
+
mode = _this$props3.mode,
|
|
292
|
+
disabled = _this$props3.disabled,
|
|
293
|
+
className = _this$props3.className,
|
|
294
|
+
_this$props3$choices = _this$props3.choices,
|
|
295
|
+
choices = _this$props3$choices === void 0 ? [] : _this$props3$choices,
|
|
296
|
+
choiceMode = _this$props3.choiceMode,
|
|
297
|
+
gridColumns = _this$props3.gridColumns,
|
|
298
|
+
partLabel = _this$props3.partLabel,
|
|
299
|
+
prompt = _this$props3.prompt,
|
|
300
|
+
responseCorrect = _this$props3.responseCorrect,
|
|
301
|
+
teacherInstructions = _this$props3.teacherInstructions,
|
|
302
|
+
classes = _this$props3.classes,
|
|
303
|
+
alwaysShowCorrect = _this$props3.alwaysShowCorrect,
|
|
304
|
+
animationsDisabled = _this$props3.animationsDisabled,
|
|
305
|
+
language = _this$props3.language,
|
|
306
|
+
isSelectionButtonBelow = _this$props3.isSelectionButtonBelow,
|
|
307
|
+
minSelections = _this$props3.minSelections,
|
|
308
|
+
maxSelections = _this$props3.maxSelections,
|
|
309
|
+
autoplayAudioEnabled = _this$props3.autoplayAudioEnabled,
|
|
310
|
+
session = _this$props3.session,
|
|
311
|
+
customAudioButton = _this$props3.customAudioButton;
|
|
312
|
+
var _this$state = this.state,
|
|
313
|
+
showCorrect = _this$state.showCorrect,
|
|
314
|
+
maxSelectionsErrorState = _this$state.maxSelectionsErrorState;
|
|
315
|
+
var isEvaluateMode = mode === 'evaluate';
|
|
316
|
+
var showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;
|
|
317
|
+
var columnsStyle = gridColumns > 1 ? {
|
|
318
|
+
gridTemplateColumns: "repeat(".concat(gridColumns, ", 1fr)")
|
|
319
|
+
} : undefined;
|
|
320
|
+
var selections = session.value && session.value.length || 0;
|
|
321
|
+
|
|
322
|
+
var teacherInstructionsDiv = /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
323
|
+
tagName: "div",
|
|
324
|
+
className: "prompt",
|
|
325
|
+
defaultClassName: "teacher-instructions",
|
|
326
|
+
prompt: teacherInstructions
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
var getMultipleChoiceMinSelectionErrorMessage = function getMultipleChoiceMinSelectionErrorMessage() {
|
|
330
|
+
if (minSelections && maxSelections) {
|
|
331
|
+
return minSelections === maxSelections ? translator.t('translation:multipleChoice:minmaxSelections_equal', {
|
|
332
|
+
lng: language,
|
|
333
|
+
minSelections: minSelections
|
|
334
|
+
}) : translator.t('translation:multipleChoice:minmaxSelections_range', {
|
|
335
|
+
lng: language,
|
|
336
|
+
minSelections: minSelections,
|
|
337
|
+
maxSelections: maxSelections
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (minSelections) {
|
|
342
|
+
return translator.t('translation:multipleChoice:minSelections', {
|
|
343
|
+
lng: language,
|
|
344
|
+
minSelections: minSelections
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return '';
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
352
|
+
id: 'main-container',
|
|
353
|
+
className: (0, _classnames["default"])(classes.main, className, 'multiple-choice')
|
|
354
|
+
}, partLabel && /*#__PURE__*/_react["default"].createElement("h2", {
|
|
355
|
+
className: classes.partLabel
|
|
356
|
+
}, partLabel), this.renderHeading(), teacherInstructions && /*#__PURE__*/_react["default"].createElement("div", {
|
|
357
|
+
className: classes.teacherInstructions
|
|
358
|
+
}, !animationsDisabled ? /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
359
|
+
labels: {
|
|
360
|
+
hidden: 'Show Teacher Instructions',
|
|
361
|
+
visible: 'Hide Teacher Instructions'
|
|
362
|
+
}
|
|
363
|
+
}, teacherInstructionsDiv) : teacherInstructionsDiv), /*#__PURE__*/_react["default"].createElement("fieldset", {
|
|
364
|
+
tabIndex: 0,
|
|
365
|
+
className: classes.fieldset,
|
|
366
|
+
onFocus: this.handleGroupFocus,
|
|
367
|
+
role: choiceMode === 'radio' ? 'radiogroup' : 'group'
|
|
368
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
369
|
+
className: "prompt",
|
|
370
|
+
defaultClassName: "prompt",
|
|
371
|
+
prompt: prompt,
|
|
372
|
+
tagName: 'legend',
|
|
373
|
+
autoplayAudioEnabled: autoplayAudioEnabled,
|
|
374
|
+
customAudioButton: customAudioButton
|
|
375
|
+
}), !alwaysShowCorrect && /*#__PURE__*/_react["default"].createElement(_correctAnswerToggle["default"], {
|
|
376
|
+
show: showCorrectAnswerToggle,
|
|
377
|
+
toggled: showCorrect,
|
|
378
|
+
onToggle: this.onToggle.bind(this),
|
|
379
|
+
language: language
|
|
380
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
381
|
+
className: (0, _classnames["default"])((_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.gridLayout, this.props.choicesLayout === 'grid'), (0, _defineProperty2["default"])(_classNames, classes.horizontalLayout, this.props.choicesLayout === 'horizontal'), _classNames)),
|
|
382
|
+
style: columnsStyle
|
|
383
|
+
}, choices.map(function (choice, index) {
|
|
384
|
+
return /*#__PURE__*/_react["default"].createElement(_choice["default"], {
|
|
385
|
+
autoFocusRef: index === 0 ? _this3.firstInputRef : null,
|
|
386
|
+
choicesLayout: _this3.props.choicesLayout,
|
|
387
|
+
selectedAnswerBackgroundColor: _this3.props.selectedAnswerBackgroundColor,
|
|
388
|
+
selectedAnswerStrokeColor: _this3.props.selectedAnswerStrokeColor,
|
|
389
|
+
selectedAnswerStrokeWidth: _this3.props.selectedAnswerStrokeWidth,
|
|
390
|
+
hoverAnswerBackgroundColor: _this3.props.hoverAnswerBackgroundColor,
|
|
391
|
+
hoverAnswerStrokeColor: _this3.props.hoverAnswerStrokeColor,
|
|
392
|
+
hoverAnswerStrokeWidth: _this3.props.hoverAnswerStrokeWidth,
|
|
393
|
+
gridColumns: gridColumns,
|
|
394
|
+
key: "choice-".concat(index),
|
|
395
|
+
choice: choice,
|
|
396
|
+
index: index,
|
|
397
|
+
choicesLength: choices.length,
|
|
398
|
+
showCorrect: showCorrect,
|
|
399
|
+
isEvaluateMode: isEvaluateMode,
|
|
400
|
+
choiceMode: choiceMode,
|
|
401
|
+
disabled: disabled,
|
|
402
|
+
tagName: partLabel ? "group-".concat(partLabel) : 'group',
|
|
403
|
+
onChoiceChanged: _this3.handleChange,
|
|
404
|
+
hideTick: choice.hideTick,
|
|
405
|
+
checked: _this3.getChecked(choice),
|
|
406
|
+
correctness: isEvaluateMode ? _this3.getCorrectness(choice) : undefined,
|
|
407
|
+
displayKey: _this3.indexToSymbol(index),
|
|
408
|
+
isSelectionButtonBelow: isSelectionButtonBelow
|
|
409
|
+
});
|
|
410
|
+
}))), choiceMode === 'checkbox' && selections < minSelections && /*#__PURE__*/_react["default"].createElement("div", {
|
|
411
|
+
className: classes.errorText
|
|
412
|
+
}, getMultipleChoiceMinSelectionErrorMessage()), choiceMode === 'checkbox' && maxSelectionsErrorState && /*#__PURE__*/_react["default"].createElement("div", {
|
|
413
|
+
className: classes.errorText
|
|
414
|
+
}, translator.t("translation:multipleChoice:maxSelections_".concat(maxSelections === 1 ? 'one' : 'other'), {
|
|
415
|
+
lng: language,
|
|
416
|
+
maxSelections: maxSelections
|
|
417
|
+
})));
|
|
418
|
+
}
|
|
419
|
+
}]);
|
|
420
|
+
return MultipleChoice;
|
|
421
|
+
}(_react["default"].Component);
|
|
422
|
+
|
|
423
|
+
exports.MultipleChoice = MultipleChoice;
|
|
424
|
+
(0, _defineProperty2["default"])(MultipleChoice, "propTypes", {
|
|
425
|
+
className: _propTypes["default"].string,
|
|
426
|
+
mode: _propTypes["default"].oneOf(['gather', 'view', 'evaluate']),
|
|
427
|
+
choiceMode: _propTypes["default"].oneOf(['radio', 'checkbox']),
|
|
428
|
+
keyMode: _propTypes["default"].oneOf(['numbers', 'letters', 'none']),
|
|
429
|
+
choices: _propTypes["default"].array,
|
|
430
|
+
partLabel: _propTypes["default"].string,
|
|
431
|
+
prompt: _propTypes["default"].string,
|
|
432
|
+
teacherInstructions: _propTypes["default"].string,
|
|
433
|
+
session: _propTypes["default"].object,
|
|
434
|
+
disabled: _propTypes["default"].bool,
|
|
435
|
+
onChoiceChanged: _propTypes["default"].func,
|
|
436
|
+
responseCorrect: _propTypes["default"].bool,
|
|
437
|
+
classes: _propTypes["default"].object.isRequired,
|
|
438
|
+
correctResponse: _propTypes["default"].array,
|
|
439
|
+
choicesLayout: _propTypes["default"].oneOf(['vertical', 'grid', 'horizontal']),
|
|
440
|
+
gridColumns: _propTypes["default"].string,
|
|
441
|
+
alwaysShowCorrect: _propTypes["default"].bool,
|
|
442
|
+
animationsDisabled: _propTypes["default"].bool,
|
|
443
|
+
language: _propTypes["default"].string,
|
|
444
|
+
selectedAnswerBackgroundColor: _propTypes["default"].string,
|
|
445
|
+
selectedAnswerStrokeColor: _propTypes["default"].string,
|
|
446
|
+
selectedAnswerStrokeWidth: _propTypes["default"].string,
|
|
447
|
+
hoverAnswerBackgroundColor: _propTypes["default"].string,
|
|
448
|
+
hoverAnswerStrokeColor: _propTypes["default"].string,
|
|
449
|
+
hoverAnswerStrokeWidth: _propTypes["default"].string,
|
|
450
|
+
onShowCorrectToggle: _propTypes["default"].func,
|
|
451
|
+
isSelectionButtonBelow: _propTypes["default"].bool,
|
|
452
|
+
minSelections: _propTypes["default"].number,
|
|
453
|
+
maxSelections: _propTypes["default"].number,
|
|
454
|
+
autoplayAudioEnabled: _propTypes["default"].bool,
|
|
455
|
+
customAudioButton: {
|
|
456
|
+
playImage: _propTypes["default"].string,
|
|
457
|
+
pauseImage: _propTypes["default"].string
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
MultipleChoice.defaultProps = {
|
|
461
|
+
session: {
|
|
462
|
+
value: []
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
var _default = (0, _styles.withStyles)(styles)(MultipleChoice);
|
|
467
|
+
|
|
468
|
+
exports["default"] = _default;
|
|
469
|
+
//# sourceMappingURL=multiple-choice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/multiple-choice.jsx"],"names":["translator","Translator","styles","theme","main","color","text","backgroundColor","background","position","border","partLabel","display","fontSize","margin","fontWeight","paddingBottom","spacing","unit","teacherInstructions","marginBottom","horizontalLayout","flexDirection","flexWrap","gridLayout","fieldset","padding","minWidth","outline","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","e","currentTarget","activeEl","document","activeElement","contains","relatedTarget","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","firstInputRef","current","focus","alwaysShowCorrect","onToggle","bind","React","createRef","sessionValue","indexOf","nextProps","correctResponse","index","keyMode","String","fromCharCode","toUpperCase","isEvaluateMode","isPrintMode","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","handleGroupFocus","choicesLayout","map","selectedAnswerBackgroundColor","selectedAnswerStrokeColor","selectedAnswerStrokeWidth","hoverAnswerBackgroundColor","hoverAnswerStrokeColor","hoverAnswerStrokeWidth","handleChange","hideTick","getChecked","getCorrectness","indexToSymbol","Component","PropTypes","string","oneOf","array","object","bool","func","isRequired","number","playImage","pauseImage","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAEA;AAEA,IA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sBAAUK,IAjBZ;AAkBjBrC,EAAAA,kBAAkB,EAAEgC,sBAAUK,IAlBb;AAmBjBpC,EAAAA,QAAQ,EAAE+B,sBAAUC,MAnBH;AAoBjBb,EAAAA,6BAA6B,EAAEY,sBAAUC,MApBxB;AAqBjBZ,EAAAA,yBAAyB,EAAEW,sBAAUC,MArBpB;AAsBjBX,EAAAA,yBAAyB,EAAEU,sBAAUC,MAtBpB;AAuBjBV,EAAAA,0BAA0B,EAAES,sBAAUC,MAvBrB;AAwBjBT,EAAAA,sBAAsB,EAAEQ,sBAAUC,MAxBjB;AAyBjBR,EAAAA,sBAAsB,EAAEO,sBAAUC,MAzBjB;AA0BjB7E,EAAAA,mBAAmB,EAAE4E,sBAAUM,IA1Bd;AA2BjBpC,EAAAA,sBAAsB,EAAE8B,sBAAUK,IA3BjB;AA4BjBlC,EAAAA,aAAa,EAAE6B,sBAAUQ,MA5BR;AA6BjB/F,EAAAA,aAAa,EAAEuF,sBAAUQ,MA7BR;AA8BjBpC,EAAAA,oBAAoB,EAAE4B,sBAAUK,IA9Bf;AA+BjBhC,EAAAA,iBAAiB,EAAE;AACjBoC,IAAAA,SAAS,EAAET,sBAAUC,MADJ;AAEjBS,IAAAA,UAAU,EAAEV,sBAAUC;AAFL;AA/BF,C;AAuVrB9F,cAAc,CAACwG,YAAf,GAA8B;AAC5BhG,EAAAA,OAAO,EAAE;AACPJ,IAAAA,KAAK,EAAE;AADA;AADmB,CAA9B;;eAMe,wBAAW1C,MAAX,EAAmBsC,cAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color, Collapsible, PreviewPrompt } from '@pie-lib/render-ui';\nimport Translator from '@pie-lib/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 // remove border from legend tags inside main to override the OT default styles\n '& legend': {\n border: 'none !important',\n },\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 '&:focus': {\n outline: 'none',\n },\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 selectedAnswerStrokeColor: PropTypes.string,\n selectedAnswerStrokeWidth: PropTypes.string,\n hoverAnswerBackgroundColor: PropTypes.string,\n hoverAnswerStrokeColor: PropTypes.string,\n hoverAnswerStrokeWidth: 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 this.firstInputRef = React.createRef();\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 // to determine if we are in evaluate mode or print mode\n // since both modes have showCorrect but it interferes with \"browse mode\" in IBX if the print props are set\n const isEvaluateMode = this.state.showCorrect && this.props.mode === 'evaluate';\n const isPrintMode =\n this.props.alwaysShowCorrect &&\n (!this.props.session || !this.props.session.value || this.props.session.value.length === 0);\n\n if (isEvaluateMode || isPrintMode) {\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 <h3 className={classes.srOnly}>Multiple Choice Question</h3>\n ) : (\n <h3 className={classes.srOnly}>Multiple Select Question</h3>\n );\n }\n\n handleGroupFocus = (e) => {\n const fieldset = e.currentTarget;\n const activeEl = document.activeElement;\n\n if (fieldset.contains(activeEl) && activeEl !== fieldset) {\n return;\n }\n\n // Only focus the first input if user is tabbing forward\n if (!e.relatedTarget || fieldset.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_PRECEDING) {\n if (this.firstInputRef?.current) {\n this.firstInputRef.current.focus();\n }\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', {\n lng: language,\n minSelections,\n maxSelections,\n });\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 && <h2 className={classes.partLabel}>{partLabel}</h2>}\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\n tabIndex={0}\n className={classes.fieldset}\n onFocus={this.handleGroupFocus}\n role={choiceMode === 'radio' ? 'radiogroup' : 'group'}\n >\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 autoFocusRef={index === 0 ? this.firstInputRef : null}\n choicesLayout={this.props.choicesLayout}\n selectedAnswerBackgroundColor={this.props.selectedAnswerBackgroundColor}\n selectedAnswerStrokeColor={this.props.selectedAnswerStrokeColor}\n selectedAnswerStrokeWidth={this.props.selectedAnswerStrokeWidth}\n hoverAnswerBackgroundColor={this.props.hoverAnswerBackgroundColor}\n hoverAnswerStrokeColor={this.props.hoverAnswerStrokeColor}\n hoverAnswerStrokeWidth={this.props.hoverAnswerStrokeWidth}\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 tagName={partLabel ? `group-${partLabel}` : 'group'}\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}>{getMultipleChoiceMinSelectionErrorMessage()}</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"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
23
|
+
|
|
24
|
+
var _react = _interopRequireDefault(require("react"));
|
|
25
|
+
|
|
26
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
27
|
+
|
|
28
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
29
|
+
|
|
30
|
+
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
31
|
+
|
|
32
|
+
var _main = _interopRequireDefault(require("./main"));
|
|
33
|
+
|
|
34
|
+
var _mathRendering = require("@pie-lib/math-rendering");
|
|
35
|
+
|
|
36
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
37
|
+
|
|
38
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
39
|
+
|
|
40
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
|
+
|
|
42
|
+
var log = (0, _debug["default"])('pie-element:multiple-choice:print');
|
|
43
|
+
/**
|
|
44
|
+
* Live in same package as main element - so we can access some of the shared comps!
|
|
45
|
+
*
|
|
46
|
+
* - update pslb to build print if src/print.js is there
|
|
47
|
+
* - update demo el
|
|
48
|
+
* - get configure/controller building
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
var preparePrintModel = function preparePrintModel(model, opts) {
|
|
52
|
+
var instr = opts.role === 'instructor';
|
|
53
|
+
model.prompt = model.promptEnabled !== false ? model.prompt : undefined;
|
|
54
|
+
model.teacherInstructions = instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;
|
|
55
|
+
model.showTeacherInstructions = instr;
|
|
56
|
+
model.alwaysShowCorrect = instr;
|
|
57
|
+
model.mode = instr ? 'evaluate' : model.mode;
|
|
58
|
+
model.disabled = true;
|
|
59
|
+
model.animationsDisabled = true;
|
|
60
|
+
model.lockChoiceOrder = true;
|
|
61
|
+
model.choicesLayout = model.choicesLayout || 'vertical';
|
|
62
|
+
var choices = (0, _cloneDeep["default"])(model.choices);
|
|
63
|
+
model.choices = choices.map(function (c) {
|
|
64
|
+
c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;
|
|
65
|
+
c.hideTick = instr;
|
|
66
|
+
c.feedback = undefined;
|
|
67
|
+
return c;
|
|
68
|
+
});
|
|
69
|
+
model.keyMode = model.choicePrefix || 'letters';
|
|
70
|
+
return model;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var MultipleChoicePrint = /*#__PURE__*/function (_HTMLElement) {
|
|
74
|
+
(0, _inherits2["default"])(MultipleChoicePrint, _HTMLElement);
|
|
75
|
+
|
|
76
|
+
var _super = _createSuper(MultipleChoicePrint);
|
|
77
|
+
|
|
78
|
+
function MultipleChoicePrint() {
|
|
79
|
+
var _this;
|
|
80
|
+
|
|
81
|
+
(0, _classCallCheck2["default"])(this, MultipleChoicePrint);
|
|
82
|
+
_this = _super.call(this);
|
|
83
|
+
_this._options = null;
|
|
84
|
+
_this._model = null;
|
|
85
|
+
_this._session = [];
|
|
86
|
+
_this._rerender = (0, _debounce["default"])(function () {
|
|
87
|
+
if (_this._model && _this._session) {
|
|
88
|
+
var printModel = preparePrintModel(_this._model, _this._options);
|
|
89
|
+
|
|
90
|
+
var element = _this._options && /*#__PURE__*/_react["default"].createElement(_main["default"], {
|
|
91
|
+
model: printModel,
|
|
92
|
+
session: {}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
_reactDom["default"].render(element, (0, _assertThisInitialized2["default"])(_this), function () {
|
|
96
|
+
log('render complete - render math');
|
|
97
|
+
(0, _mathRendering.renderMath)((0, _assertThisInitialized2["default"])(_this));
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
log('skip');
|
|
101
|
+
}
|
|
102
|
+
}, 50, {
|
|
103
|
+
leading: false,
|
|
104
|
+
trailing: true
|
|
105
|
+
});
|
|
106
|
+
return _this;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
(0, _createClass2["default"])(MultipleChoicePrint, [{
|
|
110
|
+
key: "options",
|
|
111
|
+
set: function set(o) {
|
|
112
|
+
this._options = o;
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
key: "model",
|
|
116
|
+
set: function set(s) {
|
|
117
|
+
this._model = s;
|
|
118
|
+
|
|
119
|
+
this._rerender();
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "connectedCallback",
|
|
123
|
+
value: function connectedCallback() {}
|
|
124
|
+
}]);
|
|
125
|
+
return MultipleChoicePrint;
|
|
126
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
|
|
127
|
+
|
|
128
|
+
exports["default"] = MultipleChoicePrint;
|
|
129
|
+
//# sourceMappingURL=print.js.map
|