@pie-element/inline-dropdown 5.10.2-next.17 → 5.10.2-next.18
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.
- package/configure/lib/defaults.js +151 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +209 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/inline-dropdown-toolbar.js +568 -0
- package/configure/lib/inline-dropdown-toolbar.js.map +1 -0
- package/configure/lib/main.js +737 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/markupUtils.js +70 -0
- package/configure/lib/markupUtils.js.map +1 -0
- package/configure/lib/utils.js +17 -0
- package/configure/lib/utils.js.map +1 -0
- package/controller/lib/defaults.js +11 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +363 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +40 -0
- package/controller/lib/utils.js.map +1 -0
- package/lib/index.js +118 -0
- package/lib/index.js.map +1 -0
- package/lib/inline-dropdown.js +238 -0
- package/lib/inline-dropdown.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.getAllCorrectResponses = void 0;
|
|
9
|
+
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
|
|
12
|
+
var _forEach = _interopRequireDefault(require("lodash/forEach"));
|
|
13
|
+
|
|
14
|
+
var getAllCorrectResponses = function getAllCorrectResponses(_ref) {
|
|
15
|
+
var choices = _ref.choices,
|
|
16
|
+
alternateResponse = _ref.alternateResponse;
|
|
17
|
+
alternateResponse = alternateResponse || {};
|
|
18
|
+
var correctAnswers = {};
|
|
19
|
+
(0, _forEach["default"])(choices, function (respArea, key) {
|
|
20
|
+
if (!correctAnswers[key]) {
|
|
21
|
+
correctAnswers[key] = [];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (respArea) {
|
|
25
|
+
respArea.forEach(function (choice) {
|
|
26
|
+
if (choice.correct) {
|
|
27
|
+
correctAnswers[key].push(choice.value);
|
|
28
|
+
|
|
29
|
+
if (alternateResponse[key]) {
|
|
30
|
+
correctAnswers[key] = [].concat((0, _toConsumableArray2["default"])(correctAnswers[key]), (0, _toConsumableArray2["default"])(alternateResponse[key]));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return correctAnswers;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.getAllCorrectResponses = getAllCorrectResponses;
|
|
40
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils.js"],"names":["getAllCorrectResponses","choices","alternateResponse","correctAnswers","respArea","key","forEach","choice","correct","push","value"],"mappings":";;;;;;;;;;;AAAA;;AAEO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAyB,OAAoC;AAAA,MAAjCC,OAAiC,QAAjCA,OAAiC;AAAA,MAAxBC,iBAAwB,QAAxBA,iBAAwB;AACxEA,EAAAA,iBAAiB,GAAGA,iBAAiB,IAAI,EAAzC;AACA,MAAMC,cAAc,GAAG,EAAvB;AAEA,2BAAQF,OAAR,EAAiB,UAACG,QAAD,EAAWC,GAAX,EAAmB;AAClC,QAAI,CAACF,cAAc,CAACE,GAAD,CAAnB,EAA0B;AACxBF,MAAAA,cAAc,CAACE,GAAD,CAAd,GAAsB,EAAtB;AACD;;AAED,QAAID,QAAJ,EAAc;AACZA,MAAAA,QAAQ,CAACE,OAAT,CAAiB,UAACC,MAAD,EAAY;AAC3B,YAAIA,MAAM,CAACC,OAAX,EAAoB;AAClBL,UAAAA,cAAc,CAACE,GAAD,CAAd,CAAoBI,IAApB,CAAyBF,MAAM,CAACG,KAAhC;;AAEA,cAAIR,iBAAiB,CAACG,GAAD,CAArB,EAA4B;AAC1BF,YAAAA,cAAc,CAACE,GAAD,CAAd,iDAA0BF,cAAc,CAACE,GAAD,CAAxC,uCAAkDH,iBAAiB,CAACG,GAAD,CAAnE;AACD;AACF;AACF,OARD;AASD;AACF,GAhBD;AAkBA,SAAOF,cAAP;AACD,CAvBM","sourcesContent":["import forEach from 'lodash/forEach';\n\nexport const getAllCorrectResponses = ({ choices, alternateResponse }) => {\n alternateResponse = alternateResponse || {};\n const correctAnswers = {};\n\n forEach(choices, (respArea, key) => {\n if (!correctAnswers[key]) {\n correctAnswers[key] = [];\n }\n\n if (respArea) {\n respArea.forEach((choice) => {\n if (choice.correct) {\n correctAnswers[key].push(choice.value);\n\n if (alternateResponse[key]) {\n correctAnswers[key] = [...correctAnswers[key], ...alternateResponse[key]];\n }\n }\n });\n }\n });\n\n return correctAnswers;\n};\n"],"file":"utils.js"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireDefault(require("react"));
|
|
27
|
+
|
|
28
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
29
|
+
|
|
30
|
+
var _piePlayerEvents = require("@pie-framework/pie-player-events");
|
|
31
|
+
|
|
32
|
+
var _mathRenderingAccessible = require("@pie-lib/pie-toolbox/math-rendering-accessible");
|
|
33
|
+
|
|
34
|
+
var _inlineDropdown = _interopRequireDefault(require("./inline-dropdown"));
|
|
35
|
+
|
|
36
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
37
|
+
|
|
38
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
|
+
|
|
40
|
+
var RootInlineDropdown = /*#__PURE__*/function (_HTMLElement) {
|
|
41
|
+
(0, _inherits2["default"])(RootInlineDropdown, _HTMLElement);
|
|
42
|
+
|
|
43
|
+
var _super = _createSuper(RootInlineDropdown);
|
|
44
|
+
|
|
45
|
+
function RootInlineDropdown() {
|
|
46
|
+
var _this;
|
|
47
|
+
|
|
48
|
+
(0, _classCallCheck2["default"])(this, RootInlineDropdown);
|
|
49
|
+
_this = _super.call(this);
|
|
50
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_render", function () {
|
|
51
|
+
if (_this._model && _this._session) {
|
|
52
|
+
var elem = /*#__PURE__*/_react["default"].createElement(_inlineDropdown["default"], {
|
|
53
|
+
prompt: _this._model.prompt,
|
|
54
|
+
rationale: _this._model.rationale,
|
|
55
|
+
teacherInstructions: _this._model.teacherInstructions,
|
|
56
|
+
disabled: _this._model.disabled,
|
|
57
|
+
displayType: _this._model.displayType,
|
|
58
|
+
markup: _this._model.markup,
|
|
59
|
+
mode: _this._model.mode,
|
|
60
|
+
choices: _this._model.choices,
|
|
61
|
+
value: _this._session.value,
|
|
62
|
+
feedback: _this._model.feedback,
|
|
63
|
+
language: _this._model.language,
|
|
64
|
+
onChange: _this.changeSession
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
_reactDom["default"].render(elem, (0, _assertThisInitialized2["default"])(_this), function () {
|
|
68
|
+
(0, _mathRenderingAccessible.renderMath)((0, _assertThisInitialized2["default"])(_this));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "dispatchChangedEvent", function () {
|
|
73
|
+
_this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(_this.tagName.toLowerCase(), _this.session && !!_this.session.value));
|
|
74
|
+
});
|
|
75
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeSession", function (value) {
|
|
76
|
+
_this.session.value = value;
|
|
77
|
+
|
|
78
|
+
_this.dispatchChangedEvent();
|
|
79
|
+
|
|
80
|
+
_this._render();
|
|
81
|
+
});
|
|
82
|
+
_this._model = null;
|
|
83
|
+
_this._session = null;
|
|
84
|
+
return _this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
(0, _createClass2["default"])(RootInlineDropdown, [{
|
|
88
|
+
key: "model",
|
|
89
|
+
set: function set(m) {
|
|
90
|
+
this._model = m;
|
|
91
|
+
this.dispatchEvent(new _piePlayerEvents.ModelSetEvent(this.tagName.toLowerCase(), this.session && !!this.session.value, !!this._model));
|
|
92
|
+
|
|
93
|
+
this._render();
|
|
94
|
+
}
|
|
95
|
+
}, {
|
|
96
|
+
key: "session",
|
|
97
|
+
get: function get() {
|
|
98
|
+
return this._session;
|
|
99
|
+
},
|
|
100
|
+
set: function set(s) {
|
|
101
|
+
this._session = s;
|
|
102
|
+
|
|
103
|
+
this._render();
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "connectedCallback",
|
|
107
|
+
value: function connectedCallback() {
|
|
108
|
+
this.setAttribute('aria-label', 'Inline Dropdown Question');
|
|
109
|
+
this.setAttribute('role', 'region');
|
|
110
|
+
|
|
111
|
+
this._render();
|
|
112
|
+
}
|
|
113
|
+
}]);
|
|
114
|
+
return RootInlineDropdown;
|
|
115
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
|
|
116
|
+
|
|
117
|
+
exports["default"] = RootInlineDropdown;
|
|
118
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["RootInlineDropdown","_model","_session","elem","React","createElement","InlineDropdown","prompt","rationale","teacherInstructions","disabled","displayType","markup","mode","choices","value","feedback","language","onChange","changeSession","ReactDOM","render","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","session","dispatchChangedEvent","_render","m","ModelSetEvent","s","setAttribute","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;IAEqBA,kB;;;;;AACnB,gCAAc;AAAA;;AAAA;AACZ;AADY,gGAuBJ,YAAM;AACd,UAAI,MAAKC,MAAL,IAAe,MAAKC,QAAx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Ib;;;;SACD,aAAU2B,CAAV,EAAa;AACX,WAAK5B,MAAL,GAAc4B,CAAd;AACA,WAAKP,aAAL,CACE,IAAIQ,8BAAJ,CAAkB,KAAKN,OAAL,CAAaC,WAAb,EAAlB,EAA8C,KAAKC,OAAL,IAAgB,CAAC,CAAC,KAAKA,OAAL,CAAaX,KAA7E,EAAoF,CAAC,CAAC,KAAKd,MAA3F,CADF;;AAIA,WAAK2B,OAAL;AACD;;;SAOD,eAAc;AACZ,aAAO,KAAK1B,QAAZ;AACD,K;SAPD,aAAY6B,CAAZ,EAAe;AACb,WAAK7B,QAAL,GAAgB6B,CAAhB;;AACA,WAAKH,OAAL;AACD;;;WAuCD,6BAAoB;AAClB,WAAKI,YAAL,CAAkB,YAAlB,EAAgC,0BAAhC;AACA,WAAKA,YAAL,CAAkB,MAAlB,EAA0B,QAA1B;;AAEA,WAAKJ,OAAL;AACD;;;kDA9D6CK,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { ModelSetEvent, SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering-accessible';\nimport InlineDropdown from './inline-dropdown';\n\nexport default class RootInlineDropdown extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = null;\n }\n set model(m) {\n this._model = m;\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), this.session && !!this.session.value, !!this._model),\n );\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n _render = () => {\n if (this._model && this._session) {\n let elem = React.createElement(InlineDropdown, {\n prompt: this._model.prompt,\n rationale: this._model.rationale,\n teacherInstructions: this._model.teacherInstructions,\n disabled: this._model.disabled,\n displayType: this._model.displayType,\n markup: this._model.markup,\n mode: this._model.mode,\n choices: this._model.choices,\n value: this._session.value,\n feedback: this._model.feedback,\n language: this._model.language,\n onChange: this.changeSession,\n });\n\n ReactDOM.render(elem, this, () => {\n renderMath(this);\n });\n }\n };\n\n dispatchChangedEvent = () => {\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.session && !!this.session.value));\n };\n\n changeSession = (value) => {\n this.session.value = value;\n this.dispatchChangedEvent();\n this._render();\n };\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Inline Dropdown Question');\n this.setAttribute('role', 'region');\n\n this._render();\n }\n}\n"],"file":"index.js"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.InlineDropdown = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
16
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
+
|
|
18
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireDefault(require("react"));
|
|
27
|
+
|
|
28
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
29
|
+
|
|
30
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
+
|
|
32
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
33
|
+
|
|
34
|
+
var _correctAnswerToggle = require("@pie-lib/pie-toolbox/correct-answer-toggle");
|
|
35
|
+
|
|
36
|
+
var _maskMarkup = require("@pie-lib/pie-toolbox/mask-markup");
|
|
37
|
+
|
|
38
|
+
var _renderUi = require("@pie-lib/pie-toolbox/render-ui");
|
|
39
|
+
|
|
40
|
+
var _mathRenderingAccessible = require("@pie-lib/pie-toolbox/math-rendering-accessible");
|
|
41
|
+
|
|
42
|
+
var _styles = require("@material-ui/core/styles");
|
|
43
|
+
|
|
44
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
45
|
+
|
|
46
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
47
|
+
|
|
48
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
49
|
+
|
|
50
|
+
var InlineDropdown = /*#__PURE__*/function (_React$Component) {
|
|
51
|
+
(0, _inherits2["default"])(InlineDropdown, _React$Component);
|
|
52
|
+
|
|
53
|
+
var _super = _createSuper(InlineDropdown);
|
|
54
|
+
|
|
55
|
+
function InlineDropdown() {
|
|
56
|
+
var _this;
|
|
57
|
+
|
|
58
|
+
(0, _classCallCheck2["default"])(this, InlineDropdown);
|
|
59
|
+
|
|
60
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
61
|
+
args[_key] = arguments[_key];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
65
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
66
|
+
showCorrectAnswer: false
|
|
67
|
+
});
|
|
68
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toggleShowCorrect", function () {
|
|
69
|
+
_this.setState({
|
|
70
|
+
showCorrectAnswer: !_this.state.showCorrectAnswer
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
return _this;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
(0, _createClass2["default"])(InlineDropdown, [{
|
|
77
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
78
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
79
|
+
if ((0, _isEmpty["default"])(nextProps.feedback)) {
|
|
80
|
+
this.setState({
|
|
81
|
+
showCorrectAnswer: false
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "componentDidUpdate",
|
|
87
|
+
value: function componentDidUpdate() {
|
|
88
|
+
// eslint-disable-next-line
|
|
89
|
+
var domNode = _reactDom["default"].findDOMNode(this);
|
|
90
|
+
|
|
91
|
+
(0, _mathRenderingAccessible.renderMath)(domNode);
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "render",
|
|
95
|
+
value: function render() {
|
|
96
|
+
var showCorrectAnswer = this.state.showCorrectAnswer;
|
|
97
|
+
var _this$props = this.props,
|
|
98
|
+
classes = _this$props.classes,
|
|
99
|
+
prompt = _this$props.prompt,
|
|
100
|
+
mode = _this$props.mode,
|
|
101
|
+
rationale = _this$props.rationale,
|
|
102
|
+
teacherInstructions = _this$props.teacherInstructions,
|
|
103
|
+
choices = _this$props.choices,
|
|
104
|
+
displayType = _this$props.displayType,
|
|
105
|
+
language = _this$props.language;
|
|
106
|
+
var showCorrectAnswerToggle = mode === 'evaluate';
|
|
107
|
+
var choiceRationalesHaveText = false;
|
|
108
|
+
var choiceRationales = (Object.keys(choices) || []).map(function (key) {
|
|
109
|
+
return (choices[key] || []).reduce(function (acc, currentValue) {
|
|
110
|
+
if (currentValue.rationale && (0, _renderUi.hasText)(currentValue.rationale)) {
|
|
111
|
+
choiceRationalesHaveText = true;
|
|
112
|
+
acc.push(currentValue);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return acc;
|
|
116
|
+
}, []);
|
|
117
|
+
});
|
|
118
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
119
|
+
className: classes.mainContainer,
|
|
120
|
+
style: {
|
|
121
|
+
display: "".concat(displayType)
|
|
122
|
+
}
|
|
123
|
+
}, mode === 'gather' && /*#__PURE__*/_react["default"].createElement("h2", {
|
|
124
|
+
className: classes.srOnly
|
|
125
|
+
}, "Inline Dropdown Question"), teacherInstructions && (0, _renderUi.hasText)(teacherInstructions) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
126
|
+
className: classes.collapsible,
|
|
127
|
+
labels: {
|
|
128
|
+
hidden: 'Show Teacher Instructions',
|
|
129
|
+
visible: 'Hide Teacher Instructions'
|
|
130
|
+
}
|
|
131
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
132
|
+
prompt: teacherInstructions
|
|
133
|
+
})), prompt && /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
134
|
+
prompt: prompt
|
|
135
|
+
}), /*#__PURE__*/_react["default"].createElement(_correctAnswerToggle.CorrectAnswerToggle, {
|
|
136
|
+
show: showCorrectAnswerToggle,
|
|
137
|
+
toggled: showCorrectAnswer,
|
|
138
|
+
onToggle: this.toggleShowCorrect,
|
|
139
|
+
language: language
|
|
140
|
+
}), /*#__PURE__*/_react["default"].createElement(_maskMarkup.InlineDropdown, (0, _extends2["default"])({}, this.props, {
|
|
141
|
+
showCorrectAnswer: showCorrectAnswer
|
|
142
|
+
})), choiceRationalesHaveText && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
143
|
+
className: classes.collapsible,
|
|
144
|
+
labels: {
|
|
145
|
+
hidden: 'Show Rationale for choices',
|
|
146
|
+
visible: 'Hide Rationale for choices'
|
|
147
|
+
}
|
|
148
|
+
}, choiceRationales.map(function (choices, index) {
|
|
149
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
150
|
+
key: index,
|
|
151
|
+
className: classes.choiceRationaleWrapper
|
|
152
|
+
}, (choices === null || choices === void 0 ? void 0 : choices.length) > 0 && choices.map(function (choice) {
|
|
153
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
154
|
+
className: classes.choiceRationale,
|
|
155
|
+
key: choice.label
|
|
156
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
157
|
+
className: (0, _classnames["default"])(classes.choiceRationaleLabel, choice.correct ? 'correct' : 'incorrect'),
|
|
158
|
+
dangerouslySetInnerHTML: {
|
|
159
|
+
__html: "".concat(choice.label, ": ")
|
|
160
|
+
}
|
|
161
|
+
}), /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
162
|
+
prompt: choice.rationale
|
|
163
|
+
}));
|
|
164
|
+
}));
|
|
165
|
+
})), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
166
|
+
labels: {
|
|
167
|
+
hidden: 'Show Rationale',
|
|
168
|
+
visible: 'Hide Rationale'
|
|
169
|
+
}
|
|
170
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
171
|
+
prompt: rationale
|
|
172
|
+
})));
|
|
173
|
+
}
|
|
174
|
+
}]);
|
|
175
|
+
return InlineDropdown;
|
|
176
|
+
}(_react["default"].Component);
|
|
177
|
+
|
|
178
|
+
exports.InlineDropdown = InlineDropdown;
|
|
179
|
+
(0, _defineProperty2["default"])(InlineDropdown, "propTypes", {
|
|
180
|
+
classes: _propTypes["default"].object,
|
|
181
|
+
prompt: _propTypes["default"].string,
|
|
182
|
+
disabled: _propTypes["default"].bool,
|
|
183
|
+
markup: _propTypes["default"].string,
|
|
184
|
+
mode: _propTypes["default"].string,
|
|
185
|
+
displayType: _propTypes["default"].string,
|
|
186
|
+
rationale: _propTypes["default"].string,
|
|
187
|
+
teacherInstructions: _propTypes["default"].string,
|
|
188
|
+
choices: _propTypes["default"].object,
|
|
189
|
+
value: _propTypes["default"].object,
|
|
190
|
+
feedback: _propTypes["default"].object,
|
|
191
|
+
onChange: _propTypes["default"].func
|
|
192
|
+
});
|
|
193
|
+
(0, _defineProperty2["default"])(InlineDropdown, "defaultProps", {
|
|
194
|
+
value: {}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
var styles = function styles(theme) {
|
|
198
|
+
return {
|
|
199
|
+
mainContainer: {
|
|
200
|
+
color: _renderUi.color.text(),
|
|
201
|
+
backgroundColor: _renderUi.color.background()
|
|
202
|
+
},
|
|
203
|
+
collapsible: {
|
|
204
|
+
marginBottom: theme.spacing.unit * 2
|
|
205
|
+
},
|
|
206
|
+
choiceRationaleWrapper: {
|
|
207
|
+
'&:not(:last-child)': {
|
|
208
|
+
marginBottom: theme.spacing.unit * 2
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
choiceRationale: {
|
|
212
|
+
display: 'flex',
|
|
213
|
+
whiteSpace: 'break-spaces'
|
|
214
|
+
},
|
|
215
|
+
choiceRationaleLabel: {
|
|
216
|
+
display: 'flex',
|
|
217
|
+
'&.correct': {
|
|
218
|
+
color: _renderUi.color.correct()
|
|
219
|
+
},
|
|
220
|
+
'&.incorrect': {
|
|
221
|
+
color: _renderUi.color.incorrect()
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
srOnly: {
|
|
225
|
+
position: 'absolute',
|
|
226
|
+
left: '-10000px',
|
|
227
|
+
top: 'auto',
|
|
228
|
+
width: '1px',
|
|
229
|
+
height: '1px',
|
|
230
|
+
overflow: 'hidden'
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
var _default = (0, _styles.withStyles)(styles)(InlineDropdown);
|
|
236
|
+
|
|
237
|
+
exports["default"] = _default;
|
|
238
|
+
//# sourceMappingURL=inline-dropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/inline-dropdown.jsx"],"names":["InlineDropdown","showCorrectAnswer","setState","state","nextProps","feedback","domNode","ReactDOM","findDOMNode","props","classes","prompt","mode","rationale","teacherInstructions","choices","displayType","language","showCorrectAnswerToggle","choiceRationalesHaveText","choiceRationales","Object","keys","map","key","reduce","acc","currentValue","push","mainContainer","display","srOnly","collapsible","hidden","visible","toggleShowCorrect","index","choiceRationaleWrapper","length","choice","choiceRationale","label","choiceRationaleLabel","correct","__html","React","Component","PropTypes","object","string","disabled","bool","markup","value","onChange","func","styles","theme","color","text","backgroundColor","background","marginBottom","spacing","unit","whiteSpace","incorrect","position","left","top","width","height","overflow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;IAEaA,c;;;;;;;;;;;;;;;8FAoBH;AACNC,MAAAA,iBAAiB,EAAE;AADb,K;0GAiBY,YAAM;AACxB,YAAKC,QAAL,CAAc;AAAED,QAAAA,iBAAiB,EAAE,CAAC,MAAKE,KAAL,CAAWF;AAAjC,OAAd;AACD,K;;;;;;WAfD,0CAAiCG,SAAjC,EAA4C;AAC1C,UAAI,yBAAQA,SAAS,CAACC,QAAlB,CAAJ,EAAiC;AAC/B,aAAKH,QAAL,CAAc;AAAED,UAAAA,iBAAiB,EAAE;AAArB,SAAd;AACD;AACF;;;WAED,8BAAqB;AACnB;AACA,UAAMK,OAAO,GAAGC,qBAASC,WAAT,CAAqB,IAArB,CAAhB;;AAEA,+C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N,EADM;AAEbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN;AAFJ,KADU;AAKzB7B,IAAAA,WAAW,EAAE;AACX8B,MAAAA,YAAY,EAAEL,KAAK,CAACM,OAAN,CAAcC,IAAd,GAAqB;AADxB,KALY;AAQzB3B,IAAAA,sBAAsB,EAAE;AACtB,4BAAsB;AACpByB,QAAAA,YAAY,EAAEL,KAAK,CAACM,OAAN,CAAcC,IAAd,GAAqB;AADf;AADA,KARC;AAazBxB,IAAAA,eAAe,EAAE;AACfV,MAAAA,OAAO,EAAE,MADM;AAEfmC,MAAAA,UAAU,EAAE;AAFG,KAbQ;AAiBzBvB,IAAAA,oBAAoB,EAAE;AACpBZ,MAAAA,OAAO,EAAE,MADW;AAEpB,mBAAa;AACX4B,QAAAA,KAAK,EAAEA,gBAAMf,OAAN;AADI,OAFO;AAKpB,qBAAe;AACbe,QAAAA,KAAK,EAAEA,gBAAMQ,SAAN;AADM;AALK,KAjBG;AA0BzBnC,IAAAA,MAAM,EAAE;AACNoC,MAAAA,QAAQ,EAAE,UADJ;AAENC,MAAAA,IAAI,EAAE,UAFA;AAGNC,MAAAA,GAAG,EAAE,MAHC;AAINC,MAAAA,KAAK,EAAE,KAJD;AAKNC,MAAAA,MAAM,EAAE,KALF;AAMNC,MAAAA,QAAQ,EAAE;AANJ;AA1BiB,GAAZ;AAAA,CAAf;;eAoCe,wBAAWhB,MAAX,EAAmBxD,cAAnB,C","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport isEmpty from 'lodash/isEmpty';\nimport {CorrectAnswerToggle} from '@pie-lib/pie-toolbox/correct-answer-toggle';\nimport { InlineDropdown as DropDown } from '@pie-lib/pie-toolbox/mask-markup';\nimport { color, Collapsible, hasText, PreviewPrompt } from '@pie-lib/pie-toolbox/render-ui';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering-accessible';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nexport class InlineDropdown extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n prompt: PropTypes.string,\n disabled: PropTypes.bool,\n markup: PropTypes.string,\n mode: PropTypes.string,\n displayType: PropTypes.string,\n rationale: PropTypes.string,\n teacherInstructions: PropTypes.string,\n choices: PropTypes.object,\n value: PropTypes.object,\n feedback: PropTypes.object,\n onChange: PropTypes.func,\n };\n\n static defaultProps = {\n value: {},\n };\n\n state = {\n showCorrectAnswer: false,\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (isEmpty(nextProps.feedback)) {\n this.setState({ showCorrectAnswer: false });\n }\n }\n\n componentDidUpdate() {\n // eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n toggleShowCorrect = () => {\n this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });\n };\n\n render() {\n const { showCorrectAnswer } = this.state;\n const { classes, prompt, mode, rationale, teacherInstructions, choices, displayType, language } = this.props;\n const showCorrectAnswerToggle = mode === 'evaluate';\n let choiceRationalesHaveText = false;\n\n const choiceRationales = (Object.keys(choices) || []).map((key) =>\n (choices[key] || []).reduce((acc, currentValue) => {\n if (currentValue.rationale && hasText(currentValue.rationale)) {\n choiceRationalesHaveText = true;\n\n acc.push(currentValue);\n }\n\n return acc;\n }, []),\n );\n\n return (\n <div className={classes.mainContainer} style={{ display: `${displayType}` }}>\n {mode === 'gather' && <h2 className={classes.srOnly}>Inline Dropdown Question</h2>}\n\n {teacherInstructions && hasText(teacherInstructions) && (\n <Collapsible\n className={classes.collapsible}\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </Collapsible>\n )}\n\n {prompt && <PreviewPrompt prompt={prompt} />}\n\n <CorrectAnswerToggle\n show={showCorrectAnswerToggle}\n toggled={showCorrectAnswer}\n onToggle={this.toggleShowCorrect}\n language={language}\n />\n\n <DropDown {...this.props} showCorrectAnswer={showCorrectAnswer} />\n\n {choiceRationalesHaveText && (\n <Collapsible\n className={classes.collapsible}\n labels={{ hidden: 'Show Rationale for choices', visible: 'Hide Rationale for choices' }}\n >\n {choiceRationales.map((choices, index) => (\n <div key={index} className={classes.choiceRationaleWrapper}>\n {choices?.length > 0 &&\n choices.map((choice) => (\n <div className={classes.choiceRationale} key={choice.label}>\n <div\n className={classNames(classes.choiceRationaleLabel, choice.correct ? 'correct' : 'incorrect')}\n dangerouslySetInnerHTML={{ __html: `${choice.label}: ` }}\n />\n <PreviewPrompt prompt={choice.rationale} />\n </div>\n ))}\n </div>\n ))}\n </Collapsible>\n )}\n\n {rationale && hasText(rationale) && (\n <Collapsible labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}>\n <PreviewPrompt prompt={rationale} />\n </Collapsible>\n )}\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n color: color.text(),\n backgroundColor: color.background(),\n },\n collapsible: {\n marginBottom: theme.spacing.unit * 2,\n },\n choiceRationaleWrapper: {\n '&:not(:last-child)': {\n marginBottom: theme.spacing.unit * 2,\n },\n },\n choiceRationale: {\n display: 'flex',\n whiteSpace: 'break-spaces',\n },\n choiceRationaleLabel: {\n display: 'flex',\n '&.correct': {\n color: color.correct(),\n },\n '&.incorrect': {\n color: color.incorrect(),\n },\n },\n srOnly: {\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n },\n});\n\nexport default withStyles(styles)(InlineDropdown);\n"],"file":"inline-dropdown.js"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "5.10.2-next.
|
|
7
|
+
"version": "5.10.2-next.18+68e771afe",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"postpublish": "../../scripts/postpublish"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "ISC",
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "68e771afebc28a601d494c9cfba3b97b054481fc",
|
|
25
25
|
"main": "lib/index.js",
|
|
26
26
|
"module": "src/index.js"
|
|
27
27
|
}
|