{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "corner-frame",
  "title": "Corner Frame",
  "description": "A box with bracket marks on its corners, in any size, thickness, colour and inset.",
  "dependencies": [
    "@radix-ui/react-slot"
  ],
  "registryDependencies": [
    "@corsair-ui/utils"
  ],
  "files": [
    {
      "path": "registry/default/ui/corner-frame.tsx",
      "content": "import { Slot, Slottable } from \"@radix-ui/react-slot\";\nimport type { ComponentProps, CSSProperties } from \"react\";\nimport { cn } from \"@/registry/default/lib/utils\";\n\ntype CornerFrameCorner = \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\";\n\nconst CORNERS: CornerFrameCorner[] = [\"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\"];\n\nconst LINE = \"var(--corner-frame-thickness)\";\nconst INSET = \"var(--corner-frame-inset)\";\n\n/** Where each bracket sits and which two edges it draws. */\nconst CORNER_STYLES: Record<CornerFrameCorner, CSSProperties> = {\n  \"top-left\": { top: INSET, left: INSET, borderTopWidth: LINE, borderLeftWidth: LINE },\n  \"top-right\": { top: INSET, right: INSET, borderTopWidth: LINE, borderRightWidth: LINE },\n  \"bottom-left\": { bottom: INSET, left: INSET, borderBottomWidth: LINE, borderLeftWidth: LINE },\n  \"bottom-right\": { bottom: INSET, right: INSET, borderBottomWidth: LINE, borderRightWidth: LINE },\n};\n\ninterface CornerFrameProps extends Omit<ComponentProps<\"div\">, \"color\"> {\n  /** Which corners get a bracket: \"all\", or a list of them. */\n  corners?: \"all\" | CornerFrameCorner[];\n  /** Length of each arm of a bracket. Any CSS length. */\n  size?: string;\n  /** Line width of the brackets. Any CSS length. */\n  thickness?: string;\n  /**\n   * Bracket colour: any CSS colour or theme variable. Sets\n   * `--corner-frame-color`; without it the brackets use that variable when an\n   * ancestor sets it, and `var(--primary)` otherwise.\n   */\n  color?: string;\n  /** How far the brackets sit inside the edges. Negative values move them outside. */\n  inset?: string;\n  /** Render the single child element as the frame instead of a `<div>`. */\n  asChild?: boolean;\n}\n\n/**\n * A box with bracket marks on its corners, like a viewfinder. The brackets\n * are decoration: they are hidden from screen readers and ignore the\n * pointer, so the content inside works as usual. It renders no motion and\n * needs no JavaScript.\n *\n * @example\n * <CornerFrame corners={[\"top-left\", \"bottom-right\"]} size=\"16px\" className=\"p-6\">\n *   <p>Framed content</p>\n * </CornerFrame>\n */\nfunction CornerFrame({\n  corners = \"all\",\n  size = \"12px\",\n  thickness = \"2px\",\n  color,\n  inset = \"0px\",\n  asChild = false,\n  className,\n  style,\n  children,\n  ...props\n}: CornerFrameProps) {\n  const Comp = asChild ? Slot : \"div\";\n  const shown = corners === \"all\" ? CORNERS : CORNERS.filter((corner) => corners.includes(corner));\n\n  return (\n    <Comp\n      data-slot=\"corner-frame\"\n      className={cn(\"relative\", className)}\n      style={\n        {\n          \"--corner-frame-size\": size,\n          \"--corner-frame-thickness\": thickness,\n          \"--corner-frame-inset\": inset,\n          ...(color ? { \"--corner-frame-color\": color } : null),\n          ...style,\n        } as CSSProperties\n      }\n      {...props}\n    >\n      <Slottable>{children}</Slottable>\n      {shown.map((corner) => (\n        <span\n          key={corner}\n          aria-hidden=\"true\"\n          data-slot=\"corner-frame-corner\"\n          data-corner={corner}\n          className=\"pointer-events-none absolute border-0 border-solid\"\n          style={{\n            width: \"var(--corner-frame-size)\",\n            height: \"var(--corner-frame-size)\",\n            borderColor: \"var(--corner-frame-color, var(--primary))\",\n            ...CORNER_STYLES[corner],\n          }}\n        />\n      ))}\n    </Comp>\n  );\n}\n\nexport { CornerFrame, type CornerFrameCorner, type CornerFrameProps };\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}