@razorpay/blade
Version:
The Design System that powers Razorpay
18 lines (15 loc) • 2.5 kB
JavaScript
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
import React__default from 'react';
import { BaseText } from '../BaseText/BaseText.native.js';
import { useValidateAsProp } from '../utils.js';
import { getStyledProps } from '../../Box/styledProps/getStyledProps.js';
import '@babel/runtime/helpers/slicedToArray';
import 'react-native';
import '../../../tokens/global/typography.js';
import '../../../tokens/global/motion.js';
import { getPlatformType } from '../../../utils/getPlatformType/getPlatformType.js';
import '../../BladeProvider/useTheme.js';
import { jsx } from 'react/jsx-runtime';
var _excluded=["as","size","weight","color","children","testID","textAlign","textDecorationLine"];var validAsValues=['span','h1','h2','h3','h4','h5','h6'];var getProps=function getProps(_ref){var as=_ref.as,size=_ref.size,weight=_ref.weight,color=_ref.color,testID=_ref.testID;var isPlatformWeb=getPlatformType()==='browser'||getPlatformType()==='node';var letterSpacing=weight==='medium'||weight==='regular'?50:100;var props={color:color,fontSize:800,fontWeight:weight,fontStyle:'normal',lineHeight:800,fontFamily:'heading',accessibilityProps:isPlatformWeb?{}:{role:'heading'},componentName:'display',testID:testID,letterSpacing:letterSpacing};if(size==='small'){props.fontSize=800;props.lineHeight=800;}else if(size==='medium'){props.fontSize=900;props.lineHeight=900;}else if(size==='large'){props.fontSize=1000;props.lineHeight=1000;}else if(size==='xlarge'){props.fontSize=1100;props.lineHeight=1100;}props.as=isPlatformWeb?'h1':undefined;props.as=as||props.as;return props;};var _Display=function _Display(_ref2,ref){var as=_ref2.as,_ref2$size=_ref2.size,size=_ref2$size===void 0?'small':_ref2$size,_ref2$weight=_ref2.weight,weight=_ref2$weight===void 0?'semibold':_ref2$weight,_ref2$color=_ref2.color,color=_ref2$color===void 0?'surface.text.gray.normal':_ref2$color,children=_ref2.children,testID=_ref2.testID,textAlign=_ref2.textAlign,textDecorationLine=_ref2.textDecorationLine,styledProps=_objectWithoutProperties(_ref2,_excluded);useValidateAsProp({componentName:'Display',as:as,validAsValues:validAsValues});var props=getProps({as:as,size:size,color:color,weight:weight,testID:testID});return jsx(BaseText,Object.assign({ref:ref},props,{textAlign:textAlign,textDecorationLine:textDecorationLine},getStyledProps(styledProps),{children:children}));};var Display=React__default.forwardRef(_Display);
export { Display };
//# sourceMappingURL=Display.js.map