@pie-element/multiple-choice 5.9.3-next.133 → 5.9.3-next.1332

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.
@@ -106,6 +106,22 @@
106
106
  }
107
107
  }
108
108
  },
109
+ "spellCheck": {
110
+ "title": "ConfigureProp",
111
+ "type": "object",
112
+ "properties": {
113
+ "settings": {
114
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
115
+ "type": "boolean",
116
+ "title": "settings"
117
+ },
118
+ "label": {
119
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
120
+ "type": "string",
121
+ "title": "label"
122
+ }
123
+ }
124
+ },
109
125
  "choicesLayout": {
110
126
  "title": "ConfigureProp",
111
127
  "type": "object",
@@ -255,6 +271,84 @@
255
271
  }
256
272
  }
257
273
  },
274
+ "accessibility": {
275
+ "title": "ConfigureProp",
276
+ "type": "object",
277
+ "properties": {
278
+ "settings": {
279
+ "description": "Indicates if the item has to be displayed in the Settings Panel",
280
+ "type": "boolean",
281
+ "title": "settings"
282
+ },
283
+ "label": {
284
+ "description": "Indicates the label for the item that has to be displayed in the Settings Panel",
285
+ "type": "string",
286
+ "title": "label"
287
+ }
288
+ }
289
+ },
290
+ "minAnswerChoices": {
291
+ "description": "Minimum number of answer choices",
292
+ "type": "number",
293
+ "title": "minAnswerChoices"
294
+ },
295
+ "maxAnswerChoices": {
296
+ "description": "Maximum number of answer choices",
297
+ "type": "number",
298
+ "title": "maxAnswerChoices"
299
+ },
300
+ "maxImageWidth": {
301
+ "title": "ConfigureMaxImageDimensionsProp",
302
+ "type": "object",
303
+ "properties": {
304
+ "teacherInstructions": {
305
+ "description": "Indicates the max dimension for images in teacher instructions",
306
+ "type": "number",
307
+ "title": "teacherInstructions"
308
+ },
309
+ "prompt": {
310
+ "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",
311
+ "type": "number",
312
+ "title": "prompt"
313
+ },
314
+ "rationale": {
315
+ "description": "Indicates the max dimension for images in rationale",
316
+ "type": "number",
317
+ "title": "rationale"
318
+ },
319
+ "choices": {
320
+ "description": "Indicates the max dimension for images in choices",
321
+ "type": "number",
322
+ "title": "choices"
323
+ }
324
+ }
325
+ },
326
+ "maxImageHeight": {
327
+ "title": "ConfigureMaxImageDimensionsProp",
328
+ "type": "object",
329
+ "properties": {
330
+ "teacherInstructions": {
331
+ "description": "Indicates the max dimension for images in teacher instructions",
332
+ "type": "number",
333
+ "title": "teacherInstructions"
334
+ },
335
+ "prompt": {
336
+ "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",
337
+ "type": "number",
338
+ "title": "prompt"
339
+ },
340
+ "rationale": {
341
+ "description": "Indicates the max dimension for images in rationale",
342
+ "type": "number",
343
+ "title": "rationale"
344
+ },
345
+ "choices": {
346
+ "description": "Indicates the max dimension for images in choices",
347
+ "type": "number",
348
+ "title": "choices"
349
+ }
350
+ }
351
+ },
258
352
  "showPrompt": {
259
353
  "description": "Determines whether prompt field will be displayed or not",
260
354
  "default": true,
@@ -305,6 +399,32 @@
305
399
  "title": "enabled"
306
400
  }
307
401
  }
402
+ },
403
+ "ConfigureMaxImageDimensionsProp": {
404
+ "title": "ConfigureMaxImageDimensionsProp",
405
+ "type": "object",
406
+ "properties": {
407
+ "teacherInstructions": {
408
+ "description": "Indicates the max dimension for images in teacher instructions",
409
+ "type": "number",
410
+ "title": "teacherInstructions"
411
+ },
412
+ "prompt": {
413
+ "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",
414
+ "type": "number",
415
+ "title": "prompt"
416
+ },
417
+ "rationale": {
418
+ "description": "Indicates the max dimension for images in rationale",
419
+ "type": "number",
420
+ "title": "rationale"
421
+ },
422
+ "choices": {
423
+ "description": "Indicates the max dimension for images in choices",
424
+ "type": "number",
425
+ "title": "choices"
426
+ }
427
+ }
308
428
  }
309
429
  },
310
430
  "$schema": "http://json-schema.org/draft-07/schema#"
