@axa-fr/design-system-apollo-react 1.0.5-alpha.273 → 1.0.5-alpha.274

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,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/CheckboxCard/CheckboxCardApollo.scss";
3
3
  import { Icon } from "../../../Icon/IconApollo";
4
+ import { ItemMessage } from "../../ItemMessage/ItemMessageApollo";
4
5
  import { Checkbox } from "../Checkbox/CheckboxApollo";
5
6
  import { CheckboxCardCommon } from "./CheckboxCardCommon";
6
- export const CheckboxCard = (props) => (_jsx(CheckboxCardCommon, { ...props, IconComponent: Icon, CheckboxComponent: Checkbox }));
7
+ export const CheckboxCard = (props) => (_jsx(CheckboxCardCommon, { ...props, IconComponent: Icon, CheckboxComponent: Checkbox, ItemMessageComponent: ItemMessage }));
7
8
  CheckboxCard.displayName = "CheckboxCard";
@@ -1,4 +1,5 @@
1
- import React, { ComponentPropsWithRef } from "react";
1
+ import React, { ComponentPropsWithRef, type ComponentProps, type ComponentType } from "react";
2
+ import { ItemMessage } from "../../ItemMessage/ItemMessageLF";
2
3
  import { type TCheckboxCardItem } from "./CheckboxCardItem";
3
4
  import type { CheckboxComponent, IconComponent } from "./types";
4
5
  export type CheckboxCardProps = ComponentPropsWithRef<"input"> & {
@@ -8,10 +9,13 @@ export type CheckboxCardProps = ComponentPropsWithRef<"input"> & {
8
9
  isRequired?: boolean;
9
10
  options: TCheckboxCardItem[];
10
11
  onChange?: React.ChangeEventHandler;
12
+ error?: string;
13
+ };
14
+ type CheckboxCardCommonProps = CheckboxCardProps & CheckboxComponent & IconComponent & {
15
+ ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
11
16
  };
12
- type CheckboxCardCommonProps = CheckboxCardProps & CheckboxComponent & IconComponent;
13
17
  export declare const CheckboxCardCommon: {
14
- ({ className, labelGroup, descriptionGroup, CheckboxComponent, IconComponent, isRequired, options, onChange, type, }: CheckboxCardCommonProps): import("react/jsx-runtime").JSX.Element;
18
+ ({ className, labelGroup, descriptionGroup, CheckboxComponent, IconComponent, isRequired, options, onChange, type, error, ItemMessageComponent, }: CheckboxCardCommonProps): import("react/jsx-runtime").JSX.Element;
15
19
  displayName: string;
16
20
  };
17
21
  export {};
@@ -1,15 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useId } from "react";
2
+ import { useId, } from "react";
3
3
  import { BREAKPOINT } from "../../../utilities/constants";
4
4
  import { getComponentClassName } from "../../../utilities/getComponentClassName";
5
5
  import { useIsSmallScreen } from "../../../utilities/hook/useIsSmallScreen";
6
6
  import { CheckboxCardItem } from "./CheckboxCardItem";
7
- export const CheckboxCardCommon = ({ className, labelGroup, descriptionGroup, CheckboxComponent, IconComponent, isRequired, options, onChange, type = "vertical", }) => {
7
+ export const CheckboxCardCommon = ({ className, labelGroup, descriptionGroup, CheckboxComponent, IconComponent, isRequired, options, onChange, type = "vertical", error, ItemMessageComponent, }) => {
8
8
  const componentClassName = getComponentClassName("af-checkbox-card__container", className);
9
9
  const checkboxGroupClassName = getComponentClassName("af-checkbox-card-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: [_jsx("div", { className: "af-checkbox-card__label-container", children: labelGroup && (_jsxs("legend", { className: "af-checkbox-card__legend", children: [labelGroup, isRequired && _jsx("span", { "aria-hidden": true, children: "\u00A0*" }), descriptionGroup && (_jsx("p", { className: "af-checkbox-card__description", children: descriptionGroup }))] })) }), _jsx("ul", { className: checkboxGroupClassName, children: options.map((inputProps) => (_jsx("li", { children: _jsx(CheckboxCardItem, { size: size, errorId: errorId, onChange: onChange, CheckboxComponent: CheckboxComponent, IconComponent: IconComponent, ...inputProps }) }, crypto.randomUUID()))) })] }));
13
+ return (_jsxs("fieldset", { className: componentClassName, children: [_jsx("div", { className: "af-checkbox-card__label-container", children: labelGroup && (_jsxs("legend", { className: "af-checkbox-card__legend", children: [labelGroup, isRequired && _jsx("span", { "aria-hidden": true, children: "\u00A0*" }), descriptionGroup && (_jsx("p", { className: "af-checkbox-card__description", children: descriptionGroup }))] })) }), _jsxs("div", { className: "af-checkbox-card__choices", children: [_jsx("ul", { className: checkboxGroupClassName, children: options.map(({ hasError, ...inputProps }) => (_jsx("li", { children: _jsx(CheckboxCardItem, { size: size, errorId: errorId, onChange: onChange, CheckboxComponent: CheckboxComponent, IconComponent: IconComponent, hasError: Boolean(error) || hasError, ...inputProps }) }, crypto.randomUUID()))) }), error && (_jsx(ItemMessageComponent, { id: errorId, message: error, messageType: "error" }))] })] }));
14
14
  };
15
15
  CheckboxCardCommon.displayName = "CheckboxCardCommon";
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/CheckboxCard/CheckboxCardLF.scss";
3
3
  import { Icon } from "../../../Icon/IconLF";
4
+ import { ItemMessage } from "../../ItemMessage/ItemMessageLF";
4
5
  import { Checkbox } from "../Checkbox/CheckboxLF";
5
6
  import { CheckboxCardCommon } from "./CheckboxCardCommon";
6
- export const CheckboxCard = (props) => (_jsx(CheckboxCardCommon, { ...props, IconComponent: Icon, CheckboxComponent: Checkbox }));
7
+ export const CheckboxCard = (props) => (_jsx(CheckboxCardCommon, { ...props, IconComponent: Icon, CheckboxComponent: Checkbox, ItemMessageComponent: ItemMessage }));
7
8
  CheckboxCard.displayName = "CheckboxCard";
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.273",
3
+ "version": "1.0.5-alpha.274",
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.273",
50
- "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.273",
49
+ "@axa-fr/design-system-apollo-css": "1.0.5-alpha.274",
50
+ "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.274",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },