1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
3 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
4 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
5 | import _inherits from 'babel-runtime/helpers/inherits';
|
6 | import classNames from 'classnames';
|
7 | import React from 'react';
|
8 | import PropTypes from 'prop-types';
|
9 | import elementType from 'prop-types-extra/lib/elementType';
|
10 |
|
11 | import { bsClass, prefix, splitBsProps } from './utils/bootstrapUtils';
|
12 |
|
13 | var propTypes = {
|
14 | horizontal: PropTypes.bool,
|
15 | inline: PropTypes.bool,
|
16 | componentClass: elementType
|
17 | };
|
18 |
|
19 | var defaultProps = {
|
20 | horizontal: false,
|
21 | inline: false,
|
22 | componentClass: 'form'
|
23 | };
|
24 |
|
25 | var Form = function (_React$Component) {
|
26 | _inherits(Form, _React$Component);
|
27 |
|
28 | function Form() {
|
29 | _classCallCheck(this, Form);
|
30 |
|
31 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
32 | }
|
33 |
|
34 | Form.prototype.render = function render() {
|
35 | var _props = this.props,
|
36 | horizontal = _props.horizontal,
|
37 | inline = _props.inline,
|
38 | Component = _props.componentClass,
|
39 | className = _props.className,
|
40 | props = _objectWithoutProperties(_props, ['horizontal', 'inline', 'componentClass', 'className']);
|
41 |
|
42 | var _splitBsProps = splitBsProps(props),
|
43 | bsProps = _splitBsProps[0],
|
44 | elementProps = _splitBsProps[1];
|
45 |
|
46 | var classes = [];
|
47 | if (horizontal) {
|
48 | classes.push(prefix(bsProps, 'horizontal'));
|
49 | }
|
50 | if (inline) {
|
51 | classes.push(prefix(bsProps, 'inline'));
|
52 | }
|
53 |
|
54 | return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) }));
|
55 | };
|
56 |
|
57 | return Form;
|
58 | }(React.Component);
|
59 |
|
60 | Form.propTypes = propTypes;
|
61 | Form.defaultProps = defaultProps;
|
62 |
|
63 | export default bsClass('form', Form); |
\ | No newline at end of file |