Skip to content

Commit 3ceb566

Browse files
committedDec 16, 2024
fix: support react 19 as peer dependency
fix #150
1 parent 6b24933 commit 3ceb566

6 files changed

+645
-527
lines changed
 

‎demo/examples/ChainingEventHandlers.hooks.js

-51
This file was deleted.

‎demo/examples/ChainingEventHandlers.js

+32-29
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,38 @@ import { chainEventHandlers } from 'material-ui-popup-state/chainEventHandlers'
1010

1111
const DialogPopupState = () => (
1212
<PopupState variant="dialog">
13-
{(popupState) => (
14-
<React.Fragment>
15-
<Button variant="contained" {...bindTrigger(popupState)}>
16-
Open Dialog
17-
</Button>
18-
<Dialog
19-
{...chainEventHandlers(bindDialog(popupState), {
20-
onClose: () => setTimeout(() => alert('closed dialog!'), 10),
21-
})}
22-
aria-labelledby="alert-dialog-title"
23-
aria-describedby="alert-dialog-description"
24-
>
25-
<DialogTitle id="alert-dialog-title">
26-
Chaining Event Handlers example
27-
</DialogTitle>
28-
<DialogContent>
29-
<DialogContentText id="alert-dialog-description">
30-
After you close this dialog, you should get an alert
31-
</DialogContentText>
32-
</DialogContent>
33-
<DialogActions>
34-
<Button onClick={popupState.close}>Cancel</Button>
35-
<Button onClick={popupState.close} autoFocus>
36-
OK
37-
</Button>
38-
</DialogActions>
39-
</Dialog>
40-
</React.Fragment>
41-
)}
13+
{(popupState) => {
14+
const boundDialogProps = chainEventHandlers(bindDialog(popupState), {
15+
onClose: () => setTimeout(() => alert('closed dialog!'), 10),
16+
})
17+
return (
18+
<React.Fragment>
19+
<Button variant="contained" {...bindTrigger(popupState)}>
20+
Open Dialog
21+
</Button>
22+
<Dialog
23+
{...boundDialogProps}
24+
aria-labelledby="alert-dialog-title"
25+
aria-describedby="alert-dialog-description"
26+
>
27+
<DialogTitle id="alert-dialog-title">
28+
Chaining Event Handlers example
29+
</DialogTitle>
30+
<DialogContent>
31+
<DialogContentText id="alert-dialog-description">
32+
After you close this dialog, you should get an alert
33+
</DialogContentText>
34+
</DialogContent>
35+
<DialogActions>
36+
<Button onClick={boundDialogProps.onClose}>Cancel</Button>
37+
<Button onClick={boundDialogProps.onClose} autoFocus>
38+
OK
39+
</Button>
40+
</DialogActions>
41+
</Dialog>
42+
</React.Fragment>
43+
)
44+
}}
4245
</PopupState>
4346
)
4447

‎package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
"@babel/node": "^7.20.5",
3838
"@babel/plugin-syntax-flow": "^7.14.5",
3939
"@babel/plugin-transform-react-jsx": "^7.14.9",
40-
"@emotion/react": "^11.13.3",
41-
"@emotion/styled": "^11.13.0",
40+
"@emotion/react": "^11.14.0",
41+
"@emotion/styled": "^11.14.0",
4242
"@jcoreio/eslint-plugin-implicit-dependencies": "^1.1.1",
4343
"@jcoreio/toolchain": "^4.9.0",
4444
"@jcoreio/toolchain-circle": "^4.9.0",
@@ -48,11 +48,11 @@
4848
"@jcoreio/toolchain-react": "^4.9.0",
4949
"@jcoreio/toolchain-semantic-release": "^4.9.0",
5050
"@jcoreio/toolchain-typescript": "^4.9.0",
51-
"@mui/icons-material": "^6.0.0",
52-
"@mui/material": "^6.0.0",
53-
"@mui/styles": "6.0.0",
54-
"@mui/types": "^7.2.16",
55-
"@testing-library/react": "^13.4.0",
51+
"@mui/icons-material": "^6.2.0",
52+
"@mui/material": "^6.2.0",
53+
"@mui/styles": "6.2.0",
54+
"@mui/types": "^7.2.19",
55+
"@testing-library/react": "^16.1.0",
5656
"@types/chai": "^4.3.5",
5757
"@types/glob": "^8.0.0",
5858
"@types/mocha": "^10.0.6",
@@ -75,12 +75,12 @@
7575
"flow-bin": "^0.145.0",
7676
"gh-pages": "^2.0.1",
7777
"glob": "^8.0.3",
78-
"global-jsdom": "^9.0.1",
79-
"jsdom": "^22.1.0",
78+
"global-jsdom": "^25.0.0",
79+
"jsdom": "^25.0.1",
8080
"mocha": "^10.2.0",
8181
"raw-loader": "^4.0.2",
82-
"react": "^18.2.0",
83-
"react-dom": "^18.2.0",
82+
"react": "^19.0.0",
83+
"react-dom": "^19.0.0",
8484
"rimraf": "^3.0.2",
8585
"sinon": "^6.3.5",
8686
"typescript": "^5.1.0",
@@ -91,13 +91,13 @@
9191
"dependencies": {
9292
"@babel/runtime": "^7.20.6",
9393
"@types/prop-types": "^15.7.3",
94-
"@types/react": "^18.0.26",
94+
"@types/react": "^19.0.1",
9595
"classnames": "^2.2.6",
9696
"prop-types": "^15.7.2"
9797
},
9898
"peerDependencies": {
9999
"@mui/material": "^5.0.0 || ^6.0.0",
100-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
100+
"react": "^16.8.0 || ^17 || ^18 || ^19"
101101
},
102102
"main": "dist/index.js",
103103
"module": "dist/index.mjs",

0 commit comments

Comments
 (0)