{
  "component": {
    "id": "attachment-tray",
    "name": "Attachment tray",
    "tier": "pro",
    "exampleId": "attachment-tray",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/attachment-tray-demo.tsx",
    "exportName": "AttachmentTrayDemo",
    "sha256": "c885efafec425d20a68faa3e0a465fe7b2f8692881caa60999e903e01b76a1cb",
    "helperImports": [],
    "directComponentImports": [
      "attachment-tray"
    ],
    "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/attachment-tray",
    "registryUrl": "https://tidalui.com/r/pro/attachment-tray.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/attachment-tray",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/attachment-tray",
      "registryUrl": "https://tidalui.com/r/pro/attachment-tray.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/attachment-tray.tsx",
    "exports": [
      "TidalAttachment",
      "TidalAttachmentTray"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/attachment-tray.css",
      "components/ui/status-badge.css",
      "components/ui/progress.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [],
    "registry": [
      "https://tidalui.com/r/status-badge.json",
      "@tidal-pro/progress"
    ],
    "additionalRegistry": [],
    "installClosure": [
      "attachment-tray",
      "progress",
      "status-badge"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/attachment-tray.css",
      "components/ui/status-badge.css",
      "components/ui/progress.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/attachment-tray.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/attachment-tray-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "import \"./components/ui/tidal.css\";\n\nimport { useLayoutEffect, useRef, useState } from \"react\";\n\nimport { TidalAttachmentTray, type TidalAttachment } from \"./components/ui/attachment-tray\";\n\nimport \"./components/ui/attachment-tray.css\";\n\nimport \"./components/ui/status-badge.css\";\n\nimport \"./components/ui/progress.css\";\n\n\n\nconst tidalExampleStyles = \".tidal-scope .attachment-tray-demo {\\n  width: min(100%, 640px);\\n  min-width: 0;\\n}\\n.tidal-scope .attachment-demo-advance,\\n.tidal-scope .attachment-demo-footer > button {\\n  min-height: 44px;\\n  padding: 8px 12px;\\n  border: 1px solid var(--t-border);\\n  background: var(--t-surface);\\n  border-radius: 9px;\\n  color: var(--t-ink);\\n  font: inherit;\\n  font-size: 12px;\\n  cursor: pointer;\\n}\\n.tidal-scope .attachment-demo-advance:disabled {\\n  opacity: 0.45;\\n  cursor: not-allowed;\\n}\\n.tidal-scope .attachment-demo-footer {\\n  display: flex;\\n  flex-wrap: wrap;\\n  gap: 12px;\\n  align-items: center;\\n  justify-content: space-between;\\n  margin-top: 16px;\\n}\\n.tidal-scope .attachment-demo-footer > p {\\n  flex: 1 1 200px;\\n  min-width: 0;\\n  margin: 0;\\n  font-size: 11px;\\n  line-height: 1.6;\\n  color: var(--t-muted);\\n}\";\n\nconst sample: TidalAttachment[] = [\n  {\n    id: \"brief\",\n    name: \"Project brief.pdf\",\n    typeText: \"PDF document\",\n    sizeText: \"2.4 MB\",\n    status: \"ready\",\n  },\n  {\n    id: \"notes\",\n    name: \"Release notes.md\",\n    typeText: \"Markdown\",\n    sizeText: \"42 KB\",\n    status: \"uploading\",\n    progress: 64,\n  },\n  {\n    id: \"assets\",\n    name: \"Brand assets.zip\",\n    typeText: \"ZIP archive\",\n    sizeText: \"8.1 MB\",\n    status: \"error\",\n    error: \"Preparation was interrupted. Retry this sample file.\",\n  },\n];\n\nexport function AttachmentTrayDemo() {\n  const [items, setItems] = useState(sample);\n  const [status, setStatus] = useState(\n    \"Local sample files. Nothing is uploaded.\",\n  );\n  const root = useRef<HTMLElement>(null);\n  const reset = useRef<HTMLButtonElement>(null);\n  const recovery = useRef<{\n    id: string;\n    index: number;\n    source?: HTMLButtonElement;\n  } | null>(null);\n  useLayoutEffect(() => {\n    const intent = recovery.current;\n    recovery.current = null;\n    if (\n      !intent ||\n      (document.activeElement !== document.body &&\n        !(intent.source?.disabled && document.activeElement === intent.source))\n    )\n      return;\n    const rows = Array.from(\n      root.current?.querySelectorAll<HTMLElement>(\"[data-attachment-id]\") ?? [],\n    );\n    const row =\n      rows.find((x) => x.dataset.attachmentId === intent.id) ??\n      rows[Math.min(intent.index, rows.length - 1)];\n    (\n      row?.querySelector<HTMLButtonElement>(\n        '[data-attachment-action=\"remove\"]:not(:disabled)',\n      ) ?? reset.current\n    )?.focus({ preventScroll: true });\n  }, [items]);\n  return (\n    <div className=\"attachment-tray-demo\">\n      <TidalAttachmentTray\n        ref={root}\n        label=\"Attachments\"\n        attachments={items}\n        onRemove={(item) => {\n          recovery.current = {\n            id: item.id,\n            index: items.findIndex((x) => x.id === item.id),\n          };\n          setItems(items.filter((x) => x.id !== item.id));\n          setStatus(`${item.name} removed from the local sample.`);\n        }}\n        onRetry={(item) => {\n          recovery.current = {\n            id: item.id,\n            index: items.findIndex((x) => x.id === item.id),\n          };\n          setItems(\n            items.map((x) =>\n              x.id === item.id\n                ? { ...x, status: \"ready\", error: undefined }\n                : x,\n            ),\n          );\n          setStatus(`${item.name} is ready in the local sample.`);\n        }}\n        actions={\n          <button\n            type=\"button\"\n            className=\"attachment-demo-advance\"\n            disabled={!items.some((x) => x.status === \"uploading\")}\n            onClick={(event) => {\n              recovery.current = {\n                id: items.find((x) => x.status === \"uploading\")?.id ?? \"\",\n                index: 0,\n                source: event.currentTarget,\n              };\n              setItems(\n                items.map((x) =>\n                  x.status === \"uploading\"\n                    ? { ...x, status: \"ready\", progress: 100 }\n                    : x,\n                ),\n              );\n              setStatus(\"Sample preparation completed locally.\");\n            }}\n          >\n            Complete sample\n          </button>\n        }\n      />\n      <div className=\"attachment-demo-footer\">\n        <p role=\"status\">{status}</p>\n        <button\n          ref={reset}\n          type=\"button\"\n          onClick={() => {\n            setItems(sample);\n            setStatus(\"Local sample files restored. Nothing is uploaded.\");\n          }}\n        >\n          Reset sample\n        </button>\n      </div>\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      <AttachmentTrayDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/attachment-tray.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [
    {
      "prop": "attachments",
      "type": "inferred-from-existing-demo",
      "initial": "sample",
      "setter": "setItems",
      "proposalCanBeRejected": false
    }
  ],
  "events": [
    {
      "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": "onRemove",
      "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": "onRetry",
      "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": "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": []
}
