import * as React from "react"; import { cn } from "@/lib/utils"; export type KumoTableLayout = "auto" | "fixed"; export type KumoTableRowVariant = "default" | "selected"; type TableProps = React.TableHTMLAttributes & { layout?: KumoTableLayout; }; type TableHeaderProps = React.HTMLAttributes & { sticky?: boolean; variant?: "default" | "compact"; }; type StickyColumn = "left" | "right"; type TableHeadProps = React.ThHTMLAttributes & { sticky?: StickyColumn; }; type TableRowProps = React.HTMLAttributes & { variant?: KumoTableRowVariant; }; type TableCellProps = React.TdHTMLAttributes & { sticky?: StickyColumn; }; function stickyClass(sticky?: StickyColumn): string | undefined { if (sticky === "left") { return "sticky left-0 z-10 bg-kumo-base"; } if (sticky === "right") { return "sticky right-0 z-10 bg-kumo-base"; } return undefined; } const TableRoot = React.forwardRef(function Table( { className, layout = "auto", ...props }, ref, ): React.ReactElement { return ( ); }); const TableHeader = React.forwardRef(function TableHeader( { className, sticky, variant, ...props }, ref, ): React.ReactElement { return ( ); }); const TableHead = React.forwardRef(function TableHead( { className, sticky, ...props }, ref, ): React.ReactElement { return ( ; }, ); const TableRow = React.forwardRef(function TableRow( { className, variant = "default", ...props }, ref, ): React.ReactElement { return ( ); }); const TableCell = React.forwardRef(function TableCell( { className, sticky, ...props }, ref, ): React.ReactElement { return ; }, ); const TableResizeHandle = React.forwardRef>( function TableResizeHandle({ className, type = "button", ...props }, ref): React.ReactElement { return (
); }); const TableBody = React.forwardRef>( function TableBody({ className, ...props }, ref): React.ReactElement { return
; }); const TableFooter = React.forwardRef>( function TableFooter({ className, ...props }, ref): React.ReactElement { return