UNPKG

2 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
8
9var _react = require('react');
10
11var _react2 = _interopRequireDefault(_react);
12
13var _classnames = require('classnames');
14
15var _classnames2 = _interopRequireDefault(_classnames);
16
17var _utils = require('./utils');
18
19function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
21function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
22
23var propTypes = {
24 children: _react.PropTypes.node,
25 row: _react.PropTypes.bool,
26 check: _react.PropTypes.bool,
27 disabled: _react.PropTypes.bool,
28 tag: _react.PropTypes.string,
29 color: _react.PropTypes.string,
30 className: _react.PropTypes.string,
31 cssModule: _react.PropTypes.object
32};
33
34var defaultProps = {
35 tag: 'div'
36};
37
38var FormGroup = function FormGroup(props) {
39 var className = props.className,
40 cssModule = props.cssModule,
41 row = props.row,
42 disabled = props.disabled,
43 color = props.color,
44 check = props.check,
45 Tag = props.tag,
46 attributes = _objectWithoutProperties(props, ['className', 'cssModule', 'row', 'disabled', 'color', 'check', 'tag']);
47
48 var classes = (0, _utils.mapToCssModules)((0, _classnames2.default)(className, color ? 'has-' + color : false, row ? 'row' : false, check ? 'form-check' : 'form-group', check && disabled ? 'disabled' : false), cssModule);
49
50 return _react2.default.createElement(Tag, _extends({}, attributes, { className: classes }));
51};
52
53FormGroup.propTypes = propTypes;
54FormGroup.defaultProps = defaultProps;
55
56exports.default = FormGroup;
\No newline at end of file