{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "reveal",
  "title": "Reveal",
  "description": "Crossfade from a skeleton to loaded content, driven by a data-reveal attribute.",
  "registryDependencies": [
    "@pestoui/style",
    "@pestoui/utils"
  ],
  "files": [
    {
      "path": "pestoui/ui/reveal.tsx",
      "content": "import { cn } from \"@/lib/utils\"\n\n/* The skeleton → content crossfade, as a component.\n\n   The mechanism is CSS: a container carrying `data-reveal=\"loading\" | \"ready\"`\n   and two children carrying `reveal-skeleton` / `reveal-content`, all three\n   declared in `styles/motion.css`. That is deliberately the whole contract, so\n   a component which already renders its own placeholders — `Table` with\n   `TableSkeletonRows`, `Sidebar` with `SidebarMenuSkeleton` — opts in by\n   setting one attribute and adding two class names. It does not have to adopt\n   a wrapper, and this wrapper is a convenience for the common case rather than\n   the mechanism itself.\n\n   What the wrapper buys over hand-writing those three class names:\n\n   - `inert` on the hidden layer. This is the part that is easy to get wrong.\n     Opacity does not stop hit-testing and does not remove anything from the\n     accessibility tree, so a naive crossfade leaves an invisible placeholder\n     catching clicks, or — worse — leaves the real content focusable and\n     screen-reader-visible underneath the skeleton for the whole load. Here the\n     hidden layer is unreachable in both directions: `inert` while loading (it\n     drops the subtree from the a11y tree and from the tab order), and\n     `pointer-events: none` from `reveal-skeleton` once ready.\n   - `aria-busy`, paired with `aria-hidden` on the placeholder, so the\n     placeholder is not read as a wall of empty boxes. `aria-busy` alone is not\n     enough: on a bare `div` the implicit role is generic, which NVDA and JAWS\n     do not expose a busy state for, so the load would otherwise finish in\n     silence.\n   - A separate visually-hidden live region that carries a short label once the\n     content lands. It is separate for three reasons, each of which broke a\n     first attempt that put `role=\"status\"` on the content layer itself:\n     the content layer is `inert` while loading, so it is not in the\n     accessibility tree and no live region is ever registered — and a region\n     that appears already populated does not announce, because announcement is\n     driven by mutations *after* registration; `role=\"status\"` implies\n     `aria-atomic=\"true\"`, so a revealed table would be read out entire; and the\n     role would persist, re-announcing the whole subtree on every later change\n     to a sorted column, a ticking number or a controlled input.\n\n   Both layers sit in the same grid cell, so they stack *and* stay in flow: the\n   box is as tall as the taller of the two. The real content is rendered from\n   the first frame — laid out, just not yet visible — which means the container\n   already has its finished height while the skeleton is up and nothing reflows\n   at the moment data lands. See the long note above `reveal-stack` in\n   `styles/motion.css` for why absolute positioning cannot do this.\n\n   The corollary: the skeleton stays mounted after the reveal, and a skeleton\n   *taller* than its content would hold the box open at that height. Size a\n   placeholder to the content it stands in for — which is what makes it stop\n   the layout jumping in the first place.\n\n   Reduced motion needs nothing here. `--reveal-blur` and `--reveal-rise` drop\n   to `0px` and `--duration-slower` to `1ms` under `prefers-reduced-motion`, so\n   the crossfade becomes an instant swap without this file knowing about it. */\n\ninterface RevealProps extends React.ComponentProps<\"div\"> {\n  /** While `true`, the placeholder is shown and the content is inert. */\n  loading: boolean\n  /** The placeholder. Rendered once, by the consumer — the reveal never tries\n   *  to derive a skeleton from the content, because the shape of a placeholder\n   *  is not the shape of the thing it replaces. */\n  skeleton: React.ReactNode\n  /** Announced politely, once, when the content arrives. Name the thing that\n   *  landed — \"Results loaded\" beats the default. */\n  loadedLabel?: string\n}\n\nfunction Reveal({\n  loading,\n  skeleton,\n  loadedLabel = \"Content loaded\",\n  className,\n  children,\n  ...props\n}: RevealProps) {\n  return (\n    <div\n      data-slot=\"reveal\"\n      data-reveal={loading ? \"loading\" : \"ready\"}\n      aria-busy={loading || undefined}\n      className={cn(\"reveal-stack\", className)}\n      {...props}\n    >\n      <div data-slot=\"reveal-skeleton\" aria-hidden=\"true\" className=\"reveal-skeleton\">\n        {skeleton}\n      </div>\n      <div data-slot=\"reveal-content\" inert={loading} className=\"reveal-content\">\n        {children}\n      </div>\n      {/* Outside the inert subtree, and empty until the content lands, so the\n          mutation that fills it is what triggers the announcement. */}\n      <span role=\"status\" className=\"sr-only\">\n        {loading ? \"\" : loadedLabel}\n      </span>\n    </div>\n  )\n}\n\nexport { Reveal }\nexport type { RevealProps }\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}