'use client';

// src/components/Drawer/Drawer.tsx
import * as React from "react";
import { cn } from "@paalan/react-shared/lib";
import { Drawer as DrawerPrimitive } from "vaul";
import { jsx, jsxs } from "react/jsx-runtime";
var DrawerRoot = ({ shouldScaleBackground = true, ...props }) => /* @__PURE__ */ jsx(DrawerPrimitive.Root, { shouldScaleBackground, ...props });
DrawerRoot.displayName = "DrawerRoot";
var DrawerTrigger = DrawerPrimitive.Trigger;
var DrawerPortal = DrawerPrimitive.Portal;
var DrawerClose = DrawerPrimitive.Close;
var DrawerOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DrawerPrimitive.Overlay, { ref, className: cn("fixed inset-0 z-50 bg-black/80", className), ...props }));
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
var DrawerContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DrawerPortal, { children: [
  /* @__PURE__ */ jsx(DrawerOverlay, {}),
  /* @__PURE__ */ jsxs(
    DrawerPrimitive.Content,
    {
      ref,
      className: cn(
        "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
        className
      ),
      ...props,
      children: [
        /* @__PURE__ */ jsx("div", { className: "mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" }),
        children
      ]
    }
  )
] }));
DrawerContent.displayName = "DrawerContent";
var DrawerHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("grid gap-1.5 p-4 text-center sm:text-left", className), ...props });
DrawerHeader.displayName = "DrawerHeader";
var DrawerFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: cn("mt-auto flex flex-col gap-2 p-4", className), ...props });
DrawerFooter.displayName = "DrawerFooter";
var DrawerTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
  DrawerPrimitive.Title,
  {
    ref,
    className: cn("text-lg font-semibold leading-none tracking-tight", className),
    ...props
  }
));
DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
var DrawerDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DrawerPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
var Drawer = ({
  trigger,
  triggerClassName,
  contentClassName,
  content,
  header,
  footer,
  children,
  drawerCloseButton,
  drawerCloseButtonClassName,
  ...props
}) => {
  const drawerContent = content || children;
  return /* @__PURE__ */ jsxs(DrawerRoot, { ...props, children: [
    trigger && /* @__PURE__ */ jsx(DrawerTrigger, { asChild: true, className: triggerClassName, children: trigger }),
    drawerContent && /* @__PURE__ */ jsxs(DrawerContent, { className: contentClassName, children: [
      header && /* @__PURE__ */ jsxs(DrawerHeader, { className: header.className, children: [
        header.title && /* @__PURE__ */ jsx(DrawerTitle, { children: header.title }),
        header.description && /* @__PURE__ */ jsx(DrawerDescription, { children: header.description })
      ] }),
      drawerContent,
      footer && /* @__PURE__ */ jsx(DrawerFooter, { className: footer.className, children: footer.content }),
      drawerCloseButton && /* @__PURE__ */ jsx(DrawerFooter, { className: cn("pt-2", drawerCloseButtonClassName), children: /* @__PURE__ */ jsx(DrawerClose, { asChild: true, children: drawerCloseButton }) })
    ] })
  ] });
};
Drawer.displayName = "Drawer";
export {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerOverlay,
  DrawerPortal,
  DrawerRoot,
  DrawerTitle,
  DrawerTrigger
};
