{
  "component": {
    "id": "cookie-banner",
    "name": "Cookie banner",
    "tier": "pro",
    "exampleId": "cookie-banner",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/cookie-banner-demo.tsx",
    "exportName": "CookieBannerDemo",
    "sha256": "2fb2e276eed5664ac13240a3e70a0db2f9dac71b365bdf6f0edbae3027dba196",
    "helperImports": [],
    "directComponentImports": [
      "cookie-banner"
    ],
    "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/cookie-banner",
    "registryUrl": "https://tidalui.com/r/pro/cookie-banner.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/cookie-banner",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/cookie-banner",
      "registryUrl": "https://tidalui.com/r/pro/cookie-banner.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/cookie-banner.tsx",
    "exports": [
      "TidalCookieBanner",
      "TidalCookieBannerAction"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/cookie-banner.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [],
    "registry": [],
    "additionalRegistry": [],
    "installClosure": [
      "cookie-banner"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/cookie-banner.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/cookie-banner.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/cookie-banner-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "\"use client\";\n\nimport \"./components/ui/tidal.css\";\n\nimport { useId, useLayoutEffect, useRef, useState } from \"react\";\n\nimport { TidalCookieBanner, type TidalCookieBannerAction } from \"./components/ui/cookie-banner\";\n\nimport \"./components/ui/cookie-banner.css\";\n\n\n\nconst tidalExampleStyles = \".tidal-scope .cookie-demo,\\n.tidal-scope .cookie-demo * {\\n  box-sizing: border-box;\\n}\\n\\n.tidal-scope .cookie-demo {\\n  width: 100%;\\n  min-width: 0;\\n  color: var(--t-ink);\\n  container: cookie-demo / inline-size;\\n  font-family: Inter, ui-sans-serif, system-ui, sans-serif;\\n}\\n\\n.tidal-scope .cookie-demo-frame {\\n  display: grid;\\n  min-width: 0;\\n  gap: 10px;\\n  padding: clamp(8px, 2.8cqi, 28px);\\n}\\n\\n.tidal-scope .cookie-demo-receipt {\\n  display: flex;\\n  min-width: 0;\\n  min-height: 116px;\\n  align-items: center;\\n  justify-content: space-between;\\n  gap: 18px;\\n  padding: 20px;\\n  border: 1px solid var(--t-ink);\\n  border-radius: 22px;\\n  background: var(--t-ink);\\n  color: var(--t-surface);\\n  animation: cookie-demo-receipt-in 360ms var(--t-ease-out) both;\\n}\\n\\n.tidal-scope .cookie-demo-receipt > div {\\n  display: grid;\\n  min-width: 0;\\n  gap: 6px;\\n}\\n\\n.tidal-scope .cookie-demo-receipt span,\\n.tidal-scope .cookie-demo-policy > span {\\n  color: var(--t-muted);\\n  font-size: 11px;\\n  font-weight: 720;\\n  letter-spacing: 0.09em;\\n  line-height: 1.4;\\n  text-transform: uppercase;\\n}\\n\\n.tidal-scope .cookie-demo-receipt span {\\n  color: var(--t-surface);\\n  opacity: 0.66;\\n}\\n\\n.tidal-scope .cookie-demo-receipt strong {\\n  min-width: 0;\\n  font-size: clamp(18px, 3cqi, 28px);\\n  font-weight: 560;\\n  letter-spacing: -0.035em;\\n  line-height: 1.1;\\n  overflow-wrap: anywhere;\\n}\\n\\n.tidal-scope .cookie-demo-receipt button {\\n  min-width: 132px;\\n  min-height: 44px;\\n  flex: none;\\n  padding: 8px 13px;\\n  border: 1px solid var(--t-surface);\\n  border-radius: 10px;\\n  background: var(--t-surface);\\n  color: var(--t-ink);\\n  font: inherit;\\n  font-size: 11px;\\n  font-weight: 690;\\n  cursor: pointer;\\n  transition:\\n    background 160ms,\\n    color 160ms,\\n    transform 140ms var(--t-ease-out);\\n}\\n\\n.tidal-scope .cookie-demo-receipt button:hover {\\n  background: var(--t-ink);\\n  color: var(--t-surface);\\n}\\n\\n.tidal-scope .cookie-demo-receipt button:active {\\n  transform: scale(0.97);\\n}\\n\\n.tidal-scope .cookie-demo-receipt button:focus-visible,\\n.tidal-scope .cookie-demo-policy:focus-visible,\\n.tidal-scope .cookie-demo-preferences input:focus-visible {\\n  outline: 2px solid var(--t-accent);\\n  outline-offset: 3px;\\n}\\n\\n.tidal-scope .cookie-demo-preferences {\\n  display: grid;\\n  min-width: 0;\\n  gap: 5px;\\n  padding: 0;\\n  margin: 0;\\n  border: 0;\\n}\\n\\n.tidal-scope .cookie-demo-preferences legend {\\n  margin-bottom: 4px;\\n  color: var(--t-ink);\\n  font-size: 11px;\\n  font-weight: 720;\\n}\\n\\n.tidal-scope .cookie-demo-preferences label {\\n  display: grid;\\n  min-width: 0;\\n  min-height: 48px;\\n  grid-template-columns: minmax(0, 1fr) auto;\\n  align-items: center;\\n  gap: 10px;\\n  padding: 6px 8px;\\n  border: 1px solid var(--t-border);\\n  border-radius: 9px;\\n  background: var(--t-surface);\\n  cursor: pointer;\\n}\\n\\n.tidal-scope .cookie-demo-preferences label:has(input:disabled) {\\n  cursor: default;\\n}\\n\\n.tidal-scope .cookie-demo-preferences label > span {\\n  display: grid;\\n  min-width: 0;\\n  gap: 2px;\\n}\\n\\n.tidal-scope .cookie-demo-preferences strong,\\n.tidal-scope .cookie-demo-preferences small {\\n  min-width: 0;\\n  overflow-wrap: anywhere;\\n}\\n\\n.tidal-scope .cookie-demo-preferences strong {\\n  color: var(--t-ink);\\n  font-size: 11px;\\n}\\n\\n.tidal-scope .cookie-demo-preferences small {\\n  font-size: 11px;\\n  line-height: 1.35;\\n}\\n\\n.tidal-scope .cookie-demo-preferences input {\\n  width: 20px;\\n  height: 20px;\\n  accent-color: var(--t-ink);\\n}\\n\\n.tidal-scope .cookie-demo-policy {\\n  min-width: 0;\\n  padding: 20px;\\n  border: 1px solid var(--t-border);\\n  border-radius: 18px;\\n  background: var(--t-subtle);\\n}\\n\\n.tidal-scope .cookie-demo-policy h2 {\\n  margin: 9px 0 0;\\n  font-size: 18px;\\n  font-weight: 620;\\n  letter-spacing: -0.04em;\\n  line-height: 1.1;\\n  overflow-wrap: anywhere;\\n}\\n\\n.tidal-scope .cookie-demo-policy p {\\n  max-width: 68ch;\\n  margin: 8px 0 0;\\n  color: var(--t-muted);\\n  font-size: 11px;\\n  line-height: 1.6;\\n  overflow-wrap: anywhere;\\n}\\n\\n.tidal-scope .cookie-demo-footer {\\n  padding: 3px 2px 0;\\n  color: var(--t-muted);\\n  font-size: 11px;\\n  line-height: 1.5;\\n  overflow-wrap: anywhere;\\n}\\n\\n@container cookie-demo (max-width: 480px) {\\n  .tidal-scope .cookie-demo-frame {\\n    padding: 6px;\\n  }\\n\\n  .tidal-scope .cookie-demo-receipt {\\n    align-items: stretch;\\n    flex-direction: column;\\n    padding: 18px;\\n  }\\n\\n  .tidal-scope .cookie-demo-receipt button {\\n    width: 100%;\\n    min-width: 0;\\n    font-size: 16px;\\n  }\\n\\n  .tidal-scope .cookie-demo-policy {\\n    padding: 18px;\\n  }\\n\\n  .tidal-scope .cookie-demo-preferences label {\\n    min-height: 52px;\\n  }\\n}\\n\\n@media (hover: none) and (pointer: coarse) {\\n  .tidal-scope .cookie-demo-receipt button {\\n    font-size: 16px;\\n  }\\n}\\n\\n@media (prefers-reduced-motion: reduce) {\\n  .tidal-scope .cookie-demo-receipt,\\n  .tidal-scope .cookie-demo-receipt button {\\n    animation: none;\\n    transition: none;\\n  }\\n\\n  .tidal-scope .cookie-demo-receipt button:active {\\n    transform: none;\\n  }\\n}\\n\\n@keyframes cookie-demo-receipt-in {\\n  from {\\n    opacity: 0;\\n    transform: translateY(7px);\\n  }\\n  to {\\n    opacity: 1;\\n    transform: none;\\n  }\\n}\";\n\nexport function CookieBannerDemo() {\n  const generatedId = useId().replace(/:/g, \"\");\n  const preferencesId = `${generatedId}-sample-preferences`;\n  const policyId = `${generatedId}-sample-policy`;\n  const [visible, setVisible] = useState(true);\n  const [preferencesOpen, setPreferencesOpen] = useState(false);\n  const [policyOpen, setPolicyOpen] = useState(false);\n  const [measurement, setMeasurement] = useState(false);\n  const [personalization, setPersonalization] = useState(false);\n  const [choice, setChoice] = useState(\"No sample choice yet.\");\n  const [focusIntent, setFocusIntent] = useState<\"banner\" | \"receipt\" | null>(\n    null,\n  );\n  const primaryActionRef = useRef<HTMLButtonElement>(null);\n  const restoreRef = useRef<HTMLButtonElement>(null);\n\n  useLayoutEffect(() => {\n    if (focusIntent === \"banner\" && visible)\n      primaryActionRef.current?.focus({ preventScroll: true });\n    if (focusIntent === \"receipt\" && !visible)\n      restoreRef.current?.focus({ preventScroll: true });\n    setFocusIntent(null);\n  }, [focusIntent, visible]);\n\n  function recordChoice(nextChoice: string) {\n    setChoice(nextChoice);\n    setVisible(false);\n    setFocusIntent(\"receipt\");\n  }\n\n  const actions: readonly TidalCookieBannerAction[] = [\n    {\n      id: \"manage\",\n      label: preferencesOpen ? \"Hide choices\" : \"Manage choices\",\n      buttonProps: {\n        \"aria-expanded\": preferencesOpen,\n        \"aria-controls\": preferencesOpen ? preferencesId : undefined,\n      },\n      onAction: () => setPreferencesOpen((current) => !current),\n    },\n    {\n      id: \"essential\",\n      label: \"Essential only\",\n      onAction: () => {\n        setMeasurement(false);\n        setPersonalization(false);\n        recordChoice(\"Sample choice: essential only.\");\n      },\n    },\n    preferencesOpen\n      ? {\n          id: \"save\",\n          label: \"Save sample choice\",\n          emphasis: \"primary\",\n          buttonRef: primaryActionRef,\n          onAction: () =>\n            recordChoice(\n              `Sample choice: ${measurement ? \"measurement on\" : \"measurement off\"}, ${personalization ? \"personalization on\" : \"personalization off\"}.`,\n            ),\n        }\n      : {\n          id: \"all\",\n          label: \"Allow all\",\n          emphasis: \"primary\",\n          buttonRef: primaryActionRef,\n          onAction: () => {\n            setMeasurement(true);\n            setPersonalization(true);\n            recordChoice(\"Sample choice: all options allowed.\");\n          },\n        },\n  ];\n\n  return (\n    <section className=\"cookie-demo\" aria-label=\"Cookie notice preview\">\n      <div className=\"cookie-demo-frame\">\n        {visible ? (\n          <TidalCookieBanner\n            title=\"Choose how this sample works\"\n            description=\"Essential items keep the preview usable. Optional choices can tailor the fictional workspace summary.\"\n            badge=\"Privacy choices\"\n            policyLink={{\n              label: \"Read the sample policy\",\n              href: `#${policyId}`,\n              linkProps: { onClick: () => setPolicyOpen(true) },\n            }}\n            detail={\n              preferencesOpen ? (\n                <fieldset\n                  id={preferencesId}\n                  className=\"cookie-demo-preferences\"\n                >\n                  <legend>Optional choices</legend>\n                  <label>\n                    <span>\n                      <strong>Essential</strong>\n                      <small>Required for this preview</small>\n                    </span>\n                    <input type=\"checkbox\" checked disabled />\n                  </label>\n                  <label>\n                    <span>\n                      <strong>Measurement</strong>\n                      <small>Sample usage summary</small>\n                    </span>\n                    <input\n                      type=\"checkbox\"\n                      checked={measurement}\n                      onChange={(event) =>\n                        setMeasurement(event.currentTarget.checked)\n                      }\n                    />\n                  </label>\n                  <label>\n                    <span>\n                      <strong>Personalization</strong>\n                      <small>Sample layout choice</small>\n                    </span>\n                    <input\n                      type=\"checkbox\"\n                      checked={personalization}\n                      onChange={(event) =>\n                        setPersonalization(event.currentTarget.checked)\n                      }\n                    />\n                  </label>\n                </fieldset>\n              ) : null\n            }\n            actions={actions}\n          />\n        ) : (\n          <div className=\"cookie-demo-receipt\">\n            <div>\n              <span>Local sample</span>\n              <strong>{choice}</strong>\n            </div>\n            <button\n              ref={restoreRef}\n              type=\"button\"\n              onClick={() => {\n                setVisible(true);\n                setFocusIntent(\"banner\");\n              }}\n            >\n              Review choices\n            </button>\n          </div>\n        )}\n\n        <article id={policyId} className=\"cookie-demo-policy\" tabIndex={-1}>\n          <span>Sample policy</span>\n          <h2>\n            {policyOpen ? \"What each choice means here\" : \"Policy details\"}\n          </h2>\n          {policyOpen ? (\n            <p>\n              Essential keeps the preview usable. Optional choices change only\n              the visible receipt and reset when the preview reloads.\n            </p>\n          ) : (\n            <p>Open the policy link to review the supplied choices.</p>\n          )}\n        </article>\n\n        <footer className=\"cookie-demo-footer\">\n          Sample choices. No cookie or preference is stored.\n        </footer>\n      </div>\n    </section>\n  );\n}\n\nexport default function AgentExample() {\n  return (\n    <div className=\"tidal-scope\" data-theme=\"light\" dir=\"ltr\">\n      <style>{tidalExampleStyles}</style>\n      <CookieBannerDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/cookie-banner.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [
    {
      "prop": "checked",
      "type": "inferred-from-existing-demo",
      "initial": "false",
      "setter": "setMeasurement",
      "proposalCanBeRejected": false
    }
  ],
  "events": [
    {
      "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."
    }
  ],
  "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": "No error announcement path is present in this demo; the consumer owns validation messaging.",
    "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": []
}
