2022-10-28 16:09:38 +08:00
|
|
|
/* eslint-disable import/prefer-default-export */
|
2022-12-12 16:36:46 +08:00
|
|
|
import type { CSSInterpolation, CSSObject } from '@ant-design/cssinjs';
|
|
|
|
import type { DerivativeToken, FullToken } from '../theme/internal';
|
|
|
|
import type { OverrideComponent } from '../theme/util/genComponentStyleHook';
|
2022-10-28 16:09:38 +08:00
|
|
|
|
|
|
|
function compactItemVerticalBorder(token: DerivativeToken): CSSObject {
|
|
|
|
return {
|
|
|
|
// border collapse
|
|
|
|
'&-item:not(&-last-item)': {
|
2022-11-01 15:06:38 +08:00
|
|
|
marginBottom: -token.lineWidth,
|
2022-10-28 16:09:38 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'&-item': {
|
|
|
|
'&:hover,&:focus,&:active': {
|
|
|
|
zIndex: 2,
|
|
|
|
},
|
|
|
|
|
|
|
|
'&[disabled]': {
|
|
|
|
zIndex: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function compactItemBorderVerticalRadius(prefixCls: string): CSSObject {
|
|
|
|
return {
|
|
|
|
'&-item:not(&-first-item):not(&-last-item)': {
|
|
|
|
borderRadius: 0,
|
|
|
|
},
|
|
|
|
|
2022-11-24 12:10:54 +08:00
|
|
|
'&-item&-first-item:not(&-last-item)': {
|
2022-10-28 16:09:38 +08:00
|
|
|
[`&, &${prefixCls}-sm, &${prefixCls}-lg`]: {
|
|
|
|
borderEndEndRadius: 0,
|
|
|
|
borderEndStartRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-11-24 12:10:54 +08:00
|
|
|
'&-item&-last-item:not(&-first-item)': {
|
2022-10-28 16:09:38 +08:00
|
|
|
[`&, &${prefixCls}-sm, &${prefixCls}-lg`]: {
|
|
|
|
borderStartStartRadius: 0,
|
|
|
|
borderStartEndRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-12-12 16:36:46 +08:00
|
|
|
export function genCompactItemVerticalStyle<T extends OverrideComponent>(
|
|
|
|
token: FullToken<T>,
|
|
|
|
): CSSInterpolation {
|
2022-10-28 16:09:38 +08:00
|
|
|
return {
|
2022-12-12 16:36:46 +08:00
|
|
|
[`${token.componentCls}-compact-vertical`]: {
|
2022-10-28 16:09:38 +08:00
|
|
|
...compactItemVerticalBorder(token),
|
2022-12-12 16:36:46 +08:00
|
|
|
...compactItemBorderVerticalRadius(token.componentCls),
|
2022-10-28 16:09:38 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|