@pie-element/inline-dropdown 3.10.0 → 3.10.1-beta.1443

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,22 @@
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
+ },
86
102
  "choiceRationale": {
87
103
  "title": "ConfigureProp",
88
104
  "type": "object",
@@ -99,6 +115,11 @@
99
115
  }
100
116
  }
101
117
  },
118
+ "settingsPanelDisabled": {
119
+ "description": "Indicates if the settings panel is not available",
120
+ "type": "boolean",
121
+ "title": "settingsPanelDisabled"
122
+ },
102
123
  "scoringType": {
103
124
  "title": "ConfigureProp",
104
125
  "type": "object",
@@ -147,6 +168,74 @@
147
168
  }
148
169
  }
149
170
  },
171
+ "maxResponseAreas": {
172
+ "description": "Maximum number of response areas",
173
+ "type": "number",
174
+ "title": "maxResponseAreas"
175
+ },
176
+ "maxResponseAreaChoices": {
177
+ "description": "Maximum number of choices per response area",
178
+ "type": "number",
179
+ "title": "maxResponseAreaChoices"
180
+ },
181
+ "maxImageWidth": {
182
+ "title": "ConfigureMaxImageDimensionsProp",
183
+ "type": "object",
184
+ "properties": {
185
+ "teacherInstructions": {
186
+ "description": "Indicates the max dimension for images in teacher instructions",
187
+ "type": "number",
188
+ "title": "teacherInstructions"
189
+ },
190
+ "prompt": {
191
+ "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",
192
+ "type": "number",
193
+ "title": "prompt"
194
+ },
195
+ "rationale": {
196
+ "description": "Indicates the max dimension for images in rationale",
197
+ "type": "number",
198
+ "title": "rationale"
199
+ }
200
+ }
201
+ },
202
+ "maxImageHeight": {
203
+ "title": "ConfigureMaxImageDimensionsProp",
204
+ "type": "object",
205
+ "properties": {
206
+ "teacherInstructions": {
207
+ "description": "Indicates the max dimension for images in teacher instructions",
208
+ "type": "number",
209
+ "title": "teacherInstructions"
210
+ },
211
+ "prompt": {
212
+ "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",
213
+ "type": "number",
214
+ "title": "prompt"
215
+ },
216
+ "rationale": {
217
+ "description": "Indicates the max dimension for images in rationale",
218
+ "type": "number",
219
+ "title": "rationale"
220
+ }
221
+ }
222
+ },
223
+ "withRubric": {
224
+ "title": "ConfigureProp",
225
+ "type": "object",
226
+ "properties": {
227
+ "settings": {
228
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
229
+ "type": "boolean",
230
+ "title": "settings"
231
+ },
232
+ "label": {
233
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
234
+ "type": "string",
235
+ "title": "label"
236
+ }
237
+ }
238
+ },
150
239
  "showPrompt": {
151
240
  "description": "Determines whether prompt field will be displayed or not",
152
241
  "default": true,
@@ -182,6 +271,27 @@
182
271
  "title": "label"
183
272
  }
184
273
  }
274
+ },
275
+ "ConfigureMaxImageDimensionsProp": {
276
+ "title": "ConfigureMaxImageDimensionsProp",
277
+ "type": "object",
278
+ "properties": {
279
+ "teacherInstructions": {
280
+ "description": "Indicates the max dimension for images in teacher instructions",
281
+ "type": "number",
282
+ "title": "teacherInstructions"
283
+ },
284
+ "prompt": {
285
+ "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",
286
+ "type": "number",
287
+ "title": "prompt"
288
+ },
289
+ "rationale": {
290
+ "description": "Indicates the max dimension for images in rationale",
291
+ "type": "number",
292
+ "title": "rationale"
293
+ }
294
+ }
185
295
  }
186
296
  },
187
297
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -62,6 +62,18 @@ 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
+
65
77
  # `choiceRationale` (object)
66
78
 
67
79
  Properties of the `choiceRationale` object:
@@ -74,6 +86,10 @@ Indicates if the item has to be displayed in the Settings Panel
74
86
 
75
87
  Indicates the label for the item that has to be displayed in the Settings Panel
76
88
 
