2026-10-23 11:43:49 -05:00
|
|
|
import { cn } from '@/lib/utils';
|
2026-10-23 19:56:38 -07:00
|
|
|
import React from 'react';
|
2026-10-23 11:43:49 -05:00
|
|
|
|
|
|
|
|
export const TableWrap: React.FC<React.HTMLAttributes<HTMLDivElement>> = ({
|
|
|
|
|
className,
|
|
|
|
|
children,
|
|
|
|
|
...props
|
|
|
|
|
}) => (
|
|
|
|
|
<div
|
|
|
|
|
className={cn(
|
|
|
|
|
'w-full overflow-x-auto border border-[var(--border)] bg-[var(--bg-elevated)]',
|
|
|
|
|
className
|
|
|
|
|
)}
|
|
|
|
|
{...props}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const Table: React.FC<React.TableHTMLAttributes<HTMLTableElement>> = ({
|
|
|
|
|
className,
|
|
|
|
|
children,
|
|
|
|
|
...props
|
|
|
|
|
}) => (
|
|
|
|
|
<table
|
|
|
|
|
className={cn(
|
2026-10-23 19:56:38 -07:00
|
|
|
'w-full min-w-[680px] border-collapse text-left text-[13px] whitespace-nowrap',
|
2026-10-23 11:43:49 -05:00
|
|
|
className
|
|
|
|
|
)}
|
|
|
|
|
{...props}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</table>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const TableHeader: React.FC<React.HTMLAttributes<HTMLTableSectionElement>> = ({
|
|
|
|
|
className,
|
|
|
|
|
children,
|
|
|
|
|
...props
|
|
|
|
|
}) => (
|
|
|
|
|
<thead
|
|
|
|
|
className={cn(
|
2026-10-23 19:56:38 -07:00
|
|
|
'bg-[var(--bg-sidebar)] border-b border-[var(--border)] text-[12px] font-medium text-[var(--text-muted)] uppercase',
|
2026-10-23 11:43:49 -05:00
|
|
|
className
|
|
|
|
|
)}
|
|
|
|
|
{...props}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</thead>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const TableBody: React.FC<React.HTMLAttributes<HTMLTableSectionElement>> = ({
|
|
|
|
|
className,
|
|
|
|
|
children,
|
|
|
|
|
...props
|
|
|
|
|
}) => <tbody className={cn('divide-y divide-[var(--border)]', className)} {...props}>{children}</tbody>;
|
|
|
|
|
|
|
|
|
|
export const TableRow: React.FC<React.HTMLAttributes<HTMLTableRowElement>> = ({
|
|
|
|
|
className,
|
|
|
|
|
children,
|
|
|
|
|
...props
|
|
|
|
|
}) => (
|
|
|
|
|
<tr
|
|
|
|
|
className={cn(
|
|
|
|
|
'transition-colors hover:bg-[var(--bg-hover)] text-[var(--text)]',
|
|
|
|
|
className
|
|
|
|
|
)}
|
|
|
|
|
{...props}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</tr>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const TableHead: React.FC<React.ThHTMLAttributes<HTMLTableCellElement>> = ({
|
|
|
|
|
className,
|
|
|
|
|
children,
|
|
|
|
|
...props
|
|
|
|
|
}) => (
|
2026-10-23 19:56:38 -07:00
|
|
|
<th className={cn('px-3 py-2.5 font-medium', className)} {...props}>
|
2026-10-23 11:43:49 -05:00
|
|
|
{children}
|
|
|
|
|
</th>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const TableCell: React.FC<React.TdHTMLAttributes<HTMLTableCellElement>> = ({
|
|
|
|
|
className,
|
|
|
|
|
children,
|
|
|
|
|
...props
|
|
|
|
|
}) => (
|
2026-10-23 19:56:38 -07:00
|
|
|
<td className={cn('px-3 py-2.5 text-[var(--text-muted)] align-middle', className)} {...props}>
|
2026-10-23 11:43:49 -05:00
|
|
|
{children}
|
|
|
|
|
</td>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const TableEmpty: React.FC<{ colSpan: number; message?: string }> = ({
|
|
|
|
|
colSpan,
|
|
|
|
|
message = 'No data available',
|
|
|
|
|
}) => (
|
|
|
|
|
<tr>
|
|
|
|
|
<td
|
|
|
|
|
colSpan={colSpan}
|
2026-10-23 19:56:38 -07:00
|
|
|
className="px-4 py-10 text-center text-[13px] text-[var(--text-dim)]"
|
2026-10-23 11:43:49 -05:00
|
|
|
>
|
|
|
|
|
{message}
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export default Table;
|