Skip to content

Commit

Permalink
Cleanup components' props interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
sirineJ committed Jan 16, 2025
1 parent b18cf72 commit bb3e133
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/circuit-ui/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export interface DialogProps
*/
preventClose?: boolean;
/**
* Enables focusing a particular element in the dialog content and override default behavior. This will have no effect if the dialog is not modal.
* Enables focusing a particular element in the dialog content and overrides the default behavior.
* @default `false`.
*/
initialFocusRef?: RefObject<HTMLElement>;
Expand Down
2 changes: 0 additions & 2 deletions packages/circuit-ui/components/Modal/Modal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ const openModal = async ({
const baseArgs: ModalProps = {
open: false,
onClose: () => {},
'aria-labelledby': 'title',
'aria-describedby': 'description',
variant: 'contextual',
children: defaultModalChildren,
};
Expand Down
8 changes: 6 additions & 2 deletions packages/circuit-ui/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ import classes from './Modal.module.css';
export interface ModalProps
extends Omit<
DialogProps,
'onCloseStart' | 'onCloseEnd' | 'isModal' | 'animationDuration'
| 'onCloseStart'
| 'onCloseEnd'
| 'isModal'
| 'animationDuration'
| 'preventOutsideClickRefs'
> {
/**
* Use the `immersive` variant to focus the user's attention on the dialog content.
Expand All @@ -38,7 +42,7 @@ export interface ModalProps
/**
* Callback when the modal dialog is closed.
*/
onClose: DialogProps['onCloseEnd'];
onClose?: DialogProps['onCloseEnd'];
/**
* @deprecated This prop was passed to `react-modal` and is no longer relevant.
* Use the `preventClose` prop instead. Also see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role#required_javascript_features
Expand Down
11 changes: 10 additions & 1 deletion packages/circuit-ui/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@ export interface PopoverReferenceProps {
export interface PopoverProps
extends Omit<
DialogProps,
'children' | 'role' | 'open' | 'onCloseEnd' | 'onCloseStart'
| 'children'
| 'role'
| 'open'
| 'onCloseEnd'
| 'onCloseStart'
| 'isModal'
| 'animationDuration'
| 'preventClose'
| 'initialFocusRef'
| 'preventOutsideClickRefs'
> {
/**
* Determines whether the Popover is open or closed.
Expand Down
14 changes: 11 additions & 3 deletions packages/circuit-ui/components/Toggletip/Toggletip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ export interface ToggletipReferenceProps {
export interface ToggletipProps
extends Omit<
DialogProps,
'onCloseStart' | 'onCloseEnd' | 'isModal' | 'animationDuration'
| 'onCloseStart'
| 'onCloseEnd'
| 'isModal'
| 'animationDuration'
| 'initialFocusRef'
| 'open'
| 'preventClose'
| 'preventOutsideClickRefs'
| 'children'
> {
/**
* The button element that triggers the toggletip.
Expand Down Expand Up @@ -88,7 +96,7 @@ export interface ToggletipProps
/**
* Where to display the toggletip relative to the trigger component. The
* toggletip will automatically move if there isn't enough space available.
* Default: 'top'.
* @default 'top'.
*/
placement?: Placement;
/**
Expand All @@ -98,7 +106,7 @@ export interface ToggletipProps
* positive) or towards (if negative) the reference element. Pass an object
* to displace the floating element on both the main and cross axes.
*
* Default: 12.
* @default: 12.
*/
offset?: number | { mainAxis?: number; crossAxis?: number };
}
Expand Down

0 comments on commit bb3e133

Please sign in to comment.