GoScrobble/web/node_modules/reactstrap/es/Row.js

55 lines
1.7 KiB
JavaScript

import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './utils';
var rowColWidths = ['xs', 'sm', 'md', 'lg', 'xl'];
var rowColsPropType = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
var propTypes = {
tag: tagPropType,
noGutters: PropTypes.bool,
className: PropTypes.string,
cssModule: PropTypes.object,
form: PropTypes.bool,
xs: rowColsPropType,
sm: rowColsPropType,
md: rowColsPropType,
lg: rowColsPropType,
xl: rowColsPropType
};
var defaultProps = {
tag: 'div',
widths: rowColWidths
};
var Row = function Row(props) {
var className = props.className,
cssModule = props.cssModule,
noGutters = props.noGutters,
Tag = props.tag,
form = props.form,
widths = props.widths,
attributes = _objectWithoutPropertiesLoose(props, ["className", "cssModule", "noGutters", "tag", "form", "widths"]);
var colClasses = [];
widths.forEach(function (colWidth, i) {
var colSize = props[colWidth];
delete attributes[colWidth];
if (!colSize) {
return;
}
var isXs = !i;
colClasses.push(isXs ? "row-cols-" + colSize : "row-cols-" + colWidth + "-" + colSize);
});
var classes = mapToCssModules(classNames(className, noGutters ? 'no-gutters' : null, form ? 'form-row' : 'row', colClasses), cssModule);
return /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, {
className: classes
}));
};
Row.propTypes = propTypes;
Row.defaultProps = defaultProps;
export default Row;