UNPKG

@gfazioli/mantine-split-pane

Version:

A React component that manages split panes allows users to divide and resize content areas within a layout efficiently.

67 lines (66 loc) 2.6 kB
import React from 'react'; import { BoxProps, Factory, StylesApiProps } from '@mantine/core'; import { SplitPaneResizerVariant } from '../Resizer/SplitPaneResizer'; export type SplitPaneStylesNames = 'root'; export type SplitPaneVariant = SplitPaneResizerVariant; export type SplitPaneCssVariables = {}; export interface SplitPaneHandlers { resetInitialSize?: (e: React.MouseEvent<HTMLButtonElement>) => void; getMinWidth?: () => number; getMinHeight?: () => number; getMaxWidth?: () => number; getMaxHeight?: () => number; getInitialWidth?: () => number; getInitialHeight?: () => number; onResizeStart?: () => void; onResizing?: (size: SPLIT_PANE_SIZE) => void; onResizeEnd?: (size: SPLIT_PANE_SIZE) => void; splitPane?: HTMLDivElement; } export type SPLIT_PANE_SIZE = { width: number; height: number; }; export interface SplitPaneBaseProps { /** Grow pane to fill available space */ grow?: boolean; /** Initial width of the pane */ initialWidth?: number | string; /** Initial height of the pane */ initialHeight?: number | string; /** The minimum width of the pane when orientation is vertical */ minWidth?: number | string; /** The minimum height of the pane when orientation is horizontal */ minHeight?: number | string; /** The maximum width of the pane when orientation is vertical */ maxWidth?: number | string; /** The maximum height of the pane when orientation is horizontal */ maxHeight?: number | string; /** Event called when pane size starts changing */ onResizeStart?: () => void; /** Event called when pane size changes */ onResizing?: (size: SPLIT_PANE_SIZE) => void; /** Event called when pane size changes */ onResizeEnd?: (size: SPLIT_PANE_SIZE) => void; /** Event called to reset initial size */ onResetInitialSize?: (e: React.MouseEvent<HTMLButtonElement>) => void; } export interface SplitPaneProps extends BoxProps, SplitPaneBaseProps, StylesApiProps<SplitPaneFactory> { /** Split pane content */ children: React.ReactNode; ref?: React.RefObject<HTMLDivElement & SplitPaneHandlers>; } export type SplitPaneFactory = Factory<{ props: SplitPaneProps; ref: HTMLDivElement; stylesNames: SplitPaneStylesNames; vars: SplitPaneCssVariables; variant: SplitPaneVariant; }>; export declare const SplitPane: import("@mantine/core").MantineComponent<{ props: SplitPaneProps; ref: HTMLDivElement; stylesNames: SplitPaneStylesNames; vars: SplitPaneCssVariables; variant: SplitPaneVariant; }>;