fix(ui): fix usages of panel helpers

Upstream breaking change.
This commit is contained in:
psychedelicious 2024-01-12 09:24:31 +11:00
parent c0c8fa9a89
commit dfe0b73890
3 changed files with 12 additions and 9 deletions

View File

@ -96,7 +96,7 @@
"react-icons": "^4.12.0", "react-icons": "^4.12.0",
"react-konva": "^18.2.10", "react-konva": "^18.2.10",
"react-redux": "9.0.4", "react-redux": "9.0.4",
"react-resizable-panels": "^1.0.7", "react-resizable-panels": "^1.0.8",
"react-select": "5.8.0", "react-select": "5.8.0",
"react-textarea-autosize": "^8.5.3", "react-textarea-autosize": "^8.5.3",
"react-use": "^17.4.2", "react-use": "^17.4.2",

View File

@ -143,8 +143,8 @@ dependencies:
specifier: 9.0.4 specifier: 9.0.4
version: 9.0.4(@types/react@18.2.47)(react@18.2.0)(redux@5.0.1) version: 9.0.4(@types/react@18.2.47)(react@18.2.0)(redux@5.0.1)
react-resizable-panels: react-resizable-panels:
specifier: ^1.0.7 specifier: ^1.0.8
version: 1.0.7(react-dom@18.2.0)(react@18.2.0) version: 1.0.8(react-dom@18.2.0)(react@18.2.0)
react-select: react-select:
specifier: 5.8.0 specifier: 5.8.0
version: 5.8.0(@types/react@18.2.47)(react-dom@18.2.0)(react@18.2.0) version: 5.8.0(@types/react@18.2.47)(react-dom@18.2.0)(react@18.2.0)
@ -11638,8 +11638,8 @@ packages:
use-sidecar: 1.1.2(@types/react@18.2.47)(react@18.2.0) use-sidecar: 1.1.2(@types/react@18.2.47)(react@18.2.0)
dev: false dev: false
/react-resizable-panels@1.0.7(react-dom@18.2.0)(react@18.2.0): /react-resizable-panels@1.0.8(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-CluJkHQheeNqIJly2FYDfri3ME+2h2nCXpf0Y+hTO1K1eVtNxXFA5hVp5cUD6NS70iiufswOmnku9QZiLr1hYg==} resolution: {integrity: sha512-IuivK06FWN115VSN8TDGYuIoAzplC4oPUCDZ5d+VWJj0p6N3SMfwjggpjMUGSpQJLvMi0FXPSLLn4rGVmESjmA==}
peerDependencies: peerDependencies:
react: ^16.14.0 || ^17.0.0 || ^18.0.0 react: ^16.14.0 || ^17.0.0 || ^18.0.0
react-dom: ^16.14.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.14.0 || ^17.0.0 || ^18.0.0

View File

@ -107,8 +107,11 @@ export const usePanel = (arg: UsePanelOptions): UsePanelReturn => {
return; return;
} }
const id = arg.panelGroupRef.current.getId(); const id = arg.panelGroupRef.current.getId();
const panelGroupElement = getPanelGroupElement(id); const panelGroupElement = getPanelGroupElement(id, document);
const panelGroupHandleElements = getResizeHandleElementsForGroup(id); const panelGroupHandleElements = getResizeHandleElementsForGroup(
id,
document
);
if (!panelGroupElement) { if (!panelGroupElement) {
return; return;
} }
@ -244,7 +247,7 @@ const getSizeAsPercentage = (
return 0; return 0;
} }
const id = panelGroupHandleRef.current.getId(); const id = panelGroupHandleRef.current.getId();
const panelGroupElement = getPanelGroupElement(id); const panelGroupElement = getPanelGroupElement(id, document);
if (!panelGroupElement) { if (!panelGroupElement) {
// No panel group element, size is 0 // No panel group element, size is 0
return 0; return 0;
@ -257,7 +260,7 @@ const getSizeAsPercentage = (
: panelGroupElement.offsetHeight; : panelGroupElement.offsetHeight;
// ...minus the width/height of the resize handles // ...minus the width/height of the resize handles
getResizeHandleElementsForGroup(id).forEach((el) => { getResizeHandleElementsForGroup(id, document).forEach((el) => {
availableSpace -= availableSpace -=
panelGroupDirection === 'horizontal' ? el.offsetWidth : el.offsetHeight; panelGroupDirection === 'horizontal' ? el.offsetWidth : el.offsetHeight;
}); });