{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "like-heart-fill",
  "type": "registry:component",
  "title": "Like Heart Fill",
  "description": "A heart button that fills with a rolling liquid wave, pulses two rings and rolls its count to the new value.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "social",
    "like",
    "heart",
    "liquid",
    "wave",
    "counter",
    "favorite"
  ],
  "docs": "https://hyperblur.dev/effects/like-heart-fill",
  "files": [
    {
      "path": "registry/hyperblur/like-heart-fill.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/like-heart-fill.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface LikeHeartFillProps extends React.HTMLAttributes<HTMLSpanElement> {\n  count?: number;\n  liked?: boolean;\n  defaultLiked?: boolean;\n  onLikeChange?: (liked: boolean, count: number) => void;\n  color?: string;\n  size?: number;\n  label?: string;\n}\n\nconst css = `\n.hb-qb1 {\n  position: relative;\n  display: inline-flex;\n  vertical-align: middle;\n  box-sizing: border-box;\n  font-family: inherit;\n}\n.hb-qb1 *, .hb-qb1 *::before, .hb-qb1 *::after { box-sizing: border-box; }\n.hb-qb1-btn {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  gap: calc(var(--hb-qb1-s) * 0.3);\n  margin: 0;\n  padding: calc(var(--hb-qb1-s) * 0.28) calc(var(--hb-qb1-s) * 0.6) calc(var(--hb-qb1-s) * 0.28) calc(var(--hb-qb1-s) * 0.42);\n  border: 1px solid #262626;\n  border-radius: 999px;\n  background: #171717;\n  color: #8f8f8f;\n  font: inherit;\n  font-size: calc(var(--hb-qb1-s) * 0.58);\n  font-weight: 600;\n  line-height: 1;\n  cursor: pointer;\n  user-select: none;\n  touch-action: manipulation;\n  -webkit-tap-highlight-color: transparent;\n  transition: border-color 0.25s ease, color 0.25s ease, background-color 0.25s ease, transform 0.12s ease;\n}\n.hb-qb1-btn:hover { border-color: #3a3a3a; color: #ededed; }\n.hb-qb1-btn:active { transform: scale(0.95); }\n.hb-qb1-btn:focus-visible { outline: 2px solid var(--hb-qb1-c); outline-offset: 3px; }\n.hb-qb1-btn[aria-pressed=\"true\"] {\n  border-color: color-mix(in srgb, var(--hb-qb1-c) 45%, #262626);\n  background: color-mix(in srgb, var(--hb-qb1-c) 9%, #171717);\n  color: #ededed;\n}\n.hb-qb1-ico {\n  position: relative;\n  display: inline-flex;\n  width: var(--hb-qb1-s);\n  height: var(--hb-qb1-s);\n  flex: none;\n}\n.hb-qb1-heart {\n  display: block;\n  width: 100%;\n  height: 100%;\n  transform-origin: 50% 62%;\n}\n.hb-qb1-btn[aria-pressed=\"true\"] .hb-qb1-heart[data-fx=\"true\"] {\n  animation: hb-qb1-beat 0.9s cubic-bezier(0.3, 1.4, 0.5, 1);\n}\n@keyframes hb-qb1-beat {\n  0% { transform: scale(1); }\n  22% { transform: scale(0.82); }\n  50% { transform: scale(1.22); }\n  74% { transform: scale(0.96); }\n  100% { transform: scale(1); }\n}\n.hb-qb1-svg { display: block; width: 100%; height: 100%; overflow: visible; }\n.hb-qb1-base { fill: rgba(255, 255, 255, 0.035); stroke: none; }\n.hb-qb1-edge {\n  fill: none;\n  stroke: currentColor;\n  stroke-width: 1.7;\n  stroke-linejoin: round;\n  transition: stroke 0.4s ease;\n}\n.hb-qb1-btn[aria-pressed=\"true\"] .hb-qb1-edge { stroke: var(--hb-qb1-c); }\n.hb-qb1-liq {\n  transform: translateY(26px);\n  transition: transform 0.95s cubic-bezier(0.34, 1.25, 0.5, 1);\n}\n.hb-qb1-btn[aria-pressed=\"true\"] .hb-qb1-liq { transform: translateY(-1.6px); }\n.hb-qb1-w1 { animation: hb-qb1-slide 1.5s linear infinite; }\n.hb-qb1-w2 { animation: hb-qb1-slide 2.3s linear infinite reverse; }\n.hb-qb1-btn:not([aria-pressed=\"true\"]) .hb-qb1-w1,\n.hb-qb1-btn:not([aria-pressed=\"true\"]) .hb-qb1-w2 { animation-play-state: paused; }\n@keyframes hb-qb1-slide {\n  from { transform: translateX(0); }\n  to { transform: translateX(-24px); }\n}\n.hb-qb1-f1 { fill: var(--hb-qb1-c); }\n.hb-qb1-f2 { fill: color-mix(in srgb, var(--hb-qb1-c) 50%, #ffffff); opacity: 0.65; }\n.hb-qb1-ring {\n  position: absolute;\n  inset: 0;\n  border-radius: 50%;\n  border: 2px solid var(--hb-qb1-c);\n  opacity: 0;\n  pointer-events: none;\n  animation: hb-qb1-ring 0.8s ease-out 0.25s forwards;\n}\n.hb-qb1-ring[data-n=\"2\"] { animation-delay: 0.42s; }\n@keyframes hb-qb1-ring {\n  0% { opacity: 0.8; transform: scale(0.5); }\n  100% { opacity: 0; transform: scale(2.3); }\n}\n.hb-qb1-count {\n  display: inline-flex;\n  font-variant-numeric: tabular-nums;\n  white-space: pre;\n}\n.hb-qb1-roll {\n  display: inline-grid;\n  overflow: hidden;\n  line-height: 1.25;\n  margin: -0.125em 0;\n}\n.hb-qb1-roll > span { grid-area: 1 / 1; display: block; }\n.hb-qb1-in { animation: hb-qb1-up-in 0.38s cubic-bezier(0.3, 1.3, 0.5, 1) both; }\n.hb-qb1-out { animation: hb-qb1-up-out 0.3s ease-in both; }\n.hb-qb1-roll[data-up=\"false\"] .hb-qb1-in { animation-name: hb-qb1-down-in; }\n.hb-qb1-roll[data-up=\"false\"] .hb-qb1-out { animation-name: hb-qb1-down-out; }\n@keyframes hb-qb1-up-in {\n  from { transform: translateY(100%); opacity: 0; }\n  to { transform: translateY(0); opacity: 1; }\n}\n@keyframes hb-qb1-up-out {\n  from { transform: translateY(0); opacity: 1; }\n  to { transform: translateY(-100%); opacity: 0; }\n}\n@keyframes hb-qb1-down-in {\n  from { transform: translateY(-100%); opacity: 0; }\n  to { transform: translateY(0); opacity: 1; }\n}\n@keyframes hb-qb1-down-out {\n  from { transform: translateY(0); opacity: 1; }\n  to { transform: translateY(100%); opacity: 0; }\n}\n.hb-qb1-sr {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  clip-path: inset(50%);\n  white-space: nowrap;\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-qb1-btn, .hb-qb1-edge, .hb-qb1-liq { transition: none; }\n  .hb-qb1-w1, .hb-qb1-w2 { animation: none; }\n  .hb-qb1-btn[aria-pressed=\"true\"] .hb-qb1-heart[data-fx=\"true\"] { animation: none; }\n  .hb-qb1-ring { display: none; }\n  .hb-qb1-out { display: none; }\n  .hb-qb1-in { animation: none; }\n}\n`;\n\nconst heart =\n  \"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z\";\n\nconst waveFront = \"M0 3Q6 0.2 12 3T24 3T36 3T48 3V32H0Z\";\nconst waveBack = \"M0 3.4Q6 6.2 12 3.4T24 3.4T36 3.4T48 3.4V32H0Z\";\n\ninterface RollState {\n  value: number;\n  prev: number;\n  id: number;\n  live: boolean;\n}\n\nfunction Roll({ value }: { value: number }) {\n  const [view, setView] = React.useState<RollState>({ value, prev: value, id: 0, live: false });\n  if (view.value !== value) {\n    setView({ value, prev: view.value, id: view.id + 1, live: true });\n  }\n  const to = value.toLocaleString(\"en-US\");\n  if (!view.live) {\n    return (\n      <span className=\"hb-qb1-count\" aria-hidden=\"true\">\n        {to}\n      </span>\n    );\n  }\n  const from = view.prev.toLocaleString(\"en-US\");\n  let p = 0;\n  while (p < from.length && p < to.length && from[p] === to[p]) p++;\n  return (\n    <span className=\"hb-qb1-count\" aria-hidden=\"true\">\n      {to.slice(0, p)}\n      <span key={view.id} className=\"hb-qb1-roll\" data-up={value > view.prev ? \"true\" : \"false\"}>\n        <span className=\"hb-qb1-out\">{from.slice(p)}</span>\n        <span\n          className=\"hb-qb1-in\"\n          onAnimationEnd={() => setView((v) => (v.live ? { ...v, live: false } : v))}\n        >\n          {to.slice(p)}\n        </span>\n      </span>\n    </span>\n  );\n}\n\nexport function LikeHeartFill({\n  count = 0,\n  liked,\n  defaultLiked = false,\n  onLikeChange,\n  color = \"#ff4d6d\",\n  size = 28,\n  label = \"Like\",\n  className = \"\",\n  style,\n  ...rest\n}: LikeHeartFillProps) {\n  const uid = React.useId();\n  const controlled = liked !== undefined;\n  const [inner, setInner] = React.useState(defaultLiked);\n  const current = controlled ? liked : inner;\n  const [base] = React.useState(current);\n  const [seen, setSeen] = React.useState({ liked: current, pulse: 0 });\n\n  if (seen.liked !== current) {\n    setSeen({ liked: current, pulse: current ? seen.pulse + 1 : seen.pulse });\n  }\n\n  const offset = current === base ? 0 : current ? 1 : -1;\n  const total = Math.max(0, count + offset);\n\n  function toggle() {\n    const next = !current;\n    if (!controlled) setInner(next);\n    const nextOffset = next === base ? 0 : next ? 1 : -1;\n    onLikeChange?.(next, Math.max(0, count + nextOffset));\n  }\n\n  const vars = {\n    \"--hb-qb1-s\": `${size}px`,\n    \"--hb-qb1-c\": color,\n    ...style,\n  } as React.CSSProperties;\n\n  const clip = `hb-qb1-${uid.replace(/[^a-zA-Z0-9]/g, \"\")}`;\n\n  return (\n    <span className={`hb-qb1 ${className}`} style={vars} {...rest}>\n      <style href=\"hb-like-heart-fill\" precedence=\"default\">{css}</style>\n      <button type=\"button\" className=\"hb-qb1-btn\" aria-pressed={current} aria-label={label} onClick={toggle}>\n        <span className=\"hb-qb1-ico\" aria-hidden=\"true\">\n          <span className=\"hb-qb1-heart\" data-fx={seen.pulse > 0 ? \"true\" : \"false\"}>\n            <svg className=\"hb-qb1-svg\" viewBox=\"0 0 24 24\">\n              <defs>\n                <clipPath id={clip}>\n                  <path d={heart} />\n                </clipPath>\n              </defs>\n              <path className=\"hb-qb1-base\" d={heart} />\n              <g clipPath={`url(#${clip})`}>\n                <g className=\"hb-qb1-liq\">\n                  <g className=\"hb-qb1-w2\">\n                    <path className=\"hb-qb1-f2\" d={waveBack} />\n                  </g>\n                  <g className=\"hb-qb1-w1\">\n                    <path className=\"hb-qb1-f1\" d={waveFront} />\n                  </g>\n                </g>\n              </g>\n              <path className=\"hb-qb1-edge\" d={heart} />\n            </svg>\n          </span>\n          {seen.pulse > 0 && current && (\n            <>\n              <span key={`r${seen.pulse}`} className=\"hb-qb1-ring\" />\n              <span key={`q${seen.pulse}`} className=\"hb-qb1-ring\" data-n=\"2\" />\n            </>\n          )}\n        </span>\n        <Roll value={total} />\n      </button>\n      <span className=\"hb-qb1-sr\" role=\"status\" aria-live=\"polite\">\n        {`${total.toLocaleString(\"en-US\")} ${total === 1 ? \"like\" : \"likes\"}`}\n      </span>\n    </span>\n  );\n}\n"
    }
  ]
}