{
  "component": {
    "id": "export-dialog",
    "name": "Export dialog",
    "tier": "pro",
    "exampleId": "export-dialog",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/export-dialog-demo.tsx",
    "exportName": "ExportDialogDemo",
    "sha256": "212c3a0e998fcbe57b15944ac3c7d3cd0b9104649fa4909712a8687a798516d6",
    "helperImports": [],
    "directComponentImports": [
      "export-dialog",
      "tidal-button"
    ],
    "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/export-dialog",
    "registryUrl": "https://tidalui.com/r/pro/export-dialog.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/export-dialog",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/export-dialog",
      "registryUrl": "https://tidalui.com/r/pro/export-dialog.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/export-dialog.tsx",
    "exports": [
      "TidalButton",
      "TidalExportDialog",
      "TidalExportOptions",
      "TidalExportValue"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/export-dialog.css",
      "components/ui/dialog.css",
      "components/ui/native-select.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [
      "lucide-react"
    ],
    "registry": [
      "@tidal-pro/dialog",
      "@tidal-pro/native-select",
      "https://tidalui.com/r/tidal-button.json"
    ],
    "additionalRegistry": [],
    "installClosure": [
      "dialog",
      "export-dialog",
      "native-select",
      "tidal-button"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/export-dialog.css",
      "components/ui/dialog.css",
      "components/ui/native-select.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/export-dialog.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/export-dialog-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "\"use client\";\n\nimport \"./components/ui/tidal.css\";\n\nimport { useEffect, useState, type FormEvent } from \"react\";\n\nimport { TidalExportOptions, TidalExportDialog, type TidalExportValue } from \"./components/ui/export-dialog\";\n\nimport { TidalButton } from \"./components/ui/tidal-button\";\n\nimport \"./components/ui/export-dialog.css\";\n\nimport \"./components/ui/dialog.css\";\n\nimport \"./components/ui/native-select.css\";\n\n\n\nconst tidalExampleStyles = \".tidal-scope .export-dialog-demo {\\n  width: 100%;\\n  max-width: 580px;\\n  min-width: 0;\\n}\\n.tidal-scope .export-dialog-demo > .tidal-export-options {\\n  border: 1px solid var(--t-border);\\n  border-radius: 18px;\\n  background: var(--t-surface);\\n  padding: 26px;\\n  box-shadow:\\n    0 2px 3px #00000003,\\n    0 12px 32px #00000005;\\n}\\n.tidal-scope .export-dialog-note {\\n  font-size: 11px;\\n  color: var(--t-muted);\\n  line-height: 1.6;\\n  text-align: center;\\n  margin: 14px 8px 0;\\n}\\n.tidal-scope .export-dialog-open {\\n  display: flex;\\n  margin: 16px auto 0;\\n}\\n@media (max-width: 400px) {\\n  .tidal-scope .export-dialog-demo > .tidal-export-options {\\n    padding: 20px;\\n  }\\n}\";\n\nconst formats = [\n  { id: \"csv\", label: \"CSV spreadsheet\" },\n  { id: \"json\", label: \"JSON data\" },\n];\n\nconst scopes = [\n  {\n    id: \"all\",\n    label: \"All contacts\",\n    detail: \"Every row in this sample\",\n    countLabel: \"3 rows\",\n  },\n  {\n    id: \"filtered\",\n    label: \"Current filter\",\n    detail: \"Contacts with an active project\",\n    countLabel: \"2 rows\",\n  },\n  {\n    id: \"selected\",\n    label: \"Selected contacts\",\n    detail: \"Only the current selection\",\n    countLabel: \"1 row\",\n  },\n];\n\nconst fields = [\n  { id: \"name\", label: \"Name\" },\n  { id: \"email\", label: \"Email address\" },\n  { id: \"company\", label: \"Company\" },\n  { id: \"role\", label: \"Role\" },\n];\n\nconst rows = [\n  {\n    name: \"Mira Chen\",\n    email: \"mira@example.com\",\n    company: \"Northstar\",\n    role: \"Admin\",\n  },\n  {\n    name: \"Jon Bell\",\n    email: \"jon@example.com\",\n    company: \"Field Office\",\n    role: \"Editor\",\n  },\n  {\n    name: \"Sam Rivera\",\n    email: \"sam@example.com\",\n    company: \"Studio\",\n    role: \"Viewer\",\n  },\n];\n\nexport function ExportDialogDemo({\n  theme = \"light\",\n}: {\n  theme?: \"light\" | \"dark\";\n}) {\n  const [open, setOpen] = useState(false),\n    [value, setValue] = useState<TidalExportValue>({\n      formatId: \"csv\",\n      scopeId: \"all\",\n      fieldIds: [\"name\", \"email\", \"company\", \"role\"],\n    }),\n    [file, setFile] = useState<{\n      url: string;\n      name: string;\n      rows: number;\n    } | null>(null);\n  useEffect(\n    () => () => {\n      if (file) URL.revokeObjectURL(file.url);\n    },\n    [file],\n  );\n  const update = (next: TidalExportValue) => {\n    setValue(next);\n    setFile(null);\n  };\n  const prepare = (\n    next: TidalExportValue,\n    event: FormEvent<HTMLFormElement>,\n  ) => {\n    event.preventDefault();\n    const chosen = rows\n      .slice(\n        0,\n        next.scopeId === \"selected\" ? 1 : next.scopeId === \"filtered\" ? 2 : 3,\n      )\n      .map((row) =>\n        Object.fromEntries(\n          next.fieldIds.map((id) => [id, row[id as keyof typeof row]]),\n        ),\n      );\n    const text =\n      next.formatId === \"json\"\n        ? JSON.stringify(chosen, null, 2)\n        : [\n            next.fieldIds,\n            ...chosen.map((row) => next.fieldIds.map((id) => row[id])),\n          ]\n            .map((row) =>\n              row\n                .map(\n                  (cell) =>\n                    '\"' + String(cell ?? \"\").replaceAll('\"', '\"\"') + '\"',\n                )\n                .join(\",\"),\n            )\n            .join(\"\\r\\n\");\n    setFile({\n      url: URL.createObjectURL(\n        new Blob([text], {\n          type:\n            next.formatId === \"json\"\n              ? \"application/json\"\n              : \"text/csv;charset=utf-8\",\n        }),\n      ),\n      name: \"sample-contacts.\" + next.formatId,\n      rows: chosen.length,\n    });\n  };\n  const options = {\n    formats,\n    scopes,\n    fields,\n    value,\n    onValueChange: update,\n    onExportRequest: prepare,\n    footer: file ? (\n      <a href={file.url} download={file.name}>\n        Download {file.name}\n      </a>\n    ) : (\n      <span>{value.fieldIds.length} fields selected</span>\n    ),\n  };\n  return (\n    <div className=\"export-dialog-demo\">\n      <TidalExportOptions\n        {...options}\n        title=\"Export contacts\"\n        description=\"Choose rows and fields for a sample CSV or JSON file.\"\n      />\n      <TidalExportDialog\n        {...options}\n        theme={theme}\n        open={open}\n        onOpenChange={setOpen}\n        title=\"Export contacts\"\n        description=\"Choose rows and fields for a sample CSV or JSON file.\"\n        trigger={\n          <TidalButton variant=\"secondary\" className=\"export-dialog-open\">\n            Open as dialog\n          </TidalButton>\n        }\n      />\n      <p className=\"export-dialog-note\">\n        Files contain fictional sample contacts only.\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      <ExportDialogDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/export-dialog.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [
    {
      "prop": "open",
      "type": "inferred-from-existing-demo",
      "initial": "false",
      "setter": "setOpen",
      "proposalCanBeRejected": false
    }
  ],
  "events": [
    {
      "name": "onOpenChange",
      "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": "Verify focus returns to the invoking control after dismissal.",
    "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": []
}
