UNPKG

design-system-govbr-rnp

Version:

## Padrão Digital de Governo - React Biblioteca de componentes React que implementa o [Padrão Visual digital do governo](https://www.gov.br/ds/). O objetivo da biblioteca é facilitar a implementação e promover a padronização das interfaces de sistemas do

96 lines (95 loc) 2.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TextComponent = void 0; var _styledComponents = _interopRequireDefault(require("styled-components")); var _templateObject; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } var appliesFontWeight = function appliesFontWeight(weight) { switch (weight) { case "thin": return { fontWeight: "var(--font-weight-thin)" }; case "extra-light": return { fontWeight: "var(--font-weight-extra-light)" }; case "light": return { fontWeight: "var(--font-weight-light)" }; case "regular": return { fontWeight: "var(--font-weight-regular)" }; case "medium": return { fontWeight: "var(--font-weight-medium)" }; case "semi-bold": return { fontWeight: "var(--font-weight-semi-bold)" }; case "bold": return { fontWeight: "var(--font-weight-bold)" }; case "extra-bold": return { fontWeight: "var(--font-weight-extra-bold)" }; case "black": return { fontWeight: "var(--font-weight-black)" }; default: return { fontWeight: "var(--font-weight-regular)" }; } }; var appliesWrapOrOverflow = function appliesWrapOrOverflow(wrap) { switch (wrap) { case "wrap": return { whiteSpace: "normal" }; case "truncate": return { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }; case "nowrap": return { whiteSpace: "nowrap" }; case "break": return { wordBreak: "break-word", wordWrap: "break-word" }; default: return {}; } }; var appliesFontSize = function appliesFontSize(fontSize) { return { fontSize: "var(--font-size-scale-".concat(fontSize, ")") }; }; var TextComponent = _styledComponents.default.p(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n ", "\n ", "\n"])), function (props) { return props.align && "text-align: ".concat(props.align, ";"); }, function (props) { return props.wrap && appliesWrapOrOverflow(props.wrap); }, function (props) { return props.transform && "text-transform: ".concat(props.transform, ";"); }, function (props) { return props.fontWeight && appliesFontWeight(props.fontWeight); }, function (props) { return props.fontSize && appliesFontSize(props.fontSize); }); exports.TextComponent = TextComponent;