From 6ddb8e48224b96ee2bb47e3821e494e2d5cac83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomislav=20Hora=C4=8Dek?= Date: Wed, 4 Sep 2024 10:58:54 +0200 Subject: [PATCH] chore: allow parent component to forward ref --- .../dialog/dialog-root.component.tsx | 67 ++++++++++--------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/src/design-system/dialog/dialog-root.component.tsx b/src/design-system/dialog/dialog-root.component.tsx index 3528440..599a3bd 100644 --- a/src/design-system/dialog/dialog-root.component.tsx +++ b/src/design-system/dialog/dialog-root.component.tsx @@ -27,38 +27,39 @@ export interface DialogRootProps { zIndex?: number; } -export const Root = ({ - open, - setOpen, - onCloseAutoFocusRef, - children, - portalContainer, - zIndex, -}: Readonly): JSX.Element => ( - - - - - - { - setOpen(false); - }} - onCloseAutoFocus={ - onCloseAutoFocusRef && - ((): void => { - onCloseAutoFocusRef.current?.focus(); - }) - } - > - >( + ( + { open, setOpen, onCloseAutoFocusRef, children, portalContainer, zIndex }, + forwardReference, + ) => ( + + + + + + { + setOpen(false); + }} + onCloseAutoFocus={ + onCloseAutoFocusRef && + ((): void => { + onCloseAutoFocusRef.current?.focus(); + }) + } > - {children} - - - - + + {children} + + + + + ), ); + +Root.displayName = 'DialogRoot';