{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "voice-glow",
  "title": "Voice Glow",
  "description": "A round glow that swells with the microphone level, so the user sees the assistant is listening and how loudly it hears them.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "https://miseui.junsu4621.workers.dev/r/motion.json"
  ],
  "files": [
    {
      "path": "registry/miseui/ui/voice-glow.tsx",
      "content": "import type * as React from \"react\"\nimport { motion, useReducedMotion } from \"motion/react\"\nimport { SPRING_DEFAULT, clampUnit } from \"@/registry/miseui/lib/motion\"\nimport { cn } from \"@/registry/miseui/lib/utils\"\n\nconst DEFAULT_SIZE_PX = 120\nconst LABEL_LISTENING = \"Listening\"\nconst LABEL_OFF = \"Microphone off\"\n/** The solid core takes a third of the box; the halo needs the rest to breathe into. */\nconst CORE_SHARE = 0.34\n/** Off: small and dim. On: grows a third from a whisper to a shout; the halo does most of the moving. */\nconst CORE_OFF_SCALE = 0.72\nconst CORE_OFF_OPACITY = 0.45\nconst CORE_BASE_SCALE = 0.85\nconst CORE_SCALE_RANGE = 0.3\n/** The wide halo lags the voice slightly, so loud moments leave a trace instead of flickering. */\nconst HALO_LAG_SECONDS = 0.55\n/**\n * Two halo layers: a ring that hugs the core and follows the voice, and a wide haze behind it.\n * Both are the one accent colour; only scale and opacity change with the level.\n */\nconst HALOS = [\n  {\n    gradient: \"radial-gradient(circle, transparent 42%, var(--mise) 56%, transparent 72%)\",\n    blurPx: 10,\n    baseScale: 0.62,\n    scaleRange: 0.38,\n    baseOpacity: 0.35,\n    opacityRange: 0.5,\n    lag: false,\n  },\n  {\n    gradient: \"radial-gradient(circle, var(--mise) 0%, transparent 70%)\",\n    blurPx: 22,\n    baseScale: 0.7,\n    scaleRange: 0.3,\n    baseOpacity: 0.12,\n    opacityRange: 0.4,\n    lag: true,\n  },\n] as const\n\ninterface VoiceGlowProps extends React.ComponentProps<\"div\"> {\n  /** Current input level, 0..1. Values outside the range are clamped. */\n  level?: number\n  /** Whether the microphone is listening. When false only a small, dim core remains. */\n  active?: boolean\n  /** Box size in pixels; the glow is always a circle. */\n  size?: number\n  /** Overrides the accessible name (\"Listening\" / \"Microphone off\"). */\n  label?: string\n}\n\nfunction VoiceGlow({\n  level = 0,\n  active = false,\n  size = DEFAULT_SIZE_PX,\n  label,\n  className,\n  style,\n  ...props\n}: VoiceGlowProps) {\n  const reduceMotion = useReducedMotion() ?? false\n  const clampedLevel = clampUnit(level)\n  const drive = active ? clampedLevel : 0\n  const transitionFor = (lag: boolean) => {\n    if (reduceMotion) return { duration: 0 }\n    return lag ? { ...SPRING_DEFAULT, duration: HALO_LAG_SECONDS } : SPRING_DEFAULT\n  }\n\n  return (\n    <div\n      role=\"img\"\n      aria-label={label ?? (active ? LABEL_LISTENING : LABEL_OFF)}\n      data-slot=\"voice-glow\"\n      data-active={active ? \"true\" : \"false\"}\n      data-level={clampedLevel}\n      data-reduced={reduceMotion ? \"true\" : \"false\"}\n      className={cn(\"relative inline-grid shrink-0 place-items-center\", className)}\n      style={{ ...style, width: size, height: size }}\n      {...props}\n    >\n      {HALOS.map((halo, index) => (\n        <motion.span\n          key={index}\n          aria-hidden=\"true\"\n          data-testid=\"voice-glow-halo\"\n          className=\"pointer-events-none absolute inset-0 rounded-full [@media(prefers-reduced-transparency:reduce)]:blur-none\"\n          style={{ backgroundImage: halo.gradient, filter: `blur(${halo.blurPx}px)` }}\n          initial={false}\n          animate={{\n            scale: halo.baseScale + halo.scaleRange * drive,\n            opacity: active ? halo.baseOpacity + halo.opacityRange * drive : 0,\n          }}\n          transition={transitionFor(halo.lag)}\n        />\n      ))}\n      <motion.span\n        aria-hidden=\"true\"\n        data-testid=\"voice-glow-core\"\n        className=\"rounded-full bg-mise\"\n        style={{ width: size * CORE_SHARE, height: size * CORE_SHARE }}\n        initial={false}\n        animate={{\n          scale: active ? CORE_BASE_SCALE + CORE_SCALE_RANGE * drive : CORE_OFF_SCALE,\n          opacity: active ? 1 : CORE_OFF_OPACITY,\n        }}\n        transition={transitionFor(false)}\n      />\n    </div>\n  )\n}\n\nexport { VoiceGlow, type VoiceGlowProps }\n",
      "type": "registry:ui"
    }
  ],
  "categories": [
    "effects"
  ],
  "type": "registry:ui"
}