{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"sheet","title":"Sheet","author":"brijr","description":"A dialog that slides in from an edge, built on UI SDK.","dependencies":["@ui-sdk/react","@ui-sdk/core","cn","lucide-react"],"files":[{"path":"components/ui/sheet.tsx","content":"\"use client\"\n\nimport * as React from \"react\"\nimport {\n  Drawer,\n  DrawerBackdrop as DrawerBackdropPrimitive,\n  DrawerClose as SheetClose,\n  DrawerContent as DrawerContentPrimitive,\n  DrawerDescription as DrawerDescriptionPrimitive,\n  DrawerHandle as DrawerHandlePrimitive,\n  DrawerShortcut as DrawerShortcutPrimitive,\n  DrawerTitle as DrawerTitlePrimitive,\n  DrawerTrigger as SheetTrigger,\n} from \"@ui-sdk/react/drawer\"\nimport { renderElement, type PartProps } from \"@ui-sdk/react/primitive\"\nimport { XIcon } from \"lucide-react\"\nimport { cn } from \"cn\"\n\nfunction Sheet({\n  side = \"right\",\n  ...props\n}: React.ComponentProps<typeof Drawer>) {\n  return <Drawer side={side} {...props} />\n}\n\nfunction SheetOverlay({\n  className,\n  ...props\n}: Omit<React.ComponentProps<typeof DrawerBackdropPrimitive>, \"className\"> & {\n  className?: string\n}) {\n  return (\n    <DrawerBackdropPrimitive\n      className={cn(\"fixed inset-0 bg-black/50\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SheetContent({\n  className,\n  children,\n  showCloseButton = true,\n  closeLabel = \"Close\",\n  overlay = <SheetOverlay />,\n  ...props\n}: Omit<React.ComponentProps<typeof DrawerContentPrimitive>, \"className\"> & {\n  className?: string\n  showCloseButton?: boolean\n  /** The close button's accessible name. */\n  closeLabel?: string\n  /** The backdrop behind the sheet. Pass your own, or `null` for none. */\n  overlay?: React.ReactElement | null\n}) {\n  const closeButton = showCloseButton && (\n    <SheetClose className=\"absolute top-3.5 right-3.5 flex size-7 items-center justify-center rounded-md opacity-70 transition-opacity outline-none after:absolute after:-inset-2 hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none [&_svg:not([class*='size-'])]:size-4\">\n      <XIcon aria-hidden=\"true\" />\n      <span className=\"sr-only\">{closeLabel}</span>\n    </SheetClose>\n  )\n\n  return (\n    <>\n      {overlay}\n      <DrawerContentPrimitive\n        className={cn(\n          \"relative flex max-h-dvh flex-col gap-4 overflow-y-auto overscroll-contain bg-popover text-popover-foreground shadow-(--elevation-overlay) outline-none data-[side=left]:w-3/4 data-[side=right]:w-3/4 sm:data-[side=left]:max-w-sm sm:data-[side=right]:max-w-sm\",\n          className\n        )}\n        {...props}\n      >\n        {typeof children === \"function\" ? (\n          (state) => (\n            <>\n              {children(state)}\n              {closeButton}\n            </>\n          )\n        ) : (\n          <>\n            {children}\n            {closeButton}\n          </>\n        )}\n      </DrawerContentPrimitive>\n    </>\n  )\n}\n\nfunction SheetHandle({\n  className,\n  ...props\n}: Omit<React.ComponentProps<typeof DrawerHandlePrimitive>, \"className\"> & {\n  className?: string\n}) {\n  return (\n    <DrawerHandlePrimitive\n      className={cn(\n        \"relative mx-auto mt-4 h-1.5 w-12 shrink-0 rounded-full bg-foreground/15 outline-none after:absolute after:inset-x-0 after:-inset-y-5 focus-visible:ring-3 focus-visible:ring-ring/50\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction SheetHeader({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"div\">, \"className\"> & { className?: string }) {\n  return renderElement(\n    \"div\",\n    {\n      \"data-slot\": \"sheet-header\",\n      className: cn(\"flex flex-col gap-1.5 p-4 pr-12\", className),\n      ...props,\n    },\n    render\n  )\n}\n\nfunction SheetFooter({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"div\">, \"className\"> & { className?: string }) {\n  return renderElement(\n    \"div\",\n    {\n      \"data-slot\": \"sheet-footer\",\n      className: cn(\"mt-auto flex flex-col gap-2 p-4\", className),\n      ...props,\n    },\n    render\n  )\n}\n\nfunction SheetTitle({\n  className,\n  ...props\n}: Omit<React.ComponentProps<typeof DrawerTitlePrimitive>, \"className\"> & {\n  className?: string\n}) {\n  return (\n    <DrawerTitlePrimitive\n      className={cn(\"text-base font-medium text-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SheetDescription({\n  className,\n  ...props\n}: Omit<\n  React.ComponentProps<typeof DrawerDescriptionPrimitive>,\n  \"className\"\n> & {\n  className?: string\n}) {\n  return (\n    <DrawerDescriptionPrimitive\n      className={cn(\"text-sm text-muted-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction SheetShortcut({\n  className,\n  ...props\n}: Omit<React.ComponentProps<typeof DrawerShortcutPrimitive>, \"className\"> & {\n  className?: string\n}) {\n  return (\n    <DrawerShortcutPrimitive\n      className={cn(\n        \"text-xs tracking-widest text-muted-foreground in-[.bg-primary]:text-primary-foreground/70 in-[.text-destructive]:text-current\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Sheet,\n  SheetTrigger,\n  SheetClose,\n  SheetOverlay,\n  SheetContent,\n  SheetHandle,\n  SheetHeader,\n  SheetFooter,\n  SheetTitle,\n  SheetDescription,\n  SheetShortcut,\n}\n","type":"registry:ui"}],"type":"registry:ui"}