@pie-element/multiple-choice 12.2.0-next.1 → 12.2.0-next.10
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 +55 -0
- package/configure/CHANGELOG.md +44 -0
- package/configure/lib/index.js +0 -12
- package/configure/lib/index.js.map +1 -1
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +4 -0
- package/controller/package.json +1 -1
- package/lib/choice-input.js +17 -11
- package/lib/choice-input.js.map +1 -1
- package/module/configure.js +1 -0
- package/module/controller.js +3045 -0
- package/module/demo.js +86 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +124 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +5 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,61 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [12.2.0-next.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.9...@pie-element/multiple-choice@12.2.0-next.10) (2026-04-21)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **multiple-choice:** improve screen reader experience for answer choices by removing duplicate announcements and simplifying SR output PIE-148 ([49920ad](https://github.com/pie-framework/pie-elements/commit/49920ad0de8ed9f5c21920d71298033a250fcfdf))
|
|
11
|
+
|
|
12
|
+
# [12.2.0-next.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.8...@pie-element/multiple-choice@12.2.0-next.9) (2026-04-17)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- bump libs PIE-129 ([cee3e10](https://github.com/pie-framework/pie-elements/commit/cee3e109a9c1d9a68ab592781c968f6b27209846))
|
|
17
|
+
|
|
18
|
+
# [12.2.0-next.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.7...@pie-element/multiple-choice@12.2.0-next.8) (2026-04-16)
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
- bump libs PIE-46, PIE-25, PIE-54, PIE-44, PIE-29, PIE-13, PIE-129 ([5c17838](https://github.com/pie-framework/pie-elements/commit/5c17838a53483437e42dc679a4361e16b7ef5e31))
|
|
23
|
+
- missing spacing PD-5450 ([0d3d604](https://github.com/pie-framework/pie-elements/commit/0d3d604b73843bc0dfcd993a7a433c603f5dec52))
|
|
24
|
+
|
|
25
|
+
# [12.2.0-next.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.6...@pie-element/multiple-choice@12.2.0-next.7) (2026-04-13)
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
- bump libs PIE-34 ([9f8b35a](https://github.com/pie-framework/pie-elements/commit/9f8b35a856ca1eba67d5630a358b96226cfca984))
|
|
30
|
+
|
|
31
|
+
# [12.2.0-next.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.5...@pie-element/multiple-choice@12.2.0-next.6) (2026-04-10)
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
- **multiple-choice,rubric:** ./print -> src/print.js (pslb) PIE-164 ([52fc8ca](https://github.com/pie-framework/pie-elements/commit/52fc8ca6156a9f15f148df51110ede4679027ace))
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
- **math-inline:** replace @pie-framework/mathquill with math-input helpers PIE-56, bump libs PIE-34, PIE-57, PIE-36, PIE-38, PIE-18 ([abd205e](https://github.com/pie-framework/pie-elements/commit/abd205e9c8335957b9fc2548822e4125bf1a7edb))
|
|
40
|
+
|
|
41
|
+
# [12.2.0-next.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.4...@pie-element/multiple-choice@12.2.0-next.5) (2026-04-08)
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
- bump shared modules and libs PIE-53, PIE-48, PIE-114, PIE-74, PIE-35, PIE-40, PIE-27 ([3e6682d](https://github.com/pie-framework/pie-elements/commit/3e6682db1eb23414f3a4222abe13d2dd8ae5378e))
|
|
46
|
+
|
|
47
|
+
# [12.2.0-next.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.3...@pie-element/multiple-choice@12.2.0-next.4) (2026-04-03)
|
|
48
|
+
|
|
49
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
50
|
+
|
|
51
|
+
# [12.2.0-next.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.2...@pie-element/multiple-choice@12.2.0-next.3) (2026-03-25)
|
|
52
|
+
|
|
53
|
+
**Note:** Version bump only for package @pie-element/multiple-choice
|
|
54
|
+
|
|
55
|
+
# [12.2.0-next.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.1...@pie-element/multiple-choice@12.2.0-next.2) (2026-03-19)
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
- bump libs PD-5669, PD-5530, PD-5496,PD-5501, PD-5790, PD-5622, PD-5811, PD-5590, PD-5510 ([1c7cfc4](https://github.com/pie-framework/pie-elements/commit/1c7cfc4ea91dfd631b9e2ca23810b65a4a4585cf))
|
|
60
|
+
|
|
6
61
|
# [12.2.0-next.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice@12.2.0-next.0...@pie-element/multiple-choice@12.2.0-next.1) (2026-03-18)
|
|
7
62
|
|
|
8
63
|
### Bug Fixes
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,50 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [9.2.0-next.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@9.2.0-next.6...@pie-element/multiple-choice-configure@9.2.0-next.7) (2026-04-17)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- bump libs PIE-129 ([cee3e10](https://github.com/pie-framework/pie-elements/commit/cee3e109a9c1d9a68ab592781c968f6b27209846))
|
|
11
|
+
|
|
12
|
+
# [9.2.0-next.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@9.2.0-next.5...@pie-element/multiple-choice-configure@9.2.0-next.6) (2026-04-16)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- bump libs PIE-46, PIE-25, PIE-54, PIE-44, PIE-29, PIE-13, PIE-129 ([5c17838](https://github.com/pie-framework/pie-elements/commit/5c17838a53483437e42dc679a4361e16b7ef5e31))
|
|
17
|
+
|
|
18
|
+
# [9.2.0-next.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@9.2.0-next.4...@pie-element/multiple-choice-configure@9.2.0-next.5) (2026-04-13)
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
- bump libs PIE-34 ([9f8b35a](https://github.com/pie-framework/pie-elements/commit/9f8b35a856ca1eba67d5630a358b96226cfca984))
|
|
23
|
+
|
|
24
|
+
# [9.2.0-next.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@9.2.0-next.3...@pie-element/multiple-choice-configure@9.2.0-next.4) (2026-04-10)
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
- **math-inline:** replace @pie-framework/mathquill with math-input helpers PIE-56, bump libs PIE-34, PIE-57, PIE-36, PIE-38, PIE-18 ([abd205e](https://github.com/pie-framework/pie-elements/commit/abd205e9c8335957b9fc2548822e4125bf1a7edb))
|
|
29
|
+
|
|
30
|
+
# [9.2.0-next.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@9.2.0-next.2...@pie-element/multiple-choice-configure@9.2.0-next.3) (2026-04-08)
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
- bump shared modules and libs PIE-53, PIE-48, PIE-114, PIE-74, PIE-35, PIE-40, PIE-27 ([3e6682d](https://github.com/pie-framework/pie-elements/commit/3e6682db1eb23414f3a4222abe13d2dd8ae5378e))
|
|
35
|
+
|
|
36
|
+
# [9.2.0-next.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@9.2.0-next.1...@pie-element/multiple-choice-configure@9.2.0-next.2) (2026-04-03)
|
|
37
|
+
|
|
38
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
39
|
+
|
|
40
|
+
# [9.2.0-next.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@9.2.0-next.0...@pie-element/multiple-choice-configure@9.2.0-next.1) (2026-03-25)
|
|
41
|
+
|
|
42
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-configure
|
|
43
|
+
|
|
44
|
+
# [9.2.0-next.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@9.1.1-next.4...@pie-element/multiple-choice-configure@9.2.0-next.0) (2026-03-19)
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
- bump libs PD-5669, PD-5530, PD-5496,PD-5501, PD-5790, PD-5622, PD-5811, PD-5590, PD-5510 ([1c7cfc4](https://github.com/pie-framework/pie-elements/commit/1c7cfc4ea91dfd631b9e2ca23810b65a4a4585cf))
|
|
49
|
+
|
|
6
50
|
## [9.1.1-next.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-configure@9.1.1-next.3...@pie-element/multiple-choice-configure@9.1.1-next.4) (2026-03-12)
|
|
7
51
|
|
|
8
52
|
### Bug Fixes
|
package/configure/lib/index.js
CHANGED
|
@@ -127,10 +127,6 @@ class MultipleChoice extends HTMLElement {
|
|
|
127
127
|
this.dispatchEvent(new _pieConfigureEvents.DeleteSoundEvent(src, done));
|
|
128
128
|
}
|
|
129
129
|
_render() {
|
|
130
|
-
console.log('🔧 [multiple-choice-configure] _render - Starting render');
|
|
131
|
-
console.log('🔧 [multiple-choice-configure] _render - Model:', this._model ? 'present' : 'missing');
|
|
132
|
-
console.log('🔧 [multiple-choice-configure] _render - Configuration:', this._configuration ? 'present' : 'missing');
|
|
133
|
-
console.log('🔧 [multiple-choice-configure] _render - Root exists:', !!this._root);
|
|
134
130
|
log('_render - Starting render');
|
|
135
131
|
log('_render - Model:', this._model ? 'present' : 'missing');
|
|
136
132
|
log('_render - Configuration:', this._configuration ? 'present' : 'missing');
|
|
@@ -152,23 +148,18 @@ class MultipleChoice extends HTMLElement {
|
|
|
152
148
|
}
|
|
153
149
|
});
|
|
154
150
|
if (!this._root) {
|
|
155
|
-
console.log('🔧 [multiple-choice-configure] _render - Creating React container');
|
|
156
151
|
log('_render - Creating React container');
|
|
157
152
|
|
|
158
153
|
// Create a container div for React to render into
|
|
159
154
|
this._reactContainer = document.createElement('div');
|
|
160
155
|
this._reactContainer.className = 'pie-configure-wrapper';
|
|
161
156
|
this.appendChild(this._reactContainer);
|
|
162
|
-
console.log('🔧 [multiple-choice-configure] _render - Creating new React root');
|
|
163
157
|
log('_render - Creating new React root');
|
|
164
158
|
this._root = (0, _client.createRoot)(this._reactContainer);
|
|
165
|
-
console.log('✅ [multiple-choice-configure] _render - React root created successfully');
|
|
166
159
|
log('_render - React root created successfully');
|
|
167
160
|
}
|
|
168
|
-
console.log('🔧 [multiple-choice-configure] _render - Calling root.render()');
|
|
169
161
|
log('_render - Calling root.render()');
|
|
170
162
|
this._root.render(element);
|
|
171
|
-
console.log('✅ [multiple-choice-configure] _render - Render completed successfully');
|
|
172
163
|
log('_render - Render completed successfully');
|
|
173
164
|
} catch (error) {
|
|
174
165
|
console.error('❌ [multiple-choice-configure] Render error:', error);
|
|
@@ -177,16 +168,13 @@ class MultipleChoice extends HTMLElement {
|
|
|
177
168
|
}
|
|
178
169
|
}
|
|
179
170
|
connectedCallback() {
|
|
180
|
-
console.log('🔧 [multiple-choice-configure] connectedCallback - Component connected to DOM');
|
|
181
171
|
log('connectedCallback - Component connected to DOM');
|
|
182
172
|
log('connectedCallback - Model:', this._model ? 'present' : 'missing');
|
|
183
173
|
log('connectedCallback - Configuration:', this._configuration ? 'present' : 'missing');
|
|
184
174
|
}
|
|
185
175
|
disconnectedCallback() {
|
|
186
|
-
console.log('🔧 [multiple-choice-configure] disconnectedCallback - Component disconnected from DOM');
|
|
187
176
|
log('disconnectedCallback - Component disconnected from DOM');
|
|
188
177
|
if (this._root) {
|
|
189
|
-
console.log('🔧 [multiple-choice-configure] disconnectedCallback - Unmounting React root');
|
|
190
178
|
log('disconnectedCallback - Unmounting React root');
|
|
191
179
|
this._root.unmount();
|
|
192
180
|
this._root = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_debug","_pieConfigureEvents","_main","_configUi","_lodashEs","_defaults","log","debug","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","defaults","sensibleDefaults","answerChoiceCount","MultipleChoice","HTMLElement","constructor","_root","_reactContainer","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","newConfiguration","language","enabled","languageChoices","options","settings","find","option","disableSidePanel","_disableSidePanel","dispatchModelUpdated","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","console","element","React","createElement","Main","imageSupport","add","delete","uploadSoundSupport","document","className","appendChild","createRoot","render","error","stack","connectedCallback","disconnectedCallback","unmount","exports","default","_defineProperty2","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debug from 'debug';\nimport {\n DeleteImageEvent,\n InsertImageEvent,\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport { defaults } from 'lodash-es';\n\nimport sensibleDefaults from './defaults';\n\nconst log = debug('multiple-choice:configure');\n\nconst generateFormattedChoices = (choices, choiceCount = 0) => {\n if (!choices || choices.length === 0) {\n let formattedChoices = [];\n\n for (let i = 0; i < choiceCount; i++) {\n formattedChoices.push({\n value: `${i}`,\n label: '',\n feedback: {\n type: 'none',\n value: '',\n },\n });\n }\n\n return formattedChoices;\n }\n\n return choices;\n};\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model: {\n ...model,\n choices: generateFormattedChoices(\n (model && model.choices) || [],\n configuration && configuration.answerChoiceCount,\n ),\n },\n };\n};\n\nexport default class MultipleChoice extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = utils.normalizeChoices({\n ...sensibleDefaults.model,\n ...model,\n choices: generateFormattedChoices((model && model.choices) || []),\n });\n\n // This is used for offering support for old models which have the property \"verticalMode\"\n normalizedModel.choicesLayout =\n model.choicesLayout || (model.verticalMode === false && 'horizontal') || sensibleDefaults.model.choicesLayout;\n\n return normalizedModel;\n };\n\n constructor() {\n super();\n this._root = null;\n this._reactContainer = null;\n this._model = MultipleChoice.createDefaultModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = MultipleChoice.createDefaultModel(s);\n\n this._render();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n\n const newConfiguration = {\n ...sensibleDefaults.configuration,\n ...info.configuration,\n };\n this._configuration = newConfiguration;\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = m;\n this._render();\n\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n /** @param {done, progress, file} handler */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _render() {\n console.log('🔧 [multiple-choice-configure] _render - Starting render');\n console.log('🔧 [multiple-choice-configure] _render - Model:', this._model ? 'present' : 'missing');\n console.log('🔧 [multiple-choice-configure] _render - Configuration:', this._configuration ? 'present' : 'missing');\n console.log('🔧 [multiple-choice-configure] _render - Root exists:', !!this._root);\n log('_render - Starting render');\n log('_render - Model:', this._model ? 'present' : 'missing');\n log('_render - Configuration:', this._configuration ? 'present' : 'missing');\n log('_render - Root exists:', !!this._root);\n\n try {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n console.log('🔧 [multiple-choice-configure] _render - Creating React container');\n log('_render - Creating React container');\n\n // Create a container div for React to render into\n this._reactContainer = document.createElement('div');\n this._reactContainer.className = 'pie-configure-wrapper';\n this.appendChild(this._reactContainer);\n\n console.log('🔧 [multiple-choice-configure] _render - Creating new React root');\n log('_render - Creating new React root');\n this._root = createRoot(this._reactContainer);\n console.log('✅ [multiple-choice-configure] _render - React root created successfully');\n log('_render - React root created successfully');\n }\n\n console.log('🔧 [multiple-choice-configure] _render - Calling root.render()');\n log('_render - Calling root.render()');\n this._root.render(element);\n console.log('✅ [multiple-choice-configure] _render - Render completed successfully');\n log('_render - Render completed successfully');\n } catch (error) {\n console.error('❌ [multiple-choice-configure] Render error:', error);\n console.error('Error stack:', error.stack);\n throw error;\n }\n }\n\n connectedCallback() {\n console.log('🔧 [multiple-choice-configure] connectedCallback - Component connected to DOM');\n log('connectedCallback - Component connected to DOM');\n log('connectedCallback - Model:', this._model ? 'present' : 'missing');\n log('connectedCallback - Configuration:', this._configuration ? 'present' : 'missing');\n }\n\n disconnectedCallback() {\n console.log('🔧 [multiple-choice-configure] disconnectedCallback - Component disconnected from DOM');\n log('disconnectedCallback - Component disconnected from DOM');\n if (this._root) {\n console.log('🔧 [multiple-choice-configure] disconnectedCallback - Unmounting React root');\n log('disconnectedCallback - Unmounting React root');\n this._root.unmount();\n this._root = null;\n }\n if (this._reactContainer) {\n this._reactContainer = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,MAAMQ,GAAG,GAAG,IAAAC,cAAK,EAAC,2BAA2B,CAAC;AAE9C,MAAMC,wBAAwB,GAAGA,CAACC,OAAO,EAAEC,WAAW,GAAG,CAAC,KAAK;EAC7D,IAAI,CAACD,OAAO,IAAIA,OAAO,CAACE,MAAM,KAAK,CAAC,EAAE;IACpC,IAAIC,gBAAgB,GAAG,EAAE;IAEzB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,WAAW,EAAEG,CAAC,EAAE,EAAE;MACpCD,gBAAgB,CAACE,IAAI,CAAC;QACpBC,KAAK,EAAE,GAAGF,CAAC,EAAE;QACbG,KAAK,EAAE,EAAE;QACTC,QAAQ,EAAE;UACRC,IAAI,EAAE,MAAM;UACZH,KAAK,EAAE;QACT;MACF,CAAC,CAAC;IACJ;IAEA,OAAOH,gBAAgB;EACzB;EAEA,OAAOH,OAAO;AAChB,CAAC;AAED,MAAMU,0BAA0B,GAAGA,CAACC,MAAM,EAAEC,KAAK,KAAK;EACpD,MAAMC,aAAa,GAAG,IAAAC,kBAAQ,EAACH,MAAM,EAAEI,iBAAgB,CAACF,aAAa,CAAC;EAEtE,OAAO;IACLA,aAAa;IACbD,KAAK,EA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6E,CAAC;MAC1FA,GAAG,CAAC,8CAA8C,CAAC;MACnD,IAAI,CAACuB,KAAK,CAACyD,OAAO,CAAC,CAAC;MACpB,IAAI,CAACzD,KAAK,GAAG,IAAI;IACnB;IACA,IAAI,IAAI,CAACC,eAAe,EAAE;MACxB,IAAI,CAACA,eAAe,GAAG,IAAI;IAC7B;EACF;AACF;AAACyD,OAAA,CAAAC,OAAA,GAAA9D,cAAA;AAAA,IAAA+D,gBAAA,CAAAD,OAAA,EAhMoB9D,cAAc,wBACL,CAACL,KAAK,GAAG,CAAC,CAAC,KAAK;EAC1C,MAAMqE,eAAe,GAAGC,qBAAK,CAACC,gBAAgB,CAAC;IAC7C,GAAGpE,iBAAgB,CAACH,KAAK;IACzB,GAAGA,KAAK;IACRZ,OAAO,EAAED,wBAAwB,CAAEa,KAAK,IAAIA,KAAK,CAACZ,OAAO,IAAK,EAAE;EAClE,CAAC,CAAC;;EAEF;EACAiF,eAAe,CAACG,aAAa,GAC3BxE,KAAK,CAACwE,aAAa,IAAKxE,KAAK,CAACyE,YAAY,KAAK,KAAK,IAAI,YAAa,IAAItE,iBAAgB,CAACH,KAAK,CAACwE,aAAa;EAE/G,OAAOH,eAAe;AACxB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_debug","_pieConfigureEvents","_main","_configUi","_lodashEs","_defaults","log","debug","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","defaults","sensibleDefaults","answerChoiceCount","MultipleChoice","HTMLElement","constructor","_root","_reactContainer","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","newConfiguration","language","enabled","languageChoices","options","settings","find","option","disableSidePanel","_disableSidePanel","dispatchModelUpdated","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","element","React","createElement","Main","imageSupport","add","delete","uploadSoundSupport","document","className","appendChild","createRoot","render","error","console","stack","connectedCallback","disconnectedCallback","unmount","exports","default","_defineProperty2","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debug from 'debug';\nimport {\n DeleteImageEvent,\n InsertImageEvent,\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport { defaults } from 'lodash-es';\n\nimport sensibleDefaults from './defaults';\n\nconst log = debug('multiple-choice:configure');\n\nconst generateFormattedChoices = (choices, choiceCount = 0) => {\n if (!choices || choices.length === 0) {\n let formattedChoices = [];\n\n for (let i = 0; i < choiceCount; i++) {\n formattedChoices.push({\n value: `${i}`,\n label: '',\n feedback: {\n type: 'none',\n value: '',\n },\n });\n }\n\n return formattedChoices;\n }\n\n return choices;\n};\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model: {\n ...model,\n choices: generateFormattedChoices(\n (model && model.choices) || [],\n configuration && configuration.answerChoiceCount,\n ),\n },\n };\n};\n\nexport default class MultipleChoice extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = utils.normalizeChoices({\n ...sensibleDefaults.model,\n ...model,\n choices: generateFormattedChoices((model && model.choices) || []),\n });\n\n // This is used for offering support for old models which have the property \"verticalMode\"\n normalizedModel.choicesLayout =\n model.choicesLayout || (model.verticalMode === false && 'horizontal') || sensibleDefaults.model.choicesLayout;\n\n return normalizedModel;\n };\n\n constructor() {\n super();\n this._root = null;\n this._reactContainer = null;\n this._model = MultipleChoice.createDefaultModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = MultipleChoice.createDefaultModel(s);\n\n this._render();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n\n const newConfiguration = {\n ...sensibleDefaults.configuration,\n ...info.configuration,\n };\n this._configuration = newConfiguration;\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = m;\n this._render();\n\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n /** @param {done, progress, file} handler */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _render() {\n log('_render - Starting render');\n log('_render - Model:', this._model ? 'present' : 'missing');\n log('_render - Configuration:', this._configuration ? 'present' : 'missing');\n log('_render - Root exists:', !!this._root);\n\n try {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n log('_render - Creating React container');\n\n // Create a container div for React to render into\n this._reactContainer = document.createElement('div');\n this._reactContainer.className = 'pie-configure-wrapper';\n this.appendChild(this._reactContainer);\n\n log('_render - Creating new React root');\n this._root = createRoot(this._reactContainer);\n log('_render - React root created successfully');\n }\n\n log('_render - Calling root.render()');\n this._root.render(element);\n log('_render - Render completed successfully');\n } catch (error) {\n console.error('❌ [multiple-choice-configure] Render error:', error);\n console.error('Error stack:', error.stack);\n throw error;\n }\n }\n\n connectedCallback() {\n log('connectedCallback - Component connected to DOM');\n log('connectedCallback - Model:', this._model ? 'present' : 'missing');\n log('connectedCallback - Configuration:', this._configuration ? 'present' : 'missing');\n }\n\n disconnectedCallback() {\n log('disconnectedCallback - Component disconnected from DOM');\n if (this._root) {\n log('disconnectedCallback - Unmounting React root');\n this._root.unmount();\n this._root = null;\n }\n if (this._reactContainer) {\n this._reactContainer = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SA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AAG,SAAS,GAAG,SAAS,CAAC;EACxF;EAEAoD,oBAAoBA,CAAA,EAAG;IACrB/E,GAAG,CAAC,wDAAwD,CAAC;IAC7D,IAAI,IAAI,CAACuB,KAAK,EAAE;MACdvB,GAAG,CAAC,8CAA8C,CAAC;MACnD,IAAI,CAACuB,KAAK,CAACyD,OAAO,CAAC,CAAC;MACpB,IAAI,CAACzD,KAAK,GAAG,IAAI;IACnB;IACA,IAAI,IAAI,CAACC,eAAe,EAAE;MACxB,IAAI,CAACA,eAAe,GAAG,IAAI;IAC7B;EACF;AACF;AAACyD,OAAA,CAAAC,OAAA,GAAA9D,cAAA;AAAA,IAAA+D,gBAAA,CAAAD,OAAA,EApLoB9D,cAAc,wBACL,CAACL,KAAK,GAAG,CAAC,CAAC,KAAK;EAC1C,MAAMqE,eAAe,GAAGC,qBAAK,CAACC,gBAAgB,CAAC;IAC7C,GAAGpE,iBAAgB,CAACH,KAAK;IACzB,GAAGA,KAAK;IACRZ,OAAO,EAAED,wBAAwB,CAAEa,KAAK,IAAIA,KAAK,CAACZ,OAAO,IAAK,EAAE;EAClE,CAAC,CAAC;;EAEF;EACAiF,eAAe,CAACG,aAAa,GAC3BxE,KAAK,CAACwE,aAAa,IAAKxE,KAAK,CAACyE,YAAY,KAAK,KAAK,IAAI,YAAa,IAAItE,iBAAgB,CAACH,KAAK,CAACwE,aAAa;EAE/G,OAAOH,eAAe;AACxB,CAAC","ignoreList":[]}
|
package/configure/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice-configure",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0-next.7",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"@mui/icons-material": "^7.3.4",
|
|
11
11
|
"@mui/material": "^7.3.4",
|
|
12
12
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
13
|
-
"@pie-lib/config-ui": "12.2.0-next.
|
|
14
|
-
"@pie-lib/editable-html-tip-tap": "1.2.0-next.
|
|
15
|
-
"@pie-lib/render-ui": "5.2.0-next.
|
|
13
|
+
"@pie-lib/config-ui": "12.2.0-next.36",
|
|
14
|
+
"@pie-lib/editable-html-tip-tap": "1.2.0-next.35",
|
|
15
|
+
"@pie-lib/render-ui": "5.2.0-next.8",
|
|
16
16
|
"debug": "^4.1.1",
|
|
17
17
|
"lodash-es": "^4.17.23",
|
|
18
18
|
"prop-types": "^15.8.1",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [7.2.0-next.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@7.2.0-next.0...@pie-element/multiple-choice-controller@7.2.0-next.1) (2026-04-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/multiple-choice-controller
|
|
9
|
+
|
|
6
10
|
# [7.2.0-next.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/multiple-choice-controller@7.1.1-next.1...@pie-element/multiple-choice-controller@7.2.0-next.0) (2026-03-18)
|
|
7
11
|
|
|
8
12
|
### Bug Fixes
|
package/controller/package.json
CHANGED
package/lib/choice-input.js
CHANGED
|
@@ -29,7 +29,7 @@ const CheckboxHolder = (0, _styles.styled)(_Box.default)({
|
|
|
29
29
|
backgroundColor: _renderUi.color.background(),
|
|
30
30
|
flex: 1,
|
|
31
31
|
'& .MuiFormControlLabel-root': {
|
|
32
|
-
marginLeft: '-14px' // to be consistent to previous versions before MUI v5 upgrade
|
|
32
|
+
marginLeft: '-14px' // to be consistent to previous versions before MUI v5 upgrade
|
|
33
33
|
},
|
|
34
34
|
'& label': {
|
|
35
35
|
color: _renderUi.color.text(),
|
|
@@ -37,7 +37,7 @@ const CheckboxHolder = (0, _styles.styled)(_Box.default)({
|
|
|
37
37
|
fontSize: 'inherit'
|
|
38
38
|
},
|
|
39
39
|
'& > .MuiButtonBase-root': {
|
|
40
|
-
padding: '12px' // to be consistent to previous versions before MUI v5 upgrade
|
|
40
|
+
padding: '12px' // to be consistent to previous versions before MUI v5 upgrade
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -48,7 +48,7 @@ const BelowSelectionComponent = (0, _styles.styled)('span')(({
|
|
|
48
48
|
alignItems: 'center',
|
|
49
49
|
'& > span': {
|
|
50
50
|
// visually reduce right padding, but maintain accessibility padding for checkbox indicators to be circles
|
|
51
|
-
marginLeft: `-${theme.spacing(1)}
|
|
51
|
+
marginLeft: `-${theme.spacing(1)}`
|
|
52
52
|
}
|
|
53
53
|
}));
|
|
54
54
|
const SrOnly = (0, _styles.styled)('span')({
|
|
@@ -286,9 +286,15 @@ class ChoiceInput extends _react.default.Component {
|
|
|
286
286
|
}
|
|
287
287
|
})
|
|
288
288
|
};
|
|
289
|
+
const hasMathOrImage = typeof label === 'string' && (label.includes('<math') || label.includes('\\(') || label.includes('\\[') || label.includes('<img') || label.includes('data-latex') || label.includes('data-raw') || label.includes('<mjx-container'));
|
|
290
|
+
const screenReaderLabel = displayKey ? /*#__PURE__*/_react.default.createElement(SrOnly, {
|
|
291
|
+
id: this.descId
|
|
292
|
+
}, hasMathOrImage ? `Pick the answer below, ${displayKey}` : displayKey) : null;
|
|
289
293
|
const choicelabel = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, displayKey && !isSelectionButtonBelow ? /*#__PURE__*/_react.default.createElement(Row, {
|
|
290
294
|
component: "span"
|
|
291
|
-
},
|
|
295
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
296
|
+
"aria-hidden": "true"
|
|
297
|
+
}, displayKey, ".", '\u00A0'), /*#__PURE__*/_react.default.createElement(_renderUi.PreviewPrompt, {
|
|
292
298
|
className: "prompt-label",
|
|
293
299
|
prompt: label,
|
|
294
300
|
tagName: "span"
|
|
@@ -297,9 +303,6 @@ class ChoiceInput extends _react.default.Component {
|
|
|
297
303
|
prompt: label,
|
|
298
304
|
tagName: "span"
|
|
299
305
|
}));
|
|
300
|
-
const screenReaderLabel = /*#__PURE__*/_react.default.createElement(SrOnly, {
|
|
301
|
-
id: this.descId
|
|
302
|
-
}, choiceMode === 'checkbox' ? 'Checkbox to select the answer below' : 'Radio button to select the answer below');
|
|
303
306
|
const tagProps = {
|
|
304
307
|
disabled,
|
|
305
308
|
checked,
|
|
@@ -309,14 +312,17 @@ class ChoiceInput extends _react.default.Component {
|
|
|
309
312
|
id: this.choiceId,
|
|
310
313
|
onChange: this.onToggleChoice,
|
|
311
314
|
onKeyDown: this.handleKeyDown,
|
|
312
|
-
|
|
315
|
+
...(screenReaderLabel ? {
|
|
316
|
+
'aria-describedby': this.descId
|
|
317
|
+
} : {})
|
|
313
318
|
};
|
|
314
|
-
const
|
|
315
|
-
const control = isSelectionButtonBelow ? /*#__PURE__*/_react.default.createElement(BelowSelectionComponent, null, hasMathOrImage && screenReaderLabel, /*#__PURE__*/_react.default.createElement(Tag, (0, _extends2.default)({}, tagProps, {
|
|
319
|
+
const control = isSelectionButtonBelow ? /*#__PURE__*/_react.default.createElement(BelowSelectionComponent, null, screenReaderLabel, /*#__PURE__*/_react.default.createElement(Tag, (0, _extends2.default)({}, tagProps, {
|
|
316
320
|
style: {
|
|
317
321
|
padding: 0
|
|
318
322
|
}
|
|
319
|
-
})),
|
|
323
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
324
|
+
"aria-hidden": "true"
|
|
325
|
+
}, displayKey ? `${displayKey}.` : '')) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, screenReaderLabel, /*#__PURE__*/_react.default.createElement(Tag, (0, _extends2.default)({}, tagProps, {
|
|
320
326
|
slotProps: {
|
|
321
327
|
input: {
|
|
322
328
|
ref: this.props.autoFocusRef
|
package/lib/choice-input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choice-input.js","names":["_FormControlLabel","_interopRequireDefault","require","_react","_propTypes","_styles","_Box","_Checkbox","_renderUi","_Radio","_classnames","_feedbackTick","CLASS_NAME","Row","styled","Box","display","alignItems","backgroundColor","color","background","CheckboxHolder","flex","marginLeft","text","fontSize","padding","BelowSelectionComponent","theme","spacing","SrOnly","position","left","top","width","height","overflow","StyledFormControlLabel","exports","FormControlLabel","letterSpacing","cursor","colorStyle","varName","fallback","getInputStyles","correctness","key","k","primaryLight","incorrect","correct","primary","disabled","opacity","pointerEvents","focusVisibleUnchecked","outline","focusUncheckedBorder","focusUnchecked","focusVisibleChecked","focusCheckedBorder","focusChecked","StyledCheckboxBase","Checkbox","shouldForwardProp","prop","styles","StyledCheckbox","props","checked","onChange","value","id","onKeyDown","inputRef","miniProps","default","createElement","_extends2","slotProps","input","ref","disableRipple","className","StyledRadioBase","Radio","StyledRadio","tagName","name","ChoiceInput","React","Component","constructor","_defineProperty2","event","choiceMode","isArrowDown","isArrowUp","preventDefault","currentEl","document","getElementById","choiceId","fieldset","closest","groupCheckboxes","Array","from","querySelectorAll","currentIndex","findIndex","el","nextIndex","nextEl","focus","onToggleChoice","bind","generateChoiceId","descId","Math","random","toFixed","render","displayKey","feedback","label","rationale","hideTick","isEvaluateMode","choicesLayout","isSelectionButtonBelow","Tag","classSuffix","holderSx","margin","justifyContent","choicelabel","Fragment","component","PreviewPrompt","prompt","screenReaderLabel","tagProps","handleKeyDown","hasMathOrImage","includes","control","style","autoFocusRef","classNames","sx","htmlFor","labelPlacement","undefined","defaultClassName","Feedback","PropTypes","oneOf","string","bool","isRequired","func","_default"],"sources":["../src/choice-input.jsx"],"sourcesContent":["import FormControlLabel from '@mui/material/FormControlLabel';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Checkbox from '@mui/material/Checkbox';\nimport { Feedback, color, PreviewPrompt } from '@pie-lib/render-ui';\nimport Radio from '@mui/material/Radio';\nimport classNames from 'classnames';\n\nimport FeedbackTick from './feedback-tick';\n\nconst CLASS_NAME = 'multiple-choice-component';\n\nconst Row = styled(Box)({\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n});\n\nconst CheckboxHolder = styled(Box)({\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n flex: 1,\n '& .MuiFormControlLabel-root': {\n marginLeft: '-14px', // to be consistent to previous versions before MUI v5 upgrade \n },\n '& label': {\n color: color.text(),\n '& > span': {\n fontSize: 'inherit',\n },\n '& > .MuiButtonBase-root': {\n padding: '12px', // to be consistent to previous versions before MUI v5 upgrade \n },\n },\n});\n\nconst BelowSelectionComponent = styled('span')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n '& > span': {\n // visually reduce right padding, but maintain accessibility padding for checkbox indicators to be circles\n marginLeft: `-${theme.spacing(1)}px`,\n },\n}));\n\nconst SrOnly = styled('span')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nexport const StyledFormControlLabel = styled(FormControlLabel)({\n '& .MuiFormControlLabel-label': {\n color: `${color.text()} !important`,\n backgroundColor: color.background(),\n letterSpacing: 'normal',\n },\n '&.Mui-disabled *': {\n cursor: 'not-allowed !important',\n },\n});\n\nconst colorStyle = (varName, fallback) => ({\n [`&.${CLASS_NAME}`]: {\n color: `var(--choice-input-${varName}, ${fallback}) !important`,\n },\n});\n\nconst getInputStyles = (correctness) => {\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n return {\n [key('root')]: {\n ...colorStyle('color', color.text()),\n ...(correctness ? {} : {\n '&:hover': { color: `${color.primaryLight()} !important` },\n }),\n ...(correctness === 'correct' ? colorStyle('correct-color', color.text()) : {}),\n ...(correctness === 'incorrect' ? colorStyle('incorrect-color', color.incorrect()) : {}),\n },\n [key('checked')]: {\n ...(correctness === 'correct' ? colorStyle('correct-selected-color', color.correct()) : {}),\n ...(correctness === 'incorrect' ? colorStyle('incorrect-checked', color.incorrect()) : {}),\n ...(!correctness ? colorStyle('selected-color', color.primary()) : {}),\n },\n [key('disabled')]: {\n ...colorStyle('disabled-color', color.text()),\n ...(correctness === 'correct' ? colorStyle('correct-disabled-color', color.disabled()) : {}),\n ...(correctness === 'incorrect' ? colorStyle('incorrect-disabled-color', color.disabled()) : {}),\n opacity: 0.6,\n cursor: 'not-allowed !important',\n pointerEvents: 'initial !important',\n },\n focusVisibleUnchecked: {\n outline: `2px solid ${color.focusUncheckedBorder()}`,\n backgroundColor: color.focusUnchecked(),\n },\n focusVisibleChecked: {\n outline: `2px solid ${color.focusCheckedBorder()}`,\n backgroundColor: color.focusChecked(),\n },\n };\n};\n\nconst StyledCheckboxBase = styled(Checkbox, {\n shouldForwardProp: (prop) => prop !== 'correctness',\n})(({ correctness }) => {\n const styles = getInputStyles(correctness);\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n return {\n [`&.${CLASS_NAME}`]: {\n ...styles[key('root')],\n '&.Mui-checked': styles[key('checked')],\n '&.Mui-disabled': correctness ? {} : styles[key('disabled')],\n },\n '&.Mui-focusVisible': {\n '&:not(.Mui-checked)': styles.focusVisibleUnchecked,\n '&.Mui-checked': styles.focusVisibleChecked,\n },\n };\n});\n\nexport const StyledCheckbox = (props) => {\n const { correctness, checked, onChange, disabled, value, id, onKeyDown, inputRef } = props;\n\n const miniProps = { checked, onChange, disabled, value };\n\n return (\n <StyledCheckboxBase\n id={id}\n slotProps={{ input: { ref: inputRef } }}\n onKeyDown={onKeyDown}\n disableRipple\n {...miniProps}\n correctness={correctness}\n className={CLASS_NAME}\n />\n );\n};\n\nconst StyledRadioBase = styled(Radio, {\n shouldForwardProp: (prop) => prop !== 'correctness',\n})(({ correctness }) => {\n const styles = getInputStyles(correctness);\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n return {\n [`&.${CLASS_NAME}`]: {\n ...styles[key('root')],\n '&.Mui-checked': styles[key('checked')],\n '&.Mui-disabled': correctness ? {} : styles[key('disabled')],\n },\n '&.Mui-focusVisible': {\n '&:not(.Mui-checked)': styles.focusVisibleUnchecked,\n '&.Mui-checked': styles.focusVisibleChecked,\n },\n };\n});\n\nexport const StyledRadio = (props) => {\n const { correctness, checked, onChange, disabled, value, id, tagName, inputRef } = props;\n\n const miniProps = { checked, onChange, disabled, value };\n\n return (\n <StyledRadioBase\n id={id}\n slotProps={{ input: { ref: inputRef } }}\n disableRipple\n {...miniProps}\n correctness={correctness}\n className={CLASS_NAME}\n name={tagName}\n />\n );\n};\n\nexport class ChoiceInput extends React.Component {\n static propTypes = {\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n displayKey: PropTypes.string,\n checked: PropTypes.bool.isRequired,\n correctness: PropTypes.string,\n disabled: PropTypes.bool.isRequired,\n feedback: PropTypes.string,\n label: PropTypes.string.isRequired,\n rationale: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n value: PropTypes.string.isRequired,\n className: PropTypes.string,\n tagName: PropTypes.string,\n hideTick: PropTypes.bool,\n isEvaluateMode: PropTypes.bool,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n isSelectionButtonBelow: PropTypes.bool,\n };\n\n static defaultProps = {\n rationale: null,\n checked: false,\n isEvaluateMode: false,\n };\n\n constructor(props) {\n super(props);\n this.onToggleChoice = this.onToggleChoice.bind(this);\n this.choiceId = this.generateChoiceId();\n this.descId = `${this.choiceId}-desc`;\n }\n\n onToggleChoice(event) {\n this.props.onChange(event);\n }\n\n generateChoiceId() {\n return 'choice-' + (Math.random() * 10000).toFixed();\n }\n\n handleKeyDown = (event) => {\n const { choiceMode } = this.props;\n\n if (choiceMode !== 'checkbox') return;\n\n const isArrowDown = event.key === 'ArrowDown';\n const isArrowUp = event.key === 'ArrowUp';\n\n if (!isArrowDown && !isArrowUp) return;\n\n event.preventDefault();\n\n const currentEl = document.getElementById(this.choiceId);\n if (!currentEl) return;\n\n const fieldset = currentEl.closest('fieldset');\n if (!fieldset) return;\n\n const groupCheckboxes = Array.from(fieldset.querySelectorAll('input[type=\"checkbox\"]'));\n\n const currentIndex = groupCheckboxes.findIndex((el) => el === currentEl);\n if (currentIndex === -1) return;\n\n const nextIndex = isArrowDown ? currentIndex + 1 : currentIndex - 1;\n const nextEl = groupCheckboxes[nextIndex];\n\n if (nextEl) {\n nextEl.focus();\n }\n };\n\n render() {\n const {\n choiceMode,\n disabled,\n displayKey,\n feedback,\n label,\n correctness,\n className,\n rationale,\n hideTick,\n isEvaluateMode,\n choicesLayout,\n value,\n checked,\n tagName,\n isSelectionButtonBelow,\n } = this.props;\n\n const Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;\n const classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';\n\n const holderSx = {\n ...(choicesLayout === 'horizontal' && {\n [`& .${CLASS_NAME}`]: {\n padding: '8px',\n margin: '4px 0 4px 4px',\n },\n }),\n ...(isSelectionButtonBelow && choicesLayout !== 'grid' && {\n '& > label': {\n alignItems: 'flex-start',\n },\n }),\n ...(isSelectionButtonBelow && choicesLayout === 'grid' && {\n justifyContent: 'center',\n '& > label': {\n alignItems: 'center',\n },\n }),\n };\n\n const choicelabel = (\n <>\n {displayKey && !isSelectionButtonBelow ? (\n <Row component=\"span\">\n {displayKey}.{'\\u00A0'}\n <PreviewPrompt className=\"prompt-label\" prompt={label} tagName=\"span\" />\n </Row>\n ) : (\n <PreviewPrompt className=\"prompt-label\" prompt={label} tagName=\"span\" />\n )}\n </>\n );\n\n const screenReaderLabel = (\n <SrOnly id={this.descId}>\n {choiceMode === 'checkbox' ? 'Checkbox to select the answer below' : 'Radio button to select the answer below'}\n </SrOnly>\n );\n\n const tagProps = {\n disabled,\n checked,\n correctness,\n tagName,\n value,\n id: this.choiceId,\n onChange: this.onToggleChoice,\n onKeyDown: this.handleKeyDown,\n 'aria-describedby': this.descId,\n };\n\n const hasMathOrImage =\n typeof label === 'string' &&\n (label.includes('<math') ||\n label.includes('\\\\(') ||\n label.includes('\\\\[') ||\n label.includes('<img') ||\n label.includes('data-latex') ||\n label.includes('data-raw') ||\n label.includes('<mjx-container'));\n\n const control = isSelectionButtonBelow ? (\n <BelowSelectionComponent>\n {hasMathOrImage && screenReaderLabel}\n <Tag {...tagProps} style={{ padding: 0 }} />\n {displayKey ? `${displayKey}.` : ''}\n </BelowSelectionComponent>\n ) : (\n <>\n {hasMathOrImage && screenReaderLabel}\n <Tag {...tagProps} slotProps={{ input: { ref: this.props.autoFocusRef } }} />\n </>\n );\n\n return (\n <div className={classNames(className, 'corespring-' + classSuffix, 'choice-input')}>\n <Row>\n {!hideTick && isEvaluateMode && <FeedbackTick correctness={correctness} />}\n <CheckboxHolder className=\"checkbox-holder\" sx={holderSx}>\n <StyledFormControlLabel\n label={choicelabel}\n value={value}\n htmlFor={this.choiceId}\n labelPlacement={isSelectionButtonBelow ? 'top' : undefined}\n control={control}\n />\n </CheckboxHolder>\n </Row>\n {rationale && <PreviewPrompt className=\"rationale\" defaultClassName=\"rationale\" prompt={rationale} />}\n <Feedback feedback={feedback} correctness={correctness} />\n </div>\n );\n }\n}\n\nexport default ChoiceInput;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AAEA,IAAAS,aAAA,GAAAV,sBAAA,CAAAC,OAAA;AAEA,MAAMU,U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AC3BxF,QAAQ,EAAEsF,kBAAS,CAACK,IAAI,CAACD,UAAU;EACnCzF,KAAK,EAAEqF,kBAAS,CAACE,MAAM,CAACE,UAAU;EAClC7E,SAAS,EAAEyE,kBAAS,CAACE,MAAM;EAC3BvE,OAAO,EAAEqE,kBAAS,CAACE,MAAM;EACzB/B,QAAQ,EAAE6B,kBAAS,CAACG,IAAI;EACxB/B,cAAc,EAAE4B,kBAAS,CAACG,IAAI;EAC9B9B,aAAa,EAAE2B,kBAAS,CAACC,KAAK,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;EAClE3B,sBAAsB,EAAE0B,kBAAS,CAACG;AACpC,CAAC;AAAA,IAAAlE,gBAAA,CAAAjB,OAAA,EAlBUa,WAAW,kBAoBA;EACpBqC,SAAS,EAAE,IAAI;EACfzD,OAAO,EAAE,KAAK;EACd2D,cAAc,EAAE;AAClB,CAAC;AAAA,IAAAkC,QAAA,GAAA7H,OAAA,CAAAuC,OAAA,GAqKYa,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"choice-input.js","names":["_FormControlLabel","_interopRequireDefault","require","_react","_propTypes","_styles","_Box","_Checkbox","_renderUi","_Radio","_classnames","_feedbackTick","CLASS_NAME","Row","styled","Box","display","alignItems","backgroundColor","color","background","CheckboxHolder","flex","marginLeft","text","fontSize","padding","BelowSelectionComponent","theme","spacing","SrOnly","position","left","top","width","height","overflow","StyledFormControlLabel","exports","FormControlLabel","letterSpacing","cursor","colorStyle","varName","fallback","getInputStyles","correctness","key","k","primaryLight","incorrect","correct","primary","disabled","opacity","pointerEvents","focusVisibleUnchecked","outline","focusUncheckedBorder","focusUnchecked","focusVisibleChecked","focusCheckedBorder","focusChecked","StyledCheckboxBase","Checkbox","shouldForwardProp","prop","styles","StyledCheckbox","props","checked","onChange","value","id","onKeyDown","inputRef","miniProps","default","createElement","_extends2","slotProps","input","ref","disableRipple","className","StyledRadioBase","Radio","StyledRadio","tagName","name","ChoiceInput","React","Component","constructor","_defineProperty2","event","choiceMode","isArrowDown","isArrowUp","preventDefault","currentEl","document","getElementById","choiceId","fieldset","closest","groupCheckboxes","Array","from","querySelectorAll","currentIndex","findIndex","el","nextIndex","nextEl","focus","onToggleChoice","bind","generateChoiceId","descId","Math","random","toFixed","render","displayKey","feedback","label","rationale","hideTick","isEvaluateMode","choicesLayout","isSelectionButtonBelow","Tag","classSuffix","holderSx","margin","justifyContent","hasMathOrImage","includes","screenReaderLabel","choicelabel","Fragment","component","PreviewPrompt","prompt","tagProps","handleKeyDown","control","style","autoFocusRef","classNames","sx","htmlFor","labelPlacement","undefined","defaultClassName","Feedback","PropTypes","oneOf","string","bool","isRequired","func","_default"],"sources":["../src/choice-input.jsx"],"sourcesContent":["import FormControlLabel from '@mui/material/FormControlLabel';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Checkbox from '@mui/material/Checkbox';\nimport { Feedback, color, PreviewPrompt } from '@pie-lib/render-ui';\nimport Radio from '@mui/material/Radio';\nimport classNames from 'classnames';\n\nimport FeedbackTick from './feedback-tick';\n\nconst CLASS_NAME = 'multiple-choice-component';\n\nconst Row = styled(Box)({\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n});\n\nconst CheckboxHolder = styled(Box)({\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n flex: 1,\n '& .MuiFormControlLabel-root': {\n marginLeft: '-14px', // to be consistent to previous versions before MUI v5 upgrade\n },\n '& label': {\n color: color.text(),\n '& > span': {\n fontSize: 'inherit',\n },\n '& > .MuiButtonBase-root': {\n padding: '12px', // to be consistent to previous versions before MUI v5 upgrade\n },\n },\n});\n\nconst BelowSelectionComponent = styled('span')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n '& > span': {\n // visually reduce right padding, but maintain accessibility padding for checkbox indicators to be circles\n marginLeft: `-${theme.spacing(1)}`,\n },\n}));\n\nconst SrOnly = styled('span')({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n});\n\nexport const StyledFormControlLabel = styled(FormControlLabel)({\n '& .MuiFormControlLabel-label': {\n color: `${color.text()} !important`,\n backgroundColor: color.background(),\n letterSpacing: 'normal',\n },\n '&.Mui-disabled *': {\n cursor: 'not-allowed !important',\n },\n});\n\nconst colorStyle = (varName, fallback) => ({\n [`&.${CLASS_NAME}`]: {\n color: `var(--choice-input-${varName}, ${fallback}) !important`,\n },\n});\n\nconst getInputStyles = (correctness) => {\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n return {\n [key('root')]: {\n ...colorStyle('color', color.text()),\n ...(correctness ? {} : {\n '&:hover': { color: `${color.primaryLight()} !important` },\n }),\n ...(correctness === 'correct' ? colorStyle('correct-color', color.text()) : {}),\n ...(correctness === 'incorrect' ? colorStyle('incorrect-color', color.incorrect()) : {}),\n },\n [key('checked')]: {\n ...(correctness === 'correct' ? colorStyle('correct-selected-color', color.correct()) : {}),\n ...(correctness === 'incorrect' ? colorStyle('incorrect-checked', color.incorrect()) : {}),\n ...(!correctness ? colorStyle('selected-color', color.primary()) : {}),\n },\n [key('disabled')]: {\n ...colorStyle('disabled-color', color.text()),\n ...(correctness === 'correct' ? colorStyle('correct-disabled-color', color.disabled()) : {}),\n ...(correctness === 'incorrect' ? colorStyle('incorrect-disabled-color', color.disabled()) : {}),\n opacity: 0.6,\n cursor: 'not-allowed !important',\n pointerEvents: 'initial !important',\n },\n focusVisibleUnchecked: {\n outline: `2px solid ${color.focusUncheckedBorder()}`,\n backgroundColor: color.focusUnchecked(),\n },\n focusVisibleChecked: {\n outline: `2px solid ${color.focusCheckedBorder()}`,\n backgroundColor: color.focusChecked(),\n },\n };\n};\n\nconst StyledCheckboxBase = styled(Checkbox, {\n shouldForwardProp: (prop) => prop !== 'correctness',\n})(({ correctness }) => {\n const styles = getInputStyles(correctness);\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n return {\n [`&.${CLASS_NAME}`]: {\n ...styles[key('root')],\n '&.Mui-checked': styles[key('checked')],\n '&.Mui-disabled': correctness ? {} : styles[key('disabled')],\n },\n '&.Mui-focusVisible': {\n '&:not(.Mui-checked)': styles.focusVisibleUnchecked,\n '&.Mui-checked': styles.focusVisibleChecked,\n },\n };\n});\n\nexport const StyledCheckbox = (props) => {\n const { correctness, checked, onChange, disabled, value, id, onKeyDown, inputRef } = props;\n\n const miniProps = { checked, onChange, disabled, value };\n\n return (\n <StyledCheckboxBase\n id={id}\n slotProps={{ input: { ref: inputRef } }}\n onKeyDown={onKeyDown}\n disableRipple\n {...miniProps}\n correctness={correctness}\n className={CLASS_NAME}\n />\n );\n};\n\nconst StyledRadioBase = styled(Radio, {\n shouldForwardProp: (prop) => prop !== 'correctness',\n})(({ correctness }) => {\n const styles = getInputStyles(correctness);\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n return {\n [`&.${CLASS_NAME}`]: {\n ...styles[key('root')],\n '&.Mui-checked': styles[key('checked')],\n '&.Mui-disabled': correctness ? {} : styles[key('disabled')],\n },\n '&.Mui-focusVisible': {\n '&:not(.Mui-checked)': styles.focusVisibleUnchecked,\n '&.Mui-checked': styles.focusVisibleChecked,\n },\n };\n});\n\nexport const StyledRadio = (props) => {\n const { correctness, checked, onChange, disabled, value, id, tagName, inputRef } = props;\n\n const miniProps = { checked, onChange, disabled, value };\n\n return (\n <StyledRadioBase\n id={id}\n slotProps={{ input: { ref: inputRef } }}\n disableRipple\n {...miniProps}\n correctness={correctness}\n className={CLASS_NAME}\n name={tagName}\n />\n );\n};\n\nexport class ChoiceInput extends React.Component {\n static propTypes = {\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n displayKey: PropTypes.string,\n checked: PropTypes.bool.isRequired,\n correctness: PropTypes.string,\n disabled: PropTypes.bool.isRequired,\n feedback: PropTypes.string,\n label: PropTypes.string.isRequired,\n rationale: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n value: PropTypes.string.isRequired,\n className: PropTypes.string,\n tagName: PropTypes.string,\n hideTick: PropTypes.bool,\n isEvaluateMode: PropTypes.bool,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n isSelectionButtonBelow: PropTypes.bool,\n };\n\n static defaultProps = {\n rationale: null,\n checked: false,\n isEvaluateMode: false,\n };\n\n constructor(props) {\n super(props);\n this.onToggleChoice = this.onToggleChoice.bind(this);\n this.choiceId = this.generateChoiceId();\n this.descId = `${this.choiceId}-desc`;\n }\n\n onToggleChoice(event) {\n this.props.onChange(event);\n }\n\n generateChoiceId() {\n return 'choice-' + (Math.random() * 10000).toFixed();\n }\n\n handleKeyDown = (event) => {\n const { choiceMode } = this.props;\n\n if (choiceMode !== 'checkbox') return;\n\n const isArrowDown = event.key === 'ArrowDown';\n const isArrowUp = event.key === 'ArrowUp';\n\n if (!isArrowDown && !isArrowUp) return;\n\n event.preventDefault();\n\n const currentEl = document.getElementById(this.choiceId);\n if (!currentEl) return;\n\n const fieldset = currentEl.closest('fieldset');\n if (!fieldset) return;\n\n const groupCheckboxes = Array.from(fieldset.querySelectorAll('input[type=\"checkbox\"]'));\n\n const currentIndex = groupCheckboxes.findIndex((el) => el === currentEl);\n if (currentIndex === -1) return;\n\n const nextIndex = isArrowDown ? currentIndex + 1 : currentIndex - 1;\n const nextEl = groupCheckboxes[nextIndex];\n\n if (nextEl) {\n nextEl.focus();\n }\n };\n\n render() {\n const {\n choiceMode,\n disabled,\n displayKey,\n feedback,\n label,\n correctness,\n className,\n rationale,\n hideTick,\n isEvaluateMode,\n choicesLayout,\n value,\n checked,\n tagName,\n isSelectionButtonBelow,\n } = this.props;\n\n const Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;\n const classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';\n\n const holderSx = {\n ...(choicesLayout === 'horizontal' && {\n [`& .${CLASS_NAME}`]: {\n padding: '8px',\n margin: '4px 0 4px 4px',\n },\n }),\n ...(isSelectionButtonBelow && choicesLayout !== 'grid' && {\n '& > label': {\n alignItems: 'flex-start',\n },\n }),\n ...(isSelectionButtonBelow && choicesLayout === 'grid' && {\n justifyContent: 'center',\n '& > label': {\n alignItems: 'center',\n },\n }),\n };\n\n const hasMathOrImage =\n typeof label === 'string' &&\n (label.includes('<math') ||\n label.includes('\\\\(') ||\n label.includes('\\\\[') ||\n label.includes('<img') ||\n label.includes('data-latex') ||\n label.includes('data-raw') ||\n label.includes('<mjx-container'));\n\n const screenReaderLabel = displayKey ? (\n <SrOnly id={this.descId}>\n {hasMathOrImage ? `Pick the answer below, ${displayKey}` : displayKey}\n </SrOnly>\n ) : null;\n\n const choicelabel = (\n <>\n {displayKey && !isSelectionButtonBelow ? (\n <Row component=\"span\">\n <span aria-hidden=\"true\">{displayKey}.{'\\u00A0'}</span>\n <PreviewPrompt className=\"prompt-label\" prompt={label} tagName=\"span\" />\n </Row>\n ) : (\n <PreviewPrompt className=\"prompt-label\" prompt={label} tagName=\"span\" />\n )}\n </>\n );\n\n const tagProps = {\n disabled,\n checked,\n correctness,\n tagName,\n value,\n id: this.choiceId,\n onChange: this.onToggleChoice,\n onKeyDown: this.handleKeyDown,\n ...(screenReaderLabel ? { 'aria-describedby': this.descId } : {}),\n };\n\n const control = isSelectionButtonBelow ? (\n <BelowSelectionComponent>\n {screenReaderLabel}\n <Tag {...tagProps} style={{ padding: 0 }} />\n <span aria-hidden=\"true\">{displayKey ? `${displayKey}.` : ''}</span>\n </BelowSelectionComponent>\n ) : (\n <>\n {screenReaderLabel}\n <Tag {...tagProps} slotProps={{ input: { ref: this.props.autoFocusRef } }} />\n </>\n );\n\n return (\n <div className={classNames(className, 'corespring-' + classSuffix, 'choice-input')}>\n <Row>\n {!hideTick && isEvaluateMode && <FeedbackTick correctness={correctness} />}\n <CheckboxHolder className=\"checkbox-holder\" sx={holderSx}>\n <StyledFormControlLabel\n label={choicelabel}\n value={value}\n htmlFor={this.choiceId}\n labelPlacement={isSelectionButtonBelow ? 'top' : undefined}\n control={control}\n />\n </CheckboxHolder>\n </Row>\n {rationale && <PreviewPrompt className=\"rationale\" defaultClassName=\"rationale\" prompt={rationale} />}\n <Feedback feedback={feedback} correctness={correctness} />\n </div>\n );\n }\n}\n\nexport default ChoiceInput;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AAEA,IAAAS,aAAA,GAAAV,sBAAA,CAAAC,OAAA;AAEA,MAAMU,UAAU,GAAG,2BAA2B;AAE9C,MAAMC,GAAG,GAAG,IAAAC,cAAM,EAACC,YAAG,CAAC,CAAC;EACtBC,OAAO,EAAE,MAAM;EACfC,UAAU,EAAE,QAAQ;EACpBC,eAAe,EAAEC,eAAK,CAACC,UAAU,CAAC;AACpC,CAAC,CAAC;AAEF,MAAMC,cAAc,GAAG,IAAAP,cAAM,EAACC,YAAG,CAAC,CAAC;EACjCC,OAAO,EAAE,MAAM;EACfC,UAAU,EAAE,QAAQ;EACpBC,eAAe,EAAEC,eAAK,CAACC,UAAU,CAAC,CAAC;EACnCE,IAAI,EAAE,CAAC;EACP,6BAA6B,EAAE;IAC7BC,UAAU,EAAE,OAAO,CAAE;EACvB,CAAC;EACD,SAAS,EAAE;IACTJ,KAAK,EAAEA,eAAK,CAACK,IAAI,CAAC,CAAC;IACnB,UAAU,EAAE;MACVC,QAAQ,EAAE;IACZ,CAAC;IACD,yBAAyB,EAAE;MAC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AAE0B,kBAAS,CAACG;AACpC,CAAC;AAAA,IAAAlE,gBAAA,CAAAjB,OAAA,EAlBUa,WAAW,kBAoBA;EACpBqC,SAAS,EAAE,IAAI;EACfzD,OAAO,EAAE,KAAK;EACd2D,cAAc,EAAE;AAClB,CAAC;AAAA,IAAAkC,QAAA,GAAA7H,OAAA,CAAAuC,OAAA,GAqKYa,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_dll_react_dom as e,_dll_react as t,_dll_prop_types as n,_dll_mui__material_styles as o,_dll_pie_lib__render_ui as i,_dll_mui__material as r,_dll_mui__icons_material as a,_dll_debug as s}from"../../../@pie-lib/shared-module@^4.1.0/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^3.1.0/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as c}from"../../../@pie-lib/editable-html-module@^6.2.0/module/index.js";var u,d=e;u=d.createRoot,d.hydrateRoot;var h={};Object.defineProperty(h,"__esModule",{value:!0});class p extends CustomEvent{constructor(e,t=!1){super(p.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}p.TYPE="model.updated";var g=h.ModelUpdatedEvent=p;class f extends CustomEvent{constructor(e,t){super(f.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}f.TYPE="delete.image";var b=h.DeleteImageEvent=f;class m extends CustomEvent{constructor(e){super(m.TYPE,{bubbles:!0,detail:e}),this.handler=e}}m.TYPE="insert.image";var _=h.InsertImageEvent=m;class y extends CustomEvent{constructor(e,t){super(y.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}y.TYPE="delete.sound";var C=h.DeleteSoundEvent=y;class v extends CustomEvent{constructor(e){super(v.TYPE,{bubbles:!0,detail:e}),this.handler=e}}v.TYPE="insert.sound";var E=h.InsertSoundEvent=v,j="object"==typeof global&&global&&global.Object===Object&&global,A="object"==typeof self&&self&&self.Object===Object&&self,S=j||A||Function("return this")(),x=S.Symbol,w=Object.prototype,O=w.hasOwnProperty,P=w.toString,I=x?x.toStringTag:void 0,k=Object.prototype.toString,M=x?x.toStringTag:void 0;function T(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":M&&M in Object(e)?function(e){var t=O.call(e,I),n=e[I];try{e[I]=void 0;var o=!0}catch(e){}var i=P.call(e);return o&&(t?e[I]=n:delete e[I]),i}(e):function(e){return k.call(e)}(e)}function R(e){return null!=e&&"object"==typeof e}var z=Array.isArray;function L(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function D(e){return e}function q(e){if(!L(e))return!1;var t=T(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var F,U=S["__core-js_shared__"],$=(F=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||""))?"Symbol(src)_1."+F:"",B=Function.prototype.toString,W=/^\[object .+?Constructor\]$/,Y=Function.prototype,H=Object.prototype,N=Y.toString,G=H.hasOwnProperty,V=RegExp("^"+N.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function J(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!L(e)||(t=e,$&&$ in t))&&(q(e)?V:W).test(function(e){if(null!=e){try{return B.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}(n)?n:void 0}var K,Q,X,Z=Object.create,ee=function(){function e(){}return function(t){if(!L(t))return{};if(Z)return Z(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),te=Date.now,ne=function(){try{var e=J(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),oe=ne,ie=oe?function(e,t){return oe(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:D,re=(K=ie,Q=0,X=0,function(){var e=te(),t=16-(e-X);if(X=e,t>0){if(++Q>=800)return arguments[0]}else Q=0;return K.apply(void 0,arguments)}),ae=/^(?:0|[1-9]\d*)$/;function se(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ae.test(e))&&e>-1&&e%1==0&&e<t}function le(e,t,n){"__proto__"==t&&oe?oe(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ce(e,t){return e===t||e!=e&&t!=t}var ue=Object.prototype.hasOwnProperty;function de(e,t,n){var o=e[t];ue.call(e,t)&&ce(o,n)&&(void 0!==n||t in e)||le(e,t,n)}var he=Math.max;function pe(e,t){return re(function(e,t,n){return t=he(void 0===t?e.length-1:t,0),function(){for(var o=arguments,i=-1,r=he(o.length-t,0),a=Array(r);++i<r;)a[i]=o[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=o[i];return s[t]=n(a),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,D),e+"")}function ge(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function fe(e){return null!=e&&ge(e.length)&&!q(e)}function be(e,t,n){if(!L(n))return!1;var o=typeof t;return!!("number"==o?fe(n)&&se(t,n.length):"string"==o&&t in n)&&ce(n[t],e)}var me=Object.prototype;function _e(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||me)}function ye(e){return R(e)&&"[object Arguments]"==T(e)}var Ce=Object.prototype,ve=Ce.hasOwnProperty,Ee=Ce.propertyIsEnumerable,je=ye(function(){return arguments}())?ye:function(e){return R(e)&&ve.call(e,"callee")&&!Ee.call(e,"callee")},Ae="object"==typeof exports&&exports&&!exports.nodeType&&exports,Se=Ae&&"object"==typeof module&&module&&!module.nodeType&&module,xe=Se&&Se.exports===Ae?S.Buffer:void 0,we=(xe?xe.isBuffer:void 0)||function(){return!1},Oe={};Oe["[object Float32Array]"]=Oe["[object Float64Array]"]=Oe["[object Int8Array]"]=Oe["[object Int16Array]"]=Oe["[object Int32Array]"]=Oe["[object Uint8Array]"]=Oe["[object Uint8ClampedArray]"]=Oe["[object Uint16Array]"]=Oe["[object Uint32Array]"]=!0,Oe["[object Arguments]"]=Oe["[object Array]"]=Oe["[object ArrayBuffer]"]=Oe["[object Boolean]"]=Oe["[object DataView]"]=Oe["[object Date]"]=Oe["[object Error]"]=Oe["[object Function]"]=Oe["[object Map]"]=Oe["[object Number]"]=Oe["[object Object]"]=Oe["[object RegExp]"]=Oe["[object Set]"]=Oe["[object String]"]=Oe["[object WeakMap]"]=!1;var Pe="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ie=Pe&&"object"==typeof module&&module&&!module.nodeType&&module,ke=Ie&&Ie.exports===Pe&&j.process,Me=function(){try{return Ie&&Ie.require&&Ie.require("util").types||ke&&ke.binding&&ke.binding("util")}catch(e){}}(),Te=Me&&Me.isTypedArray,Re=Te?function(e){return function(t){return e(t)}}(Te):function(e){return R(e)&&ge(e.length)&&!!Oe[T(e)]},ze=Re,Le=Object.prototype.hasOwnProperty;var De=Object.prototype.hasOwnProperty;function qe(e){return fe(e)?function(e,t){var n=z(e),o=!n&&je(e),i=!n&&!o&&we(e),r=!n&&!o&&!i&&ze(e),a=n||o||i||r,s=a?function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}(e.length,String):[],l=s.length;for(var c in e)!t&&!Le.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||se(c,l))||s.push(c);return s}(e,!0):function(e){if(!L(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=_e(e),n=[];for(var o in e)("constructor"!=o||!t&&De.call(e,o))&&n.push(o);return n}(e)}var Fe=J(Object,"create"),Ue=Object.prototype.hasOwnProperty,$e=Object.prototype.hasOwnProperty;function Be(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function We(e,t){for(var n=e.length;n--;)if(ce(e[n][0],t))return n;return-1}Be.prototype.clear=function(){this.__data__=Fe?Fe(null):{},this.size=0},Be.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Be.prototype.get=function(e){var t=this.__data__;if(Fe){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Ue.call(t,e)?t[e]:void 0},Be.prototype.has=function(e){var t=this.__data__;return Fe?void 0!==t[e]:$e.call(t,e)},Be.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Fe&&void 0===t?"__lodash_hash_undefined__":t,this};var Ye=Array.prototype.splice;function He(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}He.prototype.clear=function(){this.__data__=[],this.size=0},He.prototype.delete=function(e){var t=this.__data__,n=We(t,e);return!(n<0||(n==t.length-1?t.pop():Ye.call(t,n,1),--this.size,0))},He.prototype.get=function(e){var t=this.__data__,n=We(t,e);return n<0?void 0:t[n][1]},He.prototype.has=function(e){return We(this.__data__,e)>-1},He.prototype.set=function(e,t){var n=this.__data__,o=We(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};var Ne=J(S,"Map");function Ge(e,t){var n,o,i=e.__data__;return("string"==(o=typeof(n=t))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Ve(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Ve.prototype.clear=function(){this.size=0,this.__data__={hash:new Be,map:new(Ne||He),string:new Be}},Ve.prototype.delete=function(e){var t=Ge(this,e).delete(e);return this.size-=t?1:0,t},Ve.prototype.get=function(e){return Ge(this,e).get(e)},Ve.prototype.has=function(e){return Ge(this,e).has(e)},Ve.prototype.set=function(e,t){var n=Ge(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this};var Je=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object),Ke=Je,Qe=Function.prototype,Xe=Object.prototype,Ze=Qe.toString,et=Xe.hasOwnProperty,tt=Ze.call(Object);function nt(e){var t=this.__data__=new He(e);this.size=t.size}nt.prototype.clear=function(){this.__data__=new He,this.size=0},nt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},nt.prototype.get=function(e){return this.__data__.get(e)},nt.prototype.has=function(e){return this.__data__.has(e)},nt.prototype.set=function(e,t){var n=this.__data__;if(n instanceof He){var o=n.__data__;if(!Ne||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ve(o)}return n.set(e,t),this.size=n.size,this};var ot="object"==typeof exports&&exports&&!exports.nodeType&&exports,it=ot&&"object"==typeof module&&module&&!module.nodeType&&module,rt=it&&it.exports===ot?S.Buffer:void 0,at=(rt&&rt.allocUnsafe,S.Uint8Array);var st=Object.prototype,lt=st.hasOwnProperty,ct=pe(function(e,t){e=Object(e);var n=-1,o=t.length,i=o>2?t[2]:void 0;for(i&&be(t[0],t[1],i)&&(o=1);++n<o;)for(var r=t[n],a=qe(r),s=-1,l=a.length;++s<l;){var c=a[s],u=e[c];(void 0===u||ce(u,st[c])&&!lt.call(e,c))&&(e[c]=r[c])}return e});function ut(e,t,n){(void 0!==n&&!ce(e[t],n)||void 0===n&&!(t in e))&&le(e,t,n)}function dt(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ht(e,t,n,o,i,r,a){var s=dt(e,n),l=dt(t,n),c=a.get(l);if(c)ut(e,n,c);else{var u,d=r?r(s,l,n+"",e,t,a):void 0,h=void 0===d;if(h){var p=z(l),g=!p&&we(l),f=!p&&!g&&ze(l);d=l,p||g||f?z(s)?d=s:R(u=s)&&fe(u)?d=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n<o;)t[n]=e[n];return t}(s):g?(h=!1,d=function(e){return e.slice()}(l)):f?(h=!1,d=function(e,t){var n,o,i=t?(o=new(n=e.buffer).constructor(n.byteLength),new at(o).set(new at(n)),o):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(l,!0)):d=[]:function(e){if(!R(e)||"[object Object]"!=T(e))return!1;var t=Ke(e);if(null===t)return!0;var n=et.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ze.call(n)==tt}(l)||je(l)?(d=s,je(s)?d=function(e){return function(e,t,n){var o=!n;n||(n={});for(var i=-1,r=t.length;++i<r;){var a=t[i],s=void 0;void 0===s&&(s=e[a]),o?le(n,a,s):de(n,a,s)}return n}(e,qe(e))}(s):L(s)&&!q(s)||(d=function(e){return"function"!=typeof e.constructor||_e(e)?{}:ee(Ke(e))}(l))):h=!1}h&&(a.set(l,d),i(d,l,o,r,a),a.delete(l)),ut(e,n,d)}}function pt(e,t,n,o,i){e!==t&&function(e,t,n){for(var o=-1,i=Object(e),r=n(e),a=r.length;a--;){var s=r[++o];if(!1===t(i[s],s,i))break}}(t,function(r,a){if(i||(i=new nt),L(r))ht(e,t,a,n,pt,o,i);else{var s=o?o(dt(e,a),r,a+"",e,t,i):void 0;void 0===s&&(s=r),ut(e,a,s)}},qe)}var gt,ft=(gt=function(e,t,n){pt(e,t,n)},pe(function(e,t){var n=-1,o=t.length,i=o>1?t[o-1]:void 0,r=o>2?t[2]:void 0;for(i=gt.length>3&&"function"==typeof i?(o--,i):void 0,r&&be(t[0],t[1],r)&&(i=o<3?void 0:i,o=1),e=Object(e);++n<o;){var a=t[n];a&>(e,a,n)}return e}));const bt=t,mt=n,{styled:_t}=o,{color:yt}=i,{Button:Ct}=r,{Tooltip:vt}=r,{Typography:Et}=r,{Box:jt}=r,{Info:At}=a,St=c,{AlertDialog:xt}=l,{InputContainer:wt}=l,{ChoiceConfiguration:Ot}=l,{settings:Pt}=l,{layout:It}=l,{choiceUtils:kt}=l;function Mt(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const{Panel:Tt,toggle:Rt,radio:zt,dropdown:Lt}=Pt,Dt=_t(wt)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),qt=_t(wt)(({theme:e})=>({flex:1,marginTop:e.spacing(1.5),paddingTop:e.spacing(2),marginLeft:e.spacing(3.5)})),Ft=_t(wt)(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.spacing(1),width:"100%"})),Ut=_t(Ct)(({theme:e})=>({marginTop:e.spacing(1),float:"right"})),$t=_t(Ut)({cursor:"not-allowed",pointerEvents:"all",backgroundColor:yt.disabled(),"&:hover":{backgroundColor:yt.disabled()},"&:focus":{backgroundColor:yt.disabled()}}),Bt=_t(jt)({display:"flex",alignItems:"center"}),Wt=_t(Et)(({theme:e})=>({fontSize:e.typography.fontSize+2,marginRight:e.spacing(1)})),Yt=_t(vt)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})),Ht=_t("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)})),Nt=e=>{const{model:t,configuration:n,onPromptChanged:o,onChoiceChanged:i,onRemoveChoice:r,onAddChoice:a,imageSupport:s,uploadSoundSupport:l,onChangeModel:c,onConfigurationChanged:u,onTeacherInstructionsChanged:d}=e,{addChoiceButton:h={},contentDimensions:p={},feedback:g={},deleteChoice:f={},choiceMode:b={},choicePrefix:m={},partialScoring:_={},lockChoiceOrder:y={},teacherInstructions:C={},studentInstructions:v={},rationale:E={},scoringType:j={},sequentialChoiceLabels:A={},settingsPanelDisabled:S,choicesLayout:x,spellCheck:w={},gridColumns:O,maxImageWidth:P={},maxImageHeight:I={},prompt:k={},withRubric:M={},mathMlOptions:T={},language:R={},languageChoices:z={}}=n||{};let{maxAnswerChoices:L}=n||{};const{limitChoicesNumber:D,teacherInstructionsEnabled:q,rationaleEnabled:F,feedbackEnabled:U,promptEnabled:$,spellCheckEnabled:B,choices:W,errors:Y,toolbarEditorPosition:H,extraCSSRules:N}=t||{},{answerChoices:G,choices:V,correctResponse:J,prompt:K,rationale:Q,teacherInstructions:X}=Y||{},Z=Mt([W,"optionalAccess",e=>e.length])?Array.from({length:W.length},(e,t)=>`${t+1}`):[],{baseInputConfiguration:ee={}}=n,te={position:"top"===H?"top":"bottom"};D&&(L=9);const ne=(e={})=>({...ee,...e}),oe=(e=>{const{minAnswerChoices:t,maxAnswerChoices:n}=e;return`Validation requirements:\nThere should be at least ${t} `+(n?`and at most ${n} `:"")+"answer choices defined.\nEvery answer choice should be non-blank and unique.\nA correct answer must be defined."})(n),ie=P&&P.prompt,re=I&&I.prompt,ae=L&&Mt([W,"optionalAccess",e=>e.length])>=L?`Only ${L} allowed maximum`:"",se={choiceMode:b.settings&&zt(b.label,["checkbox","radio"]),"sequentialChoiceLabels.enabled":A.settings&&Rt(A.label,!0),choicePrefix:m.settings&&zt(m.label,["numbers","letters"]),partialScoring:_.settings&&Rt(_.label),lockChoiceOrder:y.settings&&Rt(y.label),feedbackEnabled:g.settings&&Rt(g.label),choicesLayout:x.settings&&Lt(x.label,["vertical","grid","horizontal"]),gridColumns:x.settings&&"grid"===t.choicesLayout&&Z.length>0&&Lt(O.label,Z),"language.enabled":R.settings&&Rt(R.label,!0),language:R.settings&&R.enabled&&Lt(z.label,z.options)},le={teacherInstructionsEnabled:C.settings&&Rt(C.label),studentInstructionsEnabled:v.settings&&Rt(v.label),promptEnabled:k.settings&&Rt(k.label),rationaleEnabled:E.settings&&Rt(E.label),spellCheckEnabled:w.settings&&Rt(w.label),scoringType:j.settings&&zt(j.label,["auto","rubric"]),rubricEnabled:Mt([M,"optionalAccess",e=>e.settings])&&Rt(Mt([M,"optionalAccess",e=>e.label]))};return bt.createElement(It.ConfigLayout,{dimensions:p,hideSettings:S,extraCSSRules:N,classes:{},settings:bt.createElement(Tt,{model:t,onChangeModel:c,configuration:n,onChangeConfiguration:u,groups:{Settings:se,Properties:le}})},q&&bt.createElement(Dt,{label:C.label},bt.createElement(St,{markup:t.teacherInstructions||"",onChange:d,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:X,toolbarOpts:te,pluginProps:ne(Mt([n,"optionalAccess",e=>e.teacherInstructions,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.teacherInstructions||ie,maxImageHeight:I&&I.teacherInstructions||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),X&&bt.createElement(Ht,null,X)),$&&bt.createElement(Dt,{label:k.label},bt.createElement(St,{markup:t.prompt,onChange:o,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:te,pluginProps:ne(Mt([n,"optionalAccess",e=>e.prompt,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.prompt,maxImageHeight:I&&I.prompt,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),K&&bt.createElement(Ht,null,K)),bt.createElement(Bt,null,bt.createElement(Wt,{component:"div"},"Choices"),bt.createElement(Yt,{disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:oe},bt.createElement(At,{fontSize:"small",color:"primary"}))),W.map((e,o)=>bt.createElement(Ft,{key:`choice-${o}`},bt.createElement(Ot,{key:o,index:o+1,useLetterOrdering:"letters"===t.choicePrefix,mode:t.choiceMode,data:e,defaultFeedback:{},imageSupport:s,disableImageAlignmentButtons:!0,onDelete:()=>r(o),onChange:e=>i(o,e),allowFeedBack:U,allowDelete:f.settings,noLabels:!0,pluginOpts:ne(Mt([n,"optionalAccess",e=>e.choices,"optionalAccess",e=>e.inputConfiguration])),toolbarOpts:te,spellCheck:B,error:Mt([V,"optionalAccess",t=>t[e.value]])||null,noCorrectAnswerError:J,maxImageWidth:P&&P.choices||ie,maxImageHeight:I&&I.choices||re,uploadSoundSupport:l,mathMlOptions:T}),F&&bt.createElement(qt,{key:`rationale-${o}`,label:E.label},bt.createElement(St,{markup:e.rationale||"",onChange:t=>i(o,{...e,rationale:t}),imageSupport:s,error:Mt([Q,"optionalAccess",t=>t[e.value]])||null,toolbarOpts:te,pluginProps:ne(Mt([n,"optionalAccess",e=>e.rationale,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.rationale||ie,maxImageHeight:I&&I.rationale||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),Mt([Q,"optionalAccess",t=>t[e.value]])&&bt.createElement(Ht,null,Mt([Q,"optionalAccess",t=>t[e.value]]))))),J&&bt.createElement(Ht,null,J),G&&bt.createElement(Ht,null,G),h.settings&&bt.createElement(Yt,{title:ae},L&&Mt([W,"optionalAccess",e=>e.length])>=L?bt.createElement($t,{variant:"contained",color:"primary",onClick:a,disabled:!0},h.label):bt.createElement(Ut,{variant:"contained",color:"primary",onClick:a},h.label)))};class Gt extends bt.Component{constructor(...e){super(...e),Gt.prototype.__init.call(this),Gt.prototype.__init2.call(this),Gt.prototype.__init3.call(this),Gt.prototype.__init4.call(this),Gt.prototype.__init5.call(this),Gt.prototype.__init6.call(this),Gt.prototype.__init7.call(this)}static __initStatic(){this.propTypes={model:mt.object.isRequired,configuration:mt.object.isRequired,disableSidePanel:mt.bool,onModelChanged:mt.func.isRequired,onConfigurationChanged:mt.func.isRequired,imageSupport:mt.shape({add:mt.func.isRequired,delete:mt.func.isRequired})}}__init(){this.state={showWarning:!1}}__init2(){this.onRemoveChoice=e=>{const{model:t,configuration:n,onModelChanged:o}=this.props,{minAnswerChoices:i}=n||{};i&&t.choices.length===i?this.setState({showWarning:!0}):(t.choices.splice(e,1),o(t))}}__init3(){this.onAddChoice=()=>{const{model:e,configuration:t,onModelChanged:n}=this.props;let{maxAnswerChoices:o}=t||{};const{limitChoicesNumber:i}=e||{};i&&(o=9),o&&e.choices.length>=o||(e.choices.push({label:"",value:kt.firstAvailableIndex(e.choices.map(e=>e.value),0),feedback:{type:"none"}}),n(e))}}__init4(){this.onChoiceChanged=(e,t)=>{const{model:n,onModelChanged:o}=this.props;t.correct&&"radio"===n.choiceMode&&(n.choices=n.choices.map(e=>ft({},e,{correct:!1}))),n.choices.splice(e,1,t),o(n)}}__init5(){this.onPromptChanged=e=>{this.props.onModelChanged({...this.props.model,prompt:e})}}__init6(){this.onTeacherInstructionsChanged=e=>{this.props.onModelChanged({...this.props.model,teacherInstructions:e})}}__init7(){this.onModelChanged=(e,t)=>{const{onModelChanged:n}=this.props;if("choiceMode"===t){if("radio"===e.choiceMode){let t=!1;e.choices=e.choices.map(e=>t?(e.correct=!1,e):(e.correct&&(t=!0),e))}n(e,!0)}else n(e)}}render(){const{configuration:{minAnswerChoices:e}={}}=this.props,{showWarning:t}=this.state;return bt.createElement(bt.Fragment,null,bt.createElement(xt,{open:t,title:"Warning",text:`There can't be less than ${e||0} choices.`,onConfirm:()=>this.setState({showWarning:!1})}),bt.createElement(Nt,{...this.props,onChangeModel:this.onModelChanged,onRemoveChoice:this.onRemoveChoice,onChoiceChanged:this.onChoiceChanged,onAddChoice:this.onAddChoice,onPromptChanged:this.onPromptChanged,onTeacherInstructionsChanged:this.onTeacherInstructionsChanged}))}}Gt.__initStatic();var Vt={choiceMode:"checkbox",choicePrefix:"letters",choices:[],choicesLayout:"vertical",feedbackEnabled:!1,gridColumns:2,lockChoiceOrder:!0,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",selectedAnswerBackgroundColor:"initial",keyboardEventsEnabled:!1},Jt={baseInputConfiguration:{h3:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},choices:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},choicesLayout:{settings:!1,label:"Choices Layout"},gridColumns:{label:"Grid columns"},answerChoiceCount:0,addChoiceButton:{settings:!0,label:"Add a Choice"},choiceMode:{settings:!0,label:"Response Type"},choicePrefix:{settings:!0,label:"Choice Labels"},deleteChoice:{settings:!0},feedback:{settings:!0,label:"Feedback"},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},lockChoiceOrder:{settings:!0,label:"Lock Choice Order"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!1}},required:!1},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},toolbarEditorPosition:{settings:!1,label:"Toolbar Editor Position"},minAnswerChoices:2,maxAnswerChoices:5,maxImageWidth:{teacherInstructions:300,prompt:300,rationale:636,choices:900},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300,choices:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const Kt=t,Qt=s,{choiceUtils:Xt}=l;function Zt(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const en=Qt("multiple-choice:configure"),tn=(e,t=0)=>{if(!e||0===e.length){let e=[];for(let n=0;n<t;n++)e.push({value:`${n}`,label:"",feedback:{type:"none",value:""}});return e}return e},nn=(e,t)=>{const n=ct(e,Jt);return{configuration:n,model:{...t,choices:tn(t&&t.choices||[],n&&n.answerChoiceCount)}}};class on extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>{const t=Xt.normalizeChoices({...Vt,...e,choices:tn(e&&e.choices||[])});return t.choicesLayout=e.choicesLayout||!1===e.verticalMode&&"horizontal"||Vt.choicesLayout,t}}constructor(){super(),this._root=null,this._reactContainer=null,this._model=on.createDefaultModel(),this._configuration=Jt,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=on.createDefaultModel(e),this._render()}set configuration(e){const t=nn(e,this._model);this.onModelChanged(t.model);const n={...Jt,...t.configuration};this._configuration=n,Zt([n,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Zt([n,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Zt([n,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):n.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find(e=>e.value===this._model.language)||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}set disableSidePanel(e){this._disableSidePanel=e,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new g(this._model,t))}onModelChanged(e,t){this._model=e,this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=nn(e,this._model).configuration,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new _(e))}onDeleteImage(e,t){this.dispatchEvent(new b(e,t))}insertSound(e){this.dispatchEvent(new E(e))}onDeleteSound(e,t){this.dispatchEvent(new C(e,t))}_render(){en("_render - Starting render"),en("_render - Model:",this._model?"present":"missing"),en("_render - Configuration:",this._configuration?"present":"missing"),en("_render - Root exists:",!!this._root);try{let e=Kt.createElement(Gt,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,disableSidePanel:this._disableSidePanel,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(en("_render - Creating React container"),this._reactContainer=document.createElement("div"),this._reactContainer.className="pie-configure-wrapper",this.appendChild(this._reactContainer),en("_render - Creating new React root"),this._root=u(this._reactContainer),en("_render - React root created successfully")),en("_render - Calling root.render()"),this._root.render(e),en("_render - Render completed successfully")}catch(e){throw console.error("❌ [multiple-choice-configure] Render error:",e),console.error("Error stack:",e.stack),e}}connectedCallback(){en("connectedCallback - Component connected to DOM"),en("connectedCallback - Model:",this._model?"present":"missing"),en("connectedCallback - Configuration:",this._configuration?"present":"missing")}disconnectedCallback(){en("disconnectedCallback - Component disconnected from DOM"),this._root&&(en("disconnectedCallback - Unmounting React root"),this._root.unmount(),this._root=null),this._reactContainer&&(this._reactContainer=null)}}on.__initStatic();export{on as default};
|