Skip to content

Commit 3173e2e

Browse files
authored
fix: theme import issues (#495)
1 parent bf82375 commit 3173e2e

File tree

5 files changed

+29
-31
lines changed

5 files changed

+29
-31
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pega/react-sdk-components",
3-
"version": "0.25.2",
3+
"version": "0.25.4",
44
"description": "React SDK packaging: bridge and components, overrides",
55
"main": "index.ts",
66
"scripts": {

packages/react-sdk-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pega/react-sdk-components",
3-
"version": "0.25.2",
3+
"version": "0.25.4",
44
"description": "React SDK Infrastructure: bridge and components",
55
"_filesComment": "During packing, npm ignores everything NOT in the files list",
66
"files": [

packages/react-sdk-components/src/components/designSystemExtension/RichTextEditor/RichTextEditor.tsx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import React, { forwardRef } from 'react';
22
import { Editor } from '@tinymce/tinymce-react';
3-
import { FormControl, FormHelperText, InputLabel } from '@mui/material';
3+
import { FormControl, FormHelperText, InputLabel, useTheme } from '@mui/material';
44
import makeStyles from '@mui/styles/makeStyles';
55

66
import { useAfterInitialEffect, useConsolidatedRef, useUID } from '../../../hooks';
7-
import { theme } from '../../../theme';
87

9-
const useStyles = makeStyles(() => ({
8+
const useStyles = makeStyles(theme => ({
109
fieldLabel: {
1110
position: 'relative',
1211
transform: 'translate(0, 0px) scale(1)',
@@ -32,6 +31,7 @@ interface RichTextEditorProps {
3231
}
3332

3433
const RichTextEditor = forwardRef(function RichTextEditor(props: RichTextEditorProps, ref) {
34+
const theme = useTheme();
3535
const classes = useStyles();
3636
const uid = useUID();
3737
const { id = uid, defaultValue, label, labelHidden, info, testId, placeholder, disabled, required, readOnly, error, onBlur, onChange } = props;
@@ -91,27 +91,27 @@ const RichTextEditor = forwardRef(function RichTextEditor(props: RichTextEditorP
9191
skin: 'oxide-dark', // or 'oxide' for light theme
9292
// ...other TinyMCE config...
9393
content_style: `
94-
body {
95-
font-family: ${theme.typography.fontFamily};
96-
font-size: ${theme.typography.fontSize}px;
97-
color: ${theme.palette.text.primary};
98-
background: ${theme.palette.background.paper};
99-
}
100-
a { color: ${theme.palette.primary.main}; }
101-
h1, h2, h3, h4, h5, h6 { color: ${theme.palette.text.primary}; font-family: ${theme.typography.fontFamily}; }
102-
blockquote { color: ${theme.palette.text.secondary}; border-left: 4px solid ${theme.palette.primary.light}; padding-left: 8px; }
103-
ul, ol { color: ${theme.palette.text.primary}; }
104-
input, textarea, select {
105-
background: ${theme.palette.background.paper};
106-
color: ${theme.palette.text.primary};
107-
border: 1px solid ${theme.palette.divider};
108-
border-radius: 4px;
109-
padding: 6px 10px;
110-
font-size: 1em;
111-
font-family: inherit;
112-
}
113-
/* Add more styles as needed */
114-
`,
94+
body {
95+
font-family: ${theme.typography.fontFamily};
96+
font-size: ${theme.typography.fontSize}px;
97+
color: ${theme.palette.text.primary};
98+
background: ${theme.palette.background.paper};
99+
}
100+
a { color: ${theme.palette.primary.main}; }
101+
h1, h2, h3, h4, h5, h6 { color: ${theme.palette.text.primary}; font-family: ${theme.typography.fontFamily}; }
102+
blockquote { color: ${theme.palette.text.secondary}; border-left: 4px solid ${theme.palette.primary.light}; padding-left: 8px; }
103+
ul, ol { color: ${theme.palette.text.primary}; }
104+
input, textarea, select {
105+
background: ${theme.palette.background.paper};
106+
color: ${theme.palette.text.primary};
107+
border: 1px solid ${theme.palette.divider};
108+
border-radius: 4px;
109+
padding: 6px 10px;
110+
font-size: 1em;
111+
font-family: inherit;
112+
}
113+
/* Add more styles as needed */
114+
`,
115115
placeholder,
116116
menubar: false,
117117
statusbar: false,

packages/react-sdk-components/src/theme.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// @ts-nocheck
22
import { createTheme } from '@mui/material';
3-
import { Theme } from '@mui/material/styles';
3+
import type { Theme } from '@mui/material/styles';
44

5-
import { getSdkConfig } from '@pega/auth/lib/sdk-auth-manager';
5+
import sdkConfig from '../../../sdk-config.json';
66

77
/**
88
* Since makeStyles is now exported from @mui/styles package which does not know about Theme in the core package.
@@ -257,6 +257,4 @@ const darkTheme = createTheme({
257257
}
258258
});
259259

260-
const sdkConfig = await getSdkConfig();
261-
262260
export const theme = sdkConfig.theme === 'dark' ? darkTheme : lightTheme;

packages/react-sdk-overrides/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pega/react-sdk-overrides",
3-
"version": "0.25.2",
3+
"version": "0.25.4",
44
"description": "React SDK - Code for overriding components",
55
"_filesComment": "During packing, npm ignores everything NOT in the files list",
66
"files": [

0 commit comments

Comments
 (0)