import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; export type CarbonSplitterContext = { enterDelayMs: () => number; }; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Specify the size of the start pane as a percentage of the splitter. * Rendered clamped to `[min, max]`. * @default 50 */ size?: number; /** * Set to `true` to collapse the start pane to `collapsedSize`, or `min` * when that is unset, and back to `false` to restore the size it had * before. Moving the separator there by any means also sets it to `true`. * @default false */ collapsed?: boolean; /** * Set the size the start pane collapses to, below `min`, as a percentage * or a pixel length. Dragging past halfway between `min` and this size * snaps the pane collapsed, and dragging back snaps it open. * Defaults to `min`, so the pane collapses no further than it resizes. */ collapsedSize?: number | `${number}px` | undefined; /** * Set the minimum size of the start pane, as a percentage, or as a pixel * length such as `"240px"` that holds while the splitter resizes. * @default 0 */ min?: number | `${number}px`; /** * Set the maximum size of the start pane, as a percentage, or as a pixel * length such as `"480px"`. A `min` larger than `max` wins. * @default 100 */ max?: number | `${number}px`; /** * Set the percentage an arrow key moves the separator. * Shift + arrow key moves 10 times as far. * @default 1 */ step?: number; /** * Set the direction the panes are laid out in. * `"horizontal"` places them side by side with a vertical separator; * `"vertical"` stacks them with a horizontal separator. * @default "horizontal" */ orientation?: "horizontal" | "vertical"; /** * Set to `true` to prevent resizing * @default false */ disabled?: boolean; /** * Specify the ARIA label for the separator * @default "Resize panes" */ separatorLabel?: string; /** * Specify the delay in milliseconds before hovering the separator * highlights it and shows the resize cursor. * Defaults to the enclosing `Splitter`'s delay, or `150`. */ enterDelayMs?: number | undefined; /** * Obtain a reference to the root element. * @default null */ ref?: null | HTMLDivElement; /** * Set an id for the top-level element. * The start pane id derives from it as `{id}-start`. * @default uniqueId() */ id?: string; /** Content of the end pane, which fills the remaining space. */ end?: (this: void) => void; /** Content of the start pane, sized by `size`. */ start?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type SplitterProps = Omit<$RestProps, keyof $Props> & $Props; export default class Splitter extends SvelteComponentTyped< SplitterProps, { /** Fires once the user finishes resizing (drag release, key press, or double click) and the size changed. */ resize: CustomEvent<{ size: number }>; }, { /** Content of the end pane, which fills the remaining space. */ end: Record; /** Content of the start pane, sized by `size`. */ start: Record; } > {}