Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/mui v5 #270

Merged
merged 59 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
d9e9b60
start migrating the repo
bertearazvan Feb 16, 2022
66658ac
create MikeTypography
bertearazvan Feb 16, 2022
da77975
rename folders. add palette
bertearazvan Feb 17, 2022
d412767
fix a few first components
bertearazvan Feb 17, 2022
30b4dc9
CalendarItem styled
bertearazvan Feb 18, 2022
af2a4c9
adjust barlegend styles
bertearazvan Feb 18, 2022
1ad8d2d
progress on component migration
bertearazvan Feb 21, 2022
0addc8c
progress on component migration
bertearazvan Feb 21, 2022
31702c2
addjust Card, CatBarLegend, CollBox, GapBox to MUIv5
bertearazvan Feb 21, 2022
1eaf657
migrate Loader to mui 5
bertearazvan Feb 21, 2022
50c2faf
change subtitle color Card
bertearazvan Feb 21, 2022
cce0d6c
migrate LegendBase to MUIv5
bertearazvan Feb 22, 2022
8742338
migrate multifield
bertearazvan Feb 22, 2022
99272b9
migrate ResizeHandle to Mui.5
bertearazvan Feb 22, 2022
44b8de1
snackbar mui.5
bertearazvan Feb 22, 2022
aa9ed92
StaticLegend mui.5
bertearazvan Feb 22, 2022
d67155e
timestepPlayer mui.v5
bertearazvan Feb 23, 2022
54ef9f0
Merge branch 'master' of https://github.com/DHI/react-components into…
bertearazvan Feb 23, 2022
5d7d3d9
fix typography in theme
bertearazvan Feb 23, 2022
dfd8401
migrate theme story navbar mui.5
bertearazvan Feb 24, 2022
c2a32c6
fix styles further
bertearazvan Feb 28, 2022
84e9ae2
fix merge conf
bertearazvan Feb 28, 2022
72a27e2
further migrate theme overrides
bertearazvan Mar 1, 2022
ef47b6f
fix merge conf
bertearazvan Mar 1, 2022
1681b9e
update theme to Mui.5
bertearazvan Mar 1, 2022
bf5d5b4
update deprecated storybook import
bertearazvan Mar 1, 2022
7d9189a
perf(Material-UI v.5): Update the components and the theme to Materia…
bertearazvan Mar 1, 2022
e3fd5ce
fix linting
bertearazvan Mar 1, 2022
8c7ffdc
Update packages/react-components-lab/src/components/CalendarItem/Cale…
bertearazvan Mar 2, 2022
177934a
Update packages/react-components-lab/.storybook/preview.js
bertearazvan Mar 2, 2022
b6c80d7
commit dist folder so it can be shared
bertearazvan Apr 6, 2022
b626697
bump package
bertearazvan Apr 6, 2022
12800a4
accomodate theme to latest updates from mui4 main
bertearazvan Jun 9, 2022
a91a70a
update package version. fix themeProvider
bertearazvan Jun 9, 2022
36410d4
remove commiting dist
bertearazvan Jun 9, 2022
f8f8588
update deps and theme
bertearazvan Jun 29, 2022
70a2e65
update version
bertearazvan Jun 29, 2022
1d2018d
switch primary and secondary colors
bertearazvan Jul 1, 2022
554706f
Add splash screen component and everything for it
DenizYil Jul 12, 2022
a02f3aa
use logo svg instead of png
DenizYil Jul 12, 2022
0dbac6f
feat: add splash screen (#319)
DenizYil Jul 12, 2022
90088ed
remove dhi logo file and use url. Publish new version
bertearazvan Jul 12, 2022
c0dd057
add margin to splash screen, change dhi log to url, and make image/bu…
DenizYil Jul 12, 2022
3b06d55
Merge branch 'feature/mui-v5' into tweak/splash-screen
DenizYil Jul 12, 2022
40e5811
Merge pull request #321 from DenizYil/tweak/splash-screen
DenizYil Jul 12, 2022
b324182
release mui5 version 3.3 with splash screen improvements
DenizYil Jul 12, 2022
06a44d3
fix merge conf with version
bertearazvan Jul 21, 2022
e33a52e
remove static dhi logo
bertearazvan Jul 21, 2022
395fcd1
remove unused imports
bertearazvan Jul 21, 2022
fbb502f
merge main and fix conflicts with mui5. Reinstall deps, update lock.
bertearazvan Jul 21, 2022
080f6e2
fix workflow name and docs
bertearazvan Jul 21, 2022
335e676
Merge branch 'master' into feature/mui-v5
DenizYil Jul 21, 2022
290d584
update icons to use mui 5
DenizYil Jul 21, 2022
d89b8af
improve dev start script
bertearazvan Jul 22, 2022
32dab56
fix compile error. Update packages versions and deps
bertearazvan Jul 22, 2022
0caa7d5
fix types and linting errors
bertearazvan Jul 22, 2022
07ed67f
update peer deps for mui
bertearazvan Jul 22, 2022
908557b
upload peerDependencies version
bertearazvan Jul 22, 2022
2da2b84
update peerDeps
bertearazvan Jul 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI - lab
name: CI - lab&icons
on:
push:
branches:
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# DHI | React Components
[![CI - icons](https://github.com/DHI/react-components/actions/workflows/main-icons.yml/badge.svg)](https://github.com/DHI/react-components/actions/workflows/main-icons.yml)
[![CI - lab](https://github.com/DHI/react-components/actions/workflows/main-lab.yml/badge.svg)](https://github.com/DHI/react-components/actions/workflows/main-lab.yml)
[![CI - lab&icons](https://github.com/DHI/react-components/actions/workflows/main-lab-icons.yml/badge.svg)](https://github.com/DHI/react-components/actions/workflows/main-lab-icons.yml)
![CI - core](https://github.com/DHI/react-components/workflows/CI/badge.svg)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

Expand Down
8 changes: 4 additions & 4 deletions packages/icons/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.4.0",
"version": "2.0.0",
"license": "MIT",
"name": "@dhi/icons",
"author": "DHI",
Expand Down Expand Up @@ -27,8 +27,8 @@
"@types/react-dom": "^17.0.3"
},
"peerDependencies": {
"@material-ui/core": "^4.12.3",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"@mui/material": "~5",
"react": "~17 || ~18",
"react-dom": "~17 || ~18"
}
}
10 changes: 4 additions & 6 deletions packages/icons/utils/createSvgIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import SvgIcon from '@material-ui/core/SvgIcon';
import { SvgIcon } from '@mui/material';

export default function createSvgIcon(path, displayName): typeof SvgIcon {
const Component = (props, ref) => (
Expand All @@ -14,9 +14,7 @@ export default function createSvgIcon(path, displayName): typeof SvgIcon {
Component.displayName = `${displayName}Icon`;
}

Component.muiName = (SvgIcon as any).muiName;
Component.muiName = SvgIcon.muiName;

return React.memo(React.forwardRef(Component));
}


return React.memo(React.forwardRef(Component)) as any;
}
Empty file.
3 changes: 3 additions & 0 deletions packages/react-components-lab/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ module.exports = {
reactDocgen: 'react-docgen-typescript',
tsconfigPath: "./../tsconfig.json"
},
features: {
emotionAlias: false
}
}
4 changes: 3 additions & 1 deletion packages/react-components-lab/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ export const parameters = {
}

export const decorators = [(Story, context) => {
return <ThemeProvider type={useDarkMode() ? 'dark' : 'light'}><Story /></ThemeProvider>
const isDarkMode = useDarkMode()

return <ThemeProvider mode={isDarkMode ? 'dark' : 'light'}><Story /></ThemeProvider>
}]
21 changes: 11 additions & 10 deletions packages/react-components-lab/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.14.3",
"version": "2.0.0",
"license": "MIT",
"main": "dist/index.js",
"name": "@dhi/react-components-lab",
Expand All @@ -19,14 +19,15 @@
},
"scripts": {
"dev": "yarn sb",
"start": "../../node_modules/.bin/start-storybook -p 6006",
"start": "cd ../icons && yarn build && cd ../react-components-lab && ../../node_modules/.bin/start-storybook -p 6006",
"build": "../../node_modules/.bin/tsdx build",
"test": "../../node_modules/.bin/tsdx test --passWithNoTests",
"lint": "../../node_modules/eslint/bin/eslint.js .",
"lint:fix": "../../node_modules/eslint/bin/eslint.js . --fix",
"build-storybook": "cd ../icons && yarn build && cd ../react-components-lab && ../../node_modules/.bin/build-storybook"
},
"devDependencies": {
"@dhi/icons": "workspace:^",
"@types/classnames": "^2.2.10",
"@types/jsonpath": "^0.2.0",
"@types/lodash": "^4.14.150",
Expand All @@ -36,20 +37,20 @@
"storybook-dark-mode": "^1.1.0"
},
"peerDependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
"@mui/material": "~5",
"react": "~17 || ~18",
"react-dom": "~17 || ~18"
},
"dependencies": {
"@ctrl/tinycolor": "^3.4.0",
"@dhi/icons": "workspace:^",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/system": "^4.12.1",
"clsx": "^1.1.1",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@mui/icons-material": "^5.8.3",
"@mui/material": "^5.8.3",
"@mui/system": "^5.8.3",
"copy-to-clipboard": "^3.3.1",
"date-fns": "^2.27.0",
"lodash": "^4.17.21",
"lodash.assignin": "^4.2.0",
"prismjs": "^1.24.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { useEffect, useState, FC } from 'react';
import { Box, Typography } from '@material-ui/core';
import { Box, Typography, useTheme } from '@mui/material';
import { BarLegendProps } from './types';
import useStyles from './styles';
import ImgLegendStyled from './ImgLegend.styled';

const BarLegend: FC<BarLegendProps> = ({ src, length, range, unit = '' }) => {
const classes = useStyles();
const [val, setVals] = useState<number[] | undefined>();

const theme = useTheme();
useEffect(() => {
if (
length !== undefined &&
Expand All @@ -30,13 +29,13 @@ const BarLegend: FC<BarLegendProps> = ({ src, length, range, unit = '' }) => {
}, [range, length]);

return (
<Box style={{ width: '100%' }}>
<img src={src} alt="legend-colorbar" className={classes.colorbar} />
<Box width={1}>
<ImgLegendStyled src={src} alt="legend-colorbar" theme={theme} />
bertearazvan marked this conversation as resolved.
Show resolved Hide resolved
{range &&
(typeof range[0] === 'number' && typeof range[1] === 'number' && val ? (
<Box display="flex" justifyContent="space-between">
{val.map((v: number) => (
<Typography key={`value-${v}`} style={{ fontSize: 10 }}>
bertearazvan marked this conversation as resolved.
Show resolved Hide resolved
<Typography key={`value-${v}`} sx={{ fontSize: 10 }}>
{`${v} ${unit}`}
</Typography>
))}
Expand All @@ -45,10 +44,10 @@ const BarLegend: FC<BarLegendProps> = ({ src, length, range, unit = '' }) => {
['number', 'string'].includes(typeof range[0]) &&
['number', 'string'].includes(typeof range[1]) && (
<Box display="flex" justifyContent="space-between">
<Typography style={{ fontSize: 10 }}>
<Typography sx={{ fontSize: 10 }}>
{`${range[0]} ${unit}`}
</Typography>
<Typography style={{ fontSize: 10 }}>
<Typography sx={{ fontSize: 10 }}>
{`${range[1]} ${unit}`}
</Typography>
</Box>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { styled } from '@mui/material/styles';

const ImgLegendStyled = styled('img')({
width: '100%',
height: 6,
borderRadius: 4,
});

export default ImgLegendStyled;
bertearazvan marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { FC } from 'react';
import { Box, Typography } from '@material-ui/core';
import { Box, Typography } from '@mui/material';
import { CalendarBoxProps } from './types';

const CalendarBox: FC<CalendarBoxProps> = ({ children, title }) => (
Expand All @@ -9,7 +9,7 @@ const CalendarBox: FC<CalendarBoxProps> = ({ children, title }) => (
{title}
</Typography>
)}
<Box width={1} display="flex" flexWrap="wrap" flexDirection="space-between">
<Box width={1} display="flex" flexWrap="wrap">
{children.map((comp) => comp)}
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react';
import { Box } from '@mui/material';
import { styled } from '@mui/material/styles';
import { experimental_sx as sx } from '@mui/system';
import { CalendarItemProps } from './types';

const options = {
shouldForwardProp: (prop) =>
prop !== 'disabled' || prop !== 'variant' || prop !== 'active',
};

const CalendarItemBox = styled(
Box,
options
)<Partial<CalendarItemProps>>(({ disabled, variant, active }) => {
const getStyle = () => {
if (disabled)
return {
backgroundColor: 'mediumGrey.light',
color: 'mediumGrey.dark',
};
if (variant === 'button' && !disabled)
return {
backgroundColor: active ? 'secondary.main' : 'mediumGrey.light',
color: active ? 'background.paper' : 'primary.main',
'&:hover': {
backgroundColor: active ? 'secondary.main' : 'mediumGrey.main',
},
};

if (variant === 'semi-button' && !disabled)
return {
backgroundColor: active ? 'secondary.main' : 'mediumGrey.light',
color: active ? 'background.paper' : 'primary.main',
'&:hover': {
backgroundColor: active ? 'secondary.main' : 'mediumGrey.main',
},
};

return {};
};

const stableCss = {
cursor: disabled ? 'default' : 'pointer',
borderRadius: 4,
minWidth: 42,
margin: '2px',
padding: '0px 7px',
textAlign: 'center',
flexGrow: 1,
...getStyle(),
} as const;

return sx(stableCss);
});

export default CalendarItemBox;
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { FC } from 'react';
import { Box, Typography } from '@material-ui/core';
import clsx from 'clsx';
import useStyles from './styles';
import { Typography } from '@mui/material';
import CalendarItemBox from './CalendarItem.styled';
import { CalendarItemProps } from './types';

const CalendarItem: FC<CalendarItemProps> = ({
Expand All @@ -10,34 +9,17 @@ const CalendarItem: FC<CalendarItemProps> = ({
children,
active = false,
disabled = false,
}) => {
const classes = useStyles();

return (
<Box
className={clsx(
disabled && {
[classes.button]: true,
[classes.disabled]: true,
},
variant === 'button' &&
!disabled && {
[classes.button]: true,
[classes.active]: active,
},
variant === 'semi-button' &&
!disabled && {
[classes.button]: true,
[classes.semiActive]: active,
}
)}
onClick={() => !disabled && onClick()}
>
<Typography variant="body2" style={{ color: 'inherit' }}>
{children}
</Typography>
</Box>
);
};
}) => (
<CalendarItemBox
onClick={() => !disabled && onClick()}
disabled={disabled}
variant={variant}
active={active}
>
<Typography variant="body2" sx={{ color: 'inherit' }}>
{children}
</Typography>
</CalendarItemBox>
);

export default CalendarItem;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { styled } from '@mui/material/styles';
import { Box } from '@mui/material';
import { experimental_sx as sx } from '@mui/system';

export default styled(Box)(
sx({
position: 'absolute',
top: 0,
left: 0,
zIndex: 100,
borderRadius: 4,
backgroundColor: 'lightGrey.main',
width: '100%',
height: '100%',
opacity: 0.7,
})
);
Loading