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-konva": "^18.2.10",
"react-redux": "9.0.4",
"react-resizable-panels": "^1.0.7",
"react-resizable-panels": "^1.0.8",
"react-select": "5.8.0",
"react-textarea-autosize": "^8.5.3",
"react-use": "^17.4.2",

View File

@ -143,8 +143,8 @@ dependencies:
specifier: 9.0.4
version: 9.0.4(@types/react@18.2.47)(react@18.2.0)(redux@5.0.1)
react-resizable-panels:
specifier: ^1.0.7
version: 1.0.7(react-dom@18.2.0)(react@18.2.0)
specifier: ^1.0.8
version: 1.0.8(react-dom@18.2.0)(react@18.2.0)
react-select:
specifier: 5.8.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)
dev: false
/react-resizable-panels@1.0.7(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-CluJkHQheeNqIJly2FYDfri3ME+2h2nCXpf0Y+hTO1K1eVtNxXFA5hVp5cUD6NS70iiufswOmnku9QZiLr1hYg==}
/react-resizable-panels@1.0.8(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-IuivK06FWN115VSN8TDGYuIoAzplC4oPUCDZ5d+VWJj0p6N3SMfwjggpjMUGSpQJLvMi0FXPSLLn4rGVmESjmA==}
peerDependencies:
react: ^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;
}
const id = arg.panelGroupRef.current.getId();
const panelGroupElement = getPanelGroupElement(id);
const panelGroupHandleElements = getResizeHandleElementsForGroup(id);
const panelGroupElement = getPanelGroupElement(id, document);
const panelGroupHandleElements = getResizeHandleElementsForGroup(
id,
document
);
if (!panelGroupElement) {
return;
}
@ -244,7 +247,7 @@ const getSizeAsPercentage = (
return 0;
}
const id = panelGroupHandleRef.current.getId();
const panelGroupElement = getPanelGroupElement(id);
const panelGroupElement = getPanelGroupElement(id, document);
if (!panelGroupElement) {
// No panel group element, size is 0
return 0;
@ -257,7 +260,7 @@ const getSizeAsPercentage = (
: panelGroupElement.offsetHeight;
// ...minus the width/height of the resize handles
getResizeHandleElementsForGroup(id).forEach((el) => {
getResizeHandleElementsForGroup(id, document).forEach((el) => {
availableSpace -=
panelGroupDirection === 'horizontal' ? el.offsetWidth : el.offsetHeight;
});