@axa-fr/canopee-react 1.4.2-alpha.10 → 1.4.2-alpha.11
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.
- package/dist/prospect-client/Form/Checkbox/CardCheckbox/CardCheckboxApollo.js +2 -1
- package/dist/prospect-client/Form/Checkbox/CardCheckbox/CardCheckboxCommon.d.ts +4 -1
- package/dist/prospect-client/Form/Checkbox/CardCheckbox/CardCheckboxCommon.js +3 -2
- package/dist/prospect-client/Form/Checkbox/CardCheckbox/CardCheckboxLF.js +2 -1
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ItemMessage } from "../../ItemMessage/ItemMessageApollo";
|
|
3
3
|
import { CardCheckboxOption } from "../CardCheckboxOption/CardCheckboxOptionApollo";
|
|
4
|
+
import { CheckboxText } from "../CheckboxText/CheckboxTextApollo";
|
|
4
5
|
import { CardCheckboxCommon, } from "./CardCheckboxCommon";
|
|
5
6
|
import "@axa-fr/canopee-css/prospect/Form/Checkbox/CardCheckbox/CardCheckboxApollo.css";
|
|
6
|
-
export const CardCheckbox = (props) => (_jsx(CardCheckboxCommon, { ...props, CardCheckboxItemComponent: CardCheckboxOption, ItemMessageComponent: ItemMessage }));
|
|
7
|
+
export const CardCheckbox = (props) => (_jsx(CardCheckboxCommon, { ...props, CardCheckboxItemComponent: CardCheckboxOption, CheckboxTextComponent: CheckboxText, ItemMessageComponent: ItemMessage }));
|
|
7
8
|
CardCheckbox.displayName = "CardCheckbox";
|
|
@@ -2,9 +2,11 @@ import { type ComponentType, type ReactNode } from "react";
|
|
|
2
2
|
import type { GridContainerProps } from "../../../utilities/types/GridContainerProps";
|
|
3
3
|
import type { ItemMessageProps } from "../../ItemMessage/ItemMessageCommon";
|
|
4
4
|
import type { CardCheckboxOptionProps } from "../CardCheckboxOption/CardCheckboxOptionCommon";
|
|
5
|
+
import type { CheckboxTextProps } from "../CheckboxText/CheckboxTextCommon";
|
|
5
6
|
type CheckboxOption = Omit<CardCheckboxOptionProps, "name" | "type">;
|
|
6
7
|
export type CardCheckboxProps = Omit<CardCheckboxOptionProps, "value" | "label" | "type" | "icon" | "description" | "subtitle" | "children"> & {
|
|
7
8
|
type?: "vertical" | "horizontal";
|
|
9
|
+
mode?: "text";
|
|
8
10
|
/**
|
|
9
11
|
* @deprecated Use `label` instead.
|
|
10
12
|
*/
|
|
@@ -27,11 +29,12 @@ export type CardCheckboxProps = Omit<CardCheckboxOptionProps, "value" | "label"
|
|
|
27
29
|
containerProps?: GridContainerProps<"fieldset">;
|
|
28
30
|
} & Partial<ItemMessageProps>;
|
|
29
31
|
type CardCheckboxCommonProps = CardCheckboxProps & {
|
|
32
|
+
CheckboxTextComponent: ComponentType<CheckboxTextProps>;
|
|
30
33
|
CardCheckboxItemComponent: ComponentType<CardCheckboxOptionProps>;
|
|
31
34
|
ItemMessageComponent: ComponentType<ItemMessageProps>;
|
|
32
35
|
};
|
|
33
36
|
export declare const CardCheckboxCommon: {
|
|
34
|
-
({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, type, error, name, id, onChange, CardCheckboxItemComponent, ItemMessageComponent, message, messageType, containerProps, ...inputProps }: CardCheckboxCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, type, error, name, id, onChange, CardCheckboxItemComponent, CheckboxTextComponent, ItemMessageComponent, message, messageType, containerProps, mode, ...inputProps }: CardCheckboxCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
35
38
|
displayName: string;
|
|
36
39
|
};
|
|
37
40
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId, useRef, } from "react";
|
|
3
|
-
export const CardCheckboxCommon = ({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, type = "vertical", error, name, id, onChange = () => { }, CardCheckboxItemComponent, ItemMessageComponent, message, messageType = "error", containerProps, ...inputProps }) => {
|
|
3
|
+
export const CardCheckboxCommon = ({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, type = "vertical", error, name, id, onChange = () => { }, CardCheckboxItemComponent, CheckboxTextComponent, ItemMessageComponent, message, messageType = "error", containerProps, mode, ...inputProps }) => {
|
|
4
4
|
const generatedId = useId();
|
|
5
5
|
const cardCheckboxId = id || generatedId;
|
|
6
6
|
const messageId = `${cardCheckboxId}-error`;
|
|
7
|
+
const CheckboxItemComponent = mode === "text" ? CheckboxTextComponent : CardCheckboxItemComponent;
|
|
7
8
|
const cardCheckboxOptionsRef = useRef(null);
|
|
8
9
|
const handleChange = (event) => {
|
|
9
10
|
const cardCheckboxOptionsEl = cardCheckboxOptionsRef.current;
|
|
@@ -26,6 +27,6 @@ export const CardCheckboxCommon = ({ className, labelGroup, descriptionGroup, la
|
|
|
26
27
|
return (_jsxs("fieldset", { className: ["af-card-checkbox", className].filter(Boolean).join(" "), id: cardCheckboxId, ...containerProps, children: [_jsxs("legend", { className: "af-card-checkbox__legend", children: [_jsxs("p", { className: "af-card-checkbox__label", children: [label, labelGroup, required || isRequired ? _jsx("span", { "aria-hidden": true, children: "*" }) : null] }), description || descriptionGroup ? (_jsxs("p", { className: "af-card-checkbox__description", children: [description, descriptionGroup] })) : null] }), _jsx("div", { className: [
|
|
27
28
|
"af-card-checkbox__options",
|
|
28
29
|
`af-card-checkbox__options--${type}`,
|
|
29
|
-
].join(" "), ref: cardCheckboxOptionsRef, children: options.map((cardCheckboxItemProps) => (_jsx(
|
|
30
|
+
].join(" "), ref: cardCheckboxOptionsRef, children: options.map((cardCheckboxItemProps) => (_jsx(CheckboxItemComponent, { id: `${cardCheckboxId}-${cardCheckboxItemProps.value}`, required: required, onChange: handleChange, ...inputProps, ...cardCheckboxItemProps, type: type, "aria-invalid": hasError || undefined, "aria-errormessage": hasError ? messageId : undefined, name: name }, `${name ?? cardCheckboxId}-${cardCheckboxItemProps.label}`))) }), _jsx(ItemMessageComponent, { id: messageId, message: message || error, messageType: messageType })] }));
|
|
30
31
|
};
|
|
31
32
|
CardCheckboxCommon.displayName = "CardCheckboxCommon";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ItemMessage } from "../../ItemMessage/ItemMessageLF";
|
|
3
3
|
import { CardCheckboxOption } from "../CardCheckboxOption/CardCheckboxOptionLF";
|
|
4
|
+
import { CheckboxText } from "../CheckboxText/CheckboxTextLF";
|
|
4
5
|
import { CardCheckboxCommon, } from "./CardCheckboxCommon";
|
|
5
6
|
import "@axa-fr/canopee-css/client/Form/Checkbox/CardCheckbox/CardCheckboxLF.css";
|
|
6
|
-
export const CardCheckbox = (props) => (_jsx(CardCheckboxCommon, { ...props, CardCheckboxItemComponent: CardCheckboxOption, ItemMessageComponent: ItemMessage }));
|
|
7
|
+
export const CardCheckbox = (props) => (_jsx(CardCheckboxCommon, { ...props, CardCheckboxItemComponent: CardCheckboxOption, CheckboxTextComponent: CheckboxText, ItemMessageComponent: ItemMessage }));
|
|
7
8
|
CardCheckbox.displayName = "CardCheckbox";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/canopee-react",
|
|
3
|
-
"version": "1.4.2-alpha.
|
|
3
|
+
"version": "1.4.2-alpha.11",
|
|
4
4
|
"description": "Package React - Design System Canopée",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./distributeur": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@axa-fr/canopee-css": "1.4.2-alpha.
|
|
52
|
+
"@axa-fr/canopee-css": "1.4.2-alpha.11",
|
|
53
53
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
54
54
|
"@material-symbols/svg-700": ">= 0.19.0",
|
|
55
55
|
"react": ">= 18"
|