89
+ # `settingsPanelDisabled` (boolean)
90
+
91
+ Indicates if the settings panel is not available
92
+
77
93
  # `scoringType` (object)
78
94
 
79
95
  Properties of the `scoringType` object:
@@ -110,6 +126,58 @@ Indicates if the item has to be displayed in the Settings Panel
110
126
 
111
127
  Indicates the label for the item that has to be displayed in the Settings Panel
112
128
 
129
+ # `maxResponseAreas` (number)
130
+
131
+ Maximum number of response areas
132
+
133
+ # `maxResponseAreaChoices` (number)
134
+
135
+ Maximum number of choices per response area
136
+
137
+ # `maxImageWidth` (object)
138
+
139
+ Properties of the `maxImageWidth` object:
140
+
141
+ ## `teacherInstructions` (number)
142
+
143
+ Indicates the max dimension for images in teacher instructions
144
+
145
+ ## `prompt` (number)
146
+
147
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
148
+
149
+ ## `rationale` (number)
150
+
151
+ Indicates the max dimension for images in rationale
152
+
153
+ # `maxImageHeight` (object)
154
+
155
+ Properties of the `maxImageHeight` object:
156
+
157
+ ## `teacherInstructions` (number)
158
+
159
+ Indicates the max dimension for images in teacher instructions
160
+
161
+ ## `prompt` (number)
162
+
163
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
164
+
165
+ ## `rationale` (number)
166
+
167
+ Indicates the max dimension for images in rationale
168
+
169
+ # `withRubric` (object)
170
+
171
+ Properties of the `withRubric` object:
172
+
173
+ ## `settings` (boolean)
174
+
175
+ Indicates if the item has to be displayed in the Settings Panel
176
+
177
+ ## `label` (string)
178
+
179
+ Indicates the label for the item that has to be displayed in the Settings Panel
180
+
113
181
  # `showPrompt` (boolean)
114
182
 
115
183
  Determines whether prompt field will be displayed or not
@@ -144,4 +212,20 @@ Indicates if the item has to be displayed in the Settings Panel
144
212
 
145
213
  ### `label` (string)
146
214
 
147
- Indicates the label for the item that has to be displayed in the Settings Panel
215
+ Indicates the label for the item that has to be displayed in the Settings Panel
216
+
217
+ ## `ConfigureMaxImageDimensionsProp` (object)
218
+
219
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
220
+
221
+ ### `teacherInstructions` (number)
222
+
223
+ Indicates the max dimension for images in teacher instructions
224
+
225
+ ### `prompt` (number)
226
+
227
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
228
+
229
+ ### `rationale` (number)
230
+
231
+ Indicates the max dimension for images in rationale
@@ -2,7 +2,7 @@ const { model } = require('./generate');
2
2
 
3
3
  module.exports = {
4
4
  elements: {
5
- 'inline-dropdown': '../..'
5
+ 'inline-dropdown': '../..',
6
6
  },
7
- models: [model('1', 'inline-dropdown')]
7
+ models: [model('1', 'inline-dropdown')],
8
8
  };
