diff --git a/packages/react/src/components/dialog/Dialog.tsx b/packages/react/src/components/dialog/Dialog.tsx index c2ac0b0..f5805d9 100644 --- a/packages/react/src/components/dialog/Dialog.tsx +++ b/packages/react/src/components/dialog/Dialog.tsx @@ -1,21 +1,21 @@ import type { UseDialogProps } from '@/components/dialog/use-dialog.hook' import type { ComponentWithoutAs } from '@/utilities/types' -import type { DialogTriggerProps as ComponentProps } from 'react-aria-components' +import type { DialogTriggerProps } from 'react-aria-components' import React from 'react' -import { DialogTrigger as Component } from 'react-aria-components' +import { DialogTrigger } from 'react-aria-components' import DialogContent from '@/components/dialog/DialogContent' import { DialogContext, useDialog } from '@/components/dialog/use-dialog.hook' -export type DialogProps = ComponentWithoutAs<'div'> & ComponentProps & UseDialogProps +type ComponentProps = ComponentWithoutAs<'div'> & Omit & UseDialogProps -const Dialog = React.forwardRef((props, ref) => { +const Component = React.forwardRef((props, ref) => { const { children, className, blur, placement, ...rest } = props const context = useDialog({ blur, placement }) - const component = React.useMemo( + const trigger = React.useMemo( () => ({ ref, children, @@ -27,13 +27,14 @@ const Dialog = React.forwardRef((props, ref) => { return ( - {children} + {children} ) }) -Dialog.displayName = 'Dialog' +Component.displayName = 'Dialog' -export default Object.assign(Dialog, { +export { ComponentProps as DialogProps } +export default Object.assign(Component, { Content: DialogContent, }) diff --git a/packages/react/src/components/dialog/DialogContent.tsx b/packages/react/src/components/dialog/DialogContent.tsx index 337e83a..c8e9a16 100644 --- a/packages/react/src/components/dialog/DialogContent.tsx +++ b/packages/react/src/components/dialog/DialogContent.tsx @@ -1,4 +1,3 @@ -import type { ComponentWithoutAs } from '@/utilities/types' import type { DialogProps, ModalOverlayProps } from 'react-aria-components' import React from 'react' @@ -6,9 +5,9 @@ import { Dialog, Modal, ModalOverlay } from 'react-aria-components' import { useDialogContext } from '@/components/dialog/use-dialog.hook' -export type DialogContentProps = ComponentWithoutAs<'div'> & DialogProps +type ComponentProps = DialogProps -const DialogContent = React.forwardRef((props, ref) => { +const Component = React.forwardRef((props, ref) => { const { children, className, ...rest } = props const { slots } = useDialogContext() @@ -45,6 +44,7 @@ const DialogContent = React.forwardRef((prop ) }) -DialogContent.displayName = 'Dialog.Content' +Component.displayName = 'Dialog.Content' -export default DialogContent +export { ComponentProps as DialogContentProps } +export default Component