@axa-fr/canopee-react 2.0.1-alpha.58 → 2.0.1-alpha.59

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,4 +1,5 @@
1
1
  import type { ComponentProps, ComponentType } from "react";
2
+ import { BasePicture } from "../BasePicture/BasePicture";
2
3
  import { Icon, type IconProps } from "../Icon/IconCommon";
3
4
  import { type ContentItemCoreProps } from "./ContentItemMonoCore";
4
5
  export type ContentMonoItemSize = "medium" | "large";
@@ -8,6 +9,12 @@ export type ContentMonoItemPictureProps = {
8
9
  picture: string;
9
10
  title: string;
10
11
  subtitle: string;
12
+ /**
13
+ * Props passed to the picture. The picture is decorative by default
14
+ * (`alt=""`) because the title is displayed next to it: set `alt` only
15
+ * when the picture carries information that the text does not.
16
+ */
17
+ basePictureProps?: Omit<ComponentProps<typeof BasePicture>, "src">;
11
18
  };
12
19
  export type ContentMonoItemIconProps = {
13
20
  type: "icon";
@@ -13,9 +13,10 @@ export const getContentItemCoreProps = ({ IconComponent, type, ...props }) => {
13
13
  };
14
14
  }
15
15
  if (type === "picture") {
16
+ const { picture, basePictureProps, ...pictureItemProps } = props;
16
17
  return {
17
- ...props,
18
- leftComponent: (_jsx(BasePicture, { src: props.picture, alt: props.title })),
18
+ ...pictureItemProps,
19
+ leftComponent: _jsx(BasePicture, { src: picture, ...basePictureProps }),
19
20
  };
20
21
  }
21
22
  return {
@@ -10,7 +10,7 @@ export const DataAgentCommon = ({ className, agentProps, agentContractProps, con
10
10
  const renderForDefaultLayout = () => (_jsxs(_Fragment, { children: [_jsxs("section", { className: "af-data-agent__intro", children: [_jsx(ContentItemMonoComponent, { ...agentProps, type: "picture" }), agentContractProps ? (_jsx(ContentItemMonoComponent, { ...agentContractProps, type: "stick" })) : null] }), _jsx(DividerComponent, {}), contents && contents?.length > 0 ? (_jsx("section", { className: "af-data-agent__info-content", children: contents.map((content) => (_jsxs(Fragment, { children: [_jsx(ContentItemMonoComponent, { ...content, type: "icon" }), _jsx(DividerComponent, { className: "af-data-agent__line" })] }, `content--${crypto.randomUUID()}`))) })) : null, clickContents && clickContents?.length > 0 ? (_jsx("section", { className: "af-data-agent__info-click-content", children: clickContents.map((clickContent) => (_jsxs(Fragment, { children: [_jsx(ClickItemComponent, { ...clickContent, variant: "small" }), _jsx(DividerComponent, { className: "af-data-agent__line" })] }, `clickContent--${crypto.randomUUID()}`))) })) : null, Boolean(texteOrias) && (_jsx("p", { className: "af-data-agent__text-orias", children: texteOrias }))] }));
11
11
  const renderForMobileLayout = () => (_jsx("section", { className: "af-data-agent__intro", children: _jsx(ClickItemComponent, { ...agentProps, basePictureProps: {
12
12
  src: agentProps.picture,
13
- alt: agentProps.title,
13
+ ...agentProps.basePictureProps,
14
14
  }, variant: "agent" }) }));
15
15
  return (_jsx("section", { className: componentClassName, children: (isMobile && isCompact) || variant === "compact"
16
16
  ? renderForMobileLayout()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "2.0.1-alpha.58",
3
+ "version": "2.0.1-alpha.59",
4
4
  "description": "Package React - Design System Canopée",
5
5
  "type": "module",
6
6
  "exports": {
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "homepage": "https://github.com/AxaFrance/design-system#readme",
56
56
  "peerDependencies": {
57
- "@axa-fr/canopee-css": "2.0.1-alpha.58",
57
+ "@axa-fr/canopee-css": "2.0.1-alpha.59",
58
58
  "@material-symbols/svg-400": ">= 0.19.0",
59
59
  "@material-symbols/svg-700": ">= 0.19.0",
60
60
  "react": ">= 19"