Skip to content

Commit

Permalink
Reapply the autocomplete focus patch to @mui/base
Browse files Browse the repository at this point in the history
It was broken by the MUI upgrade in
c4d5fa4
  • Loading branch information
canac committed Aug 13, 2024
1 parent bbc74f4 commit ca5750d
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 141 deletions.
129 changes: 41 additions & 88 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 24 additions & 0 deletions .yarn/patches/@mui-base-npm-5.0.0-beta.40-248417914d.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/useAutocomplete/useAutocomplete.js b/useAutocomplete/useAutocomplete.js
index b2c2a8a6770571390b3aa61267413314865642e7..8d386b2b0e240ae5746d156d3b8dea110a80bee2 100644
--- a/useAutocomplete/useAutocomplete.js
+++ b/useAutocomplete/useAutocomplete.js
@@ -330,6 +330,9 @@ export function useAutocomplete(props) {
}
const getNextIndex = () => {
const maxIndex = filteredOptions.length - 1;
+ if (diff === 'clear') {
+ return -1;
+ }
if (diff === 'reset') {
return defaultHighlighted;
}
@@ -958,6 +961,9 @@ export function useAutocomplete(props) {
onMouseDown: event => {
// Prevent blur
event.preventDefault();
+ },
+ onMouseLeave: () => {
+ changeHighlightedIndex({ diff: 'clear' });
}
}),
getOptionProps: ({
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@
"package-json/got": "^11.8.5",
"http-cache-semantics": "~4.1.1",
"cacheable-request": "^10.2.7",
"@mui/[email protected]": "patch:@mui/base@npm%3A5.0.0-alpha.98#./.yarn/patches/@mui-base-npm-5.0.0-alpha.98-f4d605d753.patch",
"@mui/x-data-grid@^5.17.4": "patch:@mui/x-data-grid@npm%3A5.17.4#./.yarn/patches/@mui-x-data-grid-npm-5.17.4-542730a19e.patch"
"@mui/[email protected]": "patch:@mui/base@npm%3A5.0.0-beta.40#./.yarn/patches/@mui-base-npm-5.0.0-beta.40-248417914d.patch",
"@mui/x-data-grid@^5.17.4": "patch:@mui/x-data-grid@npm%3A5.17.4#./.yarn/patches/@mui-x-data-grid-npm-5.17.4-542730a19e.patch",
"@mui/base@^5.0.0-beta.36": "patch:@mui/base@npm%3A5.0.0-beta.40#./.yarn/patches/@mui-base-npm-5.0.0-beta.40-248417914d.patch",
"@mui/[email protected]": "patch:@mui/base@npm%3A5.0.0-beta.40#./.yarn/patches/@mui-base-npm-5.0.0-beta.40-248417914d.patch"
},
"lint-staged": {
"*.{js,ts,tsx}": "eslint --cache --fix"
Expand Down
62 changes: 11 additions & 51 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2989,15 +2989,6 @@ __metadata:
languageName: node
linkType: hard

"@emotion/is-prop-valid@npm:^1.2.0":
version: 1.2.0
resolution: "@emotion/is-prop-valid@npm:1.2.0"
dependencies:
"@emotion/memoize": ^0.8.0
checksum: cc7a19850a4c5b24f1514665289442c8c641709e6f7711067ad550e05df331da0692a16148e85eda6f47e31b3261b64d74c5e25194d053223be16231f969d633
languageName: node
linkType: hard

"@emotion/is-prop-valid@npm:^1.2.1":
version: 1.2.2
resolution: "@emotion/is-prop-valid@npm:1.2.2"
Expand Down Expand Up @@ -4922,30 +4913,7 @@ __metadata:
languageName: node
linkType: hard

"@mui/base@npm:5.0.0-alpha.98":
version: 5.0.0-alpha.98
resolution: "@mui/base@npm:5.0.0-alpha.98"
dependencies:
"@babel/runtime": ^7.19.0
"@emotion/is-prop-valid": ^1.2.0
"@mui/types": ^7.2.0
"@mui/utils": ^5.10.6
"@popperjs/core": ^2.11.6
clsx: ^1.2.1
prop-types: ^15.8.1
react-is: ^18.2.0
peerDependencies:
"@types/react": ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0
react-dom: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
"@types/react":
optional: true
checksum: 31c5e590620bd57a63f9dad688a4e73f011036722e5063252506c2680ef5fa2f137cb9415596f6af5348683c66e12d17a24af3126ddda0f3405a37f2e208bb5e
languageName: node
linkType: hard

"@mui/base@npm:5.0.0-beta.40, @mui/base@npm:^5.0.0-beta.36":
"@mui/base@npm:5.0.0-beta.40":
version: 5.0.0-beta.40
resolution: "@mui/base@npm:5.0.0-beta.40"
dependencies:
Expand All @@ -4967,26 +4935,25 @@ __metadata:
languageName: node
linkType: hard

"@mui/base@patch:@mui/base@npm%3A5.0.0-alpha.98#./.yarn/patches/@mui-base-npm-5.0.0-alpha.98-f4d605d753.patch::locator=mpdx-react%40workspace%3A.":
version: 5.0.0-alpha.98
resolution: "@mui/base@patch:@mui/base@npm%3A5.0.0-alpha.98#./.yarn/patches/@mui-base-npm-5.0.0-alpha.98-f4d605d753.patch::version=5.0.0-alpha.98&hash=8e63fa&locator=mpdx-react%40workspace%3A."
"@mui/base@patch:@mui/base@npm%3A5.0.0-beta.40#./.yarn/patches/@mui-base-npm-5.0.0-beta.40-248417914d.patch::locator=mpdx-react%40workspace%3A.":
version: 5.0.0-beta.40
resolution: "@mui/base@patch:@mui/base@npm%3A5.0.0-beta.40#./.yarn/patches/@mui-base-npm-5.0.0-beta.40-248417914d.patch::version=5.0.0-beta.40&hash=6b20e2&locator=mpdx-react%40workspace%3A."
dependencies:
"@babel/runtime": ^7.19.0
"@emotion/is-prop-valid": ^1.2.0
"@mui/types": ^7.2.0
"@mui/utils": ^5.10.6
"@popperjs/core": ^2.11.6
clsx: ^1.2.1
"@babel/runtime": ^7.23.9
"@floating-ui/react-dom": ^2.0.8
"@mui/types": ^7.2.14
"@mui/utils": ^5.15.14
"@popperjs/core": ^2.11.8
clsx: ^2.1.0
prop-types: ^15.8.1
react-is: ^18.2.0
peerDependencies:
"@types/react": ^17.0.0 || ^18.0.0
react: ^17.0.0 || ^18.0.0
react-dom: ^17.0.0 || ^18.0.0
peerDependenciesMeta:
"@types/react":
optional: true
checksum: 728d6e97c6a54e99f670fe3fecd1ae2829986e14498f7a0060f995de3a8790eba19ccc97d0f819c7f788e2c271795e31ae1e8f71fb617d0e7261d87ec00b21b4
checksum: 4a14fd43a4b40787fb63562e3283c18e060249678c9605982b372b7675d0da3157056712fd8bd0a5fdaa28b8c22445c9d0292aab16e7912d0635b567417347eb
languageName: node
linkType: hard

Expand Down Expand Up @@ -5811,13 +5778,6 @@ __metadata:
languageName: node
linkType: hard

"@popperjs/core@npm:^2.11.6":
version: 2.11.6
resolution: "@popperjs/core@npm:2.11.6"
checksum: 47fb328cec1924559d759b48235c78574f2d71a8a6c4c03edb6de5d7074078371633b91e39bbf3f901b32aa8af9b9d8f82834856d2f5737a23475036b16817f0
languageName: node
linkType: hard

"@popperjs/core@npm:^2.11.8":
version: 2.11.8
resolution: "@popperjs/core@npm:2.11.8"
Expand Down

0 comments on commit ca5750d

Please sign in to comment.