@pie-element/image-cloze-association 3.5.0 → 3.5.1-beta.587

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +478 -0
  2. package/configure/CHANGELOG.md +390 -0
  3. package/configure/lib/defaults.js +16 -0
  4. package/configure/lib/defaults.js.map +1 -1
  5. package/configure/lib/index.js +17 -3
  6. package/configure/lib/index.js.map +1 -1
  7. package/configure/lib/root.js +43 -13
  8. package/configure/lib/root.js.map +1 -1
  9. package/configure/package.json +4 -3
  10. package/configure/src/__tests__/index.test.js +12 -15
  11. package/configure/src/defaults.js +20 -4
  12. package/configure/src/index.js +23 -3
  13. package/configure/src/root.jsx +41 -25
  14. package/controller/CHANGELOG.md +63 -0
  15. package/controller/lib/index.js +9 -8
  16. package/controller/lib/index.js.map +1 -1
  17. package/controller/lib/utils.js +4 -4
  18. package/controller/lib/utils.js.map +1 -1
  19. package/controller/package.json +2 -2
  20. package/controller/src/__tests__/index.test.js +108 -62
  21. package/controller/src/index.js +40 -28
  22. package/controller/src/utils.js +10 -10
  23. package/docs/config-schema.json +160 -0
  24. package/docs/config-schema.json.md +127 -0
  25. package/docs/demo/config.js +2 -2
  26. package/docs/demo/generate.js +30 -25
  27. package/docs/demo/session.js +1 -1
  28. package/docs/pie-schema.json +378 -0
  29. package/docs/pie-schema.json.md +295 -0
  30. package/lib/constants.js.map +1 -1
  31. package/lib/evaluation-icon.js.map +1 -1
  32. package/lib/image-container.js +13 -6
  33. package/lib/image-container.js.map +1 -1
  34. package/lib/image-drop-target.js +7 -2
  35. package/lib/image-drop-target.js.map +1 -1
  36. package/lib/index.js +4 -1
  37. package/lib/index.js.map +1 -1
  38. package/lib/interactive-section.js +1 -1
  39. package/lib/interactive-section.js.map +1 -1
  40. package/lib/possible-response.js +17 -5
  41. package/lib/possible-response.js.map +1 -1
  42. package/lib/possible-responses.js.map +1 -1
  43. package/lib/root.js +140 -19
  44. package/lib/root.js.map +1 -1
  45. package/lib/utils-correctness.js +33 -5
  46. package/lib/utils-correctness.js.map +1 -1
  47. package/package.json +8 -5
  48. package/src/__tests__/__snapshots__/{image-container-test.jsx.snap → image-container.test.jsx.snap} +20 -0
  49. package/src/__tests__/__snapshots__/possible-response.test.jsx.snap +5 -0
  50. package/src/__tests__/__snapshots__/root.test.jsx.snap +50 -0
  51. package/src/__tests__/{image-container-test.jsx → image-container.test.jsx} +12 -5
  52. package/src/__tests__/{possible-response-test.jsx → possible-response.test.jsx} +5 -3
  53. package/src/__tests__/{root-test.jsx → root.test.jsx} +4 -3
  54. package/src/__tests__/utils.test.js +207 -0
  55. package/src/constants.js +3 -3
  56. package/src/evaluation-icon.jsx +8 -17
  57. package/src/image-container.jsx +14 -19
  58. package/src/image-drop-target.jsx +45 -38
  59. package/src/index.js +10 -18
  60. package/src/interactive-section.jsx +15 -22
  61. package/src/possible-response.jsx +43 -23
  62. package/src/possible-responses.jsx +17 -25
  63. package/src/root.jsx +174 -100
  64. package/src/utils-correctness.js +44 -14
  65. package/src/__tests__/__snapshots__/possible-response-test.jsx.snap +0 -13
  66. package/src/__tests__/__snapshots__/root-test.jsx.snap +0 -38
  67. package/src/__tests__/utils-test.js +0 -211
