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

72 lines (71 loc) 7.04 kB
"use strict"; function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } Object.defineProperty(exports, "__esModule", { value: true }); exports.ListIcon = exports.ListHorizontal = exports.ListContainer = exports.Label = exports.Header = exports.ContainerExpansion = void 0; var _styledComponents = _interopRequireWildcard(require("styled-components")); var _reactFontawesome = require("@fortawesome/react-fontawesome"); var _Types = require("./Types"); var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15; function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } var checked = function checked(isChecked) { switch (isChecked) { case true: return (0, _styledComponents.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: var(--blue-warm-vivid-50);\n color: var(--pure-0);\n "]))); case false: return (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background-color: \"inherit\";\n color: var(--gray-80);\n "]))); default: break; } }; var size = function size(_size) { switch (_size) { case "medium": return (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: var(--spacing-scale-base) var(--spacing-scale-2x);\n "]))); case "low": return (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: var(--spacing-scale-3xh) var(--spacing-scale-2x);\n "]))); default: return (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding: var(--spacing-scale-base) var(--spacing-scale-2x);\n "]))); } }; var type = function type(_type) { switch (_type) { case _Types.LIST_BY_EXPANSION: return (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding: var(--spacing-scale-base) var(--spacing-scale-2xh);\n "]))); case _Types.LIST_HORIZONTAL: return (0, _styledComponents.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n width: 50%;\n border-right: 1px solid var(--gray-20);\n "]))); default: break; } }; var Header = _styledComponents.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n & span {\n padding: var(--spacing-scale-base) var(--spacing-scale-2x);\n font-size: var(--font-size-scale-base);\n font-weight: var(--font-weight-bold);\n }\n"]))); exports.Header = Header; var ListIcon = (0, _styledComponents.default)(_reactFontawesome.FontAwesomeIcon)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n padding-right: var(--spacing-scale-2x);\n padding-left: var(--surface-blur-lg);\n font-size: var(--icon-size-base);\n color: ", ";\n ", "\n"])), function (props) { return props.id && "var(--blue-warm-vivid-70)"; }, function (props) { return props.checked && (0, _styledComponents.css)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n transform: rotate(180deg);\n transform-origin: 13px 8px;\n "]))); }); exports.ListIcon = ListIcon; var ContainerExpansion = _styledComponents.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n ", "\n\n & input {\n display: none;\n }\n\n & input ~ div {\n display: none;\n padding-top: var(--spacing-scale-base);\n }\n\n & input:checked ~ div {\n display: block;\n }\n"])), function (props) { return props.type === _Types.LIST_HORIZONTAL_BY_EXPANSION && (0, _styledComponents.css)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n width: 50%;\n border-right: 1px solid var(--gray-20);\n "]))); }); exports.ContainerExpansion = ContainerExpansion; var ListHorizontal = _styledComponents.default.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n"]))); exports.ListHorizontal = ListHorizontal; var ListContainer = _styledComponents.default.div(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n color: var(--gray-80);\n cursor: ", ";\n\n & input {\n display: grid;\n }\n\n &:last-child {\n border-right: none;\n }\n\n &:hover {\n ", "\n }\n\n ", ";\n ", ";\n ", ";\n"])), function (props) { return props.expansion && "pointer"; }, function (props) { return props.expansion && "background-image: linear-gradient(rgba(var(--rgb-secondary-08), var(--surface-opacity-xs)), rgba(var(--rgb-secondary-08), 0.16))"; }, function (props) { return checked(props === null || props === void 0 ? void 0 : props.checked); }, function (props) { return size(props === null || props === void 0 ? void 0 : props.size); }, function (props) { return type(props === null || props === void 0 ? void 0 : props.type); }); exports.ListContainer = ListContainer; var Label = _styledComponents.default.div(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n padding: var(--spacing-scale-base) var(--spacing-scale-2x);\n"]))); exports.Label = Label;