From a1ee5be54b02e44cb503ea9e0e28c45e2784ed97 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Tue, 13 Jun 2023 17:46:37 +0800 Subject: [PATCH] Upgrade react-menu and bug fixes --- package-lock.json | 49 +++++++++++++++++-------- package.json | 3 +- src/components/account-info.jsx | 2 +- src/components/media-modal.jsx | 2 +- src/components/menu2.jsx | 31 ++++++++++++++++ src/components/shortcuts.jsx | 2 +- src/components/status.jsx | 29 ++------------- src/pages/account-statuses.jsx | 10 ++--- src/pages/hashtag.jsx | 10 ++--- src/pages/list.jsx | 10 ++--- src/pages/public.jsx | 10 ++--- src/pages/trending.jsx | 10 ++--- src/utils/safe-bounding-box-padding.jsx | 27 ++++++++++++++ 13 files changed, 120 insertions(+), 75 deletions(-) create mode 100644 src/components/menu2.jsx create mode 100644 src/utils/safe-bounding-box-padding.jsx diff --git a/package-lock.json b/package-lock.json index 0d3bb36e..619956a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,8 @@ "@github/text-expander-element": "~2.3.0", "@iconify-icons/mingcute": "~1.2.5", "@justinribeiro/lite-youtube": "~1.5.0", - "@szhsin/react-menu": "~3.5.3", + "@szhsin/react-menu": "~4.0.0", + "@uidotdev/usehooks": "~2.0.1", "dayjs": "~1.11.8", "dayjs-twitter": "~0.5.0", "fast-blurhash": "~1.1.2", @@ -3126,12 +3127,12 @@ } }, "node_modules/@szhsin/react-menu": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/@szhsin/react-menu/-/react-menu-3.5.3.tgz", - "integrity": "sha512-jxo8oaRwxmVjUzkyOi/ZJiXaZiuFPMIxFzyJdUKfnhBLYiEOVTU9M2CiPuEkirILoareR2GJj2K3y8a81CBPlw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@szhsin/react-menu/-/react-menu-4.0.0.tgz", + "integrity": "sha512-DOl+IWddgHofcEzSTJfILGvpU67O/y8r07LOVUhfThke9VEZ5LAZNkp2Q3mEFaN7PkmnmJtjPBEdIK3oN1/ZfQ==", "dependencies": { "prop-types": "^15.7.2", - "react-transition-state": "^1.1.5" + "react-transition-state": "^2.1.0" }, "peerDependencies": { "react": ">=16.14.0", @@ -3271,6 +3272,18 @@ "integrity": "sha512-NfQ4gyz38SL8sDNrSixxU2Os1a5xcdFxipAFxYEuLUlvU2uDwS4NUpsImcf1//SlWItCVMMLiylsxbmNMToV/g==", "dev": true }, + "node_modules/@uidotdev/usehooks": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@uidotdev/usehooks/-/usehooks-2.0.1.tgz", + "integrity": "sha512-rJXxE3Y8g9utRbOS9Pj9tIvrnOdaakHIhLbMxBlErV8HydnGD0DveD82aLBfVTh1hBp5IXqpeHpMrPE9WIT7vQ==", + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "react": ">=18.0.0", + "react-dom": ">=18.0.0" + } + }, "node_modules/@vue/compiler-core": { "version": "3.2.45", "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.45.tgz", @@ -6334,9 +6347,9 @@ } }, "node_modules/react-transition-state": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/react-transition-state/-/react-transition-state-1.1.5.tgz", - "integrity": "sha512-ITY2mZqc2dWG2eitJkYNdcSFW8aKeOlkL2A/vowRrLL8GH3J6Re/SpD/BLvQzrVOTqjsP0b5S9N10vgNNzwMUQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/react-transition-state/-/react-transition-state-2.1.0.tgz", + "integrity": "sha512-b8ldw2pbZk++XM43vcD4ETaFWlzTsjpUX33CmT8BBPPFYlQ2R50wxcY4ZeJ1TesJYziYZ9/rNPFnyA9tR0iKDw==", "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" @@ -9619,12 +9632,12 @@ } }, "@szhsin/react-menu": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/@szhsin/react-menu/-/react-menu-3.5.3.tgz", - "integrity": "sha512-jxo8oaRwxmVjUzkyOi/ZJiXaZiuFPMIxFzyJdUKfnhBLYiEOVTU9M2CiPuEkirILoareR2GJj2K3y8a81CBPlw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@szhsin/react-menu/-/react-menu-4.0.0.tgz", + "integrity": "sha512-DOl+IWddgHofcEzSTJfILGvpU67O/y8r07LOVUhfThke9VEZ5LAZNkp2Q3mEFaN7PkmnmJtjPBEdIK3oN1/ZfQ==", "requires": { "prop-types": "^15.7.2", - "react-transition-state": "^1.1.5" + "react-transition-state": "^2.1.0" } }, "@trivago/prettier-plugin-sort-imports": { @@ -9740,6 +9753,12 @@ "integrity": "sha512-NfQ4gyz38SL8sDNrSixxU2Os1a5xcdFxipAFxYEuLUlvU2uDwS4NUpsImcf1//SlWItCVMMLiylsxbmNMToV/g==", "dev": true }, + "@uidotdev/usehooks": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@uidotdev/usehooks/-/usehooks-2.0.1.tgz", + "integrity": "sha512-rJXxE3Y8g9utRbOS9Pj9tIvrnOdaakHIhLbMxBlErV8HydnGD0DveD82aLBfVTh1hBp5IXqpeHpMrPE9WIT7vQ==", + "requires": {} + }, "@vue/compiler-core": { "version": "3.2.45", "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.45.tgz", @@ -11832,9 +11851,9 @@ } }, "react-transition-state": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/react-transition-state/-/react-transition-state-1.1.5.tgz", - "integrity": "sha512-ITY2mZqc2dWG2eitJkYNdcSFW8aKeOlkL2A/vowRrLL8GH3J6Re/SpD/BLvQzrVOTqjsP0b5S9N10vgNNzwMUQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/react-transition-state/-/react-transition-state-2.1.0.tgz", + "integrity": "sha512-b8ldw2pbZk++XM43vcD4ETaFWlzTsjpUX33CmT8BBPPFYlQ2R50wxcY4ZeJ1TesJYziYZ9/rNPFnyA9tR0iKDw==", "requires": {} }, "regenerate": { diff --git a/package.json b/package.json index 715884bd..e1234e6e 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "@github/text-expander-element": "~2.3.0", "@iconify-icons/mingcute": "~1.2.5", "@justinribeiro/lite-youtube": "~1.5.0", - "@szhsin/react-menu": "~3.5.3", + "@szhsin/react-menu": "~4.0.0", + "@uidotdev/usehooks": "~2.0.1", "dayjs": "~1.11.8", "dayjs-twitter": "~0.5.0", "fast-blurhash": "~1.1.2", diff --git a/src/components/account-info.jsx b/src/components/account-info.jsx index 751c062d..a223d091 100644 --- a/src/components/account-info.jsx +++ b/src/components/account-info.jsx @@ -673,7 +673,7 @@ function RelatedActions({ info, instance, authenticated }) { openTrigger="clickOnly" direction="bottom" overflow="auto" - offsetX={-16} + shift={-16} label={ <> diff --git a/src/components/media-modal.jsx b/src/components/media-modal.jsx index 27446dd3..0c70fbbc 100644 --- a/src/components/media-modal.jsx +++ b/src/components/media-modal.jsx @@ -191,7 +191,7 @@ function MediaModal({ align="end" position="anchor" boundingBoxPadding="8 8 8 8" - offsetY={4} + gap={4} menuClassName="glass-menu" menuButton={