1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | var _excluded = ["bsPrefix", "inline", "className", "validated", "as"];
|
4 | import classNames from 'classnames';
|
5 | import React from 'react';
|
6 | import FormCheck from './FormCheck';
|
7 | import FormFile from './FormFile';
|
8 | import FormControl from './FormControl';
|
9 | import FormGroup from './FormGroup';
|
10 | import FormLabel from './FormLabel';
|
11 | import FormText from './FormText';
|
12 | import Switch from './Switch';
|
13 | import { useBootstrapPrefix } from './ThemeProvider';
|
14 | import createWithBsPrefix from './createWithBsPrefix';
|
15 | var FormRow = createWithBsPrefix('form-row');
|
16 | var defaultProps = {
|
17 | inline: false
|
18 | };
|
19 | var FormImpl = React.forwardRef(function (_ref, ref) {
|
20 | var bsPrefix = _ref.bsPrefix,
|
21 | inline = _ref.inline,
|
22 | className = _ref.className,
|
23 | validated = _ref.validated,
|
24 | _ref$as = _ref.as,
|
25 | Component = _ref$as === void 0 ? 'form' : _ref$as,
|
26 | props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
27 |
|
28 | bsPrefix = useBootstrapPrefix(bsPrefix, 'form');
|
29 | return React.createElement(Component, _extends({}, props, {
|
30 | ref: ref,
|
31 | className: classNames(className, validated && 'was-validated', inline && bsPrefix + "-inline")
|
32 | }));
|
33 | });
|
34 | FormImpl.displayName = 'Form';
|
35 | FormImpl.defaultProps = defaultProps;
|
36 | FormImpl.Row = FormRow;
|
37 | FormImpl.Group = FormGroup;
|
38 | FormImpl.Control = FormControl;
|
39 | FormImpl.Check = FormCheck;
|
40 | FormImpl.File = FormFile;
|
41 | FormImpl.Switch = Switch;
|
42 | FormImpl.Label = FormLabel;
|
43 | FormImpl.Text = FormText;
|
44 | export default FormImpl; |
\ | No newline at end of file |