1 | "use client";
|
2 |
|
3 | import classNames from 'classnames';
|
4 | import * as React from 'react';
|
5 | import { useBootstrapPrefix, useBootstrapBreakpoints, useBootstrapMinBreakpoint } from './ThemeProvider';
|
6 | import { jsx as _jsx } from "react/jsx-runtime";
|
7 | const Row = React.forwardRef(({
|
8 | bsPrefix,
|
9 | className,
|
10 |
|
11 | as: Component = 'div',
|
12 | ...props
|
13 | }, ref) => {
|
14 | const decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'row');
|
15 | const breakpoints = useBootstrapBreakpoints();
|
16 | const minBreakpoint = useBootstrapMinBreakpoint();
|
17 | const sizePrefix = `${decoratedBsPrefix}-cols`;
|
18 | const classes = [];
|
19 | breakpoints.forEach(brkPoint => {
|
20 | const propValue = props[brkPoint];
|
21 | delete props[brkPoint];
|
22 | let cols;
|
23 | if (propValue != null && typeof propValue === 'object') {
|
24 | ({
|
25 | cols
|
26 | } = propValue);
|
27 | } else {
|
28 | cols = propValue;
|
29 | }
|
30 | const infix = brkPoint !== minBreakpoint ? `-${brkPoint}` : '';
|
31 | if (cols != null) classes.push(`${sizePrefix}${infix}-${cols}`);
|
32 | });
|
33 | return _jsx(Component, {
|
34 | ref: ref,
|
35 | ...props,
|
36 | className: classNames(className, decoratedBsPrefix, ...classes)
|
37 | });
|
38 | });
|
39 | Row.displayName = 'Row';
|
40 | export default Row; |
\ | No newline at end of file |