2023-05-22 10:20:38 +08:00
|
|
|
import type { CSSProperties } from 'react';
|
2024-04-08 14:04:08 +08:00
|
|
|
import { unit } from '@ant-design/cssinjs';
|
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
|
|
|
|
2023-01-29 02:26:28 +08:00
|
|
|
import { resetComponent } from '../../style';
|
2023-11-13 15:16:06 +08:00
|
|
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
2023-11-29 17:23:45 +08:00
|
|
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
2022-04-08 17:43:44 +08:00
|
|
|
|
2022-05-16 17:52:35 +08:00
|
|
|
export interface ComponentToken {
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 内容宽度
|
|
|
|
* @descEN Width of content
|
|
|
|
*/
|
2024-07-10 23:15:06 +08:00
|
|
|
contentWidth: number | string;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 大号列表项内间距
|
|
|
|
* @descEN Padding of large item
|
|
|
|
*/
|
2023-05-22 10:20:38 +08:00
|
|
|
itemPaddingLG: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 小号列表项内间距
|
|
|
|
* @descEN Padding of small item
|
|
|
|
*/
|
2023-05-22 10:20:38 +08:00
|
|
|
itemPaddingSM: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 列表项内间距
|
|
|
|
* @descEN Padding of item
|
|
|
|
*/
|
2023-05-22 10:20:38 +08:00
|
|
|
itemPadding: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 头部区域背景色
|
|
|
|
* @descEN Background color of header
|
|
|
|
*/
|
2023-05-22 10:20:38 +08:00
|
|
|
headerBg: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 底部区域背景色
|
|
|
|
* @descEN Background color of footer
|
|
|
|
*/
|
2023-05-22 10:20:38 +08:00
|
|
|
footerBg: string;
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 空文本内边距
|
|
|
|
* @descEN Padding of empty text
|
|
|
|
*/
|
2023-05-22 10:20:38 +08:00
|
|
|
emptyTextPadding: CSSProperties['padding'];
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc Meta 下间距
|
|
|
|
* @descEN Margin bottom of meta
|
|
|
|
*/
|
2023-05-22 10:20:38 +08:00
|
|
|
metaMarginBottom: CSSProperties['marginBottom'];
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 头像右间距
|
|
|
|
* @descEN Right margin of avatar
|
|
|
|
*/
|
2023-05-22 10:20:38 +08:00
|
|
|
avatarMarginRight: CSSProperties['marginRight'];
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 标题下间距
|
|
|
|
* @descEN Margin bottom of title
|
|
|
|
*/
|
2023-05-22 10:20:38 +08:00
|
|
|
titleMarginBottom: CSSProperties['marginBottom'];
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 描述文字大小
|
|
|
|
* @descEN Font size of description
|
|
|
|
*/
|
2023-05-22 10:20:38 +08:00
|
|
|
descriptionFontSize: number;
|
2022-05-16 17:52:35 +08:00
|
|
|
}
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
interface ListToken extends FullToken<'List'> {
|
2022-04-01 10:23:34 +08:00
|
|
|
listBorderedCls: string;
|
2024-07-10 23:15:06 +08:00
|
|
|
minHeight: number | string;
|
2022-04-01 10:23:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const genBorderedStyle = (token: ListToken): CSSObject => {
|
|
|
|
const {
|
|
|
|
listBorderedCls,
|
2022-04-08 17:43:44 +08:00
|
|
|
componentCls,
|
2022-04-01 10:23:34 +08:00
|
|
|
paddingLG,
|
|
|
|
margin,
|
2023-05-22 10:20:38 +08:00
|
|
|
itemPaddingSM,
|
|
|
|
itemPaddingLG,
|
2022-04-01 10:23:34 +08:00
|
|
|
marginLG,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadiusLG,
|
2022-04-01 10:23:34 +08:00
|
|
|
} = token;
|
|
|
|
return {
|
|
|
|
[`${listBorderedCls}`]: {
|
2023-11-13 15:16:06 +08:00
|
|
|
border: `${unit(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: borderRadiusLG,
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-header,${componentCls}-footer,${componentCls}-item`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
paddingInline: paddingLG,
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-pagination`]: {
|
2023-11-13 15:16:06 +08:00
|
|
|
margin: `${unit(margin)} ${unit(marginLG)}`,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
|
|
|
},
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${listBorderedCls}${componentCls}-sm`]: {
|
|
|
|
[`${componentCls}-item,${componentCls}-header,${componentCls}-footer`]: {
|
2023-05-22 10:20:38 +08:00
|
|
|
padding: itemPaddingSM,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${listBorderedCls}${componentCls}-lg`]: {
|
|
|
|
[`${componentCls}-item,${componentCls}-header,${componentCls}-footer`]: {
|
2023-05-22 10:20:38 +08:00
|
|
|
padding: itemPaddingLG,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const genResponsiveStyle = (token: ListToken): CSSObject => {
|
2022-05-16 17:52:35 +08:00
|
|
|
const { componentCls, screenSM, screenMD, marginLG, marginSM, margin } = token;
|
2022-04-01 10:23:34 +08:00
|
|
|
return {
|
2023-11-21 15:26:41 +08:00
|
|
|
[`@media screen and (max-width:${screenMD}px)`]: {
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}`]: {
|
|
|
|
[`${componentCls}-item`]: {
|
|
|
|
[`${componentCls}-item-action`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
marginInlineStart: marginLG,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-vertical`]: {
|
|
|
|
[`${componentCls}-item`]: {
|
|
|
|
[`${componentCls}-item-extra`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
marginInlineStart: marginLG,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2023-11-21 15:26:41 +08:00
|
|
|
[`@media screen and (max-width: ${screenSM}px)`]: {
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}`]: {
|
|
|
|
[`${componentCls}-item`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
flexWrap: 'wrap',
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-action`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
marginInlineStart: marginSM,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-vertical`]: {
|
|
|
|
[`${componentCls}-item`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
flexWrap: 'wrap-reverse',
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-main`]: {
|
2022-05-16 17:52:35 +08:00
|
|
|
minWidth: token.contentWidth,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-extra`]: {
|
2023-11-13 15:16:06 +08:00
|
|
|
margin: `auto auto ${unit(margin)}`,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// =============================== Base ===============================
|
2022-11-19 13:47:33 +08:00
|
|
|
const genBaseStyle: GenerateStyle<ListToken> = (token) => {
|
2022-04-01 10:23:34 +08:00
|
|
|
const {
|
2022-04-08 17:43:44 +08:00
|
|
|
componentCls,
|
2022-05-16 17:52:35 +08:00
|
|
|
antCls,
|
2022-04-01 10:23:34 +08:00
|
|
|
controlHeight,
|
|
|
|
minHeight,
|
|
|
|
paddingSM,
|
|
|
|
marginLG,
|
|
|
|
padding,
|
2023-05-22 10:20:38 +08:00
|
|
|
itemPadding,
|
2022-04-01 10:23:34 +08:00
|
|
|
colorPrimary,
|
2023-05-22 10:20:38 +08:00
|
|
|
itemPaddingSM,
|
|
|
|
itemPaddingLG,
|
2022-04-01 10:23:34 +08:00
|
|
|
paddingXS,
|
|
|
|
margin,
|
|
|
|
colorText,
|
2022-08-04 16:16:50 +08:00
|
|
|
colorTextDescription,
|
2022-04-01 10:23:34 +08:00
|
|
|
motionDurationSlow,
|
|
|
|
lineWidth,
|
2023-05-22 10:20:38 +08:00
|
|
|
headerBg,
|
|
|
|
footerBg,
|
|
|
|
emptyTextPadding,
|
|
|
|
metaMarginBottom,
|
|
|
|
avatarMarginRight,
|
|
|
|
titleMarginBottom,
|
|
|
|
descriptionFontSize,
|
2022-04-01 10:23:34 +08:00
|
|
|
} = token;
|
|
|
|
|
|
|
|
return {
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}`]: {
|
2022-05-16 17:52:35 +08:00
|
|
|
...resetComponent(token),
|
2022-04-01 10:23:34 +08:00
|
|
|
position: 'relative',
|
|
|
|
'*': {
|
|
|
|
outline: 'none',
|
|
|
|
},
|
2023-05-22 10:20:38 +08:00
|
|
|
[`${componentCls}-header`]: {
|
|
|
|
background: headerBg,
|
|
|
|
},
|
|
|
|
[`${componentCls}-footer`]: {
|
|
|
|
background: footerBg,
|
|
|
|
},
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-header, ${componentCls}-footer`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
paddingBlock: paddingSM,
|
|
|
|
},
|
2022-12-31 19:18:09 +08:00
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-pagination`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
marginBlockStart: marginLG,
|
2022-12-31 19:18:09 +08:00
|
|
|
|
2022-04-01 10:23:34 +08:00
|
|
|
// https://github.com/ant-design/ant-design/issues/20037
|
2022-05-16 17:52:35 +08:00
|
|
|
[`${antCls}-pagination-options`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
textAlign: 'start',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-spin`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
minHeight,
|
|
|
|
textAlign: 'center',
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-items`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
margin: 0,
|
|
|
|
padding: 0,
|
|
|
|
listStyle: 'none',
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'space-between',
|
2023-05-22 10:20:38 +08:00
|
|
|
padding: itemPadding,
|
2022-04-01 10:23:34 +08:00
|
|
|
color: colorText,
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-meta`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
display: 'flex',
|
|
|
|
flex: 1,
|
|
|
|
alignItems: 'flex-start',
|
|
|
|
maxWidth: '100%',
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-meta-avatar`]: {
|
2023-05-22 10:20:38 +08:00
|
|
|
marginInlineEnd: avatarMarginRight,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-meta-content`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
flex: '1 0',
|
|
|
|
width: 0,
|
|
|
|
color: colorText,
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-meta-title`]: {
|
2023-11-13 15:16:06 +08:00
|
|
|
margin: `0 0 ${unit(token.marginXXS)} 0`,
|
2022-04-01 10:23:34 +08:00
|
|
|
color: colorText,
|
2022-05-16 17:52:35 +08:00
|
|
|
fontSize: token.fontSize,
|
|
|
|
lineHeight: token.lineHeight,
|
2022-04-01 10:23:34 +08:00
|
|
|
|
|
|
|
'> a': {
|
|
|
|
color: colorText,
|
|
|
|
transition: `all ${motionDurationSlow}`,
|
|
|
|
|
2024-06-22 21:59:12 +08:00
|
|
|
'&:hover': {
|
2022-04-01 10:23:34 +08:00
|
|
|
color: colorPrimary,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-meta-description`]: {
|
2022-08-04 16:16:50 +08:00
|
|
|
color: colorTextDescription,
|
2023-05-22 10:20:38 +08:00
|
|
|
fontSize: descriptionFontSize,
|
2022-05-16 17:52:35 +08:00
|
|
|
lineHeight: token.lineHeight,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-action`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
flex: '0 0 auto',
|
2022-05-18 15:37:27 +08:00
|
|
|
marginInlineStart: token.marginXXL,
|
2022-04-01 10:23:34 +08:00
|
|
|
padding: 0,
|
|
|
|
fontSize: 0,
|
|
|
|
listStyle: 'none',
|
|
|
|
|
2024-06-22 21:59:12 +08:00
|
|
|
'& > li': {
|
2022-04-01 10:23:34 +08:00
|
|
|
position: 'relative',
|
|
|
|
display: 'inline-block',
|
2023-11-13 15:16:06 +08:00
|
|
|
padding: `0 ${unit(paddingXS)}`,
|
2022-08-04 16:16:50 +08:00
|
|
|
color: colorTextDescription,
|
2022-05-16 17:52:35 +08:00
|
|
|
fontSize: token.fontSize,
|
|
|
|
lineHeight: token.lineHeight,
|
2022-04-01 10:23:34 +08:00
|
|
|
textAlign: 'center',
|
|
|
|
|
2024-06-22 21:59:12 +08:00
|
|
|
'&:first-child': {
|
2022-04-01 10:23:34 +08:00
|
|
|
paddingInlineStart: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-action-split`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
position: 'absolute',
|
|
|
|
insetBlockStart: '50%',
|
|
|
|
insetInlineEnd: 0,
|
|
|
|
width: lineWidth,
|
2023-11-21 15:26:41 +08:00
|
|
|
height: token.calc(token.fontHeight).sub(token.calc(token.marginXXS).mul(2)).equal(),
|
2022-05-16 17:52:35 +08:00
|
|
|
transform: 'translateY(-50%)',
|
|
|
|
backgroundColor: token.colorSplit,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-empty`]: {
|
2023-11-13 15:16:06 +08:00
|
|
|
padding: `${unit(padding)} 0`,
|
2022-08-04 16:16:50 +08:00
|
|
|
color: colorTextDescription,
|
2022-05-16 17:52:35 +08:00
|
|
|
fontSize: token.fontSizeSM,
|
2022-04-01 10:23:34 +08:00
|
|
|
textAlign: 'center',
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-empty-text`]: {
|
2023-05-22 10:20:38 +08:00
|
|
|
padding: emptyTextPadding,
|
2022-05-16 17:52:35 +08:00
|
|
|
color: token.colorTextDisabled,
|
|
|
|
fontSize: token.fontSize,
|
2022-04-01 10:23:34 +08:00
|
|
|
textAlign: 'center',
|
|
|
|
},
|
|
|
|
|
|
|
|
// ============================ without flex ============================
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-no-flex`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
display: 'block',
|
|
|
|
},
|
|
|
|
},
|
2022-05-16 17:52:35 +08:00
|
|
|
[`${componentCls}-grid ${antCls}-col > ${componentCls}-item`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
display: 'block',
|
|
|
|
maxWidth: '100%',
|
|
|
|
marginBlockEnd: margin,
|
|
|
|
paddingBlock: 0,
|
|
|
|
borderBlockEnd: 'none',
|
|
|
|
},
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-vertical ${componentCls}-item`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
alignItems: 'initial',
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-main`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
display: 'block',
|
|
|
|
flex: 1,
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-extra`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
marginInlineStart: marginLG,
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-meta`]: {
|
2023-05-22 10:20:38 +08:00
|
|
|
marginBlockEnd: metaMarginBottom,
|
2022-04-01 10:23:34 +08:00
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-meta-title`]: {
|
2023-01-29 02:26:28 +08:00
|
|
|
marginBlockStart: 0,
|
2023-05-22 10:20:38 +08:00
|
|
|
marginBlockEnd: titleMarginBottom,
|
2022-04-01 10:23:34 +08:00
|
|
|
color: colorText,
|
2022-05-16 17:52:35 +08:00
|
|
|
fontSize: token.fontSizeLG,
|
|
|
|
lineHeight: token.lineHeightLG,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-item-action`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
marginBlockStart: padding,
|
|
|
|
marginInlineStart: 'auto',
|
|
|
|
|
|
|
|
'> li': {
|
2023-11-13 15:16:06 +08:00
|
|
|
padding: `0 ${unit(padding)}`,
|
2022-04-01 10:23:34 +08:00
|
|
|
|
2024-06-22 21:59:12 +08:00
|
|
|
'&:first-child': {
|
2022-04-01 10:23:34 +08:00
|
|
|
paddingInlineStart: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-split ${componentCls}-item`]: {
|
2023-11-13 15:16:06 +08:00
|
|
|
borderBlockEnd: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
2022-04-01 10:23:34 +08:00
|
|
|
|
2024-06-22 21:59:12 +08:00
|
|
|
'&:last-child': {
|
2022-04-01 10:23:34 +08:00
|
|
|
borderBlockEnd: 'none',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-split ${componentCls}-header`]: {
|
2023-11-13 15:16:06 +08:00
|
|
|
borderBlockEnd: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-split${componentCls}-empty ${componentCls}-footer`]: {
|
2023-11-13 15:16:06 +08:00
|
|
|
borderTop: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-loading ${componentCls}-spin-nested-loading`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
minHeight: controlHeight,
|
|
|
|
},
|
2022-05-16 17:52:35 +08:00
|
|
|
[`${componentCls}-split${componentCls}-something-after-last-item ${antCls}-spin-container > ${componentCls}-items > ${componentCls}-item:last-child`]:
|
2022-04-01 10:23:34 +08:00
|
|
|
{
|
2023-11-13 15:16:06 +08:00
|
|
|
borderBlockEnd: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-lg ${componentCls}-item`]: {
|
2023-05-22 10:20:38 +08:00
|
|
|
padding: itemPaddingLG,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}-sm ${componentCls}-item`]: {
|
2023-05-22 10:20:38 +08:00
|
|
|
padding: itemPaddingSM,
|
2022-04-01 10:23:34 +08:00
|
|
|
},
|
|
|
|
// Horizontal
|
2022-04-08 17:43:44 +08:00
|
|
|
[`${componentCls}:not(${componentCls}-vertical)`]: {
|
|
|
|
[`${componentCls}-item-no-flex`]: {
|
|
|
|
[`${componentCls}-item-action`]: {
|
2022-04-01 10:23:34 +08:00
|
|
|
float: 'right',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-11-13 15:16:06 +08:00
|
|
|
export const prepareComponentToken: GetDefaultToken<'List'> = (token) => ({
|
|
|
|
contentWidth: 220,
|
|
|
|
itemPadding: `${unit(token.paddingContentVertical)} 0`,
|
|
|
|
itemPaddingSM: `${unit(token.paddingContentVerticalSM)} ${unit(token.paddingContentHorizontal)}`,
|
|
|
|
itemPaddingLG: `${unit(token.paddingContentVerticalLG)} ${unit(
|
|
|
|
token.paddingContentHorizontalLG,
|
|
|
|
)}`,
|
|
|
|
headerBg: 'transparent',
|
|
|
|
footerBg: 'transparent',
|
|
|
|
emptyTextPadding: token.padding,
|
|
|
|
metaMarginBottom: token.padding,
|
|
|
|
avatarMarginRight: token.padding,
|
|
|
|
titleMarginBottom: token.paddingSM,
|
|
|
|
descriptionFontSize: token.fontSize,
|
|
|
|
});
|
|
|
|
|
2022-04-01 10:23:34 +08:00
|
|
|
// ============================== Export ==============================
|
2023-11-29 17:23:45 +08:00
|
|
|
export default genStyleHooks(
|
2022-05-16 17:52:35 +08:00
|
|
|
'List',
|
2022-11-19 13:47:33 +08:00
|
|
|
(token) => {
|
2022-05-16 17:52:35 +08:00
|
|
|
const listToken = mergeToken<ListToken>(token, {
|
|
|
|
listBorderedCls: `${token.componentCls}-bordered`,
|
|
|
|
minHeight: token.controlHeightLG,
|
|
|
|
});
|
|
|
|
|
|
|
|
return [genBaseStyle(listToken), genBorderedStyle(listToken), genResponsiveStyle(listToken)];
|
|
|
|
},
|
2023-11-13 15:16:06 +08:00
|
|
|
prepareComponentToken,
|
2022-05-16 17:52:35 +08:00
|
|
|
);
|