@@ -84,6 +84,18 @@ Indicates if the item has to be displayed in the Settings Panel
84
84
 
85
85
  Indicates the label for the item that has to be displayed in the Settings Panel
86
86
 
87
+ # `spellCheck` (object)
88
+
89
+ Properties of the `spellCheck` object:
90
+
91
+ ## `settings` (boolean)
92
+
93
+ Indicates if the item has to be displayed in the Settings Panel
94
+
95
+ ## `label` (string)
96
+
97
+ Indicates the label for the item that has to be displayed in the Settings Panel
98
+
87
99
  # `choicesLayout` (object)
88
100
 
89
101
  Properties of the `choicesLayout` object:
@@ -197,6 +209,66 @@ Indicates the label for the item that has to be displayed in the Settings Panel
197
209
  Indicates the value of the item if it affects config-ui
198
210
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
199
211
 
212
+ # `accessibility` (object)
213
+
214
+ Properties of the `accessibility` object:
215
+
216
+ ## `settings` (boolean)
217
+
218
+ Indicates if the item has to be displayed in the Settings Panel
219
+
220
+ ## `label` (string)
221
+
222
+ Indicates the label for the item that has to be displayed in the Settings Panel
223
+
224
+ # `minAnswerChoices` (number)
225
+
226
+ Minimum number of answer choices
227
+
228
+ # `maxAnswerChoices` (number)
229
+
230
+ Maximum number of answer choices
231
+
232
+ # `maxImageWidth` (object)
233
+
234
+ Properties of the `maxImageWidth` object:
235
+
236
+ ## `teacherInstructions` (number)
237
+
238
+ Indicates the max dimension for images in teacher instructions
239
+
240
+ ## `prompt` (number)
241
+
242
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
243
+
244
+ ## `rationale` (number)
245
+
246
+ Indicates the max dimension for images in rationale
247
+
248
+ ## `choices` (number)
249
+
250
+ Indicates the max dimension for images in choices
251
+
252
+ # `maxImageHeight` (object)
253
+
254
+ Properties of the `maxImageHeight` object:
255
+
256
+ ## `teacherInstructions` (number)
257
+
258
+ Indicates the max dimension for images in teacher instructions
259
+
260
+ ## `prompt` (number)
261
+
262
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
263
+
264
+ ## `rationale` (number)
265
+
266
+ Indicates the max dimension for images in rationale
267
+
268
+ ## `choices` (number)
269
+
270
+ Indicates the max dimension for images in choices
271
+
200
272
  # `showPrompt` (boolean)
201
273
 
202
274
  Determines whether prompt field will be displayed or not
@@ -242,4 +314,24 @@ Indicates the label for the item that has to be displayed in the Settings Panel
242
314
  ### `enabled` (boolean)
243
315
 
244
316
  Indicates the value of the item if it affects config-ui
245
- (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
317
+ (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
318
+
319
+ ## `ConfigureMaxImageDimensionsProp` (object)
320
+
321
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
322
+
323
+ ### `teacherInstructions` (number)
324
+
325
+ Indicates the max dimension for images in teacher instructions
326
+
327
+ ### `prompt` (number)
328
+
329
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
330
+
331
+ ### `rationale` (number)
332
+
333
+ Indicates the max dimension for images in rationale
334
+
335
+ ### `choices` (number)
336
+
337
+ Indicates the max dimension for images in choices
@@ -163,6 +163,11 @@
163
163
  "type": "boolean",
164
164
  "title": "rationaleEnabled"
165
165
  },
166
+ "spellCheckEnabled": {
167
+ "description": "Indicates if spellcheck is enabled for the author. Default value is true",
168
+ "type": "boolean",
169
+ "title": "spellCheckEnabled"
170
+ },
166
171
  "studentInstructionsEnabled": {
167
172
  "description": "Indicates if Student Instructions are enabled",
168
173
  "type": "boolean",
@@ -173,6 +178,11 @@
173
178
  "type": "boolean",
174
179
  "title": "teacherInstructionsEnabled"
175
180
  },
181
+ "accessibilityLabelsEnabled": {
182
+ "description": "Indicates if Accessibility Labels are enabled",
183
+ "type": "boolean",
184
+ "title": "accessibilityLabelsEnabled"
185
+ },
176
186
  "id": {
177
187
  "description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
178
188
  "type": "string",
@@ -185,11 +195,13 @@
185
195
  }
186
196
  },
