@pie-lib/config-ui 12.0.0-beta.5 → 12.0.0-next.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.
Files changed (116) hide show
  1. package/CHANGELOG.json +8 -1653
  2. package/CHANGELOG.md +345 -4
  3. package/LICENSE.md +5 -0
  4. package/NEXT.CHANGELOG.json +1 -0
  5. package/lib/alert-dialog.js +40 -10
  6. package/lib/alert-dialog.js.map +1 -1
  7. package/lib/checkbox.js +58 -48
  8. package/lib/checkbox.js.map +1 -1
  9. package/lib/choice-configuration/feedback-menu.js +24 -26
  10. package/lib/choice-configuration/feedback-menu.js.map +1 -1
  11. package/lib/choice-configuration/index.js +182 -185
  12. package/lib/choice-configuration/index.js.map +1 -1
  13. package/lib/choice-utils.js +5 -7
  14. package/lib/choice-utils.js.map +1 -1
  15. package/lib/feedback-config/feedback-selector.js +69 -73
  16. package/lib/feedback-config/feedback-selector.js.map +1 -1
  17. package/lib/feedback-config/group.js +22 -25
  18. package/lib/feedback-config/group.js.map +1 -1
  19. package/lib/feedback-config/index.js +41 -44
  20. package/lib/feedback-config/index.js.map +1 -1
  21. package/lib/form-section.js +31 -25
  22. package/lib/form-section.js.map +1 -1
  23. package/lib/help.js +37 -47
  24. package/lib/help.js.map +1 -1
  25. package/lib/index.js +1 -2
  26. package/lib/index.js.map +1 -1
  27. package/lib/input.js +12 -17
  28. package/lib/input.js.map +1 -1
  29. package/lib/inputs.js +58 -67
  30. package/lib/inputs.js.map +1 -1
  31. package/lib/langs.js +56 -70
  32. package/lib/langs.js.map +1 -1
  33. package/lib/layout/config-layout.js +78 -47
  34. package/lib/layout/config-layout.js.map +1 -1
  35. package/lib/layout/index.js.map +1 -1
  36. package/lib/layout/layout-contents.js +58 -60
  37. package/lib/layout/layout-contents.js.map +1 -1
  38. package/lib/layout/settings-box.js +25 -33
  39. package/lib/layout/settings-box.js.map +1 -1
  40. package/lib/mui-box/index.js +41 -50
  41. package/lib/mui-box/index.js.map +1 -1
  42. package/lib/number-text-field-custom.js +151 -89
  43. package/lib/number-text-field-custom.js.map +1 -1
  44. package/lib/number-text-field.js +74 -63
  45. package/lib/number-text-field.js.map +1 -1
  46. package/lib/radio-with-label.js +30 -16
  47. package/lib/radio-with-label.js.map +1 -1
  48. package/lib/settings/display-size.js +16 -20
  49. package/lib/settings/display-size.js.map +1 -1
  50. package/lib/settings/index.js +13 -19
  51. package/lib/settings/index.js.map +1 -1
  52. package/lib/settings/panel.js +140 -141
  53. package/lib/settings/panel.js.map +1 -1
  54. package/lib/settings/settings-radio-label.js +29 -16
  55. package/lib/settings/settings-radio-label.js.map +1 -1
  56. package/lib/settings/toggle.js +39 -25
  57. package/lib/settings/toggle.js.map +1 -1
  58. package/lib/tabs/index.js +18 -30
  59. package/lib/tabs/index.js.map +1 -1
  60. package/lib/tags-input/index.js +49 -61
  61. package/lib/tags-input/index.js.map +1 -1
  62. package/lib/two-choice.js +33 -43
  63. package/lib/two-choice.js.map +1 -1
  64. package/lib/with-stateful-model.js +8 -12
  65. package/lib/with-stateful-model.js.map +1 -1
  66. package/package.json +22 -11
  67. package/src/__tests__/alert-dialog.test.jsx +283 -0
  68. package/src/__tests__/checkbox.test.jsx +249 -0
  69. package/src/__tests__/choice-utils.test.js +12 -0
  70. package/src/__tests__/form-section.test.jsx +334 -0
  71. package/src/__tests__/help.test.jsx +184 -0
  72. package/src/__tests__/input.test.jsx +192 -0
  73. package/src/__tests__/langs.test.jsx +457 -0
  74. package/src/__tests__/number-text-field-custom.test.jsx +438 -0
  75. package/src/__tests__/number-text-field.test.jsx +341 -0
  76. package/src/__tests__/radio-with-label.test.jsx +259 -0
  77. package/src/__tests__/settings-panel.test.js +187 -0
  78. package/src/__tests__/settings.test.jsx +515 -0
  79. package/src/__tests__/tabs.test.jsx +193 -0
  80. package/src/__tests__/two-choice.test.js +110 -0
  81. package/src/__tests__/with-stateful-model.test.jsx +145 -0
  82. package/src/alert-dialog.jsx +30 -8
  83. package/src/checkbox.jsx +43 -37
  84. package/src/choice-configuration/__tests__/feedback-menu.test.jsx +163 -0
  85. package/src/choice-configuration/__tests__/index.test.jsx +234 -0
  86. package/src/choice-configuration/feedback-menu.jsx +6 -6
  87. package/src/choice-configuration/index.jsx +208 -192
  88. package/src/feedback-config/__tests__/feedback-config.test.jsx +141 -0
  89. package/src/feedback-config/__tests__/feedback-selector.test.jsx +107 -0
  90. package/src/feedback-config/feedback-selector.jsx +52 -53
  91. package/src/feedback-config/group.jsx +21 -22
  92. package/src/feedback-config/index.jsx +27 -29
  93. package/src/form-section.jsx +26 -18
  94. package/src/help.jsx +20 -28
  95. package/src/input.jsx +1 -1
  96. package/src/inputs.jsx +35 -44
  97. package/src/langs.jsx +41 -46
  98. package/src/layout/__tests__/config.layout.test.jsx +59 -0
  99. package/src/layout/__tests__/layout-content.test.jsx +3 -0
  100. package/src/layout/config-layout.jsx +53 -23
  101. package/src/layout/layout-contents.jsx +38 -40
  102. package/src/layout/settings-box.jsx +16 -19
  103. package/src/mui-box/index.jsx +35 -43
  104. package/src/number-text-field-custom.jsx +117 -65
  105. package/src/number-text-field.jsx +51 -34
  106. package/src/radio-with-label.jsx +26 -10
  107. package/src/settings/display-size.jsx +12 -11
  108. package/src/settings/index.js +2 -1
  109. package/src/settings/panel.jsx +101 -92
  110. package/src/settings/settings-radio-label.jsx +26 -10
  111. package/src/settings/toggle.jsx +37 -18
  112. package/src/tabs/index.jsx +8 -8
  113. package/src/tags-input/__tests__/index.test.jsx +113 -0
  114. package/src/tags-input/index.jsx +35 -38
  115. package/src/two-choice.jsx +15 -19
  116. package/README.md +0 -12
