@pie-lib/mask-markup 3.0.4-next.0 → 3.0.4-next.102
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.json +17 -0
- package/CHANGELOG.md +1256 -0
- package/LICENSE.md +5 -0
- package/lib/choices/choice.js +117 -0
- package/lib/choices/choice.js.map +1 -0
- package/lib/choices/index.js +103 -0
- package/lib/choices/index.js.map +1 -0
- package/lib/componentize.js +21 -0
- package/lib/componentize.js.map +1 -0
- package/lib/components/blank.js +409 -0
- package/lib/components/blank.js.map +1 -0
- package/lib/components/correct-input.js +94 -0
- package/lib/components/correct-input.js.map +1 -0
- package/lib/components/dropdown.js +483 -0
- package/lib/components/dropdown.js.map +1 -0
- package/lib/components/input.js +50 -0
- package/lib/components/input.js.map +1 -0
- package/lib/constructed-response.js +101 -0
- package/lib/constructed-response.js.map +1 -0
- package/lib/customizable.js +42 -0
- package/lib/customizable.js.map +1 -0
- package/lib/drag-in-the-blank.js +254 -0
- package/lib/drag-in-the-blank.js.map +1 -0
- package/lib/index.js +55 -0
- package/lib/index.js.map +1 -0
- package/lib/inline-dropdown.js +40 -0
- package/lib/inline-dropdown.js.map +1 -0
- package/lib/mask.js +198 -0
- package/lib/mask.js.map +1 -0
- package/lib/serialization.js +261 -0
- package/lib/serialization.js.map +1 -0
- package/lib/with-mask.js +97 -0
- package/lib/with-mask.js.map +1 -0
- package/package.json +17 -35
- package/src/__tests__/drag-in-the-blank.test.js +111 -0
- package/src/__tests__/index.test.js +38 -0
- package/src/__tests__/mask.test.js +381 -0
- package/src/__tests__/serialization.test.js +54 -0
- package/src/__tests__/utils.js +1 -0
- package/src/__tests__/with-mask.test.js +76 -0
- package/src/choices/__tests__/index.test.js +75 -0
- package/src/choices/choice.jsx +97 -0
- package/src/choices/index.jsx +64 -0
- package/src/componentize.js +13 -0
- package/src/components/__tests__/blank.test.js +199 -0
- package/src/components/__tests__/correct-input.test.js +90 -0
- package/src/components/__tests__/dropdown.test.js +129 -0
- package/src/components/__tests__/input.test.js +102 -0
- package/src/components/blank.jsx +429 -0
- package/src/components/correct-input.jsx +82 -0
- package/src/components/dropdown.jsx +423 -0
- package/src/components/input.jsx +48 -0
- package/src/constructed-response.jsx +87 -0
- package/src/customizable.jsx +34 -0
- package/src/drag-in-the-blank.jsx +241 -0
- package/src/index.js +16 -0
- package/src/inline-dropdown.jsx +29 -0
- package/src/mask.jsx +172 -0
- package/src/serialization.js +260 -0
- package/src/with-mask.jsx +75 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -4
- package/dist/choices/choice.d.ts +0 -24
- package/dist/choices/choice.js +0 -77
- package/dist/choices/index.d.ts +0 -25
- package/dist/choices/index.js +0 -49
- package/dist/componentize.d.ts +0 -12
- package/dist/componentize.js +0 -4
- package/dist/components/blank.d.ts +0 -39
- package/dist/components/blank.js +0 -240
- package/dist/components/correct-input.d.ts +0 -11
- package/dist/components/dropdown.d.ts +0 -37
- package/dist/components/dropdown.js +0 -320
- package/dist/components/input.d.ts +0 -37
- package/dist/constructed-response.d.ts +0 -44
- package/dist/constructed-response.js +0 -55
- package/dist/customizable.d.ts +0 -43
- package/dist/customizable.js +0 -8
- package/dist/drag-in-the-blank.d.ts +0 -37
- package/dist/drag-in-the-blank.js +0 -164
- package/dist/index.d.ts +0 -15
- package/dist/index.js +0 -7
- package/dist/inline-dropdown.d.ts +0 -44
- package/dist/inline-dropdown.js +0 -24
- package/dist/mask.d.ts +0 -30
- package/dist/mask.js +0 -99
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js +0 -17
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js +0 -9
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js +0 -26
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js +0 -11
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js +0 -11
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js +0 -11
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js +0 -24
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixProperties.js +0 -32
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js +0 -29
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js +0 -14
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js +0 -8
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js +0 -12
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js +0 -11
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js +0 -10
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js +0 -10
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js +0 -55
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js +0 -16
- package/dist/serialization.d.ts +0 -34
- package/dist/serialization.js +0 -132
- package/dist/with-mask.d.ts +0 -55
- package/dist/with-mask.js +0 -45
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
11
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
|
+
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
17
|
+
var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
18
|
+
var _Menu = _interopRequireDefault(require("@mui/material/Menu"));
|
|
19
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
20
|
+
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
21
|
+
var _ArrowDropUp = _interopRequireDefault(require("@mui/icons-material/ArrowDropUp"));
|
|
22
|
+
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
23
|
+
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
24
|
+
var _styles = require("@mui/material/styles");
|
|
25
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
26
|
+
var _mathRendering = require("@pie-lib/math-rendering");
|
|
27
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
30
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
31
|
+
var StyledButton = (0, _styles.styled)(_Button["default"])(function () {
|
|
32
|
+
return {
|
|
33
|
+
color: _renderUi.color.text(),
|
|
34
|
+
border: "1px solid ".concat(_renderUi.color.borderGray()),
|
|
35
|
+
borderRadius: '4px',
|
|
36
|
+
justifyContent: 'space-between',
|
|
37
|
+
backgroundColor: _renderUi.color.background(),
|
|
38
|
+
position: 'relative',
|
|
39
|
+
height: '45px',
|
|
40
|
+
width: 'fit-content',
|
|
41
|
+
margin: '2px',
|
|
42
|
+
textTransform: 'none',
|
|
43
|
+
'& span': {
|
|
44
|
+
paddingRight: '24px'
|
|
45
|
+
},
|
|
46
|
+
'& svg': {
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
right: '4px',
|
|
49
|
+
top: 'calc(50% - 12px)',
|
|
50
|
+
pointerEvents: 'none',
|
|
51
|
+
color: _renderUi.color.text(),
|
|
52
|
+
marginLeft: '5px'
|
|
53
|
+
},
|
|
54
|
+
'&.Mui-focused': {
|
|
55
|
+
outline: "3px solid ".concat(_renderUi.color.tertiary()),
|
|
56
|
+
outlineOffset: '2px',
|
|
57
|
+
borderWidth: '3px'
|
|
58
|
+
},
|
|
59
|
+
'&.disabledCorrect': {
|
|
60
|
+
borderWidth: '2px',
|
|
61
|
+
borderColor: _renderUi.color.correct(),
|
|
62
|
+
color: "".concat(_renderUi.color.text(), " !important")
|
|
63
|
+
},
|
|
64
|
+
'&.disabledIncorrect': {
|
|
65
|
+
borderWidth: '2px',
|
|
66
|
+
borderColor: _renderUi.color.incorrectWithIcon(),
|
|
67
|
+
color: "".concat(_renderUi.color.text(), " !important")
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
var StyledMenu = (0, _styles.styled)(_Menu["default"])(function () {
|
|
72
|
+
return {
|
|
73
|
+
backgroundColor: _renderUi.color.background(),
|
|
74
|
+
border: "1px solid ".concat(_renderUi.color.correct(), " !important"),
|
|
75
|
+
'&:hover': {
|
|
76
|
+
border: "1px solid ".concat(_renderUi.color.text(), " "),
|
|
77
|
+
borderColor: 'initial'
|
|
78
|
+
},
|
|
79
|
+
'&:focus': {
|
|
80
|
+
border: "1px solid ".concat(_renderUi.color.text()),
|
|
81
|
+
borderColor: 'initial'
|
|
82
|
+
},
|
|
83
|
+
// remove default padding on the inner list
|
|
84
|
+
'& .MuiList-root': {
|
|
85
|
+
padding: 0
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
var StyledMenuItem = (0, _styles.styled)(_MenuItem["default"])(function () {
|
|
90
|
+
return {
|
|
91
|
+
// base text/layout styles (from old JSS - before mui v5 migration)
|
|
92
|
+
height: 24,
|
|
93
|
+
overflow: 'hidden',
|
|
94
|
+
fontSize: '1rem',
|
|
95
|
+
fontWeight: 400,
|
|
96
|
+
fontFamily: 'inherit',
|
|
97
|
+
lineHeight: '1.5em',
|
|
98
|
+
whiteSpace: 'nowrap',
|
|
99
|
+
// custom styles
|
|
100
|
+
color: _renderUi.color.text(),
|
|
101
|
+
backgroundColor: _renderUi.color.background(),
|
|
102
|
+
'&.Mui-focusVisible': {
|
|
103
|
+
outline: "3px solid ".concat(_renderUi.color.tertiary()),
|
|
104
|
+
outlineOffset: '-1px',
|
|
105
|
+
// keeps it inside the item
|
|
106
|
+
color: _renderUi.color.text(),
|
|
107
|
+
backgroundColor: _renderUi.color.background()
|
|
108
|
+
},
|
|
109
|
+
'&:hover': {
|
|
110
|
+
color: _renderUi.color.text(),
|
|
111
|
+
backgroundColor: _renderUi.color.dropdownBackground()
|
|
112
|
+
},
|
|
113
|
+
boxSizing: 'border-box',
|
|
114
|
+
padding: '16px 8px',
|
|
115
|
+
borderRadius: '4px',
|
|
116
|
+
'&.selected': {
|
|
117
|
+
color: "".concat(_renderUi.color.text(), " !important"),
|
|
118
|
+
backgroundColor: "".concat(_renderUi.color.background(), " !important"),
|
|
119
|
+
'&:hover': {
|
|
120
|
+
color: _renderUi.color.text(),
|
|
121
|
+
backgroundColor: "".concat(_renderUi.color.dropdownBackground(), " !important")
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
var StyledLabel = (0, _styles.styled)('span')(function () {
|
|
127
|
+
return {
|
|
128
|
+
fontSize: 'max(1rem, 14px)'
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
var StyledSelectedIndicator = (0, _styles.styled)('span')(function () {
|
|
132
|
+
return {
|
|
133
|
+
fontSize: 'max(1rem, 14px)',
|
|
134
|
+
flexShrink: 0,
|
|
135
|
+
paddingLeft: '8px'
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
var StyledInputLabel = (0, _styles.styled)(_InputLabel["default"])(function () {
|
|
139
|
+
return {
|
|
140
|
+
position: 'absolute',
|
|
141
|
+
left: '-10000px',
|
|
142
|
+
top: 'auto',
|
|
143
|
+
width: '1px',
|
|
144
|
+
height: '1px',
|
|
145
|
+
overflow: 'hidden'
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
var StyledCorrectnessIcon = (0, _styles.styled)(_Check["default"])(function () {
|
|
149
|
+
return {
|
|
150
|
+
color: "".concat(_renderUi.color.white(), " !important"),
|
|
151
|
+
position: 'absolute',
|
|
152
|
+
top: '-8px !important',
|
|
153
|
+
left: '-8px',
|
|
154
|
+
marginLeft: '0 !important',
|
|
155
|
+
borderRadius: '50%',
|
|
156
|
+
fontSize: '16px',
|
|
157
|
+
padding: '2px',
|
|
158
|
+
'&.correct': {
|
|
159
|
+
backgroundColor: _renderUi.color.correct()
|
|
160
|
+
},
|
|
161
|
+
'&.incorrect': {
|
|
162
|
+
backgroundColor: _renderUi.color.incorrectWithIcon()
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
var StyledIncorrectnessIcon = (0, _styles.styled)(_Close["default"])(function () {
|
|
167
|
+
return {
|
|
168
|
+
color: "".concat(_renderUi.color.white(), " !important"),
|
|
169
|
+
position: 'absolute',
|
|
170
|
+
top: '-8px !important',
|
|
171
|
+
left: '-8px',
|
|
172
|
+
marginLeft: '0 !important',
|
|
173
|
+
borderRadius: '50%',
|
|
174
|
+
fontSize: '16px',
|
|
175
|
+
padding: '2px',
|
|
176
|
+
'&.correct': {
|
|
177
|
+
backgroundColor: _renderUi.color.correct()
|
|
178
|
+
},
|
|
179
|
+
'&.incorrect': {
|
|
180
|
+
backgroundColor: _renderUi.color.incorrectWithIcon()
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
var Dropdown = /*#__PURE__*/function (_React$Component) {
|
|
185
|
+
function Dropdown(props) {
|
|
186
|
+
var _this;
|
|
187
|
+
(0, _classCallCheck2["default"])(this, Dropdown);
|
|
188
|
+
_this = _callSuper(this, Dropdown, [props]);
|
|
189
|
+
(0, _defineProperty2["default"])(_this, "handleClick", function (event) {
|
|
190
|
+
var _this$props = _this.props,
|
|
191
|
+
id = _this$props.id,
|
|
192
|
+
value = _this$props.value,
|
|
193
|
+
choices = _this$props.choices;
|
|
194
|
+
var highlightedOptionId = null;
|
|
195
|
+
if (value) {
|
|
196
|
+
var selectedIndex = (choices || []).findIndex(function (c) {
|
|
197
|
+
return c.value === value;
|
|
198
|
+
});
|
|
199
|
+
if (selectedIndex >= 0) {
|
|
200
|
+
highlightedOptionId = "dropdown-option-".concat(id, "-").concat(selectedIndex);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
_this.setState({
|
|
204
|
+
anchorEl: event.currentTarget,
|
|
205
|
+
highlightedOptionId: highlightedOptionId
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
(0, _defineProperty2["default"])(_this, "handleClose", function () {
|
|
209
|
+
var value = _this.props.value;
|
|
210
|
+
_this.setState({
|
|
211
|
+
anchorEl: null,
|
|
212
|
+
previewValue: null,
|
|
213
|
+
highlightedOptionId: null
|
|
214
|
+
});
|
|
215
|
+
// clear displayed preview if no selection
|
|
216
|
+
if (!value && _this.previewRef.current) {
|
|
217
|
+
_this.previewRef.current.innerHTML = '';
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
(0, _defineProperty2["default"])(_this, "handleHighlight", function (index) {
|
|
221
|
+
var highlightedOptionId = "dropdown-option-".concat(_this.props.id, "-").concat(index);
|
|
222
|
+
|
|
223
|
+
// preview on hover if nothing selected
|
|
224
|
+
var stateUpdate = {
|
|
225
|
+
highlightedOptionId: highlightedOptionId
|
|
226
|
+
};
|
|
227
|
+
if (!_this.props.value) {
|
|
228
|
+
stateUpdate.previewValue = _this.props.choices[index].value;
|
|
229
|
+
}
|
|
230
|
+
_this.setState(stateUpdate);
|
|
231
|
+
});
|
|
232
|
+
(0, _defineProperty2["default"])(_this, "handleSelect", function (value, index) {
|
|
233
|
+
_this.props.onChange(_this.props.id, value);
|
|
234
|
+
_this.handleHighlight(index);
|
|
235
|
+
_this.handleClose();
|
|
236
|
+
});
|
|
237
|
+
(0, _defineProperty2["default"])(_this, "handleHover", function (index) {
|
|
238
|
+
var selectedValue = _this.props.value;
|
|
239
|
+
if (selectedValue) return;
|
|
240
|
+
var highlightedOptionId = "dropdown-option-".concat(_this.props.id, "-").concat(index);
|
|
241
|
+
var previewValue = _this.state.previewValue;
|
|
242
|
+
_this.setState({
|
|
243
|
+
highlightedOptionId: highlightedOptionId,
|
|
244
|
+
previewValue: previewValue
|
|
245
|
+
}, function () {
|
|
246
|
+
// On hover, preview the math-rendered content inside the button if no value is selected.
|
|
247
|
+
var ref = _this.elementRefs[index];
|
|
248
|
+
var preview = _this.previewRef.current;
|
|
249
|
+
if (ref && preview) {
|
|
250
|
+
preview.innerHTML = ref.innerHTML;
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
_this.state = {
|
|
255
|
+
anchorEl: null,
|
|
256
|
+
highlightedOptionId: null,
|
|
257
|
+
menuWidth: null,
|
|
258
|
+
previewValue: null
|
|
259
|
+
};
|
|
260
|
+
_this.hiddenRef = /*#__PURE__*/_react["default"].createRef();
|
|
261
|
+
_this.buttonRef = /*#__PURE__*/_react["default"].createRef();
|
|
262
|
+
_this.previewRef = /*#__PURE__*/_react["default"].createRef();
|
|
263
|
+
_this.elementRefs = [];
|
|
264
|
+
return _this;
|
|
265
|
+
}
|
|
266
|
+
(0, _inherits2["default"])(Dropdown, _React$Component);
|
|
267
|
+
return (0, _createClass2["default"])(Dropdown, [{
|
|
268
|
+
key: "componentDidMount",
|
|
269
|
+
value: function componentDidMount() {
|
|
270
|
+
// measure hidden menu width once
|
|
271
|
+
if (this.hiddenRef.current && this.state.menuWidth === null) {
|
|
272
|
+
this.setState({
|
|
273
|
+
menuWidth: this.hiddenRef.current.clientWidth
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}, {
|
|
278
|
+
key: "componentDidUpdate",
|
|
279
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
280
|
+
var hiddenEl = this.hiddenRef.current;
|
|
281
|
+
var dropdownJustOpened = !prevState.anchorEl && this.state.anchorEl;
|
|
282
|
+
if (dropdownJustOpened) {
|
|
283
|
+
this.elementRefs.forEach(function (ref) {
|
|
284
|
+
if (!ref) return;
|
|
285
|
+
var containsLatex = ref.querySelector('[data-latex], [data-raw]');
|
|
286
|
+
var hasMathJax = ref.querySelector('mjx-container');
|
|
287
|
+
var mathHandled = ref.querySelector('[data-math-handled="true"]');
|
|
288
|
+
if (containsLatex && (!mathHandled || !hasMathJax)) {
|
|
289
|
+
(0, _mathRendering.renderMath)(ref);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
if (hiddenEl) {
|
|
294
|
+
var newWidth = hiddenEl.clientWidth;
|
|
295
|
+
if (newWidth !== this.state.menuWidth) {
|
|
296
|
+
this.elementRefs.forEach(function (ref) {
|
|
297
|
+
if (ref) (0, _mathRendering.renderMath)(ref);
|
|
298
|
+
});
|
|
299
|
+
(0, _mathRendering.renderMath)(hiddenEl);
|
|
300
|
+
this.setState({
|
|
301
|
+
menuWidth: newWidth
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}, {
|
|
307
|
+
key: "getLabel",
|
|
308
|
+
value: function getLabel(choices, value) {
|
|
309
|
+
var found = (choices || []).find(function (choice) {
|
|
310
|
+
return choice.value === value;
|
|
311
|
+
});
|
|
312
|
+
return found ? found.label.trim() : undefined;
|
|
313
|
+
}
|
|
314
|
+
}, {
|
|
315
|
+
key: "render",
|
|
316
|
+
value: function render() {
|
|
317
|
+
var _this2 = this;
|
|
318
|
+
var _this$props2 = this.props,
|
|
319
|
+
id = _this$props2.id,
|
|
320
|
+
correct = _this$props2.correct,
|
|
321
|
+
disabled = _this$props2.disabled,
|
|
322
|
+
value = _this$props2.value,
|
|
323
|
+
choices = _this$props2.choices,
|
|
324
|
+
showCorrectAnswer = _this$props2.showCorrectAnswer,
|
|
325
|
+
singleQuery = _this$props2.singleQuery,
|
|
326
|
+
correctValue = _this$props2.correctValue;
|
|
327
|
+
var anchorEl = this.state.anchorEl;
|
|
328
|
+
var open = Boolean(anchorEl);
|
|
329
|
+
var buttonId = "dropdown-button-".concat(id);
|
|
330
|
+
var menuId = "dropdown-menu-".concat(id);
|
|
331
|
+
var valueDisplayId = "dropdown-value-".concat(id);
|
|
332
|
+
|
|
333
|
+
// Determine the class for disabled state, view mode and evaluate mode
|
|
334
|
+
var disabledClass;
|
|
335
|
+
// Reset elementRefs before each render to avoid stale references
|
|
336
|
+
this.elementRefs = [];
|
|
337
|
+
if (disabled && correct !== undefined) {
|
|
338
|
+
disabledClass = correct || showCorrectAnswer ? 'disabledCorrect' : 'disabledIncorrect';
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Create distinct, visually hidden labels for each dropdown
|
|
342
|
+
var incrementedId = parseInt(id, 10) + 1;
|
|
343
|
+
var labelId = singleQuery ? 'Query-label' : "Query-label-".concat(incrementedId);
|
|
344
|
+
var labelText = singleQuery ? 'Query' : "Query ".concat(incrementedId);
|
|
345
|
+
|
|
346
|
+
// Changed from Select to Button for dropdown to enhance accessibility. This modification offers explicit control over aria attributes and focuses management, ensuring the dropdown is compliant with accessibility standards. The use of Button and Menu components allows for better handling of keyboard interactions and provides accessible labels and menus, aligning with WCAG guidelines and improving usability for assistive technology users.
|
|
347
|
+
var correctnessIcon = null;
|
|
348
|
+
if (disabled && correct !== undefined) {
|
|
349
|
+
correctnessIcon = correct || showCorrectAnswer ? /*#__PURE__*/_react["default"].createElement(StyledCorrectnessIcon, {
|
|
350
|
+
className: "correct"
|
|
351
|
+
}) : /*#__PURE__*/_react["default"].createElement(StyledIncorrectnessIcon, {
|
|
352
|
+
className: "incorrect"
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
356
|
+
ref: this.hiddenRef,
|
|
357
|
+
style: {
|
|
358
|
+
position: 'absolute',
|
|
359
|
+
visibility: 'hidden',
|
|
360
|
+
top: 0,
|
|
361
|
+
left: 0
|
|
362
|
+
},
|
|
363
|
+
tabIndex: -1,
|
|
364
|
+
"aria-hidden": "true"
|
|
365
|
+
}, (choices || []).map(function (c, index) {
|
|
366
|
+
return /*#__PURE__*/_react["default"].createElement(StyledMenuItem, {
|
|
367
|
+
key: index,
|
|
368
|
+
tabIndex: -1,
|
|
369
|
+
"aria-hidden": "true"
|
|
370
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledLabel, {
|
|
371
|
+
dangerouslySetInnerHTML: {
|
|
372
|
+
__html: c.label
|
|
373
|
+
}
|
|
374
|
+
}));
|
|
375
|
+
})), /*#__PURE__*/_react["default"].createElement(StyledInputLabel, {
|
|
376
|
+
id: labelId,
|
|
377
|
+
tabIndex: -1,
|
|
378
|
+
"aria-hidden": "true"
|
|
379
|
+
}, labelText), /*#__PURE__*/_react["default"].createElement(StyledButton, {
|
|
380
|
+
ref: this.buttonRef,
|
|
381
|
+
style: _objectSpread(_objectSpread({}, this.state.menuWidth && {
|
|
382
|
+
minWidth: "calc(".concat(this.state.menuWidth, "px + 8px)")
|
|
383
|
+
}), {}, {
|
|
384
|
+
borderWidth: open ? '2px' : '1px',
|
|
385
|
+
transition: 'border-width 0.2s ease-in-out'
|
|
386
|
+
}),
|
|
387
|
+
"aria-controls": open ? menuId : undefined,
|
|
388
|
+
"aria-haspopup": "listbox",
|
|
389
|
+
"aria-expanded": open ? 'true' : undefined,
|
|
390
|
+
"aria-activedescendant": this.state.highlightedOptionId,
|
|
391
|
+
onClick: this.handleClick,
|
|
392
|
+
className: disabledClass,
|
|
393
|
+
disabled: disabled,
|
|
394
|
+
id: buttonId,
|
|
395
|
+
role: "combobox",
|
|
396
|
+
"aria-label": "Select an option for ".concat(labelText),
|
|
397
|
+
"aria-labelledby": valueDisplayId
|
|
398
|
+
}, correctnessIcon, /*#__PURE__*/_react["default"].createElement(StyledLabel, {
|
|
399
|
+
id: valueDisplayId,
|
|
400
|
+
ref: this.previewRef,
|
|
401
|
+
dangerouslySetInnerHTML: {
|
|
402
|
+
__html: correctValue ? correctValue : open && this.state.previewValue ? this.getLabel(choices, this.state.previewValue) : this.getLabel(choices, value) || ''
|
|
403
|
+
}
|
|
404
|
+
}), open ? /*#__PURE__*/_react["default"].createElement(_ArrowDropUp["default"], null) : /*#__PURE__*/_react["default"].createElement(_ArrowDropDown["default"], null)), /*#__PURE__*/_react["default"].createElement(StyledMenu, {
|
|
405
|
+
id: menuId,
|
|
406
|
+
anchorEl: anchorEl,
|
|
407
|
+
keepMounted: true,
|
|
408
|
+
open: open,
|
|
409
|
+
onClose: this.handleClose,
|
|
410
|
+
getContentAnchorEl: null,
|
|
411
|
+
anchorOrigin: {
|
|
412
|
+
vertical: 'bottom',
|
|
413
|
+
horizontal: 'left'
|
|
414
|
+
},
|
|
415
|
+
transformOrigin: {
|
|
416
|
+
vertical: 'top',
|
|
417
|
+
horizontal: 'left'
|
|
418
|
+
},
|
|
419
|
+
transitionDuration: {
|
|
420
|
+
enter: 225,
|
|
421
|
+
exit: 195
|
|
422
|
+
},
|
|
423
|
+
slotProps: {
|
|
424
|
+
paper: this.state.menuWidth ? {
|
|
425
|
+
style: {
|
|
426
|
+
minWidth: this.state.menuWidth,
|
|
427
|
+
padding: '4px'
|
|
428
|
+
}
|
|
429
|
+
} : undefined,
|
|
430
|
+
list: {
|
|
431
|
+
'aria-labelledby': buttonId,
|
|
432
|
+
role: 'listbox',
|
|
433
|
+
disablePadding: true
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}, (choices || []).map(function (c, index) {
|
|
437
|
+
var optionId = "dropdown-option-".concat(id, "-").concat(index);
|
|
438
|
+
return /*#__PURE__*/_react["default"].createElement(StyledMenuItem, {
|
|
439
|
+
id: optionId,
|
|
440
|
+
className: c.value === value ? 'selected' : '',
|
|
441
|
+
selected: c.value === value,
|
|
442
|
+
key: "".concat(c.label, "-").concat(index),
|
|
443
|
+
value: c.value,
|
|
444
|
+
onClick: function onClick() {
|
|
445
|
+
return _this2.handleSelect(c.value, index);
|
|
446
|
+
},
|
|
447
|
+
role: "option",
|
|
448
|
+
"aria-selected": _this2.state.highlightedOptionId === optionId ? 'true' : undefined,
|
|
449
|
+
onMouseOver: function onMouseOver() {
|
|
450
|
+
return _this2.handleHover(index);
|
|
451
|
+
}
|
|
452
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledLabel, {
|
|
453
|
+
ref: function ref(_ref) {
|
|
454
|
+
return _this2.elementRefs[index] = _ref;
|
|
455
|
+
},
|
|
456
|
+
dangerouslySetInnerHTML: {
|
|
457
|
+
__html: c.label
|
|
458
|
+
}
|
|
459
|
+
}), /*#__PURE__*/_react["default"].createElement(StyledSelectedIndicator, {
|
|
460
|
+
dangerouslySetInnerHTML: {
|
|
461
|
+
__html: c.value === value ? ' ✓' : ''
|
|
462
|
+
}
|
|
463
|
+
}));
|
|
464
|
+
})));
|
|
465
|
+
}
|
|
466
|
+
}]);
|
|
467
|
+
}(_react["default"].Component);
|
|
468
|
+
(0, _defineProperty2["default"])(Dropdown, "propTypes", {
|
|
469
|
+
id: _propTypes["default"].string,
|
|
470
|
+
value: _propTypes["default"].string,
|
|
471
|
+
disabled: _propTypes["default"].bool,
|
|
472
|
+
onChange: _propTypes["default"].func,
|
|
473
|
+
correct: _propTypes["default"].bool,
|
|
474
|
+
choices: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
475
|
+
value: _propTypes["default"].string,
|
|
476
|
+
label: _propTypes["default"].string
|
|
477
|
+
})),
|
|
478
|
+
showCorrectAnswer: _propTypes["default"].bool,
|
|
479
|
+
singleQuery: _propTypes["default"].bool,
|
|
480
|
+
correctValue: _propTypes["default"].string
|
|
481
|
+
});
|
|
482
|
+
var _default = exports["default"] = Dropdown;
|
|
483
|
+
//# sourceMappingURL=dropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown.js","names":["_react","_interopRequireDefault","require","_propTypes","_Button","_InputLabel","_Menu","_MenuItem","_ArrowDropDown","_ArrowDropUp","_Close","_Check","_styles","_renderUi","_mathRendering","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","Boolean","prototype","valueOf","call","StyledButton","styled","Button","color","text","border","concat","borderGray","borderRadius","justifyContent","backgroundColor","background","position","height","width","margin","textTransform","paddingRight","right","top","pointerEvents","marginLeft","outline","tertiary","outlineOffset","borderWidth","borderColor","correct","incorrectWithIcon","StyledMenu","Menu","padding","StyledMenuItem","MenuItem","overflow","fontSize","fontWeight","fontFamily","lineHeight","whiteSpace","dropdownBackground","boxSizing","StyledLabel","StyledSelectedIndicator","flexShrink","paddingLeft","StyledInputLabel","InputLabel","left","StyledCorrectnessIcon","Check","white","StyledIncorrectnessIcon","Close","Dropdown","_React$Component","props","_this","_classCallCheck2","event","_this$props","id","value","choices","highlightedOptionId","selectedIndex","findIndex","c","setState","anchorEl","currentTarget","previewValue","previewRef","current","innerHTML","index","stateUpdate","onChange","handleHighlight","handleClose","selectedValue","state","ref","elementRefs","preview","menuWidth","hiddenRef","React","createRef","buttonRef","_inherits2","_createClass2","key","componentDidMount","clientWidth","componentDidUpdate","prevProps","prevState","hiddenEl","dropdownJustOpened","containsLatex","querySelector","hasMathJax","mathHandled","renderMath","newWidth","getLabel","found","find","choice","label","trim","undefined","render","_this2","_this$props2","disabled","showCorrectAnswer","singleQuery","correctValue","open","buttonId","menuId","valueDisplayId","disabledClass","incrementedId","parseInt","labelId","labelText","correctnessIcon","createElement","className","Fragment","style","visibility","tabIndex","map","dangerouslySetInnerHTML","__html","minWidth","transition","onClick","handleClick","role","keepMounted","onClose","getContentAnchorEl","anchorOrigin","vertical","horizontal","transformOrigin","transitionDuration","enter","exit","slotProps","paper","list","disablePadding","optionId","selected","handleSelect","onMouseOver","handleHover","Component","PropTypes","string","bool","func","arrayOf","shape","_default","exports"],"sources":["../../src/components/dropdown.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '@mui/material/Button';\nimport InputLabel from '@mui/material/InputLabel';\nimport Menu from '@mui/material/Menu';\nimport MenuItem from '@mui/material/MenuItem';\nimport ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';\nimport ArrowDropUpIcon from '@mui/icons-material/ArrowDropUp';\nimport Close from '@mui/icons-material/Close';\nimport Check from '@mui/icons-material/Check';\nimport { styled } from '@mui/material/styles';\n\nimport { color } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nconst StyledButton = styled(Button)(() => ({\n color: color.text(),\n border: `1px solid ${color.borderGray()}`,\n borderRadius: '4px',\n justifyContent: 'space-between',\n backgroundColor: color.background(),\n position: 'relative',\n height: '45px',\n width: 'fit-content',\n margin: '2px',\n textTransform: 'none',\n '& span': {\n paddingRight: '24px',\n },\n '& svg': {\n position: 'absolute',\n right: '4px',\n top: 'calc(50% - 12px)',\n pointerEvents: 'none',\n color: color.text(),\n marginLeft: '5px',\n },\n '&.Mui-focused': {\n outline: `3px solid ${color.tertiary()}`,\n outlineOffset: '2px',\n borderWidth: '3px',\n },\n '&.disabledCorrect': {\n borderWidth: '2px',\n borderColor: color.correct(),\n color: `${color.text()} !important`,\n },\n '&.disabledIncorrect': {\n borderWidth: '2px',\n borderColor: color.incorrectWithIcon(),\n color: `${color.text()} !important`,\n },\n}));\n\nconst StyledMenu = styled(Menu)(() => ({\n backgroundColor: color.background(),\n border: `1px solid ${color.correct()} !important`,\n '&:hover': {\n border: `1px solid ${color.text()} `,\n borderColor: 'initial',\n },\n '&:focus': {\n border: `1px solid ${color.text()}`,\n borderColor: 'initial',\n },\n // remove default padding on the inner list\n '& .MuiList-root': {\n padding: 0,\n },\n}));\n\nconst StyledMenuItem = styled(MenuItem)(() => ({\n // base text/layout styles (from old JSS - before mui v5 migration)\n height: 24,\n overflow: 'hidden',\n fontSize: '1rem',\n fontWeight: 400,\n fontFamily: 'inherit',\n lineHeight: '1.5em',\n whiteSpace: 'nowrap',\n\n // custom styles\n color: color.text(),\n backgroundColor: color.background(),\n '&.Mui-focusVisible': {\n outline: `3px solid ${color.tertiary()}`,\n outlineOffset: '-1px', // keeps it inside the item\n color: color.text(),\n backgroundColor: color.background(),\n },\n '&:hover': {\n color: color.text(),\n backgroundColor: color.dropdownBackground(),\n },\n boxSizing: 'border-box',\n padding: '16px 8px',\n borderRadius: '4px',\n '&.selected': {\n color: `${color.text()} !important`,\n backgroundColor: `${color.background()} !important`,\n '&:hover': {\n color: color.text(),\n backgroundColor: `${color.dropdownBackground()} !important`,\n },\n },\n}));\n\nconst StyledLabel = styled('span')(() => ({\n fontSize: 'max(1rem, 14px)',\n}));\n\nconst StyledSelectedIndicator = styled('span')(() => ({\n fontSize: 'max(1rem, 14px)',\n flexShrink: 0,\n paddingLeft: '8px',\n}));\n\nconst StyledInputLabel = styled(InputLabel)(() => ({\n position: 'absolute',\n left: '-10000px',\n top: 'auto',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n}));\n\nconst StyledCorrectnessIcon = styled(Check)(() => ({\n color: `${color.white()} !important`,\n position: 'absolute',\n top: '-8px !important',\n left: '-8px',\n marginLeft: '0 !important',\n borderRadius: '50%',\n fontSize: '16px',\n padding: '2px',\n '&.correct': {\n backgroundColor: color.correct(),\n },\n '&.incorrect': {\n backgroundColor: color.incorrectWithIcon(),\n },\n}));\n\nconst StyledIncorrectnessIcon = styled(Close)(() => ({\n color: `${color.white()} !important`,\n position: 'absolute',\n top: '-8px !important',\n left: '-8px',\n marginLeft: '0 !important',\n borderRadius: '50%',\n fontSize: '16px',\n padding: '2px',\n '&.correct': {\n backgroundColor: color.correct(),\n },\n '&.incorrect': {\n backgroundColor: color.incorrectWithIcon(),\n },\n}));\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 correct: PropTypes.bool,\n choices: PropTypes.arrayOf(PropTypes.shape({ value: PropTypes.string, label: PropTypes.string })),\n showCorrectAnswer: PropTypes.bool,\n singleQuery: PropTypes.bool,\n correctValue: PropTypes.string,\n };\n\n constructor(props) {\n super(props);\n\n this.state = {\n anchorEl: null,\n highlightedOptionId: null,\n menuWidth: null,\n previewValue: null,\n };\n this.hiddenRef = React.createRef();\n this.buttonRef = React.createRef();\n this.previewRef = React.createRef();\n this.elementRefs = [];\n }\n\n componentDidMount() {\n // measure hidden menu width once\n if (this.hiddenRef.current && this.state.menuWidth === null) {\n this.setState({ menuWidth: this.hiddenRef.current.clientWidth });\n }\n }\n\n componentDidUpdate(prevProps, prevState) {\n const hiddenEl = this.hiddenRef.current;\n\n const dropdownJustOpened = !prevState.anchorEl && this.state.anchorEl;\n if (dropdownJustOpened) {\n this.elementRefs.forEach((ref) => {\n if (!ref) return;\n\n const containsLatex = ref.querySelector('[data-latex], [data-raw]');\n const hasMathJax = ref.querySelector('mjx-container');\n const mathHandled = ref.querySelector('[data-math-handled=\"true\"]');\n\n if (containsLatex && (!mathHandled || !hasMathJax)) {\n renderMath(ref);\n }\n });\n }\n\n if (hiddenEl) {\n const newWidth = hiddenEl.clientWidth;\n if (newWidth !== this.state.menuWidth) {\n this.elementRefs.forEach((ref) => {\n if (ref) renderMath(ref);\n });\n\n renderMath(hiddenEl);\n this.setState({ menuWidth: newWidth });\n }\n }\n }\n\n handleClick = (event) => {\n const { id, value, choices } = this.props;\n let highlightedOptionId = null;\n\n if (value) {\n const selectedIndex = (choices || []).findIndex((c) => c.value === value);\n if (selectedIndex >= 0) {\n highlightedOptionId = `dropdown-option-${id}-${selectedIndex}`;\n }\n }\n\n this.setState({ anchorEl: event.currentTarget, highlightedOptionId });\n };\n\n handleClose = () => {\n const { value } = this.props;\n this.setState({ anchorEl: null, previewValue: null, highlightedOptionId: null });\n // clear displayed preview if no selection\n if (!value && this.previewRef.current) {\n this.previewRef.current.innerHTML = '';\n }\n };\n\n handleHighlight = (index) => {\n const highlightedOptionId = `dropdown-option-${this.props.id}-${index}`;\n\n // preview on hover if nothing selected\n const stateUpdate = { highlightedOptionId };\n if (!this.props.value) {\n stateUpdate.previewValue = this.props.choices[index].value;\n }\n this.setState(stateUpdate);\n };\n\n handleSelect = (value, index) => {\n this.props.onChange(this.props.id, value);\n this.handleHighlight(index);\n this.handleClose();\n };\n\n handleHover = (index) => {\n const selectedValue = this.props.value;\n\n if (selectedValue) return;\n\n const highlightedOptionId = `dropdown-option-${this.props.id}-${index}`;\n const previewValue = this.state.previewValue;\n\n this.setState({ highlightedOptionId, previewValue }, () => {\n // On hover, preview the math-rendered content inside the button if no value is selected.\n const ref = this.elementRefs[index];\n const preview = this.previewRef.current;\n\n if (ref && preview) {\n preview.innerHTML = ref.innerHTML;\n }\n });\n };\n\n getLabel(choices, value) {\n const found = (choices || []).find((choice) => choice.value === value);\n\n return found ? found.label.trim() : undefined;\n }\n\n render() {\n const { id, correct, disabled, value, choices, showCorrectAnswer, singleQuery, correctValue } = this.props;\n const { anchorEl } = this.state;\n const open = Boolean(anchorEl);\n const buttonId = `dropdown-button-${id}`;\n const menuId = `dropdown-menu-${id}`;\n const valueDisplayId = `dropdown-value-${id}`;\n\n // Determine the class for disabled state, view mode and evaluate mode\n let disabledClass;\n // Reset elementRefs before each render to avoid stale references\n this.elementRefs = [];\n\n if (disabled && correct !== undefined) {\n disabledClass = correct || showCorrectAnswer ? 'disabledCorrect' : 'disabledIncorrect';\n }\n\n // Create distinct, visually hidden labels for each dropdown\n const incrementedId = parseInt(id, 10) + 1;\n const labelId = singleQuery ? 'Query-label' : `Query-label-${incrementedId}`;\n const labelText = singleQuery ? 'Query' : `Query ${incrementedId}`;\n\n // Changed from Select to Button for dropdown to enhance accessibility. This modification offers explicit control over aria attributes and focuses management, ensuring the dropdown is compliant with accessibility standards. The use of Button and Menu components allows for better handling of keyboard interactions and provides accessible labels and menus, aligning with WCAG guidelines and improving usability for assistive technology users.\n let correctnessIcon = null;\n if (disabled && correct !== undefined) {\n correctnessIcon =\n correct || showCorrectAnswer ? (\n <StyledCorrectnessIcon className=\"correct\" />\n ) : (\n <StyledIncorrectnessIcon className=\"incorrect\" />\n );\n }\n\n return (\n <>\n <div\n ref={this.hiddenRef}\n style={{ position: 'absolute', visibility: 'hidden', top: 0, left: 0 }}\n tabIndex={-1}\n aria-hidden=\"true\"\n >\n {(choices || []).map((c, index) => (\n <StyledMenuItem key={index} tabIndex={-1} aria-hidden=\"true\">\n <StyledLabel dangerouslySetInnerHTML={{ __html: c.label }} />\n </StyledMenuItem>\n ))}\n </div>\n <StyledInputLabel id={labelId} tabIndex={-1} aria-hidden=\"true\">\n {labelText}\n </StyledInputLabel>\n <StyledButton\n ref={this.buttonRef}\n style={{\n ...(this.state.menuWidth && { minWidth: `calc(${this.state.menuWidth}px + 8px)` }),\n borderWidth: open ? '2px' : '1px',\n transition: 'border-width 0.2s ease-in-out',\n }}\n aria-controls={open ? menuId : undefined}\n aria-haspopup=\"listbox\"\n aria-expanded={open ? 'true' : undefined}\n aria-activedescendant={this.state.highlightedOptionId}\n onClick={this.handleClick}\n className={disabledClass}\n disabled={disabled}\n id={buttonId}\n role=\"combobox\"\n aria-label={`Select an option for ${labelText}`}\n aria-labelledby={valueDisplayId}\n >\n {correctnessIcon}\n <StyledLabel\n id={valueDisplayId}\n ref={this.previewRef}\n dangerouslySetInnerHTML={{\n __html: correctValue\n ? correctValue\n : open && this.state.previewValue\n ? this.getLabel(choices, this.state.previewValue)\n : this.getLabel(choices, value) || '',\n }}\n />\n {open ? <ArrowDropUpIcon /> : <ArrowDropDownIcon />}\n </StyledButton>\n <StyledMenu\n id={menuId}\n anchorEl={anchorEl}\n keepMounted\n open={open}\n onClose={this.handleClose}\n getContentAnchorEl={null}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}\n transformOrigin={{ vertical: 'top', horizontal: 'left' }}\n transitionDuration={{ enter: 225, exit: 195 }}\n slotProps={{\n paper: this.state.menuWidth ? { style: { minWidth: this.state.menuWidth, padding: '4px' } } : undefined,\n list: {\n 'aria-labelledby': buttonId,\n role: 'listbox',\n disablePadding: true,\n },\n }}\n >\n {(choices || []).map((c, index) => {\n const optionId = `dropdown-option-${id}-${index}`;\n\n return (\n <StyledMenuItem\n id={optionId}\n className={c.value === value ? 'selected' : ''}\n selected={c.value === value}\n key={`${c.label}-${index}`}\n value={c.value}\n onClick={() => this.handleSelect(c.value, index)}\n role=\"option\"\n aria-selected={this.state.highlightedOptionId === optionId ? 'true' : undefined}\n onMouseOver={() => this.handleHover(index)}\n >\n <StyledLabel\n ref={(ref) => (this.elementRefs[index] = ref)}\n dangerouslySetInnerHTML={{ __html: c.label }}\n />\n <StyledSelectedIndicator dangerouslySetInnerHTML={{ __html: c.value === value ? ' ✓' : '' }} />\n </StyledMenuItem>\n );\n })}\n </StyledMenu>\n </>\n );\n }\n}\n\nexport default Dropdown;\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,cAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,YAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,MAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,MAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AAEA,IAAAW,SAAA,GAAAX,OAAA;AACA,IAAAY,cAAA,GAAAZ,OAAA;AAAqD,SAAAa,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAA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AM,EAAEvE,CAAC,CAAC2C;UAAM;QAAE,CAC9C,CAAC,eACF7J,MAAA,YAAAiL,aAAA,CAACvF,uBAAuB;UAAC8F,uBAAuB,EAAE;YAAEC,MAAM,EAAEvE,CAAC,CAACL,KAAK,KAAKA,KAAK,GAAG,UAAU,GAAG;UAAG;QAAE,CAAE,CACtF,CAAC;MAErB,CAAC,CACS,CACZ,CAAC;IAEP;EAAC;AAAA,EAnQoByB,iBAAK,CAAC4E,SAAS;AAAA,IAAAlL,gBAAA,aAAhCqE,QAAQ,eACO;EACjBO,EAAE,EAAEuG,qBAAS,CAACC,MAAM;EACpBvG,KAAK,EAAEsG,qBAAS,CAACC,MAAM;EACvBjD,QAAQ,EAAEgD,qBAAS,CAACE,IAAI;EACxBzF,QAAQ,EAAEuF,qBAAS,CAACG,IAAI;EACxB5I,OAAO,EAAEyI,qBAAS,CAACE,IAAI;EACvBvG,OAAO,EAAEqG,qBAAS,CAACI,OAAO,CAACJ,qBAAS,CAACK,KAAK,CAAC;IAAE3G,KAAK,EAAEsG,qBAAS,CAACC,MAAM;IAAEvD,KAAK,EAAEsD,qBAAS,CAACC;EAAO,CAAC,CAAC,CAAC;EACjGhD,iBAAiB,EAAE+C,qBAAS,CAACE,IAAI;EACjChD,WAAW,EAAE8C,qBAAS,CAACE,IAAI;EAC3B/C,YAAY,EAAE6C,qBAAS,CAACC;AAC1B,CAAC;AAAA,IAAAK,QAAA,GAAAC,OAAA,cA2PYrH,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _correctInput = _interopRequireDefault(require("./correct-input"));
|
|
11
|
+
var Input = function Input(_ref) {
|
|
12
|
+
var disabled = _ref.disabled,
|
|
13
|
+
correct = _ref.correct,
|
|
14
|
+
charactersLimit = _ref.charactersLimit,
|
|
15
|
+
id = _ref.id,
|
|
16
|
+
isConstructedResponse = _ref.isConstructedResponse,
|
|
17
|
+
value = _ref.value,
|
|
18
|
+
_onChange = _ref.onChange,
|
|
19
|
+
showCorrectAnswer = _ref.showCorrectAnswer,
|
|
20
|
+
spellCheck = _ref.spellCheck,
|
|
21
|
+
width = _ref.width;
|
|
22
|
+
return /*#__PURE__*/_react["default"].createElement(_correctInput["default"], {
|
|
23
|
+
disabled: disabled,
|
|
24
|
+
correct: showCorrectAnswer || correct,
|
|
25
|
+
charactersLimit: charactersLimit,
|
|
26
|
+
variant: "outlined",
|
|
27
|
+
value: value,
|
|
28
|
+
isConstructedResponse: isConstructedResponse,
|
|
29
|
+
spellCheck: spellCheck,
|
|
30
|
+
isBox: true,
|
|
31
|
+
width: width,
|
|
32
|
+
onChange: function onChange(e) {
|
|
33
|
+
_onChange(id, e.target.value);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
Input.propTypes = {
|
|
38
|
+
id: _propTypes["default"].string,
|
|
39
|
+
value: _propTypes["default"].string,
|
|
40
|
+
onChange: _propTypes["default"].func,
|
|
41
|
+
disabled: _propTypes["default"].bool,
|
|
42
|
+
spellCheck: _propTypes["default"].bool,
|
|
43
|
+
correct: _propTypes["default"].bool,
|
|
44
|
+
showCorrectAnswer: _propTypes["default"].bool,
|
|
45
|
+
charactersLimit: _propTypes["default"].number,
|
|
46
|
+
width: _propTypes["default"].number,
|
|
47
|
+
isConstructedResponse: _propTypes["default"].bool
|
|
48
|
+
};
|
|
49
|
+
var _default = exports["default"] = Input;
|
|
50
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.js","names":["_react","_interopRequireDefault","require","_propTypes","_correctInput","Input","_ref","disabled","correct","charactersLimit","id","isConstructedResponse","value","onChange","showCorrectAnswer","spellCheck","width","createElement","variant","isBox","e","target","propTypes","PropTypes","string","func","bool","number","_default","exports"],"sources":["../../src/components/input.jsx"],"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 spellCheck,\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 spellCheck={spellCheck}\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 spellCheck: PropTypes.bool,\n correct: PropTypes.bool,\n showCorrectAnswer: PropTypes.bool,\n charactersLimit: PropTypes.number,\n width: PropTypes.number,\n isConstructedResponse: PropTypes.bool,\n};\n\nexport default Input;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAMG,KAAK,GAAG,SAARA,KAAKA,CAAAC,IAAA,EAWL;EAAA,IAVJC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IACPC,eAAe,GAAAH,IAAA,CAAfG,eAAe;IACfC,EAAE,GAAAJ,IAAA,CAAFI,EAAE;IACFC,qBAAqB,GAAAL,IAAA,CAArBK,qBAAqB;IACrBC,KAAK,GAAAN,IAAA,CAALM,KAAK;IACLC,SAAQ,GAAAP,IAAA,CAARO,QAAQ;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