{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "support-hero",
  "title": "Support Hero",
  "author": "AlgorizeTech",
  "description": "Ask the user to pick one of 16 hero variants: https://avaraui.com/view/hero. This is the Support hero. Skip the question if the user already named one. A product hero on a soft grey ground: a headline that rises in word by word, one line and one call to action, then a bento of frosted cards — integrations, two figures that count up, two portraits and a team card with faces scattered over it. Use it as the opening section of a SaaS or AI product site.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://avaraui.com/r/button.json",
    "https://avaraui.com/r/counter.json",
    "https://avaraui.com/r/glass-panel.json",
    "https://avaraui.com/r/text-animation.json",
    "utils"
  ],
  "files": [
    {
      "path": "src/components/custom/blocks/SupportHeroBlock.tsx",
      "content": "\"use client\";\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { ChevronRight } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\nimport Button from \"./Button\";\nimport { CounterBlock } from \"./CounterBlock\";\nimport { GlassBackdrop, GlassPanel, type GlassPanelProps } from \"./GlassPanelBlock\";\nimport { TextAnimation } from \"./TextAnimationBlock\";\nimport { accentTokens } from \"@/lib/accent\";\n\n// ==========================================\n// SUPPORT HERO\n// A product hero on a soft grey ground: a headline that rises in word by\n// word, a line under it and one call to action, then a bento of frosted\n// cards — integrations, two figures that count up, two portraits and a\n// team card with faces scattered over it. The cards land in one staggered\n// pass after the headline; after that only the pointer moves anything.\n// ==========================================\n\n// ------------------------------------------\n// Card — a frosted panel that takes part in the reveal\n// ------------------------------------------\nexport interface SupportHeroCardProps extends GlassPanelProps {\n  children: React.ReactNode;\n}\n\nfunction Card({ className, children, ...props }: SupportHeroCardProps) {\n  return (\n    <GlassPanel\n      data-hero-card=\"\"\n      shape=\"tile\"\n      interactive\n      className={cn(\"group relative min-h-[12rem] overflow-hidden md:col-span-3 lg:col-span-3 lg:h-52\", className)}\n      {...props}\n    >\n      {children}\n    </GlassPanel>\n  );\n}\n\n// ------------------------------------------\n// Integrations — app marks on tiles, a title and a line\n// ------------------------------------------\nexport interface SupportHeroIntegrationsProps extends Omit<SupportHeroCardProps, \"children\"> {\n  icons: React.ReactNode[];\n  title: string;\n  text?: string;\n}\n\nfunction Integrations({ icons, title, text, className, ...props }: SupportHeroIntegrationsProps) {\n  return (\n    <Card className={cn(\"flex flex-col justify-between p-6\", className)} {...props}>\n      <div className=\"flex gap-3\">\n        {icons.map((icon, i) => (\n          <span\n            key={i}\n            // Each tile rises a touch on hover, one after the other.\n            style={{ transitionDelay: `${i * 60}ms` }}\n            className=\"grid h-11 w-11 place-items-center rounded-xl border border-foreground/[0.06] bg-card shadow-[0_6px_16px_-8px_rgba(15,23,42,0.35)] transition-transform duration-300 ease-out group-hover:-translate-y-1 [&>svg]:h-5 [&>svg]:w-5\"\n          >\n            {icon}\n          </span>\n        ))}\n      </div>\n      <div>\n        <p className=\"text-[1.35rem] font-semibold leading-none tracking-tight\">{title}</p>\n        {text && <p className=\"mt-2 max-w-[15rem] text-[11px] leading-snug text-foreground/55\">{text}</p>}\n      </div>\n    </Card>\n  );\n}\n\n// ------------------------------------------\n// Stat — one figure that counts up, and what it means\n// ------------------------------------------\nexport interface SupportHeroStatProps extends Omit<SupportHeroCardProps, \"children\"> {\n  value: number;\n  decimals?: number;\n  prefix?: string;\n  suffix?: string;\n  caption: string;\n  /** Frosted, or the accent card in the theme's primary colour. */\n  tone?: \"glass\" | \"accent\";\n  /** A picture behind the whole card. Only the bottom-left corner, where the figure sits, is washed with the card colour; the rest of the picture shows through — so pick one whose subject sits up and to the right. */\n  image?: string;\n  imageAlt?: string;\n  /** Where the picture is anchored as it crops. */\n  imagePosition?: string;\n}\n\nfunction Stat({\n  value,\n  decimals = 0,\n  prefix = \"\",\n  suffix = \"\",\n  caption,\n  tone = \"glass\",\n  image,\n  imageAlt = \"\",\n  imagePosition = \"center\",\n  className,\n  ...props\n}: SupportHeroStatProps) {\n  const accent = tone === \"accent\";\n  return (\n    <Card\n      className={cn(\n        \"flex flex-col justify-end p-6\",\n        accent &&\n          \"border-primary/40 bg-primary text-primary-foreground shadow-[inset_0_1px_0_rgba(255,255,255,0.25),0_24px_48px_-28px_var(--primary)] backdrop-blur-0\",\n        className,\n      )}\n      {...props}\n    >\n      {image && (\n        <>\n          <img\n            src={image}\n            alt={imageAlt}\n            style={{ objectPosition: imagePosition }}\n            className=\"absolute inset-0 h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-[1.05]\"\n          />\n          {/* Only the corner under the figure is washed; the picture stays clear elsewhere. */}\n          <span\n            aria-hidden\n            className={cn(\n              \"absolute inset-0 bg-gradient-to-tr from-32% via-50% to-72%\",\n              accent\n                ? \"from-primary via-primary/80 to-transparent\"\n                : \"from-background via-background/85 to-transparent\",\n            )}\n          />\n        </>\n      )}\n      <p className=\"relative z-10 text-[2.9rem] font-semibold leading-none tracking-[-0.03em]\">\n        <CounterBlock\n          type=\"animated\"\n          bare\n          startOnView\n          targetValue={value}\n          decimals={decimals}\n          prefix={prefix}\n          suffix={suffix}\n          color=\"zinc\"\n        />\n      </p>\n      <p className={cn(\"relative z-10 mt-3 max-w-[11rem] text-[11px] leading-snug\", accent ? \"text-primary-foreground/80\" : \"text-foreground/55\")}>\n        {caption}\n      </p>\n    </Card>\n  );\n}\n\n// ------------------------------------------\n// Photo — a portrait that fills its card\n// ------------------------------------------\nexport interface SupportHeroPhotoProps extends Omit<SupportHeroCardProps, \"children\"> {\n  src: string;\n  alt: string;\n  /** Small word in the top-left corner, e.g. \"Transcript\". */\n  label?: string;\n  /** Where the picture is anchored as it crops. */\n  position?: string;\n}\n\nfunction Photo({ src, alt, label, position = \"center\", className, ...props }: SupportHeroPhotoProps) {\n  return (\n    <Card className={cn(\"p-0\", className)} {...props}>\n      <img\n        src={src}\n        alt={alt}\n        style={{ objectPosition: position }}\n        className=\"absolute inset-0 h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-[1.04]\"\n      />\n      {label && (\n        <span className=\"absolute left-5 top-4 text-[1.35rem] font-medium tracking-tight text-white/90 [text-shadow:0_1px_12px_rgba(0,0,0,0.25)]\">\n          {label}\n        </span>\n      )}\n    </Card>\n  );\n}\n\n// ------------------------------------------\n// Team — a title with faces scattered beside it\n// ------------------------------------------\nexport interface SupportHeroTeamProps extends Omit<SupportHeroCardProps, \"children\" | \"title\"> {\n  title: React.ReactNode;\n  avatars: { src: string; alt?: string }[];\n}\n\n// Where the faces sit, as percentages of the card's right half, and how far\n// each drifts on hover. Keeping them in the right half leaves the title alone\n// at every width.\nconst SPOTS = [\n  { left: \"6%\", top: \"20%\", size: 44, dx: -6, dy: -8 },\n  { left: \"62%\", top: \"10%\", size: 40, dx: 8, dy: -6 },\n  { left: \"26%\", top: \"60%\", size: 40, dx: -4, dy: 8 },\n  { left: \"72%\", top: \"54%\", size: 44, dx: 8, dy: 6 },\n  { left: \"0%\", top: \"72%\", size: 32, dx: -8, dy: 4 },\n  { left: \"46%\", top: \"38%\", size: 30, dx: 4, dy: -2 },\n];\n\nfunction Team({ title, avatars, className, ...props }: SupportHeroTeamProps) {\n  return (\n    <Card className={cn(\"flex items-center p-6 md:col-span-6 lg:col-span-6\", className)} {...props}>\n      {/* A field of dots that fades in from the right, for the faces to sit over. */}\n      <span\n        aria-hidden\n        className=\"pointer-events-none absolute inset-0 bg-[radial-gradient(circle,color-mix(in_oklab,var(--foreground)_16%,transparent)_1px,transparent_1.2px)] bg-[size:14px_14px] [mask-image:radial-gradient(60%_90%_at_75%_50%,black,transparent)]\"\n      />\n      <h3 className=\"relative z-10 max-w-[11rem] font-sans text-[1.35rem] font-medium leading-[1.15] tracking-tight\">{title}</h3>\n      <div className=\"absolute inset-y-0 right-0 w-[52%]\">\n        {avatars.slice(0, SPOTS.length).map((a, i) => {\n          const s = SPOTS[i]!;\n          return (\n            <img\n              key={a.src}\n              src={a.src}\n              alt={a.alt ?? \"\"}\n              data-hero-avatar=\"\"\n              style={\n                {\n                  left: s.left,\n                  top: s.top,\n                  width: s.size,\n                  height: s.size,\n                  \"--dx\": `${s.dx}px`,\n                  \"--dy\": `${s.dy}px`,\n                } as React.CSSProperties\n              }\n              className=\"absolute rounded-full border-2 border-background object-cover shadow-[0_8px_20px_-8px_rgba(15,23,42,0.5)] transition-transform duration-500 ease-out group-hover:[transform:translate(var(--dx),var(--dy))]\"\n            />\n          );\n        })}\n      </div>\n    </Card>\n  );\n}\n\n// ------------------------------------------\n// The reveal, as keyframes: GSAP's power3.out and back.out(1.8) as CSS\n// easings, each keyframe only the start pose. Cards move on `transform`, which\n// leaves the panel's hover lift (`translate`) alone; faces grow on `scale`,\n// which leaves their hover drift (`transform`) alone.\n// ------------------------------------------\nconst EASE_OUT =\n  \"linear(0, .1945, .3591, .4971, .6115, .7052, .7808, .8409, .8877, .9233, .9497, .9686, .9816, .9901, .9952, .998, .9994, .9999, 1, 1)\";\nconst EASE_POP =\n  \"linear(0, .2239, .4168, .581, .7184, .8313, .9216, .9916, 1.0432, 1.0787, 1.1, 1.1094, 1.1088, 1.1004, 1.0864, 1.0688, 1.0496, 1.0311, 1.0152, 1.0042, 1)\";\n\nconst REVEAL_CSS = `\n@keyframes support-hero-lead-in { from { opacity: 0; transform: translateY(12px); } }\n@keyframes support-hero-card-in { from { opacity: 0; transform: translateY(28px) scale(0.97); } }\n@keyframes support-hero-face-in { from { opacity: 0; scale: 0.6; } }\n[data-hero-reveal] [data-hero-lead] { animation: support-hero-lead-in 0.6s ${EASE_OUT} var(--hero-at, 0s) backwards; }\n[data-hero-reveal] [data-hero-card] { animation: support-hero-card-in 0.8s ${EASE_OUT} var(--hero-at, 0s) backwards; }\n[data-hero-reveal] [data-hero-avatar] { animation: support-hero-face-in 0.5s ${EASE_POP} var(--hero-at, 0s) backwards; }\n`;\n\n// ------------------------------------------\n// Root\n// ------------------------------------------\nexport interface SupportHeroProps extends React.HTMLAttributes<HTMLDivElement> {\n  heading: string;\n  subtitle?: React.ReactNode;\n  cta?: { label: string; href?: string; onClick?: () => void };\n  /** The three colours washed behind the glass. By default a soft wash of the theme's primary over its muted surface, so the ground follows the theme. */\n  aurora?: [string, string, string];\n  /** Play the reveal when the section enters the viewport (default) or immediately. */\n  reveal?: \"in-view\" | \"immediate\";\n  accent?: string;\n  color?: string;\n  children: React.ReactNode;\n}\n\nexport function SupportHero({\n  heading,\n  subtitle,\n  cta,\n  aurora = [\n    \"color-mix(in oklab, var(--primary) 22%, var(--muted))\",\n    \"var(--muted)\",\n    \"color-mix(in oklab, var(--primary) 14%, var(--muted))\",\n  ],\n  reveal = \"in-view\",\n  accent,\n  color,\n  className,\n  style,\n  children,\n  ...props\n}: SupportHeroProps) {\n  const rootRef = useRef<HTMLDivElement>(null);\n  const [inView, setInView] = useState(reveal === \"immediate\");\n\n  useEffect(() => {\n    if (inView) return;\n    const el = rootRef.current;\n    if (!el || typeof IntersectionObserver === \"undefined\") {\n      setInView(true);\n      return;\n    }\n    const io = new IntersectionObserver(\n      (entries) => {\n        if (entries.some((e) => e.isIntersecting)) {\n          setInView(true);\n          io.disconnect();\n        }\n      },\n      { threshold: 0.2 },\n    );\n    io.observe(el);\n    return () => io.disconnect();\n  }, [inView]);\n\n  // After the headline has risen: the line and the button, then the cards\n  // one after another, then the faces. Everything renders opaque on the\n  // server; this only plays once the page is live.\n  useEffect(() => {\n    if (!inView) return;\n    const root = rootRef.current;\n    if (!root) return;\n    const reduced =\n      typeof window !== \"undefined\" && window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;\n    if (reduced) return;\n    // Each element gets its start time as `--hero-at`; the keyframes in\n    // REVEAL_CSS hold its start pose until then.\n    const stagger = (selector: string, start: number, each: number) =>\n      root\n        .querySelectorAll<HTMLElement>(selector)\n        .forEach((el, i) => el.style.setProperty(\"--hero-at\", `${start + i * each}s`));\n    stagger(\"[data-hero-lead]\", 0.5, 0.12);\n    stagger(\"[data-hero-card]\", 0.7, 0.09);\n    stagger(\"[data-hero-avatar]\", 1.4, 0.07);\n    // Written here rather than rendered, so it lands together with the start\n    // times above and React never has to re-render to start the reveal.\n    root.setAttribute(\"data-hero-reveal\", \"\");\n  }, [inView]);\n\n  const onCta = () => {\n    cta?.onClick?.();\n    if (cta?.href && typeof window !== \"undefined\") window.location.assign(cta.href);\n  };\n\n  return (\n    <div\n      ref={rootRef}\n      className={cn(\"w-full\", className)}\n      style={{ ...accentTokens(accent || color), ...style }}\n      {...props}\n    >\n      <style>{REVEAL_CSS}</style>\n      <GlassBackdrop\n        aurora={aurora}\n        className=\"bg-background text-foreground dark:bg-background dark:text-foreground\"\n        gridClassName=\"mx-auto max-w-6xl gap-4 px-5 pb-10 pt-0 sm:px-8 sm:pb-12\"\n      >\n      <header className=\"col-span-full flex flex-col items-center px-2 pb-8 pt-14 text-center sm:pb-10 sm:pt-16\">\n        <TextAnimation\n          as=\"h1\"\n          variant=\"blur-in-up\"\n          text={heading}\n          className=\"mx-auto max-w-[22ch] justify-center font-sans text-[clamp(1.75rem,7.5vw,2.3rem)] font-semibold leading-[1.06] tracking-[-0.035em] sm:max-w-[26ch] sm:text-[3.4rem]\"\n        />\n        {subtitle && (\n          <p data-hero-lead=\"\" className=\"mx-auto mt-5 max-w-[34rem] text-[12.5px] leading-[1.7] text-foreground/55\">\n            {subtitle}\n          </p>\n        )}\n        {cta && (\n          <div data-hero-lead=\"\" className=\"mt-7\">\n            <Button\n              variant=\"default\"\n              iconRight={<ChevronRight size={14} strokeWidth={2.5} />}\n              className=\"h-11 rounded-full px-6 text-[13px] shadow-[0_16px_32px_-14px_color-mix(in_oklab,var(--primary)_70%,transparent)]\"\n              onClick={onCta}\n            >\n              {cta.label}\n            </Button>\n          </div>\n        )}\n      </header>\n\n        {children}\n      </GlassBackdrop>\n    </div>\n  );\n}\n\nSupportHero.Card = Card;\nSupportHero.Integrations = Integrations;\nSupportHero.Stat = Stat;\nSupportHero.Photo = Photo;\nSupportHero.Team = Team;\n\nexport default SupportHero;\n",
      "type": "registry:component",
      "target": "components/custom/blocks/SupportHeroBlock.tsx"
    },
    {
      "path": "src/lib/accent.ts",
      "content": "import type { CSSProperties } from \"react\";\n\n/**\n * Bridging the docs colour picker into a preview.\n *\n * Most blocks are already written against the `--primary` token (`bg-primary`,\n * `ring-primary/30`, `text-primary-foreground`…). Rather than teaching each one a\n * bespoke `color` prop, a demo can repoint that token for its own subtree and\n * every one of those classes follows along.\n */\n\n/** The swatches the picker offers, as concrete CSS colours. */\nconst PRESET_HEX: Record<string, string> = {\n  lavender: \"#9b8afb\",\n  indigo: \"#6366f1\",\n  rose: \"#f43f5e\",\n  emerald: \"#10b981\",\n  zinc: \"#18181b\",\n};\n\n/** True when the picker sits on \"Default\" — the page theme should win. */\nexport function isDefaultAccent(color?: string): boolean {\n  return !color || color === \"primary\" || color === \"default\";\n}\n\n/**\n * Turns a picker value into a CSS colour, or null for \"Default\" — meaning\n * nothing should be overridden, so the theme (and the sidebar customizer)\n * keeps control.\n */\nexport function resolveAccent(color?: string): string | null {\n  if (isDefaultAccent(color)) return null;\n  return PRESET_HEX[color as string] ?? (color as string);\n}\n\n/**\n * The picker value in a form every block accepts. Blocks know the older swatch\n * names but not \"lavender\" — and since that is also a CSS named colour\n * (#e6e6fa), a block that passes unknown names straight through would paint\n * the wrong shade, while others fall back to a different palette. Demos that\n * hand the picker value to such a block run it through this first. Every\n * other value is returned untouched.\n */\nexport function toBlockColor(color: string): string;\nexport function toBlockColor(color: string | undefined): string | undefined;\nexport function toBlockColor(color?: string): string | undefined {\n  return color === \"lavender\" ? PRESET_HEX.lavender : color;\n}\n\nfunction parseHex(input: string): [number, number, number] | null {\n  const hex = input.trim().replace(/^#/, \"\");\n  if (/^[a-f\\d]{3}$/i.test(hex)) {\n    const [r, g, b] = hex.split(\"\");\n    return [parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16)];\n  }\n  if (/^[a-f\\d]{6}$/i.test(hex)) {\n    return [\n      parseInt(hex.slice(0, 2), 16),\n      parseInt(hex.slice(2, 4), 16),\n      parseInt(hex.slice(4, 6), 16),\n    ];\n  }\n  return null;\n}\n\n/** Legible foreground for content sitting on a filled `color` swatch. */\nexport function accentForeground(color: string): string {\n  const rgb = parseHex(color);\n  if (!rgb) return \"#ffffff\";\n  const channel = (v: number) => {\n    const c = v / 255;\n    return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n  };\n  const luminance =\n    0.2126 * channel(rgb[0]) +\n    0.7152 * channel(rgb[1]) +\n    0.0722 * channel(rgb[2]);\n  return luminance > 0.45 ? \"#09090b\" : \"#ffffff\";\n}\n\n/** The theme tokens a picked accent repoints, as `--name` → value. */\nexport function accentTokens(color?: string): Record<string, string> {\n  const resolved = resolveAccent(color);\n  if (!resolved) return {};\n  return {\n    \"--primary\": resolved,\n    \"--primary-foreground\": accentForeground(resolved),\n    \"--ring\": resolved,\n  };\n}\n\n/**\n * Inline style repointing `--primary` at the picked accent for one subtree.\n * `--primary-foreground` is derived alongside it, otherwise a light pick leaves\n * `text-primary-foreground` content unreadable on its own fill. Returns `{}` on\n * \"Default\" so the page theme still wins.\n */\nexport function accentStyle(color?: string): CSSProperties {\n  return accentTokens(color) as CSSProperties;\n}\n",
      "type": "registry:component",
      "target": "lib/accent.ts"
    }
  ],
  "docs": "Named export: SupportHero, with parts Card, Integrations, Stat, Photo and Team. Composed from the glass-panel, text-animation, counter and button items, which install alongside it. Cards land in one staggered pass after the headline (`reveal` in-view or immediate); Stats count up when on screen; hover lifts cards, zooms portraits and drifts the faces. `cta` takes a label plus `onClick` or `href`.",
  "categories": [
    "marketing",
    "layout"
  ],
  "type": "registry:component"
}
