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 _withStyles = require("../helpers/withStyles");
|
11 |
|
12 | var _PageHeader = _interopRequireDefault(require("./PageHeader"));
|
13 |
|
14 | var _Wrapper = _interopRequireDefault(require("./Wrapper"));
|
15 |
|
16 | var _Spacing = _interopRequireDefault(require("./Spacing"));
|
17 |
|
18 | var _Grid = _interopRequireDefault(require("./Grid"));
|
19 |
|
20 | var _Cell = _interopRequireDefault(require("./Cell"));
|
21 |
|
22 | var _Text = _interopRequireDefault(require("./Text"));
|
23 |
|
24 | var _Icon = _interopRequireDefault(require("./Icon"));
|
25 |
|
26 | var _FlatButton = _interopRequireDefault(require("./FlatButton"));
|
27 |
|
28 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29 |
|
30 | 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; } }
|
31 |
|
32 | 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; }
|
33 |
|
34 | 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); }
|
35 |
|
36 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
37 |
|
38 | 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); } }
|
39 |
|
40 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
41 |
|
42 | function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
43 |
|
44 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
45 |
|
46 | function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
47 |
|
48 | 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); }
|
49 |
|
50 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
51 |
|
52 | var ConfigurationBox =
|
53 |
|
54 | function (_Component) {
|
55 | _inherits(ConfigurationBox, _Component);
|
56 |
|
57 | function ConfigurationBox() {
|
58 | _classCallCheck(this, ConfigurationBox);
|
59 |
|
60 | return _possibleConstructorReturn(this, _getPrototypeOf(ConfigurationBox).apply(this, arguments));
|
61 | }
|
62 |
|
63 | _createClass(ConfigurationBox, [{
|
64 | key: "render",
|
65 | value: function render() {
|
66 | var _this$props = this.props,
|
67 | actions = _this$props.actions,
|
68 | children = _this$props.children,
|
69 | closable = _this$props.closable,
|
70 | css = _this$props.css,
|
71 | description = _this$props.description,
|
72 | header = _this$props.header,
|
73 | onClose = _this$props.onClose,
|
74 | styles = _this$props.styles,
|
75 | title = _this$props.title;
|
76 | return _react.default.createElement("div", css(styles.configurationBox), _react.default.createElement("div", css(styles.configurationBox__header), _react.default.createElement(_Grid.default, {
|
77 | center: true
|
78 | }, _react.default.createElement(_Cell.default, {
|
79 | auto: true,
|
80 | noSpacing: true
|
81 | }, _react.default.createElement(_PageHeader.default, {
|
82 | title: title,
|
83 | description: description,
|
84 | level: 2,
|
85 | removeMargin: true,
|
86 | removeDescriptionSpacing: description != null
|
87 | }, actions)), closable && _react.default.createElement(_Cell.default, {
|
88 | shrink: true,
|
89 | noSpacing: true
|
90 | }, _react.default.createElement("div", css(styles.closeButtonContainer), _react.default.createElement(_FlatButton.default, {
|
91 | transparent: true,
|
92 | icon: _react.default.createElement(_Icon.default, {
|
93 | name: "error",
|
94 | large: true
|
95 | }),
|
96 | onClick: function onClick() {
|
97 | return onClose && onClose();
|
98 | }
|
99 | }))))), _react.default.createElement("div", css(styles.configurationBox__body), header && Array.isArray(header) && header.length > 0 && _react.default.createElement("div", css(styles.configurationBox__header), _react.default.createElement(_Grid.default, {
|
100 | resetSpacing: true
|
101 | }, header.map(function (headerItem, count) {
|
102 | return _react.default.createElement(_Cell.default, {
|
103 | size: 12,
|
104 | key: count,
|
105 | shrinkOnMedium: true
|
106 | }, _react.default.createElement("div", css(styles.configurationBox__header__item, styles.padded, count + 1 < header.length && styles.borderRight), _react.default.createElement(_Text.default, {
|
107 | bold: true
|
108 | }, headerItem.label), _react.default.createElement(_Text.default, {
|
109 | large: true
|
110 | }, headerItem.content)));
|
111 | }))), _react.default.createElement(_Spacing.default, {
|
112 | top: 2
|
113 | }, _react.default.createElement(_Wrapper.default, null, children))));
|
114 | }
|
115 | }]);
|
116 |
|
117 | return ConfigurationBox;
|
118 | }(_react.Component);
|
119 |
|
120 | var ConfigurationBoxWithStyles = (0, _withStyles.withStyles)(function (_ref) {
|
121 | var color = _ref.color,
|
122 | units = _ref.units,
|
123 | radius = _ref.radius,
|
124 | font = _ref.font,
|
125 | breakpoint = _ref.breakpoint;
|
126 | return {
|
127 | configurationBox: {
|
128 | display: 'flex',
|
129 | flexDirection: 'column',
|
130 | height: '100%',
|
131 | fontFamily: font.default
|
132 | },
|
133 | configurationBox__header: _defineProperty({
|
134 | paddingRight: units(1.5),
|
135 | paddingLeft: units(1.5),
|
136 | borderBottomWidth: 1,
|
137 | borderBottomColor: color.blueGrayLight,
|
138 | borderBottomStyle: 'solid',
|
139 | background: color.white
|
140 | }, breakpoint.large, {
|
141 | paddingRight: units(3),
|
142 | paddingLeft: units(3)
|
143 | }),
|
144 | configurationBox__header__item: {
|
145 | paddingRight: units(2)
|
146 | },
|
147 | padded: _defineProperty({
|
148 | paddingTop: units(.5),
|
149 | paddingBottom: units(.5)
|
150 | }, breakpoint.mediumAndAbove, {
|
151 | paddingTop: units(1),
|
152 | paddingBottom: units(1)
|
153 | }),
|
154 | borderRight: _defineProperty({}, breakpoint.mediumAndAbove, {
|
155 | borderRightWidth: 1,
|
156 | borderRightColor: color.blueGrayLight,
|
157 | borderRightStyle: 'solid'
|
158 | }),
|
159 | configurationBox__body: {
|
160 | flex: 1,
|
161 | background: color.blueGrayLightest,
|
162 | overflow: 'auto',
|
163 | paddingBottom: units(4)
|
164 | },
|
165 | configurationBox__bullet: {
|
166 | width: 6,
|
167 | height: 6,
|
168 | background: color.grayDarker,
|
169 | borderRadius: '50%',
|
170 | marginTop: 8
|
171 | },
|
172 | closeButtonContainer: _defineProperty({
|
173 | position: 'absolute',
|
174 | right: units(1),
|
175 | top: units(1)
|
176 | }, breakpoint.mediumAndAbove, {
|
177 | position: 'static',
|
178 | borderLeftWidth: 1,
|
179 | borderLeftColor: color.blueGray,
|
180 | borderLeftStyle: 'solid',
|
181 | marginLeft: 16,
|
182 | paddingLeft: 8
|
183 | })
|
184 | };
|
185 | })(ConfigurationBox);
|
186 | var _default = ConfigurationBoxWithStyles;
|
187 | exports.default = _default; |
\ | No newline at end of file |