import * as react from 'react'; import { ReactNode } from 'react'; /** * Fired when a card is dropped into a column. `toIndex` is the position * the card should land at within the destination column (0-based; * `toIndex === current count` means append). * * For a same-column reorder, `fromColumn === toColumn` and `toIndex` is * the new position. */ type KanbanCardMoveHandler = (cardId: string, fromColumn: string, toColumn: string, toIndex: number) => void; /** * Fired when a column is dropped at a new position. `toIndex` is the * new position among registered columns (0-based). */ type KanbanColumnMoveHandler = (columnId: string, toIndex: number) => void; interface KanbanContextValue { draggedCard: string | null; setDraggedCard: (id: string | null) => void; dragSource: string | null; setDragSource: (id: string | null) => void; draggedColumn: string | null; setDraggedColumn: (id: string | null) => void; onCardMove?: KanbanCardMoveHandler; onColumnMove?: KanbanColumnMoveHandler; columnIds: string[]; registerColumn: (id: string) => () => void; } interface KanbanProps { children: ReactNode; /** * Called when a card is dropped into a column. Receives the destination * index so handlers can support within-column reorder. */ onCardMove?: KanbanCardMoveHandler; /** * Called when a column is dropped at a new position. Only fires if at * least one column inside the board has a `` and * a column was actually dragged. */ onColumnMove?: KanbanColumnMoveHandler; className?: string; } interface KanbanColumnProps { children: ReactNode; id: string; title?: string; className?: string; /** * Skip the column's default visuals (background, padding, min-height, * fixed width). Drop-target wiring and the drag-over ring stay. */ unstyled?: boolean; /** * Soft work-in-progress limit. Shown in the column header (when `title` * is provided) as `count/limit`. Turns red over capacity. Drops are * still accepted — enforce hard via the consumer's `onCardMove`. */ wipLimit?: number; /** * If true, the column renders nothing when it has zero card children. * Useful for filter UIs that want clean collapse instead of empty * placeholders. */ hideWhenEmpty?: boolean; } interface KanbanCardProps { children: ReactNode; id: string; className?: string; /** * Skip the card's default visuals (border, padding, shadow). Drag * handlers and `draggable` stay. */ unstyled?: boolean; } interface KanbanColumnHandleProps { children: ReactNode; className?: string; } declare function KanbanColumn({ children, id, title, className, unstyled, wipLimit, hideWhenEmpty, }: KanbanColumnProps): react.JSX.Element | null; declare namespace KanbanColumn { var displayName: string; } declare function KanbanCard({ children, id, className, unstyled }: KanbanCardProps): react.JSX.Element; declare namespace KanbanCard { var displayName: string; } /** * Drag handle for column reordering. * * Mount inside a `Kanban.Column` to make that column draggable. The * column's parent `Kanban` listens for the drop and surfaces the new * position via `onColumnMove`. Without a handle, columns are static. * * Typically wrapped around the column header so users grab the title * to reorder; can also be a small grip icon. */ declare function KanbanColumnHandle({ children, className, }: KanbanColumnHandleProps): react.JSX.Element; declare namespace KanbanColumnHandle { var displayName: string; } /** * Kanban board. * * Compound: * * * ...header... // optional * ... * * * * Cards drag between columns AND within a column. Drop position is * computed from mouse Y at hover time and surfaced via the `toIndex` * argument on `onCardMove`. * * Columns drag horizontally to reorder when a `` * is mounted inside them. The root computes the drop index from * mouse X and surfaces it via `onColumnMove`. */ declare function KanbanRoot({ children, onCardMove, onColumnMove, className, }: KanbanProps): react.JSX.Element; declare const Kanban: typeof KanbanRoot & { Column: typeof KanbanColumn; Card: typeof KanbanCard; ColumnHandle: typeof KanbanColumnHandle; }; declare function useKanban(): KanbanContextValue; export { Kanban, type KanbanCardMoveHandler, type KanbanCardProps, type KanbanColumnHandleProps, type KanbanColumnMoveHandler, type KanbanColumnProps, type KanbanContextValue, type KanbanProps, useKanban };