UNPKG

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