@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, jsx } from 'react/jsx-runtime';
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 jsxs("div", {
16
+ return jsx("div", {
16
17
  className: variant === 'background' ? styles.cardBackground : styles.cardIcon,
17
- children: [jsx("img", {
18
- ...rest,
19
- ref: forwardedRef,
20
- className: clsx(styles.image, className),
21
- hidden: !isImageLoaded,
22
- onError: () => {
23
- // show alt text if image fails to load
24
- setIsImageLoaded(true);
25
- },
26
- onLoad: () => {
27
- // show image after it is loaded
28
- setIsImageLoaded(true);
29
- }
30
- }), !isImageLoaded && jsx(Ghost, {
31
- height: "100%",
32
- variant: "rectangle",
33
- width: "100%"
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.121.0",
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.3",
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.7",
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",