UNPKG

@hitachivantara/uikit-react-core

Version:

Core React components for the NEXT Design System.

37 lines (36 loc) 1.31 kB
import { jsx } from "react/jsx-runtime"; import { Popper } from "@mui/base/Popper"; import ClickAwayListener from "@mui/material/ClickAwayListener"; import { useTheme } from "@hitachivantara/uikit-react-utils"; import { getContainerElement } from "../../utils/document.js"; import { HvVerticalNavigation } from "../VerticalNavigation.js"; import { useClasses } from "./NavigationPopup.styles.js"; import { staticClasses } from "./NavigationPopup.styles.js"; const NavigationPopupContainer = ({ anchorEl, onClose, children, classes: classesProp, className, ...others }) => { const { classes, cx } = useClasses(classesProp); const { rootId } = useTheme(); const handleClickAway = () => onClose?.(); return /* @__PURE__ */ jsx( Popper, { open: true, anchorEl, placement: "right-start", container: getContainerElement(rootId), className: cx(classes.popper, classes.popup, className), ...others, children: /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: handleClickAway, children: /* @__PURE__ */ jsx("div", { className: classes.container, children: /* @__PURE__ */ jsx(HvVerticalNavigation, { open: true, useIcons: true, children }) }) }) } ); }; export { NavigationPopupContainer, staticClasses as verticalNavigationPopupClasses };