import { useEnsuredId } from "../useEnsuredId.js";
import { DISPLAY_NONE_CLASS } from "../utils/isElementVisible.js";
import { useExpandableLayout } from "./useExpandableLayout.js";
import { useLayoutWindowSplitter } from "./useLayoutWindowSplitter.js";
/**
 * @example
 * Main USage
 * ```tsx
 * import {
 *   AppBarTitle,
 *   Button,
 *   LayoutAppBar,
 *   LayoutNav,
 *   LayoutWindowSplitter,
 *   Main,
 *   Sheet,
 *   useResizableLayout,
 * } from "@react-md/core";
 * import type { ReactElement, ReactNode } from "react";
 *
 * import { CustomNavigation } from "./CustomNavigation";
 *
 * export interface LayoutProps {
 *   children: ReactNode;
 * }
 *
 * export function Layout(props: LayoutProps): ReactElement {
 *   const { children } = props;
 *
 *   // choose whichever one for your app
 *   // nextjs app dir
 *   const pathname = usePathname();
 *   // nextjs pages
 *   const { pathname } = useRouter();
 *   // react router
 *   const { pathname } = useHistory();
 *
 *   const {
 *     isPhone,
 *     appBarProps,
 *     expandableNavProps,
 *     mainProps,
 *     navToggleProps,
 *     temporaryNavProps,
 *     windowSplitterProps,
 *   } = useResizableLayout({ pathname });
 *
 *   return {
 *     <>
 *       <LayoutAppBar {...appBarProps}>
 *         <Button {...navToggleProps} />
 *         <AppBarTitle>Hello, world!</AppBarTitle>
 *       </LayoutAppBar>
 *       <LayoutNav {...expandableNavProps}>
 *         <CustomNavigation />
 *       </LayoutNav>
 *       <LayoutWindowSplitter {...windowSplitterProps} />
 *       {isPhone && (
 *         <Sheet {...temporaryNavProps}>
 *           <CustomNavigation />
 *         </Sheet>
 *       )}
 *       <Main {...mainProps}>{children}</Main>
 *     </>
 *   }
 * }
 * ```
 * @remarks \@since 6.0.0
 */ export function useResizableLayout(options) {
    const { navId: propNavId, pathname, appBarPosition = "fixed", fullHeightNav = false, defaultVisible, defaultExpanded, ...splitterOptions } = options;
    const navId = useEnsuredId(propNavId, "layout-nav");
    const { splitterProps, ...windowSplitter } = useLayoutWindowSplitter(splitterOptions);
    const expandableLayout = useExpandableLayout({
        pathname,
        appBarPosition,
        fullHeightNav,
        defaultExpanded,
        defaultVisible
    });
    const { expandableNavProps, expanded } = expandableLayout;
    return {
        ...expandableLayout,
        ...windowSplitter,
        expandableNavProps: {
            id: navId,
            ...expandableNavProps
        },
        windowSplitterProps: {
            ...splitterProps,
            "aria-controls": navId,
            appBarOffset: !fullHeightNav,
            className: !expanded && DISPLAY_NONE_CLASS || undefined
        }
    };
}

//# sourceMappingURL=useResizableLayout.js.map