{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "table",
  "type": "registry:ui",
  "title": "Table",
  "description": "Styled semantic table primitives on a raised seam surface.",
  "registryDependencies": [
    "https://seamui.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/seam/ui/table.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/**\n * The table itself is a raised key resting on the canvas (bg-card +\n * shadow-resting + squircle), not a well — rows are separated by hairlines\n * inside the surface.\n *\n * The scroll wrapper is a labeled `region`, but it only becomes a keyboard\n * **tab stop** when the table actually overflows — a table that fits adds no\n * phantom stop (per ARIA APG: give a scroll container `tabindex=0` only when\n * there's something to scroll). The label stays on the region either way.\n */\nfunction Table({\n  className,\n  containerClassName,\n  \"aria-label\": ariaLabel,\n  \"aria-labelledby\": ariaLabelledby,\n  ...props\n}: React.ComponentProps<\"table\"> & {\n  /** Classes for the scrollable region wrapper (not the <table>). */\n  containerClassName?: string\n}) {\n  const containerRef = React.useRef<HTMLDivElement>(null)\n  const [scrollable, setScrollable] = React.useState(false)\n\n  React.useEffect(() => {\n    const el = containerRef.current\n    if (!el) return\n    const measure = () => setScrollable(el.scrollWidth > el.clientWidth + 1)\n    measure()\n    const observer = new ResizeObserver(measure)\n    observer.observe(el)\n    return () => observer.disconnect()\n  }, [])\n\n  return (\n    <div\n      ref={containerRef}\n      data-slot=\"table-container\"\n      // the raised surface + the labeled scroll region; a tab stop only when\n      // the table overflows (no phantom stop on tables that fit).\n      role=\"region\"\n      aria-label={ariaLabel}\n      aria-labelledby={ariaLabelledby}\n      tabIndex={scrollable ? 0 : undefined}\n      className={cn(\n        \"squircle bg-card text-card-foreground w-full overflow-x-auto rounded-xl border border-border/60 shadow-resting\",\n        \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n        containerClassName\n      )}\n    >\n      <table\n        data-slot=\"table\"\n        className={cn(\"w-full caption-bottom text-sm\", className)}\n        {...props}\n      />\n    </div>\n  )\n}\n\nfunction TableHeader({ className, ...props }: React.ComponentProps<\"thead\">) {\n  return (\n    <thead\n      data-slot=\"table-header\"\n      // a quiet label rail inside the surface — a strip, not a well (nothing\n      // is typed *into* the header, so no inset shadow).\n      className={cn(\n        \"bg-muted/60 [&_tr]:border-b [&_tr]:border-border/60\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction TableBody({ className, ...props }: React.ComponentProps<\"tbody\">) {\n  return (\n    <tbody\n      data-slot=\"table-body\"\n      className={cn(\"[&_tr:last-child]:border-0\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction TableFooter({ className, ...props }: React.ComponentProps<\"tfoot\">) {\n  return (\n    <tfoot\n      data-slot=\"table-footer\"\n      className={cn(\n        \"bg-muted/60 border-t border-border/60 font-medium [&>tr]:last:border-b-0\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction TableRow({ className, ...props }: React.ComponentProps<\"tr\">) {\n  return (\n    <tr\n      data-slot=\"table-row\"\n      // Selected rows tint (not emboss) — the checkbox is the embossed token.\n      // The tint rides the seam `fades.fast` clock (120ms ease-out); a colour\n      // fade, so it stays correct under reduced motion.\n      className={cn(\n        \"border-b border-border/60 transition-colors duration-[120ms] ease-out hover:bg-muted/40 data-[state=selected]:bg-secondary\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction TableHead({ className, ...props }: React.ComponentProps<\"th\">) {\n  return (\n    <th\n      data-slot=\"table-head\"\n      className={cn(\n        \"text-muted-foreground h-11 px-3 text-left align-middle text-xs font-medium whitespace-nowrap\",\n        \"[&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction TableCell({ className, ...props }: React.ComponentProps<\"td\">) {\n  return (\n    <td\n      data-slot=\"table-cell\"\n      className={cn(\n        \"px-3 py-2.5 align-middle\",\n        \"[&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction TableCaption({\n  className,\n  ...props\n}: React.ComponentProps<\"caption\">) {\n  return (\n    <caption\n      data-slot=\"table-caption\"\n      className={cn(\"text-muted-foreground mt-3 text-sm\", className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Table,\n  TableHeader,\n  TableBody,\n  TableFooter,\n  TableRow,\n  TableHead,\n  TableCell,\n  TableCaption,\n}\n",
      "type": "registry:ui",
      "target": "components/ui/table.tsx"
    }
  ]
}