import { h as q, l as A, v as u } from "./vendor-preact-DThS2ZQ_.js";
import { i as useModalFocusCapture, n as useModalBodyScrollLock, o as useModalTabCycle, r as useModalEscapeDismiss, s as useModalVisualViewportBounds } from "./modal.hooks-ZrzmHAUa.js";
//#region src/shared/bottomSheet/bottomSheet.tsx
var BottomSheet = ({ isOpen = false, onClose, labelledById, children }) => {
	const dialogRef = A(null);
	const overlayRef = A(null);
	const requestClose = q(() => {
		onClose?.();
	}, [onClose]);
	useModalBodyScrollLock(isOpen);
	useModalEscapeDismiss(isOpen, true, requestClose);
	useModalFocusCapture(isOpen, dialogRef);
	useModalTabCycle(isOpen, dialogRef);
	useModalVisualViewportBounds(isOpen, overlayRef);
	if (!isOpen) return null;
	return /* @__PURE__ */ u("div", {
		ref: overlayRef,
		class: "IncodeBottomSheetOverlay",
		onClick: (event) => {
			if (event.target === event.currentTarget) requestClose();
		},
		children: /* @__PURE__ */ u("div", {
			class: "IncodeBottomSheetContainer",
			onClick: requestClose,
			children: /* @__PURE__ */ u("div", {
				ref: dialogRef,
				class: "IncodeBottomSheet",
				role: "dialog",
				"aria-modal": "true",
				"aria-labelledby": labelledById,
				tabIndex: -1,
				onClick: (event) => event.stopPropagation(),
				children
			})
		})
	});
};
//#endregion
export { BottomSheet as t };
