1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 | var _react = _interopRequireDefault(require("react"));
|
8 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
9 | var _classnames = _interopRequireDefault(require("classnames"));
|
10 | var _utils = require("./utils");
|
11 | const _excluded = ["className", "cssModule", "noGutters", "tag", "widths"];
|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13 | function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
14 | function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
15 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
16 | const rowColWidths = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
|
17 | const rowColsPropType = _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]);
|
18 | const propTypes = {
|
19 | tag: _utils.tagPropType,
|
20 | noGutters: (0, _utils.deprecated)(_propTypes.default.bool, 'Please use Bootstrap 5 gutter utility classes. https://getbootstrap.com/docs/5.0/layout/gutters/'),
|
21 | className: _propTypes.default.string,
|
22 | cssModule: _propTypes.default.object,
|
23 | xs: rowColsPropType,
|
24 | sm: rowColsPropType,
|
25 | md: rowColsPropType,
|
26 | lg: rowColsPropType,
|
27 | xl: rowColsPropType,
|
28 | xxl: rowColsPropType,
|
29 | widths: _propTypes.default.array
|
30 | };
|
31 | function Row(props) {
|
32 | const {
|
33 | className,
|
34 | cssModule,
|
35 | noGutters,
|
36 | tag: Tag = 'div',
|
37 | widths = rowColWidths
|
38 | } = props,
|
39 | attributes = _objectWithoutProperties(props, _excluded);
|
40 | const colClasses = [];
|
41 | widths.forEach((colWidth, i) => {
|
42 | let colSize = props[colWidth];
|
43 | delete attributes[colWidth];
|
44 | if (!colSize) {
|
45 | return;
|
46 | }
|
47 | const isXs = !i;
|
48 | colClasses.push(isXs ? `row-cols-${colSize}` : `row-cols-${colWidth}-${colSize}`);
|
49 | });
|
50 | const classes = (0, _utils.mapToCssModules)((0, _classnames.default)(className, noGutters ? 'gx-0' : null, 'row', colClasses), cssModule);
|
51 | return _react.default.createElement(Tag, _extends({}, attributes, {
|
52 | className: classes
|
53 | }));
|
54 | }
|
55 | Row.propTypes = propTypes;
|
56 | var _default = Row;
|
57 | exports.default = _default; |
\ | No newline at end of file |