{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "transition-ripple-reveal",
  "type": "registry:component",
  "title": "Transition Ripple Reveal",
  "description": "Click anywhere and the other view spreads out as a circle from that exact point, chased by two thin rings. Built for theme switches and before and after toggles.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "transitions",
    "ripple",
    "click",
    "circle",
    "theme toggle",
    "transition"
  ],
  "docs": "https://hyperblur.dev/effects/transition-ripple-reveal",
  "files": [
    {
      "path": "registry/hyperblur/transition-ripple-reveal.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/transition-ripple-reveal.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface TransitionRippleRevealProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n  children?: React.ReactNode;\n  from?: React.ReactNode;\n  to?: React.ReactNode;\n  active?: boolean;\n  defaultActive?: boolean;\n  onActiveChange?: (active: boolean) => void;\n  autoPlay?: boolean;\n  interval?: number;\n  duration?: number;\n  interactive?: boolean;\n  label?: string;\n  accent?: string;\n}\n\nconst css = `\n.hb-vj6 {\n  position: relative;\n  display: grid;\n  grid-template: minmax(0, 1fr) / minmax(0, 1fr);\n  overflow: hidden;\n  isolation: isolate;\n  box-sizing: border-box;\n  font-family: inherit;\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-vj6 *, .hb-vj6 *::before, .hb-vj6 *::after { box-sizing: border-box; }\n.hb-vj6[data-interactive=\"true\"] { cursor: pointer; }\n.hb-vj6:focus-visible { outline: 2px solid var(--hb-vj6-acc); outline-offset: 2px; }\n.hb-vj6-l {\n  grid-area: 1 / 1;\n  display: grid;\n  min-width: 0;\n  min-height: 0;\n  z-index: 1;\n}\n.hb-vj6-l[data-on=\"true\"] { z-index: 2; }\n.hb-vj6[data-ran=\"true\"] .hb-vj6-l[data-on=\"true\"] {\n  animation: hb-vj6-grow var(--hb-vj6-d) cubic-bezier(0.65, 0, 0.2, 1) both;\n}\n@keyframes hb-vj6-grow {\n  0% { clip-path: circle(0% at var(--hb-vj6-x) var(--hb-vj6-y)); }\n  100% { clip-path: circle(150% at var(--hb-vj6-x) var(--hb-vj6-y)); }\n}\n.hb-vj6-ring {\n  position: absolute;\n  z-index: 3;\n  left: var(--hb-vj6-x);\n  top: var(--hb-vj6-y);\n  width: 0;\n  aspect-ratio: 1;\n  border-radius: 50%;\n  pointer-events: none;\n  transform: translate(-50%, -50%);\n  border: 1.5px solid var(--hb-vj6-acc);\n  box-shadow: 0 0 18px color-mix(in srgb, var(--hb-vj6-acc) 55%, transparent), inset 0 0 14px color-mix(in srgb, var(--hb-vj6-acc) 35%, transparent);\n  opacity: 0;\n  animation: hb-vj6-ring var(--hb-vj6-d) cubic-bezier(0.65, 0, 0.2, 1) both;\n}\n.hb-vj6-ring + .hb-vj6-ring {\n  border-width: 1px;\n  box-shadow: none;\n  animation-duration: calc(var(--hb-vj6-d) * 1.25);\n  animation-delay: calc(var(--hb-vj6-d) * 0.12);\n}\n.hb-vj6-dot {\n  position: absolute;\n  z-index: 3;\n  left: var(--hb-vj6-x);\n  top: var(--hb-vj6-y);\n  width: 10px;\n  height: 10px;\n  margin: -5px 0 0 -5px;\n  border-radius: 50%;\n  background: var(--hb-vj6-acc);\n  pointer-events: none;\n  animation: hb-vj6-dot calc(var(--hb-vj6-d) * 0.6) cubic-bezier(0.2, 0.8, 0.2, 1) both;\n}\n@keyframes hb-vj6-ring {\n  0% { width: 0; opacity: 0.95; }\n  70% { opacity: 0.55; }\n  100% { width: 300%; opacity: 0; }\n}\n@keyframes hb-vj6-dot {\n  0% { transform: scale(0.4); opacity: 1; }\n  100% { transform: scale(2.6); opacity: 0; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-vj6[data-ran=\"true\"] .hb-vj6-l[data-on=\"true\"] { animation: none; }\n  .hb-vj6-ring, .hb-vj6-dot { display: none; }\n}\n`;\n\nconst presets = [\n  { x: 78, y: 26 },\n  { x: 22, y: 74 },\n  { x: 64, y: 70 },\n  { x: 30, y: 30 },\n];\n\nfunction Scene({ tone, kicker, title }: { tone: string; kicker: string; title: string }) {\n  return (\n    <div style={{ display: \"grid\", alignContent: \"end\", gap: 4, padding: 20, minHeight: 180, background: tone, color: \"#ededed\" }}>\n      <span style={{ fontSize: 11, letterSpacing: \"0.14em\", textTransform: \"uppercase\", color: \"rgba(237,237,237,0.6)\" }}>{kicker}</span>\n      <strong style={{ fontSize: 20, fontWeight: 600, letterSpacing: \"-0.01em\" }}>{title}</strong>\n    </div>\n  );\n}\n\nexport function TransitionRippleReveal({\n  children,\n  from,\n  to,\n  active,\n  defaultActive = false,\n  onActiveChange,\n  autoPlay = false,\n  interval = 2400,\n  duration = 900,\n  interactive = true,\n  label = \"Switch view\",\n  accent = \"#2f7bff\",\n  className,\n  style,\n  onClick,\n  onKeyDown,\n  ...rest\n}: TransitionRippleRevealProps) {\n  const [inner, setInner] = React.useState(defaultActive);\n  const controlled = active !== undefined;\n  const value = controlled ? active : inner;\n  const [pt, setPt] = React.useState({ x: 50, y: 50 });\n  const [count, setCount] = React.useState(0);\n  const [prev, setPrev] = React.useState(value);\n  if (prev !== value) {\n    setPrev(value);\n    setCount((c) => c + 1);\n  }\n  const set = React.useCallback(\n    (next: boolean) => {\n      if (!controlled) setInner(next);\n      onActiveChange?.(next);\n    },\n    [controlled, onActiveChange],\n  );\n\n  React.useEffect(() => {\n    if (!autoPlay) return;\n    if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    const id = window.setTimeout(() => {\n      setPt(presets[count % presets.length]);\n      set(!value);\n    }, interval);\n    return () => window.clearTimeout(id);\n  }, [autoPlay, interval, value, set, count]);\n\n  const kids = React.Children.toArray(children);\n  const a = from ?? kids[0] ?? <Scene tone=\"linear-gradient(160deg, #f4f2ec, #dcd8ce)\" kicker=\"Appearance\" title=\"Light\" />;\n  const b = to ?? kids[1] ?? <Scene tone=\"linear-gradient(160deg, #15171c, #08090b)\" kicker=\"Appearance\" title=\"Dark\" />;\n\n  const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\n    onClick?.(e);\n    if (!interactive || e.defaultPrevented) return;\n    const r = e.currentTarget.getBoundingClientRect();\n    if (r.width > 0 && r.height > 0) {\n      setPt({ x: ((e.clientX - r.left) / r.width) * 100, y: ((e.clientY - r.top) / r.height) * 100 });\n    }\n    set(!value);\n  };\n\n  const handleKey = (e: React.KeyboardEvent<HTMLDivElement>) => {\n    onKeyDown?.(e);\n    if (!interactive || e.defaultPrevented || e.target !== e.currentTarget) return;\n    if (e.key === \"Enter\" || e.key === \" \") {\n      e.preventDefault();\n      setPt({ x: 50, y: 50 });\n      set(!value);\n    }\n  };\n\n  const vars = {\n    \"--hb-vj6-x\": `${pt.x.toFixed(2)}%`,\n    \"--hb-vj6-y\": `${pt.y.toFixed(2)}%`,\n    \"--hb-vj6-d\": `${duration}ms`,\n    \"--hb-vj6-acc\": accent,\n  } as React.CSSProperties;\n\n  return (\n    <div\n      className={[\"hb-vj6\", className].filter(Boolean).join(\" \")}\n      style={{ ...vars, ...style }}\n      data-active={value}\n      data-ran={count > 0}\n      data-interactive={interactive}\n      role={interactive ? \"button\" : undefined}\n      tabIndex={interactive ? 0 : undefined}\n      aria-pressed={interactive ? value : undefined}\n      aria-label={interactive ? label : undefined}\n      onClick={handleClick}\n      onKeyDown={handleKey}\n      {...rest}\n    >\n      <style href=\"hb-transition-ripple-reveal\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vj6-l\" data-on={!value} aria-hidden={value} inert={value}>{a}</div>\n      <div className=\"hb-vj6-l\" data-on={value} aria-hidden={!value} inert={!value}>{b}</div>\n      {count > 0 ? (\n        <React.Fragment key={count}>\n          <span className=\"hb-vj6-ring\" aria-hidden=\"true\" />\n          <span className=\"hb-vj6-ring\" aria-hidden=\"true\" />\n          <span className=\"hb-vj6-dot\" aria-hidden=\"true\" />\n        </React.Fragment>\n      ) : null}\n    </div>\n  );\n}\n"
    }
  ]
}