@pie-element/inline-dropdown 3.8.3-next.133 → 3.8.3-next.1335

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.
@@ -83,6 +83,38 @@
83
83
  }
84
84
  }
85
85
  },
86
+ "spellCheck": {
87
+ "title": "ConfigureProp",
88
+ "type": "object",
89
+ "properties": {
90
+ "settings": {
91
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
92
+ "type": "boolean",
93
+ "title": "settings"
94
+ },
95
+ "label": {
96
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
97
+ "type": "string",
98
+ "title": "label"
99
+ }
100
+ }
101
+ },
102
+ "choiceRationale": {
103
+ "title": "ConfigureProp",
104
+ "type": "object",
105
+ "properties": {
106
+ "settings": {
107
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
108
+ "type": "boolean",
109
+ "title": "settings"
110
+ },
111
+ "label": {
112
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
113
+ "type": "string",
114
+ "title": "label"
115
+ }
116
+ }
117
+ },
86
118
  "scoringType": {
87
119
  "title": "ConfigureProp",
88
120
  "type": "object",
@@ -131,6 +163,74 @@
131
163
  }
132
164
  }
133
165
  },
166
+ "maxResponseAreas": {
167
+ "description": "Maximum number of response areas",
168
+ "type": "number",
169
+ "title": "maxResponseAreas"
170
+ },
171
+ "maxResponseAreaChoices": {
172
+ "description": "Maximum number of choices per response area",
173
+ "type": "number",
174
+ "title": "maxResponseAreaChoices"
175
+ },
176
+ "maxImageWidth": {
177
+ "title": "ConfigureMaxImageDimensionsProp",
178
+ "type": "object",
179
+ "properties": {
180
+ "teacherInstructions": {
181
+ "description": "Indicates the max dimension for images in teacher instructions",
182
+ "type": "number",
183
+ "title": "teacherInstructions"
184
+ },
185
+ "prompt": {
186
+ "description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
187
+ "type": "number",
188
+ "title": "prompt"
189
+ },
190
+ "rationale": {
191
+ "description": "Indicates the max dimension for images in rationale",
192
+ "type": "number",
193
+ "title": "rationale"
194
+ }
195
+ }
196
+ },
197
+ "maxImageHeight": {
198
+ "title": "ConfigureMaxImageDimensionsProp",
199
+ "type": "object",
200
+ "properties": {
201
+ "teacherInstructions": {
202
+ "description": "Indicates the max dimension for images in teacher instructions",
203
+ "type": "number",
204
+ "title": "teacherInstructions"
205
+ },
206
+ "prompt": {
207
+ "description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
208
+ "type": "number",
209
+ "title": "prompt"
210
+ },
211
+ "rationale": {
212
+ "description": "Indicates the max dimension for images in rationale",
213
+ "type": "number",
214
+ "title": "rationale"
215
+ }
216
+ }
217
+ },
218
+ "withRubric": {
219
+ "title": "ConfigureProp",
220
+ "type": "object",
221
+ "properties": {
222
+ "settings": {
223
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
224
+ "type": "boolean",
225
+ "title": "settings"
226
+ },
227
+ "label": {
228
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
229
+ "type": "string",
230
+ "title": "label"
231
+ }
232
+ }
233
+ },
134
234
  "showPrompt": {
135
235
  "description": "Determines whether prompt field will be displayed or not",
136
236
  "default": true,
@@ -166,6 +266,27 @@
166
266
  "title": "label"
167
267
  }
168
268
  }
269
+ },
270
+ "ConfigureMaxImageDimensionsProp": {
271
+ "title": "ConfigureMaxImageDimensionsProp",
272
+ "type": "object",
273
+ "properties": {
274
+ "teacherInstructions": {
275
+ "description": "Indicates the max dimension for images in teacher instructions",
276
+ "type": "number",
277
+ "title": "teacherInstructions"
278
+ },
279
+ "prompt": {
280
+ "description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
281
+ "type": "number",
282
+ "title": "prompt"
283
+ },
284
+ "rationale": {
285
+ "description": "Indicates the max dimension for images in rationale",
286
+ "type": "number",
287
+ "title": "rationale"
288
+ }
289
+ }
169
290
  }
