@pie-lib/mask-markup 1.11.2 → 1.12.0
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/CHANGELOG.md +35 -0
- package/lib/choices/choice.js +20 -16
- package/lib/choices/choice.js.map +1 -1
- package/lib/choices/index.js +17 -15
- package/lib/choices/index.js.map +1 -1
- package/lib/components/blank.js +27 -21
- package/lib/components/blank.js.map +1 -1
- package/lib/components/correct-input.js +22 -12
- package/lib/components/correct-input.js.map +1 -1
- package/lib/components/dropdown.js +20 -16
- package/lib/components/dropdown.js.map +1 -1
- package/lib/components/input.js +7 -3
- package/lib/components/input.js.map +1 -1
- package/lib/constructed-response.js +7 -3
- package/lib/constructed-response.js.map +1 -1
- package/lib/drag-in-the-blank.js +19 -17
- package/lib/drag-in-the-blank.js.map +1 -1
- package/lib/index.js +12 -12
- package/lib/inline-dropdown.js +1 -1
- package/lib/inline-dropdown.js.map +1 -1
- package/lib/mask.js +47 -26
- package/lib/mask.js.map +1 -1
- package/lib/serialization.js +13 -4
- package/lib/serialization.js.map +1 -1
- package/lib/with-mask.js +19 -15
- package/lib/with-mask.js.map +1 -1
- package/package.json +4 -4
- package/src/components/correct-input.jsx +25 -11
- package/src/components/input.jsx +15 -2
- package/src/constructed-response.jsx +5 -2
- package/src/mask.jsx +14 -1
- package/src/serialization.js +8 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -21,37 +23,39 @@ var _renderUi = require("@pie-lib/render-ui");
|
|
|
21
23
|
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
25
|
|
|
24
|
-
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
25
|
-
|
|
26
26
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27
27
|
|
|
28
28
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
29
29
|
|
|
30
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
31
31
|
|
|
32
|
-
function
|
|
32
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
33
33
|
|
|
34
|
-
function
|
|
34
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
+
|
|
36
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
37
|
+
|
|
38
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
35
39
|
|
|
36
40
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
41
|
|
|
38
|
-
function
|
|
42
|
+
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
43
|
|
|
40
|
-
function
|
|
44
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
45
|
|
|
42
46
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
43
47
|
|
|
44
|
-
var Dropdown =
|
|
45
|
-
/*#__PURE__*/
|
|
46
|
-
function (_React$Component) {
|
|
48
|
+
var Dropdown = /*#__PURE__*/function (_React$Component) {
|
|
47
49
|
_inherits(Dropdown, _React$Component);
|
|
48
50
|
|
|
51
|
+
var _super = _createSuper(Dropdown);
|
|
52
|
+
|
|
49
53
|
function Dropdown(props) {
|
|
50
54
|
var _this;
|
|
51
55
|
|
|
52
56
|
_classCallCheck(this, Dropdown);
|
|
53
57
|
|
|
54
|
-
_this =
|
|
58
|
+
_this = _super.call(this, props);
|
|
55
59
|
|
|
56
60
|
_defineProperty(_assertThisInitialized(_this), "showCheckmarkAndOpen", function () {
|
|
57
61
|
_this.setState({
|
|
@@ -89,7 +93,7 @@ function (_React$Component) {
|
|
|
89
93
|
var _this$state = this.state,
|
|
90
94
|
showCheckmark = _this$state.showCheckmark,
|
|
91
95
|
open = _this$state.open;
|
|
92
|
-
return _react["default"].createElement(_Select["default"], {
|
|
96
|
+
return /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
93
97
|
classes: {
|
|
94
98
|
root: classes.root,
|
|
95
99
|
icon: classes.icon,
|
|
@@ -101,7 +105,7 @@ function (_React$Component) {
|
|
|
101
105
|
onOpen: this.showCheckmarkAndOpen,
|
|
102
106
|
onClose: this.hideCheckmarkAndClose,
|
|
103
107
|
open: open,
|
|
104
|
-
input: _react["default"].createElement(_correctInput["default"], {
|
|
108
|
+
input: /*#__PURE__*/_react["default"].createElement(_correctInput["default"], {
|
|
105
109
|
correct: showCorrectAnswer || correct
|
|
106
110
|
}),
|
|
107
111
|
MenuProps: {
|
|
@@ -112,19 +116,19 @@ function (_React$Component) {
|
|
|
112
116
|
_onChange(id, e.target.value);
|
|
113
117
|
}
|
|
114
118
|
}, (choices || []).map(function (c, index) {
|
|
115
|
-
return _react["default"].createElement(_MenuItem["default"], {
|
|
119
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
116
120
|
classes: {
|
|
117
121
|
root: classes.menuRoot,
|
|
118
122
|
selected: classes.selected
|
|
119
123
|
},
|
|
120
124
|
key: "".concat(c.label, "-").concat(index),
|
|
121
125
|
value: c.value
|
|
122
|
-
}, _react["default"].createElement("span", {
|
|
126
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
123
127
|
className: classes.label,
|
|
124
128
|
dangerouslySetInnerHTML: {
|
|
125
129
|
__html: c.label
|
|
126
130
|
}
|
|
127
|
-
}), showCheckmark && _react["default"].createElement("span", {
|
|
131
|
+
}), showCheckmark && /*#__PURE__*/_react["default"].createElement("span", {
|
|
128
132
|
className: classes.label,
|
|
129
133
|
dangerouslySetInnerHTML: {
|
|
130
134
|
__html: c.value === value ? ' ✓' : ''
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/dropdown.jsx"],"names":["Dropdown","props","setState","showCheckmark","open","state","classes","id","correct","disabled","value","onChange","choices","showCorrectAnswer","root","icon","selectMenu","select","showCheckmarkAndOpen","hideCheckmarkAndClose","keepMounted","disablePortal","e","target","map","c","index","menuRoot","selected","label","__html","React","Component","PropTypes","string","bool","func","object","arrayOf","shape","styles","color","text","backgroundColor","background","borderColor","secondaryLight","paddingTop","paddingBottom","border","borderRadius","boxSizing","padding","fontSize"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/components/dropdown.jsx"],"names":["Dropdown","props","setState","showCheckmark","open","state","classes","id","correct","disabled","value","onChange","choices","showCorrectAnswer","root","icon","selectMenu","select","showCheckmarkAndOpen","hideCheckmarkAndClose","keepMounted","disablePortal","e","target","map","c","index","menuRoot","selected","label","__html","React","Component","PropTypes","string","bool","func","object","arrayOf","shape","styles","color","text","backgroundColor","background","borderColor","secondaryLight","paddingTop","paddingBottom","border","borderRadius","boxSizing","padding","fontSize"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;IAEMA,Q;;;;;AAcJ,oBAAYC,KAAZ,EAAmB;AAAA;;AAAA;;AACjB,8BAAMA,KAAN;;AADiB,2EASI,YAAM;AAC3B,YAAKC,QAAL,CAAc;AACZC,QAAAA,aAAa,EAAE,IADH;AAEZC,QAAAA,IAAI,EAAE;AAFM,OAAd;AAID,KAdkB;;AAAA,4EAgBK,YAAM;AAC5B,YAAKF,QAAL,CAAc;AACZC,QAAAA,aAAa,EAAE,KADH;AAEZC,QAAAA,IAAI,EAAE;AAFM,OAAd;AAID,KArBkB;;AAGjB,UAA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AAEF,gBAAMG,UAAN,EAFT;AAGR,iBAAW;AACTH,QAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADE;AAETC,QAAAA,eAAe,EAAEF,gBAAMG,UAAN;AAFR,OAHH;AAOR,iBAAW;AACTH,QAAAA,KAAK,EAAEA,gBAAMC,IAAN,EADE;AAETC,QAAAA,eAAe,EAAEF,gBAAMK,cAAN;AAFR,OAPH;AAWRK,MAAAA,SAAS,EAAE,YAXH;AAYRC,MAAAA,OAAO,EAAE,MAZD;AAaR,yBAAmB;AACjBF,QAAAA,YAAY,EAAE;AADG,OAbX;AAgBR,wBAAkB;AAChBA,QAAAA,YAAY,EAAE;AADE;AAhBV,KAvCU;AA2DpBrB,IAAAA,KAAK,EAAE;AACLwB,MAAAA,QAAQ,EAAE;AADL;AA3Da,GAAP;AAAA,CAAf;;eAgEe,wBAAWb,MAAX,EAAmBxC,QAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Select from '@material-ui/core/Select';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport CorrectInput from './correct-input';\nimport { withStyles } from '@material-ui/core/styles';\nimport { color } from '@pie-lib/render-ui';\n\nclass Dropdown extends React.Component {\n static propTypes = {\n id: PropTypes.string,\n value: PropTypes.string,\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n classes: PropTypes.object,\n correct: PropTypes.bool,\n choices: PropTypes.arrayOf(\n PropTypes.shape({ value: PropTypes.string, label: PropTypes.string })\n ),\n showCorrectAnswer: PropTypes.bool\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n showCheckmark: false,\n open: false\n };\n }\n\n showCheckmarkAndOpen = () => {\n this.setState({\n showCheckmark: true,\n open: true\n });\n };\n\n hideCheckmarkAndClose = () => {\n this.setState({\n showCheckmark: false,\n open: false\n });\n };\n\n render() {\n const {\n classes,\n id,\n correct,\n disabled,\n value,\n onChange,\n choices,\n showCorrectAnswer\n } = this.props;\n\n const { showCheckmark, open } = this.state;\n\n return (\n <Select\n classes={{\n root: classes.root,\n icon: classes.icon,\n selectMenu: classes.selectMenu,\n select: classes.select\n }}\n disabled={disabled}\n value={value || ''}\n onOpen={this.showCheckmarkAndOpen}\n onClose={this.hideCheckmarkAndClose}\n open={open}\n input={<CorrectInput correct={showCorrectAnswer || correct} />}\n MenuProps={{\n keepMounted: true,\n disablePortal: true\n }}\n onChange={e => {\n onChange(id, e.target.value);\n }}\n >\n {(choices || []).map((c, index) => (\n <MenuItem\n classes={{ root: classes.menuRoot, selected: classes.selected }}\n key={`${c.label}-${index}`}\n value={c.value}\n >\n <span\n className={classes.label}\n dangerouslySetInnerHTML={{\n __html: c.label\n }}\n />\n {showCheckmark && (\n <span\n className={classes.label}\n dangerouslySetInnerHTML={{ __html: c.value === value ? ' ✓' : '' }}\n />\n )}\n </MenuItem>\n ))}\n </Select>\n );\n }\n}\n\nconst styles = () => ({\n root: {\n color: color.text(),\n backgroundColor: color.background(),\n borderColor: color.secondaryLight(),\n '& ul': {\n paddingTop: 0,\n paddingBottom: 0,\n border: `1px solid ${color.text()}`,\n borderRadius: '5px',\n color: color.text(),\n backgroundColor: color.background()\n }\n },\n select: {\n '&:focus': {\n borderRadius: '4px'\n }\n },\n selectMenu: {\n backgroundColor: color.background(),\n '&:hover': {\n borderColor: 'initial'\n },\n '&:focus': {\n borderColor: 'initial'\n }\n },\n icon: {\n color: color.text()\n },\n selected: {\n color: `${color.text()} !important`,\n backgroundColor: `${color.background()} !important`,\n '&:hover': {\n color: color.text(),\n backgroundColor: `${color.secondaryLight()} !important`\n }\n },\n menuRoot: {\n color: color.text(),\n backgroundColor: color.background(),\n '&:focus': {\n color: color.text(),\n backgroundColor: color.background()\n },\n '&:hover': {\n color: color.text(),\n backgroundColor: color.secondaryLight()\n },\n boxSizing: 'border-box',\n padding: '25px',\n '&:first-of-type': {\n borderRadius: '3px 3px 0 0'\n },\n '&:last-of-type': {\n borderRadius: '0 0 3px 3px'\n }\n },\n label: {\n fontSize: 'max(1rem, 14px)'\n }\n});\n\nexport default withStyles(styles)(Dropdown);\n"],"file":"dropdown.js"}
|
package/lib/components/input.js
CHANGED
|
@@ -16,18 +16,22 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
16
16
|
var Input = function Input(_ref) {
|
|
17
17
|
var disabled = _ref.disabled,
|
|
18
18
|
correct = _ref.correct,
|
|
19
|
+
charactersLimit = _ref.charactersLimit,
|
|
19
20
|
id = _ref.id,
|
|
21
|
+
isConstructedResponse = _ref.isConstructedResponse,
|
|
20
22
|
value = _ref.value,
|
|
21
23
|
_onChange = _ref.onChange,
|
|
22
24
|
showCorrectAnswer = _ref.showCorrectAnswer,
|
|
23
|
-
|
|
24
|
-
return _react["default"].createElement(_correctInput["default"], {
|
|
25
|
+
width = _ref.width;
|
|
26
|
+
return /*#__PURE__*/_react["default"].createElement(_correctInput["default"], {
|
|
25
27
|
disabled: disabled,
|
|
26
28
|
correct: showCorrectAnswer || correct,
|
|
29
|
+
charactersLimit: charactersLimit,
|
|
27
30
|
variant: "outlined",
|
|
28
31
|
value: value,
|
|
32
|
+
isConstructedResponse: isConstructedResponse,
|
|
29
33
|
isBox: true,
|
|
30
|
-
|
|
34
|
+
width: width,
|
|
31
35
|
onChange: function onChange(e) {
|
|
32
36
|
_onChange(id, e.target.value);
|
|
33
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/input.jsx"],"names":["Input","disabled","correct","id","value","onChange","showCorrectAnswer","
|
|
1
|
+
{"version":3,"sources":["../../src/components/input.jsx"],"names":["Input","disabled","correct","charactersLimit","id","isConstructedResponse","value","onChange","showCorrectAnswer","width","e","target","propTypes","PropTypes","string","func","bool"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAEA,IAAMA,KAAK,GAAG,SAARA,KAAQ,OAUR;AAAA,MATJC,QASI,QATJA,QASI;AAAA,MARJC,OAQI,QARJA,OAQI;AAAA,MAPJC,eAOI,QAPJA,eAOI;AAAA,MANJC,EAMI,QANJA,EAMI;AAAA,MALJC,qBAKI,QALJA,qBAKI;AAAA,MAJJC,KAII,QAJJA,KAII;AAAA,MAHJC,SAGI,QAHJA,QAGI;AAAA,MAFJC,iBAEI,QAFJA,iBAEI;AAAA,MADJC,KACI,QADJA,KACI;AACJ,sBACE,gCAAC,wBAAD;AACE,IAAA,QAAQ,EAAER,QADZ;AAEE,IAAA,OAAO,EAAEO,iBAAiB,IAAIN,OAFhC;AAGE,IAAA,eAAe,EAAEC,eAHnB;AAIE,IAAA,OAAO,EAAC,UAJV;AAKE,IAAA,KAAK,EAAEG,KALT;AAME,IAAA,qBAAqB,EAAED,qBANzB;AAOE,IAAA,KAAK,EAAE,IAPT;AAQE,IAAA,KAAK,EAAEI,KART;AASE,IAAA,QAAQ,EAAE,kBAAAC,CAAC,EAAI;AACbH,MAAAA,SAAQ,CAACH,EAAD,EAAKM,CAAC,CAACC,MAAF,CAASL,KAAd,CAAR;AACD;AAXH,IADF;AAeD,CA1BD;;AA4BAN,KAAK,CAACY,SAAN,GAAkB;AAChBR,EAAAA,EAAE,EAAES,sBAAUC,MADE;AAEhBR,EAAAA,KAAK,EAAEO,sBAAUC,MAFD;AAGhBP,EAAAA,QAAQ,EAAEM,sBAAUE,IAHJ;AAIhBd,EAAAA,QAAQ,EAAEY,sBAAUG,IAJJ;AAKhBd,EAAAA,OAAO,EAAEW,sBAAUG,IALH;AAMhBR,EAAAA,iBAAiB,EAAEK,sBAAUG;AANb,CAAlB;eASehB,K","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport CorrectInput from './correct-input';\n\nconst Input = ({\n disabled,\n correct,\n charactersLimit,\n id,\n isConstructedResponse,\n value,\n onChange,\n showCorrectAnswer,\n width\n}) => {\n return (\n <CorrectInput\n disabled={disabled}\n correct={showCorrectAnswer || correct}\n charactersLimit={charactersLimit}\n variant=\"outlined\"\n value={value}\n isConstructedResponse={isConstructedResponse}\n isBox={true}\n width={width}\n onChange={e => {\n onChange(id, e.target.value);\n }}\n />\n );\n};\n\nInput.propTypes = {\n id: PropTypes.string,\n value: PropTypes.string,\n onChange: PropTypes.func,\n disabled: PropTypes.bool,\n correct: PropTypes.bool,\n showCorrectAnswer: PropTypes.bool\n};\n\nexport default Input;\n"],"file":"input.js"}
|
|
@@ -18,14 +18,16 @@ var _default = (0, _withMask.withMask)('input', function (props) {
|
|
|
18
18
|
var dataset = node.data ? node.data.dataset || {} : {};
|
|
19
19
|
|
|
20
20
|
if (dataset.component === 'input') {
|
|
21
|
-
var
|
|
21
|
+
var adjustedLimit = props.adjustedLimit,
|
|
22
|
+
disabled = props.disabled,
|
|
22
23
|
feedback = props.feedback,
|
|
23
24
|
showCorrectAnswer = props.showCorrectAnswer,
|
|
24
25
|
maxLength = props.maxLength; // the first answer is the correct one
|
|
25
26
|
|
|
26
27
|
var correctAnswer = (props.choices && dataset && props.choices[dataset.id] || [])[0];
|
|
27
28
|
var finalValue = showCorrectAnswer ? correctAnswer && correctAnswer.label : data[dataset.id] || '';
|
|
28
|
-
|
|
29
|
+
var width = maxLength && maxLength[dataset.id];
|
|
30
|
+
return /*#__PURE__*/_react["default"].createElement(_input["default"], {
|
|
29
31
|
key: "".concat(node.type, "-input-").concat(dataset.id),
|
|
30
32
|
correct: feedback && feedback[dataset.id] && feedback[dataset.id] === 'correct',
|
|
31
33
|
disabled: showCorrectAnswer || disabled,
|
|
@@ -33,7 +35,9 @@ var _default = (0, _withMask.withMask)('input', function (props) {
|
|
|
33
35
|
id: dataset.id,
|
|
34
36
|
onChange: onChange,
|
|
35
37
|
showCorrectAnswer: showCorrectAnswer,
|
|
36
|
-
|
|
38
|
+
width: width,
|
|
39
|
+
charactersLimit: adjustedLimit ? width : 25,
|
|
40
|
+
isConstructedResponse: true
|
|
37
41
|
});
|
|
38
42
|
}
|
|
39
43
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constructed-response.jsx"],"names":["props","node","data","onChange","dataset","component","disabled","feedback","showCorrectAnswer","maxLength","correctAnswer","choices","id","finalValue","label","type"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;eAEe,wBAAS,OAAT,EAAkB,UAAAA,KAAK;AAAA,SAAI,UAACC,IAAD,EAAOC,IAAP,EAAaC,QAAb,EAA0B;AAClE,QAAMC,OAAO,GAAGH,IAAI,CAACC,IAAL,GAAYD,IAAI,CAACC,IAAL,CAAUE,OAAV,IAAqB,EAAjC,GAAsC,EAAtD;;AACA,QAAIA,OAAO,CAACC,SAAR,KAAsB,OAA1B,EAAmC;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/constructed-response.jsx"],"names":["props","node","data","onChange","dataset","component","adjustedLimit","disabled","feedback","showCorrectAnswer","maxLength","correctAnswer","choices","id","finalValue","label","width","type"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;eAEe,wBAAS,OAAT,EAAkB,UAAAA,KAAK;AAAA,SAAI,UAACC,IAAD,EAAOC,IAAP,EAAaC,QAAb,EAA0B;AAClE,QAAMC,OAAO,GAAGH,IAAI,CAACC,IAAL,GAAYD,IAAI,CAACC,IAAL,CAAUE,OAAV,IAAqB,EAAjC,GAAsC,EAAtD;;AACA,QAAIA,OAAO,CAACC,SAAR,KAAsB,OAA1B,EAAmC;AACjC,UAAQC,aAAR,GAA4EN,KAA5E,CAAQM,aAAR;AAAA,UAAuBC,QAAvB,GAA4EP,KAA5E,CAAuBO,QAAvB;AAAA,UAAiCC,QAAjC,GAA4ER,KAA5E,CAAiCQ,QAAjC;AAAA,UAA2CC,iBAA3C,GAA4ET,KAA5E,CAA2CS,iBAA3C;AAAA,UAA8DC,SAA9D,GAA4EV,KAA5E,CAA8DU,SAA9D,CADiC,CAEjC;;AACA,UAAMC,aAAa,GAAG,CAAEX,KAAK,CAACY,OAAN,IAAiBR,OAAjB,IAA4BJ,KAAK,CAACY,OAAN,CAAcR,OAAO,CAACS,EAAtB,CAA7B,IAA2D,EAA5D,EAAgE,CAAhE,CAAtB;AACA,UAAMC,UAAU,GAAGL,iBAAiB,GAChCE,aAAa,IAAIA,aAAa,CAACI,KADC,GAEhCb,IAAI,CAACE,OAAO,CAACS,EAAT,CAAJ,IAAoB,EAFxB;AAGA,UAAMG,KAAK,GAAGN,SAAS,IAAIA,SAAS,CAACN,OAAO,CAACS,EAAT,CAApC;AAEA,0BACE,gCAAC,iBAAD;AACE,QAAA,GAAG,YAAKZ,IAAI,CAACgB,IAAV,oBAAwBb,OAAO,CAACS,EAAhC,CADL;AAEE,QAAA,OAAO,EAAEL,QAAQ,IAAIA,QAAQ,CAACJ,OAAO,CAACS,EAAT,CAApB,IAAoCL,QAAQ,CAACJ,OAAO,CAACS,EAAT,CAAR,KAAyB,SAFxE;AAGE,QAAA,QAAQ,EAAEJ,iBAAiB,IAAIF,QAHjC;AAIE,QAAA,KAAK,EAAEO,UAJT;AAKE,QAAA,EAAE,EAAEV,OAAO,CAACS,EALd;AAME,QAAA,QAAQ,EAAEV,QANZ;AAOE,QAAA,iBAAiB,EAAEM,iBAPrB;AAQE,QAAA,KAAK,EAAEO,KART;AASE,QAAA,eAAe,EAAEV,aAAa,GAAGU,KAAH,GAAW,EAT3C;AAUE,QAAA,qBAAqB,EAAE;AAVzB,QADF;AAcD;AACF,GA1BqC;AAAA,CAAvB,C","sourcesContent":["import React from 'react';\nimport Input from './components/input';\nimport { withMask } from './with-mask';\n\nexport default withMask('input', props => (node, data, onChange) => {\n const dataset = node.data ? node.data.dataset || {} : {};\n if (dataset.component === 'input') {\n const { adjustedLimit, disabled, feedback, showCorrectAnswer, maxLength } = props;\n // the first answer is the correct one\n const correctAnswer = ((props.choices && dataset && props.choices[dataset.id]) || [])[0];\n const finalValue = showCorrectAnswer\n ? correctAnswer && correctAnswer.label\n : data[dataset.id] || '';\n const width = maxLength && maxLength[dataset.id];\n\n return (\n <Input\n key={`${node.type}-input-${dataset.id}`}\n correct={feedback && feedback[dataset.id] && feedback[dataset.id] === 'correct'}\n disabled={showCorrectAnswer || disabled}\n value={finalValue}\n id={dataset.id}\n onChange={onChange}\n showCorrectAnswer={showCorrectAnswer}\n width={width}\n charactersLimit={adjustedLimit ? width : 25}\n isConstructedResponse={true}\n />\n );\n }\n});\n"],"file":"constructed-response.js"}
|
package/lib/drag-in-the-blank.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -19,23 +21,25 @@ var _withMask = require("./with-mask");
|
|
|
19
21
|
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
23
|
|
|
22
|
-
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
23
|
-
|
|
24
24
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
25
|
|
|
26
26
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
27
27
|
|
|
28
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
28
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
29
29
|
|
|
30
|
-
function
|
|
30
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
31
31
|
|
|
32
|
-
function
|
|
32
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
|
+
|
|
34
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
35
|
+
|
|
36
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
33
37
|
|
|
34
38
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
39
|
|
|
36
|
-
function
|
|
40
|
+
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; } }
|
|
37
41
|
|
|
38
|
-
function
|
|
42
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
43
|
|
|
40
44
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
41
45
|
|
|
@@ -53,7 +57,7 @@ var Masked = (0, _withMask.withMask)('blank', function (props) {
|
|
|
53
57
|
var choice = choiceId && props.choices.find(function (c) {
|
|
54
58
|
return c.id === choiceId;
|
|
55
59
|
});
|
|
56
|
-
return _react["default"].createElement(_blank["default"], {
|
|
60
|
+
return /*#__PURE__*/_react["default"].createElement(_blank["default"], {
|
|
57
61
|
key: "".concat(node.type, "-").concat(dataset.id),
|
|
58
62
|
correct: showCorrectAnswer || feedback && feedback[dataset.id],
|
|
59
63
|
disabled: disabled,
|
|
@@ -66,14 +70,12 @@ var Masked = (0, _withMask.withMask)('blank', function (props) {
|
|
|
66
70
|
};
|
|
67
71
|
});
|
|
68
72
|
|
|
69
|
-
var DragInTheBlank =
|
|
70
|
-
/*#__PURE__*/
|
|
71
|
-
function (_React$Component) {
|
|
73
|
+
var DragInTheBlank = /*#__PURE__*/function (_React$Component) {
|
|
72
74
|
_inherits(DragInTheBlank, _React$Component);
|
|
73
75
|
|
|
74
|
-
|
|
75
|
-
var _getPrototypeOf2;
|
|
76
|
+
var _super = _createSuper(DragInTheBlank);
|
|
76
77
|
|
|
78
|
+
function DragInTheBlank() {
|
|
77
79
|
var _this;
|
|
78
80
|
|
|
79
81
|
_classCallCheck(this, DragInTheBlank);
|
|
@@ -82,7 +84,7 @@ function (_React$Component) {
|
|
|
82
84
|
args[_key] = arguments[_key];
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
_this =
|
|
87
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
86
88
|
|
|
87
89
|
_defineProperty(_assertThisInitialized(_this), "getPositionDirection", function (choicePosition) {
|
|
88
90
|
var flexDirection;
|
|
@@ -146,18 +148,18 @@ function (_React$Component) {
|
|
|
146
148
|
display: 'flex',
|
|
147
149
|
flexDirection: this.getPositionDirection(choicePosition)
|
|
148
150
|
};
|
|
149
|
-
return _react["default"].createElement("div", {
|
|
151
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
150
152
|
ref: function ref(_ref) {
|
|
151
153
|
return _ref && (_this2.rootRef = _ref);
|
|
152
154
|
},
|
|
153
155
|
style: style
|
|
154
|
-
}, _react["default"].createElement(_choices["default"], {
|
|
156
|
+
}, /*#__PURE__*/_react["default"].createElement(_choices["default"], {
|
|
155
157
|
choicePosition: choicePosition,
|
|
156
158
|
duplicates: duplicates,
|
|
157
159
|
choices: choices,
|
|
158
160
|
value: value,
|
|
159
161
|
disabled: disabled
|
|
160
|
-
}), _react["default"].createElement(Masked, {
|
|
162
|
+
}), /*#__PURE__*/_react["default"].createElement(Masked, {
|
|
161
163
|
markup: markup,
|
|
162
164
|
layout: layout,
|
|
163
165
|
value: value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/drag-in-the-blank.jsx"],"names":["Masked","props","node","data","onChange","dataset","component","disabled","duplicates","correctResponse","feedback","showCorrectAnswer","choiceId","id","choice","choices","find","c","type","DragInTheBlank","choicePosition","flexDirection","rootRef","markup","layout","value","choicesPosition","style","display","getPositionDirection","ref","React","Component","PropTypes","string","object","arrayOf","shape","label","func","bool"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/drag-in-the-blank.jsx"],"names":["Masked","props","node","data","onChange","dataset","component","disabled","duplicates","correctResponse","feedback","showCorrectAnswer","choiceId","id","choice","choices","find","c","type","DragInTheBlank","choicePosition","flexDirection","rootRef","markup","layout","value","choicesPosition","style","display","getPositionDirection","ref","React","Component","PropTypes","string","object","arrayOf","shape","label","func","bool"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM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';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport Choices from './choices';\nimport Blank from './components/blank';\nimport { withMask } from './with-mask';\n\nconst Masked = withMask('blank', props => (node, data, onChange) => {\n const dataset = node.data ? node.data.dataset || {} : {};\n\n if (dataset.component === 'blank') {\n const { disabled, duplicates, correctResponse, feedback, showCorrectAnswer } = props;\n const choiceId = showCorrectAnswer ? correctResponse[dataset.id] : data[dataset.id];\n const choice = choiceId && props.choices.find(c => c.id === choiceId);\n\n return (\n <Blank\n key={`${node.type}-${dataset.id}`}\n correct={showCorrectAnswer || (feedback && feedback[dataset.id])}\n disabled={disabled}\n duplicates={duplicates}\n choice={choice}\n id={dataset.id}\n onChange={onChange}\n />\n );\n }\n});\n\nexport default class DragInTheBlank extends React.Component {\n static propTypes = {\n markup: PropTypes.string,\n layout: PropTypes.object,\n choicesPosition: PropTypes.string,\n choices: PropTypes.arrayOf(\n PropTypes.shape({ label: PropTypes.string, value: PropTypes.string })\n ),\n value: PropTypes.object,\n onChange: PropTypes.func,\n duplicates: PropTypes.bool,\n disabled: PropTypes.bool,\n feedback: PropTypes.object,\n correctResponse: PropTypes.object,\n showCorrectAnswer: PropTypes.bool\n };\n\n componentWillReceiveProps() {\n if (this.rootRef) {\n renderMath(this.rootRef);\n }\n }\n\n componentDidUpdate() {\n renderMath(this.rootRef);\n }\n\n getPositionDirection = choicePosition => {\n let flexDirection;\n\n switch (choicePosition) {\n case 'left':\n flexDirection = 'row';\n break;\n case 'right':\n flexDirection = 'row-reverse';\n break;\n case 'below':\n flexDirection = 'column-reverse';\n break;\n default:\n // above\n flexDirection = 'column';\n break;\n }\n\n return flexDirection;\n };\n\n render() {\n const {\n markup,\n duplicates,\n layout,\n value,\n onChange,\n choicesPosition,\n choices,\n correctResponse,\n disabled,\n feedback,\n showCorrectAnswer\n } = this.props;\n\n const choicePosition = choicesPosition || 'below';\n const style = {\n display: 'flex',\n flexDirection: this.getPositionDirection(choicePosition)\n };\n\n return (\n <div ref={ref => ref && (this.rootRef = ref)} style={style}>\n <Choices\n choicePosition={choicePosition}\n duplicates={duplicates}\n choices={choices}\n value={value}\n disabled={disabled}\n />\n <Masked\n markup={markup}\n layout={layout}\n value={value}\n choices={choices}\n onChange={onChange}\n disabled={disabled}\n duplicates={duplicates}\n feedback={feedback}\n correctResponse={correctResponse}\n showCorrectAnswer={showCorrectAnswer}\n />\n </div>\n );\n }\n}\n"],"file":"drag-in-the-blank.js"}
|
package/lib/index.js
CHANGED
|
@@ -3,16 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _withMask.withMask;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "buildLayoutFromMarkup", {
|
|
6
|
+
Object.defineProperty(exports, "ConstructedResponse", {
|
|
13
7
|
enumerable: true,
|
|
14
8
|
get: function get() {
|
|
15
|
-
return
|
|
9
|
+
return _constructedResponse["default"];
|
|
16
10
|
}
|
|
17
11
|
});
|
|
18
12
|
Object.defineProperty(exports, "DragInTheBlank", {
|
|
@@ -21,16 +15,16 @@ Object.defineProperty(exports, "DragInTheBlank", {
|
|
|
21
15
|
return _dragInTheBlank["default"];
|
|
22
16
|
}
|
|
23
17
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "InlineDropdown", {
|
|
25
19
|
enumerable: true,
|
|
26
20
|
get: function get() {
|
|
27
|
-
return
|
|
21
|
+
return _inlineDropdown["default"];
|
|
28
22
|
}
|
|
29
23
|
});
|
|
30
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "buildLayoutFromMarkup", {
|
|
31
25
|
enumerable: true,
|
|
32
26
|
get: function get() {
|
|
33
|
-
return
|
|
27
|
+
return _withMask.buildLayoutFromMarkup;
|
|
34
28
|
}
|
|
35
29
|
});
|
|
36
30
|
Object.defineProperty(exports, "componentize", {
|
|
@@ -39,6 +33,12 @@ Object.defineProperty(exports, "componentize", {
|
|
|
39
33
|
return _componentize["default"];
|
|
40
34
|
}
|
|
41
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "withMask", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _withMask.withMask;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
42
|
|
|
43
43
|
var _withMask = require("./with-mask");
|
|
44
44
|
|
package/lib/inline-dropdown.js
CHANGED
|
@@ -26,7 +26,7 @@ var _default = (0, _withMask.withMask)('dropdown', function (props) {
|
|
|
26
26
|
return c.correct;
|
|
27
27
|
});
|
|
28
28
|
var finalChoice = showCorrectAnswer ? correctAnswer && correctAnswer.value : data[dataset.id];
|
|
29
|
-
return _react["default"].createElement(_dropdown["default"], {
|
|
29
|
+
return /*#__PURE__*/_react["default"].createElement(_dropdown["default"], {
|
|
30
30
|
key: "".concat(node.type, "-dropdown-").concat(dataset.id),
|
|
31
31
|
correct: feedback && feedback[dataset.id] && feedback[dataset.id] === 'correct',
|
|
32
32
|
disabled: disabled || showCorrectAnswer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/inline-dropdown.jsx"],"names":["props","node","data","onChange","dataset","component","choices","disabled","feedback","showCorrectAnswer","correctAnswer","id","find","c","correct","finalChoice","value","type"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;eAEe,wBAAS,UAAT,EAAqB,UAAAA,KAAK;AAAA,SAAI,UAACC,IAAD,EAAOC,IAAP,EAAaC,QAAb,EAA0B;AACrE,QAAMC,OAAO,GAAGH,IAAI,CAACC,IAAL,GAAYD,IAAI,CAACC,IAAL,CAAUE,OAAV,IAAqB,EAAjC,GAAsC,EAAtD;;AACA,QAAIA,OAAO,CAACC,SAAR,KAAsB,UAA1B,EAAsC;
|
|
1
|
+
{"version":3,"sources":["../src/inline-dropdown.jsx"],"names":["props","node","data","onChange","dataset","component","choices","disabled","feedback","showCorrectAnswer","correctAnswer","id","find","c","correct","finalChoice","value","type"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;eAEe,wBAAS,UAAT,EAAqB,UAAAA,KAAK;AAAA,SAAI,UAACC,IAAD,EAAOC,IAAP,EAAaC,QAAb,EAA0B;AACrE,QAAMC,OAAO,GAAGH,IAAI,CAACC,IAAL,GAAYD,IAAI,CAACC,IAAL,CAAUE,OAAV,IAAqB,EAAjC,GAAsC,EAAtD;;AACA,QAAIA,OAAO,CAACC,SAAR,KAAsB,UAA1B,EAAsC;AACpC,UAAQC,OAAR,GAA2DN,KAA3D,CAAQM,OAAR;AAAA,UAAiBC,QAAjB,GAA2DP,KAA3D,CAAiBO,QAAjB;AAAA,UAA2BC,QAA3B,GAA2DR,KAA3D,CAA2BQ,QAA3B;AAAA,UAAqCC,iBAArC,GAA2DT,KAA3D,CAAqCS,iBAArC;AACA,UAAMC,aAAa,GACjBJ,OAAO,IAAIA,OAAO,CAACF,OAAO,CAACO,EAAT,CAAlB,IAAkCL,OAAO,CAACF,OAAO,CAACO,EAAT,CAAP,CAAoBC,IAApB,CAAyB,UAAAC,CAAC;AAAA,eAAIA,CAAC,CAACC,OAAN;AAAA,OAA1B,CADpC;AAEA,UAAMC,WAAW,GAAGN,iBAAiB,GAAGC,aAAa,IAAIA,aAAa,CAACM,KAAlC,GAA0Cd,IAAI,CAACE,OAAO,CAACO,EAAT,CAAnF;AAEA,0BACE,gCAAC,oBAAD;AACE,QAAA,GAAG,YAAKV,IAAI,CAACgB,IAAV,uBAA2Bb,OAAO,CAACO,EAAnC,CADL;AAEE,QAAA,OAAO,EAAEH,QAAQ,IAAIA,QAAQ,CAACJ,OAAO,CAACO,EAAT,CAApB,IAAoCH,QAAQ,CAACJ,OAAO,CAACO,EAAT,CAAR,KAAyB,SAFxE;AAGE,QAAA,QAAQ,EAAEJ,QAAQ,IAAIE,iBAHxB;AAIE,QAAA,KAAK,EAAEM,WAJT;AAKE,QAAA,EAAE,EAAEX,OAAO,CAACO,EALd;AAME,QAAA,QAAQ,EAAER,QANZ;AAOE,QAAA,OAAO,EAAEG,OAAO,CAACF,OAAO,CAACO,EAAT,CAPlB;AAQE,QAAA,iBAAiB,EAAEF;AARrB,QADF;AAYD;AACF,GArBwC;AAAA,CAA1B,C","sourcesContent":["import React from 'react';\nimport Dropdown from './components/dropdown';\nimport { withMask } from './with-mask';\n\nexport default withMask('dropdown', props => (node, data, onChange) => {\n const dataset = node.data ? node.data.dataset || {} : {};\n if (dataset.component === 'dropdown') {\n const { choices, disabled, feedback, showCorrectAnswer } = props;\n const correctAnswer =\n choices && choices[dataset.id] && choices[dataset.id].find(c => c.correct);\n const finalChoice = showCorrectAnswer ? correctAnswer && correctAnswer.value : data[dataset.id];\n\n return (\n <Dropdown\n key={`${node.type}-dropdown-${dataset.id}`}\n correct={feedback && feedback[dataset.id] && feedback[dataset.id] === 'correct'}\n disabled={disabled || showCorrectAnswer}\n value={finalChoice}\n id={dataset.id}\n onChange={onChange}\n choices={choices[dataset.id]}\n showCorrectAnswer={showCorrectAnswer}\n />\n );\n }\n});\n"],"file":"inline-dropdown.js"}
|