@pie-lib/config-ui 12.0.0-beta.5 → 12.1.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 (139) 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/__tests__/alert-dialog.test.js +262 -0
  6. package/lib/__tests__/checkbox.test.js +227 -0
  7. package/lib/__tests__/choice-utils.test.js +14 -0
  8. package/lib/__tests__/form-section.test.js +252 -0
  9. package/lib/__tests__/help.test.js +270 -0
  10. package/lib/__tests__/input.test.js +268 -0
  11. package/lib/__tests__/langs.test.js +541 -0
  12. package/lib/__tests__/number-text-field-custom.test.js +362 -0
  13. package/lib/__tests__/number-text-field.test.js +421 -0
  14. package/lib/__tests__/radio-with-label.test.js +233 -0
  15. package/lib/__tests__/settings-panel.test.js +184 -0
  16. package/lib/__tests__/settings.test.js +653 -0
  17. package/lib/__tests__/tabs.test.js +211 -0
  18. package/lib/__tests__/two-choice.test.js +124 -0
  19. package/lib/__tests__/with-stateful-model.test.js +221 -0
  20. package/lib/alert-dialog.js +41 -11
  21. package/lib/alert-dialog.js.map +1 -1
  22. package/lib/checkbox.js +59 -49
  23. package/lib/checkbox.js.map +1 -1
  24. package/lib/choice-configuration/__tests__/feedback-menu.test.js +287 -0
  25. package/lib/choice-configuration/__tests__/index.test.js +253 -0
  26. package/lib/choice-configuration/feedback-menu.js +25 -27
  27. package/lib/choice-configuration/feedback-menu.js.map +1 -1
  28. package/lib/choice-configuration/index.js +183 -186
  29. package/lib/choice-configuration/index.js.map +1 -1
  30. package/lib/choice-utils.js +6 -8
  31. package/lib/choice-utils.js.map +1 -1
  32. package/lib/feedback-config/__tests__/feedback-config.test.js +201 -0
  33. package/lib/feedback-config/__tests__/feedback-selector.test.js +177 -0
  34. package/lib/feedback-config/feedback-selector.js +70 -74
  35. package/lib/feedback-config/feedback-selector.js.map +1 -1
  36. package/lib/feedback-config/group.js +23 -26
  37. package/lib/feedback-config/group.js.map +1 -1
  38. package/lib/feedback-config/index.js +42 -45
  39. package/lib/feedback-config/index.js.map +1 -1
  40. package/lib/form-section.js +32 -26
  41. package/lib/form-section.js.map +1 -1
  42. package/lib/help.js +38 -48
  43. package/lib/help.js.map +1 -1
  44. package/lib/index.js +2 -3
  45. package/lib/index.js.map +1 -1
  46. package/lib/input.js +13 -18
  47. package/lib/input.js.map +1 -1
  48. package/lib/inputs.js +59 -68
  49. package/lib/inputs.js.map +1 -1
  50. package/lib/langs.js +57 -71
  51. package/lib/langs.js.map +1 -1
  52. package/lib/layout/__tests__/config.layout.test.js +70 -0
  53. package/lib/layout/__tests__/layout-content.test.js +6 -0
  54. package/lib/layout/config-layout.js +79 -48
  55. package/lib/layout/config-layout.js.map +1 -1
  56. package/lib/layout/index.js +1 -1
  57. package/lib/layout/index.js.map +1 -1
  58. package/lib/layout/layout-contents.js +59 -61
  59. package/lib/layout/layout-contents.js.map +1 -1
  60. package/lib/layout/settings-box.js +26 -34
  61. package/lib/layout/settings-box.js.map +1 -1
  62. package/lib/mui-box/index.js +42 -51
  63. package/lib/mui-box/index.js.map +1 -1
  64. package/lib/number-text-field-custom.js +152 -90
  65. package/lib/number-text-field-custom.js.map +1 -1
  66. package/lib/number-text-field.js +75 -64
  67. package/lib/number-text-field.js.map +1 -1
  68. package/lib/radio-with-label.js +31 -17
  69. package/lib/radio-with-label.js.map +1 -1
  70. package/lib/settings/display-size.js +17 -21
  71. package/lib/settings/display-size.js.map +1 -1
  72. package/lib/settings/index.js +14 -20
  73. package/lib/settings/index.js.map +1 -1
  74. package/lib/settings/panel.js +141 -142
  75. package/lib/settings/panel.js.map +1 -1
  76. package/lib/settings/settings-radio-label.js +30 -17
  77. package/lib/settings/settings-radio-label.js.map +1 -1
  78. package/lib/settings/toggle.js +40 -26
  79. package/lib/settings/toggle.js.map +1 -1
  80. package/lib/tabs/index.js +19 -31
  81. package/lib/tabs/index.js.map +1 -1
  82. package/lib/tags-input/__tests__/index.test.js +183 -0
  83. package/lib/tags-input/index.js +50 -62
  84. package/lib/tags-input/index.js.map +1 -1
  85. package/lib/two-choice.js +34 -44
  86. package/lib/two-choice.js.map +1 -1
  87. package/lib/with-stateful-model.js +9 -13
  88. package/lib/with-stateful-model.js.map +1 -1
  89. package/package.json +14 -11
  90. package/src/__tests__/alert-dialog.test.jsx +283 -0
  91. package/src/__tests__/checkbox.test.jsx +249 -0
  92. package/src/__tests__/choice-utils.test.js +12 -0
  93. package/src/__tests__/form-section.test.jsx +334 -0
  94. package/src/__tests__/help.test.jsx +184 -0
  95. package/src/__tests__/input.test.jsx +192 -0
  96. package/src/__tests__/langs.test.jsx +457 -0
  97. package/src/__tests__/number-text-field-custom.test.jsx +438 -0
  98. package/src/__tests__/number-text-field.test.jsx +341 -0
  99. package/src/__tests__/radio-with-label.test.jsx +259 -0
  100. package/src/__tests__/settings-panel.test.js +187 -0
  101. package/src/__tests__/settings.test.jsx +515 -0
  102. package/src/__tests__/tabs.test.jsx +193 -0
  103. package/src/__tests__/two-choice.test.js +110 -0
  104. package/src/__tests__/with-stateful-model.test.jsx +145 -0
  105. package/src/alert-dialog.jsx +30 -8
  106. package/src/checkbox.jsx +43 -37
  107. package/src/choice-configuration/__tests__/feedback-menu.test.jsx +163 -0
  108. package/src/choice-configuration/__tests__/index.test.jsx +234 -0
  109. package/src/choice-configuration/feedback-menu.jsx +6 -6
  110. package/src/choice-configuration/index.jsx +208 -199
  111. package/src/feedback-config/__tests__/feedback-config.test.jsx +141 -0
  112. package/src/feedback-config/__tests__/feedback-selector.test.jsx +97 -0
  113. package/src/feedback-config/feedback-selector.jsx +50 -55
  114. package/src/feedback-config/group.jsx +21 -22
  115. package/src/feedback-config/index.jsx +27 -29
  116. package/src/form-section.jsx +26 -18
  117. package/src/help.jsx +20 -28
  118. package/src/input.jsx +1 -1
  119. package/src/inputs.jsx +35 -44
  120. package/src/langs.jsx +41 -46
  121. package/src/layout/__tests__/config.layout.test.jsx +59 -0
  122. package/src/layout/__tests__/layout-content.test.jsx +3 -0
  123. package/src/layout/config-layout.jsx +53 -23
  124. package/src/layout/layout-contents.jsx +38 -40
  125. package/src/layout/settings-box.jsx +16 -19
  126. package/src/mui-box/index.jsx +35 -43
  127. package/src/number-text-field-custom.jsx +117 -65
  128. package/src/number-text-field.jsx +51 -34
  129. package/src/radio-with-label.jsx +26 -10
  130. package/src/settings/display-size.jsx +12 -11
  131. package/src/settings/index.js +2 -1
  132. package/src/settings/panel.jsx +101 -92
  133. package/src/settings/settings-radio-label.jsx +26 -10
  134. package/src/settings/toggle.jsx +37 -18
  135. package/src/tabs/index.jsx +8 -8
  136. package/src/tags-input/__tests__/index.test.jsx +113 -0
  137. package/src/tags-input/index.jsx +35 -38
  138. package/src/two-choice.jsx +15 -19
  139. package/README.md +0 -12
