import { ArrowUp } from "lucide-react"; import type { HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from "react"; import { cn } from "@/lib/utils"; /** Smallest width a dragged column can shrink to. */ const MIN_COLUMN_WIDTH = 80; export function Table({ className, ...props }: HTMLAttributes) { return (
); } export function TableHeader({ className, ...props }: HTMLAttributes) { return ; } export function TableBody({ className, ...props }: HTMLAttributes) { return ; } export interface TableRowProps extends HTMLAttributes { /** Highlights the row as selected. Default false. */ selected?: boolean; } export function TableRow({ selected = false, className, ...props }: TableRowProps) { return ( ); } export interface TableHeadProps extends ThHTMLAttributes { /** Shows a sort arrow and makes the header clickable. Omit for a plain, unsortable column. */ sorted?: "asc" | "desc" | false; onSort?: () => void; /** Shows a drag handle on the trailing edge; reports the column's new width in pixels as the pointer moves. Width itself stays the caller's state, same as sort. */ onResize?: (width: number) => void; } /** A thin strip on a header's trailing edge that drags the column wider or narrower. */ function ResizeHandle({ onResize }: { onResize: (width: number) => void }) { return ( ); } return ( ); } export interface TableCellProps extends TdHTMLAttributes { /** Bolds the cell in the foreground color, for a row's primary column, such as a name. Default false. */ emphasis?: boolean; /** Shows a muted "Calculating…" placeholder in place of children, for a value still being computed. Default false. */ loading?: boolean; } export function TableCell({ emphasis = false, loading = false, className, children, ...props }: TableCellProps) { return ( ); }
{children} {onResize ? : null} {onResize ? : null} {loading ? ( Calculating… ) : ( children )}