"use client" import { Button, Dialog, DialogTrigger, Modal, Popover, } from "react-aria-components" import { useFormContext } from "react-hook-form" import { useIntl } from "react-intl" import Body from "@/components/TempDesignSystem/Text/Body" import PickerForm from "./Form" import styles from "./guests-rooms-picker.module.css" import { GuestsRoom } from "@/types/components/bookingWidget/guestsRoomsPicker" export default function GuestsRoomsPickerForm() { const { watch } = useFormContext() const rooms = watch("rooms") as GuestsRoom[] const htmlElement = typeof window !== "undefined" ? document.querySelector("body") : null //isOpen is the 'old state', so isOpen === true means "The modal is open and WILL be closed". function setOverflowClip(isOpen: boolean) { if (htmlElement) { if (isOpen) { htmlElement.style.overflow = "visible" } else { // !important needed to override 'overflow: hidden' set by react-aria. // 'overflow: hidden' does not work in combination with other sticky positioned elements, which clip does. htmlElement.style.overflow = "clip !important" } } } return ( <> {({ close }) => } {({ close }) => } ) } function Trigger({ rooms, className, }: { rooms: GuestsRoom[] className: string }) { const intl = useIntl() return ( ) }