import type { ReactNode } from 'react' import { cn } from './cn' import { ContainerHeader } from './ContainerHeader' import { ErrorBoundary } from './ErrorBoundary' import { ScrollArea } from './ScrollArea' /** * The list column of a page: the column beside the page's main area that lists * what it can open — 290px wide, a line on its right, its name in a * `ContainerHeader`, and a list under it that scrolls. * * Moved in from Peek as it looks (UIG-14, N9), where five pages drew it by * hand and each carried the same numbers: the frame's 290px and its line, and * the list's steps — 16px under the header, 12px above the bottom, rows 12px * in from each side and 2px apart. The numbers live here now, once. One * spacing for every list (Katerina, D5): a list of groups heads each with a * `CollapsibleSection` or a `SectionHeader`. * * It scrolls its rows itself. A list column that did not was the first of the * eight mistakes on the page that led to UIG-15: the frame's card clips, so a * list that grew past the fold was simply cut off, with nothing to scroll. * * It keeps a crash inside itself (D1, D3): if its rows, its actions or the row * above break, the column keeps its title and shows `ErrorBoundary`'s message * in the middle of the room the list had, and the rest of the page keeps working. * * `collapsed` closes it with the rail, as Peek's did: it narrows to nothing * and fades, in 300ms. What opens and closes the rail stays the app's. */ export interface ListColumnProps { /** The column's name, in its header. A node for a title that is more than words. */ title: ReactNode /** A chevron after the title, as `ContainerHeader` draws it. */ chevron?: boolean /** The menu the title opens — `ContainerHeader`'s: the column's views. */ titleMenu?: ReactNode /** The column's own actions, at the header's right — a `Toolbar` of `ToolbarButton`s, or one `IconButton`. */ actions?: ReactNode /** A row between the header and the list that stays put while the list scrolls — a field that adds to the list. */ above?: ReactNode /** Closes the column with the rail: it narrows to nothing and fades. */ collapsed?: boolean /** The rows, 2px apart. Groups are headed by a `CollapsibleSection` or a `SectionHeader`. */ children: ReactNode /** Placement only. */ className?: string } function Column({ title, chevron = false, titleMenu, actions, above, collapsed = false, children, className, broken = false }: ListColumnProps & { broken?: boolean }) { return (