diff --git a/components/style/compact-item-vertical.ts b/components/style/compact-item-vertical.ts index 887388ce17..092fac7a7d 100644 --- a/components/style/compact-item-vertical.ts +++ b/components/style/compact-item-vertical.ts @@ -1,17 +1,25 @@ import type { CSSInterpolation, CSSObject } from '@ant-design/cssinjs'; -import type { AliasToken, FullToken, OverrideComponent, CSSUtil } from '../theme/internal'; +import type { AliasToken, CSSUtil, FullToken, OverrideComponent } from '../theme/internal'; -function compactItemVerticalBorder(token: AliasToken & CSSUtil, parentCls: string): CSSObject { +function compactItemVerticalBorder( + token: AliasToken & CSSUtil, + parentCls: string, + prefixCls: string, +): CSSObject { return { // border collapse [`&-item:not(${parentCls}-last-item)`]: { marginBottom: token.calc(token.lineWidth).mul(-1).equal(), }, + [`&-item:not(${prefixCls}-status-success)`]: { + zIndex: 2, + }, + '&-item': { '&:hover,&:focus,&:active': { - zIndex: 2, + zIndex: 3, }, '&[disabled]': { @@ -50,7 +58,7 @@ export function genCompactItemVerticalStyle( return { [compactCls]: { - ...compactItemVerticalBorder(token, compactCls), + ...compactItemVerticalBorder(token, compactCls, token.componentCls), ...compactItemBorderVerticalRadius(token.componentCls, compactCls), }, }; diff --git a/components/style/compact-item.ts b/components/style/compact-item.ts index 5d9934bcc0..b7d5c5e032 100644 --- a/components/style/compact-item.ts +++ b/components/style/compact-item.ts @@ -1,6 +1,6 @@ import type { CSSInterpolation, CSSObject } from '@ant-design/cssinjs'; -import type { AliasToken, FullToken, OverrideComponent, CSSUtil } from '../theme/internal'; +import type { AliasToken, CSSUtil, FullToken, OverrideComponent } from '../theme/internal'; interface CompactItemOptions { focus?: boolean; @@ -21,6 +21,7 @@ function compactItemBorder( token: AliasToken & CSSUtil, parentCls: string, options: CompactItemOptions, + prefixCls: string, ): CSSObject { const { focusElCls, focus, borderElCls } = options; const childCombinator = borderElCls ? '> *' : ''; @@ -28,20 +29,25 @@ function compactItemBorder( .filter(Boolean) .map((n) => `&:${n} ${childCombinator}`) .join(','); + return { [`&-item:not(${parentCls}-last-item)`]: { marginInlineEnd: token.calc(token.lineWidth).mul(-1).equal(), }, + [`&-item:not(${prefixCls}-status-success)`]: { + zIndex: 2, + }, + '&-item': { [hoverEffects]: { - zIndex: 2, + zIndex: 3, }, ...(focusElCls ? { [`&${focusElCls}`]: { - zIndex: 2, + zIndex: 3, }, } : {}), @@ -95,7 +101,7 @@ export function genCompactItemStyle( return { [compactCls]: { - ...compactItemBorder(token, compactCls, options), + ...compactItemBorder(token, compactCls, options, componentCls), ...compactItemBorderRadius(componentCls, compactCls, options), }, };