@@ -0,0 +1,107 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import userEvent from '@testing-library/user-event';
3
+ import React from 'react';
4
+ import { FeedbackSelector } from '../feedback-selector';
5
+
6
+ // Mock the editable-html component to avoid window dependencies in tests
7
+ jest.mock('@pie-lib/editable-html', () => {
8
+ return {
9
+ __esModule: true,
10
+ default: ({ markup, onChange }) => (
11
+ <textarea
12
+ data-testid="editable-html"
13
+ defaultValue={markup || ''}
14
+ onChange={(e) => onChange(e.target.value)}
15
+ />
16
+ ),
17
+ };
18
+ });
19
+
20
+ describe('feedback-selector', () => {
21
+ let onChange;
22
+
23
+ const renderComponent = (feedback = { type: 'default', default: 'hi' }) => {
24
+ return render(
25
+ <FeedbackSelector
26
+ label={'Feedback'}
27
+ onChange={onChange}
28
+ feedback={feedback}
29
+ />
30
+ );
31
+ };
32
+
33
+ beforeEach(() => {
34
+ onChange = jest.fn();
35
+ });
36
+
37
+ describe('rendering', () => {
38
+ it('renders feedback type selector', () => {
39
+ renderComponent();
40
+ expect(screen.getByText('Simple Feedback')).toBeInTheDocument();
41
+ expect(screen.getByText('No Feedback')).toBeInTheDocument();
42
+ expect(screen.getByText('Customized Feedback')).toBeInTheDocument();
43
+ });
44
+
45
+ it('shows default feedback text when type is default', () => {
46
+ renderComponent({ type: 'default', default: 'hi' });
47
+ expect(screen.getByText('hi')).toBeInTheDocument();
48
+ });
49
+
50
+ it('shows editable html when type is custom', () => {
51
+ renderComponent({ type: 'custom', default: 'hi', custom: 'custom text' });
52
+ expect(screen.getByTestId('editable-html')).toBeInTheDocument();
53
+ expect(screen.getByTestId('editable-html')).toHaveValue('custom text');
54
+ });
55
+
56
+ it('does not show default feedback when type is none', () => {
57
+ renderComponent({ type: 'none', default: 'hi' });
58
+ expect(screen.queryByText('hi')).not.toBeInTheDocument();
59
+ });
60
+ });
61
+
62
+ describe('user interactions', () => {
63
+ it('calls onChange when switching to default feedback', async () => {
64
+ const user = userEvent.setup();
65
+ renderComponent({ type: 'custom', default: 'hi' });
66
+
67
+ await user.click(screen.getByLabelText('Simple Feedback'));
68
+
69
+ expect(onChange).toHaveBeenCalledWith({ type: 'default', default: 'hi' });
70
+ });
71
+
72
+ it('calls onChange when switching to custom feedback', async () => {
73
+ const user = userEvent.setup();
74
+ renderComponent({ type: 'default', default: 'hi' });
75
+
76
+ await user.click(screen.getByLabelText('Customized Feedback'));
77
+
78
+ expect(onChange).toHaveBeenCalledWith({ type: 'custom', default: 'hi' });
79
+ });
80
+
81
+ it('calls onChange when switching to no feedback', async () => {
82
+ const user = userEvent.setup();
83
+ renderComponent({ type: 'default', default: 'hi' });
84
+
85
+ await user.click(screen.getByLabelText('No Feedback'));
86
+
87
+ expect(onChange).toHaveBeenCalledWith({ type: 'none', default: 'hi' });
88
+ });
89
+
90
+ it('calls onChange with custom text when editing custom feedback', async () => {
91
+ const user = userEvent.setup();
92
+ renderComponent({ type: 'custom', default: 'hi', custom: '' });
93
+
94
+ const editor = screen.getByTestId('editable-html');
95
+ await user.clear(editor);
96
+ await user.type(editor, 'text');
97
+
98
+ // user.type triggers onChange for each character, so check that onChange was called
99
+ // and that the last call has 'text' in custom field
100
+ expect(onChange).toHaveBeenCalled();
101
+ const lastCall = onChange.mock.calls[onChange.mock.calls.length - 1][0];
102
+ expect(lastCall.type).toBe('custom');
103
+ expect(lastCall.custom).toBe('text');
104
+ expect(lastCall.default).toBe('hi');
105
+ });
106
+ });
107
+ });
@@ -1,54 +1,56 @@
1
- import EditableHTML from '@pie-lib/editable-html';
1
+ //import EditableHTML from '@pie-lib/editable-html';
2
2
  import { InputContainer } from '@pie-lib/render-ui';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