187
197
  "required": [
198
+ "accessibilityLabelsEnabled",
188
199
  "choices",
189
200
  "element",
190
201
  "feedbackEnabled",
191
202
  "id",
192
203
  "rationaleEnabled",
204
+ "spellCheckEnabled",
193
205
  "studentInstructionsEnabled",
194
206
  "teacherInstructionsEnabled"
195
207
  ],
@@ -231,6 +243,32 @@
231
243
  }
232
244
  }
233
245
  },
246
+ "ConfigureMaxImageDimensionsProp": {
247
+ "title": "ConfigureMaxImageDimensionsProp",
248
+ "type": "object",
249
+ "properties": {
250
+ "teacherInstructions": {
251
+ "description": "Indicates the max dimension for images in teacher instructions",
252
+ "type": "number",
253
+ "title": "teacherInstructions"
254
+ },
255
+ "prompt": {
256
+ "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",
257
+ "type": "number",
258
+ "title": "prompt"
259
+ },
260
+ "rationale": {
261
+ "description": "Indicates the max dimension for images in rationale",
262
+ "type": "number",
263
+ "title": "rationale"
264
+ },
265
+ "choices": {
266
+ "description": "Indicates the max dimension for images in choices",
267
+ "type": "number",
268
+ "title": "choices"
269
+ }
270
+ }
271
+ },
234
272
  "Choice": {
235
273
  "title": "Choice",
236
274
  "type": "object",
@@ -142,6 +142,10 @@ Indicates if feedback is enabled
142
142
 
143
143
  Indicates if Rationale are enabled
144
144
 
145
+ # `spellCheckEnabled` (boolean, required)
146
+
147
+ Indicates if spellcheck is enabled for the author. Default value is true
148
+
145
149
  # `studentInstructionsEnabled` (boolean, required)
146
150
 
147
151
  Indicates if Student Instructions are enabled
@@ -150,6 +154,10 @@ Indicates if Student Instructions are enabled
150
154
 
151
155
  Indicates if Teacher Instructions are enabled
152
156
 
157
+ # `accessibilityLabelsEnabled` (boolean, required)
158
+
159
+ Indicates if Accessibility Labels are enabled
160
+
153
161
  # `id` (string, required)
154
162
 
155
163
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -193,6 +201,26 @@ Indicates the label for the item that has to be displayed in the Settings Panel
193
201
  Indicates the value of the item if it affects config-ui
194
202
  (eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
195
203
 
204
+ ## `ConfigureMaxImageDimensionsProp` (object)
205
+
206
+ Properties of the `ConfigureMaxImageDimensionsProp` object:
207
+
208
+ ### `teacherInstructions` (number)
209
+
210
+ Indicates the max dimension for images in teacher instructions
211
+
212
+ ### `prompt` (number)
213
+
214
+ Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
215
+
216
+ ### `rationale` (number)
217
+
218
+ Indicates the max dimension for images in rationale
219
+
220
+ ### `choices` (number)
221
+
222
+ Indicates the max dimension for images in choices
223
+
196
224
  ## `Choice` (object)
197
225
 
198
226
  Properties of the `Choice` object:
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = exports.ChoiceInput = exports.StyledRadio = exports.StyledCheckbox = exports.StyledFormControlLabel = void 0;
8
+ exports["default"] = exports.StyledRadio = exports.StyledFormControlLabel = exports.StyledCheckbox = exports.ChoiceInput = void 0;
9
9
 
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
 
@@ -19,10 +19,10 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
19
19
 
20
20
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
21
 
22
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
22
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
25
23
 
24
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
+
26
26
  var _FormControlLabel = _interopRequireDefault(require("@material-ui/core/FormControlLabel"));
27
27
 
28
28
  var _react = _interopRequireDefault(require("react"));
@@ -43,11 +43,13 @@ var _classnames = _interopRequireDefault(require("classnames"));
43
43
 
44
44
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
45
45
 
46
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
46
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
47
+
48
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
47
49
 
48
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
50
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
49
51
 
50
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
52
+ var CLASS_NAME = 'multiple-choice-component';
51
53
 
52
54
  var styleSheet = function styleSheet() {
53
55
  return {
@@ -64,7 +66,10 @@ var styleSheet = function styleSheet() {
64
66
  '& label': {
65
67
  color: _renderUi.color.text()
66
68
  }
67
- }
69
+ },
70
+ horizontalLayout: (0, _defineProperty2["default"])({}, "& .".concat(CLASS_NAME), {
71
+ paddingRight: '8px'
72
+ })
68
73
  };
69
74
  };
70
75
 
@@ -85,7 +90,6 @@ var StyledFormControlLabel = (0, _styles.withStyles)(formStyleSheet, {
85
90
  }));