@@ -0,0 +1,378 @@
1
+ {
2
+ "description": "Model for the @pie-elements/image-cloze-association Interaction",
3
+ "additionalProperties": false,
4
+ "type": "object",
5
+ "properties": {
6
+ "prompt": {
7
+ "description": "The question prompt or item stem",
8
+ "type": "string",
9
+ "title": "prompt"
10
+ },
11
+ "rationaleEnabled": {
12
+ "description": "Indicates if Rationale is enabled",
13
+ "type": "boolean",
14
+ "title": "rationaleEnabled"
15
+ },
16
+ "spellCheckEnabled": {
17
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
18
+ "type": "boolean",
19
+ "title": "spellCheckEnabled"
20
+ },
21
+ "teacherInstructionsEnabled": {
22
+ "description": "Indicates if Teacher Instructions are enabled",
23
+ "type": "boolean",
24
+ "title": "teacherInstructionsEnabled"
25
+ },
26
+ "studentInstructionsEnabled": {
27
+ "description": "Indicates if Student Instructions are enabled",
28
+ "type": "boolean",
29
+ "title": "studentInstructionsEnabled"
30
+ },
31
+ "image": {
32
+ "title": "Image",
33
+ "type": "object",
34
+ "properties": {
35
+ "src": {
36
+ "description": "The url of the image",
37
+ "type": "string",
38
+ "title": "src"
39
+ },
40
+ "width": {
41
+ "description": "The width of the image",
42
+ "type": "number",
43
+ "title": "width"
44
+ },
45
+ "height": {
46
+ "description": "The height of the image",
47
+ "type": "number",
48
+ "title": "height"
49
+ }
50
+ }
51
+ },
52
+ "responseContainers": {
53
+ "description": "List of the response containers\nThe response containers are the areas where the images are dragged in",
54
+ "type": "array",
55
+ "items": {
56
+ "title": "ResponseContainer",
57
+ "type": "object",
58
+ "properties": {
59
+ "x": {
60
+ "description": "The x coordinate of the response container",
61
+ "type": "number",
62
+ "title": "x"
63
+ },
64
+ "y": {
65
+ "description": "The y coordinate of the response container",
66
+ "type": "number",
67
+ "title": "y"
68
+ },
69
+ "width": {
70
+ "description": "The width of the response container",
71
+ "type": "string",
72
+ "title": "width"
73
+ },
74
+ "height": {
75
+ "description": "The height of the response container",
76
+ "type": "string",
77
+ "title": "height"
78
+ }
79
+ }
80
+ },
81
+ "title": "responseContainers"
82
+ },
83
+ "stimulus": {
84
+ "description": "The question stimulus",
85
+ "type": "string",
86
+ "title": "stimulus"
87
+ },
88
+ "possibleResponses": {
89
+ "description": "List of img tags that are the possible responses",
90
+ "type": "array",
91
+ "items": {
92
+ "type": "string"
93
+ },
94
+ "title": "possibleResponses"
95
+ },
96
+ "validation": {
97
+ "title": "Validation",
98
+ "type": "object",
99
+ "properties": {
100
+ "validResponse": {
101
+ "title": "ValidResponse",
102
+ "type": "object",
103
+ "properties": {
104
+ "score": {
105
+ "description": "The score of the response",
106
+ "type": "number",
107
+ "title": "score"
108
+ },
109
+ "value": {
110
+ "description": "The value of the response\nEach value is an object with a property \"images\"",
111
+ "type": "object",
112
+ "properties": {
113
+ "images": {
114
+ "description": "An array containing a string that is a img tag",
115
+ "type": "array",
116
+ "items": {
117
+ "type": "string"
118
+ },
119
+ "title": "images"
120
+ }
121
+ },
122
+ "title": "value"
123
+ }
124
+ }
125
+ },
126
+ "altResponses": {
127
+ "description": "List of alternate responses",
128
+ "type": "array",
129
+ "items": {
130
+ "title": "ValidResponse",
131
+ "type": "object",
132
+ "properties": {
133
+ "score": {
134
+ "description": "The score of the response",
135
+ "type": "number",
136
+ "title": "score"
137
+ },
138
+ "value": {
139
+ "description": "The value of the response\nEach value is an object with a property \"images\"",
140
+ "type": "object",
141
+ "properties": {
142
+ "images": {
143
+ "description": "An array containing a string that is a img tag",
144
+ "type": "array",
145
+ "items": {
146
+ "type": "string"
147
+ },
148
+ "title": "images"
149
+ }
150
+ },
151
+ "title": "value"
152
+ }
153
+ }
154
+ },
155
+ "title": "altResponses"
156
+ }
157
+ }
158
+ },
159
+ "partialScoring": {
160
+ "description": "Indicates if the item should use partial scoring",
161
+ "type": "boolean",
162
+ "title": "partialScoring"
163
+ },
164
+ "maxResponsePerZone": {
165
+ "description": "Indicates how many responses can be placed in a response container",
166
+ "default": 1,
167
+ "type": "number",
168
+ "title": "maxResponsePerZone"
169
+ },
170
+ "duplicateResponses": {
171
+ "description": "Indicates if duplicate responses are allowed",
172
+ "type": "boolean",
173
+ "title": "duplicateResponses"
174
+ },
175
+ "showDashedBorder": {
176
+ "description": "Indicates if the response containers should have a dashed border",
177
+ "type": "boolean",
178
+ "title": "showDashedBorder"
179
+ },
180
+ "rubricEnabled": {
181
+ "description": "Indicates if Rubric is enabled",
182
+ "type": "boolean",
183
+ "title": "rubricEnabled"
184
+ },
185
+ "id": {
186
+ "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
187
+ "type": "string",
188
+ "title": "id"
189
+ },
190
+ "element": {
191
+ "description": "The html Element tag name",
192
+ "type": "string",
193
+ "title": "element"
194
+ }
195
+ },
196
+ "required": [
197
+ "element",
198
+ "id",
199
+ "rubricEnabled",
200
+ "spellCheckEnabled"
201
+ ],
202
+ "definitions": {
203
+ "ConfigureMaxImageDimensionsProp": {
204
+ "title": "ConfigureMaxImageDimensionsProp",
205
+ "type": "object",
206
+ "properties": {
207
+ "teacherInstructions": {
208
+ "description": "Indicates the max dimension for images in teacher instructions",
209
+ "type": "number",
210
+ "title": "teacherInstructions"
211
+ },
212
+ "prompt": {
213
+ "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",
214
+ "type": "number",
215
+ "title": "prompt"
216
+ },
217
+ "rationale": {
218
+ "description": "Indicates the max dimension for images in rationale",
219
+ "type": "number",
220
+ "title": "rationale"
221
+ }
222
+ }
223
+ },
224
+ "ConfigureProp": {
225
+ "title": "ConfigureProp",
226
+ "type": "object",
227
+ "properties": {
228
+ "settings": {
229
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
230
+ "type": "boolean",
231
+ "title": "settings"
232
+ },
233
+ "label": {
234
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
235
+ "type": "string",
236
+ "title": "label"
237
+ }
238
+ }
239
+ },
240
+ "Image": {
241
+ "title": "Image",
242
+ "type": "object",
243
+ "properties": {
244
+ "src": {
245
+ "description": "The url of the image",
246
+ "type": "string",
247
+ "title": "src"
248
+ },
249
+ "width": {
250
+ "description": "The width of the image",
251
+ "type": "number",
252
+ "title": "width"
253
+ },
254
+ "height": {
255
+ "description": "The height of the image",
256
+ "type": "number",
257
+ "title": "height"
258
+ }
259
+ }
260
+ },
261
+ "ResponseContainer": {
262
+ "title": "ResponseContainer",
263
+ "type": "object",
264
+ "properties": {
265
+ "x": {
266
+ "description": "The x coordinate of the response container",
267
+ "type": "number",
268
+ "title": "x"
269
+ },
270
+ "y": {
271
+ "description": "The y coordinate of the response container",
272
+ "type": "number",
273
+ "title": "y"
274
+ },
275
+ "width": {
276
+ "description": "The width of the response container",
277
+ "type": "string",
278
+ "title": "width"
279
+ },
280
+ "height": {
281
+ "description": "The height of the response container",
282
+ "type": "string",
283
+ "title": "height"
284
+ }
285
+ }
286
+ },
287
+ "Validation": {
288
+ "title": "Validation",
289
+ "type": "object",
290
+ "properties": {
291
+ "validResponse": {
292
+ "title": "ValidResponse",
293
+ "type": "object",
294
+ "properties": {
295
+ "score": {
296
+ "description": "The score of the response",
297
+ "type": "number",
298
+ "title": "score"
299
+ },
300
+ "value": {
301
+ "description": "The value of the response\nEach value is an object with a property \"images\"",
302
+ "type": "object",
303
+ "properties": {
304
+ "images": {
305
+ "description": "An array containing a string that is a img tag",
306
+ "type": "array",
307
+ "items": {
308
+ "type": "string"
309
+ },
310
+ "title": "images"
311
+ }
312
+ },
313
+ "title": "value"
314
+ }
315
+ }
316
+ },
317
+ "altResponses": {
318
+ "description": "List of alternate responses",
319
+ "type": "array",
320
+ "items": {
321
+ "title": "ValidResponse",
322
+ "type": "object",
323
+ "properties": {
324
+ "score": {
325
+ "description": "The score of the response",
326
+ "type": "number",
327
+ "title": "score"
328
+ },
329
+ "value": {
330
+ "description": "The value of the response\nEach value is an object with a property \"images\"",
331
+ "type": "object",
332
+ "properties": {
333
+ "images": {
334
+ "description": "An array containing a string that is a img tag",
335
+ "type": "array",
336
+ "items": {
337
+ "type": "string"
338
+ },
339
+ "title": "images"
340
+ }
341
+ },
342
+ "title": "value"
343
+ }
344
+ }
345
+ },
346
+ "title": "altResponses"
347
+ }
348
+ }
349
+ },
350
+ "ValidResponse": {
351
+ "title": "ValidResponse",
352
+ "type": "object",
353
+ "properties": {
354
+ "score": {
355
+ "description": "The score of the response",
356
+ "type": "number",
357
+ "title": "score"
358
+ },
359
+ "value": {
360
+ "description": "The value of the response\nEach value is an object with a property \"images\"",
361
+ "type": "object",
362
+ "properties": {
363
+ "images": {
364
+ "description": "An array containing a string that is a img tag",
365
+ "type": "array",
366
+ "items": {
367
+ "type": "string"
368
+ },
369
+ "title": "images"
370
+ }
371
+ },
372
+ "title": "value"
373
+ }
374
+ }
375
+ }
376
+ },
377
+ "$schema": "http://json-schema.org/draft-07/schema#"
378
+ }
@@ -0,0 +1,295 @@
1
+ Model for the @pie-elements/image-cloze-association Interaction
2
+
3
+ The schema defines the following properties:
4
+
5
+ # `prompt` (string)
6
+
7
+ The question prompt or item stem
8
+
9
+ # `rationaleEnabled` (boolean)
10
+
11
+ Indicates if Rationale is enabled
12
+
13
+ # `spellCheckEnabled` (boolean, required)
14
+
15
+ Indicates if spellcheck is enabled for the author. Default value is true
16
+
17
+ # `teacherInstructionsEnabled` (boolean)
18
+
19
+ Indicates if Teacher Instructions are enabled
20
+
21
+ # `studentInstructionsEnabled` (boolean)
22
+
23
+ Indicates if Student Instructions are enabled
24
+
25
+ # `image` (object)
26
+
27
+ Properties of the `image` object:
28
+
29
+ ## `src` (string)
30
+
31
+ The url of the image
32
+
33
+ ## `width` (number)
34
+
35
+ The width of the image
36
+
37
+ ## `height` (number)
38
+
39
+ The height of the image
40
+
41
+ # `responseContainers` (array)
42
+
43
+ List of the response containers
44
+ The response containers are the areas where the images are dragged in
45
+
46
+ The object is an array with all elements of the type `object`.
47
+
48
+ The array object has the following properties:
49
+
50
+ ## `x` (number)
51
+
52
+ The x coordinate of the response container
53
+
54
+ ## `y` (number)
55
+
56
+ The y coordinate of the response container
57
+
58
+ ## `width` (string)
59
+
60
+ The width of the response container
61
+
62
+ ## `height` (string)
63
+
64
+ The height of the response container
65
+
66
+ # `stimulus` (string)
67
+
68
+ The question stimulus
69
+
70
+ # `possibleResponses` (array)
71
+
72
+ List of img tags that are the possible responses
73
+
74
+ The object is an array with all elements of the type `string`.
75
+
76
+ # `validation` (object)
77
+
78
+ Properties of the `validation` object:
79
+
80
+ ## `validResponse` (object)
81
+
82
+ Properties of the `validResponse` object:
83
+
84
+ ### `score` (number)
85
+
86
+ The score of the response
87
+
88
+ ### `value` (object)
89
+
90
+ The value of the response
91
+ Each value is an object with a property "images"
92
+
93
+ Properties of the `value` object:
94
+
95
+ #### `images` (array)
96
+
97
+ An array containing a string that is a img tag
98
+
99
+ The object is an array with all elements of the type `string`.
100
+
101
+ ## `altResponses` (array)
102
+
103
+ List of alternate responses
104
+
105
+ The object is an array with all elements of the type `object`.
106
+
107
+ The array object has the following properties:
108
+
109
+ ### `score` (number)
110
+
111
+ The score of the response
112
+
113
+ ### `value` (object)
114
+
115
+ The value of the response
116
+ Each value is an object with a property "images"
117
+
118
+ Properties of the `value` object:
119
+
120
+ #### `images` (array)
121
+
122
+ An array containing a string that is a img tag
123
+
124
+ The object is an array with all elements of the type `string`.
125
+
126
+ # `partialScoring` (boolean)
127
+
128
+ Indicates if the item should use partial scoring
129
+
130
+ # `maxResponsePerZone` (number)
131
+
132
+ Indicates how many responses can be placed in a response container
133
+
134
+ Default: `1`
135
+
136
+ # `duplicateResponses` (boolean)
137
+
138
+ Indicates if duplicate responses are allowed
139
+
140
+ # `showDashedBorder` (boolean)
141
+
142
+ Indicates if the response containers should have a dashed border
143
+
144
+ # `rubricEnabled` (boolean, required)
145
+
146
+ Indicates if Rubric is enabled
147
+
148
+ # `id` (string, required)
149
+
150
+ Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
151
+
152
+ # `element` (string, required)
153
+
154
+ The html Element tag name
155
+
156
+ ---
157
+
158
+ # Sub Schemas
159
+
160
+ The schema defines the following additional types:
161
+
162
+ ## `ConfigureMaxImageDimensionsProp` (object)
163
+
164
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
165
+
166
+ ### `teacherInstructions` (number)
167
+
168
+ Indicates the max dimension for images in teacher instructions
169
+
170
+ ### `prompt` (number)
171
+
172
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
173
+
174
+ ### `rationale` (number)
175
+
176
+ Indicates the max dimension for images in rationale
177
+
178
+ ## `ConfigureProp` (object)
179
+
180
+ Properties of the `ConfigureProp` object:
181
+
182
+ ### `settings` (boolean)
183
+
184
+ Indicates if the item has to be displayed in the Settings Panel
185
+
186
+ ### `label` (string)
187
+
188
+ Indicates the label for the item that has to be displayed in the Settings Panel
189
+
190
+ ## `Image` (object)
191
+
192
+ Properties of the `Image` object:
193
+
194
+ ### `src` (string)
195
+
196
+ The url of the image
197
+
198
+ ### `width` (number)
199
+
200
+ The width of the image
201
+
202
+ ### `height` (number)
203
+
204
+ The height of the image
205
+
206
+ ## `ResponseContainer` (object)
207
+
208
+ Properties of the `ResponseContainer` object:
209
+
210
+ ### `x` (number)
211
+
212
+ The x coordinate of the response container
213
+
214
+ ### `y` (number)
215
+
216
+ The y coordinate of the response container
217
+
218
+ ### `width` (string)
219
+
220
+ The width of the response container
221
+
222
+ ### `height` (string)
223
+
224
+ The height of the response container
225
+
226
+ ## `Validation` (object)
227
+
228
+ Properties of the `Validation` object:
229
+
230
+ ### `validResponse` (object)
231
+
232
+ Properties of the `validResponse` object:
233
+
234
+ #### `score` (number)
235
+
236
+ The score of the response
237
+
238
+ #### `value` (object)
239
+
240
+ The value of the response
241
+ Each value is an object with a property "images"
242
+
243
+ Properties of the `value` object:
244
+
245
+ ##### `images` (array)
246
+
247
+ An array containing a string that is a img tag
248
+
249
+ The object is an array with all elements of the type `string`.
250
+
251
+ ### `altResponses` (array)
252
+
253
+ List of alternate responses
254
+
255
+ The object is an array with all elements of the type `object`.
256
+
257
+ The array object has the following properties:
258
+
259
+ #### `score` (number)
260
+
261
+ The score of the response
262
+
263
+ #### `value` (object)
264
+
265
+ The value of the response
266
+ Each value is an object with a property "images"
267
+
268
+ Properties of the `value` object:
269
+
270
+ ##### `images` (array)
271
+
272
+ An array containing a string that is a img tag
273
+
274
+ The object is an array with all elements of the type `string`.
275
+
276
+ ## `ValidResponse` (object)
277
+
278
+ Properties of the `ValidResponse` object:
279
+
280
+ ### `score` (number)
281
+
282
+ The score of the response
283
+
284
+ ### `value` (object)
285
+
286
+ The value of the response
287
+ Each value is an object with a property "images"
288
+
289
+ Properties of the `value` object:
290
+
291
+ #### `images` (array)
292
+
293
+ An array containing a string that is a img tag
294
+
295
+ The object is an array with all elements of the type `string`.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/constants.js"],"names":["types","response"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE;AADL;AADM,C","sourcesContent":["export default {\n types: {\n response: 'react-dnd-response'\n }\n}\n"],"file":"constants.js"}
1
+ {"version":3,"sources":["../src/constants.js"],"names":["types","response"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE;AADL;AADM,C","sourcesContent":["export default {\n types: {\n response: 'react-dnd-response',\n },\n};\n"],"file":"constants.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/evaluation-icon.jsx"],"names":["getCorrectnessClass","isCorrect","filled","EvaluationIcon","classes","containerStyle","Icon","Check","Close","showCorrectness","undefined","correctness","icon","propTypes","PropTypes","object","bool","oneOfType","number","defaultProps","styles","correctEmpty","color","correct","correctFilled","background","backgroundColor","incorrectEmpty","incorrect","incorrectFilled"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,SAAD,EAAYC,MAAZ,EAAuB;AACjD,MAAIA,MAAJ,EAAY;AACV,WAAOD,SAAS,GAAG,eAAH,GAAqB,iBAArC;AACD;;AACD,SAAOA,SAAS,GAAG,cAAH,GAAoB,gBAApC;AACD,CALD;;AAOA,IAAME,cAAc,GAAG,SAAjBA,cAAiB,OAAoD;AAAA,MAAjDC,OAAiD,QAAjDA,OAAiD;AAAA,MAAxCC,cAAwC,QAAxCA,cAAwC;AAAA,MAAxBJ,SAAwB,QAAxBA,SAAwB;AAAA,MAAbC,MAAa,QAAbA,MAAa;AACzE,MAAMI,IAAI,GAAGL,SAAS,GAAGM,iBAAH,GAAWC,iBAAjC;AACA,MAAMC,eAAe,GAAGR,SAAS,KAAKS,SAAtC;AACA,MAAMC,WAAW,GAAGF,eAAe,GAAGT,mBAAmB,CAACC,SAAD,EAAYC,MAAZ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port { withStyles } from '@material-ui/core';\nimport Check from '@material-ui/icons/Check';\nimport Close from '@material-ui/icons/Close';\nimport { color } from '@pie-lib/render-ui';\n\nconst getCorrectnessClass = (isCorrect, filled) => {\n if (filled) {\n return isCorrect ? 'correctFilled' : 'incorrectFilled';\n }\n return isCorrect ? 'correctEmpty' : 'incorrectEmpty';\n};\n\nconst EvaluationIcon = ({ classes, containerStyle, isCorrect, filled }) => {\n const Icon = isCorrect ? Check : Close;\n const showCorrectness = isCorrect !== undefined;\n const correctness = showCorrectness ? getCorrectnessClass(isCorrect, filled) : '';\n\n return showCorrectness\n ? (\n <Icon\n className={`${classes.icon} ${classes[correctness]}`}\n style={containerStyle}\n />\n ) : null\n};\n\nEvaluationIcon.propTypes = {\n classes: PropTypes.object,\n containerStyle: PropTypes.object,\n filled: PropTypes.bool,\n isCorrect: PropTypes.oneOfType([\n PropTypes.bool,\n PropTypes.number\n ])\n};\n\nEvaluationIcon.defaultProps = {\n classes: {},\n containerStyle: {},\n filled: false,\n isCorrect: undefined\n};\n\nconst styles = () => ({\n correctEmpty: {\n color: color.correct()\n },\n correctFilled: {\n color: color.background(),\n backgroundColor: color.correct()\n },\n incorrectEmpty: {\n color: color.incorrect()\n },\n incorrectFilled: {\n color: color.background(),\n backgroundColor: color.incorrect()\n }\n});\n\nexport default withStyles(styles)(EvaluationIcon);\n"],"file":"evaluation-icon.js"}
1
+ {"version":3,"sources":["../src/evaluation-icon.jsx"],"names":["getCorrectnessClass","isCorrect","filled","EvaluationIcon","classes","containerStyle","Icon","Check","Close","showCorrectness","undefined","correctness","icon","propTypes","PropTypes","object","bool","oneOfType","number","defaultProps","styles","correctEmpty","color","correct","correctFilled","background","backgroundColor","incorrectEmpty","incorrect","incorrectFilled"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,SAAD,EAAYC,MAAZ,EAAuB;AACjD,MAAIA,MAAJ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,MAAAA,KAAK,EAAEA,gBAAMC,OAAN;AADK,KADM;AAIpBC,IAAAA,aAAa,EAAE;AACbF,MAAAA,KAAK,EAAEA,gBAAMG,UAAN,EADM;AAEbC,MAAAA,eAAe,EAAEJ,gBAAMC,OAAN;AAFJ,KAJK;AAQpBI,IAAAA,cAAc,EAAE;AACdL,MAAAA,KAAK,EAAEA,gBAAMM,SAAN;AADO,KARI;AAWpBC,IAAAA,eAAe,EAAE;AACfP,MAAAA,KAAK,EAAEA,gBAAMG,UAAN,EADQ;AAEfC,MAAAA,eAAe,EAAEJ,gBAAMM,SAAN;AAFF;AAXG,GAAP;AAAA,CAAf;;eAiBe,sBAAWR,MAAX,EAAmBjB,cAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core';\nimport Check from '@material-ui/icons/Check';\nimport Close from '@material-ui/icons/Close';\nimport { color } from '@pie-lib/render-ui';\n\nconst getCorrectnessClass = (isCorrect, filled) => {\n if (filled) {\n return isCorrect ? 'correctFilled' : 'incorrectFilled';\n }\n return isCorrect ? 'correctEmpty' : 'incorrectEmpty';\n};\n\nconst EvaluationIcon = ({ classes, containerStyle, isCorrect, filled }) => {\n const Icon = isCorrect ? Check : Close;\n const showCorrectness = isCorrect !== undefined;\n const correctness = showCorrectness ? getCorrectnessClass(isCorrect, filled) : '';\n\n return showCorrectness ? <Icon className={`${classes.icon} ${classes[correctness]}`} style={containerStyle} /> : null;\n};\n\nEvaluationIcon.propTypes = {\n classes: PropTypes.object,\n containerStyle: PropTypes.object,\n filled: PropTypes.bool,\n isCorrect: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),\n};\n\nEvaluationIcon.defaultProps = {\n classes: {},\n containerStyle: {},\n filled: false,\n isCorrect: undefined,\n};\n\nconst styles = () => ({\n correctEmpty: {\n color: color.correct(),\n },\n correctFilled: {\n color: color.background(),\n backgroundColor: color.correct(),\n },\n incorrectEmpty: {\n color: color.incorrect(),\n },\n incorrectFilled: {\n color: color.background(),\n backgroundColor: color.incorrect(),\n },\n});\n\nexport default withStyles(styles)(EvaluationIcon);\n"],"file":"evaluation-icon.js"}