@axa-fr/canopee-react 2.0.0-alpha.25 → 2.0.0-alpha.27

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.
@@ -22,7 +22,7 @@ export type CardRadioCommonProps = CardRadioProps & {
22
22
  IconComponent: ComponentType<ComponentProps<typeof IconCommon>>;
23
23
  };
24
24
  export declare const CardRadioCommon: {
25
- ({ label, position, type, description, subtitle, icon, src, basePictureProps, isInvalid, className, RadioComponent, IconComponent, ...inputProps }: CardRadioCommonProps): import("react/jsx-runtime").JSX.Element;
25
+ ({ label, position, type, description, subtitle, icon, src, basePictureProps, variant, className, RadioComponent, IconComponent, ...inputProps }: CardRadioCommonProps): import("react/jsx-runtime").JSX.Element;
26
26
  displayName: string;
27
27
  };
28
28
  export {};
@@ -2,15 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import {} from "react";
3
3
  import { BasePicture } from "../../../BasePicture/BasePicture";
4
4
  import { getClassName } from "../../../utilities/getClassName";
5
- export const CardRadioCommon = ({ label, position, type, description, subtitle, icon, src, basePictureProps, isInvalid, className, RadioComponent, IconComponent, ...inputProps }) => {
5
+ export const CardRadioCommon = ({ label, position, type, description, subtitle, icon, src, basePictureProps, variant, className, RadioComponent, IconComponent, ...inputProps }) => {
6
6
  const isCardRadioHorizontal = [position, type].includes("horizontal");
7
7
  return (_jsxs("label", { className: getClassName({
8
8
  baseClassName: "af-card-radio",
9
9
  modifiers: [
10
- isInvalid && "invalid",
10
+ variant === "error" && "invalid",
11
11
  isCardRadioHorizontal && "horizontal",
12
12
  ],
13
13
  className,
14
- }), children: [icon ? _jsx(IconComponent, { src: icon, role: "presentation" }) : null, isCardRadioHorizontal && src ? (_jsx(BasePicture, { src: src, ...basePictureProps })) : null, _jsxs("div", { className: "af-card-radio__content", children: [_jsx("p", { className: "af-card-radio__label", children: label }), Boolean(description) && (_jsx("p", { className: "af-card-radio__description", children: description })), Boolean(subtitle) && (_jsx("p", { className: "af-card-radio__subtitle", children: subtitle }))] }), _jsx(RadioComponent, { ...inputProps, isInvalid: isInvalid })] }));
14
+ }), children: [icon ? _jsx(IconComponent, { src: icon, role: "presentation" }) : null, isCardRadioHorizontal && src ? (_jsx(BasePicture, { src: src, ...basePictureProps })) : null, _jsxs("div", { className: "af-card-radio__content", children: [_jsx("p", { className: "af-card-radio__label", children: label }), Boolean(description) && (_jsx("p", { className: "af-card-radio__description", children: description })), Boolean(subtitle) && (_jsx("p", { className: "af-card-radio__subtitle", children: subtitle }))] }), _jsx(RadioComponent, { ...inputProps, variant: variant })] }));
15
15
  };
16
16
  CardRadioCommon.displayName = "CardRadioCommon";
@@ -2,8 +2,8 @@ import { type ComponentProps, type ComponentType, type PropsWithChildren, type R
2
2
  import type { GridContainerProps } from "../../../utilities/types/GridContainerProps";
3
3
  import { ItemMessage, type ItemMessageProps } from "../../ItemMessage/ItemMessageCommon";
4
4
  import { type CardRadioProps } from "../CardRadio/CardRadioCommon";
5
- type RadioOption = Omit<CardRadioProps, "name" | "type" | "isInvalid">;
6
- export type CardRadioGroupProps = Omit<CardRadioProps, "value" | "label" | "type" | "isInvalid" | "icon" | "src" | "basePictureProps" | "description" | "subtitle" | "children" | "position"> & {
5
+ type RadioOption = Omit<CardRadioProps, "name" | "type" | "variant">;
6
+ export type CardRadioGroupProps = Omit<CardRadioProps, "value" | "label" | "type" | "variant" | "icon" | "src" | "basePictureProps" | "description" | "subtitle" | "children" | "position"> & {
7
7
  /**
8
8
  * @deprecated Use `position` and `cardStyle` instead.
9
9
  */
@@ -12,7 +12,7 @@ const CardRadioGroupCommon = ({ className, labelGroup, descriptionGroup, label,
12
12
  `af-card-radio-group__options--${position}`,
13
13
  ].join(" "), children: options.map((cardRadioItemProps) => (_jsx(CardRadioComponent, { id: `${cardRadioGroupId}-${cardRadioItemProps.value}`, checked: value !== undefined
14
14
  ? value === cardRadioItemProps.value
15
- : undefined, required: required, position: cardStyle ?? type, ...inputProps, ...cardRadioItemProps, isInvalid: hasError, name: name }, `${name ?? cardRadioGroupId}-${cardRadioItemProps.label}`))) }), _jsx(ItemMessageComponent, { id: messageId, message: message || error, messageType: messageType })] }));
15
+ : undefined, required: required, position: cardStyle ?? type, ...inputProps, ...cardRadioItemProps, variant: hasError ? "error" : undefined, name: name }, `${name ?? cardRadioGroupId}-${cardRadioItemProps.label}`))) }), _jsx(ItemMessageComponent, { id: messageId, message: message || error, messageType: messageType })] }));
16
16
  };
17
17
  CardRadioGroupCommon.displayName = "CardRadioGroupCommon";
18
18
  export { CardRadioGroupCommon };
@@ -1,8 +1,5 @@
1
1
  import { type ComponentProps } from "react";
2
2
  export type RadioProps = Omit<ComponentProps<"input">, "disabled" | "type"> & {
3
- isInvalid?: boolean;
4
- };
5
- export declare const Radio: {
6
- ({ className, isInvalid, ...props }: RadioProps): import("react/jsx-runtime").JSX.Element;
7
- displayName: string;
3
+ variant?: "error" | "warning";
8
4
  };
5
+ export declare const Radio: ({ variant, className, ref, ...inputProps }: RadioProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import {} from "react";
3
- export const Radio = ({ className, isInvalid, ...props }) => (_jsx("input", { ...props, className: ["af-radio", isInvalid && "af-radio--invalid", className]
4
- .filter(Boolean)
5
- .join(" "), type: "radio" }));
6
- Radio.displayName = "Radio";
3
+ import { getClassName } from "../../../utilities/getClassName";
4
+ export const Radio = ({ variant, className, ref, ...inputProps }) => (_jsx("input", { ...inputProps, className: getClassName({
5
+ baseClassName: "af-radio",
6
+ modifiers: [variant],
7
+ className,
8
+ }), ref: ref, type: "radio" }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "2.0.0-alpha.25",
3
+ "version": "2.0.0-alpha.27",
4
4
  "description": "Package React - Design System Canopée",
5
5
  "exports": {
6
6
  "./distributeur": {
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "homepage": "https://github.com/AxaFrance/design-system#readme",
55
55
  "peerDependencies": {
56
- "@axa-fr/canopee-css": "2.0.0-alpha.25",
56
+ "@axa-fr/canopee-css": "2.0.0-alpha.27",
57
57
  "@material-symbols/svg-400": ">= 0.19.0",
58
58
  "@material-symbols/svg-700": ">= 0.19.0",
59
59
  "react": ">= 19"