{
  "component": {
    "id": "data-table",
    "name": "Data table",
    "tier": "pro",
    "exampleId": "data-table",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/data-table-demo.tsx",
    "exportName": "DataTableDemo",
    "sha256": "d13fd488440752db640574d089f693ba97096d03a2a312564a157bc104d580aa",
    "helperImports": [],
    "directComponentImports": [
      "data-table"
    ],
    "sampleBoundary": "Existing local demo fixture with fictional data and callbacks. No live service, customer data, access key, or Pro source is included."
  },
  "install": {
    "command": "npx shadcn@latest add @tidal-pro/data-table",
    "registryUrl": "https://tidalui.com/r/pro/data-table.json",
    "namespace": "@tidal-pro",
    "access": "pro",
    "sourceDelivery": "server-gated",
    "requiresAuthorization": true,
    "tokenSource": "local-env",
    "tokenEnvName": "TIDALUI_TOKEN",
    "cli": {
      "package": "shadcn",
      "requested": "latest"
    }
  },
  "installPlan": [
    {
      "order": 1,
      "kind": "primary",
      "dependency": "@tidal-pro/data-table",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/data-table",
      "registryUrl": "https://tidalui.com/r/pro/data-table.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/data-table.tsx",
    "exports": [
      "TidalDataTable",
      "TidalTableColumn",
      "TidalTableSort"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/data-table.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [
      "lucide-react"
    ],
    "registry": [],
    "additionalRegistry": [],
    "installClosure": [
      "data-table"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/data-table.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/data-table.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/data-table-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "import \"./components/ui/tidal.css\";\n\nimport { useLayoutEffect, useRef, useState } from \"react\";\n\nimport { ArrowUpRight, Folder, Search, X, ChevronLeft, ChevronRight, RotateCcw } from \"lucide-react\";\n\nimport { TidalDataTable, type TidalTableColumn, type TidalTableSort } from \"./components/ui/data-table\";\n\nimport \"./components/ui/data-table.css\";\n\nfunction tidalExampleAvatarDataUri(seed: unknown) {\n  const text = String(seed).replace(/[^a-z0-9]/gi, \"\").slice(-2) || \"UI\";\n  const palette = [\"#333333\", \"#555555\", \"#777777\", \"#999999\", \"#bbbbbb\"];\n  const color = palette[Array.from(text).reduce((sum, character) => sum + character.charCodeAt(0), 0) % palette.length];\n  const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 96 96\"><rect width=\"96\" height=\"96\" rx=\"48\" fill=\"${color}\"/><circle cx=\"48\" cy=\"38\" r=\"17\" fill=\"white\" fill-opacity=\".92\"/><path d=\"M18 92c3-22 15-34 30-34s27 12 30 34\" fill=\"white\" fill-opacity=\".92\"/></svg>`;\n  return `data:image/svg+xml,${encodeURIComponent(svg)}`;\n}\n\nfunction tidalExampleImageDataUri(label: string) {\n  const safeLabel = label.replace(/[<>&]/g, \"\").slice(0, 28) || \"Sample image\";\n  const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1200 675\"><defs><linearGradient id=\"g\" x1=\"0\" x2=\"1\" y1=\"0\" y2=\"1\"><stop stop-color=\"#171717\"/><stop offset=\"1\" stop-color=\"#555555\"/></linearGradient></defs><rect width=\"1200\" height=\"675\" fill=\"url(#g)\"/><circle cx=\"950\" cy=\"100\" r=\"260\" fill=\"white\" fill-opacity=\".08\"/><text x=\"80\" y=\"570\" fill=\"white\" font-family=\"system-ui,sans-serif\" font-size=\"64\" font-weight=\"700\">${safeLabel}</text></svg>`;\n  return `data:image/svg+xml,${encodeURIComponent(svg)}`;\n}\n\nconst tidalExampleStyles = \".tidal-scope .data-table-specimen{container:table-demo/inline-size;width:100%;max-width:900px;min-width:0;padding:28px;border:1px solid var(--t-border);border-radius:var(--t-radius-card);background:var(--t-subtle);box-shadow:0 22px 44px -32px #00000033;color:var(--t-ink)}.tidal-scope .data-table-demo-title{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:22px}.tidal-scope .data-table-demo-title h3{font-size:22px;letter-spacing:-.7px;font-weight:500;line-height:1.2;margin:0 0 4px}.tidal-scope .data-table-demo-title p{font-size:11px;color:var(--t-muted);margin:0}.tidal-scope .data-table-demo-title>span{font-size:11px;border:1px solid var(--t-border);padding:4px 7px;border-radius:6px;color:var(--t-muted)}.tidal-scope .data-table-demo-toolbar{display:flex;gap:10px;align-items:center;justify-content:space-between;margin-bottom:14px}.tidal-scope .data-table-demo-search{display:flex;align-items:center;gap:8px;min-width:0;width:260px;max-width:100%;min-height:44px;border:1px solid var(--t-border);border-radius:9px;padding:0 12px;background:var(--t-surface);color:var(--t-muted)}.tidal-scope .data-table-demo-search:focus-within{outline:2px solid var(--t-accent);outline-offset:-2px}.tidal-scope .data-table-demo-search input{width:100%;min-width:0;min-height:44px;font:inherit;font-size:11px;padding:0;border:0;outline:0;background:transparent;color:var(--t-ink)}.tidal-scope .table-demo-reset,.tidal-scope .table-demo-open{display:grid;place-items:center;width:44px;min-width:44px;height:44px;flex:none;padding:0;border:1px solid transparent;border-radius:8px;background:transparent;color:var(--t-muted);cursor:pointer;transition:background 140ms,transform 180ms}.tidal-scope .table-demo-reset{border-color:var(--t-border);background:var(--t-surface)}.tidal-scope .table-demo-open:hover,.tidal-scope .table-demo-reset:hover{background:var(--t-wash);color:var(--t-ink)}.tidal-scope .table-demo-open:focus-visible,.tidal-scope .table-demo-reset:focus-visible{outline:2px solid var(--t-accent);outline-offset:-3px}.tidal-scope .table-demo-open:active{transform:scale(.94)}.tidal-scope .table-demo-project{display:flex;align-items:center;gap:10px;min-width:0}.tidal-scope .table-demo-project>span{display:grid;place-items:center;flex:none;width:30px;height:33px;border:1px solid var(--t-border);background:var(--t-subtle);border-radius:7px;color:var(--t-muted)}.tidal-scope .table-demo-project>strong{font-size:11px;font-weight:500;min-width:0;overflow-wrap:anywhere}.tidal-scope .table-demo-status{display:inline-flex;align-items:center;gap:6px;padding:4px 7px;border:1px solid var(--t-border);border-radius:5px;font-size:11px;white-space:nowrap;color:var(--t-muted)}.tidal-scope .table-demo-status>i{width:5px;height:5px;border-radius:50%;border:1px solid var(--t-muted)}.tidal-scope .table-demo-status[data-complete=true]{color:var(--t-ink)}.tidal-scope .table-demo-status[data-complete=true]>i{background:var(--t-ink);border-color:var(--t-ink)}.tidal-scope .table-demo-owner{display:flex;align-items:center;gap:7px;font-size:11px;white-space:nowrap}.tidal-scope .table-demo-owner img{width:22px;height:22px;border-radius:50%;object-fit:cover}.tidal-scope .table-demo-tasks{font-size:11px;font-variant-numeric:tabular-nums}.tidal-scope .data-table-demo-footer{padding:0;border:0;width:100%;max-width:none;margin:10px 0 0;display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:11px;color:var(--t-muted);margin-top:10px}.tidal-scope .data-table-demo-footer nav{display:flex;align-items:center;gap:5px}.tidal-scope .data-table-demo-footer nav>span{min-width:35px;text-align:center;font-size:11px;font-variant-numeric:tabular-nums}.tidal-scope .data-table-demo-footer nav>button{display:grid;place-items:center;width:44px;height:44px;padding:0;border:1px solid var(--t-border);border-radius:8px;background:var(--t-surface);color:var(--t-ink);cursor:pointer;transition:background 140ms}.tidal-scope .data-table-demo-footer nav>button:hover:not([aria-disabled=true]){background:var(--t-wash)}.tidal-scope .data-table-demo-footer nav>button[aria-disabled=true]{opacity:.4;cursor:not-allowed}.tidal-scope .data-table-demo-footer nav>button:focus-visible{outline:2px solid var(--t-accent);outline-offset:-3px}.tidal-scope .data-table-demo-detail{display:flex;justify-content:space-between;gap:10px;align-items:center;border:1px solid var(--t-border);border-radius:10px;padding:10px 12px;margin-top:12px;background:var(--t-surface)}.tidal-scope .data-table-demo-detail>div{display:flex;flex-direction:column;min-width:0;gap:3px}.tidal-scope .data-table-demo-detail h4{margin:0;font-size:12px;font-weight:500;overflow-wrap:anywhere}.tidal-scope .data-table-demo-detail h4:focus{outline:0}.tidal-scope .data-table-demo-detail span{font-size:11px;color:var(--t-muted)}.tidal-scope .data-table-demo-note{font-size:11px;color:var(--t-muted);line-height:1.6;margin:13px 0 0}@media(max-width:480px){.tidal-scope .data-table-specimen{padding:18px}}@keyframes table-demo-detail-in{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:no-preference){.tidal-scope .data-table-demo-detail{animation:table-demo-detail-in 300ms var(--t-ease-out) both}}@media(prefers-reduced-motion:reduce){.tidal-scope .table-demo-open:active{transform:none}}\\n\\n.tidal-scope .table-demo-scroll-hint{display:none}@container table-demo (max-width:700px){.tidal-scope .table-demo-scroll-hint{display:inline}}\";\n\nconst records = [\n  {\n    id: \"website\",\n    name: \"Website\",\n    status: \"In review\",\n    owner: \"Ava Chen\",\n    tasks: 24,\n    portrait: 1,\n  },\n  {\n    id: \"mobile\",\n    name: \"Mobile app\",\n    status: \"In progress\",\n    owner: \"Noah Reed\",\n    tasks: 18,\n    portrait: 2,\n  },\n  {\n    id: \"brand\",\n    name: \"Brand assets\",\n    status: \"Complete\",\n    owner: \"Mila Stone\",\n    tasks: 12,\n    portrait: 3,\n  },\n  {\n    id: \"docs\",\n    name: \"Documentation\",\n    status: \"In progress\",\n    owner: \"Eli Park\",\n    tasks: 16,\n    portrait: 4,\n  },\n  {\n    id: \"onboarding\",\n    name: \"Onboarding\",\n    status: \"In review\",\n    owner: \"Ava Chen\",\n    tasks: 9,\n    portrait: 1,\n  },\n  {\n    id: \"research\",\n    name: \"User research\",\n    status: \"Complete\",\n    owner: \"Noah Reed\",\n    tasks: 8,\n    portrait: 2,\n  },\n];\n\ntype Project = (typeof records)[number];\n\nexport function DataTableDemo() {\n  const [query, setQuery] = useState(\"\"),\n    [sort, setSort] = useState<TidalTableSort | null>(null),\n    [selected, setSelected] = useState<Set<string>>(new Set()),\n    [page, setPage] = useState(1),\n    [detail, setDetail] = useState<string | null>(null),\n    [revision, setRevision] = useState(0);\n  const detailHeading = useRef<HTMLHeadingElement>(null),\n    opener = useRef<HTMLButtonElement | null>(null),\n    search = useRef<HTMLInputElement>(null);\n  useLayoutEffect(() => {\n    if (detail) detailHeading.current?.focus({ preventScroll: true });\n  }, [detail]);\n  function closeDetail() {\n    setDetail(null);\n    if (opener.current?.isConnected)\n      opener.current.focus({ preventScroll: true });\n    else search.current?.focus({ preventScroll: true });\n  }\n  const filtered = records.filter((r) =>\n    `${r.name} ${r.status} ${r.owner}`\n      .toLowerCase()\n      .includes(query.toLowerCase().trim()),\n  );\n  const ordered = sort\n    ? [...filtered].sort((a, b) => {\n        const v =\n          sort.column === \"tasks\"\n            ? a.tasks - b.tasks\n            : String(a[sort.column as keyof Project] ?? \"\").localeCompare(\n                String(b[sort.column as keyof Project] ?? \"\"),\n                \"en\",\n              );\n        return sort.direction === \"asc\" ? v : -v;\n      })\n    : filtered;\n  const count = Math.max(1, Math.ceil(ordered.length / 3)),\n    current = Math.min(page, count),\n    visible = ordered.slice((current - 1) * 3, current * 3),\n    opened = records.find((r) => r.id === detail);\n  const columns: TidalTableColumn<Project>[] = [\n    {\n      id: \"name\",\n      label: \"Project\",\n      sortable: true,\n      rowHeader: true,\n      width: 210,\n      cell: (r) => (\n        <span className=\"table-demo-project\">\n          <span aria-hidden=\"true\">\n            <Folder size={16} />\n          </span>\n          <strong>{r.name}</strong>\n        </span>\n      ),\n    },\n    {\n      id: \"status\",\n      label: \"Status\",\n      sortable: true,\n      width: 130,\n      cell: (r) => (\n        <span\n          className=\"table-demo-status\"\n          data-complete={r.status === \"Complete\"}\n        >\n          <i aria-hidden=\"true\" />\n          {r.status}\n        </span>\n      ),\n    },\n    {\n      id: \"owner\",\n      label: \"Owner\",\n      sortable: true,\n      width: 140,\n      cell: (r) => (\n        <span className=\"table-demo-owner\">\n          <img src={tidalExampleAvatarDataUri(r.portrait)} alt=\"\" />\n          {r.owner}\n        </span>\n      ),\n    },\n    {\n      id: \"tasks\",\n      label: \"Tasks\",\n      sortable: true,\n      align: \"end\",\n      width: 75,\n      cell: (r) => <span className=\"table-demo-tasks\">{r.tasks}</span>,\n    },\n    {\n      id: \"actions\",\n      label: \"Details\",\n      align: \"end\",\n      width: 70,\n      cell: (r) => (\n        <button\n          className=\"table-demo-open\"\n          type=\"button\"\n          aria-label={`Show ${r.name} details`}\n          onClick={(e) => {\n            opener.current = e.currentTarget;\n            setDetail(r.id);\n          }}\n        >\n          <ArrowUpRight size={17} aria-hidden=\"true\" />\n        </button>\n      ),\n    },\n  ];\n  return (\n    <div className=\"data-table-specimen\">\n      <header className=\"data-table-demo-title\">\n        <div>\n          <h3>Projects</h3>\n          <p>Sample workspace</p>\n        </div>\n        <span>{records.length} total</span>\n      </header>\n      <div className=\"data-table-demo-toolbar\">\n        <label className=\"data-table-demo-search\">\n          <Search size={15} aria-hidden=\"true\" />\n          <input\n            ref={search}\n            type=\"search\"\n            aria-label=\"Search sample projects\"\n            placeholder=\"Search projects…\"\n            value={query}\n            onChange={(e) => {\n              setQuery(e.target.value);\n              setPage(1);\n            }}\n          />\n        </label>\n        <button\n          type=\"button\"\n          className=\"table-demo-reset\"\n          aria-label=\"Reset sample table\"\n          onClick={() => {\n            setQuery(\"\");\n            setSort(null);\n            setSelected(new Set());\n            setPage(1);\n            setDetail(null);\n            setRevision((n) => n + 1);\n          }}\n        >\n          <RotateCcw size={15} aria-hidden=\"true\" />\n        </button>\n      </div>\n      <TidalDataTable\n        key={revision}\n        caption=\"Sample projects\"\n        columns={columns}\n        rows={visible}\n        getRowId={(r) => r.id}\n        sort={sort}\n        onSortChange={(next) => {\n          setSort(next);\n          setPage(1);\n        }}\n        selection={{\n          selectedIds: selected,\n          onSelectionChange: setSelected,\n          getRowLabel: (r) => r.name,\n        }}\n        empty=\"No sample projects match this search.\"\n      />\n      <footer className=\"data-table-demo-footer\">\n        <span role=\"status\">\n          {selected.size\n            ? `${selected.size} selected`\n            : `${filtered.length} results`}\n        </span>\n        <nav aria-label=\"Sample table pages\">\n          <button\n            type=\"button\"\n            aria-label=\"Previous sample table page\"\n            aria-disabled={current === 1}\n            onClick={() => {\n              if (current > 1) setPage(current - 1);\n            }}\n          >\n            <ChevronLeft size={15} aria-hidden=\"true\" />\n          </button>\n          <span>\n            {current} / {count}\n          </span>\n          <button\n            type=\"button\"\n            aria-label=\"Next sample table page\"\n            aria-disabled={current === count}\n            onClick={() => {\n              if (current < count) setPage(current + 1);\n            }}\n          >\n            <ChevronRight size={15} aria-hidden=\"true\" />\n          </button>\n        </nav>\n      </footer>\n      {opened ? (\n        <section\n          className=\"data-table-demo-detail\"\n          aria-label={`${opened.name} sample details`}\n        >\n          <div>\n            <h4 ref={detailHeading} tabIndex={-1}>\n              {opened.name}\n            </h4>\n            <span>\n              {opened.tasks} tasks · {opened.status}\n            </span>\n          </div>\n          <button\n            type=\"button\"\n            className=\"table-demo-open\"\n            aria-label=\"Close sample details\"\n            onClick={closeDetail}\n          >\n            <X size={16} aria-hidden=\"true\" />\n          </button>\n        </section>\n      ) : null}\n      <p className=\"data-table-demo-note\">\n        <span className=\"table-demo-scroll-hint\">\n          Scroll horizontally to see all columns.{\" \"}\n        </span>\n        Sort columns, select rows or explore the sample records.\n      </p>\n    </div>\n  );\n}\n\nexport default function AgentExample() {\n  return (\n    <div className=\"tidal-scope\" data-theme=\"light\" dir=\"ltr\">\n      <style>{tidalExampleStyles}</style>\n      <DataTableDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/data-table.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [
    {
      "prop": "value",
      "type": "inferred-from-existing-demo",
      "initial": "\"\"",
      "setter": "setQuery",
      "proposalCanBeRejected": false
    }
  ],
  "events": [
    {
      "name": "onChange",
      "nativeType": "React synthetic event or native callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onClick",
      "nativeType": "React synthetic event or native callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onSortChange",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    }
  ],
  "nativeForm": {
    "participates": true,
    "names": [],
    "expectedFormData": {},
    "submitBehavior": "The existing demo's native form callback receives the submit event.",
    "resetBehavior": "Native reset behavior remains available where the demo renders a resettable control.",
    "disabledBehavior": "Disabled controls remain excluded from successful native form submission.",
    "readOnlyBehavior": "Read-only controls retain their value and remain inspectable by the consumer."
  },
  "accessibility": {
    "labelSource": "Existing demo label or ARIA prop",
    "semantics": "Preserve the component's native element and the semantics demonstrated by the source fixture.",
    "keyboard": [
      "Tab and Shift+Tab",
      "Enter or Space for native activation",
      "Arrow keys where the component exposes a composite control"
    ],
    "focusReturn": "Preserve browser focus order and visible focus.",
    "errorAnnouncement": "The existing error or alert path remains consumer-owned and should be announced by the rendered semantics.",
    "reducedMotion": "Verify prefers-reduced-motion with the existing component transition path.",
    "forcedColors": "Verify visible borders, text, and focus in forced-colors mode."
  },
  "responsive": {
    "widths": [
      320,
      390,
      768,
      1260
    ],
    "shortViewport": "Check the example at a 300px viewport height with keyboard or portal content visible.",
    "overflow": "The page should not gain horizontal overflow; component-local scrolling must remain intentional.",
    "touchTargetMinPx": 44,
    "coarseInputFontPx": 16
  },
  "errors": [
    {
      "fixture": "Exercise the existing demo's error, empty, loading, or invalid fixture.",
      "visibleResult": "The consumer-visible result must remain explicit and must not be replaced by a silent console error.",
      "focusResult": "Focus must remain on the triggering control or move to the announced error according to the native pattern.",
      "ownership": "Consumer-owned sample state only; no network request or customer data is used."
    }
  ],
  "verification": {
    "commands": [
      "npx tsc --noEmit",
      "npx vite build"
    ],
    "lockfile": "Use the consumer project's committed lockfile.",
    "browser": [
      "Chromium 1260x800",
      "Chromium 390x844",
      "Keyboard and reduced-motion pass"
    ]
  },
  "validation": {
    "consumerFixture": {
      "tsc": "pass",
      "viteBuild": "pass",
      "resourceModel": "Generated usage plus only the component files and CSS delivered by the primary item and listed registry dependencies."
    },
    "registryArtifact": "server-gated"
  },
  "exceptions": []
}
