{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "test-results-solid",
  "title": "Test Results (Solid)",
  "description": "A test run's pass, fail and skip counts over a filterable tree of suites, each failure open to its stack trace.",
  "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",
    "@kind-ui/stack-trace-solid",
    "@kind-ui/internal-tree-solid"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/solid/test-results.tsx",
      "content": "import { testResultsPrimitive } from \"@kind-ui/agent-ui/core\";\nimport type { ComponentProps } from \"@solidjs/web\";\nimport { createParts } from \"@ui-sdk/solid/primitive\";\nimport type { TreeItemData } from \"@ui-sdk/solid/tree\";\nimport { For, omit, Show } from \"solid-js\";\nimport {\n  KindTree,\n  KindTreeGroup,\n  KindTreeItem,\n  KindTreeItemIndicator,\n  KindTreeItemLabel,\n} from \"./internal/tree\";\nimport { StackTrace } from \"./stack-trace\";\n\nconst parts = createParts(testResultsPrimitive, {\n  root: \"div\",\n  trigger: \"button\",\n  icon: \"span\",\n  title: \"span\",\n  meta: \"span\",\n  content: \"div\",\n  filter: \"div\",\n  count: \"button\",\n  tree: \"div\",\n  item: \"span\",\n  \"item-status\": \"span\",\n  failure: \"div\",\n  empty: \"p\",\n});\n\n// Lucide \"chevron-right\", see THIRD_PARTY_NOTICES.md.\nconst Chevron = () => (\n  <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" aria-hidden=\"true\">\n    <path d=\"m9 18 6-6-6-6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n  </svg>\n);\n\nexport type TestResultsProps = ComponentProps<typeof parts.Root>;\n\n/**\n * A test run as a step: its duration in the header, its counts beside it, which filter the tests when pressed, over a\n * tree of suites and tests in which a failed test opens to its message and stack trace. Any `children` replace the\n * default parts.\n */\nexport function TestResults(props: TestResultsProps) {\n  return <parts.Root {...omit(props, \"children\")}>{props.children ?? <DefaultParts />}</parts.Root>;\n}\n\nexport const TestResultsTrigger = parts.Trigger;\nexport const TestResultsIcon = parts.Icon;\nexport const TestResultsContent = parts.Content;\n\nexport type TestResultsTitleProps = ComponentProps<typeof parts.Title>;\n\n/** The `label`, else \"Tests\", unless you pass children. */\nexport function TestResultsTitle(props: TestResultsTitleProps) {\n  return <parts.Title {...omit(props, \"children\")}>{props.children ?? ((state) => state.title)}</parts.Title>;\n}\n\nexport type TestResultsMetaProps = ComponentProps<typeof parts.Meta>;\n\n/** The run's duration, unless you pass children. */\nexport function TestResultsMeta(props: TestResultsMetaProps) {\n  return (\n    <parts.Meta {...omit(props, \"children\")}>{props.children ?? ((state) => state.duration)}</parts.Meta>\n  );\n}\n\nexport type TestResultsFilterProps = ComponentProps<typeof parts.Filter>;\n\n/** Holds the counts beside the trigger: a `TestResultsCount` for passed, failed and skipped, unless you pass children. */\nexport function TestResultsFilter(props: TestResultsFilterProps) {\n  return (\n    <parts.Filter {...omit(props, \"children\")}>\n      {props.children ?? (\n        <>\n          <TestResultsCount value=\"pass\" />\n          <TestResultsCount value=\"fail\" />\n          <TestResultsCount value=\"skip\" />\n        </>\n      )}\n    </parts.Filter>\n  );\n}\n\nexport type TestResultsCountProps = ComponentProps<typeof parts.Count>;\n\n/**\n * A toggle button for the tests with its `value` (`\"pass\"`, `\"fail\"` or `\"skip\"`): pressing it shows only those, and\n * pressing it again shows every test. \"3 passed\", unless you pass children.\n */\nexport function TestResultsCount(props: TestResultsCountProps) {\n  return <parts.Count {...omit(props, \"children\")}>{props.children ?? ((state) => state.text)}</parts.Count>;\n}\n\nexport type TestResultsTreeProps = ComponentProps<typeof parts.Tree>;\n\n/** The suites and tests as a UI SDK Tree, with a row for each, unless you pass children. */\nexport function TestResultsTree(props: TestResultsTreeProps) {\n  return (\n    <parts.Tree {...omit(props, \"children\")}>\n      {props.children ??\n        ((tree) => (\n          <KindTree\n            controller={tree.controller}\n            items={tree.items}\n            defaultExpanded={tree.defaultExpanded}\n            aria-label={tree[\"aria-label\"]}\n            mode={tree.mode}\n            hiddenUntilFound={tree.hiddenUntilFound}\n          >\n            <TestResultsRows items={tree.items} />\n          </KindTree>\n        ))}\n    </parts.Tree>\n  );\n}\n\n// Every row has an indicator, a passed or skipped test's an empty spacer that lines its name up with the others. It's\n// hidden from agents, which hides UI SDK's Tree from them while the rows stay the Test Results'.\nexport type TestResultsRowsProps = { items: TreeItemData[] };\n\n/**\n * A Tree row for each item: a suite holds its tests, and a failed test its `TestResultsFailure`. Rows are keyed by\n * value over the items core keeps while the host keeps its suite, so a streamed test updates only its suite's rows.\n */\nexport function TestResultsRows(props: TestResultsRowsProps) {\n  return (\n    <For each={props.items} keyed={(item) => item.value}>\n      {(item) => (\n        <KindTreeItem value={item().value}>\n          <KindTreeItemLabel>\n            <KindTreeItemIndicator data-agent-hidden=\"\">\n              <Show when={item().children}>\n                <Chevron />\n              </Show>\n            </KindTreeItemIndicator>\n            <TestResultsItem value={item().value} />\n          </KindTreeItemLabel>\n          <Show when={item().children}>\n            {(children) => (\n              <KindTreeGroup>\n                <Show when={children().length > 0} fallback={<TestResultsFailure value={item().value} />}>\n                  <TestResultsRows items={children()} />\n                </Show>\n              </KindTreeGroup>\n            )}\n          </Show>\n        </KindTreeItem>\n      )}\n    </For>\n  );\n}\n\nexport type TestResultsItemProps = ComponentProps<typeof parts.Item>;\n\n/**\n * A row's name and its status mark, unless you pass children. Its `value` is the suite's id or the test's\n * `suiteId/testId`. The duration is drawn after them.\n */\nexport function TestResultsItem(props: TestResultsItemProps) {\n  return (\n    <parts.Item {...omit(props, \"children\")}>\n      {props.children ??\n        ((row) => (\n          <>\n            <span data-test-results-name=\"\">{row.name}</span> <TestResultsItemStatus />\n          </>\n        ))}\n    </parts.Item>\n  );\n}\n\nexport type TestResultsItemStatusProps = ComponentProps<typeof parts.ItemStatus>;\n\n/** A row's status mark, read as its status and duration, like \"failed, 12 ms\". */\nexport function TestResultsItemStatus(props: TestResultsItemStatusProps) {\n  return <parts.ItemStatus {...props} />;\n}\n\nexport type TestResultsFailureProps = ComponentProps<typeof parts.Failure>;\n\n/** A failed test's message and stack trace, as a Stack Trace, unless you pass children. Its `value` is the test's. */\nexport function TestResultsFailure(props: TestResultsFailureProps) {\n  return (\n    <parts.Failure {...omit(props, \"children\")}>\n      {props.children ??\n        ((state) => (\n          <StackTrace\n            message={state.message || undefined}\n            stack={state.stack}\n            autoOpen=\"never\"\n            motion={state.motion}\n          />\n        ))}\n    </parts.Failure>\n  );\n}\n\nexport type TestResultsEmptyProps = ComponentProps<typeof parts.Empty>;\n\n/** What shows when the filter lets no test through, like \"No failed tests\", unless you pass children. */\nexport function TestResultsEmpty(props: TestResultsEmptyProps) {\n  return <parts.Empty {...omit(props, \"children\")}>{props.children ?? ((state) => state.text)}</parts.Empty>;\n}\n\nfunction DefaultParts() {\n  return (\n    <>\n      <TestResultsTrigger>\n        <TestResultsIcon />\n        <TestResultsTitle />\n        <TestResultsMeta />\n      </TestResultsTrigger>\n      <TestResultsFilter />\n      <TestResultsContent>\n        <div data-test-results-panel=\"\">\n          <TestResultsTree />\n          <TestResultsEmpty />\n        </div>\n      </TestResultsContent>\n    </>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@ui/solid/test-results.tsx"
    }
  ],
  "meta": {
    "layer": "solid"
  },
  "type": "registry:ui"
}
