@braineet/ui
Version:
Braineet design system
33 lines (32 loc) • 1.46 kB
JavaScript
var _excluded = ["color", "size", "as", "fontFamily"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React from 'react';
import { Text as StyledText } from './styles';
/**
* The `Text` component.
*/
import { jsx as _jsx } from "react/jsx-runtime";
var Text = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var color = _ref.color,
size = _ref.size,
as = _ref.as,
fontFamily = _ref.fontFamily,
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
return /*#__PURE__*/_jsx(StyledText, _extends({
ref: ref,
forwardedAs: as,
color: color,
$fontFamily: fontFamily,
$size: size
}, restProps, {
style: restProps.isInlineCss ? _extends({}, restProps.style) : restProps.style
}));
});
Text.defaultProps = {
as: 'span',
fontFamily: 'text',
color: 'inherit',
size: 'md'
};
export default Text;