import { jsx, jsxs } from "react/jsx-runtime";
import assert from "assert";
import { createContext, useContext } from "react";
import { Box } from "../Box/Box.mjs";
import { buildDataAttributes } from "../Accordion/Accordion.mjs";
import { fullHeight } from "./Page.css.mjs";
const PageContext = createContext(false);
const Page = ({
  children,
  footer,
  footerPosition,
  data,
  ...restProps
}) => {
  assert(
    !useContext(PageContext),
    "Page components should not be nested within each other"
  );
  return /* @__PURE__ */ jsx(PageContext.Provider, { value: true, children: /* @__PURE__ */ jsxs(
    Box,
    {
      display: "flex",
      flexDirection: "column",
      className: fullHeight,
      ...buildDataAttributes({ data, validateRestProps: restProps }),
      children: [
        /* @__PURE__ */ jsx(
          Box,
          {
            flexGrow: footerPosition !== "belowFold" ? 1 : void 0,
            className: footerPosition === "belowFold" ? fullHeight : void 0,
            paddingBottom: "xxxlarge",
            children
          }
        ),
        footer
      ]
    }
  ) });
};
export {
  Page
};
