1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | var _excluded = ["bsPrefix", "className", "children", "aspectRatio"];
|
4 | import classNames from 'classnames';
|
5 | import React from 'react';
|
6 | import { useBootstrapPrefix } from './ThemeProvider';
|
7 | var defaultProps = {
|
8 | aspectRatio: '1by1'
|
9 | };
|
10 | var ResponsiveEmbed = React.forwardRef(function (_ref, ref) {
|
11 | var bsPrefix = _ref.bsPrefix,
|
12 | className = _ref.className,
|
13 | children = _ref.children,
|
14 | aspectRatio = _ref.aspectRatio,
|
15 | props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
16 |
|
17 | var decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'embed-responsive');
|
18 | var child = React.Children.only(children);
|
19 | return React.createElement("div", _extends({
|
20 | ref: ref
|
21 | }, props, {
|
22 | className: classNames(decoratedBsPrefix, className, aspectRatio && decoratedBsPrefix + "-" + aspectRatio)
|
23 | }), React.cloneElement(child, {
|
24 | className: classNames(child.props.className, decoratedBsPrefix + "-item")
|
25 | }));
|
26 | });
|
27 | ResponsiveEmbed.defaultProps = defaultProps;
|
28 | export default ResponsiveEmbed; |
\ | No newline at end of file |