import * as React from "react";
import { cn } from "@/lib/utils";
// ---------------------------------------------------------------------------
// Table
//
// Shared table primitive used by Claims, Remittances, Batches, Acks, etc.
//
// `tone="paper"` swaps the dark-mode row chrome (muted/20 header, muted/30
// hover) for paper-toned chrome (cream surface, soft hairline border,
// tinted hover). Paper-toned tables sit inside the cream "paper plane"
// sections of the hybrid Magazine Spread layout. The default `tone="dark"`
// is unchanged from the original look so existing callers keep their
// behavior. Pages pass the tone prop once on `
` and the children
// inherit the matching colors via the data-tone attribute — no need to
// rewrite every TableHead/TableRow/TableCell.
// ---------------------------------------------------------------------------
type Tone = "dark" | "paper";
type TableProps = React.HTMLAttributes & {
tone?: Tone;
};
const Table = React.forwardRef(
({ className, tone = "dark", ...props }, ref) => (
)
);
Table.displayName = "Table";
type TableSectionProps = React.HTMLAttributes;
const TableHeader = React.forwardRef(
({ className, ...props }, ref) => {
// Paper-tone: cream-papered header band, soft border, no dark muted fill.
return (
is paper-toned, swap to cream chrome.
"[[data-tone=paper]_&]:bg-[hsl(36_22%_92%)]",
"[[data-tone=paper]_&]:[&_tr]:bg-[hsl(36_22%_92%)]",
"[[data-tone=paper]_&]:[&_tr]:border-[hsl(30_14%_14%_/_0.10)]",
className
)}
{...props}
/>
);
}
);
TableHeader.displayName = "TableHeader";
const TableBody = React.forwardRef(
({ className, ...props }, ref) => (
)
);
TableBody.displayName = "TableBody";
type TableRowProps = React.HTMLAttributes;
const TableRow = React.forwardRef(
({ className, ...props }, ref) => (
)
);
TableRow.displayName = "TableRow";
type TableHeadProps = React.ThHTMLAttributes;
const TableHead = React.forwardRef(
({ className, scope = "col", ...props }, ref) => (
|
)
);
TableHead.displayName = "TableHead";
const TableCell = React.forwardRef(
({ className, ...props }, ref) => (
|
)
);
TableCell.displayName = "TableCell";
export { Table, TableHeader, TableBody, TableRow, TableHead, TableCell };
export type { Tone as TableTone };