{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "resizable",
  "title": "Resizable",
  "description": "Panels split by a handle that drags or steps with keys.",
  "dependencies": [
    "@ui-sdk/react@0.1.0-beta.5"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/resizable.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Resizable as SdkResizable, ResizableHandle, ResizablePanel, type ResizableSize } from \"@ui-sdk/react/resizable\"\nimport { crosses, haptic } from \"@/registry/cyber/lib/haptics\"\nimport { createAdjustmentSound, sfx } from \"@/registry/cyber/lib/sound\"\nimport \"@/registry/cyber/ui/cyber/resizable.css\"\n\ntype ResizablePane = {\n  /** What the pane holds, in a word or two. Printed over it, and it names the handle after it (\"Resize routes\"). */\n  label: string\n  content: React.ReactNode\n  /** Sizes are percentages as numbers, or strings with a unit, like \"160px\". */\n  defaultSize?: ResizableSize\n  minSize?: ResizableSize\n  maxSize?: ResizableSize\n  /** Lets the pane fold away: drag past its minimum, or press Enter on its handle. */\n  collapsible?: boolean\n  /** Identifies the pane in a saved layout and to a controller. */\n  id?: string\n}\n\n// Panes split by handles, in one cut frame. A handle is a rule with grip\n// ticks on it; it lights on hover, on focus and while it's dragged, and\n// prints the size of the pane before it for as long as it's lit. Arrow keys\n// step it, Shift with an arrow steps further, Home and End send it to its\n// limits.\n//\n// - `panes`: two or three, in order. Each has a `label`, printed over it.\n// - `orientation`: \"horizontal\" sets panes side by side, \"vertical\" stacks\n//   them. Give a vertical group a height.\n// - Everything else goes to the SDK's Resizable: `layout`, `defaultLayout`,\n//   `onLayoutChange`, `onLayoutCommit`, `step`, `largeStep`, `autoSaveId`,\n//   `disabled`, `controller`.\n//\n// Ticking follows active movement. A phone also taps each time a handle\n// crosses a twentieth of the group.\nfunction Resizable({\n  panes,\n  onLayoutChange,\n  onLayoutCommit,\n  ...props\n}: Omit<React.ComponentProps<typeof SdkResizable>, \"children\"> & {\n  panes: ResizablePane[]\n}) {\n  const last = React.useRef<number[]>(props.layout ?? props.defaultLayout ?? [])\n  const adjustment = React.useMemo(createAdjustmentSound, [])\n  React.useEffect(() => adjustment.stop, [adjustment])\n  React.useEffect(() => {\n    if (props.disabled) adjustment.stop()\n  }, [adjustment, props.disabled])\n  React.useEffect(() => {\n    if (props.layout) last.current = props.layout\n  }, [props.layout])\n\n  return (\n    <SdkResizable\n      data-kit=\"resizable\"\n      data-frame=\"br\"\n      {...props}\n      onLayoutChange={(layout, details) => {\n        onLayoutChange?.(layout, details)\n        if (details.canceled) return adjustment.stop()\n        // The SDK only reports actual layout changes. Resizing the window\n        // and controller updates are not movement of a person's handle.\n        const byHand = details.reason === \"drag\" || details.reason === \"step-key\" || details.reason === \"collapse\"\n        if (details.reason === \"drag\") adjustment.move()\n        else {\n          adjustment.stop()\n          // A key or collapse can commit immediately. Let one recorded\n          // tick finish instead of starting a loop that release would cut.\n          if (byHand) sfx(\"hover\")\n        }\n        if (byHand && layout.some((size, index) => last.current[index] != null && crosses(last.current[index], size, 5))) {\n          haptic(\"selection\")\n        }\n        last.current = layout\n      }}\n      onLayoutCommit={(layout, details) => {\n        adjustment.stop()\n        onLayoutCommit?.(layout, details)\n      }}\n      onBlur={(event) => {\n        adjustment.stop()\n        props.onBlur?.(event)\n      }}\n      onPointerCancel={(event) => {\n        adjustment.stop()\n        props.onPointerCancel?.(event)\n      }}\n      onLostPointerCapture={(event) => {\n        adjustment.stop()\n        props.onLostPointerCapture?.(event)\n      }}\n    >\n      {panes.map((pane, index) => (\n        <React.Fragment key={pane.id ?? pane.label}>\n          {index > 0 && (\n            <ResizableHandle data-kit=\"resizable-handle\" aria-label={`Resize ${panes[index - 1].label.toLowerCase()}`}>\n              <span data-kit=\"resizable-grip\" aria-hidden />\n            </ResizableHandle>\n          )}\n          <ResizablePanel\n            data-kit=\"resizable-pane\"\n            id={pane.id}\n            defaultSize={pane.defaultSize}\n            minSize={pane.minSize}\n            maxSize={pane.maxSize}\n            collapsible={pane.collapsible}\n          >\n            <span data-kit=\"resizable-label\">\n              <span aria-hidden>{String(index + 1).padStart(2, \"0\")}</span>\n              {pane.label}\n            </span>\n            <div data-kit=\"resizable-content\">{pane.content}</div>\n          </ResizablePanel>\n        </React.Fragment>\n      ))}\n    </SdkResizable>\n  )\n}\n\nexport { Resizable }\nexport type { ResizablePane }\n",
      "type": "registry:ui",
      "target": "@ui/resizable.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/resizable.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n@layer cyber.ui {\n  /* The group: one cut frame the panes share. The SDK lays the panes out\n     (a flex row, or a column when vertical) and sizes them. */\n  [data-skin=\"cyber\"] [data-kit=\"resizable\"] {\n    --frame-cut: var(--cy-cut);\n    --frame-line: var(--cy-line-deco);\n    --frame-fill: var(--cy-panel-a);\n    /* Frame variables inherit, and a surface behind may have set one. */\n    --frame-image: none;\n\n    width: 100%;\n    min-width: 0;\n    min-height: 172px;\n    text-align: start;\n\n    &[data-orientation=\"vertical\"] {\n      min-height: 300px;\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"resizable-pane\"] {\n    display: flex;\n    flex-direction: column;\n    min-width: 0;\n    min-height: 0;\n    overflow: hidden;\n  }\n\n  /* What the pane holds, printed along its top with its number. */\n  [data-skin=\"cyber\"] [data-kit=\"resizable-label\"] {\n    flex: none;\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    height: 26px;\n    padding-inline: 12px;\n    border-block-end: 1px solid var(--cy-line-deco);\n    overflow: hidden;\n    font-family: var(--cy-mono);\n    font-size: var(--cy-text-xs);\n    letter-spacing: 0.06em;\n    text-transform: uppercase;\n    white-space: nowrap;\n    color: var(--cy-ink-mute);\n\n    & > [aria-hidden] {\n      color: var(--cy-signal);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"resizable-content\"] {\n    flex: 1 1 auto;\n    min-height: 0;\n    padding: 10px 12px 12px;\n    overflow: auto;\n    font-size: var(--cy-text-sm);\n    line-height: 1.45;\n    color: var(--cy-ink-hi);\n\n    & ul {\n      display: grid;\n      gap: 6px;\n      padding: 0;\n      list-style: none;\n    }\n  }\n\n  /* A handle: a rule across the group with a grip on it. It stops short of\n     the frame at both ends, so its focus ring isn't clipped by the frame's\n     corners.\n       idle      rule 70%, grip hollow\n       hover     rule 100%, grip fill 10%\n       dragging  rule 100%, grip fill 40%, bright ticks\n       focus     the kit's ring around it\n       disabled  rule 30%, no grip\n     `data-hovering` is the SDK's: it covers the handle's whole hit area,\n     which reaches past the rule. */\n  [data-skin=\"cyber\"] [data-kit=\"resizable-handle\"] {\n    --line: var(--cy-line-ctl);\n    --grip-fill: var(--cy-panel);\n    --grip-ink: var(--cy-line-ctl);\n\n    position: relative;\n    flex: none;\n    display: grid;\n    place-items: center;\n    width: 9px;\n    margin-block: 5px;\n\n    /* The rule. */\n    &::before {\n      content: \"\";\n      position: absolute;\n      inset-block: 0;\n      inset-inline-start: 4px;\n      width: 1px;\n      background: var(--line);\n      transition: background-color var(--cy-t-fast) linear;\n    }\n\n    &[data-orientation=\"vertical\"] {\n      width: auto;\n      height: 9px;\n      margin-block: 0;\n      margin-inline: 5px;\n\n      &::before {\n        inset-inline: 0;\n        inset-block: 4px auto;\n        width: auto;\n        height: 1px;\n      }\n    }\n\n    &:is([data-hovering], :focus-visible) {\n      --line: var(--cy-line-hot);\n      --grip-fill: var(--cy-fill-hover);\n      --grip-ink: var(--cy-line-hot);\n    }\n\n    &[data-dragging] {\n      --line: var(--cy-line-hot);\n      --grip-fill: var(--cy-fill-active);\n      --grip-ink: var(--cy-ink-hi);\n    }\n\n    &[data-disabled] {\n      --line: var(--cy-line-deco);\n    }\n\n    /* The size of the pane before it, read off the handle's own\n       aria-valuenow: a tag beside the grip, shown while the handle is lit. */\n    &::after {\n      content: attr(aria-valuenow) \"%\";\n      position: absolute;\n      z-index: 1;\n      inset-block-start: 50%;\n      inset-inline-start: 12px;\n      translate: 0 -50%;\n      padding: 2px 5px;\n      border: 1px solid var(--cy-signal-dim);\n      background: var(--cy-panel);\n      font-family: var(--cy-mono);\n      font-size: 10px;\n      line-height: 1.2;\n      color: var(--cy-signal);\n      white-space: nowrap;\n      pointer-events: none;\n      opacity: 0;\n      transition: opacity var(--cy-t-fast) linear;\n    }\n\n    &[data-orientation=\"vertical\"]::after {\n      inset-block-start: 12px;\n      inset-inline-start: 50%;\n      translate: -50% 0;\n\n      &:dir(rtl) {\n        translate: 50% 0;\n      }\n    }\n\n    &:is([data-hovering], [data-dragging], :focus-visible):not([data-disabled])::after {\n      opacity: 1;\n    }\n  }\n\n  /* The grip: a small cut block on the rule with ticks across it. */\n  [data-skin=\"cyber\"] [data-kit=\"resizable-grip\"] {\n    position: relative;\n    width: 9px;\n    height: 30px;\n    border: 1px solid var(--line);\n    background:\n      repeating-linear-gradient(to bottom, var(--grip-ink) 0 1px, transparent 1px 4px) center / 3px 17px no-repeat,\n      var(--grip-fill);\n    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%);\n    transition:\n      background-color var(--cy-t-fast) linear,\n      border-color var(--cy-t-fast) linear;\n\n    [data-orientation=\"vertical\"] > & {\n      width: 30px;\n      height: 9px;\n      background:\n        repeating-linear-gradient(to right, var(--grip-ink) 0 1px, transparent 1px 4px) center / 17px 3px no-repeat,\n        var(--grip-fill);\n    }\n\n    [data-disabled] > & {\n      display: none;\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/resizable.css"
    }
  ],
  "type": "registry:ui"
}
