{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "social-follow-avatar",
  "type": "registry:component",
  "title": "Social Follow Avatar",
  "description": "A creator chip where the avatar itself is the follow button: the plus badge spins into a check, a ring draws around the photo, sparks fly out and the follower count rolls up. Clicking again unfollows.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "buttons",
    "follow",
    "avatar",
    "creator",
    "profile",
    "social",
    "ring"
  ],
  "docs": "https://hyperblur.dev/effects/social-follow-avatar",
  "files": [
    {
      "path": "registry/hyperblur/social-follow-avatar.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/social-follow-avatar.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface SocialFollowAvatarProps\n  extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n  name?: string;\n  handle?: string;\n  initials?: string;\n  colors?: [string, string];\n  count?: number;\n  countLabel?: string;\n  following?: boolean;\n  defaultFollowing?: boolean;\n  onFollowChange?: (following: boolean, count: number) => void;\n  accent?: string;\n  locale?: string;\n}\n\nconst css = `\n.hb-xc12 { --hb-xc12-a: #2f7bff; position: relative; display: inline-flex; align-items: center; gap: 14px; max-width: 100%; box-sizing: border-box; font-family: inherit; color: #ededed; }\n.hb-xc12 *, .hb-xc12 *::before, .hb-xc12 *::after { box-sizing: border-box; }\n.hb-xc12-av {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  flex: none;\n  width: 68px;\n  height: 68px;\n  margin: 0;\n  padding: 0;\n  border: 0;\n  border-radius: 50%;\n  font: inherit;\n  background: transparent;\n  cursor: pointer;\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-xc12-av:focus-visible { outline: 2px solid var(--hb-xc12-a); outline-offset: 3px; }\n.hb-xc12-face {\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  width: 56px;\n  height: 56px;\n  border-radius: 50%;\n  font-size: 18px;\n  font-weight: 700;\n  letter-spacing: 0.01em;\n  color: #ffffff;\n  background: linear-gradient(140deg, var(--hb-xc12-c1), var(--hb-xc12-c2));\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -8px 16px -8px rgba(0, 0, 0, 0.35), 0 8px 18px -8px rgba(0, 0, 0, 0.8);\n  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);\n}\n.hb-xc12-av:hover .hb-xc12-face { transform: scale(0.96); }\n.hb-xc12-av:active .hb-xc12-face { transform: scale(0.9); }\n.hb-xc12-ring { position: absolute; inset: 0; width: 68px; height: 68px; transform: rotate(-90deg); pointer-events: none; }\n.hb-xc12-ring circle { fill: none; stroke-width: 2.5; stroke-linecap: round; }\n.hb-xc12-ring circle:first-child { stroke: #262626; }\n.hb-xc12-ring circle + circle { stroke: var(--hb-xc12-a); stroke-dasharray: 207.35; stroke-dashoffset: 207.35; transition: stroke-dashoffset 0.8s cubic-bezier(0.65, 0, 0.25, 1); }\n.hb-xc12[data-on=\"true\"] .hb-xc12-ring circle + circle { stroke-dashoffset: 0; }\n.hb-xc12-badge {\n  position: absolute;\n  right: 2px;\n  bottom: 2px;\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  width: 24px;\n  height: 24px;\n  border-radius: 50%;\n  color: #ffffff;\n  background: var(--hb-xc12-a);\n  box-shadow: 0 0 0 3px #0e0e0e, 0 4px 10px -2px color-mix(in srgb, var(--hb-xc12-a) 70%, transparent);\n  transition: background 0.35s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;\n}\n.hb-xc12-av:hover .hb-xc12-badge { transform: scale(1.1); }\n.hb-xc12[data-on=\"true\"] .hb-xc12-badge { background: #ededed; color: #0a0a0a; transform: rotate(360deg); box-shadow: 0 0 0 3px #0e0e0e, 0 4px 10px -2px rgba(0, 0, 0, 0.6); }\n.hb-xc12-badge svg { position: absolute; width: 12px; height: 12px; transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }\n.hb-xc12-badge svg + svg { opacity: 0; transform: scale(0.4); }\n.hb-xc12[data-on=\"true\"] .hb-xc12-badge svg:first-child { opacity: 0; transform: scale(0.4); }\n.hb-xc12[data-on=\"true\"] .hb-xc12-badge svg + svg { opacity: 1; transform: none; }\n.hb-xc12-burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }\n.hb-xc12-burst span { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--hb-xc12-p); opacity: 0; animation: hb-xc12-fly 0.75s cubic-bezier(0.2, 0.8, 0.3, 1) forwards; animation-delay: 0.32s; }\n.hb-xc12-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n.hb-xc12-name { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-xc12-h { font-size: 12px; color: #8f8f8f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-xc12-cnt { display: inline-flex; align-items: baseline; gap: 5px; margin-top: 4px; font-size: 12px; color: #8f8f8f; white-space: nowrap; }\n.hb-xc12-num { font-weight: 650; color: #ededed; font-variant-numeric: tabular-nums; }\n.hb-xc12-st { font-size: 11px; font-weight: 600; color: var(--hb-xc12-a); opacity: 0; transform: translateX(-4px); transition: opacity 0.3s ease 0.4s, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.4s; }\n.hb-xc12[data-on=\"true\"] .hb-xc12-st { opacity: 1; transform: none; }\n.hb-xc12-roll { display: inline-flex; overflow: hidden; height: 1.2em; line-height: 1.2; vertical-align: bottom; }\n.hb-xc12-col { display: inline-flex; flex-direction: column; transition: transform 0.7s cubic-bezier(0.2, 0.9, 0.2, 1); transition-delay: var(--hb-xc12-dl, 0ms); }\n.hb-xc12-col span, .hb-xc12-sep { display: block; height: 1.2em; }\n.hb-xc12-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n@keyframes hb-xc12-fly {\n  0% { opacity: 1; transform: rotate(var(--hb-xc12-r)) translateY(-30px) scale(1); }\n  100% { opacity: 0; transform: rotate(var(--hb-xc12-r)) translateY(-48px) scale(0.2); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-xc12-face, .hb-xc12-ring circle + circle, .hb-xc12-badge, .hb-xc12-badge svg, .hb-xc12-st, .hb-xc12-col { transition: none; }\n  .hb-xc12-burst { display: none; }\n  .hb-xc12[data-on=\"true\"] .hb-xc12-badge { transform: none; }\n}\n`;\n\nfunction Roll({ value, locale }: { value: number; locale: string }) {\n  const chars = new Intl.NumberFormat(locale).format(value).split(\"\");\n  return (\n    <span className=\"hb-xc12-roll\" aria-hidden=\"true\">\n      {chars.map((ch, i) => {\n        const fromRight = chars.length - 1 - i;\n        const d = Number(ch);\n        if (Number.isNaN(d) || ch === \" \") {\n          return (\n            <span key={`s${fromRight}`} className=\"hb-xc12-sep\">\n              {ch}\n            </span>\n          );\n        }\n        return (\n          <span\n            key={`d${fromRight}`}\n            className=\"hb-xc12-col\"\n            style={{ transform: `translateY(${(-d * 1.2).toFixed(2)}em)`, \"--hb-xc12-dl\": `${(fromRight * 45 + 300).toFixed(0)}ms` } as React.CSSProperties}\n          >\n            {[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((k) => (\n              <span key={k}>{k}</span>\n            ))}\n          </span>\n        );\n      })}\n    </span>\n  );\n}\n\nconst SPARKS = [0, 1, 2, 3, 4, 5, 6, 7].map((i) => ({\n  r: `${(i * 45 + 22.5).toFixed(1)}deg`,\n  c: [\"#7fb3ff\", \"#ffd166\", \"#ff7aa8\", \"#6af0a0\"][i % 4],\n}));\n\nexport function SocialFollowAvatar({\n  name = \"Maya Okafor\",\n  handle = \"@mayamakes\",\n  initials = \"MO\",\n  colors = [\"#ff8a5b\", \"#d6336c\"],\n  count = 2480,\n  countLabel = \"followers\",\n  following: followingProp,\n  defaultFollowing = false,\n  onFollowChange,\n  accent = \"#2f7bff\",\n  locale = \"en-US\",\n  className = \"\",\n  style,\n  ...rest\n}: SocialFollowAvatarProps) {\n  const [inner, setInner] = React.useState(defaultFollowing);\n  const [burst, setBurst] = React.useState(0);\n  const on = followingProp ?? inner;\n  const startOn = followingProp ?? defaultFollowing;\n  const base = startOn ? count - 1 : count;\n  const value = base + (on ? 1 : 0);\n  const fmt = new Intl.NumberFormat(locale);\n\n  function toggle() {\n    const next = !on;\n    if (followingProp === undefined) setInner(next);\n    if (next) setBurst((b) => b + 1);\n    onFollowChange?.(next, base + (next ? 1 : 0));\n  }\n\n  return (\n    <>\n      <style href=\"hb-social-follow-avatar\" precedence=\"default\">{css}</style>\n      <div\n        className={`hb-xc12 ${className}`}\n        style={{ \"--hb-xc12-a\": accent, \"--hb-xc12-c1\": colors[0], \"--hb-xc12-c2\": colors[1], ...style } as React.CSSProperties}\n        data-on={on ? \"true\" : undefined}\n        {...rest}\n      >\n        <button type=\"button\" className=\"hb-xc12-av\" aria-pressed={on} aria-label={on ? `Unfollow ${name}` : `Follow ${name}`} onClick={toggle}>\n          <svg className=\"hb-xc12-ring\" viewBox=\"0 0 68 68\" aria-hidden=\"true\">\n            <circle cx=\"34\" cy=\"34\" r=\"33\" />\n            <circle cx=\"34\" cy=\"34\" r=\"33\" />\n          </svg>\n          <span className=\"hb-xc12-face\" aria-hidden=\"true\">\n            {initials}\n          </span>\n          {on && burst > 0 ? (\n            <span className=\"hb-xc12-burst\" key={burst} aria-hidden=\"true\">\n              {SPARKS.map((s, i) => (\n                <span key={i} style={{ \"--hb-xc12-r\": s.r, \"--hb-xc12-p\": s.c } as React.CSSProperties} />\n              ))}\n            </span>\n          ) : null}\n          <span className=\"hb-xc12-badge\" aria-hidden=\"true\">\n            <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2.4} strokeLinecap=\"round\">\n              <path d=\"M8 3.5v9M3.5 8h9\" />\n            </svg>\n            <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth={2.4} strokeLinecap=\"round\" strokeLinejoin=\"round\">\n              <path d=\"m3.5 8.5 3 3 6-6.5\" />\n            </svg>\n          </span>\n        </button>\n        <div className=\"hb-xc12-info\">\n          <span className=\"hb-xc12-name\">{name}</span>\n          <span className=\"hb-xc12-h\">{handle}</span>\n          <span className=\"hb-xc12-cnt\">\n            <span className=\"hb-xc12-num\">\n              <Roll value={value} locale={locale} />\n            </span>\n            {countLabel}\n            <span className=\"hb-xc12-st\">Following</span>\n            <span className=\"hb-xc12-sr\" aria-live=\"polite\">\n              {fmt.format(value)} {countLabel}\n            </span>\n          </span>\n        </div>\n      </div>\n    </>\n  );\n}\n"
    }
  ]
}