"use client";
import { cn } from "./index3.js";
import { Button } from "./index6.js";
import { useControllableState } from "./index11.js";
import { cva } from "class-variance-authority";
import { X } from "lucide-react";
import * as React from "react";
import { jsx, jsxs } from "react/jsx-runtime";
import { Dialog } from "@base-ui/react/dialog";
//#region src/components/organisms/overlays/Sheet/Sheet.tsx
var closeButtonVariants = cva("", {
	variants: { size: {
		sm: "",
		md: "",
		lg: ""
	} },
	defaultVariants: { size: "sm" }
});
var buttonSizeMap = {
	sm: "icon-sm",
	md: "icon",
	lg: "icon-lg"
};
var CloseButton = React.forwardRef(({ className, size = "sm", "aria-label": ariaLabel = "Close", ...props }, ref) => {
	return /* @__PURE__ */ jsxs(Button, {
		ref,
		"data-slot": "close-button",
		appearance: "ghost",
		variant: "secondary",
		size: buttonSizeMap[size ?? "sm"],
		className: cn(closeButtonVariants({ size }), className),
		"aria-label": ariaLabel,
		...props,
		children: [/* @__PURE__ */ jsx(X, {}), /* @__PURE__ */ jsx("span", {
			className: "sr-only",
			children: ariaLabel
		})]
	});
});
CloseButton.displayName = "CloseButton";
var Root = React.forwardRef(function Root({ ...props }, _ref) {
	return /* @__PURE__ */ jsx(Dialog.Root, {
		"data-slot": "sheet",
		...props
	});
});
Root.displayName = "Sheet.Root";
var Trigger = React.forwardRef(function Trigger({ ...props }, ref) {
	return /* @__PURE__ */ jsx(Dialog.Trigger, {
		ref,
		"data-slot": "sheet-trigger",
		...props
	});
});
Trigger.displayName = "Sheet.Trigger";
var Close = React.forwardRef(function Close({ ...props }, ref) {
	return /* @__PURE__ */ jsx(Dialog.Close, {
		ref,
		"data-slot": "sheet-close",
		...props
	});
});
Close.displayName = "Sheet.Close";
function Portal({ ...props }) {
	return /* @__PURE__ */ jsx(Dialog.Portal, {
		"data-slot": "sheet-portal",
		...props
	});
}
Portal.displayName = "Sheet.Portal";
var Backdrop = React.forwardRef(function Backdrop({ className, disableAnimation, disableBackdropBlur, ...props }, ref) {
	return /* @__PURE__ */ jsx(Dialog.Backdrop, {
		ref,
		"data-slot": "sheet-backdrop",
		className: cn("bg-background/80/10 fixed inset-0 z-50", !disableAnimation && "data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 duration-100 data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:animate-none", !disableBackdropBlur && "supports-backdrop-filter:backdrop-blur-xs", className),
		...props
	});
});
Backdrop.displayName = "Sheet.Backdrop";
var Viewport = React.forwardRef(function Viewport({ className, children, ...props }, ref) {
	return /* @__PURE__ */ jsx(Dialog.Viewport, {
		ref,
		"data-slot": "sheet-viewport",
		className: cn("fixed inset-0 z-50", className),
		...props,
		children
	});
});
Viewport.displayName = "Sheet.Viewport";
function PopupBase({ className, children, side = "right", showCloseButton = true, disableAnimation, disableBackdropBlur, ...props }) {
	return /* @__PURE__ */ jsxs(Portal, { children: [/* @__PURE__ */ jsx(Backdrop, {
		disableAnimation,
		disableBackdropBlur
	}), /* @__PURE__ */ jsxs(Dialog.Popup, {
		"data-slot": "sheet-popup",
		"data-side": side,
		className: cn("bg-background fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm", !disableAnimation && "data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-full data-[side=right]:data-open:slide-in-from-right-full data-[side=left]:data-closed:slide-out-to-left-full data-[side=left]:data-open:slide-in-from-left-full data-[side=top]:data-closed:slide-out-to-top-full data-[side=top]:data-open:slide-in-from-top-full data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-full data-[side=bottom]:data-open:slide-in-from-bottom-full data-open:duration-300 data-closed:duration-200 data-open:ease-(--ease-decelerate) data-closed:ease-in motion-reduce:animate-none", className),
		...props,
		children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog.Close, { render: /* @__PURE__ */ jsx(CloseButton, { className: "absolute top-4 end-4" }) })]
	})] });
}
PopupBase.displayName = "PopupBase";
function HeaderBase({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "sheet-header",
		className: cn("gap-1.5 p-4 flex flex-col", className),
		...props
	});
}
HeaderBase.displayName = "HeaderBase";
function FooterBase({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "sheet-footer",
		className: cn("gap-2 p-4 mt-auto flex flex-col", className),
		...props
	});
}
FooterBase.displayName = "FooterBase";
function TitleBase({ className, ...props }) {
	return /* @__PURE__ */ jsx(Dialog.Title, {
		"data-slot": "sheet-title",
		className: cn("text-foreground font-medium", className),
		...props
	});
}
TitleBase.displayName = "TitleBase";
function DescriptionBase({ className, ...props }) {
	return /* @__PURE__ */ jsx(Dialog.Description, {
		"data-slot": "sheet-description",
		className: cn("text-muted-foreground text-sm", className),
		...props
	});
}
DescriptionBase.displayName = "DescriptionBase";
function SheetComponent({ trigger, open: controlledOpen, defaultOpen = false, onOpenChange, children, ...props }) {
	const [open, handleOpenChange] = useControllableState({
		value: controlledOpen,
		defaultValue: defaultOpen,
		onChange: onOpenChange
	});
	return /* @__PURE__ */ jsxs(Root, {
		open,
		onOpenChange: handleOpenChange,
		...props,
		children: [trigger && /* @__PURE__ */ jsx(Trigger, { render: trigger }), children]
	});
}
SheetComponent.displayName = "Sheet";
var sheetWidthClasses = {
	sm: "data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
	md: "data-[side=left]:sm:max-w-md data-[side=right]:sm:max-w-md",
	lg: "data-[side=left]:sm:max-w-lg data-[side=right]:sm:max-w-lg",
	xl: "data-[side=left]:sm:max-w-xl data-[side=right]:sm:max-w-xl",
	full: "data-[side=left]:sm:max-w-full data-[side=right]:sm:max-w-full"
};
function Popup({ className, width = "md", children, showCloseButton = false, ...props }) {
	return /* @__PURE__ */ jsx(PopupBase, {
		className: cn("shadow-xl border-border", sheetWidthClasses[width], className),
		showCloseButton,
		...props,
		children
	});
}
Popup.displayName = "Sheet.Popup";
function Header({ className, children, icon, showCloseButton = true, onClose, ...props }) {
	return /* @__PURE__ */ jsxs(HeaderBase, {
		className: cn("relative flex flex-row items-start gap-4 px-6 pt-6 pb-0", className),
		...props,
		children: [
			icon && /* @__PURE__ */ jsx("div", {
				className: "flex size-10 shrink-0 items-center justify-center rounded-md border border-border bg-background shadow-xs delight-bounce-in motion-reduce:!animate-none",
				children: /* @__PURE__ */ jsx("span", {
					className: "text-secondary-foreground [&>svg]:size-5",
					children: icon
				})
			}),
			/* @__PURE__ */ jsx("div", {
				className: "flex min-w-0 flex-1 flex-col gap-0.5",
				children
			}),
			showCloseButton && /* @__PURE__ */ jsx(Close, {
				onClick: onClose,
				render: /* @__PURE__ */ jsx(CloseButton, {
					size: "md",
					className: "absolute end-4 top-3"
				})
			})
		]
	});
}
Header.displayName = "Sheet.Header";
function Title({ className, ...props }) {
	return /* @__PURE__ */ jsx(TitleBase, {
		className: cn("text-xl font-semibold text-foreground delight-stagger motion-reduce:!animate-none", className),
		...props,
		style: { "--delight-delay": "50ms" }
	});
}
Title.displayName = "Sheet.Title";
function Description({ className, ...props }) {
	return /* @__PURE__ */ jsx(DescriptionBase, {
		className: cn("text-sm text-tertiary-foreground delight-stagger motion-reduce:!animate-none", className),
		...props,
		style: { "--delight-delay": "100ms" }
	});
}
Description.displayName = "Sheet.Description";
function Body({ className, children, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "sheet-body",
		className: cn("flex flex-1 flex-col gap-6 overflow-y-auto px-6", className),
		...props,
		children
	});
}
Body.displayName = "Sheet.Body";
function Section({ className, children, label, description, ...props }) {
	return /* @__PURE__ */ jsxs("div", {
		"data-slot": "sheet-section",
		className: cn("flex flex-col gap-4", className),
		...props,
		children: [(label || description) && /* @__PURE__ */ jsxs("div", {
			className: "flex flex-col gap-1",
			children: [label && /* @__PURE__ */ jsx("p", {
				className: "text-sm font-medium text-secondary-foreground",
				children: label
			}), description && /* @__PURE__ */ jsx("p", {
				className: "text-sm text-tertiary-foreground",
				children: description
			})]
		}), children]
	});
}
Section.displayName = "Sheet.Section";
function Divider({ className, ...props }) {
	return /* @__PURE__ */ jsx("div", {
		"data-slot": "sheet-divider",
		className: cn("h-px w-full bg-border-secondary", className),
		...props
	});
}
Divider.displayName = "Sheet.Divider";
function Footer({ className, children, primaryAction, secondaryAction, onPrimaryAction, onSecondaryAction, primaryLoading, primaryDisabled, ...props }) {
	if (children) return /* @__PURE__ */ jsx(FooterBase, {
		className: cn("flex-row items-center justify-end gap-3 border-t border-border px-6 py-4", className),
		...props,
		children
	});
	return /* @__PURE__ */ jsxs(FooterBase, {
		className: cn("flex-row items-center justify-end gap-3 border-t border-border px-6 py-4", className),
		...props,
		children: [secondaryAction && /* @__PURE__ */ jsx(Close, { render: /* @__PURE__ */ jsx(Button, {
			appearance: "outline",
			variant: "secondary",
			onClick: onSecondaryAction,
			children: secondaryAction
		}) }), primaryAction && /* @__PURE__ */ jsx(Button, {
			onClick: onPrimaryAction,
			loading: primaryLoading,
			disabled: primaryDisabled,
			children: primaryAction
		})]
	});
}
Footer.displayName = "Sheet.Footer";
var Sheet = Object.assign(SheetComponent, {
	Root,
	Trigger,
	Portal,
	Backdrop,
	Viewport,
	Popup,
	Header,
	Body,
	Footer,
	Title,
	Description,
	Close,
	Section,
	Divider
});
//#endregion
export { Backdrop, Body, Close, Description, Divider, Footer, Header, Popup, Portal, Root, Section, Sheet, Title, Trigger, Viewport };

//# sourceMappingURL=index468.js.map