upgrade to @material-ui 5.0 alphas

(and various other lockfile upgrades. "npm audit" is clean.)

The date picker to use with 4.0 is unmaintained, and the new one is
apparently quite different.

Given that 5.0 is expected to be released this quarter, I prefer to
jump straight to the new one and get things working with it, even if
it means using an alpha in the short-term.
This commit is contained in:
Scott Lamb 2021-02-22 16:45:53 -08:00
parent a4cf3be7a0
commit e7527af24c
5 changed files with 1966 additions and 924 deletions

2768
ui/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,14 +3,16 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@material-ui/core": "^4.11.3", "@emotion/react": "^11.1.5",
"@material-ui/icons": "^4.11.2", "@emotion/styled": "^11.1.5",
"@material-ui/lab": "^4.0.0-alpha.57", "@material-ui/core": "^5.0.0-alpha.25",
"@material-ui/icons": "^5.0.0-alpha.24",
"@material-ui/lab": "^5.0.0-alpha.25",
"@types/jest": "^26.0.20", "@types/jest": "^26.0.20",
"@types/node": "^14.14.22", "@types/node": "^14.14.22",
"@types/react": "^17.0.0", "@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0", "@types/react-dom": "^17.0.0",
"fontsource-roboto": "^4.0.0", "@fontsource/roboto": "^4.2.1",
"gzipper": "^4.4.0", "gzipper": "^4.4.0",
"react": "^17.0.1", "react": "^17.0.1",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",

View File

@ -3,14 +3,15 @@
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception // SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
import Avatar from "@material-ui/core/Avatar"; import Avatar from "@material-ui/core/Avatar";
import Button from "@material-ui/core/Button";
import Dialog from "@material-ui/core/Dialog"; import Dialog from "@material-ui/core/Dialog";
import DialogActions from "@material-ui/core/DialogActions"; import DialogActions from "@material-ui/core/DialogActions";
import DialogTitle from "@material-ui/core/DialogTitle"; import DialogTitle from "@material-ui/core/DialogTitle";
import FormControl from "@material-ui/core/FormControl";
import FormHelperText from "@material-ui/core/FormHelperText";
import { makeStyles, Theme } from "@material-ui/core/styles"; import { makeStyles, Theme } from "@material-ui/core/styles";
import TextField from "@material-ui/core/TextField"; import TextField from "@material-ui/core/TextField";
import LockOutlinedIcon from "@material-ui/icons/LockOutlined"; import LockOutlinedIcon from "@material-ui/icons/LockOutlined";
import Alert from "@material-ui/lab/Alert"; import LoadingButton from "@material-ui/lab/LoadingButton";
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import * as api from "./api"; import * as api from "./api";
import { useSnackbars } from "./snackbars"; import { useSnackbars } from "./snackbars";
@ -19,9 +20,6 @@ const useStyles = makeStyles((theme: Theme) => ({
avatar: { avatar: {
backgroundColor: theme.palette.secondary.main, backgroundColor: theme.palette.secondary.main,
}, },
noError: {
visibility: "hidden",
},
})); }));
interface Props { interface Props {
@ -102,8 +100,6 @@ const Login = ({ open, onSuccess, handleClose }: Props) => {
e.preventDefault(); e.preventDefault();
// Suppress duplicate login attempts when latency is high. // Suppress duplicate login attempts when latency is high.
// It'd be nice to also provide a visual indication, but we might
// just wait for LoadingButton in material-ui 5 rather than reinventing it.
if (pending !== null) { if (pending !== null) {
return; return;
} }
@ -129,6 +125,7 @@ const Login = ({ open, onSuccess, handleClose }: Props) => {
</DialogTitle> </DialogTitle>
<form onSubmit={onSubmit}> <form onSubmit={onSubmit}>
<FormControl error={error != null} fullWidth>
<TextField <TextField
id="username" id="username"
label="Username" label="Username"
@ -150,18 +147,19 @@ const Login = ({ open, onSuccess, handleClose }: Props) => {
/> />
{/* reserve space for an error; show when there's something to see */} {/* reserve space for an error; show when there's something to see */}
<Alert <FormHelperText>{error == null ? " " : error}</FormHelperText>
severity="error"
className={error === null ? classes.noError : undefined}
>
{error}
</Alert>
<DialogActions> <DialogActions>
<Button type="submit" variant="contained" color="secondary"> <LoadingButton
type="submit"
variant="contained"
color="secondary"
pending={pending !== null}
>
Log in Log in
</Button> </LoadingButton>
</DialogActions> </DialogActions>
</FormControl>
</form> </form>
</Dialog> </Dialog>
); );

View File

@ -3,11 +3,9 @@
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception // SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
import CssBaseline from "@material-ui/core/CssBaseline"; import CssBaseline from "@material-ui/core/CssBaseline";
import { import { ThemeProvider, createMuiTheme } from "@material-ui/core/styles";
ThemeProvider, import StyledEngineProvider from "@material-ui/core/StyledEngineProvider";
unstable_createMuiStrictModeTheme as createMuiTheme, import "@fontsource/roboto";
} from "@material-ui/core/styles";
import "fontsource-roboto";
import React from "react"; import React from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import App from "./App"; import App from "./App";
@ -27,6 +25,7 @@ const theme = createMuiTheme({
ReactDOM.render( ReactDOM.render(
<React.StrictMode> <React.StrictMode>
<StyledEngineProvider injectFirst>
<CssBaseline /> <CssBaseline />
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<ErrorBoundary> <ErrorBoundary>
@ -35,6 +34,7 @@ ReactDOM.render(
</SnackbarProvider> </SnackbarProvider>
</ErrorBoundary> </ErrorBoundary>
</ThemeProvider> </ThemeProvider>
</StyledEngineProvider>
</React.StrictMode>, </React.StrictMode>,
document.getElementById("root") document.getElementById("root")
); );