-
-
Notifications
You must be signed in to change notification settings - Fork 243
Expand file tree
/
Copy pathcontext.ts
More file actions
49 lines (43 loc) · 1.5 KB
/
context.ts
File metadata and controls
49 lines (43 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import * as React from 'react';
import type { CSSMotionProps } from '@rc-component/motion';
import type { PortalProps } from '@rc-component/portal';
import type { TriggerProps } from './index';
import type { AlignType, ArrowTypeOuter, BuildInPlacements } from './interface';
// ===================== Nest =====================
export interface TriggerContextProps {
registerSubPopup: (id: string, node: HTMLElement) => void;
}
const TriggerContext = React.createContext<TriggerContextProps | null>(null);
export default TriggerContext;
// ==================== Unique ====================
export interface UniqueShowOptions {
id: string;
popup: TriggerProps['popup'];
target: HTMLElement;
delay: number;
prefixCls?: string;
popupClassName?: string;
uniqueContainerClassName?: string;
uniqueContainerStyle?: React.CSSProperties;
popupStyle?: React.CSSProperties;
popupPlacement?: string;
builtinPlacements?: BuildInPlacements;
popupAlign?: AlignType;
zIndex?: number;
mask?: boolean;
maskClosable?: boolean;
popupMotion?: CSSMotionProps;
maskMotion?: CSSMotionProps;
arrow?: ArrowTypeOuter;
getPopupContainer?: TriggerProps['getPopupContainer'];
getPopupClassNameFromAlign?: (align: AlignType) => string;
onEsc?: PortalProps['onEsc'];
focusPopup?: boolean;
}
export interface UniqueContextProps {
show: (options: UniqueShowOptions, isOpen: () => boolean) => void;
hide: (delay: number) => void;
}
export const UniqueContext = React.createContext<UniqueContextProps | null>(
null,
);