UNPKG

@progress/kendo-react-layout

Version:

React Layout components enable you to create a perceptive and intuitive layout of web projects. KendoReact Layout package

39 lines (38 loc) 1.49 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 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 l, getActiveElement as r, classNames as f } from "@progress/kendo-react-common"; import { Popup as d } from "@progress/kendo-react-popup"; import { Menu as w } from "../menu/components/Menu.mjs"; const h = (e) => { const o = n.useRef(null), [m, c] = n.useState(e.show), u = l(e.id), { animate: a = v.animate } = e; return n.useEffect(() => { c(e.show), e.show && setTimeout(() => { const t = o.current && o.current.element, s = t && t.querySelector(".k-menu-item"), i = r(t == null ? void 0 : t.ownerDocument); s && s !== i && s.focus(); }); }, [e.show]), /* @__PURE__ */ n.createElement(d, { show: m, offset: e.offset, popupClass: "k-menu-popup k-overflow-visible", animate: a }, /* @__PURE__ */ n.createElement( w, { id: u, vertical: !0, ...e, ref: o, className: f("k-context-menu", e.className), onClose: e.onClose, role: "menu" }, e.children )); }, v = { animate: { openDuration: 300, closeDuration: 300 } }; h.displayName = "KendoReactContextMenu"; export { h as ContextMenu };