diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 9a3beb03423964..3fb47c5e3b3ec6 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,13 +2,14 @@ ## Unreleased -### Enhancements +### Enhancements - `Button`: Add focus rings to focusable disabled buttons ([#56383](https://github.com/WordPress/gutenberg/pull/56383)). ### Experimental - `Tabs`: Memoize and expose the component context ([#56224](https://github.com/WordPress/gutenberg/pull/56224)). +- `DropdownMenuV2`: Design tweaks ([#56041](https://github.com/WordPress/gutenberg/pull/56041)) ### Internal diff --git a/packages/components/src/dropdown-menu-v2-ariakit/README.md b/packages/components/src/dropdown-menu-v2-ariakit/README.md index f74098efff4103..2902b541169766 100644 --- a/packages/components/src/dropdown-menu-v2-ariakit/README.md +++ b/packages/components/src/dropdown-menu-v2-ariakit/README.md @@ -284,9 +284,9 @@ Event handler called when the checked radio menu item changes. - Required: no -### `DropdownMenuGroup` +### `DropdownMenuItemLabel` -Used to group menu items. +Used to render the menu item's label. #### Props @@ -294,13 +294,27 @@ The component accepts the following props: ##### `children`: `React.ReactNode` -The contents of the group. +The label contents. + +- Required: yes + +### `DropdownMenuItemHelpText` + +Used to render the menu item's help text. + +#### Props + +The component accepts the following props: + +##### `children`: `React.ReactNode` + +The help text contents. - Required: yes -### `DropdownMenuGroupLabel` +### `DropdownMenuGroup` -Used to render a group label. +Used to group menu items. #### Props diff --git a/packages/components/src/dropdown-menu-v2-ariakit/index.tsx b/packages/components/src/dropdown-menu-v2-ariakit/index.tsx index 10b93d8c552c13..37d4a1f9cfcc5e 100644 --- a/packages/components/src/dropdown-menu-v2-ariakit/index.tsx +++ b/packages/components/src/dropdown-menu-v2-ariakit/index.tsx @@ -30,7 +30,6 @@ import type { DropdownMenuContext as DropdownMenuContextType, DropdownMenuProps, DropdownMenuGroupProps, - DropdownMenuGroupLabelProps, DropdownMenuItemProps, DropdownMenuCheckboxItemProps, DropdownMenuRadioItemProps, @@ -55,16 +54,23 @@ export const DropdownMenuItem = forwardRef< - { prefix && ( - { prefix } - ) } - { children } - { suffix && ( - { suffix } - ) } + { prefix } + + + + { children } + + + { suffix && ( + + { suffix } + + ) } + ); } ); @@ -82,20 +88,30 @@ export const DropdownMenuCheckboxItem = forwardRef< } + // Override some ariakit inline styles + style={ { width: 'auto', height: 'auto' } } > - { children } - { suffix && ( - { suffix } - ) } + + + { children } + + + { suffix && ( + + { suffix } + + ) } + ); } ); @@ -119,17 +135,30 @@ export const DropdownMenuRadioItem = forwardRef< } + // Override some ariakit inline styles + style={ { width: 'auto', height: 'auto' } } > - { children } - { suffix } + + + + { children } + + + { suffix && ( + + { suffix } + + ) } + ); } ); @@ -148,20 +177,6 @@ export const DropdownMenuGroup = forwardRef< ); } ); -export const DropdownMenuGroupLabel = forwardRef< - HTMLDivElement, - WordPressComponentProps< DropdownMenuGroupLabelProps, 'div', false > ->( function DropdownMenuGroupLabel( props, ref ) { - const dropdownMenuContext = useContext( DropdownMenuContext ); - return ( - - ); -} ); - const UnconnectedDropdownMenu = ( props: WordPressComponentProps< DropdownMenuProps, 'div', false >, ref: React.ForwardedRef< HTMLDivElement > @@ -280,12 +295,16 @@ const UnconnectedDropdownMenu = ( dropdownMenuStore.parent ? cloneElement( trigger, { // Add submenu arrow, unless a `suffix` is explicitly specified - suffix: trigger.props.suffix ?? ( -