170
291
  },
171
292
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -62,6 +62,30 @@ Indicates if the item has to be displayed in the Settings Panel
62
62
 
63
63
  Indicates the label for the item that has to be displayed in the Settings Panel
64
64
 
65
+ # `spellCheck` (object)
66
+
67
+ Properties of the `spellCheck` object:
68
+
69
+ ## `settings` (boolean)
70
+
71
+ Indicates if the item has to be displayed in the Settings Panel
72
+
73
+ ## `label` (string)
74
+
75
+ Indicates the label for the item that has to be displayed in the Settings Panel
76
+
77
+ # `choiceRationale` (object)
78
+
79
+ Properties of the `choiceRationale` object:
80
+
81
+ ## `settings` (boolean)
82
+
83
+ Indicates if the item has to be displayed in the Settings Panel
84
+
85
+ ## `label` (string)
86
+
87
+ Indicates the label for the item that has to be displayed in the Settings Panel
88
+
65
89
  # `scoringType` (object)
66
90
 
67
91
  Properties of the `scoringType` object:
@@ -98,6 +122,58 @@ Indicates if the item has to be displayed in the Settings Panel
98
122
 
99
123
  Indicates the label for the item that has to be displayed in the Settings Panel
100
124
 
125
+ # `maxResponseAreas` (number)
126
+
127
+ Maximum number of response areas
128
+
129
+ # `maxResponseAreaChoices` (number)
130
+
131
+ Maximum number of choices per response area
132
+
133
+ # `maxImageWidth` (object)
134
+
135
+ Properties of the `maxImageWidth` object:
136
+
137
+ ## `teacherInstructions` (number)
138
+
139
+ Indicates the max dimension for images in teacher instructions
140
+
141
+ ## `prompt` (number)
142
+
143
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
144
+
145
+ ## `rationale` (number)
146
+
147
+ Indicates the max dimension for images in rationale
148
+
149
+ # `maxImageHeight` (object)
150
+
151
+ Properties of the `maxImageHeight` object:
152
+
153
+ ## `teacherInstructions` (number)
154
+
155
+ Indicates the max dimension for images in teacher instructions
156
+
157
+ ## `prompt` (number)
158
+
159
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
160
+
161
+ ## `rationale` (number)
162
+
163
+ Indicates the max dimension for images in rationale
164
+
165
+ # `withRubric` (object)
166
+
167
+ Properties of the `withRubric` object:
168
+
169
+ ## `settings` (boolean)
170
+
171
+ Indicates if the item has to be displayed in the Settings Panel
172
+
173
+ ## `label` (string)
174
+
175
+ Indicates the label for the item that has to be displayed in the Settings Panel
176
+
101
177
  # `showPrompt` (boolean)
102
178
 
103
179
  Determines whether prompt field will be displayed or not
@@ -132,4 +208,20 @@ Indicates if the item has to be displayed in the Settings Panel
132
208
 
133
209
  ### `label` (string)
134
210
 
