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.01 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 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 n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const l=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,l.get?l:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const e=R(E),d=e.forwardRef((t,n)=>{const{className:a,style:l,text:u,icon:i,svgIcon:b,separator:g,disabled:o,selected:I,onSelect:m,index:f,tabIndex:k,children:y,...w}=t,{expanded:T,mini:P,item:x}=e.useContext(O.DrawerContext),s=e.useRef(null),p=e.useCallback(()=>{s.current&&s.current.focus()},[]);e.useImperativeHandle(n,()=>({element:s.current,focus:p,props:t}));const C=c.classNames("k-drawer-item",{"k-selected":I,"k-disabled":o},a),N=e.useCallback(j=>{if(m&&!o){const v={element:s.current,focus:p,props:t};m(v,f,j)}},[m,f,o]),D=e.createElement(e.Fragment,null,(i||b)&&e.createElement(c.IconWrap,{name:i&&c.toIconName(i),icon:b}),e.createElement("span",{className:"k-item-text"},u));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-label":u,"aria-disabled":o,onClick:N,tabIndex:c.getTabIndex(k,o),...w},x?y:D)});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;