UNPKG

3.28 kBTypeScriptView Raw
1/// <reference types="react" />
2/** Two char of 't' 'b' 'c' 'l' 'r'. Example: 'lt' */
3export declare type AlignPoint = string;
4export interface AlignType {
5 /**
6 * move point of source node to align with point of target node.
7 * Such as ['tr','cc'], align top right point of source node with center point of target node.
8 * Point can be 't'(top), 'b'(bottom), 'c'(center), 'l'(left), 'r'(right) */
9 points?: AlignPoint[];
10 /**
11 * offset source node by offset[0] in x and offset[1] in y.
12 * If offset contains percentage string value, it is relative to sourceNode region.
13 */
14 offset?: number[];
15 /**
16 * offset target node by offset[0] in x and offset[1] in y.
17 * If targetOffset contains percentage string value, it is relative to targetNode region.
18 */
19 targetOffset?: number[];
20 /**
21 * If adjustX field is true, will adjust source node in x direction if source node is invisible.
22 * If adjustY field is true, will adjust source node in y direction if source node is invisible.
23 */
24 overflow?: {
25 adjustX?: boolean | number;
26 adjustY?: boolean | number;
27 };
28 /**
29 * Whether use css right instead of left to position
30 */
31 useCssRight?: boolean;
32 /**
33 * Whether use css bottom instead of top to position
34 */
35 useCssBottom?: boolean;
36 /**
37 * Whether use css transform instead of left/top/right/bottom to position if browser supports.
38 * Defaults to false.
39 */
40 useCssTransform?: boolean;
41 ignoreShake?: boolean;
42}
43export interface BuildInPlacements {
44 [placement: string]: AlignType;
45}
46export declare type StretchType = string;
47export declare type ActionType = string;
48export declare type AnimationType = string;
49export declare type TransitionNameType = string;
50export interface Point {
51 pageX: number;
52 pageY: number;
53}
54export interface CommonEventHandler {
55 remove: () => void;
56}
57declare type MotionStatus = 'none' | 'appear' | 'enter' | 'leave';
58declare type MotionActiveStatus = 'appear-active' | 'enter-active' | 'leave-active';
59declare type MotionNameObject = {
60 [key in MotionStatus | MotionActiveStatus]?: string;
61};
62declare type MotionEventHandler = (element: HTMLElement, event: React.TransitionEvent<HTMLElement> | React.AnimationEvent<HTMLElement> | undefined) => React.CSSProperties | false | null | undefined | void;
63export interface MotionType {
64 motionName?: string | MotionNameObject;
65 motionAppear?: boolean;
66 motionEnter?: boolean;
67 motionLeave?: boolean;
68 motionLeaveImmediately?: boolean;
69 removeOnLeave?: boolean;
70 leavedClassName?: string;
71 onAppearStart?: MotionEventHandler;
72 onAppearActive?: MotionEventHandler;
73 onAppearEnd?: MotionEventHandler;
74 onEnterStart?: MotionEventHandler;
75 onEnterActive?: MotionEventHandler;
76 onEnterEnd?: MotionEventHandler;
77 onLeaveStart?: MotionEventHandler;
78 onLeaveActive?: MotionEventHandler;
79 onLeaveEnd?: MotionEventHandler;
80}
81export interface MotionProps extends MotionType {
82 visible?: boolean;
83 children: (props: {
84 className: string;
85 style: React.CSSProperties;
86 }, ref: React.Ref<any>) => React.ReactElement;
87}
88export declare type CSSMotionClass = React.ComponentClass<MotionProps>;
89export {};