import React from "react"; import type { CollectionViewMode, CollectionViewSize, CollectionPropertyConfig, CollectionDataController, CellRendererOverride, CollectionCustomViewEntry, CollectionSelectionController, KanbanPropertyOption } from "./CollectionViewTypes"; /** * Props for the headless {@link CollectionView} component. * * This component is data-agnostic — it renders collection data based on * property configurations and callbacks, with ZERO coupling to any entity * or data layer. * * @group Collection View */ export interface CollectionViewProps> { /** * Data controller providing rows, loading state, pagination, * filter/sort/search state and setters. */ dataController: CollectionDataController; /** * Property definitions keyed by property key. * Drives column rendering, cell formatting, and filter UI. */ properties: Record; /** * Display order of properties. If omitted, uses Object.keys(properties). */ propertiesOrder?: string[]; /** * Subset of property keys to actually display as columns. * If omitted, all non-hidden properties are shown. */ displayedColumnIds?: string[]; /** Property key used as row identifier. Default: "id" */ idProperty?: string; /** Property key used as the display title in card/list views */ titleProperty?: string; /** Title displayed above the collection. `false` to hide. */ title?: string | false; /** Controlled view mode. If omitted, internal state is used. */ viewMode?: CollectionViewMode; /** Default view mode when uncontrolled. Default: "list" */ defaultViewMode?: CollectionViewMode; /** Which view modes are available in the toggle */ enabledViews?: CollectionViewMode[]; /** Callback when view mode changes */ onViewModeChange?: (mode: CollectionViewMode) => void; /** Controlled size. If omitted, internal state is used. */ size?: CollectionViewSize; /** Default size. Default: "m" */ defaultSize?: CollectionViewSize; /** Callback when size changes */ onSizeChange?: (size: CollectionViewSize) => void; /** Property key for kanban column grouping */ kanbanProperty?: string; /** Available kanban property options (shown in view toggle) */ kanbanPropertyOptions?: KanbanPropertyOption[]; /** Callback when kanban column property changes */ onKanbanPropertyChange?: (property: string) => void; /** Called when a row is clicked */ onRowClick?: (row: T) => void; /** Called when the "create" button is clicked */ onRowCreate?: (defaults?: Record) => void; /** Whether creation is allowed (shows the + button) */ canCreate?: boolean; /** Enable row selection checkboxes */ selectionEnabled?: boolean; /** Selection controller */ selectionController?: CollectionSelectionController; /** Highlighted items (e.g. recently clicked) */ highlightedItems?: T[]; /** Callback for bulk delete */ onMultipleDelete?: (rows: T[]) => void; /** * Custom cell renderer override. Return undefined to use default. * This is how the connected wrapper injects PropertyPreview. */ cellRenderer?: CellRendererOverride; /** Custom empty state component */ emptyComponent?: React.ReactNode; /** * Additional ways to render these rows, keyed by view mode. A key here can * be named by `viewMode`, `defaultViewMode` and `enabledViews`, and gets * its own entry in the view switcher. * * A custom view is another rendering of the *same* `dataController`, so it * inherits the toolbar's search, the loading state and selection. A * component that fetches its own data does not want to be a view mode — * the toolbar above it would be describing a query it does not render. * * @example * ```tsx * * ``` */ customViews?: Record>; /** Actions rendered at the start (left) of the toolbar */ toolbarActionsStart?: React.ReactNode; /** Actions rendered at the end (right) of the toolbar */ toolbarActionsEnd?: React.ReactNode; /** Hide the built-in toolbar entirely */ hideToolbar?: boolean; /** Enable row hover highlight in table view */ hoverRow?: boolean; /** Callback when table columns are resized */ onColumnResize?: (params: { key: string; width: number; }) => void; /** Callback when table columns are reordered */ onColumnsOrderChange?: (keys: string[]) => void; /** CSS class for the outer container */ className?: string; } /** * A data-agnostic collection view component that orchestrates table, card, * list, and kanban views — driven entirely by props. * * Zero imports from any entity or data layer. This component lives in * `@rebasepro/ui` and can be used with any data source. * * @example * ```tsx * import { CollectionView } from "@rebasepro/ui"; * * openDetail(row.id)} * /> * ``` * * @group Collection View */ export declare function CollectionView = Record>({ dataController, properties, propertiesOrder, displayedColumnIds, idProperty, titleProperty, title, viewMode: viewModeProp, defaultViewMode, enabledViews, onViewModeChange: onViewModeChangeProp, size: sizeProp, defaultSize, onSizeChange: onSizeChangeProp, kanbanProperty: kanbanPropertyProp, kanbanPropertyOptions, onKanbanPropertyChange: onKanbanPropertyChangeProp, onRowClick, onRowCreate, canCreate, selectionEnabled, selectionController, highlightedItems, onMultipleDelete, cellRenderer, emptyComponent, customViews, toolbarActionsStart, toolbarActionsEnd, hideToolbar, hoverRow, onColumnResize, onColumnsOrderChange, className }: CollectionViewProps): React.JSX.Element;