@progress/kendo-react-layout
Version:
React Layout components enable you to create a perceptive and intuitive layout of web projects. KendoReact Layout package
43 lines (42 loc) • 1.55 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import * as n from "react";
import { useId as f, getActiveElement as r, classNames as d } from "@progress/kendo-react-common";
import { Popup as h } from "@progress/kendo-react-popup";
import { Menu as v } from "../menu/components/Menu.mjs";
const w = (e) => {
const o = n.useRef(null), [u, c] = n.useState(e.show), m = f(e.id), { animate: a = C.animate } = e;
n.useEffect(() => {
c(e.show), e.show && setTimeout(() => {
const t = o.current && o.current.element, s = t && t.querySelector(".k-menu-item"), l = r(t == null ? void 0 : t.ownerDocument);
s && s !== l && s.focus();
});
}, [e.show]);
const i = (t) => {
t.popupCloseEvent || e.onClose(t);
};
return /* @__PURE__ */ n.createElement(h, { show: u, offset: e.offset, popupClass: "k-menu-popup k-overflow-visible", animate: a }, /* @__PURE__ */ n.createElement(
v,
{
id: m,
vertical: !0,
...e,
ref: o,
className: d("k-context-menu", e.className),
onClose: i,
role: "menu"
},
e.children
));
}, C = {
animate: { openDuration: 300, closeDuration: 300 }
};
w.displayName = "KendoReactContextMenu";
export {
w as ContextMenu
};