Skip to content

Commit 31425c9

Browse files
authored
fix(useDialogContainer): defaultContainerProps (#691)
1 parent 4d1e2a1 commit 31425c9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.changeset/afraid-mugs-sneeze.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fix `defaultContainerProps` in `useDialogContainer` hook.

src/components/overlays/Dialog/dialog-container.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { DialogContainer } from './DialogContainer';
1515
* Generic hook to manage a dialog component.
1616
*
1717
* @param Component - A React component that represents the dialog content. It must accept props of type P.
18+
* @param defaultContainerProps - Default props to pass to the DialogContainer.
1819
* @returns An object with `open` function to open the dialog with provided props and `rendered` JSX element to include in your component tree.
1920
*/
2021
export function useDialogContainer<
@@ -65,12 +66,12 @@ export function useDialogContainer<
6566
<DialogContainer
6667
isOpen={isOpen}
6768
onDismiss={close}
68-
{...(containerProps ?? {})}
69+
{...mergeProps(defaultContainerProps, containerProps || undefined)}
6970
>
70-
<Component {...mergeProps(defaultContainerProps, componentProps)} />
71+
<Component {...componentProps} />
7172
</DialogContainer>
7273
);
73-
}, [componentProps, containerProps, isOpen]);
74+
}, [componentProps, containerProps, isOpen, defaultContainerProps]);
7475

7576
return {
7677
open,

0 commit comments

Comments
 (0)