@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 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/preview-layout.jsx"],"names":["PreviewLayout","props","children","classes","ariaLabel","role","extraCSSRules","fontSizeFactor","accessibility","container","React","Component","PropTypes","string","oneOfType","arrayOf","node","isRequired","object","shape","names","rules","number","styles","display","flexDirection","position","theme","typography","useNextVariants","palette","action","disabled","overrides","MuiRadio","root","color","MuiCheckbox","MuiTabs","borderBottom","MuiSwitch","backgroundColor","opacity","Styled","RootElem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;IAEMA,a;;;;;;;;;;;;WAaJ,kBAAS;AACP,wBAA8E,KAAKC,KAAnF;AAAA,UAAQC,QAAR,eAAQA,QAAR;AAAA,UAAkBC,OAAlB,eAAkBA,OAAlB;AAAA,U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C,IAAAA,eAAe,EAAE;AADP,GADe;AAI3BC,EAAAA,OAAO,EAAE;AACPC,IAAAA,MAAM,EAAE;AACNC,MAAAA,QAAQ,EAAE;AADJ;AADD,GAJkB;AAS3BC,EAAAA,SAAS,EAAE;AACTC,IAAAA,QAAQ,EAAE;AACRC,MAAAA,IAAI,EAAE;AACJ,qBAAa;AACXC,UAAAA,KAAK,EAAE;AADI;AADT;AADE,KADD;AAQTC,IAAAA,WAAW,EAAE;AACXF,MAAAA,IAAI,EAAE;AACJ,qBAAa;AACXC,UAAAA,KAAK,EAAE;AADI;AADT;AADK,KARJ;AAeTE,IAAAA,OAAO,EAAE;AACPH,MAAAA,IAAI,EAAE;AACJI,QAAAA,YAAY,EAAE;AADV;AADC,KAfA;AAoBTC,IAAAA,SAAS,EAAE;AACTL,MAAAA,IAAI,EAAE;AACJ,qBAAa;AACXC,UAAAA,KAAK,EAAE,oBADI;AAEX,sBAAY;AACVK,YAAAA,eAAe,EAAE,oBADP;AAEVC,YAAAA,OAAO,EAAE;AAFC;AAFD;AADT;AADG;AApBF;AATgB,CAAf,CAAd;AA2CA,IAAMC,MAAM,GAAG,wBAAWpB,MAAX,EAAmBvB,aAAnB,CAAf;;AAEA,IAAM4C,QAAQ,GAAG,SAAXA,QAAW,CAAC3C,KAAD;AAAA,sBACf,gCAAC,wBAAD;AAAkB,IAAA,KAAK,EAAE0B;AAAzB,kBACE,gCAAC,MAAD,EAAY1B,KAAZ,CADF,CADe;AAAA,CAAjB;;eAMe2C,Q","sourcesContent":["import React from 'react';\nimport { withStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport UiLayout from './ui-layout';\n\nclass PreviewLayout extends React.Component {\n static propTypes = {\n ariaLabel: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n classes: PropTypes.object,\n role: PropTypes.string,\n extraCSSRules: PropTypes.shape({\n names: PropTypes.arrayOf(PropTypes.string),\n rules: PropTypes.string,\n }),\n fontSizeFactor: PropTypes.number,\n };\n\n render() {\n const { children, classes, ariaLabel, role, extraCSSRules, fontSizeFactor } = this.props;\n const accessibility = ariaLabel ? { 'aria-label': ariaLabel, role } : {};\n\n return (\n <UiLayout\n className={classes.container}\n {...accessibility}\n extraCSSRules={extraCSSRules}\n fontSizeFactor={fontSizeFactor}\n >\n {children}\n </UiLayout>\n );\n }\n}\n\nconst styles = () => ({\n container: {\n display: 'flex',\n flexDirection: 'column',\n position: 'relative',\n },\n});\n\nconst theme = createMuiTheme({\n typography: {\n useNextVariants: true,\n },\n palette: {\n action: {\n disabled: 'rgba(0, 0, 0, 0.54);',\n },\n },\n overrides: {\n MuiRadio: {\n root: {\n '&$checked': {\n color: '#3f51b5 !important',\n },\n },\n },\n MuiCheckbox: {\n root: {\n '&$checked': {\n color: '#3f51b5 !important',\n },\n },\n },\n MuiTabs: {\n root: {\n borderBottom: '1px solid #eee',\n },\n },\n MuiSwitch: {\n root: {\n '&$checked': {\n color: '#3f51b5 !important',\n '& + $bar': {\n backgroundColor: '#3f51b5 !important',\n opacity: 0.5,\n },\n },\n },\n },\n },\n});\n\nconst Styled = withStyles(styles)(PreviewLayout);\n\nconst RootElem = (props) => (\n <MuiThemeProvider theme={theme}>\n <Styled {...props} />\n </MuiThemeProvider>\n);\n\nexport default RootElem;\n"],"file":"preview-layout.js"}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = exports.PreviewPrompt = void 0;
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
16
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
+
|
|
18
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
27
|
+
|
|
28
|
+
var _styles = require("@material-ui/core/styles");
|
|
29
|
+
|
|
30
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
+
|
|
32
|
+
var color = _interopRequireWildcard(require("./color"));
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
+
|
|
38
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
39
|
+
|
|
40
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
41
|
+
|
|
42
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
43
|
+
|
|
44
|
+
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); }; }
|
|
45
|
+
|
|
46
|
+
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; } }
|
|
47
|
+
|
|
48
|
+
//Used these below to replace \\embed{newLine} with \\newline from prompt which will get parsed in MathJax
|
|
49
|
+
var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
|
|
50
|
+
var NEWLINE_LATEX = '\\newline ';
|
|
51
|
+
|
|
52
|
+
var PreviewPrompt = /*#__PURE__*/function (_Component) {
|
|
53
|
+
(0, _inherits2["default"])(PreviewPrompt, _Component);
|
|
54
|
+
|
|
55
|
+
var _super = _createSuper(PreviewPrompt);
|
|
56
|
+
|
|
57
|
+
function PreviewPrompt() {
|
|
58
|
+
var _this;
|
|
59
|
+
|
|
60
|
+
(0, _classCallCheck2["default"])(this, PreviewPrompt);
|
|
61
|
+
|
|
62
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
63
|
+
args[_key] = arguments[_key];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
67
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "parsedText", function (text) {
|
|
68
|
+
var customAudioButton = _this.props.customAudioButton;
|
|
69
|
+
var div = document.createElement('div');
|
|
70
|
+
div.innerHTML = text;
|
|
71
|
+
var audio = div.querySelector('audio');
|
|
72
|
+
|
|
73
|
+
if (audio) {
|
|
74
|
+
var source = document.createElement('source');
|
|
75
|
+
source.setAttribute('type', 'audio/mp3');
|
|
76
|
+
source.setAttribute('src', audio.getAttribute('src'));
|
|
77
|
+
audio.removeAttribute('src');
|
|
78
|
+
audio.setAttribute('id', 'pie-prompt-audio-player');
|
|
79
|
+
audio.appendChild(source);
|
|
80
|
+
|
|
81
|
+
if (customAudioButton) {
|
|
82
|
+
audio.style.display = 'none';
|
|
83
|
+
var playButton = document.createElement('div');
|
|
84
|
+
playButton.id = 'play-audio-button';
|
|
85
|
+
Object.assign(playButton.style, {
|
|
86
|
+
cursor: 'pointer',
|
|
87
|
+
display: 'block',
|
|
88
|
+
width: '128px',
|
|
89
|
+
height: '128px',
|
|
90
|
+
backgroundImage: "url(".concat(customAudioButton.pauseImage, ")"),
|
|
91
|
+
backgroundSize: 'cover',
|
|
92
|
+
borderRadius: '50%',
|
|
93
|
+
border: '1px solid #326295'
|
|
94
|
+
});
|
|
95
|
+
audio.parentNode.insertBefore(playButton, audio);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return div.innerHTML;
|
|
100
|
+
});
|
|
101
|
+
return _this;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
(0, _createClass2["default"])(PreviewPrompt, [{
|
|
105
|
+
key: "addCustomAudioButtonControls",
|
|
106
|
+
value: function addCustomAudioButtonControls() {
|
|
107
|
+
var _this$props = this.props,
|
|
108
|
+
autoplayAudioEnabled = _this$props.autoplayAudioEnabled,
|
|
109
|
+
customAudioButton = _this$props.customAudioButton;
|
|
110
|
+
var playButton = document.getElementById('play-audio-button');
|
|
111
|
+
var audio = document.getElementById('pie-prompt-audio-player');
|
|
112
|
+
|
|
113
|
+
if (autoplayAudioEnabled && audio) {
|
|
114
|
+
audio.play().then(function () {
|
|
115
|
+
if (playButton && customAudioButton) {
|
|
116
|
+
audio.addEventListener('ended', handleAudioEnded);
|
|
117
|
+
}
|
|
118
|
+
})["catch"](function (error) {
|
|
119
|
+
console.error('Error playing audio', error);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!playButton || !audio || !customAudioButton) return;
|
|
124
|
+
|
|
125
|
+
var handlePlayClick = function handlePlayClick() {
|
|
126
|
+
// if already playing, don't play again
|
|
127
|
+
if (!audio.paused) return;
|
|
128
|
+
if (playButton.style.backgroundImage.includes(customAudioButton.pauseImage)) return;
|
|
129
|
+
audio.play();
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
var handleAudioEnded = function handleAudioEnded() {
|
|
133
|
+
playButton.style.backgroundImage = "url(".concat(customAudioButton.playImage, ")");
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
var handleAudioPlay = function handleAudioPlay() {
|
|
137
|
+
Object.assign(playButton.style, {
|
|
138
|
+
backgroundImage: "url(".concat(customAudioButton.pauseImage, ")"),
|
|
139
|
+
border: '1px solid #ccc'
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
var handleAudioPause = function handleAudioPause() {
|
|
144
|
+
Object.assign(playButton.style, {
|
|
145
|
+
backgroundImage: "url(".concat(customAudioButton.playImage, ")"),
|
|
146
|
+
border: '1px solid #326295'
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
playButton.addEventListener('click', handlePlayClick);
|
|
151
|
+
audio.addEventListener('play', handleAudioPlay);
|
|
152
|
+
audio.addEventListener('pause', handleAudioPause);
|
|
153
|
+
audio.addEventListener('ended', handleAudioEnded); // store event handler references so they can be removed later
|
|
154
|
+
|
|
155
|
+
this._handlePlayClick = handlePlayClick;
|
|
156
|
+
this._handleAudioPlay = handleAudioPlay;
|
|
157
|
+
this._handleAudioPause = handleAudioPause;
|
|
158
|
+
this._handleAudioEnded = handleAudioEnded;
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "removeCustomAudioButtonListeners",
|
|
162
|
+
value: function removeCustomAudioButtonListeners() {
|
|
163
|
+
var playButton = document.getElementById('play-audio-button');
|
|
164
|
+
var audio = document.querySelector('audio');
|
|
165
|
+
if (!playButton || !audio) return; // remove event listeners using stored references
|
|
166
|
+
|
|
167
|
+
playButton.removeEventListener('click', this._handlePlayClick);
|
|
168
|
+
audio.removeEventListener('play', this._handleAudioPlay);
|
|
169
|
+
audio.removeEventListener('pause', this._handleAudioPause);
|
|
170
|
+
audio.removeEventListener('ended', this._handleAudioEnded);
|
|
171
|
+
}
|
|
172
|
+
}, {
|
|
173
|
+
key: "componentDidMount",
|
|
174
|
+
value: function componentDidMount() {
|
|
175
|
+
this.alignImages();
|
|
176
|
+
this.addCustomAudioButtonControls();
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
key: "componentDidUpdate",
|
|
180
|
+
value: function componentDidUpdate() {
|
|
181
|
+
this.alignImages();
|
|
182
|
+
}
|
|
183
|
+
}, {
|
|
184
|
+
key: "componentWillUnmount",
|
|
185
|
+
value: function componentWillUnmount() {
|
|
186
|
+
this.removeCustomAudioButtonListeners();
|
|
187
|
+
}
|
|
188
|
+
}, {
|
|
189
|
+
key: "alignImages",
|
|
190
|
+
value: function alignImages() {
|
|
191
|
+
var previewPrompts = document.querySelectorAll('#preview-prompt');
|
|
192
|
+
previewPrompts.forEach(function (previewPrompt) {
|
|
193
|
+
var images = previewPrompt.getElementsByTagName('img');
|
|
194
|
+
|
|
195
|
+
if (images && images.length) {
|
|
196
|
+
var _iterator = _createForOfIteratorHelper(images),
|
|
197
|
+
_step;
|
|
198
|
+
|
|
199
|
+
try {
|
|
200
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
201
|
+
var image = _step.value;
|
|
202
|
+
|
|
203
|
+
// check if alignment property was set
|
|
204
|
+
if (image.attributes && image.attributes.alignment && image.attributes.alignment.value) {
|
|
205
|
+
var parentNode = image.parentElement; // check if div is not already added to dom and replace current image with wrapped image
|
|
206
|
+
|
|
207
|
+
if (!(parentNode.tagName === 'DIV' && parentNode.style.display === 'flex' && parentNode.style.width === '100%')) {
|
|
208
|
+
var div = document.createElement('div');
|
|
209
|
+
div.style.display = 'flex';
|
|
210
|
+
div.style.width = '100%';
|
|
211
|
+
var copyImage = image.cloneNode(true);
|
|
212
|
+
div.appendChild(copyImage);
|
|
213
|
+
parentNode.replaceChild(div, image);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
} catch (err) {
|
|
218
|
+
_iterator.e(err);
|
|
219
|
+
} finally {
|
|
220
|
+
_iterator.f();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}, {
|
|
226
|
+
key: "render",
|
|
227
|
+
value: function render() {
|
|
228
|
+
var _this$props2 = this.props,
|
|
229
|
+
prompt = _this$props2.prompt,
|
|
230
|
+
classes = _this$props2.classes,
|
|
231
|
+
tagName = _this$props2.tagName,
|
|
232
|
+
className = _this$props2.className,
|
|
233
|
+
onClick = _this$props2.onClick,
|
|
234
|
+
defaultClassName = _this$props2.defaultClassName;
|
|
235
|
+
var CustomTag = tagName || 'div'; // legend tag was added once with accessibility tasks, wee need extra style to make it work with images alignment
|
|
236
|
+
|
|
237
|
+
var legendClass = tagName === 'legend' ? 'legend' : '';
|
|
238
|
+
var customClasses = "".concat(classes.promptTable, " ").concat(classes[className] || '', " ").concat(defaultClassName || '', " ").concat(classes[legendClass] || '');
|
|
239
|
+
return /*#__PURE__*/_react["default"].createElement(CustomTag, {
|
|
240
|
+
id: 'preview-prompt',
|
|
241
|
+
onClick: onClick,
|
|
242
|
+
className: customClasses,
|
|
243
|
+
dangerouslySetInnerHTML: {
|
|
244
|
+
__html: this.parsedText(prompt || '').replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX)
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}]);
|
|
249
|
+
return PreviewPrompt;
|
|
250
|
+
}(_react.Component);
|
|
251
|
+
|
|
252
|
+
exports.PreviewPrompt = PreviewPrompt;
|
|
253
|
+
(0, _defineProperty2["default"])(PreviewPrompt, "propTypes", {
|
|
254
|
+
classes: _propTypes["default"].object,
|
|
255
|
+
prompt: _propTypes["default"].string,
|
|
256
|
+
tagName: _propTypes["default"].string,
|
|
257
|
+
className: _propTypes["default"].string,
|
|
258
|
+
onClick: _propTypes["default"].func,
|
|
259
|
+
defaultClassName: _propTypes["default"].string,
|
|
260
|
+
autoplayAudioEnabled: _propTypes["default"].bool,
|
|
261
|
+
customAudioButton: {
|
|
262
|
+
playImage: _propTypes["default"].string,
|
|
263
|
+
pauseImage: _propTypes["default"].string
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
(0, _defineProperty2["default"])(PreviewPrompt, "defaultProps", {
|
|
267
|
+
onClick: function onClick() {}
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
var styles = function styles(theme) {
|
|
271
|
+
return {
|
|
272
|
+
prompt: {
|
|
273
|
+
verticalAlign: 'middle',
|
|
274
|
+
color: color.text()
|
|
275
|
+
},
|
|
276
|
+
legend: {
|
|
277
|
+
width: '100%',
|
|
278
|
+
fontSize: 'inherit !important'
|
|
279
|
+
},
|
|
280
|
+
rationale: {
|
|
281
|
+
paddingLeft: theme.spacing.unit * 4,
|
|
282
|
+
paddingBottom: theme.spacing.unit
|
|
283
|
+
},
|
|
284
|
+
label: {
|
|
285
|
+
color: "".concat(color.text(), " !important"),
|
|
286
|
+
//'var(--choice-input-color, black)',
|
|
287
|
+
display: 'flex',
|
|
288
|
+
flexDirection: 'column',
|
|
289
|
+
verticalAlign: 'middle',
|
|
290
|
+
cursor: 'pointer',
|
|
291
|
+
'& > p': {
|
|
292
|
+
margin: '0 0 0 0 !important'
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
promptTable: {
|
|
296
|
+
'&:not(.MathJax) > table': {
|
|
297
|
+
borderCollapse: 'collapse'
|
|
298
|
+
},
|
|
299
|
+
'&:not(.MathJax) > table tr': {
|
|
300
|
+
'&:nth-child(2n)': {
|
|
301
|
+
backgroundColor: '#f6f8fa',
|
|
302
|
+
color: theme.palette.common.black
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
// align table content to left as per STAR requirement PD-3687
|
|
306
|
+
'&:not(.MathJax) table td, &:not(.MathJax) table th': {
|
|
307
|
+
padding: '.6em 1em',
|
|
308
|
+
textAlign: 'left'
|
|
309
|
+
},
|
|
310
|
+
// added this to fix alignment of text in prompt imported from studio (PD-3423)
|
|
311
|
+
'&:not(.MathJax) > table td > p.kds-indent': {
|
|
312
|
+
textAlign: 'initial'
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
var _default = (0, _styles.withStyles)(styles)(PreviewPrompt);
|
|
319
|
+
|
|
320
|
+
exports["default"] = _default;
|
|
321
|
+
//# sourceMappingURL=preview-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/preview-prompt.jsx"],"names":["NEWLINE_BLOCK_REGEX","NEWLINE_LATEX","PreviewPrompt","text","customAudioButton","props","div","document","createElement","innerHTML","audio","querySelector","source","setAttribute","getAttribute","removeAttribute","appendChild","style","display","playButton","id","Object","assign","cursor","width","height","backgroundImage","pauseImage","backgroundSize","borderRadius","border","parentNode","insertBefore","autoplayAudioEnabled","getElementById","play","then","addEventListener","handleAudioEnded","error","console","handlePlayClick","paused","includes","playImage","handleAudioPlay","handleAudioPause","_handlePlayClick","_handleAudioPlay","_handleAudioPause","_handleAudioEnded","removeEventListener","alignImages","addCustomAudioButtonControls","removeCustomAudioButtonListeners","previewPrompts","querySelectorAll","forEach","previewPrompt","images","getElementsByTagName","length","image","attributes","alignment","value","parentElement","tagName","copyImage","cloneNode","replaceChild","prompt","classes","className","onClick","defaultClassName","CustomTag","legendClass","customClasses","promptTable","__html","parsedText","replace","Component","PropTypes","object","string","func","bool","styles","theme","verticalAlign","color","legend","fontSize","rationale","paddingLeft","spacing","unit","paddingBottom","label","flexDirection","margin","borderCollapse","backgroundColor","palette","common","black","padding","textAlign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;AAEA;AACA,IAAMA,mBAAmB,GAAG,yBAA5B;AACA,IAAMC,aAAa,GAAG,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;AADS,OADhB;AAIX,oCAA8B;AAC5B,2BAAmB;AACjBC,UAAAA,eAAe,EAAE,SADA;AAEjBZ,UAAAA,KAAK,EAAEF,KAAK,CAACe,OAAN,CAAcC,MAAd,CAAqBC;AAFX;AADS,OAJnB;AAUX;AACA,4DAAsD;AACpDC,QAAAA,OAAO,EAAE,UAD2C;AAEpDC,QAAAA,SAAS,EAAE;AAFyC,OAX3C;AAeX;AACA,mDAA6C;AAC3CA,QAAAA,SAAS,EAAE;AADgC;AAhBlC;AAvBY,GAAZ;AAAA,CAAf;;eA4Ce,wBAAWpB,MAAX,EAAmBvF,aAAnB,C","sourcesContent":["import React, { Component } from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport * as color from './color';\n\n//Used these below to replace \\\\embed{newLine} with \\\\newline from prompt which will get parsed in MathJax\nconst NEWLINE_BLOCK_REGEX = /\\\\embed\\{newLine\\}\\[\\]/g;\nconst NEWLINE_LATEX = '\\\\newline ';\n\nexport class PreviewPrompt extends Component {\n static propTypes = {\n classes: PropTypes.object,\n prompt: PropTypes.string,\n tagName: PropTypes.string,\n className: PropTypes.string,\n onClick: PropTypes.func,\n defaultClassName: PropTypes.string,\n autoplayAudioEnabled: PropTypes.bool,\n customAudioButton: {\n playImage: PropTypes.string,\n pauseImage: PropTypes.string,\n },\n };\n\n static defaultProps = {\n onClick: () => {},\n };\n\n parsedText = (text) => {\n const { customAudioButton } = this.props;\n const div = document.createElement('div');\n div.innerHTML = text;\n\n const audio = div.querySelector('audio');\n if (audio) {\n const source = document.createElement('source');\n\n source.setAttribute('type', 'audio/mp3');\n source.setAttribute('src', audio.getAttribute('src'));\n\n audio.removeAttribute('src');\n audio.setAttribute('id', 'pie-prompt-audio-player');\n\n audio.appendChild(source);\n\n if (customAudioButton) {\n audio.style.display = 'none';\n\n const playButton = document.createElement('div');\n playButton.id = 'play-audio-button';\n\n Object.assign(playButton.style, {\n cursor: 'pointer',\n display: 'block',\n width: '128px',\n height: '128px',\n backgroundImage: `url(${customAudioButton.pauseImage})`,\n backgroundSize: 'cover',\n borderRadius: '50%',\n border: '1px solid #326295',\n });\n\n audio.parentNode.insertBefore(playButton, audio);\n }\n }\n\n return div.innerHTML;\n };\n\n addCustomAudioButtonControls() {\n const { autoplayAudioEnabled, customAudioButton } = this.props;\n const playButton = document.getElementById('play-audio-button');\n const audio = document.getElementById('pie-prompt-audio-player');\n\n if (autoplayAudioEnabled && audio) {\n audio\n .play()\n .then(() => {\n if (playButton && customAudioButton) {\n audio.addEventListener('ended', handleAudioEnded);\n }\n })\n .catch((error) => {\n console.error('Error playing audio', error);\n });\n }\n\n if (!playButton || !audio || !customAudioButton) return;\n\n const handlePlayClick = () => {\n // if already playing, don't play again\n if (!audio.paused) return;\n if (playButton.style.backgroundImage.includes(customAudioButton.pauseImage)) return;\n\n audio.play();\n };\n\n const handleAudioEnded = () => {\n playButton.style.backgroundImage = `url(${customAudioButton.playImage})`;\n };\n\n const handleAudioPlay = () => {\n Object.assign(playButton.style, {\n backgroundImage: `url(${customAudioButton.pauseImage})`,\n border: '1px solid #ccc',\n });\n };\n\n const handleAudioPause = () => {\n Object.assign(playButton.style, {\n backgroundImage: `url(${customAudioButton.playImage})`,\n border: '1px solid #326295',\n });\n };\n\n playButton.addEventListener('click', handlePlayClick);\n audio.addEventListener('play', handleAudioPlay);\n audio.addEventListener('pause', handleAudioPause);\n audio.addEventListener('ended', handleAudioEnded);\n\n // store event handler references so they can be removed later\n this._handlePlayClick = handlePlayClick;\n this._handleAudioPlay = handleAudioPlay;\n this._handleAudioPause = handleAudioPause;\n this._handleAudioEnded = handleAudioEnded;\n }\n\n removeCustomAudioButtonListeners() {\n const playButton = document.getElementById('play-audio-button');\n const audio = document.querySelector('audio');\n\n if (!playButton || !audio) return;\n\n // remove event listeners using stored references\n playButton.removeEventListener('click', this._handlePlayClick);\n audio.removeEventListener('play', this._handleAudioPlay);\n audio.removeEventListener('pause', this._handleAudioPause);\n audio.removeEventListener('ended', this._handleAudioEnded);\n }\n\n componentDidMount() {\n this.alignImages();\n this.addCustomAudioButtonControls();\n }\n\n componentDidUpdate() {\n this.alignImages();\n }\n\n componentWillUnmount() {\n this.removeCustomAudioButtonListeners();\n }\n\n alignImages() {\n const previewPrompts = document.querySelectorAll('#preview-prompt');\n\n previewPrompts.forEach((previewPrompt) => {\n const images = previewPrompt.getElementsByTagName('img');\n\n if (images && images.length) {\n for (let image of images) {\n // check if alignment property was set\n if (image.attributes && image.attributes.alignment && image.attributes.alignment.value) {\n const parentNode = image.parentElement;\n\n // check if div is not already added to dom and replace current image with wrapped image\n if (\n !(\n parentNode.tagName === 'DIV' &&\n parentNode.style.display === 'flex' &&\n parentNode.style.width === '100%'\n )\n ) {\n const div = document.createElement('div');\n div.style.display = 'flex';\n div.style.width = '100%';\n\n const copyImage = image.cloneNode(true);\n div.appendChild(copyImage);\n parentNode.replaceChild(div, image);\n }\n }\n }\n }\n });\n }\n\n render() {\n const { prompt, classes, tagName, className, onClick, defaultClassName } = this.props;\n const CustomTag = tagName || 'div';\n // legend tag was added once with accessibility tasks, wee need extra style to make it work with images alignment\n const legendClass = tagName === 'legend' ? 'legend' : '';\n const customClasses = `${classes.promptTable} ${classes[className] || ''} ${defaultClassName || ''} ${classes[\n legendClass\n ] || ''}`;\n\n return (\n <CustomTag\n id={'preview-prompt'}\n onClick={onClick}\n className={customClasses}\n dangerouslySetInnerHTML={{\n __html: this.parsedText(prompt || '').replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX),\n }}\n />\n );\n }\n}\n\nconst styles = (theme) => ({\n prompt: {\n verticalAlign: 'middle',\n color: color.text(),\n },\n legend: {\n width: '100%',\n fontSize: 'inherit !important',\n },\n rationale: {\n paddingLeft: theme.spacing.unit * 4,\n paddingBottom: theme.spacing.unit,\n },\n label: {\n color: `${color.text()} !important`, //'var(--choice-input-color, black)',\n display: 'flex',\n flexDirection: 'column',\n verticalAlign: 'middle',\n cursor: 'pointer',\n '& > p': {\n margin: '0 0 0 0 !important',\n },\n },\n promptTable: {\n '&:not(.MathJax) > table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) > table tr': {\n '&:nth-child(2n)': {\n backgroundColor: '#f6f8fa',\n color: theme.palette.common.black,\n },\n },\n // align table content to left as per STAR requirement PD-3687\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '.6em 1em',\n textAlign: 'left',\n },\n // added this to fix alignment of text in prompt imported from studio (PD-3423)\n '&:not(.MathJax) > table td > p.kds-indent': {\n textAlign: 'initial',\n },\n },\n});\nexport default withStyles(styles)(PreviewPrompt);\n"],"file":"preview-prompt.js"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var Purpose = function Purpose(props) {
|
|
15
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _react["default"].Children.map(props.children, function (child) {
|
|
16
|
+
return /*#__PURE__*/_react["default"].cloneElement(child, {
|
|
17
|
+
'data-pie-purpose': props.purpose
|
|
18
|
+
});
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
Purpose.propTypes = {
|
|
23
|
+
children: _propTypes["default"].node,
|
|
24
|
+
purpose: _propTypes["default"].string
|
|
25
|
+
};
|
|
26
|
+
var _default = Purpose;
|
|
27
|
+
exports["default"] = _default;
|
|
28
|
+
//# sourceMappingURL=purpose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/purpose.jsx"],"names":["Purpose","props","React","Children","map","children","child","cloneElement","purpose","propTypes","PropTypes","node","string"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAW;AACzB,sBACE,kEACGC,kBAAMC,QAAN,CAAeC,GAAf,CAAmBH,KAAK,CAACI,QAAzB,EAAmC,UAACC,KAAD;AAAA,wBAAWJ,kBAAMK,YAAN,CAAmBD,KAAnB,EAA0B;AAAE,0BAAoBL,KAAK,CAACO;AAA5B,KAA1B,CAAX;AAAA,GAAnC,CADH,CADF;AAKD,CAND;;AAQAR,OAAO,CAACS,SAAR,GAAoB;AAClBJ,EAAAA,QAAQ,EAAEK,sBAAUC,IADF;AAElBH,EAAAA,OAAO,EAAEE,sBAAUE;AAFD,CAApB;eAKeZ,O","sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nconst Purpose = (props) => {\n return (\n <>\n {React.Children.map(props.children, (child) => React.cloneElement(child, { 'data-pie-purpose': props.purpose }))}\n </>\n );\n};\n\nPurpose.propTypes = {\n children: PropTypes.node,\n purpose: PropTypes.string,\n};\n\nexport default Purpose;\n"],"file":"purpose.js"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var Readable = function Readable(props) {
|
|
15
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _react["default"].Children.map(props.children, function (child) {
|
|
16
|
+
return /*#__PURE__*/_react["default"].cloneElement(child, {
|
|
17
|
+
'data-pie-readable': props["false"] === undefined
|
|
18
|
+
});
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
Readable.propTypes = {
|
|
23
|
+
children: _propTypes["default"].node,
|
|
24
|
+
"false": _propTypes["default"].bool
|
|
25
|
+
};
|
|
26
|
+
var _default = Readable;
|
|
27
|
+
exports["default"] = _default;
|
|
28
|
+
//# sourceMappingURL=readable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/readable.jsx"],"names":["Readable","props","React","Children","map","children","child","cloneElement","undefined","propTypes","PropTypes","node","bool"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD,EAAW;AAC1B,sBACE,kEACGC,kBAAMC,QAAN,CAAeC,GAAf,CAAmBH,KAAK,CAACI,QAAzB,EAAmC,UAACC,KAAD;AAAA,wBAClCJ,kBAAMK,YAAN,CAAmBD,KAAnB,EAA0B;AAAE,2BAAqBL,KAAK,SAAL,KAAgBO;AAAvC,KAA1B,CADkC;AAAA,GAAnC,CADH,CADF;AAOD,CARD;;AAUAR,QAAQ,CAACS,SAAT,GAAqB;AACnBJ,EAAAA,QAAQ,EAAEK,sBAAUC,IADD;AAEnB,WAAOD,sBAAUE;AAFE,CAArB;eAKeZ,Q","sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nconst Readable = (props) => {\n return (\n <>\n {React.Children.map(props.children, (child) =>\n React.cloneElement(child, { 'data-pie-readable': props.false === undefined }),\n )}\n </>\n );\n};\n\nReadable.propTypes = {\n children: PropTypes.node,\n false: PropTypes.bool,\n};\n\nexport default Readable;\n"],"file":"readable.js"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.PartiallyCorrect = exports.NothingSubmitted = exports.Incorrect = exports.Correct = void 0;
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
16
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
+
|
|
18
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireDefault(require("react"));
|
|
27
|
+
|
|
28
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
29
|
+
|
|
30
|
+
var icons = _interopRequireWildcard(require("@pie-lib/icons"));
|
|
31
|
+
|
|
32
|
+
var _Popover = _interopRequireDefault(require("@material-ui/core/Popover"));
|
|
33
|
+
|
|
34
|
+
var _styles = require("@material-ui/core/styles");
|
|
35
|
+
|
|
36
|
+
var _feedback = _interopRequireDefault(require("./feedback"));
|
|
37
|
+
|
|
38
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
39
|
+
|
|
40
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
41
|
+
|
|
42
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
|
+
|
|
44
|
+
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); }; }
|
|
45
|
+
|
|
46
|
+
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; } }
|
|
47
|
+
|
|
48
|
+
var log = (0, _debug["default"])('pie-libs:render-ui:response-indicators');
|
|
49
|
+
|
|
50
|
+
var styles = function styles() {
|
|
51
|
+
return {
|
|
52
|
+
responseIndicator: {
|
|
53
|
+
cursor: 'pointer'
|
|
54
|
+
},
|
|
55
|
+
paper: {
|
|
56
|
+
padding: '0',
|
|
57
|
+
borderRadius: '4px'
|
|
58
|
+
},
|
|
59
|
+
popover: {
|
|
60
|
+
cursor: 'pointer'
|
|
61
|
+
},
|
|
62
|
+
popperClose: {
|
|
63
|
+
cursor: 'pointer'
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var BuildIndicator = function BuildIndicator(Icon, correctness) {
|
|
69
|
+
var RawIndicator = /*#__PURE__*/function (_React$Component) {
|
|
70
|
+
(0, _inherits2["default"])(RawIndicator, _React$Component);
|
|
71
|
+
|
|
72
|
+
var _super = _createSuper(RawIndicator);
|
|
73
|
+
|
|
74
|
+
function RawIndicator(props) {
|
|
75
|
+
var _this;
|
|
76
|
+
|
|
77
|
+
(0, _classCallCheck2["default"])(this, RawIndicator);
|
|
78
|
+
_this = _super.call(this, props);
|
|
79
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handlePopoverOpen", function (event) {
|
|
80
|
+
log('[handlePopoverOpen]', event.target);
|
|
81
|
+
|
|
82
|
+
_this.setState({
|
|
83
|
+
anchorEl: event.target
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handlePopoverClose", function () {
|
|
87
|
+
_this.setState({
|
|
88
|
+
anchorEl: null
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
_this.state = {};
|
|
92
|
+
return _this;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
(0, _createClass2["default"])(RawIndicator, [{
|
|
96
|
+
key: "render",
|
|
97
|
+
value: function render() {
|
|
98
|
+
var _this2 = this;
|
|
99
|
+
|
|
100
|
+
var _this$props = this.props,
|
|
101
|
+
feedback = _this$props.feedback,
|
|
102
|
+
classes = _this$props.classes;
|
|
103
|
+
var anchorEl = this.state.anchorEl;
|
|
104
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
105
|
+
className: feedback && classes.responseIndicator
|
|
106
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
107
|
+
ref: function ref(r) {
|
|
108
|
+
return _this2.icon = r;
|
|
109
|
+
},
|
|
110
|
+
onClick: this.handlePopoverOpen
|
|
111
|
+
}, /*#__PURE__*/_react["default"].createElement(Icon, null)), feedback && /*#__PURE__*/_react["default"].createElement(_Popover["default"], {
|
|
112
|
+
className: classes.popover,
|
|
113
|
+
classes: {
|
|
114
|
+
paper: classes.paper
|
|
115
|
+
},
|
|
116
|
+
open: !!anchorEl,
|
|
117
|
+
anchorEl: anchorEl,
|
|
118
|
+
anchorOrigin: {
|
|
119
|
+
vertical: 'bottom',
|
|
120
|
+
horizontal: 'left'
|
|
121
|
+
},
|
|
122
|
+
transformOrigin: {
|
|
123
|
+
vertical: 'top',
|
|
124
|
+
horizontal: 'left'
|
|
125
|
+
},
|
|
126
|
+
onClose: this.handlePopoverClose
|
|
127
|
+
}, /*#__PURE__*/_react["default"].createElement(_feedback["default"], {
|
|
128
|
+
feedback: feedback,
|
|
129
|
+
correctness: correctness
|
|
130
|
+
})));
|
|
131
|
+
}
|
|
132
|
+
}]);
|
|
133
|
+
return RawIndicator;
|
|
134
|
+
}(_react["default"].Component);
|
|
135
|
+
|
|
136
|
+
RawIndicator.propTypes = {
|
|
137
|
+
feedback: _propTypes["default"].string,
|
|
138
|
+
classes: _propTypes["default"].object.isRequired
|
|
139
|
+
};
|
|
140
|
+
return (0, _styles.withStyles)(styles)(RawIndicator);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
var Correct = BuildIndicator(icons.Correct, 'correct');
|
|
144
|
+
exports.Correct = Correct;
|
|
145
|
+
var Incorrect = BuildIndicator(icons.Incorrect, 'incorrect');
|
|
146
|
+
exports.Incorrect = Incorrect;
|
|
147
|
+
var PartiallyCorrect = BuildIndicator(icons.PartiallyCorrect, 'partially-correct');
|
|
148
|
+
exports.PartiallyCorrect = PartiallyCorrect;
|
|
149
|
+
var NothingSubmitted = BuildIndicator(icons.NothingSubmitted, 'nothing-submitted');
|
|
150
|
+
exports.NothingSubmitted = NothingSubmitted;
|
|
151
|
+
//# sourceMappingURL=response-indicators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/response-indicators.jsx"],"names":["log","styles","responseIndicator","cursor","paper","padding","borderRadius","popover","popperClose","BuildIndicator","Icon","correctness","RawIndicator","props","event","target","setState","anchorEl","state","feedback","classes","r","icon","handlePopoverOpen","vertical","horizontal","handlePopoverClose","React","Component","propTypes","PropTypes","string","object","isRequired","Correct","icons","Incorrect","PartiallyCorrect","NothingSubmitted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,wCAAN,CAAZ;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO;AACpBC,IAAAA,iBAAiB,EAAE;AACjBC,MAAAA,MAAM,EAAE;AADS,KADC;AAIpBC,IAAAA,KAAK,EAAE;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,YAAY,EAAE;AAFT,KAJa;AAQpBC,IAAAA,OAAO,EAAE;AACPJ,MAAAA,MAAM,EAAE;AADD,KARW;AAWpBK,IAAAA,WAAW,EAAE;AACXL,MAAAA,MAAM,EAAE;AADG;AAXO,GAAP;AAAA,CAAf;;AAgBA,IAAMM,cAAc,GAAG,SAAjBA,cAAiB,CAACC,IAAD,EAAOC,WAAP,EAAuB;AAAA,MACtCC,YADsC;AAAA;;AAAA;;AAE1C,0BAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,gCAAMA,KAAN;AADiB,4GAKC,UAACC,KAAD,EAAW;AAC7Bd,QAAAA,GAAG,CAAC,qBAAD,EAAwBc,KAAK,CAACC,MAA9B,CAAH;;AACA,cAAKC,QAAL,CAAc;AAAEC,UAAAA,QAAQ,EAAEH,KAAK,CAACC;AAAlB,SAAd;AACD,OARkB;AAAA,6GAUE,YAAM;AACzB,cAAKC,QAAL,CAAc;AAAEC,UAAAA,QAAQ,EAAE;AAAZ,SAAd;AACD,OAZkB;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H,GAAzB;AAKA,SAAO,wBAAWhC,MAAX,EAAmBW,YAAnB,CAAP;AACD,CAzDD;;AA2DO,IAAMsB,OAAO,GAAGzB,cAAc,CAAC0B,KAAK,CAACD,OAAP,EAAgB,SAAhB,CAA9B;;AACA,IAAME,SAAS,GAAG3B,cAAc,CAAC0B,KAAK,CAACC,SAAP,EAAkB,WAAlB,CAAhC;;AACA,IAAMC,gBAAgB,GAAG5B,cAAc,CAAC0B,KAAK,CAACE,gBAAP,EAAyB,mBAAzB,CAAvC;;AACA,IAAMC,gBAAgB,GAAG7B,cAAc,CAAC0B,KAAK,CAACG,gBAAP,EAAyB,mBAAzB,CAAvC","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport * as icons from '@pie-lib/icons';\nimport Popover from '@material-ui/core/Popover';\nimport { withStyles } from '@material-ui/core/styles';\nimport Feedback from './feedback';\nimport debug from 'debug';\n\nconst log = debug('pie-libs:render-ui:response-indicators');\n\nconst styles = () => ({\n responseIndicator: {\n cursor: 'pointer',\n },\n paper: {\n padding: '0',\n borderRadius: '4px',\n },\n popover: {\n cursor: 'pointer',\n },\n popperClose: {\n cursor: 'pointer',\n },\n});\n\nconst BuildIndicator = (Icon, correctness) => {\n class RawIndicator extends React.Component {\n constructor(props) {\n super(props);\n this.state = {};\n }\n\n handlePopoverOpen = (event) => {\n log('[handlePopoverOpen]', event.target);\n this.setState({ anchorEl: event.target });\n };\n\n handlePopoverClose = () => {\n this.setState({ anchorEl: null });\n };\n\n render() {\n const { feedback, classes } = this.props;\n const { anchorEl } = this.state;\n return (\n <div className={feedback && classes.responseIndicator}>\n <span ref={(r) => (this.icon = r)} onClick={this.handlePopoverOpen}>\n <Icon />\n </span>\n\n {feedback && (\n <Popover\n className={classes.popover}\n classes={{\n paper: classes.paper,\n }}\n open={!!anchorEl}\n anchorEl={anchorEl}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'left',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n onClose={this.handlePopoverClose}\n >\n <Feedback feedback={feedback} correctness={correctness} />\n </Popover>\n )}\n </div>\n );\n }\n }\n\n RawIndicator.propTypes = {\n feedback: PropTypes.string,\n classes: PropTypes.object.isRequired,\n };\n\n return withStyles(styles)(RawIndicator);\n};\n\nexport const Correct = BuildIndicator(icons.Correct, 'correct');\nexport const Incorrect = BuildIndicator(icons.Incorrect, 'incorrect');\nexport const PartiallyCorrect = BuildIndicator(icons.PartiallyCorrect, 'partially-correct');\nexport const NothingSubmitted = BuildIndicator(icons.NothingSubmitted, 'nothing-submitted');\n"],"file":"response-indicators.js"}
|