1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import classNames from 'classnames';
|
6 | import { mapToCssModules, tagPropType } from './utils';
|
7 | var propTypes = {
|
8 | children: PropTypes.node,
|
9 | row: PropTypes.bool,
|
10 | check: PropTypes.bool,
|
11 | inline: PropTypes.bool,
|
12 | disabled: PropTypes.bool,
|
13 | tag: tagPropType,
|
14 | className: PropTypes.string,
|
15 | cssModule: PropTypes.object
|
16 | };
|
17 | var defaultProps = {
|
18 | tag: 'div'
|
19 | };
|
20 |
|
21 | var FormGroup = function FormGroup(props) {
|
22 | var className = props.className,
|
23 | cssModule = props.cssModule,
|
24 | row = props.row,
|
25 | disabled = props.disabled,
|
26 | check = props.check,
|
27 | inline = props.inline,
|
28 | Tag = props.tag,
|
29 | attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "row", "disabled", "check", "inline", "tag"]);
|
30 |
|
31 | var classes = mapToCssModules(classNames(className, row ? 'row' : false, check ? 'form-check' : 'form-group', check && inline ? 'form-check-inline' : false, check && disabled ? 'disabled' : false), cssModule);
|
32 |
|
33 | if (Tag === 'fieldset') {
|
34 | attributes.disabled = disabled;
|
35 | }
|
36 |
|
37 | return React.createElement(Tag, _extends({}, attributes, {
|
38 | className: classes
|
39 | }));
|
40 | };
|
41 |
|
42 | FormGroup.propTypes = propTypes;
|
43 | FormGroup.defaultProps = defaultProps;
|
44 | export default FormGroup; |
\ | No newline at end of file |