{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar",
  "title": "Navbar",
  "description": "A navigation bar with status readouts, page links and trailing content.",
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/navbar.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport \"@/registry/cyber/ui/cyber/navbar.css\"\n\ntype NavbarItem = {\n  href: string\n  label: string\n  /** The page being shown. Marked with aria-current, the signal color and a bar on the rule. */\n  current?: boolean\n  icon?: React.ReactNode\n}\n\ntype ReadoutTone = \"signal\" | \"flag\" | \"ok\"\n\n// The bar across the top of a screen: status readouts at the leading end,\n// the screen's pages in the middle, and what you're carrying at the far end,\n// all sitting on one rule.\n//\n// - `label` names the navigation (\"Deck sections\"), so it can be told from\n//   any other on the page.\n// - `items` are the pages. Mark the one being shown `current`.\n// - `leading` and `trailing` take anything; NavbarReadout is made for them.\n// - `onNavigate` runs when a page is chosen, before the browser follows the\n//   link: call `event.preventDefault()` there to hand it to a router.\n// - `code` is the line of micro-print under the rule.\n//\n// With room it's one row. In a narrower container the readouts move to a row\n// of their own above the pages, and narrower still the pages wrap two to a\n// line. Nothing scrolls sideways and nothing is hidden.\nfunction Navbar({\n  label,\n  items,\n  leading,\n  trailing,\n  onNavigate,\n  code = \"NODE 3F:A2 // LINK STABLE\",\n  ...props\n}: Omit<React.ComponentProps<\"nav\">, \"children\"> & {\n  label: string\n  items: NavbarItem[]\n  leading?: React.ReactNode\n  trailing?: React.ReactNode\n  onNavigate?: (item: NavbarItem, event: React.MouseEvent<HTMLAnchorElement>) => void\n  code?: string\n}) {\n  return (\n    <nav data-kit=\"navbar\" aria-label={label} {...props}>\n      {/* The nav measures itself; the row inside it is what rearranges. */}\n      <div data-kit=\"navbar-bar\">\n        {leading != null && <div data-kit=\"navbar-leading\">{leading}</div>}\n        {/* A list without bullets stops being announced as one in some\n            screen readers, so the role is stated. */}\n        <ul data-kit=\"navbar-links\" role=\"list\">\n          {items.map((item) => (\n            <li key={item.href} data-kit=\"navbar-item\">\n              <a\n                data-kit=\"navbar-link\"\n                data-press-flash=\"\"\n                href={item.href}\n                aria-current={item.current ? \"page\" : undefined}\n                onClick={onNavigate && ((event) => onNavigate(item, event))}\n              >\n                {item.icon}\n                {item.label}\n              </a>\n            </li>\n          ))}\n        </ul>\n        {trailing != null && <div data-kit=\"navbar-trailing\">{trailing}</div>}\n        <span data-kit=\"navbar-code\" data-micro aria-hidden>\n          {code}\n        </span>\n      </div>\n    </nav>\n  )\n}\n\n// A status readout for the ends of a Navbar: a label and what it reads.\n//\n// - `tone` colors the value: \"signal\" for a plain reading, \"ok\" for standing\n//   that's good, \"flag\" for the one to look at (credits).\n// - `progress`, from 0 to 1, draws a meter under it: how far along the value\n//   is to its next step. It's announced as \"<label> progress\".\n// - `hideLabel` keeps the label for screen readers only, for a value that\n//   says what it is by itself (\"¤ 15 240\").\nfunction NavbarReadout({\n  label,\n  value,\n  tone = \"signal\",\n  progress,\n  hideLabel,\n  ...props\n}: Omit<React.ComponentProps<\"span\">, \"children\"> & {\n  label: string\n  value: React.ReactNode\n  tone?: ReadoutTone\n  progress?: number\n  hideLabel?: boolean\n}) {\n  const filled = progress == null ? null : Math.min(1, Math.max(0, progress))\n  return (\n    <span data-kit=\"navbar-readout\" data-tone={tone} {...props}>\n      <span data-kit=\"navbar-readout-label\" data-sr-only={hideLabel ? \"\" : undefined}>\n        {label}\n      </span>{\" \"}\n      <span data-kit=\"navbar-readout-value\">{value}</span>\n      {filled != null && (\n        <span\n          data-kit=\"navbar-readout-meter\"\n          role=\"meter\"\n          aria-label={`${label} progress`}\n          aria-valuemin={0}\n          aria-valuemax={100}\n          aria-valuenow={Math.round(filled * 100)}\n          style={{ \"--value\": filled } as React.CSSProperties}\n        />\n      )}\n    </span>\n  )\n}\n\nexport { Navbar, NavbarReadout }\nexport type { NavbarItem }\n",
      "type": "registry:ui",
      "target": "@ui/navbar.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/navbar.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n@layer cyber.ui {\n  /* The nav only measures: what's inside it rearranges by how wide the nav\n     is, not the window, so it works in a sidebar as well as across a page. */\n  [data-skin=\"cyber\"] [data-kit=\"navbar\"] {\n    container: navbar / inline-size;\n    width: 100%;\n    min-width: 0;\n    text-align: start;\n  }\n\n  /* Narrow first: the readouts share a row, the pages take the next, each\n     on its own length of the rule, and the print runs under them. */\n  [data-skin=\"cyber\"] [data-kit=\"navbar-bar\"] {\n    --rule: inset 0 -1px 0 var(--cy-line-deco);\n\n    display: grid;\n    grid-template-columns: minmax(0, 1fr) auto;\n    grid-template-areas:\n      \"leading trailing\"\n      \"links links\"\n      \"code code\";\n    column-gap: 16px;\n    align-items: stretch;\n  }\n\n  [data-skin=\"cyber\"] :is([data-kit=\"navbar-leading\"], [data-kit=\"navbar-trailing\"]) {\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    gap: 4px 18px;\n    min-width: 0;\n    min-height: var(--cy-h);\n    padding-block: 4px;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"navbar-leading\"] {\n    grid-area: leading;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"navbar-trailing\"] {\n    grid-area: trailing;\n    justify-content: flex-end;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"navbar-links\"] {\n    grid-area: links;\n    display: flex;\n    flex-wrap: wrap;\n    justify-content: center;\n    min-width: 0;\n    margin: 0;\n    padding: 0;\n    list-style: none;\n    box-shadow: var(--rule);\n  }\n\n  /* Two to a line while the bar is at its narrowest, so four pages make a\n     square rather than three and a straggler. */\n  [data-skin=\"cyber\"] [data-kit=\"navbar-item\"] {\n    flex: 1 1 50%;\n    display: flex;\n    min-width: 0;\n  }\n\n  /* A page. The state language, on a link with no box of its own: its\n     length of the rule is its edge. Hover brings the rule to full and the\n     10% fill; the page being shown reads in the signal color over a\n     two-pixel signal bar. */\n  [data-skin=\"cyber\"] [data-kit=\"navbar-link\"] {\n    position: relative;\n    flex: 1;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    gap: 8px;\n    min-width: 0;\n    min-height: var(--cy-h);\n    padding: 2px 12px 0;\n    font-size: var(--cy-text-md);\n    font-weight: 600;\n    line-height: 1;\n    letter-spacing: var(--cy-track);\n    text-transform: uppercase;\n    text-decoration: none;\n    white-space: nowrap;\n    color: var(--cy-ink);\n    box-shadow: var(--rule);\n    cursor: pointer;\n    transition:\n      background-color var(--cy-t-fast) linear,\n      box-shadow var(--cy-t-fast) linear,\n      color var(--cy-t-fast) linear;\n\n    & svg {\n      width: 16px;\n      height: 16px;\n    }\n\n    /* The bar under the page being shown. A border rather than a fill, so\n       it's still there in forced colors. */\n    &::after {\n      content: \"\";\n      position: absolute;\n      inset: auto 0 0;\n      border-block-end: 2px solid var(--cy-signal);\n      filter: drop-shadow(0 0 calc(4px * var(--cy-fx)) var(--cy-signal));\n      opacity: 0;\n      pointer-events: none;\n    }\n\n    @media (hover: hover) {\n      &:hover:not([aria-current=\"page\"]) {\n        background-color: var(--cy-fill-hover);\n        box-shadow: inset 0 -1px 0 var(--cy-line-hot);\n      }\n    }\n\n    &:active {\n      background-color: var(--cy-fill-active);\n      color: var(--cy-ink-hi);\n    }\n\n    /* The ring reaches past the link, so it's lifted over its neighbors'\n       fills. */\n    &:focus-visible {\n      z-index: 1;\n    }\n\n    &[aria-current=\"page\"] {\n      color: var(--cy-signal);\n\n      &::after {\n        opacity: 1;\n      }\n    }\n  }\n\n  /* The print under the rule. */\n  [data-skin=\"cyber\"] [data-kit=\"navbar-code\"] {\n    grid-area: code;\n    padding-block-start: 5px;\n    overflow: hidden;\n  }\n\n  /* ── Readouts ──────────────────────────────────────────────────────── */\n\n  /* A label, then what it reads, larger and in its tone's color. */\n  [data-skin=\"cyber\"] [data-kit=\"navbar-readout\"] {\n    --tone: var(--cy-signal);\n\n    display: inline-grid;\n    grid-template-columns: auto auto;\n    align-items: baseline;\n    column-gap: 6px;\n    row-gap: 3px;\n    white-space: nowrap;\n\n    &[data-tone=\"flag\"] {\n      --tone: var(--cy-flag);\n    }\n    &[data-tone=\"ok\"] {\n      --tone: var(--cy-ok);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"navbar-readout-label\"] {\n    font-size: var(--cy-text-sm);\n    font-weight: 600;\n    letter-spacing: var(--cy-track);\n    text-transform: uppercase;\n    color: var(--cy-ink);\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"navbar-readout-value\"] {\n    font-size: var(--cy-text-lg);\n    font-weight: 600;\n    line-height: 1;\n    letter-spacing: 0.02em;\n    color: var(--tone);\n  }\n\n  /* The meter: a short track under the readout, lit as far as the value\n     has got. The end of the lit part is a brighter tick. */\n  [data-skin=\"cyber\"] [data-kit=\"navbar-readout-meter\"] {\n    grid-column: 1 / -1;\n    display: block;\n    height: 2px;\n    background: var(--cy-line-deco);\n\n    &::before {\n      content: \"\";\n      display: block;\n      width: calc(var(--value, 0) * 100%);\n      height: 100%;\n      border-inline-end: 2px solid var(--cy-ink-hi);\n      background: var(--tone);\n    }\n\n    /* Fills are flattened in forced colors; a border isn't. */\n    @media (forced-colors: active) {\n      height: auto;\n      border: 1px solid CanvasText;\n\n      &::before {\n        height: 0;\n        border-block-start: 2px solid Highlight;\n      }\n    }\n  }\n\n  /* ── With room ─────────────────────────────────────────────────────── */\n\n  /* Enough for the pages to share a line. */\n  @container navbar (min-width: 360px) {\n    [data-skin=\"cyber\"] [data-kit=\"navbar-item\"] {\n      flex: 1 1 auto;\n    }\n  }\n\n  /* Enough for everything: one row on one rule, pages in the middle. */\n  @container navbar (min-width: 560px) {\n    [data-skin=\"cyber\"] [data-kit=\"navbar-bar\"] {\n      grid-template-columns: auto minmax(0, 1fr) auto;\n      grid-template-areas:\n        \"leading links trailing\"\n        \"code code code\";\n      column-gap: 0;\n    }\n\n    [data-skin=\"cyber\"] :is([data-kit=\"navbar-leading\"], [data-kit=\"navbar-trailing\"]) {\n      box-shadow: var(--rule);\n    }\n\n    [data-skin=\"cyber\"] [data-kit=\"navbar-leading\"] {\n      padding-inline-end: 16px;\n    }\n\n    [data-skin=\"cyber\"] [data-kit=\"navbar-trailing\"] {\n      padding-inline-start: 16px;\n    }\n\n    [data-skin=\"cyber\"] [data-kit=\"navbar-links\"] {\n      align-items: flex-end;\n    }\n\n    [data-skin=\"cyber\"] [data-kit=\"navbar-item\"] {\n      flex: none;\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/navbar.css"
    }
  ],
  "type": "registry:ui"
}
