@axa-fr/canopee-react 1.3.1-alpha.19 → 1.3.1-alpha.20
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/client.d.ts +8 -3
- package/dist/client.js +5 -1
- package/dist/prospect-client/DataAgent/DataAgentApollo.d.ts +1 -0
- package/dist/prospect-client/DataAgent/DataAgentLF.d.ts +1 -0
- package/dist/prospect-client/Form/Checkbox/CardCheckbox/CardCheckboxCommon.d.ts +3 -1
- package/dist/prospect-client/Form/Checkbox/CardCheckbox/CardCheckboxCommon.js +2 -2
- package/dist/prospect-client/Form/Checkbox/CheckboxText/CheckboxTextCommon.d.ts +2 -0
- package/dist/prospect-client/Form/Checkbox/CheckboxText/CheckboxTextCommon.js +2 -2
- package/dist/prospect-client/Form/Dropdown/DropdownCommon.d.ts +2 -0
- package/dist/prospect-client/Form/Dropdown/DropdownCommon.js +2 -2
- package/dist/prospect-client/Form/FileUpload/InputFile/InputFileCommon.d.ts +2 -0
- package/dist/prospect-client/Form/FileUpload/InputFile/InputFileCommon.js +2 -2
- package/dist/prospect-client/Form/InputDate/InputDateCommon.d.ts +2 -0
- package/dist/prospect-client/Form/InputDate/InputDateCommon.js +2 -2
- package/dist/prospect-client/Form/InputPhone/InputPhoneCommon.d.ts +2 -0
- package/dist/prospect-client/Form/InputPhone/InputPhoneCommon.js +2 -2
- package/dist/prospect-client/Form/InputText/InputTextCommon.d.ts +4 -2
- package/dist/prospect-client/Form/InputText/InputTextCommon.js +2 -2
- package/dist/prospect-client/Form/Radio/CardRadioGroup/CardRadioGroupCommon.d.ts +3 -1
- package/dist/prospect-client/Form/Radio/CardRadioGroup/CardRadioGroupCommon.js +2 -2
- package/dist/prospect-client/Form/TextArea/TextAreaCommon.d.ts +2 -0
- package/dist/prospect-client/Form/TextArea/TextAreaCommon.js +2 -2
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutApollo.d.ts +21 -0
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutApollo.js +8 -0
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutCommon.d.ts +50 -0
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutCommon.js +37 -0
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutLF.d.ts +21 -0
- package/dist/prospect-client/Layout/ExitLayout/ExitLayoutLF.js +8 -0
- package/dist/prospect-client/Layout/FormLayout/FormLayout.d.ts +3529 -0
- package/dist/prospect-client/Layout/FormLayout/FormLayout.js +79 -0
- package/dist/prospect-client/Link/LinkApollo.d.ts +1 -1
- package/dist/prospect-client/Link/LinkApollo.js +1 -1
- package/dist/prospect-client/Link/LinkCommon.d.ts +1 -2
- package/dist/prospect-client/Link/LinkLF.d.ts +1 -1
- package/dist/prospect-client/Link/LinkLF.js +1 -1
- package/dist/prospect-client/pages/ErrorPage/ErrorPageApollo.d.ts +3 -0
- package/dist/prospect-client/pages/ErrorPage/ErrorPageApollo.js +5 -0
- package/dist/prospect-client/pages/ErrorPage/ErrorPageCommon.d.ts +12 -0
- package/dist/prospect-client/pages/ErrorPage/ErrorPageCommon.js +7 -0
- package/dist/prospect-client/pages/ErrorPage/ErrorPageLF.d.ts +3 -0
- package/dist/prospect-client/pages/ErrorPage/ErrorPageLF.js +5 -0
- package/dist/prospect-client/pages/ValidPage/ValidPageApollo.d.ts +3 -0
- package/dist/prospect-client/pages/ValidPage/ValidPageApollo.js +6 -0
- package/dist/prospect-client/pages/ValidPage/ValidPageCommon.d.ts +15 -0
- package/dist/prospect-client/pages/ValidPage/ValidPageCommon.js +7 -0
- package/dist/prospect-client/pages/ValidPage/ValidPageLF.d.ts +3 -0
- package/dist/prospect-client/pages/ValidPage/ValidPageLF.js +6 -0
- package/dist/prospect-client/utilities/types/GridContainerProps.d.ts +10 -0
- package/dist/prospect-client/utilities/types/GridContainerProps.js +1 -0
- package/dist/prospect.d.ts +8 -3
- package/dist/prospect.js +5 -1
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { CardMessage, cardMessageVariants, type CardMessageVariants, } from "./p
|
|
|
12
12
|
export { ClickIcon } from "./prospect-client/ClickIcon/ClickIconLF";
|
|
13
13
|
export { ContentItemDuoAction, type ContentItemDuoActionState, } from "./prospect-client/ContentItemDuoAction/ContentItemDuoActionLF";
|
|
14
14
|
export { ContentItemMono } from "./prospect-client/ContentItemMono/ContentItemMonoLF";
|
|
15
|
-
export { DataAgent } from "./prospect-client/DataAgent/DataAgentLF";
|
|
15
|
+
export { DataAgent, type DataAgentProps, } from "./prospect-client/DataAgent/DataAgentLF";
|
|
16
16
|
export { Divider } from "./prospect-client/Divider/DividerLF";
|
|
17
17
|
export { Fieldset, type FieldsetProps, } from "./prospect-client/Fieldset/FieldsetLF";
|
|
18
18
|
export { CardCheckbox,
|
|
@@ -43,12 +43,12 @@ export { CardRadioOption } from "./prospect-client/Form/Radio/CardRadioOption/Ca
|
|
|
43
43
|
export { Radio } from "./prospect-client/Form/Radio/Radio/RadioLF";
|
|
44
44
|
export { TextArea } from "./prospect-client/Form/TextArea/TextAreaLF";
|
|
45
45
|
export { DebugGrid } from "./prospect-client/Grid/DebugGridLF";
|
|
46
|
-
export { Heading, type HeadingLevel, } from "./prospect-client/Heading/HeadingLF";
|
|
46
|
+
export { Heading, type HeadingLevel, type HeadingProps, } from "./prospect-client/Heading/HeadingLF";
|
|
47
47
|
export { Icon, iconSizeVariants, iconVariants, type IconSizeVariants, type IconVariants, } from "./prospect-client/Icon/IconLF";
|
|
48
48
|
export { ItemTabBar, type ItemTabBarProps, } from "./prospect-client/ItemTabBar/ItemTabBarLF";
|
|
49
49
|
export { Footer, type FooterProps, } from "./prospect-client/Layout/Footer/FooterLF";
|
|
50
50
|
export { LevelSelector, type LevelSelectorProps, } from "./prospect-client/LevelSelector/LevelSelectorLF";
|
|
51
|
-
export { Link, linkVariants, type LinkVariants, } from "./prospect-client/Link/LinkLF";
|
|
51
|
+
export { Link, linkVariants, type LinkVariants, type LinkProps, } from "./prospect-client/Link/LinkLF";
|
|
52
52
|
export { ClickItem, clickItemStates, clickItemVariants, type ClickItemStates, type ClickItemVariants, } from "./prospect-client/List/ClickItem/ClickItemLF";
|
|
53
53
|
export { ContentItemDuo } from "./prospect-client/List/ContentItemDuo/ContentItemDuoLF";
|
|
54
54
|
export { List, type ListProps } from "./prospect-client/List/List/ListLF";
|
|
@@ -69,3 +69,8 @@ export { TimelineVertical } from "./prospect-client/TimelineVertical/TimelineVer
|
|
|
69
69
|
export { Toggle } from "./prospect-client/Toggle/ToggleLF";
|
|
70
70
|
export { Table, type TableProps, type HeadColorVariants, type BodyColorVariants, type RowSizeVariants, } from "./prospect-client/Table/TableLF";
|
|
71
71
|
export { TableMobileCard, type TableMobileCardProps, } from "./prospect-client/TableMobileCard/TableMobileCard";
|
|
72
|
+
export { ExitLayout, type ExitLayoutWithSubComponents, type ExitLayoutProps, } from "./prospect-client/Layout/ExitLayout/ExitLayoutLF";
|
|
73
|
+
export { FormLayout, type FormLayoutProps, } from "./prospect-client/Layout/FormLayout/FormLayout";
|
|
74
|
+
export { ValidPage, type ValidPageProps, } from "./prospect-client/pages/ValidPage/ValidPageLF";
|
|
75
|
+
export { ErrorPage, type ErrorPageProps, } from "./prospect-client/pages/ErrorPage/ErrorPageLF";
|
|
76
|
+
export type { GridContainerProps } from "./prospect-client/utilities/types/GridContainerProps";
|
package/dist/client.js
CHANGED
|
@@ -12,7 +12,7 @@ export { CardMessage, cardMessageVariants, } from "./prospect-client/CardMessage
|
|
|
12
12
|
export { ClickIcon } from "./prospect-client/ClickIcon/ClickIconLF";
|
|
13
13
|
export { ContentItemDuoAction, } from "./prospect-client/ContentItemDuoAction/ContentItemDuoActionLF";
|
|
14
14
|
export { ContentItemMono } from "./prospect-client/ContentItemMono/ContentItemMonoLF";
|
|
15
|
-
export { DataAgent } from "./prospect-client/DataAgent/DataAgentLF";
|
|
15
|
+
export { DataAgent, } from "./prospect-client/DataAgent/DataAgentLF";
|
|
16
16
|
export { Divider } from "./prospect-client/Divider/DividerLF";
|
|
17
17
|
export { Fieldset, } from "./prospect-client/Fieldset/FieldsetLF";
|
|
18
18
|
export { CardCheckbox,
|
|
@@ -68,3 +68,7 @@ export { TimelineVertical } from "./prospect-client/TimelineVertical/TimelineVer
|
|
|
68
68
|
export { Toggle } from "./prospect-client/Toggle/ToggleLF";
|
|
69
69
|
export { Table, } from "./prospect-client/Table/TableLF";
|
|
70
70
|
export { TableMobileCard, } from "./prospect-client/TableMobileCard/TableMobileCard";
|
|
71
|
+
export { ExitLayout, } from "./prospect-client/Layout/ExitLayout/ExitLayoutLF";
|
|
72
|
+
export { FormLayout, } from "./prospect-client/Layout/FormLayout/FormLayout";
|
|
73
|
+
export { ValidPage, } from "./prospect-client/pages/ValidPage/ValidPageLF";
|
|
74
|
+
export { ErrorPage, } from "./prospect-client/pages/ErrorPage/ErrorPageLF";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type DataAgentProps } from "./DataAgentCommon";
|
|
2
2
|
import "@axa-fr/canopee-css/prospect/DataAgent/DataAgentApollo.css";
|
|
3
|
+
export { type DataAgentProps } from "./DataAgentCommon";
|
|
3
4
|
export declare const DataAgent: (props: DataAgentProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type DataAgentProps } from "./DataAgentCommon";
|
|
2
2
|
import "@axa-fr/canopee-css/client/DataAgent/DataAgentLF.css";
|
|
3
|
+
export { type DataAgentProps } from "./DataAgentCommon";
|
|
3
4
|
export declare const DataAgent: (props: DataAgentProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ComponentType, type ReactNode } from "react";
|
|
2
2
|
import type { ItemMessageProps } from "../../ItemMessage/ItemMessageCommon";
|
|
3
3
|
import type { CardCheckboxOptionProps } from "../CardCheckboxOption/CardCheckboxOptionCommon";
|
|
4
|
+
import { GridContainerProps } from "../../../utilities/types/GridContainerProps";
|
|
4
5
|
type CheckboxOption = Omit<CardCheckboxOptionProps, "name" | "type">;
|
|
5
6
|
export type CardCheckboxProps = Omit<CardCheckboxOptionProps, "value" | "label" | "type" | "icon" | "description" | "subtitle" | "children"> & {
|
|
6
7
|
type?: "vertical" | "horizontal";
|
|
@@ -23,13 +24,14 @@ export type CardCheckboxProps = Omit<CardCheckboxOptionProps, "value" | "label"
|
|
|
23
24
|
* @deprecated Use `message` and messageType instead.
|
|
24
25
|
*/
|
|
25
26
|
error?: string;
|
|
27
|
+
containerProps?: GridContainerProps<"fieldset">;
|
|
26
28
|
} & Partial<ItemMessageProps>;
|
|
27
29
|
type CardCheckboxCommonProps = CardCheckboxProps & {
|
|
28
30
|
CardCheckboxItemComponent: ComponentType<CardCheckboxOptionProps>;
|
|
29
31
|
ItemMessageComponent: ComponentType<ItemMessageProps>;
|
|
30
32
|
};
|
|
31
33
|
export declare const CardCheckboxCommon: {
|
|
32
|
-
({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, type, error, name, id, onChange, CardCheckboxItemComponent, ItemMessageComponent, message, messageType, ...inputProps }: CardCheckboxCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
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;
|
|
33
35
|
displayName: string;
|
|
34
36
|
};
|
|
35
37
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
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", ...inputProps }) => {
|
|
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 }) => {
|
|
4
4
|
const generatedId = useId();
|
|
5
5
|
const cardCheckboxId = id || generatedId;
|
|
6
6
|
const messageId = `${cardCheckboxId}-error`;
|
|
@@ -23,7 +23,7 @@ export const CardCheckboxCommon = ({ className, labelGroup, descriptionGroup, la
|
|
|
23
23
|
onChange(event);
|
|
24
24
|
};
|
|
25
25
|
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
26
|
-
return (_jsxs("fieldset", { className: ["af-card-checkbox", className].filter(Boolean).join(" "), id: cardCheckboxId, 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: [
|
|
26
|
+
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
27
|
"af-card-checkbox__options",
|
|
28
28
|
`af-card-checkbox__options--${type}`,
|
|
29
29
|
].join(" "), ref: cardCheckboxOptionsRef, children: options.map((cardCheckboxItemProps) => (_jsx(CardCheckboxItemComponent, { 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 })] }));
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { type ReactNode, type ComponentType } from "react";
|
|
2
2
|
import type { ItemMessageProps } from "../../ItemMessage/ItemMessageCommon";
|
|
3
3
|
import type { CheckboxProps } from "../Checkbox/CheckboxCommon";
|
|
4
|
+
import { GridContainerProps } from "../../../utilities/types/GridContainerProps";
|
|
4
5
|
export type CheckboxTextProps = {
|
|
5
6
|
label: string | ReactNode;
|
|
6
7
|
/**
|
|
7
8
|
* @deprecated Use `message` and messageType instead.
|
|
8
9
|
*/
|
|
9
10
|
errorMessage?: string;
|
|
11
|
+
containerProps?: GridContainerProps;
|
|
10
12
|
} & Omit<CheckboxProps, "aria-errormessage" | "aria-invalid"> & Partial<ItemMessageProps>;
|
|
11
13
|
export type CheckboxTextCommonProps = CheckboxTextProps & {
|
|
12
14
|
CheckboxComponent: ComponentType<Omit<CheckboxProps, "checkBoxIcon">>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId, forwardRef } from "react";
|
|
3
|
-
const CheckboxTextCommon = forwardRef(({ label, errorMessage, id, message, messageType, CheckboxComponent, ItemMessageComponent, ...inputProps }, ref) => {
|
|
3
|
+
const CheckboxTextCommon = forwardRef(({ label, errorMessage, id, message, messageType, CheckboxComponent, ItemMessageComponent, containerProps, ...inputProps }, ref) => {
|
|
4
4
|
const generatedId = useId();
|
|
5
5
|
const inputId = id ?? generatedId;
|
|
6
6
|
const messageId = `${inputId}-error`;
|
|
7
7
|
const hasError = (Boolean(message) && messageType === "error") || Boolean(errorMessage);
|
|
8
|
-
return (_jsxs("div", { className: "af-checkbox-text", children: [_jsxs("label", { htmlFor: inputId, children: [_jsx(CheckboxComponent, { id: inputId, ...inputProps, "aria-errormessage": hasError ? messageId : undefined, "aria-invalid": hasError || undefined, ref: ref }), _jsx("span", { className: "af-checkbox-text__label-content", children: label })] }), _jsx(ItemMessageComponent, { message: message || errorMessage, id: messageId, messageType: messageType })] }));
|
|
8
|
+
return (_jsxs("div", { className: "af-checkbox-text", ...containerProps, children: [_jsxs("label", { htmlFor: inputId, children: [_jsx(CheckboxComponent, { id: inputId, ...inputProps, "aria-errormessage": hasError ? messageId : undefined, "aria-invalid": hasError || undefined, ref: ref }), _jsx("span", { className: "af-checkbox-text__label-content", children: label })] }), _jsx(ItemMessageComponent, { message: message || errorMessage, id: messageId, messageType: messageType })] }));
|
|
9
9
|
});
|
|
10
10
|
CheckboxTextCommon.displayName = "CheckboxTextCommon";
|
|
11
11
|
export { CheckboxTextCommon };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ComponentProps, type ComponentPropsWithRef, type ComponentType } from "react";
|
|
2
2
|
import { ItemLabelCommon, type ItemLabelProps } from "../ItemLabel/ItemLabelCommon";
|
|
3
3
|
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
4
|
+
import { GridContainerProps } from "../../utilities/types/GridContainerProps";
|
|
4
5
|
export type DropdownProps = ComponentPropsWithRef<"select"> & {
|
|
5
6
|
id?: string;
|
|
6
7
|
classModifier?: string;
|
|
@@ -16,6 +17,7 @@ export type DropdownProps = ComponentPropsWithRef<"select"> & {
|
|
|
16
17
|
placeholder?: string;
|
|
17
18
|
description?: string;
|
|
18
19
|
helper?: string;
|
|
20
|
+
containerProps?: GridContainerProps;
|
|
19
21
|
} & Pick<ItemLabelProps, "buttonLabel" | "moreButtonLabel" | "onButtonClick" | "onMoreButtonClick" | "sideButtonLabel" | "onSideButtonClick"> & Pick<ItemMessageProps, "message" | "messageType">;
|
|
20
22
|
type DropdownCommonProps = DropdownProps & {
|
|
21
23
|
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { forwardRef, useId, } from "react";
|
|
4
|
-
const DropdownCommon = forwardRef(({ id, required, label, error, placeholder, children, helper, success, message, messageType, description, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, ...otherProps }, inputRef) => {
|
|
4
|
+
const DropdownCommon = forwardRef(({ id, required, label, error, placeholder, children, helper, success, message, messageType, description, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, containerProps, ...otherProps }, inputRef) => {
|
|
5
5
|
const idMessage = useId();
|
|
6
6
|
let inputId = useId();
|
|
7
7
|
inputId = id || inputId;
|
|
8
8
|
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
9
9
|
const classname = classNames("af-form__dropdown-input", hasError && "af-form__dropdown-input--error");
|
|
10
|
-
return (_jsxs("div", { className: "af-form__dropdown-container", children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsxs("select", { className: classname, ...otherProps, ref: inputRef, id: inputId, children: [Boolean(placeholder) && _jsx("option", { value: "", children: placeholder }), children] }), helper ? (_jsx("span", { className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idMessage, message: message || error || success, messageType: messageType || (error ? "error" : "success") })] }));
|
|
10
|
+
return (_jsxs("div", { className: "af-form__dropdown-container", ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsxs("select", { className: classname, ...otherProps, ref: inputRef, id: inputId, children: [Boolean(placeholder) && _jsx("option", { value: "", children: placeholder }), children] }), helper ? (_jsx("span", { className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idMessage, message: message || error || success, messageType: messageType || (error ? "error" : "success") })] }));
|
|
11
11
|
});
|
|
12
12
|
DropdownCommon.displayName = "Dropdown";
|
|
13
13
|
export { DropdownCommon };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef, type ComponentType, type MouseEventHandler, type ReactNode } from "react";
|
|
2
2
|
import { type ItemLabelProps } from "../../ItemLabel/ItemLabelCommon";
|
|
3
3
|
import { type ItemMessageProps } from "../../ItemMessage/ItemMessageCommon";
|
|
4
|
+
import { GridContainerProps } from "../../../utilities/types/GridContainerProps";
|
|
4
5
|
type LabelProps = Partial<Omit<ItemLabelProps, "children" | "label" | "description" | "sideButtonLabel" | "onSideButtonClick" | "moreButtonLabel" | "onMoreButtonClick">>;
|
|
5
6
|
export type InputFileProps = Omit<ComponentPropsWithRef<"input">, "type"> & {
|
|
6
7
|
/**
|
|
@@ -51,6 +52,7 @@ export type InputFileProps = Omit<ComponentPropsWithRef<"input">, "type"> & {
|
|
|
51
52
|
or?: ReactNode;
|
|
52
53
|
button?: ReactNode;
|
|
53
54
|
};
|
|
55
|
+
containerProps?: GridContainerProps;
|
|
54
56
|
} & Omit<ItemMessageProps, "id">;
|
|
55
57
|
type InputFileCommonProps = InputFileProps & {
|
|
56
58
|
ItemLabelComponent: ComponentType<ItemLabelProps>;
|
|
@@ -8,7 +8,7 @@ const DEFAULT_DROPZONE_LABELS = {
|
|
|
8
8
|
or: "ou",
|
|
9
9
|
button: "Importer fichier",
|
|
10
10
|
};
|
|
11
|
-
export const InputFileCommon = forwardRef(({ ItemLabelComponent, ItemMessageComponent, id, label, description, sideButtonLabel, onSideButtonClick, moreButtonLabel, onMoreButtonClick, labelProps, helper, required, message, messageType = "error", className,
|
|
11
|
+
export const InputFileCommon = forwardRef(({ ItemLabelComponent, ItemMessageComponent, id, label, description, sideButtonLabel, onSideButtonClick, moreButtonLabel, onMoreButtonClick, labelProps, helper, required, message, messageType = "error", className, dropzoneLabels = {}, children, containerProps, ...props }, ref) => {
|
|
12
12
|
const generatedId = useId();
|
|
13
13
|
const inputId = id || generatedId;
|
|
14
14
|
const messageId = `${inputId}-message`;
|
|
@@ -26,7 +26,7 @@ export const InputFileCommon = forwardRef(({ ItemLabelComponent, ItemMessageComp
|
|
|
26
26
|
return (_jsxs("div", { className: getClassName({
|
|
27
27
|
baseClassName: "af-input-file",
|
|
28
28
|
className,
|
|
29
|
-
}),
|
|
29
|
+
}), ...containerProps, children: [_jsx(ItemLabelComponent, { htmlFor: inputId, description: description, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, moreButtonLabel: moreButtonLabel, onMoreButtonClick: onMoreButtonClick, required: required, ...labelProps, children: label }), _jsxs("div", { className: "af-input-file__container", children: [_jsxs("span", { className: getClassName({
|
|
30
30
|
baseClassName: "af-input-file__dropzone",
|
|
31
31
|
modifiers: [hasError && "error"],
|
|
32
32
|
}), children: [_jsx("input", { ref: ref, type: "file", id: inputId, required: required, "aria-invalid": hasError || undefined, "aria-errormessage": hasError ? messageId : undefined, "aria-describedby": ariaDescribedby.length > 0
|
|
@@ -2,6 +2,7 @@ import { type ComponentProps, type ComponentPropsWithRef, type ComponentType } f
|
|
|
2
2
|
import { ItemLabelCommon, type ItemLabelProps } from "../ItemLabel/ItemLabelCommon";
|
|
3
3
|
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
4
4
|
import { type InputDateAtomProps } from "./InputDateAtom";
|
|
5
|
+
import { GridContainerProps } from "../../utilities/types/GridContainerProps";
|
|
5
6
|
export type InputDateProps = Omit<ComponentPropsWithRef<"input">, "value" | "min" | "max"> & {
|
|
6
7
|
classModifier?: string;
|
|
7
8
|
defaultValue?: Date | string;
|
|
@@ -19,6 +20,7 @@ export type InputDateProps = Omit<ComponentPropsWithRef<"input">, "value" | "min
|
|
|
19
20
|
success?: string;
|
|
20
21
|
hidePicker?: boolean;
|
|
21
22
|
label: ItemLabelProps["children"];
|
|
23
|
+
containerProps?: GridContainerProps;
|
|
22
24
|
} & Partial<Pick<ItemLabelProps, "description" | "buttonLabel" | "moreButtonLabel" | "onButtonClick" | "onMoreButtonClick"> & ItemMessageProps>;
|
|
23
25
|
type InputDateCommonProps = InputDateProps & {
|
|
24
26
|
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
@@ -3,7 +3,7 @@ import { forwardRef, useId, } from "react";
|
|
|
3
3
|
import { getClassName } from "../../utilities/getClassName";
|
|
4
4
|
import { InputDateAtom } from "./InputDateAtom";
|
|
5
5
|
import { InputDateTextAtom } from "./InputDateTextAtom";
|
|
6
|
-
const InputDateCommon = forwardRef(({ className, classModifier = "", helper, error, success, message, messageType, label, description, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, ItemLabelComponent, ItemMessageComponent, required, hidePicker, max, min, ...otherProps }, inputRef) => {
|
|
6
|
+
const InputDateCommon = forwardRef(({ className, classModifier = "", helper, error, success, message, messageType, label, description, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, ItemLabelComponent, ItemMessageComponent, required, hidePicker, max, min, containerProps, ...otherProps }, inputRef) => {
|
|
7
7
|
const componentClassName = getClassName({
|
|
8
8
|
baseClassName: "af-form__input-date",
|
|
9
9
|
modifiers: classModifier.split(" "),
|
|
@@ -24,7 +24,7 @@ const InputDateCommon = forwardRef(({ className, classModifier = "", helper, err
|
|
|
24
24
|
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
25
25
|
const ariaErrormessage = hasError ? idMessage : undefined;
|
|
26
26
|
const ariaInvalid = hasError || undefined;
|
|
27
|
-
return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, required: required, htmlFor: inputId, children: label }), hidePicker ? (_jsx(InputDateTextAtom, { ...otherProps, id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": ariaErrormessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, required: required })) : (_jsx(InputDateAtom, { ...otherProps, id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": ariaErrormessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, required: required, max: max, min: min })), helper ? (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idMessage, message: message || error || success, messageType: messageType || (error ? "error" : "success") })] }));
|
|
27
|
+
return (_jsxs("div", { className: "af-form__input-container", ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, required: required, htmlFor: inputId, children: label }), hidePicker ? (_jsx(InputDateTextAtom, { ...otherProps, id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": ariaErrormessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, required: required })) : (_jsx(InputDateAtom, { ...otherProps, id: inputId, className: componentClassName, ref: inputRef, "aria-errormessage": ariaErrormessage, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, required: required, max: max, min: min })), helper ? (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idMessage, message: message || error || success, messageType: messageType || (error ? "error" : "success") })] }));
|
|
28
28
|
});
|
|
29
29
|
InputDateCommon.displayName = "InputDate";
|
|
30
30
|
export { InputDateCommon };
|
|
@@ -5,6 +5,7 @@ import { InputTextAtom } from "../InputTextAtom/InputTextAtomCommon";
|
|
|
5
5
|
import { ItemLabelCommon, type ItemLabelProps } from "../ItemLabel/ItemLabelCommon";
|
|
6
6
|
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
7
7
|
import { type OptionType } from "./InputPhone.types";
|
|
8
|
+
import { GridContainerProps } from "../../utilities/types/GridContainerProps";
|
|
8
9
|
export type InputPhoneProps = ComponentPropsWithRef<"input"> & {
|
|
9
10
|
classModifier?: string;
|
|
10
11
|
helper?: string;
|
|
@@ -24,6 +25,7 @@ export type InputPhoneProps = ComponentPropsWithRef<"input"> & {
|
|
|
24
25
|
onChangeInput?: (value: string) => void;
|
|
25
26
|
mask?: (value: string) => string;
|
|
26
27
|
label: ItemLabelProps["children"];
|
|
28
|
+
containerProps?: GridContainerProps;
|
|
27
29
|
} & Pick<ItemLabelProps, "description" | "moreButtonLabel" | "buttonLabel" | "onMoreButtonClick" | "onButtonClick" | "sideButtonLabel" | "onSideButtonClick"> & Pick<ItemMessageProps, "message" | "messageType">;
|
|
28
30
|
type InputPhoneCommonProps = InputPhoneProps & {
|
|
29
31
|
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
3
|
import { CountryCodeSelect } from "./CountryCodeSelect";
|
|
4
4
|
import { maskFrenchPhoneNumber } from "./maskFrenchPhoneNumber";
|
|
5
|
-
const InputPhoneCommon = forwardRef(({ className, classModifier = "", helper, error, success, message, messageType, defaultCountry, showSelect, disabled, label, description, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, required, sideButtonLabel, onSideButtonClick, countryCodeOptions = [], onChangeSelect, onChangeInput, mask = maskFrenchPhoneNumber, ItemLabelComponent, ItemMessageComponent, InputTextComponent, IconComponent, "aria-errormessage": ariaErrormessage, ...otherProps }, inputRef) => {
|
|
5
|
+
const InputPhoneCommon = forwardRef(({ className, classModifier = "", helper, error, success, message, messageType, defaultCountry, showSelect, disabled, label, description, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, required, sideButtonLabel, onSideButtonClick, countryCodeOptions = [], onChangeSelect, onChangeInput, mask = maskFrenchPhoneNumber, ItemLabelComponent, ItemMessageComponent, InputTextComponent, IconComponent, "aria-errormessage": ariaErrormessage, containerProps, ...otherProps }, inputRef) => {
|
|
6
6
|
let inputId = useId();
|
|
7
7
|
inputId = otherProps.id || inputId;
|
|
8
8
|
const idMessage = useId();
|
|
@@ -24,7 +24,7 @@ const InputPhoneCommon = forwardRef(({ className, classModifier = "", helper, er
|
|
|
24
24
|
const maskedValue = mask(rawValue);
|
|
25
25
|
onChangeInput?.(maskedValue);
|
|
26
26
|
};
|
|
27
|
-
return (_jsxs("div", { className: "af-form__input-phone-container", children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsxs("div", { className: "af-form__input-phone-fields", children: [showSelect ? (_jsx("div", { className: "af-form__country-code-wrapper", children: _jsx(CountryCodeSelect, { options: countryCodeOptions, defaultCountry: defaultCountry, onChangeSelect: onChangeSelect, IconComponent: IconComponent, disabled: disabled }) })) : null, _jsx(InputTextComponent, { ...otherProps, className: ["af-form__input-phone", className]
|
|
27
|
+
return (_jsxs("div", { className: "af-form__input-phone-container", ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsxs("div", { className: "af-form__input-phone-fields", children: [showSelect ? (_jsx("div", { className: "af-form__country-code-wrapper", children: _jsx(CountryCodeSelect, { options: countryCodeOptions, defaultCountry: defaultCountry, onChangeSelect: onChangeSelect, IconComponent: IconComponent, disabled: disabled }) })) : null, _jsx(InputTextComponent, { ...otherProps, className: ["af-form__input-phone", className]
|
|
28
28
|
.filter(Boolean)
|
|
29
29
|
.join(" "), classModifier: classModifier, ref: inputRef, error: hasError ? messageType || error : undefined, type: "tel", required: required, placeholder: otherProps.placeholder, "aria-errormessage": ariaErrormessage, value: otherProps.value, onChange: handleChangeNumber, disabled: disabled, idMessage: hasError ? idMessage : undefined, idHelp: ariaDescribedby.length > 0 ? ariaDescribedby.join(" ") : undefined, id: inputId })] }), helper ? (_jsx("span", { id: idHelp, className: "af-form__input-phone-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idMessage, message: message || error || success, messageType: messageType || (error ? "error" : "success") })] }));
|
|
30
30
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { type ComponentProps, type
|
|
1
|
+
import { type ComponentProps, type ComponentType, type ReactNode } from "react";
|
|
2
2
|
import { InputTextAtom } from "../InputTextAtom/InputTextAtomCommon";
|
|
3
3
|
import { ItemLabelCommon, type ItemLabelProps } from "../ItemLabel/ItemLabelCommon";
|
|
4
4
|
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
5
|
-
|
|
5
|
+
import type { GridContainerProps } from "../../utilities/types/GridContainerProps";
|
|
6
|
+
export type InputTextProps = ComponentProps<"input"> & {
|
|
6
7
|
unit?: ReactNode;
|
|
7
8
|
classModifier?: string;
|
|
8
9
|
label?: ItemLabelProps["children"];
|
|
@@ -15,6 +16,7 @@ export type InputTextProps = ComponentPropsWithRef<"input"> & {
|
|
|
15
16
|
* @deprecated Use `message` and messageType instead.
|
|
16
17
|
*/
|
|
17
18
|
success?: string;
|
|
19
|
+
containerProps?: GridContainerProps;
|
|
18
20
|
} & Pick<ItemLabelProps, "description" | "moreButtonLabel" | "buttonLabel" | "onMoreButtonClick" | "onButtonClick" | "sideButtonLabel" | "onSideButtonClick"> & Pick<ItemMessageProps, "message" | "messageType">;
|
|
19
21
|
type InputTextCommonProps = InputTextProps & {
|
|
20
22
|
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
|
-
const InputTextCommon = forwardRef(({ unit, className, classModifier = "", helper, error, success, message, messageType, label, description, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, required, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, InputTextAtomComponent, ...otherProps }, inputRef) => {
|
|
3
|
+
const InputTextCommon = forwardRef(({ unit, className, classModifier = "", helper, error, success, message, messageType, label, description, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, required, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, InputTextAtomComponent, containerProps, ...otherProps }, inputRef) => {
|
|
4
4
|
let inputId = useId();
|
|
5
5
|
inputId = otherProps.id || inputId;
|
|
6
6
|
const idMessage = useId();
|
|
7
7
|
const idHelp = useId();
|
|
8
8
|
const ariaDescribedby = [helper && idHelp, success && idMessage].filter(Boolean);
|
|
9
|
-
return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsx(InputTextAtomComponent, { id: inputId, ref: inputRef, unit: unit, className: className, classModifier: classModifier, error: (message && messageType === "error") || Boolean(error)
|
|
9
|
+
return (_jsxs("div", { className: "af-form__input-container", ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsx(InputTextAtomComponent, { id: inputId, ref: inputRef, unit: unit, className: className, classModifier: classModifier, error: (message && messageType === "error") || Boolean(error)
|
|
10
10
|
? messageType || error
|
|
11
11
|
: undefined, required: required, idMessage: message || error ? idMessage : undefined, idHelp: ariaDescribedby.length > 0 ? ariaDescribedby.join(" ") : undefined, ...otherProps }), helper ? (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: idMessage, message: message || error || success, messageType: messageType || (error ? "error" : "success") })] }));
|
|
12
12
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ComponentProps, type ComponentType, type PropsWithChildren, type ReactNode } from "react";
|
|
2
2
|
import { ItemMessage, type ItemMessageProps } from "../../ItemMessage/ItemMessageCommon";
|
|
3
3
|
import { type CardRadioOptionProps } from "../CardRadioOption/CardRadioOptionCommon";
|
|
4
|
+
import { GridContainerProps } from "../../../utilities/types/GridContainerProps";
|
|
4
5
|
type RadioOption = Omit<CardRadioOptionProps, "name" | "type" | "isInvalid">;
|
|
5
6
|
export type CardRadioGroupProps = Omit<CardRadioOptionProps, "value" | "label" | "type" | "isInvalid" | "icon" | "src" | "basePictureProps" | "description" | "subtitle" | "children" | "position"> & {
|
|
6
7
|
/**
|
|
@@ -32,13 +33,14 @@ export type CardRadioGroupProps = Omit<CardRadioOptionProps, "value" | "label" |
|
|
|
32
33
|
* @deprecated Use `message` and messageType instead.
|
|
33
34
|
*/
|
|
34
35
|
error?: ReactNode;
|
|
36
|
+
containerProps?: GridContainerProps<"fieldset">;
|
|
35
37
|
} & PropsWithChildren & Partial<ItemMessageProps>;
|
|
36
38
|
export type CardRadioCommonProps = CardRadioGroupProps & {
|
|
37
39
|
CardRadioOptionComponent: ComponentType<CardRadioOptionProps>;
|
|
38
40
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
39
41
|
};
|
|
40
42
|
declare const CardRadioGroupCommon: {
|
|
41
|
-
({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, cardStyle, type, position, error, message, messageType, name, value, id, CardRadioOptionComponent, ItemMessageComponent, ...inputProps }: CardRadioCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, cardStyle, type, position, error, message, messageType, name, value, id, CardRadioOptionComponent, ItemMessageComponent, containerProps, ...inputProps }: CardRadioCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
42
44
|
displayName: string;
|
|
43
45
|
};
|
|
44
46
|
export { CardRadioGroupCommon };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId, } from "react";
|
|
3
|
-
const CardRadioGroupCommon = ({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, cardStyle, type = "vertical", position = (cardStyle ?? type) === "vertical" ? "column" : "line", error, message, messageType = "error", name, value, id, CardRadioOptionComponent, ItemMessageComponent, ...inputProps }) => {
|
|
3
|
+
const CardRadioGroupCommon = ({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, cardStyle, type = "vertical", position = (cardStyle ?? type) === "vertical" ? "column" : "line", error, message, messageType = "error", name, value, id, CardRadioOptionComponent, ItemMessageComponent, containerProps, ...inputProps }) => {
|
|
4
4
|
const generatedId = useId();
|
|
5
5
|
const cardRadioGroupId = id ?? generatedId;
|
|
6
6
|
const messageId = `${cardRadioGroupId}-error`;
|
|
7
7
|
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
8
|
-
return (_jsxs("fieldset", { className: ["af-card-radio-group", className].filter(Boolean).join(" "), role: "radiogroup", "aria-required": Boolean(required) || undefined, "aria-invalid": hasError || undefined, "aria-errormessage": hasError ? messageId : undefined, id: cardRadioGroupId, children: [_jsxs("legend", { className: "af-card-radio-group__legend", children: [_jsxs("p", { className: "af-card-radio-group__label", children: [label, labelGroup, required || isRequired ? _jsx("span", { "aria-hidden": true, children: "*" }) : null] }), description || descriptionGroup ? (_jsxs("p", { className: "af-card-radio-group__description", children: [description, descriptionGroup] })) : null] }), _jsx("div", { className: [
|
|
8
|
+
return (_jsxs("fieldset", { className: ["af-card-radio-group", className].filter(Boolean).join(" "), role: "radiogroup", "aria-required": Boolean(required) || undefined, "aria-invalid": hasError || undefined, "aria-errormessage": hasError ? messageId : undefined, id: cardRadioGroupId, ...containerProps, children: [_jsxs("legend", { className: "af-card-radio-group__legend", children: [_jsxs("p", { className: "af-card-radio-group__label", children: [label, labelGroup, required || isRequired ? _jsx("span", { "aria-hidden": true, children: "*" }) : null] }), description || descriptionGroup ? (_jsxs("p", { className: "af-card-radio-group__description", children: [description, descriptionGroup] })) : null] }), _jsx("div", { className: [
|
|
9
9
|
"af-card-radio-group__options",
|
|
10
10
|
`af-card-radio-group__options--${position}`,
|
|
11
11
|
].join(" "), children: options.map((cardRadioItemProps) => (_jsx(CardRadioOptionComponent, { id: `${cardRadioGroupId}-${cardRadioItemProps.value}`, checked: value !== undefined
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ComponentProps, ComponentPropsWithRef, type ComponentType } from "react";
|
|
2
2
|
import { ItemLabelCommon, type ItemLabelProps } from "../ItemLabel/ItemLabelCommon";
|
|
3
3
|
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
4
|
+
import { GridContainerProps } from "../../utilities/types/GridContainerProps";
|
|
4
5
|
export type TextAreaProps = ComponentPropsWithRef<"textarea"> & {
|
|
5
6
|
label?: ItemLabelProps["children"];
|
|
6
7
|
helper?: string;
|
|
@@ -8,6 +9,7 @@ export type TextAreaProps = ComponentPropsWithRef<"textarea"> & {
|
|
|
8
9
|
* @deprecated Use `message` and messageType instead.
|
|
9
10
|
*/
|
|
10
11
|
error?: string;
|
|
12
|
+
containerProps?: GridContainerProps;
|
|
11
13
|
} & Pick<ItemLabelProps, "description" | "moreButtonLabel" | "buttonLabel" | "onMoreButtonClick" | "onButtonClick" | "sideButtonLabel" | "onSideButtonClick"> & Pick<ItemMessageProps, "message" | "messageType">;
|
|
12
14
|
type TextAreaCommonProps = TextAreaProps & {
|
|
13
15
|
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
|
-
const TextAreaCommon = forwardRef(({ id, className, label, description, helper, error, message, messageType, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, required, sideButtonLabel, ItemLabelComponent, ItemMessageComponent, onSideButtonClick, placeholder = " ", ...inputProps }, inputRef) => {
|
|
3
|
+
const TextAreaCommon = forwardRef(({ id, className, label, description, helper, error, message, messageType, buttonLabel, moreButtonLabel, onButtonClick, onMoreButtonClick, required, sideButtonLabel, ItemLabelComponent, ItemMessageComponent, onSideButtonClick, placeholder = " ", containerProps, ...inputProps }, inputRef) => {
|
|
4
4
|
const generatedId = useId();
|
|
5
5
|
const inputId = id ?? generatedId;
|
|
6
6
|
const helperId = `${inputId}-helper`;
|
|
@@ -8,7 +8,7 @@ const TextAreaCommon = forwardRef(({ id, className, label, description, helper,
|
|
|
8
8
|
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
9
9
|
return (_jsxs("div", { className: ["af-form__input-container", className]
|
|
10
10
|
.filter(Boolean)
|
|
11
|
-
.join(" "), children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsx("textarea", { id: inputId, className: "af-form__textarea", ref: inputRef, "aria-errormessage": hasError ? messageId : undefined, "aria-describedby": helper ? helperId : undefined, required: required, "aria-invalid": hasError || undefined, placeholder: placeholder, ...inputProps }), helper ? (_jsx("span", { id: helperId, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: messageId, message: message || error, messageType: messageType })] }));
|
|
11
|
+
.join(" "), ...containerProps, children: [_jsx(ItemLabelComponent, { description: description, moreButtonLabel: moreButtonLabel ?? buttonLabel, onMoreButtonClick: onMoreButtonClick ?? onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, htmlFor: inputId, children: label }), _jsx("textarea", { id: inputId, className: "af-form__textarea", ref: inputRef, "aria-errormessage": hasError ? messageId : undefined, "aria-describedby": helper ? helperId : undefined, required: required, "aria-invalid": hasError || undefined, placeholder: placeholder, ...inputProps }), helper ? (_jsx("span", { id: helperId, className: "af-form__input-helper", children: helper })) : null, _jsx(ItemMessageComponent, { id: messageId, message: message || error, messageType: messageType })] }));
|
|
12
12
|
});
|
|
13
13
|
TextAreaCommon.displayName = "TextArea";
|
|
14
14
|
export { TextAreaCommon };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ExitLayoutProps } from "./ExitLayoutCommon";
|
|
2
|
+
export { type ExitLayoutWithSubComponents, type ExitLayoutProps, } from "./ExitLayoutCommon";
|
|
3
|
+
export declare const ExitLayout: {
|
|
4
|
+
(props: ExitLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Agent: ({ children }: import("react").PropsWithChildren) => (string | number | bigint | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | {
|
|
6
|
+
props: {
|
|
7
|
+
className: string;
|
|
8
|
+
};
|
|
9
|
+
type: string | import("react").JSXElementConstructor<any>;
|
|
10
|
+
key: string | null;
|
|
11
|
+
} | {
|
|
12
|
+
props: {
|
|
13
|
+
className: string;
|
|
14
|
+
};
|
|
15
|
+
children: import("react").ReactNode;
|
|
16
|
+
type: string | import("react").JSXElementConstructor<any>;
|
|
17
|
+
key: string | null;
|
|
18
|
+
})[] | null | undefined;
|
|
19
|
+
Action: ({ children }: import("react").PropsWithChildren) => import("react").ReactNode;
|
|
20
|
+
Content: ({ children }: import("react").PropsWithChildren) => import("react").ReactNode;
|
|
21
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Heading } from "../../Heading/HeadingApollo";
|
|
3
|
+
import { Icon } from "../../Icon/IconApollo";
|
|
4
|
+
import { Agent, Action, Content, ExitLayoutCommon, } from "./ExitLayoutCommon";
|
|
5
|
+
export const ExitLayout = (props) => (_jsx(ExitLayoutCommon, { ...props, HeadingComponent: Heading, IconComponent: Icon }));
|
|
6
|
+
ExitLayout.Agent = Agent;
|
|
7
|
+
ExitLayout.Action = Action;
|
|
8
|
+
ExitLayout.Content = Content;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import "@axa-fr/canopee-css/prospect/Layout/ExitLayout/ExitLayoutAll.css";
|
|
2
|
+
import { ComponentType, type PropsWithChildren } from "react";
|
|
3
|
+
import { type HeadingProps } from "../../Heading/types";
|
|
4
|
+
import { type IconProps } from "../../Icon/IconCommon";
|
|
5
|
+
export type ExitLayoutProps = PropsWithChildren & {
|
|
6
|
+
headingProps?: HeadingProps;
|
|
7
|
+
iconProps?: Pick<IconProps, "variant" | "src" | "hasBackground">;
|
|
8
|
+
};
|
|
9
|
+
type ExitLayoutCommonProps = ExitLayoutProps & {
|
|
10
|
+
HeadingComponent: ComponentType<HeadingProps>;
|
|
11
|
+
IconComponent: ComponentType<IconProps>;
|
|
12
|
+
};
|
|
13
|
+
export declare const Agent: ({ children }: PropsWithChildren) => (string | number | bigint | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | {
|
|
14
|
+
props: {
|
|
15
|
+
className: string;
|
|
16
|
+
};
|
|
17
|
+
type: string | import("react").JSXElementConstructor<any>;
|
|
18
|
+
key: string | null;
|
|
19
|
+
} | {
|
|
20
|
+
props: {
|
|
21
|
+
className: string;
|
|
22
|
+
};
|
|
23
|
+
children: import("react").ReactNode;
|
|
24
|
+
type: string | import("react").JSXElementConstructor<any>;
|
|
25
|
+
key: string | null;
|
|
26
|
+
})[] | null | undefined;
|
|
27
|
+
export declare const Action: ({ children }: PropsWithChildren) => import("react").ReactNode;
|
|
28
|
+
export declare const Content: ({ children }: PropsWithChildren) => import("react").ReactNode;
|
|
29
|
+
export declare const ExitLayoutCommon: {
|
|
30
|
+
({ headingProps, iconProps, children, HeadingComponent, IconComponent, }: ExitLayoutCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
Agent: ({ children }: PropsWithChildren) => (string | number | bigint | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | {
|
|
32
|
+
props: {
|
|
33
|
+
className: string;
|
|
34
|
+
};
|
|
35
|
+
type: string | import("react").JSXElementConstructor<any>;
|
|
36
|
+
key: string | null;
|
|
37
|
+
} | {
|
|
38
|
+
props: {
|
|
39
|
+
className: string;
|
|
40
|
+
};
|
|
41
|
+
children: import("react").ReactNode;
|
|
42
|
+
type: string | import("react").JSXElementConstructor<any>;
|
|
43
|
+
key: string | null;
|
|
44
|
+
})[] | null | undefined;
|
|
45
|
+
Action: ({ children }: PropsWithChildren) => import("react").ReactNode;
|
|
46
|
+
Content: ({ children }: PropsWithChildren) => import("react").ReactNode;
|
|
47
|
+
};
|
|
48
|
+
type ExitLayoutSubComponents = Pick<typeof ExitLayoutCommon, "Agent" | "Action" | "Content">;
|
|
49
|
+
export type ExitLayoutWithSubComponents = ComponentType<ExitLayoutProps> & ExitLayoutSubComponents;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/canopee-css/prospect/Layout/ExitLayout/ExitLayoutAll.css";
|
|
3
|
+
import { Children, isValidElement, } from "react";
|
|
4
|
+
import { useIsSmallScreen } from "../../utilities/hook/useIsSmallScreen";
|
|
5
|
+
import { BREAKPOINT } from "../../utilities/constants";
|
|
6
|
+
export const Agent = ({ children }) => Children.map(children, function (child) {
|
|
7
|
+
if (isValidElement(child)) {
|
|
8
|
+
const childProps = typeof child.props === "object" && child.props !== null
|
|
9
|
+
? child.props
|
|
10
|
+
: {};
|
|
11
|
+
const existingClassName = "className" in childProps && typeof childProps.className === "string"
|
|
12
|
+
? childProps.className
|
|
13
|
+
: "";
|
|
14
|
+
return {
|
|
15
|
+
...child,
|
|
16
|
+
props: {
|
|
17
|
+
...childProps,
|
|
18
|
+
className: `${existingClassName} af-exit-page__agent`,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return child;
|
|
23
|
+
});
|
|
24
|
+
export const Action = ({ children }) => children;
|
|
25
|
+
export const Content = ({ children }) => children;
|
|
26
|
+
export const ExitLayoutCommon = ({ headingProps, iconProps, children, HeadingComponent, IconComponent, }) => {
|
|
27
|
+
const childrenArray = Children.toArray(children);
|
|
28
|
+
const isMobile = useIsSmallScreen(BREAKPOINT.SM);
|
|
29
|
+
const iconSize = isMobile ? "M" : "L";
|
|
30
|
+
const agent = childrenArray.find((child) => isValidElement(child) && child.type === Agent);
|
|
31
|
+
const action = childrenArray.find((child) => isValidElement(child) && child.type === Action);
|
|
32
|
+
const content = childrenArray.find((child) => isValidElement(child) && child.type === Content);
|
|
33
|
+
return (_jsxs("section", { className: "af-exit-page subgrid", children: [_jsxs("article", { className: "af-exit-page__content subgrid", children: [iconProps ? (_jsx(IconComponent, { ...iconProps, size: iconSize, role: "img" })) : null, headingProps ? (_jsx(HeadingComponent, { level: 2, ...headingProps, children: headingProps.title })) : null, content] }), agent, action ? (_jsx("div", { className: "af-exit-page__actions subgrid", children: action })) : null] }));
|
|
34
|
+
};
|
|
35
|
+
ExitLayoutCommon.Agent = Agent;
|
|
36
|
+
ExitLayoutCommon.Action = Action;
|
|
37
|
+
ExitLayoutCommon.Content = Content;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ExitLayoutProps } from "./ExitLayoutCommon";
|
|
2
|
+
export { type ExitLayoutWithSubComponents, type ExitLayoutProps, } from "./ExitLayoutCommon";
|
|
3
|
+
export declare const ExitLayout: {
|
|
4
|
+
(props: ExitLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Agent: ({ children }: import("react").PropsWithChildren) => (string | number | bigint | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | {
|
|
6
|
+
props: {
|
|
7
|
+
className: string;
|
|
8
|
+
};
|
|
9
|
+
type: string | import("react").JSXElementConstructor<any>;
|
|
10
|
+
key: string | null;
|
|
11
|
+
} | {
|
|
12
|
+
props: {
|
|
13
|
+
className: string;
|
|
14
|
+
};
|
|
15
|
+
children: import("react").ReactNode;
|
|
16
|
+
type: string | import("react").JSXElementConstructor<any>;
|
|
17
|
+
key: string | null;
|
|
18
|
+
})[] | null | undefined;
|
|
19
|
+
Action: ({ children }: import("react").PropsWithChildren) => import("react").ReactNode;
|
|
20
|
+
Content: ({ children }: import("react").PropsWithChildren) => import("react").ReactNode;
|
|
21
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Heading } from "../../Heading/HeadingLF";
|
|
3
|
+
import { Icon } from "../../Icon/IconLF";
|
|
4
|
+
import { Agent, Action, Content, ExitLayoutCommon, } from "./ExitLayoutCommon";
|
|
5
|
+
export const ExitLayout = (props) => (_jsx(ExitLayoutCommon, { ...props, HeadingComponent: Heading, IconComponent: Icon }));
|
|
6
|
+
ExitLayout.Agent = Agent;
|
|
7
|
+
ExitLayout.Action = Action;
|
|
8
|
+
ExitLayout.Content = Content;
|