import * as React from 'react'
import { cn } from '@/lib/utils'
/**
* Table primitives — shadcn-style atomic wrappers. Замена @nstart/ui Table*.
*
*
Per handoff: table cell text = text-cell (12.5/500). Применяется на
* <td/th> через CSS rule в `
` — но проще baked-in via TableCell
* className. Caller может override через className prop.
*
* TableEmpty — single full-width row для empty state.
*/
export const Table = React.forwardRef>(
function Table({ className, ...props }, ref) {
return (
)
},
)
export const TableHeader = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes
>(function TableHeader({ className, ...props }, ref) {
return (
)
})
export const TableBody = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes
>(function TableBody({ className, ...props }, ref) {
return (
)
})
export const TableFooter = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes
>(function TableFooter({ className, ...props }, ref) {
return (
tr]:last:border-b-0',
className,
)}
{...props}
/>
)
})
export const TableRow = React.forwardRef>(
function TableRow({ className, ...props }, ref) {
return (
)
},
)
export type TableHeaderCellProps = React.ThHTMLAttributes & {
align?: 'left' | 'center' | 'right'
}
export const TableHeaderCell = React.forwardRef(
function TableHeaderCell({ className, align = 'left', ...props }, ref) {
return (
|
)
},
)
// Alias for shadcn convention.
export const TableHead = TableHeaderCell
export const TableCell = React.forwardRef<
HTMLTableCellElement,
React.TdHTMLAttributes
>(function TableCell({ className, ...props }, ref) {
return (
|
)
})
export const TableCaption = React.forwardRef<
HTMLTableCaptionElement,
React.HTMLAttributes
>(function TableCaption({ className, ...props }, ref) {
return (
)
})
/**
* TableEmpty — full-width row с заглушкой "ничего не найдено".
* Замена @nstart/ui TableEmptyRow API: {text}.
*/
export type TableEmptyProps = React.TdHTMLAttributes & {
colSpan: number
}
export function TableEmpty({ colSpan, className, children, ...props }: TableEmptyProps) {
return (
|
{children}
|
)
}