{
  "component": {
    "id": "comments-thread",
    "name": "Comments thread",
    "tier": "pro",
    "exampleId": "comments-thread",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/comments-thread-demo.tsx",
    "exportName": "CommentsThreadDemo",
    "sha256": "97cb3d82157683894aa06b4ec9860bec4f7395a0306d2a23b69cc68a9c768986",
    "helperImports": [],
    "directComponentImports": [
      "comments-thread"
    ],
    "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/comments-thread",
    "registryUrl": "https://tidalui.com/r/pro/comments-thread.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/comments-thread",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/comments-thread",
      "registryUrl": "https://tidalui.com/r/pro/comments-thread.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/comments-thread.tsx",
    "exports": [
      "TidalCommentComposerContext",
      "TidalCommentsThread",
      "TidalThreadComment"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/comments-thread.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [],
    "registry": [],
    "additionalRegistry": [],
    "installClosure": [
      "comments-thread"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/comments-thread.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/comments-thread.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/comments-thread-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "\"use client\";\n\nimport \"./components/ui/tidal.css\";\n\nimport { useRef, useState } from \"react\";\n\nimport { TidalCommentsThread, type TidalCommentComposerContext, type TidalThreadComment } from \"./components/ui/comments-thread\";\n\nimport \"./components/ui/comments-thread.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 .comments-thread-demo {\\n  container: comments-thread-demo / inline-size;\\n  display: grid;\\n  width: 100%;\\n  max-width: 760px;\\n  min-width: 0;\\n  gap: 12px;\\n}\\n\\n.tidal-scope .comments-thread-demo-footer {\\n  display: flex;\\n  min-width: 0;\\n  align-items: center;\\n  justify-content: space-between;\\n  gap: 12px;\\n  flex-wrap: wrap;\\n}\\n\\n.tidal-scope .comments-thread-demo-footer p {\\n  min-width: 0;\\n  margin: 0;\\n  color: var(--t-muted);\\n  font-size: 11px;\\n  line-height: 1.5;\\n  overflow-wrap: anywhere;\\n}\\n\\n.tidal-scope .comments-thread-demo-footer button {\\n  min-width: 44px;\\n  min-height: 44px;\\n  max-width: 100%;\\n  padding: 9px 12px;\\n  color: var(--t-ink);\\n  background: var(--t-surface);\\n  border: 1px solid var(--t-border);\\n  border-radius: var(--t-radius-control);\\n  font: inherit;\\n  font-size: 11px;\\n  font-weight: 650;\\n  line-height: 1.3;\\n  overflow-wrap: anywhere;\\n  cursor: pointer;\\n}\\n\\n.tidal-scope .comments-thread-demo-footer button:focus-visible {\\n  outline: 2px solid var(--t-accent);\\n  outline-offset: 3px;\\n}\\n\\n@container comments-thread-demo (max-width: 360px) {\\n  .tidal-scope .comments-thread-demo-footer {\\n    align-items: stretch;\\n    flex-direction: column;\\n  }\\n}\";\n\nconst initialComments: TidalThreadComment[] = [\n  {\n    id: \"ava-review\",\n    author: \"Ava Reed\",\n    avatar: <img src={tidalExampleAvatarDataUri(\"01\")} alt=\"\" />,\n    timestamp: \"10:18 AM\",\n    dateTime: \"2026-10-14T10:18:00-05:00\",\n    content:\n      \"The launch note is clear. Could we name the owner for the final accessibility check?\",\n    attachments: <span>launch-notes.pdf · sample attachment</span>,\n    actions: {\n      reply: {},\n    },\n  },\n  {\n    id: \"noah-reply\",\n    author: \"Noah Kim\",\n    avatar: <img src={tidalExampleAvatarDataUri(\"02\")} alt=\"\" />,\n    timestamp: \"10:24 AM\",\n    dateTime: \"2026-10-14T10:24:00-05:00\",\n    replyToLabel: \"Reply to Ava\",\n    content: \"I can own that check and add the result here before noon.\",\n    actions: {\n      reply: {},\n      edit: {},\n      delete: {},\n    },\n  },\n  {\n    id: \"mila-note\",\n    author: \"Mila Chen\",\n    avatar: <img src={tidalExampleAvatarDataUri(\"03\")} alt=\"\" />,\n    timestamp: \"10:31 AM\",\n    dateTime: \"2026-10-14T10:31:00-05:00\",\n    content: \"@Noah I added the mobile checklist to the sample brief.\",\n    actions: {\n      reply: {},\n    },\n  },\n];\n\nconst baseContext: TidalCommentComposerContext = { kind: \"comment\" };\n\nexport function CommentsThreadDemo() {\n  const [comments, setComments] = useState(initialComments);\n  const [resolved, setResolved] = useState(false);\n  const [draft, setDraft] = useState(\"\");\n  const [context, setContext] =\n    useState<TidalCommentComposerContext>(baseContext);\n  const [status, setStatus] = useState(\n    \"Local sample discussion. Nothing is sent or stored.\",\n  );\n  const nextId = useRef(1);\n\n  const cancelComposer = () => {\n    setDraft(\"\");\n    setContext(baseContext);\n  };\n\n  return (\n    <div className=\"comments-thread-demo\">\n      <TidalCommentsThread\n        title=\"Launch brief comments\"\n        description=\"Review notes for this sample record.\"\n        comments={comments}\n        resolved={resolved}\n        onResolvedChange={(next) => {\n          setResolved(next);\n          setStatus(\n            next ? \"Sample thread resolved.\" : \"Sample thread reopened.\",\n          );\n        }}\n        onReplyRequest={(comment) => {\n          setDraft(\"\");\n          setContext({\n            kind: \"reply\",\n            commentId: comment.id,\n            label: `Reply to ${comment.author}`,\n          });\n        }}\n        onEditRequest={(comment) => {\n          setDraft(typeof comment.content === \"string\" ? comment.content : \"\");\n          setContext({\n            kind: \"edit\",\n            commentId: comment.id,\n            label: `Edit ${comment.author}'s comment`,\n          });\n        }}\n        onDeleteRequest={(comment) => {\n          setComments((current) =>\n            current.filter((candidate) => candidate.id !== comment.id),\n          );\n          if (context.kind !== \"comment\" && context.commentId === comment.id) {\n            cancelComposer();\n          }\n          setStatus(`${comment.author}'s sample comment deleted.`);\n        }}\n        draft={draft}\n        onDraftChange={setDraft}\n        composerContext={context}\n        onCancelComposer={cancelComposer}\n        composerHint=\"Use this local form to add, reply to, or edit a sample comment.\"\n        textareaProps={{\n          placeholder: \"Write a comment\",\n          maxLength: 500,\n          autoComplete: \"off\",\n        }}\n        onSubmitComment={(value, event) => {\n          event.preventDefault();\n          const message = value.trim();\n          if (!message) return;\n          if (context.kind === \"edit\") {\n            setComments((current) =>\n              current.map((comment) =>\n                comment.id === context.commentId\n                  ? { ...comment, content: message, editedLabel: \"Edited\" }\n                  : comment,\n              ),\n            );\n            setStatus(\"Sample comment edited.\");\n          } else {\n            const target =\n              context.kind === \"reply\"\n                ? comments.find((comment) => comment.id === context.commentId)\n                : undefined;\n            setComments((current) => [\n              ...current,\n              {\n                id: `local-${nextId.current++}`,\n                author: \"You\",\n                avatar: <span aria-hidden=\"true\">YS</span>,\n                timestamp: \"Just now\",\n                replyToLabel: target ? `Reply to ${target.author}` : undefined,\n                content: message,\n                actions: { edit: {}, delete: {} },\n              },\n            ]);\n            setStatus(target ? \"Sample reply added.\" : \"Sample comment added.\");\n          }\n          setDraft(\"\");\n          setContext(baseContext);\n        }}\n      />\n      <footer className=\"comments-thread-demo-footer\">\n        <p role=\"status\">{status}</p>\n        <button\n          type=\"button\"\n          onClick={() => {\n            setComments(initialComments);\n            setResolved(false);\n            cancelComposer();\n            setStatus(\"Sample discussion reset.\");\n          }}\n        >\n          Reset sample\n        </button>\n      </footer>\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      <CommentsThreadDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/comments-thread.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [
    {
      "prop": "comments",
      "type": "inferred-from-existing-demo",
      "initial": "initialComments",
      "setter": "setComments",
      "proposalCanBeRejected": false
    },
    {
      "prop": "resolved",
      "type": "inferred-from-existing-demo",
      "initial": "false",
      "setter": "setResolved",
      "proposalCanBeRejected": false
    },
    {
      "prop": "draft",
      "type": "inferred-from-existing-demo",
      "initial": "\"\"",
      "setter": "setDraft",
      "proposalCanBeRejected": false
    },
    {
      "prop": "composerContext",
      "type": "inferred-from-existing-demo",
      "initial": "baseContext",
      "setter": "setContext",
      "proposalCanBeRejected": false
    }
  ],
  "events": [
    {
      "name": "onCancelComposer",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": true,
      "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": true,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onDeleteRequest",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": true,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onDraftChange",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": true,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onEditRequest",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": true,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onReplyRequest",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": true,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onResolvedChange",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": true,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onSubmitComment",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": true,
      "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": "Consumer-provided label remains required where the component API requires one.",
    "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": []
}
