GoScrobble/web/node_modules/react-bootstrap/esm/Row.js

44 lines
1.5 KiB
JavaScript
Raw Normal View History

2022-04-25 02:47:15 +00:00
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
var _excluded = ["bsPrefix", "className", "noGutters", "as"];
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 = /*#__PURE__*/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, _excluded);
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;