UNPKG

@progress/kendo-react-layout

Version:

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

9 lines (8 loc) 1.6 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),a=require("@progress/kendo-react-common"),b=require("@progress/kendo-react-popup"),v=require("../menu/components/Menu.js");function C(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const u=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,u.get?u:{enumerable:!0,get:()=>e[o]})}}return n.default=e,Object.freeze(n)}const c=C(d),i=e=>{const n=c.useRef(null),[o,u]=c.useState(e.show),l=a.useId(e.id),{animate:r=g.animate}=e;c.useEffect(()=>{u(e.show),e.show&&setTimeout(()=>{const t=n.current&&n.current.element,s=t&&t.querySelector(".k-menu-item"),f=a.getActiveElement(t==null?void 0:t.ownerDocument);s&&s!==f&&s.focus()})},[e.show]);const m=t=>{t.popupCloseEvent||e.onClose(t)};return c.createElement(b.Popup,{show:o,offset:e.offset,popupClass:"k-menu-popup k-overflow-visible",animate:r},c.createElement(v.Menu,{id:l,vertical:!0,...e,ref:n,className:a.classNames("k-context-menu",e.className),onClose:m,role:"menu"},e.children))},g={animate:{openDuration:300,closeDuration:300}};i.displayName="KendoReactContextMenu";exports.ContextMenu=i;