{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dictation-solid",
  "title": "Dictation (Solid)",
  "description": "A mic button that turns speech into text through a source the host chooses, with a live waveform.",
  "dependencies": [
    "@kind-ui/agent-ui@0.9.0",
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/solid@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/solid/dictation.tsx",
      "content": "import {\n  type DictationStatusState,\n  type DictationWaveformState,\n  dictationButtonPrimitive,\n} from \"@kind-ui/agent-ui/core\";\nimport type { ComponentProps } from \"@solidjs/web\";\nimport { createParts } from \"@ui-sdk/solid/primitive\";\nimport { omit, Repeat } from \"solid-js\";\n\nconst parts = createParts(dictationButtonPrimitive, {\n  root: \"div\",\n  start: \"button\",\n  waveform: \"span\",\n  bar: \"span\",\n  status: \"span\",\n  \"status-icon\": \"span\",\n  stop: \"button\",\n  cancel: \"button\",\n});\n\nexport type DictationProps = ComponentProps<typeof parts.Root>;\nexport type DictationWaveformProps = ComponentProps<typeof parts.Waveform>;\nexport type DictationStatusProps = ComponentProps<typeof parts.Status>;\n\n/** The mic button, shown while idle or after an error. */\nexport const DictationStart = parts.Start;\n/** Stop: ends the dictation and sends its final text. */\nexport const DictationStop = parts.Stop;\n/** Cancel: ends the dictation and sends nothing. */\nexport const DictationCancel = parts.Cancel;\n/** One bar of the waveform, whose `value` is its index. */\nexport const DictationBar = parts.Bar;\n/** The mark beside the status: running while transcribing, an error after one. */\nexport const DictationStatusIcon = parts.StatusIcon;\n\n// Levels are live state written as CSS variables, so only a change of `bars` renders the bars again.\nconst bars = (state: DictationWaveformState) => (\n  <Repeat count={state.bars}>{(index) => <DictationBar value={String(index)} />}</Repeat>\n);\n\n/** The waveform, one `DictationBar` per level unless you pass children. Shown while listening. */\nexport function DictationWaveform(props: DictationWaveformProps) {\n  return <parts.Waveform {...omit(props, \"children\")}>{props.children ?? bars}</parts.Waveform>;\n}\n\nconst status = (state: DictationStatusState) => (\n  <>\n    <DictationStatusIcon />\n    <span data-dictation-text=\"\">{state.text}</span>\n  </>\n);\n\n/** \"Listening\" or the words heard so far, \"Transcribing\", or the error, with its mark unless you pass children. */\nexport function DictationStatus(props: DictationStatusProps) {\n  return <parts.Status {...omit(props, \"children\")}>{props.children ?? status}</parts.Status>;\n}\n\n/**\n * A mic button that turns speech into text through a host's `source`. While listening it shows a waveform, the words\n * heard so far, Cancel and Stop, in the same box. Any `children` replace those parts.\n */\nexport function Dictation(props: DictationProps) {\n  return (\n    <parts.Root {...omit(props, \"children\")}>\n      {props.children ?? (\n        <>\n          <DictationWaveform />\n          <DictationStatus />\n          <DictationStart />\n          <DictationCancel />\n          <DictationStop />\n        </>\n      )}\n    </parts.Root>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@ui/solid/dictation.tsx"
    }
  ],
  "meta": {
    "layer": "solid"
  },
  "type": "registry:ui"
}
