@pie-lib/render-ui 4.35.3-next.0 → 4.35.3-next.155

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +9 -81
  2. package/esm/package.json +3 -0
  3. package/lib/append-css-rules.js +10 -37
  4. package/lib/append-css-rules.js.map +1 -1
  5. package/lib/assets/enableAudioAutoplayImage.js +1 -2
  6. package/lib/assets/enableAudioAutoplayImage.js.map +1 -1
  7. package/lib/collapsible/index.js +35 -65
  8. package/lib/collapsible/index.js.map +1 -1
  9. package/lib/color.js +57 -201
  10. package/lib/color.js.map +1 -1
  11. package/lib/feedback.js +71 -108
  12. package/lib/feedback.js.map +1 -1
  13. package/lib/has-media.js +2 -7
  14. package/lib/has-media.js.map +1 -1
  15. package/lib/has-text.js +1 -7
  16. package/lib/has-text.js.map +1 -1
  17. package/lib/html-and-math.js +10 -30
  18. package/lib/html-and-math.js.map +1 -1
  19. package/lib/index.js +1 -24
  20. package/lib/index.js.map +1 -1
  21. package/lib/input-container.js +43 -44
  22. package/lib/input-container.js.map +1 -1
  23. package/lib/preview-layout.js +22 -58
  24. package/lib/preview-layout.js.map +1 -1
  25. package/lib/preview-prompt.js +104 -131
  26. package/lib/preview-prompt.js.map +1 -1
  27. package/lib/purpose.js +1 -7
  28. package/lib/purpose.js.map +1 -1
  29. package/lib/readable.js +1 -7
  30. package/lib/readable.js.map +1 -1
  31. package/lib/response-indicators.js +37 -86
  32. package/lib/response-indicators.js.map +1 -1
  33. package/lib/ui-layout.js +53 -70
  34. package/lib/ui-layout.js.map +1 -1
  35. package/lib/withUndoReset.js +51 -97
  36. package/lib/withUndoReset.js.map +1 -1
  37. package/package.json +23 -13
  38. package/src/__tests__/html-and-math.test.js +26 -14
  39. package/src/__tests__/preview-prompt.test.jsx +43 -40
  40. package/src/__tests__/purpose.test.jsx +27 -23
  41. package/src/__tests__/readable.test.jsx +34 -29
  42. package/src/__tests__/response-indicators.test.jsx +104 -9
  43. package/src/__tests__/ui-layout.test.jsx +28 -12
  44. package/src/__tests__/withUndoReset.test.jsx +110 -188
  45. package/src/collapsible/__tests__/index.test.jsx +33 -7
  46. package/src/collapsible/index.jsx +17 -17
  47. package/src/color.js +1 -5
  48. package/src/feedback.jsx +59 -63
  49. package/src/input-container.jsx +41 -32
  50. package/src/preview-layout.jsx +11 -23
  51. package/src/preview-prompt.jsx +76 -58
  52. package/src/response-indicators.jsx +22 -29
  53. package/src/ui-layout.jsx +41 -28
  54. package/src/withUndoReset.jsx +48 -50
  55. package/src/__tests__/__snapshots__/html-and-math.test.js.snap +0 -11
  56. package/src/__tests__/__snapshots__/preview-prompt.test.jsx.snap +0 -37
  57. package/src/__tests__/__snapshots__/purpose.test.jsx.snap +0 -42
  58. package/src/__tests__/__snapshots__/readable.test.jsx.snap +0 -64
  59. package/src/__tests__/__snapshots__/response-indicators.test.jsx.snap +0 -27
  60. package/src/collapsible/__tests__/__snapshots__/index.test.jsx.snap +0 -18
@@ -1,13 +1,39 @@
1
- import toJson from 'enzyme-to-json';
2
- import { shallow } from 'enzyme/build';
3
- import { Collapsible } from '../index';
4
1
  import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import { Collapsible } from '../index';
5
5
 
