UNPKG

1.97 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3import * as React from 'react';
4import PropTypes from 'prop-types';
5import clsx from 'clsx';
6import withStyles from '../styles/withStyles';
7export const styles = {
8 /* Styles applied to the root element. */
9 root: {
10 display: 'flex',
11 flexDirection: 'column',
12 flexWrap: 'wrap'
13 },
14
15 /* Styles applied to the root element if `row={true}`. */
16 row: {
17 flexDirection: 'row'
18 }
19};
20/**
21 * `FormGroup` wraps controls such as `Checkbox` and `Switch`.
22 * It provides compact row layout.
23 * For the `Radio`, you should be using the `RadioGroup` component instead of this one.
24 */
25
26const FormGroup = /*#__PURE__*/React.forwardRef(function FormGroup(props, ref) {
27 const {
28 classes,
29 className,
30 row = false
31 } = props,
32 other = _objectWithoutPropertiesLoose(props, ["classes", "className", "row"]);
33
34 return /*#__PURE__*/React.createElement("div", _extends({
35 className: clsx(classes.root, className, row && classes.row),
36 ref: ref
37 }, other));
38});
39process.env.NODE_ENV !== "production" ? FormGroup.propTypes = {
40 // ----------------------------- Warning --------------------------------
41 // | These PropTypes are generated from the TypeScript type definitions |
42 // | To update them edit the d.ts file and run "yarn proptypes" |
43 // ----------------------------------------------------------------------
44
45 /**
46 * The content of the component.
47 */
48 children: PropTypes.node,
49
50 /**
51 * Override or extend the styles applied to the component.
52 * See [CSS API](#css) below for more details.
53 */
54 classes: PropTypes.object,
55
56 /**
57 * @ignore
58 */
59 className: PropTypes.string,
60
61 /**
62 * Display group of elements in a compact row.
63 */
64 row: PropTypes.bool
65} : void 0;
66export default withStyles(styles, {
67 name: 'MuiFormGroup'
68})(FormGroup);
\No newline at end of file