{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "drawer",
  "title": "Drawer",
  "author": "AniBT <https://anibt.net>",
  "description": "AniBT phone drawer on vaul: draggable floating paper with a grab handle, a stitched header, one scrolling DrawerBody and a footer clear of the home indicator.",
  "dependencies": [
    "vaul"
  ],
  "registryDependencies": [
    "@anibt/theme"
  ],
  "files": [
    {
      "path": "registry/anibt/ui/drawer.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Drawer as DrawerPrimitive } from \"vaul\"\n\nimport { cn } from \"@/lib/utils\"\n\n/**\n * Drawer — AniBT 「贴纸手账」: the phone's container for \"one record\", dragged\n * up from the bottom edge (vaul).\n *\n * The same floating paper and scrim as Dialog, rounded only on the corners\n * away from its edge. A bottom drawer carries a grab handle and clears the\n * home-indicator inset, so its footer stays tappable. `DrawerHeader` is\n * parted from the content by the dashed stitch, `DrawerBody` is the one\n * region that scrolls, and `DrawerFooter` stacks full-width buttons.\n *\n * Export names and props are shadcn's, so this file can replace\n * `components/ui/drawer.tsx`.\n */\n\ntype RenderCompat = {\n  /** Base UI's `asChild`: render this element instead, with the part's props. */\n  render?: React.ReactElement\n  /** Base UI compatibility; ignored (Radix decides from the rendered element). */\n  nativeButton?: boolean\n}\n\n/** Maps Base UI's `render` onto Radix's `asChild`. */\nfunction renderAsChild<P extends { asChild?: boolean; children?: React.ReactNode }>({\n  render,\n  nativeButton: _nativeButton,\n  ...props\n}: P & RenderCompat): P {\n  void _nativeButton\n  if (!render) return props as P\n  const children = props.children === undefined ? render : React.cloneElement(render, undefined, props.children)\n  return { ...props, asChild: true, children } as P\n}\n\nfunction Drawer({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>) {\n  return <DrawerPrimitive.Root data-slot=\"drawer\" {...props} />\n}\n\nfunction DrawerTrigger(props: React.ComponentProps<typeof DrawerPrimitive.Trigger> & RenderCompat) {\n  return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...renderAsChild(props)} />\n}\n\nfunction DrawerPortal({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {\n  return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />\n}\n\nfunction DrawerClose(props: React.ComponentProps<typeof DrawerPrimitive.Close> & RenderCompat) {\n  return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...renderAsChild(props)} />\n}\n\nfunction DrawerOverlay({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n  return (\n    <DrawerPrimitive.Overlay\n      data-slot=\"drawer-overlay\"\n      className={cn(\n        \"fixed inset-0 z-50 bg-anibt-scrim data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\n/** The grab handle on a bottom drawer: a 36×4 pill in the control-edge ink. */\nfunction DrawerSwipeHandle({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"drawer-swipe-handle\"\n      aria-hidden=\"true\"\n      className={cn(\"mx-auto mt-2.5 mb-0.5 h-1 w-9 shrink-0 rounded-full bg-input\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction DrawerContent({ className, children, ...props }: React.ComponentProps<typeof DrawerPrimitive.Content>) {\n  return (\n    <DrawerPortal data-slot=\"drawer-portal\">\n      <DrawerOverlay />\n      <DrawerPrimitive.Content\n        data-slot=\"drawer-content\"\n        className={cn(\n          \"group/drawer-content anibt-pop fixed z-50 flex h-auto flex-col overscroll-contain text-[14px] outline-none\",\n          \"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[82dvh] data-[vaul-drawer-direction=top]:rounded-t-none\",\n          \"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[82dvh] data-[vaul-drawer-direction=bottom]:rounded-b-none data-[vaul-drawer-direction=bottom]:pb-[env(safe-area-inset-bottom,0px)]\",\n          \"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-r-none data-[vaul-drawer-direction=right]:sm:max-w-sm\",\n          \"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-l-none data-[vaul-drawer-direction=left]:sm:max-w-sm\",\n          className\n        )}\n        {...props}\n      >\n        <DrawerSwipeHandle className=\"hidden group-data-[vaul-drawer-direction=bottom]/drawer-content:block\" />\n        {children}\n      </DrawerPrimitive.Content>\n    </DrawerPortal>\n  )\n}\n\n/** Title and description over the stitch; centred on a bottom or top drawer. */\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"drawer-header\"\n      className={cn(\n        \"anibt-stitch-under flex shrink-0 flex-col gap-1 px-4 pt-3 pb-3 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:text-left md:group-data-[vaul-drawer-direction=bottom]/drawer-content:text-left\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\n/** The one scrolling region of a drawer; the footer stays reachable. */\nfunction DrawerBody({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"drawer-body\"\n      className={cn(\"min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-3\", className)}\n      {...props}\n    />\n  )\n}\n\n/** Full-width buttons, stacked, the action first. */\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"drawer-footer\"\n      className={cn(\"mt-auto flex shrink-0 flex-col gap-2 p-4 pt-2\", className)}\n      {...props}\n    />\n  )\n}\n\n/** 16/800 ink. */\nfunction DrawerTitle({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Title>) {\n  return (\n    <DrawerPrimitive.Title\n      data-slot=\"drawer-title\"\n      className={cn(\"text-[16px] leading-snug font-extrabold text-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\n/** 12, muted. */\nfunction DrawerDescription({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Description>) {\n  return (\n    <DrawerPrimitive.Description\n      data-slot=\"drawer-description\"\n      className={cn(\"text-[12px] leading-normal text-muted-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Drawer,\n  DrawerPortal,\n  DrawerOverlay,\n  DrawerSwipeHandle,\n  DrawerTrigger,\n  DrawerClose,\n  DrawerContent,\n  DrawerBody,\n  DrawerHeader,\n  DrawerFooter,\n  DrawerTitle,\n  DrawerDescription,\n}\n",
      "type": "registry:ui"
    }
  ],
  "categories": [
    "overlay"
  ],
  "type": "registry:ui"
}