@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
46 lines • 2.08 kB
TypeScript
import { Ref } from 'vue';
import { ResizablePanelState, CollapseRule } from '../resizable_constants';
export interface PreCollapseState {
sizes: Map<string, number>;
manualTargets: Map<string, number | undefined>;
containerSize: number;
}
export type CollapseRequestSource = 'user' | 'system' | 'prop' | 'storage';
export interface CollapseRequest {
panelId: string;
action: 'collapse' | 'expand';
source: CollapseRequestSource;
}
export interface CollapseRequestResult {
success: boolean;
reason?: string;
panelId: string;
newState: 'collapsed' | 'expanded' | 'unchanged';
}
export interface CollapseOptions {
isAutoCollapse?: boolean;
}
export interface ResizablePanelControlsOptions {
panels: Ref<ResizablePanelState[]>;
containerSize: Ref<number>;
containerRef: Ref<HTMLElement | null>;
onPanelResize: (panelId: string, pixelSize: number) => void;
onPanelCollapse: (panelId: string, collapsed: boolean) => void;
updateSavedPanel: (panelId: string, updates: Partial<import('./useResizableStorage').SavedPanelData>) => void;
}
export declare function useResizablePanelControls(options: ResizablePanelControlsOptions): {
commitPanelSize: (panelId: string, pixels: number) => void;
resizePanel: (panelId: string, newPixelSize: number) => void;
collapsePanel: (panelId: string, collapsed: boolean, options?: CollapseOptions) => void;
resetPanels: (beforePanelId?: string, afterPanelId?: string, behavior?: "both" | "before" | "after" | "all") => void;
processCollapseRequest: (request: CollapseRequest) => CollapseRequestResult;
checkAutoCollapse: () => string[];
checkAutoExpand: () => string[];
processAutoCollapseExpand: () => {
collapsed: string[];
expanded: string[];
};
};
export declare function sortCollapseRules(rules: CollapseRule[]): CollapseRule[];
export declare function checkAutoCollapseRules(panels: ResizablePanelState[], collapseRules: CollapseRule[], containerSize: number): string[];
//# sourceMappingURL=useResizablePanelControls.d.ts.map