{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "popover",
  "title": "Popover",
  "description": "A key that opens a framed surface beside it, with a title, description and body.",
  "dependencies": [
    "@ui-sdk/react@0.1.0-beta.5",
    "lucide-react@1.73.0"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json",
    "https://www.cyberspec.dev/r/button.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/popover.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { X } from \"lucide-react\"\nimport { Popover as SdkPopover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger } from \"@ui-sdk/react/popover\"\nimport type { ButtonTone } from \"@/registry/cyber/ui/button\"\nimport \"@/registry/cyber/ui/cyber/button.css\"\nimport \"@/registry/cyber/ui/cyber/popover.css\"\n\ntype ContentProps = React.ComponentProps<typeof PopoverContent>\n\n// A small panel that opens beside the key it belongs to, wired to it by a\n// lead in the signal color. It isn't modal: the page stays usable, and\n// focus leaving it, Escape or a press outside closes it.\n//\n// - `trigger` is the label of the key that opens it. Leave it out to open it\n//   from a `controller`, and give it an `anchor` to sit against.\n// - `title` names it; `description` is the line under that; `children` are\n//   the body, which can hold controls. A `dl` in the body reads as a table\n//   of facts.\n// - `side` and `align` place it against the key. It flips and shifts by\n//   itself when there isn't room.\n// - `code` is the micro-print along its foot.\nfunction Popover({\n  trigger,\n  triggerTone = \"secondary\",\n  title,\n  description,\n  side = \"bottom\",\n  align = \"start\",\n  sideOffset = 8,\n  anchor,\n  code = \"NODE 3F:A2 // DETAIL\",\n  children,\n  ...props\n}: Omit<React.ComponentProps<typeof SdkPopover>, \"children\"> & {\n  trigger?: React.ReactNode\n  triggerTone?: ButtonTone\n  title: string\n  description?: string\n  side?: ContentProps[\"side\"]\n  align?: ContentProps[\"align\"]\n  sideOffset?: number\n  anchor?: ContentProps[\"anchor\"]\n  code?: string\n  children?: React.ReactNode\n}) {\n  return (\n    <SdkPopover {...props}>\n      {trigger != null && (\n        <PopoverTrigger data-kit=\"button\" data-frame=\"notch br\" data-press-flash=\"\" data-tone={triggerTone}>\n          {trigger}\n        </PopoverTrigger>\n      )}\n      <PopoverContent\n        data-kit=\"popover\"\n        side={side}\n        align={align}\n        sideOffset={sideOffset}\n        anchor={anchor}\n        collisionPadding={8}\n        // The lead spans the gap to the key, so it needs to know how wide\n        // the gap is.\n        style={{ \"--popover-gap\": `${sideOffset}px` } as React.CSSProperties}\n      >\n        <div data-kit=\"popover-surface\" data-frame=\"notch br\">\n          <PopoverTitle data-kit=\"popover-title\">{title}</PopoverTitle>\n          {description && <PopoverDescription data-kit=\"popover-description\">{description}</PopoverDescription>}\n          {children && <div data-kit=\"popover-body\">{children}</div>}\n          <span data-kit=\"popover-foot\" data-micro aria-hidden>\n            {code}\n          </span>\n          {/* Last in the page, first in the corner: focus opens on the\n              body's first control when it has one, and the close key is the\n              last stop before leaving. */}\n          <div data-kit=\"popover-close\">\n            <PopoverClose data-kit=\"button\" data-frame=\"br\" data-press-flash=\"\" data-tone=\"ghost\" data-size=\"sm\" data-icon=\"\" aria-label=\"Close\">\n              <X aria-hidden />\n            </PopoverClose>\n          </div>\n        </div>\n      </PopoverContent>\n    </SdkPopover>\n  )\n}\n\nexport { Popover }\n",
      "type": "registry:ui",
      "target": "@ui/popover.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/popover.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n@layer cyber.ui {\n  /* The popover itself is unframed: a frame is clipped, and this needs to\n     paint past its own edge (the lead). ui-sdk places it with left and top,\n     so the tear in and out, which are transforms, don't fight it. */\n  [data-skin=\"cyber\"] [data-kit=\"popover\"] {\n    display: flex;\n    flex-direction: column;\n    width: min(288px, calc(100vw - 16px));\n    max-height: min(var(--available-height, 80vh), 440px);\n    margin: 0;\n    outline: none;\n\n    &[data-open] {\n      animation: var(--cy-fx-in) 200ms var(--cy-ease-snap) backwards;\n    }\n    &[data-ending-style] {\n      animation: var(--cy-fx-out) 120ms var(--cy-ease-snap) both;\n    }\n\n    /* The lead: a wire in the signal color across the gap, from the middle\n       of the key to the panel, ending in a node on the panel's edge. It\n       follows the side the panel landed on, flips included. */\n    &::before,\n    &::after {\n      content: \"\";\n      position: absolute;\n      background: var(--cy-signal);\n      pointer-events: none;\n    }\n    &::after {\n      width: 6px;\n      height: 6px;\n    }\n    &:is([data-side=\"top\"], [data-side=\"bottom\"])::before {\n      left: calc(var(--arrow-offset, 24px) - 1px);\n      width: 2px;\n      height: var(--popover-gap, 8px);\n    }\n    &:is([data-side=\"top\"], [data-side=\"bottom\"])::after {\n      left: calc(var(--arrow-offset, 24px) - 3px);\n    }\n    &:is([data-side=\"left\"], [data-side=\"right\"])::before {\n      top: calc(var(--arrow-offset, 24px) - 1px);\n      width: var(--popover-gap, 8px);\n      height: 2px;\n    }\n    &:is([data-side=\"left\"], [data-side=\"right\"])::after {\n      top: calc(var(--arrow-offset, 24px) - 3px);\n    }\n    &[data-side=\"bottom\"]::before {\n      bottom: 100%;\n    }\n    &[data-side=\"bottom\"]::after {\n      top: -3px;\n    }\n    &[data-side=\"top\"]::before {\n      top: 100%;\n    }\n    &[data-side=\"top\"]::after {\n      bottom: -3px;\n    }\n    &[data-side=\"right\"]::before {\n      right: 100%;\n    }\n    &[data-side=\"right\"]::after {\n      left: -3px;\n    }\n    &[data-side=\"left\"]::before {\n      left: 100%;\n    }\n    &[data-side=\"left\"]::after {\n      right: -3px;\n    }\n\n    /* As a sheet, ui-sdk moves it up from the bottom edge itself: it takes\n       the screen's width, and has no key to be wired to. */\n    &[data-presentation=\"sheet\"] {\n      width: 100%;\n      max-height: 86dvh;\n      animation: none;\n\n      &::before,\n      &::after {\n        display: none;\n      }\n    }\n  }\n\n  /* The panel: a raised tab over the title, the close key in its corner.\n     The close key comes last in the page, so the grid puts it back in the\n     first row. */\n  [data-skin=\"cyber\"] [data-kit=\"popover-surface\"] {\n    --frame-cut: var(--cy-cut);\n    --frame-line: var(--cy-line-hot);\n    /* Opaque: it sits over whatever the page has under it. */\n    --frame-fill: var(--cy-panel);\n    /* Frame variables inherit, so a panel opened from inside a patterned\n       frame would be drawn with that frame's pattern. */\n    --frame-image: none;\n    --frame-notch: 5px;\n    --frame-notch-x: 72px;\n\n    flex: 1;\n    min-height: 0;\n    display: grid;\n    grid-template-columns: minmax(0, 1fr) auto;\n    align-items: start;\n    gap: 8px 10px;\n    padding: calc(var(--frame-notch) + 8px) 8px 8px 14px;\n    overflow-y: auto;\n    overscroll-behavior: contain;\n\n    & > :not([data-kit=\"popover-title\"], [data-kit=\"popover-close\"]) {\n      grid-column: 1 / -1;\n      margin-inline-end: 6px;\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"popover-title\"] {\n    align-self: center;\n    font-size: var(--cy-text-md);\n    font-weight: 600;\n    line-height: 1.25;\n    letter-spacing: var(--cy-track);\n    text-transform: uppercase;\n    color: var(--cy-ink);\n    text-wrap: balance;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"popover-close\"] {\n    grid-row: 1;\n    grid-column: 2;\n    display: flex;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"popover-description\"] {\n    font-size: var(--cy-text-sm);\n    line-height: 1.4;\n    color: var(--cy-ink-hi);\n    text-wrap: pretty;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"popover-body\"] {\n    display: grid;\n    gap: var(--cy-gap);\n    min-width: 0;\n    color: var(--cy-ink-hi);\n\n    /* A list of facts: the name of each on the left, what it reads on the\n       right, ruled between. */\n    & dl {\n      display: grid;\n      border-block-start: 1px solid var(--cy-line-deco);\n\n      & > div {\n        display: flex;\n        align-items: baseline;\n        justify-content: space-between;\n        gap: 12px;\n        padding-block: 5px;\n        border-block-end: 1px solid var(--cy-line-deco);\n      }\n      & dt {\n        font-size: var(--cy-text-xs);\n        font-weight: 600;\n        letter-spacing: var(--cy-track);\n        text-transform: uppercase;\n        color: var(--cy-ink);\n      }\n      & dd {\n        font-family: var(--cy-mono);\n        font-size: var(--cy-text-xs);\n        color: var(--cy-signal);\n        text-align: end;\n      }\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"popover-foot\"] {\n    padding-block: 2px 1px;\n    overflow: hidden;\n    text-overflow: ellipsis;\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/popover.css"
    }
  ],
  "type": "registry:ui"
}
