UNPKG

@progress/kendo-react-buttons

Version:

All you need in React Button in one package: disabled/enabled states, built-in styles and more. KendoReact Buttons 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 R=require("react"),t=require("prop-types"),r=require("@progress/kendo-react-common");function T(o){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const a in o)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(o,a);Object.defineProperty(c,a,n.get?n:{enumerable:!0,get:()=>o[a]})}}return c.default=o,Object.freeze(c)}const e=T(R),u=e.forwardRef((o,c)=>{const{className:a,disabled:n,text:i,icon:d,style:k,id:y,focused:b,tabIndex:x,index:s,dataItem:C,item:N,svgIcon:f,onDown:p,onClick:m,...v}=o,l=e.useRef(null),g=e.useCallback(()=>{l.current&&l.current.focus()},[]),P=e.useCallback(()=>({element:l.current,focus:g}),[g]);e.useImperativeHandle(c,P);const j=e.useCallback(O=>{m&&s!==void 0&&!n&&m(O,s)},[m,s]),E=e.useMemo(()=>r.classNames("k-fab-item",{"k-focus":b,"k-disabled":n},a),[a,n,b]),I=N;return e.createElement("li",{ref:l,id:y,className:E,style:k,role:"menuitem",tabIndex:r.getTabIndex(x,n),"aria-disabled":n,"aria-label":`${i||""} floatingactionbutton item`,onClick:j,onMouseDown:p,onPointerDown:p,...v},I?e.createElement(I,{itemIndex:s,item:C}):e.createElement(e.Fragment,null,i&&e.createElement("span",{className:"k-fab-item-text"},i),d||f?e.createElement(r.IconWrap,{className:"k-fab-item-icon",name:d,icon:f}):null))});u.propTypes={className:t.string,style:t.object,children:t.any,disabled:t.bool,focused:t.bool,index:t.number,icon:t.string,svgIcon:r.svgIconPropType,text:t.string,tabIndex:t.number,customProp:t.any};u.displayName="KendoFloatingActionButtonItem";exports.FloatingActionButtonItem=u;