86
91
  });
87
92
  exports.StyledFormControlLabel = StyledFormControlLabel;
88
- var CLASS_NAME = 'multiple-choice-component';
89
93
 
90
94
  var colorStyle = function colorStyle(varName, fallback) {
91
95
  return (0, _defineProperty2["default"])({}, "&.".concat(CLASS_NAME), {
@@ -144,7 +148,7 @@ var StyledCheckbox = (0, _styles.withStyles)(inputStyles)(function (props) {
144
148
  classes: {
145
149
  root: resolved.root,
146
150
  checked: resolved.checked,
147
- disabled: resolved.disabled
151
+ disabled: "".concat(correctness ? '' : resolved.disabled)
148
152
  }
149
153
  }));
150
154
  });
@@ -177,7 +181,8 @@ var StyledRadio = (0, _styles.withStyles)(inputStyles)(function (props) {
177
181
  className: CLASS_NAME,
178
182
  classes: {
179
183
  root: resolved.root,
180
- checked: resolved.checked
184
+ checked: resolved.checked,
185
+ disabled: "".concat(correctness ? '' : resolved.disabled)
181
186
  }
182
187
  }));
183
188
  });
@@ -219,17 +224,21 @@ var ChoiceInput = /*#__PURE__*/function (_React$Component) {
219
224
  classes = _this$props.classes,
220
225
  className = _this$props.className,
221
226
  rationale = _this$props.rationale,
222
- accessibility = _this$props.accessibility;
227
+ accessibility = _this$props.accessibility,
228
+ hideTick = _this$props.hideTick,
229
+ isEvaluateMode = _this$props.isEvaluateMode,
230
+ choicesLayout = _this$props.choicesLayout;
223
231
  var Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;
224
232
  var classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';
233
+ var holderClassNames = (0, _classnames["default"])(classes.checkboxHolder, (0, _defineProperty2["default"])({}, classes.horizontalLayout, choicesLayout === 'horizontal'));
225
234
  return /*#__PURE__*/_react["default"].createElement("div", {
226
- className: (0, _classnames["default"])(className, 'corespring-' + classSuffix)
235
+ className: (0, _classnames["default"])(className, 'corespring-' + classSuffix, 'choice-input')
227
236
  }, /*#__PURE__*/_react["default"].createElement("div", {
228
237
  className: classes.row
229
- }, /*#__PURE__*/_react["default"].createElement(_feedbackTick["default"], {
238
+ }, !hideTick && isEvaluateMode && /*#__PURE__*/_react["default"].createElement(_feedbackTick["default"], {
230
239
  correctness: correctness
231
240
  }), /*#__PURE__*/_react["default"].createElement("div", {
232
- className: classes.checkboxHolder
241
+ className: (0, _classnames["default"])(holderClassNames, 'checkbox-holder')
233
242
  }, /*#__PURE__*/_react["default"].createElement(StyledFormControlLabel, {
234
243
  disabled: disabled,
235
244
  label: displayKey ? displayKey + '. ' : '',
@@ -246,6 +255,7 @@ var ChoiceInput = /*#__PURE__*/function (_React$Component) {
246
255
  tagName: "span"
247
256
  }))), rationale && /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
248
257
  className: "rationale",
258
+ defaultClassName: "rationale",
249
259
  prompt: rationale
250
260
  }), /*#__PURE__*/_react["default"].createElement(_renderUi.Feedback, {
251
261
  feedback: feedback,
@@ -270,12 +280,16 @@ exports.ChoiceInput = ChoiceInput;
270
280
  onChange: _propTypes["default"].func.isRequired,
271
281
  value: _propTypes["default"].string.isRequired,
272
282
  classes: _propTypes["default"].object,
273
- className: _propTypes["default"].string
283
+ className: _propTypes["default"].string,
284
+ hideTick: _propTypes["default"].bool,
285
+ isEvaluateMode: _propTypes["default"].bool,
286
+ choicesLayout: _propTypes["default"].oneOf(['vertical', 'grid', 'horizontal'])
274
287
  });
275
288
  (0, _defineProperty2["default"])(ChoiceInput, "defaultProps", {
276
289
  rationale: null,
277
290
  accessibility: null,
278
- checked: false
291
+ checked: false,
292
+ isEvaluateMode: false
279
293
  });
280
294
 
281
295
  var _default = (0, _styles.withStyles)(styleSheet)(ChoiceInput);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/choice-input.jsx"],"names":["styleSheet","row","display","alignItems","backgroundColor","color","background","checkboxHolder","flex","text","formStyleSheet","label","StyledFormControlLabel","name","props","classes","CLASS_NAME","colorStyle","varName","fallback","inputStyles","correct","disabled","incorrect","root","primaryLight","checked","primary","opacity","cursor","pointerEvents","StyledCheckbox","correctness","onChange","accessibility","key","k","resolved","miniProps","StyledRadio","ChoiceInput","onToggleChoice","bind","value","selected","choiceMode","displayKey","feedback","className","rationale","Tag","classSuffix","React","Component","PropTypes","oneOf","string","isRequired","bool","func","object"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,UAAU,GAAG,SAAbA,UAAa;AAAA,SAAO;AACxBC,IAAAA,GAAG,EAAE;AACHC,MAAAA,OAAO,EAAE,MADN;AAEHC,MAAAA,UAAU,EAAE,QAFT;AAGHC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN;AAHd,KADmB;AAMxBC,IAAAA,cAAc,EAAE;AACdL,MAAAA,OAAO,EAAE,MADK;AAEdC,MAAAA,UAAU,EAAE,QAFE;AAGdC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EAHH;AAIdE,MAAAA,IAAI,EAAE,CAJQ;AAKd,iBAAW;AACTH,QAAAA,KAAK,EAAEA,gBAAMI,IAAN;AADE;AALG;AANQ,GAAP;AAAA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,EAAEoB,sBAAUE,MATR;AAUjBvB,EAAAA,QAAQ,EAAEqB,sBAAUK,IAAV,CAAeF,UAVR;AAWjBd,EAAAA,KAAK,EAAEW,sBAAUE,MAAV,CAAiBC,UAXP;AAYjB1C,EAAAA,OAAO,EAAEuC,sBAAUM,MAZF;AAajBZ,EAAAA,SAAS,EAAEM,sBAAUE;AAbJ,C;iCADRhB,W,kBAiBW;AACpBS,EAAAA,SAAS,EAAE,IADS;AAEpBf,EAAAA,aAAa,EAAE,IAFK;AAGpBR,EAAAA,OAAO,EAAE;AAHW,C;;eAsET,wBAAW1B,UAAX,EAAuBwC,WAAvB,C","sourcesContent":["import FormControlLabel from '@material-ui/core/FormControlLabel';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\n\nimport Checkbox from '@material-ui/core/Checkbox';\nimport { Feedback, color, PreviewPrompt } from '@pie-lib/render-ui';\nimport FeedbackTick from './feedback-tick';\nimport Radio from '@material-ui/core/Radio';\nimport classNames from 'classnames';\n\nconst styleSheet = () => ({\n row: {\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n },\n checkboxHolder: {\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n flex: 1,\n '& label': {\n color: color.text(),\n },\n },\n});\n\nconst formStyleSheet = {\n label: {\n color: `${color.text()} !important`, //'var(--choice-input-color, black)'\n backgroundColor: color.background(),\n },\n};\n\nexport const StyledFormControlLabel = withStyles(formStyleSheet, {\n name: 'FormControlLabel',\n})((props) => (\n <FormControlLabel {...props} classes={{ label: props.classes.label }} />\n));\n\nconst CLASS_NAME = 'multiple-choice-component';\n\nconst colorStyle = (varName, fallback) => ({\n [`&.${CLASS_NAME}`]: {\n color: `var(--choice-input-${varName}, ${fallback}) !important`,\n },\n});\n\nconst inputStyles = {\n 'correct-root': colorStyle('correct-color', color.text()),\n 'correct-checked': colorStyle('correct-selected-color', color.correct()), //green[500]),\n 'correct-disabled': colorStyle('correct-disabled-color', color.disabled()), //'grey'),\n 'incorrect-root': colorStyle('incorrect-color', color.incorrect()),\n 'incorrect-checked': colorStyle('incorrect-checked', color.incorrect()), //orange[500]),\n 'incorrect-disabled': colorStyle(\n 'incorrect-disabled-color',\n color.disabled()\n ),\n root: {\n ...colorStyle('color', color.text()),\n '&:hover': { color: `${color.primaryLight()} !important` },\n },\n checked: colorStyle('selected-color', color.primary()),\n disabled: {\n ...colorStyle('disabled-color', color.text()),\n opacity: 0.6,\n cursor: 'not-allowed !important',\n pointerEvents: 'initial !important',\n },\n};\n\nexport const StyledCheckbox = withStyles(inputStyles)((props) => {\n const { correctness, classes, checked, onChange, disabled, accessibility } = props;\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n const resolved = {\n root: classes[key('root')],\n checked: classes[key('checked')],\n disabled: classes[key('disabled')],\n };\n\n const miniProps = { checked, onChange, disabled };\n return (\n <Checkbox\n aria-label={accessibility}\n {...miniProps}\n className={CLASS_NAME}\n classes={{\n root: resolved.root,\n checked: resolved.checked,\n disabled: resolved.disabled,\n }}\n />\n );\n});\n\nexport const StyledRadio = withStyles(inputStyles)((props) => {\n const { correctness, classes, checked, onChange, disabled, accessibility } = props;\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n const resolved = {\n root: classes[key('root')],\n checked: classes[key('checked')],\n disabled: classes[key('disabled')],\n };\n\n const miniProps = { checked, onChange, disabled };\n\n return (\n <Radio\n aria-label={accessibility}\n {...miniProps}\n className={CLASS_NAME}\n classes={{\n root: resolved.root,\n checked: resolved.checked,\n }}\n />\n );\n});\n\nexport class ChoiceInput extends React.Component {\n static propTypes = {\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n displayKey: PropTypes.string.isRequired,\n checked: PropTypes.bool.isRequired,\n correctness: PropTypes.string,\n disabled: PropTypes.bool.isRequired,\n feedback: PropTypes.string,\n label: PropTypes.string.isRequired,\n rationale: PropTypes.string,\n accessibility: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n value: PropTypes.string.isRequired,\n classes: PropTypes.object,\n className: PropTypes.string,\n };\n\n static defaultProps = {\n rationale: null,\n accessibility: null,\n checked: false,\n };\n\n constructor(props) {\n super(props);\n this.onToggleChoice = this.onToggleChoice.bind(this);\n }\n\n onToggleChoice() {\n this.props.onChange({\n value: this.props.value,\n selected: !this.props.checked,\n });\n }\n\n render() {\n const {\n choiceMode,\n disabled,\n displayKey,\n feedback,\n label,\n checked,\n correctness,\n classes,\n className,\n rationale,\n accessibility,\n } = this.props;\n\n const Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;\n const classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';\n\n return (\n <div className={classNames(className, 'corespring-' + classSuffix)}>\n <div className={classes.row}>\n <FeedbackTick correctness={correctness} />\n <div className={classes.checkboxHolder}>\n <StyledFormControlLabel\n disabled={disabled}\n label={displayKey ? displayKey + '. ' : ''}\n control={\n <Tag\n accessibility={accessibility}\n checked={checked}\n correctness={correctness}\n onChange={this.onToggleChoice}\n />\n }\n />\n <PreviewPrompt\n className=\"label\"\n onClick={this.onToggleChoice}\n prompt={label}\n tagName=\"span\"\n />\n </div>\n </div>\n {rationale && (\n <PreviewPrompt className=\"rationale\" prompt={rationale} />\n )}\n <Feedback feedback={feedback} correctness={correctness} />\n </div>\n );\n }\n}\n\nexport default withStyles(styleSheet)(ChoiceInput);\n"],"file":"choice-input.js"}
1
+ {"version":3,"sources":["../src/choice-input.jsx"],"names":["CLASS_NAME","styleSheet","row","display","alignItems","backgroundColor","color","background","checkboxHolder","flex","text","horizontalLayout","paddingRight","formStyleSheet","label","StyledFormControlLabel","name","props","classes","colorStyle","varName","fallback","inputStyles","correct","disabled","incorrect","root","primaryLight","checked","primary","opacity","cursor","pointerEvents","StyledCheckbox","correctness","onChange","accessibility","key","k","resolved","miniProps","StyledRadio","ChoiceInput","onToggleChoice","bind","value","selected","choiceMode","displayKey","feedback","className","rationale","hideTick","isEvaluateMode","choicesLayout","Tag","classSuffix","holderClassNames","React","Component","PropTypes","oneOf","string","isRequired","bool","func","object"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,UAAU,GAAG,2BAAnB;;AAEA,IAAMC,UAAU,GAAG,SAAbA,UAAa;AAAA,SAAO;AACxBC,IAAAA,GAAG,EAAE;AACHC,MAAAA,OAAO,EAAE,MADN;AAEHC,MAAAA,UAAU,EAAE,QAFT;AAGHC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN;AAHd,KADmB;AAMxBC,IAAAA,cAAc,EAAE;AACdL,MAAAA,OAAO,EAAE,MADK;AAEdC,MAAAA,UAAU,EAAE,QAFE;AAGdC,MAAAA,eAAe,EAAEC,gBAAMC,UAAN,EAHH;AAIdE,MAAAA,IAAI,EAAE,CAJQ;AAKd,iBAAW;AACTH,QAAAA,KAAK,EAAEA,gBAAMI,IAAN;AADE;AALG,KANQ;AAexBC,IAAAA,gBAAgB,oDACPX,UADO,GACQ;AACpBY,MAAAA,YAAY,EAAE;AADM,KADR;AAfQ,GAAP;AAAA,CAAnB;;AAsBA,IAAMC,cAAc,GAAG;AACrBC,EAAAA,KAAK,EAAE;AACLR,IAAAA,KAAK,YAAKA,gBAAMI,IAAN,EAAL,gBADA;AACgC;AACrCL,IAAAA,eAAe,EAAEC,gBAAMC,UAAN;AAFZ;AADc,CAAvB;AAOO,IAAMQ,sBAAsB,GAAG,wBAAWF,cAAX,EAA2B;AAC/DG,EAAAA,IAAI,EAAE;AADyD,CAA3B,EAEnC,UAACC,KAAD;AAAA,sBACD,gCAAC,4BAAD,gCAAsBA,KAAtB;AAA6B,IAAA,OAAO,EAAE;AAAEH,MAAAA,KAAK,EAAEG,KAAK,CAACC,OAAN,CAAcJ;AAAvB;AAAtC,KADC;AAAA,CAFmC,CAA/B;;;AAMP,IAAMK,UAAU,GAAG,SAAbA,UAAa,CAACC,OAAD,EAAUC,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sBAAUE,MAAV,CAAiBC,UAXP;AAYjB7C,EAAAA,OAAO,EAAE0C,sBAAUM,MAZF;AAajBhB,EAAAA,SAAS,EAAEU,sBAAUE,MAbJ;AAcjBV,EAAAA,QAAQ,EAAEQ,sBAAUI,IAdH;AAejBX,EAAAA,cAAc,EAAEO,sBAAUI,IAfT;AAgBjBV,EAAAA,aAAa,EAAEM,sBAAUC,KAAV,CAAgB,CAAC,UAAD,EAAa,MAAb,EAAqB,YAArB,CAAhB;AAhBE,C;iCADRnB,W,kBAoBW;AACpBS,EAAAA,SAAS,EAAE,IADS;AAEpBf,EAAAA,aAAa,EAAE,IAFK;AAGpBR,EAAAA,OAAO,EAAE,KAHW;AAIpByB,EAAAA,cAAc,EAAE;AAJI,C;;eA8ET,wBAAWpD,UAAX,EAAuByC,WAAvB,C","sourcesContent":["import FormControlLabel from '@material-ui/core/FormControlLabel';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\n\nimport Checkbox from '@material-ui/core/Checkbox';\nimport { Feedback, color, PreviewPrompt } from '@pie-lib/render-ui';\nimport FeedbackTick from './feedback-tick';\nimport Radio from '@material-ui/core/Radio';\nimport classNames from 'classnames';\n\nconst CLASS_NAME = 'multiple-choice-component';\n\nconst styleSheet = () => ({\n row: {\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n },\n checkboxHolder: {\n display: 'flex',\n alignItems: 'center',\n backgroundColor: color.background(),\n flex: 1,\n '& label': {\n color: color.text(),\n },\n },\n horizontalLayout: {\n [`& .${CLASS_NAME}`]: {\n paddingRight: '8px',\n }\n }\n});\n\nconst formStyleSheet = {\n label: {\n color: `${color.text()} !important`, //'var(--choice-input-color, black)'\n backgroundColor: color.background(),\n },\n};\n\nexport const StyledFormControlLabel = withStyles(formStyleSheet, {\n name: 'FormControlLabel',\n})((props) => (\n <FormControlLabel {...props} classes={{ label: props.classes.label }} />\n));\n\nconst colorStyle = (varName, fallback) => ({\n [`&.${CLASS_NAME}`]: {\n color: `var(--choice-input-${varName}, ${fallback}) !important`,\n },\n});\n\nconst inputStyles = {\n 'correct-root': colorStyle('correct-color', color.text()),\n 'correct-checked': colorStyle('correct-selected-color', color.correct()), //green[500]),\n 'correct-disabled': colorStyle('correct-disabled-color', color.disabled()), //'grey'),\n 'incorrect-root': colorStyle('incorrect-color', color.incorrect()),\n 'incorrect-checked': colorStyle('incorrect-checked', color.incorrect()), //orange[500]),\n 'incorrect-disabled': colorStyle(\n 'incorrect-disabled-color',\n color.disabled()\n ),\n root: {\n ...colorStyle('color', color.text()),\n '&:hover': { color: `${color.primaryLight()} !important` },\n },\n checked: colorStyle('selected-color', color.primary()),\n disabled: {\n ...colorStyle('disabled-color', color.text()),\n opacity: 0.6,\n cursor: 'not-allowed !important',\n pointerEvents: 'initial !important',\n },\n};\n\nexport const StyledCheckbox = withStyles(inputStyles)((props) => {\n const {\n correctness,\n classes,\n checked,\n onChange,\n disabled,\n accessibility,\n } = props;\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n const resolved = {\n root: classes[key('root')],\n checked: classes[key('checked')],\n disabled: classes[key('disabled')],\n };\n\n const miniProps = { checked, onChange, disabled };\n return (\n <Checkbox\n aria-label={accessibility}\n {...miniProps}\n className={CLASS_NAME}\n classes={{\n root: resolved.root,\n checked: resolved.checked,\n disabled: `${correctness ? '' : resolved.disabled}`,\n }}\n />\n );\n});\n\nexport const StyledRadio = withStyles(inputStyles)((props) => {\n const {\n correctness,\n classes,\n checked,\n onChange,\n disabled,\n accessibility,\n } = props;\n const key = (k) => (correctness ? `${correctness}-${k}` : k);\n\n const resolved = {\n root: classes[key('root')],\n checked: classes[key('checked')],\n disabled: classes[key('disabled')],\n };\n\n const miniProps = { checked, onChange, disabled };\n\n return (\n <Radio\n aria-label={accessibility}\n {...miniProps}\n className={CLASS_NAME}\n classes={{\n root: resolved.root,\n checked: resolved.checked,\n disabled: `${correctness ? '' : resolved.disabled}`,\n }}\n />\n );\n});\n\nexport class ChoiceInput extends React.Component {\n static propTypes = {\n choiceMode: PropTypes.oneOf(['radio', 'checkbox']),\n displayKey: PropTypes.string.isRequired,\n checked: PropTypes.bool.isRequired,\n correctness: PropTypes.string,\n disabled: PropTypes.bool.isRequired,\n feedback: PropTypes.string,\n label: PropTypes.string.isRequired,\n rationale: PropTypes.string,\n accessibility: PropTypes.string,\n onChange: PropTypes.func.isRequired,\n value: PropTypes.string.isRequired,\n classes: PropTypes.object,\n className: PropTypes.string,\n hideTick: PropTypes.bool,\n isEvaluateMode: PropTypes.bool,\n choicesLayout: PropTypes.oneOf(['vertical', 'grid', 'horizontal']),\n };\n\n static defaultProps = {\n rationale: null,\n accessibility: null,\n checked: false,\n isEvaluateMode: false,\n };\n\n constructor(props) {\n super(props);\n this.onToggleChoice = this.onToggleChoice.bind(this);\n }\n\n onToggleChoice() {\n this.props.onChange({\n value: this.props.value,\n selected: !this.props.checked,\n });\n }\n\n render() {\n const {\n choiceMode,\n disabled,\n displayKey,\n feedback,\n label,\n checked,\n correctness,\n classes,\n className,\n rationale,\n accessibility,\n hideTick,\n isEvaluateMode,\n choicesLayout\n } = this.props;\n\n const Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;\n const classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';\n\n const holderClassNames = classNames(classes.checkboxHolder, {\n [classes.horizontalLayout]: choicesLayout === 'horizontal',\n });\n\n return (\n <div className={classNames(className, 'corespring-' + classSuffix, 'choice-input')}>\n <div className={classes.row}>\n {(!hideTick && isEvaluateMode) && <FeedbackTick correctness={correctness} />}\n <div className={classNames(holderClassNames, 'checkbox-holder')}>\n <StyledFormControlLabel\n disabled={disabled}\n label={displayKey ? displayKey + '. ' : ''}\n control={\n <Tag\n accessibility={accessibility}\n checked={checked}\n correctness={correctness}\n onChange={this.onToggleChoice}\n />\n }\n />\n <PreviewPrompt\n className=\"label\"\n onClick={this.onToggleChoice}\n prompt={label}\n tagName=\"span\"\n />\n </div>\n </div>\n {rationale && (\n <PreviewPrompt className=\"rationale\" defaultClassName=\"rationale\" prompt={rationale} />\n )}\n <Feedback feedback={feedback} correctness={correctness} />\n </div>\n );\n }\n}\n\nexport default withStyles(styleSheet)(ChoiceInput);\n"],"file":"choice-input.js"}