{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sources-solid",
  "title": "Sources (Solid)",
  "description": "The sources a response used, as a compact count that opens a list of links.",
  "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/sources.tsx",
      "content": "import { sourcesPrimitive } from \"@kind-ui/agent-ui/core\";\nimport type { ComponentProps } from \"@solidjs/web\";\nimport { Avatar, AvatarFallback, AvatarImage } from \"@ui-sdk/solid/avatar\";\nimport { createParts } from \"@ui-sdk/solid/primitive\";\nimport { For, omit, Show } from \"solid-js\";\n\nconst parts = createParts(sourcesPrimitive, {\n  root: \"div\",\n  trigger: \"button\",\n  content: \"div\",\n  list: \"ul\",\n  item: \"li\",\n  link: \"a\",\n  icon: \"span\",\n  title: \"span\",\n  host: \"span\",\n  snippet: \"p\",\n});\n\nexport type SourcesProps = ComponentProps<typeof parts.Root>;\n\n/**\n * The sources a response used, as \"Used N sources\" that opens a list of links. Any `children` replace the default\n * trigger and content.\n */\nexport function Sources(props: SourcesProps) {\n  return <parts.Root {...omit(props, \"children\")}>{props.children ?? <DefaultParts />}</parts.Root>;\n}\n\nexport const SourcesContent = parts.Content;\nexport const SourcesLink = parts.Link;\n\nexport type SourcesTriggerProps = ComponentProps<typeof parts.Trigger>;\n\n/** Shows and hides the list. Reads the `label`, else \"Used N sources\", unless you pass children. */\nexport function SourcesTrigger(props: SourcesTriggerProps) {\n  return (\n    <parts.Trigger {...omit(props, \"children\")}>{props.children ?? ((state) => state.label)}</parts.Trigger>\n  );\n}\n\nexport type SourcesListProps = ComponentProps<typeof parts.List>;\n\n/** An item for each of the `sources`, unless you pass children. */\nexport function SourcesList(props: SourcesListProps) {\n  return (\n    <parts.List {...omit(props, \"children\")}>\n      {props.children ??\n        ((state) => (\n          <For each={state.sources} keyed={(source) => source.id}>\n            {(source) => <SourcesItem value={source().id} />}\n          </For>\n        ))}\n    </parts.List>\n  );\n}\n\nexport type SourcesItemProps = ComponentProps<typeof parts.Item>;\n\n/** The source whose `id` is `value`. Without children, it shows a link to it and its snippet. */\nexport function SourcesItem(props: SourcesItemProps) {\n  return <parts.Item {...omit(props, \"children\")}>{props.children ?? <DefaultItemParts />}</parts.Item>;\n}\n\nexport type SourcesIconProps = ComponentProps<typeof parts.Icon>;\n\n/** A UI SDK Avatar of the source's `favicon`, showing a link glyph until it loads or without one. */\nexport function SourcesIcon(props: SourcesIconProps) {\n  return (\n    <parts.Icon {...omit(props, \"children\")}>\n      {props.children ??\n        ((state) => (\n          <Avatar>\n            <Show when={state.favicon}>{(favicon) => <AvatarImage src={favicon()} alt=\"\" />}</Show>\n            <AvatarFallback />\n          </Avatar>\n        ))}\n    </parts.Icon>\n  );\n}\n\nexport type SourcesTitleProps = ComponentProps<typeof parts.Title>;\n\n/** The source's `title`, unless you pass children. */\nexport function SourcesTitle(props: SourcesTitleProps) {\n  return <parts.Title {...omit(props, \"children\")}>{props.children ?? ((state) => state.title)}</parts.Title>;\n}\n\nexport type SourcesHostProps = ComponentProps<typeof parts.Host>;\n\n/** The host name of the source's `url`, unless you pass children. Rendered only with a safe `url`. */\nexport function SourcesHost(props: SourcesHostProps) {\n  return <parts.Host {...omit(props, \"children\")}>{props.children ?? ((state) => state.host)}</parts.Host>;\n}\n\nexport type SourcesSnippetProps = ComponentProps<typeof parts.Snippet>;\n\n/** The source's `snippet`, unless you pass children. Rendered only with a `snippet`. */\nexport function SourcesSnippet(props: SourcesSnippetProps) {\n  return (\n    <parts.Snippet {...omit(props, \"children\")}>{props.children ?? ((state) => state.snippet)}</parts.Snippet>\n  );\n}\n\nfunction DefaultItemParts() {\n  return (\n    <>\n      <SourcesLink>\n        <SourcesIcon />\n        <SourcesTitle />\n        <SourcesHost />\n      </SourcesLink>\n      <SourcesSnippet />\n    </>\n  );\n}\n\nfunction DefaultParts() {\n  return (\n    <>\n      <SourcesTrigger />\n      <SourcesContent>\n        <SourcesList />\n      </SourcesContent>\n    </>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@ui/solid/sources.tsx"
    }
  ],
  "meta": {
    "layer": "solid"
  },
  "type": "registry:ui"
}
