// ~/src/siteplane/components/native-table/native-table.tsx "use client"; import type { ComponentProps, CSSProperties } from "react"; import { type SiteplaneControlSize, useResolvedControlSize, } from "../../system/provider/siteplane-ui-provider"; import { cn } from "../../system/utils/cn"; import { tableAlignmentClassName, tableContainerSizeClassName, tableFooterClassName, type TableAlign, } from "../table/table-shared"; import "../table/table.css"; import "./native-table.css"; export interface NativeTableProps extends ComponentProps<"table"> { containerClassName?: string | undefined; hoverable?: boolean | undefined; minWidth?: CSSProperties["minWidth"]; size?: SiteplaneControlSize | undefined; } /** Native table semantics: each control keeps its own focus and keyboard behavior. */ export function NativeTable({ className, containerClassName, hoverable = true, minWidth, size, style, ...props }: NativeTableProps) { const resolvedSize = useResolvedControlSize(size); return (
); } export function NativeTableCaption({ className, ...props }: ComponentProps<"caption">) { return ( ); } export function NativeTableBody(props: ComponentProps<"tbody">) { return ( ); } export function NativeTableFooter({ className, ...props }: ComponentProps<"tfoot">) { return ( ); } export interface NativeTableRowProps extends ComponentProps<"tr"> { hoverable?: boolean | undefined; tone?: "section" | "total" | "muted" | undefined; } export function NativeTableRow({ className, hoverable = true, tone, ...props }: NativeTableRowProps) { return ( ); } export interface NativeTableHeadProps extends Omit< ComponentProps<"th">, "align" > { align?: TableAlign | undefined; } export interface NativeTableCellProps extends Omit< ComponentProps<"td">, "align" > { align?: TableAlign | undefined; } export function NativeTableHead({ align = "start", className, scope = "col", ...props }: NativeTableHeadProps) { return (
); } export function NativeTableHeader(props: ComponentProps<"thead">) { return (
); } export function NativeTableCell({ align = "start", className, ...props }: NativeTableCellProps) { return ( ); } // ~/src/siteplane/components/native-table/native-table.css @layer theme, base, components, siteplane, utilities; @layer siteplane { /* NativeTable shares Table's visual styles (table.css) and adds only the row * tones and row-heading treatment of its native semantics. */ .sp-table-row[data-tone="section"] { background: color-mix(in oklab, var(--color-muted) 40%, transparent); font-weight: var(--sp-rw-font-weight-strong); } .sp-table-row[data-tone="total"] { background: color-mix(in oklab, var(--color-muted) 70%, transparent); font-weight: var(--sp-rw-font-weight-strong); } /* The footer already paints the shared summary fill (table-shared); a total row * inside it only adds weight instead of tinting the band a second time. */ .sp-table-footer > .sp-table-row[data-tone="total"] { background: transparent; } .sp-table-row[data-tone="muted"] { color: var(--sp-rw-fg-tertiary); } .sp-table-head:is([scope="row"], [scope="rowgroup"]) { color: inherit; font-weight: inherit; } } // ~/src/siteplane/components/native-table/index.ts export * from "./native-table";