{
  "component": {
    "id": "api-key-manager",
    "name": "API key manager",
    "tier": "pro",
    "exampleId": "api-key-manager",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/api-key-manager-demo.tsx",
    "exportName": "ApiKeyManagerDemo",
    "sha256": "bd36ea5d37a9b3388be7483bc9f2f31c7800e750ea9ab1302cd24ee9f38c54a2",
    "helperImports": [],
    "directComponentImports": [
      "alert-dialog",
      "api-key-manager"
    ],
    "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/api-key-manager",
    "registryUrl": "https://tidalui.com/r/pro/api-key-manager.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/api-key-manager",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/api-key-manager",
      "registryUrl": "https://tidalui.com/r/pro/api-key-manager.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    },
    {
      "order": 2,
      "kind": "demo-only-additional",
      "dependency": "@tidal-pro/alert-dialog",
      "purpose": "complete-example-demo-dependency",
      "command": "npx shadcn@latest add @tidal-pro/alert-dialog",
      "registryUrl": "https://tidalui.com/r/pro/alert-dialog.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/api-key-manager.tsx",
    "exports": [
      "TidalAlertDialog",
      "TidalApiKeyManager",
      "TidalApiKeyRecord"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/api-key-manager.css",
      "components/ui/alert-dialog.css",
      "components/ui/status-badge.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [
      "lucide-react"
    ],
    "registry": [
      "https://tidalui.com/r/tidal-button.json",
      "https://tidalui.com/r/status-badge.json"
    ],
    "additionalRegistry": [
      "@tidal-pro/alert-dialog"
    ],
    "installClosure": [
      "alert-dialog",
      "api-key-manager",
      "status-badge",
      "tidal-button"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/api-key-manager.css",
      "components/ui/alert-dialog.css",
      "components/ui/status-badge.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/api-key-manager.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/api-key-manager-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "import \"./components/ui/tidal.css\";\n\nimport { useId, useRef, useState } from \"react\";\n\nimport { TidalApiKeyManager, type TidalApiKeyRecord } from \"./components/ui/api-key-manager\";\n\nimport { TidalAlertDialog } from \"./components/ui/alert-dialog\";\n\nimport \"./components/ui/api-key-manager.css\";\n\nimport \"./components/ui/alert-dialog.css\";\n\nimport \"./components/ui/status-badge.css\";\n\n\n\nconst tidalExampleStyles = \".tidal-scope .api-key-manager-demo {\\n  width: min(100%, 740px);\\n  max-width: 740px;\\n  min-width: 0;\\n}\\n.tidal-scope .api-key-manager-demo > p {\\n  font-size: 11px;\\n  line-height: 1.6;\\n  color: var(--t-muted);\\n  margin: 12px 0 0;\\n  overflow-wrap: anywhere;\\n}\\n.tidal-scope .api-key-demo-form {\\n  display: grid;\\n  gap: 10px;\\n  min-width: 0;\\n}\\n.tidal-scope .api-key-demo-form label {\\n  font-weight: 600;\\n}\\n.tidal-scope .api-key-demo-form input {\\n  box-sizing: border-box;\\n  width: 100%;\\n  min-width: 0;\\n  min-height: 44px;\\n  border: 1px solid var(--t-border);\\n  border-radius: 8px;\\n  background: var(--t-surface);\\n  color: var(--t-ink);\\n  font: inherit;\\n  font-size: 16px;\\n  padding: 10px 12px;\\n}\\n.tidal-scope .api-key-demo-form > div {\\n  display: flex;\\n  flex-wrap: wrap;\\n  gap: 8px;\\n}\\n.tidal-scope .api-key-demo-form button {\\n  font: inherit;\\n  color: var(--t-ink);\\n  background: var(--t-subtle);\\n  border: 1px solid var(--t-border);\\n  border-radius: 8px;\\n  min-height: 44px;\\n  min-width: 44px;\\n  padding: 10px 14px;\\n  cursor: pointer;\\n}\\n.tidal-scope .api-key-demo-form :is(input, button):focus-visible {\\n  outline: 2px solid var(--t-ink);\\n  outline-offset: 3px;\\n}\";\n\nconst initial: TidalApiKeyRecord[] = [\n  {\n    id: \"production\",\n    name: \"Production\",\n    maskedValue: \"demo_••••••••••••7a2c\",\n    scopes: [\"projects:read\", \"projects:write\"],\n    status: \"active\",\n    created: { label: \"Oct 12, 2026\", dateTime: \"2026-10-12\" },\n    lastUsed: { label: \"Today, 9:41 AM\" },\n  },\n  {\n    id: \"reporting\",\n    name: \"Reporting\",\n    maskedValue: \"demo_••••••••••••1f8b\",\n    scopes: [\"reports:read\"],\n    status: \"active\",\n    created: { label: \"Oct 8, 2026\", dateTime: \"2026-10-08\" },\n    lastUsed: { label: \"Yesterday, 3:12 PM\" },\n  },\n];\n\nexport function ApiKeyManagerDemo({\n  theme = \"light\",\n  dir = \"ltr\",\n}: {\n  theme?: \"light\" | \"dark\";\n  dir?: \"ltr\" | \"rtl\";\n}) {\n  const nameId = `api-key-name-${useId().replace(/:/g, \"\")}`;\n  const [keys, setKeys] = useState(initial),\n    [request, setRequest] = useState<TidalApiKeyRecord | null>(null),\n    [creating, setCreating] = useState(false),\n    [name, setName] = useState(\"\"),\n    [message, setMessage] = useState(\n      \"Sample records. No working keys are shown.\",\n    );\n  const createRef = useRef<HTMLButtonElement>(null),\n    opener = useRef<HTMLButtonElement | null>(null);\n  const nextId = useRef(1);\n  return (\n    <div className=\"api-key-manager-demo\" dir={dir}>\n      <TidalApiKeyManager\n        title=\"API keys\"\n        description=\"Manage access for your applications.\"\n        keys={keys}\n        createButtonRef={createRef}\n        onCreateRequest={() => setCreating((v) => !v)}\n        onRevokeRequest={(key, event) => {\n          opener.current = event.currentTarget;\n          setRequest(key);\n        }}\n        secret={\n          creating ? (\n            <form\n              className=\"api-key-demo-form\"\n              onSubmit={(e) => {\n                e.preventDefault();\n                if (!name.trim()) return;\n                setKeys((v) => [\n                  ...v,\n                  {\n                    id: `sample-${nextId.current++}`,\n                    name: name.trim(),\n                    maskedValue: \"demo_••••••••••••sample\",\n                    scopes: [\"projects:read\"],\n                    status: \"active\",\n                    created: { label: \"Added in this preview\" },\n                  },\n                ]);\n                setMessage(\n                  `Added ${name.trim()} as a sample record. No API key was generated.`,\n                );\n                setName(\"\");\n                setCreating(false);\n                createRef.current?.focus({ preventScroll: true });\n              }}\n            >\n              <label htmlFor={nameId}>Sample key name</label>\n              <input\n                id={nameId}\n                value={name}\n                onChange={(e) => setName(e.target.value)}\n                required\n                maxLength={80}\n                placeholder=\"Development\"\n                autoComplete=\"off\"\n              />\n              <div>\n                <button\n                  type=\"button\"\n                  onClick={() => {\n                    setCreating(false);\n                    createRef.current?.focus({ preventScroll: true });\n                  }}\n                >\n                  Cancel\n                </button>\n                <button type=\"submit\">Add sample record</button>\n              </div>\n            </form>\n          ) : undefined\n        }\n        dialog={\n          <TidalAlertDialog\n            open={request !== null}\n            onOpenChange={(open) => {\n              if (!open) setRequest(null);\n            }}\n            trigger={\n              <button type=\"button\" hidden tabIndex={-1}>\n                Revoke key\n              </button>\n            }\n            title={`Revoke ${request?.name ?? \"key\"}?`}\n            description=\"This changes only the sample record. Real key revocation belongs to your backend.\"\n            onCancel={() => setRequest(null)}\n            cancelLabel=\"Cancel\"\n            confirmLabel=\"Revoke sample key\"\n            onConfirm={() => {\n              if (request) {\n                setKeys((v) =>\n                  v.map((key) =>\n                    key.id === request.id ? { ...key, status: \"revoked\" } : key,\n                  ),\n                );\n                setMessage(`${request.name} is revoked in this preview.`);\n              }\n              setRequest(null);\n            }}\n            theme={theme}\n            dir={dir}\n            contentProps={{\n              onCloseAutoFocus: (e) => {\n                e.preventDefault();\n                opener.current?.focus({ preventScroll: true });\n              },\n            }}\n          />\n        }\n      />\n      <p role=\"status\">{message}</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      <ApiKeyManagerDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/api-key-manager.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [
    {
      "prop": "keys",
      "type": "inferred-from-existing-demo",
      "initial": "initial",
      "setter": "setKeys",
      "proposalCanBeRejected": false
    }
  ],
  "events": [
    {
      "name": "onCancel",
      "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": "onChange",
      "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": "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": "onConfirm",
      "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": "onCreateRequest",
      "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": "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."
    },
    {
      "name": "onRevokeRequest",
      "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": "onSubmit",
      "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."
    }
  ],
  "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": []
}