@@ -9,69 +9,70 @@ exports.model = (id, element) => ({
9
9
  shuffle: true,
10
10
  markup: '<div><p>The {{0}} jumped {{1}} the {{2}}</p></div>',
11
11
  choices: {
12
- '0': [
12
+ 0: [
13
13
  {
14
14
  label: 'cow ',
15
15
  value: '0',
16
16
  correct: true,
17
- rationale: 'rationale cow'
17
+ rationale: 'rationale cow',
18
18
  },
19
19
  {
20
20
  label: 'dog ',
21
21
  value: '1',
22
22
  correct: false,
23
- rationale: 'rationale dog'
23
+ rationale: 'rationale dog',
24
24
  },
25
25
  {
26
26
  label: 'cat ',
27
27
  value: '2',
28
28
  correct: false,
29
- rationale: 'rationale car'
30
- }
29
+ rationale: 'rationale car',
30
+ },
31
31
  ],
32
- '1': [
32
+ 1: [
33
33
  {
34
34
  label: 'over ',
35
35
  value: '0',
36
36
  correct: true,
37
- rationale: 'rationale over'
37
+ rationale: 'rationale over',
38
38
  },
39
39
  {
40
40
  label: 'under ',
41
41
  value: '1',
42
42
  correct: false,
43
- rationale: 'rationale under'
43
+ rationale: 'rationale under',
44
44
  },
45
45
  {
46
46
  label: 'across ',
47
47
  value: '2',
48
48
  correct: false,
49
- rationale: 'rationale across'
50
- }
49
+ rationale: 'rationale across',
50
+ },
51
51
  ],
52
- '2': [
52
+ 2: [
53
53
  {
54
54
  label: 'moon ',
55
55
  value: '0',
56
56
  correct: true,
57
- rationale: 'rationale moon'
57
+ rationale: 'rationale moon',
58
58
  },
59
59
  {
60
60
  label: 'sun',
61
61
  value: '2',
62
62
  correct: false,
63
- rationale: 'rationale sun'
63
+ rationale: 'rationale sun',
64
64
  },
65
65
  {
66
66
  label: 'house ',
67
67
  value: '3',
68
68
  correct: false,
69
- rationale: 'rationale house'
70
- }
71
- ]
69
+ rationale: 'rationale house',
70
+ },
71
+ ],
72
72
  },
73
73
  alternateResponse: {
74
- '2': ['2']
74
+ 2: ['2'],
75
75
  },
76
- choiceRationaleEnabled: false
76
+ choiceRationaleEnabled: false,
77
+ rubricEnabled: false,
77
78
  });
@@ -112,6 +112,11 @@
112
112
  "type": "boolean",
113
113
  "title": "rationaleEnabled"
114
114
  },
115
+ "spellCheckEnabled": {
116
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
117
+ "type": "boolean",
118
+ "title": "spellCheckEnabled"
119
+ },
115
120
  "choiceRationaleEnabled": {
116
121
  "description": "Indicates if Choice Level Rationales are enabled",
117
122
  "type": "boolean",
@@ -127,6 +132,11 @@
127
132
  "type": "boolean",
128
133
  "title": "teacherInstructionsEnabled"
129
134
  },
135
+ "displayType": {
136
+ "description": "Indicates display type for the container of the pie-ui element",
137
+ "type": "string",
138
+ "title": "displayType"
139
+ },
130
140
  "toolbarEditorPosition": {
131
141
  "description": "Indicates the editor's toolbar position which can be 'bottom' or 'top'",
132
142
  "default": ": 'bottom'",
@@ -137,6 +147,11 @@
137
147
  "type": "string",
138
148
  "title": "toolbarEditorPosition"
139
149
  },
150
+ "rubricEnabled": {
151
+ "description": "Indicates if Rubric is enabled",
152
+ "type": "boolean",
153
+ "title": "rubricEnabled"
154
+ },
140
155
  "id": {
141
156
  "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
142
157
  "type": "string",
@@ -152,6 +167,7 @@
152
167
  "alternateResponses",
153
168
  "choiceRationaleEnabled",
154
169
  "choices",
170
+ "displayType",
155
171
  "element",
156
172
  "id",
157
173
  "lockChoiceOrder",
@@ -159,7 +175,9 @@
159
175
  "partialScoring",
160
176
  "rationale",
161
177
  "rationaleEnabled",
178
+ "rubricEnabled",
162
179
  "scoringType",
180
+ "spellCheckEnabled",
163
181
  "studentInstructionsEnabled",
164
182
  "teacherInstructionsEnabled"
165
183
  ],
@@ -180,6 +198,27 @@
180
198
  }
181
199
  }
