UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

42 lines (41 loc) 2.12 kB
import { SetFloatingWindowPosition, UseFloatingWindowOptions } from '@mantine/hooks'; import { BoxProps, ElementProps, Factory, StylesApiProps } from '../../core'; import { PaperBaseProps } from '../Paper'; import { PortalProps } from '../Portal'; import { FloatingWindowDimensions, FloatingWindowSize } from './FloatingWindow.context'; import { FloatingWindowResizeHandle } from './FloatingWindowResizeHandle'; export type FloatingWindowStylesNames = 'root'; export interface FloatingWindowProps extends UseFloatingWindowOptions, PaperBaseProps, BoxProps, StylesApiProps<FloatingWindowFactory>, ElementProps<'div', keyof UseFloatingWindowOptions> { /** Assigns ref to set position programmatically */ setPositionRef?: React.RefObject<SetFloatingWindowPosition | null>; /** Determines whether the window should be rendered inside `Portal` @default true */ withinPortal?: boolean; /** Props passed down to `Portal` component */ portalProps?: Omit<PortalProps, 'children'>; /** `z-index` of the root element @default 400 */ zIndex?: React.CSSProperties['zIndex']; /** Dimensions configuration for resizable floating window */ dimensions?: FloatingWindowDimensions; /** Called when the window is resized with `FloatingWindow.ResizeHandle` */ onSizeChange?: (size: FloatingWindowSize) => void; /** Called when the resize with `FloatingWindow.ResizeHandle` starts. Not called for keyboard resize. */ onResizeStart?: () => void; /** Called when the resize with `FloatingWindow.ResizeHandle` stops. Not called for keyboard resize. */ onResizeEnd?: () => void; } export type FloatingWindowFactory = Factory<{ props: FloatingWindowProps; ref: HTMLDivElement; stylesNames: FloatingWindowStylesNames; staticComponents: { ResizeHandle: typeof FloatingWindowResizeHandle; }; }>; export declare const FloatingWindow: import("../..").MantineComponent<{ props: FloatingWindowProps; ref: HTMLDivElement; stylesNames: FloatingWindowStylesNames; staticComponents: { ResizeHandle: typeof FloatingWindowResizeHandle; }; }>;