2022-05-19 10:06:58 +08:00
|
|
|
import type { UploadToken } from '.';
|
2022-10-28 16:44:19 +08:00
|
|
|
import { clearFix, textEllipsis } from '../../style';
|
2023-06-07 11:54:50 +08:00
|
|
|
import type { GenerateStyle } from '../../theme/internal';
|
2022-04-25 18:46:53 +08:00
|
|
|
|
2022-11-19 13:47:33 +08:00
|
|
|
const genListStyle: GenerateStyle<UploadToken> = (token) => {
|
2022-11-01 15:06:38 +08:00
|
|
|
const { componentCls, antCls, iconCls, fontSize, lineHeight } = token;
|
2022-04-25 18:46:53 +08:00
|
|
|
const itemCls = `${componentCls}-list-item`;
|
|
|
|
const actionsCls = `${itemCls}-actions`;
|
|
|
|
const actionCls = `${itemCls}-action`;
|
2022-11-01 15:06:38 +08:00
|
|
|
const listItemHeightSM = Math.round(fontSize * lineHeight);
|
2022-04-25 18:46:53 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
[`${componentCls}-wrapper`]: {
|
|
|
|
[`${componentCls}-list`]: {
|
|
|
|
...clearFix(),
|
|
|
|
lineHeight: token.lineHeight,
|
|
|
|
|
|
|
|
[itemCls]: {
|
|
|
|
position: 'relative',
|
2022-11-01 15:06:38 +08:00
|
|
|
height: token.lineHeight * fontSize,
|
2022-04-25 18:46:53 +08:00
|
|
|
marginTop: token.marginXS,
|
2022-11-01 15:06:38 +08:00
|
|
|
fontSize,
|
2022-04-25 18:46:53 +08:00
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
transition: `background-color ${token.motionDurationSlow}`,
|
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
backgroundColor: token.controlItemBgHover,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${itemCls}-name`]: {
|
2022-10-28 16:44:19 +08:00
|
|
|
...textEllipsis,
|
2022-04-25 18:46:53 +08:00
|
|
|
padding: `0 ${token.paddingXS}px`,
|
2022-05-19 10:06:58 +08:00
|
|
|
lineHeight,
|
2022-04-25 18:46:53 +08:00
|
|
|
flex: 'auto',
|
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
|
|
|
},
|
|
|
|
|
|
|
|
[actionsCls]: {
|
|
|
|
[actionCls]: {
|
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${actionCls}${antCls}-btn-sm`]: {
|
2022-05-19 10:06:58 +08:00
|
|
|
height: listItemHeightSM,
|
|
|
|
border: 0,
|
2022-04-25 18:46:53 +08:00
|
|
|
lineHeight: 1,
|
|
|
|
// FIXME: should not override small button
|
|
|
|
'> span': {
|
|
|
|
transform: 'scale(1)',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`
|
2023-09-04 14:45:03 +08:00
|
|
|
${actionCls}:focus-visible,
|
2022-04-25 18:46:53 +08:00
|
|
|
&.picture ${actionCls}
|
|
|
|
`]: {
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
[iconCls]: {
|
2023-05-19 11:11:31 +08:00
|
|
|
color: token.actionsColor,
|
2022-04-25 18:46:53 +08:00
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&:hover ${iconCls}`]: {
|
|
|
|
color: token.colorText,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-icon ${iconCls}`]: {
|
2022-08-04 16:16:50 +08:00
|
|
|
color: token.colorTextDescription,
|
2022-11-01 15:06:38 +08:00
|
|
|
fontSize,
|
2022-04-25 18:46:53 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${itemCls}-progress`]: {
|
|
|
|
position: 'absolute',
|
2022-05-19 10:06:58 +08:00
|
|
|
bottom: -token.uploadProgressOffset,
|
2022-04-25 18:46:53 +08:00
|
|
|
width: '100%',
|
2022-11-01 15:06:38 +08:00
|
|
|
paddingInlineStart: fontSize + token.paddingXS,
|
|
|
|
fontSize,
|
2022-04-25 18:46:53 +08:00
|
|
|
lineHeight: 0,
|
2022-05-19 10:06:58 +08:00
|
|
|
pointerEvents: 'none',
|
|
|
|
|
|
|
|
'> div': {
|
|
|
|
margin: 0,
|
|
|
|
},
|
2022-04-25 18:46:53 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${itemCls}:hover ${actionCls}`]: {
|
|
|
|
opacity: 1,
|
|
|
|
color: token.colorText,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${itemCls}-error`]: {
|
|
|
|
color: token.colorError,
|
|
|
|
[`${itemCls}-name, ${componentCls}-icon ${iconCls}`]: {
|
|
|
|
color: token.colorError,
|
|
|
|
},
|
|
|
|
|
|
|
|
[actionsCls]: {
|
|
|
|
[`${iconCls}, ${iconCls}:hover`]: {
|
|
|
|
color: token.colorError,
|
|
|
|
},
|
|
|
|
|
|
|
|
[actionCls]: {
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-list-item-container`]: {
|
|
|
|
transition: `opacity ${token.motionDurationSlow}, height ${token.motionDurationSlow}`,
|
|
|
|
|
|
|
|
// For smooth removing animation
|
|
|
|
'&::before': {
|
|
|
|
display: 'table',
|
|
|
|
width: 0,
|
|
|
|
height: 0,
|
|
|
|
content: '""',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default genListStyle;
|