{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "voice-orb",
  "title": "Voice orb",
  "description": "Breathing voice-assistant orb that swells with a level prop through a spring: idle breathing, listening rings, speaking light that churns faster, and a spinning thinking arc, all in CSS on theme colors.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://goodui.dev/r/goodui-motion.json",
    "https://goodui.dev/r/locale.json"
  ],
  "files": [
    {
      "path": "registry/components/ai/voice-orb.tsx",
      "content": "\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport { motion, useReducedMotion, useSpring, useTransform } from \"motion/react\"\r\nimport { cn } from \"@/lib/utils\"\r\nimport { GooduiTokens } from \"@/lib/goodui-motion\"\r\nimport { useLabels } from \"@/lib/goodui-locale\"\r\n\r\n/*\r\n * A breathing voice orb for assistants: idle breathes slowly, listening sends rings outward and swells with\r\n * the microphone level, speaking churns its inner light with the output level, thinking spins a thin arc.\r\n * Pure CSS loops on gradients; the level is smoothed through a spring.\r\n */\r\n\r\nconst CSS = `\r\n.pc-orb{--pc-orb-c:var(--chart-1);--pc-orb-c2:var(--chart-4);position:relative;display:grid;place-items:center;isolation:isolate}\r\n.pc-orb-glow{position:absolute;inset:4%;border-radius:9999px;background:radial-gradient(circle,color-mix(in oklab,var(--pc-orb-c) 55%,transparent) 0%,transparent 70%);filter:blur(calc(var(--pc-orb-s) * .08));pointer-events:none}\r\n.pc-orb-breathe{position:absolute;inset:0;display:grid;place-items:center;animation:pc-orb-breathe 4.2s ease-in-out infinite}\r\n.pc-orb[data-state=speaking] .pc-orb-breathe,.pc-orb[data-state=listening] .pc-orb-breathe{animation:none}\r\n@keyframes pc-orb-breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.045)}}\r\n.pc-orb-core{position:relative;width:62%;height:62%;border-radius:9999px;overflow:hidden;background:radial-gradient(circle at 32% 28%,color-mix(in oklab,white 72%,var(--pc-orb-c)) 0%,var(--pc-orb-c) 42%,color-mix(in oklab,var(--pc-orb-c2) 75%,black) 100%);box-shadow:inset calc(var(--pc-orb-s) * -.04) calc(var(--pc-orb-s) * -.05) calc(var(--pc-orb-s) * .12) rgb(0 0 0/.28),inset calc(var(--pc-orb-s) * .02) calc(var(--pc-orb-s) * .03) calc(var(--pc-orb-s) * .08) rgb(255 255 255/.35),0 calc(var(--pc-orb-s) * .06) calc(var(--pc-orb-s) * .18) calc(var(--pc-orb-s) * -.06) color-mix(in oklab,var(--pc-orb-c) 70%,transparent)}\r\n.pc-orb-blob{position:absolute;inset:-25%;border-radius:42% 58% 55% 45%/55% 42% 58% 45%;background:conic-gradient(from 0deg,transparent 0%,color-mix(in oklab,var(--pc-orb-c2) 70%,white) 30%,transparent 60%);mix-blend-mode:soft-light;opacity:.9;animation:pc-orb-spin 11s linear infinite}\r\n.pc-orb-blob:nth-child(2){border-radius:58% 42% 45% 55%/42% 55% 45% 58%;background:conic-gradient(from 180deg,transparent 0%,color-mix(in oklab,white 60%,var(--pc-orb-c)) 25%,transparent 55%);animation-duration:15s;animation-direction:reverse}\r\n.pc-orb[data-state=speaking] .pc-orb-blob{animation-duration:2.6s}\r\n.pc-orb[data-state=speaking] .pc-orb-blob:nth-child(2){animation-duration:3.4s}\r\n.pc-orb[data-state=thinking] .pc-orb-blob{animation-duration:5s}\r\n@keyframes pc-orb-spin{to{transform:rotate(360deg)}}\r\n.pc-orb-ring{position:absolute;inset:14%;border-radius:9999px;pointer-events:none}\r\n.pc-orb-arc{background:conic-gradient(from 0deg,transparent 0%,var(--pc-orb-c) 20%,transparent 40%);-webkit-mask:radial-gradient(circle,transparent calc(50% - 3px),#000 calc(50% - 2px));mask:radial-gradient(circle,transparent calc(50% - 3px),#000 calc(50% - 2px));animation:pc-orb-spin 1.3s linear infinite}\r\n.pc-orb-wave{border:2px solid color-mix(in oklab,var(--pc-orb-c) 70%,transparent);animation:pc-orb-wave 1.9s ease-out infinite}\r\n.pc-orb-wave:nth-child(2){animation-delay:.65s}\r\n.pc-orb-wave:nth-child(3){animation-delay:1.3s}\r\n@keyframes pc-orb-wave{from{transform:scale(.86);opacity:.75}to{transform:scale(1.55);opacity:0}}\r\n@media (prefers-reduced-motion:reduce){\r\n  .pc-orb-breathe,.pc-orb-blob,.pc-orb-arc,.pc-orb-wave{animation:none}\r\n  .pc-orb-wave{transform:scale(1.12);opacity:.6}\r\n  .pc-orb-wave:nth-child(n+2){display:none}\r\n  .pc-orb-arc{-webkit-mask:none;mask:none;background:none;border:2px dashed color-mix(in oklab,var(--pc-orb-c) 70%,transparent)}\r\n}\r\n`\r\n\r\nexport type VoiceOrbState = \"idle\" | \"listening\" | \"speaking\" | \"thinking\"\r\n\r\nexport type VoiceOrbLabels = Record<VoiceOrbState, string>\r\nconst DEFAULT_LABELS: VoiceOrbLabels = { idle: \"Assistant idle\", listening: \"Listening\", speaking: \"Speaking\", thinking: \"Thinking\" }\r\n\r\nexport type VoiceOrbProps = Omit<React.ComponentProps<\"div\">, \"children\"> & {\r\n  state?: VoiceOrbState\r\n  /** Audio level 0..1 (microphone while listening, output while speaking). */\r\n  level?: number\r\n  /** Diameter in px, or a preset. */\r\n  size?: number | \"sm\" | \"md\" | \"lg\"\r\n  /** Main color (any CSS color); defaults to --chart-1. */\r\n  color?: string\r\n  /** Second color for the inner light; defaults to --chart-4. */\r\n  accent?: string\r\n  /** Text for screen readers per state; pass translations here. */\r\n  labels?: Partial<VoiceOrbLabels>\r\n}\r\n\r\nconst SIZES = { sm: 96, md: 160, lg: 240 }\r\n\r\n/** Breathing orb that reacts to an audio level, with idle, listening, speaking and thinking states. */\r\nexport function VoiceOrb({ state = \"idle\", level = 0, size = \"md\", color, accent, labels, className, style, ...props }: VoiceOrbProps) {\r\n  const l = useLabels(\"voice-orb\", DEFAULT_LABELS, labels)\r\n  const reduce = useReducedMotion() ?? false\r\n  const px = typeof size === \"number\" ? size : SIZES[size]\r\n  const clamped = Math.max(0, Math.min(1, level))\r\n  const spring = useSpring(0, { stiffness: 220, damping: 20, mass: 0.6 })\r\n  React.useEffect(() => {\r\n    if (reduce) spring.jump(clamped)\r\n    else spring.set(clamped)\r\n  }, [clamped, reduce, spring])\r\n  const reactive = state === \"listening\" || state === \"speaking\"\r\n  const scale = useTransform(spring, [0, 1], [1, reactive ? 1.22 : 1.06])\r\n  const glowScale = useTransform(spring, [0, 1], [1, 1.5])\r\n  const glowOpacity = useTransform(spring, [0, 1], [state === \"idle\" ? 0.55 : 0.75, 1])\r\n\r\n  return (\r\n    <div\r\n      data-state={state}\r\n      className={cn(\"pc-orb\", className)}\r\n      style={{ width: px, height: px, [\"--pc-orb-s\" as string]: `${px}px`, ...(color ? { [\"--pc-orb-c\" as string]: color } : {}), ...(accent ? { [\"--pc-orb-c2\" as string]: accent } : {}), ...style }}\r\n      {...props}\r\n    >\r\n      <GooduiTokens />\r\n      <style href=\"pc-voice-orb\" precedence=\"default\">\r\n        {CSS}\r\n      </style>\r\n      <div role=\"img\" aria-label={l[state]} className=\"absolute inset-0 grid place-items-center\">\r\n        <motion.span className=\"pc-orb-glow\" style={{ scale: glowScale, opacity: glowOpacity }} />\r\n        {state === \"listening\" && (\r\n          <>\r\n            <span className=\"pc-orb-ring pc-orb-wave\" />\r\n            <span className=\"pc-orb-ring pc-orb-wave\" />\r\n            <span className=\"pc-orb-ring pc-orb-wave\" />\r\n          </>\r\n        )}\r\n        {state === \"thinking\" && <span className=\"pc-orb-ring pc-orb-arc\" />}\r\n        <span className=\"pc-orb-breathe\">\r\n          <motion.span className=\"pc-orb-core\" style={{ scale }}>\r\n            <span className=\"pc-orb-blob\" />\r\n            <span className=\"pc-orb-blob\" />\r\n          </motion.span>\r\n        </span>\r\n      </div>\r\n      <span className=\"sr-only\" role=\"status\" aria-live=\"polite\">\r\n        {l[state]}\r\n      </span>\r\n    </div>\r\n  )\r\n}\r\n",
      "type": "registry:component",
      "target": "components/goodui/voice-orb.tsx"
    }
  ],
  "categories": [
    "components",
    "ai"
  ],
  "type": "registry:component"
}