-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(APP-3725): Update Dialog component to support new size property (#…
…391)
- Loading branch information
1 parent
89f6e16
commit 1ab3823
Showing
7 changed files
with
83 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/core/components/dialogs/dialog/dialogRoot/dialogRoot.api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import type { ComponentPropsWithoutRef, ReactNode } from 'react'; | ||
|
||
export type DialogSize = 'sm' | 'md' | 'lg' | 'xl'; | ||
|
||
export interface IDialogRootProps extends ComponentPropsWithoutRef<'div'> { | ||
/** | ||
* Children of the component. | ||
*/ | ||
children?: ReactNode; | ||
/** | ||
* Additional CSS class names for custom styling of the dialog's content container. | ||
*/ | ||
containerClassName?: string; | ||
/** | ||
* Size of the dialog. | ||
* @default md | ||
*/ | ||
size?: DialogSize; | ||
/** | ||
* Determines whether interactions with elements outside of the dialog will be disabled. | ||
* @default true | ||
*/ | ||
modal?: boolean; | ||
/** | ||
* Manages the visibility state of the dialog. | ||
*/ | ||
open?: boolean; | ||
/** | ||
* Additional CSS class names for custom styling of the overlay behind the dialog. | ||
*/ | ||
overlayClassName?: string; | ||
/** | ||
* Handler called when focus moves to the trigger after closing | ||
*/ | ||
onCloseAutoFocus?: (e: Event) => void; | ||
/** | ||
* Handler called when the escape key is pressed while the dialog is opened. Closes the dialog by default. | ||
*/ | ||
onEscapeKeyDown?: (e: KeyboardEvent) => void; | ||
/** | ||
* Handler called when an interaction (pointer or focus event) happens outside the bounds of the component | ||
*/ | ||
onInteractOutside?: (e: Event) => void; | ||
/** | ||
* Handler called when focus moves into the component after opening | ||
*/ | ||
onOpenAutoFocus?: (e: Event) => void; | ||
/** | ||
* Callback function invoked when the open state of the dialog changes. | ||
*/ | ||
onOpenChange?: (open: boolean) => void; | ||
/** | ||
* Handler called when a pointer event occurs outside the bounds of the component | ||
*/ | ||
onPointerDownOutside?: (e: Event) => void; | ||
/** | ||
* Keeps the focus inside the Dialog when set to true. | ||
* @default true | ||
*/ | ||
useFocusTrap?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/core/components/dialogs/dialog/dialogRoot/dialogRoot.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { DialogRoot, type IDialogRootProps } from './dialogRoot'; | ||
export { DialogRoot } from './dialogRoot'; | ||
export { type DialogSize, type IDialogRootProps } from './dialogRoot.api'; |