carbon-react 114.11.0 → 114.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/components/image/image.component.d.ts +1 -1
- package/esm/components/image/image.component.js +4 -1
- package/esm/components/image/image.style.d.ts +2 -0
- package/lib/components/image/image.component.d.ts +1 -1
- package/lib/components/image/image.component.js +4 -1
- package/lib/components/image/image.style.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { StyledImageProps } from "./image.style";
|
|
3
3
|
export declare const Image: {
|
|
4
|
-
({ alt, src, children, ...rest }: StyledImageProps): JSX.Element;
|
|
4
|
+
({ alt, decorative, src, children, ...rest }: StyledImageProps): JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
export default Image;
|
|
@@ -7,14 +7,16 @@ import { StyledImage } from "./image.style";
|
|
|
7
7
|
|
|
8
8
|
const Image = ({
|
|
9
9
|
alt,
|
|
10
|
+
decorative = false,
|
|
10
11
|
src,
|
|
11
12
|
children,
|
|
12
13
|
...rest
|
|
13
14
|
}) => {
|
|
14
15
|
!(!src || !children) ? process.env.NODE_ENV !== "production" ? invariant(false, "The 'Image' component renders as an 'img' element when the 'src' prop is used and therefore does not accept children.") : invariant(false) : void 0;
|
|
15
|
-
!(!src || alt && typeof alt === "string") ? process.env.NODE_ENV !== "production" ? invariant(false, "Please provide an 'alt' string when rendering the 'Image' component as an 'img' element.") : invariant(false) : void 0;
|
|
16
|
+
!(!src || alt && typeof alt === "string" || decorative) ? process.env.NODE_ENV !== "production" ? invariant(false, "Please use the 'decorative' prop if the 'alt' text should be an empty value or provide an 'alt' string when rendering the 'Image' component as an 'img' element.") : invariant(false) : void 0;
|
|
16
17
|
return /*#__PURE__*/React.createElement(StyledImage, _extends({
|
|
17
18
|
alt: alt,
|
|
19
|
+
decorative: decorative,
|
|
18
20
|
src: src
|
|
19
21
|
}, rest), children);
|
|
20
22
|
};
|
|
@@ -527,6 +529,7 @@ Image.propTypes = {
|
|
|
527
529
|
"valueOf": PropTypes.func.isRequired
|
|
528
530
|
}), PropTypes.string]),
|
|
529
531
|
"children": PropTypes.node,
|
|
532
|
+
"decorative": PropTypes.bool,
|
|
530
533
|
"display": PropTypes.oneOfType([PropTypes.oneOf(["-moz-initial", "-ms-flexbox", "-ms-grid", "-ms-inline-flexbox", "-ms-inline-grid", "-webkit-flex", "-webkit-inline-flex", "block", "contents", "flex", "flow-root", "flow", "grid", "inherit", "initial", "inline-block", "inline-flex", "inline-grid", "inline-list-item", "inline-table", "inline", "list-item", "none", "revert", "ruby-base-container", "ruby-base", "ruby-text-container", "ruby-text", "ruby", "run-in", "table-caption", "table-cell", "table-column-group", "table-column", "table-footer-group", "table-header-group", "table-row-group", "table-row", "table", "unset"]), PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf(["-moz-initial", "-ms-flexbox", "-ms-grid", "-ms-inline-flexbox", "-ms-inline-grid", "-webkit-flex", "-webkit-inline-flex", "block", "contents", "flex", "flow-root", "flow", "grid", "inherit", "initial", "inline-block", "inline-flex", "inline-grid", "inline-list-item", "inline-table", "inline", "list-item", "none", "revert", "ruby-base-container", "ruby-base", "ruby-text-container", "ruby-text", "ruby", "run-in", "table-caption", "table-cell", "table-column-group", "table-column", "table-footer-group", "table-header-group", "table-row-group", "table-row", "table", "unset", null]), PropTypes.shape({
|
|
531
534
|
"__@iterator": PropTypes.func.isRequired,
|
|
532
535
|
"anchor": PropTypes.func.isRequired,
|
|
@@ -3,6 +3,8 @@ import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
|
|
|
3
3
|
export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutProps {
|
|
4
4
|
/** HTML alt property to display when an img fails to load */
|
|
5
5
|
alt?: string;
|
|
6
|
+
/** Prop to specify if the image is decorative */
|
|
7
|
+
decorative?: boolean;
|
|
6
8
|
/** Any valid file path, passing this will render the component as an img element */
|
|
7
9
|
src?: string;
|
|
8
10
|
/** HTML hidden property to indicate whether to remain hidden visually and from screen readers */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { StyledImageProps } from "./image.style";
|
|
3
3
|
export declare const Image: {
|
|
4
|
-
({ alt, src, children, ...rest }: StyledImageProps): JSX.Element;
|
|
4
|
+
({ alt, decorative, src, children, ...rest }: StyledImageProps): JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
export default Image;
|
|
@@ -19,14 +19,16 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
19
19
|
|
|
20
20
|
const Image = ({
|
|
21
21
|
alt,
|
|
22
|
+
decorative = false,
|
|
22
23
|
src,
|
|
23
24
|
children,
|
|
24
25
|
...rest
|
|
25
26
|
}) => {
|
|
26
27
|
!(!src || !children) ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "The 'Image' component renders as an 'img' element when the 'src' prop is used and therefore does not accept children.") : (0, _invariant.default)(false) : void 0;
|
|
27
|
-
!(!src || alt && typeof alt === "string") ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "Please provide an 'alt' string when rendering the 'Image' component as an 'img' element.") : (0, _invariant.default)(false) : void 0;
|
|
28
|
+
!(!src || alt && typeof alt === "string" || decorative) ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "Please use the 'decorative' prop if the 'alt' text should be an empty value or provide an 'alt' string when rendering the 'Image' component as an 'img' element.") : (0, _invariant.default)(false) : void 0;
|
|
28
29
|
return /*#__PURE__*/_react.default.createElement(_image.StyledImage, _extends({
|
|
29
30
|
alt: alt,
|
|
31
|
+
decorative: decorative,
|
|
30
32
|
src: src
|
|
31
33
|
}, rest), children);
|
|
32
34
|
};
|
|
@@ -540,6 +542,7 @@ Image.propTypes = {
|
|
|
540
542
|
"valueOf": _propTypes.default.func.isRequired
|
|
541
543
|
}), _propTypes.default.string]),
|
|
542
544
|
"children": _propTypes.default.node,
|
|
545
|
+
"decorative": _propTypes.default.bool,
|
|
543
546
|
"display": _propTypes.default.oneOfType([_propTypes.default.oneOf(["-moz-initial", "-ms-flexbox", "-ms-grid", "-ms-inline-flexbox", "-ms-inline-grid", "-webkit-flex", "-webkit-inline-flex", "block", "contents", "flex", "flow-root", "flow", "grid", "inherit", "initial", "inline-block", "inline-flex", "inline-grid", "inline-list-item", "inline-table", "inline", "list-item", "none", "revert", "ruby-base-container", "ruby-base", "ruby-text-container", "ruby-text", "ruby", "run-in", "table-caption", "table-cell", "table-column-group", "table-column", "table-footer-group", "table-header-group", "table-row-group", "table-row", "table", "unset"]), _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf(["-moz-initial", "-ms-flexbox", "-ms-grid", "-ms-inline-flexbox", "-ms-inline-grid", "-webkit-flex", "-webkit-inline-flex", "block", "contents", "flex", "flow-root", "flow", "grid", "inherit", "initial", "inline-block", "inline-flex", "inline-grid", "inline-list-item", "inline-table", "inline", "list-item", "none", "revert", "ruby-base-container", "ruby-base", "ruby-text-container", "ruby-text", "ruby", "run-in", "table-caption", "table-cell", "table-column-group", "table-column", "table-footer-group", "table-header-group", "table-row-group", "table-row", "table", "unset", null]), _propTypes.default.shape({
|
|
544
547
|
"__@iterator": _propTypes.default.func.isRequired,
|
|
545
548
|
"anchor": _propTypes.default.func.isRequired,
|
|
@@ -3,6 +3,8 @@ import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
|
|
|
3
3
|
export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutProps {
|
|
4
4
|
/** HTML alt property to display when an img fails to load */
|
|
5
5
|
alt?: string;
|
|
6
|
+
/** Prop to specify if the image is decorative */
|
|
7
|
+
decorative?: boolean;
|
|
6
8
|
/** Any valid file path, passing this will render the component as an img element */
|
|
7
9
|
src?: string;
|
|
8
10
|
/** HTML hidden property to indicate whether to remain hidden visually and from screen readers */
|