1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var _react = _interopRequireWildcard(require("react"));
|
9 |
|
10 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
11 |
|
12 | var _withStyles = require("../helpers/withStyles");
|
13 |
|
14 | var _Spacing = _interopRequireDefault(require("./Spacing"));
|
15 |
|
16 | var _Text = _interopRequireDefault(require("./Text"));
|
17 |
|
18 | var _Title = _interopRequireDefault(require("./Title"));
|
19 |
|
20 | var _Icon = _interopRequireDefault(require("./Icon"));
|
21 |
|
22 | var _reactWithStyles = require("react-with-styles");
|
23 |
|
24 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25 |
|
26 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
27 |
|
28 | function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
29 |
|
30 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
31 |
|
32 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
33 |
|
34 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
35 |
|
36 | function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
37 |
|
38 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
39 |
|
40 | function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
41 |
|
42 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
43 |
|
44 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
45 |
|
46 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
47 |
|
48 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
49 |
|
50 | var propTypes = _objectSpread({}, _reactWithStyles.withStylesPropTypes, {
|
51 | after: _propTypes.default.object,
|
52 | before: _propTypes.default.object,
|
53 | children: _propTypes.default.any.isRequired,
|
54 | description: _propTypes.default.string,
|
55 | done: _propTypes.default.bool,
|
56 | errorMessage: _propTypes.default.string,
|
57 | invalid: _propTypes.default.bool,
|
58 | title: _propTypes.default.string
|
59 | });
|
60 |
|
61 | var ConfigurationItem =
|
62 |
|
63 | function (_Component) {
|
64 | _inherits(ConfigurationItem, _Component);
|
65 |
|
66 | function ConfigurationItem() {
|
67 | _classCallCheck(this, ConfigurationItem);
|
68 |
|
69 | return _possibleConstructorReturn(this, _getPrototypeOf(ConfigurationItem).apply(this, arguments));
|
70 | }
|
71 |
|
72 | _createClass(ConfigurationItem, [{
|
73 | key: "render",
|
74 | value: function render() {
|
75 | var _this$props = this.props,
|
76 | after = _this$props.after,
|
77 | before = _this$props.before,
|
78 | children = _this$props.children,
|
79 | css = _this$props.css,
|
80 | description = _this$props.description,
|
81 | done = _this$props.done,
|
82 | errorMessage = _this$props.errorMessage,
|
83 | invalid = _this$props.invalid,
|
84 | styles = _this$props.styles,
|
85 | title = _this$props.title;
|
86 | return _react.default.createElement("div", css(styles.configurationItem), before, _react.default.createElement("div", css(styles.configurationItem__content), _react.default.createElement(_Spacing.default, {
|
87 | bottom: 1
|
88 | }, _react.default.createElement(_Title.default, {
|
89 | noSpacing: true,
|
90 | light: true,
|
91 | level: 3
|
92 | }, title, (done || invalid) && _react.default.createElement("div", css(styles.statusLabel, done && styles.statusLabel_done, invalid && styles.statusLabel_error), _react.default.createElement(_Icon.default, {
|
93 | micro: true,
|
94 | inverse: true,
|
95 | name: done ? 'check' : 'error'
|
96 | }))), _react.default.createElement(_Text.default, {
|
97 | small: true,
|
98 | mutted: true
|
99 | }, description)), children, invalid && errorMessage && _react.default.createElement("div", css(styles.errorMessage), _react.default.createElement(_Text.default, {
|
100 | error: true
|
101 | }, "Mensagem de erro"))), after);
|
102 | }
|
103 | }]);
|
104 |
|
105 | return ConfigurationItem;
|
106 | }(_react.Component);
|
107 |
|
108 | var ConfigurationItemWithStyles = (0, _withStyles.withStyles)(function (_ref) {
|
109 | var color = _ref.color,
|
110 | units = _ref.units,
|
111 | radius = _ref.radius,
|
112 | font = _ref.font;
|
113 | return {
|
114 | configurationItem: {
|
115 | borderRadius: radius,
|
116 | borderWidth: 1,
|
117 | borderColor: color.blueGrayLight,
|
118 | borderStyle: 'solid',
|
119 | background: color.white,
|
120 | overflow: 'hidden'
|
121 | },
|
122 | configurationItem__content: {
|
123 | padding: units(1.5)
|
124 | },
|
125 | statusLabel: {
|
126 | width: 16,
|
127 | height: 16,
|
128 | marginLeft: 8,
|
129 | borderRadius: '50%',
|
130 | display: 'inline-flex',
|
131 | alignItems: 'center',
|
132 | justifyContent: 'center'
|
133 | },
|
134 | statusLabel_done: {
|
135 | background: color.success
|
136 | },
|
137 | statusLabel_error: {
|
138 | background: color.alert
|
139 | },
|
140 | statusLabel__icon: {
|
141 | fill: color.white
|
142 | },
|
143 | errorMessage: {
|
144 | background: color.alertLight,
|
145 | marginTop: units(1.5),
|
146 | marginRight: units(-1.5),
|
147 | marginBottom: units(-1.5),
|
148 | marginLeft: units(-1.5),
|
149 | paddingTop: units(1),
|
150 | paddingRight: units(1.5),
|
151 | paddingBottom: units(1),
|
152 | paddingLeft: units(1.5)
|
153 | }
|
154 | };
|
155 | })(ConfigurationItem);
|
156 | ConfigurationItem.propTypes = propTypes;
|
157 | var _default = ConfigurationItemWithStyles;
|
158 | exports.default = _default; |
\ | No newline at end of file |