@pie-lib/mask-markup 1.33.2-next.0 → 1.35.0-mui-update.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 +14 -7
- package/lib/choices/choice.js +74 -203
- package/lib/choices/choice.js.map +1 -1
- package/lib/choices/index.js +19 -52
- package/lib/choices/index.js.map +1 -1
- package/lib/componentize.js +1 -5
- package/lib/componentize.js.map +1 -1
- package/lib/components/blank.js +292 -357
- package/lib/components/blank.js.map +1 -1
- package/lib/components/correct-input.js +41 -65
- package/lib/components/correct-input.js.map +1 -1
- package/lib/components/dropdown.js +218 -257
- package/lib/components/dropdown.js.map +1 -1
- package/lib/components/input.js +10 -17
- package/lib/components/input.js.map +1 -1
- package/lib/constructed-response.js +38 -52
- package/lib/constructed-response.js.map +1 -1
- package/lib/customizable.js +5 -9
- package/lib/customizable.js.map +1 -1
- package/lib/drag-in-the-blank.js +117 -96
- package/lib/drag-in-the-blank.js.map +1 -1
- package/lib/index.js +0 -7
- package/lib/index.js.map +1 -1
- package/lib/inline-dropdown.js +4 -12
- package/lib/inline-dropdown.js.map +1 -1
- package/lib/mask.js +40 -112
- package/lib/mask.js.map +1 -1
- package/lib/serialization.js +8 -48
- package/lib/serialization.js.map +1 -1
- package/lib/with-mask.js +26 -55
- package/lib/with-mask.js.map +1 -1
- package/package.json +12 -10
- package/src/choices/choice.jsx +58 -154
- package/src/choices/index.jsx +8 -2
- package/src/components/blank.jsx +272 -262
- package/src/components/correct-input.jsx +33 -39
- package/src/components/dropdown.jsx +173 -161
- package/src/constructed-response.jsx +22 -18
- package/src/drag-in-the-blank.jsx +97 -39
- package/src/mask.jsx +18 -27
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import OutlinedInput from '@material
|
|
2
|
+
import OutlinedInput from '@mui/material/OutlinedInput';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import {
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
5
|
import { color } from '@pie-lib/render-ui';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const StyledOutlinedInput = styled(OutlinedInput)(() => ({
|
|
8
|
+
padding: '2px',
|
|
9
|
+
borderRadius: '4px',
|
|
10
|
+
fontSize: 'inherit',
|
|
11
|
+
display: 'inline-block',
|
|
12
|
+
verticalAlign: 'middle',
|
|
13
|
+
'& fieldset': {
|
|
14
|
+
border: 0,
|
|
15
|
+
},
|
|
16
|
+
'& .MuiOutlinedInput-input': {
|
|
13
17
|
color: color.text(),
|
|
14
18
|
backgroundColor: color.background(),
|
|
15
19
|
borderRadius: '4px !important',
|
|
@@ -26,35 +30,25 @@ export default withStyles(() => ({
|
|
|
26
30
|
borderColor: 'initial',
|
|
27
31
|
},
|
|
28
32
|
},
|
|
29
|
-
'
|
|
33
|
+
'&.Mui-focused': {
|
|
30
34
|
borderColor: color.primaryDark(),
|
|
31
35
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
display: 'inline-block',
|
|
41
|
-
verticalAlign: 'middle',
|
|
42
|
-
},
|
|
43
|
-
outlinedInput: {
|
|
44
|
-
padding: '2px',
|
|
45
|
-
borderRadius: '4px',
|
|
46
|
-
'& fieldset': {
|
|
47
|
-
border: 0,
|
|
36
|
+
'&.crInput': {
|
|
37
|
+
padding: '8px !important',
|
|
38
|
+
},
|
|
39
|
+
'&.correct': {
|
|
40
|
+
borderColor: `${color.correct()} !important`,
|
|
41
|
+
},
|
|
42
|
+
'&.incorrect': {
|
|
43
|
+
borderColor: `${color.incorrect()} !important`,
|
|
48
44
|
},
|
|
49
45
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}))((props) => {
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
const CorrectInput = (props) => {
|
|
54
49
|
const {
|
|
55
50
|
correct,
|
|
56
51
|
charactersLimit,
|
|
57
|
-
classes,
|
|
58
52
|
disabled,
|
|
59
53
|
isBox,
|
|
60
54
|
isConstructedResponse,
|
|
@@ -75,24 +69,24 @@ export default withStyles(() => ({
|
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
return (
|
|
78
|
-
<
|
|
72
|
+
<StyledOutlinedInput
|
|
79
73
|
className={classnames({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
[classes.outlinedInput]: true,
|
|
74
|
+
disabledInput: disabled,
|
|
75
|
+
box: isBox,
|
|
83
76
|
})}
|
|
84
77
|
classes={{
|
|
85
78
|
input: classnames({
|
|
86
|
-
[
|
|
87
|
-
|
|
88
|
-
[classes.crInput]: isConstructedResponse,
|
|
79
|
+
[label]: label,
|
|
80
|
+
crInput: isConstructedResponse,
|
|
89
81
|
}),
|
|
90
82
|
}}
|
|
91
83
|
inputProps={inputProps}
|
|
92
|
-
labelWidth={0}
|
|
93
84
|
disabled={disabled}
|
|
94
85
|
spellCheck={spellCheck}
|
|
95
86
|
{...rest}
|
|
96
87
|
/>
|
|
97
88
|
);
|
|
98
|
-
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export default CorrectInput;
|
|
92
|
+
|
|
@@ -1,26 +1,159 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import Button from '@material
|
|
4
|
-
import InputLabel from '@material
|
|
5
|
-
import Menu from '@material
|
|
6
|
-
import MenuItem from '@material
|
|
7
|
-
import ArrowDropDownIcon from '@
|
|
8
|
-
import ArrowDropUpIcon from '@
|
|
9
|
-
import Close from '@
|
|
10
|
-
import Check from '@
|
|
11
|
-
import {
|
|
12
|
-
import classNames from 'classnames';
|
|
3
|
+
import Button from '@mui/material/Button';
|
|
4
|
+
import InputLabel from '@mui/material/InputLabel';
|
|
5
|
+
import Menu from '@mui/material/Menu';
|
|
6
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
7
|
+
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
8
|
+
import ArrowDropUpIcon from '@mui/icons-material/ArrowDropUp';
|
|
9
|
+
import Close from '@mui/icons-material/Close';
|
|
10
|
+
import Check from '@mui/icons-material/Check';
|
|
11
|
+
import { styled } from '@mui/material/styles';
|
|
13
12
|
|
|
14
13
|
import { color } from '@pie-lib/render-ui';
|
|
15
14
|
import { renderMath } from '@pie-lib/math-rendering';
|
|
16
15
|
|
|
16
|
+
const StyledButton = styled(Button)(() => ({
|
|
17
|
+
color: color.text(),
|
|
18
|
+
border: `1px solid ${color.borderGray()}`,
|
|
19
|
+
borderRadius: '4px',
|
|
20
|
+
justifyContent: 'space-between',
|
|
21
|
+
backgroundColor: color.background(),
|
|
22
|
+
position: 'relative',
|
|
23
|
+
height: '45px',
|
|
24
|
+
width: 'fit-content',
|
|
25
|
+
margin: '2px',
|
|
26
|
+
textTransform: 'none',
|
|
27
|
+
'& span': {
|
|
28
|
+
paddingRight: '5px',
|
|
29
|
+
},
|
|
30
|
+
'& svg': {
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
right: 0,
|
|
33
|
+
top: 'calc(50% - 12px)',
|
|
34
|
+
pointerEvents: 'none',
|
|
35
|
+
color: color.text(),
|
|
36
|
+
marginLeft: '5px',
|
|
37
|
+
},
|
|
38
|
+
'&.Mui-focused': {
|
|
39
|
+
outline: `3px solid ${color.tertiary()}`,
|
|
40
|
+
outlineOffset: '2px',
|
|
41
|
+
borderWidth: '3px',
|
|
42
|
+
},
|
|
43
|
+
'&.disabledCorrect': {
|
|
44
|
+
borderWidth: '2px',
|
|
45
|
+
borderColor: color.correct(),
|
|
46
|
+
color: `${color.text()} !important`,
|
|
47
|
+
},
|
|
48
|
+
'&.disabledIncorrect': {
|
|
49
|
+
borderWidth: '2px',
|
|
50
|
+
borderColor: color.incorrectWithIcon(),
|
|
51
|
+
color: `${color.text()} !important`,
|
|
52
|
+
},
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
const StyledMenu = styled(Menu)(() => ({
|
|
56
|
+
backgroundColor: color.background(),
|
|
57
|
+
border: `1px solid ${color.correct()} !important`,
|
|
58
|
+
'&:hover': {
|
|
59
|
+
border: `1px solid ${color.text()} `,
|
|
60
|
+
borderColor: 'initial',
|
|
61
|
+
},
|
|
62
|
+
'&:focus': {
|
|
63
|
+
border: `1px solid ${color.text()}`,
|
|
64
|
+
borderColor: 'initial',
|
|
65
|
+
},
|
|
66
|
+
// remove default padding on the inner list
|
|
67
|
+
'& .MuiList-root': {
|
|
68
|
+
padding: 0,
|
|
69
|
+
},
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
const StyledMenuItem = styled(MenuItem)(() => ({
|
|
73
|
+
color: color.text(),
|
|
74
|
+
backgroundColor: color.background(),
|
|
75
|
+
'&.Mui-focused': {
|
|
76
|
+
outline: `3px solid ${color.tertiary()}`,
|
|
77
|
+
outlineOffset: '-1px', // keeps it inside the item
|
|
78
|
+
color: color.text(),
|
|
79
|
+
backgroundColor: color.background(),
|
|
80
|
+
},
|
|
81
|
+
'&:hover': {
|
|
82
|
+
color: color.text(),
|
|
83
|
+
backgroundColor: color.dropdownBackground(),
|
|
84
|
+
},
|
|
85
|
+
boxSizing: 'border-box',
|
|
86
|
+
padding: '25px',
|
|
87
|
+
borderRadius: '4px',
|
|
88
|
+
'&.selected': {
|
|
89
|
+
color: `${color.text()} !important`,
|
|
90
|
+
backgroundColor: `${color.background()} !important`,
|
|
91
|
+
'&:hover': {
|
|
92
|
+
color: color.text(),
|
|
93
|
+
backgroundColor: `${color.dropdownBackground()} !important`,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
}));
|
|
97
|
+
|
|
98
|
+
const StyledLabel = styled('span')(() => ({
|
|
99
|
+
fontSize: 'max(1rem, 14px)',
|
|
100
|
+
}));
|
|
101
|
+
|
|
102
|
+
const StyledSelectedIndicator = styled('span')(() => ({
|
|
103
|
+
fontSize: 'max(1rem, 14px)',
|
|
104
|
+
position: 'absolute',
|
|
105
|
+
right: '10px',
|
|
106
|
+
}));
|
|
107
|
+
|
|
108
|
+
const StyledInputLabel = styled(InputLabel)(() => ({
|
|
109
|
+
position: 'absolute',
|
|
110
|
+
left: '-10000px',
|
|
111
|
+
top: 'auto',
|
|
112
|
+
width: '1px',
|
|
113
|
+
height: '1px',
|
|
114
|
+
overflow: 'hidden',
|
|
115
|
+
}));
|
|
116
|
+
|
|
117
|
+
const StyledCorrectnessIcon = styled(Check)(() => ({
|
|
118
|
+
color: `${color.white()} !important`,
|
|
119
|
+
position: 'absolute',
|
|
120
|
+
top: '-8px !important',
|
|
121
|
+
left: '-8px',
|
|
122
|
+
marginLeft: '0 !important',
|
|
123
|
+
borderRadius: '50%',
|
|
124
|
+
fontSize: '16px',
|
|
125
|
+
padding: '2px',
|
|
126
|
+
'&.correct': {
|
|
127
|
+
backgroundColor: color.correct(),
|
|
128
|
+
},
|
|
129
|
+
'&.incorrect': {
|
|
130
|
+
backgroundColor: color.incorrectWithIcon(),
|
|
131
|
+
},
|
|
132
|
+
}));
|
|
133
|
+
|
|
134
|
+
const StyledIncorrectnessIcon = styled(Close)(() => ({
|
|
135
|
+
color: `${color.white()} !important`,
|
|
136
|
+
position: 'absolute',
|
|
137
|
+
top: '-8px !important',
|
|
138
|
+
left: '-8px',
|
|
139
|
+
marginLeft: '0 !important',
|
|
140
|
+
borderRadius: '50%',
|
|
141
|
+
fontSize: '16px',
|
|
142
|
+
padding: '2px',
|
|
143
|
+
'&.correct': {
|
|
144
|
+
backgroundColor: color.correct(),
|
|
145
|
+
},
|
|
146
|
+
'&.incorrect': {
|
|
147
|
+
backgroundColor: color.incorrectWithIcon(),
|
|
148
|
+
},
|
|
149
|
+
}));
|
|
150
|
+
|
|
17
151
|
class Dropdown extends React.Component {
|
|
18
152
|
static propTypes = {
|
|
19
153
|
id: PropTypes.string,
|
|
20
154
|
value: PropTypes.string,
|
|
21
155
|
disabled: PropTypes.bool,
|
|
22
156
|
onChange: PropTypes.func,
|
|
23
|
-
classes: PropTypes.object,
|
|
24
157
|
correct: PropTypes.bool,
|
|
25
158
|
choices: PropTypes.arrayOf(PropTypes.shape({ value: PropTypes.string, label: PropTypes.string })),
|
|
26
159
|
showCorrectAnswer: PropTypes.bool,
|
|
@@ -135,7 +268,7 @@ class Dropdown extends React.Component {
|
|
|
135
268
|
}
|
|
136
269
|
|
|
137
270
|
render() {
|
|
138
|
-
const {
|
|
271
|
+
const { id, correct, disabled, value, choices, showCorrectAnswer, singleQuery, correctValue } = this.props;
|
|
139
272
|
const { anchorEl } = this.state;
|
|
140
273
|
const open = Boolean(anchorEl);
|
|
141
274
|
const buttonId = `dropdown-button-${id}`;
|
|
@@ -148,7 +281,7 @@ class Dropdown extends React.Component {
|
|
|
148
281
|
this.elementRefs = [];
|
|
149
282
|
|
|
150
283
|
if (disabled && correct !== undefined) {
|
|
151
|
-
disabledClass = correct || showCorrectAnswer ?
|
|
284
|
+
disabledClass = correct || showCorrectAnswer ? 'disabledCorrect' : 'disabledIncorrect';
|
|
152
285
|
}
|
|
153
286
|
|
|
154
287
|
// Create distinct, visually hidden labels for each dropdown
|
|
@@ -161,9 +294,9 @@ class Dropdown extends React.Component {
|
|
|
161
294
|
if (disabled && correct !== undefined) {
|
|
162
295
|
correctnessIcon =
|
|
163
296
|
correct || showCorrectAnswer ? (
|
|
164
|
-
<
|
|
297
|
+
<StyledCorrectnessIcon className="correct" />
|
|
165
298
|
) : (
|
|
166
|
-
<
|
|
299
|
+
<StyledIncorrectnessIcon className="incorrect" />
|
|
167
300
|
);
|
|
168
301
|
}
|
|
169
302
|
|
|
@@ -176,20 +309,19 @@ class Dropdown extends React.Component {
|
|
|
176
309
|
aria-hidden="true"
|
|
177
310
|
>
|
|
178
311
|
{(choices || []).map((c, index) => (
|
|
179
|
-
<
|
|
312
|
+
<StyledMenuItem
|
|
180
313
|
key={index}
|
|
181
|
-
classes={{ root: classes.menuRoot, selected: classes.selected }}
|
|
182
314
|
tabIndex={-1}
|
|
183
315
|
aria-hidden="true"
|
|
184
316
|
>
|
|
185
|
-
<
|
|
186
|
-
</
|
|
317
|
+
<StyledLabel dangerouslySetInnerHTML={{ __html: c.label }} />
|
|
318
|
+
</StyledMenuItem>
|
|
187
319
|
))}
|
|
188
320
|
</div>
|
|
189
|
-
<
|
|
321
|
+
<StyledInputLabel id={labelId} tabIndex={-1} aria-hidden="true">
|
|
190
322
|
{labelText}
|
|
191
|
-
</
|
|
192
|
-
<
|
|
323
|
+
</StyledInputLabel>
|
|
324
|
+
<StyledButton
|
|
193
325
|
ref={this.buttonRef}
|
|
194
326
|
style={{
|
|
195
327
|
...(this.state.menuWidth && { minWidth: `calc(${this.state.menuWidth}px + 8px)` }),
|
|
@@ -201,10 +333,7 @@ class Dropdown extends React.Component {
|
|
|
201
333
|
aria-expanded={open ? 'true' : undefined}
|
|
202
334
|
aria-activedescendant={this.state.highlightedOptionId}
|
|
203
335
|
onClick={this.handleClick}
|
|
204
|
-
|
|
205
|
-
root: classes.root,
|
|
206
|
-
disabled: disabledClass,
|
|
207
|
-
}}
|
|
336
|
+
className={disabledClass}
|
|
208
337
|
disabled={disabled}
|
|
209
338
|
id={buttonId}
|
|
210
339
|
role="combobox"
|
|
@@ -212,10 +341,9 @@ class Dropdown extends React.Component {
|
|
|
212
341
|
aria-labelledby={valueDisplayId}
|
|
213
342
|
>
|
|
214
343
|
{correctnessIcon}
|
|
215
|
-
<
|
|
344
|
+
<StyledLabel
|
|
216
345
|
id={valueDisplayId}
|
|
217
346
|
ref={this.previewRef}
|
|
218
|
-
className={classes.label}
|
|
219
347
|
dangerouslySetInnerHTML={{
|
|
220
348
|
__html: correctValue
|
|
221
349
|
? correctValue
|
|
@@ -225,31 +353,33 @@ class Dropdown extends React.Component {
|
|
|
225
353
|
}}
|
|
226
354
|
/>
|
|
227
355
|
{open ? <ArrowDropUpIcon /> : <ArrowDropDownIcon />}
|
|
228
|
-
</
|
|
229
|
-
<
|
|
356
|
+
</StyledButton>
|
|
357
|
+
<StyledMenu
|
|
230
358
|
id={menuId}
|
|
231
359
|
anchorEl={anchorEl}
|
|
232
|
-
className={classes.selectMenu}
|
|
233
360
|
keepMounted
|
|
234
361
|
open={open}
|
|
235
362
|
onClose={this.handleClose}
|
|
236
363
|
getContentAnchorEl={null}
|
|
237
364
|
anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
|
|
238
365
|
transformOrigin={{ vertical: 'top', horizontal: 'left' }}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
'
|
|
242
|
-
|
|
243
|
-
|
|
366
|
+
transitionDuration={{ enter: 225, exit: 195 }}
|
|
367
|
+
slotProps={{
|
|
368
|
+
paper: this.state.menuWidth ? { style: { minWidth: this.state.menuWidth, padding: '4px' } } : undefined,
|
|
369
|
+
list: {
|
|
370
|
+
'aria-labelledby': buttonId,
|
|
371
|
+
role: 'listbox',
|
|
372
|
+
disablePadding: true,
|
|
373
|
+
},
|
|
244
374
|
}}
|
|
245
375
|
>
|
|
246
376
|
{(choices || []).map((c, index) => {
|
|
247
377
|
const optionId = `dropdown-option-${id}-${index}`;
|
|
248
378
|
|
|
249
379
|
return (
|
|
250
|
-
<
|
|
380
|
+
<StyledMenuItem
|
|
251
381
|
id={optionId}
|
|
252
|
-
|
|
382
|
+
className={c.value === value ? 'selected' : ''}
|
|
253
383
|
key={`${c.label}-${index}`}
|
|
254
384
|
value={c.value}
|
|
255
385
|
onClick={() => this.handleSelect(c.value, index)}
|
|
@@ -257,138 +387,20 @@ class Dropdown extends React.Component {
|
|
|
257
387
|
aria-selected={this.state.highlightedOptionId === optionId ? 'true' : undefined}
|
|
258
388
|
onMouseOver={() => this.handleHover(index)}
|
|
259
389
|
>
|
|
260
|
-
<
|
|
390
|
+
<StyledLabel
|
|
261
391
|
ref={(ref) => (this.elementRefs[index] = ref)}
|
|
262
|
-
className={classes.label}
|
|
263
392
|
dangerouslySetInnerHTML={{ __html: c.label }}
|
|
264
393
|
/>
|
|
265
|
-
<
|
|
266
|
-
className={classes.selectedIndicator}
|
|
394
|
+
<StyledSelectedIndicator
|
|
267
395
|
dangerouslySetInnerHTML={{ __html: c.value === value ? ' ✓' : '' }}
|
|
268
396
|
/>
|
|
269
|
-
</
|
|
397
|
+
</StyledMenuItem>
|
|
270
398
|
);
|
|
271
399
|
})}
|
|
272
|
-
</
|
|
400
|
+
</StyledMenu>
|
|
273
401
|
</>
|
|
274
402
|
);
|
|
275
403
|
}
|
|
276
404
|
}
|
|
277
405
|
|
|
278
|
-
|
|
279
|
-
root: {
|
|
280
|
-
color: color.text(),
|
|
281
|
-
border: `1px solid ${color.borderGray()}`,
|
|
282
|
-
borderRadius: '4px',
|
|
283
|
-
justifyContent: 'space-between',
|
|
284
|
-
backgroundColor: color.background(),
|
|
285
|
-
position: 'relative',
|
|
286
|
-
height: '45px',
|
|
287
|
-
width: 'fit-content',
|
|
288
|
-
margin: '2px',
|
|
289
|
-
textTransform: 'none',
|
|
290
|
-
'& span': {
|
|
291
|
-
paddingRight: '5px',
|
|
292
|
-
},
|
|
293
|
-
'& svg': {
|
|
294
|
-
position: 'absolute',
|
|
295
|
-
right: 0,
|
|
296
|
-
top: 'calc(50% - 12px)',
|
|
297
|
-
pointerEvents: 'none',
|
|
298
|
-
color: color.text(),
|
|
299
|
-
marginLeft: '5px',
|
|
300
|
-
},
|
|
301
|
-
'&:focus, &:focus-visible': {
|
|
302
|
-
outline: `3px solid ${color.tertiary()}`,
|
|
303
|
-
outlineOffset: '2px',
|
|
304
|
-
borderWidth: '3px',
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
disabledCorrect: {
|
|
308
|
-
borderWidth: '2px',
|
|
309
|
-
borderColor: color.correct(),
|
|
310
|
-
color: `${color.text()} !important`,
|
|
311
|
-
},
|
|
312
|
-
disabledIncorrect: {
|
|
313
|
-
borderWidth: '2px',
|
|
314
|
-
borderColor: color.incorrectWithIcon(),
|
|
315
|
-
color: `${color.text()} !important`,
|
|
316
|
-
},
|
|
317
|
-
selectMenu: {
|
|
318
|
-
backgroundColor: color.background(),
|
|
319
|
-
border: `1px solid ${color.correct()} !important`,
|
|
320
|
-
'&:hover': {
|
|
321
|
-
border: `1px solid ${color.text()} `,
|
|
322
|
-
borderColor: 'initial',
|
|
323
|
-
},
|
|
324
|
-
'&:focus': {
|
|
325
|
-
border: `1px solid ${color.text()}`,
|
|
326
|
-
borderColor: 'initial',
|
|
327
|
-
},
|
|
328
|
-
// remove default padding on the inner list
|
|
329
|
-
'& .MuiList-root': {
|
|
330
|
-
padding: 0,
|
|
331
|
-
},
|
|
332
|
-
},
|
|
333
|
-
selected: {
|
|
334
|
-
color: `${color.text()} !important`,
|
|
335
|
-
backgroundColor: `${color.background()} !important`,
|
|
336
|
-
'&:hover': {
|
|
337
|
-
color: color.text(),
|
|
338
|
-
backgroundColor: `${color.dropdownBackground()} !important`,
|
|
339
|
-
},
|
|
340
|
-
},
|
|
341
|
-
menuRoot: {
|
|
342
|
-
color: color.text(),
|
|
343
|
-
backgroundColor: color.background(),
|
|
344
|
-
'&:focus, &:focus-visible': {
|
|
345
|
-
outline: `3px solid ${color.tertiary()}`,
|
|
346
|
-
outlineOffset: '-1px', // keeps it inside the item
|
|
347
|
-
},
|
|
348
|
-
'&:focus': {
|
|
349
|
-
color: color.text(),
|
|
350
|
-
backgroundColor: color.background(),
|
|
351
|
-
},
|
|
352
|
-
'&:hover': {
|
|
353
|
-
color: color.text(),
|
|
354
|
-
backgroundColor: color.dropdownBackground(),
|
|
355
|
-
},
|
|
356
|
-
boxSizing: 'border-box',
|
|
357
|
-
padding: '25px',
|
|
358
|
-
borderRadius: '4px',
|
|
359
|
-
},
|
|
360
|
-
label: {
|
|
361
|
-
fontSize: 'max(1rem, 14px)',
|
|
362
|
-
},
|
|
363
|
-
selectedIndicator: {
|
|
364
|
-
fontSize: 'max(1rem, 14px)',
|
|
365
|
-
position: 'absolute',
|
|
366
|
-
right: '10px',
|
|
367
|
-
},
|
|
368
|
-
srOnly: {
|
|
369
|
-
position: 'absolute',
|
|
370
|
-
left: '-10000px',
|
|
371
|
-
top: 'auto',
|
|
372
|
-
width: '1px',
|
|
373
|
-
height: '1px',
|
|
374
|
-
overflow: 'hidden',
|
|
375
|
-
},
|
|
376
|
-
correctnessIndicatorIcon: {
|
|
377
|
-
color: `${color.white()} !important`,
|
|
378
|
-
position: 'absolute',
|
|
379
|
-
top: '-8px !important',
|
|
380
|
-
left: '-8px',
|
|
381
|
-
marginLeft: '0 !important',
|
|
382
|
-
borderRadius: '50%',
|
|
383
|
-
fontSize: '16px',
|
|
384
|
-
padding: '2px',
|
|
385
|
-
},
|
|
386
|
-
correctIcon: {
|
|
387
|
-
backgroundColor: color.correct(),
|
|
388
|
-
},
|
|
389
|
-
incorrectIcon: {
|
|
390
|
-
backgroundColor: color.incorrectWithIcon(),
|
|
391
|
-
},
|
|
392
|
-
});
|
|
393
|
-
|
|
394
|
-
export default withStyles(styles)(Dropdown);
|
|
406
|
+
export default Dropdown;
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { color } from '@pie-lib/render-ui';
|
|
6
|
-
import EditableHtml from '@pie-lib/editable-html';
|
|
7
6
|
import { withMask } from './with-mask';
|
|
7
|
+
//import EditableHtml from '@pie-lib/editable-html';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
let EditableHtml;
|
|
10
|
+
let StyledEditableHtml;
|
|
11
|
+
|
|
12
|
+
// - mathquill error window not defined
|
|
13
|
+
if (typeof window !== 'undefined') {
|
|
14
|
+
EditableHtml = require('@pie-lib/editable-html')['default'];
|
|
15
|
+
StyledEditableHtml = styled(EditableHtml)(() => ({
|
|
11
16
|
display: 'inline-block',
|
|
12
17
|
verticalAlign: 'middle',
|
|
13
18
|
margin: '4px',
|
|
14
19
|
borderRadius: '4px',
|
|
15
20
|
border: `1px solid ${color.black()}`,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
}
|
|
21
|
+
'&.correct': {
|
|
22
|
+
border: `1px solid ${color.correct()}`,
|
|
23
|
+
},
|
|
24
|
+
'&.incorrect': {
|
|
25
|
+
border: `1px solid ${color.incorrect()}`,
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
24
29
|
|
|
25
30
|
const MaskedInput = (props) => (node, data) => {
|
|
26
31
|
const {
|
|
@@ -30,7 +35,6 @@ const MaskedInput = (props) => (node, data) => {
|
|
|
30
35
|
showCorrectAnswer,
|
|
31
36
|
maxLength,
|
|
32
37
|
spellCheck,
|
|
33
|
-
classes,
|
|
34
38
|
pluginProps,
|
|
35
39
|
onChange,
|
|
36
40
|
} = props;
|
|
@@ -60,7 +64,7 @@ const MaskedInput = (props) => (node, data) => {
|
|
|
60
64
|
};
|
|
61
65
|
|
|
62
66
|
return (
|
|
63
|
-
<
|
|
67
|
+
<StyledEditableHtml
|
|
64
68
|
id={dataset.id}
|
|
65
69
|
key={`${node.type}-input-${dataset.id}`}
|
|
66
70
|
disabled={showCorrectAnswer || disabled}
|
|
@@ -80,13 +84,13 @@ const MaskedInput = (props) => (node, data) => {
|
|
|
80
84
|
noBorder: true,
|
|
81
85
|
isHidden: !!pluginProps?.characters?.disabled,
|
|
82
86
|
}}
|
|
83
|
-
className={classnames(
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
className={classnames({
|
|
88
|
+
correct: isCorrect,
|
|
89
|
+
incorrect: isIncorrect,
|
|
86
90
|
})}
|
|
87
91
|
/>
|
|
88
92
|
);
|
|
89
93
|
}
|
|
90
94
|
};
|
|
91
95
|
|
|
92
|
-
export default
|
|
96
|
+
export default withMask('input', MaskedInput);
|