{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tree",
  "title": "Tree",
  "description": "A hierarchy with connector lines and branches that open.",
  "dependencies": [
    "@ui-sdk/react@0.1.0-beta.5",
    "lucide-react@1.73.0"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/tree.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Tree as SdkTree, TreeGroup, TreeItem, TreeItemIndicator, TreeItemLabel, type TreeProps } from \"@ui-sdk/react/tree\"\nimport { ChevronRight } from \"lucide-react\"\nimport \"@/registry/cyber/ui/cyber/tree.css\"\n\ntype TreeNode = {\n  value: string\n  label: string\n  meta?: string\n  disabled?: boolean\n  children?: TreeNode[]\n}\n\nconst count = (nodes: TreeNode[]): number => nodes.reduce((total, node) => total + 1 + count(node.children ?? []), 0)\n\n// A hierarchy wired together: each branch drops a rail to its children, a\n// chevron turns as it opens, and a leaf carries a tick that fills when it's\n// the chosen one. One tab stop; the arrow keys walk it, and Right and Left\n// open and close branches.\n//\n// - `items`: each a `value` (unique in the tree) and a `label`, an optional\n//   `meta` printed at the end of its row (a size, a count), and `children`\n//   for a branch.\n// - Everything else goes to the SDK's Tree: `value`, `defaultValue`,\n//   `onValueChange`, `defaultExpanded`, `onExpandedChange`, `onAction`,\n//   `activation`, `disabled`, `controller`.\nfunction Tree({\n  label,\n  items,\n  ...props\n}: Omit<TreeProps<\"single\">, \"children\" | \"items\" | \"paths\" | \"mode\" | \"aria-label\" | \"aria-labelledby\"> & {\n  label: string\n  items: TreeNode[]\n}) {\n  const id = React.useId()\n\n  // An item takes real focus, and its row shows it (a ring inside the row),\n  // so the item asks for no ring of its own around the whole branch.\n  const rows = (nodes: TreeNode[]) =>\n    nodes.map((node) => (\n      <TreeItem key={node.value} value={node.value} disabled={node.disabled} data-kit=\"tree-item\" data-focus-quiet=\"\">\n        <TreeItemLabel data-kit=\"tree-row\">\n          {node.children ? (\n            <TreeItemIndicator data-kit=\"tree-indicator\">\n              <ChevronRight aria-hidden />\n            </TreeItemIndicator>\n          ) : (\n            <span data-kit=\"tree-tick\" aria-hidden />\n          )}\n          <span data-kit=\"tree-name\">{node.label}</span>\n          {node.meta && <span data-kit=\"tree-meta\">{node.meta}</span>}\n        </TreeItemLabel>\n        {node.children && <TreeGroup data-kit=\"tree-group\">{rows(node.children)}</TreeGroup>}\n      </TreeItem>\n    ))\n\n  return (\n    <div data-kit=\"tree\" data-disabled={props.disabled ? \"\" : undefined}>\n      <div data-kit=\"tree-head\">\n        <span data-kit=\"label\" id={id}>\n          {label}\n        </span>\n        <span data-kit=\"value\" aria-hidden>\n          {String(count(items)).padStart(2, \"0\")}\n        </span>\n      </div>\n      {/* The same nodes as data on the root, so the keys, typeahead and an\n          agent know the whole shape, closed branches included. */}\n      <SdkTree data-kit=\"tree-rows\" aria-labelledby={id} items={items} {...props}>\n        {rows(items)}\n      </SdkTree>\n    </div>\n  )\n}\n\nexport { Tree }\nexport type { TreeNode }\n",
      "type": "registry:ui",
      "target": "@ui/tree.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/tree.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n@layer cyber.ui {\n  /* A heading strip over the rows. Beside others in a row it shares the\n     width; alone it takes it all. */\n  [data-skin=\"cyber\"] [data-kit=\"tree\"] {\n    --row: 28px;\n    --indent: 20px;\n    /* Where a branch's rail runs: under the middle of its chevron. */\n    --rail: 12px;\n\n    flex: 1 1 220px;\n    display: grid;\n    gap: 4px;\n    min-width: min(100%, 200px);\n    text-align: start;\n\n    @media (pointer: coarse) {\n      --row: 44px;\n    }\n  }\n\n  /* The strip: the tree's name, how many nodes it holds, and a rule with a\n     hot tick at its leading end. */\n  [data-skin=\"cyber\"] [data-kit=\"tree-head\"] {\n    position: relative;\n    display: flex;\n    align-items: baseline;\n    justify-content: space-between;\n    gap: 12px;\n    padding: 0 2px 5px;\n    border-block-end: 1px solid var(--cy-line-deco);\n\n    &::after {\n      content: \"\";\n      position: absolute;\n      inset-block-end: -1px;\n      inset-inline-start: 0;\n      width: 28px;\n      height: 3px;\n      background: var(--cy-accent);\n    }\n\n    [data-disabled] > & {\n      &::after {\n        background: var(--cy-line-deco);\n      }\n      & [data-kit=\"label\"],\n      & [data-kit=\"value\"] {\n        color: var(--cy-ink-mute);\n      }\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"tree-rows\"] {\n    display: block;\n    outline: none;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"tree-item\"] {\n    position: relative;\n    display: block;\n  }\n\n  /* A branch's children, set in from it. The SDK measures the group, so it\n     opens and closes by height. */\n  [data-skin=\"cyber\"] [data-kit=\"tree-group\"] {\n    display: block;\n    height: var(--tree-group-height);\n    padding-inline-start: var(--indent);\n    overflow: clip;\n    transition: height var(--cy-t) var(--cy-ease-snap);\n\n    &:is([data-starting-style], [data-ending-style]) {\n      height: 0;\n    }\n  }\n\n  /* The wiring: a rail down from the branch past each child, stopping at\n     the last one's row, and a stub from the rail to each row. */\n  [data-skin=\"cyber\"] [data-kit=\"tree-group\"] > [data-kit=\"tree-item\"] {\n    &::before,\n    &::after {\n      content: \"\";\n      position: absolute;\n      inset-inline-start: calc(var(--rail) - var(--indent));\n      background: var(--cy-line-deco);\n      pointer-events: none;\n    }\n\n    &::before {\n      inset-block: 0;\n      width: 1px;\n    }\n\n    &:last-child::before {\n      inset-block-end: auto;\n      height: calc(var(--row) / 2 + 1px);\n    }\n\n    &::after {\n      inset-block-start: calc(var(--row) / 2);\n      width: calc(var(--indent) - var(--rail));\n      height: 1px;\n    }\n  }\n\n  /* A row: the chevron or the tick, the name, and the meta at the end. */\n  [data-skin=\"cyber\"] [data-kit=\"tree-row\"] {\n    --cut: 8px;\n\n    display: flex;\n    align-items: center;\n    gap: 6px;\n    min-height: var(--row);\n    padding-inline: 4px 10px;\n    font-size: var(--cy-text-sm);\n    font-weight: 600;\n    line-height: 1.1;\n    letter-spacing: var(--cy-track);\n    text-transform: uppercase;\n    color: var(--cy-ink);\n    cursor: default;\n    user-select: none;\n    transition:\n      background-color var(--cy-t-fast) linear,\n      color var(--cy-t-fast) linear;\n\n    @media (hover: hover) {\n      &:hover:not([data-disabled], [data-selected]) {\n        background: var(--cy-fill-hover);\n      }\n    }\n\n    /* The chosen row: lit, brighter ink, and its corner cut, so it isn't\n       told apart by color alone. */\n    &[data-selected] {\n      background: var(--cy-fill-active);\n      color: var(--cy-ink-hi);\n      clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);\n\n      &:dir(rtl) {\n        clip-path: polygon(0 0, 100% 0, 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));\n      }\n    }\n\n    /* Unavailable: hatched and muted. It still takes focus, so it can be\n       found and heard. */\n    &[data-disabled] {\n      background-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--cy-line-deco) 5px 6px);\n      color: var(--cy-ink-mute);\n      cursor: not-allowed;\n    }\n\n    /* Keyboard focus belongs to the item; its row draws the ring, inside\n       itself, so the cut corner doesn't clip it away. */\n    [data-kit=\"tree-item\"]:focus-visible > & {\n      outline: 2px solid var(--cy-signal);\n      outline-offset: -2px;\n    }\n  }\n\n  /* The chevron turns down, in steps, as its branch opens. */\n  [data-skin=\"cyber\"] [data-kit=\"tree-indicator\"] {\n    flex: none;\n    display: grid;\n    place-items: center;\n    width: 16px;\n    height: 16px;\n    color: var(--cy-ink);\n    transition: rotate var(--cy-t) var(--cy-ease-step);\n\n    & svg {\n      width: 14px;\n      height: 14px;\n    }\n\n    &:dir(rtl) {\n      scale: -1 1;\n    }\n\n    &[data-expanded] {\n      rotate: 90deg;\n      color: var(--cy-ink-hi);\n\n      &:dir(rtl) {\n        rotate: -90deg;\n      }\n    }\n\n    [data-disabled] > & {\n      color: var(--cy-ink-mute);\n    }\n  }\n\n  /* A leaf's tick: hollow at rest, solid and in the signal color once its\n     row is the chosen one. */\n  [data-skin=\"cyber\"] [data-kit=\"tree-tick\"] {\n    flex: none;\n    display: grid;\n    place-items: center;\n    width: 16px;\n    height: 16px;\n\n    &::before {\n      content: \"\";\n      width: 6px;\n      height: 6px;\n      border: 1px solid var(--cy-line-ctl);\n      transition:\n        background-color var(--cy-t-fast) linear,\n        border-color var(--cy-t-fast) linear;\n    }\n\n    [data-selected] > &::before {\n      border-color: var(--cy-signal);\n      background: var(--cy-signal);\n    }\n\n    [data-disabled] > &::before {\n      border-color: var(--cy-line-deco);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"tree-name\"] {\n    flex: 1;\n    min-width: 0;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"tree-meta\"] {\n    flex: none;\n    font-family: var(--cy-mono);\n    font-size: 10px;\n    font-weight: 400;\n    letter-spacing: 0.04em;\n    white-space: nowrap;\n    color: var(--cy-ink-mute);\n\n    [data-selected] > & {\n      color: var(--cy-signal);\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/tree.css"
    }
  ],
  "type": "registry:ui"
}
