react-split-pane
Version:
React split-pane component with hooks and TypeScript
29 lines • 1.14 kB
TypeScript
import type { Size } from '../types';
/**
* Convert a size value (string or number) to pixels
* @param size - Size value (e.g., "50%", "200px", 300)
* @param containerSize - Container size in pixels
* @returns Size in pixels
*/
export declare function convertToPixels(size: Size, containerSize: number): number;
/**
* Constrain a value between min and max
*/
export declare function clamp(value: number, min: number, max: number): number;
/**
* Snap a value to the nearest snap point if within tolerance
*/
export declare function snapToPoint(value: number, snapPoints: number[], tolerance: number): number;
/**
* Distribute sizes proportionally when container size changes
*/
export declare function distributeSizes(currentSizes: number[], newContainerSize: number): number[];
/**
* Calculate new sizes after a divider drag
*/
export declare function calculateDraggedSizes(sizes: number[], dividerIndex: number, delta: number, minSizes: number[], maxSizes: number[]): number[];
/**
* Apply step-based resizing
*/
export declare function applyStep(delta: number, step: number): number;
//# sourceMappingURL=calculations.d.ts.map