@axa-fr/design-system-apollo-react 2.0.4-alpha.1 → 2.0.4-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.
- package/dist/Form/Checkbox/CardCheckbox/CardCheckboxCommon.d.ts +5 -2
- package/dist/Form/Checkbox/CardCheckbox/CardCheckboxCommon.js +4 -3
- package/dist/Form/Checkbox/CardCheckboxOption/CardCheckboxOptionCommon.d.ts +2 -1
- package/dist/Form/Checkbox/CardCheckboxOption/CardCheckboxOptionCommon.js +8 -9
- package/dist/Form/Checkbox/CheckboxText/CheckboxTextApollo.d.ts +2 -1
- package/dist/Form/Checkbox/CheckboxText/CheckboxTextApollo.js +2 -1
- package/dist/Form/Checkbox/CheckboxText/CheckboxTextCommon.d.ts +6 -2
- package/dist/Form/Checkbox/CheckboxText/CheckboxTextCommon.js +5 -3
- package/dist/Form/Checkbox/CheckboxText/CheckboxTextLF.d.ts +3 -2
- package/dist/Form/Checkbox/CheckboxText/CheckboxTextLF.js +3 -2
- package/dist/Form/Dropdown/DropdownApollo.d.ts +2 -3
- package/dist/Form/Dropdown/DropdownApollo.js +1 -1
- package/dist/Form/Dropdown/DropdownCommon.d.ts +16 -8
- package/dist/Form/Dropdown/DropdownCommon.js +6 -5
- package/dist/Form/Dropdown/DropdownLF.d.ts +2 -3
- package/dist/Form/Dropdown/DropdownLF.js +1 -1
- package/dist/Form/InputDate/InputDateApollo.d.ts +2 -26
- package/dist/Form/InputDate/InputDateApollo.js +1 -1
- package/dist/Form/InputDate/InputDateCommon.d.ts +16 -8
- package/dist/Form/InputDate/InputDateCommon.js +5 -4
- package/dist/Form/InputDate/InputDateLF.d.ts +2 -26
- package/dist/Form/InputDate/InputDateLF.js +1 -1
- package/dist/Form/InputPhone/InputPhoneApollo.d.ts +1 -1
- package/dist/Form/InputPhone/InputPhoneCommon.d.ts +11 -5
- package/dist/Form/InputPhone/InputPhoneCommon.js +5 -4
- package/dist/Form/InputPhone/InputPhoneLF.d.ts +1 -1
- package/dist/Form/InputText/InputTextApollo.d.ts +2 -24
- package/dist/Form/InputText/InputTextApollo.js +1 -1
- package/dist/Form/InputText/InputTextCommon.d.ts +15 -8
- package/dist/Form/InputText/InputTextCommon.js +6 -6
- package/dist/Form/InputText/InputTextLF.d.ts +2 -24
- package/dist/Form/InputText/InputTextLF.js +1 -1
- package/dist/Form/InputTextAtom/InputTextAtomCommon.js +2 -2
- package/dist/Form/ItemFile/ItemFileCommon.d.ts +13 -5
- package/dist/Form/ItemFile/ItemFileCommon.js +4 -3
- package/dist/Form/ItemLabel/ItemLabelApollo.d.ts +2 -3
- package/dist/Form/ItemLabel/ItemLabelApollo.js +2 -2
- package/dist/Form/ItemLabel/ItemLabelCommon.d.ts +4 -3
- package/dist/Form/ItemLabel/ItemLabelCommon.js +1 -1
- package/dist/Form/ItemLabel/ItemLabelLF.d.ts +2 -3
- package/dist/Form/ItemLabel/ItemLabelLF.js +2 -2
- package/dist/Form/ItemMessage/ItemMessageApollo.d.ts +1 -1
- package/dist/Form/ItemMessage/ItemMessageApollo.js +1 -1
- package/dist/Form/ItemMessage/ItemMessageCommon.d.ts +7 -1
- package/dist/Form/ItemMessage/ItemMessageCommon.js +5 -0
- package/dist/Form/ItemMessage/ItemMessageLF.d.ts +1 -1
- package/dist/Form/ItemMessage/ItemMessageLF.js +1 -1
- package/dist/Form/Radio/CardRadio/CardRadioApollo.d.ts +2 -1
- package/dist/Form/Radio/CardRadio/CardRadioApollo.js +2 -1
- package/dist/Form/Radio/CardRadio/CardRadioCommon.d.ts +8 -5
- package/dist/Form/Radio/CardRadio/CardRadioCommon.js +6 -4
- package/dist/Form/Radio/CardRadio/CardRadioLF.d.ts +2 -1
- package/dist/Form/Radio/CardRadio/CardRadioLF.js +2 -1
- package/dist/Form/TextArea/TextAreaApollo.d.ts +2 -20
- package/dist/Form/TextArea/TextAreaApollo.js +1 -1
- package/dist/Form/TextArea/TextAreaCommon.d.ts +13 -10
- package/dist/Form/TextArea/TextAreaCommon.js +6 -4
- package/dist/Form/TextArea/TextAreaLF.d.ts +2 -20
- package/dist/Form/TextArea/TextAreaLF.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/indexLF.d.ts +1 -1
- package/dist/indexLF.js +1 -1
- package/package.json +3 -3
|
@@ -19,14 +19,17 @@ export type CardCheckboxProps = Omit<CardCheckboxOptionProps, "value" | "label"
|
|
|
19
19
|
*/
|
|
20
20
|
isRequired?: boolean;
|
|
21
21
|
options: CheckboxOption[];
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use `message` and messageType instead.
|
|
24
|
+
*/
|
|
22
25
|
error?: string;
|
|
23
|
-
}
|
|
26
|
+
} & Partial<ItemMessageProps>;
|
|
24
27
|
type CardCheckboxCommonProps = CardCheckboxProps & {
|
|
25
28
|
CardCheckboxItemComponent: ComponentType<CardCheckboxOptionProps>;
|
|
26
29
|
ItemMessageComponent: ComponentType<ItemMessageProps>;
|
|
27
30
|
};
|
|
28
31
|
export declare const CardCheckboxCommon: {
|
|
29
|
-
({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, type, error, name, id, onChange, CardCheckboxItemComponent, ItemMessageComponent, ...inputProps }: CardCheckboxCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
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;
|
|
30
33
|
displayName: string;
|
|
31
34
|
};
|
|
32
35
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
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, ...inputProps }) => {
|
|
3
|
+
export const CardCheckboxCommon = ({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, type = "vertical", error, name, id, onChange = () => { }, CardCheckboxItemComponent, ItemMessageComponent, message, messageType, ...inputProps }) => {
|
|
4
4
|
const generatedId = useId();
|
|
5
5
|
const cardCheckboxId = id || generatedId;
|
|
6
|
-
const
|
|
6
|
+
const messageId = `${cardCheckboxId}-error`;
|
|
7
7
|
const cardCheckboxOptionsRef = useRef(null);
|
|
8
8
|
const handleChange = (event) => {
|
|
9
9
|
const cardCheckboxOptionsEl = cardCheckboxOptionsRef.current;
|
|
@@ -22,9 +22,10 @@ export const CardCheckboxCommon = ({ className, labelGroup, descriptionGroup, la
|
|
|
22
22
|
}
|
|
23
23
|
onChange(event);
|
|
24
24
|
};
|
|
25
|
+
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
25
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
27
|
"af-card-checkbox__options",
|
|
27
28
|
`af-card-checkbox__options--${type}`,
|
|
28
|
-
].join(" "), ref: cardCheckboxOptionsRef, children: options.map((cardCheckboxItemProps) => (_jsx(CardCheckboxItemComponent, { id: `${cardCheckboxId}-${cardCheckboxItemProps.value}`, required: required, onChange: handleChange, ...inputProps, ...cardCheckboxItemProps, type: type, "aria-invalid":
|
|
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 || "error" })] }));
|
|
29
30
|
};
|
|
30
31
|
CardCheckboxCommon.displayName = "CardCheckboxCommon";
|
|
@@ -12,4 +12,5 @@ export type CardCheckboxOptionCommonProps = CardCheckboxOptionProps & {
|
|
|
12
12
|
CheckboxComponent: ComponentType<CheckboxProps>;
|
|
13
13
|
IconComponent: ComponentType<IconProps>;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
declare const CardCheckboxOptionCommon: import("react").ForwardRefExoticComponent<Omit<CardCheckboxOptionCommonProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
16
|
+
export { CardCheckboxOptionCommon };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.join(" "), children: [icon ? _jsx(IconComponent, { src: icon, role: "presentation" }) : null, _jsxs("div", { className: "af-card-checkbox-option__content", children: [_jsx("p", { className: "af-card-checkbox-option__label", children: label }), Boolean(description) && (_jsx("p", { className: "af-card-checkbox-option__description", children: description })), Boolean(subtitle) && (_jsx("p", { className: "af-card-checkbox-option__subtitle", children: subtitle }))] }), _jsx(CheckboxComponent, { ...inputProps, ref: ref })] }));
|
|
11
|
-
});
|
|
3
|
+
const CardCheckboxOptionCommon = forwardRef(({ label, type = "vertical", description, subtitle, icon, className, CheckboxComponent, IconComponent, ...inputProps }, ref) => (_jsxs("label", { className: [
|
|
4
|
+
"af-card-checkbox-option",
|
|
5
|
+
type === "horizontal" && "af-card-checkbox-option--horizontal",
|
|
6
|
+
className,
|
|
7
|
+
]
|
|
8
|
+
.filter(Boolean)
|
|
9
|
+
.join(" "), children: [icon ? _jsx(IconComponent, { src: icon, role: "presentation" }) : null, _jsxs("div", { className: "af-card-checkbox-option__content", children: [_jsx("p", { className: "af-card-checkbox-option__label", children: label }), Boolean(description) && (_jsx("p", { className: "af-card-checkbox-option__description", children: description })), Boolean(subtitle) && (_jsx("p", { className: "af-card-checkbox-option__subtitle", children: subtitle }))] }), _jsx(CheckboxComponent, { ...inputProps, ref: ref })] })));
|
|
12
10
|
CardCheckboxOptionCommon.displayName = "CardCheckboxOptionCommon";
|
|
11
|
+
export { CardCheckboxOptionCommon };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/CheckboxText/CheckboxTextApollo.scss";
|
|
2
2
|
import { type CheckboxTextProps } from "./CheckboxTextCommon";
|
|
3
|
-
|
|
3
|
+
declare const CheckboxText: import("react").ForwardRefExoticComponent<Omit<CheckboxTextProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
4
|
+
export { CheckboxText };
|
|
@@ -4,5 +4,6 @@ import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/CheckboxText/Checkbo
|
|
|
4
4
|
import { ItemMessage } from "../../ItemMessage/ItemMessageApollo";
|
|
5
5
|
import { Checkbox } from "../Checkbox/CheckboxApollo";
|
|
6
6
|
import { CheckboxTextCommon, } from "./CheckboxTextCommon";
|
|
7
|
-
|
|
7
|
+
const CheckboxText = forwardRef((props, ref) => (_jsx(CheckboxTextCommon, { ...props, ref: ref, CheckboxComponent: Checkbox, ItemMessageComponent: ItemMessage })));
|
|
8
8
|
CheckboxText.displayName = "CheckboxText";
|
|
9
|
+
export { CheckboxText };
|
|
@@ -3,10 +3,14 @@ import type { ItemMessageProps } from "../../ItemMessage/ItemMessageCommon";
|
|
|
3
3
|
import type { CheckboxProps } from "../Checkbox/CheckboxCommon";
|
|
4
4
|
export type CheckboxTextProps = {
|
|
5
5
|
label: string | ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `message` and messageType instead.
|
|
8
|
+
*/
|
|
6
9
|
errorMessage?: string;
|
|
7
|
-
} & Omit<CheckboxProps, "aria-errormessage" | "aria-invalid">;
|
|
10
|
+
} & Omit<CheckboxProps, "aria-errormessage" | "aria-invalid"> & Partial<ItemMessageProps>;
|
|
8
11
|
export type CheckboxTextCommonProps = CheckboxTextProps & {
|
|
9
12
|
CheckboxComponent: ComponentType<Omit<CheckboxProps, "checkBoxIcon">>;
|
|
10
13
|
ItemMessageComponent: ComponentType<ItemMessageProps>;
|
|
11
14
|
};
|
|
12
|
-
|
|
15
|
+
declare const CheckboxTextCommon: import("react").ForwardRefExoticComponent<Omit<CheckboxTextCommonProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
16
|
+
export { CheckboxTextCommon };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId, forwardRef } from "react";
|
|
3
|
-
|
|
3
|
+
const CheckboxTextCommon = forwardRef(({ label, errorMessage, id, message, messageType, CheckboxComponent, ItemMessageComponent, ...inputProps }, ref) => {
|
|
4
4
|
const generatedId = useId();
|
|
5
5
|
const inputId = id ?? generatedId;
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const messageId = `${inputId}-error`;
|
|
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
9
|
});
|
|
9
10
|
CheckboxTextCommon.displayName = "CheckboxTextCommon";
|
|
11
|
+
export { CheckboxTextCommon };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/CheckboxText/CheckboxTextLF.scss";
|
|
2
|
-
import { CheckboxTextProps } from "./CheckboxTextCommon";
|
|
3
|
-
|
|
2
|
+
import { type CheckboxTextProps } from "./CheckboxTextCommon";
|
|
3
|
+
declare const CheckboxText: import("react").ForwardRefExoticComponent<Omit<CheckboxTextProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
4
|
+
export { CheckboxText };
|
|
@@ -3,6 +3,7 @@ import { forwardRef } from "react";
|
|
|
3
3
|
import "@axa-fr/design-system-apollo-css/dist/Form/Checkbox/CheckboxText/CheckboxTextLF.scss";
|
|
4
4
|
import { ItemMessage } from "../../ItemMessage/ItemMessageLF";
|
|
5
5
|
import { Checkbox } from "../Checkbox/CheckboxLF";
|
|
6
|
-
import { CheckboxTextCommon } from "./CheckboxTextCommon";
|
|
7
|
-
|
|
6
|
+
import { CheckboxTextCommon, } from "./CheckboxTextCommon";
|
|
7
|
+
const CheckboxText = forwardRef((props, ref) => (_jsx(CheckboxTextCommon, { ...props, ref: ref, CheckboxComponent: Checkbox, ItemMessageComponent: ItemMessage })));
|
|
8
8
|
CheckboxText.displayName = "CheckboxText";
|
|
9
|
+
export { CheckboxText };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/Dropdown/DropdownApollo.scss";
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
export declare const Dropdown: (props: Omit<ComponentProps<typeof DropdownCommon>, "ItemLabelComponent" | "ItemMessageComponent">) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
import { type DropdownProps } from "./DropdownCommon";
|
|
3
|
+
export declare const Dropdown: (props: DropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import "@axa-fr/design-system-apollo-css/dist/Form/Dropdown/DropdownApollo.scss";
|
|
3
3
|
import { ItemLabel } from "../ItemLabel/ItemLabelApollo";
|
|
4
4
|
import { ItemMessage } from "../ItemMessage/ItemMessageApollo";
|
|
5
|
-
import {
|
|
5
|
+
import { DropdownCommon } from "./DropdownCommon";
|
|
6
6
|
export const Dropdown = (props) => (_jsx(DropdownCommon, { ...props, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage }));
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import { type ComponentProps, type ComponentPropsWithRef, type ComponentType } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
|
|
4
|
-
type DropdownProps = ComponentPropsWithRef<"select"> & {
|
|
2
|
+
import { ItemLabelCommon, type ItemLabelProps } from "../ItemLabel/ItemLabelCommon";
|
|
3
|
+
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
4
|
+
export type DropdownProps = ComponentPropsWithRef<"select"> & {
|
|
5
5
|
id?: string;
|
|
6
6
|
classModifier?: string;
|
|
7
|
-
label?:
|
|
7
|
+
label?: ItemLabelProps["label"];
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use `message` and messageType instead.
|
|
10
|
+
*/
|
|
8
11
|
error?: string;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `message` and messageType instead.
|
|
14
|
+
*/
|
|
9
15
|
success?: string;
|
|
10
16
|
placeholder?: string;
|
|
11
17
|
buttonLabel?: string;
|
|
12
18
|
description?: string;
|
|
13
19
|
helper?: string;
|
|
14
|
-
|
|
20
|
+
} & Partial<ItemLabelProps & ItemMessageProps>;
|
|
21
|
+
type DropdownCommonProps = DropdownProps & {
|
|
22
|
+
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
15
23
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
16
|
-
}
|
|
17
|
-
declare const
|
|
18
|
-
export {
|
|
24
|
+
};
|
|
25
|
+
declare const DropdownCommon: import("react").ForwardRefExoticComponent<Omit<DropdownCommonProps, "ref"> & import("react").RefAttributes<HTMLSelectElement>>;
|
|
26
|
+
export { DropdownCommon };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
-
const
|
|
4
|
+
const DropdownCommon = forwardRef(({ id, required, label, error, placeholder, children, helper, success, message, messageType, description, buttonLabel, onButtonClick, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, ...otherProps }, inputRef) => {
|
|
5
5
|
const idMessage = useId();
|
|
6
6
|
let inputId = useId();
|
|
7
7
|
inputId = id || inputId;
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
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, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, inputId: inputId }), _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
11
|
});
|
|
11
|
-
|
|
12
|
-
export {
|
|
12
|
+
DropdownCommon.displayName = "Dropdown";
|
|
13
|
+
export { DropdownCommon };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/Dropdown/DropdownLF.scss";
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
export declare const Dropdown: (props: Omit<ComponentProps<typeof DropdownCommon>, "ItemLabelComponent" | "ItemMessageComponent">) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
import { type DropdownProps } from "./DropdownCommon";
|
|
3
|
+
export declare const Dropdown: (props: DropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import "@axa-fr/design-system-apollo-css/dist/Form/Dropdown/DropdownLF.scss";
|
|
3
3
|
import { ItemLabel } from "../ItemLabel/ItemLabelLF";
|
|
4
4
|
import { ItemMessage } from "../ItemMessage/ItemMessageLF";
|
|
5
|
-
import {
|
|
5
|
+
import { DropdownCommon } from "./DropdownCommon";
|
|
6
6
|
export const Dropdown = (props) => (_jsx(DropdownCommon, { ...props, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage }));
|
|
@@ -1,27 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/InputDate/InputDateApollo.scss";
|
|
2
|
-
import { type
|
|
3
|
-
|
|
4
|
-
export declare const InputDate: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "max" | "min" | "value"> & {
|
|
5
|
-
classModifier?: string;
|
|
6
|
-
defaultValue?: Date | string;
|
|
7
|
-
value?: Date | string;
|
|
8
|
-
min?: Date | string;
|
|
9
|
-
max?: Date | string;
|
|
10
|
-
helper?: string;
|
|
11
|
-
error?: string;
|
|
12
|
-
success?: string;
|
|
13
|
-
hidePicker?: boolean;
|
|
14
|
-
label: ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>["label"];
|
|
15
|
-
ItemLabelComponent: import("react").ComponentType<Omit<ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>, "ButtonComponent">>;
|
|
16
|
-
ItemMessageComponent: import("react").ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
17
|
-
} & Partial<{
|
|
18
|
-
label?: import("react").ReactNode;
|
|
19
|
-
description?: string;
|
|
20
|
-
required?: boolean;
|
|
21
|
-
inputId: string;
|
|
22
|
-
sideButtonLabel?: string;
|
|
23
|
-
onSideButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
24
|
-
buttonLabel?: string;
|
|
25
|
-
onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
26
|
-
ButtonComponent: import("react").ComponentType<import("../../Button/ButtonCommon").ButtonProps>;
|
|
27
|
-
}>, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ItemMessageComponent" | "ItemLabelComponent">, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
2
|
+
import { type InputDateProps } from "./InputDateCommon";
|
|
3
|
+
export declare const InputDate: import("react").ForwardRefExoticComponent<Omit<InputDateProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -3,6 +3,6 @@ import "@axa-fr/design-system-apollo-css/dist/Form/InputDate/InputDateApollo.scs
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { ItemLabel } from "../ItemLabel/ItemLabelApollo";
|
|
5
5
|
import { ItemMessage } from "../ItemMessage/ItemMessageApollo";
|
|
6
|
-
import {
|
|
6
|
+
import { InputDateCommon } from "./InputDateCommon";
|
|
7
7
|
export const InputDate = forwardRef((props, ref) => (_jsx(InputDateCommon, { ...props, ref: ref, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage })));
|
|
8
8
|
InputDate.displayName = "InputDate";
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { ComponentProps, ComponentPropsWithRef, ComponentType } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
|
|
4
|
-
type InputDateProps = Omit<ComponentPropsWithRef<"input">, "value" | "min" | "max"> & {
|
|
2
|
+
import { ItemLabelCommon, type ItemLabelProps } from "../ItemLabel/ItemLabelCommon";
|
|
3
|
+
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
4
|
+
export type InputDateProps = Omit<ComponentPropsWithRef<"input">, "value" | "min" | "max"> & {
|
|
5
5
|
classModifier?: string;
|
|
6
6
|
defaultValue?: Date | string;
|
|
7
7
|
value?: Date | string;
|
|
8
8
|
min?: Date | string;
|
|
9
9
|
max?: Date | string;
|
|
10
10
|
helper?: string;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use `message` and messageType instead.
|
|
13
|
+
*/
|
|
11
14
|
error?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `message` and messageType instead.
|
|
17
|
+
*/
|
|
12
18
|
success?: string;
|
|
13
19
|
hidePicker?: boolean;
|
|
14
|
-
label:
|
|
15
|
-
|
|
20
|
+
label: ItemLabelProps["label"];
|
|
21
|
+
} & Partial<ItemLabelProps & ItemMessageProps>;
|
|
22
|
+
type InputDateCommonProps = InputDateProps & {
|
|
23
|
+
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
16
24
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
17
|
-
}
|
|
18
|
-
declare const
|
|
19
|
-
export {
|
|
25
|
+
};
|
|
26
|
+
declare const InputDateCommon: import("react").ForwardRefExoticComponent<Omit<InputDateCommonProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
27
|
+
export { InputDateCommon };
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useEffect, useId, } from "react";
|
|
3
3
|
import { getComponentClassName } from "../../utilities/getComponentClassName";
|
|
4
4
|
import { formatInputDateValue } from "./InputDate.helper";
|
|
5
|
-
const
|
|
5
|
+
const InputDateCommon = forwardRef(({ className, classModifier = "", defaultValue, value, helper, error, success, message, messageType, label, description, buttonLabel, onButtonClick, ItemLabelComponent, ItemMessageComponent, required, min, max, hidePicker, ...otherProps }, inputRef) => {
|
|
6
6
|
const componentClassName = getComponentClassName("af-form__input-date", className ?? "", `${classModifier}${hidePicker ? " no-picker" : ""}`);
|
|
7
7
|
let inputId = useId();
|
|
8
8
|
inputId = otherProps.id ?? inputId;
|
|
@@ -28,7 +28,8 @@ const InputDate = forwardRef(({ className, classModifier = "", defaultValue, val
|
|
|
28
28
|
window.removeEventListener("click", handleClick);
|
|
29
29
|
};
|
|
30
30
|
}, [hidePicker]);
|
|
31
|
-
|
|
31
|
+
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
32
|
+
return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, required: required, inputId: inputId }), _jsx("input", { ...otherProps, id: inputId, className: componentClassName, type: "date", ref: inputRef, defaultValue: formatInputDateValue(defaultValue), value: formatInputDateValue(value), "aria-errormessage": hasError ? idMessage : undefined, "aria-invalid": hasError || undefined, "aria-describedby": ariaDescribedby.length > 0 ? ariaDescribedby.join(" ") : undefined, required: required, min: formatInputDateValue(min), max: formatInputDateValue(max) }), 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") })] }));
|
|
32
33
|
});
|
|
33
|
-
|
|
34
|
-
export {
|
|
34
|
+
InputDateCommon.displayName = "InputDate";
|
|
35
|
+
export { InputDateCommon };
|
|
@@ -1,27 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/InputDate/InputDateLF.scss";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const InputDate: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "max" | "min" | "value"> & {
|
|
5
|
-
classModifier?: string;
|
|
6
|
-
defaultValue?: Date | string;
|
|
7
|
-
value?: Date | string;
|
|
8
|
-
min?: Date | string;
|
|
9
|
-
max?: Date | string;
|
|
10
|
-
helper?: string;
|
|
11
|
-
error?: string;
|
|
12
|
-
success?: string;
|
|
13
|
-
hidePicker?: boolean;
|
|
14
|
-
label: ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>["label"];
|
|
15
|
-
ItemLabelComponent: import("react").ComponentType<Omit<ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>, "ButtonComponent">>;
|
|
16
|
-
ItemMessageComponent: import("react").ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
17
|
-
} & Partial<{
|
|
18
|
-
label?: import("react").ReactNode;
|
|
19
|
-
description?: string;
|
|
20
|
-
required?: boolean;
|
|
21
|
-
inputId: string;
|
|
22
|
-
sideButtonLabel?: string;
|
|
23
|
-
onSideButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
24
|
-
buttonLabel?: string;
|
|
25
|
-
onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
26
|
-
ButtonComponent: import("react").ComponentType<import("../../Button/ButtonCommon").ButtonProps>;
|
|
27
|
-
}>, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ItemMessageComponent" | "ItemLabelComponent">, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
2
|
+
import { type InputDateProps } from "./InputDateCommon";
|
|
3
|
+
export declare const InputDate: import("react").ForwardRefExoticComponent<Omit<InputDateProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -3,6 +3,6 @@ import "@axa-fr/design-system-apollo-css/dist/Form/InputDate/InputDateLF.scss";
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { ItemLabel } from "../ItemLabel/ItemLabelLF";
|
|
5
5
|
import { ItemMessage } from "../ItemMessage/ItemMessageLF";
|
|
6
|
-
import {
|
|
6
|
+
import { InputDateCommon } from "./InputDateCommon";
|
|
7
7
|
export const InputDate = forwardRef((props, ref) => (_jsx(InputDateCommon, { ...props, ref: ref, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage })));
|
|
8
8
|
InputDate.displayName = "InputDate";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/InputPhone/InputPhoneApollo.scss";
|
|
2
|
-
import { InputPhoneProps } from "./InputPhoneCommon";
|
|
2
|
+
import { type InputPhoneProps } from "./InputPhoneCommon";
|
|
3
3
|
export declare const InputPhone: (props: InputPhoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { type ComponentProps, type ComponentPropsWithRef, type ComponentType } from "react";
|
|
2
2
|
import { SingleValue } from "react-select";
|
|
3
|
-
import {
|
|
4
|
-
import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
|
|
3
|
+
import { ItemLabelCommon, type ItemLabelProps } from "../ItemLabel/ItemLabelCommon";
|
|
4
|
+
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
5
5
|
import { InputTextAtom } from "../InputTextAtom/InputTextAtomCommon";
|
|
6
6
|
import { Icon } from "../../Icon/IconCommon";
|
|
7
7
|
import { type OptionType } from "./InputPhone.types";
|
|
8
8
|
export type InputPhoneProps = ComponentPropsWithRef<"input"> & {
|
|
9
9
|
classModifier?: string;
|
|
10
10
|
helper?: string;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use `message` and messageType instead.
|
|
13
|
+
*/
|
|
11
14
|
error?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `message` and messageType instead.
|
|
17
|
+
*/
|
|
12
18
|
success?: string;
|
|
13
19
|
defaultCountry?: string;
|
|
14
20
|
showSelect?: boolean;
|
|
@@ -17,10 +23,10 @@ export type InputPhoneProps = ComponentPropsWithRef<"input"> & {
|
|
|
17
23
|
onChangeSelect?: (value: SingleValue<OptionType>) => void;
|
|
18
24
|
onChangeInput?: (value: string) => void;
|
|
19
25
|
mask?: (value: string) => string;
|
|
20
|
-
label:
|
|
21
|
-
} & Partial<
|
|
26
|
+
label: ItemLabelProps["label"];
|
|
27
|
+
} & Partial<ItemLabelProps & ItemMessageProps>;
|
|
22
28
|
type InputPhoneCommonProps = InputPhoneProps & {
|
|
23
|
-
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof
|
|
29
|
+
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
24
30
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
25
31
|
InputTextComponent: ComponentType<ComponentProps<typeof InputTextAtom>>;
|
|
26
32
|
IconComponent: ComponentType<ComponentProps<typeof Icon>>;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
|
-
import { getComponentClassName } from "../../utilities/getComponentClassName";
|
|
4
3
|
import { CountryCodeSelect } from "./CountryCodeSelect";
|
|
5
4
|
import { maskFrenchPhoneNumber } from "./maskFrenchPhoneNumber";
|
|
6
|
-
const InputPhoneCommon = forwardRef(({ className, classModifier = "", helper, error, success, defaultCountry, showSelect, disabled, label, description, buttonLabel, onButtonClick, required, sideButtonLabel, onSideButtonClick, countryCodeOptions = [], onChangeSelect, onChangeInput, mask = maskFrenchPhoneNumber, ItemLabelComponent, ItemMessageComponent, InputTextComponent, IconComponent, "aria-errormessage": ariaErrormessage, ...otherProps }, inputRef) => {
|
|
7
|
-
const componentClassName = getComponentClassName("af-form__input-phone", className, classModifier + (error || ariaErrormessage ? " error" : ""));
|
|
5
|
+
const InputPhoneCommon = forwardRef(({ className, classModifier = "", helper, error, success, message, messageType, defaultCountry, showSelect, disabled, label, description, buttonLabel, onButtonClick, required, sideButtonLabel, onSideButtonClick, countryCodeOptions = [], onChangeSelect, onChangeInput, mask = maskFrenchPhoneNumber, ItemLabelComponent, ItemMessageComponent, InputTextComponent, IconComponent, "aria-errormessage": ariaErrormessage, ...otherProps }, inputRef) => {
|
|
8
6
|
let inputId = useId();
|
|
9
7
|
inputId = otherProps.id || inputId;
|
|
10
8
|
const idMessage = useId();
|
|
11
9
|
const idHelp = useId();
|
|
12
10
|
const ariaDescribedby = [helper && idHelp, success && idMessage].filter(Boolean);
|
|
11
|
+
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
13
12
|
/**
|
|
14
13
|
* Gère le changement de valeur du champ numéro de téléphone.
|
|
15
14
|
* - Récupère une fonction de masquage (mask) depuis les props ou utilise une version par défaut.
|
|
@@ -25,7 +24,9 @@ const InputPhoneCommon = forwardRef(({ className, classModifier = "", helper, er
|
|
|
25
24
|
const maskedValue = mask(rawValue);
|
|
26
25
|
onChangeInput?.(maskedValue);
|
|
27
26
|
};
|
|
28
|
-
return (_jsxs("div", { className: "af-form__input-phone-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, inputId: inputId }), _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:
|
|
27
|
+
return (_jsxs("div", { className: "af-form__input-phone-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, inputId: inputId }), _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
|
+
.filter(Boolean)
|
|
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") })] }));
|
|
29
30
|
});
|
|
30
31
|
InputPhoneCommon.displayName = "InputPhone";
|
|
31
32
|
export { InputPhoneCommon };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/InputPhone/InputPhoneLF.scss";
|
|
2
|
-
import { InputPhoneProps } from "./InputPhoneCommon";
|
|
2
|
+
import { type InputPhoneProps } from "./InputPhoneCommon";
|
|
3
3
|
export declare const InputPhone: (props: InputPhoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,25 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/InputText/InputTextApollo.scss";
|
|
2
|
-
import { type
|
|
3
|
-
|
|
4
|
-
import { InputTextAtom } from "../InputTextAtom/InputTextAtomApollo";
|
|
5
|
-
export declare const InputText: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
|
|
6
|
-
unit?: import("react").ReactNode;
|
|
7
|
-
classModifier?: string;
|
|
8
|
-
helper?: string;
|
|
9
|
-
error?: string;
|
|
10
|
-
success?: string;
|
|
11
|
-
label: ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>["label"];
|
|
12
|
-
ItemLabelComponent: import("react").ComponentType<Omit<ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>, "ButtonComponent">>;
|
|
13
|
-
ItemMessageComponent: import("react").ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
14
|
-
InputTextAtomComponent: import("react").ComponentType<ComponentProps<typeof InputTextAtom>>;
|
|
15
|
-
} & Partial<{
|
|
16
|
-
label?: import("react").ReactNode;
|
|
17
|
-
description?: string;
|
|
18
|
-
required?: boolean;
|
|
19
|
-
inputId: string;
|
|
20
|
-
sideButtonLabel?: string;
|
|
21
|
-
onSideButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
22
|
-
buttonLabel?: string;
|
|
23
|
-
onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
24
|
-
ButtonComponent: import("react").ComponentType<import("../../Button/ButtonCommon").ButtonProps>;
|
|
25
|
-
}>, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ItemMessageComponent" | "ItemLabelComponent" | "InputTextAtomComponent">, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
2
|
+
import { type InputTextProps } from "./InputTextCommon";
|
|
3
|
+
export declare const InputText: import("react").ForwardRefExoticComponent<Omit<InputTextProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -3,7 +3,7 @@ import "@axa-fr/design-system-apollo-css/dist/Form/InputText/InputTextApollo.scs
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { ItemLabel } from "../ItemLabel/ItemLabelApollo";
|
|
5
5
|
import { ItemMessage } from "../ItemMessage/ItemMessageApollo";
|
|
6
|
-
import {
|
|
6
|
+
import { InputTextCommon } from "./InputTextCommon";
|
|
7
7
|
import { InputTextAtom } from "../InputTextAtom/InputTextAtomApollo";
|
|
8
8
|
export const InputText = forwardRef((props, ref) => (_jsx(InputTextCommon, { ...props, ref: ref, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage, InputTextAtomComponent: InputTextAtom })));
|
|
9
9
|
InputText.displayName = "InputText";
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { type ComponentProps, type ComponentPropsWithRef, type ComponentType, type ReactNode } from "react";
|
|
2
2
|
import { InputTextAtom } from "../InputTextAtom/InputTextAtomCommon";
|
|
3
|
-
import {
|
|
4
|
-
import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
|
|
5
|
-
type InputTextProps = ComponentPropsWithRef<"input"> & {
|
|
3
|
+
import { ItemLabelCommon, type ItemLabelProps } from "../ItemLabel/ItemLabelCommon";
|
|
4
|
+
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
5
|
+
export type InputTextProps = ComponentPropsWithRef<"input"> & {
|
|
6
6
|
unit?: ReactNode;
|
|
7
7
|
classModifier?: string;
|
|
8
8
|
helper?: string;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use `message` and messageType instead.
|
|
11
|
+
*/
|
|
9
12
|
error?: string;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use `message` and messageType instead.
|
|
15
|
+
*/
|
|
10
16
|
success?: string;
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
} & Partial<ItemLabelProps & ItemMessageProps>;
|
|
18
|
+
type InputTextCommonProps = InputTextProps & {
|
|
19
|
+
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
13
20
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
14
21
|
InputTextAtomComponent: ComponentType<ComponentProps<typeof InputTextAtom>>;
|
|
15
|
-
}
|
|
16
|
-
declare const
|
|
17
|
-
export {
|
|
22
|
+
};
|
|
23
|
+
declare const InputTextCommon: import("react").ForwardRefExoticComponent<Omit<InputTextCommonProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
24
|
+
export { InputTextCommon };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
|
-
|
|
4
|
-
const InputText = forwardRef(({ unit, className, classModifier = "", helper, error, success, label, description, buttonLabel, onButtonClick, required, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, InputTextAtomComponent, "aria-errormessage": ariaErrormessage, ...otherProps }, inputRef) => {
|
|
5
|
-
const componentClassName = getComponentClassName("af-form__input-text", className, classModifier + (error || ariaErrormessage ? " error" : ""));
|
|
3
|
+
const InputTextCommon = forwardRef(({ unit, className, classModifier = "", helper, error, success, message, messageType, label, description, buttonLabel, onButtonClick, required, sideButtonLabel, onSideButtonClick, ItemLabelComponent, ItemMessageComponent, InputTextAtomComponent, ...otherProps }, inputRef) => {
|
|
6
4
|
let inputId = useId();
|
|
7
5
|
inputId = otherProps.id || inputId;
|
|
8
6
|
const idMessage = useId();
|
|
9
7
|
const idHelp = useId();
|
|
10
8
|
const ariaDescribedby = [helper && idHelp, success && idMessage].filter(Boolean);
|
|
11
|
-
return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, inputId: inputId }), _jsx(InputTextAtomComponent, { id: inputId, ref: inputRef, unit: unit, className:
|
|
9
|
+
return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, inputId: inputId }), _jsx(InputTextAtomComponent, { id: inputId, ref: inputRef, unit: unit, className: className, classModifier: classModifier, error: (message && messageType === "error") || Boolean(error)
|
|
10
|
+
? messageType || error
|
|
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
|
});
|
|
13
|
-
|
|
14
|
-
export {
|
|
13
|
+
InputTextCommon.displayName = "InputText";
|
|
14
|
+
export { InputTextCommon };
|
|
@@ -1,25 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/InputText/InputTextLF.scss";
|
|
2
|
-
import { type
|
|
3
|
-
|
|
4
|
-
import { InputTextAtom } from "../InputTextAtom/InputTextAtomLF";
|
|
5
|
-
export declare const InputText: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & {
|
|
6
|
-
unit?: import("react").ReactNode;
|
|
7
|
-
classModifier?: string;
|
|
8
|
-
helper?: string;
|
|
9
|
-
error?: string;
|
|
10
|
-
success?: string;
|
|
11
|
-
label: ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>["label"];
|
|
12
|
-
ItemLabelComponent: import("react").ComponentType<Omit<ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>, "ButtonComponent">>;
|
|
13
|
-
ItemMessageComponent: import("react").ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
14
|
-
InputTextAtomComponent: import("react").ComponentType<ComponentProps<typeof InputTextAtom>>;
|
|
15
|
-
} & Partial<{
|
|
16
|
-
label?: import("react").ReactNode;
|
|
17
|
-
description?: string;
|
|
18
|
-
required?: boolean;
|
|
19
|
-
inputId: string;
|
|
20
|
-
sideButtonLabel?: string;
|
|
21
|
-
onSideButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
22
|
-
buttonLabel?: string;
|
|
23
|
-
onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
24
|
-
ButtonComponent: import("react").ComponentType<import("../../Button/ButtonCommon").ButtonProps>;
|
|
25
|
-
}>, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ItemMessageComponent" | "ItemLabelComponent" | "InputTextAtomComponent">, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
2
|
+
import { type InputTextProps } from "./InputTextCommon";
|
|
3
|
+
export declare const InputText: import("react").ForwardRefExoticComponent<Omit<InputTextProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -3,7 +3,7 @@ import "@axa-fr/design-system-apollo-css/dist/Form/InputText/InputTextLF.scss";
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { ItemLabel } from "../ItemLabel/ItemLabelLF";
|
|
5
5
|
import { ItemMessage } from "../ItemMessage/ItemMessageLF";
|
|
6
|
-
import {
|
|
6
|
+
import { InputTextCommon } from "./InputTextCommon";
|
|
7
7
|
import { InputTextAtom } from "../InputTextAtom/InputTextAtomLF";
|
|
8
8
|
export const InputText = forwardRef((props, ref) => (_jsx(InputTextCommon, { ...props, ref: ref, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage, InputTextAtomComponent: InputTextAtom })));
|
|
9
9
|
InputText.displayName = "InputText";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
3
|
import { getComponentClassName } from "../../utilities/getComponentClassName";
|
|
4
|
-
const InputTextAtom = forwardRef(({ unit, className, classModifier = "", error, required, "aria-errormessage": ariaErrormessage,
|
|
4
|
+
const InputTextAtom = forwardRef(({ unit, className, classModifier = "", error, required, idMessage, idHelp, "aria-errormessage": ariaErrormessage, type = "text", ...otherProps }, inputRef) => {
|
|
5
5
|
const componentClassName = getComponentClassName("af-form__input-text", className, classModifier + (error || ariaErrormessage ? " error" : ""));
|
|
6
6
|
let inputId = useId();
|
|
7
7
|
inputId = otherProps.id || inputId;
|
|
8
|
-
return (_jsxs("div", { className: "af-form__input-variant", children: [_jsx("input", { id: inputId, className: componentClassName, type:
|
|
8
|
+
return (_jsxs("div", { className: "af-form__input-variant", children: [_jsx("input", { id: inputId, className: componentClassName, type: type, required: required, ref: inputRef, "aria-errormessage": ariaErrormessage ?? idMessage, "aria-invalid": Boolean(error || ariaErrormessage), "aria-describedby": idHelp, ...otherProps }), unit] }));
|
|
9
9
|
});
|
|
10
10
|
InputTextAtom.displayName = "InputTextAtom";
|
|
11
11
|
export { InputTextAtom };
|
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
import { ReactNode, type ComponentProps, type ComponentPropsWithoutRef, type ComponentType } from "react";
|
|
2
2
|
import type { IconProps } from "../../Icon/IconCommon";
|
|
3
3
|
import { Spinner } from "../../Spinner/SpinnerCommon";
|
|
4
|
-
import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
|
|
4
|
+
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
5
5
|
export declare const itemFileVariants: {
|
|
6
6
|
readonly success: "success";
|
|
7
7
|
readonly error: "error";
|
|
8
8
|
readonly loading: "loading";
|
|
9
9
|
};
|
|
10
10
|
export type ItemFileState = keyof typeof itemFileVariants;
|
|
11
|
-
export type
|
|
11
|
+
export type ItemFileProps = {
|
|
12
12
|
state: ItemFileState;
|
|
13
13
|
ariaLabelVisibility?: string;
|
|
14
14
|
ariaLabelDelete?: string;
|
|
15
15
|
filename?: string;
|
|
16
16
|
title: string;
|
|
17
17
|
subTitle: string;
|
|
18
|
-
errorMessage?: string;
|
|
19
18
|
deleteIcon: ReactNode;
|
|
20
19
|
visibilityIcon?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use `message` and messageType instead.
|
|
22
|
+
*/
|
|
23
|
+
errorMessage?: string;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Use `message` and messageType instead.
|
|
26
|
+
*/
|
|
21
27
|
success?: string;
|
|
28
|
+
} & Omit<ComponentPropsWithoutRef<"section">, "children"> & Partial<ItemMessageProps>;
|
|
29
|
+
export type ItemFileCommonProps = ItemFileProps & {
|
|
22
30
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
23
31
|
ItemIconComponent: ComponentType<IconProps>;
|
|
24
32
|
ItemSpinnerComponent: ComponentType<ComponentProps<typeof Spinner>>;
|
|
25
|
-
}
|
|
26
|
-
export declare const ItemFileCommon: ({ className, state, title, subTitle, errorMessage, deleteIcon, visibilityIcon, success, ItemSpinnerComponent, ItemIconComponent, ItemMessageComponent, ...props }: ItemFileCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
};
|
|
34
|
+
export declare const ItemFileCommon: ({ className, state, title, subTitle, errorMessage, deleteIcon, visibilityIcon, success, message, messageType, ItemSpinnerComponent, ItemIconComponent, ItemMessageComponent, ...props }: ItemFileCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,8 @@ export const itemFileVariants = {
|
|
|
6
6
|
error: "error",
|
|
7
7
|
loading: "loading",
|
|
8
8
|
};
|
|
9
|
-
export const ItemFileCommon = ({ className, state, title, subTitle, errorMessage, deleteIcon, visibilityIcon, success, ItemSpinnerComponent, ItemIconComponent, ItemMessageComponent, ...props }) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
9
|
+
export const ItemFileCommon = ({ className, state, title, subTitle, errorMessage, deleteIcon, visibilityIcon, success, message, messageType, ItemSpinnerComponent, ItemIconComponent, ItemMessageComponent, ...props }) => {
|
|
10
|
+
const hasError = (Boolean(message) && messageType === "error") || Boolean(errorMessage);
|
|
11
|
+
const classname = classNames("af-item-file", hasError && "af-item-file--error", className);
|
|
12
|
+
return (_jsxs("section", { className: classname, ...props, children: [_jsxs("div", { className: "af-item-file__body", children: [_jsx(ItemStateIcon, { state: state, ItemIconComponent: ItemIconComponent, ItemSpinnerComponent: ItemSpinnerComponent }), _jsx("p", { className: "af-item-file__title", children: title }), _jsx("p", { className: "af-item-file__subtitle", children: subTitle }), _jsxs("div", { className: "af-item-file__actions", children: [state === "success" && visibilityIcon, deleteIcon] })] }), _jsx(ItemMessageComponent, { message: message || errorMessage || success, messageType: messageType || (errorMessage ? "error" : "success") })] }));
|
|
12
13
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/ItemLabel/ItemLabelApollo.scss";
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
export declare const ItemLabel: (props: Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
import { type ItemLabelProps } from "./ItemLabelCommon";
|
|
3
|
+
export declare const ItemLabel: (props: ItemLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import "@axa-fr/design-system-apollo-css/dist/Form/ItemLabel/ItemLabelApollo.scss";
|
|
3
3
|
import { Button } from "../../Button/ButtonApollo";
|
|
4
|
-
import {
|
|
5
|
-
export const ItemLabel = (props) => _jsx(ItemLabelCommon, { ...props, ButtonComponent: Button });
|
|
4
|
+
import { ItemLabelCommon } from "./ItemLabelCommon";
|
|
5
|
+
export const ItemLabel = (props) => (_jsx(ItemLabelCommon, { ...props, ButtonComponent: Button }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentType, type MouseEventHandler, type ReactNode } from "react";
|
|
2
2
|
import type { ButtonProps } from "../../Button/ButtonCommon";
|
|
3
|
-
type ItemLabelProps = {
|
|
3
|
+
export type ItemLabelProps = {
|
|
4
4
|
label?: ReactNode;
|
|
5
5
|
description?: string;
|
|
6
6
|
required?: boolean;
|
|
@@ -9,7 +9,8 @@ type ItemLabelProps = {
|
|
|
9
9
|
onSideButtonClick?: MouseEventHandler<HTMLButtonElement>;
|
|
10
10
|
buttonLabel?: string;
|
|
11
11
|
onButtonClick?: MouseEventHandler<HTMLButtonElement>;
|
|
12
|
+
};
|
|
13
|
+
export type ItemLabelCommonProps = ItemLabelProps & {
|
|
12
14
|
ButtonComponent: ComponentType<ButtonProps>;
|
|
13
15
|
};
|
|
14
|
-
export declare const
|
|
15
|
-
export {};
|
|
16
|
+
export declare const ItemLabelCommon: ({ label, description, required, inputId, sideButtonLabel, onSideButtonClick, buttonLabel, onButtonClick, ButtonComponent, }: ItemLabelCommonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useId, } from "react";
|
|
3
3
|
import infoIcon from "@material-symbols/svg-400/outlined/info.svg";
|
|
4
4
|
import { Svg } from "../../Svg/Svg";
|
|
5
|
-
export const
|
|
5
|
+
export const ItemLabelCommon = ({ label, description, required, inputId, sideButtonLabel, onSideButtonClick, buttonLabel, onButtonClick, ButtonComponent, }) => {
|
|
6
6
|
const idDescription = useId();
|
|
7
7
|
if (!label && !description && !buttonLabel && !sideButtonLabel) {
|
|
8
8
|
return null;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/ItemLabel/ItemLabelLF.scss";
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
export declare const ItemLabel: (props: Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
import { type ItemLabelProps } from "./ItemLabelCommon";
|
|
3
|
+
export declare const ItemLabel: (props: ItemLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import "@axa-fr/design-system-apollo-css/dist/Form/ItemLabel/ItemLabelLF.scss";
|
|
3
3
|
import { Button } from "../../Button/ButtonLF";
|
|
4
|
-
import {
|
|
5
|
-
export const ItemLabel = (props) => _jsx(ItemLabelCommon, { ...props, ButtonComponent: Button });
|
|
4
|
+
import { ItemLabelCommon } from "./ItemLabelCommon";
|
|
5
|
+
export const ItemLabel = (props) => (_jsx(ItemLabelCommon, { ...props, ButtonComponent: Button }));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/ItemMessage/ItemMessageApollo.scss";
|
|
2
|
-
export { ItemMessage } from "./ItemMessageCommon";
|
|
2
|
+
export { ItemMessage, itemMessageVariants, type ItemMessageVariants, } from "./ItemMessageCommon";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/ItemMessage/ItemMessageApollo.scss";
|
|
2
|
-
export { ItemMessage } from "./ItemMessageCommon";
|
|
2
|
+
export { ItemMessage, itemMessageVariants, } from "./ItemMessageCommon";
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
export declare const itemMessageVariants: {
|
|
3
|
+
readonly error: "error";
|
|
4
|
+
readonly success: "success";
|
|
5
|
+
readonly warning: "warning";
|
|
6
|
+
};
|
|
7
|
+
export type ItemMessageVariants = keyof typeof itemMessageVariants;
|
|
2
8
|
export type ItemMessageProps = {
|
|
3
9
|
message?: ReactNode;
|
|
4
10
|
id?: string;
|
|
5
|
-
messageType?:
|
|
11
|
+
messageType?: ItemMessageVariants;
|
|
6
12
|
};
|
|
7
13
|
export declare const ItemMessage: ({ message, id, messageType, }: ItemMessageProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -3,6 +3,11 @@ import successIcon from "@material-symbols/svg-400/outlined/check_circle-fill.sv
|
|
|
3
3
|
import errorIcon from "@material-symbols/svg-400/outlined/error-fill.svg";
|
|
4
4
|
import warningIcon from "@material-symbols/svg-400/outlined/warning-fill.svg";
|
|
5
5
|
import { Svg } from "../../Svg/Svg";
|
|
6
|
+
export const itemMessageVariants = {
|
|
7
|
+
error: "error",
|
|
8
|
+
success: "success",
|
|
9
|
+
warning: "warning",
|
|
10
|
+
};
|
|
6
11
|
export const ItemMessage = ({ message, id, messageType = "error", }) => {
|
|
7
12
|
if (!message) {
|
|
8
13
|
return null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/ItemMessage/ItemMessageLF.scss";
|
|
2
|
-
export { ItemMessage } from "./ItemMessageCommon";
|
|
2
|
+
export { ItemMessage, itemMessageVariants, type ItemMessageVariants, } from "./ItemMessageCommon";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/ItemMessage/ItemMessageLF.scss";
|
|
2
|
-
export { ItemMessage } from "./ItemMessageCommon";
|
|
2
|
+
export { ItemMessage, itemMessageVariants, } from "./ItemMessageCommon";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type CardRadioProps } from "./CardRadioCommon";
|
|
2
2
|
import "@axa-fr/design-system-apollo-css/dist/Form/Radio/CardRadio/CardRadioApollo.scss";
|
|
3
|
-
|
|
3
|
+
declare const CardRadio: {
|
|
4
4
|
(props: CardRadioProps): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
|
+
export { CardRadio };
|
|
@@ -3,5 +3,6 @@ import { CardRadioOption } from "../CardRadioOption/CardRadioOptionApollo";
|
|
|
3
3
|
import { CardRadioCommon } from "./CardRadioCommon";
|
|
4
4
|
import { ItemMessage } from "../../ItemMessage/ItemMessageApollo";
|
|
5
5
|
import "@axa-fr/design-system-apollo-css/dist/Form/Radio/CardRadio/CardRadioApollo.scss";
|
|
6
|
-
|
|
6
|
+
const CardRadio = (props) => (_jsx(CardRadioCommon, { ...props, CardRadioOptionComponent: CardRadioOption, ItemMessageComponent: ItemMessage }));
|
|
7
7
|
CardRadio.displayName = "CardRadio";
|
|
8
|
+
export { CardRadio };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentProps, type ComponentType, type PropsWithChildren, type ReactNode } from "react";
|
|
2
|
-
import { ItemMessage } from "../../ItemMessage/ItemMessageLF";
|
|
3
2
|
import { type CardRadioOptionProps } from "../CardRadioOption/CardRadioOptionCommon";
|
|
3
|
+
import { ItemMessage, type ItemMessageProps } from "../../ItemMessage/ItemMessageCommon";
|
|
4
4
|
type RadioOption = Omit<CardRadioOptionProps, "name" | "type" | "isInvalid">;
|
|
5
5
|
export type CardRadioProps = Omit<CardRadioOptionProps, "value" | "label" | "type" | "isInvalid" | "icon" | "src" | "basePictureProps" | "description" | "subtitle" | "children"> & {
|
|
6
6
|
type?: "vertical" | "horizontal";
|
|
@@ -23,14 +23,17 @@ export type CardRadioProps = Omit<CardRadioOptionProps, "value" | "label" | "typ
|
|
|
23
23
|
*/
|
|
24
24
|
value?: number | string;
|
|
25
25
|
options: RadioOption[];
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use `message` and messageType instead.
|
|
28
|
+
*/
|
|
26
29
|
error?: ReactNode;
|
|
27
|
-
} & PropsWithChildren
|
|
30
|
+
} & PropsWithChildren & Partial<ItemMessageProps>;
|
|
28
31
|
export type CardRadioCommonProps = CardRadioProps & {
|
|
29
32
|
CardRadioOptionComponent: ComponentType<CardRadioOptionProps>;
|
|
30
33
|
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
31
34
|
};
|
|
32
|
-
|
|
33
|
-
({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, type, error, name, value, id, CardRadioOptionComponent, ItemMessageComponent, ...inputProps }: CardRadioCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
declare const CardRadioCommon: {
|
|
36
|
+
({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, type, error, message, messageType, name, value, id, CardRadioOptionComponent, ItemMessageComponent, ...inputProps }: CardRadioCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
34
37
|
displayName: string;
|
|
35
38
|
};
|
|
36
|
-
export {};
|
|
39
|
+
export { CardRadioCommon };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId, } from "react";
|
|
3
|
-
|
|
3
|
+
const CardRadioCommon = ({ className, labelGroup, descriptionGroup, label, description, isRequired, required, options, type = "vertical", error, message, messageType, name, value, id, CardRadioOptionComponent, ItemMessageComponent, ...inputProps }) => {
|
|
4
4
|
const generatedId = useId();
|
|
5
5
|
const cardRadioId = id ?? generatedId;
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const messageId = `${cardRadioId}-error`;
|
|
7
|
+
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
8
|
+
return (_jsxs("fieldset", { className: ["af-card-radio", className].filter(Boolean).join(" "), role: "radiogroup", "aria-required": Boolean(required) || undefined, "aria-invalid": hasError || undefined, "aria-errormessage": hasError ? messageId : undefined, id: cardRadioId, children: [_jsxs("legend", { className: "af-card-radio__legend", children: [_jsxs("p", { className: "af-card-radio__label", children: [label, labelGroup, required || isRequired ? _jsx("span", { "aria-hidden": true, children: "*" }) : null] }), description || descriptionGroup ? (_jsxs("p", { className: "af-card-radio__description", children: [description, descriptionGroup] })) : null] }), _jsx("div", { className: [
|
|
8
9
|
"af-card-radio__options",
|
|
9
10
|
`af-card-radio__options--${type}`,
|
|
10
11
|
].join(" "), children: options.map((cardRadioItemProps) => (_jsx(CardRadioOptionComponent, { id: `${cardRadioId}-${cardRadioItemProps.value}`, checked: value !== undefined
|
|
11
12
|
? value === cardRadioItemProps.value
|
|
12
|
-
: undefined, required: required, ...inputProps, ...cardRadioItemProps, type: type, isInvalid:
|
|
13
|
+
: undefined, required: required, ...inputProps, ...cardRadioItemProps, type: type, isInvalid: hasError, name: name }, `${name ?? cardRadioId}-${cardRadioItemProps.label}`))) }), _jsx(ItemMessageComponent, { id: messageId, message: message || error, messageType: messageType })] }));
|
|
13
14
|
};
|
|
14
15
|
CardRadioCommon.displayName = "CardRadioCommon";
|
|
16
|
+
export { CardRadioCommon };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type CardRadioProps } from "./CardRadioCommon";
|
|
2
2
|
import "@axa-fr/design-system-apollo-css/dist/Form/Radio/CardRadio/CardRadioLF.scss";
|
|
3
|
-
|
|
3
|
+
declare const CardRadio: {
|
|
4
4
|
(props: CardRadioProps): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
|
+
export { CardRadio };
|
|
@@ -3,5 +3,6 @@ import { CardRadioOption } from "../CardRadioOption/CardRadioOptionLF";
|
|
|
3
3
|
import { CardRadioCommon } from "./CardRadioCommon";
|
|
4
4
|
import { ItemMessage } from "../../ItemMessage/ItemMessageLF";
|
|
5
5
|
import "@axa-fr/design-system-apollo-css/dist/Form/Radio/CardRadio/CardRadioLF.scss";
|
|
6
|
-
|
|
6
|
+
const CardRadio = (props) => (_jsx(CardRadioCommon, { ...props, CardRadioOptionComponent: CardRadioOption, ItemMessageComponent: ItemMessage }));
|
|
7
7
|
CardRadio.displayName = "CardRadio";
|
|
8
|
+
export { CardRadio };
|
|
@@ -1,21 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/TextArea/TextAreaApollo.scss";
|
|
2
|
-
import { type
|
|
3
|
-
|
|
4
|
-
export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").ClassAttributes<HTMLTextAreaElement> & import("react").TextareaHTMLAttributes<HTMLTextAreaElement> & Pick<{
|
|
5
|
-
label?: import("react").ReactNode;
|
|
6
|
-
description?: string;
|
|
7
|
-
required?: boolean;
|
|
8
|
-
inputId: string;
|
|
9
|
-
sideButtonLabel?: string;
|
|
10
|
-
onSideButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
11
|
-
buttonLabel?: string;
|
|
12
|
-
onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
13
|
-
ButtonComponent: import("react").ComponentType<import("../../Button/ButtonCommon").ButtonProps>;
|
|
14
|
-
}, "label" | "description" | "sideButtonLabel" | "onSideButtonClick" | "buttonLabel"> & {
|
|
15
|
-
classModifier?: string;
|
|
16
|
-
helper?: string;
|
|
17
|
-
error?: string;
|
|
18
|
-
ItemLabelComponent: import("react").ComponentType<Omit<ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>, "ButtonComponent">>;
|
|
19
|
-
ItemMessageComponent: import("react").ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
20
|
-
onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
21
|
-
} & Partial<import("../ItemMessage/ItemMessageCommon").ItemMessageProps>, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>, "ItemMessageComponent" | "ItemLabelComponent">, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
2
|
+
import { type TextAreaProps } from "./TextAreaCommon";
|
|
3
|
+
export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -3,6 +3,6 @@ import "@axa-fr/design-system-apollo-css/dist/Form/TextArea/TextAreaApollo.scss"
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { ItemLabel } from "../ItemLabel/ItemLabelApollo";
|
|
5
5
|
import { ItemMessage } from "../ItemMessage/ItemMessageApollo";
|
|
6
|
-
import {
|
|
6
|
+
import { TextAreaCommon } from "./TextAreaCommon";
|
|
7
7
|
export const TextArea = forwardRef((props, ref) => (_jsx(TextAreaCommon, { ...props, ref: ref, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage })));
|
|
8
8
|
TextArea.displayName = "TextArea";
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { type ComponentProps, ComponentPropsWithRef, type ComponentType, MouseEventHandler } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
|
|
4
|
-
type
|
|
5
|
-
/** @deprecated Use `className` instead */
|
|
6
|
-
classModifier?: string;
|
|
2
|
+
import { ItemLabelCommon, type ItemLabelProps } from "../ItemLabel/ItemLabelCommon";
|
|
3
|
+
import { ItemMessage, type ItemMessageProps } from "../ItemMessage/ItemMessageCommon";
|
|
4
|
+
export type TextAreaProps = ComponentPropsWithRef<"textarea"> & {
|
|
7
5
|
helper?: string;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `message` and messageType instead.
|
|
8
|
+
*/
|
|
8
9
|
error?: string;
|
|
9
|
-
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabel>, "ButtonComponent">>;
|
|
10
|
-
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
11
10
|
onButtonClick?: MouseEventHandler<HTMLButtonElement>;
|
|
12
|
-
} & Partial<
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
} & Partial<ItemMessageProps & ItemLabelProps>;
|
|
12
|
+
type TextAreaCommonProps = TextAreaProps & {
|
|
13
|
+
ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabelCommon>, "ButtonComponent">>;
|
|
14
|
+
ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
15
|
+
};
|
|
16
|
+
declare const TextAreaCommon: import("react").ForwardRefExoticComponent<Omit<TextAreaCommonProps, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
17
|
+
export { TextAreaCommon };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useId, } from "react";
|
|
3
|
-
|
|
3
|
+
const TextAreaCommon = forwardRef(({ id, className, label, description, helper, error, message, messageType, buttonLabel, onButtonClick, required, sideButtonLabel, ItemLabelComponent, ItemMessageComponent, onSideButtonClick, placeholder = " ", ...inputProps }, inputRef) => {
|
|
4
4
|
const generatedId = useId();
|
|
5
5
|
const inputId = id ?? generatedId;
|
|
6
6
|
const helperId = `${inputId}-helper`;
|
|
7
|
-
const
|
|
7
|
+
const messageId = `${inputId}-error`;
|
|
8
|
+
const hasError = (Boolean(message) && messageType === "error") || Boolean(error);
|
|
8
9
|
return (_jsxs("div", { className: ["af-form__input-container", className]
|
|
9
10
|
.filter(Boolean)
|
|
10
|
-
.join(" "), children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, inputId: inputId }), _jsx("textarea", { id: inputId, className: "af-form__textarea", ref: inputRef, "aria-errormessage":
|
|
11
|
+
.join(" "), children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, sideButtonLabel: sideButtonLabel, onSideButtonClick: onSideButtonClick, required: required, inputId: inputId }), _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
12
|
});
|
|
12
|
-
|
|
13
|
+
TextAreaCommon.displayName = "TextArea";
|
|
14
|
+
export { TextAreaCommon };
|
|
@@ -1,21 +1,3 @@
|
|
|
1
1
|
import "@axa-fr/design-system-apollo-css/dist/Form/TextArea/TextAreaLF.scss";
|
|
2
|
-
import { type
|
|
3
|
-
|
|
4
|
-
export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").ClassAttributes<HTMLTextAreaElement> & import("react").TextareaHTMLAttributes<HTMLTextAreaElement> & Pick<{
|
|
5
|
-
label?: import("react").ReactNode;
|
|
6
|
-
description?: string;
|
|
7
|
-
required?: boolean;
|
|
8
|
-
inputId: string;
|
|
9
|
-
sideButtonLabel?: string;
|
|
10
|
-
onSideButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
11
|
-
buttonLabel?: string;
|
|
12
|
-
onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
13
|
-
ButtonComponent: import("react").ComponentType<import("../../Button/ButtonCommon").ButtonProps>;
|
|
14
|
-
}, "label" | "description" | "sideButtonLabel" | "onSideButtonClick" | "buttonLabel"> & {
|
|
15
|
-
classModifier?: string;
|
|
16
|
-
helper?: string;
|
|
17
|
-
error?: string;
|
|
18
|
-
ItemLabelComponent: import("react").ComponentType<Omit<ComponentProps<typeof import("../ItemLabel/ItemLabelCommon").ItemLabel>, "ButtonComponent">>;
|
|
19
|
-
ItemMessageComponent: import("react").ComponentType<ComponentProps<typeof ItemMessage>>;
|
|
20
|
-
onButtonClick?: import("react").MouseEventHandler<HTMLButtonElement>;
|
|
21
|
-
} & Partial<import("../ItemMessage/ItemMessageCommon").ItemMessageProps>, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>, "ItemMessageComponent" | "ItemLabelComponent">, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
2
|
+
import { type TextAreaProps } from "./TextAreaCommon";
|
|
3
|
+
export declare const TextArea: import("react").ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -3,6 +3,6 @@ import "@axa-fr/design-system-apollo-css/dist/Form/TextArea/TextAreaLF.scss";
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { ItemLabel } from "../ItemLabel/ItemLabelLF";
|
|
5
5
|
import { ItemMessage } from "../ItemMessage/ItemMessageLF";
|
|
6
|
-
import {
|
|
6
|
+
import { TextAreaCommon } from "./TextAreaCommon";
|
|
7
7
|
export const TextArea = forwardRef((props, ref) => (_jsx(TextAreaCommon, { ...props, ref: ref, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage })));
|
|
8
8
|
TextArea.displayName = "TextArea";
|
package/dist/index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export { InputText } from "./Form/InputText/InputTextApollo";
|
|
|
25
25
|
export { InputTextAtom } from "./Form/InputTextAtom/InputTextAtomApollo";
|
|
26
26
|
export { ItemFile, itemFileVariants } from "./Form/ItemFile/ItemFileApollo";
|
|
27
27
|
export { ItemLabel } from "./Form/ItemLabel/ItemLabelApollo";
|
|
28
|
-
export { ItemMessage } from "./Form/ItemMessage/ItemMessageApollo";
|
|
28
|
+
export { ItemMessage, itemMessageVariants, type ItemMessageVariants, } from "./Form/ItemMessage/ItemMessageApollo";
|
|
29
29
|
export { CardRadio } from "./Form/Radio/CardRadio/CardRadioApollo";
|
|
30
30
|
export { CardRadioOption } from "./Form/Radio/CardRadioOption/CardRadioOptionApollo";
|
|
31
31
|
export { Radio } from "./Form/Radio/Radio/RadioApollo";
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export { InputText } from "./Form/InputText/InputTextApollo";
|
|
|
24
24
|
export { InputTextAtom } from "./Form/InputTextAtom/InputTextAtomApollo";
|
|
25
25
|
export { ItemFile, itemFileVariants } from "./Form/ItemFile/ItemFileApollo";
|
|
26
26
|
export { ItemLabel } from "./Form/ItemLabel/ItemLabelApollo";
|
|
27
|
-
export { ItemMessage } from "./Form/ItemMessage/ItemMessageApollo";
|
|
27
|
+
export { ItemMessage, itemMessageVariants, } from "./Form/ItemMessage/ItemMessageApollo";
|
|
28
28
|
export { CardRadio } from "./Form/Radio/CardRadio/CardRadioApollo";
|
|
29
29
|
export { CardRadioOption } from "./Form/Radio/CardRadioOption/CardRadioOptionApollo";
|
|
30
30
|
export { Radio } from "./Form/Radio/Radio/RadioApollo";
|
package/dist/indexLF.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ InputText as TextInput, } from "./Form/InputText/InputTextLF";
|
|
|
29
29
|
export { InputTextAtom } from "./Form/InputTextAtom/InputTextAtomLF";
|
|
30
30
|
export { ItemFile, itemFileVariants } from "./Form/ItemFile/ItemFileLF";
|
|
31
31
|
export { ItemLabel } from "./Form/ItemLabel/ItemLabelLF";
|
|
32
|
-
export { ItemMessage } from "./Form/ItemMessage/ItemMessageLF";
|
|
32
|
+
export { ItemMessage, itemMessageVariants, type ItemMessageVariants, } from "./Form/ItemMessage/ItemMessageLF";
|
|
33
33
|
export { CardRadio } from "./Form/Radio/CardRadio/CardRadioLF";
|
|
34
34
|
export { CardRadioOption } from "./Form/Radio/CardRadioOption/CardRadioOptionLF";
|
|
35
35
|
export { Radio } from "./Form/Radio/Radio/RadioLF";
|
package/dist/indexLF.js
CHANGED
|
@@ -28,7 +28,7 @@ InputText as TextInput, } from "./Form/InputText/InputTextLF";
|
|
|
28
28
|
export { InputTextAtom } from "./Form/InputTextAtom/InputTextAtomLF";
|
|
29
29
|
export { ItemFile, itemFileVariants } from "./Form/ItemFile/ItemFileLF";
|
|
30
30
|
export { ItemLabel } from "./Form/ItemLabel/ItemLabelLF";
|
|
31
|
-
export { ItemMessage } from "./Form/ItemMessage/ItemMessageLF";
|
|
31
|
+
export { ItemMessage, itemMessageVariants, } from "./Form/ItemMessage/ItemMessageLF";
|
|
32
32
|
export { CardRadio } from "./Form/Radio/CardRadio/CardRadioLF";
|
|
33
33
|
export { CardRadioOption } from "./Form/Radio/CardRadioOption/CardRadioOptionLF";
|
|
34
34
|
export { Radio } from "./Form/Radio/Radio/RadioLF";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-apollo-react",
|
|
3
|
-
"version": "2.0.4-alpha.
|
|
3
|
+
"version": "2.0.4-alpha.14",
|
|
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": "2.0.4-alpha.
|
|
50
|
-
"@axa-fr/design-system-look-and-feel-css": "2.0.4-alpha.
|
|
49
|
+
"@axa-fr/design-system-apollo-css": "2.0.4-alpha.14",
|
|
50
|
+
"@axa-fr/design-system-look-and-feel-css": "2.0.4-alpha.14",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"react": ">= 18"
|
|
53
53
|
},
|