1 |
|
2 | import { Middleware as PopupMiddleware, OffsetOptions as PopupOffsetOptions, Placement as PopupPlacement, Strategy as PopupStrategy, VirtualElement as PopupVirtualElement } from '@floating-ui/react-dom';
|
3 | import { PortalProps } from '../Portal';
|
4 | import { PolymorphicProps, SlotComponentProps } from '../utils';
|
5 | export type { PopupPlacement, PopupStrategy, PopupOffsetOptions, PopupMiddleware, PopupVirtualElement, };
|
6 | export interface PopupRootSlotPropsOverrides {
|
7 | }
|
8 | export interface PopupOwnProps {
|
9 | |
10 |
|
11 |
|
12 |
|
13 |
|
14 | anchor?: PopupVirtualElement | HTMLElement | (() => HTMLElement) | (() => PopupVirtualElement) | null;
|
15 | children?: React.ReactNode;
|
16 | /**
|
17 | * An HTML element or function that returns one. The container will have the portal children appended to it.
|
18 | By default, it uses the body of the top-level document object, so it's `document.body` in these cases.
|
19 | */
|
20 | container?: PortalProps['container'];
|
21 | /**
|
22 | * If `true`, the popup will be rendered where it is defined, without the use of portals.
|
23 | * @default false
|
24 | */
|
25 | disablePortal?: boolean;
|
26 | /**
|
27 | * If `true`, the popup will exist in the DOM even if it's closed.
|
28 | * Its visibility will be controlled by the `visibility` CSS property.
|
29 | *
|
30 | * Otherwise, a closed popup will be removed from the DOM.
|
31 | *
|
32 | * @default false
|
33 | */
|
34 | keepMounted?: boolean;
|
35 | /**
|
36 | * Collection of Floating UI middleware to use when positioning the popup.
|
37 | * If not provided, the [`offset`](https:
|
38 | * and [`flip`](https:
|
39 | *
|
40 | * @see https:
|
41 | */
|
42 | middleware?: Array<PopupMiddleware | null | undefined | false>;
|
43 | |
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | offset?: PopupOffsetOptions;
|
51 | |
52 |
|
53 |
|
54 |
|
55 |
|
56 | open?: boolean;
|
57 | |
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | placement?: PopupPlacement;
|
64 | |
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 | slots?: {
|
71 | root?: React.ElementType;
|
72 | };
|
73 | |
74 |
|
75 |
|
76 |
|
77 |
|
78 | slotProps?: {
|
79 | root?: SlotComponentProps<'div', PopupRootSlotPropsOverrides, PopupProps>;
|
80 | };
|
81 | |
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | strategy?: PopupStrategy;
|
88 | }
|
89 | export interface PopupSlots {
|
90 | |
91 |
|
92 |
|
93 |
|
94 | root?: React.ElementType;
|
95 | }
|
96 | export interface PopupTypeMap<AdditionalProps = {}, RootComponentType extends React.ElementType = 'div'> {
|
97 | props: PopupOwnProps & AdditionalProps;
|
98 | defaultComponent: RootComponentType;
|
99 | }
|
100 | export type PopupProps<RootComponentType extends React.ElementType = PopupTypeMap['defaultComponent']> = PolymorphicProps<PopupTypeMap<{}, RootComponentType>, RootComponentType>;
|
101 | export interface PopupOwnerState extends PopupOwnProps {
|
102 | disablePortal: boolean;
|
103 | open: boolean;
|
104 | keepMounted: boolean;
|
105 | offset: PopupOffsetOptions;
|
106 | placement: PopupPlacement;
|
107 | finalPlacement: PopupPlacement;
|
108 | strategy: PopupStrategy;
|
109 | }
|
110 | export type PopupRootSlotProps = {
|
111 | className?: string;
|
112 | children?: React.ReactNode;
|
113 | ownerState: PopupOwnerState;
|
114 | style: React.CSSProperties;
|
115 | role: React.AriaRole;
|
116 | };
|
117 |
|
\ | No newline at end of file |