@axa-fr/canopee-react 1.2.1-alpha.12 → 1.2.1-alpha.14

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.
@@ -8,7 +8,15 @@ export declare enum RadioModes {
8
8
  declare const Radio: import("react").ForwardRefExoticComponent<(({
9
9
  options: Option[];
10
10
  } & Omit<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
11
- options: Option[];
11
+ options: ({
12
+ id?: string;
13
+ icon?: import("react").ReactNode;
14
+ label: import("react").ReactNode;
15
+ description?: import("react").ReactNode;
16
+ value: string;
17
+ } & import("react").InputHTMLAttributes<HTMLInputElement> & {
18
+ action?: import("react").ReactNode;
19
+ })[];
12
20
  orientation?: "horizontal" | "vertical";
13
21
  }, "ref"> & {
14
22
  mode: "cardRadio";
@@ -1,8 +1,11 @@
1
1
  import "@axa-fr/canopee-css/distributeur/Form/Radio/RadioCardGroup.css";
2
- import { ComponentProps } from "react";
2
+ import { ComponentProps, ReactNode } from "react";
3
3
  import type { Option } from "../core";
4
+ type RadioOptions = Option & {
5
+ action?: ReactNode;
6
+ };
4
7
  type Props = ComponentProps<"input"> & {
5
- options: Option[];
8
+ options: RadioOptions[];
6
9
  orientation?: "horizontal" | "vertical";
7
10
  };
8
11
  export declare const RadioCardGroup: ({ children, options, className, value, name, orientation, disabled, "aria-invalid": ariaInvalid, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -12,7 +12,7 @@ export const RadioCardGroup = ({ children, options, className, value, name, orie
12
12
  className,
13
13
  orientation === "horizontal" &&
14
14
  `${DEFAULT_CONTAINER_CLASSNAME}--horizontal`,
15
- ]), children: [options.map(({ name: optionName, icon, label, disabled: optionDisabled, value: optionValue, ...otherOptionProps }) => {
15
+ ]), children: [options.map(({ name: optionName, icon, label, disabled: optionDisabled, value: optionValue, action, ...otherOptionProps }) => {
16
16
  const newName = name || optionName || idGenerated;
17
17
  const allClassNames = classNames([
18
18
  DEFAULT_CLASSNAME,
@@ -20,6 +20,6 @@ export const RadioCardGroup = ({ children, options, className, value, name, orie
20
20
  ariaInvalid && `${DEFAULT_CLASSNAME}--error`,
21
21
  ]);
22
22
  const isDisabled = disabled || optionDisabled;
23
- return (_jsxs("label", { className: allClassNames, children: [_jsx("input", { ...otherProps, type: "radio", name: newName, disabled: isDisabled, checked: isDisabled ? false : optionValue === value, value: optionValue, ...otherOptionProps }), typeof icon === "string" ? _jsx(Svg, { src: icon }) : icon, label] }, optionValue));
23
+ return (_jsxs("div", { children: [_jsxs("label", { className: allClassNames, children: [_jsx("input", { ...otherProps, type: "radio", name: newName, disabled: isDisabled, checked: isDisabled ? false : optionValue === value, value: optionValue, ...otherOptionProps }), typeof icon === "string" ? _jsx(Svg, { src: icon }) : icon, label] }, optionValue), action] }, optionValue));
24
24
  }), children] }));
25
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "1.2.1-alpha.12",
3
+ "version": "1.2.1-alpha.14",
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.2.1-alpha.12",
48
+ "@axa-fr/canopee-css": "1.2.1-alpha.14",
49
49
  "@material-symbols/svg-400": ">= 0.19.0",
50
50
  "@material-symbols/svg-700": ">= 0.19.0",
51
51
  "react": ">= 18"