{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "drawer",
  "type": "registry:ui",
  "title": "Drawer",
  "dependencies": [
    "@base-ui-next/react"
  ],
  "registryDependencies": [
    "https://hamur.dev/r/react/utils.json"
  ],
  "files": [
    {
      "path": "react/drawer.tsx",
      "content": "'use client'\n\nimport * as React from 'react' // base-ui-next/ui drawer@0.1.1\nimport { Drawer as DrawerPrimitive } from '@base-ui-next/react/drawer'\nimport { cn } from '@/lib/utils'\n\nconst drawerOverlayClassName =\n  'fixed inset-0 z-50 min-h-dvh bg-black/10 opacity-[max(var(--drawer-overlay-min-opacity,0),calc(1-var(--drawer-swipe-progress)))] transition-opacity duration-450 ease-[cubic-bezier(0.32,0.72,0,1)] select-none data-ending-style:pointer-events-none data-ending-style:opacity-0 data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-snap-points:[--drawer-overlay-min-opacity:0.5] data-starting-style:opacity-0 data-swiping:duration-0 supports-backdrop-filter:backdrop-blur-xs supports-[-webkit-touch-callout:none]:absolute'\n\nconst drawerSwipeHandleClassName =\n  'relative z-10 flex shrink-0 cursor-grab transition-opacity duration-200 group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-[swipe-axis=x]/drawer-popup:h-full group-data-[swipe-axis=x]/drawer-popup:w-3 group-data-[swipe-axis=x]/drawer-popup:items-center group-data-[swipe-axis=y]/drawer-popup:h-3 group-data-[swipe-axis=y]/drawer-popup:w-full group-data-[swipe-axis=y]/drawer-popup:justify-center group-data-[swipe-direction=down]/drawer-popup:items-end group-data-[swipe-direction=left]/drawer-popup:order-last group-data-[swipe-direction=left]/drawer-popup:justify-start group-data-[swipe-direction=right]/drawer-popup:justify-end group-data-[swipe-direction=up]/drawer-popup:order-last group-data-[swipe-direction=up]/drawer-popup:items-start after:block after:shrink-0 after:rounded-full after:bg-muted group-data-[swipe-axis=x]/drawer-popup:after:h-[100px] group-data-[swipe-axis=x]/drawer-popup:after:w-1.5 group-data-[swipe-axis=y]/drawer-popup:after:h-1.5 group-data-[swipe-axis=y]/drawer-popup:after:w-[100px] active:cursor-grabbing'\n\nconst drawerViewportClassName =\n  'pointer-events-none fixed inset-0 z-50 select-none data-[modal=true]:pointer-events-auto'\n\n/** The popup (`DrawerContent`'s `className` goes here, as in base-vega). */\nconst drawerPopupClassName =\n  'group/drawer-popup pointer-events-auto fixed z-50 m-(--drawer-inset,0px) flex h-(--drawer-content-height) max-h-(--drawer-content-max-height,none) min-h-0 w-(--drawer-content-width,auto) transform-[translate3d(var(--translate-x,0px),var(--translate-y,0px),0)_scale(var(--stack-scale))] flex-col bg-popover text-sm text-popover-foreground transition-[transform,height,opacity,filter] duration-450 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-transform outline-none select-none [interpolate-size:allow-keywords] data-[swipe-direction=down]:rounded-t-xl data-[swipe-direction=down]:border-t data-[swipe-direction=left]:rounded-r-xl data-[swipe-direction=left]:border-r data-[swipe-direction=right]:rounded-l-xl data-[swipe-direction=right]:border-l data-[swipe-direction=up]:rounded-b-xl data-[swipe-direction=up]:border-b data-nested-drawer-open:overflow-hidden data-nested-drawer-open:brightness-95 after:pointer-events-none after:absolute after:bg-(--drawer-bleed-background,var(--color-popover)) data-[swipe-axis=x]:after:inset-y-0 data-[swipe-axis=x]:after:w-(--bleed) data-[swipe-axis=y]:after:inset-x-0 data-[swipe-axis=y]:after:h-(--bleed) data-[swipe-direction=down]:after:top-full data-[swipe-direction=left]:after:right-full data-[swipe-direction=right]:after:left-full data-[swipe-direction=up]:after:bottom-full [--drawer-content-height:var(--drawer-height,auto)] data-[swipe-axis=x]:[--drawer-content-width:75%] data-[swipe-axis=y]:[--drawer-content-max-height:calc(100dvh-6rem)] data-[swipe-axis=y]:data-snap-points:[--drawer-content-height:100dvh] data-[swipe-axis=x]:sm:[--drawer-content-width:24rem] [--bleed:3rem] [--peek:1rem] [--stack-height:var(--drawer-frontmost-height,var(--drawer-height,0px))] [--stack-peek-offset:max(0px,calc((var(--nested-drawers)-var(--stack-progress))*var(--peek)))] [--stack-progress:clamp(0,var(--drawer-swipe-progress),1)] [--stack-scale-base:max(0,calc(1-(var(--nested-drawers)*var(--stack-step))))] [--stack-scale:clamp(0,calc(var(--stack-scale-base)+(var(--stack-step)*var(--stack-progress))),1)] [--stack-shrink:calc(1-var(--stack-scale))] [--stack-step:0.05] data-ending-style:transform-(--closed-transform) data-ending-style:opacity-[0.9999] data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-nested-drawer-swiping:duration-0 data-ending-style:data-nested-drawer-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-starting-style:transform-(--closed-transform) data-swiping:duration-0 data-ending-style:data-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-[swipe-axis=y]:inset-x-0 data-[swipe-axis=y]:data-nested-drawer-open:h-(--stack-height) data-[swipe-axis=x]:inset-y-0 data-[swipe-axis=x]:flex-row data-[swipe-direction=down]:bottom-0 data-[swipe-direction=down]:origin-bottom data-[swipe-direction=down]:[--closed-transform:translate3d(0,calc(100%+var(--drawer-inset,0px)+2px),0)] data-[swipe-direction=down]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height)))] data-[swipe-direction=up]:top-0 data-[swipe-direction=up]:origin-top data-[swipe-direction=up]:[--closed-transform:translate3d(0,calc(-100%-var(--drawer-inset,0px)-2px),0)] data-[swipe-direction=up]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height)))] data-[swipe-direction=left]:left-0 data-[swipe-direction=left]:origin-left data-[swipe-direction=left]:[--closed-transform:translate3d(calc(-100%-var(--drawer-inset,0px)-2px),0,0)] data-[swipe-direction=left]:[--translate-x:calc(var(--drawer-swipe-movement-x)+var(--stack-peek-offset)+(var(--stack-shrink)*100%))] data-[swipe-direction=right]:right-0 data-[swipe-direction=right]:origin-right data-[swipe-direction=right]:[--closed-transform:translate3d(calc(100%+var(--drawer-inset,0px)+2px),0,0)] data-[swipe-direction=right]:[--translate-x:calc(var(--drawer-swipe-movement-x)-var(--stack-peek-offset)-(var(--stack-shrink)*100%))]'\n\n/** The Base UI content inside the popup, which holds `DrawerContent`'s children. */\nconst drawerContentClassName =\n  'flex min-h-0 flex-1 flex-col overflow-hidden overscroll-contain rounded-[inherit] transition-opacity duration-300 ease-[cubic-bezier(0.45,1.005,0,1.005)] select-text group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-swiping/drawer-popup:select-none'\n\nconst drawerHeaderClassName =\n  'flex shrink-0 flex-col gap-0.5 p-4 pb-0 group-data-[swipe-axis=y]/drawer-popup:text-center md:gap-1.5 md:text-left'\n\nconst drawerFooterClassName = 'mt-auto flex shrink-0 flex-col gap-2 p-4 pt-0'\n\nconst drawerTitleClassName = 'font-medium text-foreground'\n\nconst drawerDescriptionClassName = 'text-sm text-balance text-muted-foreground'\n\ntype DrawerContextProps = {\n  hasSnapPoints: boolean\n  modal: DrawerPrimitive.Root.Props['modal']\n  showSwipeHandle: boolean\n  swipeDirection: NonNullable<DrawerPrimitive.Root.Props['swipeDirection']>\n}\n\n// The root's props that `DrawerContent` writes as base-vega's attributes (as in shadcn); the\n// context holds props only, no state. Outside a `Drawer` it gives the root's defaults.\nconst DrawerContext = React.createContext<DrawerContextProps>({\n  hasSnapPoints: false,\n  modal: true,\n  showSwipeHandle: false,\n  swipeDirection: 'down',\n})\n\nfunction Drawer({\n  modal = true,\n  showSwipeHandle = false,\n  snapPoints,\n  swipeDirection = 'down',\n  ...props\n}: DrawerPrimitive.Root.Props & {\n  showSwipeHandle?: boolean\n}) {\n  const hasSnapPoints = snapPoints != null && snapPoints.length > 0\n\n  return (\n    <DrawerContext.Provider value={{ hasSnapPoints, modal, showSwipeHandle, swipeDirection }}>\n      <DrawerPrimitive.Root\n        data-slot=\"drawer\"\n        modal={modal}\n        snapPoints={snapPoints}\n        swipeDirection={swipeDirection}\n        {...props}\n      />\n    </DrawerContext.Provider>\n  )\n}\n\nfunction DrawerTrigger({ ...props }: DrawerPrimitive.Trigger.Props) {\n  return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />\n}\n\nfunction DrawerPortal({ ...props }: DrawerPrimitive.Portal.Props) {\n  return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />\n}\n\nfunction DrawerClose({ ...props }: DrawerPrimitive.Close.Props) {\n  return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />\n}\n\nfunction DrawerOverlay({ className, ...props }: DrawerPrimitive.Backdrop.Props) {\n  return (\n    <DrawerPrimitive.Backdrop\n      data-slot=\"drawer-overlay\"\n      className={cn(drawerOverlayClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction DrawerSwipeHandle({ className, ...props }: React.ComponentProps<'div'>) {\n  return (\n    <div\n      data-slot=\"drawer-swipe-handle\"\n      aria-hidden=\"true\"\n      className={cn(drawerSwipeHandleClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction DrawerContent({ className, children, ...props }: DrawerPrimitive.Popup.Props) {\n  const { hasSnapPoints, modal, showSwipeHandle, swipeDirection } = React.useContext(DrawerContext)\n  const swipeAxis = swipeDirection === 'down' || swipeDirection === 'up' ? 'y' : 'x'\n\n  return (\n    <DrawerPortal>\n      {modal === true && <DrawerOverlay data-snap-points={hasSnapPoints ? '' : undefined} />}\n      <DrawerPrimitive.Viewport\n        data-slot=\"drawer-viewport\"\n        data-modal={modal}\n        className={drawerViewportClassName}\n      >\n        <DrawerPrimitive.Popup\n          data-slot=\"drawer-popup\"\n          data-swipe-axis={swipeAxis}\n          data-snap-points={hasSnapPoints ? '' : undefined}\n          className={cn(drawerPopupClassName, className)}\n          {...props}\n        >\n          {showSwipeHandle && <DrawerSwipeHandle />}\n          <DrawerPrimitive.Content data-slot=\"drawer-content\" className={drawerContentClassName}>\n            {children}\n          </DrawerPrimitive.Content>\n        </DrawerPrimitive.Popup>\n      </DrawerPrimitive.Viewport>\n    </DrawerPortal>\n  )\n}\n\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {\n  return (\n    <div data-slot=\"drawer-header\" className={cn(drawerHeaderClassName, className)} {...props} />\n  )\n}\n\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {\n  return (\n    <div data-slot=\"drawer-footer\" className={cn(drawerFooterClassName, className)} {...props} />\n  )\n}\n\nfunction DrawerTitle({ className, ...props }: DrawerPrimitive.Title.Props) {\n  return (\n    <DrawerPrimitive.Title\n      data-slot=\"drawer-title\"\n      className={cn(drawerTitleClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction DrawerDescription({ className, ...props }: DrawerPrimitive.Description.Props) {\n  return (\n    <DrawerPrimitive.Description\n      data-slot=\"drawer-description\"\n      className={cn(drawerDescriptionClassName, className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Drawer,\n  DrawerPortal,\n  DrawerOverlay,\n  DrawerSwipeHandle,\n  DrawerTrigger,\n  DrawerClose,\n  DrawerContent,\n  DrawerHeader,\n  DrawerFooter,\n  DrawerTitle,\n  DrawerDescription,\n}\n",
      "type": "registry:ui",
      "target": "@ui/drawer.tsx"
    }
  ],
  "meta": {
    "baseUiNext": {
      "version": "0.1.1",
      "hash": "ade61d03dc898d1fbb3eb117b6b32c22e3ebe3e2b8a212010b1a69509d076cd9",
      "files": {
        "@ui/drawer.tsx": "14a09a3aeb6bc1a75ad5c0ab808550a8c06f239992b4f322deaa527d1385566d"
      }
    }
  }
}
