{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "banner",
  "title": "Banner",
  "description": "Astro announcement containers with optional dismissal and stored visibility.",
  "dependencies": [
    "@lucide/astro",
    "class-variance-authority",
    "cn"
  ],
  "registryDependencies": [
    "@gnostic/button",
    "@gnostic/dropdown-menu"
  ],
  "files": [
    {
      "path": "packages/ui/src/components/ui/banner/banner-container.astro",
      "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport XIcon from \"@lucide/astro/icons/x\"\nimport { Button } from \"@/components/ui/button\"\n\nimport { cn } from \"cn\"\n\ntype Props = HTMLAttributes<\"div\"> & {\n  showClose?: boolean\n}\n\nconst { class: className, showClose = true, ...props } = Astro.props\n---\n\n<div\n  class={cn(\n    \"relative mx-auto flex w-full max-w-7xl gap-4 px-4\",\n    showClose && \"pr-10\",\n    className,\n  )}\n  {...props}\n>\n  <slot />\n  {showClose && (\n    <Button\n      variant=\"ghost\"\n      size=\"icon-xs\"\n      data-slot=\"banner-close\"\n      aria-label=\"Close\"\n    >\n      <XIcon class=\"size-4\" />\n    </Button>\n  )}\n</div>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/banner/banner-container.astro"
    },
    {
      "path": "packages/ui/src/components/ui/banner/banner.astro",
      "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { bannerVariants, type BannerProps } from \"./types\"\n\nimport { cn } from \"cn\"\n\ntype Props = HTMLAttributes<\"aside\"> & BannerProps\n\nconst { class: className, variant, mode, storageKey, ...props } = Astro.props\n---\n\n<aside\n  class={cn(bannerVariants({ variant, mode }), className)}\n  data-slot=\"banner\"\n  data-banner-storage-key={storageKey}\n  data-variant={variant}\n  data-mode={mode}\n  {...props}\n>\n  <slot />\n</aside>\n\n<script>\n  const getStorageToken = (key: string) => `banner:${key}`\n\n  const syncBanners = () => {\n    document.querySelectorAll(\"[data-slot='banner']\").forEach((banner) => {\n      if (!(banner instanceof HTMLElement)) return\n      const storageKey = banner.dataset.bannerStorageKey\n      if (\n        storageKey &&\n        sessionStorage.getItem(getStorageToken(storageKey)) === \"hidden\"\n      ) {\n        banner.hidden = true\n      }\n    })\n  }\n\n  syncBanners()\n  document.addEventListener(\"astro:page-load\", syncBanners)\n\n  document.addEventListener(\"click\", (event) => {\n    if (!(event.target instanceof Element)) return\n    const closeButton = event.target.closest(\"[data-slot='banner-close']\")\n    const banner = closeButton?.closest(\"[data-slot='banner']\")\n    if (!(banner instanceof HTMLElement)) return\n    banner.hidden = true\n    const storageKey = banner.dataset.bannerStorageKey\n    if (storageKey)\n      sessionStorage.setItem(getStorageToken(storageKey), \"hidden\")\n  })\n</script>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/banner/banner.astro"
    },
    {
      "path": "packages/ui/src/components/ui/banner/types.ts",
      "content": "import { cva, type VariantProps } from 'class-variance-authority'\n\nexport const bannerVariants = cva(\"@container relative flex items-center py-2\", {\n    variants: {\n        variant: {\n            default: \"bg-foreground text-background w-full\",\n            floating: \"bg-background mx-auto my-2 w-[calc(100%-2rem)] max-w-[calc(var(--container,var(--container-7xl))-2rem)] overflow-hidden rounded-lg border shadow-sm\",\n        },\n        mode: {\n            inverted: \"inverted bg-background text-foreground\",\n            default: '',\n        },\n    },\n    defaultVariants: {\n        variant: 'default',\n        mode: 'default',\n    },\n})\n\nexport type BannerProps = VariantProps<typeof bannerVariants> & {\n    /**\n     * The key used to store whether the banner has been dismissed.\n     *\n     * @default `banner-${variant}`\n     */\n    storageKey?: string\n    class?: string\n\n    showClose?: boolean\n}\n",
      "type": "registry:file",
      "target": "~/src/components/ui/banner/types.ts"
    },
    {
      "path": "packages/ui/src/components/ui/banner/index.ts",
      "content": "export { default as Banner } from './banner.astro'\nexport { default as BannerContainer } from './banner-container.astro'\nexport type { BannerProps } from './types'\n",
      "type": "registry:file",
      "target": "~/src/components/ui/banner/index.ts"
    }
  ],
  "meta": {
    "framework": "astro",
    "source": "@gnostic/ui",
    "testedDependencies": {
      "@lucide/astro": "^1.68.0",
      "class-variance-authority": "^0.7.1",
      "cn": "0.5.2"
    }
  },
  "docs": "https://gnosticai.com/ui/components/banner",
  "categories": [
    "ui"
  ],
  "type": "registry:ui"
}