135
- Indicates the label for the item that has to be displayed in the Settings Panel
211
+ Indicates the label for the item that has to be displayed in the Settings Panel
212
+
213
+ ## `ConfigureMaxImageDimensionsProp` (object)
214
+
215
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
216
+
217
+ ### `teacherInstructions` (number)
218
+
219
+ Indicates the max dimension for images in teacher instructions
220
+
221
+ ### `prompt` (number)
222
+
223
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
224
+
225
+ ### `rationale` (number)
226
+
227
+ Indicates the max dimension for images in rationale
@@ -13,55 +13,66 @@ exports.model = (id, element) => ({
13
13
  {
14
14
  label: 'cow ',
15
15
  value: '0',
16
- correct: true
16
+ correct: true,
17
+ rationale: 'rationale cow'
17
18
  },
18
19
  {
19
20
  label: 'dog ',
20
21
  value: '1',
21
- correct: false
22
+ correct: false,
23
+ rationale: 'rationale dog'
22
24
  },
23
25
  {
24
26
  label: 'cat ',
25
27
  value: '2',
26
- correct: false
28
+ correct: false,
29
+ rationale: 'rationale car'
27
30
  }
28
31
  ],
29
32
  '1': [
30
33
  {
31
34
  label: 'over ',
32
35
  value: '0',
33
- correct: true
36
+ correct: true,
37
+ rationale: 'rationale over'
34
38
  },
35
39
  {
36
40
  label: 'under ',
37
41
  value: '1',
38
- correct: false
42
+ correct: false,
43
+ rationale: 'rationale under'
39
44
  },
40
45
  {
41
46
  label: 'across ',
42
47
  value: '2',
43
- correct: false
48
+ correct: false,
49
+ rationale: 'rationale across'
44
50
  }
45
51
  ],
46
52
  '2': [
47
53
  {
48
54
  label: 'moon ',
49
55
  value: '0',
50
- correct: true
56
+ correct: true,
57
+ rationale: 'rationale moon'
51
58
  },
52
59
  {
53
60
  label: 'sun',
54
61
  value: '2',
55
- correct: false
62
+ correct: false,
63
+ rationale: 'rationale sun'
56
64
  },
57
65
  {
58
66
  label: 'house ',
59
67
  value: '3',
60
- correct: false
68
+ correct: false,
69
+ rationale: 'rationale house'
61
70
  }
62
71
  ]
63
72
  },
64
73
  alternateResponse: {
65
74
  '2': ['2']
66
- }
75
+ },
76
+ choiceRationaleEnabled: false,
77
+ rubricEnabled: false
67
78
  });
@@ -28,6 +28,11 @@
28
28
  "description": "Indicates if choice is correct",
29
29
  "type": "boolean",
30
30
  "title": "correct"
31
+ },
32
+ "rationale": {
33
+ "description": "Rationale for the choice",
34
+ "type": "string",
35
+ "title": "rationale"
31
36
  }
32
37
  },
33
38
  "required": [
@@ -107,6 +112,16 @@
107
112
  "type": "boolean",
108
113
  "title": "rationaleEnabled"
109
114
  },
115
+ "spellCheckEnabled": {
116
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
117
+ "type": "boolean",
118
+ "title": "spellCheckEnabled"
119
+ },
120
+ "choiceRationaleEnabled": {
121
+ "description": "Indicates if Choice Level Rationales are enabled",
122
+ "type": "boolean",
123
+ "title": "choiceRationaleEnabled"
124
+ },
110
125
  "studentInstructionsEnabled": {
111
126
  "description": "Indicates if Student Instructions are enabled",
112
127
  "type": "boolean",
@@ -117,6 +132,11 @@
117
132
  "type": "boolean",
118
133
  "title": "teacherInstructionsEnabled"
119
134
  },
135
+ "displayType": {
136
+ "description": "Indicates display type for the container of the pie-ui element",
137
+ "type": "string",
138
+ "title": "displayType"
139
+ },
120
140
  "toolbarEditorPosition": {
121
141
  "description": "Indicates the editor's toolbar position which can be 'bottom' or 'top'",
122
142
  "default": ": 'bottom'",
@@ -127,6 +147,11 @@
127
147
  "type": "string",
128
148
  "title": "toolbarEditorPosition"
129
149
  },
150
+ "rubricEnabled": {
151
+ "description": "Indicates if Rubric is enabled",
152
+ "type": "boolean",
153
+ "title": "rubricEnabled"
154
+ },
130
155
  "id": {
131
156
  "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
132
157
  "type": "string",
@@ -140,7 +165,9 @@
140
165
  },
141
166
  "required": [
142
167
  "alternateResponses",
168
+ "choiceRationaleEnabled",
143
169
  "choices",
170
+ "displayType",
144
171
  "element",
145
172
  "id",
146
173
  "lockChoiceOrder",
@@ -148,7 +175,9 @@
148
175
  "partialScoring",
149
176
  "rationale",
150
177
  "rationaleEnabled",
178
+ "rubricEnabled",
151
179
  "scoringType",
180
+ "spellCheckEnabled",
152
181
  "studentInstructionsEnabled",
153
182
  "teacherInstructionsEnabled"
154
183
  ],
@@ -169,6 +198,27 @@
169
198
  }
170
199
  }
