UNPKG

1.7 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3var _excluded = ["bsPrefix", "className", "fluid", "rounded", "roundedCircle", "thumbnail"];
4import classNames from 'classnames';
5import React from 'react';
6import PropTypes from 'prop-types';
7import { useBootstrapPrefix } from './ThemeProvider';
8export var propTypes = {
9 /**
10 * @default 'img'
11 */
12 bsPrefix: PropTypes.string,
13
14 /**
15 * Sets image as fluid image.
16 */
17 fluid: PropTypes.bool,
18
19 /**
20 * Sets image shape as rounded.
21 */
22 rounded: PropTypes.bool,
23
24 /**
25 * Sets image shape as circle.
26 */
27 roundedCircle: PropTypes.bool,
28
29 /**
30 * Sets image shape as thumbnail.
31 */
32 thumbnail: PropTypes.bool
33};
34var defaultProps = {
35 fluid: false,
36 rounded: false,
37 roundedCircle: false,
38 thumbnail: false
39};
40var Image = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
41 var bsPrefix = _ref.bsPrefix,
42 className = _ref.className,
43 fluid = _ref.fluid,
44 rounded = _ref.rounded,
45 roundedCircle = _ref.roundedCircle,
46 thumbnail = _ref.thumbnail,
47 props = _objectWithoutPropertiesLoose(_ref, _excluded);
48
49 bsPrefix = useBootstrapPrefix(bsPrefix, 'img');
50 var classes = classNames(fluid && bsPrefix + "-fluid", rounded && "rounded", roundedCircle && "rounded-circle", thumbnail && bsPrefix + "-thumbnail");
51 return /*#__PURE__*/React.createElement("img", _extends({
52 // eslint-disable-line jsx-a11y/alt-text
53 ref: ref
54 }, props, {
55 className: classNames(className, classes)
56 }));
57});
58Image.displayName = 'Image';
59Image.defaultProps = defaultProps;
60export default Image;
\No newline at end of file