{
  "antiPatterns": [
    "Slicing the same page twice.",
    "Publishing an undefined result from a superseded or cancelled load."
  ],
  "api": {
    "importPath": "@ancrel/workspace",
    "props": [
      {
        "name": "className",
        "required": false,
        "type": "string"
      },
      {
        "name": "columns",
        "required": true,
        "type": "readonly DataTableColumn<Row>[]"
      },
      {
        "name": "emptyState",
        "required": false,
        "type": "ReactNode"
      },
      {
        "name": "label",
        "required": true,
        "type": "string"
      },
      {
        "name": "onPaginationChange",
        "required": false,
        "type": "((pagination: PaginationState) => void) | undefined"
      },
      {
        "name": "onSelectionChange",
        "required": false,
        "type": "((keys: readonly string[]) => void) | undefined"
      },
      {
        "name": "pagination",
        "required": false,
        "type": "PaginationState"
      },
      {
        "name": "rowKey",
        "required": true,
        "type": "(row: Row) => string"
      },
      {
        "name": "rows",
        "required": true,
        "type": "readonly Row[]"
      },
      {
        "name": "selectedKeys",
        "required": false,
        "type": "readonly string[]"
      },
      {
        "name": "totalRows",
        "required": false,
        "type": "number"
      }
    ],
    "symbol": "DataTable",
    "typeRef": "api/workspace/data-table/index.d.ts"
  },
  "constraints": [
    "Supply the current page of rows and stable unique keys across pages.",
    "Use a positive pageSize and zero-based pageIndex. Keep selectedKeys in application state."
  ],
  "docs": "raw/frontend/data-table.md",
  "examples": [
    {
      "code": "'use client'\n\nimport { useState } from 'react'\nimport { Button } from '@ancrel/ui'\nimport { DataTable } from '@ancrel/workspace'\nimport '@ancrel/tokens/css'\nimport '@ancrel/ui/styles.css'\nimport '@ancrel/workspace/styles.css'\n\nconst projects = [{ code: 'A', name: 'Atlas' }, { code: 'B', name: 'Beacon' }, { code: 'C', name: 'Cedar' }]\n\nexport default function App() {\n  const [page, setPage] = useState({ pageIndex: 0, pageSize: 2 })\n  const [keys, setKeys] = useState<readonly string[]>([])\n  const [pinned, setPinned] = useState<readonly string[]>([])\n  const start = page.pageIndex * page.pageSize\n  return <DataTable label=\"Projects\" rows={projects.slice(start, start + page.pageSize)}\n    rowKey={row => row.code} selectedKeys={keys} onSelectionChange={setKeys}\n    pagination={page} totalRows={projects.length} onPaginationChange={setPage}\n    columns={[\n      { id: 'name', header: 'Project', cell: row => row.name },\n      { id: 'pinned', header: <>Pinned <Button size=\"sm\" disabled={!keys.length}\n          onClick={() => { setPinned([...new Set([...pinned, ...keys])]); setKeys([]) }}>\n          Pin selected ({keys.length})\n        </Button></>, cell: row => pinned.includes(row.code) ? 'Yes' : 'No' },\n    ]} />\n}\n",
      "command": "pnpm test",
      "entry": "examples/fe.data-table/App.tsx",
      "fixture": "examples/fe.data-table/",
      "id": "minimal"
    }
  ],
  "id": "fe.data-table",
  "kind": "react-component",
  "language": "typescript",
  "layer": "frontend",
  "owner": "frontend-infra",
  "package": {
    "ecosystem": "npm",
    "name": "@ancrel/workspace",
    "version": "0.2.0"
  },
  "provenance": {
    "changes": "Adapted per-page selection and pagination from lines 50–180 and 430–496 to arbitrary row and column adapters. Generalized the debounce and request numbering from frontend/src/components/reflux/useRefluxData.ts lines 1–140 into an abortable loader.",
    "commit": "4cc384c3bdbd09a3a50268adf81ba23f53aac93e",
    "mode": "extracted",
    "origin": "rule-studio",
    "path": "frontend/src/components/reflux/RefluxTable.tsx",
    "rights": "org-internal; approved-by=owner; ref=item-19"
  },
  "schemaVersion": 1,
  "stability": "experimental",
  "summary": "A paged, typed table with controlled selection and a debounced stale-safe loader.",
  "tokenDependencies": [
    "ref.color.x16161a",
    "ref.color.x202025",
    "ref.color.xededef",
    "ref.color.xffffff",
    "ref.fontFeature.tnum",
    "ref.space.px12",
    "ref.space.px8",
    "sys.ink.primary",
    "sys.space.gap",
    "sys.space.inset",
    "sys.surface.panel",
    "sys.type.numeric"
  ]
}
