Skip to content

Commit 99b638b

Browse files
upgrade mui to 7
Signed-off-by: Rajesh-Nagarajan-11 <rajeshnagarajan36@gmail.com>
1 parent b83cc0e commit 99b638b

File tree

12 files changed

+178
-77
lines changed

12 files changed

+178
-77
lines changed

package-lock.json

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

package.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@
77
"url": "git+ssh://git@github.com/layer5io/sistent.git"
88
},
99
"main": "./dist/index.js",
10-
"module": "./dist/index.js",
10+
"module": "./dist/index.mjs",
1111
"types": "./dist/index.d.ts",
12+
"exports": {
13+
".": {
14+
"types": "./dist/index.d.ts",
15+
"import": "./dist/index.mjs",
16+
"require": "./dist/index.js",
17+
"default": "./dist/index.js"
18+
}
19+
},
1220
"files": [
1321
"dist"
1422
],
@@ -47,7 +55,7 @@
4755
"@eslint/eslintrc": "^3.3.1",
4856
"@eslint/js": "^9.39.2",
4957
"@meshery/schemas": "^0.8.124",
50-
"@mui/icons-material": "^6.4.8",
58+
"@mui/icons-material": "^7.3.7",
5159
"@reduxjs/toolkit": "^2.2.5",
5260
"@testing-library/react": "^16.2.0",
5361
"@types/jest": "^29.5.14",
@@ -93,8 +101,8 @@
93101
"xstate": "^5.25.0"
94102
},
95103
"overrides": {
96-
"@mui/icons-material": "^6.4.8",
97-
"@mui/material": "^6.4.8",
104+
"@mui/icons-material": "^7.3.7",
105+
"@mui/material": "^7.3.7",
98106
"@meshery/schemas": {
99107
"react": "$react",
100108
"react-dom": "$react-dom"
@@ -115,7 +123,7 @@
115123
"@emotion/react": "^11.14.0",
116124
"@emotion/styled": "^11.14.0",
117125
"@layer5/meshery-design-embed": "^0.4.0",
118-
"@mui/material": "^6.4.8",
126+
"@mui/material": "^7.3.7",
119127
"@sistent/mui-datatables": "^5.1.4",
120128
"@types/mui-datatables": "*",
121129
"billboard.js": "^3.15.0",

src/base/Grid2/Grid2.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Grid2 as MuiGrid, Grid2Props as MuiGridProps } from '@mui/material';
1+
import { Grid, GridProps } from '@mui/material';
22
import React from 'react';
33

4-
const Grid2 = React.forwardRef<HTMLDivElement, MuiGridProps>((props, ref) => {
5-
return <MuiGrid {...props} ref={ref} />;
4+
const Grid2 = React.forwardRef<HTMLDivElement, GridProps>((props, ref) => {
5+
return <Grid {...props} ref={ref} />;
66
});
77

88
export { Grid2 };

src/base/Hidden/Hidden.tsx

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,85 @@
1-
import { Hidden as MuiHidden, HiddenProps as MuiHiddenProps } from '@mui/material';
1+
import { useMediaQuery, useTheme } from '@mui/material';
2+
import React from 'react';
23

3-
export const Hidden = (props: MuiHiddenProps) => {
4-
return <MuiHidden {...props} />;
4+
type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
5+
6+
export interface HiddenProps {
7+
children?: React.ReactNode;
8+
only?: Breakpoint | Breakpoint[];
9+
xsUp?: boolean;
10+
smUp?: boolean;
11+
mdUp?: boolean;
12+
lgUp?: boolean;
13+
xlUp?: boolean;
14+
xsDown?: boolean;
15+
smDown?: boolean;
16+
mdDown?: boolean;
17+
lgDown?: boolean;
18+
xlDown?: boolean;
19+
implementation?: 'js' | 'css';
20+
}
21+
22+
export const Hidden = ({
23+
children,
24+
only,
25+
xsUp = false,
26+
smUp = false,
27+
mdUp = false,
28+
lgUp = false,
29+
xlUp = false,
30+
xsDown = false,
31+
smDown = false,
32+
mdDown = false,
33+
lgDown = false,
34+
xlDown = false
35+
}: HiddenProps) => {
36+
const theme = useTheme();
37+
const onlyValues = Array.isArray(only) ? only : only ? [only] : [];
38+
39+
const xsOnly = useMediaQuery(theme.breakpoints.only('xs'));
40+
const smOnly = useMediaQuery(theme.breakpoints.only('sm'));
41+
const mdOnly = useMediaQuery(theme.breakpoints.only('md'));
42+
const lgOnly = useMediaQuery(theme.breakpoints.only('lg'));
43+
const xlOnly = useMediaQuery(theme.breakpoints.only('xl'));
44+
45+
const xsUpMatch = useMediaQuery(theme.breakpoints.up('xs'));
46+
const smUpMatch = useMediaQuery(theme.breakpoints.up('sm'));
47+
const mdUpMatch = useMediaQuery(theme.breakpoints.up('md'));
48+
const lgUpMatch = useMediaQuery(theme.breakpoints.up('lg'));
49+
const xlUpMatch = useMediaQuery(theme.breakpoints.up('xl'));
50+
51+
const xsDownMatch = useMediaQuery(theme.breakpoints.down('xs'));
52+
const smDownMatch = useMediaQuery(theme.breakpoints.down('sm'));
53+
const mdDownMatch = useMediaQuery(theme.breakpoints.down('md'));
54+
const lgDownMatch = useMediaQuery(theme.breakpoints.down('lg'));
55+
const xlDownMatch = useMediaQuery(theme.breakpoints.down('xl'));
56+
57+
const onlyMatches =
58+
(onlyValues.includes('xs') && xsOnly) ||
59+
(onlyValues.includes('sm') && smOnly) ||
60+
(onlyValues.includes('md') && mdOnly) ||
61+
(onlyValues.includes('lg') && lgOnly) ||
62+
(onlyValues.includes('xl') && xlOnly);
63+
64+
const upMatches =
65+
(xsUp && xsUpMatch) ||
66+
(smUp && smUpMatch) ||
67+
(mdUp && mdUpMatch) ||
68+
(lgUp && lgUpMatch) ||
69+
(xlUp && xlUpMatch);
70+
71+
const downMatches =
72+
(xsDown && xsDownMatch) ||
73+
(smDown && smDownMatch) ||
74+
(mdDown && mdDownMatch) ||
75+
(lgDown && lgDownMatch) ||
76+
(xlDown && xlDownMatch);
77+
78+
if (onlyMatches || upMatches || downMatches) {
79+
return null;
80+
}
81+
82+
return <>{children}</>;
583
};
684

785
export default Hidden;

src/custom/DashboardWidgets/GettingStartedWidget/GetStartedModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import { Grid2, SwipeableDrawer } from '@mui/material';
2+
import { Grid as Grid2, SwipeableDrawer } from '@mui/material';
33
import { useState } from 'react';
44
import {
55
Backdrop,

src/custom/InputSearchField/InputSearchField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Autocomplete, Grid2 } from '@mui/material';
1+
import { Autocomplete, Grid as Grid2 } from '@mui/material';
22
import React, { useCallback, useEffect, useState } from 'react';
33
import { Box, Chip, CircularProgress, TextField, Tooltip, Typography } from '../../base';
44

0 commit comments

Comments
 (0)