/*! ratio-ui · design system for knowledge sharing · https://github.com/losol/ratio-ui · (c) 2026 Losol AS · MPL-2.0 */
import { cn } from "../../utils/cn.js";
import { buildSpacingClasses } from "../../tokens/spacing.js";
import { jsx } from "react/jsx-runtime";
import { Dialog, Heading, Modal, ModalOverlay } from "react-aria-components";
//#region src/layout/Dialog/Dialog.tsx
var sizeClasses = {
	sm: "max-w-md",
	md: "max-w-lg",
	lg: "max-w-2xl",
	xl: "max-w-4xl"
};
var DialogRoot = ({ isOpen, onClose, children, size, testId, role = "dialog", isDismissable = true, isKeyboardDismissDisabled = false }) => {
	const panelWidth = sizeClasses[size ?? "md"];
	return /* @__PURE__ */ jsx(ModalOverlay, {
		isOpen,
		onOpenChange: (open) => {
			if (!open) onClose();
		},
		isDismissable,
		isKeyboardDismissDisabled,
		"data-testid": testId,
		className: "flex min-h-full min-w-full items-start justify-center p-4 text-center fixed inset-0 z-100 overflow-auto h-full bg-black/50",
		children: /* @__PURE__ */ jsx(Modal, {
			className: cn("w-full", panelWidth, "transform overflow-hidden rounded-2xl bg-card text-(--text)", "p-6 text-left align-middle shadow-xl transition-all"),
			children: /* @__PURE__ */ jsx(Dialog, {
				role,
				className: "relative z-10 outline-hidden",
				children
			})
		})
	});
};
function DialogHeading({ children, className }) {
	return /* @__PURE__ */ jsx(Heading, {
		slot: "title",
		level: 3,
		className: cn("text-(--text)", buildSpacingClasses({ paddingBottom: "xs" }), className),
		children
	});
}
function DialogContent({ children, className }) {
	return /* @__PURE__ */ jsx("div", {
		className,
		children
	});
}
function DialogFooter({ children, className }) {
	return /* @__PURE__ */ jsx("div", {
		className: cn("mt-4 flex justify-end gap-2", className),
		children
	});
}
var Dialog$1 = Object.assign(DialogRoot, {
	Heading: DialogHeading,
	Content: DialogContent,
	Footer: DialogFooter
});
//#endregion
export { Dialog$1 as Dialog };

//# sourceMappingURL=Dialog.js.map