{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "drawer",
  "type": "registry:ui",
  "dependencies": [
    "@corvu/drawer"
  ],
  "files": [
    {
      "path": "ui/drawer.tsx",
      "content": "import type { Component, ComponentProps, JSX, ValidComponent } from \"solid-js\"\nimport { splitProps } from \"solid-js\"\nimport type { Portal } from \"solid-js/web\"\n\nimport type {\n  ContentProps,\n  DescriptionProps,\n  DynamicProps,\n  LabelProps,\n  OverlayProps,\n  PortalProps,\n  RootProps,\n  TriggerProps\n} from \"@corvu/drawer\"\nimport DrawerPrimitive from \"@corvu/drawer\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst Drawer: Component<RootProps> = (props) => <DrawerPrimitive data-slot=\"drawer\" {...props} />\n\nconst DrawerTrigger = <T extends ValidComponent = \"button\">(\n  props: DynamicProps<T, TriggerProps<T>>\n) => <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />\n\nconst DrawerPortal: Component<PortalProps & ComponentProps<typeof Portal>> = (props) => (\n  <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />\n)\n\nconst DrawerClose = <T extends ValidComponent = \"button\">(\n  props: DynamicProps<T, TriggerProps<T>>\n) => <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />\n\ntype DrawerOverlayProps<T extends ValidComponent = \"div\"> = OverlayProps<T> & { class?: string }\n\nconst DrawerOverlay = <T extends ValidComponent = \"div\">(\n  props: DynamicProps<T, DrawerOverlayProps<T>>\n) => {\n  const [local, others] = splitProps(props as DrawerOverlayProps, [\"class\"])\n  const drawerContext = DrawerPrimitive.useContext()\n  return (\n    <DrawerPrimitive.Overlay\n      class={cn(\n        \"fixed inset-0 z-50 data-[transitioning]:transition-colors data-[transitioning]:duration-300\",\n        local.class\n      )}\n      data-slot=\"drawer-overlay\"\n      style={{\n        \"background-color\": `rgb(0 0 0 / ${0.8 * drawerContext.openPercentage()})`\n      }}\n      {...others}\n    />\n  )\n}\n\ntype DrawerContentProps<T extends ValidComponent = \"div\"> = ContentProps<T> & {\n  class?: string\n  children?: JSX.Element\n}\n\nconst DrawerContent = <T extends ValidComponent = \"div\">(\n  props: DynamicProps<T, DrawerContentProps<T>>\n) => {\n  const [local, others] = splitProps(props as DrawerContentProps, [\"class\", \"children\"])\n  return (\n    <DrawerPortal>\n      <DrawerOverlay />\n      <DrawerPrimitive.Content\n        class={cn(\n          \"group/drawer-content fixed z-50 flex h-auto flex-col bg-background before:absolute before:bg-inherit after:absolute after:bg-inherit data-[transitioning]:transition-transform data-[transitioning]:duration-300 md:select-none\",\n          \"data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:mb-24 data-[side=top]:max-h-[80vh] data-[side=top]:rounded-b-lg data-[side=top]:border-b data-[side=top]:before:inset-x-0 data-[side=top]:before:bottom-full data-[side=top]:before:h-1/2\",\n          \"data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:mt-24 data-[side=bottom]:max-h-[80vh] data-[side=bottom]:rounded-t-lg data-[side=bottom]:border-t data-[side=bottom]:after:inset-x-0 data-[side=bottom]:after:top-full data-[side=bottom]:after:h-1/2\",\n          \"data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:after:inset-y-0 data-[side=right]:after:left-full data-[side=right]:after:w-1/2 data-[side=right]:sm:max-w-sm\",\n          \"data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:before:inset-y-0 data-[side=left]:before:right-full data-[side=left]:before:w-1/2 data-[side=left]:sm:max-w-sm\",\n          local.class\n        )}\n        data-slot=\"drawer-content\"\n        {...others}\n      >\n        <div class=\"mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full bg-muted group-data-[side=bottom]/drawer-content:block\" />\n        {local.children}\n      </DrawerPrimitive.Content>\n    </DrawerPortal>\n  )\n}\n\nconst DrawerHeader: Component<ComponentProps<\"div\">> = (props) => {\n  const [, rest] = splitProps(props, [\"class\"])\n  return (\n    <div class={cn(\"flex flex-col gap-1.5 p-4\", props.class)} data-slot=\"drawer-header\" {...rest} />\n  )\n}\n\nconst DrawerFooter: Component<ComponentProps<\"div\">> = (props) => {\n  const [, rest] = splitProps(props, [\"class\"])\n  return (\n    <div\n      class={cn(\"mt-auto flex flex-col gap-2 p-4\", props.class)}\n      data-slot=\"drawer-footer\"\n      {...rest}\n    />\n  )\n}\n\ntype DrawerTitleProps<T extends ValidComponent = \"div\"> = LabelProps<T> & { class?: string }\n\nconst DrawerTitle = <T extends ValidComponent = \"div\">(\n  props: DynamicProps<T, DrawerTitleProps<T>>\n) => {\n  const [, rest] = splitProps(props as DrawerTitleProps, [\"class\"])\n  return (\n    <DrawerPrimitive.Label\n      class={cn(\"font-semibold text-foreground\", props.class)}\n      data-slot=\"drawer-title\"\n      {...rest}\n    />\n  )\n}\n\ntype DrawerDescriptionProps<T extends ValidComponent = \"div\"> = DescriptionProps<T> & {\n  class?: string\n}\n\nconst DrawerDescription = <T extends ValidComponent = \"div\">(\n  props: DynamicProps<T, DrawerDescriptionProps<T>>\n) => {\n  const [, rest] = splitProps(props as DrawerDescriptionProps, [\"class\"])\n  return (\n    <DrawerPrimitive.Description\n      class={cn(\"text-muted-foreground text-sm\", props.class)}\n      data-slot=\"drawer-description\"\n      {...rest}\n    />\n  )\n}\n\nexport {\n  Drawer,\n  DrawerPortal,\n  DrawerOverlay,\n  DrawerTrigger,\n  DrawerClose,\n  DrawerContent,\n  DrawerHeader,\n  DrawerFooter,\n  DrawerTitle,\n  DrawerDescription\n}\n",
      "type": "registry:ui"
    }
  ]
}