Files
2026-04-05 16:14:49 -04:00

63 lines
1.8 KiB
JavaScript

import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import elementType from 'prop-types-extra/lib/elementType';
import { bsClass, prefix, splitBsProps } from './utils/bootstrapUtils';
var propTypes = {
horizontal: PropTypes.bool,
inline: PropTypes.bool,
componentClass: elementType
};
var defaultProps = {
horizontal: false,
inline: false,
componentClass: 'form'
};
var Form =
/*#__PURE__*/
function (_React$Component) {
_inheritsLoose(Form, _React$Component);
function Form() {
return _React$Component.apply(this, arguments) || this;
}
var _proto = Form.prototype;
_proto.render = function render() {
var _this$props = this.props,
horizontal = _this$props.horizontal,
inline = _this$props.inline,
Component = _this$props.componentClass,
className = _this$props.className,
props = _objectWithoutPropertiesLoose(_this$props, ["horizontal", "inline", "componentClass", "className"]);
var _splitBsProps = splitBsProps(props),
bsProps = _splitBsProps[0],
elementProps = _splitBsProps[1];
var classes = [];
if (horizontal) {
classes.push(prefix(bsProps, 'horizontal'));
}
if (inline) {
classes.push(prefix(bsProps, 'inline'));
}
return React.createElement(Component, _extends({}, elementProps, {
className: classNames(className, classes)
}));
};
return Form;
}(React.Component);
Form.propTypes = propTypes;
Form.defaultProps = defaultProps;
export default bsClass('form', Form);