@payfit/unity-components
Version:
28 lines (27 loc) • 889 B
JavaScript
import { MenuProvider as e } from "./Menu.context.js";
import { menuPopover as t } from "./menu.variants.js";
import n from "react";
import { jsx as r, jsxs as i } from "react/jsx-runtime";
import { MenuTrigger as a, Popover as o } from "react-aria-components/Menu";
//#region src/core/components/menu/Menu.tsx
function s({ defaultOpen: s, compact: c = !1, children: l, popoverClassName: u, triggerRef: d, placement: f, ...p }) {
let [m, h] = n.Children.toArray(l);
if (!m || !h) throw Error("Menu must have a trigger and a menu content");
return /* @__PURE__ */ r(e, {
compact: c,
children: /* @__PURE__ */ i(a, {
defaultOpen: s,
...p,
children: [m, /* @__PURE__ */ r(o, {
triggerRef: d,
placement: f,
className: t({ className: u }),
"data-dd-privacy": "allow",
children: h
})]
})
});
}
s.displayName = "Menu";
//#endregion
export { s as Menu };