UNPKG

1.45 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var tslib_1 = require("tslib");
4/** @jsx jsx */
5var core_1 = require("@emotion/core");
6var react_1 = tslib_1.__importDefault(require("react"));
7var constants_1 = require("@kalamazoo/theme/constants");
8exports.groupItemStyles = {
9 flex: '1 0 auto',
10 display: 'flex',
11 /* margins don't flip when the layout uses dir="rtl", whereas pseudos do */
12 '& + &::before': {
13 content: "''",
14 display: 'inline-block',
15 width: constants_1.gridSize() / 2 + "px",
16 },
17};
18var ButtonGroup = /** @class */ (function (_super) {
19 tslib_1.__extends(ButtonGroup, _super);
20 function ButtonGroup() {
21 return _super !== null && _super.apply(this, arguments) || this;
22 }
23 ButtonGroup.prototype.render = function () {
24 var _a = this.props, appearance = _a.appearance, children = _a.children;
25 return (core_1.jsx("div", { css: { display: 'inline-flex' } }, react_1.default.Children.map(children, function (child, idx) {
26 if (!child) {
27 return null;
28 }
29 return (core_1.jsx("div", { key: idx, css: exports.groupItemStyles }, appearance
30 ? react_1.default.cloneElement(child, { appearance: appearance })
31 : child));
32 })));
33 };
34 return ButtonGroup;
35}(react_1.default.Component));
36exports.default = ButtonGroup;
37//# sourceMappingURL=ButtonGroup.js.map
\No newline at end of file