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