@pie-element/multiple-choice 5.9.3-next.467 → 5.9.3-next.477

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.
@@ -0,0 +1,2003 @@
1
+ import {_dll_prop_types, _dll_react_dom, _dll_react, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_material_ui__core, _dll_classnames, _dll_pie_lib__correct_answer_toggle, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.2.14/module/index.js";
2
+ import {_dll_pie_lib__math_rendering} from "../../../@pie-lib/math-rendering-module@^1.0.17/module/index.js";
3
+ function getDefaultExportFromCjs(x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
+ }
6
+ function getAugmentedNamespace(n) {
7
+ if (n.__esModule) return n;
8
+ var a = Object.defineProperty({}, '__esModule', {
9
+ value: true
10
+ });
11
+ Object.keys(n).forEach(function (k) {
12
+ var d = Object.getOwnPropertyDescriptor(n, k);
13
+ Object.defineProperty(a, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () {
16
+ return n[k];
17
+ }
18
+ });
19
+ });
20
+ return a;
21
+ }
22
+ var CSSTransition = {
23
+ exports: {}
24
+ };
25
+ var addClass = {
26
+ exports: {}
27
+ };
28
+ var interopRequireDefault = {
29
+ exports: {}
30
+ };
31
+ (function (module) {
32
+ function _interopRequireDefault(obj) {
33
+ return obj && obj.__esModule ? obj : {
34
+ "default": obj
35
+ };
36
+ }
37
+ module.exports = _interopRequireDefault;
38
+ (module.exports["default"] = module.exports, module.exports.__esModule = true);
39
+ })(interopRequireDefault);
40
+ getDefaultExportFromCjs(interopRequireDefault.exports);
41
+ var hasClass = {
42
+ exports: {}
43
+ };
44
+ (function (module, exports) {
45
+ exports.__esModule = true;
46
+ exports.default = hasClass;
47
+ function hasClass(element, className) {
48
+ if (element.classList) return !!className && element.classList.contains(className); else return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
49
+ }
50
+ module.exports = exports["default"];
51
+ })(hasClass, hasClass.exports);
52
+ getDefaultExportFromCjs(hasClass.exports);
53
+ (function (module, exports) {
54
+ var _interopRequireDefault = interopRequireDefault.exports;
55
+ exports.__esModule = true;
56
+ exports.default = addClass;
57
+ var _hasClass = _interopRequireDefault(hasClass.exports);
58
+ function addClass(element, className) {
59
+ if (element.classList) element.classList.add(className); else if (!(0, _hasClass.default)(element, className)) if (typeof element.className === 'string') element.className = element.className + ' ' + className; else element.setAttribute('class', (element.className && element.className.baseVal || '') + ' ' + className);
60
+ }
61
+ module.exports = exports["default"];
62
+ })(addClass, addClass.exports);
63
+ getDefaultExportFromCjs(addClass.exports);
64
+ function replaceClassName(origClass, classToRemove) {
65
+ return origClass.replace(new RegExp('(^|\\s)' + classToRemove + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
66
+ }
67
+ var removeClass = function removeClass(element, className) {
68
+ if (element.classList) element.classList.remove(className); else if (typeof element.className === 'string') element.className = replaceClassName(element.className, className); else element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
69
+ };
70
+ var Transition$1 = {};
71
+ function componentWillMount() {
72
+ var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
73
+ if (state !== null && state !== undefined) {
74
+ this.setState(state);
75
+ }
76
+ }
77
+ function componentWillReceiveProps(nextProps) {
78
+ function updater(prevState) {
79
+ var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
80
+ return state !== null && state !== undefined ? state : null;
81
+ }
82
+ this.setState(updater.bind(this));
83
+ }
84
+ function componentWillUpdate(nextProps, nextState) {
85
+ try {
86
+ var prevProps = this.props;
87
+ var prevState = this.state;
88
+ this.props = nextProps;
89
+ this.state = nextState;
90
+ this.__reactInternalSnapshotFlag = true;
91
+ this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(prevProps, prevState);
92
+ } finally {
93
+ this.props = prevProps;
94
+ this.state = prevState;
95
+ }
96
+ }
97
+ componentWillMount.__suppressDeprecationWarning = true;
98
+ componentWillReceiveProps.__suppressDeprecationWarning = true;
99
+ componentWillUpdate.__suppressDeprecationWarning = true;
100
+ function polyfill(Component) {
101
+ var prototype = Component.prototype;
102
+ if (!prototype || !prototype.isReactComponent) {
103
+ throw new Error('Can only polyfill class components');
104
+ }
105
+ if (typeof Component.getDerivedStateFromProps !== 'function' && typeof prototype.getSnapshotBeforeUpdate !== 'function') {
106
+ return Component;
107
+ }
108
+ var foundWillMountName = null;
109
+ var foundWillReceivePropsName = null;
110
+ var foundWillUpdateName = null;
111
+ if (typeof prototype.componentWillMount === 'function') {
112
+ foundWillMountName = 'componentWillMount';
113
+ } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
114
+ foundWillMountName = 'UNSAFE_componentWillMount';
115
+ }
116
+ if (typeof prototype.componentWillReceiveProps === 'function') {
117
+ foundWillReceivePropsName = 'componentWillReceiveProps';
118
+ } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
119
+ foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
120
+ }
121
+ if (typeof prototype.componentWillUpdate === 'function') {
122
+ foundWillUpdateName = 'componentWillUpdate';
123
+ } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
124
+ foundWillUpdateName = 'UNSAFE_componentWillUpdate';
125
+ }
126
+ if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
127
+ var componentName = Component.displayName || Component.name;
128
+ var newApiName = typeof Component.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
129
+ throw Error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + componentName + ' uses ' + newApiName + ' but also contains the following legacy lifecycles:' + (foundWillMountName !== null ? '\n ' + foundWillMountName : '') + (foundWillReceivePropsName !== null ? '\n ' + foundWillReceivePropsName : '') + (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') + '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' + 'https://fb.me/react-async-component-lifecycle-hooks');
130
+ }
131
+ if (typeof Component.getDerivedStateFromProps === 'function') {
132
+ prototype.componentWillMount = componentWillMount;
133
+ prototype.componentWillReceiveProps = componentWillReceiveProps;
134
+ }
135
+ if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
136
+ if (typeof prototype.componentDidUpdate !== 'function') {
137
+ throw new Error('Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype');
138
+ }
139
+ prototype.componentWillUpdate = componentWillUpdate;
140
+ var componentDidUpdate = prototype.componentDidUpdate;
141
+ prototype.componentDidUpdate = function componentDidUpdatePolyfill(prevProps, prevState, maybeSnapshot) {
142
+ var snapshot = this.__reactInternalSnapshotFlag ? this.__reactInternalSnapshot : maybeSnapshot;
143
+ componentDidUpdate.call(this, prevProps, prevState, snapshot);
144
+ };
145
+ }
146
+ return Component;
147
+ }
148
+ var reactLifecyclesCompat_es = Object.freeze({
149
+ __proto__: null,
150
+ polyfill: polyfill
151
+ });
152
+ var require$$2$2 = getAugmentedNamespace(reactLifecyclesCompat_es);
153
+ var PropTypes$6 = {};
154
+ const require$$0$5 = _dll_prop_types;
155
+ PropTypes$6.__esModule = true;
156
+ PropTypes$6.classNamesShape = PropTypes$6.timeoutsShape = void 0;
157
+ var _propTypes = _interopRequireDefault$2(require$$0$5);
158
+ function _interopRequireDefault$2(obj) {
159
+ return obj && obj.__esModule ? obj : {
160
+ default: obj
161
+ };
162
+ }
163
+ var timeoutsShape = _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
164
+ enter: _propTypes.default.number,
165
+ exit: _propTypes.default.number,
166
+ appear: _propTypes.default.number
167
+ }).isRequired]);
168
+ PropTypes$6.timeoutsShape = timeoutsShape;
169
+ var classNamesShape = _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({
170
+ enter: _propTypes.default.string,
171
+ exit: _propTypes.default.string,
172
+ active: _propTypes.default.string
173
+ }), _propTypes.default.shape({
174
+ enter: _propTypes.default.string,
175
+ enterDone: _propTypes.default.string,
176
+ enterActive: _propTypes.default.string,
177
+ exit: _propTypes.default.string,
178
+ exitDone: _propTypes.default.string,
179
+ exitActive: _propTypes.default.string
180
+ })]);
181
+ PropTypes$6.classNamesShape = classNamesShape;
182
+ const require$$0$4 = _dll_prop_types;
183
+ const require$$1$2 = _dll_react;
184
+ const require$$2$1 = _dll_react_dom;
185
+ Transition$1.__esModule = true;
186
+ Transition$1.default = Transition$1.EXITING = Transition$1.ENTERED = Transition$1.ENTERING = Transition$1.EXITED = Transition$1.UNMOUNTED = void 0;
187
+ var PropTypes$5 = _interopRequireWildcard(require$$0$4);
188
+ var _react$1 = _interopRequireDefault$1(require$$1$2);
189
+ var _reactDom = _interopRequireDefault$1(require$$2$1);
190
+ var _reactLifecyclesCompat = require$$2$2;
191
+ var _PropTypes = PropTypes$6;
192
+ function _interopRequireDefault$1(obj) {
193
+ return obj && obj.__esModule ? obj : {
194
+ default: obj
195
+ };
196
+ }
197
+ function _interopRequireWildcard(obj) {
198
+ if (obj && obj.__esModule) {
199
+ return obj;
200
+ } else {
201
+ var newObj = {};
202
+ if (obj != null) {
203
+ for (var key in obj) {
204
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
205
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
206
+ if (desc.get || desc.set) {
207
+ Object.defineProperty(newObj, key, desc);
208
+ } else {
209
+ newObj[key] = obj[key];
210
+ }
211
+ }
212
+ }
213
+ }
214
+ newObj.default = obj;
215
+ return newObj;
216
+ }
217
+ }
218
+ function _objectWithoutPropertiesLoose(source, excluded) {
219
+ if (source == null) return {};
220
+ var target = {};
221
+ var sourceKeys = Object.keys(source);
222
+ var key, i;
223
+ for (i = 0; i < sourceKeys.length; i++) {
224
+ key = sourceKeys[i];
225
+ if (excluded.indexOf(key) >= 0) continue;
226
+ target[key] = source[key];
227
+ }
228
+ return target;
229
+ }
230
+ function _inheritsLoose(subClass, superClass) {
231
+ subClass.prototype = Object.create(superClass.prototype);
232
+ subClass.prototype.constructor = subClass;
233
+ subClass.__proto__ = superClass;
234
+ }
235
+ var UNMOUNTED = 'unmounted';
236
+ Transition$1.UNMOUNTED = UNMOUNTED;
237
+ var EXITED = 'exited';
238
+ Transition$1.EXITED = EXITED;
239
+ var ENTERING = 'entering';
240
+ Transition$1.ENTERING = ENTERING;
241
+ var ENTERED = 'entered';
242
+ Transition$1.ENTERED = ENTERED;
243
+ var EXITING = 'exiting';
244
+ Transition$1.EXITING = EXITING;
245
+ var Transition = (function (_React$Component) {
246
+ _inheritsLoose(Transition, _React$Component);
247
+ function Transition(props, context) {
248
+ var _this;
249
+ _this = _React$Component.call(this, props, context) || this;
250
+ var parentGroup = context.transitionGroup;
251
+ var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
252
+ var initialStatus;
253
+ _this.appearStatus = null;
254
+ if (props.in) {
255
+ if (appear) {
256
+ initialStatus = EXITED;
257
+ _this.appearStatus = ENTERING;
258
+ } else {
259
+ initialStatus = ENTERED;
260
+ }
261
+ } else {
262
+ if (props.unmountOnExit || props.mountOnEnter) {
263
+ initialStatus = UNMOUNTED;
264
+ } else {
265
+ initialStatus = EXITED;
266
+ }
267
+ }
268
+ _this.state = {
269
+ status: initialStatus
270
+ };
271
+ _this.nextCallback = null;
272
+ return _this;
273
+ }
274
+ var _proto = Transition.prototype;
275
+ _proto.getChildContext = function getChildContext() {
276
+ return {
277
+ transitionGroup: null
278
+ };
279
+ };
280
+ Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
281
+ var nextIn = _ref.in;
282
+ if (nextIn && prevState.status === UNMOUNTED) {
283
+ return {
284
+ status: EXITED
285
+ };
286
+ }
287
+ return null;
288
+ };
289
+ _proto.componentDidMount = function componentDidMount() {
290
+ this.updateStatus(true, this.appearStatus);
291
+ };
292
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
293
+ var nextStatus = null;
294
+ if (prevProps !== this.props) {
295
+ var status = this.state.status;
296
+ if (this.props.in) {
297
+ if (status !== ENTERING && status !== ENTERED) {
298
+ nextStatus = ENTERING;
299
+ }
300
+ } else {
301
+ if (status === ENTERING || status === ENTERED) {
302
+ nextStatus = EXITING;
303
+ }
304
+ }
305
+ }
306
+ this.updateStatus(false, nextStatus);
307
+ };
308
+ _proto.componentWillUnmount = function componentWillUnmount() {
309
+ this.cancelNextCallback();
310
+ };
311
+ _proto.getTimeouts = function getTimeouts() {
312
+ var timeout = this.props.timeout;
313
+ var exit, enter, appear;
314
+ exit = enter = appear = timeout;
315
+ if (timeout != null && typeof timeout !== 'number') {
316
+ exit = timeout.exit;
317
+ enter = timeout.enter;
318
+ appear = timeout.appear !== undefined ? timeout.appear : enter;
319
+ }
320
+ return {
321
+ exit: exit,
322
+ enter: enter,
323
+ appear: appear
324
+ };
325
+ };
326
+ _proto.updateStatus = function updateStatus(mounting, nextStatus) {
327
+ if (mounting === void 0) {
328
+ mounting = false;
329
+ }
330
+ if (nextStatus !== null) {
331
+ this.cancelNextCallback();
332
+ var node = _reactDom.default.findDOMNode(this);
333
+ if (nextStatus === ENTERING) {
334
+ this.performEnter(node, mounting);
335
+ } else {
336
+ this.performExit(node);
337
+ }
338
+ } else if (this.props.unmountOnExit && this.state.status === EXITED) {
339
+ this.setState({
340
+ status: UNMOUNTED
341
+ });
342
+ }
343
+ };
344
+ _proto.performEnter = function performEnter(node, mounting) {
345
+ var _this2 = this;
346
+ var enter = this.props.enter;
347
+ var appearing = this.context.transitionGroup ? this.context.transitionGroup.isMounting : mounting;
348
+ var timeouts = this.getTimeouts();
349
+ var enterTimeout = appearing ? timeouts.appear : timeouts.enter;
350
+ if (!mounting && !enter) {
351
+ this.safeSetState({
352
+ status: ENTERED
353
+ }, function () {
354
+ _this2.props.onEntered(node);
355
+ });
356
+ return;
357
+ }
358
+ this.props.onEnter(node, appearing);
359
+ this.safeSetState({
360
+ status: ENTERING
361
+ }, function () {
362
+ _this2.props.onEntering(node, appearing);
363
+ _this2.onTransitionEnd(node, enterTimeout, function () {
364
+ _this2.safeSetState({
365
+ status: ENTERED
366
+ }, function () {
367
+ _this2.props.onEntered(node, appearing);
368
+ });
369
+ });
370
+ });
371
+ };
372
+ _proto.performExit = function performExit(node) {
373
+ var _this3 = this;
374
+ var exit = this.props.exit;
375
+ var timeouts = this.getTimeouts();
376
+ if (!exit) {
377
+ this.safeSetState({
378
+ status: EXITED
379
+ }, function () {
380
+ _this3.props.onExited(node);
381
+ });
382
+ return;
383
+ }
384
+ this.props.onExit(node);
385
+ this.safeSetState({
386
+ status: EXITING
387
+ }, function () {
388
+ _this3.props.onExiting(node);
389
+ _this3.onTransitionEnd(node, timeouts.exit, function () {
390
+ _this3.safeSetState({
391
+ status: EXITED
392
+ }, function () {
393
+ _this3.props.onExited(node);
394
+ });
395
+ });
396
+ });
397
+ };
398
+ _proto.cancelNextCallback = function cancelNextCallback() {
399
+ if (this.nextCallback !== null) {
400
+ this.nextCallback.cancel();
401
+ this.nextCallback = null;
402
+ }
403
+ };
404
+ _proto.safeSetState = function safeSetState(nextState, callback) {
405
+ callback = this.setNextCallback(callback);
406
+ this.setState(nextState, callback);
407
+ };
408
+ _proto.setNextCallback = function setNextCallback(callback) {
409
+ var _this4 = this;
410
+ var active = true;
411
+ this.nextCallback = function (event) {
412
+ if (active) {
413
+ active = false;
414
+ _this4.nextCallback = null;
415
+ callback(event);
416
+ }
417
+ };
418
+ this.nextCallback.cancel = function () {
419
+ active = false;
420
+ };
421
+ return this.nextCallback;
422
+ };
423
+ _proto.onTransitionEnd = function onTransitionEnd(node, timeout, handler) {
424
+ this.setNextCallback(handler);
425
+ var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
426
+ if (!node || doesNotHaveTimeoutOrListener) {
427
+ setTimeout(this.nextCallback, 0);
428
+ return;
429
+ }
430
+ if (this.props.addEndListener) {
431
+ this.props.addEndListener(node, this.nextCallback);
432
+ }
433
+ if (timeout != null) {
434
+ setTimeout(this.nextCallback, timeout);
435
+ }
436
+ };
437
+ _proto.render = function render() {
438
+ var status = this.state.status;
439
+ if (status === UNMOUNTED) {
440
+ return null;
441
+ }
442
+ var _this$props = this.props, children = _this$props.children, childProps = _objectWithoutPropertiesLoose(_this$props, ["children"]);
443
+ delete childProps.in;
444
+ delete childProps.mountOnEnter;
445
+ delete childProps.unmountOnExit;
446
+ delete childProps.appear;
447
+ delete childProps.enter;
448
+ delete childProps.exit;
449
+ delete childProps.timeout;
450
+ delete childProps.addEndListener;
451
+ delete childProps.onEnter;
452
+ delete childProps.onEntering;
453
+ delete childProps.onEntered;
454
+ delete childProps.onExit;
455
+ delete childProps.onExiting;
456
+ delete childProps.onExited;
457
+ if (typeof children === 'function') {
458
+ return children(status, childProps);
459
+ }
460
+ var child = _react$1.default.Children.only(children);
461
+ return _react$1.default.cloneElement(child, childProps);
462
+ };
463
+ return Transition;
464
+ })(_react$1.default.Component);
465
+ Transition.contextTypes = {
466
+ transitionGroup: PropTypes$5.object
467
+ };
468
+ Transition.childContextTypes = {
469
+ transitionGroup: function transitionGroup() {}
470
+ };
471
+ Transition.propTypes = {
472
+ children: PropTypes$5.oneOfType([PropTypes$5.func.isRequired, PropTypes$5.element.isRequired]).isRequired,
473
+ in: PropTypes$5.bool,
474
+ mountOnEnter: PropTypes$5.bool,
475
+ unmountOnExit: PropTypes$5.bool,
476
+ appear: PropTypes$5.bool,
477
+ enter: PropTypes$5.bool,
478
+ exit: PropTypes$5.bool,
479
+ timeout: function timeout(props) {
480
+ var pt = _PropTypes.timeoutsShape;
481
+ if (!props.addEndListener) pt = pt.isRequired;
482
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
483
+ args[_key - 1] = arguments[_key];
484
+ }
485
+ return pt.apply(void 0, [props].concat(args));
486
+ },
487
+ addEndListener: PropTypes$5.func,
488
+ onEnter: PropTypes$5.func,
489
+ onEntering: PropTypes$5.func,
490
+ onEntered: PropTypes$5.func,
491
+ onExit: PropTypes$5.func,
492
+ onExiting: PropTypes$5.func,
493
+ onExited: PropTypes$5.func
494
+ };
495
+ function noop() {}
496
+ Transition.defaultProps = {
497
+ in: false,
498
+ mountOnEnter: false,
499
+ unmountOnExit: false,
500
+ appear: false,
501
+ enter: true,
502
+ exit: true,
503
+ onEnter: noop,
504
+ onEntering: noop,
505
+ onEntered: noop,
506
+ onExit: noop,
507
+ onExiting: noop,
508
+ onExited: noop
509
+ };
510
+ Transition.UNMOUNTED = 0;
511
+ Transition.EXITED = 1;
512
+ Transition.ENTERING = 2;
513
+ Transition.ENTERED = 3;
514
+ Transition.EXITING = 4;
515
+ var _default = (0, _reactLifecyclesCompat.polyfill)(Transition);
516
+ Transition$1.default = _default;
517
+ const require$$0$3 = _dll_prop_types;
518
+ const require$$3 = _dll_react;
519
+ (function (module, exports) {
520
+ exports.__esModule = true;
521
+ exports.default = void 0;
522
+ var PropTypes = _interopRequireWildcard(require$$0$3);
523
+ var _addClass = _interopRequireDefault(addClass.exports);
524
+ var _removeClass = _interopRequireDefault(removeClass);
525
+ var _react = _interopRequireDefault(require$$3);
526
+ var _Transition = _interopRequireDefault(Transition$1);
527
+ var _PropTypes = PropTypes$6;
528
+ function _interopRequireDefault(obj) {
529
+ return obj && obj.__esModule ? obj : {
530
+ default: obj
531
+ };
532
+ }
533
+ function _interopRequireWildcard(obj) {
534
+ if (obj && obj.__esModule) {
535
+ return obj;
536
+ } else {
537
+ var newObj = {};
538
+ if (obj != null) {
539
+ for (var key in obj) {
540
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
541
+ var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
542
+ if (desc.get || desc.set) {
543
+ Object.defineProperty(newObj, key, desc);
544
+ } else {
545
+ newObj[key] = obj[key];
546
+ }
547
+ }
548
+ }
549
+ }
550
+ newObj.default = obj;
551
+ return newObj;
552
+ }
553
+ }
554
+ function _extends() {
555
+ _extends = Object.assign || (function (target) {
556
+ for (var i = 1; i < arguments.length; i++) {
557
+ var source = arguments[i];
558
+ for (var key in source) {
559
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
560
+ target[key] = source[key];
561
+ }
562
+ }
563
+ }
564
+ return target;
565
+ });
566
+ return _extends.apply(this, arguments);
567
+ }
568
+ function _inheritsLoose(subClass, superClass) {
569
+ subClass.prototype = Object.create(superClass.prototype);
570
+ subClass.prototype.constructor = subClass;
571
+ subClass.__proto__ = superClass;
572
+ }
573
+ var addClass$1 = function addClass(node, classes) {
574
+ return node && classes && classes.split(' ').forEach(function (c) {
575
+ return (0, _addClass.default)(node, c);
576
+ });
577
+ };
578
+ var removeClass$1 = function removeClass(node, classes) {
579
+ return node && classes && classes.split(' ').forEach(function (c) {
580
+ return (0, _removeClass.default)(node, c);
581
+ });
582
+ };
583
+ var CSSTransition = (function (_React$Component) {
584
+ _inheritsLoose(CSSTransition, _React$Component);
585
+ function CSSTransition() {
586
+ var _this;
587
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
588
+ args[_key] = arguments[_key];
589
+ }
590
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
591
+ _this.onEnter = function (node, appearing) {
592
+ var _this$getClassNames = _this.getClassNames(appearing ? 'appear' : 'enter'), className = _this$getClassNames.className;
593
+ _this.removeClasses(node, 'exit');
594
+ addClass$1(node, className);
595
+ if (_this.props.onEnter) {
596
+ _this.props.onEnter(node, appearing);
597
+ }
598
+ };
599
+ _this.onEntering = function (node, appearing) {
600
+ var _this$getClassNames2 = _this.getClassNames(appearing ? 'appear' : 'enter'), activeClassName = _this$getClassNames2.activeClassName;
601
+ _this.reflowAndAddClass(node, activeClassName);
602
+ if (_this.props.onEntering) {
603
+ _this.props.onEntering(node, appearing);
604
+ }
605
+ };
606
+ _this.onEntered = function (node, appearing) {
607
+ var appearClassName = _this.getClassNames('appear').doneClassName;
608
+ var enterClassName = _this.getClassNames('enter').doneClassName;
609
+ var doneClassName = appearing ? appearClassName + " " + enterClassName : enterClassName;
610
+ _this.removeClasses(node, appearing ? 'appear' : 'enter');
611
+ addClass$1(node, doneClassName);
612
+ if (_this.props.onEntered) {
613
+ _this.props.onEntered(node, appearing);
614
+ }
615
+ };
616
+ _this.onExit = function (node) {
617
+ var _this$getClassNames3 = _this.getClassNames('exit'), className = _this$getClassNames3.className;
618
+ _this.removeClasses(node, 'appear');
619
+ _this.removeClasses(node, 'enter');
620
+ addClass$1(node, className);
621
+ if (_this.props.onExit) {
622
+ _this.props.onExit(node);
623
+ }
624
+ };
625
+ _this.onExiting = function (node) {
626
+ var _this$getClassNames4 = _this.getClassNames('exit'), activeClassName = _this$getClassNames4.activeClassName;
627
+ _this.reflowAndAddClass(node, activeClassName);
628
+ if (_this.props.onExiting) {
629
+ _this.props.onExiting(node);
630
+ }
631
+ };
632
+ _this.onExited = function (node) {
633
+ var _this$getClassNames5 = _this.getClassNames('exit'), doneClassName = _this$getClassNames5.doneClassName;
634
+ _this.removeClasses(node, 'exit');
635
+ addClass$1(node, doneClassName);
636
+ if (_this.props.onExited) {
637
+ _this.props.onExited(node);
638
+ }
639
+ };
640
+ _this.getClassNames = function (type) {
641
+ var classNames = _this.props.classNames;
642
+ var isStringClassNames = typeof classNames === 'string';
643
+ var prefix = isStringClassNames && classNames ? classNames + '-' : '';
644
+ var className = isStringClassNames ? prefix + type : classNames[type];
645
+ var activeClassName = isStringClassNames ? className + '-active' : classNames[type + 'Active'];
646
+ var doneClassName = isStringClassNames ? className + '-done' : classNames[type + 'Done'];
647
+ return {
648
+ className: className,
649
+ activeClassName: activeClassName,
650
+ doneClassName: doneClassName
651
+ };
652
+ };
653
+ return _this;
654
+ }
655
+ var _proto = CSSTransition.prototype;
656
+ _proto.removeClasses = function removeClasses(node, type) {
657
+ var _this$getClassNames6 = this.getClassNames(type), className = _this$getClassNames6.className, activeClassName = _this$getClassNames6.activeClassName, doneClassName = _this$getClassNames6.doneClassName;
658
+ className && removeClass$1(node, className);
659
+ activeClassName && removeClass$1(node, activeClassName);
660
+ doneClassName && removeClass$1(node, doneClassName);
661
+ };
662
+ _proto.reflowAndAddClass = function reflowAndAddClass(node, className) {
663
+ if (className) {
664
+ node && node.scrollTop;
665
+ addClass$1(node, className);
666
+ }
667
+ };
668
+ _proto.render = function render() {
669
+ var props = _extends({}, this.props);
670
+ delete props.classNames;
671
+ return _react.default.createElement(_Transition.default, _extends({}, props, {
672
+ onEnter: this.onEnter,
673
+ onEntered: this.onEntered,
674
+ onEntering: this.onEntering,
675
+ onExit: this.onExit,
676
+ onExiting: this.onExiting,
677
+ onExited: this.onExited
678
+ }));
679
+ };
680
+ return CSSTransition;
681
+ })(_react.default.Component);
682
+ CSSTransition.defaultProps = {
683
+ classNames: ''
684
+ };
685
+ CSSTransition.propTypes = _extends({}, _Transition.default.propTypes, {
686
+ classNames: _PropTypes.classNamesShape,
687
+ onEnter: PropTypes.func,
688
+ onEntering: PropTypes.func,
689
+ onEntered: PropTypes.func,
690
+ onExit: PropTypes.func,
691
+ onExiting: PropTypes.func,
692
+ onExited: PropTypes.func
693
+ });
694
+ var _default = CSSTransition;
695
+ exports.default = _default;
696
+ module.exports = exports["default"];
697
+ })(CSSTransition, CSSTransition.exports);
698
+ getDefaultExportFromCjs(CSSTransition.exports);
699
+ var ReplaceTransition = {
700
+ exports: {}
701
+ };
702
+ var TransitionGroup = {
703
+ exports: {}
704
+ };
705
+ var ChildMapping = {};
706
+ const require$$0$2 = _dll_react;
707
+ ChildMapping.__esModule = true;
708
+ ChildMapping.getChildMapping = getChildMapping;
709
+ ChildMapping.mergeChildMappings = mergeChildMappings;
710
+ ChildMapping.getInitialChildMapping = getInitialChildMapping;
711
+ ChildMapping.getNextChildMapping = getNextChildMapping;
712
+ var _react = require$$0$2;
713
+ function getChildMapping(children, mapFn) {
714
+ var mapper = function mapper(child) {
715
+ return mapFn && (0, _react.isValidElement)(child) ? mapFn(child) : child;
716
+ };
717
+ var result = Object.create(null);
718
+ if (children) _react.Children.map(children, function (c) {
719
+ return c;
720
+ }).forEach(function (child) {
721
+ result[child.key] = mapper(child);
722
+ });
723
+ return result;
724
+ }
725
+ function mergeChildMappings(prev, next) {
726
+ prev = prev || ({});
727
+ next = next || ({});
728
+ function getValueForKey(key) {
729
+ return (key in next) ? next[key] : prev[key];
730
+ }
731
+ var nextKeysPending = Object.create(null);
732
+ var pendingKeys = [];
733
+ for (var prevKey in prev) {
734
+ if ((prevKey in next)) {
735
+ if (pendingKeys.length) {
736
+ nextKeysPending[prevKey] = pendingKeys;
737
+ pendingKeys = [];
738
+ }
739
+ } else {
740
+ pendingKeys.push(prevKey);
741
+ }
742
+ }
743
+ var i;
744
+ var childMapping = {};
745
+ for (var nextKey in next) {
746
+ if (nextKeysPending[nextKey]) {
747
+ for (i = 0; i < nextKeysPending[nextKey].length; i++) {
748
+ var pendingNextKey = nextKeysPending[nextKey][i];
749
+ childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
750
+ }
751
+ }
752
+ childMapping[nextKey] = getValueForKey(nextKey);
753
+ }
754
+ for (i = 0; i < pendingKeys.length; i++) {
755
+ childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
756
+ }
757
+ return childMapping;
758
+ }
759
+ function getProp(child, prop, props) {
760
+ return props[prop] != null ? props[prop] : child.props[prop];
761
+ }
762
+ function getInitialChildMapping(props, onExited) {
763
+ return getChildMapping(props.children, function (child) {
764
+ return (0, _react.cloneElement)(child, {
765
+ onExited: onExited.bind(null, child),
766
+ in: true,
767
+ appear: getProp(child, 'appear', props),
768
+ enter: getProp(child, 'enter', props),
769
+ exit: getProp(child, 'exit', props)
770
+ });
771
+ });
772
+ }
773
+ function getNextChildMapping(nextProps, prevChildMapping, onExited) {
774
+ var nextChildMapping = getChildMapping(nextProps.children);
775
+ var children = mergeChildMappings(prevChildMapping, nextChildMapping);
776
+ Object.keys(children).forEach(function (key) {
777
+ var child = children[key];
778
+ if (!(0, _react.isValidElement)(child)) return;
779
+ var hasPrev = (key in prevChildMapping);
780
+ var hasNext = (key in nextChildMapping);
781
+ var prevChild = prevChildMapping[key];
782
+ var isLeaving = (0, _react.isValidElement)(prevChild) && !prevChild.props.in;
783
+ if (hasNext && (!hasPrev || isLeaving)) {
784
+ children[key] = (0, _react.cloneElement)(child, {
785
+ onExited: onExited.bind(null, child),
786
+ in: true,
787
+ exit: getProp(child, 'exit', nextProps),
788
+ enter: getProp(child, 'enter', nextProps)
789
+ });
790
+ } else if (!hasNext && hasPrev && !isLeaving) {
791
+ children[key] = (0, _react.cloneElement)(child, {
792
+ in: false
793
+ });
794
+ } else if (hasNext && hasPrev && (0, _react.isValidElement)(prevChild)) {
795
+ children[key] = (0, _react.cloneElement)(child, {
796
+ onExited: onExited.bind(null, child),
797
+ in: prevChild.props.in,
798
+ exit: getProp(child, 'exit', nextProps),
799
+ enter: getProp(child, 'enter', nextProps)
800
+ });
801
+ }
802
+ });
803
+ return children;
804
+ }
805
+ const require$$0$1 = _dll_prop_types;
806
+ const require$$1$1 = _dll_react;
807
+ (function (module, exports) {
808
+ exports.__esModule = true;
809
+ exports.default = void 0;
810
+ var _propTypes = _interopRequireDefault(require$$0$1);
811
+ var _react = _interopRequireDefault(require$$1$1);
812
+ var _reactLifecyclesCompat = require$$2$2;
813
+ var _ChildMapping = ChildMapping;
814
+ function _interopRequireDefault(obj) {
815
+ return obj && obj.__esModule ? obj : {
816
+ default: obj
817
+ };
818
+ }
819
+ function _objectWithoutPropertiesLoose(source, excluded) {
820
+ if (source == null) return {};
821
+ var target = {};
822
+ var sourceKeys = Object.keys(source);
823
+ var key, i;
824
+ for (i = 0; i < sourceKeys.length; i++) {
825
+ key = sourceKeys[i];
826
+ if (excluded.indexOf(key) >= 0) continue;
827
+ target[key] = source[key];
828
+ }
829
+ return target;
830
+ }
831
+ function _extends() {
832
+ _extends = Object.assign || (function (target) {
833
+ for (var i = 1; i < arguments.length; i++) {
834
+ var source = arguments[i];
835
+ for (var key in source) {
836
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
837
+ target[key] = source[key];
838
+ }
839
+ }
840
+ }
841
+ return target;
842
+ });
843
+ return _extends.apply(this, arguments);
844
+ }
845
+ function _inheritsLoose(subClass, superClass) {
846
+ subClass.prototype = Object.create(superClass.prototype);
847
+ subClass.prototype.constructor = subClass;
848
+ subClass.__proto__ = superClass;
849
+ }
850
+ function _assertThisInitialized(self) {
851
+ if (self === void 0) {
852
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
853
+ }
854
+ return self;
855
+ }
856
+ var values = Object.values || (function (obj) {
857
+ return Object.keys(obj).map(function (k) {
858
+ return obj[k];
859
+ });
860
+ });
861
+ var defaultProps = {
862
+ component: 'div',
863
+ childFactory: function childFactory(child) {
864
+ return child;
865
+ }
866
+ };
867
+ var TransitionGroup = (function (_React$Component) {
868
+ _inheritsLoose(TransitionGroup, _React$Component);
869
+ function TransitionGroup(props, context) {
870
+ var _this;
871
+ _this = _React$Component.call(this, props, context) || this;
872
+ var handleExited = _this.handleExited.bind(_assertThisInitialized(_assertThisInitialized(_this)));
873
+ _this.state = {
874
+ handleExited: handleExited,
875
+ firstRender: true
876
+ };
877
+ return _this;
878
+ }
879
+ var _proto = TransitionGroup.prototype;
880
+ _proto.getChildContext = function getChildContext() {
881
+ return {
882
+ transitionGroup: {
883
+ isMounting: !this.appeared
884
+ }
885
+ };
886
+ };
887
+ _proto.componentDidMount = function componentDidMount() {
888
+ this.appeared = true;
889
+ this.mounted = true;
890
+ };
891
+ _proto.componentWillUnmount = function componentWillUnmount() {
892
+ this.mounted = false;
893
+ };
894
+ TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
895
+ var prevChildMapping = _ref.children, handleExited = _ref.handleExited, firstRender = _ref.firstRender;
896
+ return {
897
+ children: firstRender ? (0, _ChildMapping.getInitialChildMapping)(nextProps, handleExited) : (0, _ChildMapping.getNextChildMapping)(nextProps, prevChildMapping, handleExited),
898
+ firstRender: false
899
+ };
900
+ };
901
+ _proto.handleExited = function handleExited(child, node) {
902
+ var currentChildMapping = (0, _ChildMapping.getChildMapping)(this.props.children);
903
+ if ((child.key in currentChildMapping)) return;
904
+ if (child.props.onExited) {
905
+ child.props.onExited(node);
906
+ }
907
+ if (this.mounted) {
908
+ this.setState(function (state) {
909
+ var children = _extends({}, state.children);
910
+ delete children[child.key];
911
+ return {
912
+ children: children
913
+ };
914
+ });
915
+ }
916
+ };
917
+ _proto.render = function render() {
918
+ var _this$props = this.props, Component = _this$props.component, childFactory = _this$props.childFactory, props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
919
+ var children = values(this.state.children).map(childFactory);
920
+ delete props.appear;
921
+ delete props.enter;
922
+ delete props.exit;
923
+ if (Component === null) {
924
+ return children;
925
+ }
926
+ return _react.default.createElement(Component, props, children);
927
+ };
928
+ return TransitionGroup;
929
+ })(_react.default.Component);
930
+ TransitionGroup.childContextTypes = {
931
+ transitionGroup: _propTypes.default.object.isRequired
932
+ };
933
+ TransitionGroup.propTypes = {
934
+ component: _propTypes.default.any,
935
+ children: _propTypes.default.node,
936
+ appear: _propTypes.default.bool,
937
+ enter: _propTypes.default.bool,
938
+ exit: _propTypes.default.bool,
939
+ childFactory: _propTypes.default.func
940
+ };
941
+ TransitionGroup.defaultProps = defaultProps;
942
+ var _default = (0, _reactLifecyclesCompat.polyfill)(TransitionGroup);
943
+ exports.default = _default;
944
+ module.exports = exports["default"];
945
+ })(TransitionGroup, TransitionGroup.exports);
946
+ getDefaultExportFromCjs(TransitionGroup.exports);
947
+ const require$$0 = _dll_prop_types;
948
+ const require$$1 = _dll_react;
949
+ const require$$2 = _dll_react_dom;
950
+ (function (module, exports) {
951
+ exports.__esModule = true;
952
+ exports.default = void 0;
953
+ var _propTypes = _interopRequireDefault(require$$0);
954
+ var _react = _interopRequireDefault(require$$1);
955
+ var _reactDom = require$$2;
956
+ var _TransitionGroup = _interopRequireDefault(TransitionGroup.exports);
957
+ function _interopRequireDefault(obj) {
958
+ return obj && obj.__esModule ? obj : {
959
+ default: obj
960
+ };
961
+ }
962
+ function _objectWithoutPropertiesLoose(source, excluded) {
963
+ if (source == null) return {};
964
+ var target = {};
965
+ var sourceKeys = Object.keys(source);
966
+ var key, i;
967
+ for (i = 0; i < sourceKeys.length; i++) {
968
+ key = sourceKeys[i];
969
+ if (excluded.indexOf(key) >= 0) continue;
970
+ target[key] = source[key];
971
+ }
972
+ return target;
973
+ }
974
+ function _inheritsLoose(subClass, superClass) {
975
+ subClass.prototype = Object.create(superClass.prototype);
976
+ subClass.prototype.constructor = subClass;
977
+ subClass.__proto__ = superClass;
978
+ }
979
+ var ReplaceTransition = (function (_React$Component) {
980
+ _inheritsLoose(ReplaceTransition, _React$Component);
981
+ function ReplaceTransition() {
982
+ var _this;
983
+ for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
984
+ _args[_key] = arguments[_key];
985
+ }
986
+ _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
987
+ _this.handleEnter = function () {
988
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
989
+ args[_key2] = arguments[_key2];
990
+ }
991
+ return _this.handleLifecycle('onEnter', 0, args);
992
+ };
993
+ _this.handleEntering = function () {
994
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
995
+ args[_key3] = arguments[_key3];
996
+ }
997
+ return _this.handleLifecycle('onEntering', 0, args);
998
+ };
999
+ _this.handleEntered = function () {
1000
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1001
+ args[_key4] = arguments[_key4];
1002
+ }
1003
+ return _this.handleLifecycle('onEntered', 0, args);
1004
+ };
1005
+ _this.handleExit = function () {
1006
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1007
+ args[_key5] = arguments[_key5];
1008
+ }
1009
+ return _this.handleLifecycle('onExit', 1, args);
1010
+ };
1011
+ _this.handleExiting = function () {
1012
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
1013
+ args[_key6] = arguments[_key6];
1014
+ }
1015
+ return _this.handleLifecycle('onExiting', 1, args);
1016
+ };
1017
+ _this.handleExited = function () {
1018
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
1019
+ args[_key7] = arguments[_key7];
1020
+ }
1021
+ return _this.handleLifecycle('onExited', 1, args);
1022
+ };
1023
+ return _this;
1024
+ }
1025
+ var _proto = ReplaceTransition.prototype;
1026
+ _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
1027
+ var _child$props;
1028
+ var children = this.props.children;
1029
+ var child = _react.default.Children.toArray(children)[idx];
1030
+ if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
1031
+ if (this.props[handler]) this.props[handler]((0, _reactDom.findDOMNode)(this));
1032
+ };
1033
+ _proto.render = function render() {
1034
+ var _this$props = this.props, children = _this$props.children, inProp = _this$props.in, props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
1035
+ var _React$Children$toArr = _react.default.Children.toArray(children), first = _React$Children$toArr[0], second = _React$Children$toArr[1];
1036
+ delete props.onEnter;
1037
+ delete props.onEntering;
1038
+ delete props.onEntered;
1039
+ delete props.onExit;
1040
+ delete props.onExiting;
1041
+ delete props.onExited;
1042
+ return _react.default.createElement(_TransitionGroup.default, props, inProp ? _react.default.cloneElement(first, {
1043
+ key: 'first',
1044
+ onEnter: this.handleEnter,
1045
+ onEntering: this.handleEntering,
1046
+ onEntered: this.handleEntered
1047
+ }) : _react.default.cloneElement(second, {
1048
+ key: 'second',
1049
+ onEnter: this.handleExit,
1050
+ onEntering: this.handleExiting,
1051
+ onEntered: this.handleExited
1052
+ }));
1053
+ };
1054
+ return ReplaceTransition;
1055
+ })(_react.default.Component);
1056
+ ReplaceTransition.propTypes = {
1057
+ in: _propTypes.default.bool.isRequired,
1058
+ children: function children(props, propName) {
1059
+ if (_react.default.Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components.");
1060
+ return null;
1061
+ }
1062
+ };
1063
+ var _default = ReplaceTransition;
1064
+ exports.default = _default;
1065
+ module.exports = exports["default"];
1066
+ })(ReplaceTransition, ReplaceTransition.exports);
1067
+ getDefaultExportFromCjs(ReplaceTransition.exports);
1068
+ var _CSSTransition = _interopRequireDefault(CSSTransition.exports);
1069
+ var _ReplaceTransition = _interopRequireDefault(ReplaceTransition.exports);
1070
+ var _TransitionGroup = _interopRequireDefault(TransitionGroup.exports);
1071
+ var _Transition = _interopRequireDefault(Transition$1);
1072
+ function _interopRequireDefault(obj) {
1073
+ return obj && obj.__esModule ? obj : {
1074
+ default: obj
1075
+ };
1076
+ }
1077
+ var reactTransitionGroup = {
1078
+ Transition: _Transition.default,
1079
+ TransitionGroup: _TransitionGroup.default,
1080
+ ReplaceTransition: _ReplaceTransition.default,
1081
+ CSSTransition: _CSSTransition.default
1082
+ };
1083
+ const React$5 = _dll_react;
1084
+ const {withStyles: withStyles$4} = _dll_material_ui__core_styles;
1085
+ const PropTypes$4 = _dll_prop_types;
1086
+ const {color: color$2} = _dll_pie_lib__render_ui;
1087
+ const _jsxFileName$4 = "/home/circleci/repo/packages/multiple-choice/src/feedback-tick.jsx";
1088
+ const stylesheet = {
1089
+ incorrect: {
1090
+ fill: `var(--feedback-incorrect-bg-color, ${color$2.incorrect()})`
1091
+ },
1092
+ correct: {
1093
+ fill: `var(--feedback-correct-bg-color, ${color$2.correct()})`
1094
+ },
1095
+ feedbackTick: {
1096
+ width: '33px',
1097
+ height: '33px',
1098
+ '& svg': {
1099
+ position: 'absolute',
1100
+ display: 'inline-block',
1101
+ width: '33px',
1102
+ height: '33px',
1103
+ verticalAlign: 'middle',
1104
+ '& hide': {
1105
+ display: 'none'
1106
+ }
1107
+ }
1108
+ },
1109
+ feedbackTickEnter: {
1110
+ opacity: '0',
1111
+ left: '-50px'
1112
+ },
1113
+ feedbackTickEnterActive: {
1114
+ opacity: '1',
1115
+ left: '0px',
1116
+ transition: 'left 500ms ease-in 200ms, opacity 500ms linear 200ms'
1117
+ },
1118
+ feedbackTickLeave: {
1119
+ opacity: '1',
1120
+ left: '0px'
1121
+ },
1122
+ feedbackTickLeaveActive: {
1123
+ opacity: '0',
1124
+ left: '-50px',
1125
+ transition: 'left 300ms ease-in, opacity 300ms'
1126
+ }
1127
+ };
1128
+ class FeedbackTick extends React$5.Component {
1129
+ static __initStatic() {
1130
+ this.propTypes = {
1131
+ classes: PropTypes$4.object.isRequired,
1132
+ correctness: PropTypes$4.string
1133
+ };
1134
+ }
1135
+ constructor(props) {
1136
+ super(props);
1137
+ this.incorrectIcon = React$5.createElement('svg', {
1138
+ key: "1",
1139
+ preserveAspectRatio: "xMinYMin meet",
1140
+ x: "0px",
1141
+ y: "0px",
1142
+ viewBox: "0 0 44 40",
1143
+ style: {
1144
+ enableBackground: 'new 0 0 44 40'
1145
+ },
1146
+ __self: this,
1147
+ __source: {
1148
+ fileName: _jsxFileName$4,
1149
+ lineNumber: 56
1150
+ }
1151
+ }, React$5.createElement('g', {
1152
+ __self: this,
1153
+ __source: {
1154
+ fileName: _jsxFileName$4,
1155
+ lineNumber: 64
1156
+ }
1157
+ }, React$5.createElement('rect', {
1158
+ x: "11",
1159
+ y: "17.3",
1160
+ transform: "matrix(0.7071 -0.7071 0.7071 0.7071 -7.852 19.2507)",
1161
+ className: this.props.classes.incorrect,
1162
+ width: "16.6",
1163
+ height: "3.7",
1164
+ __self: this,
1165
+ __source: {
1166
+ fileName: _jsxFileName$4,
1167
+ lineNumber: 65
1168
+ }
1169
+ }), React$5.createElement('rect', {
1170
+ x: "17.4",
1171
+ y: "10.7",
1172
+ transform: "matrix(0.7071 -0.7071 0.7071 0.7071 -7.8175 19.209)",
1173
+ className: this.props.classes.incorrect,
1174
+ width: "3.7",
1175
+ height: "16.6",
1176
+ __self: this,
1177
+ __source: {
1178
+ fileName: _jsxFileName$4,
1179
+ lineNumber: 73
1180
+ }
1181
+ })));
1182
+ this.correctIcon = React$5.createElement('svg', {
1183
+ key: "2",
1184
+ preserveAspectRatio: "xMinYMin meet",
1185
+ version: "1.1",
1186
+ x: "0px",
1187
+ y: "0px",
1188
+ viewBox: "0 0 44 40",
1189
+ style: {
1190
+ enableBackground: 'new 0 0 44 40'
1191
+ },
1192
+ __self: this,
1193
+ __source: {
1194
+ fileName: _jsxFileName$4,
1195
+ lineNumber: 86
1196
+ }
1197
+ }, React$5.createElement('polygon', {
1198
+ className: this.props.classes.correct,
1199
+ points: "19.1,28.6 11.8,22.3 14.4,19.2 17.9,22.1 23.9,11.4 27.5,13.4",
1200
+ __self: this,
1201
+ __source: {
1202
+ fileName: _jsxFileName$4,
1203
+ lineNumber: 95
1204
+ }
1205
+ }));
1206
+ }
1207
+ render() {
1208
+ const {correctness, classes} = this.props;
1209
+ const icon = (() => {
1210
+ if (correctness === 'incorrect') {
1211
+ return this.incorrectIcon;
1212
+ } else if (correctness === 'correct') {
1213
+ return this.correctIcon;
1214
+ }
1215
+ })();
1216
+ return React$5.createElement('div', {
1217
+ className: classes.feedbackTick,
1218
+ __self: this,
1219
+ __source: {
1220
+ fileName: _jsxFileName$4,
1221
+ lineNumber: 115
1222
+ }
1223
+ }, React$5.createElement(reactTransitionGroup.TransitionGroup, {
1224
+ __self: this,
1225
+ __source: {
1226
+ fileName: _jsxFileName$4,
1227
+ lineNumber: 116
1228
+ }
1229
+ }, correctness && React$5.createElement(reactTransitionGroup.CSSTransition, {
1230
+ classNames: {
1231
+ enter: classes.feedbackTickEnter,
1232
+ enterActive: classes.feedbackTickEnterActive,
1233
+ exit: classes.feedbackTickLeave,
1234
+ exitActive: classes.feedbackTickLeaveActive
1235
+ },
1236
+ timeout: {
1237
+ enter: 700,
1238
+ exit: 300
1239
+ },
1240
+ __self: this,
1241
+ __source: {
1242
+ fileName: _jsxFileName$4,
1243
+ lineNumber: 118
1244
+ }
1245
+ }, icon)));
1246
+ }
1247
+ }
1248
+ FeedbackTick.__initStatic();
1249
+ var FeedbackTick$1 = withStyles$4(stylesheet, {
1250
+ name: 'FeedbackTick'
1251
+ })(FeedbackTick);
1252
+ const {FormControlLabel: FormControlLabel} = _dll_material_ui__core;
1253
+ const {Checkbox: Checkbox} = _dll_material_ui__core;
1254
+ const {Radio: Radio} = _dll_material_ui__core;
1255
+ const React$4 = _dll_react;
1256
+ const PropTypes$3 = _dll_prop_types;
1257
+ const {withStyles: withStyles$3} = _dll_material_ui__core_styles;
1258
+ const {Feedback: Feedback} = _dll_pie_lib__render_ui;
1259
+ const {color: color$1} = _dll_pie_lib__render_ui;
1260
+ const {PreviewPrompt: PreviewPrompt$1} = _dll_pie_lib__render_ui;
1261
+ const classNames$3 = _dll_classnames;
1262
+ const _jsxFileName$3 = "/home/circleci/repo/packages/multiple-choice/src/choice-input.jsx";
1263
+ const styleSheet = () => ({
1264
+ row: {
1265
+ display: 'flex',
1266
+ alignItems: 'center',
1267
+ backgroundColor: color$1.background()
1268
+ },
1269
+ checkboxHolder: {
1270
+ display: 'flex',
1271
+ alignItems: 'center',
1272
+ backgroundColor: color$1.background(),
1273
+ flex: 1,
1274
+ '& label': {
1275
+ color: color$1.text()
1276
+ }
1277
+ }
1278
+ });
1279
+ const formStyleSheet = {
1280
+ label: {
1281
+ color: `${color$1.text()} !important`,
1282
+ backgroundColor: color$1.background()
1283
+ }
1284
+ };
1285
+ const StyledFormControlLabel = withStyles$3(formStyleSheet, {
1286
+ name: 'FormControlLabel'
1287
+ })(props => React$4.createElement(FormControlLabel, {
1288
+ ...props,
1289
+ classes: {
1290
+ label: props.classes.label
1291
+ },
1292
+ __self: undefined,
1293
+ __source: {
1294
+ fileName: _jsxFileName$3,
1295
+ lineNumber: 39
1296
+ }
1297
+ }));
1298
+ const CLASS_NAME = 'multiple-choice-component';
1299
+ const colorStyle = (varName, fallback) => ({
1300
+ [`&.${CLASS_NAME}`]: {
1301
+ color: `var(--choice-input-${varName}, ${fallback}) !important`
1302
+ }
1303
+ });
1304
+ const inputStyles = {
1305
+ 'correct-root': colorStyle('correct-color', color$1.text()),
1306
+ 'correct-checked': colorStyle('correct-selected-color', color$1.correct()),
1307
+ 'correct-disabled': colorStyle('correct-disabled-color', color$1.disabled()),
1308
+ 'incorrect-root': colorStyle('incorrect-color', color$1.incorrect()),
1309
+ 'incorrect-checked': colorStyle('incorrect-checked', color$1.incorrect()),
1310
+ 'incorrect-disabled': colorStyle('incorrect-disabled-color', color$1.disabled()),
1311
+ root: {
1312
+ ...colorStyle('color', color$1.text()),
1313
+ '&:hover': {
1314
+ color: `${color$1.primaryLight()} !important`
1315
+ }
1316
+ },
1317
+ checked: colorStyle('selected-color', color$1.primary()),
1318
+ disabled: {
1319
+ ...colorStyle('disabled-color', color$1.text()),
1320
+ opacity: 0.6,
1321
+ cursor: 'not-allowed !important',
1322
+ pointerEvents: 'initial !important'
1323
+ }
1324
+ };
1325
+ const StyledCheckbox = withStyles$3(inputStyles)(props => {
1326
+ const {correctness, classes, checked, onChange, disabled, accessibility} = props;
1327
+ const key = k => correctness ? `${correctness}-${k}` : k;
1328
+ const resolved = {
1329
+ root: classes[key('root')],
1330
+ checked: classes[key('checked')],
1331
+ disabled: classes[key('disabled')]
1332
+ };
1333
+ const miniProps = {
1334
+ checked,
1335
+ onChange,
1336
+ disabled
1337
+ };
1338
+ return React$4.createElement(Checkbox, {
1339
+ 'aria-label': accessibility,
1340
+ ...miniProps,
1341
+ className: CLASS_NAME,
1342
+ classes: {
1343
+ root: resolved.root,
1344
+ checked: resolved.checked,
1345
+ disabled: resolved.disabled
1346
+ },
1347
+ __self: undefined,
1348
+ __source: {
1349
+ fileName: _jsxFileName$3,
1350
+ lineNumber: 92
1351
+ }
1352
+ });
1353
+ });
1354
+ const StyledRadio = withStyles$3(inputStyles)(props => {
1355
+ const {correctness, classes, checked, onChange, disabled, accessibility} = props;
1356
+ const key = k => correctness ? `${correctness}-${k}` : k;
1357
+ const resolved = {
1358
+ root: classes[key('root')],
1359
+ checked: classes[key('checked')],
1360
+ disabled: classes[key('disabled')]
1361
+ };
1362
+ const miniProps = {
1363
+ checked,
1364
+ onChange,
1365
+ disabled
1366
+ };
1367
+ return React$4.createElement(Radio, {
1368
+ 'aria-label': accessibility,
1369
+ ...miniProps,
1370
+ className: CLASS_NAME,
1371
+ classes: {
1372
+ root: resolved.root,
1373
+ checked: resolved.checked
1374
+ },
1375
+ __self: undefined,
1376
+ __source: {
1377
+ fileName: _jsxFileName$3,
1378
+ lineNumber: 125
1379
+ }
1380
+ });
1381
+ });
1382
+ class ChoiceInput extends React$4.Component {
1383
+ static __initStatic() {
1384
+ this.propTypes = {
1385
+ choiceMode: PropTypes$3.oneOf(['radio', 'checkbox']),
1386
+ displayKey: PropTypes$3.string.isRequired,
1387
+ checked: PropTypes$3.bool.isRequired,
1388
+ correctness: PropTypes$3.string,
1389
+ disabled: PropTypes$3.bool.isRequired,
1390
+ feedback: PropTypes$3.string,
1391
+ label: PropTypes$3.string.isRequired,
1392
+ rationale: PropTypes$3.string,
1393
+ accessibility: PropTypes$3.string,
1394
+ onChange: PropTypes$3.func.isRequired,
1395
+ value: PropTypes$3.string.isRequired,
1396
+ classes: PropTypes$3.object,
1397
+ className: PropTypes$3.string,
1398
+ hideTick: PropTypes$3.bool,
1399
+ isEvaluateMode: PropTypes$3.bool
1400
+ };
1401
+ }
1402
+ static __initStatic2() {
1403
+ this.defaultProps = {
1404
+ rationale: null,
1405
+ accessibility: null,
1406
+ checked: false,
1407
+ isEvaluateMode: false
1408
+ };
1409
+ }
1410
+ constructor(props) {
1411
+ super(props);
1412
+ this.onToggleChoice = this.onToggleChoice.bind(this);
1413
+ }
1414
+ onToggleChoice() {
1415
+ this.props.onChange({
1416
+ value: this.props.value,
1417
+ selected: !this.props.checked
1418
+ });
1419
+ }
1420
+ render() {
1421
+ const {choiceMode, disabled, displayKey, feedback, label, checked, correctness, classes, className, rationale, accessibility, hideTick, isEvaluateMode} = this.props;
1422
+ const Tag = choiceMode === 'checkbox' ? StyledCheckbox : StyledRadio;
1423
+ const classSuffix = choiceMode === 'checkbox' ? 'checkbox' : 'radio-button';
1424
+ return React$4.createElement('div', {
1425
+ className: classNames$3(className, 'corespring-' + classSuffix, 'choice-input'),
1426
+ __self: this,
1427
+ __source: {
1428
+ fileName: _jsxFileName$3,
1429
+ lineNumber: 196
1430
+ }
1431
+ }, React$4.createElement('div', {
1432
+ className: classes.row,
1433
+ __self: this,
1434
+ __source: {
1435
+ fileName: _jsxFileName$3,
1436
+ lineNumber: 197
1437
+ }
1438
+ }, !hideTick && isEvaluateMode && React$4.createElement(FeedbackTick$1, {
1439
+ correctness: correctness,
1440
+ __self: this,
1441
+ __source: {
1442
+ fileName: _jsxFileName$3,
1443
+ lineNumber: 198
1444
+ }
1445
+ }), React$4.createElement('div', {
1446
+ className: classNames$3(classes.checkboxHolder, 'checkbox-holder'),
1447
+ __self: this,
1448
+ __source: {
1449
+ fileName: _jsxFileName$3,
1450
+ lineNumber: 199
1451
+ }
1452
+ }, React$4.createElement(StyledFormControlLabel, {
1453
+ disabled: disabled,
1454
+ label: displayKey ? displayKey + '. ' : '',
1455
+ control: React$4.createElement(Tag, {
1456
+ accessibility: accessibility,
1457
+ checked: checked,
1458
+ correctness: correctness,
1459
+ onChange: this.onToggleChoice,
1460
+ __self: this,
1461
+ __source: {
1462
+ fileName: _jsxFileName$3,
1463
+ lineNumber: 204
1464
+ }
1465
+ }),
1466
+ __self: this,
1467
+ __source: {
1468
+ fileName: _jsxFileName$3,
1469
+ lineNumber: 200
1470
+ }
1471
+ }), React$4.createElement(PreviewPrompt$1, {
1472
+ className: "label",
1473
+ onClick: this.onToggleChoice,
1474
+ prompt: label,
1475
+ tagName: "span",
1476
+ __self: this,
1477
+ __source: {
1478
+ fileName: _jsxFileName$3,
1479
+ lineNumber: 212
1480
+ }
1481
+ }))), rationale && React$4.createElement(PreviewPrompt$1, {
1482
+ className: "rationale",
1483
+ defaultClassName: "rationale",
1484
+ prompt: rationale,
1485
+ __self: this,
1486
+ __source: {
1487
+ fileName: _jsxFileName$3,
1488
+ lineNumber: 221
1489
+ }
1490
+ }), React$4.createElement(Feedback, {
1491
+ feedback: feedback,
1492
+ correctness: correctness,
1493
+ __self: this,
1494
+ __source: {
1495
+ fileName: _jsxFileName$3,
1496
+ lineNumber: 223
1497
+ }
1498
+ }));
1499
+ }
1500
+ }
1501
+ ChoiceInput.__initStatic();
1502
+ ChoiceInput.__initStatic2();
1503
+ var ChoiceInput$1 = withStyles$3(styleSheet)(ChoiceInput);
1504
+ const React$3 = _dll_react;
1505
+ const PropTypes$2 = _dll_prop_types;
1506
+ const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
1507
+ const classNames$2 = _dll_classnames;
1508
+ const _jsxFileName$2 = "/home/circleci/repo/packages/multiple-choice/src/choice.jsx";
1509
+ class Choice extends React$3.Component {
1510
+ constructor(...args) {
1511
+ super(...args);
1512
+ Choice.prototype.__init.call(this);
1513
+ }
1514
+ __init() {
1515
+ this.onChange = choice => {
1516
+ const {disabled, onChoiceChanged} = this.props;
1517
+ if (!disabled) {
1518
+ onChoiceChanged(choice);
1519
+ }
1520
+ };
1521
+ }
1522
+ render() {
1523
+ const {choice, index, choicesLength, showCorrect, isEvaluateMode, choiceMode, disabled, checked, correctness, displayKey, classes, choicesLayout, gridColumns} = this.props;
1524
+ const choiceClass = 'choice' + (index === choicesLength - 1 ? ' last' : '');
1525
+ const feedback = !isEvaluateMode || showCorrect ? '' : choice.feedback;
1526
+ const choiceProps = {
1527
+ ...choice,
1528
+ checked,
1529
+ choiceMode,
1530
+ disabled,
1531
+ feedback,
1532
+ correctness,
1533
+ displayKey,
1534
+ choicesLayout,
1535
+ gridColumns,
1536
+ onChange: this.onChange,
1537
+ isEvaluateMode
1538
+ };
1539
+ const names = classNames$2(classes.choice, {
1540
+ [classes.noBorder]: index === choicesLength - 1 || choicesLayout !== 'vertical'
1541
+ });
1542
+ return React$3.createElement('div', {
1543
+ className: choiceClass,
1544
+ key: index,
1545
+ __self: this,
1546
+ __source: {
1547
+ fileName: _jsxFileName$2,
1548
+ lineNumber: 56
1549
+ }
1550
+ }, React$3.createElement(ChoiceInput$1, {
1551
+ ...choiceProps,
1552
+ className: names,
1553
+ __self: this,
1554
+ __source: {
1555
+ fileName: _jsxFileName$2,
1556
+ lineNumber: 57
1557
+ }
1558
+ }));
1559
+ }
1560
+ }
1561
+ Choice.propTypes = {
1562
+ choiceMode: PropTypes$2.oneOf(['radio', 'checkbox']),
1563
+ choice: PropTypes$2.object,
1564
+ disabled: PropTypes$2.bool.isRequired,
1565
+ onChoiceChanged: PropTypes$2.func,
1566
+ classes: PropTypes$2.object.isRequired,
1567
+ index: PropTypes$2.number,
1568
+ choicesLength: PropTypes$2.number,
1569
+ showCorrect: PropTypes$2.bool,
1570
+ isEvaluateMode: PropTypes$2.bool,
1571
+ checked: PropTypes$2.bool,
1572
+ correctness: PropTypes$2.string,
1573
+ displayKey: PropTypes$2.string,
1574
+ choicesLayout: PropTypes$2.oneOf(['vertical', 'grid', 'horizontal']),
1575
+ gridColumns: PropTypes$2.string
1576
+ };
1577
+ var StyledChoice = withStyles$2({
1578
+ choice: {
1579
+ paddingTop: '20px',
1580
+ paddingBottom: '10px',
1581
+ borderBottom: '1px solid #E0DEE0'
1582
+ },
1583
+ noBorder: {
1584
+ borderBottom: 'none'
1585
+ }
1586
+ })(Choice);
1587
+ const React$2 = _dll_react;
1588
+ const PropTypes$1 = _dll_prop_types;
1589
+ const CorrectAnswerToggle = _dll_pie_lib__correct_answer_toggle;
1590
+ const classNames$1 = _dll_classnames;
1591
+ const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
1592
+ const {color: color} = _dll_pie_lib__render_ui;
1593
+ const {Collapsible: Collapsible} = _dll_pie_lib__render_ui;
1594
+ const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__render_ui;
1595
+ const _jsxFileName$1 = "/home/circleci/repo/packages/multiple-choice/src/multiple-choice.jsx";
1596
+ const styles = {
1597
+ corespringChoice: {
1598
+ backgroundColor: color.background(),
1599
+ padding: '5px',
1600
+ '& *': {
1601
+ '-webkit-font-smoothing': 'antialiased'
1602
+ }
1603
+ },
1604
+ horizontalLayout: {
1605
+ display: 'flex',
1606
+ flexDirection: 'row',
1607
+ flexWrap: 'wrap'
1608
+ },
1609
+ gridLayout: {
1610
+ display: 'grid'
1611
+ },
1612
+ getColumns: function (columns) {
1613
+ return columns > 1 ? {
1614
+ gridTemplateColumns: `repeat(${columns}, 1fr)`
1615
+ } : undefined;
1616
+ }
1617
+ };
1618
+ class MultipleChoice$1 extends React$2.Component {
1619
+ static __initStatic() {
1620
+ this.propTypes = {
1621
+ mode: PropTypes$1.oneOf(['gather', 'view', 'evaluate']),
1622
+ choiceMode: PropTypes$1.oneOf(['radio', 'checkbox']),
1623
+ keyMode: PropTypes$1.oneOf(['numbers', 'letters', 'none']),
1624
+ choices: PropTypes$1.array,
1625
+ prompt: PropTypes$1.string,
1626
+ teacherInstructions: PropTypes$1.string,
1627
+ session: PropTypes$1.object,
1628
+ disabled: PropTypes$1.bool,
1629
+ onChoiceChanged: PropTypes$1.func,
1630
+ responseCorrect: PropTypes$1.bool,
1631
+ classes: PropTypes$1.object.isRequired,
1632
+ correctResponse: PropTypes$1.array,
1633
+ choicesLayout: PropTypes$1.oneOf(['vertical', 'grid', 'horizontal']),
1634
+ gridColumns: PropTypes$1.string,
1635
+ alwaysShowCorrect: PropTypes$1.bool,
1636
+ animationsDisabled: PropTypes$1.bool
1637
+ };
1638
+ }
1639
+ constructor(props) {
1640
+ super(props);
1641
+ MultipleChoice$1.prototype.__init.call(this);
1642
+ this.state = {
1643
+ showCorrect: this.props.alwaysShowCorrect || false
1644
+ };
1645
+ this.onToggle = this.onToggle.bind(this);
1646
+ }
1647
+ onToggle() {
1648
+ if (this.props.mode === 'evaluate') {
1649
+ this.setState({
1650
+ showCorrect: !this.state.showCorrect
1651
+ });
1652
+ }
1653
+ }
1654
+ UNSAFE_componentWillReceiveProps(nextProps) {
1655
+ if (!nextProps.correctResponse) {
1656
+ this.setState({
1657
+ showCorrect: false
1658
+ });
1659
+ }
1660
+ if (nextProps.alwaysShowCorrect) {
1661
+ this.setState({
1662
+ showCorrect: true
1663
+ });
1664
+ }
1665
+ }
1666
+ isSelected(value) {
1667
+ const sessionValue = this.props.session && this.props.session.value;
1668
+ return sessionValue && sessionValue.indexOf && sessionValue.indexOf(value) >= 0;
1669
+ }
1670
+ indexToSymbol(index) {
1671
+ if (this.props.keyMode === 'numbers') {
1672
+ return `${index + 1}`;
1673
+ }
1674
+ if (this.props.keyMode === 'letters') {
1675
+ return String.fromCharCode(97 + index).toUpperCase();
1676
+ }
1677
+ return '';
1678
+ }
1679
+ __init() {
1680
+ this.getCorrectness = (choice = {}) => {
1681
+ const isCorrect = choice.correct;
1682
+ const isChecked = this.isSelected(choice.value);
1683
+ if (this.state.showCorrect) {
1684
+ return isCorrect ? 'correct' : undefined;
1685
+ }
1686
+ if (isCorrect) {
1687
+ if (isChecked) {
1688
+ return 'correct';
1689
+ } else {
1690
+ return 'incorrect';
1691
+ }
1692
+ } else {
1693
+ if (isChecked) {
1694
+ return 'incorrect';
1695
+ } else {
1696
+ return undefined;
1697
+ }
1698
+ }
1699
+ };
1700
+ }
1701
+ render() {
1702
+ const {mode, disabled, choices = [], choiceMode, prompt, onChoiceChanged, responseCorrect, teacherInstructions, classes, alwaysShowCorrect, animationsDisabled} = this.props;
1703
+ const {showCorrect} = this.state;
1704
+ const isEvaluateMode = mode === 'evaluate';
1705
+ const showCorrectAnswerToggle = isEvaluateMode && !responseCorrect;
1706
+ return React$2.createElement('div', {
1707
+ className: classNames$1(classes.corespringChoice, 'multiple-choice'),
1708
+ __self: this,
1709
+ __source: {
1710
+ fileName: _jsxFileName$1,
1711
+ lineNumber: 146
1712
+ }
1713
+ }, teacherInstructions && React$2.createElement(React$2.Fragment, {
1714
+ __self: this,
1715
+ __source: {
1716
+ fileName: _jsxFileName$1,
1717
+ lineNumber: 148
1718
+ }
1719
+ }, !animationsDisabled ? React$2.createElement(Collapsible, {
1720
+ labels: {
1721
+ hidden: 'Show Teacher Instructions',
1722
+ visible: 'Hide Teacher Instructions'
1723
+ },
1724
+ __self: this,
1725
+ __source: {
1726
+ fileName: _jsxFileName$1,
1727
+ lineNumber: 150
1728
+ }
1729
+ }, React$2.createElement(PreviewPrompt, {
1730
+ tagName: "div",
1731
+ className: "prompt",
1732
+ prompt: teacherInstructions,
1733
+ __self: this,
1734
+ __source: {
1735
+ fileName: _jsxFileName$1,
1736
+ lineNumber: 156
1737
+ }
1738
+ })) : React$2.createElement(PreviewPrompt, {
1739
+ tagName: "div",
1740
+ className: "prompt",
1741
+ defaultClassName: "teacher-instructions",
1742
+ prompt: teacherInstructions,
1743
+ __self: this,
1744
+ __source: {
1745
+ fileName: _jsxFileName$1,
1746
+ lineNumber: 162
1747
+ }
1748
+ }), React$2.createElement('br', {
1749
+ __self: this,
1750
+ __source: {
1751
+ fileName: _jsxFileName$1,
1752
+ lineNumber: 168
1753
+ }
1754
+ })), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
1755
+ show: showCorrectAnswerToggle,
1756
+ toggled: showCorrect,
1757
+ onToggle: this.onToggle.bind(this),
1758
+ __self: this,
1759
+ __source: {
1760
+ fileName: _jsxFileName$1,
1761
+ lineNumber: 172
1762
+ }
1763
+ }), showCorrectAnswerToggle && React$2.createElement('br', {
1764
+ __self: this,
1765
+ __source: {
1766
+ fileName: _jsxFileName$1,
1767
+ lineNumber: 178
1768
+ }
1769
+ }), React$2.createElement(PreviewPrompt, {
1770
+ className: "prompt",
1771
+ defaultClassName: "prompt",
1772
+ prompt: prompt,
1773
+ __self: this,
1774
+ __source: {
1775
+ fileName: _jsxFileName$1,
1776
+ lineNumber: 179
1777
+ }
1778
+ }), React$2.createElement('div', {
1779
+ className: classNames$1({
1780
+ [classes.gridLayout]: this.props.choicesLayout === 'grid'
1781
+ }, {
1782
+ [classes.horizontalLayout]: this.props.choicesLayout === 'horizontal'
1783
+ }),
1784
+ style: styles.getColumns(this.props.gridColumns),
1785
+ __self: this,
1786
+ __source: {
1787
+ fileName: _jsxFileName$1,
1788
+ lineNumber: 180
1789
+ }
1790
+ }, choices.map((choice, index) => React$2.createElement(StyledChoice, {
1791
+ choicesLayout: this.props.choicesLayout,
1792
+ gridColumns: this.props.gridColumns,
1793
+ key: `choice-${index}`,
1794
+ choice: choice,
1795
+ index: index,
1796
+ choicesLength: choices.length,
1797
+ showCorrect: showCorrect,
1798
+ isEvaluateMode: isEvaluateMode,
1799
+ choiceMode: choiceMode,
1800
+ disabled: disabled,
1801
+ onChoiceChanged: onChoiceChanged,
1802
+ hideTick: choice.hideTick,
1803
+ checked: showCorrect ? choice.correct || false : this.isSelected(choice.value),
1804
+ correctness: isEvaluateMode ? this.getCorrectness(choice) : undefined,
1805
+ displayKey: this.indexToSymbol(index),
1806
+ __self: this,
1807
+ __source: {
1808
+ fileName: _jsxFileName$1,
1809
+ lineNumber: 191
1810
+ }
1811
+ }))));
1812
+ }
1813
+ }
1814
+ MultipleChoice$1.__initStatic();
1815
+ MultipleChoice$1.defaultProps = {
1816
+ session: {
1817
+ value: []
1818
+ }
1819
+ };
1820
+ var MultipleChoice$2 = withStyles$1(styles)(MultipleChoice$1);
1821
+ const React$1 = _dll_react;
1822
+ const PropTypes = _dll_prop_types;
1823
+ const {withStyles: withStyles} = _dll_material_ui__core_styles;
1824
+ const {createMuiTheme: createMuiTheme} = _dll_material_ui__core_styles;
1825
+ const {MuiThemeProvider: MuiThemeProvider} = _dll_material_ui__core_styles;
1826
+ const classNames = _dll_classnames;
1827
+ const {PreviewLayout: PreviewLayout} = _dll_pie_lib__render_ui;
1828
+ const _jsxFileName = "/home/circleci/repo/packages/multiple-choice/src/main.jsx";
1829
+ class Main extends React$1.Component {
1830
+ static __initStatic() {
1831
+ this.propTypes = {
1832
+ model: PropTypes.object,
1833
+ session: PropTypes.object,
1834
+ onChoiceChanged: PropTypes.func,
1835
+ classes: PropTypes.object.isRequired
1836
+ };
1837
+ }
1838
+ static __initStatic2() {
1839
+ this.defaultProps = {
1840
+ model: {},
1841
+ session: {}
1842
+ };
1843
+ }
1844
+ constructor(props) {
1845
+ super(props);
1846
+ }
1847
+ render() {
1848
+ const {model, onChoiceChanged, session, classes} = this.props;
1849
+ return React$1.createElement(PreviewLayout, {
1850
+ __self: this,
1851
+ __source: {
1852
+ fileName: _jsxFileName,
1853
+ lineNumber: 30
1854
+ }
1855
+ }, model.partLabel && React$1.createElement('p', {
1856
+ __self: this,
1857
+ __source: {
1858
+ fileName: _jsxFileName,
1859
+ lineNumber: 31
1860
+ }
1861
+ }, model.partLabel), React$1.createElement('div', {
1862
+ className: classNames(classes.root, classes[model.className]),
1863
+ __self: this,
1864
+ __source: {
1865
+ fileName: _jsxFileName,
1866
+ lineNumber: 32
1867
+ }
1868
+ }, React$1.createElement(MultipleChoice$2, {
1869
+ ...model,
1870
+ session: session,
1871
+ onChoiceChanged: onChoiceChanged,
1872
+ __self: this,
1873
+ __source: {
1874
+ fileName: _jsxFileName,
1875
+ lineNumber: 33
1876
+ }
1877
+ })));
1878
+ }
1879
+ }
1880
+ Main.__initStatic();
1881
+ Main.__initStatic2();
1882
+ const Styled = withStyles({}, {
1883
+ name: 'Main'
1884
+ })(Main);
1885
+ const theme = createMuiTheme({
1886
+ typography: {
1887
+ useNextVariants: true
1888
+ }
1889
+ });
1890
+ const Root = props => React$1.createElement(MuiThemeProvider, {
1891
+ theme: theme,
1892
+ __self: undefined,
1893
+ __source: {
1894
+ fileName: _jsxFileName,
1895
+ lineNumber: 53
1896
+ }
1897
+ }, React$1.createElement(Styled, {
1898
+ ...props,
1899
+ __self: undefined,
1900
+ __source: {
1901
+ fileName: _jsxFileName,
1902
+ lineNumber: 54
1903
+ }
1904
+ }));
1905
+ const {concat: concat} = _dll_lodash;
1906
+ const {uniq: uniq} = _dll_lodash;
1907
+ const {without: without} = _dll_lodash;
1908
+ function updateSessionValue(session, choiceMode, data) {
1909
+ session.value = session.value || [];
1910
+ if (choiceMode === 'checkbox') {
1911
+ if (data.selected) {
1912
+ session.value = uniq(concat(session.value, [data.value]));
1913
+ } else {
1914
+ session.value = without(session.value, data.value);
1915
+ }
1916
+ }
1917
+ if (choiceMode === 'radio') {
1918
+ if (data.selected) {
1919
+ session.value = [data.value];
1920
+ } else {
1921
+ session.value = [];
1922
+ }
1923
+ }
1924
+ }
1925
+ const React = _dll_react;
1926
+ const ReactDOM = _dll_react_dom;
1927
+ const {debounce: debounce} = _dll_lodash;
1928
+ const debug = _dll_debug;
1929
+ const {renderMath: renderMath} = _dll_pie_lib__math_rendering;
1930
+ const log = debug('pie-ui:multiple-choice');
1931
+ const isComplete = session => !!(session && session.value && session.value.length);
1932
+ class MultipleChoice extends HTMLElement {
1933
+ constructor() {
1934
+ super();
1935
+ this._model = null;
1936
+ this._session = null;
1937
+ this._rerender = debounce(() => {
1938
+ if (this._model && this._session) {
1939
+ var element = React.createElement(Root, {
1940
+ model: this._model,
1941
+ session: this._session,
1942
+ onChoiceChanged: this._onChange.bind(this)
1943
+ });
1944
+ ReactDOM.render(element, this, () => {
1945
+ log('render complete - render math');
1946
+ renderMath(this);
1947
+ });
1948
+ } else {
1949
+ log('skip');
1950
+ }
1951
+ }, 50, {
1952
+ leading: false,
1953
+ trailing: true
1954
+ });
1955
+ this._dispatchResponseChanged = debounce(() => {
1956
+ var event = new CustomEvent('session-changed', {
1957
+ bubbles: true,
1958
+ composed: true,
1959
+ detail: {
1960
+ complete: isComplete(this._session),
1961
+ component: this.tagName.toLowerCase()
1962
+ }
1963
+ });
1964
+ this.dispatchEvent(event);
1965
+ });
1966
+ this._dispatchModelSet = debounce(() => {
1967
+ this.dispatchEvent(new CustomEvent('model-set', {
1968
+ bubbles: true,
1969
+ composed: true,
1970
+ detail: {
1971
+ complete: isComplete(this._session),
1972
+ component: this.tagName.toLowerCase(),
1973
+ hasModel: this._model !== undefined
1974
+ }
1975
+ }));
1976
+ }, 50, {
1977
+ leading: false,
1978
+ trailing: true
1979
+ });
1980
+ }
1981
+ set model(s) {
1982
+ this._model = s;
1983
+ this._rerender();
1984
+ this._dispatchModelSet();
1985
+ }
1986
+ get session() {
1987
+ return this._session;
1988
+ }
1989
+ set session(s) {
1990
+ this._session = s;
1991
+ this._rerender();
1992
+ this._dispatchResponseChanged();
1993
+ }
1994
+ _onChange(data) {
1995
+ updateSessionValue(this._session, this._model.choiceMode, data);
1996
+ this._dispatchResponseChanged();
1997
+ this._rerender();
1998
+ }
1999
+ connectedCallback() {
2000
+ this._rerender();
2001
+ }
2002
+ }
2003
+ export {MultipleChoice as default, isComplete};