@retailmenot/anchor
Version:
A React UI Library by RetailMeNot
71 lines (66 loc) • 2.65 kB
JavaScript
import { b as _objectSpread2, a as _taggedTemplateLiteral } from './anchor-chunk-7b9d8557.js';
import { a as rem } from './anchor-chunk-cd7ef49a.js';
import styled, { css } from '@xstyled/styled-components';
import { th, variant, space } from '@xstyled/system';
function _templateObject() {
var data = _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('span').attrs(function (props) {
return {
$color: props.color,
color: undefined,
className: 'anchor-typography',
asVariant: variant({
key: 'typography.as',
"default": 'none',
prop: 'as'
})(props),
scaleVariant: variant({
key: 'typography.scale',
"default": 'none',
prop: 'scale'
})(props)
};
})(_templateObject(), function (_ref) {
var asVariant = _ref.asVariant,
scaleVariant = _ref.scaleVariant;
return css(_objectSpread2(_objectSpread2({
fontFamily: 'base',
fontSize: th('typography.fontSize'),
lineHeight: th('typography.lineHeight'),
fontWeight: 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 css({
color: $color,
textAlign: align,
display: display,
textTransform: transform,
lineHeight: rem(lineHeight),
fontSize: rem(size),
fontWeight: weight
});
}, space);
export { Typography as a };
//# sourceMappingURL=anchor-chunk-5b0bbe0b.js.map