{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "site-announcement-ticker",
  "type": "registry:component",
  "title": "Announcement Ticker",
  "description": "A thin announcement bar that rotates several messages vertically, with a progress hairline, a counter, pause on hover and focus, and a dismiss button.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "site",
    "announcement",
    "banner",
    "ticker",
    "rotating",
    "header",
    "promo bar"
  ],
  "docs": "https://hyperblur.dev/effects/site-announcement-ticker",
  "files": [
    {
      "path": "registry/hyperblur/site-announcement-ticker.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/site-announcement-ticker.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface TickerItem {\n  text: string;\n  href?: string;\n  tag?: string;\n}\n\nexport interface SiteAnnouncementTickerProps\n  extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n  items?: TickerItem[];\n  interval?: number;\n  dismissible?: boolean;\n  onDismiss?: () => void;\n  pauseOnHover?: boolean;\n  label?: string;\n  accent?: string;\n}\n\nconst defaultItems: TickerItem[] = [\n  { tag: \"New\", text: \"Workspaces 2.0 is live\", href: \"#\" },\n  { tag: \"Event\", text: \"Product keynote, Nov 18\", href: \"#\" },\n  { tag: \"Offer\", text: \"25% off annual billing\", href: \"#\" },\n];\n\nconst css = `\n.hb-yfa {\n  position: relative;\n  box-sizing: border-box;\n  display: grid;\n  grid-template-rows: 1fr;\n  width: 100%;\n  font-family: inherit;\n  font-size: 12.5px;\n  color: #ededed;\n  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;\n}\n.hb-yfa *, .hb-yfa *::before, .hb-yfa *::after { box-sizing: border-box; font-family: inherit; }\n.hb-yfa[data-closing=\"true\"] { grid-template-rows: 0fr; opacity: 0; }\n.hb-yfa-clip { min-height: 0; overflow: hidden; }\n.hb-yfa-bar {\n  position: relative;\n  display: grid;\n  grid-template-columns: 56px minmax(0, 1fr) 56px;\n  align-items: center;\n  height: 36px;\n  background: #111111;\n  border-bottom: 1px solid #262626;\n}\n.hb-yfa-view { position: relative; height: 36px; overflow: hidden; }\n.hb-yfa-row { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 4px; white-space: nowrap; }\n.hb-yfa-row[data-role=\"in\"] { animation: hb-yfa-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }\n.hb-yfa-row[data-role=\"in\"][data-first=\"true\"] { animation: none; }\n.hb-yfa-row[data-role=\"out\"] { animation: hb-yfa-out 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; pointer-events: none; }\n.hb-yfa-tag { flex: none; padding: 0 7px; font-size: 10px; font-weight: 600; line-height: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--hb-yfa-a, #7fb3ff); background: color-mix(in srgb, var(--hb-yfa-a, #2f7bff) 16%, transparent); border: 1px solid color-mix(in srgb, var(--hb-yfa-a, #2f7bff) 38%, transparent); border-radius: 999px; }\n.hb-yfa-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #d4d4d4; }\n.hb-yfa-link { display: flex; align-items: center; gap: 8px; min-width: 0; color: inherit; text-decoration: none; border-radius: 6px; }\n.hb-yfa-link:hover .hb-yfa-text { color: #ffffff; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #555555; }\n.hb-yfa-link:focus-visible { outline: 2px solid var(--hb-yfa-a, #2f7bff); outline-offset: 3px; }\n.hb-yfa-arrow { flex: none; width: 11px; height: 11px; color: #8f8f8f; transition: transform 0.2s ease; }\n.hb-yfa-link:hover .hb-yfa-arrow { transform: translateX(2px); color: #ededed; }\n.hb-yfa-count { justify-self: start; padding-left: 14px; font-family: var(--font-geist-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 10.5px; font-variant-numeric: tabular-nums; color: #6b6b6b; }\n.hb-yfa-end { justify-self: end; padding-right: 8px; }\n.hb-yfa-close { display: grid; place-items: center; width: 24px; height: 24px; margin: 0; padding: 0; color: #8f8f8f; background: transparent; border: 0; border-radius: 8px; cursor: pointer; transition: background-color 0.15s ease, color 0.15s ease; }\n.hb-yfa-close:hover { color: #ededed; background: rgba(255, 255, 255, 0.08); }\n.hb-yfa-close:focus-visible { outline: 2px solid var(--hb-yfa-a, #2f7bff); outline-offset: 1px; }\n.hb-yfa-close svg { width: 10px; height: 10px; }\n.hb-yfa-prog { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--hb-yfa-a, #2f7bff); opacity: 0.55; transform-origin: left center; animation: hb-yfa-prog linear both; }\n.hb-yfa[data-paused=\"true\"] .hb-yfa-prog { animation-play-state: paused; }\n@keyframes hb-yfa-in { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }\n@keyframes hb-yfa-out { from { transform: none; opacity: 1; } to { transform: translateY(-100%); opacity: 0; } }\n@keyframes hb-yfa-prog { from { transform: scaleX(0); } to { transform: scaleX(1); } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-yfa { transition: none; }\n  .hb-yfa-row[data-role=\"in\"] { animation: none; }\n  .hb-yfa-row[data-role=\"out\"] { display: none; }\n  .hb-yfa-arrow, .hb-yfa-close { transition: none; }\n}\n`;\n\nfunction Row({ item, role, first }: { item: TickerItem; role: \"in\" | \"out\"; first?: boolean }) {\n  const body = (\n    <>\n      {item.tag ? <span className=\"hb-yfa-tag\">{item.tag}</span> : null}\n      <span className=\"hb-yfa-text\">{item.text}</span>\n    </>\n  );\n  return (\n    <div className=\"hb-yfa-row\" data-role={role} data-first={first} aria-hidden={role === \"out\" ? true : undefined}>\n      {item.href && role === \"in\" ? (\n        <a className=\"hb-yfa-link\" href={item.href}>\n          {body}\n          <svg className=\"hb-yfa-arrow\" viewBox=\"0 0 12 12\" fill=\"none\" aria-hidden=\"true\">\n            <path d=\"M2.5 6h7M6.5 3l3 3-3 3\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n          </svg>\n        </a>\n      ) : (\n        <span className=\"hb-yfa-link\">{body}</span>\n      )}\n    </div>\n  );\n}\n\nexport function SiteAnnouncementTicker({\n  items = defaultItems,\n  interval = 3200,\n  dismissible = true,\n  onDismiss,\n  pauseOnHover = true,\n  label = \"Announcements\",\n  accent = \"#2f7bff\",\n  className = \"\",\n  style,\n  onPointerEnter,\n  onPointerLeave,\n  onFocus,\n  onBlur,\n  ...rest\n}: SiteAnnouncementTickerProps) {\n  const n = items.length;\n  const [pos, setPos] = React.useState({ index: 0, prev: 0, cycle: 0 });\n  const [hover, setHover] = React.useState(false);\n  const [focus, setFocus] = React.useState(false);\n  const [closing, setClosing] = React.useState(false);\n  const [gone, setGone] = React.useState(false);\n  const timer = React.useRef(0);\n\n  React.useEffect(() => () => window.clearTimeout(timer.current), []);\n\n  if (n === 0 || gone) return null;\n\n  const index = Math.min(pos.index, n - 1);\n  const paused = pauseOnHover && (hover || focus);\n\n  function advance() {\n    setPos((p) => ({ index: (p.index + 1) % n, prev: p.index, cycle: p.cycle + 1 }));\n  }\n\n  function dismiss() {\n    setClosing(true);\n    onDismiss?.();\n    timer.current = window.setTimeout(() => setGone(true), 320);\n  }\n\n  return (\n    <>\n      <style href=\"hb-site-announcement-ticker\" precedence=\"default\">{css}</style>\n      <div\n        role=\"region\"\n        aria-label={label}\n        data-paused={paused}\n        data-closing={closing}\n        className={`hb-yfa ${className}`}\n        style={{ \"--hb-yfa-a\": accent, ...style } as React.CSSProperties}\n        onPointerEnter={(e) => {\n          onPointerEnter?.(e);\n          setHover(true);\n        }}\n        onPointerLeave={(e) => {\n          onPointerLeave?.(e);\n          setHover(false);\n        }}\n        onFocus={(e) => {\n          onFocus?.(e);\n          setFocus(true);\n        }}\n        onBlur={(e) => {\n          onBlur?.(e);\n          if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setFocus(false);\n        }}\n        {...rest}\n      >\n        <div className=\"hb-yfa-clip\">\n          <div className=\"hb-yfa-bar\">\n            <span className=\"hb-yfa-count\" aria-hidden=\"true\">\n              {n > 1 ? `${index + 1}/${n}` : \"\"}\n            </span>\n            <div className=\"hb-yfa-view\" aria-live=\"off\">\n              {pos.cycle > 0 ? <Row key={`o-${pos.cycle}`} item={items[Math.min(pos.prev, n - 1)]} role=\"out\" /> : null}\n              <Row key={`i-${pos.cycle}`} item={items[index]} role=\"in\" first={pos.cycle === 0} />\n            </div>\n            <span className=\"hb-yfa-end\">\n              {dismissible ? (\n                <button type=\"button\" className=\"hb-yfa-close\" aria-label=\"Dismiss announcements\" onClick={dismiss}>\n                  <svg viewBox=\"0 0 10 10\" fill=\"none\" aria-hidden=\"true\"><path d=\"M1.8 1.8l6.4 6.4M8.2 1.8l-6.4 6.4\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" /></svg>\n                </button>\n              ) : null}\n            </span>\n            {n > 1 && !closing ? (\n              <span\n                key={pos.cycle}\n                className=\"hb-yfa-prog\"\n                aria-hidden=\"true\"\n                style={{ animationDuration: `${Math.max(600, interval)}ms` }}\n                onAnimationEnd={advance}\n              />\n            ) : null}\n          </div>\n        </div>\n      </div>\n    </>\n  );\n}\n"
    }
  ]
}