@box/blueprint-web 12.121.0 → 12.122.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.
|
@@ -1,37 +1,44 @@
|
|
|
1
|
-
import { jsxs,
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { forwardRef, useState } from 'react';
|
|
3
|
+
import { forwardRef, useState, createElement } from 'react';
|
|
4
4
|
import { Ghost } from '../ghost/ghost.js';
|
|
5
5
|
import styles from './content-card.module.js';
|
|
6
6
|
|
|
7
7
|
const ContentCardImage = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
8
8
|
const {
|
|
9
9
|
className,
|
|
10
|
+
icon,
|
|
10
11
|
variant,
|
|
11
12
|
...rest
|
|
12
13
|
} = props;
|
|
13
14
|
const [isImageLoaded, setIsImageLoaded] = useState(false);
|
|
14
15
|
/* eslint-disable jsx-a11y/alt-text */
|
|
15
|
-
return
|
|
16
|
+
return jsx("div", {
|
|
16
17
|
className: variant === 'background' ? styles.cardBackground : styles.cardIcon,
|
|
17
|
-
children:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
children: icon ? (/*#__PURE__*/createElement(icon, {
|
|
19
|
+
role: 'presentation',
|
|
20
|
+
width: '100%',
|
|
21
|
+
height: '100%'
|
|
22
|
+
})) : jsxs(Fragment, {
|
|
23
|
+
children: [jsx("img", {
|
|
24
|
+
...rest,
|
|
25
|
+
ref: forwardedRef,
|
|
26
|
+
className: clsx(styles.image, className),
|
|
27
|
+
hidden: !isImageLoaded,
|
|
28
|
+
onError: () => {
|
|
29
|
+
// show alt text if image fails to load
|
|
30
|
+
setIsImageLoaded(true);
|
|
31
|
+
},
|
|
32
|
+
onLoad: () => {
|
|
33
|
+
// show image after it is loaded
|
|
34
|
+
setIsImageLoaded(true);
|
|
35
|
+
}
|
|
36
|
+
}), !isImageLoaded && jsx(Ghost, {
|
|
37
|
+
height: "100%",
|
|
38
|
+
variant: "rectangle",
|
|
39
|
+
width: "100%"
|
|
40
|
+
})]
|
|
41
|
+
})
|
|
35
42
|
});
|
|
36
43
|
/* eslint-enable */
|
|
37
44
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FunctionComponent, type PropsWithChildren, type SVGProps } from 'react';
|
|
1
2
|
import { type StyledText } from '../utils/commonTypes';
|
|
2
3
|
export type ContentCardBodyProps = React.ComponentProps<'p'> & {
|
|
3
4
|
/** Content of the body */
|
|
@@ -10,6 +11,8 @@ export type ContentCardFooterProps = React.ComponentProps<'div'> & {
|
|
|
10
11
|
export type ContentCardImageProps = React.ComponentProps<'img'> & {
|
|
11
12
|
/** The type of the image, either icon or background */
|
|
12
13
|
variant: 'icon' | 'background';
|
|
14
|
+
/** Icon that will be used instead of the image */
|
|
15
|
+
icon?: FunctionComponent<PropsWithChildren<SVGProps<SVGSVGElement>>>;
|
|
13
16
|
};
|
|
14
17
|
export type ContentCardTitleProps = React.ComponentProps<'h2'> & {
|
|
15
18
|
/** Content of the title */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.122.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@ariakit/react": "0.4.15",
|
|
49
49
|
"@ariakit/react-core": "0.4.15",
|
|
50
|
-
"@box/blueprint-web-assets": "^4.94.
|
|
50
|
+
"@box/blueprint-web-assets": "^4.94.5",
|
|
51
51
|
"@internationalized/date": "^3.7.0",
|
|
52
52
|
"@radix-ui/react-accordion": "1.1.2",
|
|
53
53
|
"@radix-ui/react-checkbox": "1.0.4",
|
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"type-fest": "^3.2.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@box/storybook-utils": "^0.16.
|
|
80
|
+
"@box/storybook-utils": "^0.16.9",
|
|
81
|
+
"@figma/code-connect": "1.3.12",
|
|
81
82
|
"@types/react": "^18.0.0",
|
|
82
83
|
"@types/react-dom": "^18.0.0",
|
|
83
84
|
"react": "^18.3.0",
|