@pie-element/ebsr 7.0.24-next.2 → 7.0.26
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 +48 -0
- package/{configure/node_modules/@pie-element/multiple-choice/LICENSE.md → LICENSE.md} +0 -0
- package/configure/CHANGELOG.md +48 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +8 -0
- package/controller/package.json +1 -1
- package/package.json +3 -3
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +0 -1972
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +0 -1793
- package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +0 -35
- package/configure/node_modules/@pie-element/multiple-choice/README.md +0 -56
- package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +0 -1387
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +0 -1334
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +0 -104
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +0 -198
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +0 -599
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +0 -20
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +0 -527
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +0 -768
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +0 -305
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +0 -36
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +0 -15
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +0 -353
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +0 -277
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +0 -8
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +0 -52
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +0 -7
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +0 -338
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +0 -274
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +0 -298
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +0 -157
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +0 -174
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +0 -151
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +0 -97
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +0 -254
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +0 -129
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +0 -35
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/module/configure.js +0 -843
- package/configure/node_modules/@pie-element/multiple-choice/module/controller.js +0 -20686
- package/configure/node_modules/@pie-element/multiple-choice/module/demo.js +0 -77
- package/configure/node_modules/@pie-element/multiple-choice/module/element.js +0 -2019
- package/configure/node_modules/@pie-element/multiple-choice/module/index.html +0 -21
- package/configure/node_modules/@pie-element/multiple-choice/module/manifest.json +0 -14
- package/configure/node_modules/@pie-element/multiple-choice/module/print-demo.js +0 -115
- package/configure/node_modules/@pie-element/multiple-choice/module/print.html +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/module/print.js +0 -1983
- package/configure/node_modules/@pie-element/multiple-choice/package.json +0 -34
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.json +0 -672
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.md +0 -427
- package/configure/node_modules/@pie-lib/math-rendering/LICENSE.md +0 -5
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js +0 -30
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js +0 -316
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js +0 -23
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js +0 -123
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js +0 -103
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js +0 -275
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/package.json +0 -19
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.html +0 -872
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.js +0 -108
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.html +0 -156
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.js +0 -16
- package/configure/node_modules/@pie-lib/math-rendering/playground/webpack.config.js +0 -29
- package/configure/node_modules/@pie-lib/math-rendering/src/index.js +0 -4
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/chtml.js +0 -215
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/index.js +0 -13
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/mml.js +0 -24
- package/configure/node_modules/@pie-lib/math-rendering/src/normalization.js +0 -69
- package/configure/node_modules/@pie-lib/math-rendering/src/render-math.js +0 -234
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.json +0 -937
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.md +0 -602
- package/configure/node_modules/@pie-lib/render-ui/LICENSE.md +0 -5
- package/configure/node_modules/@pie-lib/render-ui/README.md +0 -33
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js +0 -146
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js +0 -134
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js +0 -160
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js +0 -24
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js +0 -102
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js +0 -104
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js +0 -60
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js +0 -133
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js +0 -162
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js +0 -28
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js +0 -28
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js +0 -160
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js +0 -206
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/package.json +0 -30
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/index.jsx +0 -68
- package/configure/node_modules/@pie-lib/render-ui/src/color.js +0 -48
- package/configure/node_modules/@pie-lib/render-ui/src/feedback.jsx +0 -100
- package/configure/node_modules/@pie-lib/render-ui/src/has-text.js +0 -14
- package/configure/node_modules/@pie-lib/render-ui/src/html-and-math.js +0 -40
- package/configure/node_modules/@pie-lib/render-ui/src/index.js +0 -27
- package/configure/node_modules/@pie-lib/render-ui/src/input-container.jsx +0 -41
- package/configure/node_modules/@pie-lib/render-ui/src/preview-layout.jsx +0 -77
- package/configure/node_modules/@pie-lib/render-ui/src/preview-prompt.jsx +0 -90
- package/configure/node_modules/@pie-lib/render-ui/src/purpose.jsx +0 -19
- package/configure/node_modules/@pie-lib/render-ui/src/readable.jsx +0 -19
- package/configure/node_modules/@pie-lib/render-ui/src/response-indicators.jsx +0 -89
- package/configure/node_modules/@pie-lib/render-ui/src/withUndoReset.jsx +0 -118
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { renderMath } from '@pie-lib/math-rendering';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
export default class HtmlAndMath extends React.Component {
|
|
6
|
-
static propTypes = {
|
|
7
|
-
tag: PropTypes.string,
|
|
8
|
-
className: PropTypes.string,
|
|
9
|
-
html: PropTypes.string
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
static defaultProps = {
|
|
13
|
-
tag: 'div',
|
|
14
|
-
html: ''
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
componentDidMount() {
|
|
18
|
-
if (this.node) {
|
|
19
|
-
renderMath(this.node);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
componentDidUpdate() {
|
|
24
|
-
if (this.node) {
|
|
25
|
-
renderMath(this.node);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
render() {
|
|
30
|
-
const { tag, className, html } = this.props;
|
|
31
|
-
const Tag = tag || 'div';
|
|
32
|
-
return (
|
|
33
|
-
<Tag
|
|
34
|
-
ref={r => (this.node = r)}
|
|
35
|
-
className={className}
|
|
36
|
-
dangerouslySetInnerHTML={{ __html: html }}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as indicators from './response-indicators';
|
|
2
|
-
import Feedback from './feedback';
|
|
3
|
-
import Collapsible from './collapsible';
|
|
4
|
-
import withUndoReset from './withUndoReset';
|
|
5
|
-
import PreviewLayout from './preview-layout';
|
|
6
|
-
import HtmlAndMath from './html-and-math';
|
|
7
|
-
import InputContainer from './input-container';
|
|
8
|
-
import PreviewPrompt from './preview-prompt';
|
|
9
|
-
import Readable from './readable';
|
|
10
|
-
import Purpose from './purpose';
|
|
11
|
-
import * as color from './color';
|
|
12
|
-
import { hasText } from './has-text';
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
HtmlAndMath,
|
|
16
|
-
indicators,
|
|
17
|
-
withUndoReset,
|
|
18
|
-
Feedback,
|
|
19
|
-
PreviewLayout,
|
|
20
|
-
Collapsible,
|
|
21
|
-
InputContainer,
|
|
22
|
-
PreviewPrompt,
|
|
23
|
-
color,
|
|
24
|
-
Readable,
|
|
25
|
-
Purpose,
|
|
26
|
-
hasText
|
|
27
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import InputLabel from '@material-ui/core/InputLabel';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
6
|
-
import FormControl from '@material-ui/core/FormControl';
|
|
7
|
-
|
|
8
|
-
const RawInputContainer = props => {
|
|
9
|
-
const { label, className, children, classes } = props;
|
|
10
|
-
const names = classNames(classes.formControl, className);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<FormControl className={names}>
|
|
14
|
-
<InputLabel className={classes.label} shrink={true}>
|
|
15
|
-
{label}
|
|
16
|
-
</InputLabel>
|
|
17
|
-
{children}
|
|
18
|
-
</FormControl>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
RawInputContainer.propTypes = {
|
|
23
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
|
|
24
|
-
className: PropTypes.string,
|
|
25
|
-
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
26
|
-
classes: PropTypes.object.isRequired
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default withStyles(theme => ({
|
|
30
|
-
formControl: {
|
|
31
|
-
marginLeft: 0,
|
|
32
|
-
marginRight: theme.spacing.unit,
|
|
33
|
-
paddingBottom: theme.spacing.unit,
|
|
34
|
-
flex: '1 0 auto',
|
|
35
|
-
minWidth: theme.spacing.unit * 4
|
|
36
|
-
},
|
|
37
|
-
label: {
|
|
38
|
-
fontSize: 'inherit',
|
|
39
|
-
whiteSpace: 'nowrap'
|
|
40
|
-
}
|
|
41
|
-
}))(RawInputContainer);
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { withStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
class PreviewLayout extends React.Component {
|
|
6
|
-
static propTypes = {
|
|
7
|
-
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
8
|
-
classes: PropTypes.object
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
render() {
|
|
12
|
-
const { children, classes } = this.props;
|
|
13
|
-
|
|
14
|
-
return <div className={classes.container}>{children}</div>;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const styles = () => ({
|
|
19
|
-
container: {
|
|
20
|
-
display: 'flex',
|
|
21
|
-
flexDirection: 'column',
|
|
22
|
-
position: 'relative'
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const theme = createMuiTheme({
|
|
27
|
-
typography: {
|
|
28
|
-
useNextVariants: true
|
|
29
|
-
},
|
|
30
|
-
palette: {
|
|
31
|
-
action: {
|
|
32
|
-
disabled: 'rgba(0, 0, 0, 0.54);'
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
overrides: {
|
|
36
|
-
MuiRadio: {
|
|
37
|
-
root: {
|
|
38
|
-
'&$checked': {
|
|
39
|
-
color: '#3f51b5 !important'
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
MuiCheckbox: {
|
|
44
|
-
root: {
|
|
45
|
-
'&$checked': {
|
|
46
|
-
color: '#3f51b5 !important'
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
MuiTabs: {
|
|
51
|
-
root: {
|
|
52
|
-
borderBottom: '1px solid #eee'
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
MuiSwitch: {
|
|
56
|
-
root: {
|
|
57
|
-
'&$checked': {
|
|
58
|
-
color: '#3f51b5 !important',
|
|
59
|
-
'& + $bar': {
|
|
60
|
-
backgroundColor: '#3f51b5 !important',
|
|
61
|
-
opacity: 0.5
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const Styled = withStyles(styles)(PreviewLayout);
|
|
70
|
-
|
|
71
|
-
const RootElem = props => (
|
|
72
|
-
<MuiThemeProvider theme={theme}>
|
|
73
|
-
<Styled {...props} />
|
|
74
|
-
</MuiThemeProvider>
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
export default RootElem;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import * as color from './color';
|
|
5
|
-
|
|
6
|
-
//Used these below to replace \\embed{newLine} with \\newline from prompt which will get parsed in MathJax
|
|
7
|
-
const NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
|
|
8
|
-
const NEWLINE_LATEX = '\\newline ';
|
|
9
|
-
|
|
10
|
-
export class PreviewPrompt extends Component {
|
|
11
|
-
static propTypes = {
|
|
12
|
-
classes: PropTypes.object,
|
|
13
|
-
prompt: PropTypes.string,
|
|
14
|
-
tagName: PropTypes.string,
|
|
15
|
-
className: PropTypes.string,
|
|
16
|
-
onClick: PropTypes.func,
|
|
17
|
-
defaultClassName: PropTypes.string
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
static defaultProps = {
|
|
21
|
-
onClick: () => {}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
parsedText = text => {
|
|
25
|
-
// fix imported audio content for Safari PD-1419
|
|
26
|
-
const div = document.createElement('div');
|
|
27
|
-
div.innerHTML = text;
|
|
28
|
-
|
|
29
|
-
const audio = div.querySelector('audio');
|
|
30
|
-
if (audio) {
|
|
31
|
-
const source = document.createElement('source');
|
|
32
|
-
|
|
33
|
-
source.setAttribute('type', 'audio/mp3');
|
|
34
|
-
source.setAttribute('src', audio.getAttribute('src'));
|
|
35
|
-
|
|
36
|
-
audio.removeAttribute('src');
|
|
37
|
-
audio.appendChild(source);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return div.innerHTML;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
render() {
|
|
44
|
-
const { prompt, classes, tagName, className, onClick, defaultClassName } = this.props;
|
|
45
|
-
const CustomTag = tagName || 'div';
|
|
46
|
-
const customClasses = `${classes.promptTable} ${classes[className] || ''} ${defaultClassName ||
|
|
47
|
-
''}`;
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<CustomTag
|
|
51
|
-
onClick={onClick}
|
|
52
|
-
className={customClasses}
|
|
53
|
-
dangerouslySetInnerHTML={{
|
|
54
|
-
__html: this.parsedText(prompt || '').replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX)
|
|
55
|
-
}}
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const styles = theme => ({
|
|
62
|
-
prompt: {
|
|
63
|
-
verticalAlign: 'middle',
|
|
64
|
-
color: color.text()
|
|
65
|
-
},
|
|
66
|
-
rationale: {
|
|
67
|
-
paddingLeft: theme.spacing.unit * 16
|
|
68
|
-
},
|
|
69
|
-
label: {
|
|
70
|
-
color: `${color.text()} !important`, //'var(--choice-input-color, black)',
|
|
71
|
-
display: 'inline-block',
|
|
72
|
-
verticalAlign: 'middle',
|
|
73
|
-
cursor: 'pointer'
|
|
74
|
-
},
|
|
75
|
-
promptTable: {
|
|
76
|
-
'&:not(.MathJax) > table': {
|
|
77
|
-
borderCollapse: 'collapse'
|
|
78
|
-
},
|
|
79
|
-
'&:not(.MathJax) > table tr': {
|
|
80
|
-
'&:nth-child(2n)': {
|
|
81
|
-
backgroundColor: '#f6f8fa'
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
'&:not(.MathJax) > table td, &:not(.MathJax) > table th': {
|
|
85
|
-
padding: '.6em 1em',
|
|
86
|
-
textAlign: 'center'
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
export default withStyles(styles)(PreviewPrompt);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
const Purpose = props => {
|
|
5
|
-
return (
|
|
6
|
-
<>
|
|
7
|
-
{React.Children.map(props.children, child =>
|
|
8
|
-
React.cloneElement(child, { 'data-pie-purpose': props.purpose })
|
|
9
|
-
)}
|
|
10
|
-
</>
|
|
11
|
-
);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
Purpose.propTypes = {
|
|
15
|
-
children: PropTypes.node,
|
|
16
|
-
purpose: PropTypes.string
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default Purpose;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
const Readable = props => {
|
|
5
|
-
return (
|
|
6
|
-
<>
|
|
7
|
-
{React.Children.map(props.children, child =>
|
|
8
|
-
React.cloneElement(child, { 'data-pie-readable': props.false === undefined })
|
|
9
|
-
)}
|
|
10
|
-
</>
|
|
11
|
-
);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
Readable.propTypes = {
|
|
15
|
-
children: PropTypes.node,
|
|
16
|
-
false: PropTypes.bool
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default Readable;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import * as icons from '@pie-lib/icons';
|
|
4
|
-
import Popover from '@material-ui/core/Popover';
|
|
5
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
6
|
-
import Feedback from './feedback';
|
|
7
|
-
import debug from 'debug';
|
|
8
|
-
|
|
9
|
-
const log = debug('pie-libs:render-ui:response-indicators');
|
|
10
|
-
|
|
11
|
-
const styles = () => ({
|
|
12
|
-
responseIndicator: {
|
|
13
|
-
cursor: 'pointer'
|
|
14
|
-
},
|
|
15
|
-
paper: {
|
|
16
|
-
padding: '0',
|
|
17
|
-
borderRadius: '4px'
|
|
18
|
-
},
|
|
19
|
-
popover: {
|
|
20
|
-
cursor: 'pointer'
|
|
21
|
-
},
|
|
22
|
-
popperClose: {
|
|
23
|
-
cursor: 'pointer'
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const BuildIndicator = (Icon, correctness) => {
|
|
28
|
-
class RawIndicator extends React.Component {
|
|
29
|
-
constructor(props) {
|
|
30
|
-
super(props);
|
|
31
|
-
this.state = {};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
handlePopoverOpen = event => {
|
|
35
|
-
log('[handlePopoverOpen]', event.target);
|
|
36
|
-
this.setState({ anchorEl: event.target });
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
handlePopoverClose = () => {
|
|
40
|
-
this.setState({ anchorEl: null });
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
render() {
|
|
44
|
-
const { feedback, classes } = this.props;
|
|
45
|
-
const { anchorEl } = this.state;
|
|
46
|
-
return (
|
|
47
|
-
<div className={feedback && classes.responseIndicator}>
|
|
48
|
-
<span ref={r => (this.icon = r)} onClick={this.handlePopoverOpen}>
|
|
49
|
-
<Icon />
|
|
50
|
-
</span>
|
|
51
|
-
|
|
52
|
-
{feedback && (
|
|
53
|
-
<Popover
|
|
54
|
-
className={classes.popover}
|
|
55
|
-
classes={{
|
|
56
|
-
paper: classes.paper
|
|
57
|
-
}}
|
|
58
|
-
open={!!anchorEl}
|
|
59
|
-
anchorEl={anchorEl}
|
|
60
|
-
anchorOrigin={{
|
|
61
|
-
vertical: 'bottom',
|
|
62
|
-
horizontal: 'left'
|
|
63
|
-
}}
|
|
64
|
-
transformOrigin={{
|
|
65
|
-
vertical: 'top',
|
|
66
|
-
horizontal: 'left'
|
|
67
|
-
}}
|
|
68
|
-
onClose={this.handlePopoverClose}
|
|
69
|
-
>
|
|
70
|
-
<Feedback feedback={feedback} correctness={correctness} />
|
|
71
|
-
</Popover>
|
|
72
|
-
)}
|
|
73
|
-
</div>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
RawIndicator.propTypes = {
|
|
79
|
-
feedback: PropTypes.string,
|
|
80
|
-
classes: PropTypes.object.isRequired
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return withStyles(styles)(RawIndicator);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export const Correct = BuildIndicator(icons.Correct, 'correct');
|
|
87
|
-
export const Incorrect = BuildIndicator(icons.Incorrect, 'incorrect');
|
|
88
|
-
export const PartiallyCorrect = BuildIndicator(icons.PartiallyCorrect, 'partially-correct');
|
|
89
|
-
export const NothingSubmitted = BuildIndicator(icons.NothingSubmitted, 'nothing-submitted');
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import Button from '@material-ui/core/Button';
|
|
4
|
-
import { withStyles } from '@material-ui/core/styles';
|
|
5
|
-
import Restore from '@material-ui/icons/Restore';
|
|
6
|
-
import Undo from '@material-ui/icons/Undo';
|
|
7
|
-
|
|
8
|
-
const styles = theme => ({
|
|
9
|
-
wrapper: {
|
|
10
|
-
display: 'flex',
|
|
11
|
-
flexDirection: 'column'
|
|
12
|
-
},
|
|
13
|
-
resetUndoContainer: {
|
|
14
|
-
display: 'flex',
|
|
15
|
-
alignItems: 'center',
|
|
16
|
-
justifyContent: 'center'
|
|
17
|
-
},
|
|
18
|
-
icon: {
|
|
19
|
-
width: '24px',
|
|
20
|
-
height: '24px',
|
|
21
|
-
color: 'gray',
|
|
22
|
-
marginRight: theme.spacing.unit
|
|
23
|
-
},
|
|
24
|
-
buttonContainer: {
|
|
25
|
-
display: 'flex',
|
|
26
|
-
alignItems: 'center',
|
|
27
|
-
marginLeft: theme.spacing.unit * 3,
|
|
28
|
-
marginRight: theme.spacing.unit * 3
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* HOC that adds undo and reset functionality for session values
|
|
34
|
-
*/
|
|
35
|
-
const withUndoReset = WrappedComponent => {
|
|
36
|
-
class WithUndoReset extends React.Component {
|
|
37
|
-
static propTypes = {
|
|
38
|
-
classes: PropTypes.object,
|
|
39
|
-
session: PropTypes.object,
|
|
40
|
-
onSessionChange: PropTypes.func
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
constructor(props) {
|
|
44
|
-
super(props);
|
|
45
|
-
|
|
46
|
-
this.state = {
|
|
47
|
-
sessionInitialValues: JSON.parse(JSON.stringify(props.session)),
|
|
48
|
-
session: props.session,
|
|
49
|
-
changes: []
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
onSessionChange = session => {
|
|
54
|
-
this.setState(
|
|
55
|
-
state => ({ session, changes: [...state.changes, session] }),
|
|
56
|
-
() => this.props.onSessionChange(session)
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
onUndo = () => {
|
|
61
|
-
this.setState(
|
|
62
|
-
state => {
|
|
63
|
-
const newChanges = [...state.changes];
|
|
64
|
-
|
|
65
|
-
newChanges.pop();
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
changes: newChanges,
|
|
69
|
-
session: newChanges.length
|
|
70
|
-
? newChanges[newChanges.length - 1]
|
|
71
|
-
: state.sessionInitialValues
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
() => this.props.onSessionChange(this.state.session)
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
onReset = () => {
|
|
79
|
-
this.setState(
|
|
80
|
-
state => ({ session: state.sessionInitialValues, changes: [] }),
|
|
81
|
-
() => this.props.onSessionChange(this.state.sessionInitialValues)
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
render() {
|
|
86
|
-
const { classes, ...rest } = this.props;
|
|
87
|
-
const { changes, session } = this.state;
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<div className={classes.wrapper}>
|
|
91
|
-
<div className={classes.resetUndoContainer}>
|
|
92
|
-
<Button
|
|
93
|
-
className={classes.buttonContainer}
|
|
94
|
-
color="primary"
|
|
95
|
-
disabled={changes.length === 0}
|
|
96
|
-
onClick={this.onUndo}
|
|
97
|
-
>
|
|
98
|
-
<Undo className={classes.icon} /> Undo
|
|
99
|
-
</Button>
|
|
100
|
-
<Button
|
|
101
|
-
className={classes.buttonContainer}
|
|
102
|
-
color="primary"
|
|
103
|
-
disabled={changes.length === 0}
|
|
104
|
-
onClick={this.onReset}
|
|
105
|
-
>
|
|
106
|
-
<Restore className={classes.icon} /> Start Over
|
|
107
|
-
</Button>
|
|
108
|
-
</div>
|
|
109
|
-
<WrappedComponent {...rest} session={session} onSessionChange={this.onSessionChange} />
|
|
110
|
-
</div>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return withStyles(styles)(WithUndoReset);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export default withUndoReset;
|