'use strict';
'use client';
import { jsx, jsxs } from 'react/jsx-runtime';
import { Dialog } from '@base-ui/react/dialog';
import { cva } from 'class-variance-authority';
import { cn } from '../../../fd-toolbox/lib/utils.js';
import { Icon, iconNames } from '../icon/Icon.js';
import { wellKnownPositions } from '../../../base-repo/constants/tools-constants.js';
import { Tooltip } from '../tooltip/Tooltip.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
const sheetVariants = cva("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 gap-4 border-none p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-300", {
  variants: {
    side: {
      top: "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 border-b",
      bottom: "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 border-t",
      left: "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r",
      right: "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l"
    }
  },
  defaultVariants: {
    side: wellKnownPositions.right
  }
});
const Sheet = Dialog.Root;
const SheetTrigger = Dialog.Trigger;
const SheetClose = Dialog.Close;
const SheetPortal = Dialog.Portal;
function SheetOverlay({
  className,
  ref
}) {
  return /* @__PURE__ */jsx(Dialog.Backdrop, {
    className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80", className),
    ref
  });
}
__name(SheetOverlay, "SheetOverlay");
SheetOverlay.displayName = Dialog.Backdrop.displayName;
function SheetContent({
  side,
  className,
  children,
  ref
}) {
  return /* @__PURE__ */jsxs(SheetPortal, {
    children: [/* @__PURE__ */jsx(SheetOverlay, {}), /* @__PURE__ */jsx(Dialog.Viewport, {
      children: /* @__PURE__ */jsx(Dialog.Popup, {
        ref,
        className: cn(sheetVariants({
          side
        }), className),
        children: /* @__PURE__ */jsxs("div", {
          className: "size-full focus:outline-none",
          tabIndex: 0,
          children: [/* @__PURE__ */jsxs(Dialog.Close, {
            hidden: side === wellKnownPositions.left,
            className: "bg-fd-tertiary-50 ring-offset-background focus:ring-primary data-[state=open]:bg-secondary absolute top-2 right-3 z-50 cursor-pointer rounded-md opacity-100 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none sm:bg-transparent sm:opacity-70",
            children: [/* @__PURE__ */jsx(Tooltip, {
              content: "Close",
              side: wellKnownPositions.left,
              children: /* @__PURE__ */jsx("div", {
                children: /* @__PURE__ */jsx(Icon, {
                  name: iconNames.cross
                })
              })
            }), /* @__PURE__ */jsx("span", {
              className: "sr-only",
              children: "Close"
            })]
          }), children]
        })
      })
    })]
  });
}
__name(SheetContent, "SheetContent");
SheetContent.displayName = Dialog.Popup.displayName;
function SheetHeader({
  className,
  children
}) {
  return /* @__PURE__ */jsx("div", {
    className: cn("flex flex-col space-y-2 text-center sm:text-left", className),
    children
  });
}
__name(SheetHeader, "SheetHeader");
SheetHeader.displayName = "SheetHeader";
function SheetFooter({
  className
}) {
  return /* @__PURE__ */jsx("div", {
    className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)
  });
}
__name(SheetFooter, "SheetFooter");
SheetFooter.displayName = "SheetFooter";
function SheetTitle({
  className,
  children,
  ref
}) {
  return /* @__PURE__ */jsx(Dialog.Title, {
    ref,
    className: cn("text-foreground text-lg font-semibold", className),
    children
  });
}
__name(SheetTitle, "SheetTitle");
SheetTitle.displayName = Dialog.Title.displayName;
function SheetDescription({
  className,
  ref
}) {
  return /* @__PURE__ */jsx(Dialog.Description, {
    ref,
    className: cn("text-muted-foreground text-sm", className)
  });
}
__name(SheetDescription, "SheetDescription");
SheetDescription.displayName = Dialog.Description.displayName;

export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, sheetVariants };
