@axa-fr/design-system-apollo-react 1.0.5-alpha.389 → 1.0.5-alpha.391

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,21 +1,21 @@
1
- import React, { ComponentPropsWithRef, type ComponentProps, type ComponentType } from "react";
1
+ import { type ChangeEventHandler, type ComponentProps, type ComponentType } from "react";
2
2
  import { ItemMessage } from "../../ItemMessage/ItemMessageLF";
3
3
  import { type TCardCheckboxItem } from "./CardCheckboxItem";
4
4
  import type { CheckboxComponent, IconComponent } from "./types";
5
- export type CardCheckboxProps = ComponentPropsWithRef<"input"> & {
5
+ export type CardCheckboxProps = Partial<TCardCheckboxItem> & {
6
6
  type: "vertical" | "horizontal";
7
7
  labelGroup?: string;
8
8
  descriptionGroup?: string;
9
9
  isRequired?: boolean;
10
10
  options: TCardCheckboxItem[];
11
- onChange?: React.ChangeEventHandler;
11
+ onChange?: ChangeEventHandler;
12
12
  error?: string;
13
13
  };
14
14
  type CardCheckboxCommonProps = CardCheckboxProps & CheckboxComponent & IconComponent & {
15
15
  ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
16
16
  };
17
17
  export declare const CardCheckboxCommon: {
18
- ({ className, labelGroup, descriptionGroup, CheckboxComponent, IconComponent, isRequired, options, onChange, type, error, ItemMessageComponent, }: CardCheckboxCommonProps): import("react/jsx-runtime").JSX.Element;
18
+ ({ className, labelGroup, descriptionGroup, CheckboxComponent, IconComponent, isRequired, options, onChange, type, error, ItemMessageComponent, ...inputProps }: CardCheckboxCommonProps): import("react/jsx-runtime").JSX.Element;
19
19
  displayName: string;
20
20
  };
21
21
  export {};
@@ -4,12 +4,12 @@ import { BREAKPOINT } from "../../../utilities/constants";
4
4
  import { getComponentClassName } from "../../../utilities/getComponentClassName";
5
5
  import { useIsSmallScreen } from "../../../utilities/hook/useIsSmallScreen";
6
6
  import { CardCheckboxItem } from "./CardCheckboxItem";
7
- export const CardCheckboxCommon = ({ className, labelGroup, descriptionGroup, CheckboxComponent, IconComponent, isRequired, options, onChange, type = "vertical", error, ItemMessageComponent, }) => {
7
+ export const CardCheckboxCommon = ({ className, labelGroup, descriptionGroup, CheckboxComponent, IconComponent, isRequired, options, onChange, type = "vertical", error, ItemMessageComponent, ...inputProps }) => {
8
8
  const componentClassName = getComponentClassName("af-card-checkbox__container", className);
9
9
  const checkboxGroupClassName = getComponentClassName("af-card-checkbox-group", className, type);
10
10
  const errorId = useId();
11
11
  const isMobile = useIsSmallScreen(BREAKPOINT.SM);
12
12
  const size = isMobile ? "M" : "L";
13
- return (_jsxs("fieldset", { className: componentClassName, children: [labelGroup && (_jsxs("legend", { className: "af-card-checkbox__legend", children: [_jsxs("p", { children: [labelGroup, isRequired && _jsx("span", { "aria-hidden": true, children: "\u00A0*" })] }), descriptionGroup && (_jsx("p", { className: "af-card-checkbox__description", children: descriptionGroup }))] })), _jsxs("div", { className: "af-card-checkbox__choices", children: [_jsx("ul", { className: checkboxGroupClassName, children: options.map(({ hasError, ...inputProps }) => (_jsx("li", { children: _jsx(CardCheckboxItem, { size: size, errorId: errorId, onChange: onChange, CheckboxComponent: CheckboxComponent, IconComponent: IconComponent, hasError: Boolean(error) || hasError, ...inputProps }) }, crypto.randomUUID()))) }), _jsx(ItemMessageComponent, { id: errorId, message: error, messageType: "error" })] })] }));
13
+ return (_jsxs("fieldset", { className: componentClassName, children: [labelGroup && (_jsxs("legend", { className: "af-card-checkbox__legend", children: [_jsxs("p", { children: [labelGroup, isRequired && _jsx("span", { "aria-hidden": true, children: "\u00A0*" })] }), descriptionGroup && (_jsx("p", { className: "af-card-checkbox__description", children: descriptionGroup }))] })), _jsxs("div", { className: "af-card-checkbox__choices", children: [_jsx("ul", { className: checkboxGroupClassName, children: options.map(({ hasError, ...optionProps }) => (_jsx("li", { children: _jsx(CardCheckboxItem, { ...inputProps, size: size, errorId: errorId, onChange: onChange, CheckboxComponent: CheckboxComponent, IconComponent: IconComponent, hasError: Boolean(error) || hasError, ...optionProps }) }, crypto.randomUUID()))) }), _jsx(ItemMessageComponent, { id: errorId, message: error, messageType: "error" })] })] }));
14
14
  };
15
15
  CardCheckboxCommon.displayName = "CardCheckboxCommon";
@@ -1,5 +1,5 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/Checkbox/CheckboxApollo.scss";
2
- export declare const Checkbox: import("react").ForwardRefExoticComponent<import("react").InputHTMLAttributes<HTMLInputElement> & {
2
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<{
3
3
  errorId?: string;
4
4
  hasError?: boolean;
5
5
  className?: string;
@@ -1,17 +1,14 @@
1
- import React from "react";
2
- export type CheckboxProps = React.InputHTMLAttributes<HTMLInputElement> & {
1
+ import { type InputHTMLAttributes } from "react";
2
+ export type CheckboxProps = {
3
3
  errorId?: string;
4
4
  hasError?: boolean;
5
5
  className?: string;
6
- } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "disabled">;
7
- export type CheckboxCommonProps = CheckboxProps & {
8
- checkBoxIcon: string;
9
- };
10
- declare const CheckboxCommon: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & {
6
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "disabled">;
7
+ declare const CheckboxCommon: import("react").ForwardRefExoticComponent<{
11
8
  errorId?: string;
12
9
  hasError?: boolean;
13
10
  className?: string;
14
- } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "disabled"> & {
11
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "disabled"> & {
15
12
  checkBoxIcon: string;
16
- } & React.RefAttributes<HTMLInputElement>>;
13
+ } & import("react").RefAttributes<HTMLInputElement>>;
17
14
  export { CheckboxCommon };
@@ -1,5 +1,5 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/Checkbox/CheckboxLF.scss";
2
- export declare const Checkbox: import("react").ForwardRefExoticComponent<import("react").InputHTMLAttributes<HTMLInputElement> & {
2
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<{
3
3
  errorId?: string;
4
4
  hasError?: boolean;
5
5
  className?: string;
@@ -1,8 +1,8 @@
1
1
  import { type ComponentProps, type ComponentType } from "react";
2
2
  import { ItemMessage } from "../../ItemMessage/ItemMessageLF";
3
- import type { RadioCommon } from "../Radio/RadioCommon";
3
+ import type { Radio } from "../Radio/RadioCommon";
4
4
  import type { IconComponent, RadioComponent, TCardRadioItemOption } from "./types";
5
- export type CardRadioProps = Omit<ComponentProps<typeof RadioCommon>, "size"> & {
5
+ export type CardRadioProps = Omit<ComponentProps<typeof Radio>, "size"> & {
6
6
  type: "vertical" | "horizontal";
7
7
  labelGroup?: string;
8
8
  descriptionGroup?: string;
@@ -13,7 +13,7 @@ const CardRadioCommon = ({ className, labelGroup, descriptionGroup, RadioCompone
13
13
  const size = isMobile
14
14
  ? "M"
15
15
  : "L";
16
- return (_jsxs("fieldset", { className: componentClassName, "aria-invalid": Boolean(error), "aria-errormessage": error ? errorId : undefined, children: [labelGroup && (_jsxs("legend", { className: "af-card-radio__legend", children: [_jsxs("p", { children: [labelGroup, isRequired && _jsx("span", { "aria-hidden": true, children: "\u00A0*" })] }), descriptionGroup && (_jsx("p", { className: "af-card-radio__description", children: descriptionGroup }))] })), _jsx("div", { className: RadioGroupClassName, children: options.map((cardRadioItemProps) => (_jsx(CardRadioItem, { name: name, onChange: onChange, size: size, RadioComponent: RadioComponent, IconComponent: IconComponent, checked: value !== undefined
16
+ return (_jsxs("fieldset", { className: componentClassName, "aria-invalid": Boolean(error), "aria-errormessage": error ? errorId : undefined, children: [labelGroup && (_jsxs("legend", { className: "af-card-radio__legend", children: [_jsxs("p", { children: [labelGroup, isRequired && _jsx("span", { "aria-hidden": true, children: "\u00A0*" })] }), descriptionGroup && (_jsx("p", { className: "af-card-radio__description", children: descriptionGroup }))] })), _jsx("div", { className: RadioGroupClassName, children: options.map((cardRadioItemProps) => (_jsx(CardRadioItem, { name: name, onChange: onChange, size: size, RadioComponent: RadioComponent, IconComponent: IconComponent, isInvalid: Boolean(error), checked: value !== undefined
17
17
  ? value === cardRadioItemProps.value
18
18
  : undefined, ...inputProps, ...cardRadioItemProps }, `${name ?? cardRadioId}-${cardRadioItemProps.label}`))) }), _jsx(ItemMessageComponent, { id: errorId, message: error, messageType: "error" })] }));
19
19
  };
@@ -1,13 +1,13 @@
1
1
  import { type ComponentProps, type ComponentType } from "react";
2
2
  import type { Icon as IconCommon } from "../../../Icon/IconCommon";
3
- import type { RadioCommon } from "../Radio/RadioCommon";
4
- export type TCardRadioItemProps = Omit<ComponentProps<typeof RadioCommon>, "size"> & {
3
+ import type { Radio } from "../Radio/RadioCommon";
4
+ export type TCardRadioItemProps = Omit<ComponentProps<typeof Radio>, "size"> & {
5
5
  label: string;
6
6
  description?: string;
7
7
  subtitle?: string;
8
8
  icon?: ComponentProps<typeof IconCommon>["src"];
9
9
  size: ComponentProps<typeof IconCommon>["size"];
10
- RadioComponent: ComponentType<ComponentProps<typeof RadioCommon>>;
10
+ RadioComponent: ComponentType<ComponentProps<typeof Radio>>;
11
11
  IconComponent: ComponentType<ComponentProps<typeof IconCommon>>;
12
12
  };
13
13
  export declare const CardRadioItem: ({ label, description, subtitle, icon, size, RadioComponent, IconComponent, ...inputProps }: TCardRadioItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,2 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Radio/Radio/RadioApollo.scss";
2
- import { type RadioProps } from "./RadioCommon";
3
- export declare const Radio: import("react").ForwardRefExoticComponent<RadioProps & import("react").RefAttributes<HTMLInputElement>>;
2
+ export { Radio } from "./RadioCommon";
@@ -1,6 +1,2 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Radio/Radio/RadioApollo.scss";
4
- import { RadioCommon } from "./RadioCommon";
5
- export const Radio = forwardRef((props, ref) => (_jsx(RadioCommon, { ...props, ref: ref })));
6
- Radio.displayName = "Radio";
2
+ export { Radio } from "./RadioCommon";
@@ -1,3 +1,5 @@
1
- import React from "react";
2
- export type RadioProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "disabled">;
3
- export declare const RadioCommon: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
1
+ import { type ComponentProps } from "react";
2
+ export type RadioProps = Omit<ComponentProps<"input">, "disabled" | "type"> & {
3
+ isInvalid?: boolean;
4
+ };
5
+ export declare const Radio: import("react").ForwardRefExoticComponent<Omit<RadioProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,4 +1,6 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- export const RadioCommon = forwardRef((inputProps, ref) => (_jsxs("span", { className: "af-radio", children: [_jsx("input", { ...inputProps, type: "radio", ref: ref }), _jsx("span", { className: "af-radio__icons" })] })));
4
- RadioCommon.displayName = "RadioCommon";
3
+ export const Radio = forwardRef(({ className, isInvalid, ...props }, ref) => (_jsx("input", { ...props, className: ["af-radio", isInvalid && "af-radio--invalid", className]
4
+ .filter(Boolean)
5
+ .join(" "), type: "radio", ref: ref })));
6
+ Radio.displayName = "Radio";
@@ -1,3 +1,2 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Radio/Radio/RadioLF.scss";
2
- import { type RadioProps } from "./RadioCommon";
3
- export declare const Radio: import("react").ForwardRefExoticComponent<RadioProps & import("react").RefAttributes<HTMLInputElement>>;
2
+ export { Radio } from "./RadioCommon";
@@ -1,6 +1,2 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
1
  import "@axa-fr/design-system-apollo-css/dist/Form/Radio/Radio/RadioLF.scss";
4
- import { RadioCommon } from "./RadioCommon";
5
- export const Radio = forwardRef((props, ref) => (_jsx(RadioCommon, { ...props, ref: ref })));
6
- Radio.displayName = "Radio";
2
+ export { Radio } from "./RadioCommon";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-apollo-react",
3
- "version": "1.0.5-alpha.389",
3
+ "version": "1.0.5-alpha.391",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "homepage": "https://github.com/AxaFrance/design-system#readme",
48
48
  "peerDependencies": {
49
- "@axa-fr/design-system-apollo-css": "1.0.5-alpha.389",
50
- "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.389",
49
+ "@axa-fr/design-system-apollo-css": "1.0.5-alpha.391",
50
+ "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.391",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },