@axa-fr/canopee-react 1.1.1-alpha.22 → 1.1.1-alpha.24

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,16 +1,24 @@
1
1
  import { type ComponentProps, type ComponentType, type ReactNode } from "react";
2
2
  import type { ButtonProps } from "../../Button/ButtonCommon";
3
+ type ContentItemDuoPositions = {
4
+ position?: "horizontal";
5
+ size?: "small" | "large";
6
+ } | {
7
+ size?: "large";
8
+ position: "vertical";
9
+ };
3
10
  export type ContentItemDuoProps = {
4
- label: string;
11
+ label: ReactNode;
5
12
  value: ReactNode;
6
- isVertical?: boolean;
7
- className?: string;
8
- classModifier?: string;
9
13
  buttonText?: string;
10
14
  onButtonClick?: () => void;
11
- } & ComponentProps<"div">;
15
+ /** @deprecated Use `position` instead */
16
+ isVertical?: boolean;
17
+ /** @deprecated Use `size` or `className` instead */
18
+ classModifier?: string;
19
+ } & ContentItemDuoPositions & ComponentProps<"div">;
12
20
  type ContentItemDuoCommonProps = ContentItemDuoProps & {
13
21
  ButtonComponent: ComponentType<ButtonProps>;
14
22
  };
15
- export declare const ContentItemDuoCommon: ({ label, value, isVertical, className, classModifier, buttonText, onButtonClick, ButtonComponent, ...containerProps }: ContentItemDuoCommonProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const ContentItemDuoCommon: ({ label, value, position, size, className, classModifier, isVertical, buttonText, onButtonClick, ButtonComponent, ...containerProps }: ContentItemDuoCommonProps) => import("react/jsx-runtime").JSX.Element;
16
24
  export {};
@@ -1,13 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo, } from "react";
3
- import { getComponentClassName } from "../../utilities/getComponentClassName";
4
- export const ContentItemDuoCommon = ({ label, value, isVertical = false, className, classModifier, buttonText, onButtonClick, ButtonComponent, ...containerProps }) => {
5
- const componentClassName = useMemo(() => {
6
- const classModifiers = [classModifier];
7
- if (isVertical) {
8
- classModifiers.push("vertical");
9
- }
10
- return getComponentClassName("af-content-item-duo", className, classModifiers.filter(Boolean).join(" "));
11
- }, [classModifier, className, isVertical]);
12
- return (_jsxs("div", { className: componentClassName, ...containerProps, children: [_jsx("p", { className: "af-content-item-duo__label", children: label }), typeof value === "string" ? (_jsx("p", { className: "af-content-item-duo__value", children: value })) : (_jsx("div", { className: "af-content-item-duo__value", children: value })), buttonText ? (_jsx("div", { className: "af-content-item-duo__button", children: _jsx(ButtonComponent, { variant: "ghost", onClick: onButtonClick, children: buttonText }) })) : null] }));
2
+ import { getClassName } from "../../utilities/getClassName";
3
+ export const ContentItemDuoCommon = ({ label, value, position = "horizontal", size = "large", className, classModifier, isVertical, buttonText, onButtonClick, ButtonComponent, ...containerProps }) => {
4
+ const componentClassName = getClassName({
5
+ baseClassName: "af-content-item-duo",
6
+ className,
7
+ modifiers: [
8
+ isVertical ? "vertical" : position,
9
+ size === "small" && size,
10
+ classModifier,
11
+ ],
12
+ });
13
+ return (_jsxs("div", { className: componentClassName, ...containerProps, children: [_jsx("dt", { className: "af-content-item-duo__label", children: label }), _jsx("dd", { className: "af-content-item-duo__value", children: value }), Boolean(buttonText && onButtonClick) && (_jsx(ButtonComponent, { className: "af-content-item-duo__button", variant: "ghost", onClick: onButtonClick, children: buttonText }))] }));
13
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "1.1.1-alpha.22",
3
+ "version": "1.1.1-alpha.24",
4
4
  "description": "Package React - Design System Canopée",
5
5
  "exports": {
6
6
  "./distributeur": {
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/AxaFrance/design-system#readme",
47
47
  "peerDependencies": {
48
- "@axa-fr/canopee-css": "1.1.1-alpha.22",
48
+ "@axa-fr/canopee-css": "1.1.1-alpha.24",
49
49
  "@material-symbols/svg-400": ">= 0.19.0",
50
50
  "@material-symbols/svg-700": ">= 0.19.0",
51
51
  "react": ">= 18"