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
44 lines (43 loc) • 6.5 kB
JavaScript
"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.Wrapper = exports.Title = exports.Label = exports.Input = exports.Info = void 0;
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
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 stateVariant = function stateVariant(variant) {
return {
invalid: (0, _styledComponents.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 2px solid var(--red-vivid-50);\n "]))),
valid: (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 2px solid var(--green-cool-vivid-50);\n "])))
}[variant];
};
var Wrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n"])), function (props) {
return props.inline && (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n div {\n align-items: center;\n display: flex;\n }\n label {\n display: grid;\n margin-right: var(--spacing-scale-4x);\n margin-bottom: 0;\n }\n "])));
});
exports.Wrapper = Wrapper;
var Input = _styledComponents.default.input(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", "\n appearance: none;\n background: var(--pure-0);\n border-radius: 4px;\n border: 1px solid var(--gray-20);\n box-sizing: border-box;\n cursor: pointer;\n display: grid;\n height: 24px;\n margin: 0;\n place-content: center;\n transform: translateY(-0.075em);\n width: 24px;\n\n &::before {\n box-shadow: inset 12px 12px var(--blue-warm-vivid-50);\n clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);\n content: \"\";\n height: 12px;\n transform-origin: bottom left;\n transform: scale(0);\n width: 12px;\n }\n &:checked::before {\n transform: scale(1);\n }\n\n &:focus-visible {\n border-color: var(--gold-vivid-40) !important;\n box-shadow: 0 0 0 var(--surface-width-md) var(--gold-vivid-40);\n outline: none;\n }\n\n &:hover:not(:disabled) {\n background-image: linear-gradient(\n rgba(var(--blue-cool-vivid-70-rgb), var(--surface-opacity-xs)),\n rgba(var(--blue-cool-vivid-70-rgb), var(--surface-opacity-xs))\n );\n }\n\n &:disabled {\n pointer-events: none;\n cursor: not-allowed;\n }\n\n ", "\n"])), function (props) {
return props.optionsSelect > 0 && props.optionsSelect < props.optionsList.length && "\n background: var(--blue-warm-vivid-50);\n &::after {\n box-shadow: inset 12px 12px white;\n top: 9px;\n content: \"\";\n height: 2.5px;\n left: 7.4px;\n position: absolute;\n width: 8px;\n }\n ";
}, function (_ref) {
var state = _ref.state;
return stateVariant(state);
});
exports.Input = Input;
var Label = _styledComponents.default.label(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n align-items: flex-start;\n color: var(--gray-80);\n display: grid;\n font-family: Rawline, raleway, sans-serif;\n font-weight: var(--font-weight-medium);\n gap: 16px;\n grid-template-columns: 1em auto;\n line-height: 1.6em;\n min-height: var(--spacing-scale-3xh);\n margin-bottom: ", ";\n position: relative;\n font-size: var(--font-size-scale-base);\n &:empty {\n padding-left: 24px;\n }\n ", "\n"])), function (props) {
return props.disabled && "opacity: 0.45;";
}, function (props) {
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
}, function (props) {
var _props$options;
return ((_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.length) > 1 || props.selectAllOptions ? "8px" : "0px";
}, function (props) {
return props.hidden && (0, _styledComponents.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n text-indent: -10000px;\n white-space: nowrap;\n "])));
});
exports.Label = Label;
var Title = _styledComponents.default.p(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n margin: 0;\n color: var(--gray-80);\n font-size: var(--font-size-scale-base);\n font-weight: var(--font-weight-semi-bold);\n line-height: var(--font-line-height-medium);\n"])));
exports.Title = Title;
var Info = _styledComponents.default.p(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n color: var(--gray-80);\n font-size: var(--font-size-scale-down-01) !important;\n font-weight: var(--font-weight-regular);\n line-height: var(--font-line-height-medium);\n margin-bottom: var(--spacing-scale-2x);\n margin-top: 0;\n"])));
exports.Info = Info;