1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | var _excluded = ["bsPrefix", "className", "noGutters", "as"];
|
4 | import classNames from 'classnames';
|
5 | import React from 'react';
|
6 | import { useBootstrapPrefix } from './ThemeProvider';
|
7 | var DEVICE_SIZES = ['xl', 'lg', 'md', 'sm', 'xs'];
|
8 | var defaultProps = {
|
9 | noGutters: false
|
10 | };
|
11 | var Row = React.forwardRef(function (_ref, ref) {
|
12 | var bsPrefix = _ref.bsPrefix,
|
13 | className = _ref.className,
|
14 | noGutters = _ref.noGutters,
|
15 | _ref$as = _ref.as,
|
16 | Component = _ref$as === void 0 ? 'div' : _ref$as,
|
17 | props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
18 |
|
19 | var decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'row');
|
20 | var sizePrefix = decoratedBsPrefix + "-cols";
|
21 | var classes = [];
|
22 | DEVICE_SIZES.forEach(function (brkPoint) {
|
23 | var propValue = props[brkPoint];
|
24 | delete props[brkPoint];
|
25 | var cols;
|
26 |
|
27 | if (propValue != null && typeof propValue === 'object') {
|
28 | cols = propValue.cols;
|
29 | } else {
|
30 | cols = propValue;
|
31 | }
|
32 |
|
33 | var infix = brkPoint !== 'xs' ? "-" + brkPoint : '';
|
34 | if (cols != null) classes.push("" + sizePrefix + infix + "-" + cols);
|
35 | });
|
36 | return React.createElement(Component, _extends({
|
37 | ref: ref
|
38 | }, props, {
|
39 | className: classNames.apply(void 0, [className, decoratedBsPrefix, noGutters && 'no-gutters'].concat(classes))
|
40 | }));
|
41 | });
|
42 | Row.displayName = 'Row';
|
43 | Row.defaultProps = defaultProps;
|
44 | export default Row; |
\ | No newline at end of file |