package/src/langs.jsx CHANGED
@@ -1,40 +1,38 @@
1
- import Input from '@material-ui/core/Input';
2
- import InputLabel from '@material-ui/core/InputLabel';
1
+ import Input from '@mui/material/Input';
2
+ import InputLabel from '@mui/material/InputLabel';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
- import classNames from 'classnames';
6
- import { withStyles } from '@material-ui/core/styles';
7
- import Select from '@material-ui/core/Select';
8
- import MenuItem from '@material-ui/core/MenuItem';
9
- import FormControl from '@material-ui/core/FormControl';
5
+ import { styled } from '@mui/material/styles';
6
+ import Select from '@mui/material/Select';
7
+ import MenuItem from '@mui/material/MenuItem';
8
+ import FormControl from '@mui/material/FormControl';
10
9
  import debug from 'debug';
11
10
 
12
11
  const log = debug('pie-elements:config-ui:langs');
13
12
 
14
- const styles = (theme) => ({
15
- root: {
16
- flexDirection: 'column',
17
- alignItems: 'start',
18
- display: 'flex',
19
- position: 'relative',
20
- paddingTop: '0px',
21
- paddingRight: '0px',
22
- },
23
- formControl: {
24
- position: 'initial',
25
- },
26
- inputLabel: {
27
- paddingBottom: theme.spacing.unit,
28
- },
29
- });
13
+ const StyledRoot = styled('div')(() => ({
14
+ flexDirection: 'column',
15
+ alignItems: 'start',
16
+ display: 'flex',
17
+ position: 'relative',
18
+ paddingTop: '0px',
19
+ paddingRight: '0px',
20
+ }));
30
21
 
