{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "aurora-ai-mic-selector",
  "title": "Aurora AI Mic Selector",
  "author": "jmagar <https://github.com/jmagar>",
  "description": "Aurora-native mic selector parity surface from AI Elements.",
  "dependencies": [
    "lucide-react@^0.487.0"
  ],
  "registryDependencies": [
    "@aurora/aurora-tokens",
    "@aurora/aurora-ai-elements",
    "@aurora/aurora-components",
    "@aurora/aurora-select"
  ],
  "files": [
    {
      "path": "registry/aurora/blocks/ai/elements/mic-selector.tsx",
      "content": "\"use client\"\n\n/**\n * Aurora MicSelector — microphone picker with a live input-level meter + mute.\n *\n * Visual layer lives in registry/aurora/styles/aurora-components.css\n * (`@layer aurora-components`, reading only `--aurora-*` tokens) so it renders\n * identically in dark + `.light`. Architecture stays shadcn/registry-grade: a Radix `Select`\n * for device choice, `forwardRef`, `displayName`, `React.memo`, full a11y on the\n * mute toggle (`aria-pressed` + `aria-label`), and the original prop/escape-hatch\n * API (`value`/`defaultValue`/`onValueChange`/`name`/`disabled`/`required`/\n * `triggerId`/`triggerLabel`).\n */\n\nimport * as React from \"react\"\nimport { Mic, MicOff } from \"lucide-react\"\nimport {\n  Select,\n  SelectContent,\n  SelectGroup,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from \"@/registry/aurora/ui/select\"\nimport { Button } from \"@/registry/aurora/ui/button\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface MicSelectorProps extends React.HTMLAttributes<HTMLDivElement> {\n  /** Available input devices, listed in the dropdown. */\n  devices: string[]\n  /** Controlled selected device. */\n  value?: string\n  /** Uncontrolled initial device (defaults to `devices[0]`). */\n  defaultValue?: string\n  onValueChange?: (value: string) => void\n  /** Form field name for the underlying select. */\n  name?: string\n  disabled?: boolean\n  required?: boolean\n  /** `id` wired onto the select trigger (label association). */\n  triggerId?: string\n  /** Accessible label for the select trigger. Defaults to \"Microphone\". */\n  triggerLabel?: string\n  /** Controlled mute state for the toggle. */\n  muted?: boolean\n  /** Uncontrolled initial mute state. */\n  defaultMuted?: boolean\n  onMutedChange?: (muted: boolean) => void\n}\n\n// Styles: registry/aurora/styles/aurora-components.css (@layer aurora-components).\n\n// Bar layout: varying widths (in flex units) with a peaking dot near center.\nconst BAR_WEIGHTS = [1, 1.2, 1.6, 1.4, 2, 1.5, 1.4, 1.8, \"peak\", 1.9, 1.5, 1.3, 1.7, 1.4, 2, 1.6, 1.3, 1.8, 1.4, 1.2]\n\n// ─── Component ──────────────────────────────────────────────────────────────\n\nconst MicSelector = (\n    { ref,\n      devices,\n      value,\n      defaultValue,\n      onValueChange,\n      name,\n      disabled,\n      required,\n      triggerId,\n      triggerLabel,\n      muted,\n      defaultMuted,\n      onMutedChange,\n      className,\n      ...props\n    }: MicSelectorProps & { ref?: React.Ref<HTMLDivElement> }\n  ) => {\n    const isMuteControlled = muted !== undefined\n    const [internalMuted, setInternalMuted] = React.useState(defaultMuted ?? false)\n    const isMuted = isMuteControlled ? muted : internalMuted\n\n    const toggleMute = React.useCallback(() => {\n      const next = !isMuted\n      if (!isMuteControlled) setInternalMuted(next)\n      onMutedChange?.(next)\n    }, [isMuted, isMuteControlled, onMutedChange])\n\n    return (\n      <div\n        ref={ref}\n        className={cn(\"aurora-mic\", isMuted && \"aurora-mic--muted\", className)}\n        {...props}\n      >\n        <div className=\"aurora-mic__head\">\n          <span className=\"aurora-mic__title\">\n            <Mic className=\"size-3.5\" aria-hidden />\n            Microphone\n          </span>\n          <Button\n            type=\"button\"\n            variant={isMuted ? \"destructive\" : \"neutral\"}\n            size=\"icon\"\n            className=\"aurora-mic__mute\"\n            aria-pressed={isMuted}\n            aria-label={isMuted ? \"Unmute microphone\" : \"Mute microphone\"}\n            disabled={disabled}\n            onClick={toggleMute}\n          >\n            {isMuted ? (\n              <MicOff className=\"size-4\" aria-hidden />\n            ) : (\n              <Mic className=\"size-4\" aria-hidden />\n            )}\n          </Button>\n        </div>\n\n        <div className=\"aurora-mic__meter\" aria-hidden>\n          {BAR_WEIGHTS.map((weight, i) =>\n            weight === \"peak\" ? (\n              <span key={i} className=\"aurora-mic__bar aurora-mic__bar--peak\" />\n            ) : (\n              <span\n                key={i}\n                className=\"aurora-mic__bar\"\n                style={{\n                  flexGrow: weight as number,\n                  animationDelay: `${(i % 6) * 90}ms`,\n                }}\n              />\n            )\n          )}\n        </div>\n\n        <Select\n          value={value}\n          defaultValue={defaultValue ?? devices[0]}\n          onValueChange={onValueChange}\n          name={name}\n          disabled={disabled}\n          required={required}\n        >\n          <SelectTrigger\n            id={triggerId}\n            aria-label={triggerLabel ?? \"Microphone\"}\n            className=\"h-11 rounded-[10px]\"\n          >\n            <SelectValue placeholder={devices[0]} />\n          </SelectTrigger>\n          <SelectContent>\n            <SelectGroup>\n              {devices.map((device) => (\n                <SelectItem key={device} value={device}>\n                  {device}\n                </SelectItem>\n              ))}\n            </SelectGroup>\n          </SelectContent>\n        </Select>\n      </div>\n    )\n  }\nMicSelector.displayName = \"MicSelector\"\n\nconst MemoMicSelector = React.memo(MicSelector)\nMemoMicSelector.displayName = \"MicSelector\"\n\nexport { MemoMicSelector as MicSelector }\nexport default MemoMicSelector\n",
      "type": "registry:component",
      "target": "@components/aurora/ai/mic-selector.tsx"
    }
  ],
  "meta": {
    "namespace": "@aurora",
    "style": "aurora",
    "family": "block",
    "requiresTokens": true,
    "sourcePath": "registry/aurora/blocks/ai/elements/mic-selector.tsx",
    "installTarget": "@components/aurora/ai/mic-selector.tsx",
    "taxonomy": "ai"
  },
  "docs": "Aurora block that installs Aurora AI Mic Selector.\n\nInstall `aurora-tokens`, `aurora-ai-elements`, `aurora-components`, and `aurora-select` first; the shadcn CLI resolves these automatically through the @aurora registry namespace.\n\nDefault install target: `@components/aurora/ai/mic-selector.tsx`.\n\nRegistry dependencies: `aurora-tokens`, `aurora-ai-elements`, `aurora-components`, `aurora-select`.",
  "categories": [
    "aurora",
    "block",
    "ai"
  ],
  "type": "registry:block"
}