import React from "react"; //#region src/PageLayout/usePaneWidth.d.ts type Measurement = `${number}px`; type CustomWidthOptions = { min: Measurement; default: Measurement; max: Measurement; }; type PaneWidth = 'small' | 'medium' | 'large'; /** * Width value for the pane - defines constraints and defaults only. * - `PaneWidth`: Preset size ('small' | 'medium' | 'large') * - `CustomWidthOptions`: Explicit min/default/max constraints */ type PaneWidthValue = PaneWidth | CustomWidthOptions; type UsePaneWidthOptions = { width: PaneWidthValue; minWidth: number; resizable: boolean; /** localStorage key for persisting width. When undefined, localStorage is not used. */ widthStorageKey?: string; paneRef: React.RefObject; handleRef: React.RefObject; /** * Optional ref to the content wrapper element. Only used by PageLayout for its * viewport/content math during resize. Standalone consumers can omit this. */ contentWrapperRef?: React.RefObject; /** * When true, custom max width values are capped to the viewport-based max. * This prevents overflow in non-wrapping flex layouts (e.g., Sidebar). * @default false */ constrainToViewport?: boolean; /** Callback fired when a resize operation ends (drag release or keyboard key up) */ onResizeEnd?: (width: number) => void; /** Current/controlled width value in pixels (used instead of internal state; default from `width` is still used for reset) */ currentWidth?: number; /** * Formats the `aria-valuetext` written during mount and viewport resize. * Should match the formatter passed to `DragHandle` so screen-reader output * stays consistent across drag, mount, and resize updates. * @default valueNow => `Pane width ${valueNow} pixels` */ formatValueText?: (valueNow: number) => string; }; type UsePaneWidthResult = { /** Current width for React state (used in ARIA attributes) */currentWidth: number; /** Mutable ref tracking width during drag operations */ currentWidthRef: React.MutableRefObject; /** Minimum allowed pane width */ minPaneWidth: number; /** Maximum allowed pane width (updates on viewport resize) */ maxPaneWidth: number; /** Calculate current max width constraint */ getMaxPaneWidth: () => number; /** Persist width to localStorage and sync React state */ saveWidth: (value: number) => void; /** Reset to default width */ getDefaultWidth: () => number; }; /** Default widths for preset size options */ declare const defaultPaneWidth: Record; /** * Manages pane width state with storage persistence and viewport constraints. * Handles initialization from storage, clamping on viewport resize, and provides * functions to save and reset width. * * Storage behavior: * - When `resizable` is `true` and `onResizeEnd` is not provided: Uses localStorage * - When `onResizeEnd` is provided: Calls the callback instead of localStorage * - When `resizable` is `false` or `undefined`: Not resizable, no persistence */ declare function usePaneWidth({ width, minWidth, resizable, widthStorageKey, paneRef, handleRef, contentWrapperRef, constrainToViewport, onResizeEnd, currentWidth: controlledWidth, formatValueText }: UsePaneWidthOptions): UsePaneWidthResult; //#endregion export { CustomWidthOptions, PaneWidth, PaneWidthValue, UsePaneWidthOptions, UsePaneWidthResult, defaultPaneWidth, usePaneWidth };