{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tabs",
  "title": "Tabs",
  "description": "Tabs over panels with a sliding indicator, or as cut keys. Set cipher on key tabs to briefly split the selected key’s edge.",
  "dependencies": [
    "@ui-sdk/react@0.1.0-beta.5"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/tabs.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Tabs as SdkTabs, TabsIndicator, TabsList, TabsPanel, TabsTab, TabsTabIcon } from \"@ui-sdk/react/tabs\"\nimport { playCipherEdge } from \"@/registry/cyber/lib/cipher\"\nimport \"@/registry/cyber/ui/cyber/tabs.css\"\n\ntype TabSpec = {\n  value: string\n  label: string\n  icon?: React.ReactNode\n  /** A word in a yellow flag after the label, like \"New\". It's read as part of the tab's name. */\n  flag?: string\n  disabled?: boolean\n  content: React.ReactNode\n}\n\nfunction KeySelectionEffect({ list, value }: { list: React.RefObject<HTMLDivElement | null>; value: string | null }) {\n  const previous = React.useRef<HTMLElement | null | undefined>(undefined)\n  React.useLayoutEffect(() => {\n    const key = list.current?.querySelector<HTMLElement>(':scope > [aria-selected=\"true\"]') ?? null\n    const changed = previous.current !== undefined && previous.current !== key\n    previous.current = key\n    if (changed && key) return playCipherEdge(key)\n  }, [list, value])\n  return null\n}\n\n// The navigation along the top of a screen: a row of sections, one open.\n//\n// - `variant=\"bar\"` is a segmented rule: the open tab reads in the signal\n//   color and a bar slides along the rule to it, with a counter at the end\n//   of the row that steps to its number. When the row is too narrow for its\n//   tabs it scrolls sideways.\n// - `variant=\"key\"` makes each tab a cut key that stays lit while it's open,\n//   with the tick in its raised corner on. Keys wrap instead of scrolling.\n//\n// `label` names the row for assistive technology. A panel tears in when its\n// tab is chosen, but not the one that's open as the page loads.\nfunction Tabs({\n  label,\n  tabs,\n  variant = \"bar\",\n  cipher = false,\n  ...props\n}: Omit<React.ComponentProps<typeof SdkTabs>, \"children\"> & {\n  label: string\n  tabs: TabSpec[]\n  variant?: \"bar\" | \"key\"\n  /** Briefly tear the newly selected key's edge at full FX. */\n  cipher?: boolean\n}) {\n  const list = React.useRef<HTMLDivElement>(null)\n  const content = (\n    <>\n      <div data-kit=\"tabs-bar\">\n        <TabsList ref={list} data-kit=\"tabs-list\" aria-label={label}>\n          {tabs.map((tab) => (\n            <TabsTab\n              key={tab.value}\n              value={tab.value}\n              disabled={tab.disabled}\n              data-kit=\"tabs-tab\"\n              data-frame={variant === \"key\" ? \"notch br\" : undefined}\n              data-press-flash=\"\"\n            >\n              {tab.icon != null && <TabsTabIcon data-kit=\"tabs-icon\">{tab.icon}</TabsTabIcon>}\n              {tab.label}\n              {tab.flag && <span data-kit=\"tabs-flag\">{tab.flag}</span>}\n            </TabsTab>\n          ))}\n          {variant === \"bar\" && <TabsIndicator data-kit=\"tabs-indicator\" />}\n        </TabsList>\n        {/* \"02 / 03\", counted by the stylesheet from the tabs themselves. */}\n        {variant === \"bar\" && <span data-kit=\"tabs-count\" data-micro aria-hidden />}\n      </div>\n      {tabs.map((tab) => (\n        <TabsPanel key={tab.value} value={tab.value} data-kit=\"tabs-panel\">\n          {tab.content}\n        </TabsPanel>\n      ))}\n    </>\n  )\n  return (\n    <SdkTabs data-kit=\"tabs\" data-variant={variant} {...props}>\n      {state => <>\n        {content}\n        {cipher && variant === \"key\" && <KeySelectionEffect list={list} value={state.value} />}\n      </>}\n    </SdkTabs>\n  )\n}\n\nexport { Tabs }\nexport type { TabSpec }\n",
      "type": "registry:ui",
      "target": "@ui/tabs.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/tabs.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n/* How far a scrolling row of tabs has run, as the width of the fade at each\n   end: none at the end it's scrolled to, a fade wherever tabs are out of\n   sight. It's tied to the row's own scroll position, not to time. */\n@keyframes cy-tabs-edges {\n  0% {\n    --cy-tabs-fade-start: 0px;\n    --cy-tabs-fade-end: var(--fade);\n  }\n  2%,\n  98% {\n    --cy-tabs-fade-start: var(--fade);\n    --cy-tabs-fade-end: var(--fade);\n  }\n  100% {\n    --cy-tabs-fade-start: var(--fade);\n    --cy-tabs-fade-end: 0px;\n  }\n}\n\n@layer cyber.ui {\n  [data-skin=\"cyber\"] [data-kit=\"tabs\"] {\n    display: grid;\n    width: 100%;\n    min-width: 0;\n    text-align: start;\n  }\n\n  /* The row: the tabs, then whatever is left of the rule, carrying the\n     counter. Two counters run along it: one stops at the open tab, one goes\n     to the end. */\n  [data-skin=\"cyber\"] [data-kit=\"tabs-bar\"] {\n    display: flex;\n    align-items: stretch;\n    gap: 4px;\n    min-width: 0;\n    counter-reset: cy-tab cy-tabs;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"tabs-list\"] {\n    position: relative;\n    display: flex;\n    gap: 4px;\n    min-width: 0;\n    /* Too narrow for its tabs, the row scrolls; the SDK keeps the open tab\n       in view and the counter says how many there are. A scrolling box\n       clips at its padding edge, so it's padded by the width of a focus\n       ring and pulled back out by the same amount. */\n    --ring: 4px;\n    padding: var(--ring);\n    margin: calc(var(--ring) * -1);\n    overflow-x: auto;\n    overscroll-behavior-x: contain;\n    scrollbar-width: none;\n  }\n\n  /* What a tab is in either variant. The edge and the fill are left to the\n     variant: a key is a frame, which owns both. */\n  [data-skin=\"cyber\"] [data-kit=\"tabs-tab\"] {\n    position: relative;\n    flex: none;\n    display: inline-flex;\n    align-items: center;\n    gap: 8px;\n    height: var(--cy-h);\n    padding: 0 12px;\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    white-space: nowrap;\n    color: var(--cy-ink);\n    cursor: pointer;\n    user-select: none;\n    counter-increment: cy-tabs;\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    /* Every tab up to and including the open one. */\n    &:not([data-selected] ~ [data-kit=\"tabs-tab\"]) {\n      counter-increment: cy-tab cy-tabs;\n    }\n\n    &[data-disabled] {\n      color: var(--cy-ink-mute);\n      cursor: not-allowed;\n    }\n  }\n\n  /* ── Bar ───────────────────────────────────────────────────────────── */\n\n  /* Each tab is a length of the rule. Hovered, its length lights; open, it\n     reads in the signal color and the bar sits under it. */\n  [data-skin=\"cyber\"] [data-kit=\"tabs\"][data-variant=\"bar\"] [data-kit=\"tabs-tab\"] {\n    border: 0;\n    border-block-end: 1px solid var(--cy-line-deco);\n    background: none;\n\n    @media (hover: hover) {\n      &:hover:not([data-disabled], [data-selected]) {\n        border-block-end-color: var(--cy-line-hot);\n        background-color: var(--cy-fill-hover);\n      }\n    }\n\n    &[data-selected] {\n      color: var(--cy-signal);\n    }\n\n    &[data-disabled] {\n      background-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--cy-line-deco) 5px 6px);\n    }\n  }\n\n  /* A row too narrow for its tabs fades out at whichever end has more, so\n     a tab that's out of sight is hinted at, and scrolling to a tab stops\n     short of the fade. Where the browser can't tie this to the scroll\n     position, the counter at the end of the rule is the hint. The mask only\n     uses the color's opacity. */\n  @supports (animation-timeline: scroll()) {\n    [data-skin=\"cyber\"] [data-kit=\"tabs\"][data-variant=\"bar\"] [data-kit=\"tabs-list\"] {\n      --fade: 20px;\n      --toward: to right;\n\n      scroll-padding-inline: var(--fade);\n      mask-image: linear-gradient(\n        var(--toward),\n        transparent,\n        var(--cy-void) var(--cy-tabs-fade-start, 0px),\n        var(--cy-void) calc(100% - var(--cy-tabs-fade-end, 0px)),\n        transparent\n      );\n      animation: cy-tabs-edges linear both;\n      animation-timeline: scroll(self inline);\n\n      &:dir(rtl) {\n        --toward: to left;\n      }\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"tabs-icon\"] {\n    display: grid;\n    place-items: center;\n\n    & svg {\n      width: 16px;\n      height: 16px;\n    }\n\n    &[data-mirror]:dir(rtl) {\n      scale: -1 1;\n    }\n  }\n\n  /* The flag: an outlined yellow tag, the one thing in the row to look at. */\n  [data-skin=\"cyber\"] [data-kit=\"tabs-flag\"] {\n    padding: 2px 4px 1px;\n    border: 1px solid var(--cy-flag);\n    font-size: var(--cy-text-xs);\n    font-weight: 700;\n    line-height: 1;\n    letter-spacing: 0.08em;\n    color: var(--cy-flag);\n  }\n\n  /* The bar that marks the open tab. It rides the rule: its width is the\n     tab's, and it slides there with a hard stop. The SDK measures the tab\n     from the row's left edge, so the bar is placed from the left in either\n     reading direction. */\n  [data-skin=\"cyber\"] [data-kit=\"tabs-indicator\"] {\n    position: absolute;\n    left: 0;\n    bottom: var(--ring);\n    width: var(--active-tab-width);\n    height: 0;\n    border-block-start: 2px solid var(--cy-signal);\n    translate: var(--active-tab-left) 0;\n    filter: drop-shadow(0 0 calc(4px * var(--cy-fx)) var(--cy-signal));\n    pointer-events: none;\n    transition: translate var(--cy-t) var(--cy-ease-snap);\n\n    /* Its first placement isn't a move. */\n    &[data-activation-direction=\"none\"] {\n      transition: none;\n    }\n  }\n\n  /* The rest of the rule, with the counter sitting on it: \"02 / 03\". */\n  [data-skin=\"cyber\"] [data-kit=\"tabs-count\"] {\n    flex: 1 0 auto;\n    display: flex;\n    align-items: flex-end;\n    justify-content: flex-end;\n    min-width: 44px;\n    padding-block-end: 5px;\n    border-block-end: 1px solid var(--cy-line-deco);\n\n    &::before {\n      content: counter(cy-tab, decimal-leading-zero) \" / \" counter(cy-tabs, decimal-leading-zero);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"tabs-panel\"] {\n    min-width: 0;\n    padding-block-start: 12px;\n    color: var(--cy-ink-hi);\n    text-wrap: pretty;\n\n    /* A panel that was chosen tears in. The one open on arrival is simply\n       there. */\n    &[data-selected]:not([data-activation-direction=\"none\"]) {\n      animation: var(--cy-fx-in) 240ms var(--cy-ease-snap) backwards;\n    }\n  }\n\n  /* ── Keys ──────────────────────────────────────────────────────────── */\n\n  /* Each tab a cut key, in the kit's state language: idle an outline, hover\n     the line at full and a 10% fill, open the 40% fill. A key that's open\n     also lights the tick in its raised corner, so it isn't told by the fill\n     alone. */\n  [data-skin=\"cyber\"] [data-kit=\"tabs\"][data-variant=\"key\"] {\n    & [data-kit=\"tabs-list\"] {\n      flex-wrap: wrap;\n      padding: 0;\n      margin: 0;\n      overflow: visible;\n    }\n\n    & [data-kit=\"tabs-tab\"] {\n      --frame-cut: var(--cy-cut-sm);\n      --frame-line: var(--cy-line-ctl);\n      --frame-fill: var(--cy-panel-a);\n      --frame-notch-x: 22px;\n      --frame-notch: 4px;\n\n      padding-inline: 14px;\n\n      /* The tick: a bar across the raised corner. */\n      &::before {\n        content: \"\";\n        position: absolute;\n        inset-block-start: -1px;\n        left: -1px;\n        width: var(--frame-notch-x);\n        border-block-start: 4px solid var(--cy-signal);\n        opacity: 0;\n        transition: opacity var(--cy-t-fast) linear;\n      }\n\n      @media (hover: hover) {\n        &:hover:not([data-disabled], [data-selected]) {\n          --frame-line: var(--cy-line-hot);\n          --frame-fill: var(--cy-fill-hover);\n        }\n      }\n\n      &[data-selected] {\n        --frame-line: var(--cy-line-hot);\n        --frame-fill: var(--cy-fill-active);\n        color: var(--cy-ink-hi);\n\n        &::before {\n          opacity: 1;\n        }\n      }\n\n      &[data-disabled] {\n        --frame-line: var(--cy-line-deco);\n        --frame-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--cy-line-deco) 5px 6px);\n      }\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/tabs.css"
    }
  ],
  "type": "registry:ui"
}
