import React, { ReactNode } from 'react'; declare type RcDetachedWindowProps = { /** * open state of that window */ open: boolean; /** * trigger when window `unload`, you must change `open` state to `false` when `onUnload` * otherwise that will cause problem when user close window directly */ onUnload: (e: Event) => any; /** * trigger when window open */ onOpen?: (window: Window) => any; /** * `Optional`. Specifies the URL of the page to open. If no URL is specified, a new window/tab with about:blank is opened */ url?: string; /** * `Optional`. Specifies the target attribute or the name of the window. The following values are supported: * - `_blank` - URL is loaded into a new window, or tab. This is default * - `_parent` - URL is loaded into the parent frame * - `_self` - URL replaces the current page * - `_top` - URL replaces any framesets that may be loaded * - `name` - The name of the window (Note: the name does not specify the title of the new window) */ name?: string; /** * Optional. A comma-separated list of items, no whitespace. * The following values are supported: https://www.w3schools.com/jsref/met_win_open.asp */ specs?: string; /** title for that new window */ title?: string; /** trigger when window `onload` */ onload?: (e: Event) => any; /** trigger when window `beforeunload` */ onBeforeunload?: (e: BeforeUnloadEvent) => any; /** children for render */ children?: ReactNode; /** keep children render when not open */ keep?: boolean; /** * when you want open window by yourself, get `window` when `open={true}` * * ```tsx setOpen(false)} getWindow={()=>{ const win = window.open('', '_blank', 'top=0,left=800,width=400,height=400'); return win; }} > Content here * ``` */ getWindow?: (props: Pick) => Window | undefined | null; }; declare type RcDetachedWindowRef = { /** target opened window, only can get after `onload` */ window?: Window; }; /** * That can make render element on new window, and can shared state easier * implementation follow `window.open` api * https://www.w3schools.com/jsref/met_win_open.asp */ declare const RcDetachedWindow: React.MemoExoticComponent>>; export { RcDetachedWindow }; export type { RcDetachedWindowProps, RcDetachedWindowRef };