Skip to content

Commit 95b0ef2

Browse files
committed
refactor: Remove deprecated motion-related utility functions and props
1 parent eac4b9b commit 95b0ef2

File tree

4 files changed

+6
-128
lines changed

4 files changed

+6
-128
lines changed

src/index.tsx

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ import useWinClick from './hooks/useWinClick';
2020
import type {
2121
ActionType,
2222
AlignType,
23-
AnimationType,
2423
ArrowPos,
2524
ArrowTypeOuter,
2625
BuildInPlacements,
27-
TransitionNameType,
2826
} from './interface';
29-
import { getAlignPopupClassName, getMotion } from './util';
27+
import { getAlignPopupClassName } from './util';
3028

3129
export type {
3230
ActionType,
@@ -82,15 +80,6 @@ export interface TriggerProps {
8280
/** Set mask motion. You can ref `rc-motion` for more info. */
8381
maskMotion?: CSSMotionProps;
8482

85-
/** @deprecated Please us `popupMotion` instead. */
86-
popupTransitionName?: TransitionNameType;
87-
/** @deprecated Please us `popupMotion` instead. */
88-
popupAnimation?: AnimationType;
89-
/** @deprecated Please us `maskMotion` instead. */
90-
maskTransitionName?: TransitionNameType;
91-
/** @deprecated Please us `maskMotion` instead. */
92-
maskAnimation?: AnimationType;
93-
9483
// ==================== Delay ====================
9584
mouseEnterDelay?: number;
9685
mouseLeaveDelay?: number;
@@ -192,10 +181,6 @@ export function generateTrigger(
192181
// Motion
193182
popupMotion,
194183
maskMotion,
195-
popupTransitionName,
196-
popupAnimation,
197-
maskTransitionName,
198-
maskAnimation,
199184

200185
// Private
201186
getTriggerDOMNode,
@@ -278,21 +263,6 @@ export function generateTrigger(
278263
);
279264
});
280265

281-
// =========================== Motion ===========================
282-
const mergePopupMotion = getMotion(
283-
prefixCls,
284-
popupMotion,
285-
popupAnimation,
286-
popupTransitionName,
287-
);
288-
289-
const mergeMaskMotion = getMotion(
290-
prefixCls,
291-
maskMotion,
292-
maskAnimation,
293-
maskTransitionName,
294-
);
295-
296266
// ============================ Open ============================
297267
const [internalOpen, setInternalOpen] = React.useState(
298268
defaultPopupVisible || false,
@@ -710,8 +680,8 @@ export function generateTrigger(
710680
// Mask
711681
mask={mask}
712682
// Motion
713-
motion={mergePopupMotion}
714-
maskMotion={mergeMaskMotion}
683+
motion={popupMotion}
684+
maskMotion={maskMotion}
715685
onVisibleChanged={onVisibleChanged}
716686
onPrepare={onPrepare}
717687
// Portal

src/util.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,32 +39,6 @@ export function getAlignPopupClassName(
3939
return '';
4040
}
4141

42-
/** @deprecated We should not use this if we can refactor all deps */
43-
export function getMotion(
44-
prefixCls: string,
45-
motion: CSSMotionProps,
46-
animation: AnimationType,
47-
transitionName: TransitionNameType,
48-
): CSSMotionProps {
49-
if (motion) {
50-
return motion;
51-
}
52-
53-
if (animation) {
54-
return {
55-
motionName: `${prefixCls}-${animation}`,
56-
};
57-
}
58-
59-
if (transitionName) {
60-
return {
61-
motionName: transitionName,
62-
};
63-
}
64-
65-
return null;
66-
}
67-
6842
export function getWin(ele: HTMLElement) {
6943
return ele.ownerDocument.defaultView;
7044
}

tests/mask.test.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ describe('Trigger.Mask', () => {
2121
popupAlign={placementAlignMap.left}
2222
popup={<strong className="x-content" />}
2323
mask
24-
maskTransitionName="bamboo"
24+
maskMotion={{
25+
motionName: 'bamboo',
26+
}}
2527
>
2628
<div className="target">click</div>
2729
</Trigger>,

tests/util.test.jsx

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)