- import { withStyles } from '@material-ui/core/styles';
5
+ import { styled } from '@mui/material/styles';
6
6
  import Group from './group';
7
7
 
8
+
9
+ // - mathquill error window not defined
10
+ let EditableHtml;
11
+ let StyledEditableHTML;
12
+ if (typeof window !== 'undefined') {
13
+ EditableHtml = require('@pie-lib/editable-html')['default'];
14
+ StyledEditableHTML = styled(EditableHtml)(({ theme }) => ({
15
+ fontFamily: theme.typography.fontFamily,
16
+ }));
17
+ }
18
+
8
19
  const feedbackLabels = {
9
20
  default: 'Simple Feedback',
10
21
  none: 'No Feedback',
11
22
  custom: 'Customized Feedback',
12
23
  };
13
24
 
14
- const holder = (theme, extras) => ({
25
+ const StyledFeedbackSelector = styled('div')(({ theme }) => ({
26
+ marginBottom: theme.spacing(1),
27
+ }));
28
+
29
+ const StyledInputContainer = styled(InputContainer)(() => ({
30
+ paddingBottom: 0,
31
+ }));
32
+
33
+ const StyledCustomHolder = styled('div')(({ theme }) => ({
15
34
  marginTop: '0px',
16
35
  background: theme.palette.grey[300],
17
- padding: theme.spacing.unit,
18
- marginBottom: theme.spacing.unit * 2,
36
+ padding: 0,
37
+ marginBottom: theme.spacing(2),
19
38
  borderRadius: '4px',
20
- ...extras,
21
- });
22
-
23
- const style = (theme) => ({
24
- feedbackSelector: {
25
- marginBottom: theme.spacing.unit,
26
- },
27
- label: {
28
- cursor: 'pointer',
29
- },
30
- inputContainerLabel: {
31
- transform: 'translateY(-20%)',
32
- },
33
- feedbackInputContainer: {
34
- paddingBottom: 0,
35
- },
36
- customHolder: holder(theme, {
37
- background: theme.palette.grey[300],
38
- padding: 0,
39
- }),
40
- defaultHolder: holder(theme, {
41
- fontFamily: theme.typography.fontFamily,
42
- padding: theme.spacing.unit * 2,
43
- cursor: 'default',
44
- }),
45
- editor: {
46
- fontFamily: theme.typography.fontFamily,
47
- },
48
- group: {
49
- paddingTop: theme.spacing.unit,
50
- },
51
- });
39
+ }));
40
+
41
+ const StyledDefaultHolder = styled('div')(({ theme }) => ({
42
+ marginTop: '0px',
43
+ background: theme.palette.grey[300],
44
+ padding: theme.spacing(2),
45
+ marginBottom: theme.spacing(2),
46
+ borderRadius: '4px',
47
+ fontFamily: theme.typography.fontFamily,
48
+ cursor: 'default',
49
+ }));
50
+
51
+ const StyledGroup = styled(Group)(({ theme }) => ({
52
+ paddingTop: theme.spacing(1),
53
+ }));
52
54
 
