import type { IconType, ThemeType } from '../../types' /** * A single board column. In **controlled / server mode** the caller supplies the * full array of columns (each owning its own `items` + `total`). In **group-by * mode** columns are derived from flat `data` and only `columnsDef` (id/title/…) * is needed for ordering & labels. */ export interface KanbanColumn { id: string title: string items?: T[] /** Total available for this column (server mode). When set, "Load more" shows while items.length < total. */ total?: number /** This column is currently fetching (server mode) — disables the load-more button + shows a spinner. */ loading?: boolean color?: ThemeType icon?: IconType } /** Lean card field map — a board card has a fixed shape, unlike a table row. */ export interface KanbanCardSchema { /** Field used as the card title (bold, first line). */ title?: keyof T | ((item: T) => string) /** Optional secondary line. */ subtitle?: keyof T | ((item: T) => string) /** Small monospace identifier shown in the footer (e.g. an id). */ id?: keyof T | ((item: T) => string) /** Fields rendered as badges in the card body. */ badges?: Array { label: string; color?: ThemeType } | string | undefined)> } export interface KanbanMoveEvent { item: T fromColumn: string toColumn: string /** Insertion index within the destination column. */ newIndex: number } export interface KanbanBoardProps { /* ── group-by mode ── */ /** Flat data; provide with `groupBy` to derive columns client-side. */ data?: T[] /** Field on each item that maps to a column id. */ groupBy?: keyof T | ((item: T) => string) /** Column order + labels (group-by mode). Items not matching any def are dropped. */ columnsDef?: KanbanColumn[] /* ── controlled / server mode ── */ /** Supplying `columns` switches the board to controlled (server) mode. */ columns?: KanbanColumn[] /** Stable key for each item (defaults to `item.id`). */ itemKey?: keyof T | ((item: T) => string | number) /** Default card rendering. Ignored when the `#card` slot is used. */ cardSchema?: KanbanCardSchema /** Enable drag & drop between/within columns. The board stays controlled — handle `@move`. */ draggable?: boolean /** * Single load-more handler for every column. The board tracks the next page * per column and calls this with the column id + page. The caller fetches and * appends to that column's `items` (and updates `total`). */ loadMore?: (columnId: string, page: number) => void | Promise /** Label for empty columns. */ emptyText?: string }