|
12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import _extends from "@babel/runtime/helpers/esm/extends";
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
- import classNames from 'classnames';
- import React from 'react';
- import { useBootstrapPrefix } from './ThemeProvider';
- var DEVICE_SIZES = ['xl', 'lg', 'md', 'sm', 'xs'];
- var defaultProps = {
- noGutters: false
- };
- var Row = React.forwardRef(function (_ref, ref) {
- var bsPrefix = _ref.bsPrefix,
- className = _ref.className,
- noGutters = _ref.noGutters,
- _ref$as = _ref.as,
- Component = _ref$as === void 0 ? 'div' : _ref$as,
- props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "className", "noGutters", "as"]);
-
- var decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'row');
- var sizePrefix = decoratedBsPrefix + "-cols";
- var classes = [];
- DEVICE_SIZES.forEach(function (brkPoint) {
- var propValue = props[brkPoint];
- delete props[brkPoint];
- var cols;
-
- if (propValue != null && typeof propValue === 'object') {
- cols = propValue.cols;
- } else {
- cols = propValue;
- }
-
- var infix = brkPoint !== 'xs' ? "-" + brkPoint : '';
- if (cols != null) classes.push("" + sizePrefix + infix + "-" + cols);
- });
- return /*#__PURE__*/React.createElement(Component, _extends({
- ref: ref
- }, props, {
- className: classNames.apply(void 0, [className, decoratedBsPrefix, noGutters && 'no-gutters'].concat(classes))
- }));
- });
- Row.displayName = 'Row';
- Row.defaultProps = defaultProps;
- export default Row;
|