{
  "antiPatterns": [
    "Installing an Escape handler for every open layer.",
    "Incrementing z-index for each nested dialog."
  ],
  "api": {
    "importPath": "@ancrel/ui",
    "symbols": [
      "Portal",
      "FocusScope",
      "useDismiss",
      "LayerStack"
    ],
    "typeRef": "api/ui/index.d.ts"
  },
  "constraints": [
    "Put each nested layer inside a LayerStack and pass the content ref to useDismiss.",
    "Use a trigger ref when pointer activity on the opening control should be ignored."
  ],
  "docs": "raw/frontend/overlay.md",
  "examples": [
    {
      "code": "'use client'\n\nimport { useRef, useState } from 'react'\nimport { Button, FocusScope, LayerStack, Portal, useDismiss } from '@ancrel/ui'\nimport '@ancrel/tokens/css'\nimport '@ancrel/ui/styles.css'\nimport './App.css'\n\nfunction Preview({ close }: { close(): void }) {\n  const ref = useRef<HTMLDivElement>(null)\n  useDismiss({ open: true, layerRef: ref, onDismiss: close })\n  return <Portal><div className=\"ac-PreviewBackdrop\">\n    <div className=\"ac-PreviewPanel\" ref={ref} role=\"dialog\" aria-modal=\"true\" aria-label=\"Preview\">\n      <FocusScope>\n        <p>Page preview</p>\n        <Button onClick={close}>Close preview</Button>\n      </FocusScope>\n    </div>\n  </div></Portal>\n}\n\nexport default function App() {\n  const [open, setOpen] = useState(false)\n  return <section data-theme=\"light\" data-density=\"compact\">\n    <Button onClick={() => setOpen(true)}>Open preview</Button>\n    {open && <LayerStack><Preview close={() => setOpen(false)} /></LayerStack>}\n  </section>\n}\n",
      "command": "pnpm test",
      "entry": "examples/fe.overlay/App.tsx",
      "fixture": "examples/fe.overlay/",
      "id": "minimal"
    }
  ],
  "id": "fe.overlay",
  "kind": "library",
  "language": "typescript",
  "layer": "frontend",
  "owner": "frontend-infra",
  "package": {
    "ecosystem": "npm",
    "name": "@ancrel/ui",
    "version": "0.2.0"
  },
  "provenance": {
    "mode": "original",
    "origin": "Ancrel",
    "references": [
      {
        "commit": "4cc384c3bdbd09a3a50268adf81ba23f53aac93e",
        "note": "Lines 34–70 motivate a common layer and keyboard lifecycle.",
        "path": "frontend/src/components/common/RewindConfirmModal.tsx",
        "repo": "rule-studio"
      },
      {
        "commit": "4cc384c3bdbd09a3a50268adf81ba23f53aac93e",
        "note": "Lines 91–103 motivate treating the trigger and floating panel as inside a layer.",
        "path": "frontend/src/components/runtime/AgentChatHeaderControls.tsx",
        "repo": "rule-studio"
      }
    ]
  },
  "schemaVersion": 1,
  "stability": "experimental",
  "summary": "Compose portaled layers with scoped theme and density, top-layer dismissal, and keyboard focus management."
}
