UNPKG

@progress/kendo-react-common

Version:

React Common package delivers common utilities that can be used with the KendoReact UI components. KendoReact Common Utilities package

10 lines (9 loc) 1.96 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 client"; "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),r=require("prop-types"),z=require("../classNames.js"),I=require("./constants.js"),N=require("./utils.js"),P=require("../hooks/useMouse.js");function S(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:()=>t[s]})}}return n.default=t,Object.freeze(n)}const e=S(x),i=e.forwardRef((t,n)=>{const{className:s,name:o,themeColor:l,size:u,flip:f,style:g,id:b,tabIndex:y,...h}=t,c=e.useRef(null),m=e.useRef(null);e.useImperativeHandle(c,()=>({element:m.current})),e.useImperativeHandle(n,()=>c.current);const p=e.useMemo(()=>u||d.size,[u]),a=e.useMemo(()=>f||d.flip,[f]),O=e.useMemo(()=>z.classNames("k-icon","k-font-icon",o&&N.toIconClass(o),{[`k-color-${l}`]:l,"k-flip-h":a==="horizontal"||a==="both","k-flip-v":a==="vertical"||a==="both"},I.SIZE_CLASSES[p],s),[o,l,p,a,s]),v=P.useMouse(t,c);return e.createElement("span",{ref:m,...h,...v,className:O,id:b,tabIndex:y,style:g,role:"presentation"})});i.propTypes={style:r.object,classNames:r.string,name:r.string,themeColor:r.oneOf(["inherit","primary","secondary","tertiary","info","success","error","warning","dark","light","inverse"]),size:r.oneOf(["default","xsmall","small","medium","large","xlarge","xxlarge","xxxlarge"]),flip:r.oneOf(["default","horizontal","vertical","both"])};const d={size:"default",flip:"default"};i.displayName="KendoIcon";exports.Icon=i;