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) 2 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 E=require("react"),r=require("prop-types"),c=require("@progress/kendo-react-common"),O=require("./context/DrawerContext.js");function R(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(a,n,l.get?l:{enumerable:!0,get:()=>t[n]})}}return a.default=t,Object.freeze(a)}const e=R(E),d=e.forwardRef((t,a)=>{const{className:n,style:l,text:p,icon:i,svgIcon:u,separator:g,disabled:o,selected:I,onSelect:m,index:b,tabIndex:k,children:y,...w}=t,{expanded:T,mini:P,item:x}=e.useContext(O.DrawerContext),s=e.useRef(null),f=e.useCallback(()=>{s.current&&s.current.focus()},[]);e.useImperativeHandle(a,()=>({element:s.current,focus:f,props:t}));const C=c.classNames("k-drawer-item",{"k-selected":I,"k-disabled":o},n),N=e.useCallback(D=>{if(m&&!o){const j={element:s.current,focus:f,props:t};m(j,b,D)}},[m,b,o]),v=e.createElement(e.Fragment,null,(i||u)&&e.createElement(c.IconWrap,{name:i&&c.toIconName(i),icon:u}),e.createElement("span",{className:"k-item-text"},p));return g?e.createElement("li",{className:"k-drawer-item k-drawer-separator",role:"separator"}):e.createElement("li",{ref:s,className:C,style:l,role:"menuitem","aria-disabled":o||void 0,onClick:N,tabIndex:c.getTabIndex(k,o),...w},x?y:v)});d.propTypes={className:r.string,style:r.object,text:r.string,icon:r.string,svgIcon:c.svgIconPropType,separator:r.bool,selected:r.bool,disabled:r.bool,targetItem:r.any};d.displayName="KendoDrawerItem";exports.DrawerItem=d;