diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index c97e25862addec..357427f8f3443c 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -69,6 +69,7 @@ - `Composite` v2: add `Hover` and `Typeahead` subcomponents ([#64399](https://github.com/WordPress/gutenberg/pull/64399)). - `Composite` v2: add focus-related props to `Composite`and`Composite.Item` subcomponents ([#64450](https://github.com/WordPress/gutenberg/pull/64450)). - `Composite` v2: add `Context` subcomponent ([#64493](https://github.com/WordPress/gutenberg/pull/64493)). +- `DropdownMenu` v2: use themed color variables ([#64647](https://github.com/WordPress/gutenberg/pull/64647)). - `CustomSelectControl`: Improve type inferring ([#64412](https://github.com/WordPress/gutenberg/pull/64412)). - Update `ariakit` to version `0.4.10` ([#64637](https://github.com/WordPress/gutenberg/pull/64637)). diff --git a/packages/components/src/dropdown-menu-v2/styles.ts b/packages/components/src/dropdown-menu-v2/styles.ts index 3260a83f45f1c1..9e71316b6b9dc5 100644 --- a/packages/components/src/dropdown-menu-v2/styles.ts +++ b/packages/components/src/dropdown-menu-v2/styles.ts @@ -25,12 +25,14 @@ const ITEM_PADDING_BLOCK = space( 2 ); const ITEM_PADDING_INLINE = space( 3 ); // TODO: -// - those values are different from saved variables? -// - should bring this into the config, and make themeable -// - border color and divider color are different? -const DEFAULT_BORDER_COLOR = COLORS.gray[ 300 ]; -const DIVIDER_COLOR = COLORS.gray[ 200 ]; -const TOOLBAR_VARIANT_BORDER_COLOR = COLORS.gray[ '900' ]; +// - border color and divider color are different from COLORS.theme variables +// - lighter text color is not defined in COLORS.theme, should it be? +// - lighter background color is not defined in COLORS.theme, should it be? +const DEFAULT_BORDER_COLOR = COLORS.theme.gray[ 300 ]; +const DIVIDER_COLOR = COLORS.theme.gray[ 200 ]; +const LIGHTER_TEXT_COLOR = COLORS.theme.gray[ 700 ]; +const LIGHT_BACKGROUND_COLOR = COLORS.theme.gray[ 100 ]; +const TOOLBAR_VARIANT_BORDER_COLOR = COLORS.theme.foreground; const DEFAULT_BOX_SHADOW = `0 0 0 ${ CONFIG.borderWidth } ${ DEFAULT_BORDER_COLOR }, ${ CONFIG.elevationXSmall }`; const TOOLBAR_VARIANT_BOX_SHADOW = `0 0 0 ${ CONFIG.borderWidth } ${ TOOLBAR_VARIANT_BORDER_COLOR }`; @@ -149,7 +151,7 @@ const baseItem = css` font-weight: normal; line-height: 20px; - color: ${ COLORS.gray[ 900 ] }; + color: ${ COLORS.theme.foreground }; border-radius: ${ CONFIG.radiusSmall }; padding-block: ${ ITEM_PADDING_BLOCK }; @@ -193,8 +195,8 @@ const baseItem = css` /* When the item is the trigger of an open submenu */ ${ DropdownMenu }:not(:focus) &:not(:focus)[aria-expanded="true"] { - background-color: ${ COLORS.gray[ 100 ] }; - color: ${ COLORS.gray[ 900 ] }; + background-color: ${ LIGHT_BACKGROUND_COLOR }; + color: ${ COLORS.theme.foreground }; } svg { @@ -238,7 +240,7 @@ export const ItemPrefixWrapper = styled.span` align-items: center; justify-content: center; - color: ${ COLORS.gray[ '700' ] }; + color: ${ LIGHTER_TEXT_COLOR }; /* * When the parent menu item is active, except when it's a non-focused/hovered @@ -284,7 +286,7 @@ export const ItemSuffixWrapper = styled.span` justify-content: center; gap: ${ space( 3 ) }; - color: ${ COLORS.gray[ '700' ] }; + color: ${ LIGHTER_TEXT_COLOR }; /* * When the parent menu item is active, except when it's a non-focused/hovered @@ -343,7 +345,7 @@ export const DropdownMenuItemLabel = styled( Truncate )` export const DropdownMenuItemHelpText = styled( Truncate )` font-size: ${ font( 'helpText.fontSize' ) }; line-height: 16px; - color: ${ COLORS.gray[ '700' ] }; + color: ${ LIGHTER_TEXT_COLOR }; word-break: break-all; [data-active-item]:not( [data-focus-visible] ) *:not( ${ DropdownMenu } ) &,