@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) • 2.51 kB
JavaScript
/**
* @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";
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),t=require("prop-types"),a=require("./constants.js");function j(r){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const f=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(c,s,f.get?f:{enumerable:!0,get:()=>r[s]})}}return c.default=r,Object.freeze(c)}const l=j(R),n=r=>{const c=l.forwardRef((s,f)=>{const{id:y,style:h,className:m,fontSize:S,fontWeight:d,textAlign:T,textTransform:C,themeColor:E,margin:e,...O}=s,u=l.useRef(null),g=l.useRef(null);l.useImperativeHandle(u,()=>({element:g.current,props:s})),l.useImperativeHandle(f,()=>u.current);const _=()=>`k-${r==="p"?"paragraph":r}`,A=r,b=(i,p)=>{const o=typeof p=="string"?a.MARGIN_ENUM_VALUES[p]:p;return`${a.MARGIN_SIDES_CLASSES[i]}${o}`},N=()=>{if(e!==void 0){if(typeof e=="string")return[a.MARGIN_ENUM_CLASSES[e]];if(typeof e=="number"&&e>=0&&e<=24)return[`k-m-${e}`];if(typeof e=="object"){const i=[];return Object.keys(e).forEach(o=>{e[o]!==null&&e[o]!==void 0&&i.push(b(o,e[o]))}),i.join(" ")}}},M=()=>[_(),a.FONT_SIZE_CLASSES[S],a.FONT_WEIGHT_CLASSES[d],a.TEXT_ALIGN_CLASSES[T],a.TEXT_TRANSFORM_CLASSES[C],a.THEME_COLOR_CLASSES[E],N(),m].filter(o=>o!==void 0).join(" ");return l.createElement(A,{id:y,ref:g,className:M(),style:h,...O},s.children)});return c.propTypes={style:t.object,className:t.string,fontSize:t.oneOf(["xsmall","small","medium","large","xlarge"]),fontWeight:t.oneOf(["light","normal","bold"]),margin:t.oneOfType([t.number,t.object,t.oneOf(["xsmall","small","medium","large","xlarge","thin","hair"])]),textAlign:t.oneOf(["left","right","center","justify"]),textTransform:t.oneOf(["lowercase","uppercase","capitalize"]),themeColor:t.oneOf(["inherit","primary","secondary","tertiary","info","success","error","warning","dark","light","inverse"])},c.displayName=`KendoReactTypography${r.toUpperCase()}`,c},L=n("h1"),I=n("h2"),x=n("h3"),v=n("h4"),G=n("h5"),P=n("h6"),$=n("p"),w=n("code"),z=n("pre"),H={h1:L,h2:I,h3:x,h4:v,h5:G,h6:P,p:$,code:w,pre:z};exports.Typography=H;