'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var utils = require('./utils-BhM0B89p.js');
var primitives_Sheet = require('./primitives/Sheet.js');

const SIZE_CLASS_MAP = {
  small: "data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
  large: "data-[side=left]:sm:max-w-lg data-[side=right]:sm:max-w-lg",
  extraLarge: "data-[side=left]:sm:max-w-2xl data-[side=right]:sm:max-w-2xl"
};

const SheetHeader = React.forwardRef(
  ({ children, className, ...otherProps }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
    primitives_Sheet.SheetHeader,
    {
      ref,
      className: utils.cn(className),
      "data-testid": "sheet-header",
      ...otherProps,
      children
    }
  )
);
SheetHeader.displayName = "Sheet.Header";
const SheetBody = React.forwardRef(({ children, className, hasFooter = true, ...otherProps }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
  "div",
  {
    ref,
    "data-slot": "sheet-body",
    "data-testid": "sheet-body",
    className: utils.cn(
      "flex flex-1 flex-col items-start justify-start overflow-y-auto px-6",
      hasFooter && "pb-0",
      className
    ),
    ...otherProps,
    children
  }
));
SheetBody.displayName = "Sheet.Body";
const SheetFooter = React.forwardRef(
  ({ children, className, ...otherProps }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
    primitives_Sheet.SheetFooter,
    {
      ref,
      className: utils.cn(
        "flex flex-row items-center justify-start gap-2",
        className
      ),
      "data-testid": "sheet-footer",
      ...otherProps,
      children
    }
  )
);
SheetFooter.displayName = "Sheet.Footer";
const SheetTitle = React.forwardRef(({ children, className, ...otherProps }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
  primitives_Sheet.SheetTitle,
  {
    ref,
    className: utils.cn("text-2xl font-semibold", className),
    ...otherProps,
    children
  }
));
SheetTitle.displayName = "Sheet.Title";
const SheetDescription = React.forwardRef(({ children, className, ...otherProps }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
  primitives_Sheet.SheetDescription,
  {
    ref,
    className: utils.cn(className),
    ...otherProps,
    children
  }
));
SheetDescription.displayName = "Sheet.Description";
const Sheet = React.forwardRef(
  ({
    size = "small",
    isOpen = false,
    onClose = () => {
    },
    children,
    className,
    closeOnEsc = true,
    closeButton = true,
    backdropClassName,
    closeOnOutsideClick = true,
    initialFocusRef,
    finalFocusRef,
    side = "right",
    modal,
    defaultOpen,
    // Radix content handlers — intercept and merge
    onOpenAutoFocus: onOpenAutoFocusProp,
    onCloseAutoFocus: onCloseAutoFocusProp,
    ...otherProps
  }, ref) => {
    const handleOpenChange = (open) => {
      if (!open) onClose();
    };
    const handleInteractOutside = (e) => {
      if (!closeOnOutsideClick) e.preventDefault();
    };
    const handleEscapeKeyDown = (e) => {
      if (!closeOnEsc) e.preventDefault();
    };
    const handleOpenAutoFocus = (e) => {
      if (initialFocusRef) {
        e.preventDefault();
        if (initialFocusRef.current) {
          initialFocusRef.current.focus();
        } else {
          requestAnimationFrame(() => initialFocusRef.current?.focus());
        }
      }
      onOpenAutoFocusProp?.(e);
    };
    const handleCloseAutoFocus = (e) => {
      if (finalFocusRef?.current) {
        e.preventDefault();
        finalFocusRef.current.focus();
      }
      onCloseAutoFocusProp?.(e);
    };
    return /* @__PURE__ */ jsxRuntime.jsx(
      primitives_Sheet.Sheet,
      {
        open: isOpen,
        onOpenChange: handleOpenChange,
        modal,
        defaultOpen,
        children: /* @__PURE__ */ jsxRuntime.jsx(
          primitives_Sheet.SheetContent,
          {
            ref,
            side,
            showCloseButton: closeButton,
            overlayClassName: backdropClassName,
            onInteractOutside: handleInteractOutside,
            onEscapeKeyDown: handleEscapeKeyDown,
            onOpenAutoFocus: handleOpenAutoFocus,
            onCloseAutoFocus: handleCloseAutoFocus,
            className: utils.cn(SIZE_CLASS_MAP[size], className),
            "data-testid": "sheet-wrapper",
            ...otherProps,
            children
          }
        )
      }
    );
  }
);
Sheet.displayName = "Sheet";
Sheet.Header = SheetHeader;
Sheet.Body = SheetBody;
Sheet.Footer = SheetFooter;
Sheet.Title = SheetTitle;
Sheet.Description = SheetDescription;

exports.Sheet = Sheet;
//# sourceMappingURL=Sheet-By1W1pFD.js.map
