` turns rows into two-column stacked records under 768 px — give every
* a `label` (renders `data-label`) and mark the name cell `primary`. `` keeps columns and scrolls
* horizontally instead (for numeric comparison tables where row structure matters).
*/
export function DataTable({ children, stack = true, scroll = false, compact = false, className, caption }: { children: ReactNode; stack?: boolean; scroll?: boolean; compact?: boolean; className?: string; caption?: string }) {
const table = (
{caption && {caption}}
{children}
);
return scroll ? {table} : table;
}
export function Th({ children, num, className, ...rest }: ThHTMLAttributes & { num?: boolean }) {
return (
{children}
|
);
}
export function Td({ children, label, num, primary, wide, hideStack, className, ...rest }: TdHTMLAttributes & { label?: string; num?: boolean; primary?: boolean; wide?: boolean; hideStack?: boolean }) {
return (
{children}
|
);
}
export function EmptyRow({ cols, children = 'No rows.' }: { cols: number; children?: ReactNode }) {
return (
|
{children}
|
);
}
|