171
200
  },
201
+ "ConfigureMaxImageDimensionsProp": {
202
+ "title": "ConfigureMaxImageDimensionsProp",
203
+ "type": "object",
204
+ "properties": {
205
+ "teacherInstructions": {
206
+ "description": "Indicates the max dimension for images in teacher instructions",
207
+ "type": "number",
208
+ "title": "teacherInstructions"
209
+ },
210
+ "prompt": {
211
+ "description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
212
+ "type": "number",
213
+ "title": "prompt"
214
+ },
215
+ "rationale": {
216
+ "description": "Indicates the max dimension for images in rationale",
217
+ "type": "number",
218
+ "title": "rationale"
219
+ }
220
+ }
221
+ },
172
222
  "Choice": {
173
223
  "title": "Choice",
174
224
  "type": "object",
@@ -187,6 +237,11 @@
187
237
  "description": "Indicates if choice is correct",
188
238
  "type": "boolean",
189
239
  "title": "correct"
240
+ },
241
+ "rationale": {
242
+ "description": "Rationale for the choice",
243
+ "type": "string",
244
+ "title": "rationale"
190
245
  }
191
246
  },
192
247
  "required": [
@@ -56,6 +56,14 @@ Indicates teacher instructions
56
56
 
57
57
  Indicates if Rationale are enabled
58
58
 
59
+ # `spellCheckEnabled` (boolean, required)
60
+
61
+ Indicates if spellcheck is enabled for the author. Default value is true
62
+
63
+ # `choiceRationaleEnabled` (boolean, required)
64
+
65
+ Indicates if Choice Level Rationales are enabled
66
+
59
67
  # `studentInstructionsEnabled` (boolean, required)
60
68
 
61
69
  Indicates if Student Instructions are enabled
@@ -64,6 +72,10 @@ Indicates if Student Instructions are enabled
64
72
 
65
73
  Indicates if Teacher Instructions are enabled
66
74
 
75
+ # `displayType` (string, required)
76
+
77
+ Indicates display type for the container of the pie-ui element
78
+
67
79
  # `toolbarEditorPosition` (string, enum)
68
80
 
69
81
  Indicates the editor's toolbar position which can be 'bottom' or 'top'
@@ -75,6 +87,10 @@ This element must be one of the following enum values:
75
87
 
76
88
  Default: `": 'bottom'"`
77
89
 
90
+ # `rubricEnabled` (boolean, required)
91
+
92
+ Indicates if Rubric is enabled
93
+
78
94
  # `id` (string, required)
79
95
 
80
96
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -101,6 +117,22 @@ Indicates if the item has to be displayed in the Settings Panel
101
117
 
102
118
  Indicates the label for the item that has to be displayed in the Settings Panel
103
119
 
120
+ ## `ConfigureMaxImageDimensionsProp` (object)
121
+
122
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
123
+
124
+ ### `teacherInstructions` (number)
125
+
126
+ Indicates the max dimension for images in teacher instructions
127
+
128
+ ### `prompt` (number)
129
+
130
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
131
+
132
+ ### `rationale` (number)
133
+
134
+ Indicates the max dimension for images in rationale
135
+
104
136
  ## `Choice` (object)
105
137
 
106
138
  Properties of the `Choice` object:
@@ -115,4 +147,8 @@ The label of the choice
115
147
 
116
148
  ### `correct` (boolean)
117
149
 
118
- Indicates if choice is correct
150
+ Indicates if choice is correct
151
+
152
+ ### `rationale` (string)
153
+
154
+ Rationale for the choice
package/lib/index.js CHANGED
@@ -35,7 +35,7 @@ var _inlineDropdown = _interopRequireDefault(require("./inline-dropdown"));
35
35
 
36
36
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
37
37
 
38
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
38
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
39
39
 
40
40
  var RootInlineDropdown = /*#__PURE__*/function (_HTMLElement) {
41
41
  (0, _inherits2["default"])(RootInlineDropdown, _HTMLElement);
@@ -54,6 +54,7 @@ var RootInlineDropdown = /*#__PURE__*/function (_HTMLElement) {
54
54
  rationale: _this._model.rationale,
55
55
  teacherInstructions: _this._model.teacherInstructions,
56
56
  disabled: _this._model.disabled,
57
+ displayType: _this._model.displayType,
57
58
  markup: _this._model.markup,
58
59
  mode: _this._model.mode,
59
60
  choices: _this._model.choices,
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["RootInlineDropdown","_model","_session","elem","React","createElement","InlineDropdown","prompt","rationale","teacherInstructions","disabled","markup","mode","choices","value","feedback","onChange","changeSession","ReactDOM","render","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","session","dispatchChangedEvent","_render","m","ModelSetEvent","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAIA;;AACA;;;;;;IAEqBA,kB;;;;;AACnB,gCAAc;AAAA;;AAAA;AACZ;AADY,gGA4BJ,YAAM;AACd,UAAI,MAAKC,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAIC,IAAI,gBAAGC,kBAAMC,aAAN,CAAoBC,0BAApB,EAAoC;AAC7CC,UAAAA,MAAM,EAAE,MAAKN,MAAL,CAAYM,MADyB;AAE7CC,UAAAA,SAAS,EAAE,MAAKP,MAAL,CAAYO,SAFsB;AAG7CC,UAAAA,mBAAmB,EAAE,MAAKR,MAAL,CAAYQ,mBAHY;AAI7CC,UAAAA,QAAQ,EAAE,MAAKT,MAAL,CAAYS,QAJuB;AAK7CC,UAAAA,MAAM,EAAE,MAAKV,MAAL,CAAYU,MALyB;AAM7CC,UAAAA,IAAI,EAAE,MAAKX,MAAL,CAAYW,IAN2B;AAO7CC,UAAAA,OAAO,EAAE,MAAKZ,MAAL,CAAYY,OAPwB;AAQ7CC,UAAAA,KAAK,EAAE,MAAKZ,QAAL,CAAcY,KARwB;AAS7CC,UAAAA,QAAQ,EAAE,MAAKd,MAAL,CAAYc,QATuB;AAU7CC,UAAAA,QAAQ,EAAE,MAAKC;AAV8B,SAApC,CAAX;;AAYAC,6BAASC,MAAT,CAAgBhB,IAAhB,kDAA4B,YAAM;AAChC;AACD,SAFD;AAGD;AACF,KA9Ca;AAAA,6GAgDS,YAAM;AAC3B,YAAKiB,aAAL,CACE,IAAIC,oCAAJ,CACE,MAAKC,OAAL,CAAaC,WAAb,EADF,EAEE,MAAKC,OAAL,IAAgB,CAAC,CAAC,MAAKA,OAAL,CAAaV,KAFjC,CADF;AAMD,KAvDa;AAAA,sGAyDE,UAAAA,KAAK,EAAI;AACvB,YAAKU,OAAL,CAAaV,KAAb,GAAqBA,KAArB;;AACA,YAAKW,oBAAL;;AACA,YAAKC,OAAL;AACD,KA7Da;AAEZ,UAAKzB,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,IAAhB;AAHY;AAIb;;;;SAED,aAAUyB,CAAV,EAAa;AACX,WAAK1B,MAAL,GAAc0B,CAAd;AACA,WAAKP,aAAL,CACE,IAAIQ,8BAAJ,CACE,KAAKN,OAAL,CAAaC,WAAb,EADF,EAEE,KAAKC,OAAL,IAAgB,CAAC,CAAC,KAAKA,OAAL,CAAaV,KAFjC,EAGE,CAAC,CAAC,KAAKb,MAHT,CADF;;AAQA,WAAKyB,OAAL;AACD;;;SAOD,eAAc;AACZ,aAAO,KAAKxB,QAAZ;AACD,K;SAPD,aAAY2B,CAAZ,EAAe;AACb,WAAK3B,QAAL,GAAgB2B,CAAhB;;AACA,WAAKH,OAAL;AACD;;;WAyCD,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;kDAlE6CI,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport {\n ModelSetEvent,\n SessionChangedEvent\n} from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport InlineDropdown from './inline-dropdown';\n\nexport default class RootInlineDropdown extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(\n new ModelSetEvent(\n this.tagName.toLowerCase(),\n this.session && !!this.session.value,\n !!this._model\n )\n );\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n _render = () => {\n if (this._model && this._session) {\n let elem = React.createElement(InlineDropdown, {\n prompt: this._model.prompt,\n rationale: this._model.rationale,\n teacherInstructions: this._model.teacherInstructions,\n disabled: this._model.disabled,\n markup: this._model.markup,\n mode: this._model.mode,\n choices: this._model.choices,\n value: this._session.value,\n feedback: this._model.feedback,\n onChange: this.changeSession\n });\n ReactDOM.render(elem, this, () => {\n renderMath(this);\n });\n }\n };\n\n dispatchChangedEvent = () => {\n this.dispatchEvent(\n new SessionChangedEvent(\n this.tagName.toLowerCase(),\n this.session && !!this.session.value\n )\n );\n };\n\n changeSession = value => {\n this.session.value = value;\n this.dispatchChangedEvent();\n this._render();\n };\n\n connectedCallback() {\n this._render();\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["RootInlineDropdown","_model","_session","elem","React","createElement","InlineDropdown","prompt","rationale","teacherInstructions","disabled","displayType","markup","mode","choices","value","feedback","onChange","changeSession","ReactDOM","render","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","session","dispatchChangedEvent","_render","m","ModelSetEvent","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAIA;;AACA;;;;;;IAEqBA,kB;;;;;AACnB,gCAAc;AAAA;;AAAA;AACZ;AADY,gGA4BJ,YAAM;AACd,UAAI,MAAKC,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAIC,IAAI,gBAAGC,kBAAMC,aAAN,CAAoBC,0BAApB,EAAoC;AAC7CC,UAAAA,MAAM,EAAE,MAAKN,MAAL,CAAYM,MADyB;AAE7CC,UAAAA,SAAS,EAAE,MAAKP,MAAL,CAAYO,SAFsB;AAG7CC,UAAAA,mBAAmB,EAAE,MAAKR,MAAL,CAAYQ,mBAHY;AAI7CC,UAAAA,QAAQ,EAAE,MAAKT,MAAL,CAAYS,QAJuB;AAK7CC,UAAAA,WAAW,EAAE,MAAKV,MAAL,CAAYU,WALoB;AAM7CC,UAAAA,MAAM,EAAE,MAAKX,MAAL,CAAYW,MANyB;AAO7CC,UAAAA,IAAI,EAAE,MAAKZ,MAAL,CAAYY,IAP2B;AAQ7CC,UAAAA,OAAO,EAAE,MAAKb,MAAL,CAAYa,OARwB;AAS7CC,UAAAA,KAAK,EAAE,MAAKb,QAAL,CAAca,KATwB;AAU7CC,UAAAA,QAAQ,EAAE,MAAKf,MAAL,CAAYe,QAVuB;AAW7CC,UAAAA,QAAQ,EAAE,MAAKC;AAX8B,SAApC,CAAX;;AAcAC,6BAASC,MAAT,CAAgBjB,IAAhB,kDAA4B,YAAM;AAChC;AACD,SAFD;AAGD;AACF,KAhDa;AAAA,6GAkDS,YAAM;AAC3B,YAAKkB,aAAL,CACE,IAAIC,oCAAJ,CACE,MAAKC,OAAL,CAAaC,WAAb,EADF,EAEE,MAAKC,OAAL,IAAgB,CAAC,CAAC,MAAKA,OAAL,CAAaV,KAFjC,CADF;AAMD,KAzDa;AAAA,sGA2DE,UAAAA,KAAK,EAAI;AACvB,YAAKU,OAAL,CAAaV,KAAb,GAAqBA,KAArB;;AACA,YAAKW,oBAAL;;AACA,YAAKC,OAAL;AACD,KA/Da;AAEZ,UAAK1B,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,IAAhB;AAHY;AAIb;;;;SAED,aAAU0B,CAAV,EAAa;AACX,WAAK3B,MAAL,GAAc2B,CAAd;AACA,WAAKP,aAAL,CACE,IAAIQ,8BAAJ,CACE,KAAKN,OAAL,CAAaC,WAAb,EADF,EAEE,KAAKC,OAAL,IAAgB,CAAC,CAAC,KAAKA,OAAL,CAAaV,KAFjC,EAGE,CAAC,CAAC,KAAKd,MAHT,CADF;;AAQA,WAAK0B,OAAL;AACD;;;SAOD,eAAc;AACZ,aAAO,KAAKzB,QAAZ;AACD,K;SAPD,aAAY4B,CAAZ,EAAe;AACb,WAAK5B,QAAL,GAAgB4B,CAAhB;;AACA,WAAKH,OAAL;AACD;;;WA2CD,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;kDApE6CI,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport {\n ModelSetEvent,\n SessionChangedEvent\n} from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport InlineDropdown from './inline-dropdown'; \n\nexport default class RootInlineDropdown extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n }\n\n set model(m) {\n this._model = m;\n this.dispatchEvent(\n new ModelSetEvent(\n this.tagName.toLowerCase(),\n this.session && !!this.session.value,\n !!this._model\n )\n );\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n _render = () => {\n if (this._model && this._session) {\n let elem = React.createElement(InlineDropdown, {\n prompt: this._model.prompt,\n rationale: this._model.rationale,\n teacherInstructions: this._model.teacherInstructions,\n disabled: this._model.disabled,\n displayType: this._model.displayType,\n markup: this._model.markup,\n mode: this._model.mode,\n choices: this._model.choices,\n value: this._session.value,\n feedback: this._model.feedback,\n onChange: this.changeSession\n });\n\n ReactDOM.render(elem, this, () => {\n renderMath(this);\n });\n }\n };\n\n dispatchChangedEvent = () => {\n this.dispatchEvent(\n new SessionChangedEvent(\n this.tagName.toLowerCase(),\n this.session && !!this.session.value\n )\n );\n };\n\n changeSession = value => {\n this.session.value = value;\n this.dispatchChangedEvent();\n this._render();\n };\n\n connectedCallback() {\n this._render();\n }\n}\n"],"file":"index.js"}
@@ -41,9 +41,11 @@ var _mathRendering = require("@pie-lib/math-rendering");
41
41
 
42
42
  var _styles = require("@material-ui/core/styles");
43
43
 
44
+ var _classnames = _interopRequireDefault(require("classnames"));
45
+
44
46
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
45
47
 
46
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
48
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
47
49
 
48
50
  var InlineDropdown = /*#__PURE__*/function (_React$Component) {
49
51
  (0, _inherits2["default"])(InlineDropdown, _React$Component);
@@ -97,39 +99,70 @@ var InlineDropdown = /*#__PURE__*/function (_React$Component) {
97
99
  prompt = _this$props.prompt,
98
100
  mode = _this$props.mode,
99
101
  rationale = _this$props.rationale,
100
- teacherInstructions = _this$props.teacherInstructions;
102
+ teacherInstructions = _this$props.teacherInstructions,
103
+ choices = _this$props.choices,
104
+ displayType = _this$props.displayType;
101
105
  var showCorrectAnswerToggle = mode === 'evaluate';
106
+ var choiceRationalesHaveText = false;
107
+ var choiceRationales = (Object.keys(choices) || []).map(function (key) {
108
+ return (choices[key] || []).reduce(function (acc, currentValue) {
109
+ if (currentValue.rationale && (0, _renderUi.hasText)(currentValue.rationale)) {
110
+ choiceRationalesHaveText = true;
111
+ acc.push(currentValue);
112
+ }
113
+
114
+ return acc;
115
+ }, []);
116
+ });
102
117
  return /*#__PURE__*/_react["default"].createElement("div", {
103
- className: classes.mainContainer
118
+ className: classes.mainContainer,
119
+ style: {
120
+ display: "".concat(displayType)
121
+ }
104
122
  }, teacherInstructions && (0, _renderUi.hasText)(teacherInstructions) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
105
123
  labels: {
106
124
  hidden: 'Show Teacher Instructions',
107
125
  visible: 'Hide Teacher Instructions'
108
126
  }
109
- }, /*#__PURE__*/_react["default"].createElement("div", {
110
- dangerouslySetInnerHTML: {
111
- __html: teacherInstructions
112
- }
127
+ }, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
128
+ prompt: teacherInstructions
113
129
  })), /*#__PURE__*/_react["default"].createElement("br", null)), /*#__PURE__*/_react["default"].createElement(_correctAnswerToggle["default"], {
114
130
  show: showCorrectAnswerToggle,
115
131
  toggled: showCorrectAnswer,
116
132
  onToggle: this.toggleShowCorrect
117
- }), showCorrectAnswerToggle && /*#__PURE__*/_react["default"].createElement("br", null), prompt && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
118
- dangerouslySetInnerHTML: {
119
- __html: prompt
120
- }
121
- }), /*#__PURE__*/_react["default"].createElement("br", null)), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
133
+ }), showCorrectAnswerToggle && /*#__PURE__*/_react["default"].createElement("br", null), prompt && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
134
+ prompt: prompt
135
+ }), /*#__PURE__*/_react["default"].createElement("br", null)), /*#__PURE__*/_react["default"].createElement(_maskMarkup.InlineDropdown, (0, _extends2["default"])({}, this.props, {
136
+ showCorrectAnswer: showCorrectAnswer
137
+ })), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
122
138
  labels: {
123
139
  hidden: 'Show Rationale',
124
140
  visible: 'Hide Rationale'
125
141
  }
