diff --git a/.changeset/dropdown-menu-theme-fixes.md b/.changeset/dropdown-menu-theme-fixes.md new file mode 100644 index 000000000000..e09227de0500 --- /dev/null +++ b/.changeset/dropdown-menu-theme-fixes.md @@ -0,0 +1,6 @@ +--- +'@astryxdesign/core': patch +--- + +[fix] DropdownMenu: make the submenu indicator icon and menu divider spacing actually themable. The `astryx-dropdown-menu-indicator-icon` target now sits on the chevron glyph itself (not the wrapper span), so a theme can restyle its size; and the menu divider's vertical margin is exposed via `--_dropdown-menu-divider-margin` so it can be retuned without out-specifying the global divider slot. +@athz diff --git a/packages/core/src/DropdownMenu/DropdownMenu.doc.mjs b/packages/core/src/DropdownMenu/DropdownMenu.doc.mjs index cd2456726008..1fd7c95f5a90 100644 --- a/packages/core/src/DropdownMenu/DropdownMenu.doc.mjs +++ b/packages/core/src/DropdownMenu/DropdownMenu.doc.mjs @@ -42,10 +42,12 @@ export const docs = { vars: [ {name: '--_dropdown-menu-radius', description: 'Border radius of the menu popup', default: 'var(--radius-element)', private: true}, {name: '--_dropdown-menu-padding', description: 'Inner padding of the menu popup', default: 'var(--spacing-1)', private: true}, + {name: '--_dropdown-menu-divider-margin', description: 'Vertical margin above and below a menu divider', default: 'var(--spacing-1)', private: true}, ], derived: [ {property: 'borderRadius', vars: ['--_dropdown-menu-radius']}, {property: 'padding', vars: ['--_dropdown-menu-padding']}, + {property: 'marginBlock', vars: ['--_dropdown-menu-divider-margin']}, ], }, description: 'Main dropdown menu component with a trigger button and popup item list.', diff --git a/packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx b/packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx index 23a2ace15bca..64d8a1862991 100644 --- a/packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +++ b/packages/core/src/DropdownMenu/DropdownMenuSubMenu.test.tsx @@ -671,10 +671,13 @@ describe('DropdownMenuSubMenu theming slots', () => { name: /Move to/, hidden: true, }); - // The indicator-icon slot wraps the chevron affordance inside the trigger - // row. - expect( - trigger.querySelector('.astryx-dropdown-menu-indicator-icon'), - ).toBeInTheDocument(); + // The indicator-icon slot sits on the chevron glyph itself (the element + // that carries the icon size), so a theme can restyle its size/color + // directly — not on the wrapper span, which could not reach the size. + const indicator = trigger.querySelector( + '.astryx-dropdown-menu-indicator-icon', + ); + expect(indicator).toBeInTheDocument(); + expect(indicator).toHaveClass('astryx-icon'); }); }); diff --git a/packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx b/packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx index dee734f2434a..6f23c13d65eb 100644 --- a/packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx +++ b/packages/core/src/DropdownMenu/DropdownMenuSubMenu.tsx @@ -474,20 +474,17 @@ export function DropdownMenuSubMenu( ); const endAffordance = hasSpinner ? ( - + ) : ( - - + + ); diff --git a/packages/core/src/DropdownMenu/renderDropdownItems.tsx b/packages/core/src/DropdownMenu/renderDropdownItems.tsx index 254387660ce7..886abdf00322 100644 --- a/packages/core/src/DropdownMenu/renderDropdownItems.tsx +++ b/packages/core/src/DropdownMenu/renderDropdownItems.tsx @@ -35,7 +35,11 @@ const styles = stylex.create({ userSelect: 'none', }, divider: { - marginBlock: spacingVars['--spacing-1'], + // Exposed as a themable var (default: the token) so a theme can retune the + // menu divider's vertical rhythm via `--_dropdown-menu-divider-margin` + // without out-specifying the global Divider slot. Matches the component's + // existing `--_dropdown-menu-*` private-var pattern. + marginBlock: `var(--_dropdown-menu-divider-margin, ${spacingVars['--spacing-1']})`, }, });