6
6
  describe('collapsible', () => {
7
- describe('snapshot', () => {
8
- it('renders', () => {
9
- const wrapper = shallow(<Collapsible classes={{}} />);
10
- expect(toJson(wrapper)).toMatchSnapshot();
7
+ describe('rendering', () => {
8
+ it('renders collapsible component', () => {
9
+ const { container } = render(<Collapsible classes={{}} />);
10
+ expect(container.firstChild).toBeInTheDocument();
11
+ });
12
+
13
+ it('renders with default collapsed state', () => {
14
+ render(<Collapsible classes={{}} labels={{ hidden: 'Show More', visible: 'Show Less' }} />);
15
+ // Should show "Show More" when collapsed
16
+ expect(screen.queryByText('Show More')).toBeInTheDocument();
17
+ });
18
+
19
+ it('renders children when expanded', async () => {
20
+ const user = userEvent.setup();
21
+ render(
22
+ <Collapsible classes={{}}>
23
+ <div>Test Content</div>
24
+ </Collapsible>,
25
+ );
26
+
27
+ // Initially collapsed, children not visible
28
+ expect(screen.queryByText('Test Content')).not.toBeInTheDocument();
29
+
30
+ // Click to expand
31
+ const toggleButton = screen.getByText('Show');
32
+ await user.click(toggleButton);
33
+
34
+ // Wait for expansion animation and check children are visible
35
+ await screen.findByText('Test Content');
36
+ expect(screen.getByText('Test Content')).toBeInTheDocument();
11
37
  });
12
38
  });
13
39
  });
@@ -1,12 +1,21 @@
1
1
  import React from 'react';
2
- import { withStyles } from '@material-ui/core/styles/index';
3
- import Collapse from '@material-ui/core/Collapse/index';
2
+ import { styled } from '@mui/material/styles';
3
+ import Collapse from '@mui/material/Collapse';
4
4
  import { renderMath } from '@pie-lib/math-rendering';
5
5
  import PropTypes from 'prop-types';
6
6
 
7
+ const Title = styled('span')(({ theme }) => ({
8
+ color: theme.palette.primary.light,
9
+ borderBottom: `1px dotted ${theme.palette.primary.light}`,
10
+ cursor: 'pointer',
11
+ }));
12
+
13
+ const StyledCollapse = styled(Collapse)(({ theme }) => ({
14
+ paddingTop: theme.spacing(2),
15
+ }));
16
+
7
17
  export class Collapsible extends React.Component {
8
18
  static propTypes = {
9
- classes: PropTypes.object.isRequired,
10
19
  className: PropTypes.string,
11
20
  children: PropTypes.object,
12
21
  labels: PropTypes.shape({
@@ -36,29 +45,20 @@ export class Collapsible extends React.Component {
36
45
  }
37
46
 
38
47
  render() {
39
- const { classes, labels, children, className } = this.props;
48
+ const { labels, children, className } = this.props;
40
49
  const title = this.state.expanded ? labels.visible || 'Hide' : labels.hidden || 'Show';
41
50
 
42
51
  return (
43
52
  <div className={className} ref={(r) => (this.root = r)}>
44
53
  <div onClick={this.toggleExpanded}>
45
- <span className={classes.title}>{title}</span>
54
+ <Title>{title}</Title>
46
55
  </div>
47
- <Collapse in={this.state.expanded} timeout="auto" unmountOnExit className={classes.collapsible}>
56
+ <StyledCollapse in={this.state.expanded} timeout={{ enter: 225, exit: 195 }} unmountOnExit>
48
57
  {children}
49
- </Collapse>
58
+ </StyledCollapse>
50
59
  </div>
51
60
  );
52
61
  }
53
62
  }
54
63
 
55
- export default withStyles((theme) => ({
56
- title: {
57
- color: theme.palette.primary.light,
58
- borderBottom: `1px dotted ${theme.palette.primary.light}`,
59
- cursor: 'pointer',
60
- },
61
- collapsible: {
62
- paddingTop: theme.spacing.unit * 2,
63
- },
64
- }))(Collapsible);
64
+ export default Collapsible;
package/src/color.js CHANGED
@@ -1,8 +1,4 @@
1
- import green from '@material-ui/core/colors/green';
2
- import orange from '@material-ui/core/colors/orange';
3
- import pink from '@material-ui/core/colors/pink';
4
- import indigo from '@material-ui/core/colors/indigo';
5
- import red from '@material-ui/core/colors/red';
1
+ import { green, orange, pink, indigo, red } from '@mui/material/colors';
6
2
 
7
3
  export const defaults = {
8
4
  TEXT: 'black',
package/src/feedback.jsx CHANGED
@@ -1,98 +1,94 @@
1
- /**
2
- * Lifted from multiple-choice - TODO: create a shared package for it.
3
- */
4
- import { withStyles } from '@material-ui/core/styles';
5
-
6
1
  import React from 'react';
7
- import { TransitionGroup, CSSTransition } from 'react-transition-group';
8
- import classNames from 'classnames';
9
2
  import PropTypes from 'prop-types';
3
+ import { styled } from '@mui/material/styles';
4
+ import { TransitionGroup, CSSTransition } from 'react-transition-group';
10
5
  import * as color from './color';
11
6
 
12
- const styleSheet = {
13
- corespringFeedback: {
14
- transformOrigin: '0% 0px 0px',
15
- width: '100%',
16
- display: 'block',
17
- overflow: 'hidden',
18
- '&:.incorrect': {
19
- color: '#946202',
20
- },
21
- },
22
- content: {
23
- '-webkit-font-smoothing': 'antialiased',
24
- backgroundColor: `var(--feedback-bg-color, ${color.disabled()})`,
25
- borderRadius: '4px',
26
- lineHeight: '25px',
27
- margin: '0px',
28
- padding: '10px',
29
- verticalAlign: 'middle',
30
- color: 'var(--feedback-color, white)',
7
+ const FeedbackContainer = styled('div')({
8
+ transformOrigin: '0% 0px 0px',
9
+ width: '100%',
10
+ display: 'block',
11
+ overflow: 'hidden',
12
+ '&.incorrect': {
13
+ color: '#946202',
31
14
  },
32
- correct: {
15
+ });
16
+
17
+ const FeedbackContent = styled('div')({
18
+ WebkitFontSmoothing: 'antialiased',
19
+ backgroundColor: `var(--feedback-bg-color, ${color.disabled()})`,
20
+ borderRadius: '4px',
21
+ lineHeight: '25px',
22
+ margin: '0px',
23
+ padding: '10px',
24
+ verticalAlign: 'middle',
25
+ color: 'var(--feedback-color, white)',
26
+ '&.correct': {
33
27
  backgroundColor: `var(--feedback-correct-bg-color, ${color.correct()})`,
34
28
  },
35
- incorrect: {
29
+ '&.incorrect': {
36
30
  backgroundColor: `var(--feedback-incorrect-bg-color, ${color.incorrect()})`,
37
31
  },
38
- feedbackEnter: {
32
+ });
33
+
34
+ const TransitionWrapper = styled('div')({
35
+ '&.feedback-enter': {
39
36
  height: '1px',
40
37
  },
41
- feedbackEnterActive: {
38
+ '&.feedback-enter-active': {
42
39
  height: '45px',
43
40
  transition: 'height 500ms',
44
41
  },
45
- feedbackLeave: {
42
+ '&.feedback-exit': {
46
43
  height: '45px',
47
44
  },
48
- feedbackLeaveActive: {
45
+ '&.feedback-exit-active': {
49
46
  height: '1px',
50
47
  transition: 'height 200ms',
51
48
  },
52
- };
49
+ });
53
50
 
54
51
  export class Feedback extends React.Component {
55
52
  static propTypes = {
56
53
  correctness: PropTypes.string,
57
54
  feedback: PropTypes.string,
58
- classes: PropTypes.object.isRequired,
59
55
  };
60
56
 
61
- render() {
62
- const { correctness, feedback, classes } = this.props;
57
+ nodeRef = React.createRef();
63
58
 
64
- function chooseFeedback(correctness) {
65
- if (correctness && feedback) {
66
- return (
67
- <CSSTransition
68
- classNames={{
69
- enter: classes.feedbackEnter,
70
- enterActive: classes.feedbackEnterActive,
71
- leave: classes.feedbackLeave,
72
- leaveActive: classes.feedbackLeaveActive,
73
- }}
74
- key="hasFeedback"
75
- timeout={{ enter: 500, exit: 300 }}
76
- >
77
- <div className={classes.corespringFeedback}>
78
- <div
79
- className={classNames(classes.content, classes[correctness])}
80
- dangerouslySetInnerHTML={{ __html: feedback }}
81
- />
82
- </div>
83
- </CSSTransition>
84
- );
85
- } else {
86
- return null;
87
- }
88
- }
59
+ renderFeedback() {
60
+ const { correctness, feedback } = this.props;
89
61
 
62
+ if (!correctness || !feedback) return null;
63
+
64
+ return (
65
+ <CSSTransition
66
+ key="hasFeedback"
67
+ nodeRef={this.nodeRef}
68
+ timeout={{ enter: 500, exit: 200 }}
69
+ classNames="feedback"
70
+ >
71
+ <TransitionWrapper ref={this.nodeRef}>
72
+ <FeedbackContainer>
73
+ <FeedbackContent
74
+ className={correctness}
75
+ dangerouslySetInnerHTML={{ __html: feedback }}
76
+ />
77
+ </FeedbackContainer>
78
+ </TransitionWrapper>
79
+ </CSSTransition>
80
+ );
81
+ }
82
+
83
+ render() {
90
84
  return (
91
85
  <div>
92
- <TransitionGroup>{chooseFeedback(correctness)}</TransitionGroup>
86
+ <TransitionGroup>
87
+ {this.renderFeedback()}
88
+ </TransitionGroup>
93
89
  </div>
94
90
  );
95
91
  }
96
92
  }
97
93
 
98
- export default withStyles(styleSheet, { name: 'Feedback' })(Feedback);
94
+ export default Feedback;
@@ -1,41 +1,50 @@
1
- import InputLabel from '@material-ui/core/InputLabel';
1
+ import InputLabel from '@mui/material/InputLabel';
2
2
  import PropTypes from 'prop-types';
3
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';
4
+ import { styled } from '@mui/material/styles';
5
+ import FormControl from '@mui/material/FormControl';
7
6
 
8
- const RawInputContainer = (props) => {
9
- const { label, className, children, classes } = props;
10
- const names = classNames(classes.formControl, className);
7
+ const StyledFormControl = styled(FormControl)(({ theme }) => ({
8
+ margin: 0,
9
+ padding: 0,
10
+ flex: '1 0 auto',
11
+ minWidth: theme.spacing(4),
12
+ }));
11
13
 
12
- return (
13
- <FormControl className={names}>
14
- <InputLabel className={classes.label} shrink={true}>
15
- {label}
16
- </InputLabel>
17
- {children}
18
- </FormControl>
19
- );
20
- };
14
+ const StyledInputLabel = styled(InputLabel)(() => ({
15
+ fontSize: 'inherit',
16
+ whiteSpace: 'nowrap',
17
+ margin: 0,
18
+ padding: 0,
19
+ alignSelf: 'flex-start',
20
+ position: 'absolute',
21
+ top: 0,
22
+ left: 0,
23
+ transformOrigin: 'top left',
24
+ pointerEvents: 'none',
25
+ // override MUI's default transform styles
26
+ '&.MuiInputLabel-shrink': {
27
+ transform: 'scale(0.75) translate(0, -0.75em)',
28
+ },
29
+ '&:not(.MuiInputLabel-shrink)': {
30
+ transform: 'translate(0, 0)',
31
+ },
32
+ }));
21
33
 
22
- RawInputContainer.propTypes = {
34
+ const InputContainer = ({ label, className, children }) => (
35
+ <StyledFormControl className={className}>
36
+ <StyledInputLabel shrink>{label}</StyledInputLabel>
37
+ {children}
38
+ </StyledFormControl>
39
+ );
40
+
41
+ InputContainer.propTypes = {
23
42
  label: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
24
43
  className: PropTypes.string,
25
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
26
- classes: PropTypes.object.isRequired,
44
+ children: PropTypes.oneOfType([
45
+ PropTypes.arrayOf(PropTypes.node),
46
+ PropTypes.node,
47
+ ]).isRequired,
27
48
  };
28
49
 
29
- export default withStyles((theme) => ({
30
- formControl: {
31
- marginLeft: 0,
32
- marginRight: 0,
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);
50
+ export default InputContainer;
@@ -1,13 +1,18 @@
1
1
  import React from 'react';
2
- import { withStyles } from '@material-ui/core/styles';
2
+ import { styled } from '@mui/material/styles';
3
3
  import PropTypes from 'prop-types';
4
4
  import UiLayout from './ui-layout';
5
5
 
6
+ const StyledUiLayout = styled(UiLayout)({
7
+ display: 'flex',
8
+ flexDirection: 'column',
9
+ position: 'relative',
10
+ });
11
+
6
12
  class PreviewLayout extends React.Component {
7
13
  static propTypes = {
8
14
  ariaLabel: PropTypes.string,
9
15
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
10
- classes: PropTypes.object,
11
16
  role: PropTypes.string,
12
17
  extraCSSRules: PropTypes.shape({
13
18
  names: PropTypes.arrayOf(PropTypes.string),
@@ -17,32 +22,15 @@ class PreviewLayout extends React.Component {
17
22
  };
18
23
 
19
24
  render() {
20
- const { children, classes, ariaLabel, role, extraCSSRules, fontSizeFactor } = this.props;
25
+ const { children, ariaLabel, role, extraCSSRules, fontSizeFactor, classes } = this.props;
21
26
  const accessibility = ariaLabel ? { 'aria-label': ariaLabel, role } : {};
22
27
 
23
28
  return (
24
- <UiLayout
25
- className={classes.container}
26
- {...accessibility}
27
- extraCSSRules={extraCSSRules}
28
- fontSizeFactor={fontSizeFactor}
29
- >
29
+ <StyledUiLayout {...accessibility} extraCSSRules={extraCSSRules} fontSizeFactor={fontSizeFactor} classes={classes}>
30
30
  {children}
31
- </UiLayout>
31
+ </StyledUiLayout>
32
32
  );
33
33
  }
34
34
  }
35
35
 
36
- const styles = () => ({
37
- container: {
38
- display: 'flex',
39
- flexDirection: 'column',
40
- position: 'relative',
41
- },
42
- });
43
-
44
- const Styled = withStyles(styles)(PreviewLayout);
45
-
46
- const RootElem = (props) => <Styled {...props} />;
47
-
48
- export default RootElem;
36
+ export default PreviewLayout;
@@ -1,7 +1,58 @@
1
1
  import React, { Component } from 'react';
2
- import { withStyles } from '@material-ui/core/styles';
2
+ import { styled } from '@mui/material/styles';
3
3
  import PropTypes from 'prop-types';
4
4
  import * as color from './color';
5
+ import { renderMath } from '@pie-lib/math-rendering';
6
+
7
+ const StyledPromptContainer = styled('div')(({ theme, tagName }) => ({
8
+ // Base promptTable styles
9
+ '&:not(.MathJax) > table': {
10
+ borderCollapse: 'collapse',
11
+ },
12
+ // Apply vertical striping when first column is a header (th) and NOT mixed with td
13
+ '&:not(.MathJax) > table:has(tbody tr > th:first-child):not(:has(tbody tr > td:first-child)) tbody td:nth-child(even)': {
14
+ backgroundColor: '#f6f8fa',
15
+ color: theme.palette.common.black,
16
+ },
17
+ // Apply horizontal striping for tables where first element is a data cell (td)
18
+ '&:not(.MathJax) > table:has(tbody tr > td:first-child) tbody tr:nth-child(even) td': {
19
+ backgroundColor: '#f6f8fa',
20
+ color: theme.palette.common.black,
21
+ },
22
+ // align table content to left as per STAR requirement PD-3687
23
+ '&:not(.MathJax) table td, &:not(.MathJax) table th': {
24
+ padding: '.6em 1em',
25
+ textAlign: 'left',
26
+ },
27
+ // added this to fix alignment of text in prompt imported from studio (PD-3423)
28
+ '&:not(.MathJax) > table td > p.kds-indent': {
29
+ textAlign: 'initial',
30
+ },
31
+
32
+ // Conditional styles based on class names
33
+ '&.prompt': {
34
+ verticalAlign: 'middle',
35
+ color: color.text(),
36
+ },
37
+ '&.legend': {
38
+ width: '100%',
39
+ fontSize: 'inherit !important',
40
+ },
41
+ '&.rationale': {
42
+ paddingLeft: theme.spacing(4),
43
+ paddingBottom: theme.spacing(1),
44
+ },
45
+ '&.label': {
46
+ color: `${color.text()} !important`,
47
+ display: 'flex',
48
+ flexDirection: 'column',
49
+ verticalAlign: 'middle',
50
+ cursor: 'pointer',
51
+ '& > p': {
52
+ margin: '0 0 0 0 !important',
53
+ },
54
+ },
55
+ }));
5
56
 
6
57
  //Used these below to replace \\embed{newLine} with \\newline from prompt which will get parsed in MathJax
7
58
  const NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
@@ -9,7 +60,6 @@ const NEWLINE_LATEX = '\\newline ';
9
60
 
10
61
  export class PreviewPrompt extends Component {
11
62
  static propTypes = {
12
- classes: PropTypes.object,
13
63
  prompt: PropTypes.string,
14
64
  tagName: PropTypes.string,
15
65
  className: PropTypes.string,
@@ -141,16 +191,32 @@ export class PreviewPrompt extends Component {
141
191
  componentDidMount() {
142
192
  this.alignImages();
143
193
  this.addCustomAudioButtonControls();
194
+ this.setupMathRendering();
144
195
  }
145
196
 
146
- componentDidUpdate() {
197
+ componentDidUpdate(prevProps) {
147
198
  this.alignImages();
199
+
200
+ if (prevProps.prompt !== this.props.prompt) {
201
+ this.renderMathContent();
202
+ }
148
203
  }
149
204
 
150
205
  componentWillUnmount() {
151
206
  this.removeCustomAudioButtonListeners();
152
207
  }
153
208
 
209
+ setupMathRendering() {
210
+ this.renderMathContent();
211
+ }
212
+
213
+ renderMathContent() {
214
+ const container = document.getElementById('preview-prompt');
215
+ if (container && typeof renderMath === 'function') {
216
+ renderMath(container);
217
+ }
218
+ }
219
+
154
220
  alignImages() {
155
221
  const previewPrompts = document.querySelectorAll('#preview-prompt');
156
222
 
@@ -186,19 +252,18 @@ export class PreviewPrompt extends Component {
186
252
  }
187
253
 
188
254
  render() {
189
- const { prompt, classes, tagName, className, onClick, defaultClassName } = this.props;
190
- const CustomTag = tagName || 'div';
191
- // legend tag was added once with accessibility tasks, wee need extra style to make it work with images alignment
255
+ const { prompt, tagName, className, onClick, defaultClassName } = this.props;
256
+ // legend tag was added once with accessibility tasks, we need extra style to make it work with images alignment
192
257
  const legendClass = tagName === 'legend' ? 'legend' : '';
193
- const customClasses = `${classes.promptTable} ${classes[className] || ''} ${defaultClassName || ''} ${classes[
194
- legendClass
195
- ] || ''}`;
258
+ const customClasses = `${className || ''} ${defaultClassName || ''} ${legendClass}`.trim();
196
259
 
197
260
  return (
198
- <CustomTag
261
+ <StyledPromptContainer
262
+ as={tagName || 'div'}
199
263
  id={'preview-prompt'}
200
264
  onClick={onClick}
201
265
  className={customClasses}
266
+ tagName={tagName}
202
267
  dangerouslySetInnerHTML={{
203
268
  __html: this.parsedText(prompt || '').replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX),
204
269
  }}
@@ -207,51 +272,4 @@ export class PreviewPrompt extends Component {
207
272
  }
208
273
  }
209
274
 
210
- const styles = (theme) => ({
211
- prompt: {
212
- verticalAlign: 'middle',
213
- color: color.text(),
214
- },
215
- legend: {
216
- width: '100%',
217
- fontSize: 'inherit !important',
218
- },
219
- rationale: {
220
- paddingLeft: theme.spacing.unit * 4,
221
- paddingBottom: theme.spacing.unit,
222
- },
223
- label: {
224
- color: `${color.text()} !important`, //'var(--choice-input-color, black)',
225
- display: 'flex',
226
- flexDirection: 'column',
227
- verticalAlign: 'middle',
228
- cursor: 'pointer',
229
- '& > p': {
230
- margin: '0 0 0 0 !important',
231
- },
232
- },
233
- promptTable: {
234
- '&:not(.MathJax) > table': {
235
- borderCollapse: 'collapse',
236
- },
237
- '&:not(.MathJax) > table:has(tbody tr > th:first-child):not(:has(tbody tr > td:first-child)) tbody td:nth-child(even)': {
238
- backgroundColor: '#f6f8fa',
239
- color: theme.palette.common.black,
240
- },
241
-
242
- '&:not(.MathJax) > table:has(tbody tr > td:first-child) tbody tr:nth-child(even) td': {
243
- backgroundColor: '#f6f8fa',
244
- color: theme.palette.common.black,
245
- },
246
- // align table content to left as per STAR requirement PD-3687
247
- '&:not(.MathJax) table td, &:not(.MathJax) table th': {
248
- padding: '.6em 1em',
249
- textAlign: 'left',
250
- },
251
- // added this to fix alignment of text in prompt imported from studio (PD-3423)
252
- '&:not(.MathJax) > table td > p.kds-indent': {
253
- textAlign: 'initial',
254
- },
255
- },
256
- });
257
- export default withStyles(styles)(PreviewPrompt);
275
+ export default PreviewPrompt;