182
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
+ },
183
222
  "Choice": {
184
223
  "title": "Choice",
185
224
  "type": "object",
@@ -56,6 +56,10 @@ 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
+
59
63
  # `choiceRationaleEnabled` (boolean, required)
60
64
 
61
65
  Indicates if Choice Level Rationales are enabled
@@ -68,6 +72,10 @@ Indicates if Student Instructions are enabled
68
72
 
69
73
  Indicates if Teacher Instructions are enabled
70
74
 
75
+ # `displayType` (string, required)
76
+
77
+ Indicates display type for the container of the pie-ui element
78
+
71
79
  # `toolbarEditorPosition` (string, enum)
72
80
 
73
81
  Indicates the editor's toolbar position which can be 'bottom' or 'top'
@@ -79,6 +87,10 @@ This element must be one of the following enum values:
79
87
 
80
88
  Default: `": 'bottom'"`
81
89
 
90
+ # `rubricEnabled` (boolean, required)
91
+
92
+ Indicates if Rubric is enabled
93
+
82
94
  # `id` (string, required)
83
95
 
84
96
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -105,6 +117,22 @@ Indicates if the item has to be displayed in the Settings Panel
105
117
 
106
118
  Indicates the label for the item that has to be displayed in the Settings Panel
107
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
+
108
136
  ## `Choice` (object)
109
137
 
110
138
  Properties of the `Choice` object:
package/lib/index.js CHANGED
@@ -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;;AACA;;AACA;;;;;;IAEqBA,kB;;;;;AACnB,gCAAc;AAAA;;AAAA;AACZ;AADY,gGAwBJ,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,KA5Ca;AAAA,6GA8CS,YAAM;AAC3B,YAAKkB,aAAL,CAAmB,IAAIC,oCAAJ,CAAwB,MAAKC,OAAL,CAAaC,WAAb,EAAxB,EAAoD,MAAKC,OAAL,IAAgB,CAAC,CAAC,MAAKA,OAAL,CAAaV,KAAnF,CAAnB;AACD,KAhDa;AAAA,sGAkDE,UAACA,KAAD,EAAW;AACzB,YAAKU,OAAL,CAAaV,KAAb,GAAqBA,KAArB;;AACA,YAAKW,oBAAL;;AACA,YAAKC,OAAL;AACD,KAtDa;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,CAAkB,KAAKN,OAAL,CAAaC,WAAb,EAAlB,EAA8C,KAAKC,OAAL,IAAgB,CAAC,CAAC,KAAKA,OAAL,CAAaV,KAA7E,EAAoF,CAAC,CAAC,KAAKd,MAA3F,CADF;;AAIA,WAAK0B,OAAL;AACD;;;SAOD,eAAc;AACZ,aAAO,KAAKzB,QAAZ;AACD,K;SAPD,aAAY4B,CAAZ,EAAe;AACb,WAAK5B,QAAL,GAAgB4B,CAAhB;;AACA,WAAKH,OAAL;AACD;;;WAsCD,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;kDA3D6CI,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { ModelSetEvent, SessionChangedEvent } 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(this.tagName.toLowerCase(), this.session && !!this.session.value, !!this._model),\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(new SessionChangedEvent(this.tagName.toLowerCase(), this.session && !!this.session.value));\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"}
@@ -100,7 +100,8 @@ var InlineDropdown = /*#__PURE__*/function (_React$Component) {
100
100
  mode = _this$props.mode,
101
101
  rationale = _this$props.rationale,
102
102
  teacherInstructions = _this$props.teacherInstructions,
103
- choices = _this$props.choices;
103
+ choices = _this$props.choices,
104
+ displayType = _this$props.displayType;
104
105
  var showCorrectAnswerToggle = mode === 'evaluate';
105
106
  var choiceRationalesHaveText = false;
106
107
  var choiceRationales = (Object.keys(choices) || []).map(function (key) {
@@ -114,7 +115,10 @@ var InlineDropdown = /*#__PURE__*/function (_React$Component) {
114
115
  }, []);
115
116
  });
116
117
  return /*#__PURE__*/_react["default"].createElement("div", {
117
- className: classes.mainContainer
118
+ className: classes.mainContainer,
119
+ style: {
120
+ display: "".concat(displayType)
121
+ }
118
122
  }, teacherInstructions && (0, _renderUi.hasText)(teacherInstructions) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
119
123
  labels: {
120
124
  hidden: 'Show Teacher Instructions',
@@ -171,6 +175,7 @@ exports.InlineDropdown = InlineDropdown;
171
175
  disabled: _propTypes["default"].bool,
172
176
  markup: _propTypes["default"].string,
173
177
  mode: _propTypes["default"].string,
178
+ displayType: _propTypes["default"].string,
174
179
  rationale: _propTypes["default"].string,
175
180
  teacherInstructions: _propTypes["default"].string,
176
181
  choices: _propTypes["default"].object,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/inline-dropdown.jsx"],"names":["InlineDropdown","showCorrectAnswer","setState","state","nextProps","feedback","domNode","ReactDOM","findDOMNode","props","classes","prompt","mode","rationale","teacherInstructions","choices","showCorrectAnswerToggle","choiceRationalesHaveText","choiceRationales","Object","keys","map","key","reduce","acc","currentValue","push","mainContainer","hidden","visible","toggleShowCorrect","index","length","choice","choiceRationale","label","choiceRationaleLabel","correct","__html","React","Component","PropTypes","object","string","disabled","bool","markup","value","onChange","func","styles","theme","color","text","backgroundColor","background","padding","spacing","unit","display","whiteSpace","incorrect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAEaA,c;;;;;;;;;;;;;;;8FAmBH;AACNC,MAAAA,iBAAiB,EAAE;AADb,K;0GAiBY,YAAM;AACxB,YAAKC,QAAL,CAAc;AAAED,QAAAA,iBAAiB,EAAE,CAAC,MAAKE,KAAL,CAAWF;AAAjC,OAAd;AACD,K;;;;;;WAfD,0CAAiCG,SAAjC,EAA4C;AAC1C,UAAI,yBAAQA,SAAS,CAACC,QAAlB,CAAJ,EAAiC;AAC/B,aAAKH,QAAL,CAAc;AAAED,UAAAA,iBAAiB,EAAE;AAArB,SAAd;AACD;AACF;;;WAED,8BAAqB;AACnB;AACA,UAAMK,OAAO,GAAGC,qBAASC,WAAT,CAAqB,IAArB,CAAhB;;AAEA,qCAAWF,OAAX;AACD;;;W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AoB,EAAE;AACpBuB,MAAAA,OAAO,EAAE,MADW;AAEpB,mBAAa;AACXP,QAAAA,KAAK,EAAEA,gBAAMf,OAAN;AADI,OAFO;AAKpB,qBAAe;AACbe,QAAAA,KAAK,EAAEA,gBAAMS,SAAN;AADM;AALK;AAVG,GAAZ;AAAA,CAAf;;eAqBe,wBAAWX,MAAX,EAAmBlD,cAAnB,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport isEmpty from 'lodash/isEmpty';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { InlineDropdown as DropDown } from '@pie-lib/mask-markup';\nimport {color, Collapsible, hasText, PreviewPrompt} from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nexport class InlineDropdown extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n prompt: PropTypes.string,\n disabled: PropTypes.bool,\n markup: PropTypes.string,\n mode: PropTypes.string,\n rationale: PropTypes.string,\n teacherInstructions: PropTypes.string,\n choices: PropTypes.object,\n value: PropTypes.object,\n feedback: PropTypes.object,\n onChange: PropTypes.func\n };\n\n static defaultProps = {\n value: {}\n };\n\n state = {\n showCorrectAnswer: false\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n }\n\n componentDidUpdate() {\n // eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n render() {\n const { showCorrectAnswer } = this.state;\n const { classes, prompt, mode, rationale, teacherInstructions, choices } = this.props;\n const showCorrectAnswerToggle = mode === 'evaluate';\n let choiceRationalesHaveText = false;\n\n const choiceRationales = (Object.keys(choices) || []).map(key => (choices[key] || [])\n .reduce((acc, currentValue) => {\n if (currentValue.rationale && hasText(currentValue.rationale)) {\n choiceRationalesHaveText = true;\n\n acc.push(currentValue);\n }\n return acc;\n }, []));\n\n return (\n <div className={classes.mainContainer}>\n {\n teacherInstructions && hasText(teacherInstructions) && (\n <React.Fragment>\n <Collapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </Collapsible>\n <br />\n </React.Fragment>\n )\n }\n\n <CorrectAnswerToggle\n show={showCorrectAnswerToggle}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n />\n {showCorrectAnswerToggle && <br />}\n\n {prompt && (\n <React.Fragment>\n <PreviewPrompt prompt={prompt} />\n <br />\n </React.Fragment>\n )}\n <DropDown\n {...this.props}\n showCorrectAnswer={showCorrectAnswer}\n />\n {rationale && hasText(rationale) && (\n <Collapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n >\n <PreviewPrompt prompt={rationale} />\n </Collapsible>\n )}\n {choiceRationalesHaveText && (\n <React.Fragment>\n <br />\n <Collapsible labels={{hidden: 'Show Rationale for choices', visible: 'Hide Rationale for choices'}}>\n <div>\n {choiceRationales.map((choices, index) =>\n <div key={index}>\n {choices && choices.length > 0 && choices.map( choice =>\n <div className={classes.choiceRationale} key={choice.label}>\n <div\n className={classNames(classes.choiceRationaleLabel, choice.correct ? 'correct' : 'incorrect')}\n dangerouslySetInnerHTML={{ __html: `${choice.label}: ` }}\n />\n <PreviewPrompt prompt={choice.rationale} />\n </div>\n )}\n {choices && choices.length > 0 && <br />}\n </div>\n )}\n </div>\n </Collapsible>\n </React.Fragment>\n )}\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n padding: theme.spacing.unit\n },\n choiceRationale: {\n display: 'flex',\n whiteSpace: 'break-spaces'\n },\n choiceRationaleLabel: {\n display: 'flex',\n '&.correct': {\n color: color.correct()\n },\n '&.incorrect': {\n color: color.incorrect()\n }\n }\n});\n\nexport default withStyles(styles)(InlineDropdown);\n"],"file":"inline-dropdown.js"}
1
+ {"version":3,"sources":["../src/inline-dropdown.jsx"],"names":["InlineDropdown","showCorrectAnswer","setState","state","nextProps","feedback","domNode","ReactDOM","findDOMNode","props","classes","prompt","mode","rationale","teacherInstructions","choices","displayType","showCorrectAnswerToggle","choiceRationalesHaveText","choiceRationales","Object","keys","map","key","reduce","acc","currentValue","push","mainContainer","display","hidden","visible","toggleShowCorrect","index","length","choice","choiceRationale","label","choiceRationaleLabel","correct","__html","React","Component","PropTypes","object","string","disabled","bool","markup","value","onChange","func","styles","theme","color","text","backgroundColor","background","padding","spacing","unit","whiteSpace","incorrect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAEaA,c;;;;;;;;;;;;;;;8FAoBH;AACNC,MAAAA,iBAAiB,EAAE;AADb,K;0GAiBY,YAAM;AACxB,YAAKC,QAAL,CAAc;AAAED,QAAAA,iBAAiB,EAAE,CAAC,MAAKE,KAAL,CAAWF;AAAjC,OAAd;AACD,K;;;;;;WAfD,0CAAiCG,SAAjC,EAA4C;AAC1C,UAAI,yBAAQA,SAAS,CAACC,QAAlB,CAAJ,EAAiC;AAC/B,aAAKH,QAAL,CAAc;AAAED,UAAAA,iBAAiB,EAAE;AAArB,SAAd;AACD;AACF;;;WAED,8BAAqB;AACnB;AACA,UAAMK,OAAO,GAAGC,qBAASC,WAAT,CAAqB,IAArB,CAAhB;;AAEA,qCAAWF,OAAX;AACD;;;WAMD,kBAAS;AACP,UAAQL,iBAAR,GAA8B,KAAKE,KAAnC,CAAQF,iBAAR;AACA,wBAAwF,KAAKQ,KAA7F;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,UAAiBC,MAAjB,eAAiBA,MAAjB;AAAA,UAAyBC,IAAzB,eAAyBA,IAAzB;AAAA,UAA+BC,S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KAAK,EAAEA,gBAAMf,OAAN;AADI,OAFO;AAKpB,qBAAe;AACbe,QAAAA,KAAK,EAAEA,gBAAMQ,SAAN;AADM;AALK;AAVG,GAAZ;AAAA,CAAf;;eAqBe,wBAAWV,MAAX,EAAmBpD,cAAnB,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport isEmpty from 'lodash/isEmpty';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { InlineDropdown as DropDown } from '@pie-lib/mask-markup';\nimport { color, Collapsible, hasText, PreviewPrompt } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nexport class InlineDropdown extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n prompt: PropTypes.string,\n disabled: PropTypes.bool,\n markup: PropTypes.string,\n mode: PropTypes.string,\n displayType: PropTypes.string,\n rationale: PropTypes.string,\n teacherInstructions: PropTypes.string,\n choices: PropTypes.object,\n value: PropTypes.object,\n feedback: PropTypes.object,\n onChange: PropTypes.func,\n };\n\n static defaultProps = {\n value: {},\n };\n\n state = {\n showCorrectAnswer: false,\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n }\n\n componentDidUpdate() {\n // eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n render() {\n const { showCorrectAnswer } = this.state;\n const { classes, prompt, mode, rationale, teacherInstructions, choices, displayType } = this.props;\n const showCorrectAnswerToggle = mode === 'evaluate';\n let choiceRationalesHaveText = false;\n\n const choiceRationales = (Object.keys(choices) || []).map((key) =>\n (choices[key] || []).reduce((acc, currentValue) => {\n if (currentValue.rationale && hasText(currentValue.rationale)) {\n choiceRationalesHaveText = true;\n\n acc.push(currentValue);\n }\n return acc;\n }, []),\n );\n\n return (\n <div className={classes.mainContainer} style={{ display: `${displayType}` }}>\n {teacherInstructions && hasText(teacherInstructions) && (\n <React.Fragment>\n <Collapsible labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}>\n <PreviewPrompt prompt={teacherInstructions} />\n </Collapsible>\n <br />\n </React.Fragment>\n )}\n\n <CorrectAnswerToggle\n show={showCorrectAnswerToggle}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n />\n {showCorrectAnswerToggle && <br />}\n\n {prompt && (\n <React.Fragment>\n <PreviewPrompt prompt={prompt} />\n <br />\n </React.Fragment>\n )}\n <DropDown {...this.props} showCorrectAnswer={showCorrectAnswer} />\n {rationale && hasText(rationale) && (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>\n <PreviewPrompt prompt={rationale} />\n </Collapsible>\n )}\n {choiceRationalesHaveText && (\n <React.Fragment>\n <br />\n <Collapsible labels={{ hidden: 'Show Rationale for choices', visible: 'Hide Rationale for choices' }}>\n <div>\n {choiceRationales.map((choices, index) => (\n <div key={index}>\n {choices &&\n choices.length > 0 &&\n choices.map((choice) => (\n <div className={classes.choiceRationale} key={choice.label}>\n <div\n className={classNames(\n classes.choiceRationaleLabel,\n choice.correct ? 'correct' : 'incorrect',\n )}\n dangerouslySetInnerHTML={{ __html: `${choice.label}: ` }}\n />\n <PreviewPrompt prompt={choice.rationale} />\n </div>\n ))}\n {choices && choices.length > 0 && <br />}\n </div>\n ))}\n </div>\n </Collapsible>\n </React.Fragment>\n )}\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n padding: theme.spacing.unit,\n },\n choiceRationale: {\n display: 'flex',\n whiteSpace: 'break-spaces',\n },\n choiceRationaleLabel: {\n display: 'flex',\n '&.correct': {\n color: color.correct(),\n },\n '&.incorrect': {\n color: color.incorrect(),\n },\n },\n});\n\nexport default withStyles(styles)(InlineDropdown);\n"],"file":"inline-dropdown.js"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "3.10.0",
7
+ "version": "3.10.1-beta.1443+449763c04",
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -13,10 +13,10 @@
13
13
  "dependencies": {
14
14
  "@material-ui/core": "^3.9.2",
15
15
  "@pie-framework/pie-player-events": "^0.1.0",
16
- "@pie-lib/correct-answer-toggle": "^2.3.34",
17
- "@pie-lib/mask-markup": "^1.11.4",
18
- "@pie-lib/math-rendering": "^2.3.12",
19
- "@pie-lib/render-ui": "^4.12.4",
16
+ "@pie-lib/correct-answer-toggle": "^2.3.62",
17
+ "@pie-lib/mask-markup": "2.0.0-beta.1",
18
+ "@pie-lib/math-rendering": "^2.5.12",
19
+ "@pie-lib/render-ui": "^4.14.12",
20
20
  "classnames": "^2.2.5",
21
21
  "lodash": "^4.17.10",
22
22
  "prop-types": "^15.6.1",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "author": "",
27
27
  "license": "ISC",
28
- "gitHead": "510db2949732b8997ff2e1a496ca1a7bd3973088",
28
+ "gitHead": "449763c046b78327513c38ea5367b8d4da120760",
29
29
  "main": "lib/index.js",
30
30
  "module": "src/index.js"
31
31
  }