UNPKG

@retailmenot/anchor

Version:

A React UI Library by RetailMeNot

76 lines (69 loc) 2.89 kB
'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var __chunk_1 = require('./anchor-chunk-24f232e7.js'); var __chunk_5 = require('./anchor-chunk-1efd6395.js'); var styled = require('@xstyled/styled-components'); var styled__default = _interopDefault(styled); var system = require('@xstyled/system'); function _templateObject() { var data = __chunk_1._taggedTemplateLiteral(["\n\n box-sizing: border-box;\n margin: 0;\n\n // Variant styles\n ", "\n\n // If the \"asVariant\" is a css block, then we aren't spreading it above and must\n // include it here. We also include the scale variant so that it's still defined\n // \"after\" the as variant, and takes precedence.\n ", "\n ", "\n\n // Prop overrides. We don't have any defaults here because then they\n // would always override the variants above.\n ", ";\n\n // Spacing\n ", "\n\n small {\n font-size: 87.5%;\n }\n"]); _templateObject = function _templateObject() { return data; }; return data; } var isArray = Array.isArray; var Typography = styled__default('span').attrs(function (props) { return { $color: props.color, color: undefined, className: 'anchor-typography', asVariant: system.variant({ key: 'typography.as', "default": 'none', prop: 'as' })(props), scaleVariant: system.variant({ key: 'typography.scale', "default": 'none', prop: 'scale' })(props) }; })(_templateObject(), function (_ref) { var asVariant = _ref.asVariant, scaleVariant = _ref.scaleVariant; return styled.css(__chunk_1._objectSpread2(__chunk_1._objectSpread2({ fontFamily: 'base', fontSize: system.th('typography.fontSize'), lineHeight: system.th('typography.lineHeight'), fontWeight: system.th('typography.fontWeight'), textAlign: 'inherit', color: 'inherit' }, !isArray(asVariant) ? asVariant : {}), !isArray(asVariant) && !isArray(scaleVariant) ? scaleVariant : {})); }, function (_ref2) { var asVariant = _ref2.asVariant; return isArray(asVariant) && asVariant; }, function (_ref3) { var scaleVariant = _ref3.scaleVariant, asVariant = _ref3.asVariant; return (isArray(asVariant) || isArray(scaleVariant)) && scaleVariant; }, function (_ref4) { var $color = _ref4.$color, align = _ref4.align, display = _ref4.display, transform = _ref4.transform, lineHeight = _ref4.lineHeight, size = _ref4.size, weight = _ref4.weight; return styled.css({ color: $color, textAlign: align, display: display, textTransform: transform, lineHeight: __chunk_5.rem(lineHeight), fontSize: __chunk_5.rem(size), fontWeight: weight }); }, system.space); exports.Typography = Typography; //# sourceMappingURL=anchor-chunk-cd6fece5.js.map