2022-04-25 18:46:53 +08:00
|
|
|
import { Keyframes } from '@ant-design/cssinjs';
|
2024-04-08 14:04:08 +08:00
|
|
|
|
2022-05-19 10:06:58 +08:00
|
|
|
import type { UploadToken } from '.';
|
2023-07-11 10:06:09 +08:00
|
|
|
import { initFadeMotion } from '../../style/motion';
|
2024-04-08 14:04:08 +08:00
|
|
|
import type { GenerateStyle } from '../../theme/internal';
|
2022-04-25 18:46:53 +08:00
|
|
|
|
|
|
|
// =========================== Motion ===========================
|
2022-11-19 13:47:33 +08:00
|
|
|
const genMotionStyle: GenerateStyle<UploadToken> = (token) => {
|
2022-04-25 18:46:53 +08:00
|
|
|
const { componentCls } = token;
|
|
|
|
|
2024-04-18 10:31:22 +08:00
|
|
|
const uploadAnimateInlineIn = new Keyframes('uploadAnimateInlineIn', {
|
|
|
|
from: {
|
|
|
|
width: 0,
|
|
|
|
height: 0,
|
|
|
|
padding: 0,
|
|
|
|
opacity: 0,
|
|
|
|
margin: `calc(${token.marginXS} / -2)`,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const uploadAnimateInlineOut = new Keyframes('uploadAnimateInlineOut', {
|
|
|
|
to: {
|
|
|
|
width: 0,
|
|
|
|
height: 0,
|
|
|
|
padding: 0,
|
|
|
|
opacity: 0,
|
|
|
|
margin: `calc(${token.marginXS} / -2)`,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const inlineCls = `${componentCls}-animate-inline`;
|
2022-04-25 18:46:53 +08:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
[`${componentCls}-wrapper`]: {
|
|
|
|
[`${inlineCls}-appear, ${inlineCls}-enter, ${inlineCls}-leave`]: {
|
|
|
|
animationDuration: token.motionDurationSlow,
|
2022-06-10 17:17:54 +08:00
|
|
|
animationTimingFunction: token.motionEaseInOutCirc,
|
2022-08-01 17:30:14 +08:00
|
|
|
animationFillMode: 'forwards',
|
2022-04-25 18:46:53 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${inlineCls}-appear, ${inlineCls}-enter`]: {
|
|
|
|
animationName: uploadAnimateInlineIn,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${inlineCls}-leave`]: {
|
|
|
|
animationName: uploadAnimateInlineOut,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-07-11 10:06:09 +08:00
|
|
|
{
|
|
|
|
[`${componentCls}-wrapper`]: initFadeMotion(token),
|
|
|
|
},
|
2022-04-25 18:46:53 +08:00
|
|
|
uploadAnimateInlineIn,
|
|
|
|
uploadAnimateInlineOut,
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
export default genMotionStyle;
|