53
55
  export const FeedbackType = {
54
56
  type: PropTypes.oneOf(['default', 'custom', 'none']),
@@ -59,11 +61,11 @@ export const FeedbackType = {
59
61
  export class FeedbackSelector extends React.Component {
60
62
  static propTypes = {
61
63
  keys: PropTypes.arrayOf(PropTypes.string),
62
- classes: PropTypes.object.isRequired,
63
64
  label: PropTypes.string.isRequired,
64
65
  feedback: PropTypes.shape(FeedbackType).isRequired,
65
66
  onChange: PropTypes.func.isRequired,
66
67
  toolbarOpts: PropTypes.object,
68
+ mathMlOptions: PropTypes.object,
67
69
  };
68
70
 
69
71
  changeType = (type) => {
@@ -79,44 +81,41 @@ export class FeedbackSelector extends React.Component {
79
81
  };
80
82
 
81
83
  render() {
82
- const { keys, classes, label, feedback, toolbarOpts, mathMlOptions = {} } = this.props;
84
+ const { keys, label, feedback, toolbarOpts, mathMlOptions = {} } = this.props;
83
85
 
84
86
  const feedbackKeys = keys || Object.keys(feedbackLabels);
85
87
 
86
88
  return (
87
- <div className={classes.feedbackSelector}>
88
- <InputContainer
89
+ <StyledFeedbackSelector>
90
+ <StyledInputContainer
89
91
  label={label}
90
- className={classes.feedbackInputContainer}
91
- extraClasses={{ label: classes.inputContainerLabel }}
92
+ extraClasses={{ label: { transform: 'translateY(-20%)' } }}
92
93
  >
93
- <Group
94
- className={classes.group}
94
+ <StyledGroup
95
95
  keys={feedbackKeys}
96
96
  label={label}
97
97
  value={feedback.type}
98
98
  onChange={this.changeType}
99
99
  feedbackLabels={feedbackLabels}
100
100
  />
101
- </InputContainer>
101
+ </StyledInputContainer>
102
102
 
103
103
  {feedback.type === 'custom' && (
104
- <div className={classes.customHolder}>
105
- <EditableHTML
106
- className={classes.editor}
104
+ <StyledCustomHolder>
105
+ <StyledEditableHTML
107
106
  onChange={this.changeCustom}
108
107
  markup={feedback.custom || ''}
109
108
  toolbarOpts={toolbarOpts}
110
109
  languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
111
110
  mathMlOptions={mathMlOptions}
112
111
  />
113
- </div>
112
+ </StyledCustomHolder>
114
113
  )}
115
114
 
116
- {feedback.type === 'default' && <div className={classes.defaultHolder}> {feedback.default}</div>}
117
- </div>
115
+ {feedback.type === 'default' && <StyledDefaultHolder> {feedback.default}</StyledDefaultHolder>}
116
+ </StyledFeedbackSelector>
118
117
  );
119
118
  }
120
119
  }
121
120
 
122
- export default withStyles(style)(FeedbackSelector);
121
+ export default FeedbackSelector;
@@ -1,42 +1,42 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import RadioWithLabel from '../radio-with-label';
3
3
  import React from 'react';
4
- import { withStyles } from '@material-ui/core/styles';
5
- import classNames from 'classnames';
4
+ import { styled } from '@mui/material/styles';
6
5
 
7
- const styles = (theme) => ({
8
- radioLabel: {
6
+ const StyledChoiceHolder = styled('div')(() => ({
7
+ display: 'flex',
8
+ alignItems: 'center',
9
+ }));
10
+
11
+ const StyledChoice = styled('div')(() => ({
12
+ display: 'flex',
13
+ alignItems: 'center',
14
+ }));
15
+
16
+ const StyledRadioWithLabel = styled(RadioWithLabel)(({ theme }) => ({
17
+ '& .MuiFormControlLabel-label': {
9
18
  fontSize: theme.typography.fontSize - 2,
10
19
  },
11
- choice: {
12
- display: 'flex',
13
- alignItems: 'center',
14
- },
15
- choiceHolder: {
16
- display: 'flex',
17
- alignItems: 'center',
18
- },
19
- });
20
+ }));
20
21
 
21
22
  const Group = (props) => {
22
- const { feedbackLabels, value, classes, className, onChange, keys } = props;
23
+ const { feedbackLabels, value, className, onChange, keys } = props;
23
24
 
24
25
  return (
25
- <div className={classNames(classes.choiceHolder, className)}>
26
+ <StyledChoiceHolder className={className}>
26
27
  {keys.map((key) => {
27
28
  return (
28
- <div className={classes.choice} key={key}>
29
- <RadioWithLabel
29
+ <StyledChoice key={key}>
30
+ <StyledRadioWithLabel
30
31
  value={key}
31
32
  checked={value === key}
32
- classes={{ label: classes.radioLabel }}
33
33
  onChange={(e) => onChange(e.currentTarget.value)}
34
34
  label={feedbackLabels[key]}
35
35
  />
36
- </div>
36
+ </StyledChoice>
37
37
  );
38
38
  })}
39
- </div>
39
+ </StyledChoiceHolder>
40
40
  );
41
41
  };
42
42
 
@@ -44,9 +44,8 @@ Group.propTypes = {
44
44
  className: PropTypes.string,
45
45
  feedbackLabels: PropTypes.object.isRequired,
46
46
  value: PropTypes.string.isRequired,
47
- classes: PropTypes.object.isRequired,
48
47
  keys: PropTypes.arrayOf(PropTypes.string),
49
48
  onChange: PropTypes.func,
50
49
  };
51
50
 
52
- export default withStyles(styles)(Group);
51
+ export default Group;
@@ -1,27 +1,26 @@
1
1
  import FeedbackSelector, { FeedbackType } from './feedback-selector';
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
- import { withStyles } from '@material-ui/core/styles';
5
- import ExpansionPanel from '@material-ui/core/ExpansionPanel';
6
- import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
7
- import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
8
- import Typography from '@material-ui/core/Typography';
9
- import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
4
+ import { styled } from '@mui/material/styles';
5
+ import Accordion from '@mui/material/Accordion';
6
+ import AccordionSummary from '@mui/material/AccordionSummary';
7
+ import AccordionDetails from '@mui/material/AccordionDetails';
8
+ import Typography from '@mui/material/Typography';
9
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
10
10
  import merge from 'lodash/merge';
11
11
 
12
12
  export { FeedbackSelector };
13
13
 
14
- const style = {
15
- feedbackContainer: {
16
- display: 'flex',
17
- flex: 1,
18
- flexDirection: 'column',
19
- },
20
- panelDetails: {
21
- paddingTop: 0,
22
- paddingBottom: 0,
23
- },
24
- };
14
+ const StyledFeedbackContainer = styled('div')(() => ({
15
+ display: 'flex',
16
+ flex: 1,
17
+ flexDirection: 'column',
18
+ }));
19
+
20
+ const StyledAccordionDetails = styled(AccordionDetails)(() => ({
21
+ paddingTop: 0,
22
+ paddingBottom: 0,
23
+ }));
25
24
 
26
25
  export const buildDefaults = (input) => {
27
26
  return merge(
@@ -45,7 +44,6 @@ export class FeedbackConfig extends React.Component {
45
44
  partial: PropTypes.shape(FeedbackType),
46
45
  }),
47
46
  onChange: PropTypes.func.isRequired,
48
- classes: PropTypes.object.isRequired,
49
47
  toolbarOpts: PropTypes.object,
50
48
  };
51
49
 
@@ -68,17 +66,17 @@ export class FeedbackConfig extends React.Component {
68
66
  onPartialChange = this.onChange.bind(this, 'partial');
69
67
 
70
68
  render() {
71
- const { classes, className, allowPartial, feedback, toolbarOpts } = this.props;
69
+ const { className, allowPartial, feedback, toolbarOpts } = this.props;
72
70
 
73
71
  return (
74
72
  <div className={className}>
75
- <ExpansionPanel>
76
- <ExpansionPanelSummary expandIcon={<ExpandMoreIcon />}>
77
- <Typography className={classes.heading}>Feedback</Typography>
78
- </ExpansionPanelSummary>
73
+ <Accordion slotProps={{ transition: { timeout: { enter: 225, exit: 195 } } }}>
74
+ <AccordionSummary expandIcon={<ExpandMoreIcon />}>
75
+ <Typography>Feedback</Typography>
76
+ </AccordionSummary>
79
77
 
80
- <ExpansionPanelDetails className={classes.panelDetails}>
81
- <div className={classes.feedbackContainer}>
78
+ <StyledAccordionDetails>
79
+ <StyledFeedbackContainer>
82
80
  <FeedbackSelector
83
81
  label="If correct, show"
84
82
  feedback={feedback.correct}
@@ -101,12 +99,12 @@ export class FeedbackConfig extends React.Component {
101
99
  onChange={this.onIncorrectChange}
102
100
  toolbarOpts={toolbarOpts}
103
101
  />
104
- </div>
105
- </ExpansionPanelDetails>
106
- </ExpansionPanel>
102
+ </StyledFeedbackContainer>
103
+ </StyledAccordionDetails>
104
+ </Accordion>
107
105
  </div>
108
106
  );
109
107
  }
110
108
  }
111
109
 
112
- export default withStyles(style)(FeedbackConfig);
110
+ export default FeedbackConfig;
@@ -1,23 +1,31 @@
1
1
  import React from 'react';
2
- import Typography from '@material-ui/core/Typography';
3
- import classNames from 'classnames';
4
- import { withStyles } from '@material-ui/core/styles';
2
+ import PropTypes from 'prop-types';
3
+ import Typography from '@mui/material/Typography';
4
+ import { styled } from '@mui/material/styles';
5
5
 
6
- const styles = (theme) => ({
7
- formSection: {
8
- marginTop: theme.spacing.unit * 2,
9
- marginBottom: theme.spacing.unit * 2,
10
- },
11
- label: {
12
- marginBottom: theme.spacing.unit,
13
- },
14
- });
6
+ const StyledFormSection = styled('div')(({ theme }) => ({
7
+ marginTop: theme.spacing(2),
8
+ marginBottom: theme.spacing(2),
9
+ }));
15
10
 
16
- export default withStyles(styles)(({ className, classes, label, children, labelExtraStyle }) => (
17
- <div className={classNames(classes.formSection, className)}>
18
- <Typography className={classes.label} type="subheading" style={labelExtraStyle}>
11
+ const StyledTypography = styled(Typography)(({ theme }) => ({
12
+ marginBottom: theme.spacing(1),
13
+ }));
14
+
15
+ const FormSection = ({ className, label, children, labelExtraStyle }) => (
16
+ <StyledFormSection className={className}>
17
+ <StyledTypography variant="subtitle1" style={labelExtraStyle}>
19
18
  {label}
20
- </Typography>
19
+ </StyledTypography>
21
20
  {children}
22
- </div>
23
- ));
21
+ </StyledFormSection>
22
+ );
23
+
24
+ FormSection.propTypes = {
25
+ className: PropTypes.string,
26
+ label: PropTypes.string,
27
+ children: PropTypes.node,
28
+ labelExtraStyle: PropTypes.object,
29
+ };
30
+
31
+ export default FormSection;
package/src/help.jsx CHANGED
@@ -1,42 +1,34 @@
1
- import Dialog from '@material-ui/core/Dialog';
2
- import DialogTitle from '@material-ui/core/DialogTitle';
3
- import DialogContentText from '@material-ui/core/DialogContentText';
4
- import DialogContent from '@material-ui/core/DialogContent';
5
- import DialogActions from '@material-ui/core/DialogActions';
1
+ import Dialog from '@mui/material/Dialog';
2
+ import DialogTitle from '@mui/material/DialogTitle';
3
+ import DialogContentText from '@mui/material/DialogContentText';
4
+ import DialogContent from '@mui/material/DialogContent';
5
+ import DialogActions from '@mui/material/DialogActions';
6
6
  import PropTypes from 'prop-types';
7
7
 
8
- import Button from '@material-ui/core/Button';
9
- import HelpIcon from '@material-ui/icons/Help';
10
- import IconButton from '@material-ui/core/IconButton';
8
+ import Button from '@mui/material/Button';
9
+ import HelpIcon from '@mui/icons-material/Help';
10
+ import IconButton from '@mui/material/IconButton';
11
11
  import React from 'react';
12
- import { withStyles } from '@material-ui/core/styles';
12
+ import { styled } from '@mui/material/styles';
13
13
 
14
- const RawHelpButton = ({ onClick, classes }) => (
15
- <IconButton
16
- classes={{
17
- label: classes.icon,
18
- }}
19
- onClick={onClick}
20
- >
14
+ const StyledIconButton = styled(IconButton)(({ theme }) => ({
15
+ '&:hover': {
16
+ color: theme.palette.grey[300],
17
+ },
18
+ }));
19
+
20
+ export const HelpButton = ({ onClick }) => (
21
+ <StyledIconButton onClick={onClick} size="large">
21
22
  <HelpIcon />
22
- </IconButton>
23
+ </StyledIconButton>
23
24
  );
24
25
 
25
- RawHelpButton.propTypes = {
26
+ HelpButton.propTypes = {
26
27
  onClick: PropTypes.func,
27
- classes: PropTypes.object.isRequired,
28
28
  };
29
29
 
30
- export const HelpButton = withStyles((theme) => ({
31
- icon: {
32
- '&:hover': {
33
- color: theme.palette.grey[300],
34
- },
35
- },
36
- }))(RawHelpButton);
37
-
38
30
  export const HelpDialog = ({ open, onClose, children, title }) => (
39
- <Dialog open={open} onRequestClose={onClose}>
31
+ <Dialog open={open} onClose={onClose}>
40
32
  <DialogTitle>{title}</DialogTitle>
41
33
  <DialogContent>
42
34
  <DialogContentText>{children}</DialogContentText>
package/src/input.jsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { default as MaterialInput } from '@material-ui/core/Input';
3
+ import { default as MaterialInput } from '@mui/material/Input';
4
4
  import { InputContainer } from '@pie-lib/render-ui';
5
5
 
6
6
  export default class Input extends React.Component {