@razorpay/blade
Version:
The Design System that powers Razorpay
109 lines (106 loc) • 5.07 kB
JavaScript
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
import React__default from 'react';
import styled from 'styled-components';
import getBaseTextStyles from './getBaseTextStyles.js';
import '../../../utils/metaAttribute/index.js';
import '../../Box/styledProps/index.js';
import '../../../utils/makeAccessible/index.js';
import { omitPropsFromHTML } from '../../../utils/omitPropsFromHTML/index.js';
import { jsx } from 'react/jsx-runtime';
import { useStyledProps } from '../../Box/styledProps/useStyledProps.js';
import { MetaConstants } from '../../../utils/metaAttribute/metaConstants.js';
import { getStyledProps } from '../../Box/styledProps/getStyledProps.js';
import { makeAccessible } from '../../../utils/makeAccessible/makeAccessible.web.js';
import { metaAttribute } from '../../../utils/metaAttribute/metaAttribute.web.js';
var _excluded = ["color", "fontFamily", "fontSize", "fontWeight", "fontStyle", "textDecorationLine", "numberOfLines", "lineHeight", "letterSpacing", "textAlign", "wordBreak", "opacity"],
_excluded2 = ["id", "color", "fontFamily", "fontSize", "fontWeight", "fontStyle", "textDecorationLine", "lineHeight", "letterSpacing", "as", "textAlign", "children", "truncateAfterLines", "wordBreak", "opacity", "className", "style", "accessibilityProps", "componentName", "testID"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var StyledBaseText = /*#__PURE__*/styled.div.withConfig({
shouldForwardProp: omitPropsFromHTML,
displayName: 'StyledBaseText'
})(function (_ref) {
var color = _ref.color,
fontFamily = _ref.fontFamily,
fontSize = _ref.fontSize,
fontWeight = _ref.fontWeight,
fontStyle = _ref.fontStyle,
textDecorationLine = _ref.textDecorationLine,
numberOfLines = _ref.numberOfLines,
lineHeight = _ref.lineHeight,
letterSpacing = _ref.letterSpacing,
textAlign = _ref.textAlign,
wordBreak = _ref.wordBreak,
opacity = _ref.opacity,
props = _objectWithoutProperties(_ref, _excluded);
var styledPropsCSSObject = useStyledProps(props);
return _objectSpread(_objectSpread({}, getBaseTextStyles({
color: color,
fontFamily: fontFamily,
fontSize: fontSize,
fontWeight: fontWeight,
fontStyle: fontStyle,
textDecorationLine: textDecorationLine,
numberOfLines: numberOfLines,
lineHeight: lineHeight,
letterSpacing: letterSpacing,
textAlign: textAlign,
wordBreak: wordBreak,
opacity: opacity,
theme: props.theme
})), styledPropsCSSObject);
});
var _BaseText = function _BaseText(_ref2, ref) {
var id = _ref2.id,
color = _ref2.color,
fontFamily = _ref2.fontFamily,
fontSize = _ref2.fontSize,
fontWeight = _ref2.fontWeight,
fontStyle = _ref2.fontStyle,
textDecorationLine = _ref2.textDecorationLine,
lineHeight = _ref2.lineHeight,
letterSpacing = _ref2.letterSpacing,
as = _ref2.as,
textAlign = _ref2.textAlign,
children = _ref2.children,
truncateAfterLines = _ref2.truncateAfterLines,
wordBreak = _ref2.wordBreak,
opacity = _ref2.opacity,
className = _ref2.className,
style = _ref2.style,
_ref2$accessibilityPr = _ref2.accessibilityProps,
accessibilityProps = _ref2$accessibilityPr === void 0 ? {} : _ref2$accessibilityPr,
_ref2$componentName = _ref2.componentName,
componentName = _ref2$componentName === void 0 ? MetaConstants.BaseText : _ref2$componentName,
testID = _ref2.testID,
styledProps = _objectWithoutProperties(_ref2, _excluded2);
return /*#__PURE__*/jsx(StyledBaseText, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
ref: ref
}, getStyledProps(styledProps)), {}, {
color: color,
fontFamily: fontFamily,
fontSize: fontSize,
fontWeight: fontWeight,
fontStyle: fontStyle,
textDecorationLine: textDecorationLine,
lineHeight: lineHeight,
letterSpacing: letterSpacing,
as: as,
textAlign: textAlign,
numberOfLines: truncateAfterLines,
wordBreak: wordBreak,
opacity: opacity,
className: className,
style: style,
id: id
}, makeAccessible(accessibilityProps)), metaAttribute({
name: componentName,
testID: testID
})), {}, {
children: children
}));
};
var BaseText = /*#__PURE__*/React__default.forwardRef(_BaseText);
export { BaseText };
//# sourceMappingURL=BaseText.web.js.map