126
- }, /*#__PURE__*/_react["default"].createElement("div", {
127
- dangerouslySetInnerHTML: {
128
- __html: rationale
142
+ }, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
143
+ prompt: rationale
144
+ })), choiceRationalesHaveText && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
145
+ labels: {
146
+ hidden: 'Show Rationale for choices',
147
+ visible: 'Hide Rationale for choices'
129
148
  }
130
- })), /*#__PURE__*/_react["default"].createElement(_maskMarkup.InlineDropdown, (0, _extends2["default"])({}, this.props, {
131
- showCorrectAnswer: showCorrectAnswer
132
- })));
149
+ }, /*#__PURE__*/_react["default"].createElement("div", null, choiceRationales.map(function (choices, index) {
150
+ return /*#__PURE__*/_react["default"].createElement("div", {
151
+ key: index
152
+ }, choices && choices.length > 0 && choices.map(function (choice) {
153
+ return /*#__PURE__*/_react["default"].createElement("div", {
154
+ className: classes.choiceRationale,
155
+ key: choice.label
156
+ }, /*#__PURE__*/_react["default"].createElement("div", {
157
+ className: (0, _classnames["default"])(classes.choiceRationaleLabel, choice.correct ? 'correct' : 'incorrect'),
158
+ dangerouslySetInnerHTML: {
159
+ __html: "".concat(choice.label, ": ")
160
+ }
161
+ }), /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
162
+ prompt: choice.rationale
163
+ }));
164
+ }), choices && choices.length > 0 && /*#__PURE__*/_react["default"].createElement("br", null));
165
+ })))));
133
166
  }
134
167
  }]);
135
168
  return InlineDropdown;
@@ -142,6 +175,7 @@ exports.InlineDropdown = InlineDropdown;
142
175
  disabled: _propTypes["default"].bool,
143
176
  markup: _propTypes["default"].string,
144
177
  mode: _propTypes["default"].string,
178
+ displayType: _propTypes["default"].string,
145
179
  rationale: _propTypes["default"].string,
146
180
  teacherInstructions: _propTypes["default"].string,
147
181
  choices: _propTypes["default"].object,
@@ -159,6 +193,19 @@ var styles = function styles(theme) {
159
193
  color: _renderUi.color.text(),
160
194
  backgroundColor: _renderUi.color.background(),
161
195
  padding: theme.spacing.unit
196
+ },
197
+ choiceRationale: {
198
+ display: 'flex',
199
+ whiteSpace: 'break-spaces'
200
+ },
201
+ choiceRationaleLabel: {
202
+ display: 'flex',
203
+ '&.correct': {
204
+ color: _renderUi.color.correct()
205
+ },
206
+ '&.incorrect': {
207
+ color: _renderUi.color.incorrect()
208
+ }
162
209
  }
163
210
  };
164
211
  };