{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "breadcrumb",
  "title": "Breadcrumb",
  "description": "A trail of pages, the current one in the signal color.",
  "dependencies": [
    "lucide-react@1.73.0"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/breadcrumb.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Ellipsis } from \"lucide-react\"\nimport \"@/registry/cyber/ui/cyber/breadcrumb.css\"\n\ntype BreadcrumbItem = {\n  label: string\n  /** Where the level leads. Without one it's plain text. The last item is the current page and is never a link. */\n  href?: string\n}\n\n// Where this page sits: a trail of the levels above it, split by a double\n// slash, ending in the current page in the signal color.\n//\n// - `label` names the landmark (\"Dossier location\"). Keep it unique among\n//   the navigation on a screen.\n// - `items` run from the top level down. The last one is the current page.\n//\n// In a narrow column a trail of more than three levels folds its middle\n// into a small key; pressing the key unfolds the trail for good and puts\n// focus on the first level it brought back.\nfunction Breadcrumb({\n  label,\n  items,\n  ...props\n}: Omit<React.ComponentProps<\"nav\">, \"children\" | \"aria-label\"> & {\n  label: string\n  items: BreadcrumbItem[]\n}) {\n  const [unfolded, setUnfolded] = React.useState(false)\n  const list = React.useRef<HTMLOListElement>(null)\n  const last = items.length - 1\n  const folds = items.length > 3 && !unfolded\n\n  // The key is gone once it has been pressed, so focus moves to what it\n  // revealed rather than falling back to the page.\n  React.useEffect(() => {\n    if (!unfolded) return\n    const revealed = list.current?.querySelector<HTMLElement>(\"[data-middle] :is(a, [tabindex])\")\n    revealed?.focus()\n  }, [unfolded])\n\n  return (\n    <nav data-kit=\"breadcrumb\" aria-label={label} {...props}>\n      <ol data-kit=\"breadcrumb-list\" ref={list}>\n        {items.map((item, index) => {\n          const middle = index > 0 && index < last\n          return (\n            <React.Fragment key={index}>\n              {folds && index === 1 && (\n                <li data-kit=\"breadcrumb-item\" data-fold=\"\">\n                  <Slash />\n                  <button\n                    type=\"button\"\n                    data-kit=\"breadcrumb-more\"\n                    data-frame=\"br\"\n                    data-press-flash=\"\"\n                    aria-label={`Show ${last - 1} more levels`}\n                    onClick={() => setUnfolded(true)}\n                  >\n                    <Ellipsis aria-hidden />\n                  </button>\n                </li>\n              )}\n              <li data-kit=\"breadcrumb-item\" data-middle={middle ? \"\" : undefined} data-folds={folds && middle ? \"\" : undefined}>\n                {index > 0 && <Slash />}\n                {index === last ? (\n                  <span data-kit=\"breadcrumb-current\" aria-current=\"page\">\n                    {item.label}\n                  </span>\n                ) : item.href != null ? (\n                  <a data-kit=\"breadcrumb-link\" href={item.href}>\n                    {item.label}\n                  </a>\n                ) : (\n                  // A level with nowhere to go still takes focus after the\n                  // trail unfolds, so the key's press lands somewhere.\n                  <span data-kit=\"breadcrumb-text\" tabIndex={middle ? -1 : undefined}>\n                    {item.label}\n                  </span>\n                )}\n              </li>\n            </React.Fragment>\n          )\n        })}\n      </ol>\n    </nav>\n  )\n}\n\n// The divider. It's a drawing of a path, not part of any level's name.\nfunction Slash() {\n  return (\n    <span data-kit=\"breadcrumb-slash\" aria-hidden>\n      {\"//\"}\n    </span>\n  )\n}\n\nexport { Breadcrumb }\nexport type { BreadcrumbItem }\n",
      "type": "registry:ui",
      "target": "@ui/breadcrumb.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/breadcrumb.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n@layer cyber.ui {\n  /* The landmark takes the width it's given and is measured, so the trail\n     can fold when that width is short. */\n  [data-skin=\"cyber\"] [data-kit=\"breadcrumb\"] {\n    width: 100%;\n    min-width: 0;\n    text-align: start;\n    container-type: inline-size;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"breadcrumb-list\"] {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    column-gap: 6px;\n    margin: 0;\n    padding: 0;\n    list-style: none;\n  }\n\n  /* A level, with the slashes that lead into it. They travel together, so\n     a line never ends on a divider and a folded level takes its own away. */\n  [data-skin=\"cyber\"] [data-kit=\"breadcrumb-item\"] {\n    display: flex;\n    align-items: center;\n    gap: 6px;\n    min-width: 0;\n    min-height: 24px;\n    font-size: var(--cy-text-sm);\n    font-weight: 600;\n    line-height: 1.2;\n    letter-spacing: var(--cy-track);\n    text-transform: uppercase;\n\n    /* The key that stands in for the middle shows only while the middle is\n       folded away. */\n    &[data-fold] {\n      display: none;\n    }\n\n    @container (max-width: 380px) {\n      &[data-folds] {\n        display: none;\n      }\n      &[data-fold] {\n        display: flex;\n      }\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"breadcrumb-slash\"] {\n    flex: none;\n    font-family: var(--cy-mono);\n    font-size: var(--cy-text-xs);\n    font-weight: 400;\n    letter-spacing: -0.12em;\n    color: var(--cy-line-ctl);\n    user-select: none;\n  }\n\n  /* A level above: ink at rest, underlined and brighter under the pointer.\n     The padding makes the target 24px tall without moving the text. */\n  [data-skin=\"cyber\"] [data-kit=\"breadcrumb-link\"] {\n    min-width: 0;\n    padding-block: 4px;\n    color: var(--cy-ink);\n    text-decoration: underline transparent;\n    text-decoration-thickness: 1px;\n    text-underline-offset: 4px;\n    overflow-wrap: anywhere;\n    transition:\n      color var(--cy-t-fast) linear,\n      text-decoration-color var(--cy-t-fast) linear;\n\n    @media (hover: hover) {\n      &:hover {\n        color: var(--cy-ink-hi);\n        text-decoration-color: var(--cy-line-hot);\n      }\n    }\n\n    &:active {\n      color: var(--cy-ink-hi);\n      text-decoration-color: var(--cy-ink-hi);\n    }\n\n    @media (pointer: coarse) {\n      padding-block: 10px;\n    }\n  }\n\n  /* A level that leads nowhere. */\n  [data-skin=\"cyber\"] [data-kit=\"breadcrumb-text\"] {\n    min-width: 0;\n    color: var(--cy-ink-mute);\n    overflow-wrap: anywhere;\n  }\n\n  /* Here: the signal color, heavier, and not a link. */\n  [data-skin=\"cyber\"] [data-kit=\"breadcrumb-current\"] {\n    min-width: 0;\n    font-weight: 700;\n    color: var(--cy-signal);\n    overflow-wrap: anywhere;\n  }\n\n  /* The fold: a small cut key holding three dots. */\n  [data-skin=\"cyber\"] [data-kit=\"breadcrumb-more\"] {\n    --frame-cut: 5px;\n    --frame-line: var(--cy-line-ctl);\n    --frame-fill: var(--cy-panel-a);\n    --frame-image: none;\n\n    flex: none;\n    display: grid;\n    place-items: center;\n    width: 28px;\n    height: 24px;\n    padding: 0;\n    color: var(--cy-ink);\n    cursor: pointer;\n    transition:\n      background-color var(--cy-t-fast) linear,\n      border-color var(--cy-t-fast) linear,\n      color var(--cy-t-fast) linear;\n\n    & svg {\n      width: 14px;\n      height: 14px;\n    }\n\n    @media (hover: hover) {\n      &:hover {\n        --frame-line: var(--cy-line-hot);\n        --frame-fill: var(--cy-fill-hover);\n      }\n    }\n\n    &:active {\n      --frame-line: var(--cy-line-hot);\n      --frame-fill: var(--cy-fill-active);\n      color: var(--cy-ink-hi);\n    }\n\n    @media (pointer: coarse) {\n      width: var(--cy-h);\n      height: var(--cy-h-sm);\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/breadcrumb.css"
    }
  ],
  "type": "registry:ui"
}