31
- export class RawLangs extends React.Component {
22
+ const StyledFormControl = styled(FormControl)(() => ({
23
+ position: 'initial',
24
+ }));
25
+
26
+ const StyledInputLabel = styled(InputLabel)(({ theme }) => ({
27
+ paddingBottom: theme.spacing(1),
28
+ }));
29
+
30
+ export class Langs extends React.Component {
32
31
  static propTypes = {
33
32
  onChange: PropTypes.func,
34
33
  langs: PropTypes.array,
35
34
  selected: PropTypes.string,
36
35
  label: PropTypes.string,
37
- classes: PropTypes.object.isRequired,
38
36
  uid: PropTypes.string,
39
37
  };
40
38
 
@@ -52,16 +50,16 @@ export class RawLangs extends React.Component {
52
50
  };
53
51
 
54
52
  render() {
55
- let { langs, selected, label, classes } = this.props;
53
+ let { langs, selected, label } = this.props;
56
54
 
57
55
  log('[render] selected:', selected);
58
56
 
59
57
  return (
60
- <div className={classes.root}>
61
- <FormControl className={classes.formControl}>
62
- <InputLabel className={classes.inputLabel} htmlFor={this.uid}>
58
+ <StyledRoot>
59
+ <StyledFormControl>
60
+ <StyledInputLabel htmlFor={this.uid}>
63
61
  {label}
64
- </InputLabel>
62
+ </StyledInputLabel>
65
63
 
66
64
  <Select value={selected} onChange={this.choose} input={<Input id={this.uid} />}>
67
65
  {langs.map((l, index) => (
@@ -70,27 +68,23 @@ export class RawLangs extends React.Component {
70
68
  </MenuItem>
71
69
  ))}
72
70
  </Select>
73
- </FormControl>
74
- </div>
71
+ </StyledFormControl>
72
+ </StyledRoot>
75
73
  );
76
74
  }
77
75
  }
78
-
79
- const Langs = withStyles(styles, { name: 'Langs' })(RawLangs);
80
76
  export default Langs;
81
77
 
82
- export const LanguageControls = withStyles({
83
- languageControls: {
84
- display: 'grid',
85
- gridAutoFlow: 'column',
86
- gridAutoColumns: '1fr',
87
- gridGap: '8px',
88
- },
89
- })(({ classes, langs, activeLang, defaultLang, onActiveLangChange, onDefaultLangChange, className }) => {
90
- const names = classNames(classes.languageControls, className);
78
+ const StyledLanguageControls = styled('div')(() => ({
79
+ display: 'grid',
80
+ gridAutoFlow: 'column',
81
+ gridAutoColumns: '1fr',
82
+ gridGap: '8px',
83
+ }));
91
84
 
85
+ export const LanguageControls = ({ langs, activeLang, defaultLang, onActiveLangChange, onDefaultLangChange, className }) => {
92
86
  return (
93
- <div className={names}>
87
+ <StyledLanguageControls className={className}>
94
88
  <Langs
95
89
  label="Choose language to edit"
96
90
  langs={langs}
@@ -98,9 +92,9 @@ export const LanguageControls = withStyles({
98
92
  onChange={(l) => onActiveLangChange(l)}
99
93
  />
100
94
  <Langs label="Default language" langs={langs} selected={defaultLang} onChange={(l) => onDefaultLangChange(l)} />
101
- </div>
95
+ </StyledLanguageControls>
102
96
  );
103
- });
97
+ };
104
98
 
105
99
  LanguageControls.propTypes = {
106
100
  langs: PropTypes.array,
@@ -108,4 +102,5 @@ LanguageControls.propTypes = {
108
102
  defaultLang: PropTypes.string.isRequired,
109
103
  onActiveLangChange: PropTypes.func.isRequired,
110
104
  onDefaultLangChange: PropTypes.func.isRequired,
105
+ className: PropTypes.string,
111
106
  };
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+ import { render, screen, waitFor } from '@testing-library/react';
3
+ import ConfigLayout from '../config-layout';
4
+
5
+ describe('ConfigLayout', () => {
6
+ const settingsPanel = (
7
+ <div data-testid="settings-panel">
8
+ <div key={0}>Foo</div>
9
+ <div key={1}>Bar</div>
10
+ </div>
11
+ );
12
+
13
+ const children = (
14
+ <div data-testid="main-content">
15
+ <div>Foo</div>
16
+ <div>Bar</div>
17
+ </div>
18
+ );
19
+
20
+ describe('rendering', () => {
21
+ it('renders correctly with settings panel', async () => {
22
+ render(<ConfigLayout settings={settingsPanel}>{children}</ConfigLayout>);
23
+
24
+ // Main content should render immediately
25
+ expect(screen.getByTestId('main-content')).toBeInTheDocument();
26
+
27
+ // Settings panel may render after layout calculation
28
+ // In test environment, react-measure may not provide dimensions,
29
+ // so we check if it exists but don't require it
30
+ await waitFor(() => {
31
+ expect(screen.getByText('Foo')).toBeInTheDocument();
32
+ });
33
+ });
34
+
35
+ it('renders main content when provided', () => {
36
+ render(<ConfigLayout settings={settingsPanel}>{children}</ConfigLayout>);
37
+
38
+ expect(screen.getByTestId('main-content')).toBeInTheDocument();
39
+ expect(screen.getByText('Foo')).toBeInTheDocument();
40
+ // Only check that Bar appears at least once (in main content)
41
+ expect(screen.getAllByText('Bar').length).toBeGreaterThanOrEqual(1);
42
+ });
43
+
44
+ it('renders settings panel content', () => {
45
+ render(<ConfigLayout settings={settingsPanel}>{children}</ConfigLayout>);
46
+
47
+ // Settings panel might not render in test environment due to react-measure
48
+ // Just verify the component renders without crashing
49
+ expect(screen.getByTestId('main-content')).toBeInTheDocument();
50
+ });
51
+
52
+ it('renders without settings panel when not provided', () => {
53
+ render(<ConfigLayout>{children}</ConfigLayout>);
54
+
55
+ expect(screen.queryByTestId('settings-panel')).not.toBeInTheDocument();
56
+ expect(screen.getByTestId('main-content')).toBeInTheDocument();
57
+ });
58
+ });
59
+ });
@@ -0,0 +1,3 @@
1
+ describe('layout-content', () => {
2
+ it.todo('add tests!');
3
+ });
@@ -1,15 +1,35 @@
1
1
  import React from 'react';
2
2
  import Measure from 'react-measure';
3
+ import { createTheme, ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
3
4
  import { withContentRect } from 'react-measure';
4
5
  import PropTypes from 'prop-types';
5
6
  import LayoutContents from './layout-contents';
6
7
  import SettingsBox from './settings-box';
8
+ import { AppendCSSRules } from '@pie-lib/render-ui';
7
9
 
8
- class MeasuredConfigLayout extends React.Component {
10
+ const theme = createTheme({
11
+ typography: {
12
+ fontFamily: 'inherit',
13
+ },
14
+ components: {
15
+ MuiButton: {
16
+ styleOverrides: {
17
+ contained: {
18
+ backgroundColor: '#e0e0e0',
19
+ color: '#000000',
20
+ '&:hover': {
21
+ backgroundColor: '#bdbdbd',
22
+ },
23
+ },
24
+ },
25
+ },
26
+ },
27
+ });
28
+
29
+ class MeasuredConfigLayout extends AppendCSSRules {
9
30
  static propTypes = {
10
31
  children: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.element), PropTypes.element]),
11
32
  className: PropTypes.string,
12
- classes: PropTypes.object,
13
33
  dimensions: PropTypes.object,
14
34
  settings: PropTypes.element,
15
35
  sidePanelMinWidth: PropTypes.number,
@@ -17,13 +37,13 @@ class MeasuredConfigLayout extends React.Component {
17
37
  };
18
38
 
19
39
  static defaultProps = {
20
- sidePanelMinWidth: 950,
40
+ sidePanelMinWidth: 1135,
21
41
  hideSettings: false,
22
42
  dimensions: {},
23
43
  };
24
44
 
25
- constructor(props) {
26
- super(props);
45
+ constructor(...props) {
46
+ super(...props);
27
47
  this.state = { layoutMode: undefined };
28
48
  }
29
49
 
@@ -33,31 +53,41 @@ class MeasuredConfigLayout extends React.Component {
33
53
  const { maxWidth } = dimensions || {};
34
54
 
35
55
  const layoutMode =
36
- bounds.width >= sidePanelMinWidth && (maxWidth ? maxWidth >= sidePanelMinWidth : true) ? 'inline' : 'tabbed';
56
+ bounds.width > sidePanelMinWidth && (maxWidth ? maxWidth > sidePanelMinWidth : true) ? 'inline' : 'tabbed';
37
57
 
38
- this.setState({ layoutMode });
58
+ // Only update state (and cause a re-render) if the computed layoutMode changed.
59
+ if (layoutMode !== this.state.layoutMode) {
60
+ this.setState({ layoutMode });
61
+ }
39
62
  };
40
63
 
41
64
  render() {
42
65
  return (
43
- <Measure bounds onResize={this.onResize}>
44
- {({ measureRef }) => {
45
- const { children, settings, hideSettings, dimensions } = this.props;
46
- const { layoutMode } = this.state;
66
+ // TODO: REVIEW MuiThemeProvider usage - is this still needed after mui update?
67
+ // Different theme object identities will force theme consumers to re-render.
68
+ <StyledEngineProvider injectFirst>
69
+ <ThemeProvider theme={theme}>
70
+ <Measure bounds onResize={this.onResize}>
71
+ {({ measureRef }) => {
72
+ const { children, settings, hideSettings, dimensions } = this.props;
73
+ const { layoutMode } = this.state;
47
74
 
48
- const settingsPanel =
49
- layoutMode === 'inline' ? <SettingsBox className="settings-box">{settings}</SettingsBox> : settings;
50
- const secondaryContent = hideSettings ? null : settingsPanel;
75
+ const settingsPanel =
76
+ layoutMode === 'inline' ? <SettingsBox className="settings-box">{settings}</SettingsBox> : settings;
77
+ const secondaryContent = hideSettings ? null : settingsPanel;
78
+ const finalClass = 'main-container';
51
79
 
52
- return (
53
- <div ref={measureRef} className="main-container">
54
- <LayoutContents mode={layoutMode} secondary={secondaryContent} dimensions={dimensions}>
55
- {children}
56
- </LayoutContents>
57
- </div>
58
- );
59
- }}
60
- </Measure>
80
+ return (
81
+ <div ref={measureRef} className={finalClass}>
82
+ <LayoutContents mode={layoutMode} secondary={secondaryContent} dimensions={dimensions}>
83
+ {children}
84
+ </LayoutContents>
85
+ </div>
86
+ );
87
+ }}
88
+ </Measure>
89
+ </ThemeProvider>
90
+ </StyledEngineProvider>
61
91
  );
62
92
  }
63
93
  }
@@ -1,16 +1,36 @@
1
1
  import React from 'react';
2
- import classnames from 'classnames';
3
2
  import PropTypes from 'prop-types';
4
- import { withStyles } from '@material-ui/core';
3
+ import { styled } from '@mui/material/styles';
5
4
  import Tabs from '../tabs';
6
- import classNames from 'classnames';
5
+
6
+ const StyledContainer = styled('div')(() => ({
7
+ display: 'flex',
8
+ flexDirection: 'column',
9
+ position: 'relative',
10
+ }));
11
+
12
+ const StyledFlow = styled('div')(() => ({
13
+ display: 'flex',
14
+ justifyContent: 'space-between',
15
+ }));
16
+
17
+ const StyledContentContainer = styled('div')(({ theme }) => ({
18
+ padding: `${theme.spacing(2)} 0`,
19
+ }));
20
+
21
+ const StyledConfigContainer = styled('div')(() => ({
22
+ flex: '1',
23
+ }));
24
+
25
+ const StyledSettingsContainer = styled('div')(({ theme }) => ({
26
+ marginLeft: theme.spacing(2),
27
+ }));
7
28
 
8
29
  class RawLayoutContents extends React.Component {
9
30
  static propTypes = {
10
31
  mode: PropTypes.oneOf(['tabbed', 'inline']),
11
32
  secondary: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
12
33
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
13
- classes: PropTypes.object,
14
34
  dimensions: PropTypes.object,
15
35
  };
16
36
 
@@ -47,7 +67,7 @@ class RawLayoutContents extends React.Component {
47
67
  // }
48
68
 
49
69
  render() {
50
- const { mode, secondary, children, classes, dimensions } = this.props;
70
+ const { mode, secondary, children, dimensions } = this.props;
51
71
  const { minHeight, minWidth, maxHeight, maxWidth } = dimensions || {};
52
72
  const configuration = this.getConfiguration();
53
73
 
@@ -65,55 +85,33 @@ class RawLayoutContents extends React.Component {
65
85
  }
66
86
 
67
87
  return (
68
- <div className={classes.container} style={{ minHeight, minWidth, maxHeight, maxWidth }}>
88
+ <StyledContainer style={{ minHeight, minWidth, maxHeight, maxWidth }}>
69
89
  {mode === 'inline' && (
70
- <div className={classnames(classes.flow, classes.contentContainer)}>
71
- <div className={classnames(classes.configContainer, 'design-container')}>{children}</div>
90
+ <StyledFlow>
91
+ <StyledConfigContainer className="design-container">{children}</StyledConfigContainer>
72
92
  {hasSettingsPanel && (
73
- <div className={classnames(classes.settingsContainer, 'settings-container')}>{secondary}</div>
93
+ <StyledSettingsContainer className="settings-container">{secondary}</StyledSettingsContainer>
74
94
  )}
75
- </div>
95
+ </StyledFlow>
76
96
  )}
77
97
 
78
98
  {mode === 'tabbed' && hasSettingsPanel && (
79
- <Tabs onChange={this.onTabsChange} contentClassName={classes.contentContainer} indicatorColor="primary">
80
- <div title="Design" className="design-container">
99
+ <Tabs onChange={this.onTabsChange} contentClassName="content-container" indicatorColor="primary">
100
+ <StyledContentContainer title="Design" className="design-container">
81
101
  {children}
82
- </div>
83
- <div title="Settings" className="settings-container">
102
+ </StyledContentContainer>
103
+ <StyledContentContainer title="Settings" className="settings-container">
84
104
  {secondary}
85
- </div>
105
+ </StyledContentContainer>
86
106
  </Tabs>
87
107
  )}
88
108
 
89
109
  {mode === 'tabbed' && !hasSettingsPanel && (
90
- <div className={classNames(classes.contentContainer, 'design-container')}>{children}</div>
110
+ <StyledContentContainer className="design-container">{children}</StyledContentContainer>
91
111
  )}
92
- </div>
112
+ </StyledContainer>
93
113
  );
94
114
  }
95
115
  }
96
116
 
97
- const styles = (theme) => ({
98
- flow: {
99
- display: 'flex',
100
- justifyContent: 'space-between',
101
- },
102
- container: {
103
- display: 'flex',
104
- flexDirection: 'column',
105
- position: 'relative',
106
- overflow: 'auto',
107
- },
108
- contentContainer: {
109
- padding: `${theme.spacing.unit * 2}px 0`,
110
- },
111
- configContainer: {
112
- flex: '1',
113
- },
114
- settingsContainer: {
115
- marginLeft: theme.spacing.unit * 2,
116
- },
117
- });
118
-
119
- export default withStyles(styles)(RawLayoutContents);
117
+ export default RawLayoutContents;
@@ -1,11 +1,21 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withStyles } from '@material-ui/core/styles';
4
- import classNames from 'classnames';
3
+ import { styled } from '@mui/material/styles';
4
+
5
+ const StyledSettingsBox = styled('div')(({ theme }) => ({
6
+ backgroundColor: theme.palette.background.paper,
7
+ border: `2px solid ${theme.palette.grey[200]}`,
8
+ display: 'flex',
9
+ flexDirection: 'column',
10
+ justifyContent: 'flex-start',
11
+ minWidth: '275px',
12
+ maxWidth: '300px',
13
+ padding: '20px 4px 4px 20px',
14
+ zIndex: 99,
15
+ }));
5
16
 
6
17
  export class SettingsBox extends React.Component {
7
18
  static propTypes = {
8
- classes: PropTypes.object.isRequired,
9
19
  className: PropTypes.string,
10
20
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
11
21
  };
@@ -13,23 +23,10 @@ export class SettingsBox extends React.Component {
13
23
  static defaultProps = {};
14
24
 
15
25
  render() {
16
- const { classes, className, children } = this.props;
26
+ const { className, children } = this.props;
17
27
 
18
- return <div className={classNames(classes.settingsBox, className)}>{children}</div>;
28
+ return <StyledSettingsBox className={className}>{children}</StyledSettingsBox>;
19
29
  }
20
30
  }
21
- const styles = (theme) => ({
22
- settingsBox: {
23
- backgroundColor: theme.palette.background.paper,
24
- border: `2px solid ${theme.palette.grey[200]}`,
25
- display: 'flex',
26
- flexDirection: 'column',
27
- justifyContent: 'flex-start',
28
- minWidth: '275px',
29
- maxWidth: '300px',
30
- padding: '20px 4px 4px 20px',
31
- zIndex: 99,
32
- },
33
- });
34
31
 
35
- export default withStyles(styles)(SettingsBox);
32
+ export default SettingsBox;
@@ -1,61 +1,53 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withStyles } from '@material-ui/core/styles';
3
+ import { styled } from '@mui/material/styles';
4
4
  import debug from 'debug';
5
- import classNames from 'classnames';
6
5
 
7
6
  const log = debug('pie-elements:config-ui:mui-box');
8
7
 
9
- const MuiBox = withStyles((theme) => {
10
- const light = theme.palette.type === 'light';
8
+ const StyledMuiBox = styled('div')(({ theme, focused }) => {
9
+ const light = theme.palette.mode === 'light';
11
10
  const bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
12
11
 
13
- log(theme.palette.primary[theme.palette.type || 'light']);
12
+ log(theme.palette.primary[theme.palette.mode || 'light']);
14
13
 
15
14
  return {
16
- muiBox: {
17
- paddingTop: theme.spacing.unit,
18
- paddingBottom: theme.spacing.unit,
19
- position: 'relative',
20
- '&:before': {
21
- left: 0,
22
- right: 0,
23
- bottom: 0,
24
- height: '1px',
25
- content: '""',
26
- position: 'absolute',
27
- transition: 'background-color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
28
- pointerEvents: 'none',
29
- backgroundColor: bottomLineColor,
30
- },
31
- '&:hover:before': {
32
- height: '2px',
33
- },
34
- '&:after': {
35
- left: 0,
36
- right: 0,
37
- bottom: 0,
38
- height: '2px',
39
- content: '""',
40
- position: 'absolute',
41
- transform: 'scaleX(0)',
42
- transition: 'transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms',
43
- pointerEvents: 'none',
44
- backgroundColor: theme.palette.primary[theme.palette.type], //'#304ffe'
45
- },
15
+ paddingTop: theme.spacing(1),
16
+ paddingBottom: theme.spacing(1),
17
+ position: 'relative',
18
+ '&:before': {
19
+ left: 0,
20
+ right: 0,
21
+ bottom: 0,
22
+ height: '1px',
23
+ content: '""',
24
+ position: 'absolute',
25
+ transition: 'background-color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
26
+ pointerEvents: 'none',
27
+ backgroundColor: bottomLineColor,
46
28
  },
47
- focused: {
48
- '&:after': {
49
- transform: 'scaleX(1)',
50
- },
29
+ '&:hover:before': {
30
+ height: '2px',
31
+ },
32
+ '&:after': {
33
+ left: 0,
34
+ right: 0,
35
+ bottom: 0,
36
+ height: '2px',
37
+ content: '""',
38
+ position: 'absolute',
39
+ transform: focused ? 'scaleX(1)' : 'scaleX(0)',
40
+ transition: 'transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms',
41
+ pointerEvents: 'none',
42
+ backgroundColor: theme.palette.primary[theme.palette.mode], //'#304ffe'
51
43
  },
52
44
  };
53
- })(({ children, classes, focused }) => {
54
- const names = classNames(classes.muiBox, focused && classes.focused);
55
-
56
- return <div className={names}>{children}</div>;
57
45
  });
58
46
 
47
+ const MuiBox = ({ children, focused }) => {
48
+ return <StyledMuiBox focused={focused}>{children}</StyledMuiBox>;
49
+ };
50
+
59
51
  MuiBox.propTypes = {
60
52
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
61
53
  focused: PropTypes.bool.isRequired,