UNPKG

design-system-simplefi

Version:

Design System for SimpleFi Applications

70 lines 4.36 kB
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var _a, _b; import styled, { css } from 'styled-components'; import PropTypes from 'prop-types'; import { getColor, getFontFamily, getFontSize, getFontWeight, getLineHeight, } from '../../../utils'; import { TextSizes, TextVariants } from './Text.enums'; var largeSize = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n"], ["\n font-size: ", ";\n line-height: ", ";\n"])), getFontSize('lg'), getLineHeight('lg')); var mediumSize = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n"], ["\n font-size: ", ";\n line-height: ", ";\n"])), getFontSize('md'), getLineHeight('md')); var smallSize = css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n"], ["\n font-size: ", ";\n line-height: ", ";\n"])), getFontSize('sm'), getLineHeight('md')); var inheritSize = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: inherit;\n line-height: inherit;\n"], ["\n font-size: inherit;\n line-height: inherit;\n"]))); var primaryVariant = css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), getColor('black')); var secondaryVariant = css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), getColor('lightGrey')); var contextVariant = css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), getColor('darkGrey')); var monospaceVariant = css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-family: ", ";\n"], ["\n font-family: ", ";\n"])), getFontFamily('mono')); var dangerVariant = css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), getColor('neonCoral')); var sizes = (_a = {}, _a[TextSizes.lg] = largeSize, _a[TextSizes.md] = mediumSize, _a[TextSizes.sm] = smallSize, _a[TextSizes.inherit] = inheritSize, _a); var variants = (_b = {}, _b[TextVariants.primary] = primaryVariant, _b[TextVariants.secondary] = secondaryVariant, _b[TextVariants.context] = contextVariant, _b[TextVariants.monospace] = monospaceVariant, _b[TextVariants.danger] = dangerVariant, _b); var Text = styled.span(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n font-family: inherit;\n font-weight: ", ";\n color: inherit;\n white-space: nowrap;\n ", ";\n ", ";\n"], ["\n font-family: inherit;\n font-weight: ", ";\n color: inherit;\n white-space: nowrap;\n ", ";\n ", ";\n"])), function (_a) { var isBold = _a.isBold, theme = _a.theme; return isBold ? getFontWeight('bold', { theme: theme }) : 'inherit'; }, function (_a) { var size = _a.size; return sizes[size]; }, function (_a) { var variant = _a.variant; return variants[variant]; }); Text.propTypes = { size: PropTypes.oneOf(Object.values(TextSizes)), variant: PropTypes.oneOf(Object.values(TextVariants)), isBold: PropTypes.bool, }; Text.defaultProps = { size: TextSizes.lg, variant: TextVariants.primary, isBold: false, }; export default Text; export var Strong = styled(Text).attrs(function () { return ({ as: 'strong', isBold: true, size: TextSizes.inherit, }); })(templateObject_11 || (templateObject_11 = __makeTemplateObject([""], [""]))); Strong.propTypes = { variant: PropTypes.oneOf(Object.values(TextVariants)), }; export var Code = styled(Text).attrs(function () { return ({ variant: TextVariants.monospace, as: 'code', }); })(templateObject_12 || (templateObject_12 = __makeTemplateObject([""], [""]))); Code.propTypes = { size: PropTypes.oneOf(Object.values(TextSizes)), isBold: PropTypes.bool, }; var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12; //# sourceMappingURL=Text.js.map