feat: Menu support CSS Var (#8323)

Co-authored-by: songsichen <songsichen@qianxin.com>
feat-4.3
Shuhari 2025-08-23 09:16:56 +08:00 committed by GitHub
parent c9443e038b
commit 0410908cd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 847 additions and 281 deletions

View File

@ -43,6 +43,7 @@ import type { ItemType } from './hooks/useItems';
import useItems from './hooks/useItems'; import useItems from './hooks/useItems';
import useStyle from '../style'; import useStyle from '../style';
import { useInjectOverride } from './OverrideContext'; import { useInjectOverride } from './OverrideContext';
import useCSSVarCls from '../../config-provider/hooks/useCssVarCls';
export const menuProps = () => ({ export const menuProps = () => ({
id: String, id: String,
@ -106,8 +107,10 @@ export default defineComponent({
const prefixCls = computed(() => { const prefixCls = computed(() => {
return getPrefixCls('menu', props.prefixCls || override?.prefixCls?.value); return getPrefixCls('menu', props.prefixCls || override?.prefixCls?.value);
}); });
const [wrapSSR, hashId] = useStyle( const rootCls = useCSSVarCls(prefixCls);
const [wrapSSR, hashId, cssVarCls] = useStyle(
prefixCls, prefixCls,
rootCls,
computed(() => { computed(() => {
return !override; return !override;
}), }),
@ -336,6 +339,8 @@ export default defineComponent({
[`${prefixCls.value}-inline-collapsed`]: mergedInlineCollapsed.value, [`${prefixCls.value}-inline-collapsed`]: mergedInlineCollapsed.value,
[`${prefixCls.value}-rtl`]: isRtl.value, [`${prefixCls.value}-rtl`]: isRtl.value,
[`${prefixCls.value}-${props.theme}`]: true, [`${prefixCls.value}-${props.theme}`]: true,
[rootCls.value]: true,
[cssVarCls.value]: true,
}; };
}); });
const rootPrefixCls = computed(() => getPrefixCls()); const rootPrefixCls = computed(() => getPrefixCls());
@ -411,6 +416,7 @@ export default defineComponent({
); );
useProvideMenu({ useProvideMenu({
prefixCls, prefixCls,
cssVarCls: computed(() => `${rootCls.value} ${cssVarCls.value}`),
activeKeys, activeKeys,
openKeys: mergedOpenKeys, openKeys: mergedOpenKeys,
selectedKeys: mergedSelectedKeys, selectedKeys: mergedSelectedKeys,

View File

@ -103,6 +103,7 @@ export default defineComponent({
const { const {
prefixCls, prefixCls,
cssVarCls,
activeKeys, activeKeys,
disabled: contextDisabled, disabled: contextDisabled,
changeActiveKeys, changeActiveKeys,
@ -210,6 +211,7 @@ export default defineComponent({
const popupClassName = computed(() => const popupClassName = computed(() =>
classNames( classNames(
cssVarCls.value,
prefixCls.value, prefixCls.value,
`${prefixCls.value}-${props.theme || theme.value}`, `${prefixCls.value}-${props.theme || theme.value}`,
props.popupClassName, props.popupClassName,

View File

@ -23,6 +23,7 @@ export interface MenuContextProps {
registerMenuInfo: (key: string, info: StoreMenuInfo) => void; registerMenuInfo: (key: string, info: StoreMenuInfo) => void;
unRegisterMenuInfo: (key: string) => void; unRegisterMenuInfo: (key: string) => void;
prefixCls: ComputedRef<string>; prefixCls: ComputedRef<string>;
cssVarCls: ComputedRef<string>;
openKeys: Ref<Key[]>; openKeys: Ref<Key[]>;
selectedKeys: Ref<Key[]>; selectedKeys: Ref<Key[]>;

View File

@ -1,3 +1,4 @@
import { unit } from '../../_util/cssinjs';
import type { MenuToken } from '.'; import type { MenuToken } from '.';
import type { GenerateStyle } from '../../theme/internal'; import type { GenerateStyle } from '../../theme/internal';
@ -5,18 +6,18 @@ const getHorizontalStyle: GenerateStyle<MenuToken> = token => {
const { const {
componentCls, componentCls,
motionDurationSlow, motionDurationSlow,
menuHorizontalHeight, horizontalLineHeight,
colorSplit, colorSplit,
lineWidth, lineWidth,
lineType, lineType,
menuItemPaddingInline, itemPaddingInline,
} = token; } = token;
return { return {
[`${componentCls}-horizontal`]: { [`${componentCls}-horizontal`]: {
lineHeight: `${menuHorizontalHeight}px`, lineHeight: horizontalLineHeight,
border: 0, border: 0,
borderBottom: `${lineWidth}px ${lineType} ${colorSplit}`, borderBottom: `${unit(lineWidth)} ${lineType} ${colorSplit}`,
boxShadow: 'none', boxShadow: 'none',
'&::after': { '&::after': {
@ -31,7 +32,7 @@ const getHorizontalStyle: GenerateStyle<MenuToken> = token => {
position: 'relative', position: 'relative',
display: 'inline-block', display: 'inline-block',
verticalAlign: 'bottom', verticalAlign: 'bottom',
paddingInline: menuItemPaddingInline, paddingInline: itemPaddingInline,
}, },
[`> ${componentCls}-item:hover, [`> ${componentCls}-item:hover,

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,14 @@
import { unit } from '../../_util/cssinjs';
import type { CSSUtil } from '../../theme/util/genComponentStyleHook';
import type { MenuToken } from '.'; import type { MenuToken } from '.';
import type { GenerateStyle } from '../../theme/internal'; import type { GenerateStyle } from '../../theme/internal';
const getRTLStyle: GenerateStyle<MenuToken> = ({ componentCls, menuArrowOffset }) => ({ const getRTLStyle: GenerateStyle<MenuToken & CSSUtil> = ({
componentCls,
menuArrowOffset,
calc,
}) => ({
[`${componentCls}-rtl`]: { [`${componentCls}-rtl`]: {
direction: 'rtl', direction: 'rtl',
}, },
@ -15,11 +22,11 @@ const getRTLStyle: GenerateStyle<MenuToken> = ({ componentCls, menuArrowOffset }
${componentCls}-submenu-rtl ${componentCls}-vertical`]: { ${componentCls}-submenu-rtl ${componentCls}-vertical`]: {
[`${componentCls}-submenu-arrow`]: { [`${componentCls}-submenu-arrow`]: {
'&::before': { '&::before': {
transform: `rotate(-45deg) translateY(-${menuArrowOffset})`, transform: `rotate(-45deg) translateY(${unit(calc(menuArrowOffset).mul(-1).equal())})`,
}, },
'&::after': { '&::after': {
transform: `rotate(45deg) translateY(${menuArrowOffset})`, transform: `rotate(45deg) translateY(${unit(menuArrowOffset)})`,
}, },
}, },
}, },

View File

@ -1,6 +1,7 @@
import type { CSSInterpolation } from '../../_util/cssinjs'; import { unit, CSSInterpolation } from '../../_util/cssinjs';
import { genFocusOutline } from '../../style';
import type { MenuToken } from '.'; import type { MenuToken } from '.';
import { genFocusOutline } from '../../style';
const accessibilityFocus = (token: MenuToken) => ({ const accessibilityFocus = (token: MenuToken) => ({
...genFocusOutline(token), ...genFocusOutline(token),
@ -9,108 +10,121 @@ const accessibilityFocus = (token: MenuToken) => ({
const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation => { const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation => {
const { const {
componentCls, componentCls,
colorItemText, itemColor,
colorItemTextSelected, itemSelectedColor,
colorGroupTitle, subMenuItemSelectedColor,
colorItemBg, groupTitleColor,
colorSubItemBg, itemBg,
colorItemBgSelected, subMenuItemBg,
colorActiveBarHeight, itemSelectedBg,
colorActiveBarWidth, activeBarHeight,
colorActiveBarBorderSize, activeBarWidth,
activeBarBorderWidth,
motionDurationSlow, motionDurationSlow,
motionEaseInOut, motionEaseInOut,
motionEaseOut, motionEaseOut,
menuItemPaddingInline, itemPaddingInline,
motionDurationMid, motionDurationMid,
colorItemTextHover, itemHoverColor,
lineType, lineType,
colorSplit, colorSplit,
// Disabled // Disabled
colorItemTextDisabled, itemDisabledColor,
// Danger // Danger
colorDangerItemText, dangerItemColor,
colorDangerItemTextHover, dangerItemHoverColor,
colorDangerItemTextSelected, dangerItemSelectedColor,
colorDangerItemBgActive, dangerItemActiveBg,
colorDangerItemBgSelected, dangerItemSelectedBg,
// Bg
colorItemBgHover, popupBg,
itemHoverBg,
itemActiveBg,
menuSubMenuBg, menuSubMenuBg,
// Horizontal // Horizontal
colorItemTextSelectedHorizontal, horizontalItemSelectedColor,
colorItemBgSelectedHorizontal, horizontalItemSelectedBg,
horizontalItemBorderRadius,
horizontalItemHoverBg,
} = token; } = token;
return { return {
[`${componentCls}-${themeSuffix}`]: { [`${componentCls}-${themeSuffix}, ${componentCls}-${themeSuffix} > ${componentCls}`]: {
color: colorItemText, color: itemColor,
background: colorItemBg, background: itemBg,
[`&${componentCls}-root:focus-visible`]: { [`&${componentCls}-root:focus-visible`]: {
...accessibilityFocus(token), ...accessibilityFocus(token),
}, },
// ======================== Item ======================== // ======================== Item ========================
[`${componentCls}-item-group-title`]: { [`${componentCls}-item`]: {
color: colorGroupTitle, '&-group-title, &-extra': {
color: groupTitleColor,
},
}, },
[`${componentCls}-submenu-selected`]: { [`${componentCls}-submenu-selected > ${componentCls}-submenu-title`]: {
[`> ${componentCls}-submenu-title`]: { color: subMenuItemSelectedColor,
color: colorItemTextSelected, },
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
color: itemColor,
[`&:not(${componentCls}-item-disabled):focus-visible`]: {
...accessibilityFocus(token),
}, },
}, },
// Disabled // Disabled
[`${componentCls}-item-disabled, ${componentCls}-submenu-disabled`]: { [`${componentCls}-item-disabled, ${componentCls}-submenu-disabled`]: {
color: `${colorItemTextDisabled} !important`, color: `${itemDisabledColor} !important`,
}, },
// Hover // Hover
[`${componentCls}-item:hover, ${componentCls}-submenu-title:hover`]: { [`${componentCls}-item:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]:
[`&:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]: { {
color: colorItemTextHover, [`&:hover, > ${componentCls}-submenu-title:hover`]: {
color: itemHoverColor,
}, },
}, },
[`&:not(${componentCls}-horizontal)`]: { [`&:not(${componentCls}-horizontal)`]: {
[`${componentCls}-item:not(${componentCls}-item-selected)`]: { [`${componentCls}-item:not(${componentCls}-item-selected)`]: {
'&:hover': { '&:hover': {
backgroundColor: colorItemBgHover, backgroundColor: itemHoverBg,
}, },
'&:active': { '&:active': {
backgroundColor: colorItemBgSelected, backgroundColor: itemActiveBg,
}, },
}, },
[`${componentCls}-submenu-title`]: { [`${componentCls}-submenu-title`]: {
'&:hover': { '&:hover': {
backgroundColor: colorItemBgHover, backgroundColor: itemHoverBg,
}, },
'&:active': { '&:active': {
backgroundColor: colorItemBgSelected, backgroundColor: itemActiveBg,
}, },
}, },
}, },
// Danger - only Item has // Danger - only Item has
[`${componentCls}-item-danger`]: { [`${componentCls}-item-danger`]: {
color: colorDangerItemText, color: dangerItemColor,
[`&${componentCls}-item:hover`]: { [`&${componentCls}-item:hover`]: {
[`&:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]: { [`&:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]: {
color: colorDangerItemTextHover, color: dangerItemHoverColor,
}, },
}, },
[`&${componentCls}-item:active`]: { [`&${componentCls}-item:active`]: {
background: colorDangerItemBgActive, background: dangerItemActiveBg,
}, },
}, },
@ -121,30 +135,24 @@ const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation
}, },
[`${componentCls}-item-selected`]: { [`${componentCls}-item-selected`]: {
color: colorItemTextSelected, color: itemSelectedColor,
// Danger // Danger
[`&${componentCls}-item-danger`]: { [`&${componentCls}-item-danger`]: {
color: colorDangerItemTextSelected, color: dangerItemSelectedColor,
}, },
[`a, a:hover`]: { 'a, a:hover': {
color: 'inherit', color: 'inherit',
}, },
}, },
[`& ${componentCls}-item-selected`]: { [`& ${componentCls}-item-selected`]: {
backgroundColor: colorItemBgSelected, backgroundColor: itemSelectedBg,
// Danger // Danger
[`&${componentCls}-item-danger`]: { [`&${componentCls}-item-danger`]: {
backgroundColor: colorDangerItemBgSelected, backgroundColor: dangerItemSelectedBg,
},
},
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
[`&:not(${componentCls}-item-disabled):focus-visible`]: {
...accessibilityFocus(token),
}, },
}, },
@ -152,10 +160,17 @@ const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation
backgroundColor: menuSubMenuBg, backgroundColor: menuSubMenuBg,
}, },
// ===== 设置浮层的颜色 =======
// dark 模式会被popupBg 会被rest 为 darkPopupBg
[`&${componentCls}-popup > ${componentCls}`]: { [`&${componentCls}-popup > ${componentCls}`]: {
backgroundColor: colorItemBg, backgroundColor: popupBg,
}, },
[`&${componentCls}-submenu-popup > ${componentCls}`]: {
backgroundColor: popupBg,
},
// ===== 设置浮层的颜色 end =======
// ====================== Horizontal ====================== // ====================== Horizontal ======================
[`&${componentCls}-horizontal`]: { [`&${componentCls}-horizontal`]: {
...(themeSuffix === 'dark' ...(themeSuffix === 'dark'
@ -165,32 +180,36 @@ const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation
: {}), : {}),
[`> ${componentCls}-item, > ${componentCls}-submenu`]: { [`> ${componentCls}-item, > ${componentCls}-submenu`]: {
top: colorActiveBarBorderSize, top: activeBarBorderWidth,
marginTop: -colorActiveBarBorderSize, marginTop: token.calc(activeBarBorderWidth).mul(-1).equal(),
marginBottom: 0, marginBottom: 0,
borderRadius: 0, borderRadius: horizontalItemBorderRadius,
'&::after': { '&::after': {
position: 'absolute', position: 'absolute',
insetInline: menuItemPaddingInline, insetInline: itemPaddingInline,
bottom: 0, bottom: 0,
borderBottom: `${colorActiveBarHeight}px solid transparent`, borderBottom: `${unit(activeBarHeight)} solid transparent`,
transition: `border-color ${motionDurationSlow} ${motionEaseInOut}`, transition: `border-color ${motionDurationSlow} ${motionEaseInOut}`,
content: '""', content: '""',
}, },
[`&:hover, &-active, &-open`]: { '&:hover, &-active, &-open': {
background: horizontalItemHoverBg,
'&::after': { '&::after': {
borderBottomWidth: colorActiveBarHeight, borderBottomWidth: activeBarHeight,
borderBottomColor: colorItemTextSelectedHorizontal, borderBottomColor: horizontalItemSelectedColor,
}, },
}, },
[`&-selected`]: { '&-selected': {
color: colorItemTextSelectedHorizontal, color: horizontalItemSelectedColor,
backgroundColor: colorItemBgSelectedHorizontal, backgroundColor: horizontalItemSelectedBg,
'&:hover': {
backgroundColor: horizontalItemSelectedBg,
},
'&::after': { '&::after': {
borderBottomWidth: colorActiveBarHeight, borderBottomWidth: activeBarHeight,
borderBottomColor: colorItemTextSelectedHorizontal, borderBottomColor: horizontalItemSelectedColor,
}, },
}, },
}, },
@ -200,7 +219,7 @@ const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation
// //
[`&${componentCls}-root`]: { [`&${componentCls}-root`]: {
[`&${componentCls}-inline, &${componentCls}-vertical`]: { [`&${componentCls}-inline, &${componentCls}-vertical`]: {
borderInlineEnd: `${colorActiveBarBorderSize}px ${lineType} ${colorSplit}`, borderInlineEnd: `${unit(activeBarBorderWidth)} ${lineType} ${colorSplit}`,
}, },
}, },
@ -208,17 +227,9 @@ const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation
[`&${componentCls}-inline`]: { [`&${componentCls}-inline`]: {
// Sub // Sub
[`${componentCls}-sub${componentCls}-inline`]: { [`${componentCls}-sub${componentCls}-inline`]: {
background: colorSubItemBg, background: subMenuItemBg,
}, },
// Item
[`${componentCls}-item, ${componentCls}-submenu-title`]:
colorActiveBarBorderSize && colorActiveBarWidth
? {
width: `calc(100% + ${colorActiveBarBorderSize}px)`,
}
: {},
[`${componentCls}-item`]: { [`${componentCls}-item`]: {
position: 'relative', position: 'relative',
@ -226,7 +237,7 @@ const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation
position: 'absolute', position: 'absolute',
insetBlock: 0, insetBlock: 0,
insetInlineEnd: 0, insetInlineEnd: 0,
borderInlineEnd: `${colorActiveBarWidth}px solid ${colorItemTextSelected}`, borderInlineEnd: `${unit(activeBarWidth)} solid ${itemSelectedColor}`,
transform: 'scaleY(0.0001)', transform: 'scaleY(0.0001)',
opacity: 0, opacity: 0,
transition: [ transition: [
@ -239,7 +250,7 @@ const getThemeStyle = (token: MenuToken, themeSuffix: string): CSSInterpolation
// Danger // Danger
[`&${componentCls}-item-danger`]: { [`&${componentCls}-item-danger`]: {
'&::after': { '&::after': {
borderInlineEndColor: colorDangerItemTextSelected, borderInlineEndColor: dangerItemSelectedColor,
}, },
}, },
}, },

View File

@ -1,47 +1,44 @@
import type { CSSObject } from '../../_util/cssinjs'; import { unit, CSSObject } from '../../_util/cssinjs';
import { textEllipsis } from '../../style';
import type { MenuToken } from '.'; import type { MenuToken } from '.';
import { textEllipsis } from '../../style';
import type { GenerateStyle } from '../../theme/internal'; import type { GenerateStyle } from '../../theme/internal';
const getVerticalInlineStyle: GenerateStyle<MenuToken, CSSObject> = token => { const getVerticalInlineStyle: GenerateStyle<MenuToken, CSSObject> = token => {
const { const {
componentCls, componentCls,
menuItemHeight, itemHeight,
itemMarginInline, itemMarginInline,
padding, padding,
menuArrowSize, menuArrowSize,
marginXS, marginXS,
marginXXS, itemMarginBlock,
itemWidth,
itemPaddingInline,
} = token; } = token;
const paddingWithArrow = padding + menuArrowSize + marginXS; const paddingWithArrow = token.calc(menuArrowSize).add(padding).add(marginXS).equal();
return { return {
[`${componentCls}-item`]: { [`${componentCls}-item`]: {
position: 'relative', position: 'relative',
overflow: 'hidden',
}, },
[`${componentCls}-item, ${componentCls}-submenu-title`]: { [`${componentCls}-item, ${componentCls}-submenu-title`]: {
height: menuItemHeight, height: itemHeight,
lineHeight: `${menuItemHeight}px`, lineHeight: unit(itemHeight),
paddingInline: padding, paddingInline: itemPaddingInline,
overflow: 'hidden', overflow: 'hidden',
textOverflow: 'ellipsis', textOverflow: 'ellipsis',
marginInline: itemMarginInline, marginInline: itemMarginInline,
marginBlock: marginXXS, marginBlock: itemMarginBlock,
width: `calc(100% - ${itemMarginInline * 2}px)`, width: itemWidth,
},
// disable margin collapsed
[`${componentCls}-submenu`]: {
paddingBottom: 0.02,
}, },
[`> ${componentCls}-item, [`> ${componentCls}-item,
> ${componentCls}-submenu > ${componentCls}-submenu-title`]: { > ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
height: menuItemHeight, height: itemHeight,
lineHeight: `${menuItemHeight}px`, lineHeight: unit(itemHeight),
}, },
[`${componentCls}-item-group-list ${componentCls}-submenu-title, [`${componentCls}-item-group-list ${componentCls}-submenu-title,
@ -55,23 +52,25 @@ const getVerticalStyle: GenerateStyle<MenuToken> = token => {
const { const {
componentCls, componentCls,
iconCls, iconCls,
menuItemHeight, itemHeight,
colorTextLightSolid, colorTextLightSolid,
dropdownWidth, dropdownWidth,
controlHeightLG, controlHeightLG,
motionDurationMid,
motionEaseOut, motionEaseOut,
paddingXL, paddingXL,
fontSizeSM, itemMarginInline,
fontSizeLG, fontSizeLG,
motionDurationFast,
motionDurationSlow, motionDurationSlow,
paddingXS, paddingXS,
boxShadowSecondary, boxShadowSecondary,
collapsedWidth,
collapsedIconSize,
} = token; } = token;
const inlineItemStyle: CSSObject = { const inlineItemStyle: CSSObject = {
height: menuItemHeight, height: itemHeight,
lineHeight: `${menuItemHeight}px`, lineHeight: unit(itemHeight),
listStylePosition: 'inside', listStylePosition: 'inside',
listStyleType: 'disc', listStyleType: 'disc',
}; };
@ -79,7 +78,7 @@ const getVerticalStyle: GenerateStyle<MenuToken> = token => {
return [ return [
{ {
[componentCls]: { [componentCls]: {
[`&-inline, &-vertical`]: { '&-inline, &-vertical': {
[`&${componentCls}-root`]: { [`&${componentCls}-root`]: {
boxShadow: 'none', boxShadow: 'none',
}, },
@ -100,7 +99,7 @@ const getVerticalStyle: GenerateStyle<MenuToken> = token => {
{ {
[`${componentCls}-submenu-popup ${componentCls}-vertical${componentCls}-sub`]: { [`${componentCls}-submenu-popup ${componentCls}-vertical${componentCls}-sub`]: {
minWidth: dropdownWidth, minWidth: dropdownWidth,
maxHeight: `calc(100vh - ${controlHeightLG * 2.5}px)`, maxHeight: `calc(100vh - ${unit(token.calc(controlHeightLG).mul(2.5).equal())})`,
padding: '0', padding: '0',
overflow: 'hidden', overflow: 'hidden',
borderInlineEnd: 0, borderInlineEnd: 0,
@ -127,7 +126,7 @@ const getVerticalStyle: GenerateStyle<MenuToken> = token => {
transition: [ transition: [
`border-color ${motionDurationSlow}`, `border-color ${motionDurationSlow}`,
`background ${motionDurationSlow}`, `background ${motionDurationSlow}`,
`padding ${motionDurationMid} ${motionEaseOut}`, `padding ${motionDurationFast} ${motionEaseOut}`,
].join(','), ].join(','),
[`> ${componentCls}-title-content`]: { [`> ${componentCls}-title-content`]: {
@ -165,7 +164,7 @@ const getVerticalStyle: GenerateStyle<MenuToken> = token => {
// Inline Collapse Only // Inline Collapse Only
{ {
[`${componentCls}-inline-collapsed`]: { [`${componentCls}-inline-collapsed`]: {
width: menuItemHeight * 2, width: collapsedWidth,
[`&${componentCls}-root`]: { [`&${componentCls}-root`]: {
[`${componentCls}-item, ${componentCls}-submenu ${componentCls}-submenu-title`]: { [`${componentCls}-item, ${componentCls}-submenu ${componentCls}-submenu-title`]: {
@ -181,7 +180,9 @@ const getVerticalStyle: GenerateStyle<MenuToken> = token => {
> ${componentCls}-item-group > ${componentCls}-item-group-list > ${componentCls}-submenu > ${componentCls}-submenu-title, > ${componentCls}-item-group > ${componentCls}-item-group-list > ${componentCls}-submenu > ${componentCls}-submenu-title,
> ${componentCls}-submenu > ${componentCls}-submenu-title`]: { > ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
insetInlineStart: 0, insetInlineStart: 0,
paddingInline: `calc(50% - ${fontSizeSM}px)`, paddingInline: `calc(50% - ${unit(token.calc(collapsedIconSize).div(2).equal())} - ${unit(
itemMarginInline,
)})`,
textOverflow: 'clip', textOverflow: 'clip',
[` [`
@ -193,8 +194,8 @@ const getVerticalStyle: GenerateStyle<MenuToken> = token => {
[`${componentCls}-item-icon, ${iconCls}`]: { [`${componentCls}-item-icon, ${iconCls}`]: {
margin: 0, margin: 0,
fontSize: fontSizeLG, fontSize: collapsedIconSize,
lineHeight: `${menuItemHeight}px`, lineHeight: unit(itemHeight),
'+ span': { '+ span': {
display: 'inline-block', display: 'inline-block',