Skip to content

Commit

Permalink
import props from NavigableMenu`
Browse files Browse the repository at this point in the history
  • Loading branch information
chad1008 committed May 1, 2023
1 parent db22a75 commit e994728
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
3 changes: 1 addition & 2 deletions packages/components/src/dropdown-menu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ Use this object to modify props available for the `Button` component that are no

- Required: No

// TODO: Update this when `NavigableMenu` is typed and `menuProps` is imported from there
#### `menuProps`: `Object`
#### `menuProps`: `NavigableContainerProps`

Properties of `menuProps` object will be passed as props to the nested `NavigableMenu` component in the `renderContent` implementation of the `Dropdown` component used internally.
Use this object to modify props available for the `NavigableMenu` component that are not already exposed in the `DropdownMenu` component, e.g.: the orientation of the menu set with `orientation` prop.
Expand Down
13 changes: 2 additions & 11 deletions packages/components/src/dropdown-menu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { ButtonAsButtonProps } from '../button/types';
import type { WordPressComponentProps } from '../ui/context';
import type { DropdownProps } from '../dropdown/types';
import type { Props as IconProps } from '../icon';
import type { NavigableMenuProps } from '../navigable-container/types';

type DropdownOption = {
/**
Expand Down Expand Up @@ -60,15 +61,6 @@ type ToggleProps = Partial<
as?: React.ElementType | keyof JSX.IntrinsicElements;
};

type MenuProps = {
onNavigate?: ( index: number, child: HTMLElement ) => void;
cycle?: boolean;
orientation?: 'horizontal' | 'vertical' | 'both';
role?: string;
'aria-label'?: string;
className?: string;
};

export type DropdownMenuProps = {
/**
* The Dashicon icon slug to be shown in the collapsed menu button.
Expand Down Expand Up @@ -111,8 +103,7 @@ export type DropdownMenuProps = {
* component that are not already exposed in the `DropdownMenu` component,
* e.g.: the orientation of the menu set with `orientation` prop.
*/
// TODO: NavigableContainer is currently being typed. Just import these props from it when they're available.
menuProps?: Omit< MenuProps, 'children' >;
menuProps?: Omit< Partial< NavigableMenuProps >, 'children' >;
/**
* In some contexts, the arrow down key used to open the dropdown menu might
* need to be disabled—for example when that key is used to perform another
Expand Down

0 comments on commit e994728

Please sign in to comment.