Skip to content

Commit 5bcb574

Browse files
FredLL-AvaigaFred Lefévère-Laoide
andauthored
Upgrade to Material UI 9 (#2874)
* Upgrade to Material UI 9 Fixes #2873 * fix class change * fix class change * fix class change * fix class change to attribute * fix class change * copilot finds selected attribute * Fab's comment --------- Co-authored-by: Fred Lefévère-Laoide <Fred.Lefevere-Laoide@Taipy.io>
1 parent c7732e1 commit 5bcb574

28 files changed

Lines changed: 837 additions & 711 deletions

frontend/taipy-gui/dom/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/taipy-gui/package-lock.json

Lines changed: 364 additions & 331 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/taipy-gui/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"dependencies": {
66
"@emotion/react": "^11.10.0",
77
"@emotion/styled": "^11.10.0",
8-
"@mui/icons-material": "^7.1.0",
9-
"@mui/material": "^7.1.0",
10-
"@mui/x-date-pickers": "^8.3.0",
11-
"@mui/x-tree-view": "^8.3.0",
8+
"@mui/icons-material": "^9.0.1",
9+
"@mui/material": "^9.0.1",
10+
"@mui/x-date-pickers": "^9.0.4",
11+
"@mui/x-tree-view": "^9.0.4",
1212
"apache-arrow": "^16.1.0",
1313
"axios": "^1.2.0",
1414
"better-react-mathjax": "^3.0.0",

frontend/taipy-gui/src/components/Taipy/Alert.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ describe("TaipyAlert Component", () => {
2121
const { getByRole } = render(<TaipyAlert message="Default Alert" />);
2222
const alert = getByRole("alert");
2323
expect(alert).toBeInTheDocument();
24-
expect(alert).toHaveClass("MuiAlert-filledError");
24+
expect(alert).toHaveClass("MuiAlert-colorError");
2525
});
2626

2727
it("applies the correct severity", () => {
2828
const { getByRole } = render(<TaipyAlert message="Warning Alert" severity="warning" />);
2929
const alert = getByRole("alert");
3030
expect(alert).toBeInTheDocument();
31-
expect(alert).toHaveClass("MuiAlert-filledWarning");
31+
expect(alert).toHaveClass("MuiAlert-colorWarning");
3232
});
3333

3434
it("applies the correct variant", () => {
3535
const { getByRole } = render(<TaipyAlert message="Outlined Alert" variant="outlined" />);
3636
const alert = getByRole("alert");
3737
expect(alert).toBeInTheDocument();
38-
expect(alert).toHaveClass("MuiAlert-outlinedError");
38+
expect(alert).toHaveClass("MuiAlert-outlined");
3939
});
4040

4141
it("does not render if render prop is false", () => {

frontend/taipy-gui/src/components/Taipy/Button.spec.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ describe("Button Component", () => {
7474
const elt = getByRole("button");
7575
expect(elt).toBeInTheDocument();
7676
expect(elt).toHaveClass("MuiButton-sizeMedium");
77-
expect(elt).toHaveClass("MuiButton-outlinedPrimary");
77+
expect(elt).toHaveClass("MuiButton-outlined");
78+
expect(elt).toHaveClass("MuiButton-colorPrimary");
7879
});
7980
it("applies correct size", () => {
8081
const { getByRole } = render(<Button label="val" size="large" />);
@@ -86,7 +87,8 @@ describe("Button Component", () => {
8687
const { getByRole } = render(<Button label="val" variant="text" />);
8788
const elt = getByRole("button");
8889
expect(elt).toBeInTheDocument();
89-
expect(elt).toHaveClass("MuiButton-textPrimary");
90+
expect(elt).toHaveClass("MuiButton-text");
91+
expect(elt).toHaveClass("MuiButton-colorPrimary");
9092
});
9193
it("dispatch a well formed message", async () => {
9294
const dispatch = jest.fn();

frontend/taipy-gui/src/components/Taipy/Chat.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,17 @@ const ChatRow = (props: ChatRowProps) => {
170170
container
171171
className={getSuffixedClassNames(className, sender ? "-sent" : "-received")}
172172
size={12}
173-
sx={noAnchorSx}
174-
justifyContent={sender ? "flex-end" : undefined}
173+
sx={sender ? { ...noAnchorSx, justifyContent: "flex-end" } : noAnchorSx}
174+
175175
>
176176
<Grid sx={sender ? senderMsgSx : undefined}>
177177
{image ? (
178-
<Grid container justifyContent={sender ? "flex-end" : undefined}>
178+
<Grid container sx={sender ? { justifyContent: "flex-end" } : undefined}>
179179
<Box component="img" sx={imageSx} alt="Uploaded image" src={image} />
180180
</Grid>
181181
) : null}
182182
{(!sender || showSender) && avatar ? (
183-
<Stack direction="row" gap={1} justifyContent={sender ? "flex-end" : undefined}>
183+
<Stack direction="row" sx={{ gap: 1, justifyContent: sender ? "flex-end" : undefined }}>
184184
{!sender ? <Box sx={avatarColSx}>{avatar}</Box> : null}
185185
<Stack>
186186
<Box sx={sender ? rightNameSx : leftNameSx}>{name}</Box>
@@ -549,7 +549,7 @@ const Chat = (props: ChatProps) => {
549549
{withInput ? (
550550
<>
551551
{imagePreview && (
552-
<Box mb={1}>
552+
<Box sx={{ mb: 1 }}>
553553
<Chip
554554
label={selectedFile?.name}
555555
avatar={<Avatar alt="Image preview" src={imagePreview} />}

frontend/taipy-gui/src/components/Taipy/DateRange.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ interface DateRangeProps extends TaipyActiveProps, TaipyChangeProps {
4444
analogic?: boolean;
4545
}
4646

47-
const textFieldProps = { textField: { margin: "dense" } } as DateTimePickerSlotProps<boolean>;
47+
const textFieldProps = { textField: { margin: "dense" } } as DateTimePickerSlotProps;
4848

4949
const getRangeDateTime = (
5050
json: string | string[] | undefined,
@@ -142,11 +142,7 @@ const DateRange = (props: DateRangeProps) => {
142142
<Stack
143143
id={id}
144144
className={`${className} ${getComponentClassName(props.children)}`}
145-
gap={0.5}
146-
direction="row"
147-
display="inline-flex"
148-
alignItems="center"
149-
width={props.width ? getCssSize(props.width) : undefined}
145+
sx={{ display: "inline-flex", alignItems: "center", gap: 0.5, width: props.width ? getCssSize(props.width) : undefined }}
150146
>
151147
{editable ? (
152148
withTime ? (

frontend/taipy-gui/src/components/Taipy/DateSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ interface DateSelectorProps extends TaipyActiveProps, TaipyChangeProps {
5050
}
5151

5252
const boxSx = { display: "inline-block" };
53-
const textFieldProps = { textField: { margin: "dense" } } as DateTimePickerSlotProps<boolean>;
53+
const textFieldProps = { textField: { margin: "dense" } } as DateTimePickerSlotProps;
5454

5555
const analogicRenderers = {
5656
hours: renderTimeViewClock,

frontend/taipy-gui/src/components/Taipy/Dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const Dialog = (props: DialogProps) => {
161161
onClose={handleAction}
162162
open={open === undefined ? defaultOpen === "true" || defaultOpen === true : !!open}
163163
className={`${className} ${getComponentClassName(props.children)}`}
164-
PaperProps={paperProps}
164+
slotProps={{ paper: paperProps }}
165165
>
166166
<Tooltip title={hover || ""}>
167167
<DialogTitle sx={titleSx}>

frontend/taipy-gui/src/components/Taipy/Input.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe("Input Component", () => {
6868
const { getByRole } = render(<Input value="val" type="text" size="small" />);
6969
const elt = getByRole("textbox");
7070
expect(elt).toBeInTheDocument();
71-
expect(elt).toHaveClass("MuiInputBase-inputSizeSmall");
71+
expect(elt.parentElement).toHaveClass("MuiInputBase-sizeSmall");
7272
});
7373
it("dispatch a well formed message", async () => {
7474
const dispatch = jest.fn();

0 commit comments

Comments
 (0)