{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sheet",
  "title": "sheet",
  "dependencies": [
    "@radix-ui/react-dialog",
    "class-variance-authority@^0.7"
  ],
  "registryDependencies": [
    "@dwellir/dwellir-theme",
    "@dwellir/utils",
    "@dwellir/portal-container",
    "@dwellir/touch-focus",
    "@dwellir/rune-icons",
    "@dwellir/modal-surface"
  ],
  "files": [
    {
      "path": "components/ui/sheet.tsx",
      "content": "'use client';\n\nimport * as SheetPrimitive from '@radix-ui/react-dialog';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport type { ComponentProps } from 'react';\nimport { RuneClose } from '@/components/brand/rune-icons';\nimport { useModalSurface } from '@/lib/modal-surface';\nimport { PortalContainer } from '@/lib/portal-container';\nimport { useScrollFocus } from '@/lib/scroll-focus';\nimport { focusContentOnTouch } from '@/lib/touch-focus';\nimport { cn } from '@/lib/utils';\n\nfunction Sheet(props: ComponentProps<typeof SheetPrimitive.Root>) {\n  return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />;\n}\n\nfunction SheetTrigger(props: ComponentProps<typeof SheetPrimitive.Trigger>) {\n  return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />;\n}\n\nfunction SheetClose(props: ComponentProps<typeof SheetPrimitive.Close>) {\n  return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />;\n}\n\nfunction SheetPortal(props: ComponentProps<typeof SheetPrimitive.Portal>) {\n  return <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />;\n}\n\nfunction SheetOverlay({ className, ...props }: ComponentProps<typeof SheetPrimitive.Overlay>) {\n  return (\n    <SheetPrimitive.Overlay\n      data-slot=\"sheet-overlay\"\n      className={cn(\n        'fixed inset-0 z-modal bg-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/*\n * A panel that floats one inset (12px) from the screen edge, with the page sheets' rounded corners.\n * Where a phone's status bar, notch or home indicator is deeper, it keeps clear of them.\n * The surface: grain on the website, plain (the popover fill, no texture) on app screens\n * (ModalSurfaceProvider sets an app's default, lib/modal-surface.tsx).\n * Keyframes open and close it. The durations set the keyframes only, so no\n * property transitions: a theme switch or a resize does not ease.\n * Without a SheetBody the panel scrolls; with one, only the body does.\n */\nconst sheetVariants = cva(\n  'group/sheet ui-popup-motion modal-host fixed z-modal flex flex-col gap-5 overflow-y-auto overscroll-contain scrollbar-quiet rounded-3xl border border-border p-7 text-popover-foreground shadow-popover ease-in-out outline-none data-[state=closed]:animate-out data-[state=closed]:animation-duration-300 data-[state=open]:animate-in data-[state=open]:animation-duration-500',\n  {\n    variants: {\n      side: {\n        right:\n          'top-modal-t right-modal-r bottom-modal-b w-modal max-w-md data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right',\n        left: 'top-modal-t bottom-modal-b left-modal-l w-modal max-w-md data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left',\n        top: 'top-modal-t right-modal-r left-modal-l max-h-modal data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',\n        bottom:\n          'right-modal-r bottom-modal-b left-modal-l max-h-modal data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',\n      },\n      surface: {\n        grain: 'bg-popover grain',\n        plain: 'bg-popover',\n      },\n    },\n    defaultVariants: { side: 'right', surface: 'grain' },\n  },\n);\n\nfunction SheetContent({\n  className,\n  children,\n  side,\n  surface,\n  showCloseButton = true,\n  onOpenAutoFocus,\n  ...props\n}: ComponentProps<typeof SheetPrimitive.Content> &\n  VariantProps<typeof sheetVariants> & { showCloseButton?: boolean }) {\n  const shown = useModalSurface(surface);\n  return (\n    <SheetPortal>\n      <SheetOverlay />\n      <SheetPrimitive.Content\n        data-slot=\"sheet-content\"\n        data-surface={shown}\n        data-closable={showCloseButton ? '' : undefined}\n        className={cn(sheetVariants({ side, surface: shown }), className)}\n        {...props}\n        onOpenAutoFocus={focusContentOnTouch(onOpenAutoFocus)}\n      >\n        {/* Radix hides the page behind the modal: popups opened inside go to the body. */}\n        <PortalContainer id={null}>{children}</PortalContainer>\n        {/* 32px to see; a touch gets 44px. */}\n        {showCloseButton ? (\n          <SheetPrimitive.Close\n            data-slot=\"sheet-close\"\n            className=\"absolute top-5 right-5 grid size-8 place-items-center rounded-full text-muted-foreground transition-colors outline-none hover:bg-muted hover:text-foreground focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none pointer-coarse:before:absolute pointer-coarse:before:-inset-1.5\"\n          >\n            <RuneClose className=\"size-4\" aria-hidden=\"true\" />\n            <span className=\"sr-only\">Close</span>\n          </SheetPrimitive.Close>\n        ) : null}\n      </SheetPrimitive.Content>\n    </SheetPortal>\n  );\n}\n\nfunction SheetHeader({ className, ...props }: ComponentProps<'div'>) {\n  return (\n    <div\n      data-slot=\"sheet-header\"\n      className={cn(\n        /* Room for the close button, when it shows. */\n        'flex flex-col gap-2 group-data-[closable]/sheet:pr-8',\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\n/* As DialogBody: it scrolls, and the header and the footer stay in view. */\nfunction SheetBody({ className, ref, ...props }: ComponentProps<'div'>) {\n  const scrollFocus = useScrollFocus(ref);\n  return (\n    <div\n      ref={scrollFocus}\n      data-slot=\"sheet-body\"\n      className={cn('modal-body -mx-7 -my-1 px-7 py-1', className)}\n      {...props}\n    />\n  );\n}\n\nfunction SheetFooter({ className, ...props }: ComponentProps<'div'>) {\n  return (\n    <div\n      data-slot=\"sheet-footer\"\n      className={cn('mt-auto flex flex-col gap-3', className)}\n      {...props}\n    />\n  );\n}\n\nfunction SheetTitle({ className, ...props }: ComponentProps<typeof SheetPrimitive.Title>) {\n  return (\n    <SheetPrimitive.Title\n      data-slot=\"sheet-title\"\n      className={cn(\n        'font-display text-2xl leading-tight font-bold tracking-tight text-title',\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nfunction SheetDescription({\n  className,\n  ...props\n}: ComponentProps<typeof SheetPrimitive.Description>) {\n  return (\n    <SheetPrimitive.Description\n      data-slot=\"sheet-description\"\n      className={cn('text-sm text-muted-foreground', className)}\n      {...props}\n    />\n  );\n}\n\nexport {\n  Sheet,\n  SheetBody,\n  SheetClose,\n  SheetContent,\n  SheetDescription,\n  SheetFooter,\n  SheetHeader,\n  SheetOverlay,\n  SheetPortal,\n  SheetTitle,\n  SheetTrigger,\n};\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}